@webiny/api-website-builder-scheduler 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/constants.d.ts +4 -0
- package/constants.js +6 -0
- package/constants.js.map +1 -0
- package/context.js +22 -6
- package/context.js.map +1 -1
- package/exports/api/website-builder/scheduler.d.ts +4 -0
- package/exports/api/website-builder/scheduler.js +6 -0
- package/exports/api/website-builder/scheduler.js.map +1 -0
- package/features/CancelScheduledActionOnChange/CancelScheduledActionOnPageDeleteEventHandler.d.ts +18 -0
- package/features/CancelScheduledActionOnChange/CancelScheduledActionOnPageDeleteEventHandler.js +43 -0
- package/features/CancelScheduledActionOnChange/CancelScheduledActionOnPageDeleteEventHandler.js.map +1 -0
- package/features/{CancelScheduledActionOnPageChange/CancelScheduledActionOnPublishEventHandler.d.ts → CancelScheduledActionOnChange/CancelScheduledActionOnPagePublishEventHandler.d.ts} +4 -4
- package/features/{CancelScheduledActionOnPageChange/CancelScheduledActionOnPublishEventHandler.js → CancelScheduledActionOnChange/CancelScheduledActionOnPagePublishEventHandler.js} +9 -10
- package/features/CancelScheduledActionOnChange/CancelScheduledActionOnPagePublishEventHandler.js.map +1 -0
- package/features/{CancelScheduledActionOnPageChange/CancelScheduledActionOnUnpublishEventHandler.d.ts → CancelScheduledActionOnChange/CancelScheduledActionOnPageUnpublishEventHandler.d.ts} +8 -8
- package/features/{CancelScheduledActionOnPageChange/CancelScheduledActionOnUnpublishEventHandler.js → CancelScheduledActionOnChange/CancelScheduledActionOnPageUnpublishEventHandler.js} +14 -15
- package/features/CancelScheduledActionOnChange/CancelScheduledActionOnPageUnpublishEventHandler.js.map +1 -0
- package/features/CancelScheduledActionOnChange/CancelScheduledActionOnRedirectDeleteEventHandler.d.ts +19 -0
- package/features/CancelScheduledActionOnChange/CancelScheduledActionOnRedirectDeleteEventHandler.js +43 -0
- package/features/CancelScheduledActionOnChange/CancelScheduledActionOnRedirectDeleteEventHandler.js.map +1 -0
- package/features/CancelScheduledActionOnChange/feature.d.ts +8 -0
- package/features/CancelScheduledActionOnChange/feature.js +24 -0
- package/features/CancelScheduledActionOnChange/feature.js.map +1 -0
- package/features/NamespaceHandler/PageNamespaceHandler.d.ts +14 -0
- package/features/NamespaceHandler/PageNamespaceHandler.js +38 -0
- package/features/NamespaceHandler/PageNamespaceHandler.js.map +1 -0
- package/features/NamespaceHandler/RedirectNamespaceHandler.d.ts +14 -0
- package/features/NamespaceHandler/RedirectNamespaceHandler.js +38 -0
- package/features/NamespaceHandler/RedirectNamespaceHandler.js.map +1 -0
- package/features/PublishActionHandler/PublishPageActionHandler.d.ts +16 -0
- package/features/{SchedulePageAction/actionHandlers → PublishActionHandler}/PublishPageActionHandler.js +8 -11
- package/features/PublishActionHandler/PublishPageActionHandler.js.map +1 -0
- package/features/PublishActionHandler/PublishRedirectActionHandler.d.ts +17 -0
- package/features/PublishActionHandler/PublishRedirectActionHandler.js +32 -0
- package/features/PublishActionHandler/PublishRedirectActionHandler.js.map +1 -0
- package/features/SchedulePublishPageUseCase/SchedulePublishPageUseCase.d.ts +11 -0
- package/features/SchedulePublishPageUseCase/SchedulePublishPageUseCase.js +30 -0
- package/features/SchedulePublishPageUseCase/SchedulePublishPageUseCase.js.map +1 -0
- package/features/SchedulePublishPageUseCase/abstractions.d.ts +21 -0
- package/features/SchedulePublishPageUseCase/abstractions.js +5 -0
- package/features/SchedulePublishPageUseCase/abstractions.js.map +1 -0
- package/features/SchedulePublishRedirectUseCase/SchedulePublishRedirectUseCase.d.ts +11 -0
- package/features/SchedulePublishRedirectUseCase/SchedulePublishRedirectUseCase.js +30 -0
- package/features/SchedulePublishRedirectUseCase/SchedulePublishRedirectUseCase.js.map +1 -0
- package/features/SchedulePublishRedirectUseCase/abstractions.d.ts +21 -0
- package/features/SchedulePublishRedirectUseCase/abstractions.js +5 -0
- package/features/SchedulePublishRedirectUseCase/abstractions.js.map +1 -0
- package/features/ScheduleUnpublishPageUseCase/ScheduleUnpublishPageUseCase.d.ts +11 -0
- package/features/ScheduleUnpublishPageUseCase/ScheduleUnpublishPageUseCase.js +30 -0
- package/features/ScheduleUnpublishPageUseCase/ScheduleUnpublishPageUseCase.js.map +1 -0
- package/features/ScheduleUnpublishPageUseCase/abstractions.d.ts +21 -0
- package/features/ScheduleUnpublishPageUseCase/abstractions.js +5 -0
- package/features/ScheduleUnpublishPageUseCase/abstractions.js.map +1 -0
- package/features/ScheduleUnpublishRedirectUseCase/ScheduleUnpublishRedirectUseCase.d.ts +11 -0
- package/features/ScheduleUnpublishRedirectUseCase/ScheduleUnpublishRedirectUseCase.js +30 -0
- package/features/ScheduleUnpublishRedirectUseCase/ScheduleUnpublishRedirectUseCase.js.map +1 -0
- package/features/ScheduleUnpublishRedirectUseCase/abstractions.d.ts +21 -0
- package/features/ScheduleUnpublishRedirectUseCase/abstractions.js +5 -0
- package/features/ScheduleUnpublishRedirectUseCase/abstractions.js.map +1 -0
- package/features/UnpublishActionHandler/UnpublishPageActionHandler.d.ts +17 -0
- package/features/{SchedulePageAction/actionHandlers → UnpublishActionHandler}/UnpublishPageActionHandler.js +7 -11
- package/features/UnpublishActionHandler/UnpublishPageActionHandler.js.map +1 -0
- package/features/UnpublishActionHandler/UnpublishRedirectActionHandler.d.ts +18 -0
- package/features/UnpublishActionHandler/UnpublishRedirectActionHandler.js +31 -0
- package/features/UnpublishActionHandler/UnpublishRedirectActionHandler.js.map +1 -0
- package/index.d.ts +2 -6
- package/index.js +1 -7
- package/index.js.map +1 -1
- package/package.json +18 -19
- package/types.d.ts +6 -0
- package/types.js +3 -0
- package/types.js.map +1 -0
- package/utils/namespace.d.ts +3 -0
- package/utils/namespace.js +16 -0
- package/utils/namespace.js.map +1 -0
- package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnDeleteEventHandler.d.ts +0 -20
- package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnDeleteEventHandler.js +0 -48
- package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnDeleteEventHandler.js.map +0 -1
- package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnPublishEventHandler.js.map +0 -1
- package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnUnpublishEventHandler.js.map +0 -1
- package/features/CancelScheduledActionOnPageChange/feature.d.ts +0 -8
- package/features/CancelScheduledActionOnPageChange/feature.js +0 -22
- package/features/CancelScheduledActionOnPageChange/feature.js.map +0 -1
- package/features/CancelScheduledPageAction/CancelScheduledPageActionUseCase.d.ts +0 -15
- package/features/CancelScheduledPageAction/CancelScheduledPageActionUseCase.js +0 -25
- package/features/CancelScheduledPageAction/CancelScheduledPageActionUseCase.js.map +0 -1
- package/features/CancelScheduledPageAction/abstractions.d.ts +0 -22
- package/features/CancelScheduledPageAction/abstractions.js +0 -11
- package/features/CancelScheduledPageAction/abstractions.js.map +0 -1
- package/features/CancelScheduledPageAction/feature.d.ts +0 -6
- package/features/CancelScheduledPageAction/feature.js +0 -16
- package/features/CancelScheduledPageAction/feature.js.map +0 -1
- package/features/CancelScheduledPageAction/index.d.ts +0 -1
- package/features/CancelScheduledPageAction/index.js +0 -3
- package/features/CancelScheduledPageAction/index.js.map +0 -1
- package/features/SchedulePageAction/SchedulePageActionUseCase.d.ts +0 -25
- package/features/SchedulePageAction/SchedulePageActionUseCase.js +0 -74
- package/features/SchedulePageAction/SchedulePageActionUseCase.js.map +0 -1
- package/features/SchedulePageAction/abstractions.d.ts +0 -42
- package/features/SchedulePageAction/abstractions.js +0 -17
- package/features/SchedulePageAction/abstractions.js.map +0 -1
- package/features/SchedulePageAction/actionHandlers/PublishPageActionHandler.d.ts +0 -22
- package/features/SchedulePageAction/actionHandlers/PublishPageActionHandler.js.map +0 -1
- package/features/SchedulePageAction/actionHandlers/UnpublishPageActionHandler.d.ts +0 -22
- package/features/SchedulePageAction/actionHandlers/UnpublishPageActionHandler.js.map +0 -1
- package/features/SchedulePageAction/feature.d.ts +0 -7
- package/features/SchedulePageAction/feature.js +0 -21
- package/features/SchedulePageAction/feature.js.map +0 -1
- package/features/SchedulePageAction/index.d.ts +0 -1
- package/features/SchedulePageAction/index.js +0 -3
- package/features/SchedulePageAction/index.js.map +0 -1
- package/graphql/ActionMapper.d.ts +0 -12
- package/graphql/ActionMapper.js +0 -15
- package/graphql/ActionMapper.js.map +0 -1
- package/graphql/dates.d.ts +0 -6
- package/graphql/dates.js +0 -9
- package/graphql/dates.js.map +0 -1
- package/graphql/index.d.ts +0 -2
- package/graphql/index.js +0 -239
- package/graphql/index.js.map +0 -1
- package/graphql/schema.d.ts +0 -142
- package/graphql/schema.js +0 -76
- package/graphql/schema.js.map +0 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
* This will register both API and Handler plugins for the Website Builder Scheduler.
|
|
4
|
-
* API plugin will provide the GraphQL API and code for managing the scheduled WB page actions.
|
|
5
|
-
*/
|
|
6
|
-
export declare const createWebsiteBuilderScheduler: () => PluginCollection;
|
|
1
|
+
import { ContextPlugin } from "@webiny/api";
|
|
2
|
+
export declare const createWebsiteBuilderScheduler: () => ContextPlugin[];
|
package/index.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { createWebsiteBuilderScheduleContext } from "./context.js";
|
|
2
|
-
import { createWbSchedulerGraphQL } from "./graphql/index.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This will register both API and Handler plugins for the Website Builder Scheduler.
|
|
6
|
-
* API plugin will provide the GraphQL API and code for managing the scheduled WB page actions.
|
|
7
|
-
*/
|
|
8
2
|
export const createWebsiteBuilderScheduler = () => {
|
|
9
|
-
return [createWebsiteBuilderScheduleContext()
|
|
3
|
+
return [createWebsiteBuilderScheduleContext()];
|
|
10
4
|
};
|
|
11
5
|
|
|
12
6
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createWebsiteBuilderScheduleContext","
|
|
1
|
+
{"version":3,"names":["createWebsiteBuilderScheduleContext","createWebsiteBuilderScheduler"],"sources":["index.ts"],"sourcesContent":["import { createWebsiteBuilderScheduleContext } from \"~/context.js\";\nimport { ContextPlugin } from \"@webiny/api\";\n\nexport const createWebsiteBuilderScheduler = (): ContextPlugin[] => {\n return [createWebsiteBuilderScheduleContext()];\n};\n"],"mappings":"AAAA,SAASA,mCAAmC;AAG5C,OAAO,MAAMC,6BAA6B,GAAGA,CAAA,KAAuB;EAChE,OAAO,CAACD,mCAAmC,CAAC,CAAC,CAAC;AAClD,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-website-builder-scheduler",
|
|
3
|
-
"version": "6.0.0",
|
|
3
|
+
"version": "6.1.0-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"description": "Schedule for Webiny Website Builder",
|
|
@@ -14,31 +14,30 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@webiny/api": "6.0.0",
|
|
18
|
-
"@webiny/api-scheduler": "6.0.0",
|
|
19
|
-
"@webiny/api-website-builder": "6.0.0",
|
|
20
|
-
"@webiny/feature": "6.0.0",
|
|
21
|
-
"@webiny/handler-graphql": "6.0.0"
|
|
22
|
-
"@webiny/utils": "6.0.0",
|
|
23
|
-
"zod": "3.25.76"
|
|
17
|
+
"@webiny/api": "6.1.0-beta.0",
|
|
18
|
+
"@webiny/api-scheduler": "6.1.0-beta.0",
|
|
19
|
+
"@webiny/api-website-builder": "6.1.0-beta.0",
|
|
20
|
+
"@webiny/feature": "6.1.0-beta.0",
|
|
21
|
+
"@webiny/handler-graphql": "6.1.0-beta.0"
|
|
24
22
|
},
|
|
25
23
|
"devDependencies": {
|
|
26
|
-
"@webiny/api-core": "6.0.0",
|
|
27
|
-
"@webiny/api-headless-cms": "6.0.0",
|
|
28
|
-
"@webiny/aws-sdk": "6.0.0",
|
|
29
|
-
"@webiny/build-tools": "6.0.0",
|
|
30
|
-
"@webiny/handler": "6.0.0",
|
|
31
|
-
"@webiny/handler-aws": "6.0.0",
|
|
32
|
-
"@webiny/plugins": "6.0.0",
|
|
33
|
-
"@webiny/project-utils": "6.0.0",
|
|
34
|
-
"@webiny/
|
|
24
|
+
"@webiny/api-core": "6.1.0-beta.0",
|
|
25
|
+
"@webiny/api-headless-cms": "6.1.0-beta.0",
|
|
26
|
+
"@webiny/aws-sdk": "6.1.0-beta.0",
|
|
27
|
+
"@webiny/build-tools": "6.1.0-beta.0",
|
|
28
|
+
"@webiny/handler": "6.1.0-beta.0",
|
|
29
|
+
"@webiny/handler-aws": "6.1.0-beta.0",
|
|
30
|
+
"@webiny/plugins": "6.1.0-beta.0",
|
|
31
|
+
"@webiny/project-utils": "6.1.0-beta.0",
|
|
32
|
+
"@webiny/tasks": "6.1.0-beta.0",
|
|
33
|
+
"@webiny/wcp": "6.1.0-beta.0",
|
|
35
34
|
"aws-sdk-client-mock": "4.1.0",
|
|
36
35
|
"typescript": "5.9.3",
|
|
37
|
-
"vitest": "4.
|
|
36
|
+
"vitest": "4.1.2"
|
|
38
37
|
},
|
|
39
38
|
"publishConfig": {
|
|
40
39
|
"access": "public",
|
|
41
40
|
"directory": "dist"
|
|
42
41
|
},
|
|
43
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "a3bd3695c66c79238e380d7360d9731b5fcf9c87"
|
|
44
43
|
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { INamespaceHandlerResult } from "@webiny/api-scheduler/features/NamespaceHandler/abstractions.js";
|
|
2
|
+
import { SCHEDULED_ACTION_TYPE_PAGE, SCHEDULED_ACTION_TYPE_REDIRECT } from "./constants.js";
|
|
3
|
+
export type IScheduledActionPayloadType = typeof SCHEDULED_ACTION_TYPE_PAGE | typeof SCHEDULED_ACTION_TYPE_REDIRECT;
|
|
4
|
+
export interface IScheduledActionPayload extends INamespaceHandlerResult {
|
|
5
|
+
type: IScheduledActionPayloadType;
|
|
6
|
+
}
|
package/types.js
ADDED
package/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { INamespaceHandlerResult } from \"@webiny/api-scheduler/features/NamespaceHandler/abstractions.js\";\nimport { SCHEDULED_ACTION_TYPE_PAGE, SCHEDULED_ACTION_TYPE_REDIRECT } from \"~/constants.js\";\n\nexport type IScheduledActionPayloadType =\n | typeof SCHEDULED_ACTION_TYPE_PAGE\n | typeof SCHEDULED_ACTION_TYPE_REDIRECT;\n\nexport interface IScheduledActionPayload extends INamespaceHandlerResult {\n type: IScheduledActionPayloadType;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SCHEDULED_ACTION_TYPES, WEBSITE_BUILDER_NAMESPACE } from "../constants.js";
|
|
2
|
+
export const createNamespace = type => {
|
|
3
|
+
return `${WEBSITE_BUILDER_NAMESPACE}${type}`;
|
|
4
|
+
};
|
|
5
|
+
export const extractModelIdFromNamespace = namespace => {
|
|
6
|
+
if (!namespace.startsWith(WEBSITE_BUILDER_NAMESPACE)) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
const value = namespace.substring(WEBSITE_BUILDER_NAMESPACE.length) || null;
|
|
10
|
+
if (!value) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return SCHEDULED_ACTION_TYPES.includes(value) ? value : null;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SCHEDULED_ACTION_TYPES","WEBSITE_BUILDER_NAMESPACE","createNamespace","type","extractModelIdFromNamespace","namespace","startsWith","value","substring","length","includes"],"sources":["namespace.ts"],"sourcesContent":["import type { IScheduledActionPayloadType } from \"~/types.js\";\nimport { SCHEDULED_ACTION_TYPES, WEBSITE_BUILDER_NAMESPACE } from \"~/constants.js\";\n\nexport const createNamespace = (type: IScheduledActionPayloadType) => {\n return `${WEBSITE_BUILDER_NAMESPACE}${type}`;\n};\n\nexport const extractModelIdFromNamespace = (\n namespace: string\n): IScheduledActionPayloadType | null => {\n if (!namespace.startsWith(WEBSITE_BUILDER_NAMESPACE)) {\n return null;\n }\n const value = namespace.substring(WEBSITE_BUILDER_NAMESPACE.length) || null;\n if (!value) {\n return null;\n }\n return SCHEDULED_ACTION_TYPES.includes(value as IScheduledActionPayloadType)\n ? (value as IScheduledActionPayloadType)\n : null;\n};\n"],"mappings":"AACA,SAASA,sBAAsB,EAAEC,yBAAyB;AAE1D,OAAO,MAAMC,eAAe,GAAIC,IAAiC,IAAK;EAClE,OAAO,GAAGF,yBAAyB,GAAGE,IAAI,EAAE;AAChD,CAAC;AAED,OAAO,MAAMC,2BAA2B,GACpCC,SAAiB,IACoB;EACrC,IAAI,CAACA,SAAS,CAACC,UAAU,CAACL,yBAAyB,CAAC,EAAE;IAClD,OAAO,IAAI;EACf;EACA,MAAMM,KAAK,GAAGF,SAAS,CAACG,SAAS,CAACP,yBAAyB,CAACQ,MAAM,CAAC,IAAI,IAAI;EAC3E,IAAI,CAACF,KAAK,EAAE;IACR,OAAO,IAAI;EACf;EACA,OAAOP,sBAAsB,CAACU,QAAQ,CAACH,KAAoC,CAAC,GACrEA,KAAK,GACN,IAAI;AACd,CAAC","ignoreList":[]}
|
package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnDeleteEventHandler.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { PageAfterDeleteEventHandler } from "@webiny/api-website-builder/features/pages/DeletePage/abstractions.js";
|
|
2
|
-
import { ListScheduledActionsUseCase, CancelScheduledActionUseCase } from "@webiny/api-scheduler";
|
|
3
|
-
/**
|
|
4
|
-
* Cancels scheduled actions when a page is deleted.
|
|
5
|
-
*
|
|
6
|
-
* When a user deletes a page, any scheduled publish/unpublish
|
|
7
|
-
* actions for all of its revisions should be canceled since the page
|
|
8
|
-
* no longer exists.
|
|
9
|
-
*/
|
|
10
|
-
declare class CancelScheduledActionOnDeleteEventHandlerImpl implements PageAfterDeleteEventHandler.Interface {
|
|
11
|
-
private listScheduledActions;
|
|
12
|
-
private cancelScheduledAction;
|
|
13
|
-
constructor(listScheduledActions: ListScheduledActionsUseCase.Interface, cancelScheduledAction: CancelScheduledActionUseCase.Interface);
|
|
14
|
-
handle(event: PageAfterDeleteEventHandler.Event): Promise<void>;
|
|
15
|
-
private listSchedules;
|
|
16
|
-
}
|
|
17
|
-
export declare const CancelScheduledActionOnDeleteEventHandler: typeof CancelScheduledActionOnDeleteEventHandlerImpl & {
|
|
18
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/EventPublisher").DomainEvent<import("@webiny/api-website-builder/features/pages/DeletePage/abstractions.js").PageAfterDeletePayload>>>;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnDeleteEventHandler.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { PageAfterDeleteEventHandler } from "@webiny/api-website-builder/features/pages/DeletePage/abstractions.js";
|
|
2
|
-
import { ListScheduledActionsUseCase, CancelScheduledActionUseCase } from "@webiny/api-scheduler";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Cancels scheduled actions when a page is deleted.
|
|
6
|
-
*
|
|
7
|
-
* When a user deletes a page, any scheduled publish/unpublish
|
|
8
|
-
* actions for all of its revisions should be canceled since the page
|
|
9
|
-
* no longer exists.
|
|
10
|
-
*/
|
|
11
|
-
class CancelScheduledActionOnDeleteEventHandlerImpl {
|
|
12
|
-
constructor(listScheduledActions, cancelScheduledAction) {
|
|
13
|
-
this.listScheduledActions = listScheduledActions;
|
|
14
|
-
this.cancelScheduledAction = cancelScheduledAction;
|
|
15
|
-
}
|
|
16
|
-
async handle(event) {
|
|
17
|
-
const {
|
|
18
|
-
page
|
|
19
|
-
} = event.payload;
|
|
20
|
-
const schedules = await this.listSchedules(page.entryId);
|
|
21
|
-
for (const action of schedules) {
|
|
22
|
-
const cancelRes = await this.cancelScheduledAction.execute(action.id);
|
|
23
|
-
if (cancelRes.isFail()) {
|
|
24
|
-
// Silently ignore errors - this is non-critical cleanup.
|
|
25
|
-
// The page was deleted successfully, cancelling scheduled actions is best-effort.
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
async listSchedules(entryId) {
|
|
30
|
-
const actionsResult = await this.listScheduledActions.execute({
|
|
31
|
-
limit: 10000,
|
|
32
|
-
where: {
|
|
33
|
-
namespace: "Wb/Page",
|
|
34
|
-
targetId_startsWith: `${entryId}#`
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
if (actionsResult.isFail()) {
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
return actionsResult.value.items;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export const CancelScheduledActionOnDeleteEventHandler = PageAfterDeleteEventHandler.createImplementation({
|
|
44
|
-
implementation: CancelScheduledActionOnDeleteEventHandlerImpl,
|
|
45
|
-
dependencies: [ListScheduledActionsUseCase, CancelScheduledActionUseCase]
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=CancelScheduledActionOnDeleteEventHandler.js.map
|
package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnDeleteEventHandler.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PageAfterDeleteEventHandler","ListScheduledActionsUseCase","CancelScheduledActionUseCase","CancelScheduledActionOnDeleteEventHandlerImpl","constructor","listScheduledActions","cancelScheduledAction","handle","event","page","payload","schedules","listSchedules","entryId","action","cancelRes","execute","id","isFail","actionsResult","limit","where","namespace","targetId_startsWith","value","items","CancelScheduledActionOnDeleteEventHandler","createImplementation","implementation","dependencies"],"sources":["CancelScheduledActionOnDeleteEventHandler.ts"],"sourcesContent":["import { PageAfterDeleteEventHandler } from \"@webiny/api-website-builder/features/pages/DeletePage/abstractions.js\";\nimport { ListScheduledActionsUseCase, CancelScheduledActionUseCase } from \"@webiny/api-scheduler\";\n\n/**\n * Cancels scheduled actions when a page is deleted.\n *\n * When a user deletes a page, any scheduled publish/unpublish\n * actions for all of its revisions should be canceled since the page\n * no longer exists.\n */\nclass CancelScheduledActionOnDeleteEventHandlerImpl\n implements PageAfterDeleteEventHandler.Interface\n{\n constructor(\n private listScheduledActions: ListScheduledActionsUseCase.Interface,\n private cancelScheduledAction: CancelScheduledActionUseCase.Interface\n ) {}\n\n async handle(event: PageAfterDeleteEventHandler.Event): Promise<void> {\n const { page } = event.payload;\n\n const schedules = await this.listSchedules(page.entryId);\n for (const action of schedules) {\n const cancelRes = await this.cancelScheduledAction.execute(action.id);\n if (cancelRes.isFail()) {\n // Silently ignore errors - this is non-critical cleanup.\n // The page was deleted successfully, cancelling scheduled actions is best-effort.\n }\n }\n }\n\n private async listSchedules(entryId: string) {\n const actionsResult = await this.listScheduledActions.execute({\n limit: 10000,\n where: {\n namespace: \"Wb/Page\",\n targetId_startsWith: `${entryId}#`\n }\n });\n\n if (actionsResult.isFail()) {\n return [];\n }\n\n return actionsResult.value.items;\n }\n}\n\nexport const CancelScheduledActionOnDeleteEventHandler =\n PageAfterDeleteEventHandler.createImplementation({\n implementation: CancelScheduledActionOnDeleteEventHandlerImpl,\n dependencies: [ListScheduledActionsUseCase, CancelScheduledActionUseCase]\n });\n"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,uEAAuE;AACnH,SAASC,2BAA2B,EAAEC,4BAA4B,QAAQ,uBAAuB;;AAEjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,6CAA6C,CAEnD;EACIC,WAAWA,CACCC,oBAA2D,EAC3DC,qBAA6D,EACvE;IAAA,KAFUD,oBAA2D,GAA3DA,oBAA2D;IAAA,KAC3DC,qBAA6D,GAA7DA,qBAA6D;EACtE;EAEH,MAAMC,MAAMA,CAACC,KAAwC,EAAiB;IAClE,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;IAE9B,MAAMC,SAAS,GAAG,MAAM,IAAI,CAACC,aAAa,CAACH,IAAI,CAACI,OAAO,CAAC;IACxD,KAAK,MAAMC,MAAM,IAAIH,SAAS,EAAE;MAC5B,MAAMI,SAAS,GAAG,MAAM,IAAI,CAACT,qBAAqB,CAACU,OAAO,CAACF,MAAM,CAACG,EAAE,CAAC;MACrE,IAAIF,SAAS,CAACG,MAAM,CAAC,CAAC,EAAE;QACpB;QACA;MAAA;IAER;EACJ;EAEA,MAAcN,aAAaA,CAACC,OAAe,EAAE;IACzC,MAAMM,aAAa,GAAG,MAAM,IAAI,CAACd,oBAAoB,CAACW,OAAO,CAAC;MAC1DI,KAAK,EAAE,KAAK;MACZC,KAAK,EAAE;QACHC,SAAS,EAAE,SAAS;QACpBC,mBAAmB,EAAE,GAAGV,OAAO;MACnC;IACJ,CAAC,CAAC;IAEF,IAAIM,aAAa,CAACD,MAAM,CAAC,CAAC,EAAE;MACxB,OAAO,EAAE;IACb;IAEA,OAAOC,aAAa,CAACK,KAAK,CAACC,KAAK;EACpC;AACJ;AAEA,OAAO,MAAMC,yCAAyC,GAClD1B,2BAA2B,CAAC2B,oBAAoB,CAAC;EAC7CC,cAAc,EAAEzB,6CAA6C;EAC7D0B,YAAY,EAAE,CAAC5B,2BAA2B,EAAEC,4BAA4B;AAC5E,CAAC,CAAC","ignoreList":[]}
|
package/features/CancelScheduledActionOnPageChange/CancelScheduledActionOnPublishEventHandler.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PageAfterPublishEventHandler","CancelScheduledActionUseCase","ListScheduledActionsUseCase","CancelScheduledActionOnPublishEventHandlerImpl","constructor","listScheduledActions","cancelScheduledAction","handle","event","page","payload","actionsResult","execute","where","namespace","actionType","targetId","id","isFail","actions","value","items","action","cancelRes","CancelScheduledActionOnPublishEventHandler","createImplementation","implementation","dependencies"],"sources":["CancelScheduledActionOnPublishEventHandler.ts"],"sourcesContent":["import { PageAfterPublishEventHandler } from \"@webiny/api-website-builder/features/pages/PublishPage/abstractions.js\";\nimport { CancelScheduledActionUseCase, ListScheduledActionsUseCase } from \"@webiny/api-scheduler\";\n\n/**\n * Cancels scheduled \"publish\" when a page is manually published.\n *\n * When a user manually publishes a page, any scheduled publish\n * action for that page should be canceled since the manual action\n * takes precedence.\n */\nclass CancelScheduledActionOnPublishEventHandlerImpl\n implements PageAfterPublishEventHandler.Interface\n{\n constructor(\n private listScheduledActions: ListScheduledActionsUseCase.Interface,\n private cancelScheduledAction: CancelScheduledActionUseCase.Interface\n ) {}\n\n async handle(event: PageAfterPublishEventHandler.Event): Promise<void> {\n const { page } = event.payload;\n\n const actionsResult = await this.listScheduledActions.execute({\n where: {\n namespace: \"Wb/Page\",\n actionType: \"Publish\",\n targetId: page.id\n }\n });\n\n if (actionsResult.isFail()) {\n return;\n }\n\n const actions = actionsResult.value.items;\n\n for (const action of actions) {\n const cancelRes = await this.cancelScheduledAction.execute(action.id);\n if (cancelRes.isFail()) {\n // Silently ignore errors - this is non-critical cleanup.\n // Even if a schedule runs on an already published page, nothing bad will happen.\n }\n }\n }\n}\n\nexport const CancelScheduledActionOnPublishEventHandler =\n PageAfterPublishEventHandler.createImplementation({\n implementation: CancelScheduledActionOnPublishEventHandlerImpl,\n dependencies: [ListScheduledActionsUseCase, CancelScheduledActionUseCase]\n });\n"],"mappings":"AAAA,SAASA,4BAA4B,QAAQ,wEAAwE;AACrH,SAASC,4BAA4B,EAAEC,2BAA2B,QAAQ,uBAAuB;;AAEjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,8CAA8C,CAEpD;EACIC,WAAWA,CACCC,oBAA2D,EAC3DC,qBAA6D,EACvE;IAAA,KAFUD,oBAA2D,GAA3DA,oBAA2D;IAAA,KAC3DC,qBAA6D,GAA7DA,qBAA6D;EACtE;EAEH,MAAMC,MAAMA,CAACC,KAAyC,EAAiB;IACnE,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;IAE9B,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACN,oBAAoB,CAACO,OAAO,CAAC;MAC1DC,KAAK,EAAE;QACHC,SAAS,EAAE,SAAS;QACpBC,UAAU,EAAE,SAAS;QACrBC,QAAQ,EAAEP,IAAI,CAACQ;MACnB;IACJ,CAAC,CAAC;IAEF,IAAIN,aAAa,CAACO,MAAM,CAAC,CAAC,EAAE;MACxB;IACJ;IAEA,MAAMC,OAAO,GAAGR,aAAa,CAACS,KAAK,CAACC,KAAK;IAEzC,KAAK,MAAMC,MAAM,IAAIH,OAAO,EAAE;MAC1B,MAAMI,SAAS,GAAG,MAAM,IAAI,CAACjB,qBAAqB,CAACM,OAAO,CAACU,MAAM,CAACL,EAAE,CAAC;MACrE,IAAIM,SAAS,CAACL,MAAM,CAAC,CAAC,EAAE;QACpB;QACA;MAAA;IAER;EACJ;AACJ;AAEA,OAAO,MAAMM,0CAA0C,GACnDxB,4BAA4B,CAACyB,oBAAoB,CAAC;EAC9CC,cAAc,EAAEvB,8CAA8C;EAC9DwB,YAAY,EAAE,CAACzB,2BAA2B,EAAED,4BAA4B;AAC5E,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PageAfterUnpublishEventHandler","CancelScheduledActionUseCase","ListScheduledActionsUseCase","CancelScheduledActionOnUnpublishEventHandlerImpl","constructor","listScheduledActions","cancelScheduledAction","handle","event","page","payload","actionsResult","execute","where","namespace","actionType","targetId","id","isFail","actions","value","items","action","cancelRes","CancelScheduledActionOnUnpublishEventHandler","createImplementation","implementation","dependencies"],"sources":["CancelScheduledActionOnUnpublishEventHandler.ts"],"sourcesContent":["import { PageAfterUnpublishEventHandler } from \"@webiny/api-website-builder/features/pages/UnpublishPage/abstractions.js\";\nimport { CancelScheduledActionUseCase, ListScheduledActionsUseCase } from \"@webiny/api-scheduler\";\n\n/**\n * Cancels scheduled action when a page is manually unpublished.\n *\n * When a user manually unpublishes a page revision, any scheduled unpublish\n * action for that revision should be canceled since the manual action\n * takes precedence.\n */\nclass CancelScheduledActionOnUnpublishEventHandlerImpl\n implements PageAfterUnpublishEventHandler.Interface\n{\n constructor(\n private listScheduledActions: ListScheduledActionsUseCase.Interface,\n private cancelScheduledAction: CancelScheduledActionUseCase.Interface\n ) {}\n\n async handle(event: PageAfterUnpublishEventHandler.Event): Promise<void> {\n const { page } = event.payload;\n\n const actionsResult = await this.listScheduledActions.execute({\n where: {\n namespace: \"Wb/Page\",\n actionType: \"Unpublish\",\n targetId: page.id\n }\n });\n\n if (actionsResult.isFail()) {\n return;\n }\n\n const actions = actionsResult.value.items;\n\n for (const action of actions) {\n const cancelRes = await this.cancelScheduledAction.execute(action.id);\n if (cancelRes.isFail()) {\n // Silently ignore errors - this is non-critical cleanup.\n // Page was unpublished successfully, cancelling scheduled actions is best-effort.\n }\n }\n }\n}\n\nexport const CancelScheduledActionOnUnpublishEventHandler =\n PageAfterUnpublishEventHandler.createImplementation({\n implementation: CancelScheduledActionOnUnpublishEventHandlerImpl,\n dependencies: [ListScheduledActionsUseCase, CancelScheduledActionUseCase]\n });\n"],"mappings":"AAAA,SAASA,8BAA8B,QAAQ,0EAA0E;AACzH,SAASC,4BAA4B,EAAEC,2BAA2B,QAAQ,uBAAuB;;AAEjG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gDAAgD,CAEtD;EACIC,WAAWA,CACCC,oBAA2D,EAC3DC,qBAA6D,EACvE;IAAA,KAFUD,oBAA2D,GAA3DA,oBAA2D;IAAA,KAC3DC,qBAA6D,GAA7DA,qBAA6D;EACtE;EAEH,MAAMC,MAAMA,CAACC,KAA2C,EAAiB;IACrE,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;IAE9B,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACN,oBAAoB,CAACO,OAAO,CAAC;MAC1DC,KAAK,EAAE;QACHC,SAAS,EAAE,SAAS;QACpBC,UAAU,EAAE,WAAW;QACvBC,QAAQ,EAAEP,IAAI,CAACQ;MACnB;IACJ,CAAC,CAAC;IAEF,IAAIN,aAAa,CAACO,MAAM,CAAC,CAAC,EAAE;MACxB;IACJ;IAEA,MAAMC,OAAO,GAAGR,aAAa,CAACS,KAAK,CAACC,KAAK;IAEzC,KAAK,MAAMC,MAAM,IAAIH,OAAO,EAAE;MAC1B,MAAMI,SAAS,GAAG,MAAM,IAAI,CAACjB,qBAAqB,CAACM,OAAO,CAACU,MAAM,CAACL,EAAE,CAAC;MACrE,IAAIM,SAAS,CAACL,MAAM,CAAC,CAAC,EAAE;QACpB;QACA;MAAA;IAER;EACJ;AACJ;AAEA,OAAO,MAAMM,4CAA4C,GACrDxB,8BAA8B,CAACyB,oBAAoB,CAAC;EAChDC,cAAc,EAAEvB,gDAAgD;EAChEwB,YAAY,EAAE,CAACzB,2BAA2B,EAAED,4BAA4B;AAC5E,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CancelScheduledActionOnPageChange Feature
|
|
3
|
-
*
|
|
4
|
-
* Automatically cancels scheduled actions when pages are manually
|
|
5
|
-
* published, unpublished, or deleted. This ensures scheduled actions
|
|
6
|
-
* don't execute after a user has already performed the action manually.
|
|
7
|
-
*/
|
|
8
|
-
export declare const CancelScheduledActionOnPageChangeFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createFeature } from "@webiny/feature/api";
|
|
2
|
-
import { CancelScheduledActionOnPublishEventHandler } from "./CancelScheduledActionOnPublishEventHandler.js";
|
|
3
|
-
import { CancelScheduledActionOnUnpublishEventHandler } from "./CancelScheduledActionOnUnpublishEventHandler.js";
|
|
4
|
-
import { CancelScheduledActionOnDeleteEventHandler } from "./CancelScheduledActionOnDeleteEventHandler.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* CancelScheduledActionOnPageChange Feature
|
|
8
|
-
*
|
|
9
|
-
* Automatically cancels scheduled actions when pages are manually
|
|
10
|
-
* published, unpublished, or deleted. This ensures scheduled actions
|
|
11
|
-
* don't execute after a user has already performed the action manually.
|
|
12
|
-
*/
|
|
13
|
-
export const CancelScheduledActionOnPageChangeFeature = createFeature({
|
|
14
|
-
name: "CancelScheduledActionOnPageChange",
|
|
15
|
-
register(container) {
|
|
16
|
-
container.register(CancelScheduledActionOnPublishEventHandler);
|
|
17
|
-
container.register(CancelScheduledActionOnUnpublishEventHandler);
|
|
18
|
-
container.register(CancelScheduledActionOnDeleteEventHandler);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createFeature","CancelScheduledActionOnPublishEventHandler","CancelScheduledActionOnUnpublishEventHandler","CancelScheduledActionOnDeleteEventHandler","CancelScheduledActionOnPageChangeFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CancelScheduledActionOnPublishEventHandler } from \"./CancelScheduledActionOnPublishEventHandler.js\";\nimport { CancelScheduledActionOnUnpublishEventHandler } from \"./CancelScheduledActionOnUnpublishEventHandler.js\";\nimport { CancelScheduledActionOnDeleteEventHandler } from \"./CancelScheduledActionOnDeleteEventHandler.js\";\n\n/**\n * CancelScheduledActionOnPageChange Feature\n *\n * Automatically cancels scheduled actions when pages are manually\n * published, unpublished, or deleted. This ensures scheduled actions\n * don't execute after a user has already performed the action manually.\n */\nexport const CancelScheduledActionOnPageChangeFeature = createFeature({\n name: \"CancelScheduledActionOnPageChange\",\n register(container) {\n container.register(CancelScheduledActionOnPublishEventHandler);\n container.register(CancelScheduledActionOnUnpublishEventHandler);\n container.register(CancelScheduledActionOnDeleteEventHandler);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,0CAA0C;AACnD,SAASC,4CAA4C;AACrD,SAASC,yCAAyC;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wCAAwC,GAAGJ,aAAa,CAAC;EAClEK,IAAI,EAAE,mCAAmC;EACzCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACL,0CAA0C,CAAC;IAC9DM,SAAS,CAACD,QAAQ,CAACJ,4CAA4C,CAAC;IAChEK,SAAS,CAACD,QAAQ,CAACH,yCAAyC,CAAC;EACjE;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import { CancelScheduledActionUseCase } from "@webiny/api-scheduler/features/CancelScheduledAction";
|
|
3
|
-
import { CancelScheduledPageActionUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
-
/**
|
|
5
|
-
* Cancels a scheduled WB page action.
|
|
6
|
-
*/
|
|
7
|
-
declare class CancelScheduledPageActionUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
8
|
-
private cancelScheduledAction;
|
|
9
|
-
constructor(cancelScheduledAction: CancelScheduledActionUseCase.Interface);
|
|
10
|
-
execute(scheduleId: string): Promise<Result<void, UseCaseAbstraction.Error>>;
|
|
11
|
-
}
|
|
12
|
-
export declare const CancelScheduledPageActionUseCase: typeof CancelScheduledPageActionUseCaseImpl & {
|
|
13
|
-
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICancelScheduledPageActionUseCase>;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import { CancelScheduledActionUseCase } from "@webiny/api-scheduler/features/CancelScheduledAction";
|
|
3
|
-
import { CancelScheduledPageActionUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Cancels a scheduled WB page action.
|
|
7
|
-
*/
|
|
8
|
-
class CancelScheduledPageActionUseCaseImpl {
|
|
9
|
-
constructor(cancelScheduledAction) {
|
|
10
|
-
this.cancelScheduledAction = cancelScheduledAction;
|
|
11
|
-
}
|
|
12
|
-
async execute(scheduleId) {
|
|
13
|
-
const cancelRes = await this.cancelScheduledAction.execute(scheduleId);
|
|
14
|
-
if (cancelRes.isFail()) {
|
|
15
|
-
return Result.fail(cancelRes.error);
|
|
16
|
-
}
|
|
17
|
-
return Result.ok();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export const CancelScheduledPageActionUseCase = UseCaseAbstraction.createImplementation({
|
|
21
|
-
implementation: CancelScheduledPageActionUseCaseImpl,
|
|
22
|
-
dependencies: [CancelScheduledActionUseCase]
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=CancelScheduledPageActionUseCase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Result","CancelScheduledActionUseCase","CancelScheduledPageActionUseCase","UseCaseAbstraction","CancelScheduledPageActionUseCaseImpl","constructor","cancelScheduledAction","execute","scheduleId","cancelRes","isFail","fail","error","ok","createImplementation","implementation","dependencies"],"sources":["CancelScheduledPageActionUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { CancelScheduledActionUseCase } from \"@webiny/api-scheduler/features/CancelScheduledAction\";\nimport { CancelScheduledPageActionUseCase as UseCaseAbstraction } from \"./abstractions.js\";\n\n/**\n * Cancels a scheduled WB page action.\n */\nclass CancelScheduledPageActionUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private cancelScheduledAction: CancelScheduledActionUseCase.Interface) {}\n\n async execute(scheduleId: string): Promise<Result<void, UseCaseAbstraction.Error>> {\n const cancelRes = await this.cancelScheduledAction.execute(scheduleId);\n if (cancelRes.isFail()) {\n return Result.fail(cancelRes.error);\n }\n return Result.ok();\n }\n}\n\nexport const CancelScheduledPageActionUseCase = UseCaseAbstraction.createImplementation({\n implementation: CancelScheduledPageActionUseCaseImpl,\n dependencies: [CancelScheduledActionUseCase]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,4BAA4B,QAAQ,sDAAsD;AACnG,SAASC,gCAAgC,IAAIC,kBAAkB;;AAE/D;AACA;AACA;AACA,MAAMC,oCAAoC,CAAyC;EAC/EC,WAAWA,CAASC,qBAA6D,EAAE;IAAA,KAA/DA,qBAA6D,GAA7DA,qBAA6D;EAAG;EAEpF,MAAMC,OAAOA,CAACC,UAAkB,EAAmD;IAC/E,MAAMC,SAAS,GAAG,MAAM,IAAI,CAACH,qBAAqB,CAACC,OAAO,CAACC,UAAU,CAAC;IACtE,IAAIC,SAAS,CAACC,MAAM,CAAC,CAAC,EAAE;MACpB,OAAOV,MAAM,CAACW,IAAI,CAACF,SAAS,CAACG,KAAK,CAAC;IACvC;IACA,OAAOZ,MAAM,CAACa,EAAE,CAAC,CAAC;EACtB;AACJ;AAEA,OAAO,MAAMX,gCAAgC,GAAGC,kBAAkB,CAACW,oBAAoB,CAAC;EACpFC,cAAc,EAAEX,oCAAoC;EACpDY,YAAY,EAAE,CAACf,4BAA4B;AAC/C,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import { ScheduledActionNotFoundError, ScheduledActionPersistenceError, SchedulerServiceError } from "@webiny/api-scheduler/domain/errors.js";
|
|
3
|
-
/**
|
|
4
|
-
* CancelScheduledPageActionUseCase - Cancel a scheduled WB page action.
|
|
5
|
-
*
|
|
6
|
-
* This is a convenience use case for canceling scheduled WB page actions.
|
|
7
|
-
*/
|
|
8
|
-
export interface ICancelScheduledPageActionErrors {
|
|
9
|
-
notFound: ScheduledActionNotFoundError;
|
|
10
|
-
persistence: ScheduledActionPersistenceError;
|
|
11
|
-
schedulerService: SchedulerServiceError;
|
|
12
|
-
}
|
|
13
|
-
type CancelScheduledPageActionError = ICancelScheduledPageActionErrors[keyof ICancelScheduledPageActionErrors];
|
|
14
|
-
export interface ICancelScheduledPageActionUseCase {
|
|
15
|
-
execute(scheduleId: string): Promise<Result<void, CancelScheduledPageActionError>>;
|
|
16
|
-
}
|
|
17
|
-
export declare const CancelScheduledPageActionUseCase: import("@webiny/di").Abstraction<ICancelScheduledPageActionUseCase>;
|
|
18
|
-
export declare namespace CancelScheduledPageActionUseCase {
|
|
19
|
-
type Interface = ICancelScheduledPageActionUseCase;
|
|
20
|
-
type Error = CancelScheduledPageActionError;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* CancelScheduledPageActionUseCase - Cancel a scheduled WB page action.
|
|
5
|
-
*
|
|
6
|
-
* This is a convenience use case for canceling scheduled WB page actions.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
export const CancelScheduledPageActionUseCase = createAbstraction("CancelScheduledPageActionUseCase");
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","CancelScheduledPageActionUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport {\n ScheduledActionNotFoundError,\n ScheduledActionPersistenceError,\n SchedulerServiceError\n} from \"@webiny/api-scheduler/domain/errors.js\";\n\n/**\n * CancelScheduledPageActionUseCase - Cancel a scheduled WB page action.\n *\n * This is a convenience use case for canceling scheduled WB page actions.\n */\n\nexport interface ICancelScheduledPageActionErrors {\n notFound: ScheduledActionNotFoundError;\n persistence: ScheduledActionPersistenceError;\n schedulerService: SchedulerServiceError;\n}\n\ntype CancelScheduledPageActionError =\n ICancelScheduledPageActionErrors[keyof ICancelScheduledPageActionErrors];\n\nexport interface ICancelScheduledPageActionUseCase {\n execute(scheduleId: string): Promise<Result<void, CancelScheduledPageActionError>>;\n}\n\nexport const CancelScheduledPageActionUseCase =\n createAbstraction<ICancelScheduledPageActionUseCase>(\"CancelScheduledPageActionUseCase\");\n\nexport namespace CancelScheduledPageActionUseCase {\n export type Interface = ICancelScheduledPageActionUseCase;\n export type Error = CancelScheduledPageActionError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAQvD;AACA;AACA;AACA;AACA;;AAeA,OAAO,MAAMC,gCAAgC,GACzCD,iBAAiB,CAAoC,kCAAkC,CAAC","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createFeature } from "@webiny/feature/api";
|
|
2
|
-
import { CancelScheduledPageActionUseCase } from "./CancelScheduledPageActionUseCase.js";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* CancelScheduledPageAction Feature
|
|
6
|
-
*
|
|
7
|
-
* Provides the ability to cancel scheduled WB page actions (publish/unpublish).
|
|
8
|
-
*/
|
|
9
|
-
export const CancelScheduledPageActionFeature = createFeature({
|
|
10
|
-
name: "CancelScheduledPageAction",
|
|
11
|
-
register(container) {
|
|
12
|
-
container.register(CancelScheduledPageActionUseCase);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=feature.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createFeature","CancelScheduledPageActionUseCase","CancelScheduledPageActionFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CancelScheduledPageActionUseCase } from \"./CancelScheduledPageActionUseCase.js\";\n\n/**\n * CancelScheduledPageAction Feature\n *\n * Provides the ability to cancel scheduled WB page actions (publish/unpublish).\n */\nexport const CancelScheduledPageActionFeature = createFeature({\n name: \"CancelScheduledPageAction\",\n register(container) {\n container.register(CancelScheduledPageActionUseCase);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,gCAAgC;;AAEzC;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gCAAgC,GAAGF,aAAa,CAAC;EAC1DG,IAAI,EAAE,2BAA2B;EACjCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,gCAAgC,CAAC;EACxD;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./abstractions.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./abstractions.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import { type ISchedulePageActionPayload, SchedulePageActionUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
3
|
-
import type { IScheduledAction } from "@webiny/api-scheduler";
|
|
4
|
-
import { ScheduleActionUseCase } from "@webiny/api-scheduler";
|
|
5
|
-
import { RunActionUseCase } from "@webiny/api-scheduler";
|
|
6
|
-
import { GetPageByIdUseCase } from "@webiny/api-website-builder/features/pages/GetPageById/abstractions.js";
|
|
7
|
-
/**
|
|
8
|
-
* Schedules a WB page action (publish or unpublish).
|
|
9
|
-
*
|
|
10
|
-
* Flow:
|
|
11
|
-
* 1. If immediately=true, use RunAction for immediate execution (no title needed).
|
|
12
|
-
* 2. Otherwise, validate scheduleFor, fetch page to get title metadata.
|
|
13
|
-
* 3. Use ScheduleAction with page title for display in the scheduler UI.
|
|
14
|
-
*/
|
|
15
|
-
declare class SchedulePageActionUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
16
|
-
private scheduleActionUseCase;
|
|
17
|
-
private runActionUseCase;
|
|
18
|
-
private getPageByIdUseCase;
|
|
19
|
-
constructor(scheduleActionUseCase: ScheduleActionUseCase.Interface, runActionUseCase: RunActionUseCase.Interface, getPageByIdUseCase: GetPageByIdUseCase.Interface);
|
|
20
|
-
execute(input: UseCaseAbstraction.Input): Promise<Result<IScheduledAction<ISchedulePageActionPayload>, UseCaseAbstraction.Error>>;
|
|
21
|
-
}
|
|
22
|
-
export declare const SchedulePageActionUseCase: typeof SchedulePageActionUseCaseImpl & {
|
|
23
|
-
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ISchedulePageActionUseCase>;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import { SchedulePageActionUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
3
|
-
import { ScheduleActionUseCase } from "@webiny/api-scheduler";
|
|
4
|
-
import { RunActionUseCase } from "@webiny/api-scheduler";
|
|
5
|
-
import { GetPageByIdUseCase } from "@webiny/api-website-builder/features/pages/GetPageById/abstractions.js";
|
|
6
|
-
const WB_PAGE_NAMESPACE = "Wb/Page";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Schedules a WB page action (publish or unpublish).
|
|
10
|
-
*
|
|
11
|
-
* Flow:
|
|
12
|
-
* 1. If immediately=true, use RunAction for immediate execution (no title needed).
|
|
13
|
-
* 2. Otherwise, validate scheduleFor, fetch page to get title metadata.
|
|
14
|
-
* 3. Use ScheduleAction with page title for display in the scheduler UI.
|
|
15
|
-
*/
|
|
16
|
-
class SchedulePageActionUseCaseImpl {
|
|
17
|
-
constructor(scheduleActionUseCase, runActionUseCase, getPageByIdUseCase) {
|
|
18
|
-
this.scheduleActionUseCase = scheduleActionUseCase;
|
|
19
|
-
this.runActionUseCase = runActionUseCase;
|
|
20
|
-
this.getPageByIdUseCase = getPageByIdUseCase;
|
|
21
|
-
}
|
|
22
|
-
async execute(input) {
|
|
23
|
-
const payload = {
|
|
24
|
-
_type: "Wb/Page"
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// Handle immediate execution — RunAction executes now, no title needed.
|
|
28
|
-
if (input.immediately) {
|
|
29
|
-
const result = await this.runActionUseCase.execute({
|
|
30
|
-
namespace: WB_PAGE_NAMESPACE,
|
|
31
|
-
actionType: input.actionType,
|
|
32
|
-
targetId: input.targetId,
|
|
33
|
-
payload
|
|
34
|
-
});
|
|
35
|
-
if (result.isFail()) {
|
|
36
|
-
return Result.fail(result.error);
|
|
37
|
-
}
|
|
38
|
-
return Result.ok(result.value);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Validate scheduleFor is provided for future scheduling.
|
|
42
|
-
if (!input.scheduleFor) {
|
|
43
|
-
throw new Error("scheduleFor is required when immediately is not true");
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Fetch page to get title for display in the scheduler UI.
|
|
47
|
-
const pageResult = await this.getPageByIdUseCase.execute(input.targetId);
|
|
48
|
-
if (pageResult.isFail()) {
|
|
49
|
-
return Result.fail(pageResult.error);
|
|
50
|
-
}
|
|
51
|
-
const page = pageResult.value;
|
|
52
|
-
const title = page.properties?.title || "Unknown page title";
|
|
53
|
-
|
|
54
|
-
// Schedule with title metadata.
|
|
55
|
-
const scheduleResult = await this.scheduleActionUseCase.execute({
|
|
56
|
-
namespace: WB_PAGE_NAMESPACE,
|
|
57
|
-
actionType: input.actionType,
|
|
58
|
-
targetId: input.targetId,
|
|
59
|
-
title,
|
|
60
|
-
scheduleFor: input.scheduleFor,
|
|
61
|
-
payload
|
|
62
|
-
});
|
|
63
|
-
if (scheduleResult.isFail()) {
|
|
64
|
-
return Result.fail(scheduleResult.error);
|
|
65
|
-
}
|
|
66
|
-
return Result.ok(scheduleResult.value);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
export const SchedulePageActionUseCase = UseCaseAbstraction.createImplementation({
|
|
70
|
-
implementation: SchedulePageActionUseCaseImpl,
|
|
71
|
-
dependencies: [ScheduleActionUseCase, RunActionUseCase, GetPageByIdUseCase]
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
//# sourceMappingURL=SchedulePageActionUseCase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Result","SchedulePageActionUseCase","UseCaseAbstraction","ScheduleActionUseCase","RunActionUseCase","GetPageByIdUseCase","WB_PAGE_NAMESPACE","SchedulePageActionUseCaseImpl","constructor","scheduleActionUseCase","runActionUseCase","getPageByIdUseCase","execute","input","payload","_type","immediately","result","namespace","actionType","targetId","isFail","fail","error","ok","value","scheduleFor","Error","pageResult","page","title","properties","scheduleResult","createImplementation","implementation","dependencies"],"sources":["SchedulePageActionUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n type ISchedulePageActionPayload,\n SchedulePageActionUseCase as UseCaseAbstraction\n} from \"./abstractions.js\";\nimport type { IScheduledAction } from \"@webiny/api-scheduler\";\nimport { ScheduleActionUseCase } from \"@webiny/api-scheduler\";\nimport { RunActionUseCase } from \"@webiny/api-scheduler\";\nimport { GetPageByIdUseCase } from \"@webiny/api-website-builder/features/pages/GetPageById/abstractions.js\";\n\nconst WB_PAGE_NAMESPACE = \"Wb/Page\";\n\n/**\n * Schedules a WB page action (publish or unpublish).\n *\n * Flow:\n * 1. If immediately=true, use RunAction for immediate execution (no title needed).\n * 2. Otherwise, validate scheduleFor, fetch page to get title metadata.\n * 3. Use ScheduleAction with page title for display in the scheduler UI.\n */\nclass SchedulePageActionUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private scheduleActionUseCase: ScheduleActionUseCase.Interface,\n private runActionUseCase: RunActionUseCase.Interface,\n private getPageByIdUseCase: GetPageByIdUseCase.Interface\n ) {}\n\n async execute(\n input: UseCaseAbstraction.Input\n ): Promise<Result<IScheduledAction<ISchedulePageActionPayload>, UseCaseAbstraction.Error>> {\n const payload: ISchedulePageActionPayload = { _type: \"Wb/Page\" };\n\n // Handle immediate execution — RunAction executes now, no title needed.\n if (input.immediately) {\n const result = await this.runActionUseCase.execute<ISchedulePageActionPayload>({\n namespace: WB_PAGE_NAMESPACE,\n actionType: input.actionType,\n targetId: input.targetId,\n payload\n });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n return Result.ok(result.value);\n }\n\n // Validate scheduleFor is provided for future scheduling.\n if (!input.scheduleFor) {\n throw new Error(\"scheduleFor is required when immediately is not true\");\n }\n\n // Fetch page to get title for display in the scheduler UI.\n const pageResult = await this.getPageByIdUseCase.execute(input.targetId);\n if (pageResult.isFail()) {\n return Result.fail(pageResult.error);\n }\n\n const page = pageResult.value;\n const title = page.properties?.title || \"Unknown page title\";\n\n // Schedule with title metadata.\n const scheduleResult = await this.scheduleActionUseCase.execute<ISchedulePageActionPayload>(\n {\n namespace: WB_PAGE_NAMESPACE,\n actionType: input.actionType,\n targetId: input.targetId,\n title,\n scheduleFor: input.scheduleFor,\n payload\n }\n );\n\n if (scheduleResult.isFail()) {\n return Result.fail(scheduleResult.error);\n }\n\n return Result.ok(scheduleResult.value);\n }\n}\n\nexport const SchedulePageActionUseCase = UseCaseAbstraction.createImplementation({\n implementation: SchedulePageActionUseCaseImpl,\n dependencies: [ScheduleActionUseCase, RunActionUseCase, GetPageByIdUseCase]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAEIC,yBAAyB,IAAIC,kBAAkB;AAGnD,SAASC,qBAAqB,QAAQ,uBAAuB;AAC7D,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,kBAAkB,QAAQ,wEAAwE;AAE3G,MAAMC,iBAAiB,GAAG,SAAS;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,6BAA6B,CAAyC;EACxEC,WAAWA,CACCC,qBAAsD,EACtDC,gBAA4C,EAC5CC,kBAAgD,EAC1D;IAAA,KAHUF,qBAAsD,GAAtDA,qBAAsD;IAAA,KACtDC,gBAA4C,GAA5CA,gBAA4C;IAAA,KAC5CC,kBAAgD,GAAhDA,kBAAgD;EACzD;EAEH,MAAMC,OAAOA,CACTC,KAA+B,EACwD;IACvF,MAAMC,OAAmC,GAAG;MAAEC,KAAK,EAAE;IAAU,CAAC;;IAEhE;IACA,IAAIF,KAAK,CAACG,WAAW,EAAE;MACnB,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACP,gBAAgB,CAACE,OAAO,CAA6B;QAC3EM,SAAS,EAAEZ,iBAAiB;QAC5Ba,UAAU,EAAEN,KAAK,CAACM,UAAU;QAC5BC,QAAQ,EAAEP,KAAK,CAACO,QAAQ;QACxBN;MACJ,CAAC,CAAC;MAEF,IAAIG,MAAM,CAACI,MAAM,CAAC,CAAC,EAAE;QACjB,OAAOrB,MAAM,CAACsB,IAAI,CAACL,MAAM,CAACM,KAAK,CAAC;MACpC;MAEA,OAAOvB,MAAM,CAACwB,EAAE,CAACP,MAAM,CAACQ,KAAK,CAAC;IAClC;;IAEA;IACA,IAAI,CAACZ,KAAK,CAACa,WAAW,EAAE;MACpB,MAAM,IAAIC,KAAK,CAAC,sDAAsD,CAAC;IAC3E;;IAEA;IACA,MAAMC,UAAU,GAAG,MAAM,IAAI,CAACjB,kBAAkB,CAACC,OAAO,CAACC,KAAK,CAACO,QAAQ,CAAC;IACxE,IAAIQ,UAAU,CAACP,MAAM,CAAC,CAAC,EAAE;MACrB,OAAOrB,MAAM,CAACsB,IAAI,CAACM,UAAU,CAACL,KAAK,CAAC;IACxC;IAEA,MAAMM,IAAI,GAAGD,UAAU,CAACH,KAAK;IAC7B,MAAMK,KAAK,GAAGD,IAAI,CAACE,UAAU,EAAED,KAAK,IAAI,oBAAoB;;IAE5D;IACA,MAAME,cAAc,GAAG,MAAM,IAAI,CAACvB,qBAAqB,CAACG,OAAO,CAC3D;MACIM,SAAS,EAAEZ,iBAAiB;MAC5Ba,UAAU,EAAEN,KAAK,CAACM,UAAU;MAC5BC,QAAQ,EAAEP,KAAK,CAACO,QAAQ;MACxBU,KAAK;MACLJ,WAAW,EAAEb,KAAK,CAACa,WAAW;MAC9BZ;IACJ,CACJ,CAAC;IAED,IAAIkB,cAAc,CAACX,MAAM,CAAC,CAAC,EAAE;MACzB,OAAOrB,MAAM,CAACsB,IAAI,CAACU,cAAc,CAACT,KAAK,CAAC;IAC5C;IAEA,OAAOvB,MAAM,CAACwB,EAAE,CAACQ,cAAc,CAACP,KAAK,CAAC;EAC1C;AACJ;AAEA,OAAO,MAAMxB,yBAAyB,GAAGC,kBAAkB,CAAC+B,oBAAoB,CAAC;EAC7EC,cAAc,EAAE3B,6BAA6B;EAC7C4B,YAAY,EAAE,CAAChC,qBAAqB,EAAEC,gBAAgB,EAAEC,kBAAkB;AAC9E,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Result } from "@webiny/feature/api";
|
|
2
|
-
import type { IScheduledAction } from "@webiny/api-scheduler";
|
|
3
|
-
import { InvalidScheduleDateError, ScheduledActionPersistenceError, SchedulerServiceError } from "@webiny/api-scheduler/domain/errors.js";
|
|
4
|
-
import type { GetPageByIdUseCase } from "@webiny/api-website-builder/features/pages/GetPageById/abstractions.js";
|
|
5
|
-
/**
|
|
6
|
-
* SchedulePageActionUseCase - Schedule a WB page action (publish/unpublish)
|
|
7
|
-
*
|
|
8
|
-
* This is a convenience use case for scheduling WB page actions.
|
|
9
|
-
* It handles:
|
|
10
|
-
* - Immediate execution (via RunAction)
|
|
11
|
-
* - Future scheduling (via ScheduleAction)
|
|
12
|
-
* - Fetching page title for schedule metadata
|
|
13
|
-
*/
|
|
14
|
-
export type SchedulePageActionType = "Publish" | "Unpublish";
|
|
15
|
-
export interface ISchedulePageActionPayload {
|
|
16
|
-
readonly _type: "Wb/Page";
|
|
17
|
-
}
|
|
18
|
-
export interface ISchedulePageActionWithPayload extends IScheduledAction<ISchedulePageActionPayload> {
|
|
19
|
-
}
|
|
20
|
-
export interface ISchedulePageActionInput {
|
|
21
|
-
targetId: string;
|
|
22
|
-
actionType: SchedulePageActionType;
|
|
23
|
-
immediately?: boolean;
|
|
24
|
-
scheduleFor?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface ISchedulePageActionErrors {
|
|
27
|
-
persistence: ScheduledActionPersistenceError;
|
|
28
|
-
invalidDate: InvalidScheduleDateError;
|
|
29
|
-
schedulerService: SchedulerServiceError;
|
|
30
|
-
pageError: GetPageByIdUseCase.Error;
|
|
31
|
-
}
|
|
32
|
-
type SchedulePageActionError = ISchedulePageActionErrors[keyof ISchedulePageActionErrors];
|
|
33
|
-
export interface ISchedulePageActionUseCase {
|
|
34
|
-
execute(input: ISchedulePageActionInput): Promise<Result<IScheduledAction<ISchedulePageActionPayload>, SchedulePageActionError>>;
|
|
35
|
-
}
|
|
36
|
-
export declare const SchedulePageActionUseCase: import("@webiny/di").Abstraction<ISchedulePageActionUseCase>;
|
|
37
|
-
export declare namespace SchedulePageActionUseCase {
|
|
38
|
-
type Interface = ISchedulePageActionUseCase;
|
|
39
|
-
type Input = ISchedulePageActionInput;
|
|
40
|
-
type Error = SchedulePageActionError;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* SchedulePageActionUseCase - Schedule a WB page action (publish/unpublish)
|
|
5
|
-
*
|
|
6
|
-
* This is a convenience use case for scheduling WB page actions.
|
|
7
|
-
* It handles:
|
|
8
|
-
* - Immediate execution (via RunAction)
|
|
9
|
-
* - Future scheduling (via ScheduleAction)
|
|
10
|
-
* - Fetching page title for schedule metadata
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
// Pages have one fixed model, so no payload is needed beyond what the scheduler stores.
|
|
14
|
-
|
|
15
|
-
export const SchedulePageActionUseCase = createAbstraction("SchedulePageActionUseCase");
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createAbstraction","SchedulePageActionUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction, Result } from \"@webiny/feature/api\";\nimport type { IScheduledAction } from \"@webiny/api-scheduler\";\nimport {\n InvalidScheduleDateError,\n ScheduledActionPersistenceError,\n SchedulerServiceError\n} from \"@webiny/api-scheduler/domain/errors.js\";\nimport type { GetPageByIdUseCase } from \"@webiny/api-website-builder/features/pages/GetPageById/abstractions.js\";\n\n/**\n * SchedulePageActionUseCase - Schedule a WB page action (publish/unpublish)\n *\n * This is a convenience use case for scheduling WB page actions.\n * It handles:\n * - Immediate execution (via RunAction)\n * - Future scheduling (via ScheduleAction)\n * - Fetching page title for schedule metadata\n */\n\nexport type SchedulePageActionType = \"Publish\" | \"Unpublish\";\n\n// Pages have one fixed model, so no payload is needed beyond what the scheduler stores.\nexport interface ISchedulePageActionPayload {\n readonly _type: \"Wb/Page\";\n}\n\nexport interface ISchedulePageActionWithPayload\n extends IScheduledAction<ISchedulePageActionPayload> {}\n\nexport interface ISchedulePageActionInput {\n targetId: string;\n actionType: SchedulePageActionType;\n immediately?: boolean;\n scheduleFor?: string;\n}\n\nexport interface ISchedulePageActionErrors {\n persistence: ScheduledActionPersistenceError;\n invalidDate: InvalidScheduleDateError;\n schedulerService: SchedulerServiceError;\n pageError: GetPageByIdUseCase.Error;\n}\n\ntype SchedulePageActionError = ISchedulePageActionErrors[keyof ISchedulePageActionErrors];\n\nexport interface ISchedulePageActionUseCase {\n execute(\n input: ISchedulePageActionInput\n ): Promise<Result<IScheduledAction<ISchedulePageActionPayload>, SchedulePageActionError>>;\n}\n\nexport const SchedulePageActionUseCase = createAbstraction<ISchedulePageActionUseCase>(\n \"SchedulePageActionUseCase\"\n);\n\nexport namespace SchedulePageActionUseCase {\n export type Interface = ISchedulePageActionUseCase;\n export type Input = ISchedulePageActionInput;\n export type Error = SchedulePageActionError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAgB,qBAAqB;;AAS/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;;AA8BA,OAAO,MAAMC,yBAAyB,GAAGD,iBAAiB,CACtD,2BACJ,CAAC","ignoreList":[]}
|