import { APIGatewayEventDefaultAuthorizerContext, APIGatewayEventRequestContextWithAuthorizer, } from "../common/api-gateway"; import { Callback, Handler } from "../handler"; export type APIGatewayProxyHandler = Handler; export type APIGatewayProxyCallback = Callback; export type APIGatewayProxyEvent = APIGatewayProxyEventBase; export type APIGatewayProxyWithLambdaAuthorizerHandler = Handler, APIGatewayProxyResult>; export type APIGatewayProxyWithCognitoAuthorizerHandler = Handler; export type APIGatewayProxyWithLambdaAuthorizerEvent = APIGatewayProxyEventBase>; export type APIGatewayProxyWithLambdaAuthorizerEventRequestContext = APIGatewayEventRequestContextWithAuthorizer>; // API Gateway proxy integration mangles the context from a custom authorizer, // converting all number or boolean properties to string, and adding some extra properties. export type APIGatewayEventLambdaAuthorizerContext = { [P in keyof TAuthorizerContext]: TAuthorizerContext[P] extends null ? null : string; } & { principalId: string; integrationLatency: number; }; export type APIGatewayProxyWithCognitoAuthorizerEvent = APIGatewayProxyEventBase; // All claims are coerced into strings. export interface APIGatewayProxyCognitoAuthorizer { claims: { [name: string]: string; }; } export interface APIGatewayProxyEventBase { body: string | null; headers: { [name: string]: string }; multiValueHeaders: { [name: string]: string[] }; httpMethod: string; isBase64Encoded: boolean; path: string; pathParameters: { [name: string]: string } | null; queryStringParameters: { [name: string]: string } | null; multiValueQueryStringParameters: { [name: string]: string[] } | null; stageVariables: { [name: string]: string } | null; requestContext: APIGatewayEventRequestContextWithAuthorizer; resource: string; } export interface APIGatewayProxyResult { statusCode: number; headers?: { [header: string]: boolean | number | string; }; multiValueHeaders?: { [header: string]: Array; }; body: string; isBase64Encoded?: boolean; } // Legacy names export type ProxyHandler = APIGatewayProxyHandler; export type ProxyCallback = APIGatewayProxyCallback; export type APIGatewayEvent = APIGatewayProxyEvent; export type ProxyResult = APIGatewayProxyResult;