import type { Handler } from 'aws-lambda'; /** * A type that represents a synchronous Lambda handler. * * @deprecated Use {@link AsyncHandler} instead. */ type SyncHandler = (event: Parameters[0], context: Parameters[1], callback: Parameters[2]) => void; /** * A type that represents an asynchronous Lambda handler. */ type AsyncHandler = (event: Parameters[0], context: Parameters[1]) => Promise[2]>[1]>>; /** * An interface that represents an object-oriented Lambda handler. * * @example * ```typescript * import type { Context } from 'aws-lambda'; * import type { LambdaInterface } from '@aws-lambda-powertools/commons/types'; * * class Lambda implements LambdaInterface { * public handler = async (event: unknown, context: Context) => { * // Your handler code here * } * } * * const handlerClass = new Lambda(); * export const handler = lambda.handler.bind(lambda); * ``` */ interface LambdaInterface { handler: SyncHandler | AsyncHandler; } /** * A decorator function that can be used to decorate a method in a class that implements the `LambdaInterface`. */ type HandlerMethodDecorator = (target: LambdaInterface, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor> | TypedPropertyDescriptor>) => void; export type { AsyncHandler, SyncHandler, LambdaInterface, HandlerMethodDecorator, }; //# sourceMappingURL=LambdaInterface.d.ts.map