@webiny/app-headless-cms 6.0.0 → 6.1.0-beta.0
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/admin/components/ContentEntries/SidebarFooter/SidebarFooter.js +1 -3
- package/admin/components/ContentEntries/SidebarFooter/SidebarFooter.js.map +1 -1
- package/admin/components/ContentEntryForm/ContentEntryForm.d.ts +1 -1
- package/admin/components/ContentEntryForm/ContentEntryForm.js.map +1 -1
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js +8 -2
- package/admin/components/ContentEntryForm/ContentEntryFormPreview.js.map +1 -1
- package/admin/components/ContentEntryForm/ContentEntryFormProvider.d.ts +2 -2
- package/admin/components/ContentEntryForm/ContentEntryFormProvider.js +31 -7
- package/admin/components/ContentEntryForm/ContentEntryFormProvider.js.map +1 -1
- package/admin/components/ContentEntryForm/Header/SaveContent/SaveContent.js +7 -4
- package/admin/components/ContentEntryForm/Header/SaveContent/SaveContent.js.map +1 -1
- package/admin/components/ContentEntryForm/ParentValue.js +1 -1
- package/admin/components/ContentEntryForm/ParentValue.js.map +1 -1
- package/admin/components/ContentModelEditor/ContentModelEditor.js +22 -5
- package/admin/components/ContentModelEditor/ContentModelEditor.js.map +1 -1
- package/admin/components/ContentModelEditor/FieldsSidebar.js +6 -2
- package/admin/components/ContentModelEditor/FieldsSidebar.js.map +1 -1
- package/admin/components/DragPreview.js +4 -2
- package/admin/components/DragPreview.js.map +1 -1
- package/admin/components/DropZone/Center.js +4 -2
- package/admin/components/DropZone/Center.js.map +1 -1
- package/admin/components/DropZone/Horizontal.js +3 -1
- package/admin/components/DropZone/Horizontal.js.map +1 -1
- package/admin/components/DropZone/Vertical.js +3 -1
- package/admin/components/DropZone/Vertical.js.map +1 -1
- package/admin/components/FieldEditor/FieldEditor.js +9 -3
- package/admin/components/FieldEditor/FieldEditor.js.map +1 -1
- package/admin/components/IsModelPublishable.js +3 -6
- package/admin/components/IsModelPublishable.js.map +1 -1
- package/admin/hooks/useIsModelPublishable.d.ts +1 -0
- package/admin/hooks/useIsModelPublishable.js +10 -0
- package/admin/hooks/useIsModelPublishable.js.map +1 -0
- package/admin/menus/HasContentEntryPermissions.d.ts +2 -2
- package/admin/menus/HasContentEntryPermissions.js.map +1 -1
- package/admin/plugins/editor/defaultBar/Name/Name.js +1 -5
- package/admin/plugins/editor/defaultBar/Name/Name.js.map +1 -1
- package/admin/plugins/fieldRenderers/DynamicSection.d.ts +1 -1
- package/admin/plugins/fieldRenderers/DynamicSection.js +1 -1
- package/admin/plugins/fieldRenderers/DynamicSection.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.d.ts +2 -2
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.d.ts +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js.map +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.d.ts +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js +1 -1
- package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/elements/ButtonLink.js +2 -2
- package/admin/plugins/fieldRenderers/ref/advanced/components/entry/elements/ButtonLink.js.map +1 -1
- package/admin/plugins/fieldRenderers/ref/components/NewReferencedEntryDialog.js +8 -2
- package/admin/plugins/fieldRenderers/ref/components/NewReferencedEntryDialog.js.map +1 -1
- package/admin/plugins/icons.js +13 -12
- package/admin/plugins/icons.js.map +1 -1
- package/admin/views/contentEntries/ContentEntriesModule.js +1 -5
- package/admin/views/contentEntries/ContentEntriesModule.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.js +2 -9
- package/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/FullScreenContentEntry.js.map +1 -1
- package/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/RevisionListDrawer/RevisionListDrawer.js +1 -2
- package/admin/views/contentEntries/ContentEntry/FullScreenContentEntry/RevisionListDrawer/RevisionListDrawer.js.map +1 -1
- package/admin/views/contentModels/ContentModelsDataList.js +4 -5
- package/admin/views/contentModels/ContentModelsDataList.js.map +1 -1
- package/admin/views/contentModels/fullDelete/FullyDeleteModelDialog.d.ts +1 -1
- package/admin/views/contentModels/fullDelete/FullyDeleteModelDialog.js +2 -2
- package/admin/views/contentModels/fullDelete/FullyDeleteModelDialog.js.map +1 -1
- package/admin/views/contentModels/fullDelete/dialog/state.d.ts +3 -3
- package/admin/views/contentModels/fullDelete/dialog/state.js +13 -9
- package/admin/views/contentModels/fullDelete/dialog/state.js.map +1 -1
- package/admin/views/contentModels/fullDelete/types.d.ts +1 -1
- package/admin/views/contentModels/fullDelete/types.js.map +1 -1
- package/admin/views/contentModels/importing/components/Model/DataListModelItem.js +10 -10
- package/admin/views/contentModels/importing/components/Model/DataListModelItem.js.map +1 -1
- package/package.json +38 -40
- package/admin/components/ContentEntries/Scheduler/actions/ScheduleEntryAction.d.ts +0 -2
- package/admin/components/ContentEntries/Scheduler/actions/ScheduleEntryAction.js +0 -82
- package/admin/components/ContentEntries/Scheduler/actions/ScheduleEntryAction.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/actions/hooks/useGetSchedulerItem.d.ts +0 -11
- package/admin/components/ContentEntries/Scheduler/actions/hooks/useGetSchedulerItem.js +0 -35
- package/admin/components/ContentEntries/Scheduler/actions/hooks/useGetSchedulerItem.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerCancelGraphQLGateway.d.ts +0 -7
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerCancelGraphQLGateway.js +0 -46
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerCancelGraphQLGateway.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerGetGraphQLGateway.d.ts +0 -20
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerGetGraphQLGateway.js +0 -69
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerGetGraphQLGateway.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerListGraphQLGateway.d.ts +0 -7
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerListGraphQLGateway.js +0 -86
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerListGraphQLGateway.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.d.ts +0 -7
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.js +0 -65
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.d.ts +0 -23
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.js +0 -67
- package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/graphql/fields.d.ts +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/graphql/fields.js +0 -20
- package/admin/components/ContentEntries/Scheduler/adapters/graphql/fields.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/index.d.ts +0 -5
- package/admin/components/ContentEntries/Scheduler/adapters/index.js +0 -7
- package/admin/components/ContentEntries/Scheduler/adapters/index.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/adapters/schema/schedulerEntry.d.ts +0 -61
- package/admin/components/ContentEntries/Scheduler/adapters/schema/schedulerEntry.js +0 -26
- package/admin/components/ContentEntries/Scheduler/adapters/schema/schedulerEntry.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/components/ScheduleSidebarButton.d.ts +0 -5
- package/admin/components/ContentEntries/Scheduler/components/ScheduleSidebarButton.js +0 -17
- package/admin/components/ContentEntries/Scheduler/components/ScheduleSidebarButton.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/components/Scheduler.d.ts +0 -2
- package/admin/components/ContentEntries/Scheduler/components/Scheduler.js +0 -54
- package/admin/components/ContentEntries/Scheduler/components/Scheduler.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/components/index.d.ts +0 -1
- package/admin/components/ContentEntries/Scheduler/components/index.js +0 -3
- package/admin/components/ContentEntries/Scheduler/components/index.js.map +0 -1
- package/admin/components/ContentEntries/Scheduler/index.d.ts +0 -1
- package/admin/components/ContentEntries/Scheduler/index.js +0 -3
- package/admin/components/ContentEntries/Scheduler/index.js.map +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useMemo } from "react";
|
|
2
|
-
import { useContentEntry } from "../../../../views/contentEntries/hooks/index.js";
|
|
3
|
-
import { useApolloClient, usePermission } from "../../../../hooks/index.js";
|
|
4
|
-
import { ContentEntryEditorConfig } from "../../../../config/contentEntries/index.js";
|
|
5
|
-
import { ReactComponent as ScheduleIcon } from "@webiny/icons/cell_tower.svg";
|
|
6
|
-
import { useGetSchedulerItem } from "./hooks/useGetSchedulerItem.js";
|
|
7
|
-
import { SchedulerCancelGraphQLGateway, SchedulerGetGraphQLGateway, SchedulerPublishGraphQLGateway, SchedulerUnpublishGraphQLGateway } from "../adapters/index.js";
|
|
8
|
-
import { ScheduleDialogAction, useScheduleDialog } from "@webiny/app-headless-cms-scheduler";
|
|
9
|
-
export const ScheduleEntryMenuItem = () => {
|
|
10
|
-
const {
|
|
11
|
-
entry,
|
|
12
|
-
loading,
|
|
13
|
-
contentModel
|
|
14
|
-
} = useContentEntry();
|
|
15
|
-
const {
|
|
16
|
-
canPublish,
|
|
17
|
-
canUnpublish
|
|
18
|
-
} = usePermission();
|
|
19
|
-
const client = useApolloClient();
|
|
20
|
-
const {
|
|
21
|
-
showDialog: showSchedulerDialog
|
|
22
|
-
} = useScheduleDialog();
|
|
23
|
-
const getGateway = useMemo(() => {
|
|
24
|
-
return new SchedulerGetGraphQLGateway(client);
|
|
25
|
-
}, [client]);
|
|
26
|
-
const cancelGateway = useMemo(() => {
|
|
27
|
-
return new SchedulerCancelGraphQLGateway(client);
|
|
28
|
-
}, [client]);
|
|
29
|
-
const publishGateway = useMemo(() => {
|
|
30
|
-
return new SchedulerPublishGraphQLGateway(client);
|
|
31
|
-
}, [client]);
|
|
32
|
-
const unpublishGateway = useMemo(() => {
|
|
33
|
-
return new SchedulerUnpublishGraphQLGateway(client);
|
|
34
|
-
}, [client]);
|
|
35
|
-
const scheduleAction = useMemo(() => {
|
|
36
|
-
return new ScheduleDialogAction({
|
|
37
|
-
cancelGateway,
|
|
38
|
-
publishGateway,
|
|
39
|
-
unpublishGateway
|
|
40
|
-
});
|
|
41
|
-
}, [publishGateway, unpublishGateway]);
|
|
42
|
-
const scheduled = useGetSchedulerItem({
|
|
43
|
-
gateway: getGateway,
|
|
44
|
-
id: entry.id,
|
|
45
|
-
modelId: contentModel.modelId
|
|
46
|
-
});
|
|
47
|
-
const {
|
|
48
|
-
OptionsMenuItem
|
|
49
|
-
} = ContentEntryEditorConfig.Actions.MenuItemAction.useOptionsMenuItem();
|
|
50
|
-
const schedulerEntry = useMemo(() => {
|
|
51
|
-
if (scheduled.error) {
|
|
52
|
-
console.error(scheduled.error);
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
return scheduled.item;
|
|
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]);
|
|
69
|
-
if (!canPublish("cms.contentEntry") && !canUnpublish("cms.contentEntry")) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
const action = entry.meta?.status === "published" ? "unpublish" : "publish";
|
|
73
|
-
return /*#__PURE__*/React.createElement(OptionsMenuItem, {
|
|
74
|
-
icon: /*#__PURE__*/React.createElement(ScheduleIcon, null),
|
|
75
|
-
label: `Schedule ${action}`,
|
|
76
|
-
onAction: showDialog,
|
|
77
|
-
disabled: !entry?.meta?.status || loading,
|
|
78
|
-
"data-testid": "cms.content-form.header.schedule"
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
//# sourceMappingURL=ScheduleEntryAction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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","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 <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"],"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,MA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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,CAACZ,eAAe;IACZa,IAAI,eAAE/C,KAAA,CAAA8C,aAAA,CAACtC,YAAY,MAAE,CAAE;IACvBwC,KAAK,EAAE,YAAYH,MAAM,EAAG;IAC5BI,QAAQ,EAAE1B,UAAW;IACrB2B,QAAQ,EAAE,CAACjC,KAAK,EAAE0B,IAAI,EAAEC,MAAM,IAAI1B,OAAQ;IAC1C,eAAa;EAAmC,CACnD,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { SchedulerEntry } from "@webiny/app-headless-cms-scheduler/types.js";
|
|
2
|
-
import type { ISchedulerGetExecuteParams, ISchedulerGetGateway } from "@webiny/app-headless-cms-scheduler";
|
|
3
|
-
export interface IUseGetItemParams extends ISchedulerGetExecuteParams {
|
|
4
|
-
gateway: ISchedulerGetGateway;
|
|
5
|
-
}
|
|
6
|
-
interface IState {
|
|
7
|
-
item: SchedulerEntry | null;
|
|
8
|
-
error: Error | null;
|
|
9
|
-
}
|
|
10
|
-
export declare const useGetSchedulerItem: (params: IUseGetItemParams) => IState;
|
|
11
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
export const useGetSchedulerItem = params => {
|
|
3
|
-
const {
|
|
4
|
-
gateway
|
|
5
|
-
} = params;
|
|
6
|
-
const [state, setState] = useState({
|
|
7
|
-
item: null,
|
|
8
|
-
error: null
|
|
9
|
-
});
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (!params.id || !params.modelId) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
(async () => {
|
|
15
|
-
try {
|
|
16
|
-
const result = await gateway.execute({
|
|
17
|
-
id: params.id,
|
|
18
|
-
modelId: params.modelId
|
|
19
|
-
});
|
|
20
|
-
setState({
|
|
21
|
-
item: result,
|
|
22
|
-
error: null
|
|
23
|
-
});
|
|
24
|
-
} catch (ex) {
|
|
25
|
-
setState({
|
|
26
|
-
error: ex,
|
|
27
|
-
item: null
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
})();
|
|
31
|
-
}, [params.id, params.modelId, gateway]);
|
|
32
|
-
return state;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=useGetSchedulerItem.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerCancelGraphQLGateway.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ApolloClient } from "apollo-client";
|
|
2
|
-
import type { IScheduleCancelExecuteParams, ISchedulerCancelGateway } from "@webiny/app-headless-cms-scheduler";
|
|
3
|
-
export declare class SchedulerCancelGraphQLGateway implements ISchedulerCancelGateway {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: ApolloClient<any>);
|
|
6
|
-
execute(params: IScheduleCancelExecuteParams): Promise<void>;
|
|
7
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import gql from "graphql-tag";
|
|
2
|
-
const createSchedulerCancelMutation = () => {
|
|
3
|
-
return gql`
|
|
4
|
-
mutation SchedulerCancel($modelId: String!, $id: ID!) {
|
|
5
|
-
cancelCmsSchedule(modelId: $modelId, id: $id) {
|
|
6
|
-
data
|
|
7
|
-
error {
|
|
8
|
-
message
|
|
9
|
-
code
|
|
10
|
-
data
|
|
11
|
-
stack
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
};
|
|
17
|
-
export class SchedulerCancelGraphQLGateway {
|
|
18
|
-
constructor(client) {
|
|
19
|
-
this.client = client;
|
|
20
|
-
}
|
|
21
|
-
async execute(params) {
|
|
22
|
-
const {
|
|
23
|
-
data: response,
|
|
24
|
-
errors
|
|
25
|
-
} = await this.client.mutate({
|
|
26
|
-
mutation: createSchedulerCancelMutation(),
|
|
27
|
-
variables: {
|
|
28
|
-
modelId: params.modelId,
|
|
29
|
-
id: params.id
|
|
30
|
-
},
|
|
31
|
-
fetchPolicy: "no-cache"
|
|
32
|
-
});
|
|
33
|
-
const result = response?.cancelCmsSchedule;
|
|
34
|
-
if (!result || errors?.length) {
|
|
35
|
-
console.error({
|
|
36
|
-
errors
|
|
37
|
-
});
|
|
38
|
-
throw new Error("Network error while canceling a schedule.");
|
|
39
|
-
}
|
|
40
|
-
if (!result.data) {
|
|
41
|
-
throw new Error(result.error?.message || "Could not cancel schedule entry.");
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=SchedulerCancelGraphQLGateway.js.map
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerCancelGraphQLGateway.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["gql","createSchedulerCancelMutation","SchedulerCancelGraphQLGateway","constructor","client","execute","params","data","response","errors","mutate","mutation","variables","modelId","id","fetchPolicy","result","cancelCmsSchedule","length","console","error","Error","message"],"sources":["SchedulerCancelGraphQLGateway.ts"],"sourcesContent":["import type { ApolloClient } from \"apollo-client\";\nimport type { CmsErrorResponse } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport gql from \"graphql-tag\";\nimport type {\n IScheduleCancelExecuteParams,\n ISchedulerCancelGateway\n} from \"@webiny/app-headless-cms-scheduler\";\n\nconst createSchedulerCancelMutation = () => {\n return gql`\n mutation SchedulerCancel($modelId: String!, $id: ID!) {\n cancelCmsSchedule(modelId: $modelId, id: $id) {\n data\n error {\n message\n code\n data\n stack\n }\n }\n }\n `;\n};\n\ninterface SchedulerCancelGraphQLMutationVariables {\n modelId: string;\n id: string;\n}\n\ninterface SchedulerCancelGraphQLMutationResponse {\n cancelCmsSchedule: {\n data: boolean | null;\n error: CmsErrorResponse | null;\n };\n}\n\nexport class SchedulerCancelGraphQLGateway implements ISchedulerCancelGateway {\n private readonly client: ApolloClient<any>;\n\n public constructor(client: ApolloClient<any>) {\n this.client = client;\n }\n\n public async execute(params: IScheduleCancelExecuteParams) {\n const { data: response, errors } = await this.client.mutate<\n SchedulerCancelGraphQLMutationResponse,\n SchedulerCancelGraphQLMutationVariables\n >({\n mutation: createSchedulerCancelMutation(),\n variables: {\n modelId: params.modelId,\n id: params.id\n },\n fetchPolicy: \"no-cache\"\n });\n\n const result = response?.cancelCmsSchedule;\n if (!result || errors?.length) {\n console.error({\n errors\n });\n throw new Error(\"Network error while canceling a schedule.\");\n }\n\n if (!result.data) {\n throw new Error(result.error?.message || \"Could not cancel schedule entry.\");\n }\n }\n}\n"],"mappings":"AAEA,OAAOA,GAAG,MAAM,aAAa;AAM7B,MAAMC,6BAA6B,GAAGA,CAAA,KAAM;EACxC,OAAOD,GAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;AAcD,OAAO,MAAME,6BAA6B,CAAoC;EAGnEC,WAAWA,CAACC,MAAyB,EAAE;IAC1C,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAaC,OAAOA,CAACC,MAAoC,EAAE;IACvD,MAAM;MAAEC,IAAI,EAAEC,QAAQ;MAAEC;IAAO,CAAC,GAAG,MAAM,IAAI,CAACL,MAAM,CAACM,MAAM,CAGzD;MACEC,QAAQ,EAAEV,6BAA6B,CAAC,CAAC;MACzCW,SAAS,EAAE;QACPC,OAAO,EAAEP,MAAM,CAACO,OAAO;QACvBC,EAAE,EAAER,MAAM,CAACQ;MACf,CAAC;MACDC,WAAW,EAAE;IACjB,CAAC,CAAC;IAEF,MAAMC,MAAM,GAAGR,QAAQ,EAAES,iBAAiB;IAC1C,IAAI,CAACD,MAAM,IAAIP,MAAM,EAAES,MAAM,EAAE;MAC3BC,OAAO,CAACC,KAAK,CAAC;QACVX;MACJ,CAAC,CAAC;MACF,MAAM,IAAIY,KAAK,CAAC,2CAA2C,CAAC;IAChE;IAEA,IAAI,CAACL,MAAM,CAACT,IAAI,EAAE;MACd,MAAM,IAAIc,KAAK,CAACL,MAAM,CAACI,KAAK,EAAEE,OAAO,IAAI,kCAAkC,CAAC;IAChF;EACJ;AACJ","ignoreList":[]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ApolloClient } from "apollo-client";
|
|
2
|
-
import type { ISchedulerGetExecuteParams, ISchedulerGetGateway } from "@webiny/app-headless-cms-scheduler";
|
|
3
|
-
export declare class SchedulerGetGraphQLGateway implements ISchedulerGetGateway {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: ApolloClient<any>);
|
|
6
|
-
execute(params: ISchedulerGetExecuteParams): Promise<{
|
|
7
|
-
model: Pick<import("@webiny/app-headless-cms-scheduler/types.js").CmsModel, "modelId">;
|
|
8
|
-
id: string;
|
|
9
|
-
title: string;
|
|
10
|
-
type: import("@webiny/app-headless-cms-scheduler/types.js").ScheduleType;
|
|
11
|
-
targetId: string;
|
|
12
|
-
scheduledBy: {
|
|
13
|
-
id: string;
|
|
14
|
-
displayName: string;
|
|
15
|
-
type: string;
|
|
16
|
-
};
|
|
17
|
-
publishOn?: Date | undefined;
|
|
18
|
-
unpublishOn?: Date | undefined;
|
|
19
|
-
} | null>;
|
|
20
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import gql from "graphql-tag";
|
|
2
|
-
import zod from "zod";
|
|
3
|
-
import { createZodError } from "@webiny/utils/createZodError.js";
|
|
4
|
-
import { schedulerEntrySchema } from "./schema/schedulerEntry.js";
|
|
5
|
-
import { createSchedulerEntryFields } from "./graphql/fields.js";
|
|
6
|
-
const createSchedulerGetQuery = () => {
|
|
7
|
-
return gql`
|
|
8
|
-
query SchedulerGetQuery($modelId: String!, $id: ID!) {
|
|
9
|
-
getCmsSchedule(modelId: $modelId, id: $id) {
|
|
10
|
-
data {
|
|
11
|
-
${createSchedulerEntryFields()}
|
|
12
|
-
}
|
|
13
|
-
error {
|
|
14
|
-
message
|
|
15
|
-
code
|
|
16
|
-
data
|
|
17
|
-
stack
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
};
|
|
23
|
-
const schema = zod.object({
|
|
24
|
-
data: schedulerEntrySchema
|
|
25
|
-
});
|
|
26
|
-
export class SchedulerGetGraphQLGateway {
|
|
27
|
-
constructor(client) {
|
|
28
|
-
this.client = client;
|
|
29
|
-
}
|
|
30
|
-
async execute(params) {
|
|
31
|
-
const {
|
|
32
|
-
data: response,
|
|
33
|
-
errors
|
|
34
|
-
} = await this.client.query({
|
|
35
|
-
query: createSchedulerGetQuery(),
|
|
36
|
-
variables: {
|
|
37
|
-
...params
|
|
38
|
-
},
|
|
39
|
-
fetchPolicy: "network-only"
|
|
40
|
-
});
|
|
41
|
-
const result = response.getCmsSchedule;
|
|
42
|
-
if (!result || errors?.length) {
|
|
43
|
-
console.error({
|
|
44
|
-
errors
|
|
45
|
-
});
|
|
46
|
-
throw new Error("Network error while getting schedule entry.");
|
|
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;
|
|
54
|
-
}
|
|
55
|
-
const validated = await schema.safeParseAsync(result);
|
|
56
|
-
if (!validated.success) {
|
|
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;
|
|
64
|
-
}
|
|
65
|
-
return validated.data.data;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
//# sourceMappingURL=SchedulerGetGraphQLGateway.js.map
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerGetGraphQLGateway.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/index.js\";\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\";\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\ntype SchedulerGetGraphQLQueryVariables = 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,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AAC,CACL,CAAC;MACD,MAAMM,GAAG;IACb;IAEA,OAAOH,SAAS,CAAClB,IAAI,CAACA,IAAI;EAC9B;AACJ","ignoreList":[]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ApolloClient } from "apollo-client";
|
|
2
|
-
import type { ISchedulerListExecuteParams, ISchedulerListGateway, ISchedulerListGatewayResponse } from "@webiny/app-headless-cms-scheduler";
|
|
3
|
-
export declare class SchedulerListGraphQLGateway implements ISchedulerListGateway {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: ApolloClient<any>);
|
|
6
|
-
execute(params: ISchedulerListExecuteParams): Promise<ISchedulerListGatewayResponse>;
|
|
7
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import gql from "graphql-tag";
|
|
2
|
-
import zod from "zod";
|
|
3
|
-
import { createZodError } from "@webiny/utils/createZodError.js";
|
|
4
|
-
import { schedulerEntrySchema } from "./schema/schedulerEntry.js";
|
|
5
|
-
import { createSchedulerEntryFields } from "./graphql/fields.js";
|
|
6
|
-
const createSchedulerListQuery = () => {
|
|
7
|
-
return gql`
|
|
8
|
-
query SchedulerListQuery(
|
|
9
|
-
$modelId: String!
|
|
10
|
-
$where: CmsListSchedulesWhereInput
|
|
11
|
-
$sort: [CmsListSchedulesSorter!]
|
|
12
|
-
$limit: Int
|
|
13
|
-
$after: String
|
|
14
|
-
) {
|
|
15
|
-
listCmsSchedules(
|
|
16
|
-
modelId: $modelId
|
|
17
|
-
where: $where
|
|
18
|
-
sort: $sort
|
|
19
|
-
limit: $limit
|
|
20
|
-
after: $after
|
|
21
|
-
) {
|
|
22
|
-
data {
|
|
23
|
-
${createSchedulerEntryFields()}
|
|
24
|
-
}
|
|
25
|
-
meta {
|
|
26
|
-
totalCount
|
|
27
|
-
cursor
|
|
28
|
-
hasMoreItems
|
|
29
|
-
}
|
|
30
|
-
error {
|
|
31
|
-
message
|
|
32
|
-
code
|
|
33
|
-
data
|
|
34
|
-
stack
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
};
|
|
40
|
-
const schema = zod.object({
|
|
41
|
-
data: zod.array(schedulerEntrySchema),
|
|
42
|
-
meta: zod.object({
|
|
43
|
-
totalCount: zod.number(),
|
|
44
|
-
cursor: zod.string().nullable(),
|
|
45
|
-
hasMoreItems: zod.boolean()
|
|
46
|
-
})
|
|
47
|
-
});
|
|
48
|
-
export class SchedulerListGraphQLGateway {
|
|
49
|
-
constructor(client) {
|
|
50
|
-
this.client = client;
|
|
51
|
-
}
|
|
52
|
-
async execute(params) {
|
|
53
|
-
const {
|
|
54
|
-
data: response,
|
|
55
|
-
errors
|
|
56
|
-
} = await this.client.query({
|
|
57
|
-
query: createSchedulerListQuery(),
|
|
58
|
-
variables: {
|
|
59
|
-
...params
|
|
60
|
-
},
|
|
61
|
-
fetchPolicy: "network-only"
|
|
62
|
-
});
|
|
63
|
-
const result = response.listCmsSchedules;
|
|
64
|
-
if (!result || errors?.length) {
|
|
65
|
-
console.error({
|
|
66
|
-
errors
|
|
67
|
-
});
|
|
68
|
-
throw new Error("Network error while listing scheduled entries.");
|
|
69
|
-
}
|
|
70
|
-
if (!result.data || !result.meta) {
|
|
71
|
-
throw new Error(result.error?.message || "Could not fetch scheduled entries.");
|
|
72
|
-
}
|
|
73
|
-
const validated = await schema.safeParseAsync(result);
|
|
74
|
-
if (!validated.success) {
|
|
75
|
-
const err = createZodError(validated.error);
|
|
76
|
-
console.error(err);
|
|
77
|
-
throw err;
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
items: validated.data.data,
|
|
81
|
-
meta: validated.data.meta
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
//# sourceMappingURL=SchedulerListGraphQLGateway.js.map
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerListGraphQLGateway.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 {\n CmsErrorResponse,\n CmsMetaResponse\n} from \"@webiny/app-headless-cms-common/types/index.js\";\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\";\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\ntype SchedulerListGraphQLQueryVariables = 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":"AAKA,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,C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ignoreList":[]}
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ApolloClient } from "apollo-client";
|
|
2
|
-
import type { ISchedulerPublishExecuteParams, ISchedulerPublishGateway, ISchedulerPublishGatewayResponse } from "@webiny/app-headless-cms-scheduler";
|
|
3
|
-
export declare class SchedulerPublishGraphQLGateway implements ISchedulerPublishGateway {
|
|
4
|
-
private readonly client;
|
|
5
|
-
constructor(client: ApolloClient<any>);
|
|
6
|
-
execute(params: ISchedulerPublishExecuteParams): Promise<ISchedulerPublishGatewayResponse>;
|
|
7
|
-
}
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import zod from "zod";
|
|
2
|
-
import { schedulerEntrySchema } from "./schema/schedulerEntry.js";
|
|
3
|
-
import { createZodError } from "@webiny/utils/createZodError.js";
|
|
4
|
-
import gql from "graphql-tag";
|
|
5
|
-
import { ScheduleType } from "@webiny/app-headless-cms-scheduler/types.js";
|
|
6
|
-
import { createSchedulerEntryFields } from "./graphql/fields.js";
|
|
7
|
-
const createSchedulerPublishMutation = () => {
|
|
8
|
-
return gql`
|
|
9
|
-
mutation SchedulerPublish($modelId: String!, $id: ID!, $scheduleFor: DateTime, $type: CmsScheduleRecordType!) {
|
|
10
|
-
createCmsSchedule(modelId: $modelId, id: $id, scheduleFor: $scheduleFor, type: $type) {
|
|
11
|
-
data {
|
|
12
|
-
${createSchedulerEntryFields()}
|
|
13
|
-
}
|
|
14
|
-
error {
|
|
15
|
-
message
|
|
16
|
-
code
|
|
17
|
-
data
|
|
18
|
-
stack
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
};
|
|
24
|
-
const schema = zod.object({
|
|
25
|
-
data: schedulerEntrySchema
|
|
26
|
-
});
|
|
27
|
-
export class SchedulerPublishGraphQLGateway {
|
|
28
|
-
constructor(client) {
|
|
29
|
-
this.client = client;
|
|
30
|
-
}
|
|
31
|
-
async execute(params) {
|
|
32
|
-
const {
|
|
33
|
-
data: response,
|
|
34
|
-
errors
|
|
35
|
-
} = await this.client.mutate({
|
|
36
|
-
mutation: createSchedulerPublishMutation(),
|
|
37
|
-
variables: {
|
|
38
|
-
modelId: params.modelId,
|
|
39
|
-
id: params.id,
|
|
40
|
-
scheduleFor: params.scheduleOn,
|
|
41
|
-
type: ScheduleType.publish
|
|
42
|
-
},
|
|
43
|
-
fetchPolicy: "no-cache"
|
|
44
|
-
});
|
|
45
|
-
const result = response?.createCmsSchedule;
|
|
46
|
-
if (!result || errors?.length) {
|
|
47
|
-
console.error({
|
|
48
|
-
errors
|
|
49
|
-
});
|
|
50
|
-
throw new Error("Network error while creating a schedule.");
|
|
51
|
-
}
|
|
52
|
-
if (!result.data) {
|
|
53
|
-
throw new Error(result.error?.message || "Could not schedule entry to be published.");
|
|
54
|
-
}
|
|
55
|
-
const validated = await schema.safeParseAsync(result);
|
|
56
|
-
if (!validated.success) {
|
|
57
|
-
throw createZodError(validated.error);
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
item: validated.data.data
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=SchedulerPublishGraphQLGateway.js.map
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerPublishGraphQLGateway.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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","scheduleFor","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.js\";\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\";\nimport { createSchedulerEntryFields } from \"./graphql/fields.js\";\n\nconst createSchedulerPublishMutation = () => {\n return gql`\n mutation SchedulerPublish($modelId: String!, $id: ID!, $scheduleFor: DateTime, $type: CmsScheduleRecordType!) {\n createCmsSchedule(modelId: $modelId, id: $id, scheduleFor: $scheduleFor, type: $type) {\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 scheduleFor: Date;\n type: ScheduleType.publish;\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 scheduleFor: params.scheduleOn,\n type: ScheduleType.publish\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 throw createZodError(validated.error);\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,iCAAiC;AAChE,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;AAgBD,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,WAAW,EAAER,MAAM,CAACS,UAAU;QAC9BC,IAAI,EAAEpB,YAAY,CAACqB;MACvB,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,MAAMlC,cAAc,CAACgC,SAAS,CAACH,KAAK,CAAC;IACzC;IACA,OAAO;MACHM,IAAI,EAAEH,SAAS,CAACzB,IAAI,CAACA;IACzB,CAAC;EACL;AACJ","ignoreList":[]}
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ApolloClient } from "apollo-client";
|
|
2
|
-
import type { ISchedulerUnpublishExecuteParams, ISchedulerUnpublishGateway } from "@webiny/app-headless-cms-scheduler";
|
|
3
|
-
import { ScheduleType } from "@webiny/app-headless-cms-scheduler/types.js";
|
|
4
|
-
export declare class SchedulerUnpublishGraphQLGateway implements ISchedulerUnpublishGateway {
|
|
5
|
-
private readonly client;
|
|
6
|
-
constructor(client: ApolloClient<any>);
|
|
7
|
-
execute(params: ISchedulerUnpublishExecuteParams): Promise<{
|
|
8
|
-
item: {
|
|
9
|
-
model: Pick<import("@webiny/app-headless-cms-scheduler/types.js").CmsModel, "modelId">;
|
|
10
|
-
id: string;
|
|
11
|
-
title: string;
|
|
12
|
-
type: ScheduleType;
|
|
13
|
-
targetId: string;
|
|
14
|
-
scheduledBy: {
|
|
15
|
-
id: string;
|
|
16
|
-
displayName: string;
|
|
17
|
-
type: string;
|
|
18
|
-
};
|
|
19
|
-
publishOn?: Date | undefined;
|
|
20
|
-
unpublishOn?: Date | undefined;
|
|
21
|
-
};
|
|
22
|
-
}>;
|
|
23
|
-
}
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import zod from "zod";
|
|
2
|
-
import { schedulerEntrySchema } from "./schema/schedulerEntry.js";
|
|
3
|
-
import { createZodError } from "@webiny/utils/createZodError.js";
|
|
4
|
-
import gql from "graphql-tag";
|
|
5
|
-
import { ScheduleType } from "@webiny/app-headless-cms-scheduler/types.js";
|
|
6
|
-
import { createSchedulerEntryFields } from "./graphql/fields.js";
|
|
7
|
-
const createSchedulerUnpublishMutation = () => {
|
|
8
|
-
return gql`
|
|
9
|
-
mutation SchedulerUnpublish($modelId: String!, $id: ID!, $scheduleFor: DateTime, $type: CmsScheduleRecordType!) {
|
|
10
|
-
createCmsSchedule(modelId: $modelId, id: $id, scheduleFor: $scheduleFor, type: $type) {
|
|
11
|
-
data {
|
|
12
|
-
${createSchedulerEntryFields()}
|
|
13
|
-
}
|
|
14
|
-
error {
|
|
15
|
-
message
|
|
16
|
-
code
|
|
17
|
-
data
|
|
18
|
-
stack
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
};
|
|
24
|
-
const schema = zod.object({
|
|
25
|
-
data: schedulerEntrySchema
|
|
26
|
-
});
|
|
27
|
-
export class SchedulerUnpublishGraphQLGateway {
|
|
28
|
-
constructor(client) {
|
|
29
|
-
this.client = client;
|
|
30
|
-
}
|
|
31
|
-
async execute(params) {
|
|
32
|
-
const {
|
|
33
|
-
data: response,
|
|
34
|
-
errors
|
|
35
|
-
} = await this.client.mutate({
|
|
36
|
-
mutation: createSchedulerUnpublishMutation(),
|
|
37
|
-
variables: {
|
|
38
|
-
modelId: params.modelId,
|
|
39
|
-
id: params.id,
|
|
40
|
-
scheduleFor: params.scheduleOn,
|
|
41
|
-
type: ScheduleType.unpublish
|
|
42
|
-
},
|
|
43
|
-
fetchPolicy: "no-cache"
|
|
44
|
-
});
|
|
45
|
-
const result = response?.createCmsSchedule;
|
|
46
|
-
if (!result || errors?.length) {
|
|
47
|
-
console.error({
|
|
48
|
-
errors
|
|
49
|
-
});
|
|
50
|
-
throw new Error("Network error while creating a schedule.");
|
|
51
|
-
}
|
|
52
|
-
if (!result.data) {
|
|
53
|
-
throw new Error(result.error?.message || "Could not schedule entry to be unpublished.");
|
|
54
|
-
}
|
|
55
|
-
const validated = await schema.safeParseAsync(result);
|
|
56
|
-
if (!validated.success) {
|
|
57
|
-
const err = createZodError(validated.error);
|
|
58
|
-
console.error(err);
|
|
59
|
-
throw err;
|
|
60
|
-
}
|
|
61
|
-
return {
|
|
62
|
-
item: validated.data.data
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=SchedulerUnpublishGraphQLGateway.js.map
|
package/admin/components/ContentEntries/Scheduler/adapters/SchedulerUnpublishGraphQLGateway.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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","scheduleFor","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.js\";\nimport gql from \"graphql-tag\";\nimport type {\n ISchedulerUnpublishExecuteParams,\n ISchedulerUnpublishGateway\n} from \"@webiny/app-headless-cms-scheduler\";\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!, $scheduleFor: DateTime, $type: CmsScheduleRecordType!) {\n createCmsSchedule(modelId: $modelId, id: $id, scheduleFor: $scheduleFor, type: $type) {\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 scheduleFor: Date;\n type: ScheduleType.unpublish;\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 scheduleFor: params.scheduleOn,\n type: ScheduleType.unpublish\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 }\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