diff --git a/index.node.js b/index.node.js index 9b9e938..d3cd72a 100644 --- a/index.node.js +++ b/index.node.js @@ -1 +1 @@ -!function(t,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var e=r();for(var n in e)("object"==typeof exports?exports:t)[n]=e[n]}}(global,(function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=2)}([function(t,r,e){(function(t){var e=/^\[object .+?Constructor\]$/,n=/^(?:0|[1-9]\d*)$/,o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1;var i="object"==typeof global&&global&&global.Object===Object&&global,u="object"==typeof self&&self&&self.Object===Object&&self,c=i||u||Function("return this")(),a=r&&!r.nodeType&&r,f=a&&"object"==typeof t&&t&&!t.nodeType&&t,l=f&&f.exports===a,s=l&&i.process,p=function(){try{var t=f&&f.require&&f.require("util").types;return t||s&&s.binding&&s.binding("util")}catch(t){}}(),v=p&&p.isTypedArray;function h(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var y,d,_,b=Array.prototype,g=Function.prototype,j=Object.prototype,O=c["__core-js_shared__"],m=g.toString,A=j.hasOwnProperty,w=(y=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+y:"",S=j.toString,z=m.call(Object),P=RegExp("^"+m.call(A).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),x=l?c.Buffer:void 0,E=c.Symbol,k=c.Uint8Array,M=x?x.allocUnsafe:void 0,F=(d=Object.getPrototypeOf,_=Object,function(t){return d(_(t))}),T=Object.create,U=j.propertyIsEnumerable,$=b.splice,I=E?E.toStringTag:void 0,B=function(){try{var t=at(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),L=x?x.isBuffer:void 0,D=Math.max,N=Date.now,R=at(c,"Map"),q=at(Object,"create"),C=function(){function t(){}return function(r){if(!jt(r))return{};if(T)return T(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function G(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},J.prototype.set=function(t,r){var e=this.__data__,n=X(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},K.prototype.clear=function(){this.size=0,this.__data__={hash:new G,map:new(R||J),string:new G}},K.prototype.delete=function(t){var r=ct(this,t).delete(t);return this.size-=r?1:0,r},K.prototype.get=function(t){return ct(this,t).get(t)},K.prototype.has=function(t){return ct(this,t).has(t)},K.prototype.set=function(t,r){var e=ct(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},V.prototype.clear=function(){this.__data__=new J,this.size=0},V.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},V.prototype.get=function(t){return this.__data__.get(t)},V.prototype.has=function(t){return this.__data__.has(t)},V.prototype.set=function(t,r){var e=this.__data__;if(e instanceof J){var n=e.__data__;if(!R||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new K(n)}return e.set(t,r),this.size=e.size,this};var Z,tt=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[Z?u:++n];if(!1===r(o[c],c,o))break}return t};function rt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":I&&I in Object(t)?function(t){var r=A.call(t,I),e=t[I];try{t[I]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[I]=e:delete t[I]);return o}(t):function(t){return S.call(t)}(t)}function et(t){return Ot(t)&&"[object Arguments]"==rt(t)}function nt(t){return!(!jt(t)||function(t){return!!w&&w in t}(t))&&(bt(t)?P:e).test(function(t){if(null!=t){try{return m.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function ot(t){if(!jt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=lt(t),e=[];for(var n in t)("constructor"!=n||!r&&A.call(t,n))&&e.push(n);return e}function it(t,r,e,n,o){t!==r&&tt(r,(function(i,u){if(o||(o=new V),jt(i))!function(t,r,e,n,o,i,u){var c=st(t,e),a=st(r,e),f=u.get(a);if(f)return void H(t,e,f);var l=i?i(c,a,e+"",t,r,u):void 0,s=void 0===l;if(s){var p=yt(a),v=!p&&_t(a),h=!p&&!v&&mt(a);l=a,p||v||h?yt(c)?l=c:Ot(g=c)&&dt(g)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(B?function(t,r){return B(t,"toString",{configurable:!0,enumerable:!1,value:(e=r,function(){return e}),writable:!0});var e}:zt);function vt(t,r){return t===r||t!=t&&r!=r}var ht=et(function(){return arguments}())?et:function(t){return Ot(t)&&A.call(t,"callee")&&!U.call(t,"callee")},yt=Array.isArray;function dt(t){return null!=t&>(t.length)&&!bt(t)}var _t=L||function(){return!1};function bt(t){if(!jt(t))return!1;var r=rt(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function gt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function jt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ot(t){return null!=t&&"object"==typeof t}var mt=v?function(t){return function(r){return t(r)}}(v):function(t){return Ot(t)&>(t.length)&&!!o[rt(t)]};function At(t){return dt(t)?W(t,!0):ot(t)}var wt,St=(wt=function(t,r,e){it(t,r,e)},ut((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=wt.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!jt(e))return!1;var n=typeof r;return!!("number"==n?dt(e)&&ft(r,e.length):"string"==n&&r in e)&&vt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++e-1},J.prototype.set=function(t,r){var e=this.__data__,n=X(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},K.prototype.clear=function(){this.size=0,this.__data__={hash:new G,map:new(R||J),string:new G}},K.prototype.delete=function(t){var r=ct(this,t).delete(t);return this.size-=r?1:0,r},K.prototype.get=function(t){return ct(this,t).get(t)},K.prototype.has=function(t){return ct(this,t).has(t)},K.prototype.set=function(t,r){var e=ct(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},V.prototype.clear=function(){this.__data__=new J,this.size=0},V.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},V.prototype.get=function(t){return this.__data__.get(t)},V.prototype.has=function(t){return this.__data__.has(t)},V.prototype.set=function(t,r){var e=this.__data__;if(e instanceof J){var n=e.__data__;if(!R||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new K(n)}return e.set(t,r),this.size=e.size,this};var Z,tt=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[Z?u:++n];if(!1===r(o[c],c,o))break}return t};function rt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":I&&I in Object(t)?function(t){var r=A.call(t,I),e=t[I];try{t[I]=void 0;var n=!0}catch(t){}var o=z.call(t);n&&(r?t[I]=e:delete t[I]);return o}(t):function(t){return z.call(t)}(t)}function et(t){return Ot(t)&&"[object Arguments]"==rt(t)}function nt(t){return!(!jt(t)||function(t){return!!w&&w in t}(t))&&(bt(t)?E:e).test(function(t){if(null!=t){try{return m.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function ot(t){if(!jt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=lt(t),e=[];for(var n in t)("constructor"!=n||!r&&A.call(t,n))&&e.push(n);return e}function it(t,r,e,n,o){t!==r&&tt(r,(function(i,u){if(o||(o=new V),jt(i))!function(t,r,e,n,o,i,u){var c=st(t,e),a=st(r,e),f=u.get(a);if(f)return void H(t,e,f);var l=i?i(c,a,e+"",t,r,u):void 0,s=void 0===l;if(s){var p=_t(a),v=!p&&yt(a),h=!p&&!v&&mt(a);l=a,p||v||h?_t(c)?l=c:Ot(g=c)&&dt(g)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(B?function(t,r){return B(t,"toString",{configurable:!0,enumerable:!1,value:(e=r,function(){return e}),writable:!0});var e}:St);function vt(t,r){return t===r||t!=t&&r!=r}var ht=et(function(){return arguments}())?et:function(t){return Ot(t)&&A.call(t,"callee")&&!U.call(t,"callee")},_t=Array.isArray;function dt(t){return null!=t&>(t.length)&&!bt(t)}var yt=L||function(){return!1};function bt(t){if(!jt(t))return!1;var r=rt(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function gt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function jt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ot(t){return null!=t&&"object"==typeof t}var mt=v?function(t){return function(r){return t(r)}}(v):function(t){return Ot(t)&>(t.length)&&!!o[rt(t)]};function At(t){return dt(t)?W(t,!0):ot(t)}var wt,zt=(wt=function(t,r,e){it(t,r,e)},ut((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=wt.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!jt(e))return!1;var n=typeof r;return!!("number"==n?dt(e)&&ft(r,e.length):"string"==n&&r in e)&&vt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++e-1},K.prototype.set=function(t,r){var e=this.__data__,n=Y(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},V.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(q||K),string:new J}},V.prototype.delete=function(t){var r=at(this,t).delete(t);return this.size-=r?1:0,r},V.prototype.get=function(t){return at(this,t).get(t)},V.prototype.has=function(t){return at(this,t).has(t)},V.prototype.set=function(t,r){var e=at(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},W.prototype.clear=function(){this.__data__=new K,this.size=0},W.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},W.prototype.get=function(t){return this.__data__.get(t)},W.prototype.has=function(t){return this.__data__.has(t)},W.prototype.set=function(t,r){var e=this.__data__;if(e instanceof K){var n=e.__data__;if(!q||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new V(n)}return e.set(t,r),this.size=e.size,this};var tt,rt=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[tt?u:++n];if(!1===r(o[c],c,o))break}return t};function et(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":B&&B in Object(t)?function(t){var r=A.call(t,B),e=t[B];try{t[B]=void 0;var n=!0}catch(t){}var o=z.call(t);n&&(r?t[B]=e:delete t[B]);return o}(t):function(t){return z.call(t)}(t)}function nt(t){return mt(t)&&"[object Arguments]"==et(t)}function ot(t){return!(!Ot(t)||function(t){return!!S&&S in t}(t))&&(gt(t)?P:n).test(function(t){if(null!=t){try{return w.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function it(t){if(!Ot(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=st(t),e=[];for(var n in t)("constructor"!=n||!r&&A.call(t,n))&&e.push(n);return e}function ut(t,r,e,n,o){t!==r&&rt(r,(function(i,u){if(o||(o=new W),Ot(i))!function(t,r,e,n,o,i,u){var c=pt(t,e),a=pt(r,e),f=u.get(a);if(f)return void Q(t,e,f);var l=i?i(c,a,e+"",t,r,u):void 0,s=void 0===l;if(s){var p=dt(a),h=!p&&bt(a),v=!p&&!h&&wt(a);l=a,p||h||v?dt(c)?l=c:mt(g=c)&&_t(g)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(L?function(t,r){return L(t,"toString",{configurable:!0,enumerable:!1,value:(e=r,function(){return e}),writable:!0});var e}:xt);function vt(t,r){return t===r||t!=t&&r!=r}var yt=nt(function(){return arguments}())?nt:function(t){return mt(t)&&A.call(t,"callee")&&!$.call(t,"callee")},dt=Array.isArray;function _t(t){return null!=t&&jt(t.length)&&!gt(t)}var bt=D||function(){return!1};function gt(t){if(!Ot(t))return!1;var r=et(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function jt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ot(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function mt(t){return null!=t&&"object"==typeof t}var wt=v?function(t){return function(r){return t(r)}}(v):function(t){return mt(t)&&jt(t.length)&&!!i[et(t)]};function At(t){return _t(t)?H(t,!0):it(t)}var St,zt=(St=function(t,r,e){ut(t,r,e)},ct((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!Ot(e))return!1;var n=typeof r;return!!("number"==n?_t(e)&<(r,e.length):"string"==n&&r in e)&&vt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++e-1},K.prototype.set=function(t,r){var e=this.__data__,n=Y(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},V.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(q||K),string:new J}},V.prototype.delete=function(t){var r=at(this,t).delete(t);return this.size-=r?1:0,r},V.prototype.get=function(t){return at(this,t).get(t)},V.prototype.has=function(t){return at(this,t).has(t)},V.prototype.set=function(t,r){var e=at(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},W.prototype.clear=function(){this.__data__=new K,this.size=0},W.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},W.prototype.get=function(t){return this.__data__.get(t)},W.prototype.has=function(t){return this.__data__.has(t)},W.prototype.set=function(t,r){var e=this.__data__;if(e instanceof K){var n=e.__data__;if(!q||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new V(n)}return e.set(t,r),this.size=e.size,this};var tt,rt=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[tt?u:++n];if(!1===r(o[c],c,o))break}return t};function et(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":B&&B in Object(t)?function(t){var r=A.call(t,B),e=t[B];try{t[B]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[B]=e:delete t[B]);return o}(t):function(t){return S.call(t)}(t)}function nt(t){return mt(t)&&"[object Arguments]"==et(t)}function ot(t){return!(!Ot(t)||function(t){return!!z&&z in t}(t))&&(gt(t)?E:n).test(function(t){if(null!=t){try{return w.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function it(t){if(!Ot(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=st(t),e=[];for(var n in t)("constructor"!=n||!r&&A.call(t,n))&&e.push(n);return e}function ut(t,r,e,n,o){t!==r&&rt(r,(function(i,u){if(o||(o=new W),Ot(i))!function(t,r,e,n,o,i,u){var c=pt(t,e),a=pt(r,e),f=u.get(a);if(f)return void Q(t,e,f);var l=i?i(c,a,e+"",t,r,u):void 0,s=void 0===l;if(s){var p=_t(a),h=!p&&bt(a),v=!p&&!h&&wt(a);l=a,p||h||v?_t(c)?l=c:mt(g=c)&&yt(g)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(L?function(t,r){return L(t,"toString",{configurable:!0,enumerable:!1,value:(e=r,function(){return e}),writable:!0});var e}:xt);function vt(t,r){return t===r||t!=t&&r!=r}var dt=nt(function(){return arguments}())?nt:function(t){return mt(t)&&A.call(t,"callee")&&!$.call(t,"callee")},_t=Array.isArray;function yt(t){return null!=t&&jt(t.length)&&!gt(t)}var bt=D||function(){return!1};function gt(t){if(!Ot(t))return!1;var r=et(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function jt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}function Ot(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function mt(t){return null!=t&&"object"==typeof t}var wt=v?function(t){return function(r){return t(r)}}(v):function(t){return mt(t)&&jt(t.length)&&!!i[et(t)]};function At(t){return yt(t)?H(t,!0):it(t)}var zt,St=(zt=function(t,r,e){ut(t,r,e)},ct((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=zt.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!Ot(e))return!1;var n=typeof r;return!!("number"==n?yt(e)&<(r,e.length):"string"==n&&r in e)&&vt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++e boolean, blacklistKeys: matcherKey[]) => unknown; export declare class AdgoError extends Error { + readonly __isAdgoError: boolean; code: string; data: Record; constructor(error: AdgoError | Error | string, data?: Record, code?: string); diff --git a/src/index.ts b/src/index.ts index 4ec33db..352bd2d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,6 +51,7 @@ export const findKeyInObject = ( }; export class AdgoError extends Error { + readonly __isAdgoError: boolean; code: string; data: Record; @@ -69,8 +70,14 @@ export class AdgoError extends Error { super(); } - this.code = (error as AdgoError).code || (data.code as string) || code; - this.name = (error as AdgoError).name || 'AdgoError'; + this.__isAdgoError = true; + this.code = + ((error as AdgoError).__isAdgoError && (error as AdgoError).code) || + (data.code as string) || + code; + this.name = + ((error as AdgoError).__isAdgoError && (error as AdgoError).name) || + 'AdgoError'; this.data = merge({}, (error as AdgoError).data, data); if ((error as AdgoError).stack) {