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
|
@@ -2683,15 +2683,16 @@ var rateLimitThrottle = (function (axiosInstance) {
|
|
|
2683
2683
|
};
|
|
2684
2684
|
});
|
|
2685
2685
|
|
|
2686
|
-
var attempts = {};
|
|
2687
|
-
var networkErrorAttempts = 0;
|
|
2688
|
-
|
|
2689
2686
|
var delay = function delay(ms) {
|
|
2690
2687
|
return new Promise(function (resolve) {
|
|
2691
2688
|
setTimeout(resolve, ms);
|
|
2692
2689
|
});
|
|
2693
2690
|
};
|
|
2694
2691
|
|
|
2692
|
+
var defaultWait = function defaultWait(attempts) {
|
|
2693
|
+
return Math.pow(Math.SQRT2, attempts);
|
|
2694
|
+
};
|
|
2695
|
+
|
|
2695
2696
|
function rateLimit(instance) {
|
|
2696
2697
|
var maxRetry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5;
|
|
2697
2698
|
var _instance$defaults = instance.defaults,
|
|
@@ -2717,40 +2718,24 @@ function rateLimit(instance) {
|
|
|
2717
2718
|
|
|
2718
2719
|
if (!config || !instance.defaults.retryOnError) {
|
|
2719
2720
|
return Promise.reject(error);
|
|
2721
|
+
} // Retried already for max attempts
|
|
2722
|
+
|
|
2723
|
+
|
|
2724
|
+
var doneAttempts = config.attempts || 1;
|
|
2725
|
+
|
|
2726
|
+
if (doneAttempts > maxRetry) {
|
|
2727
|
+
error.attempts = config.attempts;
|
|
2728
|
+
return Promise.reject(error);
|
|
2720
2729
|
}
|
|
2721
2730
|
|
|
2722
2731
|
var retryErrorType = null;
|
|
2723
|
-
var wait =
|
|
2732
|
+
var wait = defaultWait(doneAttempts); // Errors without response did not receive anything from the server
|
|
2724
2733
|
|
|
2725
2734
|
if (!response) {
|
|
2726
2735
|
retryErrorType = 'Connection';
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
if (networkErrorAttempts > maxRetry) {
|
|
2730
|
-
error.attempts = networkErrorAttempts;
|
|
2731
|
-
return Promise.reject(error);
|
|
2732
|
-
}
|
|
2733
|
-
|
|
2734
|
-
wait = Math.pow(Math.SQRT2, networkErrorAttempts);
|
|
2735
|
-
response = {};
|
|
2736
|
-
} else {
|
|
2737
|
-
networkErrorAttempts = 0;
|
|
2738
|
-
}
|
|
2739
|
-
|
|
2740
|
-
if (response.status >= 500 && response.status < 600) {
|
|
2736
|
+
} else if (response.status >= 500 && response.status < 600) {
|
|
2741
2737
|
// 5** errors are server related
|
|
2742
2738
|
retryErrorType = "Server ".concat(response.status);
|
|
2743
|
-
var headers = response.headers || {};
|
|
2744
|
-
var requestId = headers['x-contentful-request-id'] || null;
|
|
2745
|
-
attempts[requestId] = attempts[requestId] || 0;
|
|
2746
|
-
attempts[requestId]++; // we reject if there are too many errors with the same request id or request id is not defined
|
|
2747
|
-
|
|
2748
|
-
if (attempts[requestId] > maxRetry || !requestId) {
|
|
2749
|
-
error.attempts = attempts[requestId];
|
|
2750
|
-
return Promise.reject(error);
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
wait = Math.pow(Math.SQRT2, attempts[requestId]);
|
|
2754
2739
|
} else if (response.status === 429) {
|
|
2755
2740
|
// 429 errors are exceeded rate limit exceptions
|
|
2756
2741
|
retryErrorType = 'Rate limit'; // all headers are lowercased by axios https://github.com/mzabriskie/axios/issues/413
|
|
@@ -2763,7 +2748,9 @@ function rateLimit(instance) {
|
|
|
2763
2748
|
if (retryErrorType) {
|
|
2764
2749
|
// convert to ms and add jitter
|
|
2765
2750
|
wait = Math.floor(wait * 1000 + Math.random() * 200 + 500);
|
|
2766
|
-
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying..."));
|
|
2751
|
+
instance.defaults.logHandler('warning', "".concat(retryErrorType, " error occurred. Waiting for ").concat(wait, " ms before retrying...")); // increase attempts counter
|
|
2752
|
+
|
|
2753
|
+
config.attempts = doneAttempts + 1;
|
|
2767
2754
|
/* Somehow between the interceptor and retrying the request the httpAgent/httpsAgent gets transformed from an Agent-like object
|
|
2768
2755
|
to a regular object, causing failures on retries after rate limits. Removing these properties here fixes the error, but retry
|
|
2769
2756
|
requests still use the original http/httpsAgent property */
|
|
@@ -9570,7 +9557,6 @@ var SidebarWidgetTypes = {
|
|
|
9570
9557
|
VERSIONS: 'versions-widget',
|
|
9571
9558
|
INFO_PANEL: 'info-panel',
|
|
9572
9559
|
JOBS: 'jobs-widget',
|
|
9573
|
-
TASKS: 'content-workflows-tasks-widget',
|
|
9574
9560
|
COMMENTS_PANEL: 'comments-panel'
|
|
9575
9561
|
};
|
|
9576
9562
|
var Publication = {
|
|
@@ -9585,12 +9571,6 @@ var Releases = {
|
|
|
9585
9571
|
name: 'Release',
|
|
9586
9572
|
description: 'Built-in - View release, add to it, etc.'
|
|
9587
9573
|
};
|
|
9588
|
-
var Tasks = {
|
|
9589
|
-
widgetId: SidebarWidgetTypes.TASKS,
|
|
9590
|
-
widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
|
|
9591
|
-
name: 'Tasks',
|
|
9592
|
-
description: 'Built-in - Assign tasks to be completed before publishing. Currently only supported for master environment.'
|
|
9593
|
-
};
|
|
9594
9574
|
var ContentPreview = {
|
|
9595
9575
|
widgetId: SidebarWidgetTypes.CONTENT_PREVIEW,
|
|
9596
9576
|
widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
|
|
@@ -9621,7 +9601,7 @@ var Users = {
|
|
|
9621
9601
|
name: 'Users',
|
|
9622
9602
|
description: 'Built-in - Displays users on the same entry.'
|
|
9623
9603
|
};
|
|
9624
|
-
var SidebarEntryConfiguration = [Publication, Releases,
|
|
9604
|
+
var SidebarEntryConfiguration = [Publication, Releases, ContentPreview, Links, Translation, Versions, Users];
|
|
9625
9605
|
var SidebarAssetConfiguration = [Publication, Releases, Links, Translation, Users];
|
|
9626
9606
|
|
|
9627
9607
|
/***/ }),
|
|
@@ -9714,7 +9694,7 @@ function createClient(params) {
|
|
|
9714
9694
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9715
9695
|
var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
9716
9696
|
var userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
|
|
9717
|
-
"".concat(sdkMain, "/").concat("7.45.
|
|
9697
|
+
"".concat(sdkMain, "/").concat("7.45.3"), params.application, params.integration, params.feature);
|
|
9718
9698
|
var adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params); // Parameters<?> and ReturnType<?> only return the types of the last overload
|
|
9719
9699
|
// https://github.com/microsoft/TypeScript/issues/26591
|
|
9720
9700
|
// @ts-expect-error
|