enterprise-fetch 2.0.0 → 2.0.1
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/client/enterprise-fetch.cjs.js +33 -16
- package/dist/client/enterprise-fetch.cjs.min.js +2 -2
- package/dist/client/enterprise-fetch.esm.js +39 -15
- package/dist/client/enterprise-fetch.esm.min.js +1 -1
- package/dist/enterprise-fetch.cjs.js +35 -13
- package/dist/enterprise-fetch.esm.js +35 -13
- package/dist/enterprise-fetch.esm.js.map +1 -1
- package/dist/util/server/is-node.d.ts +2 -0
- package/package.json +10 -3
|
@@ -1051,29 +1051,36 @@
|
|
|
1051
1051
|
return typeof window !== 'undefined';
|
|
1052
1052
|
};
|
|
1053
1053
|
|
|
1054
|
+
var isNode = function isNode() {
|
|
1055
|
+
if (isClient()) return false;
|
|
1056
|
+
if (!globalThis.fallbackFetch && typeof globalThis.fetch === 'function') return 'node';
|
|
1057
|
+
return 'node-fetch';
|
|
1058
|
+
};
|
|
1059
|
+
|
|
1054
1060
|
var resolveFetch = /*#__PURE__*/function () {
|
|
1055
1061
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
1056
|
-
var
|
|
1062
|
+
var node;
|
|
1057
1063
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
1058
1064
|
while (1) switch (_context.prev = _context.next) {
|
|
1059
1065
|
case 0:
|
|
1060
|
-
|
|
1066
|
+
node = isNode();
|
|
1067
|
+
if (node) {
|
|
1061
1068
|
_context.next = 1;
|
|
1062
1069
|
break;
|
|
1063
1070
|
}
|
|
1064
1071
|
return _context.abrupt("return", window.fetch);
|
|
1065
1072
|
case 1:
|
|
1066
|
-
if (!(
|
|
1067
|
-
_context.next =
|
|
1073
|
+
if (!(node !== 'node')) {
|
|
1074
|
+
_context.next = 3;
|
|
1068
1075
|
break;
|
|
1069
1076
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
_context.next = 3;
|
|
1077
|
+
globalThis.fallbackFetch = true;
|
|
1078
|
+
_context.next = 2;
|
|
1073
1079
|
return ('node-fetch');
|
|
1080
|
+
case 2:
|
|
1081
|
+
globalThis.fetch = _context.sent["default"];
|
|
1074
1082
|
case 3:
|
|
1075
|
-
|
|
1076
|
-
return _context.abrupt("return", nodeFetch["default"]);
|
|
1083
|
+
return _context.abrupt("return", globalThis.fetch);
|
|
1077
1084
|
case 4:
|
|
1078
1085
|
case "end":
|
|
1079
1086
|
return _context.stop();
|
|
@@ -1088,19 +1095,20 @@
|
|
|
1088
1095
|
// Setting http_proxy in env will inject a proxy agent header and disable certificate verification
|
|
1089
1096
|
var proxyAgent = /*#__PURE__*/function () {
|
|
1090
1097
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
1091
|
-
var proxyUri, _yield$import, HttpsProxyAgent;
|
|
1098
|
+
var proxyUri, _yield$import, HttpsProxyAgent, _yield$import2, EnvHttpProxyAgent;
|
|
1092
1099
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
1093
1100
|
while (1) switch (_context.prev = _context.next) {
|
|
1094
1101
|
case 0:
|
|
1095
|
-
proxyUri = !isClient() &&
|
|
1102
|
+
proxyUri = !isClient() && process.env.http_proxy;
|
|
1096
1103
|
if (!proxyUri) {
|
|
1097
|
-
_context.next =
|
|
1104
|
+
_context.next = 4;
|
|
1098
1105
|
break;
|
|
1099
1106
|
}
|
|
1100
|
-
// console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
|
|
1101
1107
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
1102
|
-
|
|
1103
|
-
|
|
1108
|
+
if (!globalThis.fallbackFetch) {
|
|
1109
|
+
_context.next = 2;
|
|
1110
|
+
break;
|
|
1111
|
+
}
|
|
1104
1112
|
_context.next = 1;
|
|
1105
1113
|
return ('https-proxy-agent');
|
|
1106
1114
|
case 1:
|
|
@@ -1110,8 +1118,17 @@
|
|
|
1110
1118
|
agent: new HttpsProxyAgent(proxyUri)
|
|
1111
1119
|
});
|
|
1112
1120
|
case 2:
|
|
1113
|
-
|
|
1121
|
+
_context.next = 3;
|
|
1122
|
+
return ('undici');
|
|
1114
1123
|
case 3:
|
|
1124
|
+
_yield$import2 = _context.sent;
|
|
1125
|
+
EnvHttpProxyAgent = _yield$import2.EnvHttpProxyAgent;
|
|
1126
|
+
return _context.abrupt("return", {
|
|
1127
|
+
dispatcher: new EnvHttpProxyAgent()
|
|
1128
|
+
});
|
|
1129
|
+
case 4:
|
|
1130
|
+
return _context.abrupt("return", {});
|
|
1131
|
+
case 5:
|
|
1115
1132
|
case "end":
|
|
1116
1133
|
return _context.stop();
|
|
1117
1134
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch-legacy"]={})}(this,function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r);if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function n(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],s=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e);else for(;!(s=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);s=!0);}catch(t){c=!0,o=t}finally{try{if(!s&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function a(t,e,r,n,o,i,u){try{var a=t[i](u),s=a.value}catch(t){return void r(t)}a.done?e(s):Promise.resolve(s).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,s,"next",t)}function s(t){a(i,n,o,u,s,"throw",t)}u(void 0)})}}function c(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var f,p={exports:{}},l={exports:{}};function y(){return f||(f=1,function(t){t.exports=function(t,e){this.v=t,this.k=e},t.exports.__esModule=!0,t.exports.default=t.exports}(l)),l.exports}var m,
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch-legacy"]={})}(this,function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r);if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function n(t,e,n){return(e=r(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],s=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e);else for(;!(s=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);s=!0);}catch(t){c=!0,o=t}finally{try{if(!s&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(c)throw o}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function a(t,e,r,n,o,i,u){try{var a=t[i](u),s=a.value}catch(t){return void r(t)}a.done?e(s):Promise.resolve(s).then(n,o)}function s(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,s,"next",t)}function s(t){a(i,n,o,u,s,"throw",t)}u(void 0)})}}function c(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var f,p={exports:{}},l={exports:{}};function y(){return f||(f=1,function(t){t.exports=function(t,e){this.v=t,this.k=e},t.exports.__esModule=!0,t.exports.default=t.exports}(l)),l.exports}var h,m,v={exports:{}},d={exports:{}};function x(){return h||(h=1,function(t){function e(r,n,o,i){var u=Object.defineProperty;try{u({},"",{})}catch(r){u=0}t.exports=e=function(t,r,n,o){function i(r,n){e(t,r,function(t){return this._invoke(r,n,t)})}r?u?u(t,r,{value:n,enumerable:!o,configurable:!o,writable:!o}):t[r]=n:(i("next",0),i("throw",1),i("return",2))},t.exports.__esModule=!0,t.exports.default=t.exports,e(r,n,o,i)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(d)),d.exports}function b(){return m||(m=1,function(t){var e=x();function r(){
|
|
2
2
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
3
|
-
var n,o,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.toStringTag||"@@toStringTag";function s(t,r,i,u){var a=r&&r.prototype instanceof f?r:f,s=Object.create(a.prototype);return e(s,"_invoke",function(t,e,r){var i,u,a,s=0,f=r||[],p=!1,l={p:0,n:0,v:n,a:y,f:y.bind(n,4),d:function(t,e){return i=t,u=0,a=n,l.n=e,c}};function y(t,e){for(u=t,a=e,o=0;!p&&s&&!r&&o<f.length;o++){var r,i=f[o],y=l.p,m=i[2];t>3?(r=m===e)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=n):i[0]<=y&&((r=t<2&&y<i[1])?(u=0,l.v=e,l.n=i[1]):y<m&&(r=t<3||i[0]>e||e>m)&&(i[4]=t,i[5]=e,l.n=m,u=0))}if(r||t>1)return c;throw p=!0,e}return function(r,f,m){if(s>1)throw TypeError("Generator is already running");for(p&&1===f&&y(f,m),u=f,a=m;(o=u<2?n:a)||!p;){i||(u?u<3?(u>1&&(l.n=-1),y(u,a)):l.n=a:l.v=a);try{if(s=2,i){if(u||(r="next"),o=i[r]){if(!(o=o.call(i,a)))throw TypeError("iterator result is not an object");if(!o.done)return o;a=o.value,u<2&&(u=0)}else 1===u&&(o=i.return)&&o.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+r+"' method"),u=1);i=n}else if((o=(p=l.n<0)?a:t.call(e,l))!==c)break}catch(t){i=n,u=1,a=t}finally{s=1}}return{value:o,done:p}}}(t,i,u),!0),s}var c={};function f(){}function p(){}function l(){}o=Object.getPrototypeOf;var y=[][u]?o(o([][u]())):(e(o={},u,function(){return this}),o),m=l.prototype=f.prototype=Object.create(y);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,e(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t}return p.prototype=l,e(m,"constructor",l),e(l,"constructor",p),p.displayName="GeneratorFunction",e(l,a,"GeneratorFunction"),e(m),e(m,a,"Generator"),e(m,u,function(){return this}),e(m,"toString",function(){return"[object Generator]"}),(t.exports=r=function(){return{w:s,m:h}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}(v)),v.exports}var _,g,w,T={exports:{}},O={exports:{}},j={exports:{}};function S(){return _||(_=1,function(t){var e=y(),r=x();t.exports=function t(n,o){function i(t,r,u,a){try{var s=n[t](r),c=s.value;return c instanceof e?o.resolve(c.v).then(function(t){i("next",t,u,a)},function(t){i("throw",t,u,a)}):o.resolve(c).then(function(t){s.value=t,u(s)},function(t){return i("throw",t,u,a)})}catch(t){a(t)}}var u;this.next||(r(t.prototype),r(t.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(t,e,r){function n(){return new o(function(e,n){i(t,r,e,n)})}return u=u?u.then(n,n):n()},!0)},t.exports.__esModule=!0,t.exports.default=t.exports}(j)),j.exports}function P(){return g||(g=1,function(t){var e=b(),r=S();t.exports=function(t,n,o,i,u){return new r(e().w(t,n,o,i),u||Promise)},t.exports.__esModule=!0,t.exports.default=t.exports}(O)),O.exports}function k(){return w||(w=1,function(t){var e=P();t.exports=function(t,r,n,o,i){var u=e(t,r,n,o,i);return u.next().then(function(t){return t.done?t.value:u.next()})},t.exports.__esModule=!0,t.exports.default=t.exports}(T)),T.exports}var E,R={exports:{}};function M(){return E||(E=1,function(t){t.exports=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},t.exports.__esModule=!0,t.exports.default=t.exports}(R)),R.exports}var A,N,I,C,D,G={exports:{}},F={exports:{}};function U(){return A||(A=1,function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(F)),F.exports}function J(){return N||(N=1,function(t){var e=U().default;t.exports=function(t){if(null!=t){var r=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(e(t)+" is not iterable")},t.exports.__esModule=!0,t.exports.default=t.exports}(G)),G.exports}var Y,z=function(){if(D)return C;D=1;var t=(I||(I=1,function(t){var e=y(),r=b(),n=k(),o=P(),i=S(),u=M(),a=J();function s(){var c=r(),f=c.m(s),p=(Object.getPrototypeOf?Object.getPrototypeOf(f):f.__proto__).constructor;function l(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))}var y={throw:1,return:2,break:3,continue:3};function m(t){var e,r;return function(n){e||(e={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(t,e){return r(n.a,y[t],e)},delegateYield:function(t,o,i){return e.resultName=o,r(n.d,a(t),i)},finish:function(t){return r(n.f,t)}},r=function(t,r,o){n.p=e.prev,n.n=e.next;try{return t(r,o)}finally{e.next=n.n}}),e.resultName&&(e[e.resultName]=n.v,e.resultName=void 0),e.sent=n.v,e.next=n.n;try{return t.call(this,e)}finally{n.p=e.prev,n.n=e.next}}}return(t.exports=s=function(){return{wrap:function(t,e,r,n){return c.w(m(t),e,r,n&&n.reverse())},isGeneratorFunction:l,mark:c.m,awrap:function(t,r){return new e(t,r)},AsyncIterator:i,async:function(t,e,r,i,u){return(l(e)?o:n)(m(t),e,r,i,u)},keys:u,values:a}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}(p)),p.exports)();C=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return C}(),H=c(z),L={exports:{}};var W,Z,$=function(){if(Y)return L.exports;Y=1;var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0,e=t.AbortController,r=t.AbortSignal;return L.exports=e,L.exports.AbortSignal=r,L.exports.default=e,L.exports}(),q=c($);function B(t,e){return t.then(function(t){return[null,t]}).catch(function(t){return e&&Object.assign(t,e),[t,void 0]})}var K,Q,V,X,tt,et,rt,nt={};function ot(){return V||(V=1,function(t){var e=function(){if(Q)return K;function t(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return Q=1,K=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift()}var n=this,o=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&o.unref(),!0},t.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},t.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},t.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,u=(t[i]||0)+1;t[i]=u,u>=r&&(e=o,r=u)}return e},K}();t.operation=function(r){var n=t.timeouts(r);return new e(n,{forever:r&&r.forever,unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(t,e){return t-e}),n},t.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout)},t.wrap=function(e,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var o in n=[],e)"function"==typeof e[o]&&n.push(o);for(var i=0;i<n.length;i++){var u=n[i],a=e[u];e[u]=function(n){var o=t.operation(r),i=Array.prototype.slice.call(arguments,1),u=i.pop();i.push(function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),u.apply(this,arguments))}),o.attempt(function(){n.apply(e,i)})}.bind(e,a),e[u].options=r}}}(nt)),nt}function it(){return tt?X:(tt=1,X=ot())}var ut,at=function(){if(rt)return et;rt=1;var t=function(){if(Z)return W;function t(t,e){for(var r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}return Z=1,W=function(r,n,o){if(!r||"string"==typeof r)throw new TypeError("Please pass an Error to err-code");o||(o={}),"object"===e(n)&&(o=n,n=void 0),null!=n&&(o.code=n);try{return t(r,o)}catch(e){o.message=r.message,o.stack=r.stack;var i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),t(new i,o)}}}(),r=it(),n=Object.prototype.hasOwnProperty;function o(t){return t&&"EPROMISERETRY"===t.code&&n.call(t,"retried")}return et=function(e,n){var i,u;return"object"==typeof e&&"function"==typeof n&&(i=n,n=e,e=i),u=r.operation(n),new Promise(function(r,n){u.attempt(function(i){Promise.resolve().then(function(){return e(function(e){throw o(e)&&(e=e.retried),t(new Error("Retrying"),"EPROMISERETRY",{retried:e})},i)}).then(r,function(t){o(t)&&(t=t.retried,u.retry(t||new Error))||n(t)})})})}}(),st=c(at),ct={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:(ut=s(H.mark(function t(e,r,n){var o,i,u,a,s;return H.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.url,i=n.options,u=i.retry,a=void 0===u?ct.retry:u,!(e<=a.retries)){t.next=1;break}if(s="".concat(e,"/").concat(a.retries),r.status&&!(r.status>=400&&404!==r.status)){t.next=1;break}return"message"in r?console.warn("[fetch] Attempt ".concat(s," ").concat(r.name,": ").concat(r.message," ").concat(o)):console.warn("[fetch] Attempt ".concat(s," ").concat(r.status,": ").concat(r.statusText," ").concat(o)),t.abrupt("return",!0);case 1:return t.abrupt("return",!1);case 2:case"end":return t.stop()}},t)})),function(t,e,r){return ut.apply(this,arguments)})},ft=function(){return"undefined"!=typeof window},pt=function(){var t=s(H.mark(function t(){var e;return H.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!ft()){t.next=1;break}return t.abrupt("return",window.fetch);case 1:if("function"!=typeof globalThis.fetch){t.next=2;break}return t.abrupt("return",globalThis.fetch);case 2:return t.next=3,"node-fetch";case 3:return e=t.sent,t.abrupt("return",e.default);case 4:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),lt=function(){var t=s(H.mark(function t(){var e,r,n;return H.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=!ft()&&"undefined"!=typeof process&&process.env.http_proxy||!1)){t.next=2;break}return process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",t.next=1,"https-proxy-agent";case 1:return r=t.sent,n=r.HttpsProxyAgent,t.abrupt("return",{agent:new n(e)});case 2:return t.abrupt("return",{});case 3:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),yt=function(t){return"function"==typeof t},mt=["retry","timeout","doRetry"];function ht(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function vt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ht(Object(r),!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ht(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var dt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct,e=function(){var e=s(H.mark(function e(r){var n,o,a,c=arguments;return H.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:{},e.next=1,pt();case 1:return o=e.sent,e.next=2,st(function(){var e=s(H.mark(function e(a,s){var c,f,p,l,y,m,h,v,d,x,b,_,g,w,T,O,j,S,P,k;return H.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n.retry&&t.retry,c=n.timeout,f=void 0===c?t.timeout:c,p=n.doRetry,l=void 0===p?t.doRetry||ct.doRetry:p,y=u(n,mt),m=f||t.timeout||6e4,h=new q,v=setTimeout(function(){h.abort()},m),g=B,w=o,T=r,O=vt,j=vt,S=vt({},y),e.next=1,lt();case 1:return e.next=2,g(w(T,O(j(S,e.sent),{},{signal:h.signal})));case 2:if(d=e.sent,x=i(d,2),b=x[0],_=x[1],!b){e.next=6;break}if(clearTimeout(v),!(P=yt(l))){e.next=4;break}return e.next=3,l(s,b,{url:r.toString(),options:n});case 3:P=e.sent;case 4:if(!P){e.next=5;break}a(b);case 5:throw b;case 6:if(_.ok){e.next=10;break}if(clearTimeout(v),!(k=yt(l))){e.next=8;break}return e.next=7,l(s,_,{url:r.toString(),options:n});case 7:k=e.sent;case 8:if(!k){e.next=9;break}a(_);case 9:return e.abrupt("return",_);case 10:return clearTimeout(v),e.abrupt("return",_);case 11:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),n.retry||t.retry);case 2:return a=e.sent,e.abrupt("return",a);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();return e},xt=dt(ct);t.default=xt,t.fetch=xt,t.fetchWithDefaults=dt,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
3
|
+
var n,o,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",a=i.toStringTag||"@@toStringTag";function s(t,r,i,u){var a=r&&r.prototype instanceof f?r:f,s=Object.create(a.prototype);return e(s,"_invoke",function(t,e,r){var i,u,a,s=0,f=r||[],p=!1,l={p:0,n:0,v:n,a:y,f:y.bind(n,4),d:function(t,e){return i=t,u=0,a=n,l.n=e,c}};function y(t,e){for(u=t,a=e,o=0;!p&&s&&!r&&o<f.length;o++){var r,i=f[o],y=l.p,h=i[2];t>3?(r=h===e)&&(a=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=n):i[0]<=y&&((r=t<2&&y<i[1])?(u=0,l.v=e,l.n=i[1]):y<h&&(r=t<3||i[0]>e||e>h)&&(i[4]=t,i[5]=e,l.n=h,u=0))}if(r||t>1)return c;throw p=!0,e}return function(r,f,h){if(s>1)throw TypeError("Generator is already running");for(p&&1===f&&y(f,h),u=f,a=h;(o=u<2?n:a)||!p;){i||(u?u<3?(u>1&&(l.n=-1),y(u,a)):l.n=a:l.v=a);try{if(s=2,i){if(u||(r="next"),o=i[r]){if(!(o=o.call(i,a)))throw TypeError("iterator result is not an object");if(!o.done)return o;a=o.value,u<2&&(u=0)}else 1===u&&(o=i.return)&&o.call(i),u<2&&(a=TypeError("The iterator does not provide a '"+r+"' method"),u=1);i=n}else if((o=(p=l.n<0)?a:t.call(e,l))!==c)break}catch(t){i=n,u=1,a=t}finally{s=1}}return{value:o,done:p}}}(t,i,u),!0),s}var c={};function f(){}function p(){}function l(){}o=Object.getPrototypeOf;var y=[][u]?o(o([][u]())):(e(o={},u,function(){return this}),o),h=l.prototype=f.prototype=Object.create(y);function m(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,e(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return p.prototype=l,e(h,"constructor",l),e(l,"constructor",p),p.displayName="GeneratorFunction",e(l,a,"GeneratorFunction"),e(h),e(h,a,"Generator"),e(h,u,function(){return this}),e(h,"toString",function(){return"[object Generator]"}),(t.exports=r=function(){return{w:s,m:m}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=r,t.exports.__esModule=!0,t.exports.default=t.exports}(v)),v.exports}var _,g,w,T={exports:{}},O={exports:{}},j={exports:{}};function S(){return _||(_=1,function(t){var e=y(),r=x();t.exports=function t(n,o){function i(t,r,u,a){try{var s=n[t](r),c=s.value;return c instanceof e?o.resolve(c.v).then(function(t){i("next",t,u,a)},function(t){i("throw",t,u,a)}):o.resolve(c).then(function(t){s.value=t,u(s)},function(t){return i("throw",t,u,a)})}catch(t){a(t)}}var u;this.next||(r(t.prototype),r(t.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),r(this,"_invoke",function(t,e,r){function n(){return new o(function(e,n){i(t,r,e,n)})}return u=u?u.then(n,n):n()},!0)},t.exports.__esModule=!0,t.exports.default=t.exports}(j)),j.exports}function P(){return g||(g=1,function(t){var e=b(),r=S();t.exports=function(t,n,o,i,u){return new r(e().w(t,n,o,i),u||Promise)},t.exports.__esModule=!0,t.exports.default=t.exports}(O)),O.exports}function k(){return w||(w=1,function(t){var e=P();t.exports=function(t,r,n,o,i){var u=e(t,r,n,o,i);return u.next().then(function(t){return t.done?t.value:u.next()})},t.exports.__esModule=!0,t.exports.default=t.exports}(T)),T.exports}var E,R={exports:{}};function M(){return E||(E=1,function(t){t.exports=function(t){var e=Object(t),r=[];for(var n in e)r.unshift(n);return function t(){for(;r.length;)if((n=r.pop())in e)return t.value=n,t.done=!1,t;return t.done=!0,t}},t.exports.__esModule=!0,t.exports.default=t.exports}(R)),R.exports}var A,N,I,C,D,F={exports:{}},G={exports:{}};function U(){return A||(A=1,function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(G)),G.exports}function H(){return N||(N=1,function(t){var e=U().default;t.exports=function(t){if(null!=t){var r=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}throw new TypeError(e(t)+" is not iterable")},t.exports.__esModule=!0,t.exports.default=t.exports}(F)),F.exports}var J,Y=function(){if(D)return C;D=1;var t=(I||(I=1,function(t){var e=y(),r=b(),n=k(),o=P(),i=S(),u=M(),a=H();function s(){var c=r(),f=c.m(s),p=(Object.getPrototypeOf?Object.getPrototypeOf(f):f.__proto__).constructor;function l(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))}var y={throw:1,return:2,break:3,continue:3};function h(t){var e,r;return function(n){e||(e={stop:function(){return r(n.a,2)},catch:function(){return n.v},abrupt:function(t,e){return r(n.a,y[t],e)},delegateYield:function(t,o,i){return e.resultName=o,r(n.d,a(t),i)},finish:function(t){return r(n.f,t)}},r=function(t,r,o){n.p=e.prev,n.n=e.next;try{return t(r,o)}finally{e.next=n.n}}),e.resultName&&(e[e.resultName]=n.v,e.resultName=void 0),e.sent=n.v,e.next=n.n;try{return t.call(this,e)}finally{n.p=e.prev,n.n=e.next}}}return(t.exports=s=function(){return{wrap:function(t,e,r,n){return c.w(h(t),e,r,n&&n.reverse())},isGeneratorFunction:l,mark:c.m,awrap:function(t,r){return new e(t,r)},AsyncIterator:i,async:function(t,e,r,i,u){return(l(e)?o:n)(h(t),e,r,i,u)},keys:u,values:a}},t.exports.__esModule=!0,t.exports.default=t.exports)()}t.exports=s,t.exports.__esModule=!0,t.exports.default=t.exports}(p)),p.exports)();C=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return C}(),z=c(Y),L={exports:{}};var W,Z,$=function(){if(J)return L.exports;J=1;var t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0,e=t.AbortController,r=t.AbortSignal;return L.exports=e,L.exports.AbortSignal=r,L.exports.default=e,L.exports}(),q=c($);function B(t,e){return t.then(function(t){return[null,t]}).catch(function(t){return e&&Object.assign(t,e),[t,void 0]})}var K,Q,V,X,tt,et,rt,nt={};function ot(){return V||(V=1,function(t){var e=function(){if(Q)return K;function t(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return Q=1,K=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift()}var n=this,o=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},r);return this._options.unref&&o.unref(),!0},t.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},t.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},t.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,r=0,n=0;n<this._errors.length;n++){var o=this._errors[n],i=o.message,u=(t[i]||0)+1;t[i]=u,u>=r&&(e=o,r=u)}return e},K}();t.operation=function(r){var n=t.timeouts(r);return new e(n,{forever:r&&r.forever,unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],o=0;o<e.retries;o++)n.push(this.createTimeout(o,e));return t&&t.forever&&!n.length&&n.push(this.createTimeout(o,e)),n.sort(function(t,e){return t-e}),n},t.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,n=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return n=Math.min(n,e.maxTimeout)},t.wrap=function(e,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var o in n=[],e)"function"==typeof e[o]&&n.push(o);for(var i=0;i<n.length;i++){var u=n[i],a=e[u];e[u]=function(n){var o=t.operation(r),i=Array.prototype.slice.call(arguments,1),u=i.pop();i.push(function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),u.apply(this,arguments))}),o.attempt(function(){n.apply(e,i)})}.bind(e,a),e[u].options=r}}}(nt)),nt}function it(){return tt?X:(tt=1,X=ot())}var ut,at=function(){if(rt)return et;rt=1;var t=function(){if(Z)return W;function t(t,e){for(var r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}return Z=1,W=function(r,n,o){if(!r||"string"==typeof r)throw new TypeError("Please pass an Error to err-code");o||(o={}),"object"===e(n)&&(o=n,n=void 0),null!=n&&(o.code=n);try{return t(r,o)}catch(e){o.message=r.message,o.stack=r.stack;var i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),t(new i,o)}}}(),r=it(),n=Object.prototype.hasOwnProperty;function o(t){return t&&"EPROMISERETRY"===t.code&&n.call(t,"retried")}return et=function(e,n){var i,u;return"object"==typeof e&&"function"==typeof n&&(i=n,n=e,e=i),u=r.operation(n),new Promise(function(r,n){u.attempt(function(i){Promise.resolve().then(function(){return e(function(e){throw o(e)&&(e=e.retried),t(new Error("Retrying"),"EPROMISERETRY",{retried:e})},i)}).then(r,function(t){o(t)&&(t=t.retried,u.retry(t||new Error))||n(t)})})})}}(),st=c(at),ct={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:(ut=s(z.mark(function t(e,r,n){var o,i,u,a,s;return z.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.url,i=n.options,u=i.retry,a=void 0===u?ct.retry:u,!(e<=a.retries)){t.next=1;break}if(s="".concat(e,"/").concat(a.retries),r.status&&!(r.status>=400&&404!==r.status)){t.next=1;break}return"message"in r?console.warn("[fetch] Attempt ".concat(s," ").concat(r.name,": ").concat(r.message," ").concat(o)):console.warn("[fetch] Attempt ".concat(s," ").concat(r.status,": ").concat(r.statusText," ").concat(o)),t.abrupt("return",!0);case 1:return t.abrupt("return",!1);case 2:case"end":return t.stop()}},t)})),function(t,e,r){return ut.apply(this,arguments)})},ft=function(){return"undefined"!=typeof window},pt=function(){return!ft()&&(globalThis.fallbackFetch||"function"!=typeof globalThis.fetch?"node-fetch":"node")},lt=function(){var t=s(z.mark(function t(){var e;return z.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e=pt()){t.next=1;break}return t.abrupt("return",window.fetch);case 1:if("node"===e){t.next=3;break}return globalThis.fallbackFetch=!0,t.next=2,"node-fetch";case 2:globalThis.fetch=t.sent.default;case 3:return t.abrupt("return",globalThis.fetch);case 4:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),yt=function(){var t=s(z.mark(function t(){var e,r,n,o,i;return z.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e=!ft()&&process.env.http_proxy)){t.next=4;break}if(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",!globalThis.fallbackFetch){t.next=2;break}return t.next=1,"https-proxy-agent";case 1:return r=t.sent,n=r.HttpsProxyAgent,t.abrupt("return",{agent:new n(e)});case 2:return t.next=3,"undici";case 3:return o=t.sent,i=o.EnvHttpProxyAgent,t.abrupt("return",{dispatcher:new i});case 4:return t.abrupt("return",{});case 5:case"end":return t.stop()}},t)}));return function(){return t.apply(this,arguments)}}(),ht=function(t){return"function"==typeof t},mt=["retry","timeout","doRetry"];function vt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function dt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?vt(Object(r),!0).forEach(function(e){n(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):vt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var xt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ct,e=function(){var e=s(z.mark(function e(r){var n,o,a,c=arguments;return z.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=c.length>1&&void 0!==c[1]?c[1]:{},e.next=1,lt();case 1:return o=e.sent,e.next=2,st(function(){var e=s(z.mark(function e(a,s){var c,f,p,l,y,h,m,v,d,x,b,_,g,w,T,O,j,S,P,k;return z.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n.retry&&t.retry,c=n.timeout,f=void 0===c?t.timeout:c,p=n.doRetry,l=void 0===p?t.doRetry||ct.doRetry:p,y=u(n,mt),h=f||t.timeout||6e4,m=new q,v=setTimeout(function(){m.abort()},h),g=B,w=o,T=r,O=dt,j=dt,S=dt({},y),e.next=1,yt();case 1:return e.next=2,g(w(T,O(j(S,e.sent),{},{signal:m.signal})));case 2:if(d=e.sent,x=i(d,2),b=x[0],_=x[1],!b){e.next=6;break}if(clearTimeout(v),!(P=ht(l))){e.next=4;break}return e.next=3,l(s,b,{url:r.toString(),options:n});case 3:P=e.sent;case 4:if(!P){e.next=5;break}a(b);case 5:throw b;case 6:if(_.ok){e.next=10;break}if(clearTimeout(v),!(k=ht(l))){e.next=8;break}return e.next=7,l(s,_,{url:r.toString(),options:n});case 7:k=e.sent;case 8:if(!k){e.next=9;break}a(_);case 9:return e.abrupt("return",_);case 10:return clearTimeout(v),e.abrupt("return",_);case 11:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),n.retry||t.retry);case 2:return a=e.sent,e.abrupt("return",a);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}();return e},bt=xt(ct);t.default=bt,t.fetch=bt,t.fetchWithDefaults=xt,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
@@ -488,28 +488,52 @@
|
|
|
488
488
|
|
|
489
489
|
const isClient = () => typeof window !== 'undefined';
|
|
490
490
|
|
|
491
|
+
const isNode = () => {
|
|
492
|
+
if (isClient()) return false;
|
|
493
|
+
if (!globalThis.fallbackFetch && typeof globalThis.fetch === 'function') return 'node';
|
|
494
|
+
return 'node-fetch';
|
|
495
|
+
};
|
|
496
|
+
|
|
491
497
|
const resolveFetch = async () => {
|
|
492
|
-
|
|
493
|
-
if (
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
498
|
+
const node = isNode();
|
|
499
|
+
if (!node) return window.fetch;
|
|
500
|
+
if (node !== 'node') {
|
|
501
|
+
globalThis.fallbackFetch = true;
|
|
502
|
+
globalThis.fetch = (await ('node-fetch')).default;
|
|
503
|
+
}
|
|
504
|
+
return globalThis.fetch;
|
|
497
505
|
};
|
|
498
506
|
|
|
499
507
|
// Setting http_proxy in env will inject a proxy agent header and disable certificate verification
|
|
500
508
|
const proxyAgent = async () => {
|
|
501
|
-
const proxyUri = !isClient() &&
|
|
509
|
+
const proxyUri = !isClient() && process.env.http_proxy;
|
|
502
510
|
if (proxyUri) {
|
|
503
|
-
// console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
|
|
504
511
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
512
|
+
if (globalThis.fallbackFetch) {
|
|
513
|
+
// https://www.npmjs.com/package/node-fetch#custom-agent
|
|
514
|
+
// NOTE: This uses the HttpsProxyAgent class from https-proxy-agent v7.x
|
|
515
|
+
// Will break in v8+ where only a default factory function is exported
|
|
516
|
+
const {
|
|
517
|
+
HttpsProxyAgent
|
|
518
|
+
} = await ('https-proxy-agent');
|
|
519
|
+
return {
|
|
520
|
+
agent: new HttpsProxyAgent(proxyUri)
|
|
521
|
+
};
|
|
522
|
+
} else {
|
|
523
|
+
// EnvHttpProxyAgent automatically reads the proxy configuration from the
|
|
524
|
+
// environment variables http_proxy, https_proxy, and no_proxy and sets up
|
|
525
|
+
// the proxy agents accordingly. When http_proxy and https_proxy are set,
|
|
526
|
+
// http_proxy is used for HTTP requests and https_proxy is used for HTTPS requests.
|
|
527
|
+
// If only http_proxy is set, http_proxy is used for both HTTP and HTTPS requests.
|
|
528
|
+
// If only https_proxy is set, it is only used for HTTPS requests.
|
|
529
|
+
// https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent.md
|
|
530
|
+
const {
|
|
531
|
+
EnvHttpProxyAgent
|
|
532
|
+
} = await ('undici');
|
|
533
|
+
return {
|
|
534
|
+
dispatcher: new EnvHttpProxyAgent()
|
|
535
|
+
};
|
|
536
|
+
}
|
|
513
537
|
}
|
|
514
538
|
return {};
|
|
515
539
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch"]={})}(this,function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r,o={exports:{}};var i,n,s=function(){if(r)return o.exports;r=1;const{AbortController:t,AbortSignal:e}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;return o.exports=t,o.exports.AbortSignal=e,o.exports.default=t,o.exports}(),u=e(s);var a,f,
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch"]={})}(this,function(t){"use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r,o={exports:{}};var i,n,s=function(){if(r)return o.exports;r=1;const{AbortController:t,AbortSignal:e}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;return o.exports=t,o.exports.AbortSignal=e,o.exports.default=t,o.exports}(),u=e(s);var a,c,f,p,h,m,l,y={};function _(){return f||(f=1,function(t){var e=function(){if(c)return a;function t(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}return c=1,a=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift()}var o=this,i=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},r);return this._options.unref&&i.unref(),!0},t.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){r._operationTimeoutCb()},r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},t.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},t.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,r=0,o=0;o<this._errors.length;o++){var i=this._errors[o],n=i.message,s=(t[n]||0)+1;t[n]=s,s>=r&&(e=i,r=s)}return e},a}();t.operation=function(r){var o=t.timeouts(r);return new e(o,{forever:r&&r.forever,unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(t){if(t instanceof Array)return[].concat(t);var e={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in t)e[r]=t[r];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],i=0;i<e.retries;i++)o.push(this.createTimeout(i,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(i,e)),o.sort(function(t,e){return t-e}),o},t.createTimeout=function(t,e){var r=e.randomize?Math.random()+1:1,o=Math.round(r*e.minTimeout*Math.pow(e.factor,t));return o=Math.min(o,e.maxTimeout)},t.wrap=function(e,r,o){if(r instanceof Array&&(o=r,r=null),!o)for(var i in o=[],e)"function"==typeof e[i]&&o.push(i);for(var n=0;n<o.length;n++){var s=o[n],u=e[s];e[s]=function(o){var i=t.operation(r),n=Array.prototype.slice.call(arguments,1),s=n.pop();n.push(function(t){i.retry(t)||(t&&(arguments[0]=i.mainError()),s.apply(this,arguments))}),i.attempt(function(){o.apply(e,n)})}.bind(e,u),e[s].options=r}}}(y)),y}function d(){return h?p:(h=1,p=_())}var T=function(){if(l)return m;l=1;var t=function(){if(n)return i;function t(t,e){for(const r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}return n=1,i=function(e,r,o){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");o||(o={}),"object"==typeof r&&(o=r,r=void 0),null!=r&&(o.code=r);try{return t(e,o)}catch(r){o.message=e.message,o.stack=e.stack;const i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),t(new i,o)}}}(),e=d(),r=Object.prototype.hasOwnProperty;function o(t){return t&&"EPROMISERETRY"===t.code&&r.call(t,"retried")}return m=function(r,i){var n,s;return"object"==typeof r&&"function"==typeof i&&(n=i,i=r,r=n),s=e.operation(i),new Promise(function(e,i){s.attempt(function(n){Promise.resolve().then(function(){return r(function(e){throw o(e)&&(e=e.retried),t(new Error("Retrying"),"EPROMISERETRY",{retried:e})},n)}).then(e,function(t){o(t)&&(t=t.retried,s.retry(t||new Error))||i(t)})})})}}(),g=e(T);const w={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:async(t,e,{url:r,options:o})=>{const{retry:i=w.retry}=o;if(t<=i.retries){const o=`${t}/${i.retries}`;if(!e.status||e.status>=400&&404!==e.status)return"message"in e?console.warn(`[fetch] Attempt ${o} ${e.name}: ${e.message} ${r}`):console.warn(`[fetch] Attempt ${o} ${e.status}: ${e.statusText} ${r}`),!0}return!1}},v=()=>"undefined"!=typeof window,b=async()=>{const t=!v()&&(globalThis.fallbackFetch||"function"!=typeof globalThis.fetch?"node-fetch":"node");return t?("node"!==t&&(globalThis.fallbackFetch=!0,globalThis.fetch=(await"node-fetch").default),globalThis.fetch):window.fetch},x=async()=>{const t=!v()&&process.env.http_proxy;if(t){if(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",globalThis.fallbackFetch){const{HttpsProxyAgent:e}=await"https-proxy-agent";return{agent:new e(t)}}{const{EnvHttpProxyAgent:t}=await"undici";return{dispatcher:new t}}}return{}},R=t=>"function"==typeof t,E=(t=w)=>async(e,r={})=>{const o=await b(),i=await g(async(i,n)=>{const{retry:s=t.retry,timeout:a=t.timeout,doRetry:c=t.doRetry||w.doRetry,...f}=r,p=a||t.timeout||6e4,h=new u,m=setTimeout(()=>{h.abort()},p),[l,y]=await(_=o(e,{...f,...await x(),signal:h.signal}),_.then(function(t){return[null,t]}).catch(function(t){return[t,void 0]}));var _;if(l)throw clearTimeout(m),R(c)&&await c(n,l,{url:e.toString(),options:r})&&i(l),l;return y.ok?(clearTimeout(m),y):(clearTimeout(m),R(c)&&await c(n,y,{url:e.toString(),options:r})&&i(y),y)},r.retry||t.retry);return i},O=E(w);t.default=O,t.fetch=O,t.fetchWithDefaults=E,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
@@ -38,27 +38,49 @@ const fetchDefaults = {
|
|
|
38
38
|
|
|
39
39
|
const isClient = () => typeof window !== 'undefined';
|
|
40
40
|
|
|
41
|
-
const
|
|
41
|
+
const isNode = () => {
|
|
42
42
|
if (isClient())
|
|
43
|
+
return false;
|
|
44
|
+
if (!globalThis.fallbackFetch &&
|
|
45
|
+
typeof globalThis.fetch === 'function')
|
|
46
|
+
return 'node';
|
|
47
|
+
return 'node-fetch';
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const resolveFetch = async () => {
|
|
51
|
+
const node = isNode();
|
|
52
|
+
if (!node)
|
|
43
53
|
return window.fetch;
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return
|
|
54
|
+
if (node !== 'node') {
|
|
55
|
+
globalThis.fallbackFetch = true;
|
|
56
|
+
globalThis.fetch = (await import('node-fetch')).default;
|
|
57
|
+
}
|
|
58
|
+
return globalThis.fetch;
|
|
49
59
|
};
|
|
50
60
|
|
|
51
61
|
// Setting http_proxy in env will inject a proxy agent header and disable certificate verification
|
|
52
62
|
const proxyAgent = async () => {
|
|
53
|
-
const proxyUri =
|
|
54
|
-
false;
|
|
63
|
+
const proxyUri = !isClient() && process.env.http_proxy;
|
|
55
64
|
if (proxyUri) {
|
|
56
|
-
// console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
|
|
57
65
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
if (globalThis.fallbackFetch) {
|
|
67
|
+
// https://www.npmjs.com/package/node-fetch#custom-agent
|
|
68
|
+
// NOTE: This uses the HttpsProxyAgent class from https-proxy-agent v7.x
|
|
69
|
+
// Will break in v8+ where only a default factory function is exported
|
|
70
|
+
const { HttpsProxyAgent } = await import('https-proxy-agent');
|
|
71
|
+
return { agent: new HttpsProxyAgent(proxyUri) };
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// EnvHttpProxyAgent automatically reads the proxy configuration from the
|
|
75
|
+
// environment variables http_proxy, https_proxy, and no_proxy and sets up
|
|
76
|
+
// the proxy agents accordingly. When http_proxy and https_proxy are set,
|
|
77
|
+
// http_proxy is used for HTTP requests and https_proxy is used for HTTPS requests.
|
|
78
|
+
// If only http_proxy is set, http_proxy is used for both HTTP and HTTPS requests.
|
|
79
|
+
// If only https_proxy is set, it is only used for HTTPS requests.
|
|
80
|
+
// https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent.md
|
|
81
|
+
const { EnvHttpProxyAgent } = await import('undici');
|
|
82
|
+
return { dispatcher: new EnvHttpProxyAgent() };
|
|
83
|
+
}
|
|
62
84
|
}
|
|
63
85
|
return {};
|
|
64
86
|
};
|
|
@@ -34,27 +34,49 @@ const fetchDefaults = {
|
|
|
34
34
|
|
|
35
35
|
const isClient = () => typeof window !== 'undefined';
|
|
36
36
|
|
|
37
|
-
const
|
|
37
|
+
const isNode = () => {
|
|
38
38
|
if (isClient())
|
|
39
|
+
return false;
|
|
40
|
+
if (!globalThis.fallbackFetch &&
|
|
41
|
+
typeof globalThis.fetch === 'function')
|
|
42
|
+
return 'node';
|
|
43
|
+
return 'node-fetch';
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const resolveFetch = async () => {
|
|
47
|
+
const node = isNode();
|
|
48
|
+
if (!node)
|
|
39
49
|
return window.fetch;
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
50
|
+
if (node !== 'node') {
|
|
51
|
+
globalThis.fallbackFetch = true;
|
|
52
|
+
globalThis.fetch = (await import('node-fetch')).default;
|
|
53
|
+
}
|
|
54
|
+
return globalThis.fetch;
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
// Setting http_proxy in env will inject a proxy agent header and disable certificate verification
|
|
48
58
|
const proxyAgent = async () => {
|
|
49
|
-
const proxyUri =
|
|
50
|
-
false;
|
|
59
|
+
const proxyUri = !isClient() && process.env.http_proxy;
|
|
51
60
|
if (proxyUri) {
|
|
52
|
-
// console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
|
|
53
61
|
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
if (globalThis.fallbackFetch) {
|
|
63
|
+
// https://www.npmjs.com/package/node-fetch#custom-agent
|
|
64
|
+
// NOTE: This uses the HttpsProxyAgent class from https-proxy-agent v7.x
|
|
65
|
+
// Will break in v8+ where only a default factory function is exported
|
|
66
|
+
const { HttpsProxyAgent } = await import('https-proxy-agent');
|
|
67
|
+
return { agent: new HttpsProxyAgent(proxyUri) };
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// EnvHttpProxyAgent automatically reads the proxy configuration from the
|
|
71
|
+
// environment variables http_proxy, https_proxy, and no_proxy and sets up
|
|
72
|
+
// the proxy agents accordingly. When http_proxy and https_proxy are set,
|
|
73
|
+
// http_proxy is used for HTTP requests and https_proxy is used for HTTPS requests.
|
|
74
|
+
// If only http_proxy is set, http_proxy is used for both HTTP and HTTPS requests.
|
|
75
|
+
// If only https_proxy is set, it is only used for HTTPS requests.
|
|
76
|
+
// https://undici.nodejs.org/#/docs/api/EnvHttpProxyAgent.md
|
|
77
|
+
const { EnvHttpProxyAgent } = await import('undici');
|
|
78
|
+
return { dispatcher: new EnvHttpProxyAgent() };
|
|
79
|
+
}
|
|
58
80
|
}
|
|
59
81
|
return {};
|
|
60
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enterprise-fetch.esm.js","sources":["../src/fetch-defaults.ts","../src/util/client/is-client.ts","../src/util/resolve.ts","../src/util/server/proxy-agent.ts","../src/util/typeguards.ts","../src/enterprise-fetch.ts"],"sourcesContent":[null,null,null,null,null,null],"names":["fetchDefaults","FetchDefaults"],"mappings":";;;;AAEA,MAAM,aAAa,GAAG;;IAEpB,OAAO,EAAE,EAAE,GAAG,IAAI;;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,OAAO,EAAE,CAAC;AACV,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,MAAM,EAAE,CAAC;AACV,KAAA;;;AAGD,IAAA,OAAO,EAAE,OAAO,OAAO,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAI;;QAEhD,MAAM,EAAE,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,GAAG,OAAO;AAC/C,QAAA,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE;YAC5B,MAAM,OAAO,GAAG,CAAA,EAAG,OAAO,IAAI,KAAK,CAAC,OAAO,CAAA,CAAE;;;AAI7C,YAAA,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE;gBAC5D,IAAI,SAAS,IAAI,GAAG;AAClB,oBAAA,OAAO,CAAC,IAAI,CACV,CAAA,gBAAA,EAAmB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAA,EAAA,EAAK,GAAG,CAAC,OAAO,IAAI,GAAG,CAAA,CAAE,CAChE;;AAED,oBAAA,OAAO,CAAC,IAAI,CACV,CAAA,gBAAA,EAAmB,OAAO,IAAI,GAAG,CAAC,MAAM,CAAA,EAAA,EAAK,GAAG,CAAC,UAAU,IAAI,GAAG,CAAA,CAAE,CACrE;AACH,gBAAA,OAAO,IAAI;YACb;QACF;AACA,QAAA,OAAO,KAAK;IACd,CAAC;CACW;;ACnCd,MAAM,QAAQ,GAAG,MAAM,OAAO,MAAM,KAAK,WAAW;;
|
|
1
|
+
{"version":3,"file":"enterprise-fetch.esm.js","sources":["../src/fetch-defaults.ts","../src/util/client/is-client.ts","../src/util/server/is-node.ts","../src/util/resolve.ts","../src/util/server/proxy-agent.ts","../src/util/typeguards.ts","../src/enterprise-fetch.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":["fetchDefaults","FetchDefaults"],"mappings":";;;;AAEA,MAAM,aAAa,GAAG;;IAEpB,OAAO,EAAE,EAAE,GAAG,IAAI;;AAElB,IAAA,KAAK,EAAE;AACL,QAAA,OAAO,EAAE,CAAC;AACV,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,MAAM,EAAE,CAAC;AACV,KAAA;;;AAGD,IAAA,OAAO,EAAE,OAAO,OAAO,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,KAAI;;QAEhD,MAAM,EAAE,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,GAAG,OAAO;AAC/C,QAAA,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE;YAC5B,MAAM,OAAO,GAAG,CAAA,EAAG,OAAO,IAAI,KAAK,CAAC,OAAO,CAAA,CAAE;;;AAI7C,YAAA,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE;gBAC5D,IAAI,SAAS,IAAI,GAAG;AAClB,oBAAA,OAAO,CAAC,IAAI,CACV,CAAA,gBAAA,EAAmB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAA,EAAA,EAAK,GAAG,CAAC,OAAO,IAAI,GAAG,CAAA,CAAE,CAChE;;AAED,oBAAA,OAAO,CAAC,IAAI,CACV,CAAA,gBAAA,EAAmB,OAAO,IAAI,GAAG,CAAC,MAAM,CAAA,EAAA,EAAK,GAAG,CAAC,UAAU,IAAI,GAAG,CAAA,CAAE,CACrE;AACH,gBAAA,OAAO,IAAI;YACb;QACF;AACA,QAAA,OAAO,KAAK;IACd,CAAC;CACW;;ACnCd,MAAM,QAAQ,GAAG,MAAM,OAAO,MAAM,KAAK,WAAW;;ACEpD,MAAM,MAAM,GAAG,MAAK;AAClB,IAAA,IAAI,QAAQ,EAAE;AAAE,QAAA,OAAO,KAAK;IAC5B,IACE,CAAE,UAAkB,CAAC,aAAa;AAClC,QAAA,OAAO,UAAU,CAAC,KAAK,KAAK,UAAU;AAEtC,QAAA,OAAO,MAAM;AACf,IAAA,OAAO,YAAY;AACrB,CAAC;;ACRM,MAAM,YAAY,GAAG,YAAW;AACrC,IAAA,MAAM,IAAI,GAAG,MAAM,EAAE;AACrB,IAAA,IAAI,CAAC,IAAI;QAAE,OAAO,MAAM,CAAC,KAAK;AAE9B,IAAA,IAAI,IAAI,KAAK,MAAM,EAAE;AAClB,QAAA,UAAkB,CAAC,aAAa,GAAG,IAAI;AACvC,QAAA,UAAU,CAAC,KAAa,GAAG,CAAC,MAAM,OAAO,YAAY,CAAC,EAAE,OAAO;IAClE;IACA,OAAO,UAAU,CAAC,KAAK;AACzB,CAAC;;ACPD;AACA,MAAM,UAAU,GAAe,YAAW;IACxC,MAAM,QAAQ,GAAG,CAAC,QAAQ,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;IACtD,IAAI,QAAQ,EAAE;AACZ,QAAA,OAAO,CAAC,GAAG,CAAC,4BAA4B,GAAG,GAAG;AAC9C,QAAA,IAAK,UAAkB,CAAC,aAAa,EAAE;;;;YAIrC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,OAAO,mBAAmB,CAAC;YAC7D,OAAO,EAAE,KAAK,EAAE,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE;QACjD;aAAO;;;;;;;;YAQL,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,OAAO,QAAQ,CAAC;AACpD,YAAA,OAAO,EAAE,UAAU,EAAE,IAAI,iBAAiB,EAAE,EAAE;QAChD;IACF;AACA,IAAA,OAAO,EAAE;AACX,CAAC;;ACzBM,MAAM,MAAM,GAAG,CAAC,IAAS,KAAK,OAAO,IAAI,KAAK,UAAU;;MCSlD,iBAAiB,GAAG,CAACA,eAAA,GAA2BC,aAAa,KAAI;;;;IAI5E,MAAM,eAAe,GAAU,OAAO,GAAG,EAAE,IAAI,GAAG,EAAE,KAAI;AACtD,QAAA,MAAM,SAAS,GAAG,MAAM,YAAY,EAAE;QACtC,MAAM,aAAa,GAAG,MAAM,YAAY,CAAC,OAAO,KAAK,EAAE,OAAO,KAAI;YAChE,MAAM;;AAEJ,YAAA,KAAK,EAAE,WAAW,GAAGD,eAAa,CAAC,KAAK,EACxC,OAAO,EAAE,QAAQ,GAAGA,eAAa,CAAC,OAAO,EACzC,OAAO,GAAGA,eAAa,CAAC,OAAO,IAAIC,aAAa,CAAC,OAAO,EACxD,GAAG,OAAO,EACX,GAAG,IAAI;YACR,MAAM,SAAS,GAAG,QAAQ,IAAID,eAAa,CAAC,OAAO,IAAI,EAAE,GAAG,IAAI;;;AAIhE,YAAA,MAAM,UAAU,GACd,IAAI,eAAe,EAA2C;AAChE,YAAA,MAAM,SAAS,GAAG,UAAU,CAAC,MAAK;gBAChC,UAAU,CAAC,KAAK,EAAE;YACpB,CAAC,EAAE,SAAS,CAAC;;AAGb,YAAA,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAyB,MAAM,EAAE,CACtD,SAAS,CAAC,GAAG,EAAE;;AAEb,gBAAA,GAAG,OAAO;;AAEV,gBAAA,IAAI,MAAM,UAAU,EAAE,CAAC;;gBAEvB,MAAM,EAAE,UAAU,CAAC,MAAM;AAC1B,aAAA,CAAC,CACH;YACD,IAAI,KAAK,EAAE;gBACT,YAAY,CAAC,SAAS,CAAC;gBACvB,IACE,MAAM,CAAC,OAAO,CAAC;AACf,qBAAC,MAAM,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE;AAC7B,wBAAA,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;AACnB,wBAAA,OAAO,EAAE,IAAI;qBACd,CAAC,CAAC,EACH;oBACA,KAAK,CAAC,KAAK,CAAC;gBACd;AACA,gBAAA,MAAM,KAAK;YACb;AAEA,YAAA,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;gBAChB,YAAY,CAAC,SAAS,CAAC;gBACvB,IACE,MAAM,CAAC,OAAO,CAAC;AACf,qBAAC,MAAM,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE;AAChC,wBAAA,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE;AACnB,wBAAA,OAAO,EAAE,IAAI;qBACd,CAAC,CAAC,EACH;oBACA,KAAK,CAAC,QAAQ,CAAC;gBACjB;AACA,gBAAA,OAAO,QAAQ;YACjB;YAEA,YAAY,CAAC,SAAS,CAAC;AACvB,YAAA,OAAO,QAAQ;QACjB,CAAC,EAAE,IAAI,CAAC,KAAK,IAAIA,eAAa,CAAC,KAAK,CAAC;AAErC,QAAA,OAAO,aAAa;AACtB,IAAA,CAAC;AACD,IAAA,OAAO,eAAe;AACxB;MAEa,KAAK,GAAG,iBAAiB,CAACC,aAAa;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "enterprise-fetch",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
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",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"cypress:run": "cypress run",
|
|
17
17
|
"instrument": "nyc instrument --compact=false dist/enterprise-fetch.esm.js instrumented",
|
|
18
18
|
"mocha:run": "mocha --timeout 500000 --exit cypress/integration/node.spec.mjs",
|
|
19
|
+
"nyc:mocha": "nyc npm run mocha:run",
|
|
19
20
|
"nyc:test": "nyc npm run mocha:run && npm test",
|
|
20
21
|
"prestart": "npm run build",
|
|
21
22
|
"report:coverage": "nyc report --reporter=html && serve -c ../serve.json ./coverage",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"codecov:windows": "curl -Os https://uploader.codecov.io/latest/windows/codecov.exe",
|
|
27
28
|
"report-coverage": "npm run codecov:windows && codecov -t 9f816f9c-8faa-4812-9bb2-5235c8c11468",
|
|
28
29
|
"start": "npm run nyc:test",
|
|
29
|
-
"serve": "serve",
|
|
30
|
+
"serve": "serve --no-request-logging",
|
|
30
31
|
"test": "start-server-and-test serve http://localhost:3000 cypress:run"
|
|
31
32
|
},
|
|
32
33
|
"keywords": [
|
|
@@ -48,7 +49,8 @@
|
|
|
48
49
|
"await-to-js": "^3.0.0",
|
|
49
50
|
"https-proxy-agent": "^7.0.6",
|
|
50
51
|
"node-fetch": "^2.7.0",
|
|
51
|
-
"promise-retry": "^2.0.1"
|
|
52
|
+
"promise-retry": "^2.0.1",
|
|
53
|
+
"undici": "^7.16.0"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
56
|
"@babel/core": "^7.28.4",
|
|
@@ -59,6 +61,8 @@
|
|
|
59
61
|
"@babel/runtime": "^7.28.4",
|
|
60
62
|
"@codecov/rollup-plugin": "^1.9.1",
|
|
61
63
|
"@cypress/code-coverage": "^3.14.7",
|
|
64
|
+
"@cypress/webpack-batteries-included-preprocessor": "^4.0.2",
|
|
65
|
+
"@cypress/webpack-preprocessor": "^6.0.4",
|
|
62
66
|
"@eslint/js": "^9.38.0",
|
|
63
67
|
"@rollup/plugin-babel": "^6.1.0",
|
|
64
68
|
"@rollup/plugin-commonjs": "^28.0.8",
|
|
@@ -76,7 +80,10 @@
|
|
|
76
80
|
"eslint": "^9.38.0",
|
|
77
81
|
"eslint-config-prettier": "^10.1.8",
|
|
78
82
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
83
|
+
"eslint-plugin-chai-friendly": "^1.1.0",
|
|
84
|
+
"eslint-plugin-cypress": "^5.2.0",
|
|
79
85
|
"eslint-plugin-import": "^2.32.0",
|
|
86
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
80
87
|
"eslint-plugin-prettier": "^5.5.4",
|
|
81
88
|
"fetch-mock": "^12.5.4",
|
|
82
89
|
"mocha": "^11.7.4",
|