@smithy/middleware-retry
Advanced tools
Comparing version 3.0.34 to 4.0.0
@@ -57,5 +57,5 @@ var __defProp = Object.defineProperty; | ||
const MAX_CAPACITY = initialRetryTokens; | ||
const noRetryIncrement = (options == null ? void 0 : options.noRetryIncrement) ?? import_util_retry.NO_RETRY_INCREMENT; | ||
const retryCost = (options == null ? void 0 : options.retryCost) ?? import_util_retry.RETRY_COST; | ||
const timeoutRetryCost = (options == null ? void 0 : options.timeoutRetryCost) ?? import_util_retry.TIMEOUT_RETRY_COST; | ||
const noRetryIncrement = options?.noRetryIncrement ?? import_util_retry.NO_RETRY_INCREMENT; | ||
const retryCost = options?.retryCost ?? import_util_retry.RETRY_COST; | ||
const timeoutRetryCost = options?.timeoutRetryCost ?? import_util_retry.TIMEOUT_RETRY_COST; | ||
let availableCapacity = initialRetryTokens; | ||
@@ -108,10 +108,13 @@ const getCapacityAmount = /* @__PURE__ */ __name((error) => error.name === "TimeoutError" ? timeoutRetryCost : retryCost, "getCapacityAmount"); | ||
// src/StandardRetryStrategy.ts | ||
var _StandardRetryStrategy = class _StandardRetryStrategy { | ||
var StandardRetryStrategy = class { | ||
constructor(maxAttemptsProvider, options) { | ||
this.maxAttemptsProvider = maxAttemptsProvider; | ||
this.mode = import_util_retry.RETRY_MODES.STANDARD; | ||
this.retryDecider = (options == null ? void 0 : options.retryDecider) ?? defaultRetryDecider; | ||
this.delayDecider = (options == null ? void 0 : options.delayDecider) ?? defaultDelayDecider; | ||
this.retryQuota = (options == null ? void 0 : options.retryQuota) ?? getDefaultRetryQuota(import_util_retry.INITIAL_RETRY_TOKENS); | ||
this.retryDecider = options?.retryDecider ?? defaultRetryDecider; | ||
this.delayDecider = options?.delayDecider ?? defaultDelayDecider; | ||
this.retryQuota = options?.retryQuota ?? getDefaultRetryQuota(import_util_retry.INITIAL_RETRY_TOKENS); | ||
} | ||
static { | ||
__name(this, "StandardRetryStrategy"); | ||
} | ||
shouldRetry(error, attempts, maxAttempts) { | ||
@@ -143,7 +146,7 @@ return attempts < maxAttempts && this.retryDecider(error) && this.retryQuota.hasRetryTokens(error); | ||
} | ||
if (options == null ? void 0 : options.beforeRequest) { | ||
if (options?.beforeRequest) { | ||
await options.beforeRequest(); | ||
} | ||
const { response, output } = await next(args); | ||
if (options == null ? void 0 : options.afterRequest) { | ||
if (options?.afterRequest) { | ||
options.afterRequest(response); | ||
@@ -180,4 +183,2 @@ } | ||
}; | ||
__name(_StandardRetryStrategy, "StandardRetryStrategy"); | ||
var StandardRetryStrategy = _StandardRetryStrategy; | ||
var getDelayFromRetryAfterHeader = /* @__PURE__ */ __name((response) => { | ||
@@ -198,3 +199,6 @@ if (!import_protocol_http.HttpResponse.isInstance(response)) | ||
// src/AdaptiveRetryStrategy.ts | ||
var _AdaptiveRetryStrategy = class _AdaptiveRetryStrategy extends StandardRetryStrategy { | ||
var AdaptiveRetryStrategy = class extends StandardRetryStrategy { | ||
static { | ||
__name(this, "AdaptiveRetryStrategy"); | ||
} | ||
constructor(maxAttemptsProvider, options) { | ||
@@ -217,4 +221,2 @@ const { rateLimiter, ...superOptions } = options ?? {}; | ||
}; | ||
__name(_AdaptiveRetryStrategy, "AdaptiveRetryStrategy"); | ||
var AdaptiveRetryStrategy = _AdaptiveRetryStrategy; | ||
@@ -307,3 +309,2 @@ // src/configurations.ts | ||
var retryMiddleware = /* @__PURE__ */ __name((options) => (next, context) => async (args) => { | ||
var _a; | ||
let retryStrategy = await options.retryStrategy(); | ||
@@ -336,3 +337,3 @@ const maxAttempts = await options.maxAttempts(); | ||
if (isRequest && (0, import_isStreamingPayload.isStreamingPayload)(request)) { | ||
(_a = context.logger instanceof import_smithy_client.NoOpLogger ? console : context.logger) == null ? void 0 : _a.warn( | ||
(context.logger instanceof import_smithy_client.NoOpLogger ? console : context.logger)?.warn( | ||
"An error was encountered in a non-retryable streaming request." | ||
@@ -360,3 +361,3 @@ ); | ||
retryStrategy = retryStrategy; | ||
if (retryStrategy == null ? void 0 : retryStrategy.mode) | ||
if (retryStrategy?.mode) | ||
context.userAgent = [...context.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]]; | ||
@@ -363,0 +364,0 @@ return retryStrategy.retry(next, args); |
{ | ||
"name": "@smithy/middleware-retry", | ||
"version": "3.0.34", | ||
"version": "4.0.0", | ||
"scripts": { | ||
@@ -36,9 +36,9 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'", | ||
"dependencies": { | ||
"@smithy/node-config-provider": "^3.1.12", | ||
"@smithy/protocol-http": "^4.1.8", | ||
"@smithy/service-error-classification": "^3.0.11", | ||
"@smithy/smithy-client": "^3.7.0", | ||
"@smithy/types": "^3.7.2", | ||
"@smithy/util-middleware": "^3.0.11", | ||
"@smithy/util-retry": "^3.0.11", | ||
"@smithy/node-config-provider": "^4.0.0", | ||
"@smithy/protocol-http": "^5.0.0", | ||
"@smithy/service-error-classification": "^4.0.0", | ||
"@smithy/smithy-client": "^4.0.0", | ||
"@smithy/types": "^4.0.0", | ||
"@smithy/util-middleware": "^4.0.0", | ||
"@smithy/util-retry": "^4.0.0", | ||
"tslib": "^2.6.2", | ||
@@ -56,3 +56,3 @@ "uuid": "^9.0.1" | ||
"engines": { | ||
"node": ">=16.0.0" | ||
"node": ">=18.0.0" | ||
}, | ||
@@ -59,0 +59,0 @@ "typesVersions": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1309
66260
+ Added@smithy/abort-controller@4.0.1(transitive)
+ Added@smithy/core@3.1.0(transitive)
+ Added@smithy/fetch-http-handler@5.0.1(transitive)
+ Added@smithy/is-array-buffer@4.0.0(transitive)
+ Added@smithy/middleware-endpoint@4.0.1(transitive)
+ Added@smithy/middleware-serde@4.0.1(transitive)
+ Added@smithy/middleware-stack@4.0.1(transitive)
+ Added@smithy/node-config-provider@4.0.1(transitive)
+ Added@smithy/node-http-handler@4.0.1(transitive)
+ Added@smithy/property-provider@4.0.1(transitive)
+ Added@smithy/protocol-http@5.0.1(transitive)
+ Added@smithy/querystring-builder@4.0.1(transitive)
+ Added@smithy/querystring-parser@4.0.1(transitive)
+ Added@smithy/service-error-classification@4.0.1(transitive)
+ Added@smithy/shared-ini-file-loader@4.0.1(transitive)
+ Added@smithy/smithy-client@4.1.0(transitive)
+ Added@smithy/types@4.1.0(transitive)
+ Added@smithy/url-parser@4.0.1(transitive)
+ Added@smithy/util-base64@4.0.0(transitive)
+ Added@smithy/util-body-length-browser@4.0.0(transitive)
+ Added@smithy/util-buffer-from@4.0.0(transitive)
+ Added@smithy/util-hex-encoding@4.0.0(transitive)
+ Added@smithy/util-middleware@4.0.1(transitive)
+ Added@smithy/util-retry@4.0.1(transitive)
+ Added@smithy/util-stream@4.0.1(transitive)
+ Added@smithy/util-uri-escape@4.0.0(transitive)
+ Added@smithy/util-utf8@4.0.0(transitive)
- Removed@smithy/abort-controller@3.1.9(transitive)
- Removed@smithy/core@2.5.7(transitive)
- Removed@smithy/fetch-http-handler@4.1.3(transitive)
- Removed@smithy/is-array-buffer@3.0.0(transitive)
- Removed@smithy/middleware-endpoint@3.2.8(transitive)
- Removed@smithy/middleware-serde@3.0.11(transitive)
- Removed@smithy/middleware-stack@3.0.11(transitive)
- Removed@smithy/node-config-provider@3.1.12(transitive)
- Removed@smithy/node-http-handler@3.3.3(transitive)
- Removed@smithy/property-provider@3.1.11(transitive)
- Removed@smithy/protocol-http@4.1.8(transitive)
- Removed@smithy/querystring-builder@3.0.11(transitive)
- Removed@smithy/querystring-parser@3.0.11(transitive)
- Removed@smithy/service-error-classification@3.0.11(transitive)
- Removed@smithy/shared-ini-file-loader@3.1.12(transitive)
- Removed@smithy/smithy-client@3.7.0(transitive)
- Removed@smithy/types@3.7.2(transitive)
- Removed@smithy/url-parser@3.0.11(transitive)
- Removed@smithy/util-base64@3.0.0(transitive)
- Removed@smithy/util-body-length-browser@3.0.0(transitive)
- Removed@smithy/util-buffer-from@3.0.0(transitive)
- Removed@smithy/util-hex-encoding@3.0.0(transitive)
- Removed@smithy/util-middleware@3.0.11(transitive)
- Removed@smithy/util-retry@3.0.11(transitive)
- Removed@smithy/util-stream@3.3.4(transitive)
- Removed@smithy/util-uri-escape@3.0.0(transitive)
- Removed@smithy/util-utf8@3.0.0(transitive)
Updated@smithy/protocol-http@^5.0.0
Updated@smithy/smithy-client@^4.0.0
Updated@smithy/types@^4.0.0
Updated@smithy/util-retry@^4.0.0