aws-local-stepfunctions 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,11 +2,9 @@
2
2
 
3
3
  A TypeScript implementation of the [Amazon States Language specification](https://states-language.net/spec.html).
4
4
 
5
- This package lets you run AWS Step Functions locally, both in Node.js and in the browser!
5
+ This package lets you run AWS Step Functions completely locally, both in Node.js and in the browser!
6
6
 
7
- > NOTE: This is a work in progress. Some features defined in the specification might not be supported at all yet or might have limited support.
8
-
9
- ## Table of Contents
7
+ ## Table of contents
10
8
 
11
9
  - [Features](#features)
12
10
  - [Installation](#installation)
@@ -18,12 +16,20 @@ This package lets you run AWS Step Functions locally, both in Node.js and in the
18
16
  - [API](#api)
19
17
  - [Constructor](#constructor-new-statemachinedefinition-statemachineoptions)
20
18
  - [StateMachine.run](#statemachineruninput-options)
19
+ - [CLI](#cli)
20
+ - [Basic usage](#basic-usage)
21
+ - [Passing input from stdin](#passing-input-from-stdin)
22
+ - [Overriding Task and Wait states](#overriding-task-and-wait-states)
23
+ - [Task state override](#task-state-override)
24
+ - [Wait state override](#wait-state-override)
25
+ - [Disabling ASL validations](#disabling-asl-validations)
26
+ - [Exit codes](#exit-codes)
21
27
  - [Examples](#examples)
22
28
  - [License](#license)
23
29
 
24
30
  ## Features
25
31
 
26
- To see a list of features that have full support, partial support, or no support, refer to [this document](/docs/feature-support.md).
32
+ To see the list of features defined in the specification that have full support, partial support, or no support, refer to [this document](/docs/feature-support.md).
27
33
 
28
34
  ## Installation
29
35
 
@@ -51,7 +57,7 @@ import { StateMachine } from 'aws-local-stepfunctions';
51
57
 
52
58
  You can import the bundled package directly into a browser script as an ES module, from one of the following CDNs:
53
59
 
54
- > NOTE: The following examples will import the latest package version. Refer to the CDNs websites to know about other ways in which you can specify the package URL (for example, to import a specific version).
60
+ > NOTE: The following examples will import the latest package version. Refer to the CDNs websites to know about other ways in which you can specify the package URL (for example, to import a specific version or a minified version).
55
61
 
56
62
  #### [unpkg](https://unpkg.com/)
57
63
 
@@ -78,11 +84,11 @@ The constructor takes the following parameters:
78
84
  - `validationOptions?`: An object that specifies how the definition should be validated.
79
85
  - `checkPaths`: If set to `false`, won't validate JSONPaths.
80
86
  - `checkArn`: If set to `false`, won't validate ARN syntax in `Task` states.
81
- - `awsConfig?`: An object that specifies the AWS region and credentials to use when invoking a Lambda function in a `Task` state. If not set, the AWS config will be resolved based on the [credentials provider chain](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html) of the AWS SDK for JavaScript V3. You don't need to use this option if you have a [shared config/credentials file](https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html) (for example, if you have the [AWS CLI](https://aws.amazon.com/cli/) installed) or if you use a local override for all of your `Task` states.
87
+ - `awsConfig?`: An object that specifies the [AWS region and credentials](/docs/feature-support.md#providing-aws-credentials-and-region-to-execute-lambda-functions-specified-in-task-states) to use when invoking a Lambda function in a `Task` state. If not set, the AWS config will be resolved based on the [credentials provider chain](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html) of the AWS SDK for JavaScript V3. You don't need to use this option if you have a [shared config/credentials file](https://docs.aws.amazon.com/sdkref/latest/guide/file-format.html) (for example, if you have the [AWS CLI](https://aws.amazon.com/cli/) installed) or if you use a local override for all of your `Task` states.
82
88
  - `region`: The AWS region where the Lambda functions are created.
83
89
  - `credentials`: An object that specifies which type of credentials to use.
84
- - `cognitoIdentityPool`: An object that specifies the Cognito Identity Pool to use for requesting credentials.
85
- - `accessKeys`: An object that specifies the [Access Key ID and Secret Access Key](https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html#sec-access-keys-and-secret-access-keys) to use as credentials.
90
+ - `cognitoIdentityPool`: An object that specifies the Cognito Identity Pool ID to use for requesting credentials.
91
+ - `accessKeys`: An object that specifies the Access Key ID and Secret Access Key to use as credentials.
86
92
 
87
93
  The constructor will attempt to validate the definition by default, unless the `validationOptions` property is specified. If the definition is not valid, an error will be thrown.
88
94
 
@@ -113,7 +119,7 @@ const stateMachine = new StateMachine(machineDefinition, {
113
119
 
114
120
  Runs the state machine with the given `input` parameter and returns an object with the following properties:
115
121
 
116
- - `abort`: A function that takes no parameters and doesn't return any value. If called, aborts the execution and throws an `ExecutionAbortedError`, unless the `noThrowOnAbort` option is set.
122
+ - `abort`: A function that takes no parameters and doesn't return any value. If called, [aborts the execution](/docs/feature-support.md#abort-a-running-execution) and throws an `ExecutionAbortedError`, unless the `noThrowOnAbort` option is set.
117
123
  - `result`: A `Promise` that resolves with the execution result once it finishes.
118
124
 
119
125
  Each execution is independent of all others, meaning that you can concurrently call this method as many times as needed, without worrying about race conditions.
@@ -123,8 +129,8 @@ Each execution is independent of all others, meaning that you can concurrently c
123
129
  - `input`: The initial input to pass to the state machine. This can be any valid JSON value.
124
130
  - `options?`:
125
131
  - `overrides?`: An object to override the behavior of certain states:
126
- - `taskResourceLocalHandlers?`: Overrides the resource of the specified `Task` states to run a local function.
127
- - `waitTimeOverrides?`: Overrides the wait duration of the specified `Wait` states. The specifed override duration should be in milliseconds.
132
+ - `taskResourceLocalHandlers?`: An [object that overrides](/docs/feature-support.md#task-state-resource-override) the resource of the specified `Task` states to run a local function.
133
+ - `waitTimeOverrides?`: An [object that overrides](/docs/feature-support.md#wait-state-duration-override) the wait duration of the specified `Wait` states. The specified override duration should be in milliseconds.
128
134
  - `noThrowOnAbort?`: If this option is set to `true`, aborting the execution will simply return `null` as result instead of throwing.
129
135
 
130
136
  #### Basic example:
@@ -151,6 +157,167 @@ const result = await execution.result; // wait until the execution finishes to g
151
157
  console.log(result); // log the result of the execution
152
158
  ```
153
159
 
160
+ ## CLI
161
+
162
+ In addition to the JavaScript API, `aws-local-stepfunctions` also provides a command-line interface. The CLI allows you to run one or several executions without having to create a Node.js script.
163
+
164
+ To use the CLI as a global shell command, you need to install the package globally:
165
+
166
+ ```sh
167
+ npm install -g aws-local-stepfunctions
168
+ ```
169
+
170
+ After installing the package, the command `local-sfn` will be available in your shell.
171
+
172
+ ### Basic usage
173
+
174
+ The simplest way to use the CLI is by passing either the `-d, --definition` or the `-f, --definition-file` option, along with the input(s) for the state machine. For example:
175
+
176
+ ```sh
177
+ local-sfn \
178
+ -f state-machine.json \
179
+ '{ "num1": 1, "num2": 2 }' \
180
+ '{ "num1": 3, "num2": 4 }' \
181
+ '{ "num1": 5, "num2": 6 }'
182
+ ```
183
+
184
+ This command would execute the state machine defined in file `state-machine.json` with `'{ "num1": 1, "num2": 2 }'`, `'{ "num1": 3, "num2": 4 }'`, and `'{ "num1": 5, "num2": 6 }'` as inputs. Each input corresponds to a state machine execution, and each execution is run independently, so the failure of one execution doesn't mean the failure of all of the other executions.
185
+
186
+ Now, suppose the state machine in file `state-machine.json` is defined as a single `Task` state that calls a Lambda function that adds `num1` and `num2`:
187
+
188
+ <a id="cli-state-machine"></a>
189
+
190
+ ```json
191
+ {
192
+ "StartAt": "AddNumbers",
193
+ "States": {
194
+ "AddNumbers": {
195
+ "Type": "Task",
196
+ "Resource": "arn:aws:lambda:us-east-1:123456789012:function:AddNumbers",
197
+ "End": true
198
+ }
199
+ }
200
+ }
201
+ ```
202
+
203
+ Then, the output of the `local-sfn` command above may look something like this:
204
+
205
+ ```sh
206
+ 3
207
+ 7
208
+ 11
209
+ ```
210
+
211
+ Note that each line of the output corresponds to the result of each input, in the same order that the inputs were given to the command.
212
+
213
+ ### Passing input from stdin
214
+
215
+ `local-sfn` can also read the execution input from the standard input. For example, assume you have the following text file, called `inputs.txt`, and you want to pass the contents of the file as inputs to `local-sfn`:
216
+
217
+ ```txt
218
+ { "num1": 1, "num2": 2 }
219
+ { "num1": 3, "num2": 4 }
220
+ { "num1": 5, "num2": 6 }
221
+ ```
222
+
223
+ You can then run the following command to pass the inputs of the text file to `local-sfn`:
224
+
225
+ ```sh
226
+ cat inputs.txt | local-sfn -f state-machine.json
227
+ ```
228
+
229
+ Alternatively, using input redirection:
230
+
231
+ ```sh
232
+ local-sfn -f state-machine.json < inputs.txt
233
+ ```
234
+
235
+ When reading from stdin, `local-sfn` will take each line and use it as an input. Hence, to avoid any parsing errors, make sure the output of the command you're piping into `local-sfn` prints each input in a new line.
236
+
237
+ ### Overriding Task and Wait states
238
+
239
+ As explained in the Feature support document, it's possible to override the default actions of [`Task` states](/docs/feature-support.md#task-state-resource-override) and [`Wait` states](/docs/feature-support.md#wait-state-duration-override).
240
+
241
+ #### Task state override
242
+
243
+ To override a `Task` state, pass the `-t, --override-task` option. This option takes as value the name of the `Task` state you want to override, and a path to a script or program that will be executed instead of the resource specified in the state definition. The state name and the path must be separated by a colon `:`.
244
+
245
+ Using the same [state machine definition](#cli-state-machine) as before, if you wanted to override the `AddNumbers` state to run a custom script, you can do it like this:
246
+
247
+ ```sh
248
+ local-sfn -f state-machine.json -t AddNumbers:./override.sh '{ "num1": 1, "num2": 2 }'
249
+ ```
250
+
251
+ This command would run the state machine, but instead of invoking the Lambda function specified in the `Resource` field of the `AddNumbers` state, the `override.sh` script would be executed.
252
+
253
+ Now, suppose the `override.sh` script is defined like this:
254
+
255
+ ```sh
256
+ #!/bin/sh
257
+
258
+ TASK_INPUT=$1 # First argument is the input to the overridden Task state
259
+ echo "$TASK_INPUT" | jq '.num1 + .num2' # Use jq to add "num1" and "num2", and print result to stdout
260
+ ```
261
+
262
+ When overriding a `Task` state, the overriding executable will be passed the input to the `Task` state as first argument, which can then be used to compute the task result. Similarly, the executable must print the task result as a JSON value to the standard output, so `local-sfn` can then read stdout and use the value as the result of the `Task` state. If the executable terminates with an exit code different from `0`, its standard error will be printed and the execution will be marked as a failure.
263
+
264
+ Additionally, you can pass the `-t, --override-task` option multiple times, to override more than one `Task` state. For example:
265
+
266
+ ```sh
267
+ local-sfn
268
+ -f state-machine.json \
269
+ -t AddNumbers:./override.sh \
270
+ -t SendRequest:./request.py \
271
+ -t ProcessImage:./proc_image \
272
+ '{ "num1": 1, "num2": 2 }'
273
+ ```
274
+
275
+ This command would execute the state machine, and override `Task` states `AddNumbers`, `SendRequest`, and `ProcessImage` to run the `override.sh` shell script, the `request.py` Python script, and the `proc_image` program, respectively.
276
+
277
+ #### Wait state override
278
+
279
+ To override the duration of a `Wait` state, pass the `-w, --override-wait` option. This option takes as value the name of the `Wait` state you want to override, and a number that represents the amount in milliseconds that you want to pause the execution for. The state name and the milliseconds amount must be separated by a colon `:`.
280
+
281
+ For example:
282
+
283
+ ```sh
284
+ local-sfn -f state-machine.json -w WaitResponse:1500 '{ "num1": 1, "num2": 2 }'
285
+ ```
286
+
287
+ This command would execute the state machine, and when entering the `WaitResponse` `Wait` state, the execution would be paused for 1500 milliseconds (1.5 seconds), disregarding the `Seconds`, `Timestamp`, `SecondsPath`, or `TimestampPath` fields that could've been specified in the definition of `WaitResponse`.
288
+
289
+ In the same way as the `-t, --override-task` option, you can pass the `-w, --override-wait` option multiple times, to override more than one `Wait` state. For example:
290
+
291
+ ```sh
292
+ local-sfn \
293
+ -f state-machine.json \
294
+ -w WaitResponse:1500 \
295
+ -w PauseUntilSignal:250 \
296
+ -w Delay:0 \
297
+ '{ "num1": 1, "num2": 2 }'
298
+ ```
299
+
300
+ This command would execute the state machine, and override `Wait` states `WaitResponse` and `PauseUntilSignal` to pause the execution for 1500 and 250 milliseconds, respectively. The `Delay` state wouldn't be paused at all, since the override value is set to 0.
301
+
302
+ ### Disabling ASL validations
303
+
304
+ Before attempting to run the state machine with the given inputs, the state machine definition itself is validated to check that:
305
+
306
+ - JSONPath strings are valid.
307
+ - ARNs in the `Resource` field of `Task` states are valid.
308
+
309
+ If any of these two checks fail, `local-sfn` will print the validation error and exit. To suppress this behavior, you can pass the `--no-jsonpath-validation` option, to suppress JSONPath validation; and the `--no-arn-validation` option, to suppress ARN validation.
310
+
311
+ ### Exit codes
312
+
313
+ `local-sfn` can terminate with the following exit codes:
314
+
315
+ | Exit code | Explanation |
316
+ | :-------: | ------------------------------------------------------------------------------------ |
317
+ | 0 | The state machine was executed, and all executions ran successfully. |
318
+ | 1 | An error occurred before the state machine could be executed (e.g. a parsing error). |
319
+ | 2 | The state machine was executed, but at least one execution had an error. |
320
+
154
321
  ## Examples
155
322
 
156
323
  You can check more examples and options usage in the [examples](/examples) directory.
package/build/CLI.cjs ADDED
@@ -0,0 +1,236 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/cli/CLI.ts
32
+ var CLI_exports = {};
33
+ __export(CLI_exports, {
34
+ makeProgram: () => makeProgram
35
+ });
36
+ module.exports = __toCommonJS(CLI_exports);
37
+ var import_readline = __toESM(require("readline"), 1);
38
+ var import_commander = require("commander");
39
+
40
+ // package.json
41
+ var version = "0.7.0";
42
+
43
+ // src/cli/ArgumentParsers.ts
44
+ var import_fs = require("fs");
45
+ var import_child_process = require("child_process");
46
+
47
+ // src/util/index.ts
48
+ function tryJSONParse(jsonStr) {
49
+ try {
50
+ return JSON.parse(jsonStr);
51
+ } catch (error) {
52
+ return error;
53
+ }
54
+ }
55
+
56
+ // src/cli/ArgumentParsers.ts
57
+ function parseDefinitionOption(command, definition) {
58
+ const jsonOrError = tryJSONParse(definition);
59
+ if (jsonOrError instanceof Error) {
60
+ command.error(
61
+ `error: parsing of state machine definition passed in option '-d, --definition <definition>' failed: ${jsonOrError.message}`,
62
+ {
63
+ exitCode: 1 /* PreExecutionFailure */
64
+ }
65
+ );
66
+ }
67
+ return jsonOrError;
68
+ }
69
+ function parseDefinitionFileOption(command, definitionFile) {
70
+ let file;
71
+ try {
72
+ file = (0, import_fs.readFileSync)(definitionFile).toString();
73
+ } catch (error) {
74
+ command.error(`error: ${error.message}`, { exitCode: 1 /* PreExecutionFailure */ });
75
+ }
76
+ const jsonOrError = tryJSONParse(file);
77
+ if (jsonOrError instanceof Error) {
78
+ command.error(
79
+ `error: parsing of state machine definition in file '${definitionFile}' failed: ${jsonOrError.message}`,
80
+ { exitCode: 1 /* PreExecutionFailure */ }
81
+ );
82
+ }
83
+ return jsonOrError;
84
+ }
85
+ function parseOverrideTaskOption(value, previous = {}) {
86
+ const [taskStateName, scriptPath] = value.split(":");
87
+ previous[taskStateName] = (input) => {
88
+ const spawnResult = (0, import_child_process.spawnSync)(scriptPath, [JSON.stringify(input)]);
89
+ if (spawnResult.error) {
90
+ throw new Error(
91
+ `Attempt to run task override '${scriptPath}' for state '${taskStateName}' failed: ${spawnResult.error.message}`
92
+ );
93
+ }
94
+ if (spawnResult.status !== 0) {
95
+ throw new Error(`${scriptPath} ('${taskStateName}'): ${spawnResult.stderr.toString()}`);
96
+ }
97
+ const overrideResult = spawnResult.stdout.toString();
98
+ const jsonOrError = tryJSONParse(overrideResult);
99
+ if (jsonOrError instanceof Error) {
100
+ throw new Error(
101
+ `Parsing of output '${overrideResult}' from task override '${scriptPath}' for state '${taskStateName}' failed: ${jsonOrError.message}`
102
+ );
103
+ }
104
+ return Promise.resolve(jsonOrError);
105
+ };
106
+ return previous;
107
+ }
108
+ function parseOverrideWaitOption(value, previous = {}) {
109
+ const [waitStateName, duration] = value.split(":");
110
+ previous[waitStateName] = Number(duration);
111
+ return previous;
112
+ }
113
+ function parseInputArguments(command, value, previous = []) {
114
+ const jsonOrError = tryJSONParse(value);
115
+ if (jsonOrError instanceof Error) {
116
+ command.error(`error: parsing of input value '${value}' failed: ${jsonOrError.message}`, {
117
+ exitCode: 1 /* PreExecutionFailure */
118
+ });
119
+ }
120
+ return previous.concat(jsonOrError);
121
+ }
122
+
123
+ // src/cli/CommandHandler.ts
124
+ var import_main = require("./main.node.cjs");
125
+ async function commandAction(inputs, options, command) {
126
+ let stateMachine;
127
+ try {
128
+ stateMachine = new import_main.StateMachine(options.definition ?? options.definitionFile, {
129
+ validationOptions: {
130
+ checkPaths: options.jsonpathValidation,
131
+ checkArn: options.arnValidation
132
+ }
133
+ });
134
+ } catch (error) {
135
+ command.error(`error: ${error.message}`);
136
+ }
137
+ const resultsPromises = inputs.map((input) => {
138
+ const { result } = stateMachine.run(input, {
139
+ overrides: {
140
+ taskResourceLocalHandlers: options.overrideTask,
141
+ waitTimeOverrides: options.overrideWait
142
+ }
143
+ });
144
+ return result;
145
+ });
146
+ const results = await Promise.allSettled(resultsPromises);
147
+ let exitCode = 0 /* Success */;
148
+ for (const result of results) {
149
+ if (result.status === "fulfilled") {
150
+ console.log(result.value);
151
+ } else {
152
+ exitCode = 2 /* StateMachineExecutionFailure */;
153
+ let msg = result.reason.message;
154
+ if (result.reason instanceof import_main.ExecutionTimeoutError) {
155
+ msg = "Execution timed out";
156
+ }
157
+ console.log(msg.trim());
158
+ }
159
+ }
160
+ process.exitCode = exitCode;
161
+ }
162
+ function preActionHook(thisCommand) {
163
+ const options = thisCommand.opts();
164
+ if (thisCommand.args.length === 0) {
165
+ thisCommand.help();
166
+ }
167
+ if (!options["definition"] && !options["definitionFile"]) {
168
+ thisCommand.error(
169
+ "error: missing either option '-d, --definition <definition>' or option '-f, --definition-file <path>'",
170
+ { exitCode: 1 /* PreExecutionFailure */ }
171
+ );
172
+ }
173
+ }
174
+
175
+ // src/cli/CLI.ts
176
+ function makeProgram() {
177
+ const command = new import_commander.Command();
178
+ command.name("local-sfn").description(
179
+ `Execute an Amazon States Language state machine with the given inputs.
180
+ The result of each execution will be output in a new line and in the same order as its corresponding input.`
181
+ ).helpOption("-h, --help", "Print help for command and exit.").configureHelp({ helpWidth: 80 }).addHelpText(
182
+ "after",
183
+ `
184
+ Exit codes:
185
+ 0 All executions ran successfully.
186
+ 1 An error occurred before the state machine could be executed.
187
+ 2 At least one execution had an error.
188
+
189
+ Example calls:
190
+ $ local-sfn -f state-machine.json '{ "num1": 2, "num2": 2 }'
191
+ $ local-sfn -f state-machine.json -t SendRequest:./override.sh -w WaitResponse:2000 '{ "num1": 2, "num2": 2 }'
192
+ $ cat inputs.txt | local-sfn -f state-machine.json`
193
+ ).version(version, "-V, --version", "Print the version number and exit.").addOption(
194
+ new import_commander.Option("-d, --definition <definition>", "A JSON definition of a state machine.").conflicts("definition-file").argParser((value) => parseDefinitionOption(command, value))
195
+ ).addOption(
196
+ new import_commander.Option("-f, --definition-file <path>", "Path to a file containing a JSON state machine definition.").conflicts("definition").argParser((value) => parseDefinitionFileOption(command, value))
197
+ ).addOption(
198
+ new import_commander.Option(
199
+ "-t, --override-task <mapping>",
200
+ "Override a Task state to run an executable file or script, instead of calling the service specified in the 'Resource' field of the state definition. The mapping value has to be provided in the format [TaskStateToOverride]:[path/to/override/script]. The override script will be passed the input of the Task state as first argument, which can then be used to compute the task result. The script must print the task result as a JSON value to the standard output."
201
+ ).argParser(parseOverrideTaskOption)
202
+ ).addOption(
203
+ new import_commander.Option(
204
+ "-w, --override-wait <mapping>",
205
+ "Override a Wait state to pause for the specified amount of milliseconds, instead of pausing for the duration specified in the state definition. The mapping value has to be provided in the format [WaitStateToOverride]:[number]."
206
+ ).argParser(parseOverrideWaitOption)
207
+ ).addOption(
208
+ new import_commander.Option("--no-jsonpath-validation", "Disable validation of JSONPath strings in the state machine definition.")
209
+ ).addOption(new import_commander.Option("--no-arn-validation", "Disable validation of ARNs in the state machine definition.")).argument(
210
+ "[inputs...]",
211
+ "Input data for the state machine, can be any valid JSON value. Each input represents a state machine execution. If reading from the standard input, each line will be considered as an input.",
212
+ (value, previous) => parseInputArguments(command, value, previous)
213
+ ).hook("preAction", preActionHook).action(commandAction);
214
+ return command;
215
+ }
216
+ if (require.main === module) {
217
+ (async function() {
218
+ const program = makeProgram();
219
+ if (process.stdin.isTTY) {
220
+ await program.parseAsync();
221
+ } else {
222
+ const rl = import_readline.default.createInterface({
223
+ input: process.stdin
224
+ });
225
+ const stdin = [];
226
+ for await (const line of rl) {
227
+ stdin.push(line);
228
+ }
229
+ await program.parseAsync([...process.argv, ...stdin.filter((line) => line)]);
230
+ }
231
+ })();
232
+ }
233
+ // Annotate the CommonJS export names for ESM import in node:
234
+ 0 && (module.exports = {
235
+ makeProgram
236
+ });