@xchainjs/xchain-aggregator 2.3.0 → 2.3.2
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/lib/index.esm.js +1078 -766
- package/lib/index.js +1078 -766
- package/package.json +17 -17
package/lib/index.js
CHANGED
|
@@ -352,7 +352,7 @@ const { isArray } = Array;
|
|
|
352
352
|
*
|
|
353
353
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
354
354
|
*/
|
|
355
|
-
const isUndefined = typeOfTest(
|
|
355
|
+
const isUndefined = typeOfTest('undefined');
|
|
356
356
|
|
|
357
357
|
/**
|
|
358
358
|
* Determine if a value is a Buffer
|
|
@@ -379,7 +379,7 @@ function isBuffer(val) {
|
|
|
379
379
|
*
|
|
380
380
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
381
381
|
*/
|
|
382
|
-
const isArrayBuffer = kindOfTest(
|
|
382
|
+
const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
383
383
|
|
|
384
384
|
/**
|
|
385
385
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -390,7 +390,7 @@ const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
|
390
390
|
*/
|
|
391
391
|
function isArrayBufferView(val) {
|
|
392
392
|
let result;
|
|
393
|
-
if (typeof ArrayBuffer !==
|
|
393
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
394
394
|
result = ArrayBuffer.isView(val);
|
|
395
395
|
} else {
|
|
396
396
|
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
@@ -405,7 +405,7 @@ function isArrayBufferView(val) {
|
|
|
405
405
|
*
|
|
406
406
|
* @returns {boolean} True if value is a String, otherwise false
|
|
407
407
|
*/
|
|
408
|
-
const isString = typeOfTest(
|
|
408
|
+
const isString = typeOfTest('string');
|
|
409
409
|
|
|
410
410
|
/**
|
|
411
411
|
* Determine if a value is a Function
|
|
@@ -413,7 +413,7 @@ const isString = typeOfTest("string");
|
|
|
413
413
|
* @param {*} val The value to test
|
|
414
414
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
415
415
|
*/
|
|
416
|
-
const isFunction$1 = typeOfTest(
|
|
416
|
+
const isFunction$1 = typeOfTest('function');
|
|
417
417
|
|
|
418
418
|
/**
|
|
419
419
|
* Determine if a value is a Number
|
|
@@ -422,7 +422,7 @@ const isFunction$1 = typeOfTest("function");
|
|
|
422
422
|
*
|
|
423
423
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
424
424
|
*/
|
|
425
|
-
const isNumber = typeOfTest(
|
|
425
|
+
const isNumber = typeOfTest('number');
|
|
426
426
|
|
|
427
427
|
/**
|
|
428
428
|
* Determine if a value is an Object
|
|
@@ -431,7 +431,7 @@ const isNumber = typeOfTest("number");
|
|
|
431
431
|
*
|
|
432
432
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
433
433
|
*/
|
|
434
|
-
const isObject = (thing) => thing !== null && typeof thing ===
|
|
434
|
+
const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
435
435
|
|
|
436
436
|
/**
|
|
437
437
|
* Determine if a value is a Boolean
|
|
@@ -449,7 +449,7 @@ const isBoolean = (thing) => thing === true || thing === false;
|
|
|
449
449
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
450
450
|
*/
|
|
451
451
|
const isPlainObject = (val) => {
|
|
452
|
-
if (kindOf(val) !==
|
|
452
|
+
if (kindOf(val) !== 'object') {
|
|
453
453
|
return false;
|
|
454
454
|
}
|
|
455
455
|
|
|
@@ -477,10 +477,7 @@ const isEmptyObject = (val) => {
|
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
try {
|
|
480
|
-
return (
|
|
481
|
-
Object.keys(val).length === 0 &&
|
|
482
|
-
Object.getPrototypeOf(val) === Object.prototype
|
|
483
|
-
);
|
|
480
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
484
481
|
} catch (e) {
|
|
485
482
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
486
483
|
return false;
|
|
@@ -494,7 +491,7 @@ const isEmptyObject = (val) => {
|
|
|
494
491
|
*
|
|
495
492
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
496
493
|
*/
|
|
497
|
-
const isDate = kindOfTest(
|
|
494
|
+
const isDate = kindOfTest('Date');
|
|
498
495
|
|
|
499
496
|
/**
|
|
500
497
|
* Determine if a value is a File
|
|
@@ -503,7 +500,32 @@ const isDate = kindOfTest("Date");
|
|
|
503
500
|
*
|
|
504
501
|
* @returns {boolean} True if value is a File, otherwise false
|
|
505
502
|
*/
|
|
506
|
-
const isFile = kindOfTest(
|
|
503
|
+
const isFile = kindOfTest('File');
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Determine if a value is a React Native Blob
|
|
507
|
+
* React Native "blob": an object with a `uri` attribute. Optionally, it can
|
|
508
|
+
* also have a `name` and `type` attribute to specify filename and content type
|
|
509
|
+
*
|
|
510
|
+
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
511
|
+
*
|
|
512
|
+
* @param {*} value The value to test
|
|
513
|
+
*
|
|
514
|
+
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
515
|
+
*/
|
|
516
|
+
const isReactNativeBlob = (value) => {
|
|
517
|
+
return !!(value && typeof value.uri !== 'undefined');
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Determine if environment is React Native
|
|
522
|
+
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
523
|
+
*
|
|
524
|
+
* @param {*} formData The formData to test
|
|
525
|
+
*
|
|
526
|
+
* @returns {boolean} True if environment is React Native, otherwise false
|
|
527
|
+
*/
|
|
528
|
+
const isReactNative = (formData) => formData && typeof formData.getParts !== 'undefined';
|
|
507
529
|
|
|
508
530
|
/**
|
|
509
531
|
* Determine if a value is a Blob
|
|
@@ -512,7 +534,7 @@ const isFile = kindOfTest("File");
|
|
|
512
534
|
*
|
|
513
535
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
514
536
|
*/
|
|
515
|
-
const isBlob = kindOfTest(
|
|
537
|
+
const isBlob = kindOfTest('Blob');
|
|
516
538
|
|
|
517
539
|
/**
|
|
518
540
|
* Determine if a value is a FileList
|
|
@@ -521,7 +543,7 @@ const isBlob = kindOfTest("Blob");
|
|
|
521
543
|
*
|
|
522
544
|
* @returns {boolean} True if value is a File, otherwise false
|
|
523
545
|
*/
|
|
524
|
-
const isFileList = kindOfTest(
|
|
546
|
+
const isFileList = kindOfTest('FileList');
|
|
525
547
|
|
|
526
548
|
/**
|
|
527
549
|
* Determine if a value is a Stream
|
|
@@ -539,17 +561,27 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
|
539
561
|
*
|
|
540
562
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
541
563
|
*/
|
|
564
|
+
function getGlobal() {
|
|
565
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
566
|
+
if (typeof self !== 'undefined') return self;
|
|
567
|
+
if (typeof window !== 'undefined') return window;
|
|
568
|
+
if (typeof global !== 'undefined') return global;
|
|
569
|
+
return {};
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const G = getGlobal();
|
|
573
|
+
const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
|
|
574
|
+
|
|
542
575
|
const isFormData = (thing) => {
|
|
543
576
|
let kind;
|
|
544
|
-
return (
|
|
545
|
-
thing
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
thing.toString() === "[object FormData]"))))
|
|
577
|
+
return thing && (
|
|
578
|
+
(FormDataCtor && thing instanceof FormDataCtor) || (
|
|
579
|
+
isFunction$1(thing.append) && (
|
|
580
|
+
(kind = kindOf(thing)) === 'formdata' ||
|
|
581
|
+
// detect form-data instance
|
|
582
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
583
|
+
)
|
|
584
|
+
)
|
|
553
585
|
);
|
|
554
586
|
};
|
|
555
587
|
|
|
@@ -560,13 +592,13 @@ const isFormData = (thing) => {
|
|
|
560
592
|
*
|
|
561
593
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
562
594
|
*/
|
|
563
|
-
const isURLSearchParams = kindOfTest(
|
|
595
|
+
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
564
596
|
|
|
565
597
|
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
598
|
+
'ReadableStream',
|
|
599
|
+
'Request',
|
|
600
|
+
'Response',
|
|
601
|
+
'Headers',
|
|
570
602
|
].map(kindOfTest);
|
|
571
603
|
|
|
572
604
|
/**
|
|
@@ -576,9 +608,9 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
|
576
608
|
*
|
|
577
609
|
* @returns {String} The String freed of excess whitespace
|
|
578
610
|
*/
|
|
579
|
-
const trim = (str) =>
|
|
580
|
-
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
581
|
-
|
|
611
|
+
const trim = (str) => {
|
|
612
|
+
return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
613
|
+
};
|
|
582
614
|
/**
|
|
583
615
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
584
616
|
*
|
|
@@ -597,7 +629,7 @@ const trim = (str) =>
|
|
|
597
629
|
*/
|
|
598
630
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
599
631
|
// Don't bother if no value provided
|
|
600
|
-
if (obj === null || typeof obj ===
|
|
632
|
+
if (obj === null || typeof obj === 'undefined') {
|
|
601
633
|
return;
|
|
602
634
|
}
|
|
603
635
|
|
|
@@ -605,7 +637,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
605
637
|
let l;
|
|
606
638
|
|
|
607
639
|
// Force an array if not already something iterable
|
|
608
|
-
if (typeof obj !==
|
|
640
|
+
if (typeof obj !== 'object') {
|
|
609
641
|
/*eslint no-param-reassign:0*/
|
|
610
642
|
obj = [obj];
|
|
611
643
|
}
|
|
@@ -622,9 +654,7 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
622
654
|
}
|
|
623
655
|
|
|
624
656
|
// Iterate over object keys
|
|
625
|
-
const keys = allOwnKeys
|
|
626
|
-
? Object.getOwnPropertyNames(obj)
|
|
627
|
-
: Object.keys(obj);
|
|
657
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
628
658
|
const len = keys.length;
|
|
629
659
|
let key;
|
|
630
660
|
|
|
@@ -635,6 +665,14 @@ function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
|
635
665
|
}
|
|
636
666
|
}
|
|
637
667
|
|
|
668
|
+
/**
|
|
669
|
+
* Finds a key in an object, case-insensitive, returning the actual key name.
|
|
670
|
+
* Returns null if the object is a Buffer or if no match is found.
|
|
671
|
+
*
|
|
672
|
+
* @param {Object} obj - The object to search.
|
|
673
|
+
* @param {string} key - The key to find (case-insensitive).
|
|
674
|
+
* @returns {?string} The actual key name if found, otherwise null.
|
|
675
|
+
*/
|
|
638
676
|
function findKey(obj, key) {
|
|
639
677
|
if (isBuffer(obj)) {
|
|
640
678
|
return null;
|
|
@@ -655,16 +693,11 @@ function findKey(obj, key) {
|
|
|
655
693
|
|
|
656
694
|
const _global = (() => {
|
|
657
695
|
/*eslint no-undef:0*/
|
|
658
|
-
if (typeof globalThis !==
|
|
659
|
-
return typeof self !==
|
|
660
|
-
? self
|
|
661
|
-
: typeof window !== "undefined"
|
|
662
|
-
? window
|
|
663
|
-
: global;
|
|
696
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
697
|
+
return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
|
|
664
698
|
})();
|
|
665
699
|
|
|
666
|
-
const isContextDefined = (context) =>
|
|
667
|
-
!isUndefined(context) && context !== _global;
|
|
700
|
+
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
668
701
|
|
|
669
702
|
/**
|
|
670
703
|
* Accepts varargs expecting each argument to be an object, then
|
|
@@ -689,7 +722,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
689
722
|
const result = {};
|
|
690
723
|
const assignValue = (val, key) => {
|
|
691
724
|
// Skip dangerous property names to prevent prototype pollution
|
|
692
|
-
if (key ===
|
|
725
|
+
if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
|
|
693
726
|
return;
|
|
694
727
|
}
|
|
695
728
|
|
|
@@ -742,7 +775,7 @@ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
|
742
775
|
});
|
|
743
776
|
}
|
|
744
777
|
},
|
|
745
|
-
{ allOwnKeys }
|
|
778
|
+
{ allOwnKeys }
|
|
746
779
|
);
|
|
747
780
|
return a;
|
|
748
781
|
};
|
|
@@ -771,17 +804,14 @@ const stripBOM = (content) => {
|
|
|
771
804
|
* @returns {void}
|
|
772
805
|
*/
|
|
773
806
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
774
|
-
constructor.prototype = Object.create(
|
|
775
|
-
|
|
776
|
-
descriptors,
|
|
777
|
-
);
|
|
778
|
-
Object.defineProperty(constructor.prototype, "constructor", {
|
|
807
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
808
|
+
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
779
809
|
value: constructor,
|
|
780
810
|
writable: true,
|
|
781
811
|
enumerable: false,
|
|
782
812
|
configurable: true,
|
|
783
813
|
});
|
|
784
|
-
Object.defineProperty(constructor,
|
|
814
|
+
Object.defineProperty(constructor, 'super', {
|
|
785
815
|
value: superConstructor.prototype,
|
|
786
816
|
});
|
|
787
817
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -811,20 +841,13 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
|
811
841
|
i = props.length;
|
|
812
842
|
while (i-- > 0) {
|
|
813
843
|
prop = props[i];
|
|
814
|
-
if (
|
|
815
|
-
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
816
|
-
!merged[prop]
|
|
817
|
-
) {
|
|
844
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
818
845
|
destObj[prop] = sourceObj[prop];
|
|
819
846
|
merged[prop] = true;
|
|
820
847
|
}
|
|
821
848
|
}
|
|
822
849
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
823
|
-
} while (
|
|
824
|
-
sourceObj &&
|
|
825
|
-
(!filter || filter(sourceObj, destObj)) &&
|
|
826
|
-
sourceObj !== Object.prototype
|
|
827
|
-
);
|
|
850
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
828
851
|
|
|
829
852
|
return destObj;
|
|
830
853
|
};
|
|
@@ -881,7 +904,7 @@ const isTypedArray = ((TypedArray) => {
|
|
|
881
904
|
return (thing) => {
|
|
882
905
|
return TypedArray && thing instanceof TypedArray;
|
|
883
906
|
};
|
|
884
|
-
})(typeof Uint8Array !==
|
|
907
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
|
|
885
908
|
|
|
886
909
|
/**
|
|
887
910
|
* For each entry in the object, call the function with the key and value.
|
|
@@ -924,14 +947,12 @@ const matchAll = (regExp, str) => {
|
|
|
924
947
|
};
|
|
925
948
|
|
|
926
949
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
927
|
-
const isHTMLForm = kindOfTest(
|
|
950
|
+
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
928
951
|
|
|
929
952
|
const toCamelCase = (str) => {
|
|
930
|
-
return str
|
|
931
|
-
.
|
|
932
|
-
|
|
933
|
-
return p1.toUpperCase() + p2;
|
|
934
|
-
});
|
|
953
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
954
|
+
return p1.toUpperCase() + p2;
|
|
955
|
+
});
|
|
935
956
|
};
|
|
936
957
|
|
|
937
958
|
/* Creating a function that will check if an object has a property. */
|
|
@@ -948,7 +969,7 @@ const hasOwnProperty = (
|
|
|
948
969
|
*
|
|
949
970
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
950
971
|
*/
|
|
951
|
-
const isRegExp = kindOfTest(
|
|
972
|
+
const isRegExp = kindOfTest('RegExp');
|
|
952
973
|
|
|
953
974
|
const reduceDescriptors = (obj, reducer) => {
|
|
954
975
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
@@ -972,10 +993,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
972
993
|
const freezeMethods = (obj) => {
|
|
973
994
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
974
995
|
// skip restricted props in strict mode
|
|
975
|
-
if (
|
|
976
|
-
isFunction$1(obj) &&
|
|
977
|
-
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
978
|
-
) {
|
|
996
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
979
997
|
return false;
|
|
980
998
|
}
|
|
981
999
|
|
|
@@ -985,7 +1003,7 @@ const freezeMethods = (obj) => {
|
|
|
985
1003
|
|
|
986
1004
|
descriptor.enumerable = false;
|
|
987
1005
|
|
|
988
|
-
if (
|
|
1006
|
+
if ('writable' in descriptor) {
|
|
989
1007
|
descriptor.writable = false;
|
|
990
1008
|
return;
|
|
991
1009
|
}
|
|
@@ -998,6 +1016,14 @@ const freezeMethods = (obj) => {
|
|
|
998
1016
|
});
|
|
999
1017
|
};
|
|
1000
1018
|
|
|
1019
|
+
/**
|
|
1020
|
+
* Converts an array or a delimited string into an object set with values as keys and true as values.
|
|
1021
|
+
* Useful for fast membership checks.
|
|
1022
|
+
*
|
|
1023
|
+
* @param {Array|string} arrayOrString - The array or string to convert.
|
|
1024
|
+
* @param {string} delimiter - The delimiter to use if input is a string.
|
|
1025
|
+
* @returns {Object} An object with keys from the array or string, values set to true.
|
|
1026
|
+
*/
|
|
1001
1027
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
1002
1028
|
const obj = {};
|
|
1003
1029
|
|
|
@@ -1007,9 +1033,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
1007
1033
|
});
|
|
1008
1034
|
};
|
|
1009
1035
|
|
|
1010
|
-
isArray(arrayOrString)
|
|
1011
|
-
? define(arrayOrString)
|
|
1012
|
-
: define(String(arrayOrString).split(delimiter));
|
|
1036
|
+
isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
1013
1037
|
|
|
1014
1038
|
return obj;
|
|
1015
1039
|
};
|
|
@@ -1017,9 +1041,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
1017
1041
|
const noop = () => {};
|
|
1018
1042
|
|
|
1019
1043
|
const toFiniteNumber = (value, defaultValue) => {
|
|
1020
|
-
return value != null && Number.isFinite((value = +value))
|
|
1021
|
-
? value
|
|
1022
|
-
: defaultValue;
|
|
1044
|
+
return value != null && Number.isFinite((value = +value)) ? value : defaultValue;
|
|
1023
1045
|
};
|
|
1024
1046
|
|
|
1025
1047
|
/**
|
|
@@ -1033,11 +1055,17 @@ function isSpecCompliantForm(thing) {
|
|
|
1033
1055
|
return !!(
|
|
1034
1056
|
thing &&
|
|
1035
1057
|
isFunction$1(thing.append) &&
|
|
1036
|
-
thing[toStringTag] ===
|
|
1058
|
+
thing[toStringTag] === 'FormData' &&
|
|
1037
1059
|
thing[iterator]
|
|
1038
1060
|
);
|
|
1039
1061
|
}
|
|
1040
1062
|
|
|
1063
|
+
/**
|
|
1064
|
+
* Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
|
|
1065
|
+
*
|
|
1066
|
+
* @param {Object} obj - The object to convert.
|
|
1067
|
+
* @returns {Object} The JSON-compatible object.
|
|
1068
|
+
*/
|
|
1041
1069
|
const toJSONObject = (obj) => {
|
|
1042
1070
|
const stack = new Array(10);
|
|
1043
1071
|
|
|
@@ -1052,7 +1080,7 @@ const toJSONObject = (obj) => {
|
|
|
1052
1080
|
return source;
|
|
1053
1081
|
}
|
|
1054
1082
|
|
|
1055
|
-
if (!(
|
|
1083
|
+
if (!('toJSON' in source)) {
|
|
1056
1084
|
stack[i] = source;
|
|
1057
1085
|
const target = isArray(source) ? [] : {};
|
|
1058
1086
|
|
|
@@ -1073,8 +1101,20 @@ const toJSONObject = (obj) => {
|
|
|
1073
1101
|
return visit(obj, 0);
|
|
1074
1102
|
};
|
|
1075
1103
|
|
|
1076
|
-
|
|
1104
|
+
/**
|
|
1105
|
+
* Determines if a value is an async function.
|
|
1106
|
+
*
|
|
1107
|
+
* @param {*} thing - The value to test.
|
|
1108
|
+
* @returns {boolean} True if value is an async function, otherwise false.
|
|
1109
|
+
*/
|
|
1110
|
+
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
1077
1111
|
|
|
1112
|
+
/**
|
|
1113
|
+
* Determines if a value is thenable (has then and catch methods).
|
|
1114
|
+
*
|
|
1115
|
+
* @param {*} thing - The value to test.
|
|
1116
|
+
* @returns {boolean} True if value is thenable, otherwise false.
|
|
1117
|
+
*/
|
|
1078
1118
|
const isThenable = (thing) =>
|
|
1079
1119
|
thing &&
|
|
1080
1120
|
(isObject(thing) || isFunction$1(thing)) &&
|
|
@@ -1084,6 +1124,14 @@ const isThenable = (thing) =>
|
|
|
1084
1124
|
// original code
|
|
1085
1125
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
1086
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* Provides a cross-platform setImmediate implementation.
|
|
1129
|
+
* Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
|
|
1130
|
+
*
|
|
1131
|
+
* @param {boolean} setImmediateSupported - Whether setImmediate is supported.
|
|
1132
|
+
* @param {boolean} postMessageSupported - Whether postMessage is supported.
|
|
1133
|
+
* @returns {Function} A function to schedule a callback asynchronously.
|
|
1134
|
+
*/
|
|
1087
1135
|
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
1088
1136
|
if (setImmediateSupported) {
|
|
1089
1137
|
return setImmediate;
|
|
@@ -1092,27 +1140,33 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
1092
1140
|
return postMessageSupported
|
|
1093
1141
|
? ((token, callbacks) => {
|
|
1094
1142
|
_global.addEventListener(
|
|
1095
|
-
|
|
1143
|
+
'message',
|
|
1096
1144
|
({ source, data }) => {
|
|
1097
1145
|
if (source === _global && data === token) {
|
|
1098
1146
|
callbacks.length && callbacks.shift()();
|
|
1099
1147
|
}
|
|
1100
1148
|
},
|
|
1101
|
-
false
|
|
1149
|
+
false
|
|
1102
1150
|
);
|
|
1103
1151
|
|
|
1104
1152
|
return (cb) => {
|
|
1105
1153
|
callbacks.push(cb);
|
|
1106
|
-
_global.postMessage(token,
|
|
1154
|
+
_global.postMessage(token, '*');
|
|
1107
1155
|
};
|
|
1108
1156
|
})(`axios@${Math.random()}`, [])
|
|
1109
1157
|
: (cb) => setTimeout(cb);
|
|
1110
|
-
})(typeof setImmediate ===
|
|
1158
|
+
})(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
|
|
1111
1159
|
|
|
1160
|
+
/**
|
|
1161
|
+
* Schedules a microtask or asynchronous callback as soon as possible.
|
|
1162
|
+
* Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
|
|
1163
|
+
*
|
|
1164
|
+
* @type {Function}
|
|
1165
|
+
*/
|
|
1112
1166
|
const asap =
|
|
1113
|
-
typeof queueMicrotask !==
|
|
1167
|
+
typeof queueMicrotask !== 'undefined'
|
|
1114
1168
|
? queueMicrotask.bind(_global)
|
|
1115
|
-
: (typeof process !==
|
|
1169
|
+
: (typeof process !== 'undefined' && process.nextTick) || _setImmediate;
|
|
1116
1170
|
|
|
1117
1171
|
// *********************
|
|
1118
1172
|
|
|
@@ -1137,6 +1191,8 @@ var utils$1 = {
|
|
|
1137
1191
|
isUndefined,
|
|
1138
1192
|
isDate,
|
|
1139
1193
|
isFile,
|
|
1194
|
+
isReactNativeBlob,
|
|
1195
|
+
isReactNative,
|
|
1140
1196
|
isBlob,
|
|
1141
1197
|
isRegExp,
|
|
1142
1198
|
isFunction: isFunction$1,
|
|
@@ -1179,14 +1235,20 @@ var utils$1 = {
|
|
|
1179
1235
|
};
|
|
1180
1236
|
|
|
1181
1237
|
let AxiosError$1 = class AxiosError extends Error {
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1238
|
+
static from(error, code, config, request, response, customProps) {
|
|
1239
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1240
|
+
axiosError.cause = error;
|
|
1241
|
+
axiosError.name = error.name;
|
|
1242
|
+
|
|
1243
|
+
// Preserve status from the original error if not already set from response
|
|
1244
|
+
if (error.status != null && axiosError.status == null) {
|
|
1245
|
+
axiosError.status = error.status;
|
|
1188
1246
|
}
|
|
1189
1247
|
|
|
1248
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1249
|
+
return axiosError;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1190
1252
|
/**
|
|
1191
1253
|
* Create an Error with the specified message, config, error code, request and response.
|
|
1192
1254
|
*
|
|
@@ -1199,37 +1261,48 @@ let AxiosError$1 = class AxiosError extends Error {
|
|
|
1199
1261
|
* @returns {Error} The created error.
|
|
1200
1262
|
*/
|
|
1201
1263
|
constructor(message, code, config, request, response) {
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1264
|
+
super(message);
|
|
1265
|
+
|
|
1266
|
+
// Make message enumerable to maintain backward compatibility
|
|
1267
|
+
// The native Error constructor sets message as non-enumerable,
|
|
1268
|
+
// but axios < v1.13.3 had it as enumerable
|
|
1269
|
+
Object.defineProperty(this, 'message', {
|
|
1270
|
+
value: message,
|
|
1271
|
+
enumerable: true,
|
|
1272
|
+
writable: true,
|
|
1273
|
+
configurable: true
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
this.name = 'AxiosError';
|
|
1277
|
+
this.isAxiosError = true;
|
|
1278
|
+
code && (this.code = code);
|
|
1279
|
+
config && (this.config = config);
|
|
1280
|
+
request && (this.request = request);
|
|
1281
|
+
if (response) {
|
|
1282
|
+
this.response = response;
|
|
1283
|
+
this.status = response.status;
|
|
1284
|
+
}
|
|
1212
1285
|
}
|
|
1213
1286
|
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1287
|
+
toJSON() {
|
|
1288
|
+
return {
|
|
1289
|
+
// Standard
|
|
1290
|
+
message: this.message,
|
|
1291
|
+
name: this.name,
|
|
1292
|
+
// Microsoft
|
|
1293
|
+
description: this.description,
|
|
1294
|
+
number: this.number,
|
|
1295
|
+
// Mozilla
|
|
1296
|
+
fileName: this.fileName,
|
|
1297
|
+
lineNumber: this.lineNumber,
|
|
1298
|
+
columnNumber: this.columnNumber,
|
|
1299
|
+
stack: this.stack,
|
|
1300
|
+
// Axios
|
|
1301
|
+
config: utils$1.toJSONObject(this.config),
|
|
1302
|
+
code: this.code,
|
|
1303
|
+
status: this.status,
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1233
1306
|
};
|
|
1234
1307
|
|
|
1235
1308
|
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
@@ -1282,11 +1355,14 @@ function removeBrackets(key) {
|
|
|
1282
1355
|
*/
|
|
1283
1356
|
function renderKey(path, key, dots) {
|
|
1284
1357
|
if (!path) return key;
|
|
1285
|
-
return path
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1358
|
+
return path
|
|
1359
|
+
.concat(key)
|
|
1360
|
+
.map(function each(token, i) {
|
|
1361
|
+
// eslint-disable-next-line no-param-reassign
|
|
1362
|
+
token = removeBrackets(token);
|
|
1363
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
1364
|
+
})
|
|
1365
|
+
.join(dots ? '.' : '');
|
|
1290
1366
|
}
|
|
1291
1367
|
|
|
1292
1368
|
/**
|
|
@@ -1336,21 +1412,26 @@ function toFormData$1(obj, formData, options) {
|
|
|
1336
1412
|
formData = formData || new (FormData)();
|
|
1337
1413
|
|
|
1338
1414
|
// eslint-disable-next-line no-param-reassign
|
|
1339
|
-
options = utils$1.toFlatObject(
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1415
|
+
options = utils$1.toFlatObject(
|
|
1416
|
+
options,
|
|
1417
|
+
{
|
|
1418
|
+
metaTokens: true,
|
|
1419
|
+
dots: false,
|
|
1420
|
+
indexes: false,
|
|
1421
|
+
},
|
|
1422
|
+
false,
|
|
1423
|
+
function defined(option, source) {
|
|
1424
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1425
|
+
return !utils$1.isUndefined(source[option]);
|
|
1426
|
+
}
|
|
1427
|
+
);
|
|
1347
1428
|
|
|
1348
1429
|
const metaTokens = options.metaTokens;
|
|
1349
1430
|
// eslint-disable-next-line no-use-before-define
|
|
1350
1431
|
const visitor = options.visitor || defaultVisitor;
|
|
1351
1432
|
const dots = options.dots;
|
|
1352
1433
|
const indexes = options.indexes;
|
|
1353
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
1434
|
+
const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
|
|
1354
1435
|
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
1355
1436
|
|
|
1356
1437
|
if (!utils$1.isFunction(visitor)) {
|
|
@@ -1392,6 +1473,11 @@ function toFormData$1(obj, formData, options) {
|
|
|
1392
1473
|
function defaultVisitor(value, key, path) {
|
|
1393
1474
|
let arr = value;
|
|
1394
1475
|
|
|
1476
|
+
if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
|
|
1477
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1478
|
+
return false;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1395
1481
|
if (value && !path && typeof value === 'object') {
|
|
1396
1482
|
if (utils$1.endsWith(key, '{}')) {
|
|
1397
1483
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -1400,17 +1486,22 @@ function toFormData$1(obj, formData, options) {
|
|
|
1400
1486
|
value = JSON.stringify(value);
|
|
1401
1487
|
} else if (
|
|
1402
1488
|
(utils$1.isArray(value) && isFlatArray(value)) ||
|
|
1403
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
1404
|
-
|
|
1489
|
+
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
|
|
1490
|
+
) {
|
|
1405
1491
|
// eslint-disable-next-line no-param-reassign
|
|
1406
1492
|
key = removeBrackets(key);
|
|
1407
1493
|
|
|
1408
1494
|
arr.forEach(function each(el, index) {
|
|
1409
|
-
!(utils$1.isUndefined(el) || el === null) &&
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1495
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1496
|
+
formData.append(
|
|
1497
|
+
// eslint-disable-next-line no-nested-ternary
|
|
1498
|
+
indexes === true
|
|
1499
|
+
? renderKey([key], index, dots)
|
|
1500
|
+
: indexes === null
|
|
1501
|
+
? key
|
|
1502
|
+
: key + '[]',
|
|
1503
|
+
convertValue(el)
|
|
1504
|
+
);
|
|
1414
1505
|
});
|
|
1415
1506
|
return false;
|
|
1416
1507
|
}
|
|
@@ -1430,7 +1521,7 @@ function toFormData$1(obj, formData, options) {
|
|
|
1430
1521
|
const exposedHelpers = Object.assign(predicates, {
|
|
1431
1522
|
defaultVisitor,
|
|
1432
1523
|
convertValue,
|
|
1433
|
-
isVisitable
|
|
1524
|
+
isVisitable,
|
|
1434
1525
|
});
|
|
1435
1526
|
|
|
1436
1527
|
function build(value, path) {
|
|
@@ -1443,9 +1534,9 @@ function toFormData$1(obj, formData, options) {
|
|
|
1443
1534
|
stack.push(value);
|
|
1444
1535
|
|
|
1445
1536
|
utils$1.forEach(value, function each(el, key) {
|
|
1446
|
-
const result =
|
|
1447
|
-
|
|
1448
|
-
|
|
1537
|
+
const result =
|
|
1538
|
+
!(utils$1.isUndefined(el) || el === null) &&
|
|
1539
|
+
visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1449
1540
|
|
|
1450
1541
|
if (result === true) {
|
|
1451
1542
|
build(el, path ? path.concat(key) : [key]);
|
|
@@ -1480,7 +1571,7 @@ function encode$1(str) {
|
|
|
1480
1571
|
')': '%29',
|
|
1481
1572
|
'~': '%7E',
|
|
1482
1573
|
'%20': '+',
|
|
1483
|
-
'%00': '\x00'
|
|
1574
|
+
'%00': '\x00',
|
|
1484
1575
|
};
|
|
1485
1576
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1486
1577
|
return charMap[match];
|
|
@@ -1508,29 +1599,33 @@ prototype.append = function append(name, value) {
|
|
|
1508
1599
|
};
|
|
1509
1600
|
|
|
1510
1601
|
prototype.toString = function toString(encoder) {
|
|
1511
|
-
const _encode = encoder
|
|
1512
|
-
|
|
1513
|
-
|
|
1602
|
+
const _encode = encoder
|
|
1603
|
+
? function (value) {
|
|
1604
|
+
return encoder.call(this, value, encode$1);
|
|
1605
|
+
}
|
|
1606
|
+
: encode$1;
|
|
1514
1607
|
|
|
1515
|
-
return this._pairs
|
|
1516
|
-
|
|
1517
|
-
|
|
1608
|
+
return this._pairs
|
|
1609
|
+
.map(function each(pair) {
|
|
1610
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1611
|
+
}, '')
|
|
1612
|
+
.join('&');
|
|
1518
1613
|
};
|
|
1519
1614
|
|
|
1520
1615
|
/**
|
|
1521
|
-
* It replaces
|
|
1522
|
-
*
|
|
1616
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
1617
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1523
1618
|
*
|
|
1524
1619
|
* @param {string} val The value to be encoded.
|
|
1525
1620
|
*
|
|
1526
1621
|
* @returns {string} The encoded value.
|
|
1527
1622
|
*/
|
|
1528
1623
|
function encode(val) {
|
|
1529
|
-
return encodeURIComponent(val)
|
|
1530
|
-
replace(/%3A/gi, ':')
|
|
1531
|
-
replace(/%24/g, '$')
|
|
1532
|
-
replace(/%2C/gi, ',')
|
|
1533
|
-
replace(/%20/g, '+');
|
|
1624
|
+
return encodeURIComponent(val)
|
|
1625
|
+
.replace(/%3A/gi, ':')
|
|
1626
|
+
.replace(/%24/g, '$')
|
|
1627
|
+
.replace(/%2C/gi, ',')
|
|
1628
|
+
.replace(/%20/g, '+');
|
|
1534
1629
|
}
|
|
1535
1630
|
|
|
1536
1631
|
/**
|
|
@@ -1547,11 +1642,13 @@ function buildURL(url, params, options) {
|
|
|
1547
1642
|
return url;
|
|
1548
1643
|
}
|
|
1549
1644
|
|
|
1550
|
-
const _encode = options && options.encode || encode;
|
|
1645
|
+
const _encode = (options && options.encode) || encode;
|
|
1551
1646
|
|
|
1552
|
-
const _options = utils$1.isFunction(options)
|
|
1553
|
-
|
|
1554
|
-
|
|
1647
|
+
const _options = utils$1.isFunction(options)
|
|
1648
|
+
? {
|
|
1649
|
+
serialize: options,
|
|
1650
|
+
}
|
|
1651
|
+
: options;
|
|
1555
1652
|
|
|
1556
1653
|
const serializeFn = _options && _options.serialize;
|
|
1557
1654
|
|
|
@@ -1560,13 +1657,13 @@ function buildURL(url, params, options) {
|
|
|
1560
1657
|
if (serializeFn) {
|
|
1561
1658
|
serializedParams = serializeFn(params, _options);
|
|
1562
1659
|
} else {
|
|
1563
|
-
serializedParams = utils$1.isURLSearchParams(params)
|
|
1564
|
-
params.toString()
|
|
1565
|
-
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1660
|
+
serializedParams = utils$1.isURLSearchParams(params)
|
|
1661
|
+
? params.toString()
|
|
1662
|
+
: new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1566
1663
|
}
|
|
1567
1664
|
|
|
1568
1665
|
if (serializedParams) {
|
|
1569
|
-
const hashmarkIndex = url.indexOf(
|
|
1666
|
+
const hashmarkIndex = url.indexOf('#');
|
|
1570
1667
|
|
|
1571
1668
|
if (hashmarkIndex !== -1) {
|
|
1572
1669
|
url = url.slice(0, hashmarkIndex);
|
|
@@ -1596,7 +1693,7 @@ class InterceptorManager {
|
|
|
1596
1693
|
fulfilled,
|
|
1597
1694
|
rejected,
|
|
1598
1695
|
synchronous: options ? options.synchronous : false,
|
|
1599
|
-
runWhen: options ? options.runWhen : null
|
|
1696
|
+
runWhen: options ? options.runWhen : null,
|
|
1600
1697
|
});
|
|
1601
1698
|
return this.handlers.length - 1;
|
|
1602
1699
|
}
|
|
@@ -1648,7 +1745,7 @@ var transitionalDefaults = {
|
|
|
1648
1745
|
silentJSONParsing: true,
|
|
1649
1746
|
forcedJSONParsing: true,
|
|
1650
1747
|
clarifyTimeoutError: false,
|
|
1651
|
-
legacyInterceptorReqResOrdering: true
|
|
1748
|
+
legacyInterceptorReqResOrdering: true,
|
|
1652
1749
|
};
|
|
1653
1750
|
|
|
1654
1751
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -1662,14 +1759,14 @@ var platform$1 = {
|
|
|
1662
1759
|
classes: {
|
|
1663
1760
|
URLSearchParams: URLSearchParams$1,
|
|
1664
1761
|
FormData: FormData$1,
|
|
1665
|
-
Blob: Blob$1
|
|
1762
|
+
Blob: Blob$1,
|
|
1666
1763
|
},
|
|
1667
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1764
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data'],
|
|
1668
1765
|
};
|
|
1669
1766
|
|
|
1670
1767
|
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1671
1768
|
|
|
1672
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
1769
|
+
const _navigator = (typeof navigator === 'object' && navigator) || undefined;
|
|
1673
1770
|
|
|
1674
1771
|
/**
|
|
1675
1772
|
* Determine if we're running in a standard browser environment
|
|
@@ -1688,7 +1785,8 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
1688
1785
|
*
|
|
1689
1786
|
* @returns {boolean}
|
|
1690
1787
|
*/
|
|
1691
|
-
const hasStandardBrowserEnv =
|
|
1788
|
+
const hasStandardBrowserEnv =
|
|
1789
|
+
hasBrowserEnv &&
|
|
1692
1790
|
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
1693
1791
|
|
|
1694
1792
|
/**
|
|
@@ -1709,7 +1807,7 @@ const hasStandardBrowserWebWorkerEnv = (() => {
|
|
|
1709
1807
|
);
|
|
1710
1808
|
})();
|
|
1711
1809
|
|
|
1712
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
1810
|
+
const origin = (hasBrowserEnv && window.location.href) || 'http://localhost';
|
|
1713
1811
|
|
|
1714
1812
|
var utils = /*#__PURE__*/Object.freeze({
|
|
1715
1813
|
__proto__: null,
|
|
@@ -1722,12 +1820,12 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
1722
1820
|
|
|
1723
1821
|
var platform = {
|
|
1724
1822
|
...utils,
|
|
1725
|
-
...platform$1
|
|
1823
|
+
...platform$1,
|
|
1726
1824
|
};
|
|
1727
1825
|
|
|
1728
1826
|
function toURLEncodedForm(data, options) {
|
|
1729
1827
|
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
1730
|
-
visitor: function(value, key, path, helpers) {
|
|
1828
|
+
visitor: function (value, key, path, helpers) {
|
|
1731
1829
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
1732
1830
|
this.append(key, value.toString('base64'));
|
|
1733
1831
|
return false;
|
|
@@ -1735,7 +1833,7 @@ function toURLEncodedForm(data, options) {
|
|
|
1735
1833
|
|
|
1736
1834
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
1737
1835
|
},
|
|
1738
|
-
...options
|
|
1836
|
+
...options,
|
|
1739
1837
|
});
|
|
1740
1838
|
}
|
|
1741
1839
|
|
|
@@ -1751,7 +1849,7 @@ function parsePropPath(name) {
|
|
|
1751
1849
|
// foo.x.y.z
|
|
1752
1850
|
// foo-x-y-z
|
|
1753
1851
|
// foo x y z
|
|
1754
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1852
|
+
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
1755
1853
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1756
1854
|
});
|
|
1757
1855
|
}
|
|
@@ -1855,96 +1953,107 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
1855
1953
|
}
|
|
1856
1954
|
|
|
1857
1955
|
const defaults = {
|
|
1858
|
-
|
|
1859
1956
|
transitional: transitionalDefaults,
|
|
1860
1957
|
|
|
1861
1958
|
adapter: ['xhr', 'http', 'fetch'],
|
|
1862
1959
|
|
|
1863
|
-
transformRequest: [
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1960
|
+
transformRequest: [
|
|
1961
|
+
function transformRequest(data, headers) {
|
|
1962
|
+
const contentType = headers.getContentType() || '';
|
|
1963
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1964
|
+
const isObjectPayload = utils$1.isObject(data);
|
|
1867
1965
|
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1966
|
+
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1967
|
+
data = new FormData(data);
|
|
1968
|
+
}
|
|
1871
1969
|
|
|
1872
|
-
|
|
1970
|
+
const isFormData = utils$1.isFormData(data);
|
|
1873
1971
|
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1972
|
+
if (isFormData) {
|
|
1973
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1974
|
+
}
|
|
1877
1975
|
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1976
|
+
if (
|
|
1977
|
+
utils$1.isArrayBuffer(data) ||
|
|
1978
|
+
utils$1.isBuffer(data) ||
|
|
1979
|
+
utils$1.isStream(data) ||
|
|
1980
|
+
utils$1.isFile(data) ||
|
|
1981
|
+
utils$1.isBlob(data) ||
|
|
1982
|
+
utils$1.isReadableStream(data)
|
|
1983
|
+
) {
|
|
1984
|
+
return data;
|
|
1985
|
+
}
|
|
1986
|
+
if (utils$1.isArrayBufferView(data)) {
|
|
1987
|
+
return data.buffer;
|
|
1988
|
+
}
|
|
1989
|
+
if (utils$1.isURLSearchParams(data)) {
|
|
1990
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1991
|
+
return data.toString();
|
|
1992
|
+
}
|
|
1894
1993
|
|
|
1895
|
-
|
|
1994
|
+
let isFileList;
|
|
1896
1995
|
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1996
|
+
if (isObjectPayload) {
|
|
1997
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
1998
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
1999
|
+
}
|
|
1901
2000
|
|
|
1902
|
-
|
|
1903
|
-
|
|
2001
|
+
if (
|
|
2002
|
+
(isFileList = utils$1.isFileList(data)) ||
|
|
2003
|
+
contentType.indexOf('multipart/form-data') > -1
|
|
2004
|
+
) {
|
|
2005
|
+
const _FormData = this.env && this.env.FormData;
|
|
1904
2006
|
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2007
|
+
return toFormData$1(
|
|
2008
|
+
isFileList ? { 'files[]': data } : data,
|
|
2009
|
+
_FormData && new _FormData(),
|
|
2010
|
+
this.formSerializer
|
|
2011
|
+
);
|
|
2012
|
+
}
|
|
1910
2013
|
}
|
|
1911
|
-
}
|
|
1912
2014
|
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2015
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2016
|
+
headers.setContentType('application/json', false);
|
|
2017
|
+
return stringifySafely(data);
|
|
2018
|
+
}
|
|
1917
2019
|
|
|
1918
|
-
|
|
1919
|
-
|
|
2020
|
+
return data;
|
|
2021
|
+
},
|
|
2022
|
+
],
|
|
1920
2023
|
|
|
1921
|
-
transformResponse: [
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
2024
|
+
transformResponse: [
|
|
2025
|
+
function transformResponse(data) {
|
|
2026
|
+
const transitional = this.transitional || defaults.transitional;
|
|
2027
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2028
|
+
const JSONRequested = this.responseType === 'json';
|
|
1925
2029
|
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2030
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
2031
|
+
return data;
|
|
2032
|
+
}
|
|
1929
2033
|
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
2034
|
+
if (
|
|
2035
|
+
data &&
|
|
2036
|
+
utils$1.isString(data) &&
|
|
2037
|
+
((forcedJSONParsing && !this.responseType) || JSONRequested)
|
|
2038
|
+
) {
|
|
2039
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2040
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1933
2041
|
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
2042
|
+
try {
|
|
2043
|
+
return JSON.parse(data, this.parseReviver);
|
|
2044
|
+
} catch (e) {
|
|
2045
|
+
if (strictJSONParsing) {
|
|
2046
|
+
if (e.name === 'SyntaxError') {
|
|
2047
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2048
|
+
}
|
|
2049
|
+
throw e;
|
|
1940
2050
|
}
|
|
1941
|
-
throw e;
|
|
1942
2051
|
}
|
|
1943
2052
|
}
|
|
1944
|
-
}
|
|
1945
2053
|
|
|
1946
|
-
|
|
1947
|
-
|
|
2054
|
+
return data;
|
|
2055
|
+
},
|
|
2056
|
+
],
|
|
1948
2057
|
|
|
1949
2058
|
/**
|
|
1950
2059
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
@@ -1960,7 +2069,7 @@ const defaults = {
|
|
|
1960
2069
|
|
|
1961
2070
|
env: {
|
|
1962
2071
|
FormData: platform.classes.FormData,
|
|
1963
|
-
Blob: platform.classes.Blob
|
|
2072
|
+
Blob: platform.classes.Blob,
|
|
1964
2073
|
},
|
|
1965
2074
|
|
|
1966
2075
|
validateStatus: function validateStatus(status) {
|
|
@@ -1969,10 +2078,10 @@ const defaults = {
|
|
|
1969
2078
|
|
|
1970
2079
|
headers: {
|
|
1971
2080
|
common: {
|
|
1972
|
-
|
|
1973
|
-
'Content-Type': undefined
|
|
1974
|
-
}
|
|
1975
|
-
}
|
|
2081
|
+
Accept: 'application/json, text/plain, */*',
|
|
2082
|
+
'Content-Type': undefined,
|
|
2083
|
+
},
|
|
2084
|
+
},
|
|
1976
2085
|
};
|
|
1977
2086
|
|
|
1978
2087
|
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
@@ -1982,10 +2091,23 @@ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
|
|
1982
2091
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1983
2092
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1984
2093
|
const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
1985
|
-
'age',
|
|
1986
|
-
'
|
|
1987
|
-
'
|
|
1988
|
-
'
|
|
2094
|
+
'age',
|
|
2095
|
+
'authorization',
|
|
2096
|
+
'content-length',
|
|
2097
|
+
'content-type',
|
|
2098
|
+
'etag',
|
|
2099
|
+
'expires',
|
|
2100
|
+
'from',
|
|
2101
|
+
'host',
|
|
2102
|
+
'if-modified-since',
|
|
2103
|
+
'if-unmodified-since',
|
|
2104
|
+
'last-modified',
|
|
2105
|
+
'location',
|
|
2106
|
+
'max-forwards',
|
|
2107
|
+
'proxy-authorization',
|
|
2108
|
+
'referer',
|
|
2109
|
+
'retry-after',
|
|
2110
|
+
'user-agent',
|
|
1989
2111
|
]);
|
|
1990
2112
|
|
|
1991
2113
|
/**
|
|
@@ -2002,47 +2124,81 @@ const ignoreDuplicateOf = utils$1.toObjectSet([
|
|
|
2002
2124
|
*
|
|
2003
2125
|
* @returns {Object} Headers parsed into an object
|
|
2004
2126
|
*/
|
|
2005
|
-
var parseHeaders = rawHeaders => {
|
|
2127
|
+
var parseHeaders = (rawHeaders) => {
|
|
2006
2128
|
const parsed = {};
|
|
2007
2129
|
let key;
|
|
2008
2130
|
let val;
|
|
2009
2131
|
let i;
|
|
2010
2132
|
|
|
2011
|
-
rawHeaders &&
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2133
|
+
rawHeaders &&
|
|
2134
|
+
rawHeaders.split('\n').forEach(function parser(line) {
|
|
2135
|
+
i = line.indexOf(':');
|
|
2136
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
2137
|
+
val = line.substring(i + 1).trim();
|
|
2015
2138
|
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2139
|
+
if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
|
|
2140
|
+
return;
|
|
2141
|
+
}
|
|
2019
2142
|
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2143
|
+
if (key === 'set-cookie') {
|
|
2144
|
+
if (parsed[key]) {
|
|
2145
|
+
parsed[key].push(val);
|
|
2146
|
+
} else {
|
|
2147
|
+
parsed[key] = [val];
|
|
2148
|
+
}
|
|
2023
2149
|
} else {
|
|
2024
|
-
parsed[key] = [val
|
|
2150
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2025
2151
|
}
|
|
2026
|
-
}
|
|
2027
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2028
|
-
}
|
|
2029
|
-
});
|
|
2152
|
+
});
|
|
2030
2153
|
|
|
2031
2154
|
return parsed;
|
|
2032
2155
|
};
|
|
2033
2156
|
|
|
2034
2157
|
const $internals = Symbol('internals');
|
|
2035
2158
|
|
|
2159
|
+
const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
|
|
2160
|
+
|
|
2161
|
+
function assertValidHeaderValue(value, header) {
|
|
2162
|
+
if (value === false || value == null) {
|
|
2163
|
+
return;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
if (utils$1.isArray(value)) {
|
|
2167
|
+
value.forEach((v) => assertValidHeaderValue(v, header));
|
|
2168
|
+
return;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
if (!isValidHeaderValue(String(value))) {
|
|
2172
|
+
throw new Error(`Invalid character in header content ["${header}"]`);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2036
2176
|
function normalizeHeader(header) {
|
|
2037
2177
|
return header && String(header).trim().toLowerCase();
|
|
2038
2178
|
}
|
|
2039
2179
|
|
|
2180
|
+
function stripTrailingCRLF(str) {
|
|
2181
|
+
let end = str.length;
|
|
2182
|
+
|
|
2183
|
+
while (end > 0) {
|
|
2184
|
+
const charCode = str.charCodeAt(end - 1);
|
|
2185
|
+
|
|
2186
|
+
if (charCode !== 10 && charCode !== 13) {
|
|
2187
|
+
break;
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
end -= 1;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
return end === str.length ? str : str.slice(0, end);
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2040
2196
|
function normalizeValue(value) {
|
|
2041
2197
|
if (value === false || value == null) {
|
|
2042
2198
|
return value;
|
|
2043
2199
|
}
|
|
2044
2200
|
|
|
2045
|
-
return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2201
|
+
return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
2046
2202
|
}
|
|
2047
2203
|
|
|
2048
2204
|
function parseTokens(str) {
|
|
@@ -2080,8 +2236,10 @@ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
|
2080
2236
|
}
|
|
2081
2237
|
|
|
2082
2238
|
function formatHeader(header) {
|
|
2083
|
-
return header
|
|
2084
|
-
.
|
|
2239
|
+
return header
|
|
2240
|
+
.trim()
|
|
2241
|
+
.toLowerCase()
|
|
2242
|
+
.replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
2085
2243
|
return char.toUpperCase() + str;
|
|
2086
2244
|
});
|
|
2087
2245
|
}
|
|
@@ -2089,12 +2247,12 @@ function formatHeader(header) {
|
|
|
2089
2247
|
function buildAccessors(obj, header) {
|
|
2090
2248
|
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
2091
2249
|
|
|
2092
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
2250
|
+
['get', 'set', 'has'].forEach((methodName) => {
|
|
2093
2251
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
2094
|
-
value: function(arg1, arg2, arg3) {
|
|
2252
|
+
value: function (arg1, arg2, arg3) {
|
|
2095
2253
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
2096
2254
|
},
|
|
2097
|
-
configurable: true
|
|
2255
|
+
configurable: true,
|
|
2098
2256
|
});
|
|
2099
2257
|
});
|
|
2100
2258
|
}
|
|
@@ -2116,7 +2274,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2116
2274
|
|
|
2117
2275
|
const key = utils$1.findKey(self, lHeader);
|
|
2118
2276
|
|
|
2119
|
-
if
|
|
2277
|
+
if (
|
|
2278
|
+
!key ||
|
|
2279
|
+
self[key] === undefined ||
|
|
2280
|
+
_rewrite === true ||
|
|
2281
|
+
(_rewrite === undefined && self[key] !== false)
|
|
2282
|
+
) {
|
|
2283
|
+
assertValidHeaderValue(_value, _header);
|
|
2120
2284
|
self[key || _header] = normalizeValue(_value);
|
|
2121
2285
|
}
|
|
2122
2286
|
}
|
|
@@ -2126,17 +2290,22 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2126
2290
|
|
|
2127
2291
|
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
2128
2292
|
setHeaders(header, valueOrRewrite);
|
|
2129
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2293
|
+
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2130
2294
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
2131
2295
|
} else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
|
|
2132
|
-
let obj = {},
|
|
2296
|
+
let obj = {},
|
|
2297
|
+
dest,
|
|
2298
|
+
key;
|
|
2133
2299
|
for (const entry of header) {
|
|
2134
2300
|
if (!utils$1.isArray(entry)) {
|
|
2135
2301
|
throw TypeError('Object iterator must return a key-value pair');
|
|
2136
2302
|
}
|
|
2137
2303
|
|
|
2138
|
-
obj[key = entry[0]] = (dest = obj[key])
|
|
2139
|
-
|
|
2304
|
+
obj[(key = entry[0])] = (dest = obj[key])
|
|
2305
|
+
? utils$1.isArray(dest)
|
|
2306
|
+
? [...dest, entry[1]]
|
|
2307
|
+
: [dest, entry[1]]
|
|
2308
|
+
: entry[1];
|
|
2140
2309
|
}
|
|
2141
2310
|
|
|
2142
2311
|
setHeaders(obj, valueOrRewrite);
|
|
@@ -2183,7 +2352,11 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2183
2352
|
if (header) {
|
|
2184
2353
|
const key = utils$1.findKey(this, header);
|
|
2185
2354
|
|
|
2186
|
-
return !!(
|
|
2355
|
+
return !!(
|
|
2356
|
+
key &&
|
|
2357
|
+
this[key] !== undefined &&
|
|
2358
|
+
(!matcher || matchHeaderValue(this, this[key], key, matcher))
|
|
2359
|
+
);
|
|
2187
2360
|
}
|
|
2188
2361
|
|
|
2189
2362
|
return false;
|
|
@@ -2223,7 +2396,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2223
2396
|
|
|
2224
2397
|
while (i--) {
|
|
2225
2398
|
const key = keys[i];
|
|
2226
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2399
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2227
2400
|
delete this[key];
|
|
2228
2401
|
deleted = true;
|
|
2229
2402
|
}
|
|
@@ -2267,7 +2440,9 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2267
2440
|
const obj = Object.create(null);
|
|
2268
2441
|
|
|
2269
2442
|
utils$1.forEach(this, (value, header) => {
|
|
2270
|
-
value != null &&
|
|
2443
|
+
value != null &&
|
|
2444
|
+
value !== false &&
|
|
2445
|
+
(obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
2271
2446
|
});
|
|
2272
2447
|
|
|
2273
2448
|
return obj;
|
|
@@ -2278,11 +2453,13 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2278
2453
|
}
|
|
2279
2454
|
|
|
2280
2455
|
toString() {
|
|
2281
|
-
return Object.entries(this.toJSON())
|
|
2456
|
+
return Object.entries(this.toJSON())
|
|
2457
|
+
.map(([header, value]) => header + ': ' + value)
|
|
2458
|
+
.join('\n');
|
|
2282
2459
|
}
|
|
2283
2460
|
|
|
2284
2461
|
getSetCookie() {
|
|
2285
|
-
return this.get(
|
|
2462
|
+
return this.get('set-cookie') || [];
|
|
2286
2463
|
}
|
|
2287
2464
|
|
|
2288
2465
|
get [Symbol.toStringTag]() {
|
|
@@ -2302,9 +2479,12 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2302
2479
|
}
|
|
2303
2480
|
|
|
2304
2481
|
static accessor(header) {
|
|
2305
|
-
const internals =
|
|
2306
|
-
|
|
2307
|
-
|
|
2482
|
+
const internals =
|
|
2483
|
+
(this[$internals] =
|
|
2484
|
+
this[$internals] =
|
|
2485
|
+
{
|
|
2486
|
+
accessors: {},
|
|
2487
|
+
});
|
|
2308
2488
|
|
|
2309
2489
|
const accessors = internals.accessors;
|
|
2310
2490
|
const prototype = this.prototype;
|
|
@@ -2324,17 +2504,24 @@ let AxiosHeaders$1 = class AxiosHeaders {
|
|
|
2324
2504
|
}
|
|
2325
2505
|
};
|
|
2326
2506
|
|
|
2327
|
-
AxiosHeaders$1.accessor([
|
|
2507
|
+
AxiosHeaders$1.accessor([
|
|
2508
|
+
'Content-Type',
|
|
2509
|
+
'Content-Length',
|
|
2510
|
+
'Accept',
|
|
2511
|
+
'Accept-Encoding',
|
|
2512
|
+
'User-Agent',
|
|
2513
|
+
'Authorization',
|
|
2514
|
+
]);
|
|
2328
2515
|
|
|
2329
2516
|
// reserved names hotfix
|
|
2330
|
-
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
|
|
2517
|
+
utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
|
|
2331
2518
|
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2332
2519
|
return {
|
|
2333
2520
|
get: () => value,
|
|
2334
2521
|
set(headerValue) {
|
|
2335
2522
|
this[mapped] = headerValue;
|
|
2336
|
-
}
|
|
2337
|
-
}
|
|
2523
|
+
},
|
|
2524
|
+
};
|
|
2338
2525
|
});
|
|
2339
2526
|
|
|
2340
2527
|
utils$1.freezeMethods(AxiosHeaders$1);
|
|
@@ -2397,19 +2584,23 @@ function settle(resolve, reject, response) {
|
|
|
2397
2584
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2398
2585
|
resolve(response);
|
|
2399
2586
|
} else {
|
|
2400
|
-
reject(
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2587
|
+
reject(
|
|
2588
|
+
new AxiosError$1(
|
|
2589
|
+
'Request failed with status code ' + response.status,
|
|
2590
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][
|
|
2591
|
+
Math.floor(response.status / 100) - 4
|
|
2592
|
+
],
|
|
2593
|
+
response.config,
|
|
2594
|
+
response.request,
|
|
2595
|
+
response
|
|
2596
|
+
)
|
|
2597
|
+
);
|
|
2407
2598
|
}
|
|
2408
2599
|
}
|
|
2409
2600
|
|
|
2410
2601
|
function parseProtocol(url) {
|
|
2411
2602
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2412
|
-
return match && match[1] || '';
|
|
2603
|
+
return (match && match[1]) || '';
|
|
2413
2604
|
}
|
|
2414
2605
|
|
|
2415
2606
|
/**
|
|
@@ -2460,7 +2651,7 @@ function speedometer(samplesCount, min) {
|
|
|
2460
2651
|
|
|
2461
2652
|
const passed = startedAt && now - startedAt;
|
|
2462
2653
|
|
|
2463
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
2654
|
+
return passed ? Math.round((bytesCount * 1000) / passed) : undefined;
|
|
2464
2655
|
};
|
|
2465
2656
|
}
|
|
2466
2657
|
|
|
@@ -2489,7 +2680,7 @@ function throttle(fn, freq) {
|
|
|
2489
2680
|
const throttled = (...args) => {
|
|
2490
2681
|
const now = Date.now();
|
|
2491
2682
|
const passed = now - timestamp;
|
|
2492
|
-
if (
|
|
2683
|
+
if (passed >= threshold) {
|
|
2493
2684
|
invoke(args, now);
|
|
2494
2685
|
} else {
|
|
2495
2686
|
lastArgs = args;
|
|
@@ -2511,7 +2702,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2511
2702
|
let bytesNotified = 0;
|
|
2512
2703
|
const _speedometer = speedometer(50, 250);
|
|
2513
2704
|
|
|
2514
|
-
return throttle(e => {
|
|
2705
|
+
return throttle((e) => {
|
|
2515
2706
|
const loaded = e.loaded;
|
|
2516
2707
|
const total = e.lengthComputable ? e.total : undefined;
|
|
2517
2708
|
const progressBytes = loaded - bytesNotified;
|
|
@@ -2523,13 +2714,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2523
2714
|
const data = {
|
|
2524
2715
|
loaded,
|
|
2525
2716
|
total,
|
|
2526
|
-
progress: total ?
|
|
2717
|
+
progress: total ? loaded / total : undefined,
|
|
2527
2718
|
bytes: progressBytes,
|
|
2528
2719
|
rate: rate ? rate : undefined,
|
|
2529
2720
|
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
2530
2721
|
event: e,
|
|
2531
2722
|
lengthComputable: total != null,
|
|
2532
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
2723
|
+
[isDownloadStream ? 'download' : 'upload']: true,
|
|
2533
2724
|
};
|
|
2534
2725
|
|
|
2535
2726
|
listener(data);
|
|
@@ -2539,77 +2730,82 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
|
2539
2730
|
const progressEventDecorator = (total, throttled) => {
|
|
2540
2731
|
const lengthComputable = total != null;
|
|
2541
2732
|
|
|
2542
|
-
return [
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2733
|
+
return [
|
|
2734
|
+
(loaded) =>
|
|
2735
|
+
throttled[0]({
|
|
2736
|
+
lengthComputable,
|
|
2737
|
+
total,
|
|
2738
|
+
loaded,
|
|
2739
|
+
}),
|
|
2740
|
+
throttled[1],
|
|
2741
|
+
];
|
|
2547
2742
|
};
|
|
2548
2743
|
|
|
2549
|
-
const asyncDecorator =
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2744
|
+
const asyncDecorator =
|
|
2745
|
+
(fn) =>
|
|
2746
|
+
(...args) =>
|
|
2747
|
+
utils$1.asap(() => fn(...args));
|
|
2553
2748
|
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
(isMSIE || origin.port === url.port)
|
|
2558
|
-
);
|
|
2559
|
-
})(
|
|
2560
|
-
new URL(platform.origin),
|
|
2561
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2562
|
-
) : () => true;
|
|
2563
|
-
|
|
2564
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
2749
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv
|
|
2750
|
+
? ((origin, isMSIE) => (url) => {
|
|
2751
|
+
url = new URL(url, platform.origin);
|
|
2565
2752
|
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
cookie
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2753
|
+
return (
|
|
2754
|
+
origin.protocol === url.protocol &&
|
|
2755
|
+
origin.host === url.host &&
|
|
2756
|
+
(isMSIE || origin.port === url.port)
|
|
2757
|
+
);
|
|
2758
|
+
})(
|
|
2759
|
+
new URL(platform.origin),
|
|
2760
|
+
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
2761
|
+
)
|
|
2762
|
+
: () => true;
|
|
2763
|
+
|
|
2764
|
+
var cookies = platform.hasStandardBrowserEnv
|
|
2765
|
+
? // Standard browser envs support document.cookie
|
|
2766
|
+
{
|
|
2767
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2768
|
+
if (typeof document === 'undefined') return;
|
|
2769
|
+
|
|
2770
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
2771
|
+
|
|
2772
|
+
if (utils$1.isNumber(expires)) {
|
|
2773
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
2774
|
+
}
|
|
2775
|
+
if (utils$1.isString(path)) {
|
|
2776
|
+
cookie.push(`path=${path}`);
|
|
2777
|
+
}
|
|
2778
|
+
if (utils$1.isString(domain)) {
|
|
2779
|
+
cookie.push(`domain=${domain}`);
|
|
2780
|
+
}
|
|
2781
|
+
if (secure === true) {
|
|
2782
|
+
cookie.push('secure');
|
|
2783
|
+
}
|
|
2784
|
+
if (utils$1.isString(sameSite)) {
|
|
2785
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
2786
|
+
}
|
|
2588
2787
|
|
|
2589
|
-
|
|
2590
|
-
|
|
2788
|
+
document.cookie = cookie.join('; ');
|
|
2789
|
+
},
|
|
2591
2790
|
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2791
|
+
read(name) {
|
|
2792
|
+
if (typeof document === 'undefined') return null;
|
|
2793
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
2794
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
2795
|
+
},
|
|
2597
2796
|
|
|
2598
|
-
|
|
2599
|
-
|
|
2797
|
+
remove(name) {
|
|
2798
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
2799
|
+
},
|
|
2600
2800
|
}
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
return null;
|
|
2610
|
-
},
|
|
2611
|
-
remove() {}
|
|
2612
|
-
};
|
|
2801
|
+
: // Non-standard browser env (web workers, react-native) lack needed support.
|
|
2802
|
+
{
|
|
2803
|
+
write() {},
|
|
2804
|
+
read() {
|
|
2805
|
+
return null;
|
|
2806
|
+
},
|
|
2807
|
+
remove() {},
|
|
2808
|
+
};
|
|
2613
2809
|
|
|
2614
2810
|
/**
|
|
2615
2811
|
* Determines whether the specified URL is absolute
|
|
@@ -2661,8 +2857,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
2661
2857
|
return requestedURL;
|
|
2662
2858
|
}
|
|
2663
2859
|
|
|
2664
|
-
const headersToObject = (thing) =>
|
|
2665
|
-
thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
2860
|
+
const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing } : thing);
|
|
2666
2861
|
|
|
2667
2862
|
/**
|
|
2668
2863
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -2755,23 +2950,12 @@ function mergeConfig$1(config1, config2) {
|
|
|
2755
2950
|
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
2756
2951
|
};
|
|
2757
2952
|
|
|
2758
|
-
utils$1.forEach(
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
prop === "prototype"
|
|
2765
|
-
)
|
|
2766
|
-
return;
|
|
2767
|
-
const merge = utils$1.hasOwnProp(mergeMap, prop)
|
|
2768
|
-
? mergeMap[prop]
|
|
2769
|
-
: mergeDeepProperties;
|
|
2770
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2771
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
|
2772
|
-
(config[prop] = configValue);
|
|
2773
|
-
},
|
|
2774
|
-
);
|
|
2953
|
+
utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
|
|
2954
|
+
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
2955
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
2956
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2957
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2958
|
+
});
|
|
2775
2959
|
|
|
2776
2960
|
return config;
|
|
2777
2961
|
}
|
|
@@ -2783,12 +2967,22 @@ var resolveConfig = (config) => {
|
|
|
2783
2967
|
|
|
2784
2968
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2785
2969
|
|
|
2786
|
-
newConfig.url = buildURL(
|
|
2970
|
+
newConfig.url = buildURL(
|
|
2971
|
+
buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls),
|
|
2972
|
+
config.params,
|
|
2973
|
+
config.paramsSerializer
|
|
2974
|
+
);
|
|
2787
2975
|
|
|
2788
2976
|
// HTTP basic authentication
|
|
2789
2977
|
if (auth) {
|
|
2790
|
-
headers.set(
|
|
2791
|
-
|
|
2978
|
+
headers.set(
|
|
2979
|
+
'Authorization',
|
|
2980
|
+
'Basic ' +
|
|
2981
|
+
btoa(
|
|
2982
|
+
(auth.username || '') +
|
|
2983
|
+
':' +
|
|
2984
|
+
(auth.password ? unescape(encodeURIComponent(auth.password)) : '')
|
|
2985
|
+
)
|
|
2792
2986
|
);
|
|
2793
2987
|
}
|
|
2794
2988
|
|
|
@@ -2806,7 +3000,7 @@ var resolveConfig = (config) => {
|
|
|
2806
3000
|
}
|
|
2807
3001
|
});
|
|
2808
3002
|
}
|
|
2809
|
-
}
|
|
3003
|
+
}
|
|
2810
3004
|
|
|
2811
3005
|
// Add xsrf header
|
|
2812
3006
|
// This is only done if running in a standard browser environment.
|
|
@@ -2830,196 +3024,218 @@ var resolveConfig = (config) => {
|
|
|
2830
3024
|
|
|
2831
3025
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
2832
3026
|
|
|
2833
|
-
var xhrAdapter = isXHRAdapterSupported &&
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
3027
|
+
var xhrAdapter = isXHRAdapterSupported &&
|
|
3028
|
+
function (config) {
|
|
3029
|
+
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3030
|
+
const _config = resolveConfig(config);
|
|
3031
|
+
let requestData = _config.data;
|
|
3032
|
+
const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
3033
|
+
let { responseType, onUploadProgress, onDownloadProgress } = _config;
|
|
3034
|
+
let onCanceled;
|
|
3035
|
+
let uploadThrottled, downloadThrottled;
|
|
3036
|
+
let flushUpload, flushDownload;
|
|
2842
3037
|
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
3038
|
+
function done() {
|
|
3039
|
+
flushUpload && flushUpload(); // flush events
|
|
3040
|
+
flushDownload && flushDownload(); // flush events
|
|
2846
3041
|
|
|
2847
|
-
|
|
3042
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
2848
3043
|
|
|
2849
|
-
|
|
2850
|
-
|
|
3044
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
3045
|
+
}
|
|
2851
3046
|
|
|
2852
|
-
|
|
3047
|
+
let request = new XMLHttpRequest();
|
|
2853
3048
|
|
|
2854
|
-
|
|
3049
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
2855
3050
|
|
|
2856
|
-
|
|
2857
|
-
|
|
3051
|
+
// Set the request timeout in MS
|
|
3052
|
+
request.timeout = _config.timeout;
|
|
2858
3053
|
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
3054
|
+
function onloadend() {
|
|
3055
|
+
if (!request) {
|
|
3056
|
+
return;
|
|
3057
|
+
}
|
|
3058
|
+
// Prepare the response
|
|
3059
|
+
const responseHeaders = AxiosHeaders$1.from(
|
|
3060
|
+
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
3061
|
+
);
|
|
3062
|
+
const responseData =
|
|
3063
|
+
!responseType || responseType === 'text' || responseType === 'json'
|
|
3064
|
+
? request.responseText
|
|
3065
|
+
: request.response;
|
|
3066
|
+
const response = {
|
|
3067
|
+
data: responseData,
|
|
3068
|
+
status: request.status,
|
|
3069
|
+
statusText: request.statusText,
|
|
3070
|
+
headers: responseHeaders,
|
|
3071
|
+
config,
|
|
3072
|
+
request,
|
|
3073
|
+
};
|
|
3074
|
+
|
|
3075
|
+
settle(
|
|
3076
|
+
function _resolve(value) {
|
|
3077
|
+
resolve(value);
|
|
3078
|
+
done();
|
|
3079
|
+
},
|
|
3080
|
+
function _reject(err) {
|
|
3081
|
+
reject(err);
|
|
3082
|
+
done();
|
|
3083
|
+
},
|
|
3084
|
+
response
|
|
3085
|
+
);
|
|
3086
|
+
|
|
3087
|
+
// Clean up request
|
|
3088
|
+
request = null;
|
|
2862
3089
|
}
|
|
2863
|
-
// Prepare the response
|
|
2864
|
-
const responseHeaders = AxiosHeaders$1.from(
|
|
2865
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
2866
|
-
);
|
|
2867
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
2868
|
-
request.responseText : request.response;
|
|
2869
|
-
const response = {
|
|
2870
|
-
data: responseData,
|
|
2871
|
-
status: request.status,
|
|
2872
|
-
statusText: request.statusText,
|
|
2873
|
-
headers: responseHeaders,
|
|
2874
|
-
config,
|
|
2875
|
-
request
|
|
2876
|
-
};
|
|
2877
3090
|
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
}
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
3091
|
+
if ('onloadend' in request) {
|
|
3092
|
+
// Use onloadend if available
|
|
3093
|
+
request.onloadend = onloadend;
|
|
3094
|
+
} else {
|
|
3095
|
+
// Listen for ready state to emulate onloadend
|
|
3096
|
+
request.onreadystatechange = function handleLoad() {
|
|
3097
|
+
if (!request || request.readyState !== 4) {
|
|
3098
|
+
return;
|
|
3099
|
+
}
|
|
2885
3100
|
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
3101
|
+
// The request errored out and we didn't get a response, this will be
|
|
3102
|
+
// handled by onerror instead
|
|
3103
|
+
// With one exception: request that using file: protocol, most browsers
|
|
3104
|
+
// will return status as 0 even though it's a successful request
|
|
3105
|
+
if (
|
|
3106
|
+
request.status === 0 &&
|
|
3107
|
+
!(request.responseURL && request.responseURL.indexOf('file:') === 0)
|
|
3108
|
+
) {
|
|
3109
|
+
return;
|
|
3110
|
+
}
|
|
3111
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
3112
|
+
// so we should call onloadend on the next 'tick'
|
|
3113
|
+
setTimeout(onloadend);
|
|
3114
|
+
};
|
|
3115
|
+
}
|
|
2889
3116
|
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
} else {
|
|
2894
|
-
// Listen for ready state to emulate onloadend
|
|
2895
|
-
request.onreadystatechange = function handleLoad() {
|
|
2896
|
-
if (!request || request.readyState !== 4) {
|
|
3117
|
+
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
3118
|
+
request.onabort = function handleAbort() {
|
|
3119
|
+
if (!request) {
|
|
2897
3120
|
return;
|
|
2898
3121
|
}
|
|
2899
3122
|
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
//
|
|
2903
|
-
|
|
2904
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
2905
|
-
return;
|
|
2906
|
-
}
|
|
2907
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
2908
|
-
// so we should call onloadend on the next 'tick'
|
|
2909
|
-
setTimeout(onloadend);
|
|
3123
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
3124
|
+
|
|
3125
|
+
// Clean up request
|
|
3126
|
+
request = null;
|
|
2910
3127
|
};
|
|
2911
|
-
}
|
|
2912
3128
|
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
3129
|
+
// Handle low level network errors
|
|
3130
|
+
request.onerror = function handleError(event) {
|
|
3131
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
3132
|
+
// (message may be empty; when present, surface it)
|
|
3133
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
3134
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
3135
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
3136
|
+
// attach the underlying event for consumers who want details
|
|
3137
|
+
err.event = event || null;
|
|
3138
|
+
reject(err);
|
|
3139
|
+
request = null;
|
|
3140
|
+
};
|
|
3141
|
+
|
|
3142
|
+
// Handle timeout
|
|
3143
|
+
request.ontimeout = function handleTimeout() {
|
|
3144
|
+
let timeoutErrorMessage = _config.timeout
|
|
3145
|
+
? 'timeout of ' + _config.timeout + 'ms exceeded'
|
|
3146
|
+
: 'timeout exceeded';
|
|
3147
|
+
const transitional = _config.transitional || transitionalDefaults;
|
|
3148
|
+
if (_config.timeoutErrorMessage) {
|
|
3149
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3150
|
+
}
|
|
3151
|
+
reject(
|
|
3152
|
+
new AxiosError$1(
|
|
3153
|
+
timeoutErrorMessage,
|
|
3154
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
3155
|
+
config,
|
|
3156
|
+
request
|
|
3157
|
+
)
|
|
3158
|
+
);
|
|
2918
3159
|
|
|
2919
|
-
|
|
3160
|
+
// Clean up request
|
|
3161
|
+
request = null;
|
|
3162
|
+
};
|
|
2920
3163
|
|
|
2921
|
-
//
|
|
2922
|
-
|
|
2923
|
-
};
|
|
3164
|
+
// Remove Content-Type if data is undefined
|
|
3165
|
+
requestData === undefined && requestHeaders.setContentType(null);
|
|
2924
3166
|
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
const msg = event && event.message ? event.message : 'Network Error';
|
|
2931
|
-
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2932
|
-
// attach the underlying event for consumers who want details
|
|
2933
|
-
err.event = event || null;
|
|
2934
|
-
reject(err);
|
|
2935
|
-
request = null;
|
|
2936
|
-
};
|
|
2937
|
-
|
|
2938
|
-
// Handle timeout
|
|
2939
|
-
request.ontimeout = function handleTimeout() {
|
|
2940
|
-
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
2941
|
-
const transitional = _config.transitional || transitionalDefaults;
|
|
2942
|
-
if (_config.timeoutErrorMessage) {
|
|
2943
|
-
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3167
|
+
// Add headers to the request
|
|
3168
|
+
if ('setRequestHeader' in request) {
|
|
3169
|
+
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
3170
|
+
request.setRequestHeader(key, val);
|
|
3171
|
+
});
|
|
2944
3172
|
}
|
|
2945
|
-
reject(new AxiosError$1(
|
|
2946
|
-
timeoutErrorMessage,
|
|
2947
|
-
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2948
|
-
config,
|
|
2949
|
-
request));
|
|
2950
|
-
|
|
2951
|
-
// Clean up request
|
|
2952
|
-
request = null;
|
|
2953
|
-
};
|
|
2954
|
-
|
|
2955
|
-
// Remove Content-Type if data is undefined
|
|
2956
|
-
requestData === undefined && requestHeaders.setContentType(null);
|
|
2957
3173
|
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
});
|
|
2963
|
-
}
|
|
3174
|
+
// Add withCredentials to request if needed
|
|
3175
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
3176
|
+
request.withCredentials = !!_config.withCredentials;
|
|
3177
|
+
}
|
|
2964
3178
|
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
3179
|
+
// Add responseType to request if needed
|
|
3180
|
+
if (responseType && responseType !== 'json') {
|
|
3181
|
+
request.responseType = _config.responseType;
|
|
3182
|
+
}
|
|
2969
3183
|
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
3184
|
+
// Handle progress if needed
|
|
3185
|
+
if (onDownloadProgress) {
|
|
3186
|
+
[downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
|
|
3187
|
+
request.addEventListener('progress', downloadThrottled);
|
|
3188
|
+
}
|
|
2974
3189
|
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
request.addEventListener('progress', downloadThrottled);
|
|
2979
|
-
}
|
|
3190
|
+
// Not all browsers support upload events
|
|
3191
|
+
if (onUploadProgress && request.upload) {
|
|
3192
|
+
[uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
|
|
2980
3193
|
|
|
2981
|
-
|
|
2982
|
-
if (onUploadProgress && request.upload) {
|
|
2983
|
-
([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
|
|
3194
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
2984
3195
|
|
|
2985
|
-
|
|
3196
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
3197
|
+
}
|
|
2986
3198
|
|
|
2987
|
-
|
|
2988
|
-
|
|
3199
|
+
if (_config.cancelToken || _config.signal) {
|
|
3200
|
+
// Handle cancellation
|
|
3201
|
+
// eslint-disable-next-line func-names
|
|
3202
|
+
onCanceled = (cancel) => {
|
|
3203
|
+
if (!request) {
|
|
3204
|
+
return;
|
|
3205
|
+
}
|
|
3206
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
3207
|
+
request.abort();
|
|
3208
|
+
request = null;
|
|
3209
|
+
};
|
|
2989
3210
|
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
return;
|
|
3211
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3212
|
+
if (_config.signal) {
|
|
3213
|
+
_config.signal.aborted
|
|
3214
|
+
? onCanceled()
|
|
3215
|
+
: _config.signal.addEventListener('abort', onCanceled);
|
|
2996
3216
|
}
|
|
2997
|
-
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2998
|
-
request.abort();
|
|
2999
|
-
request = null;
|
|
3000
|
-
};
|
|
3001
|
-
|
|
3002
|
-
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3003
|
-
if (_config.signal) {
|
|
3004
|
-
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
3005
3217
|
}
|
|
3006
|
-
}
|
|
3007
3218
|
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3011
|
-
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
3012
|
-
return;
|
|
3013
|
-
}
|
|
3219
|
+
const protocol = parseProtocol(_config.url);
|
|
3014
3220
|
|
|
3221
|
+
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
3222
|
+
reject(
|
|
3223
|
+
new AxiosError$1(
|
|
3224
|
+
'Unsupported protocol ' + protocol + ':',
|
|
3225
|
+
AxiosError$1.ERR_BAD_REQUEST,
|
|
3226
|
+
config
|
|
3227
|
+
)
|
|
3228
|
+
);
|
|
3229
|
+
return;
|
|
3230
|
+
}
|
|
3015
3231
|
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
};
|
|
3232
|
+
// Send the request
|
|
3233
|
+
request.send(requestData || null);
|
|
3234
|
+
});
|
|
3235
|
+
};
|
|
3020
3236
|
|
|
3021
3237
|
const composeSignals = (signals, timeout) => {
|
|
3022
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
3238
|
+
const { length } = (signals = signals ? signals.filter(Boolean) : []);
|
|
3023
3239
|
|
|
3024
3240
|
if (timeout || length) {
|
|
3025
3241
|
let controller = new AbortController();
|
|
@@ -3031,21 +3247,29 @@ const composeSignals = (signals, timeout) => {
|
|
|
3031
3247
|
aborted = true;
|
|
3032
3248
|
unsubscribe();
|
|
3033
3249
|
const err = reason instanceof Error ? reason : this.reason;
|
|
3034
|
-
controller.abort(
|
|
3250
|
+
controller.abort(
|
|
3251
|
+
err instanceof AxiosError$1
|
|
3252
|
+
? err
|
|
3253
|
+
: new CanceledError$1(err instanceof Error ? err.message : err)
|
|
3254
|
+
);
|
|
3035
3255
|
}
|
|
3036
3256
|
};
|
|
3037
3257
|
|
|
3038
|
-
let timer =
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3258
|
+
let timer =
|
|
3259
|
+
timeout &&
|
|
3260
|
+
setTimeout(() => {
|
|
3261
|
+
timer = null;
|
|
3262
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
3263
|
+
}, timeout);
|
|
3042
3264
|
|
|
3043
3265
|
const unsubscribe = () => {
|
|
3044
3266
|
if (signals) {
|
|
3045
3267
|
timer && clearTimeout(timer);
|
|
3046
3268
|
timer = null;
|
|
3047
|
-
signals.forEach(signal => {
|
|
3048
|
-
signal.unsubscribe
|
|
3269
|
+
signals.forEach((signal) => {
|
|
3270
|
+
signal.unsubscribe
|
|
3271
|
+
? signal.unsubscribe(onabort)
|
|
3272
|
+
: signal.removeEventListener('abort', onabort);
|
|
3049
3273
|
});
|
|
3050
3274
|
signals = null;
|
|
3051
3275
|
}
|
|
@@ -3053,7 +3277,7 @@ const composeSignals = (signals, timeout) => {
|
|
|
3053
3277
|
|
|
3054
3278
|
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
3055
3279
|
|
|
3056
|
-
const {signal} = controller;
|
|
3280
|
+
const { signal } = controller;
|
|
3057
3281
|
|
|
3058
3282
|
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
3059
3283
|
|
|
@@ -3094,7 +3318,7 @@ const readStream = async function* (stream) {
|
|
|
3094
3318
|
const reader = stream.getReader();
|
|
3095
3319
|
try {
|
|
3096
3320
|
for (;;) {
|
|
3097
|
-
const {done, value} = await reader.read();
|
|
3321
|
+
const { done, value } = await reader.read();
|
|
3098
3322
|
if (done) {
|
|
3099
3323
|
break;
|
|
3100
3324
|
}
|
|
@@ -3117,64 +3341,69 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
3117
3341
|
}
|
|
3118
3342
|
};
|
|
3119
3343
|
|
|
3120
|
-
return new ReadableStream(
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3344
|
+
return new ReadableStream(
|
|
3345
|
+
{
|
|
3346
|
+
async pull(controller) {
|
|
3347
|
+
try {
|
|
3348
|
+
const { done, value } = await iterator.next();
|
|
3124
3349
|
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3350
|
+
if (done) {
|
|
3351
|
+
_onFinish();
|
|
3352
|
+
controller.close();
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
3130
3355
|
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3356
|
+
let len = value.byteLength;
|
|
3357
|
+
if (onProgress) {
|
|
3358
|
+
let loadedBytes = (bytes += len);
|
|
3359
|
+
onProgress(loadedBytes);
|
|
3360
|
+
}
|
|
3361
|
+
controller.enqueue(new Uint8Array(value));
|
|
3362
|
+
} catch (err) {
|
|
3363
|
+
_onFinish(err);
|
|
3364
|
+
throw err;
|
|
3135
3365
|
}
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
_onFinish(
|
|
3139
|
-
|
|
3140
|
-
}
|
|
3366
|
+
},
|
|
3367
|
+
cancel(reason) {
|
|
3368
|
+
_onFinish(reason);
|
|
3369
|
+
return iterator.return();
|
|
3370
|
+
},
|
|
3141
3371
|
},
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
return iterator.return();
|
|
3372
|
+
{
|
|
3373
|
+
highWaterMark: 2,
|
|
3145
3374
|
}
|
|
3146
|
-
|
|
3147
|
-
highWaterMark: 2
|
|
3148
|
-
})
|
|
3375
|
+
);
|
|
3149
3376
|
};
|
|
3150
3377
|
|
|
3151
3378
|
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3152
3379
|
|
|
3153
|
-
const {isFunction} = utils$1;
|
|
3380
|
+
const { isFunction } = utils$1;
|
|
3154
3381
|
|
|
3155
|
-
const globalFetchAPI = (({Request, Response}) => ({
|
|
3156
|
-
Request,
|
|
3382
|
+
const globalFetchAPI = (({ Request, Response }) => ({
|
|
3383
|
+
Request,
|
|
3384
|
+
Response,
|
|
3157
3385
|
}))(utils$1.global);
|
|
3158
3386
|
|
|
3159
|
-
const {
|
|
3160
|
-
ReadableStream: ReadableStream$1, TextEncoder
|
|
3161
|
-
} = utils$1.global;
|
|
3162
|
-
|
|
3387
|
+
const { ReadableStream: ReadableStream$1, TextEncoder } = utils$1.global;
|
|
3163
3388
|
|
|
3164
3389
|
const test = (fn, ...args) => {
|
|
3165
3390
|
try {
|
|
3166
3391
|
return !!fn(...args);
|
|
3167
3392
|
} catch (e) {
|
|
3168
|
-
return false
|
|
3393
|
+
return false;
|
|
3169
3394
|
}
|
|
3170
3395
|
};
|
|
3171
3396
|
|
|
3172
3397
|
const factory = (env) => {
|
|
3173
|
-
env = utils$1.merge.call(
|
|
3174
|
-
|
|
3175
|
-
|
|
3398
|
+
env = utils$1.merge.call(
|
|
3399
|
+
{
|
|
3400
|
+
skipUndefined: true,
|
|
3401
|
+
},
|
|
3402
|
+
globalFetchAPI,
|
|
3403
|
+
env
|
|
3404
|
+
);
|
|
3176
3405
|
|
|
3177
|
-
const {fetch: envFetch, Request, Response} = env;
|
|
3406
|
+
const { fetch: envFetch, Request, Response } = env;
|
|
3178
3407
|
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
3179
3408
|
const isRequestSupported = isFunction(Request);
|
|
3180
3409
|
const isResponseSupported = isFunction(Response);
|
|
@@ -3185,46 +3414,65 @@ const factory = (env) => {
|
|
|
3185
3414
|
|
|
3186
3415
|
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
3187
3416
|
|
|
3188
|
-
const encodeText =
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3417
|
+
const encodeText =
|
|
3418
|
+
isFetchSupported &&
|
|
3419
|
+
(typeof TextEncoder === 'function'
|
|
3420
|
+
? (
|
|
3421
|
+
(encoder) => (str) =>
|
|
3422
|
+
encoder.encode(str)
|
|
3423
|
+
)(new TextEncoder())
|
|
3424
|
+
: async (str) => new Uint8Array(await new Request(str).arrayBuffer()));
|
|
3192
3425
|
|
|
3193
|
-
const supportsRequestStream =
|
|
3194
|
-
|
|
3426
|
+
const supportsRequestStream =
|
|
3427
|
+
isRequestSupported &&
|
|
3428
|
+
isReadableStreamSupported &&
|
|
3429
|
+
test(() => {
|
|
3430
|
+
let duplexAccessed = false;
|
|
3195
3431
|
|
|
3196
|
-
|
|
3197
|
-
body: new ReadableStream$1(),
|
|
3198
|
-
method: 'POST',
|
|
3199
|
-
get duplex() {
|
|
3200
|
-
duplexAccessed = true;
|
|
3201
|
-
return 'half';
|
|
3202
|
-
},
|
|
3203
|
-
}).headers.has('Content-Type');
|
|
3432
|
+
const body = new ReadableStream$1();
|
|
3204
3433
|
|
|
3205
|
-
|
|
3206
|
-
|
|
3434
|
+
const hasContentType = new Request(platform.origin, {
|
|
3435
|
+
body,
|
|
3436
|
+
method: 'POST',
|
|
3437
|
+
get duplex() {
|
|
3438
|
+
duplexAccessed = true;
|
|
3439
|
+
return 'half';
|
|
3440
|
+
},
|
|
3441
|
+
}).headers.has('Content-Type');
|
|
3442
|
+
|
|
3443
|
+
body.cancel();
|
|
3207
3444
|
|
|
3208
|
-
|
|
3445
|
+
return duplexAccessed && !hasContentType;
|
|
3446
|
+
});
|
|
3447
|
+
|
|
3448
|
+
const supportsResponseStream =
|
|
3449
|
+
isResponseSupported &&
|
|
3450
|
+
isReadableStreamSupported &&
|
|
3209
3451
|
test(() => utils$1.isReadableStream(new Response('').body));
|
|
3210
3452
|
|
|
3211
3453
|
const resolvers = {
|
|
3212
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
3454
|
+
stream: supportsResponseStream && ((res) => res.body),
|
|
3213
3455
|
};
|
|
3214
3456
|
|
|
3215
|
-
isFetchSupported &&
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3457
|
+
isFetchSupported &&
|
|
3458
|
+
(() => {
|
|
3459
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach((type) => {
|
|
3460
|
+
!resolvers[type] &&
|
|
3461
|
+
(resolvers[type] = (res, config) => {
|
|
3462
|
+
let method = res && res[type];
|
|
3219
3463
|
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3464
|
+
if (method) {
|
|
3465
|
+
return method.call(res);
|
|
3466
|
+
}
|
|
3223
3467
|
|
|
3224
|
-
|
|
3468
|
+
throw new AxiosError$1(
|
|
3469
|
+
`Response type '${type}' is not supported`,
|
|
3470
|
+
AxiosError$1.ERR_NOT_SUPPORT,
|
|
3471
|
+
config
|
|
3472
|
+
);
|
|
3473
|
+
});
|
|
3225
3474
|
});
|
|
3226
|
-
});
|
|
3227
|
-
})());
|
|
3475
|
+
})();
|
|
3228
3476
|
|
|
3229
3477
|
const getBodyLength = async (body) => {
|
|
3230
3478
|
if (body == null) {
|
|
@@ -3275,32 +3523,41 @@ const factory = (env) => {
|
|
|
3275
3523
|
responseType,
|
|
3276
3524
|
headers,
|
|
3277
3525
|
withCredentials = 'same-origin',
|
|
3278
|
-
fetchOptions
|
|
3526
|
+
fetchOptions,
|
|
3279
3527
|
} = resolveConfig(config);
|
|
3280
3528
|
|
|
3281
3529
|
let _fetch = envFetch || fetch;
|
|
3282
3530
|
|
|
3283
3531
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3284
3532
|
|
|
3285
|
-
let composedSignal = composeSignals(
|
|
3533
|
+
let composedSignal = composeSignals(
|
|
3534
|
+
[signal, cancelToken && cancelToken.toAbortSignal()],
|
|
3535
|
+
timeout
|
|
3536
|
+
);
|
|
3286
3537
|
|
|
3287
3538
|
let request = null;
|
|
3288
3539
|
|
|
3289
|
-
const unsubscribe =
|
|
3290
|
-
composedSignal
|
|
3291
|
-
|
|
3540
|
+
const unsubscribe =
|
|
3541
|
+
composedSignal &&
|
|
3542
|
+
composedSignal.unsubscribe &&
|
|
3543
|
+
(() => {
|
|
3544
|
+
composedSignal.unsubscribe();
|
|
3545
|
+
});
|
|
3292
3546
|
|
|
3293
3547
|
let requestContentLength;
|
|
3294
3548
|
|
|
3295
3549
|
try {
|
|
3296
3550
|
if (
|
|
3297
|
-
onUploadProgress &&
|
|
3551
|
+
onUploadProgress &&
|
|
3552
|
+
supportsRequestStream &&
|
|
3553
|
+
method !== 'get' &&
|
|
3554
|
+
method !== 'head' &&
|
|
3298
3555
|
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
3299
3556
|
) {
|
|
3300
3557
|
let _request = new Request(url, {
|
|
3301
3558
|
method: 'POST',
|
|
3302
3559
|
body: data,
|
|
3303
|
-
duplex:
|
|
3560
|
+
duplex: 'half',
|
|
3304
3561
|
});
|
|
3305
3562
|
|
|
3306
3563
|
let contentTypeHeader;
|
|
@@ -3325,7 +3582,7 @@ const factory = (env) => {
|
|
|
3325
3582
|
|
|
3326
3583
|
// Cloudflare Workers throws when credentials are defined
|
|
3327
3584
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3328
|
-
const isCredentialsSupported = isRequestSupported &&
|
|
3585
|
+
const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
3329
3586
|
|
|
3330
3587
|
const resolvedOptions = {
|
|
3331
3588
|
...fetchOptions,
|
|
@@ -3333,29 +3590,35 @@ const factory = (env) => {
|
|
|
3333
3590
|
method: method.toUpperCase(),
|
|
3334
3591
|
headers: headers.normalize().toJSON(),
|
|
3335
3592
|
body: data,
|
|
3336
|
-
duplex:
|
|
3337
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
3593
|
+
duplex: 'half',
|
|
3594
|
+
credentials: isCredentialsSupported ? withCredentials : undefined,
|
|
3338
3595
|
};
|
|
3339
3596
|
|
|
3340
3597
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3341
3598
|
|
|
3342
|
-
let response = await (isRequestSupported
|
|
3599
|
+
let response = await (isRequestSupported
|
|
3600
|
+
? _fetch(request, fetchOptions)
|
|
3601
|
+
: _fetch(url, resolvedOptions));
|
|
3343
3602
|
|
|
3344
|
-
const isStreamResponse =
|
|
3603
|
+
const isStreamResponse =
|
|
3604
|
+
supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3345
3605
|
|
|
3346
3606
|
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
3347
3607
|
const options = {};
|
|
3348
3608
|
|
|
3349
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
3609
|
+
['status', 'statusText', 'headers'].forEach((prop) => {
|
|
3350
3610
|
options[prop] = response[prop];
|
|
3351
3611
|
});
|
|
3352
3612
|
|
|
3353
3613
|
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3354
3614
|
|
|
3355
|
-
const [onProgress, flush] =
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3615
|
+
const [onProgress, flush] =
|
|
3616
|
+
(onDownloadProgress &&
|
|
3617
|
+
progressEventDecorator(
|
|
3618
|
+
responseContentLength,
|
|
3619
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
3620
|
+
)) ||
|
|
3621
|
+
[];
|
|
3359
3622
|
|
|
3360
3623
|
response = new Response(
|
|
3361
3624
|
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
@@ -3368,7 +3631,10 @@ const factory = (env) => {
|
|
|
3368
3631
|
|
|
3369
3632
|
responseType = responseType || 'text';
|
|
3370
3633
|
|
|
3371
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
3634
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](
|
|
3635
|
+
response,
|
|
3636
|
+
config
|
|
3637
|
+
);
|
|
3372
3638
|
|
|
3373
3639
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3374
3640
|
|
|
@@ -3379,43 +3645,50 @@ const factory = (env) => {
|
|
|
3379
3645
|
status: response.status,
|
|
3380
3646
|
statusText: response.statusText,
|
|
3381
3647
|
config,
|
|
3382
|
-
request
|
|
3648
|
+
request,
|
|
3383
3649
|
});
|
|
3384
|
-
})
|
|
3650
|
+
});
|
|
3385
3651
|
} catch (err) {
|
|
3386
3652
|
unsubscribe && unsubscribe();
|
|
3387
3653
|
|
|
3388
3654
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3389
3655
|
throw Object.assign(
|
|
3390
|
-
new AxiosError$1(
|
|
3656
|
+
new AxiosError$1(
|
|
3657
|
+
'Network Error',
|
|
3658
|
+
AxiosError$1.ERR_NETWORK,
|
|
3659
|
+
config,
|
|
3660
|
+
request,
|
|
3661
|
+
err && err.response
|
|
3662
|
+
),
|
|
3391
3663
|
{
|
|
3392
|
-
cause: err.cause || err
|
|
3664
|
+
cause: err.cause || err,
|
|
3393
3665
|
}
|
|
3394
|
-
)
|
|
3666
|
+
);
|
|
3395
3667
|
}
|
|
3396
3668
|
|
|
3397
3669
|
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
3398
3670
|
}
|
|
3399
|
-
}
|
|
3671
|
+
};
|
|
3400
3672
|
};
|
|
3401
3673
|
|
|
3402
3674
|
const seedCache = new Map();
|
|
3403
3675
|
|
|
3404
3676
|
const getFetch = (config) => {
|
|
3405
3677
|
let env = (config && config.env) || {};
|
|
3406
|
-
const {fetch, Request, Response} = env;
|
|
3407
|
-
const seeds = [
|
|
3408
|
-
Request, Response, fetch
|
|
3409
|
-
];
|
|
3678
|
+
const { fetch, Request, Response } = env;
|
|
3679
|
+
const seeds = [Request, Response, fetch];
|
|
3410
3680
|
|
|
3411
|
-
let len = seeds.length,
|
|
3412
|
-
|
|
3681
|
+
let len = seeds.length,
|
|
3682
|
+
i = len,
|
|
3683
|
+
seed,
|
|
3684
|
+
target,
|
|
3685
|
+
map = seedCache;
|
|
3413
3686
|
|
|
3414
3687
|
while (i--) {
|
|
3415
3688
|
seed = seeds[i];
|
|
3416
3689
|
target = map.get(seed);
|
|
3417
3690
|
|
|
3418
|
-
target === undefined && map.set(seed, target =
|
|
3691
|
+
target === undefined && map.set(seed, (target = i ? new Map() : factory(env)));
|
|
3419
3692
|
|
|
3420
3693
|
map = target;
|
|
3421
3694
|
}
|
|
@@ -3431,7 +3704,7 @@ getFetch();
|
|
|
3431
3704
|
* - `http` for Node.js
|
|
3432
3705
|
* - `xhr` for browsers
|
|
3433
3706
|
* - `fetch` for fetch API-based requests
|
|
3434
|
-
*
|
|
3707
|
+
*
|
|
3435
3708
|
* @type {Object<string, Function|Object>}
|
|
3436
3709
|
*/
|
|
3437
3710
|
const knownAdapters = {
|
|
@@ -3439,7 +3712,7 @@ const knownAdapters = {
|
|
|
3439
3712
|
xhr: xhrAdapter,
|
|
3440
3713
|
fetch: {
|
|
3441
3714
|
get: getFetch,
|
|
3442
|
-
}
|
|
3715
|
+
},
|
|
3443
3716
|
};
|
|
3444
3717
|
|
|
3445
3718
|
// Assign adapter names for easier debugging and identification
|
|
@@ -3456,7 +3729,7 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
3456
3729
|
|
|
3457
3730
|
/**
|
|
3458
3731
|
* Render a rejection reason string for unknown or unsupported adapters
|
|
3459
|
-
*
|
|
3732
|
+
*
|
|
3460
3733
|
* @param {string} reason
|
|
3461
3734
|
* @returns {string}
|
|
3462
3735
|
*/
|
|
@@ -3464,17 +3737,18 @@ const renderReason = (reason) => `- ${reason}`;
|
|
|
3464
3737
|
|
|
3465
3738
|
/**
|
|
3466
3739
|
* Check if the adapter is resolved (function, null, or false)
|
|
3467
|
-
*
|
|
3740
|
+
*
|
|
3468
3741
|
* @param {Function|null|false} adapter
|
|
3469
3742
|
* @returns {boolean}
|
|
3470
3743
|
*/
|
|
3471
|
-
const isResolvedHandle = (adapter) =>
|
|
3744
|
+
const isResolvedHandle = (adapter) =>
|
|
3745
|
+
utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3472
3746
|
|
|
3473
3747
|
/**
|
|
3474
3748
|
* Get the first suitable adapter from the provided list.
|
|
3475
3749
|
* Tries each adapter in order until a supported one is found.
|
|
3476
3750
|
* Throws an AxiosError if no adapter is suitable.
|
|
3477
|
-
*
|
|
3751
|
+
*
|
|
3478
3752
|
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
3479
3753
|
* @param {Object} config - Axios request configuration
|
|
3480
3754
|
* @throws {AxiosError} If no suitable adapter is available
|
|
@@ -3511,14 +3785,17 @@ function getAdapter$1(adapters, config) {
|
|
|
3511
3785
|
}
|
|
3512
3786
|
|
|
3513
3787
|
if (!adapter) {
|
|
3514
|
-
const reasons = Object.entries(rejectedReasons)
|
|
3515
|
-
|
|
3788
|
+
const reasons = Object.entries(rejectedReasons).map(
|
|
3789
|
+
([id, state]) =>
|
|
3790
|
+
`adapter ${id} ` +
|
|
3516
3791
|
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
3517
|
-
|
|
3792
|
+
);
|
|
3518
3793
|
|
|
3519
|
-
let s = length
|
|
3520
|
-
|
|
3521
|
-
|
|
3794
|
+
let s = length
|
|
3795
|
+
? reasons.length > 1
|
|
3796
|
+
? 'since :\n' + reasons.map(renderReason).join('\n')
|
|
3797
|
+
: ' ' + renderReason(reasons[0])
|
|
3798
|
+
: 'as no adapter specified';
|
|
3522
3799
|
|
|
3523
3800
|
throw new AxiosError$1(
|
|
3524
3801
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
@@ -3543,7 +3820,7 @@ var adapters = {
|
|
|
3543
3820
|
* Exposes all known adapters
|
|
3544
3821
|
* @type {Object<string, Function|Object>}
|
|
3545
3822
|
*/
|
|
3546
|
-
adapters: knownAdapters
|
|
3823
|
+
adapters: knownAdapters,
|
|
3547
3824
|
};
|
|
3548
3825
|
|
|
3549
3826
|
/**
|
|
@@ -3576,10 +3853,7 @@ function dispatchRequest(config) {
|
|
|
3576
3853
|
config.headers = AxiosHeaders$1.from(config.headers);
|
|
3577
3854
|
|
|
3578
3855
|
// Transform request data
|
|
3579
|
-
config.data = transformData.call(
|
|
3580
|
-
config,
|
|
3581
|
-
config.transformRequest
|
|
3582
|
-
);
|
|
3856
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
3583
3857
|
|
|
3584
3858
|
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
3585
3859
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
@@ -3587,39 +3861,38 @@ function dispatchRequest(config) {
|
|
|
3587
3861
|
|
|
3588
3862
|
const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
|
|
3589
3863
|
|
|
3590
|
-
return adapter(config).then(
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
// Transform response data
|
|
3594
|
-
response.data = transformData.call(
|
|
3595
|
-
config,
|
|
3596
|
-
config.transformResponse,
|
|
3597
|
-
response
|
|
3598
|
-
);
|
|
3599
|
-
|
|
3600
|
-
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3601
|
-
|
|
3602
|
-
return response;
|
|
3603
|
-
}, function onAdapterRejection(reason) {
|
|
3604
|
-
if (!isCancel$1(reason)) {
|
|
3864
|
+
return adapter(config).then(
|
|
3865
|
+
function onAdapterResolution(response) {
|
|
3605
3866
|
throwIfCancellationRequested(config);
|
|
3606
3867
|
|
|
3607
3868
|
// Transform response data
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3869
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
3870
|
+
|
|
3871
|
+
response.headers = AxiosHeaders$1.from(response.headers);
|
|
3872
|
+
|
|
3873
|
+
return response;
|
|
3874
|
+
},
|
|
3875
|
+
function onAdapterRejection(reason) {
|
|
3876
|
+
if (!isCancel$1(reason)) {
|
|
3877
|
+
throwIfCancellationRequested(config);
|
|
3878
|
+
|
|
3879
|
+
// Transform response data
|
|
3880
|
+
if (reason && reason.response) {
|
|
3881
|
+
reason.response.data = transformData.call(
|
|
3882
|
+
config,
|
|
3883
|
+
config.transformResponse,
|
|
3884
|
+
reason.response
|
|
3885
|
+
);
|
|
3886
|
+
reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
|
|
3887
|
+
}
|
|
3615
3888
|
}
|
|
3616
|
-
}
|
|
3617
3889
|
|
|
3618
|
-
|
|
3619
|
-
|
|
3890
|
+
return Promise.reject(reason);
|
|
3891
|
+
}
|
|
3892
|
+
);
|
|
3620
3893
|
}
|
|
3621
3894
|
|
|
3622
|
-
const VERSION$1 = "1.
|
|
3895
|
+
const VERSION$1 = "1.15.0";
|
|
3623
3896
|
|
|
3624
3897
|
const validators$1 = {};
|
|
3625
3898
|
|
|
@@ -3643,7 +3916,15 @@ const deprecatedWarnings = {};
|
|
|
3643
3916
|
*/
|
|
3644
3917
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
3645
3918
|
function formatMessage(opt, desc) {
|
|
3646
|
-
return
|
|
3919
|
+
return (
|
|
3920
|
+
'[Axios v' +
|
|
3921
|
+
VERSION$1 +
|
|
3922
|
+
"] Transitional option '" +
|
|
3923
|
+
opt +
|
|
3924
|
+
"'" +
|
|
3925
|
+
desc +
|
|
3926
|
+
(message ? '. ' + message : '')
|
|
3927
|
+
);
|
|
3647
3928
|
}
|
|
3648
3929
|
|
|
3649
3930
|
// eslint-disable-next-line func-names
|
|
@@ -3675,7 +3956,7 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
3675
3956
|
// eslint-disable-next-line no-console
|
|
3676
3957
|
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
3677
3958
|
return true;
|
|
3678
|
-
}
|
|
3959
|
+
};
|
|
3679
3960
|
};
|
|
3680
3961
|
|
|
3681
3962
|
/**
|
|
@@ -3701,7 +3982,10 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
3701
3982
|
const value = options[opt];
|
|
3702
3983
|
const result = value === undefined || validator(value, opt, options);
|
|
3703
3984
|
if (result !== true) {
|
|
3704
|
-
throw new AxiosError$1(
|
|
3985
|
+
throw new AxiosError$1(
|
|
3986
|
+
'option ' + opt + ' must be ' + result,
|
|
3987
|
+
AxiosError$1.ERR_BAD_OPTION_VALUE
|
|
3988
|
+
);
|
|
3705
3989
|
}
|
|
3706
3990
|
continue;
|
|
3707
3991
|
}
|
|
@@ -3713,7 +3997,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
3713
3997
|
|
|
3714
3998
|
var validator = {
|
|
3715
3999
|
assertOptions,
|
|
3716
|
-
validators: validators$1
|
|
4000
|
+
validators: validators$1,
|
|
3717
4001
|
};
|
|
3718
4002
|
|
|
3719
4003
|
const validators = validator.validators;
|
|
@@ -3730,7 +4014,7 @@ let Axios$1 = class Axios {
|
|
|
3730
4014
|
this.defaults = instanceConfig || {};
|
|
3731
4015
|
this.interceptors = {
|
|
3732
4016
|
request: new InterceptorManager(),
|
|
3733
|
-
response: new InterceptorManager()
|
|
4017
|
+
response: new InterceptorManager(),
|
|
3734
4018
|
};
|
|
3735
4019
|
}
|
|
3736
4020
|
|
|
@@ -3752,13 +4036,29 @@ let Axios$1 = class Axios {
|
|
|
3752
4036
|
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
3753
4037
|
|
|
3754
4038
|
// slice off the Error: ... line
|
|
3755
|
-
const stack =
|
|
4039
|
+
const stack = (() => {
|
|
4040
|
+
if (!dummy.stack) {
|
|
4041
|
+
return '';
|
|
4042
|
+
}
|
|
4043
|
+
|
|
4044
|
+
const firstNewlineIndex = dummy.stack.indexOf('\n');
|
|
4045
|
+
|
|
4046
|
+
return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
|
|
4047
|
+
})();
|
|
3756
4048
|
try {
|
|
3757
4049
|
if (!err.stack) {
|
|
3758
4050
|
err.stack = stack;
|
|
3759
4051
|
// match without the 2 top stack lines
|
|
3760
|
-
} else if (stack
|
|
3761
|
-
|
|
4052
|
+
} else if (stack) {
|
|
4053
|
+
const firstNewlineIndex = stack.indexOf('\n');
|
|
4054
|
+
const secondNewlineIndex =
|
|
4055
|
+
firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
|
|
4056
|
+
const stackWithoutTwoTopLines =
|
|
4057
|
+
secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
|
|
4058
|
+
|
|
4059
|
+
if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
|
|
4060
|
+
err.stack += '\n' + stack;
|
|
4061
|
+
}
|
|
3762
4062
|
}
|
|
3763
4063
|
} catch (e) {
|
|
3764
4064
|
// ignore the case where "stack" is an un-writable property
|
|
@@ -3781,27 +4081,35 @@ let Axios$1 = class Axios {
|
|
|
3781
4081
|
|
|
3782
4082
|
config = mergeConfig$1(this.defaults, config);
|
|
3783
4083
|
|
|
3784
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
4084
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
3785
4085
|
|
|
3786
4086
|
if (transitional !== undefined) {
|
|
3787
|
-
validator.assertOptions(
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
4087
|
+
validator.assertOptions(
|
|
4088
|
+
transitional,
|
|
4089
|
+
{
|
|
4090
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
4091
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
4092
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
4093
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
|
|
4094
|
+
},
|
|
4095
|
+
false
|
|
4096
|
+
);
|
|
3793
4097
|
}
|
|
3794
4098
|
|
|
3795
4099
|
if (paramsSerializer != null) {
|
|
3796
4100
|
if (utils$1.isFunction(paramsSerializer)) {
|
|
3797
4101
|
config.paramsSerializer = {
|
|
3798
|
-
serialize: paramsSerializer
|
|
4102
|
+
serialize: paramsSerializer,
|
|
3799
4103
|
};
|
|
3800
4104
|
} else {
|
|
3801
|
-
validator.assertOptions(
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
4105
|
+
validator.assertOptions(
|
|
4106
|
+
paramsSerializer,
|
|
4107
|
+
{
|
|
4108
|
+
encode: validators.function,
|
|
4109
|
+
serialize: validators.function,
|
|
4110
|
+
},
|
|
4111
|
+
true
|
|
4112
|
+
);
|
|
3805
4113
|
}
|
|
3806
4114
|
}
|
|
3807
4115
|
|
|
@@ -3812,26 +4120,25 @@ let Axios$1 = class Axios {
|
|
|
3812
4120
|
config.allowAbsoluteUrls = true;
|
|
3813
4121
|
}
|
|
3814
4122
|
|
|
3815
|
-
validator.assertOptions(
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
4123
|
+
validator.assertOptions(
|
|
4124
|
+
config,
|
|
4125
|
+
{
|
|
4126
|
+
baseUrl: validators.spelling('baseURL'),
|
|
4127
|
+
withXsrfToken: validators.spelling('withXSRFToken'),
|
|
4128
|
+
},
|
|
4129
|
+
true
|
|
4130
|
+
);
|
|
3819
4131
|
|
|
3820
4132
|
// Set config.method
|
|
3821
4133
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
3822
4134
|
|
|
3823
4135
|
// Flatten headers
|
|
3824
|
-
let contextHeaders = headers && utils$1.merge(
|
|
3825
|
-
headers.common,
|
|
3826
|
-
headers[config.method]
|
|
3827
|
-
);
|
|
4136
|
+
let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
|
|
3828
4137
|
|
|
3829
|
-
headers &&
|
|
3830
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
3831
|
-
(method) => {
|
|
4138
|
+
headers &&
|
|
4139
|
+
utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], (method) => {
|
|
3832
4140
|
delete headers[method];
|
|
3833
|
-
}
|
|
3834
|
-
);
|
|
4141
|
+
});
|
|
3835
4142
|
|
|
3836
4143
|
config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
|
|
3837
4144
|
|
|
@@ -3846,7 +4153,8 @@ let Axios$1 = class Axios {
|
|
|
3846
4153
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3847
4154
|
|
|
3848
4155
|
const transitional = config.transitional || transitionalDefaults;
|
|
3849
|
-
const legacyInterceptorReqResOrdering =
|
|
4156
|
+
const legacyInterceptorReqResOrdering =
|
|
4157
|
+
transitional && transitional.legacyInterceptorReqResOrdering;
|
|
3850
4158
|
|
|
3851
4159
|
if (legacyInterceptorReqResOrdering) {
|
|
3852
4160
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
@@ -3920,28 +4228,32 @@ let Axios$1 = class Axios {
|
|
|
3920
4228
|
// Provide aliases for supported request methods
|
|
3921
4229
|
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
3922
4230
|
/*eslint func-names:0*/
|
|
3923
|
-
Axios$1.prototype[method] = function(url, config) {
|
|
3924
|
-
return this.request(
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
4231
|
+
Axios$1.prototype[method] = function (url, config) {
|
|
4232
|
+
return this.request(
|
|
4233
|
+
mergeConfig$1(config || {}, {
|
|
4234
|
+
method,
|
|
4235
|
+
url,
|
|
4236
|
+
data: (config || {}).data,
|
|
4237
|
+
})
|
|
4238
|
+
);
|
|
3929
4239
|
};
|
|
3930
4240
|
});
|
|
3931
4241
|
|
|
3932
4242
|
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
3933
|
-
/*eslint func-names:0*/
|
|
3934
|
-
|
|
3935
4243
|
function generateHTTPMethod(isForm) {
|
|
3936
4244
|
return function httpMethod(url, data, config) {
|
|
3937
|
-
return this.request(
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
4245
|
+
return this.request(
|
|
4246
|
+
mergeConfig$1(config || {}, {
|
|
4247
|
+
method,
|
|
4248
|
+
headers: isForm
|
|
4249
|
+
? {
|
|
4250
|
+
'Content-Type': 'multipart/form-data',
|
|
4251
|
+
}
|
|
4252
|
+
: {},
|
|
4253
|
+
url,
|
|
4254
|
+
data,
|
|
4255
|
+
})
|
|
4256
|
+
);
|
|
3945
4257
|
};
|
|
3946
4258
|
}
|
|
3947
4259
|
|
|
@@ -3972,7 +4284,7 @@ let CancelToken$1 = class CancelToken {
|
|
|
3972
4284
|
const token = this;
|
|
3973
4285
|
|
|
3974
4286
|
// eslint-disable-next-line func-names
|
|
3975
|
-
this.promise.then(cancel => {
|
|
4287
|
+
this.promise.then((cancel) => {
|
|
3976
4288
|
if (!token._listeners) return;
|
|
3977
4289
|
|
|
3978
4290
|
let i = token._listeners.length;
|
|
@@ -3984,10 +4296,10 @@ let CancelToken$1 = class CancelToken {
|
|
|
3984
4296
|
});
|
|
3985
4297
|
|
|
3986
4298
|
// eslint-disable-next-line func-names
|
|
3987
|
-
this.promise.then = onfulfilled => {
|
|
4299
|
+
this.promise.then = (onfulfilled) => {
|
|
3988
4300
|
let _resolve;
|
|
3989
4301
|
// eslint-disable-next-line func-names
|
|
3990
|
-
const promise = new Promise(resolve => {
|
|
4302
|
+
const promise = new Promise((resolve) => {
|
|
3991
4303
|
token.subscribe(resolve);
|
|
3992
4304
|
_resolve = resolve;
|
|
3993
4305
|
}).then(onfulfilled);
|
|
@@ -4075,7 +4387,7 @@ let CancelToken$1 = class CancelToken {
|
|
|
4075
4387
|
});
|
|
4076
4388
|
return {
|
|
4077
4389
|
token,
|
|
4078
|
-
cancel
|
|
4390
|
+
cancel,
|
|
4079
4391
|
};
|
|
4080
4392
|
}
|
|
4081
4393
|
};
|
|
@@ -4115,7 +4427,7 @@ function spread$1(callback) {
|
|
|
4115
4427
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
4116
4428
|
*/
|
|
4117
4429
|
function isAxiosError$1(payload) {
|
|
4118
|
-
return utils$1.isObject(payload) &&
|
|
4430
|
+
return utils$1.isObject(payload) && payload.isAxiosError === true;
|
|
4119
4431
|
}
|
|
4120
4432
|
|
|
4121
4433
|
const HttpStatusCode$1 = {
|
|
@@ -4206,10 +4518,10 @@ function createInstance(defaultConfig) {
|
|
|
4206
4518
|
const instance = bind(Axios$1.prototype.request, context);
|
|
4207
4519
|
|
|
4208
4520
|
// Copy axios.prototype to instance
|
|
4209
|
-
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
|
4521
|
+
utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
|
|
4210
4522
|
|
|
4211
4523
|
// Copy context to instance
|
|
4212
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
4524
|
+
utils$1.extend(instance, context, null, { allOwnKeys: true });
|
|
4213
4525
|
|
|
4214
4526
|
// Factory for creating new instances
|
|
4215
4527
|
instance.create = function create(instanceConfig) {
|
|
@@ -4253,7 +4565,7 @@ axios.mergeConfig = mergeConfig$1;
|
|
|
4253
4565
|
|
|
4254
4566
|
axios.AxiosHeaders = AxiosHeaders$1;
|
|
4255
4567
|
|
|
4256
|
-
axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4568
|
+
axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4257
4569
|
|
|
4258
4570
|
axios.getAdapter = adapters.getAdapter;
|
|
4259
4571
|
|
|
@@ -4280,7 +4592,7 @@ const {
|
|
|
4280
4592
|
HttpStatusCode,
|
|
4281
4593
|
formToJSON,
|
|
4282
4594
|
getAdapter,
|
|
4283
|
-
mergeConfig
|
|
4595
|
+
mergeConfig,
|
|
4284
4596
|
} = axios;
|
|
4285
4597
|
|
|
4286
4598
|
/******************************************************************************
|
|
@@ -7369,9 +7681,9 @@ class MayachainProtocol {
|
|
|
7369
7681
|
}
|
|
7370
7682
|
|
|
7371
7683
|
/**
|
|
7372
|
-
* The base URL for the Midgard API
|
|
7684
|
+
* The base URL for the Midgard API endpoint.
|
|
7373
7685
|
*/
|
|
7374
|
-
const
|
|
7686
|
+
const MIDGARD_API_URL = 'https://gateway.liquify.com/chain/thorchain_midgard/';
|
|
7375
7687
|
|
|
7376
7688
|
/******************************************************************************
|
|
7377
7689
|
Copyright (c) Microsoft Corporation.
|
|
@@ -9846,7 +10158,7 @@ class Configuration {
|
|
|
9846
10158
|
/**
|
|
9847
10159
|
* The base URL for the Midgard API.
|
|
9848
10160
|
*/
|
|
9849
|
-
const baseUrl =
|
|
10161
|
+
const baseUrl = MIDGARD_API_URL;
|
|
9850
10162
|
/**
|
|
9851
10163
|
* Default configuration for the Midgard API client.
|
|
9852
10164
|
*/
|
|
@@ -10200,15 +10512,15 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
10200
10512
|
const defaultMidgardConfig = {
|
|
10201
10513
|
mainnet: {
|
|
10202
10514
|
apiRetries: 3,
|
|
10203
|
-
midgardBaseUrls: ['https://
|
|
10515
|
+
midgardBaseUrls: ['https://gateway.liquify.com/chain/thorchain_midgard'],
|
|
10204
10516
|
},
|
|
10205
10517
|
stagenet: {
|
|
10206
10518
|
apiRetries: 3,
|
|
10207
|
-
midgardBaseUrls: [
|
|
10519
|
+
midgardBaseUrls: [],
|
|
10208
10520
|
},
|
|
10209
10521
|
testnet: {
|
|
10210
10522
|
apiRetries: 3,
|
|
10211
|
-
midgardBaseUrls: ['
|
|
10523
|
+
midgardBaseUrls: ['deprecated'],
|
|
10212
10524
|
},
|
|
10213
10525
|
};
|
|
10214
10526
|
class Midgard {
|
|
@@ -10434,7 +10746,7 @@ class MidgardQuery {
|
|
|
10434
10746
|
getFallbackDecimals(asset) {
|
|
10435
10747
|
const assetString = xchainUtil.assetToString(asset);
|
|
10436
10748
|
// Map of assets to their actual decimal places from THORChain pools
|
|
10437
|
-
// Data sourced from https://
|
|
10749
|
+
// Data sourced from https://gateway.liquify.com/chain/thorchain_api/thorchain/pools
|
|
10438
10750
|
const fallbackDecimalMap = {
|
|
10439
10751
|
// Bitcoin and forks
|
|
10440
10752
|
'BTC.BTC': 8,
|