UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 3.6 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Map=exports.isPositiveInteger=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var state_type_1=()=>{var tmp=require("./private/state-type");return state_type_1=()=>tmp,tmp},state_1=()=>{var tmp=require("./state");return state_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},chain_1=()=>{var tmp=require("../chain");return chain_1=()=>tmp,tmp},fields_1=()=>{var tmp=require("../fields");return fields_1=()=>tmp,tmp},state_graph_1=()=>{var tmp=require("../state-graph");return state_graph_1=()=>tmp,tmp};const isPositiveInteger=value=>{const isFloat=Math.floor(value)!==value,isNotPositiveInteger=value<0||value>Number.MAX_SAFE_INTEGER;return!isFloat&&!isNotPositiveInteger};exports.isPositiveInteger=isPositiveInteger;class Map extends state_1().State{constructor(scope,id,props={}){super(scope,id,props);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_MapProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,Map),error}this.endStates=[this],this.maxConcurrency=props.maxConcurrency,this.itemsPath=props.itemsPath}addRetry(props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_RetryProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addRetry),error}return super._addRetry(props),this}addCatch(handler,props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_IChainable(handler),jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_CatchProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addCatch),error}return super._addCatch(handler.startState,props),this}next(next){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_IChainable(next)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.next),error}return super.makeNext(next.startState),chain_1().Chain.sequence(this,next)}iterator(iterator){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_stepfunctions_IChainable(iterator)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.iterator),error}const name=`Map ${this.stateId} Iterator`;return super.addIterator(new(state_graph_1()).StateGraph(iterator.startState,name)),this}toStateJson(){return{Type:state_type_1().StateType.MAP,Comment:this.comment,ResultPath:(0,state_1().renderJsonPath)(this.resultPath),...this.renderNextEnd(),...this.renderInputOutput(),...this.renderParameters(),...this.renderResultSelector(),...this.renderRetryCatch(),...this.renderIterator(),...this.renderItemsPath(),MaxConcurrency:this.maxConcurrency}}validateState(){const errors=[];return this.iteration===void 0&&errors.push("Map state must have a non-empty iterator"),this.maxConcurrency!==void 0&&!core_1().Token.isUnresolved(this.maxConcurrency)&&!(0,exports.isPositiveInteger)(this.maxConcurrency)&&errors.push("maxConcurrency has to be a positive integer"),errors}renderItemsPath(){return{ItemsPath:(0,state_1().renderJsonPath)(this.itemsPath)}}renderParameters(){return fields_1().FieldUtils.renderObject({Parameters:this.parameters})}}exports.Map=Map,_a=JSII_RTTI_SYMBOL_1,Map[_a]={fqn:"aws-cdk-lib.aws_stepfunctions.Map",version:"2.104.0"};