@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.mjs
CHANGED
@@ -206,6 +206,10 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
206
206
|
return attributes.reduce((acc, [attributeName, attribute]) => {
|
207
207
|
switch (attribute.type) {
|
208
208
|
case "relation": {
|
209
|
+
const isMorphRelation = attribute.relation.toLowerCase().startsWith("morph");
|
210
|
+
if (isMorphRelation) {
|
211
|
+
break;
|
212
|
+
}
|
209
213
|
const isVisible2 = contentTypes$1.isVisibleAttribute(model, attributeName);
|
210
214
|
if (isVisible2) {
|
211
215
|
acc[attributeName] = { fields: ["documentId", "locale", "publishedAt"] };
|
@@ -1565,9 +1569,11 @@ const multipleLocaleSchema = yup$1.lazy(
|
|
1565
1569
|
(value) => Array.isArray(value) ? yup$1.array().of(singleLocaleSchema.required()) : singleLocaleSchema
|
1566
1570
|
);
|
1567
1571
|
const statusSchema = yup$1.mixed().oneOf(["draft", "published"], "Invalid status");
|
1568
|
-
const getDocumentLocaleAndStatus = async (request, opts = { allowMultipleLocales: false }) => {
|
1572
|
+
const getDocumentLocaleAndStatus = async (request, model, opts = { allowMultipleLocales: false }) => {
|
1569
1573
|
const { allowMultipleLocales } = opts;
|
1570
|
-
const { locale, status, ...rest } = request || {};
|
1574
|
+
const { locale, status: providedStatus, ...rest } = request || {};
|
1575
|
+
const defaultStatus = contentTypes$1.hasDraftAndPublish(strapi.getModel(model)) ? void 0 : "published";
|
1576
|
+
const status = providedStatus !== void 0 ? providedStatus : defaultStatus;
|
1571
1577
|
const schema = yup$1.object().shape({
|
1572
1578
|
locale: allowMultipleLocales ? multipleLocaleSchema : singleLocaleSchema,
|
1573
1579
|
status: statusSchema
|
@@ -1615,7 +1621,7 @@ const createDocument = async (ctx, opts) => {
|
|
1615
1621
|
const setCreator = setCreatorFields({ user });
|
1616
1622
|
const sanitizeFn = async.pipe(pickPermittedFields, setCreator);
|
1617
1623
|
const sanitizedBody = await sanitizeFn(body);
|
1618
|
-
const { locale, status
|
1624
|
+
const { locale, status } = await getDocumentLocaleAndStatus(body, model);
|
1619
1625
|
return documentManager2.create(model, {
|
1620
1626
|
data: sanitizedBody,
|
1621
1627
|
locale,
|
@@ -1634,7 +1640,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1634
1640
|
}
|
1635
1641
|
const permissionQuery = await permissionChecker2.sanitizedQuery.update(ctx.query);
|
1636
1642
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1637
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1643
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1638
1644
|
const [documentVersion, documentExists] = await Promise.all([
|
1639
1645
|
documentManager2.findOne(id, model, { populate, locale, status: "draft" }),
|
1640
1646
|
documentManager2.exists(model, id)
|
@@ -1672,7 +1678,7 @@ const collectionTypes = {
|
|
1672
1678
|
}
|
1673
1679
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(query);
|
1674
1680
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(1).countRelations({ toOne: false, toMany: true }).build();
|
1675
|
-
const { locale, status } = await getDocumentLocaleAndStatus(query);
|
1681
|
+
const { locale, status } = await getDocumentLocaleAndStatus(query, model);
|
1676
1682
|
const { results: documents, pagination: pagination2 } = await documentManager2.findPage(
|
1677
1683
|
{ ...permissionQuery, populate, locale, status },
|
1678
1684
|
model
|
@@ -1707,7 +1713,7 @@ const collectionTypes = {
|
|
1707
1713
|
}
|
1708
1714
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
1709
1715
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1710
|
-
const { locale, status
|
1716
|
+
const { locale, status } = await getDocumentLocaleAndStatus(ctx.query, model);
|
1711
1717
|
const version = await documentManager2.findOne(id, model, {
|
1712
1718
|
populate,
|
1713
1719
|
locale,
|
@@ -1774,7 +1780,7 @@ const collectionTypes = {
|
|
1774
1780
|
}
|
1775
1781
|
const permissionQuery = await permissionChecker2.sanitizedQuery.create(ctx.query);
|
1776
1782
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1777
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1783
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1778
1784
|
const document = await documentManager2.findOne(id, model, {
|
1779
1785
|
populate,
|
1780
1786
|
locale,
|
@@ -1819,7 +1825,7 @@ const collectionTypes = {
|
|
1819
1825
|
}
|
1820
1826
|
const permissionQuery = await permissionChecker2.sanitizedQuery.delete(ctx.query);
|
1821
1827
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1822
|
-
const { locale } = await getDocumentLocaleAndStatus(ctx.query);
|
1828
|
+
const { locale } = await getDocumentLocaleAndStatus(ctx.query, model);
|
1823
1829
|
const documentLocales = await documentManager2.findLocales(id, model, { populate, locale });
|
1824
1830
|
if (documentLocales.length === 0) {
|
1825
1831
|
return ctx.notFound();
|
@@ -1852,7 +1858,7 @@ const collectionTypes = {
|
|
1852
1858
|
if (permissionChecker2.cannot.publish(document)) {
|
1853
1859
|
throw new errors.ForbiddenError();
|
1854
1860
|
}
|
1855
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1861
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1856
1862
|
const publishResult = await documentManager2.publish(document.documentId, model, {
|
1857
1863
|
locale
|
1858
1864
|
// TODO: Allow setting creator fields on publish
|
@@ -1879,7 +1885,9 @@ const collectionTypes = {
|
|
1879
1885
|
}
|
1880
1886
|
const permissionQuery = await permissionChecker2.sanitizedQuery.publish(ctx.query);
|
1881
1887
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1882
|
-
const { locale } = await getDocumentLocaleAndStatus(body, {
|
1888
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
1889
|
+
allowMultipleLocales: true
|
1890
|
+
});
|
1883
1891
|
const entityPromises = documentIds.map(
|
1884
1892
|
(documentId) => documentManager2.findLocales(documentId, model, { populate, locale, isPublished: false })
|
1885
1893
|
);
|
@@ -1906,7 +1914,7 @@ const collectionTypes = {
|
|
1906
1914
|
if (permissionChecker2.cannot.unpublish()) {
|
1907
1915
|
return ctx.forbidden();
|
1908
1916
|
}
|
1909
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1917
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1910
1918
|
const entityPromises = documentIds.map(
|
1911
1919
|
(documentId) => documentManager2.findLocales(documentId, model, { locale, isPublished: true })
|
1912
1920
|
);
|
@@ -1939,7 +1947,7 @@ const collectionTypes = {
|
|
1939
1947
|
}
|
1940
1948
|
const permissionQuery = await permissionChecker2.sanitizedQuery.unpublish(ctx.query);
|
1941
1949
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1942
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1950
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1943
1951
|
const document = await documentManager2.findOne(id, model, {
|
1944
1952
|
populate,
|
1945
1953
|
locale,
|
@@ -1976,7 +1984,7 @@ const collectionTypes = {
|
|
1976
1984
|
}
|
1977
1985
|
const permissionQuery = await permissionChecker2.sanitizedQuery.discard(ctx.query);
|
1978
1986
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1979
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1987
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1980
1988
|
const document = await documentManager2.findOne(id, model, {
|
1981
1989
|
populate,
|
1982
1990
|
locale,
|
@@ -2007,7 +2015,7 @@ const collectionTypes = {
|
|
2007
2015
|
}
|
2008
2016
|
const permissionQuery = await permissionChecker2.sanitizedQuery.delete(query);
|
2009
2017
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2010
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2018
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2011
2019
|
const documentLocales = await documentManager2.findLocales(documentIds, model, {
|
2012
2020
|
populate,
|
2013
2021
|
locale
|
@@ -2034,7 +2042,7 @@ const collectionTypes = {
|
|
2034
2042
|
}
|
2035
2043
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
2036
2044
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2037
|
-
const { locale, status
|
2045
|
+
const { locale, status } = await getDocumentLocaleAndStatus(ctx.query, model);
|
2038
2046
|
const entity = await documentManager2.findOne(id, model, { populate, locale, status });
|
2039
2047
|
if (!entity) {
|
2040
2048
|
return ctx.notFound();
|
@@ -2562,7 +2570,7 @@ const createOrUpdateDocument = async (ctx, opts) => {
|
|
2562
2570
|
throw new errors.ForbiddenError();
|
2563
2571
|
}
|
2564
2572
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.update(query);
|
2565
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2573
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2566
2574
|
const [documentVersion, otherDocumentVersion] = await Promise.all([
|
2567
2575
|
findDocument(sanitizedQuery, model, { locale, status: "draft" }),
|
2568
2576
|
// Find the first document to check if it exists
|
@@ -2603,7 +2611,7 @@ const singleTypes = {
|
|
2603
2611
|
return ctx.forbidden();
|
2604
2612
|
}
|
2605
2613
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(query);
|
2606
|
-
const { locale, status } = await getDocumentLocaleAndStatus(query);
|
2614
|
+
const { locale, status } = await getDocumentLocaleAndStatus(query, model);
|
2607
2615
|
const version = await findDocument(permissionQuery, model, { locale, status });
|
2608
2616
|
if (!version) {
|
2609
2617
|
if (permissionChecker2.cannot.create()) {
|
@@ -2648,7 +2656,7 @@ const singleTypes = {
|
|
2648
2656
|
}
|
2649
2657
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.delete(query);
|
2650
2658
|
const populate = await buildPopulateFromQuery(sanitizedQuery, model);
|
2651
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2659
|
+
const { locale } = await getDocumentLocaleAndStatus(query, model);
|
2652
2660
|
const documentLocales = await documentManager2.findLocales(void 0, model, {
|
2653
2661
|
populate,
|
2654
2662
|
locale
|
@@ -2685,7 +2693,7 @@ const singleTypes = {
|
|
2685
2693
|
if (permissionChecker2.cannot.publish(document)) {
|
2686
2694
|
throw new errors.ForbiddenError();
|
2687
2695
|
}
|
2688
|
-
const { locale } = await getDocumentLocaleAndStatus(document);
|
2696
|
+
const { locale } = await getDocumentLocaleAndStatus(document, model);
|
2689
2697
|
const publishResult = await documentManager2.publish(document.documentId, model, { locale });
|
2690
2698
|
return publishResult.at(0);
|
2691
2699
|
});
|
@@ -2708,7 +2716,7 @@ const singleTypes = {
|
|
2708
2716
|
return ctx.forbidden();
|
2709
2717
|
}
|
2710
2718
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.unpublish(query);
|
2711
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2719
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2712
2720
|
const document = await findDocument(sanitizedQuery, model, { locale });
|
2713
2721
|
if (!document) {
|
2714
2722
|
return ctx.notFound();
|
@@ -2740,7 +2748,7 @@ const singleTypes = {
|
|
2740
2748
|
return ctx.forbidden();
|
2741
2749
|
}
|
2742
2750
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.discard(query);
|
2743
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2751
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2744
2752
|
const document = await findDocument(sanitizedQuery, model, { locale, status: "published" });
|
2745
2753
|
if (!document) {
|
2746
2754
|
return ctx.notFound();
|
@@ -2760,7 +2768,7 @@ const singleTypes = {
|
|
2760
2768
|
const { query } = ctx.request;
|
2761
2769
|
const documentManager2 = getService$1("document-manager");
|
2762
2770
|
const permissionChecker2 = getService$1("permission-checker").create({ userAbility, model });
|
2763
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2771
|
+
const { locale } = await getDocumentLocaleAndStatus(query, model);
|
2764
2772
|
if (permissionChecker2.cannot.read()) {
|
2765
2773
|
return ctx.forbidden();
|
2766
2774
|
}
|
@@ -2781,7 +2789,7 @@ const uid$1 = {
|
|
2781
2789
|
async generateUID(ctx) {
|
2782
2790
|
const { contentTypeUID, field, data } = await validateGenerateUIDInput(ctx.request.body);
|
2783
2791
|
const { query = {} } = ctx.request;
|
2784
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2792
|
+
const { locale } = await getDocumentLocaleAndStatus(query, contentTypeUID);
|
2785
2793
|
await validateUIDField(contentTypeUID, field);
|
2786
2794
|
const uidService = getService$1("uid");
|
2787
2795
|
ctx.body = {
|
@@ -2793,7 +2801,7 @@ const uid$1 = {
|
|
2793
2801
|
ctx.request.body
|
2794
2802
|
);
|
2795
2803
|
const { query = {} } = ctx.request;
|
2796
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2804
|
+
const { locale } = await getDocumentLocaleAndStatus(query, contentTypeUID);
|
2797
2805
|
await validateUIDField(contentTypeUID, field);
|
2798
2806
|
const uidService = getService$1("uid");
|
2799
2807
|
const isAvailable = await uidService.checkUIDAvailability({
|
@@ -3718,6 +3726,10 @@ const getDeepPopulateDraftCount = (uid2) => {
|
|
3718
3726
|
const attribute = model.attributes[attributeName];
|
3719
3727
|
switch (attribute.type) {
|
3720
3728
|
case "relation": {
|
3729
|
+
const isMorphRelation = attribute.relation.toLowerCase().startsWith("morph");
|
3730
|
+
if (isMorphRelation) {
|
3731
|
+
break;
|
3732
|
+
}
|
3721
3733
|
if (isVisibleAttribute$1(model, attributeName)) {
|
3722
3734
|
populateAcc[attributeName] = {
|
3723
3735
|
count: true,
|
@@ -4203,10 +4215,7 @@ const documentManager = ({ strapi: strapi2 }) => {
|
|
4203
4215
|
async clone(id, body, uid2) {
|
4204
4216
|
const populate = await buildDeepPopulate(uid2);
|
4205
4217
|
const params = {
|
4206
|
-
data:
|
4207
|
-
...omitIdField(body),
|
4208
|
-
[PUBLISHED_AT_ATTRIBUTE]: null
|
4209
|
-
},
|
4218
|
+
data: omitIdField(body),
|
4210
4219
|
populate
|
4211
4220
|
};
|
4212
4221
|
return strapi2.documents(uid2).clone({ ...params, documentId: id }).then((result) => result?.entries.at(0));
|