enterprise-fetch 1.0.0-alpha.5 → 1.0.0

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/README.md CHANGED
@@ -287,3 +287,12 @@ You could use a polyfill service to polyfill missing features by adding a snippe
287
287
  src="https://polyfill.io/v3/polyfill.min.js?features=AbortController%2Cfetch"
288
288
  ></script>
289
289
  ```
290
+
291
+ ## Development scripts
292
+
293
+ - `npm start` builds the library and runs through all tests in command line
294
+ - `npm run build` build the library from source and create an instrumented copy of the build for coverage reporting
295
+ - `npm test` starts a http server and runs through all tests in command line
296
+ - `npm run cy:open` starts a http server and opens cypress testing gui for you to execute test specs interactively in a browser window
297
+ - `npm run report:coverage` checks code coverage and starts a http server rendering the test coverage report for review in a browser
298
+ - `npm run serve` starts a http server with a simple browser testing page available at the `/test` route
@@ -1382,26 +1382,26 @@
1382
1382
  proxyUri = typeof process !== 'undefined' && process.env.http_proxy || false;
1383
1383
 
1384
1384
  if (!proxyUri) {
1385
- _context.next = 9;
1385
+ _context.next = 8;
1386
1386
  break;
1387
1387
  }
1388
1388
 
1389
- console.info("Proxying via http_proxy: ".concat(process.env.http_proxy));
1389
+ // console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
1390
1390
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
1391
- _context.next = 6;
1391
+ _context.next = 5;
1392
1392
  return ('https-proxy-agent');
1393
1393
 
1394
- case 6:
1394
+ case 5:
1395
1395
  _yield$import = _context.sent;
1396
1396
  HttpsProxyAgent = _yield$import.HttpsProxyAgent;
1397
1397
  return _context.abrupt("return", {
1398
1398
  agent: new HttpsProxyAgent(proxyUri)
1399
1399
  });
1400
1400
 
1401
- case 9:
1401
+ case 8:
1402
1402
  return _context.abrupt("return", {});
1403
1403
 
1404
- case 10:
1404
+ case 9:
1405
1405
  case "end":
1406
1406
  return _context.stop();
1407
1407
  }
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("cross-fetch")):"function"==typeof define&&define.amd?define(["exports","cross-fetch"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch-legacy"]={},t.fetch)}(this,(function(t,e){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(e);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.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)?i(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,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function c(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).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 a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}function f(t){var e={exports:{}};return t(e,e.exports),e.exports}var p=f((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,i=Object.create(o.prototype),a=new P(n||[]);return i._invoke=function(t,e,r){var n=p;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=l;var c=f(t,e,r);if("normal"===c.type){if(n=r.done?y:h,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",l="executing",y="completed",m={};function v(){}function d(){}function g(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(L([])));_&&_!==r&&n.call(_,i)&&(b=_);var x=g.prototype=v.prototype=Object.create(b);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(p).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=f(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function L(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:k}}function k(){return{value:e,done:!0}}return d.prototype=x.constructor=g,g.constructor=d,d.displayName=c(g,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},O(T.prototype),T.prototype[a]=function(){return this},t.AsyncIterator=T,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new T(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(x),c(x,u,"Generator"),x[i]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function h(t){return(h="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)}function l(t,e){for(var r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}var y=function(t,e,r){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"===h(e)&&(r=e,e=void 0),null!=e&&(r.code=e);try{return l(t,r)}catch(e){r.message=t.message,r.stack=t.stack;var n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),l(new n,r)}};function m(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))}var v=m;m.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},m.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},m.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},m.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)},m.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},m.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},m.prototype.start=m.prototype.try,m.prototype.errors=function(){return this._errors},m.prototype.attempts=function(){return this._attempts},m.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,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e};var d=f((function(t,e){e.operation=function(t){var r=e.timeouts(t);return new v(r,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.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},e.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)},e.wrap=function(t,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var o in n=[],t)"function"==typeof t[o]&&n.push(o);for(var i=0;i<n.length;i++){var a=n[i],u=t[a];t[a]=function(n){var o=e.operation(r),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push((function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),a.apply(this,arguments))})),o.attempt((function(){n.apply(t,i)}))}.bind(t,u),t[a].options=r}}})),g=Object.prototype.hasOwnProperty;function b(t){return t&&"EPROMISERETRY"===t.code&&g.call(t,"retried")}var w=function(t,e){var r,n;return"object"==typeof t&&"function"==typeof e&&(r=e,e=t,t=r),n=d.operation(e),new Promise((function(e,r){n.attempt((function(o){Promise.resolve().then((function(){return t((function(t){throw b(t)&&(t=t.retried),y(new Error("Retrying"),"EPROMISERETRY",{retried:t})}),o)})).then(e,(function(t){b(t)&&(t=t.retried,n.retry(t||new Error))||r(t)}))}))}))},_="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0,x=_.AbortController,O=_.AbortSignal,T=x,E=O,j=x;function S(t,e){return t.then((function(t){return[null,t]})).catch((function(t){return e&&Object.assign(t,e),[t,void 0]}))}T.AbortSignal=E,T.default=j;var P,L={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:(P=s(p.mark((function t(e,r,n){var o,i,a,u,c;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.url,i=n.options,a=i.retry,u=void 0===a?L.retry:a,!(e<=u.retries)){t.next=7;break}if(c="".concat(e,"/").concat(u.retries),r.status&&!(r.status>=400&&404!==r.status)){t.next=7;break}return"message"in r?console.warn("[fetch] Attempt ".concat(c," ").concat(r.name,": ").concat(r.message," ").concat(o)):console.warn("[fetch] Attempt ".concat(c," ").concat(r.status,": ").concat(r.statusText," ").concat(o)),t.abrupt("return",!0);case 7:return t.abrupt("return",!1);case 8:case"end":return t.stop()}}),t)}))),function(t,e,r){return P.apply(this,arguments)})},k=function(){var t=s(p.mark((function t(){var e,r,n;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e="undefined"!=typeof process&&process.env.http_proxy||!1)){t.next=9;break}return console.info("Proxying via http_proxy: ".concat(process.env.http_proxy)),process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",t.next=6,"https-proxy-agent";case 6:return r=t.sent,n=r.HttpsProxyAgent,t.abrupt("return",{agent:new n(e)});case 9:return t.abrupt("return",{});case 10:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),R=function(t){return"function"==typeof t};function A(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 N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var I="undefined"!=typeof window?window.fetch:n.default,C=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L,e=function(){var e=s(p.mark((function e(r){var n,o,i=arguments;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:{},e.next=3,w(function(){var e=s(p.mark((function e(o,i){var c,s,f,h,l,y,m,v,d,g,b;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n.retry&&t.retry,c=n.timeout,s=void 0===c?t.timeout:c,f=n.doRetry,h=void 0===f?t.doRetry||L.doRetry:f,l=u(n,["retry","timeout","doRetry"]),y=s||t.timeout||6e4,m=new T,setTimeout((function(){m.abort()}),y),e.t0=S,e.t1=I,e.t2=r,e.t3=N,e.t4=N,e.t5=N({},l),e.next=12,k();case 12:return e.t6=e.sent,e.t7=(0,e.t4)(e.t5,e.t6),e.t8={},e.t9={signal:m.signal},e.t10=(0,e.t3)(e.t7,e.t8,e.t9),e.t11=(0,e.t1)(e.t2,e.t10),e.next=20,(0,e.t0)(e.t11);case 20:if(v=e.sent,d=a(v,2),g=d[0],b=d[1],!g){e.next=33;break}if(e.t12=R(h),!e.t12){e.next=30;break}return e.next=29,h(i,g,{url:r,options:n});case 29:e.t12=e.sent;case 30:if(!e.t12){e.next=32;break}o(g);case 32:throw g;case 33:if(b.ok){e.next=42;break}if(e.t13=R(h),!e.t13){e.next=39;break}return e.next=38,h(i,b,{url:r,options:n});case 38:e.t13=e.sent;case 39:if(!e.t13){e.next=41;break}o(b);case 41:case 42:return e.abrupt("return",b);case 43:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),n.retry||t.retry);case 3:return o=e.sent,e.abrupt("return",o);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return e},D=C(L);t.default=D,t.fetchWithDefaults=C,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("cross-fetch")):"function"==typeof define&&define.amd?define(["exports","cross-fetch"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch-legacy"]={},t.fetch)}(this,(function(t,e){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=r(e);function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=t[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){o=!0,i=t}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.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)?i(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,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function c(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).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 a(t){c(i,n,o,a,u,"next",t)}function u(t){c(i,n,o,a,u,"throw",t)}a(void 0)}))}}function f(t){var e={exports:{}};return t(e,e.exports),e.exports}var p=f((function(t){var e=function(t){var e,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof v?e:v,i=Object.create(o.prototype),a=new L(n||[]);return i._invoke=function(t,e,r){var n=p;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===y){if("throw"===o)throw i;return k()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=E(a,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===p)throw n=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=l;var c=f(t,e,r);if("normal"===c.type){if(n=r.done?y:h,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=y,r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p="suspendedStart",h="suspendedYield",l="executing",y="completed",m={};function v(){}function d(){}function g(){}var b={};b[i]=function(){return this};var w=Object.getPrototypeOf,_=w&&w(w(P([])));_&&_!==r&&n.call(_,i)&&(b=_);var x=g.prototype=v.prototype=Object.create(b);function O(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(o,i,a,u){var c=f(t[o],t,i);if("throw"!==c.type){var s=c.arg,p=s.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(p).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function E(t,r){var n=t.iterator[r.method];if(n===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=e,E(t,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=f(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function P(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function r(){for(;++o<t.length;)if(n.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}return{next:k}}function k(){return{value:e,done:!0}}return d.prototype=x.constructor=g,g.constructor=d,d.displayName=c(g,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,c(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},O(T.prototype),T.prototype[a]=function(){return this},t.AsyncIterator=T,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new T(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(x),c(x,u,"Generator"),x[i]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=P,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function o(n,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(c&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:P(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}));function h(t){return(h="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)}function l(t,e){for(var r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}var y=function(t,e,r){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"===h(e)&&(r=e,e=void 0),null!=e&&(r.code=e);try{return l(t,r)}catch(e){r.message=t.message,r.stack=t.stack;var n=function(){};return n.prototype=Object.create(Object.getPrototypeOf(t)),l(new n,r)}};function m(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))}var v=m;m.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},m.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},m.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},m.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)},m.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},m.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},m.prototype.start=m.prototype.try,m.prototype.errors=function(){return this._errors},m.prototype.attempts=function(){return this._attempts},m.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,a=(t[i]||0)+1;t[i]=a,a>=r&&(e=o,r=a)}return e};var d=f((function(t,e){e.operation=function(t){var r=e.timeouts(t);return new v(r,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.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},e.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)},e.wrap=function(t,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var o in n=[],t)"function"==typeof t[o]&&n.push(o);for(var i=0;i<n.length;i++){var a=n[i],u=t[a];t[a]=function(n){var o=e.operation(r),i=Array.prototype.slice.call(arguments,1),a=i.pop();i.push((function(t){o.retry(t)||(t&&(arguments[0]=o.mainError()),a.apply(this,arguments))})),o.attempt((function(){n.apply(t,i)}))}.bind(t,u),t[a].options=r}}})),g=Object.prototype.hasOwnProperty;function b(t){return t&&"EPROMISERETRY"===t.code&&g.call(t,"retried")}var w=function(t,e){var r,n;return"object"==typeof t&&"function"==typeof e&&(r=e,e=t,t=r),n=d.operation(e),new Promise((function(e,r){n.attempt((function(o){Promise.resolve().then((function(){return t((function(t){throw b(t)&&(t=t.retried),y(new Error("Retrying"),"EPROMISERETRY",{retried:t})}),o)})).then(e,(function(t){b(t)&&(t=t.retried,n.retry(t||new Error))||r(t)}))}))}))},_="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0,x=_.AbortController,O=_.AbortSignal,T=x,E=O,j=x;function S(t,e){return t.then((function(t){return[null,t]})).catch((function(t){return e&&Object.assign(t,e),[t,void 0]}))}T.AbortSignal=E,T.default=j;var L,P={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:(L=s(p.mark((function t(e,r,n){var o,i,a,u,c;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=n.url,i=n.options,a=i.retry,u=void 0===a?P.retry:a,!(e<=u.retries)){t.next=7;break}if(c="".concat(e,"/").concat(u.retries),r.status&&!(r.status>=400&&404!==r.status)){t.next=7;break}return"message"in r?console.warn("[fetch] Attempt ".concat(c," ").concat(r.name,": ").concat(r.message," ").concat(o)):console.warn("[fetch] Attempt ".concat(c," ").concat(r.status,": ").concat(r.statusText," ").concat(o)),t.abrupt("return",!0);case 7:return t.abrupt("return",!1);case 8:case"end":return t.stop()}}),t)}))),function(t,e,r){return L.apply(this,arguments)})},k=function(){var t=s(p.mark((function t(){var e,r,n;return p.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e="undefined"!=typeof process&&process.env.http_proxy||!1)){t.next=8;break}return process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",t.next=5,"https-proxy-agent";case 5:return r=t.sent,n=r.HttpsProxyAgent,t.abrupt("return",{agent:new n(e)});case 8:return t.abrupt("return",{});case 9:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),R=function(t){return"function"==typeof t};function A(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 N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?A(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var I="undefined"!=typeof window?window.fetch:n.default,C=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:P,e=function(){var e=s(p.mark((function e(r){var n,o,i=arguments;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>1&&void 0!==i[1]?i[1]:{},e.next=3,w(function(){var e=s(p.mark((function e(o,i){var c,s,f,h,l,y,m,v,d,g,b;return p.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n.retry&&t.retry,c=n.timeout,s=void 0===c?t.timeout:c,f=n.doRetry,h=void 0===f?t.doRetry||P.doRetry:f,l=u(n,["retry","timeout","doRetry"]),y=s||t.timeout||6e4,m=new T,setTimeout((function(){m.abort()}),y),e.t0=S,e.t1=I,e.t2=r,e.t3=N,e.t4=N,e.t5=N({},l),e.next=12,k();case 12:return e.t6=e.sent,e.t7=(0,e.t4)(e.t5,e.t6),e.t8={},e.t9={signal:m.signal},e.t10=(0,e.t3)(e.t7,e.t8,e.t9),e.t11=(0,e.t1)(e.t2,e.t10),e.next=20,(0,e.t0)(e.t11);case 20:if(v=e.sent,d=a(v,2),g=d[0],b=d[1],!g){e.next=33;break}if(e.t12=R(h),!e.t12){e.next=30;break}return e.next=29,h(i,g,{url:r,options:n});case 29:e.t12=e.sent;case 30:if(!e.t12){e.next=32;break}o(g);case 32:throw g;case 33:if(b.ok){e.next=42;break}if(e.t13=R(h),!e.t13){e.next=39;break}return e.next=38,h(i,b,{url:r,options:n});case 38:e.t13=e.sent;case 39:if(!e.t13){e.next=41;break}o(b);case 41:case 42:return e.abrupt("return",b);case 43:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),n.retry||t.retry);case 3:return o=e.sent,e.abrupt("return",o);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return e},D=C(P);t.default=D,t.fetchWithDefaults=C,Object.defineProperty(t,"__esModule",{value:!0})}));
@@ -524,7 +524,7 @@
524
524
  const proxyUri = typeof process !== 'undefined' && process.env.http_proxy || false;
525
525
 
526
526
  if (proxyUri) {
527
- console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
527
+ // console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
528
528
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
529
529
  const {
530
530
  HttpsProxyAgent
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("cross-fetch")):"function"==typeof define&&define.amd?define(["exports","cross-fetch"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch"]={},t.fetch)}(this,(function(t,e){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=r(e);function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function u(t,e){if(null==t)return{};var r,o,n=function(t,e){if(null==t)return{};var r,o,n={},i=Object.keys(t);for(o=0;o<i.length;o++)r=i[o],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function a(t,e){for(const r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}var c=function(t,e,r){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"==typeof e&&(r=e,e=void 0),null!=e&&(r.code=e);try{return a(t,r)}catch(e){r.message=t.message,r.stack=t.stack;const o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(t)),a(new o,r)}};function f(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))}var p=f;f.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},f.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},f.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,n=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&&n.unref(),!0},f.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)},f.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},f.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},f.prototype.start=f.prototype.try,f.prototype.errors=function(){return this._errors},f.prototype.attempts=function(){return this._attempts},f.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 n=this._errors[o],i=n.message,s=(t[i]||0)+1;t[i]=s,s>=r&&(e=n,r=s)}return e};var m=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t,e){e.operation=function(t){var r=e.timeouts(t);return new p(r,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.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=[],n=0;n<e.retries;n++)o.push(this.createTimeout(n,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(n,e)),o.sort((function(t,e){return t-e})),o},e.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)},e.wrap=function(t,r,o){if(r instanceof Array&&(o=r,r=null),!o)for(var n in o=[],t)"function"==typeof t[n]&&o.push(n);for(var i=0;i<o.length;i++){var s=o[i],u=t[s];t[s]=function(o){var n=e.operation(r),i=Array.prototype.slice.call(arguments,1),s=i.pop();i.push((function(t){n.retry(t)||(t&&(arguments[0]=n.mainError()),s.apply(this,arguments))})),n.attempt((function(){o.apply(t,i)}))}.bind(t,u),t[s].options=r}}})),h=Object.prototype.hasOwnProperty;function l(t){return t&&"EPROMISERETRY"===t.code&&h.call(t,"retried")}var y=function(t,e){var r,o;return"object"==typeof t&&"function"==typeof e&&(r=e,e=t,t=r),o=m.operation(e),new Promise((function(e,r){o.attempt((function(n){Promise.resolve().then((function(){return t((function(t){throw l(t)&&(t=t.retried),c(new Error("Retrying"),"EPROMISERETRY",{retried:t})}),n)})).then(e,(function(t){l(t)&&(t=t.retried,o.retry(t||new Error))||r(t)}))}))}))};const{AbortController:_,AbortSignal:d}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;var b=_,T=d,v=_;b.AbortSignal=T,b.default=v;const g={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:async(t,e,{url:r,options:o})=>{const{retry:n=g.retry}=o;if(t<=n.retries){const o=`${t}/${n.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}},w=t=>"function"==typeof t,O="undefined"!=typeof window?window.fetch:o.default,j=(t=g)=>async(e,r={})=>await y((async(o,n)=>{const{retry:i=t.retry,timeout:a=t.timeout,doRetry:c=t.doRetry||g.doRetry}=r,f=u(r,["retry","timeout","doRetry"]),p=a||t.timeout||6e4,m=new b;setTimeout((()=>{m.abort()}),p);const[h,l]=await(y=O(e,s(s(s({},f),await(async()=>{const t="undefined"!=typeof process&&process.env.http_proxy||!1;if(t){console.info(`Proxying via http_proxy: ${process.env.http_proxy}`),process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";const{HttpsProxyAgent:e}=await"https-proxy-agent";return{agent:new e(t)}}return{}})()),{},{signal:m.signal})),y.then((function(t){return[null,t]})).catch((function(t){return _&&Object.assign(t,_),[t,void 0]})));var y,_;if(h)throw w(c)&&await c(n,h,{url:e,options:r})&&o(h),h;return l.ok||w(c)&&await c(n,l,{url:e,options:r})&&o(l),l}),r.retry||t.retry);var x=j(g);t.default=x,t.fetchWithDefaults=j,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("cross-fetch")):"function"==typeof define&&define.amd?define(["exports","cross-fetch"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["enterprise-fetch"]={},t.fetch)}(this,(function(t,e){"use strict";function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=r(e);function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,o)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function u(t,e){if(null==t)return{};var r,o,n=function(t,e){if(null==t)return{};var r,o,n={},i=Object.keys(t);for(o=0;o<i.length;o++)r=i[o],e.indexOf(r)>=0||(n[r]=t[r]);return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)r=i[o],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function a(t,e){for(const r in e)Object.defineProperty(t,r,{value:e[r],enumerable:!0,configurable:!0});return t}var c=function(t,e,r){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");r||(r={}),"object"==typeof e&&(r=e,e=void 0),null!=e&&(r.code=e);try{return a(t,r)}catch(e){r.message=t.message,r.stack=t.stack;const o=function(){};return o.prototype=Object.create(Object.getPrototypeOf(t)),a(new o,r)}};function f(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))}var p=f;f.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},f.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},f.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,n=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&&n.unref(),!0},f.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)},f.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},f.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},f.prototype.start=f.prototype.try,f.prototype.errors=function(){return this._errors},f.prototype.attempts=function(){return this._attempts},f.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 n=this._errors[o],i=n.message,s=(t[i]||0)+1;t[i]=s,s>=r&&(e=n,r=s)}return e};var m=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t,e){e.operation=function(t){var r=e.timeouts(t);return new p(r,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},e.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=[],n=0;n<e.retries;n++)o.push(this.createTimeout(n,e));return t&&t.forever&&!o.length&&o.push(this.createTimeout(n,e)),o.sort((function(t,e){return t-e})),o},e.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)},e.wrap=function(t,r,o){if(r instanceof Array&&(o=r,r=null),!o)for(var n in o=[],t)"function"==typeof t[n]&&o.push(n);for(var i=0;i<o.length;i++){var s=o[i],u=t[s];t[s]=function(o){var n=e.operation(r),i=Array.prototype.slice.call(arguments,1),s=i.pop();i.push((function(t){n.retry(t)||(t&&(arguments[0]=n.mainError()),s.apply(this,arguments))})),n.attempt((function(){o.apply(t,i)}))}.bind(t,u),t[s].options=r}}})),h=Object.prototype.hasOwnProperty;function l(t){return t&&"EPROMISERETRY"===t.code&&h.call(t,"retried")}var y=function(t,e){var r,o;return"object"==typeof t&&"function"==typeof e&&(r=e,e=t,t=r),o=m.operation(e),new Promise((function(e,r){o.attempt((function(n){Promise.resolve().then((function(){return t((function(t){throw l(t)&&(t=t.retried),c(new Error("Retrying"),"EPROMISERETRY",{retried:t})}),n)})).then(e,(function(t){l(t)&&(t=t.retried,o.retry(t||new Error))||r(t)}))}))}))};const{AbortController:_,AbortSignal:d}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;var b=_,T=d,g=_;b.AbortSignal=T,b.default=g;const v={timeout:6e4,retry:{retries:3,minTimeout:400,factor:2},doRetry:async(t,e,{url:r,options:o})=>{const{retry:n=v.retry}=o;if(t<=n.retries){const o=`${t}/${n.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}},w=t=>"function"==typeof t,O="undefined"!=typeof window?window.fetch:o.default,j=(t=v)=>async(e,r={})=>await y((async(o,n)=>{const{retry:i=t.retry,timeout:a=t.timeout,doRetry:c=t.doRetry||v.doRetry}=r,f=u(r,["retry","timeout","doRetry"]),p=a||t.timeout||6e4,m=new b;setTimeout((()=>{m.abort()}),p);const[h,l]=await(y=O(e,s(s(s({},f),await(async()=>{const t="undefined"!=typeof process&&process.env.http_proxy||!1;if(t){process.env.NODE_TLS_REJECT_UNAUTHORIZED="0";const{HttpsProxyAgent:e}=await"https-proxy-agent";return{agent:new e(t)}}return{}})()),{},{signal:m.signal})),y.then((function(t){return[null,t]})).catch((function(t){return _&&Object.assign(t,_),[t,void 0]})));var y,_;if(h)throw w(c)&&await c(n,h,{url:e,options:r})&&o(h),h;return l.ok||w(c)&&await c(n,l,{url:e,options:r})&&o(l),l}),r.retry||t.retry);var R=j(v);t.default=R,t.fetchWithDefaults=j,Object.defineProperty(t,"__esModule",{value:!0})}));
@@ -73,7 +73,7 @@ const proxyAgent = async () => {
73
73
  const proxyUri = typeof process !== 'undefined' && process.env.http_proxy || false;
74
74
 
75
75
  if (proxyUri) {
76
- console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
76
+ // console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
77
77
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
78
78
  const {
79
79
  HttpsProxyAgent
@@ -42,7 +42,7 @@ const proxyAgent = async () => {
42
42
  const proxyUri = typeof process !== 'undefined' && process.env.http_proxy || false;
43
43
 
44
44
  if (proxyUri) {
45
- console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
45
+ // console.info(`Proxying via http_proxy: ${process.env.http_proxy}`);
46
46
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
47
47
  const {
48
48
  HttpsProxyAgent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enterprise-fetch",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0",
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",
@@ -18,10 +18,13 @@
18
18
  "mocha:run": "mocha --es-module-specifier-resolution=node --require @babel/register --timeout 500000 --exit cypress/integration/node.spec.js",
19
19
  "nyc:test": "nyc npm test",
20
20
  "prestart": "npm run build",
21
- "report:coverage": "nyc report --reporter=html",
21
+ "report:coverage": "nyc report --reporter=html && serve ./coverage",
22
22
  "report:coverage:text": "nyc report --reporter=text",
23
23
  "report:coverage:summary": "nyc report --reporter=text-summary",
24
- "report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
24
+ "codecov:linux": "curl -Os https://uploader.codecov.io/latest/linux/codecov && chmod +x codecov",
25
+ "codecov:macos": "curl -Os https://uploader.codecov.io/latest/macos/codecov && chmod +x codecov",
26
+ "codecov:windows": "curl -Os https://uploader.codecov.io/latest/windows/codecov.exe",
27
+ "report-coverage": "npm run codecov:windows && codecov -t 9f816f9c-8faa-4812-9bb2-5235c8c11468",
25
28
  "start": "npm run nyc:test",
26
29
  "serve": "serve .",
27
30
  "test": "start-server-and-test serve http://localhost:5000 cypress:run"
@@ -42,8 +45,8 @@
42
45
  "repository": "https://github.com/neilflatley/enterprise-fetch",
43
46
  "dependencies": {
44
47
  "abort-controller": "^3.0.0",
45
- "await-to-js": "^2.1.1",
46
- "cross-fetch": "^3.0.6",
48
+ "await-to-js": "^3.0.0",
49
+ "cross-fetch": "^3.1.2",
47
50
  "https-proxy-agent": "^5.0.0",
48
51
  "promise-retry": "^2.0.1"
49
52
  },
@@ -56,22 +59,22 @@
56
59
  "@babel/plugin-transform-classes": "^7.13.0",
57
60
  "@babel/plugin-transform-regenerator": "^7.12.13",
58
61
  "@babel/plugin-transform-runtime": "^7.13.10",
59
- "@babel/preset-env": "^7.13.10",
62
+ "@babel/preset-env": "^7.13.12",
60
63
  "@babel/preset-typescript": "^7.13.0",
61
64
  "@babel/register": "^7.13.8",
62
65
  "@cypress/code-coverage": "^3.9.2",
63
66
  "@rollup/plugin-babel": "^5.3.0",
64
67
  "@rollup/plugin-commonjs": "^17.1.0",
65
68
  "@rollup/plugin-node-resolve": "^11.2.0",
66
- "@types/node": "^14.14.33",
69
+ "@types/node": "^14.14.35",
67
70
  "@types/node-fetch": "^2.5.8",
68
71
  "@types/promise-retry": "^1.1.3",
69
- "@typescript-eslint/eslint-plugin": "^4.17.0",
70
- "@typescript-eslint/parser": "^4.17.0",
72
+ "@typescript-eslint/eslint-plugin": "^4.19.0",
73
+ "@typescript-eslint/parser": "^4.19.0",
71
74
  "chai": "^4.3.4",
72
75
  "cross-env": "^7.0.3",
73
- "cypress": "^6.6.0",
74
- "eslint": "^7.21.0",
76
+ "cypress": "^6.8.0",
77
+ "eslint": "^7.22.0",
75
78
  "eslint-config-prettier": "^8.1.0",
76
79
  "eslint-import-resolver-typescript": "^2.4.0",
77
80
  "eslint-plugin-import": "^2.22.1",
@@ -81,10 +84,10 @@
81
84
  "nyc": "^15.1.0",
82
85
  "prettier": "^2.2.1",
83
86
  "rimraf": "^3.0.2",
84
- "rollup": "^2.41.2",
87
+ "rollup": "^2.42.3",
85
88
  "rollup-plugin-terser": "^7.0.2",
86
89
  "serve": "^11.3.2",
87
- "start-server-and-test": "^1.12.0",
90
+ "start-server-and-test": "^1.12.1",
88
91
  "tslint": "^6.1.3",
89
92
  "typescript": "^4.2.3"
90
93
  }
@@ -1 +0,0 @@
1
- export default fetch;