tp-react-elements-dev 1.6.7 → 1.6.8
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.esm.js +533 -1048
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +532 -1047
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as React$1 from 'react';
|
|
|
2
2
|
import React__default, { forwardRef, useContext, Children, isValidElement, cloneElement, useState, useRef, useEffect, useCallback, createContext, useMemo } from 'react';
|
|
3
3
|
import * as ReactDOM from 'react-dom';
|
|
4
4
|
import ReactDOM__default from 'react-dom';
|
|
5
|
-
import require$$1$2, { TextEncoder
|
|
5
|
+
import require$$1$2, { TextEncoder } from 'util';
|
|
6
6
|
import stream, { Readable } from 'stream';
|
|
7
7
|
import require$$1$3 from 'path';
|
|
8
8
|
import require$$3 from 'http';
|
|
@@ -13,7 +13,7 @@ import require$$4$2 from 'assert';
|
|
|
13
13
|
import require$$0$4 from 'tty';
|
|
14
14
|
import require$$0$3 from 'os';
|
|
15
15
|
import zlib from 'zlib';
|
|
16
|
-
import
|
|
16
|
+
import EventEmitter from 'events';
|
|
17
17
|
|
|
18
18
|
var isCheckBoxInput = (element) => element.type === 'checkbox';
|
|
19
19
|
|
|
@@ -25715,7 +25715,7 @@ const unstable_ClassNameGenerator = {
|
|
|
25715
25715
|
}
|
|
25716
25716
|
};
|
|
25717
25717
|
|
|
25718
|
-
var utils$
|
|
25718
|
+
var utils$1 = /*#__PURE__*/Object.freeze({
|
|
25719
25719
|
__proto__: null,
|
|
25720
25720
|
capitalize: capitalize$1,
|
|
25721
25721
|
createChainedFunction: createChainedFunction,
|
|
@@ -43064,7 +43064,7 @@ var ArrowDropDownSharp = {};
|
|
|
43064
43064
|
|
|
43065
43065
|
var createSvgIcon = {};
|
|
43066
43066
|
|
|
43067
|
-
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(utils$
|
|
43067
|
+
var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(utils$1);
|
|
43068
43068
|
|
|
43069
43069
|
var hasRequiredCreateSvgIcon;
|
|
43070
43070
|
|
|
@@ -53005,8 +53005,6 @@ const isFormData = (thing) => {
|
|
|
53005
53005
|
*/
|
|
53006
53006
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
53007
53007
|
|
|
53008
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
|
53009
|
-
|
|
53010
53008
|
/**
|
|
53011
53009
|
* Trim excess whitespace off the beginning and end of a string
|
|
53012
53010
|
*
|
|
@@ -53395,7 +53393,8 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
53395
53393
|
const noop$1 = () => {};
|
|
53396
53394
|
|
|
53397
53395
|
const toFiniteNumber = (value, defaultValue) => {
|
|
53398
|
-
|
|
53396
|
+
value = +value;
|
|
53397
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
53399
53398
|
};
|
|
53400
53399
|
|
|
53401
53400
|
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
@@ -53465,37 +53464,7 @@ const isAsyncFn = kindOfTest('AsyncFunction');
|
|
|
53465
53464
|
const isThenable = (thing) =>
|
|
53466
53465
|
thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
53467
53466
|
|
|
53468
|
-
|
|
53469
|
-
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
53470
|
-
|
|
53471
|
-
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
53472
|
-
if (setImmediateSupported) {
|
|
53473
|
-
return setImmediate;
|
|
53474
|
-
}
|
|
53475
|
-
|
|
53476
|
-
return postMessageSupported ? ((token, callbacks) => {
|
|
53477
|
-
_global.addEventListener("message", ({source, data}) => {
|
|
53478
|
-
if (source === _global && data === token) {
|
|
53479
|
-
callbacks.length && callbacks.shift()();
|
|
53480
|
-
}
|
|
53481
|
-
}, false);
|
|
53482
|
-
|
|
53483
|
-
return (cb) => {
|
|
53484
|
-
callbacks.push(cb);
|
|
53485
|
-
_global.postMessage(token, "*");
|
|
53486
|
-
}
|
|
53487
|
-
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
53488
|
-
})(
|
|
53489
|
-
typeof setImmediate === 'function',
|
|
53490
|
-
isFunction$1(_global.postMessage)
|
|
53491
|
-
);
|
|
53492
|
-
|
|
53493
|
-
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
53494
|
-
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
|
|
53495
|
-
|
|
53496
|
-
// *********************
|
|
53497
|
-
|
|
53498
|
-
var utils$1 = {
|
|
53467
|
+
var utils = {
|
|
53499
53468
|
isArray,
|
|
53500
53469
|
isArrayBuffer,
|
|
53501
53470
|
isBuffer: isBuffer$1,
|
|
@@ -53506,10 +53475,6 @@ var utils$1 = {
|
|
|
53506
53475
|
isBoolean,
|
|
53507
53476
|
isObject: isObject$1,
|
|
53508
53477
|
isPlainObject,
|
|
53509
|
-
isReadableStream,
|
|
53510
|
-
isRequest,
|
|
53511
|
-
isResponse,
|
|
53512
|
-
isHeaders,
|
|
53513
53478
|
isUndefined,
|
|
53514
53479
|
isDate: isDate$1,
|
|
53515
53480
|
isFile,
|
|
@@ -53550,9 +53515,7 @@ var utils$1 = {
|
|
|
53550
53515
|
isSpecCompliantForm,
|
|
53551
53516
|
toJSONObject,
|
|
53552
53517
|
isAsyncFn,
|
|
53553
|
-
isThenable
|
|
53554
|
-
setImmediate: _setImmediate,
|
|
53555
|
-
asap
|
|
53518
|
+
isThenable
|
|
53556
53519
|
};
|
|
53557
53520
|
|
|
53558
53521
|
/**
|
|
@@ -53580,13 +53543,10 @@ function AxiosError(message, code, config, request, response) {
|
|
|
53580
53543
|
code && (this.code = code);
|
|
53581
53544
|
config && (this.config = config);
|
|
53582
53545
|
request && (this.request = request);
|
|
53583
|
-
|
|
53584
|
-
this.response = response;
|
|
53585
|
-
this.status = response.status ? response.status : null;
|
|
53586
|
-
}
|
|
53546
|
+
response && (this.response = response);
|
|
53587
53547
|
}
|
|
53588
53548
|
|
|
53589
|
-
utils
|
|
53549
|
+
utils.inherits(AxiosError, Error, {
|
|
53590
53550
|
toJSON: function toJSON() {
|
|
53591
53551
|
return {
|
|
53592
53552
|
// Standard
|
|
@@ -53601,9 +53561,9 @@ utils$1.inherits(AxiosError, Error, {
|
|
|
53601
53561
|
columnNumber: this.columnNumber,
|
|
53602
53562
|
stack: this.stack,
|
|
53603
53563
|
// Axios
|
|
53604
|
-
config: utils
|
|
53564
|
+
config: utils.toJSONObject(this.config),
|
|
53605
53565
|
code: this.code,
|
|
53606
|
-
status: this.status
|
|
53566
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
53607
53567
|
};
|
|
53608
53568
|
}
|
|
53609
53569
|
});
|
|
@@ -53636,7 +53596,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
|
53636
53596
|
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
53637
53597
|
const axiosError = Object.create(prototype$1);
|
|
53638
53598
|
|
|
53639
|
-
utils
|
|
53599
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
53640
53600
|
return obj !== Error.prototype;
|
|
53641
53601
|
}, prop => {
|
|
53642
53602
|
return prop !== 'isAxiosError';
|
|
@@ -65786,7 +65746,7 @@ var FormData$2 = /*@__PURE__*/getDefaultExportFromCjs(form_data);
|
|
|
65786
65746
|
* @returns {boolean}
|
|
65787
65747
|
*/
|
|
65788
65748
|
function isVisitable(thing) {
|
|
65789
|
-
return utils
|
|
65749
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
65790
65750
|
}
|
|
65791
65751
|
|
|
65792
65752
|
/**
|
|
@@ -65797,7 +65757,7 @@ function isVisitable(thing) {
|
|
|
65797
65757
|
* @returns {string} the key without the brackets.
|
|
65798
65758
|
*/
|
|
65799
65759
|
function removeBrackets(key) {
|
|
65800
|
-
return utils
|
|
65760
|
+
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
65801
65761
|
}
|
|
65802
65762
|
|
|
65803
65763
|
/**
|
|
@@ -65826,10 +65786,10 @@ function renderKey(path, key, dots) {
|
|
|
65826
65786
|
* @returns {boolean}
|
|
65827
65787
|
*/
|
|
65828
65788
|
function isFlatArray(arr) {
|
|
65829
|
-
return utils
|
|
65789
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
65830
65790
|
}
|
|
65831
65791
|
|
|
65832
|
-
const predicates = utils
|
|
65792
|
+
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
65833
65793
|
return /^is[A-Z]/.test(prop);
|
|
65834
65794
|
});
|
|
65835
65795
|
|
|
@@ -65857,7 +65817,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
|
|
|
65857
65817
|
* @returns
|
|
65858
65818
|
*/
|
|
65859
65819
|
function toFormData(obj, formData, options) {
|
|
65860
|
-
if (!utils
|
|
65820
|
+
if (!utils.isObject(obj)) {
|
|
65861
65821
|
throw new TypeError('target must be an object');
|
|
65862
65822
|
}
|
|
65863
65823
|
|
|
@@ -65865,13 +65825,13 @@ function toFormData(obj, formData, options) {
|
|
|
65865
65825
|
formData = formData || new (FormData$2 || FormData)();
|
|
65866
65826
|
|
|
65867
65827
|
// eslint-disable-next-line no-param-reassign
|
|
65868
|
-
options = utils
|
|
65828
|
+
options = utils.toFlatObject(options, {
|
|
65869
65829
|
metaTokens: true,
|
|
65870
65830
|
dots: false,
|
|
65871
65831
|
indexes: false
|
|
65872
65832
|
}, false, function defined(option, source) {
|
|
65873
65833
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
65874
|
-
return !utils
|
|
65834
|
+
return !utils.isUndefined(source[option]);
|
|
65875
65835
|
});
|
|
65876
65836
|
|
|
65877
65837
|
const metaTokens = options.metaTokens;
|
|
@@ -65880,24 +65840,24 @@ function toFormData(obj, formData, options) {
|
|
|
65880
65840
|
const dots = options.dots;
|
|
65881
65841
|
const indexes = options.indexes;
|
|
65882
65842
|
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
65883
|
-
const useBlob = _Blob && utils
|
|
65843
|
+
const useBlob = _Blob && utils.isSpecCompliantForm(formData);
|
|
65884
65844
|
|
|
65885
|
-
if (!utils
|
|
65845
|
+
if (!utils.isFunction(visitor)) {
|
|
65886
65846
|
throw new TypeError('visitor must be a function');
|
|
65887
65847
|
}
|
|
65888
65848
|
|
|
65889
65849
|
function convertValue(value) {
|
|
65890
65850
|
if (value === null) return '';
|
|
65891
65851
|
|
|
65892
|
-
if (utils
|
|
65852
|
+
if (utils.isDate(value)) {
|
|
65893
65853
|
return value.toISOString();
|
|
65894
65854
|
}
|
|
65895
65855
|
|
|
65896
|
-
if (!useBlob && utils
|
|
65856
|
+
if (!useBlob && utils.isBlob(value)) {
|
|
65897
65857
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
65898
65858
|
}
|
|
65899
65859
|
|
|
65900
|
-
if (utils
|
|
65860
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
65901
65861
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
65902
65862
|
}
|
|
65903
65863
|
|
|
@@ -65918,20 +65878,20 @@ function toFormData(obj, formData, options) {
|
|
|
65918
65878
|
let arr = value;
|
|
65919
65879
|
|
|
65920
65880
|
if (value && !path && typeof value === 'object') {
|
|
65921
|
-
if (utils
|
|
65881
|
+
if (utils.endsWith(key, '{}')) {
|
|
65922
65882
|
// eslint-disable-next-line no-param-reassign
|
|
65923
65883
|
key = metaTokens ? key : key.slice(0, -2);
|
|
65924
65884
|
// eslint-disable-next-line no-param-reassign
|
|
65925
65885
|
value = JSON.stringify(value);
|
|
65926
65886
|
} else if (
|
|
65927
|
-
(utils
|
|
65928
|
-
((utils
|
|
65887
|
+
(utils.isArray(value) && isFlatArray(value)) ||
|
|
65888
|
+
((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
|
|
65929
65889
|
)) {
|
|
65930
65890
|
// eslint-disable-next-line no-param-reassign
|
|
65931
65891
|
key = removeBrackets(key);
|
|
65932
65892
|
|
|
65933
65893
|
arr.forEach(function each(el, index) {
|
|
65934
|
-
!(utils
|
|
65894
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
65935
65895
|
// eslint-disable-next-line no-nested-ternary
|
|
65936
65896
|
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
65937
65897
|
convertValue(el)
|
|
@@ -65959,7 +65919,7 @@ function toFormData(obj, formData, options) {
|
|
|
65959
65919
|
});
|
|
65960
65920
|
|
|
65961
65921
|
function build(value, path) {
|
|
65962
|
-
if (utils
|
|
65922
|
+
if (utils.isUndefined(value)) return;
|
|
65963
65923
|
|
|
65964
65924
|
if (stack.indexOf(value) !== -1) {
|
|
65965
65925
|
throw Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -65967,9 +65927,9 @@ function toFormData(obj, formData, options) {
|
|
|
65967
65927
|
|
|
65968
65928
|
stack.push(value);
|
|
65969
65929
|
|
|
65970
|
-
utils
|
|
65971
|
-
const result = !(utils
|
|
65972
|
-
formData, el, utils
|
|
65930
|
+
utils.forEach(value, function each(el, key) {
|
|
65931
|
+
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
65932
|
+
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
65973
65933
|
);
|
|
65974
65934
|
|
|
65975
65935
|
if (result === true) {
|
|
@@ -65980,7 +65940,7 @@ function toFormData(obj, formData, options) {
|
|
|
65980
65940
|
stack.pop();
|
|
65981
65941
|
}
|
|
65982
65942
|
|
|
65983
|
-
if (!utils
|
|
65943
|
+
if (!utils.isObject(obj)) {
|
|
65984
65944
|
throw new TypeError('data must be an object');
|
|
65985
65945
|
}
|
|
65986
65946
|
|
|
@@ -66084,7 +66044,7 @@ function buildURL(url, params, options) {
|
|
|
66084
66044
|
if (serializeFn) {
|
|
66085
66045
|
serializedParams = serializeFn(params, options);
|
|
66086
66046
|
} else {
|
|
66087
|
-
serializedParams = utils
|
|
66047
|
+
serializedParams = utils.isURLSearchParams(params) ?
|
|
66088
66048
|
params.toString() :
|
|
66089
66049
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
66090
66050
|
}
|
|
@@ -66159,7 +66119,7 @@ class InterceptorManager {
|
|
|
66159
66119
|
* @returns {void}
|
|
66160
66120
|
*/
|
|
66161
66121
|
forEach(fn) {
|
|
66162
|
-
utils
|
|
66122
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
66163
66123
|
if (h !== null) {
|
|
66164
66124
|
fn(h);
|
|
66165
66125
|
}
|
|
@@ -66175,7 +66135,7 @@ var transitionalDefaults = {
|
|
|
66175
66135
|
|
|
66176
66136
|
var URLSearchParams = require$$0$2.URLSearchParams;
|
|
66177
66137
|
|
|
66178
|
-
var platform
|
|
66138
|
+
var platform = {
|
|
66179
66139
|
isNode: true,
|
|
66180
66140
|
classes: {
|
|
66181
66141
|
URLSearchParams,
|
|
@@ -66185,68 +66145,10 @@ var platform$1 = {
|
|
|
66185
66145
|
protocols: [ 'http', 'https', 'file', 'data' ]
|
|
66186
66146
|
};
|
|
66187
66147
|
|
|
66188
|
-
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
66189
|
-
|
|
66190
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
66191
|
-
|
|
66192
|
-
/**
|
|
66193
|
-
* Determine if we're running in a standard browser environment
|
|
66194
|
-
*
|
|
66195
|
-
* This allows axios to run in a web worker, and react-native.
|
|
66196
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
66197
|
-
*
|
|
66198
|
-
* web workers:
|
|
66199
|
-
* typeof window -> undefined
|
|
66200
|
-
* typeof document -> undefined
|
|
66201
|
-
*
|
|
66202
|
-
* react-native:
|
|
66203
|
-
* navigator.product -> 'ReactNative'
|
|
66204
|
-
* nativescript
|
|
66205
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
66206
|
-
*
|
|
66207
|
-
* @returns {boolean}
|
|
66208
|
-
*/
|
|
66209
|
-
const hasStandardBrowserEnv = hasBrowserEnv &&
|
|
66210
|
-
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
66211
|
-
|
|
66212
|
-
/**
|
|
66213
|
-
* Determine if we're running in a standard browser webWorker environment
|
|
66214
|
-
*
|
|
66215
|
-
* Although the `isStandardBrowserEnv` method indicates that
|
|
66216
|
-
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
66217
|
-
* filtered out due to its judgment standard
|
|
66218
|
-
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
66219
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
66220
|
-
*/
|
|
66221
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
66222
|
-
return (
|
|
66223
|
-
typeof WorkerGlobalScope !== 'undefined' &&
|
|
66224
|
-
// eslint-disable-next-line no-undef
|
|
66225
|
-
self instanceof WorkerGlobalScope &&
|
|
66226
|
-
typeof self.importScripts === 'function'
|
|
66227
|
-
);
|
|
66228
|
-
})();
|
|
66229
|
-
|
|
66230
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
66231
|
-
|
|
66232
|
-
var utils = /*#__PURE__*/Object.freeze({
|
|
66233
|
-
__proto__: null,
|
|
66234
|
-
hasBrowserEnv: hasBrowserEnv,
|
|
66235
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
66236
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
66237
|
-
navigator: _navigator,
|
|
66238
|
-
origin: origin
|
|
66239
|
-
});
|
|
66240
|
-
|
|
66241
|
-
var platform = {
|
|
66242
|
-
...utils,
|
|
66243
|
-
...platform$1
|
|
66244
|
-
};
|
|
66245
|
-
|
|
66246
66148
|
function toURLEncodedForm(data, options) {
|
|
66247
66149
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
66248
66150
|
visitor: function(value, key, path, helpers) {
|
|
66249
|
-
if (
|
|
66151
|
+
if (utils.isBuffer(value)) {
|
|
66250
66152
|
this.append(key, value.toString('base64'));
|
|
66251
66153
|
return false;
|
|
66252
66154
|
}
|
|
@@ -66268,7 +66170,7 @@ function parsePropPath(name) {
|
|
|
66268
66170
|
// foo.x.y.z
|
|
66269
66171
|
// foo-x-y-z
|
|
66270
66172
|
// foo x y z
|
|
66271
|
-
return utils
|
|
66173
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
66272
66174
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
66273
66175
|
});
|
|
66274
66176
|
}
|
|
@@ -66303,15 +66205,12 @@ function arrayToObject(arr) {
|
|
|
66303
66205
|
function formDataToJSON(formData) {
|
|
66304
66206
|
function buildPath(path, value, target, index) {
|
|
66305
66207
|
let name = path[index++];
|
|
66306
|
-
|
|
66307
|
-
if (name === '__proto__') return true;
|
|
66308
|
-
|
|
66309
66208
|
const isNumericKey = Number.isFinite(+name);
|
|
66310
66209
|
const isLast = index >= path.length;
|
|
66311
|
-
name = !name && utils
|
|
66210
|
+
name = !name && utils.isArray(target) ? target.length : name;
|
|
66312
66211
|
|
|
66313
66212
|
if (isLast) {
|
|
66314
|
-
if (utils
|
|
66213
|
+
if (utils.hasOwnProp(target, name)) {
|
|
66315
66214
|
target[name] = [target[name], value];
|
|
66316
66215
|
} else {
|
|
66317
66216
|
target[name] = value;
|
|
@@ -66320,23 +66219,23 @@ function formDataToJSON(formData) {
|
|
|
66320
66219
|
return !isNumericKey;
|
|
66321
66220
|
}
|
|
66322
66221
|
|
|
66323
|
-
if (!target[name] || !utils
|
|
66222
|
+
if (!target[name] || !utils.isObject(target[name])) {
|
|
66324
66223
|
target[name] = [];
|
|
66325
66224
|
}
|
|
66326
66225
|
|
|
66327
66226
|
const result = buildPath(path, value, target[name], index);
|
|
66328
66227
|
|
|
66329
|
-
if (result && utils
|
|
66228
|
+
if (result && utils.isArray(target[name])) {
|
|
66330
66229
|
target[name] = arrayToObject(target[name]);
|
|
66331
66230
|
}
|
|
66332
66231
|
|
|
66333
66232
|
return !isNumericKey;
|
|
66334
66233
|
}
|
|
66335
66234
|
|
|
66336
|
-
if (utils
|
|
66235
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
66337
66236
|
const obj = {};
|
|
66338
66237
|
|
|
66339
|
-
utils
|
|
66238
|
+
utils.forEachEntry(formData, (name, value) => {
|
|
66340
66239
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
66341
66240
|
});
|
|
66342
66241
|
|
|
@@ -66357,10 +66256,10 @@ function formDataToJSON(formData) {
|
|
|
66357
66256
|
* @returns {string} A stringified version of the rawValue.
|
|
66358
66257
|
*/
|
|
66359
66258
|
function stringifySafely(rawValue, parser, encoder) {
|
|
66360
|
-
if (utils
|
|
66259
|
+
if (utils.isString(rawValue)) {
|
|
66361
66260
|
try {
|
|
66362
66261
|
(parser || JSON.parse)(rawValue);
|
|
66363
|
-
return utils
|
|
66262
|
+
return utils.trim(rawValue);
|
|
66364
66263
|
} catch (e) {
|
|
66365
66264
|
if (e.name !== 'SyntaxError') {
|
|
66366
66265
|
throw e;
|
|
@@ -66375,36 +66274,38 @@ const defaults = {
|
|
|
66375
66274
|
|
|
66376
66275
|
transitional: transitionalDefaults,
|
|
66377
66276
|
|
|
66378
|
-
adapter: ['xhr', 'http'
|
|
66277
|
+
adapter: ['xhr', 'http'],
|
|
66379
66278
|
|
|
66380
66279
|
transformRequest: [function transformRequest(data, headers) {
|
|
66381
66280
|
const contentType = headers.getContentType() || '';
|
|
66382
66281
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
66383
|
-
const isObjectPayload = utils
|
|
66282
|
+
const isObjectPayload = utils.isObject(data);
|
|
66384
66283
|
|
|
66385
|
-
if (isObjectPayload && utils
|
|
66284
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
66386
66285
|
data = new FormData(data);
|
|
66387
66286
|
}
|
|
66388
66287
|
|
|
66389
|
-
const isFormData = utils
|
|
66288
|
+
const isFormData = utils.isFormData(data);
|
|
66390
66289
|
|
|
66391
66290
|
if (isFormData) {
|
|
66291
|
+
if (!hasJSONContentType) {
|
|
66292
|
+
return data;
|
|
66293
|
+
}
|
|
66392
66294
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
66393
66295
|
}
|
|
66394
66296
|
|
|
66395
|
-
if (utils
|
|
66396
|
-
utils
|
|
66397
|
-
utils
|
|
66398
|
-
utils
|
|
66399
|
-
utils
|
|
66400
|
-
utils$1.isReadableStream(data)
|
|
66297
|
+
if (utils.isArrayBuffer(data) ||
|
|
66298
|
+
utils.isBuffer(data) ||
|
|
66299
|
+
utils.isStream(data) ||
|
|
66300
|
+
utils.isFile(data) ||
|
|
66301
|
+
utils.isBlob(data)
|
|
66401
66302
|
) {
|
|
66402
66303
|
return data;
|
|
66403
66304
|
}
|
|
66404
|
-
if (utils
|
|
66305
|
+
if (utils.isArrayBufferView(data)) {
|
|
66405
66306
|
return data.buffer;
|
|
66406
66307
|
}
|
|
66407
|
-
if (utils
|
|
66308
|
+
if (utils.isURLSearchParams(data)) {
|
|
66408
66309
|
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
66409
66310
|
return data.toString();
|
|
66410
66311
|
}
|
|
@@ -66416,7 +66317,7 @@ const defaults = {
|
|
|
66416
66317
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
66417
66318
|
}
|
|
66418
66319
|
|
|
66419
|
-
if ((isFileList = utils
|
|
66320
|
+
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
66420
66321
|
const _FormData = this.env && this.env.FormData;
|
|
66421
66322
|
|
|
66422
66323
|
return toFormData(
|
|
@@ -66440,11 +66341,7 @@ const defaults = {
|
|
|
66440
66341
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
66441
66342
|
const JSONRequested = this.responseType === 'json';
|
|
66442
66343
|
|
|
66443
|
-
if (utils
|
|
66444
|
-
return data;
|
|
66445
|
-
}
|
|
66446
|
-
|
|
66447
|
-
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
66344
|
+
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
66448
66345
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
66449
66346
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
66450
66347
|
|
|
@@ -66492,13 +66389,13 @@ const defaults = {
|
|
|
66492
66389
|
}
|
|
66493
66390
|
};
|
|
66494
66391
|
|
|
66495
|
-
utils
|
|
66392
|
+
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
66496
66393
|
defaults.headers[method] = {};
|
|
66497
66394
|
});
|
|
66498
66395
|
|
|
66499
66396
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
66500
66397
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
66501
|
-
const ignoreDuplicateOf = utils
|
|
66398
|
+
const ignoreDuplicateOf = utils.toObjectSet([
|
|
66502
66399
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
66503
66400
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
66504
66401
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
@@ -66559,7 +66456,7 @@ function normalizeValue(value) {
|
|
|
66559
66456
|
return value;
|
|
66560
66457
|
}
|
|
66561
66458
|
|
|
66562
|
-
return utils
|
|
66459
|
+
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
66563
66460
|
}
|
|
66564
66461
|
|
|
66565
66462
|
function parseTokens(str) {
|
|
@@ -66577,7 +66474,7 @@ function parseTokens(str) {
|
|
|
66577
66474
|
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
66578
66475
|
|
|
66579
66476
|
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
66580
|
-
if (utils
|
|
66477
|
+
if (utils.isFunction(filter)) {
|
|
66581
66478
|
return filter.call(this, value, header);
|
|
66582
66479
|
}
|
|
66583
66480
|
|
|
@@ -66585,13 +66482,13 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
66585
66482
|
value = header;
|
|
66586
66483
|
}
|
|
66587
66484
|
|
|
66588
|
-
if (!utils
|
|
66485
|
+
if (!utils.isString(value)) return;
|
|
66589
66486
|
|
|
66590
|
-
if (utils
|
|
66487
|
+
if (utils.isString(filter)) {
|
|
66591
66488
|
return value.indexOf(filter) !== -1;
|
|
66592
66489
|
}
|
|
66593
66490
|
|
|
66594
|
-
if (utils
|
|
66491
|
+
if (utils.isRegExp(filter)) {
|
|
66595
66492
|
return filter.test(value);
|
|
66596
66493
|
}
|
|
66597
66494
|
}
|
|
@@ -66604,7 +66501,7 @@ function formatHeader(header) {
|
|
|
66604
66501
|
}
|
|
66605
66502
|
|
|
66606
66503
|
function buildAccessors(obj, header) {
|
|
66607
|
-
const accessorName = utils
|
|
66504
|
+
const accessorName = utils.toCamelCase(' ' + header);
|
|
66608
66505
|
|
|
66609
66506
|
['get', 'set', 'has'].forEach(methodName => {
|
|
66610
66507
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
@@ -66631,7 +66528,7 @@ class AxiosHeaders {
|
|
|
66631
66528
|
throw new Error('header name must be a non-empty string');
|
|
66632
66529
|
}
|
|
66633
66530
|
|
|
66634
|
-
const key = utils
|
|
66531
|
+
const key = utils.findKey(self, lHeader);
|
|
66635
66532
|
|
|
66636
66533
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
66637
66534
|
self[key || _header] = normalizeValue(_value);
|
|
@@ -66639,16 +66536,12 @@ class AxiosHeaders {
|
|
|
66639
66536
|
}
|
|
66640
66537
|
|
|
66641
66538
|
const setHeaders = (headers, _rewrite) =>
|
|
66642
|
-
utils
|
|
66539
|
+
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
66643
66540
|
|
|
66644
|
-
if (utils
|
|
66541
|
+
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
66645
66542
|
setHeaders(header, valueOrRewrite);
|
|
66646
|
-
} else if(utils
|
|
66543
|
+
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
66647
66544
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
66648
|
-
} else if (utils$1.isHeaders(header)) {
|
|
66649
|
-
for (const [key, value] of header.entries()) {
|
|
66650
|
-
setHeader(value, key, rewrite);
|
|
66651
|
-
}
|
|
66652
66545
|
} else {
|
|
66653
66546
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
66654
66547
|
}
|
|
@@ -66660,7 +66553,7 @@ class AxiosHeaders {
|
|
|
66660
66553
|
header = normalizeHeader(header);
|
|
66661
66554
|
|
|
66662
66555
|
if (header) {
|
|
66663
|
-
const key = utils
|
|
66556
|
+
const key = utils.findKey(this, header);
|
|
66664
66557
|
|
|
66665
66558
|
if (key) {
|
|
66666
66559
|
const value = this[key];
|
|
@@ -66673,11 +66566,11 @@ class AxiosHeaders {
|
|
|
66673
66566
|
return parseTokens(value);
|
|
66674
66567
|
}
|
|
66675
66568
|
|
|
66676
|
-
if (utils
|
|
66569
|
+
if (utils.isFunction(parser)) {
|
|
66677
66570
|
return parser.call(this, value, key);
|
|
66678
66571
|
}
|
|
66679
66572
|
|
|
66680
|
-
if (utils
|
|
66573
|
+
if (utils.isRegExp(parser)) {
|
|
66681
66574
|
return parser.exec(value);
|
|
66682
66575
|
}
|
|
66683
66576
|
|
|
@@ -66690,7 +66583,7 @@ class AxiosHeaders {
|
|
|
66690
66583
|
header = normalizeHeader(header);
|
|
66691
66584
|
|
|
66692
66585
|
if (header) {
|
|
66693
|
-
const key = utils
|
|
66586
|
+
const key = utils.findKey(this, header);
|
|
66694
66587
|
|
|
66695
66588
|
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
66696
66589
|
}
|
|
@@ -66706,7 +66599,7 @@ class AxiosHeaders {
|
|
|
66706
66599
|
_header = normalizeHeader(_header);
|
|
66707
66600
|
|
|
66708
66601
|
if (_header) {
|
|
66709
|
-
const key = utils
|
|
66602
|
+
const key = utils.findKey(self, _header);
|
|
66710
66603
|
|
|
66711
66604
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
66712
66605
|
delete self[key];
|
|
@@ -66716,7 +66609,7 @@ class AxiosHeaders {
|
|
|
66716
66609
|
}
|
|
66717
66610
|
}
|
|
66718
66611
|
|
|
66719
|
-
if (utils
|
|
66612
|
+
if (utils.isArray(header)) {
|
|
66720
66613
|
header.forEach(deleteHeader);
|
|
66721
66614
|
} else {
|
|
66722
66615
|
deleteHeader(header);
|
|
@@ -66745,8 +66638,8 @@ class AxiosHeaders {
|
|
|
66745
66638
|
const self = this;
|
|
66746
66639
|
const headers = {};
|
|
66747
66640
|
|
|
66748
|
-
utils
|
|
66749
|
-
const key = utils
|
|
66641
|
+
utils.forEach(this, (value, header) => {
|
|
66642
|
+
const key = utils.findKey(headers, header);
|
|
66750
66643
|
|
|
66751
66644
|
if (key) {
|
|
66752
66645
|
self[key] = normalizeValue(value);
|
|
@@ -66775,8 +66668,8 @@ class AxiosHeaders {
|
|
|
66775
66668
|
toJSON(asStrings) {
|
|
66776
66669
|
const obj = Object.create(null);
|
|
66777
66670
|
|
|
66778
|
-
utils
|
|
66779
|
-
value != null && value !== false && (obj[header] = asStrings && utils
|
|
66671
|
+
utils.forEach(this, (value, header) => {
|
|
66672
|
+
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
|
66780
66673
|
});
|
|
66781
66674
|
|
|
66782
66675
|
return obj;
|
|
@@ -66823,7 +66716,7 @@ class AxiosHeaders {
|
|
|
66823
66716
|
}
|
|
66824
66717
|
}
|
|
66825
66718
|
|
|
66826
|
-
utils
|
|
66719
|
+
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
66827
66720
|
|
|
66828
66721
|
return this;
|
|
66829
66722
|
}
|
|
@@ -66832,7 +66725,7 @@ class AxiosHeaders {
|
|
|
66832
66725
|
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
66833
66726
|
|
|
66834
66727
|
// reserved names hotfix
|
|
66835
|
-
utils
|
|
66728
|
+
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
66836
66729
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
66837
66730
|
return {
|
|
66838
66731
|
get: () => value,
|
|
@@ -66842,7 +66735,7 @@ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
|
|
66842
66735
|
}
|
|
66843
66736
|
});
|
|
66844
66737
|
|
|
66845
|
-
utils
|
|
66738
|
+
utils.freezeMethods(AxiosHeaders);
|
|
66846
66739
|
|
|
66847
66740
|
/**
|
|
66848
66741
|
* Transform the data for a request or a response
|
|
@@ -66858,7 +66751,7 @@ function transformData(fns, response) {
|
|
|
66858
66751
|
const headers = AxiosHeaders.from(context.headers);
|
|
66859
66752
|
let data = context.data;
|
|
66860
66753
|
|
|
66861
|
-
utils
|
|
66754
|
+
utils.forEach(fns, function transform(fn) {
|
|
66862
66755
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
66863
66756
|
});
|
|
66864
66757
|
|
|
@@ -66886,7 +66779,7 @@ function CanceledError(message, config, request) {
|
|
|
66886
66779
|
this.name = 'CanceledError';
|
|
66887
66780
|
}
|
|
66888
66781
|
|
|
66889
|
-
utils
|
|
66782
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
66890
66783
|
__CANCEL__: true
|
|
66891
66784
|
});
|
|
66892
66785
|
|
|
@@ -66938,7 +66831,7 @@ function isAbsoluteURL(url) {
|
|
|
66938
66831
|
*/
|
|
66939
66832
|
function combineURLs(baseURL, relativeURL) {
|
|
66940
66833
|
return relativeURL
|
|
66941
|
-
? baseURL.replace(
|
|
66834
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
66942
66835
|
: baseURL;
|
|
66943
66836
|
}
|
|
66944
66837
|
|
|
@@ -68944,7 +68837,7 @@ followRedirects$1.exports.wrap = wrap;
|
|
|
68944
68837
|
var followRedirectsExports = followRedirects$1.exports;
|
|
68945
68838
|
var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
|
|
68946
68839
|
|
|
68947
|
-
const VERSION = "1.
|
|
68840
|
+
const VERSION = "1.5.1";
|
|
68948
68841
|
|
|
68949
68842
|
function parseProtocol(url) {
|
|
68950
68843
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -68999,11 +68892,93 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
68999
68892
|
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
69000
68893
|
}
|
|
69001
68894
|
|
|
68895
|
+
/**
|
|
68896
|
+
* Throttle decorator
|
|
68897
|
+
* @param {Function} fn
|
|
68898
|
+
* @param {Number} freq
|
|
68899
|
+
* @return {Function}
|
|
68900
|
+
*/
|
|
68901
|
+
function throttle(fn, freq) {
|
|
68902
|
+
let timestamp = 0;
|
|
68903
|
+
const threshold = 1000 / freq;
|
|
68904
|
+
let timer = null;
|
|
68905
|
+
return function throttled(force, args) {
|
|
68906
|
+
const now = Date.now();
|
|
68907
|
+
if (force || now - timestamp > threshold) {
|
|
68908
|
+
if (timer) {
|
|
68909
|
+
clearTimeout(timer);
|
|
68910
|
+
timer = null;
|
|
68911
|
+
}
|
|
68912
|
+
timestamp = now;
|
|
68913
|
+
return fn.apply(null, args);
|
|
68914
|
+
}
|
|
68915
|
+
if (!timer) {
|
|
68916
|
+
timer = setTimeout(() => {
|
|
68917
|
+
timer = null;
|
|
68918
|
+
timestamp = Date.now();
|
|
68919
|
+
return fn.apply(null, args);
|
|
68920
|
+
}, threshold - (now - timestamp));
|
|
68921
|
+
}
|
|
68922
|
+
};
|
|
68923
|
+
}
|
|
68924
|
+
|
|
68925
|
+
/**
|
|
68926
|
+
* Calculate data maxRate
|
|
68927
|
+
* @param {Number} [samplesCount= 10]
|
|
68928
|
+
* @param {Number} [min= 1000]
|
|
68929
|
+
* @returns {Function}
|
|
68930
|
+
*/
|
|
68931
|
+
function speedometer(samplesCount, min) {
|
|
68932
|
+
samplesCount = samplesCount || 10;
|
|
68933
|
+
const bytes = new Array(samplesCount);
|
|
68934
|
+
const timestamps = new Array(samplesCount);
|
|
68935
|
+
let head = 0;
|
|
68936
|
+
let tail = 0;
|
|
68937
|
+
let firstSampleTS;
|
|
68938
|
+
|
|
68939
|
+
min = min !== undefined ? min : 1000;
|
|
68940
|
+
|
|
68941
|
+
return function push(chunkLength) {
|
|
68942
|
+
const now = Date.now();
|
|
68943
|
+
|
|
68944
|
+
const startedAt = timestamps[tail];
|
|
68945
|
+
|
|
68946
|
+
if (!firstSampleTS) {
|
|
68947
|
+
firstSampleTS = now;
|
|
68948
|
+
}
|
|
68949
|
+
|
|
68950
|
+
bytes[head] = chunkLength;
|
|
68951
|
+
timestamps[head] = now;
|
|
68952
|
+
|
|
68953
|
+
let i = tail;
|
|
68954
|
+
let bytesCount = 0;
|
|
68955
|
+
|
|
68956
|
+
while (i !== head) {
|
|
68957
|
+
bytesCount += bytes[i++];
|
|
68958
|
+
i = i % samplesCount;
|
|
68959
|
+
}
|
|
68960
|
+
|
|
68961
|
+
head = (head + 1) % samplesCount;
|
|
68962
|
+
|
|
68963
|
+
if (head === tail) {
|
|
68964
|
+
tail = (tail + 1) % samplesCount;
|
|
68965
|
+
}
|
|
68966
|
+
|
|
68967
|
+
if (now - firstSampleTS < min) {
|
|
68968
|
+
return;
|
|
68969
|
+
}
|
|
68970
|
+
|
|
68971
|
+
const passed = startedAt && now - startedAt;
|
|
68972
|
+
|
|
68973
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
68974
|
+
};
|
|
68975
|
+
}
|
|
68976
|
+
|
|
69002
68977
|
const kInternals = Symbol('internals');
|
|
69003
68978
|
|
|
69004
68979
|
class AxiosTransformStream extends stream.Transform{
|
|
69005
68980
|
constructor(options) {
|
|
69006
|
-
options = utils
|
|
68981
|
+
options = utils.toFlatObject(options, {
|
|
69007
68982
|
maxRate: 0,
|
|
69008
68983
|
chunkSize: 64 * 1024,
|
|
69009
68984
|
minChunkSize: 100,
|
|
@@ -69011,15 +68986,19 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
69011
68986
|
ticksRate: 2,
|
|
69012
68987
|
samplesCount: 15
|
|
69013
68988
|
}, null, (prop, source) => {
|
|
69014
|
-
return !utils
|
|
68989
|
+
return !utils.isUndefined(source[prop]);
|
|
69015
68990
|
});
|
|
69016
68991
|
|
|
69017
68992
|
super({
|
|
69018
68993
|
readableHighWaterMark: options.chunkSize
|
|
69019
68994
|
});
|
|
69020
68995
|
|
|
68996
|
+
const self = this;
|
|
68997
|
+
|
|
69021
68998
|
const internals = this[kInternals] = {
|
|
68999
|
+
length: options.length,
|
|
69022
69000
|
timeWindow: options.timeWindow,
|
|
69001
|
+
ticksRate: options.ticksRate,
|
|
69023
69002
|
chunkSize: options.chunkSize,
|
|
69024
69003
|
maxRate: options.maxRate,
|
|
69025
69004
|
minChunkSize: options.minChunkSize,
|
|
@@ -69031,6 +69010,8 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
69031
69010
|
onReadCallback: null
|
|
69032
69011
|
};
|
|
69033
69012
|
|
|
69013
|
+
const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
|
|
69014
|
+
|
|
69034
69015
|
this.on('newListener', event => {
|
|
69035
69016
|
if (event === 'progress') {
|
|
69036
69017
|
if (!internals.isCaptured) {
|
|
@@ -69038,6 +69019,38 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
69038
69019
|
}
|
|
69039
69020
|
}
|
|
69040
69021
|
});
|
|
69022
|
+
|
|
69023
|
+
let bytesNotified = 0;
|
|
69024
|
+
|
|
69025
|
+
internals.updateProgress = throttle(function throttledHandler() {
|
|
69026
|
+
const totalBytes = internals.length;
|
|
69027
|
+
const bytesTransferred = internals.bytesSeen;
|
|
69028
|
+
const progressBytes = bytesTransferred - bytesNotified;
|
|
69029
|
+
if (!progressBytes || self.destroyed) return;
|
|
69030
|
+
|
|
69031
|
+
const rate = _speedometer(progressBytes);
|
|
69032
|
+
|
|
69033
|
+
bytesNotified = bytesTransferred;
|
|
69034
|
+
|
|
69035
|
+
process.nextTick(() => {
|
|
69036
|
+
self.emit('progress', {
|
|
69037
|
+
'loaded': bytesTransferred,
|
|
69038
|
+
'total': totalBytes,
|
|
69039
|
+
'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
|
|
69040
|
+
'bytes': progressBytes,
|
|
69041
|
+
'rate': rate ? rate : undefined,
|
|
69042
|
+
'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
|
|
69043
|
+
(totalBytes - bytesTransferred) / rate : undefined
|
|
69044
|
+
});
|
|
69045
|
+
});
|
|
69046
|
+
}, internals.ticksRate);
|
|
69047
|
+
|
|
69048
|
+
const onFinish = () => {
|
|
69049
|
+
internals.updateProgress(true);
|
|
69050
|
+
};
|
|
69051
|
+
|
|
69052
|
+
this.once('end', onFinish);
|
|
69053
|
+
this.once('error', onFinish);
|
|
69041
69054
|
}
|
|
69042
69055
|
|
|
69043
69056
|
_read(size) {
|
|
@@ -69051,6 +69064,7 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
69051
69064
|
}
|
|
69052
69065
|
|
|
69053
69066
|
_transform(chunk, encoding, callback) {
|
|
69067
|
+
const self = this;
|
|
69054
69068
|
const internals = this[kInternals];
|
|
69055
69069
|
const maxRate = internals.maxRate;
|
|
69056
69070
|
|
|
@@ -69062,14 +69076,16 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
69062
69076
|
const bytesThreshold = (maxRate / divider);
|
|
69063
69077
|
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
|
69064
69078
|
|
|
69065
|
-
|
|
69079
|
+
function pushChunk(_chunk, _callback) {
|
|
69066
69080
|
const bytes = Buffer.byteLength(_chunk);
|
|
69067
69081
|
internals.bytesSeen += bytes;
|
|
69068
69082
|
internals.bytes += bytes;
|
|
69069
69083
|
|
|
69070
|
-
|
|
69084
|
+
if (internals.isCaptured) {
|
|
69085
|
+
internals.updateProgress();
|
|
69086
|
+
}
|
|
69071
69087
|
|
|
69072
|
-
if (
|
|
69088
|
+
if (self.push(_chunk)) {
|
|
69073
69089
|
process.nextTick(_callback);
|
|
69074
69090
|
} else {
|
|
69075
69091
|
internals.onReadCallback = () => {
|
|
@@ -69077,7 +69093,7 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
69077
69093
|
process.nextTick(_callback);
|
|
69078
69094
|
};
|
|
69079
69095
|
}
|
|
69080
|
-
}
|
|
69096
|
+
}
|
|
69081
69097
|
|
|
69082
69098
|
const transformChunk = (_chunk, _callback) => {
|
|
69083
69099
|
const chunkSize = Buffer.byteLength(_chunk);
|
|
@@ -69134,6 +69150,11 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
69134
69150
|
}
|
|
69135
69151
|
});
|
|
69136
69152
|
}
|
|
69153
|
+
|
|
69154
|
+
setLength(length) {
|
|
69155
|
+
this[kInternals].length = +length;
|
|
69156
|
+
return this;
|
|
69157
|
+
}
|
|
69137
69158
|
}
|
|
69138
69159
|
|
|
69139
69160
|
const {asyncIterator} = Symbol;
|
|
@@ -69150,9 +69171,9 @@ const readBlob = async function* (blob) {
|
|
|
69150
69171
|
}
|
|
69151
69172
|
};
|
|
69152
69173
|
|
|
69153
|
-
const BOUNDARY_ALPHABET = utils
|
|
69174
|
+
const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
|
|
69154
69175
|
|
|
69155
|
-
const textEncoder = new TextEncoder
|
|
69176
|
+
const textEncoder = new TextEncoder();
|
|
69156
69177
|
|
|
69157
69178
|
const CRLF = '\r\n';
|
|
69158
69179
|
const CRLF_BYTES = textEncoder.encode(CRLF);
|
|
@@ -69161,7 +69182,7 @@ const CRLF_BYTES_COUNT = 2;
|
|
|
69161
69182
|
class FormDataPart {
|
|
69162
69183
|
constructor(name, value) {
|
|
69163
69184
|
const {escapeName} = this.constructor;
|
|
69164
|
-
const isStringValue = utils
|
|
69185
|
+
const isStringValue = utils.isString(value);
|
|
69165
69186
|
|
|
69166
69187
|
let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
|
|
69167
69188
|
!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
|
|
@@ -69188,7 +69209,7 @@ class FormDataPart {
|
|
|
69188
69209
|
|
|
69189
69210
|
const {value} = this;
|
|
69190
69211
|
|
|
69191
|
-
if(utils
|
|
69212
|
+
if(utils.isTypedArray(value)) {
|
|
69192
69213
|
yield value;
|
|
69193
69214
|
} else {
|
|
69194
69215
|
yield* readBlob(value);
|
|
@@ -69210,10 +69231,10 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
|
69210
69231
|
const {
|
|
69211
69232
|
tag = 'form-data-boundary',
|
|
69212
69233
|
size = 25,
|
|
69213
|
-
boundary = tag + '-' + utils
|
|
69234
|
+
boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
|
|
69214
69235
|
} = options || {};
|
|
69215
69236
|
|
|
69216
|
-
if(!utils
|
|
69237
|
+
if(!utils.isFormData(form)) {
|
|
69217
69238
|
throw TypeError('FormData instance required');
|
|
69218
69239
|
}
|
|
69219
69240
|
|
|
@@ -69233,7 +69254,7 @@ const formDataToStream = (form, headersHandler, options) => {
|
|
|
69233
69254
|
|
|
69234
69255
|
contentLength += boundaryBytes.byteLength * parts.length;
|
|
69235
69256
|
|
|
69236
|
-
contentLength = utils
|
|
69257
|
+
contentLength = utils.toFiniteNumber(contentLength);
|
|
69237
69258
|
|
|
69238
69259
|
const computedHeaders = {
|
|
69239
69260
|
'Content-Type': `multipart/form-data; boundary=${boundary}`
|
|
@@ -69279,7 +69300,7 @@ class ZlibHeaderTransformStream extends stream.Transform {
|
|
|
69279
69300
|
}
|
|
69280
69301
|
|
|
69281
69302
|
const callbackify = (fn, reducer) => {
|
|
69282
|
-
return utils
|
|
69303
|
+
return utils.isAsyncFn(fn) ? function (...args) {
|
|
69283
69304
|
const cb = args.pop();
|
|
69284
69305
|
fn.apply(this, args).then((value) => {
|
|
69285
69306
|
try {
|
|
@@ -69291,142 +69312,6 @@ const callbackify = (fn, reducer) => {
|
|
|
69291
69312
|
} : fn;
|
|
69292
69313
|
};
|
|
69293
69314
|
|
|
69294
|
-
/**
|
|
69295
|
-
* Calculate data maxRate
|
|
69296
|
-
* @param {Number} [samplesCount= 10]
|
|
69297
|
-
* @param {Number} [min= 1000]
|
|
69298
|
-
* @returns {Function}
|
|
69299
|
-
*/
|
|
69300
|
-
function speedometer(samplesCount, min) {
|
|
69301
|
-
samplesCount = samplesCount || 10;
|
|
69302
|
-
const bytes = new Array(samplesCount);
|
|
69303
|
-
const timestamps = new Array(samplesCount);
|
|
69304
|
-
let head = 0;
|
|
69305
|
-
let tail = 0;
|
|
69306
|
-
let firstSampleTS;
|
|
69307
|
-
|
|
69308
|
-
min = min !== undefined ? min : 1000;
|
|
69309
|
-
|
|
69310
|
-
return function push(chunkLength) {
|
|
69311
|
-
const now = Date.now();
|
|
69312
|
-
|
|
69313
|
-
const startedAt = timestamps[tail];
|
|
69314
|
-
|
|
69315
|
-
if (!firstSampleTS) {
|
|
69316
|
-
firstSampleTS = now;
|
|
69317
|
-
}
|
|
69318
|
-
|
|
69319
|
-
bytes[head] = chunkLength;
|
|
69320
|
-
timestamps[head] = now;
|
|
69321
|
-
|
|
69322
|
-
let i = tail;
|
|
69323
|
-
let bytesCount = 0;
|
|
69324
|
-
|
|
69325
|
-
while (i !== head) {
|
|
69326
|
-
bytesCount += bytes[i++];
|
|
69327
|
-
i = i % samplesCount;
|
|
69328
|
-
}
|
|
69329
|
-
|
|
69330
|
-
head = (head + 1) % samplesCount;
|
|
69331
|
-
|
|
69332
|
-
if (head === tail) {
|
|
69333
|
-
tail = (tail + 1) % samplesCount;
|
|
69334
|
-
}
|
|
69335
|
-
|
|
69336
|
-
if (now - firstSampleTS < min) {
|
|
69337
|
-
return;
|
|
69338
|
-
}
|
|
69339
|
-
|
|
69340
|
-
const passed = startedAt && now - startedAt;
|
|
69341
|
-
|
|
69342
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
69343
|
-
};
|
|
69344
|
-
}
|
|
69345
|
-
|
|
69346
|
-
/**
|
|
69347
|
-
* Throttle decorator
|
|
69348
|
-
* @param {Function} fn
|
|
69349
|
-
* @param {Number} freq
|
|
69350
|
-
* @return {Function}
|
|
69351
|
-
*/
|
|
69352
|
-
function throttle(fn, freq) {
|
|
69353
|
-
let timestamp = 0;
|
|
69354
|
-
let threshold = 1000 / freq;
|
|
69355
|
-
let lastArgs;
|
|
69356
|
-
let timer;
|
|
69357
|
-
|
|
69358
|
-
const invoke = (args, now = Date.now()) => {
|
|
69359
|
-
timestamp = now;
|
|
69360
|
-
lastArgs = null;
|
|
69361
|
-
if (timer) {
|
|
69362
|
-
clearTimeout(timer);
|
|
69363
|
-
timer = null;
|
|
69364
|
-
}
|
|
69365
|
-
fn.apply(null, args);
|
|
69366
|
-
};
|
|
69367
|
-
|
|
69368
|
-
const throttled = (...args) => {
|
|
69369
|
-
const now = Date.now();
|
|
69370
|
-
const passed = now - timestamp;
|
|
69371
|
-
if ( passed >= threshold) {
|
|
69372
|
-
invoke(args, now);
|
|
69373
|
-
} else {
|
|
69374
|
-
lastArgs = args;
|
|
69375
|
-
if (!timer) {
|
|
69376
|
-
timer = setTimeout(() => {
|
|
69377
|
-
timer = null;
|
|
69378
|
-
invoke(lastArgs);
|
|
69379
|
-
}, threshold - passed);
|
|
69380
|
-
}
|
|
69381
|
-
}
|
|
69382
|
-
};
|
|
69383
|
-
|
|
69384
|
-
const flush = () => lastArgs && invoke(lastArgs);
|
|
69385
|
-
|
|
69386
|
-
return [throttled, flush];
|
|
69387
|
-
}
|
|
69388
|
-
|
|
69389
|
-
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
69390
|
-
let bytesNotified = 0;
|
|
69391
|
-
const _speedometer = speedometer(50, 250);
|
|
69392
|
-
|
|
69393
|
-
return throttle(e => {
|
|
69394
|
-
const loaded = e.loaded;
|
|
69395
|
-
const total = e.lengthComputable ? e.total : undefined;
|
|
69396
|
-
const progressBytes = loaded - bytesNotified;
|
|
69397
|
-
const rate = _speedometer(progressBytes);
|
|
69398
|
-
const inRange = loaded <= total;
|
|
69399
|
-
|
|
69400
|
-
bytesNotified = loaded;
|
|
69401
|
-
|
|
69402
|
-
const data = {
|
|
69403
|
-
loaded,
|
|
69404
|
-
total,
|
|
69405
|
-
progress: total ? (loaded / total) : undefined,
|
|
69406
|
-
bytes: progressBytes,
|
|
69407
|
-
rate: rate ? rate : undefined,
|
|
69408
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
69409
|
-
event: e,
|
|
69410
|
-
lengthComputable: total != null,
|
|
69411
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
69412
|
-
};
|
|
69413
|
-
|
|
69414
|
-
listener(data);
|
|
69415
|
-
}, freq);
|
|
69416
|
-
};
|
|
69417
|
-
|
|
69418
|
-
const progressEventDecorator = (total, throttled) => {
|
|
69419
|
-
const lengthComputable = total != null;
|
|
69420
|
-
|
|
69421
|
-
return [(loaded) => throttled[0]({
|
|
69422
|
-
lengthComputable,
|
|
69423
|
-
total,
|
|
69424
|
-
loaded
|
|
69425
|
-
}), throttled[1]];
|
|
69426
|
-
};
|
|
69427
|
-
|
|
69428
|
-
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
69429
|
-
|
|
69430
69315
|
const zlibOptions = {
|
|
69431
69316
|
flush: zlib.constants.Z_SYNC_FLUSH,
|
|
69432
69317
|
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
|
@@ -69437,7 +69322,7 @@ const brotliOptions = {
|
|
|
69437
69322
|
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
|
69438
69323
|
};
|
|
69439
69324
|
|
|
69440
|
-
const isBrotliSupported = utils
|
|
69325
|
+
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
|
69441
69326
|
|
|
69442
69327
|
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
|
69443
69328
|
|
|
@@ -69447,14 +69332,6 @@ const supportedProtocols = platform.protocols.map(protocol => {
|
|
|
69447
69332
|
return protocol + ':';
|
|
69448
69333
|
});
|
|
69449
69334
|
|
|
69450
|
-
const flushOnFinish = (stream, [throttled, flush]) => {
|
|
69451
|
-
stream
|
|
69452
|
-
.on('end', flush)
|
|
69453
|
-
.on('error', flush);
|
|
69454
|
-
|
|
69455
|
-
return throttled;
|
|
69456
|
-
};
|
|
69457
|
-
|
|
69458
69335
|
/**
|
|
69459
69336
|
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
|
69460
69337
|
* object.
|
|
@@ -69463,12 +69340,12 @@ const flushOnFinish = (stream, [throttled, flush]) => {
|
|
|
69463
69340
|
*
|
|
69464
69341
|
* @returns {Object<string, any>}
|
|
69465
69342
|
*/
|
|
69466
|
-
function dispatchBeforeRedirect(options
|
|
69343
|
+
function dispatchBeforeRedirect(options) {
|
|
69467
69344
|
if (options.beforeRedirects.proxy) {
|
|
69468
69345
|
options.beforeRedirects.proxy(options);
|
|
69469
69346
|
}
|
|
69470
69347
|
if (options.beforeRedirects.config) {
|
|
69471
|
-
options.beforeRedirects.config(options
|
|
69348
|
+
options.beforeRedirects.config(options);
|
|
69472
69349
|
}
|
|
69473
69350
|
}
|
|
69474
69351
|
|
|
@@ -69525,7 +69402,7 @@ function setProxy(options, configProxy, location) {
|
|
|
69525
69402
|
};
|
|
69526
69403
|
}
|
|
69527
69404
|
|
|
69528
|
-
const isHttpAdapterSupported = typeof process !== 'undefined' && utils
|
|
69405
|
+
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
|
69529
69406
|
|
|
69530
69407
|
// temporary hotfix
|
|
69531
69408
|
|
|
@@ -69554,18 +69431,6 @@ const wrapAsync = (asyncExecutor) => {
|
|
|
69554
69431
|
})
|
|
69555
69432
|
};
|
|
69556
69433
|
|
|
69557
|
-
const resolveFamily = ({address, family}) => {
|
|
69558
|
-
if (!utils$1.isString(address)) {
|
|
69559
|
-
throw TypeError('address must be a string');
|
|
69560
|
-
}
|
|
69561
|
-
return ({
|
|
69562
|
-
address,
|
|
69563
|
-
family: family || (address.indexOf('.') < 0 ? 6 : 4)
|
|
69564
|
-
});
|
|
69565
|
-
};
|
|
69566
|
-
|
|
69567
|
-
const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
|
|
69568
|
-
|
|
69569
69434
|
/*eslint consistent-return:0*/
|
|
69570
69435
|
var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
69571
69436
|
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
|
@@ -69576,20 +69441,15 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69576
69441
|
let rejected = false;
|
|
69577
69442
|
let req;
|
|
69578
69443
|
|
|
69579
|
-
if (lookup) {
|
|
69580
|
-
|
|
69581
|
-
|
|
69582
|
-
|
|
69583
|
-
|
|
69584
|
-
|
|
69585
|
-
|
|
69586
|
-
|
|
69587
|
-
|
|
69588
|
-
const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
|
69589
|
-
|
|
69590
|
-
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
69591
|
-
});
|
|
69592
|
-
};
|
|
69444
|
+
if (lookup && utils.isAsyncFn(lookup)) {
|
|
69445
|
+
lookup = callbackify(lookup, (entry) => {
|
|
69446
|
+
if(utils.isString(entry)) {
|
|
69447
|
+
entry = [entry, entry.indexOf('.') < 0 ? 6 : 4];
|
|
69448
|
+
} else if (!utils.isArray(entry)) {
|
|
69449
|
+
throw new TypeError('lookup async function must return an array [ip: string, family: number]]')
|
|
69450
|
+
}
|
|
69451
|
+
return entry;
|
|
69452
|
+
});
|
|
69593
69453
|
}
|
|
69594
69454
|
|
|
69595
69455
|
// temporary internal emitter until the AxiosRequest class will be implemented
|
|
@@ -69630,7 +69490,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69630
69490
|
|
|
69631
69491
|
// Parse url
|
|
69632
69492
|
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
69633
|
-
const parsed = new URL(fullPath,
|
|
69493
|
+
const parsed = new URL(fullPath, 'http://localhost');
|
|
69634
69494
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
69635
69495
|
|
|
69636
69496
|
if (protocol === 'data:') {
|
|
@@ -69657,7 +69517,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69657
69517
|
convertedData = convertedData.toString(responseEncoding);
|
|
69658
69518
|
|
|
69659
69519
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
69660
|
-
convertedData = utils
|
|
69520
|
+
convertedData = utils.stripBOM(convertedData);
|
|
69661
69521
|
}
|
|
69662
69522
|
} else if (responseType === 'stream') {
|
|
69663
69523
|
convertedData = stream.Readable.from(convertedData);
|
|
@@ -69688,13 +69548,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69688
69548
|
// Only set header if it hasn't been set in config
|
|
69689
69549
|
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
69690
69550
|
|
|
69691
|
-
const
|
|
69551
|
+
const onDownloadProgress = config.onDownloadProgress;
|
|
69552
|
+
const onUploadProgress = config.onUploadProgress;
|
|
69692
69553
|
const maxRate = config.maxRate;
|
|
69693
69554
|
let maxUploadRate = undefined;
|
|
69694
69555
|
let maxDownloadRate = undefined;
|
|
69695
69556
|
|
|
69696
69557
|
// support for spec compliant FormData objects
|
|
69697
|
-
if (utils
|
|
69558
|
+
if (utils.isSpecCompliantForm(data)) {
|
|
69698
69559
|
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
|
69699
69560
|
|
|
69700
69561
|
data = formDataToStream(data, (formHeaders) => {
|
|
@@ -69704,7 +69565,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69704
69565
|
boundary: userBoundary && userBoundary[1] || undefined
|
|
69705
69566
|
});
|
|
69706
69567
|
// support for https://www.npmjs.com/package/form-data api
|
|
69707
|
-
} else if (utils
|
|
69568
|
+
} else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
|
69708
69569
|
headers.set(data.getHeaders());
|
|
69709
69570
|
|
|
69710
69571
|
if (!headers.hasContentLength()) {
|
|
@@ -69715,14 +69576,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69715
69576
|
} catch (e) {
|
|
69716
69577
|
}
|
|
69717
69578
|
}
|
|
69718
|
-
} else if (utils
|
|
69579
|
+
} else if (utils.isBlob(data)) {
|
|
69719
69580
|
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
|
69720
69581
|
headers.setContentLength(data.size || 0);
|
|
69721
69582
|
data = stream.Readable.from(readBlob(data));
|
|
69722
|
-
} else if (data && !utils
|
|
69723
|
-
if (Buffer.isBuffer(data)) ; else if (utils
|
|
69583
|
+
} else if (data && !utils.isStream(data)) {
|
|
69584
|
+
if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
|
|
69724
69585
|
data = Buffer.from(new Uint8Array(data));
|
|
69725
|
-
} else if (utils
|
|
69586
|
+
} else if (utils.isString(data)) {
|
|
69726
69587
|
data = Buffer.from(data, 'utf-8');
|
|
69727
69588
|
} else {
|
|
69728
69589
|
return reject(new AxiosError(
|
|
@@ -69744,9 +69605,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69744
69605
|
}
|
|
69745
69606
|
}
|
|
69746
69607
|
|
|
69747
|
-
const contentLength = utils
|
|
69608
|
+
const contentLength = utils.toFiniteNumber(headers.getContentLength());
|
|
69748
69609
|
|
|
69749
|
-
if (utils
|
|
69610
|
+
if (utils.isArray(maxRate)) {
|
|
69750
69611
|
maxUploadRate = maxRate[0];
|
|
69751
69612
|
maxDownloadRate = maxRate[1];
|
|
69752
69613
|
} else {
|
|
@@ -69754,21 +69615,20 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69754
69615
|
}
|
|
69755
69616
|
|
|
69756
69617
|
if (data && (onUploadProgress || maxUploadRate)) {
|
|
69757
|
-
if (!utils
|
|
69618
|
+
if (!utils.isStream(data)) {
|
|
69758
69619
|
data = stream.Readable.from(data, {objectMode: false});
|
|
69759
69620
|
}
|
|
69760
69621
|
|
|
69761
69622
|
data = stream.pipeline([data, new AxiosTransformStream({
|
|
69762
|
-
|
|
69763
|
-
|
|
69764
|
-
|
|
69765
|
-
|
|
69766
|
-
|
|
69767
|
-
|
|
69768
|
-
|
|
69769
|
-
|
|
69770
|
-
|
|
69771
|
-
));
|
|
69623
|
+
length: contentLength,
|
|
69624
|
+
maxRate: utils.toFiniteNumber(maxUploadRate)
|
|
69625
|
+
})], utils.noop);
|
|
69626
|
+
|
|
69627
|
+
onUploadProgress && data.on('progress', progress => {
|
|
69628
|
+
onUploadProgress(Object.assign(progress, {
|
|
69629
|
+
upload: true
|
|
69630
|
+
}));
|
|
69631
|
+
});
|
|
69772
69632
|
}
|
|
69773
69633
|
|
|
69774
69634
|
// HTTP basic authentication
|
|
@@ -69821,12 +69681,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69821
69681
|
};
|
|
69822
69682
|
|
|
69823
69683
|
// cacheable-lookup integration hotfix
|
|
69824
|
-
!utils
|
|
69684
|
+
!utils.isUndefined(lookup) && (options.lookup = lookup);
|
|
69825
69685
|
|
|
69826
69686
|
if (config.socketPath) {
|
|
69827
69687
|
options.socketPath = config.socketPath;
|
|
69828
69688
|
} else {
|
|
69829
|
-
options.hostname = parsed.hostname
|
|
69689
|
+
options.hostname = parsed.hostname;
|
|
69830
69690
|
options.port = parsed.port;
|
|
69831
69691
|
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
|
69832
69692
|
}
|
|
@@ -69867,18 +69727,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69867
69727
|
|
|
69868
69728
|
const responseLength = +res.headers['content-length'];
|
|
69869
69729
|
|
|
69870
|
-
if (onDownloadProgress
|
|
69730
|
+
if (onDownloadProgress) {
|
|
69871
69731
|
const transformStream = new AxiosTransformStream({
|
|
69872
|
-
|
|
69732
|
+
length: utils.toFiniteNumber(responseLength),
|
|
69733
|
+
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
|
69873
69734
|
});
|
|
69874
69735
|
|
|
69875
|
-
onDownloadProgress && transformStream.on('progress',
|
|
69876
|
-
|
|
69877
|
-
|
|
69878
|
-
|
|
69879
|
-
|
|
69880
|
-
)
|
|
69881
|
-
));
|
|
69736
|
+
onDownloadProgress && transformStream.on('progress', progress => {
|
|
69737
|
+
onDownloadProgress(Object.assign(progress, {
|
|
69738
|
+
download: true
|
|
69739
|
+
}));
|
|
69740
|
+
});
|
|
69882
69741
|
|
|
69883
69742
|
streams.push(transformStream);
|
|
69884
69743
|
}
|
|
@@ -69926,7 +69785,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69926
69785
|
}
|
|
69927
69786
|
}
|
|
69928
69787
|
|
|
69929
|
-
responseStream = streams.length > 1 ? stream.pipeline(streams, utils
|
|
69788
|
+
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
|
69930
69789
|
|
|
69931
69790
|
const offListeners = stream.finished(responseStream, () => {
|
|
69932
69791
|
offListeners();
|
|
@@ -69988,12 +69847,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
69988
69847
|
if (responseType !== 'arraybuffer') {
|
|
69989
69848
|
responseData = responseData.toString(responseEncoding);
|
|
69990
69849
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
69991
|
-
responseData = utils
|
|
69850
|
+
responseData = utils.stripBOM(responseData);
|
|
69992
69851
|
}
|
|
69993
69852
|
}
|
|
69994
69853
|
response.data = responseData;
|
|
69995
69854
|
} catch (err) {
|
|
69996
|
-
|
|
69855
|
+
reject(AxiosError.from(err, null, config, response.request, response));
|
|
69997
69856
|
}
|
|
69998
69857
|
settle(resolve, reject, response);
|
|
69999
69858
|
});
|
|
@@ -70065,7 +69924,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
70065
69924
|
|
|
70066
69925
|
|
|
70067
69926
|
// Send the request
|
|
70068
|
-
if (utils
|
|
69927
|
+
if (utils.isStream(data)) {
|
|
70069
69928
|
let ended = false;
|
|
70070
69929
|
let errored = false;
|
|
70071
69930
|
|
|
@@ -70091,17 +69950,65 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
70091
69950
|
});
|
|
70092
69951
|
};
|
|
70093
69952
|
|
|
70094
|
-
var
|
|
69953
|
+
var cookies = platform.isStandardBrowserEnv ?
|
|
69954
|
+
|
|
69955
|
+
// Standard browser envs support document.cookie
|
|
69956
|
+
(function standardBrowserEnv() {
|
|
69957
|
+
return {
|
|
69958
|
+
write: function write(name, value, expires, path, domain, secure) {
|
|
69959
|
+
const cookie = [];
|
|
69960
|
+
cookie.push(name + '=' + encodeURIComponent(value));
|
|
69961
|
+
|
|
69962
|
+
if (utils.isNumber(expires)) {
|
|
69963
|
+
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
69964
|
+
}
|
|
69965
|
+
|
|
69966
|
+
if (utils.isString(path)) {
|
|
69967
|
+
cookie.push('path=' + path);
|
|
69968
|
+
}
|
|
69969
|
+
|
|
69970
|
+
if (utils.isString(domain)) {
|
|
69971
|
+
cookie.push('domain=' + domain);
|
|
69972
|
+
}
|
|
69973
|
+
|
|
69974
|
+
if (secure === true) {
|
|
69975
|
+
cookie.push('secure');
|
|
69976
|
+
}
|
|
69977
|
+
|
|
69978
|
+
document.cookie = cookie.join('; ');
|
|
69979
|
+
},
|
|
69980
|
+
|
|
69981
|
+
read: function read(name) {
|
|
69982
|
+
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
69983
|
+
return (match ? decodeURIComponent(match[3]) : null);
|
|
69984
|
+
},
|
|
69985
|
+
|
|
69986
|
+
remove: function remove(name) {
|
|
69987
|
+
this.write(name, '', Date.now() - 86400000);
|
|
69988
|
+
}
|
|
69989
|
+
};
|
|
69990
|
+
})() :
|
|
69991
|
+
|
|
69992
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
|
69993
|
+
(function nonStandardBrowserEnv() {
|
|
69994
|
+
return {
|
|
69995
|
+
write: function write() {},
|
|
69996
|
+
read: function read() { return null; },
|
|
69997
|
+
remove: function remove() {}
|
|
69998
|
+
};
|
|
69999
|
+
})();
|
|
70000
|
+
|
|
70001
|
+
var isURLSameOrigin = platform.isStandardBrowserEnv ?
|
|
70095
70002
|
|
|
70096
70003
|
// Standard browser envs have full support of the APIs needed to test
|
|
70097
70004
|
// whether the request URL is of the same origin as current location.
|
|
70098
70005
|
(function standardBrowserEnv() {
|
|
70099
|
-
const msie =
|
|
70006
|
+
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
70100
70007
|
const urlParsingNode = document.createElement('a');
|
|
70101
70008
|
let originURL;
|
|
70102
70009
|
|
|
70103
70010
|
/**
|
|
70104
|
-
* Parse a URL to discover
|
|
70011
|
+
* Parse a URL to discover it's components
|
|
70105
70012
|
*
|
|
70106
70013
|
* @param {String} url The URL to be parsed
|
|
70107
70014
|
* @returns {Object}
|
|
@@ -70141,7 +70048,7 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
|
70141
70048
|
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
70142
70049
|
*/
|
|
70143
70050
|
return function isURLSameOrigin(requestURL) {
|
|
70144
|
-
const parsed = (utils
|
|
70051
|
+
const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
70145
70052
|
return (parsed.protocol === originURL.protocol &&
|
|
70146
70053
|
parsed.host === originURL.host);
|
|
70147
70054
|
};
|
|
@@ -70154,222 +70061,81 @@ var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
|
70154
70061
|
};
|
|
70155
70062
|
})();
|
|
70156
70063
|
|
|
70157
|
-
|
|
70158
|
-
|
|
70159
|
-
|
|
70160
|
-
{
|
|
70161
|
-
write(name, value, expires, path, domain, secure) {
|
|
70162
|
-
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
70163
|
-
|
|
70164
|
-
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
70165
|
-
|
|
70166
|
-
utils$1.isString(path) && cookie.push('path=' + path);
|
|
70167
|
-
|
|
70168
|
-
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
70169
|
-
|
|
70170
|
-
secure === true && cookie.push('secure');
|
|
70171
|
-
|
|
70172
|
-
document.cookie = cookie.join('; ');
|
|
70173
|
-
},
|
|
70174
|
-
|
|
70175
|
-
read(name) {
|
|
70176
|
-
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
70177
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
70178
|
-
},
|
|
70179
|
-
|
|
70180
|
-
remove(name) {
|
|
70181
|
-
this.write(name, '', Date.now() - 86400000);
|
|
70182
|
-
}
|
|
70183
|
-
}
|
|
70184
|
-
|
|
70185
|
-
:
|
|
70186
|
-
|
|
70187
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
70188
|
-
{
|
|
70189
|
-
write() {},
|
|
70190
|
-
read() {
|
|
70191
|
-
return null;
|
|
70192
|
-
},
|
|
70193
|
-
remove() {}
|
|
70194
|
-
};
|
|
70195
|
-
|
|
70196
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
70197
|
-
|
|
70198
|
-
/**
|
|
70199
|
-
* Config-specific merge-function which creates a new config-object
|
|
70200
|
-
* by merging two configuration objects together.
|
|
70201
|
-
*
|
|
70202
|
-
* @param {Object} config1
|
|
70203
|
-
* @param {Object} config2
|
|
70204
|
-
*
|
|
70205
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
70206
|
-
*/
|
|
70207
|
-
function mergeConfig(config1, config2) {
|
|
70208
|
-
// eslint-disable-next-line no-param-reassign
|
|
70209
|
-
config2 = config2 || {};
|
|
70210
|
-
const config = {};
|
|
70211
|
-
|
|
70212
|
-
function getMergedValue(target, source, caseless) {
|
|
70213
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
70214
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
70215
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
70216
|
-
return utils$1.merge({}, source);
|
|
70217
|
-
} else if (utils$1.isArray(source)) {
|
|
70218
|
-
return source.slice();
|
|
70219
|
-
}
|
|
70220
|
-
return source;
|
|
70221
|
-
}
|
|
70064
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
70065
|
+
let bytesNotified = 0;
|
|
70066
|
+
const _speedometer = speedometer(50, 250);
|
|
70222
70067
|
|
|
70223
|
-
|
|
70224
|
-
|
|
70225
|
-
|
|
70226
|
-
|
|
70227
|
-
|
|
70228
|
-
|
|
70229
|
-
}
|
|
70230
|
-
}
|
|
70068
|
+
return e => {
|
|
70069
|
+
const loaded = e.loaded;
|
|
70070
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
70071
|
+
const progressBytes = loaded - bytesNotified;
|
|
70072
|
+
const rate = _speedometer(progressBytes);
|
|
70073
|
+
const inRange = loaded <= total;
|
|
70231
70074
|
|
|
70232
|
-
|
|
70233
|
-
function valueFromConfig2(a, b) {
|
|
70234
|
-
if (!utils$1.isUndefined(b)) {
|
|
70235
|
-
return getMergedValue(undefined, b);
|
|
70236
|
-
}
|
|
70237
|
-
}
|
|
70075
|
+
bytesNotified = loaded;
|
|
70238
70076
|
|
|
70239
|
-
|
|
70240
|
-
|
|
70241
|
-
|
|
70242
|
-
|
|
70243
|
-
|
|
70244
|
-
|
|
70245
|
-
|
|
70246
|
-
|
|
70077
|
+
const data = {
|
|
70078
|
+
loaded,
|
|
70079
|
+
total,
|
|
70080
|
+
progress: total ? (loaded / total) : undefined,
|
|
70081
|
+
bytes: progressBytes,
|
|
70082
|
+
rate: rate ? rate : undefined,
|
|
70083
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
70084
|
+
event: e
|
|
70085
|
+
};
|
|
70247
70086
|
|
|
70248
|
-
|
|
70249
|
-
function mergeDirectKeys(a, b, prop) {
|
|
70250
|
-
if (prop in config2) {
|
|
70251
|
-
return getMergedValue(a, b);
|
|
70252
|
-
} else if (prop in config1) {
|
|
70253
|
-
return getMergedValue(undefined, a);
|
|
70254
|
-
}
|
|
70255
|
-
}
|
|
70087
|
+
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
70256
70088
|
|
|
70257
|
-
|
|
70258
|
-
url: valueFromConfig2,
|
|
70259
|
-
method: valueFromConfig2,
|
|
70260
|
-
data: valueFromConfig2,
|
|
70261
|
-
baseURL: defaultToConfig2,
|
|
70262
|
-
transformRequest: defaultToConfig2,
|
|
70263
|
-
transformResponse: defaultToConfig2,
|
|
70264
|
-
paramsSerializer: defaultToConfig2,
|
|
70265
|
-
timeout: defaultToConfig2,
|
|
70266
|
-
timeoutMessage: defaultToConfig2,
|
|
70267
|
-
withCredentials: defaultToConfig2,
|
|
70268
|
-
withXSRFToken: defaultToConfig2,
|
|
70269
|
-
adapter: defaultToConfig2,
|
|
70270
|
-
responseType: defaultToConfig2,
|
|
70271
|
-
xsrfCookieName: defaultToConfig2,
|
|
70272
|
-
xsrfHeaderName: defaultToConfig2,
|
|
70273
|
-
onUploadProgress: defaultToConfig2,
|
|
70274
|
-
onDownloadProgress: defaultToConfig2,
|
|
70275
|
-
decompress: defaultToConfig2,
|
|
70276
|
-
maxContentLength: defaultToConfig2,
|
|
70277
|
-
maxBodyLength: defaultToConfig2,
|
|
70278
|
-
beforeRedirect: defaultToConfig2,
|
|
70279
|
-
transport: defaultToConfig2,
|
|
70280
|
-
httpAgent: defaultToConfig2,
|
|
70281
|
-
httpsAgent: defaultToConfig2,
|
|
70282
|
-
cancelToken: defaultToConfig2,
|
|
70283
|
-
socketPath: defaultToConfig2,
|
|
70284
|
-
responseEncoding: defaultToConfig2,
|
|
70285
|
-
validateStatus: mergeDirectKeys,
|
|
70286
|
-
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
70089
|
+
listener(data);
|
|
70287
70090
|
};
|
|
70288
|
-
|
|
70289
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
70290
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
70291
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
70292
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
70293
|
-
});
|
|
70294
|
-
|
|
70295
|
-
return config;
|
|
70296
70091
|
}
|
|
70297
70092
|
|
|
70298
|
-
var resolveConfig = (config) => {
|
|
70299
|
-
const newConfig = mergeConfig({}, config);
|
|
70300
|
-
|
|
70301
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
70302
|
-
|
|
70303
|
-
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
70304
|
-
|
|
70305
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
70306
|
-
|
|
70307
|
-
// HTTP basic authentication
|
|
70308
|
-
if (auth) {
|
|
70309
|
-
headers.set('Authorization', 'Basic ' +
|
|
70310
|
-
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
|
70311
|
-
);
|
|
70312
|
-
}
|
|
70313
|
-
|
|
70314
|
-
let contentType;
|
|
70315
|
-
|
|
70316
|
-
if (utils$1.isFormData(data)) {
|
|
70317
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
70318
|
-
headers.setContentType(undefined); // Let the browser set it
|
|
70319
|
-
} else if ((contentType = headers.getContentType()) !== false) {
|
|
70320
|
-
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
70321
|
-
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
70322
|
-
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
70323
|
-
}
|
|
70324
|
-
}
|
|
70325
|
-
|
|
70326
|
-
// Add xsrf header
|
|
70327
|
-
// This is only done if running in a standard browser environment.
|
|
70328
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
70329
|
-
|
|
70330
|
-
if (platform.hasStandardBrowserEnv) {
|
|
70331
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
70332
|
-
|
|
70333
|
-
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
70334
|
-
// Add xsrf header
|
|
70335
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
70336
|
-
|
|
70337
|
-
if (xsrfValue) {
|
|
70338
|
-
headers.set(xsrfHeaderName, xsrfValue);
|
|
70339
|
-
}
|
|
70340
|
-
}
|
|
70341
|
-
}
|
|
70342
|
-
|
|
70343
|
-
return newConfig;
|
|
70344
|
-
};
|
|
70345
|
-
|
|
70346
70093
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
70347
70094
|
|
|
70348
70095
|
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
70349
70096
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
70350
|
-
|
|
70351
|
-
|
|
70352
|
-
const
|
|
70353
|
-
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
|
70097
|
+
let requestData = config.data;
|
|
70098
|
+
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
|
70099
|
+
const responseType = config.responseType;
|
|
70354
70100
|
let onCanceled;
|
|
70355
|
-
let uploadThrottled, downloadThrottled;
|
|
70356
|
-
let flushUpload, flushDownload;
|
|
70357
|
-
|
|
70358
70101
|
function done() {
|
|
70359
|
-
|
|
70360
|
-
|
|
70102
|
+
if (config.cancelToken) {
|
|
70103
|
+
config.cancelToken.unsubscribe(onCanceled);
|
|
70104
|
+
}
|
|
70361
70105
|
|
|
70362
|
-
|
|
70106
|
+
if (config.signal) {
|
|
70107
|
+
config.signal.removeEventListener('abort', onCanceled);
|
|
70108
|
+
}
|
|
70109
|
+
}
|
|
70110
|
+
|
|
70111
|
+
let contentType;
|
|
70363
70112
|
|
|
70364
|
-
|
|
70113
|
+
if (utils.isFormData(requestData)) {
|
|
70114
|
+
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
|
70115
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
|
70116
|
+
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
|
|
70117
|
+
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
|
70118
|
+
} else if(utils.isString(contentType = requestHeaders.getContentType())){
|
|
70119
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
70120
|
+
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
|
|
70121
|
+
}
|
|
70365
70122
|
}
|
|
70366
70123
|
|
|
70367
70124
|
let request = new XMLHttpRequest();
|
|
70368
70125
|
|
|
70369
|
-
|
|
70126
|
+
// HTTP basic authentication
|
|
70127
|
+
if (config.auth) {
|
|
70128
|
+
const username = config.auth.username || '';
|
|
70129
|
+
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
70130
|
+
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
70131
|
+
}
|
|
70132
|
+
|
|
70133
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
70134
|
+
|
|
70135
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
70370
70136
|
|
|
70371
70137
|
// Set the request timeout in MS
|
|
70372
|
-
request.timeout =
|
|
70138
|
+
request.timeout = config.timeout;
|
|
70373
70139
|
|
|
70374
70140
|
function onloadend() {
|
|
70375
70141
|
if (!request) {
|
|
@@ -70449,10 +70215,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
70449
70215
|
|
|
70450
70216
|
// Handle timeout
|
|
70451
70217
|
request.ontimeout = function handleTimeout() {
|
|
70452
|
-
let timeoutErrorMessage =
|
|
70453
|
-
const transitional =
|
|
70454
|
-
if (
|
|
70455
|
-
timeoutErrorMessage =
|
|
70218
|
+
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
70219
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
70220
|
+
if (config.timeoutErrorMessage) {
|
|
70221
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
70456
70222
|
}
|
|
70457
70223
|
reject(new AxiosError(
|
|
70458
70224
|
timeoutErrorMessage,
|
|
@@ -70464,42 +70230,50 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
70464
70230
|
request = null;
|
|
70465
70231
|
};
|
|
70466
70232
|
|
|
70233
|
+
// Add xsrf header
|
|
70234
|
+
// This is only done if running in a standard browser environment.
|
|
70235
|
+
// Specifically not if we're in a web worker, or react-native.
|
|
70236
|
+
if (platform.isStandardBrowserEnv) {
|
|
70237
|
+
// Add xsrf header
|
|
70238
|
+
const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
|
|
70239
|
+
&& config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
70240
|
+
|
|
70241
|
+
if (xsrfValue) {
|
|
70242
|
+
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
70243
|
+
}
|
|
70244
|
+
}
|
|
70245
|
+
|
|
70467
70246
|
// Remove Content-Type if data is undefined
|
|
70468
70247
|
requestData === undefined && requestHeaders.setContentType(null);
|
|
70469
70248
|
|
|
70470
70249
|
// Add headers to the request
|
|
70471
70250
|
if ('setRequestHeader' in request) {
|
|
70472
|
-
utils
|
|
70251
|
+
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
70473
70252
|
request.setRequestHeader(key, val);
|
|
70474
70253
|
});
|
|
70475
70254
|
}
|
|
70476
70255
|
|
|
70477
70256
|
// Add withCredentials to request if needed
|
|
70478
|
-
if (!utils
|
|
70479
|
-
request.withCredentials = !!
|
|
70257
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
|
70258
|
+
request.withCredentials = !!config.withCredentials;
|
|
70480
70259
|
}
|
|
70481
70260
|
|
|
70482
70261
|
// Add responseType to request if needed
|
|
70483
70262
|
if (responseType && responseType !== 'json') {
|
|
70484
|
-
request.responseType =
|
|
70263
|
+
request.responseType = config.responseType;
|
|
70485
70264
|
}
|
|
70486
70265
|
|
|
70487
70266
|
// Handle progress if needed
|
|
70488
|
-
if (onDownloadProgress) {
|
|
70489
|
-
(
|
|
70490
|
-
request.addEventListener('progress', downloadThrottled);
|
|
70267
|
+
if (typeof config.onDownloadProgress === 'function') {
|
|
70268
|
+
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
|
70491
70269
|
}
|
|
70492
70270
|
|
|
70493
70271
|
// Not all browsers support upload events
|
|
70494
|
-
if (onUploadProgress && request.upload) {
|
|
70495
|
-
(
|
|
70496
|
-
|
|
70497
|
-
request.upload.addEventListener('progress', uploadThrottled);
|
|
70498
|
-
|
|
70499
|
-
request.upload.addEventListener('loadend', flushUpload);
|
|
70272
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
70273
|
+
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
|
70500
70274
|
}
|
|
70501
70275
|
|
|
70502
|
-
if (
|
|
70276
|
+
if (config.cancelToken || config.signal) {
|
|
70503
70277
|
// Handle cancellation
|
|
70504
70278
|
// eslint-disable-next-line func-names
|
|
70505
70279
|
onCanceled = cancel => {
|
|
@@ -70511,13 +70285,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
70511
70285
|
request = null;
|
|
70512
70286
|
};
|
|
70513
70287
|
|
|
70514
|
-
|
|
70515
|
-
if (
|
|
70516
|
-
|
|
70288
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
70289
|
+
if (config.signal) {
|
|
70290
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
70517
70291
|
}
|
|
70518
70292
|
}
|
|
70519
70293
|
|
|
70520
|
-
const protocol = parseProtocol(
|
|
70294
|
+
const protocol = parseProtocol(fullPath);
|
|
70521
70295
|
|
|
70522
70296
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
70523
70297
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
@@ -70530,361 +70304,12 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
70530
70304
|
});
|
|
70531
70305
|
};
|
|
70532
70306
|
|
|
70533
|
-
const composeSignals = (signals, timeout) => {
|
|
70534
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
70535
|
-
|
|
70536
|
-
if (timeout || length) {
|
|
70537
|
-
let controller = new AbortController();
|
|
70538
|
-
|
|
70539
|
-
let aborted;
|
|
70540
|
-
|
|
70541
|
-
const onabort = function (reason) {
|
|
70542
|
-
if (!aborted) {
|
|
70543
|
-
aborted = true;
|
|
70544
|
-
unsubscribe();
|
|
70545
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
70546
|
-
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
70547
|
-
}
|
|
70548
|
-
};
|
|
70549
|
-
|
|
70550
|
-
let timer = timeout && setTimeout(() => {
|
|
70551
|
-
timer = null;
|
|
70552
|
-
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
|
|
70553
|
-
}, timeout);
|
|
70554
|
-
|
|
70555
|
-
const unsubscribe = () => {
|
|
70556
|
-
if (signals) {
|
|
70557
|
-
timer && clearTimeout(timer);
|
|
70558
|
-
timer = null;
|
|
70559
|
-
signals.forEach(signal => {
|
|
70560
|
-
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
|
|
70561
|
-
});
|
|
70562
|
-
signals = null;
|
|
70563
|
-
}
|
|
70564
|
-
};
|
|
70565
|
-
|
|
70566
|
-
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
70567
|
-
|
|
70568
|
-
const {signal} = controller;
|
|
70569
|
-
|
|
70570
|
-
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
70571
|
-
|
|
70572
|
-
return signal;
|
|
70573
|
-
}
|
|
70574
|
-
};
|
|
70575
|
-
|
|
70576
|
-
const streamChunk = function* (chunk, chunkSize) {
|
|
70577
|
-
let len = chunk.byteLength;
|
|
70578
|
-
|
|
70579
|
-
if (!chunkSize || len < chunkSize) {
|
|
70580
|
-
yield chunk;
|
|
70581
|
-
return;
|
|
70582
|
-
}
|
|
70583
|
-
|
|
70584
|
-
let pos = 0;
|
|
70585
|
-
let end;
|
|
70586
|
-
|
|
70587
|
-
while (pos < len) {
|
|
70588
|
-
end = pos + chunkSize;
|
|
70589
|
-
yield chunk.slice(pos, end);
|
|
70590
|
-
pos = end;
|
|
70591
|
-
}
|
|
70592
|
-
};
|
|
70593
|
-
|
|
70594
|
-
const readBytes = async function* (iterable, chunkSize) {
|
|
70595
|
-
for await (const chunk of readStream(iterable)) {
|
|
70596
|
-
yield* streamChunk(chunk, chunkSize);
|
|
70597
|
-
}
|
|
70598
|
-
};
|
|
70599
|
-
|
|
70600
|
-
const readStream = async function* (stream) {
|
|
70601
|
-
if (stream[Symbol.asyncIterator]) {
|
|
70602
|
-
yield* stream;
|
|
70603
|
-
return;
|
|
70604
|
-
}
|
|
70605
|
-
|
|
70606
|
-
const reader = stream.getReader();
|
|
70607
|
-
try {
|
|
70608
|
-
for (;;) {
|
|
70609
|
-
const {done, value} = await reader.read();
|
|
70610
|
-
if (done) {
|
|
70611
|
-
break;
|
|
70612
|
-
}
|
|
70613
|
-
yield value;
|
|
70614
|
-
}
|
|
70615
|
-
} finally {
|
|
70616
|
-
await reader.cancel();
|
|
70617
|
-
}
|
|
70618
|
-
};
|
|
70619
|
-
|
|
70620
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
70621
|
-
const iterator = readBytes(stream, chunkSize);
|
|
70622
|
-
|
|
70623
|
-
let bytes = 0;
|
|
70624
|
-
let done;
|
|
70625
|
-
let _onFinish = (e) => {
|
|
70626
|
-
if (!done) {
|
|
70627
|
-
done = true;
|
|
70628
|
-
onFinish && onFinish(e);
|
|
70629
|
-
}
|
|
70630
|
-
};
|
|
70631
|
-
|
|
70632
|
-
return new ReadableStream({
|
|
70633
|
-
async pull(controller) {
|
|
70634
|
-
try {
|
|
70635
|
-
const {done, value} = await iterator.next();
|
|
70636
|
-
|
|
70637
|
-
if (done) {
|
|
70638
|
-
_onFinish();
|
|
70639
|
-
controller.close();
|
|
70640
|
-
return;
|
|
70641
|
-
}
|
|
70642
|
-
|
|
70643
|
-
let len = value.byteLength;
|
|
70644
|
-
if (onProgress) {
|
|
70645
|
-
let loadedBytes = bytes += len;
|
|
70646
|
-
onProgress(loadedBytes);
|
|
70647
|
-
}
|
|
70648
|
-
controller.enqueue(new Uint8Array(value));
|
|
70649
|
-
} catch (err) {
|
|
70650
|
-
_onFinish(err);
|
|
70651
|
-
throw err;
|
|
70652
|
-
}
|
|
70653
|
-
},
|
|
70654
|
-
cancel(reason) {
|
|
70655
|
-
_onFinish(reason);
|
|
70656
|
-
return iterator.return();
|
|
70657
|
-
}
|
|
70658
|
-
}, {
|
|
70659
|
-
highWaterMark: 2
|
|
70660
|
-
})
|
|
70661
|
-
};
|
|
70662
|
-
|
|
70663
|
-
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
70664
|
-
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
70665
|
-
|
|
70666
|
-
// used only inside the fetch adapter
|
|
70667
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
70668
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
70669
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
70670
|
-
);
|
|
70671
|
-
|
|
70672
|
-
const test = (fn, ...args) => {
|
|
70673
|
-
try {
|
|
70674
|
-
return !!fn(...args);
|
|
70675
|
-
} catch (e) {
|
|
70676
|
-
return false
|
|
70677
|
-
}
|
|
70678
|
-
};
|
|
70679
|
-
|
|
70680
|
-
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
70681
|
-
let duplexAccessed = false;
|
|
70682
|
-
|
|
70683
|
-
const hasContentType = new Request(platform.origin, {
|
|
70684
|
-
body: new ReadableStream(),
|
|
70685
|
-
method: 'POST',
|
|
70686
|
-
get duplex() {
|
|
70687
|
-
duplexAccessed = true;
|
|
70688
|
-
return 'half';
|
|
70689
|
-
},
|
|
70690
|
-
}).headers.has('Content-Type');
|
|
70691
|
-
|
|
70692
|
-
return duplexAccessed && !hasContentType;
|
|
70693
|
-
});
|
|
70694
|
-
|
|
70695
|
-
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
70696
|
-
|
|
70697
|
-
const supportsResponseStream = isReadableStreamSupported &&
|
|
70698
|
-
test(() => utils$1.isReadableStream(new Response('').body));
|
|
70699
|
-
|
|
70700
|
-
|
|
70701
|
-
const resolvers = {
|
|
70702
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
70703
|
-
};
|
|
70704
|
-
|
|
70705
|
-
isFetchSupported && (((res) => {
|
|
70706
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
70707
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
70708
|
-
(_, config) => {
|
|
70709
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
70710
|
-
});
|
|
70711
|
-
});
|
|
70712
|
-
})(new Response));
|
|
70713
|
-
|
|
70714
|
-
const getBodyLength = async (body) => {
|
|
70715
|
-
if (body == null) {
|
|
70716
|
-
return 0;
|
|
70717
|
-
}
|
|
70718
|
-
|
|
70719
|
-
if(utils$1.isBlob(body)) {
|
|
70720
|
-
return body.size;
|
|
70721
|
-
}
|
|
70722
|
-
|
|
70723
|
-
if(utils$1.isSpecCompliantForm(body)) {
|
|
70724
|
-
const _request = new Request(platform.origin, {
|
|
70725
|
-
method: 'POST',
|
|
70726
|
-
body,
|
|
70727
|
-
});
|
|
70728
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
70729
|
-
}
|
|
70730
|
-
|
|
70731
|
-
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
70732
|
-
return body.byteLength;
|
|
70733
|
-
}
|
|
70734
|
-
|
|
70735
|
-
if(utils$1.isURLSearchParams(body)) {
|
|
70736
|
-
body = body + '';
|
|
70737
|
-
}
|
|
70738
|
-
|
|
70739
|
-
if(utils$1.isString(body)) {
|
|
70740
|
-
return (await encodeText(body)).byteLength;
|
|
70741
|
-
}
|
|
70742
|
-
};
|
|
70743
|
-
|
|
70744
|
-
const resolveBodyLength = async (headers, body) => {
|
|
70745
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
70746
|
-
|
|
70747
|
-
return length == null ? getBodyLength(body) : length;
|
|
70748
|
-
};
|
|
70749
|
-
|
|
70750
|
-
var fetchAdapter = isFetchSupported && (async (config) => {
|
|
70751
|
-
let {
|
|
70752
|
-
url,
|
|
70753
|
-
method,
|
|
70754
|
-
data,
|
|
70755
|
-
signal,
|
|
70756
|
-
cancelToken,
|
|
70757
|
-
timeout,
|
|
70758
|
-
onDownloadProgress,
|
|
70759
|
-
onUploadProgress,
|
|
70760
|
-
responseType,
|
|
70761
|
-
headers,
|
|
70762
|
-
withCredentials = 'same-origin',
|
|
70763
|
-
fetchOptions
|
|
70764
|
-
} = resolveConfig(config);
|
|
70765
|
-
|
|
70766
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
70767
|
-
|
|
70768
|
-
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
70769
|
-
|
|
70770
|
-
let request;
|
|
70771
|
-
|
|
70772
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
70773
|
-
composedSignal.unsubscribe();
|
|
70774
|
-
});
|
|
70775
|
-
|
|
70776
|
-
let requestContentLength;
|
|
70777
|
-
|
|
70778
|
-
try {
|
|
70779
|
-
if (
|
|
70780
|
-
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
70781
|
-
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
70782
|
-
) {
|
|
70783
|
-
let _request = new Request(url, {
|
|
70784
|
-
method: 'POST',
|
|
70785
|
-
body: data,
|
|
70786
|
-
duplex: "half"
|
|
70787
|
-
});
|
|
70788
|
-
|
|
70789
|
-
let contentTypeHeader;
|
|
70790
|
-
|
|
70791
|
-
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
70792
|
-
headers.setContentType(contentTypeHeader);
|
|
70793
|
-
}
|
|
70794
|
-
|
|
70795
|
-
if (_request.body) {
|
|
70796
|
-
const [onProgress, flush] = progressEventDecorator(
|
|
70797
|
-
requestContentLength,
|
|
70798
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
70799
|
-
);
|
|
70800
|
-
|
|
70801
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
70802
|
-
}
|
|
70803
|
-
}
|
|
70804
|
-
|
|
70805
|
-
if (!utils$1.isString(withCredentials)) {
|
|
70806
|
-
withCredentials = withCredentials ? 'include' : 'omit';
|
|
70807
|
-
}
|
|
70808
|
-
|
|
70809
|
-
// Cloudflare Workers throws when credentials are defined
|
|
70810
|
-
// see https://github.com/cloudflare/workerd/issues/902
|
|
70811
|
-
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
70812
|
-
request = new Request(url, {
|
|
70813
|
-
...fetchOptions,
|
|
70814
|
-
signal: composedSignal,
|
|
70815
|
-
method: method.toUpperCase(),
|
|
70816
|
-
headers: headers.normalize().toJSON(),
|
|
70817
|
-
body: data,
|
|
70818
|
-
duplex: "half",
|
|
70819
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
70820
|
-
});
|
|
70821
|
-
|
|
70822
|
-
let response = await fetch(request);
|
|
70823
|
-
|
|
70824
|
-
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
70825
|
-
|
|
70826
|
-
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
70827
|
-
const options = {};
|
|
70828
|
-
|
|
70829
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
70830
|
-
options[prop] = response[prop];
|
|
70831
|
-
});
|
|
70832
|
-
|
|
70833
|
-
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
70834
|
-
|
|
70835
|
-
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
70836
|
-
responseContentLength,
|
|
70837
|
-
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
70838
|
-
) || [];
|
|
70839
|
-
|
|
70840
|
-
response = new Response(
|
|
70841
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
70842
|
-
flush && flush();
|
|
70843
|
-
unsubscribe && unsubscribe();
|
|
70844
|
-
}),
|
|
70845
|
-
options
|
|
70846
|
-
);
|
|
70847
|
-
}
|
|
70848
|
-
|
|
70849
|
-
responseType = responseType || 'text';
|
|
70850
|
-
|
|
70851
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
70852
|
-
|
|
70853
|
-
!isStreamResponse && unsubscribe && unsubscribe();
|
|
70854
|
-
|
|
70855
|
-
return await new Promise((resolve, reject) => {
|
|
70856
|
-
settle(resolve, reject, {
|
|
70857
|
-
data: responseData,
|
|
70858
|
-
headers: AxiosHeaders.from(response.headers),
|
|
70859
|
-
status: response.status,
|
|
70860
|
-
statusText: response.statusText,
|
|
70861
|
-
config,
|
|
70862
|
-
request
|
|
70863
|
-
});
|
|
70864
|
-
})
|
|
70865
|
-
} catch (err) {
|
|
70866
|
-
unsubscribe && unsubscribe();
|
|
70867
|
-
|
|
70868
|
-
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
70869
|
-
throw Object.assign(
|
|
70870
|
-
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
70871
|
-
{
|
|
70872
|
-
cause: err.cause || err
|
|
70873
|
-
}
|
|
70874
|
-
)
|
|
70875
|
-
}
|
|
70876
|
-
|
|
70877
|
-
throw AxiosError.from(err, err && err.code, config, request);
|
|
70878
|
-
}
|
|
70879
|
-
});
|
|
70880
|
-
|
|
70881
70307
|
const knownAdapters = {
|
|
70882
70308
|
http: httpAdapter,
|
|
70883
|
-
xhr: xhrAdapter
|
|
70884
|
-
fetch: fetchAdapter
|
|
70309
|
+
xhr: xhrAdapter
|
|
70885
70310
|
};
|
|
70886
70311
|
|
|
70887
|
-
utils
|
|
70312
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
70888
70313
|
if (fn) {
|
|
70889
70314
|
try {
|
|
70890
70315
|
Object.defineProperty(fn, 'name', {value});
|
|
@@ -70897,11 +70322,11 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
70897
70322
|
|
|
70898
70323
|
const renderReason = (reason) => `- ${reason}`;
|
|
70899
70324
|
|
|
70900
|
-
const isResolvedHandle = (adapter) => utils
|
|
70325
|
+
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
|
70901
70326
|
|
|
70902
70327
|
var adapters = {
|
|
70903
70328
|
getAdapter: (adapters) => {
|
|
70904
|
-
adapters = utils
|
|
70329
|
+
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
70905
70330
|
|
|
70906
70331
|
const {length} = adapters;
|
|
70907
70332
|
let nameOrAdapter;
|
|
@@ -71025,6 +70450,107 @@ function dispatchRequest(config) {
|
|
|
71025
70450
|
});
|
|
71026
70451
|
}
|
|
71027
70452
|
|
|
70453
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
|
70454
|
+
|
|
70455
|
+
/**
|
|
70456
|
+
* Config-specific merge-function which creates a new config-object
|
|
70457
|
+
* by merging two configuration objects together.
|
|
70458
|
+
*
|
|
70459
|
+
* @param {Object} config1
|
|
70460
|
+
* @param {Object} config2
|
|
70461
|
+
*
|
|
70462
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
70463
|
+
*/
|
|
70464
|
+
function mergeConfig(config1, config2) {
|
|
70465
|
+
// eslint-disable-next-line no-param-reassign
|
|
70466
|
+
config2 = config2 || {};
|
|
70467
|
+
const config = {};
|
|
70468
|
+
|
|
70469
|
+
function getMergedValue(target, source, caseless) {
|
|
70470
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
70471
|
+
return utils.merge.call({caseless}, target, source);
|
|
70472
|
+
} else if (utils.isPlainObject(source)) {
|
|
70473
|
+
return utils.merge({}, source);
|
|
70474
|
+
} else if (utils.isArray(source)) {
|
|
70475
|
+
return source.slice();
|
|
70476
|
+
}
|
|
70477
|
+
return source;
|
|
70478
|
+
}
|
|
70479
|
+
|
|
70480
|
+
// eslint-disable-next-line consistent-return
|
|
70481
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
70482
|
+
if (!utils.isUndefined(b)) {
|
|
70483
|
+
return getMergedValue(a, b, caseless);
|
|
70484
|
+
} else if (!utils.isUndefined(a)) {
|
|
70485
|
+
return getMergedValue(undefined, a, caseless);
|
|
70486
|
+
}
|
|
70487
|
+
}
|
|
70488
|
+
|
|
70489
|
+
// eslint-disable-next-line consistent-return
|
|
70490
|
+
function valueFromConfig2(a, b) {
|
|
70491
|
+
if (!utils.isUndefined(b)) {
|
|
70492
|
+
return getMergedValue(undefined, b);
|
|
70493
|
+
}
|
|
70494
|
+
}
|
|
70495
|
+
|
|
70496
|
+
// eslint-disable-next-line consistent-return
|
|
70497
|
+
function defaultToConfig2(a, b) {
|
|
70498
|
+
if (!utils.isUndefined(b)) {
|
|
70499
|
+
return getMergedValue(undefined, b);
|
|
70500
|
+
} else if (!utils.isUndefined(a)) {
|
|
70501
|
+
return getMergedValue(undefined, a);
|
|
70502
|
+
}
|
|
70503
|
+
}
|
|
70504
|
+
|
|
70505
|
+
// eslint-disable-next-line consistent-return
|
|
70506
|
+
function mergeDirectKeys(a, b, prop) {
|
|
70507
|
+
if (prop in config2) {
|
|
70508
|
+
return getMergedValue(a, b);
|
|
70509
|
+
} else if (prop in config1) {
|
|
70510
|
+
return getMergedValue(undefined, a);
|
|
70511
|
+
}
|
|
70512
|
+
}
|
|
70513
|
+
|
|
70514
|
+
const mergeMap = {
|
|
70515
|
+
url: valueFromConfig2,
|
|
70516
|
+
method: valueFromConfig2,
|
|
70517
|
+
data: valueFromConfig2,
|
|
70518
|
+
baseURL: defaultToConfig2,
|
|
70519
|
+
transformRequest: defaultToConfig2,
|
|
70520
|
+
transformResponse: defaultToConfig2,
|
|
70521
|
+
paramsSerializer: defaultToConfig2,
|
|
70522
|
+
timeout: defaultToConfig2,
|
|
70523
|
+
timeoutMessage: defaultToConfig2,
|
|
70524
|
+
withCredentials: defaultToConfig2,
|
|
70525
|
+
adapter: defaultToConfig2,
|
|
70526
|
+
responseType: defaultToConfig2,
|
|
70527
|
+
xsrfCookieName: defaultToConfig2,
|
|
70528
|
+
xsrfHeaderName: defaultToConfig2,
|
|
70529
|
+
onUploadProgress: defaultToConfig2,
|
|
70530
|
+
onDownloadProgress: defaultToConfig2,
|
|
70531
|
+
decompress: defaultToConfig2,
|
|
70532
|
+
maxContentLength: defaultToConfig2,
|
|
70533
|
+
maxBodyLength: defaultToConfig2,
|
|
70534
|
+
beforeRedirect: defaultToConfig2,
|
|
70535
|
+
transport: defaultToConfig2,
|
|
70536
|
+
httpAgent: defaultToConfig2,
|
|
70537
|
+
httpsAgent: defaultToConfig2,
|
|
70538
|
+
cancelToken: defaultToConfig2,
|
|
70539
|
+
socketPath: defaultToConfig2,
|
|
70540
|
+
responseEncoding: defaultToConfig2,
|
|
70541
|
+
validateStatus: mergeDirectKeys,
|
|
70542
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
70543
|
+
};
|
|
70544
|
+
|
|
70545
|
+
utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
70546
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
70547
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
70548
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
70549
|
+
});
|
|
70550
|
+
|
|
70551
|
+
return config;
|
|
70552
|
+
}
|
|
70553
|
+
|
|
71028
70554
|
const validators$1 = {};
|
|
71029
70555
|
|
|
71030
70556
|
// eslint-disable-next-line func-names
|
|
@@ -71138,34 +70664,7 @@ class Axios {
|
|
|
71138
70664
|
*
|
|
71139
70665
|
* @returns {Promise} The Promise to be fulfilled
|
|
71140
70666
|
*/
|
|
71141
|
-
|
|
71142
|
-
try {
|
|
71143
|
-
return await this._request(configOrUrl, config);
|
|
71144
|
-
} catch (err) {
|
|
71145
|
-
if (err instanceof Error) {
|
|
71146
|
-
let dummy;
|
|
71147
|
-
|
|
71148
|
-
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());
|
|
71149
|
-
|
|
71150
|
-
// slice off the Error: ... line
|
|
71151
|
-
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
71152
|
-
try {
|
|
71153
|
-
if (!err.stack) {
|
|
71154
|
-
err.stack = stack;
|
|
71155
|
-
// match without the 2 top stack lines
|
|
71156
|
-
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
71157
|
-
err.stack += '\n' + stack;
|
|
71158
|
-
}
|
|
71159
|
-
} catch (e) {
|
|
71160
|
-
// ignore the case where "stack" is an un-writable property
|
|
71161
|
-
}
|
|
71162
|
-
}
|
|
71163
|
-
|
|
71164
|
-
throw err;
|
|
71165
|
-
}
|
|
71166
|
-
}
|
|
71167
|
-
|
|
71168
|
-
_request(configOrUrl, config) {
|
|
70667
|
+
request(configOrUrl, config) {
|
|
71169
70668
|
/*eslint no-param-reassign:0*/
|
|
71170
70669
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
71171
70670
|
if (typeof configOrUrl === 'string') {
|
|
@@ -71188,7 +70687,7 @@ class Axios {
|
|
|
71188
70687
|
}
|
|
71189
70688
|
|
|
71190
70689
|
if (paramsSerializer != null) {
|
|
71191
|
-
if (utils
|
|
70690
|
+
if (utils.isFunction(paramsSerializer)) {
|
|
71192
70691
|
config.paramsSerializer = {
|
|
71193
70692
|
serialize: paramsSerializer
|
|
71194
70693
|
};
|
|
@@ -71204,12 +70703,12 @@ class Axios {
|
|
|
71204
70703
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
71205
70704
|
|
|
71206
70705
|
// Flatten headers
|
|
71207
|
-
let contextHeaders = headers && utils
|
|
70706
|
+
let contextHeaders = headers && utils.merge(
|
|
71208
70707
|
headers.common,
|
|
71209
70708
|
headers[config.method]
|
|
71210
70709
|
);
|
|
71211
70710
|
|
|
71212
|
-
headers && utils
|
|
70711
|
+
headers && utils.forEach(
|
|
71213
70712
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
71214
70713
|
(method) => {
|
|
71215
70714
|
delete headers[method];
|
|
@@ -71296,7 +70795,7 @@ class Axios {
|
|
|
71296
70795
|
}
|
|
71297
70796
|
|
|
71298
70797
|
// Provide aliases for supported request methods
|
|
71299
|
-
utils
|
|
70798
|
+
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
71300
70799
|
/*eslint func-names:0*/
|
|
71301
70800
|
Axios.prototype[method] = function(url, config) {
|
|
71302
70801
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -71307,7 +70806,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
71307
70806
|
};
|
|
71308
70807
|
});
|
|
71309
70808
|
|
|
71310
|
-
utils
|
|
70809
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
71311
70810
|
/*eslint func-names:0*/
|
|
71312
70811
|
|
|
71313
70812
|
function generateHTTPMethod(isForm) {
|
|
@@ -71428,20 +70927,6 @@ class CancelToken {
|
|
|
71428
70927
|
}
|
|
71429
70928
|
}
|
|
71430
70929
|
|
|
71431
|
-
toAbortSignal() {
|
|
71432
|
-
const controller = new AbortController();
|
|
71433
|
-
|
|
71434
|
-
const abort = (err) => {
|
|
71435
|
-
controller.abort(err);
|
|
71436
|
-
};
|
|
71437
|
-
|
|
71438
|
-
this.subscribe(abort);
|
|
71439
|
-
|
|
71440
|
-
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
71441
|
-
|
|
71442
|
-
return controller.signal;
|
|
71443
|
-
}
|
|
71444
|
-
|
|
71445
70930
|
/**
|
|
71446
70931
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
71447
70932
|
* cancels the `CancelToken`.
|
|
@@ -71493,7 +70978,7 @@ function spread(callback) {
|
|
|
71493
70978
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
71494
70979
|
*/
|
|
71495
70980
|
function isAxiosError(payload) {
|
|
71496
|
-
return utils
|
|
70981
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
71497
70982
|
}
|
|
71498
70983
|
|
|
71499
70984
|
const HttpStatusCode = {
|
|
@@ -71578,10 +71063,10 @@ function createInstance(defaultConfig) {
|
|
|
71578
71063
|
const instance = bind(Axios.prototype.request, context);
|
|
71579
71064
|
|
|
71580
71065
|
// Copy axios.prototype to instance
|
|
71581
|
-
utils
|
|
71066
|
+
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
|
71582
71067
|
|
|
71583
71068
|
// Copy context to instance
|
|
71584
|
-
utils
|
|
71069
|
+
utils.extend(instance, context, null, {allOwnKeys: true});
|
|
71585
71070
|
|
|
71586
71071
|
// Factory for creating new instances
|
|
71587
71072
|
instance.create = function create(instanceConfig) {
|
|
@@ -71625,7 +71110,7 @@ axios.mergeConfig = mergeConfig;
|
|
|
71625
71110
|
|
|
71626
71111
|
axios.AxiosHeaders = AxiosHeaders;
|
|
71627
71112
|
|
|
71628
|
-
axios.formToJSON = thing => formDataToJSON(utils
|
|
71113
|
+
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
71629
71114
|
|
|
71630
71115
|
axios.getAdapter = adapters.getAdapter;
|
|
71631
71116
|
|