aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 2.3 kB
JavaScript
;var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Choice=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),state_type_1=require("./private/state-type"),state_1=require("./state"),chain_1=require("../chain");class Choice extends state_1.State{constructor(scope,id,props={}){super(scope,id,props),this.endStates=[];try{jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_ChoiceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Choice),error}}when(condition,next){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_Condition(condition),jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(next)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.when),error}return super.addChoice(condition,next.startState),this}otherwise(def){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(def)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.otherwise),error}return super.makeDefault(def.startState),this}afterwards(options={}){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_AfterwardsOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.afterwards),error}const endStates=state_1.State.filterNextables(state_1.State.findReachableEndStates(this,{includeErrorHandlers:options.includeErrorHandlers}));if(options.includeOtherwise&&this.defaultChoice)throw new Error(`'includeOtherwise' set but Choice state ${this.stateId} already has an 'otherwise' transition`);return options.includeOtherwise&&endStates.push(new DefaultAsNext(this)),chain_1.Chain.custom(this,endStates,this)}toStateJson(){return{Type:state_type_1.StateType.CHOICE,Comment:this.comment,...this.renderInputOutput(),...this.renderChoices()}}}exports.Choice=Choice,_a=JSII_RTTI_SYMBOL_1,Choice[_a]={fqn:"aws-cdk-lib.aws_stepfunctions.Choice",version:"2.70.0"};class DefaultAsNext{constructor(choice){this.choice=choice}next(state){return this.choice.otherwise(state),chain_1.Chain.sequence(this.choice,state)}}