Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

opossum

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opossum - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

12

CHANGELOG.md

@@ -5,6 +5,16 @@ # Changelog

## [4.1.0](https://github.com/nodeshift/opossum/compare/v4.0.0...v4.1.0) (2019-10-16)
### Features
* add call() method to CircuitBreaker ([#374](https://github.com/nodeshift/opossum/issues/374)) ([ef05d2b](https://github.com/nodeshift/opossum/commit/ef05d2b))
## [4.0.0](https://github.com/nodeshift/opossum/compare/v3.1.0...v4.0.0) (2019-08-21)
## [3.1.0](https://github.com/nodeshift/opossum/compare/v3.0.0...v3.1.0) (2019-08-21)
### Breaking Changes
* The factory function has been removed in favor of simply using the `CircuitBreaker` constructor.
* Prometheus and Hystrix metrics have been moved into their own repositories.
* We no longer keep a set of all circuits

@@ -11,0 +21,0 @@ ### Features

6

dist/opossum.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.circuitBreaker=t():e.circuitBreaker=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){(function(t){var r,i=n(2),o=n(9),s=n(11),u=Array.prototype.slice,c={};r=void 0!==t&&t.console?t.console:"undefined"!=typeof window&&window.console?window.console:{};for(var a=[[function(){},"log"],[function(){r.log.apply(r,arguments)},"info"],[function(){r.log.apply(r,arguments)},"warn"],[function(){r.warn.apply(r,arguments)},"error"],[function(e){c[e]=s()},"time"],[function(e){var t=c[e];if(!t)throw new Error("No such label: "+e);var n=s()-t;r.log(e+": "+n+"ms")},"timeEnd"],[function(){var e=new Error;e.name="Trace",e.message=i.format.apply(null,arguments),r.error(e.stack)},"trace"],[function(e){r.log(i.inspect(e)+"\n")},"dir"],[function(e){if(!e){var t=u.call(arguments,1);o.ok(!1,i.format.apply(null,t))}},"assert"]],l=0;l<a.length;l++){var f=a[l],p=f[0],h=f[1];r[h]||(r[h]=p)}e.exports=r}).call(this,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(e,r){var i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},o=/%[sdj%]/g;t.format=function(e){if(!v(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(c(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,s=String(e).replace(o,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n<i;u=r[++n])d(u)||!E(u)?s+=" "+u:s+=" "+c(u);return s},t.deprecate=function(n,i){if(void 0!==e&&!0===e.noDeprecation)return n;if(void 0===e)return function(){return t.deprecate(n,i).apply(this,arguments)};var o=!1;return function(){if(!o){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?r.trace(i):r.error(i),o=!0}return n.apply(this,arguments)}};var s,u={};function c(e,n){var r={seen:[],stylize:l};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(n)?r.showHidden=n:n&&t._extend(r,n),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),f(r,e,r.depth)}function a(e,t){var n=c.styles[t];return n?"["+c.colors[n][0]+"m"+e+"["+c.colors[n][1]+"m":e}function l(e,t){return e}function f(e,n,r){if(e.customInspect&&n&&j(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return v(i)||(i=f(e,i,r)),i}var o=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(g(t))return e.stylize(""+t,"number");if(m(t))return e.stylize(""+t,"boolean");if(d(t))return e.stylize("null","null")}(e,n);if(o)return o;var s=Object.keys(n),u=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),O(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(j(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(w(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(x(n))return e.stylize(Date.prototype.toString.call(n),"date");if(O(n))return p(n)}var a,l="",E=!1,T=["{","}"];(y(n)&&(E=!0,T=["[","]"]),j(n))&&(l=" [Function"+(n.name?": "+n.name:"")+"]");return w(n)&&(l=" "+RegExp.prototype.toString.call(n)),x(n)&&(l=" "+Date.prototype.toUTCString.call(n)),O(n)&&(l=" "+p(n)),0!==s.length||E&&0!=n.length?r<0?w(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),a=E?function(e,t,n,r,i){for(var o=[],s=0,u=t.length;s<u;++s)_(t,String(s))?o.push(h(e,t,n,r,String(s),!0)):o.push("");return i.forEach(function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))}),o}(e,n,r,u,s):s.map(function(t){return h(e,n,r,u,t,E)}),e.seen.pop(),function(e,t,n){if(e.reduce(function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(a,l,T)):T[0]+l+T[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i,o){var s,u,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?u=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(u=e.stylize("[Setter]","special")),_(r,i)||(s="["+i+"]"),u||(e.seen.indexOf(c.value)<0?(u=d(n)?f(e,c.value,null):f(e,c.value,n-1)).indexOf("\n")>-1&&(u=o?u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+u.split("\n").map(function(e){return" "+e}).join("\n")):u=e.stylize("[Circular]","special")),b(s)){if(o&&i.match(/^\d+$/))return u;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function y(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function d(e){return null===e}function g(e){return"number"==typeof e}function v(e){return"string"==typeof e}function b(e){return void 0===e}function w(e){return E(e)&&"[object RegExp]"===T(e)}function E(e){return"object"==typeof e&&null!==e}function x(e){return E(e)&&"[object Date]"===T(e)}function O(e){return E(e)&&("[object Error]"===T(e)||e instanceof Error)}function j(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(b(s)&&(s=Object({WEB:"web"}).NODE_DEBUG||""),n=n.toUpperCase(),!u[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var i=e.pid;u[n]=function(){var e=t.format.apply(t,arguments);r.error("%s %d: %s",n,i,e)}}else u[n]=function(){};return u[n]},t.inspect=c,c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=m,t.isNull=d,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=w,t.isObject=E,t.isDate=x,t.isError=O,t.isFunction=j,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(7);var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),P[e.getMonth()],t].join(" ")}function _(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){r.log("%s - %s",k(),t.format.apply(t,arguments))},t.inherits=n(8),t._extend=function(e,t){if(!t||!E(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var L="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function A(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(L&&e[L]){var t;if("function"!=typeof(t=e[L]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,L,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise(function(e,r){t=e,n=r}),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push(function(e,r){e?n(e):t(r)});try{e.apply(this,i)}catch(e){n(e)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),L&&Object.defineProperty(t,L,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=L,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function n(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var i=n.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};t.apply(this,n).then(function(t){e.nextTick(s,null,t)},function(t){e.nextTick(A,t,s)})}return Object.setPrototypeOf(n,Object.getPrototypeOf(t)),Object.defineProperties(n,i(t)),n}}).call(this,n(6),n(0))},function(e,t,n){"use strict";(function(t){var n,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};n=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function a(e,n,r,i){var o,s,u,a;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",n,r.listener?r.listener:r),s=e._events),u=s[n]),void 0===u)u=s[n]=r,++e._eventsCount;else if("function"==typeof u?u=s[n]=i?[r,u]:[u,r]:i?u.unshift(r):u.push(r),(o=c(e))>0&&u.length>o&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=n,l.count=u.length,a=l,t&&t.warn&&t.warn(a)}return e}function l(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=function(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,i(this.listener,this.target,e))}.bind(r);return o.listener=n,r.wrapFn=o,o}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):h(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var a=c.length,l=h(c,a);for(n=0;n<a;++n)i(l[n],this,t)}return!0},s.prototype.addListener=function(e,t){return a(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return a(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,l(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,l(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,o,s;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return f(this,e,!0)},s.prototype.rawListeners=function(e){return f(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}}).call(this,n(0))},function(e,t,n){"use strict";e.exports=n(5)},function(e,t,n){"use strict";(function(t){const r=n(3),i=n(12),o=n(13),s=Symbol("state"),u=Symbol("open"),c=Symbol("closed"),a=Symbol("half-open"),l=Symbol("pending-close"),f=Symbol("shutdown"),p=Symbol("fallback"),h=Symbol("status"),y=Symbol("name"),m=Symbol("group"),d=new WeakMap,g=Symbol("Enabled"),v=Symbol("warming-up"),b=Symbol("volume-threshold"),w="options.maxFailures is deprecated. Please use options.errorThresholdPercentage";class E extends r{constructor(e,n={}){if(super(),this.options=n,this.options.timeout=n.timeout||1e4,this.options.resetTimeout=n.resetTimeout||3e4,this.options.errorThresholdPercentage=n.errorThresholdPercentage||50,this.options.rollingCountTimeout=n.rollingCountTimeout||1e4,this.options.rollingCountBuckets=n.rollingCountBuckets||10,this.options.rollingPercentilesEnabled=!1!==n.rollingPercentilesEnabled,this.options.capacity=Number.isInteger(n.capacity)?n.capacity:Number.MAX_SAFE_INTEGER,this.options.errorFilter=n.errorFilter||(e=>!1),this.semaphore=new o(this.options.capacity),this[b]=Number.isInteger(n.volumeThreshold)?n.volumeThreshold:0,this[v]=!0===n.allowWarmUp,this[h]=new i(this.options),this[s]=c,this[p]=null,this[l]=!1,this[y]=n.name||e.name||j(),this[m]=n.group||this[y],this[g]=!1!==n.enabled,this[v]){const e=setTimeout(e=>this[v]=!1,this.options.rollingCountTimeout);"function"==typeof e.unref&&e.unref()}this.action="function"!=typeof e?t=>Promise.resolve(e):e,n.maxFailures&&t.error(w);const r=e=>(t,n)=>this[h].increment(e,n);var u;this.on("success",r("successes")),this.on("failure",r("failures")),this.on("fallback",r("fallbacks")),this.on("timeout",r("timeouts")),this.on("fire",r("fires")),this.on("reject",r("rejects")),this.on("cacheHit",r("cacheHits")),this.on("cacheMiss",r("cacheMisses")),this.on("open",e=>this[h].open()),this.on("close",e=>this[h].close()),this.on("semaphoreLocked",r("semaphoreRejections")),this.on("open",(u=this,e=>{const t=setTimeout(()=>{u[s]=a,u[l]=!0,u.emit("halfOpen",u.options.resetTimeout)},u.options.resetTimeout);"function"==typeof t.unref&&t.unref()})),this.on("success",e=>this.close()),this.options.cache&&d.set(this,void 0)}close(){this[l]=!1,this[s]!==c&&(this[s]=c,this.emit("close"))}open(){this[l]=!1,this[s]!==u&&(this[s]=u,this.emit("open"))}shutdown(){this.disable(),this.removeAllListeners(),this.status.shutdown(),this[s]=f,this.emit("shutdown")}get isShutdown(){return this[s]===f}get name(){return this[y]}get group(){return this[m]}get pendingClose(){return this[l]}get closed(){return this[s]===c}get opened(){return this[s]===u}get halfOpen(){return this[s]===a}get status(){return this[h]}get stats(){return this[h].stats}get enabled(){return this[g]}get warmUp(){return this[v]}get volumeThreshold(){return this[b]}fallback(e){let t=e;return e instanceof E&&(t=function(){return e.fire.apply(e,arguments)}),this[p]=t,this}fire(){if(this.isShutdown){const e=new Error("The circuit has been shutdown.");return e.code="ESHUTDOWN",Promise.reject(e)}const e=Array.prototype.slice.call(arguments);if(this.emit("fire",e),void 0!==d.get(this))return this.emit("cacheHit"),d.get(this);if(this.options.cache&&this.emit("cacheMiss"),!this[g]){const t=this.action.apply(this.action,e);return"function"==typeof t.then?t:Promise.resolve(t)}if(!this.closed&&!this.pendingClose){const t=new Error("Breaker is open");return t.code="EOPENBREAKER",this.emit("reject",t),O(this,t,e)||Promise.reject(t)}let t;this[l]=!1;let n=!1;return new Promise((r,i)=>{const o=Date.now();if(this.semaphore.test()){this.options.timeout&&(t=setTimeout(()=>{n=!0;const s=new Error(`Timed out after ${this.options.timeout}ms`);s.code="ETIMEDOUT";const u=Date.now()-o;this.semaphore.release(),this.emit("timeout",s,u,e),r(x(s,this,t,e,u,r,i))},this.options.timeout));try{const s=this.action.apply(this.action,e),u="function"==typeof s.then?s:Promise.resolve(s);u.then(e=>{n||(clearTimeout(t),this.emit("success",e,Date.now()-o),this.semaphore.release(),r(e),this.options.cache&&d.set(this,u))}).catch(s=>{if(!n){this.semaphore.release();const n=Date.now()-o;x(s,this,t,e,n,r,i)}})}catch(n){this.semaphore.release();const s=Date.now()-o;x(n,this,t,e,s,r,i)}}else{const n=Date.now()-o,s=new Error("Semaphore locked");s.code="ESEMLOCKED",this.emit("semaphoreLocked",s,n),x(s,this,t,e,n,r,i)}})}clearCache(){d.set(this,void 0)}healthCheck(e,t){if(t=t||5e3,"function"!=typeof e)throw new TypeError("Health check function must be a function");if(isNaN(t))throw new TypeError("Health check interval must be a number");const n=t=>{e.apply(this).catch(e=>{this.emit("healthCheckFailed",e),this.open()})},r=setInterval(n,t);"function"==typeof r.unref&&r.unref(),n()}enable(){this[g]=!0}disable(){this[g]=!1}}function x(e,t,n,r,i,o,s){clearTimeout(n),function(e,t,n,r){if(e.options.errorFilter(t))return;if(e.emit("failure",t,r,n),e.warmUp)return;const i=e.stats;if(i.fires<e.volumeThreshold&&!e.halfOpen)return;(i.failures/i.fires*100>e.options.errorThresholdPercentage||i.failures>=e.options.maxFailures||e.halfOpen)&&e.open()}(t,e,r,i);const u=O(t,e,r);u?o(u):s(e)}function O(e,t,n){if(e[p]){const r=e[p].apply(e[p],[...n,t]);return e.emit("fallback",r,t),r instanceof Promise?r:Promise.resolve(r)}}const j=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});e.exports=E}).call(this,n(0))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,a=[],l=!1,f=-1;function p(){l&&c&&(l=!1,c.length?a=c.concat(a):f=-1,a.length&&h())}function h(){if(!l){var e=u(p);l=!0;for(var t=a.length;t;){for(c=a,a=[];++f<t;)c&&c[f].run();f=-1,t=a.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function y(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];a.push(new y(e,t)),1!==a.length||l||u(h)},y.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";(function(t){var r=n(10);
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.circuitBreaker=t():e.circuitBreaker=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}([function(e,t,n){(function(t){var r,i=n(2),o=n(9),s=n(11),u=Array.prototype.slice,c={};r=void 0!==t&&t.console?t.console:"undefined"!=typeof window&&window.console?window.console:{};for(var a=[[function(){},"log"],[function(){r.log.apply(r,arguments)},"info"],[function(){r.log.apply(r,arguments)},"warn"],[function(){r.warn.apply(r,arguments)},"error"],[function(e){c[e]=s()},"time"],[function(e){var t=c[e];if(!t)throw new Error("No such label: "+e);var n=s()-t;r.log(e+": "+n+"ms")},"timeEnd"],[function(){var e=new Error;e.name="Trace",e.message=i.format.apply(null,arguments),r.error(e.stack)},"trace"],[function(e){r.log(i.inspect(e)+"\n")},"dir"],[function(e){if(!e){var t=u.call(arguments,1);o.ok(!1,i.format.apply(null,t))}},"assert"]],l=0;l<a.length;l++){var f=a[l],p=f[0],h=f[1];r[h]||(r[h]=p)}e.exports=r}).call(this,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(e,r){var i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},o=/%[sdj%]/g;t.format=function(e){if(!v(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(c(arguments[n]));return t.join(" ")}n=1;for(var r=arguments,i=r.length,s=String(e).replace(o,(function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),u=r[n];n<i;u=r[++n])d(u)||!E(u)?s+=" "+u:s+=" "+c(u);return s},t.deprecate=function(n,i){if(void 0!==e&&!0===e.noDeprecation)return n;if(void 0===e)return function(){return t.deprecate(n,i).apply(this,arguments)};var o=!1;return function(){if(!o){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?r.trace(i):r.error(i),o=!0}return n.apply(this,arguments)}};var s,u={};function c(e,n){var r={seen:[],stylize:l};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(n)?r.showHidden=n:n&&t._extend(r,n),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),f(r,e,r.depth)}function a(e,t){var n=c.styles[t];return n?"["+c.colors[n][0]+"m"+e+"["+c.colors[n][1]+"m":e}function l(e,t){return e}function f(e,n,r){if(e.customInspect&&n&&j(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return v(i)||(i=f(e,i,r)),i}var o=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(g(t))return e.stylize(""+t,"number");if(m(t))return e.stylize(""+t,"boolean");if(d(t))return e.stylize("null","null")}(e,n);if(o)return o;var s=Object.keys(n),u=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),O(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return p(n);if(0===s.length){if(j(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(w(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(x(n))return e.stylize(Date.prototype.toString.call(n),"date");if(O(n))return p(n)}var a,l="",E=!1,T=["{","}"];(y(n)&&(E=!0,T=["[","]"]),j(n))&&(l=" [Function"+(n.name?": "+n.name:"")+"]");return w(n)&&(l=" "+RegExp.prototype.toString.call(n)),x(n)&&(l=" "+Date.prototype.toUTCString.call(n)),O(n)&&(l=" "+p(n)),0!==s.length||E&&0!=n.length?r<0?w(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),a=E?function(e,t,n,r,i){for(var o=[],s=0,u=t.length;s<u;++s)_(t,String(s))?o.push(h(e,t,n,r,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(h(e,t,n,r,i,!0))})),o}(e,n,r,u,s):s.map((function(t){return h(e,n,r,u,t,E)})),e.seen.pop(),function(e,t,n){if(e.reduce((function(e,t){return 0,t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(a,l,T)):T[0]+l+T[1]}function p(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i,o){var s,u,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?u=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(u=e.stylize("[Setter]","special")),_(r,i)||(s="["+i+"]"),u||(e.seen.indexOf(c.value)<0?(u=d(n)?f(e,c.value,null):f(e,c.value,n-1)).indexOf("\n")>-1&&(u=o?u.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+u.split("\n").map((function(e){return" "+e})).join("\n")):u=e.stylize("[Circular]","special")),b(s)){if(o&&i.match(/^\d+$/))return u;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+u}function y(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function d(e){return null===e}function g(e){return"number"==typeof e}function v(e){return"string"==typeof e}function b(e){return void 0===e}function w(e){return E(e)&&"[object RegExp]"===T(e)}function E(e){return"object"==typeof e&&null!==e}function x(e){return E(e)&&"[object Date]"===T(e)}function O(e){return E(e)&&("[object Error]"===T(e)||e instanceof Error)}function j(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function S(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(b(s)&&(s=Object({WEB:"web"}).NODE_DEBUG||""),n=n.toUpperCase(),!u[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var i=e.pid;u[n]=function(){var e=t.format.apply(t,arguments);r.error("%s %d: %s",n,i,e)}}else u[n]=function(){};return u[n]},t.inspect=c,c.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},c.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=y,t.isBoolean=m,t.isNull=d,t.isNullOrUndefined=function(e){return null==e},t.isNumber=g,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=w,t.isObject=E,t.isDate=x,t.isError=O,t.isFunction=j,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(7);var P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(){var e=new Date,t=[S(e.getHours()),S(e.getMinutes()),S(e.getSeconds())].join(":");return[e.getDate(),P[e.getMonth()],t].join(" ")}function _(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){r.log("%s - %s",k(),t.format.apply(t,arguments))},t.inherits=n(8),t._extend=function(e,t){if(!t||!E(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var L="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function A(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(L&&e[L]){var t;if("function"!=typeof(t=e[L]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,L,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,r){e?n(e):t(r)}));try{e.apply(this,i)}catch(e){n(e)}return r}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),L&&Object.defineProperty(t,L,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=L,t.callbackify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');function n(){for(var n=[],r=0;r<arguments.length;r++)n.push(arguments[r]);var i=n.pop();if("function"!=typeof i)throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};t.apply(this,n).then((function(t){e.nextTick(s,null,t)}),(function(t){e.nextTick(A,t,s)}))}return Object.setPrototypeOf(n,Object.getPrototypeOf(t)),Object.defineProperties(n,i(t)),n}}).call(this,n(6),n(0))},function(e,t,n){"use strict";(function(t){var n,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};n=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function a(e,n,r,i){var o,s,u,a;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",n,r.listener?r.listener:r),s=e._events),u=s[n]),void 0===u)u=s[n]=r,++e._eventsCount;else if("function"==typeof u?u=s[n]=i?[r,u]:[u,r]:i?u.unshift(r):u.push(r),(o=c(e))>0&&u.length>o&&!u.warned){u.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=n,l.count=u.length,a=l,t&&t.warn&&t.warn(a)}return e}function l(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,i(this.listener,this.target,e))}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):y(i,i.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function y(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,o=this._events;if(void 0!==o)r=r&&void 0===o.error;else if(!r)return!1;if(r){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var a=c.length,l=y(c,a);for(n=0;n<a;++n)i(l[n],this,t)}return!0},s.prototype.addListener=function(e,t){return a(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return a(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,f(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,f(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,o,s;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}}).call(this,n(0))},function(e,t,n){"use strict";e.exports=n(5)},function(e,t,n){"use strict";(function(t){const r=n(3),i=n(12),o=n(13),s=Symbol("state"),u=Symbol("open"),c=Symbol("closed"),a=Symbol("half-open"),l=Symbol("pending-close"),f=Symbol("shutdown"),p=Symbol("fallback"),h=Symbol("status"),y=Symbol("name"),m=Symbol("group"),d=new WeakMap,g=Symbol("Enabled"),v=Symbol("warming-up"),b=Symbol("volume-threshold"),w="options.maxFailures is deprecated. Please use options.errorThresholdPercentage";class E extends r{constructor(e,n={}){if(super(),this.options=n,this.options.timeout=n.timeout||1e4,this.options.resetTimeout=n.resetTimeout||3e4,this.options.errorThresholdPercentage=n.errorThresholdPercentage||50,this.options.rollingCountTimeout=n.rollingCountTimeout||1e4,this.options.rollingCountBuckets=n.rollingCountBuckets||10,this.options.rollingPercentilesEnabled=!1!==n.rollingPercentilesEnabled,this.options.capacity=Number.isInteger(n.capacity)?n.capacity:Number.MAX_SAFE_INTEGER,this.options.errorFilter=n.errorFilter||(e=>!1),this.semaphore=new o(this.options.capacity),this[b]=Number.isInteger(n.volumeThreshold)?n.volumeThreshold:0,this[v]=!0===n.allowWarmUp,this[h]=new i(this.options),this[s]=c,this[p]=null,this[l]=!1,this[y]=n.name||e.name||j(),this[m]=n.group||this[y],this[g]=!1!==n.enabled,this[v]){const e=setTimeout(e=>this[v]=!1,this.options.rollingCountTimeout);"function"==typeof e.unref&&e.unref()}this.action="function"!=typeof e?t=>Promise.resolve(e):e,n.maxFailures&&t.error(w);const r=e=>(t,n)=>this[h].increment(e,n);var u;this.on("success",r("successes")),this.on("failure",r("failures")),this.on("fallback",r("fallbacks")),this.on("timeout",r("timeouts")),this.on("fire",r("fires")),this.on("reject",r("rejects")),this.on("cacheHit",r("cacheHits")),this.on("cacheMiss",r("cacheMisses")),this.on("open",e=>this[h].open()),this.on("close",e=>this[h].close()),this.on("semaphoreLocked",r("semaphoreRejections")),this.on("open",(u=this,e=>{const t=setTimeout(()=>{u[s]=a,u[l]=!0,u.emit("halfOpen",u.options.resetTimeout)},u.options.resetTimeout);"function"==typeof t.unref&&t.unref()})),this.on("success",e=>this.close()),this.options.cache&&d.set(this,void 0)}close(){this[l]=!1,this[s]!==c&&(this[s]=c,this.emit("close"))}open(){this[l]=!1,this[s]!==u&&(this[s]=u,this.emit("open"))}shutdown(){this.disable(),this.removeAllListeners(),this.status.shutdown(),this[s]=f,this.emit("shutdown")}get isShutdown(){return this[s]===f}get name(){return this[y]}get group(){return this[m]}get pendingClose(){return this[l]}get closed(){return this[s]===c}get opened(){return this[s]===u}get halfOpen(){return this[s]===a}get status(){return this[h]}get stats(){return this[h].stats}get enabled(){return this[g]}get warmUp(){return this[v]}get volumeThreshold(){return this[b]}fallback(e){let t=e;return e instanceof E&&(t=function(){return e.fire.apply(e,arguments)}),this[p]=t,this}fire(...e){return this.call.apply(this,[this.action].concat(e))}call(e,...t){if(this.isShutdown){const e=new Error("The circuit has been shutdown.");return e.code="ESHUTDOWN",Promise.reject(e)}const n=Array.prototype.slice.call(t);if(this.emit("fire",n),void 0!==d.get(this))return this.emit("cacheHit"),d.get(this);if(this.options.cache&&this.emit("cacheMiss"),!this[g]){const t=this.action.apply(e,n);return"function"==typeof t.then?t:Promise.resolve(t)}if(!this.closed&&!this.pendingClose){const e=new Error("Breaker is open");return e.code="EOPENBREAKER",this.emit("reject",e),O(this,e,n)||Promise.reject(e)}let r;this[l]=!1;let i=!1;return new Promise((t,o)=>{const s=Date.now();if(this.semaphore.test()){this.options.timeout&&(r=setTimeout(()=>{i=!0;const e=new Error(`Timed out after ${this.options.timeout}ms`);e.code="ETIMEDOUT";const u=Date.now()-s;this.semaphore.release(),this.emit("timeout",e,u,n),t(x(e,this,r,n,u,t,o))},this.options.timeout));try{const u=this.action.apply(e,n),c="function"==typeof u.then?u:Promise.resolve(u);c.then(e=>{i||(clearTimeout(r),this.emit("success",e,Date.now()-s),this.semaphore.release(),t(e),this.options.cache&&d.set(this,c))}).catch(e=>{if(!i){this.semaphore.release();const i=Date.now()-s;x(e,this,r,n,i,t,o)}})}catch(e){this.semaphore.release();const i=Date.now()-s;x(e,this,r,n,i,t,o)}}else{const e=Date.now()-s,i=new Error("Semaphore locked");i.code="ESEMLOCKED",this.emit("semaphoreLocked",i,e),x(i,this,r,n,e,t,o)}})}clearCache(){d.set(this,void 0)}healthCheck(e,t){if(t=t||5e3,"function"!=typeof e)throw new TypeError("Health check function must be a function");if(isNaN(t))throw new TypeError("Health check interval must be a number");const n=t=>{e.apply(this).catch(e=>{this.emit("healthCheckFailed",e),this.open()})},r=setInterval(n,t);"function"==typeof r.unref&&r.unref(),n()}enable(){this[g]=!0}disable(){this[g]=!1}}function x(e,t,n,r,i,o,s){clearTimeout(n),function(e,t,n,r){if(e.options.errorFilter(t))return;if(e.emit("failure",t,r,n),e.warmUp)return;const i=e.stats;if(i.fires<e.volumeThreshold&&!e.halfOpen)return;(i.failures/i.fires*100>e.options.errorThresholdPercentage||i.failures>=e.options.maxFailures||e.halfOpen)&&e.open()}(t,e,r,i);const u=O(t,e,r);u?o(u):s(e)}function O(e,t,n){if(e[p]){const r=e[p].apply(e[p],[...n,t]);return e.emit("fallback",r,t),r instanceof Promise?r:Promise.resolve(r)}}const j=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});e.exports=E}).call(this,n(0))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,a=[],l=!1,f=-1;function p(){l&&c&&(l=!1,c.length?a=c.concat(a):f=-1,a.length&&h())}function h(){if(!l){var e=u(p);l=!0;for(var t=a.length;t;){for(c=a,a=[];++f<t;)c&&c[f].run();f=-1,t=a.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function y(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];a.push(new y(e,t)),1!==a.length||l||u(h)},y.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";(function(t){var r=n(10);
/*!

@@ -7,3 +7,3 @@ * The buffer module from node.js, for the browser.

* @license MIT
*/function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0}function o(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var s=n(2),u=Object.prototype.hasOwnProperty,c=Array.prototype.slice,a="foo"===function(){}.name;function l(e){return Object.prototype.toString.call(e)}function f(e){return!o(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var p=e.exports=v,h=/\s*function\s+([^\(\s]*)\s*/;function y(e){if(s.isFunction(e)){if(a)return e.name;var t=e.toString().match(h);return t&&t[1]}}function m(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function d(e){if(a||!s.isFunction(e))return s.inspect(e);var t=y(e);return"[Function"+(t?": "+t:"")+"]"}function g(e,t,n,r,i){throw new p.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function v(e,t){e||g(e,!0,t,"==",p.ok)}function b(e,t,n,r){if(e===t)return!0;if(o(e)&&o(t))return 0===i(e,t);if(s.isDate(e)&&s.isDate(t))return e.getTime()===t.getTime();if(s.isRegExp(e)&&s.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&l(e)===l(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===i(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(o(e)!==o(t))return!1;var u=(r=r||{actual:[],expected:[]}).actual.indexOf(e);return-1!==u&&u===r.expected.indexOf(t)||(r.actual.push(e),r.expected.push(t),function(e,t,n,r){if(null==e||null==t)return!1;if(s.isPrimitive(e)||s.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=w(e),o=w(t);if(i&&!o||!i&&o)return!1;if(i)return e=c.call(e),t=c.call(t),b(e,t,n);var u,a,l=O(e),f=O(t);if(l.length!==f.length)return!1;for(l.sort(),f.sort(),a=l.length-1;a>=0;a--)if(l[a]!==f[a])return!1;for(a=l.length-1;a>=0;a--)if(u=l[a],!b(e[u],t[u],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function x(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&g(i,n,"Missing expected exception"+r);var o="string"==typeof r,u=!e&&i&&!n;if((!e&&s.isError(i)&&o&&E(i,n)||u)&&g(i,n,"Got unwanted exception"+r),e&&i&&n&&!E(i,n)||!e&&i)throw i}p.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=m(d((t=this).actual),128)+" "+t.operator+" "+m(d(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=y(n),s=i.indexOf("\n"+o);if(s>=0){var u=i.indexOf("\n",s+1);i=i.substring(u+1)}this.stack=i}}},s.inherits(p.AssertionError,Error),p.fail=g,p.ok=v,p.equal=function(e,t,n){e!=t&&g(e,t,n,"==",p.equal)},p.notEqual=function(e,t,n){e==t&&g(e,t,n,"!=",p.notEqual)},p.deepEqual=function(e,t,n){b(e,t,!1)||g(e,t,n,"deepEqual",p.deepEqual)},p.deepStrictEqual=function(e,t,n){b(e,t,!0)||g(e,t,n,"deepStrictEqual",p.deepStrictEqual)},p.notDeepEqual=function(e,t,n){b(e,t,!1)&&g(e,t,n,"notDeepEqual",p.notDeepEqual)},p.notDeepStrictEqual=function e(t,n,r){b(t,n,!0)&&g(t,n,r,"notDeepStrictEqual",e)},p.strictEqual=function(e,t,n){e!==t&&g(e,t,n,"===",p.strictEqual)},p.notStrictEqual=function(e,t,n){e===t&&g(e,t,n,"!==",p.notStrictEqual)},p.throws=function(e,t,n){x(!0,e,t,n)},p.doesNotThrow=function(e,t,n){x(!1,e,t,n)},p.ifError=function(e){if(e)throw e},p.strict=r(function e(t,n){t||g(t,!0,n,"==",e)},p,{equal:p.strictEqual,deepEqual:p.deepStrictEqual,notEqual:p.notStrictEqual,notDeepEqual:p.notDeepStrictEqual}),p.strict.strict=p.strict;var O=Object.keys||function(e){var t=[];for(var n in e)u.call(e,n)&&t.push(n);return t}}).call(this,n(1))},function(e,t,n){"use strict";
*/function i(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0}function o(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var s=n(2),u=Object.prototype.hasOwnProperty,c=Array.prototype.slice,a="foo"===function(){}.name;function l(e){return Object.prototype.toString.call(e)}function f(e){return!o(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var p=e.exports=v,h=/\s*function\s+([^\(\s]*)\s*/;function y(e){if(s.isFunction(e)){if(a)return e.name;var t=e.toString().match(h);return t&&t[1]}}function m(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function d(e){if(a||!s.isFunction(e))return s.inspect(e);var t=y(e);return"[Function"+(t?": "+t:"")+"]"}function g(e,t,n,r,i){throw new p.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function v(e,t){e||g(e,!0,t,"==",p.ok)}function b(e,t,n,r){if(e===t)return!0;if(o(e)&&o(t))return 0===i(e,t);if(s.isDate(e)&&s.isDate(t))return e.getTime()===t.getTime();if(s.isRegExp(e)&&s.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(f(e)&&f(t)&&l(e)===l(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===i(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(o(e)!==o(t))return!1;var u=(r=r||{actual:[],expected:[]}).actual.indexOf(e);return-1!==u&&u===r.expected.indexOf(t)||(r.actual.push(e),r.expected.push(t),function(e,t,n,r){if(null==e||null==t)return!1;if(s.isPrimitive(e)||s.isPrimitive(t))return e===t;if(n&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=w(e),o=w(t);if(i&&!o||!i&&o)return!1;if(i)return e=c.call(e),t=c.call(t),b(e,t,n);var u,a,l=O(e),f=O(t);if(l.length!==f.length)return!1;for(l.sort(),f.sort(),a=l.length-1;a>=0;a--)if(l[a]!==f[a])return!1;for(a=l.length-1;a>=0;a--)if(u=l[a],!b(e[u],t[u],n,r))return!1;return!0}(e,t,n,r))}return n?e===t:e==t}function w(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function E(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function x(e,t,n,r){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!i&&g(i,n,"Missing expected exception"+r);var o="string"==typeof r,u=!e&&i&&!n;if((!e&&s.isError(i)&&o&&E(i,n)||u)&&g(i,n,"Got unwanted exception"+r),e&&i&&n&&!E(i,n)||!e&&i)throw i}p.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=m(d((t=this).actual),128)+" "+t.operator+" "+m(d(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var i=r.stack,o=y(n),s=i.indexOf("\n"+o);if(s>=0){var u=i.indexOf("\n",s+1);i=i.substring(u+1)}this.stack=i}}},s.inherits(p.AssertionError,Error),p.fail=g,p.ok=v,p.equal=function(e,t,n){e!=t&&g(e,t,n,"==",p.equal)},p.notEqual=function(e,t,n){e==t&&g(e,t,n,"!=",p.notEqual)},p.deepEqual=function(e,t,n){b(e,t,!1)||g(e,t,n,"deepEqual",p.deepEqual)},p.deepStrictEqual=function(e,t,n){b(e,t,!0)||g(e,t,n,"deepStrictEqual",p.deepStrictEqual)},p.notDeepEqual=function(e,t,n){b(e,t,!1)&&g(e,t,n,"notDeepEqual",p.notDeepEqual)},p.notDeepStrictEqual=function e(t,n,r){b(t,n,!0)&&g(t,n,r,"notDeepStrictEqual",e)},p.strictEqual=function(e,t,n){e!==t&&g(e,t,n,"===",p.strictEqual)},p.notStrictEqual=function(e,t,n){e===t&&g(e,t,n,"!==",p.notStrictEqual)},p.throws=function(e,t,n){x(!0,e,t,n)},p.doesNotThrow=function(e,t,n){x(!1,e,t,n)},p.ifError=function(e){if(e)throw e},p.strict=r((function e(t,n){t||g(t,!0,n,"==",e)}),p,{equal:p.strictEqual,deepEqual:p.deepStrictEqual,notEqual:p.notStrictEqual,notDeepEqual:p.notDeepStrictEqual}),p.strict.strict=p.strict;var O=Object.keys||function(e){var t=[];for(var n in e)u.call(e,n)&&t.push(n);return t}}).call(this,n(1))},function(e,t,n){"use strict";
/*

@@ -13,3 +13,3 @@ object-assign

@license MIT
*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,c=s(e),a=1;a<arguments.length;a++){for(var l in n=Object(arguments[a]))i.call(n,l)&&(c[l]=n[l]);if(r){u=r(n);for(var f=0;f<u.length;f++)o.call(n,u[f])&&(c[u[f]]=n[u[f]])}}return c}},function(e,t){e.exports=function(){return(new Date).getTime()}},function(e,t,n){"use strict";const r=Symbol("window"),i=Symbol("buckets"),o=Symbol("timeout"),s=Symbol("percentiles"),u=n(3).EventEmitter;const c=e=>t=>{e.pop(),e.unshift(a())},a=e=>({failures:0,fallbacks:0,successes:0,rejects:0,fires:0,timeouts:0,cacheHits:0,cacheMisses:0,semaphoreRejections:0,percentiles:{},latencyTimes:[]});e.exports=class extends u{constructor(e){super(),this[i]=e.rollingCountBuckets,this[o]=e.rollingCountTimeout,this[r]=new Array(this[i]),this[s]=[0,.25,.5,.75,.9,.95,.99,.995,1],this.rollingPercentilesEnabled=e.rollingPercentilesEnabled;for(let e=0;e<this[i];e++)this[r][e]=a();const t=Math.floor(this[o]/this[i]);let n=setInterval(c(this[r]),t);"function"==typeof n.unref&&n.unref(),"function"==typeof(n=setInterval(e=>this.emit("snapshot",this.stats),t)).unref&&n.unref()}get stats(){const e=this[r].reduce((e,t)=>t?(Object.keys(e).forEach(n=>{"latencyTimes"!==n&&"percentiles"!==n&&(e[n]+=t[n]||0)}),this.rollingPercentilesEnabled&&e.latencyTimes.push.apply(e.latencyTimes,t.latencyTimes||[]),e):e,a());return this.rollingPercentilesEnabled?(e.latencyTimes.sort((e,t)=>e-t),e.latencyTimes.length?e.latencyMean=e.latencyTimes.reduce((e,t)=>e+t,0)/e.latencyTimes.length:e.latencyMean=0,this[s].forEach(t=>{e.percentiles[t]=function(e,t){if(0===e)return t[0]||0;const n=Math.ceil(e*t.length);return t[n-1]||0}(t,e.latencyTimes)})):(e.latencyMean=-1,this[s].forEach(t=>{e.percentiles[t]=-1})),e}get window(){return this[r].slice()}increment(e,t){this[r][0][e]++,"successes"!==e&&"failures"!==e&&"timeouts"!==e||this[r][0].latencyTimes.push(t||0)}open(){this[r][0].isCircuitBreakerOpen=!0}close(){this[r][0].isCircuitBreakerOpen=!1}shutdown(){this.removeAllListeners()}}},function(e,t,n){"use strict";e.exports=function(e){const t=[];let n=e;const r={take:i,release:o,test:function(){return!(n<1)&&i()&&!0}};return Object.defineProperty(r,"count",{get:e=>n,enumerable:!0}),r;function i(e){return n>0?(--n,Promise.resolve(o)):new Promise((r,i)=>{t.push(e=>{--n,r(o)}),e&&setTimeout(n=>{t.shift();const r=new Error(`Timed out after ${e}ms`);r.code="ETIMEDOUT",i(r)},e)})}function o(){n++,t.length>0&&t.shift()()}}}])});
*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,c=s(e),a=1;a<arguments.length;a++){for(var l in n=Object(arguments[a]))i.call(n,l)&&(c[l]=n[l]);if(r){u=r(n);for(var f=0;f<u.length;f++)o.call(n,u[f])&&(c[u[f]]=n[u[f]])}}return c}},function(e,t){e.exports=function(){return(new Date).getTime()}},function(e,t,n){"use strict";const r=Symbol("window"),i=Symbol("buckets"),o=Symbol("timeout"),s=Symbol("percentiles"),u=n(3).EventEmitter;const c=e=>t=>{e.pop(),e.unshift(a())},a=e=>({failures:0,fallbacks:0,successes:0,rejects:0,fires:0,timeouts:0,cacheHits:0,cacheMisses:0,semaphoreRejections:0,percentiles:{},latencyTimes:[]});e.exports=class extends u{constructor(e){super(),this[i]=e.rollingCountBuckets,this[o]=e.rollingCountTimeout,this[r]=new Array(this[i]),this[s]=[0,.25,.5,.75,.9,.95,.99,.995,1],this.rollingPercentilesEnabled=e.rollingPercentilesEnabled;for(let e=0;e<this[i];e++)this[r][e]=a();const t=Math.floor(this[o]/this[i]);let n=setInterval(c(this[r]),t);"function"==typeof n.unref&&n.unref(),"function"==typeof(n=setInterval(e=>this.emit("snapshot",this.stats),t)).unref&&n.unref()}get stats(){const e=this[r].reduce((e,t)=>t?(Object.keys(e).forEach(n=>{"latencyTimes"!==n&&"percentiles"!==n&&(e[n]+=t[n]||0)}),this.rollingPercentilesEnabled&&e.latencyTimes.push.apply(e.latencyTimes,t.latencyTimes||[]),e):e,a());return this.rollingPercentilesEnabled?(e.latencyTimes.sort((e,t)=>e-t),e.latencyTimes.length?e.latencyMean=e.latencyTimes.reduce((e,t)=>e+t,0)/e.latencyTimes.length:e.latencyMean=0,this[s].forEach(t=>{e.percentiles[t]=function(e,t){if(0===e)return t[0]||0;const n=Math.ceil(e*t.length);return t[n-1]||0}(t,e.latencyTimes)})):(e.latencyMean=-1,this[s].forEach(t=>{e.percentiles[t]=-1})),e}get window(){return this[r].slice()}increment(e,t){this[r][0][e]++,"successes"!==e&&"failures"!==e&&"timeouts"!==e||this[r][0].latencyTimes.push(t||0)}open(){this[r][0].isCircuitBreakerOpen=!0}close(){this[r][0].isCircuitBreakerOpen=!1}shutdown(){this.removeAllListeners()}}},function(e,t,n){"use strict";e.exports=function(e){const t=[];let n=e;const r={take:i,release:o,test:function(){return!(n<1)&&(i()&&!0)}};return Object.defineProperty(r,"count",{get:e=>n,enumerable:!0}),r;function i(e){return n>0?(--n,Promise.resolve(o)):new Promise((r,i)=>{t.push(e=>{--n,r(o)}),e&&setTimeout(n=>{t.shift();const r=new Error(`Timed out after ${e}ms`);r.code="ETIMEDOUT",i(r)},e)})}function o(){n++,t.length>0&&t.shift()()}}}])}));
//# sourceMappingURL=opossum.min.map

@@ -77,3 +77,9 @@ 'use strict';

* trip the circuit, but still want to handle it as a failure case.
* @param {boolean} options.cache whether the return value of the first
* successful execution of the circuit's function will be cached. Once a value
* has been cached that value will be returned for every subsequent execution:
* the cache can be cleared using `clearCache`. (The metrics `cacheHit` and
* `cacheMiss` reflect cache activity.) Default: false
*
*
* @fires CircuitBreaker#halfOpen

@@ -357,2 +363,5 @@ * @fires CircuitBreaker#close

*
* Any parameters passed to this function will be proxied to the circuit
* function.
*
* @return {Promise<any>} promise resolves with the circuit function's return

@@ -369,3 +378,30 @@ * value on success or is rejected on failure of the action.

*/
fire () {
fire (...args) {
return this.call.apply(this, [this.action].concat(args));
}
/**
* Execute the action for this circuit using `context` as `this`.
* If the action fails or times out, the
* returned promise will be rejected. If the action succeeds, the promise will
* resolve with the resolved value from action. If a fallback function was
* provided, it will be invoked in the event of any failure or timeout.
*
* Any parameters in addition to `context will be passed to the
* circuit function.
*
* @param {any} context the `this` context used for function execution
*
* @return {Promise<any>} promise resolves with the circuit function's return
* value on success or is rejected on failure of the action.
*
* @fires CircuitBreaker#failure
* @fires CircuitBreaker#fallback
* @fires CircuitBreaker#fire
* @fires CircuitBreaker#reject
* @fires CircuitBreaker#success
* @fires CircuitBreaker#timeout
* @fires CircuitBreaker#semaphoreLocked
*/
call (context, ...rest) {
if (this.isShutdown) {

@@ -376,3 +412,3 @@ const err = new Error('The circuit has been shutdown.');

}
const args = Array.prototype.slice.call(arguments);
const args = Array.prototype.slice.call(rest);

@@ -404,3 +440,3 @@ /**

if (!this[ENABLED]) {
const result = this.action.apply(this.action, args);
const result = this.action.apply(context, args);
return (typeof result.then === 'function')

@@ -454,3 +490,3 @@ ? result

try {
const result = this.action.apply(this.action, args);
const result = this.action.apply(context, args);
const promise = (typeof result.then === 'function')

@@ -457,0 +493,0 @@ ? result

{
"name": "opossum",
"version": "4.0.0",
"version": "4.1.0",
"author": "Red Hat, Inc.",

@@ -63,3 +63,3 @@ "license": "Apache-2.0",

"tape": "~4.11.0",
"webpack": "~4.39.0",
"webpack": "~4.41.0",
"webpack-cli": "~3.3.0"

@@ -66,0 +66,0 @@ },

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc