@swarmion/serverless-contracts
Version:
Generate and use type-safe contracts between your Serverless services.
19 lines • 2.78 kB
TypeScript
import { ApiGatewayHandler, EventBridgeContract, EventBridgeHandler, EventBridgePayloadType, GenericApiGatewayContract, SQSContract, SQSHandler, SwarmionEventBridgeHandler, SwarmionLambdaSQSHandler, SwarmionSQSHandler } from '../contracts';
import { GetApiGatewayHandlerOptions } from '../contracts/apiGateway/features';
import { BodyType, CustomRequestContextType, HeadersType, InternalSwarmionApiGatewayHandler, OutputType, PathParametersType, QueryStringParametersType } from '../contracts/apiGateway/types';
import { ApiGatewayAuthorizerType, ApiGatewayIntegrationType } from '../contracts/apiGateway/types/constants';
import { GetEventBridgeHandlerOptions } from '../contracts/eventBridge/features';
import { GetSQSHandlerOptions, SqsMessageAttributesType, SqsMessageBodyType } from '../contracts/SQS/types';
/**
* must match the type of getApiGatewayHandler
*/
export declare function getHandler<Contract extends GenericApiGatewayContract, IntegrationType extends ApiGatewayIntegrationType = Contract['integrationType'], AuthorizerType extends ApiGatewayAuthorizerType = Contract['authorizerType'], PathParameters = PathParametersType<Contract>, QueryStringParameters = QueryStringParametersType<Contract>, Headers = HeadersType<Contract>, CustomRequestContext = CustomRequestContextType<Contract>, Body = BodyType<Contract>, Output = OutputType<Contract>>(contract: Contract, options: GetApiGatewayHandlerOptions): <AdditionalArgs extends unknown[] = never[]>(handler: InternalSwarmionApiGatewayHandler<IntegrationType, AuthorizerType, PathParameters, QueryStringParameters, Headers, CustomRequestContext, Body, Output, AdditionalArgs>) => ApiGatewayHandler<IntegrationType, AuthorizerType, Output, AdditionalArgs>;
/**
* must match the type of getEventBridgeHandler
*/
export declare function getHandler<Contract extends EventBridgeContract, EventType extends string = Contract['eventType'], Payload = EventBridgePayloadType<Contract>>(contract: Contract, options: GetEventBridgeHandlerOptions): <AdditionalArgs extends unknown[]>(handler: SwarmionEventBridgeHandler<EventType, Payload, AdditionalArgs>) => EventBridgeHandler<EventType, Payload, AdditionalArgs>;
/**
* must match the type of getSQSHandler
*/
export declare function getHandler<Contract extends SQSContract, MessageBody = SqsMessageBodyType<Contract>, MessageAttributes = SqsMessageAttributesType<Contract>, HandleRecords extends boolean = true>(contract: Contract, options: GetSQSHandlerOptions<HandleRecords>): <AdditionalArgs extends unknown[]>(handler: HandleRecords extends false ? SwarmionLambdaSQSHandler<MessageBody, MessageAttributes, AdditionalArgs> : SwarmionSQSHandler<MessageBody, MessageAttributes, AdditionalArgs>) => SQSHandler<AdditionalArgs>;
//# sourceMappingURL=lambdaHandler.d.ts.map