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
71
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 2.0.21 to 2.0.22

dist-cjs/isStreamingPayload/isStreamingPayload.browser.js

12

dist-cjs/retryMiddleware.js

@@ -6,6 +6,9 @@ "use strict";

const service_error_classification_1 = require("@smithy/service-error-classification");
const smithy_client_1 = require("@smithy/smithy-client");
const util_retry_1 = require("@smithy/util-retry");
const uuid_1 = require("uuid");
const isStreamingPayload_1 = require("./isStreamingPayload/isStreamingPayload");
const util_1 = require("./util");
const retryMiddleware = (options) => (next, context) => async (args) => {
var _a;
let retryStrategy = await options.retryStrategy();

@@ -20,3 +23,4 @@ const maxAttempts = await options.maxAttempts();

const { request } = args;
if (protocol_http_1.HttpRequest.isInstance(request)) {
const isRequest = protocol_http_1.HttpRequest.isInstance(request);
if (isRequest) {
request.headers[util_retry_1.INVOCATION_ID_HEADER] = (0, uuid_1.v4)();

@@ -26,3 +30,3 @@ }

try {
if (protocol_http_1.HttpRequest.isInstance(request)) {
if (isRequest) {
request.headers[util_retry_1.REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;

@@ -39,2 +43,6 @@ }

lastError = (0, util_1.asSdkError)(e);
if (isRequest && (0, isStreamingPayload_1.isStreamingPayload)(request)) {
(_a = (context.logger instanceof smithy_client_1.NoOpLogger ? console : context.logger)) === null || _a === void 0 ? void 0 : _a.warn("An error was encountered in a non-retryable streaming request.");
throw lastError;
}
try {

@@ -41,0 +49,0 @@ retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);

import { HttpRequest, HttpResponse } from "@smithy/protocol-http";
import { isServerError, isThrottlingError, isTransientError } from "@smithy/service-error-classification";
import { NoOpLogger } from "@smithy/smithy-client";
import { INVOCATION_ID_HEADER, REQUEST_HEADER } from "@smithy/util-retry";
import { v4 } from "uuid";
import { isStreamingPayload } from "./isStreamingPayload/isStreamingPayload";
import { asSdkError } from "./util";

@@ -16,3 +18,4 @@ export const retryMiddleware = (options) => (next, context) => async (args) => {

const { request } = args;
if (HttpRequest.isInstance(request)) {
const isRequest = HttpRequest.isInstance(request);
if (isRequest) {
request.headers[INVOCATION_ID_HEADER] = v4();

@@ -22,3 +25,3 @@ }

try {
if (HttpRequest.isInstance(request)) {
if (isRequest) {
request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;

@@ -35,2 +38,6 @@ }

lastError = asSdkError(e);
if (isRequest && isStreamingPayload(request)) {
(context.logger instanceof NoOpLogger ? console : context.logger)?.warn("An error was encountered in a non-retryable streaming request.");
throw lastError;
}
try {

@@ -37,0 +44,0 @@ retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo);

26

package.json
{
"name": "@smithy/middleware-retry",
"version": "2.0.21",
"version": "2.0.22",
"scripts": {

@@ -11,3 +11,3 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",

"stage-release": "rimraf ./.release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",

@@ -22,2 +22,9 @@ "format": "prettier --config ../../prettier.config.js --ignore-path ../.prettierignore --write \"**/*.{ts,md,json}\"",

"types": "./dist-types/index.d.ts",
"browser": {
"./dist-es/isStreamingPayload/isStreamingPayload": "./dist-es/isStreamingPayload/isStreamingPayload.browser"
},
"react-native": {
"./dist-cjs/isStreamingPayload/isStreamingPayload": "./dist-cjs/isStreamingPayload/isStreamingPayload.browser",
"./dist-es/isStreamingPayload/isStreamingPayload": "./dist-es/isStreamingPayload/isStreamingPayload.browser"
},
"author": {

@@ -29,8 +36,9 @@ "name": "AWS SDK for JavaScript Team",

"dependencies": {
"@smithy/node-config-provider": "^2.1.6",
"@smithy/protocol-http": "^3.0.10",
"@smithy/service-error-classification": "^2.0.7",
"@smithy/types": "^2.6.0",
"@smithy/util-middleware": "^2.0.7",
"@smithy/util-retry": "^2.0.7",
"@smithy/node-config-provider": "^2.1.7",
"@smithy/protocol-http": "^3.0.11",
"@smithy/service-error-classification": "^2.0.8",
"@smithy/smithy-client": "^2.1.17",
"@smithy/types": "^2.7.0",
"@smithy/util-middleware": "^2.0.8",
"@smithy/util-retry": "^2.0.8",
"tslib": "^2.5.0",

@@ -40,3 +48,3 @@ "uuid": "^8.3.2"

"devDependencies": {
"@smithy/util-test": "^0.1.10",
"@smithy/util-test": "^0.1.11",
"@tsconfig/recommended": "1.0.1",

@@ -43,0 +51,0 @@ "@types/uuid": "^8.3.0",

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