@strapi/content-manager 0.0.0-experimental.16eaafeff6bd4cd49d56f3c31d002cad71a1134a → 0.0.0-experimental.1bca8e0e074de8b0775bcddc7656fbc9e9f1393b
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/LICENSE +18 -3
- package/dist/_chunks/{ComponentConfigurationPage-Tqd-Ji_E.js → ComponentConfigurationPage-5ukroXAh.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-Tqd-Ji_E.js.map → ComponentConfigurationPage-5ukroXAh.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-B5mDY7I0.mjs → ComponentConfigurationPage-BAgyHiMm.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-B5mDY7I0.mjs.map → ComponentConfigurationPage-BAgyHiMm.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-B8UqkdtD.mjs → EditConfigurationPage-DmoXawIh.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-B8UqkdtD.mjs.map → EditConfigurationPage-DmoXawIh.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-C28IfcPs.js → EditConfigurationPage-Xp7lun0f.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-C28IfcPs.js.map → EditConfigurationPage-Xp7lun0f.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-DQUCbpW-.mjs → EditViewPage-BLsjc5F-.mjs} +3 -3
- package/dist/_chunks/{EditViewPage-DQUCbpW-.mjs.map → EditViewPage-BLsjc5F-.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-BDL9cM0Q.js → EditViewPage-C-ukDOB7.js} +3 -3
- package/dist/_chunks/{EditViewPage-BDL9cM0Q.js.map → EditViewPage-C-ukDOB7.js.map} +1 -1
- package/dist/_chunks/{Field-D8I8rXr9.js → Field-Bfph5SOd.js} +79 -54
- package/dist/_chunks/Field-Bfph5SOd.js.map +1 -0
- package/dist/_chunks/{Field-DSGnyyoh.mjs → Field-Cs7duwWd.mjs} +79 -54
- package/dist/_chunks/Field-Cs7duwWd.mjs.map +1 -0
- package/dist/_chunks/{Form-DVvv6Hst.js → Form-CPYqIWDG.js} +2 -2
- package/dist/_chunks/{Form-DVvv6Hst.js.map → Form-CPYqIWDG.js.map} +1 -1
- package/dist/_chunks/{Form-DZGlZ79l.mjs → Form-Dg_GS5TQ.mjs} +2 -2
- package/dist/_chunks/{Form-DZGlZ79l.mjs.map → Form-Dg_GS5TQ.mjs.map} +1 -1
- package/dist/_chunks/{History-CQl54kNG.js → History-DNQkXANT.js} +44 -19
- package/dist/_chunks/History-DNQkXANT.js.map +1 -0
- package/dist/_chunks/{History-DOWk7MB4.mjs → History-wrnHqf09.mjs} +44 -19
- package/dist/_chunks/History-wrnHqf09.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-G_22rTAp.js → ListConfigurationPage-CUQxfpjT.js} +8 -6
- package/dist/_chunks/ListConfigurationPage-CUQxfpjT.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-lN3NMkhK.mjs → ListConfigurationPage-DScmJVkW.mjs} +8 -6
- package/dist/_chunks/ListConfigurationPage-DScmJVkW.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-BIEXJtcz.js → ListViewPage-BsLiH2-2.js} +15 -6
- package/dist/_chunks/ListViewPage-BsLiH2-2.js.map +1 -0
- package/dist/_chunks/{ListViewPage-D_MY3zjg.mjs → ListViewPage-C4IvrMgY.mjs} +15 -6
- package/dist/_chunks/ListViewPage-C4IvrMgY.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-P-gvTfgg.js → NoContentTypePage-BZ-PnGAf.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-P-gvTfgg.js.map → NoContentTypePage-BZ-PnGAf.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-CUrrV_mP.mjs → NoContentTypePage-Djg8nPlj.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-CUrrV_mP.mjs.map → NoContentTypePage-Djg8nPlj.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-B-DP9Ht4.mjs → NoPermissionsPage-DSP7R-hv.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-B-DP9Ht4.mjs.map → NoPermissionsPage-DSP7R-hv.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CIFc7iTR.js → NoPermissionsPage-_lUqjGW3.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CIFc7iTR.js.map → NoPermissionsPage-_lUqjGW3.js.map} +1 -1
- package/dist/_chunks/{Relations-CSzJbIBP.mjs → Relations-BZr8tL0R.mjs} +3 -3
- package/dist/_chunks/Relations-BZr8tL0R.mjs.map +1 -0
- package/dist/_chunks/{Relations-BqSXkgPb.js → Relations-CtELXYIK.js} +3 -3
- package/dist/_chunks/Relations-CtELXYIK.js.map +1 -0
- package/dist/_chunks/{en-Ux26r5pl.mjs → en-BrCTWlZv.mjs} +5 -4
- package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-BrCTWlZv.mjs.map} +1 -1
- package/dist/_chunks/{en-fbKQxLGn.js → en-uOUIxfcQ.js} +5 -4
- package/dist/_chunks/{en-fbKQxLGn.js.map → en-uOUIxfcQ.js.map} +1 -1
- package/dist/_chunks/{index-iXGIUU_l.js → index-OerGjbAN.js} +259 -119
- package/dist/_chunks/index-OerGjbAN.js.map +1 -0
- package/dist/_chunks/{index-BYpa_5O9.mjs → index-c_5DdJi-.mjs} +261 -121
- package/dist/_chunks/index-c_5DdJi-.mjs.map +1 -0
- package/dist/_chunks/{layout-BLa_DTtQ.js → layout-Ci7qHlFb.js} +6 -6
- package/dist/_chunks/layout-Ci7qHlFb.js.map +1 -0
- package/dist/_chunks/{layout-DT9g7_U1.mjs → layout-oPBiO7RY.mjs} +6 -6
- package/dist/_chunks/layout-oPBiO7RY.mjs.map +1 -0
- package/dist/_chunks/{relations-CHM_mYAI.mjs → relations-BIdWFjdq.mjs} +2 -2
- package/dist/_chunks/{relations-CHM_mYAI.mjs.map → relations-BIdWFjdq.mjs.map} +1 -1
- package/dist/_chunks/{relations--l5ixWIN.js → relations-COBpStiF.js} +2 -2
- package/dist/_chunks/{relations--l5ixWIN.js.map → relations-COBpStiF.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/history/index.d.ts +3 -0
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +1 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
- package/dist/server/index.js +37 -28
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +37 -28
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/uid.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/dimensions.d.ts +4 -2
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/_chunks/Field-D8I8rXr9.js.map +0 -1
- package/dist/_chunks/Field-DSGnyyoh.mjs.map +0 -1
- package/dist/_chunks/History-CQl54kNG.js.map +0 -1
- package/dist/_chunks/History-DOWk7MB4.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-G_22rTAp.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-lN3NMkhK.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BIEXJtcz.js.map +0 -1
- package/dist/_chunks/ListViewPage-D_MY3zjg.mjs.map +0 -1
- package/dist/_chunks/Relations-BqSXkgPb.js.map +0 -1
- package/dist/_chunks/Relations-CSzJbIBP.mjs.map +0 -1
- package/dist/_chunks/index-BYpa_5O9.mjs.map +0 -1
- package/dist/_chunks/index-iXGIUU_l.js.map +0 -1
- package/dist/_chunks/layout-BLa_DTtQ.js.map +0 -1
- package/dist/_chunks/layout-DT9g7_U1.mjs.map +0 -1
package/dist/server/index.js
CHANGED
@@ -232,6 +232,10 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
232
232
|
return attributes.reduce((acc, [attributeName, attribute]) => {
|
233
233
|
switch (attribute.type) {
|
234
234
|
case "relation": {
|
235
|
+
const isMorphRelation = attribute.relation.toLowerCase().startsWith("morph");
|
236
|
+
if (isMorphRelation) {
|
237
|
+
break;
|
238
|
+
}
|
235
239
|
const isVisible2 = strapiUtils.contentTypes.isVisibleAttribute(model, attributeName);
|
236
240
|
if (isVisible2) {
|
237
241
|
acc[attributeName] = { fields: ["documentId", "locale", "publishedAt"] };
|
@@ -1591,9 +1595,11 @@ const multipleLocaleSchema = strapiUtils.yup.lazy(
|
|
1591
1595
|
(value) => Array.isArray(value) ? strapiUtils.yup.array().of(singleLocaleSchema.required()) : singleLocaleSchema
|
1592
1596
|
);
|
1593
1597
|
const statusSchema = strapiUtils.yup.mixed().oneOf(["draft", "published"], "Invalid status");
|
1594
|
-
const getDocumentLocaleAndStatus = async (request, opts = { allowMultipleLocales: false }) => {
|
1598
|
+
const getDocumentLocaleAndStatus = async (request, model, opts = { allowMultipleLocales: false }) => {
|
1595
1599
|
const { allowMultipleLocales } = opts;
|
1596
|
-
const { locale, status, ...rest } = request || {};
|
1600
|
+
const { locale, status: providedStatus, ...rest } = request || {};
|
1601
|
+
const defaultStatus = strapiUtils.contentTypes.hasDraftAndPublish(strapi.getModel(model)) ? void 0 : "published";
|
1602
|
+
const status = providedStatus !== void 0 ? providedStatus : defaultStatus;
|
1597
1603
|
const schema = strapiUtils.yup.object().shape({
|
1598
1604
|
locale: allowMultipleLocales ? multipleLocaleSchema : singleLocaleSchema,
|
1599
1605
|
status: statusSchema
|
@@ -1641,7 +1647,7 @@ const createDocument = async (ctx, opts) => {
|
|
1641
1647
|
const setCreator = strapiUtils.setCreatorFields({ user });
|
1642
1648
|
const sanitizeFn = strapiUtils.async.pipe(pickPermittedFields, setCreator);
|
1643
1649
|
const sanitizedBody = await sanitizeFn(body);
|
1644
|
-
const { locale, status
|
1650
|
+
const { locale, status } = await getDocumentLocaleAndStatus(body, model);
|
1645
1651
|
return documentManager2.create(model, {
|
1646
1652
|
data: sanitizedBody,
|
1647
1653
|
locale,
|
@@ -1660,7 +1666,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1660
1666
|
}
|
1661
1667
|
const permissionQuery = await permissionChecker2.sanitizedQuery.update(ctx.query);
|
1662
1668
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1663
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1669
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1664
1670
|
const [documentVersion, documentExists] = await Promise.all([
|
1665
1671
|
documentManager2.findOne(id, model, { populate, locale, status: "draft" }),
|
1666
1672
|
documentManager2.exists(model, id)
|
@@ -1698,7 +1704,7 @@ const collectionTypes = {
|
|
1698
1704
|
}
|
1699
1705
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(query);
|
1700
1706
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(1).countRelations({ toOne: false, toMany: true }).build();
|
1701
|
-
const { locale, status } = await getDocumentLocaleAndStatus(query);
|
1707
|
+
const { locale, status } = await getDocumentLocaleAndStatus(query, model);
|
1702
1708
|
const { results: documents, pagination } = await documentManager2.findPage(
|
1703
1709
|
{ ...permissionQuery, populate, locale, status },
|
1704
1710
|
model
|
@@ -1733,7 +1739,7 @@ const collectionTypes = {
|
|
1733
1739
|
}
|
1734
1740
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
1735
1741
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1736
|
-
const { locale, status
|
1742
|
+
const { locale, status } = await getDocumentLocaleAndStatus(ctx.query, model);
|
1737
1743
|
const version = await documentManager2.findOne(id, model, {
|
1738
1744
|
populate,
|
1739
1745
|
locale,
|
@@ -1800,7 +1806,7 @@ const collectionTypes = {
|
|
1800
1806
|
}
|
1801
1807
|
const permissionQuery = await permissionChecker2.sanitizedQuery.create(ctx.query);
|
1802
1808
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1803
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1809
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1804
1810
|
const document = await documentManager2.findOne(id, model, {
|
1805
1811
|
populate,
|
1806
1812
|
locale,
|
@@ -1845,7 +1851,7 @@ const collectionTypes = {
|
|
1845
1851
|
}
|
1846
1852
|
const permissionQuery = await permissionChecker2.sanitizedQuery.delete(ctx.query);
|
1847
1853
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1848
|
-
const { locale } = await getDocumentLocaleAndStatus(ctx.query);
|
1854
|
+
const { locale } = await getDocumentLocaleAndStatus(ctx.query, model);
|
1849
1855
|
const documentLocales = await documentManager2.findLocales(id, model, { populate, locale });
|
1850
1856
|
if (documentLocales.length === 0) {
|
1851
1857
|
return ctx.notFound();
|
@@ -1878,7 +1884,7 @@ const collectionTypes = {
|
|
1878
1884
|
if (permissionChecker2.cannot.publish(document)) {
|
1879
1885
|
throw new strapiUtils.errors.ForbiddenError();
|
1880
1886
|
}
|
1881
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1887
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1882
1888
|
const publishResult = await documentManager2.publish(document.documentId, model, {
|
1883
1889
|
locale
|
1884
1890
|
// TODO: Allow setting creator fields on publish
|
@@ -1905,7 +1911,9 @@ const collectionTypes = {
|
|
1905
1911
|
}
|
1906
1912
|
const permissionQuery = await permissionChecker2.sanitizedQuery.publish(ctx.query);
|
1907
1913
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1908
|
-
const { locale } = await getDocumentLocaleAndStatus(body, {
|
1914
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
1915
|
+
allowMultipleLocales: true
|
1916
|
+
});
|
1909
1917
|
const entityPromises = documentIds.map(
|
1910
1918
|
(documentId) => documentManager2.findLocales(documentId, model, { populate, locale, isPublished: false })
|
1911
1919
|
);
|
@@ -1932,7 +1940,7 @@ const collectionTypes = {
|
|
1932
1940
|
if (permissionChecker2.cannot.unpublish()) {
|
1933
1941
|
return ctx.forbidden();
|
1934
1942
|
}
|
1935
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1943
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1936
1944
|
const entityPromises = documentIds.map(
|
1937
1945
|
(documentId) => documentManager2.findLocales(documentId, model, { locale, isPublished: true })
|
1938
1946
|
);
|
@@ -1965,7 +1973,7 @@ const collectionTypes = {
|
|
1965
1973
|
}
|
1966
1974
|
const permissionQuery = await permissionChecker2.sanitizedQuery.unpublish(ctx.query);
|
1967
1975
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1968
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1976
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1969
1977
|
const document = await documentManager2.findOne(id, model, {
|
1970
1978
|
populate,
|
1971
1979
|
locale,
|
@@ -2002,7 +2010,7 @@ const collectionTypes = {
|
|
2002
2010
|
}
|
2003
2011
|
const permissionQuery = await permissionChecker2.sanitizedQuery.discard(ctx.query);
|
2004
2012
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2005
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2013
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2006
2014
|
const document = await documentManager2.findOne(id, model, {
|
2007
2015
|
populate,
|
2008
2016
|
locale,
|
@@ -2033,7 +2041,7 @@ const collectionTypes = {
|
|
2033
2041
|
}
|
2034
2042
|
const permissionQuery = await permissionChecker2.sanitizedQuery.delete(query);
|
2035
2043
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2036
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2044
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2037
2045
|
const documentLocales = await documentManager2.findLocales(documentIds, model, {
|
2038
2046
|
populate,
|
2039
2047
|
locale
|
@@ -2060,7 +2068,7 @@ const collectionTypes = {
|
|
2060
2068
|
}
|
2061
2069
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
2062
2070
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2063
|
-
const { locale, status
|
2071
|
+
const { locale, status } = await getDocumentLocaleAndStatus(ctx.query, model);
|
2064
2072
|
const entity = await documentManager2.findOne(id, model, { populate, locale, status });
|
2065
2073
|
if (!entity) {
|
2066
2074
|
return ctx.notFound();
|
@@ -2588,7 +2596,7 @@ const createOrUpdateDocument = async (ctx, opts) => {
|
|
2588
2596
|
throw new strapiUtils.errors.ForbiddenError();
|
2589
2597
|
}
|
2590
2598
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.update(query);
|
2591
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2599
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2592
2600
|
const [documentVersion, otherDocumentVersion] = await Promise.all([
|
2593
2601
|
findDocument(sanitizedQuery, model, { locale, status: "draft" }),
|
2594
2602
|
// Find the first document to check if it exists
|
@@ -2629,7 +2637,7 @@ const singleTypes = {
|
|
2629
2637
|
return ctx.forbidden();
|
2630
2638
|
}
|
2631
2639
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(query);
|
2632
|
-
const { locale, status } = await getDocumentLocaleAndStatus(query);
|
2640
|
+
const { locale, status } = await getDocumentLocaleAndStatus(query, model);
|
2633
2641
|
const version = await findDocument(permissionQuery, model, { locale, status });
|
2634
2642
|
if (!version) {
|
2635
2643
|
if (permissionChecker2.cannot.create()) {
|
@@ -2674,7 +2682,7 @@ const singleTypes = {
|
|
2674
2682
|
}
|
2675
2683
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.delete(query);
|
2676
2684
|
const populate = await buildPopulateFromQuery(sanitizedQuery, model);
|
2677
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2685
|
+
const { locale } = await getDocumentLocaleAndStatus(query, model);
|
2678
2686
|
const documentLocales = await documentManager2.findLocales(void 0, model, {
|
2679
2687
|
populate,
|
2680
2688
|
locale
|
@@ -2711,7 +2719,7 @@ const singleTypes = {
|
|
2711
2719
|
if (permissionChecker2.cannot.publish(document)) {
|
2712
2720
|
throw new strapiUtils.errors.ForbiddenError();
|
2713
2721
|
}
|
2714
|
-
const { locale } = await getDocumentLocaleAndStatus(document);
|
2722
|
+
const { locale } = await getDocumentLocaleAndStatus(document, model);
|
2715
2723
|
const publishResult = await documentManager2.publish(document.documentId, model, { locale });
|
2716
2724
|
return publishResult.at(0);
|
2717
2725
|
});
|
@@ -2734,7 +2742,7 @@ const singleTypes = {
|
|
2734
2742
|
return ctx.forbidden();
|
2735
2743
|
}
|
2736
2744
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.unpublish(query);
|
2737
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2745
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2738
2746
|
const document = await findDocument(sanitizedQuery, model, { locale });
|
2739
2747
|
if (!document) {
|
2740
2748
|
return ctx.notFound();
|
@@ -2766,7 +2774,7 @@ const singleTypes = {
|
|
2766
2774
|
return ctx.forbidden();
|
2767
2775
|
}
|
2768
2776
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.discard(query);
|
2769
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2777
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2770
2778
|
const document = await findDocument(sanitizedQuery, model, { locale, status: "published" });
|
2771
2779
|
if (!document) {
|
2772
2780
|
return ctx.notFound();
|
@@ -2786,7 +2794,7 @@ const singleTypes = {
|
|
2786
2794
|
const { query } = ctx.request;
|
2787
2795
|
const documentManager2 = getService$1("document-manager");
|
2788
2796
|
const permissionChecker2 = getService$1("permission-checker").create({ userAbility, model });
|
2789
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2797
|
+
const { locale } = await getDocumentLocaleAndStatus(query, model);
|
2790
2798
|
if (permissionChecker2.cannot.read()) {
|
2791
2799
|
return ctx.forbidden();
|
2792
2800
|
}
|
@@ -2807,7 +2815,7 @@ const uid$1 = {
|
|
2807
2815
|
async generateUID(ctx) {
|
2808
2816
|
const { contentTypeUID, field, data } = await validateGenerateUIDInput(ctx.request.body);
|
2809
2817
|
const { query = {} } = ctx.request;
|
2810
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2818
|
+
const { locale } = await getDocumentLocaleAndStatus(query, contentTypeUID);
|
2811
2819
|
await validateUIDField(contentTypeUID, field);
|
2812
2820
|
const uidService = getService$1("uid");
|
2813
2821
|
ctx.body = {
|
@@ -2819,7 +2827,7 @@ const uid$1 = {
|
|
2819
2827
|
ctx.request.body
|
2820
2828
|
);
|
2821
2829
|
const { query = {} } = ctx.request;
|
2822
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2830
|
+
const { locale } = await getDocumentLocaleAndStatus(query, contentTypeUID);
|
2823
2831
|
await validateUIDField(contentTypeUID, field);
|
2824
2832
|
const uidService = getService$1("uid");
|
2825
2833
|
const isAvailable = await uidService.checkUIDAvailability({
|
@@ -3744,6 +3752,10 @@ const getDeepPopulateDraftCount = (uid2) => {
|
|
3744
3752
|
const attribute = model.attributes[attributeName];
|
3745
3753
|
switch (attribute.type) {
|
3746
3754
|
case "relation": {
|
3755
|
+
const isMorphRelation = attribute.relation.toLowerCase().startsWith("morph");
|
3756
|
+
if (isMorphRelation) {
|
3757
|
+
break;
|
3758
|
+
}
|
3747
3759
|
if (isVisibleAttribute$1(model, attributeName)) {
|
3748
3760
|
populateAcc[attributeName] = {
|
3749
3761
|
count: true,
|
@@ -4229,10 +4241,7 @@ const documentManager = ({ strapi: strapi2 }) => {
|
|
4229
4241
|
async clone(id, body, uid2) {
|
4230
4242
|
const populate = await buildDeepPopulate(uid2);
|
4231
4243
|
const params = {
|
4232
|
-
data:
|
4233
|
-
...omitIdField(body),
|
4234
|
-
[PUBLISHED_AT_ATTRIBUTE]: null
|
4235
|
-
},
|
4244
|
+
data: omitIdField(body),
|
4236
4245
|
populate
|
4237
4246
|
};
|
4238
4247
|
return strapi2.documents(uid2).clone({ ...params, documentId: id }).then((result) => result?.entries.at(0));
|