/** * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * This module defines types, enums and interfaces common to the other modules. */ /// import { IncomingHttpHeaders } from "http"; export interface InvocationResponse { bodyJson: string; headers: IncomingHttpHeaders; } export interface NativeClient { initializeClient: (userAgent: string) => void; done: (id: string, bodyString: string) => void; error: (id: string, bodyString: string, xrayString: string) => void; next: () => Promise; } export declare enum INVOKE_HEADER { ClientContext = "lambda-runtime-client-context", CognitoIdentity = "lambda-runtime-cognito-identity", ARN = "lambda-runtime-invoked-function-arn", AWSRequestId = "lambda-runtime-aws-request-id", DeadlineMs = "lambda-runtime-deadline-ms", XRayTrace = "lambda-runtime-trace-id" } export interface IEnvironmentData { functionVersion?: string; functionName?: string; memoryLimitInMB?: string; logGroupName?: string; logStreamName?: string; } export interface IHeaderData { clientContext?: string; identity?: string; invokedFunctionArn?: string; awsRequestId?: string; getRemainingTimeInMillis: () => number; } export declare type ErrorStringOrUndefined = Error | string | undefined; export declare type ErrorStringOrUndefinedOrNull = ErrorStringOrUndefined | null; /** * */ export interface ICallbackContext { callbackWaitsForEmptyEventLoop: boolean; succeed: (result: unknown) => void; fail: (err: ErrorStringOrUndefinedOrNull) => void; done: (err: ErrorStringOrUndefinedOrNull, result?: unknown) => void; } export declare type CallbackFunction = (err: ErrorStringOrUndefinedOrNull, result?: unknown) => void; export interface IBeforeExitListener { invoke: () => void; reset: () => () => void; set: (listener: () => void) => () => void; } export interface IErrorCallbacks { uncaughtException: (err: Error) => void; unhandledRejection: (err: Error) => void; } export declare type HandlerFunction = (body: unknown, data: IEnvironmentData & IHeaderData, callback: CallbackFunction) => PromiseLike | unknown; export declare function isHandlerFunction(value: any): value is HandlerFunction; //# sourceMappingURL=index.d.ts.map