enterprise-fetch 2.0.2 → 2.0.3

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.
@@ -587,7 +587,7 @@
587
587
  }
588
588
 
589
589
  var browserExports = requireBrowser();
590
- var AbortController = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
590
+ var AbortControllerShim = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
591
591
 
592
592
  /**
593
593
  * @param { Promise } promise
@@ -1012,14 +1012,22 @@
1012
1012
  // Do retry function to examine failures and apply custom retry logic
1013
1013
  // return true to retry the fetch call
1014
1014
  doRetry: function () {
1015
- var _doRetry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(attempt, res, _ref) {
1016
- var url, options, _options$retry, retry, counter;
1015
+ var _doRetry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(attempt, res) {
1016
+ var _ref,
1017
+ url,
1018
+ options,
1019
+ retry,
1020
+ counter,
1021
+ _args = arguments;
1017
1022
  return _regeneratorRuntime.wrap(function (_context) {
1018
1023
  while (1) switch (_context.prev = _context.next) {
1019
1024
  case 0:
1020
- url = _ref.url, options = _ref.options;
1025
+ _ref = _args.length > 2 && _args[2] !== undefined ? _args[2] : {
1026
+ url: '',
1027
+ options: {}
1028
+ }, url = _ref.url, options = _ref.options;
1021
1029
  // Get the retry policy from options or fetchDefaults
1022
- _options$retry = options.retry, retry = _options$retry === void 0 ? fetchDefaults.retry : _options$retry;
1030
+ retry = (options === null || options === void 0 ? void 0 : options.retry) || fetchDefaults.retry;
1023
1031
  if (!(attempt <= retry.retries)) {
1024
1032
  _context.next = 1;
1025
1033
  break;
@@ -1040,7 +1048,7 @@
1040
1048
  }
1041
1049
  }, _callee);
1042
1050
  }));
1043
- function doRetry(_x, _x2, _x3) {
1051
+ function doRetry(_x, _x2) {
1044
1052
  return _doRetry.apply(this, arguments);
1045
1053
  }
1046
1054
  return doRetry;
@@ -1146,6 +1154,14 @@
1146
1154
  var _excluded = ["retry", "timeout", "doRetry"];
1147
1155
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1148
1156
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1157
+ /**
1158
+ * `abort-controller` resolves to the native `AbortController` in the browser
1159
+ * build, but to its own shim on Node — and Node's global `fetch` rejects a
1160
+ * foreign signal: `RequestInit: Expected signal to be an instance of
1161
+ * AbortSignal`. Prefer the platform's controller whenever there is one, and
1162
+ * keep the shim for environments without it.
1163
+ */
1164
+ var AbortController = typeof globalThis.AbortController !== 'undefined' ? globalThis.AbortController : AbortControllerShim;
1149
1165
  var fetchWithDefaults = function fetchWithDefaults() {
1150
1166
  var fetchDefaults$1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : fetchDefaults;
1151
1167
  // Fetch function using hoisted defaults wrapped in a promise
@@ -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 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(){
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 b(){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 x(){return m||(m=1,function(t){var e=b();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,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})});
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=b();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=x(),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,C,I,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 I;D=1;var t=(C||(C=1,function(t){var e=y(),r=x(),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)();I=t;try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return I}(),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){var n,o,i,u,a,s=arguments;return z.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(o=(n=s.length>2&&void 0!==s[2]?s[2]:{url:"",options:{}}).url,i=n.options,u=(null==i?void 0:i.retry)||ct.retry,!(e<=u.retries)){t.next=1;break}if(a="".concat(e,"/").concat(u.retries),r.status&&!(r.status>=400&&404!==r.status)){t.next=1;break}return"message"in r?console.warn("[fetch] Attempt ".concat(a," ").concat(r.name,": ").concat(r.message," ").concat(o)):console.warn("[fetch] Attempt ".concat(a," ").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){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 bt=void 0!==globalThis.AbortController?globalThis.AbortController:q,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,b,x,_,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 bt,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,b=i(d,2),x=b[0],_=b[1],!x){e.next=6;break}if(clearTimeout(v),!(P=ht(l))){e.next=4;break}return e.next=3,l(s,x,{url:r.toString(),options:n});case 3:P=e.sent;case 4:if(!P){e.next=5;break}a(x);case 5:throw x;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},_t=xt(ct);t.default=_t,t.fetch=_t,t.fetchWithDefaults=xt,Object.defineProperty(t,"__esModule",{value:!0})});
@@ -32,7 +32,7 @@
32
32
  }
33
33
 
34
34
  var browserExports = requireBrowser();
35
- var AbortController = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
35
+ var AbortControllerShim = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
36
36
 
37
37
  /**
38
38
  * @param { Promise } promise
@@ -468,11 +468,12 @@
468
468
  doRetry: async (attempt, res, {
469
469
  url,
470
470
  options
471
+ } = {
472
+ url: '',
473
+ options: {}
471
474
  }) => {
472
475
  // Get the retry policy from options or fetchDefaults
473
- const {
474
- retry = fetchDefaults.retry
475
- } = options;
476
+ const retry = (options == null ? void 0 : options.retry) || fetchDefaults.retry;
476
477
  if (attempt <= retry.retries) {
477
478
  const counter = `${attempt}/${retry.retries}`;
478
479
  // Retry request on any network error,
@@ -540,6 +541,14 @@
540
541
 
541
542
  const isFunc = func => typeof func === 'function';
542
543
 
544
+ /**
545
+ * `abort-controller` resolves to the native `AbortController` in the browser
546
+ * build, but to its own shim on Node — and Node's global `fetch` rejects a
547
+ * foreign signal: `RequestInit: Expected signal to be an instance of
548
+ * AbortSignal`. Prefer the platform's controller whenever there is one, and
549
+ * keep the shim for environments without it.
550
+ */
551
+ const AbortController = typeof globalThis.AbortController !== 'undefined' ? globalThis.AbortController : AbortControllerShim;
543
552
  const fetchWithDefaults = (fetchDefaults$1 = fetchDefaults) => {
544
553
  // Fetch function using hoisted defaults wrapped in a promise
545
554
  // retry function adhering to a default or supplied policy calling
@@ -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,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})});
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,l,m,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(m)return l;m=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 l=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 b={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:async(t,e,{url:r,options:o}={url:"",options:{}})=>{const i=(null==o?void 0:o.retry)||b.retry;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,w=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=void 0!==globalThis.AbortController?globalThis.AbortController:u,O=(t=b)=>async(e,r={})=>{const o=await w(),i=await g(async(i,n)=>{const{retry:s=t.retry,timeout:u=t.timeout,doRetry:a=t.doRetry||b.doRetry,...c}=r,f=u||t.timeout||6e4,p=new E,h=setTimeout(()=>{p.abort()},f),[l,m]=await(y=o(e,{...c,...await x(),signal:p.signal}),y.then(function(t){return[null,t]}).catch(function(t){return[t,void 0]}));var y;if(l)throw clearTimeout(h),R(a)&&await a(n,l,{url:e.toString(),options:r})&&i(l),l;return m.ok?(clearTimeout(h),m):(clearTimeout(h),R(a)&&await a(n,m,{url:e.toString(),options:r})&&i(m),m)},r.retry||t.retry);return i},A=O(b);t.default=A,t.fetch=A,t.fetchWithDefaults=O,Object.defineProperty(t,"__esModule",{value:!0})});
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var AbortController = require('abort-controller');
5
+ var AbortControllerShim = require('abort-controller');
6
6
  var awaitToJs = require('await-to-js');
7
7
  var promiseRetry = require('promise-retry');
8
8
 
@@ -34,9 +34,9 @@ const fetchDefaults = {
34
34
  },
35
35
  // Do retry function to examine failures and apply custom retry logic
36
36
  // return true to retry the fetch call
37
- doRetry: async (attempt, res, { url, options }) => {
37
+ doRetry: async (attempt, res, { url, options } = { url: '', options: {} }) => {
38
38
  // Get the retry policy from options or fetchDefaults
39
- const { retry = fetchDefaults.retry } = options;
39
+ const retry = options?.retry || fetchDefaults.retry;
40
40
  if (attempt <= retry.retries) {
41
41
  const counter = `${attempt}/${retry.retries}`;
42
42
  // Retry request on any network error,
@@ -104,6 +104,16 @@ const proxyAgent = async () => {
104
104
 
105
105
  const isFunc = (func) => typeof func === 'function';
106
106
 
107
+ /**
108
+ * `abort-controller` resolves to the native `AbortController` in the browser
109
+ * build, but to its own shim on Node — and Node's global `fetch` rejects a
110
+ * foreign signal: `RequestInit: Expected signal to be an instance of
111
+ * AbortSignal`. Prefer the platform's controller whenever there is one, and
112
+ * keep the shim for environments without it.
113
+ */
114
+ const AbortController = typeof globalThis.AbortController !== 'undefined'
115
+ ? globalThis.AbortController
116
+ : AbortControllerShim;
107
117
  const fetchWithDefaults = (fetchDefaults$1 = fetchDefaults) => {
108
118
  // Fetch function using hoisted defaults wrapped in a promise
109
119
  // retry function adhering to a default or supplied policy calling
@@ -122,14 +132,14 @@ const fetchWithDefaults = (fetchDefaults$1 = fetchDefaults) => {
122
132
  controller.abort();
123
133
  }, timeoutMs);
124
134
  // Try fetching, wait for error or response
125
- const [error, response] = await awaitToJs.to(thisFetch(url, {
135
+ const [error, response] = (await awaitToJs.to(thisFetch(url, {
126
136
  // Standard fetch options
127
137
  ...options,
128
138
  // Conditionally add a proxy agent to debug requests
129
139
  ...(await proxyAgent()),
130
140
  // The signal will recieve abort() after timeout elapsed
131
141
  signal: controller.signal,
132
- }));
142
+ })));
133
143
  if (error) {
134
144
  clearTimeout(timeoutId);
135
145
  if (isFunc(doRetry) &&
@@ -1,4 +1,4 @@
1
- import AbortController from 'abort-controller';
1
+ import AbortControllerShim from 'abort-controller';
2
2
  import { to } from 'await-to-js';
3
3
  import promiseRetry from 'promise-retry';
4
4
 
@@ -13,9 +13,9 @@ const fetchDefaults = {
13
13
  },
14
14
  // Do retry function to examine failures and apply custom retry logic
15
15
  // return true to retry the fetch call
16
- doRetry: async (attempt, res, { url, options }) => {
16
+ doRetry: async (attempt, res, { url, options } = { url: '', options: {} }) => {
17
17
  // Get the retry policy from options or fetchDefaults
18
- const { retry = fetchDefaults.retry } = options;
18
+ const retry = options?.retry || fetchDefaults.retry;
19
19
  if (attempt <= retry.retries) {
20
20
  const counter = `${attempt}/${retry.retries}`;
21
21
  // Retry request on any network error,
@@ -83,6 +83,16 @@ const proxyAgent = async () => {
83
83
 
84
84
  const isFunc = (func) => typeof func === 'function';
85
85
 
86
+ /**
87
+ * `abort-controller` resolves to the native `AbortController` in the browser
88
+ * build, but to its own shim on Node — and Node's global `fetch` rejects a
89
+ * foreign signal: `RequestInit: Expected signal to be an instance of
90
+ * AbortSignal`. Prefer the platform's controller whenever there is one, and
91
+ * keep the shim for environments without it.
92
+ */
93
+ const AbortController = typeof globalThis.AbortController !== 'undefined'
94
+ ? globalThis.AbortController
95
+ : AbortControllerShim;
86
96
  const fetchWithDefaults = (fetchDefaults$1 = fetchDefaults) => {
87
97
  // Fetch function using hoisted defaults wrapped in a promise
88
98
  // retry function adhering to a default or supplied policy calling
@@ -101,14 +111,14 @@ const fetchWithDefaults = (fetchDefaults$1 = fetchDefaults) => {
101
111
  controller.abort();
102
112
  }, timeoutMs);
103
113
  // Try fetching, wait for error or response
104
- const [error, response] = await to(thisFetch(url, {
114
+ const [error, response] = (await to(thisFetch(url, {
105
115
  // Standard fetch options
106
116
  ...options,
107
117
  // Conditionally add a proxy agent to debug requests
108
118
  ...(await proxyAgent()),
109
119
  // The signal will recieve abort() after timeout elapsed
110
120
  signal: controller.signal,
111
- }));
121
+ })));
112
122
  if (error) {
113
123
  clearTimeout(timeoutId);
114
124
  if (isFunc(doRetry) &&
@@ -1 +1 @@
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,EA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C,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;;;;"}
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,K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,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;;;;"}
@@ -1,2 +1,2 @@
1
1
  export declare const isSysError: (error: any) => error is Error;
2
- export declare const isFunc: (func: any) => boolean;
2
+ export declare const isFunc: (func: any) => func is Function;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enterprise-fetch",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
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",
@@ -15,7 +15,7 @@
15
15
  "cypress:open": "cypress open",
16
16
  "cypress:run": "cypress run",
17
17
  "instrument": "nyc instrument --compact=false dist/enterprise-fetch.esm.js instrumented",
18
- "mocha:run": "mocha --timeout 500000 --exit cypress/integration/node.spec.mjs",
18
+ "mocha:run": "mocha --timeout 500000 --exit \"cypress/integration/node*.spec.mjs\"",
19
19
  "nyc:mocha": "nyc npm run mocha:run",
20
20
  "nyc:test": "nyc npm run mocha:run && npm test",
21
21
  "prestart": "npm run build",