@pelcro/react-pelcro-js 4.0.0-alpha.110 → 4.0.0-alpha.111
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/index.cjs.js +524 -1430
- package/dist/index.esm.js +523 -1430
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -16,7 +16,7 @@ var assert = require('assert');
|
|
|
16
16
|
var tty = require('tty');
|
|
17
17
|
var os = require('os');
|
|
18
18
|
var zlib = require('zlib');
|
|
19
|
-
var
|
|
19
|
+
var EventEmitter$1 = require('events');
|
|
20
20
|
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
22
|
|
|
@@ -55,6 +55,7 @@ var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert);
|
|
|
55
55
|
var tty__default = /*#__PURE__*/_interopDefaultLegacy(tty);
|
|
56
56
|
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
57
57
|
var zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
|
|
58
|
+
var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter$1);
|
|
58
59
|
|
|
59
60
|
function _typeof$4(o) {
|
|
60
61
|
"@babel/helpers - typeof";
|
|
@@ -29047,16 +29048,12 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
|
29047
29048
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
29048
29049
|
*/
|
|
29049
29050
|
const isFormData = (thing) => {
|
|
29050
|
-
|
|
29051
|
+
const pattern = '[object FormData]';
|
|
29051
29052
|
return thing && (
|
|
29052
|
-
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
29053
|
-
|
|
29054
|
-
|
|
29055
|
-
|
|
29056
|
-
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
29057
|
-
)
|
|
29058
|
-
)
|
|
29059
|
-
)
|
|
29053
|
+
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
29054
|
+
toString.call(thing) === pattern ||
|
|
29055
|
+
(isFunction$1(thing.toString) && thing.toString() === pattern)
|
|
29056
|
+
);
|
|
29060
29057
|
};
|
|
29061
29058
|
|
|
29062
29059
|
/**
|
|
@@ -29068,8 +29065,6 @@ const isFormData = (thing) => {
|
|
|
29068
29065
|
*/
|
|
29069
29066
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
29070
29067
|
|
|
29071
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
|
29072
|
-
|
|
29073
29068
|
/**
|
|
29074
29069
|
* Trim excess whitespace off the beginning and end of a string
|
|
29075
29070
|
*
|
|
@@ -29377,7 +29372,7 @@ const matchAll = (regExp, str) => {
|
|
|
29377
29372
|
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
29378
29373
|
|
|
29379
29374
|
const toCamelCase = str => {
|
|
29380
|
-
return str.toLowerCase().replace(/[
|
|
29375
|
+
return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
|
|
29381
29376
|
function replacer(m, p1, p2) {
|
|
29382
29377
|
return p1.toUpperCase() + p2;
|
|
29383
29378
|
}
|
|
@@ -29401,9 +29396,8 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
29401
29396
|
const reducedDescriptors = {};
|
|
29402
29397
|
|
|
29403
29398
|
forEach(descriptors, (descriptor, name) => {
|
|
29404
|
-
|
|
29405
|
-
|
|
29406
|
-
reducedDescriptors[name] = ret || descriptor;
|
|
29399
|
+
if (reducer(descriptor, name, obj) !== false) {
|
|
29400
|
+
reducedDescriptors[name] = descriptor;
|
|
29407
29401
|
}
|
|
29408
29402
|
});
|
|
29409
29403
|
|
|
@@ -29458,40 +29452,10 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
29458
29452
|
const noop$2 = () => {};
|
|
29459
29453
|
|
|
29460
29454
|
const toFiniteNumber = (value, defaultValue) => {
|
|
29461
|
-
|
|
29462
|
-
|
|
29463
|
-
|
|
29464
|
-
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
29465
|
-
|
|
29466
|
-
const DIGIT = '0123456789';
|
|
29467
|
-
|
|
29468
|
-
const ALPHABET = {
|
|
29469
|
-
DIGIT,
|
|
29470
|
-
ALPHA,
|
|
29471
|
-
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
29472
|
-
};
|
|
29473
|
-
|
|
29474
|
-
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
29475
|
-
let str = '';
|
|
29476
|
-
const {length} = alphabet;
|
|
29477
|
-
while (size--) {
|
|
29478
|
-
str += alphabet[Math.random() * length|0];
|
|
29479
|
-
}
|
|
29480
|
-
|
|
29481
|
-
return str;
|
|
29455
|
+
value = +value;
|
|
29456
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
29482
29457
|
};
|
|
29483
29458
|
|
|
29484
|
-
/**
|
|
29485
|
-
* If the thing is a FormData object, return true, otherwise return false.
|
|
29486
|
-
*
|
|
29487
|
-
* @param {unknown} thing - The thing to check.
|
|
29488
|
-
*
|
|
29489
|
-
* @returns {boolean}
|
|
29490
|
-
*/
|
|
29491
|
-
function isSpecCompliantForm(thing) {
|
|
29492
|
-
return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
|
29493
|
-
}
|
|
29494
|
-
|
|
29495
29459
|
const toJSONObject = (obj) => {
|
|
29496
29460
|
const stack = new Array(10);
|
|
29497
29461
|
|
|
@@ -29523,42 +29487,7 @@ const toJSONObject = (obj) => {
|
|
|
29523
29487
|
return visit(obj, 0);
|
|
29524
29488
|
};
|
|
29525
29489
|
|
|
29526
|
-
|
|
29527
|
-
|
|
29528
|
-
const isThenable = (thing) =>
|
|
29529
|
-
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
29530
|
-
|
|
29531
|
-
// original code
|
|
29532
|
-
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
29533
|
-
|
|
29534
|
-
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
29535
|
-
if (setImmediateSupported) {
|
|
29536
|
-
return setImmediate;
|
|
29537
|
-
}
|
|
29538
|
-
|
|
29539
|
-
return postMessageSupported ? ((token, callbacks) => {
|
|
29540
|
-
_global.addEventListener("message", ({source, data}) => {
|
|
29541
|
-
if (source === _global && data === token) {
|
|
29542
|
-
callbacks.length && callbacks.shift()();
|
|
29543
|
-
}
|
|
29544
|
-
}, false);
|
|
29545
|
-
|
|
29546
|
-
return (cb) => {
|
|
29547
|
-
callbacks.push(cb);
|
|
29548
|
-
_global.postMessage(token, "*");
|
|
29549
|
-
}
|
|
29550
|
-
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
29551
|
-
})(
|
|
29552
|
-
typeof setImmediate === 'function',
|
|
29553
|
-
isFunction$1(_global.postMessage)
|
|
29554
|
-
);
|
|
29555
|
-
|
|
29556
|
-
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
29557
|
-
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
|
|
29558
|
-
|
|
29559
|
-
// *********************
|
|
29560
|
-
|
|
29561
|
-
var utils$1 = {
|
|
29490
|
+
var utils = {
|
|
29562
29491
|
isArray,
|
|
29563
29492
|
isArrayBuffer,
|
|
29564
29493
|
isBuffer: isBuffer$1,
|
|
@@ -29569,10 +29498,6 @@ var utils$1 = {
|
|
|
29569
29498
|
isBoolean,
|
|
29570
29499
|
isObject,
|
|
29571
29500
|
isPlainObject,
|
|
29572
|
-
isReadableStream,
|
|
29573
|
-
isRequest,
|
|
29574
|
-
isResponse,
|
|
29575
|
-
isHeaders,
|
|
29576
29501
|
isUndefined,
|
|
29577
29502
|
isDate,
|
|
29578
29503
|
isFile,
|
|
@@ -29608,14 +29533,7 @@ var utils$1 = {
|
|
|
29608
29533
|
findKey,
|
|
29609
29534
|
global: _global,
|
|
29610
29535
|
isContextDefined,
|
|
29611
|
-
|
|
29612
|
-
generateString,
|
|
29613
|
-
isSpecCompliantForm,
|
|
29614
|
-
toJSONObject,
|
|
29615
|
-
isAsyncFn,
|
|
29616
|
-
isThenable,
|
|
29617
|
-
setImmediate: _setImmediate,
|
|
29618
|
-
asap
|
|
29536
|
+
toJSONObject
|
|
29619
29537
|
};
|
|
29620
29538
|
|
|
29621
29539
|
/**
|
|
@@ -29643,13 +29561,10 @@ function AxiosError(message, code, config, request, response) {
|
|
|
29643
29561
|
code && (this.code = code);
|
|
29644
29562
|
config && (this.config = config);
|
|
29645
29563
|
request && (this.request = request);
|
|
29646
|
-
|
|
29647
|
-
this.response = response;
|
|
29648
|
-
this.status = response.status ? response.status : null;
|
|
29649
|
-
}
|
|
29564
|
+
response && (this.response = response);
|
|
29650
29565
|
}
|
|
29651
29566
|
|
|
29652
|
-
utils
|
|
29567
|
+
utils.inherits(AxiosError, Error, {
|
|
29653
29568
|
toJSON: function toJSON() {
|
|
29654
29569
|
return {
|
|
29655
29570
|
// Standard
|
|
@@ -29664,9 +29579,9 @@ utils$1.inherits(AxiosError, Error, {
|
|
|
29664
29579
|
columnNumber: this.columnNumber,
|
|
29665
29580
|
stack: this.stack,
|
|
29666
29581
|
// Axios
|
|
29667
|
-
config: utils
|
|
29582
|
+
config: utils.toJSONObject(this.config),
|
|
29668
29583
|
code: this.code,
|
|
29669
|
-
status: this.status
|
|
29584
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
29670
29585
|
};
|
|
29671
29586
|
}
|
|
29672
29587
|
});
|
|
@@ -29699,7 +29614,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
|
29699
29614
|
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
29700
29615
|
const axiosError = Object.create(prototype$1);
|
|
29701
29616
|
|
|
29702
|
-
utils
|
|
29617
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
29703
29618
|
return obj !== Error.prototype;
|
|
29704
29619
|
}, prop => {
|
|
29705
29620
|
return prop !== 'isAxiosError';
|
|
@@ -41647,7 +41562,7 @@ FormData$1.prototype.toString = function () {
|
|
|
41647
41562
|
* @returns {boolean}
|
|
41648
41563
|
*/
|
|
41649
41564
|
function isVisitable(thing) {
|
|
41650
|
-
return utils
|
|
41565
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
41651
41566
|
}
|
|
41652
41567
|
|
|
41653
41568
|
/**
|
|
@@ -41658,7 +41573,7 @@ function isVisitable(thing) {
|
|
|
41658
41573
|
* @returns {string} the key without the brackets.
|
|
41659
41574
|
*/
|
|
41660
41575
|
function removeBrackets(key) {
|
|
41661
|
-
return utils
|
|
41576
|
+
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
41662
41577
|
}
|
|
41663
41578
|
|
|
41664
41579
|
/**
|
|
@@ -41687,13 +41602,24 @@ function renderKey(path, key, dots) {
|
|
|
41687
41602
|
* @returns {boolean}
|
|
41688
41603
|
*/
|
|
41689
41604
|
function isFlatArray(arr) {
|
|
41690
|
-
return utils
|
|
41605
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
41691
41606
|
}
|
|
41692
41607
|
|
|
41693
|
-
const predicates = utils
|
|
41608
|
+
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
41694
41609
|
return /^is[A-Z]/.test(prop);
|
|
41695
41610
|
});
|
|
41696
41611
|
|
|
41612
|
+
/**
|
|
41613
|
+
* If the thing is a FormData object, return true, otherwise return false.
|
|
41614
|
+
*
|
|
41615
|
+
* @param {unknown} thing - The thing to check.
|
|
41616
|
+
*
|
|
41617
|
+
* @returns {boolean}
|
|
41618
|
+
*/
|
|
41619
|
+
function isSpecCompliant(thing) {
|
|
41620
|
+
return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
|
|
41621
|
+
}
|
|
41622
|
+
|
|
41697
41623
|
/**
|
|
41698
41624
|
* Convert a data object to FormData
|
|
41699
41625
|
*
|
|
@@ -41718,7 +41644,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
|
|
|
41718
41644
|
* @returns
|
|
41719
41645
|
*/
|
|
41720
41646
|
function toFormData(obj, formData, options) {
|
|
41721
|
-
if (!utils
|
|
41647
|
+
if (!utils.isObject(obj)) {
|
|
41722
41648
|
throw new TypeError('target must be an object');
|
|
41723
41649
|
}
|
|
41724
41650
|
|
|
@@ -41726,13 +41652,13 @@ function toFormData(obj, formData, options) {
|
|
|
41726
41652
|
formData = formData || new (form_data || FormData)();
|
|
41727
41653
|
|
|
41728
41654
|
// eslint-disable-next-line no-param-reassign
|
|
41729
|
-
options = utils
|
|
41655
|
+
options = utils.toFlatObject(options, {
|
|
41730
41656
|
metaTokens: true,
|
|
41731
41657
|
dots: false,
|
|
41732
41658
|
indexes: false
|
|
41733
41659
|
}, false, function defined(option, source) {
|
|
41734
41660
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
41735
|
-
return !utils
|
|
41661
|
+
return !utils.isUndefined(source[option]);
|
|
41736
41662
|
});
|
|
41737
41663
|
|
|
41738
41664
|
const metaTokens = options.metaTokens;
|
|
@@ -41741,24 +41667,24 @@ function toFormData(obj, formData, options) {
|
|
|
41741
41667
|
const dots = options.dots;
|
|
41742
41668
|
const indexes = options.indexes;
|
|
41743
41669
|
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
41744
|
-
const useBlob = _Blob &&
|
|
41670
|
+
const useBlob = _Blob && isSpecCompliant(formData);
|
|
41745
41671
|
|
|
41746
|
-
if (!utils
|
|
41672
|
+
if (!utils.isFunction(visitor)) {
|
|
41747
41673
|
throw new TypeError('visitor must be a function');
|
|
41748
41674
|
}
|
|
41749
41675
|
|
|
41750
41676
|
function convertValue(value) {
|
|
41751
41677
|
if (value === null) return '';
|
|
41752
41678
|
|
|
41753
|
-
if (utils
|
|
41679
|
+
if (utils.isDate(value)) {
|
|
41754
41680
|
return value.toISOString();
|
|
41755
41681
|
}
|
|
41756
41682
|
|
|
41757
|
-
if (!useBlob && utils
|
|
41683
|
+
if (!useBlob && utils.isBlob(value)) {
|
|
41758
41684
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
41759
41685
|
}
|
|
41760
41686
|
|
|
41761
|
-
if (utils
|
|
41687
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
41762
41688
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
41763
41689
|
}
|
|
41764
41690
|
|
|
@@ -41779,20 +41705,20 @@ function toFormData(obj, formData, options) {
|
|
|
41779
41705
|
let arr = value;
|
|
41780
41706
|
|
|
41781
41707
|
if (value && !path && typeof value === 'object') {
|
|
41782
|
-
if (utils
|
|
41708
|
+
if (utils.endsWith(key, '{}')) {
|
|
41783
41709
|
// eslint-disable-next-line no-param-reassign
|
|
41784
41710
|
key = metaTokens ? key : key.slice(0, -2);
|
|
41785
41711
|
// eslint-disable-next-line no-param-reassign
|
|
41786
41712
|
value = JSON.stringify(value);
|
|
41787
41713
|
} else if (
|
|
41788
|
-
(utils
|
|
41789
|
-
(
|
|
41714
|
+
(utils.isArray(value) && isFlatArray(value)) ||
|
|
41715
|
+
(utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
|
|
41790
41716
|
)) {
|
|
41791
41717
|
// eslint-disable-next-line no-param-reassign
|
|
41792
41718
|
key = removeBrackets(key);
|
|
41793
41719
|
|
|
41794
41720
|
arr.forEach(function each(el, index) {
|
|
41795
|
-
!(utils
|
|
41721
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
41796
41722
|
// eslint-disable-next-line no-nested-ternary
|
|
41797
41723
|
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
41798
41724
|
convertValue(el)
|
|
@@ -41820,7 +41746,7 @@ function toFormData(obj, formData, options) {
|
|
|
41820
41746
|
});
|
|
41821
41747
|
|
|
41822
41748
|
function build(value, path) {
|
|
41823
|
-
if (utils
|
|
41749
|
+
if (utils.isUndefined(value)) return;
|
|
41824
41750
|
|
|
41825
41751
|
if (stack.indexOf(value) !== -1) {
|
|
41826
41752
|
throw Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -41828,9 +41754,9 @@ function toFormData(obj, formData, options) {
|
|
|
41828
41754
|
|
|
41829
41755
|
stack.push(value);
|
|
41830
41756
|
|
|
41831
|
-
utils
|
|
41832
|
-
const result = !(utils
|
|
41833
|
-
formData, el, utils
|
|
41757
|
+
utils.forEach(value, function each(el, key) {
|
|
41758
|
+
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
41759
|
+
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
41834
41760
|
);
|
|
41835
41761
|
|
|
41836
41762
|
if (result === true) {
|
|
@@ -41841,7 +41767,7 @@ function toFormData(obj, formData, options) {
|
|
|
41841
41767
|
stack.pop();
|
|
41842
41768
|
}
|
|
41843
41769
|
|
|
41844
|
-
if (!utils
|
|
41770
|
+
if (!utils.isObject(obj)) {
|
|
41845
41771
|
throw new TypeError('data must be an object');
|
|
41846
41772
|
}
|
|
41847
41773
|
|
|
@@ -41926,7 +41852,7 @@ function encode(val) {
|
|
|
41926
41852
|
*
|
|
41927
41853
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
41928
41854
|
* @param {object} [params] The params to be appended
|
|
41929
|
-
* @param {?
|
|
41855
|
+
* @param {?object} options
|
|
41930
41856
|
*
|
|
41931
41857
|
* @returns {string} The formatted url
|
|
41932
41858
|
*/
|
|
@@ -41938,12 +41864,6 @@ function buildURL(url, params, options) {
|
|
|
41938
41864
|
|
|
41939
41865
|
const _encode = options && options.encode || encode;
|
|
41940
41866
|
|
|
41941
|
-
if (utils$1.isFunction(options)) {
|
|
41942
|
-
options = {
|
|
41943
|
-
serialize: options
|
|
41944
|
-
};
|
|
41945
|
-
}
|
|
41946
|
-
|
|
41947
41867
|
const serializeFn = options && options.serialize;
|
|
41948
41868
|
|
|
41949
41869
|
let serializedParams;
|
|
@@ -41951,7 +41871,7 @@ function buildURL(url, params, options) {
|
|
|
41951
41871
|
if (serializeFn) {
|
|
41952
41872
|
serializedParams = serializeFn(params, options);
|
|
41953
41873
|
} else {
|
|
41954
|
-
serializedParams = utils
|
|
41874
|
+
serializedParams = utils.isURLSearchParams(params) ?
|
|
41955
41875
|
params.toString() :
|
|
41956
41876
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
41957
41877
|
}
|
|
@@ -42026,7 +41946,7 @@ class InterceptorManager {
|
|
|
42026
41946
|
* @returns {void}
|
|
42027
41947
|
*/
|
|
42028
41948
|
forEach(fn) {
|
|
42029
|
-
utils
|
|
41949
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
42030
41950
|
if (h !== null) {
|
|
42031
41951
|
fn(h);
|
|
42032
41952
|
}
|
|
@@ -42042,7 +41962,7 @@ var transitionalDefaults = {
|
|
|
42042
41962
|
|
|
42043
41963
|
var URLSearchParams = url__default['default'].URLSearchParams;
|
|
42044
41964
|
|
|
42045
|
-
var platform
|
|
41965
|
+
var platform = {
|
|
42046
41966
|
isNode: true,
|
|
42047
41967
|
classes: {
|
|
42048
41968
|
URLSearchParams,
|
|
@@ -42052,68 +41972,10 @@ var platform$1 = {
|
|
|
42052
41972
|
protocols: [ 'http', 'https', 'file', 'data' ]
|
|
42053
41973
|
};
|
|
42054
41974
|
|
|
42055
|
-
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
42056
|
-
|
|
42057
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
42058
|
-
|
|
42059
|
-
/**
|
|
42060
|
-
* Determine if we're running in a standard browser environment
|
|
42061
|
-
*
|
|
42062
|
-
* This allows axios to run in a web worker, and react-native.
|
|
42063
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
42064
|
-
*
|
|
42065
|
-
* web workers:
|
|
42066
|
-
* typeof window -> undefined
|
|
42067
|
-
* typeof document -> undefined
|
|
42068
|
-
*
|
|
42069
|
-
* react-native:
|
|
42070
|
-
* navigator.product -> 'ReactNative'
|
|
42071
|
-
* nativescript
|
|
42072
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
42073
|
-
*
|
|
42074
|
-
* @returns {boolean}
|
|
42075
|
-
*/
|
|
42076
|
-
const hasStandardBrowserEnv = hasBrowserEnv &&
|
|
42077
|
-
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
42078
|
-
|
|
42079
|
-
/**
|
|
42080
|
-
* Determine if we're running in a standard browser webWorker environment
|
|
42081
|
-
*
|
|
42082
|
-
* Although the `isStandardBrowserEnv` method indicates that
|
|
42083
|
-
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
42084
|
-
* filtered out due to its judgment standard
|
|
42085
|
-
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
42086
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
42087
|
-
*/
|
|
42088
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
42089
|
-
return (
|
|
42090
|
-
typeof WorkerGlobalScope !== 'undefined' &&
|
|
42091
|
-
// eslint-disable-next-line no-undef
|
|
42092
|
-
self instanceof WorkerGlobalScope &&
|
|
42093
|
-
typeof self.importScripts === 'function'
|
|
42094
|
-
);
|
|
42095
|
-
})();
|
|
42096
|
-
|
|
42097
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
42098
|
-
|
|
42099
|
-
var utils = /*#__PURE__*/Object.freeze({
|
|
42100
|
-
__proto__: null,
|
|
42101
|
-
hasBrowserEnv: hasBrowserEnv,
|
|
42102
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
42103
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
42104
|
-
navigator: _navigator,
|
|
42105
|
-
origin: origin
|
|
42106
|
-
});
|
|
42107
|
-
|
|
42108
|
-
var platform = {
|
|
42109
|
-
...utils,
|
|
42110
|
-
...platform$1
|
|
42111
|
-
};
|
|
42112
|
-
|
|
42113
41975
|
function toURLEncodedForm(data, options) {
|
|
42114
41976
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
42115
41977
|
visitor: function(value, key, path, helpers) {
|
|
42116
|
-
if (
|
|
41978
|
+
if (utils.isBuffer(value)) {
|
|
42117
41979
|
this.append(key, value.toString('base64'));
|
|
42118
41980
|
return false;
|
|
42119
41981
|
}
|
|
@@ -42135,7 +41997,7 @@ function parsePropPath(name) {
|
|
|
42135
41997
|
// foo.x.y.z
|
|
42136
41998
|
// foo-x-y-z
|
|
42137
41999
|
// foo x y z
|
|
42138
|
-
return utils
|
|
42000
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
42139
42001
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
42140
42002
|
});
|
|
42141
42003
|
}
|
|
@@ -42170,15 +42032,12 @@ function arrayToObject(arr) {
|
|
|
42170
42032
|
function formDataToJSON(formData) {
|
|
42171
42033
|
function buildPath(path, value, target, index) {
|
|
42172
42034
|
let name = path[index++];
|
|
42173
|
-
|
|
42174
|
-
if (name === '__proto__') return true;
|
|
42175
|
-
|
|
42176
42035
|
const isNumericKey = Number.isFinite(+name);
|
|
42177
42036
|
const isLast = index >= path.length;
|
|
42178
|
-
name = !name && utils
|
|
42037
|
+
name = !name && utils.isArray(target) ? target.length : name;
|
|
42179
42038
|
|
|
42180
42039
|
if (isLast) {
|
|
42181
|
-
if (utils
|
|
42040
|
+
if (utils.hasOwnProp(target, name)) {
|
|
42182
42041
|
target[name] = [target[name], value];
|
|
42183
42042
|
} else {
|
|
42184
42043
|
target[name] = value;
|
|
@@ -42187,23 +42046,23 @@ function formDataToJSON(formData) {
|
|
|
42187
42046
|
return !isNumericKey;
|
|
42188
42047
|
}
|
|
42189
42048
|
|
|
42190
|
-
if (!target[name] || !utils
|
|
42049
|
+
if (!target[name] || !utils.isObject(target[name])) {
|
|
42191
42050
|
target[name] = [];
|
|
42192
42051
|
}
|
|
42193
42052
|
|
|
42194
42053
|
const result = buildPath(path, value, target[name], index);
|
|
42195
42054
|
|
|
42196
|
-
if (result && utils
|
|
42055
|
+
if (result && utils.isArray(target[name])) {
|
|
42197
42056
|
target[name] = arrayToObject(target[name]);
|
|
42198
42057
|
}
|
|
42199
42058
|
|
|
42200
42059
|
return !isNumericKey;
|
|
42201
42060
|
}
|
|
42202
42061
|
|
|
42203
|
-
if (utils
|
|
42062
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
42204
42063
|
const obj = {};
|
|
42205
42064
|
|
|
42206
|
-
utils
|
|
42065
|
+
utils.forEachEntry(formData, (name, value) => {
|
|
42207
42066
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
42208
42067
|
});
|
|
42209
42068
|
|
|
@@ -42213,6 +42072,10 @@ function formDataToJSON(formData) {
|
|
|
42213
42072
|
return null;
|
|
42214
42073
|
}
|
|
42215
42074
|
|
|
42075
|
+
const DEFAULT_CONTENT_TYPE = {
|
|
42076
|
+
'Content-Type': undefined
|
|
42077
|
+
};
|
|
42078
|
+
|
|
42216
42079
|
/**
|
|
42217
42080
|
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
42218
42081
|
* of the input
|
|
@@ -42224,10 +42087,10 @@ function formDataToJSON(formData) {
|
|
|
42224
42087
|
* @returns {string} A stringified version of the rawValue.
|
|
42225
42088
|
*/
|
|
42226
42089
|
function stringifySafely(rawValue, parser, encoder) {
|
|
42227
|
-
if (utils
|
|
42090
|
+
if (utils.isString(rawValue)) {
|
|
42228
42091
|
try {
|
|
42229
42092
|
(parser || JSON.parse)(rawValue);
|
|
42230
|
-
return utils
|
|
42093
|
+
return utils.trim(rawValue);
|
|
42231
42094
|
} catch (e) {
|
|
42232
42095
|
if (e.name !== 'SyntaxError') {
|
|
42233
42096
|
throw e;
|
|
@@ -42242,36 +42105,38 @@ const defaults = {
|
|
|
42242
42105
|
|
|
42243
42106
|
transitional: transitionalDefaults,
|
|
42244
42107
|
|
|
42245
|
-
adapter: ['xhr', 'http'
|
|
42108
|
+
adapter: ['xhr', 'http'],
|
|
42246
42109
|
|
|
42247
42110
|
transformRequest: [function transformRequest(data, headers) {
|
|
42248
42111
|
const contentType = headers.getContentType() || '';
|
|
42249
42112
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
42250
|
-
const isObjectPayload = utils
|
|
42113
|
+
const isObjectPayload = utils.isObject(data);
|
|
42251
42114
|
|
|
42252
|
-
if (isObjectPayload && utils
|
|
42115
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
42253
42116
|
data = new FormData(data);
|
|
42254
42117
|
}
|
|
42255
42118
|
|
|
42256
|
-
const isFormData = utils
|
|
42119
|
+
const isFormData = utils.isFormData(data);
|
|
42257
42120
|
|
|
42258
42121
|
if (isFormData) {
|
|
42122
|
+
if (!hasJSONContentType) {
|
|
42123
|
+
return data;
|
|
42124
|
+
}
|
|
42259
42125
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
42260
42126
|
}
|
|
42261
42127
|
|
|
42262
|
-
if (utils
|
|
42263
|
-
utils
|
|
42264
|
-
utils
|
|
42265
|
-
utils
|
|
42266
|
-
utils
|
|
42267
|
-
utils$1.isReadableStream(data)
|
|
42128
|
+
if (utils.isArrayBuffer(data) ||
|
|
42129
|
+
utils.isBuffer(data) ||
|
|
42130
|
+
utils.isStream(data) ||
|
|
42131
|
+
utils.isFile(data) ||
|
|
42132
|
+
utils.isBlob(data)
|
|
42268
42133
|
) {
|
|
42269
42134
|
return data;
|
|
42270
42135
|
}
|
|
42271
|
-
if (utils
|
|
42136
|
+
if (utils.isArrayBufferView(data)) {
|
|
42272
42137
|
return data.buffer;
|
|
42273
42138
|
}
|
|
42274
|
-
if (utils
|
|
42139
|
+
if (utils.isURLSearchParams(data)) {
|
|
42275
42140
|
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
42276
42141
|
return data.toString();
|
|
42277
42142
|
}
|
|
@@ -42283,7 +42148,7 @@ const defaults = {
|
|
|
42283
42148
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
42284
42149
|
}
|
|
42285
42150
|
|
|
42286
|
-
if ((isFileList = utils
|
|
42151
|
+
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
42287
42152
|
const _FormData = this.env && this.env.FormData;
|
|
42288
42153
|
|
|
42289
42154
|
return toFormData(
|
|
@@ -42307,11 +42172,7 @@ const defaults = {
|
|
|
42307
42172
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
42308
42173
|
const JSONRequested = this.responseType === 'json';
|
|
42309
42174
|
|
|
42310
|
-
if (utils
|
|
42311
|
-
return data;
|
|
42312
|
-
}
|
|
42313
|
-
|
|
42314
|
-
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
42175
|
+
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
42315
42176
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
42316
42177
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
42317
42178
|
|
|
@@ -42353,19 +42214,22 @@ const defaults = {
|
|
|
42353
42214
|
|
|
42354
42215
|
headers: {
|
|
42355
42216
|
common: {
|
|
42356
|
-
'Accept': 'application/json, text/plain, */*'
|
|
42357
|
-
'Content-Type': undefined
|
|
42217
|
+
'Accept': 'application/json, text/plain, */*'
|
|
42358
42218
|
}
|
|
42359
42219
|
}
|
|
42360
42220
|
};
|
|
42361
42221
|
|
|
42362
|
-
utils
|
|
42222
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
42363
42223
|
defaults.headers[method] = {};
|
|
42364
42224
|
});
|
|
42365
42225
|
|
|
42226
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
42227
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
42228
|
+
});
|
|
42229
|
+
|
|
42366
42230
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
42367
42231
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
42368
|
-
const ignoreDuplicateOf = utils
|
|
42232
|
+
const ignoreDuplicateOf = utils.toObjectSet([
|
|
42369
42233
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
42370
42234
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
42371
42235
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
@@ -42426,7 +42290,7 @@ function normalizeValue(value) {
|
|
|
42426
42290
|
return value;
|
|
42427
42291
|
}
|
|
42428
42292
|
|
|
42429
|
-
return utils
|
|
42293
|
+
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
42430
42294
|
}
|
|
42431
42295
|
|
|
42432
42296
|
function parseTokens(str) {
|
|
@@ -42441,24 +42305,22 @@ function parseTokens(str) {
|
|
|
42441
42305
|
return tokens;
|
|
42442
42306
|
}
|
|
42443
42307
|
|
|
42444
|
-
|
|
42308
|
+
function isValidHeaderName(str) {
|
|
42309
|
+
return /^[-_a-zA-Z]+$/.test(str.trim());
|
|
42310
|
+
}
|
|
42445
42311
|
|
|
42446
|
-
function matchHeaderValue(context, value, header, filter
|
|
42447
|
-
if (utils
|
|
42312
|
+
function matchHeaderValue(context, value, header, filter) {
|
|
42313
|
+
if (utils.isFunction(filter)) {
|
|
42448
42314
|
return filter.call(this, value, header);
|
|
42449
42315
|
}
|
|
42450
42316
|
|
|
42451
|
-
if (
|
|
42452
|
-
value = header;
|
|
42453
|
-
}
|
|
42454
|
-
|
|
42455
|
-
if (!utils$1.isString(value)) return;
|
|
42317
|
+
if (!utils.isString(value)) return;
|
|
42456
42318
|
|
|
42457
|
-
if (utils
|
|
42319
|
+
if (utils.isString(filter)) {
|
|
42458
42320
|
return value.indexOf(filter) !== -1;
|
|
42459
42321
|
}
|
|
42460
42322
|
|
|
42461
|
-
if (utils
|
|
42323
|
+
if (utils.isRegExp(filter)) {
|
|
42462
42324
|
return filter.test(value);
|
|
42463
42325
|
}
|
|
42464
42326
|
}
|
|
@@ -42471,7 +42333,7 @@ function formatHeader(header) {
|
|
|
42471
42333
|
}
|
|
42472
42334
|
|
|
42473
42335
|
function buildAccessors(obj, header) {
|
|
42474
|
-
const accessorName = utils
|
|
42336
|
+
const accessorName = utils.toCamelCase(' ' + header);
|
|
42475
42337
|
|
|
42476
42338
|
['get', 'set', 'has'].forEach(methodName => {
|
|
42477
42339
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
@@ -42498,7 +42360,7 @@ class AxiosHeaders {
|
|
|
42498
42360
|
throw new Error('header name must be a non-empty string');
|
|
42499
42361
|
}
|
|
42500
42362
|
|
|
42501
|
-
const key = utils
|
|
42363
|
+
const key = utils.findKey(self, lHeader);
|
|
42502
42364
|
|
|
42503
42365
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
42504
42366
|
self[key || _header] = normalizeValue(_value);
|
|
@@ -42506,16 +42368,12 @@ class AxiosHeaders {
|
|
|
42506
42368
|
}
|
|
42507
42369
|
|
|
42508
42370
|
const setHeaders = (headers, _rewrite) =>
|
|
42509
|
-
utils
|
|
42371
|
+
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
42510
42372
|
|
|
42511
|
-
if (utils
|
|
42373
|
+
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
42512
42374
|
setHeaders(header, valueOrRewrite);
|
|
42513
|
-
} else if(utils
|
|
42375
|
+
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
42514
42376
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
42515
|
-
} else if (utils$1.isHeaders(header)) {
|
|
42516
|
-
for (const [key, value] of header.entries()) {
|
|
42517
|
-
setHeader(value, key, rewrite);
|
|
42518
|
-
}
|
|
42519
42377
|
} else {
|
|
42520
42378
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
42521
42379
|
}
|
|
@@ -42527,7 +42385,7 @@ class AxiosHeaders {
|
|
|
42527
42385
|
header = normalizeHeader(header);
|
|
42528
42386
|
|
|
42529
42387
|
if (header) {
|
|
42530
|
-
const key = utils
|
|
42388
|
+
const key = utils.findKey(this, header);
|
|
42531
42389
|
|
|
42532
42390
|
if (key) {
|
|
42533
42391
|
const value = this[key];
|
|
@@ -42540,11 +42398,11 @@ class AxiosHeaders {
|
|
|
42540
42398
|
return parseTokens(value);
|
|
42541
42399
|
}
|
|
42542
42400
|
|
|
42543
|
-
if (utils
|
|
42401
|
+
if (utils.isFunction(parser)) {
|
|
42544
42402
|
return parser.call(this, value, key);
|
|
42545
42403
|
}
|
|
42546
42404
|
|
|
42547
|
-
if (utils
|
|
42405
|
+
if (utils.isRegExp(parser)) {
|
|
42548
42406
|
return parser.exec(value);
|
|
42549
42407
|
}
|
|
42550
42408
|
|
|
@@ -42557,9 +42415,9 @@ class AxiosHeaders {
|
|
|
42557
42415
|
header = normalizeHeader(header);
|
|
42558
42416
|
|
|
42559
42417
|
if (header) {
|
|
42560
|
-
const key = utils
|
|
42418
|
+
const key = utils.findKey(this, header);
|
|
42561
42419
|
|
|
42562
|
-
return !!(key &&
|
|
42420
|
+
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
42563
42421
|
}
|
|
42564
42422
|
|
|
42565
42423
|
return false;
|
|
@@ -42573,7 +42431,7 @@ class AxiosHeaders {
|
|
|
42573
42431
|
_header = normalizeHeader(_header);
|
|
42574
42432
|
|
|
42575
42433
|
if (_header) {
|
|
42576
|
-
const key = utils
|
|
42434
|
+
const key = utils.findKey(self, _header);
|
|
42577
42435
|
|
|
42578
42436
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
42579
42437
|
delete self[key];
|
|
@@ -42583,7 +42441,7 @@ class AxiosHeaders {
|
|
|
42583
42441
|
}
|
|
42584
42442
|
}
|
|
42585
42443
|
|
|
42586
|
-
if (utils
|
|
42444
|
+
if (utils.isArray(header)) {
|
|
42587
42445
|
header.forEach(deleteHeader);
|
|
42588
42446
|
} else {
|
|
42589
42447
|
deleteHeader(header);
|
|
@@ -42592,28 +42450,16 @@ class AxiosHeaders {
|
|
|
42592
42450
|
return deleted;
|
|
42593
42451
|
}
|
|
42594
42452
|
|
|
42595
|
-
clear(
|
|
42596
|
-
|
|
42597
|
-
let i = keys.length;
|
|
42598
|
-
let deleted = false;
|
|
42599
|
-
|
|
42600
|
-
while (i--) {
|
|
42601
|
-
const key = keys[i];
|
|
42602
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
42603
|
-
delete this[key];
|
|
42604
|
-
deleted = true;
|
|
42605
|
-
}
|
|
42606
|
-
}
|
|
42607
|
-
|
|
42608
|
-
return deleted;
|
|
42453
|
+
clear() {
|
|
42454
|
+
return Object.keys(this).forEach(this.delete.bind(this));
|
|
42609
42455
|
}
|
|
42610
42456
|
|
|
42611
42457
|
normalize(format) {
|
|
42612
42458
|
const self = this;
|
|
42613
42459
|
const headers = {};
|
|
42614
42460
|
|
|
42615
|
-
utils
|
|
42616
|
-
const key = utils
|
|
42461
|
+
utils.forEach(this, (value, header) => {
|
|
42462
|
+
const key = utils.findKey(headers, header);
|
|
42617
42463
|
|
|
42618
42464
|
if (key) {
|
|
42619
42465
|
self[key] = normalizeValue(value);
|
|
@@ -42642,8 +42488,8 @@ class AxiosHeaders {
|
|
|
42642
42488
|
toJSON(asStrings) {
|
|
42643
42489
|
const obj = Object.create(null);
|
|
42644
42490
|
|
|
42645
|
-
utils
|
|
42646
|
-
value != null && value !== false && (obj[header] = asStrings && utils
|
|
42491
|
+
utils.forEach(this, (value, header) => {
|
|
42492
|
+
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
|
42647
42493
|
});
|
|
42648
42494
|
|
|
42649
42495
|
return obj;
|
|
@@ -42690,26 +42536,16 @@ class AxiosHeaders {
|
|
|
42690
42536
|
}
|
|
42691
42537
|
}
|
|
42692
42538
|
|
|
42693
|
-
utils
|
|
42539
|
+
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
42694
42540
|
|
|
42695
42541
|
return this;
|
|
42696
42542
|
}
|
|
42697
42543
|
}
|
|
42698
42544
|
|
|
42699
|
-
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent'
|
|
42545
|
+
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
|
42700
42546
|
|
|
42701
|
-
|
|
42702
|
-
utils
|
|
42703
|
-
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
42704
|
-
return {
|
|
42705
|
-
get: () => value,
|
|
42706
|
-
set(headerValue) {
|
|
42707
|
-
this[mapped] = headerValue;
|
|
42708
|
-
}
|
|
42709
|
-
}
|
|
42710
|
-
});
|
|
42711
|
-
|
|
42712
|
-
utils$1.freezeMethods(AxiosHeaders);
|
|
42547
|
+
utils.freezeMethods(AxiosHeaders.prototype);
|
|
42548
|
+
utils.freezeMethods(AxiosHeaders);
|
|
42713
42549
|
|
|
42714
42550
|
/**
|
|
42715
42551
|
* Transform the data for a request or a response
|
|
@@ -42725,7 +42561,7 @@ function transformData(fns, response) {
|
|
|
42725
42561
|
const headers = AxiosHeaders.from(context.headers);
|
|
42726
42562
|
let data = context.data;
|
|
42727
42563
|
|
|
42728
|
-
utils
|
|
42564
|
+
utils.forEach(fns, function transform(fn) {
|
|
42729
42565
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
42730
42566
|
});
|
|
42731
42567
|
|
|
@@ -42753,7 +42589,7 @@ function CanceledError(message, config, request) {
|
|
|
42753
42589
|
this.name = 'CanceledError';
|
|
42754
42590
|
}
|
|
42755
42591
|
|
|
42756
|
-
utils
|
|
42592
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
42757
42593
|
__CANCEL__: true
|
|
42758
42594
|
});
|
|
42759
42595
|
|
|
@@ -42805,7 +42641,7 @@ function isAbsoluteURL(url) {
|
|
|
42805
42641
|
*/
|
|
42806
42642
|
function combineURLs(baseURL, relativeURL) {
|
|
42807
42643
|
return relativeURL
|
|
42808
|
-
? baseURL.replace(
|
|
42644
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
42809
42645
|
: baseURL;
|
|
42810
42646
|
}
|
|
42811
42647
|
|
|
@@ -42933,10 +42769,6 @@ function getEnv(key) {
|
|
|
42933
42769
|
|
|
42934
42770
|
var getProxyForUrl_1 = getProxyForUrl;
|
|
42935
42771
|
|
|
42936
|
-
var proxyFromEnv = {
|
|
42937
|
-
getProxyForUrl: getProxyForUrl_1
|
|
42938
|
-
};
|
|
42939
|
-
|
|
42940
42772
|
/**
|
|
42941
42773
|
* Helpers.
|
|
42942
42774
|
*/
|
|
@@ -44773,7 +44605,7 @@ var followRedirects = wrap({ http: http__default['default'], https: https__defau
|
|
|
44773
44605
|
var wrap_1 = wrap;
|
|
44774
44606
|
followRedirects.wrap = wrap_1;
|
|
44775
44607
|
|
|
44776
|
-
const VERSION = "1.
|
|
44608
|
+
const VERSION = "1.2.2";
|
|
44777
44609
|
|
|
44778
44610
|
function parseProtocol(url) {
|
|
44779
44611
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -44828,11 +44660,93 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
44828
44660
|
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
44829
44661
|
}
|
|
44830
44662
|
|
|
44663
|
+
/**
|
|
44664
|
+
* Throttle decorator
|
|
44665
|
+
* @param {Function} fn
|
|
44666
|
+
* @param {Number} freq
|
|
44667
|
+
* @return {Function}
|
|
44668
|
+
*/
|
|
44669
|
+
function throttle(fn, freq) {
|
|
44670
|
+
let timestamp = 0;
|
|
44671
|
+
const threshold = 1000 / freq;
|
|
44672
|
+
let timer = null;
|
|
44673
|
+
return function throttled(force, args) {
|
|
44674
|
+
const now = Date.now();
|
|
44675
|
+
if (force || now - timestamp > threshold) {
|
|
44676
|
+
if (timer) {
|
|
44677
|
+
clearTimeout(timer);
|
|
44678
|
+
timer = null;
|
|
44679
|
+
}
|
|
44680
|
+
timestamp = now;
|
|
44681
|
+
return fn.apply(null, args);
|
|
44682
|
+
}
|
|
44683
|
+
if (!timer) {
|
|
44684
|
+
timer = setTimeout(() => {
|
|
44685
|
+
timer = null;
|
|
44686
|
+
timestamp = Date.now();
|
|
44687
|
+
return fn.apply(null, args);
|
|
44688
|
+
}, threshold - (now - timestamp));
|
|
44689
|
+
}
|
|
44690
|
+
};
|
|
44691
|
+
}
|
|
44692
|
+
|
|
44693
|
+
/**
|
|
44694
|
+
* Calculate data maxRate
|
|
44695
|
+
* @param {Number} [samplesCount= 10]
|
|
44696
|
+
* @param {Number} [min= 1000]
|
|
44697
|
+
* @returns {Function}
|
|
44698
|
+
*/
|
|
44699
|
+
function speedometer(samplesCount, min) {
|
|
44700
|
+
samplesCount = samplesCount || 10;
|
|
44701
|
+
const bytes = new Array(samplesCount);
|
|
44702
|
+
const timestamps = new Array(samplesCount);
|
|
44703
|
+
let head = 0;
|
|
44704
|
+
let tail = 0;
|
|
44705
|
+
let firstSampleTS;
|
|
44706
|
+
|
|
44707
|
+
min = min !== undefined ? min : 1000;
|
|
44708
|
+
|
|
44709
|
+
return function push(chunkLength) {
|
|
44710
|
+
const now = Date.now();
|
|
44711
|
+
|
|
44712
|
+
const startedAt = timestamps[tail];
|
|
44713
|
+
|
|
44714
|
+
if (!firstSampleTS) {
|
|
44715
|
+
firstSampleTS = now;
|
|
44716
|
+
}
|
|
44717
|
+
|
|
44718
|
+
bytes[head] = chunkLength;
|
|
44719
|
+
timestamps[head] = now;
|
|
44720
|
+
|
|
44721
|
+
let i = tail;
|
|
44722
|
+
let bytesCount = 0;
|
|
44723
|
+
|
|
44724
|
+
while (i !== head) {
|
|
44725
|
+
bytesCount += bytes[i++];
|
|
44726
|
+
i = i % samplesCount;
|
|
44727
|
+
}
|
|
44728
|
+
|
|
44729
|
+
head = (head + 1) % samplesCount;
|
|
44730
|
+
|
|
44731
|
+
if (head === tail) {
|
|
44732
|
+
tail = (tail + 1) % samplesCount;
|
|
44733
|
+
}
|
|
44734
|
+
|
|
44735
|
+
if (now - firstSampleTS < min) {
|
|
44736
|
+
return;
|
|
44737
|
+
}
|
|
44738
|
+
|
|
44739
|
+
const passed = startedAt && now - startedAt;
|
|
44740
|
+
|
|
44741
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
44742
|
+
};
|
|
44743
|
+
}
|
|
44744
|
+
|
|
44831
44745
|
const kInternals = Symbol('internals');
|
|
44832
44746
|
|
|
44833
44747
|
class AxiosTransformStream extends stream__default['default'].Transform{
|
|
44834
44748
|
constructor(options) {
|
|
44835
|
-
options = utils
|
|
44749
|
+
options = utils.toFlatObject(options, {
|
|
44836
44750
|
maxRate: 0,
|
|
44837
44751
|
chunkSize: 64 * 1024,
|
|
44838
44752
|
minChunkSize: 100,
|
|
@@ -44840,15 +44754,19 @@ class AxiosTransformStream extends stream__default['default'].Transform{
|
|
|
44840
44754
|
ticksRate: 2,
|
|
44841
44755
|
samplesCount: 15
|
|
44842
44756
|
}, null, (prop, source) => {
|
|
44843
|
-
return !utils
|
|
44757
|
+
return !utils.isUndefined(source[prop]);
|
|
44844
44758
|
});
|
|
44845
44759
|
|
|
44846
44760
|
super({
|
|
44847
44761
|
readableHighWaterMark: options.chunkSize
|
|
44848
44762
|
});
|
|
44849
44763
|
|
|
44764
|
+
const self = this;
|
|
44765
|
+
|
|
44850
44766
|
const internals = this[kInternals] = {
|
|
44767
|
+
length: options.length,
|
|
44851
44768
|
timeWindow: options.timeWindow,
|
|
44769
|
+
ticksRate: options.ticksRate,
|
|
44852
44770
|
chunkSize: options.chunkSize,
|
|
44853
44771
|
maxRate: options.maxRate,
|
|
44854
44772
|
minChunkSize: options.minChunkSize,
|
|
@@ -44860,6 +44778,8 @@ class AxiosTransformStream extends stream__default['default'].Transform{
|
|
|
44860
44778
|
onReadCallback: null
|
|
44861
44779
|
};
|
|
44862
44780
|
|
|
44781
|
+
const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
|
|
44782
|
+
|
|
44863
44783
|
this.on('newListener', event => {
|
|
44864
44784
|
if (event === 'progress') {
|
|
44865
44785
|
if (!internals.isCaptured) {
|
|
@@ -44867,6 +44787,38 @@ class AxiosTransformStream extends stream__default['default'].Transform{
|
|
|
44867
44787
|
}
|
|
44868
44788
|
}
|
|
44869
44789
|
});
|
|
44790
|
+
|
|
44791
|
+
let bytesNotified = 0;
|
|
44792
|
+
|
|
44793
|
+
internals.updateProgress = throttle(function throttledHandler() {
|
|
44794
|
+
const totalBytes = internals.length;
|
|
44795
|
+
const bytesTransferred = internals.bytesSeen;
|
|
44796
|
+
const progressBytes = bytesTransferred - bytesNotified;
|
|
44797
|
+
if (!progressBytes || self.destroyed) return;
|
|
44798
|
+
|
|
44799
|
+
const rate = _speedometer(progressBytes);
|
|
44800
|
+
|
|
44801
|
+
bytesNotified = bytesTransferred;
|
|
44802
|
+
|
|
44803
|
+
process.nextTick(() => {
|
|
44804
|
+
self.emit('progress', {
|
|
44805
|
+
'loaded': bytesTransferred,
|
|
44806
|
+
'total': totalBytes,
|
|
44807
|
+
'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
|
|
44808
|
+
'bytes': progressBytes,
|
|
44809
|
+
'rate': rate ? rate : undefined,
|
|
44810
|
+
'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
|
|
44811
|
+
(totalBytes - bytesTransferred) / rate : undefined
|
|
44812
|
+
});
|
|
44813
|
+
});
|
|
44814
|
+
}, internals.ticksRate);
|
|
44815
|
+
|
|
44816
|
+
const onFinish = () => {
|
|
44817
|
+
internals.updateProgress(true);
|
|
44818
|
+
};
|
|
44819
|
+
|
|
44820
|
+
this.once('end', onFinish);
|
|
44821
|
+
this.once('error', onFinish);
|
|
44870
44822
|
}
|
|
44871
44823
|
|
|
44872
44824
|
_read(size) {
|
|
@@ -44880,6 +44832,7 @@ class AxiosTransformStream extends stream__default['default'].Transform{
|
|
|
44880
44832
|
}
|
|
44881
44833
|
|
|
44882
44834
|
_transform(chunk, encoding, callback) {
|
|
44835
|
+
const self = this;
|
|
44883
44836
|
const internals = this[kInternals];
|
|
44884
44837
|
const maxRate = internals.maxRate;
|
|
44885
44838
|
|
|
@@ -44891,14 +44844,16 @@ class AxiosTransformStream extends stream__default['default'].Transform{
|
|
|
44891
44844
|
const bytesThreshold = (maxRate / divider);
|
|
44892
44845
|
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
|
44893
44846
|
|
|
44894
|
-
|
|
44847
|
+
function pushChunk(_chunk, _callback) {
|
|
44895
44848
|
const bytes = Buffer.byteLength(_chunk);
|
|
44896
44849
|
internals.bytesSeen += bytes;
|
|
44897
44850
|
internals.bytes += bytes;
|
|
44898
44851
|
|
|
44899
|
-
|
|
44852
|
+
if (internals.isCaptured) {
|
|
44853
|
+
internals.updateProgress();
|
|
44854
|
+
}
|
|
44900
44855
|
|
|
44901
|
-
if (
|
|
44856
|
+
if (self.push(_chunk)) {
|
|
44902
44857
|
process.nextTick(_callback);
|
|
44903
44858
|
} else {
|
|
44904
44859
|
internals.onReadCallback = () => {
|
|
@@ -44906,7 +44861,7 @@ class AxiosTransformStream extends stream__default['default'].Transform{
|
|
|
44906
44861
|
process.nextTick(_callback);
|
|
44907
44862
|
};
|
|
44908
44863
|
}
|
|
44909
|
-
}
|
|
44864
|
+
}
|
|
44910
44865
|
|
|
44911
44866
|
const transformChunk = (_chunk, _callback) => {
|
|
44912
44867
|
const chunkSize = Buffer.byteLength(_chunk);
|
|
@@ -44963,299 +44918,13 @@ class AxiosTransformStream extends stream__default['default'].Transform{
|
|
|
44963
44918
|
}
|
|
44964
44919
|
});
|
|
44965
44920
|
}
|
|
44966
|
-
}
|
|
44967
|
-
|
|
44968
|
-
const {asyncIterator} = Symbol;
|
|
44969
|
-
|
|
44970
|
-
const readBlob = async function* (blob) {
|
|
44971
|
-
if (blob.stream) {
|
|
44972
|
-
yield* blob.stream();
|
|
44973
|
-
} else if (blob.arrayBuffer) {
|
|
44974
|
-
yield await blob.arrayBuffer();
|
|
44975
|
-
} else if (blob[asyncIterator]) {
|
|
44976
|
-
yield* blob[asyncIterator]();
|
|
44977
|
-
} else {
|
|
44978
|
-
yield blob;
|
|
44979
|
-
}
|
|
44980
|
-
};
|
|
44981
|
-
|
|
44982
|
-
const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
|
|
44983
|
-
|
|
44984
|
-
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util__default['default'].TextEncoder();
|
|
44985
|
-
|
|
44986
|
-
const CRLF = '\r\n';
|
|
44987
|
-
const CRLF_BYTES = textEncoder.encode(CRLF);
|
|
44988
|
-
const CRLF_BYTES_COUNT = 2;
|
|
44989
|
-
|
|
44990
|
-
class FormDataPart {
|
|
44991
|
-
constructor(name, value) {
|
|
44992
|
-
const {escapeName} = this.constructor;
|
|
44993
|
-
const isStringValue = utils$1.isString(value);
|
|
44994
|
-
|
|
44995
|
-
let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
|
|
44996
|
-
!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
|
|
44997
|
-
}${CRLF}`;
|
|
44998
44921
|
|
|
44999
|
-
|
|
45000
|
-
|
|
45001
|
-
|
|
45002
|
-
headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`;
|
|
45003
|
-
}
|
|
45004
|
-
|
|
45005
|
-
this.headers = textEncoder.encode(headers + CRLF);
|
|
45006
|
-
|
|
45007
|
-
this.contentLength = isStringValue ? value.byteLength : value.size;
|
|
45008
|
-
|
|
45009
|
-
this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
|
|
45010
|
-
|
|
45011
|
-
this.name = name;
|
|
45012
|
-
this.value = value;
|
|
45013
|
-
}
|
|
45014
|
-
|
|
45015
|
-
async *encode(){
|
|
45016
|
-
yield this.headers;
|
|
45017
|
-
|
|
45018
|
-
const {value} = this;
|
|
45019
|
-
|
|
45020
|
-
if(utils$1.isTypedArray(value)) {
|
|
45021
|
-
yield value;
|
|
45022
|
-
} else {
|
|
45023
|
-
yield* readBlob(value);
|
|
45024
|
-
}
|
|
45025
|
-
|
|
45026
|
-
yield CRLF_BYTES;
|
|
45027
|
-
}
|
|
45028
|
-
|
|
45029
|
-
static escapeName(name) {
|
|
45030
|
-
return String(name).replace(/[\r\n"]/g, (match) => ({
|
|
45031
|
-
'\r' : '%0D',
|
|
45032
|
-
'\n' : '%0A',
|
|
45033
|
-
'"' : '%22',
|
|
45034
|
-
}[match]));
|
|
45035
|
-
}
|
|
45036
|
-
}
|
|
45037
|
-
|
|
45038
|
-
const formDataToStream = (form, headersHandler, options) => {
|
|
45039
|
-
const {
|
|
45040
|
-
tag = 'form-data-boundary',
|
|
45041
|
-
size = 25,
|
|
45042
|
-
boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
|
|
45043
|
-
} = options || {};
|
|
45044
|
-
|
|
45045
|
-
if(!utils$1.isFormData(form)) {
|
|
45046
|
-
throw TypeError('FormData instance required');
|
|
45047
|
-
}
|
|
45048
|
-
|
|
45049
|
-
if (boundary.length < 1 || boundary.length > 70) {
|
|
45050
|
-
throw Error('boundary must be 10-70 characters long')
|
|
45051
|
-
}
|
|
45052
|
-
|
|
45053
|
-
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
|
45054
|
-
const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
|
|
45055
|
-
let contentLength = footerBytes.byteLength;
|
|
45056
|
-
|
|
45057
|
-
const parts = Array.from(form.entries()).map(([name, value]) => {
|
|
45058
|
-
const part = new FormDataPart(name, value);
|
|
45059
|
-
contentLength += part.size;
|
|
45060
|
-
return part;
|
|
45061
|
-
});
|
|
45062
|
-
|
|
45063
|
-
contentLength += boundaryBytes.byteLength * parts.length;
|
|
45064
|
-
|
|
45065
|
-
contentLength = utils$1.toFiniteNumber(contentLength);
|
|
45066
|
-
|
|
45067
|
-
const computedHeaders = {
|
|
45068
|
-
'Content-Type': `multipart/form-data; boundary=${boundary}`
|
|
45069
|
-
};
|
|
45070
|
-
|
|
45071
|
-
if (Number.isFinite(contentLength)) {
|
|
45072
|
-
computedHeaders['Content-Length'] = contentLength;
|
|
45073
|
-
}
|
|
45074
|
-
|
|
45075
|
-
headersHandler && headersHandler(computedHeaders);
|
|
45076
|
-
|
|
45077
|
-
return stream.Readable.from((async function *() {
|
|
45078
|
-
for(const part of parts) {
|
|
45079
|
-
yield boundaryBytes;
|
|
45080
|
-
yield* part.encode();
|
|
45081
|
-
}
|
|
45082
|
-
|
|
45083
|
-
yield footerBytes;
|
|
45084
|
-
})());
|
|
45085
|
-
};
|
|
45086
|
-
|
|
45087
|
-
class ZlibHeaderTransformStream extends stream__default['default'].Transform {
|
|
45088
|
-
__transform(chunk, encoding, callback) {
|
|
45089
|
-
this.push(chunk);
|
|
45090
|
-
callback();
|
|
45091
|
-
}
|
|
45092
|
-
|
|
45093
|
-
_transform(chunk, encoding, callback) {
|
|
45094
|
-
if (chunk.length !== 0) {
|
|
45095
|
-
this._transform = this.__transform;
|
|
45096
|
-
|
|
45097
|
-
// Add Default Compression headers if no zlib headers are present
|
|
45098
|
-
if (chunk[0] !== 120) { // Hex: 78
|
|
45099
|
-
const header = Buffer.alloc(2);
|
|
45100
|
-
header[0] = 120; // Hex: 78
|
|
45101
|
-
header[1] = 156; // Hex: 9C
|
|
45102
|
-
this.push(header, encoding);
|
|
45103
|
-
}
|
|
45104
|
-
}
|
|
45105
|
-
|
|
45106
|
-
this.__transform(chunk, encoding, callback);
|
|
44922
|
+
setLength(length) {
|
|
44923
|
+
this[kInternals].length = +length;
|
|
44924
|
+
return this;
|
|
45107
44925
|
}
|
|
45108
44926
|
}
|
|
45109
44927
|
|
|
45110
|
-
const callbackify = (fn, reducer) => {
|
|
45111
|
-
return utils$1.isAsyncFn(fn) ? function (...args) {
|
|
45112
|
-
const cb = args.pop();
|
|
45113
|
-
fn.apply(this, args).then((value) => {
|
|
45114
|
-
try {
|
|
45115
|
-
reducer ? cb(null, ...reducer(value)) : cb(null, value);
|
|
45116
|
-
} catch (err) {
|
|
45117
|
-
cb(err);
|
|
45118
|
-
}
|
|
45119
|
-
}, cb);
|
|
45120
|
-
} : fn;
|
|
45121
|
-
};
|
|
45122
|
-
|
|
45123
|
-
/**
|
|
45124
|
-
* Calculate data maxRate
|
|
45125
|
-
* @param {Number} [samplesCount= 10]
|
|
45126
|
-
* @param {Number} [min= 1000]
|
|
45127
|
-
* @returns {Function}
|
|
45128
|
-
*/
|
|
45129
|
-
function speedometer(samplesCount, min) {
|
|
45130
|
-
samplesCount = samplesCount || 10;
|
|
45131
|
-
const bytes = new Array(samplesCount);
|
|
45132
|
-
const timestamps = new Array(samplesCount);
|
|
45133
|
-
let head = 0;
|
|
45134
|
-
let tail = 0;
|
|
45135
|
-
let firstSampleTS;
|
|
45136
|
-
|
|
45137
|
-
min = min !== undefined ? min : 1000;
|
|
45138
|
-
|
|
45139
|
-
return function push(chunkLength) {
|
|
45140
|
-
const now = Date.now();
|
|
45141
|
-
|
|
45142
|
-
const startedAt = timestamps[tail];
|
|
45143
|
-
|
|
45144
|
-
if (!firstSampleTS) {
|
|
45145
|
-
firstSampleTS = now;
|
|
45146
|
-
}
|
|
45147
|
-
|
|
45148
|
-
bytes[head] = chunkLength;
|
|
45149
|
-
timestamps[head] = now;
|
|
45150
|
-
|
|
45151
|
-
let i = tail;
|
|
45152
|
-
let bytesCount = 0;
|
|
45153
|
-
|
|
45154
|
-
while (i !== head) {
|
|
45155
|
-
bytesCount += bytes[i++];
|
|
45156
|
-
i = i % samplesCount;
|
|
45157
|
-
}
|
|
45158
|
-
|
|
45159
|
-
head = (head + 1) % samplesCount;
|
|
45160
|
-
|
|
45161
|
-
if (head === tail) {
|
|
45162
|
-
tail = (tail + 1) % samplesCount;
|
|
45163
|
-
}
|
|
45164
|
-
|
|
45165
|
-
if (now - firstSampleTS < min) {
|
|
45166
|
-
return;
|
|
45167
|
-
}
|
|
45168
|
-
|
|
45169
|
-
const passed = startedAt && now - startedAt;
|
|
45170
|
-
|
|
45171
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
45172
|
-
};
|
|
45173
|
-
}
|
|
45174
|
-
|
|
45175
|
-
/**
|
|
45176
|
-
* Throttle decorator
|
|
45177
|
-
* @param {Function} fn
|
|
45178
|
-
* @param {Number} freq
|
|
45179
|
-
* @return {Function}
|
|
45180
|
-
*/
|
|
45181
|
-
function throttle(fn, freq) {
|
|
45182
|
-
let timestamp = 0;
|
|
45183
|
-
let threshold = 1000 / freq;
|
|
45184
|
-
let lastArgs;
|
|
45185
|
-
let timer;
|
|
45186
|
-
|
|
45187
|
-
const invoke = (args, now = Date.now()) => {
|
|
45188
|
-
timestamp = now;
|
|
45189
|
-
lastArgs = null;
|
|
45190
|
-
if (timer) {
|
|
45191
|
-
clearTimeout(timer);
|
|
45192
|
-
timer = null;
|
|
45193
|
-
}
|
|
45194
|
-
fn.apply(null, args);
|
|
45195
|
-
};
|
|
45196
|
-
|
|
45197
|
-
const throttled = (...args) => {
|
|
45198
|
-
const now = Date.now();
|
|
45199
|
-
const passed = now - timestamp;
|
|
45200
|
-
if ( passed >= threshold) {
|
|
45201
|
-
invoke(args, now);
|
|
45202
|
-
} else {
|
|
45203
|
-
lastArgs = args;
|
|
45204
|
-
if (!timer) {
|
|
45205
|
-
timer = setTimeout(() => {
|
|
45206
|
-
timer = null;
|
|
45207
|
-
invoke(lastArgs);
|
|
45208
|
-
}, threshold - passed);
|
|
45209
|
-
}
|
|
45210
|
-
}
|
|
45211
|
-
};
|
|
45212
|
-
|
|
45213
|
-
const flush = () => lastArgs && invoke(lastArgs);
|
|
45214
|
-
|
|
45215
|
-
return [throttled, flush];
|
|
45216
|
-
}
|
|
45217
|
-
|
|
45218
|
-
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
45219
|
-
let bytesNotified = 0;
|
|
45220
|
-
const _speedometer = speedometer(50, 250);
|
|
45221
|
-
|
|
45222
|
-
return throttle(e => {
|
|
45223
|
-
const loaded = e.loaded;
|
|
45224
|
-
const total = e.lengthComputable ? e.total : undefined;
|
|
45225
|
-
const progressBytes = loaded - bytesNotified;
|
|
45226
|
-
const rate = _speedometer(progressBytes);
|
|
45227
|
-
const inRange = loaded <= total;
|
|
45228
|
-
|
|
45229
|
-
bytesNotified = loaded;
|
|
45230
|
-
|
|
45231
|
-
const data = {
|
|
45232
|
-
loaded,
|
|
45233
|
-
total,
|
|
45234
|
-
progress: total ? (loaded / total) : undefined,
|
|
45235
|
-
bytes: progressBytes,
|
|
45236
|
-
rate: rate ? rate : undefined,
|
|
45237
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
45238
|
-
event: e,
|
|
45239
|
-
lengthComputable: total != null,
|
|
45240
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
45241
|
-
};
|
|
45242
|
-
|
|
45243
|
-
listener(data);
|
|
45244
|
-
}, freq);
|
|
45245
|
-
};
|
|
45246
|
-
|
|
45247
|
-
const progressEventDecorator = (total, throttled) => {
|
|
45248
|
-
const lengthComputable = total != null;
|
|
45249
|
-
|
|
45250
|
-
return [(loaded) => throttled[0]({
|
|
45251
|
-
lengthComputable,
|
|
45252
|
-
total,
|
|
45253
|
-
loaded
|
|
45254
|
-
}), throttled[1]];
|
|
45255
|
-
};
|
|
45256
|
-
|
|
45257
|
-
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
45258
|
-
|
|
45259
44928
|
const zlibOptions = {
|
|
45260
44929
|
flush: zlib__default['default'].constants.Z_SYNC_FLUSH,
|
|
45261
44930
|
finishFlush: zlib__default['default'].constants.Z_SYNC_FLUSH
|
|
@@ -45266,7 +44935,7 @@ const brotliOptions = {
|
|
|
45266
44935
|
finishFlush: zlib__default['default'].constants.BROTLI_OPERATION_FLUSH
|
|
45267
44936
|
};
|
|
45268
44937
|
|
|
45269
|
-
const isBrotliSupported = utils
|
|
44938
|
+
const isBrotliSupported = utils.isFunction(zlib__default['default'].createBrotliDecompress);
|
|
45270
44939
|
|
|
45271
44940
|
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
|
45272
44941
|
|
|
@@ -45276,14 +44945,6 @@ const supportedProtocols = platform.protocols.map(protocol => {
|
|
|
45276
44945
|
return protocol + ':';
|
|
45277
44946
|
});
|
|
45278
44947
|
|
|
45279
|
-
const flushOnFinish = (stream, [throttled, flush]) => {
|
|
45280
|
-
stream
|
|
45281
|
-
.on('end', flush)
|
|
45282
|
-
.on('error', flush);
|
|
45283
|
-
|
|
45284
|
-
return throttled;
|
|
45285
|
-
};
|
|
45286
|
-
|
|
45287
44948
|
/**
|
|
45288
44949
|
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
|
45289
44950
|
* object.
|
|
@@ -45292,12 +44953,12 @@ const flushOnFinish = (stream, [throttled, flush]) => {
|
|
|
45292
44953
|
*
|
|
45293
44954
|
* @returns {Object<string, any>}
|
|
45294
44955
|
*/
|
|
45295
|
-
function dispatchBeforeRedirect(options
|
|
44956
|
+
function dispatchBeforeRedirect(options) {
|
|
45296
44957
|
if (options.beforeRedirects.proxy) {
|
|
45297
44958
|
options.beforeRedirects.proxy(options);
|
|
45298
44959
|
}
|
|
45299
44960
|
if (options.beforeRedirects.config) {
|
|
45300
|
-
options.beforeRedirects.config(options
|
|
44961
|
+
options.beforeRedirects.config(options);
|
|
45301
44962
|
}
|
|
45302
44963
|
}
|
|
45303
44964
|
|
|
@@ -45313,7 +44974,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
|
|
|
45313
44974
|
function setProxy(options, configProxy, location) {
|
|
45314
44975
|
let proxy = configProxy;
|
|
45315
44976
|
if (!proxy && proxy !== false) {
|
|
45316
|
-
const proxyUrl =
|
|
44977
|
+
const proxyUrl = getProxyForUrl_1(location);
|
|
45317
44978
|
if (proxyUrl) {
|
|
45318
44979
|
proxy = new URL(proxyUrl);
|
|
45319
44980
|
}
|
|
@@ -45354,77 +45015,27 @@ function setProxy(options, configProxy, location) {
|
|
|
45354
45015
|
};
|
|
45355
45016
|
}
|
|
45356
45017
|
|
|
45357
|
-
const isHttpAdapterSupported = typeof process !== 'undefined' && utils
|
|
45358
|
-
|
|
45359
|
-
// temporary hotfix
|
|
45360
|
-
|
|
45361
|
-
const wrapAsync = (asyncExecutor) => {
|
|
45362
|
-
return new Promise((resolve, reject) => {
|
|
45363
|
-
let onDone;
|
|
45364
|
-
let isDone;
|
|
45365
|
-
|
|
45366
|
-
const done = (value, isRejected) => {
|
|
45367
|
-
if (isDone) return;
|
|
45368
|
-
isDone = true;
|
|
45369
|
-
onDone && onDone(value, isRejected);
|
|
45370
|
-
};
|
|
45371
|
-
|
|
45372
|
-
const _resolve = (value) => {
|
|
45373
|
-
done(value);
|
|
45374
|
-
resolve(value);
|
|
45375
|
-
};
|
|
45376
|
-
|
|
45377
|
-
const _reject = (reason) => {
|
|
45378
|
-
done(reason, true);
|
|
45379
|
-
reject(reason);
|
|
45380
|
-
};
|
|
45381
|
-
|
|
45382
|
-
asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
|
|
45383
|
-
})
|
|
45384
|
-
};
|
|
45385
|
-
|
|
45386
|
-
const resolveFamily = ({address, family}) => {
|
|
45387
|
-
if (!utils$1.isString(address)) {
|
|
45388
|
-
throw TypeError('address must be a string');
|
|
45389
|
-
}
|
|
45390
|
-
return ({
|
|
45391
|
-
address,
|
|
45392
|
-
family: family || (address.indexOf('.') < 0 ? 6 : 4)
|
|
45393
|
-
});
|
|
45394
|
-
};
|
|
45395
|
-
|
|
45396
|
-
const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
|
|
45018
|
+
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
|
45397
45019
|
|
|
45398
45020
|
/*eslint consistent-return:0*/
|
|
45399
45021
|
var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
45400
|
-
return
|
|
45401
|
-
let
|
|
45402
|
-
const
|
|
45022
|
+
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
|
45023
|
+
let data = config.data;
|
|
45024
|
+
const responseType = config.responseType;
|
|
45025
|
+
const responseEncoding = config.responseEncoding;
|
|
45403
45026
|
const method = config.method.toUpperCase();
|
|
45027
|
+
let isFinished;
|
|
45404
45028
|
let isDone;
|
|
45405
45029
|
let rejected = false;
|
|
45406
45030
|
let req;
|
|
45407
45031
|
|
|
45408
|
-
if (lookup) {
|
|
45409
|
-
const _lookup = callbackify(lookup, (value) => utils$1.isArray(value) ? value : [value]);
|
|
45410
|
-
// hotfix to support opt.all option which is required for node 20.x
|
|
45411
|
-
lookup = (hostname, opt, cb) => {
|
|
45412
|
-
_lookup(hostname, opt, (err, arg0, arg1) => {
|
|
45413
|
-
if (err) {
|
|
45414
|
-
return cb(err);
|
|
45415
|
-
}
|
|
45416
|
-
|
|
45417
|
-
const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
|
45418
|
-
|
|
45419
|
-
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
45420
|
-
});
|
|
45421
|
-
};
|
|
45422
|
-
}
|
|
45423
|
-
|
|
45424
45032
|
// temporary internal emitter until the AxiosRequest class will be implemented
|
|
45425
|
-
const emitter = new
|
|
45033
|
+
const emitter = new EventEmitter__default['default']();
|
|
45034
|
+
|
|
45035
|
+
function onFinished() {
|
|
45036
|
+
if (isFinished) return;
|
|
45037
|
+
isFinished = true;
|
|
45426
45038
|
|
|
45427
|
-
const onFinished = () => {
|
|
45428
45039
|
if (config.cancelToken) {
|
|
45429
45040
|
config.cancelToken.unsubscribe(abort);
|
|
45430
45041
|
}
|
|
@@ -45434,15 +45045,28 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45434
45045
|
}
|
|
45435
45046
|
|
|
45436
45047
|
emitter.removeAllListeners();
|
|
45437
|
-
}
|
|
45048
|
+
}
|
|
45049
|
+
|
|
45050
|
+
function done(value, isRejected) {
|
|
45051
|
+
if (isDone) return;
|
|
45438
45052
|
|
|
45439
|
-
onDone((value, isRejected) => {
|
|
45440
45053
|
isDone = true;
|
|
45054
|
+
|
|
45441
45055
|
if (isRejected) {
|
|
45442
45056
|
rejected = true;
|
|
45443
45057
|
onFinished();
|
|
45444
45058
|
}
|
|
45445
|
-
|
|
45059
|
+
|
|
45060
|
+
isRejected ? rejectPromise(value) : resolvePromise(value);
|
|
45061
|
+
}
|
|
45062
|
+
|
|
45063
|
+
const resolve = function resolve(value) {
|
|
45064
|
+
done(value);
|
|
45065
|
+
};
|
|
45066
|
+
|
|
45067
|
+
const reject = function reject(value) {
|
|
45068
|
+
done(value, true);
|
|
45069
|
+
};
|
|
45446
45070
|
|
|
45447
45071
|
function abort(reason) {
|
|
45448
45072
|
emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
|
@@ -45459,7 +45083,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45459
45083
|
|
|
45460
45084
|
// Parse url
|
|
45461
45085
|
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
45462
|
-
const parsed = new URL(fullPath
|
|
45086
|
+
const parsed = new URL(fullPath);
|
|
45463
45087
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
45464
45088
|
|
|
45465
45089
|
if (protocol === 'data:') {
|
|
@@ -45486,7 +45110,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45486
45110
|
convertedData = convertedData.toString(responseEncoding);
|
|
45487
45111
|
|
|
45488
45112
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
45489
|
-
|
|
45113
|
+
data = utils.stripBOM(convertedData);
|
|
45490
45114
|
}
|
|
45491
45115
|
} else if (responseType === 'stream') {
|
|
45492
45116
|
convertedData = stream__default['default'].Readable.from(convertedData);
|
|
@@ -45517,41 +45141,19 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45517
45141
|
// Only set header if it hasn't been set in config
|
|
45518
45142
|
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
45519
45143
|
|
|
45520
|
-
const
|
|
45144
|
+
const onDownloadProgress = config.onDownloadProgress;
|
|
45145
|
+
const onUploadProgress = config.onUploadProgress;
|
|
45521
45146
|
const maxRate = config.maxRate;
|
|
45522
45147
|
let maxUploadRate = undefined;
|
|
45523
45148
|
let maxDownloadRate = undefined;
|
|
45524
45149
|
|
|
45525
|
-
// support for
|
|
45526
|
-
if (utils
|
|
45527
|
-
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
|
45528
|
-
|
|
45529
|
-
data = formDataToStream(data, (formHeaders) => {
|
|
45530
|
-
headers.set(formHeaders);
|
|
45531
|
-
}, {
|
|
45532
|
-
tag: `axios-${VERSION}-boundary`,
|
|
45533
|
-
boundary: userBoundary && userBoundary[1] || undefined
|
|
45534
|
-
});
|
|
45535
|
-
// support for https://www.npmjs.com/package/form-data api
|
|
45536
|
-
} else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
|
|
45150
|
+
// support for https://www.npmjs.com/package/form-data api
|
|
45151
|
+
if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
|
45537
45152
|
headers.set(data.getHeaders());
|
|
45538
|
-
|
|
45539
|
-
if (
|
|
45540
|
-
try {
|
|
45541
|
-
const knownLength = await util__default['default'].promisify(data.getLength).call(data);
|
|
45542
|
-
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
|
45543
|
-
/*eslint no-empty:0*/
|
|
45544
|
-
} catch (e) {
|
|
45545
|
-
}
|
|
45546
|
-
}
|
|
45547
|
-
} else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
|
|
45548
|
-
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
|
45549
|
-
headers.setContentLength(data.size || 0);
|
|
45550
|
-
data = stream__default['default'].Readable.from(readBlob(data));
|
|
45551
|
-
} else if (data && !utils$1.isStream(data)) {
|
|
45552
|
-
if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
|
|
45153
|
+
} else if (data && !utils.isStream(data)) {
|
|
45154
|
+
if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
|
|
45553
45155
|
data = Buffer.from(new Uint8Array(data));
|
|
45554
|
-
} else if (utils
|
|
45156
|
+
} else if (utils.isString(data)) {
|
|
45555
45157
|
data = Buffer.from(data, 'utf-8');
|
|
45556
45158
|
} else {
|
|
45557
45159
|
return reject(new AxiosError(
|
|
@@ -45562,7 +45164,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45562
45164
|
}
|
|
45563
45165
|
|
|
45564
45166
|
// Add Content-Length header if data exists
|
|
45565
|
-
headers.
|
|
45167
|
+
headers.set('Content-Length', data.length, false);
|
|
45566
45168
|
|
|
45567
45169
|
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
|
45568
45170
|
return reject(new AxiosError(
|
|
@@ -45573,9 +45175,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45573
45175
|
}
|
|
45574
45176
|
}
|
|
45575
45177
|
|
|
45576
|
-
const contentLength = utils
|
|
45178
|
+
const contentLength = utils.toFiniteNumber(headers.getContentLength());
|
|
45577
45179
|
|
|
45578
|
-
if (utils
|
|
45180
|
+
if (utils.isArray(maxRate)) {
|
|
45579
45181
|
maxUploadRate = maxRate[0];
|
|
45580
45182
|
maxDownloadRate = maxRate[1];
|
|
45581
45183
|
} else {
|
|
@@ -45583,21 +45185,20 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45583
45185
|
}
|
|
45584
45186
|
|
|
45585
45187
|
if (data && (onUploadProgress || maxUploadRate)) {
|
|
45586
|
-
if (!utils
|
|
45188
|
+
if (!utils.isStream(data)) {
|
|
45587
45189
|
data = stream__default['default'].Readable.from(data, {objectMode: false});
|
|
45588
45190
|
}
|
|
45589
45191
|
|
|
45590
45192
|
data = stream__default['default'].pipeline([data, new AxiosTransformStream({
|
|
45591
|
-
|
|
45592
|
-
|
|
45593
|
-
|
|
45594
|
-
|
|
45595
|
-
|
|
45596
|
-
|
|
45597
|
-
|
|
45598
|
-
|
|
45599
|
-
|
|
45600
|
-
));
|
|
45193
|
+
length: contentLength,
|
|
45194
|
+
maxRate: utils.toFiniteNumber(maxUploadRate)
|
|
45195
|
+
})], utils.noop);
|
|
45196
|
+
|
|
45197
|
+
onUploadProgress && data.on('progress', progress => {
|
|
45198
|
+
onUploadProgress(Object.assign(progress, {
|
|
45199
|
+
upload: true
|
|
45200
|
+
}));
|
|
45201
|
+
});
|
|
45601
45202
|
}
|
|
45602
45203
|
|
|
45603
45204
|
// HTTP basic authentication
|
|
@@ -45644,18 +45245,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45644
45245
|
agents: { http: config.httpAgent, https: config.httpsAgent },
|
|
45645
45246
|
auth,
|
|
45646
45247
|
protocol,
|
|
45647
|
-
family,
|
|
45648
45248
|
beforeRedirect: dispatchBeforeRedirect,
|
|
45649
45249
|
beforeRedirects: {}
|
|
45650
45250
|
};
|
|
45651
45251
|
|
|
45652
|
-
// cacheable-lookup integration hotfix
|
|
45653
|
-
!utils$1.isUndefined(lookup) && (options.lookup = lookup);
|
|
45654
|
-
|
|
45655
45252
|
if (config.socketPath) {
|
|
45656
45253
|
options.socketPath = config.socketPath;
|
|
45657
45254
|
} else {
|
|
45658
|
-
options.hostname = parsed.hostname
|
|
45255
|
+
options.hostname = parsed.hostname;
|
|
45659
45256
|
options.port = parsed.port;
|
|
45660
45257
|
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
|
45661
45258
|
}
|
|
@@ -45696,18 +45293,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45696
45293
|
|
|
45697
45294
|
const responseLength = +res.headers['content-length'];
|
|
45698
45295
|
|
|
45699
|
-
if (onDownloadProgress
|
|
45296
|
+
if (onDownloadProgress) {
|
|
45700
45297
|
const transformStream = new AxiosTransformStream({
|
|
45701
|
-
|
|
45298
|
+
length: utils.toFiniteNumber(responseLength),
|
|
45299
|
+
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
|
45702
45300
|
});
|
|
45703
45301
|
|
|
45704
|
-
onDownloadProgress && transformStream.on('progress',
|
|
45705
|
-
|
|
45706
|
-
|
|
45707
|
-
|
|
45708
|
-
|
|
45709
|
-
)
|
|
45710
|
-
));
|
|
45302
|
+
onDownloadProgress && transformStream.on('progress', progress => {
|
|
45303
|
+
onDownloadProgress(Object.assign(progress, {
|
|
45304
|
+
download: true
|
|
45305
|
+
}));
|
|
45306
|
+
});
|
|
45711
45307
|
|
|
45712
45308
|
streams.push(transformStream);
|
|
45713
45309
|
}
|
|
@@ -45726,21 +45322,13 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45726
45322
|
delete res.headers['content-encoding'];
|
|
45727
45323
|
}
|
|
45728
45324
|
|
|
45729
|
-
switch (
|
|
45325
|
+
switch (res.headers['content-encoding']) {
|
|
45730
45326
|
/*eslint default-case:0*/
|
|
45731
45327
|
case 'gzip':
|
|
45732
45328
|
case 'x-gzip':
|
|
45733
45329
|
case 'compress':
|
|
45734
45330
|
case 'x-compress':
|
|
45735
|
-
// add the unzipper to the body stream processing pipeline
|
|
45736
|
-
streams.push(zlib__default['default'].createUnzip(zlibOptions));
|
|
45737
|
-
|
|
45738
|
-
// remove the content-encoding in order to not confuse downstream operations
|
|
45739
|
-
delete res.headers['content-encoding'];
|
|
45740
|
-
break;
|
|
45741
45331
|
case 'deflate':
|
|
45742
|
-
streams.push(new ZlibHeaderTransformStream());
|
|
45743
|
-
|
|
45744
45332
|
// add the unzipper to the body stream processing pipeline
|
|
45745
45333
|
streams.push(zlib__default['default'].createUnzip(zlibOptions));
|
|
45746
45334
|
|
|
@@ -45755,7 +45343,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45755
45343
|
}
|
|
45756
45344
|
}
|
|
45757
45345
|
|
|
45758
|
-
responseStream = streams.length > 1 ? stream__default['default'].pipeline(streams, utils
|
|
45346
|
+
responseStream = streams.length > 1 ? stream__default['default'].pipeline(streams, utils.noop) : streams[0];
|
|
45759
45347
|
|
|
45760
45348
|
const offListeners = stream__default['default'].finished(responseStream, () => {
|
|
45761
45349
|
offListeners();
|
|
@@ -45797,7 +45385,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45797
45385
|
}
|
|
45798
45386
|
|
|
45799
45387
|
const err = new AxiosError(
|
|
45800
|
-
'
|
|
45388
|
+
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
45801
45389
|
AxiosError.ERR_BAD_RESPONSE,
|
|
45802
45390
|
config,
|
|
45803
45391
|
lastRequest
|
|
@@ -45817,12 +45405,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45817
45405
|
if (responseType !== 'arraybuffer') {
|
|
45818
45406
|
responseData = responseData.toString(responseEncoding);
|
|
45819
45407
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
45820
|
-
responseData = utils
|
|
45408
|
+
responseData = utils.stripBOM(responseData);
|
|
45821
45409
|
}
|
|
45822
45410
|
}
|
|
45823
45411
|
response.data = responseData;
|
|
45824
45412
|
} catch (err) {
|
|
45825
|
-
|
|
45413
|
+
reject(AxiosError.from(err, null, config, response.request, response));
|
|
45826
45414
|
}
|
|
45827
45415
|
settle(resolve, reject, response);
|
|
45828
45416
|
});
|
|
@@ -45859,7 +45447,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45859
45447
|
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
|
45860
45448
|
const timeout = parseInt(config.timeout, 10);
|
|
45861
45449
|
|
|
45862
|
-
if (
|
|
45450
|
+
if (isNaN(timeout)) {
|
|
45863
45451
|
reject(new AxiosError(
|
|
45864
45452
|
'error trying to parse `config.timeout` to int',
|
|
45865
45453
|
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
@@ -45894,7 +45482,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45894
45482
|
|
|
45895
45483
|
|
|
45896
45484
|
// Send the request
|
|
45897
|
-
if (utils
|
|
45485
|
+
if (utils.isStream(data)) {
|
|
45898
45486
|
let ended = false;
|
|
45899
45487
|
let errored = false;
|
|
45900
45488
|
|
|
@@ -45920,235 +45508,72 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45920
45508
|
});
|
|
45921
45509
|
};
|
|
45922
45510
|
|
|
45923
|
-
|
|
45924
|
-
|
|
45925
|
-
|
|
45926
|
-
return (
|
|
45927
|
-
origin.protocol === url.protocol &&
|
|
45928
|
-
origin.host === url.host &&
|
|
45929
|
-
(isMSIE || origin.port === url.port)
|
|
45930
|
-
);
|
|
45931
|
-
})(
|
|
45932
|
-
new URL(platform.origin),
|
|
45933
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
45934
|
-
) : () => true;
|
|
45935
|
-
|
|
45936
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
45937
|
-
|
|
45938
|
-
// Standard browser envs support document.cookie
|
|
45939
|
-
{
|
|
45940
|
-
write(name, value, expires, path, domain, secure) {
|
|
45941
|
-
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
45942
|
-
|
|
45943
|
-
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
45944
|
-
|
|
45945
|
-
utils$1.isString(path) && cookie.push('path=' + path);
|
|
45946
|
-
|
|
45947
|
-
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
45948
|
-
|
|
45949
|
-
secure === true && cookie.push('secure');
|
|
45950
|
-
|
|
45951
|
-
document.cookie = cookie.join('; ');
|
|
45952
|
-
},
|
|
45953
|
-
|
|
45954
|
-
read(name) {
|
|
45955
|
-
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
45956
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
45957
|
-
},
|
|
45958
|
-
|
|
45959
|
-
remove(name) {
|
|
45960
|
-
this.write(name, '', Date.now() - 86400000);
|
|
45961
|
-
}
|
|
45962
|
-
}
|
|
45963
|
-
|
|
45964
|
-
:
|
|
45965
|
-
|
|
45966
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
45967
|
-
{
|
|
45968
|
-
write() {},
|
|
45969
|
-
read() {
|
|
45970
|
-
return null;
|
|
45971
|
-
},
|
|
45972
|
-
remove() {}
|
|
45973
|
-
};
|
|
45974
|
-
|
|
45975
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
45976
|
-
|
|
45977
|
-
/**
|
|
45978
|
-
* Config-specific merge-function which creates a new config-object
|
|
45979
|
-
* by merging two configuration objects together.
|
|
45980
|
-
*
|
|
45981
|
-
* @param {Object} config1
|
|
45982
|
-
* @param {Object} config2
|
|
45983
|
-
*
|
|
45984
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
45985
|
-
*/
|
|
45986
|
-
function mergeConfig(config1, config2) {
|
|
45987
|
-
// eslint-disable-next-line no-param-reassign
|
|
45988
|
-
config2 = config2 || {};
|
|
45989
|
-
const config = {};
|
|
45511
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
45512
|
+
let bytesNotified = 0;
|
|
45513
|
+
const _speedometer = speedometer(50, 250);
|
|
45990
45514
|
|
|
45991
|
-
|
|
45992
|
-
|
|
45993
|
-
|
|
45994
|
-
|
|
45995
|
-
|
|
45996
|
-
|
|
45997
|
-
return source.slice();
|
|
45998
|
-
}
|
|
45999
|
-
return source;
|
|
46000
|
-
}
|
|
45515
|
+
return e => {
|
|
45516
|
+
const loaded = e.loaded;
|
|
45517
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
45518
|
+
const progressBytes = loaded - bytesNotified;
|
|
45519
|
+
const rate = _speedometer(progressBytes);
|
|
45520
|
+
const inRange = loaded <= total;
|
|
46001
45521
|
|
|
46002
|
-
|
|
46003
|
-
function mergeDeepProperties(a, b, prop , caseless) {
|
|
46004
|
-
if (!utils$1.isUndefined(b)) {
|
|
46005
|
-
return getMergedValue(a, b, prop , caseless);
|
|
46006
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
46007
|
-
return getMergedValue(undefined, a, prop , caseless);
|
|
46008
|
-
}
|
|
46009
|
-
}
|
|
45522
|
+
bytesNotified = loaded;
|
|
46010
45523
|
|
|
46011
|
-
|
|
46012
|
-
|
|
46013
|
-
|
|
46014
|
-
|
|
46015
|
-
|
|
46016
|
-
|
|
45524
|
+
const data = {
|
|
45525
|
+
loaded,
|
|
45526
|
+
total,
|
|
45527
|
+
progress: total ? (loaded / total) : undefined,
|
|
45528
|
+
bytes: progressBytes,
|
|
45529
|
+
rate: rate ? rate : undefined,
|
|
45530
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
45531
|
+
event: e
|
|
45532
|
+
};
|
|
46017
45533
|
|
|
46018
|
-
|
|
46019
|
-
function defaultToConfig2(a, b) {
|
|
46020
|
-
if (!utils$1.isUndefined(b)) {
|
|
46021
|
-
return getMergedValue(undefined, b);
|
|
46022
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
46023
|
-
return getMergedValue(undefined, a);
|
|
46024
|
-
}
|
|
46025
|
-
}
|
|
45534
|
+
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
46026
45535
|
|
|
46027
|
-
|
|
46028
|
-
function mergeDirectKeys(a, b, prop) {
|
|
46029
|
-
if (prop in config2) {
|
|
46030
|
-
return getMergedValue(a, b);
|
|
46031
|
-
} else if (prop in config1) {
|
|
46032
|
-
return getMergedValue(undefined, a);
|
|
46033
|
-
}
|
|
46034
|
-
}
|
|
46035
|
-
|
|
46036
|
-
const mergeMap = {
|
|
46037
|
-
url: valueFromConfig2,
|
|
46038
|
-
method: valueFromConfig2,
|
|
46039
|
-
data: valueFromConfig2,
|
|
46040
|
-
baseURL: defaultToConfig2,
|
|
46041
|
-
transformRequest: defaultToConfig2,
|
|
46042
|
-
transformResponse: defaultToConfig2,
|
|
46043
|
-
paramsSerializer: defaultToConfig2,
|
|
46044
|
-
timeout: defaultToConfig2,
|
|
46045
|
-
timeoutMessage: defaultToConfig2,
|
|
46046
|
-
withCredentials: defaultToConfig2,
|
|
46047
|
-
withXSRFToken: defaultToConfig2,
|
|
46048
|
-
adapter: defaultToConfig2,
|
|
46049
|
-
responseType: defaultToConfig2,
|
|
46050
|
-
xsrfCookieName: defaultToConfig2,
|
|
46051
|
-
xsrfHeaderName: defaultToConfig2,
|
|
46052
|
-
onUploadProgress: defaultToConfig2,
|
|
46053
|
-
onDownloadProgress: defaultToConfig2,
|
|
46054
|
-
decompress: defaultToConfig2,
|
|
46055
|
-
maxContentLength: defaultToConfig2,
|
|
46056
|
-
maxBodyLength: defaultToConfig2,
|
|
46057
|
-
beforeRedirect: defaultToConfig2,
|
|
46058
|
-
transport: defaultToConfig2,
|
|
46059
|
-
httpAgent: defaultToConfig2,
|
|
46060
|
-
httpsAgent: defaultToConfig2,
|
|
46061
|
-
cancelToken: defaultToConfig2,
|
|
46062
|
-
socketPath: defaultToConfig2,
|
|
46063
|
-
responseEncoding: defaultToConfig2,
|
|
46064
|
-
validateStatus: mergeDirectKeys,
|
|
46065
|
-
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
45536
|
+
listener(data);
|
|
46066
45537
|
};
|
|
46067
|
-
|
|
46068
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
46069
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
46070
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
46071
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
46072
|
-
});
|
|
46073
|
-
|
|
46074
|
-
return config;
|
|
46075
45538
|
}
|
|
46076
45539
|
|
|
46077
|
-
var resolveConfig = (config) => {
|
|
46078
|
-
const newConfig = mergeConfig({}, config);
|
|
46079
|
-
|
|
46080
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
46081
|
-
|
|
46082
|
-
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
46083
|
-
|
|
46084
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
46085
|
-
|
|
46086
|
-
// HTTP basic authentication
|
|
46087
|
-
if (auth) {
|
|
46088
|
-
headers.set('Authorization', 'Basic ' +
|
|
46089
|
-
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
|
46090
|
-
);
|
|
46091
|
-
}
|
|
46092
|
-
|
|
46093
|
-
let contentType;
|
|
46094
|
-
|
|
46095
|
-
if (utils$1.isFormData(data)) {
|
|
46096
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
46097
|
-
headers.setContentType(undefined); // Let the browser set it
|
|
46098
|
-
} else if ((contentType = headers.getContentType()) !== false) {
|
|
46099
|
-
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
46100
|
-
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
46101
|
-
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
46102
|
-
}
|
|
46103
|
-
}
|
|
46104
|
-
|
|
46105
|
-
// Add xsrf header
|
|
46106
|
-
// This is only done if running in a standard browser environment.
|
|
46107
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
46108
|
-
|
|
46109
|
-
if (platform.hasStandardBrowserEnv) {
|
|
46110
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
46111
|
-
|
|
46112
|
-
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
46113
|
-
// Add xsrf header
|
|
46114
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
46115
|
-
|
|
46116
|
-
if (xsrfValue) {
|
|
46117
|
-
headers.set(xsrfHeaderName, xsrfValue);
|
|
46118
|
-
}
|
|
46119
|
-
}
|
|
46120
|
-
}
|
|
46121
|
-
|
|
46122
|
-
return newConfig;
|
|
46123
|
-
};
|
|
46124
|
-
|
|
46125
45540
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
46126
45541
|
|
|
46127
45542
|
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
46128
45543
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
46129
|
-
|
|
46130
|
-
|
|
46131
|
-
const
|
|
46132
|
-
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
|
45544
|
+
let requestData = config.data;
|
|
45545
|
+
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
|
45546
|
+
const responseType = config.responseType;
|
|
46133
45547
|
let onCanceled;
|
|
46134
|
-
let uploadThrottled, downloadThrottled;
|
|
46135
|
-
let flushUpload, flushDownload;
|
|
46136
|
-
|
|
46137
45548
|
function done() {
|
|
46138
|
-
|
|
46139
|
-
|
|
45549
|
+
if (config.cancelToken) {
|
|
45550
|
+
config.cancelToken.unsubscribe(onCanceled);
|
|
45551
|
+
}
|
|
46140
45552
|
|
|
46141
|
-
|
|
45553
|
+
if (config.signal) {
|
|
45554
|
+
config.signal.removeEventListener('abort', onCanceled);
|
|
45555
|
+
}
|
|
45556
|
+
}
|
|
46142
45557
|
|
|
46143
|
-
|
|
45558
|
+
if (utils.isFormData(requestData) && (platform.isStandardBrowserWebWorkerEnv)) {
|
|
45559
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
|
46144
45560
|
}
|
|
46145
45561
|
|
|
46146
45562
|
let request = new XMLHttpRequest();
|
|
46147
45563
|
|
|
46148
|
-
|
|
45564
|
+
// HTTP basic authentication
|
|
45565
|
+
if (config.auth) {
|
|
45566
|
+
const username = config.auth.username || '';
|
|
45567
|
+
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
45568
|
+
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
45569
|
+
}
|
|
45570
|
+
|
|
45571
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
45572
|
+
|
|
45573
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
46149
45574
|
|
|
46150
45575
|
// Set the request timeout in MS
|
|
46151
|
-
request.timeout =
|
|
45576
|
+
request.timeout = config.timeout;
|
|
46152
45577
|
|
|
46153
45578
|
function onloadend() {
|
|
46154
45579
|
if (!request) {
|
|
@@ -46228,10 +45653,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46228
45653
|
|
|
46229
45654
|
// Handle timeout
|
|
46230
45655
|
request.ontimeout = function handleTimeout() {
|
|
46231
|
-
let timeoutErrorMessage =
|
|
46232
|
-
const transitional =
|
|
46233
|
-
if (
|
|
46234
|
-
timeoutErrorMessage =
|
|
45656
|
+
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
45657
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
45658
|
+
if (config.timeoutErrorMessage) {
|
|
45659
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
46235
45660
|
}
|
|
46236
45661
|
reject(new AxiosError(
|
|
46237
45662
|
timeoutErrorMessage,
|
|
@@ -46248,37 +45673,32 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46248
45673
|
|
|
46249
45674
|
// Add headers to the request
|
|
46250
45675
|
if ('setRequestHeader' in request) {
|
|
46251
|
-
utils
|
|
45676
|
+
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
46252
45677
|
request.setRequestHeader(key, val);
|
|
46253
45678
|
});
|
|
46254
45679
|
}
|
|
46255
45680
|
|
|
46256
45681
|
// Add withCredentials to request if needed
|
|
46257
|
-
if (!utils
|
|
46258
|
-
request.withCredentials = !!
|
|
45682
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
|
45683
|
+
request.withCredentials = !!config.withCredentials;
|
|
46259
45684
|
}
|
|
46260
45685
|
|
|
46261
45686
|
// Add responseType to request if needed
|
|
46262
45687
|
if (responseType && responseType !== 'json') {
|
|
46263
|
-
request.responseType =
|
|
45688
|
+
request.responseType = config.responseType;
|
|
46264
45689
|
}
|
|
46265
45690
|
|
|
46266
45691
|
// Handle progress if needed
|
|
46267
|
-
if (onDownloadProgress) {
|
|
46268
|
-
(
|
|
46269
|
-
request.addEventListener('progress', downloadThrottled);
|
|
45692
|
+
if (typeof config.onDownloadProgress === 'function') {
|
|
45693
|
+
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
|
46270
45694
|
}
|
|
46271
45695
|
|
|
46272
45696
|
// Not all browsers support upload events
|
|
46273
|
-
if (onUploadProgress && request.upload) {
|
|
46274
|
-
(
|
|
46275
|
-
|
|
46276
|
-
request.upload.addEventListener('progress', uploadThrottled);
|
|
46277
|
-
|
|
46278
|
-
request.upload.addEventListener('loadend', flushUpload);
|
|
45697
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
45698
|
+
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
|
46279
45699
|
}
|
|
46280
45700
|
|
|
46281
|
-
if (
|
|
45701
|
+
if (config.cancelToken || config.signal) {
|
|
46282
45702
|
// Handle cancellation
|
|
46283
45703
|
// eslint-disable-next-line func-names
|
|
46284
45704
|
onCanceled = cancel => {
|
|
@@ -46290,13 +45710,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46290
45710
|
request = null;
|
|
46291
45711
|
};
|
|
46292
45712
|
|
|
46293
|
-
|
|
46294
|
-
if (
|
|
46295
|
-
|
|
45713
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
45714
|
+
if (config.signal) {
|
|
45715
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
46296
45716
|
}
|
|
46297
45717
|
}
|
|
46298
45718
|
|
|
46299
|
-
const protocol = parseProtocol(
|
|
45719
|
+
const protocol = parseProtocol(fullPath);
|
|
46300
45720
|
|
|
46301
45721
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
46302
45722
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
@@ -46309,362 +45729,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46309
45729
|
});
|
|
46310
45730
|
};
|
|
46311
45731
|
|
|
46312
|
-
const composeSignals = (signals, timeout) => {
|
|
46313
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
46314
|
-
|
|
46315
|
-
if (timeout || length) {
|
|
46316
|
-
let controller = new AbortController();
|
|
46317
|
-
|
|
46318
|
-
let aborted;
|
|
46319
|
-
|
|
46320
|
-
const onabort = function (reason) {
|
|
46321
|
-
if (!aborted) {
|
|
46322
|
-
aborted = true;
|
|
46323
|
-
unsubscribe();
|
|
46324
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
46325
|
-
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
46326
|
-
}
|
|
46327
|
-
};
|
|
46328
|
-
|
|
46329
|
-
let timer = timeout && setTimeout(() => {
|
|
46330
|
-
timer = null;
|
|
46331
|
-
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
|
|
46332
|
-
}, timeout);
|
|
46333
|
-
|
|
46334
|
-
const unsubscribe = () => {
|
|
46335
|
-
if (signals) {
|
|
46336
|
-
timer && clearTimeout(timer);
|
|
46337
|
-
timer = null;
|
|
46338
|
-
signals.forEach(signal => {
|
|
46339
|
-
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
|
|
46340
|
-
});
|
|
46341
|
-
signals = null;
|
|
46342
|
-
}
|
|
46343
|
-
};
|
|
46344
|
-
|
|
46345
|
-
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
46346
|
-
|
|
46347
|
-
const {signal} = controller;
|
|
46348
|
-
|
|
46349
|
-
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
46350
|
-
|
|
46351
|
-
return signal;
|
|
46352
|
-
}
|
|
46353
|
-
};
|
|
46354
|
-
|
|
46355
|
-
const streamChunk = function* (chunk, chunkSize) {
|
|
46356
|
-
let len = chunk.byteLength;
|
|
46357
|
-
|
|
46358
|
-
if (!chunkSize || len < chunkSize) {
|
|
46359
|
-
yield chunk;
|
|
46360
|
-
return;
|
|
46361
|
-
}
|
|
46362
|
-
|
|
46363
|
-
let pos = 0;
|
|
46364
|
-
let end;
|
|
46365
|
-
|
|
46366
|
-
while (pos < len) {
|
|
46367
|
-
end = pos + chunkSize;
|
|
46368
|
-
yield chunk.slice(pos, end);
|
|
46369
|
-
pos = end;
|
|
46370
|
-
}
|
|
46371
|
-
};
|
|
46372
|
-
|
|
46373
|
-
const readBytes = async function* (iterable, chunkSize) {
|
|
46374
|
-
for await (const chunk of readStream(iterable)) {
|
|
46375
|
-
yield* streamChunk(chunk, chunkSize);
|
|
46376
|
-
}
|
|
46377
|
-
};
|
|
46378
|
-
|
|
46379
|
-
const readStream = async function* (stream) {
|
|
46380
|
-
if (stream[Symbol.asyncIterator]) {
|
|
46381
|
-
yield* stream;
|
|
46382
|
-
return;
|
|
46383
|
-
}
|
|
46384
|
-
|
|
46385
|
-
const reader = stream.getReader();
|
|
46386
|
-
try {
|
|
46387
|
-
for (;;) {
|
|
46388
|
-
const {done, value} = await reader.read();
|
|
46389
|
-
if (done) {
|
|
46390
|
-
break;
|
|
46391
|
-
}
|
|
46392
|
-
yield value;
|
|
46393
|
-
}
|
|
46394
|
-
} finally {
|
|
46395
|
-
await reader.cancel();
|
|
46396
|
-
}
|
|
46397
|
-
};
|
|
46398
|
-
|
|
46399
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
46400
|
-
const iterator = readBytes(stream, chunkSize);
|
|
46401
|
-
|
|
46402
|
-
let bytes = 0;
|
|
46403
|
-
let done;
|
|
46404
|
-
let _onFinish = (e) => {
|
|
46405
|
-
if (!done) {
|
|
46406
|
-
done = true;
|
|
46407
|
-
onFinish && onFinish(e);
|
|
46408
|
-
}
|
|
46409
|
-
};
|
|
46410
|
-
|
|
46411
|
-
return new ReadableStream({
|
|
46412
|
-
async pull(controller) {
|
|
46413
|
-
try {
|
|
46414
|
-
const {done, value} = await iterator.next();
|
|
46415
|
-
|
|
46416
|
-
if (done) {
|
|
46417
|
-
_onFinish();
|
|
46418
|
-
controller.close();
|
|
46419
|
-
return;
|
|
46420
|
-
}
|
|
46421
|
-
|
|
46422
|
-
let len = value.byteLength;
|
|
46423
|
-
if (onProgress) {
|
|
46424
|
-
let loadedBytes = bytes += len;
|
|
46425
|
-
onProgress(loadedBytes);
|
|
46426
|
-
}
|
|
46427
|
-
controller.enqueue(new Uint8Array(value));
|
|
46428
|
-
} catch (err) {
|
|
46429
|
-
_onFinish(err);
|
|
46430
|
-
throw err;
|
|
46431
|
-
}
|
|
46432
|
-
},
|
|
46433
|
-
cancel(reason) {
|
|
46434
|
-
_onFinish(reason);
|
|
46435
|
-
return iterator.return();
|
|
46436
|
-
}
|
|
46437
|
-
}, {
|
|
46438
|
-
highWaterMark: 2
|
|
46439
|
-
})
|
|
46440
|
-
};
|
|
46441
|
-
|
|
46442
|
-
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
46443
|
-
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
46444
|
-
|
|
46445
|
-
// used only inside the fetch adapter
|
|
46446
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
46447
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
46448
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
46449
|
-
);
|
|
46450
|
-
|
|
46451
|
-
const test = (fn, ...args) => {
|
|
46452
|
-
try {
|
|
46453
|
-
return !!fn(...args);
|
|
46454
|
-
} catch (e) {
|
|
46455
|
-
return false
|
|
46456
|
-
}
|
|
46457
|
-
};
|
|
46458
|
-
|
|
46459
|
-
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
46460
|
-
let duplexAccessed = false;
|
|
46461
|
-
|
|
46462
|
-
const hasContentType = new Request(platform.origin, {
|
|
46463
|
-
body: new ReadableStream(),
|
|
46464
|
-
method: 'POST',
|
|
46465
|
-
get duplex() {
|
|
46466
|
-
duplexAccessed = true;
|
|
46467
|
-
return 'half';
|
|
46468
|
-
},
|
|
46469
|
-
}).headers.has('Content-Type');
|
|
46470
|
-
|
|
46471
|
-
return duplexAccessed && !hasContentType;
|
|
46472
|
-
});
|
|
46473
|
-
|
|
46474
|
-
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
46475
|
-
|
|
46476
|
-
const supportsResponseStream = isReadableStreamSupported &&
|
|
46477
|
-
test(() => utils$1.isReadableStream(new Response('').body));
|
|
46478
|
-
|
|
46479
|
-
|
|
46480
|
-
const resolvers = {
|
|
46481
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
46482
|
-
};
|
|
46483
|
-
|
|
46484
|
-
isFetchSupported && (((res) => {
|
|
46485
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
46486
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
46487
|
-
(_, config) => {
|
|
46488
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
46489
|
-
});
|
|
46490
|
-
});
|
|
46491
|
-
})(new Response));
|
|
46492
|
-
|
|
46493
|
-
const getBodyLength = async (body) => {
|
|
46494
|
-
if (body == null) {
|
|
46495
|
-
return 0;
|
|
46496
|
-
}
|
|
46497
|
-
|
|
46498
|
-
if(utils$1.isBlob(body)) {
|
|
46499
|
-
return body.size;
|
|
46500
|
-
}
|
|
46501
|
-
|
|
46502
|
-
if(utils$1.isSpecCompliantForm(body)) {
|
|
46503
|
-
const _request = new Request(platform.origin, {
|
|
46504
|
-
method: 'POST',
|
|
46505
|
-
body,
|
|
46506
|
-
});
|
|
46507
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
46508
|
-
}
|
|
46509
|
-
|
|
46510
|
-
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
46511
|
-
return body.byteLength;
|
|
46512
|
-
}
|
|
46513
|
-
|
|
46514
|
-
if(utils$1.isURLSearchParams(body)) {
|
|
46515
|
-
body = body + '';
|
|
46516
|
-
}
|
|
46517
|
-
|
|
46518
|
-
if(utils$1.isString(body)) {
|
|
46519
|
-
return (await encodeText(body)).byteLength;
|
|
46520
|
-
}
|
|
46521
|
-
};
|
|
46522
|
-
|
|
46523
|
-
const resolveBodyLength = async (headers, body) => {
|
|
46524
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
46525
|
-
|
|
46526
|
-
return length == null ? getBodyLength(body) : length;
|
|
46527
|
-
};
|
|
46528
|
-
|
|
46529
|
-
var fetchAdapter = isFetchSupported && (async (config) => {
|
|
46530
|
-
let {
|
|
46531
|
-
url,
|
|
46532
|
-
method,
|
|
46533
|
-
data,
|
|
46534
|
-
signal,
|
|
46535
|
-
cancelToken,
|
|
46536
|
-
timeout,
|
|
46537
|
-
onDownloadProgress,
|
|
46538
|
-
onUploadProgress,
|
|
46539
|
-
responseType,
|
|
46540
|
-
headers,
|
|
46541
|
-
withCredentials = 'same-origin',
|
|
46542
|
-
fetchOptions
|
|
46543
|
-
} = resolveConfig(config);
|
|
46544
|
-
|
|
46545
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
46546
|
-
|
|
46547
|
-
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
46548
|
-
|
|
46549
|
-
let request;
|
|
46550
|
-
|
|
46551
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
46552
|
-
composedSignal.unsubscribe();
|
|
46553
|
-
});
|
|
46554
|
-
|
|
46555
|
-
let requestContentLength;
|
|
46556
|
-
|
|
46557
|
-
try {
|
|
46558
|
-
if (
|
|
46559
|
-
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
46560
|
-
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
46561
|
-
) {
|
|
46562
|
-
let _request = new Request(url, {
|
|
46563
|
-
method: 'POST',
|
|
46564
|
-
body: data,
|
|
46565
|
-
duplex: "half"
|
|
46566
|
-
});
|
|
46567
|
-
|
|
46568
|
-
let contentTypeHeader;
|
|
46569
|
-
|
|
46570
|
-
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
46571
|
-
headers.setContentType(contentTypeHeader);
|
|
46572
|
-
}
|
|
46573
|
-
|
|
46574
|
-
if (_request.body) {
|
|
46575
|
-
const [onProgress, flush] = progressEventDecorator(
|
|
46576
|
-
requestContentLength,
|
|
46577
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
46578
|
-
);
|
|
46579
|
-
|
|
46580
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
46581
|
-
}
|
|
46582
|
-
}
|
|
46583
|
-
|
|
46584
|
-
if (!utils$1.isString(withCredentials)) {
|
|
46585
|
-
withCredentials = withCredentials ? 'include' : 'omit';
|
|
46586
|
-
}
|
|
46587
|
-
|
|
46588
|
-
// Cloudflare Workers throws when credentials are defined
|
|
46589
|
-
// see https://github.com/cloudflare/workerd/issues/902
|
|
46590
|
-
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
46591
|
-
request = new Request(url, {
|
|
46592
|
-
...fetchOptions,
|
|
46593
|
-
signal: composedSignal,
|
|
46594
|
-
method: method.toUpperCase(),
|
|
46595
|
-
headers: headers.normalize().toJSON(),
|
|
46596
|
-
body: data,
|
|
46597
|
-
duplex: "half",
|
|
46598
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
46599
|
-
});
|
|
46600
|
-
|
|
46601
|
-
let response = await fetch(request);
|
|
46602
|
-
|
|
46603
|
-
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
46604
|
-
|
|
46605
|
-
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
46606
|
-
const options = {};
|
|
46607
|
-
|
|
46608
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
46609
|
-
options[prop] = response[prop];
|
|
46610
|
-
});
|
|
46611
|
-
|
|
46612
|
-
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
46613
|
-
|
|
46614
|
-
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
46615
|
-
responseContentLength,
|
|
46616
|
-
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
46617
|
-
) || [];
|
|
46618
|
-
|
|
46619
|
-
response = new Response(
|
|
46620
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
46621
|
-
flush && flush();
|
|
46622
|
-
unsubscribe && unsubscribe();
|
|
46623
|
-
}),
|
|
46624
|
-
options
|
|
46625
|
-
);
|
|
46626
|
-
}
|
|
46627
|
-
|
|
46628
|
-
responseType = responseType || 'text';
|
|
46629
|
-
|
|
46630
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
46631
|
-
|
|
46632
|
-
!isStreamResponse && unsubscribe && unsubscribe();
|
|
46633
|
-
|
|
46634
|
-
return await new Promise((resolve, reject) => {
|
|
46635
|
-
settle(resolve, reject, {
|
|
46636
|
-
data: responseData,
|
|
46637
|
-
headers: AxiosHeaders.from(response.headers),
|
|
46638
|
-
status: response.status,
|
|
46639
|
-
statusText: response.statusText,
|
|
46640
|
-
config,
|
|
46641
|
-
request
|
|
46642
|
-
});
|
|
46643
|
-
})
|
|
46644
|
-
} catch (err) {
|
|
46645
|
-
unsubscribe && unsubscribe();
|
|
46646
|
-
|
|
46647
|
-
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
46648
|
-
throw Object.assign(
|
|
46649
|
-
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
46650
|
-
{
|
|
46651
|
-
cause: err.cause || err
|
|
46652
|
-
}
|
|
46653
|
-
)
|
|
46654
|
-
}
|
|
46655
|
-
|
|
46656
|
-
throw AxiosError.from(err, err && err.code, config, request);
|
|
46657
|
-
}
|
|
46658
|
-
});
|
|
46659
|
-
|
|
46660
45732
|
const knownAdapters = {
|
|
46661
45733
|
http: httpAdapter,
|
|
46662
|
-
xhr: xhrAdapter
|
|
46663
|
-
fetch: fetchAdapter
|
|
45734
|
+
xhr: xhrAdapter
|
|
46664
45735
|
};
|
|
46665
45736
|
|
|
46666
|
-
utils
|
|
46667
|
-
if
|
|
45737
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
45738
|
+
if(fn) {
|
|
46668
45739
|
try {
|
|
46669
45740
|
Object.defineProperty(fn, 'name', {value});
|
|
46670
45741
|
} catch (e) {
|
|
@@ -46674,58 +45745,40 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
46674
45745
|
}
|
|
46675
45746
|
});
|
|
46676
45747
|
|
|
46677
|
-
const renderReason = (reason) => `- ${reason}`;
|
|
46678
|
-
|
|
46679
|
-
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
46680
|
-
|
|
46681
45748
|
var adapters = {
|
|
46682
45749
|
getAdapter: (adapters) => {
|
|
46683
|
-
adapters = utils
|
|
45750
|
+
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
46684
45751
|
|
|
46685
45752
|
const {length} = adapters;
|
|
46686
45753
|
let nameOrAdapter;
|
|
46687
45754
|
let adapter;
|
|
46688
45755
|
|
|
46689
|
-
const rejectedReasons = {};
|
|
46690
|
-
|
|
46691
45756
|
for (let i = 0; i < length; i++) {
|
|
46692
45757
|
nameOrAdapter = adapters[i];
|
|
46693
|
-
|
|
46694
|
-
|
|
46695
|
-
adapter = nameOrAdapter;
|
|
46696
|
-
|
|
46697
|
-
if (!isResolvedHandle(nameOrAdapter)) {
|
|
46698
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
46699
|
-
|
|
46700
|
-
if (adapter === undefined) {
|
|
46701
|
-
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
46702
|
-
}
|
|
46703
|
-
}
|
|
46704
|
-
|
|
46705
|
-
if (adapter) {
|
|
45758
|
+
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
|
46706
45759
|
break;
|
|
46707
45760
|
}
|
|
46708
|
-
|
|
46709
|
-
rejectedReasons[id || '#' + i] = adapter;
|
|
46710
45761
|
}
|
|
46711
45762
|
|
|
46712
45763
|
if (!adapter) {
|
|
46713
|
-
|
|
46714
|
-
|
|
46715
|
-
|
|
46716
|
-
|
|
45764
|
+
if (adapter === false) {
|
|
45765
|
+
throw new AxiosError(
|
|
45766
|
+
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
|
45767
|
+
'ERR_NOT_SUPPORT'
|
|
46717
45768
|
);
|
|
45769
|
+
}
|
|
46718
45770
|
|
|
46719
|
-
|
|
46720
|
-
|
|
46721
|
-
|
|
46722
|
-
|
|
46723
|
-
throw new AxiosError(
|
|
46724
|
-
`There is no suitable adapter to dispatch the request ` + s,
|
|
46725
|
-
'ERR_NOT_SUPPORT'
|
|
45771
|
+
throw new Error(
|
|
45772
|
+
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
|
45773
|
+
`Adapter '${nameOrAdapter}' is not available in the build` :
|
|
45774
|
+
`Unknown adapter '${nameOrAdapter}'`
|
|
46726
45775
|
);
|
|
46727
45776
|
}
|
|
46728
45777
|
|
|
45778
|
+
if (!utils.isFunction(adapter)) {
|
|
45779
|
+
throw new TypeError('adapter is not a function');
|
|
45780
|
+
}
|
|
45781
|
+
|
|
46729
45782
|
return adapter;
|
|
46730
45783
|
},
|
|
46731
45784
|
adapters: knownAdapters
|
|
@@ -46804,6 +45857,107 @@ function dispatchRequest(config) {
|
|
|
46804
45857
|
});
|
|
46805
45858
|
}
|
|
46806
45859
|
|
|
45860
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
|
45861
|
+
|
|
45862
|
+
/**
|
|
45863
|
+
* Config-specific merge-function which creates a new config-object
|
|
45864
|
+
* by merging two configuration objects together.
|
|
45865
|
+
*
|
|
45866
|
+
* @param {Object} config1
|
|
45867
|
+
* @param {Object} config2
|
|
45868
|
+
*
|
|
45869
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
45870
|
+
*/
|
|
45871
|
+
function mergeConfig(config1, config2) {
|
|
45872
|
+
// eslint-disable-next-line no-param-reassign
|
|
45873
|
+
config2 = config2 || {};
|
|
45874
|
+
const config = {};
|
|
45875
|
+
|
|
45876
|
+
function getMergedValue(target, source, caseless) {
|
|
45877
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
45878
|
+
return utils.merge.call({caseless}, target, source);
|
|
45879
|
+
} else if (utils.isPlainObject(source)) {
|
|
45880
|
+
return utils.merge({}, source);
|
|
45881
|
+
} else if (utils.isArray(source)) {
|
|
45882
|
+
return source.slice();
|
|
45883
|
+
}
|
|
45884
|
+
return source;
|
|
45885
|
+
}
|
|
45886
|
+
|
|
45887
|
+
// eslint-disable-next-line consistent-return
|
|
45888
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
45889
|
+
if (!utils.isUndefined(b)) {
|
|
45890
|
+
return getMergedValue(a, b, caseless);
|
|
45891
|
+
} else if (!utils.isUndefined(a)) {
|
|
45892
|
+
return getMergedValue(undefined, a, caseless);
|
|
45893
|
+
}
|
|
45894
|
+
}
|
|
45895
|
+
|
|
45896
|
+
// eslint-disable-next-line consistent-return
|
|
45897
|
+
function valueFromConfig2(a, b) {
|
|
45898
|
+
if (!utils.isUndefined(b)) {
|
|
45899
|
+
return getMergedValue(undefined, b);
|
|
45900
|
+
}
|
|
45901
|
+
}
|
|
45902
|
+
|
|
45903
|
+
// eslint-disable-next-line consistent-return
|
|
45904
|
+
function defaultToConfig2(a, b) {
|
|
45905
|
+
if (!utils.isUndefined(b)) {
|
|
45906
|
+
return getMergedValue(undefined, b);
|
|
45907
|
+
} else if (!utils.isUndefined(a)) {
|
|
45908
|
+
return getMergedValue(undefined, a);
|
|
45909
|
+
}
|
|
45910
|
+
}
|
|
45911
|
+
|
|
45912
|
+
// eslint-disable-next-line consistent-return
|
|
45913
|
+
function mergeDirectKeys(a, b, prop) {
|
|
45914
|
+
if (prop in config2) {
|
|
45915
|
+
return getMergedValue(a, b);
|
|
45916
|
+
} else if (prop in config1) {
|
|
45917
|
+
return getMergedValue(undefined, a);
|
|
45918
|
+
}
|
|
45919
|
+
}
|
|
45920
|
+
|
|
45921
|
+
const mergeMap = {
|
|
45922
|
+
url: valueFromConfig2,
|
|
45923
|
+
method: valueFromConfig2,
|
|
45924
|
+
data: valueFromConfig2,
|
|
45925
|
+
baseURL: defaultToConfig2,
|
|
45926
|
+
transformRequest: defaultToConfig2,
|
|
45927
|
+
transformResponse: defaultToConfig2,
|
|
45928
|
+
paramsSerializer: defaultToConfig2,
|
|
45929
|
+
timeout: defaultToConfig2,
|
|
45930
|
+
timeoutMessage: defaultToConfig2,
|
|
45931
|
+
withCredentials: defaultToConfig2,
|
|
45932
|
+
adapter: defaultToConfig2,
|
|
45933
|
+
responseType: defaultToConfig2,
|
|
45934
|
+
xsrfCookieName: defaultToConfig2,
|
|
45935
|
+
xsrfHeaderName: defaultToConfig2,
|
|
45936
|
+
onUploadProgress: defaultToConfig2,
|
|
45937
|
+
onDownloadProgress: defaultToConfig2,
|
|
45938
|
+
decompress: defaultToConfig2,
|
|
45939
|
+
maxContentLength: defaultToConfig2,
|
|
45940
|
+
maxBodyLength: defaultToConfig2,
|
|
45941
|
+
beforeRedirect: defaultToConfig2,
|
|
45942
|
+
transport: defaultToConfig2,
|
|
45943
|
+
httpAgent: defaultToConfig2,
|
|
45944
|
+
httpsAgent: defaultToConfig2,
|
|
45945
|
+
cancelToken: defaultToConfig2,
|
|
45946
|
+
socketPath: defaultToConfig2,
|
|
45947
|
+
responseEncoding: defaultToConfig2,
|
|
45948
|
+
validateStatus: mergeDirectKeys,
|
|
45949
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
45950
|
+
};
|
|
45951
|
+
|
|
45952
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
45953
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
45954
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
45955
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
45956
|
+
});
|
|
45957
|
+
|
|
45958
|
+
return config;
|
|
45959
|
+
}
|
|
45960
|
+
|
|
46807
45961
|
const validators$1 = {};
|
|
46808
45962
|
|
|
46809
45963
|
// eslint-disable-next-line func-names
|
|
@@ -46853,14 +46007,6 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
46853
46007
|
};
|
|
46854
46008
|
};
|
|
46855
46009
|
|
|
46856
|
-
validators$1.spelling = function spelling(correctSpelling) {
|
|
46857
|
-
return (value, opt) => {
|
|
46858
|
-
// eslint-disable-next-line no-console
|
|
46859
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
46860
|
-
return true;
|
|
46861
|
-
}
|
|
46862
|
-
};
|
|
46863
|
-
|
|
46864
46010
|
/**
|
|
46865
46011
|
* Assert object's properties type
|
|
46866
46012
|
*
|
|
@@ -46925,34 +46071,7 @@ class Axios {
|
|
|
46925
46071
|
*
|
|
46926
46072
|
* @returns {Promise} The Promise to be fulfilled
|
|
46927
46073
|
*/
|
|
46928
|
-
|
|
46929
|
-
try {
|
|
46930
|
-
return await this._request(configOrUrl, config);
|
|
46931
|
-
} catch (err) {
|
|
46932
|
-
if (err instanceof Error) {
|
|
46933
|
-
let dummy = {};
|
|
46934
|
-
|
|
46935
|
-
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
46936
|
-
|
|
46937
|
-
// slice off the Error: ... line
|
|
46938
|
-
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
46939
|
-
try {
|
|
46940
|
-
if (!err.stack) {
|
|
46941
|
-
err.stack = stack;
|
|
46942
|
-
// match without the 2 top stack lines
|
|
46943
|
-
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
46944
|
-
err.stack += '\n' + stack;
|
|
46945
|
-
}
|
|
46946
|
-
} catch (e) {
|
|
46947
|
-
// ignore the case where "stack" is an un-writable property
|
|
46948
|
-
}
|
|
46949
|
-
}
|
|
46950
|
-
|
|
46951
|
-
throw err;
|
|
46952
|
-
}
|
|
46953
|
-
}
|
|
46954
|
-
|
|
46955
|
-
_request(configOrUrl, config) {
|
|
46074
|
+
request(configOrUrl, config) {
|
|
46956
46075
|
/*eslint no-param-reassign:0*/
|
|
46957
46076
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
46958
46077
|
if (typeof configOrUrl === 'string') {
|
|
@@ -46974,34 +46093,25 @@ class Axios {
|
|
|
46974
46093
|
}, false);
|
|
46975
46094
|
}
|
|
46976
46095
|
|
|
46977
|
-
if (paramsSerializer
|
|
46978
|
-
|
|
46979
|
-
|
|
46980
|
-
|
|
46981
|
-
|
|
46982
|
-
} else {
|
|
46983
|
-
validator.assertOptions(paramsSerializer, {
|
|
46984
|
-
encode: validators.function,
|
|
46985
|
-
serialize: validators.function
|
|
46986
|
-
}, true);
|
|
46987
|
-
}
|
|
46096
|
+
if (paramsSerializer !== undefined) {
|
|
46097
|
+
validator.assertOptions(paramsSerializer, {
|
|
46098
|
+
encode: validators.function,
|
|
46099
|
+
serialize: validators.function
|
|
46100
|
+
}, true);
|
|
46988
46101
|
}
|
|
46989
46102
|
|
|
46990
|
-
validator.assertOptions(config, {
|
|
46991
|
-
baseUrl: validators.spelling('baseURL'),
|
|
46992
|
-
withXsrfToken: validators.spelling('withXSRFToken')
|
|
46993
|
-
}, true);
|
|
46994
|
-
|
|
46995
46103
|
// Set config.method
|
|
46996
46104
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
46997
46105
|
|
|
46106
|
+
let contextHeaders;
|
|
46107
|
+
|
|
46998
46108
|
// Flatten headers
|
|
46999
|
-
|
|
46109
|
+
contextHeaders = headers && utils.merge(
|
|
47000
46110
|
headers.common,
|
|
47001
46111
|
headers[config.method]
|
|
47002
46112
|
);
|
|
47003
46113
|
|
|
47004
|
-
|
|
46114
|
+
contextHeaders && utils.forEach(
|
|
47005
46115
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
47006
46116
|
(method) => {
|
|
47007
46117
|
delete headers[method];
|
|
@@ -47088,7 +46198,7 @@ class Axios {
|
|
|
47088
46198
|
}
|
|
47089
46199
|
|
|
47090
46200
|
// Provide aliases for supported request methods
|
|
47091
|
-
utils
|
|
46201
|
+
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
47092
46202
|
/*eslint func-names:0*/
|
|
47093
46203
|
Axios.prototype[method] = function(url, config) {
|
|
47094
46204
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -47099,7 +46209,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
47099
46209
|
};
|
|
47100
46210
|
});
|
|
47101
46211
|
|
|
47102
|
-
utils
|
|
46212
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
47103
46213
|
/*eslint func-names:0*/
|
|
47104
46214
|
|
|
47105
46215
|
function generateHTTPMethod(isForm) {
|
|
@@ -47220,20 +46330,6 @@ class CancelToken {
|
|
|
47220
46330
|
}
|
|
47221
46331
|
}
|
|
47222
46332
|
|
|
47223
|
-
toAbortSignal() {
|
|
47224
|
-
const controller = new AbortController();
|
|
47225
|
-
|
|
47226
|
-
const abort = (err) => {
|
|
47227
|
-
controller.abort(err);
|
|
47228
|
-
};
|
|
47229
|
-
|
|
47230
|
-
this.subscribe(abort);
|
|
47231
|
-
|
|
47232
|
-
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
47233
|
-
|
|
47234
|
-
return controller.signal;
|
|
47235
|
-
}
|
|
47236
|
-
|
|
47237
46333
|
/**
|
|
47238
46334
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
47239
46335
|
* cancels the `CancelToken`.
|
|
@@ -47285,7 +46381,7 @@ function spread(callback) {
|
|
|
47285
46381
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
47286
46382
|
*/
|
|
47287
46383
|
function isAxiosError(payload) {
|
|
47288
|
-
return utils
|
|
46384
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
47289
46385
|
}
|
|
47290
46386
|
|
|
47291
46387
|
const HttpStatusCode = {
|
|
@@ -47370,10 +46466,10 @@ function createInstance(defaultConfig) {
|
|
|
47370
46466
|
const instance = bind(Axios.prototype.request, context);
|
|
47371
46467
|
|
|
47372
46468
|
// Copy axios.prototype to instance
|
|
47373
|
-
utils
|
|
46469
|
+
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
|
47374
46470
|
|
|
47375
46471
|
// Copy context to instance
|
|
47376
|
-
utils
|
|
46472
|
+
utils.extend(instance, context, null, {allOwnKeys: true});
|
|
47377
46473
|
|
|
47378
46474
|
// Factory for creating new instances
|
|
47379
46475
|
instance.create = function create(instanceConfig) {
|
|
@@ -47417,9 +46513,7 @@ axios.mergeConfig = mergeConfig;
|
|
|
47417
46513
|
|
|
47418
46514
|
axios.AxiosHeaders = AxiosHeaders;
|
|
47419
46515
|
|
|
47420
|
-
axios.formToJSON = thing => formDataToJSON(utils
|
|
47421
|
-
|
|
47422
|
-
axios.getAdapter = adapters.getAdapter;
|
|
46516
|
+
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
47423
46517
|
|
|
47424
46518
|
axios.HttpStatusCode = HttpStatusCode;
|
|
47425
46519
|
|