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
|
@@ -2848,7 +2848,7 @@ if ($defineProperty) {
|
|
|
2848
2848
|
|
|
2849
2849
|
"use strict";
|
|
2850
2850
|
__webpack_require__.r(__webpack_exports__);
|
|
2851
|
-
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/
|
|
2851
|
+
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/contentful-resolve-response/node_modules/fast-copy/dist/umd/index.js");
|
|
2852
2852
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fast_copy__WEBPACK_IMPORTED_MODULE_0__);
|
|
2853
2853
|
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; };
|
|
2854
2854
|
|
|
@@ -3003,6 +3003,426 @@ var resolveResponse = function resolveResponse(response, options) {
|
|
|
3003
3003
|
|
|
3004
3004
|
/* harmony default export */ __webpack_exports__["default"] = (resolveResponse);
|
|
3005
3005
|
|
|
3006
|
+
/***/ }),
|
|
3007
|
+
|
|
3008
|
+
/***/ "../node_modules/contentful-resolve-response/node_modules/fast-copy/dist/umd/index.js":
|
|
3009
|
+
/*!********************************************************************************************!*\
|
|
3010
|
+
!*** ../node_modules/contentful-resolve-response/node_modules/fast-copy/dist/umd/index.js ***!
|
|
3011
|
+
\********************************************************************************************/
|
|
3012
|
+
/*! no static exports found */
|
|
3013
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3014
|
+
|
|
3015
|
+
(function (global, factory) {
|
|
3016
|
+
true ? factory(exports) :
|
|
3017
|
+
undefined;
|
|
3018
|
+
})(this, (function (exports) { 'use strict';
|
|
3019
|
+
|
|
3020
|
+
var toStringFunction = Function.prototype.toString;
|
|
3021
|
+
var create = Object.create;
|
|
3022
|
+
var toStringObject = Object.prototype.toString;
|
|
3023
|
+
/**
|
|
3024
|
+
* @classdesc Fallback cache for when WeakMap is not natively supported
|
|
3025
|
+
*/
|
|
3026
|
+
var LegacyCache = /** @class */ (function () {
|
|
3027
|
+
function LegacyCache() {
|
|
3028
|
+
this._keys = [];
|
|
3029
|
+
this._values = [];
|
|
3030
|
+
}
|
|
3031
|
+
LegacyCache.prototype.has = function (key) {
|
|
3032
|
+
return !!~this._keys.indexOf(key);
|
|
3033
|
+
};
|
|
3034
|
+
LegacyCache.prototype.get = function (key) {
|
|
3035
|
+
return this._values[this._keys.indexOf(key)];
|
|
3036
|
+
};
|
|
3037
|
+
LegacyCache.prototype.set = function (key, value) {
|
|
3038
|
+
this._keys.push(key);
|
|
3039
|
+
this._values.push(value);
|
|
3040
|
+
};
|
|
3041
|
+
return LegacyCache;
|
|
3042
|
+
}());
|
|
3043
|
+
function createCacheLegacy() {
|
|
3044
|
+
return new LegacyCache();
|
|
3045
|
+
}
|
|
3046
|
+
function createCacheModern() {
|
|
3047
|
+
return new WeakMap();
|
|
3048
|
+
}
|
|
3049
|
+
/**
|
|
3050
|
+
* Get a new cache object to prevent circular references.
|
|
3051
|
+
*/
|
|
3052
|
+
var createCache = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
|
|
3053
|
+
/**
|
|
3054
|
+
* Get an empty version of the object with the same prototype it has.
|
|
3055
|
+
*/
|
|
3056
|
+
function getCleanClone(prototype) {
|
|
3057
|
+
if (!prototype) {
|
|
3058
|
+
return create(null);
|
|
3059
|
+
}
|
|
3060
|
+
var Constructor = prototype.constructor;
|
|
3061
|
+
if (Constructor === Object) {
|
|
3062
|
+
return prototype === Object.prototype ? {} : create(prototype);
|
|
3063
|
+
}
|
|
3064
|
+
if (~toStringFunction.call(Constructor).indexOf('[native code]')) {
|
|
3065
|
+
try {
|
|
3066
|
+
return new Constructor();
|
|
3067
|
+
}
|
|
3068
|
+
catch (_a) { }
|
|
3069
|
+
}
|
|
3070
|
+
return create(prototype);
|
|
3071
|
+
}
|
|
3072
|
+
function getRegExpFlagsLegacy(regExp) {
|
|
3073
|
+
var flags = '';
|
|
3074
|
+
if (regExp.global) {
|
|
3075
|
+
flags += 'g';
|
|
3076
|
+
}
|
|
3077
|
+
if (regExp.ignoreCase) {
|
|
3078
|
+
flags += 'i';
|
|
3079
|
+
}
|
|
3080
|
+
if (regExp.multiline) {
|
|
3081
|
+
flags += 'm';
|
|
3082
|
+
}
|
|
3083
|
+
if (regExp.unicode) {
|
|
3084
|
+
flags += 'u';
|
|
3085
|
+
}
|
|
3086
|
+
if (regExp.sticky) {
|
|
3087
|
+
flags += 'y';
|
|
3088
|
+
}
|
|
3089
|
+
return flags;
|
|
3090
|
+
}
|
|
3091
|
+
function getRegExpFlagsModern(regExp) {
|
|
3092
|
+
return regExp.flags;
|
|
3093
|
+
}
|
|
3094
|
+
/**
|
|
3095
|
+
* Get the flags to apply to the copied regexp.
|
|
3096
|
+
*/
|
|
3097
|
+
var getRegExpFlags = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
|
|
3098
|
+
function getTagLegacy(value) {
|
|
3099
|
+
var type = toStringObject.call(value);
|
|
3100
|
+
return type.substring(8, type.length - 1);
|
|
3101
|
+
}
|
|
3102
|
+
function getTagModern(value) {
|
|
3103
|
+
return value[Symbol.toStringTag] || getTagLegacy(value);
|
|
3104
|
+
}
|
|
3105
|
+
/**
|
|
3106
|
+
* Get the tag of the value passed, so that the correct copier can be used.
|
|
3107
|
+
*/
|
|
3108
|
+
var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
|
|
3109
|
+
|
|
3110
|
+
var defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
3111
|
+
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
|
|
3112
|
+
var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols === 'function';
|
|
3113
|
+
function getStrictPropertiesModern(object) {
|
|
3114
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
3115
|
+
}
|
|
3116
|
+
/**
|
|
3117
|
+
* Get the properites used when copying objects strictly. This includes both keys and symbols.
|
|
3118
|
+
*/
|
|
3119
|
+
var getStrictProperties = SUPPORTS_SYMBOL
|
|
3120
|
+
? getStrictPropertiesModern
|
|
3121
|
+
: getOwnPropertyNames;
|
|
3122
|
+
/**
|
|
3123
|
+
* Striclty copy all properties contained on the object.
|
|
3124
|
+
*/
|
|
3125
|
+
function copyOwnPropertiesStrict(value, clone, state) {
|
|
3126
|
+
var properties = getStrictProperties(value);
|
|
3127
|
+
for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
|
|
3128
|
+
property = properties[index];
|
|
3129
|
+
if (property === 'callee' || property === 'caller') {
|
|
3130
|
+
continue;
|
|
3131
|
+
}
|
|
3132
|
+
descriptor = getOwnPropertyDescriptor(value, property);
|
|
3133
|
+
if (!descriptor) {
|
|
3134
|
+
// In extra edge cases where the property descriptor cannot be retrived, fall back to
|
|
3135
|
+
// the loose assignment.
|
|
3136
|
+
clone[property] = state.copier(value[property], state);
|
|
3137
|
+
continue;
|
|
3138
|
+
}
|
|
3139
|
+
// Only clone the value if actually a value, not a getter / setter.
|
|
3140
|
+
if (!descriptor.get && !descriptor.set) {
|
|
3141
|
+
descriptor.value = state.copier(descriptor.value, state);
|
|
3142
|
+
}
|
|
3143
|
+
try {
|
|
3144
|
+
defineProperty(clone, property, descriptor);
|
|
3145
|
+
}
|
|
3146
|
+
catch (error) {
|
|
3147
|
+
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
|
|
3148
|
+
clone[property] = descriptor.value;
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
return clone;
|
|
3152
|
+
}
|
|
3153
|
+
/**
|
|
3154
|
+
* Deeply copy the indexed values in the array.
|
|
3155
|
+
*/
|
|
3156
|
+
function copyArrayLoose(array, state) {
|
|
3157
|
+
var clone = new state.Constructor();
|
|
3158
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3159
|
+
state.cache.set(array, clone);
|
|
3160
|
+
for (var index = 0, length_2 = array.length; index < length_2; ++index) {
|
|
3161
|
+
clone[index] = state.copier(array[index], state);
|
|
3162
|
+
}
|
|
3163
|
+
return clone;
|
|
3164
|
+
}
|
|
3165
|
+
/**
|
|
3166
|
+
* Deeply copy the indexed values in the array, as well as any custom properties.
|
|
3167
|
+
*/
|
|
3168
|
+
function copyArrayStrict(array, state) {
|
|
3169
|
+
var clone = new state.Constructor();
|
|
3170
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3171
|
+
state.cache.set(array, clone);
|
|
3172
|
+
return copyOwnPropertiesStrict(array, clone, state);
|
|
3173
|
+
}
|
|
3174
|
+
/**
|
|
3175
|
+
* Copy the contents of the ArrayBuffer.
|
|
3176
|
+
*/
|
|
3177
|
+
function copyArrayBuffer(arrayBuffer, _state) {
|
|
3178
|
+
return arrayBuffer.slice(0);
|
|
3179
|
+
}
|
|
3180
|
+
/**
|
|
3181
|
+
* Create a new Blob with the contents of the original.
|
|
3182
|
+
*/
|
|
3183
|
+
function copyBlob(blob, _state) {
|
|
3184
|
+
return blob.slice(0, blob.size, blob.type);
|
|
3185
|
+
}
|
|
3186
|
+
/**
|
|
3187
|
+
* Create a new DataView with the contents of the original.
|
|
3188
|
+
*/
|
|
3189
|
+
function copyDataView(dataView, state) {
|
|
3190
|
+
return new state.Constructor(copyArrayBuffer(dataView.buffer));
|
|
3191
|
+
}
|
|
3192
|
+
/**
|
|
3193
|
+
* Create a new Date based on the time of the original.
|
|
3194
|
+
*/
|
|
3195
|
+
function copyDate(date, state) {
|
|
3196
|
+
return new state.Constructor(date.getTime());
|
|
3197
|
+
}
|
|
3198
|
+
/**
|
|
3199
|
+
* Deeply copy the keys and values of the original.
|
|
3200
|
+
*/
|
|
3201
|
+
function copyMapLoose(map, state) {
|
|
3202
|
+
var clone = new state.Constructor();
|
|
3203
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3204
|
+
state.cache.set(map, clone);
|
|
3205
|
+
map.forEach(function (value, key) {
|
|
3206
|
+
clone.set(key, state.copier(value, state));
|
|
3207
|
+
});
|
|
3208
|
+
return clone;
|
|
3209
|
+
}
|
|
3210
|
+
/**
|
|
3211
|
+
* Deeply copy the keys and values of the original, as well as any custom properties.
|
|
3212
|
+
*/
|
|
3213
|
+
function copyMapStrict(map, state) {
|
|
3214
|
+
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
|
|
3215
|
+
}
|
|
3216
|
+
function copyObjectLooseLegacy(object, state) {
|
|
3217
|
+
var clone = getCleanClone(state.prototype);
|
|
3218
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3219
|
+
state.cache.set(object, clone);
|
|
3220
|
+
for (var key in object) {
|
|
3221
|
+
if (hasOwnProperty.call(object, key)) {
|
|
3222
|
+
clone[key] = state.copier(object[key], state);
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
return clone;
|
|
3226
|
+
}
|
|
3227
|
+
function copyObjectLooseModern(object, state) {
|
|
3228
|
+
var clone = getCleanClone(state.prototype);
|
|
3229
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3230
|
+
state.cache.set(object, clone);
|
|
3231
|
+
for (var key in object) {
|
|
3232
|
+
if (hasOwnProperty.call(object, key)) {
|
|
3233
|
+
clone[key] = state.copier(object[key], state);
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
var symbols = getOwnPropertySymbols(object);
|
|
3237
|
+
for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
|
|
3238
|
+
symbol = symbols[index];
|
|
3239
|
+
if (propertyIsEnumerable.call(object, symbol)) {
|
|
3240
|
+
clone[symbol] = state.copier(object[symbol], state);
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
return clone;
|
|
3244
|
+
}
|
|
3245
|
+
/**
|
|
3246
|
+
* Deeply copy the properties (keys and symbols) and values of the original.
|
|
3247
|
+
*/
|
|
3248
|
+
var copyObjectLoose = SUPPORTS_SYMBOL
|
|
3249
|
+
? copyObjectLooseModern
|
|
3250
|
+
: copyObjectLooseLegacy;
|
|
3251
|
+
/**
|
|
3252
|
+
* Deeply copy the properties (keys and symbols) and values of the original, as well
|
|
3253
|
+
* as any hidden or non-enumerable properties.
|
|
3254
|
+
*/
|
|
3255
|
+
function copyObjectStrict(object, state) {
|
|
3256
|
+
var clone = getCleanClone(state.prototype);
|
|
3257
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3258
|
+
state.cache.set(object, clone);
|
|
3259
|
+
return copyOwnPropertiesStrict(object, clone, state);
|
|
3260
|
+
}
|
|
3261
|
+
/**
|
|
3262
|
+
* Create a new primitive wrapper from the value of the original.
|
|
3263
|
+
*/
|
|
3264
|
+
function copyPrimitiveWrapper(primitiveObject, state) {
|
|
3265
|
+
return new state.Constructor(primitiveObject.valueOf());
|
|
3266
|
+
}
|
|
3267
|
+
/**
|
|
3268
|
+
* Create a new RegExp based on the value and flags of the original.
|
|
3269
|
+
*/
|
|
3270
|
+
function copyRegExp(regExp, state) {
|
|
3271
|
+
var clone = new state.Constructor(regExp.source, getRegExpFlags(regExp));
|
|
3272
|
+
clone.lastIndex = regExp.lastIndex;
|
|
3273
|
+
return clone;
|
|
3274
|
+
}
|
|
3275
|
+
/**
|
|
3276
|
+
* Return the original value (an identity function).
|
|
3277
|
+
*
|
|
3278
|
+
* @note
|
|
3279
|
+
* THis is used for objects that cannot be copied, such as WeakMap.
|
|
3280
|
+
*/
|
|
3281
|
+
function copySelf(value, _state) {
|
|
3282
|
+
return value;
|
|
3283
|
+
}
|
|
3284
|
+
/**
|
|
3285
|
+
* Deeply copy the values of the original.
|
|
3286
|
+
*/
|
|
3287
|
+
function copySetLoose(set, state) {
|
|
3288
|
+
var clone = new state.Constructor();
|
|
3289
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3290
|
+
state.cache.set(set, clone);
|
|
3291
|
+
set.forEach(function (value) {
|
|
3292
|
+
clone.add(state.copier(value, state));
|
|
3293
|
+
});
|
|
3294
|
+
return clone;
|
|
3295
|
+
}
|
|
3296
|
+
/**
|
|
3297
|
+
* Deeply copy the values of the original, as well as any custom properties.
|
|
3298
|
+
*/
|
|
3299
|
+
function copySetStrict(set, state) {
|
|
3300
|
+
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
var isArray = Array.isArray;
|
|
3304
|
+
var assign = Object.assign, getPrototypeOf = Object.getPrototypeOf;
|
|
3305
|
+
var DEFAULT_LOOSE_OPTIONS = {
|
|
3306
|
+
array: copyArrayLoose,
|
|
3307
|
+
arrayBuffer: copyArrayBuffer,
|
|
3308
|
+
blob: copyBlob,
|
|
3309
|
+
dataView: copyDataView,
|
|
3310
|
+
date: copyDate,
|
|
3311
|
+
error: copySelf,
|
|
3312
|
+
map: copyMapLoose,
|
|
3313
|
+
object: copyObjectLoose,
|
|
3314
|
+
regExp: copyRegExp,
|
|
3315
|
+
set: copySetLoose,
|
|
3316
|
+
};
|
|
3317
|
+
var DEFAULT_STRICT_OPTIONS = assign({}, DEFAULT_LOOSE_OPTIONS, {
|
|
3318
|
+
array: copyArrayStrict,
|
|
3319
|
+
map: copyMapStrict,
|
|
3320
|
+
object: copyObjectStrict,
|
|
3321
|
+
set: copySetStrict,
|
|
3322
|
+
});
|
|
3323
|
+
/**
|
|
3324
|
+
* Get the copiers used for each specific object tag.
|
|
3325
|
+
*/
|
|
3326
|
+
function getTagSpecificCopiers(options) {
|
|
3327
|
+
return {
|
|
3328
|
+
Arguments: options.object,
|
|
3329
|
+
Array: options.array,
|
|
3330
|
+
ArrayBuffer: options.arrayBuffer,
|
|
3331
|
+
Blob: options.blob,
|
|
3332
|
+
Boolean: copyPrimitiveWrapper,
|
|
3333
|
+
DataView: options.dataView,
|
|
3334
|
+
Date: options.date,
|
|
3335
|
+
Error: options.error,
|
|
3336
|
+
Float32Array: options.arrayBuffer,
|
|
3337
|
+
Float64Array: options.arrayBuffer,
|
|
3338
|
+
Int8Array: options.arrayBuffer,
|
|
3339
|
+
Int16Array: options.arrayBuffer,
|
|
3340
|
+
Int32Array: options.arrayBuffer,
|
|
3341
|
+
Map: options.map,
|
|
3342
|
+
Number: copyPrimitiveWrapper,
|
|
3343
|
+
Object: options.object,
|
|
3344
|
+
Promise: copySelf,
|
|
3345
|
+
RegExp: options.regExp,
|
|
3346
|
+
Set: options.set,
|
|
3347
|
+
String: copyPrimitiveWrapper,
|
|
3348
|
+
WeakMap: copySelf,
|
|
3349
|
+
WeakSet: copySelf,
|
|
3350
|
+
Uint8Array: options.arrayBuffer,
|
|
3351
|
+
Uint8ClampedArray: options.arrayBuffer,
|
|
3352
|
+
Uint16Array: options.arrayBuffer,
|
|
3353
|
+
Uint32Array: options.arrayBuffer,
|
|
3354
|
+
Uint64Array: options.arrayBuffer,
|
|
3355
|
+
};
|
|
3356
|
+
}
|
|
3357
|
+
/**
|
|
3358
|
+
* Create a custom copier based on the object-specific copy methods passed.
|
|
3359
|
+
*/
|
|
3360
|
+
function createCopier(options) {
|
|
3361
|
+
var normalizedOptions = assign({}, DEFAULT_LOOSE_OPTIONS, options);
|
|
3362
|
+
var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
|
|
3363
|
+
var array = tagSpecificCopiers.Array, object = tagSpecificCopiers.Object;
|
|
3364
|
+
function copier(value, state) {
|
|
3365
|
+
state.prototype = state.Constructor = undefined;
|
|
3366
|
+
if (!value || typeof value !== 'object') {
|
|
3367
|
+
return value;
|
|
3368
|
+
}
|
|
3369
|
+
if (state.cache.has(value)) {
|
|
3370
|
+
return state.cache.get(value);
|
|
3371
|
+
}
|
|
3372
|
+
state.prototype = value.__proto__ || getPrototypeOf(value);
|
|
3373
|
+
state.Constructor = state.prototype && state.prototype.constructor;
|
|
3374
|
+
// plain objects
|
|
3375
|
+
if (!state.Constructor || state.Constructor === Object) {
|
|
3376
|
+
return object(value, state);
|
|
3377
|
+
}
|
|
3378
|
+
// arrays
|
|
3379
|
+
if (isArray(value)) {
|
|
3380
|
+
return array(value, state);
|
|
3381
|
+
}
|
|
3382
|
+
var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
|
|
3383
|
+
if (tagSpecificCopier) {
|
|
3384
|
+
return tagSpecificCopier(value, state);
|
|
3385
|
+
}
|
|
3386
|
+
return typeof value.then === 'function' ? value : object(value, state);
|
|
3387
|
+
}
|
|
3388
|
+
return function copy(value) {
|
|
3389
|
+
return copier(value, {
|
|
3390
|
+
Constructor: undefined,
|
|
3391
|
+
cache: createCache(),
|
|
3392
|
+
copier: copier,
|
|
3393
|
+
prototype: undefined,
|
|
3394
|
+
});
|
|
3395
|
+
};
|
|
3396
|
+
}
|
|
3397
|
+
/**
|
|
3398
|
+
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
|
|
3399
|
+
* same internals as `copyStrict`.
|
|
3400
|
+
*/
|
|
3401
|
+
function createStrictCopier(options) {
|
|
3402
|
+
return createCopier(assign({}, DEFAULT_STRICT_OPTIONS, options));
|
|
3403
|
+
}
|
|
3404
|
+
/**
|
|
3405
|
+
* Copy an value deeply as much as possible, where strict recreation of object properties
|
|
3406
|
+
* are maintained. All properties (including non-enumerable ones) are copied with their
|
|
3407
|
+
* original property descriptors on both objects and arrays.
|
|
3408
|
+
*/
|
|
3409
|
+
var copyStrict = createStrictCopier({});
|
|
3410
|
+
/**
|
|
3411
|
+
* Copy an value deeply as much as possible.
|
|
3412
|
+
*/
|
|
3413
|
+
var index = createCopier({});
|
|
3414
|
+
|
|
3415
|
+
exports.copyStrict = copyStrict;
|
|
3416
|
+
exports.createCopier = createCopier;
|
|
3417
|
+
exports.createStrictCopier = createStrictCopier;
|
|
3418
|
+
exports["default"] = index;
|
|
3419
|
+
|
|
3420
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3421
|
+
|
|
3422
|
+
}));
|
|
3423
|
+
//# sourceMappingURL=index.js.map
|
|
3424
|
+
|
|
3425
|
+
|
|
3006
3426
|
/***/ }),
|
|
3007
3427
|
|
|
3008
3428
|
/***/ "../node_modules/contentful-sdk-core/dist/index.es-modules.js":
|
|
@@ -8867,11 +9287,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8867
9287
|
/* harmony import */ var _create_contentful_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./create-contentful-api */ "./create-contentful-api.js");
|
|
8868
9288
|
/* harmony import */ var _create_global_options__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./create-global-options */ "./create-global-options.js");
|
|
8869
9289
|
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; }
|
|
8870
|
-
|
|
8871
9290
|
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; }
|
|
8872
|
-
|
|
8873
9291
|
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; }
|
|
8874
|
-
|
|
8875
9292
|
/**
|
|
8876
9293
|
* Contentful Delivery API SDK. Allows you to create instances of a client
|
|
8877
9294
|
* with access to the Contentful Content Delivery API.
|
|
@@ -8882,6 +9299,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
8882
9299
|
|
|
8883
9300
|
|
|
8884
9301
|
|
|
9302
|
+
|
|
9303
|
+
|
|
8885
9304
|
/**
|
|
8886
9305
|
* Create a client instance
|
|
8887
9306
|
* @func
|
|
@@ -8920,21 +9339,17 @@ function createClient(params) {
|
|
|
8920
9339
|
if (!params.accessToken) {
|
|
8921
9340
|
throw new TypeError('Expected parameter accessToken');
|
|
8922
9341
|
}
|
|
8923
|
-
|
|
8924
9342
|
if (!params.space) {
|
|
8925
9343
|
throw new TypeError('Expected parameter space');
|
|
8926
9344
|
}
|
|
8927
|
-
|
|
8928
9345
|
const defaultConfig = {
|
|
8929
9346
|
resolveLinks: true,
|
|
8930
9347
|
removeUnresolved: false,
|
|
8931
9348
|
defaultHostname: 'cdn.contentful.com',
|
|
8932
9349
|
environment: 'master'
|
|
8933
9350
|
};
|
|
8934
|
-
|
|
8935
9351
|
const config = _objectSpread(_objectSpread({}, defaultConfig), params);
|
|
8936
|
-
|
|
8937
|
-
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.5"}`, config.application, config.integration);
|
|
9352
|
+
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.6"}`, config.application, config.integration);
|
|
8938
9353
|
config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
8939
9354
|
'Content-Type': 'application/vnd.contentful.delivery.v1+json',
|
|
8940
9355
|
'X-Contentful-User-Agent': userAgentHeader
|
|
@@ -8946,8 +9361,8 @@ function createClient(params) {
|
|
|
8946
9361
|
removeUnresolved: config.removeUnresolved,
|
|
8947
9362
|
spaceBaseUrl: http.defaults.baseURL,
|
|
8948
9363
|
environmentBaseUrl: `${http.defaults.baseURL}environments/${config.environment}`
|
|
8949
|
-
});
|
|
8950
|
-
|
|
9364
|
+
});
|
|
9365
|
+
// Append environment to baseURL
|
|
8951
9366
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
8952
9367
|
return Object(_create_contentful_api__WEBPACK_IMPORTED_MODULE_2__["default"])({
|
|
8953
9368
|
http,
|
|
@@ -8973,11 +9388,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8973
9388
|
/* harmony import */ var _utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/normalize-select */ "./utils/normalize-select.js");
|
|
8974
9389
|
/* harmony import */ var _utils_validate_timestamp__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/validate-timestamp */ "./utils/validate-timestamp.js");
|
|
8975
9390
|
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; }
|
|
8976
|
-
|
|
8977
9391
|
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; }
|
|
8978
|
-
|
|
8979
9392
|
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; }
|
|
8980
|
-
|
|
8981
9393
|
/**
|
|
8982
9394
|
* Contentful Delivery API Client. Contains methods which allow access to the
|
|
8983
9395
|
* different kinds of entities present in Contentful (Entries, Assets, etc).
|
|
@@ -9041,7 +9453,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
9041
9453
|
|
|
9042
9454
|
|
|
9043
9455
|
|
|
9456
|
+
|
|
9044
9457
|
const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
9458
|
+
|
|
9045
9459
|
/**
|
|
9046
9460
|
* Creates API object with methods to access functionality from Contentful's
|
|
9047
9461
|
* Delivery API
|
|
@@ -9052,7 +9466,6 @@ const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
|
9052
9466
|
* @prop {Function} getGlobalOptions - Link resolver preconfigured with global setting
|
|
9053
9467
|
* @return {ClientAPI}
|
|
9054
9468
|
*/
|
|
9055
|
-
|
|
9056
9469
|
function createContentfulApi(_ref) {
|
|
9057
9470
|
let {
|
|
9058
9471
|
http,
|
|
@@ -9083,7 +9496,6 @@ function createContentfulApi(_ref) {
|
|
|
9083
9496
|
const {
|
|
9084
9497
|
wrapLocaleCollection
|
|
9085
9498
|
} = _entities__WEBPACK_IMPORTED_MODULE_1__["default"].locale;
|
|
9086
|
-
|
|
9087
9499
|
const notFoundError = id => {
|
|
9088
9500
|
const error = new Error('The resource could not be found.');
|
|
9089
9501
|
error.sys = {
|
|
@@ -9098,6 +9510,7 @@ function createContentfulApi(_ref) {
|
|
|
9098
9510
|
};
|
|
9099
9511
|
return error;
|
|
9100
9512
|
};
|
|
9513
|
+
|
|
9101
9514
|
/**
|
|
9102
9515
|
* Gets the Space which the client is currently configured to use
|
|
9103
9516
|
* @memberof ContentfulClientAPI
|
|
@@ -9113,11 +9526,8 @@ function createContentfulApi(_ref) {
|
|
|
9113
9526
|
* const space = await client.getSpace()
|
|
9114
9527
|
* console.log(space)
|
|
9115
9528
|
*/
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
9529
|
async function getSpace() {
|
|
9119
9530
|
switchToSpace(http);
|
|
9120
|
-
|
|
9121
9531
|
try {
|
|
9122
9532
|
const response = await http.get('/');
|
|
9123
9533
|
return wrapSpace(response.data);
|
|
@@ -9125,6 +9535,7 @@ function createContentfulApi(_ref) {
|
|
|
9125
9535
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9126
9536
|
}
|
|
9127
9537
|
}
|
|
9538
|
+
|
|
9128
9539
|
/**
|
|
9129
9540
|
* Gets a Content Type
|
|
9130
9541
|
* @memberof ContentfulClientAPI
|
|
@@ -9141,11 +9552,8 @@ function createContentfulApi(_ref) {
|
|
|
9141
9552
|
* const contentType = await client.getContentType('<content_type_id>')
|
|
9142
9553
|
* console.log(contentType)
|
|
9143
9554
|
*/
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
9555
|
async function getContentType(id) {
|
|
9147
9556
|
switchToEnvironment(http);
|
|
9148
|
-
|
|
9149
9557
|
try {
|
|
9150
9558
|
const response = await http.get(`content_types/${id}`);
|
|
9151
9559
|
return wrapContentType(response.data);
|
|
@@ -9153,6 +9561,7 @@ function createContentfulApi(_ref) {
|
|
|
9153
9561
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9154
9562
|
}
|
|
9155
9563
|
}
|
|
9564
|
+
|
|
9156
9565
|
/**
|
|
9157
9566
|
* Gets a collection of Content Types
|
|
9158
9567
|
* @memberof ContentfulClientAPI
|
|
@@ -9169,12 +9578,9 @@ function createContentfulApi(_ref) {
|
|
|
9169
9578
|
* const response = await client.getContentTypes()
|
|
9170
9579
|
* console.log(response.items)
|
|
9171
9580
|
*/
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
9581
|
async function getContentTypes() {
|
|
9175
9582
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9176
9583
|
switchToEnvironment(http);
|
|
9177
|
-
|
|
9178
9584
|
try {
|
|
9179
9585
|
const response = await http.get('content_types', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9180
9586
|
query: query
|
|
@@ -9184,6 +9590,7 @@ function createContentfulApi(_ref) {
|
|
|
9184
9590
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9185
9591
|
}
|
|
9186
9592
|
}
|
|
9593
|
+
|
|
9187
9594
|
/**
|
|
9188
9595
|
* Gets an Entry
|
|
9189
9596
|
* @memberof ContentfulClientAPI
|
|
@@ -9201,20 +9608,15 @@ function createContentfulApi(_ref) {
|
|
|
9201
9608
|
* const entry = await client.getEntry('<entry_id>')
|
|
9202
9609
|
* console.log(entry)
|
|
9203
9610
|
*/
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
9611
|
async function getEntry(id) {
|
|
9207
9612
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9208
|
-
|
|
9209
9613
|
if (!id) {
|
|
9210
9614
|
throw notFoundError(id);
|
|
9211
9615
|
}
|
|
9212
|
-
|
|
9213
9616
|
try {
|
|
9214
9617
|
const response = await this.getEntries(_objectSpread({
|
|
9215
9618
|
'sys.id': id
|
|
9216
9619
|
}, query));
|
|
9217
|
-
|
|
9218
9620
|
if (response.items.length > 0) {
|
|
9219
9621
|
return wrapEntry(response.items[0]);
|
|
9220
9622
|
} else {
|
|
@@ -9224,6 +9626,7 @@ function createContentfulApi(_ref) {
|
|
|
9224
9626
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9225
9627
|
}
|
|
9226
9628
|
}
|
|
9629
|
+
|
|
9227
9630
|
/**
|
|
9228
9631
|
* Gets a collection of Entries
|
|
9229
9632
|
* @memberof ContentfulClientAPI
|
|
@@ -9240,8 +9643,6 @@ function createContentfulApi(_ref) {
|
|
|
9240
9643
|
* const response = await client.getEntries()
|
|
9241
9644
|
* console.log(response.items)
|
|
9242
9645
|
*/
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
9646
|
async function getEntries() {
|
|
9246
9647
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9247
9648
|
switchToEnvironment(http);
|
|
@@ -9250,7 +9651,6 @@ function createContentfulApi(_ref) {
|
|
|
9250
9651
|
removeUnresolved
|
|
9251
9652
|
} = getGlobalOptions(query);
|
|
9252
9653
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9253
|
-
|
|
9254
9654
|
try {
|
|
9255
9655
|
const response = await http.get('entries', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9256
9656
|
query: query
|
|
@@ -9280,13 +9680,10 @@ function createContentfulApi(_ref) {
|
|
|
9280
9680
|
* const asset = await client.getAsset('<asset_id>')
|
|
9281
9681
|
* console.log(asset)
|
|
9282
9682
|
*/
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
9683
|
async function getAsset(id) {
|
|
9286
9684
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9287
9685
|
switchToEnvironment(http);
|
|
9288
9686
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9289
|
-
|
|
9290
9687
|
try {
|
|
9291
9688
|
const response = await http.get(`assets/${id}`, Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9292
9689
|
query: query
|
|
@@ -9296,6 +9693,7 @@ function createContentfulApi(_ref) {
|
|
|
9296
9693
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9297
9694
|
}
|
|
9298
9695
|
}
|
|
9696
|
+
|
|
9299
9697
|
/**
|
|
9300
9698
|
* Gets a collection of Assets
|
|
9301
9699
|
* @memberof ContentfulClientAPI
|
|
@@ -9312,13 +9710,10 @@ function createContentfulApi(_ref) {
|
|
|
9312
9710
|
* const response = await client.getAssets()
|
|
9313
9711
|
* console.log(response.items)
|
|
9314
9712
|
*/
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
9713
|
async function getAssets() {
|
|
9318
9714
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9319
9715
|
switchToEnvironment(http);
|
|
9320
9716
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9321
|
-
|
|
9322
9717
|
try {
|
|
9323
9718
|
const response = await http.get('assets', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9324
9719
|
query: query
|
|
@@ -9328,6 +9723,7 @@ function createContentfulApi(_ref) {
|
|
|
9328
9723
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9329
9724
|
}
|
|
9330
9725
|
}
|
|
9726
|
+
|
|
9331
9727
|
/**
|
|
9332
9728
|
* Gets a Tag
|
|
9333
9729
|
* @memberof ContentfulClientAPI
|
|
@@ -9344,11 +9740,8 @@ function createContentfulApi(_ref) {
|
|
|
9344
9740
|
* const tag = await client.getTag('<asset_id>')
|
|
9345
9741
|
* console.log(tag)
|
|
9346
9742
|
*/
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
9743
|
async function getTag(id) {
|
|
9350
9744
|
switchToEnvironment(http);
|
|
9351
|
-
|
|
9352
9745
|
try {
|
|
9353
9746
|
const response = await http.get(`tags/${id}`);
|
|
9354
9747
|
return wrapTag(response.data);
|
|
@@ -9356,6 +9749,7 @@ function createContentfulApi(_ref) {
|
|
|
9356
9749
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9357
9750
|
}
|
|
9358
9751
|
}
|
|
9752
|
+
|
|
9359
9753
|
/**
|
|
9360
9754
|
* Gets a collection of Tags
|
|
9361
9755
|
* @memberof ContentfulClientAPI
|
|
@@ -9372,13 +9766,10 @@ function createContentfulApi(_ref) {
|
|
|
9372
9766
|
* const response = await client.getTags()
|
|
9373
9767
|
* console.log(response.items)
|
|
9374
9768
|
*/
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
9769
|
async function getTags() {
|
|
9378
9770
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9379
9771
|
switchToEnvironment(http);
|
|
9380
9772
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9381
|
-
|
|
9382
9773
|
try {
|
|
9383
9774
|
const response = await http.get('tags', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9384
9775
|
query: query
|
|
@@ -9388,6 +9779,7 @@ function createContentfulApi(_ref) {
|
|
|
9388
9779
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9389
9780
|
}
|
|
9390
9781
|
}
|
|
9782
|
+
|
|
9391
9783
|
/**
|
|
9392
9784
|
* Creates an asset key for signing asset URLs (Embargoed Assets)
|
|
9393
9785
|
* @memberof ContentfulClientAPI
|
|
@@ -9404,11 +9796,8 @@ function createContentfulApi(_ref) {
|
|
|
9404
9796
|
* const assetKey = await client.getAssetKey(<UNIX timestamp>)
|
|
9405
9797
|
* console.log(assetKey)
|
|
9406
9798
|
*/
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
9799
|
async function createAssetKey(expiresAt) {
|
|
9410
9800
|
switchToEnvironment(http);
|
|
9411
|
-
|
|
9412
9801
|
try {
|
|
9413
9802
|
const now = Math.floor(Date.now() / 1000);
|
|
9414
9803
|
const currentMaxLifetime = now + ASSET_KEY_MAX_LIFETIME;
|
|
@@ -9425,6 +9814,7 @@ function createContentfulApi(_ref) {
|
|
|
9425
9814
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9426
9815
|
}
|
|
9427
9816
|
}
|
|
9817
|
+
|
|
9428
9818
|
/**
|
|
9429
9819
|
* Gets a collection of Locale
|
|
9430
9820
|
* @memberof ContentfulClientAPI
|
|
@@ -9441,12 +9831,9 @@ function createContentfulApi(_ref) {
|
|
|
9441
9831
|
* const response = await client.getLocales()
|
|
9442
9832
|
* console.log(response.items)
|
|
9443
9833
|
*/
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
9834
|
async function getLocales() {
|
|
9447
9835
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9448
9836
|
switchToEnvironment(http);
|
|
9449
|
-
|
|
9450
9837
|
try {
|
|
9451
9838
|
const response = await http.get('locales', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9452
9839
|
query: query
|
|
@@ -9456,6 +9843,7 @@ function createContentfulApi(_ref) {
|
|
|
9456
9843
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9457
9844
|
}
|
|
9458
9845
|
}
|
|
9846
|
+
|
|
9459
9847
|
/**
|
|
9460
9848
|
* Synchronizes either all the content or only new content since last sync
|
|
9461
9849
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
@@ -9489,8 +9877,6 @@ function createContentfulApi(_ref) {
|
|
|
9489
9877
|
* nextSyncToken: response.nextSyncToken
|
|
9490
9878
|
* })
|
|
9491
9879
|
*/
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
9880
|
async function sync() {
|
|
9495
9881
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9496
9882
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
@@ -9506,6 +9892,7 @@ function createContentfulApi(_ref) {
|
|
|
9506
9892
|
removeUnresolved
|
|
9507
9893
|
}, options));
|
|
9508
9894
|
}
|
|
9895
|
+
|
|
9509
9896
|
/**
|
|
9510
9897
|
* Parse raw json data into collection of entry objects.Links will be resolved also
|
|
9511
9898
|
* @memberof ContentfulClientAPI
|
|
@@ -9536,8 +9923,6 @@ function createContentfulApi(_ref) {
|
|
|
9536
9923
|
* let parsedData = client.parseEntries(data);
|
|
9537
9924
|
* console.log( parsedData.items[0].fields.foo ); // foo
|
|
9538
9925
|
*/
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
9926
|
function parseEntries(data) {
|
|
9542
9927
|
const {
|
|
9543
9928
|
resolveLinks,
|
|
@@ -9548,23 +9933,20 @@ function createContentfulApi(_ref) {
|
|
|
9548
9933
|
removeUnresolved
|
|
9549
9934
|
});
|
|
9550
9935
|
}
|
|
9936
|
+
|
|
9551
9937
|
/*
|
|
9552
9938
|
* Switches BaseURL to use /environments path
|
|
9553
9939
|
* */
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
9940
|
function switchToEnvironment(http) {
|
|
9557
9941
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
9558
9942
|
}
|
|
9943
|
+
|
|
9559
9944
|
/*
|
|
9560
9945
|
* Switches BaseURL to use /spaces path
|
|
9561
9946
|
* */
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
9947
|
function switchToSpace(http) {
|
|
9565
9948
|
http.defaults.baseURL = getGlobalOptions().spaceBaseUrl;
|
|
9566
9949
|
}
|
|
9567
|
-
|
|
9568
9950
|
return {
|
|
9569
9951
|
getSpace,
|
|
9570
9952
|
getContentType,
|
|
@@ -9628,6 +10010,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9628
10010
|
/* 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");
|
|
9629
10011
|
|
|
9630
10012
|
|
|
10013
|
+
|
|
9631
10014
|
/**
|
|
9632
10015
|
* @memberof Entities
|
|
9633
10016
|
* @typedef AssetKey
|
|
@@ -9641,7 +10024,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9641
10024
|
* @param {Object} data - Raw asset key data
|
|
9642
10025
|
* @return {Asset} Wrapped asset key data
|
|
9643
10026
|
*/
|
|
9644
|
-
|
|
9645
10027
|
function wrapAssetKey(data) {
|
|
9646
10028
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9647
10029
|
}
|
|
@@ -9664,6 +10046,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9664
10046
|
/* 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");
|
|
9665
10047
|
|
|
9666
10048
|
|
|
10049
|
+
|
|
9667
10050
|
/**
|
|
9668
10051
|
* @memberof Entities
|
|
9669
10052
|
* @typedef Asset
|
|
@@ -9685,10 +10068,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9685
10068
|
* @param {Object} data - Raw asset data
|
|
9686
10069
|
* @return {Asset} Wrapped asset data
|
|
9687
10070
|
*/
|
|
9688
|
-
|
|
9689
10071
|
function wrapAsset(data) {
|
|
9690
10072
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9691
10073
|
}
|
|
10074
|
+
|
|
9692
10075
|
/**
|
|
9693
10076
|
* @memberof Entities
|
|
9694
10077
|
* @typedef AssetCollection
|
|
@@ -9704,7 +10087,6 @@ function wrapAsset(data) {
|
|
|
9704
10087
|
* @param {Object} data - Raw asset collection data
|
|
9705
10088
|
* @return {AssetCollection} Wrapped asset collection data
|
|
9706
10089
|
*/
|
|
9707
|
-
|
|
9708
10090
|
function wrapAssetCollection(data) {
|
|
9709
10091
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9710
10092
|
}
|
|
@@ -9727,6 +10109,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9727
10109
|
/* 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");
|
|
9728
10110
|
|
|
9729
10111
|
|
|
10112
|
+
|
|
9730
10113
|
/**
|
|
9731
10114
|
* @memberof Entities
|
|
9732
10115
|
* @typedef ContentType
|
|
@@ -9743,10 +10126,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9743
10126
|
* @param {Object} data - Raw content type data
|
|
9744
10127
|
* @return {ContentType} Wrapped content type data
|
|
9745
10128
|
*/
|
|
9746
|
-
|
|
9747
10129
|
function wrapContentType(data) {
|
|
9748
10130
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9749
10131
|
}
|
|
10132
|
+
|
|
9750
10133
|
/**
|
|
9751
10134
|
* @memberof Entities
|
|
9752
10135
|
* @typedef ContentTypeCollection
|
|
@@ -9762,7 +10145,6 @@ function wrapContentType(data) {
|
|
|
9762
10145
|
* @param {Object} data - Raw content type collection data
|
|
9763
10146
|
* @return {ContentTypeCollection} Wrapped content type collection data
|
|
9764
10147
|
*/
|
|
9765
|
-
|
|
9766
10148
|
function wrapContentTypeCollection(data) {
|
|
9767
10149
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9768
10150
|
}
|
|
@@ -9789,6 +10171,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9789
10171
|
|
|
9790
10172
|
|
|
9791
10173
|
|
|
10174
|
+
|
|
9792
10175
|
/**
|
|
9793
10176
|
* Types of fields found in an Entry
|
|
9794
10177
|
* @namespace EntryFields
|
|
@@ -9859,10 +10242,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9859
10242
|
* @param {Object} data - Raw entry data
|
|
9860
10243
|
* @return {Entry} Wrapped entry data
|
|
9861
10244
|
*/
|
|
9862
|
-
|
|
9863
10245
|
function wrapEntry(data) {
|
|
9864
10246
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9865
10247
|
}
|
|
10248
|
+
|
|
9866
10249
|
/**
|
|
9867
10250
|
* @memberof Entities
|
|
9868
10251
|
* @typedef EntryCollection
|
|
@@ -9883,21 +10266,18 @@ function wrapEntry(data) {
|
|
|
9883
10266
|
* @param {Object} options - wrapper options
|
|
9884
10267
|
* @return {EntryCollection} Wrapped entry collection data
|
|
9885
10268
|
*/
|
|
9886
|
-
|
|
9887
10269
|
function wrapEntryCollection(data, _ref) {
|
|
9888
10270
|
let {
|
|
9889
10271
|
resolveLinks,
|
|
9890
10272
|
removeUnresolved
|
|
9891
10273
|
} = _ref;
|
|
9892
10274
|
const wrappedData = Object(_mixins_stringify_safe__WEBPACK_IMPORTED_MODULE_2__["default"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9893
|
-
|
|
9894
10275
|
if (resolveLinks) {
|
|
9895
10276
|
wrappedData.items = Object(contentful_resolve_response__WEBPACK_IMPORTED_MODULE_3__["default"])(wrappedData, {
|
|
9896
10277
|
removeUnresolved,
|
|
9897
10278
|
itemEntryPoints: ['fields']
|
|
9898
10279
|
});
|
|
9899
10280
|
}
|
|
9900
|
-
|
|
9901
10281
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(wrappedData);
|
|
9902
10282
|
}
|
|
9903
10283
|
|
|
@@ -9954,6 +10334,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9954
10334
|
/* 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");
|
|
9955
10335
|
|
|
9956
10336
|
|
|
10337
|
+
|
|
9957
10338
|
/**
|
|
9958
10339
|
* @memberof Entities
|
|
9959
10340
|
* @typedef Locale
|
|
@@ -9971,10 +10352,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9971
10352
|
* @param {Object} data - Raw locale data
|
|
9972
10353
|
* @return {Locale} Wrapped locale data
|
|
9973
10354
|
*/
|
|
9974
|
-
|
|
9975
10355
|
function wrapLocale(data) {
|
|
9976
10356
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9977
10357
|
}
|
|
10358
|
+
|
|
9978
10359
|
/**
|
|
9979
10360
|
* @memberof Entities
|
|
9980
10361
|
* @typedef LocaleCollection
|
|
@@ -9990,7 +10371,6 @@ function wrapLocale(data) {
|
|
|
9990
10371
|
* @param {Object} data - Raw locale collection data
|
|
9991
10372
|
* @return {LocaleCollection} Wrapped locale collection data
|
|
9992
10373
|
*/
|
|
9993
|
-
|
|
9994
10374
|
function wrapLocaleCollection(data) {
|
|
9995
10375
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
9996
10376
|
}
|
|
@@ -10009,6 +10389,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10009
10389
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapSpace", function() { return wrapSpace; });
|
|
10010
10390
|
/* 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");
|
|
10011
10391
|
|
|
10392
|
+
|
|
10012
10393
|
/**
|
|
10013
10394
|
* @memberof Entities
|
|
10014
10395
|
* @typedef Space
|
|
@@ -10025,7 +10406,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10025
10406
|
* @param {Object} data - API response for a Space
|
|
10026
10407
|
* @return {Space}
|
|
10027
10408
|
*/
|
|
10028
|
-
|
|
10029
10409
|
function wrapSpace(data) {
|
|
10030
10410
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(data));
|
|
10031
10411
|
}
|
|
@@ -10048,6 +10428,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10048
10428
|
/* 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");
|
|
10049
10429
|
|
|
10050
10430
|
|
|
10431
|
+
|
|
10051
10432
|
/**
|
|
10052
10433
|
* @memberof Entities
|
|
10053
10434
|
* @typedef Tag
|
|
@@ -10061,10 +10442,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10061
10442
|
* @param {Object} data - Raw tag data
|
|
10062
10443
|
* @return {Tag} Wrapped tag data
|
|
10063
10444
|
*/
|
|
10064
|
-
|
|
10065
10445
|
function wrapTag(data) {
|
|
10066
10446
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
10067
10447
|
}
|
|
10448
|
+
|
|
10068
10449
|
/**
|
|
10069
10450
|
* @memberof Entities
|
|
10070
10451
|
* @typedef TagCollection
|
|
@@ -10080,7 +10461,6 @@ function wrapTag(data) {
|
|
|
10080
10461
|
* @param {Object} data - Raw tag collection data
|
|
10081
10462
|
* @return {TagCollection} Wrapped tag collection data
|
|
10082
10463
|
*/
|
|
10083
|
-
|
|
10084
10464
|
function wrapTagCollection(data) {
|
|
10085
10465
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["toPlainObject"])(fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(data)));
|
|
10086
10466
|
}
|
|
@@ -10138,11 +10518,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10138
10518
|
/* harmony import */ var contentful_resolve_response__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! contentful-resolve-response */ "../node_modules/contentful-resolve-response/dist/esm/index.js");
|
|
10139
10519
|
/* harmony import */ var _mixins_stringify_safe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mixins/stringify-safe */ "./mixins/stringify-safe.js");
|
|
10140
10520
|
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; }
|
|
10141
|
-
|
|
10142
10521
|
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; }
|
|
10143
|
-
|
|
10144
10522
|
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; }
|
|
10145
|
-
|
|
10146
10523
|
/**
|
|
10147
10524
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
10148
10525
|
* @namespace Sync
|
|
@@ -10150,6 +10527,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10150
10527
|
|
|
10151
10528
|
|
|
10152
10529
|
|
|
10530
|
+
|
|
10153
10531
|
/**
|
|
10154
10532
|
* @memberof Sync
|
|
10155
10533
|
* @typedef SyncCollection
|
|
@@ -10187,74 +10565,62 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10187
10565
|
* @param {boolean} [options.paginate = true] - If further sync pages should automatically be crawled
|
|
10188
10566
|
* @return {Promise<SyncCollection>}
|
|
10189
10567
|
*/
|
|
10190
|
-
|
|
10191
10568
|
async function pagedSync(http, query) {
|
|
10192
10569
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
10193
|
-
|
|
10194
10570
|
if (!query || !query.initial && !query.nextSyncToken && !query.nextPageToken) {
|
|
10195
10571
|
throw new Error('Please provide one of `initial`, `nextSyncToken` or `nextPageToken` parameters for syncing');
|
|
10196
10572
|
}
|
|
10197
|
-
|
|
10198
10573
|
if (query && query.content_type && !query.type) {
|
|
10199
10574
|
query.type = 'Entry';
|
|
10200
10575
|
} else if (query && query.content_type && query.type && query.type !== 'Entry') {
|
|
10201
10576
|
throw new Error('When using the `content_type` filter your `type` parameter cannot be different from `Entry`.');
|
|
10202
10577
|
}
|
|
10203
|
-
|
|
10204
10578
|
const defaultOptions = {
|
|
10205
10579
|
resolveLinks: true,
|
|
10206
10580
|
removeUnresolved: false,
|
|
10207
10581
|
paginate: true
|
|
10208
10582
|
};
|
|
10209
|
-
|
|
10210
10583
|
const {
|
|
10211
10584
|
resolveLinks,
|
|
10212
10585
|
removeUnresolved,
|
|
10213
10586
|
paginate
|
|
10214
10587
|
} = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
10215
|
-
|
|
10216
10588
|
const syncOptions = {
|
|
10217
10589
|
paginate
|
|
10218
10590
|
};
|
|
10219
|
-
const response = await getSyncPage(http, [], query, syncOptions);
|
|
10220
|
-
|
|
10591
|
+
const response = await getSyncPage(http, [], query, syncOptions);
|
|
10592
|
+
// clones response.items used in includes because we don't want these to be mutated
|
|
10221
10593
|
if (resolveLinks) {
|
|
10222
10594
|
response.items = Object(contentful_resolve_response__WEBPACK_IMPORTED_MODULE_1__["default"])(response, {
|
|
10223
10595
|
removeUnresolved,
|
|
10224
10596
|
itemEntryPoints: ['fields']
|
|
10225
10597
|
});
|
|
10226
|
-
}
|
|
10227
|
-
|
|
10228
|
-
|
|
10598
|
+
}
|
|
10599
|
+
// maps response items again after getters are attached
|
|
10229
10600
|
const mappedResponseItems = mapResponseItems(response.items);
|
|
10230
|
-
|
|
10231
10601
|
if (response.nextSyncToken) {
|
|
10232
10602
|
mappedResponseItems.nextSyncToken = response.nextSyncToken;
|
|
10233
10603
|
}
|
|
10234
|
-
|
|
10235
10604
|
if (response.nextPageToken) {
|
|
10236
10605
|
mappedResponseItems.nextPageToken = response.nextPageToken;
|
|
10237
10606
|
}
|
|
10238
|
-
|
|
10239
10607
|
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)));
|
|
10240
10608
|
}
|
|
10609
|
+
|
|
10241
10610
|
/**
|
|
10242
10611
|
* @private
|
|
10243
10612
|
* @param {Array<Entities.Entry|Entities.Array|Sync.DeletedEntry|Sync.DeletedAsset>} items
|
|
10244
10613
|
* @return {Object} Entities mapped to an object for each entity type
|
|
10245
10614
|
*/
|
|
10246
|
-
|
|
10247
10615
|
function mapResponseItems(items) {
|
|
10248
10616
|
const reducer = type => {
|
|
10249
10617
|
return (accumulated, item) => {
|
|
10250
10618
|
if (item.sys.type === type) {
|
|
10251
10619
|
accumulated.push(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(item));
|
|
10252
10620
|
}
|
|
10253
|
-
|
|
10254
10621
|
return accumulated;
|
|
10255
10622
|
};
|
|
10256
10623
|
};
|
|
10257
|
-
|
|
10258
10624
|
return {
|
|
10259
10625
|
entries: items.reduce(reducer('Entry'), []),
|
|
10260
10626
|
assets: items.reduce(reducer('Asset'), []),
|
|
@@ -10262,6 +10628,7 @@ function mapResponseItems(items) {
|
|
|
10262
10628
|
deletedAssets: items.reduce(reducer('DeletedAsset'), [])
|
|
10263
10629
|
};
|
|
10264
10630
|
}
|
|
10631
|
+
|
|
10265
10632
|
/**
|
|
10266
10633
|
* If the response contains a nextPageUrl, extracts the sync token to get the
|
|
10267
10634
|
* next page and calls itself again with that token.
|
|
@@ -10277,36 +10644,29 @@ function mapResponseItems(items) {
|
|
|
10277
10644
|
* @param {boolean} [options.paginate = true] - If further sync pages should automatically be crawled
|
|
10278
10645
|
* @return {Promise<{items: Array, nextSyncToken: string}>}
|
|
10279
10646
|
*/
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
10647
|
async function getSyncPage(http, items, query, _ref) {
|
|
10283
10648
|
let {
|
|
10284
10649
|
paginate
|
|
10285
10650
|
} = _ref;
|
|
10286
|
-
|
|
10287
10651
|
if (query.nextSyncToken) {
|
|
10288
10652
|
query.sync_token = query.nextSyncToken;
|
|
10289
10653
|
delete query.nextSyncToken;
|
|
10290
10654
|
}
|
|
10291
|
-
|
|
10292
10655
|
if (query.nextPageToken) {
|
|
10293
10656
|
query.sync_token = query.nextPageToken;
|
|
10294
10657
|
delete query.nextPageToken;
|
|
10295
10658
|
}
|
|
10296
|
-
|
|
10297
10659
|
if (query.sync_token) {
|
|
10298
10660
|
delete query.initial;
|
|
10299
10661
|
delete query.type;
|
|
10300
10662
|
delete query.content_type;
|
|
10301
10663
|
delete query.limit;
|
|
10302
10664
|
}
|
|
10303
|
-
|
|
10304
10665
|
const response = await http.get('sync', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10305
10666
|
query: query
|
|
10306
10667
|
}));
|
|
10307
10668
|
const data = response.data || {};
|
|
10308
10669
|
items = items.concat(data.items || []);
|
|
10309
|
-
|
|
10310
10670
|
if (data.nextPageUrl) {
|
|
10311
10671
|
if (paginate) {
|
|
10312
10672
|
delete query.initial;
|
|
@@ -10315,7 +10675,6 @@ async function getSyncPage(http, items, query, _ref) {
|
|
|
10315
10675
|
paginate
|
|
10316
10676
|
});
|
|
10317
10677
|
}
|
|
10318
|
-
|
|
10319
10678
|
return {
|
|
10320
10679
|
items: items,
|
|
10321
10680
|
nextPageToken: getToken(data.nextPageUrl)
|
|
@@ -10331,12 +10690,11 @@ async function getSyncPage(http, items, query, _ref) {
|
|
|
10331
10690
|
};
|
|
10332
10691
|
}
|
|
10333
10692
|
}
|
|
10693
|
+
|
|
10334
10694
|
/**
|
|
10335
10695
|
* Extracts token out of an url
|
|
10336
10696
|
* @private
|
|
10337
10697
|
*/
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
10698
|
function getToken(url) {
|
|
10341
10699
|
const urlParts = url.split('?');
|
|
10342
10700
|
return urlParts.length > 0 ? urlParts[1].replace('sync_token=', '') : '';
|
|
@@ -10355,36 +10713,36 @@ function getToken(url) {
|
|
|
10355
10713
|
__webpack_require__.r(__webpack_exports__);
|
|
10356
10714
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeSelect; });
|
|
10357
10715
|
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; }
|
|
10358
|
-
|
|
10359
10716
|
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; }
|
|
10360
|
-
|
|
10361
10717
|
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; }
|
|
10362
|
-
|
|
10363
10718
|
/*
|
|
10364
10719
|
* sdk relies heavily on sys metadata
|
|
10365
10720
|
* so we cannot omit the sys property on sdk level entirely
|
|
10366
10721
|
* and we have to ensure that at least `id` and `type` are present
|
|
10367
10722
|
* */
|
|
10723
|
+
|
|
10368
10724
|
function normalizeSelect(query) {
|
|
10369
10725
|
if (!query.select) {
|
|
10370
10726
|
return query;
|
|
10371
|
-
}
|
|
10372
|
-
// Get the different parts that are listed for selection
|
|
10373
|
-
|
|
10727
|
+
}
|
|
10374
10728
|
|
|
10375
|
-
|
|
10729
|
+
// The selection of fields for the query is limited
|
|
10730
|
+
// Get the different parts that are listed for selection
|
|
10731
|
+
const allSelects = Array.isArray(query.select) ? query.select : query.select.split(',');
|
|
10732
|
+
// Move the parts into a set for easy access and deduplication
|
|
10733
|
+
const selectedSet = new Set(allSelects);
|
|
10376
10734
|
|
|
10377
|
-
|
|
10735
|
+
// If we already select all of `sys` we can just return
|
|
10378
10736
|
// since we're anyway fetching everything that is needed
|
|
10379
|
-
|
|
10380
10737
|
if (selectedSet.has('sys')) {
|
|
10381
10738
|
return query;
|
|
10382
|
-
}
|
|
10383
|
-
|
|
10739
|
+
}
|
|
10384
10740
|
|
|
10741
|
+
// We don't select `sys` so we need to ensure the minimum set
|
|
10385
10742
|
selectedSet.add('sys.id');
|
|
10386
|
-
selectedSet.add('sys.type');
|
|
10743
|
+
selectedSet.add('sys.type');
|
|
10387
10744
|
|
|
10745
|
+
// Reassign the normalized sys properties
|
|
10388
10746
|
return _objectSpread(_objectSpread({}, query), {}, {
|
|
10389
10747
|
select: [...selectedSet].join(',')
|
|
10390
10748
|
});
|
|
@@ -10408,19 +10766,15 @@ class ValidationError extends Error {
|
|
|
10408
10766
|
super(`Invalid "${name}" provided, ` + message);
|
|
10409
10767
|
this.name = 'ValidationError';
|
|
10410
10768
|
}
|
|
10411
|
-
|
|
10412
10769
|
}
|
|
10413
10770
|
function validateTimestamp(name, timestamp, options) {
|
|
10414
10771
|
options = options || {};
|
|
10415
|
-
|
|
10416
10772
|
if (typeof timestamp !== 'number') {
|
|
10417
10773
|
throw new ValidationError(name, `only numeric values are allowed for timestamps, provided type was "${typeof timestamp}"`);
|
|
10418
10774
|
}
|
|
10419
|
-
|
|
10420
10775
|
if (options.maximum && timestamp > options.maximum) {
|
|
10421
10776
|
throw new ValidationError(name, `value (${timestamp}) cannot be further in the future than expected maximum (${options.maximum})`);
|
|
10422
10777
|
}
|
|
10423
|
-
|
|
10424
10778
|
if (options.now && timestamp < options.now) {
|
|
10425
10779
|
throw new ValidationError(name, `value (${timestamp}) cannot be in the past, current time was ${options.now}`);
|
|
10426
10780
|
}
|