@webiny/api-apw 0.0.0-unstable.fcdad0bc61 → 0.0.0-unstable.fdd9228b5d

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 (315) hide show
  1. package/ApwChangeRequestNotification.d.ts +1 -1
  2. package/ApwChangeRequestNotification.js +3 -15
  3. package/ApwChangeRequestNotification.js.map +1 -1
  4. package/ApwCommentNotification.d.ts +1 -1
  5. package/ApwCommentNotification.js +3 -15
  6. package/ApwCommentNotification.js.map +1 -1
  7. package/ApwContentReviewNotification.d.ts +1 -1
  8. package/ApwContentReviewNotification.js +3 -15
  9. package/ApwContentReviewNotification.js.map +1 -1
  10. package/ApwContentUrlPlugin.d.ts +1 -1
  11. package/ApwContentUrlPlugin.js +3 -15
  12. package/ApwContentUrlPlugin.js.map +1 -1
  13. package/ContentApwSettingsPlugin.d.ts +1 -1
  14. package/ContentApwSettingsPlugin.js +5 -9
  15. package/ContentApwSettingsPlugin.js.map +1 -1
  16. package/README.md +3 -3
  17. package/crud/createChangeRequestMethods.d.ts +1 -1
  18. package/crud/createChangeRequestMethods.js +7 -12
  19. package/crud/createChangeRequestMethods.js.map +1 -1
  20. package/crud/createCommentMethods.d.ts +1 -1
  21. package/crud/createCommentMethods.js +7 -13
  22. package/crud/createCommentMethods.js.map +1 -1
  23. package/crud/createContentReviewMethods.d.ts +2 -2
  24. package/crud/createContentReviewMethods.js +76 -115
  25. package/crud/createContentReviewMethods.js.map +1 -1
  26. package/crud/createReviewerMethods.d.ts +1 -1
  27. package/crud/createReviewerMethods.js +7 -13
  28. package/crud/createReviewerMethods.js.map +1 -1
  29. package/crud/createWorkflowMethods.d.ts +1 -1
  30. package/crud/createWorkflowMethods.js +7 -18
  31. package/crud/createWorkflowMethods.js.map +1 -1
  32. package/crud/index.d.ts +1 -1
  33. package/crud/index.js +5 -29
  34. package/crud/index.js.map +1 -1
  35. package/crud/utils.d.ts +2 -2
  36. package/crud/utils.js +7 -35
  37. package/crud/utils.js.map +1 -1
  38. package/index.d.ts +2 -3
  39. package/index.js +6 -19
  40. package/index.js.map +1 -1
  41. package/package.json +32 -50
  42. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +1 -1
  43. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +4 -19
  44. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  45. package/plugins/cms/apwEntryPlugins.d.ts +2 -2
  46. package/plugins/cms/apwEntryPlugins.js +18 -14
  47. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  48. package/plugins/cms/index.d.ts +4 -4
  49. package/plugins/cms/index.js +2 -13
  50. package/plugins/cms/index.js.map +1 -1
  51. package/plugins/cms/linkContentReviewToEntry.d.ts +2 -2
  52. package/plugins/cms/linkContentReviewToEntry.js +4 -20
  53. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  54. package/plugins/cms/linkWorkflowToEntry.d.ts +2 -2
  55. package/plugins/cms/linkWorkflowToEntry.js +18 -46
  56. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  57. package/plugins/cms/notifications/changeRequestNotification.js +2 -4
  58. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
  59. package/plugins/cms/notifications/commentNotification.js +2 -4
  60. package/plugins/cms/notifications/commentNotification.js.map +1 -1
  61. package/plugins/cms/notifications/contentReviewNotification.js +2 -4
  62. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
  63. package/plugins/cms/notifications/contentUrl.js +3 -8
  64. package/plugins/cms/notifications/contentUrl.js.map +1 -1
  65. package/plugins/cms/triggerContentReview.d.ts +2 -2
  66. package/plugins/cms/triggerContentReview.js +5 -18
  67. package/plugins/cms/triggerContentReview.js.map +1 -1
  68. package/plugins/cms/updateContentReviewStatus.d.ts +3 -3
  69. package/plugins/cms/updateContentReviewStatus.js +14 -30
  70. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  71. package/plugins/cms/utils.d.ts +5 -4
  72. package/plugins/cms/utils.js +20 -59
  73. package/plugins/cms/utils.js.map +1 -1
  74. package/plugins/context.d.ts +3 -4
  75. package/plugins/context.js +4 -58
  76. package/plugins/context.js.map +1 -1
  77. package/plugins/graphql/changeRequest.gql.d.ts +1 -1
  78. package/plugins/graphql/changeRequest.gql.js +16 -20
  79. package/plugins/graphql/changeRequest.gql.js.map +1 -1
  80. package/plugins/graphql/comment.gql.d.ts +1 -1
  81. package/plugins/graphql/comment.gql.js +41 -43
  82. package/plugins/graphql/comment.gql.js.map +1 -1
  83. package/plugins/graphql/contentReview.gql.d.ts +1 -1
  84. package/plugins/graphql/contentReview.gql.js +25 -35
  85. package/plugins/graphql/contentReview.gql.js.map +1 -1
  86. package/plugins/graphql/reviewer.gql.d.ts +1 -1
  87. package/plugins/graphql/reviewer.gql.js +15 -20
  88. package/plugins/graphql/reviewer.gql.js.map +1 -1
  89. package/plugins/graphql/utils.d.ts +2 -0
  90. package/plugins/graphql/utils.js +10 -0
  91. package/plugins/graphql/utils.js.map +1 -0
  92. package/plugins/graphql/workflow.gql.d.ts +1 -1
  93. package/plugins/graphql/workflow.gql.js +15 -20
  94. package/plugins/graphql/workflow.gql.js.map +1 -1
  95. package/plugins/graphql.d.ts +1 -1
  96. package/plugins/graphql.js +5 -18
  97. package/plugins/graphql.js.map +1 -1
  98. package/plugins/hooks/createReviewerFromIdentity.d.ts +1 -1
  99. package/plugins/hooks/createReviewerFromIdentity.js +5 -12
  100. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  101. package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +1 -1
  102. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +3 -9
  103. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  104. package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +1 -1
  105. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +3 -8
  106. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  107. package/plugins/hooks/index.d.ts +1 -1
  108. package/plugins/hooks/index.js +2 -14
  109. package/plugins/hooks/index.js.map +1 -1
  110. package/plugins/hooks/initializeContentReviewSteps.d.ts +1 -1
  111. package/plugins/hooks/initializeContentReviewSteps.js +15 -20
  112. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  113. package/plugins/hooks/initializeNotifications.d.ts +1 -1
  114. package/plugins/hooks/initializeNotifications.js +2 -5
  115. package/plugins/hooks/initializeNotifications.js.map +1 -1
  116. package/plugins/hooks/listContentReviews.d.ts +3 -3
  117. package/plugins/hooks/listContentReviews.js +3 -13
  118. package/plugins/hooks/listContentReviews.js.map +1 -1
  119. package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +1 -1
  120. package/plugins/hooks/notifications/changeRequestAfterCreate.js +7 -38
  121. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
  122. package/plugins/hooks/notifications/changeRequestUrl.js +2 -4
  123. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -1
  124. package/plugins/hooks/notifications/commentAfterCreate.d.ts +1 -1
  125. package/plugins/hooks/notifications/commentAfterCreate.js +7 -40
  126. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
  127. package/plugins/hooks/notifications/commentUrl.js +2 -4
  128. package/plugins/hooks/notifications/commentUrl.js.map +1 -1
  129. package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +1 -1
  130. package/plugins/hooks/notifications/contentReviewAfterCreate.js +9 -35
  131. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
  132. package/plugins/hooks/notifications/contentReviewUrl.js +2 -4
  133. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -1
  134. package/plugins/hooks/notifications/contentUrl.d.ts +2 -2
  135. package/plugins/hooks/notifications/contentUrl.js +2 -5
  136. package/plugins/hooks/notifications/contentUrl.js.map +1 -1
  137. package/plugins/hooks/notifications/getAppUrl.d.ts +2 -0
  138. package/plugins/hooks/notifications/getAppUrl.js +19 -0
  139. package/plugins/hooks/notifications/getAppUrl.js.map +1 -0
  140. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +1 -1
  141. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +2 -4
  142. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
  143. package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +1 -1
  144. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +2 -4
  145. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
  146. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +1 -1
  147. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +2 -4
  148. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
  149. package/plugins/hooks/notifications/reviewers.d.ts +1 -1
  150. package/plugins/hooks/notifications/reviewers.js +17 -21
  151. package/plugins/hooks/notifications/reviewers.js.map +1 -1
  152. package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +1 -1
  153. package/plugins/hooks/notifications/sendChangeRequestNotification.js +2 -11
  154. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
  155. package/plugins/hooks/notifications/sendCommentNotification.d.ts +1 -1
  156. package/plugins/hooks/notifications/sendCommentNotification.js +2 -11
  157. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
  158. package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +1 -1
  159. package/plugins/hooks/notifications/sendContentReviewNotification.js +2 -11
  160. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
  161. package/plugins/hooks/updatePendingChangeRequests.d.ts +1 -1
  162. package/plugins/hooks/updatePendingChangeRequests.js +7 -13
  163. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  164. package/plugins/hooks/updateTotalComments.d.ts +1 -1
  165. package/plugins/hooks/updateTotalComments.js +21 -23
  166. package/plugins/hooks/updateTotalComments.js.map +1 -1
  167. package/plugins/hooks/validateChangeRequest.d.ts +1 -1
  168. package/plugins/hooks/validateChangeRequest.js +2 -16
  169. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  170. package/plugins/hooks/validateComment.d.ts +1 -1
  171. package/plugins/hooks/validateComment.js +3 -12
  172. package/plugins/hooks/validateComment.js.map +1 -1
  173. package/plugins/hooks/validateContentReview.d.ts +1 -1
  174. package/plugins/hooks/validateContentReview.js +2 -6
  175. package/plugins/hooks/validateContentReview.js.map +1 -1
  176. package/plugins/utils.d.ts +7 -6
  177. package/plugins/utils.js +11 -50
  178. package/plugins/utils.js.map +1 -1
  179. package/scheduler/createScheduleActionMethods.d.ts +1 -1
  180. package/scheduler/createScheduleActionMethods.js +105 -85
  181. package/scheduler/createScheduleActionMethods.js.map +1 -1
  182. package/scheduler/handlers/executeAction/index.d.ts +2 -2
  183. package/scheduler/handlers/executeAction/index.js +47 -41
  184. package/scheduler/handlers/executeAction/index.js.map +1 -1
  185. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
  186. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +19 -9
  187. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  188. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +3 -3
  189. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +11 -28
  190. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  191. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +4 -3
  192. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +10 -92
  193. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  194. package/scheduler/handlers/executeAction/security.d.ts +2 -2
  195. package/scheduler/handlers/executeAction/security.js +2 -11
  196. package/scheduler/handlers/executeAction/security.js.map +1 -1
  197. package/scheduler/handlers/scheduleAction/index.d.ts +2 -2
  198. package/scheduler/handlers/scheduleAction/index.js +23 -38
  199. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  200. package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +3 -3
  201. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +20 -36
  202. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  203. package/scheduler/handlers/utils.d.ts +2 -4
  204. package/scheduler/handlers/utils.js +22 -53
  205. package/scheduler/handlers/utils.js.map +1 -1
  206. package/scheduler/index.d.ts +1 -1
  207. package/scheduler/index.js +2 -3
  208. package/scheduler/index.js.map +1 -1
  209. package/scheduler/types.d.ts +20 -36
  210. package/scheduler/types.js +11 -23
  211. package/scheduler/types.js.map +1 -1
  212. package/storageOperations/changeRequestStorageOperations.d.ts +2 -2
  213. package/storageOperations/changeRequestStorageOperations.js +43 -41
  214. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  215. package/storageOperations/commentStorageOperations.d.ts +3 -3
  216. package/storageOperations/commentStorageOperations.js +16 -44
  217. package/storageOperations/commentStorageOperations.js.map +1 -1
  218. package/storageOperations/contentReviewStorageOperations.d.ts +3 -3
  219. package/storageOperations/contentReviewStorageOperations.js +19 -41
  220. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  221. package/storageOperations/index.d.ts +3 -9
  222. package/storageOperations/index.js +10 -29
  223. package/storageOperations/index.js.map +1 -1
  224. package/storageOperations/models/changeRequest.model.d.ts +1 -2
  225. package/storageOperations/models/changeRequest.model.js +9 -19
  226. package/storageOperations/models/changeRequest.model.js.map +1 -1
  227. package/storageOperations/models/comment.model.d.ts +1 -2
  228. package/storageOperations/models/comment.model.js +9 -18
  229. package/storageOperations/models/comment.model.js.map +1 -1
  230. package/storageOperations/models/contentReview.model.d.ts +1 -2
  231. package/storageOperations/models/contentReview.model.js +16 -41
  232. package/storageOperations/models/contentReview.model.js.map +1 -1
  233. package/storageOperations/models/index.d.ts +1 -1
  234. package/storageOperations/models/index.js +11 -55
  235. package/storageOperations/models/index.js.map +1 -1
  236. package/storageOperations/models/reviewer.model.d.ts +1 -2
  237. package/storageOperations/models/reviewer.model.js +10 -19
  238. package/storageOperations/models/reviewer.model.js.map +1 -1
  239. package/storageOperations/models/utils.d.ts +2 -2
  240. package/storageOperations/models/utils.js +2 -4
  241. package/storageOperations/models/utils.js.map +1 -1
  242. package/storageOperations/models/workflow.model.d.ts +2 -3
  243. package/storageOperations/models/workflow.model.js +22 -46
  244. package/storageOperations/models/workflow.model.js.map +1 -1
  245. package/storageOperations/reviewerStorageOperations.d.ts +3 -3
  246. package/storageOperations/reviewerStorageOperations.js +23 -50
  247. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  248. package/storageOperations/types.d.ts +2 -2
  249. package/storageOperations/types.js +3 -1
  250. package/storageOperations/types.js.map +1 -1
  251. package/storageOperations/workflowStorageOperations.d.ts +2 -2
  252. package/storageOperations/workflowStorageOperations.js +24 -44
  253. package/storageOperations/workflowStorageOperations.js.map +1 -1
  254. package/types.d.ts +49 -64
  255. package/types.js +121 -43
  256. package/types.js.map +1 -1
  257. package/utils/contentApwSettingsPlugin.d.ts +2 -2
  258. package/utils/contentApwSettingsPlugin.js +2 -6
  259. package/utils/contentApwSettingsPlugin.js.map +1 -1
  260. package/utils/errors.js +2 -17
  261. package/utils/errors.js.map +1 -1
  262. package/utils/fieldResolver.d.ts +2 -2
  263. package/utils/fieldResolver.js +8 -18
  264. package/utils/fieldResolver.js.map +1 -1
  265. package/utils/pickEntryFieldValues.d.ts +3 -0
  266. package/utils/pickEntryFieldValues.js +30 -0
  267. package/utils/pickEntryFieldValues.js.map +1 -0
  268. package/utils/resolve.d.ts +1 -1
  269. package/utils/resolve.js +2 -3
  270. package/utils/resolve.js.map +1 -1
  271. package/plugins/hooks/notifications/appUrl.d.ts +0 -2
  272. package/plugins/hooks/notifications/appUrl.js +0 -22
  273. package/plugins/hooks/notifications/appUrl.js.map +0 -1
  274. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +0 -9
  275. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -51
  276. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +0 -1
  277. package/plugins/pageBuilder/apwContentPagePlugins.d.ts +0 -3
  278. package/plugins/pageBuilder/apwContentPagePlugins.js +0 -30
  279. package/plugins/pageBuilder/apwContentPagePlugins.js.map +0 -1
  280. package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +0 -3
  281. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +0 -25
  282. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +0 -1
  283. package/plugins/pageBuilder/index.d.ts +0 -11
  284. package/plugins/pageBuilder/index.js +0 -53
  285. package/plugins/pageBuilder/index.js.map +0 -1
  286. package/plugins/pageBuilder/linkContentReviewToPage.d.ts +0 -8
  287. package/plugins/pageBuilder/linkContentReviewToPage.js +0 -105
  288. package/plugins/pageBuilder/linkContentReviewToPage.js.map +0 -1
  289. package/plugins/pageBuilder/linkWorkflowToPage.d.ts +0 -8
  290. package/plugins/pageBuilder/linkWorkflowToPage.js +0 -194
  291. package/plugins/pageBuilder/linkWorkflowToPage.js.map +0 -1
  292. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +0 -1
  293. package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -35
  294. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +0 -1
  295. package/plugins/pageBuilder/notifications/commentNotification.d.ts +0 -1
  296. package/plugins/pageBuilder/notifications/commentNotification.js +0 -35
  297. package/plugins/pageBuilder/notifications/commentNotification.js.map +0 -1
  298. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +0 -1
  299. package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -35
  300. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +0 -1
  301. package/plugins/pageBuilder/notifications/contentUrl.d.ts +0 -1
  302. package/plugins/pageBuilder/notifications/contentUrl.js +0 -53
  303. package/plugins/pageBuilder/notifications/contentUrl.js.map +0 -1
  304. package/plugins/pageBuilder/triggerContentReview.d.ts +0 -8
  305. package/plugins/pageBuilder/triggerContentReview.js +0 -50
  306. package/plugins/pageBuilder/triggerContentReview.js.map +0 -1
  307. package/plugins/pageBuilder/updateContentReviewStatus.d.ts +0 -10
  308. package/plugins/pageBuilder/updateContentReviewStatus.js +0 -79
  309. package/plugins/pageBuilder/updateContentReviewStatus.js.map +0 -1
  310. package/plugins/pageBuilder/utils.d.ts +0 -22
  311. package/plugins/pageBuilder/utils.js +0 -184
  312. package/plugins/pageBuilder/utils.js.map +0 -1
  313. package/storageOperations/models/contentModelPluginFactory.d.ts +0 -15
  314. package/storageOperations/models/contentModelPluginFactory.js +0 -28
  315. package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
package/crud/utils.js CHANGED
@@ -1,35 +1,22 @@
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.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = void 0;
9
8
  exports.checkValidDateTime = checkValidDateTime;
10
9
  exports.getPendingRequiredSteps = exports.filterContentReviewsByRequiresMyAttention = void 0;
11
-
12
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
-
14
10
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
11
  var _dayjs = _interopRequireDefault(require("dayjs"));
17
-
18
12
  var _utc = _interopRequireDefault(require("dayjs/plugin/utc"));
19
-
20
- var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
21
-
22
13
  var _set = _interopRequireDefault(require("lodash/set"));
23
-
24
14
  var _types = require("../types");
25
-
26
15
  _dayjs.default.extend(_utc.default);
27
-
28
16
  function checkValidDateTime(datetime) {
29
17
  if (typeof datetime !== "string") {
30
18
  return;
31
19
  }
32
-
33
20
  if (!(0, _dayjs.default)(datetime).isValid()) {
34
21
  throw new _error.default({
35
22
  message: `Invalid input "datetime" should be an ISO string.`,
@@ -39,9 +26,7 @@ function checkValidDateTime(datetime) {
39
26
  }
40
27
  });
41
28
  }
42
-
43
29
  const today = _dayjs.default.utc();
44
-
45
30
  if ((0, _dayjs.default)(datetime).isBefore(today)) {
46
31
  throw new _error.default({
47
32
  message: `Cannot schedule for a past "datetime".`,
@@ -52,27 +37,21 @@ function checkValidDateTime(datetime) {
52
37
  });
53
38
  }
54
39
  }
55
-
56
40
  const getPendingRequiredSteps = (steps, predicate) => {
57
41
  return steps.filter(step => {
58
42
  const isRequiredStep = [_types.ApwWorkflowStepTypes.MANDATORY_BLOCKING, _types.ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING].includes(step.type);
59
-
60
43
  if (!isRequiredStep) {
61
44
  return false;
62
45
  }
63
-
64
46
  return predicate(step);
65
47
  });
66
48
  };
67
-
68
49
  exports.getPendingRequiredSteps = getPendingRequiredSteps;
69
- const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {
50
+ const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = exports.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {
70
51
  scheduledOn: null,
71
52
  scheduledBy: null,
72
53
  scheduledActionId: null
73
54
  };
74
- exports.INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META;
75
-
76
55
  /**
77
56
  * Filter "content reviews" that are "underReview" and current user is a reviewer for the active step.
78
57
  * That is the user is able to provide sign-off or comment.
@@ -87,25 +66,20 @@ const filterContentReviewsByRequiresMyAttention = async params => {
87
66
  /**
88
67
  * Get all "content reviews" with status "underReview"
89
68
  */
90
-
91
- const newListParams = (0, _set.default)((0, _cloneDeep.default)(listParams), "where.reviewStatus", _types.ApwContentReviewStatus.UNDER_REVIEW);
69
+ const newListParams = (0, _set.default)(structuredClone(listParams), "where.reviewStatus", _types.ApwContentReviewStatus.UNDER_REVIEW);
92
70
  const [contentReviews, meta] = await listContentReviews(newListParams);
93
71
  const identity = getIdentity();
94
72
  const filteredItems = [];
95
73
  /**
96
74
  * Filter items where current user is a reviewer for the active step.
97
75
  */
98
-
99
76
  for (let i = 0; i < contentReviews.length; i++) {
100
77
  const contentReview = contentReviews[i];
101
78
  const activeStep = contentReview.steps.find(step => step.status === _types.ApwContentReviewStepStatus.ACTIVE);
102
-
103
79
  if (!activeStep) {
104
80
  continue;
105
81
  }
106
-
107
82
  let requiresMyAttention = false;
108
-
109
83
  for (let j = 0; j < activeStep.reviewers.length; j++) {
110
84
  const {
111
85
  id
@@ -113,26 +87,24 @@ const filterContentReviewsByRequiresMyAttention = async params => {
113
87
  /**
114
88
  * Load reviewer
115
89
  */
116
-
117
90
  const reviewer = await getReviewer(id);
118
91
  /**
119
92
  * Check if the current logged in user is the reviewer.
120
93
  */
121
-
122
94
  if (reviewer.identityId === identity.id) {
123
95
  requiresMyAttention = true;
124
96
  break;
125
97
  }
126
98
  }
127
-
128
99
  if (requiresMyAttention) {
129
100
  filteredItems.push(contentReview);
130
101
  }
131
102
  }
132
-
133
- return [filteredItems, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, meta), {}, {
103
+ return [filteredItems, {
104
+ ...meta,
134
105
  totalCount: filteredItems.length
135
- })];
106
+ }];
136
107
  };
108
+ exports.filterContentReviewsByRequiresMyAttention = filterContentReviewsByRequiresMyAttention;
137
109
 
138
- exports.filterContentReviewsByRequiresMyAttention = filterContentReviewsByRequiresMyAttention;
110
+ //# sourceMappingURL=utils.js.map
package/crud/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["dayjs","extend","utc","checkValidDateTime","datetime","isValid","Error","message","code","data","today","isBefore","getPendingRequiredSteps","steps","predicate","filter","step","isRequiredStep","ApwWorkflowStepTypes","MANDATORY_BLOCKING","MANDATORY_NON_BLOCKING","includes","type","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","scheduledOn","scheduledBy","scheduledActionId","filterContentReviewsByRequiresMyAttention","params","listContentReviews","listParams","getIdentity","getReviewer","newListParams","set","cloneDeep","ApwContentReviewStatus","UNDER_REVIEW","contentReviews","meta","identity","filteredItems","i","length","contentReview","activeStep","find","status","ApwContentReviewStepStatus","ACTIVE","requiresMyAttention","j","reviewers","id","reviewer","identityId","push","totalCount"],"sources":["utils.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc\";\nimport cloneDeep from \"lodash/cloneDeep\";\nimport set from \"lodash/set\";\nimport {\n ApwContentReview,\n ApwContentReviewListParams,\n ApwContentReviewStatus,\n ApwContentReviewStep,\n ApwContentReviewStepStatus,\n ApwWorkflowStepTypes,\n ListMeta\n} from \"~/types\";\nimport { CreateContentReviewMethodsParams } from \"./createContentReviewMethods\";\n\ndayjs.extend(utc);\n\nexport function checkValidDateTime(datetime: string | undefined): void {\n if (typeof datetime !== \"string\") {\n return;\n }\n\n if (!dayjs(datetime).isValid()) {\n throw new Error({\n message: `Invalid input \"datetime\" should be an ISO string.`,\n code: \"INVALID_DATETIME_FORMAT\",\n data: {\n datetime\n }\n });\n }\n const today = dayjs.utc();\n\n if (dayjs(datetime).isBefore(today)) {\n throw new Error({\n message: `Cannot schedule for a past \"datetime\".`,\n code: \"PAST_DATETIME\",\n data: {\n datetime\n }\n });\n }\n}\n\nexport interface GetPendingRequiredSteps {\n (\n steps: ApwContentReviewStep[],\n predicate: (step: ApwContentReviewStep) => boolean\n ): ApwContentReviewStep[];\n}\n\nexport const getPendingRequiredSteps: GetPendingRequiredSteps = (steps, predicate) => {\n return steps.filter(step => {\n const isRequiredStep = [\n ApwWorkflowStepTypes.MANDATORY_BLOCKING,\n ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING\n ].includes(step.type);\n\n if (!isRequiredStep) {\n return false;\n }\n\n return predicate(step);\n });\n};\n\nexport const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n};\n\nexport interface FilterContentReviewsParams\n extends Pick<CreateContentReviewMethodsParams, \"getReviewer\" | \"getIdentity\"> {\n listParams: ApwContentReviewListParams;\n listContentReviews: CreateContentReviewMethodsParams[\"storageOperations\"][\"listContentReviews\"];\n}\n\n/**\n * Filter \"content reviews\" that are \"underReview\" and current user is a reviewer for the active step.\n * That is the user is able to provide sign-off or comment.\n */\nexport const filterContentReviewsByRequiresMyAttention = async (\n params: FilterContentReviewsParams\n): Promise<[ApwContentReview[], ListMeta]> => {\n const { listContentReviews, listParams, getIdentity, getReviewer } = params;\n /**\n * Get all \"content reviews\" with status \"underReview\"\n */\n const newListParams = set(\n cloneDeep(listParams),\n \"where.reviewStatus\",\n ApwContentReviewStatus.UNDER_REVIEW\n );\n const [contentReviews, meta] = await listContentReviews(newListParams);\n\n const identity = getIdentity();\n const filteredItems = [];\n /**\n * Filter items where current user is a reviewer for the active step.\n */\n for (let i = 0; i < contentReviews.length; i++) {\n const contentReview = contentReviews[i];\n\n const activeStep = contentReview.steps.find(\n step => step.status === ApwContentReviewStepStatus.ACTIVE\n );\n\n if (!activeStep) {\n continue;\n }\n\n let requiresMyAttention = false;\n\n for (let j = 0; j < activeStep.reviewers.length; j++) {\n const { id } = activeStep.reviewers[j];\n /**\n * Load reviewer\n */\n const reviewer = await getReviewer(id);\n /**\n * Check if the current logged in user is the reviewer.\n */\n if (reviewer.identityId === identity.id) {\n requiresMyAttention = true;\n break;\n }\n }\n\n if (requiresMyAttention) {\n filteredItems.push(contentReview);\n }\n }\n\n return [\n filteredItems,\n {\n ...meta,\n totalCount: filteredItems.length\n }\n ];\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAWAA,cAAA,CAAMC,MAAN,CAAaC,YAAb;;AAEO,SAASC,kBAAT,CAA4BC,QAA5B,EAAgE;EACnE,IAAI,OAAOA,QAAP,KAAoB,QAAxB,EAAkC;IAC9B;EACH;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_types","dayjs","extend","utc","checkValidDateTime","datetime","isValid","Error","message","code","data","today","isBefore","getPendingRequiredSteps","steps","predicate","filter","step","isRequiredStep","ApwWorkflowStepTypes","MANDATORY_BLOCKING","MANDATORY_NON_BLOCKING","includes","type","exports","INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META","scheduledOn","scheduledBy","scheduledActionId","filterContentReviewsByRequiresMyAttention","params","listContentReviews","listParams","getIdentity","getReviewer","newListParams","set","structuredClone","ApwContentReviewStatus","UNDER_REVIEW","contentReviews","meta","identity","filteredItems","i","length","contentReview","activeStep","find","status","ApwContentReviewStepStatus","ACTIVE","requiresMyAttention","j","reviewers","id","reviewer","identityId","push","totalCount"],"sources":["utils.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport dayjs from \"dayjs\";\nimport utc from \"dayjs/plugin/utc\";\nimport set from \"lodash/set\";\nimport type {\n ApwContentReview,\n ApwContentReviewListParams,\n ApwContentReviewStep,\n ListMeta\n} from \"~/types\";\nimport { ApwContentReviewStatus, ApwContentReviewStepStatus, ApwWorkflowStepTypes } from \"~/types\";\nimport type { CreateContentReviewMethodsParams } from \"./createContentReviewMethods\";\n\ndayjs.extend(utc);\n\nexport function checkValidDateTime(datetime: string | undefined): void {\n if (typeof datetime !== \"string\") {\n return;\n }\n\n if (!dayjs(datetime).isValid()) {\n throw new Error({\n message: `Invalid input \"datetime\" should be an ISO string.`,\n code: \"INVALID_DATETIME_FORMAT\",\n data: {\n datetime\n }\n });\n }\n const today = dayjs.utc();\n\n if (dayjs(datetime).isBefore(today)) {\n throw new Error({\n message: `Cannot schedule for a past \"datetime\".`,\n code: \"PAST_DATETIME\",\n data: {\n datetime\n }\n });\n }\n}\n\nexport interface GetPendingRequiredSteps {\n (\n steps: ApwContentReviewStep[],\n predicate: (step: ApwContentReviewStep) => boolean\n ): ApwContentReviewStep[];\n}\n\nexport const getPendingRequiredSteps: GetPendingRequiredSteps = (steps, predicate) => {\n return steps.filter(step => {\n const isRequiredStep = [\n ApwWorkflowStepTypes.MANDATORY_BLOCKING,\n ApwWorkflowStepTypes.MANDATORY_NON_BLOCKING\n ].includes(step.type);\n\n if (!isRequiredStep) {\n return false;\n }\n\n return predicate(step);\n });\n};\n\nexport const INITIAL_CONTENT_REVIEW_CONTENT_SCHEDULE_META = {\n scheduledOn: null,\n scheduledBy: null,\n scheduledActionId: null\n};\n\nexport interface FilterContentReviewsParams\n extends Pick<CreateContentReviewMethodsParams, \"getReviewer\" | \"getIdentity\"> {\n listParams: ApwContentReviewListParams;\n listContentReviews: CreateContentReviewMethodsParams[\"storageOperations\"][\"listContentReviews\"];\n}\n\n/**\n * Filter \"content reviews\" that are \"underReview\" and current user is a reviewer for the active step.\n * That is the user is able to provide sign-off or comment.\n */\nexport const filterContentReviewsByRequiresMyAttention = async (\n params: FilterContentReviewsParams\n): Promise<[ApwContentReview[], ListMeta]> => {\n const { listContentReviews, listParams, getIdentity, getReviewer } = params;\n /**\n * Get all \"content reviews\" with status \"underReview\"\n */\n const newListParams = set(\n structuredClone(listParams),\n \"where.reviewStatus\",\n ApwContentReviewStatus.UNDER_REVIEW\n );\n const [contentReviews, meta] = await listContentReviews(newListParams);\n\n const identity = getIdentity();\n const filteredItems = [];\n /**\n * Filter items where current user is a reviewer for the active step.\n */\n for (let i = 0; i < contentReviews.length; i++) {\n const contentReview = contentReviews[i];\n\n const activeStep = contentReview.steps.find(\n step => step.status === ApwContentReviewStepStatus.ACTIVE\n );\n\n if (!activeStep) {\n continue;\n }\n\n let requiresMyAttention = false;\n\n for (let j = 0; j < activeStep.reviewers.length; j++) {\n const { id } = activeStep.reviewers[j];\n /**\n * Load reviewer\n */\n const reviewer = await getReviewer(id);\n /**\n * Check if the current logged in user is the reviewer.\n */\n if (reviewer.identityId === identity.id) {\n requiresMyAttention = true;\n break;\n }\n }\n\n if (requiresMyAttention) {\n filteredItems.push(contentReview);\n }\n }\n\n return [\n filteredItems,\n {\n ...meta,\n totalCount: filteredItems.length\n }\n ];\n};\n"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AACZ;AACA;MACY,MAAMG,QAAQ,GAAG,MAAMtB,WAAW,CAACqB,EAAE,CAAC;MACtC;AACZ;AACA;MACY,IAAIC,QAAQ,CAACC,UAAU,KAAKf,QAAQ,CAACa,EAAE,EAAE;QACrCH,mBAAmB,GAAG,IAAI;QAC1B;MACJ;IACJ;IAEA,IAAIA,mBAAmB,EAAE;MACrBT,aAAa,CAACe,IAAI,CAACZ,aAAa,CAAC;IACrC;EACJ;EAEA,OAAO,CACHH,aAAa,EACb;IACI,GAAGF,IAAI;IACPkB,UAAU,EAAEhB,aAAa,CAACE;EAC9B,CAAC,CACJ;AACL,CAAC;AAACrB,OAAA,CAAAK,yCAAA,GAAAA,yCAAA","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { CreateApwContextParams } from "./scheduler/types";
2
- export declare const createApwHeadlessCmsContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection)[];
3
- export declare const createApwPageBuilderContext: (params: CreateApwContextParams) => (import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginCollection | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
1
+ import type { CreateApwContextParams } from "./scheduler/types";
2
+ export declare const createApwContext: (params: CreateApwContextParams) => (import("@webiny/plugins/types").Plugin<Record<string, any>> | import("@webiny/plugins/types").PluginFactory | import("@webiny/plugins/types").PluginCollection | import("@webiny/api").ContextPlugin<import("./types").ApwContext> | import("@webiny/handler-graphql").GraphQLSchemaPlugin<import("@webiny/api-mailer/types").MailerContext>)[];
4
3
  export declare const createApwGraphQL: () => import("@webiny/api").ContextPlugin<import("./types").ApwContext>[];
package/index.js CHANGED
@@ -1,38 +1,25 @@
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
- exports.createApwPageBuilderContext = exports.createApwHeadlessCmsContext = exports.createApwGraphQL = void 0;
9
-
7
+ exports.createApwGraphQL = exports.createApwContext = void 0;
10
8
  var _graphql = _interopRequireDefault(require("./plugins/graphql"));
11
-
12
9
  var _context = require("./plugins/context");
13
-
14
10
  var _apiMailer = require("@webiny/api-mailer");
15
-
16
- var _apiAdminSettings = require("@webiny/api-admin-settings");
17
-
18
11
  /**
19
12
  * We have separated context and GraphQL creation so user can initialize only context if required.
20
13
  * GraphQL will not work without context, but context will without GraphQL.
21
14
  */
22
- const createApwHeadlessCmsContext = params => {
23
- return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), (0, _context.createApwHeadlessCmsContext)(params)];
24
- };
25
-
26
- exports.createApwHeadlessCmsContext = createApwHeadlessCmsContext;
27
15
 
28
- const createApwPageBuilderContext = params => {
29
- return [...(0, _apiAdminSettings.createAdminSettingsContext)(), ...(0, _apiMailer.createMailerContext)(), ...(0, _apiMailer.createMailerGraphQL)(), (0, _context.createApwPageBuilderContext)(params)];
16
+ const createApwContext = params => {
17
+ return [...(0, _apiMailer.createMailerContext)(), ...(0, _apiMailer.createMailerGraphQL)(), (0, _context.createApwContext)(params)];
30
18
  };
31
-
32
- exports.createApwPageBuilderContext = createApwPageBuilderContext;
33
-
19
+ exports.createApwContext = createApwContext;
34
20
  const createApwGraphQL = () => {
35
21
  return [(0, _graphql.default)()];
36
22
  };
23
+ exports.createApwGraphQL = createApwGraphQL;
37
24
 
38
- exports.createApwGraphQL = createApwGraphQL;
25
+ //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createApwHeadlessCmsContext","params","createAdminSettingsContext","createMailerContext","createHeadlessCms","createApwPageBuilderContext","createMailerGraphQL","createPageBuilder","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport {\n createApwHeadlessCmsContext as createHeadlessCms,\n createApwPageBuilderContext as createPageBuilder\n} from \"./plugins/context\";\nimport { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\nimport { createAdminSettingsContext } from \"@webiny/api-admin-settings\";\n\nexport const createApwHeadlessCmsContext = (params: CreateApwContextParams) => {\n return [...createAdminSettingsContext(), ...createMailerContext(), createHeadlessCms(params)];\n};\n\nexport const createApwPageBuilderContext = (params: CreateApwContextParams) => {\n return [\n ...createAdminSettingsContext(),\n ...createMailerContext(),\n ...createMailerGraphQL(),\n createPageBuilder(params)\n ];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;;;AAIA;;AACA;;AAKA;;AACA;;AAXA;AACA;AACA;AACA;AAUO,MAAMA,2BAA2B,GAAIC,MAAD,IAAoC;EAC3E,OAAO,CAAC,GAAG,IAAAC,4CAAA,GAAJ,EAAkC,GAAG,IAAAC,8BAAA,GAArC,EAA4D,IAAAC,oCAAA,EAAkBH,MAAlB,CAA5D,CAAP;AACH,CAFM;;;;AAIA,MAAMI,2BAA2B,GAAIJ,MAAD,IAAoC;EAC3E,OAAO,CACH,GAAG,IAAAC,4CAAA,GADA,EAEH,GAAG,IAAAC,8BAAA,GAFA,EAGH,GAAG,IAAAG,8BAAA,GAHA,EAIH,IAAAC,oCAAA,EAAkBN,MAAlB,CAJG,CAAP;AAMH,CAPM;;;;AASA,MAAMO,gBAAgB,GAAG,MAAM;EAClC,OAAO,CAAC,IAAAC,gBAAA,GAAD,CAAP;AACH,CAFM"}
1
+ {"version":3,"names":["_graphql","_interopRequireDefault","require","_context","_apiMailer","createApwContext","params","createMailerContext","createMailerGraphQL","createBaseApwContext","exports","createApwGraphQL","graphql"],"sources":["index.ts"],"sourcesContent":["/**\n * We have separated context and GraphQL creation so user can initialize only context if required.\n * GraphQL will not work without context, but context will without GraphQL.\n */\nimport graphql from \"~/plugins/graphql\";\nimport { createApwContext as createBaseApwContext } from \"./plugins/context\";\nimport type { CreateApwContextParams } from \"./scheduler/types\";\nimport { createMailerContext, createMailerGraphQL } from \"@webiny/api-mailer\";\n\nexport const createApwContext = (params: CreateApwContextParams) => {\n return [...createMailerContext(), ...createMailerGraphQL(), createBaseApwContext(params)];\n};\n\nexport const createApwGraphQL = () => {\n return [graphql()];\n};\n"],"mappings":";;;;;;;AAIA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAPA;AACA;AACA;AACA;;AAMO,MAAMG,gBAAgB,GAAIC,MAA8B,IAAK;EAChE,OAAO,CAAC,GAAG,IAAAC,8BAAmB,EAAC,CAAC,EAAE,GAAG,IAAAC,8BAAmB,EAAC,CAAC,EAAE,IAAAC,yBAAoB,EAACH,MAAM,CAAC,CAAC;AAC7F,CAAC;AAACI,OAAA,CAAAL,gBAAA,GAAAA,gBAAA;AAEK,MAAMM,gBAAgB,GAAGA,CAAA,KAAM;EAClC,OAAO,CAAC,IAAAC,gBAAO,EAAC,CAAC,CAAC;AACtB,CAAC;AAACF,OAAA,CAAAC,gBAAA,GAAAA,gBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-apw",
3
- "version": "0.0.0-unstable.fcdad0bc61",
3
+ "version": "0.0.0-unstable.fdd9228b5d",
4
4
  "keywords": [
5
5
  "apw:base"
6
6
  ],
@@ -14,63 +14,45 @@
14
14
  "author": "Webiny Ltd",
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
- "@aws-sdk/client-cloudwatch-events": "3.186.0",
18
- "@babel/runtime": "7.19.0",
19
- "@commodo/fields": "1.1.2-beta.20",
20
- "@webiny/api": "0.0.0-unstable.fcdad0bc61",
21
- "@webiny/api-admin-settings": "0.0.0-unstable.fcdad0bc61",
22
- "@webiny/api-headless-cms": "0.0.0-unstable.fcdad0bc61",
23
- "@webiny/api-i18n": "0.0.0-unstable.fcdad0bc61",
24
- "@webiny/api-i18n-ddb": "0.0.0-unstable.fcdad0bc61",
25
- "@webiny/api-mailer": "0.0.0-unstable.fcdad0bc61",
26
- "@webiny/api-page-builder": "0.0.0-unstable.fcdad0bc61",
27
- "@webiny/api-security": "0.0.0-unstable.fcdad0bc61",
28
- "@webiny/api-tenancy": "0.0.0-unstable.fcdad0bc61",
29
- "@webiny/api-wcp": "0.0.0-unstable.fcdad0bc61",
30
- "@webiny/db-dynamodb": "0.0.0-unstable.fcdad0bc61",
31
- "@webiny/error": "0.0.0-unstable.fcdad0bc61",
32
- "@webiny/handler": "0.0.0-unstable.fcdad0bc61",
33
- "@webiny/handler-client": "0.0.0-unstable.fcdad0bc61",
34
- "@webiny/handler-db": "0.0.0-unstable.fcdad0bc61",
35
- "@webiny/handler-graphql": "0.0.0-unstable.fcdad0bc61",
36
- "@webiny/handler-logs": "0.0.0-unstable.fcdad0bc61",
37
- "@webiny/plugins": "0.0.0-unstable.fcdad0bc61",
38
- "@webiny/pubsub": "0.0.0-unstable.fcdad0bc61",
39
- "@webiny/utils": "0.0.0-unstable.fcdad0bc61",
40
- "@webiny/validation": "0.0.0-unstable.fcdad0bc61",
41
- "dayjs": "1.11.5",
17
+ "@webiny/api": "0.0.0-unstable.fdd9228b5d",
18
+ "@webiny/api-headless-cms": "0.0.0-unstable.fdd9228b5d",
19
+ "@webiny/api-i18n": "0.0.0-unstable.fdd9228b5d",
20
+ "@webiny/api-mailer": "0.0.0-unstable.fdd9228b5d",
21
+ "@webiny/api-security": "0.0.0-unstable.fdd9228b5d",
22
+ "@webiny/api-tenancy": "0.0.0-unstable.fdd9228b5d",
23
+ "@webiny/api-wcp": "0.0.0-unstable.fdd9228b5d",
24
+ "@webiny/aws-sdk": "0.0.0-unstable.fdd9228b5d",
25
+ "@webiny/db-dynamodb": "0.0.0-unstable.fdd9228b5d",
26
+ "@webiny/error": "0.0.0-unstable.fdd9228b5d",
27
+ "@webiny/handler": "0.0.0-unstable.fdd9228b5d",
28
+ "@webiny/handler-client": "0.0.0-unstable.fdd9228b5d",
29
+ "@webiny/handler-db": "0.0.0-unstable.fdd9228b5d",
30
+ "@webiny/handler-graphql": "0.0.0-unstable.fdd9228b5d",
31
+ "@webiny/plugins": "0.0.0-unstable.fdd9228b5d",
32
+ "@webiny/pubsub": "0.0.0-unstable.fdd9228b5d",
33
+ "@webiny/utils": "0.0.0-unstable.fdd9228b5d",
34
+ "dayjs": "1.11.13",
42
35
  "lodash": "4.17.21",
43
- "mdbid": "1.0.0"
36
+ "zod": "3.23.8"
44
37
  },
45
38
  "devDependencies": {
46
- "@babel/cli": "^7.19.3",
47
- "@babel/core": "^7.19.3",
48
- "@babel/preset-env": "^7.19.4",
49
- "@webiny/api-headless-cms-ddb": "^0.0.0-unstable.fcdad0bc61",
50
- "@webiny/api-page-builder-so-ddb": "^0.0.0-unstable.fcdad0bc61",
51
- "@webiny/api-security-so-ddb": "^0.0.0-unstable.fcdad0bc61",
52
- "@webiny/api-tenancy-so-ddb": "^0.0.0-unstable.fcdad0bc61",
53
- "@webiny/cli": "^0.0.0-unstable.fcdad0bc61",
54
- "@webiny/handler-aws": "^0.0.0-unstable.fcdad0bc61",
55
- "@webiny/project-utils": "^0.0.0-unstable.fcdad0bc61",
56
- "@webiny/wcp": "^0.0.0-unstable.fcdad0bc61",
57
- "get-yarn-workspaces": "^1.0.2",
58
- "graphql": "^15.7.2",
59
- "jest": "^28.1.0",
60
- "mdbid": "^1.0.0",
61
- "prettier": "^2.3.2",
62
- "rimraf": "^3.0.2",
63
- "sinon": "^9.0.2",
64
- "ttypescript": "^1.5.12",
65
- "typescript": "4.7.4"
39
+ "@webiny/api-page-builder": "0.0.0-unstable.fdd9228b5d",
40
+ "@webiny/handler-aws": "0.0.0-unstable.fdd9228b5d",
41
+ "@webiny/project-utils": "0.0.0-unstable.fdd9228b5d",
42
+ "@webiny/wcp": "0.0.0-unstable.fdd9228b5d",
43
+ "graphql": "15.9.0",
44
+ "jest": "29.7.0",
45
+ "prettier": "2.8.8",
46
+ "rimraf": "6.0.1",
47
+ "typescript": "5.3.3"
66
48
  },
67
49
  "publishConfig": {
68
50
  "access": "public",
69
51
  "directory": "dist"
70
52
  },
71
53
  "scripts": {
72
- "build": "yarn webiny run build",
73
- "watch": "yarn webiny run watch"
54
+ "build": "node ../cli/bin.js run build",
55
+ "watch": "node ../cli/bin.js run watch"
74
56
  },
75
- "gitHead": "40d639c3665e384a5e2d26674d43ce26f3295e8c"
57
+ "gitHead": "fdd9228b5d2636463e8a34b6e0d26eea1e29c01d"
76
58
  }
@@ -1,5 +1,5 @@
1
1
  import { ContentApwSettingsPlugin } from "../../ContentApwSettingsPlugin";
2
- import { CmsEntry } from "@webiny/api-headless-cms/types";
2
+ import type { CmsEntry } from "@webiny/api-headless-cms/types";
3
3
  import { ApwContentTypes } from "../../types";
4
4
  export declare class CmsEntryApwSettingsGetterPlugin extends ContentApwSettingsPlugin {
5
5
  canUse(type: ApwContentTypes): boolean;
@@ -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
- var _entry$meta$apw;
27
-
28
19
  if (!entry.meta) {
29
20
  return null;
30
21
  }
31
-
32
- return ((_entry$meta$apw = entry.meta.apw) === null || _entry$meta$apw === void 0 ? void 0 : _entry$meta$apw.workflowId) || null;
22
+ return entry.meta.apw?.workflowId || null;
33
23
  }
34
-
35
24
  setContentReviewId(entry, id) {
36
25
  entry.meta = (0, _set.default)(entry.meta || {}, "apw.contentReviewId", id);
37
26
  }
38
-
39
27
  getContentReviewId(entry) {
40
- var _entry$meta$apw2;
41
-
42
28
  if (!entry.meta) {
43
29
  return null;
44
30
  }
45
-
46
- return ((_entry$meta$apw2 = entry.meta.apw) === null || _entry$meta$apw2 === void 0 ? void 0 : _entry$meta$apw2.contentReviewId) || null;
31
+ return entry.meta.apw?.contentReviewId || null;
47
32
  }
48
-
49
33
  }
34
+ exports.CmsEntryApwSettingsGetterPlugin = CmsEntryApwSettingsGetterPlugin;
50
35
 
51
- exports.CmsEntryApwSettingsGetterPlugin = CmsEntryApwSettingsGetterPlugin;
36
+ //# sourceMappingURL=CmsEntryApwSettingsGetterPlugin.js.map
@@ -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":["_ContentApwSettingsPlugin","require","_types","_set","_interopRequireDefault","CmsEntryApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","CMS_ENTRY","setWorkflowId","entry","id","meta","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId","exports"],"sources":["CmsEntryApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport type { 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,IAAAA,yBAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEO,MAAMI,+BAA+B,SAASC,kDAAwB,CAAC;EAC1DC,MAAMA,CAACC,IAAqB,EAAW;IACnD,OAAOA,IAAI,KAAKC,sBAAe,CAACC,SAAS;EAC7C;EAEgBC,aAAaA,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,aAAaA,CAACJ,KAAe,EAAiB;IAC1D,IAAI,CAACA,KAAK,CAACE,IAAI,EAAE;MACb,OAAO,IAAI;IACf;IACA,OAAOF,KAAK,CAACE,IAAI,CAACG,GAAG,EAAEC,UAAU,IAAI,IAAI;EAC7C;EAEgBC,kBAAkBA,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,kBAAkBA,CAACR,KAAe,EAAiB;IAC/D,IAAI,CAACA,KAAK,CAACE,IAAI,EAAE;MACb,OAAO,IAAI;IACf;IACA,OAAOF,KAAK,CAACE,IAAI,CAACG,GAAG,EAAEI,eAAe,IAAI,IAAI;EAClD;AACJ;AAACC,OAAA,CAAAjB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { AdvancedPublishingWorkflow } from "../../types";
2
- import { HeadlessCms } from "@webiny/api-headless-cms/types";
1
+ import type { AdvancedPublishingWorkflow } from "../../types";
2
+ import type { HeadlessCms } from "@webiny/api-headless-cms/types";
3
3
  interface ApwEntryPlugins {
4
4
  apw: AdvancedPublishingWorkflow;
5
5
  cms: HeadlessCms;
@@ -1,18 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.apwEntryPlugins = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
7
  var _types = require("../../types");
13
-
14
8
  var _utils = require("./utils");
15
-
16
9
  const apwEntryPlugins = params => {
17
10
  const {
18
11
  cms,
@@ -20,16 +13,26 @@ const apwEntryPlugins = params => {
20
13
  } = params;
21
14
  apw.addContentGetter(_types.ApwContentTypes.CMS_ENTRY, async (id, settings) => {
22
15
  const model = await (0, _utils.fetchModel)(cms, id, settings);
23
- const item = await cms.getEntryById(model, id);
24
-
16
+ const item = await cms.getEntry(model, {
17
+ where: {
18
+ OR: [{
19
+ id
20
+ }, {
21
+ entryId: id
22
+ }],
23
+ latest: true
24
+ }
25
+ });
25
26
  if (!item) {
26
27
  return null;
27
28
  }
28
-
29
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
30
- meta: (0, _objectSpread2.default)({}, item.meta || {}),
29
+ return {
30
+ ...item,
31
+ meta: {
32
+ ...(item.meta || {})
33
+ },
31
34
  title: (0, _utils.getEntryTitle)(model, item)
32
- });
35
+ };
33
36
  });
34
37
  apw.addContentPublisher(_types.ApwContentTypes.CMS_ENTRY, async (id, settings) => {
35
38
  const model = await (0, _utils.fetchModel)(cms, id, settings);
@@ -42,5 +45,6 @@ const apwEntryPlugins = params => {
42
45
  return true;
43
46
  });
44
47
  };
48
+ exports.apwEntryPlugins = apwEntryPlugins;
45
49
 
46
- exports.apwEntryPlugins = apwEntryPlugins;
50
+ //# sourceMappingURL=apwEntryPlugins.js.map
@@ -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":["_types","require","_utils","apwEntryPlugins","params","cms","apw","addContentGetter","ApwContentTypes","CMS_ENTRY","id","settings","model","fetchModel","item","getEntry","where","OR","entryId","latest","meta","title","getEntryTitle","addContentPublisher","publishEntry","addContentUnPublisher","unpublishEntry","exports"],"sources":["apwEntryPlugins.ts"],"sourcesContent":["import type { AdvancedPublishingWorkflow } from \"~/types\";\nimport { ApwContentTypes } from \"~/types\";\nimport { fetchModel, getEntryTitle } from \"./utils\";\nimport type { 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.getEntry(model, {\n where: { OR: [{ id }, { entryId: id }], latest: true }\n });\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};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AAG,MAAM,IAAAC,iBAAU,EAACR,GAAG,EAAEK,EAAE,EAAEC,QAAQ,CAAC;IACjD,MAAMN,GAAG,CAACqB,cAAc,CAACd,KAAK,EAAEF,EAAE,CAAC;IACnC,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC;AAACiB,OAAA,CAAAxB,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import { AdvancedPublishingWorkflow } from "../../types";
2
- import { HeadlessCms } from "@webiny/api-headless-cms/types";
3
- import { Security } from "@webiny/api-security/types";
4
- import { PluginsContainer } from "@webiny/plugins";
1
+ import type { AdvancedPublishingWorkflow } from "../../types";
2
+ import type { HeadlessCms } from "@webiny/api-headless-cms/types";
3
+ import type { Security } from "@webiny/api-security/types";
4
+ import type { PluginsContainer } from "@webiny/plugins";
5
5
  interface ApwCmsHooksParams {
6
6
  apw: AdvancedPublishingWorkflow;
7
7
  cms: HeadlessCms;
@@ -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,6 @@ const apwCmsHooks = params => {
41
29
  (0, _triggerContentReview.triggerContentReview)(params);
42
30
  (0, _updateContentReviewStatus.updateContentReviewStatus)(params);
43
31
  };
32
+ exports.apwCmsHooks = apwCmsHooks;
44
33
 
45
- exports.apwCmsHooks = apwCmsHooks;
34
+ //# sourceMappingURL=index.js.map
@@ -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":["_apwEntryPlugins","require","_linkContentReviewToEntry","_linkWorkflowToEntry","_triggerContentReview","_updateContentReviewStatus","_CmsEntryApwSettingsGetterPlugin","_commentNotification","_contentUrl","_changeRequestNotification","_contentReviewNotification","apwCmsHooks","params","apw","cms","plugins","register","CmsEntryApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","apwEntryPlugins","linkContentReviewToEntry","linkWorkflowToEntry","triggerContentReview","updateContentReviewStatus","exports"],"sources":["index.ts"],"sourcesContent":["import type { AdvancedPublishingWorkflow } from \"~/types\";\nimport { apwEntryPlugins } from \"./apwEntryPlugins\";\nimport { linkContentReviewToEntry } from \"./linkContentReviewToEntry\";\nimport { linkWorkflowToEntry } from \"./linkWorkflowToEntry\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport type { HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport type { Security } from \"@webiny/api-security/types\";\nimport type { 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,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AACA,IAAAI,0BAAA,GAAAJ,OAAA;AAIA,IAAAK,gCAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,0BAAA,GAAAR,OAAA;AACA,IAAAS,0BAAA,GAAAT,OAAA;AAQO,MAAMU,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,CAAC,CAAC,EACrC,IAAAC,8CAAyB,EAAC,CAAC,EAC3B,IAAAC,0DAA+B,EAAC,CAAC,EACjC,IAAAC,kCAAsB,EAAC,CAAC,EACxB,IAAAC,0DAA+B,EAAC,CAAC,CACpC,CAAC;EAEF,IAAAC,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;AAACe,OAAA,CAAAhB,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { AdvancedPublishingWorkflow } from "../../types";
2
- import { HeadlessCms } from "@webiny/api-headless-cms/types";
1
+ import type { AdvancedPublishingWorkflow } from "../../types";
2
+ import type { HeadlessCms } from "@webiny/api-headless-cms/types";
3
3
  interface LinkContentReviewToEntryParams {
4
4
  apw: AdvancedPublishingWorkflow;
5
5
  cms: HeadlessCms;