@webiny/api-apw 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.9bd236cf5e

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 (313) hide show
  1. package/ApwChangeRequestNotification.d.ts +1 -1
  2. package/ApwChangeRequestNotification.js +4 -6
  3. package/ApwChangeRequestNotification.js.map +1 -1
  4. package/ApwCommentNotification.d.ts +1 -1
  5. package/ApwCommentNotification.js +4 -6
  6. package/ApwCommentNotification.js.map +1 -1
  7. package/ApwContentReviewNotification.d.ts +1 -1
  8. package/ApwContentReviewNotification.js +4 -6
  9. package/ApwContentReviewNotification.js.map +1 -1
  10. package/ApwContentUrlPlugin.d.ts +1 -1
  11. package/ApwContentUrlPlugin.js +4 -6
  12. package/ApwContentUrlPlugin.js.map +1 -1
  13. package/ContentApwSettingsPlugin.d.ts +1 -1
  14. package/ContentApwSettingsPlugin.js +5 -4
  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 +3 -1
  19. package/crud/createChangeRequestMethods.js.map +1 -1
  20. package/crud/createCommentMethods.d.ts +1 -1
  21. package/crud/createCommentMethods.js +3 -1
  22. package/crud/createCommentMethods.js.map +1 -1
  23. package/crud/createContentReviewMethods.d.ts +2 -2
  24. package/crud/createContentReviewMethods.js +41 -31
  25. package/crud/createContentReviewMethods.js.map +1 -1
  26. package/crud/createReviewerMethods.d.ts +1 -1
  27. package/crud/createReviewerMethods.js +3 -1
  28. package/crud/createReviewerMethods.js.map +1 -1
  29. package/crud/createWorkflowMethods.d.ts +1 -1
  30. package/crud/createWorkflowMethods.js +3 -1
  31. package/crud/createWorkflowMethods.js.map +1 -1
  32. package/crud/index.d.ts +1 -1
  33. package/crud/index.js +6 -5
  34. package/crud/index.js.map +1 -1
  35. package/crud/utils.d.ts +2 -2
  36. package/crud/utils.js +8 -8
  37. package/crud/utils.js.map +1 -1
  38. package/index.d.ts +2 -2
  39. package/index.js +7 -6
  40. package/index.js.map +1 -1
  41. package/package.json +33 -44
  42. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +1 -1
  43. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +5 -5
  44. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  45. package/plugins/cms/apwEntryPlugins.d.ts +2 -2
  46. package/plugins/cms/apwEntryPlugins.js +19 -7
  47. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  48. package/plugins/cms/index.d.ts +4 -4
  49. package/plugins/cms/index.js +3 -1
  50. package/plugins/cms/index.js.map +1 -1
  51. package/plugins/cms/linkContentReviewToEntry.d.ts +2 -2
  52. package/plugins/cms/linkContentReviewToEntry.js +5 -4
  53. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  54. package/plugins/cms/linkWorkflowToEntry.d.ts +2 -2
  55. package/plugins/cms/linkWorkflowToEntry.js +17 -16
  56. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  57. package/plugins/cms/notifications/changeRequestNotification.js +3 -1
  58. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -1
  59. package/plugins/cms/notifications/commentNotification.js +3 -1
  60. package/plugins/cms/notifications/commentNotification.js.map +1 -1
  61. package/plugins/cms/notifications/contentReviewNotification.js +3 -1
  62. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -1
  63. package/plugins/cms/notifications/contentUrl.js +3 -1
  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 +6 -5
  67. package/plugins/cms/triggerContentReview.js.map +1 -1
  68. package/plugins/cms/updateContentReviewStatus.d.ts +3 -3
  69. package/plugins/cms/updateContentReviewStatus.js +15 -13
  70. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  71. package/plugins/cms/utils.d.ts +5 -4
  72. package/plugins/cms/utils.js +19 -13
  73. package/plugins/cms/utils.js.map +1 -1
  74. package/plugins/context.d.ts +3 -3
  75. package/plugins/context.js +5 -14
  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 -13
  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 -36
  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 +23 -14
  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 -13
  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 -13
  94. package/plugins/graphql/workflow.gql.js.map +1 -1
  95. package/plugins/graphql.d.ts +1 -1
  96. package/plugins/graphql.js +3 -1
  97. package/plugins/graphql.js.map +1 -1
  98. package/plugins/hooks/createReviewerFromIdentity.d.ts +1 -1
  99. package/plugins/hooks/createReviewerFromIdentity.js +4 -2
  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 -1
  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 -1
  106. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  107. package/plugins/hooks/index.d.ts +1 -1
  108. package/plugins/hooks/index.js +3 -1
  109. package/plugins/hooks/index.js.map +1 -1
  110. package/plugins/hooks/initializeContentReviewSteps.d.ts +1 -1
  111. package/plugins/hooks/initializeContentReviewSteps.js +6 -4
  112. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  113. package/plugins/hooks/initializeNotifications.d.ts +1 -1
  114. package/plugins/hooks/initializeNotifications.js +3 -1
  115. package/plugins/hooks/initializeNotifications.js.map +1 -1
  116. package/plugins/hooks/listContentReviews.d.ts +3 -3
  117. package/plugins/hooks/listContentReviews.js +4 -2
  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 +5 -3
  121. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
  122. package/plugins/hooks/notifications/changeRequestUrl.js +3 -1
  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 +5 -3
  126. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
  127. package/plugins/hooks/notifications/commentUrl.js +3 -1
  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 +6 -4
  131. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
  132. package/plugins/hooks/notifications/contentReviewUrl.js +3 -1
  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 +3 -1
  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 +3 -1
  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 +3 -1
  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 +3 -1
  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 +3 -1
  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 +3 -1
  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 +3 -1
  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 +3 -1
  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 +8 -6
  163. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  164. package/plugins/hooks/updateTotalComments.d.ts +1 -1
  165. package/plugins/hooks/updateTotalComments.js +22 -15
  166. package/plugins/hooks/updateTotalComments.js.map +1 -1
  167. package/plugins/hooks/validateChangeRequest.d.ts +1 -1
  168. package/plugins/hooks/validateChangeRequest.js +3 -1
  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 -1
  172. package/plugins/hooks/validateComment.js.map +1 -1
  173. package/plugins/hooks/validateContentReview.d.ts +1 -1
  174. package/plugins/hooks/validateContentReview.js +3 -1
  175. package/plugins/hooks/validateContentReview.js.map +1 -1
  176. package/plugins/utils.d.ts +7 -6
  177. package/plugins/utils.js +12 -8
  178. package/plugins/utils.js.map +1 -1
  179. package/scheduler/createScheduleActionMethods.d.ts +1 -1
  180. package/scheduler/createScheduleActionMethods.js +103 -59
  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 +5 -5
  184. package/scheduler/handlers/executeAction/index.js.map +1 -1
  185. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +5 -4
  186. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  187. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -1
  188. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +6 -7
  189. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  190. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +3 -2
  191. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +4 -7
  192. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  193. package/scheduler/handlers/executeAction/security.d.ts +2 -2
  194. package/scheduler/handlers/executeAction/security.js +3 -1
  195. package/scheduler/handlers/executeAction/security.js.map +1 -1
  196. package/scheduler/handlers/scheduleAction/index.d.ts +2 -2
  197. package/scheduler/handlers/scheduleAction/index.js +15 -14
  198. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  199. package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +3 -3
  200. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +17 -14
  201. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  202. package/scheduler/handlers/utils.d.ts +2 -3
  203. package/scheduler/handlers/utils.js +20 -13
  204. package/scheduler/handlers/utils.js.map +1 -1
  205. package/scheduler/index.d.ts +1 -1
  206. package/scheduler/index.js +3 -1
  207. package/scheduler/index.js.map +1 -1
  208. package/scheduler/types.d.ts +19 -17
  209. package/scheduler/types.js +11 -12
  210. package/scheduler/types.js.map +1 -1
  211. package/storageOperations/changeRequestStorageOperations.d.ts +2 -2
  212. package/storageOperations/changeRequestStorageOperations.js +45 -24
  213. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  214. package/storageOperations/commentStorageOperations.d.ts +3 -3
  215. package/storageOperations/commentStorageOperations.js +23 -30
  216. package/storageOperations/commentStorageOperations.js.map +1 -1
  217. package/storageOperations/contentReviewStorageOperations.d.ts +3 -3
  218. package/storageOperations/contentReviewStorageOperations.js +22 -27
  219. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  220. package/storageOperations/index.d.ts +3 -9
  221. package/storageOperations/index.js +11 -16
  222. package/storageOperations/index.js.map +1 -1
  223. package/storageOperations/models/changeRequest.model.d.ts +1 -2
  224. package/storageOperations/models/changeRequest.model.js +10 -11
  225. package/storageOperations/models/changeRequest.model.js.map +1 -1
  226. package/storageOperations/models/comment.model.d.ts +1 -2
  227. package/storageOperations/models/comment.model.js +10 -11
  228. package/storageOperations/models/comment.model.js.map +1 -1
  229. package/storageOperations/models/contentReview.model.d.ts +1 -2
  230. package/storageOperations/models/contentReview.model.js +16 -15
  231. package/storageOperations/models/contentReview.model.js.map +1 -1
  232. package/storageOperations/models/index.d.ts +1 -1
  233. package/storageOperations/models/index.js +11 -29
  234. package/storageOperations/models/index.js.map +1 -1
  235. package/storageOperations/models/reviewer.model.d.ts +1 -2
  236. package/storageOperations/models/reviewer.model.js +11 -12
  237. package/storageOperations/models/reviewer.model.js.map +1 -1
  238. package/storageOperations/models/utils.d.ts +2 -2
  239. package/storageOperations/models/utils.js +3 -1
  240. package/storageOperations/models/utils.js.map +1 -1
  241. package/storageOperations/models/workflow.model.d.ts +2 -3
  242. package/storageOperations/models/workflow.model.js +22 -23
  243. package/storageOperations/models/workflow.model.js.map +1 -1
  244. package/storageOperations/reviewerStorageOperations.d.ts +3 -3
  245. package/storageOperations/reviewerStorageOperations.js +22 -27
  246. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  247. package/storageOperations/types.d.ts +2 -2
  248. package/storageOperations/types.js +3 -1
  249. package/storageOperations/types.js.map +1 -1
  250. package/storageOperations/workflowStorageOperations.d.ts +2 -2
  251. package/storageOperations/workflowStorageOperations.js +29 -32
  252. package/storageOperations/workflowStorageOperations.js.map +1 -1
  253. package/types.d.ts +46 -62
  254. package/types.js +121 -29
  255. package/types.js.map +1 -1
  256. package/utils/contentApwSettingsPlugin.d.ts +2 -2
  257. package/utils/contentApwSettingsPlugin.js +3 -1
  258. package/utils/contentApwSettingsPlugin.js.map +1 -1
  259. package/utils/errors.js +3 -1
  260. package/utils/errors.js.map +1 -1
  261. package/utils/fieldResolver.d.ts +2 -2
  262. package/utils/fieldResolver.js +7 -7
  263. package/utils/fieldResolver.js.map +1 -1
  264. package/utils/pickEntryFieldValues.d.ts +3 -0
  265. package/utils/pickEntryFieldValues.js +30 -0
  266. package/utils/pickEntryFieldValues.js.map +1 -0
  267. package/utils/resolve.js +3 -1
  268. package/utils/resolve.js.map +1 -1
  269. package/plugins/hooks/notifications/appUrl.d.ts +0 -2
  270. package/plugins/hooks/notifications/appUrl.js +0 -18
  271. package/plugins/hooks/notifications/appUrl.js.map +0 -1
  272. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +0 -9
  273. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -36
  274. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +0 -1
  275. package/plugins/pageBuilder/apwContentPagePlugins.d.ts +0 -3
  276. package/plugins/pageBuilder/apwContentPagePlugins.js +0 -26
  277. package/plugins/pageBuilder/apwContentPagePlugins.js.map +0 -1
  278. package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +0 -3
  279. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +0 -20
  280. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +0 -1
  281. package/plugins/pageBuilder/index.d.ts +0 -11
  282. package/plugins/pageBuilder/index.js +0 -42
  283. package/plugins/pageBuilder/index.js.map +0 -1
  284. package/plugins/pageBuilder/linkContentReviewToPage.d.ts +0 -8
  285. package/plugins/pageBuilder/linkContentReviewToPage.js +0 -89
  286. package/plugins/pageBuilder/linkContentReviewToPage.js.map +0 -1
  287. package/plugins/pageBuilder/linkWorkflowToPage.d.ts +0 -8
  288. package/plugins/pageBuilder/linkWorkflowToPage.js +0 -164
  289. package/plugins/pageBuilder/linkWorkflowToPage.js.map +0 -1
  290. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +0 -1
  291. package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -31
  292. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +0 -1
  293. package/plugins/pageBuilder/notifications/commentNotification.d.ts +0 -1
  294. package/plugins/pageBuilder/notifications/commentNotification.js +0 -31
  295. package/plugins/pageBuilder/notifications/commentNotification.js.map +0 -1
  296. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +0 -1
  297. package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -31
  298. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +0 -1
  299. package/plugins/pageBuilder/notifications/contentUrl.d.ts +0 -1
  300. package/plugins/pageBuilder/notifications/contentUrl.js +0 -47
  301. package/plugins/pageBuilder/notifications/contentUrl.js.map +0 -1
  302. package/plugins/pageBuilder/triggerContentReview.d.ts +0 -8
  303. package/plugins/pageBuilder/triggerContentReview.js +0 -39
  304. package/plugins/pageBuilder/triggerContentReview.js.map +0 -1
  305. package/plugins/pageBuilder/updateContentReviewStatus.d.ts +0 -10
  306. package/plugins/pageBuilder/updateContentReviewStatus.js +0 -67
  307. package/plugins/pageBuilder/updateContentReviewStatus.js.map +0 -1
  308. package/plugins/pageBuilder/utils.d.ts +0 -22
  309. package/plugins/pageBuilder/utils.js +0 -150
  310. package/plugins/pageBuilder/utils.js.map +0 -1
  311. package/storageOperations/models/contentModelPluginFactory.d.ts +0 -8
  312. package/storageOperations/models/contentModelPluginFactory.js +0 -20
  313. package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -5,17 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createReviewerStorageOperations = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _index = require("./index");
8
+ var _pickEntryFieldValues = require("../utils/pickEntryFieldValues");
10
9
  var _error = _interopRequireDefault(require("@webiny/error"));
11
10
  const createReviewerStorageOperations = ({
12
- cms,
13
- security
11
+ cms
14
12
  }) => {
15
13
  const getReviewerModel = async () => {
16
- const model = await security.withoutAuthorization(async () => {
17
- return cms.getModel("apwReviewerModelDefinition");
18
- });
14
+ const model = await cms.getModel("apwReviewerModelDefinition");
19
15
  if (!model) {
20
16
  throw new _error.default("Could not find `apwReviewerModelDefinition` model.", "MODEL_NOT_FOUND_ERROR");
21
17
  }
@@ -25,29 +21,26 @@ const createReviewerStorageOperations = ({
25
21
  id
26
22
  }) => {
27
23
  const model = await getReviewerModel();
28
- const entry = await security.withoutAuthorization(async () => {
29
- return cms.getEntryById(model, id);
30
- });
31
- return (0, _index.getFieldValues)(entry, _index.baseFields);
24
+ const entry = await cms.getEntryById(model, id);
25
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
32
26
  };
33
27
  return {
34
28
  getReviewerModel,
35
29
  getReviewer,
36
30
  async listReviewers(params) {
37
31
  const model = await getReviewerModel();
38
- const [entries, meta] = await security.withoutAuthorization(async () => {
39
- return cms.listLatestEntries(model, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
40
- where: (0, _objectSpread2.default)({}, params.where)
41
- }));
32
+ const [entries, meta] = await cms.listLatestEntries(model, {
33
+ ...params,
34
+ where: {
35
+ ...params.where
36
+ }
42
37
  });
43
- return [entries.map(entry => (0, _index.getFieldValues)(entry, _index.baseFields)), meta];
38
+ return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
44
39
  },
45
40
  async createReviewer(params) {
46
41
  const model = await getReviewerModel();
47
- const entry = await security.withoutAuthorization(async () => {
48
- return cms.createEntry(model, params.data);
49
- });
50
- return (0, _index.getFieldValues)(entry, _index.baseFields);
42
+ const entry = await cms.createEntry(model, params.data);
43
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
51
44
  },
52
45
  async updateReviewer(params) {
53
46
  const model = await getReviewerModel();
@@ -58,18 +51,20 @@ const createReviewerStorageOperations = ({
58
51
  const existingEntry = await getReviewer({
59
52
  id: params.id
60
53
  });
61
- const entry = await security.withoutAuthorization(async () => {
62
- return cms.updateEntry(model, params.id, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, existingEntry), params.data));
54
+ const entry = await cms.updateEntry(model, params.id, {
55
+ ...existingEntry,
56
+ ...params.data,
57
+ savedOn: new Date()
63
58
  });
64
- return (0, _index.getFieldValues)(entry, _index.baseFields);
59
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
65
60
  },
66
61
  async deleteReviewer(params) {
67
62
  const model = await getReviewerModel();
68
- await security.withoutAuthorization(async () => {
69
- return cms.deleteEntry(model, params.id);
70
- });
63
+ await cms.deleteEntry(model, params.id);
71
64
  return true;
72
65
  }
73
66
  };
74
67
  };
75
- exports.createReviewerStorageOperations = createReviewerStorageOperations;
68
+ exports.createReviewerStorageOperations = createReviewerStorageOperations;
69
+
70
+ //# sourceMappingURL=reviewerStorageOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createReviewerStorageOperations","cms","security","getReviewerModel","model","withoutAuthorization","getModel","WebinyError","getReviewer","id","entry","getEntryById","getFieldValues","baseFields","listReviewers","params","entries","meta","listLatestEntries","where","map","createReviewer","createEntry","data","updateReviewer","existingEntry","updateEntry","deleteReviewer","deleteEntry"],"sources":["reviewerStorageOperations.ts"],"sourcesContent":["import { ApwReviewerStorageOperations } from \"./types\";\nimport {\n baseFields,\n CreateApwStorageOperationsParams,\n getFieldValues\n} from \"~/storageOperations/index\";\nimport WebinyError from \"@webiny/error\";\n\nexport const createReviewerStorageOperations = ({\n cms,\n security\n}: CreateApwStorageOperationsParams): ApwReviewerStorageOperations => {\n const getReviewerModel = async () => {\n const model = await security.withoutAuthorization(async () => {\n return cms.getModel(\"apwReviewerModelDefinition\");\n });\n if (!model) {\n throw new WebinyError(\n \"Could not find `apwReviewerModelDefinition` model.\",\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getReviewer: ApwReviewerStorageOperations[\"getReviewer\"] = async ({ id }) => {\n const model = await getReviewerModel();\n\n const entry = await security.withoutAuthorization(async () => {\n return cms.getEntryById(model, id);\n });\n return getFieldValues(entry, baseFields);\n };\n return {\n getReviewerModel,\n getReviewer,\n async listReviewers(params) {\n const model = await getReviewerModel();\n\n const [entries, meta] = await security.withoutAuthorization(async () => {\n return cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n });\n return [entries.map(entry => getFieldValues(entry, baseFields)), meta];\n },\n async createReviewer(params) {\n const model = await getReviewerModel();\n const entry = await security.withoutAuthorization(async () => {\n return cms.createEntry(model, params.data);\n });\n return getFieldValues(entry, baseFields);\n },\n async updateReviewer(params) {\n const model = await getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getReviewer({ id: params.id });\n\n const entry = await security.withoutAuthorization(async () => {\n return cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data\n });\n });\n return getFieldValues(entry, baseFields);\n },\n async deleteReviewer(params) {\n const model = await getReviewerModel();\n\n await security.withoutAuthorization(async () => {\n return cms.deleteEntry(model, params.id);\n });\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;;AACA;AAKA;AAEO,MAAMA,+BAA+B,GAAG,CAAC;EAC5CC,GAAG;EACHC;AAC8B,CAAC,KAAmC;EAClE,MAAMC,gBAAgB,GAAG,YAAY;IACjC,MAAMC,KAAK,GAAG,MAAMF,QAAQ,CAACG,oBAAoB,CAAC,YAAY;MAC1D,OAAOJ,GAAG,CAACK,QAAQ,CAAC,4BAA4B,CAAC;IACrD,CAAC,CAAC;IACF,IAAI,CAACF,KAAK,EAAE;MACR,MAAM,IAAIG,cAAW,CACjB,oDAAoD,EACpD,uBAAuB,CAC1B;IACL;IACA,OAAOH,KAAK;EAChB,CAAC;EACD,MAAMI,WAAwD,GAAG,OAAO;IAAEC;EAAG,CAAC,KAAK;IAC/E,MAAML,KAAK,GAAG,MAAMD,gBAAgB,EAAE;IAEtC,MAAMO,KAAK,GAAG,MAAMR,QAAQ,CAACG,oBAAoB,CAAC,YAAY;MAC1D,OAAOJ,GAAG,CAACU,YAAY,CAACP,KAAK,EAAEK,EAAE,CAAC;IACtC,CAAC,CAAC;IACF,OAAO,IAAAG,qBAAc,EAACF,KAAK,EAAEG,iBAAU,CAAC;EAC5C,CAAC;EACD,OAAO;IACHV,gBAAgB;IAChBK,WAAW;IACX,MAAMM,aAAa,CAACC,MAAM,EAAE;MACxB,MAAMX,KAAK,GAAG,MAAMD,gBAAgB,EAAE;MAEtC,MAAM,CAACa,OAAO,EAAEC,IAAI,CAAC,GAAG,MAAMf,QAAQ,CAACG,oBAAoB,CAAC,YAAY;QACpE,OAAOJ,GAAG,CAACiB,iBAAiB,CAACd,KAAK,8DAC3BW,MAAM;UACTI,KAAK,kCACEJ,MAAM,CAACI,KAAK;QAClB,GACH;MACN,CAAC,CAAC;MACF,OAAO,CAAC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ldValues","require","_error","_interopRequireDefault","createReviewerStorageOperations","cms","getReviewerModel","model","getModel","WebinyError","getReviewer","id","entry","getEntryById","pickEntryFieldValues","listReviewers","params","entries","meta","listLatestEntries","where","map","createReviewer","createEntry","data","updateReviewer","existingEntry","updateEntry","savedOn","Date","deleteReviewer","deleteEntry","exports"],"sources":["reviewerStorageOperations.ts"],"sourcesContent":["import type { ApwReviewerStorageOperations } from \"./types\";\nimport type { CreateApwStorageOperationsParams } from \"~/storageOperations\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport type { ApwReviewer } from \"~/types\";\n\nexport const createReviewerStorageOperations = ({\n cms\n}: CreateApwStorageOperationsParams): ApwReviewerStorageOperations => {\n const getReviewerModel = async () => {\n const model = await cms.getModel(\"apwReviewerModelDefinition\");\n if (!model) {\n throw new WebinyError(\n \"Could not find `apwReviewerModelDefinition` model.\",\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getReviewer: ApwReviewerStorageOperations[\"getReviewer\"] = async ({ id }) => {\n const model = await getReviewerModel();\n\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getReviewerModel,\n getReviewer,\n async listReviewers(params) {\n const model = await getReviewerModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwReviewer>), meta];\n },\n async createReviewer(params) {\n const model = await getReviewerModel();\n const entry = await cms.createEntry(model, params.data);\n return pickEntryFieldValues(entry);\n },\n async updateReviewer(params) {\n const model = await getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getReviewer({ id: params.id });\n\n const entry = await cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n return pickEntryFieldValues(entry);\n },\n async deleteReviewer(params) {\n const model =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G,MAAMP,GAAG,CAACkB,WAAW,CAAChB,KAAK,EAAES,MAAM,CAACQ,IAAI,CAAC;MACvD,OAAO,IAAAV,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMa,cAAcA,CAACT,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MACtC;AACZ;AACA;AACA;MACY,MAAMoB,aAAa,GAAG,MAAMhB,WAAW,CAAC;QAAEC,EAAE,EAAEK,MAAM,CAACL;MAAG,CAAC,CAAC;MAE1D,MAAMC,KAAK,GAAG,MAAMP,GAAG,CAACsB,WAAW,CAACpB,KAAK,EAAES,MAAM,CAACL,EAAE,EAAE;QAClD,GAAGe,aAAa;QAChB,GAAGV,MAAM,CAACQ,IAAI;QACdI,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC,CAAC;MACF,OAAO,IAAAf,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAACd,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAES,MAAM,CAACL,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAACqB,OAAA,CAAA5B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { CmsModel } from "@webiny/api-headless-cms/types";
2
- import { ApwReviewerStorageOperations as BaseApwReviewerStorageOperations, ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations, ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations, ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations, ApwCommentStorageOperations as BaseApwCommentStorageOperations } from "../types";
1
+ import type { CmsModel } from "@webiny/api-headless-cms/types";
2
+ import type { ApwReviewerStorageOperations as BaseApwReviewerStorageOperations, ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations, ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations, ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations, ApwCommentStorageOperations as BaseApwCommentStorageOperations } from "../types";
3
3
  export interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {
4
4
  /**
5
5
  * @internal
@@ -2,4 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
5
+ });
6
+
7
+ //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport {\n ApwReviewerStorageOperations as BaseApwReviewerStorageOperations,\n ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations,\n ApwCommentStorageOperations as BaseApwCommentStorageOperations\n} from \"~/types\";\n\nexport interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {\n /**\n * @internal\n */\n getCommentModel(): Promise<CmsModel>;\n}\n\nexport interface ApwReviewerStorageOperations extends BaseApwReviewerStorageOperations {\n /**\n * @internal\n */\n getReviewerModel(): Promise<CmsModel>;\n}\n\nexport interface ApwWorkflowStorageOperations extends BaseApwWorkflowStorageOperations {\n /**\n * @internal\n */\n getWorkflowModel(): Promise<CmsModel>;\n}\n\nexport interface ApwContentReviewStorageOperations extends BaseApwContentReviewStorageOperations {\n /**\n * @internal\n */\n getContentReviewModel(): Promise<CmsModel>;\n}\n\nexport interface ApwChangeRequestStorageOperations extends BaseApwChangeRequestStorageOperations {\n /**\n * @internal\n */\n getChangeRequestModel(): Promise<CmsModel>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport type {\n ApwReviewerStorageOperations as BaseApwReviewerStorageOperations,\n ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations,\n ApwCommentStorageOperations as BaseApwCommentStorageOperations\n} from \"~/types\";\n\nexport interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {\n /**\n * @internal\n */\n getCommentModel(): Promise<CmsModel>;\n}\n\nexport interface ApwReviewerStorageOperations extends BaseApwReviewerStorageOperations {\n /**\n * @internal\n */\n getReviewerModel(): Promise<CmsModel>;\n}\n\nexport interface ApwWorkflowStorageOperations extends BaseApwWorkflowStorageOperations {\n /**\n * @internal\n */\n getWorkflowModel(): Promise<CmsModel>;\n}\n\nexport interface ApwContentReviewStorageOperations extends BaseApwContentReviewStorageOperations {\n /**\n * @internal\n */\n getContentReviewModel(): Promise<CmsModel>;\n}\n\nexport interface ApwChangeRequestStorageOperations extends BaseApwChangeRequestStorageOperations {\n /**\n * @internal\n */\n getChangeRequestModel(): Promise<CmsModel>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { ApwWorkflowStorageOperations } from "./types";
2
- import { CreateApwStorageOperationsParams } from "./index";
1
+ import type { ApwWorkflowStorageOperations } from "./types";
2
+ import type { CreateApwStorageOperationsParams } from "./index";
3
3
  export declare const createWorkflowStorageOperations: (params: CreateApwStorageOperationsParams) => ApwWorkflowStorageOperations;
@@ -5,29 +5,27 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createWorkflowStorageOperations = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _index = require("./index");
8
+ var _pickEntryFieldValues = require("../utils/pickEntryFieldValues");
10
9
  var _error = _interopRequireDefault(require("@webiny/error"));
11
10
  var _workflow = require("./models/workflow.model");
12
11
  const formatReviewersForRefInput = (data, modelId) => {
13
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
14
- steps: data.steps.map(step => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
12
+ return {
13
+ ...data,
14
+ steps: data.steps.map(step => ({
15
+ ...step,
15
16
  reviewers: step.reviewers.map(id => ({
16
17
  id,
17
18
  modelId
18
19
  }))
19
20
  }))
20
- });
21
+ };
21
22
  };
22
23
  const createWorkflowStorageOperations = params => {
23
24
  const {
24
- cms,
25
- security
25
+ cms
26
26
  } = params;
27
27
  const getWorkflowModel = async () => {
28
- const model = await security.withoutAuthorization(async () => {
29
- return cms.getModel(_workflow.WORKFLOW_MODEL_ID);
30
- });
28
+ const model = await cms.getModel(_workflow.WORKFLOW_MODEL_ID);
31
29
  if (!model) {
32
30
  throw new _error.default(`Could not find "${_workflow.WORKFLOW_MODEL_ID}" model.`, "MODEL_NOT_FOUND_ERROR");
33
31
  }
@@ -37,31 +35,28 @@ const createWorkflowStorageOperations = params => {
37
35
  id
38
36
  }) => {
39
37
  const model = await getWorkflowModel();
40
- const entry = await security.withoutAuthorization(async () => {
41
- return cms.getEntryById(model, id);
42
- });
43
- return (0, _index.getFieldValues)(entry, _index.baseFields);
38
+ const entry = await cms.getEntryById(model, id);
39
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
44
40
  };
45
41
  return {
46
42
  getWorkflowModel,
47
43
  getWorkflow,
48
44
  async listWorkflows(params) {
49
45
  const model = await getWorkflowModel();
50
- const [entries, meta] = await security.withoutAuthorization(async () => {
51
- return cms.listLatestEntries(model, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
52
- where: (0, _objectSpread2.default)({}, params.where)
53
- }));
46
+ const [entries, meta] = await cms.listLatestEntries(model, {
47
+ ...params,
48
+ where: {
49
+ ...params.where
50
+ }
54
51
  });
55
- return [entries.map(entry => (0, _index.getFieldValues)(entry, _index.baseFields)), meta];
52
+ return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
56
53
  },
57
54
  async createWorkflow(params) {
58
55
  const model = await getWorkflowModel();
59
56
  const reviewerModel = await this.getReviewerModel();
60
57
  const data = formatReviewersForRefInput(params.data, reviewerModel.modelId);
61
- const entry = await security.withoutAuthorization(async () => {
62
- return cms.createEntry(model, data);
63
- });
64
- return (0, _index.getFieldValues)(entry, _index.baseFields);
58
+ const entry = await cms.createEntry(model, data);
59
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
65
60
  },
66
61
  async updateWorkflow(params) {
67
62
  const model = await getWorkflowModel();
@@ -73,20 +68,22 @@ const createWorkflowStorageOperations = params => {
73
68
  const existingEntry = await getWorkflow({
74
69
  id: params.id
75
70
  });
76
- const input = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, existingEntry), params.data);
71
+ const input = {
72
+ ...existingEntry,
73
+ ...params.data,
74
+ savedOn: new Date()
75
+ };
77
76
  const data = formatReviewersForRefInput(input, reviewerModel.modelId);
78
- const entry = await security.withoutAuthorization(async () => {
79
- return cms.updateEntry(model, params.id, data);
80
- });
81
- return (0, _index.getFieldValues)(entry, _index.baseFields);
77
+ const entry = await cms.updateEntry(model, params.id, data);
78
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
82
79
  },
83
80
  async deleteWorkflow(params) {
84
81
  const model = await getWorkflowModel();
85
- await security.withoutAuthorization(async () => {
86
- return cms.deleteEntry(model, params.id);
87
- });
82
+ await cms.deleteEntry(model, params.id);
88
83
  return true;
89
84
  }
90
85
  };
91
86
  };
92
- exports.createWorkflowStorageOperations = createWorkflowStorageOperations;
87
+ exports.createWorkflowStorageOperations = createWorkflowStorageOperations;
88
+
89
+ //# sourceMappingURL=workflowStorageOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["formatReviewersForRefInput","data","modelId","steps","map","step","reviewers","id","createWorkflowStorageOperations","params","cms","security","getWorkflowModel","model","withoutAuthorization","getModel","WORKFLOW_MODEL_ID","WebinyError","getWorkflow","entry","getEntryById","getFieldValues","baseFields","listWorkflows","entries","meta","listLatestEntries","where","createWorkflow","reviewerModel","getReviewerModel","createEntry","updateWorkflow","existingEntry","input","updateEntry","deleteWorkflow","deleteEntry"],"sources":["workflowStorageOperations.ts"],"sourcesContent":["import { CreateApwWorkflowParams } from \"~/types\";\nimport { ApwStorageOperations, ApwWorkflowStorageOperations } from \"./types\";\nimport {\n baseFields,\n CreateApwStorageOperationsParams,\n getFieldValues\n} from \"~/storageOperations/index\";\nimport WebinyError from \"@webiny/error\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\ntype ReviewersRefInput = CreateApwWorkflowParams<{ modelId: string; id: string }>;\n\nconst formatReviewersForRefInput = (\n data: CreateApwWorkflowParams,\n modelId: string\n): ReviewersRefInput => {\n return {\n ...data,\n steps: data.steps.map(step => ({\n ...step,\n reviewers: step.reviewers.map(id => ({\n id,\n modelId\n }))\n }))\n };\n};\n\nexport const createWorkflowStorageOperations = (\n params: CreateApwStorageOperationsParams\n): ApwWorkflowStorageOperations => {\n const { cms, security } = params;\n const getWorkflowModel = async () => {\n const model = await security.withoutAuthorization(async () => {\n return cms.getModel(WORKFLOW_MODEL_ID);\n });\n if (!model) {\n throw new WebinyError(\n `Could not find \"${WORKFLOW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getWorkflow: ApwWorkflowStorageOperations[\"getWorkflow\"] = async ({ id }) => {\n const model = await getWorkflowModel();\n const entry = await security.withoutAuthorization(async () => {\n return cms.getEntryById(model, id);\n });\n return getFieldValues(entry, baseFields);\n };\n return {\n getWorkflowModel,\n getWorkflow,\n async listWorkflows(params) {\n const model = await getWorkflowModel();\n\n const [entries, meta] = await security.withoutAuthorization(async () => {\n return cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n });\n return [entries.map(entry => getFieldValues(entry, baseFields)), meta];\n },\n async createWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n\n const data = formatReviewersForRefInput(params.data, reviewerModel.modelId);\n\n const entry = await security.withoutAuthorization(async () => {\n return cms.createEntry(model, data);\n });\n\n return getFieldValues(entry, baseFields);\n },\n async updateWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getWorkflow({ id: params.id });\n const input = {\n ...existingEntry,\n ...params.data\n };\n const data = formatReviewersForRefInput(\n input as CreateApwWorkflowParams,\n reviewerModel.modelId\n );\n\n const entry = await security.withoutAuthorization(async () => {\n return cms.updateEntry(model, params.id, data);\n });\n\n return getFieldValues(entry, baseFields);\n },\n async deleteWorkflow(params) {\n const model = await getWorkflowModel();\n\n await security.withoutAuthorization(async () => {\n return cms.deleteEntry(model, params.id);\n });\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;;AAEA;AAKA;AACA;AAIA,MAAMA,0BAA0B,GAAG,CAC/BC,IAA6B,EAC7BC,OAAe,KACK;EACpB,mEACOD,IAAI;IACPE,KAAK,EAAEF,IAAI,CAACE,KAAK,CAACC,GAAG,CAACC,IAAI,gEACnBA,IAAI;MACPC,SAAS,EAAED,IAAI,CAACC,SAAS,CAACF,GAAG,CAACG,EAAE,KAAK;QACjCA,EAAE;QACFL;MACJ,CAAC,CAAC;IAAC,EACL;EAAC;AAEX,CAAC;AAEM,MAAMM,+BAA+B,GACxCC,MAAwC,IACT;EAC/B,MAAM;IAAEC,GAAG;IAAEC;EAAS,CAAC,GAAGF,MAAM;EAChC,MAAMG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CAAC,CAAC;MACF,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_workflow","formatReviewersForRefInput","data","modelId","steps","map","step","reviewers","id","createWorkflowStorageOperations","params","cms","getWorkflowModel","model","getModel","WORKFLOW_MODEL_ID","WebinyError","getWorkflow","entry","getEntryById","pickEntryFieldValues","listWorkflows","entries","meta","listLatestEntries","where","createWorkflow","reviewerModel","getReviewerModel","createEntry","updateWorkflow","existingEntry","input","savedOn","Date","updateEntry","deleteWorkflow","deleteEntry","exports"],"sources":["workflowStorageOperations.ts"],"sourcesContent":["import type { ApwWorkflow, CreateApwWorkflowParams } from \"~/types\";\nimport type { ApwStorageOperations, ApwWorkflowStorageOperations } from \"./types\";\nimport type { CreateApwStorageOperationsParams } from \"~/storageOperations/index\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\ntype ReviewersRefInput = CreateApwWorkflowParams<{ modelId: string; id: string }>;\n\nconst formatReviewersForRefInput = (\n data: CreateApwWorkflowParams,\n modelId: string\n): ReviewersRefInput => {\n return {\n ...data,\n steps: data.steps.map(step => ({\n ...step,\n reviewers: step.reviewers.map(id => ({\n id,\n modelId\n }))\n }))\n };\n};\n\nexport const createWorkflowStorageOperations = (\n params: CreateApwStorageOperationsParams\n): ApwWorkflowStorageOperations => {\n const { cms } = params;\n const getWorkflowModel = async () => {\n const model = await cms.getModel(WORKFLOW_MODEL_ID);\n if (!model) {\n throw new WebinyError(\n `Could not find \"${WORKFLOW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getWorkflow: ApwWorkflowStorageOperations[\"getWorkflow\"] = async ({ id }) => {\n const model = await getWorkflowModel();\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getWorkflowModel,\n getWorkflow,\n async listWorkflows(params) {\n const model = await getWorkflowModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwWorkflow>), meta];\n },\n async createWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n\n const data = formatReviewersForRefInput(params.data, reviewerModel.modelId);\n\n const entry = await cms.createEntry(model, data);\n\n return pickEntryFieldValues(entry);\n },\n async updateWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getWorkflow({ id: params.id });\n const input = {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n };\n const data = formatReviewersForRefInput(\n input as CreateApwWorkflowParams,\n reviewerModel.modelId\n );\n\n const entry = await cms.updateEntry(model, params.id, data);\n\n return pickEntryFieldValues(entry);\n },\n async deleteWorkflow(params) {\n const model = await getWorkflowModel();\n\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAIA,MAAMI,0BAA0B,GAAGA,CAC/BC,IAA6B,EAC7BC,OAAe,KACK;EACpB,OAAO;IACH,GAAGD,IAAI;IACPE,KAAK,EAAEF,IAAI,CAACE,KAAK,CAACC,GAAG,CAACC,IAAI,KAAK;MAC3B,GAAGA,IAAI;MACPC,SAAS,EAAED,IAAI,CAACC,SAAS,CAACF,GAAG,CAACG,EAAE,KAAK;QACjCA,EAAE;QACFL;MACJ,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAEM,MAAMM,+BAA+B,GACxCC,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MAAMe,KAAK,GAAG,MAAMP,GAAG,CAACkB,WAAW,CAAChB,KAAK,EAAEX,IAAI,CAAC;MAEhD,OAAO,IAAAkB,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMY,cAAcA,CAA6BpB,MAAM,EAAE;MACrD,MAAMG,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MACtC,MAAMe,aAAa,GAAG,MAAM,IAAI,CAACC,gBAAgB,CAAC,CAAC;MACnD;AACZ;AACA;AACA;MACY,MAAMG,aAAa,GAAG,MAAMd,WAAW,CAAC;QAAET,EAAE,EAAEE,MAAM,CAACF;MAAG,CAAC,CAAC;MAC1D,MAAMwB,KAAK,GAAG;QACV,GAAGD,aAAa;QAChB,GAAGrB,MAAM,CAACR,IAAI;QACd+B,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC;MACD,MAAMhC,IAAI,GAAGD,0BAA0B,CACnC+B,KAAK,EACLL,aAAa,CAACxB,OAClB,CAAC;MAED,MAAMe,KAAK,GAAG,MAAMP,GAAG,CAACwB,WAAW,CAACtB,KAAK,EAAEH,MAAM,CAACF,EAAE,EAAEN,IAAI,CAAC;MAE3D,OAAO,IAAAkB,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAAC1B,MAAM,EAAE;MACzB,MAAMG,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAEH,MAAM,CAACF,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC8B,OAAA,CAAA7B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,18 +1,14 @@
1
- import { CmsEntry as BaseCmsEntry, OnEntryBeforePublishTopicParams, OnEntryAfterPublishTopicParams, OnEntryAfterUnpublishTopicParams } from "@webiny/api-headless-cms/types";
2
- import { Page, OnPageBeforeCreateTopicParams, OnPageBeforeCreateFromTopicParams, OnPageBeforeUpdateTopicParams, OnPageBeforePublishTopicParams, PageSettings } from "@webiny/api-page-builder/types";
3
- import { Context } from "@webiny/api/types";
4
- import { PageBuilderContextObject } from "@webiny/api-page-builder/graphql/types";
5
- import { SecurityIdentity, SecurityPermission } from "@webiny/api-security/types";
6
- import { I18NLocale } from "@webiny/api-i18n/types";
7
- import { Tenant } from "@webiny/api-tenancy/types";
8
- import { Topic } from "@webiny/pubsub/types";
9
- import { ApwScheduleActionCrud, ScheduleActionContext } from "./scheduler/types";
10
- import HandlerClient from "@webiny/handler-client/HandlerClient";
11
- import { PluginsContainer } from "@webiny/plugins";
12
- import { WcpContextObject } from "@webiny/api-wcp/types";
13
- import { MailerContext } from "@webiny/api-mailer/types";
14
- import { AdminSettingsContext } from "@webiny/api-admin-settings/types";
15
- import { CmsPrivateModelFull } from "@webiny/api-headless-cms";
1
+ import type { CmsEntry as BaseCmsEntry, OnEntryBeforePublishTopicParams, OnEntryAfterPublishTopicParams, OnEntryAfterUnpublishTopicParams, CmsEntryListSort } from "@webiny/api-headless-cms/types";
2
+ import type { Context } from "@webiny/api/types";
3
+ import type { SecurityIdentity, SecurityPermission } from "@webiny/api-security/types";
4
+ import type { I18NLocale } from "@webiny/api-i18n/types";
5
+ import type { Tenant } from "@webiny/api-tenancy/types";
6
+ import type { Topic } from "@webiny/pubsub/types";
7
+ import type { ApwScheduleActionCrud, ScheduleActionContext } from "./scheduler/types";
8
+ import type HandlerClient from "@webiny/handler-client/HandlerClient";
9
+ import type { PluginsContainer } from "@webiny/plugins";
10
+ import type { WcpContextObject } from "@webiny/api-wcp/types";
11
+ import type { MailerContext } from "@webiny/api-mailer/types";
16
12
  export interface ApwCmsEntry extends BaseCmsEntry {
17
13
  title: string;
18
14
  meta: {
@@ -47,7 +43,7 @@ export interface ListWhere {
47
43
  }
48
44
  export interface ListParams {
49
45
  where?: ListWhere;
50
- sort?: string[];
46
+ sort?: CmsEntryListSort;
51
47
  limit?: number;
52
48
  after?: string | null;
53
49
  }
@@ -69,19 +65,6 @@ export declare enum ApwContentTypes {
69
65
  PAGE = "page",
70
66
  CMS_ENTRY = "cms_entry"
71
67
  }
72
- export interface PageSettingsWithWorkflow extends PageSettings {
73
- apw: {
74
- workflowId: string;
75
- contentReviewId: string | null;
76
- };
77
- }
78
- export interface PageWithWorkflow extends Page {
79
- settings: PageSettingsWithWorkflow;
80
- }
81
- export declare type ApwOnPageBeforeCreateTopicParams = OnPageBeforeCreateTopicParams<PageWithWorkflow>;
82
- export declare type ApwOnPageBeforeCreateFromTopicParams = OnPageBeforeCreateFromTopicParams<PageWithWorkflow>;
83
- export declare type ApwOnPageBeforeUpdateTopicParams = OnPageBeforeUpdateTopicParams<PageWithWorkflow>;
84
- export declare type ApwOnPageBeforePublishTopicParams = OnPageBeforePublishTopicParams<PageWithWorkflow>;
85
68
  export declare enum WorkflowScopeTypes {
86
69
  DEFAULT = "default",
87
70
  CUSTOM = "custom"
@@ -118,8 +101,11 @@ export interface ApwBaseFields {
118
101
  id: string;
119
102
  entryId: string;
120
103
  createdOn: string;
104
+ modifiedOn: string | null;
121
105
  savedOn: string;
122
106
  createdBy: ApwIdentity;
107
+ modifiedBy: ApwIdentity;
108
+ savedBy: ApwIdentity;
123
109
  }
124
110
  export interface ApwReviewer extends ApwBaseFields {
125
111
  identityId: string;
@@ -191,7 +177,7 @@ export declare enum ApwContentReviewStatus {
191
177
  READY_TO_BE_PUBLISHED = "readyToBePublished",
192
178
  PUBLISHED = "published"
193
179
  }
194
- export declare type ApwContentReviewListFilter = ApwContentReviewStatus | "requiresMyAttention";
180
+ export type ApwContentReviewListFilter = ApwContentReviewStatus | "requiresMyAttention";
195
181
  export interface ApwWorkflowStep<TReviewer = ApwReviewer> {
196
182
  title: string;
197
183
  type: ApwWorkflowStepTypes;
@@ -281,7 +267,7 @@ interface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {
281
267
  get(id: string): Promise<TEntry>;
282
268
  create(data: TCreateEntryParams): Promise<TEntry>;
283
269
  update(id: string, data: TUpdateEntryParams): Promise<TEntry>;
284
- delete(id: string): Promise<Boolean>;
270
+ delete(id: string): Promise<boolean>;
285
271
  }
286
272
  export interface ApwWorkflowCrud extends BaseApwCrud<ApwWorkflow, CreateApwWorkflowParams, UpdateApwWorkflowParams> {
287
273
  list(params?: ListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;
@@ -350,14 +336,14 @@ export interface ApwChangeRequestCrud extends BaseApwCrud<ApwChangeRequest, Crea
350
336
  }
351
337
  export interface ApwContentReviewCrud extends BaseApwCrud<ApwContentReview, CreateApwContentReviewParams, UpdateApwContentReviewParams> {
352
338
  list(params: ApwContentReviewListParams): Promise<[ApwContentReview[], ListMeta]>;
353
- provideSignOff(id: string, step: string): Promise<Boolean>;
354
- retractSignOff(id: string, step: string): Promise<Boolean>;
339
+ provideSignOff(id: string, step: string): Promise<boolean>;
340
+ retractSignOff(id: string, step: string): Promise<boolean>;
355
341
  isReviewRequired(data: ApwContentReviewContent): Promise<{
356
342
  isReviewRequired: boolean;
357
343
  contentReviewId?: string | null;
358
344
  }>;
359
- publishContent(id: string, datetime?: string): Promise<Boolean>;
360
- unpublishContent(id: string, datetime?: string): Promise<Boolean>;
345
+ publishContent(id: string, datetime?: string): Promise<boolean>;
346
+ unpublishContent(id: string, datetime?: string): Promise<boolean>;
361
347
  scheduleAction(data: ApwScheduleActionData): Promise<string>;
362
348
  deleteScheduledAction(id: string): Promise<boolean>;
363
349
  /**
@@ -371,15 +357,15 @@ export interface ApwContentReviewCrud extends BaseApwCrud<ApwContentReview, Crea
371
357
  onContentReviewAfterDelete: Topic<OnContentReviewAfterDeleteTopicParams>;
372
358
  onContentReviewBeforeList: Topic<OnContentReviewBeforeListTopicParams>;
373
359
  }
374
- export declare type ContentGetter = (id: string, settings: {
360
+ export type ContentGetter = (id: string, settings: {
375
361
  modelId?: string;
376
- }) => Promise<PageWithWorkflow | ApwCmsEntry | null>;
377
- export declare type ContentPublisher = (id: string, settings: {
362
+ }) => Promise<ApwCmsEntry | null>;
363
+ export type ContentPublisher = (id: string, settings: {
378
364
  modelId?: string;
379
- }) => Promise<Boolean | null>;
380
- export declare type ContentUnPublisher = (id: string, settings: {
365
+ }) => Promise<boolean | null>;
366
+ export type ContentUnPublisher = (id: string, settings: {
381
367
  modelId?: string;
382
- }) => Promise<Boolean | null>;
368
+ }) => Promise<boolean | null>;
383
369
  export interface AdvancedPublishingWorkflow {
384
370
  addContentGetter: (type: ApwContentTypes, func: ContentGetter) => void;
385
371
  getContentGetter: (type: ApwContentTypes) => ContentGetter;
@@ -394,9 +380,8 @@ export interface AdvancedPublishingWorkflow {
394
380
  contentReview: ApwContentReviewCrud;
395
381
  scheduleAction: ApwScheduleActionCrud;
396
382
  }
397
- export interface ApwContext extends Context, MailerContext, AdminSettingsContext {
383
+ export interface ApwContext extends Context, MailerContext {
398
384
  apw: AdvancedPublishingWorkflow;
399
- pageBuilder: PageBuilderContextObject;
400
385
  wcp: WcpContextObject;
401
386
  scheduleAction: ScheduleActionContext["scheduleAction"];
402
387
  }
@@ -418,7 +403,7 @@ export interface CreateApwParams {
418
403
  interface StorageOperationsGetReviewerParams {
419
404
  id: string;
420
405
  }
421
- declare type StorageOperationsListReviewersParams = ApwReviewerListParams;
406
+ type StorageOperationsListReviewersParams = ApwReviewerListParams;
422
407
  interface CreateApwReviewerData {
423
408
  identityId: string;
424
409
  displayName: string | null;
@@ -447,8 +432,8 @@ interface StorageOperationsGetParams {
447
432
  interface StorageOperationsDeleteParams {
448
433
  id: string;
449
434
  }
450
- declare type StorageOperationsGetWorkflowParams = StorageOperationsGetParams;
451
- declare type StorageOperationsListWorkflowsParams = ListParams;
435
+ type StorageOperationsGetWorkflowParams = StorageOperationsGetParams;
436
+ type StorageOperationsListWorkflowsParams = ListParams;
452
437
  interface StorageOperationsCreateWorkflowParams {
453
438
  data: CreateApwWorkflowParams;
454
439
  }
@@ -456,8 +441,8 @@ interface StorageOperationsUpdateWorkflowParams {
456
441
  id: string;
457
442
  data: UpdateApwWorkflowParams;
458
443
  }
459
- declare type StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;
460
- declare type StorageOperationsGetContentReviewParams = StorageOperationsGetParams;
444
+ type StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;
445
+ type StorageOperationsGetContentReviewParams = StorageOperationsGetParams;
461
446
  export interface ApwContentReviewListParams extends ListParams {
462
447
  where: ListWhere & {
463
448
  reviewStatus?: ApwContentReviewListFilter;
@@ -467,7 +452,7 @@ export interface ApwContentReviewListParams extends ListParams {
467
452
  workflowId_in?: string[];
468
453
  };
469
454
  }
470
- declare type StorageOperationsListContentReviewsParams = ApwContentReviewListParams;
455
+ type StorageOperationsListContentReviewsParams = ApwContentReviewListParams;
471
456
  interface StorageOperationsCreateContentReviewParams {
472
457
  data: CreateApwContentReviewParams;
473
458
  }
@@ -475,9 +460,9 @@ interface StorageOperationsUpdateContentReviewParams {
475
460
  id: string;
476
461
  data: UpdateApwContentReviewParams;
477
462
  }
478
- declare type StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;
479
- declare type StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;
480
- declare type StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;
463
+ type StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;
464
+ type StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;
465
+ type StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;
481
466
  interface StorageOperationsCreateChangeRequestParams {
482
467
  data: CreateApwChangeRequestParams;
483
468
  }
@@ -485,10 +470,10 @@ interface StorageOperationsUpdateChangeRequestParams {
485
470
  id: string;
486
471
  data: UpdateApwChangeRequestParams;
487
472
  }
488
- declare type StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;
489
- declare type StorageOperationsGetCommentParams = StorageOperationsGetParams;
490
- declare type StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;
491
- declare type StorageOperationsListCommentsParams = ApwCommentListParams;
473
+ type StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;
474
+ type StorageOperationsGetCommentParams = StorageOperationsGetParams;
475
+ type StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;
476
+ type StorageOperationsListCommentsParams = ApwCommentListParams;
492
477
  interface StorageOperationsCreateCommentParams {
493
478
  data: CreateApwCommentParams;
494
479
  }
@@ -501,35 +486,35 @@ export interface ApwReviewerStorageOperations {
501
486
  listReviewers(params: StorageOperationsListReviewersParams): Promise<[ApwReviewer[], ListMeta]>;
502
487
  createReviewer(params: StorageOperationsCreateReviewerParams): Promise<ApwReviewer>;
503
488
  updateReviewer(params: StorageOperationsUpdateReviewerParams): Promise<ApwReviewer>;
504
- deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<Boolean>;
489
+ deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<boolean>;
505
490
  }
506
491
  export interface ApwWorkflowStorageOperations {
507
492
  getWorkflow(params: StorageOperationsGetWorkflowParams): Promise<ApwWorkflow>;
508
493
  listWorkflows(params: StorageOperationsListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;
509
494
  createWorkflow(params: StorageOperationsCreateWorkflowParams): Promise<ApwWorkflow>;
510
495
  updateWorkflow(params: StorageOperationsUpdateWorkflowParams): Promise<ApwWorkflow>;
511
- deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<Boolean>;
496
+ deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<boolean>;
512
497
  }
513
498
  export interface ApwContentReviewStorageOperations {
514
499
  getContentReview(params: StorageOperationsGetContentReviewParams): Promise<ApwContentReview>;
515
500
  listContentReviews(params: StorageOperationsListContentReviewsParams): Promise<[ApwContentReview[], ListMeta]>;
516
501
  createContentReview(params: StorageOperationsCreateContentReviewParams): Promise<ApwContentReview>;
517
502
  updateContentReview(params: StorageOperationsUpdateContentReviewParams): Promise<ApwContentReview>;
518
- deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<Boolean>;
503
+ deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<boolean>;
519
504
  }
520
505
  export interface ApwChangeRequestStorageOperations {
521
506
  getChangeRequest(params: StorageOperationsGetChangeRequestParams): Promise<ApwChangeRequest>;
522
507
  listChangeRequests(params: StorageOperationsListChangeRequestsParams): Promise<[ApwChangeRequest[], ListMeta]>;
523
508
  createChangeRequest(params: StorageOperationsCreateChangeRequestParams): Promise<ApwChangeRequest>;
524
509
  updateChangeRequest(params: StorageOperationsUpdateChangeRequestParams): Promise<ApwChangeRequest>;
525
- deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<Boolean>;
510
+ deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<boolean>;
526
511
  }
527
512
  export interface ApwCommentStorageOperations {
528
513
  getComment(params: StorageOperationsGetCommentParams): Promise<ApwComment>;
529
514
  listComments(params: StorageOperationsListCommentsParams): Promise<[ApwComment[], ListMeta]>;
530
515
  createComment(params: StorageOperationsCreateCommentParams): Promise<ApwComment>;
531
516
  updateComment(params: StorageOperationsUpdateCommentParams): Promise<ApwComment>;
532
- deleteComment(params: StorageOperationsDeleteCommentParams): Promise<Boolean>;
517
+ deleteComment(params: StorageOperationsDeleteCommentParams): Promise<boolean>;
533
518
  }
534
519
  export interface ApwStorageOperations extends ApwReviewerStorageOperations, ApwWorkflowStorageOperations, ApwContentReviewStorageOperations, ApwChangeRequestStorageOperations, ApwCommentStorageOperations {
535
520
  }
@@ -737,7 +722,6 @@ export interface OnWorkflowBeforeDeleteTopicParams {
737
722
  export interface OnWorkflowAfterDeleteTopicParams {
738
723
  workflow: ApwWorkflow;
739
724
  }
740
- export declare type WorkflowModelDefinition = Omit<CmsPrivateModelFull, "noValidate" | "group">;
741
725
  /**
742
726
  * Headless CMS
743
727
  */