contentful 11.12.1 → 11.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +127 -40
- package/README.md +4 -0
- package/dist/contentful.browser.js +1509 -1140
- package/dist/contentful.browser.min.js +1 -1
- package/dist/contentful.cjs +1513 -935
- package/dist/stats-browser-min.html +1 -1
- package/package.json +1 -1
|
@@ -27,36 +27,6 @@ var contentful = (function (exports) {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function _arrayLikeToArray$4(r, a) {
|
|
31
|
-
(null == a || a > r.length) && (a = r.length);
|
|
32
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
33
|
-
return n;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _arrayWithoutHoles(r) {
|
|
37
|
-
if (Array.isArray(r)) return _arrayLikeToArray$4(r);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _iterableToArray(r) {
|
|
41
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _unsupportedIterableToArray$4(r, a) {
|
|
45
|
-
if (r) {
|
|
46
|
-
if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
|
|
47
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
48
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function _nonIterableSpread() {
|
|
53
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _toConsumableArray$1(r) {
|
|
57
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
30
|
function _typeof$2(o) {
|
|
61
31
|
"@babel/helpers - typeof";
|
|
62
32
|
|
|
@@ -92,22 +62,6 @@ var contentful = (function (exports) {
|
|
|
92
62
|
}) : e[r] = t, e;
|
|
93
63
|
}
|
|
94
64
|
|
|
95
|
-
function _classCallCheck(a, n) {
|
|
96
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function _defineProperties(e, r) {
|
|
100
|
-
for (var t = 0; t < r.length; t++) {
|
|
101
|
-
var o = r[t];
|
|
102
|
-
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function _createClass(e, r, t) {
|
|
106
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
107
|
-
writable: false
|
|
108
|
-
}), e;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
65
|
function _assertThisInitialized(e) {
|
|
112
66
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
113
67
|
return e;
|
|
@@ -192,6 +146,52 @@ var contentful = (function (exports) {
|
|
|
192
146
|
}, _wrapNativeSuper(t);
|
|
193
147
|
}
|
|
194
148
|
|
|
149
|
+
function _arrayLikeToArray$4(r, a) {
|
|
150
|
+
(null == a || a > r.length) && (a = r.length);
|
|
151
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
152
|
+
return n;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function _arrayWithoutHoles(r) {
|
|
156
|
+
if (Array.isArray(r)) return _arrayLikeToArray$4(r);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function _iterableToArray(r) {
|
|
160
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function _unsupportedIterableToArray$4(r, a) {
|
|
164
|
+
if (r) {
|
|
165
|
+
if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
|
|
166
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
167
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function _nonIterableSpread() {
|
|
172
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function _toConsumableArray$1(r) {
|
|
176
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function _classCallCheck(a, n) {
|
|
180
|
+
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function _defineProperties(e, r) {
|
|
184
|
+
for (var t = 0; t < r.length; t++) {
|
|
185
|
+
var o = r[t];
|
|
186
|
+
o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function _createClass(e, r, t) {
|
|
190
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
191
|
+
writable: false
|
|
192
|
+
}), e;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
195
|
function _arrayWithHoles(r) {
|
|
196
196
|
if (Array.isArray(r)) return r;
|
|
197
197
|
}
|
|
@@ -693,13 +693,13 @@ var contentful = (function (exports) {
|
|
|
693
693
|
}
|
|
694
694
|
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
695
695
|
|
|
696
|
-
function _createForOfIteratorHelper$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
697
|
-
function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
|
|
698
|
-
function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
699
696
|
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
700
697
|
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
701
698
|
function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
702
699
|
function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
700
|
+
function _createForOfIteratorHelper$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
701
|
+
function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
|
|
702
|
+
function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
703
703
|
function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
|
|
704
704
|
function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: true }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
|
|
705
705
|
|
|
@@ -901,9 +901,9 @@ var contentful = (function (exports) {
|
|
|
901
901
|
* also have a `name` and `type` attribute to specify filename and content type
|
|
902
902
|
*
|
|
903
903
|
* @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
|
|
904
|
-
*
|
|
904
|
+
*
|
|
905
905
|
* @param {*} value The value to test
|
|
906
|
-
*
|
|
906
|
+
*
|
|
907
907
|
* @returns {boolean} True if value is a React Native Blob, otherwise false
|
|
908
908
|
*/
|
|
909
909
|
var isReactNativeBlob = function isReactNativeBlob(value) {
|
|
@@ -913,9 +913,9 @@ var contentful = (function (exports) {
|
|
|
913
913
|
/**
|
|
914
914
|
* Determine if environment is React Native
|
|
915
915
|
* ReactNative `FormData` has a non-standard `getParts()` method
|
|
916
|
-
*
|
|
916
|
+
*
|
|
917
917
|
* @param {*} formData The formData to test
|
|
918
|
-
*
|
|
918
|
+
*
|
|
919
919
|
* @returns {boolean} True if environment is React Native, otherwise false
|
|
920
920
|
*/
|
|
921
921
|
var isReactNative$1 = function isReactNative(formData) {
|
|
@@ -936,7 +936,7 @@ var contentful = (function (exports) {
|
|
|
936
936
|
*
|
|
937
937
|
* @param {*} val The value to test
|
|
938
938
|
*
|
|
939
|
-
* @returns {boolean} True if value is a
|
|
939
|
+
* @returns {boolean} True if value is a FileList, otherwise false
|
|
940
940
|
*/
|
|
941
941
|
var isFileList = kindOfTest('FileList');
|
|
942
942
|
|
|
@@ -968,10 +968,16 @@ var contentful = (function (exports) {
|
|
|
968
968
|
var G$1 = getGlobal();
|
|
969
969
|
var FormDataCtor = typeof G$1.FormData !== 'undefined' ? G$1.FormData : undefined;
|
|
970
970
|
var isFormData = function isFormData(thing) {
|
|
971
|
-
|
|
972
|
-
|
|
971
|
+
if (!thing) return false;
|
|
972
|
+
if (FormDataCtor && thing instanceof FormDataCtor) return true;
|
|
973
|
+
// Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
|
|
974
|
+
var proto = getPrototypeOf$1(thing);
|
|
975
|
+
if (!proto || proto === Object.prototype) return false;
|
|
976
|
+
if (!isFunction$1(thing.append)) return false;
|
|
977
|
+
var kind = kindOf(thing);
|
|
978
|
+
return kind === 'formdata' ||
|
|
973
979
|
// detect form-data instance
|
|
974
|
-
kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'
|
|
980
|
+
kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]';
|
|
975
981
|
};
|
|
976
982
|
|
|
977
983
|
/**
|
|
@@ -1104,8 +1110,7 @@ var contentful = (function (exports) {
|
|
|
1104
1110
|
*
|
|
1105
1111
|
* @returns {Object} Result of all merge properties
|
|
1106
1112
|
*/
|
|
1107
|
-
function merge$1(
|
|
1108
|
-
) {
|
|
1113
|
+
function merge$1() {
|
|
1109
1114
|
var _ref4 = isContextDefined(this) && this || {},
|
|
1110
1115
|
caseless = _ref4.caseless,
|
|
1111
1116
|
skipUndefined = _ref4.skipUndefined;
|
|
@@ -1116,8 +1121,12 @@ var contentful = (function (exports) {
|
|
|
1116
1121
|
return;
|
|
1117
1122
|
}
|
|
1118
1123
|
var targetKey = caseless && findKey(result, key) || key;
|
|
1119
|
-
|
|
1120
|
-
|
|
1124
|
+
// Read via own-prop only — a bare `result[targetKey]` walks the prototype
|
|
1125
|
+
// chain, so a polluted Object.prototype value could surface here and get
|
|
1126
|
+
// copied into the merged result.
|
|
1127
|
+
var existing = hasOwnProperty$3(result, targetKey) ? result[targetKey] : undefined;
|
|
1128
|
+
if (isPlainObject$2(existing) && isPlainObject$2(val)) {
|
|
1129
|
+
result[targetKey] = merge$1(existing, val);
|
|
1121
1130
|
} else if (isPlainObject$2(val)) {
|
|
1122
1131
|
result[targetKey] = merge$1({}, val);
|
|
1123
1132
|
} else if (isArray$7(val)) {
|
|
@@ -1126,8 +1135,11 @@ var contentful = (function (exports) {
|
|
|
1126
1135
|
result[targetKey] = val;
|
|
1127
1136
|
}
|
|
1128
1137
|
};
|
|
1129
|
-
for (var
|
|
1130
|
-
|
|
1138
|
+
for (var _len = arguments.length, objs = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
1139
|
+
objs[_key2] = arguments[_key2];
|
|
1140
|
+
}
|
|
1141
|
+
for (var i = 0, l = objs.length; i < l; i++) {
|
|
1142
|
+
objs[i] && forEach(objs[i], assignValue);
|
|
1131
1143
|
}
|
|
1132
1144
|
return result;
|
|
1133
1145
|
}
|
|
@@ -1149,6 +1161,9 @@ var contentful = (function (exports) {
|
|
|
1149
1161
|
forEach(b, function (val, key) {
|
|
1150
1162
|
if (thisArg && isFunction$1(val)) {
|
|
1151
1163
|
Object.defineProperty(a, key, {
|
|
1164
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot
|
|
1165
|
+
// hijack defineProperty's accessor-vs-data resolution.
|
|
1166
|
+
__proto__: null,
|
|
1152
1167
|
value: bind$3(val, thisArg),
|
|
1153
1168
|
writable: true,
|
|
1154
1169
|
enumerable: true,
|
|
@@ -1156,6 +1171,7 @@ var contentful = (function (exports) {
|
|
|
1156
1171
|
});
|
|
1157
1172
|
} else {
|
|
1158
1173
|
Object.defineProperty(a, key, {
|
|
1174
|
+
__proto__: null,
|
|
1159
1175
|
value: val,
|
|
1160
1176
|
writable: true,
|
|
1161
1177
|
enumerable: true,
|
|
@@ -1194,12 +1210,14 @@ var contentful = (function (exports) {
|
|
|
1194
1210
|
var inherits = function inherits(constructor, superConstructor, props, descriptors) {
|
|
1195
1211
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
1196
1212
|
Object.defineProperty(constructor.prototype, 'constructor', {
|
|
1213
|
+
__proto__: null,
|
|
1197
1214
|
value: constructor,
|
|
1198
1215
|
writable: true,
|
|
1199
1216
|
enumerable: false,
|
|
1200
1217
|
configurable: true
|
|
1201
1218
|
});
|
|
1202
1219
|
Object.defineProperty(constructor, 'super', {
|
|
1220
|
+
__proto__: null,
|
|
1203
1221
|
value: superConstructor.prototype
|
|
1204
1222
|
});
|
|
1205
1223
|
props && Object.assign(constructor.prototype, props);
|
|
@@ -1370,7 +1388,7 @@ var contentful = (function (exports) {
|
|
|
1370
1388
|
var freezeMethods = function freezeMethods(obj) {
|
|
1371
1389
|
reduceDescriptors(obj, function (descriptor, name) {
|
|
1372
1390
|
// skip restricted props in strict mode
|
|
1373
|
-
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].
|
|
1391
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
|
|
1374
1392
|
return false;
|
|
1375
1393
|
}
|
|
1376
1394
|
var value = obj[name];
|
|
@@ -1581,1087 +1599,1167 @@ var contentful = (function (exports) {
|
|
|
1581
1599
|
asap: asap,
|
|
1582
1600
|
isIterable: isIterable
|
|
1583
1601
|
};
|
|
1584
|
-
var AxiosError = /*#__PURE__*/function (_Error) {
|
|
1585
|
-
/**
|
|
1586
|
-
* Create an Error with the specified message, config, error code, request and response.
|
|
1587
|
-
*
|
|
1588
|
-
* @param {string} message The error message.
|
|
1589
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
1590
|
-
* @param {Object} [config] The config.
|
|
1591
|
-
* @param {Object} [request] The request.
|
|
1592
|
-
* @param {Object} [response] The response.
|
|
1593
|
-
*
|
|
1594
|
-
* @returns {Error} The created error.
|
|
1595
|
-
*/
|
|
1596
|
-
function AxiosError(message, code, config, request, response) {
|
|
1597
|
-
var _this;
|
|
1598
|
-
_classCallCheck(this, AxiosError);
|
|
1599
|
-
_this = _callSuper$3(this, AxiosError, [message]);
|
|
1600
|
-
|
|
1601
|
-
// Make message enumerable to maintain backward compatibility
|
|
1602
|
-
// The native Error constructor sets message as non-enumerable,
|
|
1603
|
-
// but axios < v1.13.3 had it as enumerable
|
|
1604
|
-
Object.defineProperty(_this, 'message', {
|
|
1605
|
-
value: message,
|
|
1606
|
-
enumerable: true,
|
|
1607
|
-
writable: true,
|
|
1608
|
-
configurable: true
|
|
1609
|
-
});
|
|
1610
|
-
_this.name = 'AxiosError';
|
|
1611
|
-
_this.isAxiosError = true;
|
|
1612
|
-
code && (_this.code = code);
|
|
1613
|
-
config && (_this.config = config);
|
|
1614
|
-
request && (_this.request = request);
|
|
1615
|
-
if (response) {
|
|
1616
|
-
_this.response = response;
|
|
1617
|
-
_this.status = response.status;
|
|
1618
|
-
}
|
|
1619
|
-
return _this;
|
|
1620
|
-
}
|
|
1621
|
-
_inherits(AxiosError, _Error);
|
|
1622
|
-
return _createClass(AxiosError, [{
|
|
1623
|
-
key: "toJSON",
|
|
1624
|
-
value: function toJSON() {
|
|
1625
|
-
return {
|
|
1626
|
-
// Standard
|
|
1627
|
-
message: this.message,
|
|
1628
|
-
name: this.name,
|
|
1629
|
-
// Microsoft
|
|
1630
|
-
description: this.description,
|
|
1631
|
-
number: this.number,
|
|
1632
|
-
// Mozilla
|
|
1633
|
-
fileName: this.fileName,
|
|
1634
|
-
lineNumber: this.lineNumber,
|
|
1635
|
-
columnNumber: this.columnNumber,
|
|
1636
|
-
stack: this.stack,
|
|
1637
|
-
// Axios
|
|
1638
|
-
config: utils$1$1.toJSONObject(this.config),
|
|
1639
|
-
code: this.code,
|
|
1640
|
-
status: this.status
|
|
1641
|
-
};
|
|
1642
|
-
}
|
|
1643
|
-
}], [{
|
|
1644
|
-
key: "from",
|
|
1645
|
-
value: function from(error, code, config, request, response, customProps) {
|
|
1646
|
-
var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
1647
|
-
axiosError.cause = error;
|
|
1648
|
-
axiosError.name = error.name;
|
|
1649
|
-
|
|
1650
|
-
// Preserve status from the original error if not already set from response
|
|
1651
|
-
if (error.status != null && axiosError.status == null) {
|
|
1652
|
-
axiosError.status = error.status;
|
|
1653
|
-
}
|
|
1654
|
-
customProps && Object.assign(axiosError, customProps);
|
|
1655
|
-
return axiosError;
|
|
1656
|
-
}
|
|
1657
|
-
}]);
|
|
1658
|
-
}(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
1659
|
-
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
1660
|
-
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
1661
|
-
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
1662
|
-
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
1663
|
-
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
1664
|
-
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
1665
|
-
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
1666
|
-
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
1667
|
-
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
1668
|
-
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
1669
|
-
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
1670
|
-
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
1671
1602
|
|
|
1672
|
-
//
|
|
1673
|
-
|
|
1603
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1604
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1605
|
+
var ignoreDuplicateOf = utils$1$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
|
|
1674
1606
|
|
|
1675
1607
|
/**
|
|
1676
|
-
*
|
|
1677
|
-
*
|
|
1678
|
-
* @param {string} thing - The object or array to be visited.
|
|
1608
|
+
* Parse headers into an object
|
|
1679
1609
|
*
|
|
1680
|
-
*
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
/**
|
|
1687
|
-
* It removes the brackets from the end of a string
|
|
1610
|
+
* ```
|
|
1611
|
+
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
1612
|
+
* Content-Type: application/json
|
|
1613
|
+
* Connection: keep-alive
|
|
1614
|
+
* Transfer-Encoding: chunked
|
|
1615
|
+
* ```
|
|
1688
1616
|
*
|
|
1689
|
-
* @param {
|
|
1617
|
+
* @param {String} rawHeaders Headers needing to be parsed
|
|
1690
1618
|
*
|
|
1691
|
-
* @returns {
|
|
1619
|
+
* @returns {Object} Headers parsed into an object
|
|
1692
1620
|
*/
|
|
1693
|
-
function
|
|
1694
|
-
|
|
1621
|
+
var parseHeaders = function parseHeaders(rawHeaders) {
|
|
1622
|
+
var parsed = {};
|
|
1623
|
+
var key;
|
|
1624
|
+
var val;
|
|
1625
|
+
var i;
|
|
1626
|
+
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
|
1627
|
+
i = line.indexOf(':');
|
|
1628
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
1629
|
+
val = line.substring(i + 1).trim();
|
|
1630
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
1631
|
+
return;
|
|
1632
|
+
}
|
|
1633
|
+
if (key === 'set-cookie') {
|
|
1634
|
+
if (parsed[key]) {
|
|
1635
|
+
parsed[key].push(val);
|
|
1636
|
+
} else {
|
|
1637
|
+
parsed[key] = [val];
|
|
1638
|
+
}
|
|
1639
|
+
} else {
|
|
1640
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1641
|
+
}
|
|
1642
|
+
});
|
|
1643
|
+
return parsed;
|
|
1644
|
+
};
|
|
1645
|
+
var $internals = Symbol('internals');
|
|
1646
|
+
var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
|
|
1647
|
+
function trimSPorHTAB(str) {
|
|
1648
|
+
var start = 0;
|
|
1649
|
+
var end = str.length;
|
|
1650
|
+
while (start < end) {
|
|
1651
|
+
var code = str.charCodeAt(start);
|
|
1652
|
+
if (code !== 0x09 && code !== 0x20) {
|
|
1653
|
+
break;
|
|
1654
|
+
}
|
|
1655
|
+
start += 1;
|
|
1656
|
+
}
|
|
1657
|
+
while (end > start) {
|
|
1658
|
+
var _code = str.charCodeAt(end - 1);
|
|
1659
|
+
if (_code !== 0x09 && _code !== 0x20) {
|
|
1660
|
+
break;
|
|
1661
|
+
}
|
|
1662
|
+
end -= 1;
|
|
1663
|
+
}
|
|
1664
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
1695
1665
|
}
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
* It takes a path, a key, and a boolean, and returns a string
|
|
1699
|
-
*
|
|
1700
|
-
* @param {string} path - The path to the current key.
|
|
1701
|
-
* @param {string} key - The key of the current object being iterated over.
|
|
1702
|
-
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
1703
|
-
*
|
|
1704
|
-
* @returns {string} The path to the current key.
|
|
1705
|
-
*/
|
|
1706
|
-
function renderKey(path, key, dots) {
|
|
1707
|
-
if (!path) return key;
|
|
1708
|
-
return path.concat(key).map(function each(token, i) {
|
|
1709
|
-
// eslint-disable-next-line no-param-reassign
|
|
1710
|
-
token = removeBrackets(token);
|
|
1711
|
-
return !dots && i ? '[' + token + ']' : token;
|
|
1712
|
-
}).join(dots ? '.' : '');
|
|
1666
|
+
function normalizeHeader(header) {
|
|
1667
|
+
return header && String(header).trim().toLowerCase();
|
|
1713
1668
|
}
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
1717
|
-
*
|
|
1718
|
-
* @param {Array<any>} arr - The array to check
|
|
1719
|
-
*
|
|
1720
|
-
* @returns {boolean}
|
|
1721
|
-
*/
|
|
1722
|
-
function isFlatArray(arr) {
|
|
1723
|
-
return utils$1$1.isArray(arr) && !arr.some(isVisitable);
|
|
1669
|
+
function sanitizeHeaderValue(str) {
|
|
1670
|
+
return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
|
|
1724
1671
|
}
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
/**
|
|
1730
|
-
* Convert a data object to FormData
|
|
1731
|
-
*
|
|
1732
|
-
* @param {Object} obj
|
|
1733
|
-
* @param {?Object} [formData]
|
|
1734
|
-
* @param {?Object} [options]
|
|
1735
|
-
* @param {Function} [options.visitor]
|
|
1736
|
-
* @param {Boolean} [options.metaTokens = true]
|
|
1737
|
-
* @param {Boolean} [options.dots = false]
|
|
1738
|
-
* @param {?Boolean} [options.indexes = false]
|
|
1739
|
-
*
|
|
1740
|
-
* @returns {Object}
|
|
1741
|
-
**/
|
|
1742
|
-
|
|
1743
|
-
/**
|
|
1744
|
-
* It converts an object into a FormData object
|
|
1745
|
-
*
|
|
1746
|
-
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
1747
|
-
* @param {string} formData - The FormData object to append to.
|
|
1748
|
-
* @param {Object<string, any>} options
|
|
1749
|
-
*
|
|
1750
|
-
* @returns
|
|
1751
|
-
*/
|
|
1752
|
-
function toFormData(obj, formData, options) {
|
|
1753
|
-
if (!utils$1$1.isObject(obj)) {
|
|
1754
|
-
throw new TypeError('target must be an object');
|
|
1672
|
+
function normalizeValue(value) {
|
|
1673
|
+
if (value === false || value == null) {
|
|
1674
|
+
return value;
|
|
1755
1675
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1676
|
+
return utils$1$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
|
|
1677
|
+
}
|
|
1678
|
+
function parseTokens(str) {
|
|
1679
|
+
var tokens = Object.create(null);
|
|
1680
|
+
var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1681
|
+
var match;
|
|
1682
|
+
while (match = tokensRE.exec(str)) {
|
|
1683
|
+
tokens[match[1]] = match[2];
|
|
1684
|
+
}
|
|
1685
|
+
return tokens;
|
|
1686
|
+
}
|
|
1687
|
+
var isValidHeaderName = function isValidHeaderName(str) {
|
|
1688
|
+
return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1689
|
+
};
|
|
1690
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
1691
|
+
if (utils$1$1.isFunction(filter)) {
|
|
1692
|
+
return filter.call(this, value, header);
|
|
1693
|
+
}
|
|
1694
|
+
if (isHeaderNameFilter) {
|
|
1695
|
+
value = header;
|
|
1696
|
+
}
|
|
1697
|
+
if (!utils$1$1.isString(value)) return;
|
|
1698
|
+
if (utils$1$1.isString(filter)) {
|
|
1699
|
+
return value.indexOf(filter) !== -1;
|
|
1700
|
+
}
|
|
1701
|
+
if (utils$1$1.isRegExp(filter)) {
|
|
1702
|
+
return filter.test(value);
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
function formatHeader(header) {
|
|
1706
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, char, str) {
|
|
1707
|
+
return char.toUpperCase() + str;
|
|
1768
1708
|
});
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
var
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1709
|
+
}
|
|
1710
|
+
function buildAccessors(obj, header) {
|
|
1711
|
+
var accessorName = utils$1$1.toCamelCase(' ' + header);
|
|
1712
|
+
['get', 'set', 'has'].forEach(function (methodName) {
|
|
1713
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
1714
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
1715
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
1716
|
+
__proto__: null,
|
|
1717
|
+
value: function value(arg1, arg2, arg3) {
|
|
1718
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1719
|
+
},
|
|
1720
|
+
configurable: true
|
|
1721
|
+
});
|
|
1722
|
+
});
|
|
1723
|
+
}
|
|
1724
|
+
var AxiosHeaders = /*#__PURE__*/function () {
|
|
1725
|
+
function AxiosHeaders(headers) {
|
|
1726
|
+
_classCallCheck(this, AxiosHeaders);
|
|
1727
|
+
headers && this.set(headers);
|
|
1778
1728
|
}
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1729
|
+
return _createClass(AxiosHeaders, [{
|
|
1730
|
+
key: "set",
|
|
1731
|
+
value: function set(header, valueOrRewrite, rewrite) {
|
|
1732
|
+
var self = this;
|
|
1733
|
+
function setHeader(_value, _header, _rewrite) {
|
|
1734
|
+
var lHeader = normalizeHeader(_header);
|
|
1735
|
+
if (!lHeader) {
|
|
1736
|
+
throw new Error('header name must be a non-empty string');
|
|
1737
|
+
}
|
|
1738
|
+
var key = utils$1$1.findKey(self, lHeader);
|
|
1739
|
+
if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
|
|
1740
|
+
self[key || _header] = normalizeValue(_value);
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
var setHeaders = function setHeaders(headers, _rewrite) {
|
|
1744
|
+
return utils$1$1.forEach(headers, function (_value, _header) {
|
|
1745
|
+
return setHeader(_value, _header, _rewrite);
|
|
1746
|
+
});
|
|
1747
|
+
};
|
|
1748
|
+
if (utils$1$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1749
|
+
setHeaders(header, valueOrRewrite);
|
|
1750
|
+
} else if (utils$1$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
1751
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
1752
|
+
} else if (utils$1$1.isObject(header) && utils$1$1.isIterable(header)) {
|
|
1753
|
+
var obj = {},
|
|
1754
|
+
dest,
|
|
1755
|
+
key;
|
|
1756
|
+
var _iterator3 = _createForOfIteratorHelper$3(header),
|
|
1757
|
+
_step2;
|
|
1758
|
+
try {
|
|
1759
|
+
for (_iterator3.s(); !(_step2 = _iterator3.n()).done;) {
|
|
1760
|
+
var entry = _step2.value;
|
|
1761
|
+
if (!utils$1$1.isArray(entry)) {
|
|
1762
|
+
throw TypeError('Object iterator must return a key-value pair');
|
|
1763
|
+
}
|
|
1764
|
+
obj[key = entry[0]] = (dest = obj[key]) ? utils$1$1.isArray(dest) ? [].concat(_toConsumableArray$1(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
|
|
1765
|
+
}
|
|
1766
|
+
} catch (err) {
|
|
1767
|
+
_iterator3.e(err);
|
|
1768
|
+
} finally {
|
|
1769
|
+
_iterator3.f();
|
|
1770
|
+
}
|
|
1771
|
+
setHeaders(obj, valueOrRewrite);
|
|
1772
|
+
} else {
|
|
1773
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1774
|
+
}
|
|
1775
|
+
return this;
|
|
1783
1776
|
}
|
|
1784
|
-
|
|
1785
|
-
|
|
1777
|
+
}, {
|
|
1778
|
+
key: "get",
|
|
1779
|
+
value: function get(header, parser) {
|
|
1780
|
+
header = normalizeHeader(header);
|
|
1781
|
+
if (header) {
|
|
1782
|
+
var key = utils$1$1.findKey(this, header);
|
|
1783
|
+
if (key) {
|
|
1784
|
+
var value = this[key];
|
|
1785
|
+
if (!parser) {
|
|
1786
|
+
return value;
|
|
1787
|
+
}
|
|
1788
|
+
if (parser === true) {
|
|
1789
|
+
return parseTokens(value);
|
|
1790
|
+
}
|
|
1791
|
+
if (utils$1$1.isFunction(parser)) {
|
|
1792
|
+
return parser.call(this, value, key);
|
|
1793
|
+
}
|
|
1794
|
+
if (utils$1$1.isRegExp(parser)) {
|
|
1795
|
+
return parser.exec(value);
|
|
1796
|
+
}
|
|
1797
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}, {
|
|
1802
|
+
key: "has",
|
|
1803
|
+
value: function has(header, matcher) {
|
|
1804
|
+
header = normalizeHeader(header);
|
|
1805
|
+
if (header) {
|
|
1806
|
+
var key = utils$1$1.findKey(this, header);
|
|
1807
|
+
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
1808
|
+
}
|
|
1809
|
+
return false;
|
|
1810
|
+
}
|
|
1811
|
+
}, {
|
|
1812
|
+
key: "delete",
|
|
1813
|
+
value: function _delete(header, matcher) {
|
|
1814
|
+
var self = this;
|
|
1815
|
+
var deleted = false;
|
|
1816
|
+
function deleteHeader(_header) {
|
|
1817
|
+
_header = normalizeHeader(_header);
|
|
1818
|
+
if (_header) {
|
|
1819
|
+
var key = utils$1$1.findKey(self, _header);
|
|
1820
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
1821
|
+
delete self[key];
|
|
1822
|
+
deleted = true;
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
if (utils$1$1.isArray(header)) {
|
|
1827
|
+
header.forEach(deleteHeader);
|
|
1828
|
+
} else {
|
|
1829
|
+
deleteHeader(header);
|
|
1830
|
+
}
|
|
1831
|
+
return deleted;
|
|
1832
|
+
}
|
|
1833
|
+
}, {
|
|
1834
|
+
key: "clear",
|
|
1835
|
+
value: function clear(matcher) {
|
|
1836
|
+
var keys = Object.keys(this);
|
|
1837
|
+
var i = keys.length;
|
|
1838
|
+
var deleted = false;
|
|
1839
|
+
while (i--) {
|
|
1840
|
+
var key = keys[i];
|
|
1841
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
1842
|
+
delete this[key];
|
|
1843
|
+
deleted = true;
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
return deleted;
|
|
1847
|
+
}
|
|
1848
|
+
}, {
|
|
1849
|
+
key: "normalize",
|
|
1850
|
+
value: function normalize(format) {
|
|
1851
|
+
var self = this;
|
|
1852
|
+
var headers = {};
|
|
1853
|
+
utils$1$1.forEach(this, function (value, header) {
|
|
1854
|
+
var key = utils$1$1.findKey(headers, header);
|
|
1855
|
+
if (key) {
|
|
1856
|
+
self[key] = normalizeValue(value);
|
|
1857
|
+
delete self[header];
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
var normalized = format ? formatHeader(header) : String(header).trim();
|
|
1861
|
+
if (normalized !== header) {
|
|
1862
|
+
delete self[header];
|
|
1863
|
+
}
|
|
1864
|
+
self[normalized] = normalizeValue(value);
|
|
1865
|
+
headers[normalized] = true;
|
|
1866
|
+
});
|
|
1867
|
+
return this;
|
|
1868
|
+
}
|
|
1869
|
+
}, {
|
|
1870
|
+
key: "concat",
|
|
1871
|
+
value: function concat() {
|
|
1872
|
+
var _this$constructor;
|
|
1873
|
+
for (var _len2 = arguments.length, targets = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
|
|
1874
|
+
targets[_key3] = arguments[_key3];
|
|
1875
|
+
}
|
|
1876
|
+
return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
|
|
1877
|
+
}
|
|
1878
|
+
}, {
|
|
1879
|
+
key: "toJSON",
|
|
1880
|
+
value: function toJSON(asStrings) {
|
|
1881
|
+
var obj = Object.create(null);
|
|
1882
|
+
utils$1$1.forEach(this, function (value, header) {
|
|
1883
|
+
value != null && value !== false && (obj[header] = asStrings && utils$1$1.isArray(value) ? value.join(', ') : value);
|
|
1884
|
+
});
|
|
1885
|
+
return obj;
|
|
1886
|
+
}
|
|
1887
|
+
}, {
|
|
1888
|
+
key: Symbol.iterator,
|
|
1889
|
+
value: function value() {
|
|
1890
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1891
|
+
}
|
|
1892
|
+
}, {
|
|
1893
|
+
key: "toString",
|
|
1894
|
+
value: function toString() {
|
|
1895
|
+
return Object.entries(this.toJSON()).map(function (_ref8) {
|
|
1896
|
+
var _ref9 = _slicedToArray$1(_ref8, 2),
|
|
1897
|
+
header = _ref9[0],
|
|
1898
|
+
value = _ref9[1];
|
|
1899
|
+
return header + ': ' + value;
|
|
1900
|
+
}).join('\n');
|
|
1901
|
+
}
|
|
1902
|
+
}, {
|
|
1903
|
+
key: "getSetCookie",
|
|
1904
|
+
value: function getSetCookie() {
|
|
1905
|
+
return this.get('set-cookie') || [];
|
|
1786
1906
|
}
|
|
1787
|
-
|
|
1788
|
-
|
|
1907
|
+
}, {
|
|
1908
|
+
key: Symbol.toStringTag,
|
|
1909
|
+
get: function get() {
|
|
1910
|
+
return 'AxiosHeaders';
|
|
1789
1911
|
}
|
|
1790
|
-
|
|
1791
|
-
|
|
1912
|
+
}], [{
|
|
1913
|
+
key: "from",
|
|
1914
|
+
value: function from(thing) {
|
|
1915
|
+
return thing instanceof this ? thing : new this(thing);
|
|
1792
1916
|
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
1805
|
-
*/
|
|
1806
|
-
function defaultVisitor(value, key, path) {
|
|
1807
|
-
var arr = value;
|
|
1808
|
-
if (utils$1$1.isReactNative(formData) && utils$1$1.isReactNativeBlob(value)) {
|
|
1809
|
-
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
1810
|
-
return false;
|
|
1917
|
+
}, {
|
|
1918
|
+
key: "concat",
|
|
1919
|
+
value: function concat(first) {
|
|
1920
|
+
var computed = new this(first);
|
|
1921
|
+
for (var _len3 = arguments.length, targets = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) {
|
|
1922
|
+
targets[_key4 - 1] = arguments[_key4];
|
|
1923
|
+
}
|
|
1924
|
+
targets.forEach(function (target) {
|
|
1925
|
+
return computed.set(target);
|
|
1926
|
+
});
|
|
1927
|
+
return computed;
|
|
1811
1928
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
}
|
|
1826
|
-
return false;
|
|
1929
|
+
}, {
|
|
1930
|
+
key: "accessor",
|
|
1931
|
+
value: function accessor(header) {
|
|
1932
|
+
var internals = this[$internals] = this[$internals] = {
|
|
1933
|
+
accessors: {}
|
|
1934
|
+
};
|
|
1935
|
+
var accessors = internals.accessors;
|
|
1936
|
+
var prototype = this.prototype;
|
|
1937
|
+
function defineAccessor(_header) {
|
|
1938
|
+
var lHeader = normalizeHeader(_header);
|
|
1939
|
+
if (!accessors[lHeader]) {
|
|
1940
|
+
buildAccessors(prototype, _header);
|
|
1941
|
+
accessors[lHeader] = true;
|
|
1942
|
+
}
|
|
1827
1943
|
}
|
|
1944
|
+
utils$1$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1945
|
+
return this;
|
|
1828
1946
|
}
|
|
1829
|
-
|
|
1830
|
-
|
|
1947
|
+
}]);
|
|
1948
|
+
}();
|
|
1949
|
+
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
1950
|
+
|
|
1951
|
+
// reserved names hotfix
|
|
1952
|
+
utils$1$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref10, key) {
|
|
1953
|
+
var value = _ref10.value;
|
|
1954
|
+
var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
1955
|
+
return {
|
|
1956
|
+
get: function get() {
|
|
1957
|
+
return value;
|
|
1958
|
+
},
|
|
1959
|
+
set: function set(headerValue) {
|
|
1960
|
+
this[mapped] = headerValue;
|
|
1831
1961
|
}
|
|
1832
|
-
|
|
1833
|
-
|
|
1962
|
+
};
|
|
1963
|
+
});
|
|
1964
|
+
utils$1$1.freezeMethods(AxiosHeaders);
|
|
1965
|
+
var REDACTED = '[REDACTED ****]';
|
|
1966
|
+
function hasOwnOrPrototypeToJSON(source) {
|
|
1967
|
+
if (utils$1$1.hasOwnProp(source, 'toJSON')) {
|
|
1968
|
+
return true;
|
|
1834
1969
|
}
|
|
1835
|
-
var
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
isVisitable: isVisitable
|
|
1840
|
-
});
|
|
1841
|
-
function build(value, path) {
|
|
1842
|
-
if (utils$1$1.isUndefined(value)) return;
|
|
1843
|
-
if (stack.indexOf(value) !== -1) {
|
|
1844
|
-
throw Error('Circular reference detected in ' + path.join('.'));
|
|
1970
|
+
var prototype = Object.getPrototypeOf(source);
|
|
1971
|
+
while (prototype && prototype !== Object.prototype) {
|
|
1972
|
+
if (utils$1$1.hasOwnProp(prototype, 'toJSON')) {
|
|
1973
|
+
return true;
|
|
1845
1974
|
}
|
|
1846
|
-
|
|
1847
|
-
utils$1$1.forEach(value, function each(el, key) {
|
|
1848
|
-
var result = !(utils$1$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
1849
|
-
if (result === true) {
|
|
1850
|
-
build(el, path ? path.concat(key) : [key]);
|
|
1851
|
-
}
|
|
1852
|
-
});
|
|
1853
|
-
stack.pop();
|
|
1854
|
-
}
|
|
1855
|
-
if (!utils$1$1.isObject(obj)) {
|
|
1856
|
-
throw new TypeError('data must be an object');
|
|
1975
|
+
prototype = Object.getPrototypeOf(prototype);
|
|
1857
1976
|
}
|
|
1858
|
-
|
|
1859
|
-
return formData;
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
/**
|
|
1863
|
-
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
1864
|
-
* their percent-encoded equivalents
|
|
1865
|
-
*
|
|
1866
|
-
* @param {string} str - The string to encode.
|
|
1867
|
-
*
|
|
1868
|
-
* @returns {string} The encoded string.
|
|
1869
|
-
*/
|
|
1870
|
-
function encode$1(str) {
|
|
1871
|
-
var charMap = {
|
|
1872
|
-
'!': '%21',
|
|
1873
|
-
"'": '%27',
|
|
1874
|
-
'(': '%28',
|
|
1875
|
-
')': '%29',
|
|
1876
|
-
'~': '%7E',
|
|
1877
|
-
'%20': '+',
|
|
1878
|
-
'%00': '\x00'
|
|
1879
|
-
};
|
|
1880
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1881
|
-
return charMap[match];
|
|
1882
|
-
});
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
/**
|
|
1886
|
-
* It takes a params object and converts it to a FormData object
|
|
1887
|
-
*
|
|
1888
|
-
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
1889
|
-
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1890
|
-
*
|
|
1891
|
-
* @returns {void}
|
|
1892
|
-
*/
|
|
1893
|
-
function AxiosURLSearchParams(params, options) {
|
|
1894
|
-
this._pairs = [];
|
|
1895
|
-
params && toFormData(params, this, options);
|
|
1896
|
-
}
|
|
1897
|
-
var prototype = AxiosURLSearchParams.prototype;
|
|
1898
|
-
prototype.append = function append(name, value) {
|
|
1899
|
-
this._pairs.push([name, value]);
|
|
1900
|
-
};
|
|
1901
|
-
prototype.toString = function toString(encoder) {
|
|
1902
|
-
var _encode = encoder ? function (value) {
|
|
1903
|
-
return encoder.call(this, value, encode$1);
|
|
1904
|
-
} : encode$1;
|
|
1905
|
-
return this._pairs.map(function each(pair) {
|
|
1906
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1907
|
-
}, '').join('&');
|
|
1908
|
-
};
|
|
1909
|
-
|
|
1910
|
-
/**
|
|
1911
|
-
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
1912
|
-
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
1913
|
-
*
|
|
1914
|
-
* @param {string} val The value to be encoded.
|
|
1915
|
-
*
|
|
1916
|
-
* @returns {string} The encoded value.
|
|
1917
|
-
*/
|
|
1918
|
-
function encode$2(val) {
|
|
1919
|
-
return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
|
|
1977
|
+
return false;
|
|
1920
1978
|
}
|
|
1921
1979
|
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
return
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1980
|
+
// Build a plain-object snapshot of `config` and replace the value of any key
|
|
1981
|
+
// (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
|
|
1982
|
+
// and AxiosHeaders, and short-circuits on circular references.
|
|
1983
|
+
function redactConfig(config, redactKeys) {
|
|
1984
|
+
var lowerKeys = new Set(redactKeys.map(function (k) {
|
|
1985
|
+
return String(k).toLowerCase();
|
|
1986
|
+
}));
|
|
1987
|
+
var seen = [];
|
|
1988
|
+
var _visit2 = function visit(source) {
|
|
1989
|
+
if (source === null || _typeof$2(source) !== 'object') return source;
|
|
1990
|
+
if (utils$1$1.isBuffer(source)) return source;
|
|
1991
|
+
if (seen.indexOf(source) !== -1) return undefined;
|
|
1992
|
+
if (source instanceof AxiosHeaders) {
|
|
1993
|
+
source = source.toJSON();
|
|
1994
|
+
}
|
|
1995
|
+
seen.push(source);
|
|
1996
|
+
var result;
|
|
1997
|
+
if (utils$1$1.isArray(source)) {
|
|
1998
|
+
result = [];
|
|
1999
|
+
source.forEach(function (v, i) {
|
|
2000
|
+
var reducedValue = _visit2(v);
|
|
2001
|
+
if (!utils$1$1.isUndefined(reducedValue)) {
|
|
2002
|
+
result[i] = reducedValue;
|
|
2003
|
+
}
|
|
2004
|
+
});
|
|
2005
|
+
} else {
|
|
2006
|
+
if (!utils$1$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
|
|
2007
|
+
seen.pop();
|
|
2008
|
+
return source;
|
|
2009
|
+
}
|
|
2010
|
+
result = Object.create(null);
|
|
2011
|
+
for (var _i = 0, _Object$entries = Object.entries(source); _i < _Object$entries.length; _i++) {
|
|
2012
|
+
var _Object$entries$_i = _slicedToArray$1(_Object$entries[_i], 2),
|
|
2013
|
+
key = _Object$entries$_i[0],
|
|
2014
|
+
value = _Object$entries$_i[1];
|
|
2015
|
+
var reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : _visit2(value);
|
|
2016
|
+
if (!utils$1$1.isUndefined(reducedValue)) {
|
|
2017
|
+
result[key] = reducedValue;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
1950
2020
|
}
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
2021
|
+
seen.pop();
|
|
2022
|
+
return result;
|
|
2023
|
+
};
|
|
2024
|
+
return _visit2(config);
|
|
1954
2025
|
}
|
|
1955
|
-
var
|
|
1956
|
-
function InterceptorManager() {
|
|
1957
|
-
_classCallCheck(this, InterceptorManager);
|
|
1958
|
-
this.handlers = [];
|
|
1959
|
-
}
|
|
1960
|
-
|
|
2026
|
+
var AxiosError = /*#__PURE__*/function (_Error) {
|
|
1961
2027
|
/**
|
|
1962
|
-
*
|
|
2028
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
1963
2029
|
*
|
|
1964
|
-
* @param {
|
|
1965
|
-
* @param {
|
|
1966
|
-
* @param {Object}
|
|
2030
|
+
* @param {string} message The error message.
|
|
2031
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
2032
|
+
* @param {Object} [config] The config.
|
|
2033
|
+
* @param {Object} [request] The request.
|
|
2034
|
+
* @param {Object} [response] The response.
|
|
1967
2035
|
*
|
|
1968
|
-
* @
|
|
2036
|
+
* @returns {Error} The created error.
|
|
1969
2037
|
*/
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2038
|
+
function AxiosError(message, code, config, request, response) {
|
|
2039
|
+
var _this;
|
|
2040
|
+
_classCallCheck(this, AxiosError);
|
|
2041
|
+
_this = _callSuper$3(this, AxiosError, [message]);
|
|
2042
|
+
|
|
2043
|
+
// Make message enumerable to maintain backward compatibility
|
|
2044
|
+
// The native Error constructor sets message as non-enumerable,
|
|
2045
|
+
// but axios < v1.13.3 had it as enumerable
|
|
2046
|
+
Object.defineProperty(_this, 'message', {
|
|
2047
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
2048
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
2049
|
+
__proto__: null,
|
|
2050
|
+
value: message,
|
|
2051
|
+
enumerable: true,
|
|
2052
|
+
writable: true,
|
|
2053
|
+
configurable: true
|
|
2054
|
+
});
|
|
2055
|
+
_this.name = 'AxiosError';
|
|
2056
|
+
_this.isAxiosError = true;
|
|
2057
|
+
code && (_this.code = code);
|
|
2058
|
+
config && (_this.config = config);
|
|
2059
|
+
request && (_this.request = request);
|
|
2060
|
+
if (response) {
|
|
2061
|
+
_this.response = response;
|
|
2062
|
+
_this.status = response.status;
|
|
1980
2063
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
2064
|
+
return _this;
|
|
2065
|
+
}
|
|
2066
|
+
_inherits(AxiosError, _Error);
|
|
2067
|
+
return _createClass(AxiosError, [{
|
|
2068
|
+
key: "toJSON",
|
|
2069
|
+
value: function toJSON() {
|
|
2070
|
+
// Opt-in redaction: when the request config carries a `redact` array, the
|
|
2071
|
+
// value of any matching key (case-insensitive, at any depth) is replaced
|
|
2072
|
+
// with REDACTED in the serialized snapshot. Undefined or empty leaves the
|
|
2073
|
+
// existing serialization behavior unchanged.
|
|
2074
|
+
var config = this.config;
|
|
2075
|
+
var redactKeys = config && utils$1$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
|
|
2076
|
+
var serializedConfig = utils$1$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1$1.toJSONObject(config);
|
|
2077
|
+
return {
|
|
2078
|
+
// Standard
|
|
2079
|
+
message: this.message,
|
|
2080
|
+
name: this.name,
|
|
2081
|
+
// Microsoft
|
|
2082
|
+
description: this.description,
|
|
2083
|
+
number: this.number,
|
|
2084
|
+
// Mozilla
|
|
2085
|
+
fileName: this.fileName,
|
|
2086
|
+
lineNumber: this.lineNumber,
|
|
2087
|
+
columnNumber: this.columnNumber,
|
|
2088
|
+
stack: this.stack,
|
|
2089
|
+
// Axios
|
|
2090
|
+
config: serializedConfig,
|
|
2091
|
+
code: this.code,
|
|
2092
|
+
status: this.status
|
|
2093
|
+
};
|
|
1995
2094
|
}
|
|
2095
|
+
}], [{
|
|
2096
|
+
key: "from",
|
|
2097
|
+
value: function from(error, code, config, request, response, customProps) {
|
|
2098
|
+
var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
2099
|
+
axiosError.cause = error;
|
|
2100
|
+
axiosError.name = error.name;
|
|
1996
2101
|
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
* @returns {void}
|
|
2001
|
-
*/
|
|
2002
|
-
}, {
|
|
2003
|
-
key: "clear",
|
|
2004
|
-
value: function clear() {
|
|
2005
|
-
if (this.handlers) {
|
|
2006
|
-
this.handlers = [];
|
|
2102
|
+
// Preserve status from the original error if not already set from response
|
|
2103
|
+
if (error.status != null && axiosError.status == null) {
|
|
2104
|
+
axiosError.status = error.status;
|
|
2007
2105
|
}
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
/**
|
|
2011
|
-
* Iterate over all the registered interceptors
|
|
2012
|
-
*
|
|
2013
|
-
* This method is particularly useful for skipping over any
|
|
2014
|
-
* interceptors that may have become `null` calling `eject`.
|
|
2015
|
-
*
|
|
2016
|
-
* @param {Function} fn The function to call for each interceptor
|
|
2017
|
-
*
|
|
2018
|
-
* @returns {void}
|
|
2019
|
-
*/
|
|
2020
|
-
}, {
|
|
2021
|
-
key: "forEach",
|
|
2022
|
-
value: function forEach(fn) {
|
|
2023
|
-
utils$1$1.forEach(this.handlers, function forEachHandler(h) {
|
|
2024
|
-
if (h !== null) {
|
|
2025
|
-
fn(h);
|
|
2026
|
-
}
|
|
2027
|
-
});
|
|
2106
|
+
customProps && Object.assign(axiosError, customProps);
|
|
2107
|
+
return axiosError;
|
|
2028
2108
|
}
|
|
2029
2109
|
}]);
|
|
2030
|
-
}();
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
};
|
|
2049
|
-
var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2050
|
-
var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof$2(navigator)) === 'object' && navigator || undefined;
|
|
2110
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
2111
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
2112
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
2113
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
2114
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
2115
|
+
AxiosError.ECONNREFUSED = 'ECONNREFUSED';
|
|
2116
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
2117
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
2118
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
2119
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
2120
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
2121
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
2122
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
2123
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
2124
|
+
AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
|
|
2125
|
+
|
|
2126
|
+
// eslint-disable-next-line strict
|
|
2127
|
+
var httpAdapter = null;
|
|
2051
2128
|
|
|
2052
2129
|
/**
|
|
2053
|
-
*
|
|
2054
|
-
*
|
|
2055
|
-
* This allows axios to run in a web worker, and react-native.
|
|
2056
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
2057
|
-
*
|
|
2058
|
-
* web workers:
|
|
2059
|
-
* typeof window -> undefined
|
|
2060
|
-
* typeof document -> undefined
|
|
2130
|
+
* Determines if the given thing is a array or js object.
|
|
2061
2131
|
*
|
|
2062
|
-
*
|
|
2063
|
-
* navigator.product -> 'ReactNative'
|
|
2064
|
-
* nativescript
|
|
2065
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
2132
|
+
* @param {string} thing - The object or array to be visited.
|
|
2066
2133
|
*
|
|
2067
2134
|
* @returns {boolean}
|
|
2068
2135
|
*/
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
/**
|
|
2072
|
-
* Determine if we're running in a standard browser webWorker environment
|
|
2073
|
-
*
|
|
2074
|
-
* Although the `isStandardBrowserEnv` method indicates that
|
|
2075
|
-
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
2076
|
-
* filtered out due to its judgment standard
|
|
2077
|
-
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
2078
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
2079
|
-
*/
|
|
2080
|
-
var hasStandardBrowserWebWorkerEnv = function () {
|
|
2081
|
-
return typeof WorkerGlobalScope !== 'undefined' &&
|
|
2082
|
-
// eslint-disable-next-line no-undef
|
|
2083
|
-
self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
|
|
2084
|
-
}();
|
|
2085
|
-
var origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
2086
|
-
var utils$3 = /*#__PURE__*/Object.freeze({
|
|
2087
|
-
__proto__: null,
|
|
2088
|
-
hasBrowserEnv: hasBrowserEnv,
|
|
2089
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2090
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2091
|
-
navigator: _navigator,
|
|
2092
|
-
origin: origin
|
|
2093
|
-
});
|
|
2094
|
-
var platform = _objectSpread$2(_objectSpread$2({}, utils$3), platform$1);
|
|
2095
|
-
function toURLEncodedForm(data, options) {
|
|
2096
|
-
return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread$2({
|
|
2097
|
-
visitor: function visitor(value, key, path, helpers) {
|
|
2098
|
-
if (platform.isNode && utils$1$1.isBuffer(value)) {
|
|
2099
|
-
this.append(key, value.toString('base64'));
|
|
2100
|
-
return false;
|
|
2101
|
-
}
|
|
2102
|
-
return helpers.defaultVisitor.apply(this, arguments);
|
|
2103
|
-
}
|
|
2104
|
-
}, options));
|
|
2136
|
+
function isVisitable(thing) {
|
|
2137
|
+
return utils$1$1.isPlainObject(thing) || utils$1$1.isArray(thing);
|
|
2105
2138
|
}
|
|
2106
2139
|
|
|
2107
2140
|
/**
|
|
2108
|
-
* It
|
|
2141
|
+
* It removes the brackets from the end of a string
|
|
2109
2142
|
*
|
|
2110
|
-
* @param {string}
|
|
2143
|
+
* @param {string} key - The key of the parameter.
|
|
2111
2144
|
*
|
|
2112
|
-
* @returns
|
|
2145
|
+
* @returns {string} the key without the brackets.
|
|
2113
2146
|
*/
|
|
2114
|
-
function
|
|
2115
|
-
|
|
2116
|
-
// foo.x.y.z
|
|
2117
|
-
// foo-x-y-z
|
|
2118
|
-
// foo x y z
|
|
2119
|
-
return utils$1$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
|
|
2120
|
-
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
2121
|
-
});
|
|
2147
|
+
function removeBrackets(key) {
|
|
2148
|
+
return utils$1$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
2122
2149
|
}
|
|
2123
2150
|
|
|
2124
2151
|
/**
|
|
2125
|
-
*
|
|
2152
|
+
* It takes a path, a key, and a boolean, and returns a string
|
|
2126
2153
|
*
|
|
2127
|
-
* @param {
|
|
2154
|
+
* @param {string} path - The path to the current key.
|
|
2155
|
+
* @param {string} key - The key of the current object being iterated over.
|
|
2156
|
+
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
2128
2157
|
*
|
|
2129
|
-
* @returns
|
|
2158
|
+
* @returns {string} The path to the current key.
|
|
2130
2159
|
*/
|
|
2131
|
-
function
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
key = keys[i];
|
|
2139
|
-
obj[key] = arr[key];
|
|
2140
|
-
}
|
|
2141
|
-
return obj;
|
|
2160
|
+
function renderKey(path, key, dots) {
|
|
2161
|
+
if (!path) return key;
|
|
2162
|
+
return path.concat(key).map(function each(token, i) {
|
|
2163
|
+
// eslint-disable-next-line no-param-reassign
|
|
2164
|
+
token = removeBrackets(token);
|
|
2165
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
2166
|
+
}).join(dots ? '.' : '');
|
|
2142
2167
|
}
|
|
2143
2168
|
|
|
2144
2169
|
/**
|
|
2145
|
-
*
|
|
2170
|
+
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
2146
2171
|
*
|
|
2147
|
-
* @param {
|
|
2172
|
+
* @param {Array<any>} arr - The array to check
|
|
2148
2173
|
*
|
|
2149
|
-
* @returns {
|
|
2150
|
-
*/
|
|
2151
|
-
function
|
|
2152
|
-
|
|
2153
|
-
var name = path[index++];
|
|
2154
|
-
if (name === '__proto__') return true;
|
|
2155
|
-
var isNumericKey = Number.isFinite(+name);
|
|
2156
|
-
var isLast = index >= path.length;
|
|
2157
|
-
name = !name && utils$1$1.isArray(target) ? target.length : name;
|
|
2158
|
-
if (isLast) {
|
|
2159
|
-
if (utils$1$1.hasOwnProp(target, name)) {
|
|
2160
|
-
target[name] = [target[name], value];
|
|
2161
|
-
} else {
|
|
2162
|
-
target[name] = value;
|
|
2163
|
-
}
|
|
2164
|
-
return !isNumericKey;
|
|
2165
|
-
}
|
|
2166
|
-
if (!target[name] || !utils$1$1.isObject(target[name])) {
|
|
2167
|
-
target[name] = [];
|
|
2168
|
-
}
|
|
2169
|
-
var result = buildPath(path, value, target[name], index);
|
|
2170
|
-
if (result && utils$1$1.isArray(target[name])) {
|
|
2171
|
-
target[name] = arrayToObject$1(target[name]);
|
|
2172
|
-
}
|
|
2173
|
-
return !isNumericKey;
|
|
2174
|
-
}
|
|
2175
|
-
if (utils$1$1.isFormData(formData) && utils$1$1.isFunction(formData.entries)) {
|
|
2176
|
-
var obj = {};
|
|
2177
|
-
utils$1$1.forEachEntry(formData, function (name, value) {
|
|
2178
|
-
buildPath(parsePropPath(name), value, obj, 0);
|
|
2179
|
-
});
|
|
2180
|
-
return obj;
|
|
2181
|
-
}
|
|
2182
|
-
return null;
|
|
2174
|
+
* @returns {boolean}
|
|
2175
|
+
*/
|
|
2176
|
+
function isFlatArray(arr) {
|
|
2177
|
+
return utils$1$1.isArray(arr) && !arr.some(isVisitable);
|
|
2183
2178
|
}
|
|
2179
|
+
var predicates = utils$1$1.toFlatObject(utils$1$1, {}, null, function filter(prop) {
|
|
2180
|
+
return /^is[A-Z]/.test(prop);
|
|
2181
|
+
});
|
|
2184
2182
|
|
|
2185
2183
|
/**
|
|
2186
|
-
*
|
|
2187
|
-
* of the input
|
|
2184
|
+
* Convert a data object to FormData
|
|
2188
2185
|
*
|
|
2189
|
-
* @param {
|
|
2190
|
-
* @param {
|
|
2191
|
-
* @param {
|
|
2186
|
+
* @param {Object} obj
|
|
2187
|
+
* @param {?Object} [formData]
|
|
2188
|
+
* @param {?Object} [options]
|
|
2189
|
+
* @param {Function} [options.visitor]
|
|
2190
|
+
* @param {Boolean} [options.metaTokens = true]
|
|
2191
|
+
* @param {Boolean} [options.dots = false]
|
|
2192
|
+
* @param {?Boolean} [options.indexes = false]
|
|
2192
2193
|
*
|
|
2193
|
-
* @returns {
|
|
2194
|
+
* @returns {Object}
|
|
2195
|
+
**/
|
|
2196
|
+
|
|
2197
|
+
/**
|
|
2198
|
+
* It converts an object into a FormData object
|
|
2199
|
+
*
|
|
2200
|
+
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
2201
|
+
* @param {string} formData - The FormData object to append to.
|
|
2202
|
+
* @param {Object<string, any>} options
|
|
2203
|
+
*
|
|
2204
|
+
* @returns
|
|
2194
2205
|
*/
|
|
2195
|
-
function
|
|
2196
|
-
if (utils$1$1.
|
|
2197
|
-
|
|
2198
|
-
(parser || JSON.parse)(rawValue);
|
|
2199
|
-
return utils$1$1.trim(rawValue);
|
|
2200
|
-
} catch (e) {
|
|
2201
|
-
if (e.name !== 'SyntaxError') {
|
|
2202
|
-
throw e;
|
|
2203
|
-
}
|
|
2204
|
-
}
|
|
2206
|
+
function toFormData(obj, formData, options) {
|
|
2207
|
+
if (!utils$1$1.isObject(obj)) {
|
|
2208
|
+
throw new TypeError('target must be an object');
|
|
2205
2209
|
}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2210
|
+
|
|
2211
|
+
// eslint-disable-next-line no-param-reassign
|
|
2212
|
+
formData = formData || new FormData();
|
|
2213
|
+
|
|
2214
|
+
// eslint-disable-next-line no-param-reassign
|
|
2215
|
+
options = utils$1$1.toFlatObject(options, {
|
|
2216
|
+
metaTokens: true,
|
|
2217
|
+
dots: false,
|
|
2218
|
+
indexes: false
|
|
2219
|
+
}, false, function defined(option, source) {
|
|
2220
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
2221
|
+
return !utils$1$1.isUndefined(source[option]);
|
|
2222
|
+
});
|
|
2223
|
+
var metaTokens = options.metaTokens;
|
|
2224
|
+
// eslint-disable-next-line no-use-before-define
|
|
2225
|
+
var visitor = options.visitor || defaultVisitor;
|
|
2226
|
+
var dots = options.dots;
|
|
2227
|
+
var indexes = options.indexes;
|
|
2228
|
+
var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
2229
|
+
var maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
|
|
2230
|
+
var useBlob = _Blob && utils$1$1.isSpecCompliantForm(formData);
|
|
2231
|
+
if (!utils$1$1.isFunction(visitor)) {
|
|
2232
|
+
throw new TypeError('visitor must be a function');
|
|
2233
|
+
}
|
|
2234
|
+
function convertValue(value) {
|
|
2235
|
+
if (value === null) return '';
|
|
2236
|
+
if (utils$1$1.isDate(value)) {
|
|
2237
|
+
return value.toISOString();
|
|
2217
2238
|
}
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2239
|
+
if (utils$1$1.isBoolean(value)) {
|
|
2240
|
+
return value.toString();
|
|
2221
2241
|
}
|
|
2222
|
-
if (
|
|
2223
|
-
|
|
2242
|
+
if (!useBlob && utils$1$1.isBlob(value)) {
|
|
2243
|
+
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
2224
2244
|
}
|
|
2225
|
-
if (utils$1$1.
|
|
2226
|
-
return
|
|
2245
|
+
if (utils$1$1.isArrayBuffer(value) || utils$1$1.isTypedArray(value)) {
|
|
2246
|
+
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
2227
2247
|
}
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2248
|
+
return value;
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* Default visitor.
|
|
2253
|
+
*
|
|
2254
|
+
* @param {*} value
|
|
2255
|
+
* @param {String|Number} key
|
|
2256
|
+
* @param {Array<String|Number>} path
|
|
2257
|
+
* @this {FormData}
|
|
2258
|
+
*
|
|
2259
|
+
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
2260
|
+
*/
|
|
2261
|
+
function defaultVisitor(value, key, path) {
|
|
2262
|
+
var arr = value;
|
|
2263
|
+
if (utils$1$1.isReactNative(formData) && utils$1$1.isReactNativeBlob(value)) {
|
|
2264
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
2265
|
+
return false;
|
|
2231
2266
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2267
|
+
if (value && !path && _typeof$2(value) === 'object') {
|
|
2268
|
+
if (utils$1$1.endsWith(key, '{}')) {
|
|
2269
|
+
// eslint-disable-next-line no-param-reassign
|
|
2270
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
2271
|
+
// eslint-disable-next-line no-param-reassign
|
|
2272
|
+
value = JSON.stringify(value);
|
|
2273
|
+
} else if (utils$1$1.isArray(value) && isFlatArray(value) || (utils$1$1.isFileList(value) || utils$1$1.endsWith(key, '[]')) && (arr = utils$1$1.toArray(value))) {
|
|
2274
|
+
// eslint-disable-next-line no-param-reassign
|
|
2275
|
+
key = removeBrackets(key);
|
|
2276
|
+
arr.forEach(function each(el, index) {
|
|
2277
|
+
!(utils$1$1.isUndefined(el) || el === null) && formData.append(
|
|
2278
|
+
// eslint-disable-next-line no-nested-ternary
|
|
2279
|
+
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
|
|
2280
|
+
});
|
|
2281
|
+
return false;
|
|
2242
2282
|
}
|
|
2243
2283
|
}
|
|
2244
|
-
if (
|
|
2245
|
-
|
|
2246
|
-
return stringifySafely(data);
|
|
2247
|
-
}
|
|
2248
|
-
return data;
|
|
2249
|
-
}],
|
|
2250
|
-
transformResponse: [function transformResponse(data) {
|
|
2251
|
-
var transitional = this.transitional || defaults$2.transitional;
|
|
2252
|
-
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2253
|
-
var JSONRequested = this.responseType === 'json';
|
|
2254
|
-
if (utils$1$1.isResponse(data) || utils$1$1.isReadableStream(data)) {
|
|
2255
|
-
return data;
|
|
2284
|
+
if (isVisitable(value)) {
|
|
2285
|
+
return true;
|
|
2256
2286
|
}
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2287
|
+
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
2288
|
+
return false;
|
|
2289
|
+
}
|
|
2290
|
+
var stack = [];
|
|
2291
|
+
var exposedHelpers = Object.assign(predicates, {
|
|
2292
|
+
defaultVisitor: defaultVisitor,
|
|
2293
|
+
convertValue: convertValue,
|
|
2294
|
+
isVisitable: isVisitable
|
|
2295
|
+
});
|
|
2296
|
+
function build(value, path) {
|
|
2297
|
+
var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
2298
|
+
if (utils$1$1.isUndefined(value)) return;
|
|
2299
|
+
if (depth > maxDepth) {
|
|
2300
|
+
throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
|
|
2270
2301
|
}
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
/**
|
|
2274
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
2275
|
-
* timeout is not created.
|
|
2276
|
-
*/
|
|
2277
|
-
timeout: 0,
|
|
2278
|
-
xsrfCookieName: 'XSRF-TOKEN',
|
|
2279
|
-
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
2280
|
-
maxContentLength: -1,
|
|
2281
|
-
maxBodyLength: -1,
|
|
2282
|
-
env: {
|
|
2283
|
-
FormData: platform.classes.FormData,
|
|
2284
|
-
Blob: platform.classes.Blob
|
|
2285
|
-
},
|
|
2286
|
-
validateStatus: function validateStatus(status) {
|
|
2287
|
-
return status >= 200 && status < 300;
|
|
2288
|
-
},
|
|
2289
|
-
headers: {
|
|
2290
|
-
common: {
|
|
2291
|
-
Accept: 'application/json, text/plain, */*',
|
|
2292
|
-
'Content-Type': undefined
|
|
2302
|
+
if (stack.indexOf(value) !== -1) {
|
|
2303
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
2293
2304
|
}
|
|
2305
|
+
stack.push(value);
|
|
2306
|
+
utils$1$1.forEach(value, function each(el, key) {
|
|
2307
|
+
var result = !(utils$1$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1$1.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
2308
|
+
if (result === true) {
|
|
2309
|
+
build(el, path ? path.concat(key) : [key], depth + 1);
|
|
2310
|
+
}
|
|
2311
|
+
});
|
|
2312
|
+
stack.pop();
|
|
2294
2313
|
}
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2314
|
+
if (!utils$1$1.isObject(obj)) {
|
|
2315
|
+
throw new TypeError('data must be an object');
|
|
2316
|
+
}
|
|
2317
|
+
build(obj);
|
|
2318
|
+
return formData;
|
|
2319
|
+
}
|
|
2299
2320
|
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2321
|
+
/**
|
|
2322
|
+
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
2323
|
+
* their percent-encoded equivalents
|
|
2324
|
+
*
|
|
2325
|
+
* @param {string} str - The string to encode.
|
|
2326
|
+
*
|
|
2327
|
+
* @returns {string} The encoded string.
|
|
2328
|
+
*/
|
|
2329
|
+
function encode$1(str) {
|
|
2330
|
+
var charMap = {
|
|
2331
|
+
'!': '%21',
|
|
2332
|
+
"'": '%27',
|
|
2333
|
+
'(': '%28',
|
|
2334
|
+
')': '%29',
|
|
2335
|
+
'~': '%7E',
|
|
2336
|
+
'%20': '+'
|
|
2337
|
+
};
|
|
2338
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
|
|
2339
|
+
return charMap[match];
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
/**
|
|
2344
|
+
* It takes a params object and converts it to a FormData object
|
|
2345
|
+
*
|
|
2346
|
+
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
2347
|
+
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
2348
|
+
*
|
|
2349
|
+
* @returns {void}
|
|
2350
|
+
*/
|
|
2351
|
+
function AxiosURLSearchParams(params, options) {
|
|
2352
|
+
this._pairs = [];
|
|
2353
|
+
params && toFormData(params, this, options);
|
|
2354
|
+
}
|
|
2355
|
+
var prototype = AxiosURLSearchParams.prototype;
|
|
2356
|
+
prototype.append = function append(name, value) {
|
|
2357
|
+
this._pairs.push([name, value]);
|
|
2358
|
+
};
|
|
2359
|
+
prototype.toString = function toString(encoder) {
|
|
2360
|
+
var _encode = encoder ? function (value) {
|
|
2361
|
+
return encoder.call(this, value, encode$1);
|
|
2362
|
+
} : encode$1;
|
|
2363
|
+
return this._pairs.map(function each(pair) {
|
|
2364
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
2365
|
+
}, '').join('&');
|
|
2366
|
+
};
|
|
2303
2367
|
|
|
2304
2368
|
/**
|
|
2305
|
-
*
|
|
2369
|
+
* It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
|
|
2370
|
+
* their plain counterparts (`:`, `$`, `,`, `+`).
|
|
2306
2371
|
*
|
|
2307
|
-
*
|
|
2308
|
-
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
2309
|
-
* Content-Type: application/json
|
|
2310
|
-
* Connection: keep-alive
|
|
2311
|
-
* Transfer-Encoding: chunked
|
|
2312
|
-
* ```
|
|
2372
|
+
* @param {string} val The value to be encoded.
|
|
2313
2373
|
*
|
|
2314
|
-
* @
|
|
2374
|
+
* @returns {string} The encoded value.
|
|
2375
|
+
*/
|
|
2376
|
+
function encode$2(val) {
|
|
2377
|
+
return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
/**
|
|
2381
|
+
* Build a URL by appending params to the end
|
|
2315
2382
|
*
|
|
2316
|
-
* @
|
|
2383
|
+
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
2384
|
+
* @param {object} [params] The params to be appended
|
|
2385
|
+
* @param {?(object|Function)} options
|
|
2386
|
+
*
|
|
2387
|
+
* @returns {string} The formatted url
|
|
2317
2388
|
*/
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
var val;
|
|
2322
|
-
var i;
|
|
2323
|
-
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
|
2324
|
-
i = line.indexOf(':');
|
|
2325
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
2326
|
-
val = line.substring(i + 1).trim();
|
|
2327
|
-
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
2328
|
-
return;
|
|
2329
|
-
}
|
|
2330
|
-
if (key === 'set-cookie') {
|
|
2331
|
-
if (parsed[key]) {
|
|
2332
|
-
parsed[key].push(val);
|
|
2333
|
-
} else {
|
|
2334
|
-
parsed[key] = [val];
|
|
2335
|
-
}
|
|
2336
|
-
} else {
|
|
2337
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2338
|
-
}
|
|
2339
|
-
});
|
|
2340
|
-
return parsed;
|
|
2341
|
-
};
|
|
2342
|
-
var $internals = Symbol('internals');
|
|
2343
|
-
var isValidHeaderValue = function isValidHeaderValue(value) {
|
|
2344
|
-
return !/[\r\n]/.test(value);
|
|
2345
|
-
};
|
|
2346
|
-
function assertValidHeaderValue(value, header) {
|
|
2347
|
-
if (value === false || value == null) {
|
|
2348
|
-
return;
|
|
2349
|
-
}
|
|
2350
|
-
if (utils$1$1.isArray(value)) {
|
|
2351
|
-
value.forEach(function (v) {
|
|
2352
|
-
return assertValidHeaderValue(v, header);
|
|
2353
|
-
});
|
|
2354
|
-
return;
|
|
2389
|
+
function buildURL(url, params, options) {
|
|
2390
|
+
if (!params) {
|
|
2391
|
+
return url;
|
|
2355
2392
|
}
|
|
2356
|
-
|
|
2357
|
-
|
|
2393
|
+
var _encode = options && options.encode || encode$2;
|
|
2394
|
+
var _options = utils$1$1.isFunction(options) ? {
|
|
2395
|
+
serialize: options
|
|
2396
|
+
} : options;
|
|
2397
|
+
var serializeFn = _options && _options.serialize;
|
|
2398
|
+
var serializedParams;
|
|
2399
|
+
if (serializeFn) {
|
|
2400
|
+
serializedParams = serializeFn(params, _options);
|
|
2401
|
+
} else {
|
|
2402
|
+
serializedParams = utils$1$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
2358
2403
|
}
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
function stripTrailingCRLF(str) {
|
|
2364
|
-
var end = str.length;
|
|
2365
|
-
while (end > 0) {
|
|
2366
|
-
var charCode = str.charCodeAt(end - 1);
|
|
2367
|
-
if (charCode !== 10 && charCode !== 13) {
|
|
2368
|
-
break;
|
|
2404
|
+
if (serializedParams) {
|
|
2405
|
+
var hashmarkIndex = url.indexOf('#');
|
|
2406
|
+
if (hashmarkIndex !== -1) {
|
|
2407
|
+
url = url.slice(0, hashmarkIndex);
|
|
2369
2408
|
}
|
|
2370
|
-
|
|
2371
|
-
}
|
|
2372
|
-
return end === str.length ? str : str.slice(0, end);
|
|
2373
|
-
}
|
|
2374
|
-
function normalizeValue(value) {
|
|
2375
|
-
if (value === false || value == null) {
|
|
2376
|
-
return value;
|
|
2377
|
-
}
|
|
2378
|
-
return utils$1$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
|
|
2379
|
-
}
|
|
2380
|
-
function parseTokens(str) {
|
|
2381
|
-
var tokens = Object.create(null);
|
|
2382
|
-
var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
2383
|
-
var match;
|
|
2384
|
-
while (match = tokensRE.exec(str)) {
|
|
2385
|
-
tokens[match[1]] = match[2];
|
|
2386
|
-
}
|
|
2387
|
-
return tokens;
|
|
2388
|
-
}
|
|
2389
|
-
var isValidHeaderName = function isValidHeaderName(str) {
|
|
2390
|
-
return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
2391
|
-
};
|
|
2392
|
-
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
2393
|
-
if (utils$1$1.isFunction(filter)) {
|
|
2394
|
-
return filter.call(this, value, header);
|
|
2395
|
-
}
|
|
2396
|
-
if (isHeaderNameFilter) {
|
|
2397
|
-
value = header;
|
|
2398
|
-
}
|
|
2399
|
-
if (!utils$1$1.isString(value)) return;
|
|
2400
|
-
if (utils$1$1.isString(filter)) {
|
|
2401
|
-
return value.indexOf(filter) !== -1;
|
|
2402
|
-
}
|
|
2403
|
-
if (utils$1$1.isRegExp(filter)) {
|
|
2404
|
-
return filter.test(value);
|
|
2409
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
2405
2410
|
}
|
|
2411
|
+
return url;
|
|
2406
2412
|
}
|
|
2407
|
-
function
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
}
|
|
2412
|
-
function buildAccessors(obj, header) {
|
|
2413
|
-
var accessorName = utils$1$1.toCamelCase(' ' + header);
|
|
2414
|
-
['get', 'set', 'has'].forEach(function (methodName) {
|
|
2415
|
-
Object.defineProperty(obj, methodName + accessorName, {
|
|
2416
|
-
value: function value(arg1, arg2, arg3) {
|
|
2417
|
-
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
2418
|
-
},
|
|
2419
|
-
configurable: true
|
|
2420
|
-
});
|
|
2421
|
-
});
|
|
2422
|
-
}
|
|
2423
|
-
var AxiosHeaders = /*#__PURE__*/function () {
|
|
2424
|
-
function AxiosHeaders(headers) {
|
|
2425
|
-
_classCallCheck(this, AxiosHeaders);
|
|
2426
|
-
headers && this.set(headers);
|
|
2413
|
+
var InterceptorManager = /*#__PURE__*/function () {
|
|
2414
|
+
function InterceptorManager() {
|
|
2415
|
+
_classCallCheck(this, InterceptorManager);
|
|
2416
|
+
this.handlers = [];
|
|
2427
2417
|
}
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
throw TypeError('Object iterator must return a key-value pair');
|
|
2463
|
-
}
|
|
2464
|
-
obj[key = entry[0]] = (dest = obj[key]) ? utils$1$1.isArray(dest) ? [].concat(_toConsumableArray$1(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
|
|
2465
|
-
}
|
|
2466
|
-
} catch (err) {
|
|
2467
|
-
_iterator3.e(err);
|
|
2468
|
-
} finally {
|
|
2469
|
-
_iterator3.f();
|
|
2470
|
-
}
|
|
2471
|
-
setHeaders(obj, valueOrRewrite);
|
|
2472
|
-
} else {
|
|
2473
|
-
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
2474
|
-
}
|
|
2475
|
-
return this;
|
|
2476
|
-
}
|
|
2477
|
-
}, {
|
|
2478
|
-
key: "get",
|
|
2479
|
-
value: function get(header, parser) {
|
|
2480
|
-
header = normalizeHeader(header);
|
|
2481
|
-
if (header) {
|
|
2482
|
-
var key = utils$1$1.findKey(this, header);
|
|
2483
|
-
if (key) {
|
|
2484
|
-
var value = this[key];
|
|
2485
|
-
if (!parser) {
|
|
2486
|
-
return value;
|
|
2487
|
-
}
|
|
2488
|
-
if (parser === true) {
|
|
2489
|
-
return parseTokens(value);
|
|
2490
|
-
}
|
|
2491
|
-
if (utils$1$1.isFunction(parser)) {
|
|
2492
|
-
return parser.call(this, value, key);
|
|
2493
|
-
}
|
|
2494
|
-
if (utils$1$1.isRegExp(parser)) {
|
|
2495
|
-
return parser.exec(value);
|
|
2496
|
-
}
|
|
2497
|
-
throw new TypeError('parser must be boolean|regexp|function');
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
}, {
|
|
2502
|
-
key: "has",
|
|
2503
|
-
value: function has(header, matcher) {
|
|
2504
|
-
header = normalizeHeader(header);
|
|
2505
|
-
if (header) {
|
|
2506
|
-
var key = utils$1$1.findKey(this, header);
|
|
2507
|
-
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
2508
|
-
}
|
|
2509
|
-
return false;
|
|
2510
|
-
}
|
|
2511
|
-
}, {
|
|
2512
|
-
key: "delete",
|
|
2513
|
-
value: function _delete(header, matcher) {
|
|
2514
|
-
var self = this;
|
|
2515
|
-
var deleted = false;
|
|
2516
|
-
function deleteHeader(_header) {
|
|
2517
|
-
_header = normalizeHeader(_header);
|
|
2518
|
-
if (_header) {
|
|
2519
|
-
var key = utils$1$1.findKey(self, _header);
|
|
2520
|
-
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
2521
|
-
delete self[key];
|
|
2522
|
-
deleted = true;
|
|
2523
|
-
}
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
if (utils$1$1.isArray(header)) {
|
|
2527
|
-
header.forEach(deleteHeader);
|
|
2528
|
-
} else {
|
|
2529
|
-
deleteHeader(header);
|
|
2418
|
+
|
|
2419
|
+
/**
|
|
2420
|
+
* Add a new interceptor to the stack
|
|
2421
|
+
*
|
|
2422
|
+
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
2423
|
+
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
2424
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
2425
|
+
*
|
|
2426
|
+
* @return {Number} An ID used to remove interceptor later
|
|
2427
|
+
*/
|
|
2428
|
+
return _createClass(InterceptorManager, [{
|
|
2429
|
+
key: "use",
|
|
2430
|
+
value: function use(fulfilled, rejected, options) {
|
|
2431
|
+
this.handlers.push({
|
|
2432
|
+
fulfilled: fulfilled,
|
|
2433
|
+
rejected: rejected,
|
|
2434
|
+
synchronous: options ? options.synchronous : false,
|
|
2435
|
+
runWhen: options ? options.runWhen : null
|
|
2436
|
+
});
|
|
2437
|
+
return this.handlers.length - 1;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
/**
|
|
2441
|
+
* Remove an interceptor from the stack
|
|
2442
|
+
*
|
|
2443
|
+
* @param {Number} id The ID that was returned by `use`
|
|
2444
|
+
*
|
|
2445
|
+
* @returns {void}
|
|
2446
|
+
*/
|
|
2447
|
+
}, {
|
|
2448
|
+
key: "eject",
|
|
2449
|
+
value: function eject(id) {
|
|
2450
|
+
if (this.handlers[id]) {
|
|
2451
|
+
this.handlers[id] = null;
|
|
2530
2452
|
}
|
|
2531
|
-
return deleted;
|
|
2532
2453
|
}
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* Clear all interceptors from the stack
|
|
2457
|
+
*
|
|
2458
|
+
* @returns {void}
|
|
2459
|
+
*/
|
|
2533
2460
|
}, {
|
|
2534
2461
|
key: "clear",
|
|
2535
|
-
value: function clear(
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
var deleted = false;
|
|
2539
|
-
while (i--) {
|
|
2540
|
-
var key = keys[i];
|
|
2541
|
-
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2542
|
-
delete this[key];
|
|
2543
|
-
deleted = true;
|
|
2544
|
-
}
|
|
2462
|
+
value: function clear() {
|
|
2463
|
+
if (this.handlers) {
|
|
2464
|
+
this.handlers = [];
|
|
2545
2465
|
}
|
|
2546
|
-
return deleted;
|
|
2547
2466
|
}
|
|
2467
|
+
|
|
2468
|
+
/**
|
|
2469
|
+
* Iterate over all the registered interceptors
|
|
2470
|
+
*
|
|
2471
|
+
* This method is particularly useful for skipping over any
|
|
2472
|
+
* interceptors that may have become `null` calling `eject`.
|
|
2473
|
+
*
|
|
2474
|
+
* @param {Function} fn The function to call for each interceptor
|
|
2475
|
+
*
|
|
2476
|
+
* @returns {void}
|
|
2477
|
+
*/
|
|
2548
2478
|
}, {
|
|
2549
|
-
key: "
|
|
2550
|
-
value: function
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
var key = utils$1$1.findKey(headers, header);
|
|
2555
|
-
if (key) {
|
|
2556
|
-
self[key] = normalizeValue(value);
|
|
2557
|
-
delete self[header];
|
|
2558
|
-
return;
|
|
2559
|
-
}
|
|
2560
|
-
var normalized = format ? formatHeader(header) : String(header).trim();
|
|
2561
|
-
if (normalized !== header) {
|
|
2562
|
-
delete self[header];
|
|
2479
|
+
key: "forEach",
|
|
2480
|
+
value: function forEach(fn) {
|
|
2481
|
+
utils$1$1.forEach(this.handlers, function forEachHandler(h) {
|
|
2482
|
+
if (h !== null) {
|
|
2483
|
+
fn(h);
|
|
2563
2484
|
}
|
|
2564
|
-
self[normalized] = normalizeValue(value);
|
|
2565
|
-
headers[normalized] = true;
|
|
2566
2485
|
});
|
|
2567
|
-
return this;
|
|
2568
2486
|
}
|
|
2569
|
-
}
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2487
|
+
}]);
|
|
2488
|
+
}();
|
|
2489
|
+
var transitionalDefaults = {
|
|
2490
|
+
silentJSONParsing: true,
|
|
2491
|
+
forcedJSONParsing: true,
|
|
2492
|
+
clarifyTimeoutError: false,
|
|
2493
|
+
legacyInterceptorReqResOrdering: true
|
|
2494
|
+
};
|
|
2495
|
+
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
2496
|
+
var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
2497
|
+
var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
2498
|
+
var platform$1 = {
|
|
2499
|
+
isBrowser: true,
|
|
2500
|
+
classes: {
|
|
2501
|
+
URLSearchParams: URLSearchParams$1,
|
|
2502
|
+
FormData: FormData$1,
|
|
2503
|
+
Blob: Blob$1
|
|
2504
|
+
},
|
|
2505
|
+
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
2506
|
+
};
|
|
2507
|
+
var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2508
|
+
var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof$2(navigator)) === 'object' && navigator || undefined;
|
|
2509
|
+
|
|
2510
|
+
/**
|
|
2511
|
+
* Determine if we're running in a standard browser environment
|
|
2512
|
+
*
|
|
2513
|
+
* This allows axios to run in a web worker, and react-native.
|
|
2514
|
+
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
2515
|
+
*
|
|
2516
|
+
* web workers:
|
|
2517
|
+
* typeof window -> undefined
|
|
2518
|
+
* typeof document -> undefined
|
|
2519
|
+
*
|
|
2520
|
+
* react-native:
|
|
2521
|
+
* navigator.product -> 'ReactNative'
|
|
2522
|
+
* nativescript
|
|
2523
|
+
* navigator.product -> 'NativeScript' or 'NS'
|
|
2524
|
+
*
|
|
2525
|
+
* @returns {boolean}
|
|
2526
|
+
*/
|
|
2527
|
+
var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
2528
|
+
|
|
2529
|
+
/**
|
|
2530
|
+
* Determine if we're running in a standard browser webWorker environment
|
|
2531
|
+
*
|
|
2532
|
+
* Although the `isStandardBrowserEnv` method indicates that
|
|
2533
|
+
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
2534
|
+
* filtered out due to its judgment standard
|
|
2535
|
+
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
2536
|
+
* This leads to a problem when axios post `FormData` in webWorker
|
|
2537
|
+
*/
|
|
2538
|
+
var hasStandardBrowserWebWorkerEnv = function () {
|
|
2539
|
+
return typeof WorkerGlobalScope !== 'undefined' &&
|
|
2540
|
+
// eslint-disable-next-line no-undef
|
|
2541
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
|
|
2542
|
+
}();
|
|
2543
|
+
var origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
2544
|
+
var utils$3 = /*#__PURE__*/Object.freeze({
|
|
2545
|
+
__proto__: null,
|
|
2546
|
+
hasBrowserEnv: hasBrowserEnv,
|
|
2547
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
2548
|
+
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
2549
|
+
navigator: _navigator,
|
|
2550
|
+
origin: origin
|
|
2551
|
+
});
|
|
2552
|
+
var platform = _objectSpread$2(_objectSpread$2({}, utils$3), platform$1);
|
|
2553
|
+
function toURLEncodedForm(data, options) {
|
|
2554
|
+
return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread$2({
|
|
2555
|
+
visitor: function visitor(value, key, path, helpers) {
|
|
2556
|
+
if (platform.isNode && utils$1$1.isBuffer(value)) {
|
|
2557
|
+
this.append(key, value.toString('base64'));
|
|
2558
|
+
return false;
|
|
2575
2559
|
}
|
|
2576
|
-
return
|
|
2560
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
2577
2561
|
}
|
|
2578
|
-
},
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2562
|
+
}, options));
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
/**
|
|
2566
|
+
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
2567
|
+
*
|
|
2568
|
+
* @param {string} name - The name of the property to get.
|
|
2569
|
+
*
|
|
2570
|
+
* @returns An array of strings.
|
|
2571
|
+
*/
|
|
2572
|
+
function parsePropPath(name) {
|
|
2573
|
+
// foo[x][y][z]
|
|
2574
|
+
// foo.x.y.z
|
|
2575
|
+
// foo-x-y-z
|
|
2576
|
+
// foo x y z
|
|
2577
|
+
return utils$1$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
|
|
2578
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
2579
|
+
});
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
/**
|
|
2583
|
+
* Convert an array to an object.
|
|
2584
|
+
*
|
|
2585
|
+
* @param {Array<any>} arr - The array to convert to an object.
|
|
2586
|
+
*
|
|
2587
|
+
* @returns An object with the same keys and values as the array.
|
|
2588
|
+
*/
|
|
2589
|
+
function arrayToObject$1(arr) {
|
|
2590
|
+
var obj = {};
|
|
2591
|
+
var keys = Object.keys(arr);
|
|
2592
|
+
var i;
|
|
2593
|
+
var len = keys.length;
|
|
2594
|
+
var key;
|
|
2595
|
+
for (i = 0; i < len; i++) {
|
|
2596
|
+
key = keys[i];
|
|
2597
|
+
obj[key] = arr[key];
|
|
2598
|
+
}
|
|
2599
|
+
return obj;
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
/**
|
|
2603
|
+
* It takes a FormData object and returns a JavaScript object
|
|
2604
|
+
*
|
|
2605
|
+
* @param {string} formData The FormData object to convert to JSON.
|
|
2606
|
+
*
|
|
2607
|
+
* @returns {Object<string, any> | null} The converted object.
|
|
2608
|
+
*/
|
|
2609
|
+
function formDataToJSON(formData) {
|
|
2610
|
+
function buildPath(path, value, target, index) {
|
|
2611
|
+
var name = path[index++];
|
|
2612
|
+
if (name === '__proto__') return true;
|
|
2613
|
+
var isNumericKey = Number.isFinite(+name);
|
|
2614
|
+
var isLast = index >= path.length;
|
|
2615
|
+
name = !name && utils$1$1.isArray(target) ? target.length : name;
|
|
2616
|
+
if (isLast) {
|
|
2617
|
+
if (utils$1$1.hasOwnProp(target, name)) {
|
|
2618
|
+
target[name] = utils$1$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
|
|
2619
|
+
} else {
|
|
2620
|
+
target[name] = value;
|
|
2621
|
+
}
|
|
2622
|
+
return !isNumericKey;
|
|
2623
|
+
}
|
|
2624
|
+
if (!target[name] || !utils$1$1.isObject(target[name])) {
|
|
2625
|
+
target[name] = [];
|
|
2626
|
+
}
|
|
2627
|
+
var result = buildPath(path, value, target[name], index);
|
|
2628
|
+
if (result && utils$1$1.isArray(target[name])) {
|
|
2629
|
+
target[name] = arrayToObject$1(target[name]);
|
|
2630
|
+
}
|
|
2631
|
+
return !isNumericKey;
|
|
2632
|
+
}
|
|
2633
|
+
if (utils$1$1.isFormData(formData) && utils$1$1.isFunction(formData.entries)) {
|
|
2634
|
+
var obj = {};
|
|
2635
|
+
utils$1$1.forEachEntry(formData, function (name, value) {
|
|
2636
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
2637
|
+
});
|
|
2638
|
+
return obj;
|
|
2639
|
+
}
|
|
2640
|
+
return null;
|
|
2641
|
+
}
|
|
2642
|
+
var own = function own(obj, key) {
|
|
2643
|
+
return obj != null && utils$1$1.hasOwnProp(obj, key) ? obj[key] : undefined;
|
|
2644
|
+
};
|
|
2645
|
+
|
|
2646
|
+
/**
|
|
2647
|
+
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
2648
|
+
* of the input
|
|
2649
|
+
*
|
|
2650
|
+
* @param {any} rawValue - The value to be stringified.
|
|
2651
|
+
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
2652
|
+
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
2653
|
+
*
|
|
2654
|
+
* @returns {string} A stringified version of the rawValue.
|
|
2655
|
+
*/
|
|
2656
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
2657
|
+
if (utils$1$1.isString(rawValue)) {
|
|
2658
|
+
try {
|
|
2659
|
+
(parser || JSON.parse)(rawValue);
|
|
2660
|
+
return utils$1$1.trim(rawValue);
|
|
2661
|
+
} catch (e) {
|
|
2662
|
+
if (e.name !== 'SyntaxError') {
|
|
2663
|
+
throw e;
|
|
2664
|
+
}
|
|
2586
2665
|
}
|
|
2587
|
-
}
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2666
|
+
}
|
|
2667
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
2668
|
+
}
|
|
2669
|
+
var defaults$2 = {
|
|
2670
|
+
transitional: transitionalDefaults,
|
|
2671
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
2672
|
+
transformRequest: [function transformRequest(data, headers) {
|
|
2673
|
+
var contentType = headers.getContentType() || '';
|
|
2674
|
+
var hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
2675
|
+
var isObjectPayload = utils$1$1.isObject(data);
|
|
2676
|
+
if (isObjectPayload && utils$1$1.isHTMLForm(data)) {
|
|
2677
|
+
data = new FormData(data);
|
|
2591
2678
|
}
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
return Object.entries(this.toJSON()).map(function (_ref8) {
|
|
2596
|
-
var _ref9 = _slicedToArray$1(_ref8, 2),
|
|
2597
|
-
header = _ref9[0],
|
|
2598
|
-
value = _ref9[1];
|
|
2599
|
-
return header + ': ' + value;
|
|
2600
|
-
}).join('\n');
|
|
2679
|
+
var isFormData = utils$1$1.isFormData(data);
|
|
2680
|
+
if (isFormData) {
|
|
2681
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2601
2682
|
}
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
value: function getSetCookie() {
|
|
2605
|
-
return this.get('set-cookie') || [];
|
|
2683
|
+
if (utils$1$1.isArrayBuffer(data) || utils$1$1.isBuffer(data) || utils$1$1.isStream(data) || utils$1$1.isFile(data) || utils$1$1.isBlob(data) || utils$1$1.isReadableStream(data)) {
|
|
2684
|
+
return data;
|
|
2606
2685
|
}
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
get: function get() {
|
|
2610
|
-
return 'AxiosHeaders';
|
|
2686
|
+
if (utils$1$1.isArrayBufferView(data)) {
|
|
2687
|
+
return data.buffer;
|
|
2611
2688
|
}
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
return thing instanceof this ? thing : new this(thing);
|
|
2689
|
+
if (utils$1$1.isURLSearchParams(data)) {
|
|
2690
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
2691
|
+
return data.toString();
|
|
2616
2692
|
}
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2693
|
+
var isFileList;
|
|
2694
|
+
if (isObjectPayload) {
|
|
2695
|
+
var formSerializer = own(this, 'formSerializer');
|
|
2696
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
2697
|
+
return toURLEncodedForm(data, formSerializer).toString();
|
|
2698
|
+
}
|
|
2699
|
+
if ((isFileList = utils$1$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
2700
|
+
var env = own(this, 'env');
|
|
2701
|
+
var _FormData = env && env.FormData;
|
|
2702
|
+
return toFormData(isFileList ? {
|
|
2703
|
+
'files[]': data
|
|
2704
|
+
} : data, _FormData && new _FormData(), formSerializer);
|
|
2623
2705
|
}
|
|
2624
|
-
targets.forEach(function (target) {
|
|
2625
|
-
return computed.set(target);
|
|
2626
|
-
});
|
|
2627
|
-
return computed;
|
|
2628
2706
|
}
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2707
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2708
|
+
headers.setContentType('application/json', false);
|
|
2709
|
+
return stringifySafely(data);
|
|
2710
|
+
}
|
|
2711
|
+
return data;
|
|
2712
|
+
}],
|
|
2713
|
+
transformResponse: [function transformResponse(data) {
|
|
2714
|
+
var transitional = own(this, 'transitional') || defaults$2.transitional;
|
|
2715
|
+
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2716
|
+
var responseType = own(this, 'responseType');
|
|
2717
|
+
var JSONRequested = responseType === 'json';
|
|
2718
|
+
if (utils$1$1.isResponse(data) || utils$1$1.isReadableStream(data)) {
|
|
2719
|
+
return data;
|
|
2720
|
+
}
|
|
2721
|
+
if (data && utils$1$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
|
|
2722
|
+
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2723
|
+
var strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2724
|
+
try {
|
|
2725
|
+
return JSON.parse(data, own(this, 'parseReviver'));
|
|
2726
|
+
} catch (e) {
|
|
2727
|
+
if (strictJSONParsing) {
|
|
2728
|
+
if (e.name === 'SyntaxError') {
|
|
2729
|
+
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
|
|
2730
|
+
}
|
|
2731
|
+
throw e;
|
|
2642
2732
|
}
|
|
2643
2733
|
}
|
|
2644
|
-
utils$1$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
2645
|
-
return this;
|
|
2646
2734
|
}
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2735
|
+
return data;
|
|
2736
|
+
}],
|
|
2737
|
+
/**
|
|
2738
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
2739
|
+
* timeout is not created.
|
|
2740
|
+
*/
|
|
2741
|
+
timeout: 0,
|
|
2742
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
2743
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
2744
|
+
maxContentLength: -1,
|
|
2745
|
+
maxBodyLength: -1,
|
|
2746
|
+
env: {
|
|
2747
|
+
FormData: platform.classes.FormData,
|
|
2748
|
+
Blob: platform.classes.Blob
|
|
2749
|
+
},
|
|
2750
|
+
validateStatus: function validateStatus(status) {
|
|
2751
|
+
return status >= 200 && status < 300;
|
|
2752
|
+
},
|
|
2753
|
+
headers: {
|
|
2754
|
+
common: {
|
|
2755
|
+
Accept: 'application/json, text/plain, */*',
|
|
2756
|
+
'Content-Type': undefined
|
|
2661
2757
|
}
|
|
2662
|
-
}
|
|
2758
|
+
}
|
|
2759
|
+
};
|
|
2760
|
+
utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], function (method) {
|
|
2761
|
+
defaults$2.headers[method] = {};
|
|
2663
2762
|
});
|
|
2664
|
-
utils$1$1.freezeMethods(AxiosHeaders);
|
|
2665
2763
|
|
|
2666
2764
|
/**
|
|
2667
2765
|
* Transform the data for a request or a response
|
|
@@ -2720,11 +2818,11 @@ var contentful = (function (exports) {
|
|
|
2720
2818
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2721
2819
|
resolve(response);
|
|
2722
2820
|
} else {
|
|
2723
|
-
reject(new AxiosError('Request failed with status code ' + response.status,
|
|
2821
|
+
reject(new AxiosError('Request failed with status code ' + response.status, response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE, response.config, response.request, response));
|
|
2724
2822
|
}
|
|
2725
2823
|
}
|
|
2726
2824
|
function parseProtocol(url) {
|
|
2727
|
-
var match = /^([-+\w]{1,25})(
|
|
2825
|
+
var match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
|
|
2728
2826
|
return match && match[1] || '';
|
|
2729
2827
|
}
|
|
2730
2828
|
|
|
@@ -2792,8 +2890,8 @@ var contentful = (function (exports) {
|
|
|
2792
2890
|
var throttled = function throttled() {
|
|
2793
2891
|
var now = Date.now();
|
|
2794
2892
|
var passed = now - timestamp;
|
|
2795
|
-
for (var
|
|
2796
|
-
args[
|
|
2893
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {
|
|
2894
|
+
args[_key5] = arguments[_key5];
|
|
2797
2895
|
}
|
|
2798
2896
|
if (passed >= threshold) {
|
|
2799
2897
|
invoke(args, now);
|
|
@@ -2817,19 +2915,19 @@ var contentful = (function (exports) {
|
|
|
2817
2915
|
var bytesNotified = 0;
|
|
2818
2916
|
var _speedometer = speedometer(50, 250);
|
|
2819
2917
|
return throttle(function (e) {
|
|
2820
|
-
var
|
|
2918
|
+
var rawLoaded = e.loaded;
|
|
2821
2919
|
var total = e.lengthComputable ? e.total : undefined;
|
|
2822
|
-
var
|
|
2920
|
+
var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
|
|
2921
|
+
var progressBytes = Math.max(0, loaded - bytesNotified);
|
|
2823
2922
|
var rate = _speedometer(progressBytes);
|
|
2824
|
-
|
|
2825
|
-
bytesNotified = loaded;
|
|
2923
|
+
bytesNotified = Math.max(bytesNotified, loaded);
|
|
2826
2924
|
var data = _defineProperty({
|
|
2827
2925
|
loaded: loaded,
|
|
2828
2926
|
total: total,
|
|
2829
2927
|
progress: total ? loaded / total : undefined,
|
|
2830
2928
|
bytes: progressBytes,
|
|
2831
2929
|
rate: rate ? rate : undefined,
|
|
2832
|
-
estimated: rate && total
|
|
2930
|
+
estimated: rate && total ? (total - loaded) / rate : undefined,
|
|
2833
2931
|
event: e,
|
|
2834
2932
|
lengthComputable: total != null
|
|
2835
2933
|
}, isDownloadStream ? 'download' : 'upload', true);
|
|
@@ -2848,8 +2946,8 @@ var contentful = (function (exports) {
|
|
|
2848
2946
|
};
|
|
2849
2947
|
var asyncDecorator = function asyncDecorator(fn) {
|
|
2850
2948
|
return function () {
|
|
2851
|
-
for (var
|
|
2852
|
-
args[
|
|
2949
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key6 = 0; _key6 < _len5; _key6++) {
|
|
2950
|
+
args[_key6] = arguments[_key6];
|
|
2853
2951
|
}
|
|
2854
2952
|
return utils$1$1.asap(function () {
|
|
2855
2953
|
return fn.apply(void 0, args);
|
|
@@ -2889,8 +2987,20 @@ var contentful = (function (exports) {
|
|
|
2889
2987
|
},
|
|
2890
2988
|
read: function read(name) {
|
|
2891
2989
|
if (typeof document === 'undefined') return null;
|
|
2892
|
-
|
|
2893
|
-
|
|
2990
|
+
// Match name=value by splitting on the semicolon separator instead of building a
|
|
2991
|
+
// RegExp from `name` — interpolating an unescaped string into a RegExp would let
|
|
2992
|
+
// metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
|
|
2993
|
+
// match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
|
|
2994
|
+
// "; ", so ignore optional whitespace before each cookie name.
|
|
2995
|
+
var cookies = document.cookie.split(';');
|
|
2996
|
+
for (var i = 0; i < cookies.length; i++) {
|
|
2997
|
+
var cookie = cookies[i].replace(/^\s+/, '');
|
|
2998
|
+
var eq = cookie.indexOf('=');
|
|
2999
|
+
if (eq !== -1 && cookie.slice(0, eq) === name) {
|
|
3000
|
+
return decodeURIComponent(cookie.slice(eq + 1));
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
return null;
|
|
2894
3004
|
},
|
|
2895
3005
|
remove: function remove(name) {
|
|
2896
3006
|
this.write(name, '', Date.now() - 86400000, '/');
|
|
@@ -2946,7 +3056,7 @@ var contentful = (function (exports) {
|
|
|
2946
3056
|
*/
|
|
2947
3057
|
function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
2948
3058
|
var isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|
2949
|
-
if (baseURL && (isRelativeUrl || allowAbsoluteUrls
|
|
3059
|
+
if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|
2950
3060
|
return combineURLs(baseURL, requestedURL);
|
|
2951
3061
|
}
|
|
2952
3062
|
return requestedURL;
|
|
@@ -2967,7 +3077,21 @@ var contentful = (function (exports) {
|
|
|
2967
3077
|
function mergeConfig(config1, config2) {
|
|
2968
3078
|
// eslint-disable-next-line no-param-reassign
|
|
2969
3079
|
config2 = config2 || {};
|
|
2970
|
-
|
|
3080
|
+
|
|
3081
|
+
// Use a null-prototype object so that downstream reads such as `config.auth`
|
|
3082
|
+
// or `config.baseURL` cannot inherit polluted values from Object.prototype.
|
|
3083
|
+
// `hasOwnProperty` is restored as a non-enumerable own slot to preserve
|
|
3084
|
+
// ergonomics for user code that relies on it.
|
|
3085
|
+
var config = Object.create(null);
|
|
3086
|
+
Object.defineProperty(config, 'hasOwnProperty', {
|
|
3087
|
+
// Null-proto descriptor so a polluted Object.prototype.get cannot turn
|
|
3088
|
+
// this data descriptor into an accessor descriptor on the way in.
|
|
3089
|
+
__proto__: null,
|
|
3090
|
+
value: Object.prototype.hasOwnProperty,
|
|
3091
|
+
enumerable: false,
|
|
3092
|
+
writable: true,
|
|
3093
|
+
configurable: true
|
|
3094
|
+
});
|
|
2971
3095
|
function getMergedValue(target, source, prop, caseless) {
|
|
2972
3096
|
if (utils$1$1.isPlainObject(target) && utils$1$1.isPlainObject(source)) {
|
|
2973
3097
|
return utils$1$1.merge.call({
|
|
@@ -3006,9 +3130,9 @@ var contentful = (function (exports) {
|
|
|
3006
3130
|
|
|
3007
3131
|
// eslint-disable-next-line consistent-return
|
|
3008
3132
|
function mergeDirectKeys(a, b, prop) {
|
|
3009
|
-
if (prop
|
|
3133
|
+
if (utils$1$1.hasOwnProp(config2, prop)) {
|
|
3010
3134
|
return getMergedValue(a, b);
|
|
3011
|
-
} else if (prop
|
|
3135
|
+
} else if (utils$1$1.hasOwnProp(config1, prop)) {
|
|
3012
3136
|
return getMergedValue(undefined, a);
|
|
3013
3137
|
}
|
|
3014
3138
|
}
|
|
@@ -3039,6 +3163,7 @@ var contentful = (function (exports) {
|
|
|
3039
3163
|
httpsAgent: defaultToConfig2,
|
|
3040
3164
|
cancelToken: defaultToConfig2,
|
|
3041
3165
|
socketPath: defaultToConfig2,
|
|
3166
|
+
allowedSocketPaths: defaultToConfig2,
|
|
3042
3167
|
responseEncoding: defaultToConfig2,
|
|
3043
3168
|
validateStatus: mergeDirectKeys,
|
|
3044
3169
|
headers: function headers(a, b, prop) {
|
|
@@ -3048,42 +3173,72 @@ var contentful = (function (exports) {
|
|
|
3048
3173
|
utils$1$1.forEach(Object.keys(_objectSpread$2(_objectSpread$2({}, config1), config2)), function computeConfigValue(prop) {
|
|
3049
3174
|
if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
|
|
3050
3175
|
var merge = utils$1$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
|
|
3051
|
-
var
|
|
3176
|
+
var a = utils$1$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
|
|
3177
|
+
var b = utils$1$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
|
|
3178
|
+
var configValue = merge(a, b, prop);
|
|
3052
3179
|
utils$1$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
|
3053
3180
|
});
|
|
3054
3181
|
return config;
|
|
3055
3182
|
}
|
|
3183
|
+
var FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
|
|
3184
|
+
function setFormDataHeaders(headers, formHeaders, policy) {
|
|
3185
|
+
if (policy !== 'content-only') {
|
|
3186
|
+
headers.set(formHeaders);
|
|
3187
|
+
return;
|
|
3188
|
+
}
|
|
3189
|
+
Object.entries(formHeaders).forEach(function (_ref11) {
|
|
3190
|
+
var _ref12 = _slicedToArray$1(_ref11, 2),
|
|
3191
|
+
key = _ref12[0],
|
|
3192
|
+
val = _ref12[1];
|
|
3193
|
+
if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
|
|
3194
|
+
headers.set(key, val);
|
|
3195
|
+
}
|
|
3196
|
+
});
|
|
3197
|
+
}
|
|
3198
|
+
|
|
3199
|
+
/**
|
|
3200
|
+
* Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
|
|
3201
|
+
* This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
|
|
3202
|
+
*
|
|
3203
|
+
* @param {string} str The string to encode
|
|
3204
|
+
*
|
|
3205
|
+
* @returns {string} UTF-8 bytes as a Latin-1 string
|
|
3206
|
+
*/
|
|
3207
|
+
var encodeUTF8 = function encodeUTF8(str) {
|
|
3208
|
+
return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
|
|
3209
|
+
return String.fromCharCode(parseInt(hex, 16));
|
|
3210
|
+
});
|
|
3211
|
+
};
|
|
3056
3212
|
var resolveConfig = function resolveConfig(config) {
|
|
3057
3213
|
var newConfig = mergeConfig({}, config);
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3214
|
+
|
|
3215
|
+
// Read only own properties to prevent prototype pollution gadgets
|
|
3216
|
+
// (e.g. Object.prototype.baseURL = 'https://evil.com').
|
|
3217
|
+
var own = function own(key) {
|
|
3218
|
+
return utils$1$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined;
|
|
3219
|
+
};
|
|
3220
|
+
var data = own('data');
|
|
3221
|
+
var withXSRFToken = own('withXSRFToken');
|
|
3222
|
+
var xsrfHeaderName = own('xsrfHeaderName');
|
|
3223
|
+
var xsrfCookieName = own('xsrfCookieName');
|
|
3224
|
+
var headers = own('headers');
|
|
3225
|
+
var auth = own('auth');
|
|
3226
|
+
var baseURL = own('baseURL');
|
|
3227
|
+
var allowAbsoluteUrls = own('allowAbsoluteUrls');
|
|
3228
|
+
var url = own('url');
|
|
3064
3229
|
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
3065
|
-
newConfig.url = buildURL(buildFullPath(
|
|
3230
|
+
newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls), config.params, config.paramsSerializer);
|
|
3066
3231
|
|
|
3067
3232
|
// HTTP basic authentication
|
|
3068
3233
|
if (auth) {
|
|
3069
|
-
headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ?
|
|
3234
|
+
headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : '')));
|
|
3070
3235
|
}
|
|
3071
3236
|
if (utils$1$1.isFormData(data)) {
|
|
3072
3237
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
3073
3238
|
headers.setContentType(undefined); // browser handles it
|
|
3074
3239
|
} else if (utils$1$1.isFunction(data.getHeaders)) {
|
|
3075
3240
|
// Node.js FormData (like form-data package)
|
|
3076
|
-
|
|
3077
|
-
// Only set safe headers to avoid overwriting security headers
|
|
3078
|
-
var allowedHeaders = ['content-type', 'content-length'];
|
|
3079
|
-
Object.entries(formHeaders).forEach(function (_ref11) {
|
|
3080
|
-
var _ref12 = _slicedToArray$1(_ref11, 2),
|
|
3081
|
-
key = _ref12[0],
|
|
3082
|
-
val = _ref12[1];
|
|
3083
|
-
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
3084
|
-
headers.set(key, val);
|
|
3085
|
-
}
|
|
3086
|
-
});
|
|
3241
|
+
setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
|
|
3087
3242
|
}
|
|
3088
3243
|
}
|
|
3089
3244
|
|
|
@@ -3092,9 +3247,15 @@ var contentful = (function (exports) {
|
|
|
3092
3247
|
// Specifically not if we're in a web worker, or react-native.
|
|
3093
3248
|
|
|
3094
3249
|
if (platform.hasStandardBrowserEnv) {
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3250
|
+
if (utils$1$1.isFunction(withXSRFToken)) {
|
|
3251
|
+
withXSRFToken = withXSRFToken(newConfig);
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
// Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
|
|
3255
|
+
// and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
|
|
3256
|
+
// the XSRF token cross-origin.
|
|
3257
|
+
var shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
|
|
3258
|
+
if (shouldSendXSRF) {
|
|
3098
3259
|
var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
3099
3260
|
if (xsrfValue) {
|
|
3100
3261
|
headers.set(xsrfHeaderName, xsrfValue);
|
|
@@ -3167,7 +3328,7 @@ var contentful = (function (exports) {
|
|
|
3167
3328
|
// handled by onerror instead
|
|
3168
3329
|
// With one exception: request that using file: protocol, most browsers
|
|
3169
3330
|
// will return status as 0 even though it's a successful request
|
|
3170
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.
|
|
3331
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith('file:'))) {
|
|
3171
3332
|
return;
|
|
3172
3333
|
}
|
|
3173
3334
|
// readystate handler is calling before onerror or ontimeout handlers,
|
|
@@ -3182,6 +3343,7 @@ var contentful = (function (exports) {
|
|
|
3182
3343
|
return;
|
|
3183
3344
|
}
|
|
3184
3345
|
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
3346
|
+
done();
|
|
3185
3347
|
|
|
3186
3348
|
// Clean up request
|
|
3187
3349
|
request = null;
|
|
@@ -3197,6 +3359,7 @@ var contentful = (function (exports) {
|
|
|
3197
3359
|
// attach the underlying event for consumers who want details
|
|
3198
3360
|
err.event = event || null;
|
|
3199
3361
|
reject(err);
|
|
3362
|
+
done();
|
|
3200
3363
|
request = null;
|
|
3201
3364
|
};
|
|
3202
3365
|
|
|
@@ -3208,6 +3371,7 @@ var contentful = (function (exports) {
|
|
|
3208
3371
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
3209
3372
|
}
|
|
3210
3373
|
reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
|
|
3374
|
+
done();
|
|
3211
3375
|
|
|
3212
3376
|
// Clean up request
|
|
3213
3377
|
request = null;
|
|
@@ -3260,6 +3424,7 @@ var contentful = (function (exports) {
|
|
|
3260
3424
|
}
|
|
3261
3425
|
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
3262
3426
|
request.abort();
|
|
3427
|
+
done();
|
|
3263
3428
|
request = null;
|
|
3264
3429
|
};
|
|
3265
3430
|
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
@@ -3268,7 +3433,7 @@ var contentful = (function (exports) {
|
|
|
3268
3433
|
}
|
|
3269
3434
|
}
|
|
3270
3435
|
var protocol = parseProtocol(_config.url);
|
|
3271
|
-
if (protocol && platform.protocols.
|
|
3436
|
+
if (protocol && !platform.protocols.includes(protocol)) {
|
|
3272
3437
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
3273
3438
|
return;
|
|
3274
3439
|
}
|
|
@@ -3521,23 +3686,105 @@ var contentful = (function (exports) {
|
|
|
3521
3686
|
highWaterMark: 2
|
|
3522
3687
|
});
|
|
3523
3688
|
};
|
|
3689
|
+
|
|
3690
|
+
/**
|
|
3691
|
+
* Estimate decoded byte length of a data:// URL *without* allocating large buffers.
|
|
3692
|
+
* - For base64: compute exact decoded size using length and padding;
|
|
3693
|
+
* handle %XX at the character-count level (no string allocation).
|
|
3694
|
+
* - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
|
|
3695
|
+
*
|
|
3696
|
+
* @param {string} url
|
|
3697
|
+
* @returns {number}
|
|
3698
|
+
*/
|
|
3699
|
+
function estimateDataURLDecodedBytes(url) {
|
|
3700
|
+
if (!url || typeof url !== 'string') return 0;
|
|
3701
|
+
if (!url.startsWith('data:')) return 0;
|
|
3702
|
+
var comma = url.indexOf(',');
|
|
3703
|
+
if (comma < 0) return 0;
|
|
3704
|
+
var meta = url.slice(5, comma);
|
|
3705
|
+
var body = url.slice(comma + 1);
|
|
3706
|
+
var isBase64 = /;base64/i.test(meta);
|
|
3707
|
+
if (isBase64) {
|
|
3708
|
+
var effectiveLen = body.length;
|
|
3709
|
+
var len = body.length; // cache length
|
|
3710
|
+
|
|
3711
|
+
for (var i = 0; i < len; i++) {
|
|
3712
|
+
if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
|
|
3713
|
+
var a = body.charCodeAt(i + 1);
|
|
3714
|
+
var b = body.charCodeAt(i + 2);
|
|
3715
|
+
var isHex = (a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102);
|
|
3716
|
+
if (isHex) {
|
|
3717
|
+
effectiveLen -= 2;
|
|
3718
|
+
i += 2;
|
|
3719
|
+
}
|
|
3720
|
+
}
|
|
3721
|
+
}
|
|
3722
|
+
var pad = 0;
|
|
3723
|
+
var idx = len - 1;
|
|
3724
|
+
var tailIsPct3D = function tailIsPct3D(j) {
|
|
3725
|
+
return j >= 2 && body.charCodeAt(j - 2) === 37 &&
|
|
3726
|
+
// '%'
|
|
3727
|
+
body.charCodeAt(j - 1) === 51 && (
|
|
3728
|
+
// '3'
|
|
3729
|
+
body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
|
|
3730
|
+
}; // 'D' or 'd'
|
|
3731
|
+
|
|
3732
|
+
if (idx >= 0) {
|
|
3733
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
3734
|
+
pad++;
|
|
3735
|
+
idx--;
|
|
3736
|
+
} else if (tailIsPct3D(idx)) {
|
|
3737
|
+
pad++;
|
|
3738
|
+
idx -= 3;
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
if (pad === 1 && idx >= 0) {
|
|
3742
|
+
if (body.charCodeAt(idx) === 61 /* '=' */) {
|
|
3743
|
+
pad++;
|
|
3744
|
+
} else if (tailIsPct3D(idx)) {
|
|
3745
|
+
pad++;
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
var groups = Math.floor(effectiveLen / 4);
|
|
3749
|
+
var _bytes = groups * 3 - (pad || 0);
|
|
3750
|
+
return _bytes > 0 ? _bytes : 0;
|
|
3751
|
+
}
|
|
3752
|
+
if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
|
|
3753
|
+
return Buffer.byteLength(body, 'utf8');
|
|
3754
|
+
}
|
|
3755
|
+
|
|
3756
|
+
// Compute UTF-8 byte length directly from UTF-16 code units without allocating
|
|
3757
|
+
// a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
|
|
3758
|
+
// Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
|
|
3759
|
+
// but 3 UTF-8 bytes).
|
|
3760
|
+
var bytes = 0;
|
|
3761
|
+
for (var _i2 = 0, _len6 = body.length; _i2 < _len6; _i2++) {
|
|
3762
|
+
var c = body.charCodeAt(_i2);
|
|
3763
|
+
if (c < 0x80) {
|
|
3764
|
+
bytes += 1;
|
|
3765
|
+
} else if (c < 0x800) {
|
|
3766
|
+
bytes += 2;
|
|
3767
|
+
} else if (c >= 0xd800 && c <= 0xdbff && _i2 + 1 < _len6) {
|
|
3768
|
+
var next = body.charCodeAt(_i2 + 1);
|
|
3769
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
3770
|
+
bytes += 4;
|
|
3771
|
+
_i2++;
|
|
3772
|
+
} else {
|
|
3773
|
+
bytes += 3;
|
|
3774
|
+
}
|
|
3775
|
+
} else {
|
|
3776
|
+
bytes += 3;
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
return bytes;
|
|
3780
|
+
}
|
|
3781
|
+
var VERSION = "1.16.0";
|
|
3524
3782
|
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3525
3783
|
var isFunction = utils$1$1.isFunction;
|
|
3526
|
-
var globalFetchAPI = function (_ref13) {
|
|
3527
|
-
var Request = _ref13.Request,
|
|
3528
|
-
Response = _ref13.Response;
|
|
3529
|
-
return {
|
|
3530
|
-
Request: Request,
|
|
3531
|
-
Response: Response
|
|
3532
|
-
};
|
|
3533
|
-
}(utils$1$1.global);
|
|
3534
|
-
var _utils$1$global = utils$1$1.global,
|
|
3535
|
-
ReadableStream$1 = _utils$1$global.ReadableStream,
|
|
3536
|
-
TextEncoder = _utils$1$global.TextEncoder;
|
|
3537
3784
|
var test = function test(fn) {
|
|
3538
3785
|
try {
|
|
3539
|
-
for (var
|
|
3540
|
-
args[
|
|
3786
|
+
for (var _len7 = arguments.length, args = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
3787
|
+
args[_key7 - 1] = arguments[_key7];
|
|
3541
3788
|
}
|
|
3542
3789
|
return !!fn.apply(void 0, args);
|
|
3543
3790
|
} catch (e) {
|
|
@@ -3545,9 +3792,16 @@ var contentful = (function (exports) {
|
|
|
3545
3792
|
}
|
|
3546
3793
|
};
|
|
3547
3794
|
var factory = function factory(env) {
|
|
3795
|
+
var _utils$1$global;
|
|
3796
|
+
var globalObject = (_utils$1$global = utils$1$1.global) !== null && _utils$1$global !== void 0 ? _utils$1$global : globalThis;
|
|
3797
|
+
var ReadableStream = globalObject.ReadableStream,
|
|
3798
|
+
TextEncoder = globalObject.TextEncoder;
|
|
3548
3799
|
env = utils$1$1.merge.call({
|
|
3549
3800
|
skipUndefined: true
|
|
3550
|
-
},
|
|
3801
|
+
}, {
|
|
3802
|
+
Request: globalObject.Request,
|
|
3803
|
+
Response: globalObject.Response
|
|
3804
|
+
}, env);
|
|
3551
3805
|
var _env = env,
|
|
3552
3806
|
envFetch = _env.fetch,
|
|
3553
3807
|
Request = _env.Request,
|
|
@@ -3558,13 +3812,13 @@ var contentful = (function (exports) {
|
|
|
3558
3812
|
if (!isFetchSupported) {
|
|
3559
3813
|
return false;
|
|
3560
3814
|
}
|
|
3561
|
-
var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream
|
|
3815
|
+
var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
|
|
3562
3816
|
var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
|
|
3563
3817
|
return function (str) {
|
|
3564
3818
|
return encoder.encode(str);
|
|
3565
3819
|
};
|
|
3566
3820
|
}(new TextEncoder()) : (/*#__PURE__*/function () {
|
|
3567
|
-
var
|
|
3821
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(str) {
|
|
3568
3822
|
return _regeneratorRuntime.wrap(function _callee4$(_context5) {
|
|
3569
3823
|
while (1) switch (_context5.prev = _context5.next) {
|
|
3570
3824
|
case 0:
|
|
@@ -3581,21 +3835,23 @@ var contentful = (function (exports) {
|
|
|
3581
3835
|
}, _callee4);
|
|
3582
3836
|
}));
|
|
3583
3837
|
return function (_x4) {
|
|
3584
|
-
return
|
|
3838
|
+
return _ref13.apply(this, arguments);
|
|
3585
3839
|
};
|
|
3586
3840
|
}()));
|
|
3587
3841
|
var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
|
|
3588
3842
|
var duplexAccessed = false;
|
|
3589
|
-
var
|
|
3590
|
-
|
|
3591
|
-
body: body,
|
|
3843
|
+
var request = new Request(platform.origin, {
|
|
3844
|
+
body: new ReadableStream(),
|
|
3592
3845
|
method: 'POST',
|
|
3593
3846
|
get duplex() {
|
|
3594
3847
|
duplexAccessed = true;
|
|
3595
3848
|
return 'half';
|
|
3596
3849
|
}
|
|
3597
|
-
})
|
|
3598
|
-
|
|
3850
|
+
});
|
|
3851
|
+
var hasContentType = request.headers.has('Content-Type');
|
|
3852
|
+
if (request.body != null) {
|
|
3853
|
+
request.body.cancel();
|
|
3854
|
+
}
|
|
3599
3855
|
return duplexAccessed && !hasContentType;
|
|
3600
3856
|
});
|
|
3601
3857
|
var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
|
|
@@ -3618,7 +3874,7 @@ var contentful = (function (exports) {
|
|
|
3618
3874
|
});
|
|
3619
3875
|
}();
|
|
3620
3876
|
var getBodyLength = /*#__PURE__*/function () {
|
|
3621
|
-
var
|
|
3877
|
+
var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(body) {
|
|
3622
3878
|
var _request;
|
|
3623
3879
|
return _regeneratorRuntime.wrap(function _callee5$(_context6) {
|
|
3624
3880
|
while (1) switch (_context6.prev = _context6.next) {
|
|
@@ -3672,11 +3928,11 @@ var contentful = (function (exports) {
|
|
|
3672
3928
|
}, _callee5);
|
|
3673
3929
|
}));
|
|
3674
3930
|
return function getBodyLength(_x5) {
|
|
3675
|
-
return
|
|
3931
|
+
return _ref14.apply(this, arguments);
|
|
3676
3932
|
};
|
|
3677
3933
|
}();
|
|
3678
3934
|
var resolveBodyLength = /*#__PURE__*/function () {
|
|
3679
|
-
var
|
|
3935
|
+
var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(headers, body) {
|
|
3680
3936
|
var length;
|
|
3681
3937
|
return _regeneratorRuntime.wrap(function _callee6$(_context7) {
|
|
3682
3938
|
while (1) switch (_context7.prev = _context7.next) {
|
|
@@ -3690,16 +3946,18 @@ var contentful = (function (exports) {
|
|
|
3690
3946
|
}, _callee6);
|
|
3691
3947
|
}));
|
|
3692
3948
|
return function resolveBodyLength(_x6, _x7) {
|
|
3693
|
-
return
|
|
3949
|
+
return _ref15.apply(this, arguments);
|
|
3694
3950
|
};
|
|
3695
3951
|
}();
|
|
3696
3952
|
return /*#__PURE__*/function () {
|
|
3697
|
-
var
|
|
3698
|
-
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _fetch, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, resolvedOptions, response, isStreamResponse, options, responseContentLength,
|
|
3953
|
+
var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(config) {
|
|
3954
|
+
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, _fetch, composedSignal, request, unsubscribe, requestContentLength, estimated, outboundLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, declaredLength, isStreamResponse, options, responseContentLength, _ref17, _ref18, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError;
|
|
3699
3955
|
return _regeneratorRuntime.wrap(function _callee7$(_context8) {
|
|
3700
3956
|
while (1) switch (_context8.prev = _context8.next) {
|
|
3701
3957
|
case 0:
|
|
3702
|
-
_resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
|
|
3958
|
+
_resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions, maxContentLength = _resolveConfig.maxContentLength, maxBodyLength = _resolveConfig.maxBodyLength;
|
|
3959
|
+
hasMaxContentLength = utils$1$1.isNumber(maxContentLength) && maxContentLength > -1;
|
|
3960
|
+
hasMaxBodyLength = utils$1$1.isNumber(maxBodyLength) && maxBodyLength > -1;
|
|
3703
3961
|
_fetch = envFetch || fetch;
|
|
3704
3962
|
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3705
3963
|
composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
@@ -3707,20 +3965,45 @@ var contentful = (function (exports) {
|
|
|
3707
3965
|
unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
|
|
3708
3966
|
composedSignal.unsubscribe();
|
|
3709
3967
|
};
|
|
3710
|
-
_context8.prev =
|
|
3968
|
+
_context8.prev = 8;
|
|
3969
|
+
if (!(hasMaxContentLength && typeof url === 'string' && url.startsWith('data:'))) {
|
|
3970
|
+
_context8.next = 13;
|
|
3971
|
+
break;
|
|
3972
|
+
}
|
|
3973
|
+
estimated = estimateDataURLDecodedBytes(url);
|
|
3974
|
+
if (!(estimated > maxContentLength)) {
|
|
3975
|
+
_context8.next = 13;
|
|
3976
|
+
break;
|
|
3977
|
+
}
|
|
3978
|
+
throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
|
|
3979
|
+
case 13:
|
|
3980
|
+
if (!(hasMaxBodyLength && method !== 'get' && method !== 'head')) {
|
|
3981
|
+
_context8.next = 19;
|
|
3982
|
+
break;
|
|
3983
|
+
}
|
|
3984
|
+
_context8.next = 16;
|
|
3985
|
+
return resolveBodyLength(headers, data);
|
|
3986
|
+
case 16:
|
|
3987
|
+
outboundLength = _context8.sent;
|
|
3988
|
+
if (!(typeof outboundLength === 'number' && isFinite(outboundLength) && outboundLength > maxBodyLength)) {
|
|
3989
|
+
_context8.next = 19;
|
|
3990
|
+
break;
|
|
3991
|
+
}
|
|
3992
|
+
throw new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
|
|
3993
|
+
case 19:
|
|
3711
3994
|
_context8.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
|
|
3712
3995
|
if (!_context8.t0) {
|
|
3713
|
-
_context8.next =
|
|
3996
|
+
_context8.next = 25;
|
|
3714
3997
|
break;
|
|
3715
3998
|
}
|
|
3716
|
-
_context8.next =
|
|
3999
|
+
_context8.next = 23;
|
|
3717
4000
|
return resolveBodyLength(headers, data);
|
|
3718
|
-
case
|
|
4001
|
+
case 23:
|
|
3719
4002
|
_context8.t1 = requestContentLength = _context8.sent;
|
|
3720
4003
|
_context8.t0 = _context8.t1 !== 0;
|
|
3721
|
-
case
|
|
4004
|
+
case 25:
|
|
3722
4005
|
if (!_context8.t0) {
|
|
3723
|
-
_context8.next =
|
|
4006
|
+
_context8.next = 29;
|
|
3724
4007
|
break;
|
|
3725
4008
|
}
|
|
3726
4009
|
_request = new Request(url, {
|
|
@@ -3735,14 +4018,24 @@ var contentful = (function (exports) {
|
|
|
3735
4018
|
_progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray$1(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
|
|
3736
4019
|
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
3737
4020
|
}
|
|
3738
|
-
case
|
|
4021
|
+
case 29:
|
|
3739
4022
|
if (!utils$1$1.isString(withCredentials)) {
|
|
3740
4023
|
withCredentials = withCredentials ? 'include' : 'omit';
|
|
3741
4024
|
}
|
|
3742
4025
|
|
|
3743
4026
|
// Cloudflare Workers throws when credentials are defined
|
|
3744
4027
|
// see https://github.com/cloudflare/workerd/issues/902
|
|
3745
|
-
isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
|
|
4028
|
+
isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype; // If data is FormData and Content-Type is multipart/form-data without boundary,
|
|
4029
|
+
// delete it so fetch can set it correctly with the boundary
|
|
4030
|
+
if (utils$1$1.isFormData(data)) {
|
|
4031
|
+
contentType = headers.getContentType();
|
|
4032
|
+
if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
|
|
4033
|
+
headers.delete('content-type');
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
|
|
4037
|
+
// Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
|
|
4038
|
+
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
3746
4039
|
resolvedOptions = _objectSpread$2(_objectSpread$2({}, fetchOptions), {}, {
|
|
3747
4040
|
signal: composedSignal,
|
|
3748
4041
|
method: method.toUpperCase(),
|
|
@@ -3752,30 +4045,70 @@ var contentful = (function (exports) {
|
|
|
3752
4045
|
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
3753
4046
|
});
|
|
3754
4047
|
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
3755
|
-
_context8.next =
|
|
4048
|
+
_context8.next = 37;
|
|
3756
4049
|
return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
|
|
3757
|
-
case
|
|
4050
|
+
case 37:
|
|
3758
4051
|
response = _context8.sent;
|
|
4052
|
+
if (!hasMaxContentLength) {
|
|
4053
|
+
_context8.next = 42;
|
|
4054
|
+
break;
|
|
4055
|
+
}
|
|
4056
|
+
declaredLength = utils$1$1.toFiniteNumber(response.headers.get('content-length'));
|
|
4057
|
+
if (!(declaredLength != null && declaredLength > maxContentLength)) {
|
|
4058
|
+
_context8.next = 42;
|
|
4059
|
+
break;
|
|
4060
|
+
}
|
|
4061
|
+
throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
|
|
4062
|
+
case 42:
|
|
3759
4063
|
isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3760
|
-
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
4064
|
+
if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
|
|
3761
4065
|
options = {};
|
|
3762
4066
|
['status', 'statusText', 'headers'].forEach(function (prop) {
|
|
3763
4067
|
options[prop] = response[prop];
|
|
3764
4068
|
});
|
|
3765
4069
|
responseContentLength = utils$1$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3766
|
-
|
|
3767
|
-
|
|
4070
|
+
_ref17 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref18 = _slicedToArray$1(_ref17, 2), _onProgress = _ref18[0], _flush = _ref18[1];
|
|
4071
|
+
bytesRead = 0;
|
|
4072
|
+
onChunkProgress = function onChunkProgress(loadedBytes) {
|
|
4073
|
+
if (hasMaxContentLength) {
|
|
4074
|
+
bytesRead = loadedBytes;
|
|
4075
|
+
if (bytesRead > maxContentLength) {
|
|
4076
|
+
throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
_onProgress && _onProgress(loadedBytes);
|
|
4080
|
+
};
|
|
4081
|
+
response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, function () {
|
|
3768
4082
|
_flush && _flush();
|
|
3769
4083
|
unsubscribe && unsubscribe();
|
|
3770
4084
|
}), options);
|
|
3771
4085
|
}
|
|
3772
4086
|
responseType = responseType || 'text';
|
|
3773
|
-
_context8.next =
|
|
4087
|
+
_context8.next = 47;
|
|
3774
4088
|
return resolvers[utils$1$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
3775
|
-
case
|
|
4089
|
+
case 47:
|
|
3776
4090
|
responseData = _context8.sent;
|
|
4091
|
+
if (!(hasMaxContentLength && !supportsResponseStream && !isStreamResponse)) {
|
|
4092
|
+
_context8.next = 52;
|
|
4093
|
+
break;
|
|
4094
|
+
}
|
|
4095
|
+
if (responseData != null) {
|
|
4096
|
+
if (typeof responseData.byteLength === 'number') {
|
|
4097
|
+
materializedSize = responseData.byteLength;
|
|
4098
|
+
} else if (typeof responseData.size === 'number') {
|
|
4099
|
+
materializedSize = responseData.size;
|
|
4100
|
+
} else if (typeof responseData === 'string') {
|
|
4101
|
+
materializedSize = typeof TextEncoder === 'function' ? new TextEncoder().encode(responseData).byteLength : responseData.length;
|
|
4102
|
+
}
|
|
4103
|
+
}
|
|
4104
|
+
if (!(typeof materializedSize === 'number' && materializedSize > maxContentLength)) {
|
|
4105
|
+
_context8.next = 52;
|
|
4106
|
+
break;
|
|
4107
|
+
}
|
|
4108
|
+
throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
|
|
4109
|
+
case 52:
|
|
3777
4110
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
3778
|
-
_context8.next =
|
|
4111
|
+
_context8.next = 55;
|
|
3779
4112
|
return new Promise(function (resolve, reject) {
|
|
3780
4113
|
settle(resolve, reject, {
|
|
3781
4114
|
data: responseData,
|
|
@@ -3786,29 +4119,43 @@ var contentful = (function (exports) {
|
|
|
3786
4119
|
request: request
|
|
3787
4120
|
});
|
|
3788
4121
|
});
|
|
3789
|
-
case
|
|
4122
|
+
case 55:
|
|
3790
4123
|
return _context8.abrupt("return", _context8.sent);
|
|
3791
|
-
case
|
|
3792
|
-
_context8.prev =
|
|
3793
|
-
_context8.t2 = _context8["catch"](
|
|
4124
|
+
case 58:
|
|
4125
|
+
_context8.prev = 58;
|
|
4126
|
+
_context8.t2 = _context8["catch"](8);
|
|
3794
4127
|
unsubscribe && unsubscribe();
|
|
4128
|
+
|
|
4129
|
+
// Safari can surface fetch aborts as a DOMException-like object whose
|
|
4130
|
+
// branded getters throw. Prefer our composed signal reason before reading
|
|
4131
|
+
// the caught error, preserving timeout vs cancellation semantics.
|
|
4132
|
+
if (!(composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError)) {
|
|
4133
|
+
_context8.next = 67;
|
|
4134
|
+
break;
|
|
4135
|
+
}
|
|
4136
|
+
canceledError = composedSignal.reason;
|
|
4137
|
+
canceledError.config = config;
|
|
4138
|
+
request && (canceledError.request = request);
|
|
4139
|
+
_context8.t2 !== canceledError && (canceledError.cause = _context8.t2);
|
|
4140
|
+
throw canceledError;
|
|
4141
|
+
case 67:
|
|
3795
4142
|
if (!(_context8.t2 && _context8.t2.name === 'TypeError' && /Load failed|fetch/i.test(_context8.t2.message))) {
|
|
3796
|
-
_context8.next =
|
|
4143
|
+
_context8.next = 69;
|
|
3797
4144
|
break;
|
|
3798
4145
|
}
|
|
3799
4146
|
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _context8.t2 && _context8.t2.response), {
|
|
3800
4147
|
cause: _context8.t2.cause || _context8.t2
|
|
3801
4148
|
});
|
|
3802
|
-
case
|
|
4149
|
+
case 69:
|
|
3803
4150
|
throw AxiosError.from(_context8.t2, _context8.t2 && _context8.t2.code, config, request, _context8.t2 && _context8.t2.response);
|
|
3804
|
-
case
|
|
4151
|
+
case 70:
|
|
3805
4152
|
case "end":
|
|
3806
4153
|
return _context8.stop();
|
|
3807
4154
|
}
|
|
3808
|
-
}, _callee7, null, [[
|
|
4155
|
+
}, _callee7, null, [[8, 58]]);
|
|
3809
4156
|
}));
|
|
3810
4157
|
return function (_x8) {
|
|
3811
|
-
return
|
|
4158
|
+
return _ref16.apply(this, arguments);
|
|
3812
4159
|
};
|
|
3813
4160
|
}();
|
|
3814
4161
|
};
|
|
@@ -3855,13 +4202,17 @@ var contentful = (function (exports) {
|
|
|
3855
4202
|
utils$1$1.forEach(knownAdapters, function (fn, value) {
|
|
3856
4203
|
if (fn) {
|
|
3857
4204
|
try {
|
|
4205
|
+
// Null-proto descriptors so a polluted Object.prototype.get cannot turn
|
|
4206
|
+
// these data descriptors into accessor descriptors on the way in.
|
|
3858
4207
|
Object.defineProperty(fn, 'name', {
|
|
4208
|
+
__proto__: null,
|
|
3859
4209
|
value: value
|
|
3860
4210
|
});
|
|
3861
4211
|
} catch (e) {
|
|
3862
4212
|
// eslint-disable-next-line no-empty
|
|
3863
4213
|
}
|
|
3864
4214
|
Object.defineProperty(fn, 'adapterName', {
|
|
4215
|
+
__proto__: null,
|
|
3865
4216
|
value: value
|
|
3866
4217
|
});
|
|
3867
4218
|
}
|
|
@@ -3920,10 +4271,10 @@ var contentful = (function (exports) {
|
|
|
3920
4271
|
rejectedReasons[id || '#' + i] = adapter;
|
|
3921
4272
|
}
|
|
3922
4273
|
if (!adapter) {
|
|
3923
|
-
var reasons = Object.entries(rejectedReasons).map(function (
|
|
3924
|
-
var
|
|
3925
|
-
id =
|
|
3926
|
-
state =
|
|
4274
|
+
var reasons = Object.entries(rejectedReasons).map(function (_ref19) {
|
|
4275
|
+
var _ref20 = _slicedToArray$1(_ref19, 2),
|
|
4276
|
+
id = _ref20[0],
|
|
4277
|
+
state = _ref20[1];
|
|
3927
4278
|
return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
|
|
3928
4279
|
});
|
|
3929
4280
|
var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
|
|
@@ -3984,8 +4335,15 @@ var contentful = (function (exports) {
|
|
|
3984
4335
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
3985
4336
|
throwIfCancellationRequested(config);
|
|
3986
4337
|
|
|
3987
|
-
//
|
|
3988
|
-
|
|
4338
|
+
// Expose the current response on config so that transformResponse can
|
|
4339
|
+
// attach it to any AxiosError it throws (e.g. on JSON parse failure).
|
|
4340
|
+
// We clean it up afterwards to avoid polluting the config object.
|
|
4341
|
+
config.response = response;
|
|
4342
|
+
try {
|
|
4343
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
4344
|
+
} finally {
|
|
4345
|
+
delete config.response;
|
|
4346
|
+
}
|
|
3989
4347
|
response.headers = AxiosHeaders.from(response.headers);
|
|
3990
4348
|
return response;
|
|
3991
4349
|
}, function onAdapterRejection(reason) {
|
|
@@ -3994,14 +4352,18 @@ var contentful = (function (exports) {
|
|
|
3994
4352
|
|
|
3995
4353
|
// Transform response data
|
|
3996
4354
|
if (reason && reason.response) {
|
|
3997
|
-
|
|
4355
|
+
config.response = reason.response;
|
|
4356
|
+
try {
|
|
4357
|
+
reason.response.data = transformData.call(config, config.transformResponse, reason.response);
|
|
4358
|
+
} finally {
|
|
4359
|
+
delete config.response;
|
|
4360
|
+
}
|
|
3998
4361
|
reason.response.headers = AxiosHeaders.from(reason.response.headers);
|
|
3999
4362
|
}
|
|
4000
4363
|
}
|
|
4001
4364
|
return Promise.reject(reason);
|
|
4002
4365
|
});
|
|
4003
4366
|
}
|
|
4004
|
-
var VERSION = "1.15.0";
|
|
4005
4367
|
var validators$1 = {};
|
|
4006
4368
|
|
|
4007
4369
|
// eslint-disable-next-line func-names
|
|
@@ -4065,7 +4427,9 @@ var contentful = (function (exports) {
|
|
|
4065
4427
|
var i = keys.length;
|
|
4066
4428
|
while (i-- > 0) {
|
|
4067
4429
|
var opt = keys[i];
|
|
4068
|
-
|
|
4430
|
+
// Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
|
|
4431
|
+
// a non-function validator and cause a TypeError.
|
|
4432
|
+
var _validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
|
|
4069
4433
|
if (_validator) {
|
|
4070
4434
|
var value = options[opt];
|
|
4071
4435
|
var result = value === undefined || _validator(value, opt, options);
|
|
@@ -4219,7 +4583,7 @@ var contentful = (function (exports) {
|
|
|
4219
4583
|
|
|
4220
4584
|
// Flatten headers
|
|
4221
4585
|
var contextHeaders = headers && utils$1$1.merge(headers.common, headers[config.method]);
|
|
4222
|
-
headers && utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
|
|
4586
|
+
headers && utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], function (method) {
|
|
4223
4587
|
delete headers[method];
|
|
4224
4588
|
});
|
|
4225
4589
|
config.headers = AxiosHeaders.concat(contextHeaders, headers);
|
|
@@ -4301,7 +4665,7 @@ var contentful = (function (exports) {
|
|
|
4301
4665
|
}));
|
|
4302
4666
|
};
|
|
4303
4667
|
});
|
|
4304
|
-
utils$1$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
4668
|
+
utils$1$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
|
|
4305
4669
|
function generateHTTPMethod(isForm) {
|
|
4306
4670
|
return function httpMethod(url, data, config) {
|
|
4307
4671
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -4315,7 +4679,12 @@ var contentful = (function (exports) {
|
|
|
4315
4679
|
};
|
|
4316
4680
|
}
|
|
4317
4681
|
Axios.prototype[method] = generateHTTPMethod();
|
|
4318
|
-
|
|
4682
|
+
|
|
4683
|
+
// QUERY is a safe/idempotent read method; multipart form bodies don't fit
|
|
4684
|
+
// its semantics, so no queryForm shorthand is generated.
|
|
4685
|
+
if (method !== 'query') {
|
|
4686
|
+
Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
4687
|
+
}
|
|
4319
4688
|
});
|
|
4320
4689
|
|
|
4321
4690
|
/**
|
|
@@ -4553,10 +4922,10 @@ var contentful = (function (exports) {
|
|
|
4553
4922
|
SslHandshakeFailed: 525,
|
|
4554
4923
|
InvalidSslCertificate: 526
|
|
4555
4924
|
};
|
|
4556
|
-
Object.entries(HttpStatusCode).forEach(function (
|
|
4557
|
-
var
|
|
4558
|
-
key =
|
|
4559
|
-
value =
|
|
4925
|
+
Object.entries(HttpStatusCode).forEach(function (_ref21) {
|
|
4926
|
+
var _ref22 = _slicedToArray$1(_ref21, 2),
|
|
4927
|
+
key = _ref22[0],
|
|
4928
|
+
value = _ref22[1];
|
|
4560
4929
|
HttpStatusCode[value] = key;
|
|
4561
4930
|
});
|
|
4562
4931
|
|