@webiny/api-apw 5.34.8 → 5.35.0-beta.0

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 (216) 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 +20 -84
  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 +34 -34
  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 +0 -17
  36. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  37. package/plugins/cms/linkWorkflowToEntry.js +2 -31
  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 +0 -14
  48. package/plugins/cms/triggerContentReview.js.map +1 -1
  49. package/plugins/cms/updateContentReviewStatus.js +0 -18
  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 +2 -18
  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 +0 -16
  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 +1 -20
  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 +9 -40
  154. package/scheduler/handlers/executeAction/index.js.map +1 -1
  155. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +0 -7
  156. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  157. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +1 -23
  158. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  159. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +4 -28
  160. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  161. package/scheduler/handlers/executeAction/security.js +0 -11
  162. package/scheduler/handlers/executeAction/security.js.map +1 -1
  163. package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
  164. package/scheduler/handlers/scheduleAction/index.js +5 -25
  165. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  166. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +2 -23
  167. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  168. package/scheduler/handlers/utils.d.ts +1 -2
  169. package/scheduler/handlers/utils.js +3 -41
  170. package/scheduler/handlers/utils.js.map +1 -1
  171. package/scheduler/index.js +0 -3
  172. package/scheduler/index.js.map +1 -1
  173. package/scheduler/types.d.ts +2 -20
  174. package/scheduler/types.js +0 -11
  175. package/scheduler/types.js.map +1 -1
  176. package/storageOperations/changeRequestStorageOperations.js +20 -39
  177. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  178. package/storageOperations/commentStorageOperations.js +23 -44
  179. package/storageOperations/commentStorageOperations.js.map +1 -1
  180. package/storageOperations/contentReviewStorageOperations.js +20 -37
  181. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  182. package/storageOperations/index.js +0 -14
  183. package/storageOperations/index.js.map +1 -1
  184. package/storageOperations/models/changeRequest.model.js +0 -9
  185. package/storageOperations/models/changeRequest.model.js.map +1 -1
  186. package/storageOperations/models/comment.model.js +0 -8
  187. package/storageOperations/models/comment.model.js.map +1 -1
  188. package/storageOperations/models/contentModelPluginFactory.d.ts +3 -10
  189. package/storageOperations/models/contentModelPluginFactory.js +3 -11
  190. package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
  191. package/storageOperations/models/contentReview.model.js +0 -26
  192. package/storageOperations/models/contentReview.model.js.map +1 -1
  193. package/storageOperations/models/index.js +2 -28
  194. package/storageOperations/models/index.js.map +1 -1
  195. package/storageOperations/models/reviewer.model.js +0 -8
  196. package/storageOperations/models/reviewer.model.js.map +1 -1
  197. package/storageOperations/models/utils.js +0 -4
  198. package/storageOperations/models/utils.js.map +1 -1
  199. package/storageOperations/models/workflow.model.js +0 -23
  200. package/storageOperations/models/workflow.model.js.map +1 -1
  201. package/storageOperations/reviewerStorageOperations.js +23 -45
  202. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  203. package/storageOperations/workflowStorageOperations.js +20 -39
  204. package/storageOperations/workflowStorageOperations.js.map +1 -1
  205. package/types.d.ts +6 -5
  206. package/types.js +0 -14
  207. package/types.js.map +1 -1
  208. package/utils/contentApwSettingsPlugin.js +0 -6
  209. package/utils/contentApwSettingsPlugin.js.map +1 -1
  210. package/utils/errors.js +0 -17
  211. package/utils/errors.js.map +1 -1
  212. package/utils/fieldResolver.js +2 -12
  213. package/utils/fieldResolver.js.map +1 -1
  214. package/utils/resolve.d.ts +1 -1
  215. package/utils/resolve.js +0 -3
  216. package/utils/resolve.js.map +1 -1
@@ -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.CmsEntryApwSettingsGetterPlugin = 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 CmsEntryApwSettingsGetterPlugin extends _ContentApwSettingsPlugin.ContentApwSettingsPlugin {
17
12
  canUse(type) {
18
13
  return type === _types.ApwContentTypes.CMS_ENTRY;
19
14
  }
20
-
21
15
  setWorkflowId(entry, id) {
22
16
  entry.meta = (0, _set.default)(entry.meta || {}, "apw.workflowId", id);
23
17
  }
24
-
25
18
  getWorkflowId(entry) {
26
19
  var _entry$meta$apw;
27
-
28
20
  if (!entry.meta) {
29
21
  return null;
30
22
  }
31
-
32
23
  return ((_entry$meta$apw = entry.meta.apw) === null || _entry$meta$apw === void 0 ? void 0 : _entry$meta$apw.workflowId) || null;
33
24
  }
34
-
35
25
  setContentReviewId(entry, id) {
36
26
  entry.meta = (0, _set.default)(entry.meta || {}, "apw.contentReviewId", id);
37
27
  }
38
-
39
28
  getContentReviewId(entry) {
40
29
  var _entry$meta$apw2;
41
-
42
30
  if (!entry.meta) {
43
31
  return null;
44
32
  }
45
-
46
33
  return ((_entry$meta$apw2 = entry.meta.apw) === null || _entry$meta$apw2 === void 0 ? void 0 : _entry$meta$apw2.contentReviewId) || null;
47
34
  }
48
-
49
35
  }
50
-
51
36
  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,+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
+ {"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,18 +1,13 @@
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.apwEntryPlugins = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _types = require("../../types");
13
-
14
10
  var _utils = require("./utils");
15
-
16
11
  const apwEntryPlugins = params => {
17
12
  const {
18
13
  cms,
@@ -21,11 +16,9 @@ const apwEntryPlugins = params => {
21
16
  apw.addContentGetter(_types.ApwContentTypes.CMS_ENTRY, async (id, settings) => {
22
17
  const model = await (0, _utils.fetchModel)(cms, id, settings);
23
18
  const item = await cms.getEntryById(model, id);
24
-
25
19
  if (!item) {
26
20
  return null;
27
21
  }
28
-
29
22
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
30
23
  meta: (0, _objectSpread2.default)({}, item.meta || {}),
31
24
  title: (0, _utils.getEntryTitle)(model, item)
@@ -42,5 +35,4 @@ const apwEntryPlugins = params => {
42
35
  return true;
43
36
  });
44
37
  };
45
-
46
38
  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,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"}
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"}
@@ -4,27 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.apwCmsHooks = void 0;
7
-
8
7
  var _apwEntryPlugins = require("./apwEntryPlugins");
9
-
10
8
  var _linkContentReviewToEntry = require("./linkContentReviewToEntry");
11
-
12
9
  var _linkWorkflowToEntry = require("./linkWorkflowToEntry");
13
-
14
10
  var _triggerContentReview = require("./triggerContentReview");
15
-
16
11
  var _updateContentReviewStatus = require("./updateContentReviewStatus");
17
-
18
12
  var _CmsEntryApwSettingsGetterPlugin = require("./CmsEntryApwSettingsGetterPlugin");
19
-
20
13
  var _commentNotification = require("./notifications/commentNotification");
21
-
22
14
  var _contentUrl = require("./notifications/contentUrl");
23
-
24
15
  var _changeRequestNotification = require("./notifications/changeRequestNotification");
25
-
26
16
  var _contentReviewNotification = require("./notifications/contentReviewNotification");
27
-
28
17
  const apwCmsHooks = params => {
29
18
  /**
30
19
  * We do not need to assign anything if no apw or cms in the context.
@@ -33,7 +22,6 @@ const apwCmsHooks = params => {
33
22
  if (!params.apw || !params.cms) {
34
23
  return;
35
24
  }
36
-
37
25
  params.plugins.register([new _CmsEntryApwSettingsGetterPlugin.CmsEntryApwSettingsGetterPlugin(), (0, _commentNotification.createCommentNotification)(), (0, _changeRequestNotification.createChangeRequestNotification)(), (0, _contentUrl.createContentUrlPlugin)(), (0, _contentReviewNotification.createContentReviewNotification)()]);
38
26
  (0, _apwEntryPlugins.apwEntryPlugins)(params);
39
27
  (0, _linkContentReviewToEntry.linkContentReviewToEntry)(params);
@@ -41,5 +29,4 @@ const apwCmsHooks = params => {
41
29
  (0, _triggerContentReview.triggerContentReview)(params);
42
30
  (0, _updateContentReviewStatus.updateContentReviewStatus)(params);
43
31
  };
44
-
45
32
  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,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
+ {"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,18 +1,13 @@
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.linkContentReviewToEntry = void 0;
9
-
10
8
  var _types = require("../../types");
11
-
12
9
  var _utils = require("./utils");
13
-
14
10
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
11
  const linkContentReviewToEntry = params => {
17
12
  const {
18
13
  apw,
@@ -24,11 +19,9 @@ const linkContentReviewToEntry = params => {
24
19
  const {
25
20
  content
26
21
  } = contentReview;
27
-
28
22
  if (content.type !== _types.ApwContentTypes.CMS_ENTRY) {
29
23
  return;
30
24
  }
31
-
32
25
  const model = await (0, _utils.fetchModel)(cms, content.id, content.settings);
33
26
  await (0, _utils.updateEntryMeta)({
34
27
  cms,
@@ -47,11 +40,9 @@ const linkContentReviewToEntry = params => {
47
40
  const {
48
41
  content
49
42
  } = contentReview;
50
-
51
43
  if (content.type !== _types.ApwContentTypes.CMS_ENTRY) {
52
44
  return;
53
45
  }
54
-
55
46
  const model = await (0, _utils.fetchModel)(cms, content.id, content.settings);
56
47
  await (0, _utils.updateEntryMeta)({
57
48
  cms,
@@ -69,19 +60,14 @@ const linkContentReviewToEntry = params => {
69
60
  model
70
61
  }) => {
71
62
  var _entry$meta, _entry$meta$apw;
72
-
73
63
  if ((0, _utils.isAwpModel)(model)) {
74
64
  return;
75
65
  }
76
-
77
66
  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
-
79
67
  if (!contentReviewId) {
80
68
  return;
81
69
  }
82
-
83
70
  let contentReview;
84
-
85
71
  try {
86
72
  contentReview = await apw.contentReview.get(contentReviewId);
87
73
  } catch (ex) {
@@ -93,16 +79,13 @@ const linkContentReviewToEntry = params => {
93
79
  throw ex;
94
80
  }
95
81
  }
96
-
97
82
  if (!contentReview) {
98
83
  return;
99
84
  }
100
-
101
85
  throw new _error.default(`Cannot delete the entry because a peer review has been requested. Please delete the review first.`, "CANNOT_DELETE_REVIEW_EXIST", {
102
86
  contentReviewId,
103
87
  entry
104
88
  });
105
89
  });
106
90
  };
107
-
108
91
  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_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EX,OAAO,CAACM;IARC,CAAhB,CAAN;EAUH,CAlBD;EAoBAV,GAAG,CAACiB,mBAAJ,CAAwBd,SAAxB,CAAkC,OAAO;IAAEe,KAAF;IAASV;EAAT,CAAP,KAA4B;IAAA;;IAC1D,IAAI,IAAAW,iBAAA,EAAWX,KAAX,CAAJ,EAAuB;MACnB;IACH;;IACD,MAAMM,eAAe,kBAAGI,KAAK,CAACL,IAAT,mEAAG,YAAYd,GAAf,oDAAG,gBAAiBe,eAAzC;;IAEA,IAAI,CAACA,eAAL,EAAsB;MAClB;IACH;;IACD,IAAIb,aAAJ;;IACA,IAAI;MACAA,aAAa,GAAG,MAAMF,GAAG,CAACE,aAAJ,CAAkBmB,GAAlB,CAAsBN,eAAtB,CAAtB;IACH,CAFD,CAEE,OAAOO,EAAP,EAAW;MACT;AACZ;AACA;AACA;MACY,IAAIA,EAAE,CAACC,IAAH,KAAY,WAAhB,EAA6B;QACzB,MAAMD,EAAN;MACH;IACJ;;IAED,IAAI,CAACpB,aAAL,EAAoB;MAChB;IACH;;IACD,MAAM,IAAIsB,cAAJ,CACD,mGADC,EAEF,4BAFE,EAGF;MACIT,eADJ;MAEII;IAFJ,CAHE,CAAN;EAQH,CAjCD;AAkCH,CA9EM"}
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;IAAEF;EAAc,CAAC,KAAK;IAChF,MAAM;MAAEG;IAAQ,CAAC,GAAGH,aAAa;IAEjC,IAA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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,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.linkWorkflowToEntry = void 0;
9
-
10
8
  var _set = _interopRequireDefault(require("lodash/set"));
11
-
12
9
  var _utils = require("./utils");
13
-
14
10
  const linkWorkflowToEntry = params => {
15
11
  const {
16
12
  apw,
@@ -23,7 +19,6 @@ const linkWorkflowToEntry = params => {
23
19
  if ((0, _utils.isAwpModel)(model)) {
24
20
  return;
25
21
  }
26
-
27
22
  await (0, _utils.assignWorkflowToEntry)({
28
23
  apw,
29
24
  entry
@@ -35,7 +30,6 @@ const linkWorkflowToEntry = params => {
35
30
  model
36
31
  }) => {
37
32
  var _original$meta, _original$meta$apw, _original$meta2, _original$meta2$apw;
38
-
39
33
  if ((0, _utils.isAwpModel)(model)) {
40
34
  return;
41
35
  }
@@ -43,29 +37,22 @@ const linkWorkflowToEntry = params => {
43
37
  * If the previous revision(original) already had the "contentReviewId",
44
38
  * we need to unlink it so that new "contentReview" can be request for the new revision.
45
39
  */
46
-
47
-
48
40
  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
-
50
41
  if (previousContentReviewId) {
51
42
  entry.meta = (0, _set.default)(entry.meta || {}, "apw.contentReviewId", null);
52
43
  }
44
+
53
45
  /**
54
46
  * If the previous revision(original) already had the "workflowId",
55
47
  * we don't need to do anything we'll just let it be copied over.
56
48
  */
57
-
58
-
59
49
  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
-
61
50
  if (previousWorkflowId) {
62
51
  return;
63
52
  }
64
53
  /**
65
54
  * Lookup and assign "workflowId".
66
55
  */
67
-
68
-
69
56
  await (0, _utils.assignWorkflowToEntry)({
70
57
  apw,
71
58
  entry
@@ -77,11 +64,9 @@ const linkWorkflowToEntry = params => {
77
64
  model
78
65
  }) => {
79
66
  var _original$meta3, _original$meta3$apw, _entry$meta, _entry$meta$apw, _entry$meta2, _entry$meta2$apw;
80
-
81
67
  if ((0, _utils.isAwpModel)(model)) {
82
68
  return;
83
69
  }
84
-
85
70
  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;
86
71
  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;
87
72
  /**
@@ -89,7 +74,6 @@ const linkWorkflowToEntry = params => {
89
74
  * It can happen because we run modal validation in "onBeforePageUpdate" event,
90
75
  * which doesn't have the "apw" property.
91
76
  */
92
-
93
77
  if (prevApwWorkflowId && !currentApwWorkflowId) {
94
78
  entry.meta = (0, _set.default)(entry.meta || {}, "apw", (original.meta || {}).apw || {});
95
79
  }
@@ -97,58 +81,46 @@ const linkWorkflowToEntry = params => {
97
81
  * If there is a linked "contentReview" for this page and the page "title" has changed.
98
82
  * Let's update the "title" field in "contentReview".
99
83
  */
100
-
101
-
102
84
  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;
103
85
  const prevTitle = (0, _utils.getEntryTitle)(model, original);
104
86
  const newTitle = (0, _utils.getEntryTitle)(model, entry);
105
-
106
87
  if (!linkedContentReviewId || prevTitle === newTitle) {
107
88
  return;
108
89
  }
109
-
110
90
  await apw.contentReview.update(linkedContentReviewId, {
111
91
  title: newTitle
112
92
  });
113
93
  });
94
+
114
95
  /**
115
96
  * Link created workflow to associated entries.
116
97
  */
117
-
118
98
  apw.workflow.onWorkflowAfterCreate.subscribe(async ({
119
99
  workflow
120
100
  }) => {
121
101
  var _scope$data;
122
-
123
102
  const {
124
103
  scope
125
104
  } = workflow;
126
105
  /**
127
106
  * If the workflow has entries in it's scope, we'll link that workflow for each of those entries.
128
107
  */
129
-
130
108
  if ((0, _utils.hasEntries)(workflow) === false) {
131
109
  return;
132
110
  }
133
-
134
111
  const models = await cms.listModels();
135
112
  const values = (_scope$data = scope.data) === null || _scope$data === void 0 ? void 0 : _scope$data.entries;
136
-
137
113
  if (!values || Array.isArray(values) === false || values.length === 0) {
138
114
  return;
139
115
  }
140
-
141
116
  for (const value of values) {
142
117
  if (!value || !value.modelId || !value.id) {
143
118
  continue;
144
119
  }
145
-
146
120
  const model = models.find(m => m.modelId === value.modelId);
147
-
148
121
  if (!model) {
149
122
  continue;
150
123
  }
151
-
152
124
  await (0, _utils.updateEntryMeta)({
153
125
  cms,
154
126
  model,
@@ -162,5 +134,4 @@ const linkWorkflowToEntry = params => {
162
134
  }
163
135
  });
164
136
  };
165
-
166
137
  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,MAAD,IAAuC;EACtE,MAAM;IAAEC,GAAF;IAAOC;EAAP,IAAeF,MAArB;EAEAE,GAAG,CAACC,mBAAJ,CAAwBC,SAAxB,CAAkC,OAAO;IAAEC,KAAF;IAASC;EAAT,CAAP,KAA4B;IAC1D,IAAI,IAAA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ACnE;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"}
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;IAC5E,IAAI,IAAAC,iBAAU,EAACD,KAAK,CAAC,EAAE;MACnB;IACJ;IACA;AACR;AACA;AACA;IACQ,MAAMK,uBAAuB,qBAAGD,QAAQ,CAACE,IAAI,yEAAb,eAAeX,GAAG,uDAAlB,mBAAoBY,eAAe;IACnE,IAAIF,uBAAuB,EAAE;MACzBN,KAAK,CAACO,IAAI,GAAG,IAAAE,YAAG,EAACT,KAAK,CAACO,IAAI,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAE,IAAI,CAAC;IACnE;;IAEA;AACR;AACA;AACA;IACQ,MAAMG,kBAAkB,sBAAGL,QAAQ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M,KAAK,EAAEH;IACX,CAAC,CAAC;EACN,CAAC,CAAC;;EAEF;AACJ;AACA;EACItB,GAAG,CAAC0B,QAAQ,CAACC,qBAAqB,CAACxB,SAAS,CAAC,OAAO;IAAEuB;EAAS,CAAC,KAAK;IAAA;IACjE,MAAM;MAAEE;IAAM,CAAC,GAAGF,QAAQ;IAC1B;AACR;AACA;IACQ,IAAI,IAAAG,iBAAU,EAACH,QAAQ,CAAC,KAAK,KAAK,EAAE;MAChC;IACJ;IAEA,MAAMI,MAAM,GAAG,MAAM7B,GAAG,CAAC8B,UAAU,EAAE;IAErC,MAAMC,MAA2B,kBAAGJ,KAAK,CAACK,IAAI,gDAAV,YAAYC,OAAO;IACvD,IAAI,CAACF,MAAM,IAAIG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,KAAK,KAAK,IAAIA,MAAM,CAACK,MAAM,KAAK,CAAC,EAAE;MACnE;IACJ;IAEA,KAAK,MAAMC,KAAK,IAAIN,MAAM,EAAE;MACxB,IAAI,CAACM,KAAK,IAAI,CAACA,KAAK,CAACC,OAAO,IAAI,CAACD,KAAK,CAACE,EAAE,EAAE;QACvC;MACJ;MACA,MAAMnC,KAAK,GAAGyB,MAAM,CAACW,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACH,OAAO,KAAKD,KAAK,CAACC,OAAO,CAAC;MAC3D,IAAI,CAAClC,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"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createChangeRequestNotification = void 0;
7
-
8
7
  var _types = require("../../../types");
9
-
10
8
  var _ApwChangeRequestNotification = require("../../../ApwChangeRequestNotification");
11
-
12
9
  const createChangeRequestNotification = () => {
13
10
  const plugin = (0, _ApwChangeRequestNotification.createApwChangeRequestNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
14
11
  const {
@@ -31,5 +28,4 @@ const createChangeRequestNotification = () => {
31
28
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
32
29
  return plugin;
33
30
  };
34
-
35
31
  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,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"}
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"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createCommentNotification = void 0;
7
-
8
7
  var _ApwCommentNotification = require("../../../ApwCommentNotification");
9
-
10
8
  var _types = require("../../../types");
11
-
12
9
  const createCommentNotification = () => {
13
10
  const plugin = (0, _ApwCommentNotification.createApwCommentNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
14
11
  const {
@@ -31,5 +28,4 @@ const createCommentNotification = () => {
31
28
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
32
29
  return plugin;
33
30
  };
34
-
35
31
  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,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"}
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"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createContentReviewNotification = void 0;
7
-
8
7
  var _types = require("../../../types");
9
-
10
8
  var _ApwContentReviewNotification = require("../../../ApwContentReviewNotification");
11
-
12
9
  const createContentReviewNotification = () => {
13
10
  const plugin = (0, _ApwContentReviewNotification.createApwContentReviewNotification)(_types.ApwContentTypes.CMS_ENTRY, params => {
14
11
  const {
@@ -31,5 +28,4 @@ const createContentReviewNotification = () => {
31
28
  plugin.name = `${plugin.type}.${_types.ApwContentTypes.CMS_ENTRY}.default`;
32
29
  return plugin;
33
30
  };
34
-
35
31
  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,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"}
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"}