contentful-management 10.21.6 → 10.22.0
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 +45 -18
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +42 -15
- 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/comment.js +32 -12
- package/dist/es-modules/contentful-management.js +1 -1
- package/dist/es-modules/create-entry-api.js +6 -1
- package/dist/typings/adapters/REST/endpoints/comment.d.ts +4 -4
- package/dist/typings/common-types.d.ts +3 -3
- package/dist/typings/entities/comment.d.ts +20 -3
- package/dist/typings/export-types.d.ts +1 -1
- package/dist/typings/plain/common-types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -9803,17 +9803,17 @@ var validate = function validate(http, params, payload) {
|
|
|
9803
9803
|
/*!********************************************!*\
|
|
9804
9804
|
!*** ./adapters/REST/endpoints/comment.ts ***!
|
|
9805
9805
|
\********************************************/
|
|
9806
|
-
/*! exports provided: get, getMany,
|
|
9806
|
+
/*! exports provided: get, getMany, create, update, del, getAll */
|
|
9807
9807
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
9808
9808
|
|
|
9809
9809
|
"use strict";
|
|
9810
9810
|
__webpack_require__.r(__webpack_exports__);
|
|
9811
9811
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "get", function() { return get; });
|
|
9812
9812
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMany", function() { return getMany; });
|
|
9813
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAll", function() { return getAll; });
|
|
9814
9813
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "create", function() { return create; });
|
|
9815
9814
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "update", function() { return update; });
|
|
9816
9815
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "del", function() { return del; });
|
|
9816
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAll", function() { return getAll; });
|
|
9817
9817
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fast-copy */ "../node_modules/fast-copy/dist/umd/index.js");
|
|
9818
9818
|
/* harmony import */ var fast_copy__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fast_copy__WEBPACK_IMPORTED_MODULE_0__);
|
|
9819
9819
|
/* harmony import */ var _raw__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./raw */ "./adapters/REST/endpoints/raw.ts");
|
|
@@ -9830,34 +9830,50 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
9830
9830
|
|
|
9831
9831
|
|
|
9832
9832
|
|
|
9833
|
-
var
|
|
9834
|
-
return "/spaces/".concat(params.spaceId, "/environments/").concat(params.environmentId
|
|
9833
|
+
var getSpaceEnvBaseUrl = function getSpaceEnvBaseUrl(params) {
|
|
9834
|
+
return "/spaces/".concat(params.spaceId, "/environments/").concat(params.environmentId);
|
|
9835
|
+
};
|
|
9836
|
+
var getEntryBaseUrl = function getEntryBaseUrl(params) {
|
|
9837
|
+
return "".concat(getSpaceEnvBaseUrl(params), "/entries/").concat(params.entryId, "/comments");
|
|
9838
|
+
};
|
|
9839
|
+
var getEntryCommentUrl = function getEntryCommentUrl(params) {
|
|
9840
|
+
return "".concat(getEntryBaseUrl(params), "/").concat(params.commentId);
|
|
9835
9841
|
};
|
|
9836
|
-
|
|
9837
|
-
|
|
9842
|
+
|
|
9843
|
+
/**
|
|
9844
|
+
* Comments can be added to either an entry or a workflow. The latter one requires a version
|
|
9845
|
+
* to be set as part of the URL path. Workflow comments only support `create` (with
|
|
9846
|
+
* versionized URL) and `getMany` (without version). The API might support more methods
|
|
9847
|
+
* in the future with new use cases being discovered.
|
|
9848
|
+
*/
|
|
9849
|
+
var getEntityBaseUrl = function getEntityBaseUrl(params) {
|
|
9850
|
+
if ('entryId' in params) {
|
|
9851
|
+
return getEntryBaseUrl(params);
|
|
9852
|
+
}
|
|
9853
|
+
var parentEntityId = params.parentEntityId,
|
|
9854
|
+
parentEntityType = params.parentEntityType;
|
|
9855
|
+
// No need for mapping or switch-case as long as there are only two supported cases
|
|
9856
|
+
var parentPlural = parentEntityType === 'Workflow' ? 'workflows' : 'entries';
|
|
9857
|
+
var versionPath = 'parentEntityVersion' in params ? "/versions/".concat(params.parentEntityVersion) : '';
|
|
9858
|
+
return "".concat(getSpaceEnvBaseUrl(params), "/").concat(parentPlural, "/").concat(parentEntityId).concat(versionPath, "/comments");
|
|
9838
9859
|
};
|
|
9839
9860
|
var get = function get(http, params) {
|
|
9840
|
-
return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http,
|
|
9861
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http, getEntryCommentUrl(params));
|
|
9841
9862
|
};
|
|
9842
9863
|
var getMany = function getMany(http, params) {
|
|
9843
|
-
return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http,
|
|
9864
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__["get"](http, getEntityBaseUrl(params), {
|
|
9844
9865
|
params: Object(_utils__WEBPACK_IMPORTED_MODULE_2__["normalizeSelect"])(params.query)
|
|
9845
9866
|
});
|
|
9846
9867
|
};
|
|
9847
|
-
|
|
9848
|
-
/**
|
|
9849
|
-
* @deprecated use `getMany` instead. `getAll` may never be removed for app compatibility reasons.
|
|
9850
|
-
*/
|
|
9851
|
-
var getAll = getMany;
|
|
9852
9868
|
var create = function create(http, params, rawData) {
|
|
9853
9869
|
var data = fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(rawData);
|
|
9854
|
-
return _raw__WEBPACK_IMPORTED_MODULE_1__["post"](http,
|
|
9870
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__["post"](http, getEntityBaseUrl(params), data);
|
|
9855
9871
|
};
|
|
9856
9872
|
var update = function update(http, params, rawData, headers) {
|
|
9857
9873
|
var _rawData$sys$version;
|
|
9858
9874
|
var data = fast_copy__WEBPACK_IMPORTED_MODULE_0___default()(rawData);
|
|
9859
9875
|
delete data.sys;
|
|
9860
|
-
return _raw__WEBPACK_IMPORTED_MODULE_1__["put"](http,
|
|
9876
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__["put"](http, getEntryCommentUrl(params), data, {
|
|
9861
9877
|
headers: _objectSpread({
|
|
9862
9878
|
'X-Contentful-Version': (_rawData$sys$version = rawData.sys.version) !== null && _rawData$sys$version !== void 0 ? _rawData$sys$version : 0
|
|
9863
9879
|
}, headers)
|
|
@@ -9866,13 +9882,19 @@ var update = function update(http, params, rawData, headers) {
|
|
|
9866
9882
|
var del = function del(http, _ref) {
|
|
9867
9883
|
var version = _ref.version,
|
|
9868
9884
|
params = _objectWithoutProperties(_ref, _excluded);
|
|
9869
|
-
return _raw__WEBPACK_IMPORTED_MODULE_1__["del"](http,
|
|
9885
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__["del"](http, getEntryCommentUrl(params), {
|
|
9870
9886
|
headers: {
|
|
9871
9887
|
'X-Contentful-Version': version
|
|
9872
9888
|
}
|
|
9873
9889
|
});
|
|
9874
9890
|
};
|
|
9875
9891
|
|
|
9892
|
+
// Add a deprecation notive. But `getAll` may never be removed for app compatibility reasons.
|
|
9893
|
+
/**
|
|
9894
|
+
* @deprecated use `getMany` instead.
|
|
9895
|
+
*/
|
|
9896
|
+
var getAll = getMany;
|
|
9897
|
+
|
|
9876
9898
|
/***/ }),
|
|
9877
9899
|
|
|
9878
9900
|
/***/ "./adapters/REST/endpoints/content-type.ts":
|
|
@@ -13078,7 +13100,7 @@ function createClient(params) {
|
|
|
13078
13100
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
13079
13101
|
var sdkMain = opts.type === 'plain' ? 'contentful-management-plain.js' : 'contentful-management.js';
|
|
13080
13102
|
var userAgent = Object(contentful_sdk_core__WEBPACK_IMPORTED_MODULE_0__["getUserAgentHeader"])( // @ts-expect-error
|
|
13081
|
-
"".concat(sdkMain, "/").concat("10.
|
|
13103
|
+
"".concat(sdkMain, "/").concat("10.22.0"), params.application, params.integration, params.feature);
|
|
13082
13104
|
var adapter = Object(_create_adapter__WEBPACK_IMPORTED_MODULE_1__["createAdapter"])(params);
|
|
13083
13105
|
|
|
13084
13106
|
// Parameters<?> and ReturnType<?> only return the types of the last overload
|
|
@@ -14230,7 +14252,12 @@ function createEntryApi(makeRequest) {
|
|
|
14230
14252
|
return makeRequest({
|
|
14231
14253
|
entityType: 'Comment',
|
|
14232
14254
|
action: 'create',
|
|
14233
|
-
params:
|
|
14255
|
+
params: {
|
|
14256
|
+
spaceId: params.spaceId,
|
|
14257
|
+
environmentId: params.environmentId,
|
|
14258
|
+
parentEntityId: params.entryId,
|
|
14259
|
+
parentEntityType: 'Entry'
|
|
14260
|
+
},
|
|
14234
14261
|
payload: data
|
|
14235
14262
|
}).then(function (data) {
|
|
14236
14263
|
return wrapComment(makeRequest, data);
|