aws-local-stepfunctions 0.4.0 → 0.6.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/build/main.d.ts CHANGED
@@ -1,18 +1,21 @@
1
- declare type StateType = 'Task' | 'Map' | 'Pass' | 'Wait' | 'Choice' | 'Succeed' | 'Fail';
1
+ import { FromCognitoIdentityPoolParameters } from '@aws-sdk/credential-provider-cognito-identity/dist-types/fromCognitoIdentityPool';
2
+ import { Credentials } from '@aws-sdk/types/dist-types/credentials';
3
+
4
+ type StateType = 'Task' | 'Parallel' | 'Map' | 'Pass' | 'Wait' | 'Choice' | 'Succeed' | 'Fail';
2
5
 
3
6
  interface BaseState {
4
7
  Type: StateType;
5
8
  Comment?: string;
6
9
  }
7
10
 
8
- declare type JSONPrimitiveValue = null | boolean | number | string;
9
- declare type JSONArray = (JSONPrimitiveValue | JSONArray | JSONObject)[];
10
- declare type JSONObject = {
11
+ type JSONPrimitiveValue = null | boolean | number | string;
12
+ type JSONArray = (JSONPrimitiveValue | JSONArray | JSONObject)[];
13
+ type JSONObject = {
11
14
  [key: string]: JSONPrimitiveValue | JSONObject | JSONArray;
12
15
  };
13
- declare type JSONValue = JSONPrimitiveValue | JSONObject | JSONArray;
16
+ type JSONValue = JSONPrimitiveValue | JSONObject | JSONArray;
14
17
 
15
- declare type PayloadTemplate = JSONObject;
18
+ type PayloadTemplate = JSONObject;
16
19
  interface CanHaveInputPath {
17
20
  InputPath?: string | null;
18
21
  }
@@ -29,54 +32,54 @@ interface CanHaveOutputPath {
29
32
  OutputPath?: string | null;
30
33
  }
31
34
 
32
- declare type StringOperatorNames = 'StringEquals' | 'StringLessThan' | 'StringGreaterThan' | 'StringLessThanEquals' | 'StringGreaterThanEquals' | 'StringMatches';
33
- declare type StringPathOperatorNames = 'StringEqualsPath' | 'StringLessThanPath' | 'StringGreaterThanPath' | 'StringLessThanEqualsPath' | 'StringGreaterThanEqualsPath';
34
- declare type NumericOperatorNames = 'NumericEquals' | 'NumericLessThan' | 'NumericGreaterThan' | 'NumericLessThanEquals' | 'NumericGreaterThanEquals';
35
- declare type NumericPathOperatorNames = 'NumericEqualsPath' | 'NumericLessThanPath' | 'NumericGreaterThanPath' | 'NumericLessThanEqualsPath' | 'NumericGreaterThanEqualsPath';
36
- declare type BooleanOperatorNames = 'BooleanEquals';
37
- declare type BooleanPathOperatorNames = 'BooleanEqualsPath';
38
- declare type TimestampOperatorNames = 'TimestampEquals' | 'TimestampLessThan' | 'TimestampGreaterThan' | 'TimestampLessThanEquals' | 'TimestampGreaterThanEquals';
39
- declare type TimestampPathOperatorNames = 'TimestampEqualsPath' | 'TimestampLessThanPath' | 'TimestampGreaterThanPath' | 'TimestampLessThanEqualsPath' | 'TimestampGreaterThanEqualsPath';
40
- declare type TypeTestOperatorNames = 'IsNull' | 'IsPresent' | 'IsNumeric' | 'IsString' | 'IsBoolean' | 'IsTimestamp';
41
- declare type StringComparisonOperator = {
35
+ type StringOperatorNames = 'StringEquals' | 'StringLessThan' | 'StringGreaterThan' | 'StringLessThanEquals' | 'StringGreaterThanEquals' | 'StringMatches';
36
+ type StringPathOperatorNames = 'StringEqualsPath' | 'StringLessThanPath' | 'StringGreaterThanPath' | 'StringLessThanEqualsPath' | 'StringGreaterThanEqualsPath';
37
+ type NumericOperatorNames = 'NumericEquals' | 'NumericLessThan' | 'NumericGreaterThan' | 'NumericLessThanEquals' | 'NumericGreaterThanEquals';
38
+ type NumericPathOperatorNames = 'NumericEqualsPath' | 'NumericLessThanPath' | 'NumericGreaterThanPath' | 'NumericLessThanEqualsPath' | 'NumericGreaterThanEqualsPath';
39
+ type BooleanOperatorNames = 'BooleanEquals';
40
+ type BooleanPathOperatorNames = 'BooleanEqualsPath';
41
+ type TimestampOperatorNames = 'TimestampEquals' | 'TimestampLessThan' | 'TimestampGreaterThan' | 'TimestampLessThanEquals' | 'TimestampGreaterThanEquals';
42
+ type TimestampPathOperatorNames = 'TimestampEqualsPath' | 'TimestampLessThanPath' | 'TimestampGreaterThanPath' | 'TimestampLessThanEqualsPath' | 'TimestampGreaterThanEqualsPath';
43
+ type TypeTestOperatorNames = 'IsNull' | 'IsPresent' | 'IsNumeric' | 'IsString' | 'IsBoolean' | 'IsTimestamp';
44
+ type StringComparisonOperator = {
42
45
  [P in StringOperatorNames]?: string;
43
46
  };
44
- declare type StringPathComparisonOperator = {
47
+ type StringPathComparisonOperator = {
45
48
  [P in StringPathOperatorNames]?: string;
46
49
  };
47
- declare type NumericComparisonOperator = {
50
+ type NumericComparisonOperator = {
48
51
  [P in NumericOperatorNames]?: number;
49
52
  };
50
- declare type NumericPathComparisonOperator = {
53
+ type NumericPathComparisonOperator = {
51
54
  [P in NumericPathOperatorNames]?: string;
52
55
  };
53
- declare type BooleanComparisonOperator = {
56
+ type BooleanComparisonOperator = {
54
57
  [P in BooleanOperatorNames]?: boolean;
55
58
  };
56
- declare type BooleanPathComparisonOperator = {
59
+ type BooleanPathComparisonOperator = {
57
60
  [P in BooleanPathOperatorNames]?: string;
58
61
  };
59
- declare type TimestampComparisonOperator = {
62
+ type TimestampComparisonOperator = {
60
63
  [P in TimestampOperatorNames]?: string;
61
64
  };
62
- declare type TimestampPathComparisonOperator = {
65
+ type TimestampPathComparisonOperator = {
63
66
  [P in TimestampPathOperatorNames]?: string;
64
67
  };
65
- declare type TypeTestComparisonOperator = {
68
+ type TypeTestComparisonOperator = {
66
69
  [P in TypeTestOperatorNames]?: true;
67
70
  };
68
- declare type ComparisonOperator = StringComparisonOperator | StringPathComparisonOperator | NumericComparisonOperator | NumericPathComparisonOperator | BooleanComparisonOperator | BooleanPathComparisonOperator | TimestampComparisonOperator | TimestampPathComparisonOperator | TypeTestComparisonOperator;
69
- declare type BaseDataTestExpression = {
71
+ type ComparisonOperator = StringComparisonOperator | StringPathComparisonOperator | NumericComparisonOperator | NumericPathComparisonOperator | BooleanComparisonOperator | BooleanPathComparisonOperator | TimestampComparisonOperator | TimestampPathComparisonOperator | TypeTestComparisonOperator;
72
+ type BaseDataTestExpression = {
70
73
  Variable: string;
71
74
  };
72
- declare type DataTestExpression = BaseDataTestExpression & ComparisonOperator;
73
- declare type BooleanExpression = {
75
+ type DataTestExpression = BaseDataTestExpression & ComparisonOperator;
76
+ type BooleanExpression = {
74
77
  And?: ChoiceRuleWithoutNext[];
75
78
  Or?: ChoiceRuleWithoutNext[];
76
79
  Not?: ChoiceRuleWithoutNext;
77
80
  };
78
- declare type ChoiceRuleWithoutNext = DataTestExpression | BooleanExpression;
79
- declare type ChoiceRule = (DataTestExpression | BooleanExpression) & {
81
+ type ChoiceRuleWithoutNext = DataTestExpression | BooleanExpression;
82
+ type ChoiceRule = (DataTestExpression | BooleanExpression) & {
80
83
  Next: string;
81
84
  };
82
85
  interface BaseChoiceState extends BaseState, CanHaveInputPath, CanHaveOutputPath {
@@ -84,7 +87,7 @@ interface BaseChoiceState extends BaseState, CanHaveInputPath, CanHaveOutputPath
84
87
  Choices: ChoiceRule[];
85
88
  Default?: string;
86
89
  }
87
- declare type ChoiceState = BaseChoiceState;
90
+ type ChoiceState = BaseChoiceState;
88
91
 
89
92
  interface EndableState extends BaseState {
90
93
  Type: Exclude<StateType, 'Choice' | 'Succeed' | 'Fail'>;
@@ -93,16 +96,16 @@ interface EndableState extends BaseState {
93
96
  interface SucceedOrFailState extends BaseState {
94
97
  Type: Extract<StateType, 'Succeed' | 'Fail'>;
95
98
  }
96
- declare type TerminalState = EndableState | SucceedOrFailState;
99
+ type TerminalState = EndableState | SucceedOrFailState;
97
100
 
98
101
  interface BaseFailState extends BaseState {
99
102
  Type: 'Fail';
100
103
  Cause?: string;
101
104
  Error?: string;
102
105
  }
103
- declare type FailState = TerminalState & BaseFailState;
106
+ type FailState = TerminalState & BaseFailState;
104
107
 
105
- declare type Retrier = {
108
+ type Retrier = {
106
109
  ErrorEquals: string[];
107
110
  IntervalSeconds?: number;
108
111
  MaxAttempts?: number;
@@ -111,7 +114,7 @@ declare type Retrier = {
111
114
  interface RetryableState {
112
115
  Retry?: Retrier[];
113
116
  }
114
- declare type Catcher = {
117
+ type Catcher = {
115
118
  ErrorEquals: string[];
116
119
  Next: string;
117
120
  ResultPath?: string;
@@ -124,7 +127,7 @@ interface NextableState extends BaseState {
124
127
  Type: Exclude<StateType, 'Choice' | 'Succeed' | 'Fail'>;
125
128
  Next: string;
126
129
  }
127
- declare type IntermediateState = NextableState;
130
+ type IntermediateState = NextableState;
128
131
 
129
132
  interface BaseMapState extends BaseState, CanHaveInputPath, CanHaveParameters, CanHaveResultSelector, CanHaveResultPath, CanHaveOutputPath, RetryableState, CatchableState {
130
133
  Type: 'Map';
@@ -132,24 +135,30 @@ interface BaseMapState extends BaseState, CanHaveInputPath, CanHaveParameters, C
132
135
  ItemsPath?: string;
133
136
  MaxConcurrency?: number;
134
137
  }
135
- declare type MapState = (IntermediateState | TerminalState) & BaseMapState;
138
+ type MapState = (IntermediateState | TerminalState) & BaseMapState;
139
+
140
+ interface BaseParallelState extends BaseState, CanHaveInputPath, CanHaveParameters, CanHaveResultSelector, CanHaveResultPath, CanHaveOutputPath, RetryableState, CatchableState {
141
+ Type: 'Parallel';
142
+ Branches: Omit<StateMachineDefinition, 'Version' | 'TimeoutSeconds'>[];
143
+ }
144
+ type ParallelState = (IntermediateState | TerminalState) & BaseParallelState;
136
145
 
137
146
  interface BasePassState extends BaseState, CanHaveInputPath, CanHaveParameters, CanHaveResultPath, CanHaveOutputPath {
138
147
  Type: 'Pass';
139
148
  Result?: JSONValue;
140
149
  }
141
- declare type PassState = (IntermediateState | TerminalState) & BasePassState;
150
+ type PassState = (IntermediateState | TerminalState) & BasePassState;
142
151
 
143
152
  interface BaseSucceedState extends BaseState, CanHaveInputPath, CanHaveOutputPath {
144
153
  Type: 'Succeed';
145
154
  }
146
- declare type SucceedState = TerminalState & BaseSucceedState;
155
+ type SucceedState = TerminalState & BaseSucceedState;
147
156
 
148
157
  interface BaseTaskState extends BaseState, CanHaveInputPath, CanHaveParameters, CanHaveResultSelector, CanHaveResultPath, CanHaveOutputPath, RetryableState, CatchableState {
149
158
  Type: 'Task';
150
159
  Resource: string;
151
160
  }
152
- declare type TaskState = (IntermediateState | TerminalState) & BaseTaskState;
161
+ type TaskState = (IntermediateState | TerminalState) & BaseTaskState;
153
162
 
154
163
  interface BaseWaitState extends BaseState, CanHaveInputPath, CanHaveOutputPath {
155
164
  Type: 'Wait';
@@ -158,9 +167,9 @@ interface BaseWaitState extends BaseState, CanHaveInputPath, CanHaveOutputPath {
158
167
  SecondsPath?: string;
159
168
  TimestampPath?: string;
160
169
  }
161
- declare type WaitState = (IntermediateState | TerminalState) & BaseWaitState;
170
+ type WaitState = (IntermediateState | TerminalState) & BaseWaitState;
162
171
 
163
- declare type AllStates = TaskState | MapState | PassState | WaitState | ChoiceState | SucceedState | FailState;
172
+ type AllStates = TaskState | ParallelState | MapState | PassState | WaitState | ChoiceState | SucceedState | FailState;
164
173
 
165
174
  interface StateMachineDefinition {
166
175
  States: Record<string, AllStates>;
@@ -170,10 +179,10 @@ interface StateMachineDefinition {
170
179
  TimeoutSeconds?: number;
171
180
  }
172
181
 
173
- declare type TaskStateResourceLocalHandler = {
182
+ type TaskStateResourceLocalHandler = {
174
183
  [taskStateName: string]: (input: JSONValue) => Promise<JSONValue>;
175
184
  };
176
- declare type WaitStateTimeOverride = {
185
+ type WaitStateTimeOverride = {
177
186
  [waitStateName: string]: number;
178
187
  };
179
188
  interface Overrides {
@@ -184,6 +193,17 @@ interface ValidationOptions {
184
193
  readonly checkPaths?: boolean;
185
194
  readonly checkArn?: boolean;
186
195
  }
196
+ interface AWSConfig {
197
+ region: string;
198
+ credentials?: {
199
+ cognitoIdentityPool?: FromCognitoIdentityPoolParameters;
200
+ accessKeys?: Omit<Credentials, 'expiration'>;
201
+ };
202
+ }
203
+ interface StateMachineOptions {
204
+ validationOptions?: ValidationOptions;
205
+ awsConfig?: AWSConfig;
206
+ }
187
207
  interface RunOptions {
188
208
  overrides?: Overrides;
189
209
  noThrowOnAbort?: boolean;
@@ -195,16 +215,16 @@ declare class StateMachine {
195
215
  */
196
216
  private readonly definition;
197
217
  /**
198
- * Options to control whether to apply certain validations to the state machine definition.
218
+ * Options to control certain settings of the state machine.
199
219
  */
200
- private readonly validationOptions;
220
+ private readonly stateMachineOptions;
201
221
  /**
202
222
  * Constructs a new state machine.
203
223
  * @param definition The state machine definition defined using the Amazon States Language (https://states-language.net/spec.html).
204
- * @param validationOptions Options to control whether to apply certain validations to the definition.
205
- * These options also apply to state machines defined in the `Iterator` field of `Map` states.
224
+ * @param stateMachineOptions Options to control certain settings of the state machine.
225
+ * These options also apply to state machines defined in the `Iterator` field of `Map` states and in the `Branches` field of `Parallel` states.
206
226
  */
207
- constructor(definition: StateMachineDefinition, validationOptions?: ValidationOptions);
227
+ constructor(definition: StateMachineDefinition, stateMachineOptions?: StateMachineOptions);
208
228
  /**
209
229
  * Executes the state machine, running through the states specified in the definition.
210
230
  * If the execution fails, the result will throw an `ExecutionError` explaining why the
@@ -242,4 +262,25 @@ declare class ExecutionAbortedError extends Error {
242
262
  constructor();
243
263
  }
244
264
 
245
- export { ExecutionAbortedError, ExecutionError, StateMachine };
265
+ /**
266
+ * Base class for all internal errors that can be thrown during the state machine execution.
267
+ */
268
+ declare class RuntimeError extends Error {
269
+ /**
270
+ * Whether this runtime error can be matched in a `Retry` field
271
+ */
272
+ protected retryable: boolean;
273
+ /**
274
+ * Whether this runtime error can be caught in a `Catch` field
275
+ */
276
+ protected catchable: boolean;
277
+ constructor(message: string);
278
+ get isRetryable(): boolean;
279
+ get isCatchable(): boolean;
280
+ }
281
+
282
+ declare class StatesTimeoutError extends RuntimeError {
283
+ constructor();
284
+ }
285
+
286
+ export { ExecutionAbortedError, ExecutionError, StatesTimeoutError as ExecutionTimeoutError, StateMachine };