import { AsyncLocalStorage } from 'node:async_hooks';
import { RequestHandler } from 'express';
/**
 * Name of the header carrying the unique request ID issued by AMO.
 */
export declare const AMO_REQUEST_ID_HEADER = "X-AMO-Request-ID";
/**
 * Data kept around for the duration of a single request.
 *
 * @property requestId - The value of the incoming `X-AMO-Request-ID` header, or
 *   a generated UUID when the header is absent.
 */
export type RequestContext = {
    requestId?: string;
};
export declare const requestContextStorage: AsyncLocalStorage<RequestContext>;
/**
 * Return the `X-AMO-Request-ID` of the request currently being handled, or
 * `undefined` when there is no active request context (e.g. outside of the
 * Express middleware chain).
 */
export declare const getRequestId: () => string | undefined;
/**
 * Return a copy of `headers` with the `X-AMO-Request-ID` header added when a
 * request ID is available in the current context. When no request ID is in
 * scope, `headers` is returned unchanged.
 */
export declare const withRequestIdHeader: (headers?: Record<string, string>) => Record<string, string>;
/**
 * Express middleware that captures the AMO request ID from the incoming
 * `X-AMO-Request-ID` header (generating a UUID when it is absent), exposes it
 * on `req.amoRequestId`, and runs the rest of the middleware chain inside a
 * request context so the ID stays available for the duration of the request
 * and can be echoed back on every outgoing AMO API call.
 */
export declare const requestIdMiddleware: RequestHandler;
