import { a as NotificationMessage } from "../packem_shared/notification.d-D0ado_cy.js"; import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-r8K0ICyx.js"; import "../packem_shared/types.d-CRs03TYV.js"; import "../packem_shared/types.d-C7l7qdMG.js"; import "../packem_shared/provider.d-Dh32nRm9.js"; /** * A pg-boss job fetched with `includeMetadata`, narrowed to the members this adapter reads. */ interface PgBossJobLike { data: unknown; id: string; /** pg-boss retry count (present when fetched with `includeMetadata`). */ retryCount?: number; } /** * The subset of a [pg-boss](https://github.com/timgit/pg-boss) instance this adapter uses (v10 API). * Typed structurally so the `pg-boss` optional peer is never imported — pass a started `PgBoss` instance. */ interface PgBossLike { complete: (name: string, id: string) => Promise; fail: (name: string, id: string) => Promise; fetch: (name: string, options?: { batchSize?: number; includeMetadata?: boolean; }) => Promise; getQueueSize: (name: string) => Promise; send: (name: string, data: object, options?: { startAfter?: Date; }) => Promise; } /** * Options for {@link createPgBossQueue}. */ interface PgBossQueueOptions { /** The pg-boss queue name. */ queueName: string; } /** * A {@link NotificationQueue} backed by [pg-boss](https://github.com/timgit/pg-boss) (Postgres, v10 API). * * Pass a started pg-boss instance — `pg-boss` is an optional peer dependency and is never started here. * `reserve` uses `fetch` with `includeMetadata`, so the job's `attempts` is pg-boss's own * `retryCount` plus the current delivery (1 on first reserve, matching the other adapters). * `retry` calls `fail`, so the retry delay is governed by the queue's pg-boss retry policy * rather than the `delayMs` argument. * * Runtime: NODE ONLY (requires a Postgres connection). Not Cloudflare Workers compatible. */ declare class PgBossQueue implements NotificationQueue { #private; constructor(boss: PgBossLike, options: PgBossQueueOptions); enqueue(message: NotificationMessage, options?: { scheduledAt?: number; }): Promise; reserve(): Promise; ack(id: string): Promise; retry(id: string): Promise; size(): Promise; } /** * Convenience factory for {@link PgBossQueue}. * @param boss A started pg-boss instance (optional peer). * @param options Queue options. See {@link PgBossQueueOptions}. * @returns A new {@link PgBossQueue}. */ declare const createPgBossQueue: (boss: PgBossLike, options: PgBossQueueOptions) => PgBossQueue; export { type PgBossJobLike, type PgBossLike, PgBossQueue, PgBossQueueOptions, createPgBossQueue };