UNPKG

@enter-at/lambda-handlers

Version:

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

18 lines (17 loc) 1 kB
import { APIGatewayProxyResult } from "aws-lambda"; type Details = string | string[] | undefined; export interface APIGatewayResponse extends Omit<APIGatewayProxyResult, "body"> { body: unknown | undefined; } export declare function badRequest(details: Details): APIGatewayResponse; export declare function forbidden(details: Details): APIGatewayResponse; export declare function unauthorized(details: Details): APIGatewayResponse; export declare function internalServerError(): APIGatewayResponse; export declare function notFound(details: Details): APIGatewayResponse; export declare function requestTimeout(details: Details): APIGatewayResponse; export declare function unprocessableEntity(details: Details): APIGatewayResponse; export declare function conflict(details: Details): APIGatewayResponse; export declare function ok<T>(result: T): APIGatewayResponse; export declare function created<T>(result: T): APIGatewayResponse; export declare function noContent(): APIGatewayResponse; export {};