import type { HttpContractConfig } from "../contracts/index.js"; import { type MemoInstrumentationEvent } from "../memo/index.js"; import type { AnyPorts } from "../ports/index.js"; import type { ContextSeed } from "./context.js"; import type { Handler, HttpRequestLike, HttpResponse, RouteHook, ServerCaughtErrorHook, ServerHook, ServerUnhandledErrorMapper } from "./http.js"; import type { ServerInstrumentationOptions } from "./instrumentation.js"; import { type RequestBodyOptions } from "./request-preparation.js"; import { type CompiledPath } from "./route-matching.js"; import type { TrustedRequestInfo } from "./trusted-proxy.js"; type RequestExecutorOptions = { instrumentation?: ServerInstrumentationOptions | false; validateResponses?: boolean; requestBody?: RequestBodyOptions; onCaughtError?: ServerCaughtErrorHook; mapUnhandledError?: ServerUnhandledErrorMapper; }; type ExecutionTarget = { contract: C; /** * Compiled route pattern. Only required when the executor is invoked * without pre-matched params. */ compiled?: CompiledPath; handler: Handler; /** * Success status whose response schema validation is skipped because the * use case bound to this route already validated its output against the * same schema object. */ responseValidationExemptStatus?: number; }; /** * Build the per-request execution pipeline once. * * The returned executor takes the contract, compiled pattern, and user handler * per invocation so fallback responses (404/405) can reuse a single pipeline * across requests instead of rebuilding it per unmatched request. */ export declare function createRequestExecutor(options: RequestExecutorOptions, finalPorts: FinalPorts, contextRuntime: { createRequestContext: (req: HttpRequestLike, contract: HttpContractConfig, requestInfo: TrustedRequestInfo) => Promise; finalizeContext: (seed: ContextSeed | Ctx) => Ctx; resolveRequestInfo: (req: HttpRequestLike) => TrustedRequestInfo; }, hooks: ServerHook[], routeHooks?: readonly RouteHook[], optionsOverrides?: { skipRoutePreparation?: boolean; /** * Run the route through the full hook pipeline without contract * preparation: no query/path/header/body parsing or validation, and the * request body is left unconsumed for the handler. */ rawRoute?: boolean; }): (target: ExecutionTarget, req: HttpRequestLike, preMatchedParams?: Record) => Promise; /** * Build a memo instrumentation recorder from the app ports, or undefined when * no instrumentation sink is wired. * * Resolved per execution rather than at route-build time because providers * contribute `ports.instrumentation`/`ports.devtools` during setup, after * routes are registered. */ export declare function createMemoScopeRecorder(ports: AnyPorts): ((event: MemoInstrumentationEvent) => void) | undefined; export declare function buildHandler(options: RequestExecutorOptions, finalPorts: FinalPorts, contextRuntime: { createRequestContext: (req: HttpRequestLike, contract: HttpContractConfig, requestInfo: TrustedRequestInfo) => Promise; finalizeContext: (seed: ContextSeed | Ctx) => Ctx; resolveRequestInfo: (req: HttpRequestLike) => TrustedRequestInfo; }, contract: C, userHandler: Handler, hooks: ServerHook[], routeHooks?: readonly RouteHook[], optionsOverrides?: { skipRoutePreparation?: boolean; /** * Run the route through the full hook pipeline without contract * preparation: no query/path/header/body parsing or validation, and the * request body is left unconsumed for the handler. */ rawRoute?: boolean; }, responseValidationExemptStatus?: number): (req: HttpRequestLike, preMatchedParams?: Record) => Promise; export {}; //# sourceMappingURL=request-executor.d.ts.map