@strapi/content-manager 0.0.0-next.8f63e1055db761e0213cb6610f80c55658196ae1 → 0.0.0-next.926e9af9369b89a571145e3c8fa1ce6bfd6cc0ab

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 (160) hide show
  1. package/dist/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
  2. package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
  3. package/dist/_chunks/{ComponentConfigurationPage-Cmm0LJof.js → ComponentConfigurationPage-DMxUlNOo.js} +4 -5
  4. package/dist/_chunks/{ComponentConfigurationPage-Cmm0LJof.js.map → ComponentConfigurationPage-DMxUlNOo.js.map} +1 -1
  5. package/dist/_chunks/{ComponentConfigurationPage-FQd019My.mjs → ComponentConfigurationPage-baEkO-OV.mjs} +3 -3
  6. package/dist/_chunks/{ComponentConfigurationPage-FQd019My.mjs.map → ComponentConfigurationPage-baEkO-OV.mjs.map} +1 -1
  7. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
  8. package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
  9. package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
  10. package/dist/_chunks/{EditConfigurationPage-CseHna9y.js → EditConfigurationPage-CXxV7mKn.js} +4 -5
  11. package/dist/_chunks/{EditConfigurationPage-CseHna9y.js.map → EditConfigurationPage-CXxV7mKn.js.map} +1 -1
  12. package/dist/_chunks/{EditConfigurationPage-BUJqRuRq.mjs → EditConfigurationPage-YR8-4VCS.mjs} +3 -3
  13. package/dist/_chunks/{EditConfigurationPage-BUJqRuRq.mjs.map → EditConfigurationPage-YR8-4VCS.mjs.map} +1 -1
  14. package/dist/_chunks/{EditViewPage-BhjvFXZr.js → EditViewPage-BfR6jAR6.js} +22 -78
  15. package/dist/_chunks/EditViewPage-BfR6jAR6.js.map +1 -0
  16. package/dist/_chunks/{EditViewPage-BB9VeS-u.mjs → EditViewPage-DFF7c27p.mjs} +19 -74
  17. package/dist/_chunks/EditViewPage-DFF7c27p.mjs.map +1 -0
  18. package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
  19. package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
  20. package/dist/_chunks/{Form-DH5m7r5s.js → Form-CjcMRP5A.js} +5 -6
  21. package/dist/_chunks/{Form-DH5m7r5s.js.map → Form-CjcMRP5A.js.map} +1 -1
  22. package/dist/_chunks/{Form-B5b7zgoL.mjs → Form-MSOSfGGN.mjs} +3 -3
  23. package/dist/_chunks/{Form-B5b7zgoL.mjs.map → Form-MSOSfGGN.mjs.map} +1 -1
  24. package/dist/_chunks/{History-CNO4Db6U.js → History-BgZ7gVuF.js} +48 -72
  25. package/dist/_chunks/History-BgZ7gVuF.js.map +1 -0
  26. package/dist/_chunks/{History-Dhy0xF0L.mjs → History-WOQNVho-.mjs} +37 -60
  27. package/dist/_chunks/History-WOQNVho-.mjs.map +1 -0
  28. package/dist/_chunks/{Field-CWi7XMCa.mjs → Input-BkKwZ6Qt.mjs} +1245 -1243
  29. package/dist/_chunks/Input-BkKwZ6Qt.mjs.map +1 -0
  30. package/dist/_chunks/{Field-B03STsf9.js → Input-BwOibhc3.js} +1331 -1329
  31. package/dist/_chunks/Input-BwOibhc3.js.map +1 -0
  32. package/dist/_chunks/{ListConfigurationPage-C_FCilGf.mjs → ListConfigurationPage-BeXfr6uW.mjs} +6 -5
  33. package/dist/_chunks/ListConfigurationPage-BeXfr6uW.mjs.map +1 -0
  34. package/dist/_chunks/{ListConfigurationPage-DE7NESsr.js → ListConfigurationPage-DnJ3nbwL.js} +6 -6
  35. package/dist/_chunks/ListConfigurationPage-DnJ3nbwL.js.map +1 -0
  36. package/dist/_chunks/{ListViewPage-C7p0PteR.js → ListViewPage-CJFDudKl.js} +61 -58
  37. package/dist/_chunks/ListViewPage-CJFDudKl.js.map +1 -0
  38. package/dist/_chunks/{ListViewPage-B6Ut2BH0.mjs → ListViewPage-VK2v44Q1.mjs} +55 -51
  39. package/dist/_chunks/ListViewPage-VK2v44Q1.mjs.map +1 -0
  40. package/dist/_chunks/{NoContentTypePage-rR7QwWP5.mjs → NoContentTypePage-T8ttty6K.mjs} +2 -2
  41. package/dist/_chunks/{NoContentTypePage-rR7QwWP5.mjs.map → NoContentTypePage-T8ttty6K.mjs.map} +1 -1
  42. package/dist/_chunks/{NoContentTypePage-BN-8niig.js → NoContentTypePage-en2PwWgI.js} +2 -2
  43. package/dist/_chunks/{NoContentTypePage-BN-8niig.js.map → NoContentTypePage-en2PwWgI.js.map} +1 -1
  44. package/dist/_chunks/{NoPermissionsPage-Bw3b0OQm.js → NoPermissionsPage-CcjILry3.js} +2 -2
  45. package/dist/_chunks/{NoPermissionsPage-Bw3b0OQm.js.map → NoPermissionsPage-CcjILry3.js.map} +1 -1
  46. package/dist/_chunks/{NoPermissionsPage-CGUgxmce.mjs → NoPermissionsPage-CokBHhhy.mjs} +2 -2
  47. package/dist/_chunks/{NoPermissionsPage-CGUgxmce.mjs.map → NoPermissionsPage-CokBHhhy.mjs.map} +1 -1
  48. package/dist/_chunks/{Preview-_gomrUna.mjs → Preview-BF81YhRj.mjs} +75 -76
  49. package/dist/_chunks/Preview-BF81YhRj.mjs.map +1 -0
  50. package/dist/_chunks/{Preview-CICG4cRf.js → Preview-DgzAuzWQ.js} +74 -76
  51. package/dist/_chunks/Preview-DgzAuzWQ.js.map +1 -0
  52. package/dist/_chunks/{Relations-uyLoal2t.js → Relations-1O-JcM4t.js} +7 -10
  53. package/dist/_chunks/{Relations-uyLoal2t.js.map → Relations-1O-JcM4t.js.map} +1 -1
  54. package/dist/_chunks/{Relations-BEvinUkU.mjs → Relations-BncdhGCd.mjs} +6 -8
  55. package/dist/_chunks/{Relations-BEvinUkU.mjs.map → Relations-BncdhGCd.mjs.map} +1 -1
  56. package/dist/_chunks/{en-D_BMf0hT.mjs → en-BZaUty0m.mjs} +12 -3
  57. package/dist/_chunks/{en-D_BMf0hT.mjs.map → en-BZaUty0m.mjs.map} +1 -1
  58. package/dist/_chunks/{en-CHOp_xJv.js → en-CzCnBk4S.js} +12 -3
  59. package/dist/_chunks/{en-CHOp_xJv.js.map → en-CzCnBk4S.js.map} +1 -1
  60. package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
  61. package/dist/_chunks/{index-BagcPV6I.mjs → index-DiluOUp6.mjs} +462 -226
  62. package/dist/_chunks/index-DiluOUp6.mjs.map +1 -0
  63. package/dist/_chunks/{index-D_AvCmmG.js → index-EXJvmn4t.js} +445 -210
  64. package/dist/_chunks/index-EXJvmn4t.js.map +1 -0
  65. package/dist/_chunks/{layout-Dk0odfYR.js → layout-4TbKVax8.js} +5 -6
  66. package/dist/_chunks/{layout-Dk0odfYR.js.map → layout-4TbKVax8.js.map} +1 -1
  67. package/dist/_chunks/{layout-DKEX3X49.mjs → layout-mSwsYzxv.mjs} +4 -4
  68. package/dist/_chunks/{layout-DKEX3X49.mjs.map → layout-mSwsYzxv.mjs.map} +1 -1
  69. package/dist/_chunks/objects-BcXOv6_9.js.map +1 -1
  70. package/dist/_chunks/objects-D6yBsdmx.mjs.map +1 -1
  71. package/dist/_chunks/{relations-DDoMdwk6.mjs → relations--YOvQBqv.mjs} +2 -2
  72. package/dist/_chunks/{relations-DDoMdwk6.mjs.map → relations--YOvQBqv.mjs.map} +1 -1
  73. package/dist/_chunks/{relations-C312DwGU.js → relations-Ai6Izh7h.js} +2 -2
  74. package/dist/_chunks/{relations-C312DwGU.js.map → relations-Ai6Izh7h.js.map} +1 -1
  75. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
  76. package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
  77. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
  78. package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
  79. package/dist/_chunks/{useDebounce-DmuSJIF3.mjs → usePrev-CZGy2Vjf.mjs} +11 -11
  80. package/dist/_chunks/usePrev-CZGy2Vjf.mjs.map +1 -0
  81. package/dist/_chunks/{useDebounce-CtcjDB3L.js → usePrev-D5J_2fEu.js} +8 -8
  82. package/dist/_chunks/usePrev-D5J_2fEu.js.map +1 -0
  83. package/dist/admin/index.js +2 -1
  84. package/dist/admin/index.js.map +1 -1
  85. package/dist/admin/index.mjs +6 -5
  86. package/dist/admin/src/content-manager.d.ts +3 -2
  87. package/dist/admin/src/exports.d.ts +1 -0
  88. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  89. package/dist/admin/src/hooks/useDocument.d.ts +19 -2
  90. package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -1
  91. package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +3 -3
  92. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.d.ts +7 -0
  93. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/Blocks/utils/prismLanguages.d.ts +49 -0
  94. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +1 -0
  95. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.d.ts +4 -1
  96. package/dist/admin/src/pages/EditView/components/FormInputs/DynamicZone/Field.d.ts +4 -1
  97. package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +27 -0
  98. package/dist/admin/src/pages/EditView/utils/data.d.ts +1 -0
  99. package/dist/admin/src/preview/pages/Preview.d.ts +1 -1
  100. package/dist/admin/src/preview/services/preview.d.ts +1 -1
  101. package/dist/admin/src/router.d.ts +1 -1
  102. package/dist/admin/src/services/api.d.ts +1 -1
  103. package/dist/admin/src/services/components.d.ts +2 -2
  104. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  105. package/dist/admin/src/services/documents.d.ts +16 -19
  106. package/dist/admin/src/services/init.d.ts +1 -1
  107. package/dist/admin/src/services/relations.d.ts +2 -2
  108. package/dist/admin/src/services/uid.d.ts +3 -3
  109. package/dist/server/index.js +230 -187
  110. package/dist/server/index.js.map +1 -1
  111. package/dist/server/index.mjs +231 -187
  112. package/dist/server/index.mjs.map +1 -1
  113. package/dist/server/src/controllers/utils/metadata.d.ts +1 -0
  114. package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
  115. package/dist/server/src/history/controllers/history-version.d.ts +1 -1
  116. package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
  117. package/dist/server/src/history/services/history.d.ts +3 -3
  118. package/dist/server/src/history/services/history.d.ts.map +1 -1
  119. package/dist/server/src/history/services/utils.d.ts +6 -10
  120. package/dist/server/src/history/services/utils.d.ts.map +1 -1
  121. package/dist/server/src/index.d.ts +3 -2
  122. package/dist/server/src/index.d.ts.map +1 -1
  123. package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
  124. package/dist/server/src/preview/index.d.ts.map +1 -1
  125. package/dist/server/src/preview/services/index.d.ts +1 -0
  126. package/dist/server/src/preview/services/index.d.ts.map +1 -1
  127. package/dist/server/src/preview/services/preview-config.d.ts +2 -0
  128. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
  129. package/dist/server/src/preview/utils.d.ts +1 -0
  130. package/dist/server/src/preview/utils.d.ts.map +1 -1
  131. package/dist/server/src/register.d.ts.map +1 -1
  132. package/dist/server/src/services/document-manager.d.ts.map +1 -1
  133. package/dist/server/src/services/document-metadata.d.ts +4 -2
  134. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  135. package/dist/server/src/services/index.d.ts +3 -2
  136. package/dist/server/src/services/index.d.ts.map +1 -1
  137. package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
  138. package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
  139. package/dist/server/src/services/utils/populate.d.ts +2 -2
  140. package/dist/server/src/services/utils/populate.d.ts.map +1 -1
  141. package/package.json +12 -11
  142. package/dist/_chunks/EditViewPage-BB9VeS-u.mjs.map +0 -1
  143. package/dist/_chunks/EditViewPage-BhjvFXZr.js.map +0 -1
  144. package/dist/_chunks/Field-B03STsf9.js.map +0 -1
  145. package/dist/_chunks/Field-CWi7XMCa.mjs.map +0 -1
  146. package/dist/_chunks/History-CNO4Db6U.js.map +0 -1
  147. package/dist/_chunks/History-Dhy0xF0L.mjs.map +0 -1
  148. package/dist/_chunks/ListConfigurationPage-C_FCilGf.mjs.map +0 -1
  149. package/dist/_chunks/ListConfigurationPage-DE7NESsr.js.map +0 -1
  150. package/dist/_chunks/ListViewPage-B6Ut2BH0.mjs.map +0 -1
  151. package/dist/_chunks/ListViewPage-C7p0PteR.js.map +0 -1
  152. package/dist/_chunks/Preview-CICG4cRf.js.map +0 -1
  153. package/dist/_chunks/Preview-_gomrUna.mjs.map +0 -1
  154. package/dist/_chunks/index-BagcPV6I.mjs.map +0 -1
  155. package/dist/_chunks/index-D_AvCmmG.js.map +0 -1
  156. package/dist/_chunks/useDebounce-CtcjDB3L.js.map +0 -1
  157. package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +0 -1
  158. package/dist/admin/src/preview/constants.d.ts +0 -1
  159. package/dist/server/src/preview/constants.d.ts +0 -2
  160. package/dist/server/src/preview/constants.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
- import strapiUtils, { validateYupSchema, errors, async, contentTypes as contentTypes$1, yup as yup$1, validateYupSchemaSync, policy, traverse, setCreatorFields, isOperatorOfType, relations as relations$1, traverseEntity, pagination } from "@strapi/utils";
2
- import { pick, omit, difference, castArray, intersection, pipe, propOr, isEqual, isEmpty, set, isNil as isNil$1, has, prop, assoc, mapValues, flow, uniq, uniqBy, concat, getOr, propEq, merge, groupBy } from "lodash/fp";
1
+ import strapiUtils, { validateYupSchema, errors, async, contentTypes as contentTypes$1, traverseEntity, yup as yup$1, validateYupSchemaSync, policy, traverse, setCreatorFields, isOperatorOfType, relations as relations$1, pagination } from "@strapi/utils";
2
+ import { pick, omit, difference, castArray, mergeWith, intersection, pipe, propOr, isEqual, isEmpty, set, isNil as isNil$1, has, prop, assoc, mapValues, flow, uniq, uniqBy, concat, getOr, propEq, merge, groupBy } from "lodash/fp";
3
3
  import "@strapi/types";
4
4
  import * as yup from "yup";
5
5
  import { scheduleJob } from "node-schedule";
@@ -141,8 +141,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
141
141
  };
142
142
  const getRelationRestoreValue = async (versionRelationData, attribute) => {
143
143
  if (Array.isArray(versionRelationData)) {
144
- if (versionRelationData.length === 0)
145
- return versionRelationData;
144
+ if (versionRelationData.length === 0) return versionRelationData;
146
145
  const existingAndMissingRelations = await Promise.all(
147
146
  versionRelationData.map((relation) => {
148
147
  return strapi2.documents(attribute.target).findOne({
@@ -151,19 +150,16 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
151
150
  });
152
151
  })
153
152
  );
154
- return existingAndMissingRelations.filter(
155
- (relation) => relation !== null
156
- );
153
+ return existingAndMissingRelations.filter((relation) => relation !== null);
157
154
  }
158
155
  return strapi2.documents(attribute.target).findOne({
159
156
  documentId: versionRelationData.documentId,
160
157
  locale: versionRelationData.locale || void 0
161
158
  });
162
159
  };
163
- const getMediaRestoreValue = async (versionRelationData, attribute) => {
164
- if (attribute.multiple) {
160
+ const getMediaRestoreValue = async (versionRelationData) => {
161
+ if (Array.isArray(versionRelationData)) {
165
162
  const existingAndMissingMedias = await Promise.all(
166
- // @ts-expect-error Fix the type definitions so this isn't any
167
163
  versionRelationData.map((media) => {
168
164
  return strapi2.db.query("plugin::upload.file").findOne({ where: { id: media.id } });
169
165
  })
@@ -177,8 +173,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
177
173
  const getDefaultLocale = async () => localesService ? localesService.getDefaultLocale() : null;
178
174
  const isLocalizedContentType = (model) => i18nContentTypeService ? i18nContentTypeService.isLocalizedContentType(model) : false;
179
175
  const getLocaleDictionary = async () => {
180
- if (!localesService)
181
- return {};
176
+ if (!localesService) return {};
182
177
  const locales = await localesService.find() || [];
183
178
  return locales.reduce(
184
179
  (acc, locale) => {
@@ -333,8 +328,8 @@ const createHistoryService = ({ strapi: strapi2 }) => {
333
328
  });
334
329
  },
335
330
  async findVersionsPage(params) {
336
- const model = strapi2.getModel(params.query.contentType);
337
- const isLocalizedContentType = serviceUtils.isLocalizedContentType(model);
331
+ const schema = strapi2.getModel(params.query.contentType);
332
+ const isLocalizedContentType = serviceUtils.isLocalizedContentType(schema);
338
333
  const defaultLocale = await serviceUtils.getDefaultLocale();
339
334
  let locale = null;
340
335
  if (isLocalizedContentType) {
@@ -355,32 +350,20 @@ const createHistoryService = ({ strapi: strapi2 }) => {
355
350
  }),
356
351
  serviceUtils.getLocaleDictionary()
357
352
  ]);
358
- const populateEntryRelations = async (entry) => {
359
- const entryWithRelations = await Object.entries(entry.schema).reduce(
360
- async (currentDataWithRelations, [attributeKey, attributeSchema]) => {
361
- const attributeValue = entry.data[attributeKey];
362
- const attributeValues = Array.isArray(attributeValue) ? attributeValue : [attributeValue];
363
- if (attributeSchema.type === "media") {
364
- const permissionChecker2 = getService$2("permission-checker").create({
365
- userAbility: params.state.userAbility,
366
- model: "plugin::upload.file"
367
- });
368
- const response = await serviceUtils.buildMediaResponse(attributeValues);
369
- const sanitizedResults = await Promise.all(
370
- response.results.map((media) => permissionChecker2.sanitizeOutput(media))
371
- );
372
- return {
373
- ...await currentDataWithRelations,
374
- [attributeKey]: {
375
- results: sanitizedResults,
376
- meta: response.meta
377
- }
378
- };
353
+ const populateEntry = async (entry) => {
354
+ return traverseEntity(
355
+ async (options, utils) => {
356
+ if (!options.attribute) return;
357
+ if (!options.value) return;
358
+ const currentValue = Array.isArray(options.value) ? options.value : [options.value];
359
+ if (options.attribute.type === "component") {
360
+ utils.remove("id");
379
361
  }
380
- if (attributeSchema.type === "relation" && attributeSchema.relation !== "morphToOne" && attributeSchema.relation !== "morphToMany") {
381
- if (attributeSchema.target === "admin::user") {
362
+ if (options.attribute.type === "relation" && // TODO: handle polymorphic relations
363
+ options.attribute.relation !== "morphToOne" && options.attribute.relation !== "morphToMany") {
364
+ if (options.attribute.target === "admin::user") {
382
365
  const adminUsers = await Promise.all(
383
- attributeValues.map((userToPopulate) => {
366
+ currentValue.map((userToPopulate) => {
384
367
  if (userToPopulate == null) {
385
368
  return null;
386
369
  }
@@ -392,46 +375,51 @@ const createHistoryService = ({ strapi: strapi2 }) => {
392
375
  });
393
376
  })
394
377
  );
395
- return {
396
- ...await currentDataWithRelations,
397
- /**
398
- * Ideally we would return the same "{results: [], meta: {}}" shape, however,
399
- * when sanitizing the data as a whole in the controller before sending to the client,
400
- * the data for admin relation user is completely sanitized if we return an object here as opposed to an array.
401
- */
402
- [attributeKey]: adminUsers
403
- };
378
+ utils.set(options.key, adminUsers);
404
379
  }
405
380
  const permissionChecker2 = getService$2("permission-checker").create({
406
381
  userAbility: params.state.userAbility,
407
- model: attributeSchema.target
382
+ model: options.attribute.target
408
383
  });
409
384
  const response = await serviceUtils.buildRelationReponse(
410
- attributeValues,
411
- attributeSchema
385
+ currentValue,
386
+ options.attribute
412
387
  );
413
388
  const sanitizedResults = await Promise.all(
414
389
  response.results.map((media) => permissionChecker2.sanitizeOutput(media))
415
390
  );
416
- return {
417
- ...await currentDataWithRelations,
418
- [attributeKey]: {
419
- results: sanitizedResults,
420
- meta: response.meta
421
- }
422
- };
391
+ utils.set(options.key, {
392
+ results: sanitizedResults,
393
+ meta: response.meta
394
+ });
395
+ }
396
+ if (options.attribute.type === "media") {
397
+ const permissionChecker2 = getService$2("permission-checker").create({
398
+ userAbility: params.state.userAbility,
399
+ model: "plugin::upload.file"
400
+ });
401
+ const response = await serviceUtils.buildMediaResponse(currentValue);
402
+ const sanitizedResults = await Promise.all(
403
+ response.results.map((media) => permissionChecker2.sanitizeOutput(media))
404
+ );
405
+ utils.set(options.key, {
406
+ results: sanitizedResults,
407
+ meta: response.meta
408
+ });
423
409
  }
424
- return currentDataWithRelations;
425
410
  },
426
- Promise.resolve(entry.data)
411
+ {
412
+ schema,
413
+ getModel: strapi2.getModel.bind(strapi2)
414
+ },
415
+ entry.data
427
416
  );
428
- return entryWithRelations;
429
417
  };
430
418
  const formattedResults = await Promise.all(
431
419
  results.map(async (result) => {
432
420
  return {
433
421
  ...result,
434
- data: await populateEntryRelations(result),
422
+ data: await populateEntry(result),
435
423
  meta: {
436
424
  unknownAttributes: serviceUtils.getSchemaAttributesDiff(
437
425
  result.schema,
@@ -462,30 +450,44 @@ const createHistoryService = ({ strapi: strapi2 }) => {
462
450
  // Clone to avoid mutating the original version data
463
451
  structuredClone(version.data)
464
452
  );
465
- const sanitizedSchemaAttributes = omit(
466
- FIELDS_TO_IGNORE,
467
- contentTypeSchemaAttributes
468
- );
469
- const reducer = async.reduce(Object.entries(sanitizedSchemaAttributes));
470
- const dataWithoutMissingRelations = await reducer(
471
- async (previousRelationAttributes, [name, attribute]) => {
472
- const versionRelationData = version.data[name];
473
- if (!versionRelationData) {
474
- return previousRelationAttributes;
453
+ const schema = structuredClone(version.schema);
454
+ schema.attributes = omit(FIELDS_TO_IGNORE, contentTypeSchemaAttributes);
455
+ const dataWithoutMissingRelations = await traverseEntity(
456
+ async (options, utils) => {
457
+ if (!options.attribute) return;
458
+ if (options.attribute.type === "component") {
459
+ utils.remove("id");
460
+ if (options.attribute.repeatable && options.value === null) {
461
+ utils.set(options.key, []);
462
+ }
463
+ }
464
+ if (options.attribute.type === "dynamiczone") {
465
+ if (options.value === null) {
466
+ utils.set(options.key, []);
467
+ }
475
468
  }
476
- if (attribute.type === "relation" && // TODO: handle polymorphic relations
477
- attribute.relation !== "morphToOne" && attribute.relation !== "morphToMany") {
478
- const data2 = await serviceUtils.getRelationRestoreValue(versionRelationData, attribute);
479
- previousRelationAttributes[name] = data2;
469
+ if (options.attribute.type === "relation" && // TODO: handle polymorphic relations
470
+ options.attribute.relation !== "morphToOne" && options.attribute.relation !== "morphToMany") {
471
+ if (!options.value) return;
472
+ const data2 = await serviceUtils.getRelationRestoreValue(
473
+ options.value,
474
+ options.attribute
475
+ );
476
+ utils.set(options.key, data2);
480
477
  }
481
- if (attribute.type === "media") {
482
- const data2 = await serviceUtils.getMediaRestoreValue(versionRelationData, attribute);
483
- previousRelationAttributes[name] = data2;
478
+ if (options.attribute.type === "media") {
479
+ if (!options.value) return;
480
+ const data2 = await serviceUtils.getMediaRestoreValue(
481
+ options.value
482
+ );
483
+ utils.set(options.key, data2);
484
484
  }
485
- return previousRelationAttributes;
486
485
  },
487
- // Clone to avoid mutating the original version data
488
- structuredClone(dataWithoutAddedAttributes)
486
+ {
487
+ schema,
488
+ getModel: strapi2.getModel.bind(strapi2)
489
+ },
490
+ dataWithoutAddedAttributes
489
491
  );
490
492
  const data = omit(["id", ...Object.keys(schemaDiff.removed)], dataWithoutMissingRelations);
491
493
  const restoredDocument = await strapi2.documents(version.contentType).update({
@@ -714,14 +716,6 @@ const getFeature$1 = () => {
714
716
  };
715
717
  };
716
718
  const history = getFeature$1();
717
- const register = async ({ strapi: strapi2 }) => {
718
- await history.register?.({ strapi: strapi2 });
719
- };
720
- const ALLOWED_WEBHOOK_EVENTS = {
721
- ENTRY_PUBLISH: "entry.publish",
722
- ENTRY_UNPUBLISH: "entry.unpublish"
723
- };
724
- const FEATURE_ID = "preview";
725
719
  const info = { pluginName: "content-manager", type: "admin" };
726
720
  const previewRouter = {
727
721
  type: "admin",
@@ -767,6 +761,10 @@ const validatePreviewUrl = async (strapi2, uid2, params) => {
767
761
  }
768
762
  newParams.documentId = doc?.documentId;
769
763
  }
764
+ if (!newParams.status) {
765
+ const isDPEnabled = model?.options?.draftAndPublish;
766
+ newParams.status = isDPEnabled ? "draft" : "published";
767
+ }
770
768
  return newParams;
771
769
  };
772
770
  const createPreviewController = () => {
@@ -812,8 +810,48 @@ const createPreviewService = ({ strapi: strapi2 }) => {
812
810
  }
813
811
  };
814
812
  };
813
+ const extendMiddlewareConfiguration = (middleware = { name: "", config: {} }) => {
814
+ const middlewares = strapi.config.get("middlewares");
815
+ const configuredMiddlewares = middlewares.map((currentMiddleware) => {
816
+ if (currentMiddleware === middleware.name) {
817
+ return middleware;
818
+ }
819
+ if (currentMiddleware.name === middleware.name) {
820
+ return mergeWith(
821
+ (objValue, srcValue) => {
822
+ if (Array.isArray(objValue)) {
823
+ return objValue.concat(srcValue);
824
+ }
825
+ return void 0;
826
+ },
827
+ currentMiddleware,
828
+ middleware
829
+ );
830
+ }
831
+ return currentMiddleware;
832
+ });
833
+ strapi.config.set("middlewares", configuredMiddlewares);
834
+ };
815
835
  const createPreviewConfigService = ({ strapi: strapi2 }) => {
816
836
  return {
837
+ register() {
838
+ if (!this.isEnabled()) {
839
+ return;
840
+ }
841
+ const config = strapi2.config.get("admin.preview");
842
+ if (config.config?.allowedOrigins) {
843
+ extendMiddlewareConfiguration({
844
+ name: "strapi::security",
845
+ config: {
846
+ contentSecurityPolicy: {
847
+ directives: {
848
+ "frame-src": config.config.allowedOrigins
849
+ }
850
+ }
851
+ }
852
+ });
853
+ }
854
+ },
817
855
  isEnabled() {
818
856
  const config = strapi2.config.get("admin.preview");
819
857
  if (!config) {
@@ -855,14 +893,13 @@ const services$1 = {
855
893
  "preview-config": createPreviewConfigService
856
894
  };
857
895
  const getFeature = () => {
858
- if (!strapi.features.future.isEnabled(FEATURE_ID)) {
859
- return {};
860
- }
861
896
  return {
862
- bootstrap() {
863
- console.log("Bootstrapping preview server");
897
+ register() {
864
898
  const config = getService(strapi, "preview-config");
865
899
  config.validate();
900
+ config.register();
901
+ },
902
+ bootstrap() {
866
903
  },
867
904
  routes: routes$1,
868
905
  controllers: controllers$1,
@@ -870,6 +907,14 @@ const getFeature = () => {
870
907
  };
871
908
  };
872
909
  const preview = getFeature();
910
+ const register = async ({ strapi: strapi2 }) => {
911
+ await history.register?.({ strapi: strapi2 });
912
+ await preview.register?.({ strapi: strapi2 });
913
+ };
914
+ const ALLOWED_WEBHOOK_EVENTS = {
915
+ ENTRY_PUBLISH: "entry.publish",
916
+ ENTRY_UNPUBLISH: "entry.unpublish"
917
+ };
873
918
  const bootstrap = async () => {
874
919
  Object.entries(ALLOWED_WEBHOOK_EVENTS).forEach(([key, value]) => {
875
920
  strapi.get("webhookStore").addAllowedEvent(key, value);
@@ -1433,8 +1478,7 @@ const isSortable = (schema, name) => {
1433
1478
  if (!_.has(schema.attributes, name)) {
1434
1479
  return false;
1435
1480
  }
1436
- if (schema.modelType === "component" && name === "id")
1437
- return false;
1481
+ if (schema.modelType === "component" && name === "id") return false;
1438
1482
  const attribute = schema.attributes[name];
1439
1483
  if (NON_SORTABLES.includes(attribute.type)) {
1440
1484
  return false;
@@ -1579,8 +1623,7 @@ const createDefaultSettings = async (schema) => {
1579
1623
  };
1580
1624
  };
1581
1625
  const syncSettings = async (configuration, schema) => {
1582
- if (isEmpty(configuration.settings))
1583
- return createDefaultSettings(schema);
1626
+ if (isEmpty(configuration.settings)) return createDefaultSettings(schema);
1584
1627
  const defaultField = getDefaultMainField(schema);
1585
1628
  const { mainField = defaultField, defaultSortBy = defaultField } = configuration.settings || {};
1586
1629
  return {
@@ -1756,8 +1799,7 @@ const excludeNotCreatableFields = (uid2, permissionChecker2) => (body, path = []
1756
1799
  }
1757
1800
  switch (attribute.type) {
1758
1801
  case "relation": {
1759
- if (canCreate(attributePath))
1760
- return body2;
1802
+ if (canCreate(attributePath)) return body2;
1761
1803
  return set(attributePath, { set: [] }, body2);
1762
1804
  }
1763
1805
  case "component": {
@@ -1767,8 +1809,7 @@ const excludeNotCreatableFields = (uid2, permissionChecker2) => (body, path = []
1767
1809
  ]);
1768
1810
  }
1769
1811
  default: {
1770
- if (canCreate(attributePath))
1771
- return body2;
1812
+ if (canCreate(attributePath)) return body2;
1772
1813
  return set(attributePath, null, body2);
1773
1814
  }
1774
1815
  }
@@ -2561,8 +2602,7 @@ const validateStatus = (sourceUid, status) => {
2561
2602
  const sourceModel = strapi.getModel(sourceUid);
2562
2603
  const isDP = contentTypes$1.hasDraftAndPublish;
2563
2604
  const isSourceDP = isDP(sourceModel);
2564
- if (!isSourceDP)
2565
- return { status: void 0 };
2605
+ if (!isSourceDP) return { status: void 0 };
2566
2606
  switch (status) {
2567
2607
  case "published":
2568
2608
  return { status: "published" };
@@ -3207,18 +3247,15 @@ async function syncMetadatas(configuration, schema) {
3207
3247
  _.set(updatedMeta, ["list", "searchable"], false);
3208
3248
  _.set(acc, [key], updatedMeta);
3209
3249
  }
3210
- if (!_.has(edit, "mainField"))
3211
- return acc;
3250
+ if (!_.has(edit, "mainField")) return acc;
3212
3251
  if (!isRelation$1(attr)) {
3213
3252
  _.set(updatedMeta, "edit", _.omit(edit, ["mainField"]));
3214
3253
  _.set(acc, [key], updatedMeta);
3215
3254
  return acc;
3216
3255
  }
3217
- if (edit.mainField === "id")
3218
- return acc;
3256
+ if (edit.mainField === "id") return acc;
3219
3257
  const targetSchema = getTargetSchema(attr.targetModel);
3220
- if (!targetSchema)
3221
- return acc;
3258
+ if (!targetSchema) return acc;
3222
3259
  if (!isSortable(targetSchema, edit.mainField) && !isListable(targetSchema, edit.mainField)) {
3223
3260
  _.set(updatedMeta, ["edit", "mainField"], getDefaultMainField(targetSchema));
3224
3261
  _.set(acc, [key], updatedMeta);
@@ -3263,8 +3300,7 @@ function createDefaultEditLayout(schema) {
3263
3300
  return appendToEditLayout([], keys2, schema);
3264
3301
  }
3265
3302
  function syncLayouts(configuration, schema) {
3266
- if (_.isEmpty(configuration.layouts))
3267
- return createDefaultLayouts(schema);
3303
+ if (_.isEmpty(configuration.layouts)) return createDefaultLayouts(schema);
3268
3304
  const { list = [], editRelations = [], edit = [] } = configuration.layouts || {};
3269
3305
  let cleanList = list.filter((attr) => isListable(schema, attr));
3270
3306
  const cleanEditRelations = editRelations.filter(
@@ -3275,8 +3311,7 @@ function syncLayouts(configuration, schema) {
3275
3311
  for (const row of edit) {
3276
3312
  const newRow = [];
3277
3313
  for (const el of row) {
3278
- if (!hasEditableAttribute(schema, el.name))
3279
- continue;
3314
+ if (!hasEditableAttribute(schema, el.name)) continue;
3280
3315
  const { hasFieldSize } = getService$2("field-sizes");
3281
3316
  const fieldType = hasFieldSize(schema.attributes[el.name].customField) ? schema.attributes[el.name].customField : schema.attributes[el.name].type;
3282
3317
  if (!isAllowedFieldSize(fieldType, el.size)) {
@@ -3307,8 +3342,7 @@ function syncLayouts(configuration, schema) {
3307
3342
  };
3308
3343
  }
3309
3344
  const appendToEditLayout = (layout = [], keysToAppend, schema) => {
3310
- if (keysToAppend.length === 0)
3311
- return layout;
3345
+ if (keysToAppend.length === 0) return layout;
3312
3346
  let currentRowIndex = Math.max(layout.length - 1, 0);
3313
3347
  if (!layout[currentRowIndex]) {
3314
3348
  layout[currentRowIndex] = [];
@@ -3874,6 +3908,12 @@ function getPopulateForRelation(attribute, model, attributeName, { countMany, co
3874
3908
  if (initialPopulate) {
3875
3909
  return initialPopulate;
3876
3910
  }
3911
+ if (attributeName === "localizations") {
3912
+ const validationPopulate = getPopulateForValidation(model.uid);
3913
+ return {
3914
+ populate: validationPopulate.populate
3915
+ };
3916
+ }
3877
3917
  if (!isVisibleAttribute$1(model, attributeName)) {
3878
3918
  return true;
3879
3919
  }
@@ -3933,6 +3973,9 @@ const getDeepPopulate = (uid2, {
3933
3973
  return {};
3934
3974
  }
3935
3975
  const model = strapi.getModel(uid2);
3976
+ if (!model) {
3977
+ return {};
3978
+ }
3936
3979
  return Object.keys(model.attributes).reduce(
3937
3980
  (populateAcc, attributeName) => merge(
3938
3981
  populateAcc,
@@ -3952,40 +3995,46 @@ const getDeepPopulate = (uid2, {
3952
3995
  {}
3953
3996
  );
3954
3997
  };
3955
- const getValidatableFieldsPopulate = (uid2, {
3956
- initialPopulate = {},
3957
- countMany = false,
3958
- countOne = false,
3959
- maxLevel = Infinity
3960
- } = {}, level = 1) => {
3961
- if (level > maxLevel) {
3998
+ const getPopulateForValidation = (uid2) => {
3999
+ const model = strapi.getModel(uid2);
4000
+ if (!model) {
3962
4001
  return {};
3963
4002
  }
3964
- const model = strapi.getModel(uid2);
3965
4003
  return Object.entries(model.attributes).reduce((populateAcc, [attributeName, attribute]) => {
3966
- if (!getDoesAttributeRequireValidation(attribute)) {
4004
+ if (isScalarAttribute(attribute)) {
4005
+ if (getDoesAttributeRequireValidation(attribute)) {
4006
+ populateAcc.fields = populateAcc.fields || [];
4007
+ populateAcc.fields.push(attributeName);
4008
+ }
3967
4009
  return populateAcc;
3968
4010
  }
3969
- if (isScalarAttribute(attribute)) {
3970
- return merge(populateAcc, {
3971
- [attributeName]: true
3972
- });
4011
+ if (isComponent(attribute)) {
4012
+ const component = attribute.component;
4013
+ const componentResult = getPopulateForValidation(component);
4014
+ if (Object.keys(componentResult).length > 0) {
4015
+ populateAcc.populate = populateAcc.populate || {};
4016
+ populateAcc.populate[attributeName] = componentResult;
4017
+ }
4018
+ return populateAcc;
3973
4019
  }
3974
- return merge(
3975
- populateAcc,
3976
- getPopulateFor(
3977
- attributeName,
3978
- model,
3979
- {
3980
- // @ts-expect-error - improve types
3981
- initialPopulate: initialPopulate?.[attributeName],
3982
- countMany,
3983
- countOne,
3984
- maxLevel
4020
+ if (isDynamicZone(attribute)) {
4021
+ const components2 = attribute.components;
4022
+ const componentsResult = (components2 || []).reduce(
4023
+ (acc, componentUID) => {
4024
+ const componentResult = getPopulateForValidation(componentUID);
4025
+ if (Object.keys(componentResult).length > 0) {
4026
+ acc[componentUID] = componentResult;
4027
+ }
4028
+ return acc;
3985
4029
  },
3986
- level
3987
- )
3988
- );
4030
+ {}
4031
+ );
4032
+ if (Object.keys(componentsResult).length > 0) {
4033
+ populateAcc.populate = populateAcc.populate || {};
4034
+ populateAcc.populate[attributeName] = { on: componentsResult };
4035
+ }
4036
+ }
4037
+ return populateAcc;
3989
4038
  }, {});
3990
4039
  };
3991
4040
  const getDeepPopulateDraftCount = (uid2) => {
@@ -4227,7 +4276,6 @@ const AVAILABLE_LOCALES_FIELDS = [
4227
4276
  "locale",
4228
4277
  "updatedAt",
4229
4278
  "createdAt",
4230
- "status",
4231
4279
  "publishedAt",
4232
4280
  "documentId"
4233
4281
  ];
@@ -4248,36 +4296,20 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
4248
4296
  /**
4249
4297
  * Returns available locales of a document for the current status
4250
4298
  */
4251
- async getAvailableLocales(uid2, version, allVersions, validatableFields = []) {
4299
+ async getAvailableLocales(uid2, version, allVersions) {
4252
4300
  const versionsByLocale = groupBy("locale", allVersions);
4253
4301
  if (version.locale) {
4254
4302
  delete versionsByLocale[version.locale];
4255
4303
  }
4256
4304
  const model = strapi2.getModel(uid2);
4257
- const keysToKeep = [...AVAILABLE_LOCALES_FIELDS, ...validatableFields];
4258
- const traversalFunction = async (localeVersion) => traverseEntity(
4259
- ({ key }, { remove }) => {
4260
- if (keysToKeep.includes(key)) {
4261
- return;
4262
- }
4263
- remove(key);
4264
- },
4265
- { schema: model, getModel: strapi2.getModel.bind(strapi2) },
4266
- // @ts-expect-error fix types DocumentVersion incompatible with Data
4267
- localeVersion
4268
- );
4269
4305
  const mappingResult = await async.map(
4270
4306
  Object.values(versionsByLocale),
4271
4307
  async (localeVersions) => {
4272
- const mappedLocaleVersions = await async.map(
4273
- localeVersions,
4274
- traversalFunction
4275
- );
4276
4308
  if (!contentTypes$1.hasDraftAndPublish(model)) {
4277
- return mappedLocaleVersions[0];
4309
+ return localeVersions[0];
4278
4310
  }
4279
- const draftVersion = mappedLocaleVersions.find((v) => v.publishedAt === null);
4280
- const otherVersions = mappedLocaleVersions.filter((v) => v.id !== draftVersion?.id);
4311
+ const draftVersion = localeVersions.find((v) => v.publishedAt === null);
4312
+ const otherVersions = localeVersions.filter((v) => v.id !== draftVersion?.id);
4281
4313
  if (!draftVersion) {
4282
4314
  return;
4283
4315
  }
@@ -4299,8 +4331,7 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
4299
4331
  const matchStatus = status === "published" ? v.publishedAt !== null : v.publishedAt === null;
4300
4332
  return matchLocale && matchStatus;
4301
4333
  });
4302
- if (!availableStatus)
4303
- return availableStatus;
4334
+ if (!availableStatus) return availableStatus;
4304
4335
  return pick(AVAILABLE_STATUS_FIELDS, availableStatus);
4305
4336
  },
4306
4337
  /**
@@ -4310,18 +4341,19 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
4310
4341
  * @returns
4311
4342
  */
4312
4343
  async getManyAvailableStatus(uid2, documents) {
4313
- if (!documents.length)
4314
- return [];
4344
+ if (!documents.length) return [];
4315
4345
  const status = documents[0].publishedAt !== null ? "published" : "draft";
4316
- const locale = documents[0]?.locale;
4317
- const otherStatus = status === "published" ? "draft" : "published";
4318
- return strapi2.documents(uid2).findMany({
4319
- filters: {
4320
- documentId: { $in: documents.map((d) => d.documentId).filter(Boolean) }
4321
- },
4322
- status: otherStatus,
4323
- locale,
4324
- fields: ["documentId", "locale", "updatedAt", "createdAt", "publishedAt"]
4346
+ const locales = documents.map((d) => d.locale).filter(Boolean);
4347
+ const where = {
4348
+ documentId: { $in: documents.map((d) => d.documentId).filter(Boolean) },
4349
+ publishedAt: { $null: status === "published" }
4350
+ };
4351
+ if (locales.length) {
4352
+ where.locale = { $in: locales };
4353
+ }
4354
+ return strapi2.query(uid2).findMany({
4355
+ where,
4356
+ select: ["id", "documentId", "locale", "updatedAt", "createdAt", "publishedAt"]
4325
4357
  });
4326
4358
  },
4327
4359
  getStatus(version, otherDocumentStatuses) {
@@ -4338,10 +4370,8 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
4338
4370
  } else if (otherVersion) {
4339
4371
  draftVersion = otherVersion;
4340
4372
  }
4341
- if (!draftVersion)
4342
- return CONTENT_MANAGER_STATUS.PUBLISHED;
4343
- if (!publishedVersion)
4344
- return CONTENT_MANAGER_STATUS.DRAFT;
4373
+ if (!draftVersion) return CONTENT_MANAGER_STATUS.PUBLISHED;
4374
+ if (!publishedVersion) return CONTENT_MANAGER_STATUS.DRAFT;
4345
4375
  const isDraftModified = getIsVersionLatestModification(draftVersion, publishedVersion);
4346
4376
  return isDraftModified ? CONTENT_MANAGER_STATUS.MODIFIED : CONTENT_MANAGER_STATUS.PUBLISHED;
4347
4377
  },
@@ -4349,11 +4379,9 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
4349
4379
  // We could refactor this so the locales are only loaded when they're
4350
4380
  // needed. e.g. in the bulk locale action modal.
4351
4381
  async getMetadata(uid2, version, { availableLocales = true, availableStatus = true } = {}) {
4352
- const populate = getValidatableFieldsPopulate(uid2);
4353
- const versions = await strapi2.db.query(uid2).findMany({
4354
- where: { documentId: version.documentId },
4382
+ const { populate = {}, fields = [] } = getPopulateForValidation(uid2);
4383
+ const params = {
4355
4384
  populate: {
4356
- // Populate only fields that require validation for bulk locale actions
4357
4385
  ...populate,
4358
4386
  // NOTE: creator fields are selected in this way to avoid exposing sensitive data
4359
4387
  createdBy: {
@@ -4362,9 +4390,15 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
4362
4390
  updatedBy: {
4363
4391
  select: ["id", "firstname", "lastname", "email"]
4364
4392
  }
4393
+ },
4394
+ fields: uniq([...AVAILABLE_LOCALES_FIELDS, ...fields]),
4395
+ filters: {
4396
+ documentId: version.documentId
4365
4397
  }
4366
- });
4367
- const availableLocalesResult = availableLocales ? await this.getAvailableLocales(uid2, version, versions, Object.keys(populate)) : [];
4398
+ };
4399
+ const dbParams = strapi2.get("query-params").transform(uid2, params);
4400
+ const versions = await strapi2.db.query(uid2).findMany(dbParams);
4401
+ const availableLocalesResult = availableLocales ? await this.getAvailableLocales(uid2, version, versions) : [];
4368
4402
  const availableStatusResult = availableStatus ? this.getAvailableStatus(version, versions) : null;
4369
4403
  return {
4370
4404
  availableLocales: availableLocalesResult,
@@ -4391,6 +4425,16 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
4391
4425
  opts.availableStatus = false;
4392
4426
  }
4393
4427
  const meta = await this.getMetadata(uid2, document, opts);
4428
+ if (document.localizations) {
4429
+ const otherStatus = await this.getManyAvailableStatus(uid2, document.localizations);
4430
+ document.localizations = document.localizations.map((d) => {
4431
+ const status = otherStatus.find((s) => s.documentId === d.documentId);
4432
+ return {
4433
+ ...d,
4434
+ status: this.getStatus(d, status ? [status] : [])
4435
+ };
4436
+ });
4437
+ }
4394
4438
  return {
4395
4439
  data: {
4396
4440
  ...document,