@webiny/api-headless-cms-scheduler 0.0.0-unstable.e53eceafb5
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 +15 -0
- package/constants.d.ts +11 -0
- package/constants.js +19 -0
- package/constants.js.map +1 -0
- package/context.d.ts +7 -0
- package/context.js +63 -0
- package/context.js.map +1 -0
- package/graphql/index.d.ts +3 -0
- package/graphql/index.js +204 -0
- package/graphql/index.js.map +1 -0
- package/graphql/schema.d.ts +217 -0
- package/graphql/schema.js +87 -0
- package/graphql/schema.js.map +1 -0
- package/handler/Handler.d.ts +23 -0
- package/handler/Handler.js +74 -0
- package/handler/Handler.js.map +1 -0
- package/handler/actions/PublishHandlerAction.d.ts +13 -0
- package/handler/actions/PublishHandlerAction.js +64 -0
- package/handler/actions/PublishHandlerAction.js.map +1 -0
- package/handler/actions/UnpublishHandlerAction.d.ts +13 -0
- package/handler/actions/UnpublishHandlerAction.js +53 -0
- package/handler/actions/UnpublishHandlerAction.js.map +1 -0
- package/handler/index.d.ts +7 -0
- package/handler/index.js +64 -0
- package/handler/index.js.map +1 -0
- package/handler/types.d.ts +5 -0
- package/handler/types.js +7 -0
- package/handler/types.js.map +1 -0
- package/index.d.ts +10 -0
- package/index.js +29 -0
- package/index.js.map +1 -0
- package/manifest.d.ts +17 -0
- package/manifest.js +47 -0
- package/manifest.js.map +1 -0
- package/package.json +45 -0
- package/scheduler/ScheduleExecutor.d.ts +16 -0
- package/scheduler/ScheduleExecutor.js +55 -0
- package/scheduler/ScheduleExecutor.js.map +1 -0
- package/scheduler/ScheduleFetcher.d.ts +16 -0
- package/scheduler/ScheduleFetcher.js +51 -0
- package/scheduler/ScheduleFetcher.js.map +1 -0
- package/scheduler/ScheduleRecord.d.ts +33 -0
- package/scheduler/ScheduleRecord.js +56 -0
- package/scheduler/ScheduleRecord.js.map +1 -0
- package/scheduler/Scheduler.d.ts +14 -0
- package/scheduler/Scheduler.js +27 -0
- package/scheduler/Scheduler.js.map +1 -0
- package/scheduler/actions/PublishScheduleAction.d.ts +26 -0
- package/scheduler/actions/PublishScheduleAction.js +209 -0
- package/scheduler/actions/PublishScheduleAction.js.map +1 -0
- package/scheduler/actions/UnpublishScheduleAction.d.ts +26 -0
- package/scheduler/actions/UnpublishScheduleAction.js +199 -0
- package/scheduler/actions/UnpublishScheduleAction.js.map +1 -0
- package/scheduler/createScheduleRecordId.d.ts +2 -0
- package/scheduler/createScheduleRecordId.js +33 -0
- package/scheduler/createScheduleRecordId.js.map +1 -0
- package/scheduler/createScheduler.d.ts +12 -0
- package/scheduler/createScheduler.js +59 -0
- package/scheduler/createScheduler.js.map +1 -0
- package/scheduler/dates.d.ts +7 -0
- package/scheduler/dates.js +27 -0
- package/scheduler/dates.js.map +1 -0
- package/scheduler/model.d.ts +1 -0
- package/scheduler/model.js +88 -0
- package/scheduler/model.js.map +1 -0
- package/scheduler/types.d.ts +92 -0
- package/scheduler/types.js +19 -0
- package/scheduler/types.js.map +1 -0
- package/service/SchedulerService.d.ts +23 -0
- package/service/SchedulerService.js +151 -0
- package/service/SchedulerService.js.map +1 -0
- package/service/types.d.ts +19 -0
- package/service/types.js +7 -0
- package/service/types.js.map +1 -0
- package/types.d.ts +11 -0
- package/types.js +7 -0
- package/types.js.map +1 -0
- package/utils/dateInTheFuture.d.ts +6 -0
- package/utils/dateInTheFuture.js +19 -0
- package/utils/dateInTheFuture.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Webiny
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @webiny/api-headless-cms-schedule
|
|
2
|
+
[](https://www.npmjs.com/package/@webiny/api-headless-cms-schedule)
|
|
3
|
+
[](https://www.npmjs.com/package/@webiny/api-headless-cms-schedule)
|
|
4
|
+
[](https://github.com/prettier/prettier)
|
|
5
|
+
[](http://makeapullrequest.com)
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
```
|
|
9
|
+
npm install --save @webiny/api-headless-cms-schedule
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Or if you prefer yarn:
|
|
13
|
+
```
|
|
14
|
+
yarn add @webiny/api-headless-cms-schedule
|
|
15
|
+
```
|
package/constants.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const SCHEDULE_MODEL_ID = "webinyCmsSchedule";
|
|
2
|
+
export declare const SCHEDULE_ID_PREFIX = "wby-schedule-";
|
|
3
|
+
/**
|
|
4
|
+
* Minimum number of seconds in the future that a schedule can be set.
|
|
5
|
+
* Everything else will result in immediately running the action.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SCHEDULE_MIN_FUTURE_SECONDS = 65;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare const SCHEDULED_CMS_ACTION_EVENT_IDENTIFIER = "WebinyScheduledCmsAction";
|
package/constants.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SCHEDULE_MODEL_ID = exports.SCHEDULE_MIN_FUTURE_SECONDS = exports.SCHEDULE_ID_PREFIX = exports.SCHEDULED_CMS_ACTION_EVENT_IDENTIFIER = void 0;
|
|
7
|
+
const SCHEDULE_MODEL_ID = exports.SCHEDULE_MODEL_ID = "webinyCmsSchedule";
|
|
8
|
+
const SCHEDULE_ID_PREFIX = exports.SCHEDULE_ID_PREFIX = "wby-schedule-";
|
|
9
|
+
/**
|
|
10
|
+
* Minimum number of seconds in the future that a schedule can be set.
|
|
11
|
+
* Everything else will result in immediately running the action.
|
|
12
|
+
*/
|
|
13
|
+
const SCHEDULE_MIN_FUTURE_SECONDS = exports.SCHEDULE_MIN_FUTURE_SECONDS = 65;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
const SCHEDULED_CMS_ACTION_EVENT_IDENTIFIER = exports.SCHEDULED_CMS_ACTION_EVENT_IDENTIFIER = "WebinyScheduledCmsAction";
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=constants.js.map
|
package/constants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SCHEDULE_MODEL_ID","exports","SCHEDULE_ID_PREFIX","SCHEDULE_MIN_FUTURE_SECONDS","SCHEDULED_CMS_ACTION_EVENT_IDENTIFIER"],"sources":["constants.ts"],"sourcesContent":["export const SCHEDULE_MODEL_ID = \"webinyCmsSchedule\";\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/**\n *\n */\nexport const SCHEDULED_CMS_ACTION_EVENT_IDENTIFIER = \"WebinyScheduledCmsAction\";\n"],"mappings":";;;;;;AAAO,MAAMA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,mBAAmB;AAC7C,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,eAAe;AACjD;AACA;AACA;AACA;AACO,MAAMC,2BAA2B,GAAAF,OAAA,CAAAE,2BAAA,GAAG,EAAE;AAC7C;AACA;AACA;AACO,MAAMC,qCAAqC,GAAAH,OAAA,CAAAG,qCAAA,GAAG,0BAA0B","ignoreList":[]}
|
package/context.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ContextPlugin } from "@webiny/api/index.js";
|
|
2
|
+
import type { SchedulerClient, SchedulerClientConfig } from "@webiny/aws-sdk/client-scheduler/index.js";
|
|
3
|
+
import type { ScheduleContext } from "./types.js";
|
|
4
|
+
export interface ICreateHeadlessCmsSchedulerContextParams {
|
|
5
|
+
getClient(config?: SchedulerClientConfig): Pick<SchedulerClient, "send">;
|
|
6
|
+
}
|
|
7
|
+
export declare const createHeadlessCmsScheduleContext: (params: ICreateHeadlessCmsSchedulerContextParams) => ContextPlugin<ScheduleContext>;
|
package/context.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createHeadlessCmsScheduleContext = void 0;
|
|
7
|
+
var _index = require("@webiny/api/index.js");
|
|
8
|
+
var _SchedulerService = require("./service/SchedulerService.js");
|
|
9
|
+
var _manifest = require("./manifest.js");
|
|
10
|
+
var _utils = require("@webiny/utils");
|
|
11
|
+
var _createScheduler = require("./scheduler/createScheduler.js");
|
|
12
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
13
|
+
var _constants = require("./constants.js");
|
|
14
|
+
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
15
|
+
const createHeadlessCmsScheduleContext = params => {
|
|
16
|
+
return new _index.ContextPlugin(async context => {
|
|
17
|
+
/**
|
|
18
|
+
* If the Headless CMS is not ready, it means the system is not fully installed yet.
|
|
19
|
+
* We do not want to continue because it would break anyway.
|
|
20
|
+
*/
|
|
21
|
+
const ready = await (0, _apiHeadlessCms.isHeadlessCmsReady)(context);
|
|
22
|
+
if (!ready) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const manifest = await (0, _manifest.getManifest)({
|
|
26
|
+
client: context.db.driver.getClient()
|
|
27
|
+
});
|
|
28
|
+
if (manifest.error) {
|
|
29
|
+
console.error(manifest.error.message);
|
|
30
|
+
console.log((0, _utils.convertException)(manifest.error, ["message"]));
|
|
31
|
+
console.info("Scheduler not attached.");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const service = (0, _SchedulerService.createSchedulerService)({
|
|
35
|
+
getClient: params.getClient,
|
|
36
|
+
config: {
|
|
37
|
+
lambdaArn: manifest.data.lambdaArn,
|
|
38
|
+
roleArn: manifest.data.roleArn
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
let scheduleModel;
|
|
42
|
+
try {
|
|
43
|
+
scheduleModel = await context.cms.getModel(_constants.SCHEDULE_MODEL_ID);
|
|
44
|
+
} catch (ex) {
|
|
45
|
+
if (ex.code === "NOT_FOUND" || ex instanceof _handlerGraphql.NotFoundError) {
|
|
46
|
+
console.error(`Schedule model "${_constants.SCHEDULE_MODEL_ID}" not found.`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
console.error(`Error while fetching schedule model "${_constants.SCHEDULE_MODEL_ID}".`);
|
|
50
|
+
console.log((0, _utils.convertException)(ex));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
context.cms.scheduler = await (0, _createScheduler.createScheduler)({
|
|
54
|
+
cms: context.cms,
|
|
55
|
+
security: context.security,
|
|
56
|
+
service,
|
|
57
|
+
scheduleModel
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
exports.createHeadlessCmsScheduleContext = createHeadlessCmsScheduleContext;
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=context.js.map
|
package/context.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_SchedulerService","_manifest","_utils","_createScheduler","_handlerGraphql","_constants","_apiHeadlessCms","createHeadlessCmsScheduleContext","params","ContextPlugin","context","ready","isHeadlessCmsReady","manifest","getManifest","client","db","driver","getClient","error","console","message","log","convertException","info","service","createSchedulerService","config","lambdaArn","data","roleArn","scheduleModel","cms","getModel","SCHEDULE_MODEL_ID","ex","code","NotFoundError","scheduler","createScheduler","security","exports"],"sources":["context.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api/index.js\";\nimport type {\n SchedulerClient,\n SchedulerClientConfig\n} from \"@webiny/aws-sdk/client-scheduler/index.js\";\nimport { createSchedulerService } from \"~/service/SchedulerService.js\";\nimport { getManifest } from \"~/manifest.js\";\nimport { convertException } from \"@webiny/utils\";\nimport type { ScheduleContext } from \"~/types.js\";\nimport { createScheduler } from \"./scheduler/createScheduler.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { SCHEDULE_MODEL_ID } from \"./constants.js\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb/index.js\";\n\nexport interface ICreateHeadlessCmsSchedulerContextParams {\n getClient(config?: SchedulerClientConfig): Pick<SchedulerClient, \"send\">;\n}\n\nexport const createHeadlessCmsScheduleContext = (\n params: ICreateHeadlessCmsSchedulerContextParams\n) => {\n return new ContextPlugin<ScheduleContext>(async context => {\n /**\n * If the Headless CMS is not ready, it means the system is not fully installed yet.\n * We do not want to continue because it would break anyway.\n */\n const ready = await isHeadlessCmsReady(context);\n if (!ready) {\n return;\n }\n const manifest = await getManifest({\n client: context.db.driver.getClient() as DynamoDBDocument\n });\n if (manifest.error) {\n console.error(manifest.error.message);\n console.log(convertException(manifest.error, [\"message\"]));\n console.info(\"Scheduler not attached.\");\n return;\n }\n\n const service = createSchedulerService({\n getClient: params.getClient,\n config: {\n lambdaArn: manifest.data.lambdaArn,\n roleArn: manifest.data.roleArn\n }\n });\n\n let scheduleModel: CmsModel;\n try {\n scheduleModel = await context.cms.getModel(SCHEDULE_MODEL_ID);\n } catch (ex) {\n if (ex.code === \"NOT_FOUND\" || ex instanceof NotFoundError) {\n console.error(`Schedule model \"${SCHEDULE_MODEL_ID}\" not found.`);\n return;\n }\n console.error(`Error while fetching schedule model \"${SCHEDULE_MODEL_ID}\".`);\n console.log(convertException(ex));\n return;\n }\n\n context.cms.scheduler = await createScheduler({\n cms: context.cms,\n security: context.security,\n service,\n scheduleModel\n });\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AAOO,MAAMQ,gCAAgC,GACzCC,MAAgD,IAC/C;EACD,OAAO,IAAIC,oBAAa,CAAkB,MAAMC,OAAO,IAAI;IACvD;AACR;AACA;AACA;IACQ,MAAMC,KAAK,GAAG,MAAM,IAAAC,kCAAkB,EAACF,OAAO,CAAC;IAC/C,IAAI,CAACC,KAAK,EAAE;MACR;IACJ;IACA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C8B,QAAQ;MAC1Bf,OAAO;MACPM;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACU,OAAA,CAAAlC,gCAAA,GAAAA,gCAAA","ignoreList":[]}
|
package/graphql/index.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSchedulerGraphQL = void 0;
|
|
7
|
+
var _index = require("@webiny/api-headless-cms/plugins/index.js");
|
|
8
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
9
|
+
var _schema = require("./schema.js");
|
|
10
|
+
var _utils = require("@webiny/utils");
|
|
11
|
+
const resolve = async cb => {
|
|
12
|
+
try {
|
|
13
|
+
const result = await cb();
|
|
14
|
+
return new _handlerGraphql.Response(result);
|
|
15
|
+
} catch (ex) {
|
|
16
|
+
return new _handlerGraphql.ErrorResponse(ex);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const resolveList = async cb => {
|
|
20
|
+
try {
|
|
21
|
+
const result = await cb();
|
|
22
|
+
return new _handlerGraphql.ListResponse(result.data, result.meta);
|
|
23
|
+
} catch (ex) {
|
|
24
|
+
return new _handlerGraphql.ListErrorResponse(ex);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const createSchedulerGraphQL = () => {
|
|
28
|
+
return new _index.CmsGraphQLSchemaPlugin({
|
|
29
|
+
/**
|
|
30
|
+
* Make sure scheduler is available. No point in adding GraphQL if scheduler is unavailable for any reason.
|
|
31
|
+
*/
|
|
32
|
+
isApplicable: context => {
|
|
33
|
+
return !!context.cms?.scheduler;
|
|
34
|
+
},
|
|
35
|
+
typeDefs: /* GraphQL */`
|
|
36
|
+
enum CmsScheduleRecordType {
|
|
37
|
+
publish
|
|
38
|
+
unpublish
|
|
39
|
+
}
|
|
40
|
+
type CmsScheduleRecord {
|
|
41
|
+
id: String!
|
|
42
|
+
targetId: String!
|
|
43
|
+
model: CmsContentModel!
|
|
44
|
+
scheduledBy: CmsIdentity!
|
|
45
|
+
publishOn: DateTime
|
|
46
|
+
unpublishOn: DateTime
|
|
47
|
+
type: CmsScheduleRecordType!
|
|
48
|
+
title: String!
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type CmsGetScheduleResponse {
|
|
52
|
+
data: CmsScheduleRecord
|
|
53
|
+
error: CmsError
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
type CmsListSchedulesResponse {
|
|
57
|
+
data: [CmsScheduleRecord!]
|
|
58
|
+
error: CmsError
|
|
59
|
+
meta: CmsListMeta
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
input CmsCreateScheduleInput {
|
|
63
|
+
immediately: Boolean
|
|
64
|
+
scheduleOn: DateTime
|
|
65
|
+
type: CmsScheduleRecordType!
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
type CmsCreateScheduleResponse {
|
|
69
|
+
data: CmsScheduleRecord
|
|
70
|
+
error: CmsError
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
input CmsUpdateScheduleInput {
|
|
74
|
+
immediately: Boolean
|
|
75
|
+
scheduleOn: DateTime
|
|
76
|
+
type: CmsScheduleRecordType!
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type CmsUpdateScheduleResponse {
|
|
80
|
+
data: CmsScheduleRecord
|
|
81
|
+
error: CmsError
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type CmsCancelScheduleResponse {
|
|
85
|
+
data: Boolean
|
|
86
|
+
error: CmsError
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
input CmsListSchedulesWhereInput {
|
|
90
|
+
targetId: ID
|
|
91
|
+
title_contains: String
|
|
92
|
+
title_not_contains: String
|
|
93
|
+
targetEntryId: ID
|
|
94
|
+
type: CmsScheduleRecordType
|
|
95
|
+
scheduledBy: ID
|
|
96
|
+
scheduledOn: DateTime
|
|
97
|
+
scheduledOn_gte: DateTime
|
|
98
|
+
scheduledOn_lte: DateTime
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
enum CmsListSchedulesSorter {
|
|
102
|
+
title_ASC
|
|
103
|
+
title_DESC
|
|
104
|
+
scheduledOn_ASC
|
|
105
|
+
scheduledOn_DESC
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
extend type Query {
|
|
109
|
+
getCmsSchedule(modelId: String!, id: ID!): CmsGetScheduleResponse!
|
|
110
|
+
listCmsSchedules(
|
|
111
|
+
modelId: String!
|
|
112
|
+
where: CmsListSchedulesWhereInput
|
|
113
|
+
sort: [CmsListSchedulesSorter!]
|
|
114
|
+
limit: Int
|
|
115
|
+
after: String
|
|
116
|
+
): CmsListSchedulesResponse!
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
extend type Mutation {
|
|
120
|
+
createCmsSchedule(
|
|
121
|
+
modelId: String!
|
|
122
|
+
id: ID!
|
|
123
|
+
input: CmsCreateScheduleInput!
|
|
124
|
+
): CmsCreateScheduleResponse!
|
|
125
|
+
updateCmsSchedule(
|
|
126
|
+
modelId: String!
|
|
127
|
+
id: ID!
|
|
128
|
+
input: CmsUpdateScheduleInput!
|
|
129
|
+
): CmsUpdateScheduleResponse!
|
|
130
|
+
cancelCmsSchedule(modelId: String!, id: ID!): CmsCancelScheduleResponse!
|
|
131
|
+
}
|
|
132
|
+
`,
|
|
133
|
+
resolvers: {
|
|
134
|
+
Query: {
|
|
135
|
+
async getCmsSchedule(_, args, context) {
|
|
136
|
+
return resolve(async () => {
|
|
137
|
+
const validated = await _schema.getScheduleSchema.safeParseAsync(args);
|
|
138
|
+
if (validated.error) {
|
|
139
|
+
throw (0, _utils.createZodError)(validated.error);
|
|
140
|
+
}
|
|
141
|
+
const model = await context.cms.getModel(validated.data.modelId);
|
|
142
|
+
const scheduler = context.cms.scheduler(model);
|
|
143
|
+
return scheduler.getScheduled(validated.data.id);
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
async listCmsSchedules(_, args, context) {
|
|
147
|
+
return resolveList(async () => {
|
|
148
|
+
const validated = await _schema.listScheduleSchema.safeParseAsync(args);
|
|
149
|
+
if (validated.error) {
|
|
150
|
+
throw (0, _utils.createZodError)(validated.error);
|
|
151
|
+
}
|
|
152
|
+
const model = await context.cms.getModel(validated.data.modelId);
|
|
153
|
+
const scheduler = context.cms.scheduler(model);
|
|
154
|
+
return scheduler.listScheduled({
|
|
155
|
+
where: validated.data.where || {},
|
|
156
|
+
sort: validated.data.sort,
|
|
157
|
+
limit: validated.data.limit,
|
|
158
|
+
after: validated.data.after
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
Mutation: {
|
|
164
|
+
async createCmsSchedule(_, args, context) {
|
|
165
|
+
return resolve(async () => {
|
|
166
|
+
const validated = await _schema.createScheduleSchema.safeParseAsync(args);
|
|
167
|
+
if (validated.error) {
|
|
168
|
+
throw (0, _utils.createZodError)(validated.error);
|
|
169
|
+
}
|
|
170
|
+
const model = await context.cms.getModel(validated.data.modelId);
|
|
171
|
+
const scheduler = context.cms.scheduler(model);
|
|
172
|
+
return await scheduler.schedule(validated.data.id, validated.data.input);
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
async updateCmsSchedule(_, args, context) {
|
|
176
|
+
return resolve(async () => {
|
|
177
|
+
const validated = await _schema.updateScheduleSchema.safeParseAsync(args);
|
|
178
|
+
if (validated.error) {
|
|
179
|
+
throw (0, _utils.createZodError)(validated.error);
|
|
180
|
+
}
|
|
181
|
+
const model = await context.cms.getModel(validated.data.modelId);
|
|
182
|
+
const scheduler = context.cms.scheduler(model);
|
|
183
|
+
return scheduler.schedule(validated.data.id, validated.data.input);
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
async cancelCmsSchedule(_, args, context) {
|
|
187
|
+
return resolve(async () => {
|
|
188
|
+
const validated = await _schema.cancelScheduleSchema.safeParseAsync(args);
|
|
189
|
+
if (validated.error) {
|
|
190
|
+
throw (0, _utils.createZodError)(validated.error);
|
|
191
|
+
}
|
|
192
|
+
const model = await context.cms.getModel(validated.data.modelId);
|
|
193
|
+
const scheduler = context.cms.scheduler(model);
|
|
194
|
+
await scheduler.cancel(validated.data.id);
|
|
195
|
+
return true;
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
exports.createSchedulerGraphQL = createSchedulerGraphQL;
|
|
203
|
+
|
|
204
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_handlerGraphql","_schema","_utils","resolve","cb","result","Response","ex","ErrorResponse","resolveList","ListResponse","data","meta","ListErrorResponse","createSchedulerGraphQL","CmsGraphQLSchemaPlugin","isApplicable","context","cms","scheduler","typeDefs","resolvers","Query","getCmsSchedule","_","args","validated","getScheduleSchema","safeParseAsync","error","createZodError","model","getModel","modelId","getScheduled","id","listCmsSchedules","listScheduleSchema","listScheduled","where","sort","limit","after","Mutation","createCmsSchedule","createScheduleSchema","schedule","input","updateCmsSchedule","updateScheduleSchema","cancelCmsSchedule","cancelScheduleSchema","cancel","exports"],"sources":["index.ts"],"sourcesContent":["import { CmsGraphQLSchemaPlugin } from \"@webiny/api-headless-cms/plugins/index.js\";\nimport type { ScheduleContext } from \"~/types.js\";\nimport { ErrorResponse, ListErrorResponse, ListResponse, Response } from \"@webiny/handler-graphql\";\nimport type { CmsEntryMeta } from \"@webiny/api-headless-cms/types/index.js\";\nimport {\n cancelScheduleSchema,\n createScheduleSchema,\n getScheduleSchema,\n listScheduleSchema,\n updateScheduleSchema\n} from \"~/graphql/schema.js\";\nimport { createZodError } from \"@webiny/utils\";\n\nconst resolve = async (cb: () => Promise<unknown>) => {\n try {\n const result = await cb();\n\n return new Response(result);\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n};\n\ninterface IResolveListCallableResponse {\n data: unknown[];\n meta: CmsEntryMeta;\n}\n\nconst resolveList = async (cb: () => Promise<IResolveListCallableResponse>) => {\n try {\n const result = await cb();\n\n return new ListResponse(result.data, result.meta);\n } catch (ex) {\n return new ListErrorResponse(ex);\n }\n};\n\nexport const createSchedulerGraphQL = () => {\n return new CmsGraphQLSchemaPlugin<ScheduleContext>({\n /**\n * Make sure scheduler is available. No point in adding GraphQL if scheduler is unavailable for any reason.\n */\n isApplicable: context => {\n return !!context.cms?.scheduler;\n },\n typeDefs: /* GraphQL */ `\n enum CmsScheduleRecordType {\n publish\n unpublish\n }\n type CmsScheduleRecord {\n id: String!\n targetId: String!\n model: CmsContentModel!\n scheduledBy: CmsIdentity!\n publishOn: DateTime\n unpublishOn: DateTime\n type: CmsScheduleRecordType!\n title: String!\n }\n\n type CmsGetScheduleResponse {\n data: CmsScheduleRecord\n error: CmsError\n }\n\n type CmsListSchedulesResponse {\n data: [CmsScheduleRecord!]\n error: CmsError\n meta: CmsListMeta\n }\n\n input CmsCreateScheduleInput {\n immediately: Boolean\n scheduleOn: DateTime\n type: CmsScheduleRecordType!\n }\n\n type CmsCreateScheduleResponse {\n data: CmsScheduleRecord\n error: CmsError\n }\n\n input CmsUpdateScheduleInput {\n immediately: Boolean\n scheduleOn: DateTime\n type: CmsScheduleRecordType!\n }\n\n type CmsUpdateScheduleResponse {\n data: CmsScheduleRecord\n error: CmsError\n }\n\n type CmsCancelScheduleResponse {\n data: Boolean\n error: CmsError\n }\n\n input CmsListSchedulesWhereInput {\n targetId: ID\n title_contains: String\n title_not_contains: String\n targetEntryId: ID\n type: CmsScheduleRecordType\n scheduledBy: ID\n scheduledOn: DateTime\n scheduledOn_gte: DateTime\n scheduledOn_lte: DateTime\n }\n\n enum CmsListSchedulesSorter {\n title_ASC\n title_DESC\n scheduledOn_ASC\n scheduledOn_DESC\n }\n\n extend type Query {\n getCmsSchedule(modelId: String!, id: ID!): CmsGetScheduleResponse!\n listCmsSchedules(\n modelId: String!\n where: CmsListSchedulesWhereInput\n sort: [CmsListSchedulesSorter!]\n limit: Int\n after: String\n ): CmsListSchedulesResponse!\n }\n\n extend type Mutation {\n createCmsSchedule(\n modelId: String!\n id: ID!\n input: CmsCreateScheduleInput!\n ): CmsCreateScheduleResponse!\n updateCmsSchedule(\n modelId: String!\n id: ID!\n input: CmsUpdateScheduleInput!\n ): CmsUpdateScheduleResponse!\n cancelCmsSchedule(modelId: String!, id: ID!): CmsCancelScheduleResponse!\n }\n `,\n resolvers: {\n Query: {\n async getCmsSchedule(_, args, context) {\n return resolve(async () => {\n const validated = await getScheduleSchema.safeParseAsync(args);\n if (validated.error) {\n throw createZodError(validated.error);\n }\n const model = await context.cms.getModel(validated.data.modelId);\n const scheduler = context.cms.scheduler(model);\n\n return scheduler.getScheduled(validated.data.id);\n });\n },\n async listCmsSchedules(_, args, context) {\n return resolveList(async () => {\n const validated = await listScheduleSchema.safeParseAsync(args);\n if (validated.error) {\n throw createZodError(validated.error);\n }\n const model = await context.cms.getModel(validated.data.modelId);\n const scheduler = context.cms.scheduler(model);\n\n return scheduler.listScheduled({\n where: validated.data.where || {},\n sort: validated.data.sort,\n limit: validated.data.limit,\n after: validated.data.after\n });\n });\n }\n },\n Mutation: {\n async createCmsSchedule(_, args, context) {\n return resolve(async () => {\n const validated = await createScheduleSchema.safeParseAsync(args);\n if (validated.error) {\n throw createZodError(validated.error);\n }\n\n const model = await context.cms.getModel(validated.data.modelId);\n const scheduler = context.cms.scheduler(model);\n\n return await scheduler.schedule(validated.data.id, validated.data.input);\n });\n },\n async updateCmsSchedule(_, args, context) {\n return resolve(async () => {\n const validated = await updateScheduleSchema.safeParseAsync(args);\n if (validated.error) {\n throw createZodError(validated.error);\n }\n const model = await context.cms.getModel(validated.data.modelId);\n const scheduler = context.cms.scheduler(model);\n\n return scheduler.schedule(validated.data.id, validated.data.input);\n });\n },\n async cancelCmsSchedule(_, args, context) {\n return resolve(async () => {\n const validated = await cancelScheduleSchema.safeParseAsync(args);\n if (validated.error) {\n throw createZodError(validated.error);\n }\n const model = await context.cms.getModel(validated.data.modelId);\n const scheduler = context.cms.scheduler(model);\n\n await scheduler.cancel(validated.data.id);\n return true;\n });\n }\n }\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AAEA,MAAMI,OAAO,GAAG,MAAOC,EAA0B,IAAK;EAClD,IAAI;IACA,MAAMC,MAAM,GAAG,MAAMD,EAAE,CAAC,CAAC;IAEzB,OAAO,IAAIE,wBAAQ,CAACD,MAAM,CAAC;EAC/B,CAAC,CAAC,OAAOE,EAAE,EAAE;IACT,OAAO,IAAIC,6BAAa,CAACD,EAAE,CAAC;EAChC;AACJ,CAAC;AAOD,MAAME,WAAW,GAAG,MAAOL,EAA+C,IAAK;EAC3E,IAAI;IACA,MAAMC,MAAM,GAAG,MAAMD,EAAE,CAAC,CAAC;IAEzB,OAAO,IAAIM,4BAAY,CAACL,MAAM,CAACM,IAAI,EAAEN,MAAM,CAACO,IAAI,CAAC;EACrD,CAAC,CAAC,OAAOL,EAAE,EAAE;IACT,OAAO,IAAIM,iCAAiB,CAACN,EAAE,CAAC;EACpC;AACJ,CAAC;AAEM,MAAMO,sBAAsB,GAAGA,CAAA,KAAM;EACxC,OAAO,IAAIC,6BAAsB,CAAkB;IAC/C;AACR;AACA;IACQC,YAAY,EAAEC,OAAO,IAAI;MACrB,OAAO,CAAC,CAACA,OAAO,CAACC,GAAG,EAAEC,SAAS;IACnC,CAAC;IACDC,QAAQ,EAAE,aAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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S,CAACG,KAAK,EAAE;cACjB,MAAM,IAAAC,qBAAc,EAACJ,SAAS,CAACG,KAAK,CAAC;YACzC;YACA,MAAME,KAAK,GAAG,MAAMd,OAAO,CAACC,GAAG,CAACc,QAAQ,CAACN,SAAS,CAACf,IAAI,CAACsB,OAAO,CAAC;YAChE,MAAMd,SAAS,GAAGF,OAAO,CAACC,GAAG,CAACC,SAAS,CAACY,KAAK,CAAC;YAE9C,OAAOZ,SAAS,CAAC2B,QAAQ,CAACpB,SAAS,CAACf,IAAI,CAACwB,EAAE,EAAET,SAAS,CAACf,IAAI,CAACoC,KAAK,CAAC;UACtE,CAAC,CAAC;QACN,CAAC;QACD,MAAMG,iBAAiBA,CAAC1B,CAAC,EAAEC,IAAI,EAAER,OAAO,EAAE;UACtC,OAAOd,OAAO,CAAC,YAAY;YACvB,MAAMuB,SAAS,GAAG,MAAMyB,4BAAoB,CAACvB,cAAc,CAACH,IAAI,CAAC;YACjE,IAAIC,SAAS,CAACG,KAAK,EAAE;cACjB,MAAM,IAAAC,qBAAc,EAACJ,SAAS,CAACG,KAAK,CAAC;YACzC;YACA,MAAME,KAAK,GAAG,MAAMd,OAAO,CAACC,GAAG,CAACc,QAAQ,CAACN,SAAS,CAACf,IAAI,CAACsB,OAAO,CAAC;YAChE,MAAMd,SAAS,GAAGF,OAAO,CAACC,GAAG,CAACC,SAAS,CAACY,KAAK,CAAC;YAE9C,MAAMZ,SAAS,CAACiC,MAAM,CAAC1B,SAAS,CAACf,IAAI,CAACwB,EAAE,CAAC;YACzC,OAAO,IAAI;UACf,CAAC,CAAC;QACN;MACJ;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACkB,OAAA,CAAAvC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import zod from "zod";
|
|
2
|
+
import { ScheduleType } from "../scheduler/types.js";
|
|
3
|
+
export declare const getScheduleSchema: zod.ZodObject<{
|
|
4
|
+
modelId: zod.ZodString;
|
|
5
|
+
id: zod.ZodString;
|
|
6
|
+
}, "strip", zod.ZodTypeAny, {
|
|
7
|
+
id: string;
|
|
8
|
+
modelId: string;
|
|
9
|
+
}, {
|
|
10
|
+
id: string;
|
|
11
|
+
modelId: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const listScheduleSchema: zod.ZodObject<{
|
|
14
|
+
modelId: zod.ZodString;
|
|
15
|
+
where: zod.ZodOptional<zod.ZodObject<{
|
|
16
|
+
targetId: zod.ZodOptional<zod.ZodString>;
|
|
17
|
+
targetEntryId: zod.ZodOptional<zod.ZodString>;
|
|
18
|
+
title_contains: zod.ZodOptional<zod.ZodString>;
|
|
19
|
+
title_not_contains: zod.ZodOptional<zod.ZodString>;
|
|
20
|
+
type: zod.ZodOptional<zod.ZodNativeEnum<typeof ScheduleType>>;
|
|
21
|
+
scheduledBy: zod.ZodOptional<zod.ZodString>;
|
|
22
|
+
scheduledOn: zod.ZodEffects<zod.ZodOptional<zod.ZodDate>, `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined, Date | undefined>;
|
|
23
|
+
scheduledOn_gte: zod.ZodEffects<zod.ZodOptional<zod.ZodDate>, `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined, Date | undefined>;
|
|
24
|
+
scheduledOn_lte: zod.ZodEffects<zod.ZodOptional<zod.ZodDate>, `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined, Date | undefined>;
|
|
25
|
+
}, "strip", zod.ZodTypeAny, {
|
|
26
|
+
type?: ScheduleType | undefined;
|
|
27
|
+
targetId?: string | undefined;
|
|
28
|
+
targetEntryId?: string | undefined;
|
|
29
|
+
scheduledBy?: string | undefined;
|
|
30
|
+
scheduledOn?: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined;
|
|
31
|
+
scheduledOn_gte?: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined;
|
|
32
|
+
scheduledOn_lte?: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined;
|
|
33
|
+
title_contains?: string | undefined;
|
|
34
|
+
title_not_contains?: string | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
type?: ScheduleType | undefined;
|
|
37
|
+
targetId?: string | undefined;
|
|
38
|
+
targetEntryId?: string | undefined;
|
|
39
|
+
scheduledBy?: string | undefined;
|
|
40
|
+
scheduledOn?: Date | undefined;
|
|
41
|
+
scheduledOn_gte?: Date | undefined;
|
|
42
|
+
scheduledOn_lte?: Date | undefined;
|
|
43
|
+
title_contains?: string | undefined;
|
|
44
|
+
title_not_contains?: string | undefined;
|
|
45
|
+
}>>;
|
|
46
|
+
sort: zod.ZodOptional<zod.ZodArray<zod.ZodEffects<zod.ZodString, `${string}_ASC` | `${string}_DESC`, string>, "many">>;
|
|
47
|
+
limit: zod.ZodOptional<zod.ZodNumber>;
|
|
48
|
+
after: zod.ZodOptional<zod.ZodString>;
|
|
49
|
+
}, "strip", zod.ZodTypeAny, {
|
|
50
|
+
modelId: string;
|
|
51
|
+
sort?: (`${string}_ASC` | `${string}_DESC`)[] | undefined;
|
|
52
|
+
after?: string | undefined;
|
|
53
|
+
where?: {
|
|
54
|
+
type?: ScheduleType | undefined;
|
|
55
|
+
targetId?: string | undefined;
|
|
56
|
+
targetEntryId?: string | undefined;
|
|
57
|
+
scheduledBy?: string | undefined;
|
|
58
|
+
scheduledOn?: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined;
|
|
59
|
+
scheduledOn_gte?: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined;
|
|
60
|
+
scheduledOn_lte?: `${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | undefined;
|
|
61
|
+
title_contains?: string | undefined;
|
|
62
|
+
title_not_contains?: string | undefined;
|
|
63
|
+
} | undefined;
|
|
64
|
+
limit?: number | undefined;
|
|
65
|
+
}, {
|
|
66
|
+
modelId: string;
|
|
67
|
+
sort?: string[] | undefined;
|
|
68
|
+
after?: string | undefined;
|
|
69
|
+
where?: {
|
|
70
|
+
type?: ScheduleType | undefined;
|
|
71
|
+
targetId?: string | undefined;
|
|
72
|
+
targetEntryId?: string | undefined;
|
|
73
|
+
scheduledBy?: string | undefined;
|
|
74
|
+
scheduledOn?: Date | undefined;
|
|
75
|
+
scheduledOn_gte?: Date | undefined;
|
|
76
|
+
scheduledOn_lte?: Date | undefined;
|
|
77
|
+
title_contains?: string | undefined;
|
|
78
|
+
title_not_contains?: string | undefined;
|
|
79
|
+
} | undefined;
|
|
80
|
+
limit?: number | undefined;
|
|
81
|
+
}>;
|
|
82
|
+
export declare const createScheduleSchema: zod.ZodObject<{
|
|
83
|
+
modelId: zod.ZodString;
|
|
84
|
+
id: zod.ZodString;
|
|
85
|
+
input: zod.ZodDiscriminatedUnion<"immediately", [zod.ZodObject<{
|
|
86
|
+
immediately: zod.ZodLiteral<true>;
|
|
87
|
+
scheduleOn: zod.ZodOptional<zod.ZodNever>;
|
|
88
|
+
dateOn: zod.ZodOptional<zod.ZodDate>;
|
|
89
|
+
type: zod.ZodNativeEnum<typeof ScheduleType>;
|
|
90
|
+
}, "strip", zod.ZodTypeAny, {
|
|
91
|
+
type: ScheduleType;
|
|
92
|
+
immediately: true;
|
|
93
|
+
scheduleOn?: undefined;
|
|
94
|
+
dateOn?: Date | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
type: ScheduleType;
|
|
97
|
+
immediately: true;
|
|
98
|
+
scheduleOn?: undefined;
|
|
99
|
+
dateOn?: Date | undefined;
|
|
100
|
+
}>, zod.ZodObject<{
|
|
101
|
+
immediately: zod.ZodOptional<zod.ZodLiteral<false>>;
|
|
102
|
+
scheduleOn: zod.ZodUnion<[zod.ZodDate, zod.ZodEffects<zod.ZodString, Date, string>]>;
|
|
103
|
+
dateOn: zod.ZodEffects<zod.ZodOptional<zod.ZodDate>, Date | undefined, Date | undefined>;
|
|
104
|
+
type: zod.ZodNativeEnum<typeof ScheduleType>;
|
|
105
|
+
}, "strip", zod.ZodTypeAny, {
|
|
106
|
+
type: ScheduleType;
|
|
107
|
+
scheduleOn: Date;
|
|
108
|
+
immediately?: false | undefined;
|
|
109
|
+
dateOn?: Date | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
type: ScheduleType;
|
|
112
|
+
scheduleOn: string | Date;
|
|
113
|
+
immediately?: false | undefined;
|
|
114
|
+
dateOn?: Date | undefined;
|
|
115
|
+
}>]>;
|
|
116
|
+
}, "strip", zod.ZodTypeAny, {
|
|
117
|
+
input: {
|
|
118
|
+
type: ScheduleType;
|
|
119
|
+
immediately: true;
|
|
120
|
+
scheduleOn?: undefined;
|
|
121
|
+
dateOn?: Date | undefined;
|
|
122
|
+
} | {
|
|
123
|
+
type: ScheduleType;
|
|
124
|
+
scheduleOn: Date;
|
|
125
|
+
immediately?: false | undefined;
|
|
126
|
+
dateOn?: Date | undefined;
|
|
127
|
+
};
|
|
128
|
+
id: string;
|
|
129
|
+
modelId: string;
|
|
130
|
+
}, {
|
|
131
|
+
input: {
|
|
132
|
+
type: ScheduleType;
|
|
133
|
+
immediately: true;
|
|
134
|
+
scheduleOn?: undefined;
|
|
135
|
+
dateOn?: Date | undefined;
|
|
136
|
+
} | {
|
|
137
|
+
type: ScheduleType;
|
|
138
|
+
scheduleOn: string | Date;
|
|
139
|
+
immediately?: false | undefined;
|
|
140
|
+
dateOn?: Date | undefined;
|
|
141
|
+
};
|
|
142
|
+
id: string;
|
|
143
|
+
modelId: string;
|
|
144
|
+
}>;
|
|
145
|
+
export declare const updateScheduleSchema: zod.ZodObject<{
|
|
146
|
+
modelId: zod.ZodString;
|
|
147
|
+
id: zod.ZodString;
|
|
148
|
+
input: zod.ZodDiscriminatedUnion<"immediately", [zod.ZodObject<{
|
|
149
|
+
immediately: zod.ZodLiteral<true>;
|
|
150
|
+
scheduleOn: zod.ZodOptional<zod.ZodNever>;
|
|
151
|
+
dateOn: zod.ZodOptional<zod.ZodDate>;
|
|
152
|
+
type: zod.ZodNativeEnum<typeof ScheduleType>;
|
|
153
|
+
}, "strip", zod.ZodTypeAny, {
|
|
154
|
+
type: ScheduleType;
|
|
155
|
+
immediately: true;
|
|
156
|
+
scheduleOn?: undefined;
|
|
157
|
+
dateOn?: Date | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
type: ScheduleType;
|
|
160
|
+
immediately: true;
|
|
161
|
+
scheduleOn?: undefined;
|
|
162
|
+
dateOn?: Date | undefined;
|
|
163
|
+
}>, zod.ZodObject<{
|
|
164
|
+
immediately: zod.ZodOptional<zod.ZodLiteral<false>>;
|
|
165
|
+
scheduleOn: zod.ZodUnion<[zod.ZodDate, zod.ZodEffects<zod.ZodString, Date, string>]>;
|
|
166
|
+
dateOn: zod.ZodEffects<zod.ZodOptional<zod.ZodDate>, Date | undefined, Date | undefined>;
|
|
167
|
+
type: zod.ZodNativeEnum<typeof ScheduleType>;
|
|
168
|
+
}, "strip", zod.ZodTypeAny, {
|
|
169
|
+
type: ScheduleType;
|
|
170
|
+
scheduleOn: Date;
|
|
171
|
+
immediately?: false | undefined;
|
|
172
|
+
dateOn?: Date | undefined;
|
|
173
|
+
}, {
|
|
174
|
+
type: ScheduleType;
|
|
175
|
+
scheduleOn: string | Date;
|
|
176
|
+
immediately?: false | undefined;
|
|
177
|
+
dateOn?: Date | undefined;
|
|
178
|
+
}>]>;
|
|
179
|
+
}, "strip", zod.ZodTypeAny, {
|
|
180
|
+
input: {
|
|
181
|
+
type: ScheduleType;
|
|
182
|
+
immediately: true;
|
|
183
|
+
scheduleOn?: undefined;
|
|
184
|
+
dateOn?: Date | undefined;
|
|
185
|
+
} | {
|
|
186
|
+
type: ScheduleType;
|
|
187
|
+
scheduleOn: Date;
|
|
188
|
+
immediately?: false | undefined;
|
|
189
|
+
dateOn?: Date | undefined;
|
|
190
|
+
};
|
|
191
|
+
id: string;
|
|
192
|
+
modelId: string;
|
|
193
|
+
}, {
|
|
194
|
+
input: {
|
|
195
|
+
type: ScheduleType;
|
|
196
|
+
immediately: true;
|
|
197
|
+
scheduleOn?: undefined;
|
|
198
|
+
dateOn?: Date | undefined;
|
|
199
|
+
} | {
|
|
200
|
+
type: ScheduleType;
|
|
201
|
+
scheduleOn: string | Date;
|
|
202
|
+
immediately?: false | undefined;
|
|
203
|
+
dateOn?: Date | undefined;
|
|
204
|
+
};
|
|
205
|
+
id: string;
|
|
206
|
+
modelId: string;
|
|
207
|
+
}>;
|
|
208
|
+
export declare const cancelScheduleSchema: zod.ZodObject<{
|
|
209
|
+
modelId: zod.ZodString;
|
|
210
|
+
id: zod.ZodString;
|
|
211
|
+
}, "strip", zod.ZodTypeAny, {
|
|
212
|
+
id: string;
|
|
213
|
+
modelId: string;
|
|
214
|
+
}, {
|
|
215
|
+
id: string;
|
|
216
|
+
modelId: string;
|
|
217
|
+
}>;
|