/** * Thin adapters for platforms that do not expose a Web `fetch` handler directly. * * The app remains a Web-standard handler. These adapters only translate the platform event envelope; * they do not own identity, persistence, retries, or platform credentials. */ import type { Platform } from "./context.js"; import type { MaybePromise } from "./server.js"; export interface FetchApp { fetch(request: Request, platform?: Platform): MaybePromise; } export type VercelHandler = (request: Request) => MaybePromise; /** Adapt a Web-standard app to a Vercel Edge Function default export. */ export declare function toVercelHandler(app: FetchApp): VercelHandler; type HeaderValue = string | readonly string[] | undefined; type HeaderRecord = Readonly>; export interface NetlifyEvent { readonly httpMethod: string; readonly path: string; readonly rawUrl?: string; readonly rawQuery?: string; readonly headers?: HeaderRecord; readonly multiValueHeaders?: HeaderRecord; readonly body?: string | null; readonly isBase64Encoded?: boolean; readonly cookies?: readonly string[]; } export interface PlatformResponse { readonly statusCode: number; /** Single-valued headers. `set-cookie` never appears here - see the two fields below. */ readonly headers: Readonly>; /** * Repeated headers, currently only `set-cookie`. Netlify Functions and API Gateway REST (v1) read * this; omitted when the response sets no cookies. */ readonly multiValueHeaders?: Readonly>; /** API Gateway HTTP API (v2) takes cookies here rather than in a header. Omitted when there are none. */ readonly cookies?: readonly string[]; readonly body: string; readonly isBase64Encoded: true; } export type NetlifyHandler = (event: NetlifyEvent) => Promise; /** Adapt a Web-standard app to a Netlify Functions event handler. */ export declare function toNetlifyHandler(app: FetchApp): NetlifyHandler; export interface LambdaV2Event { readonly version?: "2.0"; readonly rawPath?: string; readonly rawQueryString?: string; readonly headers?: HeaderRecord; readonly cookies?: readonly string[]; readonly body?: string | null; readonly isBase64Encoded?: boolean; readonly requestContext?: { readonly domainName?: string; readonly http?: { readonly method: string; readonly path?: string; }; }; } export interface LambdaV1Event { readonly httpMethod: string; readonly path: string; readonly headers?: HeaderRecord; readonly multiValueHeaders?: HeaderRecord; readonly queryStringParameters?: Readonly>; readonly multiValueQueryStringParameters?: Readonly>; readonly body?: string | null; readonly isBase64Encoded?: boolean; readonly requestContext?: { readonly domainName?: string; }; } export type LambdaEvent = LambdaV2Event | LambdaV1Event; export type LambdaResponse = PlatformResponse; export type LambdaHandler = (event: LambdaEvent, context?: unknown) => Promise; /** Adapt API Gateway HTTP API (v2) and REST API (v1) events to a Web-standard app. */ export declare function toLambdaHandler(app: FetchApp): LambdaHandler; export {}; //# sourceMappingURL=platform-adapters.d.ts.map