Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@smithy/middleware-retry

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@smithy/middleware-retry - npm Package Compare versions

Comparing version 3.0.34 to 4.0.0

35

dist-cjs/index.js

@@ -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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc