Socket
Socket
Sign inDemoInstall

@sp-api-sdk/common

Package Overview
Dependencies
Maintainers
2
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sp-api-sdk/common - npm Package Compare versions

Comparing version 1.9.13 to 1.9.14

18

dist/cjs/src/axios.js

@@ -27,13 +27,13 @@ "use strict";

(0, axios_retry_1.default)(instance, {
retryCondition: (error) => (error.response ? error.response.status === 429 : false),
retryCondition: (error) => error.response?.status === 429,
retryDelay(retryCount, error) {
const amznRateLimit = error.response?.headers['x-amzn-ratelimit-limit'];
const url = new URL(error.config.url);
const rateLimit = amznRateLimit
? Number.parseFloat(amznRateLimit)
: rateLimits.find((rateLimit) => rateLimit.method.toLowerCase() === error.config.method?.toLowerCase() &&
rateLimit.urlRegex.exec(url.pathname))?.rate;
const delay = rateLimit && !Number.isNaN(rateLimit) ? (1 / rateLimit) * 1000 + 1500 : 60 * 1000;
if (rateLimiting?.onRetry) {
rateLimiting.onRetry({ delay, rateLimit });
const method = error.config.method?.toLowerCase();
const amznRateLimit = Number.parseFloat(error.response?.headers['x-amzn-ratelimit-limit'] ?? '');
const rateLimit = Number.isNaN(amznRateLimit)
? rateLimits.find((rateLimit) => rateLimit.method.toLowerCase() === method && rateLimit.urlRegex.exec(url.pathname))?.rate
: amznRateLimit;
const delay = rateLimit ? (1 / rateLimit) * 1000 + 1500 : 60 * 1000;
if (rateLimiting.onRetry) {
rateLimiting.onRetry({ delay, rateLimit, retryCount, error });
}

@@ -40,0 +40,0 @@ return delay;

@@ -23,13 +23,13 @@ import { aws4Interceptor } from 'aws4-axios';

axiosRetry(instance, {
retryCondition: (error) => (error.response ? error.response.status === 429 : false),
retryCondition: (error) => error.response?.status === 429,
retryDelay(retryCount, error) {
const amznRateLimit = error.response?.headers['x-amzn-ratelimit-limit'];
const url = new URL(error.config.url);
const rateLimit = amznRateLimit
? Number.parseFloat(amznRateLimit)
: rateLimits.find((rateLimit) => rateLimit.method.toLowerCase() === error.config.method?.toLowerCase() &&
rateLimit.urlRegex.exec(url.pathname))?.rate;
const delay = rateLimit && !Number.isNaN(rateLimit) ? (1 / rateLimit) * 1000 + 1500 : 60 * 1000;
if (rateLimiting?.onRetry) {
rateLimiting.onRetry({ delay, rateLimit });
const method = error.config.method?.toLowerCase();
const amznRateLimit = Number.parseFloat(error.response?.headers['x-amzn-ratelimit-limit'] ?? '');
const rateLimit = Number.isNaN(amznRateLimit)
? rateLimits.find((rateLimit) => rateLimit.method.toLowerCase() === method && rateLimit.urlRegex.exec(url.pathname))?.rate
: amznRateLimit;
const delay = rateLimit ? (1 / rateLimit) * 1000 + 1500 : 60 * 1000;
if (rateLimiting.onRetry) {
rateLimiting.onRetry({ delay, rateLimit, retryCount, error });
}

@@ -36,0 +36,0 @@ return delay;

@@ -1,2 +0,2 @@

import { type Method } from 'axios';
import { type AxiosError, type Method } from 'axios';
import { errorLogger, requestLogger, responseLogger } from 'axios-logger';

@@ -17,2 +17,4 @@ import { type SellingPartnerApiAuth } from '@sp-api-sdk/auth';

rateLimit?: number;
retryCount: number;
error: AxiosError;
}

@@ -19,0 +21,0 @@ export interface ClientConfiguration {

@@ -5,3 +5,3 @@ {

"description": "Selling Parner API common library",
"version": "1.9.13",
"version": "1.9.14",
"main": "dist/cjs/index.js",

@@ -31,3 +31,3 @@ "module": "dist/es/index.js",

"dependencies": {
"@sp-api-sdk/auth": "^1.10.0",
"@sp-api-sdk/auth": "^1.10.1",
"aws4-axios": "^2.4.9",

@@ -64,3 +64,3 @@ "axios": "^0.27.2",

},
"gitHead": "2654c12d994c84d63bac0353950603f1db4ea815"
"gitHead": "b1a628f884e9e251eae587cc474baf5d52c9f294"
}
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