contentful 11.12.1 → 11.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 File, otherwise false
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
- var kind;
972
- return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
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(/* obj1, obj2, obj3, ... */
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
- if (isPlainObject$2(result[targetKey]) && isPlainObject$2(val)) {
1120
- result[targetKey] = merge$1(result[targetKey], val);
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 i = 0, l = arguments.length; i < l; i++) {
1130
- arguments[i] && forEach(arguments[i], assignValue);
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'].indexOf(name) !== -1) {
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
- // eslint-disable-next-line strict
1673
- var httpAdapter = null;
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
- * Determines if the given thing is a array or js object.
1677
- *
1678
- * @param {string} thing - The object or array to be visited.
1608
+ * Parse headers into an object
1679
1609
  *
1680
- * @returns {boolean}
1681
- */
1682
- function isVisitable(thing) {
1683
- return utils$1$1.isPlainObject(thing) || utils$1$1.isArray(thing);
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 {string} key - The key of the parameter.
1617
+ * @param {String} rawHeaders Headers needing to be parsed
1690
1618
  *
1691
- * @returns {string} the key without the brackets.
1619
+ * @returns {Object} Headers parsed into an object
1692
1620
  */
1693
- function removeBrackets(key) {
1694
- return utils$1$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
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
- var predicates = utils$1$1.toFlatObject(utils$1$1, {}, null, function filter(prop) {
1726
- return /^is[A-Z]/.test(prop);
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
- // eslint-disable-next-line no-param-reassign
1758
- formData = formData || new FormData();
1759
-
1760
- // eslint-disable-next-line no-param-reassign
1761
- options = utils$1$1.toFlatObject(options, {
1762
- metaTokens: true,
1763
- dots: false,
1764
- indexes: false
1765
- }, false, function defined(option, source) {
1766
- // eslint-disable-next-line no-eq-null,eqeqeq
1767
- return !utils$1$1.isUndefined(source[option]);
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
- var metaTokens = options.metaTokens;
1770
- // eslint-disable-next-line no-use-before-define
1771
- var visitor = options.visitor || defaultVisitor;
1772
- var dots = options.dots;
1773
- var indexes = options.indexes;
1774
- var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1775
- var useBlob = _Blob && utils$1$1.isSpecCompliantForm(formData);
1776
- if (!utils$1$1.isFunction(visitor)) {
1777
- throw new TypeError('visitor must be a function');
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
- function convertValue(value) {
1780
- if (value === null) return '';
1781
- if (utils$1$1.isDate(value)) {
1782
- return value.toISOString();
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;
1776
+ }
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]();
1783
1891
  }
1784
- if (utils$1$1.isBoolean(value)) {
1785
- return value.toString();
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');
1786
1901
  }
1787
- if (!useBlob && utils$1$1.isBlob(value)) {
1788
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1902
+ }, {
1903
+ key: "getSetCookie",
1904
+ value: function getSetCookie() {
1905
+ return this.get('set-cookie') || [];
1789
1906
  }
1790
- if (utils$1$1.isArrayBuffer(value) || utils$1$1.isTypedArray(value)) {
1791
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1907
+ }, {
1908
+ key: Symbol.toStringTag,
1909
+ get: function get() {
1910
+ return 'AxiosHeaders';
1792
1911
  }
1793
- return value;
1794
- }
1795
-
1796
- /**
1797
- * Default visitor.
1798
- *
1799
- * @param {*} value
1800
- * @param {String|Number} key
1801
- * @param {Array<String|Number>} path
1802
- * @this {FormData}
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;
1912
+ }], [{
1913
+ key: "from",
1914
+ value: function from(thing) {
1915
+ return thing instanceof this ? thing : new this(thing);
1811
1916
  }
1812
- if (value && !path && _typeof$2(value) === 'object') {
1813
- if (utils$1$1.endsWith(key, '{}')) {
1814
- // eslint-disable-next-line no-param-reassign
1815
- key = metaTokens ? key : key.slice(0, -2);
1816
- // eslint-disable-next-line no-param-reassign
1817
- value = JSON.stringify(value);
1818
- } 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))) {
1819
- // eslint-disable-next-line no-param-reassign
1820
- key = removeBrackets(key);
1821
- arr.forEach(function each(el, index) {
1822
- !(utils$1$1.isUndefined(el) || el === null) && formData.append(
1823
- // eslint-disable-next-line no-nested-ternary
1824
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
1825
- });
1826
- 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];
1827
1923
  }
1924
+ targets.forEach(function (target) {
1925
+ return computed.set(target);
1926
+ });
1927
+ return computed;
1828
1928
  }
1829
- if (isVisitable(value)) {
1830
- return true;
1831
- }
1832
- formData.append(renderKey(path, key, dots), convertValue(value));
1833
- return false;
1834
- }
1835
- var stack = [];
1836
- var exposedHelpers = Object.assign(predicates, {
1837
- defaultVisitor: defaultVisitor,
1838
- convertValue: convertValue,
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('.'));
1845
- }
1846
- stack.push(value);
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]);
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
+ }
1851
1943
  }
1852
- });
1853
- stack.pop();
1854
- }
1855
- if (!utils$1$1.isObject(obj)) {
1856
- throw new TypeError('data must be an object');
1857
- }
1858
- build(obj);
1859
- return formData;
1860
- }
1944
+ utils$1$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1945
+ return this;
1946
+ }
1947
+ }]);
1948
+ }();
1949
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1861
1950
 
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'
1951
+ // reserved names hotfix
1952
+ utils$1$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref0, key) {
1953
+ var value = _ref0.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;
1961
+ }
1879
1962
  };
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, '+');
1920
- }
1921
-
1922
- /**
1923
- * Build a URL by appending params to the end
1924
- *
1925
- * @param {string} url The base of the url (e.g., http://www.google.com)
1926
- * @param {object} [params] The params to be appended
1927
- * @param {?(object|Function)} options
1928
- *
1929
- * @returns {string} The formatted url
1930
- */
1931
- function buildURL(url, params, options) {
1932
- if (!params) {
1933
- return url;
1934
- }
1935
- var _encode = options && options.encode || encode$2;
1936
- var _options = utils$1$1.isFunction(options) ? {
1937
- serialize: options
1938
- } : options;
1939
- var serializeFn = _options && _options.serialize;
1940
- var serializedParams;
1941
- if (serializeFn) {
1942
- serializedParams = serializeFn(params, _options);
1943
- } else {
1944
- serializedParams = utils$1$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
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;
1945
1969
  }
1946
- if (serializedParams) {
1947
- var hashmarkIndex = url.indexOf('#');
1948
- if (hashmarkIndex !== -1) {
1949
- url = url.slice(0, hashmarkIndex);
1970
+ var prototype = Object.getPrototypeOf(source);
1971
+ while (prototype && prototype !== Object.prototype) {
1972
+ if (utils$1$1.hasOwnProp(prototype, 'toJSON')) {
1973
+ return true;
1950
1974
  }
1951
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1975
+ prototype = Object.getPrototypeOf(prototype);
1952
1976
  }
1953
- return url;
1977
+ return false;
1954
1978
  }
1955
- var InterceptorManager = /*#__PURE__*/function () {
1956
- function InterceptorManager() {
1957
- _classCallCheck(this, InterceptorManager);
1958
- this.handlers = [];
1959
- }
1960
-
1961
- /**
1962
- * Add a new interceptor to the stack
1963
- *
1964
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1965
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1966
- * @param {Object} options The options for the interceptor, synchronous and runWhen
1967
- *
1968
- * @return {Number} An ID used to remove interceptor later
1969
- */
1970
- return _createClass(InterceptorManager, [{
1971
- key: "use",
1972
- value: function use(fulfilled, rejected, options) {
1973
- this.handlers.push({
1974
- fulfilled: fulfilled,
1975
- rejected: rejected,
1976
- synchronous: options ? options.synchronous : false,
1977
- runWhen: options ? options.runWhen : null
1978
- });
1979
- return this.handlers.length - 1;
1980
- }
1981
1979
 
1982
- /**
1983
- * Remove an interceptor from the stack
1984
- *
1985
- * @param {Number} id The ID that was returned by `use`
1986
- *
1987
- * @returns {void}
1988
- */
1989
- }, {
1990
- key: "eject",
1991
- value: function eject(id) {
1992
- if (this.handlers[id]) {
1993
- this.handlers[id] = null;
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
+ }
1994
2019
  }
1995
2020
  }
2021
+ seen.pop();
2022
+ return result;
2023
+ };
2024
+ return _visit2(config);
2025
+ }
2026
+ var AxiosError = /*#__PURE__*/function (_Error) {
2027
+ /**
2028
+ * Create an Error with the specified message, config, error code, request and response.
2029
+ *
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.
2035
+ *
2036
+ * @returns {Error} The created error.
2037
+ */
2038
+ function AxiosError(message, code, config, request, response) {
2039
+ var _this;
2040
+ _classCallCheck(this, AxiosError);
2041
+ _this = _callSuper$3(this, AxiosError, [message]);
1996
2042
 
1997
- /**
1998
- * Clear all interceptors from the stack
1999
- *
2000
- * @returns {void}
2001
- */
2002
- }, {
2003
- key: "clear",
2004
- value: function clear() {
2005
- if (this.handlers) {
2006
- this.handlers = [];
2007
- }
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;
2063
+ }
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
+ };
2008
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;
2009
2101
 
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
- });
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;
2105
+ }
2106
+ customProps && Object.assign(axiosError, customProps);
2107
+ return axiosError;
2028
2108
  }
2029
2109
  }]);
2030
- }();
2031
- var transitionalDefaults = {
2032
- silentJSONParsing: true,
2033
- forcedJSONParsing: true,
2034
- clarifyTimeoutError: false,
2035
- legacyInterceptorReqResOrdering: true
2036
- };
2037
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
2038
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
2039
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
2040
- var platform$1 = {
2041
- isBrowser: true,
2042
- classes: {
2043
- URLSearchParams: URLSearchParams$1,
2044
- FormData: FormData$1,
2045
- Blob: Blob$1
2046
- },
2047
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
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
- * Determine if we're running in a standard browser environment
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
- * react-native:
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
- var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2136
+ function isVisitable(thing) {
2137
+ return utils$1$1.isPlainObject(thing) || utils$1$1.isArray(thing);
2138
+ }
2070
2139
 
2071
2140
  /**
2072
- * Determine if we're running in a standard browser webWorker environment
2141
+ * It removes the brackets from the end of a string
2073
2142
  *
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
2143
+ * @param {string} key - The key of the parameter.
2144
+ *
2145
+ * @returns {string} the key without the brackets.
2079
2146
  */
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));
2147
+ function removeBrackets(key) {
2148
+ return utils$1$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
2105
2149
  }
2106
2150
 
2107
2151
  /**
2108
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2152
+ * It takes a path, a key, and a boolean, and returns a string
2109
2153
  *
2110
- * @param {string} name - The name of the property to get.
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.
2111
2157
  *
2112
- * @returns An array of strings.
2158
+ * @returns {string} The path to the current key.
2113
2159
  */
2114
- function parsePropPath(name) {
2115
- // foo[x][y][z]
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
- });
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 ? '.' : '');
2122
2167
  }
2123
2168
 
2124
2169
  /**
2125
- * Convert an array to an object.
2170
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
2126
2171
  *
2127
- * @param {Array<any>} arr - The array to convert to an object.
2172
+ * @param {Array<any>} arr - The array to check
2128
2173
  *
2129
- * @returns An object with the same keys and values as the array.
2174
+ * @returns {boolean}
2130
2175
  */
2131
- function arrayToObject$1(arr) {
2132
- var obj = {};
2133
- var keys = Object.keys(arr);
2134
- var i;
2135
- var len = keys.length;
2136
- var key;
2137
- for (i = 0; i < len; i++) {
2138
- key = keys[i];
2139
- obj[key] = arr[key];
2140
- }
2141
- return obj;
2176
+ function isFlatArray(arr) {
2177
+ return utils$1$1.isArray(arr) && !arr.some(isVisitable);
2142
2178
  }
2179
+ var predicates = utils$1$1.toFlatObject(utils$1$1, {}, null, function filter(prop) {
2180
+ return /^is[A-Z]/.test(prop);
2181
+ });
2182
+
2183
+ /**
2184
+ * Convert a data object to FormData
2185
+ *
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]
2193
+ *
2194
+ * @returns {Object}
2195
+ **/
2143
2196
 
2144
2197
  /**
2145
- * It takes a FormData object and returns a JavaScript object
2198
+ * It converts an object into a FormData object
2146
2199
  *
2147
- * @param {string} formData The FormData object to convert to JSON.
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
2148
2203
  *
2149
- * @returns {Object<string, any> | null} The converted object.
2204
+ * @returns
2150
2205
  */
2151
- function formDataToJSON(formData) {
2152
- function buildPath(path, value, target, index) {
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;
2206
+ function toFormData(obj, formData, options) {
2207
+ if (!utils$1$1.isObject(obj)) {
2208
+ throw new TypeError('target must be an object');
2181
2209
  }
2182
- return null;
2183
- }
2184
2210
 
2185
- /**
2186
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2187
- * of the input
2188
- *
2189
- * @param {any} rawValue - The value to be stringified.
2190
- * @param {Function} parser - A function that parses a string into a JavaScript object.
2191
- * @param {Function} encoder - A function that takes a value and returns a string.
2192
- *
2193
- * @returns {string} A stringified version of the rawValue.
2194
- */
2195
- function stringifySafely(rawValue, parser, encoder) {
2196
- if (utils$1$1.isString(rawValue)) {
2197
- try {
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
- }
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');
2205
2233
  }
2206
- return (encoder || JSON.stringify)(rawValue);
2207
- }
2208
- var defaults$2 = {
2209
- transitional: transitionalDefaults,
2210
- adapter: ['xhr', 'http', 'fetch'],
2211
- transformRequest: [function transformRequest(data, headers) {
2212
- var contentType = headers.getContentType() || '';
2213
- var hasJSONContentType = contentType.indexOf('application/json') > -1;
2214
- var isObjectPayload = utils$1$1.isObject(data);
2215
- if (isObjectPayload && utils$1$1.isHTMLForm(data)) {
2216
- data = new FormData(data);
2217
- }
2218
- var isFormData = utils$1$1.isFormData(data);
2219
- if (isFormData) {
2220
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2221
- }
2222
- 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)) {
2223
- return data;
2224
- }
2225
- if (utils$1$1.isArrayBufferView(data)) {
2226
- return data.buffer;
2234
+ function convertValue(value) {
2235
+ if (value === null) return '';
2236
+ if (utils$1$1.isDate(value)) {
2237
+ return value.toISOString();
2227
2238
  }
2228
- if (utils$1$1.isURLSearchParams(data)) {
2229
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2230
- return data.toString();
2239
+ if (utils$1$1.isBoolean(value)) {
2240
+ return value.toString();
2231
2241
  }
2232
- var isFileList;
2233
- if (isObjectPayload) {
2234
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2235
- return toURLEncodedForm(data, this.formSerializer).toString();
2236
- }
2237
- if ((isFileList = utils$1$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2238
- var _FormData = this.env && this.env.FormData;
2239
- return toFormData(isFileList ? {
2240
- 'files[]': data
2241
- } : data, _FormData && new _FormData(), this.formSerializer);
2242
- }
2242
+ if (!useBlob && utils$1$1.isBlob(value)) {
2243
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
2243
2244
  }
2244
- if (isObjectPayload || hasJSONContentType) {
2245
- headers.setContentType('application/json', false);
2246
- return stringifySafely(data);
2245
+ if (utils$1$1.isArrayBuffer(value) || utils$1$1.isTypedArray(value)) {
2246
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2247
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;
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;
2256
2266
  }
2257
- if (data && utils$1$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
2258
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
2259
- var strictJSONParsing = !silentJSONParsing && JSONRequested;
2260
- try {
2261
- return JSON.parse(data, this.parseReviver);
2262
- } catch (e) {
2263
- if (strictJSONParsing) {
2264
- if (e.name === 'SyntaxError') {
2265
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
2266
- }
2267
- throw e;
2268
- }
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;
2269
2282
  }
2270
2283
  }
2271
- return data;
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
2284
+ if (isVisitable(value)) {
2285
+ return true;
2293
2286
  }
2287
+ formData.append(renderKey(path, key, dots), convertValue(value));
2288
+ return false;
2294
2289
  }
2295
- };
2296
- utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
2297
- defaults$2.headers[method] = {};
2298
- });
2299
-
2300
- // RawAxiosHeaders whose duplicates are ignored by node
2301
- // c.f. https://nodejs.org/api/http.html#http_message_headers
2302
- 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']);
2303
-
2304
- /**
2305
- * Parse headers into an object
2306
- *
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
- * ```
2313
- *
2314
- * @param {String} rawHeaders Headers needing to be parsed
2315
- *
2316
- * @returns {Object} Headers parsed into an object
2317
- */
2318
- var parseHeaders = function parseHeaders(rawHeaders) {
2319
- var parsed = {};
2320
- var key;
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;
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);
2329
2301
  }
2330
- if (key === 'set-cookie') {
2331
- if (parsed[key]) {
2332
- parsed[key].push(val);
2333
- } else {
2334
- parsed[key] = [val];
2302
+ if (stack.indexOf(value) !== -1) {
2303
+ throw Error('Circular reference detected in ' + path.join('.'));
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);
2335
2310
  }
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
2311
  });
2354
- return;
2355
- }
2356
- if (!isValidHeaderValue(String(value))) {
2357
- throw new Error("Invalid character in header content [\"".concat(header, "\"]"));
2312
+ stack.pop();
2358
2313
  }
2359
- }
2360
- function normalizeHeader(header) {
2361
- return header && String(header).trim().toLowerCase();
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;
2369
- }
2370
- end -= 1;
2314
+ if (!utils$1$1.isObject(obj)) {
2315
+ throw new TypeError('data must be an object');
2371
2316
  }
2372
- return end === str.length ? str : str.slice(0, end);
2317
+ build(obj);
2318
+ return formData;
2373
2319
  }
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));
2320
+
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
+ });
2379
2341
  }
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;
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);
2388
2354
  }
2389
- var isValidHeaderName = function isValidHeaderName(str) {
2390
- return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2355
+ var prototype = AxiosURLSearchParams.prototype;
2356
+ prototype.append = function append(name, value) {
2357
+ this._pairs.push([name, value]);
2391
2358
  };
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;
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
+ };
2367
+
2368
+ /**
2369
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
2370
+ * their plain counterparts (`:`, `$`, `,`, `+`).
2371
+ *
2372
+ * @param {string} val The value to be encoded.
2373
+ *
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
2382
+ *
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
2388
+ */
2389
+ function buildURL(url, params, options) {
2390
+ if (!params) {
2391
+ return url;
2398
2392
  }
2399
- if (!utils$1$1.isString(value)) return;
2400
- if (utils$1$1.isString(filter)) {
2401
- return value.indexOf(filter) !== -1;
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);
2402
2403
  }
2403
- if (utils$1$1.isRegExp(filter)) {
2404
- return filter.test(value);
2404
+ if (serializedParams) {
2405
+ var hashmarkIndex = url.indexOf('#');
2406
+ if (hashmarkIndex !== -1) {
2407
+ url = url.slice(0, hashmarkIndex);
2408
+ }
2409
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
2405
2410
  }
2411
+ return url;
2406
2412
  }
2407
- function formatHeader(header) {
2408
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, char, str) {
2409
- return char.toUpperCase() + str;
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
- return _createClass(AxiosHeaders, [{
2429
- key: "set",
2430
- value: function set(header, valueOrRewrite, rewrite) {
2431
- var self = this;
2432
- function setHeader(_value, _header, _rewrite) {
2433
- var lHeader = normalizeHeader(_header);
2434
- if (!lHeader) {
2435
- throw new Error('header name must be a non-empty string');
2436
- }
2437
- var key = utils$1$1.findKey(self, lHeader);
2438
- if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
2439
- assertValidHeaderValue(_value, _header);
2440
- self[key || _header] = normalizeValue(_value);
2441
- }
2442
- }
2443
- var setHeaders = function setHeaders(headers, _rewrite) {
2444
- return utils$1$1.forEach(headers, function (_value, _header) {
2445
- return setHeader(_value, _header, _rewrite);
2446
- });
2447
- };
2448
- if (utils$1$1.isPlainObject(header) || header instanceof this.constructor) {
2449
- setHeaders(header, valueOrRewrite);
2450
- } else if (utils$1$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2451
- setHeaders(parseHeaders(header), valueOrRewrite);
2452
- } else if (utils$1$1.isObject(header) && utils$1$1.isIterable(header)) {
2453
- var obj = {},
2454
- dest,
2455
- key;
2456
- var _iterator3 = _createForOfIteratorHelper$3(header),
2457
- _step2;
2458
- try {
2459
- for (_iterator3.s(); !(_step2 = _iterator3.n()).done;) {
2460
- var entry = _step2.value;
2461
- if (!utils$1$1.isArray(entry)) {
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;
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;
2476
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
+ */
2477
2447
  }, {
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
- }
2448
+ key: "eject",
2449
+ value: function eject(id) {
2450
+ if (this.handlers[id]) {
2451
+ this.handlers[id] = null;
2499
2452
  }
2500
2453
  }
2454
+
2455
+ /**
2456
+ * Clear all interceptors from the stack
2457
+ *
2458
+ * @returns {void}
2459
+ */
2501
2460
  }, {
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)));
2461
+ key: "clear",
2462
+ value: function clear() {
2463
+ if (this.handlers) {
2464
+ this.handlers = [];
2508
2465
  }
2509
- return false;
2510
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
+ */
2511
2478
  }, {
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
- }
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);
2524
2484
  }
2485
+ });
2486
+ }
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;
2525
2559
  }
2526
- if (utils$1$1.isArray(header)) {
2527
- header.forEach(deleteHeader);
2560
+ return helpers.defaultVisitor.apply(this, arguments);
2561
+ }
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];
2528
2619
  } else {
2529
- deleteHeader(header);
2620
+ target[name] = value;
2530
2621
  }
2531
- return deleted;
2622
+ return !isNumericKey;
2532
2623
  }
2533
- }, {
2534
- key: "clear",
2535
- value: function clear(matcher) {
2536
- var keys = Object.keys(this);
2537
- var i = keys.length;
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
- }
2545
- }
2546
- return deleted;
2624
+ if (!target[name] || !utils$1$1.isObject(target[name])) {
2625
+ target[name] = [];
2547
2626
  }
2548
- }, {
2549
- key: "normalize",
2550
- value: function normalize(format) {
2551
- var self = this;
2552
- var headers = {};
2553
- utils$1$1.forEach(this, function (value, header) {
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];
2563
- }
2564
- self[normalized] = normalizeValue(value);
2565
- headers[normalized] = true;
2566
- });
2567
- return this;
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]);
2568
2630
  }
2569
- }, {
2570
- key: "concat",
2571
- value: function concat() {
2572
- var _this$constructor;
2573
- for (var _len = arguments.length, targets = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
2574
- targets[_key2] = arguments[_key2];
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;
2575
2664
  }
2576
- return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
2577
- }
2578
- }, {
2579
- key: "toJSON",
2580
- value: function toJSON(asStrings) {
2581
- var obj = Object.create(null);
2582
- utils$1$1.forEach(this, function (value, header) {
2583
- value != null && value !== false && (obj[header] = asStrings && utils$1$1.isArray(value) ? value.join(', ') : value);
2584
- });
2585
- return obj;
2586
2665
  }
2587
- }, {
2588
- key: Symbol.iterator,
2589
- value: function value() {
2590
- return Object.entries(this.toJSON())[Symbol.iterator]();
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
- key: "toString",
2594
- value: function toString() {
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
- key: "getSetCookie",
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
- key: Symbol.toStringTag,
2609
- get: function get() {
2610
- return 'AxiosHeaders';
2686
+ if (utils$1$1.isArrayBufferView(data)) {
2687
+ return data.buffer;
2611
2688
  }
2612
- }], [{
2613
- key: "from",
2614
- value: function from(thing) {
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
- key: "concat",
2619
- value: function concat(first) {
2620
- var computed = new this(first);
2621
- for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
2622
- targets[_key3 - 1] = arguments[_key3];
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
- key: "accessor",
2631
- value: function accessor(header) {
2632
- var internals = this[$internals] = this[$internals] = {
2633
- accessors: {}
2634
- };
2635
- var accessors = internals.accessors;
2636
- var prototype = this.prototype;
2637
- function defineAccessor(_header) {
2638
- var lHeader = normalizeHeader(_header);
2639
- if (!accessors[lHeader]) {
2640
- buildAccessors(prototype, _header);
2641
- accessors[lHeader] = true;
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
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2650
-
2651
- // reserved names hotfix
2652
- utils$1$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref10, key) {
2653
- var value = _ref10.value;
2654
- var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2655
- return {
2656
- get: function get() {
2657
- return value;
2658
- },
2659
- set: function set(headerValue) {
2660
- this[mapped] = headerValue;
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, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
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})(:?\/\/|:)/.exec(url);
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 _len3 = arguments.length, args = new Array(_len3), _key4 = 0; _key4 < _len3; _key4++) {
2796
- args[_key4] = arguments[_key4];
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 loaded = e.loaded;
2918
+ var rawLoaded = e.loaded;
2821
2919
  var total = e.lengthComputable ? e.total : undefined;
2822
- var progressBytes = loaded - bytesNotified;
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
- var inRange = loaded <= total;
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 && inRange ? (total - loaded) / rate : undefined,
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 _len4 = arguments.length, args = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {
2852
- args[_key5] = arguments[_key5];
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
- var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
2893
- return match ? decodeURIComponent(match[1]) : null;
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 == false)) {
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
- var config = {};
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 in config2) {
3133
+ if (utils$1$1.hasOwnProp(config2, prop)) {
3010
3134
  return getMergedValue(a, b);
3011
- } else if (prop in config1) {
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 configValue = merge(config1[prop], config2[prop], prop);
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 (_ref1) {
3190
+ var _ref10 = _slicedToArray$1(_ref1, 2),
3191
+ key = _ref10[0],
3192
+ val = _ref10[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
- var data = newConfig.data,
3059
- withXSRFToken = newConfig.withXSRFToken,
3060
- xsrfHeaderName = newConfig.xsrfHeaderName,
3061
- xsrfCookieName = newConfig.xsrfCookieName,
3062
- headers = newConfig.headers,
3063
- auth = newConfig.auth;
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(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
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 ? unescape(encodeURIComponent(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
- var formHeaders = data.getHeaders();
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
- withXSRFToken && utils$1$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
3096
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
3097
- // Add xsrf header
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.indexOf('file:') === 0)) {
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.indexOf(protocol) === -1) {
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 _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key6 = 1; _key6 < _len5; _key6++) {
3540
- args[_key6 - 1] = arguments[_key6];
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
- }, globalFetchAPI, env);
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$1);
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 _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(str) {
3821
+ var _ref11 = _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 _ref14.apply(this, arguments);
3838
+ return _ref11.apply(this, arguments);
3585
3839
  };
3586
3840
  }()));
3587
3841
  var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
3588
3842
  var duplexAccessed = false;
3589
- var body = new ReadableStream$1();
3590
- var hasContentType = new Request(platform.origin, {
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
- }).headers.has('Content-Type');
3598
- body.cancel();
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 _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(body) {
3877
+ var _ref12 = _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 _ref15.apply(this, arguments);
3931
+ return _ref12.apply(this, arguments);
3676
3932
  };
3677
3933
  }();
3678
3934
  var resolveBodyLength = /*#__PURE__*/function () {
3679
- var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(headers, body) {
3935
+ var _ref13 = _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 _ref16.apply(this, arguments);
3949
+ return _ref13.apply(this, arguments);
3694
3950
  };
3695
3951
  }();
3696
3952
  return /*#__PURE__*/function () {
3697
- var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(config) {
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, _ref18, _ref19, _onProgress, _flush, responseData;
3953
+ var _ref14 = _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, _ref15, _ref16, _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 = 6;
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 = 13;
3996
+ _context8.next = 25;
3714
3997
  break;
3715
3998
  }
3716
- _context8.next = 11;
3999
+ _context8.next = 23;
3717
4000
  return resolveBodyLength(headers, data);
3718
- case 11:
4001
+ case 23:
3719
4002
  _context8.t1 = requestContentLength = _context8.sent;
3720
4003
  _context8.t0 = _context8.t1 !== 0;
3721
- case 13:
4004
+ case 25:
3722
4005
  if (!_context8.t0) {
3723
- _context8.next = 17;
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 17:
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 = 23;
4048
+ _context8.next = 37;
3756
4049
  return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
3757
- case 23:
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
- _ref18 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref19 = _slicedToArray$1(_ref18, 2), _onProgress = _ref19[0], _flush = _ref19[1];
3767
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
4070
+ _ref15 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref16 = _slicedToArray$1(_ref15, 2), _onProgress = _ref16[0], _flush = _ref16[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 = 29;
4087
+ _context8.next = 47;
3774
4088
  return resolvers[utils$1$1.findKey(resolvers, responseType) || 'text'](response, config);
3775
- case 29:
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 = 33;
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 33:
4122
+ case 55:
3790
4123
  return _context8.abrupt("return", _context8.sent);
3791
- case 36:
3792
- _context8.prev = 36;
3793
- _context8.t2 = _context8["catch"](6);
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 = 41;
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 41:
4149
+ case 69:
3803
4150
  throw AxiosError.from(_context8.t2, _context8.t2 && _context8.t2.code, config, request, _context8.t2 && _context8.t2.response);
3804
- case 42:
4151
+ case 70:
3805
4152
  case "end":
3806
4153
  return _context8.stop();
3807
4154
  }
3808
- }, _callee7, null, [[6, 36]]);
4155
+ }, _callee7, null, [[8, 58]]);
3809
4156
  }));
3810
4157
  return function (_x8) {
3811
- return _ref17.apply(this, arguments);
4158
+ return _ref14.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 (_ref20) {
3924
- var _ref21 = _slicedToArray$1(_ref20, 2),
3925
- id = _ref21[0],
3926
- state = _ref21[1];
4274
+ var reasons = Object.entries(rejectedReasons).map(function (_ref17) {
4275
+ var _ref18 = _slicedToArray$1(_ref17, 2),
4276
+ id = _ref18[0],
4277
+ state = _ref18[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
- // Transform response data
3988
- response.data = transformData.call(config, config.transformResponse, response);
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
- reason.response.data = transformData.call(config, config.transformResponse, reason.response);
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
- var _validator = schema[opt];
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);
@@ -4161,7 +4525,7 @@ var contentful = (function (exports) {
4161
4525
  }
4162
4526
  }, _callee8, this, [[0, 6]]);
4163
4527
  }));
4164
- function request(_x9, _x10) {
4528
+ function request(_x9, _x0) {
4165
4529
  return _request2.apply(this, arguments);
4166
4530
  }
4167
4531
  return request;
@@ -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
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
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 (_ref22) {
4557
- var _ref23 = _slicedToArray$1(_ref22, 2),
4558
- key = _ref23[0],
4559
- value = _ref23[1];
4925
+ Object.entries(HttpStatusCode).forEach(function (_ref19) {
4926
+ var _ref20 = _slicedToArray$1(_ref19, 2),
4927
+ key = _ref20[0],
4928
+ value = _ref20[1];
4560
4929
  HttpStatusCode[value] = key;
4561
4930
  });
4562
4931
 
@@ -7718,7 +8087,7 @@ var contentful = (function (exports) {
7718
8087
  }
7719
8088
  if (obj === null) {
7720
8089
  if (strictNullHandling) {
7721
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
8090
+ return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix);
7722
8091
  }
7723
8092
  obj = '';
7724
8093
  }
@@ -7737,7 +8106,9 @@ var contentful = (function (exports) {
7737
8106
  if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
7738
8107
  // we need to join elements in
7739
8108
  if (encodeValuesOnly && encoder) {
7740
- obj = utils$1.maybeMap(obj, encoder);
8109
+ obj = utils$1.maybeMap(obj, function (v) {
8110
+ return v == null ? v : encoder(v);
8111
+ });
7741
8112
  }
7742
8113
  objKeys = [{
7743
8114
  value: obj.length > 0 ? obj.join(',') || null : void undefined
@@ -7858,6 +8229,9 @@ var contentful = (function (exports) {
7858
8229
  var sideChannel = getSideChannel();
7859
8230
  for (var i = 0; i < objKeys.length; ++i) {
7860
8231
  var key = objKeys[i];
8232
+ if (typeof key === 'undefined' || key === null) {
8233
+ continue;
8234
+ }
7861
8235
  var value = obj[key];
7862
8236
  if (options.skipNulls && value === null) {
7863
8237
  continue;
@@ -7869,10 +8243,10 @@ var contentful = (function (exports) {
7869
8243
  if (options.charsetSentinel) {
7870
8244
  if (options.charset === 'iso-8859-1') {
7871
8245
  // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
7872
- prefix += 'utf8=%26%2310003%3B&';
8246
+ prefix += 'utf8=%26%2310003%3B' + options.delimiter;
7873
8247
  } else {
7874
8248
  // encodeURIComponent('✓')
7875
- prefix += 'utf8=%E2%9C%93&';
8249
+ prefix += 'utf8=%E2%9C%93' + options.delimiter;
7876
8250
  }
7877
8251
  }
7878
8252
  return joined.length > 0 ? prefix + joined : '';
@@ -7937,8 +8311,8 @@ var contentful = (function (exports) {
7937
8311
  var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
7938
8312
  cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']');
7939
8313
  var limit = options.parameterLimit === Infinity ? void undefined : options.parameterLimit;
7940
- var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded ? limit + 1 : limit);
7941
- if (options.throwOnLimitExceeded && parts.length > limit) {
8314
+ var parts = cleanStr.split(options.delimiter, options.throwOnLimitExceeded && typeof limit !== 'undefined' ? limit + 1 : limit);
8315
+ if (options.throwOnLimitExceeded && typeof limit !== 'undefined' && parts.length > limit) {
7942
8316
  throw new RangeError('Parameter limit exceeded. Only ' + limit + ' parameter' + (limit === 1 ? '' : 's') + ' allowed.');
7943
8317
  }
7944
8318
  var skipIndex = -1; // Keep track of where the utf8 sentinel was found
@@ -8045,8 +8419,13 @@ var contentful = (function (exports) {
8045
8419
  }
8046
8420
  return leaf;
8047
8421
  };
8048
- var splitKeyIntoSegments = function splitKeyIntoSegments(givenKey, options) {
8049
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
8422
+
8423
+ // Split a key like "a[b][c[]]" into ['a', '[b]', '[c[]]'] while preserving
8424
+ // qs parse semantics for depth/prototype guards.
8425
+ var splitKeyIntoSegments = function splitKeyIntoSegments(originalKey, options) {
8426
+ var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, '[$1]') : originalKey;
8427
+
8428
+ // depth <= 0 keeps the whole key as one segment
8050
8429
  if (options.depth <= 0) {
8051
8430
  if (!options.plainObjects && has.call(Object.prototype, key)) {
8052
8431
  if (!options.allowPrototypes) {
@@ -8055,37 +8434,67 @@ var contentful = (function (exports) {
8055
8434
  }
8056
8435
  return [key];
8057
8436
  }
8058
- var brackets = /(\[[^[\]]*])/;
8059
- var child = /(\[[^[\]]*])/g;
8060
- var segment = brackets.exec(key);
8061
- var parent = segment ? key.slice(0, segment.index) : key;
8062
- var keys = [];
8437
+ var segments = [];
8438
+
8439
+ // parent before the first '[' (may be empty if key starts with '[')
8440
+ var first = key.indexOf('[');
8441
+ var parent = first >= 0 ? key.slice(0, first) : key;
8063
8442
  if (parent) {
8064
8443
  if (!options.plainObjects && has.call(Object.prototype, parent)) {
8065
8444
  if (!options.allowPrototypes) {
8066
8445
  return;
8067
8446
  }
8068
8447
  }
8069
- keys[keys.length] = parent;
8070
- }
8071
- var i = 0;
8072
- while ((segment = child.exec(key)) !== null && i < options.depth) {
8073
- i += 1;
8074
- var segmentContent = segment[1].slice(1, -1);
8075
- if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
8076
- if (!options.allowPrototypes) {
8077
- return;
8448
+ segments[segments.length] = parent;
8449
+ }
8450
+ var n = key.length;
8451
+ var open = first;
8452
+ var collected = 0;
8453
+ while (open >= 0 && collected < options.depth) {
8454
+ var level = 1;
8455
+ var i = open + 1;
8456
+ var close = -1;
8457
+
8458
+ // balance nested '[' and ']' inside this bracket group using a nesting level counter
8459
+ while (i < n && close < 0) {
8460
+ var cu = key.charCodeAt(i);
8461
+ if (cu === 0x5B) {
8462
+ // '['
8463
+ level += 1;
8464
+ } else if (cu === 0x5D) {
8465
+ // ']'
8466
+ level -= 1;
8467
+ if (level === 0) {
8468
+ close = i; // found matching close; loop will exit by condition
8469
+ }
8078
8470
  }
8471
+ i += 1;
8079
8472
  }
8080
- keys[keys.length] = segment[1];
8473
+ if (close < 0) {
8474
+ // Unterminated group: wrap the raw remainder in one bracket pair so it stays
8475
+ // a single literal segment (e.g. "[[]b" -> "[[]b]"); we do not infer missing ']'.
8476
+ segments[segments.length] = '[' + key.slice(open) + ']';
8477
+ return segments;
8478
+ }
8479
+ var seg = key.slice(open, close + 1);
8480
+ // prototype guard for the content of this group
8481
+ var content = seg.slice(1, -1);
8482
+ if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
8483
+ return;
8484
+ }
8485
+ segments[segments.length] = seg;
8486
+ collected += 1;
8487
+
8488
+ // find the next '[' after this balanced group
8489
+ open = key.indexOf('[', close + 1);
8081
8490
  }
8082
- if (segment) {
8491
+ if (open >= 0) {
8083
8492
  if (options.strictDepth === true) {
8084
8493
  throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true');
8085
8494
  }
8086
- keys[keys.length] = '[' + key.slice(segment.index) + ']';
8495
+ segments[segments.length] = '[' + key.slice(open) + ']';
8087
8496
  }
8088
- return keys;
8497
+ return segments;
8089
8498
  };
8090
8499
  var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
8091
8500
  if (!givenKey) {
@@ -9677,7 +10086,9 @@ var contentful = (function (exports) {
9677
10086
  return false;
9678
10087
  }
9679
10088
  var isValidConfig = isValidTimelinePreviewConfig(timelinePreview);
9680
- var isValidHost = typeof host === 'string' && host.startsWith('preview');
10089
+ // Show error if used outside of CPA.
10090
+ // Opt-out of the error if a custom domain is used and CPA could not be idenfified
10091
+ var isValidHost = typeof host === 'string' && (!host.includes('contentful') || host.startsWith('preview'));
9681
10092
  if (isValidConfig && !isValidHost) {
9682
10093
  throw new ValidationError('timelinePreview', "The 'timelinePreview' parameter can only be used with the CPA. Please set host to 'preview.contentful.com' or 'preview.eu.contentful.com' to enable Timeline Preview.\n ");
9683
10094
  }
@@ -10061,58 +10472,58 @@ var contentful = (function (exports) {
10061
10472
  return _internalGetEntry.apply(this, arguments);
10062
10473
  }
10063
10474
  function _internalGetEntry() {
10064
- _internalGetEntry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id, query, options) {
10475
+ _internalGetEntry = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(id, query, options) {
10065
10476
  var response;
10066
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
10067
- while (1) switch (_context10.prev = _context10.next) {
10477
+ return _regeneratorRuntime.wrap(function _callee0$(_context0) {
10478
+ while (1) switch (_context0.prev = _context0.next) {
10068
10479
  case 0:
10069
10480
  if (id) {
10070
- _context10.next = 2;
10481
+ _context0.next = 2;
10071
10482
  break;
10072
10483
  }
10073
10484
  throw notFoundError(id);
10074
10485
  case 2:
10075
- _context10.prev = 2;
10076
- _context10.next = 5;
10486
+ _context0.prev = 2;
10487
+ _context0.next = 5;
10077
10488
  return internalGetEntries(Object.assign({
10078
10489
  'sys.id': id
10079
10490
  }, maybeEnableSourceMaps(query)), options);
10080
10491
  case 5:
10081
- response = _context10.sent;
10492
+ response = _context0.sent;
10082
10493
  if (!(response.items.length > 0)) {
10083
- _context10.next = 10;
10494
+ _context0.next = 10;
10084
10495
  break;
10085
10496
  }
10086
- return _context10.abrupt("return", response.items[0]);
10497
+ return _context0.abrupt("return", response.items[0]);
10087
10498
  case 10:
10088
10499
  throw notFoundError(id);
10089
10500
  case 11:
10090
- _context10.next = 16;
10501
+ _context0.next = 16;
10091
10502
  break;
10092
10503
  case 13:
10093
- _context10.prev = 13;
10094
- _context10.t0 = _context10["catch"](2);
10095
- errorHandler(_context10.t0);
10504
+ _context0.prev = 13;
10505
+ _context0.t0 = _context0["catch"](2);
10506
+ errorHandler(_context0.t0);
10096
10507
  case 16:
10097
10508
  case "end":
10098
- return _context10.stop();
10509
+ return _context0.stop();
10099
10510
  }
10100
- }, _callee10, null, [[2, 13]]);
10511
+ }, _callee0, null, [[2, 13]]);
10101
10512
  }));
10102
10513
  return _internalGetEntry.apply(this, arguments);
10103
10514
  }
10104
- function makeGetEntries(_x10) {
10515
+ function makeGetEntries(_x0) {
10105
10516
  return _makeGetEntries.apply(this, arguments);
10106
10517
  }
10107
10518
  function _makeGetEntries() {
10108
- _makeGetEntries = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(query) {
10519
+ _makeGetEntries = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(query) {
10109
10520
  var options,
10110
10521
  withAllLocales,
10111
- _args11 = arguments;
10112
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
10113
- while (1) switch (_context11.prev = _context11.next) {
10522
+ _args1 = arguments;
10523
+ return _regeneratorRuntime.wrap(function _callee1$(_context1) {
10524
+ while (1) switch (_context1.prev = _context1.next) {
10114
10525
  case 0:
10115
- options = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {
10526
+ options = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : {
10116
10527
  withAllLocales: false,
10117
10528
  withoutLinkResolution: false,
10118
10529
  withoutUnresolvableLinks: false,
@@ -10123,14 +10534,14 @@ var contentful = (function (exports) {
10123
10534
  validateResolveLinksParam(query);
10124
10535
  validateRemoveUnresolvedParam(query);
10125
10536
  validateSearchParameters(query);
10126
- return _context11.abrupt("return", internalGetEntries(withAllLocales ? Object.assign(Object.assign({}, query), {
10537
+ return _context1.abrupt("return", internalGetEntries(withAllLocales ? Object.assign(Object.assign({}, query), {
10127
10538
  locale: '*'
10128
10539
  }) : query, options));
10129
10540
  case 7:
10130
10541
  case "end":
10131
- return _context11.stop();
10542
+ return _context1.stop();
10132
10543
  }
10133
- }, _callee11);
10544
+ }, _callee1);
10134
10545
  }));
10135
10546
  return _makeGetEntries.apply(this, arguments);
10136
10547
  }
@@ -10140,17 +10551,17 @@ var contentful = (function (exports) {
10140
10551
  // Then, apply source maps and other normalizations
10141
10552
  return maybeEnableSourceMaps(normalizeSearchParameters(normalizeSelect(withTimelinePreview)));
10142
10553
  }
10143
- function internalGetEntries(_x11, _x12) {
10554
+ function internalGetEntries(_x1, _x10) {
10144
10555
  return _internalGetEntries.apply(this, arguments);
10145
10556
  }
10146
10557
  function _internalGetEntries() {
10147
- _internalGetEntries = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(query, options) {
10558
+ _internalGetEntries = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(query, options) {
10148
10559
  var withoutLinkResolution, withoutUnresolvableLinks, withLocaleBasedPublishing, baseConfig, config, entries;
10149
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
10150
- while (1) switch (_context12.prev = _context12.next) {
10560
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
10561
+ while (1) switch (_context10.prev = _context10.next) {
10151
10562
  case 0:
10152
10563
  withoutLinkResolution = options.withoutLinkResolution, withoutUnresolvableLinks = options.withoutUnresolvableLinks, withLocaleBasedPublishing = options.withLocaleBasedPublishing;
10153
- _context12.prev = 1;
10564
+ _context10.prev = 1;
10154
10565
  baseConfig = createRequestConfig({
10155
10566
  query: prepareQuery(query)
10156
10567
  });
@@ -10160,47 +10571,47 @@ var contentful = (function (exports) {
10160
10571
  'X-Contentful-Locale-Based-Publishing': true
10161
10572
  });
10162
10573
  }
10163
- _context12.next = 7;
10574
+ _context10.next = 7;
10164
10575
  return get({
10165
10576
  context: 'environment',
10166
10577
  path: maybeEnableTimelinePreview('entries'),
10167
10578
  config: config
10168
10579
  });
10169
10580
  case 7:
10170
- entries = _context12.sent;
10171
- return _context12.abrupt("return", resolveCircular(entries, {
10581
+ entries = _context10.sent;
10582
+ return _context10.abrupt("return", resolveCircular(entries, {
10172
10583
  resolveLinks: !withoutLinkResolution,
10173
10584
  removeUnresolved: withoutUnresolvableLinks !== null && withoutUnresolvableLinks !== void 0 ? withoutUnresolvableLinks : false
10174
10585
  }));
10175
10586
  case 11:
10176
- _context12.prev = 11;
10177
- _context12.t0 = _context12["catch"](1);
10178
- errorHandler(_context12.t0);
10587
+ _context10.prev = 11;
10588
+ _context10.t0 = _context10["catch"](1);
10589
+ errorHandler(_context10.t0);
10179
10590
  case 14:
10180
10591
  case "end":
10181
- return _context12.stop();
10592
+ return _context10.stop();
10182
10593
  }
10183
- }, _callee12, null, [[1, 11]]);
10594
+ }, _callee10, null, [[1, 11]]);
10184
10595
  }));
10185
10596
  return _internalGetEntries.apply(this, arguments);
10186
10597
  }
10187
- function getAsset(_x13) {
10598
+ function getAsset(_x11) {
10188
10599
  return _getAsset.apply(this, arguments);
10189
10600
  }
10190
10601
  function _getAsset() {
10191
- _getAsset = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id) {
10602
+ _getAsset = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(id) {
10192
10603
  var query,
10193
- _args13 = arguments;
10194
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
10195
- while (1) switch (_context13.prev = _context13.next) {
10604
+ _args11 = arguments;
10605
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
10606
+ while (1) switch (_context11.prev = _context11.next) {
10196
10607
  case 0:
10197
- query = _args13.length > 1 && _args13[1] !== undefined ? _args13[1] : {};
10198
- return _context13.abrupt("return", makeGetAsset(id, query, options));
10608
+ query = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
10609
+ return _context11.abrupt("return", makeGetAsset(id, query, options));
10199
10610
  case 2:
10200
10611
  case "end":
10201
- return _context13.stop();
10612
+ return _context11.stop();
10202
10613
  }
10203
- }, _callee13);
10614
+ }, _callee11);
10204
10615
  }));
10205
10616
  return _getAsset.apply(this, arguments);
10206
10617
  }
@@ -10208,19 +10619,19 @@ var contentful = (function (exports) {
10208
10619
  return _getAssets.apply(this, arguments);
10209
10620
  }
10210
10621
  function _getAssets() {
10211
- _getAssets = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14() {
10622
+ _getAssets = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
10212
10623
  var query,
10213
- _args14 = arguments;
10214
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
10215
- while (1) switch (_context14.prev = _context14.next) {
10624
+ _args12 = arguments;
10625
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
10626
+ while (1) switch (_context12.prev = _context12.next) {
10216
10627
  case 0:
10217
- query = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
10218
- return _context14.abrupt("return", makeGetAssets(query, options));
10628
+ query = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
10629
+ return _context12.abrupt("return", makeGetAssets(query, options));
10219
10630
  case 2:
10220
10631
  case "end":
10221
- return _context14.stop();
10632
+ return _context12.stop();
10222
10633
  }
10223
- }, _callee14);
10634
+ }, _callee12);
10224
10635
  }));
10225
10636
  return _getAssets.apply(this, arguments);
10226
10637
  }
@@ -10228,40 +10639,40 @@ var contentful = (function (exports) {
10228
10639
  return _getAssetsWithCursor.apply(this, arguments);
10229
10640
  }
10230
10641
  function _getAssetsWithCursor() {
10231
- _getAssetsWithCursor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15() {
10642
+ _getAssetsWithCursor = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
10232
10643
  var query,
10233
10644
  response,
10234
- _args15 = arguments;
10235
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
10236
- while (1) switch (_context15.prev = _context15.next) {
10645
+ _args13 = arguments;
10646
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
10647
+ while (1) switch (_context13.prev = _context13.next) {
10237
10648
  case 0:
10238
- query = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
10239
- _context15.next = 3;
10649
+ query = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
10650
+ _context13.next = 3;
10240
10651
  return makeGetAssets(normalizeCursorPaginationParameters(query), options);
10241
10652
  case 3:
10242
- response = _context15.sent;
10243
- return _context15.abrupt("return", normalizeCursorPaginationResponse(response));
10653
+ response = _context13.sent;
10654
+ return _context13.abrupt("return", normalizeCursorPaginationResponse(response));
10244
10655
  case 5:
10245
10656
  case "end":
10246
- return _context15.stop();
10657
+ return _context13.stop();
10247
10658
  }
10248
- }, _callee15);
10659
+ }, _callee13);
10249
10660
  }));
10250
10661
  return _getAssetsWithCursor.apply(this, arguments);
10251
10662
  }
10252
- function makeGetAssets(_x14) {
10663
+ function makeGetAssets(_x12) {
10253
10664
  return _makeGetAssets.apply(this, arguments);
10254
10665
  }
10255
10666
  function _makeGetAssets() {
10256
- _makeGetAssets = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(query) {
10667
+ _makeGetAssets = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(query) {
10257
10668
  var options,
10258
10669
  withAllLocales,
10259
10670
  localeSpecificQuery,
10260
- _args16 = arguments;
10261
- return _regeneratorRuntime.wrap(function _callee16$(_context16) {
10262
- while (1) switch (_context16.prev = _context16.next) {
10671
+ _args14 = arguments;
10672
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
10673
+ while (1) switch (_context14.prev = _context14.next) {
10263
10674
  case 0:
10264
- options = _args16.length > 1 && _args16[1] !== undefined ? _args16[1] : {
10675
+ options = _args14.length > 1 && _args14[1] !== undefined ? _args14[1] : {
10265
10676
  withAllLocales: false,
10266
10677
  withoutLinkResolution: false,
10267
10678
  withoutUnresolvableLinks: false,
@@ -10273,26 +10684,26 @@ var contentful = (function (exports) {
10273
10684
  localeSpecificQuery = withAllLocales ? Object.assign(Object.assign({}, query), {
10274
10685
  locale: '*'
10275
10686
  }) : query;
10276
- return _context16.abrupt("return", internalGetAssets(localeSpecificQuery, options));
10687
+ return _context14.abrupt("return", internalGetAssets(localeSpecificQuery, options));
10277
10688
  case 6:
10278
10689
  case "end":
10279
- return _context16.stop();
10690
+ return _context14.stop();
10280
10691
  }
10281
- }, _callee16);
10692
+ }, _callee14);
10282
10693
  }));
10283
10694
  return _makeGetAssets.apply(this, arguments);
10284
10695
  }
10285
- function internalGetAsset(_x15, _x16, _x17) {
10696
+ function internalGetAsset(_x13, _x14, _x15) {
10286
10697
  return _internalGetAsset.apply(this, arguments);
10287
10698
  }
10288
10699
  function _internalGetAsset() {
10289
- _internalGetAsset = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(id, query, options) {
10700
+ _internalGetAsset = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(id, query, options) {
10290
10701
  var withLocaleBasedPublishing, baseConfig, config;
10291
- return _regeneratorRuntime.wrap(function _callee17$(_context17) {
10292
- while (1) switch (_context17.prev = _context17.next) {
10702
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
10703
+ while (1) switch (_context15.prev = _context15.next) {
10293
10704
  case 0:
10294
10705
  withLocaleBasedPublishing = options.withLocaleBasedPublishing;
10295
- _context17.prev = 1;
10706
+ _context15.prev = 1;
10296
10707
  baseConfig = createRequestConfig({
10297
10708
  query: prepareQuery(query)
10298
10709
  });
@@ -10302,36 +10713,36 @@ var contentful = (function (exports) {
10302
10713
  'X-Contentful-Locale-Based-Publishing': true
10303
10714
  });
10304
10715
  }
10305
- return _context17.abrupt("return", get({
10716
+ return _context15.abrupt("return", get({
10306
10717
  context: 'environment',
10307
10718
  path: maybeEnableTimelinePreview("assets/".concat(id)),
10308
10719
  config: config
10309
10720
  }));
10310
10721
  case 8:
10311
- _context17.prev = 8;
10312
- _context17.t0 = _context17["catch"](1);
10313
- errorHandler(_context17.t0);
10722
+ _context15.prev = 8;
10723
+ _context15.t0 = _context15["catch"](1);
10724
+ errorHandler(_context15.t0);
10314
10725
  case 11:
10315
10726
  case "end":
10316
- return _context17.stop();
10727
+ return _context15.stop();
10317
10728
  }
10318
- }, _callee17, null, [[1, 8]]);
10729
+ }, _callee15, null, [[1, 8]]);
10319
10730
  }));
10320
10731
  return _internalGetAsset.apply(this, arguments);
10321
10732
  }
10322
- function makeGetAsset(_x18, _x19) {
10733
+ function makeGetAsset(_x16, _x17) {
10323
10734
  return _makeGetAsset.apply(this, arguments);
10324
10735
  }
10325
10736
  function _makeGetAsset() {
10326
- _makeGetAsset = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(id, query) {
10737
+ _makeGetAsset = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(id, query) {
10327
10738
  var options,
10328
10739
  withAllLocales,
10329
10740
  localeSpecificQuery,
10330
- _args18 = arguments;
10331
- return _regeneratorRuntime.wrap(function _callee18$(_context18) {
10332
- while (1) switch (_context18.prev = _context18.next) {
10741
+ _args16 = arguments;
10742
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
10743
+ while (1) switch (_context16.prev = _context16.next) {
10333
10744
  case 0:
10334
- options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {
10745
+ options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {
10335
10746
  withAllLocales: false,
10336
10747
  withoutLinkResolution: false,
10337
10748
  withoutUnresolvableLinks: false,
@@ -10343,26 +10754,26 @@ var contentful = (function (exports) {
10343
10754
  localeSpecificQuery = withAllLocales ? Object.assign(Object.assign({}, query), {
10344
10755
  locale: '*'
10345
10756
  }) : query;
10346
- return _context18.abrupt("return", internalGetAsset(id, localeSpecificQuery, options));
10757
+ return _context16.abrupt("return", internalGetAsset(id, localeSpecificQuery, options));
10347
10758
  case 6:
10348
10759
  case "end":
10349
- return _context18.stop();
10760
+ return _context16.stop();
10350
10761
  }
10351
- }, _callee18);
10762
+ }, _callee16);
10352
10763
  }));
10353
10764
  return _makeGetAsset.apply(this, arguments);
10354
10765
  }
10355
- function internalGetAssets(_x20, _x21) {
10766
+ function internalGetAssets(_x18, _x19) {
10356
10767
  return _internalGetAssets.apply(this, arguments);
10357
10768
  }
10358
10769
  function _internalGetAssets() {
10359
- _internalGetAssets = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19(query, options) {
10770
+ _internalGetAssets = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(query, options) {
10360
10771
  var withLocaleBasedPublishing, baseConfig, config;
10361
- return _regeneratorRuntime.wrap(function _callee19$(_context19) {
10362
- while (1) switch (_context19.prev = _context19.next) {
10772
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
10773
+ while (1) switch (_context17.prev = _context17.next) {
10363
10774
  case 0:
10364
10775
  withLocaleBasedPublishing = options.withLocaleBasedPublishing;
10365
- _context19.prev = 1;
10776
+ _context17.prev = 1;
10366
10777
  baseConfig = createRequestConfig({
10367
10778
  query: prepareQuery(query)
10368
10779
  });
@@ -10372,40 +10783,40 @@ var contentful = (function (exports) {
10372
10783
  'X-Contentful-Locale-Based-Publishing': true
10373
10784
  });
10374
10785
  }
10375
- return _context19.abrupt("return", get({
10786
+ return _context17.abrupt("return", get({
10376
10787
  context: 'environment',
10377
10788
  path: maybeEnableTimelinePreview('assets'),
10378
10789
  config: config
10379
10790
  }));
10380
10791
  case 8:
10381
- _context19.prev = 8;
10382
- _context19.t0 = _context19["catch"](1);
10383
- errorHandler(_context19.t0);
10792
+ _context17.prev = 8;
10793
+ _context17.t0 = _context17["catch"](1);
10794
+ errorHandler(_context17.t0);
10384
10795
  case 11:
10385
10796
  case "end":
10386
- return _context19.stop();
10797
+ return _context17.stop();
10387
10798
  }
10388
- }, _callee19, null, [[1, 8]]);
10799
+ }, _callee17, null, [[1, 8]]);
10389
10800
  }));
10390
10801
  return _internalGetAssets.apply(this, arguments);
10391
10802
  }
10392
- function getTag(_x22) {
10803
+ function getTag(_x20) {
10393
10804
  return _getTag.apply(this, arguments);
10394
10805
  }
10395
10806
  function _getTag() {
10396
- _getTag = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee20(id) {
10397
- return _regeneratorRuntime.wrap(function _callee20$(_context20) {
10398
- while (1) switch (_context20.prev = _context20.next) {
10807
+ _getTag = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee18(id) {
10808
+ return _regeneratorRuntime.wrap(function _callee18$(_context18) {
10809
+ while (1) switch (_context18.prev = _context18.next) {
10399
10810
  case 0:
10400
- return _context20.abrupt("return", get({
10811
+ return _context18.abrupt("return", get({
10401
10812
  context: 'environment',
10402
10813
  path: "tags/".concat(id)
10403
10814
  }));
10404
10815
  case 1:
10405
10816
  case "end":
10406
- return _context20.stop();
10817
+ return _context18.stop();
10407
10818
  }
10408
- }, _callee20);
10819
+ }, _callee18);
10409
10820
  }));
10410
10821
  return _getTag.apply(this, arguments);
10411
10822
  }
@@ -10413,15 +10824,15 @@ var contentful = (function (exports) {
10413
10824
  return _getTags.apply(this, arguments);
10414
10825
  }
10415
10826
  function _getTags() {
10416
- _getTags = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
10827
+ _getTags = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee19() {
10417
10828
  var query,
10418
- _args21 = arguments;
10419
- return _regeneratorRuntime.wrap(function _callee21$(_context21) {
10420
- while (1) switch (_context21.prev = _context21.next) {
10829
+ _args19 = arguments;
10830
+ return _regeneratorRuntime.wrap(function _callee19$(_context19) {
10831
+ while (1) switch (_context19.prev = _context19.next) {
10421
10832
  case 0:
10422
- query = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
10833
+ query = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
10423
10834
  validateSearchParameters(query);
10424
- return _context21.abrupt("return", get({
10835
+ return _context19.abrupt("return", get({
10425
10836
  context: 'environment',
10426
10837
  path: 'tags',
10427
10838
  config: createRequestConfig({
@@ -10430,20 +10841,20 @@ var contentful = (function (exports) {
10430
10841
  }));
10431
10842
  case 3:
10432
10843
  case "end":
10433
- return _context21.stop();
10844
+ return _context19.stop();
10434
10845
  }
10435
- }, _callee21);
10846
+ }, _callee19);
10436
10847
  }));
10437
10848
  return _getTags.apply(this, arguments);
10438
10849
  }
10439
- function createAssetKey(_x23) {
10850
+ function createAssetKey(_x21) {
10440
10851
  return _createAssetKey.apply(this, arguments);
10441
10852
  }
10442
10853
  function _createAssetKey() {
10443
- _createAssetKey = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee22(expiresAt) {
10854
+ _createAssetKey = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee20(expiresAt) {
10444
10855
  var now, currentMaxLifetime;
10445
- return _regeneratorRuntime.wrap(function _callee22$(_context22) {
10446
- while (1) switch (_context22.prev = _context22.next) {
10856
+ return _regeneratorRuntime.wrap(function _callee20$(_context20) {
10857
+ while (1) switch (_context20.prev = _context20.next) {
10447
10858
  case 0:
10448
10859
  try {
10449
10860
  now = Math.floor(Date.now() / 1000);
@@ -10455,7 +10866,7 @@ var contentful = (function (exports) {
10455
10866
  } catch (error) {
10456
10867
  errorHandler(error);
10457
10868
  }
10458
- return _context22.abrupt("return", post({
10869
+ return _context20.abrupt("return", post({
10459
10870
  context: 'environment',
10460
10871
  path: 'asset_keys',
10461
10872
  data: {
@@ -10464,9 +10875,9 @@ var contentful = (function (exports) {
10464
10875
  }));
10465
10876
  case 2:
10466
10877
  case "end":
10467
- return _context22.stop();
10878
+ return _context20.stop();
10468
10879
  }
10469
- }, _callee22);
10880
+ }, _callee20);
10470
10881
  }));
10471
10882
  return _createAssetKey.apply(this, arguments);
10472
10883
  }
@@ -10474,15 +10885,15 @@ var contentful = (function (exports) {
10474
10885
  return _getLocales.apply(this, arguments);
10475
10886
  }
10476
10887
  function _getLocales() {
10477
- _getLocales = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee23() {
10888
+ _getLocales = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee21() {
10478
10889
  var query,
10479
- _args23 = arguments;
10480
- return _regeneratorRuntime.wrap(function _callee23$(_context23) {
10481
- while (1) switch (_context23.prev = _context23.next) {
10890
+ _args21 = arguments;
10891
+ return _regeneratorRuntime.wrap(function _callee21$(_context21) {
10892
+ while (1) switch (_context21.prev = _context21.next) {
10482
10893
  case 0:
10483
- query = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
10894
+ query = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
10484
10895
  validateSearchParameters(query);
10485
- return _context23.abrupt("return", get({
10896
+ return _context21.abrupt("return", get({
10486
10897
  context: 'environment',
10487
10898
  path: 'locales',
10488
10899
  config: createRequestConfig({
@@ -10491,46 +10902,46 @@ var contentful = (function (exports) {
10491
10902
  }));
10492
10903
  case 3:
10493
10904
  case "end":
10494
- return _context23.stop();
10905
+ return _context21.stop();
10495
10906
  }
10496
- }, _callee23);
10907
+ }, _callee21);
10497
10908
  }));
10498
10909
  return _getLocales.apply(this, arguments);
10499
10910
  }
10500
- function sync(_x24) {
10911
+ function sync(_x22) {
10501
10912
  return _sync.apply(this, arguments);
10502
10913
  }
10503
10914
  function _sync() {
10504
- _sync = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee24(query) {
10915
+ _sync = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee22(query) {
10505
10916
  var syncOptions,
10506
- _args24 = arguments;
10507
- return _regeneratorRuntime.wrap(function _callee24$(_context24) {
10508
- while (1) switch (_context24.prev = _context24.next) {
10917
+ _args22 = arguments;
10918
+ return _regeneratorRuntime.wrap(function _callee22$(_context22) {
10919
+ while (1) switch (_context22.prev = _context22.next) {
10509
10920
  case 0:
10510
- syncOptions = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {
10921
+ syncOptions = _args22.length > 1 && _args22[1] !== undefined ? _args22[1] : {
10511
10922
  paginate: true
10512
10923
  };
10513
- return _context24.abrupt("return", makePagedSync(query, syncOptions, options));
10924
+ return _context22.abrupt("return", makePagedSync(query, syncOptions, options));
10514
10925
  case 2:
10515
10926
  case "end":
10516
- return _context24.stop();
10927
+ return _context22.stop();
10517
10928
  }
10518
- }, _callee24);
10929
+ }, _callee22);
10519
10930
  }));
10520
10931
  return _sync.apply(this, arguments);
10521
10932
  }
10522
- function makePagedSync(_x25, _x26) {
10933
+ function makePagedSync(_x23, _x24) {
10523
10934
  return _makePagedSync.apply(this, arguments);
10524
10935
  }
10525
10936
  function _makePagedSync() {
10526
- _makePagedSync = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee25(query, syncOptions) {
10937
+ _makePagedSync = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee23(query, syncOptions) {
10527
10938
  var options,
10528
10939
  combinedOptions,
10529
- _args25 = arguments;
10530
- return _regeneratorRuntime.wrap(function _callee25$(_context25) {
10531
- while (1) switch (_context25.prev = _context25.next) {
10940
+ _args23 = arguments;
10941
+ return _regeneratorRuntime.wrap(function _callee23$(_context23) {
10942
+ while (1) switch (_context23.prev = _context23.next) {
10532
10943
  case 0:
10533
- options = _args25.length > 2 && _args25[2] !== undefined ? _args25[2] : {
10944
+ options = _args23.length > 2 && _args23[2] !== undefined ? _args23[2] : {
10534
10945
  withAllLocales: false,
10535
10946
  withoutLinkResolution: false,
10536
10947
  withoutUnresolvableLinks: false,
@@ -10540,12 +10951,12 @@ var contentful = (function (exports) {
10540
10951
  validateRemoveUnresolvedParam(query);
10541
10952
  combinedOptions = Object.assign(Object.assign({}, syncOptions), options);
10542
10953
  switchToEnvironment(http);
10543
- return _context25.abrupt("return", pagedSync(http, query, combinedOptions));
10954
+ return _context23.abrupt("return", pagedSync(http, query, combinedOptions));
10544
10955
  case 6:
10545
10956
  case "end":
10546
- return _context25.stop();
10957
+ return _context23.stop();
10547
10958
  }
10548
- }, _callee25);
10959
+ }, _callee23);
10549
10960
  }));
10550
10961
  return _makePagedSync.apply(this, arguments);
10551
10962
  }
@@ -10570,19 +10981,19 @@ var contentful = (function (exports) {
10570
10981
  var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10571
10982
  return internalGetConceptScheme(id, query);
10572
10983
  }
10573
- function internalGetConceptScheme(_x27) {
10984
+ function internalGetConceptScheme(_x25) {
10574
10985
  return _internalGetConceptScheme.apply(this, arguments);
10575
10986
  }
10576
10987
  function _internalGetConceptScheme() {
10577
- _internalGetConceptScheme = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee26(id) {
10988
+ _internalGetConceptScheme = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee24(id) {
10578
10989
  var query,
10579
- _args26 = arguments;
10580
- return _regeneratorRuntime.wrap(function _callee26$(_context26) {
10581
- while (1) switch (_context26.prev = _context26.next) {
10990
+ _args24 = arguments;
10991
+ return _regeneratorRuntime.wrap(function _callee24$(_context24) {
10992
+ while (1) switch (_context24.prev = _context24.next) {
10582
10993
  case 0:
10583
- query = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : {};
10584
- _context26.prev = 1;
10585
- return _context26.abrupt("return", get({
10994
+ query = _args24.length > 1 && _args24[1] !== undefined ? _args24[1] : {};
10995
+ _context24.prev = 1;
10996
+ return _context24.abrupt("return", get({
10586
10997
  context: 'environment',
10587
10998
  path: "taxonomy/concept-schemes/".concat(id),
10588
10999
  config: createRequestConfig({
@@ -10590,14 +11001,14 @@ var contentful = (function (exports) {
10590
11001
  })
10591
11002
  }));
10592
11003
  case 5:
10593
- _context26.prev = 5;
10594
- _context26.t0 = _context26["catch"](1);
10595
- errorHandler(_context26.t0);
11004
+ _context24.prev = 5;
11005
+ _context24.t0 = _context24["catch"](1);
11006
+ errorHandler(_context24.t0);
10596
11007
  case 8:
10597
11008
  case "end":
10598
- return _context26.stop();
11009
+ return _context24.stop();
10599
11010
  }
10600
- }, _callee26, null, [[1, 5]]);
11011
+ }, _callee24, null, [[1, 5]]);
10601
11012
  }));
10602
11013
  return _internalGetConceptScheme.apply(this, arguments);
10603
11014
  }
@@ -10609,15 +11020,15 @@ var contentful = (function (exports) {
10609
11020
  return _internalGetConceptSchemes.apply(this, arguments);
10610
11021
  }
10611
11022
  function _internalGetConceptSchemes() {
10612
- _internalGetConceptSchemes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
11023
+ _internalGetConceptSchemes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee25() {
10613
11024
  var query,
10614
- _args27 = arguments;
10615
- return _regeneratorRuntime.wrap(function _callee27$(_context27) {
10616
- while (1) switch (_context27.prev = _context27.next) {
11025
+ _args25 = arguments;
11026
+ return _regeneratorRuntime.wrap(function _callee25$(_context25) {
11027
+ while (1) switch (_context25.prev = _context25.next) {
10617
11028
  case 0:
10618
- query = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {};
10619
- _context27.prev = 1;
10620
- return _context27.abrupt("return", get({
11029
+ query = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
11030
+ _context25.prev = 1;
11031
+ return _context25.abrupt("return", get({
10621
11032
  context: 'environment',
10622
11033
  path: 'taxonomy/concept-schemes',
10623
11034
  config: createRequestConfig({
@@ -10625,14 +11036,14 @@ var contentful = (function (exports) {
10625
11036
  })
10626
11037
  }));
10627
11038
  case 5:
10628
- _context27.prev = 5;
10629
- _context27.t0 = _context27["catch"](1);
10630
- errorHandler(_context27.t0);
11039
+ _context25.prev = 5;
11040
+ _context25.t0 = _context25["catch"](1);
11041
+ errorHandler(_context25.t0);
10631
11042
  case 8:
10632
11043
  case "end":
10633
- return _context27.stop();
11044
+ return _context25.stop();
10634
11045
  }
10635
- }, _callee27, null, [[1, 5]]);
11046
+ }, _callee25, null, [[1, 5]]);
10636
11047
  }));
10637
11048
  return _internalGetConceptSchemes.apply(this, arguments);
10638
11049
  }
@@ -10640,19 +11051,19 @@ var contentful = (function (exports) {
10640
11051
  var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10641
11052
  return internalGetConcept(id, query);
10642
11053
  }
10643
- function internalGetConcept(_x28) {
11054
+ function internalGetConcept(_x26) {
10644
11055
  return _internalGetConcept.apply(this, arguments);
10645
11056
  }
10646
11057
  function _internalGetConcept() {
10647
- _internalGetConcept = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee28(id) {
11058
+ _internalGetConcept = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee26(id) {
10648
11059
  var query,
10649
- _args28 = arguments;
10650
- return _regeneratorRuntime.wrap(function _callee28$(_context28) {
10651
- while (1) switch (_context28.prev = _context28.next) {
11060
+ _args26 = arguments;
11061
+ return _regeneratorRuntime.wrap(function _callee26$(_context26) {
11062
+ while (1) switch (_context26.prev = _context26.next) {
10652
11063
  case 0:
10653
- query = _args28.length > 1 && _args28[1] !== undefined ? _args28[1] : {};
10654
- _context28.prev = 1;
10655
- return _context28.abrupt("return", get({
11064
+ query = _args26.length > 1 && _args26[1] !== undefined ? _args26[1] : {};
11065
+ _context26.prev = 1;
11066
+ return _context26.abrupt("return", get({
10656
11067
  context: 'environment',
10657
11068
  path: "taxonomy/concepts/".concat(id),
10658
11069
  config: createRequestConfig({
@@ -10660,14 +11071,14 @@ var contentful = (function (exports) {
10660
11071
  })
10661
11072
  }));
10662
11073
  case 5:
10663
- _context28.prev = 5;
10664
- _context28.t0 = _context28["catch"](1);
10665
- errorHandler(_context28.t0);
11074
+ _context26.prev = 5;
11075
+ _context26.t0 = _context26["catch"](1);
11076
+ errorHandler(_context26.t0);
10666
11077
  case 8:
10667
11078
  case "end":
10668
- return _context28.stop();
11079
+ return _context26.stop();
10669
11080
  }
10670
- }, _callee28, null, [[1, 5]]);
11081
+ }, _callee26, null, [[1, 5]]);
10671
11082
  }));
10672
11083
  return _internalGetConcept.apply(this, arguments);
10673
11084
  }
@@ -10679,15 +11090,15 @@ var contentful = (function (exports) {
10679
11090
  return _internalGetConcepts.apply(this, arguments);
10680
11091
  }
10681
11092
  function _internalGetConcepts() {
10682
- _internalGetConcepts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee29() {
11093
+ _internalGetConcepts = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee27() {
10683
11094
  var query,
10684
- _args29 = arguments;
10685
- return _regeneratorRuntime.wrap(function _callee29$(_context29) {
10686
- while (1) switch (_context29.prev = _context29.next) {
11095
+ _args27 = arguments;
11096
+ return _regeneratorRuntime.wrap(function _callee27$(_context27) {
11097
+ while (1) switch (_context27.prev = _context27.next) {
10687
11098
  case 0:
10688
- query = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
10689
- _context29.prev = 1;
10690
- return _context29.abrupt("return", get({
11099
+ query = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {};
11100
+ _context27.prev = 1;
11101
+ return _context27.abrupt("return", get({
10691
11102
  context: 'environment',
10692
11103
  path: 'taxonomy/concepts',
10693
11104
  config: createRequestConfig({
@@ -10695,14 +11106,14 @@ var contentful = (function (exports) {
10695
11106
  })
10696
11107
  }));
10697
11108
  case 5:
10698
- _context29.prev = 5;
10699
- _context29.t0 = _context29["catch"](1);
10700
- errorHandler(_context29.t0);
11109
+ _context27.prev = 5;
11110
+ _context27.t0 = _context27["catch"](1);
11111
+ errorHandler(_context27.t0);
10701
11112
  case 8:
10702
11113
  case "end":
10703
- return _context29.stop();
11114
+ return _context27.stop();
10704
11115
  }
10705
- }, _callee29, null, [[1, 5]]);
11116
+ }, _callee27, null, [[1, 5]]);
10706
11117
  }));
10707
11118
  return _internalGetConcepts.apply(this, arguments);
10708
11119
  }
@@ -10710,19 +11121,19 @@ var contentful = (function (exports) {
10710
11121
  var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10711
11122
  return internalGetConceptAncestors(id, query);
10712
11123
  }
10713
- function internalGetConceptAncestors(_x29) {
11124
+ function internalGetConceptAncestors(_x27) {
10714
11125
  return _internalGetConceptAncestors.apply(this, arguments);
10715
11126
  }
10716
11127
  function _internalGetConceptAncestors() {
10717
- _internalGetConceptAncestors = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee30(id) {
11128
+ _internalGetConceptAncestors = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee28(id) {
10718
11129
  var query,
10719
- _args30 = arguments;
10720
- return _regeneratorRuntime.wrap(function _callee30$(_context30) {
10721
- while (1) switch (_context30.prev = _context30.next) {
11130
+ _args28 = arguments;
11131
+ return _regeneratorRuntime.wrap(function _callee28$(_context28) {
11132
+ while (1) switch (_context28.prev = _context28.next) {
10722
11133
  case 0:
10723
- query = _args30.length > 1 && _args30[1] !== undefined ? _args30[1] : {};
10724
- _context30.prev = 1;
10725
- return _context30.abrupt("return", get({
11134
+ query = _args28.length > 1 && _args28[1] !== undefined ? _args28[1] : {};
11135
+ _context28.prev = 1;
11136
+ return _context28.abrupt("return", get({
10726
11137
  context: 'environment',
10727
11138
  path: "taxonomy/concepts/".concat(id, "/ancestors"),
10728
11139
  config: createRequestConfig({
@@ -10730,14 +11141,14 @@ var contentful = (function (exports) {
10730
11141
  })
10731
11142
  }));
10732
11143
  case 5:
10733
- _context30.prev = 5;
10734
- _context30.t0 = _context30["catch"](1);
10735
- errorHandler(_context30.t0);
11144
+ _context28.prev = 5;
11145
+ _context28.t0 = _context28["catch"](1);
11146
+ errorHandler(_context28.t0);
10736
11147
  case 8:
10737
11148
  case "end":
10738
- return _context30.stop();
11149
+ return _context28.stop();
10739
11150
  }
10740
- }, _callee30, null, [[1, 5]]);
11151
+ }, _callee28, null, [[1, 5]]);
10741
11152
  }));
10742
11153
  return _internalGetConceptAncestors.apply(this, arguments);
10743
11154
  }
@@ -10745,22 +11156,22 @@ var contentful = (function (exports) {
10745
11156
  var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
10746
11157
  return internalGetConceptDescendants(id, query);
10747
11158
  }
10748
- function internalGetConceptDescendants(_x30) {
11159
+ function internalGetConceptDescendants(_x28) {
10749
11160
  return _internalGetConceptDescendants.apply(this, arguments);
10750
11161
  }
10751
11162
  /*
10752
11163
  * Switches BaseURL to use /environments path
10753
11164
  * */
10754
11165
  function _internalGetConceptDescendants() {
10755
- _internalGetConceptDescendants = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee31(id) {
11166
+ _internalGetConceptDescendants = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee29(id) {
10756
11167
  var query,
10757
- _args31 = arguments;
10758
- return _regeneratorRuntime.wrap(function _callee31$(_context31) {
10759
- while (1) switch (_context31.prev = _context31.next) {
11168
+ _args29 = arguments;
11169
+ return _regeneratorRuntime.wrap(function _callee29$(_context29) {
11170
+ while (1) switch (_context29.prev = _context29.next) {
10760
11171
  case 0:
10761
- query = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : {};
10762
- _context31.prev = 1;
10763
- return _context31.abrupt("return", get({
11172
+ query = _args29.length > 1 && _args29[1] !== undefined ? _args29[1] : {};
11173
+ _context29.prev = 1;
11174
+ return _context29.abrupt("return", get({
10764
11175
  context: 'environment',
10765
11176
  path: "taxonomy/concepts/".concat(id, "/descendants"),
10766
11177
  config: createRequestConfig({
@@ -10768,14 +11179,14 @@ var contentful = (function (exports) {
10768
11179
  })
10769
11180
  }));
10770
11181
  case 5:
10771
- _context31.prev = 5;
10772
- _context31.t0 = _context31["catch"](1);
10773
- errorHandler(_context31.t0);
11182
+ _context29.prev = 5;
11183
+ _context29.t0 = _context29["catch"](1);
11184
+ errorHandler(_context29.t0);
10774
11185
  case 8:
10775
11186
  case "end":
10776
- return _context31.stop();
11187
+ return _context29.stop();
10777
11188
  }
10778
- }, _callee31, null, [[1, 5]]);
11189
+ }, _callee29, null, [[1, 5]]);
10779
11190
  }));
10780
11191
  return _internalGetConceptDescendants.apply(this, arguments);
10781
11192
  }