contentful 9.2.8 → 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 +39 -563
- package/dist/contentful.browser.js.map +1 -1
- package/dist/contentful.browser.min.js +3 -3
- package/dist/contentful.node.js +39 -557
- 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 +3 -3
|
@@ -3021,7 +3021,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3021
3021
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "freezeSys", function() { return freezeSys; });
|
|
3022
3022
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUserAgentHeader", function() { return getUserAgentHeader; });
|
|
3023
3023
|
/* 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/
|
|
3024
|
+
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/fast-copy.js");
|
|
3025
3025
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fast_copy__WEBPACK_IMPORTED_MODULE_0__);
|
|
3026
3026
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qs */ "../node_modules/qs/lib/index.js");
|
|
3027
3027
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_1__);
|
|
@@ -3039,17 +3039,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3039
3039
|
|
|
3040
3040
|
function ownKeys(object, enumerableOnly) {
|
|
3041
3041
|
var keys = Object.keys(object);
|
|
3042
|
-
|
|
3043
3042
|
if (Object.getOwnPropertySymbols) {
|
|
3044
3043
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
3045
3044
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
3046
3045
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
3047
3046
|
})), keys.push.apply(keys, symbols);
|
|
3048
3047
|
}
|
|
3049
|
-
|
|
3050
3048
|
return keys;
|
|
3051
3049
|
}
|
|
3052
|
-
|
|
3053
3050
|
function _objectSpread2(target) {
|
|
3054
3051
|
for (var i = 1; i < arguments.length; i++) {
|
|
3055
3052
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -3059,10 +3056,8 @@ function _objectSpread2(target) {
|
|
|
3059
3056
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3060
3057
|
});
|
|
3061
3058
|
}
|
|
3062
|
-
|
|
3063
3059
|
return target;
|
|
3064
3060
|
}
|
|
3065
|
-
|
|
3066
3061
|
function _typeof(obj) {
|
|
3067
3062
|
"@babel/helpers - typeof";
|
|
3068
3063
|
|
|
@@ -3072,61 +3067,47 @@ function _typeof(obj) {
|
|
|
3072
3067
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
3073
3068
|
}, _typeof(obj);
|
|
3074
3069
|
}
|
|
3075
|
-
|
|
3076
3070
|
function _wrapRegExp() {
|
|
3077
3071
|
_wrapRegExp = function (re, groups) {
|
|
3078
3072
|
return new BabelRegExp(re, void 0, groups);
|
|
3079
3073
|
};
|
|
3080
|
-
|
|
3081
3074
|
var _super = RegExp.prototype,
|
|
3082
|
-
|
|
3083
|
-
|
|
3075
|
+
_groups = new WeakMap();
|
|
3084
3076
|
function BabelRegExp(re, flags, groups) {
|
|
3085
3077
|
var _this = new RegExp(re, flags);
|
|
3086
|
-
|
|
3087
3078
|
return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
|
|
3088
3079
|
}
|
|
3089
|
-
|
|
3090
3080
|
function buildGroups(result, re) {
|
|
3091
3081
|
var g = _groups.get(re);
|
|
3092
|
-
|
|
3093
3082
|
return Object.keys(g).reduce(function (groups, name) {
|
|
3094
3083
|
var i = g[name];
|
|
3095
3084
|
if ("number" == typeof i) groups[name] = result[i];else {
|
|
3096
3085
|
for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
|
|
3097
|
-
|
|
3098
3086
|
groups[name] = result[i[k]];
|
|
3099
3087
|
}
|
|
3100
3088
|
return groups;
|
|
3101
3089
|
}, Object.create(null));
|
|
3102
3090
|
}
|
|
3103
|
-
|
|
3104
3091
|
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
|
|
3105
3092
|
var result = _super.exec.call(this, str);
|
|
3106
|
-
|
|
3107
3093
|
return result && (result.groups = buildGroups(result, this)), result;
|
|
3108
3094
|
}, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
|
3109
3095
|
if ("string" == typeof substitution) {
|
|
3110
3096
|
var groups = _groups.get(this);
|
|
3111
|
-
|
|
3112
3097
|
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
|
3113
3098
|
return "$" + groups[name];
|
|
3114
3099
|
}));
|
|
3115
3100
|
}
|
|
3116
|
-
|
|
3117
3101
|
if ("function" == typeof substitution) {
|
|
3118
3102
|
var _this = this;
|
|
3119
|
-
|
|
3120
3103
|
return _super[Symbol.replace].call(this, str, function () {
|
|
3121
3104
|
var args = arguments;
|
|
3122
3105
|
return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
|
|
3123
3106
|
});
|
|
3124
3107
|
}
|
|
3125
|
-
|
|
3126
3108
|
return _super[Symbol.replace].call(this, str, substitution);
|
|
3127
3109
|
}, _wrapRegExp.apply(this, arguments);
|
|
3128
3110
|
}
|
|
3129
|
-
|
|
3130
3111
|
function _defineProperty(obj, key, value) {
|
|
3131
3112
|
if (key in obj) {
|
|
3132
3113
|
Object.defineProperty(obj, key, {
|
|
@@ -3138,15 +3119,12 @@ function _defineProperty(obj, key, value) {
|
|
|
3138
3119
|
} else {
|
|
3139
3120
|
obj[key] = value;
|
|
3140
3121
|
}
|
|
3141
|
-
|
|
3142
3122
|
return obj;
|
|
3143
3123
|
}
|
|
3144
|
-
|
|
3145
3124
|
function _inherits(subClass, superClass) {
|
|
3146
3125
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
3147
3126
|
throw new TypeError("Super expression must either be null or a function");
|
|
3148
3127
|
}
|
|
3149
|
-
|
|
3150
3128
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
3151
3129
|
constructor: {
|
|
3152
3130
|
value: subClass,
|
|
@@ -3159,7 +3137,6 @@ function _inherits(subClass, superClass) {
|
|
|
3159
3137
|
});
|
|
3160
3138
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
3161
3139
|
}
|
|
3162
|
-
|
|
3163
3140
|
function _setPrototypeOf(o, p) {
|
|
3164
3141
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
3165
3142
|
o.__proto__ = p;
|
|
@@ -3167,29 +3144,22 @@ function _setPrototypeOf(o, p) {
|
|
|
3167
3144
|
};
|
|
3168
3145
|
return _setPrototypeOf(o, p);
|
|
3169
3146
|
}
|
|
3170
|
-
|
|
3171
3147
|
function _slicedToArray(arr, i) {
|
|
3172
3148
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
3173
3149
|
}
|
|
3174
|
-
|
|
3175
3150
|
function _arrayWithHoles(arr) {
|
|
3176
3151
|
if (Array.isArray(arr)) return arr;
|
|
3177
3152
|
}
|
|
3178
|
-
|
|
3179
3153
|
function _iterableToArrayLimit(arr, i) {
|
|
3180
3154
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3181
|
-
|
|
3182
3155
|
if (_i == null) return;
|
|
3183
3156
|
var _arr = [];
|
|
3184
3157
|
var _n = true;
|
|
3185
3158
|
var _d = false;
|
|
3186
|
-
|
|
3187
3159
|
var _s, _e;
|
|
3188
|
-
|
|
3189
3160
|
try {
|
|
3190
3161
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
3191
3162
|
_arr.push(_s.value);
|
|
3192
|
-
|
|
3193
3163
|
if (i && _arr.length === i) break;
|
|
3194
3164
|
}
|
|
3195
3165
|
} catch (err) {
|
|
@@ -3202,10 +3172,8 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
3202
3172
|
if (_d) throw _e;
|
|
3203
3173
|
}
|
|
3204
3174
|
}
|
|
3205
|
-
|
|
3206
3175
|
return _arr;
|
|
3207
3176
|
}
|
|
3208
|
-
|
|
3209
3177
|
function _unsupportedIterableToArray(o, minLen) {
|
|
3210
3178
|
if (!o) return;
|
|
3211
3179
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -3214,29 +3182,21 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
3214
3182
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3215
3183
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
3216
3184
|
}
|
|
3217
|
-
|
|
3218
3185
|
function _arrayLikeToArray(arr, len) {
|
|
3219
3186
|
if (len == null || len > arr.length) len = arr.length;
|
|
3220
|
-
|
|
3221
3187
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3222
|
-
|
|
3223
3188
|
return arr2;
|
|
3224
3189
|
}
|
|
3225
|
-
|
|
3226
3190
|
function _nonIterableRest() {
|
|
3227
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.");
|
|
3228
3192
|
}
|
|
3229
|
-
|
|
3230
3193
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
3231
3194
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
3232
|
-
|
|
3233
3195
|
if (!it) {
|
|
3234
3196
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
3235
3197
|
if (it) o = it;
|
|
3236
3198
|
var i = 0;
|
|
3237
|
-
|
|
3238
3199
|
var F = function () {};
|
|
3239
|
-
|
|
3240
3200
|
return {
|
|
3241
3201
|
s: F,
|
|
3242
3202
|
n: function () {
|
|
@@ -3254,13 +3214,11 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
3254
3214
|
f: F
|
|
3255
3215
|
};
|
|
3256
3216
|
}
|
|
3257
|
-
|
|
3258
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.");
|
|
3259
3218
|
}
|
|
3260
|
-
|
|
3261
3219
|
var normalCompletion = true,
|
|
3262
|
-
|
|
3263
|
-
|
|
3220
|
+
didErr = false,
|
|
3221
|
+
err;
|
|
3264
3222
|
return {
|
|
3265
3223
|
s: function () {
|
|
3266
3224
|
it = it.call(o);
|
|
@@ -3310,25 +3268,19 @@ function noop() {
|
|
|
3310
3268
|
var PERCENTAGE_REGEX = /*#__PURE__*/_wrapRegExp(/(\d+)(%)/, {
|
|
3311
3269
|
value: 1
|
|
3312
3270
|
});
|
|
3313
|
-
|
|
3314
3271
|
function calculateLimit(type) {
|
|
3315
3272
|
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 7;
|
|
3316
3273
|
var limit = max;
|
|
3317
|
-
|
|
3318
3274
|
if (PERCENTAGE_REGEX.test(type)) {
|
|
3319
3275
|
var _type$match;
|
|
3320
|
-
|
|
3321
3276
|
var groups = (_type$match = type.match(PERCENTAGE_REGEX)) === null || _type$match === void 0 ? void 0 : _type$match.groups;
|
|
3322
|
-
|
|
3323
3277
|
if (groups && groups.value) {
|
|
3324
3278
|
var percentage = parseInt(groups.value) / 100;
|
|
3325
3279
|
limit = Math.round(max * percentage);
|
|
3326
3280
|
}
|
|
3327
3281
|
}
|
|
3328
|
-
|
|
3329
3282
|
return Math.min(30, Math.max(1, limit));
|
|
3330
3283
|
}
|
|
3331
|
-
|
|
3332
3284
|
function createThrottle(limit, logger) {
|
|
3333
3285
|
logger('info', "Throttle request to ".concat(limit, "/s"));
|
|
3334
3286
|
return p_throttle__WEBPACK_IMPORTED_MODULE_3___default()({
|
|
@@ -3337,11 +3289,10 @@ function createThrottle(limit, logger) {
|
|
|
3337
3289
|
strict: false
|
|
3338
3290
|
});
|
|
3339
3291
|
}
|
|
3340
|
-
|
|
3341
3292
|
var rateLimitThrottle = (function (axiosInstance) {
|
|
3342
3293
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
|
|
3343
3294
|
var _axiosInstance$defaul = axiosInstance.defaults.logHandler,
|
|
3344
|
-
|
|
3295
|
+
logHandler = _axiosInstance$defaul === void 0 ? noop : _axiosInstance$defaul;
|
|
3345
3296
|
var limit = lodash_isstring__WEBPACK_IMPORTED_MODULE_2___default()(type) ? calculateLimit(type) : calculateLimit('auto', type);
|
|
3346
3297
|
var throttle = createThrottle(limit, logHandler);
|
|
3347
3298
|
var isCalculated = false;
|
|
@@ -3356,12 +3307,10 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
3356
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']) {
|
|
3357
3308
|
var rawLimit = parseInt(response.headers['x-contentful-ratelimit-second-limit']);
|
|
3358
3309
|
var nextLimit = calculateLimit(type, rawLimit);
|
|
3359
|
-
|
|
3360
3310
|
if (nextLimit !== limit) {
|
|
3361
3311
|
if (requestInterceptorId) {
|
|
3362
3312
|
axiosInstance.interceptors.request.eject(requestInterceptorId);
|
|
3363
3313
|
}
|
|
3364
|
-
|
|
3365
3314
|
limit = nextLimit;
|
|
3366
3315
|
throttle = createThrottle(nextLimit, logHandler);
|
|
3367
3316
|
requestInterceptorId = axiosInstance.interceptors.request.use(function (config) {
|
|
@@ -3372,10 +3321,8 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
3372
3321
|
return Promise.reject(error);
|
|
3373
3322
|
});
|
|
3374
3323
|
}
|
|
3375
|
-
|
|
3376
3324
|
isCalculated = true;
|
|
3377
3325
|
}
|
|
3378
|
-
|
|
3379
3326
|
return response;
|
|
3380
3327
|
}, function (error) {
|
|
3381
3328
|
return Promise.reject(error);
|
|
@@ -3391,18 +3338,16 @@ var delay = function delay(ms) {
|
|
|
3391
3338
|
setTimeout(resolve, ms);
|
|
3392
3339
|
});
|
|
3393
3340
|
};
|
|
3394
|
-
|
|
3395
3341
|
var defaultWait = function defaultWait(attempts) {
|
|
3396
3342
|
return Math.pow(Math.SQRT2, attempts);
|
|
3397
3343
|
};
|
|
3398
|
-
|
|
3399
3344
|
function rateLimit(instance) {
|
|
3400
3345
|
var maxRetry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
3401
3346
|
var _instance$defaults = instance.defaults,
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
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;
|
|
3406
3351
|
instance.interceptors.request.use(function (config) {
|
|
3407
3352
|
requestLogger(config);
|
|
3408
3353
|
return config;
|
|
@@ -3417,23 +3362,22 @@ function rateLimit(instance) {
|
|
|
3417
3362
|
}, function (error) {
|
|
3418
3363
|
var response = error.response;
|
|
3419
3364
|
var config = error.config;
|
|
3420
|
-
responseLogger(error);
|
|
3421
|
-
|
|
3365
|
+
responseLogger(error);
|
|
3366
|
+
// Do not retry if it is disabled or no request config exists (not an axios error)
|
|
3422
3367
|
if (!config || !instance.defaults.retryOnError) {
|
|
3423
3368
|
return Promise.reject(error);
|
|
3424
|
-
}
|
|
3425
|
-
|
|
3369
|
+
}
|
|
3426
3370
|
|
|
3371
|
+
// Retried already for max attempts
|
|
3427
3372
|
var doneAttempts = config.attempts || 1;
|
|
3428
|
-
|
|
3429
3373
|
if (doneAttempts > maxRetry) {
|
|
3430
3374
|
error.attempts = config.attempts;
|
|
3431
3375
|
return Promise.reject(error);
|
|
3432
3376
|
}
|
|
3433
|
-
|
|
3434
3377
|
var retryErrorType = null;
|
|
3435
|
-
var wait = defaultWait(doneAttempts);
|
|
3378
|
+
var wait = defaultWait(doneAttempts);
|
|
3436
3379
|
|
|
3380
|
+
// Errors without response did not receive anything from the server
|
|
3437
3381
|
if (!response) {
|
|
3438
3382
|
retryErrorType = 'Connection';
|
|
3439
3383
|
} else if (response.status >= 500 && response.status < 600) {
|
|
@@ -3441,30 +3385,29 @@ function rateLimit(instance) {
|
|
|
3441
3385
|
retryErrorType = "Server ".concat(response.status);
|
|
3442
3386
|
} else if (response.status === 429) {
|
|
3443
3387
|
// 429 errors are exceeded rate limit exceptions
|
|
3444
|
-
retryErrorType = 'Rate limit';
|
|
3445
|
-
|
|
3388
|
+
retryErrorType = 'Rate limit';
|
|
3389
|
+
// all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
|
|
3446
3390
|
if (response.headers && error.response.headers['x-contentful-ratelimit-reset']) {
|
|
3447
3391
|
wait = response.headers['x-contentful-ratelimit-reset'];
|
|
3448
3392
|
}
|
|
3449
3393
|
}
|
|
3450
|
-
|
|
3451
3394
|
if (retryErrorType) {
|
|
3452
3395
|
// convert to ms and add jitter
|
|
3453
3396
|
wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
|
|
3454
|
-
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..."));
|
|
3455
3398
|
|
|
3399
|
+
// increase attempts counter
|
|
3456
3400
|
config.attempts = doneAttempts + 1;
|
|
3401
|
+
|
|
3457
3402
|
/* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
|
|
3458
3403
|
to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
|
|
3459
3404
|
requests still use the original http/httpsAgent property */
|
|
3460
|
-
|
|
3461
3405
|
delete config.httpAgent;
|
|
3462
3406
|
delete config.httpsAgent;
|
|
3463
3407
|
return delay(wait).then(function () {
|
|
3464
3408
|
return instance(config);
|
|
3465
3409
|
});
|
|
3466
3410
|
}
|
|
3467
|
-
|
|
3468
3411
|
return Promise.reject(error);
|
|
3469
3412
|
});
|
|
3470
3413
|
}
|
|
@@ -3480,9 +3423,10 @@ function asyncToken(instance, getToken) {
|
|
|
3480
3423
|
});
|
|
3481
3424
|
}
|
|
3482
3425
|
|
|
3426
|
+
// Matches 'sub.host:port' or 'host:port' and extracts hostname and port
|
|
3483
3427
|
// Also enforces toplevel domain specified, no spaces and no protocol
|
|
3484
|
-
|
|
3485
3428
|
var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
3429
|
+
|
|
3486
3430
|
/**
|
|
3487
3431
|
* Create pre configured axios instance
|
|
3488
3432
|
* @private
|
|
@@ -3490,7 +3434,6 @@ var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
|
3490
3434
|
* @param {CreateHttpClientParams} options - Initialization parameters for the HTTP client
|
|
3491
3435
|
* @return {ContentfulAxiosInstance} Initialized axios instance
|
|
3492
3436
|
*/
|
|
3493
|
-
|
|
3494
3437
|
function createHttpClient(axios, options) {
|
|
3495
3438
|
var defaultConfig = {
|
|
3496
3439
|
insecure: false,
|
|
@@ -3505,7 +3448,6 @@ function createHttpClient(axios, options) {
|
|
|
3505
3448
|
console.error(data);
|
|
3506
3449
|
return;
|
|
3507
3450
|
}
|
|
3508
|
-
|
|
3509
3451
|
console.log("[".concat(level, "] ").concat(data));
|
|
3510
3452
|
},
|
|
3511
3453
|
// Passed to axios
|
|
@@ -3520,56 +3462,47 @@ function createHttpClient(axios, options) {
|
|
|
3520
3462
|
maxContentLength: 1073741824,
|
|
3521
3463
|
// 1GB
|
|
3522
3464
|
maxBodyLength: 1073741824 // 1GB
|
|
3523
|
-
|
|
3524
3465
|
};
|
|
3525
3466
|
|
|
3526
3467
|
var config = _objectSpread2(_objectSpread2({}, defaultConfig), options);
|
|
3527
|
-
|
|
3528
3468
|
if (!config.accessToken) {
|
|
3529
3469
|
var missingAccessTokenError = new TypeError('Expected parameter accessToken');
|
|
3530
3470
|
config.logHandler('error', missingAccessTokenError);
|
|
3531
3471
|
throw missingAccessTokenError;
|
|
3532
|
-
}
|
|
3533
|
-
|
|
3472
|
+
}
|
|
3534
3473
|
|
|
3474
|
+
// Construct axios baseURL option
|
|
3535
3475
|
var protocol = config.insecure ? 'http' : 'https';
|
|
3536
3476
|
var space = config.space ? "".concat(config.space, "/") : '';
|
|
3537
3477
|
var hostname = config.defaultHostname;
|
|
3538
3478
|
var port = config.insecure ? 80 : 443;
|
|
3539
|
-
|
|
3540
3479
|
if (config.host && HOST_REGEX.test(config.host)) {
|
|
3541
3480
|
var parsed = config.host.split(':');
|
|
3542
|
-
|
|
3543
3481
|
if (parsed.length === 2) {
|
|
3544
|
-
|
|
3545
3482
|
var _parsed = _slicedToArray(parsed, 2);
|
|
3546
|
-
|
|
3547
3483
|
hostname = _parsed[0];
|
|
3548
3484
|
port = _parsed[1];
|
|
3549
3485
|
} else {
|
|
3550
3486
|
hostname = parsed[0];
|
|
3551
3487
|
}
|
|
3552
|
-
}
|
|
3553
|
-
|
|
3488
|
+
}
|
|
3554
3489
|
|
|
3490
|
+
// Ensure that basePath does start but not end with a slash
|
|
3555
3491
|
if (config.basePath) {
|
|
3556
3492
|
config.basePath = "/".concat(config.basePath.split('/').filter(Boolean).join('/'));
|
|
3557
3493
|
}
|
|
3558
|
-
|
|
3559
3494
|
var baseURL = options.baseURL || "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath, "/spaces/").concat(space);
|
|
3560
|
-
|
|
3561
3495
|
if (!config.headers.Authorization && typeof config.accessToken !== 'function') {
|
|
3562
3496
|
config.headers.Authorization = 'Bearer ' + config.accessToken;
|
|
3563
|
-
}
|
|
3497
|
+
}
|
|
3498
|
+
|
|
3499
|
+
// Set these headers only for node because browsers don't like it when you
|
|
3564
3500
|
// override user-agent or accept-encoding.
|
|
3565
3501
|
// The SDKs should set their own X-Contentful-User-Agent.
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
3502
|
if (isNode()) {
|
|
3569
3503
|
config.headers['user-agent'] = 'node.js/' + getNodeVersion();
|
|
3570
3504
|
config.headers['Accept-Encoding'] = 'gzip';
|
|
3571
3505
|
}
|
|
3572
|
-
|
|
3573
3506
|
var axiosOptions = {
|
|
3574
3507
|
// Axios
|
|
3575
3508
|
baseURL: baseURL,
|
|
@@ -3590,6 +3523,7 @@ function createHttpClient(axios, options) {
|
|
|
3590
3523
|
};
|
|
3591
3524
|
var instance = axios.create(axiosOptions);
|
|
3592
3525
|
instance.httpClientParams = options;
|
|
3526
|
+
|
|
3593
3527
|
/**
|
|
3594
3528
|
* Creates a new axios instance with the same default base parameters as the
|
|
3595
3529
|
* current one, and with any overrides passed to the newParams object
|
|
@@ -3600,41 +3534,34 @@ function createHttpClient(axios, options) {
|
|
|
3600
3534
|
* @param {CreateHttpClientParams} httpClientParams - Initialization parameters for the HTTP client
|
|
3601
3535
|
* @return {ContentfulAxiosInstance} Initialized axios instance
|
|
3602
3536
|
*/
|
|
3603
|
-
|
|
3604
3537
|
instance.cloneWithNewParams = function (newParams) {
|
|
3605
3538
|
return createHttpClient(axios, _objectSpread2(_objectSpread2({}, fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(options)), newParams));
|
|
3606
3539
|
};
|
|
3540
|
+
|
|
3607
3541
|
/**
|
|
3608
3542
|
* Apply interceptors.
|
|
3609
3543
|
* Please note that the order of interceptors is important
|
|
3610
3544
|
*/
|
|
3611
3545
|
|
|
3612
|
-
|
|
3613
3546
|
if (config.onBeforeRequest) {
|
|
3614
3547
|
instance.interceptors.request.use(config.onBeforeRequest);
|
|
3615
3548
|
}
|
|
3616
|
-
|
|
3617
3549
|
if (typeof config.accessToken === 'function') {
|
|
3618
3550
|
asyncToken(instance, config.accessToken);
|
|
3619
3551
|
}
|
|
3620
|
-
|
|
3621
3552
|
if (config.throttle) {
|
|
3622
3553
|
rateLimitThrottle(instance, config.throttle);
|
|
3623
3554
|
}
|
|
3624
|
-
|
|
3625
3555
|
rateLimit(instance, config.retryLimit);
|
|
3626
|
-
|
|
3627
3556
|
if (config.onError) {
|
|
3628
3557
|
instance.interceptors.response.use(function (response) {
|
|
3629
3558
|
return response;
|
|
3630
3559
|
}, config.onError);
|
|
3631
3560
|
}
|
|
3632
|
-
|
|
3633
3561
|
return instance;
|
|
3634
3562
|
}
|
|
3635
3563
|
|
|
3636
3564
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3637
|
-
|
|
3638
3565
|
/**
|
|
3639
3566
|
* Creates request parameters configuration by parsing an existing query object
|
|
3640
3567
|
* @private
|
|
@@ -3657,22 +3584,19 @@ function enforceObjPath(obj, path) {
|
|
|
3657
3584
|
err.message = "Required property ".concat(path, " missing from:\n\n").concat(JSON.stringify(obj), "\n\n");
|
|
3658
3585
|
throw err;
|
|
3659
3586
|
}
|
|
3660
|
-
|
|
3661
3587
|
return true;
|
|
3662
3588
|
}
|
|
3663
3589
|
|
|
3664
3590
|
// copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
|
|
3591
|
+
|
|
3665
3592
|
function deepFreeze(object) {
|
|
3666
3593
|
var propNames = Object.getOwnPropertyNames(object);
|
|
3667
|
-
|
|
3668
3594
|
var _iterator = _createForOfIteratorHelper(propNames),
|
|
3669
|
-
|
|
3670
|
-
|
|
3595
|
+
_step;
|
|
3671
3596
|
try {
|
|
3672
3597
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3673
3598
|
var name = _step.value;
|
|
3674
3599
|
var value = object[name];
|
|
3675
|
-
|
|
3676
3600
|
if (value && _typeof(value) === 'object') {
|
|
3677
3601
|
deepFreeze(value);
|
|
3678
3602
|
}
|
|
@@ -3682,10 +3606,8 @@ function deepFreeze(object) {
|
|
|
3682
3606
|
} finally {
|
|
3683
3607
|
_iterator.f();
|
|
3684
3608
|
}
|
|
3685
|
-
|
|
3686
3609
|
return Object.freeze(object);
|
|
3687
3610
|
}
|
|
3688
|
-
|
|
3689
3611
|
function freezeSys(obj) {
|
|
3690
3612
|
deepFreeze(obj.sys || {});
|
|
3691
3613
|
return obj;
|
|
@@ -3693,18 +3615,15 @@ function freezeSys(obj) {
|
|
|
3693
3615
|
|
|
3694
3616
|
function getBrowserOS() {
|
|
3695
3617
|
var win = getWindow();
|
|
3696
|
-
|
|
3697
3618
|
if (!win) {
|
|
3698
3619
|
return null;
|
|
3699
3620
|
}
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3621
|
+
var userAgent = win.navigator.userAgent;
|
|
3622
|
+
// TODO: platform is deprecated.
|
|
3703
3623
|
var platform = win.navigator.platform;
|
|
3704
3624
|
var macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
|
|
3705
3625
|
var windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
|
|
3706
3626
|
var iosPlatforms = ['iPhone', 'iPad', 'iPod'];
|
|
3707
|
-
|
|
3708
3627
|
if (macosPlatforms.indexOf(platform) !== -1) {
|
|
3709
3628
|
return 'macOS';
|
|
3710
3629
|
} else if (iosPlatforms.indexOf(platform) !== -1) {
|
|
@@ -3716,10 +3635,8 @@ function getBrowserOS() {
|
|
|
3716
3635
|
} else if (/Linux/.test(platform)) {
|
|
3717
3636
|
return 'Linux';
|
|
3718
3637
|
}
|
|
3719
|
-
|
|
3720
3638
|
return null;
|
|
3721
3639
|
}
|
|
3722
|
-
|
|
3723
3640
|
function getNodeOS() {
|
|
3724
3641
|
var platform = process.platform || 'linux';
|
|
3725
3642
|
var version = process.version || '0.0.0';
|
|
@@ -3733,32 +3650,24 @@ function getNodeOS() {
|
|
|
3733
3650
|
sunos: 'Linux',
|
|
3734
3651
|
win32: 'Windows'
|
|
3735
3652
|
};
|
|
3736
|
-
|
|
3737
3653
|
if (platform in platformMap) {
|
|
3738
3654
|
return "".concat(platformMap[platform] || 'Linux', "/").concat(version);
|
|
3739
3655
|
}
|
|
3740
|
-
|
|
3741
3656
|
return null;
|
|
3742
3657
|
}
|
|
3743
|
-
|
|
3744
3658
|
function getUserAgentHeader(sdk, application, integration, feature) {
|
|
3745
3659
|
var headerParts = [];
|
|
3746
|
-
|
|
3747
3660
|
if (application) {
|
|
3748
3661
|
headerParts.push("app ".concat(application));
|
|
3749
3662
|
}
|
|
3750
|
-
|
|
3751
3663
|
if (integration) {
|
|
3752
3664
|
headerParts.push("integration ".concat(integration));
|
|
3753
3665
|
}
|
|
3754
|
-
|
|
3755
3666
|
if (feature) {
|
|
3756
3667
|
headerParts.push('feature ' + feature);
|
|
3757
3668
|
}
|
|
3758
|
-
|
|
3759
3669
|
headerParts.push("sdk ".concat(sdk));
|
|
3760
3670
|
var platform = null;
|
|
3761
|
-
|
|
3762
3671
|
try {
|
|
3763
3672
|
if (isReactNative()) {
|
|
3764
3673
|
platform = getBrowserOS();
|
|
@@ -3773,11 +3682,9 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
3773
3682
|
} catch (e) {
|
|
3774
3683
|
platform = null;
|
|
3775
3684
|
}
|
|
3776
|
-
|
|
3777
3685
|
if (platform) {
|
|
3778
3686
|
headerParts.push("os ".concat(platform));
|
|
3779
3687
|
}
|
|
3780
|
-
|
|
3781
3688
|
return "".concat(headerParts.filter(function (item) {
|
|
3782
3689
|
return item !== '';
|
|
3783
3690
|
}).join('; '), ";");
|
|
@@ -3789,7 +3696,6 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
3789
3696
|
* @param data - Any plain JSON response returned from the API
|
|
3790
3697
|
* @return Enhanced object with toPlainObject method
|
|
3791
3698
|
*/
|
|
3792
|
-
|
|
3793
3699
|
function toPlainObject(data) {
|
|
3794
3700
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3795
3701
|
// @ts-expect-error
|
|
@@ -3813,18 +3719,17 @@ function toPlainObject(data) {
|
|
|
3813
3719
|
*/
|
|
3814
3720
|
function errorHandler(errorResponse) {
|
|
3815
3721
|
var config = errorResponse.config,
|
|
3816
|
-
|
|
3817
|
-
var errorName;
|
|
3722
|
+
response = errorResponse.response;
|
|
3723
|
+
var errorName;
|
|
3818
3724
|
|
|
3725
|
+
// Obscure the Management token
|
|
3819
3726
|
if (config && config.headers && config.headers['Authorization']) {
|
|
3820
3727
|
var token = "...".concat(config.headers['Authorization'].toString().substr(-5));
|
|
3821
3728
|
config.headers['Authorization'] = "Bearer ".concat(token);
|
|
3822
3729
|
}
|
|
3823
|
-
|
|
3824
3730
|
if (!lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(response) || !lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
3825
3731
|
throw errorResponse;
|
|
3826
3732
|
}
|
|
3827
|
-
|
|
3828
3733
|
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
3829
3734
|
var errorData = {
|
|
3830
3735
|
status: response === null || response === void 0 ? void 0 : response.status,
|
|
@@ -3832,7 +3737,6 @@ function errorHandler(errorResponse) {
|
|
|
3832
3737
|
message: '',
|
|
3833
3738
|
details: {}
|
|
3834
3739
|
};
|
|
3835
|
-
|
|
3836
3740
|
if (lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
3837
3741
|
errorData.request = {
|
|
3838
3742
|
url: config.url,
|
|
@@ -3841,38 +3745,30 @@ function errorHandler(errorResponse) {
|
|
|
3841
3745
|
payloadData: config.data
|
|
3842
3746
|
};
|
|
3843
3747
|
}
|
|
3844
|
-
|
|
3845
3748
|
if (data && lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(data)) {
|
|
3846
3749
|
if ('requestId' in data) {
|
|
3847
3750
|
errorData.requestId = data.requestId || 'UNKNOWN';
|
|
3848
3751
|
}
|
|
3849
|
-
|
|
3850
3752
|
if ('message' in data) {
|
|
3851
3753
|
errorData.message = data.message || '';
|
|
3852
3754
|
}
|
|
3853
|
-
|
|
3854
3755
|
if ('details' in data) {
|
|
3855
3756
|
errorData.details = data.details || {};
|
|
3856
3757
|
}
|
|
3857
|
-
|
|
3858
3758
|
if ('sys' in data) {
|
|
3859
3759
|
if ('id' in data.sys) {
|
|
3860
3760
|
errorName = data.sys.id;
|
|
3861
3761
|
}
|
|
3862
3762
|
}
|
|
3863
3763
|
}
|
|
3864
|
-
|
|
3865
3764
|
var error = new Error();
|
|
3866
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);
|
|
3867
|
-
|
|
3868
3766
|
try {
|
|
3869
3767
|
error.message = JSON.stringify(errorData, null, ' ');
|
|
3870
3768
|
} catch (_unused) {
|
|
3871
3769
|
var _errorData$message;
|
|
3872
|
-
|
|
3873
3770
|
error.message = (_errorData$message = errorData === null || errorData === void 0 ? void 0 : errorData.message) !== null && _errorData$message !== void 0 ? _errorData$message : '';
|
|
3874
3771
|
}
|
|
3875
|
-
|
|
3876
3772
|
throw error;
|
|
3877
3773
|
}
|
|
3878
3774
|
|
|
@@ -3880,426 +3776,6 @@ function errorHandler(errorResponse) {
|
|
|
3880
3776
|
|
|
3881
3777
|
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "../node_modules/process/browser.js")))
|
|
3882
3778
|
|
|
3883
|
-
/***/ }),
|
|
3884
|
-
|
|
3885
|
-
/***/ "../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/umd/index.js":
|
|
3886
|
-
/*!************************************************************************************!*\
|
|
3887
|
-
!*** ../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/umd/index.js ***!
|
|
3888
|
-
\************************************************************************************/
|
|
3889
|
-
/*! no static exports found */
|
|
3890
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3891
|
-
|
|
3892
|
-
(function (global, factory) {
|
|
3893
|
-
true ? factory(exports) :
|
|
3894
|
-
undefined;
|
|
3895
|
-
})(this, (function (exports) { 'use strict';
|
|
3896
|
-
|
|
3897
|
-
var toStringFunction = Function.prototype.toString;
|
|
3898
|
-
var create = Object.create;
|
|
3899
|
-
var toStringObject = Object.prototype.toString;
|
|
3900
|
-
/**
|
|
3901
|
-
* @classdesc Fallback cache for when WeakMap is not natively supported
|
|
3902
|
-
*/
|
|
3903
|
-
var LegacyCache = /** @class */ (function () {
|
|
3904
|
-
function LegacyCache() {
|
|
3905
|
-
this._keys = [];
|
|
3906
|
-
this._values = [];
|
|
3907
|
-
}
|
|
3908
|
-
LegacyCache.prototype.has = function (key) {
|
|
3909
|
-
return !!~this._keys.indexOf(key);
|
|
3910
|
-
};
|
|
3911
|
-
LegacyCache.prototype.get = function (key) {
|
|
3912
|
-
return this._values[this._keys.indexOf(key)];
|
|
3913
|
-
};
|
|
3914
|
-
LegacyCache.prototype.set = function (key, value) {
|
|
3915
|
-
this._keys.push(key);
|
|
3916
|
-
this._values.push(value);
|
|
3917
|
-
};
|
|
3918
|
-
return LegacyCache;
|
|
3919
|
-
}());
|
|
3920
|
-
function createCacheLegacy() {
|
|
3921
|
-
return new LegacyCache();
|
|
3922
|
-
}
|
|
3923
|
-
function createCacheModern() {
|
|
3924
|
-
return new WeakMap();
|
|
3925
|
-
}
|
|
3926
|
-
/**
|
|
3927
|
-
* Get a new cache object to prevent circular references.
|
|
3928
|
-
*/
|
|
3929
|
-
var createCache = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
|
|
3930
|
-
/**
|
|
3931
|
-
* Get an empty version of the object with the same prototype it has.
|
|
3932
|
-
*/
|
|
3933
|
-
function getCleanClone(prototype) {
|
|
3934
|
-
if (!prototype) {
|
|
3935
|
-
return create(null);
|
|
3936
|
-
}
|
|
3937
|
-
var Constructor = prototype.constructor;
|
|
3938
|
-
if (Constructor === Object) {
|
|
3939
|
-
return prototype === Object.prototype ? {} : create(prototype);
|
|
3940
|
-
}
|
|
3941
|
-
if (~toStringFunction.call(Constructor).indexOf('[native code]')) {
|
|
3942
|
-
try {
|
|
3943
|
-
return new Constructor();
|
|
3944
|
-
}
|
|
3945
|
-
catch (_a) { }
|
|
3946
|
-
}
|
|
3947
|
-
return create(prototype);
|
|
3948
|
-
}
|
|
3949
|
-
function getRegExpFlagsLegacy(regExp) {
|
|
3950
|
-
var flags = '';
|
|
3951
|
-
if (regExp.global) {
|
|
3952
|
-
flags += 'g';
|
|
3953
|
-
}
|
|
3954
|
-
if (regExp.ignoreCase) {
|
|
3955
|
-
flags += 'i';
|
|
3956
|
-
}
|
|
3957
|
-
if (regExp.multiline) {
|
|
3958
|
-
flags += 'm';
|
|
3959
|
-
}
|
|
3960
|
-
if (regExp.unicode) {
|
|
3961
|
-
flags += 'u';
|
|
3962
|
-
}
|
|
3963
|
-
if (regExp.sticky) {
|
|
3964
|
-
flags += 'y';
|
|
3965
|
-
}
|
|
3966
|
-
return flags;
|
|
3967
|
-
}
|
|
3968
|
-
function getRegExpFlagsModern(regExp) {
|
|
3969
|
-
return regExp.flags;
|
|
3970
|
-
}
|
|
3971
|
-
/**
|
|
3972
|
-
* Get the flags to apply to the copied regexp.
|
|
3973
|
-
*/
|
|
3974
|
-
var getRegExpFlags = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
|
|
3975
|
-
function getTagLegacy(value) {
|
|
3976
|
-
var type = toStringObject.call(value);
|
|
3977
|
-
return type.substring(8, type.length - 1);
|
|
3978
|
-
}
|
|
3979
|
-
function getTagModern(value) {
|
|
3980
|
-
return value[Symbol.toStringTag] || getTagLegacy(value);
|
|
3981
|
-
}
|
|
3982
|
-
/**
|
|
3983
|
-
* Get the tag of the value passed, so that the correct copier can be used.
|
|
3984
|
-
*/
|
|
3985
|
-
var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
|
|
3986
|
-
|
|
3987
|
-
var defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
3988
|
-
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
|
|
3989
|
-
var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols === 'function';
|
|
3990
|
-
function getStrictPropertiesModern(object) {
|
|
3991
|
-
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
3992
|
-
}
|
|
3993
|
-
/**
|
|
3994
|
-
* Get the properites used when copying objects strictly. This includes both keys and symbols.
|
|
3995
|
-
*/
|
|
3996
|
-
var getStrictProperties = SUPPORTS_SYMBOL
|
|
3997
|
-
? getStrictPropertiesModern
|
|
3998
|
-
: getOwnPropertyNames;
|
|
3999
|
-
/**
|
|
4000
|
-
* Striclty copy all properties contained on the object.
|
|
4001
|
-
*/
|
|
4002
|
-
function copyOwnPropertiesStrict(value, clone, state) {
|
|
4003
|
-
var properties = getStrictProperties(value);
|
|
4004
|
-
for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
|
|
4005
|
-
property = properties[index];
|
|
4006
|
-
if (property === 'callee' || property === 'caller') {
|
|
4007
|
-
continue;
|
|
4008
|
-
}
|
|
4009
|
-
descriptor = getOwnPropertyDescriptor(value, property);
|
|
4010
|
-
if (!descriptor) {
|
|
4011
|
-
// In extra edge cases where the property descriptor cannot be retrived, fall back to
|
|
4012
|
-
// the loose assignment.
|
|
4013
|
-
clone[property] = state.copier(value[property], state);
|
|
4014
|
-
continue;
|
|
4015
|
-
}
|
|
4016
|
-
// Only clone the value if actually a value, not a getter / setter.
|
|
4017
|
-
if (!descriptor.get && !descriptor.set) {
|
|
4018
|
-
descriptor.value = state.copier(descriptor.value, state);
|
|
4019
|
-
}
|
|
4020
|
-
try {
|
|
4021
|
-
defineProperty(clone, property, descriptor);
|
|
4022
|
-
}
|
|
4023
|
-
catch (error) {
|
|
4024
|
-
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
|
|
4025
|
-
clone[property] = descriptor.value;
|
|
4026
|
-
}
|
|
4027
|
-
}
|
|
4028
|
-
return clone;
|
|
4029
|
-
}
|
|
4030
|
-
/**
|
|
4031
|
-
* Deeply copy the indexed values in the array.
|
|
4032
|
-
*/
|
|
4033
|
-
function copyArrayLoose(array, state) {
|
|
4034
|
-
var clone = new state.Constructor();
|
|
4035
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
4036
|
-
state.cache.set(array, clone);
|
|
4037
|
-
for (var index = 0, length_2 = array.length; index < length_2; ++index) {
|
|
4038
|
-
clone[index] = state.copier(array[index], state);
|
|
4039
|
-
}
|
|
4040
|
-
return clone;
|
|
4041
|
-
}
|
|
4042
|
-
/**
|
|
4043
|
-
* Deeply copy the indexed values in the array, as well as any custom properties.
|
|
4044
|
-
*/
|
|
4045
|
-
function copyArrayStrict(array, state) {
|
|
4046
|
-
var clone = new state.Constructor();
|
|
4047
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
4048
|
-
state.cache.set(array, clone);
|
|
4049
|
-
return copyOwnPropertiesStrict(array, clone, state);
|
|
4050
|
-
}
|
|
4051
|
-
/**
|
|
4052
|
-
* Copy the contents of the ArrayBuffer.
|
|
4053
|
-
*/
|
|
4054
|
-
function copyArrayBuffer(arrayBuffer, _state) {
|
|
4055
|
-
return arrayBuffer.slice(0);
|
|
4056
|
-
}
|
|
4057
|
-
/**
|
|
4058
|
-
* Create a new Blob with the contents of the original.
|
|
4059
|
-
*/
|
|
4060
|
-
function copyBlob(blob, _state) {
|
|
4061
|
-
return blob.slice(0, blob.size, blob.type);
|
|
4062
|
-
}
|
|
4063
|
-
/**
|
|
4064
|
-
* Create a new DataView with the contents of the original.
|
|
4065
|
-
*/
|
|
4066
|
-
function copyDataView(dataView, state) {
|
|
4067
|
-
return new state.Constructor(copyArrayBuffer(dataView.buffer));
|
|
4068
|
-
}
|
|
4069
|
-
/**
|
|
4070
|
-
* Create a new Date based on the time of the original.
|
|
4071
|
-
*/
|
|
4072
|
-
function copyDate(date, state) {
|
|
4073
|
-
return new state.Constructor(date.getTime());
|
|
4074
|
-
}
|
|
4075
|
-
/**
|
|
4076
|
-
* Deeply copy the keys and values of the original.
|
|
4077
|
-
*/
|
|
4078
|
-
function copyMapLoose(map, state) {
|
|
4079
|
-
var clone = new state.Constructor();
|
|
4080
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
4081
|
-
state.cache.set(map, clone);
|
|
4082
|
-
map.forEach(function (value, key) {
|
|
4083
|
-
clone.set(key, state.copier(value, state));
|
|
4084
|
-
});
|
|
4085
|
-
return clone;
|
|
4086
|
-
}
|
|
4087
|
-
/**
|
|
4088
|
-
* Deeply copy the keys and values of the original, as well as any custom properties.
|
|
4089
|
-
*/
|
|
4090
|
-
function copyMapStrict(map, state) {
|
|
4091
|
-
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
|
|
4092
|
-
}
|
|
4093
|
-
function copyObjectLooseLegacy(object, state) {
|
|
4094
|
-
var clone = getCleanClone(state.prototype);
|
|
4095
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
4096
|
-
state.cache.set(object, clone);
|
|
4097
|
-
for (var key in object) {
|
|
4098
|
-
if (hasOwnProperty.call(object, key)) {
|
|
4099
|
-
clone[key] = state.copier(object[key], state);
|
|
4100
|
-
}
|
|
4101
|
-
}
|
|
4102
|
-
return clone;
|
|
4103
|
-
}
|
|
4104
|
-
function copyObjectLooseModern(object, state) {
|
|
4105
|
-
var clone = getCleanClone(state.prototype);
|
|
4106
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
4107
|
-
state.cache.set(object, clone);
|
|
4108
|
-
for (var key in object) {
|
|
4109
|
-
if (hasOwnProperty.call(object, key)) {
|
|
4110
|
-
clone[key] = state.copier(object[key], state);
|
|
4111
|
-
}
|
|
4112
|
-
}
|
|
4113
|
-
var symbols = getOwnPropertySymbols(object);
|
|
4114
|
-
for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
|
|
4115
|
-
symbol = symbols[index];
|
|
4116
|
-
if (propertyIsEnumerable.call(object, symbol)) {
|
|
4117
|
-
clone[symbol] = state.copier(object[symbol], state);
|
|
4118
|
-
}
|
|
4119
|
-
}
|
|
4120
|
-
return clone;
|
|
4121
|
-
}
|
|
4122
|
-
/**
|
|
4123
|
-
* Deeply copy the properties (keys and symbols) and values of the original.
|
|
4124
|
-
*/
|
|
4125
|
-
var copyObjectLoose = SUPPORTS_SYMBOL
|
|
4126
|
-
? copyObjectLooseModern
|
|
4127
|
-
: copyObjectLooseLegacy;
|
|
4128
|
-
/**
|
|
4129
|
-
* Deeply copy the properties (keys and symbols) and values of the original, as well
|
|
4130
|
-
* as any hidden or non-enumerable properties.
|
|
4131
|
-
*/
|
|
4132
|
-
function copyObjectStrict(object, state) {
|
|
4133
|
-
var clone = getCleanClone(state.prototype);
|
|
4134
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
4135
|
-
state.cache.set(object, clone);
|
|
4136
|
-
return copyOwnPropertiesStrict(object, clone, state);
|
|
4137
|
-
}
|
|
4138
|
-
/**
|
|
4139
|
-
* Create a new primitive wrapper from the value of the original.
|
|
4140
|
-
*/
|
|
4141
|
-
function copyPrimitiveWrapper(primitiveObject, state) {
|
|
4142
|
-
return new state.Constructor(primitiveObject.valueOf());
|
|
4143
|
-
}
|
|
4144
|
-
/**
|
|
4145
|
-
* Create a new RegExp based on the value and flags of the original.
|
|
4146
|
-
*/
|
|
4147
|
-
function copyRegExp(regExp, state) {
|
|
4148
|
-
var clone = new state.Constructor(regExp.source, getRegExpFlags(regExp));
|
|
4149
|
-
clone.lastIndex = regExp.lastIndex;
|
|
4150
|
-
return clone;
|
|
4151
|
-
}
|
|
4152
|
-
/**
|
|
4153
|
-
* Return the original value (an identity function).
|
|
4154
|
-
*
|
|
4155
|
-
* @note
|
|
4156
|
-
* THis is used for objects that cannot be copied, such as WeakMap.
|
|
4157
|
-
*/
|
|
4158
|
-
function copySelf(value, _state) {
|
|
4159
|
-
return value;
|
|
4160
|
-
}
|
|
4161
|
-
/**
|
|
4162
|
-
* Deeply copy the values of the original.
|
|
4163
|
-
*/
|
|
4164
|
-
function copySetLoose(set, state) {
|
|
4165
|
-
var clone = new state.Constructor();
|
|
4166
|
-
// set in the cache immediately to be able to reuse the object recursively
|
|
4167
|
-
state.cache.set(set, clone);
|
|
4168
|
-
set.forEach(function (value) {
|
|
4169
|
-
clone.add(state.copier(value, state));
|
|
4170
|
-
});
|
|
4171
|
-
return clone;
|
|
4172
|
-
}
|
|
4173
|
-
/**
|
|
4174
|
-
* Deeply copy the values of the original, as well as any custom properties.
|
|
4175
|
-
*/
|
|
4176
|
-
function copySetStrict(set, state) {
|
|
4177
|
-
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
|
|
4178
|
-
}
|
|
4179
|
-
|
|
4180
|
-
var isArray = Array.isArray;
|
|
4181
|
-
var assign = Object.assign, getPrototypeOf = Object.getPrototypeOf;
|
|
4182
|
-
var DEFAULT_LOOSE_OPTIONS = {
|
|
4183
|
-
array: copyArrayLoose,
|
|
4184
|
-
arrayBuffer: copyArrayBuffer,
|
|
4185
|
-
blob: copyBlob,
|
|
4186
|
-
dataView: copyDataView,
|
|
4187
|
-
date: copyDate,
|
|
4188
|
-
error: copySelf,
|
|
4189
|
-
map: copyMapLoose,
|
|
4190
|
-
object: copyObjectLoose,
|
|
4191
|
-
regExp: copyRegExp,
|
|
4192
|
-
set: copySetLoose,
|
|
4193
|
-
};
|
|
4194
|
-
var DEFAULT_STRICT_OPTIONS = assign({}, DEFAULT_LOOSE_OPTIONS, {
|
|
4195
|
-
array: copyArrayStrict,
|
|
4196
|
-
map: copyMapStrict,
|
|
4197
|
-
object: copyObjectStrict,
|
|
4198
|
-
set: copySetStrict,
|
|
4199
|
-
});
|
|
4200
|
-
/**
|
|
4201
|
-
* Get the copiers used for each specific object tag.
|
|
4202
|
-
*/
|
|
4203
|
-
function getTagSpecificCopiers(options) {
|
|
4204
|
-
return {
|
|
4205
|
-
Arguments: options.object,
|
|
4206
|
-
Array: options.array,
|
|
4207
|
-
ArrayBuffer: options.arrayBuffer,
|
|
4208
|
-
Blob: options.blob,
|
|
4209
|
-
Boolean: copyPrimitiveWrapper,
|
|
4210
|
-
DataView: options.dataView,
|
|
4211
|
-
Date: options.date,
|
|
4212
|
-
Error: options.error,
|
|
4213
|
-
Float32Array: options.arrayBuffer,
|
|
4214
|
-
Float64Array: options.arrayBuffer,
|
|
4215
|
-
Int8Array: options.arrayBuffer,
|
|
4216
|
-
Int16Array: options.arrayBuffer,
|
|
4217
|
-
Int32Array: options.arrayBuffer,
|
|
4218
|
-
Map: options.map,
|
|
4219
|
-
Number: copyPrimitiveWrapper,
|
|
4220
|
-
Object: options.object,
|
|
4221
|
-
Promise: copySelf,
|
|
4222
|
-
RegExp: options.regExp,
|
|
4223
|
-
Set: options.set,
|
|
4224
|
-
String: copyPrimitiveWrapper,
|
|
4225
|
-
WeakMap: copySelf,
|
|
4226
|
-
WeakSet: copySelf,
|
|
4227
|
-
Uint8Array: options.arrayBuffer,
|
|
4228
|
-
Uint8ClampedArray: options.arrayBuffer,
|
|
4229
|
-
Uint16Array: options.arrayBuffer,
|
|
4230
|
-
Uint32Array: options.arrayBuffer,
|
|
4231
|
-
Uint64Array: options.arrayBuffer,
|
|
4232
|
-
};
|
|
4233
|
-
}
|
|
4234
|
-
/**
|
|
4235
|
-
* Create a custom copier based on the object-specific copy methods passed.
|
|
4236
|
-
*/
|
|
4237
|
-
function createCopier(options) {
|
|
4238
|
-
var normalizedOptions = assign({}, DEFAULT_LOOSE_OPTIONS, options);
|
|
4239
|
-
var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
|
|
4240
|
-
var array = tagSpecificCopiers.Array, object = tagSpecificCopiers.Object;
|
|
4241
|
-
function copier(value, state) {
|
|
4242
|
-
state.prototype = state.Constructor = undefined;
|
|
4243
|
-
if (!value || typeof value !== 'object') {
|
|
4244
|
-
return value;
|
|
4245
|
-
}
|
|
4246
|
-
if (state.cache.has(value)) {
|
|
4247
|
-
return state.cache.get(value);
|
|
4248
|
-
}
|
|
4249
|
-
state.prototype = value.__proto__ || getPrototypeOf(value);
|
|
4250
|
-
state.Constructor = state.prototype && state.prototype.constructor;
|
|
4251
|
-
// plain objects
|
|
4252
|
-
if (!state.Constructor || state.Constructor === Object) {
|
|
4253
|
-
return object(value, state);
|
|
4254
|
-
}
|
|
4255
|
-
// arrays
|
|
4256
|
-
if (isArray(value)) {
|
|
4257
|
-
return array(value, state);
|
|
4258
|
-
}
|
|
4259
|
-
var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
|
|
4260
|
-
if (tagSpecificCopier) {
|
|
4261
|
-
return tagSpecificCopier(value, state);
|
|
4262
|
-
}
|
|
4263
|
-
return typeof value.then === 'function' ? value : object(value, state);
|
|
4264
|
-
}
|
|
4265
|
-
return function copy(value) {
|
|
4266
|
-
return copier(value, {
|
|
4267
|
-
Constructor: undefined,
|
|
4268
|
-
cache: createCache(),
|
|
4269
|
-
copier: copier,
|
|
4270
|
-
prototype: undefined,
|
|
4271
|
-
});
|
|
4272
|
-
};
|
|
4273
|
-
}
|
|
4274
|
-
/**
|
|
4275
|
-
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
|
|
4276
|
-
* same internals as `copyStrict`.
|
|
4277
|
-
*/
|
|
4278
|
-
function createStrictCopier(options) {
|
|
4279
|
-
return createCopier(assign({}, DEFAULT_STRICT_OPTIONS, options));
|
|
4280
|
-
}
|
|
4281
|
-
/**
|
|
4282
|
-
* Copy an value deeply as much as possible, where strict recreation of object properties
|
|
4283
|
-
* are maintained. All properties (including non-enumerable ones) are copied with their
|
|
4284
|
-
* original property descriptors on both objects and arrays.
|
|
4285
|
-
*/
|
|
4286
|
-
var copyStrict = createStrictCopier({});
|
|
4287
|
-
/**
|
|
4288
|
-
* Copy an value deeply as much as possible.
|
|
4289
|
-
*/
|
|
4290
|
-
var index = createCopier({});
|
|
4291
|
-
|
|
4292
|
-
exports.copyStrict = copyStrict;
|
|
4293
|
-
exports.createCopier = createCopier;
|
|
4294
|
-
exports.createStrictCopier = createStrictCopier;
|
|
4295
|
-
exports["default"] = index;
|
|
4296
|
-
|
|
4297
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4298
|
-
|
|
4299
|
-
}));
|
|
4300
|
-
//# sourceMappingURL=index.js.map
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
3779
|
/***/ }),
|
|
4304
3780
|
|
|
4305
3781
|
/***/ "../node_modules/fast-copy/dist/fast-copy.js":
|
|
@@ -9363,7 +8839,7 @@ function createClient(params) {
|
|
|
9363
8839
|
environment: 'master'
|
|
9364
8840
|
};
|
|
9365
8841
|
const config = _objectSpread(_objectSpread({}, defaultConfig), params);
|
|
9366
|
-
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);
|
|
9367
8843
|
config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
|
|
9368
8844
|
'Content-Type': 'application/vnd.contentful.delivery.v1+json',
|
|
9369
8845
|
'X-Contentful-User-Agent': userAgentHeader
|