// Type definitions for lambda-wrapper 0.3 // Project: https://github.com/nordcloud/lambda-wrapper // Definitions by: Gaelan Steele // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Minimum TypeScript Version: 3.3 import { Handler, Context, Callback } from 'aws-lambda'; export interface Wrapped { // None of these functions resolve the promise if a callback is present, so prohibit using both. run(event: TEvent, context: Partial, callback: Callback): void; run(event: TEvent, callback: Callback): void; run(event: TEvent, context?: Partial): Promise; runHandler(event: TEvent, context: Partial, callback?: Callback): void; runHandler(event: TEvent, context: Partial): Promise; } export function wrap( mod: { [name in THandlerName]: Handler }, options?: { handler?: THandlerName }, ): Wrapped; export function wrap(mod: { lambdaFunction: string; region: string }, options?: {}): Wrapped; // Legacy (pre-v0.1) API for backwards compatibility export function init(mod: any, options: any): void; export function run(event: any, context: Partial, callback: Callback): Promise; export function run(event: any, callback: Callback): Promise;