contentful 9.2.5 → 9.2.6
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 +474 -120
- package/dist/contentful.browser.js.map +1 -1
- package/dist/contentful.browser.min.js +3 -3
- package/dist/contentful.node.js +468 -117
- package/dist/contentful.node.js.map +1 -1
- package/dist/contentful.node.min.js +3 -3
- package/dist/es-modules/contentful.js +4 -16
- package/dist/es-modules/create-contentful-api.js +15 -56
- package/dist/es-modules/create-global-options.js +0 -1
- package/dist/es-modules/entities/asset-key.js +0 -4
- package/dist/es-modules/entities/asset.js +1 -6
- package/dist/es-modules/entities/content-type.js +1 -6
- package/dist/es-modules/entities/entry.js +1 -10
- package/dist/es-modules/entities/index.js +0 -10
- package/dist/es-modules/entities/locale.js +1 -6
- package/dist/es-modules/entities/space.js +0 -2
- package/dist/es-modules/entities/tag.js +1 -6
- package/dist/es-modules/mixins/stringify-safe.js +0 -3
- package/dist/es-modules/paged-sync.js +7 -35
- package/dist/es-modules/utils/normalize-select.js +12 -13
- package/dist/es-modules/utils/validate-timestamp.js +0 -7
- package/package.json +1 -1
package/dist/contentful.node.js
CHANGED
|
@@ -4344,7 +4344,7 @@ CombinedStream.prototype._emitError = function(err) {
|
|
|
4344
4344
|
|
|
4345
4345
|
"use strict";
|
|
4346
4346
|
__webpack_require__.r(__webpack_exports__);
|
|
4347
|
-
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/
|
|
4347
|
+
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/contentful-resolve-response/node_modules/fast-copy/dist/esm/index.mjs");
|
|
4348
4348
|
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
4349
4349
|
|
|
4350
4350
|
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
@@ -4498,6 +4498,420 @@ var resolveResponse = function resolveResponse(response, options) {
|
|
|
4498
4498
|
|
|
4499
4499
|
/* harmony default export */ __webpack_exports__["default"] = (resolveResponse);
|
|
4500
4500
|
|
|
4501
|
+
/***/ }),
|
|
4502
|
+
|
|
4503
|
+
/***/ "../node_modules/contentful-resolve-response/node_modules/fast-copy/dist/esm/index.mjs":
|
|
4504
|
+
/*!*********************************************************************************************!*\
|
|
4505
|
+
!*** ../node_modules/contentful-resolve-response/node_modules/fast-copy/dist/esm/index.mjs ***!
|
|
4506
|
+
\*********************************************************************************************/
|
|
4507
|
+
/*! exports provided: copyStrict, createCopier, createStrictCopier, default */
|
|
4508
|
+
/***/ (function(__webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
4509
|
+
|
|
4510
|
+
"use strict";
|
|
4511
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4512
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "copyStrict", function() { return copyStrict; });
|
|
4513
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCopier", function() { return createCopier; });
|
|
4514
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createStrictCopier", function() { return createStrictCopier; });
|
|
4515
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return index; });
|
|
4516
|
+
var toStringFunction = Function.prototype.toString;
|
|
4517
|
+
var create = Object.create;
|
|
4518
|
+
var toStringObject = Object.prototype.toString;
|
|
4519
|
+
/**
|
|
4520
|
+
* @classdesc Fallback cache for when WeakMap is not natively supported
|
|
4521
|
+
*/
|
|
4522
|
+
var LegacyCache = /** @class */ (function () {
|
|
4523
|
+
function LegacyCache() {
|
|
4524
|
+
this._keys = [];
|
|
4525
|
+
this._values = [];
|
|
4526
|
+
}
|
|
4527
|
+
LegacyCache.prototype.has = function (key) {
|
|
4528
|
+
return !!~this._keys.indexOf(key);
|
|
4529
|
+
};
|
|
4530
|
+
LegacyCache.prototype.get = function (key) {
|
|
4531
|
+
return this._values[this._keys.indexOf(key)];
|
|
4532
|
+
};
|
|
4533
|
+
LegacyCache.prototype.set = function (key, value) {
|
|
4534
|
+
this._keys.push(key);
|
|
4535
|
+
this._values.push(value);
|
|
4536
|
+
};
|
|
4537
|
+
return LegacyCache;
|
|
4538
|
+
}());
|
|
4539
|
+
function createCacheLegacy() {
|
|
4540
|
+
return new LegacyCache();
|
|
4541
|
+
}
|
|
4542
|
+
function createCacheModern() {
|
|
4543
|
+
return new WeakMap();
|
|
4544
|
+
}
|
|
4545
|
+
/**
|
|
4546
|
+
* Get a new cache object to prevent circular references.
|
|
4547
|
+
*/
|
|
4548
|
+
var createCache = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
|
|
4549
|
+
/**
|
|
4550
|
+
* Get an empty version of the object with the same prototype it has.
|
|
4551
|
+
*/
|
|
4552
|
+
function getCleanClone(prototype) {
|
|
4553
|
+
if (!prototype) {
|
|
4554
|
+
return create(null);
|
|
4555
|
+
}
|
|
4556
|
+
var Constructor = prototype.constructor;
|
|
4557
|
+
if (Constructor === Object) {
|
|
4558
|
+
return prototype === Object.prototype ? {} : create(prototype);
|
|
4559
|
+
}
|
|
4560
|
+
if (~toStringFunction.call(Constructor).indexOf('[native code]')) {
|
|
4561
|
+
try {
|
|
4562
|
+
return new Constructor();
|
|
4563
|
+
}
|
|
4564
|
+
catch (_a) { }
|
|
4565
|
+
}
|
|
4566
|
+
return create(prototype);
|
|
4567
|
+
}
|
|
4568
|
+
function getRegExpFlagsLegacy(regExp) {
|
|
4569
|
+
var flags = '';
|
|
4570
|
+
if (regExp.global) {
|
|
4571
|
+
flags += 'g';
|
|
4572
|
+
}
|
|
4573
|
+
if (regExp.ignoreCase) {
|
|
4574
|
+
flags += 'i';
|
|
4575
|
+
}
|
|
4576
|
+
if (regExp.multiline) {
|
|
4577
|
+
flags += 'm';
|
|
4578
|
+
}
|
|
4579
|
+
if (regExp.unicode) {
|
|
4580
|
+
flags += 'u';
|
|
4581
|
+
}
|
|
4582
|
+
if (regExp.sticky) {
|
|
4583
|
+
flags += 'y';
|
|
4584
|
+
}
|
|
4585
|
+
return flags;
|
|
4586
|
+
}
|
|
4587
|
+
function getRegExpFlagsModern(regExp) {
|
|
4588
|
+
return regExp.flags;
|
|
4589
|
+
}
|
|
4590
|
+
/**
|
|
4591
|
+
* Get the flags to apply to the copied regexp.
|
|
4592
|
+
*/
|
|
4593
|
+
var getRegExpFlags = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
|
|
4594
|
+
function getTagLegacy(value) {
|
|
4595
|
+
var type = toStringObject.call(value);
|
|
4596
|
+
return type.substring(8, type.length - 1);
|
|
4597
|
+
}
|
|
4598
|
+
function getTagModern(value) {
|
|
4599
|
+
return value[Symbol.toStringTag] || getTagLegacy(value);
|
|
4600
|
+
}
|
|
4601
|
+
/**
|
|
4602
|
+
* Get the tag of the value passed, so that the correct copier can be used.
|
|
4603
|
+
*/
|
|
4604
|
+
var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
|
|
4605
|
+
|
|
4606
|
+
var defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
4607
|
+
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
|
|
4608
|
+
var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols === 'function';
|
|
4609
|
+
function getStrictPropertiesModern(object) {
|
|
4610
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
4611
|
+
}
|
|
4612
|
+
/**
|
|
4613
|
+
* Get the properites used when copying objects strictly. This includes both keys and symbols.
|
|
4614
|
+
*/
|
|
4615
|
+
var getStrictProperties = SUPPORTS_SYMBOL
|
|
4616
|
+
? getStrictPropertiesModern
|
|
4617
|
+
: getOwnPropertyNames;
|
|
4618
|
+
/**
|
|
4619
|
+
* Striclty copy all properties contained on the object.
|
|
4620
|
+
*/
|
|
4621
|
+
function copyOwnPropertiesStrict(value, clone, state) {
|
|
4622
|
+
var properties = getStrictProperties(value);
|
|
4623
|
+
for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
|
|
4624
|
+
property = properties[index];
|
|
4625
|
+
if (property === 'callee' || property === 'caller') {
|
|
4626
|
+
continue;
|
|
4627
|
+
}
|
|
4628
|
+
descriptor = getOwnPropertyDescriptor(value, property);
|
|
4629
|
+
if (!descriptor) {
|
|
4630
|
+
// In extra edge cases where the property descriptor cannot be retrived, fall back to
|
|
4631
|
+
// the loose assignment.
|
|
4632
|
+
clone[property] = state.copier(value[property], state);
|
|
4633
|
+
continue;
|
|
4634
|
+
}
|
|
4635
|
+
// Only clone the value if actually a value, not a getter / setter.
|
|
4636
|
+
if (!descriptor.get && !descriptor.set) {
|
|
4637
|
+
descriptor.value = state.copier(descriptor.value, state);
|
|
4638
|
+
}
|
|
4639
|
+
try {
|
|
4640
|
+
defineProperty(clone, property, descriptor);
|
|
4641
|
+
}
|
|
4642
|
+
catch (error) {
|
|
4643
|
+
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
|
|
4644
|
+
clone[property] = descriptor.value;
|
|
4645
|
+
}
|
|
4646
|
+
}
|
|
4647
|
+
return clone;
|
|
4648
|
+
}
|
|
4649
|
+
/**
|
|
4650
|
+
* Deeply copy the indexed values in the array.
|
|
4651
|
+
*/
|
|
4652
|
+
function copyArrayLoose(array, state) {
|
|
4653
|
+
var clone = new state.Constructor();
|
|
4654
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4655
|
+
state.cache.set(array, clone);
|
|
4656
|
+
for (var index = 0, length_2 = array.length; index < length_2; ++index) {
|
|
4657
|
+
clone[index] = state.copier(array[index], state);
|
|
4658
|
+
}
|
|
4659
|
+
return clone;
|
|
4660
|
+
}
|
|
4661
|
+
/**
|
|
4662
|
+
* Deeply copy the indexed values in the array, as well as any custom properties.
|
|
4663
|
+
*/
|
|
4664
|
+
function copyArrayStrict(array, state) {
|
|
4665
|
+
var clone = new state.Constructor();
|
|
4666
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4667
|
+
state.cache.set(array, clone);
|
|
4668
|
+
return copyOwnPropertiesStrict(array, clone, state);
|
|
4669
|
+
}
|
|
4670
|
+
/**
|
|
4671
|
+
* Copy the contents of the ArrayBuffer.
|
|
4672
|
+
*/
|
|
4673
|
+
function copyArrayBuffer(arrayBuffer, _state) {
|
|
4674
|
+
return arrayBuffer.slice(0);
|
|
4675
|
+
}
|
|
4676
|
+
/**
|
|
4677
|
+
* Create a new Blob with the contents of the original.
|
|
4678
|
+
*/
|
|
4679
|
+
function copyBlob(blob, _state) {
|
|
4680
|
+
return blob.slice(0, blob.size, blob.type);
|
|
4681
|
+
}
|
|
4682
|
+
/**
|
|
4683
|
+
* Create a new DataView with the contents of the original.
|
|
4684
|
+
*/
|
|
4685
|
+
function copyDataView(dataView, state) {
|
|
4686
|
+
return new state.Constructor(copyArrayBuffer(dataView.buffer));
|
|
4687
|
+
}
|
|
4688
|
+
/**
|
|
4689
|
+
* Create a new Date based on the time of the original.
|
|
4690
|
+
*/
|
|
4691
|
+
function copyDate(date, state) {
|
|
4692
|
+
return new state.Constructor(date.getTime());
|
|
4693
|
+
}
|
|
4694
|
+
/**
|
|
4695
|
+
* Deeply copy the keys and values of the original.
|
|
4696
|
+
*/
|
|
4697
|
+
function copyMapLoose(map, state) {
|
|
4698
|
+
var clone = new state.Constructor();
|
|
4699
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4700
|
+
state.cache.set(map, clone);
|
|
4701
|
+
map.forEach(function (value, key) {
|
|
4702
|
+
clone.set(key, state.copier(value, state));
|
|
4703
|
+
});
|
|
4704
|
+
return clone;
|
|
4705
|
+
}
|
|
4706
|
+
/**
|
|
4707
|
+
* Deeply copy the keys and values of the original, as well as any custom properties.
|
|
4708
|
+
*/
|
|
4709
|
+
function copyMapStrict(map, state) {
|
|
4710
|
+
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
|
|
4711
|
+
}
|
|
4712
|
+
function copyObjectLooseLegacy(object, state) {
|
|
4713
|
+
var clone = getCleanClone(state.prototype);
|
|
4714
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4715
|
+
state.cache.set(object, clone);
|
|
4716
|
+
for (var key in object) {
|
|
4717
|
+
if (hasOwnProperty.call(object, key)) {
|
|
4718
|
+
clone[key] = state.copier(object[key], state);
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
return clone;
|
|
4722
|
+
}
|
|
4723
|
+
function copyObjectLooseModern(object, state) {
|
|
4724
|
+
var clone = getCleanClone(state.prototype);
|
|
4725
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4726
|
+
state.cache.set(object, clone);
|
|
4727
|
+
for (var key in object) {
|
|
4728
|
+
if (hasOwnProperty.call(object, key)) {
|
|
4729
|
+
clone[key] = state.copier(object[key], state);
|
|
4730
|
+
}
|
|
4731
|
+
}
|
|
4732
|
+
var symbols = getOwnPropertySymbols(object);
|
|
4733
|
+
for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
|
|
4734
|
+
symbol = symbols[index];
|
|
4735
|
+
if (propertyIsEnumerable.call(object, symbol)) {
|
|
4736
|
+
clone[symbol] = state.copier(object[symbol], state);
|
|
4737
|
+
}
|
|
4738
|
+
}
|
|
4739
|
+
return clone;
|
|
4740
|
+
}
|
|
4741
|
+
/**
|
|
4742
|
+
* Deeply copy the properties (keys and symbols) and values of the original.
|
|
4743
|
+
*/
|
|
4744
|
+
var copyObjectLoose = SUPPORTS_SYMBOL
|
|
4745
|
+
? copyObjectLooseModern
|
|
4746
|
+
: copyObjectLooseLegacy;
|
|
4747
|
+
/**
|
|
4748
|
+
* Deeply copy the properties (keys and symbols) and values of the original, as well
|
|
4749
|
+
* as any hidden or non-enumerable properties.
|
|
4750
|
+
*/
|
|
4751
|
+
function copyObjectStrict(object, state) {
|
|
4752
|
+
var clone = getCleanClone(state.prototype);
|
|
4753
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4754
|
+
state.cache.set(object, clone);
|
|
4755
|
+
return copyOwnPropertiesStrict(object, clone, state);
|
|
4756
|
+
}
|
|
4757
|
+
/**
|
|
4758
|
+
* Create a new primitive wrapper from the value of the original.
|
|
4759
|
+
*/
|
|
4760
|
+
function copyPrimitiveWrapper(primitiveObject, state) {
|
|
4761
|
+
return new state.Constructor(primitiveObject.valueOf());
|
|
4762
|
+
}
|
|
4763
|
+
/**
|
|
4764
|
+
* Create a new RegExp based on the value and flags of the original.
|
|
4765
|
+
*/
|
|
4766
|
+
function copyRegExp(regExp, state) {
|
|
4767
|
+
var clone = new state.Constructor(regExp.source, getRegExpFlags(regExp));
|
|
4768
|
+
clone.lastIndex = regExp.lastIndex;
|
|
4769
|
+
return clone;
|
|
4770
|
+
}
|
|
4771
|
+
/**
|
|
4772
|
+
* Return the original value (an identity function).
|
|
4773
|
+
*
|
|
4774
|
+
* @note
|
|
4775
|
+
* THis is used for objects that cannot be copied, such as WeakMap.
|
|
4776
|
+
*/
|
|
4777
|
+
function copySelf(value, _state) {
|
|
4778
|
+
return value;
|
|
4779
|
+
}
|
|
4780
|
+
/**
|
|
4781
|
+
* Deeply copy the values of the original.
|
|
4782
|
+
*/
|
|
4783
|
+
function copySetLoose(set, state) {
|
|
4784
|
+
var clone = new state.Constructor();
|
|
4785
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4786
|
+
state.cache.set(set, clone);
|
|
4787
|
+
set.forEach(function (value) {
|
|
4788
|
+
clone.add(state.copier(value, state));
|
|
4789
|
+
});
|
|
4790
|
+
return clone;
|
|
4791
|
+
}
|
|
4792
|
+
/**
|
|
4793
|
+
* Deeply copy the values of the original, as well as any custom properties.
|
|
4794
|
+
*/
|
|
4795
|
+
function copySetStrict(set, state) {
|
|
4796
|
+
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
|
|
4797
|
+
}
|
|
4798
|
+
|
|
4799
|
+
var isArray = Array.isArray;
|
|
4800
|
+
var assign = Object.assign, getPrototypeOf = Object.getPrototypeOf;
|
|
4801
|
+
var DEFAULT_LOOSE_OPTIONS = {
|
|
4802
|
+
array: copyArrayLoose,
|
|
4803
|
+
arrayBuffer: copyArrayBuffer,
|
|
4804
|
+
blob: copyBlob,
|
|
4805
|
+
dataView: copyDataView,
|
|
4806
|
+
date: copyDate,
|
|
4807
|
+
error: copySelf,
|
|
4808
|
+
map: copyMapLoose,
|
|
4809
|
+
object: copyObjectLoose,
|
|
4810
|
+
regExp: copyRegExp,
|
|
4811
|
+
set: copySetLoose,
|
|
4812
|
+
};
|
|
4813
|
+
var DEFAULT_STRICT_OPTIONS = assign({}, DEFAULT_LOOSE_OPTIONS, {
|
|
4814
|
+
array: copyArrayStrict,
|
|
4815
|
+
map: copyMapStrict,
|
|
4816
|
+
object: copyObjectStrict,
|
|
4817
|
+
set: copySetStrict,
|
|
4818
|
+
});
|
|
4819
|
+
/**
|
|
4820
|
+
* Get the copiers used for each specific object tag.
|
|
4821
|
+
*/
|
|
4822
|
+
function getTagSpecificCopiers(options) {
|
|
4823
|
+
return {
|
|
4824
|
+
Arguments: options.object,
|
|
4825
|
+
Array: options.array,
|
|
4826
|
+
ArrayBuffer: options.arrayBuffer,
|
|
4827
|
+
Blob: options.blob,
|
|
4828
|
+
Boolean: copyPrimitiveWrapper,
|
|
4829
|
+
DataView: options.dataView,
|
|
4830
|
+
Date: options.date,
|
|
4831
|
+
Error: options.error,
|
|
4832
|
+
Float32Array: options.arrayBuffer,
|
|
4833
|
+
Float64Array: options.arrayBuffer,
|
|
4834
|
+
Int8Array: options.arrayBuffer,
|
|
4835
|
+
Int16Array: options.arrayBuffer,
|
|
4836
|
+
Int32Array: options.arrayBuffer,
|
|
4837
|
+
Map: options.map,
|
|
4838
|
+
Number: copyPrimitiveWrapper,
|
|
4839
|
+
Object: options.object,
|
|
4840
|
+
Promise: copySelf,
|
|
4841
|
+
RegExp: options.regExp,
|
|
4842
|
+
Set: options.set,
|
|
4843
|
+
String: copyPrimitiveWrapper,
|
|
4844
|
+
WeakMap: copySelf,
|
|
4845
|
+
WeakSet: copySelf,
|
|
4846
|
+
Uint8Array: options.arrayBuffer,
|
|
4847
|
+
Uint8ClampedArray: options.arrayBuffer,
|
|
4848
|
+
Uint16Array: options.arrayBuffer,
|
|
4849
|
+
Uint32Array: options.arrayBuffer,
|
|
4850
|
+
Uint64Array: options.arrayBuffer,
|
|
4851
|
+
};
|
|
4852
|
+
}
|
|
4853
|
+
/**
|
|
4854
|
+
* Create a custom copier based on the object-specific copy methods passed.
|
|
4855
|
+
*/
|
|
4856
|
+
function createCopier(options) {
|
|
4857
|
+
var normalizedOptions = assign({}, DEFAULT_LOOSE_OPTIONS, options);
|
|
4858
|
+
var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
|
|
4859
|
+
var array = tagSpecificCopiers.Array, object = tagSpecificCopiers.Object;
|
|
4860
|
+
function copier(value, state) {
|
|
4861
|
+
state.prototype = state.Constructor = undefined;
|
|
4862
|
+
if (!value || typeof value !== 'object') {
|
|
4863
|
+
return value;
|
|
4864
|
+
}
|
|
4865
|
+
if (state.cache.has(value)) {
|
|
4866
|
+
return state.cache.get(value);
|
|
4867
|
+
}
|
|
4868
|
+
state.prototype = value.__proto__ || getPrototypeOf(value);
|
|
4869
|
+
state.Constructor = state.prototype && state.prototype.constructor;
|
|
4870
|
+
// plain objects
|
|
4871
|
+
if (!state.Constructor || state.Constructor === Object) {
|
|
4872
|
+
return object(value, state);
|
|
4873
|
+
}
|
|
4874
|
+
// arrays
|
|
4875
|
+
if (isArray(value)) {
|
|
4876
|
+
return array(value, state);
|
|
4877
|
+
}
|
|
4878
|
+
var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
|
|
4879
|
+
if (tagSpecificCopier) {
|
|
4880
|
+
return tagSpecificCopier(value, state);
|
|
4881
|
+
}
|
|
4882
|
+
return typeof value.then === 'function' ? value : object(value, state);
|
|
4883
|
+
}
|
|
4884
|
+
return function copy(value) {
|
|
4885
|
+
return copier(value, {
|
|
4886
|
+
Constructor: undefined,
|
|
4887
|
+
cache: createCache(),
|
|
4888
|
+
copier: copier,
|
|
4889
|
+
prototype: undefined,
|
|
4890
|
+
});
|
|
4891
|
+
};
|
|
4892
|
+
}
|
|
4893
|
+
/**
|
|
4894
|
+
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
|
|
4895
|
+
* same internals as `copyStrict`.
|
|
4896
|
+
*/
|
|
4897
|
+
function createStrictCopier(options) {
|
|
4898
|
+
return createCopier(assign({}, DEFAULT_STRICT_OPTIONS, options));
|
|
4899
|
+
}
|
|
4900
|
+
/**
|
|
4901
|
+
* Copy an value deeply as much as possible, where strict recreation of object properties
|
|
4902
|
+
* are maintained. All properties (including non-enumerable ones) are copied with their
|
|
4903
|
+
* original property descriptors on both objects and arrays.
|
|
4904
|
+
*/
|
|
4905
|
+
var copyStrict = createStrictCopier({});
|
|
4906
|
+
/**
|
|
4907
|
+
* Copy an value deeply as much as possible.
|
|
4908
|
+
*/
|
|
4909
|
+
var index = createCopier({});
|
|
4910
|
+
|
|
4911
|
+
|
|
4912
|
+
//# sourceMappingURL=index.mjs.map
|
|
4913
|
+
|
|
4914
|
+
|
|
4501
4915
|
/***/ }),
|
|
4502
4916
|
|
|
4503
4917
|
/***/ "../node_modules/contentful-sdk-core/dist/index.es-modules.js":
|
|
@@ -10041,11 +10455,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10041
10455
|
/* harmony import */ var _create_contentful_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./create-contentful-api */ "./create-contentful-api.js");
|
|
10042
10456
|
/* harmony import */ var _create_global_options__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./create-global-options */ "./create-global-options.js");
|
|
10043
10457
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10044
|
-
|
|
10045
10458
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10046
|
-
|
|
10047
10459
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10048
|
-
|
|
10049
10460
|
/**
|
|
10050
10461
|
* Contentful Delivery API SDK. Allows you to create instances of a client
|
|
10051
10462
|
* with access to the Contentful Content Delivery API.
|
|
@@ -10056,6 +10467,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10056
10467
|
|
|
10057
10468
|
|
|
10058
10469
|
|
|
10470
|
+
|
|
10471
|
+
|
|
10059
10472
|
/**
|
|
10060
10473
|
* Create a client instance
|
|
10061
10474
|
* @func
|
|
@@ -10094,21 +10507,17 @@ function createClient(params) {
|
|
|
10094
10507
|
if (!params.accessToken) {
|
|
10095
10508
|
throw new TypeError('Expected parameter accessToken');
|
|
10096
10509
|
}
|
|
10097
|
-
|
|
10098
10510
|
if (!params.space) {
|
|
10099
10511
|
throw new TypeError('Expected parameter space');
|
|
10100
10512
|
}
|
|
10101
|
-
|
|
10102
10513
|
const defaultConfig = {
|
|
10103
10514
|
resolveLinks: true,
|
|
10104
10515
|
removeUnresolved: false,
|
|
10105
10516
|
defaultHostname: 'cdn.contentful.com',
|
|
10106
10517
|
environment: 'master'
|
|
10107
10518
|
};
|
|
10108
|
-
|
|
10109
10519
|
const config = _objectSpread(_objectSpread({}, defaultConfig), params);
|
|
10110
|
-
|
|
10111
|
-
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.5"}`, config.application, config.integration);
|
|
10520
|
+
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.6"}`, config.application, config.integration);
|
|
10112
10521
|
config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
10113
10522
|
'Content-Type': 'application/vnd.contentful.delivery.v1+json',
|
|
10114
10523
|
'X-Contentful-User-Agent': userAgentHeader
|
|
@@ -10120,8 +10529,8 @@ function createClient(params) {
|
|
|
10120
10529
|
removeUnresolved: config.removeUnresolved,
|
|
10121
10530
|
spaceBaseUrl: http.defaults.baseURL,
|
|
10122
10531
|
environmentBaseUrl: `${http.defaults.baseURL}environments/${config.environment}`
|
|
10123
|
-
});
|
|
10124
|
-
|
|
10532
|
+
});
|
|
10533
|
+
// Append environment to baseURL
|
|
10125
10534
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
10126
10535
|
return Object(_create_contentful_api__WEBPACK_IMPORTED_MODULE_2__["default"])({
|
|
10127
10536
|
http,
|
|
@@ -10147,11 +10556,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10147
10556
|
/* harmony import */ var _utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/normalize-select */ "./utils/normalize-select.js");
|
|
10148
10557
|
/* harmony import */ var _utils_validate_timestamp__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/validate-timestamp */ "./utils/validate-timestamp.js");
|
|
10149
10558
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10150
|
-
|
|
10151
10559
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10152
|
-
|
|
10153
10560
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10154
|
-
|
|
10155
10561
|
/**
|
|
10156
10562
|
* Contentful Delivery API Client. Contains methods which allow access to the
|
|
10157
10563
|
* different kinds of entities present in Contentful (Entries, Assets, etc).
|
|
@@ -10215,7 +10621,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10215
10621
|
|
|
10216
10622
|
|
|
10217
10623
|
|
|
10624
|
+
|
|
10218
10625
|
const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
10626
|
+
|
|
10219
10627
|
/**
|
|
10220
10628
|
* Creates API object with methods to access functionality from Contentful's
|
|
10221
10629
|
* Delivery API
|
|
@@ -10226,7 +10634,6 @@ const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
|
10226
10634
|
* @prop {Function} getGlobalOptions - Link resolver preconfigured with global setting
|
|
10227
10635
|
* @return {ClientAPI}
|
|
10228
10636
|
*/
|
|
10229
|
-
|
|
10230
10637
|
function createContentfulApi({
|
|
10231
10638
|
http,
|
|
10232
10639
|
getGlobalOptions
|
|
@@ -10256,7 +10663,6 @@ function createContentfulApi({
|
|
|
10256
10663
|
const {
|
|
10257
10664
|
wrapLocaleCollection
|
|
10258
10665
|
} = _entities__WEBPACK_IMPORTED_MODULE_1__["default"].locale;
|
|
10259
|
-
|
|
10260
10666
|
const notFoundError = id => {
|
|
10261
10667
|
const error = new Error('The resource could not be found.');
|
|
10262
10668
|
error.sys = {
|
|
@@ -10271,6 +10677,7 @@ function createContentfulApi({
|
|
|
10271
10677
|
};
|
|
10272
10678
|
return error;
|
|
10273
10679
|
};
|
|
10680
|
+
|
|
10274
10681
|
/**
|
|
10275
10682
|
* Gets the Space which the client is currently configured to use
|
|
10276
10683
|
* @memberof ContentfulClientAPI
|
|
@@ -10286,11 +10693,8 @@ function createContentfulApi({
|
|
|
10286
10693
|
* const space = await client.getSpace()
|
|
10287
10694
|
* console.log(space)
|
|
10288
10695
|
*/
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
10696
|
async function getSpace() {
|
|
10292
10697
|
switchToSpace(http);
|
|
10293
|
-
|
|
10294
10698
|
try {
|
|
10295
10699
|
const response = await http.get('/');
|
|
10296
10700
|
return wrapSpace(response.data);
|
|
@@ -10298,6 +10702,7 @@ function createContentfulApi({
|
|
|
10298
10702
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10299
10703
|
}
|
|
10300
10704
|
}
|
|
10705
|
+
|
|
10301
10706
|
/**
|
|
10302
10707
|
* Gets a Content Type
|
|
10303
10708
|
* @memberof ContentfulClientAPI
|
|
@@ -10314,11 +10719,8 @@ function createContentfulApi({
|
|
|
10314
10719
|
* const contentType = await client.getContentType('<content_type_id>')
|
|
10315
10720
|
* console.log(contentType)
|
|
10316
10721
|
*/
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
10722
|
async function getContentType(id) {
|
|
10320
10723
|
switchToEnvironment(http);
|
|
10321
|
-
|
|
10322
10724
|
try {
|
|
10323
10725
|
const response = await http.get(`content_types/${id}`);
|
|
10324
10726
|
return wrapContentType(response.data);
|
|
@@ -10326,6 +10728,7 @@ function createContentfulApi({
|
|
|
10326
10728
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10327
10729
|
}
|
|
10328
10730
|
}
|
|
10731
|
+
|
|
10329
10732
|
/**
|
|
10330
10733
|
* Gets a collection of Content Types
|
|
10331
10734
|
* @memberof ContentfulClientAPI
|
|
@@ -10342,11 +10745,8 @@ function createContentfulApi({
|
|
|
10342
10745
|
* const response = await client.getContentTypes()
|
|
10343
10746
|
* console.log(response.items)
|
|
10344
10747
|
*/
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
10748
|
async function getContentTypes(query = {}) {
|
|
10348
10749
|
switchToEnvironment(http);
|
|
10349
|
-
|
|
10350
10750
|
try {
|
|
10351
10751
|
const response = await http.get('content_types', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10352
10752
|
query: query
|
|
@@ -10356,6 +10756,7 @@ function createContentfulApi({
|
|
|
10356
10756
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10357
10757
|
}
|
|
10358
10758
|
}
|
|
10759
|
+
|
|
10359
10760
|
/**
|
|
10360
10761
|
* Gets an Entry
|
|
10361
10762
|
* @memberof ContentfulClientAPI
|
|
@@ -10373,18 +10774,14 @@ function createContentfulApi({
|
|
|
10373
10774
|
* const entry = await client.getEntry('<entry_id>')
|
|
10374
10775
|
* console.log(entry)
|
|
10375
10776
|
*/
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
10777
|
async function getEntry(id, query = {}) {
|
|
10379
10778
|
if (!id) {
|
|
10380
10779
|
throw notFoundError(id);
|
|
10381
10780
|
}
|
|
10382
|
-
|
|
10383
10781
|
try {
|
|
10384
10782
|
const response = await this.getEntries(_objectSpread({
|
|
10385
10783
|
'sys.id': id
|
|
10386
10784
|
}, query));
|
|
10387
|
-
|
|
10388
10785
|
if (response.items.length > 0) {
|
|
10389
10786
|
return wrapEntry(response.items[0]);
|
|
10390
10787
|
} else {
|
|
@@ -10394,6 +10791,7 @@ function createContentfulApi({
|
|
|
10394
10791
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10395
10792
|
}
|
|
10396
10793
|
}
|
|
10794
|
+
|
|
10397
10795
|
/**
|
|
10398
10796
|
* Gets a collection of Entries
|
|
10399
10797
|
* @memberof ContentfulClientAPI
|
|
@@ -10410,8 +10808,6 @@ function createContentfulApi({
|
|
|
10410
10808
|
* const response = await client.getEntries()
|
|
10411
10809
|
* console.log(response.items)
|
|
10412
10810
|
*/
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
10811
|
async function getEntries(query = {}) {
|
|
10416
10812
|
switchToEnvironment(http);
|
|
10417
10813
|
const {
|
|
@@ -10419,7 +10815,6 @@ function createContentfulApi({
|
|
|
10419
10815
|
removeUnresolved
|
|
10420
10816
|
} = getGlobalOptions(query);
|
|
10421
10817
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
10422
|
-
|
|
10423
10818
|
try {
|
|
10424
10819
|
const response = await http.get('entries', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10425
10820
|
query: query
|
|
@@ -10449,12 +10844,9 @@ function createContentfulApi({
|
|
|
10449
10844
|
* const asset = await client.getAsset('<asset_id>')
|
|
10450
10845
|
* console.log(asset)
|
|
10451
10846
|
*/
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
10847
|
async function getAsset(id, query = {}) {
|
|
10455
10848
|
switchToEnvironment(http);
|
|
10456
10849
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
10457
|
-
|
|
10458
10850
|
try {
|
|
10459
10851
|
const response = await http.get(`assets/${id}`, Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10460
10852
|
query: query
|
|
@@ -10464,6 +10856,7 @@ function createContentfulApi({
|
|
|
10464
10856
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10465
10857
|
}
|
|
10466
10858
|
}
|
|
10859
|
+
|
|
10467
10860
|
/**
|
|
10468
10861
|
* Gets a collection of Assets
|
|
10469
10862
|
* @memberof ContentfulClientAPI
|
|
@@ -10480,12 +10873,9 @@ function createContentfulApi({
|
|
|
10480
10873
|
* const response = await client.getAssets()
|
|
10481
10874
|
* console.log(response.items)
|
|
10482
10875
|
*/
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
10876
|
async function getAssets(query = {}) {
|
|
10486
10877
|
switchToEnvironment(http);
|
|
10487
10878
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
10488
|
-
|
|
10489
10879
|
try {
|
|
10490
10880
|
const response = await http.get('assets', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10491
10881
|
query: query
|
|
@@ -10495,6 +10885,7 @@ function createContentfulApi({
|
|
|
10495
10885
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10496
10886
|
}
|
|
10497
10887
|
}
|
|
10888
|
+
|
|
10498
10889
|
/**
|
|
10499
10890
|
* Gets a Tag
|
|
10500
10891
|
* @memberof ContentfulClientAPI
|
|
@@ -10511,11 +10902,8 @@ function createContentfulApi({
|
|
|
10511
10902
|
* const tag = await client.getTag('<asset_id>')
|
|
10512
10903
|
* console.log(tag)
|
|
10513
10904
|
*/
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
10905
|
async function getTag(id) {
|
|
10517
10906
|
switchToEnvironment(http);
|
|
10518
|
-
|
|
10519
10907
|
try {
|
|
10520
10908
|
const response = await http.get(`tags/${id}`);
|
|
10521
10909
|
return wrapTag(response.data);
|
|
@@ -10523,6 +10911,7 @@ function createContentfulApi({
|
|
|
10523
10911
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10524
10912
|
}
|
|
10525
10913
|
}
|
|
10914
|
+
|
|
10526
10915
|
/**
|
|
10527
10916
|
* Gets a collection of Tags
|
|
10528
10917
|
* @memberof ContentfulClientAPI
|
|
@@ -10539,12 +10928,9 @@ function createContentfulApi({
|
|
|
10539
10928
|
* const response = await client.getTags()
|
|
10540
10929
|
* console.log(response.items)
|
|
10541
10930
|
*/
|
|
10542
|
-
|
|
10543
|
-
|
|
10544
10931
|
async function getTags(query = {}) {
|
|
10545
10932
|
switchToEnvironment(http);
|
|
10546
10933
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
10547
|
-
|
|
10548
10934
|
try {
|
|
10549
10935
|
const response = await http.get('tags', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10550
10936
|
query: query
|
|
@@ -10554,6 +10940,7 @@ function createContentfulApi({
|
|
|
10554
10940
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10555
10941
|
}
|
|
10556
10942
|
}
|
|
10943
|
+
|
|
10557
10944
|
/**
|
|
10558
10945
|
* Creates an asset key for signing asset URLs (Embargoed Assets)
|
|
10559
10946
|
* @memberof ContentfulClientAPI
|
|
@@ -10570,11 +10957,8 @@ function createContentfulApi({
|
|
|
10570
10957
|
* const assetKey = await client.getAssetKey(<UNIX timestamp>)
|
|
10571
10958
|
* console.log(assetKey)
|
|
10572
10959
|
*/
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
10960
|
async function createAssetKey(expiresAt) {
|
|
10576
10961
|
switchToEnvironment(http);
|
|
10577
|
-
|
|
10578
10962
|
try {
|
|
10579
10963
|
const now = Math.floor(Date.now() / 1000);
|
|
10580
10964
|
const currentMaxLifetime = now + ASSET_KEY_MAX_LIFETIME;
|
|
@@ -10591,6 +10975,7 @@ function createContentfulApi({
|
|
|
10591
10975
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10592
10976
|
}
|
|
10593
10977
|
}
|
|
10978
|
+
|
|
10594
10979
|
/**
|
|
10595
10980
|
* Gets a collection of Locale
|
|
10596
10981
|
* @memberof ContentfulClientAPI
|
|
@@ -10607,11 +10992,8 @@ function createContentfulApi({
|
|
|
10607
10992
|
* const response = await client.getLocales()
|
|
10608
10993
|
* console.log(response.items)
|
|
10609
10994
|
*/
|
|
10610
|
-
|
|
10611
|
-
|
|
10612
10995
|
async function getLocales(query = {}) {
|
|
10613
10996
|
switchToEnvironment(http);
|
|
10614
|
-
|
|
10615
10997
|
try {
|
|
10616
10998
|
const response = await http.get('locales', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10617
10999
|
query: query
|
|
@@ -10621,6 +11003,7 @@ function createContentfulApi({
|
|
|
10621
11003
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
10622
11004
|
}
|
|
10623
11005
|
}
|
|
11006
|
+
|
|
10624
11007
|
/**
|
|
10625
11008
|
* Synchronizes either all the content or only new content since last sync
|
|
10626
11009
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
@@ -10654,8 +11037,6 @@ function createContentfulApi({
|
|
|
10654
11037
|
* nextSyncToken: response.nextSyncToken
|
|
10655
11038
|
* })
|
|
10656
11039
|
*/
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
11040
|
async function sync(query = {}, options = {
|
|
10660
11041
|
paginate: true
|
|
10661
11042
|
}) {
|
|
@@ -10669,6 +11050,7 @@ function createContentfulApi({
|
|
|
10669
11050
|
removeUnresolved
|
|
10670
11051
|
}, options));
|
|
10671
11052
|
}
|
|
11053
|
+
|
|
10672
11054
|
/**
|
|
10673
11055
|
* Parse raw json data into collection of entry objects.Links will be resolved also
|
|
10674
11056
|
* @memberof ContentfulClientAPI
|
|
@@ -10699,8 +11081,6 @@ function createContentfulApi({
|
|
|
10699
11081
|
* let parsedData = client.parseEntries(data);
|
|
10700
11082
|
* console.log( parsedData.items[0].fields.foo ); // foo
|
|
10701
11083
|
*/
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
11084
|
function parseEntries(data) {
|
|
10705
11085
|
const {
|
|
10706
11086
|
resolveLinks,
|
|
@@ -10711,23 +11091,20 @@ function createContentfulApi({
|
|
|
10711
11091
|
removeUnresolved
|
|
10712
11092
|
});
|
|
10713
11093
|
}
|
|
11094
|
+
|
|
10714
11095
|
/*
|
|
10715
11096
|
* Switches BaseURL to use /environments path
|
|
10716
11097
|
* */
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
11098
|
function switchToEnvironment(http) {
|
|
10720
11099
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
10721
11100
|
}
|
|
11101
|
+
|
|
10722
11102
|
/*
|
|
10723
11103
|
* Switches BaseURL to use /spaces path
|
|
10724
11104
|
* */
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
11105
|
function switchToSpace(http) {
|
|
10728
11106
|
http.defaults.baseURL = getGlobalOptions().spaceBaseUrl;
|
|
10729
11107
|
}
|
|
10730
|
-
|
|
10731
11108
|
return {
|
|
10732
11109
|
getSpace,
|
|
10733
11110
|
getContentType,
|
|
@@ -10790,6 +11167,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10790
11167
|
/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! contentful-sdk-core */ "../node_modules/contentful-sdk-core/dist/index.es-modules.js");
|
|
10791
11168
|
|
|
10792
11169
|
|
|
11170
|
+
|
|
10793
11171
|
/**
|
|
10794
11172
|
* @memberof Entities
|
|
10795
11173
|
* @typedef AssetKey
|
|
@@ -10803,7 +11181,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10803
11181
|
* @param {Object} data - Raw asset key data
|
|
10804
11182
|
* @return {Asset} Wrapped asset key data
|
|
10805
11183
|
*/
|
|
10806
|
-
|
|
10807
11184
|
function wrapAssetKey(data) {
|
|
10808
11185
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
10809
11186
|
}
|
|
@@ -10825,6 +11202,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10825
11202
|
/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! contentful-sdk-core */ "../node_modules/contentful-sdk-core/dist/index.es-modules.js");
|
|
10826
11203
|
|
|
10827
11204
|
|
|
11205
|
+
|
|
10828
11206
|
/**
|
|
10829
11207
|
* @memberof Entities
|
|
10830
11208
|
* @typedef Asset
|
|
@@ -10846,10 +11224,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10846
11224
|
* @param {Object} data - Raw asset data
|
|
10847
11225
|
* @return {Asset} Wrapped asset data
|
|
10848
11226
|
*/
|
|
10849
|
-
|
|
10850
11227
|
function wrapAsset(data) {
|
|
10851
11228
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
10852
11229
|
}
|
|
11230
|
+
|
|
10853
11231
|
/**
|
|
10854
11232
|
* @memberof Entities
|
|
10855
11233
|
* @typedef AssetCollection
|
|
@@ -10865,7 +11243,6 @@ function wrapAsset(data) {
|
|
|
10865
11243
|
* @param {Object} data - Raw asset collection data
|
|
10866
11244
|
* @return {AssetCollection} Wrapped asset collection data
|
|
10867
11245
|
*/
|
|
10868
|
-
|
|
10869
11246
|
function wrapAssetCollection(data) {
|
|
10870
11247
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
10871
11248
|
}
|
|
@@ -10887,6 +11264,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10887
11264
|
/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! contentful-sdk-core */ "../node_modules/contentful-sdk-core/dist/index.es-modules.js");
|
|
10888
11265
|
|
|
10889
11266
|
|
|
11267
|
+
|
|
10890
11268
|
/**
|
|
10891
11269
|
* @memberof Entities
|
|
10892
11270
|
* @typedef ContentType
|
|
@@ -10903,10 +11281,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10903
11281
|
* @param {Object} data - Raw content type data
|
|
10904
11282
|
* @return {ContentType} Wrapped content type data
|
|
10905
11283
|
*/
|
|
10906
|
-
|
|
10907
11284
|
function wrapContentType(data) {
|
|
10908
11285
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
10909
11286
|
}
|
|
11287
|
+
|
|
10910
11288
|
/**
|
|
10911
11289
|
* @memberof Entities
|
|
10912
11290
|
* @typedef ContentTypeCollection
|
|
@@ -10922,7 +11300,6 @@ function wrapContentType(data) {
|
|
|
10922
11300
|
* @param {Object} data - Raw content type collection data
|
|
10923
11301
|
* @return {ContentTypeCollection} Wrapped content type collection data
|
|
10924
11302
|
*/
|
|
10925
|
-
|
|
10926
11303
|
function wrapContentTypeCollection(data) {
|
|
10927
11304
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
10928
11305
|
}
|
|
@@ -10948,6 +11325,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10948
11325
|
|
|
10949
11326
|
|
|
10950
11327
|
|
|
11328
|
+
|
|
10951
11329
|
/**
|
|
10952
11330
|
* Types of fields found in an Entry
|
|
10953
11331
|
* @namespace EntryFields
|
|
@@ -11018,10 +11396,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11018
11396
|
* @param {Object} data - Raw entry data
|
|
11019
11397
|
* @return {Entry} Wrapped entry data
|
|
11020
11398
|
*/
|
|
11021
|
-
|
|
11022
11399
|
function wrapEntry(data) {
|
|
11023
11400
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
11024
11401
|
}
|
|
11402
|
+
|
|
11025
11403
|
/**
|
|
11026
11404
|
* @memberof Entities
|
|
11027
11405
|
* @typedef EntryCollection
|
|
@@ -11042,20 +11420,17 @@ function wrapEntry(data) {
|
|
|
11042
11420
|
* @param {Object} options - wrapper options
|
|
11043
11421
|
* @return {EntryCollection} Wrapped entry collection data
|
|
11044
11422
|
*/
|
|
11045
|
-
|
|
11046
11423
|
function wrapEntryCollection(data, {
|
|
11047
11424
|
resolveLinks,
|
|
11048
11425
|
removeUnresolved
|
|
11049
11426
|
}) {
|
|
11050
11427
|
const wrappedData = Object(_mixins_stringify_safe__WEBPACK_IMPORTED_MODULE_2__["default"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
11051
|
-
|
|
11052
11428
|
if (resolveLinks) {
|
|
11053
11429
|
wrappedData.items = Object(contentful_resolve_response__WEBPACK_IMPORTED_MODULE_3__["default"])(wrappedData, {
|
|
11054
11430
|
removeUnresolved,
|
|
11055
11431
|
itemEntryPoints: ['fields']
|
|
11056
11432
|
});
|
|
11057
11433
|
}
|
|
11058
|
-
|
|
11059
11434
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(wrappedData);
|
|
11060
11435
|
}
|
|
11061
11436
|
|
|
@@ -11111,6 +11486,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11111
11486
|
/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! contentful-sdk-core */ "../node_modules/contentful-sdk-core/dist/index.es-modules.js");
|
|
11112
11487
|
|
|
11113
11488
|
|
|
11489
|
+
|
|
11114
11490
|
/**
|
|
11115
11491
|
* @memberof Entities
|
|
11116
11492
|
* @typedef Locale
|
|
@@ -11128,10 +11504,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11128
11504
|
* @param {Object} data - Raw locale data
|
|
11129
11505
|
* @return {Locale} Wrapped locale data
|
|
11130
11506
|
*/
|
|
11131
|
-
|
|
11132
11507
|
function wrapLocale(data) {
|
|
11133
11508
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
11134
11509
|
}
|
|
11510
|
+
|
|
11135
11511
|
/**
|
|
11136
11512
|
* @memberof Entities
|
|
11137
11513
|
* @typedef LocaleCollection
|
|
@@ -11147,7 +11523,6 @@ function wrapLocale(data) {
|
|
|
11147
11523
|
* @param {Object} data - Raw locale collection data
|
|
11148
11524
|
* @return {LocaleCollection} Wrapped locale collection data
|
|
11149
11525
|
*/
|
|
11150
|
-
|
|
11151
11526
|
function wrapLocaleCollection(data) {
|
|
11152
11527
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
11153
11528
|
}
|
|
@@ -11166,6 +11541,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11166
11541
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapSpace", function() { return wrapSpace; });
|
|
11167
11542
|
/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! contentful-sdk-core */ "../node_modules/contentful-sdk-core/dist/index.es-modules.js");
|
|
11168
11543
|
|
|
11544
|
+
|
|
11169
11545
|
/**
|
|
11170
11546
|
* @memberof Entities
|
|
11171
11547
|
* @typedef Space
|
|
@@ -11182,7 +11558,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11182
11558
|
* @param {Object} data - API response for a Space
|
|
11183
11559
|
* @return {Space}
|
|
11184
11560
|
*/
|
|
11185
|
-
|
|
11186
11561
|
function wrapSpace(data) {
|
|
11187
11562
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(data));
|
|
11188
11563
|
}
|
|
@@ -11204,6 +11579,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11204
11579
|
/* harmony import */ var contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! contentful-sdk-core */ "../node_modules/contentful-sdk-core/dist/index.es-modules.js");
|
|
11205
11580
|
|
|
11206
11581
|
|
|
11582
|
+
|
|
11207
11583
|
/**
|
|
11208
11584
|
* @memberof Entities
|
|
11209
11585
|
* @typedef Tag
|
|
@@ -11217,10 +11593,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11217
11593
|
* @param {Object} data - Raw tag data
|
|
11218
11594
|
* @return {Tag} Wrapped tag data
|
|
11219
11595
|
*/
|
|
11220
|
-
|
|
11221
11596
|
function wrapTag(data) {
|
|
11222
11597
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
11223
11598
|
}
|
|
11599
|
+
|
|
11224
11600
|
/**
|
|
11225
11601
|
* @memberof Entities
|
|
11226
11602
|
* @typedef TagCollection
|
|
@@ -11236,7 +11612,6 @@ function wrapTag(data) {
|
|
|
11236
11612
|
* @param {Object} data - Raw tag collection data
|
|
11237
11613
|
* @return {TagCollection} Wrapped tag collection data
|
|
11238
11614
|
*/
|
|
11239
|
-
|
|
11240
11615
|
function wrapTagCollection(data) {
|
|
11241
11616
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(Object(fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(data)));
|
|
11242
11617
|
}
|
|
@@ -11292,11 +11667,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
11292
11667
|
/* harmony import */ var contentful_resolve_response__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! contentful-resolve-response */ "../node_modules/contentful-resolve-response/dist/esm/index.js");
|
|
11293
11668
|
/* harmony import */ var _mixins_stringify_safe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mixins/stringify-safe */ "./mixins/stringify-safe.js");
|
|
11294
11669
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11295
|
-
|
|
11296
11670
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11297
|
-
|
|
11298
11671
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11299
|
-
|
|
11300
11672
|
/**
|
|
11301
11673
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
11302
11674
|
* @namespace Sync
|
|
@@ -11304,6 +11676,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
11304
11676
|
|
|
11305
11677
|
|
|
11306
11678
|
|
|
11679
|
+
|
|
11307
11680
|
/**
|
|
11308
11681
|
* @memberof Sync
|
|
11309
11682
|
* @typedef SyncCollection
|
|
@@ -11341,72 +11714,61 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
11341
11714
|
* @param {boolean} [options.paginate = true] - If further sync pages should automatically be crawled
|
|
11342
11715
|
* @return {Promise<SyncCollection>}
|
|
11343
11716
|
*/
|
|
11344
|
-
|
|
11345
11717
|
async function pagedSync(http, query, options = {}) {
|
|
11346
11718
|
if (!query || !query.initial && !query.nextSyncToken && !query.nextPageToken) {
|
|
11347
11719
|
throw new Error('Please provide one of `initial`, `nextSyncToken` or `nextPageToken` parameters for syncing');
|
|
11348
11720
|
}
|
|
11349
|
-
|
|
11350
11721
|
if (query && query.content_type && !query.type) {
|
|
11351
11722
|
query.type = 'Entry';
|
|
11352
11723
|
} else if (query && query.content_type && query.type && query.type !== 'Entry') {
|
|
11353
11724
|
throw new Error('When using the `content_type` filter your `type` parameter cannot be different from `Entry`.');
|
|
11354
11725
|
}
|
|
11355
|
-
|
|
11356
11726
|
const defaultOptions = {
|
|
11357
11727
|
resolveLinks: true,
|
|
11358
11728
|
removeUnresolved: false,
|
|
11359
11729
|
paginate: true
|
|
11360
11730
|
};
|
|
11361
|
-
|
|
11362
11731
|
const {
|
|
11363
11732
|
resolveLinks,
|
|
11364
11733
|
removeUnresolved,
|
|
11365
11734
|
paginate
|
|
11366
11735
|
} = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
11367
|
-
|
|
11368
11736
|
const syncOptions = {
|
|
11369
11737
|
paginate
|
|
11370
11738
|
};
|
|
11371
|
-
const response = await getSyncPage(http, [], query, syncOptions);
|
|
11372
|
-
|
|
11739
|
+
const response = await getSyncPage(http, [], query, syncOptions);
|
|
11740
|
+
// clones response.items used in includes because we don't want these to be mutated
|
|
11373
11741
|
if (resolveLinks) {
|
|
11374
11742
|
response.items = Object(contentful_resolve_response__WEBPACK_IMPORTED_MODULE_1__["default"])(response, {
|
|
11375
11743
|
removeUnresolved,
|
|
11376
11744
|
itemEntryPoints: ['fields']
|
|
11377
11745
|
});
|
|
11378
|
-
}
|
|
11379
|
-
|
|
11380
|
-
|
|
11746
|
+
}
|
|
11747
|
+
// maps response items again after getters are attached
|
|
11381
11748
|
const mappedResponseItems = mapResponseItems(response.items);
|
|
11382
|
-
|
|
11383
11749
|
if (response.nextSyncToken) {
|
|
11384
11750
|
mappedResponseItems.nextSyncToken = response.nextSyncToken;
|
|
11385
11751
|
}
|
|
11386
|
-
|
|
11387
11752
|
if (response.nextPageToken) {
|
|
11388
11753
|
mappedResponseItems.nextPageToken = response.nextPageToken;
|
|
11389
11754
|
}
|
|
11390
|
-
|
|
11391
11755
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["freezeSys"])(Object(_mixins_stringify_safe__WEBPACK_IMPORTED_MODULE_2__["default"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(mappedResponseItems)));
|
|
11392
11756
|
}
|
|
11757
|
+
|
|
11393
11758
|
/**
|
|
11394
11759
|
* @private
|
|
11395
11760
|
* @param {Array<Entities.Entry|Entities.Array|Sync.DeletedEntry|Sync.DeletedAsset>} items
|
|
11396
11761
|
* @return {Object} Entities mapped to an object for each entity type
|
|
11397
11762
|
*/
|
|
11398
|
-
|
|
11399
11763
|
function mapResponseItems(items) {
|
|
11400
11764
|
const reducer = type => {
|
|
11401
11765
|
return (accumulated, item) => {
|
|
11402
11766
|
if (item.sys.type === type) {
|
|
11403
11767
|
accumulated.push(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(item));
|
|
11404
11768
|
}
|
|
11405
|
-
|
|
11406
11769
|
return accumulated;
|
|
11407
11770
|
};
|
|
11408
11771
|
};
|
|
11409
|
-
|
|
11410
11772
|
return {
|
|
11411
11773
|
entries: items.reduce(reducer('Entry'), []),
|
|
11412
11774
|
assets: items.reduce(reducer('Asset'), []),
|
|
@@ -11414,6 +11776,7 @@ function mapResponseItems(items) {
|
|
|
11414
11776
|
deletedAssets: items.reduce(reducer('DeletedAsset'), [])
|
|
11415
11777
|
};
|
|
11416
11778
|
}
|
|
11779
|
+
|
|
11417
11780
|
/**
|
|
11418
11781
|
* If the response contains a nextPageUrl, extracts the sync token to get the
|
|
11419
11782
|
* next page and calls itself again with that token.
|
|
@@ -11429,8 +11792,6 @@ function mapResponseItems(items) {
|
|
|
11429
11792
|
* @param {boolean} [options.paginate = true] - If further sync pages should automatically be crawled
|
|
11430
11793
|
* @return {Promise<{items: Array, nextSyncToken: string}>}
|
|
11431
11794
|
*/
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
11795
|
async function getSyncPage(http, items, query, {
|
|
11435
11796
|
paginate
|
|
11436
11797
|
}) {
|
|
@@ -11438,25 +11799,21 @@ async function getSyncPage(http, items, query, {
|
|
|
11438
11799
|
query.sync_token = query.nextSyncToken;
|
|
11439
11800
|
delete query.nextSyncToken;
|
|
11440
11801
|
}
|
|
11441
|
-
|
|
11442
11802
|
if (query.nextPageToken) {
|
|
11443
11803
|
query.sync_token = query.nextPageToken;
|
|
11444
11804
|
delete query.nextPageToken;
|
|
11445
11805
|
}
|
|
11446
|
-
|
|
11447
11806
|
if (query.sync_token) {
|
|
11448
11807
|
delete query.initial;
|
|
11449
11808
|
delete query.type;
|
|
11450
11809
|
delete query.content_type;
|
|
11451
11810
|
delete query.limit;
|
|
11452
11811
|
}
|
|
11453
|
-
|
|
11454
11812
|
const response = await http.get('sync', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
11455
11813
|
query: query
|
|
11456
11814
|
}));
|
|
11457
11815
|
const data = response.data || {};
|
|
11458
11816
|
items = items.concat(data.items || []);
|
|
11459
|
-
|
|
11460
11817
|
if (data.nextPageUrl) {
|
|
11461
11818
|
if (paginate) {
|
|
11462
11819
|
delete query.initial;
|
|
@@ -11465,7 +11822,6 @@ async function getSyncPage(http, items, query, {
|
|
|
11465
11822
|
paginate
|
|
11466
11823
|
});
|
|
11467
11824
|
}
|
|
11468
|
-
|
|
11469
11825
|
return {
|
|
11470
11826
|
items: items,
|
|
11471
11827
|
nextPageToken: getToken(data.nextPageUrl)
|
|
@@ -11481,12 +11837,11 @@ async function getSyncPage(http, items, query, {
|
|
|
11481
11837
|
};
|
|
11482
11838
|
}
|
|
11483
11839
|
}
|
|
11840
|
+
|
|
11484
11841
|
/**
|
|
11485
11842
|
* Extracts token out of an url
|
|
11486
11843
|
* @private
|
|
11487
11844
|
*/
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
11845
|
function getToken(url) {
|
|
11491
11846
|
const urlParts = url.split('?');
|
|
11492
11847
|
return urlParts.length > 0 ? urlParts[1].replace('sync_token=', '') : '';
|
|
@@ -11505,36 +11860,36 @@ function getToken(url) {
|
|
|
11505
11860
|
__webpack_require__.r(__webpack_exports__);
|
|
11506
11861
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeSelect; });
|
|
11507
11862
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11508
|
-
|
|
11509
11863
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11510
|
-
|
|
11511
11864
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11512
|
-
|
|
11513
11865
|
/*
|
|
11514
11866
|
* sdk relies heavily on sys metadata
|
|
11515
11867
|
* so we cannot omit the sys property on sdk level entirely
|
|
11516
11868
|
* and we have to ensure that at least `id` and `type` are present
|
|
11517
11869
|
* */
|
|
11870
|
+
|
|
11518
11871
|
function normalizeSelect(query) {
|
|
11519
11872
|
if (!query.select) {
|
|
11520
11873
|
return query;
|
|
11521
|
-
}
|
|
11522
|
-
// Get the different parts that are listed for selection
|
|
11523
|
-
|
|
11874
|
+
}
|
|
11524
11875
|
|
|
11525
|
-
|
|
11876
|
+
// The selection of fields for the query is limited
|
|
11877
|
+
// Get the different parts that are listed for selection
|
|
11878
|
+
const allSelects = Array.isArray(query.select) ? query.select : query.select.split(',');
|
|
11879
|
+
// Move the parts into a set for easy access and deduplication
|
|
11880
|
+
const selectedSet = new Set(allSelects);
|
|
11526
11881
|
|
|
11527
|
-
|
|
11882
|
+
// If we already select all of `sys` we can just return
|
|
11528
11883
|
// since we're anyway fetching everything that is needed
|
|
11529
|
-
|
|
11530
11884
|
if (selectedSet.has('sys')) {
|
|
11531
11885
|
return query;
|
|
11532
|
-
}
|
|
11533
|
-
|
|
11886
|
+
}
|
|
11534
11887
|
|
|
11888
|
+
// We don't select `sys` so we need to ensure the minimum set
|
|
11535
11889
|
selectedSet.add('sys.id');
|
|
11536
|
-
selectedSet.add('sys.type');
|
|
11890
|
+
selectedSet.add('sys.type');
|
|
11537
11891
|
|
|
11892
|
+
// Reassign the normalized sys properties
|
|
11538
11893
|
return _objectSpread(_objectSpread({}, query), {}, {
|
|
11539
11894
|
select: [...selectedSet].join(',')
|
|
11540
11895
|
});
|
|
@@ -11558,19 +11913,15 @@ class ValidationError extends Error {
|
|
|
11558
11913
|
super(`Invalid "${name}" provided, ` + message);
|
|
11559
11914
|
this.name = 'ValidationError';
|
|
11560
11915
|
}
|
|
11561
|
-
|
|
11562
11916
|
}
|
|
11563
11917
|
function validateTimestamp(name, timestamp, options) {
|
|
11564
11918
|
options = options || {};
|
|
11565
|
-
|
|
11566
11919
|
if (typeof timestamp !== 'number') {
|
|
11567
11920
|
throw new ValidationError(name, `only numeric values are allowed for timestamps, provided type was "${typeof timestamp}"`);
|
|
11568
11921
|
}
|
|
11569
|
-
|
|
11570
11922
|
if (options.maximum && timestamp > options.maximum) {
|
|
11571
11923
|
throw new ValidationError(name, `value (${timestamp}) cannot be further in the future than expected maximum (${options.maximum})`);
|
|
11572
11924
|
}
|
|
11573
|
-
|
|
11574
11925
|
if (options.now && timestamp < options.now) {
|
|
11575
11926
|
throw new ValidationError(name, `value (${timestamp}) cannot be in the past, current time was ${options.now}`);
|
|
11576
11927
|
}
|