@smooai/utils
Version:
A collection of shared utilities and tools used across SmooAI projects. This package provides common functionality to standardize and simplify development across all SmooAI repositories.
15 lines (12 loc) • 1.03 kB
TypeScript
import { APIGatewayProxyStructuredResultV2, APIGatewayProxyEventV2, Context, EventBridgeEvent, SQSEvent } from 'aws-lambda';
type LambdaResponseOrError<T = any> = Omit<APIGatewayProxyStructuredResultV2, 'body'> & {
body?: T | string | {
error: {
message: string;
} & Record<string, any>;
};
};
declare function lambdaApiHandler<T = any>(event: APIGatewayProxyEventV2, context: Context, handler: (event: APIGatewayProxyEventV2, context: Context) => Promise<LambdaResponseOrError<T>>): Promise<APIGatewayProxyStructuredResultV2>;
declare function eventBridgeHandler(event: EventBridgeEvent<any, any>, context: Context, handler: (event: EventBridgeEvent<any, any>, context: Context) => Promise<void>): Promise<void>;
declare function sqsHandler(event: SQSEvent, context: Context, handler: (event: SQSEvent, context: Context) => Promise<PromiseSettledResult<void>[]>): Promise<PromiseSettledResult<void>[]>;
export { type LambdaResponseOrError, eventBridgeHandler, lambdaApiHandler, sqsHandler };