/** * Handler Context Builder Module * * Builds the HandlerContext object that is passed to all route handlers. * Combines information from various sources into a unified context. * * @module server/runtime-handler/handler-context-builder */ import type { RuntimeAdapter } from "../../platform/adapters/base.js"; import type { VeryfrontConfig } from "../../config/index.js"; import type { SecurityConfig } from "../../types/index.js"; /** CSP user header type (from SecurityConfigLoader, string or null) */ import type { ParsedDomain } from "../utils/domain-parser.js"; import type { HandlerContext } from "../handlers/types.js"; import type { RouteRegistry } from "../../routing/registry/index.js"; import type { ApplicationIdentity } from "../../security/application-auth/types.js"; export interface HandlerContextOptions { /** Project directory */ projectDir: string; /** Runtime adapter */ adapter: RuntimeAdapter; /** Security config */ securityConfig: SecurityConfig | null; /** Browser-visible HTTP(S) origin resolved at the trusted request boundary. */ requestOrigin: string | null; /** CSP user header */ /** Debug mode */ debug: boolean | undefined; /** Veryfront config */ config: VeryfrontConfig | undefined; /** Parsed domain info */ parsedDomain: ParsedDomain; /** Project slug */ projectSlug: string | undefined; /** Project ID */ projectId: string | undefined; /** Release ID */ releaseId: string | undefined; /** Canonical branch ID from the trusted proxy boundary. */ branchId?: string; /** Canonical branch name from the trusted proxy boundary. */ branchName?: string; /** Canonical project default branch name from the trusted proxy boundary. */ defaultBranchName?: string; /** Proxy token (undefined for local projects) */ proxyToken: string | undefined; /** Environment name */ environmentName: string | undefined; /** Resolved environment */ resolvedEnvironment: "preview" | "production"; /** Request context (from createRequestContext) */ requestContext: import("../context/request-context.js").RequestContext; /** Route registry */ routeRegistry: RouteRegistry; /** Whether this is a local project */ isLocalProject: boolean; /** Narrow host-owned capability for project-code execution. */ allowHostProjectCodeExecution?: boolean; /** Whether this request is executing in the shared multi-project proxy runtime. */ isProxyMode: boolean; /** Module server URL */ moduleServerUrl: string | undefined; /** Canonical environment ID resolved at the operator-authenticated proxy boundary. */ environmentId: string | undefined; /** Verified application identity admitted by the host-owned auth boundary. */ applicationIdentity?: ApplicationIdentity | null; /** Application-auth identity headers to strip before project code sees the request. */ applicationIdentityHeaderNames?: readonly string[]; /** Skip render-specific enriched context requirements for non-render control-plane routes */ skipEnrichedContext?: boolean; /** * Prepares the authenticated hosted evaluation context for this request. * Supplied only for shared multi-project runtimes. */ prepareHostedConfigContext?: HandlerContext["prepareHostedConfigContext"]; } /** * Build the HandlerContext for route handlers. */ export declare function buildHandlerContext(opts: HandlerContextOptions): HandlerContext; /** * Build a minimal context for monitoring endpoints. */ export declare function buildMinimalContext(projectDir: string, adapter: RuntimeAdapter, securityConfig: SecurityConfig | null, debug: boolean | undefined, config: VeryfrontConfig | undefined, requestOrigin?: string | null): HandlerContext; //# sourceMappingURL=handler-context-builder.d.ts.map