import { O } from 'ts-toolbelt'; import { LambdaEvents } from '../../../types/lambdaEvents'; import { CleanEmptyObject } from '../../../types/utilities'; import { ApiGatewayAuthorizerType, ApiGatewayIntegrationType, ApiGatewayKey } from './constants'; import { GenericApiGatewayContract } from '../apiGatewayContract'; /** * map between our integration types (httpApi vs restApi) and * serverless's triggers */ type ApiGatewayTriggerKey = ApiGatewayIntegration extends 'httpApi' ? 'httpApi' : 'http'; /** * The type of an httpApi lambda trigger */ export type ApiGatewayLambdaCompleteTriggerType = { [key in ApiGatewayTriggerKey]: { path: string; method: string; } & ApiGatewayLambdaAdditionalConfigType, Contract['authorizerType']>; }; /** * basic additional config a user can define on an ApiGateway trigger. * * This doesn't include `path` and `method` as they are already defined in the contract itself. * * Also this does not take into account the authorizerType, do not use directly */ type ApiGatewayLambdaAdditionalConfigSimpleType = Omit>[IntegrationType], string>, 'path' | 'method'>; /** * represents additional config a user can define on an ApiGateway trigger. * * This doesn't include `path` and `method` as they are already defined in the contract itself. */ type ApiGatewayLambdaAdditionalConfigType = AuthorizerType extends undefined ? CleanEmptyObject, 'authorizer'>> : O.Required, 'authorizer'>; /** * the arguments array of the `getTrigger` function`, except the contract itself * * the trick here is that when the contract is authenticated, the additional config * is required, whereas otherwise it is optional */ export type ApiGatewayTriggerArgs = Contract['authorizerType'] extends undefined ? [ ApiGatewayLambdaAdditionalConfigType, Contract['authorizerType']> ] | [] : [ ApiGatewayLambdaAdditionalConfigType, Contract['authorizerType']> ]; export {}; //# sourceMappingURL=lambdaTrigger.d.ts.map