@webiny/api-apw 0.0.0-unstable.6e5425ee89 → 0.0.0-unstable.78f581c1d2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/ApwChangeRequestNotification.js +10 -0
  2. package/ApwChangeRequestNotification.js.map +1 -1
  3. package/ApwCommentNotification.js +10 -0
  4. package/ApwCommentNotification.js.map +1 -1
  5. package/ApwContentReviewNotification.js +10 -0
  6. package/ApwContentReviewNotification.js.map +1 -1
  7. package/ApwContentUrlPlugin.js +10 -0
  8. package/ApwContentUrlPlugin.js.map +1 -1
  9. package/ContentApwSettingsPlugin.js +5 -0
  10. package/ContentApwSettingsPlugin.js.map +1 -1
  11. package/crud/createChangeRequestMethods.js +11 -4
  12. package/crud/createChangeRequestMethods.js.map +1 -1
  13. package/crud/createCommentMethods.js +12 -4
  14. package/crud/createCommentMethods.js.map +1 -1
  15. package/crud/createContentReviewMethods.js +84 -20
  16. package/crud/createContentReviewMethods.js.map +1 -1
  17. package/crud/createReviewerMethods.js +12 -4
  18. package/crud/createReviewerMethods.js.map +1 -1
  19. package/crud/createWorkflowMethods.js +17 -4
  20. package/crud/createWorkflowMethods.js.map +1 -1
  21. package/crud/index.js +25 -0
  22. package/crud/index.js.map +1 -1
  23. package/crud/utils.js +28 -0
  24. package/crud/utils.js.map +1 -1
  25. package/index.js +11 -1
  26. package/index.js.map +1 -1
  27. package/package.json +34 -34
  28. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +15 -0
  29. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  30. package/plugins/cms/apwEntryPlugins.js +8 -0
  31. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  32. package/plugins/cms/index.js +13 -0
  33. package/plugins/cms/index.js.map +1 -1
  34. package/plugins/cms/linkContentReviewToEntry.js +17 -0
  35. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  36. package/plugins/cms/linkWorkflowToEntry.js +31 -2
  37. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  38. package/plugins/cms/notifications/changeRequestNotification.js +4 -0
  39. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
  40. package/plugins/cms/notifications/commentNotification.js +4 -0
  41. package/plugins/cms/notifications/commentNotification.js.map +1 -1
  42. package/plugins/cms/notifications/contentReviewNotification.js +4 -0
  43. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
  44. package/plugins/cms/notifications/contentUrl.js +8 -1
  45. package/plugins/cms/notifications/contentUrl.js.map +1 -1
  46. package/plugins/cms/triggerContentReview.js +14 -0
  47. package/plugins/cms/triggerContentReview.js.map +1 -1
  48. package/plugins/cms/updateContentReviewStatus.js +18 -0
  49. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  50. package/plugins/cms/utils.js +47 -2
  51. package/plugins/cms/utils.js.map +1 -1
  52. package/plugins/context.js +31 -0
  53. package/plugins/context.js.map +1 -1
  54. package/plugins/graphql/changeRequest.gql.js +8 -1
  55. package/plugins/graphql/changeRequest.gql.js.map +1 -1
  56. package/plugins/graphql/comment.gql.js +8 -1
  57. package/plugins/graphql/comment.gql.js.map +1 -1
  58. package/plugins/graphql/contentReview.gql.js +20 -1
  59. package/plugins/graphql/contentReview.gql.js.map +1 -1
  60. package/plugins/graphql/reviewer.gql.js +8 -1
  61. package/plugins/graphql/reviewer.gql.js.map +1 -1
  62. package/plugins/graphql/workflow.gql.js +8 -1
  63. package/plugins/graphql/workflow.gql.js.map +1 -1
  64. package/plugins/graphql.js +16 -1
  65. package/plugins/graphql.js.map +1 -1
  66. package/plugins/hooks/createReviewerFromIdentity.js +11 -2
  67. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  68. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +9 -1
  69. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  70. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +8 -1
  71. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  72. package/plugins/hooks/index.js +14 -0
  73. package/plugins/hooks/index.js.map +1 -1
  74. package/plugins/hooks/initializeContentReviewSteps.js +15 -2
  75. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  76. package/plugins/hooks/initializeNotifications.js +5 -0
  77. package/plugins/hooks/initializeNotifications.js.map +1 -1
  78. package/plugins/hooks/listContentReviews.js +12 -0
  79. package/plugins/hooks/listContentReviews.js.map +1 -1
  80. package/plugins/hooks/notifications/appUrl.js +4 -0
  81. package/plugins/hooks/notifications/appUrl.js.map +1 -1
  82. package/plugins/hooks/notifications/changeRequestAfterCreate.js +28 -0
  83. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
  84. package/plugins/hooks/notifications/changeRequestUrl.js +4 -0
  85. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
  86. package/plugins/hooks/notifications/commentAfterCreate.js +30 -0
  87. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
  88. package/plugins/hooks/notifications/commentUrl.js +4 -0
  89. package/plugins/hooks/notifications/commentUrl.js.map +1 -1
  90. package/plugins/hooks/notifications/contentReviewAfterCreate.js +24 -1
  91. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
  92. package/plugins/hooks/notifications/contentReviewUrl.js +4 -0
  93. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
  94. package/plugins/hooks/notifications/contentUrl.js +5 -0
  95. package/plugins/hooks/notifications/contentUrl.js.map +1 -1
  96. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +4 -0
  97. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
  98. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +4 -0
  99. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
  100. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +4 -0
  101. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
  102. package/plugins/hooks/notifications/reviewers.js +7 -0
  103. package/plugins/hooks/notifications/reviewers.js.map +1 -1
  104. package/plugins/hooks/notifications/sendChangeRequestNotification.js +11 -0
  105. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
  106. package/plugins/hooks/notifications/sendCommentNotification.js +11 -0
  107. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
  108. package/plugins/hooks/notifications/sendContentReviewNotification.js +11 -0
  109. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
  110. package/plugins/hooks/updatePendingChangeRequests.js +8 -0
  111. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  112. package/plugins/hooks/updateTotalComments.js +9 -0
  113. package/plugins/hooks/updateTotalComments.js.map +1 -1
  114. package/plugins/hooks/validateChangeRequest.js +16 -0
  115. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  116. package/plugins/hooks/validateComment.js +12 -1
  117. package/plugins/hooks/validateComment.js.map +1 -1
  118. package/plugins/hooks/validateContentReview.js +6 -0
  119. package/plugins/hooks/validateContentReview.js.map +1 -1
  120. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +15 -0
  121. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
  122. package/plugins/pageBuilder/apwContentPagePlugins.js +4 -0
  123. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
  124. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +6 -1
  125. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
  126. package/plugins/pageBuilder/index.js +11 -0
  127. package/plugins/pageBuilder/index.js.map +1 -1
  128. package/plugins/pageBuilder/linkContentReviewToPage.js +16 -0
  129. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
  130. package/plugins/pageBuilder/linkWorkflowToPage.js +31 -1
  131. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  132. package/plugins/pageBuilder/notifications/changeRequestNotification.js +4 -0
  133. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -1
  134. package/plugins/pageBuilder/notifications/commentNotification.js +4 -0
  135. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -1
  136. package/plugins/pageBuilder/notifications/contentReviewNotification.js +4 -0
  137. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -1
  138. package/plugins/pageBuilder/notifications/contentUrl.js +7 -1
  139. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -1
  140. package/plugins/pageBuilder/triggerContentReview.js +11 -0
  141. package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
  142. package/plugins/pageBuilder/updateContentReviewStatus.js +12 -0
  143. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
  144. package/plugins/pageBuilder/utils.js +35 -1
  145. package/plugins/pageBuilder/utils.js.map +1 -1
  146. package/plugins/utils.js +43 -0
  147. package/plugins/utils.js.map +1 -1
  148. package/scheduler/createScheduleActionMethods.js +20 -1
  149. package/scheduler/createScheduleActionMethods.js.map +1 -1
  150. package/scheduler/handlers/executeAction/index.js +33 -9
  151. package/scheduler/handlers/executeAction/index.js.map +1 -1
  152. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +5 -0
  153. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  154. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +21 -0
  155. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  156. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +27 -4
  157. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  158. package/scheduler/handlers/executeAction/security.js +11 -0
  159. package/scheduler/handlers/executeAction/security.js.map +1 -1
  160. package/scheduler/handlers/scheduleAction/index.js +25 -5
  161. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  162. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +23 -2
  163. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  164. package/scheduler/handlers/utils.js +40 -3
  165. package/scheduler/handlers/utils.js.map +1 -1
  166. package/scheduler/index.js +3 -0
  167. package/scheduler/index.js.map +1 -1
  168. package/scheduler/types.js +6 -0
  169. package/scheduler/types.js.map +1 -1
  170. package/storageOperations/changeRequestStorageOperations.js +19 -0
  171. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  172. package/storageOperations/commentStorageOperations.js +21 -0
  173. package/storageOperations/commentStorageOperations.js.map +1 -1
  174. package/storageOperations/contentReviewStorageOperations.js +17 -0
  175. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  176. package/storageOperations/index.js +14 -0
  177. package/storageOperations/index.js.map +1 -1
  178. package/storageOperations/models/changeRequest.model.js +9 -0
  179. package/storageOperations/models/changeRequest.model.js.map +1 -1
  180. package/storageOperations/models/comment.model.js +8 -0
  181. package/storageOperations/models/comment.model.js.map +1 -1
  182. package/storageOperations/models/contentModelPluginFactory.js +5 -0
  183. package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
  184. package/storageOperations/models/contentReview.model.js +26 -0
  185. package/storageOperations/models/contentReview.model.js.map +1 -1
  186. package/storageOperations/models/index.js +24 -2
  187. package/storageOperations/models/index.js.map +1 -1
  188. package/storageOperations/models/reviewer.model.js +8 -0
  189. package/storageOperations/models/reviewer.model.js.map +1 -1
  190. package/storageOperations/models/utils.js +4 -0
  191. package/storageOperations/models/utils.js.map +1 -1
  192. package/storageOperations/models/workflow.model.js +23 -0
  193. package/storageOperations/models/workflow.model.js.map +1 -1
  194. package/storageOperations/reviewerStorageOperations.js +17 -0
  195. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  196. package/storageOperations/workflowStorageOperations.js +19 -0
  197. package/storageOperations/workflowStorageOperations.js.map +1 -1
  198. package/types.js +14 -0
  199. package/types.js.map +1 -1
  200. package/utils/contentApwSettingsPlugin.js +6 -0
  201. package/utils/contentApwSettingsPlugin.js.map +1 -1
  202. package/utils/errors.js +17 -0
  203. package/utils/errors.js.map +1 -1
  204. package/utils/fieldResolver.js +12 -2
  205. package/utils/fieldResolver.js.map +1 -1
  206. package/utils/resolve.js +3 -0
  207. package/utils/resolve.js.map +1 -1
@@ -1,36 +1,51 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.CmsEntryApwSettingsGetterPlugin = void 0;
9
+
8
10
  var _ContentApwSettingsPlugin = require("../../ContentApwSettingsPlugin");
11
+
9
12
  var _types = require("../../types");
13
+
10
14
  var _set = _interopRequireDefault(require("lodash/set"));
15
+
11
16
  class CmsEntryApwSettingsGetterPlugin extends _ContentApwSettingsPlugin.ContentApwSettingsPlugin {
12
17
  canUse(type) {
13
18
  return type === _types.ApwContentTypes.CMS_ENTRY;
14
19
  }
20
+
15
21
  setWorkflowId(entry, id) {
16
22
  entry.meta = (0, _set.default)(entry.meta || {}, "apw.workflowId", id);
17
23
  }
24
+
18
25
  getWorkflowId(entry) {
19
26
  var _entry$meta$apw;
27
+
20
28
  if (!entry.meta) {
21
29
  return null;
22
30
  }
31
+
23
32
  return ((_entry$meta$apw = entry.meta.apw) === null || _entry$meta$apw === void 0 ? void 0 : _entry$meta$apw.workflowId) || null;
24
33
  }
34
+
25
35
  setContentReviewId(entry, id) {
26
36
  entry.meta = (0, _set.default)(entry.meta || {}, "apw.contentReviewId", id);
27
37
  }
38
+
28
39
  getContentReviewId(entry) {
29
40
  var _entry$meta$apw2;
41
+
30
42
  if (!entry.meta) {
31
43
  return null;
32
44
  }
45
+
33
46
  return ((_entry$meta$apw2 = entry.meta.apw) === null || _entry$meta$apw2 === void 0 ? void 0 : _entry$meta$apw2.contentReviewId) || null;
34
47
  }
48
+
35
49
  }
50
+
36
51
  exports.CmsEntryApwSettingsGetterPlugin = CmsEntryApwSettingsGetterPlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["CmsEntryApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","CMS_ENTRY","setWorkflowId","entry","id","meta","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId"],"sources":["CmsEntryApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport { ApwContentTypes } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class CmsEntryApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.CMS_ENTRY;\n }\n\n public override setWorkflowId(entry: CmsEntry, id: string | null) {\n entry.meta = set(entry.meta || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(entry: CmsEntry): string | null {\n if (!entry.meta) {\n return null;\n }\n return entry.meta.apw?.workflowId || null;\n }\n\n public override setContentReviewId(entry: CmsEntry, id: string | null) {\n entry.meta = set(entry.meta || {}, \"apw.contentReviewId\", id);\n }\n public override getContentReviewId(entry: CmsEntry): string | null {\n if (!entry.meta) {\n return null;\n }\n return entry.meta.apw?.contentReviewId || null;\n }\n}\n"],"mappings":";;;;;;;AAAA;AAEA;AACA;AAEO,MAAMA,+BAA+B,SAASC,kDAAwB,CAAC;EAC1DC,MAAM,CAACC,IAAqB,EAAW;IACnD,OAAOA,IAAI,KAAKC,sBAAe,CAACC,SAAS;EAC7C;EAEgBC,aAAa,CAACC,KAAe,EAAEC,EAAiB,EAAE;IAC9DD,KAAK,CAACE,IAAI,GAAG,IAAAC,YAAG,EAACH,KAAK,CAACE,IAAI,IAAI,CAAC,CAAC,EAAE,gBAAgB,EAAED,EAAE,CAAC;EAC5D;EAEgBG,aAAa,CAACJ,KAAe,EAAiB;IAAA;IAC1D,IAAI,CAACA,KAAK,CAACE,IAAI,EAAE;MACb,OAAO,IAAI;IACf;IACA,OAAO,oBAAAF,KAAK,CAACE,IAAI,CAACG,GAAG,oDAAd,gBAAgBC,UAAU,KAAI,IAAI;EAC7C;EAEgBC,kBAAkB,CAACP,KAAe,EAAEC,EAAiB,EAAE;IACnED,KAAK,CAACE,IAAI,GAAG,IAAAC,YAAG,EAACH,KAAK,CAACE,IAAI,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAED,EAAE,CAAC;EACjE;EACgBO,kBAAkB,CAACR,KAAe,EAAiB;IAAA;IAC/D,IAAI,CAACA,KAAK,CAACE,IAAI,EAAE;MACb,OAAO,IAAI;IACf;IACA,OAAO,qBAAAF,KAAK,CAACE,IAAI,CAACG,GAAG,qDAAd,iBAAgBI,eAAe,KAAI,IAAI;EAClD;AACJ;AAAC"}
1
+ {"version":3,"names":["CmsEntryApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","CMS_ENTRY","setWorkflowId","entry","id","meta","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId"],"sources":["CmsEntryApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport { ApwContentTypes } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class CmsEntryApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.CMS_ENTRY;\n }\n\n public override setWorkflowId(entry: CmsEntry, id: string | null) {\n entry.meta = set(entry.meta || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(entry: CmsEntry): string | null {\n if (!entry.meta) {\n return null;\n }\n return entry.meta.apw?.workflowId || null;\n }\n\n public override setContentReviewId(entry: CmsEntry, id: string | null) {\n entry.meta = set(entry.meta || {}, \"apw.contentReviewId\", id);\n }\n public override getContentReviewId(entry: CmsEntry): string | null {\n if (!entry.meta) {\n return null;\n }\n return entry.meta.apw?.contentReviewId || null;\n }\n}\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AAEO,MAAMA,+BAAN,SAA8CC,kDAA9C,CAAuE;EAC1DC,MAAM,CAACC,IAAD,EAAiC;IACnD,OAAOA,IAAI,KAAKC,sBAAA,CAAgBC,SAAhC;EACH;;EAEeC,aAAa,CAACC,KAAD,EAAkBC,EAAlB,EAAqC;IAC9DD,KAAK,CAACE,IAAN,GAAa,IAAAC,YAAA,EAAIH,KAAK,CAACE,IAAN,IAAc,EAAlB,EAAsB,gBAAtB,EAAwCD,EAAxC,CAAb;EACH;;EAEeG,aAAa,CAACJ,KAAD,EAAiC;IAAA;;IAC1D,IAAI,CAACA,KAAK,CAACE,IAAX,EAAiB;MACb,OAAO,IAAP;IACH;;IACD,OAAO,oBAAAF,KAAK,CAACE,IAAN,CAAWG,GAAX,oEAAgBC,UAAhB,KAA8B,IAArC;EACH;;EAEeC,kBAAkB,CAACP,KAAD,EAAkBC,EAAlB,EAAqC;IACnED,KAAK,CAACE,IAAN,GAAa,IAAAC,YAAA,EAAIH,KAAK,CAACE,IAAN,IAAc,EAAlB,EAAsB,qBAAtB,EAA6CD,EAA7C,CAAb;EACH;;EACeO,kBAAkB,CAACR,KAAD,EAAiC;IAAA;;IAC/D,IAAI,CAACA,KAAK,CAACE,IAAX,EAAiB;MACb,OAAO,IAAP;IACH;;IACD,OAAO,qBAAAF,KAAK,CAACE,IAAN,CAAWG,GAAX,sEAAgBI,eAAhB,KAAmC,IAA1C;EACH;;AAxByE"}
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.apwEntryPlugins = void 0;
9
+
8
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
9
12
  var _types = require("../../types");
13
+
10
14
  var _utils = require("./utils");
15
+
11
16
  const apwEntryPlugins = params => {
12
17
  const {
13
18
  cms,
@@ -16,9 +21,11 @@ const apwEntryPlugins = params => {
16
21
  apw.addContentGetter(_types.ApwContentTypes.CMS_ENTRY, async (id, settings) => {
17
22
  const model = await (0, _utils.fetchModel)(cms, id, settings);
18
23
  const item = await cms.getEntryById(model, id);
24
+
19
25
  if (!item) {
20
26
  return null;
21
27
  }
28
+
22
29
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
23
30
  meta: (0, _objectSpread2.default)({}, item.meta || {}),
24
31
  title: (0, _utils.getEntryTitle)(model, item)
@@ -35,4 +42,5 @@ const apwEntryPlugins = params => {
35
42
  return true;
36
43
  });
37
44
  };
45
+
38
46
  exports.apwEntryPlugins = apwEntryPlugins;
@@ -1 +1 @@
1
- {"version":3,"names":["apwEntryPlugins","params","cms","apw","addContentGetter","ApwContentTypes","CMS_ENTRY","id","settings","model","fetchModel","item","getEntryById","meta","title","getEntryTitle","addContentPublisher","publishEntry","addContentUnPublisher","unpublishEntry"],"sources":["apwEntryPlugins.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow, ApwContentTypes } from \"~/types\";\nimport { fetchModel, getEntryTitle } from \"./utils\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\n\ninterface ApwEntryPlugins {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n}\nexport const apwEntryPlugins = (params: ApwEntryPlugins) => {\n const { cms, apw } = params;\n\n apw.addContentGetter(ApwContentTypes.CMS_ENTRY, async (id, settings) => {\n const model = await fetchModel(cms, id, settings);\n\n const item = await cms.getEntryById(model, id);\n\n if (!item) {\n return null;\n }\n\n return {\n ...item,\n meta: {\n ...(item.meta || {})\n },\n title: getEntryTitle(model, item)\n };\n });\n\n apw.addContentPublisher(ApwContentTypes.CMS_ENTRY, async (id, settings) => {\n const model = await fetchModel(cms, id, settings);\n await cms.publishEntry(model, id);\n return true;\n });\n\n apw.addContentUnPublisher(ApwContentTypes.CMS_ENTRY, async (id, settings) => {\n const model = await fetchModel(cms, id, settings);\n await cms.unpublishEntry(model, id);\n return true;\n });\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AAOO,MAAMA,eAAe,GAAIC,MAAuB,IAAK;EACxD,MAAM;IAAEC,GAAG;IAAEC;EAAI,CAAC,GAAGF,MAAM;EAE3BE,GAAG,CAACC,gBAAgB,CAACC,sBAAe,CAACC,SAAS,EAAE,OAAOC,EAAE,EAAEC,QAAQ,KAAK;IACpE,MAAMC,KAAK,GAAG,MAAM,IAAAC,iBAAU,EAACR,GAAG,EAAEK,EAAE,EAAEC,QAAQ,CAAC;IAEjD,MAAMG,IAAI,GAAG,MAAMT,GAAG,CAACU,YAAY,CAACH,KAAK,EAAEF,EAAE,CAAC;IAE9C,IAAI,CAACI,IAAI,EAAE;MACP,OAAO,IAAI;IACf;IAEA,mEACOA,IAAI;MACPE,IAAI,kCACIF,IAAI,CAACE,IAAI,IAAI,CAAC,CAAC,CACtB;MACDC,KAAK,EAAE,IAAAC,oBAAa,EAACN,KAAK,EAAEE,IAAI;IAAC;EAEzC,CAAC,CAAC;EAEFR,GAAG,CAACa,mBAAmB,CAACX,sBAAe,CAACC,SAAS,EAAE,OAAOC,EAAE,EAAEC,QAAQ,KAAK;IACvE,MAAMC,KAAK,GAAG,MAAM,IAAAC,iBAAU,EAACR,GAAG,EAAEK,EAAE,EAAEC,QAAQ,CAAC;IACjD,MAAMN,GAAG,CAACe,YAAY,CAACR,KAAK,EAAEF,EAAE,CAAC;IACjC,OAAO,IAAI;EACf,CAAC,CAAC;EAEFJ,GAAG,CAACe,qBAAqB,CAACb,sBAAe,CAACC,SAAS,EAAE,OAAOC,EAAE,EAAEC,QAAQ,KAAK;IACzE,MAAMC,KAAK,GAAG,MAAM,IAAAC,iBAAU,EAACR,GAAG,EAAEK,EAAE,EAAEC,QAAQ,CAAC;IACjD,MAAMN,GAAG,CAACiB,cAAc,CAACV,KAAK,EAAEF,EAAE,CAAC;IACnC,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["apwEntryPlugins","params","cms","apw","addContentGetter","ApwContentTypes","CMS_ENTRY","id","settings","model","fetchModel","item","getEntryById","meta","title","getEntryTitle","addContentPublisher","publishEntry","addContentUnPublisher","unpublishEntry"],"sources":["apwEntryPlugins.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow, ApwContentTypes } from \"~/types\";\nimport { fetchModel, getEntryTitle } from \"./utils\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\n\ninterface ApwEntryPlugins {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n}\nexport const apwEntryPlugins = (params: ApwEntryPlugins) => {\n const { cms, apw } = params;\n\n apw.addContentGetter(ApwContentTypes.CMS_ENTRY, async (id, settings) => {\n const model = await fetchModel(cms, id, settings);\n\n const item = await cms.getEntryById(model, id);\n\n if (!item) {\n return null;\n }\n\n return {\n ...item,\n meta: {\n ...(item.meta || {})\n },\n title: getEntryTitle(model, item)\n };\n });\n\n apw.addContentPublisher(ApwContentTypes.CMS_ENTRY, async (id, settings) => {\n const model = await fetchModel(cms, id, settings);\n await cms.publishEntry(model, id);\n return true;\n });\n\n apw.addContentUnPublisher(ApwContentTypes.CMS_ENTRY, async (id, settings) => {\n const model = await fetchModel(cms, id, settings);\n await cms.unpublishEntry(model, id);\n return true;\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAOO,MAAMA,eAAe,GAAIC,MAAD,IAA6B;EACxD,MAAM;IAAEC,GAAF;IAAOC;EAAP,IAAeF,MAArB;EAEAE,GAAG,CAACC,gBAAJ,CAAqBC,sBAAA,CAAgBC,SAArC,EAAgD,OAAOC,EAAP,EAAWC,QAAX,KAAwB;IACpE,MAAMC,KAAK,GAAG,MAAM,IAAAC,iBAAA,EAAWR,GAAX,EAAgBK,EAAhB,EAAoBC,QAApB,CAApB;IAEA,MAAMG,IAAI,GAAG,MAAMT,GAAG,CAACU,YAAJ,CAAiBH,KAAjB,EAAwBF,EAAxB,CAAnB;;IAEA,IAAI,CAACI,IAAL,EAAW;MACP,OAAO,IAAP;IACH;;IAED,mEACOA,IADP;MAEIE,IAAI,kCACIF,IAAI,CAACE,IAAL,IAAa,EADjB,CAFR;MAKIC,KAAK,EAAE,IAAAC,oBAAA,EAAcN,KAAd,EAAqBE,IAArB;IALX;EAOH,CAhBD;EAkBAR,GAAG,CAACa,mBAAJ,CAAwBX,sBAAA,CAAgBC,SAAxC,EAAmD,OAAOC,EAAP,EAAWC,QAAX,KAAwB;IACvE,MAAMC,KAAK,GAAG,MAAM,IAAAC,iBAAA,EAAWR,GAAX,EAAgBK,EAAhB,EAAoBC,QAApB,CAApB;IACA,MAAMN,GAAG,CAACe,YAAJ,CAAiBR,KAAjB,EAAwBF,EAAxB,CAAN;IACA,OAAO,IAAP;EACH,CAJD;EAMAJ,GAAG,CAACe,qBAAJ,CAA0Bb,sBAAA,CAAgBC,SAA1C,EAAqD,OAAOC,EAAP,EAAWC,QAAX,KAAwB;IACzE,MAAMC,KAAK,GAAG,MAAM,IAAAC,iBAAA,EAAWR,GAAX,EAAgBK,EAAhB,EAAoBC,QAApB,CAApB;IACA,MAAMN,GAAG,CAACiB,cAAJ,CAAmBV,KAAnB,EAA0BF,EAA1B,CAAN;IACA,OAAO,IAAP;EACH,CAJD;AAKH,CAhCM"}
@@ -4,16 +4,27 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.apwCmsHooks = void 0;
7
+
7
8
  var _apwEntryPlugins = require("./apwEntryPlugins");
9
+
8
10
  var _linkContentReviewToEntry = require("./linkContentReviewToEntry");
11
+
9
12
  var _linkWorkflowToEntry = require("./linkWorkflowToEntry");
13
+
10
14
  var _triggerContentReview = require("./triggerContentReview");
15
+
11
16
  var _updateContentReviewStatus = require("./updateContentReviewStatus");
17
+
12
18
  var _CmsEntryApwSettingsGetterPlugin = require("./CmsEntryApwSettingsGetterPlugin");
19
+
13
20
  var _commentNotification = require("./notifications/commentNotification");
21
+
14
22
  var _contentUrl = require("./notifications/contentUrl");
23
+
15
24
  var _changeRequestNotification = require("./notifications/changeRequestNotification");
25
+
16
26
  var _contentReviewNotification = require("./notifications/contentReviewNotification");
27
+
17
28
  const apwCmsHooks = params => {
18
29
  /**
19
30
  * We do not need to assign anything if no apw or cms in the context.
@@ -22,6 +33,7 @@ const apwCmsHooks = params => {
22
33
  if (!params.apw || !params.cms) {
23
34
  return;
24
35
  }
36
+
25
37
  params.plugins.register([new _CmsEntryApwSettingsGetterPlugin.CmsEntryApwSettingsGetterPlugin(), (0, _commentNotification.createCommentNotification)(), (0, _changeRequestNotification.createChangeRequestNotification)(), (0, _contentUrl.createContentUrlPlugin)(), (0, _contentReviewNotification.createContentReviewNotification)()]);
26
38
  (0, _apwEntryPlugins.apwEntryPlugins)(params);
27
39
  (0, _linkContentReviewToEntry.linkContentReviewToEntry)(params);
@@ -29,4 +41,5 @@ const apwCmsHooks = params => {
29
41
  (0, _triggerContentReview.triggerContentReview)(params);
30
42
  (0, _updateContentReviewStatus.updateContentReviewStatus)(params);
31
43
  };
44
+
32
45
  exports.apwCmsHooks = apwCmsHooks;
@@ -1 +1 @@
1
- {"version":3,"names":["apwCmsHooks","params","apw","cms","plugins","register","CmsEntryApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","apwEntryPlugins","linkContentReviewToEntry","linkWorkflowToEntry","triggerContentReview","updateContentReviewStatus"],"sources":["index.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow } from \"~/types\";\nimport { apwEntryPlugins } from \"./apwEntryPlugins\";\nimport { linkContentReviewToEntry } from \"./linkContentReviewToEntry\";\nimport { linkWorkflowToEntry } from \"./linkWorkflowToEntry\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryApwSettingsGetterPlugin } from \"./CmsEntryApwSettingsGetterPlugin\";\nimport { createCommentNotification } from \"./notifications/commentNotification\";\nimport { createContentUrlPlugin } from \"./notifications/contentUrl\";\nimport { createChangeRequestNotification } from \"./notifications/changeRequestNotification\";\nimport { createContentReviewNotification } from \"./notifications/contentReviewNotification\";\n\ninterface ApwCmsHooksParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n plugins: PluginsContainer;\n security: Security;\n}\nexport const apwCmsHooks = (params: ApwCmsHooksParams) => {\n /**\n * We do not need to assign anything if no apw or cms in the context.\n * This might happen on options request.\n */\n if (!params.apw || !params.cms) {\n return;\n }\n\n params.plugins.register([\n new CmsEntryApwSettingsGetterPlugin(),\n createCommentNotification(),\n createChangeRequestNotification(),\n createContentUrlPlugin(),\n createContentReviewNotification()\n ]);\n\n apwEntryPlugins(params);\n\n linkContentReviewToEntry(params);\n\n linkWorkflowToEntry(params);\n\n triggerContentReview(params);\n\n updateContentReviewStatus(params);\n};\n"],"mappings":";;;;;;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AAQO,MAAMA,WAAW,GAAIC,MAAyB,IAAK;EACtD;AACJ;AACA;AACA;EACI,IAAI,CAACA,MAAM,CAACC,GAAG,IAAI,CAACD,MAAM,CAACE,GAAG,EAAE;IAC5B;EACJ;EAEAF,MAAM,CAACG,OAAO,CAACC,QAAQ,CAAC,CACpB,IAAIC,gEAA+B,EAAE,EACrC,IAAAC,8CAAyB,GAAE,EAC3B,IAAAC,0DAA+B,GAAE,EACjC,IAAAC,kCAAsB,GAAE,EACxB,IAAAC,0DAA+B,GAAE,CACpC,CAAC;EAEF,IAAAC,gCAAe,EAACV,MAAM,CAAC;EAEvB,IAAAW,kDAAwB,EAACX,MAAM,CAAC;EAEhC,IAAAY,wCAAmB,EAACZ,MAAM,CAAC;EAE3B,IAAAa,0CAAoB,EAACb,MAAM,CAAC;EAE5B,IAAAc,oDAAyB,EAACd,MAAM,CAAC;AACrC,CAAC;AAAC"}
1
+ {"version":3,"names":["apwCmsHooks","params","apw","cms","plugins","register","CmsEntryApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","apwEntryPlugins","linkContentReviewToEntry","linkWorkflowToEntry","triggerContentReview","updateContentReviewStatus"],"sources":["index.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow } from \"~/types\";\nimport { apwEntryPlugins } from \"./apwEntryPlugins\";\nimport { linkContentReviewToEntry } from \"./linkContentReviewToEntry\";\nimport { linkWorkflowToEntry } from \"./linkWorkflowToEntry\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { Security } from \"@webiny/api-security/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryApwSettingsGetterPlugin } from \"./CmsEntryApwSettingsGetterPlugin\";\nimport { createCommentNotification } from \"./notifications/commentNotification\";\nimport { createContentUrlPlugin } from \"./notifications/contentUrl\";\nimport { createChangeRequestNotification } from \"./notifications/changeRequestNotification\";\nimport { createContentReviewNotification } from \"./notifications/contentReviewNotification\";\n\ninterface ApwCmsHooksParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n plugins: PluginsContainer;\n security: Security;\n}\nexport const apwCmsHooks = (params: ApwCmsHooksParams) => {\n /**\n * We do not need to assign anything if no apw or cms in the context.\n * This might happen on options request.\n */\n if (!params.apw || !params.cms) {\n return;\n }\n\n params.plugins.register([\n new CmsEntryApwSettingsGetterPlugin(),\n createCommentNotification(),\n createChangeRequestNotification(),\n createContentUrlPlugin(),\n createContentReviewNotification()\n ]);\n\n apwEntryPlugins(params);\n\n linkContentReviewToEntry(params);\n\n linkWorkflowToEntry(params);\n\n triggerContentReview(params);\n\n updateContentReviewStatus(params);\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAQO,MAAMA,WAAW,GAAIC,MAAD,IAA+B;EACtD;AACJ;AACA;AACA;EACI,IAAI,CAACA,MAAM,CAACC,GAAR,IAAe,CAACD,MAAM,CAACE,GAA3B,EAAgC;IAC5B;EACH;;EAEDF,MAAM,CAACG,OAAP,CAAeC,QAAf,CAAwB,CACpB,IAAIC,gEAAJ,EADoB,EAEpB,IAAAC,8CAAA,GAFoB,EAGpB,IAAAC,0DAAA,GAHoB,EAIpB,IAAAC,kCAAA,GAJoB,EAKpB,IAAAC,0DAAA,GALoB,CAAxB;EAQA,IAAAC,gCAAA,EAAgBV,MAAhB;EAEA,IAAAW,kDAAA,EAAyBX,MAAzB;EAEA,IAAAY,wCAAA,EAAoBZ,MAApB;EAEA,IAAAa,0CAAA,EAAqBb,MAArB;EAEA,IAAAc,oDAAA,EAA0Bd,MAA1B;AACH,CA1BM"}
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.linkContentReviewToEntry = void 0;
9
+
8
10
  var _types = require("../../types");
11
+
9
12
  var _utils = require("./utils");
13
+
10
14
  var _error = _interopRequireDefault(require("@webiny/error"));
15
+
11
16
  const linkContentReviewToEntry = params => {
12
17
  const {
13
18
  apw,
@@ -19,9 +24,11 @@ const linkContentReviewToEntry = params => {
19
24
  const {
20
25
  content
21
26
  } = contentReview;
27
+
22
28
  if (content.type !== _types.ApwContentTypes.CMS_ENTRY) {
23
29
  return;
24
30
  }
31
+
25
32
  const model = await (0, _utils.fetchModel)(cms, content.id, content.settings);
26
33
  await (0, _utils.updateEntryMeta)({
27
34
  cms,
@@ -40,9 +47,11 @@ const linkContentReviewToEntry = params => {
40
47
  const {
41
48
  content
42
49
  } = contentReview;
50
+
43
51
  if (content.type !== _types.ApwContentTypes.CMS_ENTRY) {
44
52
  return;
45
53
  }
54
+
46
55
  const model = await (0, _utils.fetchModel)(cms, content.id, content.settings);
47
56
  await (0, _utils.updateEntryMeta)({
48
57
  cms,
@@ -60,14 +69,19 @@ const linkContentReviewToEntry = params => {
60
69
  model
61
70
  }) => {
62
71
  var _entry$meta, _entry$meta$apw;
72
+
63
73
  if ((0, _utils.isAwpModel)(model)) {
64
74
  return;
65
75
  }
76
+
66
77
  const contentReviewId = (_entry$meta = entry.meta) === null || _entry$meta === void 0 ? void 0 : (_entry$meta$apw = _entry$meta.apw) === null || _entry$meta$apw === void 0 ? void 0 : _entry$meta$apw.contentReviewId;
78
+
67
79
  if (!contentReviewId) {
68
80
  return;
69
81
  }
82
+
70
83
  let contentReview;
84
+
71
85
  try {
72
86
  contentReview = await apw.contentReview.get(contentReviewId);
73
87
  } catch (ex) {
@@ -79,13 +93,16 @@ const linkContentReviewToEntry = params => {
79
93
  throw ex;
80
94
  }
81
95
  }
96
+
82
97
  if (!contentReview) {
83
98
  return;
84
99
  }
100
+
85
101
  throw new _error.default(`Cannot delete the entry because a peer review has been requested. Please delete the review first.`, "CANNOT_DELETE_REVIEW_EXIST", {
86
102
  contentReviewId,
87
103
  entry
88
104
  });
89
105
  });
90
106
  };
107
+
91
108
  exports.linkContentReviewToEntry = linkContentReviewToEntry;
@@ -1 +1 @@
1
- {"version":3,"names":["linkContentReviewToEntry","params","apw","cms","contentReview","onContentReviewAfterCreate","subscribe","content","type","ApwContentTypes","CMS_ENTRY","model","fetchModel","id","settings","updateEntryMeta","meta","contentReviewId","entryId","onContentReviewAfterDelete","onEntryBeforeDelete","entry","isAwpModel","get","ex","code","Error"],"sources":["linkContentReviewToEntry.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow, ApwContentTypes } from \"~/types\";\nimport { fetchModel, isAwpModel, updateEntryMeta } from \"~/plugins/cms/utils\";\nimport Error from \"@webiny/error\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\n\ninterface LinkContentReviewToEntryParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n}\nexport const linkContentReviewToEntry = (params: LinkContentReviewToEntryParams) => {\n const { apw, cms } = params;\n\n apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.CMS_ENTRY) {\n return;\n }\n\n const model = await fetchModel(cms, content.id, content.settings);\n\n await updateEntryMeta({\n cms,\n model,\n meta: {\n apw: {\n contentReviewId: contentReview.id\n }\n },\n entryId: content.id\n });\n });\n\n apw.contentReview.onContentReviewAfterDelete.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n if (content.type !== ApwContentTypes.CMS_ENTRY) {\n return;\n }\n\n const model = await fetchModel(cms, content.id, content.settings);\n\n await updateEntryMeta({\n cms,\n model,\n meta: {\n apw: {\n contentReviewId: null\n }\n },\n entryId: content.id\n });\n });\n\n cms.onEntryBeforeDelete.subscribe(async ({ entry, model }) => {\n if (isAwpModel(model)) {\n return;\n }\n const contentReviewId = entry.meta?.apw?.contentReviewId;\n\n if (!contentReviewId) {\n return;\n }\n let contentReview;\n try {\n contentReview = await apw.contentReview.get(contentReviewId);\n } catch (ex) {\n /**\n * We're handling the case whereby \"contentReviewId\" is still linked to page;\n * even when the contentReview entry has been deleted. In that case, we'll allow page deletion.\n */\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n\n if (!contentReview) {\n return;\n }\n throw new Error(\n `Cannot delete the entry because a peer review has been requested. Please delete the review first.`,\n \"CANNOT_DELETE_REVIEW_EXIST\",\n {\n contentReviewId,\n entry\n }\n );\n });\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAOO,MAAMA,wBAAwB,GAAIC,MAAsC,IAAK;EAChF,MAAM;IAAEC,GAAG;IAAEC;EAAI,CAAC,GAAGF,MAAM;EAE3BC,GAAG,CAACE,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO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oDAAf,gBAAiBe,eAAe;IAExD,IAAI,CAACA,eAAe,EAAE;MAClB;IACJ;IACA,IAAIb,aAAa;IACjB,IAAI;MACAA,aAAa,GAAG,MAAMF,GAAG,CAACE,aAAa,CAACmB,GAAG,CAACN,eAAe,CAAC;IAChE,CAAC,CAAC,OAAOO,EAAE,EAAE;MACT;AACZ;AACA;AACA;MACY,IAAIA,EAAE,CAACC,IAAI,KAAK,WAAW,EAAE;QACzB,MAAMD,EAAE;MACZ;IACJ;IAEA,IAAI,CAACpB,aAAa,EAAE;MAChB;IACJ;IACA,MAAM,IAAIsB,cAAK,CACV,mGAAkG,EACnG,4BAA4B,EAC5B;MACIT,eAAe;MACfI;IACJ,CAAC,CACJ;EACL,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["linkContentReviewToEntry","params","apw","cms","contentReview","onContentReviewAfterCreate","subscribe","content","type","ApwContentTypes","CMS_ENTRY","model","fetchModel","id","settings","updateEntryMeta","meta","contentReviewId","entryId","onContentReviewAfterDelete","onEntryBeforeDelete","entry","isAwpModel","get","ex","code","Error"],"sources":["linkContentReviewToEntry.ts"],"sourcesContent":["import { AdvancedPublishingWorkflow, ApwContentTypes } from \"~/types\";\nimport { fetchModel, isAwpModel, updateEntryMeta } from \"~/plugins/cms/utils\";\nimport Error from \"@webiny/error\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\n\ninterface LinkContentReviewToEntryParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n}\nexport const linkContentReviewToEntry = (params: LinkContentReviewToEntryParams) => {\n const { apw, cms } = params;\n\n apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.CMS_ENTRY) {\n return;\n }\n\n const model = await fetchModel(cms, content.id, content.settings);\n\n await updateEntryMeta({\n cms,\n model,\n meta: {\n apw: {\n contentReviewId: contentReview.id\n }\n },\n entryId: content.id\n });\n });\n\n apw.contentReview.onContentReviewAfterDelete.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n if (content.type !== ApwContentTypes.CMS_ENTRY) {\n return;\n }\n\n const model = await fetchModel(cms, content.id, content.settings);\n\n await updateEntryMeta({\n cms,\n model,\n meta: {\n apw: {\n contentReviewId: null\n }\n },\n entryId: content.id\n });\n });\n\n cms.onEntryBeforeDelete.subscribe(async ({ entry, model }) => {\n if (isAwpModel(model)) {\n return;\n }\n const contentReviewId = entry.meta?.apw?.contentReviewId;\n\n if (!contentReviewId) {\n return;\n }\n let contentReview;\n try {\n contentReview = await apw.contentReview.get(contentReviewId);\n } catch (ex) {\n /**\n * We're handling the case whereby \"contentReviewId\" is still linked to page;\n * even when the contentReview entry has been deleted. In that case, we'll allow page deletion.\n */\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n\n if (!contentReview) {\n return;\n }\n throw new Error(\n `Cannot delete the entry because a peer review has been requested. Please delete the review first.`,\n \"CANNOT_DELETE_REVIEW_EXIST\",\n {\n contentReviewId,\n entry\n }\n );\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAOO,MAAMA,wBAAwB,GAAIC,MAAD,IAA4C;EAChF,MAAM;IAAEC,GAAF;IAAOC;EAAP,IAAeF,MAArB;EAEAC,GAAG,CAACE,aAAJ,CAAkBC,0BAAlB,CAA6CC,SAA7C,CAAuD,OAAO;IAAEF;EAAF,CAAP,KAA6B;IAChF,MAAM;MAAEG;IAAF,IAAcH,aAApB;;IAEA,IAAIG,OAAO,CAACC,IAAR,KAAiBC,sBAAA,CAAgBC,SAArC,EAAgD;MAC5C;IACH;;IAED,MAAMC,KAAK,GAAG,MAAM,IAAAC,iBAAA,EAAWT,GAAX,EAAgBI,OAAO,CAACM,EAAxB,EAA4BN,OAAO,CAACO,QAApC,CAApB;IAEA,MAAM,IAAAC,sBAAA,EAAgB;MAClBZ,GADkB;MAElBQ,KAFkB;MAGlBK,IAAI,EAAE;QACFd,GAAG,EAA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pB,aAAL,EAAoB;MAChB;IACH;;IACD,MAAM,IAAIsB,cAAJ,CACD,mGADC,EAEF,4BAFE,EAGF;MACIT,eADJ;MAEII;IAFJ,CAHE,CAAN;EAQH,CAjCD;AAkCH,CA9EM"}
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.linkWorkflowToEntry = void 0;
9
+
8
10
  var _set = _interopRequireDefault(require("lodash/set"));
11
+
9
12
  var _utils = require("./utils");
13
+
10
14
  const linkWorkflowToEntry = params => {
11
15
  const {
12
16
  apw,
@@ -19,6 +23,7 @@ const linkWorkflowToEntry = params => {
19
23
  if ((0, _utils.isAwpModel)(model)) {
20
24
  return;
21
25
  }
26
+
22
27
  await (0, _utils.assignWorkflowToEntry)({
23
28
  apw,
24
29
  entry
@@ -30,6 +35,7 @@ const linkWorkflowToEntry = params => {
30
35
  model
31
36
  }) => {
32
37
  var _original$meta, _original$meta$apw, _original$meta2, _original$meta2$apw;
38
+
33
39
  if ((0, _utils.isAwpModel)(model)) {
34
40
  return;
35
41
  }
@@ -37,22 +43,29 @@ const linkWorkflowToEntry = params => {
37
43
  * If the previous revision(original) already had the "contentReviewId",
38
44
  * we need to unlink it so that new "contentReview" can be request for the new revision.
39
45
  */
46
+
47
+
40
48
  const previousContentReviewId = (_original$meta = original.meta) === null || _original$meta === void 0 ? void 0 : (_original$meta$apw = _original$meta.apw) === null || _original$meta$apw === void 0 ? void 0 : _original$meta$apw.contentReviewId;
49
+
41
50
  if (previousContentReviewId) {
42
51
  entry.meta = (0, _set.default)(entry.meta || {}, "apw.contentReviewId", null);
43
52
  }
44
-
45
53
  /**
46
54
  * If the previous revision(original) already had the "workflowId",
47
55
  * we don't need to do anything we'll just let it be copied over.
48
56
  */
57
+
58
+
49
59
  const previousWorkflowId = (_original$meta2 = original.meta) === null || _original$meta2 === void 0 ? void 0 : (_original$meta2$apw = _original$meta2.apw) === null || _original$meta2$apw === void 0 ? void 0 : _original$meta2$apw.workflowId;
60
+
50
61
  if (previousWorkflowId) {
51
62
  return;
52
63
  }
53
64
  /**
54
65
  * Lookup and assign "workflowId".
55
66
  */
67
+
68
+
56
69
  await (0, _utils.assignWorkflowToEntry)({
57
70
  apw,
58
71
  entry
@@ -64,9 +77,11 @@ const linkWorkflowToEntry = params => {
64
77
  model
65
78
  }) => {
66
79
  var _original$meta3, _original$meta3$apw, _entry$meta, _entry$meta$apw, _entry$meta2, _entry$meta2$apw;
80
+
67
81
  if ((0, _utils.isAwpModel)(model)) {
68
82
  return;
69
83
  }
84
+
70
85
  const prevApwWorkflowId = (_original$meta3 = original.meta) === null || _original$meta3 === void 0 ? void 0 : (_original$meta3$apw = _original$meta3.apw) === null || _original$meta3$apw === void 0 ? void 0 : _original$meta3$apw.workflowId;
71
86
  const currentApwWorkflowId = (_entry$meta = entry.meta) === null || _entry$meta === void 0 ? void 0 : (_entry$meta$apw = _entry$meta.apw) === null || _entry$meta$apw === void 0 ? void 0 : _entry$meta$apw.workflowId;
72
87
  /**
@@ -74,6 +89,7 @@ const linkWorkflowToEntry = params => {
74
89
  * It can happen because we run modal validation in "onBeforePageUpdate" event,
75
90
  * which doesn't have the "apw" property.
76
91
  */
92
+
77
93
  if (prevApwWorkflowId && !currentApwWorkflowId) {
78
94
  entry.meta = (0, _set.default)(entry.meta || {}, "apw", (original.meta || {}).apw || {});
79
95
  }
@@ -81,46 +97,58 @@ const linkWorkflowToEntry = params => {
81
97
  * If there is a linked "contentReview" for this page and the page "title" has changed.
82
98
  * Let's update the "title" field in "contentReview".
83
99
  */
100
+
101
+
84
102
  const linkedContentReviewId = (_entry$meta2 = entry.meta) === null || _entry$meta2 === void 0 ? void 0 : (_entry$meta2$apw = _entry$meta2.apw) === null || _entry$meta2$apw === void 0 ? void 0 : _entry$meta2$apw.contentReviewId;
85
103
  const prevTitle = (0, _utils.getEntryTitle)(model, original);
86
104
  const newTitle = (0, _utils.getEntryTitle)(model, entry);
105
+
87
106
  if (!linkedContentReviewId || prevTitle === newTitle) {
88
107
  return;
89
108
  }
109
+
90
110
  await apw.contentReview.update(linkedContentReviewId, {
91
111
  title: newTitle
92
112
  });
93
113
  });
94
-
95
114
  /**
96
115
  * Link created workflow to associated entries.
97
116
  */
117
+
98
118
  apw.workflow.onWorkflowAfterCreate.subscribe(async ({
99
119
  workflow
100
120
  }) => {
101
121
  var _scope$data;
122
+
102
123
  const {
103
124
  scope
104
125
  } = workflow;
105
126
  /**
106
127
  * If the workflow has entries in it's scope, we'll link that workflow for each of those entries.
107
128
  */
129
+
108
130
  if ((0, _utils.hasEntries)(workflow) === false) {
109
131
  return;
110
132
  }
133
+
111
134
  const models = await cms.listModels();
112
135
  const values = (_scope$data = scope.data) === null || _scope$data === void 0 ? void 0 : _scope$data.entries;
136
+
113
137
  if (!values || Array.isArray(values) === false || values.length === 0) {
114
138
  return;
115
139
  }
140
+
116
141
  for (const value of values) {
117
142
  if (!value || !value.modelId || !value.id) {
118
143
  continue;
119
144
  }
145
+
120
146
  const model = models.find(m => m.modelId === value.modelId);
147
+
121
148
  if (!model) {
122
149
  continue;
123
150
  }
151
+
124
152
  await (0, _utils.updateEntryMeta)({
125
153
  cms,
126
154
  model,
@@ -134,4 +162,5 @@ const linkWorkflowToEntry = params => {
134
162
  }
135
163
  });
136
164
  };
165
+
137
166
  exports.linkWorkflowToEntry = linkWorkflowToEntry;
@@ -1 +1 @@
1
- {"version":3,"names":["linkWorkflowToEntry","params","apw","cms","onEntryBeforeCreate","subscribe","entry","model","isAwpModel","assignWorkflowToEntry","onEntryRevisionBeforeCreate","original","previousContentReviewId","meta","contentReviewId","set","previousWorkflowId","workflowId","onEntryBeforeUpdate","prevApwWorkflowId","currentApwWorkflowId","linkedContentReviewId","prevTitle","getEntryTitle","newTitle","contentReview","update","title","workflow","onWorkflowAfterCreate","scope","hasEntries","models","listModels","values","data","entries","Array","isArray","length","value","modelId","id","find","m","updateEntryMeta","entryId"],"sources":["linkWorkflowToEntry.ts"],"sourcesContent":["import set from \"lodash/set\";\nimport { AdvancedPublishingWorkflow } from \"~/types\";\nimport {\n assignWorkflowToEntry,\n getEntryTitle,\n hasEntries,\n isAwpModel,\n updateEntryMeta\n} from \"~/plugins/cms/utils\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\n\ninterface Value {\n id: string;\n modelId: string;\n}\n\ninterface LinkWorkflowToEntryParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n}\nexport const linkWorkflowToEntry = (params: LinkWorkflowToEntryParams) => {\n const { apw, cms } = params;\n\n cms.onEntryBeforeCreate.subscribe(async ({ entry, model }) => {\n if (isAwpModel(model)) {\n return;\n }\n await assignWorkflowToEntry({\n apw,\n entry\n });\n });\n\n cms.onEntryRevisionBeforeCreate.subscribe(async ({ entry, original, model }) => {\n if (isAwpModel(model)) {\n return;\n }\n /**\n * If the previous revision(original) already had the \"contentReviewId\",\n * we need to unlink it so that new \"contentReview\" can be request for the new revision.\n */\n const previousContentReviewId = original.meta?.apw?.contentReviewId;\n if (previousContentReviewId) {\n entry.meta = set(entry.meta || {}, \"apw.contentReviewId\", null);\n }\n\n /**\n * If the previous revision(original) already had the \"workflowId\",\n * we don't need to do anything we'll just let it be copied over.\n */\n const previousWorkflowId = original.meta?.apw?.workflowId;\n if (previousWorkflowId) {\n return;\n }\n /**\n * Lookup and assign \"workflowId\".\n */\n await assignWorkflowToEntry({\n apw,\n entry\n });\n });\n\n cms.onEntryBeforeUpdate.subscribe(async ({ entry, original, model }) => {\n if (isAwpModel(model)) {\n return;\n }\n const prevApwWorkflowId = original.meta?.apw?.workflowId;\n const currentApwWorkflowId = entry.meta?.apw?.workflowId;\n /**\n * Make sure the apw property doesn't get lost between updates.\n * It can happen because we run modal validation in \"onBeforePageUpdate\" event,\n * which doesn't have the \"apw\" property.\n */\n if (prevApwWorkflowId && !currentApwWorkflowId) {\n entry.meta = set(entry.meta || {}, \"apw\", (original.meta || {}).apw || {});\n }\n /*\n * If there is a linked \"contentReview\" for this page and the page \"title\" has changed.\n * Let's update the \"title\" field in \"contentReview\".\n */\n const linkedContentReviewId = entry.meta?.apw?.contentReviewId;\n const prevTitle = getEntryTitle(model, original);\n const newTitle = getEntryTitle(model, entry);\n\n if (!linkedContentReviewId || prevTitle === newTitle) {\n return;\n }\n await apw.contentReview.update(linkedContentReviewId, {\n title: newTitle\n });\n });\n\n /**\n * Link created workflow to associated entries.\n */\n apw.workflow.onWorkflowAfterCreate.subscribe(async ({ workflow }) => {\n const { scope } = workflow;\n /**\n * If the workflow has entries in it's scope, we'll link that workflow for each of those entries.\n */\n if (hasEntries(workflow) === false) {\n return;\n }\n\n const models = await cms.listModels();\n\n const values: Value[] | undefined = scope.data?.entries;\n if (!values || Array.isArray(values) === false || values.length === 0) {\n return;\n }\n\n for (const value of values) {\n if (!value || !value.modelId || !value.id) {\n continue;\n }\n const model = models.find(m => m.modelId === value.modelId);\n if (!model) {\n continue;\n }\n await updateEntryMeta({\n cms,\n model,\n entryId: value.id,\n meta: {\n apw: {\n workflowId: workflow.id\n }\n }\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AAEA;AAkBO,MAAMA,mBAAmB,GAAIC,MAAiC,IAAK;EACtE,MAAM;IAAEC,GAAG;IAAEC;EAAI,CAAC,GAAGF,MAAM;EAE3BE,GAAG,CAACC,mBAAmB,CAACC,SAAS,CAAC,OAAO;IAAEC,KAAK;IAAEC;EAAM,CAAC,KAAK;IAC1D,IAAI,IAAAC,iBAAU,EAACD,KAAK,CAAC,EAAE;MACnB;IACJ;IACA,MAAM,IAAAE,4BAAqB,EAAC;MACxBP,GAAG;MACHI;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFH,GAAG,CAACO,2BAA2B,CAACL,SAAS,CAAC,OAAO;IAAEC,KAAK;IAAEK,QAAQ;IAAEJ;EAAM,CAAC,KAAK;IAAA;IAC5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,KAAK,EAAE;QACR;MACJ;MACA,MAAM,IAAAsC,sBAAe,EAAC;QAClB1C,GAAG;QACHI,KAAK;QACLuC,OAAO,EAAEN,KAAK,CAACE,EAAE;QACjB7B,IAAI,EAAE;UACFX,GAAG,EAAE;YACDe,UAAU,EAAEW,QAAQ,CAACc;UACzB;QACJ;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
1
+ {"version":3,"names":["linkWorkflowToEntry","params","apw","cms","onEntryBeforeCreate","subscribe","entry","model","isAwpModel","assignWorkflowToEntry","onEntryRevisionBeforeCreate","original","previousContentReviewId","meta","contentReviewId","set","previousWorkflowId","workflowId","onEntryBeforeUpdate","prevApwWorkflowId","currentApwWorkflowId","linkedContentReviewId","prevTitle","getEntryTitle","newTitle","contentReview","update","title","workflow","onWorkflowAfterCreate","scope","hasEntries","models","listModels","values","data","entries","Array","isArray","length","value","modelId","id","find","m","updateEntryMeta","entryId"],"sources":["linkWorkflowToEntry.ts"],"sourcesContent":["import set from \"lodash/set\";\nimport { AdvancedPublishingWorkflow } from \"~/types\";\nimport {\n assignWorkflowToEntry,\n getEntryTitle,\n hasEntries,\n isAwpModel,\n updateEntryMeta\n} from \"~/plugins/cms/utils\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/types\";\n\ninterface Value {\n id: string;\n modelId: string;\n}\n\ninterface LinkWorkflowToEntryParams {\n apw: AdvancedPublishingWorkflow;\n cms: HeadlessCms;\n}\nexport const linkWorkflowToEntry = (params: LinkWorkflowToEntryParams) => {\n const { apw, cms } = params;\n\n cms.onEntryBeforeCreate.subscribe(async ({ entry, model }) => {\n if (isAwpModel(model)) {\n return;\n }\n await assignWorkflowToEntry({\n apw,\n entry\n });\n });\n\n cms.onEntryRevisionBeforeCreate.subscribe(async ({ entry, original, model }) => {\n if (isAwpModel(model)) {\n return;\n }\n /**\n * If the previous revision(original) already had the \"contentReviewId\",\n * we need to unlink it so that new \"contentReview\" can be request for the new revision.\n */\n const previousContentReviewId = original.meta?.apw?.contentReviewId;\n if (previousContentReviewId) {\n entry.meta = set(entry.meta || {}, \"apw.contentReviewId\", null);\n }\n\n /**\n * If the previous revision(original) already had the \"workflowId\",\n * we don't need to do anything we'll just let it be copied over.\n */\n const previousWorkflowId = original.meta?.apw?.workflowId;\n if (previousWorkflowId) {\n return;\n }\n /**\n * Lookup and assign \"workflowId\".\n */\n await assignWorkflowToEntry({\n apw,\n entry\n });\n });\n\n cms.onEntryBeforeUpdate.subscribe(async ({ entry, original, model }) => {\n if (isAwpModel(model)) {\n return;\n }\n const prevApwWorkflowId = original.meta?.apw?.workflowId;\n const currentApwWorkflowId = entry.meta?.apw?.workflowId;\n /**\n * Make sure the apw property doesn't get lost between updates.\n * It can happen because we run modal validation in \"onBeforePageUpdate\" event,\n * which doesn't have the \"apw\" property.\n */\n if (prevApwWorkflowId && !currentApwWorkflowId) {\n entry.meta = set(entry.meta || {}, \"apw\", (original.meta || {}).apw || {});\n }\n /*\n * If there is a linked \"contentReview\" for this page and the page \"title\" has changed.\n * Let's update the \"title\" field in \"contentReview\".\n */\n const linkedContentReviewId = entry.meta?.apw?.contentReviewId;\n const prevTitle = getEntryTitle(model, original);\n const newTitle = getEntryTitle(model, entry);\n\n if (!linkedContentReviewId || prevTitle === newTitle) {\n return;\n }\n await apw.contentReview.update(linkedContentReviewId, {\n title: newTitle\n });\n });\n\n /**\n * Link created workflow to associated entries.\n */\n apw.workflow.onWorkflowAfterCreate.subscribe(async ({ workflow }) => {\n const { scope } = workflow;\n /**\n * If the workflow has entries in it's scope, we'll link that workflow for each of those entries.\n */\n if (hasEntries(workflow) === false) {\n return;\n }\n\n const models = await cms.listModels();\n\n const values: Value[] | undefined = scope.data?.entries;\n if (!values || Array.isArray(values) === false || values.length === 0) {\n return;\n }\n\n for (const value of values) {\n if (!value || !value.modelId || !value.id) {\n continue;\n }\n const model = models.find(m => m.modelId === value.modelId);\n if (!model) {\n continue;\n }\n await updateEntryMeta({\n cms,\n model,\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AA,EAAWH,QAAX,MAAyB,KAA7B,EAAoC;MAChC;IACH;;IAED,MAAMI,MAAM,GAAG,MAAM7B,GAAG,CAAC8B,UAAJ,EAArB;IAEA,MAAMC,MAA2B,kBAAGJ,KAAK,CAACK,IAAT,gDAAG,YAAYC,OAAhD;;IACA,IAAI,CAACF,MAAD,IAAWG,KAAK,CAACC,OAAN,CAAcJ,MAAd,MAA0B,KAArC,IAA8CA,MAAM,CAACK,MAAP,KAAkB,CAApE,EAAuE;MACnE;IACH;;IAED,KAAK,MAAMC,KAAX,IAAoBN,MAApB,EAA4B;MACxB,IAAI,CAACM,KAAD,IAAU,CAACA,KAAK,CAACC,OAAjB,IAA4B,CAACD,KAAK,CAACE,EAAvC,EAA2C;QACvC;MACH;;MACD,MAAMnC,KAAK,GAAGyB,MAAM,CAACW,IAAP,CAAYC,CAAC,IAAIA,CAAC,CAACH,OAAF,KAAcD,KAAK,CAACC,OAArC,CAAd;;MACA,IAAI,CAAClC,KAAL,EAAY;QACR;MACH;;MACD,MAAM,IAAAsC,sBAAA,EAAgB;QAClB1C,GADkB;QAElBI,KAFkB;QAGlBuC,OAAO,EAAEN,KAAK,CAACE,EAHG;QAIlB7B,IAAI,EAAE;UACFX,GAAG,EAAE;YACDe,UAAU,EAAEW,QAAQ,CAACc;UADpB;QADH;MAJY,CAAhB,CAAN;IAUH;EACJ,CAnCD;AAoCH,CAhHM"}
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createChangeRequestNotification = void 0;
7
+
7
8
  var _types = require("../../../types");
9
+
8
10
  var _ApwChangeRequestNotification = require("../../../ApwChangeRequestNotification");
11
+
9
12
  const createChangeRequestNotification = () => {
10
13
  const plugin = (0, _ApwChangeRequestNotification.createApwChangeRequestNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
11
14
  const {
@@ -28,4 +31,5 @@ const createChangeRequestNotification = () => {
28
31
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
29
32
  return plugin;
30
33
  };
34
+
31
35
  exports.createChangeRequestNotification = createChangeRequestNotification;
@@ -1 +1 @@
1
- {"version":3,"names":["createChangeRequestNotification","plugin","createApwChangeRequestNotification","ApwContentTypes","CMS_ENTRY","params","changeRequestUrl","contentUrl","text","name","type"],"sources":["changeRequestNotification.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { createApwChangeRequestNotification } from \"~/ApwChangeRequestNotification\";\n\nexport const createChangeRequestNotification = () => {\n const plugin = createApwChangeRequestNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { changeRequestUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${changeRequestUrl}\">change request</a>, for <a href=\"${contentUrl}\">this</a> content entry.<br /><br />\n \n Here are the full URLs:<br /><br />\n \n Change Request: ${changeRequestUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA;AACA;AAEO,MAAMA,+BAA+B,GAAG,MAAM;EACjD,MAAMC,MAAM,GAAG,IAAAC,gEAAkC,EAACC,sBAAe,CAACC,SAAS,EAAEC,MAAM,IAAI;IACnF,MAAM;MAAEC,gBAAgB;MAAEC;IAAW,CAAC,GAAGF,MAAM;IAE/C,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,gBAAiB,sCAAqCC,UAAW;AAChH;AACA;AACA;AACA,kCAAkCD,gBAAiB;AACnD,iCAAiCC,UAAW;AAC5C;IACQ,CAAC;EACL,CAAC,CAAC;EAEFN,MAAM,CAACQ,IAAI,GAAI,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAe,CAACC,SAAU,UAAS;EAEnE,OAAOH,MAAM;AACjB,CAAC;AAAC"}
1
+ {"version":3,"names":["createChangeRequestNotification","plugin","createApwChangeRequestNotification","ApwContentTypes","CMS_ENTRY","params","changeRequestUrl","contentUrl","text","name","type"],"sources":["changeRequestNotification.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { createApwChangeRequestNotification } from \"~/ApwChangeRequestNotification\";\n\nexport const createChangeRequestNotification = () => {\n const plugin = createApwChangeRequestNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { changeRequestUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${changeRequestUrl}\">change request</a>, for <a href=\"${contentUrl}\">this</a> content entry.<br /><br />\n \n Here are the full URLs:<br /><br />\n \n Change Request: ${changeRequestUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,+BAA+B,GAAG,MAAM;EACjD,MAAMC,MAAM,GAAG,IAAAC,gEAAA,EAAmCC,sBAAA,CAAgBC,SAAnD,EAA8DC,MAAM,IAAI;IACnF,MAAM;MAAEC,gBAAF;MAAoBC;IAApB,IAAmCF,MAAzC;IAEA,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,gBAAiB,sCAAqCC,UAAW;AAChH;AACA;AACA;AACA,kCAAkCD,gBAAiB;AACnD,iCAAiCC,UAAW;AAC5C;IAVe,CAAP;EAYH,CAfc,CAAf;EAiBAN,MAAM,CAACQ,IAAP,GAAe,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAA,CAAgBC,SAAU,UAA1D;EAEA,OAAOH,MAAP;AACH,CArBM"}
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createCommentNotification = void 0;
7
+
7
8
  var _ApwCommentNotification = require("../../../ApwCommentNotification");
9
+
8
10
  var _types = require("../../../types");
11
+
9
12
  const createCommentNotification = () => {
10
13
  const plugin = (0, _ApwCommentNotification.createApwCommentNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
11
14
  const {
@@ -28,4 +31,5 @@ const createCommentNotification = () => {
28
31
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
29
32
  return plugin;
30
33
  };
34
+
31
35
  exports.createCommentNotification = createCommentNotification;
@@ -1 +1 @@
1
- {"version":3,"names":["createCommentNotification","plugin","createApwCommentNotification","ApwContentTypes","CMS_ENTRY","params","commentUrl","contentUrl","text","name","type"],"sources":["commentNotification.ts"],"sourcesContent":["import { createApwCommentNotification } from \"~/ApwCommentNotification\";\nimport { ApwContentTypes } from \"~/types\";\n\nexport const createCommentNotification = () => {\n const plugin = createApwCommentNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { commentUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${commentUrl}\">comment</a>, on a change request, for <a href=\"${contentUrl}\">this</a> content entry.<br />\n \n Here are the full URLs:<br /><br />\n \n Comment: ${commentUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA;AACA;AAEO,MAAMA,yBAAyB,GAAG,MAAM;EAC3C,MAAMC,MAAM,GAAG,IAAAC,oDAA4B,EAACC,sBAAe,CAACC,SAAS,EAAEC,MAAM,IAAI;IAC7E,MAAM;MAAEC,UAAU;MAAEC;IAAW,CAAC,GAAGF,MAAM;IAEzC,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,UAAW,oDAAmDC,UAAW;AACxH;AACA;AACA;AACA,2BAA2BD,UAAW;AACtC,iCAAiCC,UAAW;AAC5C;IACQ,CAAC;EACL,CAAC,CAAC;EAEFN,MAAM,CAACQ,IAAI,GAAI,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAe,CAACC,SAAU,UAAS;EAEnE,OAAOH,MAAM;AACjB,CAAC;AAAC"}
1
+ {"version":3,"names":["createCommentNotification","plugin","createApwCommentNotification","ApwContentTypes","CMS_ENTRY","params","commentUrl","contentUrl","text","name","type"],"sources":["commentNotification.ts"],"sourcesContent":["import { createApwCommentNotification } from \"~/ApwCommentNotification\";\nimport { ApwContentTypes } from \"~/types\";\n\nexport const createCommentNotification = () => {\n const plugin = createApwCommentNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { commentUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${commentUrl}\">comment</a>, on a change request, for <a href=\"${contentUrl}\">this</a> content entry.<br />\n \n Here are the full URLs:<br /><br />\n \n Comment: ${commentUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,yBAAyB,GAAG,MAAM;EAC3C,MAAMC,MAAM,GAAG,IAAAC,oDAAA,EAA6BC,sBAAA,CAAgBC,SAA7C,EAAwDC,MAAM,IAAI;IAC7E,MAAM;MAAEC,UAAF;MAAcC;IAAd,IAA6BF,MAAnC;IAEA,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,UAAW,oDAAmDC,UAAW;AACxH;AACA;AACA;AACA,2BAA2BD,UAAW;AACtC,iCAAiCC,UAAW;AAC5C;IAVe,CAAP;EAYH,CAfc,CAAf;EAiBAN,MAAM,CAACQ,IAAP,GAAe,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAA,CAAgBC,SAAU,UAA1D;EAEA,OAAOH,MAAP;AACH,CArBM"}
@@ -4,8 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createContentReviewNotification = void 0;
7
+
7
8
  var _types = require("../../../types");
9
+
8
10
  var _ApwContentReviewNotification = require("../../../ApwContentReviewNotification");
11
+
9
12
  const createContentReviewNotification = () => {
10
13
  const plugin = (0, _ApwContentReviewNotification.createApwContentReviewNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
11
14
  const {
@@ -28,4 +31,5 @@ const createContentReviewNotification = () => {
28
31
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
29
32
  return plugin;
30
33
  };
34
+
31
35
  exports.createContentReviewNotification = createContentReviewNotification;
@@ -1 +1 @@
1
- {"version":3,"names":["createContentReviewNotification","plugin","createApwContentReviewNotification","ApwContentTypes","CMS_ENTRY","params","contentReviewUrl","contentUrl","text","name","type"],"sources":["contentReviewNotification.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { createApwContentReviewNotification } from \"~/ApwContentReviewNotification\";\n\nexport const createContentReviewNotification = () => {\n const plugin = createApwContentReviewNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { contentReviewUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${contentReviewUrl}\">content review</a>, for <a href=\"${contentUrl}\">this</a> content entry.<br />\n \n Here are the full URLs:<br /><br />\n \n Content Review: ${contentReviewUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA;AACA;AAEO,MAAMA,+BAA+B,GAAG,MAAM;EACjD,MAAMC,MAAM,GAAG,IAAAC,gEAAkC,EAACC,sBAAe,CAACC,SAAS,EAAEC,MAAM,IAAI;IACnF,MAAM;MAAEC,gBAAgB;MAAEC;IAAW,CAAC,GAAGF,MAAM;IAE/C,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,gBAAiB,sCAAqCC,UAAW;AAChH;AACA;AACA;AACA,kCAAkCD,gBAAiB;AACnD,iCAAiCC,UAAW;AAC5C;IACQ,CAAC;EACL,CAAC,CAAC;EAEFN,MAAM,CAACQ,IAAI,GAAI,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAe,CAACC,SAAU,UAAS;EAEnE,OAAOH,MAAM;AACjB,CAAC;AAAC"}
1
+ {"version":3,"names":["createContentReviewNotification","plugin","createApwContentReviewNotification","ApwContentTypes","CMS_ENTRY","params","contentReviewUrl","contentUrl","text","name","type"],"sources":["contentReviewNotification.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { createApwContentReviewNotification } from \"~/ApwContentReviewNotification\";\n\nexport const createContentReviewNotification = () => {\n const plugin = createApwContentReviewNotification(ApwContentTypes.CMS_ENTRY, params => {\n const { contentReviewUrl, contentUrl } = params;\n\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${contentReviewUrl}\">content review</a>, for <a href=\"${contentUrl}\">this</a> content entry.<br />\n \n Here are the full URLs:<br /><br />\n \n Content Review: ${contentReviewUrl}<br />\n Content Entry: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.CMS_ENTRY}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,+BAA+B,GAAG,MAAM;EACjD,MAAMC,MAAM,GAAG,IAAAC,gEAAA,EAAmCC,sBAAA,CAAgBC,SAAnD,EAA8DC,MAAM,IAAI;IACnF,MAAM;MAAEC,gBAAF;MAAoBC;IAApB,IAAmCF,MAAzC;IAEA,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,gBAAiB,sCAAqCC,UAAW;AAChH;AACA;AACA;AACA,kCAAkCD,gBAAiB;AACnD,iCAAiCC,UAAW;AAC5C;IAVe,CAAP;EAYH,CAfc,CAAf;EAiBAN,MAAM,CAACQ,IAAP,GAAe,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAA,CAAgBC,SAAU,UAA1D;EAEA,OAAOH,MAAP;AACH,CArBM"}