contentful 9.2.7 → 9.2.9
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 +52 -987
- package/dist/contentful.browser.js.map +1 -1
- package/dist/contentful.browser.min.js +3 -3
- package/dist/contentful.node.js +52 -975
- package/dist/contentful.node.js.map +1 -1
- package/dist/contentful.node.min.js +3 -3
- package/dist/es-modules/contentful.js +1 -1
- package/package.json +4 -4
|
@@ -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/
|
|
2851
|
+
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/fast-copy.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,426 +3003,6 @@ 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
|
-
|
|
3426
3006
|
/***/ }),
|
|
3427
3007
|
|
|
3428
3008
|
/***/ "../node_modules/contentful-sdk-core/dist/index.es-modules.js":
|
|
@@ -3441,7 +3021,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3441
3021
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "freezeSys", function() { return freezeSys; });
|
|
3442
3022
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUserAgentHeader", function() { return getUserAgentHeader; });
|
|
3443
3023
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toPlainObject", function() { return toPlainObject; });
|
|
3444
|
-
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/
|
|
3024
|
+
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/fast-copy.js");
|
|
3445
3025
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fast_copy__WEBPACK_IMPORTED_MODULE_0__);
|
|
3446
3026
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qs */ "../node_modules/qs/lib/index.js");
|
|
3447
3027
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_1__);
|
|
@@ -3459,17 +3039,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3459
3039
|
|
|
3460
3040
|
function ownKeys(object, enumerableOnly) {
|
|
3461
3041
|
var keys = Object.keys(object);
|
|
3462
|
-
|
|
3463
3042
|
if (Object.getOwnPropertySymbols) {
|
|
3464
3043
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
3465
3044
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
3466
3045
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
3467
3046
|
})), keys.push.apply(keys, symbols);
|
|
3468
3047
|
}
|
|
3469
|
-
|
|
3470
3048
|
return keys;
|
|
3471
3049
|
}
|
|
3472
|
-
|
|
3473
3050
|
function _objectSpread2(target) {
|
|
3474
3051
|
for (var i = 1; i < arguments.length; i++) {
|
|
3475
3052
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -3479,10 +3056,8 @@ function _objectSpread2(target) {
|
|
|
3479
3056
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3480
3057
|
});
|
|
3481
3058
|
}
|
|
3482
|
-
|
|
3483
3059
|
return target;
|
|
3484
3060
|
}
|
|
3485
|
-
|
|
3486
3061
|
function _typeof(obj) {
|
|
3487
3062
|
"@babel/helpers - typeof";
|
|
3488
3063
|
|
|
@@ -3492,61 +3067,47 @@ function _typeof(obj) {
|
|
|
3492
3067
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
3493
3068
|
}, _typeof(obj);
|
|
3494
3069
|
}
|
|
3495
|
-
|
|
3496
3070
|
function _wrapRegExp() {
|
|
3497
3071
|
_wrapRegExp = function (re, groups) {
|
|
3498
3072
|
return new BabelRegExp(re, void 0, groups);
|
|
3499
3073
|
};
|
|
3500
|
-
|
|
3501
3074
|
var _super = RegExp.prototype,
|
|
3502
|
-
|
|
3503
|
-
|
|
3075
|
+
_groups = new WeakMap();
|
|
3504
3076
|
function BabelRegExp(re, flags, groups) {
|
|
3505
3077
|
var _this = new RegExp(re, flags);
|
|
3506
|
-
|
|
3507
3078
|
return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
|
|
3508
3079
|
}
|
|
3509
|
-
|
|
3510
3080
|
function buildGroups(result, re) {
|
|
3511
3081
|
var g = _groups.get(re);
|
|
3512
|
-
|
|
3513
3082
|
return Object.keys(g).reduce(function (groups, name) {
|
|
3514
3083
|
var i = g[name];
|
|
3515
3084
|
if ("number" == typeof i) groups[name] = result[i];else {
|
|
3516
3085
|
for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
|
|
3517
|
-
|
|
3518
3086
|
groups[name] = result[i[k]];
|
|
3519
3087
|
}
|
|
3520
3088
|
return groups;
|
|
3521
3089
|
}, Object.create(null));
|
|
3522
3090
|
}
|
|
3523
|
-
|
|
3524
3091
|
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
|
|
3525
3092
|
var result = _super.exec.call(this, str);
|
|
3526
|
-
|
|
3527
3093
|
return result && (result.groups = buildGroups(result, this)), result;
|
|
3528
3094
|
}, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
|
3529
3095
|
if ("string" == typeof substitution) {
|
|
3530
3096
|
var groups = _groups.get(this);
|
|
3531
|
-
|
|
3532
3097
|
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
|
3533
3098
|
return "$" + groups[name];
|
|
3534
3099
|
}));
|
|
3535
3100
|
}
|
|
3536
|
-
|
|
3537
3101
|
if ("function" == typeof substitution) {
|
|
3538
3102
|
var _this = this;
|
|
3539
|
-
|
|
3540
3103
|
return _super[Symbol.replace].call(this, str, function () {
|
|
3541
3104
|
var args = arguments;
|
|
3542
3105
|
return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
|
|
3543
3106
|
});
|
|
3544
3107
|
}
|
|
3545
|
-
|
|
3546
3108
|
return _super[Symbol.replace].call(this, str, substitution);
|
|
3547
3109
|
}, _wrapRegExp.apply(this, arguments);
|
|
3548
3110
|
}
|
|
3549
|
-
|
|
3550
3111
|
function _defineProperty(obj, key, value) {
|
|
3551
3112
|
if (key in obj) {
|
|
3552
3113
|
Object.defineProperty(obj, key, {
|
|
@@ -3558,15 +3119,12 @@ function _defineProperty(obj, key, value) {
|
|
|
3558
3119
|
} else {
|
|
3559
3120
|
obj[key] = value;
|
|
3560
3121
|
}
|
|
3561
|
-
|
|
3562
3122
|
return obj;
|
|
3563
3123
|
}
|
|
3564
|
-
|
|
3565
3124
|
function _inherits(subClass, superClass) {
|
|
3566
3125
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
3567
3126
|
throw new TypeError("Super expression must either be null or a function");
|
|
3568
3127
|
}
|
|
3569
|
-
|
|
3570
3128
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
3571
3129
|
constructor: {
|
|
3572
3130
|
value: subClass,
|
|
@@ -3579,7 +3137,6 @@ function _inherits(subClass, superClass) {
|
|
|
3579
3137
|
});
|
|
3580
3138
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
3581
3139
|
}
|
|
3582
|
-
|
|
3583
3140
|
function _setPrototypeOf(o, p) {
|
|
3584
3141
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
3585
3142
|
o.__proto__ = p;
|
|
@@ -3587,29 +3144,22 @@ function _setPrototypeOf(o, p) {
|
|
|
3587
3144
|
};
|
|
3588
3145
|
return _setPrototypeOf(o, p);
|
|
3589
3146
|
}
|
|
3590
|
-
|
|
3591
3147
|
function _slicedToArray(arr, i) {
|
|
3592
3148
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
3593
3149
|
}
|
|
3594
|
-
|
|
3595
3150
|
function _arrayWithHoles(arr) {
|
|
3596
3151
|
if (Array.isArray(arr)) return arr;
|
|
3597
3152
|
}
|
|
3598
|
-
|
|
3599
3153
|
function _iterableToArrayLimit(arr, i) {
|
|
3600
3154
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3601
|
-
|
|
3602
3155
|
if (_i == null) return;
|
|
3603
3156
|
var _arr = [];
|
|
3604
3157
|
var _n = true;
|
|
3605
3158
|
var _d = false;
|
|
3606
|
-
|
|
3607
3159
|
var _s, _e;
|
|
3608
|
-
|
|
3609
3160
|
try {
|
|
3610
3161
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
3611
3162
|
_arr.push(_s.value);
|
|
3612
|
-
|
|
3613
3163
|
if (i && _arr.length === i) break;
|
|
3614
3164
|
}
|
|
3615
3165
|
} catch (err) {
|
|
@@ -3622,10 +3172,8 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
3622
3172
|
if (_d) throw _e;
|
|
3623
3173
|
}
|
|
3624
3174
|
}
|
|
3625
|
-
|
|
3626
3175
|
return _arr;
|
|
3627
3176
|
}
|
|
3628
|
-
|
|
3629
3177
|
function _unsupportedIterableToArray(o, minLen) {
|
|
3630
3178
|
if (!o) return;
|
|
3631
3179
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -3634,29 +3182,21 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
3634
3182
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3635
3183
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
3636
3184
|
}
|
|
3637
|
-
|
|
3638
3185
|
function _arrayLikeToArray(arr, len) {
|
|
3639
3186
|
if (len == null || len > arr.length) len = arr.length;
|
|
3640
|
-
|
|
3641
3187
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3642
|
-
|
|
3643
3188
|
return arr2;
|
|
3644
3189
|
}
|
|
3645
|
-
|
|
3646
3190
|
function _nonIterableRest() {
|
|
3647
3191
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3648
3192
|
}
|
|
3649
|
-
|
|
3650
3193
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
3651
3194
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
3652
|
-
|
|
3653
3195
|
if (!it) {
|
|
3654
3196
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
3655
3197
|
if (it) o = it;
|
|
3656
3198
|
var i = 0;
|
|
3657
|
-
|
|
3658
3199
|
var F = function () {};
|
|
3659
|
-
|
|
3660
3200
|
return {
|
|
3661
3201
|
s: F,
|
|
3662
3202
|
n: function () {
|
|
@@ -3674,13 +3214,11 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
3674
3214
|
f: F
|
|
3675
3215
|
};
|
|
3676
3216
|
}
|
|
3677
|
-
|
|
3678
3217
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3679
3218
|
}
|
|
3680
|
-
|
|
3681
3219
|
var normalCompletion = true,
|
|
3682
|
-
|
|
3683
|
-
|
|
3220
|
+
didErr = false,
|
|
3221
|
+
err;
|
|
3684
3222
|
return {
|
|
3685
3223
|
s: function () {
|
|
3686
3224
|
it = it.call(o);
|
|
@@ -3730,25 +3268,19 @@ function noop() {
|
|
|
3730
3268
|
var PERCENTAGE_REGEX = /*#__PURE__*/_wrapRegExp(/(\d+)(%)/, {
|
|
3731
3269
|
value: 1
|
|
3732
3270
|
});
|
|
3733
|
-
|
|
3734
3271
|
function calculateLimit(type) {
|
|
3735
3272
|
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 7;
|
|
3736
3273
|
var limit = max;
|
|
3737
|
-
|
|
3738
3274
|
if (PERCENTAGE_REGEX.test(type)) {
|
|
3739
3275
|
var _type$match;
|
|
3740
|
-
|
|
3741
3276
|
var groups = (_type$match = type.match(PERCENTAGE_REGEX)) === null || _type$match === void 0 ? void 0 : _type$match.groups;
|
|
3742
|
-
|
|
3743
3277
|
if (groups && groups.value) {
|
|
3744
3278
|
var percentage = parseInt(groups.value) / 100;
|
|
3745
3279
|
limit = Math.round(max * percentage);
|
|
3746
3280
|
}
|
|
3747
3281
|
}
|
|
3748
|
-
|
|
3749
3282
|
return Math.min(30, Math.max(1, limit));
|
|
3750
3283
|
}
|
|
3751
|
-
|
|
3752
3284
|
function createThrottle(limit, logger) {
|
|
3753
3285
|
logger('info', "Throttle request to ".concat(limit, "/s"));
|
|
3754
3286
|
return p_throttle__WEBPACK_IMPORTED_MODULE_3___default()({
|
|
@@ -3757,11 +3289,10 @@ function createThrottle(limit, logger) {
|
|
|
3757
3289
|
strict: false
|
|
3758
3290
|
});
|
|
3759
3291
|
}
|
|
3760
|
-
|
|
3761
3292
|
var rateLimitThrottle = (function (axiosInstance) {
|
|
3762
3293
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
|
|
3763
3294
|
var _axiosInstance$defaul = axiosInstance.defaults.logHandler,
|
|
3764
|
-
|
|
3295
|
+
logHandler = _axiosInstance$defaul === void 0 ? noop : _axiosInstance$defaul;
|
|
3765
3296
|
var limit = lodash_isstring__WEBPACK_IMPORTED_MODULE_2___default()(type) ? calculateLimit(type) : calculateLimit('auto', type);
|
|
3766
3297
|
var throttle = createThrottle(limit, logHandler);
|
|
3767
3298
|
var isCalculated = false;
|
|
@@ -3776,12 +3307,10 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
3776
3307
|
if (!isCalculated && lodash_isstring__WEBPACK_IMPORTED_MODULE_2___default()(type) && (type === 'auto' || PERCENTAGE_REGEX.test(type)) && response.headers && response.headers['x-contentful-ratelimit-second-limit']) {
|
|
3777
3308
|
var rawLimit = parseInt(response.headers['x-contentful-ratelimit-second-limit']);
|
|
3778
3309
|
var nextLimit = calculateLimit(type, rawLimit);
|
|
3779
|
-
|
|
3780
3310
|
if (nextLimit !== limit) {
|
|
3781
3311
|
if (requestInterceptorId) {
|
|
3782
3312
|
axiosInstance.interceptors.request.eject(requestInterceptorId);
|
|
3783
3313
|
}
|
|
3784
|
-
|
|
3785
3314
|
limit = nextLimit;
|
|
3786
3315
|
throttle = createThrottle(nextLimit, logHandler);
|
|
3787
3316
|
requestInterceptorId = axiosInstance.interceptors.request.use(function (config) {
|
|
@@ -3792,10 +3321,8 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
3792
3321
|
return Promise.reject(error);
|
|
3793
3322
|
});
|
|
3794
3323
|
}
|
|
3795
|
-
|
|
3796
3324
|
isCalculated = true;
|
|
3797
3325
|
}
|
|
3798
|
-
|
|
3799
3326
|
return response;
|
|
3800
3327
|
}, function (error) {
|
|
3801
3328
|
return Promise.reject(error);
|
|
@@ -3811,18 +3338,16 @@ var delay = function delay(ms) {
|
|
|
3811
3338
|
setTimeout(resolve, ms);
|
|
3812
3339
|
});
|
|
3813
3340
|
};
|
|
3814
|
-
|
|
3815
3341
|
var defaultWait = function defaultWait(attempts) {
|
|
3816
3342
|
return Math.pow(Math.SQRT2, attempts);
|
|
3817
3343
|
};
|
|
3818
|
-
|
|
3819
3344
|
function rateLimit(instance) {
|
|
3820
3345
|
var maxRetry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
3821
3346
|
var _instance$defaults = instance.defaults,
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3347
|
+
_instance$defaults$re = _instance$defaults.responseLogger,
|
|
3348
|
+
responseLogger = _instance$defaults$re === void 0 ? noop : _instance$defaults$re,
|
|
3349
|
+
_instance$defaults$re2 = _instance$defaults.requestLogger,
|
|
3350
|
+
requestLogger = _instance$defaults$re2 === void 0 ? noop : _instance$defaults$re2;
|
|
3826
3351
|
instance.interceptors.request.use(function (config) {
|
|
3827
3352
|
requestLogger(config);
|
|
3828
3353
|
return config;
|
|
@@ -3837,23 +3362,22 @@ function rateLimit(instance) {
|
|
|
3837
3362
|
}, function (error) {
|
|
3838
3363
|
var response = error.response;
|
|
3839
3364
|
var config = error.config;
|
|
3840
|
-
responseLogger(error);
|
|
3841
|
-
|
|
3365
|
+
responseLogger(error);
|
|
3366
|
+
// Do not retry if it is disabled or no request config exists (not an axios error)
|
|
3842
3367
|
if (!config || !instance.defaults.retryOnError) {
|
|
3843
3368
|
return Promise.reject(error);
|
|
3844
|
-
}
|
|
3845
|
-
|
|
3369
|
+
}
|
|
3846
3370
|
|
|
3371
|
+
// Retried already for max attempts
|
|
3847
3372
|
var doneAttempts = config.attempts || 1;
|
|
3848
|
-
|
|
3849
3373
|
if (doneAttempts > maxRetry) {
|
|
3850
3374
|
error.attempts = config.attempts;
|
|
3851
3375
|
return Promise.reject(error);
|
|
3852
3376
|
}
|
|
3853
|
-
|
|
3854
3377
|
var retryErrorType = null;
|
|
3855
|
-
var wait = defaultWait(doneAttempts);
|
|
3378
|
+
var wait = defaultWait(doneAttempts);
|
|
3856
3379
|
|
|
3380
|
+
// Errors without response did not receive anything from the server
|
|
3857
3381
|
if (!response) {
|
|
3858
3382
|
retryErrorType = 'Connection';
|
|
3859
3383
|
} else if (response.status >= 500 && response.status < 600) {
|
|
@@ -3861,30 +3385,29 @@ function rateLimit(instance) {
|
|
|
3861
3385
|
retryErrorType = "Server ".concat(response.status);
|
|
3862
3386
|
} else if (response.status === 429) {
|
|
3863
3387
|
// 429 errors are exceeded rate limit exceptions
|
|
3864
|
-
retryErrorType = 'Rate limit';
|
|
3865
|
-
|
|
3388
|
+
retryErrorType = 'Rate limit';
|
|
3389
|
+
// all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
|
|
3866
3390
|
if (response.headers && error.response.headers['x-contentful-ratelimit-reset']) {
|
|
3867
3391
|
wait = response.headers['x-contentful-ratelimit-reset'];
|
|
3868
3392
|
}
|
|
3869
3393
|
}
|
|
3870
|
-
|
|
3871
3394
|
if (retryErrorType) {
|
|
3872
3395
|
// convert to ms and add jitter
|
|
3873
3396
|
wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
|
|
3874
|
-
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
|
|
3397
|
+
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
|
|
3875
3398
|
|
|
3399
|
+
// increase attempts counter
|
|
3876
3400
|
config.attempts = doneAttempts + 1;
|
|
3401
|
+
|
|
3877
3402
|
/* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
|
|
3878
3403
|
to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
|
|
3879
3404
|
requests still use the original http/httpsAgent property */
|
|
3880
|
-
|
|
3881
3405
|
delete config.httpAgent;
|
|
3882
3406
|
delete config.httpsAgent;
|
|
3883
3407
|
return delay(wait).then(function () {
|
|
3884
3408
|
return instance(config);
|
|
3885
3409
|
});
|
|
3886
3410
|
}
|
|
3887
|
-
|
|
3888
3411
|
return Promise.reject(error);
|
|
3889
3412
|
});
|
|
3890
3413
|
}
|
|
@@ -3900,9 +3423,10 @@ function asyncToken(instance, getToken) {
|
|
|
3900
3423
|
});
|
|
3901
3424
|
}
|
|
3902
3425
|
|
|
3426
|
+
// Matches 'sub.host:port' or 'host:port' and extracts hostname and port
|
|
3903
3427
|
// Also enforces toplevel domain specified, no spaces and no protocol
|
|
3904
|
-
|
|
3905
3428
|
var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
3429
|
+
|
|
3906
3430
|
/**
|
|
3907
3431
|
* Create pre configured axios instance
|
|
3908
3432
|
* @private
|
|
@@ -3910,7 +3434,6 @@ var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
|
3910
3434
|
* @param {CreateHttpClientParams} options - Initialization parameters for the HTTP client
|
|
3911
3435
|
* @return {ContentfulAxiosInstance} Initialized axios instance
|
|
3912
3436
|
*/
|
|
3913
|
-
|
|
3914
3437
|
function createHttpClient(axios, options) {
|
|
3915
3438
|
var defaultConfig = {
|
|
3916
3439
|
insecure: false,
|
|
@@ -3925,7 +3448,6 @@ function createHttpClient(axios, options) {
|
|
|
3925
3448
|
console.error(data);
|
|
3926
3449
|
return;
|
|
3927
3450
|
}
|
|
3928
|
-
|
|
3929
3451
|
console.log("[".concat(level, "] ").concat(data));
|
|
3930
3452
|
},
|
|
3931
3453
|
// Passed to axios
|
|
@@ -3940,56 +3462,47 @@ function createHttpClient(axios, options) {
|
|
|
3940
3462
|
maxContentLength: 1073741824,
|
|
3941
3463
|
// 1GB
|
|
3942
3464
|
maxBodyLength: 1073741824 // 1GB
|
|
3943
|
-
|
|
3944
3465
|
};
|
|
3945
3466
|
|
|
3946
3467
|
var config = _objectSpread2(_objectSpread2({}, defaultConfig), options);
|
|
3947
|
-
|
|
3948
3468
|
if (!config.accessToken) {
|
|
3949
3469
|
var missingAccessTokenError = new TypeError('Expected parameter accessToken');
|
|
3950
3470
|
config.logHandler('error', missingAccessTokenError);
|
|
3951
3471
|
throw missingAccessTokenError;
|
|
3952
|
-
}
|
|
3953
|
-
|
|
3472
|
+
}
|
|
3954
3473
|
|
|
3474
|
+
// Construct axios baseURL option
|
|
3955
3475
|
var protocol = config.insecure ? 'http' : 'https';
|
|
3956
3476
|
var space = config.space ? "".concat(config.space, "/") : '';
|
|
3957
3477
|
var hostname = config.defaultHostname;
|
|
3958
3478
|
var port = config.insecure ? 80 : 443;
|
|
3959
|
-
|
|
3960
3479
|
if (config.host && HOST_REGEX.test(config.host)) {
|
|
3961
3480
|
var parsed = config.host.split(':');
|
|
3962
|
-
|
|
3963
3481
|
if (parsed.length === 2) {
|
|
3964
|
-
|
|
3965
3482
|
var _parsed = _slicedToArray(parsed, 2);
|
|
3966
|
-
|
|
3967
3483
|
hostname = _parsed[0];
|
|
3968
3484
|
port = _parsed[1];
|
|
3969
3485
|
} else {
|
|
3970
3486
|
hostname = parsed[0];
|
|
3971
3487
|
}
|
|
3972
|
-
}
|
|
3973
|
-
|
|
3488
|
+
}
|
|
3974
3489
|
|
|
3490
|
+
// Ensure that basePath does start but not end with a slash
|
|
3975
3491
|
if (config.basePath) {
|
|
3976
3492
|
config.basePath = "/".concat(config.basePath.split('/').filter(Boolean).join('/'));
|
|
3977
3493
|
}
|
|
3978
|
-
|
|
3979
3494
|
var baseURL = options.baseURL || "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath, "/spaces/").concat(space);
|
|
3980
|
-
|
|
3981
3495
|
if (!config.headers.Authorization && typeof config.accessToken !== 'function') {
|
|
3982
3496
|
config.headers.Authorization = 'Bearer ' + config.accessToken;
|
|
3983
|
-
}
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3499
|
+
// Set these headers only for node because browsers don't like it when you
|
|
3984
3500
|
// override user-agent or accept-encoding.
|
|
3985
3501
|
// The SDKs should set their own X-Contentful-User-Agent.
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
3502
|
if (isNode()) {
|
|
3989
3503
|
config.headers['user-agent'] = 'node.js/' + getNodeVersion();
|
|
3990
3504
|
config.headers['Accept-Encoding'] = 'gzip';
|
|
3991
3505
|
}
|
|
3992
|
-
|
|
3993
3506
|
var axiosOptions = {
|
|
3994
3507
|
// Axios
|
|
3995
3508
|
baseURL: baseURL,
|
|
@@ -4010,6 +3523,7 @@ function createHttpClient(axios, options) {
|
|
|
4010
3523
|
};
|
|
4011
3524
|
var instance = axios.create(axiosOptions);
|
|
4012
3525
|
instance.httpClientParams = options;
|
|
3526
|
+
|
|
4013
3527
|
/**
|
|
4014
3528
|
* Creates a new axios instance with the same default base parameters as the
|
|
4015
3529
|
* current one, and with any overrides passed to the newParams object
|
|
@@ -4020,41 +3534,34 @@ function createHttpClient(axios, options) {
|
|
|
4020
3534
|
* @param {CreateHttpClientParams} httpClientParams - Initialization parameters for the HTTP client
|
|
4021
3535
|
* @return {ContentfulAxiosInstance} Initialized axios instance
|
|
4022
3536
|
*/
|
|
4023
|
-
|
|
4024
3537
|
instance.cloneWithNewParams = function (newParams) {
|
|
4025
3538
|
return createHttpClient(axios, _objectSpread2(_objectSpread2({}, fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(options)), newParams));
|
|
4026
3539
|
};
|
|
3540
|
+
|
|
4027
3541
|
/**
|
|
4028
3542
|
* Apply interceptors.
|
|
4029
3543
|
* Please note that the order of interceptors is important
|
|
4030
3544
|
*/
|
|
4031
3545
|
|
|
4032
|
-
|
|
4033
3546
|
if (config.onBeforeRequest) {
|
|
4034
3547
|
instance.interceptors.request.use(config.onBeforeRequest);
|
|
4035
3548
|
}
|
|
4036
|
-
|
|
4037
3549
|
if (typeof config.accessToken === 'function') {
|
|
4038
3550
|
asyncToken(instance, config.accessToken);
|
|
4039
3551
|
}
|
|
4040
|
-
|
|
4041
3552
|
if (config.throttle) {
|
|
4042
3553
|
rateLimitThrottle(instance, config.throttle);
|
|
4043
3554
|
}
|
|
4044
|
-
|
|
4045
3555
|
rateLimit(instance, config.retryLimit);
|
|
4046
|
-
|
|
4047
3556
|
if (config.onError) {
|
|
4048
3557
|
instance.interceptors.response.use(function (response) {
|
|
4049
3558
|
return response;
|
|
4050
3559
|
}, config.onError);
|
|
4051
3560
|
}
|
|
4052
|
-
|
|
4053
3561
|
return instance;
|
|
4054
3562
|
}
|
|
4055
3563
|
|
|
4056
3564
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
4057
|
-
|
|
4058
3565
|
/**
|
|
4059
3566
|
* Creates request parameters configuration by parsing an existing query object
|
|
4060
3567
|
* @private
|
|
@@ -4077,22 +3584,19 @@ function enforceObjPath(obj, path) {
|
|
|
4077
3584
|
err.message = "Required property ".concat(path, " missing from:\n\n").concat(JSON.stringify(obj), "\n\n");
|
|
4078
3585
|
throw err;
|
|
4079
3586
|
}
|
|
4080
|
-
|
|
4081
3587
|
return true;
|
|
4082
3588
|
}
|
|
4083
3589
|
|
|
4084
3590
|
// copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
|
|
3591
|
+
|
|
4085
3592
|
function deepFreeze(object) {
|
|
4086
3593
|
var propNames = Object.getOwnPropertyNames(object);
|
|
4087
|
-
|
|
4088
3594
|
var _iterator = _createForOfIteratorHelper(propNames),
|
|
4089
|
-
|
|
4090
|
-
|
|
3595
|
+
_step;
|
|
4091
3596
|
try {
|
|
4092
3597
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4093
3598
|
var name = _step.value;
|
|
4094
3599
|
var value = object[name];
|
|
4095
|
-
|
|
4096
3600
|
if (value && _typeof(value) === 'object') {
|
|
4097
3601
|
deepFreeze(value);
|
|
4098
3602
|
}
|
|
@@ -4102,10 +3606,8 @@ function deepFreeze(object) {
|
|
|
4102
3606
|
} finally {
|
|
4103
3607
|
_iterator.f();
|
|
4104
3608
|
}
|
|
4105
|
-
|
|
4106
3609
|
return Object.freeze(object);
|
|
4107
3610
|
}
|
|
4108
|
-
|
|
4109
3611
|
function freezeSys(obj) {
|
|
4110
3612
|
deepFreeze(obj.sys || {});
|
|
4111
3613
|
return obj;
|
|
@@ -4113,18 +3615,15 @@ function freezeSys(obj) {
|
|
|
4113
3615
|
|
|
4114
3616
|
function getBrowserOS() {
|
|
4115
3617
|
var win = getWindow();
|
|
4116
|
-
|
|
4117
3618
|
if (!win) {
|
|
4118
3619
|
return null;
|
|
4119
3620
|
}
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
3621
|
+
var userAgent = win.navigator.userAgent;
|
|
3622
|
+
// TODO: platform is deprecated.
|
|
4123
3623
|
var platform = win.navigator.platform;
|
|
4124
3624
|
var macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
|
|
4125
3625
|
var windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
|
|
4126
3626
|
var iosPlatforms = ['iPhone', 'iPad', 'iPod'];
|
|
4127
|
-
|
|
4128
3627
|
if (macosPlatforms.indexOf(platform) !== -1) {
|
|
4129
3628
|
return 'macOS';
|
|
4130
3629
|
} else if (iosPlatforms.indexOf(platform) !== -1) {
|
|
@@ -4136,10 +3635,8 @@ function getBrowserOS() {
|
|
|
4136
3635
|
} else if (/Linux/.test(platform)) {
|
|
4137
3636
|
return 'Linux';
|
|
4138
3637
|
}
|
|
4139
|
-
|
|
4140
3638
|
return null;
|
|
4141
3639
|
}
|
|
4142
|
-
|
|
4143
3640
|
function getNodeOS() {
|
|
4144
3641
|
var platform = process.platform || 'linux';
|
|
4145
3642
|
var version = process.version || '0.0.0';
|
|
@@ -4153,32 +3650,24 @@ function getNodeOS() {
|
|
|
4153
3650
|
sunos: 'Linux',
|
|
4154
3651
|
win32: 'Windows'
|
|
4155
3652
|
};
|
|
4156
|
-
|
|
4157
3653
|
if (platform in platformMap) {
|
|
4158
3654
|
return "".concat(platformMap[platform] || 'Linux', "/").concat(version);
|
|
4159
3655
|
}
|
|
4160
|
-
|
|
4161
3656
|
return null;
|
|
4162
3657
|
}
|
|
4163
|
-
|
|
4164
3658
|
function getUserAgentHeader(sdk, application, integration, feature) {
|
|
4165
3659
|
var headerParts = [];
|
|
4166
|
-
|
|
4167
3660
|
if (application) {
|
|
4168
3661
|
headerParts.push("app ".concat(application));
|
|
4169
3662
|
}
|
|
4170
|
-
|
|
4171
3663
|
if (integration) {
|
|
4172
3664
|
headerParts.push("integration ".concat(integration));
|
|
4173
3665
|
}
|
|
4174
|
-
|
|
4175
3666
|
if (feature) {
|
|
4176
3667
|
headerParts.push('feature ' + feature);
|
|
4177
3668
|
}
|
|
4178
|
-
|
|
4179
3669
|
headerParts.push("sdk ".concat(sdk));
|
|
4180
3670
|
var platform = null;
|
|
4181
|
-
|
|
4182
3671
|
try {
|
|
4183
3672
|
if (isReactNative()) {
|
|
4184
3673
|
platform = getBrowserOS();
|
|
@@ -4193,11 +3682,9 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
4193
3682
|
} catch (e) {
|
|
4194
3683
|
platform = null;
|
|
4195
3684
|
}
|
|
4196
|
-
|
|
4197
3685
|
if (platform) {
|
|
4198
3686
|
headerParts.push("os ".concat(platform));
|
|
4199
3687
|
}
|
|
4200
|
-
|
|
4201
3688
|
return "".concat(headerParts.filter(function (item) {
|
|
4202
3689
|
return item !== '';
|
|
4203
3690
|
}).join('; '), ";");
|
|
@@ -4209,7 +3696,6 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
4209
3696
|
* @param data - Any plain JSON response returned from the API
|
|
4210
3697
|
* @return Enhanced object with toPlainObject method
|
|
4211
3698
|
*/
|
|
4212
|
-
|
|
4213
3699
|
function toPlainObject(data) {
|
|
4214
3700
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
4215
3701
|
// @ts-expect-error
|
|
@@ -4233,18 +3719,17 @@ function toPlainObject(data) {
|
|
|
4233
3719
|
*/
|
|
4234
3720
|
function errorHandler(errorResponse) {
|
|
4235
3721
|
var config = errorResponse.config,
|
|
4236
|
-
|
|
4237
|
-
var errorName;
|
|
3722
|
+
response = errorResponse.response;
|
|
3723
|
+
var errorName;
|
|
4238
3724
|
|
|
3725
|
+
// Obscure the Management token
|
|
4239
3726
|
if (config && config.headers && config.headers['Authorization']) {
|
|
4240
3727
|
var token = "...".concat(config.headers['Authorization'].toString().substr(-5));
|
|
4241
3728
|
config.headers['Authorization'] = "Bearer ".concat(token);
|
|
4242
3729
|
}
|
|
4243
|
-
|
|
4244
3730
|
if (!lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(response) || !lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
4245
3731
|
throw errorResponse;
|
|
4246
3732
|
}
|
|
4247
|
-
|
|
4248
3733
|
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
4249
3734
|
var errorData = {
|
|
4250
3735
|
status: response === null || response === void 0 ? void 0 : response.status,
|
|
@@ -4252,7 +3737,6 @@ function errorHandler(errorResponse) {
|
|
|
4252
3737
|
message: '',
|
|
4253
3738
|
details: {}
|
|
4254
3739
|
};
|
|
4255
|
-
|
|
4256
3740
|
if (lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
4257
3741
|
errorData.request = {
|
|
4258
3742
|
url: config.url,
|
|
@@ -4261,38 +3745,30 @@ function errorHandler(errorResponse) {
|
|
|
4261
3745
|
payloadData: config.data
|
|
4262
3746
|
};
|
|
4263
3747
|
}
|
|
4264
|
-
|
|
4265
3748
|
if (data && lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(data)) {
|
|
4266
3749
|
if ('requestId' in data) {
|
|
4267
3750
|
errorData.requestId = data.requestId || 'UNKNOWN';
|
|
4268
3751
|
}
|
|
4269
|
-
|
|
4270
3752
|
if ('message' in data) {
|
|
4271
3753
|
errorData.message = data.message || '';
|
|
4272
3754
|
}
|
|
4273
|
-
|
|
4274
3755
|
if ('details' in data) {
|
|
4275
3756
|
errorData.details = data.details || {};
|
|
4276
3757
|
}
|
|
4277
|
-
|
|
4278
3758
|
if ('sys' in data) {
|
|
4279
3759
|
if ('id' in data.sys) {
|
|
4280
3760
|
errorName = data.sys.id;
|
|
4281
3761
|
}
|
|
4282
3762
|
}
|
|
4283
3763
|
}
|
|
4284
|
-
|
|
4285
3764
|
var error = new Error();
|
|
4286
3765
|
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
3766
|
try {
|
|
4289
3767
|
error.message = JSON.stringify(errorData, null, ' ');
|
|
4290
3768
|
} catch (_unused) {
|
|
4291
3769
|
var _errorData$message;
|
|
4292
|
-
|
|
4293
3770
|
error.message = (_errorData$message = errorData === null || errorData === void 0 ? void 0 : errorData.message) !== null && _errorData$message !== void 0 ? _errorData$message : '';
|
|
4294
3771
|
}
|
|
4295
|
-
|
|
4296
3772
|
throw error;
|
|
4297
3773
|
}
|
|
4298
3774
|
|
|
@@ -4300,426 +3776,6 @@ function errorHandler(errorResponse) {
|
|
|
4300
3776
|
|
|
4301
3777
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "../node_modules/process/browser.js")))
|
|
4302
3778
|
|
|
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);
|
|
4598
|
-
}
|
|
4599
|
-
|
|
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
|
-
};
|
|
4653
|
-
}
|
|
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
|
-
};
|
|
4693
|
-
}
|
|
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));
|
|
4700
|
-
}
|
|
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({});
|
|
4711
|
-
|
|
4712
|
-
exports.copyStrict = copyStrict;
|
|
4713
|
-
exports.createCopier = createCopier;
|
|
4714
|
-
exports.createStrictCopier = createStrictCopier;
|
|
4715
|
-
exports["default"] = index;
|
|
4716
|
-
|
|
4717
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4718
|
-
|
|
4719
|
-
}));
|
|
4720
|
-
//# sourceMappingURL=index.js.map
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
3779
|
/***/ }),
|
|
4724
3780
|
|
|
4725
3781
|
/***/ "../node_modules/fast-copy/dist/fast-copy.js":
|
|
@@ -9008,6 +8064,7 @@ var stringify = function stringify(
|
|
|
9008
8064
|
object,
|
|
9009
8065
|
prefix,
|
|
9010
8066
|
generateArrayPrefix,
|
|
8067
|
+
commaRoundTrip,
|
|
9011
8068
|
strictNullHandling,
|
|
9012
8069
|
skipNulls,
|
|
9013
8070
|
encoder,
|
|
@@ -9072,7 +8129,7 @@ var stringify = function stringify(
|
|
|
9072
8129
|
for (var i = 0; i < valuesArray.length; ++i) {
|
|
9073
8130
|
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
|
9074
8131
|
}
|
|
9075
|
-
return [formatter(keyValue) + '=' + valuesJoined];
|
|
8132
|
+
return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
|
|
9076
8133
|
}
|
|
9077
8134
|
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
9078
8135
|
}
|
|
@@ -9096,6 +8153,8 @@ var stringify = function stringify(
|
|
|
9096
8153
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
9097
8154
|
}
|
|
9098
8155
|
|
|
8156
|
+
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
|
8157
|
+
|
|
9099
8158
|
for (var j = 0; j < objKeys.length; ++j) {
|
|
9100
8159
|
var key = objKeys[j];
|
|
9101
8160
|
var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
|
@@ -9105,8 +8164,8 @@ var stringify = function stringify(
|
|
|
9105
8164
|
}
|
|
9106
8165
|
|
|
9107
8166
|
var keyPrefix = isArray(obj)
|
|
9108
|
-
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(
|
|
9109
|
-
:
|
|
8167
|
+
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
|
8168
|
+
: adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
|
9110
8169
|
|
|
9111
8170
|
sideChannel.set(object, step);
|
|
9112
8171
|
var valueSideChannel = getSideChannel();
|
|
@@ -9115,6 +8174,7 @@ var stringify = function stringify(
|
|
|
9115
8174
|
value,
|
|
9116
8175
|
keyPrefix,
|
|
9117
8176
|
generateArrayPrefix,
|
|
8177
|
+
commaRoundTrip,
|
|
9118
8178
|
strictNullHandling,
|
|
9119
8179
|
skipNulls,
|
|
9120
8180
|
encoder,
|
|
@@ -9211,6 +8271,10 @@ module.exports = function (object, opts) {
|
|
|
9211
8271
|
}
|
|
9212
8272
|
|
|
9213
8273
|
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
|
8274
|
+
if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
8275
|
+
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
8276
|
+
}
|
|
8277
|
+
var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
|
9214
8278
|
|
|
9215
8279
|
if (!objKeys) {
|
|
9216
8280
|
objKeys = Object.keys(obj);
|
|
@@ -9231,6 +8295,7 @@ module.exports = function (object, opts) {
|
|
|
9231
8295
|
obj[key],
|
|
9232
8296
|
key,
|
|
9233
8297
|
generateArrayPrefix,
|
|
8298
|
+
commaRoundTrip,
|
|
9234
8299
|
options.strictNullHandling,
|
|
9235
8300
|
options.skipNulls,
|
|
9236
8301
|
options.encode ? options.encoder : null,
|
|
@@ -9774,7 +8839,7 @@ function createClient(params) {
|
|
|
9774
8839
|
environment: 'master'
|
|
9775
8840
|
};
|
|
9776
8841
|
const config = _objectSpread(_objectSpread({}, defaultConfig), params);
|
|
9777
|
-
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.
|
|
8842
|
+
const userAgentHeader = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_1__["getUserAgentHeader"])(`contentful.js/${"9.2.9"}`, config.application, config.integration);
|
|
9778
8843
|
config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
9779
8844
|
'Content-Type': 'application/vnd.contentful.delivery.v1+json',
|
|
9780
8845
|
'X-Contentful-User-Agent': userAgentHeader
|