{"version":3,"sources":["../../src/jobs/adapters/base.ts"],"sourcesContent":["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":"AAEO,IAAKA,OACXA,EAAA,QAAU,UACVA,EAAA,cAAgB,gBAChBA,EAAA,WAAa,aAHFA,OAAA,IAcUC,EAAf,KAAmB,CACzBC,GAAyC,CAAC,EAC1CC,GAA2B,CAAC,EAO5B,IAAI,WAAY,CACf,OAAO,KAAKA,EACb,CACA,IAAI,UAAUC,EAA4B,CACzC,KAAKD,GAAaC,CACnB,CACA,IAAI,OAAQ,CACX,OAAO,KAAKF,EACb,CACA,IAAI,MAAMG,EAA0C,CACnD,KAAKH,GAASG,CACf,CACD","names":["JobNames","Job","#crons","#callbacks","newCallbacks","newCrons"]}