@webiny/api-apw 0.0.0-ee-vpcs.549378cf03

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 (316) hide show
  1. package/ApwChangeRequestNotification.d.ts +27 -0
  2. package/ApwChangeRequestNotification.js +40 -0
  3. package/ApwChangeRequestNotification.js.map +1 -0
  4. package/ApwCommentNotification.d.ts +27 -0
  5. package/ApwCommentNotification.js +40 -0
  6. package/ApwCommentNotification.js.map +1 -0
  7. package/ApwContentReviewNotification.d.ts +26 -0
  8. package/ApwContentReviewNotification.js +40 -0
  9. package/ApwContentReviewNotification.js.map +1 -0
  10. package/ApwContentUrlPlugin.d.ts +19 -0
  11. package/ApwContentUrlPlugin.js +40 -0
  12. package/ApwContentUrlPlugin.js.map +1 -0
  13. package/ContentApwSettingsPlugin.d.ts +10 -0
  14. package/ContentApwSettingsPlugin.js +17 -0
  15. package/ContentApwSettingsPlugin.js.map +1 -0
  16. package/LICENSE +21 -0
  17. package/README.md +34 -0
  18. package/crud/createChangeRequestMethods.d.ts +2 -0
  19. package/crud/createChangeRequestMethods.js +98 -0
  20. package/crud/createChangeRequestMethods.js.map +1 -0
  21. package/crud/createCommentMethods.d.ts +2 -0
  22. package/crud/createCommentMethods.js +99 -0
  23. package/crud/createCommentMethods.js.map +1 -0
  24. package/crud/createContentReviewMethods.d.ts +10 -0
  25. package/crud/createContentReviewMethods.js +562 -0
  26. package/crud/createContentReviewMethods.js.map +1 -0
  27. package/crud/createReviewerMethods.d.ts +2 -0
  28. package/crud/createReviewerMethods.js +99 -0
  29. package/crud/createReviewerMethods.js.map +1 -0
  30. package/crud/createWorkflowMethods.d.ts +2 -0
  31. package/crud/createWorkflowMethods.js +118 -0
  32. package/crud/createWorkflowMethods.js.map +1 -0
  33. package/crud/index.d.ts +2 -0
  34. package/crud/index.js +96 -0
  35. package/crud/index.js.map +1 -0
  36. package/crud/utils.d.ts +21 -0
  37. package/crud/utils.js +138 -0
  38. package/crud/utils.js.map +1 -0
  39. package/index.d.ts +4 -0
  40. package/index.js +38 -0
  41. package/index.js.map +1 -0
  42. package/package.json +76 -0
  43. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +10 -0
  44. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +51 -0
  45. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -0
  46. package/plugins/cms/README.md +49 -0
  47. package/plugins/cms/apwEntryPlugins.d.ts +8 -0
  48. package/plugins/cms/apwEntryPlugins.js +46 -0
  49. package/plugins/cms/apwEntryPlugins.js.map +1 -0
  50. package/plugins/cms/index.d.ts +12 -0
  51. package/plugins/cms/index.js +45 -0
  52. package/plugins/cms/index.js.map +1 -0
  53. package/plugins/cms/linkContentReviewToEntry.d.ts +8 -0
  54. package/plugins/cms/linkContentReviewToEntry.js +108 -0
  55. package/plugins/cms/linkContentReviewToEntry.js.map +1 -0
  56. package/plugins/cms/linkWorkflowToEntry.d.ts +8 -0
  57. package/plugins/cms/linkWorkflowToEntry.js +166 -0
  58. package/plugins/cms/linkWorkflowToEntry.js.map +1 -0
  59. package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
  60. package/plugins/cms/notifications/changeRequestNotification.js +35 -0
  61. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
  62. package/plugins/cms/notifications/commentNotification.d.ts +1 -0
  63. package/plugins/cms/notifications/commentNotification.js +35 -0
  64. package/plugins/cms/notifications/commentNotification.js.map +1 -0
  65. package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
  66. package/plugins/cms/notifications/contentReviewNotification.js +35 -0
  67. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
  68. package/plugins/cms/notifications/contentUrl.d.ts +8 -0
  69. package/plugins/cms/notifications/contentUrl.js +60 -0
  70. package/plugins/cms/notifications/contentUrl.js.map +1 -0
  71. package/plugins/cms/triggerContentReview.d.ts +8 -0
  72. package/plugins/cms/triggerContentReview.js +59 -0
  73. package/plugins/cms/triggerContentReview.js.map +1 -0
  74. package/plugins/cms/updateContentReviewStatus.d.ts +10 -0
  75. package/plugins/cms/updateContentReviewStatus.js +97 -0
  76. package/plugins/cms/updateContentReviewStatus.js.map +1 -0
  77. package/plugins/cms/utils.d.ts +27 -0
  78. package/plugins/cms/utils.js +207 -0
  79. package/plugins/cms/utils.js.map +1 -0
  80. package/plugins/context.d.ts +5 -0
  81. package/plugins/context.js +146 -0
  82. package/plugins/context.js.map +1 -0
  83. package/plugins/graphql/changeRequest.gql.d.ts +4 -0
  84. package/plugins/graphql/changeRequest.gql.js +155 -0
  85. package/plugins/graphql/changeRequest.gql.js.map +1 -0
  86. package/plugins/graphql/comment.gql.d.ts +4 -0
  87. package/plugins/graphql/comment.gql.js +160 -0
  88. package/plugins/graphql/comment.gql.js.map +1 -0
  89. package/plugins/graphql/contentReview.gql.d.ts +4 -0
  90. package/plugins/graphql/contentReview.gql.js +382 -0
  91. package/plugins/graphql/contentReview.gql.js.map +1 -0
  92. package/plugins/graphql/reviewer.gql.d.ts +4 -0
  93. package/plugins/graphql/reviewer.gql.js +116 -0
  94. package/plugins/graphql/reviewer.gql.js.map +1 -0
  95. package/plugins/graphql/workflow.gql.d.ts +4 -0
  96. package/plugins/graphql/workflow.gql.js +205 -0
  97. package/plugins/graphql/workflow.gql.js.map +1 -0
  98. package/plugins/graphql.d.ts +4 -0
  99. package/plugins/graphql.js +95 -0
  100. package/plugins/graphql.js.map +1 -0
  101. package/plugins/hooks/createReviewerFromIdentity.d.ts +2 -0
  102. package/plugins/hooks/createReviewerFromIdentity.js +82 -0
  103. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -0
  104. package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +2 -0
  105. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +67 -0
  106. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -0
  107. package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +2 -0
  108. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +59 -0
  109. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -0
  110. package/plugins/hooks/index.d.ts +3 -0
  111. package/plugins/hooks/index.js +74 -0
  112. package/plugins/hooks/index.js.map +1 -0
  113. package/plugins/hooks/initializeContentReviewSteps.d.ts +2 -0
  114. package/plugins/hooks/initializeContentReviewSteps.js +86 -0
  115. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -0
  116. package/plugins/hooks/initializeNotifications.d.ts +2 -0
  117. package/plugins/hooks/initializeNotifications.js +20 -0
  118. package/plugins/hooks/initializeNotifications.js.map +1 -0
  119. package/plugins/hooks/listContentReviews.d.ts +10 -0
  120. package/plugins/hooks/listContentReviews.js +68 -0
  121. package/plugins/hooks/listContentReviews.js.map +1 -0
  122. package/plugins/hooks/notifications/appUrl.d.ts +2 -0
  123. package/plugins/hooks/notifications/appUrl.js +22 -0
  124. package/plugins/hooks/notifications/appUrl.js.map +1 -0
  125. package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
  126. package/plugins/hooks/notifications/changeRequestAfterCreate.js +144 -0
  127. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
  128. package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
  129. package/plugins/hooks/notifications/changeRequestUrl.js +31 -0
  130. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
  131. package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
  132. package/plugins/hooks/notifications/commentAfterCreate.js +157 -0
  133. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
  134. package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
  135. package/plugins/hooks/notifications/commentUrl.js +31 -0
  136. package/plugins/hooks/notifications/commentUrl.js.map +1 -0
  137. package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
  138. package/plugins/hooks/notifications/contentReviewAfterCreate.js +122 -0
  139. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
  140. package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
  141. package/plugins/hooks/notifications/contentReviewUrl.js +30 -0
  142. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
  143. package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
  144. package/plugins/hooks/notifications/contentUrl.js +29 -0
  145. package/plugins/hooks/notifications/contentUrl.js.map +1 -0
  146. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
  147. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +25 -0
  148. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
  149. package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
  150. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +25 -0
  151. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
  152. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
  153. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +25 -0
  154. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
  155. package/plugins/hooks/notifications/reviewers.d.ts +15 -0
  156. package/plugins/hooks/notifications/reviewers.js +51 -0
  157. package/plugins/hooks/notifications/reviewers.js.map +1 -0
  158. package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
  159. package/plugins/hooks/notifications/sendChangeRequestNotification.js +52 -0
  160. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
  161. package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
  162. package/plugins/hooks/notifications/sendCommentNotification.js +52 -0
  163. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
  164. package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
  165. package/plugins/hooks/notifications/sendContentReviewNotification.js +52 -0
  166. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
  167. package/plugins/hooks/updatePendingChangeRequests.d.ts +2 -0
  168. package/plugins/hooks/updatePendingChangeRequests.js +94 -0
  169. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -0
  170. package/plugins/hooks/updateTotalComments.d.ts +3 -0
  171. package/plugins/hooks/updateTotalComments.js +153 -0
  172. package/plugins/hooks/updateTotalComments.js.map +1 -0
  173. package/plugins/hooks/validateChangeRequest.d.ts +2 -0
  174. package/plugins/hooks/validateChangeRequest.js +89 -0
  175. package/plugins/hooks/validateChangeRequest.js.map +1 -0
  176. package/plugins/hooks/validateComment.d.ts +2 -0
  177. package/plugins/hooks/validateComment.js +57 -0
  178. package/plugins/hooks/validateComment.js.map +1 -0
  179. package/plugins/hooks/validateContentReview.d.ts +2 -0
  180. package/plugins/hooks/validateContentReview.js +38 -0
  181. package/plugins/hooks/validateContentReview.js.map +1 -0
  182. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +9 -0
  183. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +51 -0
  184. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -0
  185. package/plugins/pageBuilder/apwContentPagePlugins.d.ts +3 -0
  186. package/plugins/pageBuilder/apwContentPagePlugins.js +30 -0
  187. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -0
  188. package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +3 -0
  189. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +25 -0
  190. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -0
  191. package/plugins/pageBuilder/index.d.ts +11 -0
  192. package/plugins/pageBuilder/index.js +53 -0
  193. package/plugins/pageBuilder/index.js.map +1 -0
  194. package/plugins/pageBuilder/linkContentReviewToPage.d.ts +8 -0
  195. package/plugins/pageBuilder/linkContentReviewToPage.js +105 -0
  196. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -0
  197. package/plugins/pageBuilder/linkWorkflowToPage.d.ts +8 -0
  198. package/plugins/pageBuilder/linkWorkflowToPage.js +194 -0
  199. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -0
  200. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
  201. package/plugins/pageBuilder/notifications/changeRequestNotification.js +35 -0
  202. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
  203. package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
  204. package/plugins/pageBuilder/notifications/commentNotification.js +35 -0
  205. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
  206. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
  207. package/plugins/pageBuilder/notifications/contentReviewNotification.js +35 -0
  208. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
  209. package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
  210. package/plugins/pageBuilder/notifications/contentUrl.js +53 -0
  211. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
  212. package/plugins/pageBuilder/triggerContentReview.d.ts +8 -0
  213. package/plugins/pageBuilder/triggerContentReview.js +50 -0
  214. package/plugins/pageBuilder/triggerContentReview.js.map +1 -0
  215. package/plugins/pageBuilder/updateContentReviewStatus.d.ts +10 -0
  216. package/plugins/pageBuilder/updateContentReviewStatus.js +79 -0
  217. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -0
  218. package/plugins/pageBuilder/utils.d.ts +22 -0
  219. package/plugins/pageBuilder/utils.js +184 -0
  220. package/plugins/pageBuilder/utils.js.map +1 -0
  221. package/plugins/utils.d.ts +35 -0
  222. package/plugins/utils.js +187 -0
  223. package/plugins/utils.js.map +1 -0
  224. package/scheduler/createScheduleActionMethods.d.ts +2 -0
  225. package/scheduler/createScheduleActionMethods.js +149 -0
  226. package/scheduler/createScheduleActionMethods.js.map +1 -0
  227. package/scheduler/handlers/executeAction/index.d.ts +13 -0
  228. package/scheduler/handlers/executeAction/index.js +172 -0
  229. package/scheduler/handlers/executeAction/index.js.map +1 -0
  230. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +13 -0
  231. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +17 -0
  232. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -0
  233. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +11 -0
  234. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +126 -0
  235. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -0
  236. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +11 -0
  237. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +163 -0
  238. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -0
  239. package/scheduler/handlers/executeAction/security.d.ts +4 -0
  240. package/scheduler/handlers/executeAction/security.js +68 -0
  241. package/scheduler/handlers/executeAction/security.js.map +1 -0
  242. package/scheduler/handlers/scheduleAction/index.d.ts +22 -0
  243. package/scheduler/handlers/scheduleAction/index.js +164 -0
  244. package/scheduler/handlers/scheduleAction/index.js.map +1 -0
  245. package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +24 -0
  246. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +172 -0
  247. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -0
  248. package/scheduler/handlers/utils.d.ts +33 -0
  249. package/scheduler/handlers/utils.js +168 -0
  250. package/scheduler/handlers/utils.js.map +1 -0
  251. package/scheduler/index.d.ts +2 -0
  252. package/scheduler/index.js +27 -0
  253. package/scheduler/index.js.map +1 -0
  254. package/scheduler/types.d.ts +171 -0
  255. package/scheduler/types.js +34 -0
  256. package/scheduler/types.js.map +1 -0
  257. package/storageOperations/changeRequestStorageOperations.d.ts +3 -0
  258. package/storageOperations/changeRequestStorageOperations.js +122 -0
  259. package/storageOperations/changeRequestStorageOperations.js.map +1 -0
  260. package/storageOperations/commentStorageOperations.d.ts +3 -0
  261. package/storageOperations/commentStorageOperations.js +138 -0
  262. package/storageOperations/commentStorageOperations.js.map +1 -0
  263. package/storageOperations/contentReviewStorageOperations.d.ts +3 -0
  264. package/storageOperations/contentReviewStorageOperations.js +93 -0
  265. package/storageOperations/contentReviewStorageOperations.js.map +1 -0
  266. package/storageOperations/index.d.ts +15 -0
  267. package/storageOperations/index.js +48 -0
  268. package/storageOperations/index.js.map +1 -0
  269. package/storageOperations/models/changeRequest.model.d.ts +3 -0
  270. package/storageOperations/models/changeRequest.model.js +59 -0
  271. package/storageOperations/models/changeRequest.model.js.map +1 -0
  272. package/storageOperations/models/comment.model.d.ts +7 -0
  273. package/storageOperations/models/comment.model.js +60 -0
  274. package/storageOperations/models/comment.model.js.map +1 -0
  275. package/storageOperations/models/contentModelPluginFactory.d.ts +15 -0
  276. package/storageOperations/models/contentModelPluginFactory.js +28 -0
  277. package/storageOperations/models/contentModelPluginFactory.js.map +1 -0
  278. package/storageOperations/models/contentReview.model.d.ts +7 -0
  279. package/storageOperations/models/contentReview.model.js +258 -0
  280. package/storageOperations/models/contentReview.model.js.map +1 -0
  281. package/storageOperations/models/index.d.ts +2 -0
  282. package/storageOperations/models/index.js +115 -0
  283. package/storageOperations/models/index.js.map +1 -0
  284. package/storageOperations/models/reviewer.model.d.ts +3 -0
  285. package/storageOperations/models/reviewer.model.js +71 -0
  286. package/storageOperations/models/reviewer.model.js.map +1 -0
  287. package/storageOperations/models/utils.d.ts +3 -0
  288. package/storageOperations/models/utils.js +37 -0
  289. package/storageOperations/models/utils.js.map +1 -0
  290. package/storageOperations/models/workflow.model.d.ts +12 -0
  291. package/storageOperations/models/workflow.model.js +208 -0
  292. package/storageOperations/models/workflow.model.js.map +1 -0
  293. package/storageOperations/reviewerStorageOperations.d.ts +3 -0
  294. package/storageOperations/reviewerStorageOperations.js +97 -0
  295. package/storageOperations/reviewerStorageOperations.js.map +1 -0
  296. package/storageOperations/types.d.ts +34 -0
  297. package/storageOperations/types.js +5 -0
  298. package/storageOperations/types.js.map +1 -0
  299. package/storageOperations/workflowStorageOperations.d.ts +3 -0
  300. package/storageOperations/workflowStorageOperations.js +111 -0
  301. package/storageOperations/workflowStorageOperations.js.map +1 -0
  302. package/types.d.ts +752 -0
  303. package/types.js +69 -0
  304. package/types.js.map +1 -0
  305. package/utils/contentApwSettingsPlugin.d.ts +9 -0
  306. package/utils/contentApwSettingsPlugin.js +26 -0
  307. package/utils/contentApwSettingsPlugin.js.map +1 -0
  308. package/utils/errors.d.ts +16 -0
  309. package/utils/errors.js +75 -0
  310. package/utils/errors.js.map +1 -0
  311. package/utils/fieldResolver.d.ts +16 -0
  312. package/utils/fieldResolver.js +54 -0
  313. package/utils/fieldResolver.js.map +1 -0
  314. package/utils/resolve.d.ts +3 -0
  315. package/utils/resolve.js +18 -0
  316. package/utils/resolve.js.map +1 -0
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.initializeContentReviewSteps = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _set = _interopRequireDefault(require("lodash/set"));
13
+
14
+ var _utils = require("../utils");
15
+
16
+ var _handlerGraphql = require("@webiny/handler-graphql");
17
+
18
+ var _contentApwSettingsPlugin = require("../../utils/contentApwSettingsPlugin");
19
+
20
+ const initializeContentReviewSteps = ({
21
+ apw,
22
+ plugins
23
+ }) => {
24
+ apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({
25
+ input
26
+ }) => {
27
+ const {
28
+ type,
29
+ id,
30
+ settings
31
+ } = input.content;
32
+ /*
33
+ * Let's set "title" field value.
34
+ */
35
+
36
+ const getContent = apw.getContentGetter(type);
37
+ const content = await getContent(id, settings);
38
+
39
+ if (!content) {
40
+ throw new _handlerGraphql.NotFoundError(`Content "${type}" with id ${id} not found.`);
41
+ }
42
+
43
+ const {
44
+ title
45
+ } = content;
46
+ input = (0, _set.default)(input, "title", title);
47
+ /**
48
+ * We need to find a plugin which can get a workflow ID for the given type of content.
49
+ */
50
+
51
+ const contentApwSettingsPlugin = (0, _contentApwSettingsPlugin.getContentApwSettingsPlugin)({
52
+ plugins,
53
+ type
54
+ });
55
+ const workflowId = contentApwSettingsPlugin.getWorkflowId(content);
56
+ /**
57
+ * Let's initialize the "ContentReview" steps.
58
+ */
59
+
60
+ if (!workflowId) {
61
+ throw new _handlerGraphql.NotFoundError(`Unable to initiate a "Content review". No workflow found!`);
62
+ }
63
+
64
+ input.workflowId = workflowId;
65
+ const workflow = await apw.workflow.get(workflowId);
66
+ const workflowSteps = workflow.steps;
67
+ let previousStepStatus = undefined;
68
+ const updatedSteps = workflow.steps.map((step, index) => {
69
+ const status = (0, _utils.getContentReviewStepInitialStatus)(workflowSteps, index, previousStepStatus);
70
+ previousStepStatus = status;
71
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
72
+ status,
73
+ pendingChangeRequests: 0,
74
+ totalComments: 0
75
+ });
76
+ });
77
+ /**
78
+ * TODO Figure our what does this actually do?
79
+ * There is no steps property on CreateApwContentReviewParams
80
+ */
81
+
82
+ input = (0, _set.default)(input, "steps", updatedSteps);
83
+ });
84
+ };
85
+
86
+ exports.initializeContentReviewSteps = initializeContentReviewSteps;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["initializeContentReviewSteps","apw","plugins","contentReview","onContentReviewBeforeCreate","subscribe","input","type","id","settings","content","getContent","getContentGetter","NotFoundError","title","lodashSet","contentApwSettingsPlugin","getContentApwSettingsPlugin","workflowId","getWorkflowId","workflow","get","workflowSteps","steps","previousStepStatus","undefined","updatedSteps","map","step","index","status","getContentReviewStepInitialStatus","pendingChangeRequests","totalComments"],"sources":["initializeContentReviewSteps.ts"],"sourcesContent":["import lodashSet from \"lodash/set\";\nimport { ApwContentReviewStepStatus, ApwContext } from \"~/types\";\nimport { getContentReviewStepInitialStatus } from \"~/plugins/utils\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { getContentApwSettingsPlugin } from \"~/utils/contentApwSettingsPlugin\";\n\nexport const initializeContentReviewSteps = ({ apw, plugins }: ApwContext) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { type, id, settings } = input.content;\n /*\n * Let's set \"title\" field value.\n */\n const getContent = apw.getContentGetter(type);\n const content = await getContent(id, settings);\n if (!content) {\n throw new NotFoundError(`Content \"${type}\" with id ${id} not found.`);\n }\n\n const { title } = content;\n input = lodashSet(input, \"title\", title);\n\n /**\n * We need to find a plugin which can get a workflow ID for the given type of content.\n */\n const contentApwSettingsPlugin = getContentApwSettingsPlugin({\n plugins,\n type\n });\n\n const workflowId = contentApwSettingsPlugin.getWorkflowId(content);\n\n /**\n * Let's initialize the \"ContentReview\" steps.\n */\n if (!workflowId) {\n throw new NotFoundError(`Unable to initiate a \"Content review\". No workflow found!`);\n }\n\n input.workflowId = workflowId;\n\n const workflow = await apw.workflow.get(workflowId);\n const workflowSteps = workflow.steps;\n\n let previousStepStatus: ApwContentReviewStepStatus | undefined = undefined;\n const updatedSteps = workflow.steps.map((step, index) => {\n const status = getContentReviewStepInitialStatus(\n workflowSteps,\n index,\n previousStepStatus\n );\n previousStepStatus = status;\n return {\n ...step,\n status,\n pendingChangeRequests: 0,\n totalComments: 0\n };\n });\n /**\n * TODO Figure our what does this actually do?\n * There is no steps property on CreateApwContentReviewParams\n */\n input = lodashSet(input, \"steps\", updatedSteps);\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AAEO,MAAMA,4BAA4B,GAAG,CAAC;EAAEC,GAAF;EAAOC;AAAP,CAAD,KAAkC;EAC1ED,GAAG,CAACE,aAAJ,CAAkBC,2BAAlB,CAA8CC,SAA9C,CAAwD,OAAO;IAAEC;EAAF,CAAP,KAAqB;IACzE,MAAM;MAAEC,IAAF;MAAQC,EAAR;MAAYC;IAAZ,IAAyBH,KAAK,CAACI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B,KAAK,GAAG,IAAAS,YAAA,EAAUT,KAAV,EAAiB,OAAjB,EAA0BoB,YAA1B,CAAR;EACH,CAxDD;AAyDH,CA1DM"}
@@ -0,0 +1,2 @@
1
+ import { ApwContext } from "../../types";
2
+ export declare const initializeNotifications: (context: ApwContext) => void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initializeNotifications = void 0;
7
+
8
+ var _contentReviewAfterCreate = require("./notifications/contentReviewAfterCreate");
9
+
10
+ var _commentAfterCreate = require("./notifications/commentAfterCreate");
11
+
12
+ var _changeRequestAfterCreate = require("./notifications/changeRequestAfterCreate");
13
+
14
+ const initializeNotifications = context => {
15
+ (0, _contentReviewAfterCreate.attachContentReviewAfterCreate)(context);
16
+ (0, _commentAfterCreate.attachCommentAfterCreate)(context);
17
+ (0, _changeRequestAfterCreate.attachChangeRequestAfterCreate)(context);
18
+ };
19
+
20
+ exports.initializeNotifications = initializeNotifications;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["initializeNotifications","context","attachContentReviewAfterCreate","attachCommentAfterCreate","attachChangeRequestAfterCreate"],"sources":["initializeNotifications.ts"],"sourcesContent":["import { ApwContext } from \"~/types\";\nimport { attachContentReviewAfterCreate } from \"./notifications/contentReviewAfterCreate\";\nimport { attachCommentAfterCreate } from \"./notifications/commentAfterCreate\";\nimport { attachChangeRequestAfterCreate } from \"./notifications/changeRequestAfterCreate\";\n\nexport const initializeNotifications = (context: ApwContext) => {\n attachContentReviewAfterCreate(context);\n attachCommentAfterCreate(context);\n attachChangeRequestAfterCreate(context);\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AAEO,MAAMA,uBAAuB,GAAIC,OAAD,IAAyB;EAC5D,IAAAC,wDAAA,EAA+BD,OAA/B;EACA,IAAAE,4CAAA,EAAyBF,OAAzB;EACA,IAAAG,wDAAA,EAA+BH,OAA/B;AACH,CAJM"}
@@ -0,0 +1,10 @@
1
+ import { AdvancedPublishingWorkflow } from "../../types";
2
+ import { HeadlessCms } from "@webiny/api-headless-cms/types";
3
+ import { Security } from "@webiny/api-security/types";
4
+ interface ListWorkflowsParams {
5
+ apw: AdvancedPublishingWorkflow;
6
+ cms: HeadlessCms;
7
+ security: Security;
8
+ }
9
+ export declare const listContentReviews: ({ apw, security }: ListWorkflowsParams) => void;
10
+ export {};
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.listContentReviews = void 0;
7
+
8
+ const listContentReviews = ({
9
+ apw,
10
+ security
11
+ }) => {
12
+ /**
13
+ * We need to hook into listing the content review entries.
14
+ * When listing content review entries, we need to check which ones current user can actually see.
15
+ */
16
+ apw.contentReview.onContentReviewBeforeList.subscribe(async ({
17
+ where
18
+ }) => {
19
+ /**
20
+ * If there is workflowId_in attached on where, we will not change it.
21
+ */
22
+ if (where.workflowId_in) {
23
+ return;
24
+ }
25
+
26
+ const identity = security.getIdentity();
27
+
28
+ if (!(identity !== null && identity !== void 0 && identity.id)) {
29
+ return;
30
+ }
31
+ /**
32
+ * Find all available workflows.
33
+ */
34
+
35
+
36
+ const [workflows] = await apw.workflow.list();
37
+
38
+ if (workflows.length === 0) {
39
+ return;
40
+ }
41
+ /**
42
+ * Find all workflows which user has access to.
43
+ * User access is buried quite deep in the workflow data, so we need to do some traversing.
44
+ */
45
+
46
+
47
+ const userWorkflows = workflows.filter(workflow => {
48
+ return workflow.steps.some(step => {
49
+ return step.reviewers.some(reviewer => {
50
+ return identity.id === reviewer.identityId;
51
+ });
52
+ });
53
+ });
54
+
55
+ if (userWorkflows.length === 0) {
56
+ return;
57
+ }
58
+ /**
59
+ * In the end, we need to attach the workflow filter by the entryId.
60
+ * Just in case we add versioning at some point...
61
+ */
62
+
63
+
64
+ where.workflowId_in = userWorkflows.map(workflow => workflow.id);
65
+ });
66
+ };
67
+
68
+ exports.listContentReviews = listContentReviews;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["listContentReviews","apw","security","contentReview","onContentReviewBeforeList","subscribe","where","workflowId_in","identity","getIdentity","id","workflows","workflow","list","length","userWorkflows","filter","steps","some","step","reviewers","reviewer","identityId","map"],"sources":["listContentReviews.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow } from \"~/types\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\n\ninterface ListWorkflowsParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n security: Security;\n}\nexport const listContentReviews = ({ apw, security }: ListWorkflowsParams) => {\n /**\n * We need to hook into listing the content review entries.\n * When listing content review entries, we need to check which ones current user can actually see.\n */\n apw.contentReview.onContentReviewBeforeList.subscribe(async ({ where }) => {\n /**\n * If there is workflowId_in attached on where, we will not change it.\n */\n if (where.workflowId_in) {\n return;\n }\n const identity = security.getIdentity();\n if (!identity?.id) {\n return;\n }\n /**\n * Find all available workflows.\n */\n const [workflows] = await apw.workflow.list();\n if (workflows.length === 0) {\n return;\n }\n /**\n * Find all workflows which user has access to.\n * User access is buried quite deep in the workflow data, so we need to do some traversing.\n */\n const userWorkflows = workflows.filter(workflow => {\n return workflow.steps.some(step => {\n return step.reviewers.some(reviewer => {\n return identity.id === reviewer.identityId;\n });\n });\n });\n if (userWorkflows.length === 0) {\n return;\n }\n /**\n * In the end, we need to attach the workflow filter by the entryId.\n * Just in case we add versioning at some point...\n */\n where.workflowId_in = userWorkflows.map(workflow => workflow.id);\n });\n};\n"],"mappings":";;;;;;;AASO,MAAMA,kBAAkB,GAAG,CAAC;EAAEC,GAAF;EAAOC;AAAP,CAAD,KAA4C;EAC1E;AACJ;AACA;AACA;EACID,GAAG,CAACE,aAAJ,CAAkBC,yBAAlB,CAA4CC,SAA5C,CAAsD,OAAO;IAAEC;EAAF,CAAP,KAAqB;IACvE;AACR;AACA;IACQ,IAAIA,KAAK,CAACC,aAAV,EAAyB;MACrB;IACH;;IACD,MAAMC,QAAQ,GAAGN,QAAQ,CAACO,WAAT,EAAjB;;IACA,IAAI,EAACD,QAAD,aAACA,QAAD,eAACA,QAAQ,CAAEE,EAAX,CAAJ,EAAmB;MACf;IACH;IACD;AACR;AACA;;;IACQ,MAAM,CAACC,SAAD,IAAc,MAAMV,GAAG,CAACW,QAAJ,CAAaC,IAAb,EAA1B;;IACA,IAAIF,SAAS,CAACG,MAAV,KAAqB,CAAzB,EAA4B;MACxB;IACH;IACD;AACR;AACA;AACA;;;IACQ,MAAMC,aAAa,GAAGJ,SAAS,CAACK,MAAV,CAAiBJ,QAAQ,IAAI;MAC/C,OAAOA,QAAQ,CAACK,KAAT,CAAeC,IAAf,CAAoBC,IAAI,IAAI;QAC/B,OAAOA,IAAI,CAACC,SAAL,CAAeF,IAAf,CAAoBG,QAAQ,IAAI;UACnC,OAAOb,QAAQ,CAACE,EAAT,KAAgBW,QAAQ,CAACC,UAAhC;QACH,CAFM,CAAP;MAGH,CAJM,CAAP;IAKH,CANqB,CAAtB;;IAOA,IAAIP,aAAa,CAACD,MAAd,KAAyB,CAA7B,EAAgC;MAC5B;IACH;IACD;AACR;AACA;AACA;;;IACQR,KAAK,CAACC,aAAN,GAAsBQ,aAAa,CAACQ,GAAd,CAAkBX,QAAQ,IAAIA,QAAQ,CAACF,EAAvC,CAAtB;EACH,CArCD;AAsCH,CA3CM"}
@@ -0,0 +1,2 @@
1
+ import { ApwContext } from "../../../types";
2
+ export declare const getAppUrl: (context: ApwContext) => Promise<import("@webiny/api-admin-settings/types").AdminSettings | null>;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getAppUrl = void 0;
7
+
8
+ const getAppUrl = async context => {
9
+ const tenant = context.tenancy.getCurrentTenant().id;
10
+
11
+ try {
12
+ return await context.settings.getSettings(tenant);
13
+ } catch (ex) {
14
+ if (ex.code !== "NOT_FOUND") {
15
+ throw ex;
16
+ }
17
+ }
18
+
19
+ return null;
20
+ };
21
+
22
+ exports.getAppUrl = getAppUrl;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getAppUrl","context","tenant","tenancy","getCurrentTenant","id","settings","getSettings","ex","code"],"sources":["appUrl.ts"],"sourcesContent":["import { ApwContext } from \"~/types\";\n\nexport const getAppUrl = async (context: ApwContext) => {\n const tenant = context.tenancy.getCurrentTenant().id;\n try {\n return await context.settings.getSettings(tenant);\n } catch (ex) {\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n return null;\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,SAAS,GAAG,MAAOC,OAAP,IAA+B;EACpD,MAAMC,MAAM,GAAGD,OAAO,CAACE,OAAR,CAAgBC,gBAAhB,GAAmCC,EAAlD;;EACA,IAAI;IACA,OAAO,MAAMJ,OAAO,CAACK,QAAR,CAAiBC,WAAjB,CAA6BL,MAA7B,CAAb;EACH,CAFD,CAEE,OAAOM,EAAP,EAAW;IACT,IAAIA,EAAE,CAACC,IAAH,KAAY,WAAhB,EAA6B;MACzB,MAAMD,EAAN;IACH;EACJ;;EACD,OAAO,IAAP;AACH,CAVM"}
@@ -0,0 +1,2 @@
1
+ import { ApwContext } from "../../../types";
2
+ export declare const attachChangeRequestAfterCreate: (context: ApwContext) => void;
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.attachChangeRequestAfterCreate = void 0;
9
+
10
+ var _error = _interopRequireDefault(require("@webiny/error"));
11
+
12
+ var _utils = require("../../utils");
13
+
14
+ var _contentUrl = require("./contentUrl");
15
+
16
+ var _sendChangeRequestNotification = require("./sendChangeRequestNotification");
17
+
18
+ var _reviewers = require("./reviewers");
19
+
20
+ var _changeRequestUrl = require("./changeRequestUrl");
21
+
22
+ var _appUrl = require("./appUrl");
23
+
24
+ const attachChangeRequestAfterCreate = context => {
25
+ context.apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({
26
+ changeRequest
27
+ }) => {
28
+ const execute = async () => {
29
+ const {
30
+ id: contentReviewId,
31
+ stepId
32
+ } = (0, _utils.extractContentReviewIdAndStep)(changeRequest.step);
33
+
34
+ if (!stepId) {
35
+ throw new _error.default("Malformed changeRequest.step value.", "MALFORMED_VALUE", {
36
+ step: changeRequest.step
37
+ });
38
+ }
39
+
40
+ const settings = await (0, _appUrl.getAppUrl)(context);
41
+
42
+ if (!settings) {
43
+ return;
44
+ }
45
+ /**
46
+ * We will check if we can create a comment url before we go digging further into the database.
47
+ */
48
+
49
+
50
+ const changeRequestUrl = (0, _changeRequestUrl.createChangeRequestUrl)({
51
+ baseUrl: settings.appUrl,
52
+ changeRequestId: changeRequest.id,
53
+ contentReviewId,
54
+ stepId
55
+ });
56
+
57
+ if (!changeRequestUrl) {
58
+ return;
59
+ }
60
+ /**
61
+ * Let's see if content review exists.
62
+ */
63
+
64
+
65
+ const contentReview = await context.apw.contentReview.get(contentReviewId);
66
+
67
+ if (!contentReview) {
68
+ throw new _error.default(`There is no contentReview with id "${contentReviewId}".`, "CONTENT_REVIEW_NOT_FOUND", {
69
+ contentReviewId
70
+ });
71
+ }
72
+ /**
73
+ * We go and check the workflow.
74
+ */
75
+
76
+
77
+ const workflow = await context.apw.workflow.get(contentReview.workflowId);
78
+
79
+ if (!workflow) {
80
+ throw new _error.default(`There is no workflow with workflowId "${contentReview.workflowId}".`, "WORKFLOW_NOT_FOUND", {
81
+ workflowId: contentReview.workflowId
82
+ });
83
+ }
84
+
85
+ const contentUrl = (0, _contentUrl.createContentUrl)({
86
+ plugins: context.plugins,
87
+ baseUrl: settings.appUrl,
88
+ contentReview,
89
+ workflow
90
+ });
91
+
92
+ if (!contentUrl) {
93
+ return;
94
+ }
95
+
96
+ const reviewers = await (0, _reviewers.fetchReviewers)({
97
+ context,
98
+ workflow,
99
+ exclude: [changeRequest.createdBy.id]
100
+ });
101
+
102
+ if (reviewers.length === 0) {
103
+ return;
104
+ }
105
+
106
+ try {
107
+ await (0, _sendChangeRequestNotification.sendChangeRequestNotification)({
108
+ context,
109
+ reviewers,
110
+ changeRequest,
111
+ contentReview,
112
+ workflow,
113
+ changeRequestUrl,
114
+ contentUrl
115
+ });
116
+ } catch (ex) {
117
+ throw new _error.default(`Could not send change request notifications.`, "CHANGE_REQUEST_NOTIFICATIONS_NOT_SENT", {
118
+ workflowId: workflow.id,
119
+ changeRequestId: changeRequest.id,
120
+ contentReviewId,
121
+ changeRequestUrl,
122
+ contentUrl,
123
+ error: {
124
+ message: ex.message,
125
+ code: ex.code,
126
+ data: ex.data,
127
+ stack: ex.stack
128
+ }
129
+ });
130
+ }
131
+ };
132
+
133
+ try {
134
+ context.security.disableAuthorization();
135
+ await execute();
136
+ } catch (ex) {
137
+ throw ex;
138
+ } finally {
139
+ context.security.enableAuthorization();
140
+ }
141
+ });
142
+ };
143
+
144
+ exports.attachChangeRequestAfterCreate = attachChangeRequestAfterCreate;
@@ -0,0 +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":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,MAAMA,8BAA8B,GAAIC,OAAD,IAA+B;EACzEA,OAAO,CAACC,GAAR,CAAYC,aAAZ,CAA0BC,0BAA1B,CAAqDC,SAArD,CAA+D,OAAO;IAAEF;EAAF,CAAP,KAA6B;IACxF,MAAMG,OAAO,GAAG,YAAY;MACxB,MAAM;QAAEC,EAAE,EAAEC,eAAN;QAAuBC;MAAvB,IAAkC,IAAAC,oCAAA,EACpCP,aAAa,CAACQ,IADsB,CAAxC;;MAGA,IAAI,CAACF,MAAL,EAAa;QACT,MAAM,IAAIG,cAAJ,CAAgB,qCAAhB,EAAuD,iBAAvD,EAA0E;UAC5ED,IAAI,EAAER,aAAa,CAACQ;QADwD,CAA1E,CAAN;MAGH;;MAED,MAAME,QAAQ,GAAG,MAAM,IAAAC,iBAAA,EAAUb,OAAV,CAAvB;;MACA,IAAI,CAACY,QAAL,EAAe;QACX;MACH;MACD;AACZ;AACA;;;MACY,MAAME,gBAAgB,GAAG,IAAAC,wCAAA,EAAuB;QAC5CC,OAAO,EAAEJ,QAAQ,CAACK,MAD0B;QAE5CC,eAAe,EAAEhB,aAAa,CAACI,EAFa;QAG5CC,eAH4C;QAI5CC;MAJ4C,CAAvB,CAAzB;;MAMA,IAAI,CAACM,gBAAL,EAAuB;QACnB;MACH;MACD;AACZ;AACA;;;MACY,MAAMK,aAAa,GAAG,MAAMnB,OAAO,CAACC,GAAR,CAAYkB,aAAZ,CAA0BC,GAA1B,CAA8Bb,eAA9B,CAA5B;;MACA,IAAI,CAACY,aAAL,EAAoB;QAChB,MAAM,IAAIR,cAAJ,CACD,sCAAqCJ,eAAgB,IAD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EAAE,CAACE,OADT;YAEHC,IAAI,EAAEH,EAAE,CAACG,IAFN;YAGHC,IAAI,EAAEJ,EAAE,CAACI,IAHN;YAIHC,KAAK,EAAEL,EAAE,CAACK;UAJP;QANX,CAHE,CAAN;MAiBH;IACJ,CArGD;;IAuGA,IAAI;MACArC,OAAO,CAACsC,QAAR,CAAiBC,oBAAjB;MACA,MAAMlC,OAAO,EAAb;IACH,CAHD,CAGE,OAAO2B,EAAP,EAAW;MACT,MAAMA,EAAN;IACH,CALD,SAKU;MACNhC,OAAO,CAACsC,QAAR,CAAiBE,mBAAjB;IACH;EACJ,CAhHD;AAiHH,CAlHM"}
@@ -0,0 +1,8 @@
1
+ interface Params {
2
+ baseUrl?: string;
3
+ changeRequestId: string;
4
+ contentReviewId: string;
5
+ stepId: string;
6
+ }
7
+ export declare const createChangeRequestUrl: (params: Params) => string | null;
8
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createChangeRequestUrl = void 0;
7
+
8
+ const createChangeRequestUrl = params => {
9
+ /**
10
+ * All variables must exist for URL to be created.
11
+ * We go through all vars and throw a log if it does not exist.
12
+ */
13
+ for (const key in params) {
14
+ if (!!key) {
15
+ continue;
16
+ }
17
+
18
+ console.log(`Missing variable "${key}", which we use to create a comment URL.`);
19
+ return null;
20
+ }
21
+
22
+ const {
23
+ baseUrl,
24
+ changeRequestId,
25
+ contentReviewId,
26
+ stepId
27
+ } = params;
28
+ return `${baseUrl}/apw/content-reviews/${contentReviewId}/${stepId}/${changeRequestId}`;
29
+ };
30
+
31
+ exports.createChangeRequestUrl = createChangeRequestUrl;
@@ -0,0 +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":";;;;;;;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"}
@@ -0,0 +1,2 @@
1
+ import { ApwContext } from "../../../types";
2
+ export declare const attachCommentAfterCreate: (context: ApwContext) => void;
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.attachCommentAfterCreate = void 0;
9
+
10
+ var _error = _interopRequireDefault(require("@webiny/error"));
11
+
12
+ var _utils = require("../../utils");
13
+
14
+ var _contentUrl = require("./contentUrl");
15
+
16
+ var _commentUrl = require("./commentUrl");
17
+
18
+ var _reviewers = require("./reviewers");
19
+
20
+ var _sendCommentNotification = require("./sendCommentNotification");
21
+
22
+ var _appUrl = require("./appUrl");
23
+
24
+ const attachCommentAfterCreate = context => {
25
+ context.apw.comment.onCommentAfterCreate.subscribe(async ({
26
+ comment
27
+ }) => {
28
+ const execute = async () => {
29
+ const changeRequest = await context.apw.changeRequest.get(comment.changeRequest);
30
+
31
+ if (!changeRequest) {
32
+ throw new _error.default("Missing change request.", "CHANGE_REQUEST_NOT_FOUND", {
33
+ changeRequest: comment.changeRequest,
34
+ comment: comment.id
35
+ });
36
+ }
37
+
38
+ const {
39
+ id: contentReviewId,
40
+ stepId
41
+ } = (0, _utils.extractContentReviewIdAndStep)(changeRequest.step);
42
+
43
+ if (!stepId) {
44
+ throw new _error.default("Malformed changeRequest.step value.", "MALFORMED_VALUE", {
45
+ step: changeRequest.step
46
+ });
47
+ }
48
+
49
+ const settings = await (0, _appUrl.getAppUrl)(context);
50
+
51
+ if (!settings) {
52
+ return;
53
+ }
54
+ /**
55
+ * We will check if we can create a comment url before we go digging further into the database.
56
+ */
57
+
58
+
59
+ const commentUrl = (0, _commentUrl.createCommentUrl)({
60
+ baseUrl: settings.appUrl,
61
+ changeRequestId: changeRequest.id,
62
+ contentReviewId,
63
+ stepId
64
+ });
65
+
66
+ if (!commentUrl) {
67
+ console.log("No comment url.");
68
+ return;
69
+ }
70
+ /**
71
+ * Let's see if content review exists.
72
+ */
73
+
74
+
75
+ const contentReview = await context.apw.contentReview.get(contentReviewId);
76
+
77
+ if (!contentReview) {
78
+ throw new _error.default(`There is no contentReview with id "${contentReviewId}".`, "CONTENT_REVIEW_NOT_FOUND", {
79
+ contentReviewId
80
+ });
81
+ }
82
+ /**
83
+ * We go and check the workflow.
84
+ */
85
+
86
+
87
+ const workflow = await context.apw.workflow.get(contentReview.workflowId);
88
+
89
+ if (!workflow) {
90
+ throw new _error.default(`There is no workflow with workflowId "${contentReview.workflowId}".`, "WORKFLOW_NOT_FOUND", {
91
+ workflowId: contentReview.workflowId
92
+ });
93
+ }
94
+
95
+ const contentUrl = (0, _contentUrl.createContentUrl)({
96
+ plugins: context.plugins,
97
+ baseUrl: settings.appUrl,
98
+ contentReview,
99
+ workflow
100
+ });
101
+
102
+ if (!contentUrl) {
103
+ console.log("No content url.");
104
+ return;
105
+ }
106
+
107
+ const reviewers = await (0, _reviewers.fetchReviewers)({
108
+ context,
109
+ workflow,
110
+ exclude: [comment.createdBy.id]
111
+ });
112
+
113
+ if (reviewers.length === 0) {
114
+ console.log("No reviewers to send the e-mail notification to.");
115
+ return;
116
+ }
117
+
118
+ try {
119
+ await (0, _sendCommentNotification.sendCommentNotification)({
120
+ context,
121
+ reviewers,
122
+ changeRequest,
123
+ contentReview,
124
+ workflow,
125
+ commentUrl,
126
+ contentUrl
127
+ });
128
+ } catch (ex) {
129
+ throw new _error.default(`Could not send comment notifications.`, "COMMENT_NOTIFICATIONS_NOT_SENT", {
130
+ commentId: comment.id,
131
+ workflowId: workflow.id,
132
+ changeRequestId: changeRequest.id,
133
+ contentReviewId,
134
+ commentUrl,
135
+ contentUrl,
136
+ error: {
137
+ message: ex.message,
138
+ code: ex.code,
139
+ data: ex.data,
140
+ stack: ex.stack
141
+ }
142
+ });
143
+ }
144
+ };
145
+
146
+ try {
147
+ context.security.disableAuthorization();
148
+ await execute();
149
+ } catch (ex) {
150
+ throw ex;
151
+ } finally {
152
+ context.security.enableAuthorization();
153
+ }
154
+ });
155
+ };
156
+
157
+ exports.attachCommentAfterCreate = attachCommentAfterCreate;
@@ -0,0 +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":";;;;;;;;;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,IAAAC,oCAAA,EACpCN,aAAa,CAACO,IADsB,CAAxC;;MAGA,IAAI,CAACF,MAAL,EAAa;QACT,MAAM,IAAIH,cAAJ,CAAgB,qCAAhB,EAAuD,iBAAvD,EAA0E;UAC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changeRequestId: string;
4
+ contentReviewId: string;
5
+ stepId: string;
6
+ }
7
+ export declare const createCommentUrl: (params: CreateCommentUrlParams) => string | null;
8
+ export {};