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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/ApwChangeRequestNotification.js +0 -10
  2. package/ApwChangeRequestNotification.js.map +1 -1
  3. package/ApwCommentNotification.js +0 -10
  4. package/ApwCommentNotification.js.map +1 -1
  5. package/ApwContentReviewNotification.js +0 -10
  6. package/ApwContentReviewNotification.js.map +1 -1
  7. package/ApwContentUrlPlugin.js +0 -10
  8. package/ApwContentUrlPlugin.js.map +1 -1
  9. package/ContentApwSettingsPlugin.js +0 -5
  10. package/ContentApwSettingsPlugin.js.map +1 -1
  11. package/crud/createChangeRequestMethods.js +4 -11
  12. package/crud/createChangeRequestMethods.js.map +1 -1
  13. package/crud/createCommentMethods.js +4 -12
  14. package/crud/createCommentMethods.js.map +1 -1
  15. package/crud/createContentReviewMethods.js +39 -88
  16. package/crud/createContentReviewMethods.js.map +1 -1
  17. package/crud/createReviewerMethods.js +4 -12
  18. package/crud/createReviewerMethods.js.map +1 -1
  19. package/crud/createWorkflowMethods.js +4 -17
  20. package/crud/createWorkflowMethods.js.map +1 -1
  21. package/crud/index.js +0 -25
  22. package/crud/index.js.map +1 -1
  23. package/crud/utils.js +0 -28
  24. package/crud/utils.js.map +1 -1
  25. package/index.d.ts +1 -2
  26. package/index.js +1 -15
  27. package/index.js.map +1 -1
  28. package/package.json +40 -47
  29. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +0 -15
  30. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  31. package/plugins/cms/apwEntryPlugins.js +0 -8
  32. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  33. package/plugins/cms/index.js +0 -13
  34. package/plugins/cms/index.js.map +1 -1
  35. package/plugins/cms/linkContentReviewToEntry.js +2 -19
  36. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  37. package/plugins/cms/linkWorkflowToEntry.js +9 -38
  38. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  39. package/plugins/cms/notifications/changeRequestNotification.js +0 -4
  40. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
  41. package/plugins/cms/notifications/commentNotification.js +0 -4
  42. package/plugins/cms/notifications/commentNotification.js.map +1 -1
  43. package/plugins/cms/notifications/contentReviewNotification.js +0 -4
  44. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
  45. package/plugins/cms/notifications/contentUrl.js +1 -8
  46. package/plugins/cms/notifications/contentUrl.js.map +1 -1
  47. package/plugins/cms/triggerContentReview.js +3 -17
  48. package/plugins/cms/triggerContentReview.js.map +1 -1
  49. package/plugins/cms/updateContentReviewStatus.js +4 -22
  50. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  51. package/plugins/cms/utils.js +2 -47
  52. package/plugins/cms/utils.js.map +1 -1
  53. package/plugins/context.d.ts +0 -1
  54. package/plugins/context.js +2 -47
  55. package/plugins/context.js.map +1 -1
  56. package/plugins/graphql/changeRequest.gql.js +3 -10
  57. package/plugins/graphql/changeRequest.gql.js.map +1 -1
  58. package/plugins/graphql/comment.gql.js +3 -10
  59. package/plugins/graphql/comment.gql.js.map +1 -1
  60. package/plugins/graphql/contentReview.gql.js +6 -25
  61. package/plugins/graphql/contentReview.gql.js.map +1 -1
  62. package/plugins/graphql/reviewer.gql.js +3 -10
  63. package/plugins/graphql/reviewer.gql.js.map +1 -1
  64. package/plugins/graphql/workflow.gql.js +3 -10
  65. package/plugins/graphql/workflow.gql.js.map +1 -1
  66. package/plugins/graphql.js +3 -18
  67. package/plugins/graphql.js.map +1 -1
  68. package/plugins/hooks/createReviewerFromIdentity.js +2 -11
  69. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  70. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +1 -9
  71. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  72. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +1 -8
  73. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  74. package/plugins/hooks/index.js +0 -14
  75. package/plugins/hooks/index.js.map +1 -1
  76. package/plugins/hooks/initializeContentReviewSteps.js +10 -17
  77. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  78. package/plugins/hooks/initializeNotifications.js +0 -5
  79. package/plugins/hooks/initializeNotifications.js.map +1 -1
  80. package/plugins/hooks/listContentReviews.js +0 -12
  81. package/plugins/hooks/listContentReviews.js.map +1 -1
  82. package/plugins/hooks/notifications/appUrl.js +0 -4
  83. package/plugins/hooks/notifications/appUrl.js.map +1 -1
  84. package/plugins/hooks/notifications/changeRequestAfterCreate.js +3 -36
  85. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
  86. package/plugins/hooks/notifications/changeRequestUrl.js +0 -4
  87. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
  88. package/plugins/hooks/notifications/commentAfterCreate.js +3 -38
  89. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
  90. package/plugins/hooks/notifications/commentUrl.js +0 -4
  91. package/plugins/hooks/notifications/commentUrl.js.map +1 -1
  92. package/plugins/hooks/notifications/contentReviewAfterCreate.js +4 -32
  93. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
  94. package/plugins/hooks/notifications/contentReviewUrl.js +0 -4
  95. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
  96. package/plugins/hooks/notifications/contentUrl.js +0 -5
  97. package/plugins/hooks/notifications/contentUrl.js.map +1 -1
  98. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +0 -4
  99. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
  100. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +0 -4
  101. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
  102. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +0 -4
  103. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
  104. package/plugins/hooks/notifications/reviewers.js +15 -21
  105. package/plugins/hooks/notifications/reviewers.js.map +1 -1
  106. package/plugins/hooks/notifications/sendChangeRequestNotification.js +0 -11
  107. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
  108. package/plugins/hooks/notifications/sendCommentNotification.js +0 -11
  109. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
  110. package/plugins/hooks/notifications/sendContentReviewNotification.js +0 -11
  111. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
  112. package/plugins/hooks/updatePendingChangeRequests.js +0 -8
  113. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  114. package/plugins/hooks/updateTotalComments.js +0 -9
  115. package/plugins/hooks/updateTotalComments.js.map +1 -1
  116. package/plugins/hooks/validateChangeRequest.js +0 -16
  117. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  118. package/plugins/hooks/validateComment.js +1 -12
  119. package/plugins/hooks/validateComment.js.map +1 -1
  120. package/plugins/hooks/validateContentReview.js +0 -6
  121. package/plugins/hooks/validateContentReview.js.map +1 -1
  122. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -15
  123. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
  124. package/plugins/pageBuilder/apwContentPagePlugins.js +0 -4
  125. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
  126. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +1 -6
  127. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
  128. package/plugins/pageBuilder/index.js +0 -11
  129. package/plugins/pageBuilder/index.js.map +1 -1
  130. package/plugins/pageBuilder/linkContentReviewToPage.js +2 -18
  131. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
  132. package/plugins/pageBuilder/linkWorkflowToPage.js +1 -31
  133. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  134. package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -4
  135. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
  136. package/plugins/pageBuilder/notifications/commentNotification.js +0 -4
  137. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
  138. package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -4
  139. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
  140. package/plugins/pageBuilder/notifications/contentUrl.js +1 -7
  141. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
  142. package/plugins/pageBuilder/triggerContentReview.js +0 -11
  143. package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
  144. package/plugins/pageBuilder/updateContentReviewStatus.js +0 -12
  145. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
  146. package/plugins/pageBuilder/utils.js +1 -35
  147. package/plugins/pageBuilder/utils.js.map +1 -1
  148. package/plugins/utils.js +0 -43
  149. package/plugins/utils.js.map +1 -1
  150. package/scheduler/createScheduleActionMethods.js +3 -27
  151. package/scheduler/createScheduleActionMethods.js.map +1 -1
  152. package/scheduler/handlers/executeAction/index.d.ts +1 -1
  153. package/scheduler/handlers/executeAction/index.js +45 -39
  154. package/scheduler/handlers/executeAction/index.js.map +1 -1
  155. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
  156. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +14 -5
  157. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  158. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -3
  159. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +7 -23
  160. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  161. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +2 -2
  162. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +7 -86
  163. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  164. package/scheduler/handlers/executeAction/security.js +0 -11
  165. package/scheduler/handlers/executeAction/security.js.map +1 -1
  166. package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
  167. package/scheduler/handlers/scheduleAction/index.js +13 -29
  168. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  169. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +4 -23
  170. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  171. package/scheduler/handlers/utils.d.ts +1 -2
  172. package/scheduler/handlers/utils.js +3 -41
  173. package/scheduler/handlers/utils.js.map +1 -1
  174. package/scheduler/index.js +0 -3
  175. package/scheduler/index.js.map +1 -1
  176. package/scheduler/types.d.ts +2 -20
  177. package/scheduler/types.js +12 -23
  178. package/scheduler/types.js.map +1 -1
  179. package/storageOperations/changeRequestStorageOperations.js +20 -39
  180. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  181. package/storageOperations/commentStorageOperations.js +23 -44
  182. package/storageOperations/commentStorageOperations.js.map +1 -1
  183. package/storageOperations/contentReviewStorageOperations.js +20 -37
  184. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  185. package/storageOperations/index.js +0 -14
  186. package/storageOperations/index.js.map +1 -1
  187. package/storageOperations/models/changeRequest.model.js +0 -9
  188. package/storageOperations/models/changeRequest.model.js.map +1 -1
  189. package/storageOperations/models/comment.model.js +0 -8
  190. package/storageOperations/models/comment.model.js.map +1 -1
  191. package/storageOperations/models/contentModelPluginFactory.d.ts +3 -10
  192. package/storageOperations/models/contentModelPluginFactory.js +3 -11
  193. package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
  194. package/storageOperations/models/contentReview.model.js +0 -26
  195. package/storageOperations/models/contentReview.model.js.map +1 -1
  196. package/storageOperations/models/index.js +2 -28
  197. package/storageOperations/models/index.js.map +1 -1
  198. package/storageOperations/models/reviewer.model.js +0 -8
  199. package/storageOperations/models/reviewer.model.js.map +1 -1
  200. package/storageOperations/models/utils.js +0 -4
  201. package/storageOperations/models/utils.js.map +1 -1
  202. package/storageOperations/models/workflow.model.js +0 -23
  203. package/storageOperations/models/workflow.model.js.map +1 -1
  204. package/storageOperations/reviewerStorageOperations.js +23 -45
  205. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  206. package/storageOperations/workflowStorageOperations.js +20 -39
  207. package/storageOperations/workflowStorageOperations.js.map +1 -1
  208. package/types.d.ts +6 -5
  209. package/types.js +124 -42
  210. package/types.js.map +1 -1
  211. package/utils/contentApwSettingsPlugin.js +0 -6
  212. package/utils/contentApwSettingsPlugin.js.map +1 -1
  213. package/utils/errors.js +0 -17
  214. package/utils/errors.js.map +1 -1
  215. package/utils/fieldResolver.js +2 -12
  216. package/utils/fieldResolver.js.map +1 -1
  217. package/utils/resolve.d.ts +1 -1
  218. package/utils/resolve.js +0 -3
  219. package/utils/resolve.js.map +1 -1
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.updatePendingChangeRequestsCount = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _utils = require("../utils");
13
-
14
10
  const updatePendingChangeRequests = async ({
15
11
  contentReviewMethods,
16
12
  step,
@@ -32,7 +28,6 @@ const updatePendingChangeRequests = async ({
32
28
  }
33
29
  });
34
30
  };
35
-
36
31
  const updatePendingChangeRequestsCount = ({
37
32
  apw
38
33
  }) => {
@@ -50,8 +45,6 @@ const updatePendingChangeRequestsCount = ({
50
45
  * After a "changeRequest" is deleted, decrement the "pendingChangeRequests" count
51
46
  * in the corresponding step of the content review entry.
52
47
  */
53
-
54
-
55
48
  await updatePendingChangeRequests({
56
49
  contentReviewMethods: apw.contentReview,
57
50
  step: changeRequest.step,
@@ -90,5 +83,4 @@ const updatePendingChangeRequestsCount = ({
90
83
  }
91
84
  });
92
85
  };
93
-
94
86
  exports.updatePendingChangeRequestsCount = updatePendingChangeRequestsCount;
@@ -1 +1 @@
1
- {"version":3,"names":["updatePendingChangeRequests","contentReviewMethods","step","delta","id","stepId","extractContentReviewIdAndStep","updateContentReview","getNewContentReviewData","data","steps","updateContentReviewStep","pendingChangeRequests","updatePendingChangeRequestsCount","apw","changeRequest","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
+ {"version":3,"names":["_utils","require","updatePendingChangeRequests","contentReviewMethods","step","delta","id","stepId","extractContentReviewIdAndStep","updateContentReview","getNewContentReviewData","data","_objectSpread2","default","steps","updateContentReviewStep","pendingChangeRequests","updatePendingChangeRequestsCount","apw","changeRequest","onChangeRequestAfterDelete","subscribe","resolved","contentReview","onChangeRequestAfterCreate","onChangeRequestAfterUpdate","original","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAYA,MAAMC,2BAA2B,GAAG,MAAAA,CAAO;EACvCC,oBAAoB;EACpBC,IAAI;EACJC;AAC+B,CAAC,KAAoB;EACpD,MAAM;IAAEC,EAAE;IAAEC;EAAO,CAAC,GAAG,IAAAC,oCAA6B,EAACJ,IAAI,CAAC;EAE1D,MAAM,IAAAK,0BAAmB,EAAC;IACtBN,oBAAoB;IACpBG,EAAE;IACFI,uBAAuB,EAAEC,IAAI,IAAI;MAC7B,WAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACOF,IAAI;QACPG,KAAK,EAAE,IAAAC,8BAAuB,EAACJ,IAAI,CAACG,KAAK,EAAEP,MAAM,EAAEH,IAAI,QAAAQ,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MAChDT,IAAI;UACPY,qBAAqB,EAAEZ,IAAI,CAACY,qBAAqB,GAAGX;QAAK,EAC3D;MAAC;IAEX;EACJ,CAAC,CAAC;AACN,CAAC;AAEM,MAAMY,gCAAgC,GAAGA,CAAC;EAC7CC;AACsC,CAAC,KAAK;EAC5CA,GAAG,CAACC,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;AACA;IACQ,IAAIA,aAAa,CAACG,QAAQ,KAAK,IAAI,EAAE;MACjC;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMpB,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEe,GAAG,CAACK,aAAa;MACvCnB,IAAI,EAAEe,aAAa,CAACf,IAAI;MACxBC,KAAK,EAAE,CAAC;IACZ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFa,GAAG,CAACC,aAAa,CAACK,0BAA0B,CAACH,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF;AACR;AACA;AACA;IACQ,MAAMjB,2BAA2B,CAAC;MAC9BC,oBAAoB,EAAEe,GAAG,CAACK,aAAa;MACvCnB,IAAI,EAAEe,aAAa,CAACf,IAAI;MACxBC,KAAK,EAAE;IACX,CAAC,CAAC;EACN,CAAC,CAAC;EAEFa,GAAG,CAACC,aAAa,CAACM,0BAA0B,CAACJ,SAAS,CAAC,OAAO;IAAEF,aAAa;IAAEO;EAAS,CAAC,KAAK;IAC1F;AACR;AACA;AACA;IACQ,IAAIA,QAAQ,CAACJ,QAAQ,KAAKH,aAAa,CAACG,QAAQ,EAAE;MAC9C,MAAMA,QAAQ,GAAGH,aAAa,CAACG,QAAQ;MACvC,MAAMjB,KAAK,GAAGiB,QAAQ,KAAK,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;MAExC,MAAMpB,2BAA2B,CAAC;QAC9BC,oBAAoB,EAAEe,GAAG,CAACK,aAAa;QACvCnB,IAAI,EAAEe,aAAa,CAACf,IAAI;QACxBC;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACsB,OAAA,CAAAV,gCAAA,GAAAA,gCAAA"}
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.updateTotalCommentsCount = exports.updateLatestCommentId = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _utils = require("../utils");
13
-
14
10
  const updateTotalCommentsCount = ({
15
11
  apw
16
12
  }) => {
@@ -24,7 +20,6 @@ const updateTotalCommentsCount = ({
24
20
  * After a "comment" is deleted, decrement the "totalComments" count
25
21
  * in the corresponding step of the content review entry.
26
22
  */
27
-
28
23
  if (step) {
29
24
  const {
30
25
  id,
@@ -67,9 +62,7 @@ const updateTotalCommentsCount = ({
67
62
  });
68
63
  });
69
64
  };
70
-
71
65
  exports.updateTotalCommentsCount = updateTotalCommentsCount;
72
-
73
66
  const updateLatestCommentId = ({
74
67
  apw
75
68
  }) => {
@@ -127,7 +120,6 @@ const updateLatestCommentId = ({
127
120
  id,
128
121
  contentReviewMethods: apw.contentReview
129
122
  });
130
-
131
123
  if (contentReview && contentReview.latestCommentId === comment.id) {
132
124
  const [[latestComment]] = await apw.comment.list({
133
125
  where: {
@@ -149,5 +141,4 @@ const updateLatestCommentId = ({
149
141
  }
150
142
  });
151
143
  };
152
-
153
144
  exports.updateLatestCommentId = updateLatestCommentId;
@@ -1 +1 @@
1
- {"version":3,"names":["updateTotalCommentsCount","apw","comment","onCommentAfterDelete","subscribe","step","id","stepId","extractContentReviewIdAndStep","updateContentReview","contentReviewMethods","contentReview","getNewContentReviewData","data","steps","updateContentReviewStep","totalComments","onCommentAfterCreate","updateLatestCommentId","latestCommentId","onCommentAfterUpdate","safelyGetContentReview","latestComment","list","where","changeRequest","sort"],"sources":["updateTotalComments.ts"],"sourcesContent":["import { LifeCycleHookCallbackParams } from \"~/types\";\nimport {\n extractContentReviewIdAndStep,\n safelyGetContentReview,\n updateContentReview,\n updateContentReviewStep\n} from \"../utils\";\n\nexport const updateTotalCommentsCount = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentAfterDelete.subscribe(async ({ comment }) => {\n const { step } = comment;\n /**\n * After a \"comment\" is deleted, decrement the \"totalComments\" count\n * in the corresponding step of the content review entry.\n */\n if (step) {\n const { id, stepId } = extractContentReviewIdAndStep(step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n totalComments: step.totalComments - 1\n }))\n };\n }\n });\n }\n });\n\n apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is created, increment the \"totalComments\" count\n * of the corresponding step in the content review entry.\n */\n const { id, stepId } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n totalComments: step.totalComments + 1\n }))\n };\n }\n });\n });\n};\n\nexport const updateLatestCommentId = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is created, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: comment.id\n };\n }\n });\n });\n\n apw.comment.onCommentAfterUpdate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is updated, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: comment.id\n };\n }\n });\n });\n\n apw.comment.onCommentAfterDelete.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is updated, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n const contentReview = await safelyGetContentReview({\n id,\n contentReviewMethods: apw.contentReview\n });\n\n if (contentReview && contentReview.latestCommentId === comment.id) {\n const [[latestComment]] = await apw.comment.list({\n where: { changeRequest: { id: comment.changeRequest } },\n sort: [\"createdOn_DESC\"]\n });\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: latestComment ? latestComment.id : null\n };\n }\n });\n }\n });\n};\n"],"mappings":"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"}
1
+ {"version":3,"names":["_utils","require","updateTotalCommentsCount","apw","comment","onCommentAfterDelete","subscribe","step","id","stepId","extractContentReviewIdAndStep","updateContentReview","contentReviewMethods","contentReview","getNewContentReviewData","data","_objectSpread2","default","steps","updateContentReviewStep","totalComments","onCommentAfterCreate","exports","updateLatestCommentId","latestCommentId","onCommentAfterUpdate","safelyGetContentReview","latestComment","list","where","changeRequest","sort"],"sources":["updateTotalComments.ts"],"sourcesContent":["import { LifeCycleHookCallbackParams } from \"~/types\";\nimport {\n extractContentReviewIdAndStep,\n safelyGetContentReview,\n updateContentReview,\n updateContentReviewStep\n} from \"../utils\";\n\nexport const updateTotalCommentsCount = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentAfterDelete.subscribe(async ({ comment }) => {\n const { step } = comment;\n /**\n * After a \"comment\" is deleted, decrement the \"totalComments\" count\n * in the corresponding step of the content review entry.\n */\n if (step) {\n const { id, stepId } = extractContentReviewIdAndStep(step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n totalComments: step.totalComments - 1\n }))\n };\n }\n });\n }\n });\n\n apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is created, increment the \"totalComments\" count\n * of the corresponding step in the content review entry.\n */\n const { id, stepId } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: data => {\n return {\n ...data,\n steps: updateContentReviewStep(data.steps, stepId, step => ({\n ...step,\n totalComments: step.totalComments + 1\n }))\n };\n }\n });\n });\n};\n\nexport const updateLatestCommentId = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentAfterCreate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is created, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: comment.id\n };\n }\n });\n });\n\n apw.comment.onCommentAfterUpdate.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is updated, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: comment.id\n };\n }\n });\n });\n\n apw.comment.onCommentAfterDelete.subscribe(async ({ comment }) => {\n /**\n * After a \"comment\" is updated, update the \"latestCommentId\" in\n * the corresponding content review entry.\n */\n const { id } = extractContentReviewIdAndStep(comment.step);\n\n const contentReview = await safelyGetContentReview({\n id,\n contentReviewMethods: apw.contentReview\n });\n\n if (contentReview && contentReview.latestCommentId === comment.id) {\n const [[latestComment]] = await apw.comment.list({\n where: { changeRequest: { id: comment.changeRequest } },\n sort: [\"createdOn_DESC\"]\n });\n\n await updateContentReview({\n contentReviewMethods: apw.contentReview,\n id,\n getNewContentReviewData: contentReview => {\n return {\n ...contentReview,\n latestCommentId: latestComment ? latestComment.id : null\n };\n }\n });\n }\n });\n};\n"],"mappings":"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"}
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.validateChangeRequest = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  var _handlerGraphql = require("@webiny/handler-graphql");
13
-
14
10
  var _utils = require("../utils");
15
-
16
11
  var _utils2 = require("@webiny/utils");
17
-
18
12
  const validateChangeRequest = ({
19
13
  apw
20
14
  }) => {
@@ -27,7 +21,6 @@ const validateChangeRequest = ({
27
21
  /**
28
22
  * We need step to be in a particular format i.e. "contentReviewId#version#stepId"
29
23
  */
30
-
31
24
  const {
32
25
  id: revisionId,
33
26
  stepId
@@ -36,7 +29,6 @@ const validateChangeRequest = ({
36
29
  id: entryId,
37
30
  version
38
31
  } = (0, _utils2.parseIdentifier)(revisionId);
39
-
40
32
  if (!entryId || !version || !stepId) {
41
33
  throw new _error.default(`The step property in input is not properly formatted.`, "MALFORMED_CHANGE_REQUEST_STEP", {
42
34
  step
@@ -45,10 +37,7 @@ const validateChangeRequest = ({
45
37
  /**
46
38
  * Check whether a contentReview entry exists with provided id.
47
39
  */
48
-
49
-
50
40
  let contentReview = undefined;
51
-
52
41
  try {
53
42
  contentReview = await apw.contentReview.get(revisionId);
54
43
  } catch (ex) {
@@ -63,20 +52,16 @@ const validateChangeRequest = ({
63
52
  });
64
53
  }
65
54
  }
66
-
67
55
  if (!contentReview) {
68
56
  throw new _handlerGraphql.NotFoundError(`Unable to found "ContentReview" with given id "${revisionId}"`);
69
57
  }
70
58
  /**
71
59
  * Don't allow "change request" creation once the sign-off has been provided.
72
60
  */
73
-
74
-
75
61
  const {
76
62
  steps
77
63
  } = contentReview;
78
64
  const currentStep = steps.find(step => step.id === stepId);
79
-
80
65
  if (currentStep && currentStep.signOffProvidedOn) {
81
66
  throw new _error.default(`Please retract the sign-off before opening a new change request.`, "SIGN_OFF_PROVIDED", {
82
67
  step: currentStep,
@@ -85,5 +70,4 @@ const validateChangeRequest = ({
85
70
  }
86
71
  });
87
72
  };
88
-
89
73
  exports.validateChangeRequest = validateChangeRequest;
@@ -1 +1 @@
1
- {"version":3,"names":["validateChangeRequest","apw","changeRequest","onChangeRequestBeforeCreate","subscribe","input","step","id","revisionId","stepId","extractContentReviewIdAndStep","entryId","version","parseIdentifier","WebinyError","contentReview","undefined","get","ex","process","env","NODE_ENV","console","log","message","code","data","NotFoundError","steps","currentStep","find","signOffProvidedOn"],"sources":["validateChangeRequest.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { ApwContentReview, LifeCycleHookCallbackParams } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const validateChangeRequest = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestBeforeCreate.subscribe(async ({ input }) => {\n const { step } = input;\n /**\n * We need step to be in a particular format i.e. \"contentReviewId#version#stepId\"\n */\n const { id: revisionId, stepId } = extractContentReviewIdAndStep(step);\n\n const { id: entryId, version } = parseIdentifier(revisionId);\n if (!entryId || !version || !stepId) {\n throw new WebinyError(\n `The step property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_STEP\",\n {\n step\n }\n );\n }\n /**\n * Check whether a contentReview entry exists with provided id.\n */\n let contentReview: ApwContentReview | undefined = undefined;\n try {\n contentReview = await apw.contentReview.get(revisionId);\n } catch (ex) {\n /**\n * There is no need to output the log if this is the test environment.\n */\n if (process.env.NODE_ENV !== \"test\") {\n console.log({\n message: ex.message,\n code: ex.data,\n data: ex.data\n });\n }\n }\n if (!contentReview) {\n throw new NotFoundError(\n `Unable to found \"ContentReview\" with given id \"${revisionId}\"`\n );\n }\n /**\n * Don't allow \"change request\" creation once the sign-off has been provided.\n */\n const { steps } = contentReview;\n const currentStep = steps.find(step => step.id === stepId);\n\n if (currentStep && currentStep.signOffProvidedOn) {\n throw new WebinyError(\n `Please retract the sign-off before opening a new change request.`,\n \"SIGN_OFF_PROVIDED\",\n {\n step: currentStep,\n stepId: stepId\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAAF,CAAD,KAAuD;EACxFA,GAAG,CAACC,aAAJ,CAAkBC,2BAAlB,CAA8CC,SAA9C,CAAwD,OAAO;IAAEC;EAAF,CAAP,KAAqB;IACzE,MAAM;MAAEC;IAAF,IAAWD,KAAjB;IACA;AACR;AACA;;IACQ,MAAM;MAAEE,EAAE,EAAEC,UAAN;MAAkBC;IAAlB,IAA6B,IAAAC,oCAAA,EAA8BJ,IAA9B,CAAnC;IAEA,MAAM;MAAEC,EAAE,EAAEI,OAAN;MAAeC;IAAf,IAA2B,IAAAC,uBAAA,EAAgBL,UAAhB,CAAjC;;IACA,IAAI,CAACG,OAAD,IAAY,CAACC,OAAb,IAAwB,CAACH,MAA7B,EAAqC;MACjC,MAAM,IAAIK,cAAJ,CACD,uDADC,EAEF,+BAFE,EAGF;QACIR;MADJ,CAHE,CAAN;IAOH;IACD;AACR;AACA;;;IACQ,IAAIS,aAA2C,GAAGC,SAAlD;;IACA,IAAI;MACAD,aAAa,GAAG,MAAMd,GAAG,CAACc,aAAJ,CAAkBE,GAAlB,CAAsBT,UAAtB,CAAtB;IACH,CAFD,CAEE,OAAOU,EAAP,EAAW;MACT;AACZ;AACA;MACY,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,MAA7B,EAAqC;QACjCC,OAAO,CAACC,GAAR,CAAY;UACRC,OAAO,EAAEN,EAAE,CAACM,OADJ;UAERC,IAAI,EAAEP,EAAE,CAACQ,IAFD;UAGRA,IAAI,EAAER,EAAE,CAACQ;QAHD,CAAZ;MAKH;IACJ;;IACD,IAAI,CAACX,aAAL,EAAoB;MAChB,MAAM,IAAIY,6BAAJ,CACD,kDAAiDnB,UAAW,GAD3D,CAAN;IAGH;IACD;AACR;AACA;;;IACQ,MAAM;MAAEoB;IAAF,IAAYb,aAAlB;IACA,MAAMc,WAAW,GAAGD,KAAK,CAACE,IAAN,CAAWxB,IAAI,IAAIA,IAAI,CAACC,EAAL,KAAYE,MAA/B,CAApB;;IAEA,IAAIoB,WAAW,IAAIA,WAAW,CAACE,iBAA/B,EAAkD;MAC9C,MAAM,IAAIjB,cAAJ,CACD,kEADC,EAEF,mBAFE,EAGF;QACIR,IAAI,EAAEuB,WADV;QAEIpB,MAAM,EAAEA;MAFZ,CAHE,CAAN;IAQH;EACJ,CAxDD;AAyDH,CA1DM"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_handlerGraphql","_utils","_utils2","validateChangeRequest","apw","changeRequest","onChangeRequestBeforeCreate","subscribe","input","step","id","revisionId","stepId","extractContentReviewIdAndStep","entryId","version","parseIdentifier","WebinyError","contentReview","undefined","get","ex","process","env","NODE_ENV","console","log","message","code","data","NotFoundError","steps","currentStep","find","signOffProvidedOn","exports"],"sources":["validateChangeRequest.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport { ApwContentReview, LifeCycleHookCallbackParams } from \"~/types\";\nimport { extractContentReviewIdAndStep } from \"~/plugins/utils\";\nimport { parseIdentifier } from \"@webiny/utils\";\n\nexport const validateChangeRequest = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.changeRequest.onChangeRequestBeforeCreate.subscribe(async ({ input }) => {\n const { step } = input;\n /**\n * We need step to be in a particular format i.e. \"contentReviewId#version#stepId\"\n */\n const { id: revisionId, stepId } = extractContentReviewIdAndStep(step);\n\n const { id: entryId, version } = parseIdentifier(revisionId);\n if (!entryId || !version || !stepId) {\n throw new WebinyError(\n `The step property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_STEP\",\n {\n step\n }\n );\n }\n /**\n * Check whether a contentReview entry exists with provided id.\n */\n let contentReview: ApwContentReview | undefined = undefined;\n try {\n contentReview = await apw.contentReview.get(revisionId);\n } catch (ex) {\n /**\n * There is no need to output the log if this is the test environment.\n */\n if (process.env.NODE_ENV !== \"test\") {\n console.log({\n message: ex.message,\n code: ex.data,\n data: ex.data\n });\n }\n }\n if (!contentReview) {\n throw new NotFoundError(\n `Unable to found \"ContentReview\" with given id \"${revisionId}\"`\n );\n }\n /**\n * Don't allow \"change request\" creation once the sign-off has been provided.\n */\n const { steps } = contentReview;\n const currentStep = steps.find(step => step.id === stepId);\n\n if (currentStep && currentStep.signOffProvidedOn) {\n throw new WebinyError(\n `Please retract the sign-off before opening a new change request.`,\n \"SIGN_OFF_PROVIDED\",\n {\n step: currentStep,\n stepId: stepId\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEO,MAAMI,qBAAqB,GAAGA,CAAC;EAAEC;AAA8C,CAAC,KAAK;EACxFA,GAAG,CAACC,aAAa,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACzE,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK;IACtB;AACR;AACA;IACQ,MAAM;MAAEE,EAAE,EAAEC,UAAU;MAAEC;IAAO,CAAC,GAAG,IAAAC,oCAA6B,EAACJ,IAAI,CAAC;IAEtE,MAAM;MAAEC,EAAE,EAAEI,OAAO;MAAEC;IAAQ,CAAC,GAAG,IAAAC,uBAAe,EAACL,UAAU,CAAC;IAC5D,IAAI,CAACG,OAAO,IAAI,CAACC,OAAO,IAAI,CAACH,MAAM,EAAE;MACjC,MAAM,IAAIK,cAAW,CAChB,uDAAsD,EACvD,+BAA+B,EAC/B;QACIR;MACJ,CACJ,CAAC;IACL;IACA;AACR;AACA;IACQ,IAAIS,aAA2C,GAAGC,SAAS;IAC3D,IAAI;MACAD,aAAa,GAAG,MAAMd,GAAG,CAACc,aAAa,CAACE,GAAG,CAACT,UAAU,CAAC;IAC3D,CAAC,CAAC,OAAOU,EAAE,EAAE;MACT;AACZ;AACA;MACY,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;QACjCC,OAAO,CAACC,GAAG,CAAC;UACRC,OAAO,EAAEN,EAAE,CAACM,OAAO;UACnBC,IAAI,EAAEP,EAAE,CAACQ,IAAI;UACbA,IAAI,EAAER,EAAE,CAACQ;QACb,CAAC,CAAC;MACN;IACJ;IACA,IAAI,CAACX,aAAa,EAAE;MAChB,MAAM,IAAIY,6BAAa,CAClB,kDAAiDnB,UAAW,GACjE,CAAC;IACL;IACA;AACR;AACA;IACQ,MAAM;MAAEoB;IAAM,CAAC,GAAGb,aAAa;IAC/B,MAAMc,WAAW,GAAGD,KAAK,CAACE,IAAI,CAACxB,IAAI,IAAIA,IAAI,CAACC,EAAE,KAAKE,MAAM,CAAC;IAE1D,IAAIoB,WAAW,IAAIA,WAAW,CAACE,iBAAiB,EAAE;MAC9C,MAAM,IAAIjB,cAAW,CAChB,kEAAiE,EAClE,mBAAmB,EACnB;QACIR,IAAI,EAAEuB,WAAW;QACjBpB,MAAM,EAAEA;MACZ,CACJ,CAAC;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAACuB,OAAA,CAAAhC,qBAAA,GAAAA,qBAAA"}
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.validateComment = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  var _utils = require("@webiny/utils");
13
-
14
10
  const validateComment = ({
15
11
  apw
16
12
  }) => {
@@ -23,12 +19,9 @@ const validateComment = ({
23
19
  /**
24
20
  * We need changeRequest to be in a particular format i.e. "contentReviewUniqueId#version"
25
21
  */
26
-
27
22
  let result;
28
-
29
23
  try {
30
24
  result = (0, _utils.parseIdentifier)(changeRequestId);
31
-
32
25
  if (!result) {
33
26
  throw new _error.default("Could not parse changeRequestId.", "MALFORMED_CHANGE_REQUEST_ID", {
34
27
  changeRequestId
@@ -39,19 +32,15 @@ const validateComment = ({
39
32
  input
40
33
  });
41
34
  }
35
+
42
36
  /**
43
37
  * Assign value for "step" field from "changeRequest".
44
38
  */
45
-
46
-
47
39
  const changeRequest = await apw.changeRequest.get(changeRequestId);
48
-
49
40
  if (!changeRequest) {
50
41
  return;
51
42
  }
52
-
53
43
  input.step = changeRequest.step;
54
44
  });
55
45
  };
56
-
57
46
  exports.validateComment = validateComment;
@@ -1 +1 @@
1
- {"version":3,"names":["validateComment","apw","comment","onCommentBeforeCreate","subscribe","input","changeRequest","changeRequestId","result","parseIdentifier","WebinyError","ex","get","step"],"sources":["validateComment.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\nimport { parseIdentifier, ParseIdentifierResult } from \"@webiny/utils\";\n\nexport const validateComment = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentBeforeCreate.subscribe(async ({ input }) => {\n const { changeRequest: changeRequestId } = input;\n /**\n * We need changeRequest to be in a particular format i.e. \"contentReviewUniqueId#version\"\n */\n let result: ParseIdentifierResult;\n try {\n result = parseIdentifier(changeRequestId);\n if (!result) {\n throw new WebinyError(\n \"Could not parse changeRequestId.\",\n \"MALFORMED_CHANGE_REQUEST_ID\",\n {\n changeRequestId\n }\n );\n }\n } catch (ex) {\n throw new WebinyError(\n `The\"changeRequest\" property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_ID\",\n {\n input\n }\n );\n }\n\n /**\n * Assign value for \"step\" field from \"changeRequest\".\n */\n const changeRequest = await apw.changeRequest.get(changeRequestId);\n if (!changeRequest) {\n return;\n }\n input.step = changeRequest.step;\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;AAEO,MAAMA,eAAe,GAAG,CAAC;EAAEC;AAAF,CAAD,KAAuD;EAClFA,GAAG,CAACC,OAAJ,CAAYC,qBAAZ,CAAkCC,SAAlC,CAA4C,OAAO;IAAEC;EAAF,CAAP,KAAqB;IAC7D,MAAM;MAAEC,aAAa,EAAEC;IAAjB,IAAqCF,KAA3C;IACA;AACR;AACA;;IACQ,IAAIG,MAAJ;;IACA,IAAI;MACAA,MAAM,GAAG,IAAAC,sBAAA,EAAgBF,eAAhB,CAAT;;MACA,IAAI,CAACC,MAAL,EAAa;QACT,MAAM,IAAIE,cAAJ,CACF,kCADE,EAEF,6BAFE,EAGF;UACIH;QADJ,CAHE,CAAN;MAOH;IACJ,CAXD,CAWE,OAAOI,EAAP,EAAW;MACT,MAAM,IAAID,cAAJ,CACD,iEADC,EAEF,6BAFE,EAGF;QACIL;MADJ,CAHE,CAAN;IAOH;IAED;AACR;AACA;;;IACQ,MAAMC,aAAa,GAAG,MAAML,GAAG,CAACK,aAAJ,CAAkBM,GAAlB,CAAsBL,eAAtB,CAA5B;;IACA,IAAI,CAACD,aAAL,EAAoB;MAChB;IACH;;IACDD,KAAK,CAACQ,IAAN,GAAaP,aAAa,CAACO,IAA3B;EACH,CAnCD;AAoCH,CArCM"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_utils","validateComment","apw","comment","onCommentBeforeCreate","subscribe","input","changeRequest","changeRequestId","result","parseIdentifier","WebinyError","ex","get","step","exports"],"sources":["validateComment.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\nimport { parseIdentifier, ParseIdentifierResult } from \"@webiny/utils\";\n\nexport const validateComment = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.comment.onCommentBeforeCreate.subscribe(async ({ input }) => {\n const { changeRequest: changeRequestId } = input;\n /**\n * We need changeRequest to be in a particular format i.e. \"contentReviewUniqueId#version\"\n */\n let result: ParseIdentifierResult;\n try {\n result = parseIdentifier(changeRequestId);\n if (!result) {\n throw new WebinyError(\n \"Could not parse changeRequestId.\",\n \"MALFORMED_CHANGE_REQUEST_ID\",\n {\n changeRequestId\n }\n );\n }\n } catch (ex) {\n throw new WebinyError(\n `The\"changeRequest\" property in input is not properly formatted.`,\n \"MALFORMED_CHANGE_REQUEST_ID\",\n {\n input\n }\n );\n }\n\n /**\n * Assign value for \"step\" field from \"changeRequest\".\n */\n const changeRequest = await apw.changeRequest.get(changeRequestId);\n if (!changeRequest) {\n return;\n }\n input.step = changeRequest.step;\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,eAAe,GAAGA,CAAC;EAAEC;AAA8C,CAAC,KAAK;EAClFA,GAAG,CAACC,OAAO,CAACC,qBAAqB,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IAC7D,MAAM;MAAEC,aAAa,EAAEC;IAAgB,CAAC,GAAGF,KAAK;IAChD;AACR;AACA;IACQ,IAAIG,MAA6B;IACjC,IAAI;MACAA,MAAM,GAAG,IAAAC,sBAAe,EAACF,eAAe,CAAC;MACzC,IAAI,CAACC,MAAM,EAAE;QACT,MAAM,IAAIE,cAAW,CACjB,kCAAkC,EAClC,6BAA6B,EAC7B;UACIH;QACJ,CACJ,CAAC;MACL;IACJ,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAID,cAAW,CAChB,iEAAgE,EACjE,6BAA6B,EAC7B;QACIL;MACJ,CACJ,CAAC;IACL;;IAEA;AACR;AACA;IACQ,MAAMC,aAAa,GAAG,MAAML,GAAG,CAACK,aAAa,CAACM,GAAG,CAACL,eAAe,CAAC;IAClE,IAAI,CAACD,aAAa,EAAE;MAChB;IACJ;IACAD,KAAK,CAACQ,IAAI,GAAGP,aAAa,CAACO,IAAI;EACnC,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAd,eAAA,GAAAA,eAAA"}
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.validateContentReview = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  const validateContentReview = ({
13
10
  apw
14
11
  }) => {
@@ -21,11 +18,9 @@ const validateContentReview = ({
21
18
  /**
22
19
  * Check whether a contentReview already exists for provided content.
23
20
  */
24
-
25
21
  const {
26
22
  contentReviewId
27
23
  } = await apw.contentReview.isReviewRequired(content);
28
-
29
24
  if (contentReviewId) {
30
25
  throw new _error.default(`A peer review for this content has been already requested.`, "REVIEW_ALREADY_EXIST", {
31
26
  contentReviewId,
@@ -34,5 +29,4 @@ const validateContentReview = ({
34
29
  }
35
30
  });
36
31
  };
37
-
38
32
  exports.validateContentReview = validateContentReview;
@@ -1 +1 @@
1
- {"version":3,"names":["validateContentReview","apw","contentReview","onContentReviewBeforeCreate","subscribe","input","content","contentReviewId","isReviewRequired","WebinyError"],"sources":["validateContentReview.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const validateContentReview = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { content } = input;\n /**\n * Check whether a contentReview already exists for provided content.\n */\n const { contentReviewId } = await apw.contentReview.isReviewRequired(content);\n if (contentReviewId) {\n throw new WebinyError(\n `A peer review for this content has been already requested.`,\n \"REVIEW_ALREADY_EXIST\",\n {\n contentReviewId,\n content\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AAGO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAAF,CAAD,KAAuD;EACxFA,GAAG,CAACC,aAAJ,CAAkBC,2BAAlB,CAA8CC,SAA9C,CAAwD,OAAO;IAAEC;EAAF,CAAP,KAAqB;IACzE,MAAM;MAAEC;IAAF,IAAcD,KAApB;IACA;AACR;AACA;;IACQ,MAAM;MAAEE;IAAF,IAAsB,MAAMN,GAAG,CAACC,aAAJ,CAAkBM,gBAAlB,CAAmCF,OAAnC,CAAlC;;IACA,IAAIC,eAAJ,EAAqB;MACjB,MAAM,IAAIE,cAAJ,CACD,4DADC,EAEF,sBAFE,EAGF;QACIF,eADJ;QAEID;MAFJ,CAHE,CAAN;IAQH;EACJ,CAhBD;AAiBH,CAlBM"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","validateContentReview","apw","contentReview","onContentReviewBeforeCreate","subscribe","input","content","contentReviewId","isReviewRequired","WebinyError","exports"],"sources":["validateContentReview.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const validateContentReview = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { content } = input;\n /**\n * Check whether a contentReview already exists for provided content.\n */\n const { contentReviewId } = await apw.contentReview.isReviewRequired(content);\n if (contentReviewId) {\n throw new WebinyError(\n `A peer review for this content has been already requested.`,\n \"REVIEW_ALREADY_EXIST\",\n {\n contentReviewId,\n content\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGO,MAAMC,qBAAqB,GAAGA,CAAC;EAAEC;AAA8C,CAAC,KAAK;EACxFA,GAAG,CAACC,aAAa,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACzE,MAAM;MAAEC;IAAQ,CAAC,GAAGD,KAAK;IACzB;AACR;AACA;IACQ,MAAM;MAAEE;IAAgB,CAAC,GAAG,MAAMN,GAAG,CAACC,aAAa,CAACM,gBAAgB,CAACF,OAAO,CAAC;IAC7E,IAAIC,eAAe,EAAE;MACjB,MAAM,IAAIE,cAAW,CAChB,4DAA2D,EAC5D,sBAAsB,EACtB;QACIF,eAAe;QACfD;MACJ,CACJ,CAAC;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAV,qBAAA,GAAAA,qBAAA"}
@@ -1,51 +1,36 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.PageApwSettingsGetterPlugin = void 0;
9
-
10
8
  var _ContentApwSettingsPlugin = require("../../ContentApwSettingsPlugin");
11
-
12
9
  var _types = require("../../types");
13
-
14
10
  var _set = _interopRequireDefault(require("lodash/set"));
15
-
16
11
  class PageApwSettingsGetterPlugin extends _ContentApwSettingsPlugin.ContentApwSettingsPlugin {
17
12
  canUse(type) {
18
13
  return type === _types.ApwContentTypes.PAGE;
19
14
  }
20
-
21
15
  setWorkflowId(page, id) {
22
16
  page.settings = (0, _set.default)(page.settings || {}, "apw.workflowId", id);
23
17
  }
24
-
25
18
  getWorkflowId(page) {
26
19
  var _page$settings$apw;
27
-
28
20
  if (!page.settings) {
29
21
  return null;
30
22
  }
31
-
32
23
  return ((_page$settings$apw = page.settings.apw) === null || _page$settings$apw === void 0 ? void 0 : _page$settings$apw.workflowId) || null;
33
24
  }
34
-
35
25
  setContentReviewId(page, id) {
36
26
  page.settings = (0, _set.default)(page.settings || {}, "apw.contentReviewId", id);
37
27
  }
38
-
39
28
  getContentReviewId(page) {
40
29
  var _page$settings$apw2;
41
-
42
30
  if (!page.settings) {
43
31
  return null;
44
32
  }
45
-
46
33
  return (_page$settings$apw2 = page.settings.apw) === null || _page$settings$apw2 === void 0 ? void 0 : _page$settings$apw2.contentReviewId;
47
34
  }
48
-
49
35
  }
50
-
51
36
  exports.PageApwSettingsGetterPlugin = PageApwSettingsGetterPlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["PageApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","PAGE","setWorkflowId","page","id","settings","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId"],"sources":["PageApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { ApwContentTypes, PageWithWorkflow } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class PageApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.PAGE;\n }\n\n public override setWorkflowId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.workflowId || null;\n }\n\n public override setContentReviewId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.contentReviewId\", id);\n }\n\n public override getContentReviewId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.contentReviewId;\n }\n}\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEO,MAAMA,2BAAN,SAA0CC,kDAA1C,CAAmE;EACtDC,MAAM,CAACC,IAAD,EAAiC;IACnD,OAAOA,IAAI,KAAKC,sBAAA,CAAgBC,IAAhC;EACH;;EAEeC,aAAa,CAACC,IAAD,EAAyBC,EAAzB,EAA4C;IACrED,IAAI,CAACE,QAAL,GAAgB,IAAAC,YAAA,EAAIH,IAAI,CAACE,QAAL,IAAiB,EAArB,EAAyB,gBAAzB,EAA2CD,EAA3C,CAAhB;EACH;;EAEeG,aAAa,CAACJ,IAAD,EAAwC;IAAA;;IACjE,IAAI,CAACA,IAAI,CAACE,QAAV,EAAoB;MAChB,OAAO,IAAP;IACH;;IACD,OAAO,uBAAAF,IAAI,CAACE,QAAL,CAAcG,GAAd,0EAAmBC,UAAnB,KAAiC,IAAxC;EACH;;EAEeC,kBAAkB,CAACP,IAAD,EAAyBC,EAAzB,EAA4C;IAC1ED,IAAI,CAACE,QAAL,GAAgB,IAAAC,YAAA,EAAIH,IAAI,CAACE,QAAL,IAAiB,EAArB,EAAyB,qBAAzB,EAAgDD,EAAhD,CAAhB;EACH;;EAEeO,kBAAkB,CAACR,IAAD,EAAwC;IAAA;;IACtE,IAAI,CAACA,IAAI,CAACE,QAAV,EAAoB;MAChB,OAAO,IAAP;IACH;;IACD,8BAAOF,IAAI,CAACE,QAAL,CAAcG,GAArB,wDAAO,oBAAmBI,eAA1B;EACH;;AAzBqE"}
1
+ {"version":3,"names":["_ContentApwSettingsPlugin","require","_types","_set","_interopRequireDefault","PageApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","PAGE","setWorkflowId","page","id","settings","set","getWorkflowId","_page$settings$apw","apw","workflowId","setContentReviewId","getContentReviewId","_page$settings$apw2","contentReviewId","exports"],"sources":["PageApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { ApwContentTypes, PageWithWorkflow } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class PageApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.PAGE;\n }\n\n public override setWorkflowId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.workflowId || null;\n }\n\n public override setContentReviewId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.contentReviewId\", id);\n }\n\n public override getContentReviewId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.contentReviewId;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEO,MAAMI,2BAA2B,SAASC,kDAAwB,CAAC;EACtDC,MAAMA,CAACC,IAAqB,EAAW;IACnD,OAAOA,IAAI,KAAKC,sBAAe,CAACC,IAAI;EACxC;EAEgBC,aAAaA,CAACC,IAAsB,EAAEC,EAAiB,EAAE;IACrED,IAAI,CAACE,QAAQ,GAAG,IAAAC,YAAG,EAACH,IAAI,CAACE,QAAQ,IAAI,CAAC,CAAC,EAAE,gBAAgB,EAAED,EAAE,CAAC;EAClE;EAEgBG,aAAaA,CAACJ,IAAsB,EAAiB;IAAA,IAAAK,kBAAA;IACjE,IAAI,CAACL,IAAI,CAACE,QAAQ,EAAE;MAChB,OAAO,IAAI;IACf;IACA,OAAO,EAAAG,kBAAA,GAAAL,IAAI,CAACE,QAAQ,CAACI,GAAG,cAAAD,kBAAA,uBAAjBA,kBAAA,CAAmBE,UAAU,KAAI,IAAI;EAChD;EAEgBC,kBAAkBA,CAACR,IAAsB,EAAEC,EAAiB,EAAE;IAC1ED,IAAI,CAACE,QAAQ,GAAG,IAAAC,YAAG,EAACH,IAAI,CAACE,QAAQ,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAED,EAAE,CAAC;EACvE;EAEgBQ,kBAAkBA,CAACT,IAAsB,EAAiB;IAAA,IAAAU,mBAAA;IACtE,IAAI,CAACV,IAAI,CAACE,QAAQ,EAAE;MAChB,OAAO,IAAI;IACf;IACA,QAAAQ,mBAAA,GAAOV,IAAI,CAACE,QAAQ,CAACI,GAAG,cAAAI,mBAAA,uBAAjBA,mBAAA,CAAmBC,eAAe;EAC7C;AACJ;AAACC,OAAA,CAAAnB,2BAAA,GAAAA,2BAAA"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.apwContentPagePlugins = void 0;
7
-
8
7
  var _api = require("@webiny/api");
9
-
10
8
  var _types = require("../../types");
11
-
12
9
  const apwContentPagePlugins = () => new _api.ContextPlugin(async context => {
13
10
  const {
14
11
  apw,
@@ -26,5 +23,4 @@ const apwContentPagePlugins = () => new _api.ContextPlugin(async context => {
26
23
  return true;
27
24
  });
28
25
  });
29
-
30
26
  exports.apwContentPagePlugins = apwContentPagePlugins;
@@ -1 +1 @@
1
- {"version":3,"names":["apwContentPagePlugins","ContextPlugin","context","apw","pageBuilder","addContentGetter","ApwContentTypes","PAGE","id","getPage","addContentPublisher","publishPage","addContentUnPublisher","unpublishPage"],"sources":["apwContentPagePlugins.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContentTypes, ApwContext, PageWithWorkflow } from \"~/types\";\n\nexport const apwContentPagePlugins = () =>\n new ContextPlugin<ApwContext>(async context => {\n const { apw, pageBuilder } = context;\n\n apw.addContentGetter(ApwContentTypes.PAGE, async id => {\n return pageBuilder.getPage<PageWithWorkflow>(id);\n });\n\n apw.addContentPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.publishPage<PageWithWorkflow>(id);\n return true;\n });\n\n apw.addContentUnPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.unpublishPage<PageWithWorkflow>(id);\n return true;\n });\n });\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,qBAAqB,GAAG,MACjC,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;EAC3C,MAAM;IAAEC,GAAF;IAAOC;EAAP,IAAuBF,OAA7B;EAEAC,GAAG,CAACE,gBAAJ,CAAqBC,sBAAA,CAAgBC,IAArC,EAA2C,MAAMC,EAAN,IAAY;IACnD,OAAOJ,WAAW,CAACK,OAAZ,CAAsCD,EAAtC,CAAP;EACH,CAFD;EAIAL,GAAG,CAACO,mBAAJ,CAAwBJ,sBAAA,CAAgBC,IAAxC,EAA8C,MAAMC,EAAN,IAAY;IACtD,MAAMJ,WAAW,CAACO,WAAZ,CAA0CH,EAA1C,CAAN;IACA,OAAO,IAAP;EACH,CAHD;EAKAL,GAAG,CAACS,qBAAJ,CAA0BN,sBAAA,CAAgBC,IAA1C,EAAgD,MAAMC,EAAN,IAAY;IACxD,MAAMJ,WAAW,CAACS,aAAZ,CAA4CL,EAA5C,CAAN;IACA,OAAO,IAAP;EACH,CAHD;AAIH,CAhBD,CADG"}
1
+ {"version":3,"names":["_api","require","_types","apwContentPagePlugins","ContextPlugin","context","apw","pageBuilder","addContentGetter","ApwContentTypes","PAGE","id","getPage","addContentPublisher","publishPage","addContentUnPublisher","unpublishPage","exports"],"sources":["apwContentPagePlugins.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContentTypes, ApwContext, PageWithWorkflow } from \"~/types\";\n\nexport const apwContentPagePlugins = () =>\n new ContextPlugin<ApwContext>(async context => {\n const { apw, pageBuilder } = context;\n\n apw.addContentGetter(ApwContentTypes.PAGE, async id => {\n return pageBuilder.getPage<PageWithWorkflow>(id);\n });\n\n apw.addContentPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.publishPage<PageWithWorkflow>(id);\n return true;\n });\n\n apw.addContentUnPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.unpublishPage<PageWithWorkflow>(id);\n return true;\n });\n });\n"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,qBAAqB,GAAGA,CAAA,KACjC,IAAIC,kBAAa,CAAa,MAAMC,OAAO,IAAI;EAC3C,MAAM;IAAEC,GAAG;IAAEC;EAAY,CAAC,GAAGF,OAAO;EAEpCC,GAAG,CAACE,gBAAgB,CAACC,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACnD,OAAOJ,WAAW,CAACK,OAAO,CAAmBD,EAAE,CAAC;EACpD,CAAC,CAAC;EAEFL,GAAG,CAACO,mBAAmB,CAACJ,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACtD,MAAMJ,WAAW,CAACO,WAAW,CAAmBH,EAAE,CAAC;IACnD,OAAO,IAAI;EACf,CAAC,CAAC;EAEFL,GAAG,CAACS,qBAAqB,CAACN,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACxD,MAAMJ,WAAW,CAACS,aAAa,CAAmBL,EAAE,CAAC;IACrD,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC,CAAC;AAACM,OAAA,CAAAd,qBAAA,GAAAA,qBAAA"}
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.extendPbPageSettingsSchema = void 0;
7
-
8
7
  var _plugins = require("@webiny/handler-graphql/plugins");
9
-
10
8
  const extendPbPageSettingsSchema = () => new _plugins.GraphQLSchemaPlugin({
11
- typeDefs:
12
- /* GraphQL */
13
- `
9
+ typeDefs: /* GraphQL */`
14
10
  type PbApwPageSettings {
15
11
  workflowId: ID
16
12
  contentReviewId: ID
@@ -21,5 +17,4 @@ const extendPbPageSettingsSchema = () => new _plugins.GraphQLSchemaPlugin({
21
17
  }
22
18
  `
23
19
  });
24
-
25
20
  exports.extendPbPageSettingsSchema = extendPbPageSettingsSchema;
@@ -1 +1 @@
1
- {"version":3,"names":["extendPbPageSettingsSchema","GraphQLSchemaPlugin","typeDefs"],"sources":["extendPbPageSettingsSchema.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ApwContext } from \"~/types\";\n\nexport const extendPbPageSettingsSchema = () =>\n new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type PbApwPageSettings {\n workflowId: ID\n contentReviewId: ID\n }\n\n extend type PbPageSettings {\n apw: PbApwPageSettings\n }\n `\n });\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,0BAA0B,GAAG,MACtC,IAAIC,4BAAJ,CAAoC;EAChCC,QAAQ;EAAE;EAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVwC,CAApC,CADG"}
1
+ {"version":3,"names":["_plugins","require","extendPbPageSettingsSchema","GraphQLSchemaPlugin","typeDefs","exports"],"sources":["extendPbPageSettingsSchema.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ApwContext } from \"~/types\";\n\nexport const extendPbPageSettingsSchema = () =>\n new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type PbApwPageSettings {\n workflowId: ID\n contentReviewId: ID\n }\n\n extend type PbPageSettings {\n apw: PbApwPageSettings\n }\n `\n });\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAGO,MAAMC,0BAA0B,GAAGA,CAAA,KACtC,IAAIC,4BAAmB,CAAa;EAChCC,QAAQ,EAAE,aAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,CAAC,CAAC;AAACC,OAAA,CAAAH,0BAAA,GAAAA,0BAAA"}
@@ -4,25 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.apwPageBuilderHooks = void 0;
7
-
8
7
  var _triggerContentReview = require("./triggerContentReview");
9
-
10
8
  var _linkContentReviewToPage = require("./linkContentReviewToPage");
11
-
12
9
  var _updateContentReviewStatus = require("./updateContentReviewStatus");
13
-
14
10
  var _linkWorkflowToPage = require("./linkWorkflowToPage");
15
-
16
11
  var _PageApwSettingsGetterPlugin = require("./PageApwSettingsGetterPlugin");
17
-
18
12
  var _commentNotification = require("./notifications/commentNotification");
19
-
20
13
  var _contentUrl = require("./notifications/contentUrl");
21
-
22
14
  var _changeRequestNotification = require("./notifications/changeRequestNotification");
23
-
24
15
  var _contentReviewNotification = require("./notifications/contentReviewNotification");
25
-
26
16
  const apwPageBuilderHooks = params => {
27
17
  const {
28
18
  pageBuilder,
@@ -49,5 +39,4 @@ const apwPageBuilderHooks = params => {
49
39
  pageBuilder
50
40
  });
51
41
  };
52
-
53
42
  exports.apwPageBuilderHooks = apwPageBuilderHooks;
@@ -1 +1 @@
1
- {"version":3,"names":["apwPageBuilderHooks","params","pageBuilder","apw","security","plugins","register","PageApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","triggerContentReview","linkContentReviewToPage","updateContentReviewStatus","linkWorkflowToPage"],"sources":["index.ts"],"sourcesContent":["import { Security } from \"@webiny/api-security/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { AdvancedPublishingWorkflow } from \"~/types\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { linkContentReviewToPage } from \"./linkContentReviewToPage\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { linkWorkflowToPage } from \"./linkWorkflowToPage\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PageApwSettingsGetterPlugin } from \"~/plugins/pageBuilder/PageApwSettingsGetterPlugin\";\nimport { createCommentNotification } from \"./notifications/commentNotification\";\nimport { createContentUrlPlugin } from \"./notifications/contentUrl\";\nimport { createChangeRequestNotification } from \"./notifications/changeRequestNotification\";\nimport { createContentReviewNotification } from \"./notifications/contentReviewNotification\";\n\nexport interface ApwPageBuilderPluginsParams {\n pageBuilder: PageBuilderContextObject;\n apw: AdvancedPublishingWorkflow;\n security: Security;\n plugins: PluginsContainer;\n}\n\nexport const apwPageBuilderHooks = (params: ApwPageBuilderPluginsParams) => {\n const { pageBuilder, apw, security, plugins } = params;\n\n plugins.register([\n new PageApwSettingsGetterPlugin(),\n createCommentNotification(),\n createChangeRequestNotification(),\n createContentUrlPlugin(),\n createContentReviewNotification()\n ]);\n\n triggerContentReview({\n apw,\n pageBuilder\n });\n linkContentReviewToPage({\n apw,\n pageBuilder\n });\n updateContentReviewStatus({\n apw,\n pageBuilder,\n security\n });\n linkWorkflowToPage({\n apw,\n pageBuilder\n });\n};\n"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AASO,MAAMA,mBAAmB,GAAIC,MAAD,IAAyC;EACxE,MAAM;IAAEC,WAAF;IAAeC,GAAf;IAAoBC,QAApB;IAA8BC;EAA9B,IAA0CJ,MAAhD;EAEAI,OAAO,CAACC,QAAR,CAAiB,CACb,IAAIC,wDAAJ,EADa,EAEb,IAAAC,8CAAA,GAFa,EAGb,IAAAC,0DAAA,GAHa,EAIb,IAAAC,kCAAA,GAJa,EAKb,IAAAC,0DAAA,GALa,CAAjB;EAQA,IAAAC,0CAAA,EAAqB;IACjBT,GADiB;IAEjBD;EAFiB,CAArB;EAIA,IAAAW,gDAAA,EAAwB;IACpBV,GADoB;IAEpBD;EAFoB,CAAxB;EAIA,IAAAY,oDAAA,EAA0B;IACtBX,GADsB;IAEtBD,WAFsB;IAGtBE;EAHsB,CAA1B;EAKA,IAAAW,sCAAA,EAAmB;IACfZ,GADe;IAEfD;EAFe,CAAnB;AAIH,CA5BM"}
1
+ {"version":3,"names":["_triggerContentReview","require","_linkContentReviewToPage","_updateContentReviewStatus","_linkWorkflowToPage","_PageApwSettingsGetterPlugin","_commentNotification","_contentUrl","_changeRequestNotification","_contentReviewNotification","apwPageBuilderHooks","params","pageBuilder","apw","security","plugins","register","PageApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","triggerContentReview","linkContentReviewToPage","updateContentReviewStatus","linkWorkflowToPage","exports"],"sources":["index.ts"],"sourcesContent":["import { Security } from \"@webiny/api-security/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { AdvancedPublishingWorkflow } from \"~/types\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { linkContentReviewToPage } from \"./linkContentReviewToPage\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { linkWorkflowToPage } from \"./linkWorkflowToPage\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PageApwSettingsGetterPlugin } from \"~/plugins/pageBuilder/PageApwSettingsGetterPlugin\";\nimport { createCommentNotification } from \"./notifications/commentNotification\";\nimport { createContentUrlPlugin } from \"./notifications/contentUrl\";\nimport { createChangeRequestNotification } from \"./notifications/changeRequestNotification\";\nimport { createContentReviewNotification } from \"./notifications/contentReviewNotification\";\n\nexport interface ApwPageBuilderPluginsParams {\n pageBuilder: PageBuilderContextObject;\n apw: AdvancedPublishingWorkflow;\n security: Security;\n plugins: PluginsContainer;\n}\n\nexport const apwPageBuilderHooks = (params: ApwPageBuilderPluginsParams) => {\n const { pageBuilder, apw, security, plugins } = params;\n\n plugins.register([\n new PageApwSettingsGetterPlugin(),\n createCommentNotification(),\n createChangeRequestNotification(),\n createContentUrlPlugin(),\n createContentReviewNotification()\n ]);\n\n triggerContentReview({\n apw,\n pageBuilder\n });\n linkContentReviewToPage({\n apw,\n pageBuilder\n });\n updateContentReviewStatus({\n apw,\n pageBuilder,\n security\n });\n linkWorkflowToPage({\n apw,\n pageBuilder\n });\n};\n"],"mappings":";;;;;;AAGA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAEA,IAAAI,4BAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,0BAAA,GAAAP,OAAA;AACA,IAAAQ,0BAAA,GAAAR,OAAA;AASO,MAAMS,mBAAmB,GAAIC,MAAmC,IAAK;EACxE,MAAM;IAAEC,WAAW;IAAEC,GAAG;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAEtDI,OAAO,CAACC,QAAQ,CAAC,CACb,IAAIC,wDAA2B,CAAC,CAAC,EACjC,IAAAC,8CAAyB,EAAC,CAAC,EAC3B,IAAAC,0DAA+B,EAAC,CAAC,EACjC,IAAAC,kCAAsB,EAAC,CAAC,EACxB,IAAAC,0DAA+B,EAAC,CAAC,CACpC,CAAC;EAEF,IAAAC,0CAAoB,EAAC;IACjBT,GAAG;IACHD;EACJ,CAAC,CAAC;EACF,IAAAW,gDAAuB,EAAC;IACpBV,GAAG;IACHD;EACJ,CAAC,CAAC;EACF,IAAAY,oDAAyB,EAAC;IACtBX,GAAG;IACHD,WAAW;IACXE;EACJ,CAAC,CAAC;EACF,IAAAW,sCAAkB,EAAC;IACfZ,GAAG;IACHD;EACJ,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAhB,mBAAA,GAAAA,mBAAA"}