myfetchapi
Advanced tools
Comparing version 1.7.4 to 1.7.5
import type * as nodefetch from "node-fetch"; | ||
/** | ||
* set maximum number of concurrent requests (requests made at thesame time) | ||
* @param max @default 500 | ||
*/ | ||
export declare const SET_MAX_CONCURRENT_REQUESTS: (max: number) => void; | ||
export type myFetchOptions = { | ||
export type MyFetchRequestInfo = RequestInfo | nodefetch.RequestInfo; | ||
export type MyFetchRequestInit = RequestInit | nodefetch.RequestInit; | ||
export type MyFetchOptions = { | ||
/** | ||
@@ -32,2 +29,7 @@ * set this to `true` in order to use nodejs features, e.g agents | ||
}; | ||
export declare function myFetch(input: RequestInfo | nodefetch.RequestInfo, init?: RequestInit | nodefetch.RequestInit, options?: myFetchOptions): Promise<Response>; | ||
/** | ||
* set maximum number of concurrent requests (requests made at thesame time) | ||
* @param max @default 500 | ||
*/ | ||
export declare const SET_MAX_CONCURRENT_REQUESTS: (max: number) => void; | ||
export declare function myFetch(input: MyFetchRequestInfo, init?: MyFetchRequestInit, options?: MyFetchOptions): Promise<Response>; |
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -18,2 +20,10 @@ var __export = (target, all) => { | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -28,2 +38,3 @@ | ||
module.exports = __toCommonJS(src_exports); | ||
var nfetch = __toESM(require("./nodeFetch")); | ||
var MAX_CONCURRENT_REQUESTS = 500; | ||
@@ -37,3 +48,3 @@ var currentRequests = 0; | ||
try { | ||
const httpFunc = options?.useNodeFetch ? (await require("./nodeFetch.js")).fetch : fetch; | ||
const httpFunc = options?.useNodeFetch ? nfetch.fetch : fetch; | ||
const res = await httpFunc(input, init); | ||
@@ -40,0 +51,0 @@ const isOkay = options?.retryCondition ? await options.retryCondition(res) : res.ok; |
{ | ||
"name": "myfetchapi", | ||
"version": "1.7.4", | ||
"version": "1.7.5", | ||
"description": "mFetch is a JavaScript library that provides a utility function for making HTTP requests with queuing and retry functionality.", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
Sorry, the diff of this file is not supported yet
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
539386
13087
3