Comparing version 2.1.6 to 3.0.0
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var axios=_interopDefault(require("axios")),__assign=function(){return(__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)},__awaiter=function(e,n,t,r){return new(t||(t=Promise))(function(o,s){function a(e){try{i(r.next(e))}catch(e){s(e)}}function R(e){try{i(r.throw(e))}catch(e){s(e)}}function i(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(a,R)}i((r=r.apply(e,n||[])).next())})},__generator=function(e,n){var t,r,o,s,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:R(0),throw:R(1),return:R(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function R(s){return function(R){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,R])}}},_this=void 0,toNumber=function(e){return e instanceof Date?e.getTime():"number"==typeof e||null===e||void 0===e?e:Number(e)},isWithin=function(e,n,t){return t>=e&&t<=n},isPromise=function(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then},DEFAULT_HEADERS={Accept:"application/json","Content-Type":"application/json"},DEFAULT_CONFIG={timeout:0},NONE=null,CLIENT_ERROR="CLIENT_ERROR",SERVER_ERROR="SERVER_ERROR",TIMEOUT_ERROR="TIMEOUT_ERROR",CONNECTION_ERROR="CONNECTION_ERROR",NETWORK_ERROR="NETWORK_ERROR",UNKNOWN_ERROR="UNKNOWN_ERROR",CANCEL_ERROR="CANCEL_ERROR",TIMEOUT_ERROR_CODES=["ECONNABORTED"],NODEJS_CONNECTION_ERROR_CODES=["ENOTFOUND","ECONNREFUSED","ECONNRESET"],in200s=function(e){return isWithin(200,299,e)},in400s=function(e){return isWithin(400,499,e)},in500s=function(e){return isWithin(500,599,e)},getProblemFromError=function(e){return"Network Error"===e.message?NETWORK_ERROR:axios.isCancel(e)?CANCEL_ERROR:e.code?TIMEOUT_ERROR_CODES.includes(e.code)?TIMEOUT_ERROR:NODEJS_CONNECTION_ERROR_CODES.includes(e.code)?CONNECTION_ERROR:UNKNOWN_ERROR:getProblemFromStatus(e.response?e.response.status:null)},getProblemFromStatus=function(e){return e?in200s(e)?NONE:in400s(e)?CLIENT_ERROR:in500s(e)?SERVER_ERROR:UNKNOWN_ERROR:UNKNOWN_ERROR},create=function(e){var n,t=__assign({},DEFAULT_HEADERS,e.headers||{});if(e.axiosInstance)n=e.axiosInstance;else{var r=__assign({},e,{headers:void 0}),o=__assign({},DEFAULT_CONFIG,r);n=axios.create(o)}var s=[],a=[],R=[],i=[],u=[],E=function(e,r){return t[e]=r,n},c=function(e){return function(n,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),O(__assign({},r,{url:n,params:t,method:e}))}},l=function(e){return function(n,t,r){return void 0===r&&(r={}),O(__assign({},r,{url:n,method:e,data:t}))}},O=function(e){return __awaiter(_this,void 0,void 0,function(){var r,o,s,i,u=this;return __generator(this,function(E){switch(E.label){case 0:if(e.headers=__assign({},t,e.headers),a.length>0&&a.forEach(function(n){return n(e)}),!(R.length>0))return[3,6];r=0,E.label=1;case 1:return r<R.length?(o=R[r](e),isPromise(o)?[4,o]:[3,3]):[3,6];case 2:return E.sent(),[3,5];case 3:return[4,o(e)];case 4:E.sent(),E.label=5;case 5:return r++,[3,1];case 6:return s=toNumber(new Date),i=function(e){return __awaiter(u,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,N(s,e)];case 1:return n=t.sent(),[2,_(n)]}})})},[2,n.request(e).then(i).catch(i)]}})})},_=function(e){return s.forEach(function(n){try{n(e)}catch(e){}}),e},N=function(e,n){return __awaiter(_this,void 0,void 0,function(){var t,r,o,s,a,R,E,c,l,O,_,N,f,p,T,h;return __generator(this,function(d){switch(d.label){case 0:if(t=toNumber(new Date),r=t-e,o=n instanceof Error||axios.isCancel(n),s=n,a=n,R=o?a.response:s,E=R&&R.status||null,c=o?getProblemFromError(n):getProblemFromStatus(E),l=o?a:null,O=in200s(E),_=n.config||null,N=R&&R.headers||null,f=R&&R.data||null,p={duration:r,problem:c,originalError:l,ok:O,status:E,headers:N,config:_,data:f},i.length>0&&i.forEach(function(e){return e(p)}),!(u.length>0))return[3,6];T=0,d.label=1;case 1:return T<u.length?(h=u[T](p),isPromise(h)?[4,h]:[3,3]):[3,6];case 2:return d.sent(),[3,5];case 3:return[4,h(p)];case 4:d.sent(),d.label=5;case 5:return T++,[3,1];case 6:return[2,p]}})})};return{axiosInstance:n,monitors:s,addMonitor:function(e){s.push(e)},requestTransforms:a,asyncRequestTransforms:R,responseTransforms:i,asyncResponseTransforms:u,addRequestTransform:function(e){return a.push(e)},addAsyncRequestTransform:function(e){return R.push(e)},addResponseTransform:function(e){return i.push(e)},addAsyncResponseTransform:function(e){return u.push(e)},setHeader:E,setHeaders:function(e){return Object.keys(e).forEach(function(n){return E(n,e[n])}),n},deleteHeader:function(e){return delete t[e],n},headers:t,setBaseURL:function(e){return n.defaults.baseURL=e,n},getBaseURL:function(){return n.defaults.baseURL},any:O,get:c("get"),delete:c("delete"),head:c("head"),post:l("post"),put:l("put"),patch:l("patch"),link:c("link"),unlink:c("unlink")}},isCancel=axios.isCancel,CancelToken=axios.CancelToken,apisauce={DEFAULT_HEADERS:DEFAULT_HEADERS,NONE:NONE,CLIENT_ERROR:CLIENT_ERROR,SERVER_ERROR:SERVER_ERROR,TIMEOUT_ERROR:TIMEOUT_ERROR,CONNECTION_ERROR:CONNECTION_ERROR,NETWORK_ERROR:NETWORK_ERROR,UNKNOWN_ERROR:UNKNOWN_ERROR,create:create,isCancel:isCancel,CancelToken:CancelToken};exports.DEFAULT_HEADERS=DEFAULT_HEADERS,exports.NONE=NONE,exports.CLIENT_ERROR=CLIENT_ERROR,exports.SERVER_ERROR=SERVER_ERROR,exports.TIMEOUT_ERROR=TIMEOUT_ERROR,exports.CONNECTION_ERROR=CONNECTION_ERROR,exports.NETWORK_ERROR=NETWORK_ERROR,exports.UNKNOWN_ERROR=UNKNOWN_ERROR,exports.CANCEL_ERROR=CANCEL_ERROR,exports.getProblemFromError=getProblemFromError,exports.getProblemFromStatus=getProblemFromStatus,exports.create=create,exports.isCancel=isCancel,exports.CancelToken=CancelToken,exports.default=apisauce; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var axios=_interopDefault(require("axios")),__assign=function(){return(__assign=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)},__awaiter=function(e,n,t,r){return new(t||(t=Promise))(function(o,s){function R(e){try{i(r.next(e))}catch(e){s(e)}}function a(e){try{i(r.throw(e))}catch(e){s(e)}}function i(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(R,a)}i((r=r.apply(e,n||[])).next())})},__generator=function(e,n){var t,r,o,s,R={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;R;)try{if(t=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return R.label++,{value:s[1],done:!1};case 5:R.label++,r=s[1],s=[0];continue;case 7:s=R.ops.pop(),R.trys.pop();continue;default:if(!(o=(o=R.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){R=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){R.label=s[1];break}if(6===s[0]&&R.label<o[1]){R.label=o[1],o=s;break}if(o&&R.label<o[2]){R.label=o[2],R.ops.push(s);break}o[2]&&R.ops.pop(),R.trys.pop();continue}s=n.call(e,R)}catch(e){s=[6,e],r=0}finally{t=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},_this=void 0,toNumber=function(e){return e instanceof Date?e.getTime():"number"==typeof e||null===e||void 0===e?e:Number(e)},isWithin=function(e,n,t){return t>=e&&t<=n},isPromise=function(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then},DEFAULT_HEADERS={Accept:"application/json","Content-Type":"application/json"},DEFAULT_CONFIG={timeout:0},NONE=null,CLIENT_ERROR="CLIENT_ERROR",SERVER_ERROR="SERVER_ERROR",TIMEOUT_ERROR="TIMEOUT_ERROR",CONNECTION_ERROR="CONNECTION_ERROR",NETWORK_ERROR="NETWORK_ERROR",UNKNOWN_ERROR="UNKNOWN_ERROR",CANCEL_ERROR="CANCEL_ERROR",TIMEOUT_ERROR_CODES=["ECONNABORTED"],NODEJS_CONNECTION_ERROR_CODES=["ENOTFOUND","ECONNREFUSED","ECONNRESET"],STATUS_ERROR_CODES=["ERR_BAD_REQUEST","ERR_BAD_RESPONSE"],in200s=function(e){return isWithin(200,299,e)},in400s=function(e){return isWithin(400,499,e)},in500s=function(e){return isWithin(500,599,e)},getProblemFromError=function(e){return"Network Error"===e.message?NETWORK_ERROR:axios.isCancel(e)?CANCEL_ERROR:e.code?STATUS_ERROR_CODES.includes(e.code)?getProblemFromStatus(e.response.status):TIMEOUT_ERROR_CODES.includes(e.code)?TIMEOUT_ERROR:NODEJS_CONNECTION_ERROR_CODES.includes(e.code)?CONNECTION_ERROR:UNKNOWN_ERROR:getProblemFromStatus(e.response?e.response.status:null)},getProblemFromStatus=function(e){return e?in200s(e)?NONE:in400s(e)?CLIENT_ERROR:in500s(e)?SERVER_ERROR:UNKNOWN_ERROR:UNKNOWN_ERROR},create=function(e){var n,t=__assign({},DEFAULT_HEADERS,e.headers||{});if(e.axiosInstance)n=e.axiosInstance;else{var r=__assign({},e,{headers:void 0}),o=__assign({},DEFAULT_CONFIG,r);n=axios.create(o)}var s=[],R=[],a=[],i=[],u=[],E=function(e,r){return t[e]=r,n},c=function(e){return function(n,t,r){return void 0===t&&(t={}),void 0===r&&(r={}),O(__assign({},r,{url:n,params:t,method:e}))}},l=function(e){return function(n,t,r){return void 0===r&&(r={}),O(__assign({},r,{url:n,method:e,data:t}))}},O=function(e){return __awaiter(_this,void 0,void 0,function(){var r,o,s,i,u=this;return __generator(this,function(E){switch(E.label){case 0:if(e.headers=__assign({},t,e.headers),R.length>0&&R.forEach(function(n){return n(e)}),!(a.length>0))return[3,6];r=0,E.label=1;case 1:return r<a.length?(o=a[r](e),isPromise(o)?[4,o]:[3,3]):[3,6];case 2:return E.sent(),[3,5];case 3:return[4,o(e)];case 4:E.sent(),E.label=5;case 5:return r++,[3,1];case 6:return s=toNumber(new Date),i=function(e){return __awaiter(u,void 0,void 0,function(){var n;return __generator(this,function(t){switch(t.label){case 0:return[4,N(s,e)];case 1:return n=t.sent(),[2,_(n)]}})})},[2,n.request(e).then(i).catch(i)]}})})},_=function(e){return s.forEach(function(n){try{n(e)}catch(e){}}),e},N=function(e,n){return __awaiter(_this,void 0,void 0,function(){var t,r,o,s,R,a,E,c,l,O,_,N,f,p,T,d;return __generator(this,function(h){switch(h.label){case 0:if(t=toNumber(new Date),r=t-e,o=n instanceof Error||axios.isCancel(n),s=n,R=n,a=o?R.response:s,E=a&&a.status||null,c=o?getProblemFromError(n):getProblemFromStatus(E),l=o?R:null,O=in200s(E),_=n.config||null,N=a&&a.headers||null,f=a&&a.data||null,p={duration:r,problem:c,originalError:l,ok:O,status:E,headers:N,config:_,data:f},i.length>0&&i.forEach(function(e){return e(p)}),!(u.length>0))return[3,6];T=0,h.label=1;case 1:return T<u.length?(d=u[T](p),isPromise(d)?[4,d]:[3,3]):[3,6];case 2:return h.sent(),[3,5];case 3:return[4,d(p)];case 4:h.sent(),h.label=5;case 5:return T++,[3,1];case 6:return[2,p]}})})};return{axiosInstance:n,monitors:s,addMonitor:function(e){s.push(e)},requestTransforms:R,asyncRequestTransforms:a,responseTransforms:i,asyncResponseTransforms:u,addRequestTransform:function(e){return R.push(e)},addAsyncRequestTransform:function(e){return a.push(e)},addResponseTransform:function(e){return i.push(e)},addAsyncResponseTransform:function(e){return u.push(e)},setHeader:E,setHeaders:function(e){return Object.keys(e).forEach(function(n){return E(n,e[n])}),n},deleteHeader:function(e){return delete t[e],n},headers:t,setBaseURL:function(e){return n.defaults.baseURL=e,n},getBaseURL:function(){return n.defaults.baseURL},any:O,get:c("get"),delete:c("delete"),head:c("head"),post:l("post"),put:l("put"),patch:l("patch"),link:c("link"),unlink:c("unlink")}},isCancel=axios.isCancel,CancelToken=axios.CancelToken,apisauce={DEFAULT_HEADERS:DEFAULT_HEADERS,NONE:NONE,CLIENT_ERROR:CLIENT_ERROR,SERVER_ERROR:SERVER_ERROR,TIMEOUT_ERROR:TIMEOUT_ERROR,CONNECTION_ERROR:CONNECTION_ERROR,NETWORK_ERROR:NETWORK_ERROR,UNKNOWN_ERROR:UNKNOWN_ERROR,create:create,isCancel:isCancel,CancelToken:CancelToken};exports.DEFAULT_HEADERS=DEFAULT_HEADERS,exports.NONE=NONE,exports.CLIENT_ERROR=CLIENT_ERROR,exports.SERVER_ERROR=SERVER_ERROR,exports.TIMEOUT_ERROR=TIMEOUT_ERROR,exports.CONNECTION_ERROR=CONNECTION_ERROR,exports.NETWORK_ERROR=NETWORK_ERROR,exports.UNKNOWN_ERROR=UNKNOWN_ERROR,exports.CANCEL_ERROR=CANCEL_ERROR,exports.getProblemFromError=getProblemFromError,exports.getProblemFromStatus=getProblemFromStatus,exports.create=create,exports.isCancel=isCancel,exports.CancelToken=CancelToken,exports.default=apisauce; |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],n):n(e.apisauce={},e.axios)}(this,function(e,n){"use strict";var t=function(){return(t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)},r=function(e,n,t,r){return new(t||(t=Promise))(function(o,u){function a(e){try{c(r.next(e))}catch(e){u(e)}}function s(e){try{c(r.throw(e))}catch(e){u(e)}}function c(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(a,s)}c((r=r.apply(e,n||[])).next())})},o=function(e,n){var t,r,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(u){return function(s){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},u=function(e){return e instanceof Date?e.getTime():"number"==typeof e||null===e||void 0===e?e:Number(e)},a=function(e,n,t){return t>=e&&t<=n},s=function(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then},c={Accept:"application/json","Content-Type":"application/json"},i={timeout:0},R=["ECONNABORTED"],l=["ENOTFOUND","ECONNREFUSED","ECONNRESET"],f=function(e){return a(200,299,e)},E=function(e){return"Network Error"===e.message?"NETWORK_ERROR":n.isCancel(e)?"CANCEL_ERROR":e.code?R.includes(e.code)?"TIMEOUT_ERROR":l.includes(e.code)?"CONNECTION_ERROR":"UNKNOWN_ERROR":O(e.response?e.response.status:null)},O=function(e){return e?f(e)?null:a(400,499,e)?"CLIENT_ERROR":function(e){return a(500,599,e)}(e)?"SERVER_ERROR":"UNKNOWN_ERROR":"UNKNOWN_ERROR"},d=function(e){var a,R=t({},c,e.headers||{});if(e.axiosInstance)a=e.axiosInstance;else{var l=t({},e,{headers:void 0}),d=t({},i,l);a=n.create(d)}var N=[],p=[],h=[],T=[],_=[],b=function(e,n){return R[e]=n,a},y=function(e){return function(n,r,o){return void 0===r&&(r={}),void 0===o&&(o={}),v(t({},o,{url:n,params:r,method:e}))}},C=function(e){return function(n,r,o){return void 0===o&&(o={}),v(t({},o,{url:n,method:e,data:r}))}},v=function(e){return r(void 0,void 0,void 0,function(){var n,c,i,l,f=this;return o(this,function(E){switch(E.label){case 0:if(e.headers=t({},R,e.headers),p.length>0&&p.forEach(function(n){return n(e)}),!(h.length>0))return[3,6];n=0,E.label=1;case 1:return n<h.length?(c=h[n](e),s(c)?[4,c]:[3,3]):[3,6];case 2:return E.sent(),[3,5];case 3:return[4,c(e)];case 4:E.sent(),E.label=5;case 5:return n++,[3,1];case 6:return i=u(new Date),l=function(e){return r(f,void 0,void 0,function(){var n;return o(this,function(t){switch(t.label){case 0:return[4,g(i,e)];case 1:return n=t.sent(),[2,m(n)]}})})},[2,a.request(e).then(l).catch(l)]}})})},m=function(e){return N.forEach(function(n){try{n(e)}catch(e){}}),e},g=function(e,t){return r(void 0,void 0,void 0,function(){var r,a,c,i,R,l,d,N,p,h,b,y,C,v,m,g;return o(this,function(o){switch(o.label){case 0:if(r=u(new Date),a=r-e,c=t instanceof Error||n.isCancel(t),i=t,R=t,l=c?R.response:i,d=l&&l.status||null,N=c?E(t):O(d),p=c?R:null,h=f(d),b=t.config||null,y=l&&l.headers||null,C=l&&l.data||null,v={duration:a,problem:N,originalError:p,ok:h,status:d,headers:y,config:b,data:C},T.length>0&&T.forEach(function(e){return e(v)}),!(_.length>0))return[3,6];m=0,o.label=1;case 1:return m<_.length?(g=_[m](v),s(g)?[4,g]:[3,3]):[3,6];case 2:return o.sent(),[3,5];case 3:return[4,g(v)];case 4:o.sent(),o.label=5;case 5:return m++,[3,1];case 6:return[2,v]}})})};return{axiosInstance:a,monitors:N,addMonitor:function(e){N.push(e)},requestTransforms:p,asyncRequestTransforms:h,responseTransforms:T,asyncResponseTransforms:_,addRequestTransform:function(e){return p.push(e)},addAsyncRequestTransform:function(e){return h.push(e)},addResponseTransform:function(e){return T.push(e)},addAsyncResponseTransform:function(e){return _.push(e)},setHeader:b,setHeaders:function(e){return Object.keys(e).forEach(function(n){return b(n,e[n])}),a},deleteHeader:function(e){return delete R[e],a},headers:R,setBaseURL:function(e){return a.defaults.baseURL=e,a},getBaseURL:function(){return a.defaults.baseURL},any:v,get:y("get"),delete:y("delete"),head:y("head"),post:C("post"),put:C("put"),patch:C("patch"),link:y("link"),unlink:y("unlink")}},N=(n=n&&n.hasOwnProperty("default")?n.default:n).isCancel,p=n.CancelToken,h={DEFAULT_HEADERS:c,NONE:null,CLIENT_ERROR:"CLIENT_ERROR",SERVER_ERROR:"SERVER_ERROR",TIMEOUT_ERROR:"TIMEOUT_ERROR",CONNECTION_ERROR:"CONNECTION_ERROR",NETWORK_ERROR:"NETWORK_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR",create:d,isCancel:N,CancelToken:p};e.DEFAULT_HEADERS=c,e.NONE=null,e.CLIENT_ERROR="CLIENT_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT_ERROR="TIMEOUT_ERROR",e.CONNECTION_ERROR="CONNECTION_ERROR",e.NETWORK_ERROR="NETWORK_ERROR",e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.CANCEL_ERROR="CANCEL_ERROR",e.getProblemFromError=E,e.getProblemFromStatus=O,e.create=d,e.isCancel=N,e.CancelToken=p,e.default=h,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],n):n(e.apisauce={},e.axios)}(this,function(e,n){"use strict";var t=function(){return(t=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)},r=function(e,n,t,r){return new(t||(t=Promise))(function(o,u){function a(e){try{c(r.next(e))}catch(e){u(e)}}function s(e){try{c(r.throw(e))}catch(e){u(e)}}function c(e){e.done?o(e.value):new t(function(n){n(e.value)}).then(a,s)}c((r=r.apply(e,n||[])).next())})},o=function(e,n){var t,r,o,u,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return u={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function s(u){return function(s){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,s])}}},u=function(e){return e instanceof Date?e.getTime():"number"==typeof e||null===e||void 0===e?e:Number(e)},a=function(e,n,t){return t>=e&&t<=n},s=function(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then},c={Accept:"application/json","Content-Type":"application/json"},i={timeout:0},R=["ECONNABORTED"],l=["ENOTFOUND","ECONNREFUSED","ECONNRESET"],f=["ERR_BAD_REQUEST","ERR_BAD_RESPONSE"],E=function(e){return a(200,299,e)},O=function(e){return"Network Error"===e.message?"NETWORK_ERROR":n.isCancel(e)?"CANCEL_ERROR":e.code?f.includes(e.code)?d(e.response.status):R.includes(e.code)?"TIMEOUT_ERROR":l.includes(e.code)?"CONNECTION_ERROR":"UNKNOWN_ERROR":d(e.response?e.response.status:null)},d=function(e){return e?E(e)?null:a(400,499,e)?"CLIENT_ERROR":function(e){return a(500,599,e)}(e)?"SERVER_ERROR":"UNKNOWN_ERROR":"UNKNOWN_ERROR"},N=function(e){var a,R=t({},c,e.headers||{});if(e.axiosInstance)a=e.axiosInstance;else{var l=t({},e,{headers:void 0}),f=t({},i,l);a=n.create(f)}var N=[],p=[],h=[],T=[],_=[],b=function(e,n){return R[e]=n,a},y=function(e){return function(n,r,o){return void 0===r&&(r={}),void 0===o&&(o={}),v(t({},o,{url:n,params:r,method:e}))}},C=function(e){return function(n,r,o){return void 0===o&&(o={}),v(t({},o,{url:n,method:e,data:r}))}},v=function(e){return r(void 0,void 0,void 0,function(){var n,c,i,l,f=this;return o(this,function(E){switch(E.label){case 0:if(e.headers=t({},R,e.headers),p.length>0&&p.forEach(function(n){return n(e)}),!(h.length>0))return[3,6];n=0,E.label=1;case 1:return n<h.length?(c=h[n](e),s(c)?[4,c]:[3,3]):[3,6];case 2:return E.sent(),[3,5];case 3:return[4,c(e)];case 4:E.sent(),E.label=5;case 5:return n++,[3,1];case 6:return i=u(new Date),l=function(e){return r(f,void 0,void 0,function(){var n;return o(this,function(t){switch(t.label){case 0:return[4,g(i,e)];case 1:return n=t.sent(),[2,m(n)]}})})},[2,a.request(e).then(l).catch(l)]}})})},m=function(e){return N.forEach(function(n){try{n(e)}catch(e){}}),e},g=function(e,t){return r(void 0,void 0,void 0,function(){var r,a,c,i,R,l,f,N,p,h,b,y,C,v,m,g;return o(this,function(o){switch(o.label){case 0:if(r=u(new Date),a=r-e,c=t instanceof Error||n.isCancel(t),i=t,R=t,l=c?R.response:i,f=l&&l.status||null,N=c?O(t):d(f),p=c?R:null,h=E(f),b=t.config||null,y=l&&l.headers||null,C=l&&l.data||null,v={duration:a,problem:N,originalError:p,ok:h,status:f,headers:y,config:b,data:C},T.length>0&&T.forEach(function(e){return e(v)}),!(_.length>0))return[3,6];m=0,o.label=1;case 1:return m<_.length?(g=_[m](v),s(g)?[4,g]:[3,3]):[3,6];case 2:return o.sent(),[3,5];case 3:return[4,g(v)];case 4:o.sent(),o.label=5;case 5:return m++,[3,1];case 6:return[2,v]}})})};return{axiosInstance:a,monitors:N,addMonitor:function(e){N.push(e)},requestTransforms:p,asyncRequestTransforms:h,responseTransforms:T,asyncResponseTransforms:_,addRequestTransform:function(e){return p.push(e)},addAsyncRequestTransform:function(e){return h.push(e)},addResponseTransform:function(e){return T.push(e)},addAsyncResponseTransform:function(e){return _.push(e)},setHeader:b,setHeaders:function(e){return Object.keys(e).forEach(function(n){return b(n,e[n])}),a},deleteHeader:function(e){return delete R[e],a},headers:R,setBaseURL:function(e){return a.defaults.baseURL=e,a},getBaseURL:function(){return a.defaults.baseURL},any:v,get:y("get"),delete:y("delete"),head:y("head"),post:C("post"),put:C("put"),patch:C("patch"),link:y("link"),unlink:y("unlink")}},p=(n=n&&n.hasOwnProperty("default")?n.default:n).isCancel,h=n.CancelToken,T={DEFAULT_HEADERS:c,NONE:null,CLIENT_ERROR:"CLIENT_ERROR",SERVER_ERROR:"SERVER_ERROR",TIMEOUT_ERROR:"TIMEOUT_ERROR",CONNECTION_ERROR:"CONNECTION_ERROR",NETWORK_ERROR:"NETWORK_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR",create:N,isCancel:p,CancelToken:h};e.DEFAULT_HEADERS=c,e.NONE=null,e.CLIENT_ERROR="CLIENT_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT_ERROR="TIMEOUT_ERROR",e.CONNECTION_ERROR="CONNECTION_ERROR",e.NETWORK_ERROR="NETWORK_ERROR",e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.CANCEL_ERROR="CANCEL_ERROR",e.getProblemFromError=O,e.getProblemFromStatus=d,e.create=N,e.isCancel=p,e.CancelToken=h,e.default=T,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"version": "2.1.6", | ||
"version": "3.0.0", | ||
"author": { | ||
@@ -14,3 +14,3 @@ "name": "Infinite Red", | ||
"dependencies": { | ||
"axios": "^0.21.4" | ||
"axios": "^0.27.2" | ||
}, | ||
@@ -45,3 +45,3 @@ "description": "Axios + standardized errors + request/response transforms.", | ||
"tslint-config-standard": "^8.0.1", | ||
"typescript": "3.2.1" | ||
"typescript": "3.5.1" | ||
}, | ||
@@ -48,0 +48,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31948
157
+ Addedasynckit@0.4.0(transitive)
+ Addedaxios@0.27.2(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedform-data@4.0.1(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
- Removedaxios@0.21.4(transitive)
Updatedaxios@^0.27.2