@webiny/api-apw 0.0.0-unstable.6e5425ee89 → 0.0.0-unstable.78f581c1d2
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.js +10 -0
- package/ApwChangeRequestNotification.js.map +1 -1
- package/ApwCommentNotification.js +10 -0
- package/ApwCommentNotification.js.map +1 -1
- package/ApwContentReviewNotification.js +10 -0
- package/ApwContentReviewNotification.js.map +1 -1
- package/ApwContentUrlPlugin.js +10 -0
- package/ApwContentUrlPlugin.js.map +1 -1
- package/ContentApwSettingsPlugin.js +5 -0
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/crud/createChangeRequestMethods.js +11 -4
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.js +12 -4
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.js +84 -20
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.js +12 -4
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.js +17 -4
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.js +25 -0
- package/crud/index.js.map +1 -1
- package/crud/utils.js +28 -0
- package/crud/utils.js.map +1 -1
- package/index.js +11 -1
- package/index.js.map +1 -1
- package/package.json +34 -34
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +15 -0
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.js +8 -0
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.js +13 -0
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js +17 -0
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js +31 -2
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.js +4 -0
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/cms/notifications/commentNotification.js +4 -0
- package/plugins/cms/notifications/commentNotification.js.map +1 -1
- package/plugins/cms/notifications/contentReviewNotification.js +4 -0
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/cms/notifications/contentUrl.js +8 -1
- package/plugins/cms/notifications/contentUrl.js.map +1 -1
- package/plugins/cms/triggerContentReview.js +14 -0
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js +18 -0
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.js +47 -2
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.js +31 -0
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +8 -1
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +8 -1
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +20 -1
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +8 -1
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/workflow.gql.js +8 -1
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js +16 -1
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +11 -2
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +9 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +8 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.js +14 -0
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +15 -2
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.js +5 -0
- package/plugins/hooks/initializeNotifications.js.map +1 -1
- package/plugins/hooks/listContentReviews.js +12 -0
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.js +4 -0
- package/plugins/hooks/notifications/appUrl.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +28 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/changeRequestUrl.js +4 -0
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
- package/plugins/hooks/notifications/commentAfterCreate.js +30 -0
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/commentUrl.js +4 -0
- package/plugins/hooks/notifications/commentUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +24 -1
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
- package/plugins/hooks/notifications/contentReviewUrl.js +4 -0
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
- package/plugins/hooks/notifications/contentUrl.js +5 -0
- package/plugins/hooks/notifications/contentUrl.js.map +1 -1
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +4 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +4 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +4 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
- package/plugins/hooks/notifications/reviewers.js +7 -0
- package/plugins/hooks/notifications/reviewers.js.map +1 -1
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +11 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendCommentNotification.js +11 -0
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
- package/plugins/hooks/notifications/sendContentReviewNotification.js +11 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
- package/plugins/hooks/updatePendingChangeRequests.js +8 -0
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js +9 -0
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.js +16 -0
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js +12 -1
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.js +6 -0
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +15 -0
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js +4 -0
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +6 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
- package/plugins/pageBuilder/index.js +11 -0
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js +16 -0
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js +31 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +4 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/commentNotification.js +4 -0
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +4 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
- package/plugins/pageBuilder/notifications/contentUrl.js +7 -1
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
- package/plugins/pageBuilder/triggerContentReview.js +11 -0
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js +12 -0
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.js +35 -1
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.js +43 -0
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +20 -1
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.js +33 -9
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +5 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +21 -0
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +27 -4
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.js +11 -0
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.js +25 -5
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +23 -2
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.js +40 -3
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.js +3 -0
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.js +6 -0
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js +19 -0
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +21 -0
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.js +17 -0
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.js +14 -0
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.js +9 -0
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.js +8 -0
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.js +5 -0
- package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
- package/storageOperations/models/contentReview.model.js +26 -0
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +24 -2
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.js +8 -0
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js +4 -0
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.js +23 -0
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.js +17 -0
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/workflowStorageOperations.js +19 -0
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.js +14 -0
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.js +6 -0
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js +17 -0
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.js +12 -2
- package/utils/fieldResolver.js.map +1 -1
- package/utils/resolve.js +3 -0
- package/utils/resolve.js.map +1 -1
@@ -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","disableAuthorization","enableAuthorization"],"sources":["changeRequestAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { 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/appUrl\";\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 try {\n context.security.disableAuthorization();\n await execute();\n } catch (ex) {\n throw ex;\n } finally {\n context.security.enableAuthorization();\n }\n });\n};\n"],"mappings":"
|
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","disableAuthorization","enableAuthorization"],"sources":["changeRequestAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { 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/appUrl\";\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 try {\n context.security.disableAuthorization();\n await execute();\n } catch (ex) {\n throw ex;\n } finally {\n context.security.enableAuthorization();\n }\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,8BAA8B,G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H,CAHD,CAGE,OAAO2B,EAAP,EAAW;MACT,MAAMA,EAAN;IACH,CALD,SAKU;MACNhC,OAAO,CAACsC,QAAR,CAAiBE,mBAAjB;IACH;EACJ,CAhHD;AAiHH,CAlHM"}
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createChangeRequestUrl = void 0;
|
7
|
+
|
7
8
|
const createChangeRequestUrl = params => {
|
8
9
|
/**
|
9
10
|
* All variables must exist for URL to be created.
|
@@ -13,9 +14,11 @@ const createChangeRequestUrl = params => {
|
|
13
14
|
if (!!key) {
|
14
15
|
continue;
|
15
16
|
}
|
17
|
+
|
16
18
|
console.log(`Missing variable "${key}", which we use to create a comment URL.`);
|
17
19
|
return null;
|
18
20
|
}
|
21
|
+
|
19
22
|
const {
|
20
23
|
baseUrl,
|
21
24
|
changeRequestId,
|
@@ -24,4 +27,5 @@ const createChangeRequestUrl = params => {
|
|
24
27
|
} = params;
|
25
28
|
return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;
|
26
29
|
};
|
30
|
+
|
27
31
|
exports.createChangeRequestUrl = createChangeRequestUrl;
|
@@ -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"],"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,MAAD,IAAoB;EACtD;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAX,IAAkBD,MAAlB,EAA0B;IACtB,IAAI,CAAC,CAACC,GAAN,EAAW;MACP;IACH;;IACDC,OAAO,CAACC,GAAR,CAAa,qBAAoBF,GAAI,0CAArC;IACA,OAAO,IAAP;EACH;;EACD,MAAM;IAAEG,OAAF;IAAWC,eAAX;IAA4BC,eAA5B;IAA6CC;EAA7C,IAAwDP,MAA9D;EAEA,OAAQ,GAAEI,OAAQ,wBAAuBE,eAAgB,IAAGC,MAAO,IAAGF,eAAgB,EAAtF;AACH,CAfM"}
|
@@ -1,51 +1,68 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.attachCommentAfterCreate = void 0;
|
9
|
+
|
8
10
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
+
|
9
12
|
var _utils = require("../../utils");
|
13
|
+
|
10
14
|
var _contentUrl = require("./contentUrl");
|
15
|
+
|
11
16
|
var _commentUrl = require("./commentUrl");
|
17
|
+
|
12
18
|
var _reviewers = require("./reviewers");
|
19
|
+
|
13
20
|
var _sendCommentNotification = require("./sendCommentNotification");
|
21
|
+
|
14
22
|
var _appUrl = require("./appUrl");
|
23
|
+
|
15
24
|
const attachCommentAfterCreate = context => {
|
16
25
|
context.apw.comment.onCommentAfterCreate.subscribe(async ({
|
17
26
|
comment
|
18
27
|
}) => {
|
19
28
|
const execute = async () => {
|
20
29
|
const changeRequest = await context.apw.changeRequest.get(comment.changeRequest);
|
30
|
+
|
21
31
|
if (!changeRequest) {
|
22
32
|
throw new _error.default("Missing change request.", "CHANGE_REQUEST_NOT_FOUND", {
|
23
33
|
changeRequest: comment.changeRequest,
|
24
34
|
comment: comment.id
|
25
35
|
});
|
26
36
|
}
|
37
|
+
|
27
38
|
const {
|
28
39
|
id: contentReviewId,
|
29
40
|
stepId
|
30
41
|
} = (0, _utils.extractContentReviewIdAndStep)(changeRequest.step);
|
42
|
+
|
31
43
|
if (!stepId) {
|
32
44
|
throw new _error.default("Malformed changeRequest.step value.", "MALFORMED_VALUE", {
|
33
45
|
step: changeRequest.step
|
34
46
|
});
|
35
47
|
}
|
48
|
+
|
36
49
|
const settings = await (0, _appUrl.getAppUrl)(context);
|
50
|
+
|
37
51
|
if (!settings) {
|
38
52
|
return;
|
39
53
|
}
|
40
54
|
/**
|
41
55
|
* We will check if we can create a comment url before we go digging further into the database.
|
42
56
|
*/
|
57
|
+
|
58
|
+
|
43
59
|
const commentUrl = (0, _commentUrl.createCommentUrl)({
|
44
60
|
baseUrl: settings.appUrl,
|
45
61
|
changeRequestId: changeRequest.id,
|
46
62
|
contentReviewId,
|
47
63
|
stepId
|
48
64
|
});
|
65
|
+
|
49
66
|
if (!commentUrl) {
|
50
67
|
console.log("No comment url.");
|
51
68
|
return;
|
@@ -53,7 +70,10 @@ const attachCommentAfterCreate = context => {
|
|
53
70
|
/**
|
54
71
|
* Let's see if content review exists.
|
55
72
|
*/
|
73
|
+
|
74
|
+
|
56
75
|
const contentReview = await context.apw.contentReview.get(contentReviewId);
|
76
|
+
|
57
77
|
if (!contentReview) {
|
58
78
|
throw new _error.default(`There is no contentReview with id "${contentReviewId}".`, "CONTENT_REVIEW_NOT_FOUND", {
|
59
79
|
contentReviewId
|
@@ -62,31 +82,39 @@ const attachCommentAfterCreate = context => {
|
|
62
82
|
/**
|
63
83
|
* We go and check the workflow.
|
64
84
|
*/
|
85
|
+
|
86
|
+
|
65
87
|
const workflow = await context.apw.workflow.get(contentReview.workflowId);
|
88
|
+
|
66
89
|
if (!workflow) {
|
67
90
|
throw new _error.default(`There is no workflow with workflowId "${contentReview.workflowId}".`, "WORKFLOW_NOT_FOUND", {
|
68
91
|
workflowId: contentReview.workflowId
|
69
92
|
});
|
70
93
|
}
|
94
|
+
|
71
95
|
const contentUrl = (0, _contentUrl.createContentUrl)({
|
72
96
|
plugins: context.plugins,
|
73
97
|
baseUrl: settings.appUrl,
|
74
98
|
contentReview,
|
75
99
|
workflow
|
76
100
|
});
|
101
|
+
|
77
102
|
if (!contentUrl) {
|
78
103
|
console.log("No content url.");
|
79
104
|
return;
|
80
105
|
}
|
106
|
+
|
81
107
|
const reviewers = await (0, _reviewers.fetchReviewers)({
|
82
108
|
context,
|
83
109
|
workflow,
|
84
110
|
exclude: [comment.createdBy.id]
|
85
111
|
});
|
112
|
+
|
86
113
|
if (reviewers.length === 0) {
|
87
114
|
console.log("No reviewers to send the e-mail notification to.");
|
88
115
|
return;
|
89
116
|
}
|
117
|
+
|
90
118
|
try {
|
91
119
|
await (0, _sendCommentNotification.sendCommentNotification)({
|
92
120
|
context,
|
@@ -114,6 +142,7 @@ const attachCommentAfterCreate = context => {
|
|
114
142
|
});
|
115
143
|
}
|
116
144
|
};
|
145
|
+
|
117
146
|
try {
|
118
147
|
context.security.disableAuthorization();
|
119
148
|
await execute();
|
@@ -124,4 +153,5 @@ const attachCommentAfterCreate = context => {
|
|
124
153
|
}
|
125
154
|
});
|
126
155
|
};
|
156
|
+
|
127
157
|
exports.attachCommentAfterCreate = attachCommentAfterCreate;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["attachCommentAfterCreate","context","apw","comment","onCommentAfterCreate","subscribe","execute","changeRequest","get","WebinyError","id","contentReviewId","stepId","extractContentReviewIdAndStep","step","settings","getAppUrl","commentUrl","createCommentUrl","baseUrl","appUrl","changeRequestId","console","log","contentReview","workflow","workflowId","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","length","sendCommentNotification","ex","commentId","error","message","code","data","stack","security","disableAuthorization","enableAuthorization"],"sources":["commentAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { createCommentUrl } from \"./commentUrl\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { sendCommentNotification } from \"./sendCommentNotification\";\nimport { getAppUrl } from \"~/plugins/hooks/notifications/appUrl\";\n\nexport const attachCommentAfterCreate = (context: ApwContext): void => {\n context.apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n const execute = async () => {\n const changeRequest = await context.apw.changeRequest.get(comment.changeRequest);\n if (!changeRequest) {\n throw new WebinyError(\"Missing change request.\", \"CHANGE_REQUEST_NOT_FOUND\", {\n changeRequest: comment.changeRequest,\n comment: comment.id\n });\n }\n\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 commentUrl = createCommentUrl({\n baseUrl: settings.appUrl,\n changeRequestId: changeRequest.id,\n contentReviewId,\n stepId\n });\n if (!commentUrl) {\n console.log(\"No comment url.\");\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 console.log(\"No content url.\");\n return;\n }\n\n const reviewers = await fetchReviewers({\n context,\n workflow,\n exclude: [comment.createdBy.id]\n });\n\n if (reviewers.length === 0) {\n console.log(\"No reviewers to send the e-mail notification to.\");\n return;\n }\n\n try {\n await sendCommentNotification({\n context,\n reviewers,\n changeRequest,\n contentReview,\n workflow,\n commentUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send comment notifications.`,\n \"COMMENT_NOTIFICATIONS_NOT_SENT\",\n {\n commentId: comment.id,\n workflowId: workflow.id,\n changeRequestId: changeRequest.id,\n contentReviewId,\n commentUrl,\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 try {\n context.security.disableAuthorization();\n await execute();\n } catch (ex) {\n throw ex;\n } finally {\n context.security.enableAuthorization();\n }\n });\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["attachCommentAfterCreate","context","apw","comment","onCommentAfterCreate","subscribe","execute","changeRequest","get","WebinyError","id","contentReviewId","stepId","extractContentReviewIdAndStep","step","settings","getAppUrl","commentUrl","createCommentUrl","baseUrl","appUrl","changeRequestId","console","log","contentReview","workflow","workflowId","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","length","sendCommentNotification","ex","commentId","error","message","code","data","stack","security","disableAuthorization","enableAuthorization"],"sources":["commentAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { createCommentUrl } from \"./commentUrl\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { sendCommentNotification } from \"./sendCommentNotification\";\nimport { getAppUrl } from \"~/plugins/hooks/notifications/appUrl\";\n\nexport const attachCommentAfterCreate = (context: ApwContext): void => {\n context.apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n const execute = async () => {\n const changeRequest = await context.apw.changeRequest.get(comment.changeRequest);\n if (!changeRequest) {\n throw new WebinyError(\"Missing change request.\", \"CHANGE_REQUEST_NOT_FOUND\", {\n changeRequest: comment.changeRequest,\n comment: comment.id\n });\n }\n\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 commentUrl = createCommentUrl({\n baseUrl: settings.appUrl,\n changeRequestId: changeRequest.id,\n contentReviewId,\n stepId\n });\n if (!commentUrl) {\n console.log(\"No comment url.\");\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 console.log(\"No content url.\");\n return;\n }\n\n const reviewers = await fetchReviewers({\n context,\n workflow,\n exclude: [comment.createdBy.id]\n });\n\n if (reviewers.length === 0) {\n console.log(\"No reviewers to send the e-mail notification to.\");\n return;\n }\n\n try {\n await sendCommentNotification({\n context,\n reviewers,\n changeRequest,\n contentReview,\n workflow,\n commentUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send comment notifications.`,\n \"COMMENT_NOTIFICATIONS_NOT_SENT\",\n {\n commentId: comment.id,\n workflowId: workflow.id,\n changeRequestId: changeRequest.id,\n contentReviewId,\n commentUrl,\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 try {\n context.security.disableAuthorization();\n await execute();\n } catch (ex) {\n throw ex;\n } finally {\n context.security.enableAuthorization();\n }\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,wBAAwB,GAAIC,OAAD,IAA+B;EACnEA,OAAO,CAACC,GAAR,CAAYC,OAAZ,CAAoBC,oBAApB,CAAyCC,SAAzC,CAAmD,OAAO;IAAEF;EAAF,CAAP,KAAuB;IACtE,MAAMG,OAAO,GAAG,YAAY;MACxB,MAAMC,aAAa,GAAG,MAAMN,OAAO,CAACC,GAAR,CAAYK,aAAZ,CAA0BC,GAA1B,CAA8BL,OAAO,CAACI,aAAtC,CAA5B;;MACA,IAAI,CAACA,aAAL,EAAoB;QAChB,MAAM,IAAIE,cAAJ,CAAgB,yBAAhB,EAA2C,0BAA3C,EAAuE;UACzEF,aAAa,EAAEJ,OAAO,CAACI,aADkD;UAEzEJ,OAAO,EAAEA,OAAO,CAACO;QAFwD,CAAvE,CAAN;MAIH;;MAED,MAAM;QAAEA,EAAE,EAAEC,eAAN;QAAuBC;MAAvB,IAAkC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KU;MACNnC,OAAO,CAAC0C,QAAR,CAAiBE,mBAAjB;IACH;EACJ,CA7HD;AA8HH,CA/HM"}
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createCommentUrl = void 0;
|
7
|
+
|
7
8
|
const createCommentUrl = params => {
|
8
9
|
/**
|
9
10
|
* All variables must exist for URL to be created.
|
@@ -13,9 +14,11 @@ const createCommentUrl = params => {
|
|
13
14
|
if (!!key) {
|
14
15
|
continue;
|
15
16
|
}
|
17
|
+
|
16
18
|
console.log(`Missing variable "${key}", which we use to create a comment URL.`);
|
17
19
|
return null;
|
18
20
|
}
|
21
|
+
|
19
22
|
const {
|
20
23
|
baseUrl,
|
21
24
|
changeRequestId,
|
@@ -24,4 +27,5 @@ const createCommentUrl = params => {
|
|
24
27
|
} = params;
|
25
28
|
return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;
|
26
29
|
};
|
30
|
+
|
27
31
|
exports.createCommentUrl = createCommentUrl;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createCommentUrl","params","key","console","log","baseUrl","changeRequestId","contentReviewId","stepId"],"sources":["commentUrl.ts"],"sourcesContent":["interface CreateCommentUrlParams {\n baseUrl?: string;\n changeRequestId: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createCommentUrl = (params: CreateCommentUrlParams): string | null => {\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":["createCommentUrl","params","key","console","log","baseUrl","changeRequestId","contentReviewId","stepId"],"sources":["commentUrl.ts"],"sourcesContent":["interface CreateCommentUrlParams {\n baseUrl?: string;\n changeRequestId: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createCommentUrl = (params: CreateCommentUrlParams): string | null => {\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,gBAAgB,GAAIC,MAAD,IAAmD;EAC/E;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAX,IAAkBD,MAAlB,EAA0B;IACtB,IAAI,CAAC,CAACC,GAAN,EAAW;MACP;IACH;;IACDC,OAAO,CAACC,GAAR,CAAa,qBAAoBF,GAAI,0CAArC;IACA,OAAO,IAAP;EACH;;EACD,MAAM;IAAEG,OAAF;IAAWC,eAAX;IAA4BC,eAA5B;IAA6CC;EAA7C,IAAwDP,MAA9D;EAEA,OAAQ,GAAEI,OAAQ,wBAAuBE,eAAgB,IAAGC,MAAO,IAAGF,eAAgB,EAAtF;AACH,CAfM"}
|
@@ -1,16 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4
|
+
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.attachContentReviewAfterCreate = void 0;
|
9
|
+
|
8
10
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
11
|
+
|
9
12
|
var _appUrl = require("./appUrl");
|
13
|
+
|
10
14
|
var _contentReviewUrl = require("./contentReviewUrl");
|
15
|
+
|
11
16
|
var _contentUrl = require("./contentUrl");
|
17
|
+
|
12
18
|
var _reviewers = require("./reviewers");
|
19
|
+
|
13
20
|
var _sendContentReviewNotification = require("./sendContentReviewNotification");
|
21
|
+
|
14
22
|
const attachContentReviewAfterCreate = context => {
|
15
23
|
context.apw.contentReview.onContentReviewAfterCreate.subscribe(async ({
|
16
24
|
contentReview
|
@@ -19,49 +27,62 @@ const attachContentReviewAfterCreate = context => {
|
|
19
27
|
if (contentReview.steps.length === 0) {
|
20
28
|
return;
|
21
29
|
}
|
30
|
+
|
22
31
|
const [step] = contentReview.steps;
|
32
|
+
|
23
33
|
if (!(step !== null && step !== void 0 && step.id)) {
|
24
34
|
return;
|
25
35
|
}
|
36
|
+
|
26
37
|
const settings = await (0, _appUrl.getAppUrl)(context);
|
38
|
+
|
27
39
|
if (!settings) {
|
28
40
|
return;
|
29
41
|
}
|
42
|
+
|
30
43
|
const contentReviewUrl = (0, _contentReviewUrl.createContentReviewUrl)({
|
31
44
|
baseUrl: settings.appUrl,
|
32
45
|
contentReviewId: contentReview.id,
|
33
46
|
stepId: step.id
|
34
47
|
});
|
48
|
+
|
35
49
|
if (!contentReviewUrl) {
|
36
50
|
return;
|
37
51
|
}
|
38
|
-
|
39
52
|
/**
|
40
53
|
* We go and check the workflow.
|
41
54
|
*/
|
55
|
+
|
56
|
+
|
42
57
|
const workflow = await context.apw.workflow.get(contentReview.workflowId);
|
58
|
+
|
43
59
|
if (!workflow) {
|
44
60
|
throw new _error.default(`There is no workflow with Id "${contentReview.workflowId}".`, "WORKFLOW_NOT_FOUND", {
|
45
61
|
workflowId: contentReview.workflowId
|
46
62
|
});
|
47
63
|
}
|
64
|
+
|
48
65
|
const contentUrl = (0, _contentUrl.createContentUrl)({
|
49
66
|
plugins: context.plugins,
|
50
67
|
baseUrl: settings.appUrl,
|
51
68
|
contentReview,
|
52
69
|
workflow
|
53
70
|
});
|
71
|
+
|
54
72
|
if (!contentUrl) {
|
55
73
|
return;
|
56
74
|
}
|
75
|
+
|
57
76
|
const reviewers = await (0, _reviewers.fetchReviewers)({
|
58
77
|
context,
|
59
78
|
workflow,
|
60
79
|
exclude: [contentReview.createdBy.id]
|
61
80
|
});
|
81
|
+
|
62
82
|
if (reviewers.length === 0) {
|
63
83
|
return;
|
64
84
|
}
|
85
|
+
|
65
86
|
try {
|
66
87
|
await (0, _sendContentReviewNotification.sendContentReviewNotification)({
|
67
88
|
context,
|
@@ -86,6 +107,7 @@ const attachContentReviewAfterCreate = context => {
|
|
86
107
|
});
|
87
108
|
}
|
88
109
|
};
|
110
|
+
|
89
111
|
try {
|
90
112
|
context.security.disableAuthorization();
|
91
113
|
await execute();
|
@@ -96,4 +118,5 @@ const attachContentReviewAfterCreate = context => {
|
|
96
118
|
}
|
97
119
|
});
|
98
120
|
};
|
121
|
+
|
99
122
|
exports.attachContentReviewAfterCreate = attachContentReviewAfterCreate;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["attachContentReviewAfterCreate","context","apw","contentReview","onContentReviewAfterCreate","subscribe","execute","steps","length","step","id","settings","getAppUrl","contentReviewUrl","createContentReviewUrl","baseUrl","appUrl","contentReviewId","stepId","workflow","get","workflowId","WebinyError","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","sendContentReviewNotification","ex","error","message","code","data","stack","security","disableAuthorization","enableAuthorization"],"sources":["contentReviewAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { getAppUrl } from \"./appUrl\";\nimport { createContentReviewUrl } from \"./contentReviewUrl\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { sendContentReviewNotification } from \"./sendContentReviewNotification\";\n\nexport const attachContentReviewAfterCreate = (context: ApwContext): void => {\n context.apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const execute = async () => {\n if (contentReview.steps.length === 0) {\n return;\n }\n const [step] = contentReview.steps;\n if (!step?.id) {\n return;\n }\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n\n const contentReviewUrl = createContentReviewUrl({\n baseUrl: settings.appUrl,\n contentReviewId: contentReview.id,\n stepId: step.id\n });\n if (!contentReviewUrl) {\n return;\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 Id \"${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: [contentReview.createdBy.id]\n });\n if (reviewers.length === 0) {\n return;\n }\n\n try {\n await sendContentReviewNotification({\n context,\n reviewers,\n contentReview,\n workflow,\n contentReviewUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send content review notifications.`,\n \"CONTENT_REVIEW_NOTIFICATIONS_NOT_SENT\",\n {\n workflowId: workflow.id,\n contentReviewId: contentReview.id,\n contentReviewUrl,\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 try {\n context.security.disableAuthorization();\n await execute();\n } catch (ex) {\n throw ex;\n } finally {\n context.security.enableAuthorization();\n }\n });\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["attachContentReviewAfterCreate","context","apw","contentReview","onContentReviewAfterCreate","subscribe","execute","steps","length","step","id","settings","getAppUrl","contentReviewUrl","createContentReviewUrl","baseUrl","appUrl","contentReviewId","stepId","workflow","get","workflowId","WebinyError","contentUrl","createContentUrl","plugins","reviewers","fetchReviewers","exclude","createdBy","sendContentReviewNotification","ex","error","message","code","data","stack","security","disableAuthorization","enableAuthorization"],"sources":["contentReviewAfterCreate.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { ApwContext } from \"~/types\";\nimport { getAppUrl } from \"./appUrl\";\nimport { createContentReviewUrl } from \"./contentReviewUrl\";\nimport { createContentUrl } from \"./contentUrl\";\nimport { fetchReviewers } from \"./reviewers\";\nimport { sendContentReviewNotification } from \"./sendContentReviewNotification\";\n\nexport const attachContentReviewAfterCreate = (context: ApwContext): void => {\n context.apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const execute = async () => {\n if (contentReview.steps.length === 0) {\n return;\n }\n const [step] = contentReview.steps;\n if (!step?.id) {\n return;\n }\n const settings = await getAppUrl(context);\n if (!settings) {\n return;\n }\n\n const contentReviewUrl = createContentReviewUrl({\n baseUrl: settings.appUrl,\n contentReviewId: contentReview.id,\n stepId: step.id\n });\n if (!contentReviewUrl) {\n return;\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 Id \"${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: [contentReview.createdBy.id]\n });\n if (reviewers.length === 0) {\n return;\n }\n\n try {\n await sendContentReviewNotification({\n context,\n reviewers,\n contentReview,\n workflow,\n contentReviewUrl,\n contentUrl\n });\n } catch (ex) {\n throw new WebinyError(\n `Could not send content review notifications.`,\n \"CONTENT_REVIEW_NOTIFICATIONS_NOT_SENT\",\n {\n workflowId: workflow.id,\n contentReviewId: contentReview.id,\n contentReviewUrl,\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 try {\n context.security.disableAuthorization();\n await execute();\n } catch (ex) {\n throw ex;\n } finally {\n context.security.enableAuthorization();\n }\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,8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iB;QACb;MACH;;MAED,MAAMG,SAAS,GAAG,MAAM,IAAAC,yBAAA,EAAe;QACnC1B,OADmC;QAEnCkB,QAFmC;QAGnCS,OAAO,EAAE,CAACzB,aAAa,CAAC0B,SAAd,CAAwBnB,EAAzB;MAH0B,CAAf,CAAxB;;MAKA,IAAIgB,SAAS,CAAClB,MAAV,KAAqB,CAAzB,EAA4B;QACxB;MACH;;MAED,IAAI;QACA,MAAM,IAAAsB,4DAAA,EAA8B;UAChC7B,OADgC;UAEhCyB,SAFgC;UAGhCvB,aAHgC;UAIhCgB,QAJgC;UAKhCN,gBALgC;UAMhCU;QANgC,CAA9B,CAAN;MAQH,CATD,CASE,OAAOQ,EAAP,EAAW;QACT,MAAM,IAAIT,cAAJ,CACD,8CADC,EAEF,uCAFE,EAGF;UACID,UAAU,EAAEF,QAAQ,CAACT,EADzB;UAEIO,eAAe,EAAEd,aAAa,CAACO,EAFnC;UAGIG,gBAHJ;UAIIU,UAJJ;UAKIS,KAAK,EAAE;YACHC,OAAO,EAAEF,EAAE,CAACE,OADT;YAEHC,IAAI,EAAEH,EAAE,CAACG,IAFN;YAGHC,IAAI,EAAEJ,EAAE,CAACI,IAHN;YAIHC,KAAK,EAAEL,EAAE,CAACK;UAJP;QALX,CAHE,CAAN;MAgBH;IACJ,CAlFD;;IAoFA,IAAI;MACAnC,OAAO,CAACoC,QAAR,CAAiBC,oBAAjB;MACA,MAAMhC,OAAO,EAAb;IACH,CAHD,CAGE,OAAOyB,EAAP,EAAW;MACT,MAAMA,EAAN;IACH,CALD,SAKU;MACN9B,OAAO,CAACoC,QAAR,CAAiBE,mBAAjB;IACH;EACJ,CA7FD;AA8FH,CA/FM"}
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createContentReviewUrl = void 0;
|
7
|
+
|
7
8
|
const createContentReviewUrl = params => {
|
8
9
|
/**
|
9
10
|
* All variables must exist for URL to be created.
|
@@ -13,9 +14,11 @@ const createContentReviewUrl = params => {
|
|
13
14
|
if (!!key) {
|
14
15
|
continue;
|
15
16
|
}
|
17
|
+
|
16
18
|
console.log(`Missing variable "${key}", which we use to create a comment URL.`);
|
17
19
|
return null;
|
18
20
|
}
|
21
|
+
|
19
22
|
const {
|
20
23
|
baseUrl,
|
21
24
|
contentReviewId,
|
@@ -23,4 +26,5 @@ const createContentReviewUrl = params => {
|
|
23
26
|
} = params;
|
24
27
|
return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}`;
|
25
28
|
};
|
29
|
+
|
26
30
|
exports.createContentReviewUrl = createContentReviewUrl;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createContentReviewUrl","params","key","console","log","baseUrl","contentReviewId","stepId"],"sources":["contentReviewUrl.ts"],"sourcesContent":["interface Params {\n baseUrl?: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createContentReviewUrl = (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, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}`;\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["createContentReviewUrl","params","key","console","log","baseUrl","contentReviewId","stepId"],"sources":["contentReviewUrl.ts"],"sourcesContent":["interface Params {\n baseUrl?: string;\n contentReviewId: string;\n stepId: string;\n}\nexport const createContentReviewUrl = (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, contentReviewId, stepId } = params;\n\n return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}`;\n};\n"],"mappings":";;;;;;;AAKO,MAAMA,sBAAsB,GAAIC,MAAD,IAAoB;EACtD;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAX,IAAkBD,MAAlB,EAA0B;IACtB,IAAI,CAAC,CAACC,GAAN,EAAW;MACP;IACH;;IACDC,OAAO,CAACC,GAAR,CAAa,qBAAoBF,GAAI,0CAArC;IACA,OAAO,IAAP;EACH;;EACD,MAAM;IAAEG,OAAF;IAAWC,eAAX;IAA4BC;EAA5B,IAAuCN,MAA7C;EAEA,OAAQ,GAAEI,OAAQ,wBAAuBC,eAAgB,IAAGC,MAAO,EAAnE;AACH,CAfM"}
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.createContentUrl = void 0;
|
7
|
+
|
7
8
|
var _ApwContentUrlPlugin = require("../../../ApwContentUrlPlugin");
|
9
|
+
|
8
10
|
const createContentUrl = params => {
|
9
11
|
const {
|
10
12
|
plugins,
|
@@ -16,9 +18,12 @@ const createContentUrl = params => {
|
|
16
18
|
const [contentUrlPlugin] = plugins.byType(_ApwContentUrlPlugin.ApwContentUrlPlugin.type).filter(plugin => {
|
17
19
|
return plugin.canUse(contentType);
|
18
20
|
}).reverse();
|
21
|
+
|
19
22
|
if (!contentUrlPlugin) {
|
20
23
|
return null;
|
21
24
|
}
|
25
|
+
|
22
26
|
return contentUrlPlugin.create(params);
|
23
27
|
};
|
28
|
+
|
24
29
|
exports.createContentUrl = createContentUrl;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["createContentUrl","params","plugins","contentReview","type","contentType","content","contentUrlPlugin","byType","ApwContentUrlPlugin","filter","plugin","canUse","reverse","create"],"sources":["contentUrl.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport { ApwContentUrlPlugin, ApwContentUrlPluginCbParams } from \"~/ApwContentUrlPlugin\";\n\ninterface Params extends ApwContentUrlPluginCbParams {\n plugins: PluginsContainer;\n}\n\nexport const createContentUrl = (params: Params): string | null => {\n const { plugins, contentReview } = params;\n\n const { type: contentType } = contentReview.content;\n\n const [contentUrlPlugin] = plugins\n .byType<ApwContentUrlPlugin>(ApwContentUrlPlugin.type)\n .filter(plugin => {\n return plugin.canUse(contentType);\n })\n .reverse();\n if (!contentUrlPlugin) {\n return null;\n }\n\n return contentUrlPlugin.create(params);\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["createContentUrl","params","plugins","contentReview","type","contentType","content","contentUrlPlugin","byType","ApwContentUrlPlugin","filter","plugin","canUse","reverse","create"],"sources":["contentUrl.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport { ApwContentUrlPlugin, ApwContentUrlPluginCbParams } from \"~/ApwContentUrlPlugin\";\n\ninterface Params extends ApwContentUrlPluginCbParams {\n plugins: PluginsContainer;\n}\n\nexport const createContentUrl = (params: Params): string | null => {\n const { plugins, contentReview } = params;\n\n const { type: contentType } = contentReview.content;\n\n const [contentUrlPlugin] = plugins\n .byType<ApwContentUrlPlugin>(ApwContentUrlPlugin.type)\n .filter(plugin => {\n return plugin.canUse(contentType);\n })\n .reverse();\n if (!contentUrlPlugin) {\n return null;\n }\n\n return contentUrlPlugin.create(params);\n};\n"],"mappings":";;;;;;;AACA;;AAMO,MAAMA,gBAAgB,GAAIC,MAAD,IAAmC;EAC/D,MAAM;IAAEC,OAAF;IAAWC;EAAX,IAA6BF,MAAnC;EAEA,MAAM;IAAEG,IAAI,EAAEC;EAAR,IAAwBF,aAAa,CAACG,OAA5C;EAEA,MAAM,CAACC,gBAAD,IAAqBL,OAAO,CAC7BM,MADsB,CACMC,wCAAA,CAAoBL,IAD1B,EAEtBM,MAFsB,CAEfC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAP,CAAcP,WAAd,CAAP;EACH,CAJsB,EAKtBQ,OALsB,EAA3B;;EAMA,IAAI,CAACN,gBAAL,EAAuB;IACnB,OAAO,IAAP;EACH;;EAED,OAAOA,gBAAgB,CAACO,MAAjB,CAAwBb,MAAxB,CAAP;AACH,CAhBM"}
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getLastChangeRequestNotificationPlugin = void 0;
|
7
|
+
|
7
8
|
var _ApwChangeRequestNotification = require("../../../ApwChangeRequestNotification");
|
9
|
+
|
8
10
|
const getLastChangeRequestNotificationPlugin = params => {
|
9
11
|
const {
|
10
12
|
context,
|
@@ -13,9 +15,11 @@ const getLastChangeRequestNotificationPlugin = params => {
|
|
13
15
|
/**
|
14
16
|
* We need the plugin to create the notification text.
|
15
17
|
*/
|
18
|
+
|
16
19
|
const plugins = context.plugins.byType(_ApwChangeRequestNotification.ApwChangeRequestNotification.type).filter(plugin => {
|
17
20
|
return plugin.canUse(type);
|
18
21
|
});
|
19
22
|
return plugins.shift();
|
20
23
|
};
|
24
|
+
|
21
25
|
exports.getLastChangeRequestNotificationPlugin = getLastChangeRequestNotificationPlugin;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getLastChangeRequestNotificationPlugin","params","context","type","plugins","byType","ApwChangeRequestNotification","filter","plugin","canUse","shift"],"sources":["lastChangeRequestNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwChangeRequestNotification } from \"~/ApwChangeRequestNotification\";\n\ninterface GetLastChangeRequestNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastChangeRequestNotificationPlugin {\n (params: GetLastChangeRequestNotificationPluginParams):\n | ApwChangeRequestNotification\n | undefined;\n}\nexport const getLastChangeRequestNotificationPlugin: GetLastChangeRequestNotificationPlugin =\n params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwChangeRequestNotification>(ApwChangeRequestNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n };\n"],"mappings":"
|
1
|
+
{"version":3,"names":["getLastChangeRequestNotificationPlugin","params","context","type","plugins","byType","ApwChangeRequestNotification","filter","plugin","canUse","shift"],"sources":["lastChangeRequestNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwChangeRequestNotification } from \"~/ApwChangeRequestNotification\";\n\ninterface GetLastChangeRequestNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastChangeRequestNotificationPlugin {\n (params: GetLastChangeRequestNotificationPluginParams):\n | ApwChangeRequestNotification\n | undefined;\n}\nexport const getLastChangeRequestNotificationPlugin: GetLastChangeRequestNotificationPlugin =\n params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwChangeRequestNotification>(ApwChangeRequestNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n };\n"],"mappings":";;;;;;;AACA;;AAWO,MAAMA,sCAA8E,GACvFC,MAAM,IAAI;EACN,MAAM;IAAEC,OAAF;IAAWC;EAAX,IAAoBF,MAA1B;EACA;AACR;AACA;;EACQ,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAR,CACXC,MADW,CAC0BC,0DAAA,CAA6BH,IADvD,EAEXI,MAFW,CAEJC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAP,CAAcN,IAAd,CAAP;EACH,CAJW,CAAhB;EAMA,OAAOC,OAAO,CAACM,KAAR,EAAP;AACH,CAbE"}
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getLastCommentNotificationPlugin = void 0;
|
7
|
+
|
7
8
|
var _ApwCommentNotification = require("../../../ApwCommentNotification");
|
9
|
+
|
8
10
|
const getLastCommentNotificationPlugin = params => {
|
9
11
|
const {
|
10
12
|
context,
|
@@ -13,9 +15,11 @@ const getLastCommentNotificationPlugin = params => {
|
|
13
15
|
/**
|
14
16
|
* We need the plugin to create the notification text.
|
15
17
|
*/
|
18
|
+
|
16
19
|
const plugins = context.plugins.byType(_ApwCommentNotification.ApwCommentNotification.type).filter(plugin => {
|
17
20
|
return plugin.canUse(type);
|
18
21
|
});
|
19
22
|
return plugins.shift();
|
20
23
|
};
|
24
|
+
|
21
25
|
exports.getLastCommentNotificationPlugin = getLastCommentNotificationPlugin;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getLastCommentNotificationPlugin","params","context","type","plugins","byType","ApwCommentNotification","filter","plugin","canUse","shift"],"sources":["lastCommentNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwCommentNotification } from \"~/ApwCommentNotification\";\n\ninterface GetLastCommentNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastCommentNotificationPlugin {\n (params: GetLastCommentNotificationPluginParams): ApwCommentNotification | undefined;\n}\nexport const getLastCommentNotificationPlugin: GetLastCommentNotificationPlugin = params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwCommentNotification>(ApwCommentNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["getLastCommentNotificationPlugin","params","context","type","plugins","byType","ApwCommentNotification","filter","plugin","canUse","shift"],"sources":["lastCommentNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwCommentNotification } from \"~/ApwCommentNotification\";\n\ninterface GetLastCommentNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastCommentNotificationPlugin {\n (params: GetLastCommentNotificationPluginParams): ApwCommentNotification | undefined;\n}\nexport const getLastCommentNotificationPlugin: GetLastCommentNotificationPlugin = params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwCommentNotification>(ApwCommentNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n};\n"],"mappings":";;;;;;;AACA;;AASO,MAAMA,gCAAkE,GAAGC,MAAM,IAAI;EACxF,MAAM;IAAEC,OAAF;IAAWC;EAAX,IAAoBF,MAA1B;EACA;AACJ;AACA;;EACI,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAR,CACXC,MADW,CACoBC,8CAAA,CAAuBH,IAD3C,EAEXI,MAFW,CAEJC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAP,CAAcN,IAAd,CAAP;EACH,CAJW,CAAhB;EAMA,OAAOC,OAAO,CAACM,KAAR,EAAP;AACH,CAZM"}
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.getLastContentReviewNotificationPlugin = void 0;
|
7
|
+
|
7
8
|
var _ApwContentReviewNotification = require("../../../ApwContentReviewNotification");
|
9
|
+
|
8
10
|
const getLastContentReviewNotificationPlugin = params => {
|
9
11
|
const {
|
10
12
|
context,
|
@@ -13,9 +15,11 @@ const getLastContentReviewNotificationPlugin = params => {
|
|
13
15
|
/**
|
14
16
|
* We need the plugin to create the notification text.
|
15
17
|
*/
|
18
|
+
|
16
19
|
const plugins = context.plugins.byType(_ApwContentReviewNotification.ApwContentReviewNotification.type).filter(plugin => {
|
17
20
|
return plugin.canUse(type);
|
18
21
|
});
|
19
22
|
return plugins.shift();
|
20
23
|
};
|
24
|
+
|
21
25
|
exports.getLastContentReviewNotificationPlugin = getLastContentReviewNotificationPlugin;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getLastContentReviewNotificationPlugin","params","context","type","plugins","byType","ApwContentReviewNotification","filter","plugin","canUse","shift"],"sources":["lastContentReviewNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwContentReviewNotification } from \"~/ApwContentReviewNotification\";\n\ninterface GetLastContentReviewNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastContentReviewNotificationPlugin {\n (params: GetLastContentReviewNotificationPluginParams):\n | ApwContentReviewNotification\n | undefined;\n}\nexport const getLastContentReviewNotificationPlugin: GetLastContentReviewNotificationPlugin =\n params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwContentReviewNotification>(ApwContentReviewNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n };\n"],"mappings":"
|
1
|
+
{"version":3,"names":["getLastContentReviewNotificationPlugin","params","context","type","plugins","byType","ApwContentReviewNotification","filter","plugin","canUse","shift"],"sources":["lastContentReviewNotificationPlugin.ts"],"sourcesContent":["import { ApwContentTypes, ApwContext } from \"~/types\";\nimport { ApwContentReviewNotification } from \"~/ApwContentReviewNotification\";\n\ninterface GetLastContentReviewNotificationPluginParams {\n context: ApwContext;\n type: ApwContentTypes;\n}\ninterface GetLastContentReviewNotificationPlugin {\n (params: GetLastContentReviewNotificationPluginParams):\n | ApwContentReviewNotification\n | undefined;\n}\nexport const getLastContentReviewNotificationPlugin: GetLastContentReviewNotificationPlugin =\n params => {\n const { context, type } = params;\n /**\n * We need the plugin to create the notification text.\n */\n const plugins = context.plugins\n .byType<ApwContentReviewNotification>(ApwContentReviewNotification.type)\n .filter(plugin => {\n return plugin.canUse(type);\n });\n\n return plugins.shift();\n };\n"],"mappings":";;;;;;;AACA;;AAWO,MAAMA,sCAA8E,GACvFC,MAAM,IAAI;EACN,MAAM;IAAEC,OAAF;IAAWC;EAAX,IAAoBF,MAA1B;EACA;AACR;AACA;;EACQ,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAR,CACXC,MADW,CAC0BC,0DAAA,CAA6BH,IADvD,EAEXI,MAFW,CAEJC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAP,CAAcN,IAAd,CAAP;EACH,CAJW,CAAhB;EAMA,OAAOC,OAAO,CAACM,KAAR,EAAP;AACH,CAbE"}
|