@tryghost/content-api 1.9.1 → 1.9.4
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/cjs/content-api.js +12 -12
- package/es/content-api.js +912 -319
- package/es/content-api.js.map +1 -1
- package/lib/{index.js → content-api.js} +0 -0
- package/package.json +12 -12
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/es/content-api.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import url from 'url';
|
|
2
|
+
|
|
1
3
|
function _defineProperty(obj, key, value) {
|
|
2
4
|
if (key in obj) {
|
|
3
5
|
Object.defineProperty(obj, key, {
|
|
@@ -43,7 +45,7 @@ var fails = function (exec) {
|
|
|
43
45
|
};
|
|
44
46
|
|
|
45
47
|
// Detect IE8's incomplete defineProperty implementation
|
|
46
|
-
var descriptors = !fails(function () {
|
|
48
|
+
var descriptors$1 = !fails(function () {
|
|
47
49
|
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
48
50
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
49
51
|
});
|
|
@@ -271,10 +273,10 @@ var shared = createCommonjsModule(function (module) {
|
|
|
271
273
|
(module.exports = function (key, value) {
|
|
272
274
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
273
275
|
})('versions', []).push({
|
|
274
|
-
version: '3.22.
|
|
276
|
+
version: '3.22.4',
|
|
275
277
|
mode: 'global',
|
|
276
278
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
277
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.22.
|
|
279
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
|
|
278
280
|
source: 'https://github.com/zloirock/core-js'
|
|
279
281
|
});
|
|
280
282
|
});
|
|
@@ -357,7 +359,7 @@ var documentCreateElement = function (it) {
|
|
|
357
359
|
};
|
|
358
360
|
|
|
359
361
|
// Thanks to IE8 for its funny defineProperty
|
|
360
|
-
var ie8DomDefine = !descriptors && !fails(function () {
|
|
362
|
+
var ie8DomDefine = !descriptors$1 && !fails(function () {
|
|
361
363
|
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
362
364
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
363
365
|
get: function () { return 7; }
|
|
@@ -369,7 +371,7 @@ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
|
369
371
|
|
|
370
372
|
// `Object.getOwnPropertyDescriptor` method
|
|
371
373
|
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
372
|
-
var f$5 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
374
|
+
var f$5 = descriptors$1 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
373
375
|
O = toIndexedObject(O);
|
|
374
376
|
P = toPropertyKey(P);
|
|
375
377
|
if (ie8DomDefine) try {
|
|
@@ -384,7 +386,7 @@ var objectGetOwnPropertyDescriptor = {
|
|
|
384
386
|
|
|
385
387
|
// V8 ~ Chrome 36-
|
|
386
388
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
387
|
-
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
389
|
+
var v8PrototypeDefineBug = descriptors$1 && fails(function () {
|
|
388
390
|
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
389
391
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
390
392
|
value: 42,
|
|
@@ -412,7 +414,7 @@ var WRITABLE = 'writable';
|
|
|
412
414
|
|
|
413
415
|
// `Object.defineProperty` method
|
|
414
416
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
415
|
-
var f$4 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
|
|
417
|
+
var f$4 = descriptors$1 ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
|
|
416
418
|
anObject(O);
|
|
417
419
|
P = toPropertyKey(P);
|
|
418
420
|
anObject(Attributes);
|
|
@@ -443,13 +445,28 @@ var objectDefineProperty = {
|
|
|
443
445
|
f: f$4
|
|
444
446
|
};
|
|
445
447
|
|
|
446
|
-
var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
448
|
+
var createNonEnumerableProperty = descriptors$1 ? function (object, key, value) {
|
|
447
449
|
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
|
448
450
|
} : function (object, key, value) {
|
|
449
451
|
object[key] = value;
|
|
450
452
|
return object;
|
|
451
453
|
};
|
|
452
454
|
|
|
455
|
+
var FunctionPrototype$2 = Function.prototype;
|
|
456
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
457
|
+
var getDescriptor = descriptors$1 && Object.getOwnPropertyDescriptor;
|
|
458
|
+
|
|
459
|
+
var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
|
|
460
|
+
// additional protection from minified / mangled / dropped function names
|
|
461
|
+
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
462
|
+
var CONFIGURABLE = EXISTS && (!descriptors$1 || (descriptors$1 && getDescriptor(FunctionPrototype$2, 'name').configurable));
|
|
463
|
+
|
|
464
|
+
var functionName = {
|
|
465
|
+
EXISTS: EXISTS,
|
|
466
|
+
PROPER: PROPER,
|
|
467
|
+
CONFIGURABLE: CONFIGURABLE
|
|
468
|
+
};
|
|
469
|
+
|
|
453
470
|
var functionToString$1 = functionUncurryThis(Function.toString);
|
|
454
471
|
|
|
455
472
|
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
@@ -533,50 +550,56 @@ var internalState = {
|
|
|
533
550
|
getterFor: getterFor
|
|
534
551
|
};
|
|
535
552
|
|
|
536
|
-
var
|
|
537
|
-
|
|
538
|
-
var
|
|
539
|
-
|
|
540
|
-
var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
|
|
541
|
-
// additional protection from minified / mangled / dropped function names
|
|
542
|
-
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
543
|
-
var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$2, 'name').configurable));
|
|
553
|
+
var makeBuiltIn_1 = createCommonjsModule(function (module) {
|
|
554
|
+
var defineProperty = objectDefineProperty.f;
|
|
555
|
+
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
544
556
|
|
|
545
|
-
var functionName = {
|
|
546
|
-
EXISTS: EXISTS,
|
|
547
|
-
PROPER: PROPER,
|
|
548
|
-
CONFIGURABLE: CONFIGURABLE
|
|
549
|
-
};
|
|
550
557
|
|
|
551
|
-
var redefine = createCommonjsModule(function (module) {
|
|
552
|
-
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
553
558
|
|
|
554
|
-
var getInternalState = internalState.get;
|
|
555
559
|
var enforceInternalState = internalState.enforce;
|
|
560
|
+
var getInternalState = internalState.get;
|
|
561
|
+
|
|
562
|
+
var CONFIGURABLE_LENGTH = !fails(function () {
|
|
563
|
+
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
564
|
+
});
|
|
565
|
+
|
|
556
566
|
var TEMPLATE = String(String).split('String');
|
|
557
567
|
|
|
558
|
-
|
|
568
|
+
var makeBuiltIn = module.exports = function (value, name, options) {
|
|
569
|
+
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
570
|
+
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
571
|
+
}
|
|
572
|
+
if (options && options.getter) name = 'get ' + name;
|
|
573
|
+
if (options && options.setter) name = 'set ' + name;
|
|
574
|
+
if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
|
575
|
+
defineProperty(value, 'name', { value: name, configurable: true });
|
|
576
|
+
}
|
|
577
|
+
if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
|
|
578
|
+
defineProperty(value, 'length', { value: options.arity });
|
|
579
|
+
}
|
|
580
|
+
var state = enforceInternalState(value);
|
|
581
|
+
if (!hasOwnProperty_1(state, 'source')) {
|
|
582
|
+
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
583
|
+
} return value;
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
587
|
+
// eslint-disable-next-line no-extend-native -- required
|
|
588
|
+
Function.prototype.toString = makeBuiltIn(function toString() {
|
|
589
|
+
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
590
|
+
}, 'toString');
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
var defineBuiltIn = function (O, key, value, options) {
|
|
559
594
|
var unsafe = options ? !!options.unsafe : false;
|
|
560
595
|
var simple = options ? !!options.enumerable : false;
|
|
561
596
|
var noTargetGet = options ? !!options.noTargetGet : false;
|
|
562
597
|
var name = options && options.name !== undefined ? options.name : key;
|
|
563
|
-
|
|
564
|
-
if (isCallable(value)) {
|
|
565
|
-
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
566
|
-
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
567
|
-
}
|
|
568
|
-
if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
|
569
|
-
createNonEnumerableProperty(value, 'name', name);
|
|
570
|
-
}
|
|
571
|
-
state = enforceInternalState(value);
|
|
572
|
-
if (!state.source) {
|
|
573
|
-
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
574
|
-
}
|
|
575
|
-
}
|
|
598
|
+
if (isCallable(value)) makeBuiltIn_1(value, name, options);
|
|
576
599
|
if (O === global_1) {
|
|
577
600
|
if (simple) O[key] = value;
|
|
578
601
|
else setGlobal(key, value);
|
|
579
|
-
return;
|
|
602
|
+
return O;
|
|
580
603
|
} else if (!unsafe) {
|
|
581
604
|
delete O[key];
|
|
582
605
|
} else if (!noTargetGet && O[key]) {
|
|
@@ -584,11 +607,8 @@ var TEMPLATE = String(String).split('String');
|
|
|
584
607
|
}
|
|
585
608
|
if (simple) O[key] = value;
|
|
586
609
|
else createNonEnumerableProperty(O, key, value);
|
|
587
|
-
|
|
588
|
-
}
|
|
589
|
-
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
590
|
-
});
|
|
591
|
-
});
|
|
610
|
+
return O;
|
|
611
|
+
};
|
|
592
612
|
|
|
593
613
|
var ceil = Math.ceil;
|
|
594
614
|
var floor = Math.floor;
|
|
@@ -728,7 +748,7 @@ var copyConstructorProperties = function (target, source, exceptions) {
|
|
|
728
748
|
var replacement = /#|\.prototype\./;
|
|
729
749
|
|
|
730
750
|
var isForced = function (feature, detection) {
|
|
731
|
-
var value = data[normalize(feature)];
|
|
751
|
+
var value = data$1[normalize(feature)];
|
|
732
752
|
return value == POLYFILL ? true
|
|
733
753
|
: value == NATIVE ? false
|
|
734
754
|
: isCallable(detection) ? fails(detection)
|
|
@@ -739,7 +759,7 @@ var normalize = isForced.normalize = function (string) {
|
|
|
739
759
|
return String(string).replace(replacement, '.').toLowerCase();
|
|
740
760
|
};
|
|
741
761
|
|
|
742
|
-
var data = isForced.data = {};
|
|
762
|
+
var data$1 = isForced.data = {};
|
|
743
763
|
var NATIVE = isForced.NATIVE = 'N';
|
|
744
764
|
var POLYFILL = isForced.POLYFILL = 'P';
|
|
745
765
|
|
|
@@ -795,8 +815,7 @@ var _export = function (options, source) {
|
|
|
795
815
|
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
796
816
|
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
797
817
|
}
|
|
798
|
-
|
|
799
|
-
redefine(target, key, sourceProperty, options);
|
|
818
|
+
defineBuiltIn(target, key, sourceProperty, options);
|
|
800
819
|
}
|
|
801
820
|
};
|
|
802
821
|
|
|
@@ -844,6 +863,7 @@ var toString_1 = function (argument) {
|
|
|
844
863
|
var regexpFlags = function () {
|
|
845
864
|
var that = anObject(this);
|
|
846
865
|
var result = '';
|
|
866
|
+
if (that.hasIndices) result += 'd';
|
|
847
867
|
if (that.global) result += 'g';
|
|
848
868
|
if (that.ignoreCase) result += 'i';
|
|
849
869
|
if (that.multiline) result += 'm';
|
|
@@ -891,7 +911,7 @@ var objectKeys = Object.keys || function keys(O) {
|
|
|
891
911
|
// `Object.defineProperties` method
|
|
892
912
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
893
913
|
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
894
|
-
var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
914
|
+
var f$1 = descriptors$1 && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
895
915
|
anObject(O);
|
|
896
916
|
var props = toIndexedObject(Properties);
|
|
897
917
|
var keys = objectKeys(Properties);
|
|
@@ -1199,8 +1219,8 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
|
1199
1219
|
return { done: false };
|
|
1200
1220
|
});
|
|
1201
1221
|
|
|
1202
|
-
|
|
1203
|
-
|
|
1222
|
+
defineBuiltIn(String.prototype, KEY, methods[0]);
|
|
1223
|
+
defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
|
|
1204
1224
|
}
|
|
1205
1225
|
|
|
1206
1226
|
if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
|
|
@@ -1328,7 +1348,7 @@ var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
|
1328
1348
|
// `Object.prototype.toString` method
|
|
1329
1349
|
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1330
1350
|
if (!toStringTagSupport) {
|
|
1331
|
-
|
|
1351
|
+
defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
1332
1352
|
}
|
|
1333
1353
|
|
|
1334
1354
|
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
|
@@ -1467,7 +1487,7 @@ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
|
1467
1487
|
// `Array.prototype.concat` method
|
|
1468
1488
|
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
1469
1489
|
// with adding support of @@isConcatSpreadable and @@species
|
|
1470
|
-
_export({ target: 'Array', proto: true, forced: FORCED }, {
|
|
1490
|
+
_export({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
1471
1491
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
1472
1492
|
concat: function concat(arg) {
|
|
1473
1493
|
var O = toObject(this);
|
|
@@ -1510,9 +1530,15 @@ var addToUnscopables = function (key) {
|
|
|
1510
1530
|
var $includes = arrayIncludes.includes;
|
|
1511
1531
|
|
|
1512
1532
|
|
|
1533
|
+
|
|
1534
|
+
// FF99+ bug
|
|
1535
|
+
var BROKEN_ON_SPARSE = fails(function () {
|
|
1536
|
+
return !Array(1).includes();
|
|
1537
|
+
});
|
|
1538
|
+
|
|
1513
1539
|
// `Array.prototype.includes` method
|
|
1514
1540
|
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1515
|
-
_export({ target: 'Array', proto: true }, {
|
|
1541
|
+
_export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
1516
1542
|
includes: function includes(el /* , fromIndex = 0 */) {
|
|
1517
1543
|
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
1518
1544
|
}
|
|
@@ -1624,11 +1650,6 @@ _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_I
|
|
|
1624
1650
|
|
|
1625
1651
|
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
1626
1652
|
|
|
1627
|
-
var redefineAll = function (target, src, options) {
|
|
1628
|
-
for (var key in src) redefine(target, key, src[key], options);
|
|
1629
|
-
return target;
|
|
1630
|
-
};
|
|
1631
|
-
|
|
1632
1653
|
var String$2 = global_1.String;
|
|
1633
1654
|
var TypeError$7 = global_1.TypeError;
|
|
1634
1655
|
|
|
@@ -1684,7 +1705,7 @@ var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
|
1684
1705
|
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
|
1685
1706
|
var defineProperty = objectDefineProperty.f;
|
|
1686
1707
|
|
|
1687
|
-
if (descriptors && Constructor && !Constructor[SPECIES$2]) {
|
|
1708
|
+
if (descriptors$1 && Constructor && !Constructor[SPECIES$2]) {
|
|
1688
1709
|
defineProperty(Constructor, SPECIES$2, {
|
|
1689
1710
|
configurable: true,
|
|
1690
1711
|
get: function () { return this; }
|
|
@@ -2249,23 +2270,20 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
2249
2270
|
});
|
|
2250
2271
|
};
|
|
2251
2272
|
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
});
|
|
2267
|
-
return reaction.promise;
|
|
2268
|
-
}
|
|
2273
|
+
// `Promise.prototype.then` method
|
|
2274
|
+
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
2275
|
+
Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
2276
|
+
var state = getInternalPromiseState(this);
|
|
2277
|
+
var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
|
|
2278
|
+
state.parent = true;
|
|
2279
|
+
reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
|
|
2280
|
+
reaction.fail = isCallable(onRejected) && onRejected;
|
|
2281
|
+
reaction.domain = engineIsNode ? process$1.domain : undefined;
|
|
2282
|
+
if (state.state == PENDING) state.reactions.add(reaction);
|
|
2283
|
+
else microtask(function () {
|
|
2284
|
+
callReaction(reaction, state);
|
|
2285
|
+
});
|
|
2286
|
+
return reaction.promise;
|
|
2269
2287
|
});
|
|
2270
2288
|
|
|
2271
2289
|
OwnPromiseCapability = function () {
|
|
@@ -2287,7 +2305,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
2287
2305
|
|
|
2288
2306
|
if (!NATIVE_PROMISE_SUBCLASSING) {
|
|
2289
2307
|
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
2290
|
-
|
|
2308
|
+
defineBuiltIn(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
|
|
2291
2309
|
var that = this;
|
|
2292
2310
|
return new PromiseConstructor(function (resolve, reject) {
|
|
2293
2311
|
functionCall(nativeThen, that, resolve, reject);
|
|
@@ -2510,7 +2528,7 @@ _export({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2,
|
|
|
2510
2528
|
if (isCallable(promiseNativeConstructor)) {
|
|
2511
2529
|
var method = getBuiltIn('Promise').prototype['catch'];
|
|
2512
2530
|
if (NativePromisePrototype['catch'] !== method) {
|
|
2513
|
-
|
|
2531
|
+
defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
2514
2532
|
}
|
|
2515
2533
|
}
|
|
2516
2534
|
|
|
@@ -2576,7 +2594,7 @@ var concat = functionUncurryThis([].concat);
|
|
|
2576
2594
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
2577
2595
|
var objectAssign = !$assign || fails(function () {
|
|
2578
2596
|
// should have correct order of operations (Edge bug)
|
|
2579
|
-
if (descriptors && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
|
|
2597
|
+
if (descriptors$1 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
|
|
2580
2598
|
enumerable: true,
|
|
2581
2599
|
get: function () {
|
|
2582
2600
|
defineProperty$1(this, 'b', {
|
|
@@ -2608,7 +2626,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2608
2626
|
var key;
|
|
2609
2627
|
while (length > j) {
|
|
2610
2628
|
key = keys[j++];
|
|
2611
|
-
if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
2629
|
+
if (!descriptors$1 || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
2612
2630
|
}
|
|
2613
2631
|
} return T;
|
|
2614
2632
|
} : $assign;
|
|
@@ -2616,7 +2634,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2616
2634
|
// `Object.assign` method
|
|
2617
2635
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
2618
2636
|
// eslint-disable-next-line es-x/no-object-assign -- required for testing
|
|
2619
|
-
_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
|
|
2637
|
+
_export({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== objectAssign }, {
|
|
2620
2638
|
assign: objectAssign
|
|
2621
2639
|
});
|
|
2622
2640
|
|
|
@@ -2632,7 +2650,7 @@ var NAME = 'name';
|
|
|
2632
2650
|
|
|
2633
2651
|
// Function instances `.name` property
|
|
2634
2652
|
// https://tc39.es/ecma262/#sec-function-instances-name
|
|
2635
|
-
if (descriptors && !FUNCTION_NAME_EXISTS) {
|
|
2653
|
+
if (descriptors$1 && !FUNCTION_NAME_EXISTS) {
|
|
2636
2654
|
defineProperty(FunctionPrototype, NAME, {
|
|
2637
2655
|
configurable: true,
|
|
2638
2656
|
get: function () {
|
|
@@ -2795,12 +2813,42 @@ var bind = function bind(fn, thisArg) {
|
|
|
2795
2813
|
};
|
|
2796
2814
|
};
|
|
2797
2815
|
|
|
2798
|
-
/*global toString:true*/
|
|
2799
|
-
|
|
2800
2816
|
// utils is a library of generic helper functions non-specific to axios
|
|
2801
2817
|
|
|
2802
2818
|
var toString = Object.prototype.toString;
|
|
2803
2819
|
|
|
2820
|
+
// eslint-disable-next-line func-names
|
|
2821
|
+
var kindOf = (function(cache) {
|
|
2822
|
+
// eslint-disable-next-line func-names
|
|
2823
|
+
return function(thing) {
|
|
2824
|
+
var str = toString.call(thing);
|
|
2825
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
2826
|
+
};
|
|
2827
|
+
})(Object.create(null));
|
|
2828
|
+
|
|
2829
|
+
function kindOfTest(type) {
|
|
2830
|
+
type = type.toLowerCase();
|
|
2831
|
+
return function isKindOf(thing) {
|
|
2832
|
+
return kindOf(thing) === type;
|
|
2833
|
+
};
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
/**
|
|
2837
|
+
* Array with axios supported protocols.
|
|
2838
|
+
*/
|
|
2839
|
+
var supportedProtocols = [ 'http:', 'https:', 'file:' ];
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* Returns URL protocol passed as param if is not undefined or null,
|
|
2843
|
+
* otherwise just returns 'http:'
|
|
2844
|
+
*
|
|
2845
|
+
* @param {String} protocol The String value of URL protocol
|
|
2846
|
+
* @returns {String} Protocol if the value is not undefined or null
|
|
2847
|
+
*/
|
|
2848
|
+
function getProtocol(protocol) {
|
|
2849
|
+
return protocol || 'http:';
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2804
2852
|
/**
|
|
2805
2853
|
* Determine if a value is an Array
|
|
2806
2854
|
*
|
|
@@ -2808,7 +2856,7 @@ var toString = Object.prototype.toString;
|
|
|
2808
2856
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
2809
2857
|
*/
|
|
2810
2858
|
function isArray(val) {
|
|
2811
|
-
return
|
|
2859
|
+
return Array.isArray(val);
|
|
2812
2860
|
}
|
|
2813
2861
|
|
|
2814
2862
|
/**
|
|
@@ -2835,22 +2883,12 @@ function isBuffer(val) {
|
|
|
2835
2883
|
/**
|
|
2836
2884
|
* Determine if a value is an ArrayBuffer
|
|
2837
2885
|
*
|
|
2886
|
+
* @function
|
|
2838
2887
|
* @param {Object} val The value to test
|
|
2839
2888
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
2840
2889
|
*/
|
|
2841
|
-
|
|
2842
|
-
return toString.call(val) === '[object ArrayBuffer]';
|
|
2843
|
-
}
|
|
2890
|
+
var isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
2844
2891
|
|
|
2845
|
-
/**
|
|
2846
|
-
* Determine if a value is a FormData
|
|
2847
|
-
*
|
|
2848
|
-
* @param {Object} val The value to test
|
|
2849
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
|
2850
|
-
*/
|
|
2851
|
-
function isFormData(val) {
|
|
2852
|
-
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
|
2853
|
-
}
|
|
2854
2892
|
|
|
2855
2893
|
/**
|
|
2856
2894
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -2863,7 +2901,7 @@ function isArrayBufferView(val) {
|
|
|
2863
2901
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
2864
2902
|
result = ArrayBuffer.isView(val);
|
|
2865
2903
|
} else {
|
|
2866
|
-
result = (val) && (val.buffer) && (val.buffer
|
|
2904
|
+
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
|
2867
2905
|
}
|
|
2868
2906
|
return result;
|
|
2869
2907
|
}
|
|
@@ -2905,7 +2943,7 @@ function isObject(val) {
|
|
|
2905
2943
|
* @return {boolean} True if value is a plain Object, otherwise false
|
|
2906
2944
|
*/
|
|
2907
2945
|
function isPlainObject(val) {
|
|
2908
|
-
if (
|
|
2946
|
+
if (kindOf(val) !== 'object') {
|
|
2909
2947
|
return false;
|
|
2910
2948
|
}
|
|
2911
2949
|
|
|
@@ -2916,32 +2954,38 @@ function isPlainObject(val) {
|
|
|
2916
2954
|
/**
|
|
2917
2955
|
* Determine if a value is a Date
|
|
2918
2956
|
*
|
|
2957
|
+
* @function
|
|
2919
2958
|
* @param {Object} val The value to test
|
|
2920
2959
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
2921
2960
|
*/
|
|
2922
|
-
|
|
2923
|
-
return toString.call(val) === '[object Date]';
|
|
2924
|
-
}
|
|
2961
|
+
var isDate = kindOfTest('Date');
|
|
2925
2962
|
|
|
2926
2963
|
/**
|
|
2927
2964
|
* Determine if a value is a File
|
|
2928
2965
|
*
|
|
2966
|
+
* @function
|
|
2929
2967
|
* @param {Object} val The value to test
|
|
2930
2968
|
* @returns {boolean} True if value is a File, otherwise false
|
|
2931
2969
|
*/
|
|
2932
|
-
|
|
2933
|
-
return toString.call(val) === '[object File]';
|
|
2934
|
-
}
|
|
2970
|
+
var isFile = kindOfTest('File');
|
|
2935
2971
|
|
|
2936
2972
|
/**
|
|
2937
2973
|
* Determine if a value is a Blob
|
|
2938
2974
|
*
|
|
2975
|
+
* @function
|
|
2939
2976
|
* @param {Object} val The value to test
|
|
2940
2977
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
2941
2978
|
*/
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2979
|
+
var isBlob = kindOfTest('Blob');
|
|
2980
|
+
|
|
2981
|
+
/**
|
|
2982
|
+
* Determine if a value is a FileList
|
|
2983
|
+
*
|
|
2984
|
+
* @function
|
|
2985
|
+
* @param {Object} val The value to test
|
|
2986
|
+
* @returns {boolean} True if value is a File, otherwise false
|
|
2987
|
+
*/
|
|
2988
|
+
var isFileList = kindOfTest('FileList');
|
|
2945
2989
|
|
|
2946
2990
|
/**
|
|
2947
2991
|
* Determine if a value is a Function
|
|
@@ -2964,14 +3008,27 @@ function isStream(val) {
|
|
|
2964
3008
|
}
|
|
2965
3009
|
|
|
2966
3010
|
/**
|
|
2967
|
-
* Determine if a value is a
|
|
3011
|
+
* Determine if a value is a FormData
|
|
2968
3012
|
*
|
|
3013
|
+
* @param {Object} thing The value to test
|
|
3014
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
|
3015
|
+
*/
|
|
3016
|
+
function isFormData(thing) {
|
|
3017
|
+
var pattern = '[object FormData]';
|
|
3018
|
+
return thing && (
|
|
3019
|
+
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
3020
|
+
toString.call(thing) === pattern ||
|
|
3021
|
+
(isFunction(thing.toString) && thing.toString() === pattern)
|
|
3022
|
+
);
|
|
3023
|
+
}
|
|
3024
|
+
|
|
3025
|
+
/**
|
|
3026
|
+
* Determine if a value is a URLSearchParams object
|
|
3027
|
+
* @function
|
|
2969
3028
|
* @param {Object} val The value to test
|
|
2970
3029
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
2971
3030
|
*/
|
|
2972
|
-
|
|
2973
|
-
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
|
2974
|
-
}
|
|
3031
|
+
var isURLSearchParams = kindOfTest('URLSearchParams');
|
|
2975
3032
|
|
|
2976
3033
|
/**
|
|
2977
3034
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -2980,7 +3037,7 @@ function isURLSearchParams(val) {
|
|
|
2980
3037
|
* @returns {String} The String freed of excess whitespace
|
|
2981
3038
|
*/
|
|
2982
3039
|
function trim(str) {
|
|
2983
|
-
return str.
|
|
3040
|
+
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
|
2984
3041
|
}
|
|
2985
3042
|
|
|
2986
3043
|
/**
|
|
@@ -3118,7 +3175,97 @@ function stripBOM(content) {
|
|
|
3118
3175
|
return content;
|
|
3119
3176
|
}
|
|
3120
3177
|
|
|
3178
|
+
/**
|
|
3179
|
+
* Inherit the prototype methods from one constructor into another
|
|
3180
|
+
* @param {function} constructor
|
|
3181
|
+
* @param {function} superConstructor
|
|
3182
|
+
* @param {object} [props]
|
|
3183
|
+
* @param {object} [descriptors]
|
|
3184
|
+
*/
|
|
3185
|
+
|
|
3186
|
+
function inherits(constructor, superConstructor, props, descriptors) {
|
|
3187
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
3188
|
+
constructor.prototype.constructor = constructor;
|
|
3189
|
+
props && Object.assign(constructor.prototype, props);
|
|
3190
|
+
}
|
|
3191
|
+
|
|
3192
|
+
/**
|
|
3193
|
+
* Resolve object with deep prototype chain to a flat object
|
|
3194
|
+
* @param {Object} sourceObj source object
|
|
3195
|
+
* @param {Object} [destObj]
|
|
3196
|
+
* @param {Function} [filter]
|
|
3197
|
+
* @returns {Object}
|
|
3198
|
+
*/
|
|
3199
|
+
|
|
3200
|
+
function toFlatObject(sourceObj, destObj, filter) {
|
|
3201
|
+
var props;
|
|
3202
|
+
var i;
|
|
3203
|
+
var prop;
|
|
3204
|
+
var merged = {};
|
|
3205
|
+
|
|
3206
|
+
destObj = destObj || {};
|
|
3207
|
+
|
|
3208
|
+
do {
|
|
3209
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
3210
|
+
i = props.length;
|
|
3211
|
+
while (i-- > 0) {
|
|
3212
|
+
prop = props[i];
|
|
3213
|
+
if (!merged[prop]) {
|
|
3214
|
+
destObj[prop] = sourceObj[prop];
|
|
3215
|
+
merged[prop] = true;
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
sourceObj = Object.getPrototypeOf(sourceObj);
|
|
3219
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
3220
|
+
|
|
3221
|
+
return destObj;
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
/*
|
|
3225
|
+
* determines whether a string ends with the characters of a specified string
|
|
3226
|
+
* @param {String} str
|
|
3227
|
+
* @param {String} searchString
|
|
3228
|
+
* @param {Number} [position= 0]
|
|
3229
|
+
* @returns {boolean}
|
|
3230
|
+
*/
|
|
3231
|
+
function endsWith(str, searchString, position) {
|
|
3232
|
+
str = String(str);
|
|
3233
|
+
if (position === undefined || position > str.length) {
|
|
3234
|
+
position = str.length;
|
|
3235
|
+
}
|
|
3236
|
+
position -= searchString.length;
|
|
3237
|
+
var lastIndex = str.indexOf(searchString, position);
|
|
3238
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
3239
|
+
}
|
|
3240
|
+
|
|
3241
|
+
|
|
3242
|
+
/**
|
|
3243
|
+
* Returns new array from array like object
|
|
3244
|
+
* @param {*} [thing]
|
|
3245
|
+
* @returns {Array}
|
|
3246
|
+
*/
|
|
3247
|
+
function toArray(thing) {
|
|
3248
|
+
if (!thing) return null;
|
|
3249
|
+
var i = thing.length;
|
|
3250
|
+
if (isUndefined(i)) return null;
|
|
3251
|
+
var arr = new Array(i);
|
|
3252
|
+
while (i-- > 0) {
|
|
3253
|
+
arr[i] = thing[i];
|
|
3254
|
+
}
|
|
3255
|
+
return arr;
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
// eslint-disable-next-line func-names
|
|
3259
|
+
var isTypedArray = (function(TypedArray) {
|
|
3260
|
+
// eslint-disable-next-line func-names
|
|
3261
|
+
return function(thing) {
|
|
3262
|
+
return TypedArray && thing instanceof TypedArray;
|
|
3263
|
+
};
|
|
3264
|
+
})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
|
|
3265
|
+
|
|
3121
3266
|
var utils = {
|
|
3267
|
+
supportedProtocols: supportedProtocols,
|
|
3268
|
+
getProtocol: getProtocol,
|
|
3122
3269
|
isArray: isArray,
|
|
3123
3270
|
isArrayBuffer: isArrayBuffer,
|
|
3124
3271
|
isBuffer: isBuffer,
|
|
@@ -3140,7 +3287,15 @@ var utils = {
|
|
|
3140
3287
|
merge: merge,
|
|
3141
3288
|
extend: extend,
|
|
3142
3289
|
trim: trim,
|
|
3143
|
-
stripBOM: stripBOM
|
|
3290
|
+
stripBOM: stripBOM,
|
|
3291
|
+
inherits: inherits,
|
|
3292
|
+
toFlatObject: toFlatObject,
|
|
3293
|
+
kindOf: kindOf,
|
|
3294
|
+
kindOfTest: kindOfTest,
|
|
3295
|
+
endsWith: endsWith,
|
|
3296
|
+
toArray: toArray,
|
|
3297
|
+
isTypedArray: isTypedArray,
|
|
3298
|
+
isFileList: isFileList
|
|
3144
3299
|
};
|
|
3145
3300
|
|
|
3146
3301
|
function encode(val) {
|
|
@@ -3222,10 +3377,12 @@ function InterceptorManager() {
|
|
|
3222
3377
|
*
|
|
3223
3378
|
* @return {Number} An ID used to remove interceptor later
|
|
3224
3379
|
*/
|
|
3225
|
-
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
|
3380
|
+
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
|
3226
3381
|
this.handlers.push({
|
|
3227
3382
|
fulfilled: fulfilled,
|
|
3228
|
-
rejected: rejected
|
|
3383
|
+
rejected: rejected,
|
|
3384
|
+
synchronous: options ? options.synchronous : false,
|
|
3385
|
+
runWhen: options ? options.runWhen : null
|
|
3229
3386
|
});
|
|
3230
3387
|
return this.handlers.length - 1;
|
|
3231
3388
|
};
|
|
@@ -3259,27 +3416,6 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
|
3259
3416
|
|
|
3260
3417
|
var InterceptorManager_1 = InterceptorManager;
|
|
3261
3418
|
|
|
3262
|
-
/**
|
|
3263
|
-
* Transform the data for a request or a response
|
|
3264
|
-
*
|
|
3265
|
-
* @param {Object|String} data The data to be transformed
|
|
3266
|
-
* @param {Array} headers The headers for the request or response
|
|
3267
|
-
* @param {Array|Function} fns A single function or Array of functions
|
|
3268
|
-
* @returns {*} The resulting transformed data
|
|
3269
|
-
*/
|
|
3270
|
-
var transformData = function transformData(data, headers, fns) {
|
|
3271
|
-
/*eslint no-param-reassign:0*/
|
|
3272
|
-
utils.forEach(fns, function transform(fn) {
|
|
3273
|
-
data = fn(data, headers);
|
|
3274
|
-
});
|
|
3275
|
-
|
|
3276
|
-
return data;
|
|
3277
|
-
};
|
|
3278
|
-
|
|
3279
|
-
var isCancel = function isCancel(value) {
|
|
3280
|
-
return !!(value && value.__CANCEL__);
|
|
3281
|
-
};
|
|
3282
|
-
|
|
3283
3419
|
var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
|
|
3284
3420
|
utils.forEach(headers, function processHeader(value, name) {
|
|
3285
3421
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
@@ -3290,26 +3426,27 @@ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName)
|
|
|
3290
3426
|
};
|
|
3291
3427
|
|
|
3292
3428
|
/**
|
|
3293
|
-
*
|
|
3429
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
3294
3430
|
*
|
|
3295
|
-
* @param {
|
|
3296
|
-
* @param {Object} config The config.
|
|
3431
|
+
* @param {string} message The error message.
|
|
3297
3432
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
3433
|
+
* @param {Object} [config] The config.
|
|
3298
3434
|
* @param {Object} [request] The request.
|
|
3299
3435
|
* @param {Object} [response] The response.
|
|
3300
|
-
* @returns {Error} The error.
|
|
3436
|
+
* @returns {Error} The created error.
|
|
3301
3437
|
*/
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3438
|
+
function AxiosError(message, code, config, request, response) {
|
|
3439
|
+
Error.call(this);
|
|
3440
|
+
this.message = message;
|
|
3441
|
+
this.name = 'AxiosError';
|
|
3442
|
+
code && (this.code = code);
|
|
3443
|
+
config && (this.config = config);
|
|
3444
|
+
request && (this.request = request);
|
|
3445
|
+
response && (this.response = response);
|
|
3446
|
+
}
|
|
3311
3447
|
|
|
3312
|
-
|
|
3448
|
+
utils.inherits(AxiosError, Error, {
|
|
3449
|
+
toJSON: function toJSON() {
|
|
3313
3450
|
return {
|
|
3314
3451
|
// Standard
|
|
3315
3452
|
message: this.message,
|
|
@@ -3324,26 +3461,130 @@ var enhanceError = function enhanceError(error, config, code, request, response)
|
|
|
3324
3461
|
stack: this.stack,
|
|
3325
3462
|
// Axios
|
|
3326
3463
|
config: this.config,
|
|
3327
|
-
code: this.code
|
|
3464
|
+
code: this.code,
|
|
3465
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
3328
3466
|
};
|
|
3329
|
-
}
|
|
3330
|
-
|
|
3467
|
+
}
|
|
3468
|
+
});
|
|
3469
|
+
|
|
3470
|
+
var prototype = AxiosError.prototype;
|
|
3471
|
+
var descriptors = {};
|
|
3472
|
+
|
|
3473
|
+
[
|
|
3474
|
+
'ERR_BAD_OPTION_VALUE',
|
|
3475
|
+
'ERR_BAD_OPTION',
|
|
3476
|
+
'ECONNABORTED',
|
|
3477
|
+
'ETIMEDOUT',
|
|
3478
|
+
'ERR_NETWORK',
|
|
3479
|
+
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
3480
|
+
'ERR_DEPRECATED',
|
|
3481
|
+
'ERR_BAD_RESPONSE',
|
|
3482
|
+
'ERR_BAD_REQUEST',
|
|
3483
|
+
'ERR_CANCELED'
|
|
3484
|
+
// eslint-disable-next-line func-names
|
|
3485
|
+
].forEach(function(code) {
|
|
3486
|
+
descriptors[code] = {value: code};
|
|
3487
|
+
});
|
|
3488
|
+
|
|
3489
|
+
Object.defineProperties(AxiosError, descriptors);
|
|
3490
|
+
Object.defineProperty(prototype, 'isAxiosError', {value: true});
|
|
3491
|
+
|
|
3492
|
+
// eslint-disable-next-line func-names
|
|
3493
|
+
AxiosError.from = function(error, code, config, request, response, customProps) {
|
|
3494
|
+
var axiosError = Object.create(prototype);
|
|
3495
|
+
|
|
3496
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
3497
|
+
return obj !== Error.prototype;
|
|
3498
|
+
});
|
|
3499
|
+
|
|
3500
|
+
AxiosError.call(axiosError, error.message, code, config, request, response);
|
|
3501
|
+
|
|
3502
|
+
axiosError.name = error.name;
|
|
3503
|
+
|
|
3504
|
+
customProps && Object.assign(axiosError, customProps);
|
|
3505
|
+
|
|
3506
|
+
return axiosError;
|
|
3331
3507
|
};
|
|
3332
3508
|
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
* @param {Object} [request] The request.
|
|
3340
|
-
* @param {Object} [response] The response.
|
|
3341
|
-
* @returns {Error} The created error.
|
|
3342
|
-
*/
|
|
3343
|
-
var createError = function createError(message, config, code, request, response) {
|
|
3344
|
-
var error = new Error(message);
|
|
3345
|
-
return enhanceError(error, config, code, request, response);
|
|
3509
|
+
var AxiosError_1 = AxiosError;
|
|
3510
|
+
|
|
3511
|
+
var transitional = {
|
|
3512
|
+
silentJSONParsing: true,
|
|
3513
|
+
forcedJSONParsing: true,
|
|
3514
|
+
clarifyTimeoutError: false
|
|
3346
3515
|
};
|
|
3516
|
+
transitional.silentJSONParsing;
|
|
3517
|
+
transitional.forcedJSONParsing;
|
|
3518
|
+
transitional.clarifyTimeoutError;
|
|
3519
|
+
|
|
3520
|
+
/**
|
|
3521
|
+
* Convert a data object to FormData
|
|
3522
|
+
* @param {Object} obj
|
|
3523
|
+
* @param {?Object} [formData]
|
|
3524
|
+
* @returns {Object}
|
|
3525
|
+
**/
|
|
3526
|
+
|
|
3527
|
+
function toFormData(obj, formData) {
|
|
3528
|
+
// eslint-disable-next-line no-param-reassign
|
|
3529
|
+
formData = formData || new FormData();
|
|
3530
|
+
|
|
3531
|
+
var stack = [];
|
|
3532
|
+
|
|
3533
|
+
function convertValue(value) {
|
|
3534
|
+
if (value === null) return '';
|
|
3535
|
+
|
|
3536
|
+
if (utils.isDate(value)) {
|
|
3537
|
+
return value.toISOString();
|
|
3538
|
+
}
|
|
3539
|
+
|
|
3540
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
3541
|
+
return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
3542
|
+
}
|
|
3543
|
+
|
|
3544
|
+
return value;
|
|
3545
|
+
}
|
|
3546
|
+
|
|
3547
|
+
function build(data, parentKey) {
|
|
3548
|
+
if (utils.isPlainObject(data) || utils.isArray(data)) {
|
|
3549
|
+
if (stack.indexOf(data) !== -1) {
|
|
3550
|
+
throw Error('Circular reference detected in ' + parentKey);
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
stack.push(data);
|
|
3554
|
+
|
|
3555
|
+
utils.forEach(data, function each(value, key) {
|
|
3556
|
+
if (utils.isUndefined(value)) return;
|
|
3557
|
+
var fullKey = parentKey ? parentKey + '.' + key : key;
|
|
3558
|
+
var arr;
|
|
3559
|
+
|
|
3560
|
+
if (value && !parentKey && typeof value === 'object') {
|
|
3561
|
+
if (utils.endsWith(key, '{}')) {
|
|
3562
|
+
// eslint-disable-next-line no-param-reassign
|
|
3563
|
+
value = JSON.stringify(value);
|
|
3564
|
+
} else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
|
|
3565
|
+
// eslint-disable-next-line func-names
|
|
3566
|
+
arr.forEach(function(el) {
|
|
3567
|
+
!utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
|
|
3568
|
+
});
|
|
3569
|
+
return;
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
|
|
3573
|
+
build(value, fullKey);
|
|
3574
|
+
});
|
|
3575
|
+
|
|
3576
|
+
stack.pop();
|
|
3577
|
+
} else {
|
|
3578
|
+
formData.append(parentKey, convertValue(data));
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
|
|
3582
|
+
build(obj);
|
|
3583
|
+
|
|
3584
|
+
return formData;
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3587
|
+
var toFormData_1 = toFormData;
|
|
3347
3588
|
|
|
3348
3589
|
/**
|
|
3349
3590
|
* Resolve or reject a Promise based on response status.
|
|
@@ -3357,10 +3598,10 @@ var settle = function settle(resolve, reject, response) {
|
|
|
3357
3598
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
3358
3599
|
resolve(response);
|
|
3359
3600
|
} else {
|
|
3360
|
-
reject(
|
|
3601
|
+
reject(new AxiosError_1(
|
|
3361
3602
|
'Request failed with status code ' + response.status,
|
|
3603
|
+
[AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
3362
3604
|
response.config,
|
|
3363
|
-
null,
|
|
3364
3605
|
response.request,
|
|
3365
3606
|
response
|
|
3366
3607
|
));
|
|
@@ -3427,7 +3668,7 @@ var isAbsoluteURL = function isAbsoluteURL(url) {
|
|
|
3427
3668
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
3428
3669
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
3429
3670
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
3430
|
-
return /^([a-z][a-z\d
|
|
3671
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
3431
3672
|
};
|
|
3432
3673
|
|
|
3433
3674
|
/**
|
|
@@ -3574,13 +3815,38 @@ var isURLSameOrigin = (
|
|
|
3574
3815
|
})()
|
|
3575
3816
|
);
|
|
3576
3817
|
|
|
3818
|
+
/**
|
|
3819
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
3820
|
+
*
|
|
3821
|
+
* @class
|
|
3822
|
+
* @param {string=} message The message.
|
|
3823
|
+
*/
|
|
3824
|
+
function CanceledError(message) {
|
|
3825
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
3826
|
+
AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED);
|
|
3827
|
+
this.name = 'CanceledError';
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
utils.inherits(CanceledError, AxiosError_1, {
|
|
3831
|
+
__CANCEL__: true
|
|
3832
|
+
});
|
|
3833
|
+
|
|
3834
|
+
var CanceledError_1 = CanceledError;
|
|
3835
|
+
|
|
3577
3836
|
var xhr = function xhrAdapter(config) {
|
|
3578
3837
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3579
3838
|
var requestData = config.data;
|
|
3580
3839
|
var requestHeaders = config.headers;
|
|
3840
|
+
var responseType = config.responseType;
|
|
3841
|
+
var onCanceled;
|
|
3842
|
+
function done() {
|
|
3843
|
+
if (config.cancelToken) {
|
|
3844
|
+
config.cancelToken.unsubscribe(onCanceled);
|
|
3845
|
+
}
|
|
3581
3846
|
|
|
3582
|
-
|
|
3583
|
-
|
|
3847
|
+
if (config.signal) {
|
|
3848
|
+
config.signal.removeEventListener('abort', onCanceled);
|
|
3849
|
+
}
|
|
3584
3850
|
}
|
|
3585
3851
|
|
|
3586
3852
|
var request = new XMLHttpRequest();
|
|
@@ -3593,28 +3859,22 @@ var xhr = function xhrAdapter(config) {
|
|
|
3593
3859
|
}
|
|
3594
3860
|
|
|
3595
3861
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
3862
|
+
var parsed = url.parse(fullPath);
|
|
3863
|
+
var protocol = utils.getProtocol(parsed.protocol);
|
|
3864
|
+
|
|
3596
3865
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
3597
3866
|
|
|
3598
3867
|
// Set the request timeout in MS
|
|
3599
3868
|
request.timeout = config.timeout;
|
|
3600
3869
|
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
if (!request || request.readyState !== 4) {
|
|
3604
|
-
return;
|
|
3605
|
-
}
|
|
3606
|
-
|
|
3607
|
-
// The request errored out and we didn't get a response, this will be
|
|
3608
|
-
// handled by onerror instead
|
|
3609
|
-
// With one exception: request that using file: protocol, most browsers
|
|
3610
|
-
// will return status as 0 even though it's a successful request
|
|
3611
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
3870
|
+
function onloadend() {
|
|
3871
|
+
if (!request) {
|
|
3612
3872
|
return;
|
|
3613
3873
|
}
|
|
3614
|
-
|
|
3615
3874
|
// Prepare the response
|
|
3616
3875
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
|
3617
|
-
var responseData = !
|
|
3876
|
+
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
3877
|
+
request.responseText : request.response;
|
|
3618
3878
|
var response = {
|
|
3619
3879
|
data: responseData,
|
|
3620
3880
|
status: request.status,
|
|
@@ -3624,11 +3884,40 @@ var xhr = function xhrAdapter(config) {
|
|
|
3624
3884
|
request: request
|
|
3625
3885
|
};
|
|
3626
3886
|
|
|
3627
|
-
settle(
|
|
3887
|
+
settle(function _resolve(value) {
|
|
3888
|
+
resolve(value);
|
|
3889
|
+
done();
|
|
3890
|
+
}, function _reject(err) {
|
|
3891
|
+
reject(err);
|
|
3892
|
+
done();
|
|
3893
|
+
}, response);
|
|
3628
3894
|
|
|
3629
3895
|
// Clean up request
|
|
3630
3896
|
request = null;
|
|
3631
|
-
}
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3899
|
+
if ('onloadend' in request) {
|
|
3900
|
+
// Use onloadend if available
|
|
3901
|
+
request.onloadend = onloadend;
|
|
3902
|
+
} else {
|
|
3903
|
+
// Listen for ready state to emulate onloadend
|
|
3904
|
+
request.onreadystatechange = function handleLoad() {
|
|
3905
|
+
if (!request || request.readyState !== 4) {
|
|
3906
|
+
return;
|
|
3907
|
+
}
|
|
3908
|
+
|
|
3909
|
+
// The request errored out and we didn't get a response, this will be
|
|
3910
|
+
// handled by onerror instead
|
|
3911
|
+
// With one exception: request that using file: protocol, most browsers
|
|
3912
|
+
// will return status as 0 even though it's a successful request
|
|
3913
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
3914
|
+
return;
|
|
3915
|
+
}
|
|
3916
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
3917
|
+
// so we should call onloadend on the next 'tick'
|
|
3918
|
+
setTimeout(onloadend);
|
|
3919
|
+
};
|
|
3920
|
+
}
|
|
3632
3921
|
|
|
3633
3922
|
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
3634
3923
|
request.onabort = function handleAbort() {
|
|
@@ -3636,7 +3925,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
3636
3925
|
return;
|
|
3637
3926
|
}
|
|
3638
3927
|
|
|
3639
|
-
reject(
|
|
3928
|
+
reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
|
|
3640
3929
|
|
|
3641
3930
|
// Clean up request
|
|
3642
3931
|
request = null;
|
|
@@ -3646,7 +3935,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
3646
3935
|
request.onerror = function handleError() {
|
|
3647
3936
|
// Real errors are hidden from us by the browser
|
|
3648
3937
|
// onerror should only fire if it's a network error
|
|
3649
|
-
reject(
|
|
3938
|
+
reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request, request));
|
|
3650
3939
|
|
|
3651
3940
|
// Clean up request
|
|
3652
3941
|
request = null;
|
|
@@ -3654,11 +3943,15 @@ var xhr = function xhrAdapter(config) {
|
|
|
3654
3943
|
|
|
3655
3944
|
// Handle timeout
|
|
3656
3945
|
request.ontimeout = function handleTimeout() {
|
|
3657
|
-
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
|
3946
|
+
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
3947
|
+
var transitional$1 = config.transitional || transitional;
|
|
3658
3948
|
if (config.timeoutErrorMessage) {
|
|
3659
3949
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
3660
3950
|
}
|
|
3661
|
-
reject(
|
|
3951
|
+
reject(new AxiosError_1(
|
|
3952
|
+
timeoutErrorMessage,
|
|
3953
|
+
transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
|
|
3954
|
+
config,
|
|
3662
3955
|
request));
|
|
3663
3956
|
|
|
3664
3957
|
// Clean up request
|
|
@@ -3698,16 +3991,8 @@ var xhr = function xhrAdapter(config) {
|
|
|
3698
3991
|
}
|
|
3699
3992
|
|
|
3700
3993
|
// Add responseType to request if needed
|
|
3701
|
-
if (
|
|
3702
|
-
|
|
3703
|
-
request.responseType = config.responseType;
|
|
3704
|
-
} catch (e) {
|
|
3705
|
-
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
|
|
3706
|
-
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
|
|
3707
|
-
if (config.responseType !== 'json') {
|
|
3708
|
-
throw e;
|
|
3709
|
-
}
|
|
3710
|
-
}
|
|
3994
|
+
if (responseType && responseType !== 'json') {
|
|
3995
|
+
request.responseType = config.responseType;
|
|
3711
3996
|
}
|
|
3712
3997
|
|
|
3713
3998
|
// Handle progress if needed
|
|
@@ -3720,29 +4005,46 @@ var xhr = function xhrAdapter(config) {
|
|
|
3720
4005
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
3721
4006
|
}
|
|
3722
4007
|
|
|
3723
|
-
if (config.cancelToken) {
|
|
4008
|
+
if (config.cancelToken || config.signal) {
|
|
3724
4009
|
// Handle cancellation
|
|
3725
|
-
|
|
4010
|
+
// eslint-disable-next-line func-names
|
|
4011
|
+
onCanceled = function(cancel) {
|
|
3726
4012
|
if (!request) {
|
|
3727
4013
|
return;
|
|
3728
4014
|
}
|
|
3729
|
-
|
|
4015
|
+
reject(!cancel || (cancel && cancel.type) ? new CanceledError_1() : cancel);
|
|
3730
4016
|
request.abort();
|
|
3731
|
-
reject(cancel);
|
|
3732
|
-
// Clean up request
|
|
3733
4017
|
request = null;
|
|
3734
|
-
}
|
|
4018
|
+
};
|
|
4019
|
+
|
|
4020
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
4021
|
+
if (config.signal) {
|
|
4022
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
4023
|
+
}
|
|
3735
4024
|
}
|
|
3736
4025
|
|
|
3737
4026
|
if (!requestData) {
|
|
3738
4027
|
requestData = null;
|
|
3739
4028
|
}
|
|
3740
4029
|
|
|
4030
|
+
if (parsed.path === null) {
|
|
4031
|
+
reject(new AxiosError_1('Malformed URL ' + fullPath, AxiosError_1.ERR_BAD_REQUEST, config));
|
|
4032
|
+
return;
|
|
4033
|
+
}
|
|
4034
|
+
|
|
4035
|
+
if (!utils.supportedProtocols.includes(protocol)) {
|
|
4036
|
+
reject(new AxiosError_1('Unsupported protocol ' + protocol, AxiosError_1.ERR_BAD_REQUEST, config));
|
|
4037
|
+
return;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
3741
4040
|
// Send the request
|
|
3742
4041
|
request.send(requestData);
|
|
3743
4042
|
});
|
|
3744
4043
|
};
|
|
3745
4044
|
|
|
4045
|
+
// eslint-disable-next-line strict
|
|
4046
|
+
var _null = null;
|
|
4047
|
+
|
|
3746
4048
|
var DEFAULT_CONTENT_TYPE = {
|
|
3747
4049
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
3748
4050
|
};
|
|
@@ -3765,12 +4067,31 @@ function getDefaultAdapter() {
|
|
|
3765
4067
|
return adapter;
|
|
3766
4068
|
}
|
|
3767
4069
|
|
|
4070
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
4071
|
+
if (utils.isString(rawValue)) {
|
|
4072
|
+
try {
|
|
4073
|
+
(parser || JSON.parse)(rawValue);
|
|
4074
|
+
return utils.trim(rawValue);
|
|
4075
|
+
} catch (e) {
|
|
4076
|
+
if (e.name !== 'SyntaxError') {
|
|
4077
|
+
throw e;
|
|
4078
|
+
}
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
|
|
4082
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
4083
|
+
}
|
|
4084
|
+
|
|
3768
4085
|
var defaults = {
|
|
4086
|
+
|
|
4087
|
+
transitional: transitional,
|
|
4088
|
+
|
|
3769
4089
|
adapter: getDefaultAdapter(),
|
|
3770
4090
|
|
|
3771
4091
|
transformRequest: [function transformRequest(data, headers) {
|
|
3772
4092
|
normalizeHeaderName(headers, 'Accept');
|
|
3773
4093
|
normalizeHeaderName(headers, 'Content-Type');
|
|
4094
|
+
|
|
3774
4095
|
if (utils.isFormData(data) ||
|
|
3775
4096
|
utils.isArrayBuffer(data) ||
|
|
3776
4097
|
utils.isBuffer(data) ||
|
|
@@ -3787,20 +4108,42 @@ var defaults = {
|
|
|
3787
4108
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
3788
4109
|
return data.toString();
|
|
3789
4110
|
}
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
4111
|
+
|
|
4112
|
+
var isObjectPayload = utils.isObject(data);
|
|
4113
|
+
var contentType = headers && headers['Content-Type'];
|
|
4114
|
+
|
|
4115
|
+
var isFileList;
|
|
4116
|
+
|
|
4117
|
+
if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
|
|
4118
|
+
var _FormData = this.env && this.env.FormData;
|
|
4119
|
+
return toFormData_1(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
|
|
4120
|
+
} else if (isObjectPayload || contentType === 'application/json') {
|
|
4121
|
+
setContentTypeIfUnset(headers, 'application/json');
|
|
4122
|
+
return stringifySafely(data);
|
|
3793
4123
|
}
|
|
4124
|
+
|
|
3794
4125
|
return data;
|
|
3795
4126
|
}],
|
|
3796
4127
|
|
|
3797
4128
|
transformResponse: [function transformResponse(data) {
|
|
3798
|
-
|
|
3799
|
-
|
|
4129
|
+
var transitional = this.transitional || defaults.transitional;
|
|
4130
|
+
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
4131
|
+
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
4132
|
+
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
4133
|
+
|
|
4134
|
+
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
|
|
3800
4135
|
try {
|
|
3801
|
-
|
|
3802
|
-
} catch (e) {
|
|
4136
|
+
return JSON.parse(data);
|
|
4137
|
+
} catch (e) {
|
|
4138
|
+
if (strictJSONParsing) {
|
|
4139
|
+
if (e.name === 'SyntaxError') {
|
|
4140
|
+
throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
4141
|
+
}
|
|
4142
|
+
throw e;
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
3803
4145
|
}
|
|
4146
|
+
|
|
3804
4147
|
return data;
|
|
3805
4148
|
}],
|
|
3806
4149
|
|
|
@@ -3816,14 +4159,18 @@ var defaults = {
|
|
|
3816
4159
|
maxContentLength: -1,
|
|
3817
4160
|
maxBodyLength: -1,
|
|
3818
4161
|
|
|
4162
|
+
env: {
|
|
4163
|
+
FormData: _null
|
|
4164
|
+
},
|
|
4165
|
+
|
|
3819
4166
|
validateStatus: function validateStatus(status) {
|
|
3820
4167
|
return status >= 200 && status < 300;
|
|
3821
|
-
}
|
|
3822
|
-
};
|
|
4168
|
+
},
|
|
3823
4169
|
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
4170
|
+
headers: {
|
|
4171
|
+
common: {
|
|
4172
|
+
'Accept': 'application/json, text/plain, */*'
|
|
4173
|
+
}
|
|
3827
4174
|
}
|
|
3828
4175
|
};
|
|
3829
4176
|
|
|
@@ -3838,12 +4185,38 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
3838
4185
|
var defaults_1 = defaults;
|
|
3839
4186
|
|
|
3840
4187
|
/**
|
|
3841
|
-
*
|
|
4188
|
+
* Transform the data for a request or a response
|
|
4189
|
+
*
|
|
4190
|
+
* @param {Object|String} data The data to be transformed
|
|
4191
|
+
* @param {Array} headers The headers for the request or response
|
|
4192
|
+
* @param {Array|Function} fns A single function or Array of functions
|
|
4193
|
+
* @returns {*} The resulting transformed data
|
|
4194
|
+
*/
|
|
4195
|
+
var transformData = function transformData(data, headers, fns) {
|
|
4196
|
+
var context = this || defaults_1;
|
|
4197
|
+
/*eslint no-param-reassign:0*/
|
|
4198
|
+
utils.forEach(fns, function transform(fn) {
|
|
4199
|
+
data = fn.call(context, data, headers);
|
|
4200
|
+
});
|
|
4201
|
+
|
|
4202
|
+
return data;
|
|
4203
|
+
};
|
|
4204
|
+
|
|
4205
|
+
var isCancel = function isCancel(value) {
|
|
4206
|
+
return !!(value && value.__CANCEL__);
|
|
4207
|
+
};
|
|
4208
|
+
|
|
4209
|
+
/**
|
|
4210
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
3842
4211
|
*/
|
|
3843
4212
|
function throwIfCancellationRequested(config) {
|
|
3844
4213
|
if (config.cancelToken) {
|
|
3845
4214
|
config.cancelToken.throwIfRequested();
|
|
3846
4215
|
}
|
|
4216
|
+
|
|
4217
|
+
if (config.signal && config.signal.aborted) {
|
|
4218
|
+
throw new CanceledError_1();
|
|
4219
|
+
}
|
|
3847
4220
|
}
|
|
3848
4221
|
|
|
3849
4222
|
/**
|
|
@@ -3859,7 +4232,8 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
3859
4232
|
config.headers = config.headers || {};
|
|
3860
4233
|
|
|
3861
4234
|
// Transform request data
|
|
3862
|
-
config.data = transformData(
|
|
4235
|
+
config.data = transformData.call(
|
|
4236
|
+
config,
|
|
3863
4237
|
config.data,
|
|
3864
4238
|
config.headers,
|
|
3865
4239
|
config.transformRequest
|
|
@@ -3885,7 +4259,8 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
3885
4259
|
throwIfCancellationRequested(config);
|
|
3886
4260
|
|
|
3887
4261
|
// Transform response data
|
|
3888
|
-
response.data = transformData(
|
|
4262
|
+
response.data = transformData.call(
|
|
4263
|
+
config,
|
|
3889
4264
|
response.data,
|
|
3890
4265
|
response.headers,
|
|
3891
4266
|
config.transformResponse
|
|
@@ -3898,7 +4273,8 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
3898
4273
|
|
|
3899
4274
|
// Transform response data
|
|
3900
4275
|
if (reason && reason.response) {
|
|
3901
|
-
reason.response.data = transformData(
|
|
4276
|
+
reason.response.data = transformData.call(
|
|
4277
|
+
config,
|
|
3902
4278
|
reason.response.data,
|
|
3903
4279
|
reason.response.headers,
|
|
3904
4280
|
config.transformResponse
|
|
@@ -3923,17 +4299,6 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
3923
4299
|
config2 = config2 || {};
|
|
3924
4300
|
var config = {};
|
|
3925
4301
|
|
|
3926
|
-
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
|
3927
|
-
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
|
3928
|
-
var defaultToConfig2Keys = [
|
|
3929
|
-
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
|
3930
|
-
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
|
3931
|
-
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
|
3932
|
-
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
|
3933
|
-
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
|
3934
|
-
];
|
|
3935
|
-
var directMergeKeys = ['validateStatus'];
|
|
3936
|
-
|
|
3937
4302
|
function getMergedValue(target, source) {
|
|
3938
4303
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
3939
4304
|
return utils.merge(target, source);
|
|
@@ -3945,55 +4310,169 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
3945
4310
|
return source;
|
|
3946
4311
|
}
|
|
3947
4312
|
|
|
4313
|
+
// eslint-disable-next-line consistent-return
|
|
3948
4314
|
function mergeDeepProperties(prop) {
|
|
3949
4315
|
if (!utils.isUndefined(config2[prop])) {
|
|
3950
|
-
|
|
4316
|
+
return getMergedValue(config1[prop], config2[prop]);
|
|
3951
4317
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
3952
|
-
|
|
4318
|
+
return getMergedValue(undefined, config1[prop]);
|
|
3953
4319
|
}
|
|
3954
4320
|
}
|
|
3955
4321
|
|
|
3956
|
-
|
|
4322
|
+
// eslint-disable-next-line consistent-return
|
|
4323
|
+
function valueFromConfig2(prop) {
|
|
3957
4324
|
if (!utils.isUndefined(config2[prop])) {
|
|
3958
|
-
|
|
4325
|
+
return getMergedValue(undefined, config2[prop]);
|
|
3959
4326
|
}
|
|
3960
|
-
}
|
|
3961
|
-
|
|
3962
|
-
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
4327
|
+
}
|
|
3963
4328
|
|
|
3964
|
-
|
|
4329
|
+
// eslint-disable-next-line consistent-return
|
|
4330
|
+
function defaultToConfig2(prop) {
|
|
3965
4331
|
if (!utils.isUndefined(config2[prop])) {
|
|
3966
|
-
|
|
4332
|
+
return getMergedValue(undefined, config2[prop]);
|
|
3967
4333
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
3968
|
-
|
|
4334
|
+
return getMergedValue(undefined, config1[prop]);
|
|
3969
4335
|
}
|
|
3970
|
-
}
|
|
4336
|
+
}
|
|
3971
4337
|
|
|
3972
|
-
|
|
4338
|
+
// eslint-disable-next-line consistent-return
|
|
4339
|
+
function mergeDirectKeys(prop) {
|
|
3973
4340
|
if (prop in config2) {
|
|
3974
|
-
|
|
4341
|
+
return getMergedValue(config1[prop], config2[prop]);
|
|
3975
4342
|
} else if (prop in config1) {
|
|
3976
|
-
|
|
4343
|
+
return getMergedValue(undefined, config1[prop]);
|
|
3977
4344
|
}
|
|
4345
|
+
}
|
|
4346
|
+
|
|
4347
|
+
var mergeMap = {
|
|
4348
|
+
'url': valueFromConfig2,
|
|
4349
|
+
'method': valueFromConfig2,
|
|
4350
|
+
'data': valueFromConfig2,
|
|
4351
|
+
'baseURL': defaultToConfig2,
|
|
4352
|
+
'transformRequest': defaultToConfig2,
|
|
4353
|
+
'transformResponse': defaultToConfig2,
|
|
4354
|
+
'paramsSerializer': defaultToConfig2,
|
|
4355
|
+
'timeout': defaultToConfig2,
|
|
4356
|
+
'timeoutMessage': defaultToConfig2,
|
|
4357
|
+
'withCredentials': defaultToConfig2,
|
|
4358
|
+
'adapter': defaultToConfig2,
|
|
4359
|
+
'responseType': defaultToConfig2,
|
|
4360
|
+
'xsrfCookieName': defaultToConfig2,
|
|
4361
|
+
'xsrfHeaderName': defaultToConfig2,
|
|
4362
|
+
'onUploadProgress': defaultToConfig2,
|
|
4363
|
+
'onDownloadProgress': defaultToConfig2,
|
|
4364
|
+
'decompress': defaultToConfig2,
|
|
4365
|
+
'maxContentLength': defaultToConfig2,
|
|
4366
|
+
'maxBodyLength': defaultToConfig2,
|
|
4367
|
+
'beforeRedirect': defaultToConfig2,
|
|
4368
|
+
'transport': defaultToConfig2,
|
|
4369
|
+
'httpAgent': defaultToConfig2,
|
|
4370
|
+
'httpsAgent': defaultToConfig2,
|
|
4371
|
+
'cancelToken': defaultToConfig2,
|
|
4372
|
+
'socketPath': defaultToConfig2,
|
|
4373
|
+
'responseEncoding': defaultToConfig2,
|
|
4374
|
+
'validateStatus': mergeDirectKeys
|
|
4375
|
+
};
|
|
4376
|
+
|
|
4377
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
4378
|
+
var merge = mergeMap[prop] || mergeDeepProperties;
|
|
4379
|
+
var configValue = merge(prop);
|
|
4380
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
3978
4381
|
});
|
|
3979
4382
|
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
.concat(defaultToConfig2Keys)
|
|
3983
|
-
.concat(directMergeKeys);
|
|
4383
|
+
return config;
|
|
4384
|
+
};
|
|
3984
4385
|
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
.filter(function filterAxiosKeys(key) {
|
|
3989
|
-
return axiosKeys.indexOf(key) === -1;
|
|
3990
|
-
});
|
|
4386
|
+
var data = {
|
|
4387
|
+
"version": "0.27.0"
|
|
4388
|
+
};
|
|
3991
4389
|
|
|
3992
|
-
|
|
4390
|
+
var VERSION = data.version;
|
|
3993
4391
|
|
|
3994
|
-
|
|
4392
|
+
|
|
4393
|
+
var validators$1 = {};
|
|
4394
|
+
|
|
4395
|
+
// eslint-disable-next-line func-names
|
|
4396
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
|
|
4397
|
+
validators$1[type] = function validator(thing) {
|
|
4398
|
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
4399
|
+
};
|
|
4400
|
+
});
|
|
4401
|
+
|
|
4402
|
+
var deprecatedWarnings = {};
|
|
4403
|
+
|
|
4404
|
+
/**
|
|
4405
|
+
* Transitional option validator
|
|
4406
|
+
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|
4407
|
+
* @param {string?} version - deprecated version / removed since version
|
|
4408
|
+
* @param {string?} message - some message with additional info
|
|
4409
|
+
* @returns {function}
|
|
4410
|
+
*/
|
|
4411
|
+
validators$1.transitional = function transitional(validator, version, message) {
|
|
4412
|
+
function formatMessage(opt, desc) {
|
|
4413
|
+
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
4414
|
+
}
|
|
4415
|
+
|
|
4416
|
+
// eslint-disable-next-line func-names
|
|
4417
|
+
return function(value, opt, opts) {
|
|
4418
|
+
if (validator === false) {
|
|
4419
|
+
throw new AxiosError_1(
|
|
4420
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
4421
|
+
AxiosError_1.ERR_DEPRECATED
|
|
4422
|
+
);
|
|
4423
|
+
}
|
|
4424
|
+
|
|
4425
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
4426
|
+
deprecatedWarnings[opt] = true;
|
|
4427
|
+
// eslint-disable-next-line no-console
|
|
4428
|
+
console.warn(
|
|
4429
|
+
formatMessage(
|
|
4430
|
+
opt,
|
|
4431
|
+
' has been deprecated since v' + version + ' and will be removed in the near future'
|
|
4432
|
+
)
|
|
4433
|
+
);
|
|
4434
|
+
}
|
|
4435
|
+
|
|
4436
|
+
return validator ? validator(value, opt, opts) : true;
|
|
4437
|
+
};
|
|
3995
4438
|
};
|
|
3996
4439
|
|
|
4440
|
+
/**
|
|
4441
|
+
* Assert object's properties type
|
|
4442
|
+
* @param {object} options
|
|
4443
|
+
* @param {object} schema
|
|
4444
|
+
* @param {boolean?} allowUnknown
|
|
4445
|
+
*/
|
|
4446
|
+
|
|
4447
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
4448
|
+
if (typeof options !== 'object') {
|
|
4449
|
+
throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
|
|
4450
|
+
}
|
|
4451
|
+
var keys = Object.keys(options);
|
|
4452
|
+
var i = keys.length;
|
|
4453
|
+
while (i-- > 0) {
|
|
4454
|
+
var opt = keys[i];
|
|
4455
|
+
var validator = schema[opt];
|
|
4456
|
+
if (validator) {
|
|
4457
|
+
var value = options[opt];
|
|
4458
|
+
var result = value === undefined || validator(value, opt, options);
|
|
4459
|
+
if (result !== true) {
|
|
4460
|
+
throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
|
|
4461
|
+
}
|
|
4462
|
+
continue;
|
|
4463
|
+
}
|
|
4464
|
+
if (allowUnknown !== true) {
|
|
4465
|
+
throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
|
|
4466
|
+
}
|
|
4467
|
+
}
|
|
4468
|
+
}
|
|
4469
|
+
|
|
4470
|
+
var validator = {
|
|
4471
|
+
assertOptions: assertOptions,
|
|
4472
|
+
validators: validators$1
|
|
4473
|
+
};
|
|
4474
|
+
|
|
4475
|
+
var validators = validator.validators;
|
|
3997
4476
|
/**
|
|
3998
4477
|
* Create a new instance of Axios
|
|
3999
4478
|
*
|
|
@@ -4012,14 +4491,14 @@ function Axios(instanceConfig) {
|
|
|
4012
4491
|
*
|
|
4013
4492
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
|
4014
4493
|
*/
|
|
4015
|
-
Axios.prototype.request = function request(config) {
|
|
4494
|
+
Axios.prototype.request = function request(configOrUrl, config) {
|
|
4016
4495
|
/*eslint no-param-reassign:0*/
|
|
4017
4496
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
4018
|
-
if (typeof
|
|
4019
|
-
config = arguments[1] || {};
|
|
4020
|
-
config.url = arguments[0];
|
|
4021
|
-
} else {
|
|
4497
|
+
if (typeof configOrUrl === 'string') {
|
|
4022
4498
|
config = config || {};
|
|
4499
|
+
config.url = configOrUrl;
|
|
4500
|
+
} else {
|
|
4501
|
+
config = configOrUrl || {};
|
|
4023
4502
|
}
|
|
4024
4503
|
|
|
4025
4504
|
config = mergeConfig(this.defaults, config);
|
|
@@ -4033,20 +4512,71 @@ Axios.prototype.request = function request(config) {
|
|
|
4033
4512
|
config.method = 'get';
|
|
4034
4513
|
}
|
|
4035
4514
|
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4515
|
+
var transitional = config.transitional;
|
|
4516
|
+
|
|
4517
|
+
if (transitional !== undefined) {
|
|
4518
|
+
validator.assertOptions(transitional, {
|
|
4519
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
4520
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
4521
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
4522
|
+
}, false);
|
|
4523
|
+
}
|
|
4039
4524
|
|
|
4525
|
+
// filter out skipped interceptors
|
|
4526
|
+
var requestInterceptorChain = [];
|
|
4527
|
+
var synchronousRequestInterceptors = true;
|
|
4040
4528
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
4041
|
-
|
|
4529
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
4530
|
+
return;
|
|
4531
|
+
}
|
|
4532
|
+
|
|
4533
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
4534
|
+
|
|
4535
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
4042
4536
|
});
|
|
4043
4537
|
|
|
4538
|
+
var responseInterceptorChain = [];
|
|
4044
4539
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
4045
|
-
|
|
4540
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
4046
4541
|
});
|
|
4047
4542
|
|
|
4048
|
-
|
|
4049
|
-
|
|
4543
|
+
var promise;
|
|
4544
|
+
|
|
4545
|
+
if (!synchronousRequestInterceptors) {
|
|
4546
|
+
var chain = [dispatchRequest, undefined];
|
|
4547
|
+
|
|
4548
|
+
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
4549
|
+
chain = chain.concat(responseInterceptorChain);
|
|
4550
|
+
|
|
4551
|
+
promise = Promise.resolve(config);
|
|
4552
|
+
while (chain.length) {
|
|
4553
|
+
promise = promise.then(chain.shift(), chain.shift());
|
|
4554
|
+
}
|
|
4555
|
+
|
|
4556
|
+
return promise;
|
|
4557
|
+
}
|
|
4558
|
+
|
|
4559
|
+
|
|
4560
|
+
var newConfig = config;
|
|
4561
|
+
while (requestInterceptorChain.length) {
|
|
4562
|
+
var onFulfilled = requestInterceptorChain.shift();
|
|
4563
|
+
var onRejected = requestInterceptorChain.shift();
|
|
4564
|
+
try {
|
|
4565
|
+
newConfig = onFulfilled(newConfig);
|
|
4566
|
+
} catch (error) {
|
|
4567
|
+
onRejected(error);
|
|
4568
|
+
break;
|
|
4569
|
+
}
|
|
4570
|
+
}
|
|
4571
|
+
|
|
4572
|
+
try {
|
|
4573
|
+
promise = dispatchRequest(newConfig);
|
|
4574
|
+
} catch (error) {
|
|
4575
|
+
return Promise.reject(error);
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4578
|
+
while (responseInterceptorChain.length) {
|
|
4579
|
+
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
4050
4580
|
}
|
|
4051
4581
|
|
|
4052
4582
|
return promise;
|
|
@@ -4054,7 +4584,8 @@ Axios.prototype.request = function request(config) {
|
|
|
4054
4584
|
|
|
4055
4585
|
Axios.prototype.getUri = function getUri(config) {
|
|
4056
4586
|
config = mergeConfig(this.defaults, config);
|
|
4057
|
-
|
|
4587
|
+
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
4588
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
4058
4589
|
};
|
|
4059
4590
|
|
|
4060
4591
|
// Provide aliases for supported request methods
|
|
@@ -4071,34 +4602,26 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
|
4071
4602
|
|
|
4072
4603
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4073
4604
|
/*eslint func-names:0*/
|
|
4074
|
-
Axios.prototype[method] = function(url, data, config) {
|
|
4075
|
-
return this.request(mergeConfig(config || {}, {
|
|
4076
|
-
method: method,
|
|
4077
|
-
url: url,
|
|
4078
|
-
data: data
|
|
4079
|
-
}));
|
|
4080
|
-
};
|
|
4081
|
-
});
|
|
4082
4605
|
|
|
4083
|
-
|
|
4606
|
+
function generateHTTPMethod(isForm) {
|
|
4607
|
+
return function httpMethod(url, data, config) {
|
|
4608
|
+
return this.request(mergeConfig(config || {}, {
|
|
4609
|
+
method: method,
|
|
4610
|
+
headers: isForm ? {
|
|
4611
|
+
'Content-Type': 'multipart/form-data'
|
|
4612
|
+
} : {},
|
|
4613
|
+
url: url,
|
|
4614
|
+
data: data
|
|
4615
|
+
}));
|
|
4616
|
+
};
|
|
4617
|
+
}
|
|
4084
4618
|
|
|
4085
|
-
|
|
4086
|
-
* A `Cancel` is an object that is thrown when an operation is canceled.
|
|
4087
|
-
*
|
|
4088
|
-
* @class
|
|
4089
|
-
* @param {string=} message The message.
|
|
4090
|
-
*/
|
|
4091
|
-
function Cancel(message) {
|
|
4092
|
-
this.message = message;
|
|
4093
|
-
}
|
|
4619
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
4094
4620
|
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
};
|
|
4098
|
-
|
|
4099
|
-
Cancel.prototype.__CANCEL__ = true;
|
|
4621
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4622
|
+
});
|
|
4100
4623
|
|
|
4101
|
-
var
|
|
4624
|
+
var Axios_1 = Axios;
|
|
4102
4625
|
|
|
4103
4626
|
/**
|
|
4104
4627
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
@@ -4112,24 +4635,55 @@ function CancelToken(executor) {
|
|
|
4112
4635
|
}
|
|
4113
4636
|
|
|
4114
4637
|
var resolvePromise;
|
|
4638
|
+
|
|
4115
4639
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
4116
4640
|
resolvePromise = resolve;
|
|
4117
4641
|
});
|
|
4118
4642
|
|
|
4119
4643
|
var token = this;
|
|
4644
|
+
|
|
4645
|
+
// eslint-disable-next-line func-names
|
|
4646
|
+
this.promise.then(function(cancel) {
|
|
4647
|
+
if (!token._listeners) return;
|
|
4648
|
+
|
|
4649
|
+
var i;
|
|
4650
|
+
var l = token._listeners.length;
|
|
4651
|
+
|
|
4652
|
+
for (i = 0; i < l; i++) {
|
|
4653
|
+
token._listeners[i](cancel);
|
|
4654
|
+
}
|
|
4655
|
+
token._listeners = null;
|
|
4656
|
+
});
|
|
4657
|
+
|
|
4658
|
+
// eslint-disable-next-line func-names
|
|
4659
|
+
this.promise.then = function(onfulfilled) {
|
|
4660
|
+
var _resolve;
|
|
4661
|
+
// eslint-disable-next-line func-names
|
|
4662
|
+
var promise = new Promise(function(resolve) {
|
|
4663
|
+
token.subscribe(resolve);
|
|
4664
|
+
_resolve = resolve;
|
|
4665
|
+
}).then(onfulfilled);
|
|
4666
|
+
|
|
4667
|
+
promise.cancel = function reject() {
|
|
4668
|
+
token.unsubscribe(_resolve);
|
|
4669
|
+
};
|
|
4670
|
+
|
|
4671
|
+
return promise;
|
|
4672
|
+
};
|
|
4673
|
+
|
|
4120
4674
|
executor(function cancel(message) {
|
|
4121
4675
|
if (token.reason) {
|
|
4122
4676
|
// Cancellation has already been requested
|
|
4123
4677
|
return;
|
|
4124
4678
|
}
|
|
4125
4679
|
|
|
4126
|
-
token.reason = new
|
|
4680
|
+
token.reason = new CanceledError_1(message);
|
|
4127
4681
|
resolvePromise(token.reason);
|
|
4128
4682
|
});
|
|
4129
4683
|
}
|
|
4130
4684
|
|
|
4131
4685
|
/**
|
|
4132
|
-
* Throws a `
|
|
4686
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
4133
4687
|
*/
|
|
4134
4688
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
4135
4689
|
if (this.reason) {
|
|
@@ -4137,6 +4691,37 @@ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
|
4137
4691
|
}
|
|
4138
4692
|
};
|
|
4139
4693
|
|
|
4694
|
+
/**
|
|
4695
|
+
* Subscribe to the cancel signal
|
|
4696
|
+
*/
|
|
4697
|
+
|
|
4698
|
+
CancelToken.prototype.subscribe = function subscribe(listener) {
|
|
4699
|
+
if (this.reason) {
|
|
4700
|
+
listener(this.reason);
|
|
4701
|
+
return;
|
|
4702
|
+
}
|
|
4703
|
+
|
|
4704
|
+
if (this._listeners) {
|
|
4705
|
+
this._listeners.push(listener);
|
|
4706
|
+
} else {
|
|
4707
|
+
this._listeners = [listener];
|
|
4708
|
+
}
|
|
4709
|
+
};
|
|
4710
|
+
|
|
4711
|
+
/**
|
|
4712
|
+
* Unsubscribe from the cancel signal
|
|
4713
|
+
*/
|
|
4714
|
+
|
|
4715
|
+
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
|
4716
|
+
if (!this._listeners) {
|
|
4717
|
+
return;
|
|
4718
|
+
}
|
|
4719
|
+
var index = this._listeners.indexOf(listener);
|
|
4720
|
+
if (index !== -1) {
|
|
4721
|
+
this._listeners.splice(index, 1);
|
|
4722
|
+
}
|
|
4723
|
+
};
|
|
4724
|
+
|
|
4140
4725
|
/**
|
|
4141
4726
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
4142
4727
|
* cancels the `CancelToken`.
|
|
@@ -4187,7 +4772,7 @@ var spread = function spread(callback) {
|
|
|
4187
4772
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
4188
4773
|
*/
|
|
4189
4774
|
var isAxiosError = function isAxiosError(payload) {
|
|
4190
|
-
return (
|
|
4775
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
4191
4776
|
};
|
|
4192
4777
|
|
|
4193
4778
|
/**
|
|
@@ -4206,6 +4791,11 @@ function createInstance(defaultConfig) {
|
|
|
4206
4791
|
// Copy context to instance
|
|
4207
4792
|
utils.extend(instance, context);
|
|
4208
4793
|
|
|
4794
|
+
// Factory for creating new instances
|
|
4795
|
+
instance.create = function create(instanceConfig) {
|
|
4796
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
4797
|
+
};
|
|
4798
|
+
|
|
4209
4799
|
return instance;
|
|
4210
4800
|
}
|
|
4211
4801
|
|
|
@@ -4215,15 +4805,18 @@ var axios$1 = createInstance(defaults_1);
|
|
|
4215
4805
|
// Expose Axios class to allow class inheritance
|
|
4216
4806
|
axios$1.Axios = Axios_1;
|
|
4217
4807
|
|
|
4218
|
-
// Factory for creating new instances
|
|
4219
|
-
axios$1.create = function create(instanceConfig) {
|
|
4220
|
-
return createInstance(mergeConfig(axios$1.defaults, instanceConfig));
|
|
4221
|
-
};
|
|
4222
|
-
|
|
4223
4808
|
// Expose Cancel & CancelToken
|
|
4224
|
-
axios$1.
|
|
4809
|
+
axios$1.CanceledError = CanceledError_1;
|
|
4225
4810
|
axios$1.CancelToken = CancelToken_1;
|
|
4226
4811
|
axios$1.isCancel = isCancel;
|
|
4812
|
+
axios$1.VERSION = data.version;
|
|
4813
|
+
axios$1.toFormData = toFormData_1;
|
|
4814
|
+
|
|
4815
|
+
// Expose AxiosError class
|
|
4816
|
+
axios$1.AxiosError = AxiosError_1;
|
|
4817
|
+
|
|
4818
|
+
// alias for CanceledError for backward compatibility
|
|
4819
|
+
axios$1.Cancel = axios$1.CanceledError;
|
|
4227
4820
|
|
|
4228
4821
|
// Expose all/spread
|
|
4229
4822
|
axios$1.all = function all(promises) {
|
|
@@ -4243,14 +4836,14 @@ axios_1.default = default_1;
|
|
|
4243
4836
|
var axios = axios_1;
|
|
4244
4837
|
|
|
4245
4838
|
var name$1 = "@tryghost/content-api";
|
|
4246
|
-
var version = "1.9.
|
|
4839
|
+
var version = "1.9.4";
|
|
4247
4840
|
var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
|
|
4248
4841
|
var author = "Ghost Foundation";
|
|
4249
4842
|
var license = "MIT";
|
|
4250
4843
|
var main = "cjs/content-api.js";
|
|
4251
4844
|
var unpkg = "umd/content-api.min.js";
|
|
4252
4845
|
var module = "es/content-api.js";
|
|
4253
|
-
var source = "lib/
|
|
4846
|
+
var source = "lib/content-api.js";
|
|
4254
4847
|
var files = [
|
|
4255
4848
|
"LICENSE",
|
|
4256
4849
|
"README.md",
|
|
@@ -4272,27 +4865,27 @@ var publishConfig = {
|
|
|
4272
4865
|
access: "public"
|
|
4273
4866
|
};
|
|
4274
4867
|
var devDependencies = {
|
|
4275
|
-
"@babel/core": "7.17.
|
|
4868
|
+
"@babel/core": "7.17.10",
|
|
4276
4869
|
"@babel/polyfill": "7.12.1",
|
|
4277
|
-
"@babel/preset-env": "7.
|
|
4870
|
+
"@babel/preset-env": "7.17.10",
|
|
4278
4871
|
"@rollup/plugin-json": "4.1.0",
|
|
4279
|
-
c8: "7.11.
|
|
4280
|
-
"core-js": "3.22.
|
|
4281
|
-
"eslint-plugin-ghost": "
|
|
4282
|
-
mocha: "
|
|
4283
|
-
rollup: "2.
|
|
4872
|
+
c8: "7.11.2",
|
|
4873
|
+
"core-js": "3.22.4",
|
|
4874
|
+
"eslint-plugin-ghost": "2.13.0",
|
|
4875
|
+
mocha: "10.0.0",
|
|
4876
|
+
rollup: "2.72.1",
|
|
4284
4877
|
"rollup-plugin-babel": "4.4.0",
|
|
4285
4878
|
"rollup-plugin-commonjs": "10.1.0",
|
|
4286
4879
|
"rollup-plugin-node-resolve": "5.2.0",
|
|
4287
4880
|
"rollup-plugin-replace": "2.2.0",
|
|
4288
4881
|
"rollup-plugin-terser": "7.0.2",
|
|
4289
4882
|
should: "13.2.3",
|
|
4290
|
-
sinon: "
|
|
4883
|
+
sinon: "14.0.0"
|
|
4291
4884
|
};
|
|
4292
4885
|
var dependencies = {
|
|
4293
|
-
axios: "^0.
|
|
4886
|
+
axios: "^0.27.0"
|
|
4294
4887
|
};
|
|
4295
|
-
var gitHead = "
|
|
4888
|
+
var gitHead = "2f7fb1fef3f2464f000974c8e0e13e25eabd6f6d";
|
|
4296
4889
|
var packageInfo = {
|
|
4297
4890
|
name: name$1,
|
|
4298
4891
|
version: version,
|