contentful 9.2.8 → 9.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contentful.browser.js +39 -563
- package/dist/contentful.browser.js.map +1 -1
- package/dist/contentful.browser.min.js +3 -3
- package/dist/contentful.node.js +39 -557
- package/dist/contentful.node.js.map +1 -1
- package/dist/contentful.node.min.js +3 -3
- package/dist/es-modules/contentful.js +1 -1
- package/package.json +4 -4
package/dist/contentful.node.js
CHANGED
|
@@ -4516,7 +4516,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4516
4516
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "freezeSys", function() { return freezeSys; });
|
|
4517
4517
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUserAgentHeader", function() { return getUserAgentHeader; });
|
|
4518
4518
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toPlainObject", function() { return toPlainObject; });
|
|
4519
|
-
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/
|
|
4519
|
+
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/fast-copy.esm.js");
|
|
4520
4520
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qs */ "../node_modules/qs/lib/index.js");
|
|
4521
4521
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_1__);
|
|
4522
4522
|
/* harmony import */ var lodash_isstring__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash.isstring */ "../node_modules/lodash.isstring/index.js");
|
|
@@ -4533,17 +4533,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4533
4533
|
|
|
4534
4534
|
function ownKeys(object, enumerableOnly) {
|
|
4535
4535
|
var keys = Object.keys(object);
|
|
4536
|
-
|
|
4537
4536
|
if (Object.getOwnPropertySymbols) {
|
|
4538
4537
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
4539
4538
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
4540
4539
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
4541
4540
|
})), keys.push.apply(keys, symbols);
|
|
4542
4541
|
}
|
|
4543
|
-
|
|
4544
4542
|
return keys;
|
|
4545
4543
|
}
|
|
4546
|
-
|
|
4547
4544
|
function _objectSpread2(target) {
|
|
4548
4545
|
for (var i = 1; i < arguments.length; i++) {
|
|
4549
4546
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -4553,10 +4550,8 @@ function _objectSpread2(target) {
|
|
|
4553
4550
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4554
4551
|
});
|
|
4555
4552
|
}
|
|
4556
|
-
|
|
4557
4553
|
return target;
|
|
4558
4554
|
}
|
|
4559
|
-
|
|
4560
4555
|
function _typeof(obj) {
|
|
4561
4556
|
"@babel/helpers - typeof";
|
|
4562
4557
|
|
|
@@ -4566,61 +4561,47 @@ function _typeof(obj) {
|
|
|
4566
4561
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
4567
4562
|
}, _typeof(obj);
|
|
4568
4563
|
}
|
|
4569
|
-
|
|
4570
4564
|
function _wrapRegExp() {
|
|
4571
4565
|
_wrapRegExp = function (re, groups) {
|
|
4572
4566
|
return new BabelRegExp(re, void 0, groups);
|
|
4573
4567
|
};
|
|
4574
|
-
|
|
4575
4568
|
var _super = RegExp.prototype,
|
|
4576
|
-
|
|
4577
|
-
|
|
4569
|
+
_groups = new WeakMap();
|
|
4578
4570
|
function BabelRegExp(re, flags, groups) {
|
|
4579
4571
|
var _this = new RegExp(re, flags);
|
|
4580
|
-
|
|
4581
4572
|
return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
|
|
4582
4573
|
}
|
|
4583
|
-
|
|
4584
4574
|
function buildGroups(result, re) {
|
|
4585
4575
|
var g = _groups.get(re);
|
|
4586
|
-
|
|
4587
4576
|
return Object.keys(g).reduce(function (groups, name) {
|
|
4588
4577
|
var i = g[name];
|
|
4589
4578
|
if ("number" == typeof i) groups[name] = result[i];else {
|
|
4590
4579
|
for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
|
|
4591
|
-
|
|
4592
4580
|
groups[name] = result[i[k]];
|
|
4593
4581
|
}
|
|
4594
4582
|
return groups;
|
|
4595
4583
|
}, Object.create(null));
|
|
4596
4584
|
}
|
|
4597
|
-
|
|
4598
4585
|
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
|
|
4599
4586
|
var result = _super.exec.call(this, str);
|
|
4600
|
-
|
|
4601
4587
|
return result && (result.groups = buildGroups(result, this)), result;
|
|
4602
4588
|
}, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
|
4603
4589
|
if ("string" == typeof substitution) {
|
|
4604
4590
|
var groups = _groups.get(this);
|
|
4605
|
-
|
|
4606
4591
|
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
|
4607
4592
|
return "$" + groups[name];
|
|
4608
4593
|
}));
|
|
4609
4594
|
}
|
|
4610
|
-
|
|
4611
4595
|
if ("function" == typeof substitution) {
|
|
4612
4596
|
var _this = this;
|
|
4613
|
-
|
|
4614
4597
|
return _super[Symbol.replace].call(this, str, function () {
|
|
4615
4598
|
var args = arguments;
|
|
4616
4599
|
return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
|
|
4617
4600
|
});
|
|
4618
4601
|
}
|
|
4619
|
-
|
|
4620
4602
|
return _super[Symbol.replace].call(this, str, substitution);
|
|
4621
4603
|
}, _wrapRegExp.apply(this, arguments);
|
|
4622
4604
|
}
|
|
4623
|
-
|
|
4624
4605
|
function _defineProperty(obj, key, value) {
|
|
4625
4606
|
if (key in obj) {
|
|
4626
4607
|
Object.defineProperty(obj, key, {
|
|
@@ -4632,15 +4613,12 @@ function _defineProperty(obj, key, value) {
|
|
|
4632
4613
|
} else {
|
|
4633
4614
|
obj[key] = value;
|
|
4634
4615
|
}
|
|
4635
|
-
|
|
4636
4616
|
return obj;
|
|
4637
4617
|
}
|
|
4638
|
-
|
|
4639
4618
|
function _inherits(subClass, superClass) {
|
|
4640
4619
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
4641
4620
|
throw new TypeError("Super expression must either be null or a function");
|
|
4642
4621
|
}
|
|
4643
|
-
|
|
4644
4622
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
4645
4623
|
constructor: {
|
|
4646
4624
|
value: subClass,
|
|
@@ -4653,7 +4631,6 @@ function _inherits(subClass, superClass) {
|
|
|
4653
4631
|
});
|
|
4654
4632
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
4655
4633
|
}
|
|
4656
|
-
|
|
4657
4634
|
function _setPrototypeOf(o, p) {
|
|
4658
4635
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
4659
4636
|
o.__proto__ = p;
|
|
@@ -4661,29 +4638,22 @@ function _setPrototypeOf(o, p) {
|
|
|
4661
4638
|
};
|
|
4662
4639
|
return _setPrototypeOf(o, p);
|
|
4663
4640
|
}
|
|
4664
|
-
|
|
4665
4641
|
function _slicedToArray(arr, i) {
|
|
4666
4642
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
4667
4643
|
}
|
|
4668
|
-
|
|
4669
4644
|
function _arrayWithHoles(arr) {
|
|
4670
4645
|
if (Array.isArray(arr)) return arr;
|
|
4671
4646
|
}
|
|
4672
|
-
|
|
4673
4647
|
function _iterableToArrayLimit(arr, i) {
|
|
4674
4648
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
4675
|
-
|
|
4676
4649
|
if (_i == null) return;
|
|
4677
4650
|
var _arr = [];
|
|
4678
4651
|
var _n = true;
|
|
4679
4652
|
var _d = false;
|
|
4680
|
-
|
|
4681
4653
|
var _s, _e;
|
|
4682
|
-
|
|
4683
4654
|
try {
|
|
4684
4655
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
4685
4656
|
_arr.push(_s.value);
|
|
4686
|
-
|
|
4687
4657
|
if (i && _arr.length === i) break;
|
|
4688
4658
|
}
|
|
4689
4659
|
} catch (err) {
|
|
@@ -4696,10 +4666,8 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
4696
4666
|
if (_d) throw _e;
|
|
4697
4667
|
}
|
|
4698
4668
|
}
|
|
4699
|
-
|
|
4700
4669
|
return _arr;
|
|
4701
4670
|
}
|
|
4702
|
-
|
|
4703
4671
|
function _unsupportedIterableToArray(o, minLen) {
|
|
4704
4672
|
if (!o) return;
|
|
4705
4673
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -4708,29 +4676,21 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
4708
4676
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
4709
4677
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
4710
4678
|
}
|
|
4711
|
-
|
|
4712
4679
|
function _arrayLikeToArray(arr, len) {
|
|
4713
4680
|
if (len == null || len > arr.length) len = arr.length;
|
|
4714
|
-
|
|
4715
4681
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
4716
|
-
|
|
4717
4682
|
return arr2;
|
|
4718
4683
|
}
|
|
4719
|
-
|
|
4720
4684
|
function _nonIterableRest() {
|
|
4721
4685
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4722
4686
|
}
|
|
4723
|
-
|
|
4724
4687
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
4725
4688
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
4726
|
-
|
|
4727
4689
|
if (!it) {
|
|
4728
4690
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
4729
4691
|
if (it) o = it;
|
|
4730
4692
|
var i = 0;
|
|
4731
|
-
|
|
4732
4693
|
var F = function () {};
|
|
4733
|
-
|
|
4734
4694
|
return {
|
|
4735
4695
|
s: F,
|
|
4736
4696
|
n: function () {
|
|
@@ -4748,13 +4708,11 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
4748
4708
|
f: F
|
|
4749
4709
|
};
|
|
4750
4710
|
}
|
|
4751
|
-
|
|
4752
4711
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4753
4712
|
}
|
|
4754
|
-
|
|
4755
4713
|
var normalCompletion = true,
|
|
4756
|
-
|
|
4757
|
-
|
|
4714
|
+
didErr = false,
|
|
4715
|
+
err;
|
|
4758
4716
|
return {
|
|
4759
4717
|
s: function () {
|
|
4760
4718
|
it = it.call(o);
|
|
@@ -4804,25 +4762,19 @@ function noop() {
|
|
|
4804
4762
|
var PERCENTAGE_REGEX = /*#__PURE__*/_wrapRegExp(/(\d+)(%)/, {
|
|
4805
4763
|
value: 1
|
|
4806
4764
|
});
|
|
4807
|
-
|
|
4808
4765
|
function calculateLimit(type) {
|
|
4809
4766
|
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 7;
|
|
4810
4767
|
var limit = max;
|
|
4811
|
-
|
|
4812
4768
|
if (PERCENTAGE_REGEX.test(type)) {
|
|
4813
4769
|
var _type$match;
|
|
4814
|
-
|
|
4815
4770
|
var groups = (_type$match = type.match(PERCENTAGE_REGEX)) === null || _type$match === void 0 ? void 0 : _type$match.groups;
|
|
4816
|
-
|
|
4817
4771
|
if (groups && groups.value) {
|
|
4818
4772
|
var percentage = parseInt(groups.value) / 100;
|
|
4819
4773
|
limit = Math.round(max * percentage);
|
|
4820
4774
|
}
|
|
4821
4775
|
}
|
|
4822
|
-
|
|
4823
4776
|
return Math.min(30, Math.max(1, limit));
|
|
4824
4777
|
}
|
|
4825
|
-
|
|
4826
4778
|
function createThrottle(limit, logger) {
|
|
4827
4779
|
logger('info', "Throttle request to ".concat(limit, "/s"));
|
|
4828
4780
|
return p_throttle__WEBPACK_IMPORTED_MODULE_3___default()({
|
|
@@ -4831,11 +4783,10 @@ function createThrottle(limit, logger) {
|
|
|
4831
4783
|
strict: false
|
|
4832
4784
|
});
|
|
4833
4785
|
}
|
|
4834
|
-
|
|
4835
4786
|
var rateLimitThrottle = (function (axiosInstance) {
|
|
4836
4787
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
|
|
4837
4788
|
var _axiosInstance$defaul = axiosInstance.defaults.logHandler,
|
|
4838
|
-
|
|
4789
|
+
logHandler = _axiosInstance$defaul === void 0 ? noop : _axiosInstance$defaul;
|
|
4839
4790
|
var limit = lodash_isstring__WEBPACK_IMPORTED_MODULE_2___default()(type) ? calculateLimit(type) : calculateLimit('auto', type);
|
|
4840
4791
|
var throttle = createThrottle(limit, logHandler);
|
|
4841
4792
|
var isCalculated = false;
|
|
@@ -4850,12 +4801,10 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
4850
4801
|
if (!isCalculated && lodash_isstring__WEBPACK_IMPORTED_MODULE_2___default()(type) && (type === 'auto' || PERCENTAGE_REGEX.test(type)) && response.headers && response.headers['x-contentful-ratelimit-second-limit']) {
|
|
4851
4802
|
var rawLimit = parseInt(response.headers['x-contentful-ratelimit-second-limit']);
|
|
4852
4803
|
var nextLimit = calculateLimit(type, rawLimit);
|
|
4853
|
-
|
|
4854
4804
|
if (nextLimit !== limit) {
|
|
4855
4805
|
if (requestInterceptorId) {
|
|
4856
4806
|
axiosInstance.interceptors.request.eject(requestInterceptorId);
|
|
4857
4807
|
}
|
|
4858
|
-
|
|
4859
4808
|
limit = nextLimit;
|
|
4860
4809
|
throttle = createThrottle(nextLimit, logHandler);
|
|
4861
4810
|
requestInterceptorId = axiosInstance.interceptors.request.use(function (config) {
|
|
@@ -4866,10 +4815,8 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
4866
4815
|
return Promise.reject(error);
|
|
4867
4816
|
});
|
|
4868
4817
|
}
|
|
4869
|
-
|
|
4870
4818
|
isCalculated = true;
|
|
4871
4819
|
}
|
|
4872
|
-
|
|
4873
4820
|
return response;
|
|
4874
4821
|
}, function (error) {
|
|
4875
4822
|
return Promise.reject(error);
|
|
@@ -4885,18 +4832,16 @@ var delay = function delay(ms) {
|
|
|
4885
4832
|
setTimeout(resolve, ms);
|
|
4886
4833
|
});
|
|
4887
4834
|
};
|
|
4888
|
-
|
|
4889
4835
|
var defaultWait = function defaultWait(attempts) {
|
|
4890
4836
|
return Math.pow(Math.SQRT2, attempts);
|
|
4891
4837
|
};
|
|
4892
|
-
|
|
4893
4838
|
function rateLimit(instance) {
|
|
4894
4839
|
var maxRetry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
4895
4840
|
var _instance$defaults = instance.defaults,
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4841
|
+
_instance$defaults$re = _instance$defaults.responseLogger,
|
|
4842
|
+
responseLogger = _instance$defaults$re === void 0 ? noop : _instance$defaults$re,
|
|
4843
|
+
_instance$defaults$re2 = _instance$defaults.requestLogger,
|
|
4844
|
+
requestLogger = _instance$defaults$re2 === void 0 ? noop : _instance$defaults$re2;
|
|
4900
4845
|
instance.interceptors.request.use(function (config) {
|
|
4901
4846
|
requestLogger(config);
|
|
4902
4847
|
return config;
|
|
@@ -4911,23 +4856,22 @@ function rateLimit(instance) {
|
|
|
4911
4856
|
}, function (error) {
|
|
4912
4857
|
var response = error.response;
|
|
4913
4858
|
var config = error.config;
|
|
4914
|
-
responseLogger(error);
|
|
4915
|
-
|
|
4859
|
+
responseLogger(error);
|
|
4860
|
+
// Do not retry if it is disabled or no request config exists (not an axios error)
|
|
4916
4861
|
if (!config || !instance.defaults.retryOnError) {
|
|
4917
4862
|
return Promise.reject(error);
|
|
4918
|
-
}
|
|
4919
|
-
|
|
4863
|
+
}
|
|
4920
4864
|
|
|
4865
|
+
// Retried already for max attempts
|
|
4921
4866
|
var doneAttempts = config.attempts || 1;
|
|
4922
|
-
|
|
4923
4867
|
if (doneAttempts > maxRetry) {
|
|
4924
4868
|
error.attempts = config.attempts;
|
|
4925
4869
|
return Promise.reject(error);
|
|
4926
4870
|
}
|
|
4927
|
-
|
|
4928
4871
|
var retryErrorType = null;
|
|
4929
|
-
var wait = defaultWait(doneAttempts);
|
|
4872
|
+
var wait = defaultWait(doneAttempts);
|
|
4930
4873
|
|
|
4874
|
+
// Errors without response did not receive anything from the server
|
|
4931
4875
|
if (!response) {
|
|
4932
4876
|
retryErrorType = 'Connection';
|
|
4933
4877
|
} else if (response.status >= 500 && response.status < 600) {
|
|
@@ -4935,30 +4879,29 @@ function rateLimit(instance) {
|
|
|
4935
4879
|
retryErrorType = "Server ".concat(response.status);
|
|
4936
4880
|
} else if (response.status === 429) {
|
|
4937
4881
|
// 429 errors are exceeded rate limit exceptions
|
|
4938
|
-
retryErrorType = 'Rate limit';
|
|
4939
|
-
|
|
4882
|
+
retryErrorType = 'Rate limit';
|
|
4883
|
+
// all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
|
|
4940
4884
|
if (response.headers && error.response.headers['x-contentful-ratelimit-reset']) {
|
|
4941
4885
|
wait = response.headers['x-contentful-ratelimit-reset'];
|
|
4942
4886
|
}
|
|
4943
4887
|
}
|
|
4944
|
-
|
|
4945
4888
|
if (retryErrorType) {
|
|
4946
4889
|
// convert to ms and add jitter
|
|
4947
4890
|
wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
|
|
4948
|
-
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
|
|
4891
|
+
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
|
|
4949
4892
|
|
|
4893
|
+
// increase attempts counter
|
|
4950
4894
|
config.attempts = doneAttempts + 1;
|
|
4895
|
+
|
|
4951
4896
|
/* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
|
|
4952
4897
|
to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
|
|
4953
4898
|
requests still use the original http/httpsAgent property */
|
|
4954
|
-
|
|
4955
4899
|
delete config.httpAgent;
|
|
4956
4900
|
delete config.httpsAgent;
|
|
4957
4901
|
return delay(wait).then(function () {
|
|
4958
4902
|
return instance(config);
|
|
4959
4903
|
});
|
|
4960
4904
|
}
|
|
4961
|
-
|
|
4962
4905
|
return Promise.reject(error);
|
|
4963
4906
|
});
|
|
4964
4907
|
}
|
|
@@ -4974,9 +4917,10 @@ function asyncToken(instance, getToken) {
|
|
|
4974
4917
|
});
|
|
4975
4918
|
}
|
|
4976
4919
|
|
|
4920
|
+
// Matches 'sub.host:port' or 'host:port' and extracts hostname and port
|
|
4977
4921
|
// Also enforces toplevel domain specified, no spaces and no protocol
|
|
4978
|
-
|
|
4979
4922
|
var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
4923
|
+
|
|
4980
4924
|
/**
|
|
4981
4925
|
* Create pre configured axios instance
|
|
4982
4926
|
* @private
|
|
@@ -4984,7 +4928,6 @@ var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
|
4984
4928
|
* @param {CreateHttpClientParams} options - Initialization parameters for the HTTP client
|
|
4985
4929
|
* @return {ContentfulAxiosInstance} Initialized axios instance
|
|
4986
4930
|
*/
|
|
4987
|
-
|
|
4988
4931
|
function createHttpClient(axios, options) {
|
|
4989
4932
|
var defaultConfig = {
|
|
4990
4933
|
insecure: false,
|
|
@@ -4999,7 +4942,6 @@ function createHttpClient(axios, options) {
|
|
|
4999
4942
|
console.error(data);
|
|
5000
4943
|
return;
|
|
5001
4944
|
}
|
|
5002
|
-
|
|
5003
4945
|
console.log("[".concat(level, "] ").concat(data));
|
|
5004
4946
|
},
|
|
5005
4947
|
// Passed to axios
|
|
@@ -5014,56 +4956,47 @@ function createHttpClient(axios, options) {
|
|
|
5014
4956
|
maxContentLength: 1073741824,
|
|
5015
4957
|
// 1GB
|
|
5016
4958
|
maxBodyLength: 1073741824 // 1GB
|
|
5017
|
-
|
|
5018
4959
|
};
|
|
5019
4960
|
|
|
5020
4961
|
var config = _objectSpread2(_objectSpread2({}, defaultConfig), options);
|
|
5021
|
-
|
|
5022
4962
|
if (!config.accessToken) {
|
|
5023
4963
|
var missingAccessTokenError = new TypeError('Expected parameter accessToken');
|
|
5024
4964
|
config.logHandler('error', missingAccessTokenError);
|
|
5025
4965
|
throw missingAccessTokenError;
|
|
5026
|
-
}
|
|
5027
|
-
|
|
4966
|
+
}
|
|
5028
4967
|
|
|
4968
|
+
// Construct axios baseURL option
|
|
5029
4969
|
var protocol = config.insecure ? 'http' : 'https';
|
|
5030
4970
|
var space = config.space ? "".concat(config.space, "/") : '';
|
|
5031
4971
|
var hostname = config.defaultHostname;
|
|
5032
4972
|
var port = config.insecure ? 80 : 443;
|
|
5033
|
-
|
|
5034
4973
|
if (config.host && HOST_REGEX.test(config.host)) {
|
|
5035
4974
|
var parsed = config.host.split(':');
|
|
5036
|
-
|
|
5037
4975
|
if (parsed.length === 2) {
|
|
5038
|
-
|
|
5039
4976
|
var _parsed = _slicedToArray(parsed, 2);
|
|
5040
|
-
|
|
5041
4977
|
hostname = _parsed[0];
|
|
5042
4978
|
port = _parsed[1];
|
|
5043
4979
|
} else {
|
|
5044
4980
|
hostname = parsed[0];
|
|
5045
4981
|
}
|
|
5046
|
-
}
|
|
5047
|
-
|
|
4982
|
+
}
|
|
5048
4983
|
|
|
4984
|
+
// Ensure that basePath does start but not end with a slash
|
|
5049
4985
|
if (config.basePath) {
|
|
5050
4986
|
config.basePath = "/".concat(config.basePath.split('/').filter(Boolean).join('/'));
|
|
5051
4987
|
}
|
|
5052
|
-
|
|
5053
4988
|
var baseURL = options.baseURL || "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath, "/spaces/").concat(space);
|
|
5054
|
-
|
|
5055
4989
|
if (!config.headers.Authorization && typeof config.accessToken !== 'function') {
|
|
5056
4990
|
config.headers.Authorization = 'Bearer ' + config.accessToken;
|
|
5057
|
-
}
|
|
4991
|
+
}
|
|
4992
|
+
|
|
4993
|
+
// Set these headers only for node because browsers don't like it when you
|
|
5058
4994
|
// override user-agent or accept-encoding.
|
|
5059
4995
|
// The SDKs should set their own X-Contentful-User-Agent.
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
4996
|
if (isNode()) {
|
|
5063
4997
|
config.headers['user-agent'] = 'node.js/' + getNodeVersion();
|
|
5064
4998
|
config.headers['Accept-Encoding'] = 'gzip';
|
|
5065
4999
|
}
|
|
5066
|
-
|
|
5067
5000
|
var axiosOptions = {
|
|
5068
5001
|
// Axios
|
|
5069
5002
|
baseURL: baseURL,
|
|
@@ -5084,6 +5017,7 @@ function createHttpClient(axios, options) {
|
|
|
5084
5017
|
};
|
|
5085
5018
|
var instance = axios.create(axiosOptions);
|
|
5086
5019
|
instance.httpClientParams = options;
|
|
5020
|
+
|
|
5087
5021
|
/**
|
|
5088
5022
|
* Creates a new axios instance with the same default base parameters as the
|
|
5089
5023
|
* current one, and with any overrides passed to the newParams object
|
|
@@ -5094,41 +5028,34 @@ function createHttpClient(axios, options) {
|
|
|
5094
5028
|
* @param {CreateHttpClientParams} httpClientParams - Initialization parameters for the HTTP client
|
|
5095
5029
|
* @return {ContentfulAxiosInstance} Initialized axios instance
|
|
5096
5030
|
*/
|
|
5097
|
-
|
|
5098
5031
|
instance.cloneWithNewParams = function (newParams) {
|
|
5099
5032
|
return createHttpClient(axios, _objectSpread2(_objectSpread2({}, Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(options)), newParams));
|
|
5100
5033
|
};
|
|
5034
|
+
|
|
5101
5035
|
/**
|
|
5102
5036
|
* Apply interceptors.
|
|
5103
5037
|
* Please note that the order of interceptors is important
|
|
5104
5038
|
*/
|
|
5105
5039
|
|
|
5106
|
-
|
|
5107
5040
|
if (config.onBeforeRequest) {
|
|
5108
5041
|
instance.interceptors.request.use(config.onBeforeRequest);
|
|
5109
5042
|
}
|
|
5110
|
-
|
|
5111
5043
|
if (typeof config.accessToken === 'function') {
|
|
5112
5044
|
asyncToken(instance, config.accessToken);
|
|
5113
5045
|
}
|
|
5114
|
-
|
|
5115
5046
|
if (config.throttle) {
|
|
5116
5047
|
rateLimitThrottle(instance, config.throttle);
|
|
5117
5048
|
}
|
|
5118
|
-
|
|
5119
5049
|
rateLimit(instance, config.retryLimit);
|
|
5120
|
-
|
|
5121
5050
|
if (config.onError) {
|
|
5122
5051
|
instance.interceptors.response.use(function (response) {
|
|
5123
5052
|
return response;
|
|
5124
5053
|
}, config.onError);
|
|
5125
5054
|
}
|
|
5126
|
-
|
|
5127
5055
|
return instance;
|
|
5128
5056
|
}
|
|
5129
5057
|
|
|
5130
5058
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5131
|
-
|
|
5132
5059
|
/**
|
|
5133
5060
|
* Creates request parameters configuration by parsing an existing query object
|
|
5134
5061
|
* @private
|
|
@@ -5151,22 +5078,19 @@ function enforceObjPath(obj, path) {
|
|
|
5151
5078
|
err.message = "Required property ".concat(path, " missing from:\n\n").concat(JSON.stringify(obj), "\n\n");
|
|
5152
5079
|
throw err;
|
|
5153
5080
|
}
|
|
5154
|
-
|
|
5155
5081
|
return true;
|
|
5156
5082
|
}
|
|
5157
5083
|
|
|
5158
5084
|
// copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
|
|
5085
|
+
|
|
5159
5086
|
function deepFreeze(object) {
|
|
5160
5087
|
var propNames = Object.getOwnPropertyNames(object);
|
|
5161
|
-
|
|
5162
5088
|
var _iterator = _createForOfIteratorHelper(propNames),
|
|
5163
|
-
|
|
5164
|
-
|
|
5089
|
+
_step;
|
|
5165
5090
|
try {
|
|
5166
5091
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
5167
5092
|
var name = _step.value;
|
|
5168
5093
|
var value = object[name];
|
|
5169
|
-
|
|
5170
5094
|
if (value && _typeof(value) === 'object') {
|
|
5171
5095
|
deepFreeze(value);
|
|
5172
5096
|
}
|
|
@@ -5176,10 +5100,8 @@ function deepFreeze(object) {
|
|
|
5176
5100
|
} finally {
|
|
5177
5101
|
_iterator.f();
|
|
5178
5102
|
}
|
|
5179
|
-
|
|
5180
5103
|
return Object.freeze(object);
|
|
5181
5104
|
}
|
|
5182
|
-
|
|
5183
5105
|
function freezeSys(obj) {
|
|
5184
5106
|
deepFreeze(obj.sys || {});
|
|
5185
5107
|
return obj;
|
|
@@ -5187,18 +5109,15 @@ function freezeSys(obj) {
|
|
|
5187
5109
|
|
|
5188
5110
|
function getBrowserOS() {
|
|
5189
5111
|
var win = getWindow();
|
|
5190
|
-
|
|
5191
5112
|
if (!win) {
|
|
5192
5113
|
return null;
|
|
5193
5114
|
}
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5115
|
+
var userAgent = win.navigator.userAgent;
|
|
5116
|
+
// TODO: platform is deprecated.
|
|
5197
5117
|
var platform = win.navigator.platform;
|
|
5198
5118
|
var macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
|
|
5199
5119
|
var windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
|
|
5200
5120
|
var iosPlatforms = ['iPhone', 'iPad', 'iPod'];
|
|
5201
|
-
|
|
5202
5121
|
if (macosPlatforms.indexOf(platform) !== -1) {
|
|
5203
5122
|
return 'macOS';
|
|
5204
5123
|
} else if (iosPlatforms.indexOf(platform) !== -1) {
|
|
@@ -5210,10 +5129,8 @@ function getBrowserOS() {
|
|
|
5210
5129
|
} else if (/Linux/.test(platform)) {
|
|
5211
5130
|
return 'Linux';
|
|
5212
5131
|
}
|
|
5213
|
-
|
|
5214
5132
|
return null;
|
|
5215
5133
|
}
|
|
5216
|
-
|
|
5217
5134
|
function getNodeOS() {
|
|
5218
5135
|
var platform = process.platform || 'linux';
|
|
5219
5136
|
var version = process.version || '0.0.0';
|
|
@@ -5227,32 +5144,24 @@ function getNodeOS() {
|
|
|
5227
5144
|
sunos: 'Linux',
|
|
5228
5145
|
win32: 'Windows'
|
|
5229
5146
|
};
|
|
5230
|
-
|
|
5231
5147
|
if (platform in platformMap) {
|
|
5232
5148
|
return "".concat(platformMap[platform] || 'Linux', "/").concat(version);
|
|
5233
5149
|
}
|
|
5234
|
-
|
|
5235
5150
|
return null;
|
|
5236
5151
|
}
|
|
5237
|
-
|
|
5238
5152
|
function getUserAgentHeader(sdk, application, integration, feature) {
|
|
5239
5153
|
var headerParts = [];
|
|
5240
|
-
|
|
5241
5154
|
if (application) {
|
|
5242
5155
|
headerParts.push("app ".concat(application));
|
|
5243
5156
|
}
|
|
5244
|
-
|
|
5245
5157
|
if (integration) {
|
|
5246
5158
|
headerParts.push("integration ".concat(integration));
|
|
5247
5159
|
}
|
|
5248
|
-
|
|
5249
5160
|
if (feature) {
|
|
5250
5161
|
headerParts.push('feature ' + feature);
|
|
5251
5162
|
}
|
|
5252
|
-
|
|
5253
5163
|
headerParts.push("sdk ".concat(sdk));
|
|
5254
5164
|
var platform = null;
|
|
5255
|
-
|
|
5256
5165
|
try {
|
|
5257
5166
|
if (isReactNative()) {
|
|
5258
5167
|
platform = getBrowserOS();
|
|
@@ -5267,11 +5176,9 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
5267
5176
|
} catch (e) {
|
|
5268
5177
|
platform = null;
|
|
5269
5178
|
}
|
|
5270
|
-
|
|
5271
5179
|
if (platform) {
|
|
5272
5180
|
headerParts.push("os ".concat(platform));
|
|
5273
5181
|
}
|
|
5274
|
-
|
|
5275
5182
|
return "".concat(headerParts.filter(function (item) {
|
|
5276
5183
|
return item !== '';
|
|
5277
5184
|
}).join('; '), ";");
|
|
@@ -5283,7 +5190,6 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
5283
5190
|
* @param data - Any plain JSON response returned from the API
|
|
5284
5191
|
* @return Enhanced object with toPlainObject method
|
|
5285
5192
|
*/
|
|
5286
|
-
|
|
5287
5193
|
function toPlainObject(data) {
|
|
5288
5194
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
5289
5195
|
// @ts-expect-error
|
|
@@ -5307,18 +5213,17 @@ function toPlainObject(data) {
|
|
|
5307
5213
|
*/
|
|
5308
5214
|
function errorHandler(errorResponse) {
|
|
5309
5215
|
var config = errorResponse.config,
|
|
5310
|
-
|
|
5311
|
-
var errorName;
|
|
5216
|
+
response = errorResponse.response;
|
|
5217
|
+
var errorName;
|
|
5312
5218
|
|
|
5219
|
+
// Obscure the Management token
|
|
5313
5220
|
if (config && config.headers && config.headers['Authorization']) {
|
|
5314
5221
|
var token = "...".concat(config.headers['Authorization'].toString().substr(-5));
|
|
5315
5222
|
config.headers['Authorization'] = "Bearer ".concat(token);
|
|
5316
5223
|
}
|
|
5317
|
-
|
|
5318
5224
|
if (!lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(response) || !lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
5319
5225
|
throw errorResponse;
|
|
5320
5226
|
}
|
|
5321
|
-
|
|
5322
5227
|
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
5323
5228
|
var errorData = {
|
|
5324
5229
|
status: response === null || response === void 0 ? void 0 : response.status,
|
|
@@ -5326,7 +5231,6 @@ function errorHandler(errorResponse) {
|
|
|
5326
5231
|
message: '',
|
|
5327
5232
|
details: {}
|
|
5328
5233
|
};
|
|
5329
|
-
|
|
5330
5234
|
if (lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
5331
5235
|
errorData.request = {
|
|
5332
5236
|
url: config.url,
|
|
@@ -5335,458 +5239,36 @@ function errorHandler(errorResponse) {
|
|
|
5335
5239
|
payloadData: config.data
|
|
5336
5240
|
};
|
|
5337
5241
|
}
|
|
5338
|
-
|
|
5339
5242
|
if (data && lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(data)) {
|
|
5340
5243
|
if ('requestId' in data) {
|
|
5341
5244
|
errorData.requestId = data.requestId || 'UNKNOWN';
|
|
5342
5245
|
}
|
|
5343
|
-
|
|
5344
5246
|
if ('message' in data) {
|
|
5345
5247
|
errorData.message = data.message || '';
|
|
5346
5248
|
}
|
|
5347
|
-
|
|
5348
5249
|
if ('details' in data) {
|
|
5349
5250
|
errorData.details = data.details || {};
|
|
5350
5251
|
}
|
|
5351
|
-
|
|
5352
5252
|
if ('sys' in data) {
|
|
5353
5253
|
if ('id' in data.sys) {
|
|
5354
5254
|
errorName = data.sys.id;
|
|
5355
5255
|
}
|
|
5356
5256
|
}
|
|
5357
5257
|
}
|
|
5358
|
-
|
|
5359
5258
|
var error = new Error();
|
|
5360
5259
|
error.name = errorName && errorName !== 'Unknown' ? errorName : "".concat(response === null || response === void 0 ? void 0 : response.status, " ").concat(response === null || response === void 0 ? void 0 : response.statusText);
|
|
5361
|
-
|
|
5362
5260
|
try {
|
|
5363
5261
|
error.message = JSON.stringify(errorData, null, ' ');
|
|
5364
5262
|
} catch (_unused) {
|
|
5365
5263
|
var _errorData$message;
|
|
5366
|
-
|
|
5367
5264
|
error.message = (_errorData$message = errorData === null || errorData === void 0 ? void 0 : errorData.message) !== null && _errorData$message !== void 0 ? _errorData$message : '';
|
|
5368
5265
|
}
|
|
5369
|
-
|
|
5370
5266
|
throw error;
|
|
5371
5267
|
}
|
|
5372
5268
|
|
|
5373
5269
|
|
|
5374
5270
|
|
|
5375
5271
|
|
|
5376
|
-
/***/ }),
|
|
5377
|
-
|
|
5378
|
-
/***/ "../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/esm/index.mjs":
|
|
5379
|
-
/*!*************************************************************************************!*\
|
|
5380
|
-
!*** ../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/esm/index.mjs ***!
|
|
5381
|
-
\*************************************************************************************/
|
|
5382
|
-
/*! exports provided: copyStrict, createCopier, createStrictCopier, default */
|
|
5383
|
-
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
5384
|
-
|
|
5385
|
-
"use strict";
|
|
5386
|
-
__webpack_require__.r(__webpack_exports__);
|
|
5387
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copyStrict", function() { return copyStrict; });
|
|
5388
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCopier", function() { return createCopier; });
|
|
5389
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createStrictCopier", function() { return createStrictCopier; });
|
|
5390
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return index; });
|
|
5391
|
-
var toStringFunction = Function.prototype.toString;
|
|
5392
|
-
var create = Object.create;
|
|
5393
|
-
var toStringObject = Object.prototype.toString;
|
|
5394
|
-
/**
|
|
5395
|
-
* @classdesc Fallback cache for when WeakMap is not natively supported
|
|
5396
|
-
*/
|
|
5397
|
-
var LegacyCache = /** @class */ (function () {
|
|
5398
|
-
function LegacyCache() {
|
|
5399
|
-
this._keys = [];
|
|
5400
|
-
this._values = [];
|
|
5401
|
-
}
|
|
5402
|
-
LegacyCache.prototype.has = function (key) {
|
|
5403
|
-
return !!~this._keys.indexOf(key);
|
|
5404
|
-
};
|
|
5405
|
-
LegacyCache.prototype.get = function (key) {
|
|
5406
|
-
return this._values[this._keys.indexOf(key)];
|
|
5407
|
-
};
|
|
5408
|
-
LegacyCache.prototype.set = function (key, value) {
|
|
5409
|
-
this._keys.push(key);
|
|
5410
|
-
this._values.push(value);
|
|
5411
|
-
};
|
|
5412
|
-
return LegacyCache;
|
|
5413
|
-
}());
|
|
5414
|
-
function createCacheLegacy() {
|
|
5415
|
-
return new LegacyCache();
|
|
5416
|
-
}
|
|
5417
|
-
function createCacheModern() {
|
|
5418
|
-
return new WeakMap();
|
|
5419
|
-
}
|
|
5420
|
-
/**
|
|
5421
|
-
* Get a new cache object to prevent circular references.
|
|
5422
|
-
*/
|
|
5423
|
-
var createCache = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
|
|
5424
|
-
/**
|
|
5425
|
-
* Get an empty version of the object with the same prototype it has.
|
|
5426
|
-
*/
|
|
5427
|
-
function getCleanClone(prototype) {
|
|
5428
|
-
if (!prototype) {
|
|
5429
|
-
return create(null);
|
|
5430
|
-
}
|
|
5431
|
-
var Constructor = prototype.constructor;
|
|
5432
|
-
if (Constructor === Object) {
|
|
5433
|
-
return prototype === Object.prototype ? {} : create(prototype);
|
|
5434
|
-
}
|
|
5435
|
-
if (~toStringFunction.call(Constructor).indexOf('[native code]')) {
|
|
5436
|
-
try {
|
|
5437
|
-
return new Constructor();
|
|
5438
|
-
}
|
|
5439
|
-
catch (_a) { }
|
|
5440
|
-
}
|
|
5441
|
-
return create(prototype);
|
|
5442
|
-
}
|
|
5443
|
-
function getRegExpFlagsLegacy(regExp) {
|
|
5444
|
-
var flags = '';
|
|
5445
|
-
if (regExp.global) {
|
|
5446
|
-
flags += 'g';
|
|
5447
|
-
}
|
|
5448
|
-
if (regExp.ignoreCase) {
|
|
5449
|
-
flags += 'i';
|
|
5450
|
-
}
|
|
5451
|
-
if (regExp.multiline) {
|
|
5452
|
-
flags += 'm';
|
|
5453
|
-
}
|
|
5454
|
-
if (regExp.unicode) {
|
|
5455
|
-
flags += 'u';
|
|
5456
|
-
}
|
|
5457
|
-
if (regExp.sticky) {
|
|
5458
|
-
flags += 'y';
|
|
5459
|
-
}
|
|
5460
|
-
return flags;
|
|
5461
|
-
}
|
|
5462
|
-
function getRegExpFlagsModern(regExp) {
|
|
5463
|
-
return regExp.flags;
|
|
5464
|
-
}
|
|
5465
|
-
/**
|
|
5466
|
-
* Get the flags to apply to the copied regexp.
|
|
5467
|
-
*/
|
|
5468
|
-
var getRegExpFlags = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
|
|
5469
|
-
function getTagLegacy(value) {
|
|
5470
|
-
var type = toStringObject.call(value);
|
|
5471
|
-
return type.substring(8, type.length - 1);
|
|
5472
|
-
}
|
|
5473
|
-
function getTagModern(value) {
|
|
5474
|
-
return value[Symbol.toStringTag] || getTagLegacy(value);
|
|
5475
|
-
}
|
|
5476
|
-
/**
|
|
5477
|
-
* Get the tag of the value passed, so that the correct copier can be used.
|
|
5478
|
-
*/
|
|
5479
|
-
var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
|
|
5480
|
-
|
|
5481
|
-
var defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
5482
|
-
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
|
|
5483
|
-
var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols === 'function';
|
|
5484
|
-
function getStrictPropertiesModern(object) {
|
|
5485
|
-
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
5486
|
-
}
|
|
5487
|
-
/**
|
|
5488
|
-
* Get the properites used when copying objects strictly. This includes both keys and symbols.
|
|
5489
|
-
*/
|
|
5490
|
-
var getStrictProperties = SUPPORTS_SYMBOL
|
|
5491
|
-
? getStrictPropertiesModern
|
|
5492
|
-
: getOwnPropertyNames;
|
|
5493
|
-
/**
|
|
5494
|
-
* Striclty copy all properties contained on the object.
|
|
5495
|
-
*/
|
|
5496
|
-
function copyOwnPropertiesStrict(value, clone, state) {
|
|
5497
|
-
var properties = getStrictProperties(value);
|
|
5498
|
-
for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
|
|
5499
|
-
property = properties[index];
|
|
5500
|
-
if (property === 'callee' || property === 'caller') {
|
|
5501
|
-
continue;
|
|
5502
|
-
}
|
|
5503
|
-
descriptor = getOwnPropertyDescriptor(value, property);
|
|
5504
|
-
if (!descriptor) {
|
|
5505
|
-
// In extra edge cases where the property descriptor cannot be retrived, fall back to
|
|
5506
|
-
// the loose assignment.
|
|
5507
|
-
clone[property] = state.copier(value[property], state);
|
|
5508
|
-
continue;
|
|
5509
|
-
}
|
|
5510
|
-
// Only clone the value if actually a value, not a getter / setter.
|
|
5511
|
-
if (!descriptor.get && !descriptor.set) {
|
|
5512
|
-
descriptor.value = state.copier(descriptor.value, state);
|
|
5513
|
-
}
|
|
5514
|
-
try {
|
|
5515
|
-
defineProperty(clone, property, descriptor);
|
|
5516
|
-
}
|
|
5517
|
-
catch (error) {
|
|
5518
|
-
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
|
|
5519
|
-
clone[property] = descriptor.value;
|
|
5520
|
-
}
|
|
5521
|
-
}
|
|
5522
|
-
return clone;
|
|
5523
|
-
}
|
|
5524
|
-
/**
|
|
5525
|
-
* Deeply copy the indexed values in the array.
|
|
5526
|
-
*/
|
|
5527
|
-
function copyArrayLoose(array, state) {
|
|
5528
|
-
var clone = new state.Constructor();
|
|
5529
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
5530
|
-
state.cache.set(array, clone);
|
|
5531
|
-
for (var index = 0, length_2 = array.length; index < length_2; ++index) {
|
|
5532
|
-
clone[index] = state.copier(array[index], state);
|
|
5533
|
-
}
|
|
5534
|
-
return clone;
|
|
5535
|
-
}
|
|
5536
|
-
/**
|
|
5537
|
-
* Deeply copy the indexed values in the array, as well as any custom properties.
|
|
5538
|
-
*/
|
|
5539
|
-
function copyArrayStrict(array, state) {
|
|
5540
|
-
var clone = new state.Constructor();
|
|
5541
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
5542
|
-
state.cache.set(array, clone);
|
|
5543
|
-
return copyOwnPropertiesStrict(array, clone, state);
|
|
5544
|
-
}
|
|
5545
|
-
/**
|
|
5546
|
-
* Copy the contents of the ArrayBuffer.
|
|
5547
|
-
*/
|
|
5548
|
-
function copyArrayBuffer(arrayBuffer, _state) {
|
|
5549
|
-
return arrayBuffer.slice(0);
|
|
5550
|
-
}
|
|
5551
|
-
/**
|
|
5552
|
-
* Create a new Blob with the contents of the original.
|
|
5553
|
-
*/
|
|
5554
|
-
function copyBlob(blob, _state) {
|
|
5555
|
-
return blob.slice(0, blob.size, blob.type);
|
|
5556
|
-
}
|
|
5557
|
-
/**
|
|
5558
|
-
* Create a new DataView with the contents of the original.
|
|
5559
|
-
*/
|
|
5560
|
-
function copyDataView(dataView, state) {
|
|
5561
|
-
return new state.Constructor(copyArrayBuffer(dataView.buffer));
|
|
5562
|
-
}
|
|
5563
|
-
/**
|
|
5564
|
-
* Create a new Date based on the time of the original.
|
|
5565
|
-
*/
|
|
5566
|
-
function copyDate(date, state) {
|
|
5567
|
-
return new state.Constructor(date.getTime());
|
|
5568
|
-
}
|
|
5569
|
-
/**
|
|
5570
|
-
* Deeply copy the keys and values of the original.
|
|
5571
|
-
*/
|
|
5572
|
-
function copyMapLoose(map, state) {
|
|
5573
|
-
var clone = new state.Constructor();
|
|
5574
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
5575
|
-
state.cache.set(map, clone);
|
|
5576
|
-
map.forEach(function (value, key) {
|
|
5577
|
-
clone.set(key, state.copier(value, state));
|
|
5578
|
-
});
|
|
5579
|
-
return clone;
|
|
5580
|
-
}
|
|
5581
|
-
/**
|
|
5582
|
-
* Deeply copy the keys and values of the original, as well as any custom properties.
|
|
5583
|
-
*/
|
|
5584
|
-
function copyMapStrict(map, state) {
|
|
5585
|
-
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
|
|
5586
|
-
}
|
|
5587
|
-
function copyObjectLooseLegacy(object, state) {
|
|
5588
|
-
var clone = getCleanClone(state.prototype);
|
|
5589
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
5590
|
-
state.cache.set(object, clone);
|
|
5591
|
-
for (var key in object) {
|
|
5592
|
-
if (hasOwnProperty.call(object, key)) {
|
|
5593
|
-
clone[key] = state.copier(object[key], state);
|
|
5594
|
-
}
|
|
5595
|
-
}
|
|
5596
|
-
return clone;
|
|
5597
|
-
}
|
|
5598
|
-
function copyObjectLooseModern(object, state) {
|
|
5599
|
-
var clone = getCleanClone(state.prototype);
|
|
5600
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
5601
|
-
state.cache.set(object, clone);
|
|
5602
|
-
for (var key in object) {
|
|
5603
|
-
if (hasOwnProperty.call(object, key)) {
|
|
5604
|
-
clone[key] = state.copier(object[key], state);
|
|
5605
|
-
}
|
|
5606
|
-
}
|
|
5607
|
-
var symbols = getOwnPropertySymbols(object);
|
|
5608
|
-
for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
|
|
5609
|
-
symbol = symbols[index];
|
|
5610
|
-
if (propertyIsEnumerable.call(object, symbol)) {
|
|
5611
|
-
clone[symbol] = state.copier(object[symbol], state);
|
|
5612
|
-
}
|
|
5613
|
-
}
|
|
5614
|
-
return clone;
|
|
5615
|
-
}
|
|
5616
|
-
/**
|
|
5617
|
-
* Deeply copy the properties (keys and symbols) and values of the original.
|
|
5618
|
-
*/
|
|
5619
|
-
var copyObjectLoose = SUPPORTS_SYMBOL
|
|
5620
|
-
? copyObjectLooseModern
|
|
5621
|
-
: copyObjectLooseLegacy;
|
|
5622
|
-
/**
|
|
5623
|
-
* Deeply copy the properties (keys and symbols) and values of the original, as well
|
|
5624
|
-
* as any hidden or non-enumerable properties.
|
|
5625
|
-
*/
|
|
5626
|
-
function copyObjectStrict(object, state) {
|
|
5627
|
-
var clone = getCleanClone(state.prototype);
|
|
5628
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
5629
|
-
state.cache.set(object, clone);
|
|
5630
|
-
return copyOwnPropertiesStrict(object, clone, state);
|
|
5631
|
-
}
|
|
5632
|
-
/**
|
|
5633
|
-
* Create a new primitive wrapper from the value of the original.
|
|
5634
|
-
*/
|
|
5635
|
-
function copyPrimitiveWrapper(primitiveObject, state) {
|
|
5636
|
-
return new state.Constructor(primitiveObject.valueOf());
|
|
5637
|
-
}
|
|
5638
|
-
/**
|
|
5639
|
-
* Create a new RegExp based on the value and flags of the original.
|
|
5640
|
-
*/
|
|
5641
|
-
function copyRegExp(regExp, state) {
|
|
5642
|
-
var clone = new state.Constructor(regExp.source, getRegExpFlags(regExp));
|
|
5643
|
-
clone.lastIndex = regExp.lastIndex;
|
|
5644
|
-
return clone;
|
|
5645
|
-
}
|
|
5646
|
-
/**
|
|
5647
|
-
* Return the original value (an identity function).
|
|
5648
|
-
*
|
|
5649
|
-
* @note
|
|
5650
|
-
* THis is used for objects that cannot be copied, such as WeakMap.
|
|
5651
|
-
*/
|
|
5652
|
-
function copySelf(value, _state) {
|
|
5653
|
-
return value;
|
|
5654
|
-
}
|
|
5655
|
-
/**
|
|
5656
|
-
* Deeply copy the values of the original.
|
|
5657
|
-
*/
|
|
5658
|
-
function copySetLoose(set, state) {
|
|
5659
|
-
var clone = new state.Constructor();
|
|
5660
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
5661
|
-
state.cache.set(set, clone);
|
|
5662
|
-
set.forEach(function (value) {
|
|
5663
|
-
clone.add(state.copier(value, state));
|
|
5664
|
-
});
|
|
5665
|
-
return clone;
|
|
5666
|
-
}
|
|
5667
|
-
/**
|
|
5668
|
-
* Deeply copy the values of the original, as well as any custom properties.
|
|
5669
|
-
*/
|
|
5670
|
-
function copySetStrict(set, state) {
|
|
5671
|
-
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
|
|
5672
|
-
}
|
|
5673
|
-
|
|
5674
|
-
var isArray = Array.isArray;
|
|
5675
|
-
var assign = Object.assign, getPrototypeOf = Object.getPrototypeOf;
|
|
5676
|
-
var DEFAULT_LOOSE_OPTIONS = {
|
|
5677
|
-
array: copyArrayLoose,
|
|
5678
|
-
arrayBuffer: copyArrayBuffer,
|
|
5679
|
-
blob: copyBlob,
|
|
5680
|
-
dataView: copyDataView,
|
|
5681
|
-
date: copyDate,
|
|
5682
|
-
error: copySelf,
|
|
5683
|
-
map: copyMapLoose,
|
|
5684
|
-
object: copyObjectLoose,
|
|
5685
|
-
regExp: copyRegExp,
|
|
5686
|
-
set: copySetLoose,
|
|
5687
|
-
};
|
|
5688
|
-
var DEFAULT_STRICT_OPTIONS = assign({}, DEFAULT_LOOSE_OPTIONS, {
|
|
5689
|
-
array: copyArrayStrict,
|
|
5690
|
-
map: copyMapStrict,
|
|
5691
|
-
object: copyObjectStrict,
|
|
5692
|
-
set: copySetStrict,
|
|
5693
|
-
});
|
|
5694
|
-
/**
|
|
5695
|
-
* Get the copiers used for each specific object tag.
|
|
5696
|
-
*/
|
|
5697
|
-
function getTagSpecificCopiers(options) {
|
|
5698
|
-
return {
|
|
5699
|
-
Arguments: options.object,
|
|
5700
|
-
Array: options.array,
|
|
5701
|
-
ArrayBuffer: options.arrayBuffer,
|
|
5702
|
-
Blob: options.blob,
|
|
5703
|
-
Boolean: copyPrimitiveWrapper,
|
|
5704
|
-
DataView: options.dataView,
|
|
5705
|
-
Date: options.date,
|
|
5706
|
-
Error: options.error,
|
|
5707
|
-
Float32Array: options.arrayBuffer,
|
|
5708
|
-
Float64Array: options.arrayBuffer,
|
|
5709
|
-
Int8Array: options.arrayBuffer,
|
|
5710
|
-
Int16Array: options.arrayBuffer,
|
|
5711
|
-
Int32Array: options.arrayBuffer,
|
|
5712
|
-
Map: options.map,
|
|
5713
|
-
Number: copyPrimitiveWrapper,
|
|
5714
|
-
Object: options.object,
|
|
5715
|
-
Promise: copySelf,
|
|
5716
|
-
RegExp: options.regExp,
|
|
5717
|
-
Set: options.set,
|
|
5718
|
-
String: copyPrimitiveWrapper,
|
|
5719
|
-
WeakMap: copySelf,
|
|
5720
|
-
WeakSet: copySelf,
|
|
5721
|
-
Uint8Array: options.arrayBuffer,
|
|
5722
|
-
Uint8ClampedArray: options.arrayBuffer,
|
|
5723
|
-
Uint16Array: options.arrayBuffer,
|
|
5724
|
-
Uint32Array: options.arrayBuffer,
|
|
5725
|
-
Uint64Array: options.arrayBuffer,
|
|
5726
|
-
};
|
|
5727
|
-
}
|
|
5728
|
-
/**
|
|
5729
|
-
* Create a custom copier based on the object-specific copy methods passed.
|
|
5730
|
-
*/
|
|
5731
|
-
function createCopier(options) {
|
|
5732
|
-
var normalizedOptions = assign({}, DEFAULT_LOOSE_OPTIONS, options);
|
|
5733
|
-
var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
|
|
5734
|
-
var array = tagSpecificCopiers.Array, object = tagSpecificCopiers.Object;
|
|
5735
|
-
function copier(value, state) {
|
|
5736
|
-
state.prototype = state.Constructor = undefined;
|
|
5737
|
-
if (!value || typeof value !== 'object') {
|
|
5738
|
-
return value;
|
|
5739
|
-
}
|
|
5740
|
-
if (state.cache.has(value)) {
|
|
5741
|
-
return state.cache.get(value);
|
|
5742
|
-
}
|
|
5743
|
-
state.prototype = value.__proto__ || getPrototypeOf(value);
|
|
5744
|
-
state.Constructor = state.prototype && state.prototype.constructor;
|
|
5745
|
-
// plain objects
|
|
5746
|
-
if (!state.Constructor || state.Constructor === Object) {
|
|
5747
|
-
return object(value, state);
|
|
5748
|
-
}
|
|
5749
|
-
// arrays
|
|
5750
|
-
if (isArray(value)) {
|
|
5751
|
-
return array(value, state);
|
|
5752
|
-
}
|
|
5753
|
-
var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
|
|
5754
|
-
if (tagSpecificCopier) {
|
|
5755
|
-
return tagSpecificCopier(value, state);
|
|
5756
|
-
}
|
|
5757
|
-
return typeof value.then === 'function' ? value : object(value, state);
|
|
5758
|
-
}
|
|
5759
|
-
return function copy(value) {
|
|
5760
|
-
return copier(value, {
|
|
5761
|
-
Constructor: undefined,
|
|
5762
|
-
cache: createCache(),
|
|
5763
|
-
copier: copier,
|
|
5764
|
-
prototype: undefined,
|
|
5765
|
-
});
|
|
5766
|
-
};
|
|
5767
|
-
}
|
|
5768
|
-
/**
|
|
5769
|
-
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
|
|
5770
|
-
* same internals as `copyStrict`.
|
|
5771
|
-
*/
|
|
5772
|
-
function createStrictCopier(options) {
|
|
5773
|
-
return createCopier(assign({}, DEFAULT_STRICT_OPTIONS, options));
|
|
5774
|
-
}
|
|
5775
|
-
/**
|
|
5776
|
-
* Copy an value deeply as much as possible, where strict recreation of object properties
|
|
5777
|
-
* are maintained. All properties (including non-enumerable ones) are copied with their
|
|
5778
|
-
* original property descriptors on both objects and arrays.
|
|
5779
|
-
*/
|
|
5780
|
-
var copyStrict = createStrictCopier({});
|
|
5781
|
-
/**
|
|
5782
|
-
* Copy an value deeply as much as possible.
|
|
5783
|
-
*/
|
|
5784
|
-
var index = createCopier({});
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
//# sourceMappingURL=index.mjs.map
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
5272
|
/***/ }),
|
|
5791
5273
|
|
|
5792
5274
|
/***/ "../node_modules/debug/src/browser.js":
|
|
@@ -10531,7 +10013,7 @@ function createClient(params) {
|
|
|
10531
10013
|
environment: 'master'
|
|
10532
10014
|
};
|
|
10533
10015
|
const config = _objectSpread(_objectSpread({}, defaultConfig), params);
|
|
10534
|
-
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.
|
|
10016
|
+
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.10"}`, config.application, config.integration);
|
|
10535
10017
|
config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
10536
10018
|
'Content-Type': 'application/vnd.contentful.delivery.v1+json',
|
|
10537
10019
|
'X-Contentful-User-Agent': userAgentHeader
|