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