@webiny/api-apw 0.0.0-unstable.5e7233243f → 0.0.0-unstable.6e5425ee89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ApwChangeRequestNotification.d.ts +27 -0
- package/ApwChangeRequestNotification.js +30 -0
- package/ApwChangeRequestNotification.js.map +1 -0
- package/ApwCommentNotification.d.ts +27 -0
- package/ApwCommentNotification.js +30 -0
- package/ApwCommentNotification.js.map +1 -0
- package/ApwContentReviewNotification.d.ts +26 -0
- package/ApwContentReviewNotification.js +30 -0
- package/ApwContentReviewNotification.js.map +1 -0
- package/ApwContentUrlPlugin.d.ts +19 -0
- package/ApwContentUrlPlugin.js +30 -0
- package/ApwContentUrlPlugin.js.map +1 -0
- package/ContentApwSettingsPlugin.js +1 -6
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/crud/createChangeRequestMethods.js +21 -25
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.js +21 -26
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.js +71 -125
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.js +21 -26
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.d.ts +1 -1
- package/crud/createWorkflowMethods.js +37 -28
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.js +3 -32
- package/crud/index.js.map +1 -1
- package/crud/utils.js +4 -36
- package/crud/utils.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +7 -13
- package/index.js.map +1 -1
- package/package.json +38 -37
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +1 -16
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.js +4 -16
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.js +5 -10
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js +4 -21
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js +7 -36
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/cms/notifications/changeRequestNotification.js +31 -0
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/cms/notifications/commentNotification.d.ts +1 -0
- package/plugins/cms/notifications/commentNotification.js +31 -0
- package/plugins/cms/notifications/commentNotification.js.map +1 -0
- package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/cms/notifications/contentReviewNotification.js +31 -0
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/cms/notifications/contentUrl.d.ts +8 -0
- package/plugins/cms/notifications/contentUrl.js +53 -0
- package/plugins/cms/notifications/contentUrl.js.map +1 -0
- package/plugins/cms/triggerContentReview.js +3 -17
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js +10 -32
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.js +6 -55
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.js +1 -32
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +2 -9
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +2 -9
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +5 -24
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +4 -9
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +2 -9
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js +2 -17
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +26 -15
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +2 -10
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +2 -9
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.js +4 -12
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +7 -23
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.d.ts +2 -0
- package/plugins/hooks/initializeNotifications.js +15 -0
- package/plugins/hooks/initializeNotifications.js.map +1 -0
- package/plugins/hooks/listContentReviews.d.ts +10 -0
- package/plugins/hooks/listContentReviews.js +56 -0
- package/plugins/hooks/listContentReviews.js.map +1 -0
- package/plugins/hooks/notifications/appUrl.d.ts +2 -0
- package/plugins/hooks/notifications/appUrl.js +18 -0
- package/plugins/hooks/notifications/appUrl.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +116 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
- package/plugins/hooks/notifications/changeRequestUrl.js +27 -0
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
- package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/commentAfterCreate.js +127 -0
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
- package/plugins/hooks/notifications/commentUrl.js +27 -0
- package/plugins/hooks/notifications/commentUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +99 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentReviewUrl.js +26 -0
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentUrl.js +24 -0
- package/plugins/hooks/notifications/contentUrl.js.map +1 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +21 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +21 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +21 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/reviewers.d.ts +15 -0
- package/plugins/hooks/notifications/reviewers.js +44 -0
- package/plugins/hooks/notifications/reviewers.js.map +1 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +41 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendCommentNotification.js +41 -0
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js +41 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
- package/plugins/hooks/updatePendingChangeRequests.js +7 -19
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js +14 -27
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.js +27 -18
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js +13 -14
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.js +2 -8
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +1 -16
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js +0 -4
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +1 -6
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
- package/plugins/pageBuilder/index.js +5 -8
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js +38 -42
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js +14 -32
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +31 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.js +31 -0
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +31 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.js +47 -0
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
- package/plugins/pageBuilder/triggerContentReview.js +3 -14
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js +10 -26
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.js +2 -36
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.d.ts +1 -1
- package/plugins/utils.js +4 -57
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +17 -33
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.js +9 -33
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +1 -6
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +1 -22
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +5 -28
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.js +0 -11
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.js +13 -34
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +7 -32
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.js +4 -41
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.js +0 -3
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.js +0 -6
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js +5 -28
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +4 -29
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.js +5 -26
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.js +5 -23
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.js +0 -9
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.js +0 -8
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.js +3 -12
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
- package/storageOperations/models/contentReview.model.js +6 -31
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +3 -25
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.js +17 -9
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js +3 -6
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.js +0 -23
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js +16 -29
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +6 -31
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +99 -84
- package/types.js +0 -14
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.js +0 -6
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js +1 -18
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.js +5 -21
- package/utils/fieldResolver.js.map +1 -1
- package/utils/resolve.js +0 -3
- package/utils/resolve.js.map +1 -1
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.sendChangeRequestNotification = void 0;
|
7
|
+
var _lastChangeRequestNotificationPlugin = require("./lastChangeRequestNotificationPlugin");
|
8
|
+
const sendChangeRequestNotification = async params => {
|
9
|
+
const {
|
10
|
+
context,
|
11
|
+
reviewers,
|
12
|
+
contentReview
|
13
|
+
} = params;
|
14
|
+
if (reviewers.length === 0) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
const changeRequestPlugin = (0, _lastChangeRequestNotificationPlugin.getLastChangeRequestNotificationPlugin)({
|
18
|
+
context,
|
19
|
+
type: contentReview.content.type
|
20
|
+
});
|
21
|
+
if (!changeRequestPlugin) {
|
22
|
+
console.log("No e-mail body change request plugin.");
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
const body = changeRequestPlugin.create(params);
|
26
|
+
if (!body) {
|
27
|
+
console.log(`No e-mail body from the change request plugin: ${changeRequestPlugin.name}`);
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
const result = await context.mailer.sendMail({
|
31
|
+
bcc: reviewers.map(r => r.email),
|
32
|
+
subject: "There is a new change request on the Content Review you are assigned on.",
|
33
|
+
text: body.text,
|
34
|
+
html: body.html || body.text
|
35
|
+
});
|
36
|
+
if (!result.error) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
console.log("Error while sending e-mail", JSON.stringify(result.error));
|
40
|
+
};
|
41
|
+
exports.sendChangeRequestNotification = sendChangeRequestNotification;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["sendChangeRequestNotification","params","context","reviewers","contentReview","length","changeRequestPlugin","getLastChangeRequestNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify"],"sources":["sendChangeRequestNotification.ts"],"sourcesContent":["import { getLastChangeRequestNotificationPlugin } from \"./lastChangeRequestNotificationPlugin\";\nimport { ApwChangeRequestNotificationCbParams } from \"~/ApwChangeRequestNotification\";\n\nexport const sendChangeRequestNotification = async (\n params: ApwChangeRequestNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const changeRequestPlugin = getLastChangeRequestNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!changeRequestPlugin) {\n console.log(\"No e-mail body change request plugin.\");\n return;\n }\n\n const body = changeRequestPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the change request plugin: ${changeRequestPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new change request on the Content Review you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA;AAGO,MAAMA,6BAA6B,GAAG,MACzCC,MAA4C,IAC5B;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,mBAAmB,GAAG,IAAAC,2EAAsC,EAAC;IAC/DL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,mBAAmB,EAAE;IACtBI,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;IACpD;EACJ;EAEA,MAAMC,IAAI,GAAGN,mBAAmB,CAACO,MAAM,CAACZ,MAAM,CAAC;EAC/C,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,kDAAiDL,mBAAmB,CAACQ,IAAK,EAAC,CAAC;IACzF;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,0EAA0E;IACnFC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAAC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.sendCommentNotification = void 0;
|
7
|
+
var _lastCommentNotificationPlugin = require("./lastCommentNotificationPlugin");
|
8
|
+
const sendCommentNotification = async params => {
|
9
|
+
const {
|
10
|
+
context,
|
11
|
+
reviewers,
|
12
|
+
contentReview
|
13
|
+
} = params;
|
14
|
+
if (reviewers.length === 0) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
const commentPlugin = (0, _lastCommentNotificationPlugin.getLastCommentNotificationPlugin)({
|
18
|
+
context,
|
19
|
+
type: contentReview.content.type
|
20
|
+
});
|
21
|
+
if (!commentPlugin) {
|
22
|
+
console.log("No e-mail body comment plugin.");
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
const body = commentPlugin.create(params);
|
26
|
+
if (!body) {
|
27
|
+
console.log(`No e-mail body from the comment plugin: ${commentPlugin.name}`);
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
const result = await context.mailer.sendMail({
|
31
|
+
bcc: reviewers.map(r => r.email),
|
32
|
+
subject: "There is a new comment on the Content Review you are assigned on.",
|
33
|
+
text: body.text,
|
34
|
+
html: body.html || body.text
|
35
|
+
});
|
36
|
+
if (!result.error) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
console.log("Error while sending e-mail", JSON.stringify(result.error));
|
40
|
+
};
|
41
|
+
exports.sendCommentNotification = sendCommentNotification;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["sendCommentNotification","params","context","reviewers","contentReview","length","commentPlugin","getLastCommentNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify"],"sources":["sendCommentNotification.ts"],"sourcesContent":["import { getLastCommentNotificationPlugin } from \"./lastCommentNotificationPlugin\";\nimport { ApwCommentNotificationCbParams } from \"~/ApwCommentNotification\";\n\nexport const sendCommentNotification = async (\n params: ApwCommentNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const commentPlugin = getLastCommentNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!commentPlugin) {\n console.log(\"No e-mail body comment plugin.\");\n return;\n }\n\n const body = commentPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the comment plugin: ${commentPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new comment on the Content Review you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA;AAGO,MAAMA,uBAAuB,GAAG,MACnCC,MAAsC,IACtB;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,aAAa,GAAG,IAAAC,+DAAgC,EAAC;IACnDL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,aAAa,EAAE;IAChBI,OAAO,CAACC,GAAG,CAAC,gCAAgC,CAAC;IAC7C;EACJ;EAEA,MAAMC,IAAI,GAAGN,aAAa,CAACO,MAAM,CAACZ,MAAM,CAAC;EACzC,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,2CAA0CL,aAAa,CAACQ,IAAK,EAAC,CAAC;IAC5E;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,mEAAmE;IAC5EC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAAC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.sendContentReviewNotification = void 0;
|
7
|
+
var _lastContentReviewNotificationPlugin = require("./lastContentReviewNotificationPlugin");
|
8
|
+
const sendContentReviewNotification = async params => {
|
9
|
+
const {
|
10
|
+
context,
|
11
|
+
reviewers,
|
12
|
+
contentReview
|
13
|
+
} = params;
|
14
|
+
if (reviewers.length === 0) {
|
15
|
+
return;
|
16
|
+
}
|
17
|
+
const contentReviewPlugin = (0, _lastContentReviewNotificationPlugin.getLastContentReviewNotificationPlugin)({
|
18
|
+
context,
|
19
|
+
type: contentReview.content.type
|
20
|
+
});
|
21
|
+
if (!contentReviewPlugin) {
|
22
|
+
console.log("No e-mail body content review plugin.");
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
const body = contentReviewPlugin.create(params);
|
26
|
+
if (!body) {
|
27
|
+
console.log(`No e-mail body from the content review plugin: ${contentReviewPlugin.name}`);
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
const result = await context.mailer.sendMail({
|
31
|
+
bcc: reviewers.map(r => r.email),
|
32
|
+
subject: "There is a new content review which you are assigned on.",
|
33
|
+
text: body.text,
|
34
|
+
html: body.html || body.text
|
35
|
+
});
|
36
|
+
if (!result.error) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
console.log("Error while sending e-mail", JSON.stringify(result.error));
|
40
|
+
};
|
41
|
+
exports.sendContentReviewNotification = sendContentReviewNotification;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["sendContentReviewNotification","params","context","reviewers","contentReview","length","contentReviewPlugin","getLastContentReviewNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify"],"sources":["sendContentReviewNotification.ts"],"sourcesContent":["import { getLastContentReviewNotificationPlugin } from \"./lastContentReviewNotificationPlugin\";\nimport { ApwContentReviewNotificationCbParams } from \"~/ApwContentReviewNotification\";\n\nexport const sendContentReviewNotification = async (\n params: ApwContentReviewNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const contentReviewPlugin = getLastContentReviewNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!contentReviewPlugin) {\n console.log(\"No e-mail body content review plugin.\");\n return;\n }\n\n const body = contentReviewPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the content review plugin: ${contentReviewPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new content review which you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;AAAA;AAGO,MAAMA,6BAA6B,GAAG,MACzCC,MAA4C,IAC5B;EAChB,MAAM;IAAEC,OAAO;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EACpD,IAAIE,SAAS,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB;EACJ;EAEA,MAAMC,mBAAmB,GAAG,IAAAC,2EAAsC,EAAC;IAC/DL,OAAO;IACPM,IAAI,EAAEJ,aAAa,CAACK,OAAO,CAACD;EAChC,CAAC,CAAC;EACF,IAAI,CAACF,mBAAmB,EAAE;IACtBI,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;IACpD;EACJ;EAEA,MAAMC,IAAI,GAAGN,mBAAmB,CAACO,MAAM,CAACZ,MAAM,CAAC;EAC/C,IAAI,CAACW,IAAI,EAAE;IACPF,OAAO,CAACC,GAAG,CAAE,kDAAiDL,mBAAmB,CAACQ,IAAK,EAAC,CAAC;IACzF;EACJ;EAEA,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAM,CAACC,QAAQ,CAAC;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,KAAK,CAAC;IAChCC,OAAO,EAAE,0DAA0D;IACnEC,IAAI,EAAEX,IAAI,CAACW,IAAI;IACfC,IAAI,EAAEZ,IAAI,CAACY,IAAI,IAAIZ,IAAI,CAACW;EAC5B,CAAC,CAAC;EACF,IAAI,CAACR,MAAM,CAACU,KAAK,EAAE;IACf;EACJ;EACAf,OAAO,CAACC,GAAG,CAAC,4BAA4B,EAAEe,IAAI,CAACC,SAAS,CAACZ,MAAM,CAACU,KAAK,CAAC,CAAC;AAC3E,CAAC;AAAC"}
|
@@ -1,20 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.updatePendingChangeRequestsCount = void 0;
|
9
|
-
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
-
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
12
9
|
var _utils = require("../utils");
|
13
|
-
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
15
|
-
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
17
|
-
|
18
10
|
const updatePendingChangeRequests = async ({
|
19
11
|
contentReviewMethods,
|
20
12
|
step,
|
@@ -28,19 +20,18 @@ const updatePendingChangeRequests = async ({
|
|
28
20
|
contentReviewMethods,
|
29
21
|
id,
|
30
22
|
getNewContentReviewData: data => {
|
31
|
-
return
|
32
|
-
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step =>
|
23
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
|
24
|
+
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
|
33
25
|
pendingChangeRequests: step.pendingChangeRequests + delta
|
34
26
|
}))
|
35
27
|
});
|
36
28
|
}
|
37
29
|
});
|
38
30
|
};
|
39
|
-
|
40
31
|
const updatePendingChangeRequestsCount = ({
|
41
32
|
apw
|
42
33
|
}) => {
|
43
|
-
apw.changeRequest.
|
34
|
+
apw.changeRequest.onChangeRequestAfterDelete.subscribe(async ({
|
44
35
|
changeRequest
|
45
36
|
}) => {
|
46
37
|
/**
|
@@ -54,15 +45,13 @@ const updatePendingChangeRequestsCount = ({
|
|
54
45
|
* After a "changeRequest" is deleted, decrement the "pendingChangeRequests" count
|
55
46
|
* in the corresponding step of the content review entry.
|
56
47
|
*/
|
57
|
-
|
58
|
-
|
59
48
|
await updatePendingChangeRequests({
|
60
49
|
contentReviewMethods: apw.contentReview,
|
61
50
|
step: changeRequest.step,
|
62
51
|
delta: -1
|
63
52
|
});
|
64
53
|
});
|
65
|
-
apw.changeRequest.
|
54
|
+
apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({
|
66
55
|
changeRequest
|
67
56
|
}) => {
|
68
57
|
/**
|
@@ -75,7 +64,7 @@ const updatePendingChangeRequestsCount = ({
|
|
75
64
|
delta: 1
|
76
65
|
});
|
77
66
|
});
|
78
|
-
apw.changeRequest.
|
67
|
+
apw.changeRequest.onChangeRequestAfterUpdate.subscribe(async ({
|
79
68
|
changeRequest,
|
80
69
|
original
|
81
70
|
}) => {
|
@@ -94,5 +83,4 @@ const updatePendingChangeRequestsCount = ({
|
|
94
83
|
}
|
95
84
|
});
|
96
85
|
};
|
97
|
-
|
98
86
|
exports.updatePendingChangeRequestsCount = updatePendingChangeRequestsCount;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["updatePendingChangeRequests","contentReviewMethods","step","delta","id","stepId","extractContentReviewIdAndStep","updateContentReview","getNewContentReviewData","data","steps","updateContentReviewStep","pendingChangeRequests","updatePendingChangeRequestsCount","apw","changeRequest","
|
1
|
+
{"version":3,"names":["updatePendingChangeRequests","contentReviewMethods","step","delta","id","stepId","extractContentReviewIdAndStep","updateContentReview","getNewContentReviewData","data","steps","updateContentReviewStep","pendingChangeRequests","updatePendingChangeRequestsCount","apw","changeRequest","onChangeRequestAfterDelete","subscribe","resolved","contentReview","onChangeRequestAfterCreate","onChangeRequestAfterUpdate","original"],"sources":["updatePendingChangeRequests.ts"],"sourcesContent":["import { ApwChangeRequest, ApwContentReviewCrud, LifeCycleHookCallbackParams } from \"~/types\";\nimport {\n extractContentReviewIdAndStep,\n updateContentReview,\n updateContentReviewStep\n} from \"../utils\";\n\ninterface UpdatePendingChangeRequestsParams {\n contentReviewMethods: ApwContentReviewCrud;\n delta: number;\n step: ApwChangeRequest[\"step\"];\n}\n\nconst updatePendingChangeRequests = async ({\n contentReviewMethods,\n step,\n delta\n}: UpdatePendingChangeRequestsParams): Promise<void> => {\n const { id, stepId } = extractContentReviewIdAndStep(step);\n\n await updateContentReview({\n contentReviewMethods,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n pendingChangeRequests: step.pendingChangeRequests + delta\n }))\n };\n }\n });\n};\n\nexport const updatePendingChangeRequestsCount = ({\n apw\n}: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestAfterDelete.subscribe(async ({ changeRequest }) => {\n /**\n * If the deleted changeRequest was marked as resolved. We don't need to do anything here,\n * because \"pendingChangeRequests has been already updated in \"onAfterChangeRequestUpdate\" hook.\n */\n if (changeRequest.resolved === true) {\n return;\n }\n /**\n * After a \"changeRequest\" is deleted, decrement the \"pendingChangeRequests\" count\n * in the corresponding step of the content review entry.\n */\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta: -1\n });\n });\n\n apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({ changeRequest }) => {\n /**\n * After a \"changeRequest\" is created, increment the \"pendingChangeRequests\" count\n * of the corresponding step in the content review entry.\n */\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta: 1\n });\n });\n\n apw.changeRequest.onChangeRequestAfterUpdate.subscribe(async ({ changeRequest, original }) => {\n /**\n * After a \"changeRequest\" is created, and the value of \"resolved\" field has changed;\n * then we also need to update the \"pendingChangeRequests\" count of the corresponding step in the content review entry.\n */\n if (original.resolved !== changeRequest.resolved) {\n const resolved = changeRequest.resolved;\n const delta = resolved === true ? -1 : 1;\n\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta\n });\n }\n });\n};\n"],"mappings":";;;;;;;;AACA;AAYA,MAAMA,2BAA2B,GAAG,OAAO;EACvCC,oBAAoB;EACpBC,IAAI;EACJC;AAC+B,CAAC,KAAoB;EACpD,MAAM;IAAEC,EAAE;IAAEC;EAAO,CAAC,GAAG,IAAAC,oCAA6B,EAACJ,IAAI,CAAC;EAE1D,MAAM,IAAAK,0BAAmB,EAAC;IACtBN,oBAAoB;IACpBG,EAAE;IACFI,uBAAuB,EAAEC,IAAI,IAAI;MAC7B,mEACOA,IAAI;QACPC,KAAK,EAAE,IAAAC,8BAAuB,EAACF,IAAI,CAACC,KAAK,EAAEL,MAAM,EAAEH,IAAI,gEAChDA,IAAI;UACPU,qBAAqB,EAAEV,IAAI,CAACU,qBAAqB,GAAGT;QAAK,EAC3D;MAAC;IAEX;EACJ,CAAC,CAAC;AACN,CAAC;AAEM,MAAMU,gCAAgC,GAAG,CAAC;EAC7CC;AACsC,CAAC,KAAK;EAC5CA,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;AACA;IACQ,IAAIA,aAAa,CAACG,QAAQ,KAAK,IAAI,EAAE;MACjC;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMlB,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aAAa;MACvCjB,IAAI,EAAEa,aAAa,CAACb,IAAI;MACxBC,KAAK,EAAE,CAAC;IACZ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFW,GAAG,CAACC,aAAa,CAACK,0BAA0B,CAACH,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;AACA;IACQ,MAAMf,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aAAa;MACvCjB,IAAI,EAAEa,aAAa,CAACb,IAAI;MACxBC,KAAK,EAAE;IACX,CAAC,CAAC;EACN,CAAC,CAAC;EAEFW,GAAG,CAACC,aAAa,CAACM,0BAA0B,CAACJ,SAAS,CAAC,OAAO;IAAEF,aAAa;IAAEO;EAAS,CAAC,KAAK;IAC1F;AACR;AACA;AACA;IACQ,IAAIA,QAAQ,CAACJ,QAAQ,KAAKH,aAAa,CAACG,QAAQ,EAAE;MAC9C,MAAMA,QAAQ,GAAGH,aAAa,CAACG,QAAQ;MACvC,MAAMf,KAAK,GAAGe,QAAQ,KAAK,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;MAExC,MAAMlB,2BAA2B,CAAC;QAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aAAa;QACvCjB,IAAI,EAAEa,aAAa,CAACb,IAAI;QACxBC;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|
@@ -1,24 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.updateTotalCommentsCount = exports.updateLatestCommentId = void 0;
|
9
|
-
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
-
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
12
9
|
var _utils = require("../utils");
|
13
|
-
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
15
|
-
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
17
|
-
|
18
10
|
const updateTotalCommentsCount = ({
|
19
11
|
apw
|
20
12
|
}) => {
|
21
|
-
apw.comment.
|
13
|
+
apw.comment.onCommentAfterDelete.subscribe(async ({
|
22
14
|
comment
|
23
15
|
}) => {
|
24
16
|
const {
|
@@ -28,7 +20,6 @@ const updateTotalCommentsCount = ({
|
|
28
20
|
* After a "comment" is deleted, decrement the "totalComments" count
|
29
21
|
* in the corresponding step of the content review entry.
|
30
22
|
*/
|
31
|
-
|
32
23
|
if (step) {
|
33
24
|
const {
|
34
25
|
id,
|
@@ -38,8 +29,8 @@ const updateTotalCommentsCount = ({
|
|
38
29
|
contentReviewMethods: apw.contentReview,
|
39
30
|
id,
|
40
31
|
getNewContentReviewData: data => {
|
41
|
-
return
|
42
|
-
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step =>
|
32
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
|
33
|
+
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
|
43
34
|
totalComments: step.totalComments - 1
|
44
35
|
}))
|
45
36
|
});
|
@@ -47,7 +38,7 @@ const updateTotalCommentsCount = ({
|
|
47
38
|
});
|
48
39
|
}
|
49
40
|
});
|
50
|
-
apw.comment.
|
41
|
+
apw.comment.onCommentAfterCreate.subscribe(async ({
|
51
42
|
comment
|
52
43
|
}) => {
|
53
44
|
/**
|
@@ -62,8 +53,8 @@ const updateTotalCommentsCount = ({
|
|
62
53
|
contentReviewMethods: apw.contentReview,
|
63
54
|
id,
|
64
55
|
getNewContentReviewData: data => {
|
65
|
-
return
|
66
|
-
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step =>
|
56
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
|
57
|
+
steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
|
67
58
|
totalComments: step.totalComments + 1
|
68
59
|
}))
|
69
60
|
});
|
@@ -71,13 +62,11 @@ const updateTotalCommentsCount = ({
|
|
71
62
|
});
|
72
63
|
});
|
73
64
|
};
|
74
|
-
|
75
65
|
exports.updateTotalCommentsCount = updateTotalCommentsCount;
|
76
|
-
|
77
66
|
const updateLatestCommentId = ({
|
78
67
|
apw
|
79
68
|
}) => {
|
80
|
-
apw.comment.
|
69
|
+
apw.comment.onCommentAfterCreate.subscribe(async ({
|
81
70
|
comment
|
82
71
|
}) => {
|
83
72
|
/**
|
@@ -91,13 +80,13 @@ const updateLatestCommentId = ({
|
|
91
80
|
contentReviewMethods: apw.contentReview,
|
92
81
|
id,
|
93
82
|
getNewContentReviewData: contentReview => {
|
94
|
-
return
|
83
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contentReview), {}, {
|
95
84
|
latestCommentId: comment.id
|
96
85
|
});
|
97
86
|
}
|
98
87
|
});
|
99
88
|
});
|
100
|
-
apw.comment.
|
89
|
+
apw.comment.onCommentAfterUpdate.subscribe(async ({
|
101
90
|
comment
|
102
91
|
}) => {
|
103
92
|
/**
|
@@ -111,13 +100,13 @@ const updateLatestCommentId = ({
|
|
111
100
|
contentReviewMethods: apw.contentReview,
|
112
101
|
id,
|
113
102
|
getNewContentReviewData: contentReview => {
|
114
|
-
return
|
103
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contentReview), {}, {
|
115
104
|
latestCommentId: comment.id
|
116
105
|
});
|
117
106
|
}
|
118
107
|
});
|
119
108
|
});
|
120
|
-
apw.comment.
|
109
|
+
apw.comment.onCommentAfterDelete.subscribe(async ({
|
121
110
|
comment
|
122
111
|
}) => {
|
123
112
|
/**
|
@@ -131,7 +120,6 @@ const updateLatestCommentId = ({
|
|
131
120
|
id,
|
132
121
|
contentReviewMethods: apw.contentReview
|
133
122
|
});
|
134
|
-
|
135
123
|
if (contentReview && contentReview.latestCommentId === comment.id) {
|
136
124
|
const [[latestComment]] = await apw.comment.list({
|
137
125
|
where: {
|
@@ -145,7 +133,7 @@ const updateLatestCommentId = ({
|
|
145
133
|
contentReviewMethods: apw.contentReview,
|
146
134
|
id,
|
147
135
|
getNewContentReviewData: contentReview => {
|
148
|
-
return
|
136
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contentReview), {}, {
|
149
137
|
latestCommentId: latestComment ? latestComment.id : null
|
150
138
|
});
|
151
139
|
}
|
@@ -153,5 +141,4 @@ const updateLatestCommentId = ({
|
|
153
141
|
}
|
154
142
|
});
|
155
143
|
};
|
156
|
-
|
157
144
|
exports.updateLatestCommentId = updateLatestCommentId;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["updateTotalCommentsCount","apw","comment","
|
1
|
+
{"version":3,"names":["updateTotalCommentsCount","apw","comment","onCommentAfterDelete","subscribe","step","id","stepId","extractContentReviewIdAndStep","updateContentReview","contentReviewMethods","contentReview","getNewContentReviewData","data","steps","updateContentReviewStep","totalComments","onCommentAfterCreate","updateLatestCommentId","latestCommentId","onCommentAfterUpdate","safelyGetContentReview","latestComment","list","where","changeRequest","sort"],"sources":["updateTotalComments.ts"],"sourcesContent":["import { LifeCycleHookCallbackParams } from \"~/types\";\nimport {\n extractContentReviewIdAndStep,\n safelyGetContentReview,\n updateContentReview,\n updateContentReviewStep\n} from \"../utils\";\n\nexport const updateTotalCommentsCount = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentAfterDelete.subscribe(async ({ comment }) => {\n const { step } = comment;\n /**\n * After a \"comment\" is deleted, decrement the \"totalComments\" count\n * in the corresponding step of the content review entry.\n */\n if (step) {\n const { id, stepId } = extractContentReviewIdAndStep(step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n totalComments: step.totalComments - 1\n }))\n };\n }\n });\n }\n });\n\n apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is created, increment the \"totalComments\" count\n * of the corresponding step in the content review entry.\n */\n const { id, stepId } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n totalComments: step.totalComments + 1\n }))\n };\n }\n });\n });\n};\n\nexport const updateLatestCommentId = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is created, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: comment.id\n };\n }\n });\n });\n\n apw.comment.onCommentAfterUpdate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is updated, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: comment.id\n };\n }\n });\n });\n\n apw.comment.onCommentAfterDelete.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is updated, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n const contentReview = await safelyGetContentReview({\n id,\n contentReviewMethods: apw.contentReview\n });\n\n if (contentReview && contentReview.latestCommentId === comment.id) {\n const [[latestComment]] = await apw.comment.list({\n where: { changeRequest: { id: comment.changeRequest } },\n sort: [\"createdOn_DESC\"]\n });\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: latestComment ? latestComment.id : null\n };\n }\n });\n }\n });\n};\n"],"mappings":"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"}
|
@@ -1,20 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.validateChangeRequest = void 0;
|
9
|
-
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
-
|
12
9
|
var _handlerGraphql = require("@webiny/handler-graphql");
|
13
|
-
|
10
|
+
var _utils = require("../utils");
|
11
|
+
var _utils2 = require("@webiny/utils");
|
14
12
|
const validateChangeRequest = ({
|
15
13
|
apw
|
16
14
|
}) => {
|
17
|
-
apw.changeRequest.
|
15
|
+
apw.changeRequest.onChangeRequestBeforeCreate.subscribe(async ({
|
18
16
|
input
|
19
17
|
}) => {
|
20
18
|
const {
|
@@ -23,9 +21,14 @@ const validateChangeRequest = ({
|
|
23
21
|
/**
|
24
22
|
* We need step to be in a particular format i.e. "contentReviewId#version#stepId"
|
25
23
|
*/
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
const {
|
25
|
+
id: revisionId,
|
26
|
+
stepId
|
27
|
+
} = (0, _utils.extractContentReviewIdAndStep)(step);
|
28
|
+
const {
|
29
|
+
id: entryId,
|
30
|
+
version
|
31
|
+
} = (0, _utils2.parseIdentifier)(revisionId);
|
29
32
|
if (!entryId || !version || !stepId) {
|
30
33
|
throw new _error.default(`The step property in input is not properly formatted.`, "MALFORMED_CHANGE_REQUEST_STEP", {
|
31
34
|
step
|
@@ -34,24 +37,31 @@ const validateChangeRequest = ({
|
|
34
37
|
/**
|
35
38
|
* Check whether a contentReview entry exists with provided id.
|
36
39
|
*/
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
let contentReview = undefined;
|
41
|
+
try {
|
42
|
+
contentReview = await apw.contentReview.get(revisionId);
|
43
|
+
} catch (ex) {
|
44
|
+
/**
|
45
|
+
* There is no need to output the log if this is the test environment.
|
46
|
+
*/
|
47
|
+
if (process.env.NODE_ENV !== "test") {
|
48
|
+
console.log({
|
49
|
+
message: ex.message,
|
50
|
+
code: ex.data,
|
51
|
+
data: ex.data
|
52
|
+
});
|
53
|
+
}
|
54
|
+
}
|
42
55
|
if (!contentReview) {
|
43
56
|
throw new _handlerGraphql.NotFoundError(`Unable to found "ContentReview" with given id "${revisionId}"`);
|
44
57
|
}
|
45
58
|
/**
|
46
59
|
* Don't allow "change request" creation once the sign-off has been provided.
|
47
60
|
*/
|
48
|
-
|
49
|
-
|
50
61
|
const {
|
51
62
|
steps
|
52
63
|
} = contentReview;
|
53
64
|
const currentStep = steps.find(step => step.id === stepId);
|
54
|
-
|
55
65
|
if (currentStep && currentStep.signOffProvidedOn) {
|
56
66
|
throw new _error.default(`Please retract the sign-off before opening a new change request.`, "SIGN_OFF_PROVIDED", {
|
57
67
|
step: currentStep,
|
@@ -60,5 +70,4 @@ const validateChangeRequest = ({
|
|
60
70
|
}
|
61
71
|
});
|
62
72
|
};
|
63
|
-
|
64
73
|
exports.validateChangeRequest = validateChangeRequest;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["validateChangeRequest","apw","changeRequest","
|
1
|
+
{"version":3,"names":["validateChangeRequest","apw","changeRequest","onChangeRequestBeforeCreate","subscribe","input","step","id","revisionId","stepId","extractContentReviewIdAndStep","entryId","version","parseIdentifier","WebinyError","contentReview","undefined","get","ex","process","env","NODE_ENV","console","log","message","code","data","NotFoundError","steps","currentStep","find","signOffProvidedOn"],"sources":["validateChangeRequest.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { ApwContentReview, LifeCycleHookCallbackParams } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const validateChangeRequest = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestBeforeCreate.subscribe(async ({ input }) => {\n const { step } = input;\n /**\n * We need step to be in a particular format i.e. \"contentReviewId#version#stepId\"\n */\n const { id: revisionId, stepId } = extractContentReviewIdAndStep(step);\n\n const { id: entryId, version } = parseIdentifier(revisionId);\n if (!entryId || !version || !stepId) {\n throw new WebinyError(\n `The step property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_STEP\",\n {\n step\n }\n );\n }\n /**\n * Check whether a contentReview entry exists with provided id.\n */\n let contentReview: ApwContentReview | undefined = undefined;\n try {\n contentReview = await apw.contentReview.get(revisionId);\n } catch (ex) {\n /**\n * There is no need to output the log if this is the test environment.\n */\n if (process.env.NODE_ENV !== \"test\") {\n console.log({\n message: ex.message,\n code: ex.data,\n data: ex.data\n });\n }\n }\n if (!contentReview) {\n throw new NotFoundError(\n `Unable to found \"ContentReview\" with given id \"${revisionId}\"`\n );\n }\n /**\n * Don't allow \"change request\" creation once the sign-off has been provided.\n */\n const { steps } = contentReview;\n const currentStep = steps.find(step => step.id === stepId);\n\n if (currentStep && currentStep.signOffProvidedOn) {\n throw new WebinyError(\n `Please retract the sign-off before opening a new change request.`,\n \"SIGN_OFF_PROVIDED\",\n {\n step: currentStep,\n stepId: stepId\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AAEO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAA8C,CAAC,KAAK;EACxFA,GAAG,CAACC,aAAa,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACzE,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK;IACtB;AACR;AACA;IACQ,MAAM;MAAEE,EAAE,EAAEC,UAAU;MAAEC;IAAO,CAAC,GAAG,IAAAC,oCAA6B,EAACJ,IAAI,CAAC;IAEtE,MAAM;MAAEC,EAAE,EAAEI,OAAO;MAAEC;IAAQ,CAAC,GAAG,IAAAC,uBAAe,EAACL,UAAU,CAAC;IAC5D,IAAI,CAACG,OAAO,IAAI,CAACC,OAAO,IAAI,CAACH,MAAM,EAAE;MACjC,MAAM,IAAIK,cAAW,CAChB,uDAAsD,EACvD,+BAA+B,EAC/B;QACIR;MACJ,CAAC,CACJ;IACL;IACA;AACR;AACA;IACQ,IAAIS,aAA2C,GAAGC,SAAS;IAC3D,IAAI;MACAD,aAAa,GAAG,MAAMd,GAAG,CAACc,aAAa,CAACE,GAAG,CAACT,UAAU,CAAC;IAC3D,CAAC,CAAC,OAAOU,EAAE,EAAE;MACT;AACZ;AACA;MACY,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;QACjCC,OAAO,CAACC,GAAG,CAAC;UACRC,OAAO,EAAEN,EAAE,CAACM,OAAO;UACnBC,IAAI,EAAEP,EAAE,CAACQ,IAAI;UACbA,IAAI,EAAER,EAAE,CAACQ;QACb,CAAC,CAAC;MACN;IACJ;IACA,IAAI,CAACX,aAAa,EAAE;MAChB,MAAM,IAAIY,6BAAa,CAClB,kDAAiDnB,UAAW,GAAE,CAClE;IACL;IACA;AACR;AACA;IACQ,MAAM;MAAEoB;IAAM,CAAC,GAAGb,aAAa;IAC/B,MAAMc,WAAW,GAAGD,KAAK,CAACE,IAAI,CAACxB,IAAI,IAAIA,IAAI,CAACC,EAAE,KAAKE,MAAM,CAAC;IAE1D,IAAIoB,WAAW,IAAIA,WAAW,CAACE,iBAAiB,EAAE;MAC9C,MAAM,IAAIjB,cAAW,CAChB,kEAAiE,EAClE,mBAAmB,EACnB;QACIR,IAAI,EAAEuB,WAAW;QACjBpB,MAAM,EAAEA;MACZ,CAAC,CACJ;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
|
@@ -1,18 +1,16 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
8
7
|
exports.validateComment = void 0;
|
9
|
-
|
10
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
-
|
9
|
+
var _utils = require("@webiny/utils");
|
12
10
|
const validateComment = ({
|
13
11
|
apw
|
14
12
|
}) => {
|
15
|
-
apw.comment.
|
13
|
+
apw.comment.onCommentBeforeCreate.subscribe(async ({
|
16
14
|
input
|
17
15
|
}) => {
|
18
16
|
const {
|
@@ -21,27 +19,28 @@ const validateComment = ({
|
|
21
19
|
/**
|
22
20
|
* We need changeRequest to be in a particular format i.e. "contentReviewUniqueId#version"
|
23
21
|
*/
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
let result;
|
23
|
+
try {
|
24
|
+
result = (0, _utils.parseIdentifier)(changeRequestId);
|
25
|
+
if (!result) {
|
26
|
+
throw new _error.default("Could not parse changeRequestId.", "MALFORMED_CHANGE_REQUEST_ID", {
|
27
|
+
changeRequestId
|
28
|
+
});
|
29
|
+
}
|
30
|
+
} catch (ex) {
|
28
31
|
throw new _error.default(`The"changeRequest" property in input is not properly formatted.`, "MALFORMED_CHANGE_REQUEST_ID", {
|
29
32
|
input
|
30
33
|
});
|
31
34
|
}
|
35
|
+
|
32
36
|
/**
|
33
37
|
* Assign value for "step" field from "changeRequest".
|
34
38
|
*/
|
35
|
-
|
36
|
-
|
37
39
|
const changeRequest = await apw.changeRequest.get(changeRequestId);
|
38
|
-
|
39
40
|
if (!changeRequest) {
|
40
41
|
return;
|
41
42
|
}
|
42
|
-
|
43
43
|
input.step = changeRequest.step;
|
44
44
|
});
|
45
45
|
};
|
46
|
-
|
47
46
|
exports.validateComment = validateComment;
|