@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
@@ -1 +1 @@
1
- {"version":3,"names":["NotAuthorizedError","Error","constructor","data","code","message","StepMissingError","PendingChangeRequestsError","StepInActiveError","NoSignOffProvidedError"],"sources":["errors.ts"],"sourcesContent":["import Error from \"@webiny/error\";\n\nexport class NotAuthorizedError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"NOT_AUTHORISED\",\n message: `Not a reviewer, couldn't provide sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class StepMissingError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"MISSING_STEP\",\n message: `Please complete previous steps first.`,\n data: data || null\n });\n }\n}\n\nexport class PendingChangeRequestsError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"PENDING_CHANGE_REQUESTS\",\n message: `Change requests are pending couldn't provide sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class StepInActiveError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"STEP_NOT_ACTIVE\",\n message: `Step needs to be in active state before providing sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class NoSignOffProvidedError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"NO_SIGN_OFF_PROVIDED\",\n message: `Sign-off must be provided in order for it to be retracted.`,\n data: data || null\n });\n }\n}\n"],"mappings":";;;;;;;;;AAAA;;AAEO,MAAMA,kBAAN,SAAiCC,cAAjC,CAAuC;EAC1CC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,gBADJ;MAEFC,OAAO,EAAG,4CAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAPyC;;;;AAUvC,MAAMG,gBAAN,SAA+BL,cAA/B,CAAqC;EACxCC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,cADJ;MAEFC,OAAO,EAAG,uCAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAPuC;;;;AAUrC,MAAMI,0BAAN,SAAyCN,cAAzC,CAA+C;EAClDC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,yBADJ;MAEFC,OAAO,EAAG,wDAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAPiD;;;;AAU/C,MAAMK,iBAAN,SAAgCP,cAAhC,CAAsC;EACzCC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,iBADJ;MAEFC,OAAO,EAAG,6DAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAPwC;;;;AAUtC,MAAMM,sBAAN,SAAqCR,cAArC,CAA2C;EAC9CC,WAAW,CAACC,IAAD,EAA4B;IACnC,MAAM;MACFC,IAAI,EAAE,sBADJ;MAEFC,OAAO,EAAG,4DAFR;MAGFF,IAAI,EAAEA,IAAI,IAAI;IAHZ,CAAN;EAKH;;AAP6C"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","NotAuthorizedError","Error","constructor","data","code","message","exports","StepMissingError","PendingChangeRequestsError","StepInActiveError","NoSignOffProvidedError"],"sources":["errors.ts"],"sourcesContent":["import Error from \"@webiny/error\";\n\nexport class NotAuthorizedError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"NOT_AUTHORISED\",\n message: `Not a reviewer, couldn't provide sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class StepMissingError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"MISSING_STEP\",\n message: `Please complete previous steps first.`,\n data: data || null\n });\n }\n}\n\nexport class PendingChangeRequestsError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"PENDING_CHANGE_REQUESTS\",\n message: `Change requests are pending couldn't provide sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class StepInActiveError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"STEP_NOT_ACTIVE\",\n message: `Step needs to be in active state before providing sign-off.`,\n data: data || null\n });\n }\n}\n\nexport class NoSignOffProvidedError extends Error {\n constructor(data: Record<string, any>) {\n super({\n code: \"NO_SIGN_OFF_PROVIDED\",\n message: `Sign-off must be provided in order for it to be retracted.`,\n data: data || null\n });\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,MAAMC,kBAAkB,SAASC,cAAK,CAAC;EAC1CC,WAAWA,CAACC,IAAyB,EAAE;IACnC,KAAK,CAAC;MACFC,IAAI,EAAE,gBAAgB;MACtBC,OAAO,EAAG,4CAA2C;MACrDF,IAAI,EAAEA,IAAI,IAAI;IAClB,CAAC,CAAC;EACN;AACJ;AAACG,OAAA,CAAAN,kBAAA,GAAAA,kBAAA;AAEM,MAAMO,gBAAgB,SAASN,cAAK,CAAC;EACxCC,WAAWA,CAACC,IAAyB,EAAE;IACnC,KAAK,CAAC;MACFC,IAAI,EAAE,cAAc;MACpBC,OAAO,EAAG,uCAAsC;MAChDF,IAAI,EAAEA,IAAI,IAAI;IAClB,CAAC,CAAC;EACN;AACJ;AAACG,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AAEM,MAAMC,0BAA0B,SAASP,cAAK,CAAC;EAClDC,WAAWA,CAACC,IAAyB,EAAE;IACnC,KAAK,CAAC;MACFC,IAAI,EAAE,yBAAyB;MAC/BC,OAAO,EAAG,wDAAuD;MACjEF,IAAI,EAAEA,IAAI,IAAI;IAClB,CAAC,CAAC;EACN;AACJ;AAACG,OAAA,CAAAE,0BAAA,GAAAA,0BAAA;AAEM,MAAMC,iBAAiB,SAASR,cAAK,CAAC;EACzCC,WAAWA,CAACC,IAAyB,EAAE;IACnC,KAAK,CAAC;MACFC,IAAI,EAAE,iBAAiB;MACvBC,OAAO,EAAG,6DAA4D;MACtEF,IAAI,EAAEA,IAAI,IAAI;IAClB,CAAC,CAAC;EACN;AACJ;AAACG,OAAA,CAAAG,iBAAA,GAAAA,iBAAA;AAEM,MAAMC,sBAAsB,SAAST,cAAK,CAAC;EAC9CC,WAAWA,CAACC,IAAyB,EAAE;IACnC,KAAK,CAAC;MACFC,IAAI,EAAE,sBAAsB;MAC5BC,OAAO,EAAG,4DAA2D;MACrEF,IAAI,EAAEA,IAAI,IAAI;IAClB,CAAC,CAAC;EACN;AACJ;AAACG,OAAA,CAAAI,sBAAA,GAAAA,sBAAA"}
@@ -1,37 +1,29 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.getTransformer = exports.getFieldValues = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _pick = _interopRequireDefault(require("lodash/pick"));
13
-
14
7
  var _apiHeadlessCms = require("@webiny/api-headless-cms");
15
-
8
+ var _pickEntryFieldValues = require("./pickEntryFieldValues");
16
9
  const getFieldValues = async params => {
17
10
  const {
18
11
  entry,
19
12
  context,
20
- transformers = [],
21
- fields
13
+ transformers = []
22
14
  } = params;
23
- const values = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _pick.default)(entry, fields)), entry.values);
15
+ const values = (0, _pickEntryFieldValues.pickEntryFieldValues)(entry);
16
+
24
17
  /**
25
18
  * Transform field value for each transformers.
26
19
  */
27
-
28
20
  for (const transformer of transformers) {
29
21
  const {
30
22
  fieldId,
31
23
  model,
32
24
  field
33
- } = transformer; // Get transformed value (eg. data decompression)
34
-
25
+ } = transformer;
26
+ // Get transformed value (eg. data decompression)
35
27
  values[fieldId] = await (0, _apiHeadlessCms.entryFieldFromStorageTransform)({
36
28
  context,
37
29
  model,
@@ -39,16 +31,14 @@ const getFieldValues = async params => {
39
31
  value: values[fieldId]
40
32
  });
41
33
  }
42
-
43
34
  return values;
44
35
  };
45
-
46
36
  exports.getFieldValues = getFieldValues;
47
-
48
37
  const getTransformer = (model, fieldId) => ({
49
38
  fieldId: fieldId,
50
39
  model: model,
51
40
  field: model.fields.find(field => field.fieldId === fieldId)
52
41
  });
42
+ exports.getTransformer = getTransformer;
53
43
 
54
- exports.getTransformer = getTransformer;
44
+ //# sourceMappingURL=fieldResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getFieldValues","params","entry","context","transformers","fields","values","pick","transformer","fieldId","model","field","entryFieldFromStorageTransform","value","getTransformer","find"],"sources":["fieldResolver.ts"],"sourcesContent":["import pick from \"lodash/pick\";\nimport { CmsContext, CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { entryFieldFromStorageTransform } from \"@webiny/api-headless-cms\";\nimport { ApwBaseFields } from \"~/types\";\n\ninterface Transformer {\n fieldId: keyof ApwBaseFields;\n model: any;\n field: any;\n}\n\ninterface GetFieldValuesParams {\n entry: CmsEntry;\n fields: string[];\n transformers?: Transformer[];\n context: CmsContext;\n}\n\nexport const getFieldValues = async <T extends ApwBaseFields>(\n params: GetFieldValuesParams\n): Promise<T> => {\n const { entry, context, transformers = [], fields } = params;\n const values = {\n ...pick(entry, fields),\n ...entry.values\n } as T;\n /**\n * Transform field value for each transformers.\n */\n for (const transformer of transformers) {\n const { fieldId, model, field } = transformer;\n // Get transformed value (eg. data decompression)\n values[fieldId] = await entryFieldFromStorageTransform({\n context,\n model,\n field,\n value: values[fieldId]\n });\n }\n\n return values;\n};\n\nexport const getTransformer = (model: CmsModel, fieldId: string): Transformer => ({\n fieldId: fieldId as unknown as keyof ApwBaseFields,\n model: model,\n field: model.fields.find(field => field.fieldId === fieldId)\n});\n"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AAgBO,MAAMA,cAAc,GAAG,MAC1BC,MAD0B,IAEb;EACb,MAAM;IAAEC,KAAF;IAASC,OAAT;IAAkBC,YAAY,GAAG,EAAjC;IAAqCC;EAArC,IAAgDJ,MAAtD;EACA,MAAMK,MAAM,+DACL,IAAAC,aAAA,EAAKL,KAAL,EAAYG,MAAZ,CADK,GAELH,KAAK,CAACI,MAFD,CAAZ;EAIA;AACJ;AACA;;EACI,KAAK,MAAME,WAAX,IAA0BJ,YAA1B,EAAwC;IACpC,MAAM;MAAEK,OAAF;MAAWC,KAAX;MAAkBC;IAAlB,IAA4BH,WAAlC,CADoC,CAEpC;;IACAF,MAAM,CAACG,OAAD,CAAN,GAAkB,MAAM,IAAAG,8CAAA,EAA+B;MACnDT,OADmD;MAEnDO,KAFmD;MAGnDC,KAHmD;MAInDE,KAAK,EAAEP,MAAM,CAACG,OAAD;IAJsC,CAA/B,CAAxB;EAMH;;EAED,OAAOH,MAAP;AACH,CAvBM;;;;AAyBA,MAAMQ,cAAc,GAAG,CAACJ,KAAD,EAAkBD,OAAlB,MAAoD;EAC9EA,OAAO,EAAEA,OADqE;EAE9EC,KAAK,EAAEA,KAFuE;EAG9EC,KAAK,EAAED,KAAK,CAACL,MAAN,CAAaU,IAAb,CAAkBJ,KAAK,IAAIA,KAAK,CAACF,OAAN,KAAkBA,OAA7C;AAHuE,CAApD,CAAvB"}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_pickEntryFieldValues","getFieldValues","params","entry","context","transformers","values","pickEntryFieldValues","transformer","fieldId","model","field","entryFieldFromStorageTransform","value","exports","getTransformer","fields","find"],"sources":["fieldResolver.ts"],"sourcesContent":["import { CmsContext, CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { entryFieldFromStorageTransform } from \"@webiny/api-headless-cms\";\nimport { ApwBaseFields } from \"~/types\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\n\ninterface Transformer {\n fieldId: keyof ApwBaseFields;\n model: any;\n field: any;\n}\n\ninterface GetFieldValuesParams {\n entry: CmsEntry;\n fields: string[];\n transformers?: Transformer[];\n context: CmsContext;\n}\n\nexport const getFieldValues = async <T extends ApwBaseFields>(\n params: GetFieldValuesParams\n): Promise<T> => {\n const { entry, context, transformers = [] } = params;\n\n const values = pickEntryFieldValues<T>(entry);\n\n /**\n * Transform field value for each transformers.\n */\n for (const transformer of transformers) {\n const { fieldId, model, field } = transformer;\n // Get transformed value (eg. data decompression)\n values[fieldId] = await entryFieldFromStorageTransform({\n context,\n model,\n field,\n value: values[fieldId]\n });\n }\n\n return values;\n};\n\nexport const getTransformer = (model: CmsModel, fieldId: string): Transformer => ({\n fieldId: fieldId as unknown as keyof ApwBaseFields,\n model: model,\n field: model.fields.find(field => field.fieldId === fieldId)\n});\n"],"mappings":";;;;;;AACA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAAA;AAeO,MAAME,cAAc,GAAG,MAC1BC,MAA4B,IACf;EACb,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC,YAAY,GAAG;EAAG,CAAC,GAAGH,MAAM;EAEpD,MAAMI,MAAM,GAAG,IAAAC,0CAAoB,EAAIJ,KAAK,CAAC;;EAE7C;AACJ;AACA;EACI,KAAK,MAAMK,WAAW,IAAIH,YAAY,EAAE;IACpC,MAAM;MAAEI,OAAO;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGH,WAAW;IAC7C;IACAF,MAAM,CAACG,OAAO,CAAC,GAAG,MAAM,IAAAG,8CAA8B,EAAC;MACnDR,OAAO;MACPM,KAAK;MACLC,KAAK;MACLE,KAAK,EAAEP,MAAM,CAACG,OAAO;IACzB,CAAC,CAAC;EACN;EAEA,OAAOH,MAAM;AACjB,CAAC;AAACQ,OAAA,CAAAb,cAAA,GAAAA,cAAA;AAEK,MAAMc,cAAc,GAAGA,CAACL,KAAe,EAAED,OAAe,MAAmB;EAC9EA,OAAO,EAAEA,OAAyC;EAClDC,KAAK,EAAEA,KAAK;EACZC,KAAK,EAAED,KAAK,CAACM,MAAM,CAACC,IAAI,CAACN,KAAK,IAAIA,KAAK,CAACF,OAAO,KAAKA,OAAO;AAC/D,CAAC,CAAC;AAACK,OAAA,CAAAC,cAAA,GAAAA,cAAA"}
@@ -0,0 +1,3 @@
1
+ import { CmsEntry } from "@webiny/api-headless-cms/types";
2
+ export declare const baseFields: string[];
3
+ export declare function pickEntryFieldValues<T>(entry: CmsEntry): T;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.baseFields = void 0;
7
+ exports.pickEntryFieldValues = pickEntryFieldValues;
8
+ const baseFields = [
9
+ // Entry ID is mapped to "id" (we don't use revisions with ACO entities).
10
+ "id", "createdOn", "modifiedOn", "savedOn", "createdBy", "modifiedBy", "savedBy"];
11
+ exports.baseFields = baseFields;
12
+ const pickBaseEntryFieldValues = entry => {
13
+ const pickedValues = {};
14
+ for (const fieldName of baseFields) {
15
+ const [srcFieldName, targetFieldName = srcFieldName] = fieldName.split(":");
16
+ if (srcFieldName in entry) {
17
+ Object.assign(pickedValues, {
18
+ [targetFieldName]: entry[srcFieldName]
19
+ });
20
+ }
21
+ }
22
+ return pickedValues;
23
+ };
24
+ function pickEntryFieldValues(entry) {
25
+ return {
26
+ ...pickBaseEntryFieldValues(entry),
27
+ ...entry.values
28
+ };
29
+ }
30
+
31
+ //# sourceMappingURL=pickEntryFieldValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["baseFields","exports","pickBaseEntryFieldValues","entry","pickedValues","fieldName","srcFieldName","targetFieldName","split","Object","assign","pickEntryFieldValues","values"],"sources":["pickEntryFieldValues.ts"],"sourcesContent":["import { CmsEntry } from \"@webiny/api-headless-cms/types\";\n\nexport const baseFields = [\n // Entry ID is mapped to \"id\" (we don't use revisions with ACO entities).\n \"id\",\n\n \"createdOn\",\n \"modifiedOn\",\n \"savedOn\",\n \"createdBy\",\n \"modifiedBy\",\n \"savedBy\"\n];\n\nconst pickBaseEntryFieldValues = (entry: CmsEntry) => {\n const pickedValues: Partial<CmsEntry> = {};\n for (const fieldName of baseFields) {\n const [srcFieldName, targetFieldName = srcFieldName] = fieldName.split(\":\");\n if (srcFieldName in entry) {\n Object.assign(pickedValues, {\n [targetFieldName]: entry[srcFieldName as keyof CmsEntry]\n });\n }\n }\n\n return pickedValues;\n};\n\nexport function pickEntryFieldValues<T>(entry: CmsEntry): T {\n return {\n ...pickBaseEntryFieldValues(entry),\n ...entry.values\n } as T;\n}\n"],"mappings":";;;;;;;AAEO,MAAMA,UAAU,GAAG;AACtB;AACA,IAAI,EAEJ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,YAAY,EACZ,SAAS,CACZ;AAACC,OAAA,CAAAD,UAAA,GAAAA,UAAA;AAEF,MAAME,wBAAwB,GAAIC,KAAe,IAAK;EAClD,MAAMC,YAA+B,GAAG,CAAC,CAAC;EAC1C,KAAK,MAAMC,SAAS,IAAIL,UAAU,EAAE;IAChC,MAAM,CAACM,YAAY,EAAEC,eAAe,GAAGD,YAAY,CAAC,GAAGD,SAAS,CAACG,KAAK,CAAC,GAAG,CAAC;IAC3E,IAAIF,YAAY,IAAIH,KAAK,EAAE;MACvBM,MAAM,CAACC,MAAM,CAACN,YAAY,EAAE;QACxB,CAACG,eAAe,GAAGJ,KAAK,CAACG,YAAY;MACzC,CAAC,CAAC;IACN;EACJ;EAEA,OAAOF,YAAY;AACvB,CAAC;AAEM,SAASO,oBAAoBA,CAAIR,KAAe,EAAK;EACxD,OAAO;IACH,GAAGD,wBAAwB,CAACC,KAAK,CAAC;IAClC,GAAGA,KAAK,CAACS;EACb,CAAC;AACL"}
@@ -1,3 +1,3 @@
1
1
  import { Response, ErrorResponse } from "@webiny/handler-graphql";
2
- declare const _default: (fn: () => Promise<any>) => Promise<Response<any> | ErrorResponse>;
2
+ declare const _default: (fn: () => Promise<any>) => Promise<ErrorResponse | Response<any>>;
3
3
  export default _default;
package/utils/resolve.js CHANGED
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _handlerGraphql = require("@webiny/handler-graphql");
9
-
10
8
  var _default = async fn => {
11
9
  try {
12
10
  return new _handlerGraphql.Response(await fn());
@@ -14,5 +12,6 @@ var _default = async fn => {
14
12
  return new _handlerGraphql.ErrorResponse(e);
15
13
  }
16
14
  };
15
+ exports.default = _default;
17
16
 
18
- exports.default = _default;
17
+ //# sourceMappingURL=resolve.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["fn","Response","e","ErrorResponse"],"sources":["resolve.ts"],"sourcesContent":["import { Response, ErrorResponse } from \"@webiny/handler-graphql\";\n\nexport default async (fn: () => Promise<any>) => {\n try {\n return new Response(await fn());\n } catch (e) {\n return new ErrorResponse(e);\n }\n};\n"],"mappings":";;;;;;;AAAA;;eAEe,MAAOA,EAAP,IAAkC;EAC7C,IAAI;IACA,OAAO,IAAIC,wBAAJ,CAAa,MAAMD,EAAE,EAArB,CAAP;EACH,CAFD,CAEE,OAAOE,CAAP,EAAU;IACR,OAAO,IAAIC,6BAAJ,CAAkBD,CAAlB,CAAP;EACH;AACJ,C"}
1
+ {"version":3,"names":["_handlerGraphql","require","_default","fn","Response","e","ErrorResponse","exports","default"],"sources":["resolve.ts"],"sourcesContent":["import { Response, ErrorResponse } from \"@webiny/handler-graphql\";\n\nexport default async (fn: () => Promise<any>) => {\n try {\n return new Response(await fn());\n } catch (e) {\n return new ErrorResponse(e);\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAAkE,IAAAC,QAAA,GAEnD,MAAOC,EAAsB,IAAK;EAC7C,IAAI;IACA,OAAO,IAAIC,wBAAQ,CAAC,MAAMD,EAAE,CAAC,CAAC,CAAC;EACnC,CAAC,CAAC,OAAOE,CAAC,EAAE;IACR,OAAO,IAAIC,6BAAa,CAACD,CAAC,CAAC;EAC/B;AACJ,CAAC;AAAAE,OAAA,CAAAC,OAAA,GAAAN,QAAA"}
@@ -1,15 +0,0 @@
1
- import { CmsModelPlugin } from "@webiny/api-headless-cms";
2
- import { CmsModel, CmsGroup } from "@webiny/api-headless-cms/types";
3
- interface Params {
4
- group: Pick<CmsGroup, "id" | "name">;
5
- /**
6
- * Locale and tenant do not need to be defined.
7
- * In that case model is not bound to any locale or tenant.
8
- * You can bind it to locale, tenant, both or none.
9
- */
10
- locale?: string;
11
- tenant?: string;
12
- modelDefinition: Omit<CmsModel, "locale" | "tenant" | "webinyVersion" | "group">;
13
- }
14
- export declare const contentModelPluginFactory: (params: Params) => CmsModelPlugin;
15
- export {};
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.contentModelPluginFactory = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
- var _apiHeadlessCms = require("@webiny/api-headless-cms");
13
-
14
- const contentModelPluginFactory = params => {
15
- const {
16
- group,
17
- locale,
18
- tenant,
19
- modelDefinition
20
- } = params;
21
- return (0, _apiHeadlessCms.createCmsModel)((0, _objectSpread2.default)({
22
- group,
23
- locale,
24
- tenant
25
- }, modelDefinition));
26
- };
27
-
28
- exports.contentModelPluginFactory = contentModelPluginFactory;
@@ -1 +0,0 @@
1
- {"version":3,"names":["contentModelPluginFactory","params","group","locale","tenant","modelDefinition","createCmsModel"],"sources":["contentModelPluginFactory.ts"],"sourcesContent":["import { CmsModelPlugin, createCmsModel } from \"@webiny/api-headless-cms\";\nimport { CmsModel, CmsGroup } from \"@webiny/api-headless-cms/types\";\n\ninterface Params {\n group: Pick<CmsGroup, \"id\" | \"name\">;\n /**\n * Locale and tenant do not need to be defined.\n * In that case model is not bound to any locale or tenant.\n * You can bind it to locale, tenant, both or none.\n */\n locale?: string;\n tenant?: string;\n modelDefinition: Omit<CmsModel, \"locale\" | \"tenant\" | \"webinyVersion\" | \"group\">;\n}\n\nexport const contentModelPluginFactory = (params: Params): CmsModelPlugin => {\n const { group, locale, tenant, modelDefinition } = params;\n\n return createCmsModel({\n group,\n locale,\n tenant,\n ...modelDefinition\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAeO,MAAMA,yBAAyB,GAAIC,MAAD,IAAoC;EACzE,MAAM;IAAEC,KAAF;IAASC,MAAT;IAAiBC,MAAjB;IAAyBC;EAAzB,IAA6CJ,MAAnD;EAEA,OAAO,IAAAK,8BAAA;IACHJ,KADG;IAEHC,MAFG;IAGHC;EAHG,GAIAC,eAJA,EAAP;AAMH,CATM"}