UNPKG

@enter-at/lambda-handlers

Version:

An opinionated Typescript package that facilitates specifying AWS Lambda handlers including input validation, error handling and response formatting.

15 lines (14 loc) 945 B
import { APIGatewayProxyResult } from "aws-lambda"; export interface APIGatewayResponse extends Omit<APIGatewayProxyResult, "body"> { body: unknown | undefined; } export declare function badRequest(details: string | undefined): APIGatewayResponse; export declare function forbidden(details: string | undefined): APIGatewayResponse; export declare function unauthorized(details: string | undefined): APIGatewayResponse; export declare function internalServerError(): APIGatewayResponse; export declare function notFound(details: string | undefined): APIGatewayResponse; export declare function requestTimeout(details: string | undefined): APIGatewayResponse; export declare function unprocessableEntity(details: string | undefined): APIGatewayResponse; export declare function ok<T>(result: T): APIGatewayResponse; export declare function created<T>(result: T): APIGatewayResponse; export declare function noContent<T>(): APIGatewayResponse;