"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TriggerInvalidation=exports.Trigger=exports.InvocationType=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),path_1=require("path"),constructs_1=require("constructs"),core_1=require("../../core");var InvocationType;(function(InvocationType2){InvocationType2.EVENT="Event",InvocationType2.REQUEST_RESPONSE="RequestResponse",InvocationType2.DRY_RUN="DryRun"})(InvocationType||(exports.InvocationType=InvocationType={}));class Trigger extends constructs_1.Construct{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings.aws_cdk_lib_triggers_TriggerProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Trigger),error}const provider=core_1.CustomResourceProvider.getOrCreateProvider(this,"AWSCDK.TriggerCustomResourceProvider",{runtime:core_1.CustomResourceProviderRuntime.NODEJS_18_X,codeDirectory:(0,path_1.join)(__dirname,"lambda")});provider.addToRolePolicy({Effect:"Allow",Action:["lambda:InvokeFunction"],Resource:[`${props.handler.functionArn}:*`]}),new core_1.CustomResource(this,"Default",{resourceType:"Custom::Trigger",serviceToken:provider.serviceToken,properties:{HandlerArn:props.handler.currentVersion.functionArn,InvocationType:props.invocationType??"RequestResponse",Timeout:props.timeout?.toMilliseconds().toString()??core_1.Duration.minutes(2).toMilliseconds().toString(),ExecuteOnHandlerChange:props.executeOnHandlerChange??!0}}),this.executeAfter(...props.executeAfter??[]),this.executeBefore(...props.executeBefore??[])}executeAfter(...scopes){constructs_1.Node.of(this).addDependency(...scopes)}executeBefore(...scopes){for(const s of scopes)constructs_1.Node.of(s).addDependency(this)}}exports.Trigger=Trigger,_a=JSII_RTTI_SYMBOL_1,Trigger[_a]={fqn:"aws-cdk-lib.triggers.Trigger",version:"2.96.1"};var TriggerInvalidation;(function(TriggerInvalidation2){TriggerInvalidation2.HANDLER_CHANGE="WHEN_FUNCTION_CHANGES"})(TriggerInvalidation||(exports.TriggerInvalidation=TriggerInvalidation={}));
