http-factory
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -40,2 +40,33 @@ | ||
}; | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { | ||
return value instanceof P ? value : new P(function (resolve) { | ||
resolve(value); | ||
}); | ||
} | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { | ||
try { | ||
step(generator.next(value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function rejected(value) { | ||
try { | ||
step(generator["throw"](value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function step(result) { | ||
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); | ||
} | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
@@ -1701,2 +1732,17 @@ var _ = { | ||
var logRequest = function (data, headers) { | ||
var printf = 'color: #4CAF50; font-weight: bold'; | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
if (data && Object.keys(data).length > 0) { | ||
console.info('%c REQUEST: DATA ===> ', printf, { data: data }); | ||
} | ||
console.info('%c REQUEST: HEADERS ===> ', printf, { headers: headers }); | ||
return data; | ||
}; | ||
var logResponse = function (data) { | ||
var printf = 'color: #4CAF50; font-weight: bold'; | ||
console.info('%c RESPONSE: DATA ===> ', printf, data); | ||
return data; | ||
}; | ||
/** | ||
@@ -1784,16 +1830,2 @@ * @license | ||
var logRequest = function (data, headers) { | ||
var printf = 'color: #4CAF50; font-weight: bold'; | ||
if (data && Object.keys(data).length > 0) { | ||
console.info('%c REQUEST: DATA ===> ', printf, { data: data }); | ||
} | ||
console.info('%c REQUEST: HEADERS ===> ', printf, { headers: headers }); | ||
return data; | ||
}; | ||
var logResponse = function (data) { | ||
var printf = 'color: #4CAF50; font-weight: bold'; | ||
console.info('%c RESPONSE: DATA ===> ', printf, data); | ||
return data; | ||
}; | ||
/** | ||
@@ -1877,7 +1909,11 @@ * Factory for creating new Http clients. | ||
HttpClient.prototype.get = function (config, cb) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return this.client(__assign({ method: 'get' }, config)) | ||
.then(cb)["catch"](cb); | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return [2 /*return*/, this.client(__assign({ method: 'get' }, config)) | ||
.then(cb)["catch"](cb)]; | ||
}); | ||
}); | ||
}; | ||
@@ -1890,7 +1926,11 @@ /** | ||
HttpClient.prototype.post = function (config, cb) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return this.client(__assign({ method: 'post' }, config)) | ||
.then(cb)["catch"](cb); | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return [2 /*return*/, this.client(__assign({ method: 'post' }, config)) | ||
.then(cb)["catch"](cb)]; | ||
}); | ||
}); | ||
}; | ||
@@ -1903,7 +1943,11 @@ /** | ||
HttpClient.prototype.put = function (config, cb) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return this.client(__assign({ method: 'put' }, config)) | ||
.then(cb)["catch"](cb); | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return [2 /*return*/, this.client(__assign({ method: 'put' }, config)) | ||
.then(cb)["catch"](cb)]; | ||
}); | ||
}); | ||
}; | ||
@@ -1916,7 +1960,11 @@ /** | ||
HttpClient.prototype["delete"] = function (config, cb) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return this.client(__assign({ method: 'delete' }, config)) | ||
.then(cb)["catch"](cb); | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return [2 /*return*/, this.client(__assign({ method: 'delete' }, config)) | ||
.then(cb)["catch"](cb)]; | ||
}); | ||
}); | ||
}; | ||
@@ -1969,3 +2017,5 @@ /** | ||
return [3 /*break*/, 16]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { return reject(new Error(ex_1)); }))]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { | ||
reject(new Error(ex_1)); | ||
}))]; | ||
case 14: return [4 /*yield*/, _a.sent()]; | ||
@@ -2029,3 +2079,5 @@ case 15: | ||
return [3 /*break*/, 16]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { return reject(new Error(ex_2)); }))]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { | ||
reject(new Error(ex_2)); | ||
}))]; | ||
case 14: return [4 /*yield*/, _a.sent()]; | ||
@@ -2089,3 +2141,5 @@ case 15: | ||
return [3 /*break*/, 16]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { return reject(new Error(ex_3)); }))]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { | ||
reject(new Error(ex_3)); | ||
}))]; | ||
case 14: return [4 /*yield*/, _a.sent()]; | ||
@@ -2149,3 +2203,5 @@ case 15: | ||
return [3 /*break*/, 16]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { return reject(new Error(ex_4)); }))]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { | ||
reject(new Error(ex_4)); | ||
}))]; | ||
case 14: return [4 /*yield*/, _a.sent()]; | ||
@@ -2152,0 +2208,0 @@ case 15: |
@@ -36,2 +36,33 @@ | ||
}; | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { | ||
return value instanceof P ? value : new P(function (resolve) { | ||
resolve(value); | ||
}); | ||
} | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { | ||
try { | ||
step(generator.next(value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function rejected(value) { | ||
try { | ||
step(generator["throw"](value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
} | ||
function step(result) { | ||
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); | ||
} | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
function __generator(thisArg, body) { | ||
@@ -1697,2 +1728,17 @@ var _ = { | ||
var logRequest = function (data, headers) { | ||
var printf = 'color: #4CAF50; font-weight: bold'; | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
if (data && Object.keys(data).length > 0) { | ||
console.info('%c REQUEST: DATA ===> ', printf, { data: data }); | ||
} | ||
console.info('%c REQUEST: HEADERS ===> ', printf, { headers: headers }); | ||
return data; | ||
}; | ||
var logResponse = function (data) { | ||
var printf = 'color: #4CAF50; font-weight: bold'; | ||
console.info('%c RESPONSE: DATA ===> ', printf, data); | ||
return data; | ||
}; | ||
/** | ||
@@ -1780,16 +1826,2 @@ * @license | ||
var logRequest = function (data, headers) { | ||
var printf = 'color: #4CAF50; font-weight: bold'; | ||
if (data && Object.keys(data).length > 0) { | ||
console.info('%c REQUEST: DATA ===> ', printf, { data: data }); | ||
} | ||
console.info('%c REQUEST: HEADERS ===> ', printf, { headers: headers }); | ||
return data; | ||
}; | ||
var logResponse = function (data) { | ||
var printf = 'color: #4CAF50; font-weight: bold'; | ||
console.info('%c RESPONSE: DATA ===> ', printf, data); | ||
return data; | ||
}; | ||
/** | ||
@@ -1873,7 +1905,11 @@ * Factory for creating new Http clients. | ||
HttpClient.prototype.get = function (config, cb) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return this.client(__assign({ method: 'get' }, config)) | ||
.then(cb)["catch"](cb); | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return [2 /*return*/, this.client(__assign({ method: 'get' }, config)) | ||
.then(cb)["catch"](cb)]; | ||
}); | ||
}); | ||
}; | ||
@@ -1886,7 +1922,11 @@ /** | ||
HttpClient.prototype.post = function (config, cb) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return this.client(__assign({ method: 'post' }, config)) | ||
.then(cb)["catch"](cb); | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return [2 /*return*/, this.client(__assign({ method: 'post' }, config)) | ||
.then(cb)["catch"](cb)]; | ||
}); | ||
}); | ||
}; | ||
@@ -1899,7 +1939,11 @@ /** | ||
HttpClient.prototype.put = function (config, cb) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return this.client(__assign({ method: 'put' }, config)) | ||
.then(cb)["catch"](cb); | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return [2 /*return*/, this.client(__assign({ method: 'put' }, config)) | ||
.then(cb)["catch"](cb)]; | ||
}); | ||
}); | ||
}; | ||
@@ -1912,7 +1956,11 @@ /** | ||
HttpClient.prototype["delete"] = function (config, cb) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return this.client(__assign({ method: 'delete' }, config)) | ||
.then(cb)["catch"](cb); | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (cb != null) { | ||
mustBeFn(cb); | ||
} | ||
return [2 /*return*/, this.client(__assign({ method: 'delete' }, config)) | ||
.then(cb)["catch"](cb)]; | ||
}); | ||
}); | ||
}; | ||
@@ -1965,3 +2013,5 @@ /** | ||
return [3 /*break*/, 16]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { return reject(new Error(ex_1)); }))]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { | ||
reject(new Error(ex_1)); | ||
}))]; | ||
case 14: return [4 /*yield*/, _a.sent()]; | ||
@@ -2025,3 +2075,5 @@ case 15: | ||
return [3 /*break*/, 16]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { return reject(new Error(ex_2)); }))]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { | ||
reject(new Error(ex_2)); | ||
}))]; | ||
case 14: return [4 /*yield*/, _a.sent()]; | ||
@@ -2085,3 +2137,5 @@ case 15: | ||
return [3 /*break*/, 16]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { return reject(new Error(ex_3)); }))]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { | ||
reject(new Error(ex_3)); | ||
}))]; | ||
case 14: return [4 /*yield*/, _a.sent()]; | ||
@@ -2145,3 +2199,5 @@ case 15: | ||
return [3 /*break*/, 16]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { return reject(new Error(ex_4)); }))]; | ||
case 13: return [4 /*yield*/, __await(new Promise(function (_, reject) { | ||
reject(new Error(ex_4)); | ||
}))]; | ||
case 14: return [4 /*yield*/, _a.sent()]; | ||
@@ -2148,0 +2204,0 @@ case 15: |
@@ -21,3 +21,3 @@ /** | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var t=function(){return t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function r(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function n(e){return this instanceof n?(this.v=e,this):new n(e)}function o(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,i=r.apply(e,t||[]),s=[];return o={},a("next"),a("throw"),a("return"),o[Symbol.asyncIterator]=function(){return this},o;function a(e){i[e]&&(o[e]=function(t){return new Promise((function(r,n){s.push([e,t,r,n])>1||u(e,t)}))})}function u(e,t){try{(r=i[e](t)).value instanceof n?Promise.resolve(r.value.v).then(c,f):l(s[0][2],r)}catch(e){l(s[0][3],e)}var r}function c(e){u("next",e)}function f(e){u("throw",e)}function l(e,t){e(t),s.shift(),s.length&&u(s[0][0],s[0][1])}}function i(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var s={exports:{}},a=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},u=a,c=Object.prototype.toString;function f(e){return"[object Array]"===c.call(e)}function l(e){return void 0===e}function h(e){return null!==e&&"object"==typeof e}function p(e){if("[object Object]"!==c.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function d(e){return"[object Function]"===c.call(e)}function y(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),f(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var m={isArray:f,isArrayBuffer:function(e){return"[object ArrayBuffer]"===c.call(e)},isBuffer:function(e){return null!==e&&!l(e)&&null!==e.constructor&&!l(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:h,isPlainObject:p,isUndefined:l,isDate:function(e){return"[object Date]"===c.call(e)},isFile:function(e){return"[object File]"===c.call(e)},isBlob:function(e){return"[object Blob]"===c.call(e)},isFunction:d,isStream:function(e){return h(e)&&d(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:y,merge:function e(){var t={};function r(r,n){p(t[n])&&p(r)?t[n]=e(t[n],r):p(r)?t[n]=e({},r):f(r)?t[n]=r.slice():t[n]=r}for(var n=0,o=arguments.length;n<o;n++)y(arguments[n],r);return t},extend:function(e,t,r){return y(t,(function(t,n){e[n]=r&&"function"==typeof t?u(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}},b=m;function v(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var g=m;function w(){this.handlers=[]}w.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},w.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},w.prototype.forEach=function(e){g.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var j=w,E="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function S(){throw new Error("setTimeout has not been defined")}function O(){throw new Error("clearTimeout has not been defined")}var A=S,T=O;function P(e){if(A===setTimeout)return setTimeout(e,0);if((A===S||!A)&&setTimeout)return A=setTimeout,setTimeout(e,0);try{return A(e,0)}catch(t){try{return A.call(null,e,0)}catch(t){return A.call(this,e,0)}}}"function"==typeof E.setTimeout&&(A=setTimeout),"function"==typeof E.clearTimeout&&(T=clearTimeout);var R,x=[],N=!1,_=-1;function q(){N&&R&&(N=!1,R.length?x=R.concat(x):_=-1,x.length&&C())}function C(){if(!N){var e=P(q);N=!0;for(var t=x.length;t;){for(R=x,x=[];++_<t;)R&&R[_].run();_=-1,t=x.length}R=null,N=!1,function(e){if(T===clearTimeout)return clearTimeout(e);if((T===O||!T)&&clearTimeout)return T=clearTimeout,clearTimeout(e);try{T(e)}catch(t){try{return T.call(null,e)}catch(t){return T.call(this,e)}}}(e)}}function U(e,t){this.fun=e,this.array=t}U.prototype.run=function(){this.fun.apply(null,this.array)};function k(){}var B=k,L=k,D=k,F=k,J=k,M=k,I=k;var H=E.performance||{},z=H.now||H.mozNow||H.msNow||H.oNow||H.webkitNow||function(){return(new Date).getTime()};var V=new Date;var W={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];x.push(new U(e,t)),1!==x.length||N||P(C)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:B,addListener:L,once:D,off:F,removeListener:J,removeAllListeners:M,emit:I,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*z.call(H),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-V)/1e3}},X=require("./utils"),G=require("./helpers/normalizeHeaderName"),K=require("./core/enhanceError"),Q={"Content-Type":"application/x-www-form-urlencoded"};function $(e,t){!X.isUndefined(e)&&X.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Y,Z={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:("undefined"!=typeof XMLHttpRequest?Y=require("./adapters/xhr"):void 0!==W&&"[object process]"===Object.prototype.toString.call(W)&&(Y=require("./adapters/http")),Y),transformRequest:[function(e,t){return G(t,"Accept"),G(t,"Content-Type"),X.isFormData(e)||X.isArrayBuffer(e)||X.isBuffer(e)||X.isStream(e)||X.isFile(e)||X.isBlob(e)?e:X.isArrayBufferView(e)?e.buffer:X.isURLSearchParams(e)?($(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):X.isObject(e)||t&&"application/json"===t["Content-Type"]?($(t,"application/json"),function(e,t,r){if(X.isString(e))try{return(t||JSON.parse)(e),X.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||Z.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,o=!r&&"json"===this.responseType;if(o||n&&X.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw K(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};X.forEach(["delete","get","head"],(function(e){Z.headers[e]={}})),X.forEach(["post","put","patch"],(function(e){Z.headers[e]=X.merge(Q)})),module.exports=Z;var ee=i(Object.freeze({__proto__:null})),te=m,re=ee,ne=function(e){return!(!e||!e.__CANCEL__)};function oe(e){this.message=e}oe.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},oe.prototype.__CANCEL__=!0;var ie=oe,se=m,ae=function(e,t,r){var n=this||re;return te.forEach(r,(function(r){e=r.call(n,e,t)})),e},ue=ne,ce=ee,fe=ie;function le(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new fe("canceled")}var he=m,pe=function(e,t){t=t||{};var r={};function n(e,t){return he.isPlainObject(e)&&he.isPlainObject(t)?he.merge(e,t):he.isPlainObject(t)?he.merge({},t):he.isArray(t)?t.slice():t}function o(r){return he.isUndefined(t[r])?he.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function i(e){if(!he.isUndefined(t[e]))return n(void 0,t[e])}function s(r){return he.isUndefined(t[r])?he.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function a(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var u={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a};return he.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,n=t(e);he.isUndefined(n)&&t!==a||(r[e]=n)})),r},de="0.24.0",ye=de,me={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){me[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var be={};me.transitional=function(e,t,r){function n(e,t){return"[Axios v"+ye+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,i){if(!1===e)throw new Error(n(o," has been removed"+(t?" in "+t:"")));return t&&!be[o]&&(be[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}};var ve={assertOptions:function(e,t,r){if("object"!=typeof e)throw new TypeError("options must be an object");for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],s=t[i];if(s){var a=e[i],u=void 0===a||s(a,i,e);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==r)throw Error("Unknown option "+i)}},validators:me},ge=m,we=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(b.isURLSearchParams(t))n=t.toString();else{var o=[];b.forEach(t,(function(e,t){null!=e&&(b.isArray(e)?t+="[]":e=[e],b.forEach(e,(function(e){b.isDate(e)?e=e.toISOString():b.isObject(e)&&(e=JSON.stringify(e)),o.push(v(t)+"="+v(e))})))})),n=o.join("&")}if(n){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e},je=j,Ee=function(e){return le(e),e.headers=e.headers||{},e.data=ae.call(e,e.data,e.headers,e.transformRequest),e.headers=se.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),se.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||ce.adapter)(e).then((function(t){return le(e),t.data=ae.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return ue(t)||(le(e),t&&t.response&&(t.response.data=ae.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Se=pe,Oe=ve,Ae=Oe.validators;function Te(e){this.defaults=e,this.interceptors={request:new je,response:new je}}Te.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Se(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&Oe.assertOptions(t,{silentJSONParsing:Ae.transitional(Ae.boolean),forcedJSONParsing:Ae.transitional(Ae.boolean),clarifyTimeoutError:Ae.transitional(Ae.boolean)},!1);var r=[],n=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(n=n&&t.synchronous,r.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!n){var s=[Ee,void 0];for(Array.prototype.unshift.apply(s,r),s=s.concat(i),o=Promise.resolve(e);s.length;)o=o.then(s.shift(),s.shift());return o}for(var a=e;r.length;){var u=r.shift(),c=r.shift();try{a=u(a)}catch(e){c(e);break}}try{o=Ee(a)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},Te.prototype.getUri=function(e){return e=Se(this.defaults,e),we(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},ge.forEach(["delete","get","head","options"],(function(e){Te.prototype[e]=function(t,r){return this.request(Se(r||{},{method:e,url:t,data:(r||{}).data}))}})),ge.forEach(["post","put","patch"],(function(e){Te.prototype[e]=function(t,r,n){return this.request(Se(n||{},{method:e,url:t,data:r}))}}));var Pe=Te,Re=ie;function xe(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new Re(e),t(r.reason))}))}xe.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},xe.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},xe.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},xe.source=function(){var e;return{token:new xe((function(t){e=t})),cancel:e}};var Ne=xe,_e=m,qe=a,Ce=Pe,Ue=pe;var ke=function e(t){var r=new Ce(t),n=qe(Ce.prototype.request,r);return _e.extend(n,Ce.prototype,r),_e.extend(n,r),n.create=function(r){return e(Ue(t,r))},n}(ee);ke.Axios=Ce,ke.Cancel=ie,ke.CancelToken=Ne,ke.isCancel=ne,ke.VERSION=de,ke.all=function(e){return Promise.all(e)},ke.spread=function(e){return function(t){return e.apply(null,t)}},ke.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError},s.exports=ke,s.exports.default=ke;var Be=s.exports; | ||
***************************************************************************** */var t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{u(r.next(e))}catch(e){i(e)}}function a(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))}function r(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function o(e){return this instanceof o?(this.v=e,this):new o(e)}function i(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),s=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){s.push([e,t,n,r])>1||u(e,t)}))})}function u(e,t){try{(n=i[e](t)).value instanceof o?Promise.resolve(n.value.v).then(c,f):l(s[0][2],n)}catch(e){l(s[0][3],e)}var n}function c(e){u("next",e)}function f(e){u("throw",e)}function l(e,t){e(t),s.shift(),s.length&&u(s[0][0],s[0][1])}}function s(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}var a={exports:{}},u=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},c=u,f=Object.prototype.toString;function l(e){return"[object Array]"===f.call(e)}function h(e){return void 0===e}function p(e){return null!==e&&"object"==typeof e}function d(e){if("[object Object]"!==f.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function y(e){return"[object Function]"===f.call(e)}function m(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),l(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var v={isArray:l,isArrayBuffer:function(e){return"[object ArrayBuffer]"===f.call(e)},isBuffer:function(e){return null!==e&&!h(e)&&null!==e.constructor&&!h(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:p,isPlainObject:d,isUndefined:h,isDate:function(e){return"[object Date]"===f.call(e)},isFile:function(e){return"[object File]"===f.call(e)},isBlob:function(e){return"[object Blob]"===f.call(e)},isFunction:y,isStream:function(e){return p(e)&&y(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:m,merge:function e(){var t={};function n(n,r){d(t[r])&&d(n)?t[r]=e(t[r],n):d(n)?t[r]=e({},n):l(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)m(arguments[r],n);return t},extend:function(e,t,n){return m(t,(function(t,r){e[r]=n&&"function"==typeof t?c(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}},b=v;function g(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var w=v;function j(){this.handlers=[]}j.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},j.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},j.prototype.forEach=function(e){w.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var E=j,S="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function O(){throw new Error("setTimeout has not been defined")}function A(){throw new Error("clearTimeout has not been defined")}var T=O,P=A;function x(e){if(T===setTimeout)return setTimeout(e,0);if((T===O||!T)&&setTimeout)return T=setTimeout,setTimeout(e,0);try{return T(e,0)}catch(t){try{return T.call(null,e,0)}catch(t){return T.call(this,e,0)}}}"function"==typeof S.setTimeout&&(T=setTimeout),"function"==typeof S.clearTimeout&&(P=clearTimeout);var R,N=[],_=!1,q=-1;function C(){_&&R&&(_=!1,R.length?N=R.concat(N):q=-1,N.length&&U())}function U(){if(!_){var e=x(C);_=!0;for(var t=N.length;t;){for(R=N,N=[];++q<t;)R&&R[q].run();q=-1,t=N.length}R=null,_=!1,function(e){if(P===clearTimeout)return clearTimeout(e);if((P===A||!P)&&clearTimeout)return P=clearTimeout,clearTimeout(e);try{P(e)}catch(t){try{return P.call(null,e)}catch(t){return P.call(this,e)}}}(e)}}function k(e,t){this.fun=e,this.array=t}k.prototype.run=function(){this.fun.apply(null,this.array)};function B(){}var L=B,D=B,F=B,J=B,M=B,I=B,H=B;var z=S.performance||{},V=z.now||z.mozNow||z.msNow||z.oNow||z.webkitNow||function(){return(new Date).getTime()};var W=new Date;var X={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];N.push(new k(e,t)),1!==N.length||_||x(U)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:L,addListener:D,once:F,off:J,removeListener:M,removeAllListeners:I,emit:H,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*V.call(z),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-W)/1e3}},G=require("./utils"),K=require("./helpers/normalizeHeaderName"),Q=require("./core/enhanceError"),$={"Content-Type":"application/x-www-form-urlencoded"};function Y(e,t){!G.isUndefined(e)&&G.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Z,ee={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:("undefined"!=typeof XMLHttpRequest?Z=require("./adapters/xhr"):void 0!==X&&"[object process]"===Object.prototype.toString.call(X)&&(Z=require("./adapters/http")),Z),transformRequest:[function(e,t){return K(t,"Accept"),K(t,"Content-Type"),G.isFormData(e)||G.isArrayBuffer(e)||G.isBuffer(e)||G.isStream(e)||G.isFile(e)||G.isBlob(e)?e:G.isArrayBufferView(e)?e.buffer:G.isURLSearchParams(e)?(Y(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):G.isObject(e)||t&&"application/json"===t["Content-Type"]?(Y(t,"application/json"),function(e,t,n){if(G.isString(e))try{return(t||JSON.parse)(e),G.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||ee.transitional,n=t&&t.silentJSONParsing,r=t&&t.forcedJSONParsing,o=!n&&"json"===this.responseType;if(o||r&&G.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw Q(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};G.forEach(["delete","get","head"],(function(e){ee.headers[e]={}})),G.forEach(["post","put","patch"],(function(e){ee.headers[e]=G.merge($)})),module.exports=ee;var te=s(Object.freeze({__proto__:null})),ne=v,re=te,oe=function(e){return!(!e||!e.__CANCEL__)};function ie(e){this.message=e}ie.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},ie.prototype.__CANCEL__=!0;var se=ie,ae=v,ue=function(e,t,n){var r=this||re;return ne.forEach(n,(function(n){e=n.call(r,e,t)})),e},ce=oe,fe=te,le=se;function he(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new le("canceled")}var pe=v,de=function(e,t){t=t||{};var n={};function r(e,t){return pe.isPlainObject(e)&&pe.isPlainObject(t)?pe.merge(e,t):pe.isPlainObject(t)?pe.merge({},t):pe.isArray(t)?t.slice():t}function o(n){return pe.isUndefined(t[n])?pe.isUndefined(e[n])?void 0:r(void 0,e[n]):r(e[n],t[n])}function i(e){if(!pe.isUndefined(t[e]))return r(void 0,t[e])}function s(n){return pe.isUndefined(t[n])?pe.isUndefined(e[n])?void 0:r(void 0,e[n]):r(void 0,t[n])}function a(n){return n in t?r(e[n],t[n]):n in e?r(void 0,e[n]):void 0}var u={url:i,method:i,data:i,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a};return pe.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||o,r=t(e);pe.isUndefined(r)&&t!==a||(n[e]=r)})),n},ye="0.24.0",me=ye,ve={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){ve[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var be={};ve.transitional=function(e,t,n){function r(e,t){return"[Axios v"+me+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,o,i){if(!1===e)throw new Error(r(o," has been removed"+(t?" in "+t:"")));return t&&!be[o]&&(be[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,i)}};var ge={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),o=r.length;o-- >0;){var i=r[o],s=t[i];if(s){var a=e[i],u=void 0===a||s(a,i,e);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:ve},we=v,je=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(b.isURLSearchParams(t))r=t.toString();else{var o=[];b.forEach(t,(function(e,t){null!=e&&(b.isArray(e)?t+="[]":e=[e],b.forEach(e,(function(e){b.isDate(e)?e=e.toISOString():b.isObject(e)&&(e=JSON.stringify(e)),o.push(g(t)+"="+g(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e},Ee=E,Se=function(e){return he(e),e.headers=e.headers||{},e.data=ue.call(e,e.data,e.headers,e.transformRequest),e.headers=ae.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ae.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||fe.adapter)(e).then((function(t){return he(e),t.data=ue.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return ce(t)||(he(e),t&&t.response&&(t.response.data=ue.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Oe=de,Ae=ge,Te=Ae.validators;function Pe(e){this.defaults=e,this.interceptors={request:new Ee,response:new Ee}}Pe.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Oe(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&Ae.assertOptions(t,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean)},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var s=[Se,void 0];for(Array.prototype.unshift.apply(s,n),s=s.concat(i),o=Promise.resolve(e);s.length;)o=o.then(s.shift(),s.shift());return o}for(var a=e;n.length;){var u=n.shift(),c=n.shift();try{a=u(a)}catch(e){c(e);break}}try{o=Se(a)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},Pe.prototype.getUri=function(e){return e=Oe(this.defaults,e),je(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},we.forEach(["delete","get","head","options"],(function(e){Pe.prototype[e]=function(t,n){return this.request(Oe(n||{},{method:e,url:t,data:(n||{}).data}))}})),we.forEach(["post","put","patch"],(function(e){Pe.prototype[e]=function(t,n,r){return this.request(Oe(r||{},{method:e,url:t,data:n}))}}));var xe=Pe,Re=se;function Ne(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new Re(e),t(n.reason))}))}Ne.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Ne.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},Ne.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},Ne.source=function(){var e;return{token:new Ne((function(t){e=t})),cancel:e}};var _e=Ne,qe=v,Ce=u,Ue=xe,ke=de;var Be=function e(t){var n=new Ue(t),r=Ce(Ue.prototype.request,n);return qe.extend(r,Ue.prototype,n),qe.extend(r,n),r.create=function(n){return e(ke(t,n))},r}(te);Be.Axios=Ue,Be.Cancel=se,Be.CancelToken=_e,Be.isCancel=oe,Be.VERSION=ye,Be.all=function(e){return Promise.all(e)},Be.spread=function(e){return function(t){return e.apply(null,t)}},Be.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError},a.exports=Be,a.exports.default=Be;var Le=a.exports,De=function(e,t){var n="color: #4CAF50; font-weight: bold";return e&&Object.keys(e).length>0&&console.info("%c REQUEST: DATA ===> ",n,{data:e}),console.info("%c REQUEST: HEADERS ===> ",n,{headers:t}),e},Fe=function(e){return console.info("%c RESPONSE: DATA ===> ","color: #4CAF50; font-weight: bold",e),e};function Je(e,t){return function(n){ | ||
/** | ||
@@ -28,2 +28,3 @@ * @license | ||
* Released under the MIT license. | ||
*/function Le(e,t){return function(r){return function(e,t){if(void 0===t&&(t="contract violation"),!e)throw new Error(t)}(e(r),t)}}var De=Le((function(e){if(e){var t={}.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t}return!1}),"Must be function"),Fe=Le((function(e){return"[object Object]"=={}.toString.call(e)}),"Must be object"),Je=Le((function(e){return"[object String]"=={}.toString.call(e)}),"Must be string"),Me=function(e,t){var r="color: #4CAF50; font-weight: bold";return e&&Object.keys(e).length>0&&console.info("%c REQUEST: DATA ===> ",r,{data:e}),console.info("%c REQUEST: HEADERS ===> ",r,{headers:t}),e},Ie=function(e){return console.info("%c RESPONSE: DATA ===> ","color: #4CAF50; font-weight: bold",e),e},He=function(){function e(e){e&&Fe(e),this.client=Be.create(e),this.transformRequest=this.client.defaults.transformRequest,this.transformResponse=this.client.defaults.transformResponse}return e.prototype.setBaseUrl=function(e){return Je(e),this.client.defaults.baseURL=e,this},e.prototype.transforms=function(e){var t=void 0===e?{}:e,r=t.request,n=void 0===r?[]:r,o=t.response,i=void 0===o?[]:o;return Array.isArray(this.transformRequest)&&Array.isArray(this.transformResponse)&&(this.transformRequest.concat(n),this.transformResponse.concat(i)),this},e.prototype.intercepts=function(e){var t=e.request,r=void 0===t?function(e){return e}:t,n=e.response,o=void 0===n?function(e){return e}:n,i=e.error,s=void 0===i?function(e){return e}:i;return De(r),De(o),De(s),this.client.interceptors.request.use(r),this.client.interceptors.response.use(o,s),this},e.prototype.logs=function(e){var t=void 0===e?{}:e,r=t.request,n=void 0===r||r,o=t.response,i=void 0===o||o;return Array.isArray(this.transformRequest)&&Array.isArray(this.transformResponse)&&(n&&(this.transformRequest=this.transformRequest.concat(Me)),i&&(this.transformResponse=this.transformResponse.concat(Ie))),this},e.prototype.get=function(e,r){return null!=r&&De(r),this.client(t({method:"get"},e)).then(r).catch(r)},e.prototype.post=function(e,r){return null!=r&&De(r),this.client(t({method:"post"},e)).then(r).catch(r)},e.prototype.put=function(e,r){return null!=r&&De(r),this.client(t({method:"put"},e)).then(r).catch(r)},e.prototype.delete=function(e,r){return null!=r&&De(r),this.client(t({method:"delete"},e)).then(r).catch(r)},e.prototype.serialGet=function(e,t){return o(this,arguments,(function(){var o,i,s,a,u;return r(this,(function(r){switch(r.label){case 0:null!=t&&De(t),o=0,i=e,r.label=1;case 1:if(!(o<i.length))return[3,18];s=i[o],r.label=2;case 2:return r.trys.push([2,10,,17]),[4,n(this.get(s))];case 3:return a=r.sent(),t?[4,n(t(a))]:[3,6];case 4:return[4,r.sent()];case 5:return r.sent(),[3,9];case 6:return[4,n(a)];case 7:return[4,r.sent()];case 8:r.sent(),r.label=9;case 9:return[3,17];case 10:return u=r.sent(),t?[4,n(t(u))]:[3,13];case 11:return[4,r.sent()];case 12:return r.sent(),[3,16];case 13:return[4,n(new Promise((function(e,t){return t(new Error(u))})))];case 14:return[4,r.sent()];case 15:r.sent(),r.label=16;case 16:return[3,17];case 17:return o++,[3,1];case 18:return[2]}}))}))},e.prototype.serialPost=function(e,t){return o(this,arguments,(function(){var o,i,s,a,u;return r(this,(function(r){switch(r.label){case 0:null!=t&&De(t),o=0,i=e,r.label=1;case 1:if(!(o<i.length))return[3,18];s=i[o],r.label=2;case 2:return r.trys.push([2,10,,17]),[4,n(this.post(s))];case 3:return a=r.sent(),t?[4,n(t(a))]:[3,6];case 4:return[4,r.sent()];case 5:return r.sent(),[3,9];case 6:return[4,n(a)];case 7:return[4,r.sent()];case 8:r.sent(),r.label=9;case 9:return[3,17];case 10:return u=r.sent(),t?[4,n(t(u))]:[3,13];case 11:return[4,r.sent()];case 12:return r.sent(),[3,16];case 13:return[4,n(new Promise((function(e,t){return t(new Error(u))})))];case 14:return[4,r.sent()];case 15:r.sent(),r.label=16;case 16:return[3,17];case 17:return o++,[3,1];case 18:return[2]}}))}))},e.prototype.serialPut=function(e,t){return o(this,arguments,(function(){var o,i,s,a,u;return r(this,(function(r){switch(r.label){case 0:null!=t&&De(t),o=0,i=e,r.label=1;case 1:if(!(o<i.length))return[3,18];s=i[o],r.label=2;case 2:return r.trys.push([2,10,,17]),[4,n(this.put(s))];case 3:return a=r.sent(),t?[4,n(t(a))]:[3,6];case 4:return[4,r.sent()];case 5:return r.sent(),[3,9];case 6:return[4,n(a)];case 7:return[4,r.sent()];case 8:r.sent(),r.label=9;case 9:return[3,17];case 10:return u=r.sent(),t?[4,n(t(u))]:[3,13];case 11:return[4,r.sent()];case 12:return r.sent(),[3,16];case 13:return[4,n(new Promise((function(e,t){return t(new Error(u))})))];case 14:return[4,r.sent()];case 15:r.sent(),r.label=16;case 16:return[3,17];case 17:return o++,[3,1];case 18:return[2]}}))}))},e.prototype.serialDelete=function(e,t){return o(this,arguments,(function(){var o,i,s,a,u;return r(this,(function(r){switch(r.label){case 0:null!=t&&De(t),o=0,i=e,r.label=1;case 1:if(!(o<i.length))return[3,18];s=i[o],r.label=2;case 2:return r.trys.push([2,10,,17]),[4,n(this.delete(s))];case 3:return a=r.sent(),t?[4,n(t(a))]:[3,6];case 4:return[4,r.sent()];case 5:return r.sent(),[3,9];case 6:return[4,n(a)];case 7:return[4,r.sent()];case 8:r.sent(),r.label=9;case 9:return[3,17];case 10:return u=r.sent(),t?[4,n(t(u))]:[3,13];case 11:return[4,r.sent()];case 12:return r.sent(),[3,16];case 13:return[4,n(new Promise((function(e,t){return t(new Error(u))})))];case 14:return[4,r.sent()];case 15:r.sent(),r.label=16;case 16:return[3,17];case 17:return o++,[3,1];case 18:return[2]}}))}))},e}();e.HttpClient=He,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/ | ||
return function(e,t){if(void 0===t&&(t="contract violation"),!e)throw new Error(t)}(e(n),t)}}var Me=Je((function(e){if(e){var t={}.toString.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t}return!1}),"Must be function"),Ie=Je((function(e){return"[object Object]"=={}.toString.call(e)}),"Must be object"),He=Je((function(e){return"[object String]"=={}.toString.call(e)}),"Must be string"),ze=function(){function e(e){e&&Ie(e),this.client=Le.create(e),this.transformRequest=this.client.defaults.transformRequest,this.transformResponse=this.client.defaults.transformResponse}return e.prototype.setBaseUrl=function(e){return He(e),this.client.defaults.baseURL=e,this},e.prototype.transforms=function(e){var t=void 0===e?{}:e,n=t.request,r=void 0===n?[]:n,o=t.response,i=void 0===o?[]:o;return Array.isArray(this.transformRequest)&&Array.isArray(this.transformResponse)&&(this.transformRequest.concat(r),this.transformResponse.concat(i)),this},e.prototype.intercepts=function(e){var t=e.request,n=void 0===t?function(e){return e}:t,r=e.response,o=void 0===r?function(e){return e}:r,i=e.error,s=void 0===i?function(e){return e}:i;return Me(n),Me(o),Me(s),this.client.interceptors.request.use(n),this.client.interceptors.response.use(o,s),this},e.prototype.logs=function(e){var t=void 0===e?{}:e,n=t.request,r=void 0===n||n,o=t.response,i=void 0===o||o;return Array.isArray(this.transformRequest)&&Array.isArray(this.transformResponse)&&(r&&(this.transformRequest=this.transformRequest.concat(De)),i&&(this.transformResponse=this.transformResponse.concat(Fe))),this},e.prototype.get=function(e,o){return n(this,void 0,void 0,(function(){return r(this,(function(n){return null!=o&&Me(o),[2,this.client(t({method:"get"},e)).then(o).catch(o)]}))}))},e.prototype.post=function(e,o){return n(this,void 0,void 0,(function(){return r(this,(function(n){return null!=o&&Me(o),[2,this.client(t({method:"post"},e)).then(o).catch(o)]}))}))},e.prototype.put=function(e,o){return n(this,void 0,void 0,(function(){return r(this,(function(n){return null!=o&&Me(o),[2,this.client(t({method:"put"},e)).then(o).catch(o)]}))}))},e.prototype.delete=function(e,o){return n(this,void 0,void 0,(function(){return r(this,(function(n){return null!=o&&Me(o),[2,this.client(t({method:"delete"},e)).then(o).catch(o)]}))}))},e.prototype.serialGet=function(e,t){return i(this,arguments,(function(){var n,i,s,a,u;return r(this,(function(r){switch(r.label){case 0:null!=t&&Me(t),n=0,i=e,r.label=1;case 1:if(!(n<i.length))return[3,18];s=i[n],r.label=2;case 2:return r.trys.push([2,10,,17]),[4,o(this.get(s))];case 3:return a=r.sent(),t?[4,o(t(a))]:[3,6];case 4:return[4,r.sent()];case 5:return r.sent(),[3,9];case 6:return[4,o(a)];case 7:return[4,r.sent()];case 8:r.sent(),r.label=9;case 9:return[3,17];case 10:return u=r.sent(),t?[4,o(t(u))]:[3,13];case 11:return[4,r.sent()];case 12:return r.sent(),[3,16];case 13:return[4,o(new Promise((function(e,t){t(new Error(u))})))];case 14:return[4,r.sent()];case 15:r.sent(),r.label=16;case 16:return[3,17];case 17:return n++,[3,1];case 18:return[2]}}))}))},e.prototype.serialPost=function(e,t){return i(this,arguments,(function(){var n,i,s,a,u;return r(this,(function(r){switch(r.label){case 0:null!=t&&Me(t),n=0,i=e,r.label=1;case 1:if(!(n<i.length))return[3,18];s=i[n],r.label=2;case 2:return r.trys.push([2,10,,17]),[4,o(this.post(s))];case 3:return a=r.sent(),t?[4,o(t(a))]:[3,6];case 4:return[4,r.sent()];case 5:return r.sent(),[3,9];case 6:return[4,o(a)];case 7:return[4,r.sent()];case 8:r.sent(),r.label=9;case 9:return[3,17];case 10:return u=r.sent(),t?[4,o(t(u))]:[3,13];case 11:return[4,r.sent()];case 12:return r.sent(),[3,16];case 13:return[4,o(new Promise((function(e,t){t(new Error(u))})))];case 14:return[4,r.sent()];case 15:r.sent(),r.label=16;case 16:return[3,17];case 17:return n++,[3,1];case 18:return[2]}}))}))},e.prototype.serialPut=function(e,t){return i(this,arguments,(function(){var n,i,s,a,u;return r(this,(function(r){switch(r.label){case 0:null!=t&&Me(t),n=0,i=e,r.label=1;case 1:if(!(n<i.length))return[3,18];s=i[n],r.label=2;case 2:return r.trys.push([2,10,,17]),[4,o(this.put(s))];case 3:return a=r.sent(),t?[4,o(t(a))]:[3,6];case 4:return[4,r.sent()];case 5:return r.sent(),[3,9];case 6:return[4,o(a)];case 7:return[4,r.sent()];case 8:r.sent(),r.label=9;case 9:return[3,17];case 10:return u=r.sent(),t?[4,o(t(u))]:[3,13];case 11:return[4,r.sent()];case 12:return r.sent(),[3,16];case 13:return[4,o(new Promise((function(e,t){t(new Error(u))})))];case 14:return[4,r.sent()];case 15:r.sent(),r.label=16;case 16:return[3,17];case 17:return n++,[3,1];case 18:return[2]}}))}))},e.prototype.serialDelete=function(e,t){return i(this,arguments,(function(){var n,i,s,a,u;return r(this,(function(r){switch(r.label){case 0:null!=t&&Me(t),n=0,i=e,r.label=1;case 1:if(!(n<i.length))return[3,18];s=i[n],r.label=2;case 2:return r.trys.push([2,10,,17]),[4,o(this.delete(s))];case 3:return a=r.sent(),t?[4,o(t(a))]:[3,6];case 4:return[4,r.sent()];case 5:return r.sent(),[3,9];case 6:return[4,o(a)];case 7:return[4,r.sent()];case 8:r.sent(),r.label=9;case 9:return[3,17];case 10:return u=r.sent(),t?[4,o(t(u))]:[3,13];case 11:return[4,r.sent()];case 12:return r.sent(),[3,16];case 13:return[4,o(new Promise((function(e,t){t(new Error(u))})))];case 14:return[4,r.sent()];case 15:r.sent(),r.label=16;case 16:return[3,17];case 17:return n++,[3,1];case 18:return[2]}}))}))},e}();e.HttpClient=ze,Object.defineProperty(e,"__esModule",{value:!0})})); |
export { CancelToken } from 'axios'; | ||
interface IBaseClientInstance { | ||
<T = any>(config: IRequestConfig): Promise<T>; | ||
<T = any>(url: string, config?: IRequestConfig): Promise<T>; | ||
defaults: IDefaults; | ||
@@ -9,5 +12,2 @@ interceptors: { | ||
}; | ||
<T = any>(config: IRequestConfig): Promise<T>; | ||
<T = any>(url: string, config?: IRequestConfig): Promise<T>; | ||
} | ||
@@ -53,22 +53,22 @@ | ||
type Method = | ||
| 'DELETE' | ||
| 'delete' | ||
| 'GET' | ||
| 'get' | ||
| 'GET' | ||
| 'delete' | ||
| 'DELETE' | ||
| 'HEAD' | ||
| 'head' | ||
| 'HEAD' | ||
| 'LINK' | ||
| 'link' | ||
| 'OPTIONS' | ||
| 'options' | ||
| 'OPTIONS' | ||
| 'PATCH' | ||
| 'patch' | ||
| 'POST' | ||
| 'post' | ||
| 'POST' | ||
| 'PURGE' | ||
| 'purge' | ||
| 'PUT' | ||
| 'put' | ||
| 'PUT' | ||
| 'patch' | ||
| 'PATCH' | ||
| 'purge' | ||
| 'PURGE' | ||
| 'link' | ||
| 'LINK' | ||
| 'unlink' | ||
| 'UNLINK'; | ||
| 'UNLINK' | ||
| 'unlink'; | ||
@@ -80,4 +80,4 @@ type ResponseType = | ||
| 'json' | ||
| 'text' | ||
| 'stream'; | ||
| 'stream' | ||
| 'text'; | ||
@@ -165,3 +165,3 @@ interface TransitionalOptions { | ||
interface IPromise<T = any> extends Promise<IResponse<T>> {} | ||
type IPromise<T = any> = Promise<IResponse<T>>; | ||
@@ -180,3 +180,3 @@ interface Cancel { | ||
use<T = V>( | ||
onFulfilled?: (value: V) => T | Promise<T>, | ||
onFulfilled?: (value: V) => Promise<T> | T, | ||
onRejected?: (error: any) => any | ||
@@ -183,0 +183,0 @@ ): number; |
{ | ||
"name": "http-factory", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "declarative, strongly-typed http clients and serial requests", | ||
@@ -37,6 +37,5 @@ "keywords": [ | ||
"docgen": "pnpm dts && tsc && api-extractor run --local && api-documenter markdown -i temp -o docs", | ||
"lint": "eslint --ext .js,.ts,.json --no-fix .", | ||
"lint": "eslint --ext .js,.ts,.json --fix .", | ||
"mock:db": "json-server mock/db.json &", | ||
"mock:reset": "chmod -R u+x ./scripts && ./scripts/setup_db.sh", | ||
"postinstall": "husky install", | ||
"prerelease": "npm pack && tar -xvzf *.tgz && rimraf package *.tgz", | ||
@@ -70,3 +69,3 @@ "semantic-release": "semantic-release", | ||
"@commitlint/config-conventional": "^13.1.0", | ||
"@magister_zito/eslint-config-typescript": "0.0.8", | ||
"@magister_zito/eslint-config": "0.4.0", | ||
"@microsoft/api-documenter": "^7.9.10", | ||
@@ -79,3 +78,2 @@ "@microsoft/api-extractor": "^7.10.4", | ||
"@types/jest": "27.0.2", | ||
"@typescript-eslint/eslint-plugin": "5.1.0", | ||
"axios": "0.24.0", | ||
@@ -86,3 +84,2 @@ "copyfiles": "2.4.1", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-jest": "25.2.2", | ||
"heuristics": "1.1.0", | ||
@@ -89,0 +86,0 @@ "husky": "7.0.2", |
Sorry, the diff of this file is too big to display
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
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
231407
31
6092
0