@tryghost/content-api 1.9.2 → 1.9.3
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 +3 -3
- package/es/content-api.js +597 -355
- package/es/content-api.js.map +1 -1
- package/package.json +3 -3
- 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
|
|
|
@@ -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,
|
|
@@ -750,7 +748,7 @@ var copyConstructorProperties = function (target, source, exceptions) {
|
|
|
750
748
|
var replacement = /#|\.prototype\./;
|
|
751
749
|
|
|
752
750
|
var isForced = function (feature, detection) {
|
|
753
|
-
var value = data[normalize(feature)];
|
|
751
|
+
var value = data$1[normalize(feature)];
|
|
754
752
|
return value == POLYFILL ? true
|
|
755
753
|
: value == NATIVE ? false
|
|
756
754
|
: isCallable(detection) ? fails(detection)
|
|
@@ -761,7 +759,7 @@ var normalize = isForced.normalize = function (string) {
|
|
|
761
759
|
return String(string).replace(replacement, '.').toLowerCase();
|
|
762
760
|
};
|
|
763
761
|
|
|
764
|
-
var data = isForced.data = {};
|
|
762
|
+
var data$1 = isForced.data = {};
|
|
765
763
|
var NATIVE = isForced.NATIVE = 'N';
|
|
766
764
|
var POLYFILL = isForced.POLYFILL = 'P';
|
|
767
765
|
|
|
@@ -913,7 +911,7 @@ var objectKeys = Object.keys || function keys(O) {
|
|
|
913
911
|
// `Object.defineProperties` method
|
|
914
912
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
915
913
|
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
916
|
-
var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
914
|
+
var f$1 = descriptors$1 && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
917
915
|
anObject(O);
|
|
918
916
|
var props = toIndexedObject(Properties);
|
|
919
917
|
var keys = objectKeys(Properties);
|
|
@@ -1707,7 +1705,7 @@ var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
|
1707
1705
|
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
|
1708
1706
|
var defineProperty = objectDefineProperty.f;
|
|
1709
1707
|
|
|
1710
|
-
if (descriptors && Constructor && !Constructor[SPECIES$2]) {
|
|
1708
|
+
if (descriptors$1 && Constructor && !Constructor[SPECIES$2]) {
|
|
1711
1709
|
defineProperty(Constructor, SPECIES$2, {
|
|
1712
1710
|
configurable: true,
|
|
1713
1711
|
get: function () { return this; }
|
|
@@ -2596,7 +2594,7 @@ var concat = functionUncurryThis([].concat);
|
|
|
2596
2594
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
2597
2595
|
var objectAssign = !$assign || fails(function () {
|
|
2598
2596
|
// should have correct order of operations (Edge bug)
|
|
2599
|
-
if (descriptors && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
|
|
2597
|
+
if (descriptors$1 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
|
|
2600
2598
|
enumerable: true,
|
|
2601
2599
|
get: function () {
|
|
2602
2600
|
defineProperty$1(this, 'b', {
|
|
@@ -2628,7 +2626,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2628
2626
|
var key;
|
|
2629
2627
|
while (length > j) {
|
|
2630
2628
|
key = keys[j++];
|
|
2631
|
-
if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
2629
|
+
if (!descriptors$1 || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
|
|
2632
2630
|
}
|
|
2633
2631
|
} return T;
|
|
2634
2632
|
} : $assign;
|
|
@@ -2652,7 +2650,7 @@ var NAME = 'name';
|
|
|
2652
2650
|
|
|
2653
2651
|
// Function instances `.name` property
|
|
2654
2652
|
// https://tc39.es/ecma262/#sec-function-instances-name
|
|
2655
|
-
if (descriptors && !FUNCTION_NAME_EXISTS) {
|
|
2653
|
+
if (descriptors$1 && !FUNCTION_NAME_EXISTS) {
|
|
2656
2654
|
defineProperty(FunctionPrototype, NAME, {
|
|
2657
2655
|
configurable: true,
|
|
2658
2656
|
get: function () {
|
|
@@ -2819,6 +2817,38 @@ var bind = function bind(fn, thisArg) {
|
|
|
2819
2817
|
|
|
2820
2818
|
var toString = Object.prototype.toString;
|
|
2821
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
|
+
|
|
2822
2852
|
/**
|
|
2823
2853
|
* Determine if a value is an Array
|
|
2824
2854
|
*
|
|
@@ -2826,7 +2856,7 @@ var toString = Object.prototype.toString;
|
|
|
2826
2856
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
2827
2857
|
*/
|
|
2828
2858
|
function isArray(val) {
|
|
2829
|
-
return
|
|
2859
|
+
return Array.isArray(val);
|
|
2830
2860
|
}
|
|
2831
2861
|
|
|
2832
2862
|
/**
|
|
@@ -2853,22 +2883,12 @@ function isBuffer(val) {
|
|
|
2853
2883
|
/**
|
|
2854
2884
|
* Determine if a value is an ArrayBuffer
|
|
2855
2885
|
*
|
|
2886
|
+
* @function
|
|
2856
2887
|
* @param {Object} val The value to test
|
|
2857
2888
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
2858
2889
|
*/
|
|
2859
|
-
|
|
2860
|
-
return toString.call(val) === '[object ArrayBuffer]';
|
|
2861
|
-
}
|
|
2890
|
+
var isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
2862
2891
|
|
|
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
2892
|
|
|
2873
2893
|
/**
|
|
2874
2894
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -2881,7 +2901,7 @@ function isArrayBufferView(val) {
|
|
|
2881
2901
|
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
2882
2902
|
result = ArrayBuffer.isView(val);
|
|
2883
2903
|
} else {
|
|
2884
|
-
result = (val) && (val.buffer) && (val.buffer
|
|
2904
|
+
result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
|
|
2885
2905
|
}
|
|
2886
2906
|
return result;
|
|
2887
2907
|
}
|
|
@@ -2923,7 +2943,7 @@ function isObject(val) {
|
|
|
2923
2943
|
* @return {boolean} True if value is a plain Object, otherwise false
|
|
2924
2944
|
*/
|
|
2925
2945
|
function isPlainObject(val) {
|
|
2926
|
-
if (
|
|
2946
|
+
if (kindOf(val) !== 'object') {
|
|
2927
2947
|
return false;
|
|
2928
2948
|
}
|
|
2929
2949
|
|
|
@@ -2934,32 +2954,38 @@ function isPlainObject(val) {
|
|
|
2934
2954
|
/**
|
|
2935
2955
|
* Determine if a value is a Date
|
|
2936
2956
|
*
|
|
2957
|
+
* @function
|
|
2937
2958
|
* @param {Object} val The value to test
|
|
2938
2959
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
2939
2960
|
*/
|
|
2940
|
-
|
|
2941
|
-
return toString.call(val) === '[object Date]';
|
|
2942
|
-
}
|
|
2961
|
+
var isDate = kindOfTest('Date');
|
|
2943
2962
|
|
|
2944
2963
|
/**
|
|
2945
2964
|
* Determine if a value is a File
|
|
2946
2965
|
*
|
|
2966
|
+
* @function
|
|
2947
2967
|
* @param {Object} val The value to test
|
|
2948
2968
|
* @returns {boolean} True if value is a File, otherwise false
|
|
2949
2969
|
*/
|
|
2950
|
-
|
|
2951
|
-
return toString.call(val) === '[object File]';
|
|
2952
|
-
}
|
|
2970
|
+
var isFile = kindOfTest('File');
|
|
2953
2971
|
|
|
2954
2972
|
/**
|
|
2955
2973
|
* Determine if a value is a Blob
|
|
2956
2974
|
*
|
|
2975
|
+
* @function
|
|
2957
2976
|
* @param {Object} val The value to test
|
|
2958
2977
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
2959
2978
|
*/
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
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');
|
|
2963
2989
|
|
|
2964
2990
|
/**
|
|
2965
2991
|
* Determine if a value is a Function
|
|
@@ -2982,14 +3008,27 @@ function isStream(val) {
|
|
|
2982
3008
|
}
|
|
2983
3009
|
|
|
2984
3010
|
/**
|
|
2985
|
-
* Determine if a value is a
|
|
3011
|
+
* Determine if a value is a FormData
|
|
2986
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
|
|
2987
3028
|
* @param {Object} val The value to test
|
|
2988
3029
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
2989
3030
|
*/
|
|
2990
|
-
|
|
2991
|
-
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
|
|
2992
|
-
}
|
|
3031
|
+
var isURLSearchParams = kindOfTest('URLSearchParams');
|
|
2993
3032
|
|
|
2994
3033
|
/**
|
|
2995
3034
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -3136,7 +3175,97 @@ function stripBOM(content) {
|
|
|
3136
3175
|
return content;
|
|
3137
3176
|
}
|
|
3138
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
|
+
|
|
3139
3266
|
var utils = {
|
|
3267
|
+
supportedProtocols: supportedProtocols,
|
|
3268
|
+
getProtocol: getProtocol,
|
|
3140
3269
|
isArray: isArray,
|
|
3141
3270
|
isArrayBuffer: isArrayBuffer,
|
|
3142
3271
|
isBuffer: isBuffer,
|
|
@@ -3158,7 +3287,15 @@ var utils = {
|
|
|
3158
3287
|
merge: merge,
|
|
3159
3288
|
extend: extend,
|
|
3160
3289
|
trim: trim,
|
|
3161
|
-
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
|
|
3162
3299
|
};
|
|
3163
3300
|
|
|
3164
3301
|
function encode(val) {
|
|
@@ -3289,26 +3426,27 @@ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName)
|
|
|
3289
3426
|
};
|
|
3290
3427
|
|
|
3291
3428
|
/**
|
|
3292
|
-
*
|
|
3429
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
3293
3430
|
*
|
|
3294
|
-
* @param {
|
|
3295
|
-
* @param {Object} config The config.
|
|
3431
|
+
* @param {string} message The error message.
|
|
3296
3432
|
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
3433
|
+
* @param {Object} [config] The config.
|
|
3297
3434
|
* @param {Object} [request] The request.
|
|
3298
3435
|
* @param {Object} [response] The response.
|
|
3299
|
-
* @returns {Error} The error.
|
|
3436
|
+
* @returns {Error} The created error.
|
|
3300
3437
|
*/
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
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
|
+
}
|
|
3310
3447
|
|
|
3311
|
-
|
|
3448
|
+
utils.inherits(AxiosError, Error, {
|
|
3449
|
+
toJSON: function toJSON() {
|
|
3312
3450
|
return {
|
|
3313
3451
|
// Standard
|
|
3314
3452
|
message: this.message,
|
|
@@ -3323,26 +3461,130 @@ var enhanceError = function enhanceError(error, config, code, request, response)
|
|
|
3323
3461
|
stack: this.stack,
|
|
3324
3462
|
// Axios
|
|
3325
3463
|
config: this.config,
|
|
3326
|
-
code: this.code
|
|
3464
|
+
code: this.code,
|
|
3465
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
3327
3466
|
};
|
|
3328
|
-
}
|
|
3329
|
-
|
|
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;
|
|
3330
3507
|
};
|
|
3331
3508
|
|
|
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);
|
|
3509
|
+
var AxiosError_1 = AxiosError;
|
|
3510
|
+
|
|
3511
|
+
var transitional = {
|
|
3512
|
+
silentJSONParsing: true,
|
|
3513
|
+
forcedJSONParsing: true,
|
|
3514
|
+
clarifyTimeoutError: false
|
|
3345
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;
|
|
3346
3588
|
|
|
3347
3589
|
/**
|
|
3348
3590
|
* Resolve or reject a Promise based on response status.
|
|
@@ -3356,10 +3598,10 @@ var settle = function settle(resolve, reject, response) {
|
|
|
3356
3598
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
3357
3599
|
resolve(response);
|
|
3358
3600
|
} else {
|
|
3359
|
-
reject(
|
|
3601
|
+
reject(new AxiosError_1(
|
|
3360
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],
|
|
3361
3604
|
response.config,
|
|
3362
|
-
null,
|
|
3363
3605
|
response.request,
|
|
3364
3606
|
response
|
|
3365
3607
|
));
|
|
@@ -3426,7 +3668,7 @@ var isAbsoluteURL = function isAbsoluteURL(url) {
|
|
|
3426
3668
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
3427
3669
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
3428
3670
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
3429
|
-
return /^([a-z][a-z\d
|
|
3671
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
3430
3672
|
};
|
|
3431
3673
|
|
|
3432
3674
|
/**
|
|
@@ -3573,14 +3815,38 @@ var isURLSameOrigin = (
|
|
|
3573
3815
|
})()
|
|
3574
3816
|
);
|
|
3575
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
|
+
|
|
3576
3836
|
var xhr = function xhrAdapter(config) {
|
|
3577
3837
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3578
3838
|
var requestData = config.data;
|
|
3579
3839
|
var requestHeaders = config.headers;
|
|
3580
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,6 +3859,9 @@ 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
|
|
@@ -3615,7 +3884,13 @@ var xhr = function xhrAdapter(config) {
|
|
|
3615
3884
|
request: request
|
|
3616
3885
|
};
|
|
3617
3886
|
|
|
3618
|
-
settle(
|
|
3887
|
+
settle(function _resolve(value) {
|
|
3888
|
+
resolve(value);
|
|
3889
|
+
done();
|
|
3890
|
+
}, function _reject(err) {
|
|
3891
|
+
reject(err);
|
|
3892
|
+
done();
|
|
3893
|
+
}, response);
|
|
3619
3894
|
|
|
3620
3895
|
// Clean up request
|
|
3621
3896
|
request = null;
|
|
@@ -3650,7 +3925,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
3650
3925
|
return;
|
|
3651
3926
|
}
|
|
3652
3927
|
|
|
3653
|
-
reject(
|
|
3928
|
+
reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
|
|
3654
3929
|
|
|
3655
3930
|
// Clean up request
|
|
3656
3931
|
request = null;
|
|
@@ -3660,7 +3935,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
3660
3935
|
request.onerror = function handleError() {
|
|
3661
3936
|
// Real errors are hidden from us by the browser
|
|
3662
3937
|
// onerror should only fire if it's a network error
|
|
3663
|
-
reject(
|
|
3938
|
+
reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request, request));
|
|
3664
3939
|
|
|
3665
3940
|
// Clean up request
|
|
3666
3941
|
request = null;
|
|
@@ -3668,14 +3943,15 @@ var xhr = function xhrAdapter(config) {
|
|
|
3668
3943
|
|
|
3669
3944
|
// Handle timeout
|
|
3670
3945
|
request.ontimeout = function handleTimeout() {
|
|
3671
|
-
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;
|
|
3672
3948
|
if (config.timeoutErrorMessage) {
|
|
3673
3949
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
3674
3950
|
}
|
|
3675
|
-
reject(
|
|
3951
|
+
reject(new AxiosError_1(
|
|
3676
3952
|
timeoutErrorMessage,
|
|
3953
|
+
transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
|
|
3677
3954
|
config,
|
|
3678
|
-
config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
3679
3955
|
request));
|
|
3680
3956
|
|
|
3681
3957
|
// Clean up request
|
|
@@ -3729,29 +4005,46 @@ var xhr = function xhrAdapter(config) {
|
|
|
3729
4005
|
request.upload.addEventListener('progress', config.onUploadProgress);
|
|
3730
4006
|
}
|
|
3731
4007
|
|
|
3732
|
-
if (config.cancelToken) {
|
|
4008
|
+
if (config.cancelToken || config.signal) {
|
|
3733
4009
|
// Handle cancellation
|
|
3734
|
-
|
|
4010
|
+
// eslint-disable-next-line func-names
|
|
4011
|
+
onCanceled = function(cancel) {
|
|
3735
4012
|
if (!request) {
|
|
3736
4013
|
return;
|
|
3737
4014
|
}
|
|
3738
|
-
|
|
4015
|
+
reject(!cancel || (cancel && cancel.type) ? new CanceledError_1() : cancel);
|
|
3739
4016
|
request.abort();
|
|
3740
|
-
reject(cancel);
|
|
3741
|
-
// Clean up request
|
|
3742
4017
|
request = null;
|
|
3743
|
-
}
|
|
4018
|
+
};
|
|
4019
|
+
|
|
4020
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
4021
|
+
if (config.signal) {
|
|
4022
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
4023
|
+
}
|
|
3744
4024
|
}
|
|
3745
4025
|
|
|
3746
4026
|
if (!requestData) {
|
|
3747
4027
|
requestData = null;
|
|
3748
4028
|
}
|
|
3749
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
|
+
|
|
3750
4040
|
// Send the request
|
|
3751
4041
|
request.send(requestData);
|
|
3752
4042
|
});
|
|
3753
4043
|
};
|
|
3754
4044
|
|
|
4045
|
+
// eslint-disable-next-line strict
|
|
4046
|
+
var _null = null;
|
|
4047
|
+
|
|
3755
4048
|
var DEFAULT_CONTENT_TYPE = {
|
|
3756
4049
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
3757
4050
|
};
|
|
@@ -3791,11 +4084,7 @@ function stringifySafely(rawValue, parser, encoder) {
|
|
|
3791
4084
|
|
|
3792
4085
|
var defaults = {
|
|
3793
4086
|
|
|
3794
|
-
transitional:
|
|
3795
|
-
silentJSONParsing: true,
|
|
3796
|
-
forcedJSONParsing: true,
|
|
3797
|
-
clarifyTimeoutError: false
|
|
3798
|
-
},
|
|
4087
|
+
transitional: transitional,
|
|
3799
4088
|
|
|
3800
4089
|
adapter: getDefaultAdapter(),
|
|
3801
4090
|
|
|
@@ -3819,15 +4108,25 @@ var defaults = {
|
|
|
3819
4108
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
3820
4109
|
return data.toString();
|
|
3821
4110
|
}
|
|
3822
|
-
|
|
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') {
|
|
3823
4121
|
setContentTypeIfUnset(headers, 'application/json');
|
|
3824
4122
|
return stringifySafely(data);
|
|
3825
4123
|
}
|
|
4124
|
+
|
|
3826
4125
|
return data;
|
|
3827
4126
|
}],
|
|
3828
4127
|
|
|
3829
4128
|
transformResponse: [function transformResponse(data) {
|
|
3830
|
-
var transitional = this.transitional;
|
|
4129
|
+
var transitional = this.transitional || defaults.transitional;
|
|
3831
4130
|
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
3832
4131
|
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
3833
4132
|
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
@@ -3838,7 +4137,7 @@ var defaults = {
|
|
|
3838
4137
|
} catch (e) {
|
|
3839
4138
|
if (strictJSONParsing) {
|
|
3840
4139
|
if (e.name === 'SyntaxError') {
|
|
3841
|
-
throw
|
|
4140
|
+
throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
3842
4141
|
}
|
|
3843
4142
|
throw e;
|
|
3844
4143
|
}
|
|
@@ -3860,14 +4159,18 @@ var defaults = {
|
|
|
3860
4159
|
maxContentLength: -1,
|
|
3861
4160
|
maxBodyLength: -1,
|
|
3862
4161
|
|
|
4162
|
+
env: {
|
|
4163
|
+
FormData: _null
|
|
4164
|
+
},
|
|
4165
|
+
|
|
3863
4166
|
validateStatus: function validateStatus(status) {
|
|
3864
4167
|
return status >= 200 && status < 300;
|
|
3865
|
-
}
|
|
3866
|
-
};
|
|
4168
|
+
},
|
|
3867
4169
|
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
4170
|
+
headers: {
|
|
4171
|
+
common: {
|
|
4172
|
+
'Accept': 'application/json, text/plain, */*'
|
|
4173
|
+
}
|
|
3871
4174
|
}
|
|
3872
4175
|
};
|
|
3873
4176
|
|
|
@@ -3904,12 +4207,16 @@ var isCancel = function isCancel(value) {
|
|
|
3904
4207
|
};
|
|
3905
4208
|
|
|
3906
4209
|
/**
|
|
3907
|
-
* Throws a `
|
|
4210
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
3908
4211
|
*/
|
|
3909
4212
|
function throwIfCancellationRequested(config) {
|
|
3910
4213
|
if (config.cancelToken) {
|
|
3911
4214
|
config.cancelToken.throwIfRequested();
|
|
3912
4215
|
}
|
|
4216
|
+
|
|
4217
|
+
if (config.signal && config.signal.aborted) {
|
|
4218
|
+
throw new CanceledError_1();
|
|
4219
|
+
}
|
|
3913
4220
|
}
|
|
3914
4221
|
|
|
3915
4222
|
/**
|
|
@@ -3992,17 +4299,6 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
3992
4299
|
config2 = config2 || {};
|
|
3993
4300
|
var config = {};
|
|
3994
4301
|
|
|
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
4302
|
function getMergedValue(target, source) {
|
|
4007
4303
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
4008
4304
|
return utils.merge(target, source);
|
|
@@ -4014,182 +4310,85 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
4014
4310
|
return source;
|
|
4015
4311
|
}
|
|
4016
4312
|
|
|
4313
|
+
// eslint-disable-next-line consistent-return
|
|
4017
4314
|
function mergeDeepProperties(prop) {
|
|
4018
4315
|
if (!utils.isUndefined(config2[prop])) {
|
|
4019
|
-
|
|
4316
|
+
return getMergedValue(config1[prop], config2[prop]);
|
|
4020
4317
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
4021
|
-
|
|
4318
|
+
return getMergedValue(undefined, config1[prop]);
|
|
4022
4319
|
}
|
|
4023
4320
|
}
|
|
4024
4321
|
|
|
4025
|
-
|
|
4322
|
+
// eslint-disable-next-line consistent-return
|
|
4323
|
+
function valueFromConfig2(prop) {
|
|
4026
4324
|
if (!utils.isUndefined(config2[prop])) {
|
|
4027
|
-
|
|
4325
|
+
return getMergedValue(undefined, config2[prop]);
|
|
4028
4326
|
}
|
|
4029
|
-
}
|
|
4030
|
-
|
|
4031
|
-
utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
|
|
4327
|
+
}
|
|
4032
4328
|
|
|
4033
|
-
|
|
4329
|
+
// eslint-disable-next-line consistent-return
|
|
4330
|
+
function defaultToConfig2(prop) {
|
|
4034
4331
|
if (!utils.isUndefined(config2[prop])) {
|
|
4035
|
-
|
|
4332
|
+
return getMergedValue(undefined, config2[prop]);
|
|
4036
4333
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
4037
|
-
|
|
4334
|
+
return getMergedValue(undefined, config1[prop]);
|
|
4038
4335
|
}
|
|
4039
|
-
}
|
|
4336
|
+
}
|
|
4040
4337
|
|
|
4041
|
-
|
|
4338
|
+
// eslint-disable-next-line consistent-return
|
|
4339
|
+
function mergeDirectKeys(prop) {
|
|
4042
4340
|
if (prop in config2) {
|
|
4043
|
-
|
|
4341
|
+
return getMergedValue(config1[prop], config2[prop]);
|
|
4044
4342
|
} else if (prop in config1) {
|
|
4045
|
-
|
|
4343
|
+
return getMergedValue(undefined, config1[prop]);
|
|
4046
4344
|
}
|
|
4047
|
-
}
|
|
4048
|
-
|
|
4049
|
-
var axiosKeys = valueFromConfig2Keys
|
|
4050
|
-
.concat(mergeDeepPropertiesKeys)
|
|
4051
|
-
.concat(defaultToConfig2Keys)
|
|
4052
|
-
.concat(directMergeKeys);
|
|
4345
|
+
}
|
|
4053
4346
|
|
|
4054
|
-
var
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
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
|
+
};
|
|
4060
4376
|
|
|
4061
|
-
utils.forEach(
|
|
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);
|
|
4381
|
+
});
|
|
4062
4382
|
|
|
4063
4383
|
return config;
|
|
4064
4384
|
};
|
|
4065
4385
|
|
|
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
|
-
});
|
|
4386
|
+
var data = {
|
|
4387
|
+
"version": "0.27.0"
|
|
4388
|
+
};
|
|
4389
|
+
|
|
4390
|
+
var VERSION = data.version;
|
|
4191
4391
|
|
|
4192
|
-
var pkg = getCjsExportFromNamespace(_package$1);
|
|
4193
4392
|
|
|
4194
4393
|
var validators$1 = {};
|
|
4195
4394
|
|
|
@@ -4201,48 +4400,29 @@ var validators$1 = {};
|
|
|
4201
4400
|
});
|
|
4202
4401
|
|
|
4203
4402
|
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
4403
|
|
|
4225
4404
|
/**
|
|
4226
4405
|
* Transitional option validator
|
|
4227
|
-
* @param {function|boolean?} validator
|
|
4228
|
-
* @param {string?} version
|
|
4229
|
-
* @param {string} message
|
|
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
|
|
4230
4409
|
* @returns {function}
|
|
4231
4410
|
*/
|
|
4232
4411
|
validators$1.transitional = function transitional(validator, version, message) {
|
|
4233
|
-
var isDeprecated = version && isOlderVersion(version);
|
|
4234
|
-
|
|
4235
4412
|
function formatMessage(opt, desc) {
|
|
4236
|
-
return '[Axios v' +
|
|
4413
|
+
return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
4237
4414
|
}
|
|
4238
4415
|
|
|
4239
4416
|
// eslint-disable-next-line func-names
|
|
4240
4417
|
return function(value, opt, opts) {
|
|
4241
4418
|
if (validator === false) {
|
|
4242
|
-
throw new
|
|
4419
|
+
throw new AxiosError_1(
|
|
4420
|
+
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
4421
|
+
AxiosError_1.ERR_DEPRECATED
|
|
4422
|
+
);
|
|
4243
4423
|
}
|
|
4244
4424
|
|
|
4245
|
-
if (
|
|
4425
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
4246
4426
|
deprecatedWarnings[opt] = true;
|
|
4247
4427
|
// eslint-disable-next-line no-console
|
|
4248
4428
|
console.warn(
|
|
@@ -4266,7 +4446,7 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
4266
4446
|
|
|
4267
4447
|
function assertOptions(options, schema, allowUnknown) {
|
|
4268
4448
|
if (typeof options !== 'object') {
|
|
4269
|
-
throw new
|
|
4449
|
+
throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
|
|
4270
4450
|
}
|
|
4271
4451
|
var keys = Object.keys(options);
|
|
4272
4452
|
var i = keys.length;
|
|
@@ -4277,18 +4457,17 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
4277
4457
|
var value = options[opt];
|
|
4278
4458
|
var result = value === undefined || validator(value, opt, options);
|
|
4279
4459
|
if (result !== true) {
|
|
4280
|
-
throw new
|
|
4460
|
+
throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
|
|
4281
4461
|
}
|
|
4282
4462
|
continue;
|
|
4283
4463
|
}
|
|
4284
4464
|
if (allowUnknown !== true) {
|
|
4285
|
-
throw
|
|
4465
|
+
throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
|
|
4286
4466
|
}
|
|
4287
4467
|
}
|
|
4288
4468
|
}
|
|
4289
4469
|
|
|
4290
4470
|
var validator = {
|
|
4291
|
-
isOlderVersion: isOlderVersion,
|
|
4292
4471
|
assertOptions: assertOptions,
|
|
4293
4472
|
validators: validators$1
|
|
4294
4473
|
};
|
|
@@ -4312,14 +4491,14 @@ function Axios(instanceConfig) {
|
|
|
4312
4491
|
*
|
|
4313
4492
|
* @param {Object} config The config specific for this request (merged with this.defaults)
|
|
4314
4493
|
*/
|
|
4315
|
-
Axios.prototype.request = function request(config) {
|
|
4494
|
+
Axios.prototype.request = function request(configOrUrl, config) {
|
|
4316
4495
|
/*eslint no-param-reassign:0*/
|
|
4317
4496
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
4318
|
-
if (typeof
|
|
4319
|
-
config = arguments[1] || {};
|
|
4320
|
-
config.url = arguments[0];
|
|
4321
|
-
} else {
|
|
4497
|
+
if (typeof configOrUrl === 'string') {
|
|
4322
4498
|
config = config || {};
|
|
4499
|
+
config.url = configOrUrl;
|
|
4500
|
+
} else {
|
|
4501
|
+
config = configOrUrl || {};
|
|
4323
4502
|
}
|
|
4324
4503
|
|
|
4325
4504
|
config = mergeConfig(this.defaults, config);
|
|
@@ -4337,9 +4516,9 @@ Axios.prototype.request = function request(config) {
|
|
|
4337
4516
|
|
|
4338
4517
|
if (transitional !== undefined) {
|
|
4339
4518
|
validator.assertOptions(transitional, {
|
|
4340
|
-
silentJSONParsing: validators.transitional(validators.boolean
|
|
4341
|
-
forcedJSONParsing: validators.transitional(validators.boolean
|
|
4342
|
-
clarifyTimeoutError: validators.transitional(validators.boolean
|
|
4519
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
4520
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
4521
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
4343
4522
|
}, false);
|
|
4344
4523
|
}
|
|
4345
4524
|
|
|
@@ -4405,7 +4584,8 @@ Axios.prototype.request = function request(config) {
|
|
|
4405
4584
|
|
|
4406
4585
|
Axios.prototype.getUri = function getUri(config) {
|
|
4407
4586
|
config = mergeConfig(this.defaults, config);
|
|
4408
|
-
|
|
4587
|
+
var fullPath = buildFullPath(config.baseURL, config.url);
|
|
4588
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
4409
4589
|
};
|
|
4410
4590
|
|
|
4411
4591
|
// Provide aliases for supported request methods
|
|
@@ -4422,34 +4602,26 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
|
|
|
4422
4602
|
|
|
4423
4603
|
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4424
4604
|
/*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
|
-
|
|
4434
|
-
var Axios_1 = Axios;
|
|
4435
4605
|
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
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
|
+
}
|
|
4445
4618
|
|
|
4446
|
-
|
|
4447
|
-
return 'Cancel' + (this.message ? ': ' + this.message : '');
|
|
4448
|
-
};
|
|
4619
|
+
Axios.prototype[method] = generateHTTPMethod();
|
|
4449
4620
|
|
|
4450
|
-
|
|
4621
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4622
|
+
});
|
|
4451
4623
|
|
|
4452
|
-
var
|
|
4624
|
+
var Axios_1 = Axios;
|
|
4453
4625
|
|
|
4454
4626
|
/**
|
|
4455
4627
|
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
@@ -4463,24 +4635,55 @@ function CancelToken(executor) {
|
|
|
4463
4635
|
}
|
|
4464
4636
|
|
|
4465
4637
|
var resolvePromise;
|
|
4638
|
+
|
|
4466
4639
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
4467
4640
|
resolvePromise = resolve;
|
|
4468
4641
|
});
|
|
4469
4642
|
|
|
4470
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
|
+
|
|
4471
4674
|
executor(function cancel(message) {
|
|
4472
4675
|
if (token.reason) {
|
|
4473
4676
|
// Cancellation has already been requested
|
|
4474
4677
|
return;
|
|
4475
4678
|
}
|
|
4476
4679
|
|
|
4477
|
-
token.reason = new
|
|
4680
|
+
token.reason = new CanceledError_1(message);
|
|
4478
4681
|
resolvePromise(token.reason);
|
|
4479
4682
|
});
|
|
4480
4683
|
}
|
|
4481
4684
|
|
|
4482
4685
|
/**
|
|
4483
|
-
* Throws a `
|
|
4686
|
+
* Throws a `CanceledError` if cancellation has been requested.
|
|
4484
4687
|
*/
|
|
4485
4688
|
CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
4486
4689
|
if (this.reason) {
|
|
@@ -4488,6 +4691,37 @@ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
|
|
|
4488
4691
|
}
|
|
4489
4692
|
};
|
|
4490
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
|
+
|
|
4491
4725
|
/**
|
|
4492
4726
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
4493
4727
|
* cancels the `CancelToken`.
|
|
@@ -4538,7 +4772,7 @@ var spread = function spread(callback) {
|
|
|
4538
4772
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
4539
4773
|
*/
|
|
4540
4774
|
var isAxiosError = function isAxiosError(payload) {
|
|
4541
|
-
return (
|
|
4775
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
4542
4776
|
};
|
|
4543
4777
|
|
|
4544
4778
|
/**
|
|
@@ -4557,6 +4791,11 @@ function createInstance(defaultConfig) {
|
|
|
4557
4791
|
// Copy context to instance
|
|
4558
4792
|
utils.extend(instance, context);
|
|
4559
4793
|
|
|
4794
|
+
// Factory for creating new instances
|
|
4795
|
+
instance.create = function create(instanceConfig) {
|
|
4796
|
+
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
4797
|
+
};
|
|
4798
|
+
|
|
4560
4799
|
return instance;
|
|
4561
4800
|
}
|
|
4562
4801
|
|
|
@@ -4566,15 +4805,18 @@ var axios$1 = createInstance(defaults_1);
|
|
|
4566
4805
|
// Expose Axios class to allow class inheritance
|
|
4567
4806
|
axios$1.Axios = Axios_1;
|
|
4568
4807
|
|
|
4569
|
-
// Factory for creating new instances
|
|
4570
|
-
axios$1.create = function create(instanceConfig) {
|
|
4571
|
-
return createInstance(mergeConfig(axios$1.defaults, instanceConfig));
|
|
4572
|
-
};
|
|
4573
|
-
|
|
4574
4808
|
// Expose Cancel & CancelToken
|
|
4575
|
-
axios$1.
|
|
4809
|
+
axios$1.CanceledError = CanceledError_1;
|
|
4576
4810
|
axios$1.CancelToken = CancelToken_1;
|
|
4577
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;
|
|
4578
4820
|
|
|
4579
4821
|
// Expose all/spread
|
|
4580
4822
|
axios$1.all = function all(promises) {
|
|
@@ -4594,7 +4836,7 @@ axios_1.default = default_1;
|
|
|
4594
4836
|
var axios = axios_1;
|
|
4595
4837
|
|
|
4596
4838
|
var name$1 = "@tryghost/content-api";
|
|
4597
|
-
var version = "1.9.
|
|
4839
|
+
var version = "1.9.3";
|
|
4598
4840
|
var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
|
|
4599
4841
|
var author = "Ghost Foundation";
|
|
4600
4842
|
var license = "MIT";
|
|
@@ -4631,7 +4873,7 @@ var devDependencies = {
|
|
|
4631
4873
|
"core-js": "3.22.4",
|
|
4632
4874
|
"eslint-plugin-ghost": "2.13.0",
|
|
4633
4875
|
mocha: "10.0.0",
|
|
4634
|
-
rollup: "2.
|
|
4876
|
+
rollup: "2.72.1",
|
|
4635
4877
|
"rollup-plugin-babel": "4.4.0",
|
|
4636
4878
|
"rollup-plugin-commonjs": "10.1.0",
|
|
4637
4879
|
"rollup-plugin-node-resolve": "5.2.0",
|
|
@@ -4643,7 +4885,7 @@ var devDependencies = {
|
|
|
4643
4885
|
var dependencies = {
|
|
4644
4886
|
axios: "^0.27.0"
|
|
4645
4887
|
};
|
|
4646
|
-
var gitHead = "
|
|
4888
|
+
var gitHead = "1b8c08ab41c317f79bff2b1be65fab6ee638d9d5";
|
|
4647
4889
|
var packageInfo = {
|
|
4648
4890
|
name: name$1,
|
|
4649
4891
|
version: version,
|