enterprise-fetch 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/enterprise-fetch.cjs.js +20 -3
- package/package.json +1 -1
|
@@ -6,6 +6,23 @@ var AbortController = require('abort-controller');
|
|
|
6
6
|
var awaitToJs = require('await-to-js');
|
|
7
7
|
var promiseRetry = require('promise-retry');
|
|
8
8
|
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
9
26
|
const fetchDefaults = {
|
|
10
27
|
// The timeout to apply to requests that do not supply a timeout option
|
|
11
28
|
timeout: 60 * 1000,
|
|
@@ -53,7 +70,7 @@ const resolveFetch = async () => {
|
|
|
53
70
|
return window.fetch;
|
|
54
71
|
if (node !== 'node') {
|
|
55
72
|
globalThis.fallbackFetch = true;
|
|
56
|
-
globalThis.fetch = (await
|
|
73
|
+
globalThis.fetch = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefault(require('node-fetch')); })).default;
|
|
57
74
|
}
|
|
58
75
|
return globalThis.fetch;
|
|
59
76
|
};
|
|
@@ -67,7 +84,7 @@ const proxyAgent = async () => {
|
|
|
67
84
|
// https://www.npmjs.com/package/node-fetch#custom-agent
|
|
68
85
|
// NOTE: This uses the HttpsProxyAgent class from https-proxy-agent v7.x
|
|
69
86
|
// Will break in v8+ where only a default factory function is exported
|
|
70
|
-
const { HttpsProxyAgent } = await
|
|
87
|
+
const { HttpsProxyAgent } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefault(require('https-proxy-agent')); });
|
|
71
88
|
return { agent: new HttpsProxyAgent(proxyUri) };
|
|
72
89
|
}
|
|
73
90
|
else {
|
|
@@ -78,7 +95,7 @@ const proxyAgent = async () => {
|
|
|
78
95
|
// If only http_proxy is set, http_proxy is used for both HTTP and HTTPS requests.
|
|
79
96
|
// If only https_proxy is set, it is only used for HTTPS requests.
|
|
80
97
|
// https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent.md
|
|
81
|
-
const { EnvHttpProxyAgent } = await
|
|
98
|
+
const { EnvHttpProxyAgent } = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefault(require('undici')); });
|
|
82
99
|
return { dispatcher: new EnvHttpProxyAgent() };
|
|
83
100
|
}
|
|
84
101
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "enterprise-fetch",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A fetch wrapper to leverage enterprise features such as retry policy and request timeout",
|
|
5
5
|
"browser": "dist/client/enterprise-fetch.esm.min.js",
|
|
6
6
|
"module": "dist/enterprise-fetch.esm.js",
|