@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,22 +1,15 @@
|
|
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.initializeContentReviewSteps = void 0;
|
9
|
-
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
|
-
|
12
8
|
var _set = _interopRequireDefault(require("lodash/set"));
|
13
|
-
|
9
|
+
var _types = require("../../types");
|
14
10
|
var _utils = require("../utils");
|
15
|
-
|
16
11
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
17
|
-
|
18
12
|
var _contentApwSettingsPlugin = require("../../utils/contentApwSettingsPlugin");
|
19
|
-
|
20
13
|
const initializeContentReviewSteps = ({
|
21
14
|
apw,
|
22
15
|
plugins
|
@@ -32,35 +25,31 @@ const initializeContentReviewSteps = ({
|
|
32
25
|
/*
|
33
26
|
* Let's set "title" field value.
|
34
27
|
*/
|
35
|
-
|
36
28
|
const getContent = apw.getContentGetter(type);
|
37
29
|
const content = await getContent(id, settings);
|
38
|
-
|
39
30
|
if (!content) {
|
40
31
|
throw new _handlerGraphql.NotFoundError(`Content "${type}" with id ${id} not found.`);
|
41
32
|
}
|
42
|
-
|
43
33
|
const {
|
44
34
|
title
|
45
35
|
} = content;
|
46
36
|
input = (0, _set.default)(input, "title", title);
|
37
|
+
|
47
38
|
/**
|
48
39
|
* We need to find a plugin which can get a workflow ID for the given type of content.
|
49
40
|
*/
|
50
|
-
|
51
41
|
const contentApwSettingsPlugin = (0, _contentApwSettingsPlugin.getContentApwSettingsPlugin)({
|
52
42
|
plugins,
|
53
43
|
type
|
54
44
|
});
|
55
45
|
const workflowId = contentApwSettingsPlugin.getWorkflowId(content);
|
46
|
+
|
56
47
|
/**
|
57
48
|
* Let's initialize the "ContentReview" steps.
|
58
49
|
*/
|
59
|
-
|
60
50
|
if (!workflowId) {
|
61
51
|
throw new _handlerGraphql.NotFoundError(`Unable to initiate a "Content review". No workflow found!`);
|
62
52
|
}
|
63
|
-
|
64
53
|
input.workflowId = workflowId;
|
65
54
|
const workflow = await apw.workflow.get(workflowId);
|
66
55
|
const workflowSteps = workflow.steps;
|
@@ -68,19 +57,25 @@ const initializeContentReviewSteps = ({
|
|
68
57
|
const updatedSteps = workflow.steps.map((step, index) => {
|
69
58
|
const status = (0, _utils.getContentReviewStepInitialStatus)(workflowSteps, index, previousStepStatus);
|
70
59
|
previousStepStatus = status;
|
71
|
-
return
|
60
|
+
return {
|
61
|
+
...step,
|
72
62
|
status,
|
73
63
|
pendingChangeRequests: 0,
|
74
64
|
totalComments: 0
|
75
|
-
}
|
65
|
+
};
|
76
66
|
});
|
77
67
|
/**
|
78
|
-
*
|
79
|
-
* There is no steps property on CreateApwContentReviewParams
|
68
|
+
* If there are only steps which are not mandatory ones, put review status to ApwContentReviewStatus.READY_TO_BE_PUBLISHED.
|
80
69
|
*/
|
81
|
-
|
70
|
+
const isNonMandatory = updatedSteps.every(step => {
|
71
|
+
return step.type === _types.ApwWorkflowStepTypes.NON_MANDATORY;
|
72
|
+
});
|
73
|
+
if (isNonMandatory) {
|
74
|
+
input.reviewStatus = _types.ApwContentReviewStatus.READY_TO_BE_PUBLISHED;
|
75
|
+
}
|
82
76
|
input = (0, _set.default)(input, "steps", updatedSteps);
|
83
77
|
});
|
84
78
|
};
|
79
|
+
exports.initializeContentReviewSteps = initializeContentReviewSteps;
|
85
80
|
|
86
|
-
|
81
|
+
//# sourceMappingURL=initializeContentReviewSteps.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["initializeContentReviewSteps","apw","plugins","contentReview","onContentReviewBeforeCreate","subscribe","input","type","id","settings","content","getContent","getContentGetter","NotFoundError","title","lodashSet","contentApwSettingsPlugin","getContentApwSettingsPlugin","workflowId","getWorkflowId","workflow","get","workflowSteps","steps","previousStepStatus","undefined","updatedSteps","map","step","index","status","getContentReviewStepInitialStatus","pendingChangeRequests","totalComments"],"sources":["initializeContentReviewSteps.ts"],"sourcesContent":["import lodashSet from \"lodash/set\";\nimport { ApwContentReviewStepStatus, ApwContext } from \"~/types\";\nimport { getContentReviewStepInitialStatus } from \"~/plugins/utils\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\n\nexport const initializeContentReviewSteps = ({ apw, plugins }: ApwContext) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { type, id, settings } = input.content;\n /*\n * Let's set \"title\" field value.\n */\n const getContent = apw.getContentGetter(type);\n const content = await getContent(id, settings);\n if (!content) {\n throw new NotFoundError(`Content \"${type}\" with id ${id} not found.`);\n }\n\n const { title } = content;\n input = lodashSet(input, \"title\", title);\n\n /**\n * We need to find a plugin which can get a workflow ID for the given type of content.\n */\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type\n });\n\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n\n /**\n * Let's initialize the \"ContentReview\" steps.\n */\n if (!workflowId) {\n throw new NotFoundError(`Unable to initiate a \"Content review\". No workflow found!`);\n }\n\n input.workflowId = workflowId;\n\n const workflow = await apw.workflow.get(workflowId);\n const workflowSteps = workflow.steps;\n\n let previousStepStatus: ApwContentReviewStepStatus | undefined = undefined;\n const updatedSteps = workflow.steps.map((step, index) => {\n const status = getContentReviewStepInitialStatus(\n workflowSteps,\n index,\n previousStepStatus\n );\n previousStepStatus = status;\n return {\n ...step,\n status,\n pendingChangeRequests: 0,\n totalComments: 0\n };\n });\n /**\n *
|
1
|
+
{"version":3,"names":["_set","_interopRequireDefault","require","_types","_utils","_handlerGraphql","_contentApwSettingsPlugin","initializeContentReviewSteps","apw","plugins","contentReview","onContentReviewBeforeCreate","subscribe","input","type","id","settings","content","getContent","getContentGetter","NotFoundError","title","lodashSet","contentApwSettingsPlugin","getContentApwSettingsPlugin","workflowId","getWorkflowId","workflow","get","workflowSteps","steps","previousStepStatus","undefined","updatedSteps","map","step","index","status","getContentReviewStepInitialStatus","pendingChangeRequests","totalComments","isNonMandatory","every","ApwWorkflowStepTypes","NON_MANDATORY","reviewStatus","ApwContentReviewStatus","READY_TO_BE_PUBLISHED","exports"],"sources":["initializeContentReviewSteps.ts"],"sourcesContent":["import lodashSet from \"lodash/set\";\nimport type { ApwContentReviewStepStatus, ApwContext } from \"~/types\";\nimport { ApwContentReviewStatus, ApwWorkflowStepTypes } from \"~/types\";\nimport { getContentReviewStepInitialStatus } from \"~/plugins/utils\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\n\nexport const initializeContentReviewSteps = ({ apw, plugins }: ApwContext) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { type, id, settings } = input.content;\n /*\n * Let's set \"title\" field value.\n */\n const getContent = apw.getContentGetter(type);\n const content = await getContent(id, settings);\n if (!content) {\n throw new NotFoundError(`Content \"${type}\" with id ${id} not found.`);\n }\n\n const { title } = content;\n input = lodashSet(input, \"title\", title);\n\n /**\n * We need to find a plugin which can get a workflow ID for the given type of content.\n */\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type\n });\n\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n\n /**\n * Let's initialize the \"ContentReview\" steps.\n */\n if (!workflowId) {\n throw new NotFoundError(`Unable to initiate a \"Content review\". No workflow found!`);\n }\n\n input.workflowId = workflowId;\n\n const workflow = await apw.workflow.get(workflowId);\n const workflowSteps = workflow.steps;\n\n let previousStepStatus: ApwContentReviewStepStatus | undefined = undefined;\n const updatedSteps = workflow.steps.map((step, index) => {\n const status = getContentReviewStepInitialStatus(\n workflowSteps,\n index,\n previousStepStatus\n );\n previousStepStatus = status;\n return {\n ...step,\n status,\n pendingChangeRequests: 0,\n totalComments: 0\n };\n });\n /**\n * If there are only steps which are not mandatory ones, put review status to ApwContentReviewStatus.READY_TO_BE_PUBLISHED.\n */\n const isNonMandatory = updatedSteps.every(step => {\n return step.type === ApwWorkflowStepTypes.NON_MANDATORY;\n });\n if (isNonMandatory) {\n input.reviewStatus = ApwContentReviewStatus.READY_TO_BE_PUBLISHED;\n }\n\n input = lodashSet(input, \"steps\", updatedSteps);\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAJ,OAAA;AAEO,MAAMK,4BAA4B,GAAGA,CAAC;EAAEC,GAAG;EAAEC;AAAoB,CAAC,KAAK;EAC1ED,GAAG,CAACE,aAAa,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACzE,MAAM;MAAEC,IAAI;MAAEC,EAAE;MAAEC;IAAS,CAAC,GAAGH,KAAK,CAACI,OAAO;IAC5C;AACR;AACA;IACQ,MAAMC,UAAU,GAAGV,GAAG,CAACW,gBAAgB,CAACL,IAAI,CAAC;IAC7C,MAAMG,OAAO,GAAG,MAAMC,UAAU,CAACH,EAAE,EAAEC,QAAQ,CAAC;IAC9C,IAAI,CAACC,OAAO,EAAE;MACV,MAAM,IAAIG,6BAAa,CAAC,YAAYN,IAAI,aAAaC,EAAE,aAAa,CAAC;IACzE;IAEA,MAAM;MAAEM;IAAM,CAAC,GAAGJ,OAAO;IACzBJ,KAAK,GAAG,IAAAS,YAAS,EAACT,KAAK,EAAE,OAAO,EAAEQ,KAAK,CAAC;;IAExC;AACR;AACA;IACQ,MAAME,wBAAwB,GAAG,IAAAC,qDAA2B,EAAC;MACzDf,OAAO;MACPK;IACJ,CAAC,CAAC;IAEF,MAAMW,UAAU,GAAGF,wBAAwB,CAACG,aAAa,CAACT,OAAO,CAAC;;IAElE;AACR;AACA;IACQ,IAAI,CAACQ,UAAU,EAAE;MACb,MAAM,IAAIL,6BAAa,CAAC,2DAA2D,CAAC;IACxF;IAEAP,KAAK,CAACY,UAAU,GAAGA,UAAU;IAE7B,MAAME,QAAQ,GAAG,MAAMnB,GAAG,CAACmB,QAAQ,CAACC,GAAG,CAACH,UAAU,CAAC;IACnD,MAAMI,aAAa,GAAGF,QAAQ,CAACG,KAAK;IAEpC,IAAIC,kBAA0D,GAAGC,SAAS;IAC1E,MAAMC,YAAY,GAAGN,QAAQ,CAACG,KAAK,CAACI,GAAG,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;MACrD,MAAMC,MAAM,GAAG,IAAAC,wCAAiC,EAC5CT,aAAa,EACbO,KAAK,EACLL,kBACJ,CAAC;MACDA,kBAAkB,GAAGM,MAAM;MAC3B,OAAO;QACH,GAAGF,IAAI;QACPE,MAAM;QACNE,qBAAqB,EAAE,CAAC;QACxBC,aAAa,EAAE;MACnB,CAAC;IACL,CAAC,CAAC;IACF;AACR;AACA;IACQ,MAAMC,cAAc,GAAGR,YAAY,CAACS,KAAK,CAACP,IAAI,IAAI;MAC9C,OAAOA,IAAI,CAACrB,IAAI,KAAK6B,2BAAoB,CAACC,aAAa;IAC3D,CAAC,CAAC;IACF,IAAIH,cAAc,EAAE;MAChB5B,KAAK,CAACgC,YAAY,GAAGC,6BAAsB,CAACC,qBAAqB;IACrE;IAEAlC,KAAK,GAAG,IAAAS,YAAS,EAACT,KAAK,EAAE,OAAO,EAAEoB,YAAY,CAAC;EACnD,CAAC,CAAC;AACN,CAAC;AAACe,OAAA,CAAAzC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { ApwContext } from "../../types";
|
1
|
+
import type { ApwContext } from "../../types";
|
2
2
|
export declare const initializeNotifications: (context: ApwContext) => void;
|
@@ -4,17 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.initializeNotifications = void 0;
|
7
|
-
|
8
7
|
var _contentReviewAfterCreate = require("./notifications/contentReviewAfterCreate");
|
9
|
-
|
10
8
|
var _commentAfterCreate = require("./notifications/commentAfterCreate");
|
11
|
-
|
12
9
|
var _changeRequestAfterCreate = require("./notifications/changeRequestAfterCreate");
|
13
|
-
|
14
10
|
const initializeNotifications = context => {
|
15
11
|
(0, _contentReviewAfterCreate.attachContentReviewAfterCreate)(context);
|
16
12
|
(0, _commentAfterCreate.attachCommentAfterCreate)(context);
|
17
13
|
(0, _changeRequestAfterCreate.attachChangeRequestAfterCreate)(context);
|
18
14
|
};
|
15
|
+
exports.initializeNotifications = initializeNotifications;
|
19
16
|
|
20
|
-
|
17
|
+
//# sourceMappingURL=initializeNotifications.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["initializeNotifications","context","attachContentReviewAfterCreate","attachCommentAfterCreate","attachChangeRequestAfterCreate"],"sources":["initializeNotifications.ts"],"sourcesContent":["import { ApwContext } from \"~/types\";\nimport { attachContentReviewAfterCreate } from \"./notifications/contentReviewAfterCreate\";\nimport { attachCommentAfterCreate } from \"./notifications/commentAfterCreate\";\nimport { attachChangeRequestAfterCreate } from \"./notifications/changeRequestAfterCreate\";\n\nexport const initializeNotifications = (context: ApwContext) => {\n attachContentReviewAfterCreate(context);\n attachCommentAfterCreate(context);\n attachChangeRequestAfterCreate(context);\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["_contentReviewAfterCreate","require","_commentAfterCreate","_changeRequestAfterCreate","initializeNotifications","context","attachContentReviewAfterCreate","attachCommentAfterCreate","attachChangeRequestAfterCreate","exports"],"sources":["initializeNotifications.ts"],"sourcesContent":["import type { ApwContext } from \"~/types\";\nimport { attachContentReviewAfterCreate } from \"./notifications/contentReviewAfterCreate\";\nimport { attachCommentAfterCreate } from \"./notifications/commentAfterCreate\";\nimport { attachChangeRequestAfterCreate } from \"./notifications/changeRequestAfterCreate\";\n\nexport const initializeNotifications = (context: ApwContext) => {\n attachContentReviewAfterCreate(context);\n attachCommentAfterCreate(context);\n attachChangeRequestAfterCreate(context);\n};\n"],"mappings":";;;;;;AACA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AAEO,MAAMG,uBAAuB,GAAIC,OAAmB,IAAK;EAC5D,IAAAC,wDAA8B,EAACD,OAAO,CAAC;EACvC,IAAAE,4CAAwB,EAACF,OAAO,CAAC;EACjC,IAAAG,wDAA8B,EAACH,OAAO,CAAC;AAC3C,CAAC;AAACI,OAAA,CAAAL,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { AdvancedPublishingWorkflow } from "../../types";
|
2
|
-
import { HeadlessCms } from "@webiny/api-headless-cms/types";
|
3
|
-
import { Security } from "@webiny/api-security/types";
|
1
|
+
import type { AdvancedPublishingWorkflow } from "../../types";
|
2
|
+
import type { HeadlessCms } from "@webiny/api-headless-cms/types";
|
3
|
+
import type { Security } from "@webiny/api-security/types";
|
4
4
|
interface ListWorkflowsParams {
|
5
5
|
apw: AdvancedPublishingWorkflow;
|
6
6
|
cms: HeadlessCms;
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.listContentReviews = void 0;
|
7
|
-
|
8
7
|
const listContentReviews = ({
|
9
8
|
apw,
|
10
9
|
security
|
@@ -22,19 +21,14 @@ const listContentReviews = ({
|
|
22
21
|
if (where.workflowId_in) {
|
23
22
|
return;
|
24
23
|
}
|
25
|
-
|
26
24
|
const identity = security.getIdentity();
|
27
|
-
|
28
|
-
if (!(identity !== null && identity !== void 0 && identity.id)) {
|
25
|
+
if (!identity?.id) {
|
29
26
|
return;
|
30
27
|
}
|
31
28
|
/**
|
32
29
|
* Find all available workflows.
|
33
30
|
*/
|
34
|
-
|
35
|
-
|
36
31
|
const [workflows] = await apw.workflow.list();
|
37
|
-
|
38
32
|
if (workflows.length === 0) {
|
39
33
|
return;
|
40
34
|
}
|
@@ -42,8 +36,6 @@ const listContentReviews = ({
|
|
42
36
|
* Find all workflows which user has access to.
|
43
37
|
* User access is buried quite deep in the workflow data, so we need to do some traversing.
|
44
38
|
*/
|
45
|
-
|
46
|
-
|
47
39
|
const userWorkflows = workflows.filter(workflow => {
|
48
40
|
return workflow.steps.some(step => {
|
49
41
|
return step.reviewers.some(reviewer => {
|
@@ -51,7 +43,6 @@ const listContentReviews = ({
|
|
51
43
|
});
|
52
44
|
});
|
53
45
|
});
|
54
|
-
|
55
46
|
if (userWorkflows.length === 0) {
|
56
47
|
return;
|
57
48
|
}
|
@@ -59,10 +50,9 @@ const listContentReviews = ({
|
|
59
50
|
* In the end, we need to attach the workflow filter by the entryId.
|
60
51
|
* Just in case we add versioning at some point...
|
61
52
|
*/
|
62
|
-
|
63
|
-
|
64
53
|
where.workflowId_in = userWorkflows.map(workflow => workflow.id);
|
65
54
|
});
|
66
55
|
};
|
56
|
+
exports.listContentReviews = listContentReviews;
|
67
57
|
|
68
|
-
|
58
|
+
//# sourceMappingURL=listContentReviews.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["listContentReviews","apw","security","contentReview","onContentReviewBeforeList","subscribe","where","workflowId_in","identity","getIdentity","id","workflows","workflow","list","length","userWorkflows","filter","steps","some","step","reviewers","reviewer","identityId","map"],"sources":["listContentReviews.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow } from \"~/types\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\n\ninterface ListWorkflowsParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n security: Security;\n}\nexport const listContentReviews = ({ apw, security }: ListWorkflowsParams) => {\n /**\n * We need to hook into listing the content review entries.\n * When listing content review entries, we need to check which ones current user can actually see.\n */\n apw.contentReview.onContentReviewBeforeList.subscribe(async ({ where }) => {\n /**\n * If there is workflowId_in attached on where, we will not change it.\n */\n if (where.workflowId_in) {\n return;\n }\n const identity = security.getIdentity();\n if (!identity?.id) {\n return;\n }\n /**\n * Find all available workflows.\n */\n const [workflows] = await apw.workflow.list();\n if (workflows.length === 0) {\n return;\n }\n /**\n * Find all workflows which user has access to.\n * User access is buried quite deep in the workflow data, so we need to do some traversing.\n */\n const userWorkflows = workflows.filter(workflow => {\n return workflow.steps.some(step => {\n return step.reviewers.some(reviewer => {\n return identity.id === reviewer.identityId;\n });\n });\n });\n if (userWorkflows.length === 0) {\n return;\n }\n /**\n * In the end, we need to attach the workflow filter by the entryId.\n * Just in case we add versioning at some point...\n */\n where.workflowId_in = userWorkflows.map(workflow => workflow.id);\n });\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["listContentReviews","apw","security","contentReview","onContentReviewBeforeList","subscribe","where","workflowId_in","identity","getIdentity","id","workflows","workflow","list","length","userWorkflows","filter","steps","some","step","reviewers","reviewer","identityId","map","exports"],"sources":["listContentReviews.ts"],"sourcesContent":["import type { AdvancedPublishingWorkflow } from \"~/types\";\nimport type { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport type { Security } from \"@webiny/api-security/types\";\n\ninterface ListWorkflowsParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n security: Security;\n}\nexport const listContentReviews = ({ apw, security }: ListWorkflowsParams) => {\n /**\n * We need to hook into listing the content review entries.\n * When listing content review entries, we need to check which ones current user can actually see.\n */\n apw.contentReview.onContentReviewBeforeList.subscribe(async ({ where }) => {\n /**\n * If there is workflowId_in attached on where, we will not change it.\n */\n if (where.workflowId_in) {\n return;\n }\n const identity = security.getIdentity();\n if (!identity?.id) {\n return;\n }\n /**\n * Find all available workflows.\n */\n const [workflows] = await apw.workflow.list();\n if (workflows.length === 0) {\n return;\n }\n /**\n * Find all workflows which user has access to.\n * User access is buried quite deep in the workflow data, so we need to do some traversing.\n */\n const userWorkflows = workflows.filter(workflow => {\n return workflow.steps.some(step => {\n return step.reviewers.some(reviewer => {\n return identity.id === reviewer.identityId;\n });\n });\n });\n if (userWorkflows.length === 0) {\n return;\n }\n /**\n * In the end, we need to attach the workflow filter by the entryId.\n * Just in case we add versioning at some point...\n */\n where.workflowId_in = userWorkflows.map(workflow => workflow.id);\n });\n};\n"],"mappings":";;;;;;AASO,MAAMA,kBAAkB,GAAGA,CAAC;EAAEC,GAAG;EAAEC;AAA8B,CAAC,KAAK;EAC1E;AACJ;AACA;AACA;EACID,GAAG,CAACE,aAAa,CAACC,yBAAyB,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACvE;AACR;AACA;IACQ,IAAIA,KAAK,CAACC,aAAa,EAAE;MACrB;IACJ;IACA,MAAMC,QAAQ,GAAGN,QAAQ,CAACO,WAAW,CAAC,CAAC;IACvC,IAAI,CAACD,QAAQ,EAAEE,EAAE,EAAE;MACf;IACJ;IACA;AACR;AACA;IACQ,MAAM,CAACC,SAAS,CAAC,GAAG,MAAMV,GAAG,CAACW,QAAQ,CAACC,IAAI,CAAC,CAAC;IAC7C,IAAIF,SAAS,CAACG,MAAM,KAAK,CAAC,EAAE;MACxB;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMC,aAAa,GAAGJ,SAAS,CAACK,MAAM,CAACJ,QAAQ,IAAI;MAC/C,OAAOA,QAAQ,CAACK,KAAK,CAACC,IAAI,CAACC,IAAI,IAAI;QAC/B,OAAOA,IAAI,CAACC,SAAS,CAACF,IAAI,CAACG,QAAQ,IAAI;UACnC,OAAOb,QAAQ,CAACE,EAAE,KAAKW,QAAQ,CAACC,UAAU;QAC9C,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC,CAAC;IACF,IAAIP,aAAa,CAACD,MAAM,KAAK,CAAC,EAAE;MAC5B;IACJ;IACA;AACR;AACA;AACA;IACQR,KAAK,CAACC,aAAa,GAAGQ,aAAa,CAACQ,GAAG,CAACX,QAAQ,IAAIA,QAAQ,CAACF,EAAE,CAAC;EACpE,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAxB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { ApwContext } from "../../../types";
|
1
|
+
import type { ApwContext } from "../../../types";
|
2
2
|
export declare const attachChangeRequestAfterCreate: (context: ApwContext) => void;
|
@@ -1,26 +1,17 @@
|
|
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.attachChangeRequestAfterCreate = void 0;
|
9
|
-
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
-
|
12
9
|
var _utils = require("../../utils");
|
13
|
-
|
14
10
|
var _contentUrl = require("./contentUrl");
|
15
|
-
|
16
11
|
var _sendChangeRequestNotification = require("./sendChangeRequestNotification");
|
17
|
-
|
18
12
|
var _reviewers = require("./reviewers");
|
19
|
-
|
20
13
|
var _changeRequestUrl = require("./changeRequestUrl");
|
21
|
-
|
22
|
-
var _appUrl = require("./appUrl");
|
23
|
-
|
14
|
+
var _getAppUrl = require("./getAppUrl");
|
24
15
|
const attachChangeRequestAfterCreate = context => {
|
25
16
|
context.apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({
|
26
17
|
changeRequest
|
@@ -30,40 +21,31 @@ const attachChangeRequestAfterCreate = context => {
|
|
30
21
|
id: contentReviewId,
|
31
22
|
stepId
|
32
23
|
} = (0, _utils.extractContentReviewIdAndStep)(changeRequest.step);
|
33
|
-
|
34
24
|
if (!stepId) {
|
35
25
|
throw new _error.default("Malformed changeRequest.step value.", "MALFORMED_VALUE", {
|
36
26
|
step: changeRequest.step
|
37
27
|
});
|
38
28
|
}
|
39
|
-
|
40
|
-
const settings = await (0, _appUrl.getAppUrl)(context);
|
41
|
-
|
29
|
+
const settings = await (0, _getAppUrl.getAppUrl)(context);
|
42
30
|
if (!settings) {
|
43
31
|
return;
|
44
32
|
}
|
45
33
|
/**
|
46
34
|
* We will check if we can create a comment url before we go digging further into the database.
|
47
35
|
*/
|
48
|
-
|
49
|
-
|
50
36
|
const changeRequestUrl = (0, _changeRequestUrl.createChangeRequestUrl)({
|
51
37
|
baseUrl: settings.appUrl,
|
52
38
|
changeRequestId: changeRequest.id,
|
53
39
|
contentReviewId,
|
54
40
|
stepId
|
55
41
|
});
|
56
|
-
|
57
42
|
if (!changeRequestUrl) {
|
58
43
|
return;
|
59
44
|
}
|
60
45
|
/**
|
61
46
|
* Let's see if content review exists.
|
62
47
|
*/
|
63
|
-
|
64
|
-
|
65
48
|
const contentReview = await context.apw.contentReview.get(contentReviewId);
|
66
|
-
|
67
49
|
if (!contentReview) {
|
68
50
|
throw new _error.default(`There is no contentReview with id "${contentReviewId}".`, "CONTENT_REVIEW_NOT_FOUND", {
|
69
51
|
contentReviewId
|
@@ -72,37 +54,29 @@ const attachChangeRequestAfterCreate = context => {
|
|
72
54
|
/**
|
73
55
|
* We go and check the workflow.
|
74
56
|
*/
|
75
|
-
|
76
|
-
|
77
57
|
const workflow = await context.apw.workflow.get(contentReview.workflowId);
|
78
|
-
|
79
58
|
if (!workflow) {
|
80
59
|
throw new _error.default(`There is no workflow with workflowId "${contentReview.workflowId}".`, "WORKFLOW_NOT_FOUND", {
|
81
60
|
workflowId: contentReview.workflowId
|
82
61
|
});
|
83
62
|
}
|
84
|
-
|
85
63
|
const contentUrl = (0, _contentUrl.createContentUrl)({
|
86
64
|
plugins: context.plugins,
|
87
65
|
baseUrl: settings.appUrl,
|
88
66
|
contentReview,
|
89
67
|
workflow
|
90
68
|
});
|
91
|
-
|
92
69
|
if (!contentUrl) {
|
93
70
|
return;
|
94
71
|
}
|
95
|
-
|
96
72
|
const reviewers = await (0, _reviewers.fetchReviewers)({
|
97
73
|
context,
|
98
74
|
workflow,
|
99
75
|
exclude: [changeRequest.createdBy.id]
|
100
76
|
});
|
101
|
-
|
102
77
|
if (reviewers.length === 0) {
|
103
78
|
return;
|
104
79
|
}
|
105
|
-
|
106
80
|
try {
|
107
81
|
await (0, _sendChangeRequestNotification.sendChangeRequestNotification)({
|
108
82
|
context,
|
@@ -129,16 +103,11 @@ const attachChangeRequestAfterCreate = context => {
|
|
129
103
|
});
|
130
104
|
}
|
131
105
|
};
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
await execute();
|
136
|
-
} catch (ex) {
|
137
|
-
throw ex;
|
138
|
-
} finally {
|
139
|
-
context.security.enableAuthorization();
|
140
|
-
}
|
106
|
+
await context.security.withoutAuthorization(async () => {
|
107
|
+
return execute();
|
108
|
+
});
|
141
109
|
});
|
142
110
|
};
|
111
|
+
exports.attachChangeRequestAfterCreate = attachChangeRequestAfterCreate;
|
143
112
|
|
144
|
-
|
113
|
+
//# sourceMappingURL=changeRequestAfterCreate.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["attachChangeRequestAfterCreate","context","apw","changeRequest","onChangeRequestAfterCreate","subscribe","execute","id","contentReviewId","stepId","extractContentReviewIdAndStep","step","WebinyError","settings","getAppUrl","changeRequestUrl","createChangeRequestUrl","baseUrl","appUrl","changeRequestId","contentReview","get","workflow","workflowId","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","length","sendChangeRequestNotification","ex","error","message","code","data","stack","security","
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_utils","_contentUrl","_sendChangeRequestNotification","_reviewers","_changeRequestUrl","_getAppUrl","attachChangeRequestAfterCreate","context","apw","changeRequest","onChangeRequestAfterCreate","subscribe","execute","id","contentReviewId","stepId","extractContentReviewIdAndStep","step","WebinyError","settings","getAppUrl","changeRequestUrl","createChangeRequestUrl","baseUrl","appUrl","changeRequestId","contentReview","get","workflow","workflowId","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","length","sendChangeRequestNotification","ex","error","message","code","data","stack","security","withoutAuthorization","exports"],"sources":["changeRequestAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { ApwContext } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { sendChangeRequestNotification } from \"./sendChangeRequestNotification\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { createChangeRequestUrl } from \"./changeRequestUrl\";\nimport { getAppUrl } from \"~/plugins/hooks/notifications/getAppUrl\";\n\nexport const attachChangeRequestAfterCreate = (context: ApwContext): void => {\n context.apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({ changeRequest }) => {\n const execute = async () => {\n const { id: contentReviewId, stepId } = extractContentReviewIdAndStep(\n changeRequest.step\n );\n if (!stepId) {\n throw new WebinyError(\"Malformed changeRequest.step value.\", \"MALFORMED_VALUE\", {\n step: changeRequest.step\n });\n }\n\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n /**\n * We will check if we can create a comment url before we go digging further into the database.\n */\n const changeRequestUrl = createChangeRequestUrl({\n baseUrl: settings.appUrl,\n changeRequestId: changeRequest.id,\n contentReviewId,\n stepId\n });\n if (!changeRequestUrl) {\n return;\n }\n /**\n * Let's see if content review exists.\n */\n const contentReview = await context.apw.contentReview.get(contentReviewId);\n if (!contentReview) {\n throw new WebinyError(\n `There is no contentReview with id \"${contentReviewId}\".`,\n \"CONTENT_REVIEW_NOT_FOUND\",\n {\n contentReviewId\n }\n );\n }\n /**\n * We go and check the workflow.\n */\n const workflow = await context.apw.workflow.get(contentReview.workflowId);\n if (!workflow) {\n throw new WebinyError(\n `There is no workflow with workflowId \"${contentReview.workflowId}\".`,\n \"WORKFLOW_NOT_FOUND\",\n {\n workflowId: contentReview.workflowId\n }\n );\n }\n\n const contentUrl = createContentUrl({\n plugins: context.plugins,\n baseUrl: settings.appUrl,\n contentReview,\n workflow\n });\n if (!contentUrl) {\n return;\n }\n\n const reviewers = await fetchReviewers({\n context,\n workflow,\n exclude: [changeRequest.createdBy.id]\n });\n if (reviewers.length === 0) {\n return;\n }\n\n try {\n await sendChangeRequestNotification({\n context,\n reviewers,\n changeRequest,\n contentReview,\n workflow,\n changeRequestUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send change request notifications.`,\n \"CHANGE_REQUEST_NOTIFICATIONS_NOT_SENT\",\n {\n workflowId: workflow.id,\n changeRequestId: changeRequest.id,\n contentReviewId,\n changeRequestUrl,\n contentUrl,\n error: {\n message: ex.message,\n code: ex.code,\n data: ex.data,\n stack: ex.stack\n }\n }\n );\n }\n };\n\n await context.security.withoutAuthorization(async () => {\n return execute();\n });\n });\n};\n"],"mappings":"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","ignoreList":[]}
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createChangeRequestUrl = void 0;
|
7
|
-
|
8
7
|
const createChangeRequestUrl = params => {
|
9
8
|
/**
|
10
9
|
* All variables must exist for URL to be created.
|
@@ -14,11 +13,9 @@ const createChangeRequestUrl = params => {
|
|
14
13
|
if (!!key) {
|
15
14
|
continue;
|
16
15
|
}
|
17
|
-
|
18
16
|
console.log(`Missing variable "${key}", which we use to create a comment URL.`);
|
19
17
|
return null;
|
20
18
|
}
|
21
|
-
|
22
19
|
const {
|
23
20
|
baseUrl,
|
24
21
|
changeRequestId,
|
@@ -27,5 +24,6 @@ const createChangeRequestUrl = params => {
|
|
27
24
|
} = params;
|
28
25
|
return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;
|
29
26
|
};
|
27
|
+
exports.createChangeRequestUrl = createChangeRequestUrl;
|
30
28
|
|
31
|
-
|
29
|
+
//# sourceMappingURL=changeRequestUrl.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createChangeRequestUrl","params","key","console","log","baseUrl","changeRequestId","contentReviewId","stepId"],"sources":["changeRequestUrl.ts"],"sourcesContent":["interface Params {\n baseUrl?: string;\n changeRequestId: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createChangeRequestUrl = (params: Params) => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a comment URL.`);\n return null;\n }\n const { baseUrl, changeRequestId, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["createChangeRequestUrl","params","key","console","log","baseUrl","changeRequestId","contentReviewId","stepId","exports"],"sources":["changeRequestUrl.ts"],"sourcesContent":["interface Params {\n baseUrl?: string;\n changeRequestId: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createChangeRequestUrl = (params: Params) => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a comment URL.`);\n return null;\n }\n const { baseUrl, changeRequestId, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;\n};\n"],"mappings":";;;;;;AAMO,MAAMA,sBAAsB,GAAIC,MAAc,IAAK;EACtD;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAC,qBAAqBF,GAAG,0CAA0C,CAAC;IAC/E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe;IAAEC,eAAe;IAAEC;EAAO,CAAC,GAAGP,MAAM;EAEpE,OAAO,GAAGI,OAAO,wBAAwBE,eAAe,IAAIC,MAAM,IAAIF,eAAe,EAAE;AAC3F,CAAC;AAACG,OAAA,CAAAT,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { ApwContext } from "../../../types";
|
1
|
+
import type { ApwContext } from "../../../types";
|
2
2
|
export declare const attachCommentAfterCreate: (context: ApwContext) => void;
|
@@ -1,68 +1,51 @@
|
|
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.attachCommentAfterCreate = void 0;
|
9
|
-
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
-
|
12
9
|
var _utils = require("../../utils");
|
13
|
-
|
14
10
|
var _contentUrl = require("./contentUrl");
|
15
|
-
|
16
11
|
var _commentUrl = require("./commentUrl");
|
17
|
-
|
18
12
|
var _reviewers = require("./reviewers");
|
19
|
-
|
20
13
|
var _sendCommentNotification = require("./sendCommentNotification");
|
21
|
-
|
22
|
-
var _appUrl = require("./appUrl");
|
23
|
-
|
14
|
+
var _getAppUrl = require("./getAppUrl");
|
24
15
|
const attachCommentAfterCreate = context => {
|
25
16
|
context.apw.comment.onCommentAfterCreate.subscribe(async ({
|
26
17
|
comment
|
27
18
|
}) => {
|
28
19
|
const execute = async () => {
|
29
20
|
const changeRequest = await context.apw.changeRequest.get(comment.changeRequest);
|
30
|
-
|
31
21
|
if (!changeRequest) {
|
32
22
|
throw new _error.default("Missing change request.", "CHANGE_REQUEST_NOT_FOUND", {
|
33
23
|
changeRequest: comment.changeRequest,
|
34
24
|
comment: comment.id
|
35
25
|
});
|
36
26
|
}
|
37
|
-
|
38
27
|
const {
|
39
28
|
id: contentReviewId,
|
40
29
|
stepId
|
41
30
|
} = (0, _utils.extractContentReviewIdAndStep)(changeRequest.step);
|
42
|
-
|
43
31
|
if (!stepId) {
|
44
32
|
throw new _error.default("Malformed changeRequest.step value.", "MALFORMED_VALUE", {
|
45
33
|
step: changeRequest.step
|
46
34
|
});
|
47
35
|
}
|
48
|
-
|
49
|
-
const settings = await (0, _appUrl.getAppUrl)(context);
|
50
|
-
|
36
|
+
const settings = await (0, _getAppUrl.getAppUrl)(context);
|
51
37
|
if (!settings) {
|
52
38
|
return;
|
53
39
|
}
|
54
40
|
/**
|
55
41
|
* We will check if we can create a comment url before we go digging further into the database.
|
56
42
|
*/
|
57
|
-
|
58
|
-
|
59
43
|
const commentUrl = (0, _commentUrl.createCommentUrl)({
|
60
44
|
baseUrl: settings.appUrl,
|
61
45
|
changeRequestId: changeRequest.id,
|
62
46
|
contentReviewId,
|
63
47
|
stepId
|
64
48
|
});
|
65
|
-
|
66
49
|
if (!commentUrl) {
|
67
50
|
console.log("No comment url.");
|
68
51
|
return;
|
@@ -70,10 +53,7 @@ const attachCommentAfterCreate = context => {
|
|
70
53
|
/**
|
71
54
|
* Let's see if content review exists.
|
72
55
|
*/
|
73
|
-
|
74
|
-
|
75
56
|
const contentReview = await context.apw.contentReview.get(contentReviewId);
|
76
|
-
|
77
57
|
if (!contentReview) {
|
78
58
|
throw new _error.default(`There is no contentReview with id "${contentReviewId}".`, "CONTENT_REVIEW_NOT_FOUND", {
|
79
59
|
contentReviewId
|
@@ -82,39 +62,31 @@ const attachCommentAfterCreate = context => {
|
|
82
62
|
/**
|
83
63
|
* We go and check the workflow.
|
84
64
|
*/
|
85
|
-
|
86
|
-
|
87
65
|
const workflow = await context.apw.workflow.get(contentReview.workflowId);
|
88
|
-
|
89
66
|
if (!workflow) {
|
90
67
|
throw new _error.default(`There is no workflow with workflowId "${contentReview.workflowId}".`, "WORKFLOW_NOT_FOUND", {
|
91
68
|
workflowId: contentReview.workflowId
|
92
69
|
});
|
93
70
|
}
|
94
|
-
|
95
71
|
const contentUrl = (0, _contentUrl.createContentUrl)({
|
96
72
|
plugins: context.plugins,
|
97
73
|
baseUrl: settings.appUrl,
|
98
74
|
contentReview,
|
99
75
|
workflow
|
100
76
|
});
|
101
|
-
|
102
77
|
if (!contentUrl) {
|
103
78
|
console.log("No content url.");
|
104
79
|
return;
|
105
80
|
}
|
106
|
-
|
107
81
|
const reviewers = await (0, _reviewers.fetchReviewers)({
|
108
82
|
context,
|
109
83
|
workflow,
|
110
84
|
exclude: [comment.createdBy.id]
|
111
85
|
});
|
112
|
-
|
113
86
|
if (reviewers.length === 0) {
|
114
87
|
console.log("No reviewers to send the e-mail notification to.");
|
115
88
|
return;
|
116
89
|
}
|
117
|
-
|
118
90
|
try {
|
119
91
|
await (0, _sendCommentNotification.sendCommentNotification)({
|
120
92
|
context,
|
@@ -142,16 +114,11 @@ const attachCommentAfterCreate = context => {
|
|
142
114
|
});
|
143
115
|
}
|
144
116
|
};
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
await execute();
|
149
|
-
} catch (ex) {
|
150
|
-
throw ex;
|
151
|
-
} finally {
|
152
|
-
context.security.enableAuthorization();
|
153
|
-
}
|
117
|
+
await context.security.withoutAuthorization(async () => {
|
118
|
+
return execute();
|
119
|
+
});
|
154
120
|
});
|
155
121
|
};
|
122
|
+
exports.attachCommentAfterCreate = attachCommentAfterCreate;
|
156
123
|
|
157
|
-
|
124
|
+
//# sourceMappingURL=commentAfterCreate.js.map
|