@strapi/content-manager 0.0.0-experimental.c592deb623aed3f74ef7fdacfad9757ed59d34f7 → 0.0.0-experimental.cb74730ce5154c26404d4dccca14976a22319002
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/_chunks/CardDragPreview-C0QyJgRA.js.map +1 -1
- package/dist/_chunks/CardDragPreview-DOxamsuj.mjs.map +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-7-qB29e7.mjs → ComponentConfigurationPage-BgCLcjXO.mjs} +4 -4
- package/dist/_chunks/{ComponentConfigurationPage-7-qB29e7.mjs.map → ComponentConfigurationPage-BgCLcjXO.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DP7AC0UU.js → ComponentConfigurationPage-DywpTZeV.js} +5 -6
- package/dist/_chunks/{ComponentConfigurationPage-DP7AC0UU.js.map → ComponentConfigurationPage-DywpTZeV.js.map} +1 -1
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js → ComponentIcon-CRbtQEUV.js} +2 -3
- package/dist/_chunks/{ComponentIcon-BXdiCGQp.js.map → ComponentIcon-CRbtQEUV.js.map} +1 -1
- package/dist/_chunks/ComponentIcon-u4bIXTFY.mjs.map +1 -1
- package/dist/_chunks/{EditConfigurationPage-CI4XoymK.mjs → EditConfigurationPage-BNjOAHNS.mjs} +4 -4
- package/dist/_chunks/{EditConfigurationPage-CI4XoymK.mjs.map → EditConfigurationPage-BNjOAHNS.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DITVliEI.js → EditConfigurationPage-CxRlP5if.js} +5 -6
- package/dist/_chunks/{EditConfigurationPage-DITVliEI.js.map → EditConfigurationPage-CxRlP5if.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-CUS2EAhB.js → EditViewPage-BRewdTqE.js} +45 -10
- package/dist/_chunks/EditViewPage-BRewdTqE.js.map +1 -0
- package/dist/_chunks/{EditViewPage-Dzpno8xI.mjs → EditViewPage-CD_hqc1J.mjs} +45 -9
- package/dist/_chunks/EditViewPage-CD_hqc1J.mjs.map +1 -0
- package/dist/_chunks/{Field-B_jG_EV9.mjs → Field-BPkQ-3Ku.mjs} +102 -70
- package/dist/_chunks/Field-BPkQ-3Ku.mjs.map +1 -0
- package/dist/_chunks/{Field-CtUU1Fg8.js → Field-DwvmENVf.js} +103 -72
- package/dist/_chunks/Field-DwvmENVf.js.map +1 -0
- package/dist/_chunks/FieldTypeIcon-CMlNO8PE.mjs.map +1 -1
- package/dist/_chunks/FieldTypeIcon-Dnwq_IRF.js.map +1 -1
- package/dist/_chunks/{Form-DTqO0ymI.js → Form-C_Gwv8P_.js} +6 -7
- package/dist/_chunks/Form-C_Gwv8P_.js.map +1 -0
- package/dist/_chunks/{Form-BXHao2mZ.mjs → Form-Czi0cf_2.mjs} +4 -4
- package/dist/_chunks/Form-Czi0cf_2.mjs.map +1 -0
- package/dist/_chunks/{History-C_uSGzO5.js → History-C1TKAig-.js} +42 -100
- package/dist/_chunks/History-C1TKAig-.js.map +1 -0
- package/dist/_chunks/{History-2Ah2CQ4T.mjs → History-CIQHyi4T.mjs} +43 -100
- package/dist/_chunks/History-CIQHyi4T.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-nyuP7OSy.js → ListConfigurationPage-D-NGRLYu.js} +7 -7
- package/dist/_chunks/ListConfigurationPage-D-NGRLYu.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-BjSJlaoC.mjs → ListConfigurationPage-DcZsfyEL.mjs} +7 -6
- package/dist/_chunks/ListConfigurationPage-DcZsfyEL.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-B75x3nz2.mjs → ListViewPage-C10McTK1.mjs} +62 -39
- package/dist/_chunks/ListViewPage-C10McTK1.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-DHgHD8Xg.js → ListViewPage-xv5IQoZp.js} +63 -41
- package/dist/_chunks/ListViewPage-xv5IQoZp.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DUacQSyF.mjs → NoContentTypePage-CPc0Cd3S.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DUacQSyF.mjs.map → NoContentTypePage-CPc0Cd3S.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CDUKdZ7d.js → NoContentTypePage-Dzw5Yj5u.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-CDUKdZ7d.js.map → NoContentTypePage-Dzw5Yj5u.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-zwIZydDI.js → NoPermissionsPage-DAe5CDCC.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-zwIZydDI.js.map → NoPermissionsPage-DAe5CDCC.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-SFllMekk.mjs → NoPermissionsPage-wfPBh2_0.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-SFllMekk.mjs.map → NoPermissionsPage-wfPBh2_0.mjs.map} +1 -1
- package/dist/_chunks/Preview-B7LyGT_b.js +290 -0
- package/dist/_chunks/Preview-B7LyGT_b.js.map +1 -0
- package/dist/_chunks/Preview-BVFFm7uB.mjs +272 -0
- package/dist/_chunks/Preview-BVFFm7uB.mjs.map +1 -0
- package/dist/_chunks/{Relations-NFLaRNPr.js → Relations-BmYR1AjY.js} +68 -39
- package/dist/_chunks/Relations-BmYR1AjY.js.map +1 -0
- package/dist/_chunks/{Relations-D2NRW8fC.mjs → Relations-JPhWxk-s.mjs} +68 -38
- package/dist/_chunks/Relations-JPhWxk-s.mjs.map +1 -0
- package/dist/_chunks/{en-BlhnxQfj.js → en-BK8Xyl5I.js} +22 -10
- package/dist/_chunks/{en-BlhnxQfj.js.map → en-BK8Xyl5I.js.map} +1 -1
- package/dist/_chunks/{en-C8YBvRrK.mjs → en-Dtk_ot79.mjs} +22 -10
- package/dist/_chunks/{en-C8YBvRrK.mjs.map → en-Dtk_ot79.mjs.map} +1 -1
- package/dist/_chunks/{es-EUonQTon.js → es-9K52xZIr.js} +2 -2
- package/dist/_chunks/{ja-CcFe8diO.js.map → es-9K52xZIr.js.map} +1 -1
- package/dist/_chunks/{es-CeXiYflN.mjs → es-D34tqjMw.mjs} +2 -2
- package/dist/_chunks/{es-CeXiYflN.mjs.map → es-D34tqjMw.mjs.map} +1 -1
- package/dist/_chunks/{fr-CD9VFbPM.mjs → fr--pg5jUbt.mjs} +13 -3
- package/dist/_chunks/{fr-CD9VFbPM.mjs.map → fr--pg5jUbt.mjs.map} +1 -1
- package/dist/_chunks/{fr-B7kGGg3E.js → fr-B2Kyv8Z9.js} +13 -3
- package/dist/_chunks/{fr-B7kGGg3E.js.map → fr-B2Kyv8Z9.js.map} +1 -1
- package/dist/_chunks/hooks-BAaaKPS_.js.map +1 -1
- package/dist/_chunks/{index-ovJRE1FM.js → index-C2Q_PLWj.js} +294 -167
- package/dist/_chunks/index-C2Q_PLWj.js.map +1 -0
- package/dist/_chunks/{index-C9HxCo5R.mjs → index-DLIkNVnQ.mjs} +297 -170
- package/dist/_chunks/index-DLIkNVnQ.mjs.map +1 -0
- package/dist/_chunks/{ja-CcFe8diO.js → ja-7sfIbjxE.js} +2 -2
- package/dist/_chunks/{es-EUonQTon.js.map → ja-7sfIbjxE.js.map} +1 -1
- package/dist/_chunks/{ja-CtsUxOvk.mjs → ja-BHqhDq4V.mjs} +2 -2
- package/dist/_chunks/{ja-CtsUxOvk.mjs.map → ja-BHqhDq4V.mjs.map} +1 -1
- package/dist/_chunks/{layout-UNWstw_s.js → layout-7AsWJzZJ.js} +5 -6
- package/dist/_chunks/{layout-UNWstw_s.js.map → layout-7AsWJzZJ.js.map} +1 -1
- package/dist/_chunks/{layout-DaUjDiWQ.mjs → layout-qE8qkNH_.mjs} +4 -4
- package/dist/_chunks/{layout-DaUjDiWQ.mjs.map → layout-qE8qkNH_.mjs.map} +1 -1
- package/dist/_chunks/{objects-gigeqt7s.js → objects-BcXOv6_9.js} +2 -4
- package/dist/_chunks/{objects-gigeqt7s.js.map → objects-BcXOv6_9.js.map} +1 -1
- package/dist/_chunks/{objects-mKMAmfec.mjs → objects-D6yBsdmx.mjs} +2 -4
- package/dist/_chunks/{objects-mKMAmfec.mjs.map → objects-D6yBsdmx.mjs.map} +1 -1
- package/dist/_chunks/{relations-D8iFAeRu.mjs → relations-BjHH_1Am.mjs} +6 -7
- package/dist/_chunks/relations-BjHH_1Am.mjs.map +1 -0
- package/dist/_chunks/{relations-NN3coOG5.js → relations-EifVzf_2.js} +6 -7
- package/dist/_chunks/relations-EifVzf_2.js.map +1 -0
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -1
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -1
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js → useDragAndDrop-BMtgCYzL.js} +5 -9
- package/dist/_chunks/{useDragAndDrop-J0TUUbR6.js.map → useDragAndDrop-BMtgCYzL.js.map} +1 -1
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs → useDragAndDrop-DJ6jqvZN.mjs} +4 -7
- package/dist/_chunks/{useDragAndDrop-DdHgKsqq.mjs.map → useDragAndDrop-DJ6jqvZN.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +9 -1
- package/dist/admin/src/pages/EditView/components/DocumentStatus.d.ts +2 -2
- package/dist/admin/src/preview/components/PreviewContent.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewHeader.d.ts +2 -0
- package/dist/admin/src/preview/components/PreviewSidePanel.d.ts +3 -0
- package/dist/admin/src/preview/constants.d.ts +1 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/admin/src/preview/pages/Preview.d.ts +11 -0
- package/dist/admin/src/preview/routes.d.ts +3 -0
- package/dist/admin/src/preview/services/preview.d.ts +3 -0
- package/dist/admin/src/router.d.ts +1 -1
- package/dist/admin/src/services/documents.d.ts +0 -3
- package/dist/server/index.js +426 -190
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +426 -189
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +15 -1
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +2 -3
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +4 -4
- package/dist/server/src/preview/constants.d.ts +2 -0
- package/dist/server/src/preview/constants.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/index.d.ts +2 -0
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/preview.d.ts +13 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts +6 -0
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -0
- package/dist/server/src/preview/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/index.d.ts +8 -0
- package/dist/server/src/preview/routes/index.d.ts.map +1 -0
- package/dist/server/src/preview/routes/preview.d.ts +4 -0
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -0
- package/dist/server/src/preview/services/index.d.ts +16 -0
- package/dist/server/src/preview/services/index.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview-config.d.ts +32 -0
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -0
- package/dist/server/src/preview/services/preview.d.ts +12 -0
- package/dist/server/src/preview/services/preview.d.ts.map +1 -0
- package/dist/server/src/preview/utils.d.ts +19 -0
- package/dist/server/src/preview/utils.d.ts.map +1 -0
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +8 -8
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +4 -4
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/index.d.ts +2 -2
- package/dist/server/src/services/utils/configuration/layouts.d.ts +2 -2
- package/dist/server/src/utils/index.d.ts +2 -0
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/shared/contracts/index.d.ts +1 -0
- package/dist/shared/contracts/index.d.ts.map +1 -1
- package/dist/shared/contracts/preview.d.ts +27 -0
- package/dist/shared/contracts/preview.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/index.mjs +4 -0
- package/dist/shared/index.mjs.map +1 -1
- package/package.json +12 -12
- package/dist/_chunks/EditViewPage-CUS2EAhB.js.map +0 -1
- package/dist/_chunks/EditViewPage-Dzpno8xI.mjs.map +0 -1
- package/dist/_chunks/Field-B_jG_EV9.mjs.map +0 -1
- package/dist/_chunks/Field-CtUU1Fg8.js.map +0 -1
- package/dist/_chunks/Form-BXHao2mZ.mjs.map +0 -1
- package/dist/_chunks/Form-DTqO0ymI.js.map +0 -1
- package/dist/_chunks/History-2Ah2CQ4T.mjs.map +0 -1
- package/dist/_chunks/History-C_uSGzO5.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-BjSJlaoC.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-nyuP7OSy.js.map +0 -1
- package/dist/_chunks/ListViewPage-B75x3nz2.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-DHgHD8Xg.js.map +0 -1
- package/dist/_chunks/Relations-D2NRW8fC.mjs.map +0 -1
- package/dist/_chunks/Relations-NFLaRNPr.js.map +0 -1
- package/dist/_chunks/index-C9HxCo5R.mjs.map +0 -1
- package/dist/_chunks/index-ovJRE1FM.js.map +0 -1
- package/dist/_chunks/relations-D8iFAeRu.mjs.map +0 -1
- package/dist/_chunks/relations-NN3coOG5.js.map +0 -1
package/dist/server/index.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
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";
|
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";
|
@@ -7,10 +7,10 @@ import isNil from "lodash/isNil";
|
|
7
7
|
import _, { intersection as intersection$1, difference as difference$1 } from "lodash";
|
8
8
|
import qs from "qs";
|
9
9
|
import slugify from "@sindresorhus/slugify";
|
10
|
-
const getService$
|
10
|
+
const getService$2 = (name) => {
|
11
11
|
return strapi.plugin("content-manager").service(name);
|
12
12
|
};
|
13
|
-
function getService(strapi2, name) {
|
13
|
+
function getService$1(strapi2, name) {
|
14
14
|
return strapi2.service(`plugin::content-manager.${name}`);
|
15
15
|
}
|
16
16
|
const historyRestoreVersionSchema = yup.object().shape({
|
@@ -46,7 +46,7 @@ const createHistoryVersionController = ({ strapi: strapi2 }) => {
|
|
46
46
|
if (!isSingleType && (!contentTypeUid || !ctx.query.documentId)) {
|
47
47
|
throw new errors.ForbiddenError("contentType and documentId are required");
|
48
48
|
}
|
49
|
-
const permissionChecker2 = getService$
|
49
|
+
const permissionChecker2 = getService$2("permission-checker").create({
|
50
50
|
userAbility: ctx.state.userAbility,
|
51
51
|
model: ctx.query.contentType
|
52
52
|
});
|
@@ -54,7 +54,7 @@ const createHistoryVersionController = ({ strapi: strapi2 }) => {
|
|
54
54
|
return ctx.forbidden();
|
55
55
|
}
|
56
56
|
const query = await permissionChecker2.sanitizeQuery(ctx.query);
|
57
|
-
const { results, pagination: pagination2 } = await getService(strapi2, "history").findVersionsPage({
|
57
|
+
const { results, pagination: pagination2 } = await getService$1(strapi2, "history").findVersionsPage({
|
58
58
|
query: {
|
59
59
|
...query,
|
60
60
|
...getValidPagination({ page: query.page, pageSize: query.pageSize })
|
@@ -79,14 +79,14 @@ const createHistoryVersionController = ({ strapi: strapi2 }) => {
|
|
79
79
|
async restoreVersion(ctx) {
|
80
80
|
const request = ctx.request;
|
81
81
|
await validateRestoreVersion(request.body, "contentType is required");
|
82
|
-
const permissionChecker2 = getService$
|
82
|
+
const permissionChecker2 = getService$2("permission-checker").create({
|
83
83
|
userAbility: ctx.state.userAbility,
|
84
84
|
model: request.body.contentType
|
85
85
|
});
|
86
86
|
if (permissionChecker2.cannot.update()) {
|
87
87
|
throw new errors.ForbiddenError();
|
88
88
|
}
|
89
|
-
const restoredDocument = await getService(strapi2, "history").restoreVersion(
|
89
|
+
const restoredDocument = await getService$1(strapi2, "history").restoreVersion(
|
90
90
|
request.params.versionId
|
91
91
|
);
|
92
92
|
return {
|
@@ -95,7 +95,7 @@ const createHistoryVersionController = ({ strapi: strapi2 }) => {
|
|
95
95
|
}
|
96
96
|
};
|
97
97
|
};
|
98
|
-
const controllers$
|
98
|
+
const controllers$2 = {
|
99
99
|
"history-version": createHistoryVersionController
|
100
100
|
/**
|
101
101
|
* Casting is needed because the types aren't aware that Strapi supports
|
@@ -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({
|
@@ -177,8 +176,7 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
177
176
|
const getDefaultLocale = async () => localesService ? localesService.getDefaultLocale() : null;
|
178
177
|
const isLocalizedContentType = (model) => i18nContentTypeService ? i18nContentTypeService.isLocalizedContentType(model) : false;
|
179
178
|
const getLocaleDictionary = async () => {
|
180
|
-
if (!localesService)
|
181
|
-
return {};
|
179
|
+
if (!localesService) return {};
|
182
180
|
const locales = await localesService.find() || [];
|
183
181
|
return locales.reduce(
|
184
182
|
(acc, locale) => {
|
@@ -202,6 +200,17 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
202
200
|
const meta = await documentMetadataService.getMetadata(contentTypeUid, document);
|
203
201
|
return documentMetadataService.getStatus(document, meta.availableStatus);
|
204
202
|
};
|
203
|
+
const getComponentFields = (componentUID) => {
|
204
|
+
return Object.entries(strapi2.getModel(componentUID).attributes).reduce(
|
205
|
+
(fieldsAcc, [key, attribute]) => {
|
206
|
+
if (!["relation", "media", "component", "dynamiczone"].includes(attribute.type)) {
|
207
|
+
fieldsAcc.push(key);
|
208
|
+
}
|
209
|
+
return fieldsAcc;
|
210
|
+
},
|
211
|
+
[]
|
212
|
+
);
|
213
|
+
};
|
205
214
|
const getDeepPopulate2 = (uid2, useDatabaseSyntax = false) => {
|
206
215
|
const model = strapi2.getModel(uid2);
|
207
216
|
const attributes = Object.entries(model.attributes);
|
@@ -225,13 +234,19 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
225
234
|
}
|
226
235
|
case "component": {
|
227
236
|
const populate = getDeepPopulate2(attribute.component);
|
228
|
-
acc[attributeName] = {
|
237
|
+
acc[attributeName] = {
|
238
|
+
populate,
|
239
|
+
[fieldSelector]: getComponentFields(attribute.component)
|
240
|
+
};
|
229
241
|
break;
|
230
242
|
}
|
231
243
|
case "dynamiczone": {
|
232
244
|
const populatedComponents = (attribute.components || []).reduce(
|
233
245
|
(acc2, componentUID) => {
|
234
|
-
acc2[componentUID] = {
|
246
|
+
acc2[componentUID] = {
|
247
|
+
populate: getDeepPopulate2(componentUID),
|
248
|
+
[fieldSelector]: getComponentFields(componentUID)
|
249
|
+
};
|
235
250
|
return acc2;
|
236
251
|
},
|
237
252
|
{}
|
@@ -344,7 +359,7 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
344
359
|
const attributeValue = entry.data[attributeKey];
|
345
360
|
const attributeValues = Array.isArray(attributeValue) ? attributeValue : [attributeValue];
|
346
361
|
if (attributeSchema.type === "media") {
|
347
|
-
const permissionChecker2 = getService$
|
362
|
+
const permissionChecker2 = getService$2("permission-checker").create({
|
348
363
|
userAbility: params.state.userAbility,
|
349
364
|
model: "plugin::upload.file"
|
350
365
|
});
|
@@ -367,7 +382,12 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
367
382
|
if (userToPopulate == null) {
|
368
383
|
return null;
|
369
384
|
}
|
370
|
-
return strapi2.query("admin::user").findOne({
|
385
|
+
return strapi2.query("admin::user").findOne({
|
386
|
+
where: {
|
387
|
+
...userToPopulate.id ? { id: userToPopulate.id } : {},
|
388
|
+
...userToPopulate.documentId ? { documentId: userToPopulate.documentId } : {}
|
389
|
+
}
|
390
|
+
});
|
371
391
|
})
|
372
392
|
);
|
373
393
|
return {
|
@@ -380,7 +400,7 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
380
400
|
[attributeKey]: adminUsers
|
381
401
|
};
|
382
402
|
}
|
383
|
-
const permissionChecker2 = getService$
|
403
|
+
const permissionChecker2 = getService$2("permission-checker").create({
|
384
404
|
userAbility: params.state.userAbility,
|
385
405
|
model: attributeSchema.target
|
386
406
|
});
|
@@ -556,7 +576,7 @@ const createLifecyclesService = ({ strapi: strapi2 }) => {
|
|
556
576
|
onCommit(async () => {
|
557
577
|
for (const entry of localeEntries) {
|
558
578
|
const status = await serviceUtils.getVersionStatus(uid2, entry);
|
559
|
-
await getService(strapi2, "history").createVersion({
|
579
|
+
await getService$1(strapi2, "history").createVersion({
|
560
580
|
contentType: uid2,
|
561
581
|
data: omit(FIELDS_TO_IGNORE, entry),
|
562
582
|
relatedDocumentId: documentId,
|
@@ -569,15 +589,19 @@ const createLifecyclesService = ({ strapi: strapi2 }) => {
|
|
569
589
|
});
|
570
590
|
return result;
|
571
591
|
});
|
572
|
-
state.deleteExpiredJob = scheduleJob("0 0 * * *", () => {
|
592
|
+
state.deleteExpiredJob = scheduleJob("historyDaily", "0 0 * * *", () => {
|
573
593
|
const retentionDaysInMilliseconds = serviceUtils.getRetentionDays() * 24 * 60 * 60 * 1e3;
|
574
594
|
const expirationDate = new Date(Date.now() - retentionDaysInMilliseconds);
|
575
595
|
strapi2.db.query(HISTORY_VERSION_UID).deleteMany({
|
576
596
|
where: {
|
577
597
|
created_at: {
|
578
|
-
$lt: expirationDate
|
598
|
+
$lt: expirationDate
|
579
599
|
}
|
580
600
|
}
|
601
|
+
}).catch((error) => {
|
602
|
+
if (error instanceof Error) {
|
603
|
+
strapi2.log.error("Error deleting expired history versions", error.message);
|
604
|
+
}
|
581
605
|
});
|
582
606
|
});
|
583
607
|
state.isInitialized = true;
|
@@ -589,17 +613,17 @@ const createLifecyclesService = ({ strapi: strapi2 }) => {
|
|
589
613
|
}
|
590
614
|
};
|
591
615
|
};
|
592
|
-
const services$
|
616
|
+
const services$2 = {
|
593
617
|
history: createHistoryService,
|
594
618
|
lifecycles: createLifecyclesService
|
595
619
|
};
|
596
|
-
const info = { pluginName: "content-manager", type: "admin" };
|
620
|
+
const info$1 = { pluginName: "content-manager", type: "admin" };
|
597
621
|
const historyVersionRouter = {
|
598
622
|
type: "admin",
|
599
623
|
routes: [
|
600
624
|
{
|
601
625
|
method: "GET",
|
602
|
-
info,
|
626
|
+
info: info$1,
|
603
627
|
path: "/history-versions",
|
604
628
|
handler: "history-version.findMany",
|
605
629
|
config: {
|
@@ -608,7 +632,7 @@ const historyVersionRouter = {
|
|
608
632
|
},
|
609
633
|
{
|
610
634
|
method: "PUT",
|
611
|
-
info,
|
635
|
+
info: info$1,
|
612
636
|
path: "/history-versions/:versionId/restore",
|
613
637
|
handler: "history-version.restoreVersion",
|
614
638
|
config: {
|
@@ -617,7 +641,7 @@ const historyVersionRouter = {
|
|
617
641
|
}
|
618
642
|
]
|
619
643
|
};
|
620
|
-
const routes$
|
644
|
+
const routes$2 = {
|
621
645
|
"history-version": historyVersionRouter
|
622
646
|
};
|
623
647
|
const historyVersion = {
|
@@ -664,21 +688,21 @@ const historyVersion = {
|
|
664
688
|
}
|
665
689
|
}
|
666
690
|
};
|
667
|
-
const getFeature = () => {
|
691
|
+
const getFeature$1 = () => {
|
668
692
|
if (strapi.ee.features.isEnabled("cms-content-history")) {
|
669
693
|
return {
|
670
694
|
register({ strapi: strapi2 }) {
|
671
695
|
strapi2.get("models").add(historyVersion);
|
672
696
|
},
|
673
697
|
bootstrap({ strapi: strapi2 }) {
|
674
|
-
getService(strapi2, "lifecycles").bootstrap();
|
698
|
+
getService$1(strapi2, "lifecycles").bootstrap();
|
675
699
|
},
|
676
700
|
destroy({ strapi: strapi2 }) {
|
677
|
-
getService(strapi2, "lifecycles").destroy();
|
701
|
+
getService$1(strapi2, "lifecycles").destroy();
|
678
702
|
},
|
679
|
-
controllers: controllers$
|
680
|
-
services: services$
|
681
|
-
routes: routes$
|
703
|
+
controllers: controllers$2,
|
704
|
+
services: services$2,
|
705
|
+
routes: routes$2
|
682
706
|
};
|
683
707
|
}
|
684
708
|
return {
|
@@ -687,9 +711,205 @@ const getFeature = () => {
|
|
687
711
|
}
|
688
712
|
};
|
689
713
|
};
|
690
|
-
const history = getFeature();
|
714
|
+
const history = getFeature$1();
|
715
|
+
const FEATURE_ID = "preview";
|
716
|
+
const info = { pluginName: "content-manager", type: "admin" };
|
717
|
+
const previewRouter = {
|
718
|
+
type: "admin",
|
719
|
+
routes: [
|
720
|
+
{
|
721
|
+
method: "GET",
|
722
|
+
info,
|
723
|
+
path: "/preview/url/:contentType",
|
724
|
+
handler: "preview.getPreviewUrl",
|
725
|
+
config: {
|
726
|
+
policies: ["admin::isAuthenticatedAdmin"]
|
727
|
+
}
|
728
|
+
}
|
729
|
+
]
|
730
|
+
};
|
731
|
+
const routes$1 = {
|
732
|
+
preview: previewRouter
|
733
|
+
};
|
734
|
+
function getService(strapi2, name) {
|
735
|
+
return strapi2.service(`plugin::content-manager.${name}`);
|
736
|
+
}
|
737
|
+
const getPreviewUrlSchema = yup.object().shape({
|
738
|
+
// Will be undefined for single types
|
739
|
+
documentId: yup.string(),
|
740
|
+
locale: yup.string().nullable(),
|
741
|
+
status: yup.string()
|
742
|
+
}).required();
|
743
|
+
const validatePreviewUrl = async (strapi2, uid2, params) => {
|
744
|
+
await validateYupSchema(getPreviewUrlSchema)(params);
|
745
|
+
const newParams = pick(["documentId", "locale", "status"], params);
|
746
|
+
const model = strapi2.getModel(uid2);
|
747
|
+
if (!model || model.modelType !== "contentType") {
|
748
|
+
throw new errors.ValidationError("Invalid content type");
|
749
|
+
}
|
750
|
+
const isSingleType = model?.kind === "singleType";
|
751
|
+
if (!isSingleType && !params.documentId) {
|
752
|
+
throw new errors.ValidationError("documentId is required for Collection Types");
|
753
|
+
}
|
754
|
+
if (isSingleType) {
|
755
|
+
const doc = await strapi2.documents(uid2).findFirst();
|
756
|
+
if (!doc) {
|
757
|
+
throw new errors.NotFoundError("Document not found");
|
758
|
+
}
|
759
|
+
newParams.documentId = doc?.documentId;
|
760
|
+
}
|
761
|
+
if (!newParams.status) {
|
762
|
+
const isDPEnabled = model?.options?.draftAndPublish;
|
763
|
+
newParams.status = isDPEnabled ? "draft" : "published";
|
764
|
+
}
|
765
|
+
return newParams;
|
766
|
+
};
|
767
|
+
const createPreviewController = () => {
|
768
|
+
return {
|
769
|
+
/**
|
770
|
+
* Transforms an entry into a preview URL, so that it can be previewed
|
771
|
+
* in the Content Manager.
|
772
|
+
*/
|
773
|
+
async getPreviewUrl(ctx) {
|
774
|
+
const uid2 = ctx.params.contentType;
|
775
|
+
const query = ctx.request.query;
|
776
|
+
const params = await validatePreviewUrl(strapi, uid2, query);
|
777
|
+
const previewService = getService(strapi, "preview");
|
778
|
+
const url = await previewService.getPreviewUrl(uid2, params);
|
779
|
+
if (!url) {
|
780
|
+
ctx.status = 204;
|
781
|
+
}
|
782
|
+
return {
|
783
|
+
data: { url }
|
784
|
+
};
|
785
|
+
}
|
786
|
+
};
|
787
|
+
};
|
788
|
+
const controllers$1 = {
|
789
|
+
preview: createPreviewController
|
790
|
+
/**
|
791
|
+
* Casting is needed because the types aren't aware that Strapi supports
|
792
|
+
* passing a controller factory as the value, instead of a controller object directly
|
793
|
+
*/
|
794
|
+
};
|
795
|
+
const createPreviewService = ({ strapi: strapi2 }) => {
|
796
|
+
const config = getService(strapi2, "preview-config");
|
797
|
+
return {
|
798
|
+
async getPreviewUrl(uid2, params) {
|
799
|
+
const handler = config.getPreviewHandler();
|
800
|
+
try {
|
801
|
+
return handler(uid2, params);
|
802
|
+
} catch (error) {
|
803
|
+
strapi2.log.error(`Failed to get preview URL: ${error}`);
|
804
|
+
throw new errors.ApplicationError("Failed to get preview URL");
|
805
|
+
}
|
806
|
+
return;
|
807
|
+
}
|
808
|
+
};
|
809
|
+
};
|
810
|
+
const extendMiddlewareConfiguration = (middleware = { name: "", config: {} }) => {
|
811
|
+
const middlewares = strapi.config.get("middlewares");
|
812
|
+
const configuredMiddlewares = middlewares.map((currentMiddleware) => {
|
813
|
+
if (currentMiddleware === middleware.name) {
|
814
|
+
return middleware;
|
815
|
+
}
|
816
|
+
if (currentMiddleware.name === middleware.name) {
|
817
|
+
return mergeWith(
|
818
|
+
(objValue, srcValue) => {
|
819
|
+
if (Array.isArray(objValue)) {
|
820
|
+
return objValue.concat(srcValue);
|
821
|
+
}
|
822
|
+
return void 0;
|
823
|
+
},
|
824
|
+
currentMiddleware,
|
825
|
+
middleware
|
826
|
+
);
|
827
|
+
}
|
828
|
+
return currentMiddleware;
|
829
|
+
});
|
830
|
+
strapi.config.set("middlewares", configuredMiddlewares);
|
831
|
+
};
|
832
|
+
const createPreviewConfigService = ({ strapi: strapi2 }) => {
|
833
|
+
return {
|
834
|
+
register() {
|
835
|
+
if (!this.isEnabled()) {
|
836
|
+
return;
|
837
|
+
}
|
838
|
+
const config = strapi2.config.get("admin.preview");
|
839
|
+
if (config.config?.allowedOrigins) {
|
840
|
+
extendMiddlewareConfiguration({
|
841
|
+
name: "strapi::security",
|
842
|
+
config: {
|
843
|
+
contentSecurityPolicy: {
|
844
|
+
directives: {
|
845
|
+
"frame-src": config.config.allowedOrigins
|
846
|
+
}
|
847
|
+
}
|
848
|
+
}
|
849
|
+
});
|
850
|
+
}
|
851
|
+
},
|
852
|
+
isEnabled() {
|
853
|
+
const config = strapi2.config.get("admin.preview");
|
854
|
+
if (!config) {
|
855
|
+
return false;
|
856
|
+
}
|
857
|
+
return config?.enabled ?? true;
|
858
|
+
},
|
859
|
+
/**
|
860
|
+
* Validate if the configuration is valid
|
861
|
+
*/
|
862
|
+
validate() {
|
863
|
+
if (!this.isEnabled()) {
|
864
|
+
return;
|
865
|
+
}
|
866
|
+
const handler = this.getPreviewHandler();
|
867
|
+
if (typeof handler !== "function") {
|
868
|
+
throw new errors.ValidationError(
|
869
|
+
"Preview configuration is invalid. Handler must be a function"
|
870
|
+
);
|
871
|
+
}
|
872
|
+
},
|
873
|
+
/**
|
874
|
+
* Utility to get the preview handler from the configuration
|
875
|
+
*/
|
876
|
+
getPreviewHandler() {
|
877
|
+
const config = strapi2.config.get("admin.preview");
|
878
|
+
const emptyHandler = () => {
|
879
|
+
return void 0;
|
880
|
+
};
|
881
|
+
if (!this.isEnabled()) {
|
882
|
+
return emptyHandler;
|
883
|
+
}
|
884
|
+
return config?.config?.handler || emptyHandler;
|
885
|
+
}
|
886
|
+
};
|
887
|
+
};
|
888
|
+
const services$1 = {
|
889
|
+
preview: createPreviewService,
|
890
|
+
"preview-config": createPreviewConfigService
|
891
|
+
};
|
892
|
+
const getFeature = () => {
|
893
|
+
if (!strapi.features.future.isEnabled(FEATURE_ID)) {
|
894
|
+
return {};
|
895
|
+
}
|
896
|
+
return {
|
897
|
+
register() {
|
898
|
+
const config = getService(strapi, "preview-config");
|
899
|
+
config.validate();
|
900
|
+
config.register();
|
901
|
+
},
|
902
|
+
bootstrap() {
|
903
|
+
},
|
904
|
+
routes: routes$1,
|
905
|
+
controllers: controllers$1,
|
906
|
+
services: services$1
|
907
|
+
};
|
908
|
+
};
|
909
|
+
const preview = getFeature();
|
691
910
|
const register = async ({ strapi: strapi2 }) => {
|
692
911
|
await history.register?.({ strapi: strapi2 });
|
912
|
+
await preview.register?.({ strapi: strapi2 });
|
693
913
|
};
|
694
914
|
const ALLOWED_WEBHOOK_EVENTS = {
|
695
915
|
ENTRY_PUBLISH: "entry.publish",
|
@@ -699,11 +919,12 @@ const bootstrap = async () => {
|
|
699
919
|
Object.entries(ALLOWED_WEBHOOK_EVENTS).forEach(([key, value]) => {
|
700
920
|
strapi.get("webhookStore").addAllowedEvent(key, value);
|
701
921
|
});
|
702
|
-
getService$
|
703
|
-
await getService$
|
704
|
-
await getService$
|
705
|
-
await getService$
|
922
|
+
getService$2("field-sizes").setCustomFieldInputSizes();
|
923
|
+
await getService$2("components").syncConfigurations();
|
924
|
+
await getService$2("content-types").syncConfigurations();
|
925
|
+
await getService$2("permission").registerPermissions();
|
706
926
|
await history.bootstrap?.({ strapi });
|
927
|
+
await preview.bootstrap?.({ strapi });
|
707
928
|
};
|
708
929
|
const destroy = async ({ strapi: strapi2 }) => {
|
709
930
|
await history.destroy?.({ strapi: strapi2 });
|
@@ -1193,7 +1414,8 @@ const admin = {
|
|
1193
1414
|
};
|
1194
1415
|
const routes = {
|
1195
1416
|
admin,
|
1196
|
-
...history.routes ? history.routes : {}
|
1417
|
+
...history.routes ? history.routes : {},
|
1418
|
+
...preview.routes ? preview.routes : {}
|
1197
1419
|
};
|
1198
1420
|
const hasPermissionsSchema = yup$1.object({
|
1199
1421
|
actions: yup$1.array().of(yup$1.string()),
|
@@ -1256,8 +1478,7 @@ const isSortable = (schema, name) => {
|
|
1256
1478
|
if (!_.has(schema.attributes, name)) {
|
1257
1479
|
return false;
|
1258
1480
|
}
|
1259
|
-
if (schema.modelType === "component" && name === "id")
|
1260
|
-
return false;
|
1481
|
+
if (schema.modelType === "component" && name === "id") return false;
|
1261
1482
|
const attribute = schema.attributes[name];
|
1262
1483
|
if (NON_SORTABLES.includes(attribute.type)) {
|
1263
1484
|
return false;
|
@@ -1402,8 +1623,7 @@ const createDefaultSettings = async (schema) => {
|
|
1402
1623
|
};
|
1403
1624
|
};
|
1404
1625
|
const syncSettings = async (configuration, schema) => {
|
1405
|
-
if (isEmpty(configuration.settings))
|
1406
|
-
return createDefaultSettings(schema);
|
1626
|
+
if (isEmpty(configuration.settings)) return createDefaultSettings(schema);
|
1407
1627
|
const defaultField = getDefaultMainField(schema);
|
1408
1628
|
const { mainField = defaultField, defaultSortBy = defaultField } = configuration.settings || {};
|
1409
1629
|
return {
|
@@ -1450,7 +1670,7 @@ const createMetadasSchema = (schema) => {
|
|
1450
1670
|
if (!value) {
|
1451
1671
|
return yup$1.string();
|
1452
1672
|
}
|
1453
|
-
const targetSchema = getService$
|
1673
|
+
const targetSchema = getService$2("content-types").findContentType(
|
1454
1674
|
schema.attributes[key].targetModel
|
1455
1675
|
);
|
1456
1676
|
if (!targetSchema) {
|
@@ -1579,8 +1799,7 @@ const excludeNotCreatableFields = (uid2, permissionChecker2) => (body, path = []
|
|
1579
1799
|
}
|
1580
1800
|
switch (attribute.type) {
|
1581
1801
|
case "relation": {
|
1582
|
-
if (canCreate(attributePath))
|
1583
|
-
return body2;
|
1802
|
+
if (canCreate(attributePath)) return body2;
|
1584
1803
|
return set(attributePath, { set: [] }, body2);
|
1585
1804
|
}
|
1586
1805
|
case "component": {
|
@@ -1590,8 +1809,7 @@ const excludeNotCreatableFields = (uid2, permissionChecker2) => (body, path = []
|
|
1590
1809
|
]);
|
1591
1810
|
}
|
1592
1811
|
default: {
|
1593
|
-
if (canCreate(attributePath))
|
1594
|
-
return body2;
|
1812
|
+
if (canCreate(attributePath)) return body2;
|
1595
1813
|
return set(attributePath, null, body2);
|
1596
1814
|
}
|
1597
1815
|
}
|
@@ -1619,7 +1837,7 @@ const getDocumentLocaleAndStatus = async (request, model, opts = { allowMultiple
|
|
1619
1837
|
}
|
1620
1838
|
};
|
1621
1839
|
const formatDocumentWithMetadata = async (permissionChecker2, uid2, document, opts = {}) => {
|
1622
|
-
const documentMetadata2 = getService$
|
1840
|
+
const documentMetadata2 = getService$2("document-metadata");
|
1623
1841
|
const serviceOutput = await documentMetadata2.formatDocumentWithMetadata(uid2, document, opts);
|
1624
1842
|
let {
|
1625
1843
|
meta: { availableLocales, availableStatus }
|
@@ -1645,8 +1863,8 @@ const createDocument = async (ctx, opts) => {
|
|
1645
1863
|
const { userAbility, user } = ctx.state;
|
1646
1864
|
const { model } = ctx.params;
|
1647
1865
|
const { body } = ctx.request;
|
1648
|
-
const documentManager2 = getService$
|
1649
|
-
const permissionChecker2 = getService$
|
1866
|
+
const documentManager2 = getService$2("document-manager");
|
1867
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1650
1868
|
if (permissionChecker2.cannot.create()) {
|
1651
1869
|
throw new errors.ForbiddenError();
|
1652
1870
|
}
|
@@ -1666,13 +1884,13 @@ const updateDocument = async (ctx, opts) => {
|
|
1666
1884
|
const { userAbility, user } = ctx.state;
|
1667
1885
|
const { id, model } = ctx.params;
|
1668
1886
|
const { body } = ctx.request;
|
1669
|
-
const documentManager2 = getService$
|
1670
|
-
const permissionChecker2 = getService$
|
1887
|
+
const documentManager2 = getService$2("document-manager");
|
1888
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1671
1889
|
if (permissionChecker2.cannot.update()) {
|
1672
1890
|
throw new errors.ForbiddenError();
|
1673
1891
|
}
|
1674
1892
|
const permissionQuery = await permissionChecker2.sanitizedQuery.update(ctx.query);
|
1675
|
-
const populate = await getService$
|
1893
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1676
1894
|
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1677
1895
|
const [documentVersion, documentExists] = await Promise.all([
|
1678
1896
|
documentManager2.findOne(id, model, { populate, locale, status: "draft" }),
|
@@ -1689,7 +1907,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1689
1907
|
throw new errors.ForbiddenError();
|
1690
1908
|
}
|
1691
1909
|
const pickPermittedFields = documentVersion ? permissionChecker2.sanitizeUpdateInput(documentVersion) : permissionChecker2.sanitizeCreateInput;
|
1692
|
-
const setCreator = setCreatorFields({ user, isEdition: true });
|
1910
|
+
const setCreator = documentVersion ? setCreatorFields({ user, isEdition: true }) : setCreatorFields({ user });
|
1693
1911
|
const sanitizeFn = async.pipe(pickPermittedFields, setCreator);
|
1694
1912
|
const sanitizedBody = await sanitizeFn(body);
|
1695
1913
|
return documentManager2.update(documentVersion?.documentId || id, model, {
|
@@ -1703,14 +1921,14 @@ const collectionTypes = {
|
|
1703
1921
|
const { userAbility } = ctx.state;
|
1704
1922
|
const { model } = ctx.params;
|
1705
1923
|
const { query } = ctx.request;
|
1706
|
-
const documentMetadata2 = getService$
|
1707
|
-
const documentManager2 = getService$
|
1708
|
-
const permissionChecker2 = getService$
|
1924
|
+
const documentMetadata2 = getService$2("document-metadata");
|
1925
|
+
const documentManager2 = getService$2("document-manager");
|
1926
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1709
1927
|
if (permissionChecker2.cannot.read()) {
|
1710
1928
|
return ctx.forbidden();
|
1711
1929
|
}
|
1712
1930
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(query);
|
1713
|
-
const populate = await getService$
|
1931
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(1).countRelations({ toOne: false, toMany: true }).build();
|
1714
1932
|
const { locale, status } = await getDocumentLocaleAndStatus(query, model);
|
1715
1933
|
const { results: documents, pagination: pagination2 } = await documentManager2.findPage(
|
1716
1934
|
{ ...permissionQuery, populate, locale, status },
|
@@ -1739,13 +1957,13 @@ const collectionTypes = {
|
|
1739
1957
|
async findOne(ctx) {
|
1740
1958
|
const { userAbility } = ctx.state;
|
1741
1959
|
const { model, id } = ctx.params;
|
1742
|
-
const documentManager2 = getService$
|
1743
|
-
const permissionChecker2 = getService$
|
1960
|
+
const documentManager2 = getService$2("document-manager");
|
1961
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1744
1962
|
if (permissionChecker2.cannot.read()) {
|
1745
1963
|
return ctx.forbidden();
|
1746
1964
|
}
|
1747
1965
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
1748
|
-
const populate = await getService$
|
1966
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1749
1967
|
const { locale, status } = await getDocumentLocaleAndStatus(ctx.query, model);
|
1750
1968
|
const version = await documentManager2.findOne(id, model, {
|
1751
1969
|
populate,
|
@@ -1776,7 +1994,7 @@ const collectionTypes = {
|
|
1776
1994
|
async create(ctx) {
|
1777
1995
|
const { userAbility } = ctx.state;
|
1778
1996
|
const { model } = ctx.params;
|
1779
|
-
const permissionChecker2 = getService$
|
1997
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1780
1998
|
const [totalEntries, document] = await Promise.all([
|
1781
1999
|
strapi.db.query(model).count(),
|
1782
2000
|
createDocument(ctx)
|
@@ -1797,7 +2015,7 @@ const collectionTypes = {
|
|
1797
2015
|
async update(ctx) {
|
1798
2016
|
const { userAbility } = ctx.state;
|
1799
2017
|
const { model } = ctx.params;
|
1800
|
-
const permissionChecker2 = getService$
|
2018
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1801
2019
|
const updatedVersion = await updateDocument(ctx);
|
1802
2020
|
const sanitizedVersion = await permissionChecker2.sanitizeOutput(updatedVersion);
|
1803
2021
|
ctx.body = await formatDocumentWithMetadata(permissionChecker2, model, sanitizedVersion);
|
@@ -1806,13 +2024,13 @@ const collectionTypes = {
|
|
1806
2024
|
const { userAbility, user } = ctx.state;
|
1807
2025
|
const { model, sourceId: id } = ctx.params;
|
1808
2026
|
const { body } = ctx.request;
|
1809
|
-
const documentManager2 = getService$
|
1810
|
-
const permissionChecker2 = getService$
|
2027
|
+
const documentManager2 = getService$2("document-manager");
|
2028
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1811
2029
|
if (permissionChecker2.cannot.create()) {
|
1812
2030
|
return ctx.forbidden();
|
1813
2031
|
}
|
1814
2032
|
const permissionQuery = await permissionChecker2.sanitizedQuery.create(ctx.query);
|
1815
|
-
const populate = await getService$
|
2033
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1816
2034
|
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1817
2035
|
const document = await documentManager2.findOne(id, model, {
|
1818
2036
|
populate,
|
@@ -1851,13 +2069,13 @@ const collectionTypes = {
|
|
1851
2069
|
async delete(ctx) {
|
1852
2070
|
const { userAbility } = ctx.state;
|
1853
2071
|
const { id, model } = ctx.params;
|
1854
|
-
const documentManager2 = getService$
|
1855
|
-
const permissionChecker2 = getService$
|
2072
|
+
const documentManager2 = getService$2("document-manager");
|
2073
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1856
2074
|
if (permissionChecker2.cannot.delete()) {
|
1857
2075
|
return ctx.forbidden();
|
1858
2076
|
}
|
1859
2077
|
const permissionQuery = await permissionChecker2.sanitizedQuery.delete(ctx.query);
|
1860
|
-
const populate = await getService$
|
2078
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1861
2079
|
const { locale } = await getDocumentLocaleAndStatus(ctx.query, model);
|
1862
2080
|
const documentLocales = await documentManager2.findLocales(id, model, { populate, locale });
|
1863
2081
|
if (documentLocales.length === 0) {
|
@@ -1879,14 +2097,14 @@ const collectionTypes = {
|
|
1879
2097
|
const { userAbility } = ctx.state;
|
1880
2098
|
const { id, model } = ctx.params;
|
1881
2099
|
const { body } = ctx.request;
|
1882
|
-
const documentManager2 = getService$
|
1883
|
-
const permissionChecker2 = getService$
|
2100
|
+
const documentManager2 = getService$2("document-manager");
|
2101
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1884
2102
|
if (permissionChecker2.cannot.publish()) {
|
1885
2103
|
return ctx.forbidden();
|
1886
2104
|
}
|
1887
2105
|
const publishedDocument = await strapi.db.transaction(async () => {
|
1888
2106
|
const permissionQuery = await permissionChecker2.sanitizedQuery.publish(ctx.query);
|
1889
|
-
const populate = await getService$
|
2107
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1890
2108
|
let document;
|
1891
2109
|
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1892
2110
|
const isCreate = isNil$1(id);
|
@@ -1934,13 +2152,13 @@ const collectionTypes = {
|
|
1934
2152
|
const { body } = ctx.request;
|
1935
2153
|
const { documentIds } = body;
|
1936
2154
|
await validateBulkActionInput(body);
|
1937
|
-
const documentManager2 = getService$
|
1938
|
-
const permissionChecker2 = getService$
|
2155
|
+
const documentManager2 = getService$2("document-manager");
|
2156
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1939
2157
|
if (permissionChecker2.cannot.publish()) {
|
1940
2158
|
return ctx.forbidden();
|
1941
2159
|
}
|
1942
2160
|
const permissionQuery = await permissionChecker2.sanitizedQuery.publish(ctx.query);
|
1943
|
-
const populate = await getService$
|
2161
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1944
2162
|
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
1945
2163
|
allowMultipleLocales: true
|
1946
2164
|
});
|
@@ -1965,8 +2183,8 @@ const collectionTypes = {
|
|
1965
2183
|
const { body } = ctx.request;
|
1966
2184
|
const { documentIds } = body;
|
1967
2185
|
await validateBulkActionInput(body);
|
1968
|
-
const documentManager2 = getService$
|
1969
|
-
const permissionChecker2 = getService$
|
2186
|
+
const documentManager2 = getService$2("document-manager");
|
2187
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
1970
2188
|
if (permissionChecker2.cannot.unpublish()) {
|
1971
2189
|
return ctx.forbidden();
|
1972
2190
|
}
|
@@ -1995,8 +2213,8 @@ const collectionTypes = {
|
|
1995
2213
|
const {
|
1996
2214
|
body: { discardDraft, ...body }
|
1997
2215
|
} = ctx.request;
|
1998
|
-
const documentManager2 = getService$
|
1999
|
-
const permissionChecker2 = getService$
|
2216
|
+
const documentManager2 = getService$2("document-manager");
|
2217
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2000
2218
|
if (permissionChecker2.cannot.unpublish()) {
|
2001
2219
|
return ctx.forbidden();
|
2002
2220
|
}
|
@@ -2004,7 +2222,7 @@ const collectionTypes = {
|
|
2004
2222
|
return ctx.forbidden();
|
2005
2223
|
}
|
2006
2224
|
const permissionQuery = await permissionChecker2.sanitizedQuery.unpublish(ctx.query);
|
2007
|
-
const populate = await getService$
|
2225
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2008
2226
|
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2009
2227
|
const document = await documentManager2.findOne(id, model, {
|
2010
2228
|
populate,
|
@@ -2035,13 +2253,13 @@ const collectionTypes = {
|
|
2035
2253
|
const { userAbility } = ctx.state;
|
2036
2254
|
const { id, model } = ctx.params;
|
2037
2255
|
const { body } = ctx.request;
|
2038
|
-
const documentManager2 = getService$
|
2039
|
-
const permissionChecker2 = getService$
|
2256
|
+
const documentManager2 = getService$2("document-manager");
|
2257
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2040
2258
|
if (permissionChecker2.cannot.discard()) {
|
2041
2259
|
return ctx.forbidden();
|
2042
2260
|
}
|
2043
2261
|
const permissionQuery = await permissionChecker2.sanitizedQuery.discard(ctx.query);
|
2044
|
-
const populate = await getService$
|
2262
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2045
2263
|
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2046
2264
|
const document = await documentManager2.findOne(id, model, {
|
2047
2265
|
populate,
|
@@ -2066,13 +2284,13 @@ const collectionTypes = {
|
|
2066
2284
|
const { query, body } = ctx.request;
|
2067
2285
|
const { documentIds } = body;
|
2068
2286
|
await validateBulkActionInput(body);
|
2069
|
-
const documentManager2 = getService$
|
2070
|
-
const permissionChecker2 = getService$
|
2287
|
+
const documentManager2 = getService$2("document-manager");
|
2288
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2071
2289
|
if (permissionChecker2.cannot.delete()) {
|
2072
2290
|
return ctx.forbidden();
|
2073
2291
|
}
|
2074
2292
|
const permissionQuery = await permissionChecker2.sanitizedQuery.delete(query);
|
2075
|
-
const populate = await getService$
|
2293
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2076
2294
|
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2077
2295
|
const documentLocales = await documentManager2.findLocales(documentIds, model, {
|
2078
2296
|
populate,
|
@@ -2093,13 +2311,13 @@ const collectionTypes = {
|
|
2093
2311
|
async countDraftRelations(ctx) {
|
2094
2312
|
const { userAbility } = ctx.state;
|
2095
2313
|
const { model, id } = ctx.params;
|
2096
|
-
const documentManager2 = getService$
|
2097
|
-
const permissionChecker2 = getService$
|
2314
|
+
const documentManager2 = getService$2("document-manager");
|
2315
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2098
2316
|
if (permissionChecker2.cannot.read()) {
|
2099
2317
|
return ctx.forbidden();
|
2100
2318
|
}
|
2101
2319
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
2102
|
-
const populate = await getService$
|
2320
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2103
2321
|
const { locale, status } = await getDocumentLocaleAndStatus(ctx.query, model);
|
2104
2322
|
const entity = await documentManager2.findOne(id, model, { populate, locale, status });
|
2105
2323
|
if (!entity) {
|
@@ -2118,8 +2336,8 @@ const collectionTypes = {
|
|
2118
2336
|
const ids = ctx.request.query.documentIds;
|
2119
2337
|
const locale = ctx.request.query.locale;
|
2120
2338
|
const { model } = ctx.params;
|
2121
|
-
const documentManager2 = getService$
|
2122
|
-
const permissionChecker2 = getService$
|
2339
|
+
const documentManager2 = getService$2("document-manager");
|
2340
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2123
2341
|
if (permissionChecker2.cannot.read()) {
|
2124
2342
|
return ctx.forbidden();
|
2125
2343
|
}
|
@@ -2143,13 +2361,13 @@ const collectionTypes = {
|
|
2143
2361
|
};
|
2144
2362
|
const components$1 = {
|
2145
2363
|
findComponents(ctx) {
|
2146
|
-
const components2 = getService$
|
2147
|
-
const { toDto } = getService$
|
2364
|
+
const components2 = getService$2("components").findAllComponents();
|
2365
|
+
const { toDto } = getService$2("data-mapper");
|
2148
2366
|
ctx.body = { data: components2.map(toDto) };
|
2149
2367
|
},
|
2150
2368
|
async findComponentConfiguration(ctx) {
|
2151
2369
|
const { uid: uid2 } = ctx.params;
|
2152
|
-
const componentService = getService$
|
2370
|
+
const componentService = getService$2("components");
|
2153
2371
|
const component = componentService.findComponent(uid2);
|
2154
2372
|
if (!component) {
|
2155
2373
|
return ctx.notFound("component.notFound");
|
@@ -2166,7 +2384,7 @@ const components$1 = {
|
|
2166
2384
|
async updateComponentConfiguration(ctx) {
|
2167
2385
|
const { uid: uid2 } = ctx.params;
|
2168
2386
|
const { body } = ctx.request;
|
2169
|
-
const componentService = getService$
|
2387
|
+
const componentService = getService$2("components");
|
2170
2388
|
const component = componentService.findComponent(uid2);
|
2171
2389
|
if (!component) {
|
2172
2390
|
return ctx.notFound("component.notFound");
|
@@ -2200,12 +2418,12 @@ const contentTypes = {
|
|
2200
2418
|
} catch (error) {
|
2201
2419
|
return ctx.send({ error }, 400);
|
2202
2420
|
}
|
2203
|
-
const contentTypes2 = getService$
|
2204
|
-
const { toDto } = getService$
|
2421
|
+
const contentTypes2 = getService$2("content-types").findContentTypesByKind(kind);
|
2422
|
+
const { toDto } = getService$2("data-mapper");
|
2205
2423
|
ctx.body = { data: contentTypes2.map(toDto) };
|
2206
2424
|
},
|
2207
2425
|
async findContentTypesSettings(ctx) {
|
2208
|
-
const { findAllContentTypes, findConfiguration } = getService$
|
2426
|
+
const { findAllContentTypes, findConfiguration } = getService$2("content-types");
|
2209
2427
|
const contentTypes2 = await findAllContentTypes();
|
2210
2428
|
const configurations = await Promise.all(
|
2211
2429
|
contentTypes2.map(async (contentType) => {
|
@@ -2219,7 +2437,7 @@ const contentTypes = {
|
|
2219
2437
|
},
|
2220
2438
|
async findContentTypeConfiguration(ctx) {
|
2221
2439
|
const { uid: uid2 } = ctx.params;
|
2222
|
-
const contentTypeService = getService$
|
2440
|
+
const contentTypeService = getService$2("content-types");
|
2223
2441
|
const contentType = await contentTypeService.findContentType(uid2);
|
2224
2442
|
if (!contentType) {
|
2225
2443
|
return ctx.notFound("contentType.notFound");
|
@@ -2241,13 +2459,13 @@ const contentTypes = {
|
|
2241
2459
|
const { userAbility } = ctx.state;
|
2242
2460
|
const { uid: uid2 } = ctx.params;
|
2243
2461
|
const { body } = ctx.request;
|
2244
|
-
const contentTypeService = getService$
|
2245
|
-
const metricsService = getService$
|
2462
|
+
const contentTypeService = getService$2("content-types");
|
2463
|
+
const metricsService = getService$2("metrics");
|
2246
2464
|
const contentType = await contentTypeService.findContentType(uid2);
|
2247
2465
|
if (!contentType) {
|
2248
2466
|
return ctx.notFound("contentType.notFound");
|
2249
2467
|
}
|
2250
|
-
if (!getService$
|
2468
|
+
if (!getService$2("permission").canConfigureContentType({ userAbility, contentType })) {
|
2251
2469
|
return ctx.forbidden();
|
2252
2470
|
}
|
2253
2471
|
let input;
|
@@ -2280,10 +2498,10 @@ const contentTypes = {
|
|
2280
2498
|
};
|
2281
2499
|
const init = {
|
2282
2500
|
getInitData(ctx) {
|
2283
|
-
const { toDto } = getService$
|
2284
|
-
const { findAllComponents } = getService$
|
2285
|
-
const { getAllFieldSizes } = getService$
|
2286
|
-
const { findAllContentTypes } = getService$
|
2501
|
+
const { toDto } = getService$2("data-mapper");
|
2502
|
+
const { findAllComponents } = getService$2("components");
|
2503
|
+
const { getAllFieldSizes } = getService$2("field-sizes");
|
2504
|
+
const { findAllContentTypes } = getService$2("content-types");
|
2287
2505
|
ctx.body = {
|
2288
2506
|
data: {
|
2289
2507
|
fieldSizes: getAllFieldSizes(),
|
@@ -2319,7 +2537,7 @@ const addFiltersClause = (params, filtersClause) => {
|
|
2319
2537
|
params.filters.$and.push(filtersClause);
|
2320
2538
|
};
|
2321
2539
|
const sanitizeMainField = (model, mainField, userAbility) => {
|
2322
|
-
const permissionChecker2 = getService$
|
2540
|
+
const permissionChecker2 = getService$2("permission-checker").create({
|
2323
2541
|
userAbility,
|
2324
2542
|
model: model.uid
|
2325
2543
|
});
|
@@ -2333,15 +2551,27 @@ const sanitizeMainField = (model, mainField, userAbility) => {
|
|
2333
2551
|
}
|
2334
2552
|
return mainField;
|
2335
2553
|
};
|
2336
|
-
const addStatusToRelations = async (
|
2337
|
-
if (!contentTypes$1.hasDraftAndPublish(strapi.
|
2554
|
+
const addStatusToRelations = async (targetUid, relations2) => {
|
2555
|
+
if (!contentTypes$1.hasDraftAndPublish(strapi.getModel(targetUid))) {
|
2556
|
+
return relations2;
|
2557
|
+
}
|
2558
|
+
const documentMetadata2 = getService$2("document-metadata");
|
2559
|
+
if (!relations2.length) {
|
2338
2560
|
return relations2;
|
2339
2561
|
}
|
2340
|
-
const
|
2341
|
-
const
|
2562
|
+
const firstRelation = relations2[0];
|
2563
|
+
const filters = {
|
2564
|
+
documentId: { $in: relations2.map((r) => r.documentId) },
|
2565
|
+
// NOTE: find the "opposite" status
|
2566
|
+
publishedAt: firstRelation.publishedAt !== null ? { $null: true } : { $notNull: true }
|
2567
|
+
};
|
2568
|
+
const availableStatus = await strapi.query(targetUid).findMany({
|
2569
|
+
select: ["id", "documentId", "locale", "updatedAt", "createdAt", "publishedAt"],
|
2570
|
+
filters
|
2571
|
+
});
|
2342
2572
|
return relations2.map((relation) => {
|
2343
|
-
const availableStatuses =
|
2344
|
-
(availableDocument) => availableDocument.documentId === relation.documentId
|
2573
|
+
const availableStatuses = availableStatus.filter(
|
2574
|
+
(availableDocument) => availableDocument.documentId === relation.documentId && (relation.locale ? availableDocument.locale === relation.locale : true)
|
2345
2575
|
);
|
2346
2576
|
return {
|
2347
2577
|
...relation,
|
@@ -2362,11 +2592,8 @@ const validateLocale = (sourceUid, targetUid, locale) => {
|
|
2362
2592
|
const isLocalized = strapi.plugin("i18n").service("content-types").isLocalizedContentType;
|
2363
2593
|
const isSourceLocalized = isLocalized(sourceModel);
|
2364
2594
|
const isTargetLocalized = isLocalized(targetModel);
|
2365
|
-
let validatedLocale = locale;
|
2366
|
-
if (!targetModel || !isTargetLocalized)
|
2367
|
-
validatedLocale = void 0;
|
2368
2595
|
return {
|
2369
|
-
locale
|
2596
|
+
locale,
|
2370
2597
|
isSourceLocalized,
|
2371
2598
|
isTargetLocalized
|
2372
2599
|
};
|
@@ -2375,8 +2602,7 @@ const validateStatus = (sourceUid, status) => {
|
|
2375
2602
|
const sourceModel = strapi.getModel(sourceUid);
|
2376
2603
|
const isDP = contentTypes$1.hasDraftAndPublish;
|
2377
2604
|
const isSourceDP = isDP(sourceModel);
|
2378
|
-
if (!isSourceDP)
|
2379
|
-
return { status: void 0 };
|
2605
|
+
if (!isSourceDP) return { status: void 0 };
|
2380
2606
|
switch (status) {
|
2381
2607
|
case "published":
|
2382
2608
|
return { status: "published" };
|
@@ -2406,7 +2632,7 @@ const relations = {
|
|
2406
2632
|
ctx.request?.query?.locale
|
2407
2633
|
);
|
2408
2634
|
const { status } = validateStatus(sourceUid, ctx.request?.query?.status);
|
2409
|
-
const permissionChecker2 = getService$
|
2635
|
+
const permissionChecker2 = getService$2("permission-checker").create({
|
2410
2636
|
userAbility,
|
2411
2637
|
model
|
2412
2638
|
});
|
@@ -2431,7 +2657,7 @@ const relations = {
|
|
2431
2657
|
where.id = id;
|
2432
2658
|
}
|
2433
2659
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
2434
|
-
const populate = await getService$
|
2660
|
+
const populate = await getService$2("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2435
2661
|
const currentEntity = await strapi.db.query(model).findOne({
|
2436
2662
|
where,
|
2437
2663
|
populate
|
@@ -2446,7 +2672,7 @@ const relations = {
|
|
2446
2672
|
}
|
2447
2673
|
entryId = currentEntity.id;
|
2448
2674
|
}
|
2449
|
-
const modelConfig = isComponent2 ? await getService$
|
2675
|
+
const modelConfig = isComponent2 ? await getService$2("components").findConfiguration(sourceSchema) : await getService$2("content-types").findConfiguration(sourceSchema);
|
2450
2676
|
const targetSchema = strapi.getModel(targetUid);
|
2451
2677
|
const mainField = flow(
|
2452
2678
|
prop(`metadatas.${targetField}.edit.mainField`),
|
@@ -2469,7 +2695,7 @@ const relations = {
|
|
2469
2695
|
attribute,
|
2470
2696
|
fieldsToSelect,
|
2471
2697
|
mainField,
|
2472
|
-
source: { schema: sourceSchema },
|
2698
|
+
source: { schema: sourceSchema, isLocalized: isSourceLocalized },
|
2473
2699
|
target: { schema: targetSchema, isLocalized: isTargetLocalized },
|
2474
2700
|
sourceSchema,
|
2475
2701
|
targetSchema,
|
@@ -2491,7 +2717,8 @@ const relations = {
|
|
2491
2717
|
fieldsToSelect,
|
2492
2718
|
mainField,
|
2493
2719
|
source: {
|
2494
|
-
schema: { uid: sourceUid, modelType: sourceModelType }
|
2720
|
+
schema: { uid: sourceUid, modelType: sourceModelType },
|
2721
|
+
isLocalized: isSourceLocalized
|
2495
2722
|
},
|
2496
2723
|
target: {
|
2497
2724
|
schema: { uid: targetUid },
|
@@ -2499,7 +2726,7 @@ const relations = {
|
|
2499
2726
|
}
|
2500
2727
|
} = await this.extractAndValidateRequestInfo(ctx, id);
|
2501
2728
|
const { idsToOmit, idsToInclude, _q, ...query } = ctx.request.query;
|
2502
|
-
const permissionChecker2 = getService$
|
2729
|
+
const permissionChecker2 = getService$2("permission-checker").create({
|
2503
2730
|
userAbility: ctx.state.userAbility,
|
2504
2731
|
model: targetUid
|
2505
2732
|
});
|
@@ -2533,9 +2760,12 @@ const relations = {
|
|
2533
2760
|
if (!isEmpty(publishedAt)) {
|
2534
2761
|
where[`${alias}.published_at`] = publishedAt;
|
2535
2762
|
}
|
2536
|
-
if (
|
2763
|
+
if (isTargetLocalized && locale) {
|
2537
2764
|
where[`${alias}.locale`] = locale;
|
2538
2765
|
}
|
2766
|
+
if (isSourceLocalized && locale) {
|
2767
|
+
where.locale = locale;
|
2768
|
+
}
|
2539
2769
|
if ((idsToInclude?.length ?? 0) !== 0) {
|
2540
2770
|
where[`${alias}.id`].$notIn = idsToInclude;
|
2541
2771
|
}
|
@@ -2553,7 +2783,8 @@ const relations = {
|
|
2553
2783
|
id: { $notIn: uniq(idsToOmit) }
|
2554
2784
|
});
|
2555
2785
|
}
|
2556
|
-
const
|
2786
|
+
const dbQuery = strapi.get("query-params").transform(targetUid, queryParams);
|
2787
|
+
const res = await strapi.db.query(targetUid).findPage(dbQuery);
|
2557
2788
|
ctx.body = {
|
2558
2789
|
...res,
|
2559
2790
|
results: await addStatusToRelations(targetUid, res.results)
|
@@ -2568,21 +2799,33 @@ const relations = {
|
|
2568
2799
|
attribute,
|
2569
2800
|
targetField,
|
2570
2801
|
fieldsToSelect,
|
2571
|
-
|
2572
|
-
|
2573
|
-
}
|
2574
|
-
target: {
|
2575
|
-
schema: { uid: targetUid }
|
2576
|
-
}
|
2802
|
+
status,
|
2803
|
+
source: { schema: sourceSchema },
|
2804
|
+
target: { schema: targetSchema }
|
2577
2805
|
} = await this.extractAndValidateRequestInfo(ctx, id);
|
2578
|
-
const
|
2806
|
+
const { uid: sourceUid } = sourceSchema;
|
2807
|
+
const { uid: targetUid } = targetSchema;
|
2808
|
+
const permissionQuery = await getService$2("permission-checker").create({ userAbility, model: targetUid }).sanitizedQuery.read({ fields: fieldsToSelect });
|
2579
2809
|
const dbQuery = strapi.db.query(sourceUid);
|
2580
2810
|
const loadRelations = relations$1.isAnyToMany(attribute) ? (...args) => dbQuery.loadPages(...args) : (...args) => dbQuery.load(...args).then((res2) => ({ results: res2 ? [res2] : [] }));
|
2811
|
+
const filters = {};
|
2812
|
+
if (sourceSchema?.options?.draftAndPublish) {
|
2813
|
+
if (targetSchema?.options?.draftAndPublish) {
|
2814
|
+
if (status === "published") {
|
2815
|
+
filters.publishedAt = { $notNull: true };
|
2816
|
+
} else {
|
2817
|
+
filters.publishedAt = { $null: true };
|
2818
|
+
}
|
2819
|
+
}
|
2820
|
+
} else if (targetSchema?.options?.draftAndPublish) {
|
2821
|
+
filters.publishedAt = { $null: true };
|
2822
|
+
}
|
2581
2823
|
const res = await loadRelations({ id: entryId }, targetField, {
|
2582
|
-
select: ["id", "documentId", "locale", "publishedAt"],
|
2824
|
+
select: ["id", "documentId", "locale", "publishedAt", "updatedAt"],
|
2583
2825
|
ordering: "desc",
|
2584
2826
|
page: ctx.request.query.page,
|
2585
|
-
pageSize: ctx.request.query.pageSize
|
2827
|
+
pageSize: ctx.request.query.pageSize,
|
2828
|
+
filters
|
2586
2829
|
});
|
2587
2830
|
const loadedIds = res.results.map((item) => item.id);
|
2588
2831
|
addFiltersClause(permissionQuery, { id: { $in: loadedIds } });
|
@@ -2603,10 +2846,10 @@ const relations = {
|
|
2603
2846
|
}
|
2604
2847
|
};
|
2605
2848
|
const buildPopulateFromQuery = async (query, model) => {
|
2606
|
-
return getService$
|
2849
|
+
return getService$2("populate-builder")(model).populateFromQuery(query).populateDeep(Infinity).countRelations().build();
|
2607
2850
|
};
|
2608
2851
|
const findDocument = async (query, uid2, opts = {}) => {
|
2609
|
-
const documentManager2 = getService$
|
2852
|
+
const documentManager2 = getService$2("document-manager");
|
2610
2853
|
const populate = await buildPopulateFromQuery(query, uid2);
|
2611
2854
|
return documentManager2.findMany({ ...opts, populate }, uid2).then((documents) => documents[0]);
|
2612
2855
|
};
|
@@ -2614,8 +2857,8 @@ const createOrUpdateDocument = async (ctx, opts) => {
|
|
2614
2857
|
const { user, userAbility } = ctx.state;
|
2615
2858
|
const { model } = ctx.params;
|
2616
2859
|
const { body, query } = ctx.request;
|
2617
|
-
const documentManager2 = getService$
|
2618
|
-
const permissionChecker2 = getService$
|
2860
|
+
const documentManager2 = getService$2("document-manager");
|
2861
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2619
2862
|
if (permissionChecker2.cannot.create() && permissionChecker2.cannot.update()) {
|
2620
2863
|
throw new errors.ForbiddenError();
|
2621
2864
|
}
|
@@ -2656,7 +2899,7 @@ const singleTypes = {
|
|
2656
2899
|
const { userAbility } = ctx.state;
|
2657
2900
|
const { model } = ctx.params;
|
2658
2901
|
const { query = {} } = ctx.request;
|
2659
|
-
const permissionChecker2 = getService$
|
2902
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2660
2903
|
if (permissionChecker2.cannot.read()) {
|
2661
2904
|
return ctx.forbidden();
|
2662
2905
|
}
|
@@ -2690,7 +2933,7 @@ const singleTypes = {
|
|
2690
2933
|
async createOrUpdate(ctx) {
|
2691
2934
|
const { userAbility } = ctx.state;
|
2692
2935
|
const { model } = ctx.params;
|
2693
|
-
const permissionChecker2 = getService$
|
2936
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2694
2937
|
const document = await createOrUpdateDocument(ctx);
|
2695
2938
|
const sanitizedDocument = await permissionChecker2.sanitizeOutput(document);
|
2696
2939
|
ctx.body = await formatDocumentWithMetadata(permissionChecker2, model, sanitizedDocument);
|
@@ -2699,8 +2942,8 @@ const singleTypes = {
|
|
2699
2942
|
const { userAbility } = ctx.state;
|
2700
2943
|
const { model } = ctx.params;
|
2701
2944
|
const { query = {} } = ctx.request;
|
2702
|
-
const documentManager2 = getService$
|
2703
|
-
const permissionChecker2 = getService$
|
2945
|
+
const documentManager2 = getService$2("document-manager");
|
2946
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2704
2947
|
if (permissionChecker2.cannot.delete()) {
|
2705
2948
|
return ctx.forbidden();
|
2706
2949
|
}
|
@@ -2728,8 +2971,8 @@ const singleTypes = {
|
|
2728
2971
|
const { userAbility } = ctx.state;
|
2729
2972
|
const { model } = ctx.params;
|
2730
2973
|
const { query = {} } = ctx.request;
|
2731
|
-
const documentManager2 = getService$
|
2732
|
-
const permissionChecker2 = getService$
|
2974
|
+
const documentManager2 = getService$2("document-manager");
|
2975
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2733
2976
|
if (permissionChecker2.cannot.publish()) {
|
2734
2977
|
return ctx.forbidden();
|
2735
2978
|
}
|
@@ -2757,8 +3000,8 @@ const singleTypes = {
|
|
2757
3000
|
body: { discardDraft, ...body },
|
2758
3001
|
query = {}
|
2759
3002
|
} = ctx.request;
|
2760
|
-
const documentManager2 = getService$
|
2761
|
-
const permissionChecker2 = getService$
|
3003
|
+
const documentManager2 = getService$2("document-manager");
|
3004
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2762
3005
|
if (permissionChecker2.cannot.unpublish()) {
|
2763
3006
|
return ctx.forbidden();
|
2764
3007
|
}
|
@@ -2792,8 +3035,8 @@ const singleTypes = {
|
|
2792
3035
|
const { userAbility } = ctx.state;
|
2793
3036
|
const { model } = ctx.params;
|
2794
3037
|
const { body, query = {} } = ctx.request;
|
2795
|
-
const documentManager2 = getService$
|
2796
|
-
const permissionChecker2 = getService$
|
3038
|
+
const documentManager2 = getService$2("document-manager");
|
3039
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2797
3040
|
if (permissionChecker2.cannot.discard()) {
|
2798
3041
|
return ctx.forbidden();
|
2799
3042
|
}
|
@@ -2816,8 +3059,8 @@ const singleTypes = {
|
|
2816
3059
|
const { userAbility } = ctx.state;
|
2817
3060
|
const { model } = ctx.params;
|
2818
3061
|
const { query } = ctx.request;
|
2819
|
-
const documentManager2 = getService$
|
2820
|
-
const permissionChecker2 = getService$
|
3062
|
+
const documentManager2 = getService$2("document-manager");
|
3063
|
+
const permissionChecker2 = getService$2("permission-checker").create({ userAbility, model });
|
2821
3064
|
const { locale } = await getDocumentLocaleAndStatus(query, model);
|
2822
3065
|
if (permissionChecker2.cannot.read()) {
|
2823
3066
|
return ctx.forbidden();
|
@@ -2841,7 +3084,7 @@ const uid$1 = {
|
|
2841
3084
|
const { query = {} } = ctx.request;
|
2842
3085
|
const { locale } = await getDocumentLocaleAndStatus(query, contentTypeUID);
|
2843
3086
|
await validateUIDField(contentTypeUID, field);
|
2844
|
-
const uidService = getService$
|
3087
|
+
const uidService = getService$2("uid");
|
2845
3088
|
ctx.body = {
|
2846
3089
|
data: await uidService.generateUIDField({ contentTypeUID, field, data, locale })
|
2847
3090
|
};
|
@@ -2853,7 +3096,7 @@ const uid$1 = {
|
|
2853
3096
|
const { query = {} } = ctx.request;
|
2854
3097
|
const { locale } = await getDocumentLocaleAndStatus(query, contentTypeUID);
|
2855
3098
|
await validateUIDField(contentTypeUID, field);
|
2856
|
-
const uidService = getService$
|
3099
|
+
const uidService = getService$2("uid");
|
2857
3100
|
const isAvailable = await uidService.checkUIDAvailability({
|
2858
3101
|
contentTypeUID,
|
2859
3102
|
field,
|
@@ -2874,7 +3117,8 @@ const controllers = {
|
|
2874
3117
|
relations,
|
2875
3118
|
"single-types": singleTypes,
|
2876
3119
|
uid: uid$1,
|
2877
|
-
...history.controllers ? history.controllers : {}
|
3120
|
+
...history.controllers ? history.controllers : {},
|
3121
|
+
...preview.controllers ? preview.controllers : {}
|
2878
3122
|
};
|
2879
3123
|
const keys = {
|
2880
3124
|
CONFIGURATION: "configuration"
|
@@ -3003,18 +3247,15 @@ async function syncMetadatas(configuration, schema) {
|
|
3003
3247
|
_.set(updatedMeta, ["list", "searchable"], false);
|
3004
3248
|
_.set(acc, [key], updatedMeta);
|
3005
3249
|
}
|
3006
|
-
if (!_.has(edit, "mainField"))
|
3007
|
-
return acc;
|
3250
|
+
if (!_.has(edit, "mainField")) return acc;
|
3008
3251
|
if (!isRelation$1(attr)) {
|
3009
3252
|
_.set(updatedMeta, "edit", _.omit(edit, ["mainField"]));
|
3010
3253
|
_.set(acc, [key], updatedMeta);
|
3011
3254
|
return acc;
|
3012
3255
|
}
|
3013
|
-
if (edit.mainField === "id")
|
3014
|
-
return acc;
|
3256
|
+
if (edit.mainField === "id") return acc;
|
3015
3257
|
const targetSchema = getTargetSchema(attr.targetModel);
|
3016
|
-
if (!targetSchema)
|
3017
|
-
return acc;
|
3258
|
+
if (!targetSchema) return acc;
|
3018
3259
|
if (!isSortable(targetSchema, edit.mainField) && !isListable(targetSchema, edit.mainField)) {
|
3019
3260
|
_.set(updatedMeta, ["edit", "mainField"], getDefaultMainField(targetSchema));
|
3020
3261
|
_.set(acc, [key], updatedMeta);
|
@@ -3025,12 +3266,12 @@ async function syncMetadatas(configuration, schema) {
|
|
3025
3266
|
return _.assign(metasWithDefaults, updatedMetas);
|
3026
3267
|
}
|
3027
3268
|
const getTargetSchema = (targetModel) => {
|
3028
|
-
return getService$
|
3269
|
+
return getService$2("content-types").findContentType(targetModel);
|
3029
3270
|
};
|
3030
3271
|
const DEFAULT_LIST_LENGTH = 4;
|
3031
3272
|
const MAX_ROW_SIZE = 12;
|
3032
3273
|
const isAllowedFieldSize = (type, size) => {
|
3033
|
-
const { getFieldSize } = getService$
|
3274
|
+
const { getFieldSize } = getService$2("field-sizes");
|
3034
3275
|
const fieldSize = getFieldSize(type);
|
3035
3276
|
if (!fieldSize.isResizable && size !== fieldSize.default) {
|
3036
3277
|
return false;
|
@@ -3038,7 +3279,7 @@ const isAllowedFieldSize = (type, size) => {
|
|
3038
3279
|
return size <= MAX_ROW_SIZE;
|
3039
3280
|
};
|
3040
3281
|
const getDefaultFieldSize = (attribute) => {
|
3041
|
-
const { hasFieldSize, getFieldSize } = getService$
|
3282
|
+
const { hasFieldSize, getFieldSize } = getService$2("field-sizes");
|
3042
3283
|
return getFieldSize(hasFieldSize(attribute.customField) ? attribute.customField : attribute.type).default;
|
3043
3284
|
};
|
3044
3285
|
async function createDefaultLayouts(schema) {
|
@@ -3059,8 +3300,7 @@ function createDefaultEditLayout(schema) {
|
|
3059
3300
|
return appendToEditLayout([], keys2, schema);
|
3060
3301
|
}
|
3061
3302
|
function syncLayouts(configuration, schema) {
|
3062
|
-
if (_.isEmpty(configuration.layouts))
|
3063
|
-
return createDefaultLayouts(schema);
|
3303
|
+
if (_.isEmpty(configuration.layouts)) return createDefaultLayouts(schema);
|
3064
3304
|
const { list = [], editRelations = [], edit = [] } = configuration.layouts || {};
|
3065
3305
|
let cleanList = list.filter((attr) => isListable(schema, attr));
|
3066
3306
|
const cleanEditRelations = editRelations.filter(
|
@@ -3071,9 +3311,8 @@ function syncLayouts(configuration, schema) {
|
|
3071
3311
|
for (const row of edit) {
|
3072
3312
|
const newRow = [];
|
3073
3313
|
for (const el of row) {
|
3074
|
-
if (!hasEditableAttribute(schema, el.name))
|
3075
|
-
|
3076
|
-
const { hasFieldSize } = getService$1("field-sizes");
|
3314
|
+
if (!hasEditableAttribute(schema, el.name)) continue;
|
3315
|
+
const { hasFieldSize } = getService$2("field-sizes");
|
3077
3316
|
const fieldType = hasFieldSize(schema.attributes[el.name].customField) ? schema.attributes[el.name].customField : schema.attributes[el.name].type;
|
3078
3317
|
if (!isAllowedFieldSize(fieldType, el.size)) {
|
3079
3318
|
elementsToReAppend.push(el.name);
|
@@ -3103,8 +3342,7 @@ function syncLayouts(configuration, schema) {
|
|
3103
3342
|
};
|
3104
3343
|
}
|
3105
3344
|
const appendToEditLayout = (layout = [], keysToAppend, schema) => {
|
3106
|
-
if (keysToAppend.length === 0)
|
3107
|
-
return layout;
|
3345
|
+
if (keysToAppend.length === 0) return layout;
|
3108
3346
|
let currentRowIndex = Math.max(layout.length - 1, 0);
|
3109
3347
|
if (!layout[currentRowIndex]) {
|
3110
3348
|
layout[currentRowIndex] = [];
|
@@ -3213,17 +3451,17 @@ const configurationService$1 = createConfigurationService({
|
|
3213
3451
|
isComponent: true,
|
3214
3452
|
prefix: STORE_KEY_PREFIX,
|
3215
3453
|
getModels() {
|
3216
|
-
const { toContentManagerModel } = getService$
|
3454
|
+
const { toContentManagerModel } = getService$2("data-mapper");
|
3217
3455
|
return mapValues(toContentManagerModel, strapi.components);
|
3218
3456
|
}
|
3219
3457
|
});
|
3220
3458
|
const components = ({ strapi: strapi2 }) => ({
|
3221
3459
|
findAllComponents() {
|
3222
|
-
const { toContentManagerModel } = getService$
|
3460
|
+
const { toContentManagerModel } = getService$2("data-mapper");
|
3223
3461
|
return Object.values(strapi2.components).map(toContentManagerModel);
|
3224
3462
|
},
|
3225
3463
|
findComponent(uid2) {
|
3226
|
-
const { toContentManagerModel } = getService$
|
3464
|
+
const { toContentManagerModel } = getService$2("data-mapper");
|
3227
3465
|
const component = strapi2.components[uid2];
|
3228
3466
|
return isNil$1(component) ? component : toContentManagerModel(component);
|
3229
3467
|
},
|
@@ -3274,17 +3512,17 @@ const configurationService = createConfigurationService({
|
|
3274
3512
|
storeUtils,
|
3275
3513
|
prefix: "content_types",
|
3276
3514
|
getModels() {
|
3277
|
-
const { toContentManagerModel } = getService$
|
3515
|
+
const { toContentManagerModel } = getService$2("data-mapper");
|
3278
3516
|
return mapValues(toContentManagerModel, strapi.contentTypes);
|
3279
3517
|
}
|
3280
3518
|
});
|
3281
3519
|
const service = ({ strapi: strapi2 }) => ({
|
3282
3520
|
findAllContentTypes() {
|
3283
|
-
const { toContentManagerModel } = getService$
|
3521
|
+
const { toContentManagerModel } = getService$2("data-mapper");
|
3284
3522
|
return Object.values(strapi2.contentTypes).map(toContentManagerModel);
|
3285
3523
|
},
|
3286
3524
|
findContentType(uid2) {
|
3287
|
-
const { toContentManagerModel } = getService$
|
3525
|
+
const { toContentManagerModel } = getService$2("data-mapper");
|
3288
3526
|
const contentType = strapi2.contentTypes[uid2];
|
3289
3527
|
return isNil$1(contentType) ? contentType : toContentManagerModel(contentType);
|
3290
3528
|
},
|
@@ -3313,7 +3551,7 @@ const service = ({ strapi: strapi2 }) => ({
|
|
3313
3551
|
return this.findConfiguration(contentType);
|
3314
3552
|
},
|
3315
3553
|
findComponentsConfigurations(contentType) {
|
3316
|
-
return getService$
|
3554
|
+
return getService$2("components").findComponentsConfigurations(contentType);
|
3317
3555
|
},
|
3318
3556
|
syncConfigurations() {
|
3319
3557
|
return configurationService.syncConfigurations();
|
@@ -3585,7 +3823,7 @@ const permission = ({ strapi: strapi2 }) => ({
|
|
3585
3823
|
return userAbility.can(action);
|
3586
3824
|
},
|
3587
3825
|
async registerPermissions() {
|
3588
|
-
const displayedContentTypes = getService$
|
3826
|
+
const displayedContentTypes = getService$2("content-types").findDisplayedContentTypes();
|
3589
3827
|
const contentTypesUids = displayedContentTypes.map(prop("uid"));
|
3590
3828
|
const actions = [
|
3591
3829
|
{
|
@@ -3861,7 +4099,7 @@ const getQueryPopulate = async (uid2, query) => {
|
|
3861
4099
|
return populateQuery;
|
3862
4100
|
};
|
3863
4101
|
const buildDeepPopulate = (uid2) => {
|
3864
|
-
return getService$
|
4102
|
+
return getService$2("populate-builder")(uid2).populateDeep(Infinity).countRelations().build();
|
3865
4103
|
};
|
3866
4104
|
const populateBuilder = (uid2) => {
|
3867
4105
|
let getInitialPopulate = async () => {
|
@@ -4046,7 +4284,9 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4046
4284
|
*/
|
4047
4285
|
async getAvailableLocales(uid2, version, allVersions, validatableFields = []) {
|
4048
4286
|
const versionsByLocale = groupBy("locale", allVersions);
|
4049
|
-
|
4287
|
+
if (version.locale) {
|
4288
|
+
delete versionsByLocale[version.locale];
|
4289
|
+
}
|
4050
4290
|
const model = strapi2.getModel(uid2);
|
4051
4291
|
const keysToKeep = [...AVAILABLE_LOCALES_FIELDS, ...validatableFields];
|
4052
4292
|
const traversalFunction = async (localeVersion) => traverseEntity(
|
@@ -4093,8 +4333,7 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4093
4333
|
const matchStatus = status === "published" ? v.publishedAt !== null : v.publishedAt === null;
|
4094
4334
|
return matchLocale && matchStatus;
|
4095
4335
|
});
|
4096
|
-
if (!availableStatus)
|
4097
|
-
return availableStatus;
|
4336
|
+
if (!availableStatus) return availableStatus;
|
4098
4337
|
return pick(AVAILABLE_STATUS_FIELDS, availableStatus);
|
4099
4338
|
},
|
4100
4339
|
/**
|
@@ -4104,8 +4343,7 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4104
4343
|
* @returns
|
4105
4344
|
*/
|
4106
4345
|
async getManyAvailableStatus(uid2, documents) {
|
4107
|
-
if (!documents.length)
|
4108
|
-
return [];
|
4346
|
+
if (!documents.length) return [];
|
4109
4347
|
const status = documents[0].publishedAt !== null ? "published" : "draft";
|
4110
4348
|
const locale = documents[0]?.locale;
|
4111
4349
|
const otherStatus = status === "published" ? "draft" : "published";
|
@@ -4132,10 +4370,8 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4132
4370
|
} else if (otherVersion) {
|
4133
4371
|
draftVersion = otherVersion;
|
4134
4372
|
}
|
4135
|
-
if (!draftVersion)
|
4136
|
-
|
4137
|
-
if (!publishedVersion)
|
4138
|
-
return CONTENT_MANAGER_STATUS.DRAFT;
|
4373
|
+
if (!draftVersion) return CONTENT_MANAGER_STATUS.PUBLISHED;
|
4374
|
+
if (!publishedVersion) return CONTENT_MANAGER_STATUS.DRAFT;
|
4139
4375
|
const isDraftModified = getIsVersionLatestModification(draftVersion, publishedVersion);
|
4140
4376
|
return isDraftModified ? CONTENT_MANAGER_STATUS.MODIFIED : CONTENT_MANAGER_STATUS.PUBLISHED;
|
4141
4377
|
},
|
@@ -4402,7 +4638,8 @@ const services = {
|
|
4402
4638
|
permission,
|
4403
4639
|
"populate-builder": populateBuilder$1,
|
4404
4640
|
uid,
|
4405
|
-
...history.services ? history.services : {}
|
4641
|
+
...history.services ? history.services : {},
|
4642
|
+
...preview.services ? preview.services : {}
|
4406
4643
|
};
|
4407
4644
|
const index = () => {
|
4408
4645
|
return {
|