@webiny/api-apw 0.0.0-ee-vpcs.549378cf03
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/ApwChangeRequestNotification.d.ts +27 -0
- package/ApwChangeRequestNotification.js +40 -0
- package/ApwChangeRequestNotification.js.map +1 -0
- package/ApwCommentNotification.d.ts +27 -0
- package/ApwCommentNotification.js +40 -0
- package/ApwCommentNotification.js.map +1 -0
- package/ApwContentReviewNotification.d.ts +26 -0
- package/ApwContentReviewNotification.js +40 -0
- package/ApwContentReviewNotification.js.map +1 -0
- package/ApwContentUrlPlugin.d.ts +19 -0
- package/ApwContentUrlPlugin.js +40 -0
- package/ApwContentUrlPlugin.js.map +1 -0
- package/ContentApwSettingsPlugin.d.ts +10 -0
- package/ContentApwSettingsPlugin.js +17 -0
- package/ContentApwSettingsPlugin.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +34 -0
- package/crud/createChangeRequestMethods.d.ts +2 -0
- package/crud/createChangeRequestMethods.js +98 -0
- package/crud/createChangeRequestMethods.js.map +1 -0
- package/crud/createCommentMethods.d.ts +2 -0
- package/crud/createCommentMethods.js +99 -0
- package/crud/createCommentMethods.js.map +1 -0
- package/crud/createContentReviewMethods.d.ts +10 -0
- package/crud/createContentReviewMethods.js +562 -0
- package/crud/createContentReviewMethods.js.map +1 -0
- package/crud/createReviewerMethods.d.ts +2 -0
- package/crud/createReviewerMethods.js +99 -0
- package/crud/createReviewerMethods.js.map +1 -0
- package/crud/createWorkflowMethods.d.ts +2 -0
- package/crud/createWorkflowMethods.js +118 -0
- package/crud/createWorkflowMethods.js.map +1 -0
- package/crud/index.d.ts +2 -0
- package/crud/index.js +96 -0
- package/crud/index.js.map +1 -0
- package/crud/utils.d.ts +21 -0
- package/crud/utils.js +138 -0
- package/crud/utils.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +38 -0
- package/index.js.map +1 -0
- package/package.json +76 -0
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +10 -0
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +51 -0
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -0
- package/plugins/cms/README.md +49 -0
- package/plugins/cms/apwEntryPlugins.d.ts +8 -0
- package/plugins/cms/apwEntryPlugins.js +46 -0
- package/plugins/cms/apwEntryPlugins.js.map +1 -0
- package/plugins/cms/index.d.ts +12 -0
- package/plugins/cms/index.js +45 -0
- package/plugins/cms/index.js.map +1 -0
- package/plugins/cms/linkContentReviewToEntry.d.ts +8 -0
- package/plugins/cms/linkContentReviewToEntry.js +108 -0
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -0
- package/plugins/cms/linkWorkflowToEntry.d.ts +8 -0
- package/plugins/cms/linkWorkflowToEntry.js +166 -0
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -0
- package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/cms/notifications/changeRequestNotification.js +35 -0
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/cms/notifications/commentNotification.d.ts +1 -0
- package/plugins/cms/notifications/commentNotification.js +35 -0
- package/plugins/cms/notifications/commentNotification.js.map +1 -0
- package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/cms/notifications/contentReviewNotification.js +35 -0
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/cms/notifications/contentUrl.d.ts +8 -0
- package/plugins/cms/notifications/contentUrl.js +60 -0
- package/plugins/cms/notifications/contentUrl.js.map +1 -0
- package/plugins/cms/triggerContentReview.d.ts +8 -0
- package/plugins/cms/triggerContentReview.js +59 -0
- package/plugins/cms/triggerContentReview.js.map +1 -0
- package/plugins/cms/updateContentReviewStatus.d.ts +10 -0
- package/plugins/cms/updateContentReviewStatus.js +97 -0
- package/plugins/cms/updateContentReviewStatus.js.map +1 -0
- package/plugins/cms/utils.d.ts +27 -0
- package/plugins/cms/utils.js +207 -0
- package/plugins/cms/utils.js.map +1 -0
- package/plugins/context.d.ts +5 -0
- package/plugins/context.js +146 -0
- package/plugins/context.js.map +1 -0
- package/plugins/graphql/changeRequest.gql.d.ts +4 -0
- package/plugins/graphql/changeRequest.gql.js +155 -0
- package/plugins/graphql/changeRequest.gql.js.map +1 -0
- package/plugins/graphql/comment.gql.d.ts +4 -0
- package/plugins/graphql/comment.gql.js +160 -0
- package/plugins/graphql/comment.gql.js.map +1 -0
- package/plugins/graphql/contentReview.gql.d.ts +4 -0
- package/plugins/graphql/contentReview.gql.js +382 -0
- package/plugins/graphql/contentReview.gql.js.map +1 -0
- package/plugins/graphql/reviewer.gql.d.ts +4 -0
- package/plugins/graphql/reviewer.gql.js +116 -0
- package/plugins/graphql/reviewer.gql.js.map +1 -0
- package/plugins/graphql/workflow.gql.d.ts +4 -0
- package/plugins/graphql/workflow.gql.js +205 -0
- package/plugins/graphql/workflow.gql.js.map +1 -0
- package/plugins/graphql.d.ts +4 -0
- package/plugins/graphql.js +95 -0
- package/plugins/graphql.js.map +1 -0
- package/plugins/hooks/createReviewerFromIdentity.d.ts +2 -0
- package/plugins/hooks/createReviewerFromIdentity.js +82 -0
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -0
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +2 -0
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +67 -0
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -0
- package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +2 -0
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +59 -0
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -0
- package/plugins/hooks/index.d.ts +3 -0
- package/plugins/hooks/index.js +74 -0
- package/plugins/hooks/index.js.map +1 -0
- package/plugins/hooks/initializeContentReviewSteps.d.ts +2 -0
- package/plugins/hooks/initializeContentReviewSteps.js +86 -0
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -0
- package/plugins/hooks/initializeNotifications.d.ts +2 -0
- package/plugins/hooks/initializeNotifications.js +20 -0
- package/plugins/hooks/initializeNotifications.js.map +1 -0
- package/plugins/hooks/listContentReviews.d.ts +10 -0
- package/plugins/hooks/listContentReviews.js +68 -0
- package/plugins/hooks/listContentReviews.js.map +1 -0
- package/plugins/hooks/notifications/appUrl.d.ts +2 -0
- package/plugins/hooks/notifications/appUrl.js +22 -0
- package/plugins/hooks/notifications/appUrl.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +144 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
- package/plugins/hooks/notifications/changeRequestUrl.js +31 -0
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
- package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/commentAfterCreate.js +157 -0
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
- package/plugins/hooks/notifications/commentUrl.js +31 -0
- package/plugins/hooks/notifications/commentUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +122 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentReviewUrl.js +30 -0
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentUrl.js +29 -0
- package/plugins/hooks/notifications/contentUrl.js.map +1 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +25 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +25 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +25 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/reviewers.d.ts +15 -0
- package/plugins/hooks/notifications/reviewers.js +51 -0
- package/plugins/hooks/notifications/reviewers.js.map +1 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +52 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendCommentNotification.js +52 -0
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js +52 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
- package/plugins/hooks/updatePendingChangeRequests.d.ts +2 -0
- package/plugins/hooks/updatePendingChangeRequests.js +94 -0
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -0
- package/plugins/hooks/updateTotalComments.d.ts +3 -0
- package/plugins/hooks/updateTotalComments.js +153 -0
- package/plugins/hooks/updateTotalComments.js.map +1 -0
- package/plugins/hooks/validateChangeRequest.d.ts +2 -0
- package/plugins/hooks/validateChangeRequest.js +89 -0
- package/plugins/hooks/validateChangeRequest.js.map +1 -0
- package/plugins/hooks/validateComment.d.ts +2 -0
- package/plugins/hooks/validateComment.js +57 -0
- package/plugins/hooks/validateComment.js.map +1 -0
- package/plugins/hooks/validateContentReview.d.ts +2 -0
- package/plugins/hooks/validateContentReview.js +38 -0
- package/plugins/hooks/validateContentReview.js.map +1 -0
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +9 -0
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +51 -0
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -0
- package/plugins/pageBuilder/apwContentPagePlugins.d.ts +3 -0
- package/plugins/pageBuilder/apwContentPagePlugins.js +30 -0
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -0
- package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +3 -0
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +25 -0
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -0
- package/plugins/pageBuilder/index.d.ts +11 -0
- package/plugins/pageBuilder/index.js +53 -0
- package/plugins/pageBuilder/index.js.map +1 -0
- package/plugins/pageBuilder/linkContentReviewToPage.d.ts +8 -0
- package/plugins/pageBuilder/linkContentReviewToPage.js +105 -0
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -0
- package/plugins/pageBuilder/linkWorkflowToPage.d.ts +8 -0
- package/plugins/pageBuilder/linkWorkflowToPage.js +194 -0
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +35 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.js +35 -0
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +35 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.js +53 -0
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
- package/plugins/pageBuilder/triggerContentReview.d.ts +8 -0
- package/plugins/pageBuilder/triggerContentReview.js +50 -0
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -0
- package/plugins/pageBuilder/updateContentReviewStatus.d.ts +10 -0
- package/plugins/pageBuilder/updateContentReviewStatus.js +79 -0
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -0
- package/plugins/pageBuilder/utils.d.ts +22 -0
- package/plugins/pageBuilder/utils.js +184 -0
- package/plugins/pageBuilder/utils.js.map +1 -0
- package/plugins/utils.d.ts +35 -0
- package/plugins/utils.js +187 -0
- package/plugins/utils.js.map +1 -0
- package/scheduler/createScheduleActionMethods.d.ts +2 -0
- package/scheduler/createScheduleActionMethods.js +149 -0
- package/scheduler/createScheduleActionMethods.js.map +1 -0
- package/scheduler/handlers/executeAction/index.d.ts +13 -0
- package/scheduler/handlers/executeAction/index.js +172 -0
- package/scheduler/handlers/executeAction/index.js.map +1 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +13 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +17 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -0
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +11 -0
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +126 -0
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -0
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +11 -0
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +163 -0
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -0
- package/scheduler/handlers/executeAction/security.d.ts +4 -0
- package/scheduler/handlers/executeAction/security.js +68 -0
- package/scheduler/handlers/executeAction/security.js.map +1 -0
- package/scheduler/handlers/scheduleAction/index.d.ts +22 -0
- package/scheduler/handlers/scheduleAction/index.js +164 -0
- package/scheduler/handlers/scheduleAction/index.js.map +1 -0
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +24 -0
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +172 -0
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -0
- package/scheduler/handlers/utils.d.ts +33 -0
- package/scheduler/handlers/utils.js +168 -0
- package/scheduler/handlers/utils.js.map +1 -0
- package/scheduler/index.d.ts +2 -0
- package/scheduler/index.js +27 -0
- package/scheduler/index.js.map +1 -0
- package/scheduler/types.d.ts +171 -0
- package/scheduler/types.js +34 -0
- package/scheduler/types.js.map +1 -0
- package/storageOperations/changeRequestStorageOperations.d.ts +3 -0
- package/storageOperations/changeRequestStorageOperations.js +122 -0
- package/storageOperations/changeRequestStorageOperations.js.map +1 -0
- package/storageOperations/commentStorageOperations.d.ts +3 -0
- package/storageOperations/commentStorageOperations.js +138 -0
- package/storageOperations/commentStorageOperations.js.map +1 -0
- package/storageOperations/contentReviewStorageOperations.d.ts +3 -0
- package/storageOperations/contentReviewStorageOperations.js +93 -0
- package/storageOperations/contentReviewStorageOperations.js.map +1 -0
- package/storageOperations/index.d.ts +15 -0
- package/storageOperations/index.js +48 -0
- package/storageOperations/index.js.map +1 -0
- package/storageOperations/models/changeRequest.model.d.ts +3 -0
- package/storageOperations/models/changeRequest.model.js +59 -0
- package/storageOperations/models/changeRequest.model.js.map +1 -0
- package/storageOperations/models/comment.model.d.ts +7 -0
- package/storageOperations/models/comment.model.js +60 -0
- package/storageOperations/models/comment.model.js.map +1 -0
- package/storageOperations/models/contentModelPluginFactory.d.ts +15 -0
- package/storageOperations/models/contentModelPluginFactory.js +28 -0
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -0
- package/storageOperations/models/contentReview.model.d.ts +7 -0
- package/storageOperations/models/contentReview.model.js +258 -0
- package/storageOperations/models/contentReview.model.js.map +1 -0
- package/storageOperations/models/index.d.ts +2 -0
- package/storageOperations/models/index.js +115 -0
- package/storageOperations/models/index.js.map +1 -0
- package/storageOperations/models/reviewer.model.d.ts +3 -0
- package/storageOperations/models/reviewer.model.js +71 -0
- package/storageOperations/models/reviewer.model.js.map +1 -0
- package/storageOperations/models/utils.d.ts +3 -0
- package/storageOperations/models/utils.js +37 -0
- package/storageOperations/models/utils.js.map +1 -0
- package/storageOperations/models/workflow.model.d.ts +12 -0
- package/storageOperations/models/workflow.model.js +208 -0
- package/storageOperations/models/workflow.model.js.map +1 -0
- package/storageOperations/reviewerStorageOperations.d.ts +3 -0
- package/storageOperations/reviewerStorageOperations.js +97 -0
- package/storageOperations/reviewerStorageOperations.js.map +1 -0
- package/storageOperations/types.d.ts +34 -0
- package/storageOperations/types.js +5 -0
- package/storageOperations/types.js.map +1 -0
- package/storageOperations/workflowStorageOperations.d.ts +3 -0
- package/storageOperations/workflowStorageOperations.js +111 -0
- package/storageOperations/workflowStorageOperations.js.map +1 -0
- package/types.d.ts +752 -0
- package/types.js +69 -0
- package/types.js.map +1 -0
- package/utils/contentApwSettingsPlugin.d.ts +9 -0
- package/utils/contentApwSettingsPlugin.js +26 -0
- package/utils/contentApwSettingsPlugin.js.map +1 -0
- package/utils/errors.d.ts +16 -0
- package/utils/errors.js +75 -0
- package/utils/errors.js.map +1 -0
- package/utils/fieldResolver.d.ts +16 -0
- package/utils/fieldResolver.js +54 -0
- package/utils/fieldResolver.js.map +1 -0
- package/utils/resolve.d.ts +3 -0
- package/utils/resolve.js +18 -0
- package/utils/resolve.js.map +1 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createReviewerMethods = createReviewerMethods;
|
7
|
+
|
8
|
+
var _pubsub = require("@webiny/pubsub");
|
9
|
+
|
10
|
+
function createReviewerMethods({
|
11
|
+
storageOperations
|
12
|
+
}) {
|
13
|
+
// create
|
14
|
+
const onReviewerBeforeCreate = (0, _pubsub.createTopic)("apw.onReviewerBeforeCreate");
|
15
|
+
const onReviewerAfterCreate = (0, _pubsub.createTopic)("apw.onReviewerAfterCreate"); // update
|
16
|
+
|
17
|
+
const onReviewerBeforeUpdate = (0, _pubsub.createTopic)("apw.onReviewerBeforeUpdate");
|
18
|
+
const onReviewerAfterUpdate = (0, _pubsub.createTopic)("apw.onReviewerAfterUpdate"); // delete
|
19
|
+
|
20
|
+
const onReviewerBeforeDelete = (0, _pubsub.createTopic)("apw.onReviewerBeforeDelete");
|
21
|
+
const onReviewerAfterDelete = (0, _pubsub.createTopic)("apw.onReviewerAfterDelete");
|
22
|
+
return {
|
23
|
+
/**
|
24
|
+
* Lifecycle events
|
25
|
+
*/
|
26
|
+
onReviewerBeforeCreate,
|
27
|
+
onReviewerAfterCreate,
|
28
|
+
onReviewerBeforeUpdate,
|
29
|
+
onReviewerAfterUpdate,
|
30
|
+
onReviewerBeforeDelete,
|
31
|
+
onReviewerAfterDelete,
|
32
|
+
|
33
|
+
async get(id) {
|
34
|
+
return storageOperations.getReviewer({
|
35
|
+
id
|
36
|
+
});
|
37
|
+
},
|
38
|
+
|
39
|
+
async list(params) {
|
40
|
+
return storageOperations.listReviewers(params);
|
41
|
+
},
|
42
|
+
|
43
|
+
async create(data) {
|
44
|
+
await onReviewerBeforeCreate.publish({
|
45
|
+
input: data
|
46
|
+
});
|
47
|
+
const reviewer = await storageOperations.createReviewer({
|
48
|
+
data
|
49
|
+
});
|
50
|
+
await onReviewerAfterCreate.publish({
|
51
|
+
reviewer
|
52
|
+
});
|
53
|
+
return reviewer;
|
54
|
+
},
|
55
|
+
|
56
|
+
async update(id, data) {
|
57
|
+
const original = await storageOperations.getReviewer({
|
58
|
+
id
|
59
|
+
});
|
60
|
+
await onReviewerBeforeUpdate.publish({
|
61
|
+
original,
|
62
|
+
input: {
|
63
|
+
id,
|
64
|
+
data
|
65
|
+
}
|
66
|
+
});
|
67
|
+
const reviewer = await storageOperations.updateReviewer({
|
68
|
+
id,
|
69
|
+
data
|
70
|
+
});
|
71
|
+
await onReviewerAfterUpdate.publish({
|
72
|
+
original,
|
73
|
+
input: {
|
74
|
+
id,
|
75
|
+
data
|
76
|
+
},
|
77
|
+
reviewer
|
78
|
+
});
|
79
|
+
return reviewer;
|
80
|
+
},
|
81
|
+
|
82
|
+
async delete(id) {
|
83
|
+
const reviewer = await storageOperations.getReviewer({
|
84
|
+
id
|
85
|
+
});
|
86
|
+
await onReviewerBeforeDelete.publish({
|
87
|
+
reviewer
|
88
|
+
});
|
89
|
+
await storageOperations.deleteReviewer({
|
90
|
+
id
|
91
|
+
});
|
92
|
+
await onReviewerAfterDelete.publish({
|
93
|
+
reviewer
|
94
|
+
});
|
95
|
+
return true;
|
96
|
+
}
|
97
|
+
|
98
|
+
};
|
99
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createReviewerMethods","storageOperations","onReviewerBeforeCreate","createTopic","onReviewerAfterCreate","onReviewerBeforeUpdate","onReviewerAfterUpdate","onReviewerBeforeDelete","onReviewerAfterDelete","get","id","getReviewer","list","params","listReviewers","create","data","publish","input","reviewer","createReviewer","update","original","updateReviewer","delete","deleteReviewer"],"sources":["createReviewerMethods.ts"],"sourcesContent":["import {\n ApwReviewerCrud,\n CreateApwParams,\n OnReviewerAfterCreateTopicParams,\n OnReviewerAfterDeleteTopicParams,\n OnReviewerAfterUpdateTopicParams,\n OnReviewerBeforeCreateTopicParams,\n OnReviewerBeforeDeleteTopicParams,\n OnReviewerBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\n\nexport function createReviewerMethods({ storageOperations }: CreateApwParams): ApwReviewerCrud {\n // create\n const onReviewerBeforeCreate = createTopic<OnReviewerBeforeCreateTopicParams>(\n \"apw.onReviewerBeforeCreate\"\n );\n const onReviewerAfterCreate = createTopic<OnReviewerAfterCreateTopicParams>(\n \"apw.onReviewerAfterCreate\"\n );\n // update\n const onReviewerBeforeUpdate = createTopic<OnReviewerBeforeUpdateTopicParams>(\n \"apw.onReviewerBeforeUpdate\"\n );\n const onReviewerAfterUpdate = createTopic<OnReviewerAfterUpdateTopicParams>(\n \"apw.onReviewerAfterUpdate\"\n );\n // delete\n const onReviewerBeforeDelete = createTopic<OnReviewerBeforeDeleteTopicParams>(\n \"apw.onReviewerBeforeDelete\"\n );\n const onReviewerAfterDelete = createTopic<OnReviewerAfterDeleteTopicParams>(\n \"apw.onReviewerAfterDelete\"\n );\n return {\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate,\n onReviewerAfterCreate,\n onReviewerBeforeUpdate,\n onReviewerAfterUpdate,\n onReviewerBeforeDelete,\n onReviewerAfterDelete,\n async get(id) {\n return storageOperations.getReviewer({ id });\n },\n async list(params) {\n return storageOperations.listReviewers(params);\n },\n async create(data) {\n await onReviewerBeforeCreate.publish({ input: data });\n\n const reviewer = await storageOperations.createReviewer({ data });\n\n await onReviewerAfterCreate.publish({ reviewer });\n\n return reviewer;\n },\n async update(id, data) {\n const original = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeUpdate.publish({ original, input: { id, data } });\n\n const reviewer = await storageOperations.updateReviewer({ id, data });\n\n await onReviewerAfterUpdate.publish({ original, input: { id, data }, reviewer });\n\n return reviewer;\n },\n async delete(id: string) {\n const reviewer = await storageOperations.getReviewer({ id });\n\n await onReviewerBeforeDelete.publish({ reviewer });\n\n await storageOperations.deleteReviewer({ id });\n\n await onReviewerAfterDelete.publish({ reviewer });\n\n return true;\n }\n };\n}\n"],"mappings":";;;;;;;AAUA;;AAEO,SAASA,qBAAT,CAA+B;EAAEC;AAAF,CAA/B,EAAwF;EAC3F;EACA,MAAMC,sBAAsB,GAAG,IAAAC,mBAAA,EAC3B,4BAD2B,CAA/B;EAGA,MAAMC,qBAAqB,GAAG,IAAAD,mBAAA,EAC1B,2BAD0B,CAA9B,CAL2F,CAQ3F;;EACA,MAAME,sBAAsB,GAAG,IAAAF,mBAAA,EAC3B,4BA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jC,CAAvB;MAEA,MAAMV,qBAAqB,CAACW,OAAtB,CAA8B;QAAEK,QAAF;QAAYJ,KAAK,EAAE;UAAER,EAAF;UAAMM;QAAN,CAAnB;QAAiCG;MAAjC,CAA9B,CAAN;MAEA,OAAOA,QAAP;IACH,CAnCE;;IAoCH,MAAMK,MAAN,CAAad,EAAb,EAAyB;MACrB,MAAMS,QAAQ,GAAG,MAAMlB,iBAAiB,CAACU,WAAlB,CAA8B;QAAED;MAAF,CAA9B,CAAvB;MAEA,MAAMH,sBAAsB,CAACU,OAAvB,CAA+B;QAAEE;MAAF,CAA/B,CAAN;MAEA,MAAMlB,iBAAiB,CAACwB,cAAlB,CAAiC;QAAEf;MAAF,CAAjC,CAAN;MAEA,MAAMF,qBAAqB,CAACS,OAAtB,CAA8B;QAAEE;MAAF,CAA9B,CAAN;MAEA,OAAO,IAAP;IACH;;EA9CE,CAAP;AAgDH"}
|
@@ -0,0 +1,118 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createWorkflowMethods = createWorkflowMethods;
|
7
|
+
|
8
|
+
var _pubsub = require("@webiny/pubsub");
|
9
|
+
|
10
|
+
var _apiSecurity = require("@webiny/api-security");
|
11
|
+
|
12
|
+
function createWorkflowMethods({
|
13
|
+
storageOperations,
|
14
|
+
getPermission
|
15
|
+
}) {
|
16
|
+
// create
|
17
|
+
const onWorkflowBeforeCreate = (0, _pubsub.createTopic)("apw.onWorkflowBeforeCreate");
|
18
|
+
const onWorkflowAfterCreate = (0, _pubsub.createTopic)("apw.onWorkflowAfterCreate"); // update
|
19
|
+
|
20
|
+
const onWorkflowBeforeUpdate = (0, _pubsub.createTopic)("apw.onWorkflowBeforeUpdate");
|
21
|
+
const onWorkflowAfterUpdate = (0, _pubsub.createTopic)("apw.onWorkflowAfterUpdate"); // delete
|
22
|
+
|
23
|
+
const onWorkflowBeforeDelete = (0, _pubsub.createTopic)("apw.onWorkflowBeforeDelete");
|
24
|
+
const onWorkflowAfterDelete = (0, _pubsub.createTopic)("apw.onWorkflowAfterDelete");
|
25
|
+
|
26
|
+
const validateAccess = async () => {
|
27
|
+
const permission = await getPermission("apw.publishingWorkflows");
|
28
|
+
|
29
|
+
if (!!permission) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
throw new _apiSecurity.NotAuthorizedError({
|
34
|
+
message: "Not authorized to access publishing workflows."
|
35
|
+
});
|
36
|
+
};
|
37
|
+
|
38
|
+
return {
|
39
|
+
/**
|
40
|
+
* Lifecycle events
|
41
|
+
*/
|
42
|
+
onWorkflowBeforeCreate,
|
43
|
+
onWorkflowAfterCreate,
|
44
|
+
onWorkflowBeforeUpdate,
|
45
|
+
onWorkflowAfterUpdate,
|
46
|
+
onWorkflowBeforeDelete,
|
47
|
+
onWorkflowAfterDelete,
|
48
|
+
|
49
|
+
async get(id) {
|
50
|
+
return storageOperations.getWorkflow({
|
51
|
+
id
|
52
|
+
});
|
53
|
+
},
|
54
|
+
|
55
|
+
async list(params) {
|
56
|
+
return storageOperations.listWorkflows(params || {});
|
57
|
+
},
|
58
|
+
|
59
|
+
async create(data) {
|
60
|
+
await validateAccess();
|
61
|
+
await onWorkflowBeforeCreate.publish({
|
62
|
+
input: data
|
63
|
+
});
|
64
|
+
const workflow = await storageOperations.createWorkflow({
|
65
|
+
data
|
66
|
+
});
|
67
|
+
await onWorkflowAfterCreate.publish({
|
68
|
+
workflow
|
69
|
+
});
|
70
|
+
return workflow;
|
71
|
+
},
|
72
|
+
|
73
|
+
async update(id, data) {
|
74
|
+
await validateAccess();
|
75
|
+
const original = await storageOperations.getWorkflow({
|
76
|
+
id
|
77
|
+
});
|
78
|
+
await onWorkflowBeforeUpdate.publish({
|
79
|
+
original,
|
80
|
+
input: {
|
81
|
+
id,
|
82
|
+
data
|
83
|
+
}
|
84
|
+
});
|
85
|
+
const workflow = await storageOperations.updateWorkflow({
|
86
|
+
id,
|
87
|
+
data
|
88
|
+
});
|
89
|
+
await onWorkflowAfterUpdate.publish({
|
90
|
+
original,
|
91
|
+
input: {
|
92
|
+
id,
|
93
|
+
data
|
94
|
+
},
|
95
|
+
workflow
|
96
|
+
});
|
97
|
+
return workflow;
|
98
|
+
},
|
99
|
+
|
100
|
+
async delete(id) {
|
101
|
+
await validateAccess();
|
102
|
+
const workflow = await storageOperations.getWorkflow({
|
103
|
+
id
|
104
|
+
});
|
105
|
+
await onWorkflowBeforeDelete.publish({
|
106
|
+
workflow
|
107
|
+
});
|
108
|
+
await storageOperations.deleteWorkflow({
|
109
|
+
id
|
110
|
+
});
|
111
|
+
await onWorkflowAfterDelete.publish({
|
112
|
+
workflow
|
113
|
+
});
|
114
|
+
return true;
|
115
|
+
}
|
116
|
+
|
117
|
+
};
|
118
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createWorkflowMethods","storageOperations","getPermission","onWorkflowBeforeCreate","createTopic","onWorkflowAfterCreate","onWorkflowBeforeUpdate","onWorkflowAfterUpdate","onWorkflowBeforeDelete","onWorkflowAfterDelete","validateAccess","permission","NotAuthorizedError","message","get","id","getWorkflow","list","params","listWorkflows","create","data","publish","input","workflow","createWorkflow","update","original","updateWorkflow","delete","deleteWorkflow"],"sources":["createWorkflowMethods.ts"],"sourcesContent":["import {\n ApwWorkflowCrud,\n CreateApwParams,\n OnWorkflowAfterCreateTopicParams,\n OnWorkflowAfterDeleteTopicParams,\n OnWorkflowAfterUpdateTopicParams,\n OnWorkflowBeforeCreateTopicParams,\n OnWorkflowBeforeDeleteTopicParams,\n OnWorkflowBeforeUpdateTopicParams\n} from \"~/types\";\nimport { createTopic } from \"@webiny/pubsub\";\nimport { NotAuthorizedError } from \"@webiny/api-security\";\n\nexport function createWorkflowMethods({\n storageOperations,\n getPermission\n}: CreateApwParams): ApwWorkflowCrud {\n // create\n const onWorkflowBeforeCreate = createTopic<OnWorkflowBeforeCreateTopicParams>(\n \"apw.onWorkflowBeforeCreate\"\n );\n const onWorkflowAfterCreate = createTopic<OnWorkflowAfterCreateTopicParams>(\n \"apw.onWorkflowAfterCreate\"\n );\n // update\n const onWorkflowBeforeUpdate = createTopic<OnWorkflowBeforeUpdateTopicParams>(\n \"apw.onWorkflowBeforeUpdate\"\n );\n const onWorkflowAfterUpdate = createTopic<OnWorkflowAfterUpdateTopicParams>(\n \"apw.onWorkflowAfterUpdate\"\n );\n // delete\n const onWorkflowBeforeDelete = createTopic<OnWorkflowBeforeDeleteTopicParams>(\n \"apw.onWorkflowBeforeDelete\"\n );\n const onWorkflowAfterDelete = createTopic<OnWorkflowAfterDeleteTopicParams>(\n \"apw.onWorkflowAfterDelete\"\n );\n\n const validateAccess = async (): Promise<void> => {\n const permission = await getPermission(\"apw.publishingWorkflows\");\n if (!!permission) {\n return;\n }\n throw new NotAuthorizedError({\n message: \"Not authorized to access publishing workflows.\"\n });\n };\n\n return {\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate,\n onWorkflowAfterCreate,\n onWorkflowBeforeUpdate,\n onWorkflowAfterUpdate,\n onWorkflowBeforeDelete,\n onWorkflowAfterDelete,\n async get(id) {\n return storageOperations.getWorkflow({ id });\n },\n async list(params) {\n return storageOperations.listWorkflows(params || {});\n },\n async create(data) {\n await validateAccess();\n await onWorkflowBeforeCreate.publish({ input: data });\n\n const workflow = await storageOperations.createWorkflow({ data });\n\n await onWorkflowAfterCreate.publish({ workflow });\n\n return workflow;\n },\n async update(id, data) {\n await validateAccess();\n const original = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeUpdate.publish({ original, input: { id, data } });\n\n const workflow = await storageOperations.updateWorkflow({ id, data });\n\n await onWorkflowAfterUpdate.publish({ original, input: { id, data }, workflow });\n\n return workflow;\n },\n async delete(id: string) {\n await validateAccess();\n const workflow = await storageOperations.getWorkflow({ id });\n\n await onWorkflowBeforeDelete.publish({ workflow });\n\n await storageOperations.deleteWorkflow({ id });\n\n await onWorkflowAfterDelete.publish({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/crud/index.js
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.createApw = void 0;
|
9
|
+
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
|
+
|
12
|
+
var _createWorkflowMethods = require("./createWorkflowMethods");
|
13
|
+
|
14
|
+
var _createReviewerMethods = require("./createReviewerMethods");
|
15
|
+
|
16
|
+
var _createCommentMethods = require("./createCommentMethods");
|
17
|
+
|
18
|
+
var _createChangeRequestMethods = require("./createChangeRequestMethods");
|
19
|
+
|
20
|
+
var _createContentReviewMethods = require("./createContentReviewMethods");
|
21
|
+
|
22
|
+
const createApw = params => {
|
23
|
+
const contentGetters = new Map();
|
24
|
+
const contentPublisher = new Map();
|
25
|
+
const contentUnPublisher = new Map();
|
26
|
+
const workflowMethods = (0, _createWorkflowMethods.createWorkflowMethods)(params);
|
27
|
+
const reviewerMethods = (0, _createReviewerMethods.createReviewerMethods)(params);
|
28
|
+
const changeRequestMethods = (0, _createChangeRequestMethods.createChangeRequestMethods)(params);
|
29
|
+
|
30
|
+
function getContentGetter(type) {
|
31
|
+
const getter = contentGetters.get(type);
|
32
|
+
|
33
|
+
if (!getter) {
|
34
|
+
throw new Error(`No "ContentGetter" loader found for type: "${type}". You must define a loader.`);
|
35
|
+
}
|
36
|
+
|
37
|
+
return getter;
|
38
|
+
}
|
39
|
+
|
40
|
+
function getContentUnPublisher(type) {
|
41
|
+
const getter = contentUnPublisher.get(type);
|
42
|
+
|
43
|
+
if (!getter) {
|
44
|
+
throw new Error(`No "Content UnPublisher" loader found for type: "${type}". You must define a loader.`);
|
45
|
+
}
|
46
|
+
|
47
|
+
return getter;
|
48
|
+
}
|
49
|
+
|
50
|
+
function getContentPublisher(type) {
|
51
|
+
const getter = contentPublisher.get(type);
|
52
|
+
|
53
|
+
if (!getter) {
|
54
|
+
throw new Error(`No "ContentPublisher" loader found for type: "${type}". You must define a loader.`);
|
55
|
+
}
|
56
|
+
|
57
|
+
return getter;
|
58
|
+
}
|
59
|
+
|
60
|
+
return {
|
61
|
+
addContentPublisher(type, func) {
|
62
|
+
contentPublisher.set(type, func);
|
63
|
+
},
|
64
|
+
|
65
|
+
getContentPublisher,
|
66
|
+
|
67
|
+
addContentGetter(type, func) {
|
68
|
+
contentGetters.set(type, func);
|
69
|
+
},
|
70
|
+
|
71
|
+
getContentGetter,
|
72
|
+
|
73
|
+
addContentUnPublisher(type, func) {
|
74
|
+
contentUnPublisher.set(type, func);
|
75
|
+
},
|
76
|
+
|
77
|
+
getContentUnPublisher,
|
78
|
+
workflow: workflowMethods,
|
79
|
+
reviewer: reviewerMethods,
|
80
|
+
changeRequest: changeRequestMethods,
|
81
|
+
comment: (0, _createCommentMethods.createCommentMethods)(params),
|
82
|
+
contentReview: (0, _createContentReviewMethods.createContentReviewMethods)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
|
83
|
+
getReviewer: reviewerMethods.get.bind(reviewerMethods),
|
84
|
+
getContentGetter,
|
85
|
+
getContentPublisher,
|
86
|
+
getContentUnPublisher
|
87
|
+
})),
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Add scheduler to context so that we can access it later. For example, during testing.
|
91
|
+
*/
|
92
|
+
scheduleAction: params.scheduler
|
93
|
+
};
|
94
|
+
};
|
95
|
+
|
96
|
+
exports.createApw = createApw;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createApw","params","contentGetters","Map","contentPublisher","contentUnPublisher","workflowMethods","createWorkflowMethods","reviewerMethods","createReviewerMethods","changeRequestMethods","createChangeRequestMethods","getContentGetter","type","getter","get","Error","getContentUnPublisher","getContentPublisher","addContentPublisher","func","set","addContentGetter","addContentUnPublisher","workflow","reviewer","changeRequest","comment","createCommentMethods","contentReview","createContentReviewMethods","getReviewer","bind","scheduleAction","scheduler"],"sources":["index.ts"],"sourcesContent":["import { createWorkflowMethods } from \"./createWorkflowMethods\";\nimport { createReviewerMethods } from \"./createReviewerMethods\";\nimport { createCommentMethods } from \"./createCommentMethods\";\nimport { createChangeRequestMethods } from \"./createChangeRequestMethods\";\nimport { createContentReviewMethods } from \"./createContentReviewMethods\";\nimport {\n AdvancedPublishingWorkflow,\n ApwContentTypes,\n ContentGetter,\n ContentPublisher,\n ContentUnPublisher,\n CreateApwParams\n} from \"~/types\";\n\nexport const createApw = (params: CreateApwParams): AdvancedPublishingWorkflow => {\n const contentGetters = new Map<ApwContentTypes, ContentGetter>();\n const contentPublisher = new Map<ApwContentTypes, ContentPublisher>();\n const contentUnPublisher = new Map<ApwContentTypes, ContentUnPublisher>();\n\n const workflowMethods = createWorkflowMethods(params);\n const reviewerMethods = createReviewerMethods(params);\n const changeRequestMethods = createChangeRequestMethods(params);\n\n function getContentGetter(type: ApwContentTypes) {\n const getter = contentGetters.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentGetter\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentUnPublisher(type: ApwContentTypes) {\n const getter = contentUnPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"Content UnPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n function getContentPublisher(type: ApwContentTypes) {\n const getter = contentPublisher.get(type);\n if (!getter) {\n throw new Error(\n `No \"ContentPublisher\" loader found for type: \"${type}\". You must define a loader.`\n );\n }\n return getter;\n }\n\n return {\n addContentPublisher(type, func) {\n contentPublisher.set(type, func);\n },\n getContentPublisher,\n addContentGetter(type, func) {\n contentGetters.set(type, func);\n },\n getContentGetter,\n addContentUnPublisher(type, func) {\n contentUnPublisher.set(type, func);\n },\n getContentUnPublisher,\n workflow: workflowMethods,\n reviewer: reviewerMethods,\n changeRequest: changeRequestMethods,\n comment: createCommentMethods(params),\n contentReview: createContentReviewMethods({\n ...params,\n getReviewer: reviewerMethods.get.bind(reviewerMethods),\n getContentGetter,\n getContentPublisher,\n getContentUnPublisher\n }),\n /**\n * Add scheduler to context so that we can access it later. For example, during testing.\n */\n scheduleAction: params.scheduler\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAUO,MAAMA,SAAS,GAAIC,MAAD,IAAyD;EAC9E,MAAMC,cAAc,GAAG,IAAIC,GAAJ,EAAvB;EACA,MAAMC,gBAAgB,GAAG,IAAID,GAAJ,EAAzB;EACA,MAAME,kBAAkB,GAAG,IAAIF,GAAJ,EAA3B;EAEA,MAAMG,eAAe,GAAG,IAAAC,4CAAA,EAAsBN,MAAtB,CAAxB;EACA,MAAMO,eAAe,GAAG,IAAAC,4CAAA,EAAsBR,MAAtB,CAAxB;EACA,MAAMS,oBAAoB,GAAG,IAAAC,sDAAA,EAA2BV,MAA3B,CAA7B;;EAEA,SAASW,gBAAT,CAA0BC,IAA1B,EAAiD;IAC7C,MAAMC,MAAM,GAAGZ,cAAc,CAACa,GAAf,CAAmBF,IAAnB,CAAf;;IACA,IAAI,CAACC,MAAL,EAAa;MACT,MAAM,IAAIE,KAAJ,CACD,8CAA6CH,IAAK,8BADjD,CAAN;IAGH;;IACD,OAAOC,MAAP;EACH;;EAED,SAASG,qBAAT,CAA+BJ,IAA/B,EAAsD;IAClD,MAAMC,MAAM,GAAGT,kBAAkB,CAACU,GAAnB,CAAuBF,IAAvB,CAAf;;IACA,IAAI,CAACC,MAAL,EAAa;MACT,MAAM,IAAIE,KAAJ,CACD,oDAAmDH,IAAK,8BADvD,CAAN;IAGH;;IACD,OAAOC,MAAP;EACH;;EAED,SAASI,mBAAT,CAA6BL,IAA7B,EAAoD;IAChD,MAAMC,MAAM,GAAGV,gBAAgB,CAACW,GAAjB,CAAqBF,IAArB,CAAf;;IACA,IAAI,CAACC,MAAL,EAAa;MACT,MAAM,IAAIE,KAAJ,CACD,iDAAgDH,IAAK,8BADpD,CAAN;IAGH;;IACD,OAAOC,MAAP;EACH;;EAED,OAAO;IACHK,mBAAmB,CAACN,IAAD,EAAOO,IAAP,EAAa;MAC5BhB,gBAAgB,CAACiB,GAAjB,CAAqBR,IAArB,EAA2BO,IAA3B;IACH,CAHE;;IAIHF,mBAJG;;IAKHI,gBAAgB,CAACT,IAAD,EAAOO,IAAP,EAAa;MACzBlB,cAAc,CAACmB,GAAf,CAAmBR,IAAnB,EAAyBO,IAAzB;IACH,CAPE;;IAQHR,gBARG;;IASHW,qBAAqB,CAACV,IAAD,EAAOO,IAAP,EAAa;MAC9Bf,kBAAkB,CAACgB,GAAnB,CAAuBR,IAAvB,EAA6BO,IAA7B;IACH,CAXE;;IAYHH,qBAZG;IAaHO,QAAQ,EAAElB,eAbP;IAcHmB,QAAQ,EAAEjB,eAdP;IAeHkB,aAAa,EAAEhB,oBAfZ;IAgBHiB,OAAO,EAAE,IAAAC,0CAAA,EAAqB3B,MAArB,CAhBN;IAiBH4B,aAAa,EAAE,IAAAC,sDAAA,8DACR7B,MADQ;MAEX8B,WAAW,EAAEvB,eAAe,CAACO,GAAhB,CAAoBiB,IAApB,CAAyBxB,eAAzB,CAFF;MAGXI,gBAHW;MAIXM,mBAJW;MAKXD;IALW,GAjBZ;;IAwBH;AACR;AACA;IACQgB,cAAc,EAAEhC,MAAM,CAACiC;EA3BpB,CAAP;AA6BH,CApEM"}
|
package/crud/utils.d.ts
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
import { ApwContentReview, ApwContentReviewListParams, ApwContentReviewStep, ListMeta } from "../types";
|
2
|
+
import { CreateContentReviewMethodsParams } from "./createContentReviewMethods";
|
3
|
+
export declare function checkValidDateTime(datetime: string | undefined): void;
|
4
|
+
export interface GetPendingRequiredSteps {
|
5
|
+
(steps: ApwContentReviewStep[], predicate: (step: ApwContentReviewStep) => boolean): ApwContentReviewStep[];
|
6
|
+
}
|
7
|
+
export declare const getPendingRequiredSteps: GetPendingRequiredSteps;
|
8
|
+
export declare const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META: {
|
9
|
+
scheduledOn: null;
|
10
|
+
scheduledBy: null;
|
11
|
+
scheduledActionId: null;
|
12
|
+
};
|
13
|
+
export interface FilterContentReviewsParams extends Pick<CreateContentReviewMethodsParams, "getReviewer" | "getIdentity"> {
|
14
|
+
listParams: ApwContentReviewListParams;
|
15
|
+
listContentReviews: CreateContentReviewMethodsParams["storageOperations"]["listContentReviews"];
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Filter "content reviews" that are "underReview" and current user is a reviewer for the active step.
|
19
|
+
* That is the user is able to provide sign-off or comment.
|
20
|
+
*/
|
21
|
+
export declare const filterContentReviewsByRequiresMyAttention: (params: FilterContentReviewsParams) => Promise<[ApwContentReview[], ListMeta]>;
|
package/crud/utils.js
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = void 0;
|
9
|
+
exports.checkValidDateTime = checkValidDateTime;
|
10
|
+
exports.getPendingRequiredSteps = exports.filterContentReviewsByRequiresMyAttention = void 0;
|
11
|
+
|
12
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
13
|
+
|
14
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
15
|
+
|
16
|
+
var _dayjs = _interopRequireDefault(require("dayjs"));
|
17
|
+
|
18
|
+
var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
|
19
|
+
|
20
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
21
|
+
|
22
|
+
var _set = _interopRequireDefault(require("lodash/set"));
|
23
|
+
|
24
|
+
var _types = require("../types");
|
25
|
+
|
26
|
+
_dayjs.default.extend(_utc.default);
|
27
|
+
|
28
|
+
function checkValidDateTime(datetime) {
|
29
|
+
if (typeof datetime !== "string") {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
if (!(0, _dayjs.default)(datetime).isValid()) {
|
34
|
+
throw new _error.default({
|
35
|
+
message: `Invalid input "datetime" should be an ISO string.`,
|
36
|
+
code: "INVALID_DATETIME_FORMAT",
|
37
|
+
data: {
|
38
|
+
datetime
|
39
|
+
}
|
40
|
+
});
|
41
|
+
}
|
42
|
+
|
43
|
+
const today = _dayjs.default.utc();
|
44
|
+
|
45
|
+
if ((0, _dayjs.default)(datetime).isBefore(today)) {
|
46
|
+
throw new _error.default({
|
47
|
+
message: `Cannot schedule for a past "datetime".`,
|
48
|
+
code: "PAST_DATETIME",
|
49
|
+
data: {
|
50
|
+
datetime
|
51
|
+
}
|
52
|
+
});
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
const getPendingRequiredSteps = (steps, predicate) => {
|
57
|
+
return steps.filter(step => {
|
58
|
+
const isRequiredStep = [_types.ApwWorkflowStepTypes.MANDATORY_BLOCKING, _types.ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING].includes(step.type);
|
59
|
+
|
60
|
+
if (!isRequiredStep) {
|
61
|
+
return false;
|
62
|
+
}
|
63
|
+
|
64
|
+
return predicate(step);
|
65
|
+
});
|
66
|
+
};
|
67
|
+
|
68
|
+
exports.getPendingRequiredSteps = getPendingRequiredSteps;
|
69
|
+
const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {
|
70
|
+
scheduledOn: null,
|
71
|
+
scheduledBy: null,
|
72
|
+
scheduledActionId: null
|
73
|
+
};
|
74
|
+
exports.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META;
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Filter "content reviews" that are "underReview" and current user is a reviewer for the active step.
|
78
|
+
* That is the user is able to provide sign-off or comment.
|
79
|
+
*/
|
80
|
+
const filterContentReviewsByRequiresMyAttention = async params => {
|
81
|
+
const {
|
82
|
+
listContentReviews,
|
83
|
+
listParams,
|
84
|
+
getIdentity,
|
85
|
+
getReviewer
|
86
|
+
} = params;
|
87
|
+
/**
|
88
|
+
* Get all "content reviews" with status "underReview"
|
89
|
+
*/
|
90
|
+
|
91
|
+
const newListParams = (0, _set.default)((0, _cloneDeep.default)(listParams), "where.reviewStatus", _types.ApwContentReviewStatus.UNDER_REVIEW);
|
92
|
+
const [contentReviews, meta] = await listContentReviews(newListParams);
|
93
|
+
const identity = getIdentity();
|
94
|
+
const filteredItems = [];
|
95
|
+
/**
|
96
|
+
* Filter items where current user is a reviewer for the active step.
|
97
|
+
*/
|
98
|
+
|
99
|
+
for (let i = 0; i < contentReviews.length; i++) {
|
100
|
+
const contentReview = contentReviews[i];
|
101
|
+
const activeStep = contentReview.steps.find(step => step.status === _types.ApwContentReviewStepStatus.ACTIVE);
|
102
|
+
|
103
|
+
if (!activeStep) {
|
104
|
+
continue;
|
105
|
+
}
|
106
|
+
|
107
|
+
let requiresMyAttention = false;
|
108
|
+
|
109
|
+
for (let j = 0; j < activeStep.reviewers.length; j++) {
|
110
|
+
const {
|
111
|
+
id
|
112
|
+
} = activeStep.reviewers[j];
|
113
|
+
/**
|
114
|
+
* Load reviewer
|
115
|
+
*/
|
116
|
+
|
117
|
+
const reviewer = await getReviewer(id);
|
118
|
+
/**
|
119
|
+
* Check if the current logged in user is the reviewer.
|
120
|
+
*/
|
121
|
+
|
122
|
+
if (reviewer.identityId === identity.id) {
|
123
|
+
requiresMyAttention = true;
|
124
|
+
break;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
if (requiresMyAttention) {
|
129
|
+
filteredItems.push(contentReview);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
return [filteredItems, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, meta), {}, {
|
134
|
+
totalCount: filteredItems.length
|
135
|
+
})];
|
136
|
+
};
|
137
|
+
|
138
|
+
exports.filterContentReviewsByRequiresMyAttention = filterContentReviewsByRequiresMyAttention;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["dayjs","extend","utc","checkValidDateTime","datetime","isValid","Error","message","code","data","today","isBefore","getPendingRequiredSteps","steps","predicate","filter","step","isRequiredStep","ApwWorkflowStepTypes","MANDATORY_BLOCKING","MANDATORY_NON_BLOCKING","includes","type","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","scheduledOn","scheduledBy","scheduledActionId","filterContentReviewsByRequiresMyAttention","params","listContentReviews","listParams","getIdentity","getReviewer","newListParams","set","cloneDeep","ApwContentReviewStatus","UNDER_REVIEW","contentReviews","meta","identity","filteredItems","i","length","contentReview","activeStep","find","status","ApwContentReviewStepStatus","ACTIVE","requiresMyAttention","j","reviewers","id","reviewer","identityId","push","totalCount"],"sources":["utils.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport set from \"lodash/set\";\nimport {\n ApwContentReview,\n ApwContentReviewListParams,\n ApwContentReviewStatus,\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwWorkflowStepTypes,\n ListMeta\n} from \"~/types\";\nimport { CreateContentReviewMethodsParams } from \"./createContentReviewMethods\";\n\ndayjs.extend(utc);\n\nexport function checkValidDateTime(datetime: string | undefined): void {\n if (typeof datetime !== \"string\") {\n return;\n }\n\n if (!dayjs(datetime).isValid()) {\n throw new Error({\n message: `Invalid input \"datetime\" should be an ISO string.`,\n code: \"INVALID_DATETIME_FORMAT\",\n data: {\n datetime\n }\n });\n }\n const today = dayjs.utc();\n\n if (dayjs(datetime).isBefore(today)) {\n throw new Error({\n message: `Cannot schedule for a past \"datetime\".`,\n code: \"PAST_DATETIME\",\n data: {\n datetime\n }\n });\n }\n}\n\nexport interface GetPendingRequiredSteps {\n (\n steps: ApwContentReviewStep[],\n predicate: (step: ApwContentReviewStep) => boolean\n ): ApwContentReviewStep[];\n}\n\nexport const getPendingRequiredSteps: GetPendingRequiredSteps = (steps, predicate) => {\n return steps.filter(step => {\n const isRequiredStep = [\n ApwWorkflowStepTypes.MANDATORY_BLOCKING,\n ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING\n ].includes(step.type);\n\n if (!isRequiredStep) {\n return false;\n }\n\n return predicate(step);\n });\n};\n\nexport const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n};\n\nexport interface FilterContentReviewsParams\n extends Pick<CreateContentReviewMethodsParams, \"getReviewer\" | \"getIdentity\"> {\n listParams: ApwContentReviewListParams;\n listContentReviews: CreateContentReviewMethodsParams[\"storageOperations\"][\"listContentReviews\"];\n}\n\n/**\n * Filter \"content reviews\" that are \"underReview\" and current user is a reviewer for the active step.\n * That is the user is able to provide sign-off or comment.\n */\nexport const filterContentReviewsByRequiresMyAttention = async (\n params: FilterContentReviewsParams\n): Promise<[ApwContentReview[], ListMeta]> => {\n const { listContentReviews, listParams, getIdentity, getReviewer } = params;\n /**\n * Get all \"content reviews\" with status \"underReview\"\n */\n const newListParams = set(\n cloneDeep(listParams),\n \"where.reviewStatus\",\n ApwContentReviewStatus.UNDER_REVIEW\n );\n const [contentReviews, meta] = await listContentReviews(newListParams);\n\n const identity = getIdentity();\n const filteredItems = [];\n /**\n * Filter items where current user is a reviewer for the active step.\n */\n for (let i = 0; i < contentReviews.length; i++) {\n const contentReview = contentReviews[i];\n\n const activeStep = contentReview.steps.find(\n step => step.status === ApwContentReviewStepStatus.ACTIVE\n );\n\n if (!activeStep) {\n continue;\n }\n\n let requiresMyAttention = false;\n\n for (let j = 0; j < activeStep.reviewers.length; j++) {\n const { id } = activeStep.reviewers[j];\n /**\n * Load reviewer\n */\n const reviewer = await getReviewer(id);\n /**\n * Check if the current logged in user is the reviewer.\n */\n if (reviewer.identityId === identity.id) {\n requiresMyAttention = true;\n break;\n }\n }\n\n if (requiresMyAttention) {\n filteredItems.push(contentReview);\n }\n }\n\n return [\n filteredItems,\n {\n ...meta,\n totalCount: filteredItems.length\n }\n ];\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAWAA,cAAA,CAAMC,MAAN,CAAaC,YAAb;;AAEO,SAASC,kBAAT,CAA4BC,QAA5B,EAAgE;EACnE,IAAI,OAAOA,QAAP,KAAoB,QAAxB,EAAkC;IAC9B;EACH;;EAED,IAAI,CAAC,IAAAJ,cAAA,EAAMI,QAAN,EAAgBC,OAAhB,EAAL,EAAgC;IAC5B,MAAM,IAAIC,cAAJ,CAAU;MACZC,OAAO,EAAG,mDADE;MAEZC,IAAI,EAAE,yBAFM;MAGZC,IAAI,EAAE;QACFL;MADE;IAHM,CAAV,CAAN;EAOH;;EACD,MAAMM,KAAK,GAAGV,cAAA,CAAME,GAAN,EAAd;;EAEA,IAAI,IAAAF,cAAA,EAAMI,QAAN,EAAgBO,QAAhB,CAAyBD,KAAzB,CAAJ,EAAqC;IACjC,MAAM,IAAIJ,cAAJ,CAAU;MACZC,OAAO,EAAG,wCADE;MAEZC,IAAI,EAAE,eAFM;MAGZC,IAAI,EAAE;QACFL;MADE;IAHM,CAAV,CAAN;EAOH;AACJ;;AASM,MAAMQ,uBAAgD,GAAG,CAACC,KAAD,EAAQC,SAAR,KAAsB;EAClF,OAAOD,KAAK,CAACE,MAAN,CAAaC,IAAI,IAAI;IACxB,MAAMC,cAAc,GAAG,CACnBC,2BAAA,CAAqBC,kBADF,EAEnBD,2BAAA,CAAqBE,sBAFF,EAGrBC,QAHqB,CAGZL,IAAI,CAACM,IAHO,CAAvB;;IAKA,IAAI,CAACL,cAAL,EAAqB;MACjB,OAAO,KAAP;IACH;;IAED,OAAOH,SAAS,CAACE,IAAD,CAAhB;EACH,CAXM,CAAP;AAYH,CAbM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AD,CAAlC;MACA;AACZ;AACA;;MACY,IAAIC,QAAQ,CAACC,UAAT,KAAwBf,QAAQ,CAACa,EAArC,EAAyC;QACrCH,mBAAmB,GAAG,IAAtB;QACA;MACH;IACJ;;IAED,IAAIA,mBAAJ,EAAyB;MACrBT,aAAa,CAACe,IAAd,CAAmBZ,aAAnB;IACH;EACJ;;EAED,OAAO,CACHH,aADG,8DAGIF,IAHJ;IAICkB,UAAU,EAAEhB,aAAa,CAACE;EAJ3B,GAAP;AAOH,CA3DM"}
|
package/index.d.ts
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
import { CreateApwContextParams } from "./scheduler/types";
|
2
|
+
export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => (import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/api").ContextPlugin<import("./types").ApwContext>)[];
|
3
|
+
export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
|
4
|
+
export declare const createApwGraphQL: () => import("@webiny/api").ContextPlugin<import("./types").ApwContext>[];
|
package/index.js
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.createApwPageBuilderContext = exports.createApwHeadlessCmsContext = exports.createApwGraphQL = void 0;
|
9
|
+
|
10
|
+
var _graphql = _interopRequireDefault(require("./plugins/graphql"));
|
11
|
+
|
12
|
+
var _context = require("./plugins/context");
|
13
|
+
|
14
|
+
var _apiMailer = require("@webiny/api-mailer");
|
15
|
+
|
16
|
+
var _apiAdminSettings = require("@webiny/api-admin-settings");
|
17
|
+
|
18
|
+
/**
|
19
|
+
* We have separated context and GraphQL creation so user can initialize only context if required.
|
20
|
+
* GraphQL will not work without context, but context will without GraphQL.
|
21
|
+
*/
|
22
|
+
const createApwHeadlessCmsContext = params => {
|
23
|
+
return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), (0, _context.createApwHeadlessCmsContext)(params)];
|
24
|
+
};
|
25
|
+
|
26
|
+
exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
|
27
|
+
|
28
|
+
const createApwPageBuilderContext = params => {
|
29
|
+
return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), ...(0, _apiMailer.createMailerGraphQL)(), (0, _context.createApwPageBuilderContext)(params)];
|
30
|
+
};
|
31
|
+
|
32
|
+
exports.createApwPageBuilderContext = createApwPageBuilderContext;
|
33
|
+
|
34
|
+
const createApwGraphQL = () => {
|
35
|
+
return [(0, _graphql.default)()];
|
36
|
+
};
|
37
|
+
|
38
|
+
exports.createApwGraphQL = createApwGraphQL;
|
package/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["createApwHeadlessCmsContext","params","createAdminSettingsContext","createMailerContext","createHeadlessCms","createApwPageBuilderContext","createMailerGraphQL","createPageBuilder","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport {\n createApwHeadlessCmsContext as createHeadlessCms,\n createApwPageBuilderContext as createPageBuilder\n} from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwHeadlessCmsContext = (params: CreateApwContextParams) => {\n return [...createAdminSettingsContext(), ...createMailerContext(), createHeadlessCms(params)];\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;;;AAIA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;AACA;AAUO,MAAMA,2BAA2B,GAAIC,MAAD,IAAoC;EAC3E,OAAO,CAAC,GAAG,IAAAC,4CAAA,GAAJ,EAAkC,GAAG,IAAAC,8BAAA,GAArC,EAA4D,IAAAC,oCAAA,EAAkBH,MAAlB,CAA5D,CAAP;AACH,CAFM;;;;AAIA,MAAMI,2BAA2B,GAAIJ,MAAD,IAAoC;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAAA,GADA,EAEH,GAAG,IAAAC,8BAAA,GAFA,EAGH,GAAG,IAAAG,8BAAA,GAHA,EAIH,IAAAC,oCAAA,EAAkBN,MAAlB,CAJG,CAAP;AAMH,CAPM;;;;AASA,MAAMO,gBAAgB,GAAG,MAAM;EAClC,OAAO,CAAC,IAAAC,gBAAA,GAAD,CAAP;AACH,CAFM"}
|