/** * Registration-time route compilation. * * This module owns the policy decisions that turn a route declaration into the immutable facts the * execution-plan builder and the route catalog consume. It deliberately runs only from `Server.register` * and `Server.registerBatch`; no function here is reachable from the request path. * * The public Server remains the fluent registration surface. This module is the deep implementation seam * behind that surface: body limits, capability and assurance evidence, optional runtimes, decorations, and * lane selection are resolved once, together, so adding a new route policy does not require editing the * kernel's dispatch code. */ import type { EffectLifecycleObserver } from "../effect-lifecycle.js"; import { type CompiledRoutePattern } from "../router/pattern.js"; import type { Method } from "../router/router.js"; import type { StandardSchemaV1 } from "../schema/standard.js"; import type { RouteSchema } from "../server/context.js"; import type { IdempotencyRuntime, ResolvedIdempotency } from "../server/idempotency-lane.js"; import type { EffectLedgerRuntime, ResolvedEffectLedger } from "../server/ledger-lane.js"; import type { ResponseContractRuntime } from "../server/response-contract-lane.js"; import { type CapabilityUseEvent, type RegisteredCapabilityInterceptor } from "./capability-runtime.js"; import { type AssuranceDeclaration } from "./route-assurance.js"; import type { RawAfterHandle, RawAround, RawBeforeHandle, RawDerive, RawErrorHandler } from "./route-execution.js"; import { type RouteLaneSelection } from "./route-lanes.js"; export interface RouteCompilerContext { readonly maxBodyBytes: number; readonly activeAssurance: readonly AssuranceDeclaration[]; readonly globalAssurance: readonly AssuranceDeclaration[]; readonly decorations: Record; readonly onCapabilityUse: ((event: CapabilityUseEvent) => void) | undefined; readonly capabilityInterceptors: readonly RegisteredCapabilityInterceptor[]; readonly capabilityObservers: readonly EffectLifecycleObserver[]; readonly effectLedgerRuntime: EffectLedgerRuntime | undefined; readonly idempotencyRuntime: IdempotencyRuntime | undefined; readonly responseContractRuntime: ResponseContractRuntime | undefined; readonly derives: readonly RawDerive[]; readonly beforeHandleHooks: readonly RawBeforeHandle[]; readonly afterHandleHooks: readonly RawAfterHandle[]; readonly onErrorHooks: readonly RawErrorHandler[]; readonly aroundHooks: readonly RawAround[]; readonly defaultOnValidationError: RouteSchema["onValidationError"] | undefined; } export interface CompiledRouteOptions { readonly pattern: CompiledRoutePattern; readonly bodyLimit: number | undefined; readonly capabilities: readonly string[]; readonly handlerAssurance: readonly AssuranceDeclaration[]; readonly routeDecorations: Record; readonly hasDecorations: boolean; readonly idempotent: ResolvedIdempotency | undefined; readonly ledgered: ResolvedEffectLedger | undefined; readonly responseContract: { readonly runtime: ResponseContractRuntime; readonly schema: StandardSchemaV1; } | undefined; readonly lanes: RouteLaneSelection; readonly routeAssurance: readonly AssuranceDeclaration[]; } /** Resolve all registration-time policy and lane facts for one route. */ export declare function compileRouteOptions(context: RouteCompilerContext, method: Method, path: string, schema: RouteSchema | undefined, handler: (context: never) => unknown): CompiledRouteOptions; //# sourceMappingURL=route-compiler.d.ts.map