@webiny/api-scheduler 0.0.0-unstable.0d717d18dd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/ScheduledActionLambdaHandler.d.ts +18 -0
- package/ScheduledActionLambdaHandler.js +41 -0
- package/ScheduledActionLambdaHandler.js.map +1 -0
- package/SchedulerFeature.d.ts +6 -0
- package/SchedulerFeature.js +21 -0
- package/SchedulerFeature.js.map +1 -0
- package/SchedulerFeature.types.d.ts +5 -0
- package/SchedulerFeature.types.js +0 -0
- package/SchedulerModelContextualSchema.d.ts +13 -0
- package/SchedulerModelContextualSchema.js +32 -0
- package/SchedulerModelContextualSchema.js.map +1 -0
- package/constants.d.ts +13 -0
- package/constants.js +13 -0
- package/constants.js.map +1 -0
- package/domain/SchedulePrivateModel.d.ts +8 -0
- package/domain/SchedulePrivateModel.js +32 -0
- package/domain/SchedulePrivateModel.js.map +1 -0
- package/domain/ScheduledActionId.d.ts +8 -0
- package/domain/ScheduledActionId.js +17 -0
- package/domain/ScheduledActionId.js.map +1 -0
- package/domain/ScheduledActionIdWithVersion.d.ts +3 -0
- package/domain/ScheduledActionIdWithVersion.js +9 -0
- package/domain/ScheduledActionIdWithVersion.js.map +1 -0
- package/domain/ScheduledActionMapper.d.ts +16 -0
- package/domain/ScheduledActionMapper.js +37 -0
- package/domain/ScheduledActionMapper.js.map +1 -0
- package/domain/errors.d.ts +55 -0
- package/domain/errors.js +61 -0
- package/domain/errors.js.map +1 -0
- package/domain/isValidDate.d.ts +6 -0
- package/domain/isValidDate.js +8 -0
- package/domain/isValidDate.js.map +1 -0
- package/domain/permissionsSchema.d.ts +9 -0
- package/domain/permissionsSchema.js +18 -0
- package/domain/permissionsSchema.js.map +1 -0
- package/exports/api/scheduler.d.ts +10 -0
- package/exports/api/scheduler.js +8 -0
- package/features/CancelScheduledAction/CancelScheduledActionUseCase.d.ts +28 -0
- package/features/CancelScheduledAction/CancelScheduledActionUseCase.js +58 -0
- package/features/CancelScheduledAction/CancelScheduledActionUseCase.js.map +1 -0
- package/features/CancelScheduledAction/abstractions.d.ts +32 -0
- package/features/CancelScheduledAction/abstractions.js +5 -0
- package/features/CancelScheduledAction/abstractions.js.map +1 -0
- package/features/CancelScheduledAction/feature.d.ts +10 -0
- package/features/CancelScheduledAction/feature.js +11 -0
- package/features/CancelScheduledAction/feature.js.map +1 -0
- package/features/CancelScheduledAction/index.d.ts +1 -0
- package/features/CancelScheduledAction/index.js +1 -0
- package/features/ExecuteScheduledAction/ExecuteScheduledActionUseCase.d.ts +33 -0
- package/features/ExecuteScheduledAction/ExecuteScheduledActionUseCase.js +82 -0
- package/features/ExecuteScheduledAction/ExecuteScheduledActionUseCase.js.map +1 -0
- package/features/ExecuteScheduledAction/ScheduledActionHandlerComposite.d.ts +19 -0
- package/features/ExecuteScheduledAction/ScheduledActionHandlerComposite.js +28 -0
- package/features/ExecuteScheduledAction/ScheduledActionHandlerComposite.js.map +1 -0
- package/features/ExecuteScheduledAction/abstractions.d.ts +54 -0
- package/features/ExecuteScheduledAction/abstractions.js +17 -0
- package/features/ExecuteScheduledAction/abstractions.js.map +1 -0
- package/features/ExecuteScheduledAction/feature.d.ts +10 -0
- package/features/ExecuteScheduledAction/feature.js +13 -0
- package/features/ExecuteScheduledAction/feature.js.map +1 -0
- package/features/ExecuteScheduledAction/index.d.ts +1 -0
- package/features/ExecuteScheduledAction/index.js +1 -0
- package/features/GetScheduledAction/GetScheduledActionUseCase.d.ts +28 -0
- package/features/GetScheduledAction/GetScheduledActionUseCase.js +48 -0
- package/features/GetScheduledAction/GetScheduledActionUseCase.js.map +1 -0
- package/features/GetScheduledAction/abstractions.d.ts +33 -0
- package/features/GetScheduledAction/abstractions.js +5 -0
- package/features/GetScheduledAction/abstractions.js.map +1 -0
- package/features/GetScheduledAction/feature.d.ts +10 -0
- package/features/GetScheduledAction/feature.js +11 -0
- package/features/GetScheduledAction/feature.js.map +1 -0
- package/features/GetScheduledAction/index.d.ts +1 -0
- package/features/GetScheduledAction/index.js +1 -0
- package/features/GetTargetScheduledAction/GetTargetScheduledActionUseCase.d.ts +32 -0
- package/features/GetTargetScheduledAction/GetTargetScheduledActionUseCase.js +64 -0
- package/features/GetTargetScheduledAction/GetTargetScheduledActionUseCase.js.map +1 -0
- package/features/GetTargetScheduledAction/abstractions.d.ts +24 -0
- package/features/GetTargetScheduledAction/abstractions.js +5 -0
- package/features/GetTargetScheduledAction/abstractions.js.map +1 -0
- package/features/GetTargetScheduledAction/feature.d.ts +10 -0
- package/features/GetTargetScheduledAction/feature.js +11 -0
- package/features/GetTargetScheduledAction/feature.js.map +1 -0
- package/features/GetTargetScheduledAction/index.d.ts +1 -0
- package/features/GetTargetScheduledAction/index.js +1 -0
- package/features/ListScheduledActions/ListScheduledActionsUseCase.d.ts +31 -0
- package/features/ListScheduledActions/ListScheduledActionsUseCase.js +63 -0
- package/features/ListScheduledActions/ListScheduledActionsUseCase.js.map +1 -0
- package/features/ListScheduledActions/abstractions.d.ts +57 -0
- package/features/ListScheduledActions/abstractions.js +5 -0
- package/features/ListScheduledActions/abstractions.js.map +1 -0
- package/features/ListScheduledActions/feature.d.ts +10 -0
- package/features/ListScheduledActions/feature.js +11 -0
- package/features/ListScheduledActions/feature.js.map +1 -0
- package/features/ListScheduledActions/index.d.ts +1 -0
- package/features/ListScheduledActions/index.js +1 -0
- package/features/NamespaceHandler/NamespaceHandlerExecutioner.d.ts +11 -0
- package/features/NamespaceHandler/NamespaceHandlerExecutioner.js +26 -0
- package/features/NamespaceHandler/NamespaceHandlerExecutioner.js.map +1 -0
- package/features/NamespaceHandler/abstractions.d.ts +50 -0
- package/features/NamespaceHandler/abstractions.js +6 -0
- package/features/NamespaceHandler/abstractions.js.map +1 -0
- package/features/NamespaceHandler/feature.d.ts +4 -0
- package/features/NamespaceHandler/feature.js +11 -0
- package/features/NamespaceHandler/feature.js.map +1 -0
- package/features/NamespaceHandler/index.d.ts +1 -0
- package/features/NamespaceHandler/index.js +1 -0
- package/features/ScheduleAction/ScheduleActionUseCase.d.ts +45 -0
- package/features/ScheduleAction/ScheduleActionUseCase.js +171 -0
- package/features/ScheduleAction/ScheduleActionUseCase.js.map +1 -0
- package/features/ScheduleAction/abstractions.d.ts +36 -0
- package/features/ScheduleAction/abstractions.js +5 -0
- package/features/ScheduleAction/abstractions.js.map +1 -0
- package/features/ScheduleAction/feature.d.ts +10 -0
- package/features/ScheduleAction/feature.js +11 -0
- package/features/ScheduleAction/feature.js.map +1 -0
- package/features/ScheduleAction/index.d.ts +1 -0
- package/features/ScheduleAction/index.js +1 -0
- package/features/SchedulerFeature.d.ts +11 -0
- package/features/SchedulerFeature.js +21 -0
- package/features/SchedulerFeature.js.map +1 -0
- package/features/SchedulerService/VoidSchedulerService.d.ts +15 -0
- package/features/SchedulerService/VoidSchedulerService.js +24 -0
- package/features/SchedulerService/VoidSchedulerService.js.map +1 -0
- package/features/permissions/abstractions.d.ts +14 -0
- package/features/permissions/abstractions.js +6 -0
- package/features/permissions/abstractions.js.map +1 -0
- package/features/permissions/feature.d.ts +4 -0
- package/features/permissions/feature.js +7 -0
- package/features/permissions/feature.js.map +1 -0
- package/graphql/SchedulerGraphQLFactory.d.ts +8 -0
- package/graphql/SchedulerGraphQLFactory.js +219 -0
- package/graphql/SchedulerGraphQLFactory.js.map +1 -0
- package/graphql/feature.d.ts +4 -0
- package/graphql/feature.js +11 -0
- package/graphql/feature.js.map +1 -0
- package/graphql/index.d.ts +1 -0
- package/graphql/index.js +1 -0
- package/index.d.ts +6 -0
- package/index.js +4 -0
- package/package.json +47 -0
- package/shared/abstractions.d.ts +107 -0
- package/shared/abstractions.js +7 -0
- package/shared/abstractions.js.map +1 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { IScheduledAction } from "../../shared/abstractions.js";
|
|
3
|
+
import { ScheduledActionNotFoundError, ScheduledActionPersistenceError, NotAuthorizedError } from "../../domain/errors.js";
|
|
4
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* GetScheduledActionUseCase - Retrieve a scheduled action by ID
|
|
7
|
+
*
|
|
8
|
+
* Used to check if a schedule exists (for reschedule logic) and to retrieve
|
|
9
|
+
* schedule details for display/management purposes.
|
|
10
|
+
*
|
|
11
|
+
* Returns null value (Result.ok(null)) if schedule not found.
|
|
12
|
+
*/
|
|
13
|
+
export interface IGetScheduledActionErrors {
|
|
14
|
+
persistence: ScheduledActionPersistenceError;
|
|
15
|
+
notFound: ScheduledActionNotFoundError;
|
|
16
|
+
unauthorized: NotAuthorizedError;
|
|
17
|
+
}
|
|
18
|
+
type GetScheduledActionError = IGetScheduledActionErrors[keyof IGetScheduledActionErrors];
|
|
19
|
+
export interface IGetScheduledActionUseCaseParams {
|
|
20
|
+
namespace: string;
|
|
21
|
+
id: string;
|
|
22
|
+
}
|
|
23
|
+
export interface IGetScheduledActionUseCase {
|
|
24
|
+
execute<T extends GenericRecord>(params: IGetScheduledActionUseCaseParams): Promise<Result<IScheduledAction<T>, GetScheduledActionError>>;
|
|
25
|
+
}
|
|
26
|
+
/** Retrieve a scheduled action. */
|
|
27
|
+
export declare const GetScheduledActionUseCase: import("@webiny/di").Abstraction<IGetScheduledActionUseCase>;
|
|
28
|
+
export declare namespace GetScheduledActionUseCase {
|
|
29
|
+
type Interface = IGetScheduledActionUseCase;
|
|
30
|
+
type Error = GetScheduledActionError;
|
|
31
|
+
type Params = IGetScheduledActionUseCaseParams;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetScheduledAction/abstractions.js","sources":["../../../src/features/GetScheduledAction/abstractions.ts"],"sourcesContent":["import { createAbstraction, Result } from \"@webiny/feature/api\";\nimport type { IScheduledAction } from \"~/shared/abstractions.js\";\nimport {\n ScheduledActionNotFoundError,\n ScheduledActionPersistenceError,\n NotAuthorizedError\n} from \"~/domain/errors.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\n/**\n * GetScheduledActionUseCase - Retrieve a scheduled action by ID\n *\n * Used to check if a schedule exists (for reschedule logic) and to retrieve\n * schedule details for display/management purposes.\n *\n * Returns null value (Result.ok(null)) if schedule not found.\n */\n\nexport interface IGetScheduledActionErrors {\n persistence: ScheduledActionPersistenceError;\n notFound: ScheduledActionNotFoundError;\n unauthorized: NotAuthorizedError;\n}\n\ntype GetScheduledActionError = IGetScheduledActionErrors[keyof IGetScheduledActionErrors];\n\nexport interface IGetScheduledActionUseCaseParams {\n namespace: string;\n id: string;\n}\n\nexport interface IGetScheduledActionUseCase {\n execute<T extends GenericRecord>(\n params: IGetScheduledActionUseCaseParams\n ): Promise<Result<IScheduledAction<T>, GetScheduledActionError>>;\n}\n\n/** Retrieve a scheduled action. */\nexport const GetScheduledActionUseCase = createAbstraction<IGetScheduledActionUseCase>(\n \"Scheduler/GetScheduledActionUseCase\"\n);\n\nexport namespace GetScheduledActionUseCase {\n export type Interface = IGetScheduledActionUseCase;\n export type Error = GetScheduledActionError;\n export type Params = IGetScheduledActionUseCaseParams;\n}\n"],"names":["GetScheduledActionUseCase","createAbstraction"],"mappings":";AAsCO,MAAMA,4BAA4BC,kBACrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GetScheduledAction Feature
|
|
3
|
+
*
|
|
4
|
+
* Provides the ability to retrieve a scheduled action by ID.
|
|
5
|
+
* Used for checking if schedules exist and displaying schedule details.
|
|
6
|
+
*/
|
|
7
|
+
export declare const GetScheduledActionFeature: {
|
|
8
|
+
name: string;
|
|
9
|
+
register(container: import("@webiny/di").Container): void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { GetScheduledActionUseCase } from "./GetScheduledActionUseCase.js";
|
|
3
|
+
const GetScheduledActionFeature = createFeature({
|
|
4
|
+
name: "GetScheduledAction",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(GetScheduledActionUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { GetScheduledActionFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetScheduledAction/feature.js","sources":["../../../src/features/GetScheduledAction/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetScheduledActionUseCase } from \"./GetScheduledActionUseCase.js\";\n\n/**\n * GetScheduledAction Feature\n *\n * Provides the ability to retrieve a scheduled action by ID.\n * Used for checking if schedules exist and displaying schedule details.\n */\nexport const GetScheduledActionFeature = createFeature({\n name: \"GetScheduledAction\",\n register(container) {\n container.register(GetScheduledActionUseCase);\n }\n});\n"],"names":["GetScheduledActionFeature","createFeature","container","GetScheduledActionUseCase"],"mappings":";;AASO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./abstractions.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetTargetScheduledActionUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
3
|
+
import type { IScheduledAction } from "../../shared/abstractions.js";
|
|
4
|
+
import { ScheduledActionModel } from "../../shared/abstractions.js";
|
|
5
|
+
import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById/index.js";
|
|
6
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
7
|
+
import { SchedulerPermissions } from "../../features/permissions/abstractions.js";
|
|
8
|
+
import { IdentityContext } from "@webiny/api-core/exports/api/security.js";
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves a scheduled action by its ID
|
|
11
|
+
*
|
|
12
|
+
* Flow:
|
|
13
|
+
* 1. Fetch schedule entry from CMS storage by ID
|
|
14
|
+
* 2. Return null if not found
|
|
15
|
+
* 3. Transform CMS entry to IScheduledAction format
|
|
16
|
+
*/
|
|
17
|
+
declare class GetTargetScheduledActionUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
18
|
+
private getEntryByIdUseCase;
|
|
19
|
+
private model;
|
|
20
|
+
private permissions;
|
|
21
|
+
private identityContext;
|
|
22
|
+
constructor(getEntryByIdUseCase: GetEntryByIdUseCase.Interface, model: ScheduledActionModel.Interface, permissions: SchedulerPermissions.Interface, identityContext: IdentityContext.Interface);
|
|
23
|
+
execute<T extends GenericRecord>(params: UseCaseAbstraction.Params): Promise<Result<IScheduledAction<T>, UseCaseAbstraction.Error>>;
|
|
24
|
+
/**
|
|
25
|
+
* We always need to fetch both publish and unpublish actions because we don't know the type of the action that is being searched for.
|
|
26
|
+
*/
|
|
27
|
+
private getRecord;
|
|
28
|
+
}
|
|
29
|
+
export declare const GetTargetScheduledActionUseCase: typeof GetTargetScheduledActionUseCaseImpl & {
|
|
30
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetTargetScheduledActionUseCase>;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetTargetScheduledActionUseCase } from "./abstractions.js";
|
|
3
|
+
import { ScheduledActionModel } from "../../shared/abstractions.js";
|
|
4
|
+
import { NotAuthorizedError, ScheduledActionNotFoundError, ScheduledActionPersistenceError } from "../../domain/errors.js";
|
|
5
|
+
import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById/index.js";
|
|
6
|
+
import { SchedulerPermissions } from "../permissions/abstractions.js";
|
|
7
|
+
import { IdentityContext } from "@webiny/api-core/exports/api/security.js";
|
|
8
|
+
import { ScheduledActionMapper } from "../../domain/ScheduledActionMapper.js";
|
|
9
|
+
import { ScheduledActionId } from "../../domain/ScheduledActionId.js";
|
|
10
|
+
import { ScheduledActionIdWithVersion } from "../../domain/ScheduledActionIdWithVersion.js";
|
|
11
|
+
import { SCHEDULED_ACTION_PUBLISH, SCHEDULED_ACTION_UNPUBLISH } from "../../constants.js";
|
|
12
|
+
class GetTargetScheduledActionUseCaseImpl {
|
|
13
|
+
constructor(getEntryByIdUseCase, model, permissions, identityContext){
|
|
14
|
+
this.getEntryByIdUseCase = getEntryByIdUseCase;
|
|
15
|
+
this.model = model;
|
|
16
|
+
this.permissions = permissions;
|
|
17
|
+
this.identityContext = identityContext;
|
|
18
|
+
}
|
|
19
|
+
async execute(params) {
|
|
20
|
+
const hasPermission = await this.permissions.canRead("action");
|
|
21
|
+
if (!hasPermission) return Result.fail(new NotAuthorizedError());
|
|
22
|
+
const { id, namespace } = params;
|
|
23
|
+
const entryResult = await this.getRecord(params);
|
|
24
|
+
if (entryResult.isFail()) {
|
|
25
|
+
if ("Cms/Entry/NotFound" === entryResult.error.code) return Result.fail(new ScheduledActionNotFoundError(id));
|
|
26
|
+
return Result.fail(new ScheduledActionPersistenceError(entryResult.error));
|
|
27
|
+
}
|
|
28
|
+
const ownRecordsOnly = await this.permissions.onlyOwnRecords("action");
|
|
29
|
+
if (ownRecordsOnly) {
|
|
30
|
+
if (entryResult.value.createdBy.id !== this.identityContext.getIdentity().id) return Result.fail(new NotAuthorizedError());
|
|
31
|
+
}
|
|
32
|
+
const entry = entryResult.value;
|
|
33
|
+
if (entry.values.namespace !== namespace) return Result.fail(new ScheduledActionNotFoundError(id));
|
|
34
|
+
const action = ScheduledActionMapper.toAction(entry);
|
|
35
|
+
return Result.ok(action);
|
|
36
|
+
}
|
|
37
|
+
async getRecord(params) {
|
|
38
|
+
const schedulePublishId = ScheduledActionId.from({
|
|
39
|
+
namespace: params.namespace,
|
|
40
|
+
targetId: params.id,
|
|
41
|
+
actionType: SCHEDULED_ACTION_PUBLISH
|
|
42
|
+
});
|
|
43
|
+
const publishResult = await this.getEntryByIdUseCase.execute(this.model, ScheduledActionIdWithVersion.from(schedulePublishId));
|
|
44
|
+
if (publishResult.isOk()) return publishResult;
|
|
45
|
+
const scheduleUnpublishId = ScheduledActionId.from({
|
|
46
|
+
namespace: params.namespace,
|
|
47
|
+
targetId: params.id,
|
|
48
|
+
actionType: SCHEDULED_ACTION_UNPUBLISH
|
|
49
|
+
});
|
|
50
|
+
return this.getEntryByIdUseCase.execute(this.model, ScheduledActionIdWithVersion.from(scheduleUnpublishId));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const GetTargetScheduledActionUseCase_GetTargetScheduledActionUseCase = GetTargetScheduledActionUseCase.createImplementation({
|
|
54
|
+
implementation: GetTargetScheduledActionUseCaseImpl,
|
|
55
|
+
dependencies: [
|
|
56
|
+
GetEntryByIdUseCase,
|
|
57
|
+
ScheduledActionModel,
|
|
58
|
+
SchedulerPermissions,
|
|
59
|
+
IdentityContext
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
export { GetTargetScheduledActionUseCase_GetTargetScheduledActionUseCase as GetTargetScheduledActionUseCase };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=GetTargetScheduledActionUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetTargetScheduledAction/GetTargetScheduledActionUseCase.js","sources":["../../../src/features/GetTargetScheduledAction/GetTargetScheduledActionUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetTargetScheduledActionUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type { IScheduledAction, IScheduledActionEntryValues } from \"~/shared/abstractions.js\";\nimport { ScheduledActionModel } from \"~/shared/abstractions.js\";\nimport {\n NotAuthorizedError,\n ScheduledActionNotFoundError,\n ScheduledActionPersistenceError\n} from \"~/domain/errors.js\";\nimport { GetEntryByIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetEntryById/index.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { SchedulerPermissions } from \"~/features/permissions/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/exports/api/security.js\";\nimport { ScheduledActionMapper } from \"~/domain/ScheduledActionMapper.js\";\nimport { ScheduledActionId } from \"~/domain/ScheduledActionId.js\";\nimport { ScheduledActionIdWithVersion } from \"~/domain/ScheduledActionIdWithVersion.js\";\nimport { SCHEDULED_ACTION_PUBLISH, SCHEDULED_ACTION_UNPUBLISH } from \"~/constants.js\";\n\n/**\n * Retrieves a scheduled action by its ID\n *\n * Flow:\n * 1. Fetch schedule entry from CMS storage by ID\n * 2. Return null if not found\n * 3. Transform CMS entry to IScheduledAction format\n */\nclass GetTargetScheduledActionUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getEntryByIdUseCase: GetEntryByIdUseCase.Interface,\n private model: ScheduledActionModel.Interface,\n private permissions: SchedulerPermissions.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute<T extends GenericRecord>(\n params: UseCaseAbstraction.Params\n ): Promise<Result<IScheduledAction<T>, UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canRead(\"action\");\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n const { id, namespace } = params;\n\n const entryResult = await this.getRecord<T>(params);\n\n if (entryResult.isFail()) {\n if (entryResult.error.code === \"Cms/Entry/NotFound\") {\n return Result.fail(new ScheduledActionNotFoundError(id));\n }\n\n return Result.fail(new ScheduledActionPersistenceError(entryResult.error));\n }\n\n const ownRecordsOnly = await this.permissions.onlyOwnRecords(\"action\");\n if (ownRecordsOnly) {\n if (entryResult.value.createdBy.id !== this.identityContext.getIdentity().id) {\n return Result.fail(new NotAuthorizedError());\n }\n }\n\n const entry = entryResult.value;\n /**\n * Always check if the namespace is correct because entry is loaded directly, not via filtering.\n */\n if (entry.values.namespace !== namespace) {\n return Result.fail(new ScheduledActionNotFoundError(id));\n }\n const action = ScheduledActionMapper.toAction<T>(entry);\n return Result.ok(action);\n }\n /**\n * We always need to fetch both publish and unpublish actions because we don't know the type of the action that is being searched for.\n */\n private async getRecord<T extends GenericRecord>(params: UseCaseAbstraction.Params) {\n const schedulePublishId = ScheduledActionId.from({\n namespace: params.namespace,\n targetId: params.id,\n actionType: SCHEDULED_ACTION_PUBLISH\n });\n const publishResult = await this.getEntryByIdUseCase.execute<\n IScheduledActionEntryValues<T>\n >(this.model, ScheduledActionIdWithVersion.from(schedulePublishId));\n if (publishResult.isOk()) {\n return publishResult;\n }\n const scheduleUnpublishId = ScheduledActionId.from({\n namespace: params.namespace,\n targetId: params.id,\n actionType: SCHEDULED_ACTION_UNPUBLISH\n });\n return this.getEntryByIdUseCase.execute<IScheduledActionEntryValues<T>>(\n this.model,\n ScheduledActionIdWithVersion.from(scheduleUnpublishId)\n );\n }\n}\n\nexport const GetTargetScheduledActionUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetTargetScheduledActionUseCaseImpl,\n dependencies: [GetEntryByIdUseCase, ScheduledActionModel, SchedulerPermissions, IdentityContext]\n});\n"],"names":["GetTargetScheduledActionUseCaseImpl","getEntryByIdUseCase","model","permissions","identityContext","params","hasPermission","Result","NotAuthorizedError","id","namespace","entryResult","ScheduledActionNotFoundError","ScheduledActionPersistenceError","ownRecordsOnly","entry","action","ScheduledActionMapper","schedulePublishId","ScheduledActionId","SCHEDULED_ACTION_PUBLISH","publishResult","ScheduledActionIdWithVersion","scheduleUnpublishId","SCHEDULED_ACTION_UNPUBLISH","GetTargetScheduledActionUseCase","UseCaseAbstraction","GetEntryByIdUseCase","ScheduledActionModel","SchedulerPermissions","IdentityContext"],"mappings":";;;;;;;;;;;AA0BA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,KAAqC,EACrCC,WAA2C,EAC3CC,eAA0C,CACpD;aAJUH,mBAAmB,GAAnBA;aACAC,KAAK,GAALA;aACAC,WAAW,GAAXA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,QACFC,MAAiC,EAC6B;QAC9D,MAAMC,gBAAgB,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;QACrD,IAAI,CAACA,eACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAE3B,MAAM,EAAEC,EAAE,EAAEC,SAAS,EAAE,GAAGL;QAE1B,MAAMM,cAAc,MAAM,IAAI,CAAC,SAAS,CAAIN;QAE5C,IAAIM,YAAY,MAAM,IAAI;YACtB,IAAIA,AAA2B,yBAA3BA,YAAY,KAAK,CAAC,IAAI,EACtB,OAAOJ,OAAO,IAAI,CAAC,IAAIK,6BAA6BH;YAGxD,OAAOF,OAAO,IAAI,CAAC,IAAIM,gCAAgCF,YAAY,KAAK;QAC5E;QAEA,MAAMG,iBAAiB,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;QAC7D,IAAIA,gBACA;YAAA,IAAIH,YAAY,KAAK,CAAC,SAAS,CAAC,EAAE,KAAK,IAAI,CAAC,eAAe,CAAC,WAAW,GAAG,EAAE,EACxE,OAAOJ,OAAO,IAAI,CAAC,IAAIC;QAC3B;QAGJ,MAAMO,QAAQJ,YAAY,KAAK;QAI/B,IAAII,MAAM,MAAM,CAAC,SAAS,KAAKL,WAC3B,OAAOH,OAAO,IAAI,CAAC,IAAIK,6BAA6BH;QAExD,MAAMO,SAASC,sBAAsB,QAAQ,CAAIF;QACjD,OAAOR,OAAO,EAAE,CAACS;IACrB;IAIA,MAAc,UAAmCX,MAAiC,EAAE;QAChF,MAAMa,oBAAoBC,kBAAkB,IAAI,CAAC;YAC7C,WAAWd,OAAO,SAAS;YAC3B,UAAUA,OAAO,EAAE;YACnB,YAAYe;QAChB;QACA,MAAMC,gBAAgB,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAE1D,IAAI,CAAC,KAAK,EAAEC,6BAA6B,IAAI,CAACJ;QAChD,IAAIG,cAAc,IAAI,IAClB,OAAOA;QAEX,MAAME,sBAAsBJ,kBAAkB,IAAI,CAAC;YAC/C,WAAWd,OAAO,SAAS;YAC3B,UAAUA,OAAO,EAAE;YACnB,YAAYmB;QAChB;QACA,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CACnC,IAAI,CAAC,KAAK,EACVF,6BAA6B,IAAI,CAACC;IAE1C;AACJ;AAEO,MAAME,kEAAkCC,gCAAAA,oBAAuC,CAAC;IACnF,gBAAgB1B;IAChB,cAAc;QAAC2B;QAAqBC;QAAsBC;QAAsBC;KAAgB;AACpG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { IScheduledAction } from "../../shared/abstractions.js";
|
|
3
|
+
import { ScheduledActionNotFoundError, ScheduledActionPersistenceError, NotAuthorizedError } from "../../domain/errors.js";
|
|
4
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
5
|
+
export interface IGetTargetScheduledActionErrors {
|
|
6
|
+
persistence: ScheduledActionPersistenceError;
|
|
7
|
+
notFound: ScheduledActionNotFoundError;
|
|
8
|
+
unauthorized: NotAuthorizedError;
|
|
9
|
+
}
|
|
10
|
+
type GetTargetScheduledActionError = IGetTargetScheduledActionErrors[keyof IGetTargetScheduledActionErrors];
|
|
11
|
+
export interface IGetTargetScheduledActionUseCaseParams {
|
|
12
|
+
namespace: string;
|
|
13
|
+
id: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IGetTargetScheduledActionUseCase {
|
|
16
|
+
execute<T extends GenericRecord>(params: IGetTargetScheduledActionUseCaseParams): Promise<Result<IScheduledAction<T>, GetTargetScheduledActionError>>;
|
|
17
|
+
}
|
|
18
|
+
export declare const GetTargetScheduledActionUseCase: import("@webiny/di").Abstraction<IGetTargetScheduledActionUseCase>;
|
|
19
|
+
export declare namespace GetTargetScheduledActionUseCase {
|
|
20
|
+
type Interface = IGetTargetScheduledActionUseCase;
|
|
21
|
+
type Error = GetTargetScheduledActionError;
|
|
22
|
+
type Params = IGetTargetScheduledActionUseCaseParams;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetTargetScheduledAction/abstractions.js","sources":["../../../src/features/GetTargetScheduledAction/abstractions.ts"],"sourcesContent":["import { createAbstraction, Result } from \"@webiny/feature/api\";\nimport type { IScheduledAction } from \"~/shared/abstractions.js\";\nimport {\n ScheduledActionNotFoundError,\n ScheduledActionPersistenceError,\n NotAuthorizedError\n} from \"~/domain/errors.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport interface IGetTargetScheduledActionErrors {\n persistence: ScheduledActionPersistenceError;\n notFound: ScheduledActionNotFoundError;\n unauthorized: NotAuthorizedError;\n}\n\ntype GetTargetScheduledActionError =\n IGetTargetScheduledActionErrors[keyof IGetTargetScheduledActionErrors];\n\nexport interface IGetTargetScheduledActionUseCaseParams {\n namespace: string;\n id: string;\n}\n\nexport interface IGetTargetScheduledActionUseCase {\n execute<T extends GenericRecord>(\n params: IGetTargetScheduledActionUseCaseParams\n ): Promise<Result<IScheduledAction<T>, GetTargetScheduledActionError>>;\n}\n\nexport const GetTargetScheduledActionUseCase = createAbstraction<IGetTargetScheduledActionUseCase>(\n \"Scheduler/GetTargetScheduledActionUseCase\"\n);\n\nexport namespace GetTargetScheduledActionUseCase {\n export type Interface = IGetTargetScheduledActionUseCase;\n export type Error = GetTargetScheduledActionError;\n export type Params = IGetTargetScheduledActionUseCaseParams;\n}\n"],"names":["GetTargetScheduledActionUseCase","createAbstraction"],"mappings":";AA6BO,MAAMA,kCAAkCC,kBAC3C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GetTargetScheduledAction Feature
|
|
3
|
+
*
|
|
4
|
+
* Provides the ability to retrieve a target scheduled action by ID.
|
|
5
|
+
* Used for checking if schedules exist and displaying schedule details.
|
|
6
|
+
*/
|
|
7
|
+
export declare const GetTargetScheduledActionFeature: {
|
|
8
|
+
name: string;
|
|
9
|
+
register(container: import("@webiny/di").Container): void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { GetTargetScheduledActionUseCase } from "./GetTargetScheduledActionUseCase.js";
|
|
3
|
+
const GetTargetScheduledActionFeature = createFeature({
|
|
4
|
+
name: "GetTargetScheduledAction",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(GetTargetScheduledActionUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { GetTargetScheduledActionFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/GetTargetScheduledAction/feature.js","sources":["../../../src/features/GetTargetScheduledAction/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetTargetScheduledActionUseCase } from \"./GetTargetScheduledActionUseCase.js\";\n\n/**\n * GetTargetScheduledAction Feature\n *\n * Provides the ability to retrieve a target scheduled action by ID.\n * Used for checking if schedules exist and displaying schedule details.\n */\nexport const GetTargetScheduledActionFeature = createFeature({\n name: \"GetTargetScheduledAction\",\n register(container) {\n container.register(GetTargetScheduledActionUseCase);\n }\n});\n"],"names":["GetTargetScheduledActionFeature","createFeature","container","GetTargetScheduledActionUseCase"],"mappings":";;AASO,MAAMA,kCAAkCC,cAAc;IACzD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./abstractions.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListLatestEntriesUseCase } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/abstractions.js";
|
|
3
|
+
import { IListScheduledActionsParams, IListScheduledActionsResponse, ListScheduledActionsUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
+
import { ScheduledActionModel } from "../../shared/abstractions.js";
|
|
5
|
+
import { CmsSortMapper, CmsWhereMapper } from "@webiny/api-headless-cms";
|
|
6
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
7
|
+
import { SchedulerPermissions } from "../../features/permissions/abstractions.js";
|
|
8
|
+
import { IdentityContext } from "@webiny/api-core/exports/api/security.js";
|
|
9
|
+
/**
|
|
10
|
+
* Lists scheduled actions with optional filtering
|
|
11
|
+
*
|
|
12
|
+
* Flow:
|
|
13
|
+
* 1. Build query filters based on where params (namespace, actionType, targetId, etc.)
|
|
14
|
+
* 2. Fetch entries from CMS storage with pagination and sorting
|
|
15
|
+
* 3. Transform CMS entries to IScheduledAction format
|
|
16
|
+
* 4. Return paginated results with metadata
|
|
17
|
+
*/
|
|
18
|
+
declare class ListScheduledActionsUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
19
|
+
private listEntriesUseCase;
|
|
20
|
+
private model;
|
|
21
|
+
private cmsWhereMapper;
|
|
22
|
+
private cmsSortMapper;
|
|
23
|
+
private permissions;
|
|
24
|
+
private identityContext;
|
|
25
|
+
constructor(listEntriesUseCase: ListLatestEntriesUseCase.Interface, model: ScheduledActionModel.Interface, cmsWhereMapper: CmsWhereMapper.Interface, cmsSortMapper: CmsSortMapper.Interface, permissions: SchedulerPermissions.Interface, identityContext: IdentityContext.Interface);
|
|
26
|
+
execute<T extends GenericRecord>(params: IListScheduledActionsParams): Promise<Result<IListScheduledActionsResponse<T>, UseCaseAbstraction.Error>>;
|
|
27
|
+
}
|
|
28
|
+
export declare const ListScheduledActionsUseCase: typeof ListScheduledActionsUseCaseImpl & {
|
|
29
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListScheduledActionsUseCase>;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListLatestEntriesUseCase } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/abstractions.js";
|
|
3
|
+
import { ListScheduledActionsUseCase } from "./abstractions.js";
|
|
4
|
+
import { ScheduledActionModel } from "../../shared/abstractions.js";
|
|
5
|
+
import { NotAuthorizedError, ScheduledActionPersistenceError } from "../../domain/errors.js";
|
|
6
|
+
import { CmsSortMapper, CmsWhereMapper } from "@webiny/api-headless-cms";
|
|
7
|
+
import { SchedulerPermissions } from "../permissions/abstractions.js";
|
|
8
|
+
import { IdentityContext } from "@webiny/api-core/exports/api/security.js";
|
|
9
|
+
import { ScheduledActionMapper } from "../../domain/ScheduledActionMapper.js";
|
|
10
|
+
class ListScheduledActionsUseCaseImpl {
|
|
11
|
+
constructor(listEntriesUseCase, model, cmsWhereMapper, cmsSortMapper, permissions, identityContext){
|
|
12
|
+
this.listEntriesUseCase = listEntriesUseCase;
|
|
13
|
+
this.model = model;
|
|
14
|
+
this.cmsWhereMapper = cmsWhereMapper;
|
|
15
|
+
this.cmsSortMapper = cmsSortMapper;
|
|
16
|
+
this.permissions = permissions;
|
|
17
|
+
this.identityContext = identityContext;
|
|
18
|
+
}
|
|
19
|
+
async execute(params) {
|
|
20
|
+
const hasPermission = await this.permissions.canRead("action");
|
|
21
|
+
if (!hasPermission) return Result.fail(new NotAuthorizedError());
|
|
22
|
+
const ownRecordsOnly = await this.permissions.onlyOwnRecords("action");
|
|
23
|
+
const { where: initialWhere, sort: sortInput, limit, after } = params;
|
|
24
|
+
const where = this.cmsWhereMapper.map({
|
|
25
|
+
input: initialWhere || {},
|
|
26
|
+
fields: this.model.fields
|
|
27
|
+
});
|
|
28
|
+
if (ownRecordsOnly) {
|
|
29
|
+
const identity = this.identityContext.getIdentity();
|
|
30
|
+
where.createdBy = identity.id;
|
|
31
|
+
}
|
|
32
|
+
const sort = this.cmsSortMapper.map({
|
|
33
|
+
input: sortInput,
|
|
34
|
+
fields: this.model.fields
|
|
35
|
+
});
|
|
36
|
+
const listResult = await this.listEntriesUseCase.execute(this.model, {
|
|
37
|
+
where,
|
|
38
|
+
sort,
|
|
39
|
+
limit,
|
|
40
|
+
after
|
|
41
|
+
});
|
|
42
|
+
if (listResult.isFail()) return Result.fail(new ScheduledActionPersistenceError(listResult.error));
|
|
43
|
+
const { entries, meta } = listResult.value;
|
|
44
|
+
return Result.ok({
|
|
45
|
+
items: ScheduledActionMapper.toActions(entries),
|
|
46
|
+
meta
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const ListScheduledActionsUseCase_ListScheduledActionsUseCase = ListScheduledActionsUseCase.createImplementation({
|
|
51
|
+
implementation: ListScheduledActionsUseCaseImpl,
|
|
52
|
+
dependencies: [
|
|
53
|
+
ListLatestEntriesUseCase,
|
|
54
|
+
ScheduledActionModel,
|
|
55
|
+
CmsWhereMapper,
|
|
56
|
+
CmsSortMapper,
|
|
57
|
+
SchedulerPermissions,
|
|
58
|
+
IdentityContext
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
export { ListScheduledActionsUseCase_ListScheduledActionsUseCase as ListScheduledActionsUseCase };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=ListScheduledActionsUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ListScheduledActions/ListScheduledActionsUseCase.js","sources":["../../../src/features/ListScheduledActions/ListScheduledActionsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { ListLatestEntriesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/abstractions.js\";\nimport {\n IListScheduledActionsParams,\n IListScheduledActionsResponse,\n ListScheduledActionsUseCase as UseCaseAbstraction\n} from \"./abstractions.js\";\nimport type { IScheduledActionEntryValues } from \"~/shared/abstractions.js\";\nimport { ScheduledActionModel } from \"~/shared/abstractions.js\";\nimport { NotAuthorizedError, ScheduledActionPersistenceError } from \"~/domain/errors.js\";\nimport { CmsSortMapper, CmsWhereMapper } from \"@webiny/api-headless-cms\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { SchedulerPermissions } from \"~/features/permissions/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/exports/api/security.js\";\nimport { ScheduledActionMapper } from \"~/domain/ScheduledActionMapper.js\";\n\n/**\n * Lists scheduled actions with optional filtering\n *\n * Flow:\n * 1. Build query filters based on where params (namespace, actionType, targetId, etc.)\n * 2. Fetch entries from CMS storage with pagination and sorting\n * 3. Transform CMS entries to IScheduledAction format\n * 4. Return paginated results with metadata\n */\nclass ListScheduledActionsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private listEntriesUseCase: ListLatestEntriesUseCase.Interface,\n private model: ScheduledActionModel.Interface,\n private cmsWhereMapper: CmsWhereMapper.Interface,\n private cmsSortMapper: CmsSortMapper.Interface,\n private permissions: SchedulerPermissions.Interface,\n private identityContext: IdentityContext.Interface\n ) {}\n\n async execute<T extends GenericRecord>(\n params: IListScheduledActionsParams\n ): Promise<Result<IListScheduledActionsResponse<T>, UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canRead(\"action\");\n if (!hasPermission) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const ownRecordsOnly = await this.permissions.onlyOwnRecords(\"action\");\n\n const { where: initialWhere, sort: sortInput, limit, after } = params;\n\n const where = this.cmsWhereMapper.map({\n input: initialWhere || {},\n fields: this.model.fields\n });\n\n if (ownRecordsOnly) {\n const identity = this.identityContext.getIdentity();\n where!.createdBy = identity.id;\n }\n\n const sort = this.cmsSortMapper.map({\n input: sortInput,\n fields: this.model.fields\n });\n // List entries from CMS\n const listResult = await this.listEntriesUseCase.execute<IScheduledActionEntryValues<T>>(\n this.model,\n {\n where,\n sort,\n limit,\n after\n }\n );\n\n if (listResult.isFail()) {\n return Result.fail(new ScheduledActionPersistenceError(listResult.error));\n }\n\n const { entries, meta } = listResult.value;\n\n return Result.ok({\n items: ScheduledActionMapper.toActions<T>(entries),\n meta\n });\n }\n}\n\nexport const ListScheduledActionsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListScheduledActionsUseCaseImpl,\n dependencies: [\n ListLatestEntriesUseCase,\n ScheduledActionModel,\n CmsWhereMapper,\n CmsSortMapper,\n SchedulerPermissions,\n IdentityContext\n ]\n});\n"],"names":["ListScheduledActionsUseCaseImpl","listEntriesUseCase","model","cmsWhereMapper","cmsSortMapper","permissions","identityContext","params","hasPermission","Result","NotAuthorizedError","ownRecordsOnly","initialWhere","sortInput","limit","after","where","identity","sort","listResult","ScheduledActionPersistenceError","entries","meta","ScheduledActionMapper","ListScheduledActionsUseCase","UseCaseAbstraction","ListLatestEntriesUseCase","ScheduledActionModel","CmsWhereMapper","CmsSortMapper","SchedulerPermissions","IdentityContext"],"mappings":";;;;;;;;;AAyBA,MAAMA;IACF,YACYC,kBAAsD,EACtDC,KAAqC,EACrCC,cAAwC,EACxCC,aAAsC,EACtCC,WAA2C,EAC3CC,eAA0C,CACpD;aANUL,kBAAkB,GAAlBA;aACAC,KAAK,GAALA;aACAC,cAAc,GAAdA;aACAC,aAAa,GAAbA;aACAC,WAAW,GAAXA;aACAC,eAAe,GAAfA;IACT;IAEH,MAAM,QACFC,MAAmC,EACwC;QAC3E,MAAMC,gBAAgB,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;QACrD,IAAI,CAACA,eACD,OAAOC,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,iBAAiB,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC;QAE7D,MAAM,EAAE,OAAOC,YAAY,EAAE,MAAMC,SAAS,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGR;QAE/D,MAAMS,QAAQ,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;YAClC,OAAOJ,gBAAgB,CAAC;YACxB,QAAQ,IAAI,CAAC,KAAK,CAAC,MAAM;QAC7B;QAEA,IAAID,gBAAgB;YAChB,MAAMM,WAAW,IAAI,CAAC,eAAe,CAAC,WAAW;YACjDD,MAAO,SAAS,GAAGC,SAAS,EAAE;QAClC;QAEA,MAAMC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;YAChC,OAAOL;YACP,QAAQ,IAAI,CAAC,KAAK,CAAC,MAAM;QAC7B;QAEA,MAAMM,aAAa,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CACpD,IAAI,CAAC,KAAK,EACV;YACIH;YACAE;YACAJ;YACAC;QACJ;QAGJ,IAAII,WAAW,MAAM,IACjB,OAAOV,OAAO,IAAI,CAAC,IAAIW,gCAAgCD,WAAW,KAAK;QAG3E,MAAM,EAAEE,OAAO,EAAEC,IAAI,EAAE,GAAGH,WAAW,KAAK;QAE1C,OAAOV,OAAO,EAAE,CAAC;YACb,OAAOc,sBAAsB,SAAS,CAAIF;YAC1CC;QACJ;IACJ;AACJ;AAEO,MAAME,0DAA8BC,4BAAAA,oBAAuC,CAAC;IAC/E,gBAAgBzB;IAChB,cAAc;QACV0B;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { IScheduledAction, ScheduledActionType } from "../../shared/abstractions.js";
|
|
3
|
+
import { ScheduledActionPersistenceError, NotAuthorizedError } from "../../domain/errors.js";
|
|
4
|
+
import type { CmsEntryListSort, CmsEntryMeta } from "@webiny/api-headless-cms/types/index.js";
|
|
5
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
6
|
+
/**
|
|
7
|
+
* ListScheduledActionsUseCase - List scheduled actions with optional filtering
|
|
8
|
+
*
|
|
9
|
+
* Used to retrieve all scheduled actions for a namespace (e.g., all actions for Article model)
|
|
10
|
+
* or all actions of a specific type across namespaces.
|
|
11
|
+
*
|
|
12
|
+
* This is critical for CMS CRUD views where we need to show ALL scheduled actions
|
|
13
|
+
* (publish, unpublish, delete) for a specific content model.
|
|
14
|
+
*/
|
|
15
|
+
export type DateISOString = `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z`;
|
|
16
|
+
export interface IListScheduledActionsWhere {
|
|
17
|
+
namespace?: string;
|
|
18
|
+
namespace_startsWith?: string;
|
|
19
|
+
actionType?: ScheduledActionType;
|
|
20
|
+
targetId?: string;
|
|
21
|
+
targetId_startsWith?: string;
|
|
22
|
+
scheduledBy?: string;
|
|
23
|
+
scheduledFor?: DateISOString;
|
|
24
|
+
scheduledFor_gte?: DateISOString;
|
|
25
|
+
scheduledFor_lte?: DateISOString;
|
|
26
|
+
}
|
|
27
|
+
export type IListScheduledActionsMeta = CmsEntryMeta;
|
|
28
|
+
export interface IListScheduledActionsParams {
|
|
29
|
+
where: IListScheduledActionsWhere;
|
|
30
|
+
sort?: CmsEntryListSort;
|
|
31
|
+
limit?: number;
|
|
32
|
+
after?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface IListScheduledActionsResponse<T extends GenericRecord> {
|
|
35
|
+
items: IScheduledAction<T>[];
|
|
36
|
+
meta: CmsEntryMeta;
|
|
37
|
+
}
|
|
38
|
+
export interface IListScheduledActionsErrors {
|
|
39
|
+
persistence: ScheduledActionPersistenceError;
|
|
40
|
+
unauthorized: NotAuthorizedError;
|
|
41
|
+
}
|
|
42
|
+
type ListScheduledActionsError = IListScheduledActionsErrors[keyof IListScheduledActionsErrors];
|
|
43
|
+
export interface IListScheduledActionsUseCase {
|
|
44
|
+
execute<T extends GenericRecord>(params: IListScheduledActionsParams): Promise<Result<IListScheduledActionsResponse<T>, ListScheduledActionsError>>;
|
|
45
|
+
}
|
|
46
|
+
/** List scheduled actions. */
|
|
47
|
+
export declare const ListScheduledActionsUseCase: import("@webiny/di").Abstraction<IListScheduledActionsUseCase>;
|
|
48
|
+
export declare namespace ListScheduledActionsUseCase {
|
|
49
|
+
type Interface = IListScheduledActionsUseCase;
|
|
50
|
+
type Error = ListScheduledActionsError;
|
|
51
|
+
type Params = IListScheduledActionsParams;
|
|
52
|
+
type Where = IListScheduledActionsWhere;
|
|
53
|
+
type Sort = CmsEntryListSort;
|
|
54
|
+
type Meta = IListScheduledActionsMeta;
|
|
55
|
+
type Response<T extends GenericRecord> = IListScheduledActionsResponse<T>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ListScheduledActions/abstractions.js","sources":["../../../src/features/ListScheduledActions/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { Result } from \"@webiny/feature/api\";\nimport type { IScheduledAction, ScheduledActionType } from \"~/shared/abstractions.js\";\nimport { ScheduledActionPersistenceError, NotAuthorizedError } from \"~/domain/errors.js\";\nimport type { CmsEntryListSort, CmsEntryMeta } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\n/**\n * ListScheduledActionsUseCase - List scheduled actions with optional filtering\n *\n * Used to retrieve all scheduled actions for a namespace (e.g., all actions for Article model)\n * or all actions of a specific type across namespaces.\n *\n * This is critical for CMS CRUD views where we need to show ALL scheduled actions\n * (publish, unpublish, delete) for a specific content model.\n */\n\nexport type DateISOString =\n `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z`;\n\nexport interface IListScheduledActionsWhere {\n namespace?: string;\n namespace_startsWith?: string;\n actionType?: ScheduledActionType;\n targetId?: string;\n targetId_startsWith?: string;\n scheduledBy?: string;\n scheduledFor?: DateISOString;\n scheduledFor_gte?: DateISOString;\n scheduledFor_lte?: DateISOString;\n}\n\nexport type IListScheduledActionsMeta = CmsEntryMeta;\n\nexport interface IListScheduledActionsParams {\n where: IListScheduledActionsWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n after?: string;\n}\n\nexport interface IListScheduledActionsResponse<T extends GenericRecord> {\n items: IScheduledAction<T>[];\n meta: CmsEntryMeta;\n}\n\nexport interface IListScheduledActionsErrors {\n persistence: ScheduledActionPersistenceError;\n unauthorized: NotAuthorizedError;\n}\n\ntype ListScheduledActionsError = IListScheduledActionsErrors[keyof IListScheduledActionsErrors];\n\nexport interface IListScheduledActionsUseCase {\n execute<T extends GenericRecord>(\n params: IListScheduledActionsParams\n ): Promise<Result<IListScheduledActionsResponse<T>, ListScheduledActionsError>>;\n}\n\n/** List scheduled actions. */\nexport const ListScheduledActionsUseCase = createAbstraction<IListScheduledActionsUseCase>(\n \"Scheduler/ListScheduledActionsUseCase\"\n);\n\nexport namespace ListScheduledActionsUseCase {\n export type Interface = IListScheduledActionsUseCase;\n export type Error = ListScheduledActionsError;\n export type Params = IListScheduledActionsParams;\n export type Where = IListScheduledActionsWhere;\n export type Sort = CmsEntryListSort;\n export type Meta = IListScheduledActionsMeta;\n export type Response<T extends GenericRecord> = IListScheduledActionsResponse<T>;\n}\n"],"names":["ListScheduledActionsUseCase","createAbstraction"],"mappings":";AA4DO,MAAMA,8BAA8BC,kBACvC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ListScheduledActions Feature
|
|
3
|
+
*
|
|
4
|
+
* Provides the ability to list scheduled actions with optional filtering by namespace or actionType.
|
|
5
|
+
* Critical for CMS CRUD views showing all scheduled actions for a content model.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ListScheduledActionsFeature: {
|
|
8
|
+
name: string;
|
|
9
|
+
register(container: import("@webiny/di").Container): void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { ListScheduledActionsUseCase } from "./ListScheduledActionsUseCase.js";
|
|
3
|
+
const ListScheduledActionsFeature = createFeature({
|
|
4
|
+
name: "ListScheduledActions",
|
|
5
|
+
register (container) {
|
|
6
|
+
container.register(ListScheduledActionsUseCase);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
export { ListScheduledActionsFeature };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ListScheduledActions/feature.js","sources":["../../../src/features/ListScheduledActions/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListScheduledActionsUseCase } from \"./ListScheduledActionsUseCase.js\";\n\n/**\n * ListScheduledActions Feature\n *\n * Provides the ability to list scheduled actions with optional filtering by namespace or actionType.\n * Critical for CMS CRUD views showing all scheduled actions for a content model.\n */\nexport const ListScheduledActionsFeature = createFeature({\n name: \"ListScheduledActions\",\n register(container) {\n container.register(ListScheduledActionsUseCase);\n }\n});\n"],"names":["ListScheduledActionsFeature","createFeature","container","ListScheduledActionsUseCase"],"mappings":";;AASO,MAAMA,8BAA8BC,cAAc;IACrD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./abstractions.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NamespaceHandler, NamespaceHandlerExecutioner as NamespaceHandlerExecutionerAbstraction } from "./abstractions.js";
|
|
2
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
+
declare class NamespaceHandlerExecutionerImpl implements NamespaceHandlerExecutionerAbstraction.Interface {
|
|
4
|
+
private readonly namespaceHandlers;
|
|
5
|
+
constructor(namespaceHandlers: NamespaceHandler.Interface<GenericRecord>[]);
|
|
6
|
+
execute(params: NamespaceHandlerExecutionerAbstraction.Params): NamespaceHandlerExecutionerAbstraction.Response;
|
|
7
|
+
}
|
|
8
|
+
export declare const NamespaceHandlerExecutioner: typeof NamespaceHandlerExecutionerImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").INamespaceHandlerExecutioner>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NamespaceHandler, NamespaceHandlerExecutioner } from "./abstractions.js";
|
|
2
|
+
import { Result } from "@webiny/feature/exports/api.js";
|
|
3
|
+
import { NamespaceHandlerNotFoundError } from "../../domain/errors.js";
|
|
4
|
+
class NamespaceHandlerExecutionerImpl {
|
|
5
|
+
constructor(namespaceHandlers){
|
|
6
|
+
this.namespaceHandlers = namespaceHandlers;
|
|
7
|
+
}
|
|
8
|
+
async execute(params) {
|
|
9
|
+
for (const handler of this.namespaceHandlers)if (false !== handler.canHandle(params.namespace)) return handler.execute(params);
|
|
10
|
+
return Result.fail(new NamespaceHandlerNotFoundError(params.namespace));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const NamespaceHandlerExecutioner_NamespaceHandlerExecutioner = NamespaceHandlerExecutioner.createImplementation({
|
|
14
|
+
implementation: NamespaceHandlerExecutionerImpl,
|
|
15
|
+
dependencies: [
|
|
16
|
+
[
|
|
17
|
+
NamespaceHandler,
|
|
18
|
+
{
|
|
19
|
+
multiple: true
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
]
|
|
23
|
+
});
|
|
24
|
+
export { NamespaceHandlerExecutioner_NamespaceHandlerExecutioner as NamespaceHandlerExecutioner };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=NamespaceHandlerExecutioner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/NamespaceHandler/NamespaceHandlerExecutioner.js","sources":["../../../src/features/NamespaceHandler/NamespaceHandlerExecutioner.ts"],"sourcesContent":["import {\n NamespaceHandler,\n NamespaceHandlerExecutioner as NamespaceHandlerExecutionerAbstraction\n} from \"./abstractions.js\";\nimport { Result } from \"@webiny/feature/exports/api.js\";\nimport { NamespaceHandlerNotFoundError } from \"~/domain/errors.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\n\nclass NamespaceHandlerExecutionerImpl implements NamespaceHandlerExecutionerAbstraction.Interface {\n public constructor(\n private readonly namespaceHandlers: NamespaceHandler.Interface<GenericRecord>[]\n ) {}\n\n public async execute(\n params: NamespaceHandlerExecutionerAbstraction.Params\n ): NamespaceHandlerExecutionerAbstraction.Response {\n for (const handler of this.namespaceHandlers) {\n if (handler.canHandle(params.namespace) === false) {\n continue;\n }\n return handler.execute(params);\n }\n\n return Result.fail(new NamespaceHandlerNotFoundError(params.namespace));\n }\n}\n\nexport const NamespaceHandlerExecutioner =\n NamespaceHandlerExecutionerAbstraction.createImplementation({\n implementation: NamespaceHandlerExecutionerImpl,\n dependencies: [\n [\n NamespaceHandler,\n {\n multiple: true\n }\n ]\n ]\n });\n"],"names":["NamespaceHandlerExecutionerImpl","namespaceHandlers","params","handler","Result","NamespaceHandlerNotFoundError","NamespaceHandlerExecutioner","NamespaceHandlerExecutionerAbstraction","NamespaceHandler"],"mappings":";;;AAQA,MAAMA;IACF,YACqBC,iBAA8D,CACjF;aADmBA,iBAAiB,GAAjBA;IAClB;IAEH,MAAa,QACTC,MAAqD,EACN;QAC/C,KAAK,MAAMC,WAAW,IAAI,CAAC,iBAAiB,CACxC,IAAIA,AAAwC,UAAxCA,QAAQ,SAAS,CAACD,OAAO,SAAS,GAGtC,OAAOC,QAAQ,OAAO,CAACD;QAG3B,OAAOE,OAAO,IAAI,CAAC,IAAIC,8BAA8BH,OAAO,SAAS;IACzE;AACJ;AAEO,MAAMI,0DACTC,4BAAAA,oBAA2D,CAAC;IACxD,gBAAgBP;IAChB,cAAc;QACV;YACIQ;YACA;gBACI,UAAU;YACd;SACH;KACJ;AACL"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
3
|
+
import type { ScheduledActionType } from "../../shared/abstractions.js";
|
|
4
|
+
import { NamespaceHandlerNotFoundError } from "../../domain/errors.js";
|
|
5
|
+
export interface INamespaceHandlerErrors {
|
|
6
|
+
notFound: NamespaceHandlerNotFoundError;
|
|
7
|
+
}
|
|
8
|
+
type NamespaceHandlerError = INamespaceHandlerErrors[keyof INamespaceHandlerErrors];
|
|
9
|
+
/**
|
|
10
|
+
* Handling of specific app.
|
|
11
|
+
*/
|
|
12
|
+
export interface INamespaceHandlerParams {
|
|
13
|
+
scheduleId: string;
|
|
14
|
+
targetId: string;
|
|
15
|
+
actionType: ScheduledActionType;
|
|
16
|
+
namespace: string;
|
|
17
|
+
immediately: boolean | undefined;
|
|
18
|
+
scheduleFor: Date;
|
|
19
|
+
}
|
|
20
|
+
export type INamespaceHandlerResult<T extends GenericRecord = GenericRecord> = T & {
|
|
21
|
+
title: string;
|
|
22
|
+
targetId: string;
|
|
23
|
+
actionType: ScheduledActionType;
|
|
24
|
+
namespace: string;
|
|
25
|
+
scheduleId: string;
|
|
26
|
+
};
|
|
27
|
+
export interface INamespaceHandler<T extends GenericRecord = GenericRecord> {
|
|
28
|
+
canHandle(namespace: string): boolean;
|
|
29
|
+
execute(params: INamespaceHandlerParams): Promise<Result<INamespaceHandlerResult<T>, NamespaceHandlerError>>;
|
|
30
|
+
}
|
|
31
|
+
/** Handle namespace-specific scheduled action logic. */
|
|
32
|
+
export declare const NamespaceHandler: import("@webiny/di").Abstraction<INamespaceHandler<GenericRecord>>;
|
|
33
|
+
export declare namespace NamespaceHandler {
|
|
34
|
+
type Interface<T extends GenericRecord> = INamespaceHandler<T>;
|
|
35
|
+
type Response<T extends GenericRecord> = Promise<Result<INamespaceHandlerResult<T>, NamespaceHandlerError>>;
|
|
36
|
+
type Params = INamespaceHandlerParams;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Executioner of the app handlers.
|
|
40
|
+
*/
|
|
41
|
+
export interface INamespaceHandlerExecutioner {
|
|
42
|
+
execute<T extends GenericRecord = GenericRecord>(params: INamespaceHandlerParams): Promise<Result<INamespaceHandlerResult<T>, NamespaceHandlerError>>;
|
|
43
|
+
}
|
|
44
|
+
export declare const NamespaceHandlerExecutioner: import("@webiny/di").Abstraction<INamespaceHandlerExecutioner>;
|
|
45
|
+
export declare namespace NamespaceHandlerExecutioner {
|
|
46
|
+
type Interface = INamespaceHandlerExecutioner;
|
|
47
|
+
type Response = Promise<Result<INamespaceHandlerResult, NamespaceHandlerError>>;
|
|
48
|
+
type Params = INamespaceHandlerParams;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const NamespaceHandler = createAbstraction("Scheduler/NamespaceHandler");
|
|
3
|
+
const NamespaceHandlerExecutioner = createAbstraction("Scheduler/NamespaceHandlerExecutioner");
|
|
4
|
+
export { NamespaceHandler, NamespaceHandlerExecutioner };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/NamespaceHandler/abstractions.js","sources":["../../../src/features/NamespaceHandler/abstractions.ts"],"sourcesContent":["import { createAbstraction, Result } from \"@webiny/feature/api\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport type { ScheduledActionType } from \"~/shared/abstractions.js\";\nimport { NamespaceHandlerNotFoundError } from \"~/domain/errors.js\";\n\nexport interface INamespaceHandlerErrors {\n notFound: NamespaceHandlerNotFoundError;\n}\n\ntype NamespaceHandlerError = INamespaceHandlerErrors[keyof INamespaceHandlerErrors];\n/**\n * Handling of specific app.\n */\nexport interface INamespaceHandlerParams {\n scheduleId: string;\n targetId: string;\n actionType: ScheduledActionType;\n namespace: string;\n immediately: boolean | undefined;\n scheduleFor: Date;\n}\n\nexport type INamespaceHandlerResult<T extends GenericRecord = GenericRecord> = T & {\n title: string;\n targetId: string;\n actionType: ScheduledActionType;\n namespace: string;\n scheduleId: string;\n};\n\nexport interface INamespaceHandler<T extends GenericRecord = GenericRecord> {\n canHandle(namespace: string): boolean;\n execute(\n params: INamespaceHandlerParams\n ): Promise<Result<INamespaceHandlerResult<T>, NamespaceHandlerError>>;\n}\n\n/** Handle namespace-specific scheduled action logic. */\nexport const NamespaceHandler = createAbstraction<INamespaceHandler>(\"Scheduler/NamespaceHandler\");\n\nexport namespace NamespaceHandler {\n export type Interface<T extends GenericRecord> = INamespaceHandler<T>;\n export type Response<T extends GenericRecord> = Promise<\n Result<INamespaceHandlerResult<T>, NamespaceHandlerError>\n >;\n export type Params = INamespaceHandlerParams;\n}\n\n/**\n * Executioner of the app handlers.\n */\n\nexport interface INamespaceHandlerExecutioner {\n execute<T extends GenericRecord = GenericRecord>(\n params: INamespaceHandlerParams\n ): Promise<Result<INamespaceHandlerResult<T>, NamespaceHandlerError>>;\n}\n\nexport const NamespaceHandlerExecutioner = createAbstraction<INamespaceHandlerExecutioner>(\n \"Scheduler/NamespaceHandlerExecutioner\"\n);\n\nexport namespace NamespaceHandlerExecutioner {\n export type Interface = INamespaceHandlerExecutioner;\n export type Response = Promise<Result<INamespaceHandlerResult, NamespaceHandlerError>>;\n export type Params = INamespaceHandlerParams;\n}\n"],"names":["NamespaceHandler","createAbstraction","NamespaceHandlerExecutioner"],"mappings":";AAsCO,MAAMA,mBAAmBC,kBAAqC;AAoB9D,MAAMC,8BAA8BD,kBACvC"}
|