import { type ContextPlugin } from "@nifrajs/core/server"; export interface RequestIdOptions { /** Header read for an inbound id (trace propagation) + echoed on the response. Default `"x-request-id"`. */ readonly header?: string; /** Generate an id when the inbound header is absent. Default `crypto.randomUUID()`. */ readonly generate?: () => string; } /** * A {@link defineContextPlugin} plugin that gives every request a stable id: it reuses an inbound * `x-request-id` (or generates one), exposes it on the handler context as **`c.requestId`** (typed, * threaded by `derive`), and echoes it on EVERY response leaving the app - handler-returned raw * `Response`s and redirects, `onRequest` short-circuits (an auth 401, an admission 429), and * framework-generated 404/405/422/timeout responses included. Core deliberately does not merge * `c.set.headers` onto a handler-returned `Response`, so the echo lives in an app-global * `onResponse` hook (paired with the derive through a `WeakMap` keyed on the request) with a node * twin, keeping the Node adapter on its direct writer with no request-walk cost. Idempotent - * applying it twice is a no-op. * * ```ts * app.use(requestId()) // c.requestId available downstream; X-Request-Id on responses * ``` */ export declare function requestId(options?: RequestIdOptions): ContextPlugin<{ requestId: string; }>; //# sourceMappingURL=request-id.d.ts.map