@webiny/api-apw 5.33.5 → 5.34.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (207) 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.js +1 -1
  14. package/crud/createChangeRequestMethods.js +21 -18
  15. package/crud/createChangeRequestMethods.js.map +1 -1
  16. package/crud/createCommentMethods.js +21 -18
  17. package/crud/createCommentMethods.js.map +1 -1
  18. package/crud/createContentReviewMethods.js +60 -50
  19. package/crud/createContentReviewMethods.js.map +1 -1
  20. package/crud/createReviewerMethods.js +21 -18
  21. package/crud/createReviewerMethods.js.map +1 -1
  22. package/crud/createWorkflowMethods.d.ts +1 -1
  23. package/crud/createWorkflowMethods.js +42 -20
  24. package/crud/createWorkflowMethods.js.map +1 -1
  25. package/crud/index.js +3 -7
  26. package/crud/index.js.map +1 -1
  27. package/crud/utils.js +4 -8
  28. package/crud/utils.js.map +1 -1
  29. package/index.d.ts +3 -3
  30. package/index.js +8 -4
  31. package/index.js.map +1 -1
  32. package/package.json +38 -37
  33. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +1 -1
  34. package/plugins/cms/apwEntryPlugins.js +4 -8
  35. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  36. package/plugins/cms/index.js +9 -1
  37. package/plugins/cms/index.js.map +1 -1
  38. package/plugins/cms/linkContentReviewToEntry.js +4 -4
  39. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  40. package/plugins/cms/linkWorkflowToEntry.js +5 -5
  41. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  42. package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
  43. package/plugins/cms/notifications/changeRequestNotification.js +35 -0
  44. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
  45. package/plugins/cms/notifications/commentNotification.d.ts +1 -0
  46. package/plugins/cms/notifications/commentNotification.js +35 -0
  47. package/plugins/cms/notifications/commentNotification.js.map +1 -0
  48. package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
  49. package/plugins/cms/notifications/contentReviewNotification.js +35 -0
  50. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
  51. package/plugins/cms/notifications/contentUrl.d.ts +8 -0
  52. package/plugins/cms/notifications/contentUrl.js +60 -0
  53. package/plugins/cms/notifications/contentUrl.js.map +1 -0
  54. package/plugins/cms/triggerContentReview.js +3 -3
  55. package/plugins/cms/triggerContentReview.js.map +1 -1
  56. package/plugins/cms/updateContentReviewStatus.js +10 -14
  57. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  58. package/plugins/cms/utils.js +4 -8
  59. package/plugins/cms/utils.js.map +1 -1
  60. package/plugins/context.js +1 -1
  61. package/plugins/graphql/changeRequest.gql.js +1 -1
  62. package/plugins/graphql/comment.gql.js +1 -1
  63. package/plugins/graphql/contentReview.gql.js +4 -4
  64. package/plugins/graphql/contentReview.gql.js.map +1 -1
  65. package/plugins/graphql/reviewer.gql.js +3 -1
  66. package/plugins/graphql/reviewer.gql.js.map +1 -1
  67. package/plugins/graphql/workflow.gql.js +1 -1
  68. package/plugins/graphql.js +1 -1
  69. package/plugins/hooks/createReviewerFromIdentity.js +28 -8
  70. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  71. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +1 -1
  72. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  73. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +1 -1
  74. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  75. package/plugins/hooks/index.js +6 -0
  76. package/plugins/hooks/index.js.map +1 -1
  77. package/plugins/hooks/initializeContentReviewSteps.js +5 -8
  78. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  79. package/plugins/hooks/initializeNotifications.d.ts +2 -0
  80. package/plugins/hooks/initializeNotifications.js +20 -0
  81. package/plugins/hooks/initializeNotifications.js.map +1 -0
  82. package/plugins/hooks/listContentReviews.d.ts +10 -0
  83. package/plugins/hooks/listContentReviews.js +68 -0
  84. package/plugins/hooks/listContentReviews.js.map +1 -0
  85. package/plugins/hooks/notifications/appUrl.d.ts +2 -0
  86. package/plugins/hooks/notifications/appUrl.js +22 -0
  87. package/plugins/hooks/notifications/appUrl.js.map +1 -0
  88. package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
  89. package/plugins/hooks/notifications/changeRequestAfterCreate.js +144 -0
  90. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
  91. package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
  92. package/plugins/hooks/notifications/changeRequestUrl.js +31 -0
  93. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
  94. package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
  95. package/plugins/hooks/notifications/commentAfterCreate.js +157 -0
  96. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
  97. package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
  98. package/plugins/hooks/notifications/commentUrl.js +31 -0
  99. package/plugins/hooks/notifications/commentUrl.js.map +1 -0
  100. package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
  101. package/plugins/hooks/notifications/contentReviewAfterCreate.js +122 -0
  102. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
  103. package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
  104. package/plugins/hooks/notifications/contentReviewUrl.js +30 -0
  105. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
  106. package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
  107. package/plugins/hooks/notifications/contentUrl.js +29 -0
  108. package/plugins/hooks/notifications/contentUrl.js.map +1 -0
  109. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
  110. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +25 -0
  111. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
  112. package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
  113. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +25 -0
  114. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
  115. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
  116. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +25 -0
  117. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
  118. package/plugins/hooks/notifications/reviewers.d.ts +15 -0
  119. package/plugins/hooks/notifications/reviewers.js +51 -0
  120. package/plugins/hooks/notifications/reviewers.js.map +1 -0
  121. package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
  122. package/plugins/hooks/notifications/sendChangeRequestNotification.js +52 -0
  123. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
  124. package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
  125. package/plugins/hooks/notifications/sendCommentNotification.js +52 -0
  126. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
  127. package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
  128. package/plugins/hooks/notifications/sendContentReviewNotification.js +52 -0
  129. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
  130. package/plugins/hooks/updatePendingChangeRequests.js +7 -11
  131. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  132. package/plugins/hooks/updateTotalComments.js +14 -18
  133. package/plugins/hooks/updateTotalComments.js.map +1 -1
  134. package/plugins/hooks/validateChangeRequest.js +30 -5
  135. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  136. package/plugins/hooks/validateComment.js +14 -4
  137. package/plugins/hooks/validateComment.js.map +1 -1
  138. package/plugins/hooks/validateContentReview.js +2 -2
  139. package/plugins/hooks/validateContentReview.js.map +1 -1
  140. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +1 -1
  141. package/plugins/pageBuilder/index.js +9 -1
  142. package/plugins/pageBuilder/index.js.map +1 -1
  143. package/plugins/pageBuilder/linkContentReviewToPage.js +41 -29
  144. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
  145. package/plugins/pageBuilder/linkWorkflowToPage.js +18 -6
  146. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  147. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
  148. package/plugins/pageBuilder/notifications/changeRequestNotification.js +35 -0
  149. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
  150. package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
  151. package/plugins/pageBuilder/notifications/commentNotification.js +35 -0
  152. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
  153. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
  154. package/plugins/pageBuilder/notifications/contentReviewNotification.js +35 -0
  155. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
  156. package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
  157. package/plugins/pageBuilder/notifications/contentUrl.js +53 -0
  158. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
  159. package/plugins/pageBuilder/triggerContentReview.js +3 -3
  160. package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
  161. package/plugins/pageBuilder/updateContentReviewStatus.js +10 -14
  162. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
  163. package/plugins/pageBuilder/utils.js +1 -1
  164. package/plugins/pageBuilder/utils.js.map +1 -1
  165. package/plugins/utils.d.ts +1 -1
  166. package/plugins/utils.js +4 -14
  167. package/plugins/utils.js.map +1 -1
  168. package/scheduler/createScheduleActionMethods.js +17 -14
  169. package/scheduler/createScheduleActionMethods.js.map +1 -1
  170. package/scheduler/handlers/executeAction/index.d.ts +1 -1
  171. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +1 -1
  172. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +1 -1
  173. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +1 -1
  174. package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
  175. package/scheduler/handlers/scheduleAction/index.js +8 -9
  176. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  177. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +5 -9
  178. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  179. package/scheduler/handlers/utils.d.ts +1 -1
  180. package/scheduler/handlers/utils.js +1 -1
  181. package/storageOperations/changeRequestStorageOperations.js +5 -9
  182. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  183. package/storageOperations/commentStorageOperations.js +4 -8
  184. package/storageOperations/commentStorageOperations.js.map +1 -1
  185. package/storageOperations/contentReviewStorageOperations.js +5 -9
  186. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  187. package/storageOperations/index.js +5 -9
  188. package/storageOperations/index.js.map +1 -1
  189. package/storageOperations/models/contentModelPluginFactory.js +3 -7
  190. package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
  191. package/storageOperations/models/contentReview.model.js +6 -5
  192. package/storageOperations/models/contentReview.model.js.map +1 -1
  193. package/storageOperations/models/index.js +1 -1
  194. package/storageOperations/models/reviewer.model.js +18 -2
  195. package/storageOperations/models/reviewer.model.js.map +1 -1
  196. package/storageOperations/models/utils.js +3 -2
  197. package/storageOperations/models/utils.js.map +1 -1
  198. package/storageOperations/reviewerStorageOperations.js +18 -14
  199. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  200. package/storageOperations/workflowStorageOperations.js +8 -12
  201. package/storageOperations/workflowStorageOperations.js.map +1 -1
  202. package/types.d.ts +99 -84
  203. package/types.js.map +1 -1
  204. package/utils/errors.js +1 -1
  205. package/utils/fieldResolver.js +3 -9
  206. package/utils/fieldResolver.js.map +1 -1
  207. package/utils/resolve.d.ts +1 -1
@@ -0,0 +1,11 @@
1
+ import { ApwContentTypes, ApwContext } from "../../../types";
2
+ import { ApwChangeRequestNotification } from "../../../ApwChangeRequestNotification";
3
+ interface GetLastChangeRequestNotificationPluginParams {
4
+ context: ApwContext;
5
+ type: ApwContentTypes;
6
+ }
7
+ interface GetLastChangeRequestNotificationPlugin {
8
+ (params: GetLastChangeRequestNotificationPluginParams): ApwChangeRequestNotification | undefined;
9
+ }
10
+ export declare const getLastChangeRequestNotificationPlugin: GetLastChangeRequestNotificationPlugin;
11
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLastChangeRequestNotificationPlugin = void 0;
7
+
8
+ var _ApwChangeRequestNotification = require("../../../ApwChangeRequestNotification");
9
+
10
+ const getLastChangeRequestNotificationPlugin = params => {
11
+ const {
12
+ context,
13
+ type
14
+ } = params;
15
+ /**
16
+ * We need the plugin to create the notification text.
17
+ */
18
+
19
+ const plugins = context.plugins.byType(_ApwChangeRequestNotification.ApwChangeRequestNotification.type).filter(plugin => {
20
+ return plugin.canUse(type);
21
+ });
22
+ return plugins.shift();
23
+ };
24
+
25
+ exports.getLastChangeRequestNotificationPlugin = getLastChangeRequestNotificationPlugin;
@@ -0,0 +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"}
@@ -0,0 +1,11 @@
1
+ import { ApwContentTypes, ApwContext } from "../../../types";
2
+ import { ApwCommentNotification } from "../../../ApwCommentNotification";
3
+ interface GetLastCommentNotificationPluginParams {
4
+ context: ApwContext;
5
+ type: ApwContentTypes;
6
+ }
7
+ interface GetLastCommentNotificationPlugin {
8
+ (params: GetLastCommentNotificationPluginParams): ApwCommentNotification | undefined;
9
+ }
10
+ export declare const getLastCommentNotificationPlugin: GetLastCommentNotificationPlugin;
11
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLastCommentNotificationPlugin = void 0;
7
+
8
+ var _ApwCommentNotification = require("../../../ApwCommentNotification");
9
+
10
+ const getLastCommentNotificationPlugin = params => {
11
+ const {
12
+ context,
13
+ type
14
+ } = params;
15
+ /**
16
+ * We need the plugin to create the notification text.
17
+ */
18
+
19
+ const plugins = context.plugins.byType(_ApwCommentNotification.ApwCommentNotification.type).filter(plugin => {
20
+ return plugin.canUse(type);
21
+ });
22
+ return plugins.shift();
23
+ };
24
+
25
+ exports.getLastCommentNotificationPlugin = getLastCommentNotificationPlugin;
@@ -0,0 +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"}
@@ -0,0 +1,11 @@
1
+ import { ApwContentTypes, ApwContext } from "../../../types";
2
+ import { ApwContentReviewNotification } from "../../../ApwContentReviewNotification";
3
+ interface GetLastContentReviewNotificationPluginParams {
4
+ context: ApwContext;
5
+ type: ApwContentTypes;
6
+ }
7
+ interface GetLastContentReviewNotificationPlugin {
8
+ (params: GetLastContentReviewNotificationPluginParams): ApwContentReviewNotification | undefined;
9
+ }
10
+ export declare const getLastContentReviewNotificationPlugin: GetLastContentReviewNotificationPlugin;
11
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLastContentReviewNotificationPlugin = void 0;
7
+
8
+ var _ApwContentReviewNotification = require("../../../ApwContentReviewNotification");
9
+
10
+ const getLastContentReviewNotificationPlugin = params => {
11
+ const {
12
+ context,
13
+ type
14
+ } = params;
15
+ /**
16
+ * We need the plugin to create the notification text.
17
+ */
18
+
19
+ const plugins = context.plugins.byType(_ApwContentReviewNotification.ApwContentReviewNotification.type).filter(plugin => {
20
+ return plugin.canUse(type);
21
+ });
22
+ return plugins.shift();
23
+ };
24
+
25
+ exports.getLastContentReviewNotificationPlugin = getLastContentReviewNotificationPlugin;
@@ -0,0 +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"}
@@ -0,0 +1,15 @@
1
+ import { ApwContext, ApwReviewerWithEmail, ApwWorkflow, ApwWorkflowStep } from "../../../types";
2
+ interface GetReviewerIdListParams {
3
+ steps: ApwWorkflowStep[];
4
+ }
5
+ interface GetReviewerIdList {
6
+ (params: GetReviewerIdListParams): string[];
7
+ }
8
+ export declare const getReviewerIdList: GetReviewerIdList;
9
+ interface FetchReviewersParams {
10
+ context: ApwContext;
11
+ workflow: ApwWorkflow;
12
+ exclude: string[];
13
+ }
14
+ export declare const fetchReviewers: (params: FetchReviewersParams) => Promise<ApwReviewerWithEmail[]>;
15
+ export {};
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getReviewerIdList = exports.fetchReviewers = void 0;
7
+
8
+ const getReviewerIdList = ({
9
+ steps
10
+ }) => {
11
+ return steps.reduce((collection, step) => {
12
+ for (const reviewer of step.reviewers) {
13
+ if (collection.includes(reviewer.id)) {
14
+ return collection;
15
+ }
16
+
17
+ collection.push(reviewer.id);
18
+ }
19
+
20
+ return collection;
21
+ }, []);
22
+ };
23
+
24
+ exports.getReviewerIdList = getReviewerIdList;
25
+
26
+ const fetchReviewers = async params => {
27
+ const {
28
+ context,
29
+ workflow,
30
+ exclude
31
+ } = params;
32
+ 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;
48
+ });
49
+ };
50
+
51
+ exports.fetchReviewers = fetchReviewers;
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ import { ApwChangeRequestNotificationCbParams } from "../../../ApwChangeRequestNotification";
2
+ export declare const sendChangeRequestNotification: (params: ApwChangeRequestNotificationCbParams) => Promise<void>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.sendChangeRequestNotification = void 0;
7
+
8
+ var _lastChangeRequestNotificationPlugin = require("./lastChangeRequestNotificationPlugin");
9
+
10
+ const sendChangeRequestNotification = async params => {
11
+ const {
12
+ context,
13
+ reviewers,
14
+ contentReview
15
+ } = params;
16
+
17
+ if (reviewers.length === 0) {
18
+ return;
19
+ }
20
+
21
+ const changeRequestPlugin = (0, _lastChangeRequestNotificationPlugin.getLastChangeRequestNotificationPlugin)({
22
+ context,
23
+ type: contentReview.content.type
24
+ });
25
+
26
+ if (!changeRequestPlugin) {
27
+ console.log("No e-mail body change request plugin.");
28
+ return;
29
+ }
30
+
31
+ const body = changeRequestPlugin.create(params);
32
+
33
+ if (!body) {
34
+ console.log(`No e-mail body from the change request plugin: ${changeRequestPlugin.name}`);
35
+ return;
36
+ }
37
+
38
+ const result = await context.mailer.sendMail({
39
+ bcc: reviewers.map(r => r.email),
40
+ subject: "There is a new change request on the Content Review you are assigned on.",
41
+ text: body.text,
42
+ html: body.html || body.text
43
+ });
44
+
45
+ if (!result.error) {
46
+ return;
47
+ }
48
+
49
+ console.log("Error while sending e-mail", JSON.stringify(result.error));
50
+ };
51
+
52
+ exports.sendChangeRequestNotification = sendChangeRequestNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sendChangeRequestNotification","params","context","reviewers","contentReview","length","changeRequestPlugin","getLastChangeRequestNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify"],"sources":["sendChangeRequestNotification.ts"],"sourcesContent":["import { getLastChangeRequestNotificationPlugin } from \"./lastChangeRequestNotificationPlugin\";\nimport { ApwChangeRequestNotificationCbParams } from \"~/ApwChangeRequestNotification\";\n\nexport const sendChangeRequestNotification = async (\n params: ApwChangeRequestNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const changeRequestPlugin = getLastChangeRequestNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!changeRequestPlugin) {\n console.log(\"No e-mail body change request plugin.\");\n return;\n }\n\n const body = changeRequestPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the change request plugin: ${changeRequestPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new change request on the Content Review you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,6BAA6B,GAAG,MACzCC,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"}
@@ -0,0 +1,2 @@
1
+ import { ApwCommentNotificationCbParams } from "../../../ApwCommentNotification";
2
+ export declare const sendCommentNotification: (params: ApwCommentNotificationCbParams) => Promise<void>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.sendCommentNotification = void 0;
7
+
8
+ var _lastCommentNotificationPlugin = require("./lastCommentNotificationPlugin");
9
+
10
+ const sendCommentNotification = async params => {
11
+ const {
12
+ context,
13
+ reviewers,
14
+ contentReview
15
+ } = params;
16
+
17
+ if (reviewers.length === 0) {
18
+ return;
19
+ }
20
+
21
+ const commentPlugin = (0, _lastCommentNotificationPlugin.getLastCommentNotificationPlugin)({
22
+ context,
23
+ type: contentReview.content.type
24
+ });
25
+
26
+ if (!commentPlugin) {
27
+ console.log("No e-mail body comment plugin.");
28
+ return;
29
+ }
30
+
31
+ const body = commentPlugin.create(params);
32
+
33
+ if (!body) {
34
+ console.log(`No e-mail body from the comment plugin: ${commentPlugin.name}`);
35
+ return;
36
+ }
37
+
38
+ const result = await context.mailer.sendMail({
39
+ bcc: reviewers.map(r => r.email),
40
+ subject: "There is a new comment on the Content Review you are assigned on.",
41
+ text: body.text,
42
+ html: body.html || body.text
43
+ });
44
+
45
+ if (!result.error) {
46
+ return;
47
+ }
48
+
49
+ console.log("Error while sending e-mail", JSON.stringify(result.error));
50
+ };
51
+
52
+ exports.sendCommentNotification = sendCommentNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sendCommentNotification","params","context","reviewers","contentReview","length","commentPlugin","getLastCommentNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify"],"sources":["sendCommentNotification.ts"],"sourcesContent":["import { getLastCommentNotificationPlugin } from \"./lastCommentNotificationPlugin\";\nimport { ApwCommentNotificationCbParams } from \"~/ApwCommentNotification\";\n\nexport const sendCommentNotification = async (\n params: ApwCommentNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const commentPlugin = getLastCommentNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!commentPlugin) {\n console.log(\"No e-mail body comment plugin.\");\n return;\n }\n\n const body = commentPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the comment plugin: ${commentPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new comment on the Content Review you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,uBAAuB,GAAG,MACnCC,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"}
@@ -0,0 +1,2 @@
1
+ import { ApwContentReviewNotificationCbParams } from "../../../ApwContentReviewNotification";
2
+ export declare const sendContentReviewNotification: (params: ApwContentReviewNotificationCbParams) => Promise<void>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.sendContentReviewNotification = void 0;
7
+
8
+ var _lastContentReviewNotificationPlugin = require("./lastContentReviewNotificationPlugin");
9
+
10
+ const sendContentReviewNotification = async params => {
11
+ const {
12
+ context,
13
+ reviewers,
14
+ contentReview
15
+ } = params;
16
+
17
+ if (reviewers.length === 0) {
18
+ return;
19
+ }
20
+
21
+ const contentReviewPlugin = (0, _lastContentReviewNotificationPlugin.getLastContentReviewNotificationPlugin)({
22
+ context,
23
+ type: contentReview.content.type
24
+ });
25
+
26
+ if (!contentReviewPlugin) {
27
+ console.log("No e-mail body content review plugin.");
28
+ return;
29
+ }
30
+
31
+ const body = contentReviewPlugin.create(params);
32
+
33
+ if (!body) {
34
+ console.log(`No e-mail body from the content review plugin: ${contentReviewPlugin.name}`);
35
+ return;
36
+ }
37
+
38
+ const result = await context.mailer.sendMail({
39
+ bcc: reviewers.map(r => r.email),
40
+ subject: "There is a new content review which you are assigned on.",
41
+ text: body.text,
42
+ html: body.html || body.text
43
+ });
44
+
45
+ if (!result.error) {
46
+ return;
47
+ }
48
+
49
+ console.log("Error while sending e-mail", JSON.stringify(result.error));
50
+ };
51
+
52
+ exports.sendContentReviewNotification = sendContentReviewNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sendContentReviewNotification","params","context","reviewers","contentReview","length","contentReviewPlugin","getLastContentReviewNotificationPlugin","type","content","console","log","body","create","name","result","mailer","sendMail","bcc","map","r","email","subject","text","html","error","JSON","stringify"],"sources":["sendContentReviewNotification.ts"],"sourcesContent":["import { getLastContentReviewNotificationPlugin } from \"./lastContentReviewNotificationPlugin\";\nimport { ApwContentReviewNotificationCbParams } from \"~/ApwContentReviewNotification\";\n\nexport const sendContentReviewNotification = async (\n params: ApwContentReviewNotificationCbParams\n): Promise<void> => {\n const { context, reviewers, contentReview } = params;\n if (reviewers.length === 0) {\n return;\n }\n\n const contentReviewPlugin = getLastContentReviewNotificationPlugin({\n context,\n type: contentReview.content.type\n });\n if (!contentReviewPlugin) {\n console.log(\"No e-mail body content review plugin.\");\n return;\n }\n\n const body = contentReviewPlugin.create(params);\n if (!body) {\n console.log(`No e-mail body from the content review plugin: ${contentReviewPlugin.name}`);\n return;\n }\n\n const result = await context.mailer.sendMail({\n bcc: reviewers.map(r => r.email),\n subject: \"There is a new content review which you are assigned on.\",\n text: body.text,\n html: body.html || body.text\n });\n if (!result.error) {\n return;\n }\n console.log(\"Error while sending e-mail\", JSON.stringify(result.error));\n};\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,6BAA6B,GAAG,MACzCC,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,20 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.updatePendingChangeRequestsCount = void 0;
9
9
 
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
11
 
12
12
  var _utils = require("../utils");
13
13
 
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
-
18
14
  const updatePendingChangeRequests = async ({
19
15
  contentReviewMethods,
20
16
  step,
@@ -28,8 +24,8 @@ const updatePendingChangeRequests = async ({
28
24
  contentReviewMethods,
29
25
  id,
30
26
  getNewContentReviewData: data => {
31
- return _objectSpread(_objectSpread({}, data), {}, {
32
- steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => _objectSpread(_objectSpread({}, step), {}, {
27
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
28
+ steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
33
29
  pendingChangeRequests: step.pendingChangeRequests + delta
34
30
  }))
35
31
  });
@@ -40,7 +36,7 @@ const updatePendingChangeRequests = async ({
40
36
  const updatePendingChangeRequestsCount = ({
41
37
  apw
42
38
  }) => {
43
- apw.changeRequest.onAfterChangeRequestDelete.subscribe(async ({
39
+ apw.changeRequest.onChangeRequestAfterDelete.subscribe(async ({
44
40
  changeRequest
45
41
  }) => {
46
42
  /**
@@ -62,7 +58,7 @@ const updatePendingChangeRequestsCount = ({
62
58
  delta: -1
63
59
  });
64
60
  });
65
- apw.changeRequest.onAfterChangeRequestCreate.subscribe(async ({
61
+ apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({
66
62
  changeRequest
67
63
  }) => {
68
64
  /**
@@ -75,7 +71,7 @@ const updatePendingChangeRequestsCount = ({
75
71
  delta: 1
76
72
  });
77
73
  });
78
- apw.changeRequest.onAfterChangeRequestUpdate.subscribe(async ({
74
+ apw.changeRequest.onChangeRequestAfterUpdate.subscribe(async ({
79
75
  changeRequest,
80
76
  original
81
77
  }) => {
@@ -1 +1 @@
1
- {"version":3,"names":["updatePendingChangeRequests","contentReviewMethods","step","delta","id","stepId","extractContentReviewIdAndStep","updateContentReview","getNewContentReviewData","data","steps","updateContentReviewStep","pendingChangeRequests","updatePendingChangeRequestsCount","apw","changeRequest","onAfterChangeRequestDelete","subscribe","resolved","contentReview","onAfterChangeRequestCreate","onAfterChangeRequestUpdate","original"],"sources":["updatePendingChangeRequests.ts"],"sourcesContent":["import { ApwChangeRequest, ApwContentReviewCrud, LifeCycleHookCallbackParams } from \"~/types\";\nimport {\n extractContentReviewIdAndStep,\n updateContentReview,\n updateContentReviewStep\n} from \"../utils\";\n\ninterface UpdatePendingChangeRequestsParams {\n contentReviewMethods: ApwContentReviewCrud;\n delta: number;\n step: ApwChangeRequest[\"step\"];\n}\n\nconst updatePendingChangeRequests = async ({\n contentReviewMethods,\n step,\n delta\n}: UpdatePendingChangeRequestsParams): Promise<void> => {\n const { id, stepId } = extractContentReviewIdAndStep(step);\n\n await updateContentReview({\n contentReviewMethods,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n pendingChangeRequests: step.pendingChangeRequests + delta\n }))\n };\n }\n });\n};\n\nexport const updatePendingChangeRequestsCount = ({\n apw\n}: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onAfterChangeRequestDelete.subscribe(async ({ changeRequest }) => {\n /**\n * If the deleted changeRequest was marked as resolved. We don't need to do anything here,\n * because \"pendingChangeRequests has been already updated in \"onAfterChangeRequestUpdate\" hook.\n */\n if (changeRequest.resolved === true) {\n return;\n }\n /**\n * After a \"changeRequest\" is deleted, decrement the \"pendingChangeRequests\" count\n * in the corresponding step of the content review entry.\n */\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta: -1\n });\n });\n\n apw.changeRequest.onAfterChangeRequestCreate.subscribe(async ({ changeRequest }) => {\n /**\n * After a \"changeRequest\" is created, increment the \"pendingChangeRequests\" count\n * of the corresponding step in the content review entry.\n */\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta: 1\n });\n });\n\n apw.changeRequest.onAfterChangeRequestUpdate.subscribe(async ({ changeRequest, original }) => {\n /**\n * After a \"changeRequest\" is created, and the value of \"resolved\" field has changed;\n * then we also need to update the \"pendingChangeRequests\" count of the corresponding step in the content review entry.\n */\n if (original.resolved !== changeRequest.resolved) {\n const resolved = changeRequest.resolved;\n const delta = resolved === true ? -1 : 1;\n\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta\n });\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AACA;;;;;;AAYA,MAAMA,2BAA2B,GAAG,OAAO;EACvCC,oBADuC;EAEvCC,IAFuC;EAGvCC;AAHuC,CAAP,KAIoB;EACpD,MAAM;IAAEC,EAAF;IAAMC;EAAN,IAAiB,IAAAC,oCAAA,EAA8BJ,IAA9B,CAAvB;EAEA,MAAM,IAAAK,0BAAA,EAAoB;IACtBN,oBADsB;IAEtBG,EAFsB;IAGtBI,uBAAuB,EAAEC,IAAI,IAAI;MAC7B,uCACOA,IADP;QAEIC,KAAK,EAAE,IAAAC,8BAAA,EAAwBF,IAAI,CAACC,KAA7B,EAAoCL,MAApC,EAA4CH,IAAI,oCAChDA,IADgD;UAEnDU,qBAAqB,EAAEV,IAAI,CAACU,qBAAL,GAA6BT;QAFD,EAAhD;MAFX;IAOH;EAXqB,CAApB,CAAN;AAaH,CApBD;;AAsBO,MAAMU,gCAAgC,GAAG,CAAC;EAC7CC;AAD6C,CAAD,KAEA;EAC5CA,GAAG,CAACC,aAAJ,CAAkBC,0BAAlB,CAA6CC,SAA7C,CAAuD,OAAO;IAAEF;EAAF,CAAP,KAA6B;IAChF;AACR;AACA;AACA;IACQ,IAAIA,aAAa,CAACG,QAAd,KAA2B,IAA/B,EAAqC;MACjC;IACH;IACD;AACR;AACA;AACA;;;IACQ,MAAMlB,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aADI;MAE9BjB,IAAI,EAAEa,aAAa,CAACb,IAFU;MAG9BC,KAAK,EAAE,CAAC;IAHsB,CAAD,CAAjC;EAKH,CAjBD;EAmBAW,GAAG,CAACC,aAAJ,CAAkBK,0BAAlB,CAA6CH,SAA7C,CAAuD,OAAO;IAAEF;EAAF,CAAP,KAA6B;IAChF;AACR;AACA;AACA;IACQ,MAAMf,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aADI;MAE9BjB,IAAI,EAAEa,aAAa,CAACb,IAFU;MAG9BC,KAAK,EAAE;IAHuB,CAAD,CAAjC;EAKH,CAVD;EAYAW,GAAG,CAACC,aAAJ,CAAkBM,0BAAlB,CAA6CJ,SAA7C,CAAuD,OAAO;IAAEF,aAAF;IAAiBO;EAAjB,CAAP,KAAuC;IAC1F;AACR;AACA;AACA;IACQ,IAAIA,QAAQ,CAACJ,QAAT,KAAsBH,aAAa,CAACG,QAAxC,EAAkD;MAC9C,MAAMA,QAAQ,GAAGH,aAAa,CAACG,QAA/B;MACA,MAAMf,KAAK,GAAGe,QAAQ,KAAK,IAAb,GAAoB,CAAC,CAArB,GAAyB,CAAvC;MAEA,MAAMlB,2BAA2B,CAAC;QAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aADI;QAE9BjB,IAAI,EAAEa,aAAa,CAACb,IAFU;QAG9BC;MAH8B,CAAD,CAAjC;IAKH;EACJ,CAfD;AAgBH,CAlDM"}
1
+ {"version":3,"names":["updatePendingChangeRequests","contentReviewMethods","step","delta","id","stepId","extractContentReviewIdAndStep","updateContentReview","getNewContentReviewData","data","steps","updateContentReviewStep","pendingChangeRequests","updatePendingChangeRequestsCount","apw","changeRequest","onChangeRequestAfterDelete","subscribe","resolved","contentReview","onChangeRequestAfterCreate","onChangeRequestAfterUpdate","original"],"sources":["updatePendingChangeRequests.ts"],"sourcesContent":["import { ApwChangeRequest, ApwContentReviewCrud, LifeCycleHookCallbackParams } from \"~/types\";\nimport {\n extractContentReviewIdAndStep,\n updateContentReview,\n updateContentReviewStep\n} from \"../utils\";\n\ninterface UpdatePendingChangeRequestsParams {\n contentReviewMethods: ApwContentReviewCrud;\n delta: number;\n step: ApwChangeRequest[\"step\"];\n}\n\nconst updatePendingChangeRequests = async ({\n contentReviewMethods,\n step,\n delta\n}: UpdatePendingChangeRequestsParams): Promise<void> => {\n const { id, stepId } = extractContentReviewIdAndStep(step);\n\n await updateContentReview({\n contentReviewMethods,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n pendingChangeRequests: step.pendingChangeRequests + delta\n }))\n };\n }\n });\n};\n\nexport const updatePendingChangeRequestsCount = ({\n apw\n}: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestAfterDelete.subscribe(async ({ changeRequest }) => {\n /**\n * If the deleted changeRequest was marked as resolved. We don't need to do anything here,\n * because \"pendingChangeRequests has been already updated in \"onAfterChangeRequestUpdate\" hook.\n */\n if (changeRequest.resolved === true) {\n return;\n }\n /**\n * After a \"changeRequest\" is deleted, decrement the \"pendingChangeRequests\" count\n * in the corresponding step of the content review entry.\n */\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta: -1\n });\n });\n\n apw.changeRequest.onChangeRequestAfterCreate.subscribe(async ({ changeRequest }) => {\n /**\n * After a \"changeRequest\" is created, increment the \"pendingChangeRequests\" count\n * of the corresponding step in the content review entry.\n */\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta: 1\n });\n });\n\n apw.changeRequest.onChangeRequestAfterUpdate.subscribe(async ({ changeRequest, original }) => {\n /**\n * After a \"changeRequest\" is created, and the value of \"resolved\" field has changed;\n * then we also need to update the \"pendingChangeRequests\" count of the corresponding step in the content review entry.\n */\n if (original.resolved !== changeRequest.resolved) {\n const resolved = changeRequest.resolved;\n const delta = resolved === true ? -1 : 1;\n\n await updatePendingChangeRequests({\n contentReviewMethods: apw.contentReview,\n step: changeRequest.step,\n delta\n });\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AACA;;AAYA,MAAMA,2BAA2B,GAAG,OAAO;EACvCC,oBADuC;EAEvCC,IAFuC;EAGvCC;AAHuC,CAAP,KAIoB;EACpD,MAAM;IAAEC,EAAF;IAAMC;EAAN,IAAiB,IAAAC,oCAAA,EAA8BJ,IAA9B,CAAvB;EAEA,MAAM,IAAAK,0BAAA,EAAoB;IACtBN,oBADsB;IAEtBG,EAFsB;IAGtBI,uBAAuB,EAAEC,IAAI,IAAI;MAC7B,mEACOA,IADP;QAEIC,KAAK,EAAE,IAAAC,8BAAA,EAAwBF,IAAI,CAACC,KAA7B,EAAoCL,MAApC,EAA4CH,IAAI,gEAChDA,IADgD;UAEnDU,qBAAqB,EAAEV,IAAI,CAACU,qBAAL,GAA6BT;QAFD,EAAhD;MAFX;IAOH;EAXqB,CAApB,CAAN;AAaH,CApBD;;AAsBO,MAAMU,gCAAgC,GAAG,CAAC;EAC7CC;AAD6C,CAAD,KAEA;EAC5CA,GAAG,CAACC,aAAJ,CAAkBC,0BAAlB,CAA6CC,SAA7C,CAAuD,OAAO;IAAEF;EAAF,CAAP,KAA6B;IAChF;AACR;AACA;AACA;IACQ,IAAIA,aAAa,CAACG,QAAd,KAA2B,IAA/B,EAAqC;MACjC;IACH;IACD;AACR;AACA;AACA;;;IACQ,MAAMlB,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aADI;MAE9BjB,IAAI,EAAEa,aAAa,CAACb,IAFU;MAG9BC,KAAK,EAAE,CAAC;IAHsB,CAAD,CAAjC;EAKH,CAjBD;EAmBAW,GAAG,CAACC,aAAJ,CAAkBK,0BAAlB,CAA6CH,SAA7C,CAAuD,OAAO;IAAEF;EAAF,CAAP,KAA6B;IAChF;AACR;AACA;AACA;IACQ,MAAMf,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aADI;MAE9BjB,IAAI,EAAEa,aAAa,CAACb,IAFU;MAG9BC,KAAK,EAAE;IAHuB,CAAD,CAAjC;EAKH,CAVD;EAYAW,GAAG,CAACC,aAAJ,CAAkBM,0BAAlB,CAA6CJ,SAA7C,CAAuD,OAAO;IAAEF,aAAF;IAAiBO;EAAjB,CAAP,KAAuC;IAC1F;AACR;AACA;AACA;IACQ,IAAIA,QAAQ,CAACJ,QAAT,KAAsBH,aAAa,CAACG,QAAxC,EAAkD;MAC9C,MAAMA,QAAQ,GAAGH,aAAa,CAACG,QAA/B;MACA,MAAMf,KAAK,GAAGe,QAAQ,KAAK,IAAb,GAAoB,CAAC,CAArB,GAAyB,CAAvC;MAEA,MAAMlB,2BAA2B,CAAC;QAC9BC,oBAAoB,EAAEa,GAAG,CAACK,aADI;QAE9BjB,IAAI,EAAEa,aAAa,CAACb,IAFU;QAG9BC;MAH8B,CAAD,CAAjC;IAKH;EACJ,CAfD;AAgBH,CAlDM"}
@@ -1,24 +1,20 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.updateTotalCommentsCount = exports.updateLatestCommentId = void 0;
9
9
 
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
11
 
12
12
  var _utils = require("../utils");
13
13
 
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
-
18
14
  const updateTotalCommentsCount = ({
19
15
  apw
20
16
  }) => {
21
- apw.comment.onAfterCommentDelete.subscribe(async ({
17
+ apw.comment.onCommentAfterDelete.subscribe(async ({
22
18
  comment
23
19
  }) => {
24
20
  const {
@@ -38,8 +34,8 @@ const updateTotalCommentsCount = ({
38
34
  contentReviewMethods: apw.contentReview,
39
35
  id,
40
36
  getNewContentReviewData: data => {
41
- return _objectSpread(_objectSpread({}, data), {}, {
42
- steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => _objectSpread(_objectSpread({}, step), {}, {
37
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
38
+ steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
43
39
  totalComments: step.totalComments - 1
44
40
  }))
45
41
  });
@@ -47,7 +43,7 @@ const updateTotalCommentsCount = ({
47
43
  });
48
44
  }
49
45
  });
50
- apw.comment.onAfterCommentCreate.subscribe(async ({
46
+ apw.comment.onCommentAfterCreate.subscribe(async ({
51
47
  comment
52
48
  }) => {
53
49
  /**
@@ -62,8 +58,8 @@ const updateTotalCommentsCount = ({
62
58
  contentReviewMethods: apw.contentReview,
63
59
  id,
64
60
  getNewContentReviewData: data => {
65
- return _objectSpread(_objectSpread({}, data), {}, {
66
- steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => _objectSpread(_objectSpread({}, step), {}, {
61
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
62
+ steps: (0, _utils.updateContentReviewStep)(data.steps, stepId, step => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
67
63
  totalComments: step.totalComments + 1
68
64
  }))
69
65
  });
@@ -77,7 +73,7 @@ exports.updateTotalCommentsCount = updateTotalCommentsCount;
77
73
  const updateLatestCommentId = ({
78
74
  apw
79
75
  }) => {
80
- apw.comment.onAfterCommentCreate.subscribe(async ({
76
+ apw.comment.onCommentAfterCreate.subscribe(async ({
81
77
  comment
82
78
  }) => {
83
79
  /**
@@ -91,13 +87,13 @@ const updateLatestCommentId = ({
91
87
  contentReviewMethods: apw.contentReview,
92
88
  id,
93
89
  getNewContentReviewData: contentReview => {
94
- return _objectSpread(_objectSpread({}, contentReview), {}, {
90
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contentReview), {}, {
95
91
  latestCommentId: comment.id
96
92
  });
97
93
  }
98
94
  });
99
95
  });
100
- apw.comment.onAfterCommentUpdate.subscribe(async ({
96
+ apw.comment.onCommentAfterUpdate.subscribe(async ({
101
97
  comment
102
98
  }) => {
103
99
  /**
@@ -111,13 +107,13 @@ const updateLatestCommentId = ({
111
107
  contentReviewMethods: apw.contentReview,
112
108
  id,
113
109
  getNewContentReviewData: contentReview => {
114
- return _objectSpread(_objectSpread({}, contentReview), {}, {
110
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contentReview), {}, {
115
111
  latestCommentId: comment.id
116
112
  });
117
113
  }
118
114
  });
119
115
  });
120
- apw.comment.onAfterCommentDelete.subscribe(async ({
116
+ apw.comment.onCommentAfterDelete.subscribe(async ({
121
117
  comment
122
118
  }) => {
123
119
  /**
@@ -145,7 +141,7 @@ const updateLatestCommentId = ({
145
141
  contentReviewMethods: apw.contentReview,
146
142
  id,
147
143
  getNewContentReviewData: contentReview => {
148
- return _objectSpread(_objectSpread({}, contentReview), {}, {
144
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, contentReview), {}, {
149
145
  latestCommentId: latestComment ? latestComment.id : null
150
146
  });
151
147
  }