Skip to content
23K
Console

Map

The Map state is internally used by the StepFunctions component to add a Map workflow state to a state machine.

You’ll find this component returned by the map method of the StepFunctions component.


Constructor

new Map(args)

Parameters

MapArgs

assign?

Type Record<string, any>

Used to store variables. The Assign field accepts a JSON object with key/value pairs that define variable names and their assigned values. Alternatively, you can pass in a JSONata expression directly.

For more information, see Passing data between states with variables.

Provide a JSON object with variable names and values.

{
assign: {
productName: "product1",
count: 42,
available: true,
}
}

Assign values from state input and result using JSONata expressions.

{
assign: {
product: "{% $states.input.order.product %}",
currentPrice: "{% $states.result.Payload.current_price %}"
}
}

comment?

Type Input<string>

A comment to describe the state.

itemSelector?

Type Input<Record<string, Input<any>>>

Overrides the values of the input array items before they’re passed on to each Map state iteration.

Learn more about ItemSelector.

items?

Type Input<any[] | {% ${string} %}>

A JSON array or a JSONata expression that must evaluate to an array.

Learn more about Items.

Specify an array of items to process.

{
items: ["item1", "item2", "item3"],
}

Alternatively, specify a JSONata expression to evaluate to an array.

{
items: "{% $states.input.items %}",
}

maxConcurrency?

Type Input<number | {% ${string} %}>

Default 0

Specifies an integer value or a JSONata expression that evaluates to an integer. This provides the upper bound on the number of Map state iterations that can run in parallel.

The default value is 0, which places no limit on concurrency. Step Functions invokes iterations as concurrently as possible.

Limit the Map state to 10 concurrent iterations running at one time.

{
maxConcurrency: 10,
}

name

Type string

The name of the state.

output?

Type Input<Record<string, any> | {% ${string} %}>

Specify and transform output from the state. When specified, the value overrides the state output default.

The output field accepts any JSON value (object, array, string, number, boolean, null). Alternatively, you can pass in a JSONata expression directly.

For more information, see Transforming data with JSONata in Step Functions.

processor

Type State

The state to execute for each item in the array.

Methods

catch

catch(state, args?)

Parameters

  • state State

    The state to transition to on error.
  • args? CatchArgs

    Optional catch properties to customize error handling.

Returns Map

Add catch behavior to the Map state. If the state fails with any of the specified errors, continue execution with the given state.

next

next(state)

Parameters

  • state State

    The state to transition to.

Returns State

Add a next state to the Map state. If the state completes successfully, continue execution with the given state.

retry

retry(args?)

Parameters

  • args? RetryArgs

    Optional retry properties to customize retry behavior.

Returns Map

Add retry behavior to the Map state. If the state fails with any of the specified errors, retry execution using the specified parameters.