@strapi/content-manager 0.0.0-experimental.44c735643fa8b4286750c2dca43f185bb30b7760 → 0.0.0-experimental.4d2127dc461470cbc28e8244c9c2776429a3c8a2
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-BlAzljQ6.js → ComponentConfigurationPage-BEGp0IOV.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BlAzljQ6.js.map → ComponentConfigurationPage-BEGp0IOV.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-Ccwb19Qj.mjs → ComponentConfigurationPage-DUXYqQwA.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-Ccwb19Qj.mjs.map → ComponentConfigurationPage-DUXYqQwA.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BPoOzhCM.js → EditConfigurationPage-BFAn2GH9.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BPoOzhCM.js.map → EditConfigurationPage-BFAn2GH9.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-C19b_9RL.mjs → EditConfigurationPage-D7PzCWYW.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-C19b_9RL.mjs.map → EditConfigurationPage-D7PzCWYW.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-D9xH8HYD.js → EditViewPage-CB017yCP.js} +15 -5
- package/dist/_chunks/EditViewPage-CB017yCP.js.map +1 -0
- package/dist/_chunks/{EditViewPage-nmrHNiJ9.mjs → EditViewPage-DmKviP3U.mjs} +15 -5
- package/dist/_chunks/EditViewPage-DmKviP3U.mjs.map +1 -0
- package/dist/_chunks/{Field-BB_pHo6D.js → Field-ByXbOZL6.js} +69 -25
- package/dist/_chunks/Field-ByXbOZL6.js.map +1 -0
- package/dist/_chunks/{Field--kmlJuSb.mjs → Field-DztIyw14.mjs} +69 -25
- package/dist/_chunks/Field-DztIyw14.mjs.map +1 -0
- package/dist/_chunks/{Form-CUtOiC4S.mjs → Form-D993gfLL.mjs} +3 -3
- package/dist/_chunks/Form-D993gfLL.mjs.map +1 -0
- package/dist/_chunks/{Form-iwbkoaAF.js → Form-WgML3Oqo.js} +3 -3
- package/dist/_chunks/Form-WgML3Oqo.js.map +1 -0
- package/dist/_chunks/{History-guuZF4lR.js → History-BmxGh1cB.js} +24 -11
- package/dist/_chunks/History-BmxGh1cB.js.map +1 -0
- package/dist/_chunks/{History-BKR3KyU3.mjs → History-GcW_hfMD.mjs} +25 -12
- package/dist/_chunks/History-GcW_hfMD.mjs.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-Cu26t5sE.js → ListConfigurationPage-16rxMcAO.js} +2 -2
- package/dist/_chunks/{ListConfigurationPage-Cu26t5sE.js.map → ListConfigurationPage-16rxMcAO.js.map} +1 -1
- package/dist/_chunks/{ListConfigurationPage-B_O3hiLT.mjs → ListConfigurationPage-kBho1y__.mjs} +2 -2
- package/dist/_chunks/{ListConfigurationPage-B_O3hiLT.mjs.map → ListConfigurationPage-kBho1y__.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-B4sTBfu6.mjs → ListViewPage-6rg02vWk.mjs} +16 -5
- package/dist/_chunks/{ListViewPage-B4sTBfu6.mjs.map → ListViewPage-6rg02vWk.mjs.map} +1 -1
- package/dist/_chunks/{ListViewPage-DWqqGno8.js → ListViewPage-BXqw44Ja.js} +16 -5
- package/dist/_chunks/ListViewPage-BXqw44Ja.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-Daktt4t9.mjs → NoContentTypePage-BVtZUY-U.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-Daktt4t9.mjs.map → NoContentTypePage-BVtZUY-U.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-TTkwA8uk.js → NoContentTypePage-DYfH0OD-.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-TTkwA8uk.js.map → NoContentTypePage-DYfH0OD-.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-D8_k39Q0.js → NoPermissionsPage-ClDJKdA9.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-D8_k39Q0.js.map → NoPermissionsPage-ClDJKdA9.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CBUXY2Pt.mjs → NoPermissionsPage-D9R6cWCY.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CBUXY2Pt.mjs.map → NoPermissionsPage-D9R6cWCY.mjs.map} +1 -1
- package/dist/_chunks/{Relations-DjvmZ_XQ.js → Relations-CvsqEtYj.js} +32 -23
- package/dist/_chunks/Relations-CvsqEtYj.js.map +1 -0
- package/dist/_chunks/{Relations-HKmXF7eO.mjs → Relations-uEN7K10I.mjs} +32 -23
- package/dist/_chunks/Relations-uEN7K10I.mjs.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-CB1AN26E.mjs → index-BHBrXMdZ.mjs} +940 -863
- package/dist/_chunks/index-BHBrXMdZ.mjs.map +1 -0
- package/dist/_chunks/{index-jDJgW_Lf.js → index-BrzMjag-.js} +938 -861
- package/dist/_chunks/index-BrzMjag-.js.map +1 -0
- package/dist/_chunks/{layout-D6A3K-ut.js → layout-Dwmw0D0e.js} +3 -3
- package/dist/_chunks/{layout-D6A3K-ut.js.map → layout-Dwmw0D0e.js.map} +1 -1
- package/dist/_chunks/{layout-BCzDsMgN.mjs → layout-TDRwTVM6.mjs} +3 -3
- package/dist/_chunks/{layout-BCzDsMgN.mjs.map → layout-TDRwTVM6.mjs.map} +1 -1
- package/dist/_chunks/{relations-B5Jnw32V.mjs → relations-41Z1upHL.mjs} +2 -2
- package/dist/_chunks/{relations-B5Jnw32V.mjs.map → relations-41Z1upHL.mjs.map} +1 -1
- package/dist/_chunks/{relations-C10QoukP.js → relations-CIcMvUXZ.js} +2 -2
- package/dist/_chunks/{relations-C10QoukP.js.map → relations-CIcMvUXZ.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 +11 -11
- package/dist/_chunks/EditViewPage-D9xH8HYD.js.map +0 -1
- package/dist/_chunks/EditViewPage-nmrHNiJ9.mjs.map +0 -1
- package/dist/_chunks/Field--kmlJuSb.mjs.map +0 -1
- package/dist/_chunks/Field-BB_pHo6D.js.map +0 -1
- package/dist/_chunks/Form-CUtOiC4S.mjs.map +0 -1
- package/dist/_chunks/Form-iwbkoaAF.js.map +0 -1
- package/dist/_chunks/History-BKR3KyU3.mjs.map +0 -1
- package/dist/_chunks/History-guuZF4lR.js.map +0 -1
- package/dist/_chunks/ListViewPage-DWqqGno8.js.map +0 -1
- package/dist/_chunks/Relations-DjvmZ_XQ.js.map +0 -1
- package/dist/_chunks/Relations-HKmXF7eO.mjs.map +0 -1
- package/dist/_chunks/index-CB1AN26E.mjs.map +0 -1
- package/dist/_chunks/index-jDJgW_Lf.js.map +0 -1
- package/strapi-server.js +0 -3
@@ -31,7 +31,9 @@ type UseDocument = (args: UseDocumentArgs, opts?: UseDocumentOpts) => {
|
|
31
31
|
* This is the schema of the content type, it is not the same as the layout.
|
32
32
|
*/
|
33
33
|
schema?: Schema;
|
34
|
+
schemas?: Schema[];
|
34
35
|
validate: (document: Document) => null | FormErrors;
|
36
|
+
hasError?: boolean;
|
35
37
|
};
|
36
38
|
/**
|
37
39
|
* @alpha
|
@@ -78,10 +80,39 @@ declare const useDoc: () => {
|
|
78
80
|
* This is the schema of the content type, it is not the same as the layout.
|
79
81
|
*/
|
80
82
|
schema?: ContentType | undefined;
|
83
|
+
schemas?: ContentType[] | undefined;
|
81
84
|
validate: (document: Document) => null | FormErrors;
|
85
|
+
hasError?: boolean | undefined;
|
82
86
|
collectionType: string;
|
83
87
|
model: string;
|
84
88
|
id: string | undefined;
|
85
89
|
};
|
86
|
-
|
90
|
+
/**
|
91
|
+
* @public
|
92
|
+
* @experimental
|
93
|
+
* Content manager context hooks for plugin development.
|
94
|
+
* Make sure to use this hook inside the content manager.
|
95
|
+
*/
|
96
|
+
declare const useContentManagerContext: () => {
|
97
|
+
error: import("@reduxjs/toolkit").SerializedError | import("../utils/api").BaseQueryError | undefined;
|
98
|
+
isLoading: boolean;
|
99
|
+
model: string;
|
100
|
+
collectionType: string;
|
101
|
+
id: string | undefined;
|
102
|
+
slug: string;
|
103
|
+
isCreatingEntry: boolean;
|
104
|
+
isSingleType: boolean;
|
105
|
+
hasDraftAndPublish: boolean;
|
106
|
+
components: ComponentsDictionary;
|
107
|
+
contentType: ContentType | undefined;
|
108
|
+
contentTypes: ContentType[] | undefined;
|
109
|
+
form: import("@strapi/admin/strapi-admin").FormContextValue<import("@strapi/admin/strapi-admin").FormValues>;
|
110
|
+
layout: {
|
111
|
+
error?: import("@reduxjs/toolkit").SerializedError | import("../utils/api").BaseQueryError | undefined;
|
112
|
+
isLoading: boolean;
|
113
|
+
edit: import("./useDocumentLayout").EditLayout;
|
114
|
+
list: import("./useDocumentLayout").ListLayout;
|
115
|
+
};
|
116
|
+
};
|
117
|
+
export { useDocument, useDoc, useContentManagerContext };
|
87
118
|
export type { UseDocument, UseDocumentArgs, Document, Schema, ComponentsDictionary };
|
@@ -28,6 +28,7 @@ interface HeaderActionDescription {
|
|
28
28
|
}>;
|
29
29
|
onSelect?: (value: string) => void;
|
30
30
|
value?: string;
|
31
|
+
customizeContent?: (value: string) => React.ReactNode;
|
31
32
|
}
|
32
33
|
declare const DEFAULT_HEADER_ACTIONS: DocumentActionComponent[];
|
33
34
|
export { Header, DEFAULT_HEADER_ACTIONS };
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const FEATURE_ID = "preview";
|
package/dist/server/index.js
CHANGED
@@ -393,7 +393,12 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
393
393
|
if (userToPopulate == null) {
|
394
394
|
return null;
|
395
395
|
}
|
396
|
-
return strapi2.query("admin::user").findOne({
|
396
|
+
return strapi2.query("admin::user").findOne({
|
397
|
+
where: {
|
398
|
+
...userToPopulate.id ? { id: userToPopulate.id } : {},
|
399
|
+
...userToPopulate.documentId ? { documentId: userToPopulate.documentId } : {}
|
400
|
+
}
|
401
|
+
});
|
397
402
|
})
|
398
403
|
);
|
399
404
|
return {
|
@@ -690,7 +695,7 @@ const historyVersion = {
|
|
690
695
|
}
|
691
696
|
}
|
692
697
|
};
|
693
|
-
const getFeature = () => {
|
698
|
+
const getFeature$1 = () => {
|
694
699
|
if (strapi.ee.features.isEnabled("cms-content-history")) {
|
695
700
|
return {
|
696
701
|
register({ strapi: strapi2 }) {
|
@@ -713,7 +718,7 @@ const getFeature = () => {
|
|
713
718
|
}
|
714
719
|
};
|
715
720
|
};
|
716
|
-
const history = getFeature();
|
721
|
+
const history = getFeature$1();
|
717
722
|
const register = async ({ strapi: strapi2 }) => {
|
718
723
|
await history.register?.({ strapi: strapi2 });
|
719
724
|
};
|
@@ -721,6 +726,18 @@ const ALLOWED_WEBHOOK_EVENTS = {
|
|
721
726
|
ENTRY_PUBLISH: "entry.publish",
|
722
727
|
ENTRY_UNPUBLISH: "entry.unpublish"
|
723
728
|
};
|
729
|
+
const FEATURE_ID = "preview";
|
730
|
+
const getFeature = () => {
|
731
|
+
if (!strapi.features.future.isEnabled(FEATURE_ID)) {
|
732
|
+
return {};
|
733
|
+
}
|
734
|
+
return {
|
735
|
+
bootstrap() {
|
736
|
+
console.log("Bootstrapping preview server");
|
737
|
+
}
|
738
|
+
};
|
739
|
+
};
|
740
|
+
const preview = getFeature();
|
724
741
|
const bootstrap = async () => {
|
725
742
|
Object.entries(ALLOWED_WEBHOOK_EVENTS).forEach(([key, value]) => {
|
726
743
|
strapi.get("webhookStore").addAllowedEvent(key, value);
|
@@ -730,6 +747,7 @@ const bootstrap = async () => {
|
|
730
747
|
await getService$1("content-types").syncConfigurations();
|
731
748
|
await getService$1("permission").registerPermissions();
|
732
749
|
await history.bootstrap?.({ strapi });
|
750
|
+
await preview.bootstrap?.({ strapi });
|
733
751
|
};
|
734
752
|
const destroy = async ({ strapi: strapi2 }) => {
|
735
753
|
await history.destroy?.({ strapi: strapi2 });
|
@@ -1715,7 +1733,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1715
1733
|
throw new strapiUtils.errors.ForbiddenError();
|
1716
1734
|
}
|
1717
1735
|
const pickPermittedFields = documentVersion ? permissionChecker2.sanitizeUpdateInput(documentVersion) : permissionChecker2.sanitizeCreateInput;
|
1718
|
-
const setCreator = strapiUtils.setCreatorFields({ user, isEdition: true });
|
1736
|
+
const setCreator = documentVersion ? strapiUtils.setCreatorFields({ user, isEdition: true }) : strapiUtils.setCreatorFields({ user });
|
1719
1737
|
const sanitizeFn = strapiUtils.async.pipe(pickPermittedFields, setCreator);
|
1720
1738
|
const sanitizedBody = await sanitizeFn(body);
|
1721
1739
|
return documentManager2.update(documentVersion?.documentId || id, model, {
|
@@ -1924,11 +1942,17 @@ const collectionTypes = {
|
|
1924
1942
|
}
|
1925
1943
|
const isUpdate = !isCreate;
|
1926
1944
|
if (isUpdate) {
|
1927
|
-
|
1928
|
-
if (!
|
1945
|
+
const documentExists = documentManager2.exists(model, id);
|
1946
|
+
if (!documentExists) {
|
1929
1947
|
throw new strapiUtils.errors.NotFoundError("Document not found");
|
1930
1948
|
}
|
1931
|
-
|
1949
|
+
document = await documentManager2.findOne(id, model, { populate, locale });
|
1950
|
+
if (!document) {
|
1951
|
+
if (permissionChecker2.cannot.create({ locale }) || permissionChecker2.cannot.publish({ locale })) {
|
1952
|
+
throw new strapiUtils.errors.ForbiddenError();
|
1953
|
+
}
|
1954
|
+
document = await updateDocument(ctx);
|
1955
|
+
} else if (permissionChecker2.can.update(document)) {
|
1932
1956
|
await updateDocument(ctx);
|
1933
1957
|
}
|
1934
1958
|
}
|
@@ -2382,11 +2406,8 @@ const validateLocale = (sourceUid, targetUid, locale) => {
|
|
2382
2406
|
const isLocalized = strapi.plugin("i18n").service("content-types").isLocalizedContentType;
|
2383
2407
|
const isSourceLocalized = isLocalized(sourceModel);
|
2384
2408
|
const isTargetLocalized = isLocalized(targetModel);
|
2385
|
-
let validatedLocale = locale;
|
2386
|
-
if (!targetModel || !isTargetLocalized)
|
2387
|
-
validatedLocale = void 0;
|
2388
2409
|
return {
|
2389
|
-
locale
|
2410
|
+
locale,
|
2390
2411
|
isSourceLocalized,
|
2391
2412
|
isTargetLocalized
|
2392
2413
|
};
|
@@ -2489,7 +2510,7 @@ const relations = {
|
|
2489
2510
|
attribute,
|
2490
2511
|
fieldsToSelect,
|
2491
2512
|
mainField,
|
2492
|
-
source: { schema: sourceSchema },
|
2513
|
+
source: { schema: sourceSchema, isLocalized: isSourceLocalized },
|
2493
2514
|
target: { schema: targetSchema, isLocalized: isTargetLocalized },
|
2494
2515
|
sourceSchema,
|
2495
2516
|
targetSchema,
|
@@ -2511,7 +2532,8 @@ const relations = {
|
|
2511
2532
|
fieldsToSelect,
|
2512
2533
|
mainField,
|
2513
2534
|
source: {
|
2514
|
-
schema: { uid: sourceUid, modelType: sourceModelType }
|
2535
|
+
schema: { uid: sourceUid, modelType: sourceModelType },
|
2536
|
+
isLocalized: isSourceLocalized
|
2515
2537
|
},
|
2516
2538
|
target: {
|
2517
2539
|
schema: { uid: targetUid },
|
@@ -2549,12 +2571,16 @@ const relations = {
|
|
2549
2571
|
} else {
|
2550
2572
|
where.id = id;
|
2551
2573
|
}
|
2552
|
-
|
2553
|
-
|
2574
|
+
const publishedAt = getPublishedAtClause(status, targetUid);
|
2575
|
+
if (!fp.isEmpty(publishedAt)) {
|
2576
|
+
where[`${alias}.published_at`] = publishedAt;
|
2554
2577
|
}
|
2555
|
-
if (
|
2578
|
+
if (isTargetLocalized && locale) {
|
2556
2579
|
where[`${alias}.locale`] = locale;
|
2557
2580
|
}
|
2581
|
+
if (isSourceLocalized && locale) {
|
2582
|
+
where.locale = locale;
|
2583
|
+
}
|
2558
2584
|
if ((idsToInclude?.length ?? 0) !== 0) {
|
2559
2585
|
where[`${alias}.id`].$notIn = idsToInclude;
|
2560
2586
|
}
|
@@ -2572,7 +2598,8 @@ const relations = {
|
|
2572
2598
|
id: { $notIn: fp.uniq(idsToOmit) }
|
2573
2599
|
});
|
2574
2600
|
}
|
2575
|
-
const
|
2601
|
+
const dbQuery = strapi.get("query-params").transform(targetUid, queryParams);
|
2602
|
+
const res = await strapi.db.query(targetUid).findPage(dbQuery);
|
2576
2603
|
ctx.body = {
|
2577
2604
|
...res,
|
2578
2605
|
results: await addStatusToRelations(targetUid, res.results)
|
@@ -2694,7 +2721,7 @@ const singleTypes = {
|
|
2694
2721
|
permissionChecker2,
|
2695
2722
|
model,
|
2696
2723
|
// @ts-expect-error - fix types
|
2697
|
-
{
|
2724
|
+
{ documentId: document.documentId, locale, publishedAt: null },
|
2698
2725
|
{ availableLocales: true, availableStatus: false }
|
2699
2726
|
);
|
2700
2727
|
ctx.body = { data: {}, meta };
|