@strapi/content-manager 0.0.0-experimental.da85533897155e719d784f0271223c866d2f69ab → 0.0.0-experimental.e02b4637b3906c6d31048d00600d09a23a0edc3d
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/{ComponentConfigurationPage-9lRmRdIr.mjs → ComponentConfigurationPage-DfFSZQxe.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-9lRmRdIr.mjs.map → ComponentConfigurationPage-DfFSZQxe.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-DyDkPajU.js → ComponentConfigurationPage-FqfsxQ1j.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-DyDkPajU.js.map → ComponentConfigurationPage-FqfsxQ1j.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-DValmA0m.js → EditConfigurationPage-Cn0e8t3I.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-DValmA0m.js.map → EditConfigurationPage-Cn0e8t3I.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-Bk893vVY.mjs → EditConfigurationPage-DdPNAbl3.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-Bk893vVY.mjs.map → EditConfigurationPage-DdPNAbl3.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-DiNFdFqP.mjs → EditViewPage-B82x_x1b.mjs} +15 -5
- package/dist/_chunks/EditViewPage-B82x_x1b.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-Dk7Eaft4.js → EditViewPage-DlxEHhUt.js} +15 -5
- package/dist/_chunks/EditViewPage-DlxEHhUt.js.map +1 -0
- package/dist/_chunks/{Field-DH2OaqUP.js → Field-COL25JiC.js} +76 -42
- package/dist/_chunks/Field-COL25JiC.js.map +1 -0
- package/dist/_chunks/{Field-Dv_HTFTa.mjs → Field-DufHXW17.mjs} +72 -38
- package/dist/_chunks/Field-DufHXW17.mjs.map +1 -0
- package/dist/_chunks/{Form-B_dUDizM.js → Form-BssUwrTO.js} +16 -8
- package/dist/_chunks/Form-BssUwrTO.js.map +1 -0
- package/dist/_chunks/{Form-Dy6P4HgH.mjs → Form-u_kAOhwB.mjs} +16 -8
- package/dist/_chunks/Form-u_kAOhwB.mjs.map +1 -0
- package/dist/_chunks/{History-BT4w83Oa.js → History-C9t9UqpO.js} +23 -10
- package/dist/_chunks/History-C9t9UqpO.js.map +1 -0
- package/dist/_chunks/{History-DrwsD1Vc.mjs → History-DRwA3oMM.mjs} +24 -11
- package/dist/_chunks/History-DRwA3oMM.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CuYrMcW3.js → ListConfigurationPage-BXYPohh-.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-CuYrMcW3.js.map → ListConfigurationPage-BXYPohh-.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BxIP0jRy.mjs → ListConfigurationPage-BxfQJzPk.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BxIP0jRy.mjs.map → ListConfigurationPage-BxfQJzPk.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-5a1vw-OK.mjs → ListViewPage-CELx2ysp.mjs} +24 -12
- package/dist/_chunks/ListViewPage-CELx2ysp.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-BvpwNur7.js → ListViewPage-D2VD8Szg.js} +28 -16
- package/dist/_chunks/ListViewPage-D2VD8Szg.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-UqEiWKkM.js → NoContentTypePage-BV9IjJSM.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-UqEiWKkM.js.map → NoContentTypePage-BV9IjJSM.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-Bm6tRcd3.mjs → NoContentTypePage-DtJ9jcfk.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-Bm6tRcd3.mjs.map → NoContentTypePage-DtJ9jcfk.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BHPqn_tQ.mjs → NoPermissionsPage-DWleVYK7.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BHPqn_tQ.mjs.map → NoPermissionsPage-DWleVYK7.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-C_vGRo8Q.js → NoPermissionsPage-Dp8NpF9I.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-C_vGRo8Q.js.map → NoPermissionsPage-Dp8NpF9I.js.map} +1 -1
- package/dist/_chunks/{Relations-C7fPyh5P.mjs → Relations-BTcf5xaw.mjs} +32 -23
- package/dist/_chunks/Relations-BTcf5xaw.mjs.map +1 -0
- package/dist/_chunks/{Relations-CznVF6LS.js → Relations-DR7EUgyC.js} +32 -23
- package/dist/_chunks/Relations-DR7EUgyC.js.map +1 -0
- package/dist/_chunks/{en-otD_UBJi.js → en-Bm0D0IWz.js} +12 -11
- package/dist/_chunks/{en-otD_UBJi.js.map → en-Bm0D0IWz.js.map} +1 -1
- package/dist/_chunks/{en-CbaIuYoB.mjs → en-DKV44jRb.mjs} +12 -11
- package/dist/_chunks/{en-CbaIuYoB.mjs.map → en-DKV44jRb.mjs.map} +1 -1
- package/dist/_chunks/{index-D9UmmBcM.js → index-BdMf2lfT.js} +1990 -1875
- package/dist/_chunks/index-BdMf2lfT.js.map +1 -0
- package/dist/_chunks/{index-BJ6uTqLL.mjs → index-wnqzm4Q8.mjs} +1994 -1879
- package/dist/_chunks/index-wnqzm4Q8.mjs.map +1 -0
- package/dist/_chunks/{layout-uomiIGbG.mjs → layout-2CfjL0T9.mjs} +5 -4
- package/dist/_chunks/{layout-uomiIGbG.mjs.map → layout-2CfjL0T9.mjs.map} +1 -1
- package/dist/_chunks/{layout-kfu5Wtix.js → layout-B2MyZU-_.js} +5 -4
- package/dist/_chunks/{layout-kfu5Wtix.js.map → layout-B2MyZU-_.js.map} +1 -1
- package/dist/_chunks/{relations-DKENrxko.js → relations-BH7JJGGe.js} +2 -2
- package/dist/_chunks/{relations-DKENrxko.js.map → relations-BH7JJGGe.js.map} +1 -1
- package/dist/_chunks/{relations-DiDufGSA.mjs → relations-C0w0GcXi.mjs} +2 -2
- package/dist/_chunks/{relations-DiDufGSA.mjs.map → relations-C0w0GcXi.mjs.map} +1 -1
- package/dist/_chunks/{usePrev-B9w_-eYc.js → useDebounce-CtcjDB3L.js} +14 -1
- package/dist/_chunks/useDebounce-CtcjDB3L.js.map +1 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs +29 -0
- package/dist/_chunks/useDebounce-DmuSJIF3.mjs.map +1 -0
- package/dist/admin/index.js +2 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +3 -2
- package/dist/admin/src/exports.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +32 -1
- package/dist/admin/src/pages/EditView/components/Header.d.ts +11 -11
- package/dist/admin/src/services/documents.d.ts +3 -1
- package/dist/server/index.js +34 -18
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +34 -18
- 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/relations.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +3 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/package.json +12 -12
- package/dist/_chunks/EditViewPage-DiNFdFqP.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-Dk7Eaft4.js.map +0 -1
- package/dist/_chunks/Field-DH2OaqUP.js.map +0 -1
- package/dist/_chunks/Field-Dv_HTFTa.mjs.map +0 -1
- package/dist/_chunks/Form-B_dUDizM.js.map +0 -1
- package/dist/_chunks/Form-Dy6P4HgH.mjs.map +0 -1
- package/dist/_chunks/History-BT4w83Oa.js.map +0 -1
- package/dist/_chunks/History-DrwsD1Vc.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-5a1vw-OK.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BvpwNur7.js.map +0 -1
- package/dist/_chunks/Relations-C7fPyh5P.mjs.map +0 -1
- package/dist/_chunks/Relations-CznVF6LS.js.map +0 -1
- package/dist/_chunks/index-BJ6uTqLL.mjs.map +0 -1
- package/dist/_chunks/index-D9UmmBcM.js.map +0 -1
- package/dist/_chunks/usePrev-B9w_-eYc.js.map +0 -1
- package/dist/_chunks/usePrev-DH6iah0A.mjs +0 -16
- package/dist/_chunks/usePrev-DH6iah0A.mjs.map +0 -1
- package/strapi-server.js +0 -3
package/dist/server/index.mjs
CHANGED
@@ -367,7 +367,12 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
367
367
|
if (userToPopulate == null) {
|
368
368
|
return null;
|
369
369
|
}
|
370
|
-
return strapi2.query("admin::user").findOne({
|
370
|
+
return strapi2.query("admin::user").findOne({
|
371
|
+
where: {
|
372
|
+
...userToPopulate.id ? { id: userToPopulate.id } : {},
|
373
|
+
...userToPopulate.documentId ? { documentId: userToPopulate.documentId } : {}
|
374
|
+
}
|
375
|
+
});
|
371
376
|
})
|
372
377
|
);
|
373
378
|
return {
|
@@ -1689,7 +1694,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1689
1694
|
throw new errors.ForbiddenError();
|
1690
1695
|
}
|
1691
1696
|
const pickPermittedFields = documentVersion ? permissionChecker2.sanitizeUpdateInput(documentVersion) : permissionChecker2.sanitizeCreateInput;
|
1692
|
-
const setCreator = setCreatorFields({ user, isEdition: true });
|
1697
|
+
const setCreator = documentVersion ? setCreatorFields({ user, isEdition: true }) : setCreatorFields({ user });
|
1693
1698
|
const sanitizeFn = async.pipe(pickPermittedFields, setCreator);
|
1694
1699
|
const sanitizedBody = await sanitizeFn(body);
|
1695
1700
|
return documentManager2.update(documentVersion?.documentId || id, model, {
|
@@ -1761,7 +1766,7 @@ const collectionTypes = {
|
|
1761
1766
|
permissionChecker2,
|
1762
1767
|
model,
|
1763
1768
|
// @ts-expect-error TODO: fix
|
1764
|
-
{ id, locale, publishedAt: null },
|
1769
|
+
{ documentId: id, locale, publishedAt: null },
|
1765
1770
|
{ availableLocales: true, availableStatus: false }
|
1766
1771
|
);
|
1767
1772
|
ctx.body = { data: {}, meta };
|
@@ -1898,11 +1903,17 @@ const collectionTypes = {
|
|
1898
1903
|
}
|
1899
1904
|
const isUpdate = !isCreate;
|
1900
1905
|
if (isUpdate) {
|
1901
|
-
|
1902
|
-
if (!
|
1906
|
+
const documentExists = documentManager2.exists(model, id);
|
1907
|
+
if (!documentExists) {
|
1903
1908
|
throw new errors.NotFoundError("Document not found");
|
1904
1909
|
}
|
1905
|
-
|
1910
|
+
document = await documentManager2.findOne(id, model, { populate, locale });
|
1911
|
+
if (!document) {
|
1912
|
+
if (permissionChecker2.cannot.create({ locale }) || permissionChecker2.cannot.publish({ locale })) {
|
1913
|
+
throw new errors.ForbiddenError();
|
1914
|
+
}
|
1915
|
+
document = await updateDocument(ctx);
|
1916
|
+
} else if (permissionChecker2.can.update(document)) {
|
1906
1917
|
await updateDocument(ctx);
|
1907
1918
|
}
|
1908
1919
|
}
|
@@ -1964,7 +1975,9 @@ const collectionTypes = {
|
|
1964
1975
|
if (permissionChecker2.cannot.unpublish()) {
|
1965
1976
|
return ctx.forbidden();
|
1966
1977
|
}
|
1967
|
-
const { locale } = await getDocumentLocaleAndStatus(body, model
|
1978
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
1979
|
+
allowMultipleLocales: true
|
1980
|
+
});
|
1968
1981
|
const entityPromises = documentIds.map(
|
1969
1982
|
(documentId) => documentManager2.findLocales(documentId, model, { locale, isPublished: true })
|
1970
1983
|
);
|
@@ -2354,11 +2367,8 @@ const validateLocale = (sourceUid, targetUid, locale) => {
|
|
2354
2367
|
const isLocalized = strapi.plugin("i18n").service("content-types").isLocalizedContentType;
|
2355
2368
|
const isSourceLocalized = isLocalized(sourceModel);
|
2356
2369
|
const isTargetLocalized = isLocalized(targetModel);
|
2357
|
-
let validatedLocale = locale;
|
2358
|
-
if (!targetModel || !isTargetLocalized)
|
2359
|
-
validatedLocale = void 0;
|
2360
2370
|
return {
|
2361
|
-
locale
|
2371
|
+
locale,
|
2362
2372
|
isSourceLocalized,
|
2363
2373
|
isTargetLocalized
|
2364
2374
|
};
|
@@ -2461,7 +2471,7 @@ const relations = {
|
|
2461
2471
|
attribute,
|
2462
2472
|
fieldsToSelect,
|
2463
2473
|
mainField,
|
2464
|
-
source: { schema: sourceSchema },
|
2474
|
+
source: { schema: sourceSchema, isLocalized: isSourceLocalized },
|
2465
2475
|
target: { schema: targetSchema, isLocalized: isTargetLocalized },
|
2466
2476
|
sourceSchema,
|
2467
2477
|
targetSchema,
|
@@ -2483,7 +2493,8 @@ const relations = {
|
|
2483
2493
|
fieldsToSelect,
|
2484
2494
|
mainField,
|
2485
2495
|
source: {
|
2486
|
-
schema: { uid: sourceUid, modelType: sourceModelType }
|
2496
|
+
schema: { uid: sourceUid, modelType: sourceModelType },
|
2497
|
+
isLocalized: isSourceLocalized
|
2487
2498
|
},
|
2488
2499
|
target: {
|
2489
2500
|
schema: { uid: targetUid },
|
@@ -2521,12 +2532,16 @@ const relations = {
|
|
2521
2532
|
} else {
|
2522
2533
|
where.id = id;
|
2523
2534
|
}
|
2524
|
-
|
2525
|
-
|
2535
|
+
const publishedAt = getPublishedAtClause(status, targetUid);
|
2536
|
+
if (!isEmpty(publishedAt)) {
|
2537
|
+
where[`${alias}.published_at`] = publishedAt;
|
2526
2538
|
}
|
2527
|
-
if (
|
2539
|
+
if (isTargetLocalized && locale) {
|
2528
2540
|
where[`${alias}.locale`] = locale;
|
2529
2541
|
}
|
2542
|
+
if (isSourceLocalized && locale) {
|
2543
|
+
where.locale = locale;
|
2544
|
+
}
|
2530
2545
|
if ((idsToInclude?.length ?? 0) !== 0) {
|
2531
2546
|
where[`${alias}.id`].$notIn = idsToInclude;
|
2532
2547
|
}
|
@@ -2544,7 +2559,8 @@ const relations = {
|
|
2544
2559
|
id: { $notIn: uniq(idsToOmit) }
|
2545
2560
|
});
|
2546
2561
|
}
|
2547
|
-
const
|
2562
|
+
const dbQuery = strapi.get("query-params").transform(targetUid, queryParams);
|
2563
|
+
const res = await strapi.db.query(targetUid).findPage(dbQuery);
|
2548
2564
|
ctx.body = {
|
2549
2565
|
...res,
|
2550
2566
|
results: await addStatusToRelations(targetUid, res.results)
|
@@ -2666,7 +2682,7 @@ const singleTypes = {
|
|
2666
2682
|
permissionChecker2,
|
2667
2683
|
model,
|
2668
2684
|
// @ts-expect-error - fix types
|
2669
|
-
{
|
2685
|
+
{ documentId: document.documentId, locale, publishedAt: null },
|
2670
2686
|
{ availableLocales: true, availableStatus: false }
|
2671
2687
|
);
|
2672
2688
|
ctx.body = { data: {}, meta };
|