import logger from 'lambda-log'; import { CognitoAuthorizer, JwtAuthorizer } from './auth'; /** * An object containing the properties for an HTTP response. */ export interface HttpResponseContext { statusCode?: number; headers: { [name: string]: string; }; json: boolean; } /** * An object containing the properties for an HTTP request handler. */ export interface HttpHandlerContext { event: AWSLambda.APIGatewayProxyWithCognitoAuthorizerEvent; lambdaContext: AWSLambda.Context; logger: logger.LambdaLog; response: HttpResponseContext; auth: JwtAuthorizer; } /** * A type definition for an HTTP handler. */ export type HttpHandler = (context: HttpHandlerContext, body: T) => Promise; /** * An object containing the properties for an OpenAPI operation. */ export interface Operation { responses: { [statusCode: number]: { content: { 'application/json': any; }; } | any; }; } /** * A type definition for an API Gateway v1 request handler. */ export type APIGatewayv1Handler = AWSLambda.Handler; /** * An object containing the properties for an OpenAPI operation with a request body. */ export interface OperationWithRequestBody extends Operation { requestBody: { content: { 'application/json': any; }; }; } /** * A factory function that creates an HTTP request handler for an OpenAPI operation with a request body. */ export declare const createOpenApiHandlerWithRequestBody: (handler: HttpHandler) => APIGatewayv1Handler; /** * A factory function that creates an HTTP request handler for an OpenAPI operation with a request body and no response. */ export declare const createOpenApiHandlerWithRequestBodyNoResponse: (handler: HttpHandler) => APIGatewayv1Handler; /** * A factory function that creates an HTTP request handler for an OpenAPI operation. */ export declare const createOpenApiHandler: (handler: HttpHandler) => APIGatewayv1Handler; /** * A factory function that creates an HTTP request handler. */ export declare const createHttpHandler: (handler: HttpHandler) => APIGatewayv1Handler; /** * The context for the AppSync resolver function. * Contains information about the event, lambda context, logger, and Cognito authorizer. */ export interface AppSyncHandlerContext { event: AWSLambda.AppSyncResolverEvent; lambdaContext: AWSLambda.Context; logger: logger.LambdaLog; cognitoAuth: CognitoAuthorizer; } /** * A function that handles an AppSync resolver event. * Receives the context object and returns the response. */ export type AppSyncHandler = (context: AppSyncHandlerContext) => Promise; /** * Creates an AppSync resolver handler from the given AppSyncHandler. * Returns a function that can be used as an AppSync resolver. * * @param handler The AppSyncHandler to use as the resolver. */ export declare const createAppSyncHandler: (handler: AppSyncHandler) => import("aws-lambda").AppSyncResolverHandler | null>;