/** * @rlanz/bull-queue * * @license MIT * @copyright Romain Lanz */ declare module '@ioc:Rlanz/Queue' { import type { ConnectionOptions, Job, JobsOptions, Queue as BullQueue, QueueOptions, WorkerOptions } from 'bullmq'; export type DataForJob = K extends keyof JobsList ? JobsList[K] : Record; export type DispatchOptions = JobsOptions & { queueName?: 'default' | string; }; export type QueueConfig = { connection: ConnectionOptions; queue: Omit; worker: Omit; jobs: JobsOptions; }; interface QueueContract { dispatch(job: K, payload: DataForJob, options?: DispatchOptions): Promise; dispatch(job: K, payload: DataForJob, options?: DispatchOptions): Promise; process(): Promise; clear(queue: K): Promise; list(): Promise>; get(): Promise; getQueue(queueName?: 'default' | string): BullQueue; } export interface JobHandlerContract { handle(payload: any): Promise; failed(): Promise; } /** * An interface to define typed queues/jobs */ export interface JobsList { } export const Queue: QueueContract; export { Job }; }