contentful-management 11.2.0 → 11.3.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 +26 -17
- package/dist/contentful-management.browser.js.map +1 -1
- package/dist/contentful-management.browser.min.js +1 -1
- package/dist/contentful-management.node.js +24 -13
- 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 +24 -13
- package/dist/typings/entities/comment.d.ts +4 -1
- package/package.json +2 -2
|
@@ -1186,32 +1186,41 @@ var BODY_FORMAT_HEADER = 'x-contentful-comment-body-format';
|
|
|
1186
1186
|
var getSpaceEnvBaseUrl = function getSpaceEnvBaseUrl(params) {
|
|
1187
1187
|
return "/spaces/".concat(params.spaceId, "/environments/").concat(params.environmentId);
|
|
1188
1188
|
};
|
|
1189
|
-
var
|
|
1190
|
-
return "".concat(
|
|
1191
|
-
};
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1189
|
+
var getEntityCommentUrl = function getEntityCommentUrl(params) {
|
|
1190
|
+
return "".concat(getEntityBaseUrl(params), "/").concat(params.commentId);
|
|
1191
|
+
};
|
|
1192
|
+
function getParentPlural(parentEntityType) {
|
|
1193
|
+
switch (parentEntityType) {
|
|
1194
|
+
case 'ContentType':
|
|
1195
|
+
return 'content_types';
|
|
1196
|
+
case 'Entry':
|
|
1197
|
+
return 'entries';
|
|
1198
|
+
case 'Workflow':
|
|
1199
|
+
return 'workflows';
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1195
1202
|
|
|
1196
1203
|
/**
|
|
1197
|
-
* Comments can be added to
|
|
1204
|
+
* Comments can be added to a content type, an entry, and a workflow. Workflow comments requires a version
|
|
1198
1205
|
* to be set as part of the URL path. Workflow comments only support `create` (with
|
|
1199
1206
|
* versionized URL) and `getMany` (without version). The API might support more methods
|
|
1200
1207
|
* in the future with new use cases being discovered.
|
|
1201
1208
|
*/
|
|
1202
|
-
var getEntityBaseUrl = function getEntityBaseUrl(
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1209
|
+
var getEntityBaseUrl = function getEntityBaseUrl(paramsOrg) {
|
|
1210
|
+
var params = 'entryId' in paramsOrg ? {
|
|
1211
|
+
spaceId: paramsOrg.spaceId,
|
|
1212
|
+
environmentId: paramsOrg.environmentId,
|
|
1213
|
+
parentEntityType: 'Entry',
|
|
1214
|
+
parentEntityId: paramsOrg.entryId
|
|
1215
|
+
} : paramsOrg;
|
|
1206
1216
|
var parentEntityId = params.parentEntityId,
|
|
1207
1217
|
parentEntityType = params.parentEntityType;
|
|
1208
|
-
|
|
1209
|
-
var parentPlural = parentEntityType === 'Workflow' ? 'workflows' : 'entries';
|
|
1218
|
+
var parentPlural = getParentPlural(parentEntityType);
|
|
1210
1219
|
var versionPath = 'parentEntityVersion' in params ? "/versions/".concat(params.parentEntityVersion) : '';
|
|
1211
1220
|
return "".concat(getSpaceEnvBaseUrl(params), "/").concat(parentPlural, "/").concat(parentEntityId).concat(versionPath, "/comments");
|
|
1212
1221
|
};
|
|
1213
1222
|
var get = function get(http, params) {
|
|
1214
|
-
return _raw__WEBPACK_IMPORTED_MODULE_1__.get(http,
|
|
1223
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__.get(http, getEntityCommentUrl(params), {
|
|
1215
1224
|
headers: params.bodyFormat === 'rich-text' ? _defineProperty({}, BODY_FORMAT_HEADER, params.bodyFormat) : {}
|
|
1216
1225
|
});
|
|
1217
1226
|
};
|
|
@@ -1231,7 +1240,7 @@ var update = function update(http, params, rawData, headers) {
|
|
|
1231
1240
|
var _rawData$sys$version;
|
|
1232
1241
|
var data = (0,fast_copy__WEBPACK_IMPORTED_MODULE_0__["default"])(rawData);
|
|
1233
1242
|
delete data.sys;
|
|
1234
|
-
return _raw__WEBPACK_IMPORTED_MODULE_1__.put(http,
|
|
1243
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__.put(http, getEntityCommentUrl(params), data, {
|
|
1235
1244
|
headers: _objectSpread(_objectSpread({
|
|
1236
1245
|
'X-Contentful-Version': (_rawData$sys$version = rawData.sys.version) !== null && _rawData$sys$version !== void 0 ? _rawData$sys$version : 0
|
|
1237
1246
|
}, typeof rawData.body !== 'string' ? _defineProperty({}, BODY_FORMAT_HEADER, 'rich-text') : {}), headers)
|
|
@@ -1240,14 +1249,14 @@ var update = function update(http, params, rawData, headers) {
|
|
|
1240
1249
|
var del = function del(http, _ref5) {
|
|
1241
1250
|
var version = _ref5.version,
|
|
1242
1251
|
params = _objectWithoutProperties(_ref5, _excluded);
|
|
1243
|
-
return _raw__WEBPACK_IMPORTED_MODULE_1__.del(http,
|
|
1252
|
+
return _raw__WEBPACK_IMPORTED_MODULE_1__.del(http, getEntityCommentUrl(params), {
|
|
1244
1253
|
headers: {
|
|
1245
1254
|
'X-Contentful-Version': version
|
|
1246
1255
|
}
|
|
1247
1256
|
});
|
|
1248
1257
|
};
|
|
1249
1258
|
|
|
1250
|
-
// Add a deprecation
|
|
1259
|
+
// Add a deprecation notice. But `getAll` may never be removed for app compatibility reasons.
|
|
1251
1260
|
/**
|
|
1252
1261
|
* @deprecated use `getMany` instead.
|
|
1253
1262
|
*/
|