From b365ba8e1c8045850d81d25d045e60ac0acac305 Mon Sep 17 00:00:00 2001 From: MEPalma <64580864+MEPalma@users.noreply.github.com> Date: Mon, 3 Mar 2025 17:28:13 +0100 Subject: [PATCH] allow assign templates in itemselector declarations --- .../stepfunctions/asl/antlr/ASLParser.g4 | 2 +- .../asl/antlr/runtime/ASLParser.py | 8 +- .../state_map/item_selector.py | 12 +- .../stepfunctions/asl/parse/preprocessor.py | 6 +- .../scenarios/scenarios_templates.py | 3 + .../map_state_item_selector_jsonata.json5 | 36 + .../v2/scenarios/test_base_scenarios.py | 9 +- .../test_base_scenarios.snapshot.json | 1976 +++++++++++++++++ .../test_base_scenarios.validation.json | 6 + 9 files changed, 2044 insertions(+), 14 deletions(-) create mode 100644 tests/aws/services/stepfunctions/templates/scenarios/statemachines/map_state_item_selector_jsonata.json5 diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/ASLParser.g4 b/localstack-core/localstack/services/stepfunctions/asl/antlr/ASLParser.g4 index f93a7ba351820..a8868ea341269 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/ASLParser.g4 +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/ASLParser.g4 @@ -299,7 +299,7 @@ iterator_decl: ITERATOR COLON LBRACE iterator_decl_item (COMMA iterator_decl_ite iterator_decl_item: startat_decl | states_decl | comment_decl | processor_config_decl; -item_selector_decl: ITEMSELECTOR COLON payload_tmpl_decl; +item_selector_decl: ITEMSELECTOR COLON assign_template_value_object; item_reader_decl: ITEMREADER COLON LBRACE items_reader_field (COMMA items_reader_field)* RBRACE; diff --git a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/ASLParser.py b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/ASLParser.py index d6dced3fcf907..aeeb665fbc1c9 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/ASLParser.py +++ b/localstack-core/localstack/services/stepfunctions/asl/antlr/runtime/ASLParser.py @@ -336,7 +336,7 @@ def serializedATN(): 1,0,0,0,836,834,1,0,0,0,837,838,5,6,0,0,838,141,1,0,0,0,839,844, 3,6,3,0,840,844,3,16,8,0,841,844,3,8,4,0,842,844,3,128,64,0,843, 839,1,0,0,0,843,840,1,0,0,0,843,841,1,0,0,0,843,842,1,0,0,0,844, - 143,1,0,0,0,845,846,5,87,0,0,846,847,5,2,0,0,847,848,3,64,32,0,848, + 143,1,0,0,0,845,846,5,87,0,0,846,847,5,2,0,0,847,848,3,80,40,0,848, 145,1,0,0,0,849,850,5,102,0,0,850,851,5,2,0,0,851,852,5,5,0,0,852, 857,3,148,74,0,853,854,5,1,0,0,854,856,3,148,74,0,855,853,1,0,0, 0,856,859,1,0,0,0,857,855,1,0,0,0,857,858,1,0,0,0,858,860,1,0,0, @@ -7873,8 +7873,8 @@ def ITEMSELECTOR(self): def COLON(self): return self.getToken(ASLParser.COLON, 0) - def payload_tmpl_decl(self): - return self.getTypedRuleContext(ASLParser.Payload_tmpl_declContext,0) + def assign_template_value_object(self): + return self.getTypedRuleContext(ASLParser.Assign_template_value_objectContext,0) def getRuleIndex(self): @@ -7908,7 +7908,7 @@ def item_selector_decl(self): self.state = 846 self.match(ASLParser.COLON) self.state = 847 - self.payload_tmpl_decl() + self.assign_template_value_object() except RecognitionException as re: localctx.exception = re self._errHandler.reportError(self, re) diff --git a/localstack-core/localstack/services/stepfunctions/asl/component/state/state_execution/state_map/item_selector.py b/localstack-core/localstack/services/stepfunctions/asl/component/state/state_execution/state_map/item_selector.py index bfbb2b20041cc..a096c004270c8 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/component/state/state_execution/state_map/item_selector.py +++ b/localstack-core/localstack/services/stepfunctions/asl/component/state/state_execution/state_map/item_selector.py @@ -1,15 +1,17 @@ from typing import Final -from localstack.services.stepfunctions.asl.component.common.payload.payloadvalue.payloadtmpl.payload_tmpl import ( - PayloadTmpl, +from localstack.services.stepfunctions.asl.component.common.assign.assign_template_value_object import ( + AssignTemplateValueObject, ) from localstack.services.stepfunctions.asl.component.eval_component import EvalComponent from localstack.services.stepfunctions.asl.eval.environment import Environment class ItemSelector(EvalComponent): - def __init__(self, payload_tmpl: PayloadTmpl): - self.payload_tmpl: Final[PayloadTmpl] = payload_tmpl + template_value_object: Final[AssignTemplateValueObject] + + def __init__(self, template_value_object: AssignTemplateValueObject): + self.template_value_object = template_value_object def _eval_body(self, env: Environment) -> None: - self.payload_tmpl.eval(env=env) + self.template_value_object.eval(env=env) diff --git a/localstack-core/localstack/services/stepfunctions/asl/parse/preprocessor.py b/localstack-core/localstack/services/stepfunctions/asl/parse/preprocessor.py index 3740df33ccd7e..93132888e920b 100644 --- a/localstack-core/localstack/services/stepfunctions/asl/parse/preprocessor.py +++ b/localstack-core/localstack/services/stepfunctions/asl/parse/preprocessor.py @@ -918,8 +918,10 @@ def visitIterator_decl(self, ctx: ASLParser.Iterator_declContext) -> IteratorDec ) def visitItem_selector_decl(self, ctx: ASLParser.Item_selector_declContext) -> ItemSelector: - payload_tmpl: PayloadTmpl = self.visit(ctx.payload_tmpl_decl()) - return ItemSelector(payload_tmpl=payload_tmpl) + template_value_object = self.visitAssign_template_value_object( + ctx=ctx.assign_template_value_object() + ) + return ItemSelector(template_value_object=template_value_object) def visitItem_reader_decl(self, ctx: ASLParser.Item_reader_declContext) -> ItemReader: props = StateProps() diff --git a/tests/aws/services/stepfunctions/templates/scenarios/scenarios_templates.py b/tests/aws/services/stepfunctions/templates/scenarios/scenarios_templates.py index bcbdf71299d73..6d479d719d788 100644 --- a/tests/aws/services/stepfunctions/templates/scenarios/scenarios_templates.py +++ b/tests/aws/services/stepfunctions/templates/scenarios/scenarios_templates.py @@ -124,6 +124,9 @@ class ScenariosTemplate(TemplateLoader): MAP_STATE_ITEM_SELECTOR: Final[str] = os.path.join( _THIS_FOLDER, "statemachines/map_state_item_selector.json5" ) + MAP_STATE_ITEM_SELECTOR_JSONATA: Final[str] = os.path.join( + _THIS_FOLDER, "statemachines/map_state_item_selector_jsonata.json5" + ) MAP_STATE_ITEM_SELECTOR_PARAMETERS: Final[str] = os.path.join( _THIS_FOLDER, "statemachines/map_state_item_selector_parameters.json5" ) diff --git a/tests/aws/services/stepfunctions/templates/scenarios/statemachines/map_state_item_selector_jsonata.json5 b/tests/aws/services/stepfunctions/templates/scenarios/statemachines/map_state_item_selector_jsonata.json5 new file mode 100644 index 0000000000000..47b31d274cf91 --- /dev/null +++ b/tests/aws/services/stepfunctions/templates/scenarios/statemachines/map_state_item_selector_jsonata.json5 @@ -0,0 +1,36 @@ +{ + "QueryLanguage": "JSONata", + "StartAt": "Start", + "States": { + "Start": { + "Type": "Pass", + "Assign": { + "ItemsVar": ["Item1", "Item2"] + }, + "Next": "MapIterateState" + }, + "MapIterateState": { + "Type": "Map", + "MaxConcurrency": 1, + "Items": "{% $ItemsVar %}", + "ItemSelector": { + "map_item_value": "{% $states.context.Map.Item.Value %}", + "var_sample": "{% $ItemsVar %}", + "string_literal": "string literal" + }, + "ItemProcessor": { + "ProcessorConfig": { + "Mode": "INLINE" + }, + "StartAt": "Pass", + "States": { + "Pass": { + "Type": "Pass", + "End": true + } + } + }, + "End": true + } + } +} \ No newline at end of file diff --git a/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py b/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py index e3ce1f40b18b4..6993971c1d6de 100644 --- a/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py +++ b/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py @@ -787,16 +787,21 @@ def test_map_state_config_inline_parameters( ) @markers.aws.validated + @pytest.mark.parametrize( + "template_path", + [ST.MAP_STATE_ITEM_SELECTOR, ST.MAP_STATE_ITEM_SELECTOR_JSONATA], + ids=["MAP_STATE_ITEM_SELECTOR", "MAP_STATE_ITEM_SELECTOR_JSONATA"], + ) def test_map_state_item_selector( self, aws_client, create_state_machine_iam_role, create_state_machine, sfn_snapshot, + template_path, ): - template = ST.load_sfn_template(ST.MAP_STATE_ITEM_SELECTOR) + template = ST.load_sfn_template(template_path) definition = json.dumps(template) - exec_input = json.dumps({}) create_and_record_execution( aws_client, diff --git a/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.snapshot.json b/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.snapshot.json index 9f8880b5543d8..5dad14e24e73e 100644 --- a/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.snapshot.json +++ b/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.snapshot.json @@ -27847,5 +27847,1981 @@ "exception_value": "An error occurred (InvalidDefinition) when calling the CreateStateMachine operation: Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: The value for the field 'parsed.$' must be a valid JSONPath or a valid intrinsic function call at /States/IntrinsicEscape/Parameters'" } } + }, + "tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_item_selector[MAP_STATE_ITEM_SELECTOR]": { + "recorded-date": "03-03-2025, 16:07:53", + "recorded-content": { + "get_execution_history": { + "events": [ + { + "executionStartedEventDetails": { + "input": {}, + "inputDetails": { + "truncated": false + }, + "roleArn": "snf_role_arn" + }, + "id": 1, + "previousEventId": 0, + "timestamp": "timestamp", + "type": "ExecutionStarted" + }, + { + "id": 2, + "previousEventId": 0, + "stateEnteredEventDetails": { + "input": {}, + "inputDetails": { + "truncated": false + }, + "name": "StartState" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 3, + "previousEventId": 2, + "stateExitedEventDetails": { + "name": "StartState", + "output": { + "detail": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 4, + "previousEventId": 3, + "stateEnteredEventDetails": { + "input": { + "detail": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "inputDetails": { + "truncated": false + }, + "name": "MapState" + }, + "timestamp": "timestamp", + "type": "MapStateEntered" + }, + { + "id": 5, + "mapStateStartedEventDetails": { + "length": 5 + }, + "previousEventId": 4, + "timestamp": "timestamp", + "type": "MapStateStarted" + }, + { + "id": 6, + "mapIterationStartedEventDetails": { + "index": 0, + "name": "MapState" + }, + "previousEventId": 5, + "timestamp": "timestamp", + "type": "MapIterationStarted" + }, + { + "id": 7, + "previousEventId": 6, + "stateEnteredEventDetails": { + "input": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + "from_input_constant": "UQS", + "iteration_index": 0, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "inputDetails": { + "truncated": false + }, + "name": "HandleItem" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 8, + "previousEventId": 7, + "stateExitedEventDetails": { + "name": "HandleItem", + "output": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + "from_input_constant": "UQS", + "iteration_index": 0, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 9, + "mapIterationSucceededEventDetails": { + "index": 0, + "name": "MapState" + }, + "previousEventId": 8, + "timestamp": "timestamp", + "type": "MapIterationSucceeded" + }, + { + "id": 10, + "mapIterationStartedEventDetails": { + "index": 1, + "name": "MapState" + }, + "previousEventId": 8, + "timestamp": "timestamp", + "type": "MapIterationStarted" + }, + { + "id": 11, + "previousEventId": 10, + "stateEnteredEventDetails": { + "input": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + "from_input_constant": "UQS", + "iteration_index": 1, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "inputDetails": { + "truncated": false + }, + "name": "HandleItem" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 12, + "previousEventId": 11, + "stateExitedEventDetails": { + "name": "HandleItem", + "output": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + "from_input_constant": "UQS", + "iteration_index": 1, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 13, + "mapIterationSucceededEventDetails": { + "index": 1, + "name": "MapState" + }, + "previousEventId": 12, + "timestamp": "timestamp", + "type": "MapIterationSucceeded" + }, + { + "id": 14, + "mapIterationStartedEventDetails": { + "index": 2, + "name": "MapState" + }, + "previousEventId": 12, + "timestamp": "timestamp", + "type": "MapIterationStarted" + }, + { + "id": 15, + "previousEventId": 14, + "stateEnteredEventDetails": { + "input": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + "from_input_constant": "UQS", + "iteration_index": 2, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "inputDetails": { + "truncated": false + }, + "name": "HandleItem" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 16, + "previousEventId": 15, + "stateExitedEventDetails": { + "name": "HandleItem", + "output": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + "from_input_constant": "UQS", + "iteration_index": 2, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 17, + "mapIterationSucceededEventDetails": { + "index": 2, + "name": "MapState" + }, + "previousEventId": 16, + "timestamp": "timestamp", + "type": "MapIterationSucceeded" + }, + { + "id": 18, + "mapIterationStartedEventDetails": { + "index": 3, + "name": "MapState" + }, + "previousEventId": 16, + "timestamp": "timestamp", + "type": "MapIterationStarted" + }, + { + "id": 19, + "previousEventId": 18, + "stateEnteredEventDetails": { + "input": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + "from_input_constant": "UQS", + "iteration_index": 3, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "inputDetails": { + "truncated": false + }, + "name": "HandleItem" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 20, + "previousEventId": 19, + "stateExitedEventDetails": { + "name": "HandleItem", + "output": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + "from_input_constant": "UQS", + "iteration_index": 3, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 21, + "mapIterationSucceededEventDetails": { + "index": 3, + "name": "MapState" + }, + "previousEventId": 20, + "timestamp": "timestamp", + "type": "MapIterationSucceeded" + }, + { + "id": 22, + "mapIterationStartedEventDetails": { + "index": 4, + "name": "MapState" + }, + "previousEventId": 20, + "timestamp": "timestamp", + "type": "MapIterationStarted" + }, + { + "id": 23, + "previousEventId": 22, + "stateEnteredEventDetails": { + "input": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + }, + "from_input_constant": "UQS", + "iteration_index": 4, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "inputDetails": { + "truncated": false + }, + "name": "HandleItem" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 24, + "previousEventId": 23, + "stateExitedEventDetails": { + "name": "HandleItem", + "output": { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + }, + "from_input_constant": "UQS", + "iteration_index": 4, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 25, + "mapIterationSucceededEventDetails": { + "index": 4, + "name": "MapState" + }, + "previousEventId": 24, + "timestamp": "timestamp", + "type": "MapIterationSucceeded" + }, + { + "id": 26, + "previousEventId": 25, + "timestamp": "timestamp", + "type": "MapStateSucceeded" + }, + { + "id": 27, + "previousEventId": 25, + "stateExitedEventDetails": { + "name": "MapState", + "output": { + "detail": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ], + "shipped_output": [ + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + "from_input_constant": "UQS", + "iteration_index": 0, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + "from_input_constant": "UQS", + "iteration_index": 1, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + "from_input_constant": "UQS", + "iteration_index": 2, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + "from_input_constant": "UQS", + "iteration_index": 3, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + }, + "from_input_constant": "UQS", + "iteration_index": 4, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "MapStateExited" + }, + { + "id": 28, + "previousEventId": 27, + "stateEnteredEventDetails": { + "input": { + "detail": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ], + "shipped_output": [ + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + "from_input_constant": "UQS", + "iteration_index": 0, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + "from_input_constant": "UQS", + "iteration_index": 1, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + "from_input_constant": "UQS", + "iteration_index": 2, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + "from_input_constant": "UQS", + "iteration_index": 3, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + }, + "from_input_constant": "UQS", + "iteration_index": 4, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + } + ] + } + }, + "inputDetails": { + "truncated": false + }, + "name": "Final" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 29, + "previousEventId": 28, + "stateExitedEventDetails": { + "name": "Final", + "output": { + "detail": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ], + "shipped_output": [ + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + "from_input_constant": "UQS", + "iteration_index": 0, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + "from_input_constant": "UQS", + "iteration_index": 1, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + "from_input_constant": "UQS", + "iteration_index": 2, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + "from_input_constant": "UQS", + "iteration_index": 3, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + }, + "from_input_constant": "UQS", + "iteration_index": 4, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "executionSucceededEventDetails": { + "output": { + "detail": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ], + "shipped_output": [ + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + "from_input_constant": "UQS", + "iteration_index": 0, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + "from_input_constant": "UQS", + "iteration_index": 1, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + "from_input_constant": "UQS", + "iteration_index": 2, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + "from_input_constant": "UQS", + "iteration_index": 3, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + }, + { + "constant_value": "HelloWorld", + "iteration_input_value": { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + }, + "from_input_constant": "UQS", + "iteration_index": 4, + "original_input": { + "delivery-partner": "UQS", + "shipped": [ + { + "prod": "R31", + "dest-code": 9511, + "quantity": 1344 + }, + { + "prod": "S39", + "dest-code": 9511, + "quantity": 40 + }, + { + "prod": "R31", + "dest-code": 9833, + "quantity": 12 + }, + { + "prod": "R40", + "dest-code": 9860, + "quantity": 887 + }, + { + "prod": "R40", + "dest-code": 9511, + "quantity": 1220 + } + ] + } + } + ] + } + }, + "outputDetails": { + "truncated": false + } + }, + "id": 30, + "previousEventId": 29, + "timestamp": "timestamp", + "type": "ExecutionSucceeded" + } + ], + "ResponseMetadata": { + "HTTPHeaders": {}, + "HTTPStatusCode": 200 + } + } + } + }, + "tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_item_selector[MAP_STATE_ITEM_SELECTOR_JSONATA]": { + "recorded-date": "03-03-2025, 16:08:13", + "recorded-content": { + "get_execution_history": { + "events": [ + { + "executionStartedEventDetails": { + "input": {}, + "inputDetails": { + "truncated": false + }, + "roleArn": "snf_role_arn" + }, + "id": 1, + "previousEventId": 0, + "timestamp": "timestamp", + "type": "ExecutionStarted" + }, + { + "id": 2, + "previousEventId": 0, + "stateEnteredEventDetails": { + "input": {}, + "inputDetails": { + "truncated": false + }, + "name": "Start" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 3, + "previousEventId": 2, + "stateExitedEventDetails": { + "assignedVariables": { + "ItemsVar": "[\"Item1\",\"Item2\"]" + }, + "assignedVariablesDetails": { + "truncated": false + }, + "name": "Start", + "output": {}, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 4, + "previousEventId": 3, + "stateEnteredEventDetails": { + "input": {}, + "inputDetails": { + "truncated": false + }, + "name": "MapIterateState" + }, + "timestamp": "timestamp", + "type": "MapStateEntered" + }, + { + "id": 5, + "mapStateStartedEventDetails": { + "length": 2 + }, + "previousEventId": 4, + "timestamp": "timestamp", + "type": "MapStateStarted" + }, + { + "id": 6, + "mapIterationStartedEventDetails": { + "index": 0, + "name": "MapIterateState" + }, + "previousEventId": 5, + "timestamp": "timestamp", + "type": "MapIterationStarted" + }, + { + "id": 7, + "previousEventId": 6, + "stateEnteredEventDetails": { + "input": { + "map_item_value": "Item1", + "var_sample": [ + "Item1", + "Item2" + ], + "string_literal": "string literal" + }, + "inputDetails": { + "truncated": false + }, + "name": "Pass" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 8, + "previousEventId": 7, + "stateExitedEventDetails": { + "name": "Pass", + "output": { + "map_item_value": "Item1", + "var_sample": [ + "Item1", + "Item2" + ], + "string_literal": "string literal" + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 9, + "mapIterationSucceededEventDetails": { + "index": 0, + "name": "MapIterateState" + }, + "previousEventId": 8, + "timestamp": "timestamp", + "type": "MapIterationSucceeded" + }, + { + "id": 10, + "mapIterationStartedEventDetails": { + "index": 1, + "name": "MapIterateState" + }, + "previousEventId": 8, + "timestamp": "timestamp", + "type": "MapIterationStarted" + }, + { + "id": 11, + "previousEventId": 10, + "stateEnteredEventDetails": { + "input": { + "map_item_value": "Item2", + "var_sample": [ + "Item1", + "Item2" + ], + "string_literal": "string literal" + }, + "inputDetails": { + "truncated": false + }, + "name": "Pass" + }, + "timestamp": "timestamp", + "type": "PassStateEntered" + }, + { + "id": 12, + "previousEventId": 11, + "stateExitedEventDetails": { + "name": "Pass", + "output": { + "map_item_value": "Item2", + "var_sample": [ + "Item1", + "Item2" + ], + "string_literal": "string literal" + }, + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "PassStateExited" + }, + { + "id": 13, + "mapIterationSucceededEventDetails": { + "index": 1, + "name": "MapIterateState" + }, + "previousEventId": 12, + "timestamp": "timestamp", + "type": "MapIterationSucceeded" + }, + { + "id": 14, + "previousEventId": 13, + "timestamp": "timestamp", + "type": "MapStateSucceeded" + }, + { + "id": 15, + "previousEventId": 13, + "stateExitedEventDetails": { + "name": "MapIterateState", + "output": "[{\"map_item_value\":\"Item1\",\"var_sample\":[\"Item1\",\"Item2\"],\"string_literal\":\"string literal\"},{\"map_item_value\":\"Item2\",\"var_sample\":[\"Item1\",\"Item2\"],\"string_literal\":\"string literal\"}]", + "outputDetails": { + "truncated": false + } + }, + "timestamp": "timestamp", + "type": "MapStateExited" + }, + { + "executionSucceededEventDetails": { + "output": "[{\"map_item_value\":\"Item1\",\"var_sample\":[\"Item1\",\"Item2\"],\"string_literal\":\"string literal\"},{\"map_item_value\":\"Item2\",\"var_sample\":[\"Item1\",\"Item2\"],\"string_literal\":\"string literal\"}]", + "outputDetails": { + "truncated": false + } + }, + "id": 16, + "previousEventId": 15, + "timestamp": "timestamp", + "type": "ExecutionSucceeded" + } + ], + "ResponseMetadata": { + "HTTPHeaders": {}, + "HTTPStatusCode": 200 + } + } + } } } diff --git a/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.validation.json b/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.validation.json index 2d8ef1c283b4b..cc5745106dfcc 100644 --- a/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.validation.json +++ b/tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.validation.json @@ -224,6 +224,12 @@ "tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_item_selector": { "last_validated_date": "2023-07-19T11:47:54+00:00" }, + "tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_item_selector[MAP_STATE_ITEM_SELECTOR]": { + "last_validated_date": "2025-03-03T16:07:53+00:00" + }, + "tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_item_selector[MAP_STATE_ITEM_SELECTOR_JSONATA]": { + "last_validated_date": "2025-03-03T16:08:13+00:00" + }, "tests/aws/services/stepfunctions/v2/scenarios/test_base_scenarios.py::TestBaseScenarios::test_map_state_item_selector_parameters": { "last_validated_date": "2024-11-15T11:20:56+00:00" },