contentful 9.2.4 → 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 +484 -121
- package/dist/contentful.browser.js.map +1 -1
- package/dist/contentful.browser.min.js +3 -3
- package/dist/contentful.node.js +478 -118
- 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 +2 -11
- 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.4"}`, 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).
|
|
@@ -9011,6 +9423,15 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
9011
9423
|
* @prop {string} linkType - type of this link. If defined, either Entry or Asset
|
|
9012
9424
|
*/
|
|
9013
9425
|
|
|
9426
|
+
/**
|
|
9427
|
+
* Link to another entity in a different space.
|
|
9428
|
+
* @memberof Entities
|
|
9429
|
+
* @typedef ResourceLink
|
|
9430
|
+
* @prop {string} type - type of this entity. Always ResourceLink.
|
|
9431
|
+
* @prop {string} urn
|
|
9432
|
+
* @prop {string} linkType - type of this link. Always Contentful:Entry
|
|
9433
|
+
*/
|
|
9434
|
+
|
|
9014
9435
|
/**
|
|
9015
9436
|
* @memberof ContentfulClientAPI
|
|
9016
9437
|
* @typedef {Object} ClientAPI
|
|
@@ -9032,7 +9453,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
9032
9453
|
|
|
9033
9454
|
|
|
9034
9455
|
|
|
9456
|
+
|
|
9035
9457
|
const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
9458
|
+
|
|
9036
9459
|
/**
|
|
9037
9460
|
* Creates API object with methods to access functionality from Contentful's
|
|
9038
9461
|
* Delivery API
|
|
@@ -9043,7 +9466,6 @@ const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
|
9043
9466
|
* @prop {Function} getGlobalOptions - Link resolver preconfigured with global setting
|
|
9044
9467
|
* @return {ClientAPI}
|
|
9045
9468
|
*/
|
|
9046
|
-
|
|
9047
9469
|
function createContentfulApi(_ref) {
|
|
9048
9470
|
let {
|
|
9049
9471
|
http,
|
|
@@ -9074,7 +9496,6 @@ function createContentfulApi(_ref) {
|
|
|
9074
9496
|
const {
|
|
9075
9497
|
wrapLocaleCollection
|
|
9076
9498
|
} = _entities__WEBPACK_IMPORTED_MODULE_1__["default"].locale;
|
|
9077
|
-
|
|
9078
9499
|
const notFoundError = id => {
|
|
9079
9500
|
const error = new Error('The resource could not be found.');
|
|
9080
9501
|
error.sys = {
|
|
@@ -9089,6 +9510,7 @@ function createContentfulApi(_ref) {
|
|
|
9089
9510
|
};
|
|
9090
9511
|
return error;
|
|
9091
9512
|
};
|
|
9513
|
+
|
|
9092
9514
|
/**
|
|
9093
9515
|
* Gets the Space which the client is currently configured to use
|
|
9094
9516
|
* @memberof ContentfulClientAPI
|
|
@@ -9104,11 +9526,8 @@ function createContentfulApi(_ref) {
|
|
|
9104
9526
|
* const space = await client.getSpace()
|
|
9105
9527
|
* console.log(space)
|
|
9106
9528
|
*/
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
9529
|
async function getSpace() {
|
|
9110
9530
|
switchToSpace(http);
|
|
9111
|
-
|
|
9112
9531
|
try {
|
|
9113
9532
|
const response = await http.get('/');
|
|
9114
9533
|
return wrapSpace(response.data);
|
|
@@ -9116,6 +9535,7 @@ function createContentfulApi(_ref) {
|
|
|
9116
9535
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9117
9536
|
}
|
|
9118
9537
|
}
|
|
9538
|
+
|
|
9119
9539
|
/**
|
|
9120
9540
|
* Gets a Content Type
|
|
9121
9541
|
* @memberof ContentfulClientAPI
|
|
@@ -9132,11 +9552,8 @@ function createContentfulApi(_ref) {
|
|
|
9132
9552
|
* const contentType = await client.getContentType('<content_type_id>')
|
|
9133
9553
|
* console.log(contentType)
|
|
9134
9554
|
*/
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
9555
|
async function getContentType(id) {
|
|
9138
9556
|
switchToEnvironment(http);
|
|
9139
|
-
|
|
9140
9557
|
try {
|
|
9141
9558
|
const response = await http.get(`content_types/${id}`);
|
|
9142
9559
|
return wrapContentType(response.data);
|
|
@@ -9144,6 +9561,7 @@ function createContentfulApi(_ref) {
|
|
|
9144
9561
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9145
9562
|
}
|
|
9146
9563
|
}
|
|
9564
|
+
|
|
9147
9565
|
/**
|
|
9148
9566
|
* Gets a collection of Content Types
|
|
9149
9567
|
* @memberof ContentfulClientAPI
|
|
@@ -9160,12 +9578,9 @@ function createContentfulApi(_ref) {
|
|
|
9160
9578
|
* const response = await client.getContentTypes()
|
|
9161
9579
|
* console.log(response.items)
|
|
9162
9580
|
*/
|
|
9163
|
-
|
|
9164
|
-
|
|
9165
9581
|
async function getContentTypes() {
|
|
9166
9582
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9167
9583
|
switchToEnvironment(http);
|
|
9168
|
-
|
|
9169
9584
|
try {
|
|
9170
9585
|
const response = await http.get('content_types', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9171
9586
|
query: query
|
|
@@ -9175,6 +9590,7 @@ function createContentfulApi(_ref) {
|
|
|
9175
9590
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9176
9591
|
}
|
|
9177
9592
|
}
|
|
9593
|
+
|
|
9178
9594
|
/**
|
|
9179
9595
|
* Gets an Entry
|
|
9180
9596
|
* @memberof ContentfulClientAPI
|
|
@@ -9192,20 +9608,15 @@ function createContentfulApi(_ref) {
|
|
|
9192
9608
|
* const entry = await client.getEntry('<entry_id>')
|
|
9193
9609
|
* console.log(entry)
|
|
9194
9610
|
*/
|
|
9195
|
-
|
|
9196
|
-
|
|
9197
9611
|
async function getEntry(id) {
|
|
9198
9612
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9199
|
-
|
|
9200
9613
|
if (!id) {
|
|
9201
9614
|
throw notFoundError(id);
|
|
9202
9615
|
}
|
|
9203
|
-
|
|
9204
9616
|
try {
|
|
9205
9617
|
const response = await this.getEntries(_objectSpread({
|
|
9206
9618
|
'sys.id': id
|
|
9207
9619
|
}, query));
|
|
9208
|
-
|
|
9209
9620
|
if (response.items.length > 0) {
|
|
9210
9621
|
return wrapEntry(response.items[0]);
|
|
9211
9622
|
} else {
|
|
@@ -9215,6 +9626,7 @@ function createContentfulApi(_ref) {
|
|
|
9215
9626
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9216
9627
|
}
|
|
9217
9628
|
}
|
|
9629
|
+
|
|
9218
9630
|
/**
|
|
9219
9631
|
* Gets a collection of Entries
|
|
9220
9632
|
* @memberof ContentfulClientAPI
|
|
@@ -9231,8 +9643,6 @@ function createContentfulApi(_ref) {
|
|
|
9231
9643
|
* const response = await client.getEntries()
|
|
9232
9644
|
* console.log(response.items)
|
|
9233
9645
|
*/
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
9646
|
async function getEntries() {
|
|
9237
9647
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9238
9648
|
switchToEnvironment(http);
|
|
@@ -9241,7 +9651,6 @@ function createContentfulApi(_ref) {
|
|
|
9241
9651
|
removeUnresolved
|
|
9242
9652
|
} = getGlobalOptions(query);
|
|
9243
9653
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9244
|
-
|
|
9245
9654
|
try {
|
|
9246
9655
|
const response = await http.get('entries', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9247
9656
|
query: query
|
|
@@ -9271,13 +9680,10 @@ function createContentfulApi(_ref) {
|
|
|
9271
9680
|
* const asset = await client.getAsset('<asset_id>')
|
|
9272
9681
|
* console.log(asset)
|
|
9273
9682
|
*/
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
9683
|
async function getAsset(id) {
|
|
9277
9684
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9278
9685
|
switchToEnvironment(http);
|
|
9279
9686
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9280
|
-
|
|
9281
9687
|
try {
|
|
9282
9688
|
const response = await http.get(`assets/${id}`, Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9283
9689
|
query: query
|
|
@@ -9287,6 +9693,7 @@ function createContentfulApi(_ref) {
|
|
|
9287
9693
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9288
9694
|
}
|
|
9289
9695
|
}
|
|
9696
|
+
|
|
9290
9697
|
/**
|
|
9291
9698
|
* Gets a collection of Assets
|
|
9292
9699
|
* @memberof ContentfulClientAPI
|
|
@@ -9303,13 +9710,10 @@ function createContentfulApi(_ref) {
|
|
|
9303
9710
|
* const response = await client.getAssets()
|
|
9304
9711
|
* console.log(response.items)
|
|
9305
9712
|
*/
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
9713
|
async function getAssets() {
|
|
9309
9714
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9310
9715
|
switchToEnvironment(http);
|
|
9311
9716
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9312
|
-
|
|
9313
9717
|
try {
|
|
9314
9718
|
const response = await http.get('assets', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9315
9719
|
query: query
|
|
@@ -9319,6 +9723,7 @@ function createContentfulApi(_ref) {
|
|
|
9319
9723
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9320
9724
|
}
|
|
9321
9725
|
}
|
|
9726
|
+
|
|
9322
9727
|
/**
|
|
9323
9728
|
* Gets a Tag
|
|
9324
9729
|
* @memberof ContentfulClientAPI
|
|
@@ -9335,11 +9740,8 @@ function createContentfulApi(_ref) {
|
|
|
9335
9740
|
* const tag = await client.getTag('<asset_id>')
|
|
9336
9741
|
* console.log(tag)
|
|
9337
9742
|
*/
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
9743
|
async function getTag(id) {
|
|
9341
9744
|
switchToEnvironment(http);
|
|
9342
|
-
|
|
9343
9745
|
try {
|
|
9344
9746
|
const response = await http.get(`tags/${id}`);
|
|
9345
9747
|
return wrapTag(response.data);
|
|
@@ -9347,6 +9749,7 @@ function createContentfulApi(_ref) {
|
|
|
9347
9749
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9348
9750
|
}
|
|
9349
9751
|
}
|
|
9752
|
+
|
|
9350
9753
|
/**
|
|
9351
9754
|
* Gets a collection of Tags
|
|
9352
9755
|
* @memberof ContentfulClientAPI
|
|
@@ -9363,13 +9766,10 @@ function createContentfulApi(_ref) {
|
|
|
9363
9766
|
* const response = await client.getTags()
|
|
9364
9767
|
* console.log(response.items)
|
|
9365
9768
|
*/
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
9769
|
async function getTags() {
|
|
9369
9770
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9370
9771
|
switchToEnvironment(http);
|
|
9371
9772
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9372
|
-
|
|
9373
9773
|
try {
|
|
9374
9774
|
const response = await http.get('tags', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9375
9775
|
query: query
|
|
@@ -9379,6 +9779,7 @@ function createContentfulApi(_ref) {
|
|
|
9379
9779
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9380
9780
|
}
|
|
9381
9781
|
}
|
|
9782
|
+
|
|
9382
9783
|
/**
|
|
9383
9784
|
* Creates an asset key for signing asset URLs (Embargoed Assets)
|
|
9384
9785
|
* @memberof ContentfulClientAPI
|
|
@@ -9395,11 +9796,8 @@ function createContentfulApi(_ref) {
|
|
|
9395
9796
|
* const assetKey = await client.getAssetKey(<UNIX timestamp>)
|
|
9396
9797
|
* console.log(assetKey)
|
|
9397
9798
|
*/
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
9799
|
async function createAssetKey(expiresAt) {
|
|
9401
9800
|
switchToEnvironment(http);
|
|
9402
|
-
|
|
9403
9801
|
try {
|
|
9404
9802
|
const now = Math.floor(Date.now() / 1000);
|
|
9405
9803
|
const currentMaxLifetime = now + ASSET_KEY_MAX_LIFETIME;
|
|
@@ -9416,6 +9814,7 @@ function createContentfulApi(_ref) {
|
|
|
9416
9814
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9417
9815
|
}
|
|
9418
9816
|
}
|
|
9817
|
+
|
|
9419
9818
|
/**
|
|
9420
9819
|
* Gets a collection of Locale
|
|
9421
9820
|
* @memberof ContentfulClientAPI
|
|
@@ -9432,12 +9831,9 @@ function createContentfulApi(_ref) {
|
|
|
9432
9831
|
* const response = await client.getLocales()
|
|
9433
9832
|
* console.log(response.items)
|
|
9434
9833
|
*/
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
9834
|
async function getLocales() {
|
|
9438
9835
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9439
9836
|
switchToEnvironment(http);
|
|
9440
|
-
|
|
9441
9837
|
try {
|
|
9442
9838
|
const response = await http.get('locales', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9443
9839
|
query: query
|
|
@@ -9447,6 +9843,7 @@ function createContentfulApi(_ref) {
|
|
|
9447
9843
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9448
9844
|
}
|
|
9449
9845
|
}
|
|
9846
|
+
|
|
9450
9847
|
/**
|
|
9451
9848
|
* Synchronizes either all the content or only new content since last sync
|
|
9452
9849
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
@@ -9480,8 +9877,6 @@ function createContentfulApi(_ref) {
|
|
|
9480
9877
|
* nextSyncToken: response.nextSyncToken
|
|
9481
9878
|
* })
|
|
9482
9879
|
*/
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
9880
|
async function sync() {
|
|
9486
9881
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9487
9882
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
@@ -9497,6 +9892,7 @@ function createContentfulApi(_ref) {
|
|
|
9497
9892
|
removeUnresolved
|
|
9498
9893
|
}, options));
|
|
9499
9894
|
}
|
|
9895
|
+
|
|
9500
9896
|
/**
|
|
9501
9897
|
* Parse raw json data into collection of entry objects.Links will be resolved also
|
|
9502
9898
|
* @memberof ContentfulClientAPI
|
|
@@ -9527,8 +9923,6 @@ function createContentfulApi(_ref) {
|
|
|
9527
9923
|
* let parsedData = client.parseEntries(data);
|
|
9528
9924
|
* console.log( parsedData.items[0].fields.foo ); // foo
|
|
9529
9925
|
*/
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
9926
|
function parseEntries(data) {
|
|
9533
9927
|
const {
|
|
9534
9928
|
resolveLinks,
|
|
@@ -9539,23 +9933,20 @@ function createContentfulApi(_ref) {
|
|
|
9539
9933
|
removeUnresolved
|
|
9540
9934
|
});
|
|
9541
9935
|
}
|
|
9936
|
+
|
|
9542
9937
|
/*
|
|
9543
9938
|
* Switches BaseURL to use /environments path
|
|
9544
9939
|
* */
|
|
9545
|
-
|
|
9546
|
-
|
|
9547
9940
|
function switchToEnvironment(http) {
|
|
9548
9941
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
9549
9942
|
}
|
|
9943
|
+
|
|
9550
9944
|
/*
|
|
9551
9945
|
* Switches BaseURL to use /spaces path
|
|
9552
9946
|
* */
|
|
9553
|
-
|
|
9554
|
-
|
|
9555
9947
|
function switchToSpace(http) {
|
|
9556
9948
|
http.defaults.baseURL = getGlobalOptions().spaceBaseUrl;
|
|
9557
9949
|
}
|
|
9558
|
-
|
|
9559
9950
|
return {
|
|
9560
9951
|
getSpace,
|
|
9561
9952
|
getContentType,
|
|
@@ -9619,6 +10010,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9619
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");
|
|
9620
10011
|
|
|
9621
10012
|
|
|
10013
|
+
|
|
9622
10014
|
/**
|
|
9623
10015
|
* @memberof Entities
|
|
9624
10016
|
* @typedef AssetKey
|
|
@@ -9632,7 +10024,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9632
10024
|
* @param {Object} data - Raw asset key data
|
|
9633
10025
|
* @return {Asset} Wrapped asset key data
|
|
9634
10026
|
*/
|
|
9635
|
-
|
|
9636
10027
|
function wrapAssetKey(data) {
|
|
9637
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)));
|
|
9638
10029
|
}
|
|
@@ -9655,6 +10046,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9655
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");
|
|
9656
10047
|
|
|
9657
10048
|
|
|
10049
|
+
|
|
9658
10050
|
/**
|
|
9659
10051
|
* @memberof Entities
|
|
9660
10052
|
* @typedef Asset
|
|
@@ -9676,10 +10068,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9676
10068
|
* @param {Object} data - Raw asset data
|
|
9677
10069
|
* @return {Asset} Wrapped asset data
|
|
9678
10070
|
*/
|
|
9679
|
-
|
|
9680
10071
|
function wrapAsset(data) {
|
|
9681
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)));
|
|
9682
10073
|
}
|
|
10074
|
+
|
|
9683
10075
|
/**
|
|
9684
10076
|
* @memberof Entities
|
|
9685
10077
|
* @typedef AssetCollection
|
|
@@ -9695,7 +10087,6 @@ function wrapAsset(data) {
|
|
|
9695
10087
|
* @param {Object} data - Raw asset collection data
|
|
9696
10088
|
* @return {AssetCollection} Wrapped asset collection data
|
|
9697
10089
|
*/
|
|
9698
|
-
|
|
9699
10090
|
function wrapAssetCollection(data) {
|
|
9700
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)));
|
|
9701
10092
|
}
|
|
@@ -9718,6 +10109,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9718
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");
|
|
9719
10110
|
|
|
9720
10111
|
|
|
10112
|
+
|
|
9721
10113
|
/**
|
|
9722
10114
|
* @memberof Entities
|
|
9723
10115
|
* @typedef ContentType
|
|
@@ -9734,10 +10126,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9734
10126
|
* @param {Object} data - Raw content type data
|
|
9735
10127
|
* @return {ContentType} Wrapped content type data
|
|
9736
10128
|
*/
|
|
9737
|
-
|
|
9738
10129
|
function wrapContentType(data) {
|
|
9739
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)));
|
|
9740
10131
|
}
|
|
10132
|
+
|
|
9741
10133
|
/**
|
|
9742
10134
|
* @memberof Entities
|
|
9743
10135
|
* @typedef ContentTypeCollection
|
|
@@ -9753,7 +10145,6 @@ function wrapContentType(data) {
|
|
|
9753
10145
|
* @param {Object} data - Raw content type collection data
|
|
9754
10146
|
* @return {ContentTypeCollection} Wrapped content type collection data
|
|
9755
10147
|
*/
|
|
9756
|
-
|
|
9757
10148
|
function wrapContentTypeCollection(data) {
|
|
9758
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)));
|
|
9759
10150
|
}
|
|
@@ -9780,6 +10171,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9780
10171
|
|
|
9781
10172
|
|
|
9782
10173
|
|
|
10174
|
+
|
|
9783
10175
|
/**
|
|
9784
10176
|
* Types of fields found in an Entry
|
|
9785
10177
|
* @namespace EntryFields
|
|
@@ -9832,7 +10224,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9832
10224
|
* A Field in an Entry can have one of the following types that can be defined in Contentful. See <a href="https://www.contentful.com/developers/docs/references/field-type/">Field Types</a> for more details.
|
|
9833
10225
|
* @memberof Entities
|
|
9834
10226
|
* @typedef Field
|
|
9835
|
-
* @type EntryFields.Symbol | EntryFields.Text | EntryFields.Integer | EntryFields.Number | EntryFields.Date | EntryFields.Boolean | EntryFields.Location | Entities.Link | Array<EntryFields.Symbol|Entities.Link> | Object
|
|
10227
|
+
* @type EntryFields.Symbol | EntryFields.Text | EntryFields.Integer | EntryFields.Number | EntryFields.Date | EntryFields.Boolean | EntryFields.Location | Entities.Link | Entities.ResourceLink | Array<EntryFields.Symbol|Entities.Link|Entities.ResourceLink> | Object
|
|
9836
10228
|
*/
|
|
9837
10229
|
|
|
9838
10230
|
/**
|
|
@@ -9850,10 +10242,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9850
10242
|
* @param {Object} data - Raw entry data
|
|
9851
10243
|
* @return {Entry} Wrapped entry data
|
|
9852
10244
|
*/
|
|
9853
|
-
|
|
9854
10245
|
function wrapEntry(data) {
|
|
9855
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)));
|
|
9856
10247
|
}
|
|
10248
|
+
|
|
9857
10249
|
/**
|
|
9858
10250
|
* @memberof Entities
|
|
9859
10251
|
* @typedef EntryCollection
|
|
@@ -9874,21 +10266,18 @@ function wrapEntry(data) {
|
|
|
9874
10266
|
* @param {Object} options - wrapper options
|
|
9875
10267
|
* @return {EntryCollection} Wrapped entry collection data
|
|
9876
10268
|
*/
|
|
9877
|
-
|
|
9878
10269
|
function wrapEntryCollection(data, _ref) {
|
|
9879
10270
|
let {
|
|
9880
10271
|
resolveLinks,
|
|
9881
10272
|
removeUnresolved
|
|
9882
10273
|
} = _ref;
|
|
9883
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)));
|
|
9884
|
-
|
|
9885
10275
|
if (resolveLinks) {
|
|
9886
10276
|
wrappedData.items = Object(contentful_resolve_response__WEBPACK_IMPORTED_MODULE_3__["default"])(wrappedData, {
|
|
9887
10277
|
removeUnresolved,
|
|
9888
10278
|
itemEntryPoints: ['fields']
|
|
9889
10279
|
});
|
|
9890
10280
|
}
|
|
9891
|
-
|
|
9892
10281
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(wrappedData);
|
|
9893
10282
|
}
|
|
9894
10283
|
|
|
@@ -9945,6 +10334,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9945
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");
|
|
9946
10335
|
|
|
9947
10336
|
|
|
10337
|
+
|
|
9948
10338
|
/**
|
|
9949
10339
|
* @memberof Entities
|
|
9950
10340
|
* @typedef Locale
|
|
@@ -9962,10 +10352,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9962
10352
|
* @param {Object} data - Raw locale data
|
|
9963
10353
|
* @return {Locale} Wrapped locale data
|
|
9964
10354
|
*/
|
|
9965
|
-
|
|
9966
10355
|
function wrapLocale(data) {
|
|
9967
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)));
|
|
9968
10357
|
}
|
|
10358
|
+
|
|
9969
10359
|
/**
|
|
9970
10360
|
* @memberof Entities
|
|
9971
10361
|
* @typedef LocaleCollection
|
|
@@ -9981,7 +10371,6 @@ function wrapLocale(data) {
|
|
|
9981
10371
|
* @param {Object} data - Raw locale collection data
|
|
9982
10372
|
* @return {LocaleCollection} Wrapped locale collection data
|
|
9983
10373
|
*/
|
|
9984
|
-
|
|
9985
10374
|
function wrapLocaleCollection(data) {
|
|
9986
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)));
|
|
9987
10376
|
}
|
|
@@ -10000,6 +10389,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10000
10389
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapSpace", function() { return wrapSpace; });
|
|
10001
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");
|
|
10002
10391
|
|
|
10392
|
+
|
|
10003
10393
|
/**
|
|
10004
10394
|
* @memberof Entities
|
|
10005
10395
|
* @typedef Space
|
|
@@ -10016,7 +10406,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10016
10406
|
* @param {Object} data - API response for a Space
|
|
10017
10407
|
* @return {Space}
|
|
10018
10408
|
*/
|
|
10019
|
-
|
|
10020
10409
|
function wrapSpace(data) {
|
|
10021
10410
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(data));
|
|
10022
10411
|
}
|
|
@@ -10039,6 +10428,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10039
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");
|
|
10040
10429
|
|
|
10041
10430
|
|
|
10431
|
+
|
|
10042
10432
|
/**
|
|
10043
10433
|
* @memberof Entities
|
|
10044
10434
|
* @typedef Tag
|
|
@@ -10052,10 +10442,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10052
10442
|
* @param {Object} data - Raw tag data
|
|
10053
10443
|
* @return {Tag} Wrapped tag data
|
|
10054
10444
|
*/
|
|
10055
|
-
|
|
10056
10445
|
function wrapTag(data) {
|
|
10057
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)));
|
|
10058
10447
|
}
|
|
10448
|
+
|
|
10059
10449
|
/**
|
|
10060
10450
|
* @memberof Entities
|
|
10061
10451
|
* @typedef TagCollection
|
|
@@ -10071,7 +10461,6 @@ function wrapTag(data) {
|
|
|
10071
10461
|
* @param {Object} data - Raw tag collection data
|
|
10072
10462
|
* @return {TagCollection} Wrapped tag collection data
|
|
10073
10463
|
*/
|
|
10074
|
-
|
|
10075
10464
|
function wrapTagCollection(data) {
|
|
10076
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)));
|
|
10077
10466
|
}
|
|
@@ -10129,11 +10518,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10129
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");
|
|
10130
10519
|
/* harmony import */ var _mixins_stringify_safe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mixins/stringify-safe */ "./mixins/stringify-safe.js");
|
|
10131
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; }
|
|
10132
|
-
|
|
10133
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; }
|
|
10134
|
-
|
|
10135
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; }
|
|
10136
|
-
|
|
10137
10523
|
/**
|
|
10138
10524
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
10139
10525
|
* @namespace Sync
|
|
@@ -10141,6 +10527,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10141
10527
|
|
|
10142
10528
|
|
|
10143
10529
|
|
|
10530
|
+
|
|
10144
10531
|
/**
|
|
10145
10532
|
* @memberof Sync
|
|
10146
10533
|
* @typedef SyncCollection
|
|
@@ -10178,74 +10565,62 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10178
10565
|
* @param {boolean} [options.paginate = true] - If further sync pages should automatically be crawled
|
|
10179
10566
|
* @return {Promise<SyncCollection>}
|
|
10180
10567
|
*/
|
|
10181
|
-
|
|
10182
10568
|
async function pagedSync(http, query) {
|
|
10183
10569
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
10184
|
-
|
|
10185
10570
|
if (!query || !query.initial && !query.nextSyncToken && !query.nextPageToken) {
|
|
10186
10571
|
throw new Error('Please provide one of `initial`, `nextSyncToken` or `nextPageToken` parameters for syncing');
|
|
10187
10572
|
}
|
|
10188
|
-
|
|
10189
10573
|
if (query && query.content_type && !query.type) {
|
|
10190
10574
|
query.type = 'Entry';
|
|
10191
10575
|
} else if (query && query.content_type && query.type && query.type !== 'Entry') {
|
|
10192
10576
|
throw new Error('When using the `content_type` filter your `type` parameter cannot be different from `Entry`.');
|
|
10193
10577
|
}
|
|
10194
|
-
|
|
10195
10578
|
const defaultOptions = {
|
|
10196
10579
|
resolveLinks: true,
|
|
10197
10580
|
removeUnresolved: false,
|
|
10198
10581
|
paginate: true
|
|
10199
10582
|
};
|
|
10200
|
-
|
|
10201
10583
|
const {
|
|
10202
10584
|
resolveLinks,
|
|
10203
10585
|
removeUnresolved,
|
|
10204
10586
|
paginate
|
|
10205
10587
|
} = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
10206
|
-
|
|
10207
10588
|
const syncOptions = {
|
|
10208
10589
|
paginate
|
|
10209
10590
|
};
|
|
10210
|
-
const response = await getSyncPage(http, [], query, syncOptions);
|
|
10211
|
-
|
|
10591
|
+
const response = await getSyncPage(http, [], query, syncOptions);
|
|
10592
|
+
// clones response.items used in includes because we don't want these to be mutated
|
|
10212
10593
|
if (resolveLinks) {
|
|
10213
10594
|
response.items = Object(contentful_resolve_response__WEBPACK_IMPORTED_MODULE_1__["default"])(response, {
|
|
10214
10595
|
removeUnresolved,
|
|
10215
10596
|
itemEntryPoints: ['fields']
|
|
10216
10597
|
});
|
|
10217
|
-
}
|
|
10218
|
-
|
|
10219
|
-
|
|
10598
|
+
}
|
|
10599
|
+
// maps response items again after getters are attached
|
|
10220
10600
|
const mappedResponseItems = mapResponseItems(response.items);
|
|
10221
|
-
|
|
10222
10601
|
if (response.nextSyncToken) {
|
|
10223
10602
|
mappedResponseItems.nextSyncToken = response.nextSyncToken;
|
|
10224
10603
|
}
|
|
10225
|
-
|
|
10226
10604
|
if (response.nextPageToken) {
|
|
10227
10605
|
mappedResponseItems.nextPageToken = response.nextPageToken;
|
|
10228
10606
|
}
|
|
10229
|
-
|
|
10230
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)));
|
|
10231
10608
|
}
|
|
10609
|
+
|
|
10232
10610
|
/**
|
|
10233
10611
|
* @private
|
|
10234
10612
|
* @param {Array<Entities.Entry|Entities.Array|Sync.DeletedEntry|Sync.DeletedAsset>} items
|
|
10235
10613
|
* @return {Object} Entities mapped to an object for each entity type
|
|
10236
10614
|
*/
|
|
10237
|
-
|
|
10238
10615
|
function mapResponseItems(items) {
|
|
10239
10616
|
const reducer = type => {
|
|
10240
10617
|
return (accumulated, item) => {
|
|
10241
10618
|
if (item.sys.type === type) {
|
|
10242
10619
|
accumulated.push(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(item));
|
|
10243
10620
|
}
|
|
10244
|
-
|
|
10245
10621
|
return accumulated;
|
|
10246
10622
|
};
|
|
10247
10623
|
};
|
|
10248
|
-
|
|
10249
10624
|
return {
|
|
10250
10625
|
entries: items.reduce(reducer('Entry'), []),
|
|
10251
10626
|
assets: items.reduce(reducer('Asset'), []),
|
|
@@ -10253,6 +10628,7 @@ function mapResponseItems(items) {
|
|
|
10253
10628
|
deletedAssets: items.reduce(reducer('DeletedAsset'), [])
|
|
10254
10629
|
};
|
|
10255
10630
|
}
|
|
10631
|
+
|
|
10256
10632
|
/**
|
|
10257
10633
|
* If the response contains a nextPageUrl, extracts the sync token to get the
|
|
10258
10634
|
* next page and calls itself again with that token.
|
|
@@ -10268,36 +10644,29 @@ function mapResponseItems(items) {
|
|
|
10268
10644
|
* @param {boolean} [options.paginate = true] - If further sync pages should automatically be crawled
|
|
10269
10645
|
* @return {Promise<{items: Array, nextSyncToken: string}>}
|
|
10270
10646
|
*/
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
10647
|
async function getSyncPage(http, items, query, _ref) {
|
|
10274
10648
|
let {
|
|
10275
10649
|
paginate
|
|
10276
10650
|
} = _ref;
|
|
10277
|
-
|
|
10278
10651
|
if (query.nextSyncToken) {
|
|
10279
10652
|
query.sync_token = query.nextSyncToken;
|
|
10280
10653
|
delete query.nextSyncToken;
|
|
10281
10654
|
}
|
|
10282
|
-
|
|
10283
10655
|
if (query.nextPageToken) {
|
|
10284
10656
|
query.sync_token = query.nextPageToken;
|
|
10285
10657
|
delete query.nextPageToken;
|
|
10286
10658
|
}
|
|
10287
|
-
|
|
10288
10659
|
if (query.sync_token) {
|
|
10289
10660
|
delete query.initial;
|
|
10290
10661
|
delete query.type;
|
|
10291
10662
|
delete query.content_type;
|
|
10292
10663
|
delete query.limit;
|
|
10293
10664
|
}
|
|
10294
|
-
|
|
10295
10665
|
const response = await http.get('sync', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10296
10666
|
query: query
|
|
10297
10667
|
}));
|
|
10298
10668
|
const data = response.data || {};
|
|
10299
10669
|
items = items.concat(data.items || []);
|
|
10300
|
-
|
|
10301
10670
|
if (data.nextPageUrl) {
|
|
10302
10671
|
if (paginate) {
|
|
10303
10672
|
delete query.initial;
|
|
@@ -10306,7 +10675,6 @@ async function getSyncPage(http, items, query, _ref) {
|
|
|
10306
10675
|
paginate
|
|
10307
10676
|
});
|
|
10308
10677
|
}
|
|
10309
|
-
|
|
10310
10678
|
return {
|
|
10311
10679
|
items: items,
|
|
10312
10680
|
nextPageToken: getToken(data.nextPageUrl)
|
|
@@ -10322,12 +10690,11 @@ async function getSyncPage(http, items, query, _ref) {
|
|
|
10322
10690
|
};
|
|
10323
10691
|
}
|
|
10324
10692
|
}
|
|
10693
|
+
|
|
10325
10694
|
/**
|
|
10326
10695
|
* Extracts token out of an url
|
|
10327
10696
|
* @private
|
|
10328
10697
|
*/
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
10698
|
function getToken(url) {
|
|
10332
10699
|
const urlParts = url.split('?');
|
|
10333
10700
|
return urlParts.length > 0 ? urlParts[1].replace('sync_token=', '') : '';
|
|
@@ -10346,36 +10713,36 @@ function getToken(url) {
|
|
|
10346
10713
|
__webpack_require__.r(__webpack_exports__);
|
|
10347
10714
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeSelect; });
|
|
10348
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; }
|
|
10349
|
-
|
|
10350
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; }
|
|
10351
|
-
|
|
10352
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; }
|
|
10353
|
-
|
|
10354
10718
|
/*
|
|
10355
10719
|
* sdk relies heavily on sys metadata
|
|
10356
10720
|
* so we cannot omit the sys property on sdk level entirely
|
|
10357
10721
|
* and we have to ensure that at least `id` and `type` are present
|
|
10358
10722
|
* */
|
|
10723
|
+
|
|
10359
10724
|
function normalizeSelect(query) {
|
|
10360
10725
|
if (!query.select) {
|
|
10361
10726
|
return query;
|
|
10362
|
-
}
|
|
10363
|
-
// Get the different parts that are listed for selection
|
|
10364
|
-
|
|
10727
|
+
}
|
|
10365
10728
|
|
|
10366
|
-
|
|
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);
|
|
10367
10734
|
|
|
10368
|
-
|
|
10735
|
+
// If we already select all of `sys` we can just return
|
|
10369
10736
|
// since we're anyway fetching everything that is needed
|
|
10370
|
-
|
|
10371
10737
|
if (selectedSet.has('sys')) {
|
|
10372
10738
|
return query;
|
|
10373
|
-
}
|
|
10374
|
-
|
|
10739
|
+
}
|
|
10375
10740
|
|
|
10741
|
+
// We don't select `sys` so we need to ensure the minimum set
|
|
10376
10742
|
selectedSet.add('sys.id');
|
|
10377
|
-
selectedSet.add('sys.type');
|
|
10743
|
+
selectedSet.add('sys.type');
|
|
10378
10744
|
|
|
10745
|
+
// Reassign the normalized sys properties
|
|
10379
10746
|
return _objectSpread(_objectSpread({}, query), {}, {
|
|
10380
10747
|
select: [...selectedSet].join(',')
|
|
10381
10748
|
});
|
|
@@ -10399,19 +10766,15 @@ class ValidationError extends Error {
|
|
|
10399
10766
|
super(`Invalid "${name}" provided, ` + message);
|
|
10400
10767
|
this.name = 'ValidationError';
|
|
10401
10768
|
}
|
|
10402
|
-
|
|
10403
10769
|
}
|
|
10404
10770
|
function validateTimestamp(name, timestamp, options) {
|
|
10405
10771
|
options = options || {};
|
|
10406
|
-
|
|
10407
10772
|
if (typeof timestamp !== 'number') {
|
|
10408
10773
|
throw new ValidationError(name, `only numeric values are allowed for timestamps, provided type was "${typeof timestamp}"`);
|
|
10409
10774
|
}
|
|
10410
|
-
|
|
10411
10775
|
if (options.maximum && timestamp > options.maximum) {
|
|
10412
10776
|
throw new ValidationError(name, `value (${timestamp}) cannot be further in the future than expected maximum (${options.maximum})`);
|
|
10413
10777
|
}
|
|
10414
|
-
|
|
10415
10778
|
if (options.now && timestamp < options.now) {
|
|
10416
10779
|
throw new ValidationError(name, `value (${timestamp}) cannot be in the past, current time was ${options.now}`);
|
|
10417
10780
|
}
|