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

@pnpm/fetch

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnpm/fetch - npm Package Compare versions

Comparing version 4.1.2 to 4.1.3

26

lib/fetch.js

@@ -27,18 +27,14 @@ "use strict";

Object.defineProperty(exports, "Response", { enumerable: true, get: function () { return node_fetch_1.Response; } });
// retry settings
const MIN_TIMEOUT = 10;
const MAX_RETRIES = 5;
const MAX_RETRY_AFTER = 20;
const FACTOR = 6;
exports.isRedirect = node_fetch_1.default.isRedirect;
async function fetchRetry(url, opts = {}) {
const retryOpts = Object.assign({
factor: FACTOR,
// timeouts will be [10, 60, 360, 2160, 12960]
// (before randomization is added)
maxRetryAfter: MAX_RETRY_AFTER,
minTimeout: MIN_TIMEOUT,
retries: MAX_RETRIES,
}, opts.retry);
const op = (0, retry_1.operation)(retryOpts);
var _a, _b, _c, _d, _e;
const retryOpts = (_a = opts.retry) !== null && _a !== void 0 ? _a : {};
const maxRetries = (_b = retryOpts.retries) !== null && _b !== void 0 ? _b : 2;
const op = (0, retry_1.operation)({
factor: (_c = retryOpts.factor) !== null && _c !== void 0 ? _c : 10,
maxTimeout: (_d = retryOpts.maxTimeout) !== null && _d !== void 0 ? _d : 60000,
minTimeout: (_e = retryOpts.minTimeout) !== null && _e !== void 0 ? _e : 10000,
randomize: false,
retries: maxRetries,
});
try {

@@ -67,3 +63,3 @@ return await new Promise((resolve, reject) => op.attempt(async (attempt) => {

error,
maxRetries: retryOpts.retries,
maxRetries,
method: (_a = opts.method) !== null && _a !== void 0 ? _a : 'GET',

@@ -70,0 +66,0 @@ timeout,

{
"name": "@pnpm/fetch",
"version": "4.1.2",
"version": "4.1.3",
"description": "node-fetch with retries",

@@ -31,3 +31,3 @@ "main": "lib/index.js",

"@pnpm/fetching-types": "2.2.1",
"@pnpm/npm-registry-agent": "5.0.1",
"@pnpm/npm-registry-agent": "5.0.2",
"@zkochan/retry": "^0.2.0",

@@ -43,3 +43,3 @@ "node-fetch": "3.0.0-beta.9"

"scripts": {
"lint": "eslint -c ../../eslint.json src/**/*.ts test/**/*.ts",
"lint": "eslint src/**/*.ts test/**/*.ts",
"_test": "jest",

@@ -46,0 +46,0 @@ "test": "pnpm run compile && pnpm run _test",

Sorry, the diff of this file is not supported yet

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