import { E as EmailOptions, a as EmailResult, R as Result } from "../packem_shared/types.d-CyiC9uRC.js"; import { E as EnqueueOptions } from "../packem_shared/types.d-B5iH_mgb.js"; import 'node:buffer'; /** * The subset of a [BullMQ](https://docs.bullmq.io/) `Queue` this adapter uses. */ interface BullmqQueueLike { add: (name: string, data: unknown, options?: { delay?: number; }) => Promise<{ id?: string; }>; } /** * A BullMQ job, narrowed to its `data` payload. */ interface BullmqJobLike { data: EmailOptions; } /** * A BullMQ `Worker` processor that sends a job's message and resolves with the send result. */ type BullmqProcessor = (job: BullmqJobLike) => Promise; /** * Adds a message to a BullMQ queue. * * BullMQ is push-based — jobs are consumed by a BullMQ `Worker`, not the pull-based reserve/ack model * of `EmailQueue`. Use this to enqueue and {@link createBullmqProcessor} to consume. * @param queue A BullMQ `Queue` instance to add the job to (optional peer). * @param message The email payload stored as the BullMQ job data. * @param options Optional scheduling — `scheduledAt` maps to a BullMQ `delay`. * @param jobName The name to enqueue the job under. * @returns The id of the created BullMQ job. */ declare const enqueueToBullmq: (queue: BullmqQueueLike, message: EmailOptions, options?: EnqueueOptions, jobName?: string) => Promise; /** * Builds a BullMQ `Worker` processor that sends each job's message via the given send function. * * Pass it to `new Worker(queueName, createBullmqProcessor(mail.send.bind(mail)), { concurrency })`. * BullMQ then handles concurrency, retries (via the job's `attempts`/`backoff`) and dead-lettering. A * failed send throws so BullMQ records the attempt. * @param send The send function — typically `mail.send.bind(mail)`. * @returns A BullMQ processor function. */ declare const createBullmqProcessor: (send: (message: EmailOptions) => Promise>) => BullmqProcessor; export { BullmqJobLike, BullmqProcessor, BullmqQueueLike, createBullmqProcessor, enqueueToBullmq };