@webiny/api-apw 0.0.0-unstable.97a151f74d → 0.0.0-unstable.98511f29f1

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.
Files changed (219) hide show
  1. package/ApwChangeRequestNotification.js +0 -10
  2. package/ApwChangeRequestNotification.js.map +1 -1
  3. package/ApwCommentNotification.js +0 -10
  4. package/ApwCommentNotification.js.map +1 -1
  5. package/ApwContentReviewNotification.js +0 -10
  6. package/ApwContentReviewNotification.js.map +1 -1
  7. package/ApwContentUrlPlugin.js +0 -10
  8. package/ApwContentUrlPlugin.js.map +1 -1
  9. package/ContentApwSettingsPlugin.js +0 -5
  10. package/ContentApwSettingsPlugin.js.map +1 -1
  11. package/crud/createChangeRequestMethods.js +4 -11
  12. package/crud/createChangeRequestMethods.js.map +1 -1
  13. package/crud/createCommentMethods.js +4 -12
  14. package/crud/createCommentMethods.js.map +1 -1
  15. package/crud/createContentReviewMethods.js +39 -88
  16. package/crud/createContentReviewMethods.js.map +1 -1
  17. package/crud/createReviewerMethods.js +4 -12
  18. package/crud/createReviewerMethods.js.map +1 -1
  19. package/crud/createWorkflowMethods.js +4 -17
  20. package/crud/createWorkflowMethods.js.map +1 -1
  21. package/crud/index.js +0 -25
  22. package/crud/index.js.map +1 -1
  23. package/crud/utils.js +0 -28
  24. package/crud/utils.js.map +1 -1
  25. package/index.d.ts +1 -2
  26. package/index.js +1 -15
  27. package/index.js.map +1 -1
  28. package/package.json +40 -47
  29. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +0 -15
  30. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  31. package/plugins/cms/apwEntryPlugins.js +0 -8
  32. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  33. package/plugins/cms/index.js +0 -13
  34. package/plugins/cms/index.js.map +1 -1
  35. package/plugins/cms/linkContentReviewToEntry.js +2 -19
  36. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  37. package/plugins/cms/linkWorkflowToEntry.js +9 -38
  38. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  39. package/plugins/cms/notifications/changeRequestNotification.js +0 -4
  40. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
  41. package/plugins/cms/notifications/commentNotification.js +0 -4
  42. package/plugins/cms/notifications/commentNotification.js.map +1 -1
  43. package/plugins/cms/notifications/contentReviewNotification.js +0 -4
  44. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
  45. package/plugins/cms/notifications/contentUrl.js +1 -8
  46. package/plugins/cms/notifications/contentUrl.js.map +1 -1
  47. package/plugins/cms/triggerContentReview.js +3 -17
  48. package/plugins/cms/triggerContentReview.js.map +1 -1
  49. package/plugins/cms/updateContentReviewStatus.js +4 -22
  50. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  51. package/plugins/cms/utils.js +2 -47
  52. package/plugins/cms/utils.js.map +1 -1
  53. package/plugins/context.d.ts +0 -1
  54. package/plugins/context.js +2 -47
  55. package/plugins/context.js.map +1 -1
  56. package/plugins/graphql/changeRequest.gql.js +3 -10
  57. package/plugins/graphql/changeRequest.gql.js.map +1 -1
  58. package/plugins/graphql/comment.gql.js +3 -10
  59. package/plugins/graphql/comment.gql.js.map +1 -1
  60. package/plugins/graphql/contentReview.gql.js +6 -25
  61. package/plugins/graphql/contentReview.gql.js.map +1 -1
  62. package/plugins/graphql/reviewer.gql.js +3 -10
  63. package/plugins/graphql/reviewer.gql.js.map +1 -1
  64. package/plugins/graphql/workflow.gql.js +3 -10
  65. package/plugins/graphql/workflow.gql.js.map +1 -1
  66. package/plugins/graphql.js +3 -18
  67. package/plugins/graphql.js.map +1 -1
  68. package/plugins/hooks/createReviewerFromIdentity.js +2 -11
  69. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  70. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +1 -9
  71. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  72. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +1 -8
  73. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  74. package/plugins/hooks/index.js +0 -14
  75. package/plugins/hooks/index.js.map +1 -1
  76. package/plugins/hooks/initializeContentReviewSteps.js +10 -17
  77. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  78. package/plugins/hooks/initializeNotifications.js +0 -5
  79. package/plugins/hooks/initializeNotifications.js.map +1 -1
  80. package/plugins/hooks/listContentReviews.js +0 -12
  81. package/plugins/hooks/listContentReviews.js.map +1 -1
  82. package/plugins/hooks/notifications/appUrl.js +0 -4
  83. package/plugins/hooks/notifications/appUrl.js.map +1 -1
  84. package/plugins/hooks/notifications/changeRequestAfterCreate.js +3 -36
  85. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
  86. package/plugins/hooks/notifications/changeRequestUrl.js +0 -4
  87. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
  88. package/plugins/hooks/notifications/commentAfterCreate.js +3 -38
  89. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
  90. package/plugins/hooks/notifications/commentUrl.js +0 -4
  91. package/plugins/hooks/notifications/commentUrl.js.map +1 -1
  92. package/plugins/hooks/notifications/contentReviewAfterCreate.js +4 -32
  93. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
  94. package/plugins/hooks/notifications/contentReviewUrl.js +0 -4
  95. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
  96. package/plugins/hooks/notifications/contentUrl.js +0 -5
  97. package/plugins/hooks/notifications/contentUrl.js.map +1 -1
  98. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +0 -4
  99. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
  100. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +0 -4
  101. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
  102. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +0 -4
  103. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
  104. package/plugins/hooks/notifications/reviewers.js +15 -21
  105. package/plugins/hooks/notifications/reviewers.js.map +1 -1
  106. package/plugins/hooks/notifications/sendChangeRequestNotification.js +0 -11
  107. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
  108. package/plugins/hooks/notifications/sendCommentNotification.js +0 -11
  109. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
  110. package/plugins/hooks/notifications/sendContentReviewNotification.js +0 -11
  111. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
  112. package/plugins/hooks/updatePendingChangeRequests.js +0 -8
  113. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  114. package/plugins/hooks/updateTotalComments.js +0 -9
  115. package/plugins/hooks/updateTotalComments.js.map +1 -1
  116. package/plugins/hooks/validateChangeRequest.js +0 -16
  117. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  118. package/plugins/hooks/validateComment.js +1 -12
  119. package/plugins/hooks/validateComment.js.map +1 -1
  120. package/plugins/hooks/validateContentReview.js +0 -6
  121. package/plugins/hooks/validateContentReview.js.map +1 -1
  122. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -15
  123. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
  124. package/plugins/pageBuilder/apwContentPagePlugins.js +0 -4
  125. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
  126. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +1 -6
  127. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
  128. package/plugins/pageBuilder/index.js +0 -11
  129. package/plugins/pageBuilder/index.js.map +1 -1
  130. package/plugins/pageBuilder/linkContentReviewToPage.js +2 -18
  131. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
  132. package/plugins/pageBuilder/linkWorkflowToPage.js +1 -31
  133. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  134. package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -4
  135. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
  136. package/plugins/pageBuilder/notifications/commentNotification.js +0 -4
  137. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
  138. package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -4
  139. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
  140. package/plugins/pageBuilder/notifications/contentUrl.js +1 -7
  141. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
  142. package/plugins/pageBuilder/triggerContentReview.js +0 -11
  143. package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
  144. package/plugins/pageBuilder/updateContentReviewStatus.js +0 -12
  145. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
  146. package/plugins/pageBuilder/utils.js +1 -35
  147. package/plugins/pageBuilder/utils.js.map +1 -1
  148. package/plugins/utils.js +0 -43
  149. package/plugins/utils.js.map +1 -1
  150. package/scheduler/createScheduleActionMethods.js +3 -27
  151. package/scheduler/createScheduleActionMethods.js.map +1 -1
  152. package/scheduler/handlers/executeAction/index.d.ts +1 -1
  153. package/scheduler/handlers/executeAction/index.js +45 -39
  154. package/scheduler/handlers/executeAction/index.js.map +1 -1
  155. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
  156. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +14 -5
  157. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  158. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -3
  159. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +7 -23
  160. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  161. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +2 -2
  162. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +7 -86
  163. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  164. package/scheduler/handlers/executeAction/security.js +0 -11
  165. package/scheduler/handlers/executeAction/security.js.map +1 -1
  166. package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
  167. package/scheduler/handlers/scheduleAction/index.js +13 -29
  168. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  169. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +4 -23
  170. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  171. package/scheduler/handlers/utils.d.ts +1 -2
  172. package/scheduler/handlers/utils.js +3 -41
  173. package/scheduler/handlers/utils.js.map +1 -1
  174. package/scheduler/index.js +0 -3
  175. package/scheduler/index.js.map +1 -1
  176. package/scheduler/types.d.ts +2 -20
  177. package/scheduler/types.js +12 -23
  178. package/scheduler/types.js.map +1 -1
  179. package/storageOperations/changeRequestStorageOperations.js +20 -39
  180. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  181. package/storageOperations/commentStorageOperations.js +23 -44
  182. package/storageOperations/commentStorageOperations.js.map +1 -1
  183. package/storageOperations/contentReviewStorageOperations.js +20 -37
  184. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  185. package/storageOperations/index.js +0 -14
  186. package/storageOperations/index.js.map +1 -1
  187. package/storageOperations/models/changeRequest.model.js +0 -9
  188. package/storageOperations/models/changeRequest.model.js.map +1 -1
  189. package/storageOperations/models/comment.model.js +0 -8
  190. package/storageOperations/models/comment.model.js.map +1 -1
  191. package/storageOperations/models/contentModelPluginFactory.d.ts +3 -10
  192. package/storageOperations/models/contentModelPluginFactory.js +3 -11
  193. package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
  194. package/storageOperations/models/contentReview.model.js +0 -26
  195. package/storageOperations/models/contentReview.model.js.map +1 -1
  196. package/storageOperations/models/index.js +2 -28
  197. package/storageOperations/models/index.js.map +1 -1
  198. package/storageOperations/models/reviewer.model.js +0 -8
  199. package/storageOperations/models/reviewer.model.js.map +1 -1
  200. package/storageOperations/models/utils.js +0 -4
  201. package/storageOperations/models/utils.js.map +1 -1
  202. package/storageOperations/models/workflow.model.js +0 -23
  203. package/storageOperations/models/workflow.model.js.map +1 -1
  204. package/storageOperations/reviewerStorageOperations.js +23 -45
  205. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  206. package/storageOperations/workflowStorageOperations.js +20 -39
  207. package/storageOperations/workflowStorageOperations.js.map +1 -1
  208. package/types.d.ts +6 -5
  209. package/types.js +124 -42
  210. package/types.js.map +1 -1
  211. package/utils/contentApwSettingsPlugin.js +0 -6
  212. package/utils/contentApwSettingsPlugin.js.map +1 -1
  213. package/utils/errors.js +0 -17
  214. package/utils/errors.js.map +1 -1
  215. package/utils/fieldResolver.js +2 -12
  216. package/utils/fieldResolver.js.map +1 -1
  217. package/utils/resolve.d.ts +1 -1
  218. package/utils/resolve.js +0 -3
  219. package/utils/resolve.js.map +1 -1
@@ -1,24 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.attachContentReviewAfterCreate = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  var _appUrl = require("./appUrl");
13
-
14
10
  var _contentReviewUrl = require("./contentReviewUrl");
15
-
16
11
  var _contentUrl = require("./contentUrl");
17
-
18
12
  var _reviewers = require("./reviewers");
19
-
20
13
  var _sendContentReviewNotification = require("./sendContentReviewNotification");
21
-
22
14
  const attachContentReviewAfterCreate = context => {
23
15
  context.apw.contentReview.onContentReviewAfterCreate.subscribe(async ({
24
16
  contentReview
@@ -27,62 +19,49 @@ const attachContentReviewAfterCreate = context => {
27
19
  if (contentReview.steps.length === 0) {
28
20
  return;
29
21
  }
30
-
31
22
  const [step] = contentReview.steps;
32
-
33
23
  if (!(step !== null && step !== void 0 && step.id)) {
34
24
  return;
35
25
  }
36
-
37
26
  const settings = await (0, _appUrl.getAppUrl)(context);
38
-
39
27
  if (!settings) {
40
28
  return;
41
29
  }
42
-
43
30
  const contentReviewUrl = (0, _contentReviewUrl.createContentReviewUrl)({
44
31
  baseUrl: settings.appUrl,
45
32
  contentReviewId: contentReview.id,
46
33
  stepId: step.id
47
34
  });
48
-
49
35
  if (!contentReviewUrl) {
50
36
  return;
51
37
  }
38
+
52
39
  /**
53
40
  * We go and check the workflow.
54
41
  */
55
-
56
-
57
42
  const workflow = await context.apw.workflow.get(contentReview.workflowId);
58
-
59
43
  if (!workflow) {
60
44
  throw new _error.default(`There is no workflow with Id "${contentReview.workflowId}".`, "WORKFLOW_NOT_FOUND", {
61
45
  workflowId: contentReview.workflowId
62
46
  });
63
47
  }
64
-
65
48
  const contentUrl = (0, _contentUrl.createContentUrl)({
66
49
  plugins: context.plugins,
67
50
  baseUrl: settings.appUrl,
68
51
  contentReview,
69
52
  workflow
70
53
  });
71
-
72
54
  if (!contentUrl) {
73
55
  return;
74
56
  }
75
-
76
57
  const reviewers = await (0, _reviewers.fetchReviewers)({
77
58
  context,
78
59
  workflow,
79
60
  exclude: [contentReview.createdBy.id]
80
61
  });
81
-
82
62
  if (reviewers.length === 0) {
83
63
  return;
84
64
  }
85
-
86
65
  try {
87
66
  await (0, _sendContentReviewNotification.sendContentReviewNotification)({
88
67
  context,
@@ -107,16 +86,9 @@ const attachContentReviewAfterCreate = context => {
107
86
  });
108
87
  }
109
88
  };
110
-
111
- try {
112
- context.security.disableAuthorization();
113
- await execute();
114
- } catch (ex) {
115
- throw ex;
116
- } finally {
117
- context.security.enableAuthorization();
118
- }
89
+ await context.security.withoutAuthorization(async () => {
90
+ return execute();
91
+ });
119
92
  });
120
93
  };
121
-
122
94
  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":"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"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_appUrl","_contentReviewUrl","_contentUrl","_reviewers","_sendContentReviewNotification","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","withoutAuthorization","exports"],"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 await context.security.withoutAuthorization(async () => {\n return execute();\n });\n });\n};\n"],"mappings":"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"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createContentReviewUrl = void 0;
7
-
8
7
  const createContentReviewUrl = params => {
9
8
  /**
10
9
  * All variables must exist for URL to be created.
@@ -14,11 +13,9 @@ const createContentReviewUrl = params => {
14
13
  if (!!key) {
15
14
  continue;
16
15
  }
17
-
18
16
  console.log(`Missing variable "${key}", which we use to create a comment URL.`);
19
17
  return null;
20
18
  }
21
-
22
19
  const {
23
20
  baseUrl,
24
21
  contentReviewId,
@@ -26,5 +23,4 @@ const createContentReviewUrl = params => {
26
23
  } = params;
27
24
  return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}`;
28
25
  };
29
-
30
26
  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":";;;;;;;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"}
1
+ {"version":3,"names":["createContentReviewUrl","params","key","console","log","baseUrl","contentReviewId","stepId","exports"],"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,MAAc,IAAK;EACtD;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAE,qBAAoBF,GAAI,0CAAyC,CAAC;IAC/E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC,eAAe;IAAEC;EAAO,CAAC,GAAGN,MAAM;EAEnD,OAAQ,GAAEI,OAAQ,wBAAuBC,eAAgB,IAAGC,MAAO,EAAC;AACxE,CAAC;AAACC,OAAA,CAAAR,sBAAA,GAAAA,sBAAA"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createContentUrl = void 0;
7
-
8
7
  var _ApwContentUrlPlugin = require("../../../ApwContentUrlPlugin");
9
-
10
8
  const createContentUrl = params => {
11
9
  const {
12
10
  plugins,
@@ -18,12 +16,9 @@ const createContentUrl = params => {
18
16
  const [contentUrlPlugin] = plugins.byType(_ApwContentUrlPlugin.ApwContentUrlPlugin.type).filter(plugin => {
19
17
  return plugin.canUse(contentType);
20
18
  }).reverse();
21
-
22
19
  if (!contentUrlPlugin) {
23
20
  return null;
24
21
  }
25
-
26
22
  return contentUrlPlugin.create(params);
27
23
  };
28
-
29
24
  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":";;;;;;;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"}
1
+ {"version":3,"names":["_ApwContentUrlPlugin","require","createContentUrl","params","plugins","contentReview","type","contentType","content","contentUrlPlugin","byType","ApwContentUrlPlugin","filter","plugin","canUse","reverse","create","exports"],"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,IAAAA,oBAAA,GAAAC,OAAA;AAMO,MAAMC,gBAAgB,GAAIC,MAAc,IAAoB;EAC/D,MAAM;IAAEC,OAAO;IAAEC;EAAc,CAAC,GAAGF,MAAM;EAEzC,MAAM;IAAEG,IAAI,EAAEC;EAAY,CAAC,GAAGF,aAAa,CAACG,OAAO;EAEnD,MAAM,CAACC,gBAAgB,CAAC,GAAGL,OAAO,CAC7BM,MAAM,CAAsBC,wCAAmB,CAACL,IAAI,CAAC,CACrDM,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACP,WAAW,CAAC;EACrC,CAAC,CAAC,CACDQ,OAAO,CAAC,CAAC;EACd,IAAI,CAACN,gBAAgB,EAAE;IACnB,OAAO,IAAI;EACf;EAEA,OAAOA,gBAAgB,CAACO,MAAM,CAACb,MAAM,CAAC;AAC1C,CAAC;AAACc,OAAA,CAAAf,gBAAA,GAAAA,gBAAA"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getLastChangeRequestNotificationPlugin = void 0;
7
-
8
7
  var _ApwChangeRequestNotification = require("../../../ApwChangeRequestNotification");
9
-
10
8
  const getLastChangeRequestNotificationPlugin = params => {
11
9
  const {
12
10
  context,
@@ -15,11 +13,9 @@ const getLastChangeRequestNotificationPlugin = params => {
15
13
  /**
16
14
  * We need the plugin to create the notification text.
17
15
  */
18
-
19
16
  const plugins = context.plugins.byType(_ApwChangeRequestNotification.ApwChangeRequestNotification.type).filter(plugin => {
20
17
  return plugin.canUse(type);
21
18
  });
22
19
  return plugins.shift();
23
20
  };
24
-
25
21
  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":";;;;;;;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"}
1
+ {"version":3,"names":["_ApwChangeRequestNotification","require","getLastChangeRequestNotificationPlugin","params","context","type","plugins","byType","ApwChangeRequestNotification","filter","plugin","canUse","shift","exports"],"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,IAAAA,6BAAA,GAAAC,OAAA;AAWO,MAAMC,sCAA8E,GACvFC,MAAM,IAAI;EACN,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACR;AACA;EACQ,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAA+BC,0DAA4B,CAACH,IAAI,CAAC,CACvEI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,sCAAA,GAAAA,sCAAA"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getLastCommentNotificationPlugin = void 0;
7
-
8
7
  var _ApwCommentNotification = require("../../../ApwCommentNotification");
9
-
10
8
  const getLastCommentNotificationPlugin = params => {
11
9
  const {
12
10
  context,
@@ -15,11 +13,9 @@ const getLastCommentNotificationPlugin = params => {
15
13
  /**
16
14
  * We need the plugin to create the notification text.
17
15
  */
18
-
19
16
  const plugins = context.plugins.byType(_ApwCommentNotification.ApwCommentNotification.type).filter(plugin => {
20
17
  return plugin.canUse(type);
21
18
  });
22
19
  return plugins.shift();
23
20
  };
24
-
25
21
  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":";;;;;;;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"}
1
+ {"version":3,"names":["_ApwCommentNotification","require","getLastCommentNotificationPlugin","params","context","type","plugins","byType","ApwCommentNotification","filter","plugin","canUse","shift","exports"],"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,IAAAA,uBAAA,GAAAC,OAAA;AASO,MAAMC,gCAAkE,GAAGC,MAAM,IAAI;EACxF,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACJ;AACA;EACI,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAAyBC,8CAAsB,CAACH,IAAI,CAAC,CAC3DI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,gCAAA,GAAAA,gCAAA"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getLastContentReviewNotificationPlugin = void 0;
7
-
8
7
  var _ApwContentReviewNotification = require("../../../ApwContentReviewNotification");
9
-
10
8
  const getLastContentReviewNotificationPlugin = params => {
11
9
  const {
12
10
  context,
@@ -15,11 +13,9 @@ const getLastContentReviewNotificationPlugin = params => {
15
13
  /**
16
14
  * We need the plugin to create the notification text.
17
15
  */
18
-
19
16
  const plugins = context.plugins.byType(_ApwContentReviewNotification.ApwContentReviewNotification.type).filter(plugin => {
20
17
  return plugin.canUse(type);
21
18
  });
22
19
  return plugins.shift();
23
20
  };
24
-
25
21
  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":";;;;;;;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"}
1
+ {"version":3,"names":["_ApwContentReviewNotification","require","getLastContentReviewNotificationPlugin","params","context","type","plugins","byType","ApwContentReviewNotification","filter","plugin","canUse","shift","exports"],"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,IAAAA,6BAAA,GAAAC,OAAA;AAWO,MAAMC,sCAA8E,GACvFC,MAAM,IAAI;EACN,MAAM;IAAEC,OAAO;IAAEC;EAAK,CAAC,GAAGF,MAAM;EAChC;AACR;AACA;EACQ,MAAMG,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAA+BC,0DAA4B,CAACH,IAAI,CAAC,CACvEI,MAAM,CAACC,MAAM,IAAI;IACd,OAAOA,MAAM,CAACC,MAAM,CAACN,IAAI,CAAC;EAC9B,CAAC,CAAC;EAEN,OAAOC,OAAO,CAACM,KAAK,CAAC,CAAC;AAC1B,CAAC;AAACC,OAAA,CAAAX,sCAAA,GAAAA,sCAAA"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getReviewerIdList = exports.fetchReviewers = void 0;
7
-
8
7
  const getReviewerIdList = ({
9
8
  steps
10
9
  }) => {
@@ -13,16 +12,12 @@ const getReviewerIdList = ({
13
12
  if (collection.includes(reviewer.id)) {
14
13
  return collection;
15
14
  }
16
-
17
15
  collection.push(reviewer.id);
18
16
  }
19
-
20
17
  return collection;
21
18
  }, []);
22
19
  };
23
-
24
20
  exports.getReviewerIdList = getReviewerIdList;
25
-
26
21
  const fetchReviewers = async params => {
27
22
  const {
28
23
  context,
@@ -30,22 +25,21 @@ const fetchReviewers = async params => {
30
25
  exclude
31
26
  } = params;
32
27
  const idList = getReviewerIdList(workflow);
33
- context.security.disableAuthorization();
34
- const [reviewers] = await context.apw.reviewer.list({
35
- where: {
36
- id_in: idList
37
- },
38
- limit: 10000
39
- });
40
- return reviewers.filter(item => {
41
- if (!item.email) {
42
- return false;
43
- } else if (exclude.includes(item.identityId)) {
44
- return false;
45
- }
46
-
47
- return true;
28
+ return context.security.withoutAuthorization(async () => {
29
+ const [reviewers] = await context.apw.reviewer.list({
30
+ where: {
31
+ id_in: idList
32
+ },
33
+ limit: 10000
34
+ });
35
+ return reviewers.filter(item => {
36
+ if (!item.email) {
37
+ return false;
38
+ } else if (exclude.includes(item.identityId)) {
39
+ return false;
40
+ }
41
+ return true;
42
+ });
48
43
  });
49
44
  };
50
-
51
45
  exports.fetchReviewers = fetchReviewers;
@@ -1 +1 @@
1
- {"version":3,"names":["getReviewerIdList","steps","reduce","collection","step","reviewer","reviewers","includes","id","push","fetchReviewers","params","context","workflow","exclude","idList","security","disableAuthorization","apw","list","where","id_in","limit","filter","item","email","identityId"],"sources":["reviewers.ts"],"sourcesContent":["import { ApwContext, ApwReviewerWithEmail, ApwWorkflow, ApwWorkflowStep } from \"~/types\";\n\ninterface GetReviewerIdListParams {\n steps: ApwWorkflowStep[];\n}\ninterface GetReviewerIdList {\n (params: GetReviewerIdListParams): string[];\n}\nexport const getReviewerIdList: GetReviewerIdList = ({ steps }) => {\n return steps.reduce<string[]>((collection, step) => {\n for (const reviewer of step.reviewers) {\n if (collection.includes(reviewer.id)) {\n return collection;\n }\n collection.push(reviewer.id);\n }\n\n return collection;\n }, []);\n};\n\ninterface FetchReviewersParams {\n context: ApwContext;\n workflow: ApwWorkflow;\n exclude: string[];\n}\nexport const fetchReviewers = async (\n params: FetchReviewersParams\n): Promise<ApwReviewerWithEmail[]> => {\n const { context, workflow, exclude } = params;\n\n const idList = getReviewerIdList(workflow);\n\n context.security.disableAuthorization();\n\n const [reviewers] = await context.apw.reviewer.list({\n where: {\n id_in: idList\n },\n limit: 10000\n });\n return reviewers.filter(item => {\n if (!item.email) {\n return false;\n } else if (exclude.includes(item.identityId)) {\n return false;\n }\n\n return true;\n }) as ApwReviewerWithEmail[];\n};\n"],"mappings":";;;;;;;AAQO,MAAMA,iBAAoC,GAAG,CAAC;EAAEC;AAAF,CAAD,KAAe;EAC/D,OAAOA,KAAK,CAACC,MAAN,CAAuB,CAACC,UAAD,EAAaC,IAAb,KAAsB;IAChD,KAAK,MAAMC,QAAX,IAAuBD,IAAI,CAACE,SAA5B,EAAuC;MACnC,IAAIH,UAAU,CAACI,QAAX,CAAoBF,QAAQ,CAACG,EAA7B,CAAJ,EAAsC;QAClC,OAAOL,UAAP;MACH;;MACDA,UAAU,CAACM,IAAX,CAAgBJ,QAAQ,CAACG,EAAzB;IACH;;IAED,OAAOL,UAAP;EACH,CATM,EASJ,EATI,CAAP;AAUH,CAXM;;;;AAkBA,MAAMO,cAAc,GAAG,MAC1BC,MAD0B,IAEQ;EAClC,MAAM;IAAEC,OAAF;IAAWC,QAAX;IAAqBC;EAArB,IAAiCH,MAAvC;EAEA,MAAMI,MAAM,GAAGf,iBAAiB,CAACa,QAAD,CAAhC;EAEAD,OAAO,CAACI,QAAR,CAAiBC,oBAAjB;EAEA,MAAM,CAACX,SAAD,IAAc,MAAMM,OAAO,CAACM,GAAR,CAAYb,QAAZ,CAAqBc,IAArB,CAA0B;IAChDC,KAAK,EAAE;MACHC,KAAK,EAAEN;IADJ,CADyC;IAIhDO,KAAK,EAAE;EAJyC,CAA1B,CAA1B;EAMA,OAAOhB,SAAS,CAACiB,MAAV,CAAiBC,IAAI,IAAI;IAC5B,IAAI,CAACA,IAAI,CAACC,KAAV,EAAiB;MACb,OAAO,KAAP;IACH,CAFD,MAEO,IAAIX,OAAO,CAACP,QAAR,CAAiBiB,IAAI,CAACE,UAAtB,CAAJ,EAAuC;MAC1C,OAAO,KAAP;IACH;;IAED,OAAO,IAAP;EACH,CARM,CAAP;AASH,CAxBM"}
1
+ {"version":3,"names":["getReviewerIdList","steps","reduce","collection","step","reviewer","reviewers","includes","id","push","exports","fetchReviewers","params","context","workflow","exclude","idList","security","withoutAuthorization","apw","list","where","id_in","limit","filter","item","email","identityId"],"sources":["reviewers.ts"],"sourcesContent":["import { ApwContext, ApwReviewerWithEmail, ApwWorkflow, ApwWorkflowStep } from \"~/types\";\n\ninterface GetReviewerIdListParams {\n steps: ApwWorkflowStep[];\n}\n\ninterface GetReviewerIdList {\n (params: GetReviewerIdListParams): string[];\n}\n\nexport const getReviewerIdList: GetReviewerIdList = ({ steps }) => {\n return steps.reduce<string[]>((collection, step) => {\n for (const reviewer of step.reviewers) {\n if (collection.includes(reviewer.id)) {\n return collection;\n }\n collection.push(reviewer.id);\n }\n\n return collection;\n }, []);\n};\n\ninterface FetchReviewersParams {\n context: ApwContext;\n workflow: ApwWorkflow;\n exclude: string[];\n}\n\nexport const fetchReviewers = async (\n params: FetchReviewersParams\n): Promise<ApwReviewerWithEmail[]> => {\n const { context, workflow, exclude } = params;\n\n const idList = getReviewerIdList(workflow);\n\n return context.security.withoutAuthorization(async () => {\n const [reviewers] = await context.apw.reviewer.list({\n where: {\n id_in: idList\n },\n limit: 10000\n });\n return reviewers.filter((item): item is ApwReviewerWithEmail => {\n if (!item.email) {\n return false;\n } else if (exclude.includes(item.identityId)) {\n return false;\n }\n\n return true;\n });\n });\n};\n"],"mappings":";;;;;;AAUO,MAAMA,iBAAoC,GAAGA,CAAC;EAAEC;AAAM,CAAC,KAAK;EAC/D,OAAOA,KAAK,CAACC,MAAM,CAAW,CAACC,UAAU,EAAEC,IAAI,KAAK;IAChD,KAAK,MAAMC,QAAQ,IAAID,IAAI,CAACE,SAAS,EAAE;MACnC,IAAIH,UAAU,CAACI,QAAQ,CAACF,QAAQ,CAACG,EAAE,CAAC,EAAE;QAClC,OAAOL,UAAU;MACrB;MACAA,UAAU,CAACM,IAAI,CAACJ,QAAQ,CAACG,EAAE,CAAC;IAChC;IAEA,OAAOL,UAAU;EACrB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAACO,OAAA,CAAAV,iBAAA,GAAAA,iBAAA;AAQK,MAAMW,cAAc,GAAG,MAC1BC,MAA4B,IACM;EAClC,MAAM;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAE7C,MAAMI,MAAM,GAAGhB,iBAAiB,CAACc,QAAQ,CAAC;EAE1C,OAAOD,OAAO,CAACI,QAAQ,CAACC,oBAAoB,CAAC,YAAY;IACrD,MAAM,CAACZ,SAAS,CAAC,GAAG,MAAMO,OAAO,CAACM,GAAG,CAACd,QAAQ,CAACe,IAAI,CAAC;MAChDC,KAAK,EAAE;QACHC,KAAK,EAAEN;MACX,CAAC;MACDO,KAAK,EAAE;IACX,CAAC,CAAC;IACF,OAAOjB,SAAS,CAACkB,MAAM,CAAEC,IAAI,IAAmC;MAC5D,IAAI,CAACA,IAAI,CAACC,KAAK,EAAE;QACb,OAAO,KAAK;MAChB,CAAC,MAAM,IAAIX,OAAO,CAACR,QAAQ,CAACkB,IAAI,CAACE,UAAU,CAAC,EAAE;QAC1C,OAAO,KAAK;MAChB;MAEA,OAAO,IAAI;IACf,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACjB,OAAA,CAAAC,cAAA,GAAAA,cAAA"}
@@ -4,49 +4,38 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.sendChangeRequestNotification = void 0;
7
-
8
7
  var _lastChangeRequestNotificationPlugin = require("./lastChangeRequestNotificationPlugin");
9
-
10
8
  const sendChangeRequestNotification = async params => {
11
9
  const {
12
10
  context,
13
11
  reviewers,
14
12
  contentReview
15
13
  } = params;
16
-
17
14
  if (reviewers.length === 0) {
18
15
  return;
19
16
  }
20
-
21
17
  const changeRequestPlugin = (0, _lastChangeRequestNotificationPlugin.getLastChangeRequestNotificationPlugin)({
22
18
  context,
23
19
  type: contentReview.content.type
24
20
  });
25
-
26
21
  if (!changeRequestPlugin) {
27
22
  console.log("No e-mail body change request plugin.");
28
23
  return;
29
24
  }
30
-
31
25
  const body = changeRequestPlugin.create(params);
32
-
33
26
  if (!body) {
34
27
  console.log(`No e-mail body from the change request plugin: ${changeRequestPlugin.name}`);
35
28
  return;
36
29
  }
37
-
38
30
  const result = await context.mailer.sendMail({
39
31
  bcc: reviewers.map(r => r.email),
40
32
  subject: "There is a new change request on the Content Review you are assigned on.",
41
33
  text: body.text,
42
34
  html: body.html || body.text
43
35
  });
44
-
45
36
  if (!result.error) {
46
37
  return;
47
38
  }
48
-
49
39
  console.log("Error while sending e-mail", JSON.stringify(result.error));
50
40
  };
51
-
52
41
  exports.sendChangeRequestNotification = sendChangeRequestNotification;
@@ -1 +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,MADyC,IAEzB;EAChB,MAAM;IAAEC,OAAF;IAAWC,SAAX;IAAsBC;EAAtB,IAAwCH,MAA9C;;EACA,IAAIE,SAAS,CAACE,MAAV,KAAqB,CAAzB,EAA4B;IACxB;EACH;;EAED,MAAMC,mBAAmB,GAAG,IAAAC,2EAAA,EAAuC;IAC/DL,OAD+D;IAE/DM,IAAI,EAAEJ,aAAa,CAACK,OAAd,CAAsBD;EAFmC,CAAvC,CAA5B;;EAIA,IAAI,CAACF,mBAAL,EAA0B;IACtBI,OAAO,CAACC,GAAR,CAAY,uCAAZ;IACA;EACH;;EAED,MAAMC,IAAI,GAAGN,mBAAmB,CAACO,MAApB,CAA2BZ,MAA3B,CAAb;;EACA,IAAI,CAACW,IAAL,EAAW;IACPF,OAAO,CAACC,GAAR,CAAa,kDAAiDL,mBAAmB,CAACQ,IAAK,EAAvF;IACA;EACH;;EAED,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAR,CAAeC,QAAf,CAAwB;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAV,CAAcC,CAAC,IAAIA,CAAC,CAACC,KAArB,CADoC;IAEzCC,OAAO,EAAE,0EAFgC;IAGzCC,IAAI,EAAEX,IAAI,CAACW,IAH8B;IAIzCC,IAAI,EAAEZ,IAAI,CAACY,IAAL,IAAaZ,IAAI,CAACW;EAJiB,CAAxB,CAArB;;EAMA,IAAI,CAACR,MAAM,CAACU,KAAZ,EAAmB;IACf;EACH;;EACDf,OAAO,CAACC,GAAR,CAAY,4BAAZ,EAA0Ce,IAAI,CAACC,SAAL,CAAeZ,MAAM,CAACU,KAAtB,CAA1C;AACH,CAjCM"}
1
+ {"version":3,"names":["_lastChangeRequestNotificationPlugin","require","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","exports"],"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,IAAAA,oCAAA,GAAAC,OAAA;AAGO,MAAMC,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;AAACG,OAAA,CAAA5B,6BAAA,GAAAA,6BAAA"}
@@ -4,49 +4,38 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.sendCommentNotification = void 0;
7
-
8
7
  var _lastCommentNotificationPlugin = require("./lastCommentNotificationPlugin");
9
-
10
8
  const sendCommentNotification = async params => {
11
9
  const {
12
10
  context,
13
11
  reviewers,
14
12
  contentReview
15
13
  } = params;
16
-
17
14
  if (reviewers.length === 0) {
18
15
  return;
19
16
  }
20
-
21
17
  const commentPlugin = (0, _lastCommentNotificationPlugin.getLastCommentNotificationPlugin)({
22
18
  context,
23
19
  type: contentReview.content.type
24
20
  });
25
-
26
21
  if (!commentPlugin) {
27
22
  console.log("No e-mail body comment plugin.");
28
23
  return;
29
24
  }
30
-
31
25
  const body = commentPlugin.create(params);
32
-
33
26
  if (!body) {
34
27
  console.log(`No e-mail body from the comment plugin: ${commentPlugin.name}`);
35
28
  return;
36
29
  }
37
-
38
30
  const result = await context.mailer.sendMail({
39
31
  bcc: reviewers.map(r => r.email),
40
32
  subject: "There is a new comment on the Content Review you are assigned on.",
41
33
  text: body.text,
42
34
  html: body.html || body.text
43
35
  });
44
-
45
36
  if (!result.error) {
46
37
  return;
47
38
  }
48
-
49
39
  console.log("Error while sending e-mail", JSON.stringify(result.error));
50
40
  };
51
-
52
41
  exports.sendCommentNotification = sendCommentNotification;
@@ -1 +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,MADmC,IAEnB;EAChB,MAAM;IAAEC,OAAF;IAAWC,SAAX;IAAsBC;EAAtB,IAAwCH,MAA9C;;EACA,IAAIE,SAAS,CAACE,MAAV,KAAqB,CAAzB,EAA4B;IACxB;EACH;;EAED,MAAMC,aAAa,GAAG,IAAAC,+DAAA,EAAiC;IACnDL,OADmD;IAEnDM,IAAI,EAAEJ,aAAa,CAACK,OAAd,CAAsBD;EAFuB,CAAjC,CAAtB;;EAIA,IAAI,CAACF,aAAL,EAAoB;IAChBI,OAAO,CAACC,GAAR,CAAY,gCAAZ;IACA;EACH;;EAED,MAAMC,IAAI,GAAGN,aAAa,CAACO,MAAd,CAAqBZ,MAArB,CAAb;;EACA,IAAI,CAACW,IAAL,EAAW;IACPF,OAAO,CAACC,GAAR,CAAa,2CAA0CL,aAAa,CAACQ,IAAK,EAA1E;IACA;EACH;;EAED,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAR,CAAeC,QAAf,CAAwB;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAV,CAAcC,CAAC,IAAIA,CAAC,CAACC,KAArB,CADoC;IAEzCC,OAAO,EAAE,mEAFgC;IAGzCC,IAAI,EAAEX,IAAI,CAACW,IAH8B;IAIzCC,IAAI,EAAEZ,IAAI,CAACY,IAAL,IAAaZ,IAAI,CAACW;EAJiB,CAAxB,CAArB;;EAMA,IAAI,CAACR,MAAM,CAACU,KAAZ,EAAmB;IACf;EACH;;EACDf,OAAO,CAACC,GAAR,CAAY,4BAAZ,EAA0Ce,IAAI,CAACC,SAAL,CAAeZ,MAAM,CAACU,KAAtB,CAA1C;AACH,CAjCM"}
1
+ {"version":3,"names":["_lastCommentNotificationPlugin","require","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","exports"],"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,IAAAA,8BAAA,GAAAC,OAAA;AAGO,MAAMC,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;AAACG,OAAA,CAAA5B,uBAAA,GAAAA,uBAAA"}
@@ -4,49 +4,38 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.sendContentReviewNotification = void 0;
7
-
8
7
  var _lastContentReviewNotificationPlugin = require("./lastContentReviewNotificationPlugin");
9
-
10
8
  const sendContentReviewNotification = async params => {
11
9
  const {
12
10
  context,
13
11
  reviewers,
14
12
  contentReview
15
13
  } = params;
16
-
17
14
  if (reviewers.length === 0) {
18
15
  return;
19
16
  }
20
-
21
17
  const contentReviewPlugin = (0, _lastContentReviewNotificationPlugin.getLastContentReviewNotificationPlugin)({
22
18
  context,
23
19
  type: contentReview.content.type
24
20
  });
25
-
26
21
  if (!contentReviewPlugin) {
27
22
  console.log("No e-mail body content review plugin.");
28
23
  return;
29
24
  }
30
-
31
25
  const body = contentReviewPlugin.create(params);
32
-
33
26
  if (!body) {
34
27
  console.log(`No e-mail body from the content review plugin: ${contentReviewPlugin.name}`);
35
28
  return;
36
29
  }
37
-
38
30
  const result = await context.mailer.sendMail({
39
31
  bcc: reviewers.map(r => r.email),
40
32
  subject: "There is a new content review which you are assigned on.",
41
33
  text: body.text,
42
34
  html: body.html || body.text
43
35
  });
44
-
45
36
  if (!result.error) {
46
37
  return;
47
38
  }
48
-
49
39
  console.log("Error while sending e-mail", JSON.stringify(result.error));
50
40
  };
51
-
52
41
  exports.sendContentReviewNotification = sendContentReviewNotification;
@@ -1 +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,MADyC,IAEzB;EAChB,MAAM;IAAEC,OAAF;IAAWC,SAAX;IAAsBC;EAAtB,IAAwCH,MAA9C;;EACA,IAAIE,SAAS,CAACE,MAAV,KAAqB,CAAzB,EAA4B;IACxB;EACH;;EAED,MAAMC,mBAAmB,GAAG,IAAAC,2EAAA,EAAuC;IAC/DL,OAD+D;IAE/DM,IAAI,EAAEJ,aAAa,CAACK,OAAd,CAAsBD;EAFmC,CAAvC,CAA5B;;EAIA,IAAI,CAACF,mBAAL,EAA0B;IACtBI,OAAO,CAACC,GAAR,CAAY,uCAAZ;IACA;EACH;;EAED,MAAMC,IAAI,GAAGN,mBAAmB,CAACO,MAApB,CAA2BZ,MAA3B,CAAb;;EACA,IAAI,CAACW,IAAL,EAAW;IACPF,OAAO,CAACC,GAAR,CAAa,kDAAiDL,mBAAmB,CAACQ,IAAK,EAAvF;IACA;EACH;;EAED,MAAMC,MAAM,GAAG,MAAMb,OAAO,CAACc,MAAR,CAAeC,QAAf,CAAwB;IACzCC,GAAG,EAAEf,SAAS,CAACgB,GAAV,CAAcC,CAAC,IAAIA,CAAC,CAACC,KAArB,CADoC;IAEzCC,OAAO,EAAE,0DAFgC;IAGzCC,IAAI,EAAEX,IAAI,CAACW,IAH8B;IAIzCC,IAAI,EAAEZ,IAAI,CAACY,IAAL,IAAaZ,IAAI,CAACW;EAJiB,CAAxB,CAArB;;EAMA,IAAI,CAACR,MAAM,CAACU,KAAZ,EAAmB;IACf;EACH;;EACDf,OAAO,CAACC,GAAR,CAAY,4BAAZ,EAA0Ce,IAAI,CAACC,SAAL,CAAeZ,MAAM,CAACU,KAAtB,CAA1C;AACH,CAjCM"}
1
+ {"version":3,"names":["_lastContentReviewNotificationPlugin","require","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","exports"],"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,IAAAA,oCAAA,GAAAC,OAAA;AAGO,MAAMC,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;AAACG,OAAA,CAAA5B,6BAAA,GAAAA,6BAAA"}