@webiny/api-apw 0.0.0-unstable.1e66d121db → 0.0.0-unstable.2696f9d9e8

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 (267) hide show
  1. package/ApwChangeRequestNotification.d.ts +27 -0
  2. package/ApwChangeRequestNotification.js +28 -0
  3. package/ApwChangeRequestNotification.js.map +1 -0
  4. package/ApwCommentNotification.d.ts +27 -0
  5. package/ApwCommentNotification.js +28 -0
  6. package/ApwCommentNotification.js.map +1 -0
  7. package/ApwContentReviewNotification.d.ts +26 -0
  8. package/ApwContentReviewNotification.js +28 -0
  9. package/ApwContentReviewNotification.js.map +1 -0
  10. package/ApwContentUrlPlugin.d.ts +19 -0
  11. package/ApwContentUrlPlugin.js +28 -0
  12. package/ApwContentUrlPlugin.js.map +1 -0
  13. package/ContentApwSettingsPlugin.js +5 -9
  14. package/ContentApwSettingsPlugin.js.map +1 -1
  15. package/README.md +3 -3
  16. package/crud/createChangeRequestMethods.js +7 -12
  17. package/crud/createChangeRequestMethods.js.map +1 -1
  18. package/crud/createCommentMethods.js +7 -13
  19. package/crud/createCommentMethods.js.map +1 -1
  20. package/crud/createContentReviewMethods.js +83 -111
  21. package/crud/createContentReviewMethods.js.map +1 -1
  22. package/crud/createReviewerMethods.js +7 -13
  23. package/crud/createReviewerMethods.js.map +1 -1
  24. package/crud/createWorkflowMethods.js +7 -18
  25. package/crud/createWorkflowMethods.js.map +1 -1
  26. package/crud/index.js +5 -29
  27. package/crud/index.js.map +1 -1
  28. package/crud/utils.js +6 -33
  29. package/crud/utils.js.map +1 -1
  30. package/index.d.ts +2 -3
  31. package/index.js +6 -16
  32. package/index.js.map +1 -1
  33. package/package.json +40 -47
  34. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +4 -19
  35. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  36. package/plugins/cms/apwEntryPlugins.js +8 -13
  37. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  38. package/plugins/cms/index.js +7 -10
  39. package/plugins/cms/index.js.map +1 -1
  40. package/plugins/cms/linkContentReviewToEntry.js +4 -20
  41. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  42. package/plugins/cms/linkWorkflowToEntry.js +17 -45
  43. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  44. package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
  45. package/plugins/cms/notifications/changeRequestNotification.js +33 -0
  46. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
  47. package/plugins/cms/notifications/commentNotification.d.ts +1 -0
  48. package/plugins/cms/notifications/commentNotification.js +33 -0
  49. package/plugins/cms/notifications/commentNotification.js.map +1 -0
  50. package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
  51. package/plugins/cms/notifications/contentReviewNotification.js +33 -0
  52. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
  53. package/plugins/cms/notifications/contentUrl.d.ts +8 -0
  54. package/plugins/cms/notifications/contentUrl.js +55 -0
  55. package/plugins/cms/notifications/contentUrl.js.map +1 -0
  56. package/plugins/cms/triggerContentReview.js +5 -18
  57. package/plugins/cms/triggerContentReview.js.map +1 -1
  58. package/plugins/cms/updateContentReviewStatus.js +14 -30
  59. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  60. package/plugins/cms/utils.d.ts +3 -2
  61. package/plugins/cms/utils.js +23 -60
  62. package/plugins/cms/utils.js.map +1 -1
  63. package/plugins/context.d.ts +0 -1
  64. package/plugins/context.js +2 -45
  65. package/plugins/context.js.map +1 -1
  66. package/plugins/graphql/changeRequest.gql.js +16 -19
  67. package/plugins/graphql/changeRequest.gql.js.map +1 -1
  68. package/plugins/graphql/comment.gql.js +41 -42
  69. package/plugins/graphql/comment.gql.js.map +1 -1
  70. package/plugins/graphql/contentReview.gql.js +25 -34
  71. package/plugins/graphql/contentReview.gql.js.map +1 -1
  72. package/plugins/graphql/reviewer.gql.js +17 -19
  73. package/plugins/graphql/reviewer.gql.js.map +1 -1
  74. package/plugins/graphql/utils.d.ts +2 -0
  75. package/plugins/graphql/utils.js +12 -0
  76. package/plugins/graphql/utils.js.map +1 -0
  77. package/plugins/graphql/workflow.gql.js +15 -19
  78. package/plugins/graphql/workflow.gql.js.map +1 -1
  79. package/plugins/graphql.js +5 -18
  80. package/plugins/graphql.js.map +1 -1
  81. package/plugins/hooks/createReviewerFromIdentity.js +28 -15
  82. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  83. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +3 -9
  84. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  85. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +3 -8
  86. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  87. package/plugins/hooks/index.js +4 -13
  88. package/plugins/hooks/index.js.map +1 -1
  89. package/plugins/hooks/initializeContentReviewSteps.js +15 -20
  90. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  91. package/plugins/hooks/initializeNotifications.d.ts +2 -0
  92. package/plugins/hooks/initializeNotifications.js +17 -0
  93. package/plugins/hooks/initializeNotifications.js.map +1 -0
  94. package/plugins/hooks/listContentReviews.d.ts +1 -1
  95. package/plugins/hooks/listContentReviews.js +11 -33
  96. package/plugins/hooks/listContentReviews.js.map +1 -1
  97. package/plugins/hooks/notifications/appUrl.d.ts +2 -0
  98. package/plugins/hooks/notifications/appUrl.js +20 -0
  99. package/plugins/hooks/notifications/appUrl.js.map +1 -0
  100. package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
  101. package/plugins/hooks/notifications/changeRequestAfterCreate.js +113 -0
  102. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
  103. package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
  104. package/plugins/hooks/notifications/changeRequestUrl.js +29 -0
  105. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
  106. package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
  107. package/plugins/hooks/notifications/commentAfterCreate.js +124 -0
  108. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
  109. package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
  110. package/plugins/hooks/notifications/commentUrl.js +29 -0
  111. package/plugins/hooks/notifications/commentUrl.js.map +1 -0
  112. package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
  113. package/plugins/hooks/notifications/contentReviewAfterCreate.js +96 -0
  114. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
  115. package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
  116. package/plugins/hooks/notifications/contentReviewUrl.js +28 -0
  117. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
  118. package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
  119. package/plugins/hooks/notifications/contentUrl.js +26 -0
  120. package/plugins/hooks/notifications/contentUrl.js.map +1 -0
  121. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
  122. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +23 -0
  123. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
  124. package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
  125. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +23 -0
  126. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
  127. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
  128. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +23 -0
  129. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
  130. package/plugins/hooks/notifications/reviewers.d.ts +15 -0
  131. package/plugins/hooks/notifications/reviewers.js +47 -0
  132. package/plugins/hooks/notifications/reviewers.js.map +1 -0
  133. package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
  134. package/plugins/hooks/notifications/sendChangeRequestNotification.js +43 -0
  135. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
  136. package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
  137. package/plugins/hooks/notifications/sendCommentNotification.js +43 -0
  138. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
  139. package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
  140. package/plugins/hooks/notifications/sendContentReviewNotification.js +43 -0
  141. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
  142. package/plugins/hooks/updatePendingChangeRequests.js +7 -13
  143. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  144. package/plugins/hooks/updateTotalComments.js +21 -23
  145. package/plugins/hooks/updateTotalComments.js.map +1 -1
  146. package/plugins/hooks/validateChangeRequest.js +27 -16
  147. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  148. package/plugins/hooks/validateComment.js +13 -12
  149. package/plugins/hooks/validateComment.js.map +1 -1
  150. package/plugins/hooks/validateContentReview.js +2 -6
  151. package/plugins/hooks/validateContentReview.js.map +1 -1
  152. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +4 -19
  153. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
  154. package/plugins/pageBuilder/apwContentPagePlugins.js +2 -4
  155. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
  156. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +3 -6
  157. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
  158. package/plugins/pageBuilder/index.js +7 -8
  159. package/plugins/pageBuilder/index.js.map +1 -1
  160. package/plugins/pageBuilder/linkContentReviewToPage.js +15 -27
  161. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
  162. package/plugins/pageBuilder/linkWorkflowToPage.js +3 -31
  163. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  164. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
  165. package/plugins/pageBuilder/notifications/changeRequestNotification.js +33 -0
  166. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
  167. package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
  168. package/plugins/pageBuilder/notifications/commentNotification.js +33 -0
  169. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
  170. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
  171. package/plugins/pageBuilder/notifications/contentReviewNotification.js +33 -0
  172. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
  173. package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
  174. package/plugins/pageBuilder/notifications/contentUrl.js +49 -0
  175. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
  176. package/plugins/pageBuilder/triggerContentReview.js +2 -11
  177. package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
  178. package/plugins/pageBuilder/updateContentReviewStatus.js +10 -17
  179. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
  180. package/plugins/pageBuilder/utils.d.ts +2 -2
  181. package/plugins/pageBuilder/utils.js +3 -35
  182. package/plugins/pageBuilder/utils.js.map +1 -1
  183. package/plugins/utils.d.ts +1 -2
  184. package/plugins/utils.js +6 -52
  185. package/plugins/utils.js.map +1 -1
  186. package/scheduler/createScheduleActionMethods.js +45 -50
  187. package/scheduler/createScheduleActionMethods.js.map +1 -1
  188. package/scheduler/handlers/executeAction/index.d.ts +1 -1
  189. package/scheduler/handlers/executeAction/index.js +47 -40
  190. package/scheduler/handlers/executeAction/index.js.map +1 -1
  191. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
  192. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +19 -9
  193. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  194. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -3
  195. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +11 -28
  196. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  197. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +2 -2
  198. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +10 -92
  199. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  200. package/scheduler/handlers/executeAction/security.js +2 -11
  201. package/scheduler/handlers/executeAction/security.js.map +1 -1
  202. package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
  203. package/scheduler/handlers/scheduleAction/index.js +24 -37
  204. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  205. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +20 -36
  206. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  207. package/scheduler/handlers/utils.d.ts +2 -4
  208. package/scheduler/handlers/utils.js +8 -47
  209. package/scheduler/handlers/utils.js.map +1 -1
  210. package/scheduler/index.js +2 -3
  211. package/scheduler/index.js.map +1 -1
  212. package/scheduler/types.d.ts +12 -28
  213. package/scheduler/types.js +13 -22
  214. package/scheduler/types.js.map +1 -1
  215. package/storageOperations/changeRequestStorageOperations.js +59 -45
  216. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  217. package/storageOperations/commentStorageOperations.js +35 -50
  218. package/storageOperations/commentStorageOperations.js.map +1 -1
  219. package/storageOperations/contentReviewStorageOperations.d.ts +1 -1
  220. package/storageOperations/contentReviewStorageOperations.js +34 -43
  221. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  222. package/storageOperations/index.d.ts +1 -7
  223. package/storageOperations/index.js +10 -29
  224. package/storageOperations/index.js.map +1 -1
  225. package/storageOperations/models/changeRequest.model.d.ts +1 -2
  226. package/storageOperations/models/changeRequest.model.js +6 -15
  227. package/storageOperations/models/changeRequest.model.js.map +1 -1
  228. package/storageOperations/models/comment.model.d.ts +1 -2
  229. package/storageOperations/models/comment.model.js +6 -14
  230. package/storageOperations/models/comment.model.js.map +1 -1
  231. package/storageOperations/models/contentReview.model.d.ts +1 -2
  232. package/storageOperations/models/contentReview.model.js +13 -37
  233. package/storageOperations/models/contentReview.model.js.map +1 -1
  234. package/storageOperations/models/index.js +6 -50
  235. package/storageOperations/models/index.js.map +1 -1
  236. package/storageOperations/models/reviewer.model.d.ts +1 -2
  237. package/storageOperations/models/reviewer.model.js +22 -14
  238. package/storageOperations/models/reviewer.model.js.map +1 -1
  239. package/storageOperations/models/utils.js +2 -4
  240. package/storageOperations/models/utils.js.map +1 -1
  241. package/storageOperations/models/workflow.model.d.ts +1 -2
  242. package/storageOperations/models/workflow.model.js +19 -42
  243. package/storageOperations/models/workflow.model.js.map +1 -1
  244. package/storageOperations/reviewerStorageOperations.d.ts +1 -1
  245. package/storageOperations/reviewerStorageOperations.js +34 -40
  246. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  247. package/storageOperations/types.js +3 -1
  248. package/storageOperations/workflowStorageOperations.js +40 -47
  249. package/storageOperations/workflowStorageOperations.js.map +1 -1
  250. package/types.d.ts +39 -25
  251. package/types.js +126 -42
  252. package/types.js.map +1 -1
  253. package/utils/contentApwSettingsPlugin.js +2 -6
  254. package/utils/contentApwSettingsPlugin.js.map +1 -1
  255. package/utils/errors.js +2 -17
  256. package/utils/errors.js.map +1 -1
  257. package/utils/fieldResolver.js +8 -18
  258. package/utils/fieldResolver.js.map +1 -1
  259. package/utils/pickEntryFieldValues.d.ts +3 -0
  260. package/utils/pickEntryFieldValues.js +31 -0
  261. package/utils/pickEntryFieldValues.js.map +1 -0
  262. package/utils/resolve.d.ts +1 -1
  263. package/utils/resolve.js +2 -3
  264. package/utils/resolve.js.map +1 -1
  265. package/storageOperations/models/contentModelPluginFactory.d.ts +0 -15
  266. package/storageOperations/models/contentModelPluginFactory.js +0 -28
  267. package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.stepTypeField = exports.stepTitleField = exports.stepReviewersField = exports.stepIdField = exports.createWorkflowModelDefinition = exports.WORKFLOW_MODEL_ID = void 0;
7
-
7
+ var _apiHeadlessCms = require("@webiny/api-headless-cms");
8
8
  var _utils = require("./utils");
9
-
9
+ var _types = require("../../types");
10
10
  const titleField = () => (0, _utils.createModelField)({
11
11
  label: "Title",
12
12
  type: "text",
@@ -16,7 +16,6 @@ const titleField = () => (0, _utils.createModelField)({
16
16
  name: "required"
17
17
  }]
18
18
  });
19
-
20
19
  const stepsField = fields => (0, _utils.createModelField)({
21
20
  label: "Steps",
22
21
  type: "object",
@@ -26,7 +25,6 @@ const stepsField = fields => (0, _utils.createModelField)({
26
25
  },
27
26
  multipleValues: true
28
27
  });
29
-
30
28
  const stepTitleField = () => (0, _utils.createModelField)({
31
29
  label: "Title",
32
30
  type: "text",
@@ -36,9 +34,7 @@ const stepTitleField = () => (0, _utils.createModelField)({
36
34
  name: "required"
37
35
  }]
38
36
  });
39
-
40
37
  exports.stepTitleField = stepTitleField;
41
-
42
38
  const stepTypeField = () => (0, _utils.createModelField)({
43
39
  label: "Type",
44
40
  type: "text",
@@ -61,9 +57,7 @@ const stepTypeField = () => (0, _utils.createModelField)({
61
57
  message: "`type` field value is required in workflow steps."
62
58
  }]
63
59
  });
64
-
65
60
  exports.stepTypeField = stepTypeField;
66
-
67
61
  const stepIdField = () => (0, _utils.createModelField)({
68
62
  label: "Id",
69
63
  type: "text",
@@ -73,9 +67,7 @@ const stepIdField = () => (0, _utils.createModelField)({
73
67
  name: "required"
74
68
  }]
75
69
  });
76
-
77
70
  exports.stepIdField = stepIdField;
78
-
79
71
  const stepReviewersField = reviewerModelId => (0, _utils.createModelField)({
80
72
  label: "Reviewers",
81
73
  type: "ref",
@@ -94,9 +86,7 @@ const stepReviewersField = reviewerModelId => (0, _utils.createModelField)({
94
86
  }
95
87
  }]
96
88
  });
97
-
98
89
  exports.stepReviewersField = stepReviewersField;
99
-
100
90
  const scopeField = fields => (0, _utils.createModelField)({
101
91
  type: "object",
102
92
  label: "Scope",
@@ -105,7 +95,6 @@ const scopeField = fields => (0, _utils.createModelField)({
105
95
  fields
106
96
  }
107
97
  });
108
-
109
98
  const scopeTypeField = () => (0, _utils.createModelField)({
110
99
  label: "Type",
111
100
  parent: "workflow scope",
@@ -117,18 +106,14 @@ const scopeTypeField = () => (0, _utils.createModelField)({
117
106
  predefinedValues: {
118
107
  enabled: true,
119
108
  values: [{
120
- value: "default",
109
+ value: _types.WorkflowScopeTypes.DEFAULT,
121
110
  label: "Default - Catch all scope that applies to all content that's being published."
122
111
  }, {
123
- value: "pageBuilder",
124
- label: "Page category (Page Builder only) - The workflow will apply to all pages inside specific categories."
125
- }, {
126
- value: "cms",
127
- label: "Content model (Headless CMS only) - The workflow will apply to all the content inside the specific content models. "
112
+ value: _types.WorkflowScopeTypes.CUSTOM,
113
+ label: "Custom - The workflow will be applied to all selected content."
128
114
  }]
129
115
  }
130
116
  });
131
-
132
117
  const scopeDataField = fields => (0, _utils.createModelField)({
133
118
  label: "Data",
134
119
  parent: "workflow scope",
@@ -137,35 +122,30 @@ const scopeDataField = fields => (0, _utils.createModelField)({
137
122
  fields
138
123
  }
139
124
  });
140
-
141
125
  const scopeDataPbCategories = () => (0, _utils.createModelField)({
142
126
  label: "Categories",
143
127
  parent: "workflow scope data",
144
128
  type: "text",
145
129
  multipleValues: true
146
130
  });
147
-
148
131
  const scopeDataPbPages = () => (0, _utils.createModelField)({
149
132
  label: "Pages",
150
133
  parent: "workflow scope data",
151
134
  type: "text",
152
135
  multipleValues: true
153
136
  });
154
-
155
137
  const scopeDataCmsModels = () => (0, _utils.createModelField)({
156
138
  label: "Models",
157
139
  parent: "workflow scope data",
158
140
  type: "text",
159
141
  multipleValues: true
160
142
  });
161
-
162
143
  const scopeDataCmsEntries = () => (0, _utils.createModelField)({
163
144
  label: "Entries",
164
145
  parent: "workflow scope data",
165
146
  type: "text",
166
147
  multipleValues: true
167
148
  });
168
-
169
149
  const applicationField = () => (0, _utils.createModelField)({
170
150
  parent: "workflow",
171
151
  type: "text",
@@ -185,24 +165,21 @@ const applicationField = () => (0, _utils.createModelField)({
185
165
  }]
186
166
  }
187
167
  });
188
-
189
168
  const WORKFLOW_MODEL_ID = "apwWorkflowModelDefinition";
190
169
  exports.WORKFLOW_MODEL_ID = WORKFLOW_MODEL_ID;
191
-
192
170
  const createWorkflowModelDefinition = ({
193
171
  reviewerModelId
194
- }) => ({
195
- name: "APW - Workflow",
196
-
197
- /**
198
- * Id of the model cannot be appWorkflow because it clashes with the GraphQL types for APW.
199
- */
200
- modelId: WORKFLOW_MODEL_ID,
201
- layout: [["workflow_title"], ["workflow_steps"], ["workflow_scope"], ["workflow_app"]],
202
- titleFieldId: "title",
203
- description: "",
204
- fields: [titleField(), stepsField([stepTitleField(), stepTypeField(), stepIdField(), stepReviewersField(reviewerModelId)]), scopeField([scopeTypeField(), scopeDataField([scopeDataPbCategories(), scopeDataPbPages(), scopeDataCmsModels(), scopeDataCmsEntries()])]), applicationField()],
205
- isPrivate: true
206
- });
207
-
208
- exports.createWorkflowModelDefinition = createWorkflowModelDefinition;
172
+ }) => {
173
+ return (0, _apiHeadlessCms.createPrivateModelDefinition)({
174
+ name: "APW - Workflow",
175
+ /**
176
+ * Id of the model cannot be appWorkflow because it clashes with the GraphQL types for APW.
177
+ */
178
+ modelId: WORKFLOW_MODEL_ID,
179
+ titleFieldId: "title",
180
+ fields: [titleField(), stepsField([stepTitleField(), stepTypeField(), stepIdField(), stepReviewersField(reviewerModelId)]), scopeField([scopeTypeField(), scopeDataField([scopeDataPbCategories(), scopeDataPbPages(), scopeDataCmsModels(), scopeDataCmsEntries()])]), applicationField()]
181
+ });
182
+ };
183
+ exports.createWorkflowModelDefinition = createWorkflowModelDefinition;
184
+
185
+ //# sourceMappingURL=workflow.model.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["titleField","createModelField","label","type","parent","validation","message","name","stepsField","fields","settings","multipleValues","stepTitleField","stepTypeField","predefinedValues","enabled","values","value","stepIdField","stepReviewersField","reviewerModelId","models","modelId","listValidation","scopeField","scopeTypeField","scopeDataField","scopeDataPbCategories","scopeDataPbPages","scopeDataCmsModels","scopeDataCmsEntries","applicationField","WORKFLOW_MODEL_ID","createWorkflowModelDefinition","layout","titleFieldId","description","isPrivate"],"sources":["workflow.model.ts"],"sourcesContent":["import { createModelField } from \"./utils\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { WorkflowModelDefinition } from \"~/types\";\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"workflow\",\n validation: [\n {\n message: \"`title` field value is required in workflow.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Steps\",\n type: \"object\",\n parent: \"workflow\",\n settings: {\n fields\n },\n multipleValues: true\n });\n\nexport const stepTitleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"workflow steps\",\n validation: [\n {\n message: \"`title` field value is required in workflow steps.\",\n name: \"required\"\n }\n ]\n });\n\nexport const stepTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"workflow steps\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"mandatoryBlocking\",\n label: \"Mandatory, blocking - An approval from a reviewer is required before being able to move to the next step and publish the content. \"\n },\n {\n value: \"mandatoryNonBlocking\",\n label: \"Mandatory, non-blocking - An approval from a reviewer is to publish the content, but the next step in the review workflow is not blocked. \"\n },\n {\n value: \"notMandatory\",\n label: \"Not mandatory - This is an optional review step. The content can be published regardless if an approval is provided or not.\"\n }\n ]\n },\n validation: [\n {\n name: \"required\",\n message: \"`type` field value is required in workflow steps.\"\n }\n ]\n });\n\nexport const stepIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"workflow steps\",\n validation: [\n {\n message: \"`id` field value is required in workflow steps.\",\n name: \"required\"\n }\n ]\n });\n\nexport const stepReviewersField = (reviewerModelId: string) =>\n createModelField({\n label: \"Reviewers\",\n type: \"ref\",\n parent: \"workflow steps\",\n multipleValues: true,\n settings: {\n models: [\n {\n modelId: reviewerModelId\n }\n ]\n },\n listValidation: [\n {\n name: \"minLength\",\n message: \"Value is too short.\",\n settings: {\n value: \"1\"\n }\n }\n ]\n });\n\nconst scopeField = (fields: CmsModelField[]) =>\n createModelField({\n type: \"object\",\n label: \"Scope\",\n parent: \"workflow\",\n settings: {\n fields\n }\n });\n\nconst scopeTypeField = () =>\n createModelField({\n label: \"Type\",\n parent: \"workflow scope\",\n type: \"text\",\n validation: [\n {\n message: \"`type` field value is required in workflow scope.\",\n name: \"required\"\n }\n ],\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"default\",\n label: \"Default - Catch all scope that applies to all content that's being published.\"\n },\n {\n value: \"pageBuilder\",\n label: \"Page category (Page Builder only) - The workflow will apply to all pages inside specific categories.\"\n },\n {\n value: \"cms\",\n label: \"Content model (Headless CMS only) - The workflow will apply to all the content inside the specific content models. \"\n }\n ]\n }\n });\n\nconst scopeDataField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Data\",\n parent: \"workflow scope\",\n type: \"object\",\n settings: {\n fields\n }\n });\n\nconst scopeDataPbCategories = () =>\n createModelField({\n label: \"Categories\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataPbPages = () =>\n createModelField({\n label: \"Pages\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataCmsModels = () =>\n createModelField({\n label: \"Models\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataCmsEntries = () =>\n createModelField({\n label: \"Entries\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\n\nconst applicationField = () =>\n createModelField({\n parent: \"workflow\",\n type: \"text\",\n label: \"App\",\n validation: [\n {\n message: \"`app` field value is required in workflow.\",\n name: \"required\"\n }\n ],\n predefinedValues: {\n enabled: true,\n values: [\n { label: \"Page Builder\", value: \"pageBuilder\" },\n { label: \"Headless CMS\", value: \"cms\" }\n ]\n }\n });\n\ninterface CreateWorkflowModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const WORKFLOW_MODEL_ID = \"apwWorkflowModelDefinition\";\n\nexport const createWorkflowModelDefinition = ({\n reviewerModelId\n}: CreateWorkflowModelDefinitionParams): WorkflowModelDefinition => ({\n name: \"APW - Workflow\",\n /**\n * Id of the model cannot be appWorkflow because it clashes with the GraphQL types for APW.\n */\n modelId: WORKFLOW_MODEL_ID,\n layout: [[\"workflow_title\"], [\"workflow_steps\"], [\"workflow_scope\"], [\"workflow_app\"]],\n titleFieldId: \"title\",\n description: \"\",\n fields: [\n titleField(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId)\n ]),\n scopeField([\n scopeTypeField(),\n scopeDataField([\n scopeDataPbCategories(),\n scopeDataPbPages(),\n scopeDataCmsModels(),\n scopeDataCmsEntries()\n ])\n ]),\n applicationField()\n ],\n isPrivate: true\n});\n"],"mappings":";;;;;;;AAAA;;AAIA,MAAMA,UAAU,GAAG,MACf,IAAAC,uBAAA,EAAiB;EACbC,KAAK,EAAE,OADM;EAEbC,IAAI,EAAE,MAFO;EAGbC,MAAM,EAAE,UAHK;EAIbC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,8CADb;IAEIC,IAAI,EAAE;EAFV,CADQ;AAJC,CAAjB,CADJ;;AAaA,MAAMC,UAAU,GAAIC,MAAD,IACf,IAAAR,uBAAA,EAAiB;EACbC,KAAK,EAAE,OADM;EAEbC,IAAI,EAAE,QAFO;EAGbC,MAAM,EAAE,UAHK;EAIbM,QAAQ,EAAE;IACND;EADM,CAJG;EAObE,cAAc,EAAE;AAPH,CAAjB,CADJ;;AAWO,MAAMC,cAAc,GAAG,MAC1B,IAAAX,uBAAA,EAAiB;EACbC,KAAK,EAAE,OADM;EAEbC,IAAI,EAAE,MAFO;EAGb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HJ,EAIPC,kBAAkB,CAACC,eAAD,CAJX,CAAD,CAFN,EAQJI,UAAU,CAAC,CACPC,cAAc,EADP,EAEPC,cAAc,CAAC,CACXC,qBAAqB,EADV,EAEXC,gBAAgB,EAFL,EAGXC,kBAAkB,EAHP,EAIXC,mBAAmB,EAJR,CAAD,CAFP,CAAD,CARN,EAiBJC,gBAAgB,EAjBZ,CATyD;EA4BjEM,SAAS,EAAE;AA5BsD,CAFxB,CAAtC"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","_types","titleField","createModelField","label","type","parent","validation","message","name","stepsField","fields","settings","multipleValues","stepTitleField","exports","stepTypeField","predefinedValues","enabled","values","value","stepIdField","stepReviewersField","reviewerModelId","models","modelId","listValidation","scopeField","scopeTypeField","WorkflowScopeTypes","DEFAULT","CUSTOM","scopeDataField","scopeDataPbCategories","scopeDataPbPages","scopeDataCmsModels","scopeDataCmsEntries","applicationField","WORKFLOW_MODEL_ID","createWorkflowModelDefinition","createPrivateModelDefinition","titleFieldId"],"sources":["workflow.model.ts"],"sourcesContent":["import { createPrivateModelDefinition } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { WorkflowScopeTypes } from \"~/types\";\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"workflow\",\n validation: [\n {\n message: \"`title` field value is required in workflow.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Steps\",\n type: \"object\",\n parent: \"workflow\",\n settings: {\n fields\n },\n multipleValues: true\n });\n\nexport const stepTitleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"workflow steps\",\n validation: [\n {\n message: \"`title` field value is required in workflow steps.\",\n name: \"required\"\n }\n ]\n });\n\nexport const stepTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"workflow steps\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"mandatoryBlocking\",\n label: \"Mandatory, blocking - An approval from a reviewer is required before being able to move to the next step and publish the content. \"\n },\n {\n value: \"mandatoryNonBlocking\",\n label: \"Mandatory, non-blocking - An approval from a reviewer is to publish the content, but the next step in the review workflow is not blocked. \"\n },\n {\n value: \"notMandatory\",\n label: \"Not mandatory - This is an optional review step. The content can be published regardless if an approval is provided or not.\"\n }\n ]\n },\n validation: [\n {\n name: \"required\",\n message: \"`type` field value is required in workflow steps.\"\n }\n ]\n });\n\nexport const stepIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"workflow steps\",\n validation: [\n {\n message: \"`id` field value is required in workflow steps.\",\n name: \"required\"\n }\n ]\n });\n\nexport const stepReviewersField = (reviewerModelId: string) =>\n createModelField({\n label: \"Reviewers\",\n type: \"ref\",\n parent: \"workflow steps\",\n multipleValues: true,\n settings: {\n models: [\n {\n modelId: reviewerModelId\n }\n ]\n },\n listValidation: [\n {\n name: \"minLength\",\n message: \"Value is too short.\",\n settings: {\n value: \"1\"\n }\n }\n ]\n });\n\nconst scopeField = (fields: CmsModelField[]) =>\n createModelField({\n type: \"object\",\n label: \"Scope\",\n parent: \"workflow\",\n settings: {\n fields\n }\n });\n\nconst scopeTypeField = () =>\n createModelField({\n label: \"Type\",\n parent: \"workflow scope\",\n type: \"text\",\n validation: [\n {\n message: \"`type` field value is required in workflow scope.\",\n name: \"required\"\n }\n ],\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: WorkflowScopeTypes.DEFAULT,\n label: \"Default - Catch all scope that applies to all content that's being published.\"\n },\n {\n value: WorkflowScopeTypes.CUSTOM,\n label: \"Custom - The workflow will be applied to all selected content.\"\n }\n ]\n }\n });\n\nconst scopeDataField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Data\",\n parent: \"workflow scope\",\n type: \"object\",\n settings: {\n fields\n }\n });\n\nconst scopeDataPbCategories = () =>\n createModelField({\n label: \"Categories\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataPbPages = () =>\n createModelField({\n label: \"Pages\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataCmsModels = () =>\n createModelField({\n label: \"Models\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\nconst scopeDataCmsEntries = () =>\n createModelField({\n label: \"Entries\",\n parent: \"workflow scope data\",\n type: \"text\",\n multipleValues: true\n });\n\nconst applicationField = () =>\n createModelField({\n parent: \"workflow\",\n type: \"text\",\n label: \"App\",\n validation: [\n {\n message: \"`app` field value is required in workflow.\",\n name: \"required\"\n }\n ],\n predefinedValues: {\n enabled: true,\n values: [\n { label: \"Page Builder\", value: \"pageBuilder\" },\n { label: \"Headless CMS\", value: \"cms\" }\n ]\n }\n });\n\ninterface CreateWorkflowModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const WORKFLOW_MODEL_ID = \"apwWorkflowModelDefinition\";\n\nexport const createWorkflowModelDefinition = ({\n reviewerModelId\n}: CreateWorkflowModelDefinitionParams) => {\n return createPrivateModelDefinition({\n name: \"APW - Workflow\",\n /**\n * Id of the model cannot be appWorkflow because it clashes with the GraphQL types for APW.\n */\n modelId: WORKFLOW_MODEL_ID,\n titleFieldId: \"title\",\n fields: [\n titleField(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId)\n ]),\n scopeField([\n scopeTypeField(),\n scopeDataField([\n scopeDataPbCategories(),\n scopeDataPbPages(),\n scopeDataCmsModels(),\n scopeDataCmsEntries()\n ])\n ]),\n applicationField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAMG,UAAU,GAAGA,CAAA,KACf,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EAC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;MAAEf,KAAK,EAAE,cAAc;MAAEgB,KAAK,EAAE;IAAc,CAAC,EAC/C;MAAEhB,KAAK,EAAE,cAAc;MAAEgB,KAAK,EAAE;IAAM,CAAC;EAE/C;AACJ,CAAC,CAAC;AAMC,MAAMkB,iBAAiB,GAAG,4BAA4B;AAACvB,OAAA,CAAAuB,iBAAA,GAAAA,iBAAA;AAEvD,MAAMC,6BAA6B,GAAGA,CAAC;EAC1ChB;AACiC,CAAC,KAAK;EACvC,OAAO,IAAAiB,4CAA4B,EAAC;IAChC/B,IAAI,EAAE,gBAAgB;IACtB;AACR;AACA;IACQgB,OAAO,EAAEa,iBAAiB;IAC1BG,YAAY,EAAE,OAAO;IACrB9B,MAAM,EAAE,CACJT,UAAU,CAAC,CAAC,EACZQ,UAAU,CAAC,CACPI,cAAc,CAAC,CAAC,EAChBE,aAAa,CAAC,CAAC,EACfK,WAAW,CAAC,CAAC,EACbC,kBAAkB,CAACC,eAAe,CAAC,CACtC,CAAC,EACFI,UAAU,CAAC,CACPC,cAAc,CAAC,CAAC,EAChBI,cAAc,CAAC,CACXC,qBAAqB,CAAC,CAAC,EACvBC,gBAAgB,CAAC,CAAC,EAClBC,kBAAkB,CAAC,CAAC,EACpBC,mBAAmB,CAAC,CAAC,CACxB,CAAC,CACL,CAAC,EACFC,gBAAgB,CAAC,CAAC;EAE1B,CAAC,CAAC;AACN,CAAC;AAACtB,OAAA,CAAAwB,6BAAA,GAAAA,6BAAA"}
@@ -1,3 +1,3 @@
1
1
  import { ApwReviewerStorageOperations } from "./types";
2
- import { CreateApwStorageOperationsParams } from "./index";
2
+ import { CreateApwStorageOperationsParams } from ".";
3
3
  export declare const createReviewerStorageOperations: ({ cms, security }: CreateApwStorageOperationsParams) => ApwReviewerStorageOperations;
@@ -1,89 +1,83 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createReviewerStorageOperations = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _index = require("./index");
13
-
8
+ var _pickEntryFieldValues = require("../utils/pickEntryFieldValues");
14
9
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
10
  const createReviewerStorageOperations = ({
17
11
  cms,
18
12
  security
19
13
  }) => {
20
14
  const getReviewerModel = async () => {
21
- const model = await cms.getModel("apwReviewerModelDefinition");
22
-
15
+ const model = await security.withoutAuthorization(async () => {
16
+ return cms.getModel("apwReviewerModelDefinition");
17
+ });
23
18
  if (!model) {
24
19
  throw new _error.default("Could not find `apwReviewerModelDefinition` model.", "MODEL_NOT_FOUND_ERROR");
25
20
  }
26
-
27
21
  return model;
28
22
  };
29
-
30
23
  const getReviewer = async ({
31
24
  id
32
25
  }) => {
33
26
  const model = await getReviewerModel();
34
- security.disableAuthorization();
35
- const entry = await cms.getEntryById(model, id);
36
- security.enableAuthorization();
37
- return (0, _index.getFieldValues)(entry, _index.baseFields);
27
+ const entry = await security.withoutAuthorization(async () => {
28
+ return cms.getEntryById(model, id);
29
+ });
30
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
38
31
  };
39
-
40
32
  return {
41
33
  getReviewerModel,
42
34
  getReviewer,
43
-
44
35
  async listReviewers(params) {
45
36
  const model = await getReviewerModel();
46
- security.disableAuthorization();
47
- const [entries, meta] = await cms.listLatestEntries(model, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
48
- where: (0, _objectSpread2.default)({}, params.where)
49
- }));
50
- security.enableAuthorization();
51
- return [entries.map(entry => (0, _index.getFieldValues)(entry, _index.baseFields)), meta];
37
+ const [entries, meta] = await security.withoutAuthorization(async () => {
38
+ return cms.listLatestEntries(model, {
39
+ ...params,
40
+ where: {
41
+ ...params.where
42
+ }
43
+ });
44
+ });
45
+ return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
52
46
  },
53
-
54
47
  async createReviewer(params) {
55
48
  const model = await getReviewerModel();
56
- security.disableAuthorization();
57
- const entry = await cms.createEntry(model, params.data);
58
- security.enableAuthorization();
59
- return (0, _index.getFieldValues)(entry, _index.baseFields);
49
+ const entry = await security.withoutAuthorization(async () => {
50
+ return cms.createEntry(model, params.data);
51
+ });
52
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
60
53
  },
61
-
62
54
  async updateReviewer(params) {
63
55
  const model = await getReviewerModel();
64
56
  /**
65
57
  * We're fetching the existing entry here because we're not accepting "app" field as input,
66
58
  * but, we still need to retain its value after the "update" operation.
67
59
  */
68
-
69
60
  const existingEntry = await getReviewer({
70
61
  id: params.id
71
62
  });
72
- security.disableAuthorization();
73
- const entry = await cms.updateEntry(model, params.id, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, existingEntry), params.data));
74
- security.enableAuthorization();
75
- return (0, _index.getFieldValues)(entry, _index.baseFields);
63
+ const entry = await security.withoutAuthorization(async () => {
64
+ return cms.updateEntry(model, params.id, {
65
+ ...existingEntry,
66
+ ...params.data,
67
+ savedOn: new Date()
68
+ });
69
+ });
70
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
76
71
  },
77
-
78
72
  async deleteReviewer(params) {
79
73
  const model = await getReviewerModel();
80
- security.disableAuthorization();
81
- await cms.deleteEntry(model, params.id);
82
- security.enableAuthorization();
74
+ await security.withoutAuthorization(async () => {
75
+ return cms.deleteEntry(model, params.id);
76
+ });
83
77
  return true;
84
78
  }
85
-
86
79
  };
87
80
  };
81
+ exports.createReviewerStorageOperations = createReviewerStorageOperations;
88
82
 
89
- exports.createReviewerStorageOperations = createReviewerStorageOperations;
83
+ //# sourceMappingURL=reviewerStorageOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createReviewerStorageOperations","cms","security","getReviewerModel","model","getModel","WebinyError","getReviewer","id","disableAuthorization","entry","getEntryById","enableAuthorization","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 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 security.disableAuthorization();\n const entry = await cms.getEntryById(model, id);\n security.enableAuthorization();\n return getFieldValues(entry, baseFields);\n };\n return {\n getReviewerModel,\n getReviewer,\n async listReviewers(params) {\n const model = await getReviewerModel();\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 createReviewer(params) {\n const model = await getReviewerModel();\n security.disableAuthorization();\n const entry = await cms.createEntry(model, params.data);\n security.enableAuthorization();\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 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 deleteReviewer(params) {\n const model = await getReviewerModel();\n security.disableAuthorization();\n await cms.deleteEntry(model, params.id);\n security.enableAuthorization();\n return true;\n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,gBAAgB,EAApC;MACAD,QAAQ,CAACO,oBAAT;MACA,MAAMC,KAAK,GAAG,MAAMT,GAAG,CAACsB,WAAJ,CAAgBnB,KAAhB,EAAuBY,MAAM,CAACQ,IAA9B,CAApB;MACAtB,QAAQ,CAACU,mBAAT;MACA,OAAO,IAAAC,qBAAA,EAAeH,KAAf,EAAsBI,iBAAtB,CAAP;IACH,CArBE;;IAsBH,MAAMW,cAAN,CAAqBT,MAArB,EAA6B;MACzB,MAAMZ,KAAK,GAAG,MAAMD,gBAAgB,EAApC;MACA;AACZ;AACA;AACA;;MACY,MAAMuB,aAAa,GAAG,MAAMnB,WAAW,CAAC;QAAEC,EAAE,EAAEQ,MAAM,CAACR;MAAb,CAAD,CAAvC;MAEAN,QAAQ,CAACO,oBAAT;MACA,MAAMC,KAAK,GAAG,MAAMT,GAAG,CAAC0B,WAAJ,CAAgBvB,KAAhB,EAAuBY,MAAM,CAACR,EAA9B,8DACbkB,aADa,GAEbV,MAAM,CAACQ,IAFM,EAApB;MAIAtB,QAAQ,CAACU,mBAAT;MACA,OAAO,IAAAC,qBAAA,EAAeH,KAAf,EAAsBI,iBAAtB,CAAP;IACH,CArCE;;IAsCH,MAAMc,cAAN,CAAqBZ,MAArB,EAA6B;MACzB,MAAMZ,KAAK,GAAG,MAAMD,gBAAgB,EAApC;MACAD,QAAQ,CAACO,oBAAT;MACA,MAAMR,GAAG,CAAC4B,WAAJ,CAAgBzB,KAAhB,EAAuBY,MAAM,CAACR,EAA9B,CAAN;MACAN,QAAQ,CAACU,mBAAT;MACA,OAAO,IAAP;IACH;;EA5CE,CAAP;AA8CH,CAnEM"}
1
+ {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","createReviewerStorageOperations","cms","security","getReviewerModel","model","withoutAuthorization","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 { ApwReviewerStorageOperations } from \"./types\";\nimport { CreateApwStorageOperationsParams } from \"~/storageOperations\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { ApwReviewer } from \"~/types\";\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 pickEntryFieldValues(entry);\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(pickEntryFieldValues<ApwReviewer>), 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 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 security.withoutAuthorization(async () => {\n return cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n });\n return pickEntryFieldValues(entry);\n },\n async deleteReviewer(params) {\n const model = await getReviewerModel();\n\n await security.withoutAuthorization(async () => {\n return cms.deleteEntry(model,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BAAA"}
@@ -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,81 +1,72 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createWorkflowStorageOperations = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _index = require("./index");
13
-
8
+ var _pickEntryFieldValues = require("../utils/pickEntryFieldValues");
14
9
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
10
  var _workflow = require("./models/workflow.model");
17
-
18
11
  const formatReviewersForRefInput = (data, modelId) => {
19
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, data), {}, {
20
- steps: data.steps.map(step => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, step), {}, {
12
+ return {
13
+ ...data,
14
+ steps: data.steps.map(step => ({
15
+ ...step,
21
16
  reviewers: step.reviewers.map(id => ({
22
17
  id,
23
18
  modelId
24
19
  }))
25
20
  }))
26
- });
21
+ };
27
22
  };
28
-
29
23
  const createWorkflowStorageOperations = params => {
30
24
  const {
31
25
  cms,
32
26
  security
33
27
  } = params;
34
-
35
28
  const getWorkflowModel = async () => {
36
- security.disableAuthorization();
37
- const model = await cms.getModel(_workflow.WORKFLOW_MODEL_ID);
38
- security.enableAuthorization();
39
-
29
+ const model = await security.withoutAuthorization(async () => {
30
+ return cms.getModel(_workflow.WORKFLOW_MODEL_ID);
31
+ });
40
32
  if (!model) {
41
33
  throw new _error.default(`Could not find "${_workflow.WORKFLOW_MODEL_ID}" model.`, "MODEL_NOT_FOUND_ERROR");
42
34
  }
43
-
44
35
  return model;
45
36
  };
46
-
47
37
  const getWorkflow = async ({
48
38
  id
49
39
  }) => {
50
40
  const model = await getWorkflowModel();
51
- security.disableAuthorization();
52
- const entry = await cms.getEntryById(model, id);
53
- security.enableAuthorization();
54
- return (0, _index.getFieldValues)(entry, _index.baseFields);
41
+ const entry = await security.withoutAuthorization(async () => {
42
+ return cms.getEntryById(model, id);
43
+ });
44
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
55
45
  };
56
-
57
46
  return {
58
47
  getWorkflowModel,
59
48
  getWorkflow,
60
-
61
49
  async listWorkflows(params) {
62
50
  const model = await getWorkflowModel();
63
- security.disableAuthorization();
64
- const [entries, meta] = await cms.listLatestEntries(model, (0, _objectSpread2.default)({}, params));
65
- security.enableAuthorization();
66
- return [entries.map(entry => (0, _index.getFieldValues)(entry, _index.baseFields)), meta];
51
+ const [entries, meta] = await security.withoutAuthorization(async () => {
52
+ return cms.listLatestEntries(model, {
53
+ ...params,
54
+ where: {
55
+ ...params.where
56
+ }
57
+ });
58
+ });
59
+ return [entries.map(_pickEntryFieldValues.pickEntryFieldValues), meta];
67
60
  },
68
-
69
61
  async createWorkflow(params) {
70
62
  const model = await getWorkflowModel();
71
63
  const reviewerModel = await this.getReviewerModel();
72
64
  const data = formatReviewersForRefInput(params.data, reviewerModel.modelId);
73
- security.disableAuthorization();
74
- const entry = await cms.createEntry(model, data);
75
- security.enableAuthorization();
76
- return (0, _index.getFieldValues)(entry, _index.baseFields);
65
+ const entry = await security.withoutAuthorization(async () => {
66
+ return cms.createEntry(model, data);
67
+ });
68
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
77
69
  },
78
-
79
70
  async updateWorkflow(params) {
80
71
  const model = await getWorkflowModel();
81
72
  const reviewerModel = await this.getReviewerModel();
@@ -83,27 +74,29 @@ const createWorkflowStorageOperations = params => {
83
74
  * We're fetching the existing entry here because we're not accepting "app" field as input,
84
75
  * but, we still need to retain its value after the "update" operation.
85
76
  */
86
-
87
77
  const existingEntry = await getWorkflow({
88
78
  id: params.id
89
79
  });
90
- const input = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, existingEntry), params.data);
80
+ const input = {
81
+ ...existingEntry,
82
+ ...params.data,
83
+ savedOn: new Date()
84
+ };
91
85
  const data = formatReviewersForRefInput(input, reviewerModel.modelId);
92
- security.disableAuthorization();
93
- const entry = await cms.updateEntry(model, params.id, data);
94
- security.enableAuthorization();
95
- return (0, _index.getFieldValues)(entry, _index.baseFields);
86
+ const entry = await security.withoutAuthorization(async () => {
87
+ return cms.updateEntry(model, params.id, data);
88
+ });
89
+ return (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
96
90
  },
97
-
98
91
  async deleteWorkflow(params) {
99
92
  const model = await getWorkflowModel();
100
- security.disableAuthorization();
101
- await cms.deleteEntry(model, params.id);
102
- security.enableAuthorization();
93
+ await security.withoutAuthorization(async () => {
94
+ return cms.deleteEntry(model, params.id);
95
+ });
103
96
  return true;
104
97
  }
105
-
106
98
  };
107
99
  };
100
+ exports.createWorkflowStorageOperations = createWorkflowStorageOperations;
108
101
 
109
- exports.createWorkflowStorageOperations = createWorkflowStorageOperations;
102
+ //# sourceMappingURL=workflowStorageOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["formatReviewersForRefInput","data","modelId","steps","map","step","reviewers","id","createWorkflowStorageOperations","params","cms","security","getWorkflowModel","disableAuthorization","model","getModel","WORKFLOW_MODEL_ID","enableAuthorization","WebinyError","getWorkflow","entry","getEntryById","getFieldValues","baseFields","listWorkflows","entries","meta","listLatestEntries","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 security.disableAuthorization();\n const model = await cms.getModel(WORKFLOW_MODEL_ID);\n security.enableAuthorization();\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 security.disableAuthorization();\n const entry = await cms.getEntryById(model, id);\n security.enableAuthorization();\n return getFieldValues(entry, baseFields);\n };\n return {\n getWorkflowModel,\n getWorkflow,\n async listWorkflows(params) {\n const model = await getWorkflowModel();\n security.disableAuthorization();\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params\n });\n security.enableAuthorization();\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 security.disableAuthorization();\n const entry = await cms.createEntry(model, data);\n security.enableAuthorization();\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 security.disableAuthorization();\n const entry = await cms.updateEntry(model, params.id, data);\n security.enableAuthorization();\n return getFieldValues(entry, baseFields);\n },\n async deleteWorkflow(params) {\n const model = await getWorkflowModel();\n security.disableAuthorization();\n await cms.deleteEntry(model, params.id);\n security.enableAuthorization();\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;;;;;AAEA;;AAKA;;AACA;;AAIA,MAAMA,0BAA0B,GAAG,CAC/BC,IAD+B,EAE/BC,OAF+B,KAGX;EACpB,mEACOD,IADP;IAEIE,KAAK,EAAEF,IAAI,CAACE,KAAL,CAAWC,GAAX,CAAeC,IAAI,gEACnBA,IADmB;MAEtBC,SAAS,EAAED,IAAI,CAACC,SAAL,CAAeF,GAAf,CAAmBG,EAAE,KAAK;QACjCA,EADiC;QAEjCL;MAFiC,CAAL,CAArB;IAFW,EAAnB;EAFX;AAUH,CAdD;;AAgBO,MAAMM,+BAA+B,GACxCC,MAD2C,IAEZ;EAC/B,MAAM;IAAEC,GAAF;IAAOC;EAAP,IAAoBF,MAA1B;;EACA,MAAMG,gBAAgB,GAAG,YAAY;IACjCD,QAAQ,CAACE,oBAAT;IACA,MAAMC,KAAK,GAAG,MAAMJ,GAAG,CAACK,QAAJ,CAAaC,2BAAb,CAApB;IACAL,QAAQ,CAACM,mBAAT;;IACA,IAAI,CAACH,KAAL,EAAY;MACR,MAAM,IAAII,cAAJ,CACD,mBAAkBF,2BAAkB,UADnC,EAEF,uBAFE,CAAN;IAIH;;IACD,OAAOF,KAAP;EACH,CAXD;;EAYA,MAAMK,WAAwD,GAAG,OAAO;IAAEZ;EAAF,CAAP,KAAkB;IAC/E,MAAMO,KAAK,GAAG,MAAMF,gBAAgB,EAApC;IACAD,QAAQ,CAACE,oBAAT;IACA,MAAMO,KAAK,GAAG,MAAMV,GAAG,CAACW,YAAJ,CAAiBP,KAAjB,EAAwBP,EAAxB,CAApB;IACAI,QAAQ,CAACM,mBAAT;IACA,OAAO,IAAAK,qBAAA,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,aADI,GAEJxB,MAAM,CAACR,IAFH,CAAX;MAIA,MAAMA,IAAI,GAAGD,0BAA0B,CACnCkC,KADmC,EAEnCL,aAAa,CAAC3B,OAFqB,CAAvC;MAIAS,QAAQ,CAACE,oBAAT;MACA,MAAMO,KAAK,GAAG,MAAMV,GAAG,CAACyB,WAAJ,CAAgBrB,KAAhB,EAAuBL,MAAM,CAACF,EAA9B,EAAkCN,IAAlC,CAApB;MACAU,QAAQ,CAACM,mBAAT;MACA,OAAO,IAAAK,qBAAA,EAAeF,KAAf,EAAsBG,iBAAtB,CAAP;IACH,CA3CE;;IA4CH,MAAMa,cAAN,CAAqB3B,MAArB,EAA6B;MACzB,MAAMK,KAAK,GAAG,MAAMF,gBAAgB,EAApC;MACAD,QAAQ,CAACE,oBAAT;MACA,MAAMH,GAAG,CAAC2B,WAAJ,CAAgBvB,KAAhB,EAAuBL,MAAM,CAACF,EAA9B,CAAN;MACAI,QAAQ,CAACM,mBAAT;MACA,OAAO,IAAP;IACH;;EAlDE,CAAP;AAoDH,CA3EM"}
1
+ {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_workflow","formatReviewersForRefInput","data","modelId","steps","map","step","reviewers","id","createWorkflowStorageOperations","params","cms","security","getWorkflowModel","model","withoutAuthorization","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 { ApwWorkflow, CreateApwWorkflowParams } from \"~/types\";\nimport { ApwStorageOperations, ApwWorkflowStorageOperations } from \"./types\";\nimport { 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, 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 pickEntryFieldValues(entry);\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(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 security.withoutAuthorization(async () => {\n return cms.createEntry(model, data);\n });\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 security.withoutAuthorization(async () => {\n return cms.updateEntry(model, params.id, data);\n });\n\n return pickEntryFieldValues(entry);\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":";;;;;;;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,MAAwC,IACT;EAC/B,MAAM;IAAEC,GAAG;IAAEC;EAAS,CAAC,GAAGF,MAAM;EAChC,MAAMG,gBAAgB,GAAG,MAAAA,CAAA,KAAY;IACjC,MAAMC,KAAK,GAAG,MAAMF,QAAQ,CAACG,oBAAoB,CAAC,YAAY;MAC1D,OAAOJ,GAAG,CAACK,QAAQ,CAACC,2BAAiB,CAAC;IAC1C,CAAC,CAAC;IACF,IAAI,CAACH,KAAK,EAAE;MACR,MAAM,IAAII,cAAW,CAChB,mBAAkBD,2BAAkB,UAAS,EAC9C,uBACJ,CAAC;IACL;IACA,OAAOH,KAAK;EAChB,CAAC;EACD,MAAMK,WAAwD,GAAG,MAAAA,CAAO;IAAEX;EAAG,CAAC,KAAK;IAC/E,MAAMM,KAAK,G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