@webiny/api-scheduler 0.0.0-unstable.81ae05e56b → 0.0.0-unstable.a4f3e4ea8b
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.js +11 -14
- package/constants.js.map +1 -1
- package/context.d.ts +2 -6
- package/context.js +29 -37
- package/context.js.map +1 -1
- package/domain/SchedulePrivateModel.js +25 -22
- package/domain/SchedulePrivateModel.js.map +1 -1
- package/domain/ScheduledActionId.js +12 -4
- package/domain/ScheduledActionId.js.map +1 -1
- package/domain/ScheduledActionIdWithVersion.js +5 -6
- package/domain/ScheduledActionIdWithVersion.js.map +1 -1
- package/domain/ScheduledActionMapper.js +37 -32
- package/domain/ScheduledActionMapper.js.map +1 -1
- package/domain/errors.js +52 -80
- package/domain/errors.js.map +1 -1
- package/domain/isValidDate.js +4 -9
- package/domain/isValidDate.js.map +1 -1
- package/exports/api/scheduler.js +1 -3
- package/features/CancelScheduledAction/CancelScheduledActionUseCase.d.ts +3 -12
- package/features/CancelScheduledAction/CancelScheduledActionUseCase.js +46 -68
- package/features/CancelScheduledAction/CancelScheduledActionUseCase.js.map +1 -1
- package/features/CancelScheduledAction/abstractions.d.ts +1 -0
- package/features/CancelScheduledAction/abstractions.js +2 -11
- package/features/CancelScheduledAction/abstractions.js.map +1 -1
- package/features/CancelScheduledAction/feature.d.ts +4 -1
- package/features/CancelScheduledAction/feature.js +6 -12
- package/features/CancelScheduledAction/feature.js.map +1 -1
- package/features/CancelScheduledAction/index.js +0 -2
- package/features/ExecuteScheduledAction/ExecuteScheduledActionUseCase.js +73 -92
- package/features/ExecuteScheduledAction/ExecuteScheduledActionUseCase.js.map +1 -1
- package/features/ExecuteScheduledAction/ScheduledActionHandlerComposite.js +21 -25
- package/features/ExecuteScheduledAction/ScheduledActionHandlerComposite.js.map +1 -1
- package/features/ExecuteScheduledAction/abstractions.d.ts +1 -0
- package/features/ExecuteScheduledAction/abstractions.js +12 -37
- package/features/ExecuteScheduledAction/abstractions.js.map +1 -1
- package/features/ExecuteScheduledAction/feature.d.ts +4 -1
- package/features/ExecuteScheduledAction/feature.js +7 -13
- package/features/ExecuteScheduledAction/feature.js.map +1 -1
- package/features/ExecuteScheduledAction/index.js +0 -2
- package/features/GetScheduledAction/GetScheduledActionUseCase.d.ts +3 -11
- package/features/GetScheduledAction/GetScheduledActionUseCase.js +37 -52
- package/features/GetScheduledAction/GetScheduledActionUseCase.js.map +1 -1
- package/features/GetScheduledAction/abstractions.js +2 -12
- package/features/GetScheduledAction/abstractions.js.map +1 -1
- package/features/GetScheduledAction/feature.d.ts +4 -1
- package/features/GetScheduledAction/feature.js +6 -12
- package/features/GetScheduledAction/feature.js.map +1 -1
- package/features/GetScheduledAction/index.js +0 -2
- package/features/GetTargetScheduledAction/GetTargetScheduledActionUseCase.d.ts +3 -14
- package/features/GetTargetScheduledAction/GetTargetScheduledActionUseCase.js +50 -69
- package/features/GetTargetScheduledAction/GetTargetScheduledActionUseCase.js.map +1 -1
- package/features/GetTargetScheduledAction/abstractions.js +2 -1
- package/features/GetTargetScheduledAction/abstractions.js.map +1 -1
- package/features/GetTargetScheduledAction/feature.d.ts +4 -1
- package/features/GetTargetScheduledAction/feature.js +6 -12
- package/features/GetTargetScheduledAction/feature.js.map +1 -1
- package/features/GetTargetScheduledAction/index.js +0 -2
- package/features/ListScheduledActions/ListScheduledActionsUseCase.d.ts +3 -12
- package/features/ListScheduledActions/ListScheduledActionsUseCase.js +53 -64
- package/features/ListScheduledActions/ListScheduledActionsUseCase.js.map +1 -1
- package/features/ListScheduledActions/abstractions.js +2 -13
- package/features/ListScheduledActions/abstractions.js.map +1 -1
- package/features/ListScheduledActions/feature.d.ts +4 -1
- package/features/ListScheduledActions/feature.js +6 -12
- package/features/ListScheduledActions/feature.js.map +1 -1
- package/features/ListScheduledActions/index.js +0 -2
- package/features/NamespaceHandler/NamespaceHandlerExecutioner.js +18 -17
- package/features/NamespaceHandler/NamespaceHandlerExecutioner.js.map +1 -1
- package/features/NamespaceHandler/abstractions.js +3 -13
- package/features/NamespaceHandler/abstractions.js.map +1 -1
- 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.js +0 -2
- package/features/ScheduleAction/ScheduleActionUseCase.js +150 -200
- package/features/ScheduleAction/ScheduleActionUseCase.js.map +1 -1
- package/features/ScheduleAction/abstractions.d.ts +1 -0
- package/features/ScheduleAction/abstractions.js +2 -11
- package/features/ScheduleAction/abstractions.js.map +1 -1
- package/features/ScheduleAction/feature.d.ts +4 -1
- package/features/ScheduleAction/feature.js +6 -12
- package/features/ScheduleAction/feature.js.map +1 -1
- package/features/ScheduleAction/index.js +0 -2
- package/features/SchedulerFeature.d.ts +4 -1
- package/features/SchedulerFeature.js +11 -19
- package/features/SchedulerFeature.js.map +1 -1
- package/features/SchedulerService/VoidSchedulerService.d.ts +9 -9
- package/features/SchedulerService/VoidSchedulerService.js +17 -24
- package/features/SchedulerService/VoidSchedulerService.js.map +1 -1
- package/features/permissions/SchedulerPermissionsResolver.d.ts +10 -0
- package/features/permissions/SchedulerPermissionsResolver.js +23 -0
- package/features/permissions/SchedulerPermissionsResolver.js.map +1 -0
- package/features/permissions/abstractions.d.ts +16 -0
- package/features/permissions/abstractions.js +6 -0
- package/features/permissions/abstractions.js.map +1 -0
- package/graphql/SchedulerGraphQLFactory.js +84 -113
- package/graphql/SchedulerGraphQLFactory.js.map +1 -1
- package/graphql/feature.d.ts +4 -0
- package/graphql/feature.js +11 -0
- package/graphql/feature.js.map +1 -0
- package/graphql/index.js +0 -2
- package/index.d.ts +1 -1
- package/index.js +2 -4
- package/package.json +21 -26
- package/shared/abstractions.d.ts +19 -2
- package/shared/abstractions.js +4 -32
- package/shared/abstractions.js.map +1 -1
- package/createEventHandler.d.ts +0 -14
- package/createEventHandler.js +0 -50
- package/createEventHandler.js.map +0 -1
- package/createScheduler.d.ts +0 -6
- package/createScheduler.js +0 -11
- package/createScheduler.js.map +0 -1
- package/domain/permissions.d.ts +0 -45
- package/domain/permissions.js +0 -13
- package/domain/permissions.js.map +0 -1
- package/exports/api/scheduler.js.map +0 -1
- package/features/CancelScheduledAction/index.js.map +0 -1
- package/features/ExecuteScheduledAction/index.js.map +0 -1
- package/features/GetScheduledAction/index.js.map +0 -1
- package/features/GetTargetScheduledAction/index.js.map +0 -1
- package/features/ListScheduledActions/index.js.map +0 -1
- package/features/NamespaceHandler/index.js.map +0 -1
- package/features/ScheduleAction/index.js.map +0 -1
- package/features/SchedulerService/EventBridgeSchedulerService.d.ts +0 -26
- package/features/SchedulerService/EventBridgeSchedulerService.js +0 -133
- package/features/SchedulerService/EventBridgeSchedulerService.js.map +0 -1
- package/graphql/index.js.map +0 -1
- package/index.js.map +0 -1
- package/manifest.d.ts +0 -17
- package/manifest.js +0 -39
- package/manifest.js.map +0 -1
package/constants.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
/** Constant identifier for the unpublish scheduled action type. */
|
|
13
|
-
export const SCHEDULED_ACTION_UNPUBLISH = "unpublish";
|
|
14
|
-
export const SCHEDULED_ACTIONS = [SCHEDULED_ACTION_PUBLISH, SCHEDULED_ACTION_UNPUBLISH];
|
|
1
|
+
const SCHEDULE_MODEL_ID = "wbySchedule";
|
|
2
|
+
const SCHEDULE_ID_PREFIX = "wby-schedule-";
|
|
3
|
+
const SCHEDULE_MIN_FUTURE_SECONDS = 65;
|
|
4
|
+
const SCHEDULED_ACTION_EVENT_IDENTIFIER = "WebinyScheduledAction";
|
|
5
|
+
const SCHEDULED_ACTION_PUBLISH = "publish";
|
|
6
|
+
const SCHEDULED_ACTION_UNPUBLISH = "unpublish";
|
|
7
|
+
const SCHEDULED_ACTIONS = [
|
|
8
|
+
SCHEDULED_ACTION_PUBLISH,
|
|
9
|
+
SCHEDULED_ACTION_UNPUBLISH
|
|
10
|
+
];
|
|
11
|
+
export { SCHEDULED_ACTIONS, SCHEDULED_ACTION_EVENT_IDENTIFIER, SCHEDULED_ACTION_PUBLISH, SCHEDULED_ACTION_UNPUBLISH, SCHEDULE_ID_PREFIX, SCHEDULE_MIN_FUTURE_SECONDS, SCHEDULE_MODEL_ID };
|
|
15
12
|
|
|
16
13
|
//# sourceMappingURL=constants.js.map
|
package/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export const SCHEDULE_MODEL_ID = \"wbySchedule\";\nexport const SCHEDULE_ID_PREFIX = \"wby-schedule-\";\n/**\n * Minimum number of seconds in the future that a schedule can be set.\n * Everything else will result in immediately running the action.\n */\nexport const SCHEDULE_MIN_FUTURE_SECONDS = 65;\n\nexport const SCHEDULED_ACTION_EVENT_IDENTIFIER = \"WebinyScheduledAction\";\n\n/** Constant identifier for the publish scheduled action type. */\nexport const SCHEDULED_ACTION_PUBLISH = \"publish\" as const;\n/** Constant identifier for the unpublish scheduled action type. */\nexport const SCHEDULED_ACTION_UNPUBLISH = \"unpublish\" as const;\n\nexport const SCHEDULED_ACTIONS = [SCHEDULED_ACTION_PUBLISH, SCHEDULED_ACTION_UNPUBLISH] as const;\n"],"names":["SCHEDULE_MODEL_ID","SCHEDULE_ID_PREFIX","SCHEDULE_MIN_FUTURE_SECONDS","SCHEDULED_ACTION_EVENT_IDENTIFIER","SCHEDULED_ACTION_PUBLISH","SCHEDULED_ACTION_UNPUBLISH","SCHEDULED_ACTIONS"],"mappings":"AAAO,MAAMA,oBAAoB;AAC1B,MAAMC,qBAAqB;AAK3B,MAAMC,8BAA8B;AAEpC,MAAMC,oCAAoC;AAG1C,MAAMC,2BAA2B;AAEjC,MAAMC,6BAA6B;AAEnC,MAAMC,oBAAoB;IAACF;IAA0BC;CAA2B"}
|
package/context.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import type { SchedulerClient, SchedulerClientConfig } from "@webiny/aws-sdk/client-scheduler/index.js";
|
|
3
1
|
import type { CmsContext } from "@webiny/api-headless-cms/types/index.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export declare const createSchedulerContext: (params: ICreateHeadlessCmsSchedulerContextParams) => ContextPlugin<CmsContext>;
|
|
2
|
+
import { ContextPlugin } from "@webiny/api";
|
|
3
|
+
export declare const registerSchedulerExtension: () => (ContextPlugin<CmsContext> | import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types").Context>)[];
|
package/context.js
CHANGED
|
@@ -1,47 +1,39 @@
|
|
|
1
|
-
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import { getManifest } from "./manifest.js";
|
|
3
1
|
import { SCHEDULE_MODEL_ID } from "./constants.js";
|
|
4
|
-
import { ScheduledActionModel
|
|
5
|
-
import { EventBridgeSchedulerService } from "./features/SchedulerService/EventBridgeSchedulerService.js";
|
|
6
|
-
import { VoidSchedulerService } from "./features/SchedulerService/VoidSchedulerService.js";
|
|
2
|
+
import { ScheduledActionModel } from "./shared/abstractions.js";
|
|
7
3
|
import { SchedulePrivateModel } from "./domain/SchedulePrivateModel.js";
|
|
8
4
|
import { SchedulerFeature } from "./features/SchedulerFeature.js";
|
|
9
5
|
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
10
6
|
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
import { SchedulerPermissionsResolver } from "./features/permissions/SchedulerPermissionsResolver.js";
|
|
8
|
+
import { ContextPlugin } from "@webiny/api";
|
|
9
|
+
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
10
|
+
import { NamespaceHandlerExecutionerFeature } from "./features/NamespaceHandler/feature.js";
|
|
11
|
+
import { SchedulerGraphQLFactoryFeature } from "./graphql/feature.js";
|
|
12
|
+
const registerSchedulerExtension = ()=>{
|
|
13
|
+
const extensionPlugin = createRegisterExtensionPlugin(async (context)=>{
|
|
14
|
+
context.container.register(SchedulePrivateModel);
|
|
15
|
+
context.container.register(SchedulerPermissionsResolver);
|
|
16
|
+
SchedulerGraphQLFactoryFeature.register(context.container);
|
|
17
|
+
NamespaceHandlerExecutionerFeature.register(context.container);
|
|
18
|
+
SchedulerFeature.register(context.container);
|
|
23
19
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
context.container.register(SchedulePrivateModel);
|
|
35
|
-
context.container.register(SchedulerGraphQLFactory);
|
|
36
|
-
context.container.register(NamespaceHandlerExecutioner);
|
|
37
|
-
await context.security.withoutAuthorization(async () => {
|
|
38
|
-
const schedulerModel = await getModel.execute(SCHEDULE_MODEL_ID);
|
|
39
|
-
context.container.registerInstance(ScheduledActionModel, schedulerModel.value);
|
|
20
|
+
extensionPlugin.name = "scheduler.base.extension";
|
|
21
|
+
const contextPlugin = new ContextPlugin(async (context)=>{
|
|
22
|
+
const tenantContext = context.container.resolve(TenantContext);
|
|
23
|
+
const getModel = context.container.resolve(GetModelUseCase);
|
|
24
|
+
if (!tenantContext.getTenant()) return;
|
|
25
|
+
await context.security.withoutAuthorization(async ()=>{
|
|
26
|
+
const schedulerModel = await getModel.execute(SCHEDULE_MODEL_ID);
|
|
27
|
+
if (schedulerModel.isFail()) throw schedulerModel.error;
|
|
28
|
+
context.container.registerInstance(ScheduledActionModel, schedulerModel.value);
|
|
29
|
+
});
|
|
40
30
|
});
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
contextPlugin.name = "scheduler.base.context";
|
|
32
|
+
return [
|
|
33
|
+
extensionPlugin,
|
|
34
|
+
contextPlugin
|
|
35
|
+
];
|
|
45
36
|
};
|
|
37
|
+
export { registerSchedulerExtension };
|
|
46
38
|
|
|
47
39
|
//# sourceMappingURL=context.js.map
|
package/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../src/context.ts"],"sourcesContent":["import type { CmsContext } from \"@webiny/api-headless-cms/types/index.js\";\nimport { SCHEDULE_MODEL_ID } from \"~/constants.js\";\nimport { ScheduledActionModel } from \"~/shared/abstractions.js\";\nimport { SchedulePrivateModel } from \"~/domain/SchedulePrivateModel.js\";\nimport { SchedulerFeature } from \"~/features/SchedulerFeature.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { SchedulerPermissionsResolver } from \"~/features/permissions/SchedulerPermissionsResolver.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { NamespaceHandlerExecutionerFeature } from \"~/features/NamespaceHandler/feature.js\";\nimport { SchedulerGraphQLFactoryFeature } from \"~/graphql/feature.js\";\n\nexport const registerSchedulerExtension = () => {\n const extensionPlugin = createRegisterExtensionPlugin(async context => {\n context.container.register(SchedulePrivateModel);\n context.container.register(SchedulerPermissionsResolver);\n SchedulerGraphQLFactoryFeature.register(context.container);\n NamespaceHandlerExecutionerFeature.register(context.container);\n SchedulerFeature.register(context.container);\n });\n extensionPlugin.name = \"scheduler.base.extension\";\n\n const contextPlugin = new ContextPlugin<CmsContext>(async context => {\n const tenantContext = context.container.resolve(TenantContext);\n const getModel = context.container.resolve(GetModelUseCase);\n\n if (!tenantContext.getTenant()) {\n return;\n }\n\n await context.security.withoutAuthorization(async () => {\n const schedulerModel = await getModel.execute(SCHEDULE_MODEL_ID);\n if (schedulerModel.isFail()) {\n throw schedulerModel.error;\n }\n context.container.registerInstance(ScheduledActionModel, schedulerModel.value);\n });\n });\n\n contextPlugin.name = \"scheduler.base.context\";\n\n return [extensionPlugin, contextPlugin];\n};\n"],"names":["registerSchedulerExtension","extensionPlugin","createRegisterExtensionPlugin","context","SchedulePrivateModel","SchedulerPermissionsResolver","SchedulerGraphQLFactoryFeature","NamespaceHandlerExecutionerFeature","SchedulerFeature","contextPlugin","ContextPlugin","tenantContext","TenantContext","getModel","GetModelUseCase","schedulerModel","SCHEDULE_MODEL_ID","ScheduledActionModel"],"mappings":";;;;;;;;;;;AAaO,MAAMA,6BAA6B;IACtC,MAAMC,kBAAkBC,8BAA8B,OAAMC;QACxDA,QAAQ,SAAS,CAAC,QAAQ,CAACC;QAC3BD,QAAQ,SAAS,CAAC,QAAQ,CAACE;QAC3BC,+BAA+B,QAAQ,CAACH,QAAQ,SAAS;QACzDI,mCAAmC,QAAQ,CAACJ,QAAQ,SAAS;QAC7DK,iBAAiB,QAAQ,CAACL,QAAQ,SAAS;IAC/C;IACAF,gBAAgB,IAAI,GAAG;IAEvB,MAAMQ,gBAAgB,IAAIC,cAA0B,OAAMP;QACtD,MAAMQ,gBAAgBR,QAAQ,SAAS,CAAC,OAAO,CAACS;QAChD,MAAMC,WAAWV,QAAQ,SAAS,CAAC,OAAO,CAACW;QAE3C,IAAI,CAACH,cAAc,SAAS,IACxB;QAGJ,MAAMR,QAAQ,QAAQ,CAAC,oBAAoB,CAAC;YACxC,MAAMY,iBAAiB,MAAMF,SAAS,OAAO,CAACG;YAC9C,IAAID,eAAe,MAAM,IACrB,MAAMA,eAAe,KAAK;YAE9BZ,QAAQ,SAAS,CAAC,gBAAgB,CAACc,sBAAsBF,eAAe,KAAK;QACjF;IACJ;IAEAN,cAAc,IAAI,GAAG;IAErB,OAAO;QAACR;QAAiBQ;KAAc;AAC3C"}
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import { ModelFactory } from "@webiny/api-headless-cms/features/modelBuilder/index.js";
|
|
2
2
|
import { SCHEDULE_MODEL_ID } from "../constants.js";
|
|
3
3
|
class SchedulePrivateModelImpl {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
async execute(builder) {
|
|
5
|
+
return [
|
|
6
|
+
builder.private({
|
|
7
|
+
modelId: SCHEDULE_MODEL_ID,
|
|
8
|
+
name: "Webiny CMS Schedule"
|
|
9
|
+
}).fields((fields)=>({
|
|
10
|
+
namespace: fields.text().label("Namespace"),
|
|
11
|
+
actionType: fields.text().label("Action Type"),
|
|
12
|
+
targetId: fields.text().label("Target ID"),
|
|
13
|
+
scheduledBy: fields.object().label("Scheduled By").fields((fields)=>({
|
|
14
|
+
id: fields.text().label("Identity ID"),
|
|
15
|
+
displayName: fields.text().label("Display Name"),
|
|
16
|
+
type: fields.text().label("Type")
|
|
17
|
+
})),
|
|
18
|
+
scheduledFor: fields.datetime().label("Scheduled For"),
|
|
19
|
+
title: fields.text().label("Title"),
|
|
20
|
+
error: fields.text().label("Error"),
|
|
21
|
+
payload: fields.json().label("Payload")
|
|
22
|
+
}))
|
|
23
|
+
];
|
|
24
|
+
}
|
|
23
25
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
const SchedulePrivateModel = ModelFactory.createImplementation({
|
|
27
|
+
implementation: SchedulePrivateModelImpl,
|
|
28
|
+
dependencies: []
|
|
27
29
|
});
|
|
30
|
+
export { SchedulePrivateModel };
|
|
28
31
|
|
|
29
32
|
//# sourceMappingURL=SchedulePrivateModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"domain/SchedulePrivateModel.js","sources":["../../src/domain/SchedulePrivateModel.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { SCHEDULE_MODEL_ID } from \"~/constants.js\";\n\nclass SchedulePrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: SCHEDULE_MODEL_ID,\n name: \"Webiny CMS Schedule\"\n })\n .fields(fields => ({\n namespace: fields.text().label(\"Namespace\"),\n actionType: fields.text().label(\"Action Type\"),\n targetId: fields.text().label(\"Target ID\"),\n scheduledBy: fields\n .object()\n .label(\"Scheduled By\")\n .fields(fields => ({\n id: fields.text().label(\"Identity ID\"),\n displayName: fields.text().label(\"Display Name\"),\n type: fields.text().label(\"Type\")\n })),\n scheduledFor: fields.datetime().label(\"Scheduled For\"),\n title: fields.text().label(\"Title\"),\n error: fields.text().label(\"Error\"),\n payload: fields.json().label(\"Payload\")\n }))\n ];\n }\n}\n\nexport const SchedulePrivateModel = ModelFactory.createImplementation({\n implementation: SchedulePrivateModelImpl,\n dependencies: []\n});\n"],"names":["SchedulePrivateModelImpl","builder","SCHEDULE_MODEL_ID","fields","SchedulePrivateModel","ModelFactory"],"mappings":";;AAGA,MAAMA;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASC;gBACT,MAAM;YACV,GACC,MAAM,CAACC,CAAAA,SAAW;oBACf,WAAWA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC/B,YAAYA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAChC,UAAUA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC9B,aAAaA,OACR,MAAM,GACN,KAAK,CAAC,gBACN,MAAM,CAACA,CAAAA,SAAW;4BACf,IAAIA,OAAO,IAAI,GAAG,KAAK,CAAC;4BACxB,aAAaA,OAAO,IAAI,GAAG,KAAK,CAAC;4BACjC,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC;wBAC9B;oBACJ,cAAcA,OAAO,QAAQ,GAAG,KAAK,CAAC;oBACtC,OAAOA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC3B,OAAOA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC3B,SAASA,OAAO,IAAI,GAAG,KAAK,CAAC;gBACjC;SACP;IACL;AACJ;AAEO,MAAMC,uBAAuBC,aAAa,oBAAoB,CAAC;IAClE,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { createCacheKey } from "@webiny/utils";
|
|
2
2
|
import { SCHEDULE_ID_PREFIX } from "../constants.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
class ScheduledActionId {
|
|
4
|
+
static from(params) {
|
|
5
|
+
return [
|
|
6
|
+
SCHEDULE_ID_PREFIX,
|
|
7
|
+
createCacheKey([
|
|
8
|
+
params.namespace,
|
|
9
|
+
params.actionType,
|
|
10
|
+
params.targetId
|
|
11
|
+
]).slice(-24)
|
|
12
|
+
].join("");
|
|
13
|
+
}
|
|
7
14
|
}
|
|
15
|
+
export { ScheduledActionId };
|
|
8
16
|
|
|
9
17
|
//# sourceMappingURL=ScheduledActionId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"domain/ScheduledActionId.js","sources":["../../src/domain/ScheduledActionId.ts"],"sourcesContent":["import { createCacheKey } from \"@webiny/utils\";\nimport { SCHEDULE_ID_PREFIX } from \"~/constants.js\";\n\nexport interface IScheduledActionIdParams {\n namespace: string;\n actionType: string;\n targetId: string;\n}\n\nexport class ScheduledActionId {\n static from(params: IScheduledActionIdParams) {\n return [\n SCHEDULE_ID_PREFIX,\n createCacheKey([params.namespace, params.actionType, params.targetId]).slice(-24)\n ].join(\"\");\n }\n}\n"],"names":["ScheduledActionId","params","SCHEDULE_ID_PREFIX","createCacheKey"],"mappings":";;AASO,MAAMA;IACT,OAAO,KAAKC,MAAgC,EAAE;QAC1C,OAAO;YACHC;YACAC,eAAe;gBAACF,OAAO,SAAS;gBAAEA,OAAO,UAAU;gBAAEA,OAAO,QAAQ;aAAC,EAAE,KAAK,CAAC;SAChF,CAAC,IAAI,CAAC;IACX;AACJ"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
class ScheduledActionIdWithVersion {
|
|
2
|
+
static from(id) {
|
|
3
|
+
if (id.endsWith("#0001")) return id;
|
|
4
|
+
return `${id}#0001`;
|
|
5
5
|
}
|
|
6
|
-
return `${id}#0001`;
|
|
7
|
-
}
|
|
8
6
|
}
|
|
7
|
+
export { ScheduledActionIdWithVersion };
|
|
9
8
|
|
|
10
9
|
//# sourceMappingURL=ScheduledActionIdWithVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"domain/ScheduledActionIdWithVersion.js","sources":["../../src/domain/ScheduledActionIdWithVersion.ts"],"sourcesContent":["export class ScheduledActionIdWithVersion {\n static from(id: string) {\n if (id.endsWith(\"#0001\")) {\n return id;\n }\n\n return `${id}#0001`;\n }\n}\n"],"names":["ScheduledActionIdWithVersion","id"],"mappings":"AAAO,MAAMA;IACT,OAAO,KAAKC,EAAU,EAAE;QACpB,IAAIA,GAAG,QAAQ,CAAC,UACZ,OAAOA;QAGX,OAAO,GAAGA,GAAG,KAAK,CAAC;IACvB;AACJ"}
|
|
@@ -1,37 +1,42 @@
|
|
|
1
1
|
import { parseIdentifier } from "@webiny/utils";
|
|
2
2
|
import { SCHEDULED_ACTION_PUBLISH, SCHEDULED_ACTION_UNPUBLISH } from "../constants.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
3
|
+
class ScheduledActionMapper {
|
|
4
|
+
static toAction(action) {
|
|
5
|
+
const { id: scheduleId } = parseIdentifier(action.id);
|
|
6
|
+
const scheduledBy = action.values.scheduledBy;
|
|
7
|
+
return {
|
|
8
|
+
id: scheduleId,
|
|
9
|
+
targetId: action.values.targetId,
|
|
10
|
+
namespace: action.values.namespace,
|
|
11
|
+
scheduledBy: {
|
|
12
|
+
id: scheduledBy.id,
|
|
13
|
+
displayName: scheduledBy.displayName,
|
|
14
|
+
type: scheduledBy.type
|
|
15
|
+
},
|
|
16
|
+
scheduledFor: new Date(action.values.scheduledFor),
|
|
17
|
+
actionType: action.values.actionType,
|
|
18
|
+
title: action.values.title,
|
|
19
|
+
payload: action.values.payload,
|
|
20
|
+
error: action.values.error,
|
|
21
|
+
tenant: action.tenant
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
static toActions(actions) {
|
|
25
|
+
return actions.map(ScheduledActionMapper.toAction);
|
|
26
|
+
}
|
|
27
|
+
static toGraphQL(action) {
|
|
28
|
+
return {
|
|
29
|
+
id: action.id,
|
|
30
|
+
targetId: action.targetId,
|
|
31
|
+
namespace: action.namespace,
|
|
32
|
+
scheduledBy: action.scheduledBy,
|
|
33
|
+
publishOn: action.actionType === SCHEDULED_ACTION_PUBLISH ? action.scheduledFor : null,
|
|
34
|
+
unpublishOn: action.actionType === SCHEDULED_ACTION_UNPUBLISH ? action.scheduledFor : null,
|
|
35
|
+
actionType: action.actionType,
|
|
36
|
+
title: action.title
|
|
37
|
+
};
|
|
38
|
+
}
|
|
35
39
|
}
|
|
40
|
+
export { ScheduledActionMapper };
|
|
36
41
|
|
|
37
42
|
//# sourceMappingURL=ScheduledActionMapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"domain/ScheduledActionMapper.js","sources":["../../src/domain/ScheduledActionMapper.ts"],"sourcesContent":["import type { IScheduledAction, IScheduledActionEntry } from \"~/shared/abstractions.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { SCHEDULED_ACTION_PUBLISH, SCHEDULED_ACTION_UNPUBLISH } from \"~/constants.js\";\n\nexport class ScheduledActionMapper {\n static toAction<T extends GenericRecord = GenericRecord>(\n action: IScheduledActionEntry<T>\n ): IScheduledAction<T> {\n const { id: scheduleId } = parseIdentifier(action.id);\n const scheduledBy = action.values.scheduledBy;\n return {\n id: scheduleId,\n targetId: action.values.targetId,\n namespace: action.values.namespace,\n /**\n * Mapped field by field on purpose: Headless CMS stores this as an object\n * field, and object values carry a generated `_id` we don't want to leak\n * into the identity.\n */\n scheduledBy: {\n id: scheduledBy.id,\n displayName: scheduledBy.displayName,\n type: scheduledBy.type\n },\n scheduledFor: new Date(action.values.scheduledFor),\n actionType: action.values.actionType,\n title: action.values.title,\n payload: action.values.payload,\n error: action.values.error,\n tenant: action.tenant\n };\n }\n\n static toActions<T extends GenericRecord = GenericRecord>(\n actions: IScheduledActionEntry<T>[]\n ): IScheduledAction<T>[] {\n return actions.map(ScheduledActionMapper.toAction);\n }\n\n static toGraphQL<T extends GenericRecord = GenericRecord>(action: IScheduledAction<T>) {\n return {\n id: action.id,\n targetId: action.targetId,\n namespace: action.namespace,\n scheduledBy: action.scheduledBy,\n publishOn: action.actionType === SCHEDULED_ACTION_PUBLISH ? action.scheduledFor : null,\n unpublishOn:\n action.actionType === SCHEDULED_ACTION_UNPUBLISH ? action.scheduledFor : null,\n actionType: action.actionType,\n title: action.title\n };\n }\n}\n"],"names":["ScheduledActionMapper","action","scheduleId","parseIdentifier","scheduledBy","Date","actions","SCHEDULED_ACTION_PUBLISH","SCHEDULED_ACTION_UNPUBLISH"],"mappings":";;AAKO,MAAMA;IACT,OAAO,SACHC,MAAgC,EACb;QACnB,MAAM,EAAE,IAAIC,UAAU,EAAE,GAAGC,gBAAgBF,OAAO,EAAE;QACpD,MAAMG,cAAcH,OAAO,MAAM,CAAC,WAAW;QAC7C,OAAO;YACH,IAAIC;YACJ,UAAUD,OAAO,MAAM,CAAC,QAAQ;YAChC,WAAWA,OAAO,MAAM,CAAC,SAAS;YAMlC,aAAa;gBACT,IAAIG,YAAY,EAAE;gBAClB,aAAaA,YAAY,WAAW;gBACpC,MAAMA,YAAY,IAAI;YAC1B;YACA,cAAc,IAAIC,KAAKJ,OAAO,MAAM,CAAC,YAAY;YACjD,YAAYA,OAAO,MAAM,CAAC,UAAU;YACpC,OAAOA,OAAO,MAAM,CAAC,KAAK;YAC1B,SAASA,OAAO,MAAM,CAAC,OAAO;YAC9B,OAAOA,OAAO,MAAM,CAAC,KAAK;YAC1B,QAAQA,OAAO,MAAM;QACzB;IACJ;IAEA,OAAO,UACHK,OAAmC,EACd;QACrB,OAAOA,QAAQ,GAAG,CAACN,sBAAsB,QAAQ;IACrD;IAEA,OAAO,UAAmDC,MAA2B,EAAE;QACnF,OAAO;YACH,IAAIA,OAAO,EAAE;YACb,UAAUA,OAAO,QAAQ;YACzB,WAAWA,OAAO,SAAS;YAC3B,aAAaA,OAAO,WAAW;YAC/B,WAAWA,OAAO,UAAU,KAAKM,2BAA2BN,OAAO,YAAY,GAAG;YAClF,aACIA,OAAO,UAAU,KAAKO,6BAA6BP,OAAO,YAAY,GAAG;YAC7E,YAAYA,OAAO,UAAU;YAC7B,OAAOA,OAAO,KAAK;QACvB;IACJ;AACJ"}
|
package/domain/errors.js
CHANGED
|
@@ -1,89 +1,61 @@
|
|
|
1
1
|
import { BaseError } from "@webiny/feature/api";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
constructor() {
|
|
9
|
-
super({
|
|
10
|
-
message: "Not authorized!"
|
|
11
|
-
});
|
|
12
|
-
}
|
|
2
|
+
class NotAuthorizedError extends BaseError {
|
|
3
|
+
constructor(){
|
|
4
|
+
super({
|
|
5
|
+
message: "Not authorized!"
|
|
6
|
+
}), this.code = "Scheduler/NotAuthorized";
|
|
7
|
+
}
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
data: {
|
|
24
|
-
scheduleId
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
9
|
+
class ScheduledActionNotFoundError extends BaseError {
|
|
10
|
+
constructor(scheduleId){
|
|
11
|
+
super({
|
|
12
|
+
message: `Scheduled action "${scheduleId}" was not found.`,
|
|
13
|
+
data: {
|
|
14
|
+
scheduleId
|
|
15
|
+
}
|
|
16
|
+
}), this.code = "Scheduler/ScheduledAction/NotFound";
|
|
17
|
+
}
|
|
28
18
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
data: {
|
|
39
|
-
originalError: error
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
19
|
+
class ScheduledActionPersistenceError extends BaseError {
|
|
20
|
+
constructor(error){
|
|
21
|
+
super({
|
|
22
|
+
message: error.message,
|
|
23
|
+
data: {
|
|
24
|
+
originalError: error
|
|
25
|
+
}
|
|
26
|
+
}), this.code = "Scheduler/ScheduledAction/PersistenceError";
|
|
27
|
+
}
|
|
43
28
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
data: {
|
|
54
|
-
scheduleFor: scheduleFor.toISOString()
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
29
|
+
class InvalidScheduleDateError extends BaseError {
|
|
30
|
+
constructor(scheduleFor){
|
|
31
|
+
super({
|
|
32
|
+
message: "Cannot schedule in the past",
|
|
33
|
+
data: {
|
|
34
|
+
scheduleFor: scheduleFor.toISOString()
|
|
35
|
+
}
|
|
36
|
+
}), this.code = "Scheduler/ScheduledAction/InvalidDate";
|
|
37
|
+
}
|
|
58
38
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
data: {
|
|
69
|
-
originalError: error
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
39
|
+
class SchedulerServiceError extends BaseError {
|
|
40
|
+
constructor(error){
|
|
41
|
+
super({
|
|
42
|
+
message: `Scheduler service error: ${error.message}`,
|
|
43
|
+
data: {
|
|
44
|
+
originalError: error
|
|
45
|
+
}
|
|
46
|
+
}), this.code = "Scheduler/Service/Error";
|
|
47
|
+
}
|
|
73
48
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
namespace
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
49
|
+
class NamespaceHandlerNotFoundError extends BaseError {
|
|
50
|
+
constructor(namespace){
|
|
51
|
+
super({
|
|
52
|
+
message: `Namespace handler for "${namespace}" was not found.`,
|
|
53
|
+
data: {
|
|
54
|
+
namespace
|
|
55
|
+
}
|
|
56
|
+
}), this.code = "Scheduler/NamespaceHandler/NotFound";
|
|
57
|
+
}
|
|
87
58
|
}
|
|
59
|
+
export { InvalidScheduleDateError, NamespaceHandlerNotFoundError, NotAuthorizedError, ScheduledActionNotFoundError, ScheduledActionPersistenceError, SchedulerServiceError };
|
|
88
60
|
|
|
89
61
|
//# sourceMappingURL=errors.js.map
|
package/domain/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"domain/errors.js","sources":["../../src/domain/errors.ts"],"sourcesContent":["import { BaseError } from \"@webiny/feature/api\";\n\n/**\n * Not authorized error when user lacks permissions to manage scheduled actions.\n */\nexport class NotAuthorizedError extends BaseError {\n override readonly code = \"Scheduler/NotAuthorized\" as const;\n\n constructor() {\n super({ message: \"Not authorized!\" });\n }\n}\n\n/**\n * Scheduled action not found error\n */\nexport class ScheduledActionNotFoundError extends BaseError<{ scheduleId: string }> {\n override readonly code = \"Scheduler/ScheduledAction/NotFound\" as const;\n\n constructor(scheduleId: string) {\n super({\n message: `Scheduled action \"${scheduleId}\" was not found.`,\n data: {\n scheduleId\n }\n });\n }\n}\n\n/**\n * Storage/persistence error when working with scheduled actions\n */\nexport class ScheduledActionPersistenceError extends BaseError<{ originalError: Error }> {\n override readonly code = \"Scheduler/ScheduledAction/PersistenceError\" as const;\n\n constructor(error: Error) {\n super({\n message: error.message,\n data: { originalError: error }\n });\n }\n}\n\n/**\n * Invalid schedule date error (e.g., scheduling in the past)\n */\nexport class InvalidScheduleDateError extends BaseError<{ scheduleFor: string }> {\n override readonly code = \"Scheduler/ScheduledAction/InvalidDate\" as const;\n\n constructor(scheduleFor: Date) {\n super({\n message: \"Cannot schedule in the past\",\n data: {\n scheduleFor: scheduleFor.toISOString()\n }\n });\n }\n}\n\n/**\n * Scheduler service error (EventBridge/cloud provider errors)\n */\nexport class SchedulerServiceError extends BaseError<{ originalError: Error }> {\n override readonly code = \"Scheduler/Service/Error\" as const;\n\n constructor(error: Error) {\n super({\n message: `Scheduler service error: ${error.message}`,\n data: { originalError: error }\n });\n }\n}\n\ninterface INamespaceHandlerNotFoundErrorData {\n namespace: string;\n}\n/**\n * Namespace handler not found error.\n */\nexport class NamespaceHandlerNotFoundError extends BaseError<INamespaceHandlerNotFoundErrorData> {\n override readonly code = \"Scheduler/NamespaceHandler/NotFound\" as const;\n\n constructor(namespace: string) {\n super({\n message: `Namespace handler for \"${namespace}\" was not found.`,\n data: {\n namespace\n }\n });\n }\n}\n"],"names":["NotAuthorizedError","BaseError","ScheduledActionNotFoundError","scheduleId","ScheduledActionPersistenceError","error","InvalidScheduleDateError","scheduleFor","SchedulerServiceError","NamespaceHandlerNotFoundError","namespace"],"mappings":";AAKO,MAAMA,2BAA2BC;IAGpC,aAAc;QACV,KAAK,CAAC;YAAE,SAAS;QAAkB,SAHrB,IAAI,GAAG;IAIzB;AACJ;AAKO,MAAMC,qCAAqCD;IAG9C,YAAYE,UAAkB,CAAE;QAC5B,KAAK,CAAC;YACF,SAAS,CAAC,kBAAkB,EAAEA,WAAW,gBAAgB,CAAC;YAC1D,MAAM;gBACFA;YACJ;QACJ,SARc,IAAI,GAAG;IASzB;AACJ;AAKO,MAAMC,wCAAwCH;IAGjD,YAAYI,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAASA,MAAM,OAAO;YACtB,MAAM;gBAAE,eAAeA;YAAM;QACjC,SANc,IAAI,GAAG;IAOzB;AACJ;AAKO,MAAMC,iCAAiCL;IAG1C,YAAYM,WAAiB,CAAE;QAC3B,KAAK,CAAC;YACF,SAAS;YACT,MAAM;gBACF,aAAaA,YAAY,WAAW;YACxC;QACJ,SARc,IAAI,GAAG;IASzB;AACJ;AAKO,MAAMC,8BAA8BP;IAGvC,YAAYI,KAAY,CAAE;QACtB,KAAK,CAAC;YACF,SAAS,CAAC,yBAAyB,EAAEA,MAAM,OAAO,EAAE;YACpD,MAAM;gBAAE,eAAeA;YAAM;QACjC,SANc,IAAI,GAAG;IAOzB;AACJ;AAQO,MAAMI,sCAAsCR;IAG/C,YAAYS,SAAiB,CAAE;QAC3B,KAAK,CAAC;YACF,SAAS,CAAC,uBAAuB,EAAEA,UAAU,gBAAgB,CAAC;YAC9D,MAAM;gBACFA;YACJ;QACJ,SARc,IAAI,GAAG;IASzB;AACJ"}
|
package/domain/isValidDate.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { SCHEDULE_MIN_FUTURE_SECONDS } from "../constants.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* We need to ensure that the date is at least a SCHEDULE_MIN_FUTURE_MINUTES minutes in the future.
|
|
6
|
-
* Otherwise, we consider it as "immediate" and run the action right away.
|
|
7
|
-
*/
|
|
8
|
-
export const isValidDate = input => {
|
|
9
|
-
const minDate = new Date(Date.now() + SCHEDULE_MIN_FUTURE_SECONDS * 1000);
|
|
10
|
-
return input.getTime() >= minDate.getTime();
|
|
2
|
+
const isValidDate = (input)=>{
|
|
3
|
+
const minDate = new Date(Date.now() + 1000 * SCHEDULE_MIN_FUTURE_SECONDS);
|
|
4
|
+
return input.getTime() >= minDate.getTime();
|
|
11
5
|
};
|
|
6
|
+
export { isValidDate };
|
|
12
7
|
|
|
13
8
|
//# sourceMappingURL=isValidDate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"domain/isValidDate.js","sources":["../../src/domain/isValidDate.ts"],"sourcesContent":["import { SCHEDULE_MIN_FUTURE_SECONDS } from \"~/constants.js\";\n\n/**\n * Check if the provided date is in the future.\n * We need to ensure that the date is at least a SCHEDULE_MIN_FUTURE_MINUTES minutes in the future.\n * Otherwise, we consider it as \"immediate\" and run the action right away.\n */\nexport const isValidDate = (input: Date): boolean => {\n const minDate = new Date(Date.now() + SCHEDULE_MIN_FUTURE_SECONDS * 1000);\n\n return input.getTime() >= minDate.getTime();\n};\n"],"names":["isValidDate","input","minDate","Date","SCHEDULE_MIN_FUTURE_SECONDS"],"mappings":";AAOO,MAAMA,cAAc,CAACC;IACxB,MAAMC,UAAU,IAAIC,KAAKA,KAAK,GAAG,KAAKC,AAA8B,OAA9BA;IAEtC,OAAOH,MAAM,OAAO,MAAMC,QAAQ,OAAO;AAC7C"}
|
package/exports/api/scheduler.js
CHANGED
|
@@ -4,7 +4,5 @@ export { ListScheduledActionsUseCase } from "../../features/ListScheduledActions
|
|
|
4
4
|
export { CancelScheduledActionUseCase } from "../../features/CancelScheduledAction/index.js";
|
|
5
5
|
export { ExecuteScheduledActionUseCase } from "../../features/ExecuteScheduledAction/index.js";
|
|
6
6
|
export { NamespaceHandler } from "../../features/NamespaceHandler/index.js";
|
|
7
|
-
export {
|
|
7
|
+
export { ScheduledActionHandler, ScheduledActionModel, SchedulerService } from "../../shared/abstractions.js";
|
|
8
8
|
export { SCHEDULED_ACTION_PUBLISH as ScheduledActionTypePublish, SCHEDULED_ACTION_UNPUBLISH as ScheduledActionTypeUnpublish } from "../../constants.js";
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=scheduler.js.map
|