import type { ClaimedDelivery, WebhookDeliveryRow } from '../types/index.js'; import { type NewDelivery } from './deliveryStore.js'; import { type WebhookTarget } from './matchWebhooks.js'; export type EnqueueDeps = { getTargets: () => Promise; recordEnqueued: (webhookId: number, count: number) => void; sanitize: (data: unknown) => Promise; insert: (rows: NewDelivery[]) => Promise; claim: (ids: number[]) => Promise; deliver: (delivery: ClaimedDelivery) => Promise; warn: (message: string) => void; logError: (e: unknown) => void; now: () => Date; newId: () => string; }; /** * The write-first half of the webhook pipeline, called by the wildcard * subscriber for every event. * * 1. find the enabled webhooks that want this topic (cached), * 2. skip any webhook already at the pending ceiling (backlog guard), * 3. strip secrets from the payload, * 4. INSERT one `webhook_delivery` row per webhook <- from here the event * itself no longer matters; the row owns delivery and retries, * 5. claim those rows and make the first attempt now. */ export declare function enqueueDeliveries(topic: string, data: unknown, eventUuid: string | null, deps?: EnqueueDeps): Promise<{ enqueued: number; skipped: number; }>;