import { type ParsedDomain } from "../server/utils/domain-parser.js"; import type { TokenCache } from "./cache/types.js"; import { type ProxyServerTiming } from "./server-timing.js"; export declare const INTERNAL_PROXY_HEADERS: readonly ["x-token", "x-project-slug", "x-environment", "x-environment-id", "x-environment-name", "x-content-source-id", "x-forwarded-host", "x-project-path", "x-project-id", "x-release-id", "x-branch-id", "x-branch-name", "x-default-branch-name"]; export interface ProxyConfig { apiBaseUrl: string; apiClientId: string; apiClientSecret: string; previewApiClientId: string; previewApiClientSecret: string; apiToken?: string; localProjects?: Record; } export interface ProxyContext { token?: string; projectSlug?: string; projectId?: string; releaseId?: string; branchId?: string; branchName?: string; defaultBranchName?: string; environmentId?: string; environmentName?: string; environment: "preview" | "production"; contentSourceId: string; localPath?: string; host: string; requestAuthority?: string; parsedDomain: ParsedDomain; isLocalProject: boolean; error?: { status: number; message: string; slug?: string; redirectUrl?: string; }; } export interface ProxyLogger { debug: (msg: string, extra?: Record) => void; info: (msg: string, extra?: Record) => void; warn: (msg: string, extra?: Record) => void; error: (msg: string, error?: unknown, extra?: Record) => void; } export interface ProxyHandlerOptions { config: ProxyConfig; cache?: TokenCache; logger?: ProxyLogger; metadataFetch?: typeof fetch; metadataTimeoutMs?: number; metadataMaxInflight?: number; } export interface ProxyRequestOptions { url?: URL; timing?: ProxyServerTiming; } export interface ProxyRoutingInvalidation { projectId: string; projectSlug?: string; deploymentId?: string; environmentId?: string; environmentName?: string; releaseId?: string; } export interface ConfirmedProxyRoutingInvalidation extends ProxyRoutingInvalidation { projectSlug: string; environmentId: string; environmentName: string; releaseId: string; } export declare function createProxyHandler(options: ProxyHandlerOptions): { processRequest: (req: Request, options?: ProxyRequestOptions) => Promise; getTokenForApi: (req: Request, options?: ProxyRequestOptions) => Promise; getStats: () => Promise<{ hits: number; misses: number; size: number; type: string; }>; close: () => Promise; validateConfig: () => string[]; invalidateRoutingLookup: (input: ProxyRoutingInvalidation) => { evictedEntries: number; generation: number; }; invalidateAndConfirmRoutingLookup: (input: ConfirmedProxyRoutingInvalidation) => Promise; localProjects: Readonly>; }; export type ProxyHandler = ReturnType; export declare function createProxyContextHeaders(sourceHeaders: Headers, ctx: ProxyContext): Headers; export declare function injectContextHeaders(req: Request, ctx: ProxyContext): Request; //# sourceMappingURL=handler.d.ts.map