UNPKG

@mountainpass/server-agnostic-functions-aws

Version:

Provides an interface for writing server-agnostic (serverless) functions.

16 lines (15 loc) 778 B
import { HttpRequest, HttpResponse } from '@mountainpass/server-agnostic-functions-core'; import { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, Context } from 'aws-lambda'; export type AwsRequest = { context: Context; event: APIGatewayProxyEvent | APIGatewayProxyEventV2; }; export type AwsHandler = (event: any, context: Context) => Promise<APIGatewayProxyResult>; /** * Maps from an Aws APIGatewayProxyEvent v1/v2 to a HttpRequest. * @param untypedEvent * @param context * @returns */ export declare const mapRequest: <UnderlyingRequest = any>(untypedEvent: any, context: Context, request?: HttpRequest) => HttpRequest<UnderlyingRequest>; export declare const mapResponse: (response: HttpResponse) => APIGatewayProxyResult;