/** * `DeadLetterSink` — destination for messages whose handler exhausted retries. * * The runtime calls `sink(entry)` once per failed dispatch after `max + 1` * attempts have all thrown. Production wires plug in a real DLQ (BullMQ's * failed-jobs board, a Mongo collection, an SNS topic). Default is in-memory: * collect every entry so tests can assert on what got dead-lettered. */ import type { MessageEnvelope } from "@nwire/envelope"; export interface DeadLetterEntry { readonly actionName: string; readonly input: unknown; readonly envelope: MessageEnvelope; readonly attempts: number; readonly lastError: { name: string; message: string; stack?: string; }; readonly enteredAt: string; } export interface DeadLetterSink { record(entry: DeadLetterEntry): Promise; /** Return everything dead-lettered so far. Test/dev introspection. */ list(): Promise; } export declare class InMemoryDeadLetterSink implements DeadLetterSink { private readonly entries; record(entry: DeadLetterEntry): Promise; list(): Promise; clear(): void; } /** * Build a DeadLetterEntry from a thrown error and the dispatch state. */ export declare function buildDeadLetterEntry(actionName: string, input: unknown, envelope: MessageEnvelope, attempts: number, error: unknown): DeadLetterEntry;