@webiny/api-apw 0.0.0-unstable.1e66d121db → 0.0.0-unstable.2aaa1916d9
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 +28 -0
- package/ApwChangeRequestNotification.js.map +1 -0
- package/ApwCommentNotification.d.ts +27 -0
- package/ApwCommentNotification.js +28 -0
- package/ApwCommentNotification.js.map +1 -0
- package/ApwContentReviewNotification.d.ts +26 -0
- package/ApwContentReviewNotification.js +28 -0
- package/ApwContentReviewNotification.js.map +1 -0
- package/ApwContentUrlPlugin.d.ts +19 -0
- package/ApwContentUrlPlugin.js +28 -0
- package/ApwContentUrlPlugin.js.map +1 -0
- package/ContentApwSettingsPlugin.d.ts +1 -1
- package/ContentApwSettingsPlugin.js +5 -9
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/README.md +3 -3
- package/crud/createChangeRequestMethods.d.ts +1 -1
- package/crud/createChangeRequestMethods.js +7 -12
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.d.ts +1 -1
- package/crud/createCommentMethods.js +7 -13
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.d.ts +2 -2
- package/crud/createContentReviewMethods.js +84 -113
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.d.ts +1 -1
- package/crud/createReviewerMethods.js +7 -13
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.d.ts +1 -1
- package/crud/createWorkflowMethods.js +7 -18
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.d.ts +1 -1
- package/crud/index.js +5 -29
- package/crud/index.js.map +1 -1
- package/crud/utils.d.ts +2 -2
- package/crud/utils.js +7 -35
- package/crud/utils.js.map +1 -1
- package/index.d.ts +3 -4
- package/index.js +7 -18
- package/index.js.map +1 -1
- package/package.json +32 -50
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +1 -1
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +4 -19
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.d.ts +2 -2
- package/plugins/cms/apwEntryPlugins.js +18 -14
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.d.ts +4 -4
- package/plugins/cms/index.js +7 -10
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.d.ts +2 -2
- package/plugins/cms/linkContentReviewToEntry.js +4 -20
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.d.ts +2 -2
- package/plugins/cms/linkWorkflowToEntry.js +18 -46
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/cms/notifications/changeRequestNotification.js +33 -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 +33 -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 +33 -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 +55 -0
- package/plugins/cms/notifications/contentUrl.js.map +1 -0
- package/plugins/cms/triggerContentReview.d.ts +2 -2
- package/plugins/cms/triggerContentReview.js +5 -18
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.d.ts +3 -3
- package/plugins/cms/updateContentReviewStatus.js +14 -30
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.d.ts +5 -4
- package/plugins/cms/utils.js +20 -59
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.d.ts +3 -4
- package/plugins/context.js +4 -58
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.d.ts +1 -1
- package/plugins/graphql/changeRequest.gql.js +16 -20
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.d.ts +1 -1
- package/plugins/graphql/comment.gql.js +41 -43
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.d.ts +1 -1
- package/plugins/graphql/contentReview.gql.js +25 -35
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.d.ts +1 -1
- package/plugins/graphql/reviewer.gql.js +17 -20
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/utils.d.ts +2 -0
- package/plugins/graphql/utils.js +10 -0
- package/plugins/graphql/utils.js.map +1 -0
- package/plugins/graphql/workflow.gql.d.ts +1 -1
- package/plugins/graphql/workflow.gql.js +15 -20
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.d.ts +1 -1
- package/plugins/graphql.js +5 -18
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.d.ts +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +28 -15
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +3 -9
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +3 -8
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.d.ts +1 -1
- package/plugins/hooks/index.js +4 -13
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.d.ts +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +15 -20
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.d.ts +2 -0
- package/plugins/hooks/initializeNotifications.js +17 -0
- package/plugins/hooks/initializeNotifications.js.map +1 -0
- package/plugins/hooks/listContentReviews.d.ts +4 -4
- package/plugins/hooks/listContentReviews.js +11 -33
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +113 -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 +29 -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 +124 -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 +29 -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 +96 -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 +28 -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 +26 -0
- package/plugins/hooks/notifications/contentUrl.js.map +1 -0
- package/plugins/hooks/notifications/getAppUrl.d.ts +2 -0
- package/plugins/hooks/notifications/getAppUrl.js +19 -0
- package/plugins/hooks/notifications/getAppUrl.js.map +1 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +23 -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 +23 -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 +23 -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 +47 -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 +43 -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 +43 -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 +43 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
- package/plugins/hooks/updatePendingChangeRequests.d.ts +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js +7 -13
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.d.ts +1 -1
- package/plugins/hooks/updateTotalComments.js +21 -23
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.d.ts +1 -1
- package/plugins/hooks/validateChangeRequest.js +27 -16
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.d.ts +1 -1
- package/plugins/hooks/validateComment.js +13 -12
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.d.ts +1 -1
- package/plugins/hooks/validateContentReview.js +2 -6
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/utils.d.ts +7 -7
- package/plugins/utils.js +12 -57
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.d.ts +1 -1
- package/scheduler/createScheduleActionMethods.js +105 -85
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +2 -2
- package/scheduler/handlers/executeAction/index.js +47 -41
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +19 -9
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +3 -3
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +11 -28
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +4 -3
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +10 -92
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.d.ts +2 -2
- package/scheduler/handlers/executeAction/security.js +2 -11
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +2 -2
- package/scheduler/handlers/scheduleAction/index.js +23 -38
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +3 -3
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +20 -36
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.d.ts +2 -4
- package/scheduler/handlers/utils.js +22 -53
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.d.ts +1 -1
- package/scheduler/index.js +2 -3
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.d.ts +20 -36
- package/scheduler/types.js +11 -23
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.d.ts +2 -2
- package/storageOperations/changeRequestStorageOperations.js +43 -41
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.d.ts +3 -3
- package/storageOperations/commentStorageOperations.js +16 -44
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.d.ts +3 -3
- package/storageOperations/contentReviewStorageOperations.js +19 -41
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.d.ts +3 -9
- package/storageOperations/index.js +10 -29
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.d.ts +1 -2
- package/storageOperations/models/changeRequest.model.js +9 -19
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.d.ts +1 -2
- package/storageOperations/models/comment.model.js +9 -18
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentReview.model.d.ts +1 -2
- package/storageOperations/models/contentReview.model.js +16 -41
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.d.ts +1 -1
- package/storageOperations/models/index.js +11 -55
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.d.ts +1 -2
- package/storageOperations/models/reviewer.model.js +25 -18
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.d.ts +2 -2
- package/storageOperations/models/utils.js +2 -4
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.d.ts +2 -3
- package/storageOperations/models/workflow.model.js +22 -46
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.d.ts +3 -3
- package/storageOperations/reviewerStorageOperations.js +19 -38
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/types.d.ts +2 -2
- package/storageOperations/types.js +3 -1
- package/storageOperations/types.js.map +1 -1
- package/storageOperations/workflowStorageOperations.d.ts +2 -2
- package/storageOperations/workflowStorageOperations.js +24 -44
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +66 -69
- package/types.js +121 -43
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.d.ts +2 -2
- package/utils/contentApwSettingsPlugin.js +2 -6
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js +2 -17
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.d.ts +2 -2
- package/utils/fieldResolver.js +8 -18
- package/utils/fieldResolver.js.map +1 -1
- package/utils/pickEntryFieldValues.d.ts +3 -0
- package/utils/pickEntryFieldValues.js +30 -0
- package/utils/pickEntryFieldValues.js.map +1 -0
- package/utils/resolve.d.ts +1 -1
- package/utils/resolve.js +2 -3
- package/utils/resolve.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +0 -9
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -51
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +0 -1
- package/plugins/pageBuilder/apwContentPagePlugins.d.ts +0 -3
- package/plugins/pageBuilder/apwContentPagePlugins.js +0 -30
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +0 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +0 -3
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +0 -25
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +0 -1
- package/plugins/pageBuilder/index.d.ts +0 -11
- package/plugins/pageBuilder/index.js +0 -45
- package/plugins/pageBuilder/index.js.map +0 -1
- package/plugins/pageBuilder/linkContentReviewToPage.d.ts +0 -8
- package/plugins/pageBuilder/linkContentReviewToPage.js +0 -105
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +0 -1
- package/plugins/pageBuilder/linkWorkflowToPage.d.ts +0 -8
- package/plugins/pageBuilder/linkWorkflowToPage.js +0 -194
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +0 -1
- package/plugins/pageBuilder/triggerContentReview.d.ts +0 -8
- package/plugins/pageBuilder/triggerContentReview.js +0 -50
- package/plugins/pageBuilder/triggerContentReview.js.map +0 -1
- package/plugins/pageBuilder/updateContentReviewStatus.d.ts +0 -10
- package/plugins/pageBuilder/updateContentReviewStatus.js +0 -79
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +0 -1
- package/plugins/pageBuilder/utils.d.ts +0 -22
- package/plugins/pageBuilder/utils.js +0 -184
- package/plugins/pageBuilder/utils.js.map +0 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +0 -15
- package/storageOperations/models/contentModelPluginFactory.js +0 -28
- package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -1,32 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.createContentReviewMethods = createContentReviewMethods;
|
9
|
-
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
|
-
|
12
|
-
var _get = _interopRequireDefault(require("lodash/get"));
|
13
|
-
|
14
8
|
var _pubsub = require("@webiny/pubsub");
|
15
|
-
|
16
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
17
|
-
|
18
10
|
var _types = require("../types");
|
19
|
-
|
20
11
|
var _utils = require("../plugins/utils");
|
21
|
-
|
22
12
|
var _errors = require("../utils/errors");
|
23
|
-
|
24
13
|
var _types2 = require("../scheduler/types");
|
25
|
-
|
26
14
|
var _utils2 = require("./utils");
|
27
|
-
|
28
15
|
var _contentApwSettingsPlugin = require("../utils/contentApwSettingsPlugin");
|
29
|
-
|
30
16
|
function createContentReviewMethods(params) {
|
31
17
|
const {
|
32
18
|
getIdentity,
|
@@ -40,16 +26,19 @@ function createContentReviewMethods(params) {
|
|
40
26
|
getTenant,
|
41
27
|
getLocale,
|
42
28
|
plugins
|
43
|
-
} = params;
|
29
|
+
} = params;
|
44
30
|
|
31
|
+
// create
|
45
32
|
const onContentReviewBeforeCreate = (0, _pubsub.createTopic)("apw.onContentReviewBeforeCreate");
|
46
|
-
const onContentReviewAfterCreate = (0, _pubsub.createTopic)("apw.onContentReviewAfterCreate");
|
47
|
-
|
33
|
+
const onContentReviewAfterCreate = (0, _pubsub.createTopic)("apw.onContentReviewAfterCreate");
|
34
|
+
// update
|
48
35
|
const onContentReviewBeforeUpdate = (0, _pubsub.createTopic)("apw.onContentReviewBeforeUpdate");
|
49
|
-
const onContentReviewAfterUpdate = (0, _pubsub.createTopic)("apw.onContentReviewAfterUpdate");
|
50
|
-
|
36
|
+
const onContentReviewAfterUpdate = (0, _pubsub.createTopic)("apw.onContentReviewAfterUpdate");
|
37
|
+
// delete
|
51
38
|
const onContentReviewBeforeDelete = (0, _pubsub.createTopic)("apw.onContentReviewBeforeDelete");
|
52
39
|
const onContentReviewAfterDelete = (0, _pubsub.createTopic)("apw.onContentReviewAfterDelete");
|
40
|
+
// list
|
41
|
+
const onContentReviewBeforeList = (0, _pubsub.createTopic)("apw.onContentReviewBeforeList");
|
53
42
|
return {
|
54
43
|
/**
|
55
44
|
* Lifecycle events
|
@@ -60,32 +49,38 @@ function createContentReviewMethods(params) {
|
|
60
49
|
onContentReviewAfterUpdate,
|
61
50
|
onContentReviewBeforeDelete,
|
62
51
|
onContentReviewAfterDelete,
|
63
|
-
|
52
|
+
onContentReviewBeforeList,
|
64
53
|
async get(id) {
|
65
54
|
return storageOperations.getContentReview({
|
66
55
|
id
|
67
56
|
});
|
68
57
|
},
|
69
|
-
|
70
58
|
async list(params) {
|
71
|
-
|
72
|
-
|
73
|
-
|
59
|
+
const where = params.where || {};
|
60
|
+
await onContentReviewBeforeList.publish({
|
61
|
+
where
|
62
|
+
});
|
63
|
+
if (where.reviewStatus === "requiresMyAttention") {
|
74
64
|
return (0, _utils2.filterContentReviewsByRequiresMyAttention)({
|
75
|
-
listParams:
|
65
|
+
listParams: {
|
66
|
+
...params,
|
67
|
+
where
|
68
|
+
},
|
76
69
|
listContentReviews: storageOperations.listContentReviews,
|
77
70
|
getReviewer,
|
78
71
|
getIdentity
|
79
72
|
});
|
80
73
|
}
|
81
|
-
|
82
|
-
|
74
|
+
return storageOperations.listContentReviews({
|
75
|
+
...params,
|
76
|
+
where
|
77
|
+
});
|
83
78
|
},
|
84
|
-
|
85
79
|
async create(data) {
|
86
|
-
const input =
|
80
|
+
const input = {
|
81
|
+
...data,
|
87
82
|
reviewStatus: _types.ApwContentReviewStatus.UNDER_REVIEW
|
88
|
-
}
|
83
|
+
};
|
89
84
|
await onContentReviewBeforeCreate.publish({
|
90
85
|
input
|
91
86
|
});
|
@@ -97,7 +92,6 @@ function createContentReviewMethods(params) {
|
|
97
92
|
});
|
98
93
|
return contentReview;
|
99
94
|
},
|
100
|
-
|
101
95
|
async update(id, data) {
|
102
96
|
const original = await storageOperations.getContentReview({
|
103
97
|
id
|
@@ -123,7 +117,6 @@ function createContentReviewMethods(params) {
|
|
123
117
|
});
|
124
118
|
return contentReview;
|
125
119
|
},
|
126
|
-
|
127
120
|
async delete(id) {
|
128
121
|
const contentReview = await storageOperations.getContentReview({
|
129
122
|
id
|
@@ -139,7 +132,6 @@ function createContentReviewMethods(params) {
|
|
139
132
|
});
|
140
133
|
return true;
|
141
134
|
},
|
142
|
-
|
143
135
|
async provideSignOff(id, stepId) {
|
144
136
|
const entry = await this.get(id);
|
145
137
|
const {
|
@@ -155,10 +147,10 @@ function createContentReviewMethods(params) {
|
|
155
147
|
identity,
|
156
148
|
step: currentStep
|
157
149
|
});
|
150
|
+
|
158
151
|
/**
|
159
152
|
* Check whether the sign-off is requested by a reviewer.
|
160
153
|
*/
|
161
|
-
|
162
154
|
if (!hasPermission) {
|
163
155
|
throw new _errors.NotAuthorizedError({
|
164
156
|
entry,
|
@@ -171,8 +163,6 @@ function createContentReviewMethods(params) {
|
|
171
163
|
/**
|
172
164
|
* Don't allow sign off, if previous step is of "mandatory_blocking" type and undone.
|
173
165
|
*/
|
174
|
-
|
175
|
-
|
176
166
|
if (previousStep && previousStep.status !== _types.ApwContentReviewStepStatus.DONE && previousStep.type === _types.ApwWorkflowStepTypes.MANDATORY_BLOCKING) {
|
177
167
|
throw new _errors.StepMissingError({
|
178
168
|
entry,
|
@@ -185,8 +175,6 @@ function createContentReviewMethods(params) {
|
|
185
175
|
/**
|
186
176
|
* Don't allow sign off, if there are pending change requests.
|
187
177
|
*/
|
188
|
-
|
189
|
-
|
190
178
|
if (currentStep.pendingChangeRequests > 0) {
|
191
179
|
throw new _errors.PendingChangeRequestsError({
|
192
180
|
entry,
|
@@ -199,8 +187,6 @@ function createContentReviewMethods(params) {
|
|
199
187
|
/**
|
200
188
|
* Don't allow sign off, if current step is not in "active" state.
|
201
189
|
*/
|
202
|
-
|
203
|
-
|
204
190
|
if (currentStep.status !== _types.ApwContentReviewStepStatus.ACTIVE) {
|
205
191
|
throw new _errors.StepInActiveError({
|
206
192
|
entry,
|
@@ -210,67 +196,62 @@ function createContentReviewMethods(params) {
|
|
210
196
|
}
|
211
197
|
});
|
212
198
|
}
|
213
|
-
|
214
199
|
let previousStepStatus;
|
215
200
|
/*
|
216
201
|
* Provide sign-off for give step.
|
217
202
|
*/
|
218
|
-
|
219
203
|
const updatedSteps = steps.map((step, index) => {
|
220
204
|
if (index === stepIndex) {
|
221
205
|
previousStepStatus = _types.ApwContentReviewStepStatus.DONE;
|
222
|
-
return
|
206
|
+
return {
|
207
|
+
...step,
|
223
208
|
status: _types.ApwContentReviewStepStatus.DONE,
|
224
209
|
signOffProvidedOn: new Date().toISOString(),
|
225
210
|
signOffProvidedBy: identity
|
226
|
-
}
|
211
|
+
};
|
227
212
|
}
|
228
213
|
/**
|
229
214
|
* Update next steps status based on type.
|
230
215
|
*/
|
231
|
-
|
232
|
-
|
233
216
|
if (index > stepIndex) {
|
234
217
|
const previousStep = steps[index - 1];
|
235
218
|
previousStepStatus = (0, _utils.getNextStepStatus)(previousStep.type, previousStepStatus);
|
236
|
-
return
|
219
|
+
return {
|
220
|
+
...step,
|
237
221
|
status: previousStepStatus
|
238
|
-
}
|
222
|
+
};
|
239
223
|
}
|
240
|
-
|
241
224
|
return step;
|
242
225
|
});
|
243
226
|
/**
|
244
227
|
* Check for pending steps
|
245
228
|
*/
|
246
|
-
|
247
229
|
let newStatus = reviewStatus;
|
248
230
|
const pendingRequiredSteps = (0, _utils2.getPendingRequiredSteps)(updatedSteps, step => typeof step.signOffProvidedOn !== "string");
|
231
|
+
|
249
232
|
/**
|
250
233
|
* If there are no required steps that are pending, set the status to "READY_TO_BE_PUBLISHED".
|
251
234
|
*/
|
252
|
-
|
253
235
|
if (pendingRequiredSteps.length === 0) {
|
254
236
|
newStatus = _types.ApwContentReviewStatus.READY_TO_BE_PUBLISHED;
|
255
237
|
}
|
238
|
+
|
256
239
|
/**
|
257
240
|
* Save updated steps.
|
258
241
|
*/
|
259
|
-
|
260
|
-
|
261
242
|
await this.update(id, {
|
262
243
|
steps: updatedSteps,
|
263
244
|
reviewStatus: newStatus
|
264
245
|
});
|
265
246
|
return true;
|
266
247
|
},
|
267
|
-
|
268
248
|
async retractSignOff(id, stepId) {
|
269
|
-
const
|
249
|
+
const contentReview = await this.get(id);
|
270
250
|
const {
|
271
251
|
steps,
|
272
|
-
reviewStatus
|
273
|
-
|
252
|
+
reviewStatus,
|
253
|
+
content
|
254
|
+
} = contentReview;
|
274
255
|
const stepIndex = steps.findIndex(step => step.id === stepId);
|
275
256
|
const currentStep = steps[stepIndex];
|
276
257
|
const identity = getIdentity();
|
@@ -279,13 +260,13 @@ function createContentReviewMethods(params) {
|
|
279
260
|
identity,
|
280
261
|
step: currentStep
|
281
262
|
});
|
263
|
+
|
282
264
|
/**
|
283
265
|
* Check whether the retract sign-off is requested by a reviewer.
|
284
266
|
*/
|
285
|
-
|
286
267
|
if (!hasPermission) {
|
287
268
|
throw new _errors.NotAuthorizedError({
|
288
|
-
entry,
|
269
|
+
entry: contentReview,
|
289
270
|
input: {
|
290
271
|
id,
|
291
272
|
step: stepId
|
@@ -295,68 +276,75 @@ function createContentReviewMethods(params) {
|
|
295
276
|
/**
|
296
277
|
* Don't allow, if step in not "done" i.e. no sign-off was provided for it.
|
297
278
|
*/
|
298
|
-
|
299
|
-
|
300
279
|
if (currentStep.status !== _types.ApwContentReviewStepStatus.DONE) {
|
301
280
|
throw new _errors.NoSignOffProvidedError({
|
302
|
-
entry,
|
281
|
+
entry: contentReview,
|
303
282
|
input: {
|
304
283
|
id,
|
305
284
|
step: stepId
|
306
285
|
}
|
307
286
|
});
|
308
287
|
}
|
309
|
-
|
310
288
|
let previousStepStatus;
|
289
|
+
|
311
290
|
/*
|
312
291
|
* Retract sign-off for give step.
|
313
292
|
*/
|
314
|
-
|
315
293
|
const updatedSteps = steps.map((step, index) => {
|
316
294
|
if (index === stepIndex) {
|
317
295
|
previousStepStatus = _types.ApwContentReviewStepStatus.ACTIVE;
|
318
|
-
return
|
296
|
+
return {
|
297
|
+
...step,
|
319
298
|
status: previousStepStatus,
|
320
299
|
signOffProvidedOn: null,
|
321
300
|
signOffProvidedBy: null
|
322
|
-
}
|
301
|
+
};
|
323
302
|
}
|
324
303
|
/**
|
325
304
|
* Set next step status as "inactive".
|
326
305
|
*/
|
327
|
-
|
328
|
-
|
329
306
|
if (index > stepIndex) {
|
330
307
|
const previousStep = steps[index - 1];
|
331
308
|
previousStepStatus = (0, _utils.getNextStepStatus)(previousStep.type, previousStepStatus);
|
332
|
-
return
|
309
|
+
return {
|
310
|
+
...step,
|
333
311
|
status: previousStepStatus
|
334
|
-
}
|
312
|
+
};
|
335
313
|
}
|
336
|
-
|
337
314
|
return step;
|
338
315
|
});
|
316
|
+
|
339
317
|
/**
|
340
318
|
* Check for pending steps
|
341
319
|
*/
|
342
|
-
|
343
320
|
let newStatus = reviewStatus;
|
344
321
|
const pendingRequiredSteps = (0, _utils2.getPendingRequiredSteps)(updatedSteps, step => step.signOffProvidedOn === null);
|
345
322
|
/**
|
346
323
|
* If there are required steps that are pending, set the status to "UNDER_REVIEW".
|
347
324
|
*/
|
348
|
-
|
349
325
|
if (pendingRequiredSteps.length !== 0) {
|
350
326
|
newStatus = _types.ApwContentReviewStatus.UNDER_REVIEW;
|
351
327
|
}
|
352
328
|
|
329
|
+
/**
|
330
|
+
* We need to delete the scheduled action if one was created.
|
331
|
+
*/
|
332
|
+
const scheduledActionId = contentReview.content?.scheduledActionId;
|
333
|
+
if (!!scheduledActionId) {
|
334
|
+
await scheduler.delete(scheduledActionId);
|
335
|
+
}
|
353
336
|
await this.update(id, {
|
337
|
+
content: {
|
338
|
+
...content,
|
339
|
+
scheduledOn: null,
|
340
|
+
scheduledBy: null,
|
341
|
+
scheduledActionId: null
|
342
|
+
},
|
354
343
|
steps: updatedSteps,
|
355
344
|
reviewStatus: newStatus
|
356
345
|
});
|
357
346
|
return true;
|
358
347
|
},
|
359
|
-
|
360
348
|
async isReviewRequired(data) {
|
361
349
|
const contentGetter = getContentGetter(data.type);
|
362
350
|
const content = await contentGetter(data.id, data.settings);
|
@@ -366,31 +354,24 @@ function createContentReviewMethods(params) {
|
|
366
354
|
plugins,
|
367
355
|
type: data.type
|
368
356
|
});
|
369
|
-
|
370
357
|
if (contentApwSettingsPlugin) {
|
371
358
|
contentReviewId = contentApwSettingsPlugin.getContentReviewId(content);
|
372
359
|
const workflowId = contentApwSettingsPlugin.getWorkflowId(content);
|
373
|
-
|
374
360
|
if (workflowId) {
|
375
361
|
isReviewRequired = true;
|
376
362
|
}
|
377
363
|
}
|
378
|
-
|
379
364
|
return {
|
380
365
|
isReviewRequired,
|
381
366
|
contentReviewId
|
382
367
|
};
|
383
368
|
},
|
384
|
-
|
385
369
|
async publishContent(id, datetime) {
|
386
|
-
var _content$settings;
|
387
|
-
|
388
370
|
const {
|
389
371
|
content,
|
390
372
|
reviewStatus
|
391
373
|
} = await this.get(id);
|
392
374
|
const identity = getIdentity();
|
393
|
-
|
394
375
|
if (reviewStatus !== _types.ApwContentReviewStatus.READY_TO_BE_PUBLISHED) {
|
395
376
|
throw new _error.default({
|
396
377
|
message: `Cannot publish content because it is not yet ready to be published.`,
|
@@ -402,50 +383,44 @@ function createContentReviewMethods(params) {
|
|
402
383
|
}
|
403
384
|
});
|
404
385
|
}
|
405
|
-
|
406
386
|
(0, _utils2.checkValidDateTime)(datetime);
|
387
|
+
|
407
388
|
/**
|
408
389
|
* If datetime is present it means we're scheduling this action.
|
409
390
|
* And if not, we are publishing immediately.
|
410
391
|
*/
|
411
|
-
|
412
392
|
if (!datetime) {
|
413
393
|
const contentPublisher = getContentPublisher(content.type);
|
414
394
|
await contentPublisher(content.id, content.settings);
|
415
395
|
return true;
|
416
396
|
}
|
417
|
-
|
418
397
|
const data = {
|
419
398
|
action: _types2.ApwScheduleActionTypes.PUBLISH,
|
420
399
|
type: content.type,
|
421
400
|
entryId: content.id,
|
422
|
-
modelId:
|
401
|
+
modelId: content.settings?.modelId,
|
423
402
|
datetime
|
424
403
|
};
|
425
404
|
const scheduledActionId = await this.scheduleAction(data);
|
426
405
|
/**
|
427
406
|
* Update scheduled related meta data.
|
428
407
|
*/
|
429
|
-
|
430
408
|
await this.update(id, {
|
431
|
-
content:
|
409
|
+
content: {
|
410
|
+
...content,
|
432
411
|
scheduledOn: datetime,
|
433
412
|
scheduledBy: identity.id,
|
434
413
|
scheduledActionId
|
435
|
-
}
|
414
|
+
}
|
436
415
|
});
|
437
416
|
return true;
|
438
417
|
},
|
439
|
-
|
440
418
|
async unpublishContent(id, datetime) {
|
441
|
-
var _content$settings2;
|
442
|
-
|
443
419
|
const {
|
444
420
|
content,
|
445
421
|
reviewStatus
|
446
422
|
} = await this.get(id);
|
447
423
|
const identity = getIdentity();
|
448
|
-
|
449
424
|
if (reviewStatus !== _types.ApwContentReviewStatus.PUBLISHED) {
|
450
425
|
throw new _error.default({
|
451
426
|
message: `Cannot unpublish content because it is not yet published.`,
|
@@ -457,40 +432,37 @@ function createContentReviewMethods(params) {
|
|
457
432
|
}
|
458
433
|
});
|
459
434
|
}
|
460
|
-
|
461
435
|
(0, _utils2.checkValidDateTime)(datetime);
|
436
|
+
|
462
437
|
/**
|
463
438
|
* If datetime is present it means we're scheduling this action.
|
464
439
|
* If not, we are unpublishing immediately.
|
465
440
|
*/
|
466
|
-
|
467
441
|
if (!datetime) {
|
468
442
|
const contentUnPublisher = getContentUnPublisher(content.type);
|
469
443
|
await contentUnPublisher(content.id, content.settings);
|
470
444
|
return true;
|
471
445
|
}
|
472
|
-
|
473
446
|
const scheduledActionId = await this.scheduleAction({
|
474
447
|
action: _types2.ApwScheduleActionTypes.UNPUBLISH,
|
475
448
|
type: content.type,
|
476
449
|
entryId: content.id,
|
477
|
-
modelId:
|
450
|
+
modelId: content.settings?.modelId,
|
478
451
|
datetime
|
479
452
|
});
|
480
453
|
/**
|
481
454
|
* Update scheduled related meta data.
|
482
455
|
*/
|
483
|
-
|
484
456
|
await this.update(id, {
|
485
|
-
content:
|
457
|
+
content: {
|
458
|
+
...content,
|
486
459
|
scheduledOn: datetime,
|
487
460
|
scheduledBy: identity.id,
|
488
461
|
scheduledActionId
|
489
|
-
}
|
462
|
+
}
|
490
463
|
});
|
491
464
|
return true;
|
492
465
|
},
|
493
|
-
|
494
466
|
async scheduleAction(data) {
|
495
467
|
// Save input in DB
|
496
468
|
const scheduledAction = await scheduler.create(data);
|
@@ -498,12 +470,10 @@ function createContentReviewMethods(params) {
|
|
498
470
|
* This function contains logic of lambda invocation.
|
499
471
|
* Current we're not mocking it, therefore, we're just returning true.
|
500
472
|
*/
|
501
|
-
|
502
473
|
if (process.env.NODE_ENV === "test") {
|
503
474
|
return scheduledAction.id;
|
504
|
-
}
|
505
|
-
|
506
|
-
|
475
|
+
}
|
476
|
+
// Invoke handler
|
507
477
|
await handlerClient.invoke({
|
508
478
|
name: String(process.env.APW_SCHEDULER_SCHEDULE_ACTION_HANDLER),
|
509
479
|
payload: {
|
@@ -515,14 +485,13 @@ function createContentReviewMethods(params) {
|
|
515
485
|
});
|
516
486
|
return scheduledAction.id;
|
517
487
|
},
|
518
|
-
|
519
488
|
async deleteScheduledAction(id) {
|
520
489
|
const contentReview = await this.get(id);
|
521
|
-
const scheduledActionId =
|
490
|
+
const scheduledActionId = contentReview.content?.scheduledActionId;
|
491
|
+
|
522
492
|
/**
|
523
493
|
* Check if there is any action scheduled for this "content review".
|
524
494
|
*/
|
525
|
-
|
526
495
|
if (!scheduledActionId) {
|
527
496
|
throw new _error.default({
|
528
497
|
message: `There is no action scheduled for content review.`,
|
@@ -535,18 +504,20 @@ function createContentReviewMethods(params) {
|
|
535
504
|
/**
|
536
505
|
* Delete scheduled action.
|
537
506
|
*/
|
538
|
-
|
539
|
-
|
540
507
|
await scheduler.delete(scheduledActionId);
|
508
|
+
|
541
509
|
/**
|
542
510
|
* Reset scheduled related meta data.
|
543
511
|
*/
|
544
|
-
|
545
512
|
await this.update(id, {
|
546
|
-
content:
|
513
|
+
content: {
|
514
|
+
...contentReview.content,
|
515
|
+
..._utils2.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META
|
516
|
+
}
|
547
517
|
});
|
548
518
|
return true;
|
549
519
|
}
|
550
|
-
|
551
520
|
};
|
552
|
-
}
|
521
|
+
}
|
522
|
+
|
523
|
+
//# sourceMappingURL=createContentReviewMethods.js.map
|