@strapi/content-manager 0.0.0-experimental.3fd705928266d1b836afc8a30fceb35aac0ae2f8 → 0.0.0-experimental.438960f273755509510c3610187d9deb520ba2a0
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-_zF8p6CY.js → ComponentConfigurationPage-3feZ0gyp.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-_zF8p6CY.js.map → ComponentConfigurationPage-3feZ0gyp.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-CpBFh6_r.mjs → ComponentConfigurationPage-DkUdgHD9.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-CpBFh6_r.mjs.map → ComponentConfigurationPage-DkUdgHD9.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-_aG2DJSU.js → EditConfigurationPage-B0KA-x9U.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-_aG2DJSU.js.map → EditConfigurationPage-B0KA-x9U.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CE_yavTi.mjs → EditConfigurationPage-Ox5wFgpq.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CE_yavTi.mjs.map → EditConfigurationPage-Ox5wFgpq.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-G9uNzwYL.js → EditViewPage-OMv9CogC.js} +15 -5
- package/dist/_chunks/EditViewPage-OMv9CogC.js.map +1 -0
- package/dist/_chunks/{EditViewPage-DeTn7rAF.mjs → EditViewPage-foKE8Al3.mjs} +15 -5
- package/dist/_chunks/EditViewPage-foKE8Al3.mjs.map +1 -0
- package/dist/_chunks/{Field-CnCKhI1R.mjs → Field-CLqZcnnc.mjs} +69 -25
- package/dist/_chunks/Field-CLqZcnnc.mjs.map +1 -0
- package/dist/_chunks/{Field-DDHUWEfV.js → Field-u09MCk3G.js} +69 -25
- package/dist/_chunks/Field-u09MCk3G.js.map +1 -0
- package/dist/_chunks/{Form-DYETaKUX.js → Form-B9c_Ti0q.js} +3 -3
- package/dist/_chunks/Form-B9c_Ti0q.js.map +1 -0
- package/dist/_chunks/{Form-IvVVwqRL.mjs → Form-CU4hRyJf.mjs} +3 -3
- package/dist/_chunks/Form-CU4hRyJf.mjs.map +1 -0
- package/dist/_chunks/{History-BMunT-do.mjs → History-BFyFzpSS.mjs} +25 -12
- package/dist/_chunks/History-BFyFzpSS.mjs.map +1 -0
- package/dist/_chunks/{History-CnZDctSO.js → History-OlickLyX.js} +24 -11
- package/dist/_chunks/History-OlickLyX.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CDqkCxgV.mjs → ListConfigurationPage-Bu5Z_39o.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-CDqkCxgV.mjs.map → ListConfigurationPage-Bu5Z_39o.mjs.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-BynalOp8.js → ListConfigurationPage-D0AAi_cW.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-BynalOp8.js.map → ListConfigurationPage-D0AAi_cW.js.map} +1 -1
- package/dist/_chunks/{ListViewPage-I88Ouzoq.js → ListViewPage--lV5p8Qi.js} +10 -6
- package/dist/_chunks/ListViewPage--lV5p8Qi.js.map +1 -0
- package/dist/_chunks/{ListViewPage-_5gS-DOF.mjs → ListViewPage-BAHxSPux.mjs} +10 -6
- package/dist/_chunks/ListViewPage-BAHxSPux.mjs.map +1 -0
- package/dist/_chunks/{NoContentTypePage-Dht-55hr.mjs → NoContentTypePage-C6SMXW77.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-Dht-55hr.mjs.map → NoContentTypePage-C6SMXW77.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BaWQ7HsA.js → NoContentTypePage-Dxl9oZqL.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-BaWQ7HsA.js.map → NoContentTypePage-Dxl9oZqL.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DCVUh5at.js → NoPermissionsPage-BY1-rMng.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DCVUh5at.js.map → NoPermissionsPage-BY1-rMng.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-Bs8D5W_v.mjs → NoPermissionsPage-o9BXzQeI.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-Bs8D5W_v.mjs.map → NoPermissionsPage-o9BXzQeI.mjs.map} +1 -1
- package/dist/_chunks/{Relations-Chdt5qWc.mjs → Relations-BAK95JHc.mjs} +32 -23
- package/dist/_chunks/Relations-BAK95JHc.mjs.map +1 -0
- package/dist/_chunks/{Relations-BPgFQeGj.js → Relations-CHfwGkBG.js} +32 -23
- package/dist/_chunks/Relations-CHfwGkBG.js.map +1 -0
- package/dist/_chunks/{en-BVzUkPxZ.js → en-Bm0D0IWz.js} +8 -8
- package/dist/_chunks/{en-BVzUkPxZ.js.map → en-Bm0D0IWz.js.map} +1 -1
- package/dist/_chunks/{en-CPTj6CjC.mjs → en-DKV44jRb.mjs} +8 -8
- package/dist/_chunks/{en-CPTj6CjC.mjs.map → en-DKV44jRb.mjs.map} +1 -1
- package/dist/_chunks/{index-D4UGPFZC.mjs → index-CxlpxzA5.mjs} +940 -863
- package/dist/_chunks/index-CxlpxzA5.mjs.map +1 -0
- package/dist/_chunks/{index-BhbLFX4l.js → index-_Mlmsefd.js} +938 -861
- package/dist/_chunks/index-_Mlmsefd.js.map +1 -0
- package/dist/_chunks/{layout-D4HI4_PS.mjs → layout-Cr0H40au.mjs} +3 -3
- package/dist/_chunks/{layout-D4HI4_PS.mjs.map → layout-Cr0H40au.mjs.map} +1 -1
- package/dist/_chunks/{layout-CYA7s0qO.js → layout-vcHVgSr1.js} +3 -3
- package/dist/_chunks/{layout-CYA7s0qO.js.map → layout-vcHVgSr1.js.map} +1 -1
- package/dist/_chunks/{relations-1pXaYpBK.mjs → relations-Dq60voyX.mjs} +2 -2
- package/dist/_chunks/{relations-1pXaYpBK.mjs.map → relations-Dq60voyX.mjs.map} +1 -1
- package/dist/_chunks/{relations-DDZ9OxNo.js → relations-hXUB80SH.js} +2 -2
- package/dist/_chunks/{relations-DDZ9OxNo.js.map → relations-hXUB80SH.js.map} +1 -1
- 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 +1 -0
- package/dist/admin/src/preview/constants.d.ts +1 -0
- package/dist/admin/src/preview/index.d.ts +4 -0
- package/dist/server/index.js +45 -18
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +45 -18
- 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/relations.d.ts.map +1 -1
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- 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/index.d.ts +4 -0
- package/dist/server/src/preview/index.d.ts.map +1 -0
- package/package.json +12 -12
- package/dist/_chunks/EditViewPage-DeTn7rAF.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-G9uNzwYL.js.map +0 -1
- package/dist/_chunks/Field-CnCKhI1R.mjs.map +0 -1
- package/dist/_chunks/Field-DDHUWEfV.js.map +0 -1
- package/dist/_chunks/Form-DYETaKUX.js.map +0 -1
- package/dist/_chunks/Form-IvVVwqRL.mjs.map +0 -1
- package/dist/_chunks/History-BMunT-do.mjs.map +0 -1
- package/dist/_chunks/History-CnZDctSO.js.map +0 -1
- package/dist/_chunks/ListViewPage-I88Ouzoq.js.map +0 -1
- package/dist/_chunks/ListViewPage-_5gS-DOF.mjs.map +0 -1
- package/dist/_chunks/Relations-BPgFQeGj.js.map +0 -1
- package/dist/_chunks/Relations-Chdt5qWc.mjs.map +0 -1
- package/dist/_chunks/index-BhbLFX4l.js.map +0 -1
- package/dist/_chunks/index-D4UGPFZC.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 {
|
@@ -664,7 +669,7 @@ const historyVersion = {
|
|
664
669
|
}
|
665
670
|
}
|
666
671
|
};
|
667
|
-
const getFeature = () => {
|
672
|
+
const getFeature$1 = () => {
|
668
673
|
if (strapi.ee.features.isEnabled("cms-content-history")) {
|
669
674
|
return {
|
670
675
|
register({ strapi: strapi2 }) {
|
@@ -687,7 +692,7 @@ const getFeature = () => {
|
|
687
692
|
}
|
688
693
|
};
|
689
694
|
};
|
690
|
-
const history = getFeature();
|
695
|
+
const history = getFeature$1();
|
691
696
|
const register = async ({ strapi: strapi2 }) => {
|
692
697
|
await history.register?.({ strapi: strapi2 });
|
693
698
|
};
|
@@ -695,6 +700,18 @@ const ALLOWED_WEBHOOK_EVENTS = {
|
|
695
700
|
ENTRY_PUBLISH: "entry.publish",
|
696
701
|
ENTRY_UNPUBLISH: "entry.unpublish"
|
697
702
|
};
|
703
|
+
const FEATURE_ID = "preview";
|
704
|
+
const getFeature = () => {
|
705
|
+
if (!strapi.features.future.isEnabled(FEATURE_ID)) {
|
706
|
+
return {};
|
707
|
+
}
|
708
|
+
return {
|
709
|
+
bootstrap() {
|
710
|
+
console.log("Bootstrapping preview server");
|
711
|
+
}
|
712
|
+
};
|
713
|
+
};
|
714
|
+
const preview = getFeature();
|
698
715
|
const bootstrap = async () => {
|
699
716
|
Object.entries(ALLOWED_WEBHOOK_EVENTS).forEach(([key, value]) => {
|
700
717
|
strapi.get("webhookStore").addAllowedEvent(key, value);
|
@@ -704,6 +721,7 @@ const bootstrap = async () => {
|
|
704
721
|
await getService$1("content-types").syncConfigurations();
|
705
722
|
await getService$1("permission").registerPermissions();
|
706
723
|
await history.bootstrap?.({ strapi });
|
724
|
+
await preview.bootstrap?.({ strapi });
|
707
725
|
};
|
708
726
|
const destroy = async ({ strapi: strapi2 }) => {
|
709
727
|
await history.destroy?.({ strapi: strapi2 });
|
@@ -1689,7 +1707,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1689
1707
|
throw new errors.ForbiddenError();
|
1690
1708
|
}
|
1691
1709
|
const pickPermittedFields = documentVersion ? permissionChecker2.sanitizeUpdateInput(documentVersion) : permissionChecker2.sanitizeCreateInput;
|
1692
|
-
const setCreator = setCreatorFields({ user, isEdition: true });
|
1710
|
+
const setCreator = documentVersion ? setCreatorFields({ user, isEdition: true }) : setCreatorFields({ user });
|
1693
1711
|
const sanitizeFn = async.pipe(pickPermittedFields, setCreator);
|
1694
1712
|
const sanitizedBody = await sanitizeFn(body);
|
1695
1713
|
return documentManager2.update(documentVersion?.documentId || id, model, {
|
@@ -1898,11 +1916,17 @@ const collectionTypes = {
|
|
1898
1916
|
}
|
1899
1917
|
const isUpdate = !isCreate;
|
1900
1918
|
if (isUpdate) {
|
1901
|
-
|
1902
|
-
if (!
|
1919
|
+
const documentExists = documentManager2.exists(model, id);
|
1920
|
+
if (!documentExists) {
|
1903
1921
|
throw new errors.NotFoundError("Document not found");
|
1904
1922
|
}
|
1905
|
-
|
1923
|
+
document = await documentManager2.findOne(id, model, { populate, locale });
|
1924
|
+
if (!document) {
|
1925
|
+
if (permissionChecker2.cannot.create({ locale }) || permissionChecker2.cannot.publish({ locale })) {
|
1926
|
+
throw new errors.ForbiddenError();
|
1927
|
+
}
|
1928
|
+
document = await updateDocument(ctx);
|
1929
|
+
} else if (permissionChecker2.can.update(document)) {
|
1906
1930
|
await updateDocument(ctx);
|
1907
1931
|
}
|
1908
1932
|
}
|
@@ -2356,11 +2380,8 @@ const validateLocale = (sourceUid, targetUid, locale) => {
|
|
2356
2380
|
const isLocalized = strapi.plugin("i18n").service("content-types").isLocalizedContentType;
|
2357
2381
|
const isSourceLocalized = isLocalized(sourceModel);
|
2358
2382
|
const isTargetLocalized = isLocalized(targetModel);
|
2359
|
-
let validatedLocale = locale;
|
2360
|
-
if (!targetModel || !isTargetLocalized)
|
2361
|
-
validatedLocale = void 0;
|
2362
2383
|
return {
|
2363
|
-
locale
|
2384
|
+
locale,
|
2364
2385
|
isSourceLocalized,
|
2365
2386
|
isTargetLocalized
|
2366
2387
|
};
|
@@ -2463,7 +2484,7 @@ const relations = {
|
|
2463
2484
|
attribute,
|
2464
2485
|
fieldsToSelect,
|
2465
2486
|
mainField,
|
2466
|
-
source: { schema: sourceSchema },
|
2487
|
+
source: { schema: sourceSchema, isLocalized: isSourceLocalized },
|
2467
2488
|
target: { schema: targetSchema, isLocalized: isTargetLocalized },
|
2468
2489
|
sourceSchema,
|
2469
2490
|
targetSchema,
|
@@ -2485,7 +2506,8 @@ const relations = {
|
|
2485
2506
|
fieldsToSelect,
|
2486
2507
|
mainField,
|
2487
2508
|
source: {
|
2488
|
-
schema: { uid: sourceUid, modelType: sourceModelType }
|
2509
|
+
schema: { uid: sourceUid, modelType: sourceModelType },
|
2510
|
+
isLocalized: isSourceLocalized
|
2489
2511
|
},
|
2490
2512
|
target: {
|
2491
2513
|
schema: { uid: targetUid },
|
@@ -2523,12 +2545,16 @@ const relations = {
|
|
2523
2545
|
} else {
|
2524
2546
|
where.id = id;
|
2525
2547
|
}
|
2526
|
-
|
2527
|
-
|
2548
|
+
const publishedAt = getPublishedAtClause(status, targetUid);
|
2549
|
+
if (!isEmpty(publishedAt)) {
|
2550
|
+
where[`${alias}.published_at`] = publishedAt;
|
2528
2551
|
}
|
2529
|
-
if (
|
2552
|
+
if (isTargetLocalized && locale) {
|
2530
2553
|
where[`${alias}.locale`] = locale;
|
2531
2554
|
}
|
2555
|
+
if (isSourceLocalized && locale) {
|
2556
|
+
where.locale = locale;
|
2557
|
+
}
|
2532
2558
|
if ((idsToInclude?.length ?? 0) !== 0) {
|
2533
2559
|
where[`${alias}.id`].$notIn = idsToInclude;
|
2534
2560
|
}
|
@@ -2546,7 +2572,8 @@ const relations = {
|
|
2546
2572
|
id: { $notIn: uniq(idsToOmit) }
|
2547
2573
|
});
|
2548
2574
|
}
|
2549
|
-
const
|
2575
|
+
const dbQuery = strapi.get("query-params").transform(targetUid, queryParams);
|
2576
|
+
const res = await strapi.db.query(targetUid).findPage(dbQuery);
|
2550
2577
|
ctx.body = {
|
2551
2578
|
...res,
|
2552
2579
|
results: await addStatusToRelations(targetUid, res.results)
|
@@ -2668,7 +2695,7 @@ const singleTypes = {
|
|
2668
2695
|
permissionChecker2,
|
2669
2696
|
model,
|
2670
2697
|
// @ts-expect-error - fix types
|
2671
|
-
{
|
2698
|
+
{ documentId: document.documentId, locale, publishedAt: null },
|
2672
2699
|
{ availableLocales: true, availableStatus: false }
|
2673
2700
|
);
|
2674
2701
|
ctx.body = { data: {}, meta };
|