{"version":3,"sources":["../../../src/jobs/index.ts","../../../src/jobs/adapters/base.ts"],"sourcesContent":["export * from './adapters/base'\n","import type { CronTypes, DelayedJobs, RepeatableJobs } from '../../types'\n\nexport enum JobNames {\n\tCronJob = 'CronJob',\n\tRepeatableJob = 'RepeatableJob',\n\tDelayedJob = 'DelayedJob',\n}\n\nexport type Cron = CronTypes[keyof CronTypes]\nexport type DelayedJobEvent = DelayedJobs[keyof DelayedJobs]\nexport type RepeatableJobEvent = RepeatableJobs[keyof RepeatableJobs]\nexport type DelayedJobCallback = (data: DelayedJobEvent) => Promise<void> | void\nexport type CronJobCallback = (name: CronTypes[keyof CronTypes]) => Promise<void> | void\nexport type RepeatableJobCallback = (data: RepeatableJobEvent) => Promise<void> | void\nexport type JobCallbacks = { onDelayed?: DelayedJobCallback; onCron?: CronJobCallback; onRepeatable?: RepeatableJobCallback }\n\nexport abstract class Job {\n\t#crons: { name: Cron; cron: string }[] = []\n\t#callbacks: JobCallbacks = {}\n\n\tabstract addDelayed(data: DelayedJobEvent, delayInMs: number): Promise<string>\n\tabstract addRepeatable(data: RepeatableJobEvent, cron: string, tz?: string): Promise<string>\n\tabstract removeDelayed(jobId: string): Promise<void>\n\tabstract retryAllFailedJobs(): Promise<void>\n\n\tget callbacks() {\n\t\treturn this.#callbacks\n\t}\n\tset callbacks(newCallbacks: JobCallbacks) {\n\t\tthis.#callbacks = newCallbacks\n\t}\n\tget crons() {\n\t\treturn this.#crons\n\t}\n\tset crons(newCrons: { name: Cron; cron: string }[]) {\n\t\tthis.#crons = newCrons\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAK,WAAL,kBAAKA,cAAL;AACN,EAAAA,UAAA,aAAU;AACV,EAAAA,UAAA,mBAAgB;AAChB,EAAAA,UAAA,gBAAa;AAHF,SAAAA;AAAA,GAAA;AAcL,IAAe,MAAf,MAAmB;AAAA,EACzB,SAAyC,CAAC;AAAA,EAC1C,aAA2B,CAAC;AAAA,EAO5B,IAAI,YAAY;AACf,WAAO,KAAK;AAAA,EACb;AAAA,EACA,IAAI,UAAU,cAA4B;AACzC,SAAK,aAAa;AAAA,EACnB;AAAA,EACA,IAAI,QAAQ;AACX,WAAO,KAAK;AAAA,EACb;AAAA,EACA,IAAI,MAAM,UAA0C;AACnD,SAAK,SAAS;AAAA,EACf;AACD;","names":["JobNames"]}