@wiajs/req 1.7.28 → 1.7.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/req.cjs +91 -91
- package/dist/req.js +2 -2
- package/dist/req.min.js +2 -2
- package/dist/web/req.cjs +2 -2
- package/dist/web/req.mjs +2 -2
- package/lib/adapters/http.js +13 -13
- package/package.json +227 -214
package/dist/node/req.cjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wia/req v1.7.
|
|
3
|
-
* (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
|
|
2
|
+
* @wia/req v1.7.29
|
|
3
|
+
* (c) 2024-2025 Sibyl Yu, Matt Zabriskie and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
const FormData$1 = require('form-data');
|
|
9
9
|
const url = require('node:url');
|
|
10
|
-
const request = require('@wiajs/request');
|
|
11
10
|
const agent = require('@wiajs/agent');
|
|
12
11
|
const log$1 = require('@wiajs/log');
|
|
12
|
+
const request = require('@wiajs/request');
|
|
13
13
|
const util = require('node:util');
|
|
14
|
-
const
|
|
14
|
+
const node_events = require('node:events');
|
|
15
15
|
const stream$1 = require('node:stream');
|
|
16
|
+
const zlib = require('node:zlib');
|
|
16
17
|
const stream = require('stream');
|
|
17
|
-
const node_events = require('node:events');
|
|
18
18
|
|
|
19
19
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
20
20
|
function bind(fn, thisArg) {
|
|
@@ -2023,32 +2023,6 @@ utils$1.inherits(CanceledError, AxiosError, {
|
|
|
2023
2023
|
__CANCEL__: true
|
|
2024
2024
|
});
|
|
2025
2025
|
|
|
2026
|
-
/**
|
|
2027
|
-
* Resolve or reject a Promise based on response status.
|
|
2028
|
-
*
|
|
2029
|
-
* @param {Function} resolve A function that resolves the promise.
|
|
2030
|
-
* @param {Function} reject A function that rejects the promise.
|
|
2031
|
-
* @param {object} response The response.
|
|
2032
|
-
*
|
|
2033
|
-
* @returns {object} The response.
|
|
2034
|
-
*/
|
|
2035
|
-
function settle(resolve, reject, response) {
|
|
2036
|
-
const validateStatus = response.config.validateStatus;
|
|
2037
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2038
|
-
resolve(response);
|
|
2039
|
-
} else {
|
|
2040
|
-
reject(
|
|
2041
|
-
new AxiosError(
|
|
2042
|
-
'Request failed with status code ' + response.status,
|
|
2043
|
-
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
2044
|
-
response.config,
|
|
2045
|
-
response.request,
|
|
2046
|
-
response
|
|
2047
|
-
)
|
|
2048
|
-
);
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
2026
|
/**
|
|
2053
2027
|
* Determines whether the specified URL is absolute
|
|
2054
2028
|
*
|
|
@@ -2094,61 +2068,34 @@ function buildFullPath(baseURL, requestedURL) {
|
|
|
2094
2068
|
return requestedURL;
|
|
2095
2069
|
}
|
|
2096
2070
|
|
|
2097
|
-
const VERSION = "1.7.7";
|
|
2098
|
-
|
|
2099
|
-
function parseProtocol(url) {
|
|
2100
|
-
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2101
|
-
return match && match[1] || '';
|
|
2102
|
-
}
|
|
2103
|
-
|
|
2104
|
-
const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
|
|
2105
|
-
|
|
2106
2071
|
/**
|
|
2107
|
-
*
|
|
2072
|
+
* Resolve or reject a Promise based on response status.
|
|
2108
2073
|
*
|
|
2109
|
-
* @param {
|
|
2110
|
-
* @param {
|
|
2111
|
-
* @param {
|
|
2112
|
-
* @param {?Function} options.Blob
|
|
2074
|
+
* @param {Function} resolve A function that resolves the promise.
|
|
2075
|
+
* @param {Function} reject A function that rejects the promise.
|
|
2076
|
+
* @param {object} response The response.
|
|
2113
2077
|
*
|
|
2114
|
-
* @returns {
|
|
2078
|
+
* @returns {object} The response.
|
|
2115
2079
|
*/
|
|
2116
|
-
function
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
|
-
const mime = match[1];
|
|
2134
|
-
const isBase64 = match[2];
|
|
2135
|
-
const body = match[3];
|
|
2136
|
-
const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');
|
|
2137
|
-
|
|
2138
|
-
if (asBlob) {
|
|
2139
|
-
if (!_Blob) {
|
|
2140
|
-
throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
|
|
2141
|
-
}
|
|
2142
|
-
|
|
2143
|
-
return new _Blob([buffer], {type: mime});
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
return buffer;
|
|
2080
|
+
function settle(resolve, reject, response) {
|
|
2081
|
+
const validateStatus = response.config.validateStatus;
|
|
2082
|
+
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2083
|
+
resolve(response);
|
|
2084
|
+
} else {
|
|
2085
|
+
reject(
|
|
2086
|
+
new AxiosError(
|
|
2087
|
+
'Request failed with status code ' + response.status,
|
|
2088
|
+
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
2089
|
+
response.config,
|
|
2090
|
+
response.request,
|
|
2091
|
+
response
|
|
2092
|
+
)
|
|
2093
|
+
);
|
|
2147
2094
|
}
|
|
2148
|
-
|
|
2149
|
-
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
2150
2095
|
}
|
|
2151
2096
|
|
|
2097
|
+
const VERSION = "1.7.7";
|
|
2098
|
+
|
|
2152
2099
|
const kInternals = Symbol('internals');
|
|
2153
2100
|
|
|
2154
2101
|
class AxiosTransformStream extends stream.Transform {
|
|
@@ -2286,6 +2233,19 @@ class AxiosTransformStream extends stream.Transform {
|
|
|
2286
2233
|
}
|
|
2287
2234
|
}
|
|
2288
2235
|
|
|
2236
|
+
const callbackify = (fn, reducer) => {
|
|
2237
|
+
return utils$1.isAsyncFn(fn) ? function (...args) {
|
|
2238
|
+
const cb = args.pop();
|
|
2239
|
+
fn.apply(this, args).then((value) => {
|
|
2240
|
+
try {
|
|
2241
|
+
reducer ? cb(null, ...reducer(value)) : cb(null, value);
|
|
2242
|
+
} catch (err) {
|
|
2243
|
+
cb(err);
|
|
2244
|
+
}
|
|
2245
|
+
}, cb);
|
|
2246
|
+
} : fn;
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2289
2249
|
const {asyncIterator} = Symbol;
|
|
2290
2250
|
|
|
2291
2251
|
const readBlob = async function* (blob) {
|
|
@@ -2405,18 +2365,58 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
|
2405
2365
|
})());
|
|
2406
2366
|
};
|
|
2407
2367
|
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2368
|
+
function parseProtocol(url) {
|
|
2369
|
+
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2370
|
+
return match && match[1] || '';
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
|
|
2374
|
+
|
|
2375
|
+
/**
|
|
2376
|
+
* Parse data uri to a Buffer or Blob
|
|
2377
|
+
*
|
|
2378
|
+
* @param {String} uri
|
|
2379
|
+
* @param {?Boolean} asBlob
|
|
2380
|
+
* @param {?Object} options
|
|
2381
|
+
* @param {?Function} options.Blob
|
|
2382
|
+
*
|
|
2383
|
+
* @returns {Buffer|Blob}
|
|
2384
|
+
*/
|
|
2385
|
+
function fromDataURI(uri, asBlob, options) {
|
|
2386
|
+
const _Blob = options && options.Blob || platform.classes.Blob;
|
|
2387
|
+
const protocol = parseProtocol(uri);
|
|
2388
|
+
|
|
2389
|
+
if (asBlob === undefined && _Blob) {
|
|
2390
|
+
asBlob = true;
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
if (protocol === 'data') {
|
|
2394
|
+
uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
|
|
2395
|
+
|
|
2396
|
+
const match = DATA_URL_PATTERN.exec(uri);
|
|
2397
|
+
|
|
2398
|
+
if (!match) {
|
|
2399
|
+
throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
const mime = match[1];
|
|
2403
|
+
const isBase64 = match[2];
|
|
2404
|
+
const body = match[3];
|
|
2405
|
+
const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');
|
|
2406
|
+
|
|
2407
|
+
if (asBlob) {
|
|
2408
|
+
if (!_Blob) {
|
|
2409
|
+
throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
|
|
2416
2410
|
}
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
}
|
|
2411
|
+
|
|
2412
|
+
return new _Blob([buffer], {type: mime});
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
return buffer;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
2419
|
+
}
|
|
2420
2420
|
|
|
2421
2421
|
/**
|
|
2422
2422
|
* Calculate data maxRate
|
|
@@ -2590,7 +2590,7 @@ const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(
|
|
|
2590
2590
|
|
|
2591
2591
|
/**
|
|
2592
2592
|
* !+++
|
|
2593
|
-
* 将request
|
|
2593
|
+
* 将request 函数改为类,request 拆分为 init 初始化和 请求执行,
|
|
2594
2594
|
* 如需重新发起请求时,无需重新初始化
|
|
2595
2595
|
*/
|
|
2596
2596
|
class HttpAdapter {
|
package/dist/req.js
CHANGED
package/dist/req.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wia/req v1.7.
|
|
3
|
-
* (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
|
|
2
|
+
* @wia/req v1.7.29
|
|
3
|
+
* (c) 2024-2025 Sibyl Yu, Matt Zabriskie and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).req=t()}(this,(function(){"use strict";function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:r}=Object,n=(o=Object.create(null),e=>{const r=t.call(e);return o[r]||(o[r]=r.slice(8,-1).toLowerCase())});var o;const s=e=>(e=e.toLowerCase(),t=>n(t)===e),i=e=>t=>typeof t===e,{isArray:a}=Array,c=i("undefined");const u=s("ArrayBuffer");const l=i("string"),f=i("function"),p=i("number"),h=e=>null!==e&&"object"==typeof e,d=e=>{if("object"!==n(e))return!1;const t=r(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},m=s("Date"),y=s("File"),b=s("Blob"),g=s("FileList"),O=s("URLSearchParams"),[E,w,S,A]=["ReadableStream","Request","Response","Headers"].map(s);function R(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),a(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(n=0;n<s;n++)i=o[n],t.call(null,e[i],i,e)}}function j(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,_=e=>!c(e)&&e!==T;const P=(F="undefined"!=typeof Uint8Array&&r(Uint8Array),e=>F&&e instanceof F);var F;const x=s("HTMLFormElement"),N=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),v=s("RegExp"),C=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};R(r,((r,o)=>{let s;!1!==(s=t(r,o,e))&&(n[o]=s||r)})),Object.defineProperties(e,n)},B="abcdefghijklmnopqrstuvwxyz",D="0123456789",L={DIGIT:D,ALPHA:B,ALPHA_DIGIT:B+B.toUpperCase()+D};const k=s("AsyncFunction"),U=(I="function"==typeof setImmediate,q=f(T.postMessage),I?setImmediate:q?(M=`axios@${Math.random()}`,z=[],T.addEventListener("message",(({source:e,data:t})=>{e===T&&t===M&&z.length&&z.shift()()}),!1),e=>{z.push(e),T.postMessage(M,"*")}):e=>setTimeout(e));var I,q,M,z;const H="undefined"!=typeof queueMicrotask?queueMicrotask.bind(T):"undefined"!=typeof process&&process.nextTick||U;var J={isArray:a,isArrayBuffer:u,isBuffer:function(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=n(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&u(e.buffer),t},isString:l,isNumber:p,isBoolean:e=>!0===e||!1===e,isObject:h,isPlainObject:d,isReadableStream:E,isRequest:w,isResponse:S,isHeaders:A,isUndefined:c,isDate:m,isFile:y,isBlob:b,isRegExp:v,isFunction:f,isStream:e=>h(e)&&f(e.pipe),isURLSearchParams:O,isTypedArray:P,isFileList:g,forEach:R,merge:function e(){const{caseless:t}=_(this)&&this||{},r={},n=(n,o)=>{const s=t&&j(r,o)||o;d(r[s])&&d(n)?r[s]=e(r[s],n):d(n)?r[s]=e({},n):a(n)?r[s]=n.slice():r[s]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&R(arguments[e],n);return r},extend:(t,r,n,{allOwnKeys:o}={})=>(R(r,((r,o)=>{n&&f(r)?t[o]=e(r,n):t[o]=r}),{allOwnKeys:o}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,n,o)=>{let s,i,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],o&&!o(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==n&&r(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},kindOf:n,kindOfTest:s,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(a(e))return e;let t=e.length;if(!p(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:x,hasOwnProperty:N,hasOwnProp:N,reduceDescriptors:C,freezeMethods:e=>{C(e,((t,r)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];f(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return a(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:j,global:T,isContextDefined:_,ALPHABET:L,generateString:(e=16,t=L.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(h(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=a(e)?[]:{};return R(e,((e,t)=>{const s=r(e,n+1);!c(s)&&(o[t]=s)})),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:k,isThenable:e=>e&&(h(e)||f(e))&&f(e.then)&&f(e.catch),setImmediate:U,asap:H,createErrorType:function(e,t,r){function n(r){Error.captureStackTrace(this,this.constructor),Object.assign(this,r||{}),this.code=e,this.message=this.cause?`${t}: ${this.cause.message}`:t}return n.prototype=new(r||Error),n.prototype.constructor=n,n.prototype.name=`Error [${e}]`,n}};function V(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}J.inherits(V,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:J.toJSONObject(this.config),code:this.code,status:this.status}}});const $=V.prototype,K={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{K[e]={value:e}})),Object.defineProperties(V,K),Object.defineProperty($,"isAxiosError",{value:!0}),V.from=(e,t,r,n,o,s)=>{const i=Object.create($);return J.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),V.call(i,e.message,t,r,n,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function W(e){return J.isPlainObject(e)||J.isArray(e)}function G(e){return J.endsWith(e,"[]")?e.slice(0,-2):e}function X(e,t,r){return e?e.concat(t).map((function(e,t){return e=G(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Z=J.toFlatObject(J,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Q(e,t,r){if(!J.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=J.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!J.isUndefined(t[e])}))).metaTokens,o=r.visitor||u,s=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&J.isSpecCompliantForm(t);if(!J.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(J.isDate(e))return e.toISOString();if(!a&&J.isBlob(e))throw new V("Blob is not supported. Use a Buffer instead.");return J.isArrayBuffer(e)||J.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(J.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(J.isArray(e)&&function(e){return J.isArray(e)&&!e.some(W)}(e)||(J.isFileList(e)||J.endsWith(r,"[]"))&&(a=J.toArray(e)))return r=G(r),a.forEach((function(e,n){!J.isUndefined(e)&&null!==e&&t.append(!0===i?X([r],n,s):null===i?r:r+"[]",c(e))})),!1;return!!W(e)||(t.append(X(o,r,s),c(e)),!1)}const l=[],f=Object.assign(Z,{defaultVisitor:u,convertValue:c,isVisitable:W});if(!J.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!J.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),J.forEach(r,(function(r,s){!0===(!(J.isUndefined(r)||null===r)&&o.call(t,r,J.isString(s)?s.trim():s,n,f))&&e(r,n?n.concat(s):[s])})),l.pop()}}(e),t}function Y(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ee(e,t){this._pairs=[],e&&Q(e,this,t)}const te=ee.prototype;function re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}te.append=function(e,t){this._pairs.push([e,t])},te.toString=function(e){const t=e?function(t){return e.call(this,t,Y)}:Y;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var ne=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){J.forEach(this.handlers,(function(t){null!==t&&e(t)}))}};const{toString:oe}=Object.prototype,{getPrototypeOf:se}=Object,ie=(e=>t=>{const r=oe.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ae=e=>(e=e.toLowerCase(),t=>ie(t)===e),ce=e=>t=>typeof t===e,{isArray:ue}=Array,le=ce("undefined");const fe=ae("ArrayBuffer");const pe=ce("string"),he=ce("function"),de=ce("number"),me=e=>null!==e&&"object"==typeof e,ye=e=>{if("object"!==ie(e))return!1;const t=se(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},be=ae("Date"),ge=ae("File"),Oe=ae("Blob"),Ee=ae("FileList"),we=ae("URLSearchParams"),[Se,Ae,Re,je]=["ReadableStream","Request","Response","Headers"].map(ae);function Te(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,o;if("object"!=typeof e&&(e=[e]),ue(e))for(n=0,o=e.length;n<o;n++)t.call(null,e[n],n,e);else{const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let i;for(n=0;n<s;n++)i=o[n],t.call(null,e[i],i,e)}}function _e(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,o=r.length;for(;o-- >0;)if(n=r[o],t===n.toLowerCase())return n;return null}const Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Fe=e=>!le(e)&&e!==Pe;const xe=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&se(Uint8Array)),Ne=ae("HTMLFormElement"),ve=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ce=ae("RegExp"),Be=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Te(r,((r,o)=>{let s;!1!==(s=t(r,o,e))&&(n[o]=s||r)})),Object.defineProperties(e,n)},De="abcdefghijklmnopqrstuvwxyz",Le="0123456789",ke={DIGIT:Le,ALPHA:De,ALPHA_DIGIT:De+De.toUpperCase()+Le};const Ue=ae("AsyncFunction"),Ie=((e,t)=>e?setImmediate:t?((e,t)=>(Pe.addEventListener("message",(({source:r,data:n})=>{r===Pe&&n===e&&t.length&&t.shift()()}),!1),r=>{t.push(r),Pe.postMessage(e,"*")}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))("function"==typeof setImmediate,he(Pe.postMessage)),qe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Pe):"undefined"!=typeof process&&process.nextTick||Ie;var Me={isArray:ue,isArrayBuffer:fe,isBuffer:function(e){return null!==e&&!le(e)&&null!==e.constructor&&!le(e.constructor)&&he(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||he(e.append)&&("formdata"===(t=ie(e))||"object"===t&&he(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&fe(e.buffer),t},isString:pe,isNumber:de,isBoolean:e=>!0===e||!1===e,isObject:me,isPlainObject:ye,isReadableStream:Se,isRequest:Ae,isResponse:Re,isHeaders:je,isUndefined:le,isDate:be,isFile:ge,isBlob:Oe,isRegExp:Ce,isFunction:he,isStream:e=>me(e)&&he(e.pipe),isURLSearchParams:we,isTypedArray:xe,isFileList:Ee,forEach:Te,merge:function e(){const{caseless:t}=Fe(this)&&this||{},r={},n=(n,o)=>{const s=t&&_e(r,o)||o;ye(r[s])&&ye(n)?r[s]=e(r[s],n):ye(n)?r[s]=e({},n):ue(n)?r[s]=n.slice():r[s]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Te(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(Te(t,((t,n)=>{r&&he(t)?e[n]=function(e,t){return function(){return e.apply(t,arguments)}}(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let o,s,i;const a={};if(t=t||{},null==e)return t;do{for(o=Object.getOwnPropertyNames(e),s=o.length;s-- >0;)i=o[s],n&&!n(i,e,t)||a[i]||(t[i]=e[i],a[i]=!0);e=!1!==r&&se(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:ie,kindOfTest:ae,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(ue(e))return e;let t=e.length;if(!de(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Ne,hasOwnProperty:ve,hasOwnProp:ve,reduceDescriptors:Be,freezeMethods:e=>{Be(e,((t,r)=>{if(he(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];he(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return ue(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:_e,global:Pe,isContextDefined:Fe,ALPHABET:ke,generateString:(e=16,t=ke.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&he(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(me(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const o=ue(e)?[]:{};return Te(e,((e,t)=>{const s=r(e,n+1);!le(s)&&(o[t]=s)})),t[n]=void 0,o}}return e};return r(e,0)},isAsyncFn:Ue,isThenable:e=>e&&(me(e)||he(e))&&he(e.then)&&he(e.catch),setImmediate:Ie,asap:qe,createErrorType:function(e,t,r){function n(r){Error.captureStackTrace(this,this.constructor),Object.assign(this,r||{}),this.code=e,this.message=this.cause?`${t}: ${this.cause.message}`:t}return n.prototype=new(r||Error),n.prototype.constructor=n,n.prototype.name=`Error [${e}]`,n}};function ze(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}Me.inherits(ze,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Me.toJSONObject(this.config),code:this.code,status:this.status}}});const He=ze.prototype,Je={};function Ve(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{Je[e]={value:e}})),Object.defineProperties(ze,Je),Object.defineProperty(He,"isAxiosError",{value:!0}),ze.from=(e,t,r,n,o,s)=>{const i=Object.create(He);return Me.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),ze.call(i,e.message,t,r,n,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};var $e=Ve("object"==typeof self?self.FormData:window.FormData);function Ke(e){return Me.isPlainObject(e)||Me.isArray(e)}function We(e){return Me.endsWith(e,"[]")?e.slice(0,-2):e}function Ge(e,t,r){return e?e.concat(t).map((function(e,t){return e=We(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Xe=Me.toFlatObject(Me,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Ze(e,t,r){if(!Me.isObject(e))throw new TypeError("target must be an object");t=t||new($e||FormData);const n=(r=Me.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Me.isUndefined(t[e])}))).metaTokens,o=r.visitor||u,s=r.dots,i=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Me.isSpecCompliantForm(t);if(!Me.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(Me.isDate(e))return e.toISOString();if(!a&&Me.isBlob(e))throw new ze("Blob is not supported. Use a Buffer instead.");return Me.isArrayBuffer(e)||Me.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,o){let a=e;if(e&&!o&&"object"==typeof e)if(Me.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(Me.isArray(e)&&function(e){return Me.isArray(e)&&!e.some(Ke)}(e)||(Me.isFileList(e)||Me.endsWith(r,"[]"))&&(a=Me.toArray(e)))return r=We(r),a.forEach((function(e,n){!Me.isUndefined(e)&&null!==e&&t.append(!0===i?Ge([r],n,s):null===i?r:r+"[]",c(e))})),!1;return!!Ke(e)||(t.append(Ge(o,r,s),c(e)),!1)}const l=[],f=Object.assign(Xe,{defaultVisitor:u,convertValue:c,isVisitable:Ke});if(!Me.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!Me.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),Me.forEach(r,(function(r,s){!0===(!(Me.isUndefined(r)||null===r)&&o.call(t,r,Me.isString(s)?s.trim():s,n,f))&&e(r,n?n.concat(s):[s])})),l.pop()}}(e),t}function Qe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Ye(e,t){this._pairs=[],e&&Ze(e,this,t)}const et=Ye.prototype;et.append=function(e,t){this._pairs.push([e,t])},et.toString=function(e){const t=e?function(t){return e.call(this,t,Qe)}:Qe;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var tt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ye,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const rt="undefined"!=typeof window&&"undefined"!=typeof document,nt="object"==typeof navigator&&navigator||void 0,ot=rt&&(!nt||["ReactNative","NativeScript","NS"].indexOf(nt.product)<0),st="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,it=rt&&window.location.href||"http://localhost";var at={...Object.freeze({__proto__:null,hasBrowserEnv:rt,hasStandardBrowserEnv:ot,hasStandardBrowserWebWorkerEnv:st,navigator:nt,origin:it}),...tt};function ct(e){function t(e,r,n,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&J.isArray(n)?n.length:s,a)return J.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!i;n[s]&&J.isObject(n[s])||(n[s]=[]);return t(e,r,n[s],o)&&J.isArray(n[s])&&(n[s]=function(e){const t={},r=Object.keys(e);let n;const o=r.length;let s;for(n=0;n<o;n++)s=r[n],t[s]=e[s];return t}(n[s])),!i}if(J.isFormData(e)&&J.isFunction(e.entries)){const r={};return J.forEachEntry(e,((e,n)=>{t(function(e){return J.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const ut={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,o=J.isObject(e);o&&J.isHTMLForm(e)&&(e=new FormData(e));if(J.isFormData(e))return n?JSON.stringify(ct(e)):e;if(J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)||J.isReadableStream(e))return e;if(J.isArrayBufferView(e))return e.buffer;if(J.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Q(e,new at.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return at.isNode&&J.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=J.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Q(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||n?(t.setContentType("application/json",!1),function(e,t,r){if(J.isString(e))try{return(t||JSON.parse)(e),J.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ut.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(J.isResponse(e)||J.isReadableStream(e))return e;if(e&&J.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw V.from(e,V.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:at.classes.FormData,Blob:at.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};J.forEach(["delete","get","head","post","put","patch"],(e=>{ut.headers[e]={}}));var lt=ut;const ft=J.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const pt=Symbol("internals");function ht(e){return e&&String(e).trim().toLowerCase()}function dt(e){return!1===e||null==e?e:J.isArray(e)?e.map(dt):String(e)}function mt(e,t,r,n,o){return J.isFunction(n)?n.call(this,t,r):(o&&(t=r),J.isString(t)?J.isString(n)?-1!==t.indexOf(n):J.isRegExp(n)?n.test(t):void 0:void 0)}let yt=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function o(e,t,r){const o=ht(t);if(!o)throw new Error("header name must be a non-empty string");const s=J.findKey(n,o);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||t]=dt(e))}const s=(e,t)=>J.forEach(e,((e,r)=>o(e,r,t)));if(J.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(J.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let r,n,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),r=e.substring(0,o).trim().toLowerCase(),n=e.substring(o+1).trim(),!r||t[r]&&ft[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t);else if(J.isHeaders(e))for(const[t,n]of e.entries())o(n,t,r);else null!=e&&o(t,e,r);return this}get(e,t){if(e=ht(e)){const r=J.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(J.isFunction(t))return t.call(this,e,r);if(J.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=ht(e)){const r=J.findKey(this,e);return!(!r||void 0===this[r]||t&&!mt(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function o(e){if(e=ht(e)){const o=J.findKey(r,e);!o||t&&!mt(0,r[o],o,t)||(delete r[o],n=!0)}}return J.isArray(e)?e.forEach(o):o(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const o=t[r];e&&!mt(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}normalize(e){const t=this,r={};return J.forEach(this,((n,o)=>{const s=J.findKey(r,o);if(s)return t[s]=dt(n),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(o):String(o).trim();i!==o&&delete t[o],t[i]=dt(n),r[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return J.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&J.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[pt]=this[pt]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=ht(e);t[n]||(!function(e,t){const r=J.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,o){return this[n].call(this,t,e,r,o)},configurable:!0})}))}(r,e),t[n]=!0)}return J.isArray(e)?e.forEach(n):n(e),this}};yt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),J.reduceDescriptors(yt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),J.freezeMethods(yt);var bt=yt;function gt(e,t){const r=this||lt,n=t||r,o=bt.from(n.headers);let s=n.data;return J.forEach(e,(function(e){s=e.call(r,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function Ot(e){return!(!e||!e.__CANCEL__)}function Et(e,t,r){V.call(this,null==e?"canceled":e,V.ERR_CANCELED,t,r),this.name="CanceledError"}J.inherits(Et,V,{__CANCEL__:!0});const wt="undefined"!=typeof XMLHttpRequest;const St={http:null,xhr:wt&&class{constructor(e){this.init(e)}init(e){}request(){}stream(){}}};J.forEach(St,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var At=e=>{e=J.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let o=0;o<t&&(r=e[o],!(n=J.isString(r)?St[r.toLowerCase()]:r));o++);if(!n){if(!1===n)throw new V(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(J.hasOwnProp(St,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!J.isFunction(n))throw new TypeError("adapter is not a function");return n};function Rt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Et(null,e)}function jt(e){let t;Rt(e),e.headers=bt.from(e.headers),e.data=gt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);const r=new(At(e.adapter||lt.adapter))(e);return t=e.stream?r.request(this):r.request(this).then((t=>(Rt(e),t.data=gt.call(e,e.transformResponse,t),Object.defineProperty(t,"body",{get:()=>t.data}),t.headers=bt.from(t.headers),t)),(t=>(Ot(t)||(Rt(e),t&&t.response&&(t.response.data=gt.call(e,e.transformResponse,t.response),t.response.data&&!t.response.body&&(t.response.body=t.response.data),t.response.headers=bt.from(t.response.headers))),Promise.reject(t)))),t}const Tt=e=>e instanceof bt?{...e}:e;function _t(e,t){t=t||{};const r={};function n(e,t,r){return J.isPlainObject(e)&&J.isPlainObject(t)?J.merge.call({caseless:r},e,t):J.isPlainObject(t)?J.merge({},t):J.isArray(t)?t.slice():t}function o(e,t,r){return J.isUndefined(t)?J.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function s(e,t){if(!J.isUndefined(t))return n(void 0,t)}function i(e,t){return J.isUndefined(t)?J.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,o,s){return s in t?n(r,o):s in e?n(void 0,r):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t)=>o(Tt(e),Tt(t),!0)};return J.forEach(Object.keys(Object.assign({},e,t)),(function(n){const s=c[n]||o,i=s(e[n],t[n],n);J.isUndefined(i)&&s!==a||(r[n]=i)})),r}const Pt="1.7.7",Ft={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ft[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const xt={};Ft.transitional=function(e,t,r){function n(e,t){return"[Axios v1.7.7] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,o,s)=>{if(!1===e)throw new V(n(o," has been removed"+(t?" in "+t:"")),V.ERR_DEPRECATED);return t&&!xt[o]&&(xt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,s)}},Ft.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Nt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let o=n.length;for(;o-- >0;){const s=n[o],i=t[s];if(i){const t=e[s],r=void 0===t||i(t,s,e);if(!0!==r)throw new V("option "+s+" must be "+r,V.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new V("Unknown option "+s,V.ERR_BAD_OPTION)}},validators:Ft};const{validators:vt}=Nt;let Ct=class{constructor(e){this.defaults=e,this.config=this.defaults,this.interceptors={request:new ne,response:new ne},this.init()}init(){const e=this;["url","method","baseURL","transformRequest","transformResponse","headers","params","paramsSerializer","body","data","timeout","withCredentials","adapter","auth","responseType","responseEncoding","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","maxBodyLength","validateStatus","maxRedirects","beforeRedirect","socketPath","httpAgent","httpsAgent","agent","cancelToken","signal","decompress","insecureHTTPParser","transitional","env","formSerializer","maxRate"].forEach((t=>Object.defineProperty(e,t,{enumerable:!0,get:()=>e.config[t],set(r){e.config[t]=r}})))}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t,r=!1){let n=null;"string"==typeof e?(t=t||{}).url=e:t=e||{},!t.data&&t.body&&(t.data=t.body),t=_t(this.defaults,t);const{transitional:o,paramsSerializer:s,headers:i}=t;void 0!==o&&Nt.assertOptions(o,{silentJSONParsing:vt.transitional(vt.boolean),forcedJSONParsing:vt.transitional(vt.boolean),clarifyTimeoutError:vt.transitional(vt.boolean)},!1),s&&(J.isFunction(s)?t.paramsSerializer={serialize:s}:Nt.assertOptions(s,{encode:vt.function,serialize:vt.function},!0)),Nt.assertOptions(t,{baseUrl:vt.spelling("baseURL"),withXsrfToken:vt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();const a=i&&J.merge(i.common,i[t.method]);i&&J.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=bt.concat(a,i);const c=[];let u=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,c.unshift(e.fulfilled,e.rejected))}));const l=[];let f;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let p,h=0;if(r)t.stream=!0,n=jt.call(this,t);else if(u){p=c.length;let e=t;for(h=0;h<p;){const t=c[h++],r=c[h++];try{e=t(e)}catch(e){r.call(this,e);break}}try{for(f=jt.call(this,e),h=0,p=l.length;h<p;)f=f.then(l[h++],l[h++]);n=f}catch(e){n=Promise.reject(e)}}else{const e=[jt.bind(this),void 0];for(e.unshift(...c),e.push(...l),p=e.length,f=Promise.resolve(t);h<p;)f=f.then(e[h++],e[h++]);n=f}return n}stream(e,t){return this._request(e,t,!0)}getUri(e){e=_t(this.defaults,e);var t,r;return function(e,t,r){if(!t)return e;const n=r&&r.encode||re,o=r&&r.serialize;let s;if(s=o?o(t,r):J.isURLSearchParams(t)?t.toString():new ee(t,r).toString(n),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}((t=e.baseURL,r=e.url,t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(t,r):r),e.params,e.paramsSerializer)}};J.forEach(["head","options"],(function(e){Ct.prototype[e]=function(t,r){return this.request(_t(r||{},{method:e,url:t,data:(r||{}).data}))}})),J.forEach(["delete","get"],(function(e){Ct.prototype[e]=function(t,r,n){return this.request(_t(n||{},{method:e,url:t,params:r}))}})),J.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,o){return this.request(_t(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ct.prototype[e]=t(),Ct.prototype[`${e}Form`]=t(!0)})),J.forEach(["gets"],(function(e){Ct.prototype[e]=function(t,r,n){return this.stream(_t(n||{},{method:e,url:t,params:r,data:(n||{}).data}))}})),J.forEach(["posts","puts","patchs"],(function(e){function t(t){return function(r,n,o){return this.stream(_t(o||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ct.prototype[e]=t(),Ct.prototype[`${e}Forms`]=t(!0)}));var Bt=Ct;var Dt=class e{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,o){r.reason||(r.reason=new Et(e,n,o),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}};const Lt=function t(r){const n=new Bt(r),o=e(Bt.prototype.request,n);return J.extend(o,Bt.prototype,n,{allOwnKeys:!0}),J.extend(o,n,null,{allOwnKeys:!0}),o.create=function(e){return t(_t(r,e))},o}(lt);return Lt.Axios=Bt,Lt.CanceledError=Et,Lt.CancelToken=Dt,Lt.isCancel=Ot,Lt.VERSION=Pt,Lt.toFormData=Q,Lt.AxiosError=V,Lt.Cancel=Lt.CanceledError,Lt.all=e=>Promise.all(e),Lt.spread=function(e){return function(t){return e.apply(null,t)}},Lt.isAxiosError=function(e){return J.isObject(e)&&!0===e.isAxiosError},Lt.mergeConfig=_t,Lt.AxiosHeaders=bt,Lt.formToJSON=e=>ct(J.isHTMLForm(e)?new FormData(e):e),Lt.getAdapter=At,Lt.default=Lt,Lt}));
|
package/dist/web/req.cjs
CHANGED
package/dist/web/req.mjs
CHANGED
package/lib/adapters/http.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import request from '@wiajs/request';
|
|
2
1
|
import { Agent } from '@wiajs/agent';
|
|
3
2
|
import { log as Log, name } from '@wiajs/log';
|
|
4
|
-
import
|
|
5
|
-
import settle from '../core/settle.js';
|
|
3
|
+
import request from '@wiajs/request';
|
|
6
4
|
import buildFullPath from '../core/buildFullPath.js';
|
|
5
|
+
import settle from '../core/settle.js';
|
|
7
6
|
import buildURL from '../helpers/buildURL.js';
|
|
7
|
+
import utils from '../utils.js';
|
|
8
8
|
// import {getProxyForUrl} from 'proxy-from-env';
|
|
9
9
|
import util from 'node:util';
|
|
10
10
|
// import followRedirects from 'follow-redirects';
|
|
11
11
|
// import Redirect from '../request/index.js'
|
|
12
|
+
import { EventEmitter } from 'node:events';
|
|
13
|
+
import stream from 'node:stream';
|
|
12
14
|
import zlib from 'node:zlib';
|
|
13
|
-
import { VERSION } from '../env/data.js';
|
|
14
|
-
import transitionalDefaults from '../defaults/transitional.js';
|
|
15
|
-
import AxiosError from '../core/AxiosError.js';
|
|
16
15
|
import CanceledError from '../cancel/CanceledError.js';
|
|
17
|
-
import
|
|
18
|
-
import fromDataURI from '../helpers/fromDataURI.js';
|
|
19
|
-
import stream from 'node:stream';
|
|
16
|
+
import AxiosError from '../core/AxiosError.js';
|
|
20
17
|
import AxiosHeaders from '../core/AxiosHeaders.js';
|
|
18
|
+
import transitionalDefaults from '../defaults/transitional.js';
|
|
19
|
+
import { VERSION } from '../env/data.js';
|
|
21
20
|
import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
|
|
22
|
-
import
|
|
21
|
+
import callbackify from '../helpers/callbackify.js';
|
|
23
22
|
import formDataToStream from '../helpers/formDataToStream.js';
|
|
23
|
+
import fromDataURI from '../helpers/fromDataURI.js';
|
|
24
|
+
import { asyncDecorator, progressEventDecorator, progressEventReducer } from '../helpers/progressEventReducer.js';
|
|
24
25
|
import readBlob from '../helpers/readBlob.js';
|
|
25
|
-
import
|
|
26
|
-
import { progressEventReducer, progressEventDecorator, asyncDecorator } from '../helpers/progressEventReducer.js';
|
|
26
|
+
import platform from '../platform/index.js';
|
|
27
27
|
const px = {
|
|
28
28
|
host: '114.98.163.61:17813'
|
|
29
29
|
};
|
|
@@ -47,7 +47,7 @@ const supportedProtocols = platform.protocols.map((protocol)=>`${protocol}:`);
|
|
|
47
47
|
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
|
48
48
|
/**
|
|
49
49
|
* !+++
|
|
50
|
-
* 将request
|
|
50
|
+
* 将request 函数改为类,request 拆分为 init 初始化和 请求执行,
|
|
51
51
|
* 如需重新发起请求时,无需重新初始化
|
|
52
52
|
*/ let HttpAdapter = class HttpAdapter {
|
|
53
53
|
/**
|
package/package.json
CHANGED
|
@@ -1,214 +1,227 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@wiajs/req",
|
|
3
|
-
"version": "1.7.
|
|
4
|
-
"description": "Promise And Stream based AXIOS client for the browser and node.js",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"types": "index.d.ts",
|
|
7
|
-
"main": "index.js",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": {
|
|
11
|
-
"require": "./index.d.cts",
|
|
12
|
-
"default": "./index.d.ts"
|
|
13
|
-
},
|
|
14
|
-
"browser": {
|
|
15
|
-
"require": "./dist/web/req.cjs",
|
|
16
|
-
"default": "./index.js"
|
|
17
|
-
},
|
|
18
|
-
"default": {
|
|
19
|
-
"require": "./dist/node/req.cjs",
|
|
20
|
-
"default": "./index.js"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
"./lib/adapters/http.js": "./lib/adapters/http.js",
|
|
24
|
-
"./lib/adapters/xhr.js": "./lib/adapters/xhr.js",
|
|
25
|
-
"./unsafe/*": "./lib/*",
|
|
26
|
-
"./unsafe/core/settle.js": "./lib/core/settle.js",
|
|
27
|
-
"./unsafe/core/buildFullPath.js": "./lib/core/buildFullPath.js",
|
|
28
|
-
"./unsafe/helpers/isAbsoluteURL.js": "./lib/helpers/isAbsoluteURL.js",
|
|
29
|
-
"./unsafe/helpers/buildURL.js": "./lib/helpers/buildURL.js",
|
|
30
|
-
"./unsafe/helpers/combineURLs.js": "./lib/helpers/combineURLs.js",
|
|
31
|
-
"./unsafe/adapters/http.js": "./lib/adapters/http.js",
|
|
32
|
-
"./unsafe/adapters/xhr.js": "./lib/adapters/xhr.js",
|
|
33
|
-
"./unsafe/utils.js": "./lib/utils.js",
|
|
34
|
-
"./package.json": "./package.json"
|
|
35
|
-
},
|
|
36
|
-
"browser": {
|
|
37
|
-
"./src/adapters/http.js": "./lib/helpers/null.js",
|
|
38
|
-
"./src/platform/node/index.js": "./lib/platform/browser/index.js",
|
|
39
|
-
"./src/platform/node/classes/FormData.js": "./lib/helpers/null.js"
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"test": "npm run test:eslint && npm run test:mocha && npm run test:karma && npm run test:dtslint && npm run test:exports",
|
|
43
|
-
"test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js",
|
|
44
|
-
"test:dtslint": "dtslint --localTs node_modules/typescript/lib",
|
|
45
|
-
"test:mocha": "node bin/ssl_hotfix.js mocha test/unit/**/*.js --timeout 30000 --exit",
|
|
46
|
-
"test:exports": "node bin/ssl_hotfix.js mocha test/module/test.js --timeout 30000 --exit",
|
|
47
|
-
"test:karma": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: karma start karma.conf.cjs --single-run",
|
|
48
|
-
"test:karma:firefox": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: Browsers=Firefox karma start karma.conf.cjs --single-run",
|
|
49
|
-
"test:karma:server": "node bin/ssl_hotfix.js cross-env karma start karma.conf.cjs",
|
|
50
|
-
"test:build:version": "node ./bin/check-build-version.js",
|
|
51
|
-
"start": "node ./sandbox/server.js",
|
|
52
|
-
"preversion-x": "gulp version",
|
|
53
|
-
"version": "npm run build && git add dist && git add package.json",
|
|
54
|
-
"prepublishOnly-x": "npm run test:build:version",
|
|
55
|
-
"postpublish": "git push && git push --tags",
|
|
56
|
-
"build-x": "gulp clear && cross-env NODE_ENV=production rollup -c -m",
|
|
57
|
-
"bin": "swc --config-file ./bin.swcrc ./src -d bin -w --strip-leading-paths",
|
|
58
|
-
"lib": "swc --config-file ./lib.swcrc ./src -d lib -w --strip-leading-paths",
|
|
59
|
-
"build": "cross-env NODE_ENV=production gulp build",
|
|
60
|
-
"examples": "node ./examples/server.js",
|
|
61
|
-
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
62
|
-
"fix": "eslint --fix lib/**/*.js",
|
|
63
|
-
"prepare-x": "husky install && npm run prepare:hooks",
|
|
64
|
-
"prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\"",
|
|
65
|
-
"release:dry": "release-it --dry-run --no-npm",
|
|
66
|
-
"release:info": "release-it --release-version",
|
|
67
|
-
"release:beta:no-npm": "release-it --preRelease=beta --no-npm",
|
|
68
|
-
"release:beta": "release-it --preRelease=beta",
|
|
69
|
-
"release:no-npm": "release-it --no-npm",
|
|
70
|
-
"release:changelog:fix": "node ./bin/injectContributorsList.js && git add CHANGELOG.md",
|
|
71
|
-
"release": "release-it"
|
|
72
|
-
},
|
|
73
|
-
"repository": {
|
|
74
|
-
"type": "git",
|
|
75
|
-
"url": "https://github.com/wiajs/req.git"
|
|
76
|
-
},
|
|
77
|
-
"keywords": [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"@
|
|
94
|
-
"@
|
|
95
|
-
"@
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"karma
|
|
126
|
-
"karma-
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
},
|
|
151
|
-
"
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
"
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
},
|
|
201
|
-
"
|
|
202
|
-
"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
"
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@wiajs/req",
|
|
3
|
+
"version": "1.7.29",
|
|
4
|
+
"description": "Promise And Stream based AXIOS client for the browser and node.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": {
|
|
11
|
+
"require": "./index.d.cts",
|
|
12
|
+
"default": "./index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"browser": {
|
|
15
|
+
"require": "./dist/web/req.cjs",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
18
|
+
"default": {
|
|
19
|
+
"require": "./dist/node/req.cjs",
|
|
20
|
+
"default": "./index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"./lib/adapters/http.js": "./lib/adapters/http.js",
|
|
24
|
+
"./lib/adapters/xhr.js": "./lib/adapters/xhr.js",
|
|
25
|
+
"./unsafe/*": "./lib/*",
|
|
26
|
+
"./unsafe/core/settle.js": "./lib/core/settle.js",
|
|
27
|
+
"./unsafe/core/buildFullPath.js": "./lib/core/buildFullPath.js",
|
|
28
|
+
"./unsafe/helpers/isAbsoluteURL.js": "./lib/helpers/isAbsoluteURL.js",
|
|
29
|
+
"./unsafe/helpers/buildURL.js": "./lib/helpers/buildURL.js",
|
|
30
|
+
"./unsafe/helpers/combineURLs.js": "./lib/helpers/combineURLs.js",
|
|
31
|
+
"./unsafe/adapters/http.js": "./lib/adapters/http.js",
|
|
32
|
+
"./unsafe/adapters/xhr.js": "./lib/adapters/xhr.js",
|
|
33
|
+
"./unsafe/utils.js": "./lib/utils.js",
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
"browser": {
|
|
37
|
+
"./src/adapters/http.js": "./lib/helpers/null.js",
|
|
38
|
+
"./src/platform/node/index.js": "./lib/platform/browser/index.js",
|
|
39
|
+
"./src/platform/node/classes/FormData.js": "./lib/helpers/null.js"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "npm run test:eslint && npm run test:mocha && npm run test:karma && npm run test:dtslint && npm run test:exports",
|
|
43
|
+
"test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js",
|
|
44
|
+
"test:dtslint": "dtslint --localTs node_modules/typescript/lib",
|
|
45
|
+
"test:mocha": "node bin/ssl_hotfix.js mocha test/unit/**/*.js --timeout 30000 --exit",
|
|
46
|
+
"test:exports": "node bin/ssl_hotfix.js mocha test/module/test.js --timeout 30000 --exit",
|
|
47
|
+
"test:karma": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: karma start karma.conf.cjs --single-run",
|
|
48
|
+
"test:karma:firefox": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: Browsers=Firefox karma start karma.conf.cjs --single-run",
|
|
49
|
+
"test:karma:server": "node bin/ssl_hotfix.js cross-env karma start karma.conf.cjs",
|
|
50
|
+
"test:build:version": "node ./bin/check-build-version.js",
|
|
51
|
+
"start": "node ./sandbox/server.js",
|
|
52
|
+
"preversion-x": "gulp version",
|
|
53
|
+
"version": "npm run build && git add dist && git add package.json",
|
|
54
|
+
"prepublishOnly-x": "npm run test:build:version",
|
|
55
|
+
"postpublish": "git push && git push --tags",
|
|
56
|
+
"build-x": "gulp clear && cross-env NODE_ENV=production rollup -c -m",
|
|
57
|
+
"bin": "swc --config-file ./bin.swcrc ./src -d bin -w --strip-leading-paths",
|
|
58
|
+
"lib": "swc --config-file ./lib.swcrc ./src -d lib -w --strip-leading-paths",
|
|
59
|
+
"build": "cross-env NODE_ENV=production gulp build",
|
|
60
|
+
"examples": "node ./examples/server.js",
|
|
61
|
+
"coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
62
|
+
"fix": "eslint --fix lib/**/*.js",
|
|
63
|
+
"prepare-x": "husky install && npm run prepare:hooks",
|
|
64
|
+
"prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\"",
|
|
65
|
+
"release:dry": "release-it --dry-run --no-npm",
|
|
66
|
+
"release:info": "release-it --release-version",
|
|
67
|
+
"release:beta:no-npm": "release-it --preRelease=beta --no-npm",
|
|
68
|
+
"release:beta": "release-it --preRelease=beta",
|
|
69
|
+
"release:no-npm": "release-it --no-npm",
|
|
70
|
+
"release:changelog:fix": "node ./bin/injectContributorsList.js && git add CHANGELOG.md",
|
|
71
|
+
"release": "release-it"
|
|
72
|
+
},
|
|
73
|
+
"repository": {
|
|
74
|
+
"type": "git",
|
|
75
|
+
"url": "https://github.com/wiajs/req.git"
|
|
76
|
+
},
|
|
77
|
+
"keywords": [
|
|
78
|
+
"xhr",
|
|
79
|
+
"http",
|
|
80
|
+
"ajax",
|
|
81
|
+
"promise",
|
|
82
|
+
"stream",
|
|
83
|
+
"node"
|
|
84
|
+
],
|
|
85
|
+
"author": "Sibyl Yu <sibyl@wia.pub>",
|
|
86
|
+
"bugs": "https://github.com/wiajs/req/issues",
|
|
87
|
+
"homepage": "https://wiajs.pub/req",
|
|
88
|
+
"license": "MIT",
|
|
89
|
+
"publishConfig": {
|
|
90
|
+
"access": "public"
|
|
91
|
+
},
|
|
92
|
+
"devDependencies": {
|
|
93
|
+
"@babel/core": "^7.23.9",
|
|
94
|
+
"@babel/preset-env": "^7.23.9",
|
|
95
|
+
"@commitlint/cli": "^17.8.1",
|
|
96
|
+
"@commitlint/config-conventional": "^17.8.1",
|
|
97
|
+
"@release-it/conventional-changelog": "^5.1.1",
|
|
98
|
+
"@rollup/plugin-alias": "^5.1.0",
|
|
99
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
100
|
+
"@rollup/plugin-commonjs": "^15.1.0",
|
|
101
|
+
"@rollup/plugin-json": "^4.1.0",
|
|
102
|
+
"@rollup/plugin-multi-entry": "^4.1.0",
|
|
103
|
+
"@rollup/plugin-node-resolve": "^9.0.0",
|
|
104
|
+
"abortcontroller-polyfill": "^1.7.5",
|
|
105
|
+
"auto-changelog": "^2.4.0",
|
|
106
|
+
"body-parser": "^1.20.2",
|
|
107
|
+
"chalk": "^5.3.0",
|
|
108
|
+
"coveralls": "^3.1.1",
|
|
109
|
+
"cross-env": "^7.0.3",
|
|
110
|
+
"dev-null": "^0.1.1",
|
|
111
|
+
"dtslint": "^4.2.1",
|
|
112
|
+
"es6-promise": "^4.2.8",
|
|
113
|
+
"eslint": "^8.56.0",
|
|
114
|
+
"express": "^4.18.2",
|
|
115
|
+
"formdata-node": "^5.0.1",
|
|
116
|
+
"formidable": "^2.1.2",
|
|
117
|
+
"fs-extra": "^10.1.0",
|
|
118
|
+
"get-stream": "^3.0.0",
|
|
119
|
+
"gulp": "^4.0.2",
|
|
120
|
+
"gzip-size": "^7.0.0",
|
|
121
|
+
"handlebars": "^4.7.8",
|
|
122
|
+
"husky": "^8.0.3",
|
|
123
|
+
"istanbul-instrumenter-loader": "^3.0.1",
|
|
124
|
+
"jasmine-core": "^2.99.1",
|
|
125
|
+
"karma": "^6.3.17",
|
|
126
|
+
"karma-chrome-launcher": "^3.2.0",
|
|
127
|
+
"karma-firefox-launcher": "^2.1.2",
|
|
128
|
+
"karma-jasmine": "^1.1.2",
|
|
129
|
+
"karma-jasmine-ajax": "^0.1.13",
|
|
130
|
+
"karma-rollup-preprocessor": "^7.0.8",
|
|
131
|
+
"karma-safari-launcher": "^1.0.0",
|
|
132
|
+
"karma-sauce-launcher": "^4.3.6",
|
|
133
|
+
"karma-sinon": "^1.0.5",
|
|
134
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
135
|
+
"memoizee": "^0.4.15",
|
|
136
|
+
"minimist": "^1.2.8",
|
|
137
|
+
"mocha": "^10.3.0",
|
|
138
|
+
"multer": "^1.4.4",
|
|
139
|
+
"pretty-bytes": "^6.1.1",
|
|
140
|
+
"release-it": "^15.11.0",
|
|
141
|
+
"rollup": "^2.79.1",
|
|
142
|
+
"rollup-plugin-auto-external": "^2.0.0",
|
|
143
|
+
"rollup-plugin-bundle-size": "^1.0.3",
|
|
144
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
145
|
+
"sinon": "^4.5.0",
|
|
146
|
+
"stream-throttle": "^0.1.3",
|
|
147
|
+
"string-replace-async": "^3.0.2",
|
|
148
|
+
"terser-webpack-plugin": "^4.2.3",
|
|
149
|
+
"typescript": "^4.9.5"
|
|
150
|
+
},
|
|
151
|
+
"dependencies": {
|
|
152
|
+
"@wiajs/agent": "^1.0.21",
|
|
153
|
+
"@wiajs/log": "^4.3.19",
|
|
154
|
+
"@wiajs/request": "^3.0.32",
|
|
155
|
+
"form-data": "^4.0.0",
|
|
156
|
+
"proxy-from-env": "^1.1.0"
|
|
157
|
+
},
|
|
158
|
+
"jsdelivr": "dist/req.min.js",
|
|
159
|
+
"unpkg": "dist/req.min.js",
|
|
160
|
+
"typings": "./index.d.ts",
|
|
161
|
+
"bundlesize": [
|
|
162
|
+
{
|
|
163
|
+
"path": "./dist/req.min.js",
|
|
164
|
+
"threshold": "5kB"
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"contributors": [
|
|
168
|
+
"Sibyl Yu (https://github.com/wiajs)",
|
|
169
|
+
"Matt Zabriskie (https://github.com/mzabriskie)",
|
|
170
|
+
"Nick Uraltsev (https://github.com/nickuraltsev)",
|
|
171
|
+
"Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
|
|
172
|
+
"Jay (https://github.com/jasonsaayman)",
|
|
173
|
+
"Emily Morehouse (https://github.com/emilyemorehouse)",
|
|
174
|
+
"Rubén Norte (https://github.com/rubennorte)",
|
|
175
|
+
"Justin Beckwith (https://github.com/JustinBeckwith)",
|
|
176
|
+
"Martti Laine (https://github.com/codeclown)",
|
|
177
|
+
"Xianming Zhong (https://github.com/chinesedfan)",
|
|
178
|
+
"Rikki Gibson (https://github.com/RikkiGibson)",
|
|
179
|
+
"Remco Haszing (https://github.com/remcohaszing)",
|
|
180
|
+
"Yasu Flores (https://github.com/yasuf)",
|
|
181
|
+
"Ben Carp (https://github.com/carpben)"
|
|
182
|
+
],
|
|
183
|
+
"sideEffects": false,
|
|
184
|
+
"release-it": {
|
|
185
|
+
"git": {
|
|
186
|
+
"commitMessage": "chore(release): v${version}",
|
|
187
|
+
"push": true,
|
|
188
|
+
"commit": true,
|
|
189
|
+
"tag": true,
|
|
190
|
+
"requireCommits": false,
|
|
191
|
+
"requireCleanWorkingDir": false
|
|
192
|
+
},
|
|
193
|
+
"github": {
|
|
194
|
+
"release": true,
|
|
195
|
+
"draft": true
|
|
196
|
+
},
|
|
197
|
+
"npm": {
|
|
198
|
+
"publish": false,
|
|
199
|
+
"ignoreVersion": false
|
|
200
|
+
},
|
|
201
|
+
"plugins": {
|
|
202
|
+
"@release-it/conventional-changelog": {
|
|
203
|
+
"preset": "angular",
|
|
204
|
+
"infile": "CHANGELOG.md",
|
|
205
|
+
"header": "# Changelog"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"hooks": {
|
|
209
|
+
"before:init": "npm test",
|
|
210
|
+
"after:bump": "gulp version --bump ${version} && npm run build && npm run test:build:version && git add ./dist && git add ./package-lock.json",
|
|
211
|
+
"before:release": "npm run release:changelog:fix",
|
|
212
|
+
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"commitlint": {
|
|
216
|
+
"rules": {
|
|
217
|
+
"header-max-length": [
|
|
218
|
+
2,
|
|
219
|
+
"always",
|
|
220
|
+
130
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
"extends": [
|
|
224
|
+
"@commitlint/config-conventional"
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
}
|