aws-local-stepfunctions 1.2.0 → 1.3.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 +11 -1
- package/bin/CLI.cjs +1 -1
- package/build/main.browser.esm.js +245 -190
- package/build/main.d.ts +20 -4
- package/build/main.node.cjs +36 -6
- package/build/main.node.esm.js +36 -6
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -160,8 +160,18 @@ Each execution is independent of all others, meaning that you can concurrently c
|
|
|
160
160
|
- `overrides?`: An object to override the behavior of certain states:
|
|
161
161
|
- `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.
|
|
162
162
|
- `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.
|
|
163
|
+
- `retryIntervalOverrides?`: An [object that overrides](/docs/feature-support.md#retry-field-interval-override) the pause duration of the specified state's `Retry` field. The specified override duration should be a number in milliseconds; or an array of numbers, where each number represents milliseconds.
|
|
163
164
|
- `noThrowOnAbort?`: If this option is set to `true`, aborting the execution will simply return `null` as result instead of throwing.
|
|
164
|
-
- `context?`: An object that will be used as the [Context Object](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html) for the execution. If not passed, the Context Object will default to
|
|
165
|
+
- `context?`: An object that will be used as the [Context Object](https://docs.aws.amazon.com/step-functions/latest/dg/input-output-contextobject.html) for the execution. If not passed, the Context Object will default to the following object:
|
|
166
|
+
```js
|
|
167
|
+
{
|
|
168
|
+
"Execution": {
|
|
169
|
+
"Input": /* input passed to the execution */,
|
|
170
|
+
"StartTime": /* ISO 8601 timestamp of when the execution started */
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
This option is useful to mock the fields of the Context Object in case your definition references it in a JSONPath.
|
|
165
175
|
|
|
166
176
|
#### Return value
|
|
167
177
|
|
package/bin/CLI.cjs
CHANGED
|
@@ -19910,6 +19910,8 @@ function isPlainObj(value) {
|
|
|
19910
19910
|
return !!value && Object.getPrototypeOf(value) === Object.prototype;
|
|
19911
19911
|
}
|
|
19912
19912
|
function sleep(ms, abortSignal) {
|
|
19913
|
+
if (ms === 0)
|
|
19914
|
+
return;
|
|
19913
19915
|
return new Promise((resolve) => {
|
|
19914
19916
|
if (abortSignal?.aborted) {
|
|
19915
19917
|
return resolve();
|
|
@@ -20688,9 +20690,18 @@ function processInputPath(path, input, context) {
|
|
|
20688
20690
|
return jsonPathQuery(path, input, context);
|
|
20689
20691
|
}
|
|
20690
20692
|
function processPayloadTemplate(payloadTemplate, json, context) {
|
|
20693
|
+
if (typeof payloadTemplate !== "object" || payloadTemplate === null) {
|
|
20694
|
+
return payloadTemplate;
|
|
20695
|
+
}
|
|
20696
|
+
if (Array.isArray(payloadTemplate)) {
|
|
20697
|
+
return payloadTemplate.map((value) => processPayloadTemplate(value, json, context));
|
|
20698
|
+
}
|
|
20691
20699
|
const resolvedProperties = Object.entries(payloadTemplate).map(([key, value]) => {
|
|
20692
20700
|
let sanitizedKey = key;
|
|
20693
20701
|
let resolvedValue = value;
|
|
20702
|
+
if (Array.isArray(value)) {
|
|
20703
|
+
resolvedValue = value.map((innerValue) => processPayloadTemplate(innerValue, json, context));
|
|
20704
|
+
}
|
|
20694
20705
|
if (isPlainObj(value)) {
|
|
20695
20706
|
resolvedValue = processPayloadTemplate(value, json, context);
|
|
20696
20707
|
}
|
|
@@ -22620,13 +22631,24 @@ var awsAuthMiddleware = (options) => (next, context) => async function(args) {
|
|
|
22620
22631
|
const authScheme = context.endpointV2?.properties?.authSchemes?.[0];
|
|
22621
22632
|
const multiRegionOverride = authScheme?.name === "sigv4a" ? authScheme?.signingRegionSet?.join(",") : void 0;
|
|
22622
22633
|
const signer = await options.signer(authScheme);
|
|
22634
|
+
let signedRequest;
|
|
22635
|
+
const signingOptions = {
|
|
22636
|
+
signingDate: getSkewCorrectedDate(options.systemClockOffset),
|
|
22637
|
+
signingRegion: multiRegionOverride || context["signing_region"],
|
|
22638
|
+
signingService: context["signing_service"]
|
|
22639
|
+
};
|
|
22640
|
+
if (context.s3ExpressIdentity) {
|
|
22641
|
+
const sigV4MultiRegion = signer;
|
|
22642
|
+
signedRequest = await sigV4MultiRegion.signWithCredentials(args.request, context.s3ExpressIdentity, signingOptions);
|
|
22643
|
+
if (signedRequest.headers["X-Amz-Security-Token"] || signedRequest.headers["x-amz-security-token"]) {
|
|
22644
|
+
throw new Error("X-Amz-Security-Token must not be set for s3-express requests.");
|
|
22645
|
+
}
|
|
22646
|
+
} else {
|
|
22647
|
+
signedRequest = await signer.sign(args.request, signingOptions);
|
|
22648
|
+
}
|
|
22623
22649
|
const output = await next({
|
|
22624
22650
|
...args,
|
|
22625
|
-
request:
|
|
22626
|
-
signingDate: getSkewCorrectedDate(options.systemClockOffset),
|
|
22627
|
-
signingRegion: multiRegionOverride || context["signing_region"],
|
|
22628
|
-
signingService: context["signing_service"]
|
|
22629
|
-
})
|
|
22651
|
+
request: signedRequest
|
|
22630
22652
|
}).catch((error) => {
|
|
22631
22653
|
const serverTime = error.ServerTime ?? getDateHeader(error.$response);
|
|
22632
22654
|
if (serverTime) {
|
|
@@ -24171,102 +24193,6 @@ var resolveRetryConfig = (input) => {
|
|
|
24171
24193
|
};
|
|
24172
24194
|
};
|
|
24173
24195
|
|
|
24174
|
-
// node_modules/@smithy/middleware-retry/dist-es/retryMiddleware.js
|
|
24175
|
-
var retryMiddleware = (options) => (next, context) => async (args) => {
|
|
24176
|
-
let retryStrategy = await options.retryStrategy();
|
|
24177
|
-
const maxAttempts = await options.maxAttempts();
|
|
24178
|
-
if (isRetryStrategyV2(retryStrategy)) {
|
|
24179
|
-
retryStrategy = retryStrategy;
|
|
24180
|
-
let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]);
|
|
24181
|
-
let lastError = new Error();
|
|
24182
|
-
let attempts = 0;
|
|
24183
|
-
let totalRetryDelay = 0;
|
|
24184
|
-
const { request } = args;
|
|
24185
|
-
if (HttpRequest.isInstance(request)) {
|
|
24186
|
-
request.headers[INVOCATION_ID_HEADER] = v4_default();
|
|
24187
|
-
}
|
|
24188
|
-
while (true) {
|
|
24189
|
-
try {
|
|
24190
|
-
if (HttpRequest.isInstance(request)) {
|
|
24191
|
-
request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
|
|
24192
|
-
}
|
|
24193
|
-
const { response, output } = await next(args);
|
|
24194
|
-
retryStrategy.recordSuccess(retryToken);
|
|
24195
|
-
output.$metadata.attempts = attempts + 1;
|
|
24196
|
-
output.$metadata.totalRetryDelay = totalRetryDelay;
|
|
24197
|
-
return { response, output };
|
|
24198
|
-
} catch (e3) {
|
|
24199
|
-
const retryErrorInfo = getRetryErrorInfo(e3);
|
|
24200
|
-
lastError = asSdkError(e3);
|
|
24201
|
-
try {
|
|
24202
|
-
retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
|
|
24203
|
-
} catch (refreshError) {
|
|
24204
|
-
if (!lastError.$metadata) {
|
|
24205
|
-
lastError.$metadata = {};
|
|
24206
|
-
}
|
|
24207
|
-
lastError.$metadata.attempts = attempts + 1;
|
|
24208
|
-
lastError.$metadata.totalRetryDelay = totalRetryDelay;
|
|
24209
|
-
throw lastError;
|
|
24210
|
-
}
|
|
24211
|
-
attempts = retryToken.getRetryCount();
|
|
24212
|
-
const delay = retryToken.getRetryDelay();
|
|
24213
|
-
totalRetryDelay += delay;
|
|
24214
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
24215
|
-
}
|
|
24216
|
-
}
|
|
24217
|
-
} else {
|
|
24218
|
-
retryStrategy = retryStrategy;
|
|
24219
|
-
if (retryStrategy?.mode)
|
|
24220
|
-
context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]];
|
|
24221
|
-
return retryStrategy.retry(next, args);
|
|
24222
|
-
}
|
|
24223
|
-
};
|
|
24224
|
-
var isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined";
|
|
24225
|
-
var getRetryErrorInfo = (error) => {
|
|
24226
|
-
const errorInfo = {
|
|
24227
|
-
errorType: getRetryErrorType(error)
|
|
24228
|
-
};
|
|
24229
|
-
const retryAfterHint = getRetryAfterHint(error.$response);
|
|
24230
|
-
if (retryAfterHint) {
|
|
24231
|
-
errorInfo.retryAfterHint = retryAfterHint;
|
|
24232
|
-
}
|
|
24233
|
-
return errorInfo;
|
|
24234
|
-
};
|
|
24235
|
-
var getRetryErrorType = (error) => {
|
|
24236
|
-
if (isThrottlingError(error))
|
|
24237
|
-
return "THROTTLING";
|
|
24238
|
-
if (isTransientError(error))
|
|
24239
|
-
return "TRANSIENT";
|
|
24240
|
-
if (isServerError(error))
|
|
24241
|
-
return "SERVER_ERROR";
|
|
24242
|
-
return "CLIENT_ERROR";
|
|
24243
|
-
};
|
|
24244
|
-
var retryMiddlewareOptions = {
|
|
24245
|
-
name: "retryMiddleware",
|
|
24246
|
-
tags: ["RETRY"],
|
|
24247
|
-
step: "finalizeRequest",
|
|
24248
|
-
priority: "high",
|
|
24249
|
-
override: true
|
|
24250
|
-
};
|
|
24251
|
-
var getRetryPlugin = (options) => ({
|
|
24252
|
-
applyToStack: (clientStack) => {
|
|
24253
|
-
clientStack.add(retryMiddleware(options), retryMiddlewareOptions);
|
|
24254
|
-
}
|
|
24255
|
-
});
|
|
24256
|
-
var getRetryAfterHint = (response) => {
|
|
24257
|
-
if (!HttpResponse.isInstance(response))
|
|
24258
|
-
return;
|
|
24259
|
-
const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after");
|
|
24260
|
-
if (!retryAfterHeaderName)
|
|
24261
|
-
return;
|
|
24262
|
-
const retryAfter = response.headers[retryAfterHeaderName];
|
|
24263
|
-
const retryAfterSeconds = Number(retryAfter);
|
|
24264
|
-
if (!Number.isNaN(retryAfterSeconds))
|
|
24265
|
-
return new Date(retryAfterSeconds * 1e3);
|
|
24266
|
-
const retryAfterDate = new Date(retryAfter);
|
|
24267
|
-
return retryAfterDate;
|
|
24268
|
-
};
|
|
24269
|
-
|
|
24270
24196
|
// node_modules/@smithy/smithy-client/dist-es/NoOpLogger.js
|
|
24271
24197
|
var NoOpLogger = class {
|
|
24272
24198
|
trace() {
|
|
@@ -24726,6 +24652,12 @@ var keepAliveSupport = {
|
|
|
24726
24652
|
supported: Boolean(typeof Request !== "undefined" && "keepalive" in new Request("https://[::1]"))
|
|
24727
24653
|
};
|
|
24728
24654
|
var FetchHttpHandler = class {
|
|
24655
|
+
static create(instanceOrOptions) {
|
|
24656
|
+
if (typeof instanceOrOptions?.handle === "function") {
|
|
24657
|
+
return instanceOrOptions;
|
|
24658
|
+
}
|
|
24659
|
+
return new FetchHttpHandler(instanceOrOptions);
|
|
24660
|
+
}
|
|
24729
24661
|
constructor(options) {
|
|
24730
24662
|
if (typeof options === "function") {
|
|
24731
24663
|
this.configProvider = options().then((opts) => opts || {});
|
|
@@ -25242,7 +25174,7 @@ var _json = (obj) => {
|
|
|
25242
25174
|
return {};
|
|
25243
25175
|
}
|
|
25244
25176
|
if (Array.isArray(obj)) {
|
|
25245
|
-
return obj.filter((_) => _ != null);
|
|
25177
|
+
return obj.filter((_) => _ != null).map(_json);
|
|
25246
25178
|
}
|
|
25247
25179
|
if (typeof obj === "object") {
|
|
25248
25180
|
const target = {};
|
|
@@ -25257,6 +25189,110 @@ var _json = (obj) => {
|
|
|
25257
25189
|
return obj;
|
|
25258
25190
|
};
|
|
25259
25191
|
|
|
25192
|
+
// node_modules/@smithy/middleware-retry/dist-es/isStreamingPayload/isStreamingPayload.browser.js
|
|
25193
|
+
var isStreamingPayload = (request) => request?.body instanceof ReadableStream;
|
|
25194
|
+
|
|
25195
|
+
// node_modules/@smithy/middleware-retry/dist-es/retryMiddleware.js
|
|
25196
|
+
var retryMiddleware = (options) => (next, context) => async (args) => {
|
|
25197
|
+
let retryStrategy = await options.retryStrategy();
|
|
25198
|
+
const maxAttempts = await options.maxAttempts();
|
|
25199
|
+
if (isRetryStrategyV2(retryStrategy)) {
|
|
25200
|
+
retryStrategy = retryStrategy;
|
|
25201
|
+
let retryToken = await retryStrategy.acquireInitialRetryToken(context["partition_id"]);
|
|
25202
|
+
let lastError = new Error();
|
|
25203
|
+
let attempts = 0;
|
|
25204
|
+
let totalRetryDelay = 0;
|
|
25205
|
+
const { request } = args;
|
|
25206
|
+
const isRequest = HttpRequest.isInstance(request);
|
|
25207
|
+
if (isRequest) {
|
|
25208
|
+
request.headers[INVOCATION_ID_HEADER] = v4_default();
|
|
25209
|
+
}
|
|
25210
|
+
while (true) {
|
|
25211
|
+
try {
|
|
25212
|
+
if (isRequest) {
|
|
25213
|
+
request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
|
|
25214
|
+
}
|
|
25215
|
+
const { response, output } = await next(args);
|
|
25216
|
+
retryStrategy.recordSuccess(retryToken);
|
|
25217
|
+
output.$metadata.attempts = attempts + 1;
|
|
25218
|
+
output.$metadata.totalRetryDelay = totalRetryDelay;
|
|
25219
|
+
return { response, output };
|
|
25220
|
+
} catch (e3) {
|
|
25221
|
+
const retryErrorInfo = getRetryErrorInfo(e3);
|
|
25222
|
+
lastError = asSdkError(e3);
|
|
25223
|
+
if (isRequest && isStreamingPayload(request)) {
|
|
25224
|
+
(context.logger instanceof NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request.");
|
|
25225
|
+
throw lastError;
|
|
25226
|
+
}
|
|
25227
|
+
try {
|
|
25228
|
+
retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);
|
|
25229
|
+
} catch (refreshError) {
|
|
25230
|
+
if (!lastError.$metadata) {
|
|
25231
|
+
lastError.$metadata = {};
|
|
25232
|
+
}
|
|
25233
|
+
lastError.$metadata.attempts = attempts + 1;
|
|
25234
|
+
lastError.$metadata.totalRetryDelay = totalRetryDelay;
|
|
25235
|
+
throw lastError;
|
|
25236
|
+
}
|
|
25237
|
+
attempts = retryToken.getRetryCount();
|
|
25238
|
+
const delay = retryToken.getRetryDelay();
|
|
25239
|
+
totalRetryDelay += delay;
|
|
25240
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
25241
|
+
}
|
|
25242
|
+
}
|
|
25243
|
+
} else {
|
|
25244
|
+
retryStrategy = retryStrategy;
|
|
25245
|
+
if (retryStrategy?.mode)
|
|
25246
|
+
context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]];
|
|
25247
|
+
return retryStrategy.retry(next, args);
|
|
25248
|
+
}
|
|
25249
|
+
};
|
|
25250
|
+
var isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined";
|
|
25251
|
+
var getRetryErrorInfo = (error) => {
|
|
25252
|
+
const errorInfo = {
|
|
25253
|
+
errorType: getRetryErrorType(error)
|
|
25254
|
+
};
|
|
25255
|
+
const retryAfterHint = getRetryAfterHint(error.$response);
|
|
25256
|
+
if (retryAfterHint) {
|
|
25257
|
+
errorInfo.retryAfterHint = retryAfterHint;
|
|
25258
|
+
}
|
|
25259
|
+
return errorInfo;
|
|
25260
|
+
};
|
|
25261
|
+
var getRetryErrorType = (error) => {
|
|
25262
|
+
if (isThrottlingError(error))
|
|
25263
|
+
return "THROTTLING";
|
|
25264
|
+
if (isTransientError(error))
|
|
25265
|
+
return "TRANSIENT";
|
|
25266
|
+
if (isServerError(error))
|
|
25267
|
+
return "SERVER_ERROR";
|
|
25268
|
+
return "CLIENT_ERROR";
|
|
25269
|
+
};
|
|
25270
|
+
var retryMiddlewareOptions = {
|
|
25271
|
+
name: "retryMiddleware",
|
|
25272
|
+
tags: ["RETRY"],
|
|
25273
|
+
step: "finalizeRequest",
|
|
25274
|
+
priority: "high",
|
|
25275
|
+
override: true
|
|
25276
|
+
};
|
|
25277
|
+
var getRetryPlugin = (options) => ({
|
|
25278
|
+
applyToStack: (clientStack) => {
|
|
25279
|
+
clientStack.add(retryMiddleware(options), retryMiddlewareOptions);
|
|
25280
|
+
}
|
|
25281
|
+
});
|
|
25282
|
+
var getRetryAfterHint = (response) => {
|
|
25283
|
+
if (!HttpResponse.isInstance(response))
|
|
25284
|
+
return;
|
|
25285
|
+
const retryAfterHeaderName = Object.keys(response.headers).find((key) => key.toLowerCase() === "retry-after");
|
|
25286
|
+
if (!retryAfterHeaderName)
|
|
25287
|
+
return;
|
|
25288
|
+
const retryAfter = response.headers[retryAfterHeaderName];
|
|
25289
|
+
const retryAfterSeconds = Number(retryAfter);
|
|
25290
|
+
if (!Number.isNaN(retryAfterSeconds))
|
|
25291
|
+
return new Date(retryAfterSeconds * 1e3);
|
|
25292
|
+
const retryAfterDate = new Date(retryAfter);
|
|
25293
|
+
return retryAfterDate;
|
|
25294
|
+
};
|
|
25295
|
+
|
|
25260
25296
|
// node_modules/@aws-sdk/client-lambda/dist-es/endpoint/EndpointParameters.js
|
|
25261
25297
|
var resolveClientEndpointParameters = (options) => {
|
|
25262
25298
|
return {
|
|
@@ -25271,11 +25307,10 @@ var resolveClientEndpointParameters = (options) => {
|
|
|
25271
25307
|
var package_default = {
|
|
25272
25308
|
name: "@aws-sdk/client-lambda",
|
|
25273
25309
|
description: "AWS SDK for JavaScript Lambda Client for Node.js, Browser and React Native",
|
|
25274
|
-
version: "3.
|
|
25310
|
+
version: "3.470.0",
|
|
25275
25311
|
scripts: {
|
|
25276
25312
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
25277
25313
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
25278
|
-
"build:docs": "typedoc",
|
|
25279
25314
|
"build:es": "tsc -p tsconfig.es.json",
|
|
25280
25315
|
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
25281
25316
|
"build:types": "tsc -p tsconfig.types.json",
|
|
@@ -25291,47 +25326,47 @@ var package_default = {
|
|
|
25291
25326
|
dependencies: {
|
|
25292
25327
|
"@aws-crypto/sha256-browser": "3.0.0",
|
|
25293
25328
|
"@aws-crypto/sha256-js": "3.0.0",
|
|
25294
|
-
"@aws-sdk/client-sts": "3.
|
|
25295
|
-
"@aws-sdk/core": "3.
|
|
25296
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
25297
|
-
"@aws-sdk/middleware-host-header": "3.
|
|
25298
|
-
"@aws-sdk/middleware-logger": "3.
|
|
25299
|
-
"@aws-sdk/middleware-recursion-detection": "3.
|
|
25300
|
-
"@aws-sdk/middleware-signing": "3.
|
|
25301
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
25302
|
-
"@aws-sdk/region-config-resolver": "3.
|
|
25303
|
-
"@aws-sdk/types": "3.
|
|
25304
|
-
"@aws-sdk/util-endpoints": "3.
|
|
25305
|
-
"@aws-sdk/util-user-agent-browser": "3.
|
|
25306
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
25307
|
-
"@smithy/config-resolver": "^2.0.
|
|
25308
|
-
"@smithy/eventstream-serde-browser": "^2.0.
|
|
25309
|
-
"@smithy/eventstream-serde-config-resolver": "^2.0.
|
|
25310
|
-
"@smithy/eventstream-serde-node": "^2.0.
|
|
25311
|
-
"@smithy/fetch-http-handler": "^2.
|
|
25312
|
-
"@smithy/hash-node": "^2.0.
|
|
25313
|
-
"@smithy/invalid-dependency": "^2.0.
|
|
25314
|
-
"@smithy/middleware-content-length": "^2.0.
|
|
25315
|
-
"@smithy/middleware-endpoint": "^2.
|
|
25316
|
-
"@smithy/middleware-retry": "^2.0.
|
|
25317
|
-
"@smithy/middleware-serde": "^2.0.
|
|
25318
|
-
"@smithy/middleware-stack": "^2.0.
|
|
25319
|
-
"@smithy/node-config-provider": "^2.1.
|
|
25320
|
-
"@smithy/node-http-handler": "^2.1
|
|
25321
|
-
"@smithy/protocol-http": "^3.0.
|
|
25322
|
-
"@smithy/smithy-client": "^2.1.
|
|
25323
|
-
"@smithy/types": "^2.
|
|
25324
|
-
"@smithy/url-parser": "^2.0.
|
|
25325
|
-
"@smithy/util-base64": "^2.0.
|
|
25326
|
-
"@smithy/util-body-length-browser": "^2.0.
|
|
25329
|
+
"@aws-sdk/client-sts": "3.470.0",
|
|
25330
|
+
"@aws-sdk/core": "3.468.0",
|
|
25331
|
+
"@aws-sdk/credential-provider-node": "3.470.0",
|
|
25332
|
+
"@aws-sdk/middleware-host-header": "3.468.0",
|
|
25333
|
+
"@aws-sdk/middleware-logger": "3.468.0",
|
|
25334
|
+
"@aws-sdk/middleware-recursion-detection": "3.468.0",
|
|
25335
|
+
"@aws-sdk/middleware-signing": "3.468.0",
|
|
25336
|
+
"@aws-sdk/middleware-user-agent": "3.470.0",
|
|
25337
|
+
"@aws-sdk/region-config-resolver": "3.470.0",
|
|
25338
|
+
"@aws-sdk/types": "3.468.0",
|
|
25339
|
+
"@aws-sdk/util-endpoints": "3.470.0",
|
|
25340
|
+
"@aws-sdk/util-user-agent-browser": "3.468.0",
|
|
25341
|
+
"@aws-sdk/util-user-agent-node": "3.470.0",
|
|
25342
|
+
"@smithy/config-resolver": "^2.0.21",
|
|
25343
|
+
"@smithy/eventstream-serde-browser": "^2.0.15",
|
|
25344
|
+
"@smithy/eventstream-serde-config-resolver": "^2.0.15",
|
|
25345
|
+
"@smithy/eventstream-serde-node": "^2.0.15",
|
|
25346
|
+
"@smithy/fetch-http-handler": "^2.3.1",
|
|
25347
|
+
"@smithy/hash-node": "^2.0.17",
|
|
25348
|
+
"@smithy/invalid-dependency": "^2.0.15",
|
|
25349
|
+
"@smithy/middleware-content-length": "^2.0.17",
|
|
25350
|
+
"@smithy/middleware-endpoint": "^2.2.3",
|
|
25351
|
+
"@smithy/middleware-retry": "^2.0.24",
|
|
25352
|
+
"@smithy/middleware-serde": "^2.0.15",
|
|
25353
|
+
"@smithy/middleware-stack": "^2.0.9",
|
|
25354
|
+
"@smithy/node-config-provider": "^2.1.8",
|
|
25355
|
+
"@smithy/node-http-handler": "^2.2.1",
|
|
25356
|
+
"@smithy/protocol-http": "^3.0.11",
|
|
25357
|
+
"@smithy/smithy-client": "^2.1.18",
|
|
25358
|
+
"@smithy/types": "^2.7.0",
|
|
25359
|
+
"@smithy/url-parser": "^2.0.15",
|
|
25360
|
+
"@smithy/util-base64": "^2.0.1",
|
|
25361
|
+
"@smithy/util-body-length-browser": "^2.0.1",
|
|
25327
25362
|
"@smithy/util-body-length-node": "^2.1.0",
|
|
25328
|
-
"@smithy/util-defaults-mode-browser": "^2.0.
|
|
25329
|
-
"@smithy/util-defaults-mode-node": "^2.0.
|
|
25330
|
-
"@smithy/util-endpoints": "^1.0.
|
|
25331
|
-
"@smithy/util-retry": "^2.0.
|
|
25332
|
-
"@smithy/util-stream": "^2.0.
|
|
25333
|
-
"@smithy/util-utf8": "^2.0.
|
|
25334
|
-
"@smithy/util-waiter": "^2.0.
|
|
25363
|
+
"@smithy/util-defaults-mode-browser": "^2.0.22",
|
|
25364
|
+
"@smithy/util-defaults-mode-node": "^2.0.29",
|
|
25365
|
+
"@smithy/util-endpoints": "^1.0.7",
|
|
25366
|
+
"@smithy/util-retry": "^2.0.8",
|
|
25367
|
+
"@smithy/util-stream": "^2.0.23",
|
|
25368
|
+
"@smithy/util-utf8": "^2.0.2",
|
|
25369
|
+
"@smithy/util-waiter": "^2.0.15",
|
|
25335
25370
|
tslib: "^2.5.0"
|
|
25336
25371
|
},
|
|
25337
25372
|
devDependencies: {
|
|
@@ -25341,7 +25376,6 @@ var package_default = {
|
|
|
25341
25376
|
concurrently: "7.0.0",
|
|
25342
25377
|
"downlevel-dts": "0.10.1",
|
|
25343
25378
|
rimraf: "3.0.2",
|
|
25344
|
-
typedoc: "0.23.23",
|
|
25345
25379
|
typescript: "~4.9.5"
|
|
25346
25380
|
},
|
|
25347
25381
|
engines: {
|
|
@@ -25571,8 +25605,12 @@ var eventStreamSerdeProvider = (options) => new EventStreamMarshaller2(options);
|
|
|
25571
25605
|
var invalidProvider = (message) => () => Promise.reject(message);
|
|
25572
25606
|
|
|
25573
25607
|
// node_modules/@smithy/util-body-length-browser/dist-es/calculateBodyLength.js
|
|
25608
|
+
var TEXT_ENCODER = typeof TextEncoder == "function" ? new TextEncoder() : null;
|
|
25574
25609
|
var calculateBodyLength = (body) => {
|
|
25575
25610
|
if (typeof body === "string") {
|
|
25611
|
+
if (TEXT_ENCODER) {
|
|
25612
|
+
return TEXT_ENCODER.encode(body).byteLength;
|
|
25613
|
+
}
|
|
25576
25614
|
let len = body.length;
|
|
25577
25615
|
for (let i3 = len - 1; i3 >= 0; i3--) {
|
|
25578
25616
|
const code = body.charCodeAt(i3);
|
|
@@ -26897,11 +26935,10 @@ var resolveClientEndpointParameters2 = (options) => {
|
|
|
26897
26935
|
var package_default2 = {
|
|
26898
26936
|
name: "@aws-sdk/client-cognito-identity",
|
|
26899
26937
|
description: "AWS SDK for JavaScript Cognito Identity Client for Node.js, Browser and React Native",
|
|
26900
|
-
version: "3.
|
|
26938
|
+
version: "3.470.0",
|
|
26901
26939
|
scripts: {
|
|
26902
26940
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
26903
26941
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
26904
|
-
"build:docs": "typedoc",
|
|
26905
26942
|
"build:es": "tsc -p tsconfig.es.json",
|
|
26906
26943
|
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
26907
26944
|
"build:types": "tsc -p tsconfig.types.json",
|
|
@@ -26918,46 +26955,46 @@ var package_default2 = {
|
|
|
26918
26955
|
dependencies: {
|
|
26919
26956
|
"@aws-crypto/sha256-browser": "3.0.0",
|
|
26920
26957
|
"@aws-crypto/sha256-js": "3.0.0",
|
|
26921
|
-
"@aws-sdk/client-sts": "3.
|
|
26922
|
-
"@aws-sdk/core": "3.
|
|
26923
|
-
"@aws-sdk/credential-provider-node": "3.
|
|
26924
|
-
"@aws-sdk/middleware-host-header": "3.
|
|
26925
|
-
"@aws-sdk/middleware-logger": "3.
|
|
26926
|
-
"@aws-sdk/middleware-recursion-detection": "3.
|
|
26927
|
-
"@aws-sdk/middleware-signing": "3.
|
|
26928
|
-
"@aws-sdk/middleware-user-agent": "3.
|
|
26929
|
-
"@aws-sdk/region-config-resolver": "3.
|
|
26930
|
-
"@aws-sdk/types": "3.
|
|
26931
|
-
"@aws-sdk/util-endpoints": "3.
|
|
26932
|
-
"@aws-sdk/util-user-agent-browser": "3.
|
|
26933
|
-
"@aws-sdk/util-user-agent-node": "3.
|
|
26934
|
-
"@smithy/config-resolver": "^2.0.
|
|
26935
|
-
"@smithy/fetch-http-handler": "^2.
|
|
26936
|
-
"@smithy/hash-node": "^2.0.
|
|
26937
|
-
"@smithy/invalid-dependency": "^2.0.
|
|
26938
|
-
"@smithy/middleware-content-length": "^2.0.
|
|
26939
|
-
"@smithy/middleware-endpoint": "^2.
|
|
26940
|
-
"@smithy/middleware-retry": "^2.0.
|
|
26941
|
-
"@smithy/middleware-serde": "^2.0.
|
|
26942
|
-
"@smithy/middleware-stack": "^2.0.
|
|
26943
|
-
"@smithy/node-config-provider": "^2.1.
|
|
26944
|
-
"@smithy/node-http-handler": "^2.1
|
|
26945
|
-
"@smithy/protocol-http": "^3.0.
|
|
26946
|
-
"@smithy/smithy-client": "^2.1.
|
|
26947
|
-
"@smithy/types": "^2.
|
|
26948
|
-
"@smithy/url-parser": "^2.0.
|
|
26949
|
-
"@smithy/util-base64": "^2.0.
|
|
26950
|
-
"@smithy/util-body-length-browser": "^2.0.
|
|
26958
|
+
"@aws-sdk/client-sts": "3.470.0",
|
|
26959
|
+
"@aws-sdk/core": "3.468.0",
|
|
26960
|
+
"@aws-sdk/credential-provider-node": "3.470.0",
|
|
26961
|
+
"@aws-sdk/middleware-host-header": "3.468.0",
|
|
26962
|
+
"@aws-sdk/middleware-logger": "3.468.0",
|
|
26963
|
+
"@aws-sdk/middleware-recursion-detection": "3.468.0",
|
|
26964
|
+
"@aws-sdk/middleware-signing": "3.468.0",
|
|
26965
|
+
"@aws-sdk/middleware-user-agent": "3.470.0",
|
|
26966
|
+
"@aws-sdk/region-config-resolver": "3.470.0",
|
|
26967
|
+
"@aws-sdk/types": "3.468.0",
|
|
26968
|
+
"@aws-sdk/util-endpoints": "3.470.0",
|
|
26969
|
+
"@aws-sdk/util-user-agent-browser": "3.468.0",
|
|
26970
|
+
"@aws-sdk/util-user-agent-node": "3.470.0",
|
|
26971
|
+
"@smithy/config-resolver": "^2.0.21",
|
|
26972
|
+
"@smithy/fetch-http-handler": "^2.3.1",
|
|
26973
|
+
"@smithy/hash-node": "^2.0.17",
|
|
26974
|
+
"@smithy/invalid-dependency": "^2.0.15",
|
|
26975
|
+
"@smithy/middleware-content-length": "^2.0.17",
|
|
26976
|
+
"@smithy/middleware-endpoint": "^2.2.3",
|
|
26977
|
+
"@smithy/middleware-retry": "^2.0.24",
|
|
26978
|
+
"@smithy/middleware-serde": "^2.0.15",
|
|
26979
|
+
"@smithy/middleware-stack": "^2.0.9",
|
|
26980
|
+
"@smithy/node-config-provider": "^2.1.8",
|
|
26981
|
+
"@smithy/node-http-handler": "^2.2.1",
|
|
26982
|
+
"@smithy/protocol-http": "^3.0.11",
|
|
26983
|
+
"@smithy/smithy-client": "^2.1.18",
|
|
26984
|
+
"@smithy/types": "^2.7.0",
|
|
26985
|
+
"@smithy/url-parser": "^2.0.15",
|
|
26986
|
+
"@smithy/util-base64": "^2.0.1",
|
|
26987
|
+
"@smithy/util-body-length-browser": "^2.0.1",
|
|
26951
26988
|
"@smithy/util-body-length-node": "^2.1.0",
|
|
26952
|
-
"@smithy/util-defaults-mode-browser": "^2.0.
|
|
26953
|
-
"@smithy/util-defaults-mode-node": "^2.0.
|
|
26954
|
-
"@smithy/util-endpoints": "^1.0.
|
|
26955
|
-
"@smithy/util-retry": "^2.0.
|
|
26956
|
-
"@smithy/util-utf8": "^2.0.
|
|
26989
|
+
"@smithy/util-defaults-mode-browser": "^2.0.22",
|
|
26990
|
+
"@smithy/util-defaults-mode-node": "^2.0.29",
|
|
26991
|
+
"@smithy/util-endpoints": "^1.0.7",
|
|
26992
|
+
"@smithy/util-retry": "^2.0.8",
|
|
26993
|
+
"@smithy/util-utf8": "^2.0.2",
|
|
26957
26994
|
tslib: "^2.5.0"
|
|
26958
26995
|
},
|
|
26959
26996
|
devDependencies: {
|
|
26960
|
-
"@aws-sdk/client-iam": "3.
|
|
26997
|
+
"@aws-sdk/client-iam": "3.470.0",
|
|
26961
26998
|
"@smithy/service-client-documentation-generator": "^2.0.0",
|
|
26962
26999
|
"@tsconfig/node14": "1.0.3",
|
|
26963
27000
|
"@types/chai": "^4.2.11",
|
|
@@ -26966,7 +27003,6 @@ var package_default2 = {
|
|
|
26966
27003
|
concurrently: "7.0.0",
|
|
26967
27004
|
"downlevel-dts": "0.10.1",
|
|
26968
27005
|
rimraf: "3.0.2",
|
|
26969
|
-
typedoc: "0.23.23",
|
|
26970
27006
|
typescript: "~4.9.5"
|
|
26971
27007
|
},
|
|
26972
27008
|
engines: {
|
|
@@ -28011,7 +28047,10 @@ var StateExecutor = class {
|
|
|
28011
28047
|
input,
|
|
28012
28048
|
error
|
|
28013
28049
|
);
|
|
28014
|
-
const { shouldRetry, waitTimeBeforeRetry, retrierIndex } = this.shouldRetry(
|
|
28050
|
+
const { shouldRetry, waitTimeBeforeRetry, retrierIndex } = this.shouldRetry(
|
|
28051
|
+
error,
|
|
28052
|
+
options.runOptions?.overrides?.retryIntervalOverrides
|
|
28053
|
+
);
|
|
28015
28054
|
if (shouldRetry) {
|
|
28016
28055
|
const stateDefinition = this.stateDefinition;
|
|
28017
28056
|
await sleep(waitTimeBeforeRetry, options.abortSignal);
|
|
@@ -28070,20 +28109,29 @@ var StateExecutor = class {
|
|
|
28070
28109
|
/**
|
|
28071
28110
|
* Decide whether this state should be retried, according to the `Retry` field.
|
|
28072
28111
|
*/
|
|
28073
|
-
shouldRetry(error) {
|
|
28112
|
+
shouldRetry(error, retryIntervalOverrides) {
|
|
28074
28113
|
if (!("Retry" in this.stateDefinition)) {
|
|
28075
28114
|
return { shouldRetry: false };
|
|
28076
28115
|
}
|
|
28077
28116
|
for (let i3 = 0; i3 < this.stateDefinition.Retry.length; i3++) {
|
|
28078
28117
|
const retrier = this.stateDefinition.Retry[i3];
|
|
28118
|
+
let intervalOverride = null;
|
|
28119
|
+
if (retryIntervalOverrides?.[this.stateName] !== void 0) {
|
|
28120
|
+
const override = retryIntervalOverrides[this.stateName];
|
|
28121
|
+
if (typeof override === "number") {
|
|
28122
|
+
intervalOverride = override / 1e3;
|
|
28123
|
+
} else if (override[i3] !== void 0 && override[i3] >= 0) {
|
|
28124
|
+
intervalOverride = override[i3] / 1e3;
|
|
28125
|
+
}
|
|
28126
|
+
}
|
|
28079
28127
|
const jitterStrategy = retrier.JitterStrategy ?? DEFAULT_JITTER_STRATEGY;
|
|
28080
28128
|
const maxAttempts = retrier.MaxAttempts ?? DEFAULT_MAX_ATTEMPTS2;
|
|
28081
28129
|
const intervalSeconds = retrier.IntervalSeconds ?? DEFAULT_INTERVAL_SECONDS;
|
|
28082
28130
|
const backoffRate = retrier.BackoffRate ?? DEFAULT_BACKOFF_RATE;
|
|
28083
|
-
const waitInterval = intervalSeconds * Math.pow(backoffRate, this.retrierAttempts[i3]);
|
|
28131
|
+
const waitInterval = intervalOverride ?? intervalSeconds * Math.pow(backoffRate, this.retrierAttempts[i3]);
|
|
28084
28132
|
const retryable = error.isRetryable ?? true;
|
|
28085
|
-
let waitTimeBeforeRetry = clamp(waitInterval,
|
|
28086
|
-
if (jitterStrategy === "FULL") {
|
|
28133
|
+
let waitTimeBeforeRetry = clamp(waitInterval, 0, retrier.MaxDelaySeconds) * 1e3;
|
|
28134
|
+
if (jitterStrategy === "FULL" && intervalOverride === null) {
|
|
28087
28135
|
waitTimeBeforeRetry = getRandomNumber(0, waitTimeBeforeRetry);
|
|
28088
28136
|
}
|
|
28089
28137
|
for (const retrierError of retrier.ErrorEquals) {
|
|
@@ -28556,7 +28604,14 @@ var StateMachine = class {
|
|
|
28556
28604
|
*/
|
|
28557
28605
|
async execute(input, options, cleanupFn) {
|
|
28558
28606
|
options.eventLogger.dispatchExecutionStartedEvent(input);
|
|
28559
|
-
const context =
|
|
28607
|
+
const context = {
|
|
28608
|
+
...options.runOptions?.context,
|
|
28609
|
+
Execution: {
|
|
28610
|
+
...options.runOptions?.context?.Execution,
|
|
28611
|
+
Input: input,
|
|
28612
|
+
StartTime: (/* @__PURE__ */ new Date()).toISOString()
|
|
28613
|
+
}
|
|
28614
|
+
};
|
|
28560
28615
|
let currState = this.definition.States[this.definition.StartAt];
|
|
28561
28616
|
let currStateName = this.definition.StartAt;
|
|
28562
28617
|
let currInput = (0, import_cloneDeep3.default)(input);
|
package/build/main.d.ts
CHANGED
|
@@ -15,15 +15,15 @@ type JSONObject = {
|
|
|
15
15
|
};
|
|
16
16
|
type JSONValue = JSONPrimitiveValue | JSONObject | JSONArray;
|
|
17
17
|
|
|
18
|
-
type PayloadTemplate = JSONObject;
|
|
18
|
+
type PayloadTemplate = JSONObject | JSONArray;
|
|
19
19
|
interface CanHaveInputPath {
|
|
20
20
|
InputPath?: string | null;
|
|
21
21
|
}
|
|
22
22
|
interface CanHaveParameters {
|
|
23
|
-
Parameters?:
|
|
23
|
+
Parameters?: JSONValue;
|
|
24
24
|
}
|
|
25
25
|
interface CanHaveResultSelector {
|
|
26
|
-
ResultSelector?:
|
|
26
|
+
ResultSelector?: JSONValue;
|
|
27
27
|
}
|
|
28
28
|
interface CanHaveResultPath {
|
|
29
29
|
ResultPath?: string | null;
|
|
@@ -189,7 +189,15 @@ interface StateMachineDefinition {
|
|
|
189
189
|
TimeoutSeconds?: number;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
type
|
|
192
|
+
type ContextExecution = {
|
|
193
|
+
Input?: JSONValue;
|
|
194
|
+
StartTime?: string;
|
|
195
|
+
[other: string]: unknown;
|
|
196
|
+
};
|
|
197
|
+
type Context = {
|
|
198
|
+
Execution?: ContextExecution;
|
|
199
|
+
[other: string]: unknown;
|
|
200
|
+
};
|
|
193
201
|
|
|
194
202
|
declare class ErrorWithCause extends Error {
|
|
195
203
|
#private;
|
|
@@ -332,6 +340,9 @@ type TaskStateResourceLocalHandler = {
|
|
|
332
340
|
type WaitStateTimeOverride = {
|
|
333
341
|
[waitStateName: string]: number;
|
|
334
342
|
};
|
|
343
|
+
type RetryIntervalOverrides = {
|
|
344
|
+
[retryableStateName: string]: number | number[];
|
|
345
|
+
};
|
|
335
346
|
interface Overrides {
|
|
336
347
|
/**
|
|
337
348
|
* Pass an object to this option to override a `Task` state to run a local function,
|
|
@@ -343,6 +354,11 @@ interface Overrides {
|
|
|
343
354
|
* instead of pausing for the duration specified by the `Seconds`, `Timestamp`, `SecondsPath`, or `TimestampPath` fields.
|
|
344
355
|
*/
|
|
345
356
|
waitTimeOverrides?: WaitStateTimeOverride;
|
|
357
|
+
/**
|
|
358
|
+
* Pass an object to this option to override the duration in milliseconds a retrier in a `Retry` field waits before retrying the state,
|
|
359
|
+
* instead of pausing for the duration calculated by the `IntervalSeconds`, `BackoffRate`, `MaxDelaySeconds`, and `JitterStrategy` fields.
|
|
360
|
+
*/
|
|
361
|
+
retryIntervalOverrides?: RetryIntervalOverrides;
|
|
346
362
|
}
|
|
347
363
|
interface ValidationOptions {
|
|
348
364
|
/**
|
package/build/main.node.cjs
CHANGED
|
@@ -135,6 +135,8 @@ function isPlainObj(value) {
|
|
|
135
135
|
return !!value && Object.getPrototypeOf(value) === Object.prototype;
|
|
136
136
|
}
|
|
137
137
|
function sleep(ms, abortSignal) {
|
|
138
|
+
if (ms === 0)
|
|
139
|
+
return;
|
|
138
140
|
return new Promise((resolve) => {
|
|
139
141
|
if (abortSignal?.aborted) {
|
|
140
142
|
return resolve();
|
|
@@ -913,9 +915,18 @@ function processInputPath(path, input, context) {
|
|
|
913
915
|
return jsonPathQuery(path, input, context);
|
|
914
916
|
}
|
|
915
917
|
function processPayloadTemplate(payloadTemplate, json, context) {
|
|
918
|
+
if (typeof payloadTemplate !== "object" || payloadTemplate === null) {
|
|
919
|
+
return payloadTemplate;
|
|
920
|
+
}
|
|
921
|
+
if (Array.isArray(payloadTemplate)) {
|
|
922
|
+
return payloadTemplate.map((value) => processPayloadTemplate(value, json, context));
|
|
923
|
+
}
|
|
916
924
|
const resolvedProperties = Object.entries(payloadTemplate).map(([key, value]) => {
|
|
917
925
|
let sanitizedKey = key;
|
|
918
926
|
let resolvedValue = value;
|
|
927
|
+
if (Array.isArray(value)) {
|
|
928
|
+
resolvedValue = value.map((innerValue) => processPayloadTemplate(innerValue, json, context));
|
|
929
|
+
}
|
|
919
930
|
if (isPlainObj(value)) {
|
|
920
931
|
resolvedValue = processPayloadTemplate(value, json, context);
|
|
921
932
|
}
|
|
@@ -1719,7 +1730,10 @@ var StateExecutor = class {
|
|
|
1719
1730
|
input,
|
|
1720
1731
|
error
|
|
1721
1732
|
);
|
|
1722
|
-
const { shouldRetry, waitTimeBeforeRetry, retrierIndex } = this.shouldRetry(
|
|
1733
|
+
const { shouldRetry, waitTimeBeforeRetry, retrierIndex } = this.shouldRetry(
|
|
1734
|
+
error,
|
|
1735
|
+
options.runOptions?.overrides?.retryIntervalOverrides
|
|
1736
|
+
);
|
|
1723
1737
|
if (shouldRetry) {
|
|
1724
1738
|
const stateDefinition = this.stateDefinition;
|
|
1725
1739
|
await sleep(waitTimeBeforeRetry, options.abortSignal);
|
|
@@ -1778,20 +1792,29 @@ var StateExecutor = class {
|
|
|
1778
1792
|
/**
|
|
1779
1793
|
* Decide whether this state should be retried, according to the `Retry` field.
|
|
1780
1794
|
*/
|
|
1781
|
-
shouldRetry(error) {
|
|
1795
|
+
shouldRetry(error, retryIntervalOverrides) {
|
|
1782
1796
|
if (!("Retry" in this.stateDefinition)) {
|
|
1783
1797
|
return { shouldRetry: false };
|
|
1784
1798
|
}
|
|
1785
1799
|
for (let i = 0; i < this.stateDefinition.Retry.length; i++) {
|
|
1786
1800
|
const retrier = this.stateDefinition.Retry[i];
|
|
1801
|
+
let intervalOverride = null;
|
|
1802
|
+
if (retryIntervalOverrides?.[this.stateName] !== void 0) {
|
|
1803
|
+
const override = retryIntervalOverrides[this.stateName];
|
|
1804
|
+
if (typeof override === "number") {
|
|
1805
|
+
intervalOverride = override / 1e3;
|
|
1806
|
+
} else if (override[i] !== void 0 && override[i] >= 0) {
|
|
1807
|
+
intervalOverride = override[i] / 1e3;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1787
1810
|
const jitterStrategy = retrier.JitterStrategy ?? DEFAULT_JITTER_STRATEGY;
|
|
1788
1811
|
const maxAttempts = retrier.MaxAttempts ?? DEFAULT_MAX_ATTEMPTS;
|
|
1789
1812
|
const intervalSeconds = retrier.IntervalSeconds ?? DEFAULT_INTERVAL_SECONDS;
|
|
1790
1813
|
const backoffRate = retrier.BackoffRate ?? DEFAULT_BACKOFF_RATE;
|
|
1791
|
-
const waitInterval = intervalSeconds * Math.pow(backoffRate, this.retrierAttempts[i]);
|
|
1814
|
+
const waitInterval = intervalOverride ?? intervalSeconds * Math.pow(backoffRate, this.retrierAttempts[i]);
|
|
1792
1815
|
const retryable = error.isRetryable ?? true;
|
|
1793
|
-
let waitTimeBeforeRetry = clamp(waitInterval,
|
|
1794
|
-
if (jitterStrategy === "FULL") {
|
|
1816
|
+
let waitTimeBeforeRetry = clamp(waitInterval, 0, retrier.MaxDelaySeconds) * 1e3;
|
|
1817
|
+
if (jitterStrategy === "FULL" && intervalOverride === null) {
|
|
1795
1818
|
waitTimeBeforeRetry = getRandomNumber(0, waitTimeBeforeRetry);
|
|
1796
1819
|
}
|
|
1797
1820
|
for (const retrierError of retrier.ErrorEquals) {
|
|
@@ -2264,7 +2287,14 @@ var StateMachine = class {
|
|
|
2264
2287
|
*/
|
|
2265
2288
|
async execute(input, options, cleanupFn) {
|
|
2266
2289
|
options.eventLogger.dispatchExecutionStartedEvent(input);
|
|
2267
|
-
const context =
|
|
2290
|
+
const context = {
|
|
2291
|
+
...options.runOptions?.context,
|
|
2292
|
+
Execution: {
|
|
2293
|
+
...options.runOptions?.context?.Execution,
|
|
2294
|
+
Input: input,
|
|
2295
|
+
StartTime: (/* @__PURE__ */ new Date()).toISOString()
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2268
2298
|
let currState = this.definition.States[this.definition.StartAt];
|
|
2269
2299
|
let currStateName = this.definition.StartAt;
|
|
2270
2300
|
let currInput = (0, import_cloneDeep3.default)(input);
|
package/build/main.node.esm.js
CHANGED
|
@@ -97,6 +97,8 @@ function isPlainObj(value) {
|
|
|
97
97
|
return !!value && Object.getPrototypeOf(value) === Object.prototype;
|
|
98
98
|
}
|
|
99
99
|
function sleep(ms, abortSignal) {
|
|
100
|
+
if (ms === 0)
|
|
101
|
+
return;
|
|
100
102
|
return new Promise((resolve) => {
|
|
101
103
|
if (abortSignal?.aborted) {
|
|
102
104
|
return resolve();
|
|
@@ -875,9 +877,18 @@ function processInputPath(path, input, context) {
|
|
|
875
877
|
return jsonPathQuery(path, input, context);
|
|
876
878
|
}
|
|
877
879
|
function processPayloadTemplate(payloadTemplate, json, context) {
|
|
880
|
+
if (typeof payloadTemplate !== "object" || payloadTemplate === null) {
|
|
881
|
+
return payloadTemplate;
|
|
882
|
+
}
|
|
883
|
+
if (Array.isArray(payloadTemplate)) {
|
|
884
|
+
return payloadTemplate.map((value) => processPayloadTemplate(value, json, context));
|
|
885
|
+
}
|
|
878
886
|
const resolvedProperties = Object.entries(payloadTemplate).map(([key, value]) => {
|
|
879
887
|
let sanitizedKey = key;
|
|
880
888
|
let resolvedValue = value;
|
|
889
|
+
if (Array.isArray(value)) {
|
|
890
|
+
resolvedValue = value.map((innerValue) => processPayloadTemplate(innerValue, json, context));
|
|
891
|
+
}
|
|
881
892
|
if (isPlainObj(value)) {
|
|
882
893
|
resolvedValue = processPayloadTemplate(value, json, context);
|
|
883
894
|
}
|
|
@@ -1681,7 +1692,10 @@ var StateExecutor = class {
|
|
|
1681
1692
|
input,
|
|
1682
1693
|
error
|
|
1683
1694
|
);
|
|
1684
|
-
const { shouldRetry, waitTimeBeforeRetry, retrierIndex } = this.shouldRetry(
|
|
1695
|
+
const { shouldRetry, waitTimeBeforeRetry, retrierIndex } = this.shouldRetry(
|
|
1696
|
+
error,
|
|
1697
|
+
options.runOptions?.overrides?.retryIntervalOverrides
|
|
1698
|
+
);
|
|
1685
1699
|
if (shouldRetry) {
|
|
1686
1700
|
const stateDefinition = this.stateDefinition;
|
|
1687
1701
|
await sleep(waitTimeBeforeRetry, options.abortSignal);
|
|
@@ -1740,20 +1754,29 @@ var StateExecutor = class {
|
|
|
1740
1754
|
/**
|
|
1741
1755
|
* Decide whether this state should be retried, according to the `Retry` field.
|
|
1742
1756
|
*/
|
|
1743
|
-
shouldRetry(error) {
|
|
1757
|
+
shouldRetry(error, retryIntervalOverrides) {
|
|
1744
1758
|
if (!("Retry" in this.stateDefinition)) {
|
|
1745
1759
|
return { shouldRetry: false };
|
|
1746
1760
|
}
|
|
1747
1761
|
for (let i = 0; i < this.stateDefinition.Retry.length; i++) {
|
|
1748
1762
|
const retrier = this.stateDefinition.Retry[i];
|
|
1763
|
+
let intervalOverride = null;
|
|
1764
|
+
if (retryIntervalOverrides?.[this.stateName] !== void 0) {
|
|
1765
|
+
const override = retryIntervalOverrides[this.stateName];
|
|
1766
|
+
if (typeof override === "number") {
|
|
1767
|
+
intervalOverride = override / 1e3;
|
|
1768
|
+
} else if (override[i] !== void 0 && override[i] >= 0) {
|
|
1769
|
+
intervalOverride = override[i] / 1e3;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1749
1772
|
const jitterStrategy = retrier.JitterStrategy ?? DEFAULT_JITTER_STRATEGY;
|
|
1750
1773
|
const maxAttempts = retrier.MaxAttempts ?? DEFAULT_MAX_ATTEMPTS;
|
|
1751
1774
|
const intervalSeconds = retrier.IntervalSeconds ?? DEFAULT_INTERVAL_SECONDS;
|
|
1752
1775
|
const backoffRate = retrier.BackoffRate ?? DEFAULT_BACKOFF_RATE;
|
|
1753
|
-
const waitInterval = intervalSeconds * Math.pow(backoffRate, this.retrierAttempts[i]);
|
|
1776
|
+
const waitInterval = intervalOverride ?? intervalSeconds * Math.pow(backoffRate, this.retrierAttempts[i]);
|
|
1754
1777
|
const retryable = error.isRetryable ?? true;
|
|
1755
|
-
let waitTimeBeforeRetry = clamp(waitInterval,
|
|
1756
|
-
if (jitterStrategy === "FULL") {
|
|
1778
|
+
let waitTimeBeforeRetry = clamp(waitInterval, 0, retrier.MaxDelaySeconds) * 1e3;
|
|
1779
|
+
if (jitterStrategy === "FULL" && intervalOverride === null) {
|
|
1757
1780
|
waitTimeBeforeRetry = getRandomNumber(0, waitTimeBeforeRetry);
|
|
1758
1781
|
}
|
|
1759
1782
|
for (const retrierError of retrier.ErrorEquals) {
|
|
@@ -2226,7 +2249,14 @@ var StateMachine = class {
|
|
|
2226
2249
|
*/
|
|
2227
2250
|
async execute(input, options, cleanupFn) {
|
|
2228
2251
|
options.eventLogger.dispatchExecutionStartedEvent(input);
|
|
2229
|
-
const context =
|
|
2252
|
+
const context = {
|
|
2253
|
+
...options.runOptions?.context,
|
|
2254
|
+
Execution: {
|
|
2255
|
+
...options.runOptions?.context?.Execution,
|
|
2256
|
+
Input: input,
|
|
2257
|
+
StartTime: (/* @__PURE__ */ new Date()).toISOString()
|
|
2258
|
+
}
|
|
2259
|
+
};
|
|
2230
2260
|
let currState = this.definition.States[this.definition.StartAt];
|
|
2231
2261
|
let currStateName = this.definition.StartAt;
|
|
2232
2262
|
let currInput = cloneDeep3(input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aws-local-stepfunctions",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Execute an AWS Step Function state machine locally",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aws",
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@tsconfig/node16-strictest": "^1.0.4",
|
|
56
56
|
"@types/crypto-js": "^4.2.1",
|
|
57
|
-
"@types/jest": "^29.5.
|
|
58
|
-
"@types/lodash": "^4.14.
|
|
59
|
-
"@types/node": "^18.
|
|
57
|
+
"@types/jest": "^29.5.11",
|
|
58
|
+
"@types/lodash": "^4.14.202",
|
|
59
|
+
"@types/node": "^18.19.3",
|
|
60
60
|
"@types/picomatch": "^2.3.3",
|
|
61
61
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
62
62
|
"@typescript-eslint/parser": "^5.62.0",
|
|
63
|
-
"eslint": "^8.
|
|
63
|
+
"eslint": "^8.55.0",
|
|
64
64
|
"eslint-config-prettier": "^8.10.0",
|
|
65
65
|
"eslint-plugin-prettier": "^4.2.1",
|
|
66
66
|
"prettier": "^2.8.8",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"typescript": "^4.9.5"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@aws-sdk/client-lambda": "^3.
|
|
73
|
-
"@aws-sdk/credential-providers": "^3.
|
|
72
|
+
"@aws-sdk/client-lambda": "^3.470.0",
|
|
73
|
+
"@aws-sdk/credential-providers": "^3.470.0",
|
|
74
74
|
"asl-validator": "^3.8.2",
|
|
75
75
|
"commander": "^11.1.0",
|
|
76
76
|
"crypto-js": "^4.2.0",
|