aws-local-stepfunctions 1.0.0 → 1.1.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 +27 -6
- package/{build → bin}/CLI.cjs +11 -4
- package/build/main.browser.esm.js +9995 -9295
- package/build/main.d.ts +137 -44
- package/build/main.node.cjs +386 -127
- package/build/main.node.esm.js +386 -127
- package/package.json +19 -17
package/build/main.d.ts
CHANGED
|
@@ -122,10 +122,6 @@ type Catcher = {
|
|
|
122
122
|
interface CatchableState {
|
|
123
123
|
Catch?: Catcher[];
|
|
124
124
|
}
|
|
125
|
-
type ErrorOutput = {
|
|
126
|
-
Error: string;
|
|
127
|
-
Cause?: string;
|
|
128
|
-
};
|
|
129
125
|
|
|
130
126
|
interface NextableState extends BaseState {
|
|
131
127
|
Type: Exclude<StateType, 'Choice' | 'Succeed' | 'Fail'>;
|
|
@@ -183,22 +179,70 @@ interface StateMachineDefinition {
|
|
|
183
179
|
TimeoutSeconds?: number;
|
|
184
180
|
}
|
|
185
181
|
|
|
182
|
+
type Context = Record<string, unknown>;
|
|
183
|
+
|
|
184
|
+
declare class ErrorWithCause extends Error {
|
|
185
|
+
#private;
|
|
186
|
+
constructor(message: string, options?: {
|
|
187
|
+
cause: unknown;
|
|
188
|
+
});
|
|
189
|
+
get cause(): unknown;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Base class for all internal errors that can be thrown during the state machine execution.
|
|
194
|
+
*/
|
|
195
|
+
declare abstract class RuntimeError extends ErrorWithCause {
|
|
196
|
+
/**
|
|
197
|
+
* Whether this runtime error can be matched in a `Retry` field
|
|
198
|
+
*/
|
|
199
|
+
protected retryable: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Whether this runtime error can be caught in a `Catch` field
|
|
202
|
+
*/
|
|
203
|
+
protected catchable: boolean;
|
|
204
|
+
constructor(message: string, cause?: unknown);
|
|
205
|
+
get isRetryable(): boolean;
|
|
206
|
+
get isCatchable(): boolean;
|
|
207
|
+
}
|
|
208
|
+
|
|
186
209
|
type ExecutionStartedEventType = 'ExecutionStarted';
|
|
187
210
|
type ExecutionSucceededEventType = 'ExecutionSucceeded';
|
|
188
211
|
type ExecutionFailedEventType = 'ExecutionFailed';
|
|
189
212
|
type ExecutionTerminatedEventType = 'ExecutionAborted' | 'ExecutionTimeout';
|
|
190
|
-
type
|
|
213
|
+
type ExecutionEventType = ExecutionStartedEventType | ExecutionSucceededEventType | ExecutionFailedEventType | ExecutionTerminatedEventType;
|
|
214
|
+
type MapIterationStartedEventType = 'MapIterationStarted';
|
|
215
|
+
type MapIterationSucceededEventType = 'MapIterationSucceeded';
|
|
191
216
|
type MapIterationFailedEventType = 'MapIterationFailed';
|
|
192
|
-
type
|
|
217
|
+
type MapIterationEventType = MapIterationStartedEventType | MapIterationSucceededEventType | MapIterationFailedEventType;
|
|
218
|
+
type ParallelBranchStartedEventType = 'ParallelBranchStarted';
|
|
219
|
+
type ParallelBranchSucceededEventType = 'ParallelBranchSucceeded';
|
|
193
220
|
type ParallelBranchFailedEventType = 'ParallelBranchFailed';
|
|
194
|
-
type
|
|
195
|
-
type
|
|
221
|
+
type ParallelBranchEventType = ParallelBranchStartedEventType | ParallelBranchSucceededEventType | ParallelBranchFailedEventType;
|
|
222
|
+
type StateEnteredEventType = 'StateEntered';
|
|
223
|
+
type StateExitedEventType = 'StateExited';
|
|
224
|
+
type StateFailedEventType = 'StateFailed';
|
|
225
|
+
type StateRetriedEventType = 'StateRetried';
|
|
226
|
+
type StateCaughtEventType = 'StateCaught';
|
|
227
|
+
type StateEventType = StateEnteredEventType | StateExitedEventType | StateFailedEventType | StateRetriedEventType | StateCaughtEventType;
|
|
228
|
+
type AllEventTypes = ExecutionEventType | MapIterationEventType | ParallelBranchEventType | StateEventType;
|
|
196
229
|
interface StateData {
|
|
197
230
|
name: string;
|
|
198
231
|
type: StateType;
|
|
199
232
|
input: JSONValue;
|
|
200
233
|
output?: JSONValue;
|
|
201
234
|
}
|
|
235
|
+
interface RetryData {
|
|
236
|
+
retrier: Retrier;
|
|
237
|
+
attempt: number;
|
|
238
|
+
}
|
|
239
|
+
interface CatchData {
|
|
240
|
+
catcher: Catcher;
|
|
241
|
+
}
|
|
242
|
+
interface ErrorInfo {
|
|
243
|
+
Error: string;
|
|
244
|
+
Cause: unknown;
|
|
245
|
+
}
|
|
202
246
|
interface BaseEvent {
|
|
203
247
|
type: AllEventTypes;
|
|
204
248
|
timestamp: number;
|
|
@@ -211,87 +255,138 @@ interface ExecutionSucceededEvent extends BaseEvent {
|
|
|
211
255
|
type: ExecutionSucceededEventType;
|
|
212
256
|
output: JSONValue;
|
|
213
257
|
}
|
|
214
|
-
interface ExecutionFailedEvent extends BaseEvent,
|
|
258
|
+
interface ExecutionFailedEvent extends BaseEvent, ErrorInfo {
|
|
215
259
|
type: ExecutionFailedEventType;
|
|
216
260
|
}
|
|
217
261
|
interface ExecutionTerminatedEvent extends BaseEvent {
|
|
218
262
|
type: ExecutionTerminatedEventType;
|
|
219
263
|
}
|
|
220
264
|
interface BaseMapIterationEvent extends BaseEvent {
|
|
221
|
-
type: MapIterationEventType
|
|
265
|
+
type: MapIterationEventType;
|
|
222
266
|
parentState: StateData;
|
|
223
267
|
index: number;
|
|
224
268
|
}
|
|
225
|
-
interface
|
|
226
|
-
type:
|
|
269
|
+
interface MapIterationStartedEvent extends BaseMapIterationEvent {
|
|
270
|
+
type: MapIterationStartedEventType;
|
|
271
|
+
}
|
|
272
|
+
interface MapIterationSucceededEvent extends BaseMapIterationEvent {
|
|
273
|
+
type: MapIterationSucceededEventType;
|
|
227
274
|
}
|
|
228
|
-
interface MapIterationFailedEvent extends BaseMapIterationEvent,
|
|
275
|
+
interface MapIterationFailedEvent extends BaseMapIterationEvent, ErrorInfo {
|
|
229
276
|
type: MapIterationFailedEventType;
|
|
230
277
|
}
|
|
231
278
|
interface BaseParallelBranchEvent extends BaseEvent {
|
|
232
|
-
type: ParallelBranchEventType
|
|
279
|
+
type: ParallelBranchEventType;
|
|
233
280
|
parentState: StateData;
|
|
234
281
|
}
|
|
235
|
-
interface
|
|
236
|
-
type:
|
|
282
|
+
interface ParallelBranchStartedEvent extends BaseParallelBranchEvent {
|
|
283
|
+
type: ParallelBranchStartedEventType;
|
|
284
|
+
}
|
|
285
|
+
interface ParallelBranchSucceededEvent extends BaseParallelBranchEvent {
|
|
286
|
+
type: ParallelBranchSucceededEventType;
|
|
237
287
|
}
|
|
238
|
-
interface ParallelBranchFailedEvent extends BaseParallelBranchEvent,
|
|
288
|
+
interface ParallelBranchFailedEvent extends BaseParallelBranchEvent, ErrorInfo {
|
|
239
289
|
type: ParallelBranchFailedEventType;
|
|
240
290
|
}
|
|
241
|
-
interface
|
|
291
|
+
interface BaseStateEvent extends BaseEvent {
|
|
242
292
|
type: StateEventType;
|
|
243
293
|
state: StateData;
|
|
244
294
|
index?: number;
|
|
245
295
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
* Base class for all internal errors that can be thrown during the state machine execution.
|
|
252
|
-
*/
|
|
253
|
-
declare abstract class RuntimeError extends Error {
|
|
254
|
-
/**
|
|
255
|
-
* Whether this runtime error can be matched in a `Retry` field
|
|
256
|
-
*/
|
|
257
|
-
protected retryable: boolean;
|
|
258
|
-
/**
|
|
259
|
-
* Whether this runtime error can be caught in a `Catch` field
|
|
260
|
-
*/
|
|
261
|
-
protected catchable: boolean;
|
|
262
|
-
constructor(message: string);
|
|
263
|
-
get isRetryable(): boolean;
|
|
264
|
-
get isCatchable(): boolean;
|
|
296
|
+
interface StateEnteredEvent extends BaseStateEvent {
|
|
297
|
+
type: StateEnteredEventType;
|
|
298
|
+
}
|
|
299
|
+
interface StateExitedEvent extends BaseStateEvent {
|
|
300
|
+
type: StateExitedEventType;
|
|
265
301
|
}
|
|
302
|
+
interface StateFailedEvent extends BaseStateEvent, ErrorInfo {
|
|
303
|
+
type: StateFailedEventType;
|
|
304
|
+
}
|
|
305
|
+
interface StateRetriedEvent extends BaseStateEvent {
|
|
306
|
+
type: StateRetriedEventType;
|
|
307
|
+
retry: RetryData;
|
|
308
|
+
}
|
|
309
|
+
interface StateRetriedEvent extends BaseStateEvent {
|
|
310
|
+
type: StateRetriedEventType;
|
|
311
|
+
retry: RetryData;
|
|
312
|
+
}
|
|
313
|
+
interface StateCaughtEvent extends BaseStateEvent {
|
|
314
|
+
type: StateCaughtEventType;
|
|
315
|
+
catch: CatchData;
|
|
316
|
+
}
|
|
317
|
+
type EventLog = ExecutionStartedEvent | ExecutionSucceededEvent | ExecutionFailedEvent | ExecutionTerminatedEvent | MapIterationStartedEvent | MapIterationSucceededEvent | MapIterationFailedEvent | ParallelBranchStartedEvent | ParallelBranchSucceededEvent | ParallelBranchFailedEvent | StateEnteredEvent | StateExitedEvent | StateFailedEvent | StateRetriedEvent | StateCaughtEvent;
|
|
266
318
|
|
|
267
319
|
type TaskStateResourceLocalHandler = {
|
|
268
|
-
[taskStateName: string]: (input: JSONValue) => Promise<JSONValue
|
|
320
|
+
[taskStateName: string]: (input: JSONValue) => Promise<JSONValue> | JSONValue;
|
|
269
321
|
};
|
|
270
322
|
type WaitStateTimeOverride = {
|
|
271
323
|
[waitStateName: string]: number;
|
|
272
324
|
};
|
|
273
325
|
interface Overrides {
|
|
326
|
+
/**
|
|
327
|
+
* Pass an object to this option to override a `Task` state to run a local function,
|
|
328
|
+
* instead of calling the service specified in the `Resource` field.
|
|
329
|
+
*/
|
|
274
330
|
taskResourceLocalHandlers?: TaskStateResourceLocalHandler;
|
|
331
|
+
/**
|
|
332
|
+
* Pass an object to this option to override a `Wait` state to pause for the specified number of milliseconds,
|
|
333
|
+
* instead of pausing for the duration specified by the `Seconds`, `Timestamp`, `SecondsPath`, or `TimestampPath` fields.
|
|
334
|
+
*/
|
|
275
335
|
waitTimeOverrides?: WaitStateTimeOverride;
|
|
276
336
|
}
|
|
277
337
|
interface ValidationOptions {
|
|
338
|
+
/**
|
|
339
|
+
* Disables validation of the state machine definition entirely.
|
|
340
|
+
*
|
|
341
|
+
* Use this option at your own risk, there are no guarantees when passing an invalid or non-standard definition to the state machine.
|
|
342
|
+
* Running it might result in undefined/unsupported behavior.
|
|
343
|
+
*/
|
|
344
|
+
readonly noValidate?: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Disables validation of JSONPath expressions in the state machine definition.
|
|
347
|
+
*/
|
|
278
348
|
readonly checkPaths?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Disables validation of ARNs in the state machine definition.
|
|
351
|
+
*/
|
|
279
352
|
readonly checkArn?: boolean;
|
|
280
353
|
}
|
|
281
354
|
interface AWSConfig {
|
|
355
|
+
/**
|
|
356
|
+
* AWS Region where your Task resources are located.
|
|
357
|
+
*/
|
|
282
358
|
region: string;
|
|
359
|
+
/**
|
|
360
|
+
* AWS credentials needed to be able to call Task resources.
|
|
361
|
+
*/
|
|
283
362
|
credentials?: {
|
|
284
363
|
cognitoIdentityPool?: FromCognitoIdentityPoolParameters;
|
|
285
|
-
accessKeys?:
|
|
364
|
+
accessKeys?: AwsCredentialIdentity;
|
|
286
365
|
};
|
|
287
366
|
}
|
|
288
367
|
interface StateMachineOptions {
|
|
368
|
+
/**
|
|
369
|
+
* Options that allow changing certain rules when validating the state machine definition.
|
|
370
|
+
*/
|
|
289
371
|
validationOptions?: ValidationOptions;
|
|
372
|
+
/**
|
|
373
|
+
* Config options related to AWS resources.
|
|
374
|
+
*/
|
|
290
375
|
awsConfig?: AWSConfig;
|
|
291
376
|
}
|
|
292
377
|
interface RunOptions {
|
|
378
|
+
/**
|
|
379
|
+
* This option allows overriding the behavior of certain states.
|
|
380
|
+
*/
|
|
293
381
|
overrides?: Overrides;
|
|
382
|
+
/**
|
|
383
|
+
* If set to `true`, aborting the execution will simply return `null` as result instead of throwing
|
|
384
|
+
*/
|
|
294
385
|
noThrowOnAbort?: boolean;
|
|
386
|
+
/**
|
|
387
|
+
* Pass an object to this option to mock the [Context Object](https://states-language.net/#context-object) that will be used in the execution.
|
|
388
|
+
* @see https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html
|
|
389
|
+
*/
|
|
295
390
|
context?: Context;
|
|
296
391
|
}
|
|
297
392
|
|
|
@@ -339,14 +434,12 @@ declare class StateMachine {
|
|
|
339
434
|
/**
|
|
340
435
|
* Represents the failure of a state machine execution.
|
|
341
436
|
*/
|
|
342
|
-
declare class ExecutionError extends
|
|
343
|
-
#private;
|
|
437
|
+
declare class ExecutionError extends ErrorWithCause {
|
|
344
438
|
constructor(caughtError: RuntimeError);
|
|
345
|
-
get getWrappedError(): RuntimeError;
|
|
346
439
|
}
|
|
347
440
|
|
|
348
441
|
/**
|
|
349
|
-
* Represents the
|
|
442
|
+
* Represents the abort of a state machine execution.
|
|
350
443
|
*/
|
|
351
444
|
declare class ExecutionAbortedError extends Error {
|
|
352
445
|
constructor();
|
|
@@ -359,4 +452,4 @@ declare class ExecutionTimeoutError extends Error {
|
|
|
359
452
|
constructor();
|
|
360
453
|
}
|
|
361
454
|
|
|
362
|
-
export { ExecutionAbortedError, ExecutionError, ExecutionTimeoutError, StateMachine };
|
|
455
|
+
export { ExecutionAbortedError, ExecutionError, ExecutionTimeoutError, RunOptions, StateMachine, StateMachineDefinition, StateMachineOptions };
|