@webiny/app-headless-cms 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.eb196ccd2f
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/ContentEntryListConfig.d.ts +7 -2
- package/admin/components/ContentEntries/Scheduler/actions/ScheduleEntryAction.js +32 -23
- package/admin/components/ContentEntries/Scheduler/actions/ScheduleEntryAction.js.map +1 -1
- package/admin/components/ContentEntries/Scheduler/actions/hooks/useGetSchedulerItem.js +5 -2
- package/admin/components/ContentEntries/Scheduler/actions/hooks/useGetSchedulerItem.js.map +1 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerGetGraphQLGateway.d.ts +11 -13
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerGetGraphQLGateway.js +15 -7
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerGetGraphQLGateway.js.map +1 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerListGraphQLGateway.js +1 -3
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerListGraphQLGateway.js.map +1 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.js +8 -2
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.js.map +1 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.d.ts +3 -3
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.js +4 -2
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.js.map +1 -1
- package/admin/components/ContentEntries/Scheduler/adapters/index.d.ts +5 -0
- package/admin/components/ContentEntries/Scheduler/adapters/index.js +7 -0
- package/admin/components/ContentEntries/Scheduler/adapters/index.js.map +1 -0
- package/admin/components/ContentEntries/Scheduler/adapters/schema/schedulerEntry.d.ts +13 -13
- package/admin/components/ContentEntries/Scheduler/adapters/schema/schedulerEntry.js +6 -2
- package/admin/components/ContentEntries/Scheduler/adapters/schema/schedulerEntry.js.map +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellActions.js +3 -3
- package/admin/components/ContentEntries/Table/Cells/CellActions.js.map +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellAuthor.js +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellAuthor.js.map +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellCreated.js +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellCreated.js.map +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellModified.js +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellModified.js.map +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellName.d.ts +4 -4
- package/admin/components/ContentEntries/Table/Cells/CellName.js +2 -2
- package/admin/components/ContentEntries/Table/Cells/CellName.js.map +1 -1
- package/admin/components/ContentEntries/Table/Cells/CellStatus.js +4 -3
- package/admin/components/ContentEntries/Table/Cells/CellStatus.js.map +1 -1
- package/admin/components/ContentEntries/Table/index.js +6 -3
- package/admin/components/ContentEntries/Table/index.js.map +1 -1
- package/admin/config/contentEntries/list/Browser/AdvancedSearch/FieldRenderer.d.ts +2 -2
- package/admin/config/contentEntries/list/Browser/AdvancedSearch/FieldRenderer.js +1 -2
- package/admin/config/contentEntries/list/Browser/AdvancedSearch/FieldRenderer.js.map +1 -1
- package/admin/config/contentEntries/list/Browser/EntryAction.d.ts +2 -2
- package/admin/config/contentEntries/list/Browser/EntryAction.js +1 -2
- package/admin/config/contentEntries/list/Browser/EntryAction.js.map +1 -1
- package/admin/config/contentEntries/list/Browser/FolderAction.d.ts +2 -2
- package/admin/config/contentEntries/list/Browser/FolderAction.js +1 -2
- package/admin/config/contentEntries/list/Browser/FolderAction.js.map +1 -1
- package/admin/config/contentEntries/list/Browser/Table/Column.d.ts +9 -4
- package/admin/config/contentEntries/list/Browser/Table/Column.js +5 -3
- package/admin/config/contentEntries/list/Browser/Table/Column.js.map +1 -1
- package/admin/config/contentEntries/list/Browser/Table/index.d.ts +7 -2
- package/admin/config/contentEntries/list/Browser/index.d.ts +7 -2
- package/admin/config/contentEntries/list/ContentEntryListConfig.d.ts +7 -2
- package/admin/hooks/useEntry.d.ts +3 -3
- package/admin/hooks/useEntry.js.map +1 -1
- package/admin/hooks/useModelFieldGraphqlContext.d.ts +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/index.d.ts +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/index.js +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/index.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/FieldSettings.d.ts +1 -1
- package/admin/plugins/index.d.ts +3 -3
- package/admin/views/contentEntries/ContentEntry/SingletonContentEntry.js +3 -3
- package/admin/views/contentEntries/ContentEntry/SingletonContentEntry.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/useMockRecords.d.ts +1 -1
- package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +6 -5
- package/admin/views/contentEntries/hooks/useContentEntriesList.js +5 -12
- package/admin/views/contentEntries/hooks/useContentEntriesList.js.map +1 -1
- package/admin/views/contentEntries/hooks/useMoveContentEntryToFolder.d.ts +2 -2
- package/admin/views/contentEntries/hooks/useMoveContentEntryToFolder.js.map +1 -1
- package/allPlugins.d.ts +4 -4
- package/package.json +30 -30
- package/types.d.ts +3 -3
- package/types.js.map +1 -1
|
@@ -119,8 +119,13 @@ export declare const ContentEntryListConfig: {
|
|
|
119
119
|
displayName: string;
|
|
120
120
|
}>) => (props: unknown) => import("react").JSX.Element;
|
|
121
121
|
} & {
|
|
122
|
-
useTableRow:
|
|
123
|
-
|
|
122
|
+
useTableRow: {
|
|
123
|
+
(): import("@webiny/app-aco").TableRowContextData<import("./types").TableItem>;
|
|
124
|
+
<TUserRow>(): import("@webiny/app-aco").TableRowContextData<import("./types").TableItem & {
|
|
125
|
+
data: TUserRow;
|
|
126
|
+
}>;
|
|
127
|
+
};
|
|
128
|
+
isFolderRow: (row: import("./types").TableItem) => row is import("@webiny/app-aco").FolderTableRow;
|
|
124
129
|
};
|
|
125
130
|
};
|
|
126
131
|
FolderAction: (({ modelIds, ...props }: import("./admin/config/contentEntries/list/Browser/FolderAction").FolderActionProps) => import("react").JSX.Element | null) & {
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import React, { useCallback, useMemo
|
|
1
|
+
import React, { useCallback, useMemo } from "react";
|
|
2
2
|
import { useContentEntry } from "../../../../views/contentEntries/hooks/index.js";
|
|
3
3
|
import { useApolloClient, usePermission } from "../../../../hooks/index.js";
|
|
4
4
|
import { ContentEntryEditorConfig } from "../../../../config/contentEntries/index.js";
|
|
5
5
|
import { ReactComponent as ScheduleIcon } from "@webiny/icons/cell_tower.svg";
|
|
6
6
|
import { useGetSchedulerItem } from "./hooks/useGetSchedulerItem.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { SchedulerCancelGraphQLGateway } from "../adapters/SchedulerCancelGraphQLGateway.js";
|
|
10
|
-
import { SchedulerPublishGraphQLGateway } from "../adapters/SchedulerPublishGraphQLGateway.js";
|
|
11
|
-
import { SchedulerUnpublishGraphQLGateway } from "../adapters/SchedulerUnpublishGraphQLGateway.js";
|
|
7
|
+
import { SchedulerCancelGraphQLGateway, SchedulerGetGraphQLGateway, SchedulerPublishGraphQLGateway, SchedulerUnpublishGraphQLGateway } from "../adapters/index.js";
|
|
8
|
+
import { ScheduleDialogAction, useScheduleDialog } from "@webiny/app-headless-cms-scheduler";
|
|
12
9
|
export const ScheduleEntryMenuItem = () => {
|
|
13
10
|
const {
|
|
14
11
|
entry,
|
|
15
12
|
loading,
|
|
16
|
-
|
|
13
|
+
contentModel
|
|
17
14
|
} = useContentEntry();
|
|
18
15
|
const {
|
|
19
16
|
canPublish,
|
|
20
17
|
canUnpublish
|
|
21
18
|
} = usePermission();
|
|
22
19
|
const client = useApolloClient();
|
|
23
|
-
const
|
|
20
|
+
const {
|
|
21
|
+
showDialog: showSchedulerDialog
|
|
22
|
+
} = useScheduleDialog();
|
|
24
23
|
const getGateway = useMemo(() => {
|
|
25
24
|
return new SchedulerGetGraphQLGateway(client);
|
|
26
25
|
}, [client]);
|
|
@@ -33,40 +32,50 @@ export const ScheduleEntryMenuItem = () => {
|
|
|
33
32
|
const unpublishGateway = useMemo(() => {
|
|
34
33
|
return new SchedulerUnpublishGraphQLGateway(client);
|
|
35
34
|
}, [client]);
|
|
35
|
+
const scheduleAction = useMemo(() => {
|
|
36
|
+
return new ScheduleDialogAction({
|
|
37
|
+
cancelGateway,
|
|
38
|
+
publishGateway,
|
|
39
|
+
unpublishGateway
|
|
40
|
+
});
|
|
41
|
+
}, [publishGateway, unpublishGateway]);
|
|
36
42
|
const scheduled = useGetSchedulerItem({
|
|
37
43
|
gateway: getGateway,
|
|
38
44
|
id: entry.id,
|
|
39
|
-
modelId:
|
|
45
|
+
modelId: contentModel.modelId
|
|
40
46
|
});
|
|
41
47
|
const {
|
|
42
48
|
OptionsMenuItem
|
|
43
49
|
} = ContentEntryEditorConfig.Actions.MenuItemAction.useOptionsMenuItem();
|
|
44
|
-
const
|
|
45
|
-
setShow(!show);
|
|
46
|
-
}, []);
|
|
47
|
-
const scheduleEntry = useMemo(() => {
|
|
50
|
+
const schedulerEntry = useMemo(() => {
|
|
48
51
|
if (scheduled.error) {
|
|
49
52
|
console.error(scheduled.error);
|
|
50
53
|
return null;
|
|
51
54
|
}
|
|
52
55
|
return scheduled.item;
|
|
53
56
|
}, [scheduled]);
|
|
57
|
+
const showDialog = useCallback(() => {
|
|
58
|
+
showSchedulerDialog({
|
|
59
|
+
entry: {
|
|
60
|
+
id: entry.id,
|
|
61
|
+
title: entry.meta.title,
|
|
62
|
+
modelId: contentModel.modelId,
|
|
63
|
+
status: entry.meta.status
|
|
64
|
+
},
|
|
65
|
+
schedulerEntry,
|
|
66
|
+
action: scheduleAction
|
|
67
|
+
});
|
|
68
|
+
}, [entry, schedulerEntry, scheduleAction, showSchedulerDialog, contentModel]);
|
|
54
69
|
if (!canPublish("cms.contentEntry") && !canUnpublish("cms.contentEntry")) {
|
|
55
70
|
return null;
|
|
56
71
|
}
|
|
72
|
+
const action = entry.meta?.status === "published" ? "unpublish" : "publish";
|
|
57
73
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(OptionsMenuItem, {
|
|
58
74
|
icon: /*#__PURE__*/React.createElement(ScheduleIcon, null),
|
|
59
|
-
label:
|
|
60
|
-
onAction:
|
|
61
|
-
disabled: !entry?.
|
|
75
|
+
label: `Schedule ${action}`,
|
|
76
|
+
onAction: showDialog,
|
|
77
|
+
disabled: !entry?.meta?.status || loading,
|
|
62
78
|
"data-testid": "cms.content-form.header.schedule"
|
|
63
|
-
}), /*#__PURE__*/React.createElement(ScheduleDialog, {
|
|
64
|
-
show: show,
|
|
65
|
-
schedulerEntry: scheduleEntry,
|
|
66
|
-
cancelGateway: cancelGateway,
|
|
67
|
-
publishGateway: publishGateway,
|
|
68
|
-
unpublishGateway: unpublishGateway,
|
|
69
|
-
entry: entry
|
|
70
79
|
}));
|
|
71
80
|
};
|
|
72
81
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useMemo","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","useContentEntry","useApolloClient","usePermission","ContentEntryEditorConfig","ReactComponent","ScheduleIcon","useGetSchedulerItem","SchedulerCancelGraphQLGateway","SchedulerGetGraphQLGateway","SchedulerPublishGraphQLGateway","SchedulerUnpublishGraphQLGateway","ScheduleDialogAction","useScheduleDialog","ScheduleEntryMenuItem","entry","loading","contentModel","canPublish","canUnpublish","client","showDialog","showSchedulerDialog","getGateway","cancelGateway","publishGateway","unpublishGateway","scheduleAction","scheduled","gateway","id","modelId","OptionsMenuItem","Actions","MenuItemAction","useOptionsMenuItem","schedulerEntry","error","console","item","title","meta","status","action","createElement","Fragment","icon","label","onAction","disabled"],"sources":["ScheduleEntryAction.tsx"],"sourcesContent":["import React, { useCallback, useMemo } from \"react\";\nimport { useContentEntry } from \"~/admin/views/contentEntries/hooks/index.js\";\nimport { useApolloClient, usePermission } from \"~/admin/hooks/index.js\";\nimport { ContentEntryEditorConfig } from \"~/admin/config/contentEntries/index.js\";\nimport { ReactComponent as ScheduleIcon } from \"@webiny/icons/cell_tower.svg\";\nimport { useGetSchedulerItem } from \"./hooks/useGetSchedulerItem.js\";\nimport {\n SchedulerCancelGraphQLGateway,\n SchedulerGetGraphQLGateway,\n SchedulerPublishGraphQLGateway,\n SchedulerUnpublishGraphQLGateway\n} from \"../adapters/index.js\";\nimport { ScheduleDialogAction, useScheduleDialog } from \"@webiny/app-headless-cms-scheduler\";\n\nexport const ScheduleEntryMenuItem = () => {\n const { entry, loading, contentModel } = useContentEntry();\n const { canPublish, canUnpublish } = usePermission();\n const client = useApolloClient();\n\n const { showDialog: showSchedulerDialog } = useScheduleDialog();\n\n const getGateway = useMemo(() => {\n return new SchedulerGetGraphQLGateway(client);\n }, [client]);\n\n const cancelGateway = useMemo(() => {\n return new SchedulerCancelGraphQLGateway(client);\n }, [client]);\n\n const publishGateway = useMemo(() => {\n return new SchedulerPublishGraphQLGateway(client);\n }, [client]);\n\n const unpublishGateway = useMemo(() => {\n return new SchedulerUnpublishGraphQLGateway(client);\n }, [client]);\n\n const scheduleAction = useMemo(() => {\n return new ScheduleDialogAction({\n cancelGateway,\n publishGateway,\n unpublishGateway\n });\n }, [publishGateway, unpublishGateway]);\n\n const scheduled = useGetSchedulerItem({\n gateway: getGateway,\n id: entry.id,\n modelId: contentModel.modelId\n });\n\n const { OptionsMenuItem } =\n ContentEntryEditorConfig.Actions.MenuItemAction.useOptionsMenuItem();\n\n const schedulerEntry = useMemo(() => {\n if (scheduled.error) {\n console.error(scheduled.error);\n return null;\n }\n return scheduled.item;\n }, [scheduled]);\n\n const showDialog = useCallback(() => {\n showSchedulerDialog({\n entry: {\n id: entry.id,\n title: entry.meta.title,\n modelId: contentModel.modelId,\n status: entry.meta.status\n },\n schedulerEntry,\n action: scheduleAction\n });\n }, [entry, schedulerEntry, scheduleAction, showSchedulerDialog, contentModel]);\n\n if (!canPublish(\"cms.contentEntry\") && !canUnpublish(\"cms.contentEntry\")) {\n return null;\n }\n\n const action = entry.meta?.status === \"published\" ? \"unpublish\" : \"publish\";\n\n return (\n <>\n <OptionsMenuItem\n icon={<ScheduleIcon />}\n label={`Schedule ${action}`}\n onAction={showDialog}\n disabled={!entry?.meta?.status || loading}\n data-testid={\"cms.content-form.header.schedule\"}\n />\n </>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,eAAe;AACxB,SAASC,eAAe,EAAEC,aAAa;AACvC,SAASC,wBAAwB;AACjC,SAASC,cAAc,IAAIC,YAAY,QAAQ,8BAA8B;AAC7E,SAASC,mBAAmB;AAC5B,SACIC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,gCAAgC;AAEpC,SAASC,oBAAoB,EAAEC,iBAAiB,QAAQ,oCAAoC;AAE5F,OAAO,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;EACvC,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;EAAa,CAAC,GAAGhB,eAAe,CAAC,CAAC;EAC1D,MAAM;IAAEiB,UAAU;IAAEC;EAAa,CAAC,GAAGhB,aAAa,CAAC,CAAC;EACpD,MAAMiB,MAAM,GAAGlB,eAAe,CAAC,CAAC;EAEhC,MAAM;IAAEmB,UAAU,EAAEC;EAAoB,CAAC,GAAGT,iBAAiB,CAAC,CAAC;EAE/D,MAAMU,UAAU,GAAGvB,OAAO,CAAC,MAAM;IAC7B,OAAO,IAAIS,0BAA0B,CAACW,MAAM,CAAC;EACjD,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,MAAMI,aAAa,GAAGxB,OAAO,CAAC,MAAM;IAChC,OAAO,IAAIQ,6BAA6B,CAACY,MAAM,CAAC;EACpD,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,MAAMK,cAAc,GAAGzB,OAAO,CAAC,MAAM;IACjC,OAAO,IAAIU,8BAA8B,CAACU,MAAM,CAAC;EACrD,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,MAAMM,gBAAgB,GAAG1B,OAAO,CAAC,MAAM;IACnC,OAAO,IAAIW,gCAAgC,CAACS,MAAM,CAAC;EACvD,CAAC,EAAE,CAACA,MAAM,CAAC,CAAC;EAEZ,MAAMO,cAAc,GAAG3B,OAAO,CAAC,MAAM;IACjC,OAAO,IAAIY,oBAAoB,CAAC;MAC5BY,aAAa;MACbC,cAAc;MACdC;IACJ,CAAC,CAAC;EACN,CAAC,EAAE,CAACD,cAAc,EAAEC,gBAAgB,CAAC,CAAC;EAEtC,MAAME,SAAS,GAAGrB,mBAAmB,CAAC;IAClCsB,OAAO,EAAEN,UAAU;IACnBO,EAAE,EAAEf,KAAK,CAACe,EAAE;IACZC,OAAO,EAAEd,YAAY,CAACc;EAC1B,CAAC,CAAC;EAEF,MAAM;IAAEC;EAAgB,CAAC,GACrB5B,wBAAwB,CAAC6B,OAAO,CAACC,cAAc,CAACC,kBAAkB,CAAC,CAAC;EAExE,MAAMC,cAAc,GAAGpC,OAAO,CAAC,MAAM;IACjC,IAAI4B,SAAS,CAACS,KAAK,EAAE;MACjBC,OAAO,CAACD,KAAK,CAACT,SAAS,CAACS,KAAK,CAAC;MAC9B,OAAO,IAAI;IACf;IACA,OAAOT,SAAS,CAACW,IAAI;EACzB,CAAC,EAAE,CAACX,SAAS,CAAC,CAAC;EAEf,MAAMP,UAAU,GAAGtB,WAAW,CAAC,MAAM;IACjCuB,mBAAmB,CAAC;MAChBP,KAAK,EAAE;QACHe,EAAE,EAAEf,KAAK,CAACe,EAAE;QACZU,KAAK,EAAEzB,KAAK,CAAC0B,IAAI,CAACD,KAAK;QACvBT,OAAO,EAAEd,YAAY,CAACc,OAAO;QAC7BW,MAAM,EAAE3B,KAAK,CAAC0B,IAAI,CAACC;MACvB,CAAC;MACDN,cAAc;MACdO,MAAM,EAAEhB;IACZ,CAAC,CAAC;EACN,CAAC,EAAE,CAACZ,KAAK,EAAEqB,cAAc,EAAET,cAAc,EAAEL,mBAAmB,EAAEL,YAAY,CAAC,CAAC;EAE9E,IAAI,CAACC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAACC,YAAY,CAAC,kBAAkB,CAAC,EAAE;IACtE,OAAO,IAAI;EACf;EAEA,MAAMwB,MAAM,GAAG5B,KAAK,CAAC0B,IAAI,EAAEC,MAAM,KAAK,WAAW,GAAG,WAAW,GAAG,SAAS;EAE3E,oBACI5C,KAAA,CAAA8C,aAAA,CAAA9C,KAAA,CAAA+C,QAAA,qBACI/C,KAAA,CAAA8C,aAAA,CAACZ,eAAe;IACZc,IAAI,eAAEhD,KAAA,CAAA8C,aAAA,CAACtC,YAAY,MAAE,CAAE;IACvByC,KAAK,EAAE,YAAYJ,MAAM,EAAG;IAC5BK,QAAQ,EAAE3B,UAAW;IACrB4B,QAAQ,EAAE,CAAClC,KAAK,EAAE0B,IAAI,EAAEC,MAAM,IAAI1B,OAAQ;IAC1C,eAAa;EAAmC,CACnD,CACH,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -13,9 +13,12 @@ export const useGetSchedulerItem = params => {
|
|
|
13
13
|
}
|
|
14
14
|
(async () => {
|
|
15
15
|
try {
|
|
16
|
-
const result = await gateway.execute(
|
|
16
|
+
const result = await gateway.execute({
|
|
17
|
+
id: params.id,
|
|
18
|
+
modelId: params.modelId
|
|
19
|
+
});
|
|
17
20
|
setState({
|
|
18
|
-
item: result
|
|
21
|
+
item: result,
|
|
19
22
|
error: null
|
|
20
23
|
});
|
|
21
24
|
} catch (ex) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","useGetSchedulerItem","params","gateway","state","setState","item","error","id","modelId","result","execute","ex"],"sources":["useGetSchedulerItem.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport type { SchedulerEntry } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport type {\n ISchedulerGetExecuteParams,\n ISchedulerGetGateway\n} from \"@webiny/app-headless-cms-scheduler\";\n\nexport interface IUseGetItemParams extends ISchedulerGetExecuteParams {\n gateway: ISchedulerGetGateway;\n}\n\ninterface IState {\n item: SchedulerEntry | null;\n error: Error | null;\n}\n\nexport const useGetSchedulerItem = (params: IUseGetItemParams) => {\n const { gateway } = params;\n const [state, setState] = useState<IState>({\n item: null,\n error: null\n });\n\n useEffect(() => {\n if (!params.id || !params.modelId) {\n return;\n }\n (async () => {\n try {\n const result = await gateway.execute(params);\n setState({\n item: result
|
|
1
|
+
{"version":3,"names":["useEffect","useState","useGetSchedulerItem","params","gateway","state","setState","item","error","id","modelId","result","execute","ex"],"sources":["useGetSchedulerItem.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport type { SchedulerEntry } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport type {\n ISchedulerGetExecuteParams,\n ISchedulerGetGateway\n} from \"@webiny/app-headless-cms-scheduler\";\n\nexport interface IUseGetItemParams extends ISchedulerGetExecuteParams {\n gateway: ISchedulerGetGateway;\n}\n\ninterface IState {\n item: SchedulerEntry | null;\n error: Error | null;\n}\n\nexport const useGetSchedulerItem = (params: IUseGetItemParams) => {\n const { gateway } = params;\n const [state, setState] = useState<IState>({\n item: null,\n error: null\n });\n\n useEffect(() => {\n if (!params.id || !params.modelId) {\n return;\n }\n (async () => {\n try {\n const result = await gateway.execute({\n id: params.id,\n modelId: params.modelId\n });\n setState({\n item: result,\n error: null\n });\n } catch (ex) {\n setState({\n error: ex,\n item: null\n });\n }\n })();\n }, [params.id, params.modelId, gateway]);\n\n return state;\n};\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAgB3C,OAAO,MAAMC,mBAAmB,GAAIC,MAAyB,IAAK;EAC9D,MAAM;IAAEC;EAAQ,CAAC,GAAGD,MAAM;EAC1B,MAAM,CAACE,KAAK,EAAEC,QAAQ,CAAC,GAAGL,QAAQ,CAAS;IACvCM,IAAI,EAAE,IAAI;IACVC,KAAK,EAAE;EACX,CAAC,CAAC;EAEFR,SAAS,CAAC,MAAM;IACZ,IAAI,CAACG,MAAM,CAACM,EAAE,IAAI,CAACN,MAAM,CAACO,OAAO,EAAE;MAC/B;IACJ;IACA,CAAC,YAAY;MACT,IAAI;QACA,MAAMC,MAAM,GAAG,MAAMP,OAAO,CAACQ,OAAO,CAAC;UACjCH,EAAE,EAAEN,MAAM,CAACM,EAAE;UACbC,OAAO,EAAEP,MAAM,CAACO;QACpB,CAAC,CAAC;QACFJ,QAAQ,CAAC;UACLC,IAAI,EAAEI,MAAM;UACZH,KAAK,EAAE;QACX,CAAC,CAAC;MACN,CAAC,CAAC,OAAOK,EAAE,EAAE;QACTP,QAAQ,CAAC;UACLE,KAAK,EAAEK,EAAE;UACTN,IAAI,EAAE;QACV,CAAC,CAAC;MACN;IACJ,CAAC,EAAE,CAAC;EACR,CAAC,EAAE,CAACJ,MAAM,CAACM,EAAE,EAAEN,MAAM,CAACO,OAAO,EAAEN,OAAO,CAAC,CAAC;EAExC,OAAOC,KAAK;AAChB,CAAC","ignoreList":[]}
|
|
@@ -4,19 +4,17 @@ export declare class SchedulerGetGraphQLGateway implements ISchedulerGetGateway
|
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: ApolloClient<any>);
|
|
6
6
|
execute(params: ISchedulerGetExecuteParams): Promise<{
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
model: Pick<import("@webiny/app-headless-cms-common/types").CmsModel, "modelId">;
|
|
8
|
+
id: string;
|
|
9
|
+
title: string;
|
|
10
|
+
type: import("@webiny/app-headless-cms-scheduler/types.js").ScheduleType;
|
|
11
|
+
targetId: string;
|
|
12
|
+
scheduledBy: {
|
|
9
13
|
id: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
targetId: string;
|
|
13
|
-
scheduledBy: {
|
|
14
|
-
type: string;
|
|
15
|
-
id: string;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
18
|
-
publishOn?: Date | undefined;
|
|
19
|
-
unpublishOn?: Date | undefined;
|
|
14
|
+
displayName: string;
|
|
15
|
+
type: string;
|
|
20
16
|
};
|
|
21
|
-
|
|
17
|
+
publishOn?: Date | undefined;
|
|
18
|
+
unpublishOn?: Date | undefined;
|
|
19
|
+
} | null>;
|
|
22
20
|
}
|
|
@@ -44,17 +44,25 @@ export class SchedulerGetGraphQLGateway {
|
|
|
44
44
|
errors
|
|
45
45
|
});
|
|
46
46
|
throw new Error("Network error while getting schedule entry.");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
} else if (result.error) {
|
|
48
|
+
console.error({
|
|
49
|
+
error: result.error
|
|
50
|
+
});
|
|
51
|
+
throw new Error(result.error.message || "Could not fetch scheduled entry.");
|
|
52
|
+
} else if (!result.data) {
|
|
53
|
+
return null;
|
|
50
54
|
}
|
|
51
55
|
const validated = await schema.safeParseAsync(result);
|
|
52
56
|
if (!validated.success) {
|
|
53
|
-
|
|
57
|
+
const err = createZodError(validated.error);
|
|
58
|
+
console.error(err);
|
|
59
|
+
console.log(JSON.stringify({
|
|
60
|
+
err,
|
|
61
|
+
ex: validated.error
|
|
62
|
+
}));
|
|
63
|
+
throw err;
|
|
54
64
|
}
|
|
55
|
-
return
|
|
56
|
-
item: validated.data.data
|
|
57
|
-
};
|
|
65
|
+
return validated.data.data;
|
|
58
66
|
}
|
|
59
67
|
}
|
|
60
68
|
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerGetGraphQLGateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["gql","zod","createZodError","schedulerEntrySchema","createSchedulerEntryFields","createSchedulerGetQuery","schema","object","data","SchedulerGetGraphQLGateway","constructor","client","execute","params","response","errors","query","variables","fetchPolicy","result","getCmsSchedule","length","console","error","Error","message","validated","safeParseAsync","success","
|
|
1
|
+
{"version":3,"names":["gql","zod","createZodError","schedulerEntrySchema","createSchedulerEntryFields","createSchedulerGetQuery","schema","object","data","SchedulerGetGraphQLGateway","constructor","client","execute","params","response","errors","query","variables","fetchPolicy","result","getCmsSchedule","length","console","error","Error","message","validated","safeParseAsync","success","err","log","JSON","stringify","ex"],"sources":["SchedulerGetGraphQLGateway.ts"],"sourcesContent":["import type { ApolloClient } from \"apollo-client\";\nimport type { CmsErrorResponse } from \"@webiny/app-headless-cms-common/types\";\nimport gql from \"graphql-tag\";\nimport zod from \"zod\";\nimport { createZodError } from \"@webiny/utils/createZodError.js\";\nimport { schedulerEntrySchema } from \"./schema/schedulerEntry.js\";\nimport type {\n ISchedulerGetExecuteParams,\n ISchedulerGetGateway\n} from \"@webiny/app-headless-cms-scheduler/index.js\";\nimport type { SchedulerEntry } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport { createSchedulerEntryFields } from \"./graphql/fields.js\";\n\nconst createSchedulerGetQuery = () => {\n return gql`\n query SchedulerGetQuery($modelId: String!, $id: ID!) {\n getCmsSchedule(modelId: $modelId, id: $id) {\n data {\n ${createSchedulerEntryFields()}\n }\n error {\n message\n code\n data\n stack\n }\n }\n }\n `;\n};\n\ninterface SchedulerGetGraphQLQueryVariables extends ISchedulerGetExecuteParams {}\n\ninterface SchedulerGetGraphQLQueryResponse {\n getCmsSchedule: {\n data: SchedulerEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nconst schema = zod.object({\n data: schedulerEntrySchema\n});\n\nexport class SchedulerGetGraphQLGateway implements ISchedulerGetGateway {\n private readonly client: ApolloClient<any>;\n\n public constructor(client: ApolloClient<any>) {\n this.client = client;\n }\n\n public async execute(params: ISchedulerGetExecuteParams) {\n const { data: response, errors } = await this.client.query<\n SchedulerGetGraphQLQueryResponse,\n SchedulerGetGraphQLQueryVariables\n >({\n query: createSchedulerGetQuery(),\n variables: {\n ...params\n },\n fetchPolicy: \"network-only\"\n });\n\n const result = response.getCmsSchedule;\n if (!result || errors?.length) {\n console.error({\n errors\n });\n throw new Error(\"Network error while getting schedule entry.\");\n } else if (result.error) {\n console.error({\n error: result.error\n });\n throw new Error(result.error.message || \"Could not fetch scheduled entry.\");\n } else if (!result.data) {\n return null;\n }\n\n const validated = await schema.safeParseAsync(result);\n if (!validated.success) {\n const err = createZodError(validated.error);\n console.error(err);\n console.log(\n JSON.stringify({\n err,\n ex: validated.error\n })\n );\n throw err;\n }\n\n return validated.data.data;\n }\n}\n"],"mappings":"AAEA,OAAOA,GAAG,MAAM,aAAa;AAC7B,OAAOC,GAAG,MAAM,KAAK;AACrB,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,oBAAoB;AAM7B,SAASC,0BAA0B;AAEnC,MAAMC,uBAAuB,GAAGA,CAAA,KAAM;EAClC,OAAOL,GAAG;AACd;AACA;AACA;AACA,sBAAsBI,0BAA0B,CAAC,CAAC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;AAWD,MAAME,MAAM,GAAGL,GAAG,CAACM,MAAM,CAAC;EACtBC,IAAI,EAAEL;AACV,CAAC,CAAC;AAEF,OAAO,MAAMM,0BAA0B,CAAiC;EAG7DC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,OAAOA,CAACC,MAAkC,EAAE;IACrD,MAAM;MAAEL,IAAI,EAAEM,QAAQ;MAAEC;IAAO,CAAC,GAAG,MAAM,IAAI,CAACJ,MAAM,CAACK,KAAK,CAGxD;MACEA,KAAK,EAAEX,uBAAuB,CAAC,CAAC;MAChCY,SAAS,EAAE;QACP,GAAGJ;MACP,CAAC;MACDK,WAAW,EAAE;IACjB,CAAC,CAAC;IAEF,MAAMC,MAAM,GAAGL,QAAQ,CAACM,cAAc;IACtC,IAAI,CAACD,MAAM,IAAIJ,MAAM,EAAEM,MAAM,EAAE;MAC3BC,OAAO,CAACC,KAAK,CAAC;QACVR;MACJ,CAAC,CAAC;MACF,MAAM,IAAIS,KAAK,CAAC,6CAA6C,CAAC;IAClE,CAAC,MAAM,IAAIL,MAAM,CAACI,KAAK,EAAE;MACrBD,OAAO,CAACC,KAAK,CAAC;QACVA,KAAK,EAAEJ,MAAM,CAACI;MAClB,CAAC,CAAC;MACF,MAAM,IAAIC,KAAK,CAACL,MAAM,CAACI,KAAK,CAACE,OAAO,IAAI,kCAAkC,CAAC;IAC/E,CAAC,MAAM,IAAI,CAACN,MAAM,CAACX,IAAI,EAAE;MACrB,OAAO,IAAI;IACf;IAEA,MAAMkB,SAAS,GAAG,MAAMpB,MAAM,CAACqB,cAAc,CAACR,MAAM,CAAC;IACrD,IAAI,CAACO,SAAS,CAACE,OAAO,EAAE;MACpB,MAAMC,GAAG,GAAG3B,cAAc,CAACwB,SAAS,CAACH,KAAK,CAAC;MAC3CD,OAAO,CAACC,KAAK,CAACM,GAAG,CAAC;MAClBP,OAAO,CAACQ,GAAG,CACPC,IAAI,CAACC,SAAS,CAAC;QACXH,GAAG;QACHI,EAAE,EAAEP,SAAS,CAACH;MAClB,CAAC,CACL,CAAC;MACD,MAAMM,GAAG;IACb;IAEA,OAAOH,SAAS,CAAClB,IAAI,CAACA,IAAI;EAC9B;AACJ","ignoreList":[]}
|
|
@@ -73,9 +73,7 @@ export class SchedulerListGraphQLGateway {
|
|
|
73
73
|
const validated = await schema.safeParseAsync(result);
|
|
74
74
|
if (!validated.success) {
|
|
75
75
|
const err = createZodError(validated.error);
|
|
76
|
-
console.
|
|
77
|
-
err
|
|
78
|
-
});
|
|
76
|
+
console.error(err);
|
|
79
77
|
throw err;
|
|
80
78
|
}
|
|
81
79
|
return {
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerListGraphQLGateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["gql","zod","createZodError","schedulerEntrySchema","createSchedulerEntryFields","createSchedulerListQuery","schema","object","data","array","meta","totalCount","number","cursor","string","nullable","hasMoreItems","boolean","SchedulerListGraphQLGateway","constructor","client","execute","params","response","errors","query","variables","fetchPolicy","result","listCmsSchedules","length","console","error","Error","message","validated","safeParseAsync","success","err","
|
|
1
|
+
{"version":3,"names":["gql","zod","createZodError","schedulerEntrySchema","createSchedulerEntryFields","createSchedulerListQuery","schema","object","data","array","meta","totalCount","number","cursor","string","nullable","hasMoreItems","boolean","SchedulerListGraphQLGateway","constructor","client","execute","params","response","errors","query","variables","fetchPolicy","result","listCmsSchedules","length","console","error","Error","message","validated","safeParseAsync","success","err","items"],"sources":["SchedulerListGraphQLGateway.ts"],"sourcesContent":["import type { ApolloClient } from \"apollo-client\";\nimport type { CmsErrorResponse, CmsMetaResponse } from \"@webiny/app-headless-cms-common/types\";\nimport gql from \"graphql-tag\";\nimport zod from \"zod\";\nimport { createZodError } from \"@webiny/utils/createZodError.js\";\nimport { schedulerEntrySchema } from \"./schema/schedulerEntry.js\";\nimport type {\n ISchedulerListExecuteParams,\n ISchedulerListGateway,\n ISchedulerListGatewayResponse\n} from \"@webiny/app-headless-cms-scheduler/index.js\";\nimport type { SchedulerEntry } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport { createSchedulerEntryFields } from \"./graphql/fields.js\";\n\nconst createSchedulerListQuery = () => {\n return gql`\n query SchedulerListQuery(\n $modelId: String!\n $where: CmsListSchedulesWhereInput\n $sort: [CmsListSchedulesSorter!]\n $limit: Int\n $after: String\n ) {\n listCmsSchedules(\n modelId: $modelId\n where: $where\n sort: $sort\n limit: $limit\n after: $after\n ) {\n data {\n ${createSchedulerEntryFields()}\n }\n meta {\n totalCount\n cursor\n hasMoreItems\n }\n error {\n message\n code\n data\n stack\n }\n }\n }\n `;\n};\n\ninterface SchedulerListGraphQLQueryVariables extends ISchedulerListExecuteParams {}\n\ninterface SchedulerListGraphQLQueryResponse {\n listCmsSchedules: {\n data: SchedulerEntry[] | null;\n meta: CmsMetaResponse | null;\n error: CmsErrorResponse | null;\n };\n}\n\nconst schema = zod.object({\n data: zod.array(schedulerEntrySchema),\n meta: zod.object({\n totalCount: zod.number(),\n cursor: zod.string().nullable(),\n hasMoreItems: zod.boolean()\n })\n});\n\nexport class SchedulerListGraphQLGateway implements ISchedulerListGateway {\n private readonly client: ApolloClient<any>;\n\n public constructor(client: ApolloClient<any>) {\n this.client = client;\n }\n\n public async execute(\n params: ISchedulerListExecuteParams\n ): Promise<ISchedulerListGatewayResponse> {\n const { data: response, errors } = await this.client.query<\n SchedulerListGraphQLQueryResponse,\n SchedulerListGraphQLQueryVariables\n >({\n query: createSchedulerListQuery(),\n variables: {\n ...params\n },\n fetchPolicy: \"network-only\"\n });\n\n const result = response.listCmsSchedules;\n if (!result || errors?.length) {\n console.error({\n errors\n });\n throw new Error(\"Network error while listing scheduled entries.\");\n }\n\n if (!result.data || !result.meta) {\n throw new Error(result.error?.message || \"Could not fetch scheduled entries.\");\n }\n\n const validated = await schema.safeParseAsync(result);\n if (!validated.success) {\n const err = createZodError(validated.error);\n console.error(err);\n throw err;\n }\n\n return {\n items: validated.data.data,\n meta: validated.data.meta\n };\n }\n}\n"],"mappings":"AAEA,OAAOA,GAAG,MAAM,aAAa;AAC7B,OAAOC,GAAG,MAAM,KAAK;AACrB,SAASC,cAAc,QAAQ,iCAAiC;AAChE,SAASC,oBAAoB;AAO7B,SAASC,0BAA0B;AAEnC,MAAMC,wBAAwB,GAAGA,CAAA,KAAM;EACnC,OAAOL,GAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsBI,0BAA0B,CAAC,CAAC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;AAYD,MAAME,MAAM,GAAGL,GAAG,CAACM,MAAM,CAAC;EACtBC,IAAI,EAAEP,GAAG,CAACQ,KAAK,CAACN,oBAAoB,CAAC;EACrCO,IAAI,EAAET,GAAG,CAACM,MAAM,CAAC;IACbI,UAAU,EAAEV,GAAG,CAACW,MAAM,CAAC,CAAC;IACxBC,MAAM,EAAEZ,GAAG,CAACa,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;IAC/BC,YAAY,EAAEf,GAAG,CAACgB,OAAO,CAAC;EAC9B,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,MAAMC,2BAA2B,CAAkC;EAG/DC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,OAAOA,CAChBC,MAAmC,EACG;IACtC,MAAM;MAAEd,IAAI,EAAEe,QAAQ;MAAEC;IAAO,CAAC,GAAG,MAAM,IAAI,CAACJ,MAAM,CAACK,KAAK,CAGxD;MACEA,KAAK,EAAEpB,wBAAwB,CAAC,CAAC;MACjCqB,SAAS,EAAE;QACP,GAAGJ;MACP,CAAC;MACDK,WAAW,EAAE;IACjB,CAAC,CAAC;IAEF,MAAMC,MAAM,GAAGL,QAAQ,CAACM,gBAAgB;IACxC,IAAI,CAACD,MAAM,IAAIJ,MAAM,EAAEM,MAAM,EAAE;MAC3BC,OAAO,CAACC,KAAK,CAAC;QACVR;MACJ,CAAC,CAAC;MACF,MAAM,IAAIS,KAAK,CAAC,gDAAgD,CAAC;IACrE;IAEA,IAAI,CAACL,MAAM,CAACpB,IAAI,IAAI,CAACoB,MAAM,CAAClB,IAAI,EAAE;MAC9B,MAAM,IAAIuB,KAAK,CAACL,MAAM,CAACI,KAAK,EAAEE,OAAO,IAAI,oCAAoC,CAAC;IAClF;IAEA,MAAMC,SAAS,GAAG,MAAM7B,MAAM,CAAC8B,cAAc,CAACR,MAAM,CAAC;IACrD,IAAI,CAACO,SAAS,CAACE,OAAO,EAAE;MACpB,MAAMC,GAAG,GAAGpC,cAAc,CAACiC,SAAS,CAACH,KAAK,CAAC;MAC3CD,OAAO,CAACC,KAAK,CAACM,GAAG,CAAC;MAClB,MAAMA,GAAG;IACb;IAEA,OAAO;MACHC,KAAK,EAAEJ,SAAS,CAAC3B,IAAI,CAACA,IAAI;MAC1BE,IAAI,EAAEyB,SAAS,CAAC3B,IAAI,CAACE;IACzB,CAAC;EACL;AACJ","ignoreList":[]}
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.js
CHANGED
|
@@ -54,9 +54,15 @@ export class SchedulerPublishGraphQLGateway {
|
|
|
54
54
|
if (!result.data) {
|
|
55
55
|
throw new Error(result.error?.message || "Could not schedule entry to be published.");
|
|
56
56
|
}
|
|
57
|
-
const validated = await schema.safeParseAsync(result
|
|
57
|
+
const validated = await schema.safeParseAsync(result);
|
|
58
58
|
if (!validated.success) {
|
|
59
|
-
|
|
59
|
+
const err = createZodError(validated.error);
|
|
60
|
+
console.error({
|
|
61
|
+
err,
|
|
62
|
+
errS: JSON.stringify(err),
|
|
63
|
+
error: JSON.stringify(validated.error)
|
|
64
|
+
});
|
|
65
|
+
throw err;
|
|
60
66
|
}
|
|
61
67
|
return {
|
|
62
68
|
item: validated.data.data
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["zod","schedulerEntrySchema","createZodError","gql","ScheduleType","createSchedulerEntryFields","createSchedulerPublishMutation","schema","object","data","SchedulerPublishGraphQLGateway","constructor","client","execute","params","response","errors","mutate","mutation","variables","modelId","id","input","scheduleOn","type","publish","fetchPolicy","result","createCmsSchedule","length","console","error","Error","message","validated","safeParseAsync","success","item"],"sources":["SchedulerPublishGraphQLGateway.ts"],"sourcesContent":["import type { ApolloClient } from \"apollo-client\";\nimport type { CmsErrorResponse } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport zod from \"zod\";\nimport { schedulerEntrySchema } from \"./schema/schedulerEntry.js\";\nimport { createZodError } from \"@webiny/utils/createZodError\";\nimport gql from \"graphql-tag\";\nimport type { SchedulerEntry } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport { ScheduleType } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport type {\n ISchedulerPublishExecuteParams,\n ISchedulerPublishGateway,\n ISchedulerPublishGatewayResponse\n} from \"@webiny/app-headless-cms-scheduler/index.js\";\nimport { createSchedulerEntryFields } from \"./graphql/fields.js\";\n\nconst createSchedulerPublishMutation = () => {\n return gql`\n mutation SchedulerPublish($modelId: String!, $id: ID!, $input: CmsCreateScheduleInput!) {\n createCmsSchedule(modelId: $modelId, id: $id, input: $input) {\n data {\n ${createSchedulerEntryFields()}\n }\n error {\n message\n code\n data\n stack\n }\n }\n }\n `;\n};\n\ninterface SchedulerPublishGraphQLMutationVariables {\n modelId: string;\n id: string;\n input: {\n scheduleOn: Date;\n type: ScheduleType.publish;\n };\n}\n\ninterface SchedulerPublishGraphQLMutationResponse {\n createCmsSchedule: {\n data: SchedulerEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nconst schema = zod.object({\n data: schedulerEntrySchema\n});\n\nexport class SchedulerPublishGraphQLGateway implements ISchedulerPublishGateway {\n private readonly client: ApolloClient<any>;\n\n public constructor(client: ApolloClient<any>) {\n this.client = client;\n }\n\n public async execute(\n params: ISchedulerPublishExecuteParams\n ): Promise<ISchedulerPublishGatewayResponse> {\n const { data: response, errors } = await this.client.mutate<\n SchedulerPublishGraphQLMutationResponse,\n SchedulerPublishGraphQLMutationVariables\n >({\n mutation: createSchedulerPublishMutation(),\n variables: {\n modelId: params.modelId,\n id: params.id,\n input: {\n scheduleOn: params.scheduleOn,\n type: ScheduleType.publish\n }\n },\n fetchPolicy: \"no-cache\"\n });\n\n const result = response?.createCmsSchedule;\n if (!result || errors?.length) {\n console.error({\n errors\n });\n throw new Error(\"Network error while creating a schedule.\");\n }\n\n if (!result.data) {\n throw new Error(result.error?.message || \"Could not schedule entry to be published.\");\n }\n\n const validated = await schema.safeParseAsync(result
|
|
1
|
+
{"version":3,"names":["zod","schedulerEntrySchema","createZodError","gql","ScheduleType","createSchedulerEntryFields","createSchedulerPublishMutation","schema","object","data","SchedulerPublishGraphQLGateway","constructor","client","execute","params","response","errors","mutate","mutation","variables","modelId","id","input","scheduleOn","type","publish","fetchPolicy","result","createCmsSchedule","length","console","error","Error","message","validated","safeParseAsync","success","err","errS","JSON","stringify","item"],"sources":["SchedulerPublishGraphQLGateway.ts"],"sourcesContent":["import type { ApolloClient } from \"apollo-client\";\nimport type { CmsErrorResponse } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport zod from \"zod\";\nimport { schedulerEntrySchema } from \"./schema/schedulerEntry.js\";\nimport { createZodError } from \"@webiny/utils/createZodError\";\nimport gql from \"graphql-tag\";\nimport type { SchedulerEntry } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport { ScheduleType } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport type {\n ISchedulerPublishExecuteParams,\n ISchedulerPublishGateway,\n ISchedulerPublishGatewayResponse\n} from \"@webiny/app-headless-cms-scheduler/index.js\";\nimport { createSchedulerEntryFields } from \"./graphql/fields.js\";\n\nconst createSchedulerPublishMutation = () => {\n return gql`\n mutation SchedulerPublish($modelId: String!, $id: ID!, $input: CmsCreateScheduleInput!) {\n createCmsSchedule(modelId: $modelId, id: $id, input: $input) {\n data {\n ${createSchedulerEntryFields()}\n }\n error {\n message\n code\n data\n stack\n }\n }\n }\n `;\n};\n\ninterface SchedulerPublishGraphQLMutationVariables {\n modelId: string;\n id: string;\n input: {\n scheduleOn: Date;\n type: ScheduleType.publish;\n };\n}\n\ninterface SchedulerPublishGraphQLMutationResponse {\n createCmsSchedule: {\n data: SchedulerEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nconst schema = zod.object({\n data: schedulerEntrySchema\n});\n\nexport class SchedulerPublishGraphQLGateway implements ISchedulerPublishGateway {\n private readonly client: ApolloClient<any>;\n\n public constructor(client: ApolloClient<any>) {\n this.client = client;\n }\n\n public async execute(\n params: ISchedulerPublishExecuteParams\n ): Promise<ISchedulerPublishGatewayResponse> {\n const { data: response, errors } = await this.client.mutate<\n SchedulerPublishGraphQLMutationResponse,\n SchedulerPublishGraphQLMutationVariables\n >({\n mutation: createSchedulerPublishMutation(),\n variables: {\n modelId: params.modelId,\n id: params.id,\n input: {\n scheduleOn: params.scheduleOn,\n type: ScheduleType.publish\n }\n },\n fetchPolicy: \"no-cache\"\n });\n\n const result = response?.createCmsSchedule;\n if (!result || errors?.length) {\n console.error({\n errors\n });\n throw new Error(\"Network error while creating a schedule.\");\n }\n\n if (!result.data) {\n throw new Error(result.error?.message || \"Could not schedule entry to be published.\");\n }\n\n const validated = await schema.safeParseAsync(result);\n if (!validated.success) {\n const err = createZodError(validated.error);\n console.error({\n err,\n errS: JSON.stringify(err),\n error: JSON.stringify(validated.error)\n });\n throw err;\n }\n return {\n item: validated.data.data\n };\n }\n}\n"],"mappings":"AAEA,OAAOA,GAAG,MAAM,KAAK;AACrB,SAASC,oBAAoB;AAC7B,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,OAAOC,GAAG,MAAM,aAAa;AAE7B,SAASC,YAAY,QAAQ,6CAA6C;AAM1E,SAASC,0BAA0B;AAEnC,MAAMC,8BAA8B,GAAGA,CAAA,KAAM;EACzC,OAAOH,GAAG;AACd;AACA;AACA;AACA,sBAAsBE,0BAA0B,CAAC,CAAC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;AAkBD,MAAME,MAAM,GAAGP,GAAG,CAACQ,MAAM,CAAC;EACtBC,IAAI,EAAER;AACV,CAAC,CAAC;AAEF,OAAO,MAAMS,8BAA8B,CAAqC;EAGrEC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,OAAOA,CAChBC,MAAsC,EACG;IACzC,MAAM;MAAEL,IAAI,EAAEM,QAAQ;MAAEC;IAAO,CAAC,GAAG,MAAM,IAAI,CAACJ,MAAM,CAACK,MAAM,CAGzD;MACEC,QAAQ,EAAEZ,8BAA8B,CAAC,CAAC;MAC1Ca,SAAS,EAAE;QACPC,OAAO,EAAEN,MAAM,CAACM,OAAO;QACvBC,EAAE,EAAEP,MAAM,CAACO,EAAE;QACbC,KAAK,EAAE;UACHC,UAAU,EAAET,MAAM,CAACS,UAAU;UAC7BC,IAAI,EAAEpB,YAAY,CAACqB;QACvB;MACJ,CAAC;MACDC,WAAW,EAAE;IACjB,CAAC,CAAC;IAEF,MAAMC,MAAM,GAAGZ,QAAQ,EAAEa,iBAAiB;IAC1C,IAAI,CAACD,MAAM,IAAIX,MAAM,EAAEa,MAAM,EAAE;MAC3BC,OAAO,CAACC,KAAK,CAAC;QACVf;MACJ,CAAC,CAAC;MACF,MAAM,IAAIgB,KAAK,CAAC,0CAA0C,CAAC;IAC/D;IAEA,IAAI,CAACL,MAAM,CAAClB,IAAI,EAAE;MACd,MAAM,IAAIuB,KAAK,CAACL,MAAM,CAACI,KAAK,EAAEE,OAAO,IAAI,2CAA2C,CAAC;IACzF;IAEA,MAAMC,SAAS,GAAG,MAAM3B,MAAM,CAAC4B,cAAc,CAACR,MAAM,CAAC;IACrD,IAAI,CAACO,SAAS,CAACE,OAAO,EAAE;MACpB,MAAMC,GAAG,GAAGnC,cAAc,CAACgC,SAAS,CAACH,KAAK,CAAC;MAC3CD,OAAO,CAACC,KAAK,CAAC;QACVM,GAAG;QACHC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACH,GAAG,CAAC;QACzBN,KAAK,EAAEQ,IAAI,CAACC,SAAS,CAACN,SAAS,CAACH,KAAK;MACzC,CAAC,CAAC;MACF,MAAMM,GAAG;IACb;IACA,OAAO;MACHI,IAAI,EAAEP,SAAS,CAACzB,IAAI,CAACA;IACzB,CAAC;EACL;AACJ","ignoreList":[]}
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.d.ts
CHANGED
|
@@ -6,15 +6,15 @@ export declare class SchedulerUnpublishGraphQLGateway implements ISchedulerUnpub
|
|
|
6
6
|
constructor(client: ApolloClient<any>);
|
|
7
7
|
execute(params: ISchedulerUnpublishExecuteParams): Promise<{
|
|
8
8
|
item: {
|
|
9
|
-
|
|
9
|
+
model: Pick<import("@webiny/app-headless-cms-scheduler/types.js").CmsModel, "modelId">;
|
|
10
10
|
id: string;
|
|
11
11
|
title: string;
|
|
12
|
-
|
|
12
|
+
type: ScheduleType;
|
|
13
13
|
targetId: string;
|
|
14
14
|
scheduledBy: {
|
|
15
|
-
type: string;
|
|
16
15
|
id: string;
|
|
17
16
|
displayName: string;
|
|
17
|
+
type: string;
|
|
18
18
|
};
|
|
19
19
|
publishOn?: Date | undefined;
|
|
20
20
|
unpublishOn?: Date | undefined;
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.js
CHANGED
|
@@ -54,9 +54,11 @@ export class SchedulerUnpublishGraphQLGateway {
|
|
|
54
54
|
if (!result.data) {
|
|
55
55
|
throw new Error(result.error?.message || "Could not schedule entry to be unpublished.");
|
|
56
56
|
}
|
|
57
|
-
const validated = await schema.safeParseAsync(result
|
|
57
|
+
const validated = await schema.safeParseAsync(result);
|
|
58
58
|
if (!validated.success) {
|
|
59
|
-
|
|
59
|
+
const err = createZodError(validated.error);
|
|
60
|
+
console.error(err);
|
|
61
|
+
throw err;
|
|
60
62
|
}
|
|
61
63
|
return {
|
|
62
64
|
item: validated.data.data
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["zod","schedulerEntrySchema","createZodError","gql","ScheduleType","createSchedulerEntryFields","createSchedulerUnpublishMutation","schema","object","data","SchedulerUnpublishGraphQLGateway","constructor","client","execute","params","response","errors","mutate","mutation","variables","modelId","id","input","scheduleOn","type","unpublish","fetchPolicy","result","createCmsSchedule","length","console","error","Error","message","validated","safeParseAsync","success","item"],"sources":["SchedulerUnpublishGraphQLGateway.ts"],"sourcesContent":["import type { ApolloClient } from \"apollo-client\";\nimport type { CmsErrorResponse } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport zod from \"zod\";\nimport { schedulerEntrySchema } from \"./schema/schedulerEntry.js\";\nimport { createZodError } from \"@webiny/utils/createZodError\";\nimport gql from \"graphql-tag\";\nimport type {\n ISchedulerUnpublishExecuteParams,\n ISchedulerUnpublishGateway\n} from \"@webiny/app-headless-cms-scheduler/index.js\";\nimport type { SchedulerEntry } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport { ScheduleType } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport { createSchedulerEntryFields } from \"./graphql/fields.js\";\n\nconst createSchedulerUnpublishMutation = () => {\n return gql`\n mutation SchedulerUnpublish($modelId: String!, $id: ID!, $input: CmsCreateScheduleInput!) {\n createCmsSchedule(modelId: $modelId, id: $id, input: $input) {\n data {\n ${createSchedulerEntryFields()}\n }\n error {\n message\n code\n data\n stack\n }\n }\n }\n `;\n};\n\ninterface SchedulerUnpublishGraphQLMutationVariables {\n modelId: string;\n id: string;\n input: {\n scheduleOn: Date;\n type: ScheduleType.unpublish;\n };\n}\n\ninterface SchedulerUnpublishGraphQLMutationResponse {\n createCmsSchedule: {\n data: SchedulerEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nconst schema = zod.object({\n data: schedulerEntrySchema\n});\n\nexport class SchedulerUnpublishGraphQLGateway implements ISchedulerUnpublishGateway {\n private readonly client: ApolloClient<any>;\n\n public constructor(client: ApolloClient<any>) {\n this.client = client;\n }\n\n public async execute(params: ISchedulerUnpublishExecuteParams) {\n const { data: response, errors } = await this.client.mutate<\n SchedulerUnpublishGraphQLMutationResponse,\n SchedulerUnpublishGraphQLMutationVariables\n >({\n mutation: createSchedulerUnpublishMutation(),\n variables: {\n modelId: params.modelId,\n id: params.id,\n input: {\n scheduleOn: params.scheduleOn,\n type: ScheduleType.unpublish\n }\n },\n fetchPolicy: \"no-cache\"\n });\n\n const result = response?.createCmsSchedule;\n if (!result || errors?.length) {\n console.error({\n errors\n });\n throw new Error(\"Network error while creating a schedule.\");\n }\n\n if (!result.data) {\n throw new Error(result.error?.message || \"Could not schedule entry to be unpublished.\");\n }\n\n const validated = await schema.safeParseAsync(result
|
|
1
|
+
{"version":3,"names":["zod","schedulerEntrySchema","createZodError","gql","ScheduleType","createSchedulerEntryFields","createSchedulerUnpublishMutation","schema","object","data","SchedulerUnpublishGraphQLGateway","constructor","client","execute","params","response","errors","mutate","mutation","variables","modelId","id","input","scheduleOn","type","unpublish","fetchPolicy","result","createCmsSchedule","length","console","error","Error","message","validated","safeParseAsync","success","err","item"],"sources":["SchedulerUnpublishGraphQLGateway.ts"],"sourcesContent":["import type { ApolloClient } from \"apollo-client\";\nimport type { CmsErrorResponse } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport zod from \"zod\";\nimport { schedulerEntrySchema } from \"./schema/schedulerEntry.js\";\nimport { createZodError } from \"@webiny/utils/createZodError\";\nimport gql from \"graphql-tag\";\nimport type {\n ISchedulerUnpublishExecuteParams,\n ISchedulerUnpublishGateway\n} from \"@webiny/app-headless-cms-scheduler/index.js\";\nimport type { SchedulerEntry } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport { ScheduleType } from \"@webiny/app-headless-cms-scheduler/types.js\";\nimport { createSchedulerEntryFields } from \"./graphql/fields.js\";\n\nconst createSchedulerUnpublishMutation = () => {\n return gql`\n mutation SchedulerUnpublish($modelId: String!, $id: ID!, $input: CmsCreateScheduleInput!) {\n createCmsSchedule(modelId: $modelId, id: $id, input: $input) {\n data {\n ${createSchedulerEntryFields()}\n }\n error {\n message\n code\n data\n stack\n }\n }\n }\n `;\n};\n\ninterface SchedulerUnpublishGraphQLMutationVariables {\n modelId: string;\n id: string;\n input: {\n scheduleOn: Date;\n type: ScheduleType.unpublish;\n };\n}\n\ninterface SchedulerUnpublishGraphQLMutationResponse {\n createCmsSchedule: {\n data: SchedulerEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nconst schema = zod.object({\n data: schedulerEntrySchema\n});\n\nexport class SchedulerUnpublishGraphQLGateway implements ISchedulerUnpublishGateway {\n private readonly client: ApolloClient<any>;\n\n public constructor(client: ApolloClient<any>) {\n this.client = client;\n }\n\n public async execute(params: ISchedulerUnpublishExecuteParams) {\n const { data: response, errors } = await this.client.mutate<\n SchedulerUnpublishGraphQLMutationResponse,\n SchedulerUnpublishGraphQLMutationVariables\n >({\n mutation: createSchedulerUnpublishMutation(),\n variables: {\n modelId: params.modelId,\n id: params.id,\n input: {\n scheduleOn: params.scheduleOn,\n type: ScheduleType.unpublish\n }\n },\n fetchPolicy: \"no-cache\"\n });\n\n const result = response?.createCmsSchedule;\n if (!result || errors?.length) {\n console.error({\n errors\n });\n throw new Error(\"Network error while creating a schedule.\");\n }\n\n if (!result.data) {\n throw new Error(result.error?.message || \"Could not schedule entry to be unpublished.\");\n }\n\n const validated = await schema.safeParseAsync(result);\n if (!validated.success) {\n const err = createZodError(validated.error);\n console.error(err);\n throw err;\n }\n return {\n item: validated.data.data\n };\n }\n}\n"],"mappings":"AAEA,OAAOA,GAAG,MAAM,KAAK;AACrB,SAASC,oBAAoB;AAC7B,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,OAAOC,GAAG,MAAM,aAAa;AAM7B,SAASC,YAAY,QAAQ,6CAA6C;AAC1E,SAASC,0BAA0B;AAEnC,MAAMC,gCAAgC,GAAGA,CAAA,KAAM;EAC3C,OAAOH,GAAG;AACd;AACA;AACA;AACA,sBAAsBE,0BAA0B,CAAC,CAAC;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;AAkBD,MAAME,MAAM,GAAGP,GAAG,CAACQ,MAAM,CAAC;EACtBC,IAAI,EAAER;AACV,CAAC,CAAC;AAEF,OAAO,MAAMS,gCAAgC,CAAuC;EAGzEC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,OAAOA,CAACC,MAAwC,EAAE;IAC3D,MAAM;MAAEL,IAAI,EAAEM,QAAQ;MAAEC;IAAO,CAAC,GAAG,MAAM,IAAI,CAACJ,MAAM,CAACK,MAAM,CAGzD;MACEC,QAAQ,EAAEZ,gCAAgC,CAAC,CAAC;MAC5Ca,SAAS,EAAE;QACPC,OAAO,EAAEN,MAAM,CAACM,OAAO;QACvBC,EAAE,EAAEP,MAAM,CAACO,EAAE;QACbC,KAAK,EAAE;UACHC,UAAU,EAAET,MAAM,CAACS,UAAU;UAC7BC,IAAI,EAAEpB,YAAY,CAACqB;QACvB;MACJ,CAAC;MACDC,WAAW,EAAE;IACjB,CAAC,CAAC;IAEF,MAAMC,MAAM,GAAGZ,QAAQ,EAAEa,iBAAiB;IAC1C,IAAI,CAACD,MAAM,IAAIX,MAAM,EAAEa,MAAM,EAAE;MAC3BC,OAAO,CAACC,KAAK,CAAC;QACVf;MACJ,CAAC,CAAC;MACF,MAAM,IAAIgB,KAAK,CAAC,0CAA0C,CAAC;IAC/D;IAEA,IAAI,CAACL,MAAM,CAAClB,IAAI,EAAE;MACd,MAAM,IAAIuB,KAAK,CAACL,MAAM,CAACI,KAAK,EAAEE,OAAO,IAAI,6CAA6C,CAAC;IAC3F;IAEA,MAAMC,SAAS,GAAG,MAAM3B,MAAM,CAAC4B,cAAc,CAACR,MAAM,CAAC;IACrD,IAAI,CAACO,SAAS,CAACE,OAAO,EAAE;MACpB,MAAMC,GAAG,GAAGnC,cAAc,CAACgC,SAAS,CAACH,KAAK,CAAC;MAC3CD,OAAO,CAACC,KAAK,CAACM,GAAG,CAAC;MAClB,MAAMA,GAAG;IACb;IACA,OAAO;MACHC,IAAI,EAAEJ,SAAS,CAACzB,IAAI,CAACA;IACzB,CAAC;EACL;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./SchedulerCancelGraphQLGateway";
|
|
2
|
+
export * from "./SchedulerGetGraphQLGateway";
|
|
3
|
+
export * from "./SchedulerListGraphQLGateway";
|
|
4
|
+
export * from "./SchedulerPublishGraphQLGateway";
|
|
5
|
+
export * from "./SchedulerUnpublishGraphQLGateway";
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./SchedulerCancelGraphQLGateway\";\nexport * from \"./SchedulerGetGraphQLGateway\";\nexport * from \"./SchedulerListGraphQLGateway\";\nexport * from \"./SchedulerPublishGraphQLGateway\";\nexport * from \"./SchedulerUnpublishGraphQLGateway\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -18,44 +18,44 @@ export declare const schedulerEntrySchema: zod.ZodObject<{
|
|
|
18
18
|
displayName: zod.ZodString;
|
|
19
19
|
type: zod.ZodString;
|
|
20
20
|
}, "strip", zod.ZodTypeAny, {
|
|
21
|
-
type: string;
|
|
22
21
|
id: string;
|
|
23
22
|
displayName: string;
|
|
24
|
-
}, {
|
|
25
23
|
type: string;
|
|
24
|
+
}, {
|
|
26
25
|
id: string;
|
|
27
26
|
displayName: string;
|
|
27
|
+
type: string;
|
|
28
28
|
}>;
|
|
29
|
-
publishOn: zod.ZodOptional<zod.
|
|
30
|
-
unpublishOn: zod.ZodOptional<zod.
|
|
29
|
+
publishOn: zod.ZodEffects<zod.ZodOptional<zod.ZodNullable<zod.ZodString>>, Date | undefined, string | null | undefined>;
|
|
30
|
+
unpublishOn: zod.ZodEffects<zod.ZodOptional<zod.ZodNullable<zod.ZodString>>, Date | undefined, string | null | undefined>;
|
|
31
31
|
type: zod.ZodNativeEnum<typeof ScheduleType>;
|
|
32
32
|
title: zod.ZodString;
|
|
33
33
|
}, "strip", zod.ZodTypeAny, {
|
|
34
|
-
|
|
34
|
+
model: Pick<CmsModel, "modelId">;
|
|
35
35
|
id: string;
|
|
36
36
|
title: string;
|
|
37
|
-
|
|
37
|
+
type: ScheduleType;
|
|
38
38
|
targetId: string;
|
|
39
39
|
scheduledBy: {
|
|
40
|
-
type: string;
|
|
41
40
|
id: string;
|
|
42
41
|
displayName: string;
|
|
42
|
+
type: string;
|
|
43
43
|
};
|
|
44
44
|
publishOn?: Date | undefined;
|
|
45
45
|
unpublishOn?: Date | undefined;
|
|
46
46
|
}, {
|
|
47
|
-
type: ScheduleType;
|
|
48
|
-
id: string;
|
|
49
|
-
title: string;
|
|
50
47
|
model: {
|
|
51
48
|
modelId: string;
|
|
52
49
|
};
|
|
50
|
+
id: string;
|
|
51
|
+
title: string;
|
|
52
|
+
type: ScheduleType;
|
|
53
53
|
targetId: string;
|
|
54
54
|
scheduledBy: {
|
|
55
|
-
type: string;
|
|
56
55
|
id: string;
|
|
57
56
|
displayName: string;
|
|
57
|
+
type: string;
|
|
58
58
|
};
|
|
59
|
-
publishOn?:
|
|
60
|
-
unpublishOn?:
|
|
59
|
+
publishOn?: string | null | undefined;
|
|
60
|
+
unpublishOn?: string | null | undefined;
|
|
61
61
|
}>;
|
|
@@ -13,8 +13,12 @@ export const schedulerEntrySchema = zod.object({
|
|
|
13
13
|
displayName: zod.string(),
|
|
14
14
|
type: zod.string()
|
|
15
15
|
}),
|
|
16
|
-
publishOn: zod.
|
|
17
|
-
|
|
16
|
+
publishOn: zod.string().nullable().optional().transform(value => {
|
|
17
|
+
return !!value ? new Date(value) : undefined;
|
|
18
|
+
}),
|
|
19
|
+
unpublishOn: zod.string().nullable().optional().transform(value => {
|
|
20
|
+
return !!value ? new Date(value) : undefined;
|
|
21
|
+
}),
|
|
18
22
|
type: zod.nativeEnum(ScheduleType),
|
|
19
23
|
title: zod.string()
|
|
20
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["zod","ScheduleType","schedulerEntrySchema","object","id","string","targetId","model","modelId","transform","value","scheduledBy","displayName","type","publishOn","
|
|
1
|
+
{"version":3,"names":["zod","ScheduleType","schedulerEntrySchema","object","id","string","targetId","model","modelId","transform","value","scheduledBy","displayName","type","publishOn","nullable","optional","Date","undefined","unpublishOn","nativeEnum","title"],"sources":["schedulerEntry.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/app-headless-cms-common/types/model.js\";\nimport zod from \"zod\";\nimport { ScheduleType } from \"@webiny/app-headless-cms-scheduler/types.js\";\n\nexport const schedulerEntrySchema = zod.object({\n id: zod.string(),\n targetId: zod.string(),\n model: zod\n .object({\n modelId: zod.string()\n })\n .transform(value => {\n return value as unknown as Pick<CmsModel, \"modelId\">;\n }),\n scheduledBy: zod.object({\n id: zod.string(),\n displayName: zod.string(),\n type: zod.string()\n }),\n publishOn: zod\n .string()\n .nullable()\n .optional()\n .transform(value => {\n return !!value ? new Date(value) : undefined;\n }),\n unpublishOn: zod\n .string()\n .nullable()\n .optional()\n .transform(value => {\n return !!value ? new Date(value) : undefined;\n }),\n type: zod.nativeEnum(ScheduleType),\n title: zod.string()\n});\n"],"mappings":"AACA,OAAOA,GAAG,MAAM,KAAK;AACrB,SAASC,YAAY,QAAQ,6CAA6C;AAE1E,OAAO,MAAMC,oBAAoB,GAAGF,GAAG,CAACG,MAAM,CAAC;EAC3CC,EAAE,EAAEJ,GAAG,CAACK,MAAM,CAAC,CAAC;EAChBC,QAAQ,EAAEN,GAAG,CAACK,MAAM,CAAC,CAAC;EACtBE,KAAK,EAAEP,GAAG,CACLG,MAAM,CAAC;IACJK,OAAO,EAAER,GAAG,CAACK,MAAM,CAAC;EACxB,CAAC,CAAC,CACDI,SAAS,CAACC,KAAK,IAAI;IAChB,OAAOA,KAAK;EAChB,CAAC,CAAC;EACNC,WAAW,EAAEX,GAAG,CAACG,MAAM,CAAC;IACpBC,EAAE,EAAEJ,GAAG,CAACK,MAAM,CAAC,CAAC;IAChBO,WAAW,EAAEZ,GAAG,CAACK,MAAM,CAAC,CAAC;IACzBQ,IAAI,EAAEb,GAAG,CAACK,MAAM,CAAC;EACrB,CAAC,CAAC;EACFS,SAAS,EAAEd,GAAG,CACTK,MAAM,CAAC,CAAC,CACRU,QAAQ,CAAC,CAAC,CACVC,QAAQ,CAAC,CAAC,CACVP,SAAS,CAACC,KAAK,IAAI;IAChB,OAAO,CAAC,CAACA,KAAK,GAAG,IAAIO,IAAI,CAACP,KAAK,CAAC,GAAGQ,SAAS;EAChD,CAAC,CAAC;EACNC,WAAW,EAAEnB,GAAG,CACXK,MAAM,CAAC,CAAC,CACRU,QAAQ,CAAC,CAAC,CACVC,QAAQ,CAAC,CAAC,CACVP,SAAS,CAACC,KAAK,IAAI;IAChB,OAAO,CAAC,CAACA,KAAK,GAAG,IAAIO,IAAI,CAACP,KAAK,CAAC,GAAGQ,SAAS;EAChD,CAAC,CAAC;EACNL,IAAI,EAAEb,GAAG,CAACoB,UAAU,CAACnB,YAAY,CAAC;EAClCoB,KAAK,EAAErB,GAAG,CAACK,MAAM,CAAC;AACtB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -17,18 +17,18 @@ const DefaultCellActions = () => {
|
|
|
17
17
|
} = useAcoConfig();
|
|
18
18
|
if (isFolderRow(row)) {
|
|
19
19
|
// If the user cannot manage folder structure, no need to show the menu.
|
|
20
|
-
if (!row.canManageStructure) {
|
|
20
|
+
if (!row.data.canManageStructure) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
return /*#__PURE__*/React.createElement(FolderProvider, {
|
|
24
|
-
folder: row
|
|
24
|
+
folder: row.data
|
|
25
25
|
}, /*#__PURE__*/React.createElement(OptionsMenu, {
|
|
26
26
|
actions: folderConfig.actions,
|
|
27
27
|
"data-testid": "table.row.folder.menu-action"
|
|
28
28
|
}));
|
|
29
29
|
}
|
|
30
30
|
return /*#__PURE__*/React.createElement(EntryProvider, {
|
|
31
|
-
entry: row
|
|
31
|
+
entry: row.data
|
|
32
32
|
}, /*#__PURE__*/React.createElement(OptionsMenu, {
|
|
33
33
|
actions: recordConfig.actions,
|
|
34
34
|
"data-testid": "table.row.pb.entry.menu-action"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","FolderProvider","useAcoConfig","makeDecoratable","OptionsMenu","ContentEntryListConfig","EntryProvider","DefaultCellActions","useTableRow","isFolderRow","Browser","Table","Column","row","folder","folderConfig","record","recordConfig","canManageStructure","createElement","actions","entry","CellActions"],"sources":["CellActions.tsx"],"sourcesContent":["import React from \"react\";\nimport { FolderProvider, useAcoConfig } from \"@webiny/app-aco\";\nimport { makeDecoratable, OptionsMenu } from \"@webiny/app-admin\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { EntryProvider } from \"~/admin/hooks/useEntry\";\n\nconst DefaultCellActions = () => {\n const { useTableRow, isFolderRow } = ContentEntryListConfig.Browser.Table.Column;\n const { row } = useTableRow();\n const { folder: folderConfig, record: recordConfig } = useAcoConfig();\n\n if (isFolderRow(row)) {\n // If the user cannot manage folder structure, no need to show the menu.\n if (!row.canManageStructure) {\n return null;\n }\n\n return (\n <FolderProvider folder={row}>\n <OptionsMenu\n actions={folderConfig.actions}\n data-testid={\"table.row.folder.menu-action\"}\n />\n </FolderProvider>\n );\n }\n\n return (\n <EntryProvider entry={row}>\n <OptionsMenu\n actions={recordConfig.actions}\n data-testid={\"table.row.pb.entry.menu-action\"}\n />\n </EntryProvider>\n );\n};\n\nexport const CellActions = makeDecoratable(\"CellActions\", DefaultCellActions);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,EAAEC,YAAY,QAAQ,iBAAiB;AAC9D,SAASC,eAAe,EAAEC,WAAW,QAAQ,mBAAmB;AAChE,SAASC,sBAAsB;AAC/B,SAASC,aAAa;AAEtB,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC,WAAW;IAAEC;EAAY,CAAC,GAAGJ,sBAAsB,CAACK,OAAO,CAACC,KAAK,CAACC,MAAM;EAChF,MAAM;IAAEC;EAAI,CAAC,GAAGL,WAAW,CAAC,CAAC;EAC7B,MAAM;IAAEM,MAAM,EAAEC,YAAY;IAAEC,MAAM,EAAEC;EAAa,CAAC,GAAGf,YAAY,CAAC,CAAC;EAErE,IAAIO,WAAW,CAACI,GAAG,CAAC,EAAE;IAClB;IACA,IAAI,CAACA,GAAG,CAACK,kBAAkB,EAAE;
|
|
1
|
+
{"version":3,"names":["React","FolderProvider","useAcoConfig","makeDecoratable","OptionsMenu","ContentEntryListConfig","EntryProvider","DefaultCellActions","useTableRow","isFolderRow","Browser","Table","Column","row","folder","folderConfig","record","recordConfig","data","canManageStructure","createElement","actions","entry","CellActions"],"sources":["CellActions.tsx"],"sourcesContent":["import React from \"react\";\nimport { FolderProvider, useAcoConfig } from \"@webiny/app-aco\";\nimport { makeDecoratable, OptionsMenu } from \"@webiny/app-admin\";\nimport { ContentEntryListConfig } from \"~/admin/config/contentEntries\";\nimport { EntryProvider } from \"~/admin/hooks/useEntry\";\n\nconst DefaultCellActions = () => {\n const { useTableRow, isFolderRow } = ContentEntryListConfig.Browser.Table.Column;\n const { row } = useTableRow();\n const { folder: folderConfig, record: recordConfig } = useAcoConfig();\n\n if (isFolderRow(row)) {\n // If the user cannot manage folder structure, no need to show the menu.\n if (!row.data.canManageStructure) {\n return null;\n }\n\n return (\n <FolderProvider folder={row.data}>\n <OptionsMenu\n actions={folderConfig.actions}\n data-testid={\"table.row.folder.menu-action\"}\n />\n </FolderProvider>\n );\n }\n\n return (\n <EntryProvider entry={row.data}>\n <OptionsMenu\n actions={recordConfig.actions}\n data-testid={\"table.row.pb.entry.menu-action\"}\n />\n </EntryProvider>\n );\n};\n\nexport const CellActions = makeDecoratable(\"CellActions\", DefaultCellActions);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,EAAEC,YAAY,QAAQ,iBAAiB;AAC9D,SAASC,eAAe,EAAEC,WAAW,QAAQ,mBAAmB;AAChE,SAASC,sBAAsB;AAC/B,SAASC,aAAa;AAEtB,MAAMC,kBAAkB,GAAGA,CAAA,KAAM;EAC7B,MAAM;IAAEC,WAAW;IAAEC;EAAY,CAAC,GAAGJ,sBAAsB,CAACK,OAAO,CAACC,KAAK,CAACC,MAAM;EAChF,MAAM;IAAEC;EAAI,CAAC,GAAGL,WAAW,CAAC,CAAC;EAC7B,MAAM;IAAEM,MAAM,EAAEC,YAAY;IAAEC,MAAM,EAAEC;EAAa,CAAC,GAAGf,YAAY,CAAC,CAAC;EAErE,IAAIO,WAAW,CAACI,GAAG,CAAC,EAAE;IAClB;IACA,IAAI,CAACA,GAAG,CAACK,IAAI,CAACC,kBAAkB,EAAE;MAC9B,OAAO,IAAI;IACf;IAEA,oBACInB,KAAA,CAAAoB,aAAA,CAACnB,cAAc;MAACa,MAAM,EAAED,GAAG,CAACK;IAAK,gBAC7BlB,KAAA,CAAAoB,aAAA,CAAChB,WAAW;MACRiB,OAAO,EAAEN,YAAY,CAACM,OAAQ;MAC9B,eAAa;IAA+B,CAC/C,CACW,CAAC;EAEzB;EAEA,oBACIrB,KAAA,CAAAoB,aAAA,CAACd,aAAa;IAACgB,KAAK,EAAET,GAAG,CAACK;EAAK,gBAC3BlB,KAAA,CAAAoB,aAAA,CAAChB,WAAW;IACRiB,OAAO,EAAEJ,YAAY,CAACI,OAAQ;IAC9B,eAAa;EAAiC,CACjD,CACU,CAAC;AAExB,CAAC;AAED,OAAO,MAAME,WAAW,GAAGpB,eAAe,CAAC,aAAa,EAAEI,kBAAkB,CAAC","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ export const CellAuthor = () => {
|
|
|
7
7
|
const {
|
|
8
8
|
row
|
|
9
9
|
} = useTableRow();
|
|
10
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, row.createdBy.displayName);
|
|
10
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, row.data.createdBy.displayName);
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
//# sourceMappingURL=CellAuthor.js.map
|