export interface SseMessage { /** Event payload. Non-strings are JSON-serialized. */ data: unknown; /** Optional `event:` name. */ event?: string; /** Optional `id:` for last-event-id resumption. */ id?: string; /** Optional client reconnect hint in ms (`retry:`). */ retry?: number; } /** A callback source: receives an emitter, returns an optional cleanup fn. */ export type SseSubscribe = (emit: (message: SseMessage) => void) => void | (() => void) | Promise void)>; export type SseSource = AsyncIterable | SseSubscribe; export interface SseResponseOptions { /** Heartbeat comment interval in ms to keep the connection alive. Default 15000. Set 0 to disable. */ heartbeatMs?: number; /** Extra response headers. */ headers?: Record; } /** * A first-class Server-Sent Events response. Return one from a route handler and * the router streams it with the correct headers, a keep-alive heartbeat, and * automatic cleanup when the client disconnects. * * ```ts * @Get('/events') * events() { * return new SseResponse((emit) => { * const t = setInterval(() => emit({ event: 'tick', data: { at: Date.now() } }), 1000); * return () => clearInterval(t); * }); * } * ``` */ export declare class SseResponse { private readonly source; private readonly options; constructor(source: SseSource, options?: SseResponseOptions); /** Materialize the streaming `Response`. Called by the router. */ toResponse(): Response; } //# sourceMappingURL=sse-response.d.ts.map