diff --git a/adonis-typings/index.ts b/adonis-typings/index.ts index 801d7e1..d2baf8c 100644 --- a/adonis-typings/index.ts +++ b/adonis-typings/index.ts @@ -6,51 +6,58 @@ */ declare module '@ioc:Rlanz/Queue' { - import type { ConnectionOptions, WorkerOptions, QueueOptions, JobsOptions, Job, Queue as BullQueue } 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: string): Promise; - list(): Map; - get(queueName: string): BullQueue | undefined; - } - - 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 }; + import type { + ConnectionOptions, + WorkerOptions, + QueueOptions, + JobsOptions, + Job, + Queue as BullQueue, + } 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(queue: string): Promise + clear(queue: string): Promise + list(): Map + get(queueName: string): BullQueue | undefined + } + + 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 } }