contentful 9.2.5 → 9.2.7
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 +973 -194
- package/dist/contentful.browser.js.map +1 -1
- package/dist/contentful.browser.min.js +3 -3
- package/dist/contentful.node.js +976 -206
- 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":
|
|
@@ -3021,7 +3441,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3021
3441
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "freezeSys", function() { return freezeSys; });
|
|
3022
3442
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUserAgentHeader", function() { return getUserAgentHeader; });
|
|
3023
3443
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toPlainObject", function() { return toPlainObject; });
|
|
3024
|
-
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/
|
|
3444
|
+
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/umd/index.js");
|
|
3025
3445
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fast_copy__WEBPACK_IMPORTED_MODULE_0__);
|
|
3026
3446
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qs */ "../node_modules/qs/lib/index.js");
|
|
3027
3447
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_1__);
|
|
@@ -3091,7 +3511,13 @@ function _wrapRegExp() {
|
|
|
3091
3511
|
var g = _groups.get(re);
|
|
3092
3512
|
|
|
3093
3513
|
return Object.keys(g).reduce(function (groups, name) {
|
|
3094
|
-
|
|
3514
|
+
var i = g[name];
|
|
3515
|
+
if ("number" == typeof i) groups[name] = result[i];else {
|
|
3516
|
+
for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
|
|
3517
|
+
|
|
3518
|
+
groups[name] = result[i[k]];
|
|
3519
|
+
}
|
|
3520
|
+
return groups;
|
|
3095
3521
|
}, Object.create(null));
|
|
3096
3522
|
}
|
|
3097
3523
|
|
|
@@ -3155,11 +3581,10 @@ function _inherits(subClass, superClass) {
|
|
|
3155
3581
|
}
|
|
3156
3582
|
|
|
3157
3583
|
function _setPrototypeOf(o, p) {
|
|
3158
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
3584
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
3159
3585
|
o.__proto__ = p;
|
|
3160
3586
|
return o;
|
|
3161
3587
|
};
|
|
3162
|
-
|
|
3163
3588
|
return _setPrototypeOf(o, p);
|
|
3164
3589
|
}
|
|
3165
3590
|
|
|
@@ -3795,85 +4220,505 @@ function toPlainObject(data) {
|
|
|
3795
4220
|
value: function value() {
|
|
3796
4221
|
return fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(this);
|
|
3797
4222
|
}
|
|
3798
|
-
});
|
|
3799
|
-
}
|
|
3800
|
-
|
|
3801
|
-
/**
|
|
3802
|
-
* Handles errors received from the server. Parses the error into a more useful
|
|
3803
|
-
* format, places it in an exception and throws it.
|
|
3804
|
-
* See https://www.contentful.com/developers/docs/references/errors/
|
|
3805
|
-
* for more details on the data received on the errorResponse.data property
|
|
3806
|
-
* and the expected error codes.
|
|
3807
|
-
* @private
|
|
3808
|
-
*/
|
|
3809
|
-
function errorHandler(errorResponse) {
|
|
3810
|
-
var config = errorResponse.config,
|
|
3811
|
-
response = errorResponse.response;
|
|
3812
|
-
var errorName; // Obscure the Management token
|
|
3813
|
-
|
|
3814
|
-
if (config && config.headers && config.headers['Authorization']) {
|
|
3815
|
-
var token = "...".concat(config.headers['Authorization'].toString().substr(-5));
|
|
3816
|
-
config.headers['Authorization'] = "Bearer ".concat(token);
|
|
3817
|
-
}
|
|
3818
|
-
|
|
3819
|
-
if (!lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(response) || !lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
3820
|
-
throw errorResponse;
|
|
3821
|
-
}
|
|
3822
|
-
|
|
3823
|
-
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
3824
|
-
var errorData = {
|
|
3825
|
-
status: response === null || response === void 0 ? void 0 : response.status,
|
|
3826
|
-
statusText: response === null || response === void 0 ? void 0 : response.statusText,
|
|
3827
|
-
message: '',
|
|
3828
|
-
details: {}
|
|
3829
|
-
};
|
|
3830
|
-
|
|
3831
|
-
if (lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
3832
|
-
errorData.request = {
|
|
3833
|
-
url: config.url,
|
|
3834
|
-
headers: config.headers,
|
|
3835
|
-
method: config.method,
|
|
3836
|
-
payloadData: config.data
|
|
3837
|
-
};
|
|
3838
|
-
}
|
|
3839
|
-
|
|
3840
|
-
if (data && lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(data)) {
|
|
3841
|
-
if ('requestId' in data) {
|
|
3842
|
-
errorData.requestId = data.requestId || 'UNKNOWN';
|
|
4223
|
+
});
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4226
|
+
/**
|
|
4227
|
+
* Handles errors received from the server. Parses the error into a more useful
|
|
4228
|
+
* format, places it in an exception and throws it.
|
|
4229
|
+
* See https://www.contentful.com/developers/docs/references/errors/
|
|
4230
|
+
* for more details on the data received on the errorResponse.data property
|
|
4231
|
+
* and the expected error codes.
|
|
4232
|
+
* @private
|
|
4233
|
+
*/
|
|
4234
|
+
function errorHandler(errorResponse) {
|
|
4235
|
+
var config = errorResponse.config,
|
|
4236
|
+
response = errorResponse.response;
|
|
4237
|
+
var errorName; // Obscure the Management token
|
|
4238
|
+
|
|
4239
|
+
if (config && config.headers && config.headers['Authorization']) {
|
|
4240
|
+
var token = "...".concat(config.headers['Authorization'].toString().substr(-5));
|
|
4241
|
+
config.headers['Authorization'] = "Bearer ".concat(token);
|
|
4242
|
+
}
|
|
4243
|
+
|
|
4244
|
+
if (!lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(response) || !lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
4245
|
+
throw errorResponse;
|
|
4246
|
+
}
|
|
4247
|
+
|
|
4248
|
+
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
4249
|
+
var errorData = {
|
|
4250
|
+
status: response === null || response === void 0 ? void 0 : response.status,
|
|
4251
|
+
statusText: response === null || response === void 0 ? void 0 : response.statusText,
|
|
4252
|
+
message: '',
|
|
4253
|
+
details: {}
|
|
4254
|
+
};
|
|
4255
|
+
|
|
4256
|
+
if (lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
4257
|
+
errorData.request = {
|
|
4258
|
+
url: config.url,
|
|
4259
|
+
headers: config.headers,
|
|
4260
|
+
method: config.method,
|
|
4261
|
+
payloadData: config.data
|
|
4262
|
+
};
|
|
4263
|
+
}
|
|
4264
|
+
|
|
4265
|
+
if (data && lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(data)) {
|
|
4266
|
+
if ('requestId' in data) {
|
|
4267
|
+
errorData.requestId = data.requestId || 'UNKNOWN';
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
if ('message' in data) {
|
|
4271
|
+
errorData.message = data.message || '';
|
|
4272
|
+
}
|
|
4273
|
+
|
|
4274
|
+
if ('details' in data) {
|
|
4275
|
+
errorData.details = data.details || {};
|
|
4276
|
+
}
|
|
4277
|
+
|
|
4278
|
+
if ('sys' in data) {
|
|
4279
|
+
if ('id' in data.sys) {
|
|
4280
|
+
errorName = data.sys.id;
|
|
4281
|
+
}
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
var error = new Error();
|
|
4286
|
+
error.name = errorName && errorName !== 'Unknown' ? errorName : "".concat(response === null || response === void 0 ? void 0 : response.status, " ").concat(response === null || response === void 0 ? void 0 : response.statusText);
|
|
4287
|
+
|
|
4288
|
+
try {
|
|
4289
|
+
error.message = JSON.stringify(errorData, null, ' ');
|
|
4290
|
+
} catch (_unused) {
|
|
4291
|
+
var _errorData$message;
|
|
4292
|
+
|
|
4293
|
+
error.message = (_errorData$message = errorData === null || errorData === void 0 ? void 0 : errorData.message) !== null && _errorData$message !== void 0 ? _errorData$message : '';
|
|
4294
|
+
}
|
|
4295
|
+
|
|
4296
|
+
throw error;
|
|
4297
|
+
}
|
|
4298
|
+
|
|
4299
|
+
|
|
4300
|
+
|
|
4301
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "../node_modules/process/browser.js")))
|
|
4302
|
+
|
|
4303
|
+
/***/ }),
|
|
4304
|
+
|
|
4305
|
+
/***/ "../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/umd/index.js":
|
|
4306
|
+
/*!************************************************************************************!*\
|
|
4307
|
+
!*** ../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/umd/index.js ***!
|
|
4308
|
+
\************************************************************************************/
|
|
4309
|
+
/*! no static exports found */
|
|
4310
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
4311
|
+
|
|
4312
|
+
(function (global, factory) {
|
|
4313
|
+
true ? factory(exports) :
|
|
4314
|
+
undefined;
|
|
4315
|
+
})(this, (function (exports) { 'use strict';
|
|
4316
|
+
|
|
4317
|
+
var toStringFunction = Function.prototype.toString;
|
|
4318
|
+
var create = Object.create;
|
|
4319
|
+
var toStringObject = Object.prototype.toString;
|
|
4320
|
+
/**
|
|
4321
|
+
* @classdesc Fallback cache for when WeakMap is not natively supported
|
|
4322
|
+
*/
|
|
4323
|
+
var LegacyCache = /** @class */ (function () {
|
|
4324
|
+
function LegacyCache() {
|
|
4325
|
+
this._keys = [];
|
|
4326
|
+
this._values = [];
|
|
4327
|
+
}
|
|
4328
|
+
LegacyCache.prototype.has = function (key) {
|
|
4329
|
+
return !!~this._keys.indexOf(key);
|
|
4330
|
+
};
|
|
4331
|
+
LegacyCache.prototype.get = function (key) {
|
|
4332
|
+
return this._values[this._keys.indexOf(key)];
|
|
4333
|
+
};
|
|
4334
|
+
LegacyCache.prototype.set = function (key, value) {
|
|
4335
|
+
this._keys.push(key);
|
|
4336
|
+
this._values.push(value);
|
|
4337
|
+
};
|
|
4338
|
+
return LegacyCache;
|
|
4339
|
+
}());
|
|
4340
|
+
function createCacheLegacy() {
|
|
4341
|
+
return new LegacyCache();
|
|
4342
|
+
}
|
|
4343
|
+
function createCacheModern() {
|
|
4344
|
+
return new WeakMap();
|
|
4345
|
+
}
|
|
4346
|
+
/**
|
|
4347
|
+
* Get a new cache object to prevent circular references.
|
|
4348
|
+
*/
|
|
4349
|
+
var createCache = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
|
|
4350
|
+
/**
|
|
4351
|
+
* Get an empty version of the object with the same prototype it has.
|
|
4352
|
+
*/
|
|
4353
|
+
function getCleanClone(prototype) {
|
|
4354
|
+
if (!prototype) {
|
|
4355
|
+
return create(null);
|
|
4356
|
+
}
|
|
4357
|
+
var Constructor = prototype.constructor;
|
|
4358
|
+
if (Constructor === Object) {
|
|
4359
|
+
return prototype === Object.prototype ? {} : create(prototype);
|
|
4360
|
+
}
|
|
4361
|
+
if (~toStringFunction.call(Constructor).indexOf('[native code]')) {
|
|
4362
|
+
try {
|
|
4363
|
+
return new Constructor();
|
|
4364
|
+
}
|
|
4365
|
+
catch (_a) { }
|
|
4366
|
+
}
|
|
4367
|
+
return create(prototype);
|
|
4368
|
+
}
|
|
4369
|
+
function getRegExpFlagsLegacy(regExp) {
|
|
4370
|
+
var flags = '';
|
|
4371
|
+
if (regExp.global) {
|
|
4372
|
+
flags += 'g';
|
|
4373
|
+
}
|
|
4374
|
+
if (regExp.ignoreCase) {
|
|
4375
|
+
flags += 'i';
|
|
4376
|
+
}
|
|
4377
|
+
if (regExp.multiline) {
|
|
4378
|
+
flags += 'm';
|
|
4379
|
+
}
|
|
4380
|
+
if (regExp.unicode) {
|
|
4381
|
+
flags += 'u';
|
|
4382
|
+
}
|
|
4383
|
+
if (regExp.sticky) {
|
|
4384
|
+
flags += 'y';
|
|
4385
|
+
}
|
|
4386
|
+
return flags;
|
|
4387
|
+
}
|
|
4388
|
+
function getRegExpFlagsModern(regExp) {
|
|
4389
|
+
return regExp.flags;
|
|
4390
|
+
}
|
|
4391
|
+
/**
|
|
4392
|
+
* Get the flags to apply to the copied regexp.
|
|
4393
|
+
*/
|
|
4394
|
+
var getRegExpFlags = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
|
|
4395
|
+
function getTagLegacy(value) {
|
|
4396
|
+
var type = toStringObject.call(value);
|
|
4397
|
+
return type.substring(8, type.length - 1);
|
|
4398
|
+
}
|
|
4399
|
+
function getTagModern(value) {
|
|
4400
|
+
return value[Symbol.toStringTag] || getTagLegacy(value);
|
|
4401
|
+
}
|
|
4402
|
+
/**
|
|
4403
|
+
* Get the tag of the value passed, so that the correct copier can be used.
|
|
4404
|
+
*/
|
|
4405
|
+
var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
|
|
4406
|
+
|
|
4407
|
+
var defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
4408
|
+
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
|
|
4409
|
+
var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols === 'function';
|
|
4410
|
+
function getStrictPropertiesModern(object) {
|
|
4411
|
+
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
4412
|
+
}
|
|
4413
|
+
/**
|
|
4414
|
+
* Get the properites used when copying objects strictly. This includes both keys and symbols.
|
|
4415
|
+
*/
|
|
4416
|
+
var getStrictProperties = SUPPORTS_SYMBOL
|
|
4417
|
+
? getStrictPropertiesModern
|
|
4418
|
+
: getOwnPropertyNames;
|
|
4419
|
+
/**
|
|
4420
|
+
* Striclty copy all properties contained on the object.
|
|
4421
|
+
*/
|
|
4422
|
+
function copyOwnPropertiesStrict(value, clone, state) {
|
|
4423
|
+
var properties = getStrictProperties(value);
|
|
4424
|
+
for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
|
|
4425
|
+
property = properties[index];
|
|
4426
|
+
if (property === 'callee' || property === 'caller') {
|
|
4427
|
+
continue;
|
|
4428
|
+
}
|
|
4429
|
+
descriptor = getOwnPropertyDescriptor(value, property);
|
|
4430
|
+
if (!descriptor) {
|
|
4431
|
+
// In extra edge cases where the property descriptor cannot be retrived, fall back to
|
|
4432
|
+
// the loose assignment.
|
|
4433
|
+
clone[property] = state.copier(value[property], state);
|
|
4434
|
+
continue;
|
|
4435
|
+
}
|
|
4436
|
+
// Only clone the value if actually a value, not a getter / setter.
|
|
4437
|
+
if (!descriptor.get && !descriptor.set) {
|
|
4438
|
+
descriptor.value = state.copier(descriptor.value, state);
|
|
4439
|
+
}
|
|
4440
|
+
try {
|
|
4441
|
+
defineProperty(clone, property, descriptor);
|
|
4442
|
+
}
|
|
4443
|
+
catch (error) {
|
|
4444
|
+
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
|
|
4445
|
+
clone[property] = descriptor.value;
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
return clone;
|
|
4449
|
+
}
|
|
4450
|
+
/**
|
|
4451
|
+
* Deeply copy the indexed values in the array.
|
|
4452
|
+
*/
|
|
4453
|
+
function copyArrayLoose(array, state) {
|
|
4454
|
+
var clone = new state.Constructor();
|
|
4455
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4456
|
+
state.cache.set(array, clone);
|
|
4457
|
+
for (var index = 0, length_2 = array.length; index < length_2; ++index) {
|
|
4458
|
+
clone[index] = state.copier(array[index], state);
|
|
4459
|
+
}
|
|
4460
|
+
return clone;
|
|
4461
|
+
}
|
|
4462
|
+
/**
|
|
4463
|
+
* Deeply copy the indexed values in the array, as well as any custom properties.
|
|
4464
|
+
*/
|
|
4465
|
+
function copyArrayStrict(array, state) {
|
|
4466
|
+
var clone = new state.Constructor();
|
|
4467
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4468
|
+
state.cache.set(array, clone);
|
|
4469
|
+
return copyOwnPropertiesStrict(array, clone, state);
|
|
4470
|
+
}
|
|
4471
|
+
/**
|
|
4472
|
+
* Copy the contents of the ArrayBuffer.
|
|
4473
|
+
*/
|
|
4474
|
+
function copyArrayBuffer(arrayBuffer, _state) {
|
|
4475
|
+
return arrayBuffer.slice(0);
|
|
4476
|
+
}
|
|
4477
|
+
/**
|
|
4478
|
+
* Create a new Blob with the contents of the original.
|
|
4479
|
+
*/
|
|
4480
|
+
function copyBlob(blob, _state) {
|
|
4481
|
+
return blob.slice(0, blob.size, blob.type);
|
|
4482
|
+
}
|
|
4483
|
+
/**
|
|
4484
|
+
* Create a new DataView with the contents of the original.
|
|
4485
|
+
*/
|
|
4486
|
+
function copyDataView(dataView, state) {
|
|
4487
|
+
return new state.Constructor(copyArrayBuffer(dataView.buffer));
|
|
4488
|
+
}
|
|
4489
|
+
/**
|
|
4490
|
+
* Create a new Date based on the time of the original.
|
|
4491
|
+
*/
|
|
4492
|
+
function copyDate(date, state) {
|
|
4493
|
+
return new state.Constructor(date.getTime());
|
|
4494
|
+
}
|
|
4495
|
+
/**
|
|
4496
|
+
* Deeply copy the keys and values of the original.
|
|
4497
|
+
*/
|
|
4498
|
+
function copyMapLoose(map, state) {
|
|
4499
|
+
var clone = new state.Constructor();
|
|
4500
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4501
|
+
state.cache.set(map, clone);
|
|
4502
|
+
map.forEach(function (value, key) {
|
|
4503
|
+
clone.set(key, state.copier(value, state));
|
|
4504
|
+
});
|
|
4505
|
+
return clone;
|
|
4506
|
+
}
|
|
4507
|
+
/**
|
|
4508
|
+
* Deeply copy the keys and values of the original, as well as any custom properties.
|
|
4509
|
+
*/
|
|
4510
|
+
function copyMapStrict(map, state) {
|
|
4511
|
+
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
|
|
4512
|
+
}
|
|
4513
|
+
function copyObjectLooseLegacy(object, state) {
|
|
4514
|
+
var clone = getCleanClone(state.prototype);
|
|
4515
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4516
|
+
state.cache.set(object, clone);
|
|
4517
|
+
for (var key in object) {
|
|
4518
|
+
if (hasOwnProperty.call(object, key)) {
|
|
4519
|
+
clone[key] = state.copier(object[key], state);
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
return clone;
|
|
4523
|
+
}
|
|
4524
|
+
function copyObjectLooseModern(object, state) {
|
|
4525
|
+
var clone = getCleanClone(state.prototype);
|
|
4526
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4527
|
+
state.cache.set(object, clone);
|
|
4528
|
+
for (var key in object) {
|
|
4529
|
+
if (hasOwnProperty.call(object, key)) {
|
|
4530
|
+
clone[key] = state.copier(object[key], state);
|
|
4531
|
+
}
|
|
4532
|
+
}
|
|
4533
|
+
var symbols = getOwnPropertySymbols(object);
|
|
4534
|
+
for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
|
|
4535
|
+
symbol = symbols[index];
|
|
4536
|
+
if (propertyIsEnumerable.call(object, symbol)) {
|
|
4537
|
+
clone[symbol] = state.copier(object[symbol], state);
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
return clone;
|
|
4541
|
+
}
|
|
4542
|
+
/**
|
|
4543
|
+
* Deeply copy the properties (keys and symbols) and values of the original.
|
|
4544
|
+
*/
|
|
4545
|
+
var copyObjectLoose = SUPPORTS_SYMBOL
|
|
4546
|
+
? copyObjectLooseModern
|
|
4547
|
+
: copyObjectLooseLegacy;
|
|
4548
|
+
/**
|
|
4549
|
+
* Deeply copy the properties (keys and symbols) and values of the original, as well
|
|
4550
|
+
* as any hidden or non-enumerable properties.
|
|
4551
|
+
*/
|
|
4552
|
+
function copyObjectStrict(object, state) {
|
|
4553
|
+
var clone = getCleanClone(state.prototype);
|
|
4554
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4555
|
+
state.cache.set(object, clone);
|
|
4556
|
+
return copyOwnPropertiesStrict(object, clone, state);
|
|
4557
|
+
}
|
|
4558
|
+
/**
|
|
4559
|
+
* Create a new primitive wrapper from the value of the original.
|
|
4560
|
+
*/
|
|
4561
|
+
function copyPrimitiveWrapper(primitiveObject, state) {
|
|
4562
|
+
return new state.Constructor(primitiveObject.valueOf());
|
|
4563
|
+
}
|
|
4564
|
+
/**
|
|
4565
|
+
* Create a new RegExp based on the value and flags of the original.
|
|
4566
|
+
*/
|
|
4567
|
+
function copyRegExp(regExp, state) {
|
|
4568
|
+
var clone = new state.Constructor(regExp.source, getRegExpFlags(regExp));
|
|
4569
|
+
clone.lastIndex = regExp.lastIndex;
|
|
4570
|
+
return clone;
|
|
4571
|
+
}
|
|
4572
|
+
/**
|
|
4573
|
+
* Return the original value (an identity function).
|
|
4574
|
+
*
|
|
4575
|
+
* @note
|
|
4576
|
+
* THis is used for objects that cannot be copied, such as WeakMap.
|
|
4577
|
+
*/
|
|
4578
|
+
function copySelf(value, _state) {
|
|
4579
|
+
return value;
|
|
4580
|
+
}
|
|
4581
|
+
/**
|
|
4582
|
+
* Deeply copy the values of the original.
|
|
4583
|
+
*/
|
|
4584
|
+
function copySetLoose(set, state) {
|
|
4585
|
+
var clone = new state.Constructor();
|
|
4586
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
4587
|
+
state.cache.set(set, clone);
|
|
4588
|
+
set.forEach(function (value) {
|
|
4589
|
+
clone.add(state.copier(value, state));
|
|
4590
|
+
});
|
|
4591
|
+
return clone;
|
|
4592
|
+
}
|
|
4593
|
+
/**
|
|
4594
|
+
* Deeply copy the values of the original, as well as any custom properties.
|
|
4595
|
+
*/
|
|
4596
|
+
function copySetStrict(set, state) {
|
|
4597
|
+
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
|
|
3843
4598
|
}
|
|
3844
4599
|
|
|
3845
|
-
|
|
3846
|
-
|
|
4600
|
+
var isArray = Array.isArray;
|
|
4601
|
+
var assign = Object.assign, getPrototypeOf = Object.getPrototypeOf;
|
|
4602
|
+
var DEFAULT_LOOSE_OPTIONS = {
|
|
4603
|
+
array: copyArrayLoose,
|
|
4604
|
+
arrayBuffer: copyArrayBuffer,
|
|
4605
|
+
blob: copyBlob,
|
|
4606
|
+
dataView: copyDataView,
|
|
4607
|
+
date: copyDate,
|
|
4608
|
+
error: copySelf,
|
|
4609
|
+
map: copyMapLoose,
|
|
4610
|
+
object: copyObjectLoose,
|
|
4611
|
+
regExp: copyRegExp,
|
|
4612
|
+
set: copySetLoose,
|
|
4613
|
+
};
|
|
4614
|
+
var DEFAULT_STRICT_OPTIONS = assign({}, DEFAULT_LOOSE_OPTIONS, {
|
|
4615
|
+
array: copyArrayStrict,
|
|
4616
|
+
map: copyMapStrict,
|
|
4617
|
+
object: copyObjectStrict,
|
|
4618
|
+
set: copySetStrict,
|
|
4619
|
+
});
|
|
4620
|
+
/**
|
|
4621
|
+
* Get the copiers used for each specific object tag.
|
|
4622
|
+
*/
|
|
4623
|
+
function getTagSpecificCopiers(options) {
|
|
4624
|
+
return {
|
|
4625
|
+
Arguments: options.object,
|
|
4626
|
+
Array: options.array,
|
|
4627
|
+
ArrayBuffer: options.arrayBuffer,
|
|
4628
|
+
Blob: options.blob,
|
|
4629
|
+
Boolean: copyPrimitiveWrapper,
|
|
4630
|
+
DataView: options.dataView,
|
|
4631
|
+
Date: options.date,
|
|
4632
|
+
Error: options.error,
|
|
4633
|
+
Float32Array: options.arrayBuffer,
|
|
4634
|
+
Float64Array: options.arrayBuffer,
|
|
4635
|
+
Int8Array: options.arrayBuffer,
|
|
4636
|
+
Int16Array: options.arrayBuffer,
|
|
4637
|
+
Int32Array: options.arrayBuffer,
|
|
4638
|
+
Map: options.map,
|
|
4639
|
+
Number: copyPrimitiveWrapper,
|
|
4640
|
+
Object: options.object,
|
|
4641
|
+
Promise: copySelf,
|
|
4642
|
+
RegExp: options.regExp,
|
|
4643
|
+
Set: options.set,
|
|
4644
|
+
String: copyPrimitiveWrapper,
|
|
4645
|
+
WeakMap: copySelf,
|
|
4646
|
+
WeakSet: copySelf,
|
|
4647
|
+
Uint8Array: options.arrayBuffer,
|
|
4648
|
+
Uint8ClampedArray: options.arrayBuffer,
|
|
4649
|
+
Uint16Array: options.arrayBuffer,
|
|
4650
|
+
Uint32Array: options.arrayBuffer,
|
|
4651
|
+
Uint64Array: options.arrayBuffer,
|
|
4652
|
+
};
|
|
3847
4653
|
}
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
4654
|
+
/**
|
|
4655
|
+
* Create a custom copier based on the object-specific copy methods passed.
|
|
4656
|
+
*/
|
|
4657
|
+
function createCopier(options) {
|
|
4658
|
+
var normalizedOptions = assign({}, DEFAULT_LOOSE_OPTIONS, options);
|
|
4659
|
+
var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
|
|
4660
|
+
var array = tagSpecificCopiers.Array, object = tagSpecificCopiers.Object;
|
|
4661
|
+
function copier(value, state) {
|
|
4662
|
+
state.prototype = state.Constructor = undefined;
|
|
4663
|
+
if (!value || typeof value !== 'object') {
|
|
4664
|
+
return value;
|
|
4665
|
+
}
|
|
4666
|
+
if (state.cache.has(value)) {
|
|
4667
|
+
return state.cache.get(value);
|
|
4668
|
+
}
|
|
4669
|
+
state.prototype = value.__proto__ || getPrototypeOf(value);
|
|
4670
|
+
state.Constructor = state.prototype && state.prototype.constructor;
|
|
4671
|
+
// plain objects
|
|
4672
|
+
if (!state.Constructor || state.Constructor === Object) {
|
|
4673
|
+
return object(value, state);
|
|
4674
|
+
}
|
|
4675
|
+
// arrays
|
|
4676
|
+
if (isArray(value)) {
|
|
4677
|
+
return array(value, state);
|
|
4678
|
+
}
|
|
4679
|
+
var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
|
|
4680
|
+
if (tagSpecificCopier) {
|
|
4681
|
+
return tagSpecificCopier(value, state);
|
|
4682
|
+
}
|
|
4683
|
+
return typeof value.then === 'function' ? value : object(value, state);
|
|
4684
|
+
}
|
|
4685
|
+
return function copy(value) {
|
|
4686
|
+
return copier(value, {
|
|
4687
|
+
Constructor: undefined,
|
|
4688
|
+
cache: createCache(),
|
|
4689
|
+
copier: copier,
|
|
4690
|
+
prototype: undefined,
|
|
4691
|
+
});
|
|
4692
|
+
};
|
|
3851
4693
|
}
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
4694
|
+
/**
|
|
4695
|
+
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
|
|
4696
|
+
* same internals as `copyStrict`.
|
|
4697
|
+
*/
|
|
4698
|
+
function createStrictCopier(options) {
|
|
4699
|
+
return createCopier(assign({}, DEFAULT_STRICT_OPTIONS, options));
|
|
3857
4700
|
}
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
error.message = (_errorData$message = errorData === null || errorData === void 0 ? void 0 : errorData.message) !== null && _errorData$message !== void 0 ? _errorData$message : '';
|
|
3869
|
-
}
|
|
4701
|
+
/**
|
|
4702
|
+
* Copy an value deeply as much as possible, where strict recreation of object properties
|
|
4703
|
+
* are maintained. All properties (including non-enumerable ones) are copied with their
|
|
4704
|
+
* original property descriptors on both objects and arrays.
|
|
4705
|
+
*/
|
|
4706
|
+
var copyStrict = createStrictCopier({});
|
|
4707
|
+
/**
|
|
4708
|
+
* Copy an value deeply as much as possible.
|
|
4709
|
+
*/
|
|
4710
|
+
var index = createCopier({});
|
|
3870
4711
|
|
|
3871
|
-
|
|
3872
|
-
|
|
4712
|
+
exports.copyStrict = copyStrict;
|
|
4713
|
+
exports.createCopier = createCopier;
|
|
4714
|
+
exports.createStrictCopier = createStrictCopier;
|
|
4715
|
+
exports["default"] = index;
|
|
3873
4716
|
|
|
4717
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3874
4718
|
|
|
4719
|
+
}));
|
|
4720
|
+
//# sourceMappingURL=index.js.map
|
|
3875
4721
|
|
|
3876
|
-
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "../node_modules/process/browser.js")))
|
|
3877
4722
|
|
|
3878
4723
|
/***/ }),
|
|
3879
4724
|
|
|
@@ -8867,11 +9712,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8867
9712
|
/* harmony import */ var _create_contentful_api__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./create-contentful-api */ "./create-contentful-api.js");
|
|
8868
9713
|
/* harmony import */ var _create_global_options__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./create-global-options */ "./create-global-options.js");
|
|
8869
9714
|
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
9715
|
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
9716
|
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
9717
|
/**
|
|
8876
9718
|
* Contentful Delivery API SDK. Allows you to create instances of a client
|
|
8877
9719
|
* with access to the Contentful Content Delivery API.
|
|
@@ -8882,6 +9724,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
8882
9724
|
|
|
8883
9725
|
|
|
8884
9726
|
|
|
9727
|
+
|
|
9728
|
+
|
|
8885
9729
|
/**
|
|
8886
9730
|
* Create a client instance
|
|
8887
9731
|
* @func
|
|
@@ -8920,21 +9764,17 @@ function createClient(params) {
|
|
|
8920
9764
|
if (!params.accessToken) {
|
|
8921
9765
|
throw new TypeError('Expected parameter accessToken');
|
|
8922
9766
|
}
|
|
8923
|
-
|
|
8924
9767
|
if (!params.space) {
|
|
8925
9768
|
throw new TypeError('Expected parameter space');
|
|
8926
9769
|
}
|
|
8927
|
-
|
|
8928
9770
|
const defaultConfig = {
|
|
8929
9771
|
resolveLinks: true,
|
|
8930
9772
|
removeUnresolved: false,
|
|
8931
9773
|
defaultHostname: 'cdn.contentful.com',
|
|
8932
9774
|
environment: 'master'
|
|
8933
9775
|
};
|
|
8934
|
-
|
|
8935
9776
|
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);
|
|
9777
|
+
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.7"}`, config.application, config.integration);
|
|
8938
9778
|
config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
8939
9779
|
'Content-Type': 'application/vnd.contentful.delivery.v1+json',
|
|
8940
9780
|
'X-Contentful-User-Agent': userAgentHeader
|
|
@@ -8946,8 +9786,8 @@ function createClient(params) {
|
|
|
8946
9786
|
removeUnresolved: config.removeUnresolved,
|
|
8947
9787
|
spaceBaseUrl: http.defaults.baseURL,
|
|
8948
9788
|
environmentBaseUrl: `${http.defaults.baseURL}environments/${config.environment}`
|
|
8949
|
-
});
|
|
8950
|
-
|
|
9789
|
+
});
|
|
9790
|
+
// Append environment to baseURL
|
|
8951
9791
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
8952
9792
|
return Object(_create_contentful_api__WEBPACK_IMPORTED_MODULE_2__["default"])({
|
|
8953
9793
|
http,
|
|
@@ -8973,11 +9813,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
8973
9813
|
/* harmony import */ var _utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/normalize-select */ "./utils/normalize-select.js");
|
|
8974
9814
|
/* harmony import */ var _utils_validate_timestamp__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/validate-timestamp */ "./utils/validate-timestamp.js");
|
|
8975
9815
|
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
9816
|
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
9817
|
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
9818
|
/**
|
|
8982
9819
|
* Contentful Delivery API Client. Contains methods which allow access to the
|
|
8983
9820
|
* different kinds of entities present in Contentful (Entries, Assets, etc).
|
|
@@ -9041,7 +9878,9 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
9041
9878
|
|
|
9042
9879
|
|
|
9043
9880
|
|
|
9881
|
+
|
|
9044
9882
|
const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
9883
|
+
|
|
9045
9884
|
/**
|
|
9046
9885
|
* Creates API object with methods to access functionality from Contentful's
|
|
9047
9886
|
* Delivery API
|
|
@@ -9052,7 +9891,6 @@ const ASSET_KEY_MAX_LIFETIME = 48 * 60 * 60;
|
|
|
9052
9891
|
* @prop {Function} getGlobalOptions - Link resolver preconfigured with global setting
|
|
9053
9892
|
* @return {ClientAPI}
|
|
9054
9893
|
*/
|
|
9055
|
-
|
|
9056
9894
|
function createContentfulApi(_ref) {
|
|
9057
9895
|
let {
|
|
9058
9896
|
http,
|
|
@@ -9083,7 +9921,6 @@ function createContentfulApi(_ref) {
|
|
|
9083
9921
|
const {
|
|
9084
9922
|
wrapLocaleCollection
|
|
9085
9923
|
} = _entities__WEBPACK_IMPORTED_MODULE_1__["default"].locale;
|
|
9086
|
-
|
|
9087
9924
|
const notFoundError = id => {
|
|
9088
9925
|
const error = new Error('The resource could not be found.');
|
|
9089
9926
|
error.sys = {
|
|
@@ -9098,6 +9935,7 @@ function createContentfulApi(_ref) {
|
|
|
9098
9935
|
};
|
|
9099
9936
|
return error;
|
|
9100
9937
|
};
|
|
9938
|
+
|
|
9101
9939
|
/**
|
|
9102
9940
|
* Gets the Space which the client is currently configured to use
|
|
9103
9941
|
* @memberof ContentfulClientAPI
|
|
@@ -9113,11 +9951,8 @@ function createContentfulApi(_ref) {
|
|
|
9113
9951
|
* const space = await client.getSpace()
|
|
9114
9952
|
* console.log(space)
|
|
9115
9953
|
*/
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
9954
|
async function getSpace() {
|
|
9119
9955
|
switchToSpace(http);
|
|
9120
|
-
|
|
9121
9956
|
try {
|
|
9122
9957
|
const response = await http.get('/');
|
|
9123
9958
|
return wrapSpace(response.data);
|
|
@@ -9125,6 +9960,7 @@ function createContentfulApi(_ref) {
|
|
|
9125
9960
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9126
9961
|
}
|
|
9127
9962
|
}
|
|
9963
|
+
|
|
9128
9964
|
/**
|
|
9129
9965
|
* Gets a Content Type
|
|
9130
9966
|
* @memberof ContentfulClientAPI
|
|
@@ -9141,11 +9977,8 @@ function createContentfulApi(_ref) {
|
|
|
9141
9977
|
* const contentType = await client.getContentType('<content_type_id>')
|
|
9142
9978
|
* console.log(contentType)
|
|
9143
9979
|
*/
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
9980
|
async function getContentType(id) {
|
|
9147
9981
|
switchToEnvironment(http);
|
|
9148
|
-
|
|
9149
9982
|
try {
|
|
9150
9983
|
const response = await http.get(`content_types/${id}`);
|
|
9151
9984
|
return wrapContentType(response.data);
|
|
@@ -9153,6 +9986,7 @@ function createContentfulApi(_ref) {
|
|
|
9153
9986
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9154
9987
|
}
|
|
9155
9988
|
}
|
|
9989
|
+
|
|
9156
9990
|
/**
|
|
9157
9991
|
* Gets a collection of Content Types
|
|
9158
9992
|
* @memberof ContentfulClientAPI
|
|
@@ -9169,12 +10003,9 @@ function createContentfulApi(_ref) {
|
|
|
9169
10003
|
* const response = await client.getContentTypes()
|
|
9170
10004
|
* console.log(response.items)
|
|
9171
10005
|
*/
|
|
9172
|
-
|
|
9173
|
-
|
|
9174
10006
|
async function getContentTypes() {
|
|
9175
10007
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9176
10008
|
switchToEnvironment(http);
|
|
9177
|
-
|
|
9178
10009
|
try {
|
|
9179
10010
|
const response = await http.get('content_types', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9180
10011
|
query: query
|
|
@@ -9184,6 +10015,7 @@ function createContentfulApi(_ref) {
|
|
|
9184
10015
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9185
10016
|
}
|
|
9186
10017
|
}
|
|
10018
|
+
|
|
9187
10019
|
/**
|
|
9188
10020
|
* Gets an Entry
|
|
9189
10021
|
* @memberof ContentfulClientAPI
|
|
@@ -9201,20 +10033,15 @@ function createContentfulApi(_ref) {
|
|
|
9201
10033
|
* const entry = await client.getEntry('<entry_id>')
|
|
9202
10034
|
* console.log(entry)
|
|
9203
10035
|
*/
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
10036
|
async function getEntry(id) {
|
|
9207
10037
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9208
|
-
|
|
9209
10038
|
if (!id) {
|
|
9210
10039
|
throw notFoundError(id);
|
|
9211
10040
|
}
|
|
9212
|
-
|
|
9213
10041
|
try {
|
|
9214
10042
|
const response = await this.getEntries(_objectSpread({
|
|
9215
10043
|
'sys.id': id
|
|
9216
10044
|
}, query));
|
|
9217
|
-
|
|
9218
10045
|
if (response.items.length > 0) {
|
|
9219
10046
|
return wrapEntry(response.items[0]);
|
|
9220
10047
|
} else {
|
|
@@ -9224,6 +10051,7 @@ function createContentfulApi(_ref) {
|
|
|
9224
10051
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9225
10052
|
}
|
|
9226
10053
|
}
|
|
10054
|
+
|
|
9227
10055
|
/**
|
|
9228
10056
|
* Gets a collection of Entries
|
|
9229
10057
|
* @memberof ContentfulClientAPI
|
|
@@ -9240,8 +10068,6 @@ function createContentfulApi(_ref) {
|
|
|
9240
10068
|
* const response = await client.getEntries()
|
|
9241
10069
|
* console.log(response.items)
|
|
9242
10070
|
*/
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
10071
|
async function getEntries() {
|
|
9246
10072
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9247
10073
|
switchToEnvironment(http);
|
|
@@ -9250,7 +10076,6 @@ function createContentfulApi(_ref) {
|
|
|
9250
10076
|
removeUnresolved
|
|
9251
10077
|
} = getGlobalOptions(query);
|
|
9252
10078
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9253
|
-
|
|
9254
10079
|
try {
|
|
9255
10080
|
const response = await http.get('entries', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9256
10081
|
query: query
|
|
@@ -9280,13 +10105,10 @@ function createContentfulApi(_ref) {
|
|
|
9280
10105
|
* const asset = await client.getAsset('<asset_id>')
|
|
9281
10106
|
* console.log(asset)
|
|
9282
10107
|
*/
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
10108
|
async function getAsset(id) {
|
|
9286
10109
|
let query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9287
10110
|
switchToEnvironment(http);
|
|
9288
10111
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9289
|
-
|
|
9290
10112
|
try {
|
|
9291
10113
|
const response = await http.get(`assets/${id}`, Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9292
10114
|
query: query
|
|
@@ -9296,6 +10118,7 @@ function createContentfulApi(_ref) {
|
|
|
9296
10118
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9297
10119
|
}
|
|
9298
10120
|
}
|
|
10121
|
+
|
|
9299
10122
|
/**
|
|
9300
10123
|
* Gets a collection of Assets
|
|
9301
10124
|
* @memberof ContentfulClientAPI
|
|
@@ -9312,13 +10135,10 @@ function createContentfulApi(_ref) {
|
|
|
9312
10135
|
* const response = await client.getAssets()
|
|
9313
10136
|
* console.log(response.items)
|
|
9314
10137
|
*/
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
10138
|
async function getAssets() {
|
|
9318
10139
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9319
10140
|
switchToEnvironment(http);
|
|
9320
10141
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9321
|
-
|
|
9322
10142
|
try {
|
|
9323
10143
|
const response = await http.get('assets', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9324
10144
|
query: query
|
|
@@ -9328,6 +10148,7 @@ function createContentfulApi(_ref) {
|
|
|
9328
10148
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9329
10149
|
}
|
|
9330
10150
|
}
|
|
10151
|
+
|
|
9331
10152
|
/**
|
|
9332
10153
|
* Gets a Tag
|
|
9333
10154
|
* @memberof ContentfulClientAPI
|
|
@@ -9344,11 +10165,8 @@ function createContentfulApi(_ref) {
|
|
|
9344
10165
|
* const tag = await client.getTag('<asset_id>')
|
|
9345
10166
|
* console.log(tag)
|
|
9346
10167
|
*/
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
10168
|
async function getTag(id) {
|
|
9350
10169
|
switchToEnvironment(http);
|
|
9351
|
-
|
|
9352
10170
|
try {
|
|
9353
10171
|
const response = await http.get(`tags/${id}`);
|
|
9354
10172
|
return wrapTag(response.data);
|
|
@@ -9356,6 +10174,7 @@ function createContentfulApi(_ref) {
|
|
|
9356
10174
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9357
10175
|
}
|
|
9358
10176
|
}
|
|
10177
|
+
|
|
9359
10178
|
/**
|
|
9360
10179
|
* Gets a collection of Tags
|
|
9361
10180
|
* @memberof ContentfulClientAPI
|
|
@@ -9372,13 +10191,10 @@ function createContentfulApi(_ref) {
|
|
|
9372
10191
|
* const response = await client.getTags()
|
|
9373
10192
|
* console.log(response.items)
|
|
9374
10193
|
*/
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
10194
|
async function getTags() {
|
|
9378
10195
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9379
10196
|
switchToEnvironment(http);
|
|
9380
10197
|
query = Object(_utils_normalize_select__WEBPACK_IMPORTED_MODULE_3__["default"])(query);
|
|
9381
|
-
|
|
9382
10198
|
try {
|
|
9383
10199
|
const response = await http.get('tags', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9384
10200
|
query: query
|
|
@@ -9388,6 +10204,7 @@ function createContentfulApi(_ref) {
|
|
|
9388
10204
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9389
10205
|
}
|
|
9390
10206
|
}
|
|
10207
|
+
|
|
9391
10208
|
/**
|
|
9392
10209
|
* Creates an asset key for signing asset URLs (Embargoed Assets)
|
|
9393
10210
|
* @memberof ContentfulClientAPI
|
|
@@ -9404,11 +10221,8 @@ function createContentfulApi(_ref) {
|
|
|
9404
10221
|
* const assetKey = await client.getAssetKey(<UNIX timestamp>)
|
|
9405
10222
|
* console.log(assetKey)
|
|
9406
10223
|
*/
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
10224
|
async function createAssetKey(expiresAt) {
|
|
9410
10225
|
switchToEnvironment(http);
|
|
9411
|
-
|
|
9412
10226
|
try {
|
|
9413
10227
|
const now = Math.floor(Date.now() / 1000);
|
|
9414
10228
|
const currentMaxLifetime = now + ASSET_KEY_MAX_LIFETIME;
|
|
@@ -9425,6 +10239,7 @@ function createContentfulApi(_ref) {
|
|
|
9425
10239
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9426
10240
|
}
|
|
9427
10241
|
}
|
|
10242
|
+
|
|
9428
10243
|
/**
|
|
9429
10244
|
* Gets a collection of Locale
|
|
9430
10245
|
* @memberof ContentfulClientAPI
|
|
@@ -9441,12 +10256,9 @@ function createContentfulApi(_ref) {
|
|
|
9441
10256
|
* const response = await client.getLocales()
|
|
9442
10257
|
* console.log(response.items)
|
|
9443
10258
|
*/
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
10259
|
async function getLocales() {
|
|
9447
10260
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9448
10261
|
switchToEnvironment(http);
|
|
9449
|
-
|
|
9450
10262
|
try {
|
|
9451
10263
|
const response = await http.get('locales', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
9452
10264
|
query: query
|
|
@@ -9456,6 +10268,7 @@ function createContentfulApi(_ref) {
|
|
|
9456
10268
|
Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["errorHandler"])(error);
|
|
9457
10269
|
}
|
|
9458
10270
|
}
|
|
10271
|
+
|
|
9459
10272
|
/**
|
|
9460
10273
|
* Synchronizes either all the content or only new content since last sync
|
|
9461
10274
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
@@ -9489,8 +10302,6 @@ function createContentfulApi(_ref) {
|
|
|
9489
10302
|
* nextSyncToken: response.nextSyncToken
|
|
9490
10303
|
* })
|
|
9491
10304
|
*/
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
10305
|
async function sync() {
|
|
9495
10306
|
let query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9496
10307
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
@@ -9506,6 +10317,7 @@ function createContentfulApi(_ref) {
|
|
|
9506
10317
|
removeUnresolved
|
|
9507
10318
|
}, options));
|
|
9508
10319
|
}
|
|
10320
|
+
|
|
9509
10321
|
/**
|
|
9510
10322
|
* Parse raw json data into collection of entry objects.Links will be resolved also
|
|
9511
10323
|
* @memberof ContentfulClientAPI
|
|
@@ -9536,8 +10348,6 @@ function createContentfulApi(_ref) {
|
|
|
9536
10348
|
* let parsedData = client.parseEntries(data);
|
|
9537
10349
|
* console.log( parsedData.items[0].fields.foo ); // foo
|
|
9538
10350
|
*/
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
10351
|
function parseEntries(data) {
|
|
9542
10352
|
const {
|
|
9543
10353
|
resolveLinks,
|
|
@@ -9548,23 +10358,20 @@ function createContentfulApi(_ref) {
|
|
|
9548
10358
|
removeUnresolved
|
|
9549
10359
|
});
|
|
9550
10360
|
}
|
|
10361
|
+
|
|
9551
10362
|
/*
|
|
9552
10363
|
* Switches BaseURL to use /environments path
|
|
9553
10364
|
* */
|
|
9554
|
-
|
|
9555
|
-
|
|
9556
10365
|
function switchToEnvironment(http) {
|
|
9557
10366
|
http.defaults.baseURL = getGlobalOptions().environmentBaseUrl;
|
|
9558
10367
|
}
|
|
10368
|
+
|
|
9559
10369
|
/*
|
|
9560
10370
|
* Switches BaseURL to use /spaces path
|
|
9561
10371
|
* */
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
10372
|
function switchToSpace(http) {
|
|
9565
10373
|
http.defaults.baseURL = getGlobalOptions().spaceBaseUrl;
|
|
9566
10374
|
}
|
|
9567
|
-
|
|
9568
10375
|
return {
|
|
9569
10376
|
getSpace,
|
|
9570
10377
|
getContentType,
|
|
@@ -9628,6 +10435,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9628
10435
|
/* 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
10436
|
|
|
9630
10437
|
|
|
10438
|
+
|
|
9631
10439
|
/**
|
|
9632
10440
|
* @memberof Entities
|
|
9633
10441
|
* @typedef AssetKey
|
|
@@ -9641,7 +10449,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9641
10449
|
* @param {Object} data - Raw asset key data
|
|
9642
10450
|
* @return {Asset} Wrapped asset key data
|
|
9643
10451
|
*/
|
|
9644
|
-
|
|
9645
10452
|
function wrapAssetKey(data) {
|
|
9646
10453
|
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
10454
|
}
|
|
@@ -9664,6 +10471,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9664
10471
|
/* 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
10472
|
|
|
9666
10473
|
|
|
10474
|
+
|
|
9667
10475
|
/**
|
|
9668
10476
|
* @memberof Entities
|
|
9669
10477
|
* @typedef Asset
|
|
@@ -9685,10 +10493,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9685
10493
|
* @param {Object} data - Raw asset data
|
|
9686
10494
|
* @return {Asset} Wrapped asset data
|
|
9687
10495
|
*/
|
|
9688
|
-
|
|
9689
10496
|
function wrapAsset(data) {
|
|
9690
10497
|
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
10498
|
}
|
|
10499
|
+
|
|
9692
10500
|
/**
|
|
9693
10501
|
* @memberof Entities
|
|
9694
10502
|
* @typedef AssetCollection
|
|
@@ -9704,7 +10512,6 @@ function wrapAsset(data) {
|
|
|
9704
10512
|
* @param {Object} data - Raw asset collection data
|
|
9705
10513
|
* @return {AssetCollection} Wrapped asset collection data
|
|
9706
10514
|
*/
|
|
9707
|
-
|
|
9708
10515
|
function wrapAssetCollection(data) {
|
|
9709
10516
|
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
10517
|
}
|
|
@@ -9727,6 +10534,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9727
10534
|
/* 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
10535
|
|
|
9729
10536
|
|
|
10537
|
+
|
|
9730
10538
|
/**
|
|
9731
10539
|
* @memberof Entities
|
|
9732
10540
|
* @typedef ContentType
|
|
@@ -9743,10 +10551,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9743
10551
|
* @param {Object} data - Raw content type data
|
|
9744
10552
|
* @return {ContentType} Wrapped content type data
|
|
9745
10553
|
*/
|
|
9746
|
-
|
|
9747
10554
|
function wrapContentType(data) {
|
|
9748
10555
|
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
10556
|
}
|
|
10557
|
+
|
|
9750
10558
|
/**
|
|
9751
10559
|
* @memberof Entities
|
|
9752
10560
|
* @typedef ContentTypeCollection
|
|
@@ -9762,7 +10570,6 @@ function wrapContentType(data) {
|
|
|
9762
10570
|
* @param {Object} data - Raw content type collection data
|
|
9763
10571
|
* @return {ContentTypeCollection} Wrapped content type collection data
|
|
9764
10572
|
*/
|
|
9765
|
-
|
|
9766
10573
|
function wrapContentTypeCollection(data) {
|
|
9767
10574
|
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
10575
|
}
|
|
@@ -9789,6 +10596,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9789
10596
|
|
|
9790
10597
|
|
|
9791
10598
|
|
|
10599
|
+
|
|
9792
10600
|
/**
|
|
9793
10601
|
* Types of fields found in an Entry
|
|
9794
10602
|
* @namespace EntryFields
|
|
@@ -9859,10 +10667,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9859
10667
|
* @param {Object} data - Raw entry data
|
|
9860
10668
|
* @return {Entry} Wrapped entry data
|
|
9861
10669
|
*/
|
|
9862
|
-
|
|
9863
10670
|
function wrapEntry(data) {
|
|
9864
10671
|
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
10672
|
}
|
|
10673
|
+
|
|
9866
10674
|
/**
|
|
9867
10675
|
* @memberof Entities
|
|
9868
10676
|
* @typedef EntryCollection
|
|
@@ -9883,21 +10691,18 @@ function wrapEntry(data) {
|
|
|
9883
10691
|
* @param {Object} options - wrapper options
|
|
9884
10692
|
* @return {EntryCollection} Wrapped entry collection data
|
|
9885
10693
|
*/
|
|
9886
|
-
|
|
9887
10694
|
function wrapEntryCollection(data, _ref) {
|
|
9888
10695
|
let {
|
|
9889
10696
|
resolveLinks,
|
|
9890
10697
|
removeUnresolved
|
|
9891
10698
|
} = _ref;
|
|
9892
10699
|
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
10700
|
if (resolveLinks) {
|
|
9895
10701
|
wrappedData.items = Object(contentful_resolve_response__WEBPACK_IMPORTED_MODULE_3__["default"])(wrappedData, {
|
|
9896
10702
|
removeUnresolved,
|
|
9897
10703
|
itemEntryPoints: ['fields']
|
|
9898
10704
|
});
|
|
9899
10705
|
}
|
|
9900
|
-
|
|
9901
10706
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["freezeSys"])(wrappedData);
|
|
9902
10707
|
}
|
|
9903
10708
|
|
|
@@ -9954,6 +10759,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9954
10759
|
/* 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
10760
|
|
|
9956
10761
|
|
|
10762
|
+
|
|
9957
10763
|
/**
|
|
9958
10764
|
* @memberof Entities
|
|
9959
10765
|
* @typedef Locale
|
|
@@ -9971,10 +10777,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9971
10777
|
* @param {Object} data - Raw locale data
|
|
9972
10778
|
* @return {Locale} Wrapped locale data
|
|
9973
10779
|
*/
|
|
9974
|
-
|
|
9975
10780
|
function wrapLocale(data) {
|
|
9976
10781
|
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
10782
|
}
|
|
10783
|
+
|
|
9978
10784
|
/**
|
|
9979
10785
|
* @memberof Entities
|
|
9980
10786
|
* @typedef LocaleCollection
|
|
@@ -9990,7 +10796,6 @@ function wrapLocale(data) {
|
|
|
9990
10796
|
* @param {Object} data - Raw locale collection data
|
|
9991
10797
|
* @return {LocaleCollection} Wrapped locale collection data
|
|
9992
10798
|
*/
|
|
9993
|
-
|
|
9994
10799
|
function wrapLocaleCollection(data) {
|
|
9995
10800
|
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
10801
|
}
|
|
@@ -10009,6 +10814,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10009
10814
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wrapSpace", function() { return wrapSpace; });
|
|
10010
10815
|
/* 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
10816
|
|
|
10817
|
+
|
|
10012
10818
|
/**
|
|
10013
10819
|
* @memberof Entities
|
|
10014
10820
|
* @typedef Space
|
|
@@ -10025,7 +10831,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10025
10831
|
* @param {Object} data - API response for a Space
|
|
10026
10832
|
* @return {Space}
|
|
10027
10833
|
*/
|
|
10028
|
-
|
|
10029
10834
|
function wrapSpace(data) {
|
|
10030
10835
|
return Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["freezeSys"])(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(data));
|
|
10031
10836
|
}
|
|
@@ -10048,6 +10853,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10048
10853
|
/* 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
10854
|
|
|
10050
10855
|
|
|
10856
|
+
|
|
10051
10857
|
/**
|
|
10052
10858
|
* @memberof Entities
|
|
10053
10859
|
* @typedef Tag
|
|
@@ -10061,10 +10867,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10061
10867
|
* @param {Object} data - Raw tag data
|
|
10062
10868
|
* @return {Tag} Wrapped tag data
|
|
10063
10869
|
*/
|
|
10064
|
-
|
|
10065
10870
|
function wrapTag(data) {
|
|
10066
10871
|
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
10872
|
}
|
|
10873
|
+
|
|
10068
10874
|
/**
|
|
10069
10875
|
* @memberof Entities
|
|
10070
10876
|
* @typedef TagCollection
|
|
@@ -10080,7 +10886,6 @@ function wrapTag(data) {
|
|
|
10080
10886
|
* @param {Object} data - Raw tag collection data
|
|
10081
10887
|
* @return {TagCollection} Wrapped tag collection data
|
|
10082
10888
|
*/
|
|
10083
|
-
|
|
10084
10889
|
function wrapTagCollection(data) {
|
|
10085
10890
|
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
10891
|
}
|
|
@@ -10138,11 +10943,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
10138
10943
|
/* 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
10944
|
/* harmony import */ var _mixins_stringify_safe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mixins/stringify-safe */ "./mixins/stringify-safe.js");
|
|
10140
10945
|
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
10946
|
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
10947
|
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
10948
|
/**
|
|
10147
10949
|
* See <a href="https://www.contentful.com/developers/docs/concepts/sync/">Synchronization</a> for more information.
|
|
10148
10950
|
* @namespace Sync
|
|
@@ -10150,6 +10952,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10150
10952
|
|
|
10151
10953
|
|
|
10152
10954
|
|
|
10955
|
+
|
|
10153
10956
|
/**
|
|
10154
10957
|
* @memberof Sync
|
|
10155
10958
|
* @typedef SyncCollection
|
|
@@ -10187,74 +10990,62 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
10187
10990
|
* @param {boolean} [options.paginate = true] - If further sync pages should automatically be crawled
|
|
10188
10991
|
* @return {Promise<SyncCollection>}
|
|
10189
10992
|
*/
|
|
10190
|
-
|
|
10191
10993
|
async function pagedSync(http, query) {
|
|
10192
10994
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
10193
|
-
|
|
10194
10995
|
if (!query || !query.initial && !query.nextSyncToken && !query.nextPageToken) {
|
|
10195
10996
|
throw new Error('Please provide one of `initial`, `nextSyncToken` or `nextPageToken` parameters for syncing');
|
|
10196
10997
|
}
|
|
10197
|
-
|
|
10198
10998
|
if (query && query.content_type && !query.type) {
|
|
10199
10999
|
query.type = 'Entry';
|
|
10200
11000
|
} else if (query && query.content_type && query.type && query.type !== 'Entry') {
|
|
10201
11001
|
throw new Error('When using the `content_type` filter your `type` parameter cannot be different from `Entry`.');
|
|
10202
11002
|
}
|
|
10203
|
-
|
|
10204
11003
|
const defaultOptions = {
|
|
10205
11004
|
resolveLinks: true,
|
|
10206
11005
|
removeUnresolved: false,
|
|
10207
11006
|
paginate: true
|
|
10208
11007
|
};
|
|
10209
|
-
|
|
10210
11008
|
const {
|
|
10211
11009
|
resolveLinks,
|
|
10212
11010
|
removeUnresolved,
|
|
10213
11011
|
paginate
|
|
10214
11012
|
} = _objectSpread(_objectSpread({}, defaultOptions), options);
|
|
10215
|
-
|
|
10216
11013
|
const syncOptions = {
|
|
10217
11014
|
paginate
|
|
10218
11015
|
};
|
|
10219
|
-
const response = await getSyncPage(http, [], query, syncOptions);
|
|
10220
|
-
|
|
11016
|
+
const response = await getSyncPage(http, [], query, syncOptions);
|
|
11017
|
+
// clones response.items used in includes because we don't want these to be mutated
|
|
10221
11018
|
if (resolveLinks) {
|
|
10222
11019
|
response.items = Object(contentful_resolve_response__WEBPACK_IMPORTED_MODULE_1__["default"])(response, {
|
|
10223
11020
|
removeUnresolved,
|
|
10224
11021
|
itemEntryPoints: ['fields']
|
|
10225
11022
|
});
|
|
10226
|
-
}
|
|
10227
|
-
|
|
10228
|
-
|
|
11023
|
+
}
|
|
11024
|
+
// maps response items again after getters are attached
|
|
10229
11025
|
const mappedResponseItems = mapResponseItems(response.items);
|
|
10230
|
-
|
|
10231
11026
|
if (response.nextSyncToken) {
|
|
10232
11027
|
mappedResponseItems.nextSyncToken = response.nextSyncToken;
|
|
10233
11028
|
}
|
|
10234
|
-
|
|
10235
11029
|
if (response.nextPageToken) {
|
|
10236
11030
|
mappedResponseItems.nextPageToken = response.nextPageToken;
|
|
10237
11031
|
}
|
|
10238
|
-
|
|
10239
11032
|
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
11033
|
}
|
|
11034
|
+
|
|
10241
11035
|
/**
|
|
10242
11036
|
* @private
|
|
10243
11037
|
* @param {Array<Entities.Entry|Entities.Array|Sync.DeletedEntry|Sync.DeletedAsset>} items
|
|
10244
11038
|
* @return {Object} Entities mapped to an object for each entity type
|
|
10245
11039
|
*/
|
|
10246
|
-
|
|
10247
11040
|
function mapResponseItems(items) {
|
|
10248
11041
|
const reducer = type => {
|
|
10249
11042
|
return (accumulated, item) => {
|
|
10250
11043
|
if (item.sys.type === type) {
|
|
10251
11044
|
accumulated.push(Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["toPlainObject"])(item));
|
|
10252
11045
|
}
|
|
10253
|
-
|
|
10254
11046
|
return accumulated;
|
|
10255
11047
|
};
|
|
10256
11048
|
};
|
|
10257
|
-
|
|
10258
11049
|
return {
|
|
10259
11050
|
entries: items.reduce(reducer('Entry'), []),
|
|
10260
11051
|
assets: items.reduce(reducer('Asset'), []),
|
|
@@ -10262,6 +11053,7 @@ function mapResponseItems(items) {
|
|
|
10262
11053
|
deletedAssets: items.reduce(reducer('DeletedAsset'), [])
|
|
10263
11054
|
};
|
|
10264
11055
|
}
|
|
11056
|
+
|
|
10265
11057
|
/**
|
|
10266
11058
|
* If the response contains a nextPageUrl, extracts the sync token to get the
|
|
10267
11059
|
* next page and calls itself again with that token.
|
|
@@ -10277,36 +11069,29 @@ function mapResponseItems(items) {
|
|
|
10277
11069
|
* @param {boolean} [options.paginate = true] - If further sync pages should automatically be crawled
|
|
10278
11070
|
* @return {Promise<{items: Array, nextSyncToken: string}>}
|
|
10279
11071
|
*/
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
11072
|
async function getSyncPage(http, items, query, _ref) {
|
|
10283
11073
|
let {
|
|
10284
11074
|
paginate
|
|
10285
11075
|
} = _ref;
|
|
10286
|
-
|
|
10287
11076
|
if (query.nextSyncToken) {
|
|
10288
11077
|
query.sync_token = query.nextSyncToken;
|
|
10289
11078
|
delete query.nextSyncToken;
|
|
10290
11079
|
}
|
|
10291
|
-
|
|
10292
11080
|
if (query.nextPageToken) {
|
|
10293
11081
|
query.sync_token = query.nextPageToken;
|
|
10294
11082
|
delete query.nextPageToken;
|
|
10295
11083
|
}
|
|
10296
|
-
|
|
10297
11084
|
if (query.sync_token) {
|
|
10298
11085
|
delete query.initial;
|
|
10299
11086
|
delete query.type;
|
|
10300
11087
|
delete query.content_type;
|
|
10301
11088
|
delete query.limit;
|
|
10302
11089
|
}
|
|
10303
|
-
|
|
10304
11090
|
const response = await http.get('sync', Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["createRequestConfig"])({
|
|
10305
11091
|
query: query
|
|
10306
11092
|
}));
|
|
10307
11093
|
const data = response.data || {};
|
|
10308
11094
|
items = items.concat(data.items || []);
|
|
10309
|
-
|
|
10310
11095
|
if (data.nextPageUrl) {
|
|
10311
11096
|
if (paginate) {
|
|
10312
11097
|
delete query.initial;
|
|
@@ -10315,7 +11100,6 @@ async function getSyncPage(http, items, query, _ref) {
|
|
|
10315
11100
|
paginate
|
|
10316
11101
|
});
|
|
10317
11102
|
}
|
|
10318
|
-
|
|
10319
11103
|
return {
|
|
10320
11104
|
items: items,
|
|
10321
11105
|
nextPageToken: getToken(data.nextPageUrl)
|
|
@@ -10331,12 +11115,11 @@ async function getSyncPage(http, items, query, _ref) {
|
|
|
10331
11115
|
};
|
|
10332
11116
|
}
|
|
10333
11117
|
}
|
|
11118
|
+
|
|
10334
11119
|
/**
|
|
10335
11120
|
* Extracts token out of an url
|
|
10336
11121
|
* @private
|
|
10337
11122
|
*/
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
11123
|
function getToken(url) {
|
|
10341
11124
|
const urlParts = url.split('?');
|
|
10342
11125
|
return urlParts.length > 0 ? urlParts[1].replace('sync_token=', '') : '';
|
|
@@ -10355,36 +11138,36 @@ function getToken(url) {
|
|
|
10355
11138
|
__webpack_require__.r(__webpack_exports__);
|
|
10356
11139
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeSelect; });
|
|
10357
11140
|
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
11141
|
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
11142
|
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
11143
|
/*
|
|
10364
11144
|
* sdk relies heavily on sys metadata
|
|
10365
11145
|
* so we cannot omit the sys property on sdk level entirely
|
|
10366
11146
|
* and we have to ensure that at least `id` and `type` are present
|
|
10367
11147
|
* */
|
|
11148
|
+
|
|
10368
11149
|
function normalizeSelect(query) {
|
|
10369
11150
|
if (!query.select) {
|
|
10370
11151
|
return query;
|
|
10371
|
-
}
|
|
10372
|
-
// Get the different parts that are listed for selection
|
|
10373
|
-
|
|
11152
|
+
}
|
|
10374
11153
|
|
|
10375
|
-
|
|
11154
|
+
// The selection of fields for the query is limited
|
|
11155
|
+
// Get the different parts that are listed for selection
|
|
11156
|
+
const allSelects = Array.isArray(query.select) ? query.select : query.select.split(',');
|
|
11157
|
+
// Move the parts into a set for easy access and deduplication
|
|
11158
|
+
const selectedSet = new Set(allSelects);
|
|
10376
11159
|
|
|
10377
|
-
|
|
11160
|
+
// If we already select all of `sys` we can just return
|
|
10378
11161
|
// since we're anyway fetching everything that is needed
|
|
10379
|
-
|
|
10380
11162
|
if (selectedSet.has('sys')) {
|
|
10381
11163
|
return query;
|
|
10382
|
-
}
|
|
10383
|
-
|
|
11164
|
+
}
|
|
10384
11165
|
|
|
11166
|
+
// We don't select `sys` so we need to ensure the minimum set
|
|
10385
11167
|
selectedSet.add('sys.id');
|
|
10386
|
-
selectedSet.add('sys.type');
|
|
11168
|
+
selectedSet.add('sys.type');
|
|
10387
11169
|
|
|
11170
|
+
// Reassign the normalized sys properties
|
|
10388
11171
|
return _objectSpread(_objectSpread({}, query), {}, {
|
|
10389
11172
|
select: [...selectedSet].join(',')
|
|
10390
11173
|
});
|
|
@@ -10408,19 +11191,15 @@ class ValidationError extends Error {
|
|
|
10408
11191
|
super(`Invalid "${name}" provided, ` + message);
|
|
10409
11192
|
this.name = 'ValidationError';
|
|
10410
11193
|
}
|
|
10411
|
-
|
|
10412
11194
|
}
|
|
10413
11195
|
function validateTimestamp(name, timestamp, options) {
|
|
10414
11196
|
options = options || {};
|
|
10415
|
-
|
|
10416
11197
|
if (typeof timestamp !== 'number') {
|
|
10417
11198
|
throw new ValidationError(name, `only numeric values are allowed for timestamps, provided type was "${typeof timestamp}"`);
|
|
10418
11199
|
}
|
|
10419
|
-
|
|
10420
11200
|
if (options.maximum && timestamp > options.maximum) {
|
|
10421
11201
|
throw new ValidationError(name, `value (${timestamp}) cannot be further in the future than expected maximum (${options.maximum})`);
|
|
10422
11202
|
}
|
|
10423
|
-
|
|
10424
11203
|
if (options.now && timestamp < options.now) {
|
|
10425
11204
|
throw new ValidationError(name, `value (${timestamp}) cannot be in the past, current time was ${options.now}`);
|
|
10426
11205
|
}
|