contentful-management 12.6.0-dev.3 → 12.6.0-dev.4

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.
Files changed (52) hide show
  1. package/dist/browser/index.js +2201 -1260
  2. package/dist/browser/index.js.map +1 -1
  3. package/dist/browser/index.min.js +1 -1
  4. package/dist/browser/index.min.js.map +1 -1
  5. package/dist/cjs/index.cjs +92 -19
  6. package/dist/cjs/index.cjs.map +1 -1
  7. package/dist/esm/adapters/REST/endpoints/asset.mjs +12 -1
  8. package/dist/esm/adapters/REST/endpoints/asset.mjs.map +1 -1
  9. package/dist/esm/adapters/REST/endpoints/comment.mjs +10 -2
  10. package/dist/esm/adapters/REST/endpoints/comment.mjs.map +1 -1
  11. package/dist/esm/adapters/REST/endpoints/content-type.mjs +9 -1
  12. package/dist/esm/adapters/REST/endpoints/content-type.mjs.map +1 -1
  13. package/dist/esm/adapters/REST/endpoints/entry.mjs +12 -1
  14. package/dist/esm/adapters/REST/endpoints/entry.mjs.map +1 -1
  15. package/dist/esm/adapters/REST/endpoints/task.mjs +28 -1
  16. package/dist/esm/adapters/REST/endpoints/task.mjs.map +1 -1
  17. package/dist/esm/common-types.mjs.map +1 -1
  18. package/dist/esm/entities/ai-action-invocation.mjs.map +1 -1
  19. package/dist/esm/entities/ai-action.mjs.map +1 -1
  20. package/dist/esm/entities/comment.mjs +10 -6
  21. package/dist/esm/entities/comment.mjs.map +1 -1
  22. package/dist/esm/entities/task.mjs +10 -6
  23. package/dist/esm/entities/task.mjs.map +1 -1
  24. package/dist/types/adapters/REST/endpoints/asset.d.ts +1 -0
  25. package/dist/types/adapters/REST/endpoints/asset.js +12 -1
  26. package/dist/types/adapters/REST/endpoints/asset.js.map +1 -1
  27. package/dist/types/adapters/REST/endpoints/comment.js +10 -2
  28. package/dist/types/adapters/REST/endpoints/comment.js.map +1 -1
  29. package/dist/types/adapters/REST/endpoints/content-type.d.ts +1 -0
  30. package/dist/types/adapters/REST/endpoints/content-type.js +9 -1
  31. package/dist/types/adapters/REST/endpoints/content-type.js.map +1 -1
  32. package/dist/types/adapters/REST/endpoints/entry.d.ts +1 -0
  33. package/dist/types/adapters/REST/endpoints/entry.js +12 -1
  34. package/dist/types/adapters/REST/endpoints/entry.js.map +1 -1
  35. package/dist/types/adapters/REST/endpoints/task.js +28 -1
  36. package/dist/types/adapters/REST/endpoints/task.js.map +1 -1
  37. package/dist/types/common-types.d.ts +9 -4
  38. package/dist/types/common-types.js.map +1 -1
  39. package/dist/types/constants/editor-interface-defaults/controls-defaults.d.ts +1 -1
  40. package/dist/types/entities/ai-action-invocation.d.ts +37 -18
  41. package/dist/types/entities/ai-action-invocation.js.map +1 -1
  42. package/dist/types/entities/ai-action.d.ts +4 -1
  43. package/dist/types/entities/ai-action.js.map +1 -1
  44. package/dist/types/entities/comment.d.ts +4 -6
  45. package/dist/types/entities/comment.js +10 -6
  46. package/dist/types/entities/comment.js.map +1 -1
  47. package/dist/types/entities/task.d.ts +5 -3
  48. package/dist/types/entities/task.js +10 -6
  49. package/dist/types/entities/task.js.map +1 -1
  50. package/dist/types/export-types.d.ts +7 -7
  51. package/dist/types/plain/entities/task.d.ts +77 -8
  52. package/package.json +2 -2
@@ -1159,6 +1159,16 @@ const getMany$I = (http, params, rawData, headers) => {
1159
1159
  headers: headers ? { ...headers } : undefined,
1160
1160
  });
1161
1161
  };
1162
+ const getManyWithCursor$2 = (http, params, rawData, headers) => {
1163
+ if (params.releaseId) {
1164
+ throw new Error('getManyWithCursor is not supported for release-scoped assets');
1165
+ }
1166
+ return get$19(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/assets`, {
1167
+ params: { cursor: true, ...(params.query ?? {}) },
1168
+ headers: headers ? { ...headers } : undefined,
1169
+ })
1170
+ .then(normalizeCursorPaginationResponse);
1171
+ };
1162
1172
  const update$u = (http, params, rawData, headers) => {
1163
1173
  if (params.releaseId) {
1164
1174
  return update$v(http, params, rawData, headers ?? {});
@@ -1342,6 +1352,7 @@ var Asset = /*#__PURE__*/Object.freeze({
1342
1352
  del: del$y,
1343
1353
  get: get$Q,
1344
1354
  getMany: getMany$I,
1355
+ getManyWithCursor: getManyWithCursor$2,
1345
1356
  getPublished: getPublished$2,
1346
1357
  processForAllLocales: processForAllLocales,
1347
1358
  processForLocale: processForLocale,
@@ -1438,9 +1449,9 @@ const VERSION_HEADER = 'X-Contentful-Version';
1438
1449
  const BODY_FORMAT_HEADER = 'x-contentful-comment-body-format';
1439
1450
  const PARENT_ENTITY_REFERENCE_HEADER = 'x-contentful-parent-entity-reference';
1440
1451
  const PARENT_COMMENT_ID_HEADER = 'x-contentful-parent-id';
1441
- const getSpaceEnvBaseUrl = (params) => `/spaces/${params.spaceId}/environments/${params.environmentId}`;
1452
+ const getSpaceEnvBaseUrl$1 = (params) => `/spaces/${params.spaceId}/environments/${params.environmentId}`;
1442
1453
  const getEntityCommentUrl = (params) => `${getEntityBaseUrl(params)}/${params.commentId}`;
1443
- function getParentPlural(parentEntityType) {
1454
+ function getParentPlural$1(parentEntityType) {
1444
1455
  switch (parentEntityType) {
1445
1456
  case 'ContentType':
1446
1457
  return 'content_types';
@@ -1448,11 +1459,19 @@ function getParentPlural(parentEntityType) {
1448
1459
  return 'entries';
1449
1460
  case 'Workflow':
1450
1461
  return 'workflows';
1462
+ case 'Experience':
1463
+ return 'experiences';
1464
+ case 'Fragment':
1465
+ return 'fragments';
1466
+ case 'ComponentType':
1467
+ return 'component_types';
1468
+ case 'Template':
1469
+ return 'templates';
1451
1470
  }
1452
1471
  }
1453
1472
  /**
1454
- * Comments can be added to a content type, an entry, and a workflow. Workflow comments requires a version
1455
- * to be set as part of the URL path. Workflow comments only support `create` (with
1473
+ * Comments can be added to a content type, an entry, a workflow, or ExO entities. Workflow comments requires a version
1474
+ * to be set as part of the URL path for versioned operations. Workflow comments only support `create` (with
1456
1475
  * versionized URL) and `getMany` (without version). The API might support more methods
1457
1476
  * in the future with new use cases being discovered.
1458
1477
  */
@@ -1466,9 +1485,9 @@ const getEntityBaseUrl = (paramsOrg) => {
1466
1485
  }
1467
1486
  : paramsOrg;
1468
1487
  const { parentEntityId, parentEntityType } = params;
1469
- const parentPlural = getParentPlural(parentEntityType);
1488
+ const parentPlural = getParentPlural$1(parentEntityType);
1470
1489
  const versionPath = 'parentEntityVersion' in params ? `/versions/${params.parentEntityVersion}` : '';
1471
- return `${getSpaceEnvBaseUrl(params)}/${parentPlural}/${parentEntityId}${versionPath}/comments`;
1490
+ return `${getSpaceEnvBaseUrl$1(params)}/${parentPlural}/${parentEntityId}${versionPath}/comments`;
1472
1491
  };
1473
1492
  const get$O = (http, params) => get$19(http, getEntityCommentUrl(params), {
1474
1493
  headers: params.bodyFormat === 'rich-text'
@@ -1725,6 +1744,13 @@ const getMany$C = (http, params, headers) => {
1725
1744
  headers,
1726
1745
  });
1727
1746
  };
1747
+ const getManyWithCursor$1 = (http, params, headers) => {
1748
+ return get$19(http, getBaseUrl$n(params), {
1749
+ params: { cursor: true, ...(params.query ?? {}) },
1750
+ headers,
1751
+ })
1752
+ .then(normalizeCursorPaginationResponse);
1753
+ };
1728
1754
  const create$r = (http, params, rawData, headers) => {
1729
1755
  const data = copy__default.default(rawData);
1730
1756
  return post$1(http, getBaseUrl$n(params), data, { headers });
@@ -1765,6 +1791,7 @@ var ContentType = /*#__PURE__*/Object.freeze({
1765
1791
  del: del$t,
1766
1792
  get: get$K,
1767
1793
  getMany: getMany$C,
1794
+ getManyWithCursor: getManyWithCursor$1,
1768
1795
  publish: publish$6,
1769
1796
  unpublish: unpublish$6,
1770
1797
  update: update$q
@@ -1961,6 +1988,16 @@ const getMany$x = (http, params, rawData, headers) => {
1961
1988
  headers: { ...headers },
1962
1989
  });
1963
1990
  };
1991
+ const getManyWithCursor = (http, params, rawData, headers) => {
1992
+ if (params.releaseId) {
1993
+ throw new Error('getManyWithCursor is not supported for release-scoped entries');
1994
+ }
1995
+ return get$19(http, `/spaces/${params.spaceId}/environments/${params.environmentId}/entries`, {
1996
+ params: { cursor: true, ...(params.query ?? {}) },
1997
+ headers: { ...headers },
1998
+ })
1999
+ .then(normalizeCursorPaginationResponse);
2000
+ };
1964
2001
  const patch$1 = (http, params, data, headers) => {
1965
2002
  if (params.releaseId) {
1966
2003
  return patch$2(http, params, data, headers ?? {});
@@ -2052,6 +2089,7 @@ var Entry = /*#__PURE__*/Object.freeze({
2052
2089
  del: del$r,
2053
2090
  get: get$G,
2054
2091
  getMany: getMany$x,
2092
+ getManyWithCursor: getManyWithCursor,
2055
2093
  getPublished: getPublished,
2056
2094
  patch: patch$1,
2057
2095
  publish: publish$4,
@@ -3261,7 +3299,34 @@ var Tag = /*#__PURE__*/Object.freeze({
3261
3299
  update: update$9
3262
3300
  });
3263
3301
 
3264
- const getBaseUrl$a = (params) => `/spaces/${params.spaceId}/environments/${params.environmentId}/entries/${params.entryId}/tasks`;
3302
+ const getSpaceEnvBaseUrl = (params) => `/spaces/${params.spaceId}/environments/${params.environmentId}`;
3303
+ function getParentPlural(parentEntityType) {
3304
+ switch (parentEntityType) {
3305
+ case 'Entry':
3306
+ return 'entries';
3307
+ case 'Experience':
3308
+ return 'experiences';
3309
+ case 'Fragment':
3310
+ return 'fragments';
3311
+ case 'Template':
3312
+ return 'templates';
3313
+ case 'ComponentType':
3314
+ return 'component_types';
3315
+ }
3316
+ }
3317
+ const normalizeTaskParentParams = (paramsOrg) => 'entryId' in paramsOrg
3318
+ ? {
3319
+ spaceId: paramsOrg.spaceId,
3320
+ environmentId: paramsOrg.environmentId,
3321
+ parentEntityType: 'Entry',
3322
+ parentEntityId: paramsOrg.entryId,
3323
+ }
3324
+ : paramsOrg;
3325
+ const getBaseUrl$a = (paramsOrg) => {
3326
+ const params = normalizeTaskParentParams(paramsOrg);
3327
+ const parentPlural = getParentPlural(params.parentEntityType);
3328
+ return `${getSpaceEnvBaseUrl(params)}/${parentPlural}/${params.parentEntityId}/tasks`;
3329
+ };
3265
3330
  const getTaskUrl = (params) => `${getBaseUrl$a(params)}/${params.taskId}`;
3266
3331
  const get$a = (http, params) => get$19(http, getTaskUrl(params));
3267
3332
  const getMany$8 = (http, params) => get$19(http, getBaseUrl$a(params), {
@@ -4724,12 +4789,16 @@ const wrapContentTypeCursorPaginatedCollection = wrapCursorPaginatedCollection(w
4724
4789
  * @internal
4725
4790
  */
4726
4791
  function createTaskApi(makeRequest) {
4727
- const getParams = (task) => ({
4728
- spaceId: task.sys.space.sys.id,
4729
- environmentId: task.sys.environment.sys.id,
4730
- entryId: task.sys.parentEntity.sys.id,
4731
- taskId: task.sys.id,
4732
- });
4792
+ const getParams = (task) => {
4793
+ const parentEntity = task.sys.parentEntity;
4794
+ return {
4795
+ spaceId: task.sys.space.sys.id,
4796
+ environmentId: task.sys.environment.sys.id,
4797
+ parentEntityType: parentEntity.sys.linkType,
4798
+ parentEntityId: parentEntity.sys.id,
4799
+ taskId: task.sys.id,
4800
+ };
4801
+ };
4733
4802
  return {
4734
4803
  update: function () {
4735
4804
  const raw = this.toPlainObject();
@@ -4779,12 +4848,16 @@ var CommentNode;
4779
4848
  * @internal
4780
4849
  */
4781
4850
  function createCommentApi(makeRequest) {
4782
- const getParams = (comment) => ({
4783
- spaceId: comment.sys.space.sys.id,
4784
- environmentId: comment.sys.environment.sys.id,
4785
- entryId: comment.sys.parentEntity.sys.id,
4786
- commentId: comment.sys.id,
4787
- });
4851
+ const getParams = (comment) => {
4852
+ const parentEntity = comment.sys.parentEntity;
4853
+ return {
4854
+ spaceId: comment.sys.space.sys.id,
4855
+ environmentId: comment.sys.environment.sys.id,
4856
+ commentId: comment.sys.id,
4857
+ parentEntityType: parentEntity.sys.linkType,
4858
+ parentEntityId: parentEntity.sys.id,
4859
+ };
4860
+ };
4788
4861
  return {
4789
4862
  update: async function () {
4790
4863
  const raw = this.toPlainObject();