@tryghost/content-api 1.9.2 → 1.9.5
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 +5 -5
- package/es/content-api.js +610 -362
- package/es/content-api.js.map +1 -1
- package/package.json +5 -5
- 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, {
|
|
@@ -19,10 +21,6 @@ function createCommonjsModule(fn, module) {
|
|
|
19
21
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
function getCjsExportFromNamespace (n) {
|
|
23
|
-
return n && n['default'] || n;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
24
|
var check = function (it) {
|
|
27
25
|
return it && it.Math == Math && it;
|
|
28
26
|
};
|
|
@@ -47,7 +45,7 @@ var fails = function (exec) {
|
|
|
47
45
|
};
|
|
48
46
|
|
|
49
47
|
// Detect IE8's incomplete defineProperty implementation
|
|
50
|
-
var descriptors = !fails(function () {
|
|
48
|
+
var descriptors$1 = !fails(function () {
|
|
51
49
|
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
52
50
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
53
51
|
});
|
|
@@ -167,26 +165,26 @@ var process$4 = global_1.process;
|
|
|
167
165
|
var Deno$1 = global_1.Deno;
|
|
168
166
|
var versions = process$4 && process$4.versions || Deno$1 && Deno$1.version;
|
|
169
167
|
var v8 = versions && versions.v8;
|
|
170
|
-
var match, version$
|
|
168
|
+
var match, version$1;
|
|
171
169
|
|
|
172
170
|
if (v8) {
|
|
173
171
|
match = v8.split('.');
|
|
174
172
|
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
175
173
|
// but their correct versions are not interesting for us
|
|
176
|
-
version$
|
|
174
|
+
version$1 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
177
175
|
}
|
|
178
176
|
|
|
179
177
|
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
180
178
|
// so check `userAgent` even if `.v8` exists, but 0
|
|
181
|
-
if (!version$
|
|
179
|
+
if (!version$1 && engineUserAgent) {
|
|
182
180
|
match = engineUserAgent.match(/Edge\/(\d+)/);
|
|
183
181
|
if (!match || match[1] >= 74) {
|
|
184
182
|
match = engineUserAgent.match(/Chrome\/(\d+)/);
|
|
185
|
-
if (match) version$
|
|
183
|
+
if (match) version$1 = +match[1];
|
|
186
184
|
}
|
|
187
185
|
}
|
|
188
186
|
|
|
189
|
-
var engineV8Version = version$
|
|
187
|
+
var engineV8Version = version$1;
|
|
190
188
|
|
|
191
189
|
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
192
190
|
|
|
@@ -275,10 +273,10 @@ var shared = createCommonjsModule(function (module) {
|
|
|
275
273
|
(module.exports = function (key, value) {
|
|
276
274
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
277
275
|
})('versions', []).push({
|
|
278
|
-
version: '3.22.
|
|
276
|
+
version: '3.22.5',
|
|
279
277
|
mode: 'global',
|
|
280
278
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
281
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.22.
|
|
279
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.5/LICENSE',
|
|
282
280
|
source: 'https://github.com/zloirock/core-js'
|
|
283
281
|
});
|
|
284
282
|
});
|
|
@@ -361,7 +359,7 @@ var documentCreateElement = function (it) {
|
|
|
361
359
|
};
|
|
362
360
|
|
|
363
361
|
// Thanks to IE8 for its funny defineProperty
|
|
364
|
-
var ie8DomDefine = !descriptors && !fails(function () {
|
|
362
|
+
var ie8DomDefine = !descriptors$1 && !fails(function () {
|
|
365
363
|
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
366
364
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
367
365
|
get: function () { return 7; }
|
|
@@ -373,7 +371,7 @@ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
|
373
371
|
|
|
374
372
|
// `Object.getOwnPropertyDescriptor` method
|
|
375
373
|
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
376
|
-
var f$5 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
374
|
+
var f$5 = descriptors$1 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
377
375
|
O = toIndexedObject(O);
|
|
378
376
|
P = toPropertyKey(P);
|
|
379
377
|
if (ie8DomDefine) try {
|
|
@@ -388,7 +386,7 @@ var objectGetOwnPropertyDescriptor = {
|
|
|
388
386
|
|
|
389
387
|
// V8 ~ Chrome 36-
|
|
390
388
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
391
|
-
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
389
|
+
var v8PrototypeDefineBug = descriptors$1 && fails(function () {
|
|
392
390
|
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
393
391
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
394
392
|
value: 42,
|
|
@@ -416,7 +414,7 @@ var WRITABLE = 'writable';
|
|
|
416
414
|
|
|
417
415
|
// `Object.defineProperty` method
|
|
418
416
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
419
|
-
var f$4 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
|
|
417
|
+
var f$4 = descriptors$1 ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
|
|
420
418
|
anObject(O);
|
|
421
419
|
P = toPropertyKey(P);
|
|
422
420
|
anObject(Attributes);
|
|
@@ -447,7 +445,7 @@ var objectDefineProperty = {
|
|
|
447
445
|
f: f$4
|
|
448
446
|
};
|
|
449
447
|
|
|
450
|
-
var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
448
|
+
var createNonEnumerableProperty = descriptors$1 ? function (object, key, value) {
|
|
451
449
|
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
|
452
450
|
} : function (object, key, value) {
|
|
453
451
|
object[key] = value;
|
|
@@ -456,12 +454,12 @@ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
|
456
454
|
|
|
457
455
|
var FunctionPrototype$2 = Function.prototype;
|
|
458
456
|
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
459
|
-
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
457
|
+
var getDescriptor = descriptors$1 && Object.getOwnPropertyDescriptor;
|
|
460
458
|
|
|
461
459
|
var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
|
|
462
460
|
// additional protection from minified / mangled / dropped function names
|
|
463
461
|
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
464
|
-
var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$2, 'name').configurable));
|
|
462
|
+
var CONFIGURABLE = EXISTS && (!descriptors$1 || (descriptors$1 && getDescriptor(FunctionPrototype$2, 'name').configurable));
|
|
465
463
|
|
|
466
464
|
var functionName = {
|
|
467
465
|
EXISTS: EXISTS,
|
|
@@ -553,15 +551,16 @@ var internalState = {
|
|
|
553
551
|
};
|
|
554
552
|
|
|
555
553
|
var makeBuiltIn_1 = createCommonjsModule(function (module) {
|
|
556
|
-
var defineProperty = objectDefineProperty.f;
|
|
557
554
|
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
558
555
|
|
|
559
556
|
|
|
560
557
|
|
|
561
558
|
var enforceInternalState = internalState.enforce;
|
|
562
559
|
var getInternalState = internalState.get;
|
|
560
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
561
|
+
var defineProperty = Object.defineProperty;
|
|
563
562
|
|
|
564
|
-
var CONFIGURABLE_LENGTH = !fails(function () {
|
|
563
|
+
var CONFIGURABLE_LENGTH = descriptors$1 && !fails(function () {
|
|
565
564
|
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
566
565
|
});
|
|
567
566
|
|
|
@@ -579,6 +578,11 @@ var makeBuiltIn = module.exports = function (value, name, options) {
|
|
|
579
578
|
if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
|
|
580
579
|
defineProperty(value, 'length', { value: options.arity });
|
|
581
580
|
}
|
|
581
|
+
if (options && hasOwnProperty_1(options, 'constructor') && options.constructor) {
|
|
582
|
+
if (descriptors$1) try {
|
|
583
|
+
defineProperty(value, 'prototype', { writable: false });
|
|
584
|
+
} catch (error) { /* empty */ }
|
|
585
|
+
} else value.prototype = undefined;
|
|
582
586
|
var state = enforceInternalState(value);
|
|
583
587
|
if (!hasOwnProperty_1(state, 'source')) {
|
|
584
588
|
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
@@ -750,7 +754,7 @@ var copyConstructorProperties = function (target, source, exceptions) {
|
|
|
750
754
|
var replacement = /#|\.prototype\./;
|
|
751
755
|
|
|
752
756
|
var isForced = function (feature, detection) {
|
|
753
|
-
var value = data[normalize(feature)];
|
|
757
|
+
var value = data$1[normalize(feature)];
|
|
754
758
|
return value == POLYFILL ? true
|
|
755
759
|
: value == NATIVE ? false
|
|
756
760
|
: isCallable(detection) ? fails(detection)
|
|
@@ -761,7 +765,7 @@ var normalize = isForced.normalize = function (string) {
|
|
|
761
765
|
return String(string).replace(replacement, '.').toLowerCase();
|
|
762
766
|
};
|
|
763
767
|
|
|
764
|
-
var data = isForced.data = {};
|
|
768
|
+
var data$1 = isForced.data = {};
|
|
765
769
|
var NATIVE = isForced.NATIVE = 'N';
|
|
766
770
|
var POLYFILL = isForced.POLYFILL = 'P';
|
|
767
771
|
|
|
@@ -913,7 +917,7 @@ var objectKeys = Object.keys || function keys(O) {
|
|
|
913
917
|
// `Object.defineProperties` method
|
|
914
918
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
915
919
|
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
916
|
-
var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
920
|
+
var f$1 = descriptors$1 && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
917
921
|
anObject(O);
|
|
918
922
|
var props = toIndexedObject(Properties);
|
|
919
923
|
var keys = objectKeys(Properties);
|
|
@@ -1707,7 +1711,7 @@ var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
|
1707
1711
|
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
|
1708
1712
|
var defineProperty = objectDefineProperty.f;
|
|
1709
1713
|
|
|
1710
|
-
if (descriptors && Constructor && !Constructor[SPECIES$2]) {
|
|
1714
|
+
if (descriptors$1 && Constructor && !Constructor[SPECIES$2]) {
|
|
1711
1715
|
defineProperty(Constructor, SPECIES$2, {
|
|
1712
1716
|
configurable: true,
|
|
1713
1717
|
get: function () { return this; }
|
|
@@ -2328,7 +2332,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
|
2328
2332
|
}
|
|
2329
2333
|
}
|
|
2330
2334
|
|
|
2331
|
-
_export({ global: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
2335
|
+
_export({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
2332
2336
|
Promise: PromiseConstructor
|
|
2333
2337
|
});
|
|
2334
2338
|
|
|
@@ -2596,7 +2600,7 @@ var concat = functionUncurryThis([].concat);
|
|
|
2596
2600
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
2597
2601
|
var objectAssign = !$assign || fails(function () {
|
|
2598
2602
|
// should have correct order of operations (Edge bug)
|
|
2599
|
-
if (descriptors && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
|
|
2603
|
+
if (descriptors$1 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
|
|
2600
2604
|
enumerable: true,
|
|
2601
2605
|
get: function () {
|
|
2602
2606
|
defineProperty$1(this, 'b', {
|
|
@@ -2628,7 +2632,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2628
2632
|
var key;
|
|
2629
2633
|
while (length > j) {
|
|
2630
2634
|
key = keys[j++];
|
|
2631
|
-
if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
2635
|
+
if (!descriptors$1 || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
2632
2636
|
}
|
|
2633
2637
|
} return T;
|
|
2634
2638
|
} : $assign;
|
|
@@ -2652,7 +2656,7 @@ var NAME = 'name';
|
|
|
2652
2656
|
|
|
2653
2657
|
// Function instances `.name` property
|
|
2654
2658
|
// https://tc39.es/ecma262/#sec-function-instances-name
|
|
2655
|
-
if (descriptors && !FUNCTION_NAME_EXISTS) {
|
|
2659
|
+
if (descriptors$1 && !FUNCTION_NAME_EXISTS) {
|
|
2656
2660
|
defineProperty(FunctionPrototype, NAME, {
|
|
2657
2661
|
configurable: true,
|
|
2658
2662
|
get: function () {
|
|
@@ -2819,6 +2823,38 @@ var bind = function bind(fn, thisArg) {
|
|
|
2819
2823
|
|
|
2820
2824
|
var toString = Object.prototype.toString;
|
|
2821
2825
|
|
|
2826
|
+
// eslint-disable-next-line func-names
|
|
2827
|
+
var kindOf = (function(cache) {
|
|
2828
|
+
// eslint-disable-next-line func-names
|
|
2829
|
+
return function(thing) {
|
|
2830
|
+
var str = toString.call(thing);
|
|
2831
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
2832
|
+
};
|
|
2833
|
+
})(Object.create(null));
|
|
2834
|
+
|
|
2835
|
+
function kindOfTest(type) {
|
|
2836
|
+
type = type.toLowerCase();
|
|
2837
|
+
return function isKindOf(thing) {
|
|
2838
|
+
return kindOf(thing) === type;
|
|
2839
|
+
};
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
/**
|
|
2843
|
+
* Array with axios supported protocols.
|
|
2844
|
+
*/
|
|
2845
|
+
var supportedProtocols = [ 'http:', 'https:', 'file:' ];
|
|
2846
|
+
|
|
2847
|
+
/**
|
|
2848
|
+
* Returns URL protocol passed as param if is not undefined or null,
|
|
2849
|
+
* otherwise just returns 'http:'
|
|
2850
|
+
*
|
|
2851
|
+
* @param {String} protocol The String value of URL protocol
|
|
2852
|
+
* @returns {String} Protocol if the value is not undefined or null
|
|
2853
|
+
*/
|
|
2854
|
+
function getProtocol(protocol) {
|
|
2855
|
+
return protocol || 'http:';
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2822
2858
|
/**
|
|
2823
2859
|
* Determine if a value is an Array
|
|
2824
2860
|
*
|
|
@@ -2826,7 +2862,7 @@ var toString = Object.prototype.toString;
|
|
|
2826
2862
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
2827
2863
|
*/
|
|
2828
2864
|
function isArray(val) {
|
|
2829
|
-
return
|
|
2865
|
+
return Array.isArray(val);
|
|
2830
2866
|
}
|
|
2831
2867
|
|
|
2832
2868
|
/**
|
|
@@ -2853,22 +2889,12 @@ function isBuffer(val) {
|
|
|
2853
2889
|
/**
|
|
2854
2890
|
* Determine if a value is an ArrayBuffer
|
|
2855
2891
|
*
|
|
2892
|
+
* @function
|
|
2856
2893
|
* @param {Object} val The value to test
|
|
2857
2894
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
2858
2895
|
*/
|
|
2859
|
-
|
|
2860
|
-
return toString.call(val) === '[object ArrayBuffer]';
|
|
2861
|
-
}
|
|
2896
|
+
var isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
2862
2897
|
|
|
2863
|
-
/**
|
|
2864
|
-
* Determine if a value is a FormData
|
|
2865
|
-
*
|
|
2866
|
-
* @param {Object} val The value to test
|
|
2867
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
|
2868
|
-
*/
|
|
2869
|
-
function isFormData(val) {
|
|
2870
|
-
return (typeof FormData !== 'undefined') && (val instanceof FormData);
|
|
2871
|
-
}
|
|
2872
2898
|
|
|
2873
2899
|
/**
|
|
2874
2900
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -2881,7 +2907,7 @@ function isArrayBufferView(val) {
|
|
|
2881
2907
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
2882
2908
|
result = ArrayBuffer.isView(val);
|
|
2883
2909
|
} else {
|
|
2884
|
-
result = (val) && (val.buffer) && (val.buffer
|
|
2910
|
+
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
|
2885
2911
|
}
|
|
2886
2912
|
return result;
|
|
2887
2913
|
}
|
|
@@ -2923,7 +2949,7 @@ function isObject(val) {
|
|
|
2923
2949
|
* @return {boolean} True if value is a plain Object, otherwise false
|
|
2924
2950
|
*/
|
|
2925
2951
|
function isPlainObject(val) {
|
|
2926
|
-
if (
|
|
2952
|
+
if (kindOf(val) !== 'object') {
|
|
2927
2953
|
return false;
|
|
2928
2954
|
}
|
|
2929
2955
|
|
|
@@ -2934,32 +2960,38 @@ function isPlainObject(val) {
|
|
|
2934
2960
|
/**
|
|
2935
2961
|
* Determine if a value is a Date
|
|
2936
2962
|
*
|
|
2963
|
+
* @function
|
|
2937
2964
|
* @param {Object} val The value to test
|
|
2938
2965
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
2939
2966
|
*/
|
|
2940
|
-
|
|
2941
|
-
return toString.call(val) === '[object Date]';
|
|
2942
|
-
}
|
|
2967
|
+
var isDate = kindOfTest('Date');
|
|
2943
2968
|
|
|
2944
2969
|
/**
|
|
2945
2970
|
* Determine if a value is a File
|
|
2946
2971
|
*
|
|
2972
|
+
* @function
|
|
2947
2973
|
* @param {Object} val The value to test
|
|
2948
2974
|
* @returns {boolean} True if value is a File, otherwise false
|
|
2949
2975
|
*/
|
|
2950
|
-
|
|
2951
|
-
return toString.call(val) === '[object File]';
|
|
2952
|
-
}
|
|
2976
|
+
var isFile = kindOfTest('File');
|
|
2953
2977
|
|
|
2954
2978
|
/**
|
|
2955
2979
|
* Determine if a value is a Blob
|
|
2956
2980
|
*
|
|
2981
|
+
* @function
|
|
2957
2982
|
* @param {Object} val The value to test
|
|
2958
2983
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
2959
2984
|
*/
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2985
|
+
var isBlob = kindOfTest('Blob');
|
|
2986
|
+
|
|
2987
|
+
/**
|
|
2988
|
+
* Determine if a value is a FileList
|
|
2989
|
+
*
|
|
2990
|
+
* @function
|
|
2991
|
+
* @param {Object} val The value to test
|
|
2992
|
+
* @returns {boolean} True if value is a File, otherwise false
|
|
2993
|
+
*/
|
|
2994
|
+
var isFileList = kindOfTest('FileList');
|
|
2963
2995
|
|
|
2964
2996
|
/**
|
|
2965
2997
|
* Determine if a value is a Function
|
|
@@ -2982,14 +3014,27 @@ function isStream(val) {
|
|
|
2982
3014
|
}
|
|
2983
3015
|
|
|
2984
3016
|
/**
|
|
2985
|
-
* Determine if a value is a
|
|
3017
|
+
* Determine if a value is a FormData
|
|
2986
3018
|
*
|
|
3019
|
+
* @param {Object} thing The value to test
|
|
3020
|
+
* @returns {boolean} True if value is an FormData, otherwise false
|
|
3021
|
+
*/
|
|
3022
|
+
function isFormData(thing) {
|
|
3023
|
+
var pattern = '[object FormData]';
|
|
3024
|
+
return thing && (
|
|
3025
|
+
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
3026
|
+
toString.call(thing) === pattern ||
|
|
3027
|
+
(isFunction(thing.toString) && thing.toString() === pattern)
|
|
3028
|
+
);
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
/**
|
|
3032
|
+
* Determine if a value is a URLSearchParams object
|
|
3033
|
+
* @function
|
|
2987
3034
|
* @param {Object} val The value to test
|
|
2988
3035
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
2989
3036
|
*/
|
|
2990
|
-
|
|
2991
|
-
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
|
2992
|
-
}
|
|
3037
|
+
var isURLSearchParams = kindOfTest('URLSearchParams');
|
|
2993
3038
|
|
|
2994
3039
|
/**
|
|
2995
3040
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -3136,7 +3181,97 @@ function stripBOM(content) {
|
|
|
3136
3181
|
return content;
|
|
3137
3182
|
}
|
|
3138
3183
|
|
|
3184
|
+
/**
|
|
3185
|
+
* Inherit the prototype methods from one constructor into another
|
|
3186
|
+
* @param {function} constructor
|
|
3187
|
+
* @param {function} superConstructor
|
|
3188
|
+
* @param {object} [props]
|
|
3189
|
+
* @param {object} [descriptors]
|
|
3190
|
+
*/
|
|
3191
|
+
|
|
3192
|
+
function inherits(constructor, superConstructor, props, descriptors) {
|
|
3193
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
3194
|
+
constructor.prototype.constructor = constructor;
|
|
3195
|
+
props && Object.assign(constructor.prototype, props);
|
|
3196
|
+
}
|
|
3197
|
+
|
|
3198
|
+
/**
|
|
3199
|
+
* Resolve object with deep prototype chain to a flat object
|
|
3200
|
+
* @param {Object} sourceObj source object
|
|
3201
|
+
* @param {Object} [destObj]
|
|
3202
|
+
* @param {Function} [filter]
|
|
3203
|
+
* @returns {Object}
|
|
3204
|
+
*/
|
|
3205
|
+
|
|
3206
|
+
function toFlatObject(sourceObj, destObj, filter) {
|
|
3207
|
+
var props;
|
|
3208
|
+
var i;
|
|
3209
|
+
var prop;
|
|
3210
|
+
var merged = {};
|
|
3211
|
+
|
|
3212
|
+
destObj = destObj || {};
|
|
3213
|
+
|
|
3214
|
+
do {
|
|
3215
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
3216
|
+
i = props.length;
|
|
3217
|
+
while (i-- > 0) {
|
|
3218
|
+
prop = props[i];
|
|
3219
|
+
if (!merged[prop]) {
|
|
3220
|
+
destObj[prop] = sourceObj[prop];
|
|
3221
|
+
merged[prop] = true;
|
|
3222
|
+
}
|
|
3223
|
+
}
|
|
3224
|
+
sourceObj = Object.getPrototypeOf(sourceObj);
|
|
3225
|
+
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
3226
|
+
|
|
3227
|
+
return destObj;
|
|
3228
|
+
}
|
|
3229
|
+
|
|
3230
|
+
/*
|
|
3231
|
+
* determines whether a string ends with the characters of a specified string
|
|
3232
|
+
* @param {String} str
|
|
3233
|
+
* @param {String} searchString
|
|
3234
|
+
* @param {Number} [position= 0]
|
|
3235
|
+
* @returns {boolean}
|
|
3236
|
+
*/
|
|
3237
|
+
function endsWith(str, searchString, position) {
|
|
3238
|
+
str = String(str);
|
|
3239
|
+
if (position === undefined || position > str.length) {
|
|
3240
|
+
position = str.length;
|
|
3241
|
+
}
|
|
3242
|
+
position -= searchString.length;
|
|
3243
|
+
var lastIndex = str.indexOf(searchString, position);
|
|
3244
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
|
|
3248
|
+
/**
|
|
3249
|
+
* Returns new array from array like object
|
|
3250
|
+
* @param {*} [thing]
|
|
3251
|
+
* @returns {Array}
|
|
3252
|
+
*/
|
|
3253
|
+
function toArray(thing) {
|
|
3254
|
+
if (!thing) return null;
|
|
3255
|
+
var i = thing.length;
|
|
3256
|
+
if (isUndefined(i)) return null;
|
|
3257
|
+
var arr = new Array(i);
|
|
3258
|
+
while (i-- > 0) {
|
|
3259
|
+
arr[i] = thing[i];
|
|
3260
|
+
}
|
|
3261
|
+
return arr;
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
// eslint-disable-next-line func-names
|
|
3265
|
+
var isTypedArray = (function(TypedArray) {
|
|
3266
|
+
// eslint-disable-next-line func-names
|
|
3267
|
+
return function(thing) {
|
|
3268
|
+
return TypedArray && thing instanceof TypedArray;
|
|
3269
|
+
};
|
|
3270
|
+
})(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
|
|
3271
|
+
|
|
3139
3272
|
var utils = {
|
|
3273
|
+
supportedProtocols: supportedProtocols,
|
|
3274
|
+
getProtocol: getProtocol,
|
|
3140
3275
|
isArray: isArray,
|
|
3141
3276
|
isArrayBuffer: isArrayBuffer,
|
|
3142
3277
|
isBuffer: isBuffer,
|
|
@@ -3158,7 +3293,15 @@ var utils = {
|
|
|
3158
3293
|
merge: merge,
|
|
3159
3294
|
extend: extend,
|
|
3160
3295
|
trim: trim,
|
|
3161
|
-
stripBOM: stripBOM
|
|
3296
|
+
stripBOM: stripBOM,
|
|
3297
|
+
inherits: inherits,
|
|
3298
|
+
toFlatObject: toFlatObject,
|
|
3299
|
+
kindOf: kindOf,
|
|
3300
|
+
kindOfTest: kindOfTest,
|
|
3301
|
+
endsWith: endsWith,
|
|
3302
|
+
toArray: toArray,
|
|
3303
|
+
isTypedArray: isTypedArray,
|
|
3304
|
+
isFileList: isFileList
|
|
3162
3305
|
};
|
|
3163
3306
|
|
|
3164
3307
|
function encode(val) {
|
|
@@ -3289,26 +3432,27 @@ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName)
|
|
|
3289
3432
|
};
|
|
3290
3433
|
|
|
3291
3434
|
/**
|
|
3292
|
-
*
|
|
3435
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
3293
3436
|
*
|
|
3294
|
-
* @param {
|
|
3295
|
-
* @param {Object} config The config.
|
|
3437
|
+
* @param {string} message The error message.
|
|
3296
3438
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
3439
|
+
* @param {Object} [config] The config.
|
|
3297
3440
|
* @param {Object} [request] The request.
|
|
3298
3441
|
* @param {Object} [response] The response.
|
|
3299
|
-
* @returns {Error} The error.
|
|
3442
|
+
* @returns {Error} The created error.
|
|
3300
3443
|
*/
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3444
|
+
function AxiosError(message, code, config, request, response) {
|
|
3445
|
+
Error.call(this);
|
|
3446
|
+
this.message = message;
|
|
3447
|
+
this.name = 'AxiosError';
|
|
3448
|
+
code && (this.code = code);
|
|
3449
|
+
config && (this.config = config);
|
|
3450
|
+
request && (this.request = request);
|
|
3451
|
+
response && (this.response = response);
|
|
3452
|
+
}
|
|
3310
3453
|
|
|
3311
|
-
|
|
3454
|
+
utils.inherits(AxiosError, Error, {
|
|
3455
|
+
toJSON: function toJSON() {
|
|
3312
3456
|
return {
|
|
3313
3457
|
// Standard
|
|
3314
3458
|
message: this.message,
|
|
@@ -3323,26 +3467,130 @@ var enhanceError = function enhanceError(error, config, code, request, response)
|
|
|
3323
3467
|
stack: this.stack,
|
|
3324
3468
|
// Axios
|
|
3325
3469
|
config: this.config,
|
|
3326
|
-
code: this.code
|
|
3470
|
+
code: this.code,
|
|
3471
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
3327
3472
|
};
|
|
3328
|
-
}
|
|
3329
|
-
|
|
3473
|
+
}
|
|
3474
|
+
});
|
|
3475
|
+
|
|
3476
|
+
var prototype = AxiosError.prototype;
|
|
3477
|
+
var descriptors = {};
|
|
3478
|
+
|
|
3479
|
+
[
|
|
3480
|
+
'ERR_BAD_OPTION_VALUE',
|
|
3481
|
+
'ERR_BAD_OPTION',
|
|
3482
|
+
'ECONNABORTED',
|
|
3483
|
+
'ETIMEDOUT',
|
|
3484
|
+
'ERR_NETWORK',
|
|
3485
|
+
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
3486
|
+
'ERR_DEPRECATED',
|
|
3487
|
+
'ERR_BAD_RESPONSE',
|
|
3488
|
+
'ERR_BAD_REQUEST',
|
|
3489
|
+
'ERR_CANCELED'
|
|
3490
|
+
// eslint-disable-next-line func-names
|
|
3491
|
+
].forEach(function(code) {
|
|
3492
|
+
descriptors[code] = {value: code};
|
|
3493
|
+
});
|
|
3494
|
+
|
|
3495
|
+
Object.defineProperties(AxiosError, descriptors);
|
|
3496
|
+
Object.defineProperty(prototype, 'isAxiosError', {value: true});
|
|
3497
|
+
|
|
3498
|
+
// eslint-disable-next-line func-names
|
|
3499
|
+
AxiosError.from = function(error, code, config, request, response, customProps) {
|
|
3500
|
+
var axiosError = Object.create(prototype);
|
|
3501
|
+
|
|
3502
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
3503
|
+
return obj !== Error.prototype;
|
|
3504
|
+
});
|
|
3505
|
+
|
|
3506
|
+
AxiosError.call(axiosError, error.message, code, config, request, response);
|
|
3507
|
+
|
|
3508
|
+
axiosError.name = error.name;
|
|
3509
|
+
|
|
3510
|
+
customProps && Object.assign(axiosError, customProps);
|
|
3511
|
+
|
|
3512
|
+
return axiosError;
|
|
3330
3513
|
};
|
|
3331
3514
|
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
* @param {Object} [request] The request.
|
|
3339
|
-
* @param {Object} [response] The response.
|
|
3340
|
-
* @returns {Error} The created error.
|
|
3341
|
-
*/
|
|
3342
|
-
var createError = function createError(message, config, code, request, response) {
|
|
3343
|
-
var error = new Error(message);
|
|
3344
|
-
return enhanceError(error, config, code, request, response);
|
|
3515
|
+
var AxiosError_1 = AxiosError;
|
|
3516
|
+
|
|
3517
|
+
var transitional = {
|
|
3518
|
+
silentJSONParsing: true,
|
|
3519
|
+
forcedJSONParsing: true,
|
|
3520
|
+
clarifyTimeoutError: false
|
|
3345
3521
|
};
|
|
3522
|
+
transitional.silentJSONParsing;
|
|
3523
|
+
transitional.forcedJSONParsing;
|
|
3524
|
+
transitional.clarifyTimeoutError;
|
|
3525
|
+
|
|
3526
|
+
/**
|
|
3527
|
+
* Convert a data object to FormData
|
|
3528
|
+
* @param {Object} obj
|
|
3529
|
+
* @param {?Object} [formData]
|
|
3530
|
+
* @returns {Object}
|
|
3531
|
+
**/
|
|
3532
|
+
|
|
3533
|
+
function toFormData(obj, formData) {
|
|
3534
|
+
// eslint-disable-next-line no-param-reassign
|
|
3535
|
+
formData = formData || new FormData();
|
|
3536
|
+
|
|
3537
|
+
var stack = [];
|
|
3538
|
+
|
|
3539
|
+
function convertValue(value) {
|
|
3540
|
+
if (value === null) return '';
|
|
3541
|
+
|
|
3542
|
+
if (utils.isDate(value)) {
|
|
3543
|
+
return value.toISOString();
|
|
3544
|
+
}
|
|
3545
|
+
|
|
3546
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
3547
|
+
return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
3548
|
+
}
|
|
3549
|
+
|
|
3550
|
+
return value;
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
function build(data, parentKey) {
|
|
3554
|
+
if (utils.isPlainObject(data) || utils.isArray(data)) {
|
|
3555
|
+
if (stack.indexOf(data) !== -1) {
|
|
3556
|
+
throw Error('Circular reference detected in ' + parentKey);
|
|
3557
|
+
}
|
|
3558
|
+
|
|
3559
|
+
stack.push(data);
|
|
3560
|
+
|
|
3561
|
+
utils.forEach(data, function each(value, key) {
|
|
3562
|
+
if (utils.isUndefined(value)) return;
|
|
3563
|
+
var fullKey = parentKey ? parentKey + '.' + key : key;
|
|
3564
|
+
var arr;
|
|
3565
|
+
|
|
3566
|
+
if (value && !parentKey && typeof value === 'object') {
|
|
3567
|
+
if (utils.endsWith(key, '{}')) {
|
|
3568
|
+
// eslint-disable-next-line no-param-reassign
|
|
3569
|
+
value = JSON.stringify(value);
|
|
3570
|
+
} else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
|
|
3571
|
+
// eslint-disable-next-line func-names
|
|
3572
|
+
arr.forEach(function(el) {
|
|
3573
|
+
!utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
|
|
3574
|
+
});
|
|
3575
|
+
return;
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
build(value, fullKey);
|
|
3580
|
+
});
|
|
3581
|
+
|
|
3582
|
+
stack.pop();
|
|
3583
|
+
} else {
|
|
3584
|
+
formData.append(parentKey, convertValue(data));
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3587
|
+
|
|
3588
|
+
build(obj);
|
|
3589
|
+
|
|
3590
|
+
return formData;
|
|
3591
|
+
}
|
|
3592
|
+
|
|
3593
|
+
var toFormData_1 = toFormData;
|
|
3346
3594
|
|
|
3347
3595
|
/**
|
|
3348
3596
|
* Resolve or reject a Promise based on response status.
|
|
@@ -3356,10 +3604,10 @@ var settle = function settle(resolve, reject, response) {
|
|
|
3356
3604
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
3357
3605
|
resolve(response);
|
|
3358
3606
|
} else {
|
|
3359
|
-
reject(
|
|
3607
|
+
reject(new AxiosError_1(
|
|
3360
3608
|
'Request failed with status code ' + response.status,
|
|
3609
|
+
[AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
3361
3610
|
response.config,
|
|
3362
|
-
null,
|
|
3363
3611
|
response.request,
|
|
3364
3612
|
response
|
|
3365
3613
|
));
|
|
@@ -3426,7 +3674,7 @@ var isAbsoluteURL = function isAbsoluteURL(url) {
|
|
|
3426
3674
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
3427
3675
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
3428
3676
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
3429
|
-
return /^([a-z][a-z\d
|
|
3677
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
3430
3678
|
};
|
|
3431
3679
|
|
|
3432
3680
|
/**
|
|
@@ -3573,14 +3821,38 @@ var isURLSameOrigin = (
|
|
|
3573
3821
|
})()
|
|
3574
3822
|
);
|
|
3575
3823
|
|
|
3824
|
+
/**
|
|
3825
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
3826
|
+
*
|
|
3827
|
+
* @class
|
|
3828
|
+
* @param {string=} message The message.
|
|
3829
|
+
*/
|
|
3830
|
+
function CanceledError(message) {
|
|
3831
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
3832
|
+
AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED);
|
|
3833
|
+
this.name = 'CanceledError';
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
utils.inherits(CanceledError, AxiosError_1, {
|
|
3837
|
+
__CANCEL__: true
|
|
3838
|
+
});
|
|
3839
|
+
|
|
3840
|
+
var CanceledError_1 = CanceledError;
|
|
3841
|
+
|
|
3576
3842
|
var xhr = function xhrAdapter(config) {
|
|
3577
3843
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3578
3844
|
var requestData = config.data;
|
|
3579
3845
|
var requestHeaders = config.headers;
|
|
3580
3846
|
var responseType = config.responseType;
|
|
3847
|
+
var onCanceled;
|
|
3848
|
+
function done() {
|
|
3849
|
+
if (config.cancelToken) {
|
|
3850
|
+
config.cancelToken.unsubscribe(onCanceled);
|
|
3851
|
+
}
|
|
3581
3852
|
|
|
3582
|
-
|
|
3583
|
-
|
|
3853
|
+
if (config.signal) {
|
|
3854
|
+
config.signal.removeEventListener('abort', onCanceled);
|
|
3855
|
+
}
|
|
3584
3856
|
}
|
|
3585
3857
|
|
|
3586
3858
|
var request = new XMLHttpRequest();
|
|
@@ -3593,6 +3865,9 @@ var xhr = function xhrAdapter(config) {
|
|
|
3593
3865
|
}
|
|
3594
3866
|
|
|
3595
3867
|
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
3868
|
+
var parsed = url.parse(fullPath);
|
|
3869
|
+
var protocol = utils.getProtocol(parsed.protocol);
|
|
3870
|
+
|
|
3596
3871
|
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
3597
3872
|
|
|
3598
3873
|
// Set the request timeout in MS
|
|
@@ -3615,7 +3890,13 @@ var xhr = function xhrAdapter(config) {
|
|
|
3615
3890
|
request: request
|
|
3616
3891
|
};
|
|
3617
3892
|
|
|
3618
|
-
settle(
|
|
3893
|
+
settle(function _resolve(value) {
|
|
3894
|
+
resolve(value);
|
|
3895
|
+
done();
|
|
3896
|
+
}, function _reject(err) {
|
|
3897
|
+
reject(err);
|
|
3898
|
+
done();
|
|
3899
|
+
}, response);
|
|
3619
3900
|
|
|
3620
3901
|
// Clean up request
|
|
3621
3902
|
request = null;
|
|
@@ -3650,7 +3931,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
3650
3931
|
return;
|
|
3651
3932
|
}
|
|
3652
3933
|
|
|
3653
|
-
reject(
|
|
3934
|
+
reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
|
|
3654
3935
|
|
|
3655
3936
|
// Clean up request
|
|
3656
3937
|
request = null;
|
|
@@ -3660,7 +3941,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
3660
3941
|
request.onerror = function handleError() {
|
|
3661
3942
|
// Real errors are hidden from us by the browser
|
|
3662
3943
|
// onerror should only fire if it's a network error
|
|
3663
|
-
reject(
|
|
3944
|
+
reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request, request));
|
|
3664
3945
|
|
|
3665
3946
|
// Clean up request
|
|
3666
3947
|
request = null;
|
|
@@ -3668,14 +3949,15 @@ var xhr = function xhrAdapter(config) {
|
|
|
3668
3949
|
|
|
3669
3950
|
// Handle timeout
|
|
3670
3951
|
request.ontimeout = function handleTimeout() {
|
|
3671
|
-
var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
|
|
3952
|
+
var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
3953
|
+
var transitional$1 = config.transitional || transitional;
|
|
3672
3954
|
if (config.timeoutErrorMessage) {
|
|
3673
3955
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
3674
3956
|
}
|
|
3675
|
-
reject(
|
|
3957
|
+
reject(new AxiosError_1(
|
|
3676
3958
|
timeoutErrorMessage,
|
|
3959
|
+
transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
|
|
3677
3960
|
config,
|
|
3678
|
-
config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
3679
3961
|
request));
|
|
3680
3962
|
|
|
3681
3963
|
// Clean up request
|
|
@@ -3729,29 +4011,46 @@ var xhr = function xhrAdapter(config) {
|
|
|
3729
4011
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
3730
4012
|
}
|
|
3731
4013
|
|
|
3732
|
-
if (config.cancelToken) {
|
|
4014
|
+
if (config.cancelToken || config.signal) {
|
|
3733
4015
|
// Handle cancellation
|
|
3734
|
-
|
|
4016
|
+
// eslint-disable-next-line func-names
|
|
4017
|
+
onCanceled = function(cancel) {
|
|
3735
4018
|
if (!request) {
|
|
3736
4019
|
return;
|
|
3737
4020
|
}
|
|
3738
|
-
|
|
4021
|
+
reject(!cancel || (cancel && cancel.type) ? new CanceledError_1() : cancel);
|
|
3739
4022
|
request.abort();
|
|
3740
|
-
reject(cancel);
|
|
3741
|
-
// Clean up request
|
|
3742
4023
|
request = null;
|
|
3743
|
-
}
|
|
4024
|
+
};
|
|
4025
|
+
|
|
4026
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
4027
|
+
if (config.signal) {
|
|
4028
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
4029
|
+
}
|
|
3744
4030
|
}
|
|
3745
4031
|
|
|
3746
4032
|
if (!requestData) {
|
|
3747
4033
|
requestData = null;
|
|
3748
4034
|
}
|
|
3749
4035
|
|
|
4036
|
+
if (parsed.path === null) {
|
|
4037
|
+
reject(new AxiosError_1('Malformed URL ' + fullPath, AxiosError_1.ERR_BAD_REQUEST, config));
|
|
4038
|
+
return;
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
if (!utils.supportedProtocols.includes(protocol)) {
|
|
4042
|
+
reject(new AxiosError_1('Unsupported protocol ' + protocol, AxiosError_1.ERR_BAD_REQUEST, config));
|
|
4043
|
+
return;
|
|
4044
|
+
}
|
|
4045
|
+
|
|
3750
4046
|
// Send the request
|
|
3751
4047
|
request.send(requestData);
|
|
3752
4048
|
});
|
|
3753
4049
|
};
|
|
3754
4050
|
|
|
4051
|
+
// eslint-disable-next-line strict
|
|
4052
|
+
var _null = null;
|
|
4053
|
+
|
|
3755
4054
|
var DEFAULT_CONTENT_TYPE = {
|
|
3756
4055
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
3757
4056
|
};
|
|
@@ -3791,11 +4090,7 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
3791
4090
|
|
|
3792
4091
|
var defaults = {
|
|
3793
4092
|
|
|
3794
|
-
transitional:
|
|
3795
|
-
silentJSONParsing: true,
|
|
3796
|
-
forcedJSONParsing: true,
|
|
3797
|
-
clarifyTimeoutError: false
|
|
3798
|
-
},
|
|
4093
|
+
transitional: transitional,
|
|
3799
4094
|
|
|
3800
4095
|
adapter: getDefaultAdapter(),
|
|
3801
4096
|
|
|
@@ -3819,15 +4114,25 @@ var defaults = {
|
|
|
3819
4114
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
3820
4115
|
return data.toString();
|
|
3821
4116
|
}
|
|
3822
|
-
|
|
4117
|
+
|
|
4118
|
+
var isObjectPayload = utils.isObject(data);
|
|
4119
|
+
var contentType = headers && headers['Content-Type'];
|
|
4120
|
+
|
|
4121
|
+
var isFileList;
|
|
4122
|
+
|
|
4123
|
+
if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
|
|
4124
|
+
var _FormData = this.env && this.env.FormData;
|
|
4125
|
+
return toFormData_1(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
|
|
4126
|
+
} else if (isObjectPayload || contentType === 'application/json') {
|
|
3823
4127
|
setContentTypeIfUnset(headers, 'application/json');
|
|
3824
4128
|
return stringifySafely(data);
|
|
3825
4129
|
}
|
|
4130
|
+
|
|
3826
4131
|
return data;
|
|
3827
4132
|
}],
|
|
3828
4133
|
|
|
3829
4134
|
transformResponse: [function transformResponse(data) {
|
|
3830
|
-
var transitional = this.transitional;
|
|
4135
|
+
var transitional = this.transitional || defaults.transitional;
|
|
3831
4136
|
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
3832
4137
|
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
3833
4138
|
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
@@ -3838,7 +4143,7 @@ var defaults = {
|
|
|
3838
4143
|
} catch (e) {
|
|
3839
4144
|
if (strictJSONParsing) {
|
|
3840
4145
|
if (e.name === 'SyntaxError') {
|
|
3841
|
-
throw
|
|
4146
|
+
throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
3842
4147
|
}
|
|
3843
4148
|
throw e;
|
|
3844
4149
|
}
|
|
@@ -3860,14 +4165,18 @@ var defaults = {
|
|
|
3860
4165
|
maxContentLength: -1,
|
|
3861
4166
|
maxBodyLength: -1,
|
|
3862
4167
|
|
|
4168
|
+
env: {
|
|
4169
|
+
FormData: _null
|
|
4170
|
+
},
|
|
4171
|
+
|
|
3863
4172
|
validateStatus: function validateStatus(status) {
|
|
3864
4173
|
return status >= 200 && status < 300;
|
|
3865
|
-
}
|
|
3866
|
-
};
|
|
4174
|
+
},
|
|
3867
4175
|
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
4176
|
+
headers: {
|
|
4177
|
+
common: {
|
|
4178
|
+
'Accept': 'application/json, text/plain, */*'
|
|
4179
|
+
}
|
|
3871
4180
|
}
|
|
3872
4181
|
};
|
|
3873
4182
|
|
|
@@ -3904,12 +4213,16 @@ var isCancel = function isCancel(value) {
|
|
|
3904
4213
|
};
|
|
3905
4214
|
|
|
3906
4215
|
/**
|
|
3907
|
-
* Throws a `
|
|
4216
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
3908
4217
|
*/
|
|
3909
4218
|
function throwIfCancellationRequested(config) {
|
|
3910
4219
|
if (config.cancelToken) {
|
|
3911
4220
|
config.cancelToken.throwIfRequested();
|
|
3912
4221
|
}
|
|
4222
|
+
|
|
4223
|
+
if (config.signal && config.signal.aborted) {
|
|
4224
|
+
throw new CanceledError_1();
|
|
4225
|
+
}
|
|
3913
4226
|
}
|
|
3914
4227
|
|
|
3915
4228
|
/**
|
|
@@ -3992,17 +4305,6 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
3992
4305
|
config2 = config2 || {};
|
|
3993
4306
|
var config = {};
|
|
3994
4307
|
|
|
3995
|
-
var valueFromConfig2Keys = ['url', 'method', 'data'];
|
|
3996
|
-
var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
|
|
3997
|
-
var defaultToConfig2Keys = [
|
|
3998
|
-
'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
|
3999
|
-
'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
|
4000
|
-
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
|
|
4001
|
-
'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
|
|
4002
|
-
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
|
4003
|
-
];
|
|
4004
|
-
var directMergeKeys = ['validateStatus'];
|
|
4005
|
-
|
|
4006
4308
|
function getMergedValue(target, source) {
|
|
4007
4309
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
4008
4310
|
return utils.merge(target, source);
|
|
@@ -4014,182 +4316,85 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
4014
4316
|
return source;
|
|
4015
4317
|
}
|
|
4016
4318
|
|
|
4319
|
+
// eslint-disable-next-line consistent-return
|
|
4017
4320
|
function mergeDeepProperties(prop) {
|
|
4018
4321
|
if (!utils.isUndefined(config2[prop])) {
|
|
4019
|
-
|
|
4322
|
+
return getMergedValue(config1[prop], config2[prop]);
|
|
4020
4323
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
4021
|
-
|
|
4324
|
+
return getMergedValue(undefined, config1[prop]);
|
|
4022
4325
|
}
|
|
4023
4326
|
}
|
|
4024
4327
|
|
|
4025
|
-
|
|
4328
|
+
// eslint-disable-next-line consistent-return
|
|
4329
|
+
function valueFromConfig2(prop) {
|
|
4026
4330
|
if (!utils.isUndefined(config2[prop])) {
|
|
4027
|
-
|
|
4331
|
+
return getMergedValue(undefined, config2[prop]);
|
|
4028
4332
|
}
|
|
4029
|
-
}
|
|
4030
|
-
|
|
4031
|
-
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
4333
|
+
}
|
|
4032
4334
|
|
|
4033
|
-
|
|
4335
|
+
// eslint-disable-next-line consistent-return
|
|
4336
|
+
function defaultToConfig2(prop) {
|
|
4034
4337
|
if (!utils.isUndefined(config2[prop])) {
|
|
4035
|
-
|
|
4338
|
+
return getMergedValue(undefined, config2[prop]);
|
|
4036
4339
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
4037
|
-
|
|
4340
|
+
return getMergedValue(undefined, config1[prop]);
|
|
4038
4341
|
}
|
|
4039
|
-
}
|
|
4342
|
+
}
|
|
4040
4343
|
|
|
4041
|
-
|
|
4344
|
+
// eslint-disable-next-line consistent-return
|
|
4345
|
+
function mergeDirectKeys(prop) {
|
|
4042
4346
|
if (prop in config2) {
|
|
4043
|
-
|
|
4347
|
+
return getMergedValue(config1[prop], config2[prop]);
|
|
4044
4348
|
} else if (prop in config1) {
|
|
4045
|
-
|
|
4349
|
+
return getMergedValue(undefined, config1[prop]);
|
|
4046
4350
|
}
|
|
4047
|
-
}
|
|
4048
|
-
|
|
4049
|
-
var axiosKeys = valueFromConfig2Keys
|
|
4050
|
-
.concat(mergeDeepPropertiesKeys)
|
|
4051
|
-
.concat(defaultToConfig2Keys)
|
|
4052
|
-
.concat(directMergeKeys);
|
|
4351
|
+
}
|
|
4053
4352
|
|
|
4054
|
-
var
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4353
|
+
var mergeMap = {
|
|
4354
|
+
'url': valueFromConfig2,
|
|
4355
|
+
'method': valueFromConfig2,
|
|
4356
|
+
'data': valueFromConfig2,
|
|
4357
|
+
'baseURL': defaultToConfig2,
|
|
4358
|
+
'transformRequest': defaultToConfig2,
|
|
4359
|
+
'transformResponse': defaultToConfig2,
|
|
4360
|
+
'paramsSerializer': defaultToConfig2,
|
|
4361
|
+
'timeout': defaultToConfig2,
|
|
4362
|
+
'timeoutMessage': defaultToConfig2,
|
|
4363
|
+
'withCredentials': defaultToConfig2,
|
|
4364
|
+
'adapter': defaultToConfig2,
|
|
4365
|
+
'responseType': defaultToConfig2,
|
|
4366
|
+
'xsrfCookieName': defaultToConfig2,
|
|
4367
|
+
'xsrfHeaderName': defaultToConfig2,
|
|
4368
|
+
'onUploadProgress': defaultToConfig2,
|
|
4369
|
+
'onDownloadProgress': defaultToConfig2,
|
|
4370
|
+
'decompress': defaultToConfig2,
|
|
4371
|
+
'maxContentLength': defaultToConfig2,
|
|
4372
|
+
'maxBodyLength': defaultToConfig2,
|
|
4373
|
+
'beforeRedirect': defaultToConfig2,
|
|
4374
|
+
'transport': defaultToConfig2,
|
|
4375
|
+
'httpAgent': defaultToConfig2,
|
|
4376
|
+
'httpsAgent': defaultToConfig2,
|
|
4377
|
+
'cancelToken': defaultToConfig2,
|
|
4378
|
+
'socketPath': defaultToConfig2,
|
|
4379
|
+
'responseEncoding': defaultToConfig2,
|
|
4380
|
+
'validateStatus': mergeDirectKeys
|
|
4381
|
+
};
|
|
4060
4382
|
|
|
4061
|
-
utils.forEach(
|
|
4383
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
4384
|
+
var merge = mergeMap[prop] || mergeDeepProperties;
|
|
4385
|
+
var configValue = merge(prop);
|
|
4386
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
4387
|
+
});
|
|
4062
4388
|
|
|
4063
4389
|
return config;
|
|
4064
4390
|
};
|
|
4065
4391
|
|
|
4066
|
-
var
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
var
|
|
4071
|
-
test: "grunt test",
|
|
4072
|
-
start: "node ./sandbox/server.js",
|
|
4073
|
-
build: "NODE_ENV=production grunt build",
|
|
4074
|
-
preversion: "npm test",
|
|
4075
|
-
version: "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",
|
|
4076
|
-
postversion: "git push && git push --tags",
|
|
4077
|
-
examples: "node ./examples/server.js",
|
|
4078
|
-
coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
4079
|
-
fix: "eslint --fix lib/**/*.js"
|
|
4080
|
-
};
|
|
4081
|
-
var repository$1 = {
|
|
4082
|
-
type: "git",
|
|
4083
|
-
url: "https://github.com/axios/axios.git"
|
|
4084
|
-
};
|
|
4085
|
-
var keywords = [
|
|
4086
|
-
"xhr",
|
|
4087
|
-
"http",
|
|
4088
|
-
"ajax",
|
|
4089
|
-
"promise",
|
|
4090
|
-
"node"
|
|
4091
|
-
];
|
|
4092
|
-
var author$1 = "Matt Zabriskie";
|
|
4093
|
-
var license$1 = "MIT";
|
|
4094
|
-
var bugs = {
|
|
4095
|
-
url: "https://github.com/axios/axios/issues"
|
|
4096
|
-
};
|
|
4097
|
-
var homepage = "https://axios-http.com";
|
|
4098
|
-
var devDependencies$1 = {
|
|
4099
|
-
coveralls: "^3.0.0",
|
|
4100
|
-
"es6-promise": "^4.2.4",
|
|
4101
|
-
grunt: "^1.3.0",
|
|
4102
|
-
"grunt-banner": "^0.6.0",
|
|
4103
|
-
"grunt-cli": "^1.2.0",
|
|
4104
|
-
"grunt-contrib-clean": "^1.1.0",
|
|
4105
|
-
"grunt-contrib-watch": "^1.0.0",
|
|
4106
|
-
"grunt-eslint": "^23.0.0",
|
|
4107
|
-
"grunt-karma": "^4.0.0",
|
|
4108
|
-
"grunt-mocha-test": "^0.13.3",
|
|
4109
|
-
"grunt-ts": "^6.0.0-beta.19",
|
|
4110
|
-
"grunt-webpack": "^4.0.2",
|
|
4111
|
-
"istanbul-instrumenter-loader": "^1.0.0",
|
|
4112
|
-
"jasmine-core": "^2.4.1",
|
|
4113
|
-
karma: "^6.3.2",
|
|
4114
|
-
"karma-chrome-launcher": "^3.1.0",
|
|
4115
|
-
"karma-firefox-launcher": "^2.1.0",
|
|
4116
|
-
"karma-jasmine": "^1.1.1",
|
|
4117
|
-
"karma-jasmine-ajax": "^0.1.13",
|
|
4118
|
-
"karma-safari-launcher": "^1.0.0",
|
|
4119
|
-
"karma-sauce-launcher": "^4.3.6",
|
|
4120
|
-
"karma-sinon": "^1.0.5",
|
|
4121
|
-
"karma-sourcemap-loader": "^0.3.8",
|
|
4122
|
-
"karma-webpack": "^4.0.2",
|
|
4123
|
-
"load-grunt-tasks": "^3.5.2",
|
|
4124
|
-
minimist: "^1.2.0",
|
|
4125
|
-
mocha: "^8.2.1",
|
|
4126
|
-
sinon: "^4.5.0",
|
|
4127
|
-
"terser-webpack-plugin": "^4.2.3",
|
|
4128
|
-
typescript: "^4.0.5",
|
|
4129
|
-
"url-search-params": "^0.10.0",
|
|
4130
|
-
webpack: "^4.44.2",
|
|
4131
|
-
"webpack-dev-server": "^3.11.0"
|
|
4132
|
-
};
|
|
4133
|
-
var browser = {
|
|
4134
|
-
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
|
4135
|
-
};
|
|
4136
|
-
var jsdelivr = "dist/axios.min.js";
|
|
4137
|
-
var unpkg$1 = "dist/axios.min.js";
|
|
4138
|
-
var typings = "./index.d.ts";
|
|
4139
|
-
var dependencies$1 = {
|
|
4140
|
-
"follow-redirects": "^1.14.0"
|
|
4141
|
-
};
|
|
4142
|
-
var bundlesize = [
|
|
4143
|
-
{
|
|
4144
|
-
path: "./dist/axios.min.js",
|
|
4145
|
-
threshold: "5kB"
|
|
4146
|
-
}
|
|
4147
|
-
];
|
|
4148
|
-
var _package = {
|
|
4149
|
-
name: name$2,
|
|
4150
|
-
version: version$1,
|
|
4151
|
-
description: description,
|
|
4152
|
-
main: main$1,
|
|
4153
|
-
scripts: scripts$1,
|
|
4154
|
-
repository: repository$1,
|
|
4155
|
-
keywords: keywords,
|
|
4156
|
-
author: author$1,
|
|
4157
|
-
license: license$1,
|
|
4158
|
-
bugs: bugs,
|
|
4159
|
-
homepage: homepage,
|
|
4160
|
-
devDependencies: devDependencies$1,
|
|
4161
|
-
browser: browser,
|
|
4162
|
-
jsdelivr: jsdelivr,
|
|
4163
|
-
unpkg: unpkg$1,
|
|
4164
|
-
typings: typings,
|
|
4165
|
-
dependencies: dependencies$1,
|
|
4166
|
-
bundlesize: bundlesize
|
|
4167
|
-
};
|
|
4168
|
-
|
|
4169
|
-
var _package$1 = /*#__PURE__*/Object.freeze({
|
|
4170
|
-
__proto__: null,
|
|
4171
|
-
name: name$2,
|
|
4172
|
-
version: version$1,
|
|
4173
|
-
description: description,
|
|
4174
|
-
main: main$1,
|
|
4175
|
-
scripts: scripts$1,
|
|
4176
|
-
repository: repository$1,
|
|
4177
|
-
keywords: keywords,
|
|
4178
|
-
author: author$1,
|
|
4179
|
-
license: license$1,
|
|
4180
|
-
bugs: bugs,
|
|
4181
|
-
homepage: homepage,
|
|
4182
|
-
devDependencies: devDependencies$1,
|
|
4183
|
-
browser: browser,
|
|
4184
|
-
jsdelivr: jsdelivr,
|
|
4185
|
-
unpkg: unpkg$1,
|
|
4186
|
-
typings: typings,
|
|
4187
|
-
dependencies: dependencies$1,
|
|
4188
|
-
bundlesize: bundlesize,
|
|
4189
|
-
'default': _package
|
|
4190
|
-
});
|
|
4392
|
+
var data = {
|
|
4393
|
+
"version": "0.27.0"
|
|
4394
|
+
};
|
|
4395
|
+
|
|
4396
|
+
var VERSION = data.version;
|
|
4191
4397
|
|
|
4192
|
-
var pkg = getCjsExportFromNamespace(_package$1);
|
|
4193
4398
|
|
|
4194
4399
|
var validators$1 = {};
|
|
4195
4400
|
|
|
@@ -4201,48 +4406,29 @@ var validators$1 = {};
|
|
|
4201
4406
|
});
|
|
4202
4407
|
|
|
4203
4408
|
var deprecatedWarnings = {};
|
|
4204
|
-
var currentVerArr = pkg.version.split('.');
|
|
4205
|
-
|
|
4206
|
-
/**
|
|
4207
|
-
* Compare package versions
|
|
4208
|
-
* @param {string} version
|
|
4209
|
-
* @param {string?} thanVersion
|
|
4210
|
-
* @returns {boolean}
|
|
4211
|
-
*/
|
|
4212
|
-
function isOlderVersion(version, thanVersion) {
|
|
4213
|
-
var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
|
|
4214
|
-
var destVer = version.split('.');
|
|
4215
|
-
for (var i = 0; i < 3; i++) {
|
|
4216
|
-
if (pkgVersionArr[i] > destVer[i]) {
|
|
4217
|
-
return true;
|
|
4218
|
-
} else if (pkgVersionArr[i] < destVer[i]) {
|
|
4219
|
-
return false;
|
|
4220
|
-
}
|
|
4221
|
-
}
|
|
4222
|
-
return false;
|
|
4223
|
-
}
|
|
4224
4409
|
|
|
4225
4410
|
/**
|
|
4226
4411
|
* Transitional option validator
|
|
4227
|
-
* @param {function|boolean?} validator
|
|
4228
|
-
* @param {string?} version
|
|
4229
|
-
* @param {string} message
|
|
4412
|
+
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|
4413
|
+
* @param {string?} version - deprecated version / removed since version
|
|
4414
|
+
* @param {string?} message - some message with additional info
|
|
4230
4415
|
* @returns {function}
|
|
4231
4416
|
*/
|
|
4232
4417
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
4233
|
-
var isDeprecated = version && isOlderVersion(version);
|
|
4234
|
-
|
|
4235
4418
|
function formatMessage(opt, desc) {
|
|
4236
|
-
return '[Axios v' +
|
|
4419
|
+
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
4237
4420
|
}
|
|
4238
4421
|
|
|
4239
4422
|
// eslint-disable-next-line func-names
|
|
4240
4423
|
return function(value, opt, opts) {
|
|
4241
4424
|
if (validator === false) {
|
|
4242
|
-
throw new
|
|
4425
|
+
throw new AxiosError_1(
|
|
4426
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
4427
|
+
AxiosError_1.ERR_DEPRECATED
|
|
4428
|
+
);
|
|
4243
4429
|
}
|
|
4244
4430
|
|
|
4245
|
-
if (
|
|
4431
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
4246
4432
|
deprecatedWarnings[opt] = true;
|
|
4247
4433
|
// eslint-disable-next-line no-console
|
|
4248
4434
|
console.warn(
|
|
@@ -4266,7 +4452,7 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
4266
4452
|
|
|
4267
4453
|
function assertOptions(options, schema, allowUnknown) {
|
|
4268
4454
|
if (typeof options !== 'object') {
|
|
4269
|
-
throw new
|
|
4455
|
+
throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
|
|
4270
4456
|
}
|
|
4271
4457
|
var keys = Object.keys(options);
|
|
4272
4458
|
var i = keys.length;
|
|
@@ -4277,18 +4463,17 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
4277
4463
|
var value = options[opt];
|
|
4278
4464
|
var result = value === undefined || validator(value, opt, options);
|
|
4279
4465
|
if (result !== true) {
|
|
4280
|
-
throw new
|
|
4466
|
+
throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
|
|
4281
4467
|
}
|
|
4282
4468
|
continue;
|
|
4283
4469
|
}
|
|
4284
4470
|
if (allowUnknown !== true) {
|
|
4285
|
-
throw
|
|
4471
|
+
throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
|
|
4286
4472
|
}
|
|
4287
4473
|
}
|
|
4288
4474
|
}
|
|
4289
4475
|
|
|
4290
4476
|
var validator = {
|
|
4291
|
-
isOlderVersion: isOlderVersion,
|
|
4292
4477
|
assertOptions: assertOptions,
|
|
4293
4478
|
validators: validators$1
|
|
4294
4479
|
};
|
|
@@ -4312,14 +4497,14 @@ function Axios(instanceConfig) {
|
|
|
4312
4497
|
*
|
|
4313
4498
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
|
4314
4499
|
*/
|
|
4315
|
-
Axios.prototype.request = function request(config) {
|
|
4500
|
+
Axios.prototype.request = function request(configOrUrl, config) {
|
|
4316
4501
|
/*eslint no-param-reassign:0*/
|
|
4317
4502
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
4318
|
-
if (typeof
|
|
4319
|
-
config = arguments[1] || {};
|
|
4320
|
-
config.url = arguments[0];
|
|
4321
|
-
} else {
|
|
4503
|
+
if (typeof configOrUrl === 'string') {
|
|
4322
4504
|
config = config || {};
|
|
4505
|
+
config.url = configOrUrl;
|
|
4506
|
+
} else {
|
|
4507
|
+
config = configOrUrl || {};
|
|
4323
4508
|
}
|
|
4324
4509
|
|
|
4325
4510
|
config = mergeConfig(this.defaults, config);
|
|
@@ -4337,9 +4522,9 @@ Axios.prototype.request = function request(config) {
|
|
|
4337
4522
|
|
|
4338
4523
|
if (transitional !== undefined) {
|
|
4339
4524
|
validator.assertOptions(transitional, {
|
|
4340
|
-
silentJSONParsing: validators.transitional(validators.boolean
|
|
4341
|
-
forcedJSONParsing: validators.transitional(validators.boolean
|
|
4342
|
-
clarifyTimeoutError: validators.transitional(validators.boolean
|
|
4525
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
4526
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
4527
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
4343
4528
|
}, false);
|
|
4344
4529
|
}
|
|
4345
4530
|
|
|
@@ -4405,7 +4590,8 @@ Axios.prototype.request = function request(config) {
|
|
|
4405
4590
|
|
|
4406
4591
|
Axios.prototype.getUri = function getUri(config) {
|
|
4407
4592
|
config = mergeConfig(this.defaults, config);
|
|
4408
|
-
|
|
4593
|
+
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
4594
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
4409
4595
|
};
|
|
4410
4596
|
|
|
4411
4597
|
// Provide aliases for supported request methods
|
|
@@ -4422,34 +4608,26 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
|
4422
4608
|
|
|
4423
4609
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4424
4610
|
/*eslint func-names:0*/
|
|
4425
|
-
Axios.prototype[method] = function(url, data, config) {
|
|
4426
|
-
return this.request(mergeConfig(config || {}, {
|
|
4427
|
-
method: method,
|
|
4428
|
-
url: url,
|
|
4429
|
-
data: data
|
|
4430
|
-
}));
|
|
4431
|
-
};
|
|
4432
|
-
});
|
|
4433
4611
|
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
}
|
|
4612
|
+
function generateHTTPMethod(isForm) {
|
|
4613
|
+
return function httpMethod(url, data, config) {
|
|
4614
|
+
return this.request(mergeConfig(config || {}, {
|
|
4615
|
+
method: method,
|
|
4616
|
+
headers: isForm ? {
|
|
4617
|
+
'Content-Type': 'multipart/form-data'
|
|
4618
|
+
} : {},
|
|
4619
|
+
url: url,
|
|
4620
|
+
data: data
|
|
4621
|
+
}));
|
|
4622
|
+
};
|
|
4623
|
+
}
|
|
4445
4624
|
|
|
4446
|
-
|
|
4447
|
-
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
|
4448
|
-
};
|
|
4625
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
4449
4626
|
|
|
4450
|
-
|
|
4627
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4628
|
+
});
|
|
4451
4629
|
|
|
4452
|
-
var
|
|
4630
|
+
var Axios_1 = Axios;
|
|
4453
4631
|
|
|
4454
4632
|
/**
|
|
4455
4633
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
@@ -4463,24 +4641,55 @@ function CancelToken(executor) {
|
|
|
4463
4641
|
}
|
|
4464
4642
|
|
|
4465
4643
|
var resolvePromise;
|
|
4644
|
+
|
|
4466
4645
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
4467
4646
|
resolvePromise = resolve;
|
|
4468
4647
|
});
|
|
4469
4648
|
|
|
4470
4649
|
var token = this;
|
|
4650
|
+
|
|
4651
|
+
// eslint-disable-next-line func-names
|
|
4652
|
+
this.promise.then(function(cancel) {
|
|
4653
|
+
if (!token._listeners) return;
|
|
4654
|
+
|
|
4655
|
+
var i;
|
|
4656
|
+
var l = token._listeners.length;
|
|
4657
|
+
|
|
4658
|
+
for (i = 0; i < l; i++) {
|
|
4659
|
+
token._listeners[i](cancel);
|
|
4660
|
+
}
|
|
4661
|
+
token._listeners = null;
|
|
4662
|
+
});
|
|
4663
|
+
|
|
4664
|
+
// eslint-disable-next-line func-names
|
|
4665
|
+
this.promise.then = function(onfulfilled) {
|
|
4666
|
+
var _resolve;
|
|
4667
|
+
// eslint-disable-next-line func-names
|
|
4668
|
+
var promise = new Promise(function(resolve) {
|
|
4669
|
+
token.subscribe(resolve);
|
|
4670
|
+
_resolve = resolve;
|
|
4671
|
+
}).then(onfulfilled);
|
|
4672
|
+
|
|
4673
|
+
promise.cancel = function reject() {
|
|
4674
|
+
token.unsubscribe(_resolve);
|
|
4675
|
+
};
|
|
4676
|
+
|
|
4677
|
+
return promise;
|
|
4678
|
+
};
|
|
4679
|
+
|
|
4471
4680
|
executor(function cancel(message) {
|
|
4472
4681
|
if (token.reason) {
|
|
4473
4682
|
// Cancellation has already been requested
|
|
4474
4683
|
return;
|
|
4475
4684
|
}
|
|
4476
4685
|
|
|
4477
|
-
token.reason = new
|
|
4686
|
+
token.reason = new CanceledError_1(message);
|
|
4478
4687
|
resolvePromise(token.reason);
|
|
4479
4688
|
});
|
|
4480
4689
|
}
|
|
4481
4690
|
|
|
4482
4691
|
/**
|
|
4483
|
-
* Throws a `
|
|
4692
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
4484
4693
|
*/
|
|
4485
4694
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
4486
4695
|
if (this.reason) {
|
|
@@ -4488,6 +4697,37 @@ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
|
4488
4697
|
}
|
|
4489
4698
|
};
|
|
4490
4699
|
|
|
4700
|
+
/**
|
|
4701
|
+
* Subscribe to the cancel signal
|
|
4702
|
+
*/
|
|
4703
|
+
|
|
4704
|
+
CancelToken.prototype.subscribe = function subscribe(listener) {
|
|
4705
|
+
if (this.reason) {
|
|
4706
|
+
listener(this.reason);
|
|
4707
|
+
return;
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4710
|
+
if (this._listeners) {
|
|
4711
|
+
this._listeners.push(listener);
|
|
4712
|
+
} else {
|
|
4713
|
+
this._listeners = [listener];
|
|
4714
|
+
}
|
|
4715
|
+
};
|
|
4716
|
+
|
|
4717
|
+
/**
|
|
4718
|
+
* Unsubscribe from the cancel signal
|
|
4719
|
+
*/
|
|
4720
|
+
|
|
4721
|
+
CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
|
|
4722
|
+
if (!this._listeners) {
|
|
4723
|
+
return;
|
|
4724
|
+
}
|
|
4725
|
+
var index = this._listeners.indexOf(listener);
|
|
4726
|
+
if (index !== -1) {
|
|
4727
|
+
this._listeners.splice(index, 1);
|
|
4728
|
+
}
|
|
4729
|
+
};
|
|
4730
|
+
|
|
4491
4731
|
/**
|
|
4492
4732
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
4493
4733
|
* cancels the `CancelToken`.
|
|
@@ -4538,7 +4778,7 @@ var spread = function spread(callback) {
|
|
|
4538
4778
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
4539
4779
|
*/
|
|
4540
4780
|
var isAxiosError = function isAxiosError(payload) {
|
|
4541
|
-
return (
|
|
4781
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
4542
4782
|
};
|
|
4543
4783
|
|
|
4544
4784
|
/**
|
|
@@ -4557,6 +4797,11 @@ function createInstance(defaultConfig) {
|
|
|
4557
4797
|
// Copy context to instance
|
|
4558
4798
|
utils.extend(instance, context);
|
|
4559
4799
|
|
|
4800
|
+
// Factory for creating new instances
|
|
4801
|
+
instance.create = function create(instanceConfig) {
|
|
4802
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
4803
|
+
};
|
|
4804
|
+
|
|
4560
4805
|
return instance;
|
|
4561
4806
|
}
|
|
4562
4807
|
|
|
@@ -4566,15 +4811,18 @@ var axios$1 = createInstance(defaults_1);
|
|
|
4566
4811
|
// Expose Axios class to allow class inheritance
|
|
4567
4812
|
axios$1.Axios = Axios_1;
|
|
4568
4813
|
|
|
4569
|
-
// Factory for creating new instances
|
|
4570
|
-
axios$1.create = function create(instanceConfig) {
|
|
4571
|
-
return createInstance(mergeConfig(axios$1.defaults, instanceConfig));
|
|
4572
|
-
};
|
|
4573
|
-
|
|
4574
4814
|
// Expose Cancel & CancelToken
|
|
4575
|
-
axios$1.
|
|
4815
|
+
axios$1.CanceledError = CanceledError_1;
|
|
4576
4816
|
axios$1.CancelToken = CancelToken_1;
|
|
4577
4817
|
axios$1.isCancel = isCancel;
|
|
4818
|
+
axios$1.VERSION = data.version;
|
|
4819
|
+
axios$1.toFormData = toFormData_1;
|
|
4820
|
+
|
|
4821
|
+
// Expose AxiosError class
|
|
4822
|
+
axios$1.AxiosError = AxiosError_1;
|
|
4823
|
+
|
|
4824
|
+
// alias for CanceledError for backward compatibility
|
|
4825
|
+
axios$1.Cancel = axios$1.CanceledError;
|
|
4578
4826
|
|
|
4579
4827
|
// Expose all/spread
|
|
4580
4828
|
axios$1.all = function all(promises) {
|
|
@@ -4594,7 +4842,7 @@ axios_1.default = default_1;
|
|
|
4594
4842
|
var axios = axios_1;
|
|
4595
4843
|
|
|
4596
4844
|
var name$1 = "@tryghost/content-api";
|
|
4597
|
-
var version = "1.9.
|
|
4845
|
+
var version = "1.9.5";
|
|
4598
4846
|
var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
|
|
4599
4847
|
var author = "Ghost Foundation";
|
|
4600
4848
|
var license = "MIT";
|
|
@@ -4628,22 +4876,22 @@ var devDependencies = {
|
|
|
4628
4876
|
"@babel/preset-env": "7.17.10",
|
|
4629
4877
|
"@rollup/plugin-json": "4.1.0",
|
|
4630
4878
|
c8: "7.11.2",
|
|
4631
|
-
"core-js": "3.22.
|
|
4879
|
+
"core-js": "3.22.5",
|
|
4632
4880
|
"eslint-plugin-ghost": "2.13.0",
|
|
4633
4881
|
mocha: "10.0.0",
|
|
4634
|
-
rollup: "2.
|
|
4882
|
+
rollup: "2.72.1",
|
|
4635
4883
|
"rollup-plugin-babel": "4.4.0",
|
|
4636
4884
|
"rollup-plugin-commonjs": "10.1.0",
|
|
4637
4885
|
"rollup-plugin-node-resolve": "5.2.0",
|
|
4638
4886
|
"rollup-plugin-replace": "2.2.0",
|
|
4639
4887
|
"rollup-plugin-terser": "7.0.2",
|
|
4640
4888
|
should: "13.2.3",
|
|
4641
|
-
sinon: "
|
|
4889
|
+
sinon: "14.0.0"
|
|
4642
4890
|
};
|
|
4643
4891
|
var dependencies = {
|
|
4644
4892
|
axios: "^0.27.0"
|
|
4645
4893
|
};
|
|
4646
|
-
var gitHead = "
|
|
4894
|
+
var gitHead = "dd641499aeaaae6f491cc55e0f37be400f300a3c";
|
|
4647
4895
|
var packageInfo = {
|
|
4648
4896
|
name: name$1,
|
|
4649
4897
|
version: version,
|