@xchainjs/xchain-aggregator 2.0.33 → 2.0.35
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 +462 -329
- package/lib/index.js +462 -329
- package/package.json +16 -16
package/lib/index.esm.js
CHANGED
|
@@ -315,6 +315,13 @@ class ChainflipProtocol {
|
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Create a bound version of a function with a specified `this` context
|
|
320
|
+
*
|
|
321
|
+
* @param {Function} fn - The function to bind
|
|
322
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
323
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
324
|
+
*/
|
|
318
325
|
function bind(fn, thisArg) {
|
|
319
326
|
return function wrap() {
|
|
320
327
|
return fn.apply(thisArg, arguments);
|
|
@@ -323,30 +330,30 @@ function bind(fn, thisArg) {
|
|
|
323
330
|
|
|
324
331
|
// utils is a library of generic helper functions non-specific to axios
|
|
325
332
|
|
|
326
|
-
const {toString} = Object.prototype;
|
|
327
|
-
const {getPrototypeOf} = Object;
|
|
328
|
-
const {iterator, toStringTag} = Symbol;
|
|
333
|
+
const { toString } = Object.prototype;
|
|
334
|
+
const { getPrototypeOf } = Object;
|
|
335
|
+
const { iterator, toStringTag } = Symbol;
|
|
329
336
|
|
|
330
|
-
const kindOf = (cache => thing => {
|
|
331
|
-
|
|
332
|
-
|
|
337
|
+
const kindOf = ((cache) => (thing) => {
|
|
338
|
+
const str = toString.call(thing);
|
|
339
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
333
340
|
})(Object.create(null));
|
|
334
341
|
|
|
335
342
|
const kindOfTest = (type) => {
|
|
336
343
|
type = type.toLowerCase();
|
|
337
|
-
return (thing) => kindOf(thing) === type
|
|
344
|
+
return (thing) => kindOf(thing) === type;
|
|
338
345
|
};
|
|
339
346
|
|
|
340
|
-
const typeOfTest = type => thing => typeof thing === type;
|
|
347
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
341
348
|
|
|
342
349
|
/**
|
|
343
|
-
* Determine if a value is
|
|
350
|
+
* Determine if a value is a non-null object
|
|
344
351
|
*
|
|
345
352
|
* @param {Object} val The value to test
|
|
346
353
|
*
|
|
347
354
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
348
355
|
*/
|
|
349
|
-
const {isArray} = Array;
|
|
356
|
+
const { isArray } = Array;
|
|
350
357
|
|
|
351
358
|
/**
|
|
352
359
|
* Determine if a value is undefined
|
|
@@ -355,7 +362,7 @@ const {isArray} = Array;
|
|
|
355
362
|
*
|
|
356
363
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
357
364
|
*/
|
|
358
|
-
const isUndefined = typeOfTest(
|
|
365
|
+
const isUndefined = typeOfTest("undefined");
|
|
359
366
|
|
|
360
367
|
/**
|
|
361
368
|
* Determine if a value is a Buffer
|
|
@@ -365,8 +372,14 @@ const isUndefined = typeOfTest('undefined');
|
|
|
365
372
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
366
373
|
*/
|
|
367
374
|
function isBuffer(val) {
|
|
368
|
-
return
|
|
369
|
-
|
|
375
|
+
return (
|
|
376
|
+
val !== null &&
|
|
377
|
+
!isUndefined(val) &&
|
|
378
|
+
val.constructor !== null &&
|
|
379
|
+
!isUndefined(val.constructor) &&
|
|
380
|
+
isFunction$1(val.constructor.isBuffer) &&
|
|
381
|
+
val.constructor.isBuffer(val)
|
|
382
|
+
);
|
|
370
383
|
}
|
|
371
384
|
|
|
372
385
|
/**
|
|
@@ -376,8 +389,7 @@ function isBuffer(val) {
|
|
|
376
389
|
*
|
|
377
390
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
378
391
|
*/
|
|
379
|
-
const isArrayBuffer = kindOfTest(
|
|
380
|
-
|
|
392
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
381
393
|
|
|
382
394
|
/**
|
|
383
395
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -388,10 +400,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
|
388
400
|
*/
|
|
389
401
|
function isArrayBufferView(val) {
|
|
390
402
|
let result;
|
|
391
|
-
if (
|
|
403
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
392
404
|
result = ArrayBuffer.isView(val);
|
|
393
405
|
} else {
|
|
394
|
-
result =
|
|
406
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
395
407
|
}
|
|
396
408
|
return result;
|
|
397
409
|
}
|
|
@@ -403,7 +415,7 @@ function isArrayBufferView(val) {
|
|
|
403
415
|
*
|
|
404
416
|
* @returns {boolean} True if value is a String, otherwise false
|
|
405
417
|
*/
|
|
406
|
-
const isString = typeOfTest(
|
|
418
|
+
const isString = typeOfTest("string");
|
|
407
419
|
|
|
408
420
|
/**
|
|
409
421
|
* Determine if a value is a Function
|
|
@@ -411,7 +423,7 @@ const isString = typeOfTest('string');
|
|
|
411
423
|
* @param {*} val The value to test
|
|
412
424
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
413
425
|
*/
|
|
414
|
-
const isFunction$1 = typeOfTest(
|
|
426
|
+
const isFunction$1 = typeOfTest("function");
|
|
415
427
|
|
|
416
428
|
/**
|
|
417
429
|
* Determine if a value is a Number
|
|
@@ -420,7 +432,7 @@ const isFunction$1 = typeOfTest('function');
|
|
|
420
432
|
*
|
|
421
433
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
422
434
|
*/
|
|
423
|
-
const isNumber = typeOfTest(
|
|
435
|
+
const isNumber = typeOfTest("number");
|
|
424
436
|
|
|
425
437
|
/**
|
|
426
438
|
* Determine if a value is an Object
|
|
@@ -429,7 +441,7 @@ const isNumber = typeOfTest('number');
|
|
|
429
441
|
*
|
|
430
442
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
431
443
|
*/
|
|
432
|
-
const isObject = (thing) => thing !== null && typeof thing ===
|
|
444
|
+
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
433
445
|
|
|
434
446
|
/**
|
|
435
447
|
* Determine if a value is a Boolean
|
|
@@ -437,7 +449,7 @@ const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
|
437
449
|
* @param {*} thing The value to test
|
|
438
450
|
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
439
451
|
*/
|
|
440
|
-
const isBoolean = thing => thing === true || thing === false;
|
|
452
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
441
453
|
|
|
442
454
|
/**
|
|
443
455
|
* Determine if a value is a plain Object
|
|
@@ -447,12 +459,18 @@ const isBoolean = thing => thing === true || thing === false;
|
|
|
447
459
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
448
460
|
*/
|
|
449
461
|
const isPlainObject = (val) => {
|
|
450
|
-
if (kindOf(val) !==
|
|
462
|
+
if (kindOf(val) !== "object") {
|
|
451
463
|
return false;
|
|
452
464
|
}
|
|
453
465
|
|
|
454
466
|
const prototype = getPrototypeOf(val);
|
|
455
|
-
return (
|
|
467
|
+
return (
|
|
468
|
+
(prototype === null ||
|
|
469
|
+
prototype === Object.prototype ||
|
|
470
|
+
Object.getPrototypeOf(prototype) === null) &&
|
|
471
|
+
!(toStringTag in val) &&
|
|
472
|
+
!(iterator in val)
|
|
473
|
+
);
|
|
456
474
|
};
|
|
457
475
|
|
|
458
476
|
/**
|
|
@@ -469,7 +487,10 @@ const isEmptyObject = (val) => {
|
|
|
469
487
|
}
|
|
470
488
|
|
|
471
489
|
try {
|
|
472
|
-
return
|
|
490
|
+
return (
|
|
491
|
+
Object.keys(val).length === 0 &&
|
|
492
|
+
Object.getPrototypeOf(val) === Object.prototype
|
|
493
|
+
);
|
|
473
494
|
} catch (e) {
|
|
474
495
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
475
496
|
return false;
|
|
@@ -483,7 +504,7 @@ const isEmptyObject = (val) => {
|
|
|
483
504
|
*
|
|
484
505
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
485
506
|
*/
|
|
486
|
-
const isDate = kindOfTest(
|
|
507
|
+
const isDate = kindOfTest("Date");
|
|
487
508
|
|
|
488
509
|
/**
|
|
489
510
|
* Determine if a value is a File
|
|
@@ -492,7 +513,7 @@ const isDate = kindOfTest('Date');
|
|
|
492
513
|
*
|
|
493
514
|
* @returns {boolean} True if value is a File, otherwise false
|
|
494
515
|
*/
|
|
495
|
-
const isFile = kindOfTest(
|
|
516
|
+
const isFile = kindOfTest("File");
|
|
496
517
|
|
|
497
518
|
/**
|
|
498
519
|
* Determine if a value is a Blob
|
|
@@ -501,7 +522,7 @@ const isFile = kindOfTest('File');
|
|
|
501
522
|
*
|
|
502
523
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
503
524
|
*/
|
|
504
|
-
const isBlob = kindOfTest(
|
|
525
|
+
const isBlob = kindOfTest("Blob");
|
|
505
526
|
|
|
506
527
|
/**
|
|
507
528
|
* Determine if a value is a FileList
|
|
@@ -510,7 +531,7 @@ const isBlob = kindOfTest('Blob');
|
|
|
510
531
|
*
|
|
511
532
|
* @returns {boolean} True if value is a File, otherwise false
|
|
512
533
|
*/
|
|
513
|
-
const isFileList = kindOfTest(
|
|
534
|
+
const isFileList = kindOfTest("FileList");
|
|
514
535
|
|
|
515
536
|
/**
|
|
516
537
|
* Determine if a value is a Stream
|
|
@@ -530,15 +551,16 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
|
530
551
|
*/
|
|
531
552
|
const isFormData = (thing) => {
|
|
532
553
|
let kind;
|
|
533
|
-
return
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
554
|
+
return (
|
|
555
|
+
thing &&
|
|
556
|
+
((typeof FormData === "function" && thing instanceof FormData) ||
|
|
557
|
+
(isFunction$1(thing.append) &&
|
|
558
|
+
((kind = kindOf(thing)) === "formdata" ||
|
|
559
|
+
// detect form-data instance
|
|
560
|
+
(kind === "object" &&
|
|
561
|
+
isFunction$1(thing.toString) &&
|
|
562
|
+
thing.toString() === "[object FormData]"))))
|
|
563
|
+
);
|
|
542
564
|
};
|
|
543
565
|
|
|
544
566
|
/**
|
|
@@ -548,9 +570,14 @@ const isFormData = (thing) => {
|
|
|
548
570
|
*
|
|
549
571
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
550
572
|
*/
|
|
551
|
-
const isURLSearchParams = kindOfTest(
|
|
573
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
552
574
|
|
|
553
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
575
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
576
|
+
"ReadableStream",
|
|
577
|
+
"Request",
|
|
578
|
+
"Response",
|
|
579
|
+
"Headers",
|
|
580
|
+
].map(kindOfTest);
|
|
554
581
|
|
|
555
582
|
/**
|
|
556
583
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -559,8 +586,8 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream',
|
|
|
559
586
|
*
|
|
560
587
|
* @returns {String} The String freed of excess whitespace
|
|
561
588
|
*/
|
|
562
|
-
const trim = (str) =>
|
|
563
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
589
|
+
const trim = (str) =>
|
|
590
|
+
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
564
591
|
|
|
565
592
|
/**
|
|
566
593
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
@@ -571,15 +598,16 @@ const trim = (str) => str.trim ?
|
|
|
571
598
|
* If 'obj' is an Object callback will be called passing
|
|
572
599
|
* the value, key, and complete object for each property.
|
|
573
600
|
*
|
|
574
|
-
* @param {Object|Array} obj The object to iterate
|
|
601
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
575
602
|
* @param {Function} fn The callback to invoke for each item
|
|
576
603
|
*
|
|
577
|
-
* @param {
|
|
604
|
+
* @param {Object} [options]
|
|
605
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
578
606
|
* @returns {any}
|
|
579
607
|
*/
|
|
580
|
-
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
608
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
581
609
|
// Don't bother if no value provided
|
|
582
|
-
if (obj === null || typeof obj ===
|
|
610
|
+
if (obj === null || typeof obj === "undefined") {
|
|
583
611
|
return;
|
|
584
612
|
}
|
|
585
613
|
|
|
@@ -587,7 +615,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
587
615
|
let l;
|
|
588
616
|
|
|
589
617
|
// Force an array if not already something iterable
|
|
590
|
-
if (typeof obj !==
|
|
618
|
+
if (typeof obj !== "object") {
|
|
591
619
|
/*eslint no-param-reassign:0*/
|
|
592
620
|
obj = [obj];
|
|
593
621
|
}
|
|
@@ -604,7 +632,9 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
604
632
|
}
|
|
605
633
|
|
|
606
634
|
// Iterate over object keys
|
|
607
|
-
const keys = allOwnKeys
|
|
635
|
+
const keys = allOwnKeys
|
|
636
|
+
? Object.getOwnPropertyNames(obj)
|
|
637
|
+
: Object.keys(obj);
|
|
608
638
|
const len = keys.length;
|
|
609
639
|
let key;
|
|
610
640
|
|
|
@@ -616,7 +646,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
616
646
|
}
|
|
617
647
|
|
|
618
648
|
function findKey(obj, key) {
|
|
619
|
-
if (isBuffer(obj)){
|
|
649
|
+
if (isBuffer(obj)) {
|
|
620
650
|
return null;
|
|
621
651
|
}
|
|
622
652
|
|
|
@@ -636,10 +666,15 @@ function findKey(obj, key) {
|
|
|
636
666
|
const _global = (() => {
|
|
637
667
|
/*eslint no-undef:0*/
|
|
638
668
|
if (typeof globalThis !== "undefined") return globalThis;
|
|
639
|
-
return typeof self !== "undefined"
|
|
669
|
+
return typeof self !== "undefined"
|
|
670
|
+
? self
|
|
671
|
+
: typeof window !== "undefined"
|
|
672
|
+
? window
|
|
673
|
+
: global;
|
|
640
674
|
})();
|
|
641
675
|
|
|
642
|
-
const isContextDefined = (context) =>
|
|
676
|
+
const isContextDefined = (context) =>
|
|
677
|
+
!isUndefined(context) && context !== _global;
|
|
643
678
|
|
|
644
679
|
/**
|
|
645
680
|
* Accepts varargs expecting each argument to be an object, then
|
|
@@ -651,7 +686,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
651
686
|
* Example:
|
|
652
687
|
*
|
|
653
688
|
* ```js
|
|
654
|
-
*
|
|
689
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
655
690
|
* console.log(result.foo); // outputs 456
|
|
656
691
|
* ```
|
|
657
692
|
*
|
|
@@ -660,20 +695,23 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
660
695
|
* @returns {Object} Result of all merge properties
|
|
661
696
|
*/
|
|
662
697
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
663
|
-
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
698
|
+
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
664
699
|
const result = {};
|
|
665
700
|
const assignValue = (val, key) => {
|
|
666
|
-
|
|
701
|
+
// Skip dangerous property names to prevent prototype pollution
|
|
702
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
const targetKey = (caseless && findKey(result, key)) || key;
|
|
667
707
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
668
708
|
result[targetKey] = merge(result[targetKey], val);
|
|
669
709
|
} else if (isPlainObject(val)) {
|
|
670
710
|
result[targetKey] = merge({}, val);
|
|
671
711
|
} else if (isArray(val)) {
|
|
672
712
|
result[targetKey] = val.slice();
|
|
673
|
-
} else {
|
|
674
|
-
|
|
675
|
-
result[targetKey] = val;
|
|
676
|
-
}
|
|
713
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
714
|
+
result[targetKey] = val;
|
|
677
715
|
}
|
|
678
716
|
};
|
|
679
717
|
|
|
@@ -690,17 +728,32 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
690
728
|
* @param {Object} b The object to copy properties from
|
|
691
729
|
* @param {Object} thisArg The object to bind function to
|
|
692
730
|
*
|
|
693
|
-
* @param {
|
|
731
|
+
* @param {Object} [options]
|
|
732
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
694
733
|
* @returns {Object} The resulting value of object a
|
|
695
734
|
*/
|
|
696
|
-
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
697
|
-
forEach(
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
735
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
736
|
+
forEach(
|
|
737
|
+
b,
|
|
738
|
+
(val, key) => {
|
|
739
|
+
if (thisArg && isFunction$1(val)) {
|
|
740
|
+
Object.defineProperty(a, key, {
|
|
741
|
+
value: bind(val, thisArg),
|
|
742
|
+
writable: true,
|
|
743
|
+
enumerable: true,
|
|
744
|
+
configurable: true,
|
|
745
|
+
});
|
|
746
|
+
} else {
|
|
747
|
+
Object.defineProperty(a, key, {
|
|
748
|
+
value: val,
|
|
749
|
+
writable: true,
|
|
750
|
+
enumerable: true,
|
|
751
|
+
configurable: true,
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
},
|
|
755
|
+
{ allOwnKeys },
|
|
756
|
+
);
|
|
704
757
|
return a;
|
|
705
758
|
};
|
|
706
759
|
|
|
@@ -712,7 +765,7 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
|
712
765
|
* @returns {string} content value without BOM
|
|
713
766
|
*/
|
|
714
767
|
const stripBOM = (content) => {
|
|
715
|
-
if (content.charCodeAt(0) ===
|
|
768
|
+
if (content.charCodeAt(0) === 0xfeff) {
|
|
716
769
|
content = content.slice(1);
|
|
717
770
|
}
|
|
718
771
|
return content;
|
|
@@ -728,10 +781,18 @@ const stripBOM = (content) => {
|
|
|
728
781
|
* @returns {void}
|
|
729
782
|
*/
|
|
730
783
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
731
|
-
constructor.prototype = Object.create(
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
784
|
+
constructor.prototype = Object.create(
|
|
785
|
+
superConstructor.prototype,
|
|
786
|
+
descriptors,
|
|
787
|
+
);
|
|
788
|
+
Object.defineProperty(constructor.prototype, "constructor", {
|
|
789
|
+
value: constructor,
|
|
790
|
+
writable: true,
|
|
791
|
+
enumerable: false,
|
|
792
|
+
configurable: true,
|
|
793
|
+
});
|
|
794
|
+
Object.defineProperty(constructor, "super", {
|
|
795
|
+
value: superConstructor.prototype,
|
|
735
796
|
});
|
|
736
797
|
props && Object.assign(constructor.prototype, props);
|
|
737
798
|
};
|
|
@@ -760,13 +821,20 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
|
760
821
|
i = props.length;
|
|
761
822
|
while (i-- > 0) {
|
|
762
823
|
prop = props[i];
|
|
763
|
-
if (
|
|
824
|
+
if (
|
|
825
|
+
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
826
|
+
!merged[prop]
|
|
827
|
+
) {
|
|
764
828
|
destObj[prop] = sourceObj[prop];
|
|
765
829
|
merged[prop] = true;
|
|
766
830
|
}
|
|
767
831
|
}
|
|
768
832
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
769
|
-
} while (
|
|
833
|
+
} while (
|
|
834
|
+
sourceObj &&
|
|
835
|
+
(!filter || filter(sourceObj, destObj)) &&
|
|
836
|
+
sourceObj !== Object.prototype
|
|
837
|
+
);
|
|
770
838
|
|
|
771
839
|
return destObj;
|
|
772
840
|
};
|
|
@@ -790,7 +858,6 @@ const endsWith = (str, searchString, position) => {
|
|
|
790
858
|
return lastIndex !== -1 && lastIndex === position;
|
|
791
859
|
};
|
|
792
860
|
|
|
793
|
-
|
|
794
861
|
/**
|
|
795
862
|
* Returns new array from array like object or null if failed
|
|
796
863
|
*
|
|
@@ -819,12 +886,12 @@ const toArray = (thing) => {
|
|
|
819
886
|
* @returns {Array}
|
|
820
887
|
*/
|
|
821
888
|
// eslint-disable-next-line func-names
|
|
822
|
-
const isTypedArray = (TypedArray => {
|
|
889
|
+
const isTypedArray = ((TypedArray) => {
|
|
823
890
|
// eslint-disable-next-line func-names
|
|
824
|
-
return thing => {
|
|
891
|
+
return (thing) => {
|
|
825
892
|
return TypedArray && thing instanceof TypedArray;
|
|
826
893
|
};
|
|
827
|
-
})(typeof Uint8Array !==
|
|
894
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
828
895
|
|
|
829
896
|
/**
|
|
830
897
|
* For each entry in the object, call the function with the key and value.
|
|
@@ -867,18 +934,22 @@ const matchAll = (regExp, str) => {
|
|
|
867
934
|
};
|
|
868
935
|
|
|
869
936
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
870
|
-
const isHTMLForm = kindOfTest(
|
|
937
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
871
938
|
|
|
872
|
-
const toCamelCase = str => {
|
|
873
|
-
return str
|
|
874
|
-
|
|
939
|
+
const toCamelCase = (str) => {
|
|
940
|
+
return str
|
|
941
|
+
.toLowerCase()
|
|
942
|
+
.replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
875
943
|
return p1.toUpperCase() + p2;
|
|
876
|
-
}
|
|
877
|
-
);
|
|
944
|
+
});
|
|
878
945
|
};
|
|
879
946
|
|
|
880
947
|
/* Creating a function that will check if an object has a property. */
|
|
881
|
-
const hasOwnProperty = (
|
|
948
|
+
const hasOwnProperty = (
|
|
949
|
+
({ hasOwnProperty }) =>
|
|
950
|
+
(obj, prop) =>
|
|
951
|
+
hasOwnProperty.call(obj, prop)
|
|
952
|
+
)(Object.prototype);
|
|
882
953
|
|
|
883
954
|
/**
|
|
884
955
|
* Determine if a value is a RegExp object
|
|
@@ -887,7 +958,7 @@ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call
|
|
|
887
958
|
*
|
|
888
959
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
889
960
|
*/
|
|
890
|
-
const isRegExp = kindOfTest(
|
|
961
|
+
const isRegExp = kindOfTest("RegExp");
|
|
891
962
|
|
|
892
963
|
const reduceDescriptors = (obj, reducer) => {
|
|
893
964
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
@@ -911,7 +982,10 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
911
982
|
const freezeMethods = (obj) => {
|
|
912
983
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
913
984
|
// skip restricted props in strict mode
|
|
914
|
-
if (
|
|
985
|
+
if (
|
|
986
|
+
isFunction$1(obj) &&
|
|
987
|
+
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
988
|
+
) {
|
|
915
989
|
return false;
|
|
916
990
|
}
|
|
917
991
|
|
|
@@ -921,14 +995,14 @@ const freezeMethods = (obj) => {
|
|
|
921
995
|
|
|
922
996
|
descriptor.enumerable = false;
|
|
923
997
|
|
|
924
|
-
if (
|
|
998
|
+
if ("writable" in descriptor) {
|
|
925
999
|
descriptor.writable = false;
|
|
926
1000
|
return;
|
|
927
1001
|
}
|
|
928
1002
|
|
|
929
1003
|
if (!descriptor.set) {
|
|
930
1004
|
descriptor.set = () => {
|
|
931
|
-
throw Error(
|
|
1005
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
932
1006
|
};
|
|
933
1007
|
}
|
|
934
1008
|
});
|
|
@@ -938,12 +1012,14 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
938
1012
|
const obj = {};
|
|
939
1013
|
|
|
940
1014
|
const define = (arr) => {
|
|
941
|
-
arr.forEach(value => {
|
|
1015
|
+
arr.forEach((value) => {
|
|
942
1016
|
obj[value] = true;
|
|
943
1017
|
});
|
|
944
1018
|
};
|
|
945
1019
|
|
|
946
|
-
isArray(arrayOrString)
|
|
1020
|
+
isArray(arrayOrString)
|
|
1021
|
+
? define(arrayOrString)
|
|
1022
|
+
: define(String(arrayOrString).split(delimiter));
|
|
947
1023
|
|
|
948
1024
|
return obj;
|
|
949
1025
|
};
|
|
@@ -951,11 +1027,11 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
951
1027
|
const noop = () => {};
|
|
952
1028
|
|
|
953
1029
|
const toFiniteNumber = (value, defaultValue) => {
|
|
954
|
-
return value != null && Number.isFinite(value = +value)
|
|
1030
|
+
return value != null && Number.isFinite((value = +value))
|
|
1031
|
+
? value
|
|
1032
|
+
: defaultValue;
|
|
955
1033
|
};
|
|
956
1034
|
|
|
957
|
-
|
|
958
|
-
|
|
959
1035
|
/**
|
|
960
1036
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
961
1037
|
*
|
|
@@ -964,14 +1040,18 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
964
1040
|
* @returns {boolean}
|
|
965
1041
|
*/
|
|
966
1042
|
function isSpecCompliantForm(thing) {
|
|
967
|
-
return !!(
|
|
1043
|
+
return !!(
|
|
1044
|
+
thing &&
|
|
1045
|
+
isFunction$1(thing.append) &&
|
|
1046
|
+
thing[toStringTag] === "FormData" &&
|
|
1047
|
+
thing[iterator]
|
|
1048
|
+
);
|
|
968
1049
|
}
|
|
969
1050
|
|
|
970
1051
|
const toJSONObject = (obj) => {
|
|
971
1052
|
const stack = new Array(10);
|
|
972
1053
|
|
|
973
1054
|
const visit = (source, i) => {
|
|
974
|
-
|
|
975
1055
|
if (isObject(source)) {
|
|
976
1056
|
if (stack.indexOf(source) >= 0) {
|
|
977
1057
|
return;
|
|
@@ -982,7 +1062,7 @@ const toJSONObject = (obj) => {
|
|
|
982
1062
|
return source;
|
|
983
1063
|
}
|
|
984
1064
|
|
|
985
|
-
if(!(
|
|
1065
|
+
if (!("toJSON" in source)) {
|
|
986
1066
|
stack[i] = source;
|
|
987
1067
|
const target = isArray(source) ? [] : {};
|
|
988
1068
|
|
|
@@ -1003,10 +1083,13 @@ const toJSONObject = (obj) => {
|
|
|
1003
1083
|
return visit(obj, 0);
|
|
1004
1084
|
};
|
|
1005
1085
|
|
|
1006
|
-
const isAsyncFn = kindOfTest(
|
|
1086
|
+
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
1007
1087
|
|
|
1008
1088
|
const isThenable = (thing) =>
|
|
1009
|
-
thing &&
|
|
1089
|
+
thing &&
|
|
1090
|
+
(isObject(thing) || isFunction$1(thing)) &&
|
|
1091
|
+
isFunction$1(thing.then) &&
|
|
1092
|
+
isFunction$1(thing.catch);
|
|
1010
1093
|
|
|
1011
1094
|
// original code
|
|
1012
1095
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -1016,32 +1099,35 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
1016
1099
|
return setImmediate;
|
|
1017
1100
|
}
|
|
1018
1101
|
|
|
1019
|
-
return postMessageSupported
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1102
|
+
return postMessageSupported
|
|
1103
|
+
? ((token, callbacks) => {
|
|
1104
|
+
_global.addEventListener(
|
|
1105
|
+
"message",
|
|
1106
|
+
({ source, data }) => {
|
|
1107
|
+
if (source === _global && data === token) {
|
|
1108
|
+
callbacks.length && callbacks.shift()();
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
false,
|
|
1112
|
+
);
|
|
1025
1113
|
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
isFunction$1(_global.postMessage)
|
|
1034
|
-
);
|
|
1114
|
+
return (cb) => {
|
|
1115
|
+
callbacks.push(cb);
|
|
1116
|
+
_global.postMessage(token, "*");
|
|
1117
|
+
};
|
|
1118
|
+
})(`axios@${Math.random()}`, [])
|
|
1119
|
+
: (cb) => setTimeout(cb);
|
|
1120
|
+
})(typeof setImmediate === "function", isFunction$1(_global.postMessage));
|
|
1035
1121
|
|
|
1036
|
-
const asap =
|
|
1037
|
-
|
|
1122
|
+
const asap =
|
|
1123
|
+
typeof queueMicrotask !== "undefined"
|
|
1124
|
+
? queueMicrotask.bind(_global)
|
|
1125
|
+
: (typeof process !== "undefined" && process.nextTick) || _setImmediate;
|
|
1038
1126
|
|
|
1039
1127
|
// *********************
|
|
1040
1128
|
|
|
1041
|
-
|
|
1042
1129
|
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
1043
1130
|
|
|
1044
|
-
|
|
1045
1131
|
var utils$1 = {
|
|
1046
1132
|
isArray,
|
|
1047
1133
|
isArrayBuffer,
|
|
@@ -1099,113 +1185,76 @@ var utils$1 = {
|
|
|
1099
1185
|
isThenable,
|
|
1100
1186
|
setImmediate: _setImmediate,
|
|
1101
1187
|
asap,
|
|
1102
|
-
isIterable
|
|
1188
|
+
isIterable,
|
|
1103
1189
|
};
|
|
1104
1190
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
*
|
|
1114
|
-
* @returns {Error} The created error.
|
|
1115
|
-
*/
|
|
1116
|
-
function AxiosError(message, code, config, request, response) {
|
|
1117
|
-
Error.call(this);
|
|
1191
|
+
class AxiosError extends Error {
|
|
1192
|
+
static from(error, code, config, request, response, customProps) {
|
|
1193
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1194
|
+
axiosError.cause = error;
|
|
1195
|
+
axiosError.name = error.name;
|
|
1196
|
+
customProps && Object.assign(axiosError, customProps);
|
|
1197
|
+
return axiosError;
|
|
1198
|
+
}
|
|
1118
1199
|
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1200
|
+
/**
|
|
1201
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
1202
|
+
*
|
|
1203
|
+
* @param {string} message The error message.
|
|
1204
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
1205
|
+
* @param {Object} [config] The config.
|
|
1206
|
+
* @param {Object} [request] The request.
|
|
1207
|
+
* @param {Object} [response] The response.
|
|
1208
|
+
*
|
|
1209
|
+
* @returns {Error} The created error.
|
|
1210
|
+
*/
|
|
1211
|
+
constructor(message, code, config, request, response) {
|
|
1212
|
+
super(message);
|
|
1213
|
+
this.name = 'AxiosError';
|
|
1214
|
+
this.isAxiosError = true;
|
|
1215
|
+
code && (this.code = code);
|
|
1216
|
+
config && (this.config = config);
|
|
1217
|
+
request && (this.request = request);
|
|
1218
|
+
if (response) {
|
|
1219
|
+
this.response = response;
|
|
1220
|
+
this.status = response.status;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1124
1223
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1224
|
+
toJSON() {
|
|
1225
|
+
return {
|
|
1226
|
+
// Standard
|
|
1227
|
+
message: this.message,
|
|
1228
|
+
name: this.name,
|
|
1229
|
+
// Microsoft
|
|
1230
|
+
description: this.description,
|
|
1231
|
+
number: this.number,
|
|
1232
|
+
// Mozilla
|
|
1233
|
+
fileName: this.fileName,
|
|
1234
|
+
lineNumber: this.lineNumber,
|
|
1235
|
+
columnNumber: this.columnNumber,
|
|
1236
|
+
stack: this.stack,
|
|
1237
|
+
// Axios
|
|
1238
|
+
config: utils$1.toJSONObject(this.config),
|
|
1239
|
+
code: this.code,
|
|
1240
|
+
status: this.status,
|
|
1241
|
+
};
|
|
1242
|
+
}
|
|
1134
1243
|
}
|
|
1135
1244
|
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
stack: this.stack,
|
|
1150
|
-
// Axios
|
|
1151
|
-
config: utils$1.toJSONObject(this.config),
|
|
1152
|
-
code: this.code,
|
|
1153
|
-
status: this.status
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
});
|
|
1157
|
-
|
|
1158
|
-
const prototype$1 = AxiosError.prototype;
|
|
1159
|
-
const descriptors = {};
|
|
1160
|
-
|
|
1161
|
-
[
|
|
1162
|
-
'ERR_BAD_OPTION_VALUE',
|
|
1163
|
-
'ERR_BAD_OPTION',
|
|
1164
|
-
'ECONNABORTED',
|
|
1165
|
-
'ETIMEDOUT',
|
|
1166
|
-
'ERR_NETWORK',
|
|
1167
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
1168
|
-
'ERR_DEPRECATED',
|
|
1169
|
-
'ERR_BAD_RESPONSE',
|
|
1170
|
-
'ERR_BAD_REQUEST',
|
|
1171
|
-
'ERR_CANCELED',
|
|
1172
|
-
'ERR_NOT_SUPPORT',
|
|
1173
|
-
'ERR_INVALID_URL'
|
|
1174
|
-
// eslint-disable-next-line func-names
|
|
1175
|
-
].forEach(code => {
|
|
1176
|
-
descriptors[code] = {value: code};
|
|
1177
|
-
});
|
|
1178
|
-
|
|
1179
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
1180
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
1181
|
-
|
|
1182
|
-
// eslint-disable-next-line func-names
|
|
1183
|
-
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
1184
|
-
const axiosError = Object.create(prototype$1);
|
|
1185
|
-
|
|
1186
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
1187
|
-
return obj !== Error.prototype;
|
|
1188
|
-
}, prop => {
|
|
1189
|
-
return prop !== 'isAxiosError';
|
|
1190
|
-
});
|
|
1191
|
-
|
|
1192
|
-
const msg = error && error.message ? error.message : 'Error';
|
|
1193
|
-
|
|
1194
|
-
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
1195
|
-
const errCode = code == null && error ? error.code : code;
|
|
1196
|
-
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
1197
|
-
|
|
1198
|
-
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
1199
|
-
if (error && axiosError.cause == null) {
|
|
1200
|
-
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
axiosError.name = (error && error.name) || 'Error';
|
|
1204
|
-
|
|
1205
|
-
customProps && Object.assign(axiosError, customProps);
|
|
1206
|
-
|
|
1207
|
-
return axiosError;
|
|
1208
|
-
};
|
|
1245
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
1246
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
1247
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
1248
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
1249
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
1250
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
1251
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
1252
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
1253
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
1254
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
1255
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
1256
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1257
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1209
1258
|
|
|
1210
1259
|
// eslint-disable-next-line strict
|
|
1211
1260
|
var httpAdapter = null;
|
|
@@ -1504,29 +1553,26 @@ function encode(val) {
|
|
|
1504
1553
|
* @returns {string} The formatted url
|
|
1505
1554
|
*/
|
|
1506
1555
|
function buildURL(url, params, options) {
|
|
1507
|
-
/*eslint no-param-reassign:0*/
|
|
1508
1556
|
if (!params) {
|
|
1509
1557
|
return url;
|
|
1510
1558
|
}
|
|
1511
|
-
|
|
1559
|
+
|
|
1512
1560
|
const _encode = options && options.encode || encode;
|
|
1513
1561
|
|
|
1514
|
-
|
|
1515
|
-
options
|
|
1516
|
-
|
|
1517
|
-
};
|
|
1518
|
-
}
|
|
1562
|
+
const _options = utils$1.isFunction(options) ? {
|
|
1563
|
+
serialize: options
|
|
1564
|
+
} : options;
|
|
1519
1565
|
|
|
1520
|
-
const serializeFn =
|
|
1566
|
+
const serializeFn = _options && _options.serialize;
|
|
1521
1567
|
|
|
1522
1568
|
let serializedParams;
|
|
1523
1569
|
|
|
1524
1570
|
if (serializeFn) {
|
|
1525
|
-
serializedParams = serializeFn(params,
|
|
1571
|
+
serializedParams = serializeFn(params, _options);
|
|
1526
1572
|
} else {
|
|
1527
1573
|
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
1528
1574
|
params.toString() :
|
|
1529
|
-
new AxiosURLSearchParams(params,
|
|
1575
|
+
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1530
1576
|
}
|
|
1531
1577
|
|
|
1532
1578
|
if (serializedParams) {
|
|
@@ -1551,6 +1597,7 @@ class InterceptorManager {
|
|
|
1551
1597
|
*
|
|
1552
1598
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1553
1599
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1600
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1554
1601
|
*
|
|
1555
1602
|
* @return {Number} An ID used to remove interceptor later
|
|
1556
1603
|
*/
|
|
@@ -1569,7 +1616,7 @@ class InterceptorManager {
|
|
|
1569
1616
|
*
|
|
1570
1617
|
* @param {Number} id The ID that was returned by `use`
|
|
1571
1618
|
*
|
|
1572
|
-
* @returns {
|
|
1619
|
+
* @returns {void}
|
|
1573
1620
|
*/
|
|
1574
1621
|
eject(id) {
|
|
1575
1622
|
if (this.handlers[id]) {
|
|
@@ -1610,7 +1657,8 @@ class InterceptorManager {
|
|
|
1610
1657
|
var transitionalDefaults = {
|
|
1611
1658
|
silentJSONParsing: true,
|
|
1612
1659
|
forcedJSONParsing: true,
|
|
1613
|
-
clarifyTimeoutError: false
|
|
1660
|
+
clarifyTimeoutError: false,
|
|
1661
|
+
legacyInterceptorReqResOrdering: true
|
|
1614
1662
|
};
|
|
1615
1663
|
|
|
1616
1664
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -2328,25 +2376,23 @@ function isCancel(value) {
|
|
|
2328
2376
|
return !!(value && value.__CANCEL__);
|
|
2329
2377
|
}
|
|
2330
2378
|
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2379
|
+
class CanceledError extends AxiosError {
|
|
2380
|
+
/**
|
|
2381
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
2382
|
+
*
|
|
2383
|
+
* @param {string=} message The message.
|
|
2384
|
+
* @param {Object=} config The config.
|
|
2385
|
+
* @param {Object=} request The request.
|
|
2386
|
+
*
|
|
2387
|
+
* @returns {CanceledError} The created error.
|
|
2388
|
+
*/
|
|
2389
|
+
constructor(message, config, request) {
|
|
2390
|
+
super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
|
|
2391
|
+
this.name = 'CanceledError';
|
|
2392
|
+
this.__CANCEL__ = true;
|
|
2393
|
+
}
|
|
2344
2394
|
}
|
|
2345
2395
|
|
|
2346
|
-
utils$1.inherits(CanceledError, AxiosError, {
|
|
2347
|
-
__CANCEL__: true
|
|
2348
|
-
});
|
|
2349
|
-
|
|
2350
2396
|
/**
|
|
2351
2397
|
* Resolve or reject a Promise based on response status.
|
|
2352
2398
|
*
|
|
@@ -2529,27 +2575,38 @@ var cookies = platform.hasStandardBrowserEnv ?
|
|
|
2529
2575
|
|
|
2530
2576
|
// Standard browser envs support document.cookie
|
|
2531
2577
|
{
|
|
2532
|
-
write(name, value, expires, path, domain, secure) {
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
2536
|
-
|
|
2537
|
-
utils$1.isString(path) && cookie.push('path=' + path);
|
|
2578
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2579
|
+
if (typeof document === 'undefined') return;
|
|
2538
2580
|
|
|
2539
|
-
|
|
2581
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
2540
2582
|
|
|
2541
|
-
|
|
2583
|
+
if (utils$1.isNumber(expires)) {
|
|
2584
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
2585
|
+
}
|
|
2586
|
+
if (utils$1.isString(path)) {
|
|
2587
|
+
cookie.push(`path=${path}`);
|
|
2588
|
+
}
|
|
2589
|
+
if (utils$1.isString(domain)) {
|
|
2590
|
+
cookie.push(`domain=${domain}`);
|
|
2591
|
+
}
|
|
2592
|
+
if (secure === true) {
|
|
2593
|
+
cookie.push('secure');
|
|
2594
|
+
}
|
|
2595
|
+
if (utils$1.isString(sameSite)) {
|
|
2596
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
2597
|
+
}
|
|
2542
2598
|
|
|
2543
2599
|
document.cookie = cookie.join('; ');
|
|
2544
2600
|
},
|
|
2545
2601
|
|
|
2546
2602
|
read(name) {
|
|
2547
|
-
|
|
2548
|
-
|
|
2603
|
+
if (typeof document === 'undefined') return null;
|
|
2604
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
2605
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
2549
2606
|
},
|
|
2550
2607
|
|
|
2551
2608
|
remove(name) {
|
|
2552
|
-
this.write(name, '', Date.now() - 86400000);
|
|
2609
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
2553
2610
|
}
|
|
2554
2611
|
}
|
|
2555
2612
|
|
|
@@ -2575,6 +2632,10 @@ function isAbsoluteURL(url) {
|
|
|
2575
2632
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
2576
2633
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
2577
2634
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
2635
|
+
if (typeof url !== 'string') {
|
|
2636
|
+
return false;
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2578
2639
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
2579
2640
|
}
|
|
2580
2641
|
|
|
@@ -2610,7 +2671,8 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
2610
2671
|
return requestedURL;
|
|
2611
2672
|
}
|
|
2612
2673
|
|
|
2613
|
-
const headersToObject = (thing) =>
|
|
2674
|
+
const headersToObject = (thing) =>
|
|
2675
|
+
thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
2614
2676
|
|
|
2615
2677
|
/**
|
|
2616
2678
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -2628,7 +2690,7 @@ function mergeConfig(config1, config2) {
|
|
|
2628
2690
|
|
|
2629
2691
|
function getMergedValue(target, source, prop, caseless) {
|
|
2630
2692
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2631
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
2693
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
2632
2694
|
} else if (utils$1.isPlainObject(source)) {
|
|
2633
2695
|
return utils$1.merge({}, source);
|
|
2634
2696
|
} else if (utils$1.isArray(source)) {
|
|
@@ -2637,12 +2699,11 @@ function mergeConfig(config1, config2) {
|
|
|
2637
2699
|
return source;
|
|
2638
2700
|
}
|
|
2639
2701
|
|
|
2640
|
-
|
|
2641
|
-
function mergeDeepProperties(a, b, prop , caseless) {
|
|
2702
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
2642
2703
|
if (!utils$1.isUndefined(b)) {
|
|
2643
|
-
return getMergedValue(a, b, prop
|
|
2704
|
+
return getMergedValue(a, b, prop, caseless);
|
|
2644
2705
|
} else if (!utils$1.isUndefined(a)) {
|
|
2645
|
-
return getMergedValue(undefined, a, prop
|
|
2706
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
2646
2707
|
}
|
|
2647
2708
|
}
|
|
2648
2709
|
|
|
@@ -2700,14 +2761,27 @@ function mergeConfig(config1, config2) {
|
|
|
2700
2761
|
socketPath: defaultToConfig2,
|
|
2701
2762
|
responseEncoding: defaultToConfig2,
|
|
2702
2763
|
validateStatus: mergeDirectKeys,
|
|
2703
|
-
headers: (a, b
|
|
2764
|
+
headers: (a, b, prop) =>
|
|
2765
|
+
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
2704
2766
|
};
|
|
2705
2767
|
|
|
2706
|
-
utils$1.forEach(
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2768
|
+
utils$1.forEach(
|
|
2769
|
+
Object.keys({ ...config1, ...config2 }),
|
|
2770
|
+
function computeConfigValue(prop) {
|
|
2771
|
+
if (
|
|
2772
|
+
prop === "__proto__" ||
|
|
2773
|
+
prop === "constructor" ||
|
|
2774
|
+
prop === "prototype"
|
|
2775
|
+
)
|
|
2776
|
+
return;
|
|
2777
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop)
|
|
2778
|
+
? mergeMap[prop]
|
|
2779
|
+
: mergeDeepProperties;
|
|
2780
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2781
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
|
2782
|
+
(config[prop] = configValue);
|
|
2783
|
+
},
|
|
2784
|
+
);
|
|
2711
2785
|
|
|
2712
2786
|
return config;
|
|
2713
2787
|
}
|
|
@@ -2973,7 +3047,7 @@ const composeSignals = (signals, timeout) => {
|
|
|
2973
3047
|
|
|
2974
3048
|
let timer = timeout && setTimeout(() => {
|
|
2975
3049
|
timer = null;
|
|
2976
|
-
onabort(new AxiosError(`timeout ${timeout}
|
|
3050
|
+
onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
|
|
2977
3051
|
}, timeout);
|
|
2978
3052
|
|
|
2979
3053
|
const unsubscribe = () => {
|
|
@@ -3088,9 +3162,9 @@ const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
|
3088
3162
|
|
|
3089
3163
|
const {isFunction} = utils$1;
|
|
3090
3164
|
|
|
3091
|
-
const globalFetchAPI = (({
|
|
3092
|
-
|
|
3093
|
-
|
|
3165
|
+
const globalFetchAPI = (({Request, Response}) => ({
|
|
3166
|
+
Request, Response
|
|
3167
|
+
}))(utils$1.global);
|
|
3094
3168
|
|
|
3095
3169
|
const {
|
|
3096
3170
|
ReadableStream: ReadableStream$1, TextEncoder
|
|
@@ -3106,8 +3180,12 @@ const test = (fn, ...args) => {
|
|
|
3106
3180
|
};
|
|
3107
3181
|
|
|
3108
3182
|
const factory = (env) => {
|
|
3109
|
-
|
|
3110
|
-
|
|
3183
|
+
env = utils$1.merge.call({
|
|
3184
|
+
skipUndefined: true
|
|
3185
|
+
}, globalFetchAPI, env);
|
|
3186
|
+
|
|
3187
|
+
const {fetch: envFetch, Request, Response} = env;
|
|
3188
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
3111
3189
|
const isRequestSupported = isFunction(Request);
|
|
3112
3190
|
const isResponseSupported = isFunction(Response);
|
|
3113
3191
|
|
|
@@ -3210,6 +3288,8 @@ const factory = (env) => {
|
|
|
3210
3288
|
fetchOptions
|
|
3211
3289
|
} = resolveConfig(config);
|
|
3212
3290
|
|
|
3291
|
+
let _fetch = envFetch || fetch;
|
|
3292
|
+
|
|
3213
3293
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3214
3294
|
|
|
3215
3295
|
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
@@ -3269,7 +3349,7 @@ const factory = (env) => {
|
|
|
3269
3349
|
|
|
3270
3350
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3271
3351
|
|
|
3272
|
-
let response = await (isRequestSupported ?
|
|
3352
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
3273
3353
|
|
|
3274
3354
|
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3275
3355
|
|
|
@@ -3317,14 +3397,14 @@ const factory = (env) => {
|
|
|
3317
3397
|
|
|
3318
3398
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3319
3399
|
throw Object.assign(
|
|
3320
|
-
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
3400
|
+
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, err && err.response),
|
|
3321
3401
|
{
|
|
3322
3402
|
cause: err.cause || err
|
|
3323
3403
|
}
|
|
3324
3404
|
)
|
|
3325
3405
|
}
|
|
3326
3406
|
|
|
3327
|
-
throw AxiosError.from(err, err && err.code, config, request);
|
|
3407
|
+
throw AxiosError.from(err, err && err.code, config, request, err && err.response);
|
|
3328
3408
|
}
|
|
3329
3409
|
}
|
|
3330
3410
|
};
|
|
@@ -3332,12 +3412,8 @@ const factory = (env) => {
|
|
|
3332
3412
|
const seedCache = new Map();
|
|
3333
3413
|
|
|
3334
3414
|
const getFetch = (config) => {
|
|
3335
|
-
let env =
|
|
3336
|
-
skipUndefined: true
|
|
3337
|
-
}, globalFetchAPI, config ? config.env : null);
|
|
3338
|
-
|
|
3415
|
+
let env = (config && config.env) || {};
|
|
3339
3416
|
const {fetch, Request, Response} = env;
|
|
3340
|
-
|
|
3341
3417
|
const seeds = [
|
|
3342
3418
|
Request, Response, fetch
|
|
3343
3419
|
];
|
|
@@ -3359,6 +3435,15 @@ const getFetch = (config) => {
|
|
|
3359
3435
|
|
|
3360
3436
|
getFetch();
|
|
3361
3437
|
|
|
3438
|
+
/**
|
|
3439
|
+
* Known adapters mapping.
|
|
3440
|
+
* Provides environment-specific adapters for Axios:
|
|
3441
|
+
* - `http` for Node.js
|
|
3442
|
+
* - `xhr` for browsers
|
|
3443
|
+
* - `fetch` for fetch API-based requests
|
|
3444
|
+
*
|
|
3445
|
+
* @type {Object<string, Function|Object>}
|
|
3446
|
+
*/
|
|
3362
3447
|
const knownAdapters = {
|
|
3363
3448
|
http: httpAdapter,
|
|
3364
3449
|
xhr: xhrAdapter,
|
|
@@ -3367,71 +3452,107 @@ const knownAdapters = {
|
|
|
3367
3452
|
}
|
|
3368
3453
|
};
|
|
3369
3454
|
|
|
3455
|
+
// Assign adapter names for easier debugging and identification
|
|
3370
3456
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
3371
3457
|
if (fn) {
|
|
3372
3458
|
try {
|
|
3373
|
-
Object.defineProperty(fn, 'name', {value});
|
|
3459
|
+
Object.defineProperty(fn, 'name', { value });
|
|
3374
3460
|
} catch (e) {
|
|
3375
3461
|
// eslint-disable-next-line no-empty
|
|
3376
3462
|
}
|
|
3377
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
3463
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
3378
3464
|
}
|
|
3379
3465
|
});
|
|
3380
3466
|
|
|
3467
|
+
/**
|
|
3468
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
3469
|
+
*
|
|
3470
|
+
* @param {string} reason
|
|
3471
|
+
* @returns {string}
|
|
3472
|
+
*/
|
|
3381
3473
|
const renderReason = (reason) => `- ${reason}`;
|
|
3382
3474
|
|
|
3475
|
+
/**
|
|
3476
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
3477
|
+
*
|
|
3478
|
+
* @param {Function|null|false} adapter
|
|
3479
|
+
* @returns {boolean}
|
|
3480
|
+
*/
|
|
3383
3481
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3384
3482
|
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3483
|
+
/**
|
|
3484
|
+
* Get the first suitable adapter from the provided list.
|
|
3485
|
+
* Tries each adapter in order until a supported one is found.
|
|
3486
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
3487
|
+
*
|
|
3488
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
3489
|
+
* @param {Object} config - Axios request configuration
|
|
3490
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
3491
|
+
* @returns {Function} The resolved adapter function
|
|
3492
|
+
*/
|
|
3493
|
+
function getAdapter(adapters, config) {
|
|
3494
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
3392
3495
|
|
|
3393
|
-
|
|
3496
|
+
const { length } = adapters;
|
|
3497
|
+
let nameOrAdapter;
|
|
3498
|
+
let adapter;
|
|
3394
3499
|
|
|
3395
|
-
|
|
3396
|
-
nameOrAdapter = adapters[i];
|
|
3397
|
-
let id;
|
|
3500
|
+
const rejectedReasons = {};
|
|
3398
3501
|
|
|
3399
|
-
|
|
3502
|
+
for (let i = 0; i < length; i++) {
|
|
3503
|
+
nameOrAdapter = adapters[i];
|
|
3504
|
+
let id;
|
|
3400
3505
|
|
|
3401
|
-
|
|
3402
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3506
|
+
adapter = nameOrAdapter;
|
|
3403
3507
|
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
}
|
|
3407
|
-
}
|
|
3508
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
3509
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3408
3510
|
|
|
3409
|
-
if (adapter
|
|
3410
|
-
|
|
3511
|
+
if (adapter === undefined) {
|
|
3512
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
3411
3513
|
}
|
|
3514
|
+
}
|
|
3412
3515
|
|
|
3413
|
-
|
|
3516
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
3517
|
+
break;
|
|
3414
3518
|
}
|
|
3415
3519
|
|
|
3416
|
-
|
|
3520
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
3521
|
+
}
|
|
3417
3522
|
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
)
|
|
3523
|
+
if (!adapter) {
|
|
3524
|
+
const reasons = Object.entries(rejectedReasons)
|
|
3525
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
3526
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
3527
|
+
);
|
|
3422
3528
|
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3529
|
+
let s = length ?
|
|
3530
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
3531
|
+
'as no adapter specified';
|
|
3426
3532
|
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3533
|
+
throw new AxiosError(
|
|
3534
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
3535
|
+
'ERR_NOT_SUPPORT'
|
|
3536
|
+
);
|
|
3537
|
+
}
|
|
3432
3538
|
|
|
3433
|
-
|
|
3434
|
-
|
|
3539
|
+
return adapter;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
/**
|
|
3543
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
3544
|
+
*/
|
|
3545
|
+
var adapters = {
|
|
3546
|
+
/**
|
|
3547
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
3548
|
+
* @type {Function}
|
|
3549
|
+
*/
|
|
3550
|
+
getAdapter,
|
|
3551
|
+
|
|
3552
|
+
/**
|
|
3553
|
+
* Exposes all known adapters
|
|
3554
|
+
* @type {Object<string, Function|Object>}
|
|
3555
|
+
*/
|
|
3435
3556
|
adapters: knownAdapters
|
|
3436
3557
|
};
|
|
3437
3558
|
|
|
@@ -3508,7 +3629,7 @@ function dispatchRequest(config) {
|
|
|
3508
3629
|
});
|
|
3509
3630
|
}
|
|
3510
3631
|
|
|
3511
|
-
const VERSION = "1.
|
|
3632
|
+
const VERSION = "1.13.5";
|
|
3512
3633
|
|
|
3513
3634
|
const validators$1 = {};
|
|
3514
3635
|
|
|
@@ -3676,7 +3797,8 @@ class Axios {
|
|
|
3676
3797
|
validator.assertOptions(transitional, {
|
|
3677
3798
|
silentJSONParsing: validators.transitional(validators.boolean),
|
|
3678
3799
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
3679
|
-
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
3800
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
3801
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
|
3680
3802
|
}, false);
|
|
3681
3803
|
}
|
|
3682
3804
|
|
|
@@ -3733,7 +3855,14 @@ class Axios {
|
|
|
3733
3855
|
|
|
3734
3856
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3735
3857
|
|
|
3736
|
-
|
|
3858
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
3859
|
+
const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
|
|
3860
|
+
|
|
3861
|
+
if (legacyInterceptorReqResOrdering) {
|
|
3862
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
3863
|
+
} else {
|
|
3864
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
3865
|
+
}
|
|
3737
3866
|
});
|
|
3738
3867
|
|
|
3739
3868
|
const responseInterceptorChain = [];
|
|
@@ -3764,8 +3893,6 @@ class Axios {
|
|
|
3764
3893
|
|
|
3765
3894
|
let newConfig = config;
|
|
3766
3895
|
|
|
3767
|
-
i = 0;
|
|
3768
|
-
|
|
3769
3896
|
while (i < len) {
|
|
3770
3897
|
const onFulfilled = requestInterceptorChain[i++];
|
|
3771
3898
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -3970,7 +4097,7 @@ class CancelToken {
|
|
|
3970
4097
|
*
|
|
3971
4098
|
* ```js
|
|
3972
4099
|
* function f(x, y, z) {}
|
|
3973
|
-
*
|
|
4100
|
+
* const args = [1, 2, 3];
|
|
3974
4101
|
* f.apply(null, args);
|
|
3975
4102
|
* ```
|
|
3976
4103
|
*
|
|
@@ -4065,6 +4192,12 @@ const HttpStatusCode = {
|
|
|
4065
4192
|
LoopDetected: 508,
|
|
4066
4193
|
NotExtended: 510,
|
|
4067
4194
|
NetworkAuthenticationRequired: 511,
|
|
4195
|
+
WebServerIsDown: 521,
|
|
4196
|
+
ConnectionTimedOut: 522,
|
|
4197
|
+
OriginIsUnreachable: 523,
|
|
4198
|
+
TimeoutOccurred: 524,
|
|
4199
|
+
SslHandshakeFailed: 525,
|
|
4200
|
+
InvalidSslCertificate: 526,
|
|
4068
4201
|
};
|
|
4069
4202
|
|
|
4070
4203
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|