@webiny/api-apw 0.0.0-unstable.e3f4727c56 → 0.0.0-unstable.eb196ccd2f

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 +57 -32
  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 +32 -50
  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 +26 -17
  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 +4 -2
  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 +8 -11
  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 +8 -11
  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 +9 -12
  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 +18 -15
  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 +105 -66
  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 +30 -9
  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 +20 -15
  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 +19 -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 +20 -36
  209. package/scheduler/types.js +11 -17
  210. package/scheduler/types.js.map +1 -1
  211. package/storageOperations/changeRequestStorageOperations.d.ts +2 -2
  212. package/storageOperations/changeRequestStorageOperations.js +44 -23
  213. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  214. package/storageOperations/commentStorageOperations.d.ts +3 -3
  215. package/storageOperations/commentStorageOperations.js +17 -24
  216. package/storageOperations/commentStorageOperations.js.map +1 -1
  217. package/storageOperations/contentReviewStorageOperations.d.ts +3 -3
  218. package/storageOperations/contentReviewStorageOperations.js +20 -25
  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 -31
  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 +24 -34
  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 +25 -28
  252. package/storageOperations/workflowStorageOperations.js.map +1 -1
  253. package/types.d.ts +49 -64
  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 -19
  313. package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -1,3 +1,3 @@
1
- import { ApwContentReviewStorageOperations } from "./types";
2
- import { CreateApwStorageOperationsParams } from "./index";
3
- export declare const createContentReviewStorageOperations: ({ cms, security }: CreateApwStorageOperationsParams) => ApwContentReviewStorageOperations;
1
+ import type { ApwContentReviewStorageOperations } from "./types";
2
+ import type { CreateApwStorageOperationsParams } from "./";
3
+ export declare const createContentReviewStorageOperations: ({ cms }: CreateApwStorageOperationsParams) => ApwContentReviewStorageOperations;
@@ -5,18 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createContentReviewStorageOperations = 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 _contentReview = require("./models/contentReview.model");
12
11
  const createContentReviewStorageOperations = ({
13
- cms,
14
- security
12
+ cms
15
13
  }) => {
16
14
  const getContentReviewModel = async () => {
17
- security.disableAuthorization();
18
15
  const model = await cms.getModel(_contentReview.CONTENT_REVIEW_MODEL_ID);
19
- security.enableAuthorization();
20
16
  if (!model) {
21
17
  throw new _error.default(`Could not find "${_contentReview.CONTENT_REVIEW_MODEL_ID}" model.`, "MODEL_NOT_FOUND_ERROR");
22
18
  }
@@ -26,29 +22,26 @@ const createContentReviewStorageOperations = ({
26
22
  id
27
23
  }) => {
28
24
  const model = await getContentReviewModel();
29
- security.disableAuthorization();
30
25
  const entry = await cms.getEntryById(model, id);
31
- security.enableAuthorization();
32
- return (0, _index.getFieldValues)(entry, _index.baseFields);
26
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
33
27
  };
34
28
  return {
35
29
  getContentReviewModel,
36
30
  getContentReview,
37
31
  async listContentReviews(params) {
38
32
  const model = await getContentReviewModel();
39
- security.disableAuthorization();
40
- const [entries, meta] = await cms.listLatestEntries(model, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
41
- where: (0, _objectSpread2.default)({}, params.where)
42
- }));
43
- security.enableAuthorization();
44
- return [entries.map(entry => (0, _index.getFieldValues)(entry, _index.baseFields)), meta];
33
+ const [entries, meta] = await cms.listLatestEntries(model, {
34
+ ...params,
35
+ where: {
36
+ ...params.where
37
+ }
38
+ });
39
+ return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
45
40
  },
46
41
  async createContentReview(params) {
47
42
  const model = await getContentReviewModel();
48
- security.disableAuthorization();
49
43
  const entry = await cms.createEntry(model, params.data);
50
- security.enableAuthorization();
51
- return (0, _index.getFieldValues)(entry, _index.baseFields);
44
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
52
45
  },
53
46
  async updateContentReview(params) {
54
47
  const model = await getContentReviewModel();
@@ -59,18 +52,20 @@ const createContentReviewStorageOperations = ({
59
52
  const existingEntry = await getContentReview({
60
53
  id: params.id
61
54
  });
62
- security.disableAuthorization();
63
- const entry = await cms.updateEntry(model, params.id, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, existingEntry), params.data));
64
- security.enableAuthorization();
65
- return (0, _index.getFieldValues)(entry, _index.baseFields);
55
+ const entry = await cms.updateEntry(model, params.id, {
56
+ ...existingEntry,
57
+ ...params.data,
58
+ savedOn: new Date()
59
+ });
60
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
66
61
  },
67
62
  async deleteContentReview(params) {
68
63
  const model = await getContentReviewModel();
69
- security.disableAuthorization();
70
64
  await cms.deleteEntry(model, params.id);
71
- security.enableAuthorization();
72
65
  return true;
73
66
  }
74
67
  };
75
68
  };
76
- exports.createContentReviewStorageOperations = createContentReviewStorageOperations;
69
+ exports.createContentReviewStorageOperations = createContentReviewStorageOperations;
70
+
71
+ //# sourceMappingURL=contentReviewStorageOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContentReviewStorageOperations","cms","security","getContentReviewModel","disableAuthorization","model","getModel","CONTENT_REVIEW_MODEL_ID","enableAuthorization","WebinyError","getContentReview","id","entry","getEntryById","getFieldValues","baseFields","listContentReviews","params","entries","meta","listLatestEntries","where","map","createContentReview","createEntry","data","updateContentReview","existingEntry","updateEntry","deleteContentReview","deleteEntry"],"sources":["contentReviewStorageOperations.ts"],"sourcesContent":["import { ApwContentReviewStorageOperations } from \"./types\";\nimport {\n baseFields,\n CreateApwStorageOperationsParams,\n getFieldValues\n} from \"~/storageOperations/index\";\nimport WebinyError from \"@webiny/error\";\nimport { CONTENT_REVIEW_MODEL_ID } from \"~/storageOperations/models/contentReview.model\";\n\nexport const createContentReviewStorageOperations = ({\n cms,\n security\n}: CreateApwStorageOperationsParams): ApwContentReviewStorageOperations => {\n const getContentReviewModel = async () => {\n security.disableAuthorization();\n const model = await cms.getModel(CONTENT_REVIEW_MODEL_ID);\n security.enableAuthorization();\n if (!model) {\n throw new WebinyError(\n `Could not find \"${CONTENT_REVIEW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getContentReview: ApwContentReviewStorageOperations[\"getContentReview\"] = async ({\n id\n }) => {\n const model = await getContentReviewModel();\n security.disableAuthorization();\n const entry = await cms.getEntryById(model, id);\n security.enableAuthorization();\n return getFieldValues(entry, baseFields);\n };\n return {\n getContentReviewModel,\n getContentReview,\n async listContentReviews(params) {\n const model = await getContentReviewModel();\n security.disableAuthorization();\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n security.enableAuthorization();\n return [entries.map(entry => getFieldValues(entry, baseFields)), meta];\n },\n async createContentReview(params) {\n const model = await getContentReviewModel();\n security.disableAuthorization();\n const entry = await cms.createEntry(model, params.data);\n security.enableAuthorization();\n return getFieldValues(entry, baseFields);\n },\n async updateContentReview(params) {\n const model = await getContentReviewModel();\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 getContentReview({ id: params.id });\n\n security.disableAuthorization();\n const entry = await cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data\n });\n security.enableAuthorization();\n return getFieldValues(entry, baseFields);\n },\n async deleteContentReview(params) {\n const model = await getContentReviewModel();\n security.disableAuthorization();\n await cms.deleteEntry(model, params.id);\n security.enableAuthorization();\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;;AACA;AAKA;AACA;AAEO,MAAMA,oCAAoC,GAAG,CAAC;EACjDC,GAAG;EACHC;AAC8B,CAAC,KAAwC;EACvE,MAAMC,qBAAqB,GAAG,YAAY;IACtCD,QAAQ,CAACE,oBAAoB,EAAE;IAC/B,MAAMC,KAAK,GAAG,MAAMJ,GAAG,CAACK,QAAQ,CAACC,sCAAuB,CAAC;IACzDL,QAAQ,CAACM,mBAAmB,EAAE;IAC9B,IAAI,CAACH,KAAK,EAAE;MACR,MAAM,IAAII,cAAW,CAChB,mBAAkBF,sCAAwB,UAAS,EACpD,uBAAuB,CAC1B;IACL;IACA,OAAOF,KAAK;EAChB,CAAC;EACD,MAAMK,gBAAuE,GAAG,OAAO;IACnFC;EACJ,CAAC,KAAK;IACF,MAAMN,KAAK,GAAG,MAAMF,qBAAqB,EAAE;IAC3CD,QAAQ,CAACE,oBAAoB,EAAE;IAC/B,MAAMQ,KAAK,GAAG,MAAMX,GAAG,CAACY,YAAY,CAACR,KAAK,EAAEM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MX,GAAG,CAAC2B,WAAW,CAACvB,KAAK,EAAEY,MAAM,CAACN,EAAE,8DAC7CgB,aAAa,GACbV,MAAM,CAACQ,IAAI,EAChB;MACFvB,QAAQ,CAACM,mBAAmB,EAAE;MAC9B,OAAO,IAAAM,qBAAc,EAACF,KAAK,EAAEG,iBAAU,CAAC;IAC5C,CAAC;IACD,MAAMc,mBAAmB,CAACZ,MAAM,EAAE;MAC9B,MAAMZ,KAAK,GAAG,MAAMF,qBAAqB,EAAE;MAC3CD,QAAQ,CAACE,oBAAoB,EAAE;MAC/B,MAAMH,GAAG,CAAC6B,WAAW,CAACzB,KAAK,EAAEY,MAAM,CAACN,EAAE,CAAC;MACvCT,QAAQ,CAACM,mBAAmB,EAAE;MAC9B,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_contentReview","createContentReviewStorageOperations","cms","getContentReviewModel","model","getModel","CONTENT_REVIEW_MODEL_ID","WebinyError","getContentReview","id","entry","getEntryById","pickEntryFieldValues","listContentReviews","params","entries","meta","listLatestEntries","where","map","createContentReview","createEntry","data","updateContentReview","existingEntry","updateEntry","savedOn","Date","deleteContentReview","deleteEntry","exports"],"sources":["contentReviewStorageOperations.ts"],"sourcesContent":["import type { ApwContentReviewStorageOperations } from \"./types\";\nimport type { CreateApwStorageOperationsParams } from \"~/storageOperations\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { CONTENT_REVIEW_MODEL_ID } from \"~/storageOperations/models/contentReview.model\";\nimport type { ApwContentReview } from \"~/types\";\n\nexport const createContentReviewStorageOperations = ({\n cms\n}: CreateApwStorageOperationsParams): ApwContentReviewStorageOperations => {\n const getContentReviewModel = async () => {\n const model = await cms.getModel(CONTENT_REVIEW_MODEL_ID);\n if (!model) {\n throw new WebinyError(\n `Could not find \"${CONTENT_REVIEW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getContentReview: ApwContentReviewStorageOperations[\"getContentReview\"] = async ({\n id\n }) => {\n const model = await getContentReviewModel();\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getContentReviewModel,\n getContentReview,\n async listContentReviews(params) {\n const model = await getContentReviewModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n\n return [entries.map(pickEntryFieldValues<ApwContentReview>), meta];\n },\n async createContentReview(params) {\n const model = await getContentReviewModel();\n\n const entry = await cms.createEntry(model, params.data);\n return pickEntryFieldValues(entry);\n },\n async updateContentReview(params) {\n const model = await getContentReviewModel();\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 getContentReview({ 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 deleteContentReview(params) {\n const model = await getContentReviewModel();\n await cms.deleteEntry(model, params.id);\n\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAGO,MAAMI,oCAAoC,GAAGA,CAAC;EACjDC;AAC8B,CAAC,KAAwC;EACvE,MAAMC,qBAAqB,GAAG,MAAAA,CAAA,KAAY;IACtC,MAAMC,KAAK,GAAG,MAAMF,GAAG,CAACG,QAAQ,CAACC,sCAAuB,CAAC;IACzD,IAAI,CAACF,KAAK,EAAE;MACR,MAAM,IAAIG,cAAW,CACjB,mBAAmBD,sCAAuB,UAAU,EACpD,uBACJ,CAAC;IACL;IACA,OAAOF,KAAK;EAChB,CAAC;EACD,MAAMI,gBAAuE,GAAG,MAAAA,CAAO;IACnFC;EACJ,CAAC,K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AE,IAAIC,IAAI,CAAC;MACtB,CAAC,CAAC;MACF,OAAO,IAAAf,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,mBAAmBA,CAACd,MAAM,EAAE;MAC9B,MAAMV,KAAK,GAAG,MAAMD,qBAAqB,CAAC,CAAC;MAC3C,MAAMD,GAAG,CAAC2B,WAAW,CAACzB,KAAK,EAAEU,MAAM,CAACL,EAAE,CAAC;MAEvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAACqB,OAAA,CAAA7B,oCAAA,GAAAA,oCAAA","ignoreList":[]}
@@ -1,15 +1,9 @@
1
- import { CmsContext, CmsEntry, HeadlessCms } from "@webiny/api-headless-cms/types";
2
- import { ApwStorageOperations } from "../types";
3
- import { Security } from "@webiny/api-security/types";
1
+ import type { CmsContext, HeadlessCms } from "@webiny/api-headless-cms/types";
2
+ import type { ApwStorageOperations } from "../types";
3
+ import type { Security } from "@webiny/api-security/types";
4
4
  export interface CreateApwStorageOperationsParams {
5
5
  cms: HeadlessCms;
6
6
  security: Security;
7
7
  getCmsContext: () => CmsContext;
8
8
  }
9
- /**
10
- * Using any because value can be a lot of types.
11
- * TODO @ts-refactor figure out correct types.
12
- */
13
- export declare function getFieldValues(entry: CmsEntry, fields: string[]): any;
14
- export declare const baseFields: string[];
15
9
  export declare const createStorageOperations: (params: CreateApwStorageOperationsParams) => ApwStorageOperations;
@@ -1,34 +1,29 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.createStorageOperations = exports.baseFields = void 0;
8
- exports.getFieldValues = getFieldValues;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
- var _pick = _interopRequireDefault(require("lodash/pick"));
6
+ exports.createStorageOperations = void 0;
11
7
  var _reviewerStorageOperations = require("./reviewerStorageOperations");
12
8
  var _workflowStorageOperations = require("./workflowStorageOperations");
13
9
  var _contentReviewStorageOperations = require("./contentReviewStorageOperations");
14
10
  var _changeRequestStorageOperations = require("./changeRequestStorageOperations");
15
11
  var _commentStorageOperations = require("./commentStorageOperations");
16
12
  var _models = require("./models");
17
- /**
18
- * Using any because value can be a lot of types.
19
- * TODO @ts-refactor figure out correct types.
20
- */
21
- function getFieldValues(entry, fields) {
22
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
23
- }
24
- const baseFields = ["id", "entryId", "createdBy", "createdOn", "savedOn"];
25
- exports.baseFields = baseFields;
26
13
  const createStorageOperations = params => {
27
14
  const context = params.getCmsContext();
28
15
  /**
29
16
  * Register Apw models.
30
17
  */
31
18
  (0, _models.createApwModels)(context);
32
- return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _reviewerStorageOperations.createReviewerStorageOperations)(params)), (0, _workflowStorageOperations.createWorkflowStorageOperations)(params)), (0, _contentReviewStorageOperations.createContentReviewStorageOperations)(params)), (0, _changeRequestStorageOperations.createChangeRequestStorageOperations)(params)), (0, _commentStorageOperations.createCommentStorageOperations)(params));
19
+ return {
20
+ ...(0, _reviewerStorageOperations.createReviewerStorageOperations)(params),
21
+ ...(0, _workflowStorageOperations.createWorkflowStorageOperations)(params),
22
+ ...(0, _contentReviewStorageOperations.createContentReviewStorageOperations)(params),
23
+ ...(0, _changeRequestStorageOperations.createChangeRequestStorageOperations)(params),
24
+ ...(0, _commentStorageOperations.createCommentStorageOperations)(params)
25
+ };
33
26
  };
34
- exports.createStorageOperations = createStorageOperations;
27
+ exports.createStorageOperations = createStorageOperations;
28
+
29
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getFieldValues","entry","fields","pick","values","baseFields","createStorageOperations","params","context","getCmsContext","createApwModels","createReviewerStorageOperations","createWorkflowStorageOperations","createContentReviewStorageOperations","createChangeRequestStorageOperations","createCommentStorageOperations"],"sources":["index.ts"],"sourcesContent":["import pick from \"lodash/pick\";\nimport { CmsContext, CmsEntry, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport { ApwStorageOperations } from \"~/types\";\nimport { createReviewerStorageOperations } from \"./reviewerStorageOperations\";\nimport { createWorkflowStorageOperations } from \"./workflowStorageOperations\";\nimport { createContentReviewStorageOperations } from \"./contentReviewStorageOperations\";\nimport { createChangeRequestStorageOperations } from \"./changeRequestStorageOperations\";\nimport { createCommentStorageOperations } from \"~/storageOperations/commentStorageOperations\";\nimport { createApwModels } from \"./models\";\nimport { Security } from \"@webiny/api-security/types\";\n\nexport interface CreateApwStorageOperationsParams {\n cms: HeadlessCms;\n security: Security;\n getCmsContext: () => CmsContext;\n}\n\n/**\n * Using any because value can be a lot of types.\n * TODO @ts-refactor figure out correct types.\n */\nexport function getFieldValues(entry: CmsEntry, fields: string[]): any {\n return { ...pick(entry, fields), ...entry.values };\n}\n\nexport const baseFields = [\"id\", \"entryId\", \"createdBy\", \"createdOn\", \"savedOn\"];\n\nexport const createStorageOperations = (\n params: CreateApwStorageOperationsParams\n): ApwStorageOperations => {\n const context = params.getCmsContext();\n /**\n * Register Apw models.\n */\n createApwModels(context);\n\n return {\n ...createReviewerStorageOperations(params),\n ...createWorkflowStorageOperations(params),\n ...createContentReviewStorageOperations(params),\n ...createChangeRequestStorageOperations(params),\n ...createCommentStorageOperations(params)\n };\n};\n"],"mappings":";;;;;;;;;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACO,SAASA,cAAc,CAACC,KAAe,EAAEC,MAAgB,EAAO;EACnE,mEAAY,IAAAC,aAAI,EAACF,KAAK,EAAEC,MAAM,CAAC,GAAKD,KAAK,CAACG,MAAM;AACpD;AAEO,MAAMC,UAAU,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,CAAC;AAAC;AAE1E,MAAMC,uBAAuB,GAChCC,MAAwC,IACjB;EACvB,MAAMC,OAAO,GAAGD,MAAM,CAACE,aAAa,EAAE;EACtC;AACJ;AACA;EACI,IAAAC,uBAAe,EAACF,OAAO,CAAC;EAExB,uJACO,IAAAG,0DAA+B,EAACJ,MAAM,CAAC,GACvC,IAAAK,0DAA+B,EAACL,MAAM,CAAC,GACvC,IAAAM,oEAAoC,EAACN,MAAM,CAAC,GAC5C,IAAAO,oEAAoC,EAACP,MAAM,CAAC,GAC5C,IAAAQ,wDAA8B,EAACR,MAAM,CAAC;AAEjD,CAAC;AAAC"}
1
+ {"version":3,"names":["_reviewerStorageOperations","require","_workflowStorageOperations","_contentReviewStorageOperations","_changeRequestStorageOperations","_commentStorageOperations","_models","createStorageOperations","params","context","getCmsContext","createApwModels","createReviewerStorageOperations","createWorkflowStorageOperations","createContentReviewStorageOperations","createChangeRequestStorageOperations","createCommentStorageOperations","exports"],"sources":["index.ts"],"sourcesContent":["import type { CmsContext, HeadlessCms } from \"@webiny/api-headless-cms/types\";\nimport type { ApwStorageOperations } from \"~/types\";\nimport { createReviewerStorageOperations } from \"./reviewerStorageOperations\";\nimport { createWorkflowStorageOperations } from \"./workflowStorageOperations\";\nimport { createContentReviewStorageOperations } from \"./contentReviewStorageOperations\";\nimport { createChangeRequestStorageOperations } from \"./changeRequestStorageOperations\";\nimport { createCommentStorageOperations } from \"~/storageOperations/commentStorageOperations\";\nimport { createApwModels } from \"./models\";\nimport type { Security } from \"@webiny/api-security/types\";\n\nexport interface CreateApwStorageOperationsParams {\n cms: HeadlessCms;\n security: Security;\n getCmsContext: () => CmsContext;\n}\n\nexport const createStorageOperations = (\n params: CreateApwStorageOperationsParams\n): ApwStorageOperations => {\n const context = params.getCmsContext();\n /**\n * Register Apw models.\n */\n createApwModels(context);\n\n return {\n ...createReviewerStorageOperations(params),\n ...createWorkflowStorageOperations(params),\n ...createContentReviewStorageOperations(params),\n ...createChangeRequestStorageOperations(params),\n ...createCommentStorageOperations(params)\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,0BAAA,GAAAC,OAAA;AACA,IAAAC,0BAAA,GAAAD,OAAA;AACA,IAAAE,+BAAA,GAAAF,OAAA;AACA,IAAAG,+BAAA,GAAAH,OAAA;AACA,IAAAI,yBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AASO,MAAMM,uBAAuB,GAChCC,MAAwC,IACjB;EACvB,MAAMC,OAAO,GAAGD,MAAM,CAACE,aAAa,CAAC,CAAC;EACtC;AACJ;AACA;EACI,IAAAC,uBAAe,EAACF,OAAO,CAAC;EAExB,OAAO;IACH,GAAG,IAAAG,0DAA+B,EAACJ,MAAM,CAAC;IAC1C,GAAG,IAAAK,0DAA+B,EAACL,MAAM,CAAC;IAC1C,GAAG,IAAAM,oEAAoC,EAACN,MAAM,CAAC;IAC/C,GAAG,IAAAO,oEAAoC,EAACP,MAAM,CAAC;IAC/C,GAAG,IAAAQ,wDAA8B,EAACR,MAAM;EAC5C,CAAC;AACL,CAAC;AAACS,OAAA,CAAAV,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1,3 +1,2 @@
1
- import { WorkflowModelDefinition } from "../../types";
2
1
  export declare const CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
3
- export declare const createChangeRequestModelDefinition: () => WorkflowModelDefinition;
2
+ export declare const createChangeRequestModel: () => import("@webiny/api-headless-cms").CmsPrivateModelFull;
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createChangeRequestModelDefinition = exports.CHANGE_REQUEST_MODEL_ID = void 0;
6
+ exports.createChangeRequestModel = exports.CHANGE_REQUEST_MODEL_ID = void 0;
7
+ var _apiHeadlessCms = require("@webiny/api-headless-cms");
7
8
  var _utils = require("./utils");
8
9
  const bodyField = () => (0, _utils.createModelField)({
9
10
  label: "Body",
@@ -34,17 +35,15 @@ const stepField = () => (0, _utils.createModelField)({
34
35
  name: "required"
35
36
  }]
36
37
  });
37
- const CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
38
- exports.CHANGE_REQUEST_MODEL_ID = CHANGE_REQUEST_MODEL_ID;
39
- const createChangeRequestModelDefinition = () => {
40
- return {
38
+ const CHANGE_REQUEST_MODEL_ID = exports.CHANGE_REQUEST_MODEL_ID = "apwChangeRequestModelDefinition";
39
+ const createChangeRequestModel = () => {
40
+ return (0, _apiHeadlessCms.createPrivateModel)({
41
41
  name: "APW - Change Request",
42
42
  modelId: CHANGE_REQUEST_MODEL_ID,
43
43
  titleFieldId: "title",
44
- layout: [["changeRequest_body"], ["changeRequest_title"], ["changeRequest_resolved"], ["changeRequest_media"], ["changeRequest_step"]],
45
- fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()],
46
- description: "",
47
- isPrivate: true
48
- };
44
+ fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()]
45
+ });
49
46
  };
50
- exports.createChangeRequestModelDefinition = createChangeRequestModelDefinition;
47
+ exports.createChangeRequestModel = createChangeRequestModel;
48
+
49
+ //# sourceMappingURL=changeRequest.model.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["bodyField","createModelField","label","type","parent","titleField","resolvedField","mediaField","stepField","validation","message","name","CHANGE_REQUEST_MODEL_ID","createChangeRequestModelDefinition","modelId","titleFieldId","layout","fields","description","isPrivate"],"sources":["changeRequest.model.ts"],"sourcesContent":["import { createModelField } from \"./utils\";\nimport { WorkflowModelDefinition } from \"~/types\";\n\nconst bodyField = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"changeRequest\"\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"changeRequest\"\n });\n\nconst resolvedField = () =>\n createModelField({\n label: \"Resolved\",\n type: \"boolean\",\n parent: \"changeRequest\"\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"changeRequest\"\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"changeRequest\",\n validation: [\n {\n message: \"`step` field value is required in changeRequest.\",\n name: \"required\"\n }\n ]\n });\n\nexport const CHANGE_REQUEST_MODEL_ID = \"apwChangeRequestModelDefinition\";\n\nexport const createChangeRequestModelDefinition = (): WorkflowModelDefinition => {\n return {\n name: \"APW - Change Request\",\n modelId: CHANGE_REQUEST_MODEL_ID,\n titleFieldId: \"title\",\n layout: [\n [\"changeRequest_body\"],\n [\"changeRequest_title\"],\n [\"changeRequest_resolved\"],\n [\"changeRequest_media\"],\n [\"changeRequest_step\"]\n ],\n fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()],\n description: \"\",\n isPrivate: true\n };\n};\n"],"mappings":";;;;;;AAAA;AAGA,MAAMA,SAAS,GAAG,MACd,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAG,MACf,IAAAJ,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAME,aAAa,GAAG,MAClB,IAAAL,uBAAgB,EAAC;EACbC,KAAK,EAAE,UAAU;EACjBC,IAAI,EAAE,SAAS;EACfC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMG,UAAU,GAAG,MACf,IAAAN,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMI,SAAS,GAAG,MACd,IAAAP,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,eAAe;EACvBK,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,kDAAkD;IAC3DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEC,MAAMC,uBAAuB,GAAG,iCAAiC;AAAC;AAElE,MAAMC,kCAAkC,GAAG,MAA+B;EAC7E,OAAO;IACHF,IAAI,EAAE,sBAAsB;IAC5BG,OAAO,EAAEF,uBAAuB;IAChCG,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE,CACJ,CAAC,oBAAoB,CAAC,EACtB,CAAC,qBAAqB,CAAC,EACvB,CAAC,wBAAwB,CAAC,EAC1B,CAAC,qBAAqB,CAAC,EACvB,CAAC,oBAAoB,CAAC,CACzB;IACDC,MAAM,EAAE,CAACjB,SAAS,EAAE,EAAEK,UAAU,EAAE,EAAEC,aAAa,EAAE,EAAEC,UAAU,EAAE,EAAEC,SAAS,EAAE,CAAC;IAC/EU,WAAW,EAAE,EAAE;IACfC,SAAS,EAAE;EACf,CAAC;AACL,CAAC;AAAC"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","bodyField","createModelField","label","type","parent","titleField","resolvedField","mediaField","stepField","validation","message","name","CHANGE_REQUEST_MODEL_ID","exports","createChangeRequestModel","createPrivateModel","modelId","titleFieldId","fields"],"sources":["changeRequest.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"./utils\";\n\nconst bodyField = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"changeRequest\"\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"changeRequest\"\n });\n\nconst resolvedField = () =>\n createModelField({\n label: \"Resolved\",\n type: \"boolean\",\n parent: \"changeRequest\"\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"changeRequest\"\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"changeRequest\",\n validation: [\n {\n message: \"`step` field value is required in changeRequest.\",\n name: \"required\"\n }\n ]\n });\n\nexport const CHANGE_REQUEST_MODEL_ID = \"apwChangeRequestModelDefinition\";\n\nexport const createChangeRequestModel = () => {\n return createPrivateModel({\n name: \"APW - Change Request\",\n modelId: CHANGE_REQUEST_MODEL_ID,\n titleFieldId: \"title\",\n fields: [bodyField(), titleField(), resolvedField(), mediaField(), stepField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,SAAS,GAAGA,CAAA,KACd,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAGA,CAAA,KACf,IAAAJ,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAME,aAAa,GAAGA,CAAA,KAClB,IAAAL,uBAAgB,EAAC;EACbC,KAAK,EAAE,UAAU;EACjBC,IAAI,EAAE,SAAS;EACfC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAN,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMI,SAAS,GAAGA,CAAA,KACd,IAAAP,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,eAAe;EACvBK,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,kDAAkD;IAC3DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEC,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,iCAAiC;AAEjE,MAAME,wBAAwB,GAAGA,CAAA,KAAM;EAC1C,OAAO,IAAAC,kCAAkB,EAAC;IACtBJ,IAAI,EAAE,sBAAsB;IAC5BK,OAAO,EAAEJ,uBAAuB;IAChCK,YAAY,EAAE,OAAO;IACrBC,MAAM,EAAE,CAAClB,SAAS,CAAC,CAAC,EAAEK,UAAU,CAAC,CAAC,EAAEC,aAAa,CAAC,CAAC,EAAEC,UAAU,CAAC,CAAC,EAAEC,SAAS,CAAC,CAAC;EAClF,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,7 +1,6 @@
1
- import { WorkflowModelDefinition } from "../../types";
2
1
  interface CreateCommentModelDefinitionParams {
3
2
  modelId: string;
4
3
  }
5
4
  export declare const COMMENT_MODEL_ID = "apwCommentModelDefinition";
6
- export declare const createCommentModelDefinition: ({ modelId }: CreateCommentModelDefinitionParams) => WorkflowModelDefinition;
5
+ export declare const createCommentModel: ({ modelId }: CreateCommentModelDefinitionParams) => import("@webiny/api-headless-cms").CmsPrivateModelFull;
7
6
  export {};
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createCommentModelDefinition = exports.COMMENT_MODEL_ID = void 0;
6
+ exports.createCommentModel = exports.COMMENT_MODEL_ID = void 0;
7
+ var _apiHeadlessCms = require("@webiny/api-headless-cms");
7
8
  var _utils = require("./utils");
8
9
  const commentBody = () => (0, _utils.createModelField)({
9
10
  label: "Body",
@@ -34,19 +35,17 @@ const mediaField = () => (0, _utils.createModelField)({
34
35
  type: "file",
35
36
  parent: "comment"
36
37
  });
37
- const COMMENT_MODEL_ID = "apwCommentModelDefinition";
38
- exports.COMMENT_MODEL_ID = COMMENT_MODEL_ID;
39
- const createCommentModelDefinition = ({
38
+ const COMMENT_MODEL_ID = exports.COMMENT_MODEL_ID = "apwCommentModelDefinition";
39
+ const createCommentModel = ({
40
40
  modelId
41
41
  }) => {
42
- return {
42
+ return (0, _apiHeadlessCms.createPrivateModel)({
43
43
  name: "APW - Comment",
44
44
  modelId: COMMENT_MODEL_ID,
45
45
  titleFieldId: "step",
46
- layout: [["comment_body"], ["comment_changeRequest"], ["comment_step"], ["comment_media"]],
47
- fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()],
48
- description: "",
49
- isPrivate: true
50
- };
46
+ fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()]
47
+ });
51
48
  };
52
- exports.createCommentModelDefinition = createCommentModelDefinition;
49
+ exports.createCommentModel = createCommentModel;
50
+
51
+ //# sourceMappingURL=comment.model.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["commentBody","createModelField","label","type","parent","changeRequestRef","modelId","settings","models","stepField","validation","message","name","mediaField","COMMENT_MODEL_ID","createCommentModelDefinition","titleFieldId","layout","fields","description","isPrivate"],"sources":["comment.model.ts"],"sourcesContent":["import { createModelField } from \"./utils\";\nimport { WorkflowModelDefinition } from \"~/types\";\n\nconst commentBody = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"comment\"\n });\n\nconst changeRequestRef = (modelId: string) =>\n createModelField({\n label: \"Change Request\",\n type: \"ref\",\n parent: \"comment\",\n settings: {\n models: [\n {\n modelId\n }\n ]\n }\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"comment\",\n validation: [\n {\n message: \"`step` field value is required in comment.\",\n name: \"required\"\n }\n ]\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"comment\"\n });\n\ninterface CreateCommentModelDefinitionParams {\n modelId: string;\n}\n\nexport const COMMENT_MODEL_ID = \"apwCommentModelDefinition\";\n\nexport const createCommentModelDefinition = ({\n modelId\n}: CreateCommentModelDefinitionParams): WorkflowModelDefinition => {\n return {\n name: \"APW - Comment\",\n modelId: COMMENT_MODEL_ID,\n titleFieldId: \"step\",\n layout: [[\"comment_body\"], [\"comment_changeRequest\"], [\"comment_step\"], [\"comment_media\"]],\n fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()],\n description: \"\",\n isPrivate: true\n };\n};\n"],"mapp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,CAAC;AAAC"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","commentBody","createModelField","label","type","parent","changeRequestRef","modelId","settings","models","stepField","validation","message","name","mediaField","COMMENT_MODEL_ID","exports","createCommentModel","createPrivateModel","titleFieldId","fields"],"sources":["comment.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { createModelField } from \"./utils\";\n\nconst commentBody = () =>\n createModelField({\n label: \"Body\",\n type: \"rich-text\",\n parent: \"comment\"\n });\n\nconst changeRequestRef = (modelId: string) =>\n createModelField({\n label: \"Change Request\",\n type: \"ref\",\n parent: \"comment\",\n settings: {\n models: [\n {\n modelId\n }\n ]\n }\n });\n\nconst stepField = () =>\n createModelField({\n label: \"Step\",\n type: \"text\",\n parent: \"comment\",\n validation: [\n {\n message: \"`step` field value is required in comment.\",\n name: \"required\"\n }\n ]\n });\n\nconst mediaField = () =>\n createModelField({\n label: \"Media\",\n type: \"file\",\n parent: \"comment\"\n });\n\ninterface CreateCommentModelDefinitionParams {\n modelId: string;\n}\n\nexport const COMMENT_MODEL_ID = \"apwCommentModelDefinition\";\n\nexport const createCommentModel = ({ modelId }: CreateCommentModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Comment\",\n modelId: COMMENT_MODEL_ID,\n titleFieldId: \"step\",\n fields: [commentBody(), changeRequestRef(modelId), stepField(), mediaField()]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAME,WAAW,GAAGA,CAAA,KAChB,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACZ,CAAC,CAAC;AAEN,MAAMC,gBAAgB,GAAIC,OAAe,IACrC,IAAAL,uBAAgB,EAAC;EACbC,KAAK,EAAE,gBAAgB;EACvBC,IAAI,EAAE,KAAK;EACXC,MAAM,EAAE,SAAS;EACjBG,QAAQ,EAAE;IACNC,MAAM,EAAE,CACJ;MACIF;IACJ,CAAC;EAET;AACJ,CAAC,CAAC;AAEN,MAAMG,SAAS,GAAGA,CAAA,KACd,IAAAR,uBAAgB,EAAC;EACbC,KAAK,EAAE,MAAM;EACbC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,SAAS;EACjBM,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,4CAA4C;IACrDC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAGA,CAAA,KACf,IAAAZ,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC,CAAC;AAMC,MAAMU,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,2BAA2B;AAEpD,MAAME,kBAAkB,GAAGA,CAAC;EAAEV;AAA4C,CAAC,KAAK;EACnF,OAAO,IAAAW,kCAAkB,EAAC;IACtBL,IAAI,EAAE,eAAe;IACrBN,OAAO,EAAEQ,gBAAgB;IACzBI,YAAY,EAAE,MAAM;IACpBC,MAAM,EAAE,CAACnB,WAAW,CAAC,CAAC,EAAEK,gBAAgB,CAACC,OAAO,CAAC,EAAEG,SAAS,CAAC,CAAC,EAAEI,UAAU,CAAC,CAAC;EAChF,CAAC,CAAC;AACN,CAAC;AAACE,OAAA,CAAAC,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,7 +1,6 @@
1
- import { WorkflowModelDefinition } from "../../types";
2
1
  interface CreateContentReviewModelDefinitionParams {
3
2
  reviewerModelId: string;
4
3
  }
5
4
  export declare const CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
6
- export declare const createContentReviewModelDefinition: ({ reviewerModelId }: CreateContentReviewModelDefinitionParams) => WorkflowModelDefinition;
5
+ export declare const createContentReviewModel: ({ reviewerModelId }: CreateContentReviewModelDefinitionParams) => import("@webiny/api-headless-cms").CmsPrivateModelFull;
7
6
  export {};
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createContentReviewModelDefinition = exports.CONTENT_REVIEW_MODEL_ID = void 0;
6
+ exports.createContentReviewModel = exports.CONTENT_REVIEW_MODEL_ID = void 0;
7
+ var _apiHeadlessCms = require("@webiny/api-headless-cms");
7
8
  var _utils = require("./utils");
8
9
  var _workflow = require("./workflow.model");
9
10
  const contentField = fields => (0, _utils.createModelField)({
@@ -79,7 +80,7 @@ const contentTypeField = () => (0, _utils.createModelField)({
79
80
  label: "Page",
80
81
  value: "page"
81
82
  }, {
82
- value: "cms-entry",
83
+ value: "cms_entry",
83
84
  label: "CMS Entry"
84
85
  }]
85
86
  },
@@ -216,17 +217,17 @@ const stepsField = fields => ({
216
217
  enabled: false
217
218
  }
218
219
  });
219
- const CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
220
- exports.CONTENT_REVIEW_MODEL_ID = CONTENT_REVIEW_MODEL_ID;
221
- const createContentReviewModelDefinition = ({
220
+ const CONTENT_REVIEW_MODEL_ID = exports.CONTENT_REVIEW_MODEL_ID = "apwContentReviewModelDefinition";
221
+ const createContentReviewModel = ({
222
222
  reviewerModelId
223
- }) => ({
224
- name: "APW - Content Review",
225
- modelId: CONTENT_REVIEW_MODEL_ID,
226
- titleFieldId: "content",
227
- layout: [["contentReview_title"], ["contentReview_content"], ["contentReview_reviewStatus"], ["contentReview_reviewRequestedBy"], ["contentReview_steps"], ["contentReview_changeRequested"], ["contentReview_latestCommentId"], ["contentReview_workflowId"]],
228
- fields: [titleField(), contentField([contentIdField(), contentTypeField(), contentSettingsField([contentSettingsModelIdField()]), contentScheduledOnField(), contentScheduledByField(), scheduledActionIdField(), contentPublishedByField()]), contentStatus(), stepsField([(0, _workflow.stepTitleField)(), (0, _workflow.stepTypeField)(), (0, _workflow.stepIdField)(), (0, _workflow.stepReviewersField)(reviewerModelId), stepStatusField(), stepPendingChangeRequests(), stepTotalComments(), stepSignOffProvidedOn(), stepSignOffProvidedBy([stepSignOffProvidedById(), stepSignOffProvidedByDisplayName()])]), latestCommentId(), workflowIdField()],
229
- description: "",
230
- isPrivate: true
231
- });
232
- exports.createContentReviewModelDefinition = createContentReviewModelDefinition;
223
+ }) => {
224
+ return (0, _apiHeadlessCms.createPrivateModel)({
225
+ name: "APW - Content Review",
226
+ modelId: CONTENT_REVIEW_MODEL_ID,
227
+ titleFieldId: "content",
228
+ fields: [titleField(), contentField([contentIdField(), contentTypeField(), contentSettingsField([contentSettingsModelIdField()]), contentScheduledOnField(), contentScheduledByField(), scheduledActionIdField(), contentPublishedByField()]), contentStatus(), stepsField([(0, _workflow.stepTitleField)(), (0, _workflow.stepTypeField)(), (0, _workflow.stepIdField)(), (0, _workflow.stepReviewersField)(reviewerModelId), stepStatusField(), stepPendingChangeRequests(), stepTotalComments(), stepSignOffProvidedOn(), stepSignOffProvidedBy([stepSignOffProvidedById(), stepSignOffProvidedByDisplayName()])]), latestCommentId(), workflowIdField()]
229
+ });
230
+ };
231
+ exports.createContentReviewModel = createContentReviewModel;
232
+
233
+ //# sourceMappingURL=contentReview.model.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["contentField","fields","createModelField","label","parent","type","multipleValues","settings","validation","message","name","contentStatus","fieldId","predefinedValues","enabled","values","value","titleField","contentIdField","workflowIdField","contentTypeField","contentSettingsField","contentSettingsModelIdField","scheduledActionIdField","contentScheduledOnField","contentScheduledByField","contentPublishedByField","stepStatusField","listValidation","renderer","id","storageId","stepPendingChangeRequests","stepTotalComments","latestCommentId","stepSignOffProvidedOn","stepSignOffProvidedBy","stepSignOffProvidedById","stepSignOffProvidedByDisplayName","stepsField","layout","map","field","CONTENT_REVIEW_MODEL_ID","createContentReviewModelDefinition","reviewerModelId","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField","description","isPrivate"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createModelField } from \"./utils\";\nimport { stepTitleField, stepTypeField, stepIdField, stepReviewersField } from \"./workflow.model\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { WorkflowModelDefinition } from \"~/types\";\n\nconst contentField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Content\",\n parent: \"contentReview\",\n type: \"object\",\n multipleValues: false,\n settings: { fields },\n validation: [\n {\n message: \"`content` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentStatus = () =>\n createModelField({\n label: \"Status\",\n fieldId: \"reviewStatus\",\n parent: \"contentReview\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Under review\",\n value: \"underReview\"\n },\n {\n label: \"Ready to be published\",\n value: \"readyToBePublished\"\n },\n {\n label: \"Published\",\n value: \"published\"\n }\n ]\n },\n validation: [\n {\n message: \"`reviewStatus` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`title` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Content\",\n validation: [\n {\n message: \"`id` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst workflowIdField = () =>\n createModelField({\n label: \"Workflow Id\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`workflowId` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"contentReview Type\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Page\",\n value: \"page\"\n },\n { value: \"cms-entry\", label: \"CMS Entry\" }\n ]\n },\n validation: [\n {\n message: \"`type` field value is required in contentReview Type.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentSettingsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Settings\",\n parent: \"contentReview Content\",\n type: \"object\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst contentSettingsModelIdField = () =>\n createModelField({\n label: \"Model Id\",\n parent: \"contentReview Settings\",\n type: \"text\"\n });\n\nconst scheduledActionIdField = () =>\n createModelField({\n label: \"Scheduled action Id\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledOnField = () =>\n createModelField({\n label: \"Scheduled on\",\n type: \"datetime\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledByField = () =>\n createModelField({\n label: \"Scheduled by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentPublishedByField = () =>\n createModelField({\n label: \"Published by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst stepStatusField = (): CmsModelField => ({\n multipleValues: false,\n listValidation: [],\n renderer: {\n name: \"radio-buttons\"\n },\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"done\",\n label: \"Steps done\"\n },\n {\n value: \"active\",\n label: \"Step active\"\n },\n {\n value: \"inactive\",\n label: \"Step inactive\"\n }\n ]\n },\n label: \"Status\",\n id: \"contentReview_steps_status\",\n type: \"text\",\n validation: [\n {\n message: \"`status` field value is required in contentReview steps status.\",\n name: \"required\"\n }\n ],\n storageId: \"status\",\n fieldId: \"status\"\n});\n\nconst stepPendingChangeRequests = () =>\n createModelField({\n label: \"Pending change requests\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`pendingChangeRequests` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepTotalComments = () =>\n createModelField({\n label: \"Total comments\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`totalComments` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst latestCommentId = () =>\n createModelField({\n label: \"Latest comment Id\",\n type: \"text\",\n parent: \"contentReview\"\n });\n\nconst stepSignOffProvidedOn = () =>\n createModelField({\n label: \"Sign off provided on\",\n type: \"datetime\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedBy = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Sign off provided By\",\n type: \"object\",\n parent: \"contentReview Step\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst stepSignOffProvidedById = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedByDisplayName = () =>\n createModelField({\n label: \"DisplayName\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepsField = (fields: CmsModelField[]): CmsModelField => ({\n id: \"contentReview_steps\",\n label: \"Steps\",\n type: \"object\",\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [],\n validation: [],\n fieldId: \"steps\",\n storageId: \"steps\",\n multipleValues: true,\n predefinedValues: {\n values: [],\n enabled: false\n }\n});\n\ninterface CreateContentReviewModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const CONTENT_REVIEW_MODEL_ID = \"apwContentReviewModelDefinition\";\n\nexport const createContentReviewModelDefinition = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams): WorkflowModelDefinition => ({\n name: \"APW - Content Review\",\n modelId: CONTENT_REVIEW_MODEL_ID,\n titleFieldId: \"content\",\n layout: [\n [\"contentReview_title\"],\n [\"contentReview_content\"],\n [\"contentReview_reviewStatus\"],\n [\"contentReview_reviewRequestedBy\"],\n [\"contentReview_steps\"],\n [\"contentReview_changeRequested\"],\n [\"contentReview_latestCommentId\"],\n [\"contentReview_workflowId\"]\n ],\n fields: [\n titleField(),\n contentField([\n contentIdField(),\n contentTypeField(),\n contentSettingsField([contentSettingsModelIdField()]),\n contentScheduledOnField(),\n contentScheduledByField(),\n scheduledActionIdField(),\n contentPublishedByField()\n ]),\n contentStatus(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId),\n stepStatusField(),\n stepPendingChangeRequests(),\n stepTotalComments(),\n stepSignOffProvidedOn(),\n stepSignOffProvidedBy([stepSignOffProvidedById(), stepSignOffProvidedByDisplayName()])\n ]),\n latestCommentId(),\n workflowIdField()\n ],\n description: \"\",\n isPrivate: true\n});\n"],"mappings":";;;;;;AAAA;AACA;AAIA,MAAMA,YAAY,GAAIC,MAAuB,IACzC,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,SAAS;EAChBC,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE;IAAEN;EAAO,CAAC;EACpBO,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,qDAAqD;IAC9DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,aAAa,GAAG,MAClB,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OAAO,EAAE,cAAc;EACvBR,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,MAAM;EACZQ,gBAAgB,EAAE;IACdC,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE,CACJ;MACIZ,KAAK,EAAE,cAAc;MACrBa,KAAK,EAAE;IACX,CAAC,EACD;MACIb,KAAK,EAAE,uBAAuB;MAC9Ba,KAAK,EAAE;IACX,CAAC,EACD;MACIb,KAAK,EAAE,WAAW;MAClBa,KAAK,EAAE;IACX,CAAC;EAET,CAAC;EACDR,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,0DAA0D;IACnEC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMO,UAAU,GAAG,MACf,IAAAf,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdE,IAAI,EAAE,MAAM;EACZD,MAAM,EAAE,eAAe;EACvBI,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,mDAAmD;IAC5DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMQ,cAAc,GAAG,MACnB,IAAAhB,uBAAgB,EAAC;EACb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b,IAAAC,4BAAkB,EAACN,eAAe,CAAC,EACnClB,eAAe,EAAE,EACjBK,yBAAyB,EAAE,EAC3BC,iBAAiB,EAAE,EACnBE,qBAAqB,EAAE,EACvBC,qBAAqB,CAAC,CAACC,uBAAuB,EAAE,EAAEC,gCAAgC,EAAE,CAAC,CAAC,CACzF,CAAC,EACFJ,eAAe,EAAE,EACjBf,eAAe,EAAE,CACpB;EACDiC,WAAW,EAAE,EAAE;EACfC,SAAS,EAAE;AACf,CAAC,CAAC;AAAC"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","_workflow","contentField","fields","createModelField","label","parent","type","multipleValues","settings","validation","message","name","contentStatus","fieldId","predefinedValues","enabled","values","value","titleField","contentIdField","workflowIdField","contentTypeField","contentSettingsField","contentSettingsModelIdField","scheduledActionIdField","contentScheduledOnField","contentScheduledByField","contentPublishedByField","stepStatusField","listValidation","renderer","id","storageId","stepPendingChangeRequests","stepTotalComments","latestCommentId","stepSignOffProvidedOn","stepSignOffProvidedBy","stepSignOffProvidedById","stepSignOffProvidedByDisplayName","stepsField","layout","map","field","CONTENT_REVIEW_MODEL_ID","exports","createContentReviewModel","reviewerModelId","createPrivateModel","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { stepTitleField, stepTypeField, stepIdField, stepReviewersField } from \"./workflow.model\";\n\nconst contentField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Content\",\n parent: \"contentReview\",\n type: \"object\",\n multipleValues: false,\n settings: { fields },\n validation: [\n {\n message: \"`content` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentStatus = () =>\n createModelField({\n label: \"Status\",\n fieldId: \"reviewStatus\",\n parent: \"contentReview\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Under review\",\n value: \"underReview\"\n },\n {\n label: \"Ready to be published\",\n value: \"readyToBePublished\"\n },\n {\n label: \"Published\",\n value: \"published\"\n }\n ]\n },\n validation: [\n {\n message: \"`reviewStatus` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`title` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Content\",\n validation: [\n {\n message: \"`id` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst workflowIdField = () =>\n createModelField({\n label: \"Workflow Id\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`workflowId` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"contentReview Type\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Page\",\n value: \"page\"\n },\n { value: \"cms_entry\", label: \"CMS Entry\" }\n ]\n },\n validation: [\n {\n message: \"`type` field value is required in contentReview Type.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentSettingsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Settings\",\n parent: \"contentReview Content\",\n type: \"object\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst contentSettingsModelIdField = () =>\n createModelField({\n label: \"Model Id\",\n parent: \"contentReview Settings\",\n type: \"text\"\n });\n\nconst scheduledActionIdField = () =>\n createModelField({\n label: \"Scheduled action Id\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledOnField = () =>\n createModelField({\n label: \"Scheduled on\",\n type: \"datetime\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledByField = () =>\n createModelField({\n label: \"Scheduled by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentPublishedByField = () =>\n createModelField({\n label: \"Published by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst stepStatusField = (): CmsModelField => ({\n multipleValues: false,\n listValidation: [],\n renderer: {\n name: \"radio-buttons\"\n },\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"done\",\n label: \"Steps done\"\n },\n {\n value: \"active\",\n label: \"Step active\"\n },\n {\n value: \"inactive\",\n label: \"Step inactive\"\n }\n ]\n },\n label: \"Status\",\n id: \"contentReview_steps_status\",\n type: \"text\",\n validation: [\n {\n message: \"`status` field value is required in contentReview steps status.\",\n name: \"required\"\n }\n ],\n storageId: \"status\",\n fieldId: \"status\"\n});\n\nconst stepPendingChangeRequests = () =>\n createModelField({\n label: \"Pending change requests\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`pendingChangeRequests` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepTotalComments = () =>\n createModelField({\n label: \"Total comments\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`totalComments` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst latestCommentId = () =>\n createModelField({\n label: \"Latest comment Id\",\n type: \"text\",\n parent: \"contentReview\"\n });\n\nconst stepSignOffProvidedOn = () =>\n createModelField({\n label: \"Sign off provided on\",\n type: \"datetime\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedBy = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Sign off provided By\",\n type: \"object\",\n parent: \"contentReview Step\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst stepSignOffProvidedById = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedByDisplayName = () =>\n createModelField({\n label: \"DisplayName\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepsField = (fields: CmsModelField[]): CmsModelField => ({\n id: \"contentReview_steps\",\n label: \"Steps\",\n type: \"object\",\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [],\n validation: [],\n fieldId: \"steps\",\n storageId: \"steps\",\n multipleValues: true,\n predefinedValues: {\n values: [],\n enabled: false\n }\n});\n\ninterface CreateContentReviewModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const CONTENT_REVIEW_MODEL_ID = \"apwContentReviewModelDefinition\";\n\nexport const createContentReviewModel = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Content Review\",\n modelId: CONTENT_REVIEW_MODEL_ID,\n titleFieldId: \"content\",\n fields: [\n titleField(),\n contentField([\n contentIdField(),\n contentTypeField(),\n contentSettingsField([contentSettingsModelIdField()]),\n contentScheduledOnField(),\n contentScheduledByField(),\n scheduledActionIdField(),\n contentPublishedByField()\n ]),\n contentStatus(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId),\n stepStatusField(),\n stepPendingChangeRequests(),\n stepTotalComments(),\n stepSignOffProvidedOn(),\n stepSignOffProvidedBy([\n stepSignOffProvidedById(),\n stepSignOffProvidedByDisplayName()\n ])\n ]),\n latestCommentId(),\n workflowIdField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,MAAMG,YAAY,GAAIC,MAAuB,IACzC,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,SAAS;EAChBC,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE;IAAEN;EAAO,CAAC;EACpBO,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,qDAAqD;IAC9DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,aAAa,GAAGA,CAAA,KAClB,IAAAT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AE;IACdE,MAAM,EAAE,EAAE;IACVD,OAAO,EAAE;EACb;AACJ,CAAC,CAAC;AAMK,MAAM6B,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,iCAAiC;AAEjE,MAAME,wBAAwB,GAAGA,CAAC;EACrCC;AACsC,CAAC,KAAK;EAC5C,OAAO,IAAAC,kCAAkB,EAAC;IACtBrC,IAAI,EAAE,sBAAsB;IAC5BsC,OAAO,EAAEL,uBAAuB;IAChCM,YAAY,EAAE,SAAS;IACvBhD,MAAM,EAAE,CACJgB,UAAU,CAAC,CAAC,EACZjB,YAAY,CAAC,CACTkB,cAAc,CAAC,CAAC,EAChBE,gBAAgB,CAAC,CAAC,EAClBC,oBAAoB,CAAC,CAACC,2BAA2B,CAAC,CAAC,CAAC,CAAC,EACrDE,uBAAuB,CAAC,CAAC,EACzBC,uBAAuB,CAAC,CAAC,EACzBF,sBAAsB,CAAC,CAAC,EACxBG,uBAAuB,CAAC,CAAC,CAC5B,CAAC,EACFf,aAAa,CAAC,CAAC,EACf4B,UAAU,CAAC,CACP,IAAAW,wBAAc,EAAC,CAAC,EAChB,IAAAC,uBAAa,EAAC,CAAC,EACf,IAAAC,qBAAW,EAAC,CAAC,EACb,IAAAC,4BAAkB,EAACP,eAAe,CAAC,EACnCnB,eAAe,CAAC,CAAC,EACjBK,yBAAyB,CAAC,CAAC,EAC3BC,iBAAiB,CAAC,CAAC,EACnBE,qBAAqB,CAAC,CAAC,EACvBC,qBAAqB,CAAC,CAClBC,uBAAuB,CAAC,CAAC,EACzBC,gCAAgC,CAAC,CAAC,CACrC,CAAC,CACL,CAAC,EACFJ,eAAe,CAAC,CAAC,EACjBf,eAAe,CAAC,CAAC;EAEzB,CAAC,CAAC;AACN,CAAC;AAACyB,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsContext } from "@webiny/api-headless-cms/types";
1
+ import type { CmsContext } from "@webiny/api-headless-cms/types";
2
2
  export declare const createApwModels: (context: CmsContext) => void;
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.createApwModels = void 0;
8
8
  var _error = _interopRequireDefault(require("@webiny/error"));
9
9
  var _apiHeadlessCms = require("@webiny/api-headless-cms");
10
- var _contentModelPluginFactory = require("./contentModelPluginFactory");
11
10
  var _workflow = require("./workflow.model");
12
11
  var _contentReview = require("./contentReview.model");
13
12
  var _reviewer = require("./reviewer.model");
@@ -29,51 +28,31 @@ const createApwModels = context => {
29
28
  })) {
30
29
  return;
31
30
  }
32
- context.security.disableAuthorization();
33
31
  const locale = context.i18n.getContentLocale();
34
32
  if (!locale) {
35
33
  throw new _error.default("Missing content locale in api-apw/storageOperations/index.ts", "LOCALE_ERROR");
36
34
  }
37
- /**
38
- * TODO:@ashutosh
39
- * We need to move these plugin in an installation plugin
40
- */
41
- const groupId = "contentModelGroup_apw";
42
- /**
43
- * Create a CmsGroup.
44
- */
45
- const cmsGroupPlugin = new _apiHeadlessCms.CmsGroupPlugin({
46
- id: groupId,
47
- slug: "apw",
48
- name: "APW",
49
- description: "Group for Advanced Publishing Workflow",
50
- icon: "fas/star",
51
- isPrivate: true
52
- });
53
35
 
54
36
  /**
55
37
  * Create CmsModel plugins.
56
38
  */
57
- const changeRequestModelDefinition = (0, _changeRequest.createChangeRequestModelDefinition)();
58
- const reviewerModelDefinition = (0, _reviewer.createReviewerModelDefinition)();
59
- const workflowModelDefinition = (0, _workflow.createWorkflowModelDefinition)({
39
+ const changeRequestModelDefinition = (0, _changeRequest.createChangeRequestModel)();
40
+ const reviewerModelDefinition = (0, _reviewer.createReviewerModel)();
41
+ const workflowModelDefinition = (0, _workflow.createWorkflowModel)({
60
42
  reviewerModelId: reviewerModelDefinition.modelId
61
43
  });
62
- const commentModelDefinition = (0, _comment.createCommentModelDefinition)({
44
+ const commentModelDefinition = (0, _comment.createCommentModel)({
63
45
  modelId: changeRequestModelDefinition.modelId
64
46
  });
65
- const contentReviewModelDefinition = (0, _contentReview.createContentReviewModelDefinition)({
47
+ const contentReviewModelDefinition = (0, _contentReview.createContentReviewModel)({
66
48
  reviewerModelId: reviewerModelDefinition.modelId
67
49
  });
68
50
  const modelDefinitions = [workflowModelDefinition, contentReviewModelDefinition, reviewerModelDefinition, changeRequestModelDefinition, commentModelDefinition];
69
51
  const cmsModelPlugins = [];
70
52
  for (const modelDefinition of modelDefinitions) {
71
- const cmsModelPlugin = (0, _contentModelPluginFactory.contentModelPluginFactory)({
72
- group: cmsGroupPlugin.contentModelGroup,
73
- modelDefinition
74
- });
53
+ const cmsModelPlugin = (0, _apiHeadlessCms.createCmsModel)(modelDefinition);
75
54
  /**
76
- * We want "title" field as the "titleField" for "ContentReview" model.
55
+ * We want "title" field as the title field for "ContentReview" model.
77
56
  * so that we can later search entries by title.
78
57
  */
79
58
  if (cmsModelPlugin.contentModel.modelId === "apwContentReviewModelDefinition") {
@@ -85,7 +64,8 @@ const createApwModels = context => {
85
64
  /**
86
65
  * Register them so that they are accessible in cms context
87
66
  */
88
- context.plugins.register([cmsGroupPlugin, cmsModelPlugins]);
89
- context.security.enableAuthorization();
67
+ context.plugins.register(...cmsModelPlugins);
90
68
  };
91
- exports.createApwModels = createApwModels;
69
+ exports.createApwModels = createApwModels;
70
+
71
+ //# sourceMappingURL=index.js.map