diff --git a/src/classes/job-scheduler.ts b/src/classes/job-scheduler.ts index bd47466ce5..c728f50834 100644 --- a/src/classes/job-scheduler.ts +++ b/src/classes/job-scheduler.ts @@ -6,7 +6,11 @@ import { RepeatBaseOptions, RepeatOptions, } from '../interfaces'; -import { JobsOptions, RepeatStrategy } from '../types'; +import { + JobSchedulerTemplateOptions, + JobsOptions, + RepeatStrategy, +} from '../types'; import { Job } from './job'; import { QueueBase } from './queue-base'; import { RedisConnection } from './redis-connection'; @@ -32,7 +36,7 @@ export class JobScheduler extends QueueBase { repeatOpts: Omit, jobName: N, jobData: T, - opts: Omit, + opts: JobSchedulerTemplateOptions, { override }: { override: boolean }, ): Promise | undefined> { const { every, pattern } = repeatOpts; diff --git a/src/classes/queue.ts b/src/classes/queue.ts index 1525d13254..34cb1a4bd8 100644 --- a/src/classes/queue.ts +++ b/src/classes/queue.ts @@ -8,7 +8,12 @@ import { RepeatableJob, RepeatOptions, } from '../interfaces'; -import { FinishedStatus, JobsOptions, MinimalQueue } from '../types'; +import { + FinishedStatus, + JobsOptions, + JobSchedulerTemplateOptions, + MinimalQueue, +} from '../types'; import { Job } from './job'; import { QueueGetters } from './queue-getters'; import { Repeat } from './repeat'; @@ -433,7 +438,7 @@ export class Queue< jobTemplate?: { name?: NameType; data?: DataType; - opts?: Omit; + opts?: JobSchedulerTemplateOptions; }, ) { if (repeatOpts.endDate) { diff --git a/src/interfaces/job-scheduler-json.ts b/src/interfaces/job-scheduler-json.ts index 90796f5dd5..150d08873e 100644 --- a/src/interfaces/job-scheduler-json.ts +++ b/src/interfaces/job-scheduler-json.ts @@ -1,8 +1,8 @@ -import { JobsOptions } from '../types'; +import { JobSchedulerTemplateOptions } from '../types'; export interface JobSchedulerTemplateJson { data?: D; - opts?: Omit; + opts?: JobSchedulerTemplateOptions; } export interface JobSchedulerJson { diff --git a/src/types/index.ts b/src/types/index.ts index 7d30742ac9..c2ec6b49e8 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -3,5 +3,6 @@ export * from './finished-status'; export * from './minimal-queue'; export * from './job-json-sandbox'; export * from './job-options'; +export * from './job-scheduler-template-options'; export * from './job-type'; export * from './repeat-strategy'; diff --git a/src/types/job-scheduler-template-options.ts b/src/types/job-scheduler-template-options.ts new file mode 100644 index 0000000000..57bbfd6b31 --- /dev/null +++ b/src/types/job-scheduler-template-options.ts @@ -0,0 +1,6 @@ +import { JobsOptions } from './job-options'; + +export type JobSchedulerTemplateOptions = Omit< + JobsOptions, + 'jobId' | 'repeat' | 'delay' | 'deduplication' | 'debounce' +>;