@strapi/content-manager 0.0.0-experimental.59ce88771272039a9d868fba2f7b503edf715c6a → 0.0.0-experimental.5e04dee5c96cd68273df3b3cadf4635e19dc2afc
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-gdUj_t-O.mjs → ComponentConfigurationPage-B3yDbeU1.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-gdUj_t-O.mjs.map → ComponentConfigurationPage-B3yDbeU1.mjs.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js → ComponentConfigurationPage-KXSuLnQD.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-WRPUXGd6.js.map → ComponentConfigurationPage-KXSuLnQD.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js → EditConfigurationPage-BQ17--5R.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-C1vjMBgy.js.map → EditConfigurationPage-BQ17--5R.js.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs → EditConfigurationPage-D7PrLO8j.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-BwuIPOJG.mjs.map → EditConfigurationPage-D7PrLO8j.mjs.map} +1 -1
- package/dist/_chunks/{EditViewPage-0MiFkXa8.mjs → EditViewPage-B7VgwJaG.mjs} +18 -7
- package/dist/_chunks/EditViewPage-B7VgwJaG.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-DbcGfyqK.js → EditViewPage-BgjdnGz2.js} +18 -7
- package/dist/_chunks/EditViewPage-BgjdnGz2.js.map +1 -0
- package/dist/_chunks/{Field-BG1xu38N.js → Field-CdK7ZLmv.js} +434 -83
- package/dist/_chunks/Field-CdK7ZLmv.js.map +1 -0
- package/dist/_chunks/{Field-BDMSCcy5.mjs → Field-tHCw4lGA.mjs} +435 -84
- package/dist/_chunks/Field-tHCw4lGA.mjs.map +1 -0
- package/dist/_chunks/{Form-CPVWavB8.mjs → Form-BJxdTv3Q.mjs} +26 -12
- package/dist/_chunks/Form-BJxdTv3Q.mjs.map +1 -0
- package/dist/_chunks/{Form-9BnFyUjy.js → Form-C_0KTVvV.js} +26 -12
- package/dist/_chunks/Form-C_0KTVvV.js.map +1 -0
- package/dist/_chunks/{History-BVpd8LP3.mjs → History-DR2txJLE.mjs} +44 -19
- package/dist/_chunks/History-DR2txJLE.mjs.map +1 -0
- package/dist/_chunks/{History-BWWxLt2Z.js → History-nuEzM5qm.js} +44 -19
- package/dist/_chunks/History-nuEzM5qm.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-6swzjdAZ.js → ListConfigurationPage-CnB86Psm.js} +20 -8
- package/dist/_chunks/ListConfigurationPage-CnB86Psm.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DozVMKcR.mjs → ListConfigurationPage-voFVtXu6.mjs} +20 -8
- package/dist/_chunks/ListConfigurationPage-voFVtXu6.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-Ds0ulgfG.mjs → ListViewPage-B_GaWgRH.mjs} +22 -8
- package/dist/_chunks/ListViewPage-B_GaWgRH.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-BlzfjS2Q.js → ListViewPage-SXIXm-RM.js} +21 -7
- package/dist/_chunks/ListViewPage-SXIXm-RM.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js → NoContentTypePage-BzsQ3hLZ.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-D2nCCWEl.js.map → NoContentTypePage-BzsQ3hLZ.js.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs → NoContentTypePage-CYiGpsbj.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-BH11kaKt.mjs.map → NoContentTypePage-CYiGpsbj.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs → NoPermissionsPage-B5baIHal.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-BT2Tn0D_.mjs.map → NoPermissionsPage-B5baIHal.mjs.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js → NoPermissionsPage-IGkId4C5.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-DN_JlsU2.js.map → NoPermissionsPage-IGkId4C5.js.map} +1 -1
- package/dist/_chunks/{Relations-Dnag3fhV.mjs → Relations-CIYDdKU-.mjs} +4 -4
- package/dist/_chunks/Relations-CIYDdKU-.mjs.map +1 -0
- package/dist/_chunks/{Relations-CcgFTcWo.js → Relations-Dhuurpx2.js} +4 -4
- package/dist/_chunks/Relations-Dhuurpx2.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-JNNNKUHs.mjs → index-C9TJPyni.mjs} +351 -151
- package/dist/_chunks/index-C9TJPyni.mjs.map +1 -0
- package/dist/_chunks/{index-CWpLBSt0.js → index-CdT0kHZ8.js} +336 -136
- package/dist/_chunks/index-CdT0kHZ8.js.map +1 -0
- package/dist/_chunks/{layout-DC503LnF.mjs → layout-BNqvLR_b.mjs} +25 -13
- package/dist/_chunks/layout-BNqvLR_b.mjs.map +1 -0
- package/dist/_chunks/{layout--iHdZzRk.js → layout-C6dxWYT7.js} +23 -11
- package/dist/_chunks/layout-C6dxWYT7.js.map +1 -0
- package/dist/_chunks/{relations-CTje5t-a.mjs → relations-CkKqKw65.mjs} +2 -2
- package/dist/_chunks/{relations-CTje5t-a.mjs.map → relations-CkKqKw65.mjs.map} +1 -1
- package/dist/_chunks/{relations-BbHizA5K.js → relations-DtFaDnP1.js} +2 -2
- package/dist/_chunks/{relations-BbHizA5K.js.map → relations-DtFaDnP1.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- 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/BlocksInput/utils/constants.d.ts +4 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +10 -22
- package/dist/server/index.js +137 -90
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +138 -91
- 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/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +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/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/_chunks/EditViewPage-0MiFkXa8.mjs.map +0 -1
- package/dist/_chunks/EditViewPage-DbcGfyqK.js.map +0 -1
- package/dist/_chunks/Field-BDMSCcy5.mjs.map +0 -1
- package/dist/_chunks/Field-BG1xu38N.js.map +0 -1
- package/dist/_chunks/Form-9BnFyUjy.js.map +0 -1
- package/dist/_chunks/Form-CPVWavB8.mjs.map +0 -1
- package/dist/_chunks/History-BVpd8LP3.mjs.map +0 -1
- package/dist/_chunks/History-BWWxLt2Z.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-6swzjdAZ.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DozVMKcR.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-BlzfjS2Q.js.map +0 -1
- package/dist/_chunks/ListViewPage-Ds0ulgfG.mjs.map +0 -1
- package/dist/_chunks/Relations-CcgFTcWo.js.map +0 -1
- package/dist/_chunks/Relations-Dnag3fhV.mjs.map +0 -1
- package/dist/_chunks/index-CWpLBSt0.js.map +0 -1
- package/dist/_chunks/index-JNNNKUHs.mjs.map +0 -1
- package/dist/_chunks/layout--iHdZzRk.js.map +0 -1
- package/dist/_chunks/layout-DC503LnF.mjs.map +0 -1
@@ -7,8 +7,8 @@ interface EditorLayoutProps {
|
|
7
7
|
onCollapse: () => void;
|
8
8
|
}
|
9
9
|
declare const EditorLayout: ({ children, isExpandMode, error, previewContent, onCollapse, }: EditorLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
10
|
-
declare const ExpandButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<Omit<import("@strapi/design-system").
|
10
|
+
declare const ExpandButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<Omit<import("@strapi/design-system").ButtonProps<React.ElementType<any, keyof React.JSX.IntrinsicElements>>, "ref"> & React.RefAttributes<unknown>, "ref"> & {
|
11
11
|
ref?: ((instance: unknown) => void) | React.RefObject<unknown> | null | undefined;
|
12
|
-
}, never>> & Omit<(<C extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "button">(props: React.PropsWithoutRef<import("@strapi/design-system").
|
12
|
+
}, never>> & Omit<(<C extends React.ElementType<any, keyof React.JSX.IntrinsicElements> = "button">(props: React.PropsWithoutRef<import("@strapi/design-system").ButtonProps<C>> & React.RefAttributes<unknown>) => React.ReactNode), keyof React.Component<any, {}, any>>;
|
13
13
|
export { EditorLayout, ExpandButton };
|
14
14
|
export type { EditorLayoutProps };
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { ButtonProps } from '@strapi/design-system';
|
2
2
|
interface WysiwygFooterProps {
|
3
|
-
onToggleExpand:
|
3
|
+
onToggleExpand: ButtonProps['onClick'];
|
4
4
|
}
|
5
5
|
declare const WysiwygFooter: ({ onToggleExpand }: WysiwygFooterProps) => import("react/jsx-runtime").JSX.Element;
|
6
6
|
export { WysiwygFooter };
|
@@ -4,41 +4,32 @@ export declare const CustomIconButton: import("styled-components").IStyledCompon
|
|
4
4
|
children?: import("react").ReactNode;
|
5
5
|
} & import("@strapi/design-system/dist/types").AsProp<"button"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
|
6
6
|
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
7
|
-
} & import("@strapi/design-system").TransientFlexProps & {
|
8
|
-
disabled?: boolean | undefined;
|
9
|
-
} & {
|
7
|
+
} & import("@strapi/design-system").TransientFlexProps & Pick<import("@strapi/design-system").ButtonProps, "size" | "variant"> & {
|
10
8
|
children: import("react").ReactNode;
|
9
|
+
disabled?: boolean | undefined;
|
11
10
|
label: string;
|
12
11
|
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
13
|
-
size?: "S" | "M" | "L" | undefined;
|
14
|
-
variant?: "secondary" | "tertiary" | undefined;
|
15
12
|
withTooltip?: boolean | undefined;
|
16
13
|
}, never>> & Omit<IconButtonComponent, keyof import("react").Component<any, {}, any>>;
|
17
14
|
export declare const CustomLinkIconButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("styled-components/dist/types").FastOmit<import("@strapi/design-system").TransientBoxProps & {
|
18
15
|
children?: import("react").ReactNode;
|
19
16
|
} & import("@strapi/design-system/dist/types").AsProp<"button"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
|
20
17
|
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
21
|
-
} & import("@strapi/design-system").TransientFlexProps & {
|
22
|
-
disabled?: boolean | undefined;
|
23
|
-
} & {
|
18
|
+
} & import("@strapi/design-system").TransientFlexProps & Pick<import("@strapi/design-system").ButtonProps, "size" | "variant"> & {
|
24
19
|
children: import("react").ReactNode;
|
20
|
+
disabled?: boolean | undefined;
|
25
21
|
label: string;
|
26
22
|
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
27
|
-
size?: "S" | "M" | "L" | undefined;
|
28
|
-
variant?: "secondary" | "tertiary" | undefined;
|
29
23
|
withTooltip?: boolean | undefined;
|
30
24
|
}, never>, never>> & Omit<import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("@strapi/design-system").TransientBoxProps & {
|
31
25
|
children?: import("react").ReactNode;
|
32
26
|
} & import("@strapi/design-system/dist/types").AsProp<"button"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
|
33
27
|
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
34
|
-
} & import("@strapi/design-system").TransientFlexProps & {
|
35
|
-
disabled?: boolean | undefined;
|
36
|
-
} & {
|
28
|
+
} & import("@strapi/design-system").TransientFlexProps & Pick<import("@strapi/design-system").ButtonProps, "size" | "variant"> & {
|
37
29
|
children: import("react").ReactNode;
|
30
|
+
disabled?: boolean | undefined;
|
38
31
|
label: string;
|
39
32
|
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
40
|
-
size?: "S" | "M" | "L" | undefined;
|
41
|
-
variant?: "secondary" | "tertiary" | undefined;
|
42
33
|
withTooltip?: boolean | undefined;
|
43
34
|
}, never>> & Omit<IconButtonComponent, keyof import("react").Component<any, {}, any>>, keyof import("react").Component<any, {}, any>>;
|
44
35
|
export declare const MainButtons: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> | (import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> & Omit<any, keyof import("react").Component<any, {}, any>>);
|
@@ -46,17 +37,14 @@ export declare const MoreButton: import("styled-components").IStyledComponent<"w
|
|
46
37
|
children?: import("react").ReactNode;
|
47
38
|
} & import("@strapi/design-system/dist/types").AsProp<"button"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children" | keyof import("@strapi/design-system/dist/types").AsProp<C> | keyof import("@strapi/design-system").TransientBoxProps> & {
|
48
39
|
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
49
|
-
} & import("@strapi/design-system").TransientFlexProps & {
|
50
|
-
disabled?: boolean | undefined;
|
51
|
-
} & {
|
40
|
+
} & import("@strapi/design-system").TransientFlexProps & Pick<import("@strapi/design-system").ButtonProps, "size" | "variant"> & {
|
52
41
|
children: import("react").ReactNode;
|
42
|
+
disabled?: boolean | undefined;
|
53
43
|
label: string;
|
54
44
|
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
55
|
-
size?: "S" | "M" | "L" | undefined;
|
56
|
-
variant?: "secondary" | "tertiary" | undefined;
|
57
45
|
withTooltip?: boolean | undefined;
|
58
46
|
}, never>> & Omit<IconButtonComponent, keyof import("react").Component<any, {}, any>>;
|
59
47
|
export declare const IconButtonGroupMargin: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> | (import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<any, never>> & Omit<any, keyof import("react").Component<any, {}, any>>);
|
60
|
-
export declare const ExpandButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<Omit<import("@strapi/design-system").
|
48
|
+
export declare const ExpandButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<Omit<Omit<import("@strapi/design-system").ButtonProps<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>>, "ref"> & import("react").RefAttributes<unknown>, "ref"> & {
|
61
49
|
ref?: ((instance: unknown) => void) | import("react").RefObject<unknown> | null | undefined;
|
62
|
-
}, never>> & Omit<(<C extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">(props: import("react").PropsWithoutRef<import("@strapi/design-system").
|
50
|
+
}, never>> & Omit<(<C extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">(props: import("react").PropsWithoutRef<import("@strapi/design-system").ButtonProps<C>> & import("react").RefAttributes<unknown>) => import("react").ReactNode), keyof import("react").Component<any, {}, any>>;
|
package/dist/server/index.js
CHANGED
@@ -226,20 +226,25 @@ const createServiceUtils = ({ strapi: strapi2 }) => {
|
|
226
226
|
const meta = await documentMetadataService.getMetadata(contentTypeUid, document);
|
227
227
|
return documentMetadataService.getStatus(document, meta.availableStatus);
|
228
228
|
};
|
229
|
-
const getDeepPopulate2 = (uid2) => {
|
229
|
+
const getDeepPopulate2 = (uid2, useDatabaseSyntax = false) => {
|
230
230
|
const model = strapi2.getModel(uid2);
|
231
231
|
const attributes = Object.entries(model.attributes);
|
232
|
+
const fieldSelector = useDatabaseSyntax ? "select" : "fields";
|
232
233
|
return attributes.reduce((acc, [attributeName, attribute]) => {
|
233
234
|
switch (attribute.type) {
|
234
235
|
case "relation": {
|
236
|
+
const isMorphRelation = attribute.relation.toLowerCase().startsWith("morph");
|
237
|
+
if (isMorphRelation) {
|
238
|
+
break;
|
239
|
+
}
|
235
240
|
const isVisible2 = strapiUtils.contentTypes.isVisibleAttribute(model, attributeName);
|
236
241
|
if (isVisible2) {
|
237
|
-
acc[attributeName] = {
|
242
|
+
acc[attributeName] = { [fieldSelector]: ["documentId", "locale", "publishedAt"] };
|
238
243
|
}
|
239
244
|
break;
|
240
245
|
}
|
241
246
|
case "media": {
|
242
|
-
acc[attributeName] = {
|
247
|
+
acc[attributeName] = { [fieldSelector]: ["id"] };
|
243
248
|
break;
|
244
249
|
}
|
245
250
|
case "component": {
|
@@ -490,13 +495,47 @@ const createHistoryService = ({ strapi: strapi2 }) => {
|
|
490
495
|
}
|
491
496
|
};
|
492
497
|
};
|
498
|
+
const shouldCreateHistoryVersion = (context) => {
|
499
|
+
if (!strapi.requestContext.get()?.request.url.startsWith("/content-manager")) {
|
500
|
+
return false;
|
501
|
+
}
|
502
|
+
if (context.action !== "create" && context.action !== "update" && context.action !== "clone" && context.action !== "publish" && context.action !== "unpublish" && context.action !== "discardDraft") {
|
503
|
+
return false;
|
504
|
+
}
|
505
|
+
if (context.action === "update" && strapi.requestContext.get()?.request.url.endsWith("/actions/publish")) {
|
506
|
+
return false;
|
507
|
+
}
|
508
|
+
if (!context.contentType.uid.startsWith("api::")) {
|
509
|
+
return false;
|
510
|
+
}
|
511
|
+
return true;
|
512
|
+
};
|
513
|
+
const getSchemas = (uid2) => {
|
514
|
+
const attributesSchema = strapi.getModel(uid2).attributes;
|
515
|
+
const componentsSchemas = Object.keys(attributesSchema).reduce(
|
516
|
+
(currentComponentSchemas, key) => {
|
517
|
+
const fieldSchema = attributesSchema[key];
|
518
|
+
if (fieldSchema.type === "component") {
|
519
|
+
const componentSchema = strapi.getModel(fieldSchema.component).attributes;
|
520
|
+
return {
|
521
|
+
...currentComponentSchemas,
|
522
|
+
[fieldSchema.component]: componentSchema
|
523
|
+
};
|
524
|
+
}
|
525
|
+
return currentComponentSchemas;
|
526
|
+
},
|
527
|
+
{}
|
528
|
+
);
|
529
|
+
return {
|
530
|
+
schema: fp.omit(FIELDS_TO_IGNORE, attributesSchema),
|
531
|
+
componentsSchemas
|
532
|
+
};
|
533
|
+
};
|
493
534
|
const createLifecyclesService = ({ strapi: strapi2 }) => {
|
494
535
|
const state = {
|
495
536
|
deleteExpiredJob: null,
|
496
537
|
isInitialized: false
|
497
538
|
};
|
498
|
-
const query = strapi2.db.query(HISTORY_VERSION_UID);
|
499
|
-
const historyService = getService(strapi2, "history");
|
500
539
|
const serviceUtils = createServiceUtils({ strapi: strapi2 });
|
501
540
|
return {
|
502
541
|
async bootstrap() {
|
@@ -504,63 +543,43 @@ const createLifecyclesService = ({ strapi: strapi2 }) => {
|
|
504
543
|
return;
|
505
544
|
}
|
506
545
|
strapi2.documents.use(async (context, next) => {
|
507
|
-
if (!strapi2.requestContext.get()?.request.url.startsWith("/content-manager")) {
|
508
|
-
return next();
|
509
|
-
}
|
510
|
-
if (context.action !== "create" && context.action !== "update" && context.action !== "clone" && context.action !== "publish" && context.action !== "unpublish" && context.action !== "discardDraft") {
|
511
|
-
return next();
|
512
|
-
}
|
513
|
-
if (context.action === "update" && strapi2.requestContext.get()?.request.url.endsWith("/actions/publish")) {
|
514
|
-
return next();
|
515
|
-
}
|
516
|
-
const contentTypeUid = context.contentType.uid;
|
517
|
-
if (!contentTypeUid.startsWith("api::")) {
|
518
|
-
return next();
|
519
|
-
}
|
520
546
|
const result = await next();
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
547
|
+
if (!shouldCreateHistoryVersion(context)) {
|
548
|
+
return result;
|
549
|
+
}
|
550
|
+
const documentId = context.action === "create" || context.action === "clone" ? result.documentId : context.params.documentId;
|
525
551
|
const defaultLocale = await serviceUtils.getDefaultLocale();
|
526
|
-
const
|
527
|
-
if (
|
528
|
-
|
529
|
-
"[Content manager history middleware]: An array of locales was provided, but only a single locale is supported for the findOne operation."
|
530
|
-
);
|
531
|
-
return next();
|
552
|
+
const locales = fp.castArray(context.params?.locale || defaultLocale);
|
553
|
+
if (!locales.length) {
|
554
|
+
return result;
|
532
555
|
}
|
533
|
-
const
|
534
|
-
|
535
|
-
|
536
|
-
|
556
|
+
const uid2 = context.contentType.uid;
|
557
|
+
const schemas = getSchemas(uid2);
|
558
|
+
const localeEntries = await strapi2.db.query(uid2).findMany({
|
559
|
+
where: {
|
560
|
+
documentId,
|
561
|
+
locale: { $in: locales },
|
562
|
+
publishedAt: null
|
563
|
+
},
|
564
|
+
populate: serviceUtils.getDeepPopulate(
|
565
|
+
uid2,
|
566
|
+
true
|
567
|
+
/* use database syntax */
|
568
|
+
)
|
537
569
|
});
|
538
|
-
const status = await serviceUtils.getVersionStatus(contentTypeUid, document);
|
539
|
-
const attributesSchema = strapi2.getModel(contentTypeUid).attributes;
|
540
|
-
const componentsSchemas = Object.keys(
|
541
|
-
attributesSchema
|
542
|
-
).reduce((currentComponentSchemas, key) => {
|
543
|
-
const fieldSchema = attributesSchema[key];
|
544
|
-
if (fieldSchema.type === "component") {
|
545
|
-
const componentSchema = strapi2.getModel(fieldSchema.component).attributes;
|
546
|
-
return {
|
547
|
-
...currentComponentSchemas,
|
548
|
-
[fieldSchema.component]: componentSchema
|
549
|
-
};
|
550
|
-
}
|
551
|
-
return currentComponentSchemas;
|
552
|
-
}, {});
|
553
570
|
await strapi2.db.transaction(async ({ onCommit }) => {
|
554
|
-
onCommit(() => {
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
571
|
+
onCommit(async () => {
|
572
|
+
for (const entry of localeEntries) {
|
573
|
+
const status = await serviceUtils.getVersionStatus(uid2, entry);
|
574
|
+
await getService(strapi2, "history").createVersion({
|
575
|
+
contentType: uid2,
|
576
|
+
data: fp.omit(FIELDS_TO_IGNORE, entry),
|
577
|
+
relatedDocumentId: documentId,
|
578
|
+
locale: entry.locale,
|
579
|
+
status,
|
580
|
+
...schemas
|
581
|
+
});
|
582
|
+
}
|
564
583
|
});
|
565
584
|
});
|
566
585
|
return result;
|
@@ -568,7 +587,7 @@ const createLifecyclesService = ({ strapi: strapi2 }) => {
|
|
568
587
|
state.deleteExpiredJob = nodeSchedule.scheduleJob("0 0 * * *", () => {
|
569
588
|
const retentionDaysInMilliseconds = serviceUtils.getRetentionDays() * 24 * 60 * 60 * 1e3;
|
570
589
|
const expirationDate = new Date(Date.now() - retentionDaysInMilliseconds);
|
571
|
-
query.deleteMany({
|
590
|
+
strapi2.db.query(HISTORY_VERSION_UID).deleteMany({
|
572
591
|
where: {
|
573
592
|
created_at: {
|
574
593
|
$lt: expirationDate.toISOString()
|
@@ -1593,9 +1612,11 @@ const multipleLocaleSchema = strapiUtils.yup.lazy(
|
|
1593
1612
|
(value) => Array.isArray(value) ? strapiUtils.yup.array().of(singleLocaleSchema.required()) : singleLocaleSchema
|
1594
1613
|
);
|
1595
1614
|
const statusSchema = strapiUtils.yup.mixed().oneOf(["draft", "published"], "Invalid status");
|
1596
|
-
const getDocumentLocaleAndStatus = async (request, opts = { allowMultipleLocales: false }) => {
|
1615
|
+
const getDocumentLocaleAndStatus = async (request, model, opts = { allowMultipleLocales: false }) => {
|
1597
1616
|
const { allowMultipleLocales } = opts;
|
1598
|
-
const { locale, status, ...rest } = request || {};
|
1617
|
+
const { locale, status: providedStatus, ...rest } = request || {};
|
1618
|
+
const defaultStatus = strapiUtils.contentTypes.hasDraftAndPublish(strapi.getModel(model)) ? void 0 : "published";
|
1619
|
+
const status = providedStatus !== void 0 ? providedStatus : defaultStatus;
|
1599
1620
|
const schema = strapiUtils.yup.object().shape({
|
1600
1621
|
locale: allowMultipleLocales ? multipleLocaleSchema : singleLocaleSchema,
|
1601
1622
|
status: statusSchema
|
@@ -1643,7 +1664,7 @@ const createDocument = async (ctx, opts) => {
|
|
1643
1664
|
const setCreator = strapiUtils.setCreatorFields({ user });
|
1644
1665
|
const sanitizeFn = strapiUtils.async.pipe(pickPermittedFields, setCreator);
|
1645
1666
|
const sanitizedBody = await sanitizeFn(body);
|
1646
|
-
const { locale, status
|
1667
|
+
const { locale, status } = await getDocumentLocaleAndStatus(body, model);
|
1647
1668
|
return documentManager2.create(model, {
|
1648
1669
|
data: sanitizedBody,
|
1649
1670
|
locale,
|
@@ -1662,7 +1683,7 @@ const updateDocument = async (ctx, opts) => {
|
|
1662
1683
|
}
|
1663
1684
|
const permissionQuery = await permissionChecker2.sanitizedQuery.update(ctx.query);
|
1664
1685
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1665
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1686
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1666
1687
|
const [documentVersion, documentExists] = await Promise.all([
|
1667
1688
|
documentManager2.findOne(id, model, { populate, locale, status: "draft" }),
|
1668
1689
|
documentManager2.exists(model, id)
|
@@ -1700,7 +1721,7 @@ const collectionTypes = {
|
|
1700
1721
|
}
|
1701
1722
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(query);
|
1702
1723
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(1).countRelations({ toOne: false, toMany: true }).build();
|
1703
|
-
const { locale, status } = await getDocumentLocaleAndStatus(query);
|
1724
|
+
const { locale, status } = await getDocumentLocaleAndStatus(query, model);
|
1704
1725
|
const { results: documents, pagination } = await documentManager2.findPage(
|
1705
1726
|
{ ...permissionQuery, populate, locale, status },
|
1706
1727
|
model
|
@@ -1735,7 +1756,7 @@ const collectionTypes = {
|
|
1735
1756
|
}
|
1736
1757
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
1737
1758
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1738
|
-
const { locale, status
|
1759
|
+
const { locale, status } = await getDocumentLocaleAndStatus(ctx.query, model);
|
1739
1760
|
const version = await documentManager2.findOne(id, model, {
|
1740
1761
|
populate,
|
1741
1762
|
locale,
|
@@ -1802,7 +1823,7 @@ const collectionTypes = {
|
|
1802
1823
|
}
|
1803
1824
|
const permissionQuery = await permissionChecker2.sanitizedQuery.create(ctx.query);
|
1804
1825
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1805
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1826
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1806
1827
|
const document = await documentManager2.findOne(id, model, {
|
1807
1828
|
populate,
|
1808
1829
|
locale,
|
@@ -1847,7 +1868,7 @@ const collectionTypes = {
|
|
1847
1868
|
}
|
1848
1869
|
const permissionQuery = await permissionChecker2.sanitizedQuery.delete(ctx.query);
|
1849
1870
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1850
|
-
const { locale } = await getDocumentLocaleAndStatus(ctx.query);
|
1871
|
+
const { locale } = await getDocumentLocaleAndStatus(ctx.query, model);
|
1851
1872
|
const documentLocales = await documentManager2.findLocales(id, model, { populate, locale });
|
1852
1873
|
if (documentLocales.length === 0) {
|
1853
1874
|
return ctx.notFound();
|
@@ -1876,11 +1897,28 @@ const collectionTypes = {
|
|
1876
1897
|
const publishedDocument = await strapi.db.transaction(async () => {
|
1877
1898
|
const permissionQuery = await permissionChecker2.sanitizedQuery.publish(ctx.query);
|
1878
1899
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1879
|
-
|
1900
|
+
let document;
|
1901
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1902
|
+
const isCreate = fp.isNil(id);
|
1903
|
+
if (isCreate) {
|
1904
|
+
if (permissionChecker2.cannot.create()) {
|
1905
|
+
throw new strapiUtils.errors.ForbiddenError();
|
1906
|
+
}
|
1907
|
+
document = await createDocument(ctx, { populate });
|
1908
|
+
}
|
1909
|
+
const isUpdate = !isCreate;
|
1910
|
+
if (isUpdate) {
|
1911
|
+
document = await documentManager2.findOne(id, model, { populate, locale });
|
1912
|
+
if (!document) {
|
1913
|
+
throw new strapiUtils.errors.NotFoundError("Document not found");
|
1914
|
+
}
|
1915
|
+
if (permissionChecker2.can.update(document)) {
|
1916
|
+
await updateDocument(ctx);
|
1917
|
+
}
|
1918
|
+
}
|
1880
1919
|
if (permissionChecker2.cannot.publish(document)) {
|
1881
1920
|
throw new strapiUtils.errors.ForbiddenError();
|
1882
1921
|
}
|
1883
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1884
1922
|
const publishResult = await documentManager2.publish(document.documentId, model, {
|
1885
1923
|
locale
|
1886
1924
|
// TODO: Allow setting creator fields on publish
|
@@ -1907,7 +1945,9 @@ const collectionTypes = {
|
|
1907
1945
|
}
|
1908
1946
|
const permissionQuery = await permissionChecker2.sanitizedQuery.publish(ctx.query);
|
1909
1947
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).populateDeep(Infinity).countRelations().build();
|
1910
|
-
const { locale } = await getDocumentLocaleAndStatus(body, {
|
1948
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model, {
|
1949
|
+
allowMultipleLocales: true
|
1950
|
+
});
|
1911
1951
|
const entityPromises = documentIds.map(
|
1912
1952
|
(documentId) => documentManager2.findLocales(documentId, model, { populate, locale, isPublished: false })
|
1913
1953
|
);
|
@@ -1934,7 +1974,7 @@ const collectionTypes = {
|
|
1934
1974
|
if (permissionChecker2.cannot.unpublish()) {
|
1935
1975
|
return ctx.forbidden();
|
1936
1976
|
}
|
1937
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
1977
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1938
1978
|
const entityPromises = documentIds.map(
|
1939
1979
|
(documentId) => documentManager2.findLocales(documentId, model, { locale, isPublished: true })
|
1940
1980
|
);
|
@@ -1967,7 +2007,7 @@ const collectionTypes = {
|
|
1967
2007
|
}
|
1968
2008
|
const permissionQuery = await permissionChecker2.sanitizedQuery.unpublish(ctx.query);
|
1969
2009
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
1970
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2010
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
1971
2011
|
const document = await documentManager2.findOne(id, model, {
|
1972
2012
|
populate,
|
1973
2013
|
locale,
|
@@ -2004,7 +2044,7 @@ const collectionTypes = {
|
|
2004
2044
|
}
|
2005
2045
|
const permissionQuery = await permissionChecker2.sanitizedQuery.discard(ctx.query);
|
2006
2046
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2007
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2047
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2008
2048
|
const document = await documentManager2.findOne(id, model, {
|
2009
2049
|
populate,
|
2010
2050
|
locale,
|
@@ -2035,7 +2075,7 @@ const collectionTypes = {
|
|
2035
2075
|
}
|
2036
2076
|
const permissionQuery = await permissionChecker2.sanitizedQuery.delete(query);
|
2037
2077
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2038
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2078
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2039
2079
|
const documentLocales = await documentManager2.findLocales(documentIds, model, {
|
2040
2080
|
populate,
|
2041
2081
|
locale
|
@@ -2062,7 +2102,7 @@ const collectionTypes = {
|
|
2062
2102
|
}
|
2063
2103
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(ctx.query);
|
2064
2104
|
const populate = await getService$1("populate-builder")(model).populateFromQuery(permissionQuery).build();
|
2065
|
-
const { locale, status
|
2105
|
+
const { locale, status } = await getDocumentLocaleAndStatus(ctx.query, model);
|
2066
2106
|
const entity = await documentManager2.findOne(id, model, { populate, locale, status });
|
2067
2107
|
if (!entity) {
|
2068
2108
|
return ctx.notFound();
|
@@ -2085,7 +2125,7 @@ const collectionTypes = {
|
|
2085
2125
|
if (permissionChecker2.cannot.read()) {
|
2086
2126
|
return ctx.forbidden();
|
2087
2127
|
}
|
2088
|
-
const
|
2128
|
+
const documents = await documentManager2.findMany(
|
2089
2129
|
{
|
2090
2130
|
filters: {
|
2091
2131
|
documentId: ids
|
@@ -2094,7 +2134,7 @@ const collectionTypes = {
|
|
2094
2134
|
},
|
2095
2135
|
model
|
2096
2136
|
);
|
2097
|
-
if (!
|
2137
|
+
if (!documents) {
|
2098
2138
|
return ctx.notFound();
|
2099
2139
|
}
|
2100
2140
|
const number = await documentManager2.countManyEntriesDraftRelations(ids, model, locale);
|
@@ -2590,7 +2630,7 @@ const createOrUpdateDocument = async (ctx, opts) => {
|
|
2590
2630
|
throw new strapiUtils.errors.ForbiddenError();
|
2591
2631
|
}
|
2592
2632
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.update(query);
|
2593
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2633
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2594
2634
|
const [documentVersion, otherDocumentVersion] = await Promise.all([
|
2595
2635
|
findDocument(sanitizedQuery, model, { locale, status: "draft" }),
|
2596
2636
|
// Find the first document to check if it exists
|
@@ -2631,7 +2671,7 @@ const singleTypes = {
|
|
2631
2671
|
return ctx.forbidden();
|
2632
2672
|
}
|
2633
2673
|
const permissionQuery = await permissionChecker2.sanitizedQuery.read(query);
|
2634
|
-
const { locale, status } = await getDocumentLocaleAndStatus(query);
|
2674
|
+
const { locale, status } = await getDocumentLocaleAndStatus(query, model);
|
2635
2675
|
const version = await findDocument(permissionQuery, model, { locale, status });
|
2636
2676
|
if (!version) {
|
2637
2677
|
if (permissionChecker2.cannot.create()) {
|
@@ -2676,7 +2716,7 @@ const singleTypes = {
|
|
2676
2716
|
}
|
2677
2717
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.delete(query);
|
2678
2718
|
const populate = await buildPopulateFromQuery(sanitizedQuery, model);
|
2679
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2719
|
+
const { locale } = await getDocumentLocaleAndStatus(query, model);
|
2680
2720
|
const documentLocales = await documentManager2.findLocales(void 0, model, {
|
2681
2721
|
populate,
|
2682
2722
|
locale
|
@@ -2713,7 +2753,7 @@ const singleTypes = {
|
|
2713
2753
|
if (permissionChecker2.cannot.publish(document)) {
|
2714
2754
|
throw new strapiUtils.errors.ForbiddenError();
|
2715
2755
|
}
|
2716
|
-
const { locale } = await getDocumentLocaleAndStatus(document);
|
2756
|
+
const { locale } = await getDocumentLocaleAndStatus(document, model);
|
2717
2757
|
const publishResult = await documentManager2.publish(document.documentId, model, { locale });
|
2718
2758
|
return publishResult.at(0);
|
2719
2759
|
});
|
@@ -2736,7 +2776,7 @@ const singleTypes = {
|
|
2736
2776
|
return ctx.forbidden();
|
2737
2777
|
}
|
2738
2778
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.unpublish(query);
|
2739
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2779
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2740
2780
|
const document = await findDocument(sanitizedQuery, model, { locale });
|
2741
2781
|
if (!document) {
|
2742
2782
|
return ctx.notFound();
|
@@ -2768,7 +2808,7 @@ const singleTypes = {
|
|
2768
2808
|
return ctx.forbidden();
|
2769
2809
|
}
|
2770
2810
|
const sanitizedQuery = await permissionChecker2.sanitizedQuery.discard(query);
|
2771
|
-
const { locale } = await getDocumentLocaleAndStatus(body);
|
2811
|
+
const { locale } = await getDocumentLocaleAndStatus(body, model);
|
2772
2812
|
const document = await findDocument(sanitizedQuery, model, { locale, status: "published" });
|
2773
2813
|
if (!document) {
|
2774
2814
|
return ctx.notFound();
|
@@ -2788,7 +2828,7 @@ const singleTypes = {
|
|
2788
2828
|
const { query } = ctx.request;
|
2789
2829
|
const documentManager2 = getService$1("document-manager");
|
2790
2830
|
const permissionChecker2 = getService$1("permission-checker").create({ userAbility, model });
|
2791
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2831
|
+
const { locale } = await getDocumentLocaleAndStatus(query, model);
|
2792
2832
|
if (permissionChecker2.cannot.read()) {
|
2793
2833
|
return ctx.forbidden();
|
2794
2834
|
}
|
@@ -2809,7 +2849,7 @@ const uid$1 = {
|
|
2809
2849
|
async generateUID(ctx) {
|
2810
2850
|
const { contentTypeUID, field, data } = await validateGenerateUIDInput(ctx.request.body);
|
2811
2851
|
const { query = {} } = ctx.request;
|
2812
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2852
|
+
const { locale } = await getDocumentLocaleAndStatus(query, contentTypeUID);
|
2813
2853
|
await validateUIDField(contentTypeUID, field);
|
2814
2854
|
const uidService = getService$1("uid");
|
2815
2855
|
ctx.body = {
|
@@ -2821,7 +2861,7 @@ const uid$1 = {
|
|
2821
2861
|
ctx.request.body
|
2822
2862
|
);
|
2823
2863
|
const { query = {} } = ctx.request;
|
2824
|
-
const { locale } = await getDocumentLocaleAndStatus(query);
|
2864
|
+
const { locale } = await getDocumentLocaleAndStatus(query, contentTypeUID);
|
2825
2865
|
await validateUIDField(contentTypeUID, field);
|
2826
2866
|
const uidService = getService$1("uid");
|
2827
2867
|
const isAvailable = await uidService.checkUIDAvailability({
|
@@ -3746,6 +3786,10 @@ const getDeepPopulateDraftCount = (uid2) => {
|
|
3746
3786
|
const attribute = model.attributes[attributeName];
|
3747
3787
|
switch (attribute.type) {
|
3748
3788
|
case "relation": {
|
3789
|
+
const isMorphRelation = attribute.relation.toLowerCase().startsWith("morph");
|
3790
|
+
if (isMorphRelation) {
|
3791
|
+
break;
|
3792
|
+
}
|
3749
3793
|
if (isVisibleAttribute$1(model, attributeName)) {
|
3750
3794
|
populateAcc[attributeName] = {
|
3751
3795
|
count: true,
|
@@ -4123,7 +4167,13 @@ const documentMetadata = ({ strapi: strapi2 }) => ({
|
|
4123
4167
|
*/
|
4124
4168
|
async formatDocumentWithMetadata(uid2, document, opts = {}) {
|
4125
4169
|
if (!document) {
|
4126
|
-
return
|
4170
|
+
return {
|
4171
|
+
data: document,
|
4172
|
+
meta: {
|
4173
|
+
availableLocales: [],
|
4174
|
+
availableStatus: []
|
4175
|
+
}
|
4176
|
+
};
|
4127
4177
|
}
|
4128
4178
|
const hasDraftAndPublish = strapiUtils.contentTypes.hasDraftAndPublish(strapi2.getModel(uid2));
|
4129
4179
|
if (!hasDraftAndPublish) {
|
@@ -4231,10 +4281,7 @@ const documentManager = ({ strapi: strapi2 }) => {
|
|
4231
4281
|
async clone(id, body, uid2) {
|
4232
4282
|
const populate = await buildDeepPopulate(uid2);
|
4233
4283
|
const params = {
|
4234
|
-
data:
|
4235
|
-
...omitIdField(body),
|
4236
|
-
[PUBLISHED_AT_ATTRIBUTE]: null
|
4237
|
-
},
|
4284
|
+
data: omitIdField(body),
|
4238
4285
|
populate
|
4239
4286
|
};
|
4240
4287
|
return strapi2.documents(uid2).clone({ ...params, documentId: id }).then((result) => result?.entries.at(0));
|