contentful-management 10.21.2 → 10.21.3
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-management.browser.js +460 -156
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +2 -2
- package/dist/contentful-management.node.js +455 -156
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +2 -2
- package/dist/es-modules/contentful-management.js +1 -1
- package/package.json +1 -1
|
@@ -2855,7 +2855,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2855
2855
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "freezeSys", function() { return freezeSys; });
|
|
2856
2856
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUserAgentHeader", function() { return getUserAgentHeader; });
|
|
2857
2857
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toPlainObject", function() { return toPlainObject; });
|
|
2858
|
-
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/fast-copy.js");
|
|
2858
|
+
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/fast-copy.js");
|
|
2859
2859
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fast_copy__WEBPACK_IMPORTED_MODULE_0__);
|
|
2860
2860
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qs */ "../node_modules/qs/lib/index.js");
|
|
2861
2861
|
/* harmony import */ var qs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qs__WEBPACK_IMPORTED_MODULE_1__);
|
|
@@ -2873,17 +2873,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2873
2873
|
|
|
2874
2874
|
function ownKeys(object, enumerableOnly) {
|
|
2875
2875
|
var keys = Object.keys(object);
|
|
2876
|
-
|
|
2877
2876
|
if (Object.getOwnPropertySymbols) {
|
|
2878
2877
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
2879
2878
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
2880
2879
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
2881
2880
|
})), keys.push.apply(keys, symbols);
|
|
2882
2881
|
}
|
|
2883
|
-
|
|
2884
2882
|
return keys;
|
|
2885
2883
|
}
|
|
2886
|
-
|
|
2887
2884
|
function _objectSpread2(target) {
|
|
2888
2885
|
for (var i = 1; i < arguments.length; i++) {
|
|
2889
2886
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -2893,10 +2890,8 @@ function _objectSpread2(target) {
|
|
|
2893
2890
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2894
2891
|
});
|
|
2895
2892
|
}
|
|
2896
|
-
|
|
2897
2893
|
return target;
|
|
2898
2894
|
}
|
|
2899
|
-
|
|
2900
2895
|
function _typeof(obj) {
|
|
2901
2896
|
"@babel/helpers - typeof";
|
|
2902
2897
|
|
|
@@ -2906,55 +2901,47 @@ function _typeof(obj) {
|
|
|
2906
2901
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2907
2902
|
}, _typeof(obj);
|
|
2908
2903
|
}
|
|
2909
|
-
|
|
2910
2904
|
function _wrapRegExp() {
|
|
2911
2905
|
_wrapRegExp = function (re, groups) {
|
|
2912
2906
|
return new BabelRegExp(re, void 0, groups);
|
|
2913
2907
|
};
|
|
2914
|
-
|
|
2915
2908
|
var _super = RegExp.prototype,
|
|
2916
|
-
|
|
2917
|
-
|
|
2909
|
+
_groups = new WeakMap();
|
|
2918
2910
|
function BabelRegExp(re, flags, groups) {
|
|
2919
2911
|
var _this = new RegExp(re, flags);
|
|
2920
|
-
|
|
2921
2912
|
return _groups.set(_this, groups || _groups.get(re)), _setPrototypeOf(_this, BabelRegExp.prototype);
|
|
2922
2913
|
}
|
|
2923
|
-
|
|
2924
2914
|
function buildGroups(result, re) {
|
|
2925
2915
|
var g = _groups.get(re);
|
|
2926
|
-
|
|
2927
2916
|
return Object.keys(g).reduce(function (groups, name) {
|
|
2928
|
-
|
|
2917
|
+
var i = g[name];
|
|
2918
|
+
if ("number" == typeof i) groups[name] = result[i];else {
|
|
2919
|
+
for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++;
|
|
2920
|
+
groups[name] = result[i[k]];
|
|
2921
|
+
}
|
|
2922
|
+
return groups;
|
|
2929
2923
|
}, Object.create(null));
|
|
2930
2924
|
}
|
|
2931
|
-
|
|
2932
2925
|
return _inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) {
|
|
2933
2926
|
var result = _super.exec.call(this, str);
|
|
2934
|
-
|
|
2935
2927
|
return result && (result.groups = buildGroups(result, this)), result;
|
|
2936
2928
|
}, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
|
2937
2929
|
if ("string" == typeof substitution) {
|
|
2938
2930
|
var groups = _groups.get(this);
|
|
2939
|
-
|
|
2940
2931
|
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
|
2941
2932
|
return "$" + groups[name];
|
|
2942
2933
|
}));
|
|
2943
2934
|
}
|
|
2944
|
-
|
|
2945
2935
|
if ("function" == typeof substitution) {
|
|
2946
2936
|
var _this = this;
|
|
2947
|
-
|
|
2948
2937
|
return _super[Symbol.replace].call(this, str, function () {
|
|
2949
2938
|
var args = arguments;
|
|
2950
2939
|
return "object" != typeof args[args.length - 1] && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args);
|
|
2951
2940
|
});
|
|
2952
2941
|
}
|
|
2953
|
-
|
|
2954
2942
|
return _super[Symbol.replace].call(this, str, substitution);
|
|
2955
2943
|
}, _wrapRegExp.apply(this, arguments);
|
|
2956
2944
|
}
|
|
2957
|
-
|
|
2958
2945
|
function _defineProperty(obj, key, value) {
|
|
2959
2946
|
if (key in obj) {
|
|
2960
2947
|
Object.defineProperty(obj, key, {
|
|
@@ -2966,15 +2953,12 @@ function _defineProperty(obj, key, value) {
|
|
|
2966
2953
|
} else {
|
|
2967
2954
|
obj[key] = value;
|
|
2968
2955
|
}
|
|
2969
|
-
|
|
2970
2956
|
return obj;
|
|
2971
2957
|
}
|
|
2972
|
-
|
|
2973
2958
|
function _inherits(subClass, superClass) {
|
|
2974
2959
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
2975
2960
|
throw new TypeError("Super expression must either be null or a function");
|
|
2976
2961
|
}
|
|
2977
|
-
|
|
2978
2962
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
2979
2963
|
constructor: {
|
|
2980
2964
|
value: subClass,
|
|
@@ -2987,38 +2971,29 @@ function _inherits(subClass, superClass) {
|
|
|
2987
2971
|
});
|
|
2988
2972
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
2989
2973
|
}
|
|
2990
|
-
|
|
2991
2974
|
function _setPrototypeOf(o, p) {
|
|
2992
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
2975
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
2993
2976
|
o.__proto__ = p;
|
|
2994
2977
|
return o;
|
|
2995
2978
|
};
|
|
2996
|
-
|
|
2997
2979
|
return _setPrototypeOf(o, p);
|
|
2998
2980
|
}
|
|
2999
|
-
|
|
3000
2981
|
function _slicedToArray(arr, i) {
|
|
3001
2982
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
3002
2983
|
}
|
|
3003
|
-
|
|
3004
2984
|
function _arrayWithHoles(arr) {
|
|
3005
2985
|
if (Array.isArray(arr)) return arr;
|
|
3006
2986
|
}
|
|
3007
|
-
|
|
3008
2987
|
function _iterableToArrayLimit(arr, i) {
|
|
3009
2988
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3010
|
-
|
|
3011
2989
|
if (_i == null) return;
|
|
3012
2990
|
var _arr = [];
|
|
3013
2991
|
var _n = true;
|
|
3014
2992
|
var _d = false;
|
|
3015
|
-
|
|
3016
2993
|
var _s, _e;
|
|
3017
|
-
|
|
3018
2994
|
try {
|
|
3019
2995
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
3020
2996
|
_arr.push(_s.value);
|
|
3021
|
-
|
|
3022
2997
|
if (i && _arr.length === i) break;
|
|
3023
2998
|
}
|
|
3024
2999
|
} catch (err) {
|
|
@@ -3031,10 +3006,8 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
3031
3006
|
if (_d) throw _e;
|
|
3032
3007
|
}
|
|
3033
3008
|
}
|
|
3034
|
-
|
|
3035
3009
|
return _arr;
|
|
3036
3010
|
}
|
|
3037
|
-
|
|
3038
3011
|
function _unsupportedIterableToArray(o, minLen) {
|
|
3039
3012
|
if (!o) return;
|
|
3040
3013
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -3043,29 +3016,21 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
3043
3016
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3044
3017
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
3045
3018
|
}
|
|
3046
|
-
|
|
3047
3019
|
function _arrayLikeToArray(arr, len) {
|
|
3048
3020
|
if (len == null || len > arr.length) len = arr.length;
|
|
3049
|
-
|
|
3050
3021
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3051
|
-
|
|
3052
3022
|
return arr2;
|
|
3053
3023
|
}
|
|
3054
|
-
|
|
3055
3024
|
function _nonIterableRest() {
|
|
3056
3025
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3057
3026
|
}
|
|
3058
|
-
|
|
3059
3027
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
3060
3028
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
3061
|
-
|
|
3062
3029
|
if (!it) {
|
|
3063
3030
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
3064
3031
|
if (it) o = it;
|
|
3065
3032
|
var i = 0;
|
|
3066
|
-
|
|
3067
3033
|
var F = function () {};
|
|
3068
|
-
|
|
3069
3034
|
return {
|
|
3070
3035
|
s: F,
|
|
3071
3036
|
n: function () {
|
|
@@ -3083,13 +3048,11 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
3083
3048
|
f: F
|
|
3084
3049
|
};
|
|
3085
3050
|
}
|
|
3086
|
-
|
|
3087
3051
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3088
3052
|
}
|
|
3089
|
-
|
|
3090
3053
|
var normalCompletion = true,
|
|
3091
|
-
|
|
3092
|
-
|
|
3054
|
+
didErr = false,
|
|
3055
|
+
err;
|
|
3093
3056
|
return {
|
|
3094
3057
|
s: function () {
|
|
3095
3058
|
it = it.call(o);
|
|
@@ -3139,25 +3102,19 @@ function noop() {
|
|
|
3139
3102
|
var PERCENTAGE_REGEX = /*#__PURE__*/_wrapRegExp(/(\d+)(%)/, {
|
|
3140
3103
|
value: 1
|
|
3141
3104
|
});
|
|
3142
|
-
|
|
3143
3105
|
function calculateLimit(type) {
|
|
3144
3106
|
var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 7;
|
|
3145
3107
|
var limit = max;
|
|
3146
|
-
|
|
3147
3108
|
if (PERCENTAGE_REGEX.test(type)) {
|
|
3148
3109
|
var _type$match;
|
|
3149
|
-
|
|
3150
3110
|
var groups = (_type$match = type.match(PERCENTAGE_REGEX)) === null || _type$match === void 0 ? void 0 : _type$match.groups;
|
|
3151
|
-
|
|
3152
3111
|
if (groups && groups.value) {
|
|
3153
3112
|
var percentage = parseInt(groups.value) / 100;
|
|
3154
3113
|
limit = Math.round(max * percentage);
|
|
3155
3114
|
}
|
|
3156
3115
|
}
|
|
3157
|
-
|
|
3158
3116
|
return Math.min(30, Math.max(1, limit));
|
|
3159
3117
|
}
|
|
3160
|
-
|
|
3161
3118
|
function createThrottle(limit, logger) {
|
|
3162
3119
|
logger('info', "Throttle request to ".concat(limit, "/s"));
|
|
3163
3120
|
return p_throttle__WEBPACK_IMPORTED_MODULE_3___default()({
|
|
@@ -3166,11 +3123,10 @@ function createThrottle(limit, logger) {
|
|
|
3166
3123
|
strict: false
|
|
3167
3124
|
});
|
|
3168
3125
|
}
|
|
3169
|
-
|
|
3170
3126
|
var rateLimitThrottle = (function (axiosInstance) {
|
|
3171
3127
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'auto';
|
|
3172
3128
|
var _axiosInstance$defaul = axiosInstance.defaults.logHandler,
|
|
3173
|
-
|
|
3129
|
+
logHandler = _axiosInstance$defaul === void 0 ? noop : _axiosInstance$defaul;
|
|
3174
3130
|
var limit = lodash_isstring__WEBPACK_IMPORTED_MODULE_2___default()(type) ? calculateLimit(type) : calculateLimit('auto', type);
|
|
3175
3131
|
var throttle = createThrottle(limit, logHandler);
|
|
3176
3132
|
var isCalculated = false;
|
|
@@ -3185,12 +3141,10 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
3185
3141
|
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']) {
|
|
3186
3142
|
var rawLimit = parseInt(response.headers['x-contentful-ratelimit-second-limit']);
|
|
3187
3143
|
var nextLimit = calculateLimit(type, rawLimit);
|
|
3188
|
-
|
|
3189
3144
|
if (nextLimit !== limit) {
|
|
3190
3145
|
if (requestInterceptorId) {
|
|
3191
3146
|
axiosInstance.interceptors.request.eject(requestInterceptorId);
|
|
3192
3147
|
}
|
|
3193
|
-
|
|
3194
3148
|
limit = nextLimit;
|
|
3195
3149
|
throttle = createThrottle(nextLimit, logHandler);
|
|
3196
3150
|
requestInterceptorId = axiosInstance.interceptors.request.use(function (config) {
|
|
@@ -3201,10 +3155,8 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
3201
3155
|
return Promise.reject(error);
|
|
3202
3156
|
});
|
|
3203
3157
|
}
|
|
3204
|
-
|
|
3205
3158
|
isCalculated = true;
|
|
3206
3159
|
}
|
|
3207
|
-
|
|
3208
3160
|
return response;
|
|
3209
3161
|
}, function (error) {
|
|
3210
3162
|
return Promise.reject(error);
|
|
@@ -3220,18 +3172,16 @@ var delay = function delay(ms) {
|
|
|
3220
3172
|
setTimeout(resolve, ms);
|
|
3221
3173
|
});
|
|
3222
3174
|
};
|
|
3223
|
-
|
|
3224
3175
|
var defaultWait = function defaultWait(attempts) {
|
|
3225
3176
|
return Math.pow(Math.SQRT2, attempts);
|
|
3226
3177
|
};
|
|
3227
|
-
|
|
3228
3178
|
function rateLimit(instance) {
|
|
3229
3179
|
var maxRetry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
3230
3180
|
var _instance$defaults = instance.defaults,
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3181
|
+
_instance$defaults$re = _instance$defaults.responseLogger,
|
|
3182
|
+
responseLogger = _instance$defaults$re === void 0 ? noop : _instance$defaults$re,
|
|
3183
|
+
_instance$defaults$re2 = _instance$defaults.requestLogger,
|
|
3184
|
+
requestLogger = _instance$defaults$re2 === void 0 ? noop : _instance$defaults$re2;
|
|
3235
3185
|
instance.interceptors.request.use(function (config) {
|
|
3236
3186
|
requestLogger(config);
|
|
3237
3187
|
return config;
|
|
@@ -3246,23 +3196,22 @@ function rateLimit(instance) {
|
|
|
3246
3196
|
}, function (error) {
|
|
3247
3197
|
var response = error.response;
|
|
3248
3198
|
var config = error.config;
|
|
3249
|
-
responseLogger(error);
|
|
3250
|
-
|
|
3199
|
+
responseLogger(error);
|
|
3200
|
+
// Do not retry if it is disabled or no request config exists (not an axios error)
|
|
3251
3201
|
if (!config || !instance.defaults.retryOnError) {
|
|
3252
3202
|
return Promise.reject(error);
|
|
3253
|
-
}
|
|
3254
|
-
|
|
3203
|
+
}
|
|
3255
3204
|
|
|
3205
|
+
// Retried already for max attempts
|
|
3256
3206
|
var doneAttempts = config.attempts || 1;
|
|
3257
|
-
|
|
3258
3207
|
if (doneAttempts > maxRetry) {
|
|
3259
3208
|
error.attempts = config.attempts;
|
|
3260
3209
|
return Promise.reject(error);
|
|
3261
3210
|
}
|
|
3262
|
-
|
|
3263
3211
|
var retryErrorType = null;
|
|
3264
|
-
var wait = defaultWait(doneAttempts);
|
|
3212
|
+
var wait = defaultWait(doneAttempts);
|
|
3265
3213
|
|
|
3214
|
+
// Errors without response did not receive anything from the server
|
|
3266
3215
|
if (!response) {
|
|
3267
3216
|
retryErrorType = 'Connection';
|
|
3268
3217
|
} else if (response.status >= 500 && response.status < 600) {
|
|
@@ -3270,30 +3219,29 @@ function rateLimit(instance) {
|
|
|
3270
3219
|
retryErrorType = "Server ".concat(response.status);
|
|
3271
3220
|
} else if (response.status === 429) {
|
|
3272
3221
|
// 429 errors are exceeded rate limit exceptions
|
|
3273
|
-
retryErrorType = 'Rate limit';
|
|
3274
|
-
|
|
3222
|
+
retryErrorType = 'Rate limit';
|
|
3223
|
+
// all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
|
|
3275
3224
|
if (response.headers && error.response.headers['x-contentful-ratelimit-reset']) {
|
|
3276
3225
|
wait = response.headers['x-contentful-ratelimit-reset'];
|
|
3277
3226
|
}
|
|
3278
3227
|
}
|
|
3279
|
-
|
|
3280
3228
|
if (retryErrorType) {
|
|
3281
3229
|
// convert to ms and add jitter
|
|
3282
3230
|
wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
|
|
3283
|
-
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
|
|
3231
|
+
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
|
|
3284
3232
|
|
|
3233
|
+
// increase attempts counter
|
|
3285
3234
|
config.attempts = doneAttempts + 1;
|
|
3235
|
+
|
|
3286
3236
|
/* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
|
|
3287
3237
|
to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
|
|
3288
3238
|
requests still use the original http/httpsAgent property */
|
|
3289
|
-
|
|
3290
3239
|
delete config.httpAgent;
|
|
3291
3240
|
delete config.httpsAgent;
|
|
3292
3241
|
return delay(wait).then(function () {
|
|
3293
3242
|
return instance(config);
|
|
3294
3243
|
});
|
|
3295
3244
|
}
|
|
3296
|
-
|
|
3297
3245
|
return Promise.reject(error);
|
|
3298
3246
|
});
|
|
3299
3247
|
}
|
|
@@ -3309,9 +3257,10 @@ function asyncToken(instance, getToken) {
|
|
|
3309
3257
|
});
|
|
3310
3258
|
}
|
|
3311
3259
|
|
|
3260
|
+
// Matches 'sub.host:port' or 'host:port' and extracts hostname and port
|
|
3312
3261
|
// Also enforces toplevel domain specified, no spaces and no protocol
|
|
3313
|
-
|
|
3314
3262
|
var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
3263
|
+
|
|
3315
3264
|
/**
|
|
3316
3265
|
* Create pre configured axios instance
|
|
3317
3266
|
* @private
|
|
@@ -3319,7 +3268,6 @@ var HOST_REGEX = /^(?!\w+:\/\/)([^\s:]+\.?[^\s:]+)(?::(\d+))?(?!:)$/;
|
|
|
3319
3268
|
* @param {CreateHttpClientParams} options - Initialization parameters for the HTTP client
|
|
3320
3269
|
* @return {ContentfulAxiosInstance} Initialized axios instance
|
|
3321
3270
|
*/
|
|
3322
|
-
|
|
3323
3271
|
function createHttpClient(axios, options) {
|
|
3324
3272
|
var defaultConfig = {
|
|
3325
3273
|
insecure: false,
|
|
@@ -3334,7 +3282,6 @@ function createHttpClient(axios, options) {
|
|
|
3334
3282
|
console.error(data);
|
|
3335
3283
|
return;
|
|
3336
3284
|
}
|
|
3337
|
-
|
|
3338
3285
|
console.log("[".concat(level, "] ").concat(data));
|
|
3339
3286
|
},
|
|
3340
3287
|
// Passed to axios
|
|
@@ -3349,56 +3296,47 @@ function createHttpClient(axios, options) {
|
|
|
3349
3296
|
maxContentLength: 1073741824,
|
|
3350
3297
|
// 1GB
|
|
3351
3298
|
maxBodyLength: 1073741824 // 1GB
|
|
3352
|
-
|
|
3353
3299
|
};
|
|
3354
3300
|
|
|
3355
3301
|
var config = _objectSpread2(_objectSpread2({}, defaultConfig), options);
|
|
3356
|
-
|
|
3357
3302
|
if (!config.accessToken) {
|
|
3358
3303
|
var missingAccessTokenError = new TypeError('Expected parameter accessToken');
|
|
3359
3304
|
config.logHandler('error', missingAccessTokenError);
|
|
3360
3305
|
throw missingAccessTokenError;
|
|
3361
|
-
}
|
|
3362
|
-
|
|
3306
|
+
}
|
|
3363
3307
|
|
|
3308
|
+
// Construct axios baseURL option
|
|
3364
3309
|
var protocol = config.insecure ? 'http' : 'https';
|
|
3365
3310
|
var space = config.space ? "".concat(config.space, "/") : '';
|
|
3366
3311
|
var hostname = config.defaultHostname;
|
|
3367
3312
|
var port = config.insecure ? 80 : 443;
|
|
3368
|
-
|
|
3369
3313
|
if (config.host && HOST_REGEX.test(config.host)) {
|
|
3370
3314
|
var parsed = config.host.split(':');
|
|
3371
|
-
|
|
3372
3315
|
if (parsed.length === 2) {
|
|
3373
|
-
|
|
3374
3316
|
var _parsed = _slicedToArray(parsed, 2);
|
|
3375
|
-
|
|
3376
3317
|
hostname = _parsed[0];
|
|
3377
3318
|
port = _parsed[1];
|
|
3378
3319
|
} else {
|
|
3379
3320
|
hostname = parsed[0];
|
|
3380
3321
|
}
|
|
3381
|
-
}
|
|
3382
|
-
|
|
3322
|
+
}
|
|
3383
3323
|
|
|
3324
|
+
// Ensure that basePath does start but not end with a slash
|
|
3384
3325
|
if (config.basePath) {
|
|
3385
3326
|
config.basePath = "/".concat(config.basePath.split('/').filter(Boolean).join('/'));
|
|
3386
3327
|
}
|
|
3387
|
-
|
|
3388
3328
|
var baseURL = options.baseURL || "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath, "/spaces/").concat(space);
|
|
3389
|
-
|
|
3390
3329
|
if (!config.headers.Authorization && typeof config.accessToken !== 'function') {
|
|
3391
3330
|
config.headers.Authorization = 'Bearer ' + config.accessToken;
|
|
3392
|
-
}
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3333
|
+
// Set these headers only for node because browsers don't like it when you
|
|
3393
3334
|
// override user-agent or accept-encoding.
|
|
3394
3335
|
// The SDKs should set their own X-Contentful-User-Agent.
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
3336
|
if (isNode()) {
|
|
3398
3337
|
config.headers['user-agent'] = 'node.js/' + getNodeVersion();
|
|
3399
3338
|
config.headers['Accept-Encoding'] = 'gzip';
|
|
3400
3339
|
}
|
|
3401
|
-
|
|
3402
3340
|
var axiosOptions = {
|
|
3403
3341
|
// Axios
|
|
3404
3342
|
baseURL: baseURL,
|
|
@@ -3419,6 +3357,7 @@ function createHttpClient(axios, options) {
|
|
|
3419
3357
|
};
|
|
3420
3358
|
var instance = axios.create(axiosOptions);
|
|
3421
3359
|
instance.httpClientParams = options;
|
|
3360
|
+
|
|
3422
3361
|
/**
|
|
3423
3362
|
* Creates a new axios instance with the same default base parameters as the
|
|
3424
3363
|
* current one, and with any overrides passed to the newParams object
|
|
@@ -3429,41 +3368,34 @@ function createHttpClient(axios, options) {
|
|
|
3429
3368
|
* @param {CreateHttpClientParams} httpClientParams - Initialization parameters for the HTTP client
|
|
3430
3369
|
* @return {ContentfulAxiosInstance} Initialized axios instance
|
|
3431
3370
|
*/
|
|
3432
|
-
|
|
3433
3371
|
instance.cloneWithNewParams = function (newParams) {
|
|
3434
3372
|
return createHttpClient(axios, _objectSpread2(_objectSpread2({}, fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(options)), newParams));
|
|
3435
3373
|
};
|
|
3374
|
+
|
|
3436
3375
|
/**
|
|
3437
3376
|
* Apply interceptors.
|
|
3438
3377
|
* Please note that the order of interceptors is important
|
|
3439
3378
|
*/
|
|
3440
3379
|
|
|
3441
|
-
|
|
3442
3380
|
if (config.onBeforeRequest) {
|
|
3443
3381
|
instance.interceptors.request.use(config.onBeforeRequest);
|
|
3444
3382
|
}
|
|
3445
|
-
|
|
3446
3383
|
if (typeof config.accessToken === 'function') {
|
|
3447
3384
|
asyncToken(instance, config.accessToken);
|
|
3448
3385
|
}
|
|
3449
|
-
|
|
3450
3386
|
if (config.throttle) {
|
|
3451
3387
|
rateLimitThrottle(instance, config.throttle);
|
|
3452
3388
|
}
|
|
3453
|
-
|
|
3454
3389
|
rateLimit(instance, config.retryLimit);
|
|
3455
|
-
|
|
3456
3390
|
if (config.onError) {
|
|
3457
3391
|
instance.interceptors.response.use(function (response) {
|
|
3458
3392
|
return response;
|
|
3459
3393
|
}, config.onError);
|
|
3460
3394
|
}
|
|
3461
|
-
|
|
3462
3395
|
return instance;
|
|
3463
3396
|
}
|
|
3464
3397
|
|
|
3465
3398
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3466
|
-
|
|
3467
3399
|
/**
|
|
3468
3400
|
* Creates request parameters configuration by parsing an existing query object
|
|
3469
3401
|
* @private
|
|
@@ -3486,22 +3418,19 @@ function enforceObjPath(obj, path) {
|
|
|
3486
3418
|
err.message = "Required property ".concat(path, " missing from:\n\n").concat(JSON.stringify(obj), "\n\n");
|
|
3487
3419
|
throw err;
|
|
3488
3420
|
}
|
|
3489
|
-
|
|
3490
3421
|
return true;
|
|
3491
3422
|
}
|
|
3492
3423
|
|
|
3493
3424
|
// copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
|
|
3425
|
+
|
|
3494
3426
|
function deepFreeze(object) {
|
|
3495
3427
|
var propNames = Object.getOwnPropertyNames(object);
|
|
3496
|
-
|
|
3497
3428
|
var _iterator = _createForOfIteratorHelper(propNames),
|
|
3498
|
-
|
|
3499
|
-
|
|
3429
|
+
_step;
|
|
3500
3430
|
try {
|
|
3501
3431
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3502
3432
|
var name = _step.value;
|
|
3503
3433
|
var value = object[name];
|
|
3504
|
-
|
|
3505
3434
|
if (value && _typeof(value) === 'object') {
|
|
3506
3435
|
deepFreeze(value);
|
|
3507
3436
|
}
|
|
@@ -3511,10 +3440,8 @@ function deepFreeze(object) {
|
|
|
3511
3440
|
} finally {
|
|
3512
3441
|
_iterator.f();
|
|
3513
3442
|
}
|
|
3514
|
-
|
|
3515
3443
|
return Object.freeze(object);
|
|
3516
3444
|
}
|
|
3517
|
-
|
|
3518
3445
|
function freezeSys(obj) {
|
|
3519
3446
|
deepFreeze(obj.sys || {});
|
|
3520
3447
|
return obj;
|
|
@@ -3522,18 +3449,15 @@ function freezeSys(obj) {
|
|
|
3522
3449
|
|
|
3523
3450
|
function getBrowserOS() {
|
|
3524
3451
|
var win = getWindow();
|
|
3525
|
-
|
|
3526
3452
|
if (!win) {
|
|
3527
3453
|
return null;
|
|
3528
3454
|
}
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3455
|
+
var userAgent = win.navigator.userAgent;
|
|
3456
|
+
// TODO: platform is deprecated.
|
|
3532
3457
|
var platform = win.navigator.platform;
|
|
3533
3458
|
var macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
|
|
3534
3459
|
var windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
|
|
3535
3460
|
var iosPlatforms = ['iPhone', 'iPad', 'iPod'];
|
|
3536
|
-
|
|
3537
3461
|
if (macosPlatforms.indexOf(platform) !== -1) {
|
|
3538
3462
|
return 'macOS';
|
|
3539
3463
|
} else if (iosPlatforms.indexOf(platform) !== -1) {
|
|
@@ -3545,10 +3469,8 @@ function getBrowserOS() {
|
|
|
3545
3469
|
} else if (/Linux/.test(platform)) {
|
|
3546
3470
|
return 'Linux';
|
|
3547
3471
|
}
|
|
3548
|
-
|
|
3549
3472
|
return null;
|
|
3550
3473
|
}
|
|
3551
|
-
|
|
3552
3474
|
function getNodeOS() {
|
|
3553
3475
|
var platform = process.platform || 'linux';
|
|
3554
3476
|
var version = process.version || '0.0.0';
|
|
@@ -3562,32 +3484,24 @@ function getNodeOS() {
|
|
|
3562
3484
|
sunos: 'Linux',
|
|
3563
3485
|
win32: 'Windows'
|
|
3564
3486
|
};
|
|
3565
|
-
|
|
3566
3487
|
if (platform in platformMap) {
|
|
3567
3488
|
return "".concat(platformMap[platform] || 'Linux', "/").concat(version);
|
|
3568
3489
|
}
|
|
3569
|
-
|
|
3570
3490
|
return null;
|
|
3571
3491
|
}
|
|
3572
|
-
|
|
3573
3492
|
function getUserAgentHeader(sdk, application, integration, feature) {
|
|
3574
3493
|
var headerParts = [];
|
|
3575
|
-
|
|
3576
3494
|
if (application) {
|
|
3577
3495
|
headerParts.push("app ".concat(application));
|
|
3578
3496
|
}
|
|
3579
|
-
|
|
3580
3497
|
if (integration) {
|
|
3581
3498
|
headerParts.push("integration ".concat(integration));
|
|
3582
3499
|
}
|
|
3583
|
-
|
|
3584
3500
|
if (feature) {
|
|
3585
3501
|
headerParts.push('feature ' + feature);
|
|
3586
3502
|
}
|
|
3587
|
-
|
|
3588
3503
|
headerParts.push("sdk ".concat(sdk));
|
|
3589
3504
|
var platform = null;
|
|
3590
|
-
|
|
3591
3505
|
try {
|
|
3592
3506
|
if (isReactNative()) {
|
|
3593
3507
|
platform = getBrowserOS();
|
|
@@ -3602,11 +3516,9 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
3602
3516
|
} catch (e) {
|
|
3603
3517
|
platform = null;
|
|
3604
3518
|
}
|
|
3605
|
-
|
|
3606
3519
|
if (platform) {
|
|
3607
3520
|
headerParts.push("os ".concat(platform));
|
|
3608
3521
|
}
|
|
3609
|
-
|
|
3610
3522
|
return "".concat(headerParts.filter(function (item) {
|
|
3611
3523
|
return item !== '';
|
|
3612
3524
|
}).join('; '), ";");
|
|
@@ -3618,7 +3530,6 @@ function getUserAgentHeader(sdk, application, integration, feature) {
|
|
|
3618
3530
|
* @param data - Any plain JSON response returned from the API
|
|
3619
3531
|
* @return Enhanced object with toPlainObject method
|
|
3620
3532
|
*/
|
|
3621
|
-
|
|
3622
3533
|
function toPlainObject(data) {
|
|
3623
3534
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3624
3535
|
// @ts-expect-error
|
|
@@ -3642,18 +3553,17 @@ function toPlainObject(data) {
|
|
|
3642
3553
|
*/
|
|
3643
3554
|
function errorHandler(errorResponse) {
|
|
3644
3555
|
var config = errorResponse.config,
|
|
3645
|
-
|
|
3646
|
-
var errorName;
|
|
3556
|
+
response = errorResponse.response;
|
|
3557
|
+
var errorName;
|
|
3647
3558
|
|
|
3559
|
+
// Obscure the Management token
|
|
3648
3560
|
if (config && config.headers && config.headers['Authorization']) {
|
|
3649
3561
|
var token = "...".concat(config.headers['Authorization'].toString().substr(-5));
|
|
3650
3562
|
config.headers['Authorization'] = "Bearer ".concat(token);
|
|
3651
3563
|
}
|
|
3652
|
-
|
|
3653
3564
|
if (!lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(response) || !lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
3654
3565
|
throw errorResponse;
|
|
3655
3566
|
}
|
|
3656
|
-
|
|
3657
3567
|
var data = response === null || response === void 0 ? void 0 : response.data;
|
|
3658
3568
|
var errorData = {
|
|
3659
3569
|
status: response === null || response === void 0 ? void 0 : response.status,
|
|
@@ -3661,7 +3571,6 @@ function errorHandler(errorResponse) {
|
|
|
3661
3571
|
message: '',
|
|
3662
3572
|
details: {}
|
|
3663
3573
|
};
|
|
3664
|
-
|
|
3665
3574
|
if (lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(config)) {
|
|
3666
3575
|
errorData.request = {
|
|
3667
3576
|
url: config.url,
|
|
@@ -3670,38 +3579,30 @@ function errorHandler(errorResponse) {
|
|
|
3670
3579
|
payloadData: config.data
|
|
3671
3580
|
};
|
|
3672
3581
|
}
|
|
3673
|
-
|
|
3674
3582
|
if (data && lodash_isplainobject__WEBPACK_IMPORTED_MODULE_4___default()(data)) {
|
|
3675
3583
|
if ('requestId' in data) {
|
|
3676
3584
|
errorData.requestId = data.requestId || 'UNKNOWN';
|
|
3677
3585
|
}
|
|
3678
|
-
|
|
3679
3586
|
if ('message' in data) {
|
|
3680
3587
|
errorData.message = data.message || '';
|
|
3681
3588
|
}
|
|
3682
|
-
|
|
3683
3589
|
if ('details' in data) {
|
|
3684
3590
|
errorData.details = data.details || {};
|
|
3685
3591
|
}
|
|
3686
|
-
|
|
3687
3592
|
if ('sys' in data) {
|
|
3688
3593
|
if ('id' in data.sys) {
|
|
3689
3594
|
errorName = data.sys.id;
|
|
3690
3595
|
}
|
|
3691
3596
|
}
|
|
3692
3597
|
}
|
|
3693
|
-
|
|
3694
3598
|
var error = new Error();
|
|
3695
3599
|
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);
|
|
3696
|
-
|
|
3697
3600
|
try {
|
|
3698
3601
|
error.message = JSON.stringify(errorData, null, ' ');
|
|
3699
3602
|
} catch (_unused) {
|
|
3700
3603
|
var _errorData$message;
|
|
3701
|
-
|
|
3702
3604
|
error.message = (_errorData$message = errorData === null || errorData === void 0 ? void 0 : errorData.message) !== null && _errorData$message !== void 0 ? _errorData$message : '';
|
|
3703
3605
|
}
|
|
3704
|
-
|
|
3705
3606
|
throw error;
|
|
3706
3607
|
}
|
|
3707
3608
|
|
|
@@ -3711,6 +3612,372 @@ function errorHandler(errorResponse) {
|
|
|
3711
3612
|
|
|
3712
3613
|
/***/ }),
|
|
3713
3614
|
|
|
3615
|
+
/***/ "../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/fast-copy.js":
|
|
3616
|
+
/*!************************************************************************************!*\
|
|
3617
|
+
!*** ../node_modules/contentful-sdk-core/node_modules/fast-copy/dist/fast-copy.js ***!
|
|
3618
|
+
\************************************************************************************/
|
|
3619
|
+
/*! no static exports found */
|
|
3620
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3621
|
+
|
|
3622
|
+
/* WEBPACK VAR INJECTION */(function(global) {(function (global, factory) {
|
|
3623
|
+
true ? module.exports = factory() :
|
|
3624
|
+
undefined;
|
|
3625
|
+
})(this, (function () { 'use strict';
|
|
3626
|
+
|
|
3627
|
+
var toStringFunction = Function.prototype.toString;
|
|
3628
|
+
var create = Object.create, defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols, getPrototypeOf$1 = Object.getPrototypeOf;
|
|
3629
|
+
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
|
|
3630
|
+
var SYMBOL_PROPERTIES = typeof getOwnPropertySymbols === 'function';
|
|
3631
|
+
var WEAK_MAP = typeof WeakMap === 'function';
|
|
3632
|
+
/**
|
|
3633
|
+
* @function createCache
|
|
3634
|
+
*
|
|
3635
|
+
* @description
|
|
3636
|
+
* get a new cache object to prevent circular references
|
|
3637
|
+
*
|
|
3638
|
+
* @returns the new cache object
|
|
3639
|
+
*/
|
|
3640
|
+
var createCache = (function () {
|
|
3641
|
+
if (WEAK_MAP) {
|
|
3642
|
+
return function () { return new WeakMap(); };
|
|
3643
|
+
}
|
|
3644
|
+
var Cache = /** @class */ (function () {
|
|
3645
|
+
function Cache() {
|
|
3646
|
+
this._keys = [];
|
|
3647
|
+
this._values = [];
|
|
3648
|
+
}
|
|
3649
|
+
Cache.prototype.has = function (key) {
|
|
3650
|
+
return !!~this._keys.indexOf(key);
|
|
3651
|
+
};
|
|
3652
|
+
Cache.prototype.get = function (key) {
|
|
3653
|
+
return this._values[this._keys.indexOf(key)];
|
|
3654
|
+
};
|
|
3655
|
+
Cache.prototype.set = function (key, value) {
|
|
3656
|
+
this._keys.push(key);
|
|
3657
|
+
this._values.push(value);
|
|
3658
|
+
};
|
|
3659
|
+
return Cache;
|
|
3660
|
+
}());
|
|
3661
|
+
return function () { return new Cache(); };
|
|
3662
|
+
})();
|
|
3663
|
+
/**
|
|
3664
|
+
* @function getCleanClone
|
|
3665
|
+
*
|
|
3666
|
+
* @description
|
|
3667
|
+
* get an empty version of the object with the same prototype it has
|
|
3668
|
+
*
|
|
3669
|
+
* @param object the object to build a clean clone from
|
|
3670
|
+
* @param realm the realm the object resides in
|
|
3671
|
+
* @returns the empty cloned object
|
|
3672
|
+
*/
|
|
3673
|
+
var getCleanClone = function (object, realm) {
|
|
3674
|
+
var prototype = object.__proto__ || getPrototypeOf$1(object);
|
|
3675
|
+
if (!prototype) {
|
|
3676
|
+
return create(null);
|
|
3677
|
+
}
|
|
3678
|
+
var Constructor = prototype.constructor;
|
|
3679
|
+
if (Constructor === realm.Object) {
|
|
3680
|
+
return prototype === realm.Object.prototype ? {} : create(prototype);
|
|
3681
|
+
}
|
|
3682
|
+
if (~toStringFunction.call(Constructor).indexOf('[native code]')) {
|
|
3683
|
+
try {
|
|
3684
|
+
return new Constructor();
|
|
3685
|
+
}
|
|
3686
|
+
catch (_a) { }
|
|
3687
|
+
}
|
|
3688
|
+
return create(prototype);
|
|
3689
|
+
};
|
|
3690
|
+
/**
|
|
3691
|
+
* @function getObjectCloneLoose
|
|
3692
|
+
*
|
|
3693
|
+
* @description
|
|
3694
|
+
* get a copy of the object based on loose rules, meaning all enumerable keys
|
|
3695
|
+
* and symbols are copied, but property descriptors are not considered
|
|
3696
|
+
*
|
|
3697
|
+
* @param object the object to clone
|
|
3698
|
+
* @param realm the realm the object resides in
|
|
3699
|
+
* @param handleCopy the function that handles copying the object
|
|
3700
|
+
* @returns the copied object
|
|
3701
|
+
*/
|
|
3702
|
+
var getObjectCloneLoose = function (object, realm, handleCopy, cache) {
|
|
3703
|
+
var clone = getCleanClone(object, realm);
|
|
3704
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3705
|
+
cache.set(object, clone);
|
|
3706
|
+
for (var key in object) {
|
|
3707
|
+
if (hasOwnProperty.call(object, key)) {
|
|
3708
|
+
clone[key] = handleCopy(object[key], cache);
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
if (SYMBOL_PROPERTIES) {
|
|
3712
|
+
var symbols = getOwnPropertySymbols(object);
|
|
3713
|
+
for (var index = 0, length_1 = symbols.length, symbol = void 0; index < length_1; ++index) {
|
|
3714
|
+
symbol = symbols[index];
|
|
3715
|
+
if (propertyIsEnumerable.call(object, symbol)) {
|
|
3716
|
+
clone[symbol] = handleCopy(object[symbol], cache);
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
}
|
|
3720
|
+
return clone;
|
|
3721
|
+
};
|
|
3722
|
+
/**
|
|
3723
|
+
* @function getObjectCloneStrict
|
|
3724
|
+
*
|
|
3725
|
+
* @description
|
|
3726
|
+
* get a copy of the object based on strict rules, meaning all keys and symbols
|
|
3727
|
+
* are copied based on the original property descriptors
|
|
3728
|
+
*
|
|
3729
|
+
* @param object the object to clone
|
|
3730
|
+
* @param realm the realm the object resides in
|
|
3731
|
+
* @param handleCopy the function that handles copying the object
|
|
3732
|
+
* @returns the copied object
|
|
3733
|
+
*/
|
|
3734
|
+
var getObjectCloneStrict = function (object, realm, handleCopy, cache) {
|
|
3735
|
+
var clone = getCleanClone(object, realm);
|
|
3736
|
+
// set in the cache immediately to be able to reuse the object recursively
|
|
3737
|
+
cache.set(object, clone);
|
|
3738
|
+
var properties = SYMBOL_PROPERTIES
|
|
3739
|
+
? getOwnPropertyNames(object).concat(getOwnPropertySymbols(object))
|
|
3740
|
+
: getOwnPropertyNames(object);
|
|
3741
|
+
for (var index = 0, length_2 = properties.length, property = void 0, descriptor = void 0; index < length_2; ++index) {
|
|
3742
|
+
property = properties[index];
|
|
3743
|
+
if (property !== 'callee' && property !== 'caller') {
|
|
3744
|
+
descriptor = getOwnPropertyDescriptor(object, property);
|
|
3745
|
+
if (descriptor) {
|
|
3746
|
+
// Only clone the value if actually a value, not a getter / setter.
|
|
3747
|
+
if (!descriptor.get && !descriptor.set) {
|
|
3748
|
+
descriptor.value = handleCopy(object[property], cache);
|
|
3749
|
+
}
|
|
3750
|
+
try {
|
|
3751
|
+
defineProperty(clone, property, descriptor);
|
|
3752
|
+
}
|
|
3753
|
+
catch (error) {
|
|
3754
|
+
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
|
|
3755
|
+
clone[property] = descriptor.value;
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3758
|
+
else {
|
|
3759
|
+
// In extra edge cases where the property descriptor cannot be retrived, fall back to
|
|
3760
|
+
// the loose assignment.
|
|
3761
|
+
clone[property] = handleCopy(object[property], cache);
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
}
|
|
3765
|
+
return clone;
|
|
3766
|
+
};
|
|
3767
|
+
/**
|
|
3768
|
+
* @function getRegExpFlags
|
|
3769
|
+
*
|
|
3770
|
+
* @description
|
|
3771
|
+
* get the flags to apply to the copied regexp
|
|
3772
|
+
*
|
|
3773
|
+
* @param regExp the regexp to get the flags of
|
|
3774
|
+
* @returns the flags for the regexp
|
|
3775
|
+
*/
|
|
3776
|
+
var getRegExpFlags = function (regExp) {
|
|
3777
|
+
var flags = '';
|
|
3778
|
+
if (regExp.global) {
|
|
3779
|
+
flags += 'g';
|
|
3780
|
+
}
|
|
3781
|
+
if (regExp.ignoreCase) {
|
|
3782
|
+
flags += 'i';
|
|
3783
|
+
}
|
|
3784
|
+
if (regExp.multiline) {
|
|
3785
|
+
flags += 'm';
|
|
3786
|
+
}
|
|
3787
|
+
if (regExp.unicode) {
|
|
3788
|
+
flags += 'u';
|
|
3789
|
+
}
|
|
3790
|
+
if (regExp.sticky) {
|
|
3791
|
+
flags += 'y';
|
|
3792
|
+
}
|
|
3793
|
+
return flags;
|
|
3794
|
+
};
|
|
3795
|
+
|
|
3796
|
+
// utils
|
|
3797
|
+
var isArray = Array.isArray;
|
|
3798
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
3799
|
+
var GLOBAL_THIS = (function () {
|
|
3800
|
+
if (typeof globalThis !== 'undefined') {
|
|
3801
|
+
return globalThis;
|
|
3802
|
+
}
|
|
3803
|
+
if (typeof self !== 'undefined') {
|
|
3804
|
+
return self;
|
|
3805
|
+
}
|
|
3806
|
+
if (typeof window !== 'undefined') {
|
|
3807
|
+
return window;
|
|
3808
|
+
}
|
|
3809
|
+
if (typeof global !== 'undefined') {
|
|
3810
|
+
return global;
|
|
3811
|
+
}
|
|
3812
|
+
if (console && console.error) {
|
|
3813
|
+
console.error('Unable to locate global object, returning "this".');
|
|
3814
|
+
}
|
|
3815
|
+
return this;
|
|
3816
|
+
})();
|
|
3817
|
+
/**
|
|
3818
|
+
* @function copy
|
|
3819
|
+
*
|
|
3820
|
+
* @description
|
|
3821
|
+
* copy an value deeply as much as possible
|
|
3822
|
+
*
|
|
3823
|
+
* If `strict` is applied, then all properties (including non-enumerable ones)
|
|
3824
|
+
* are copied with their original property descriptors on both objects and arrays.
|
|
3825
|
+
*
|
|
3826
|
+
* The value is compared to the global constructors in the `realm` provided,
|
|
3827
|
+
* and the native constructor is always used to ensure that extensions of native
|
|
3828
|
+
* objects (allows in ES2015+) are maintained.
|
|
3829
|
+
*
|
|
3830
|
+
* @param value the value to copy
|
|
3831
|
+
* @param [options] the options for copying with
|
|
3832
|
+
* @param [options.isStrict] should the copy be strict
|
|
3833
|
+
* @param [options.realm] the realm (this) value the value is copied from
|
|
3834
|
+
* @returns the copied value
|
|
3835
|
+
*/
|
|
3836
|
+
function copy(value, options) {
|
|
3837
|
+
// manually coalesced instead of default parameters for performance
|
|
3838
|
+
var isStrict = !!(options && options.isStrict);
|
|
3839
|
+
var realm = (options && options.realm) || GLOBAL_THIS;
|
|
3840
|
+
var getObjectClone = isStrict ? getObjectCloneStrict : getObjectCloneLoose;
|
|
3841
|
+
/**
|
|
3842
|
+
* @function handleCopy
|
|
3843
|
+
*
|
|
3844
|
+
* @description
|
|
3845
|
+
* copy the value recursively based on its type
|
|
3846
|
+
*
|
|
3847
|
+
* @param value the value to copy
|
|
3848
|
+
* @returns the copied value
|
|
3849
|
+
*/
|
|
3850
|
+
var handleCopy = function (value, cache) {
|
|
3851
|
+
if (!value || typeof value !== 'object') {
|
|
3852
|
+
return value;
|
|
3853
|
+
}
|
|
3854
|
+
if (cache.has(value)) {
|
|
3855
|
+
return cache.get(value);
|
|
3856
|
+
}
|
|
3857
|
+
var prototype = value.__proto__ || getPrototypeOf(value);
|
|
3858
|
+
var Constructor = prototype && prototype.constructor;
|
|
3859
|
+
// plain objects
|
|
3860
|
+
if (!Constructor || Constructor === realm.Object) {
|
|
3861
|
+
return getObjectClone(value, realm, handleCopy, cache);
|
|
3862
|
+
}
|
|
3863
|
+
var clone;
|
|
3864
|
+
// arrays
|
|
3865
|
+
if (isArray(value)) {
|
|
3866
|
+
// if strict, include non-standard properties
|
|
3867
|
+
if (isStrict) {
|
|
3868
|
+
return getObjectCloneStrict(value, realm, handleCopy, cache);
|
|
3869
|
+
}
|
|
3870
|
+
clone = new Constructor();
|
|
3871
|
+
cache.set(value, clone);
|
|
3872
|
+
for (var index = 0, length_1 = value.length; index < length_1; ++index) {
|
|
3873
|
+
clone[index] = handleCopy(value[index], cache);
|
|
3874
|
+
}
|
|
3875
|
+
return clone;
|
|
3876
|
+
}
|
|
3877
|
+
// dates
|
|
3878
|
+
if (value instanceof realm.Date) {
|
|
3879
|
+
return new Constructor(value.getTime());
|
|
3880
|
+
}
|
|
3881
|
+
// regexps
|
|
3882
|
+
if (value instanceof realm.RegExp) {
|
|
3883
|
+
clone = new Constructor(value.source, value.flags || getRegExpFlags(value));
|
|
3884
|
+
clone.lastIndex = value.lastIndex;
|
|
3885
|
+
return clone;
|
|
3886
|
+
}
|
|
3887
|
+
// maps
|
|
3888
|
+
if (realm.Map && value instanceof realm.Map) {
|
|
3889
|
+
clone = new Constructor();
|
|
3890
|
+
cache.set(value, clone);
|
|
3891
|
+
value.forEach(function (value, key) {
|
|
3892
|
+
clone.set(key, handleCopy(value, cache));
|
|
3893
|
+
});
|
|
3894
|
+
return clone;
|
|
3895
|
+
}
|
|
3896
|
+
// sets
|
|
3897
|
+
if (realm.Set && value instanceof realm.Set) {
|
|
3898
|
+
clone = new Constructor();
|
|
3899
|
+
cache.set(value, clone);
|
|
3900
|
+
value.forEach(function (value) {
|
|
3901
|
+
clone.add(handleCopy(value, cache));
|
|
3902
|
+
});
|
|
3903
|
+
return clone;
|
|
3904
|
+
}
|
|
3905
|
+
// blobs
|
|
3906
|
+
if (realm.Blob && value instanceof realm.Blob) {
|
|
3907
|
+
return value.slice(0, value.size, value.type);
|
|
3908
|
+
}
|
|
3909
|
+
// buffers (node-only)
|
|
3910
|
+
if (realm.Buffer && realm.Buffer.isBuffer(value)) {
|
|
3911
|
+
clone = realm.Buffer.allocUnsafe
|
|
3912
|
+
? realm.Buffer.allocUnsafe(value.length)
|
|
3913
|
+
: new Constructor(value.length);
|
|
3914
|
+
cache.set(value, clone);
|
|
3915
|
+
value.copy(clone);
|
|
3916
|
+
return clone;
|
|
3917
|
+
}
|
|
3918
|
+
// arraybuffers / dataviews
|
|
3919
|
+
if (realm.ArrayBuffer) {
|
|
3920
|
+
// dataviews
|
|
3921
|
+
if (realm.ArrayBuffer.isView(value)) {
|
|
3922
|
+
clone = new Constructor(value.buffer.slice(0));
|
|
3923
|
+
cache.set(value, clone);
|
|
3924
|
+
return clone;
|
|
3925
|
+
}
|
|
3926
|
+
// arraybuffers
|
|
3927
|
+
if (value instanceof realm.ArrayBuffer) {
|
|
3928
|
+
clone = value.slice(0);
|
|
3929
|
+
cache.set(value, clone);
|
|
3930
|
+
return clone;
|
|
3931
|
+
}
|
|
3932
|
+
}
|
|
3933
|
+
// if the value cannot / should not be cloned, don't
|
|
3934
|
+
if (
|
|
3935
|
+
// promise-like
|
|
3936
|
+
typeof value.then === 'function' ||
|
|
3937
|
+
// errors
|
|
3938
|
+
value instanceof Error ||
|
|
3939
|
+
// weakmaps
|
|
3940
|
+
(realm.WeakMap && value instanceof realm.WeakMap) ||
|
|
3941
|
+
// weaksets
|
|
3942
|
+
(realm.WeakSet && value instanceof realm.WeakSet)) {
|
|
3943
|
+
return value;
|
|
3944
|
+
}
|
|
3945
|
+
// assume anything left is a custom constructor
|
|
3946
|
+
return getObjectClone(value, realm, handleCopy, cache);
|
|
3947
|
+
};
|
|
3948
|
+
return handleCopy(value, createCache());
|
|
3949
|
+
}
|
|
3950
|
+
// Adding reference to allow usage in CommonJS libraries compiled using TSC, which
|
|
3951
|
+
// expects there to be a default property on the exported value. See
|
|
3952
|
+
// [#37](https://github.com/planttheidea/fast-copy/issues/37) for details.
|
|
3953
|
+
copy.default = copy;
|
|
3954
|
+
/**
|
|
3955
|
+
* @function strictCopy
|
|
3956
|
+
*
|
|
3957
|
+
* @description
|
|
3958
|
+
* copy the value with `strict` option pre-applied
|
|
3959
|
+
*
|
|
3960
|
+
* @param value the value to copy
|
|
3961
|
+
* @param [options] the options for copying with
|
|
3962
|
+
* @param [options.realm] the realm (this) value the value is copied from
|
|
3963
|
+
* @returns the copied value
|
|
3964
|
+
*/
|
|
3965
|
+
copy.strict = function strictCopy(value, options) {
|
|
3966
|
+
return copy(value, {
|
|
3967
|
+
isStrict: true,
|
|
3968
|
+
realm: options ? options.realm : void 0,
|
|
3969
|
+
});
|
|
3970
|
+
};
|
|
3971
|
+
|
|
3972
|
+
return copy;
|
|
3973
|
+
|
|
3974
|
+
}));
|
|
3975
|
+
//# sourceMappingURL=fast-copy.js.map
|
|
3976
|
+
|
|
3977
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js")))
|
|
3978
|
+
|
|
3979
|
+
/***/ }),
|
|
3980
|
+
|
|
3714
3981
|
/***/ "../node_modules/fast-copy/dist/fast-copy.js":
|
|
3715
3982
|
/*!***************************************************!*\
|
|
3716
3983
|
!*** ../node_modules/fast-copy/dist/fast-copy.js ***!
|
|
@@ -7801,7 +8068,7 @@ var parseObject = function (chain, val, options, valuesParsed) {
|
|
|
7801
8068
|
) {
|
|
7802
8069
|
obj = [];
|
|
7803
8070
|
obj[index] = leaf;
|
|
7804
|
-
} else {
|
|
8071
|
+
} else if (cleanRoot !== '__proto__') {
|
|
7805
8072
|
obj[cleanRoot] = leaf;
|
|
7806
8073
|
}
|
|
7807
8074
|
}
|
|
@@ -7959,6 +8226,7 @@ var arrayPrefixGenerators = {
|
|
|
7959
8226
|
};
|
|
7960
8227
|
|
|
7961
8228
|
var isArray = Array.isArray;
|
|
8229
|
+
var split = String.prototype.split;
|
|
7962
8230
|
var push = Array.prototype.push;
|
|
7963
8231
|
var pushToArray = function (arr, valueOrArray) {
|
|
7964
8232
|
push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
|
@@ -7995,10 +8263,13 @@ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
|
|
7995
8263
|
|| typeof v === 'bigint';
|
|
7996
8264
|
};
|
|
7997
8265
|
|
|
8266
|
+
var sentinel = {};
|
|
8267
|
+
|
|
7998
8268
|
var stringify = function stringify(
|
|
7999
8269
|
object,
|
|
8000
8270
|
prefix,
|
|
8001
8271
|
generateArrayPrefix,
|
|
8272
|
+
commaRoundTrip,
|
|
8002
8273
|
strictNullHandling,
|
|
8003
8274
|
skipNulls,
|
|
8004
8275
|
encoder,
|
|
@@ -8014,8 +8285,23 @@ var stringify = function stringify(
|
|
|
8014
8285
|
) {
|
|
8015
8286
|
var obj = object;
|
|
8016
8287
|
|
|
8017
|
-
|
|
8018
|
-
|
|
8288
|
+
var tmpSc = sideChannel;
|
|
8289
|
+
var step = 0;
|
|
8290
|
+
var findFlag = false;
|
|
8291
|
+
while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
|
8292
|
+
// Where object last appeared in the ref tree
|
|
8293
|
+
var pos = tmpSc.get(object);
|
|
8294
|
+
step += 1;
|
|
8295
|
+
if (typeof pos !== 'undefined') {
|
|
8296
|
+
if (pos === step) {
|
|
8297
|
+
throw new RangeError('Cyclic object value');
|
|
8298
|
+
} else {
|
|
8299
|
+
findFlag = true; // Break while
|
|
8300
|
+
}
|
|
8301
|
+
}
|
|
8302
|
+
if (typeof tmpSc.get(sentinel) === 'undefined') {
|
|
8303
|
+
step = 0;
|
|
8304
|
+
}
|
|
8019
8305
|
}
|
|
8020
8306
|
|
|
8021
8307
|
if (typeof filter === 'function') {
|
|
@@ -8042,6 +8328,14 @@ var stringify = function stringify(
|
|
|
8042
8328
|
if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
|
8043
8329
|
if (encoder) {
|
|
8044
8330
|
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
|
8331
|
+
if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
|
|
8332
|
+
var valuesArray = split.call(String(obj), ',');
|
|
8333
|
+
var valuesJoined = '';
|
|
8334
|
+
for (var i = 0; i < valuesArray.length; ++i) {
|
|
8335
|
+
valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
|
8336
|
+
}
|
|
8337
|
+
return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
|
|
8338
|
+
}
|
|
8045
8339
|
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
|
8046
8340
|
}
|
|
8047
8341
|
return [formatter(prefix) + '=' + formatter(String(obj))];
|
|
@@ -8056,7 +8350,7 @@ var stringify = function stringify(
|
|
|
8056
8350
|
var objKeys;
|
|
8057
8351
|
if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
|
8058
8352
|
// we need to join elements in
|
|
8059
|
-
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : undefined }];
|
|
8353
|
+
objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
|
8060
8354
|
} else if (isArray(filter)) {
|
|
8061
8355
|
objKeys = filter;
|
|
8062
8356
|
} else {
|
|
@@ -8064,24 +8358,28 @@ var stringify = function stringify(
|
|
|
8064
8358
|
objKeys = sort ? keys.sort(sort) : keys;
|
|
8065
8359
|
}
|
|
8066
8360
|
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8361
|
+
var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
|
8362
|
+
|
|
8363
|
+
for (var j = 0; j < objKeys.length; ++j) {
|
|
8364
|
+
var key = objKeys[j];
|
|
8365
|
+
var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
|
8070
8366
|
|
|
8071
8367
|
if (skipNulls && value === null) {
|
|
8072
8368
|
continue;
|
|
8073
8369
|
}
|
|
8074
8370
|
|
|
8075
8371
|
var keyPrefix = isArray(obj)
|
|
8076
|
-
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(
|
|
8077
|
-
:
|
|
8372
|
+
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
|
8373
|
+
: adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
|
8078
8374
|
|
|
8079
|
-
sideChannel.set(object,
|
|
8375
|
+
sideChannel.set(object, step);
|
|
8080
8376
|
var valueSideChannel = getSideChannel();
|
|
8377
|
+
valueSideChannel.set(sentinel, sideChannel);
|
|
8081
8378
|
pushToArray(values, stringify(
|
|
8082
8379
|
value,
|
|
8083
8380
|
keyPrefix,
|
|
8084
8381
|
generateArrayPrefix,
|
|
8382
|
+
commaRoundTrip,
|
|
8085
8383
|
strictNullHandling,
|
|
8086
8384
|
skipNulls,
|
|
8087
8385
|
encoder,
|
|
@@ -8105,7 +8403,7 @@ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
|
|
8105
8403
|
return defaults;
|
|
8106
8404
|
}
|
|
8107
8405
|
|
|
8108
|
-
if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') {
|
|
8406
|
+
if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
|
8109
8407
|
throw new TypeError('Encoder has to be a function.');
|
|
8110
8408
|
}
|
|
8111
8409
|
|
|
@@ -8178,6 +8476,10 @@ module.exports = function (object, opts) {
|
|
|
8178
8476
|
}
|
|
8179
8477
|
|
|
8180
8478
|
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
|
8479
|
+
if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
|
8480
|
+
throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
|
8481
|
+
}
|
|
8482
|
+
var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
|
8181
8483
|
|
|
8182
8484
|
if (!objKeys) {
|
|
8183
8485
|
objKeys = Object.keys(obj);
|
|
@@ -8198,6 +8500,7 @@ module.exports = function (object, opts) {
|
|
|
8198
8500
|
obj[key],
|
|
8199
8501
|
key,
|
|
8200
8502
|
generateArrayPrefix,
|
|
8503
|
+
commaRoundTrip,
|
|
8201
8504
|
options.strictNullHandling,
|
|
8202
8505
|
options.skipNulls,
|
|
8203
8506
|
options.encode ? options.encoder : null,
|
|
@@ -8419,6 +8722,7 @@ var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
|
|
8419
8722
|
|
|
8420
8723
|
i += 1;
|
|
8421
8724
|
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
|
8725
|
+
/* eslint operator-linebreak: [2, "before"] */
|
|
8422
8726
|
out += hexTable[0xF0 | (c >> 18)]
|
|
8423
8727
|
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
|
|
8424
8728
|
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
|
|
@@ -12620,7 +12924,7 @@ function createClient(params) {
|
|
|
12620
12924
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12621
12925
|
var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
12622
12926
|
var userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
|
|
12623
|
-
"".concat(sdkMain, "/").concat("10.21.
|
|
12927
|
+
"".concat(sdkMain, "/").concat("10.21.3"), params.application, params.integration, params.feature);
|
|
12624
12928
|
var adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params);
|
|
12625
12929
|
|
|
12626
12930
|
// Parameters<?> and ReturnType<?> only return the types of the last overload
|