contentful-management 7.45.2 → 7.45.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 +19 -39
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.legacy.js +19 -39
- package/dist/contentful-management.legacy.js.map +1 -1
- package/dist/contentful-management.legacy.min.js +1 -1
- package/dist/contentful-management.node.js +19 -39
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +1 -1
- package/dist/es-modules/constants/editor-interface-defaults/sidebar-defaults.js +1 -8
- package/dist/es-modules/contentful-management.js +1 -1
- package/package.json +7 -6
|
@@ -3015,15 +3015,16 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
3015
3015
|
};
|
|
3016
3016
|
});
|
|
3017
3017
|
|
|
3018
|
-
var attempts = {};
|
|
3019
|
-
var networkErrorAttempts = 0;
|
|
3020
|
-
|
|
3021
3018
|
var delay = function delay(ms) {
|
|
3022
3019
|
return new Promise(function (resolve) {
|
|
3023
3020
|
setTimeout(resolve, ms);
|
|
3024
3021
|
});
|
|
3025
3022
|
};
|
|
3026
3023
|
|
|
3024
|
+
var defaultWait = function defaultWait(attempts) {
|
|
3025
|
+
return Math.pow(Math.SQRT2, attempts);
|
|
3026
|
+
};
|
|
3027
|
+
|
|
3027
3028
|
function rateLimit(instance) {
|
|
3028
3029
|
var maxRetry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
3029
3030
|
var _instance$defaults = instance.defaults,
|
|
@@ -3049,40 +3050,24 @@ function rateLimit(instance) {
|
|
|
3049
3050
|
|
|
3050
3051
|
if (!config || !instance.defaults.retryOnError) {
|
|
3051
3052
|
return Promise.reject(error);
|
|
3053
|
+
} // Retried already for max attempts
|
|
3054
|
+
|
|
3055
|
+
|
|
3056
|
+
var doneAttempts = config.attempts || 1;
|
|
3057
|
+
|
|
3058
|
+
if (doneAttempts > maxRetry) {
|
|
3059
|
+
error.attempts = config.attempts;
|
|
3060
|
+
return Promise.reject(error);
|
|
3052
3061
|
}
|
|
3053
3062
|
|
|
3054
3063
|
var retryErrorType = null;
|
|
3055
|
-
var wait =
|
|
3064
|
+
var wait = defaultWait(doneAttempts); // Errors without response did not receive anything from the server
|
|
3056
3065
|
|
|
3057
3066
|
if (!response) {
|
|
3058
3067
|
retryErrorType = 'Connection';
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
if (networkErrorAttempts > maxRetry) {
|
|
3062
|
-
error.attempts = networkErrorAttempts;
|
|
3063
|
-
return Promise.reject(error);
|
|
3064
|
-
}
|
|
3065
|
-
|
|
3066
|
-
wait = Math.pow(Math.SQRT2, networkErrorAttempts);
|
|
3067
|
-
response = {};
|
|
3068
|
-
} else {
|
|
3069
|
-
networkErrorAttempts = 0;
|
|
3070
|
-
}
|
|
3071
|
-
|
|
3072
|
-
if (response.status >= 500 && response.status < 600) {
|
|
3068
|
+
} else if (response.status >= 500 && response.status < 600) {
|
|
3073
3069
|
// 5** errors are server related
|
|
3074
3070
|
retryErrorType = "Server ".concat(response.status);
|
|
3075
|
-
var headers = response.headers || {};
|
|
3076
|
-
var requestId = headers['x-contentful-request-id'] || null;
|
|
3077
|
-
attempts[requestId] = attempts[requestId] || 0;
|
|
3078
|
-
attempts[requestId]++; // we reject if there are too many errors with the same request id or request id is not defined
|
|
3079
|
-
|
|
3080
|
-
if (attempts[requestId] > maxRetry || !requestId) {
|
|
3081
|
-
error.attempts = attempts[requestId];
|
|
3082
|
-
return Promise.reject(error);
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3085
|
-
wait = Math.pow(Math.SQRT2, attempts[requestId]);
|
|
3086
3071
|
} else if (response.status === 429) {
|
|
3087
3072
|
// 429 errors are exceeded rate limit exceptions
|
|
3088
3073
|
retryErrorType = 'Rate limit'; // all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
|
|
@@ -3095,7 +3080,9 @@ function rateLimit(instance) {
|
|
|
3095
3080
|
if (retryErrorType) {
|
|
3096
3081
|
// convert to ms and add jitter
|
|
3097
3082
|
wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
|
|
3098
|
-
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
|
|
3083
|
+
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying...")); // increase attempts counter
|
|
3084
|
+
|
|
3085
|
+
config.attempts = doneAttempts + 1;
|
|
3099
3086
|
/* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
|
|
3100
3087
|
to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
|
|
3101
3088
|
requests still use the original http/httpsAgent property */
|
|
@@ -10971,7 +10958,6 @@ const SidebarWidgetTypes = {
|
|
|
10971
10958
|
VERSIONS: 'versions-widget',
|
|
10972
10959
|
INFO_PANEL: 'info-panel',
|
|
10973
10960
|
JOBS: 'jobs-widget',
|
|
10974
|
-
TASKS: 'content-workflows-tasks-widget',
|
|
10975
10961
|
COMMENTS_PANEL: 'comments-panel'
|
|
10976
10962
|
};
|
|
10977
10963
|
const Publication = {
|
|
@@ -10986,12 +10972,6 @@ const Releases = {
|
|
|
10986
10972
|
name: 'Release',
|
|
10987
10973
|
description: 'Built-in - View release, add to it, etc.'
|
|
10988
10974
|
};
|
|
10989
|
-
const Tasks = {
|
|
10990
|
-
widgetId: SidebarWidgetTypes.TASKS,
|
|
10991
|
-
widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
|
|
10992
|
-
name: 'Tasks',
|
|
10993
|
-
description: 'Built-in - Assign tasks to be completed before publishing. Currently only supported for master environment.'
|
|
10994
|
-
};
|
|
10995
10975
|
const ContentPreview = {
|
|
10996
10976
|
widgetId: SidebarWidgetTypes.CONTENT_PREVIEW,
|
|
10997
10977
|
widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
|
|
@@ -11022,7 +11002,7 @@ const Users = {
|
|
|
11022
11002
|
name: 'Users',
|
|
11023
11003
|
description: 'Built-in - Displays users on the same entry.'
|
|
11024
11004
|
};
|
|
11025
|
-
const SidebarEntryConfiguration = [Publication, Releases,
|
|
11005
|
+
const SidebarEntryConfiguration = [Publication, Releases, ContentPreview, Links, Translation, Versions, Users];
|
|
11026
11006
|
const SidebarAssetConfiguration = [Publication, Releases, Links, Translation, Users];
|
|
11027
11007
|
|
|
11028
11008
|
/***/ }),
|
|
@@ -11112,7 +11092,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
11112
11092
|
function createClient(params, opts = {}) {
|
|
11113
11093
|
const sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
11114
11094
|
const userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
|
|
11115
|
-
`${sdkMain}/${"7.45.
|
|
11095
|
+
`${sdkMain}/${"7.45.3"}`, params.application, params.integration, params.feature);
|
|
11116
11096
|
const adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params); // Parameters<?> and ReturnType<?> only return the types of the last overload
|
|
11117
11097
|
// https://github.com/microsoft/TypeScript/issues/26591
|
|
11118
11098
|
// @ts-expect-error
|