contentful-management 7.45.1 → 7.45.5
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 +76 -56
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.legacy.js +76 -56
- package/dist/contentful-management.legacy.js.map +1 -1
- package/dist/contentful-management.legacy.min.js +1 -1
- package/dist/contentful-management.node.js +72 -52
- package/dist/contentful-management.node.js.map +1 -1
- package/dist/contentful-management.node.min.js +1 -1
- package/dist/es-modules/adapters/REST/endpoints/entry.js +4 -3
- package/dist/es-modules/constants/editor-interface-defaults/sidebar-defaults.js +1 -8
- package/dist/es-modules/contentful-management.js +2 -1
- package/dist/es-modules/create-entry-api.js +1 -1
- package/dist/es-modules/create-environment-api.js +9 -4
- package/dist/es-modules/plain/as-iterator.js +12 -8
- package/dist/typings/common-types.d.ts +4 -0
- package/dist/typings/contentful-management.d.ts +1 -0
- package/dist/typings/create-environment-api.d.ts +4 -3
- package/dist/typings/entities/entry.d.ts +6 -2
- package/dist/typings/plain/common-types.d.ts +4 -0
- 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 */
|
|
@@ -7215,9 +7202,10 @@ var references = function references(http, params) {
|
|
|
7215
7202
|
var spaceId = params.spaceId,
|
|
7216
7203
|
environmentId = params.environmentId,
|
|
7217
7204
|
entryId = params.entryId,
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7205
|
+
maxDepth = params.maxDepth,
|
|
7206
|
+
include = params.include;
|
|
7207
|
+
var level = include || maxDepth || 2;
|
|
7208
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http, "/spaces/".concat(spaceId, "/environments/").concat(environmentId, "/entries/").concat(entryId, "/references?include=").concat(level));
|
|
7221
7209
|
};
|
|
7222
7210
|
|
|
7223
7211
|
/***/ }),
|
|
@@ -9159,6 +9147,19 @@ var RestAdapter = /*#__PURE__*/function () {
|
|
|
9159
9147
|
return RestAdapter;
|
|
9160
9148
|
}();
|
|
9161
9149
|
|
|
9150
|
+
/***/ }),
|
|
9151
|
+
|
|
9152
|
+
/***/ "./common-types.ts":
|
|
9153
|
+
/*!*************************!*\
|
|
9154
|
+
!*** ./common-types.ts ***!
|
|
9155
|
+
\*************************/
|
|
9156
|
+
/*! no exports provided */
|
|
9157
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9158
|
+
|
|
9159
|
+
"use strict";
|
|
9160
|
+
__webpack_require__.r(__webpack_exports__);
|
|
9161
|
+
|
|
9162
|
+
|
|
9162
9163
|
/***/ }),
|
|
9163
9164
|
|
|
9164
9165
|
/***/ "./common-utils.ts":
|
|
@@ -9570,7 +9571,6 @@ var SidebarWidgetTypes = {
|
|
|
9570
9571
|
VERSIONS: 'versions-widget',
|
|
9571
9572
|
INFO_PANEL: 'info-panel',
|
|
9572
9573
|
JOBS: 'jobs-widget',
|
|
9573
|
-
TASKS: 'content-workflows-tasks-widget',
|
|
9574
9574
|
COMMENTS_PANEL: 'comments-panel'
|
|
9575
9575
|
};
|
|
9576
9576
|
var Publication = {
|
|
@@ -9585,12 +9585,6 @@ var Releases = {
|
|
|
9585
9585
|
name: 'Release',
|
|
9586
9586
|
description: 'Built-in - View release, add to it, etc.'
|
|
9587
9587
|
};
|
|
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
9588
|
var ContentPreview = {
|
|
9595
9589
|
widgetId: SidebarWidgetTypes.CONTENT_PREVIEW,
|
|
9596
9590
|
widgetNamespace: _types__WEBPACK_IMPORTED_MODULE_0__["WidgetNamespace"].SIDEBAR_BUILTIN,
|
|
@@ -9621,7 +9615,7 @@ var Users = {
|
|
|
9621
9615
|
name: 'Users',
|
|
9622
9616
|
description: 'Built-in - Displays users on the same entry.'
|
|
9623
9617
|
};
|
|
9624
|
-
var SidebarEntryConfiguration = [Publication, Releases,
|
|
9618
|
+
var SidebarEntryConfiguration = [Publication, Releases, ContentPreview, Links, Translation, Versions, Users];
|
|
9625
9619
|
var SidebarAssetConfiguration = [Publication, Releases, Links, Translation, Users];
|
|
9626
9620
|
|
|
9627
9621
|
/***/ }),
|
|
@@ -9688,7 +9682,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9688
9682
|
/* harmony import */ var _adapters_REST_rest_adapter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./adapters/REST/rest-adapter */ "./adapters/REST/rest-adapter.ts");
|
|
9689
9683
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RestAdapter", function() { return _adapters_REST_rest_adapter__WEBPACK_IMPORTED_MODULE_7__["RestAdapter"]; });
|
|
9690
9684
|
|
|
9691
|
-
|
|
9685
|
+
/* harmony import */ var _export_types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./export-types */ "./export-types.ts");
|
|
9686
|
+
/* empty/unused harmony star reexport */function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
9692
9687
|
|
|
9693
9688
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9694
9689
|
|
|
@@ -9710,11 +9705,12 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
9710
9705
|
|
|
9711
9706
|
|
|
9712
9707
|
|
|
9708
|
+
|
|
9713
9709
|
function createClient(params) {
|
|
9714
9710
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9715
9711
|
var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
9716
9712
|
var userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
|
|
9717
|
-
"".concat(sdkMain, "/").concat("7.45.
|
|
9713
|
+
"".concat(sdkMain, "/").concat("7.45.5"), params.application, params.integration, params.feature);
|
|
9718
9714
|
var adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params); // Parameters<?> and ReturnType<?> only return the types of the last overload
|
|
9719
9715
|
// https://github.com/microsoft/TypeScript/issues/26591
|
|
9720
9716
|
// @ts-expect-error
|
|
@@ -10954,7 +10950,7 @@ function createEntryApi(makeRequest) {
|
|
|
10954
10950
|
spaceId: raw.sys.space.sys.id,
|
|
10955
10951
|
environmentId: raw.sys.environment.sys.id,
|
|
10956
10952
|
entryId: raw.sys.id,
|
|
10957
|
-
maxDepth: options === null || options === void 0 ? void 0 : options.maxDepth
|
|
10953
|
+
maxDepth: (options === null || options === void 0 ? void 0 : options.include) || (options === null || options === void 0 ? void 0 : options.maxDepth)
|
|
10958
10954
|
}
|
|
10959
10955
|
}).then(function (response) {
|
|
10960
10956
|
return wrapEntryCollection(makeRequest, response);
|
|
@@ -11794,7 +11790,8 @@ function createEnvironmentApi(makeRequest) {
|
|
|
11794
11790
|
/**
|
|
11795
11791
|
* Get entry references
|
|
11796
11792
|
* @param entryId - Entry ID
|
|
11797
|
-
* @param {Object} options.
|
|
11793
|
+
* @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum
|
|
11794
|
+
* @param {Object} options.maxDepth - alias for `include`. Deprecated, please use `include`
|
|
11798
11795
|
* @returns Promise of Entry references
|
|
11799
11796
|
* @example ```javascript
|
|
11800
11797
|
* const contentful = require('contentful-management');
|
|
@@ -11806,10 +11803,10 @@ function createEnvironmentApi(makeRequest) {
|
|
|
11806
11803
|
* // Get entry references
|
|
11807
11804
|
* client.getSpace('<space_id>')
|
|
11808
11805
|
* .then((space) => space.getEnvironment('<environment_id>'))
|
|
11809
|
-
* .then((environment) => environment.getEntryReferences('<entry_id>', {
|
|
11806
|
+
* .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
|
|
11810
11807
|
* .then((entry) => console.log(entry.includes))
|
|
11811
11808
|
* // or
|
|
11812
|
-
* .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({
|
|
11809
|
+
* .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({include: number}))
|
|
11813
11810
|
* .catch(console.error)
|
|
11814
11811
|
* ```
|
|
11815
11812
|
*/
|
|
@@ -11822,7 +11819,11 @@ function createEnvironmentApi(makeRequest) {
|
|
|
11822
11819
|
spaceId: raw.sys.space.sys.id,
|
|
11823
11820
|
environmentId: raw.sys.id,
|
|
11824
11821
|
entryId: entryId,
|
|
11825
|
-
|
|
11822
|
+
|
|
11823
|
+
/**
|
|
11824
|
+
* @deprecated use `include` instead
|
|
11825
|
+
*/
|
|
11826
|
+
maxDepth: (options === null || options === void 0 ? void 0 : options.include) || (options === null || options === void 0 ? void 0 : options.maxDepth)
|
|
11826
11827
|
}
|
|
11827
11828
|
}).then(function (response) {
|
|
11828
11829
|
return wrapEntryCollection(makeRequest, response);
|
|
@@ -18865,6 +18866,21 @@ function wrapWebhook(makeRequest, data) {
|
|
|
18865
18866
|
|
|
18866
18867
|
var wrapWebhookCollection = Object(_common_utils__WEBPACK_IMPORTED_MODULE_2__["wrapCollection"])(wrapWebhook);
|
|
18867
18868
|
|
|
18869
|
+
/***/ }),
|
|
18870
|
+
|
|
18871
|
+
/***/ "./export-types.ts":
|
|
18872
|
+
/*!*************************!*\
|
|
18873
|
+
!*** ./export-types.ts ***!
|
|
18874
|
+
\*************************/
|
|
18875
|
+
/*! no exports provided */
|
|
18876
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
18877
|
+
|
|
18878
|
+
"use strict";
|
|
18879
|
+
__webpack_require__.r(__webpack_exports__);
|
|
18880
|
+
/* harmony import */ var _common_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./common-types */ "./common-types.ts");
|
|
18881
|
+
/* empty/unused harmony star reexport */
|
|
18882
|
+
|
|
18883
|
+
|
|
18868
18884
|
/***/ }),
|
|
18869
18885
|
|
|
18870
18886
|
/***/ "./methods/action.ts":
|
|
@@ -19154,7 +19170,7 @@ var asIterator = function asIterator(fn, params) {
|
|
|
19154
19170
|
var _this = this;
|
|
19155
19171
|
|
|
19156
19172
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
19157
|
-
var _yield$currentResult, total, items, skip, limit, value, endOfPage, endOfList;
|
|
19173
|
+
var _yield$currentResult, _yield$currentResult$, total, _yield$currentResult$2, items, _yield$currentResult$3, skip, _yield$currentResult$4, limit, value, endOfPage, endOfList;
|
|
19158
19174
|
|
|
19159
19175
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19160
19176
|
while (1) {
|
|
@@ -19165,13 +19181,17 @@ var asIterator = function asIterator(fn, params) {
|
|
|
19165
19181
|
|
|
19166
19182
|
case 2:
|
|
19167
19183
|
_yield$currentResult = _context.sent;
|
|
19168
|
-
|
|
19169
|
-
|
|
19170
|
-
|
|
19171
|
-
|
|
19184
|
+
_yield$currentResult$ = _yield$currentResult.total;
|
|
19185
|
+
total = _yield$currentResult$ === void 0 ? 0 : _yield$currentResult$;
|
|
19186
|
+
_yield$currentResult$2 = _yield$currentResult.items;
|
|
19187
|
+
items = _yield$currentResult$2 === void 0 ? [] : _yield$currentResult$2;
|
|
19188
|
+
_yield$currentResult$3 = _yield$currentResult.skip;
|
|
19189
|
+
skip = _yield$currentResult$3 === void 0 ? 0 : _yield$currentResult$3;
|
|
19190
|
+
_yield$currentResult$4 = _yield$currentResult.limit;
|
|
19191
|
+
limit = _yield$currentResult$4 === void 0 ? 100 : _yield$currentResult$4;
|
|
19172
19192
|
|
|
19173
19193
|
if (!(total === _this.current)) {
|
|
19174
|
-
_context.next =
|
|
19194
|
+
_context.next = 13;
|
|
19175
19195
|
break;
|
|
19176
19196
|
}
|
|
19177
19197
|
|
|
@@ -19180,7 +19200,7 @@ var asIterator = function asIterator(fn, params) {
|
|
|
19180
19200
|
value: null
|
|
19181
19201
|
});
|
|
19182
19202
|
|
|
19183
|
-
case
|
|
19203
|
+
case 13:
|
|
19184
19204
|
value = items[_this.current++ - skip];
|
|
19185
19205
|
endOfPage = _this.current % limit === 0;
|
|
19186
19206
|
endOfList = _this.current === total;
|
|
@@ -19199,7 +19219,7 @@ var asIterator = function asIterator(fn, params) {
|
|
|
19199
19219
|
value: value
|
|
19200
19220
|
});
|
|
19201
19221
|
|
|
19202
|
-
case
|
|
19222
|
+
case 18:
|
|
19203
19223
|
case "end":
|
|
19204
19224
|
return _context.stop();
|
|
19205
19225
|
}
|