@webiny/api-apw 6.0.0-alpha.0 → 6.0.0-alpha.2

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 (200) hide show
  1. package/ApwChangeRequestNotification.d.ts +1 -1
  2. package/ApwChangeRequestNotification.js.map +1 -1
  3. package/ApwCommentNotification.d.ts +1 -1
  4. package/ApwCommentNotification.js.map +1 -1
  5. package/ApwContentReviewNotification.d.ts +1 -1
  6. package/ApwContentReviewNotification.js.map +1 -1
  7. package/ApwContentUrlPlugin.d.ts +1 -1
  8. package/ApwContentUrlPlugin.js.map +1 -1
  9. package/ContentApwSettingsPlugin.d.ts +1 -1
  10. package/ContentApwSettingsPlugin.js.map +1 -1
  11. package/crud/createChangeRequestMethods.d.ts +1 -1
  12. package/crud/createChangeRequestMethods.js.map +1 -1
  13. package/crud/createCommentMethods.d.ts +1 -1
  14. package/crud/createCommentMethods.js.map +1 -1
  15. package/crud/createContentReviewMethods.d.ts +2 -2
  16. package/crud/createContentReviewMethods.js.map +1 -1
  17. package/crud/createReviewerMethods.d.ts +1 -1
  18. package/crud/createReviewerMethods.js.map +1 -1
  19. package/crud/createWorkflowMethods.d.ts +1 -1
  20. package/crud/createWorkflowMethods.js.map +1 -1
  21. package/crud/index.d.ts +1 -1
  22. package/crud/index.js.map +1 -1
  23. package/crud/utils.d.ts +2 -2
  24. package/crud/utils.js.map +1 -1
  25. package/index.d.ts +2 -2
  26. package/index.js +4 -4
  27. package/index.js.map +1 -1
  28. package/package.json +23 -23
  29. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.d.ts +1 -1
  30. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  31. package/plugins/cms/apwEntryPlugins.d.ts +2 -2
  32. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  33. package/plugins/cms/index.d.ts +4 -4
  34. package/plugins/cms/index.js.map +1 -1
  35. package/plugins/cms/linkContentReviewToEntry.d.ts +2 -2
  36. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  37. package/plugins/cms/linkWorkflowToEntry.d.ts +2 -2
  38. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  39. package/plugins/cms/triggerContentReview.d.ts +2 -2
  40. package/plugins/cms/triggerContentReview.js.map +1 -1
  41. package/plugins/cms/updateContentReviewStatus.d.ts +3 -3
  42. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  43. package/plugins/cms/utils.d.ts +2 -2
  44. package/plugins/cms/utils.js.map +1 -1
  45. package/plugins/context.d.ts +3 -3
  46. package/plugins/context.js +3 -14
  47. package/plugins/context.js.map +1 -1
  48. package/plugins/graphql/changeRequest.gql.d.ts +1 -1
  49. package/plugins/graphql/changeRequest.gql.js.map +1 -1
  50. package/plugins/graphql/comment.gql.d.ts +1 -1
  51. package/plugins/graphql/comment.gql.js.map +1 -1
  52. package/plugins/graphql/contentReview.gql.d.ts +1 -1
  53. package/plugins/graphql/contentReview.gql.js.map +1 -1
  54. package/plugins/graphql/reviewer.gql.d.ts +1 -1
  55. package/plugins/graphql/reviewer.gql.js.map +1 -1
  56. package/plugins/graphql/workflow.gql.d.ts +1 -1
  57. package/plugins/graphql/workflow.gql.js.map +1 -1
  58. package/plugins/graphql.d.ts +1 -1
  59. package/plugins/graphql.js.map +1 -1
  60. package/plugins/hooks/createReviewerFromIdentity.d.ts +1 -1
  61. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  62. package/plugins/hooks/deleteChangeRequestsAfterContentReview.d.ts +1 -1
  63. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  64. package/plugins/hooks/deleteCommentsAfterChangeRequest.d.ts +1 -1
  65. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  66. package/plugins/hooks/index.d.ts +1 -1
  67. package/plugins/hooks/index.js.map +1 -1
  68. package/plugins/hooks/initializeContentReviewSteps.d.ts +1 -1
  69. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  70. package/plugins/hooks/initializeNotifications.d.ts +1 -1
  71. package/plugins/hooks/initializeNotifications.js.map +1 -1
  72. package/plugins/hooks/listContentReviews.d.ts +3 -3
  73. package/plugins/hooks/listContentReviews.js.map +1 -1
  74. package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +1 -1
  75. package/plugins/hooks/notifications/changeRequestAfterCreate.js +1 -1
  76. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -1
  77. package/plugins/hooks/notifications/commentAfterCreate.d.ts +1 -1
  78. package/plugins/hooks/notifications/commentAfterCreate.js +1 -1
  79. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -1
  80. package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +1 -1
  81. package/plugins/hooks/notifications/contentReviewAfterCreate.js +1 -1
  82. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -1
  83. package/plugins/hooks/notifications/contentUrl.d.ts +2 -2
  84. package/plugins/hooks/notifications/contentUrl.js.map +1 -1
  85. package/plugins/hooks/notifications/getAppUrl.d.ts +2 -1
  86. package/plugins/hooks/notifications/getAppUrl.js +3 -1
  87. package/plugins/hooks/notifications/getAppUrl.js.map +1 -1
  88. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +1 -1
  89. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -1
  90. package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +1 -1
  91. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -1
  92. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +1 -1
  93. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -1
  94. package/plugins/hooks/notifications/reviewers.d.ts +1 -1
  95. package/plugins/hooks/notifications/reviewers.js.map +1 -1
  96. package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +1 -1
  97. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -1
  98. package/plugins/hooks/notifications/sendCommentNotification.d.ts +1 -1
  99. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -1
  100. package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +1 -1
  101. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -1
  102. package/plugins/hooks/updatePendingChangeRequests.d.ts +1 -1
  103. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  104. package/plugins/hooks/updateTotalComments.d.ts +1 -1
  105. package/plugins/hooks/updateTotalComments.js.map +1 -1
  106. package/plugins/hooks/validateChangeRequest.d.ts +1 -1
  107. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  108. package/plugins/hooks/validateComment.d.ts +1 -1
  109. package/plugins/hooks/validateComment.js.map +1 -1
  110. package/plugins/hooks/validateContentReview.d.ts +1 -1
  111. package/plugins/hooks/validateContentReview.js.map +1 -1
  112. package/plugins/utils.d.ts +4 -3
  113. package/plugins/utils.js.map +1 -1
  114. package/scheduler/createScheduleActionMethods.d.ts +1 -1
  115. package/scheduler/createScheduleActionMethods.js.map +1 -1
  116. package/scheduler/handlers/executeAction/index.d.ts +1 -1
  117. package/scheduler/handlers/executeAction/index.js.map +1 -1
  118. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -1
  119. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  120. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +3 -2
  121. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  122. package/scheduler/handlers/executeAction/security.d.ts +2 -2
  123. package/scheduler/handlers/executeAction/security.js.map +1 -1
  124. package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
  125. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  126. package/scheduler/handlers/scheduleAction/scheduleAction.utils.d.ts +3 -3
  127. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  128. package/scheduler/index.d.ts +1 -1
  129. package/scheduler/index.js.map +1 -1
  130. package/scheduler/types.d.ts +5 -5
  131. package/scheduler/types.js.map +1 -1
  132. package/storageOperations/changeRequestStorageOperations.d.ts +2 -2
  133. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  134. package/storageOperations/commentStorageOperations.d.ts +2 -2
  135. package/storageOperations/commentStorageOperations.js.map +1 -1
  136. package/storageOperations/contentReviewStorageOperations.d.ts +2 -2
  137. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  138. package/storageOperations/index.d.ts +3 -3
  139. package/storageOperations/index.js.map +1 -1
  140. package/storageOperations/models/contentReview.model.js.map +1 -1
  141. package/storageOperations/models/index.d.ts +1 -1
  142. package/storageOperations/models/index.js.map +1 -1
  143. package/storageOperations/models/utils.d.ts +2 -2
  144. package/storageOperations/models/utils.js.map +1 -1
  145. package/storageOperations/models/workflow.model.d.ts +1 -1
  146. package/storageOperations/models/workflow.model.js.map +1 -1
  147. package/storageOperations/reviewerStorageOperations.d.ts +2 -2
  148. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  149. package/storageOperations/types.d.ts +2 -2
  150. package/storageOperations/types.js.map +1 -1
  151. package/storageOperations/workflowStorageOperations.d.ts +2 -2
  152. package/storageOperations/workflowStorageOperations.js.map +1 -1
  153. package/types.d.ts +12 -28
  154. package/types.js.map +1 -1
  155. package/utils/contentApwSettingsPlugin.d.ts +2 -2
  156. package/utils/contentApwSettingsPlugin.js.map +1 -1
  157. package/utils/fieldResolver.d.ts +2 -2
  158. package/utils/fieldResolver.js.map +1 -1
  159. package/utils/pickEntryFieldValues.d.ts +1 -1
  160. package/utils/pickEntryFieldValues.js.map +1 -1
  161. package/utils/resolve.d.ts +1 -1
  162. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.d.ts +0 -9
  163. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -36
  164. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +0 -1
  165. package/plugins/pageBuilder/apwContentPagePlugins.d.ts +0 -3
  166. package/plugins/pageBuilder/apwContentPagePlugins.js +0 -28
  167. package/plugins/pageBuilder/apwContentPagePlugins.js.map +0 -1
  168. package/plugins/pageBuilder/extendPbPageSettingsSchema.d.ts +0 -3
  169. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +0 -22
  170. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +0 -1
  171. package/plugins/pageBuilder/index.d.ts +0 -11
  172. package/plugins/pageBuilder/index.js +0 -44
  173. package/plugins/pageBuilder/index.js.map +0 -1
  174. package/plugins/pageBuilder/linkContentReviewToPage.d.ts +0 -8
  175. package/plugins/pageBuilder/linkContentReviewToPage.js +0 -93
  176. package/plugins/pageBuilder/linkContentReviewToPage.js.map +0 -1
  177. package/plugins/pageBuilder/linkWorkflowToPage.d.ts +0 -8
  178. package/plugins/pageBuilder/linkWorkflowToPage.js +0 -165
  179. package/plugins/pageBuilder/linkWorkflowToPage.js.map +0 -1
  180. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +0 -1
  181. package/plugins/pageBuilder/notifications/changeRequestNotification.js +0 -33
  182. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +0 -1
  183. package/plugins/pageBuilder/notifications/commentNotification.d.ts +0 -1
  184. package/plugins/pageBuilder/notifications/commentNotification.js +0 -33
  185. package/plugins/pageBuilder/notifications/commentNotification.js.map +0 -1
  186. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +0 -1
  187. package/plugins/pageBuilder/notifications/contentReviewNotification.js +0 -33
  188. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +0 -1
  189. package/plugins/pageBuilder/notifications/contentUrl.d.ts +0 -1
  190. package/plugins/pageBuilder/notifications/contentUrl.js +0 -49
  191. package/plugins/pageBuilder/notifications/contentUrl.js.map +0 -1
  192. package/plugins/pageBuilder/triggerContentReview.d.ts +0 -8
  193. package/plugins/pageBuilder/triggerContentReview.js +0 -40
  194. package/plugins/pageBuilder/triggerContentReview.js.map +0 -1
  195. package/plugins/pageBuilder/updateContentReviewStatus.d.ts +0 -10
  196. package/plugins/pageBuilder/updateContentReviewStatus.js +0 -70
  197. package/plugins/pageBuilder/updateContentReviewStatus.js.map +0 -1
  198. package/plugins/pageBuilder/utils.d.ts +0 -22
  199. package/plugins/pageBuilder/utils.js +0 -151
  200. package/plugins/pageBuilder/utils.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_apiHeadlessCms","require","_utils","_workflow","contentField","fields","createModelField","label","parent","type","multipleValues","settings","validation","message","name","contentStatus","fieldId","predefinedValues","enabled","values","value","titleField","contentIdField","workflowIdField","contentTypeField","contentSettingsField","contentSettingsModelIdField","scheduledActionIdField","contentScheduledOnField","contentScheduledByField","contentPublishedByField","stepStatusField","listValidation","renderer","id","storageId","stepPendingChangeRequests","stepTotalComments","latestCommentId","stepSignOffProvidedOn","stepSignOffProvidedBy","stepSignOffProvidedById","stepSignOffProvidedByDisplayName","stepsField","layout","map","field","CONTENT_REVIEW_MODEL_ID","exports","createContentReviewModel","reviewerModelId","createPrivateModel","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { stepTitleField, stepTypeField, stepIdField, stepReviewersField } from \"./workflow.model\";\n\nconst contentField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Content\",\n parent: \"contentReview\",\n type: \"object\",\n multipleValues: false,\n settings: { fields },\n validation: [\n {\n message: \"`content` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentStatus = () =>\n createModelField({\n label: \"Status\",\n fieldId: \"reviewStatus\",\n parent: \"contentReview\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Under review\",\n value: \"underReview\"\n },\n {\n label: \"Ready to be published\",\n value: \"readyToBePublished\"\n },\n {\n label: \"Published\",\n value: \"published\"\n }\n ]\n },\n validation: [\n {\n message: \"`reviewStatus` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`title` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Content\",\n validation: [\n {\n message: \"`id` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst workflowIdField = () =>\n createModelField({\n label: \"Workflow Id\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`workflowId` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"contentReview Type\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Page\",\n value: \"page\"\n },\n { value: \"cms_entry\", label: \"CMS Entry\" }\n ]\n },\n validation: [\n {\n message: \"`type` field value is required in contentReview Type.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentSettingsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Settings\",\n parent: \"contentReview Content\",\n type: \"object\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst contentSettingsModelIdField = () =>\n createModelField({\n label: \"Model Id\",\n parent: \"contentReview Settings\",\n type: \"text\"\n });\n\nconst scheduledActionIdField = () =>\n createModelField({\n label: \"Scheduled action Id\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledOnField = () =>\n createModelField({\n label: \"Scheduled on\",\n type: \"datetime\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledByField = () =>\n createModelField({\n label: \"Scheduled by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentPublishedByField = () =>\n createModelField({\n label: \"Published by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst stepStatusField = (): CmsModelField => ({\n multipleValues: false,\n listValidation: [],\n renderer: {\n name: \"radio-buttons\"\n },\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"done\",\n label: \"Steps done\"\n },\n {\n value: \"active\",\n label: \"Step active\"\n },\n {\n value: \"inactive\",\n label: \"Step inactive\"\n }\n ]\n },\n label: \"Status\",\n id: \"contentReview_steps_status\",\n type: \"text\",\n validation: [\n {\n message: \"`status` field value is required in contentReview steps status.\",\n name: \"required\"\n }\n ],\n storageId: \"status\",\n fieldId: \"status\"\n});\n\nconst stepPendingChangeRequests = () =>\n createModelField({\n label: \"Pending change requests\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`pendingChangeRequests` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepTotalComments = () =>\n createModelField({\n label: \"Total comments\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`totalComments` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst latestCommentId = () =>\n createModelField({\n label: \"Latest comment Id\",\n type: \"text\",\n parent: \"contentReview\"\n });\n\nconst stepSignOffProvidedOn = () =>\n createModelField({\n label: \"Sign off provided on\",\n type: \"datetime\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedBy = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Sign off provided By\",\n type: \"object\",\n parent: \"contentReview Step\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst stepSignOffProvidedById = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedByDisplayName = () =>\n createModelField({\n label: \"DisplayName\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepsField = (fields: CmsModelField[]): CmsModelField => ({\n id: \"contentReview_steps\",\n label: \"Steps\",\n type: \"object\",\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [],\n validation: [],\n fieldId: \"steps\",\n storageId: \"steps\",\n multipleValues: true,\n predefinedValues: {\n values: [],\n enabled: false\n }\n});\n\ninterface CreateContentReviewModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const CONTENT_REVIEW_MODEL_ID = \"apwContentReviewModelDefinition\";\n\nexport const createContentReviewModel = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Content Review\",\n modelId: CONTENT_REVIEW_MODEL_ID,\n titleFieldId: \"content\",\n fields: [\n titleField(),\n contentField([\n contentIdField(),\n contentTypeField(),\n contentSettingsField([contentSettingsModelIdField()]),\n contentScheduledOnField(),\n contentScheduledByField(),\n scheduledActionIdField(),\n contentPublishedByField()\n ]),\n contentStatus(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId),\n stepStatusField(),\n stepPendingChangeRequests(),\n stepTotalComments(),\n stepSignOffProvidedOn(),\n stepSignOffProvidedBy([\n stepSignOffProvidedById(),\n stepSignOffProvidedByDisplayName()\n ])\n ]),\n latestCommentId(),\n workflowIdField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,MAAMG,YAAY,GAAIC,MAAuB,IACzC,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,SAAS;EAChBC,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE;IAAEN;EAAO,CAAC;EACpBO,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,qDAAqD;IAC9DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,aAAa,GAAGA,CAAA,KAClB,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OAAO,EAAE,cAAc;EACvBR,MAAM,EAAE,eAAe;EACvBC,I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OAAA,CAAAD,uBAAA,GAAG,iCAAiC;AAEjE,MAAME,wBAAwB,GAAGA,CAAC;EACrCC;AACsC,CAAC,KAAK;EAC5C,OAAO,IAAAC,kCAAkB,EAAC;IACtBrC,IAAI,EAAE,sBAAsB;IAC5BsC,OAAO,EAAEL,uBAAuB;IAChCM,YAAY,EAAE,SAAS;IACvBhD,MAAM,EAAE,CACJgB,UAAU,CAAC,CAAC,EACZjB,YAAY,CAAC,CACTkB,cAAc,CAAC,CAAC,EAChBE,gBAAgB,CAAC,CAAC,EAClBC,oBAAoB,CAAC,CAACC,2BAA2B,CAAC,CAAC,CAAC,CAAC,EACrDE,uBAAuB,CAAC,CAAC,EACzBC,uBAAuB,CAAC,CAAC,EACzBF,sBAAsB,CAAC,CAAC,EACxBG,uBAAuB,CAAC,CAAC,CAC5B,CAAC,EACFf,aAAa,CAAC,CAAC,EACf4B,UAAU,CAAC,CACP,IAAAW,wBAAc,EAAC,CAAC,EAChB,IAAAC,uBAAa,EAAC,CAAC,EACf,IAAAC,qBAAW,EAAC,CAAC,EACb,IAAAC,4BAAkB,EAACP,eAAe,CAAC,EACnCnB,eAAe,CAAC,CAAC,EACjBK,yBAAyB,CAAC,CAAC,EAC3BC,iBAAiB,CAAC,CAAC,EACnBE,qBAAqB,CAAC,CAAC,EACvBC,qBAAqB,CAAC,CAClBC,uBAAuB,CAAC,CAAC,EACzBC,gCAAgC,CAAC,CAAC,CACrC,CAAC,CACL,CAAC,EACFJ,eAAe,CAAC,CAAC,EACjBf,eAAe,CAAC,CAAC;EAEzB,CAAC,CAAC;AACN,CAAC;AAACyB,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_apiHeadlessCms","require","_utils","_workflow","contentField","fields","createModelField","label","parent","type","multipleValues","settings","validation","message","name","contentStatus","fieldId","predefinedValues","enabled","values","value","titleField","contentIdField","workflowIdField","contentTypeField","contentSettingsField","contentSettingsModelIdField","scheduledActionIdField","contentScheduledOnField","contentScheduledByField","contentPublishedByField","stepStatusField","listValidation","renderer","id","storageId","stepPendingChangeRequests","stepTotalComments","latestCommentId","stepSignOffProvidedOn","stepSignOffProvidedBy","stepSignOffProvidedById","stepSignOffProvidedByDisplayName","stepsField","layout","map","field","CONTENT_REVIEW_MODEL_ID","exports","createContentReviewModel","reviewerModelId","createPrivateModel","modelId","titleFieldId","stepTitleField","stepTypeField","stepIdField","stepReviewersField"],"sources":["contentReview.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { createModelField } from \"./utils\";\nimport { stepTitleField, stepTypeField, stepIdField, stepReviewersField } from \"./workflow.model\";\n\nconst contentField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Content\",\n parent: \"contentReview\",\n type: \"object\",\n multipleValues: false,\n settings: { fields },\n validation: [\n {\n message: \"`content` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentStatus = () =>\n createModelField({\n label: \"Status\",\n fieldId: \"reviewStatus\",\n parent: \"contentReview\",\n type: \"text\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Under review\",\n value: \"underReview\"\n },\n {\n label: \"Ready to be published\",\n value: \"readyToBePublished\"\n },\n {\n label: \"Published\",\n value: \"published\"\n }\n ]\n },\n validation: [\n {\n message: \"`reviewStatus` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst titleField = () =>\n createModelField({\n label: \"Title\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`title` field value is required in contentReview.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentIdField = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Content\",\n validation: [\n {\n message: \"`id` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst workflowIdField = () =>\n createModelField({\n label: \"Workflow Id\",\n type: \"text\",\n parent: \"contentReview\",\n validation: [\n {\n message: \"`workflowId` field value is required in contentReview Content.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentTypeField = () =>\n createModelField({\n label: \"Type\",\n type: \"text\",\n parent: \"contentReview Type\",\n predefinedValues: {\n enabled: true,\n values: [\n {\n label: \"Page\",\n value: \"page\"\n },\n { value: \"cms_entry\", label: \"CMS Entry\" }\n ]\n },\n validation: [\n {\n message: \"`type` field value is required in contentReview Type.\",\n name: \"required\"\n }\n ]\n });\n\nconst contentSettingsField = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Settings\",\n parent: \"contentReview Content\",\n type: \"object\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst contentSettingsModelIdField = () =>\n createModelField({\n label: \"Model Id\",\n parent: \"contentReview Settings\",\n type: \"text\"\n });\n\nconst scheduledActionIdField = () =>\n createModelField({\n label: \"Scheduled action Id\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledOnField = () =>\n createModelField({\n label: \"Scheduled on\",\n type: \"datetime\",\n parent: \"contentReview Content\"\n });\n\nconst contentScheduledByField = () =>\n createModelField({\n label: \"Scheduled by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst contentPublishedByField = () =>\n createModelField({\n label: \"Published by\",\n type: \"text\",\n parent: \"contentReview Content\"\n });\n\nconst stepStatusField = (): CmsModelField => ({\n multipleValues: false,\n listValidation: [],\n renderer: {\n name: \"radio-buttons\"\n },\n predefinedValues: {\n enabled: true,\n values: [\n {\n value: \"done\",\n label: \"Steps done\"\n },\n {\n value: \"active\",\n label: \"Step active\"\n },\n {\n value: \"inactive\",\n label: \"Step inactive\"\n }\n ]\n },\n label: \"Status\",\n id: \"contentReview_steps_status\",\n type: \"text\",\n validation: [\n {\n message: \"`status` field value is required in contentReview steps status.\",\n name: \"required\"\n }\n ],\n storageId: \"status\",\n fieldId: \"status\"\n});\n\nconst stepPendingChangeRequests = () =>\n createModelField({\n label: \"Pending change requests\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`pendingChangeRequests` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst stepTotalComments = () =>\n createModelField({\n label: \"Total comments\",\n type: \"number\",\n parent: \"contentReview Step\",\n validation: [\n {\n message: \"`totalComments` field value is required in contentReview step.\",\n name: \"required\"\n }\n ]\n });\n\nconst latestCommentId = () =>\n createModelField({\n label: \"Latest comment Id\",\n type: \"text\",\n parent: \"contentReview\"\n });\n\nconst stepSignOffProvidedOn = () =>\n createModelField({\n label: \"Sign off provided on\",\n type: \"datetime\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedBy = (fields: CmsModelField[]) =>\n createModelField({\n label: \"Sign off provided By\",\n type: \"object\",\n parent: \"contentReview Step\",\n multipleValues: false,\n settings: { fields }\n });\n\nconst stepSignOffProvidedById = () =>\n createModelField({\n label: \"Id\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepSignOffProvidedByDisplayName = () =>\n createModelField({\n label: \"DisplayName\",\n type: \"text\",\n parent: \"contentReview Step\"\n });\n\nconst stepsField = (fields: CmsModelField[]): CmsModelField => ({\n id: \"contentReview_steps\",\n label: \"Steps\",\n type: \"object\",\n settings: {\n fields,\n layout: fields.map(field => [field.storageId])\n },\n listValidation: [],\n validation: [],\n fieldId: \"steps\",\n storageId: \"steps\",\n multipleValues: true,\n predefinedValues: {\n values: [],\n enabled: false\n }\n});\n\ninterface CreateContentReviewModelDefinitionParams {\n reviewerModelId: string;\n}\n\nexport const CONTENT_REVIEW_MODEL_ID = \"apwContentReviewModelDefinition\";\n\nexport const createContentReviewModel = ({\n reviewerModelId\n}: CreateContentReviewModelDefinitionParams) => {\n return createPrivateModel({\n name: \"APW - Content Review\",\n modelId: CONTENT_REVIEW_MODEL_ID,\n titleFieldId: \"content\",\n fields: [\n titleField(),\n contentField([\n contentIdField(),\n contentTypeField(),\n contentSettingsField([contentSettingsModelIdField()]),\n contentScheduledOnField(),\n contentScheduledByField(),\n scheduledActionIdField(),\n contentPublishedByField()\n ]),\n contentStatus(),\n stepsField([\n stepTitleField(),\n stepTypeField(),\n stepIdField(),\n stepReviewersField(reviewerModelId),\n stepStatusField(),\n stepPendingChangeRequests(),\n stepTotalComments(),\n stepSignOffProvidedOn(),\n stepSignOffProvidedBy([\n stepSignOffProvidedById(),\n stepSignOffProvidedByDisplayName()\n ])\n ]),\n latestCommentId(),\n workflowIdField()\n ]\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,MAAMG,YAAY,GAAIC,MAAuB,IACzC,IAAAC,uBAAgB,EAAC;EACbC,KAAK,EAAE,SAAS;EAChBC,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,QAAQ;EACdC,cAAc,EAAE,KAAK;EACrBC,QAAQ,EAAE;IAAEN;EAAO,CAAC;EACpBO,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,qDAAqD;IAC9DC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,aAAa,GAAGA,CAAA,KAClB,IAAAT,uBAAgB,EAAC;EACbC,KAAK,EAAE,QAAQ;EACfS,OAAO,EAAE,cAAc;EACvBR,MAAM,EAAE,eAAe;EACvBC,IAAI,EAAE,MAAM;EACZQ,gBAAgB,EAAE;IACdC,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE,CACJ;MACIZ,KAAK,EAAE,cAAc;MACrBa,KAAK,EAAE;IACX,CAAC,EACD;MACIb,KAAK,EAAE,uBAAuB;MAC9Ba,KAAK,EAAE;IACX,CAAC,EACD;MACIb,KAAK,EAAE,WAAW;MAClBa,KAAK,EAAE;IACX,CAAC;EAET,CAAC;EACDR,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,0DAA0D;IACnEC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMO,UAAU,GAAGA,CAAA,KACf,IAAAf,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AAC,EACzBC,uBAAuB,CAAC,CAAC,EACzBF,sBAAsB,CAAC,CAAC,EACxBG,uBAAuB,CAAC,CAAC,CAC5B,CAAC,EACFf,aAAa,CAAC,CAAC,EACf4B,UAAU,CAAC,CACP,IAAAW,wBAAc,EAAC,CAAC,EAChB,IAAAC,uBAAa,EAAC,CAAC,EACf,IAAAC,qBAAW,EAAC,CAAC,EACb,IAAAC,4BAAkB,EAACP,eAAe,CAAC,EACnCnB,eAAe,CAAC,CAAC,EACjBK,yBAAyB,CAAC,CAAC,EAC3BC,iBAAiB,CAAC,CAAC,EACnBE,qBAAqB,CAAC,CAAC,EACvBC,qBAAqB,CAAC,CAClBC,uBAAuB,CAAC,CAAC,EACzBC,gCAAgC,CAAC,CAAC,CACrC,CAAC,CACL,CAAC,EACFJ,eAAe,CAAC,CAAC,EACjBf,eAAe,CAAC,CAAC;EAEzB,CAAC,CAAC;AACN,CAAC;AAACyB,OAAA,CAAAC,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsContext } from "@webiny/api-headless-cms/types";
1
+ import type { CmsContext } from "@webiny/api-headless-cms/types";
2
2
  export declare const createApwModels: (context: CmsContext) => void;
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_workflow","_contentReview","_reviewer","_comment","_changeRequest","_utils","createApwModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","locale","getContentLocale","WebinyError","changeRequestModelDefinition","createChangeRequestModel","reviewerModelDefinition","createReviewerModel","workflowModelDefinition","createWorkflowModel","reviewerModelId","modelId","commentModelDefinition","createCommentModel","contentReviewModelDefinition","createContentReviewModel","modelDefinitions","cmsModelPlugins","modelDefinition","cmsModelPlugin","createCmsModel","contentModel","titleFieldId","push","plugins","register","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelPlugin, createCmsModel } from \"@webiny/api-headless-cms\";\nimport { createWorkflowModel } from \"./workflow.model\";\nimport { createContentReviewModel } from \"./contentReview.model\";\nimport { createReviewerModel } from \"./reviewer.model\";\nimport { createCommentModel } from \"./comment.model\";\nimport { createChangeRequestModel } from \"./changeRequest.model\";\nimport { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { isInstallationPending } from \"~/plugins/utils\";\n\nexport const createApwModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n /**\n * Create CmsModel plugins.\n */\n const changeRequestModelDefinition = createChangeRequestModel();\n const reviewerModelDefinition = createReviewerModel();\n const workflowModelDefinition = createWorkflowModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n const commentModelDefinition = createCommentModel({\n modelId: changeRequestModelDefinition.modelId\n });\n const contentReviewModelDefinition = createContentReviewModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n\n const modelDefinitions = [\n workflowModelDefinition,\n contentReviewModelDefinition,\n reviewerModelDefinition,\n changeRequestModelDefinition,\n commentModelDefinition\n ];\n\n const cmsModelPlugins: CmsModelPlugin[] = [];\n for (const modelDefinition of modelDefinitions) {\n const cmsModelPlugin = createCmsModel(modelDefinition);\n /**\n * We want \"title\" field as the title field for \"ContentReview\" model.\n * so that we can later search entries by title.\n */\n if (cmsModelPlugin.contentModel.modelId === \"apwContentReviewModelDefinition\") {\n cmsModelPlugin.contentModel.titleFieldId = \"title\";\n }\n cmsModelPlugins.push(cmsModelPlugin);\n }\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register(...cmsModelPlugins);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,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B,EAC5BQ,sBAAsB,CACzB;EAED,MAAMK,eAAiC,GAAG,EAAE;EAC5C,KAAK,MAAMC,eAAe,IAAIF,gBAAgB,EAAE;IAC5C,MAAMG,cAAc,GAAG,IAAAC,8BAAc,EAACF,eAAe,CAAC;IACtD;AACR;AACA;AACA;IACQ,IAAIC,cAAc,CAACE,YAAY,CAACV,OAAO,KAAK,iCAAiC,EAAE;MAC3EQ,cAAc,CAACE,YAAY,CAACC,YAAY,GAAG,OAAO;IACtD;IACAL,eAAe,CAACM,IAAI,CAACJ,cAAc,CAAC;EACxC;;EAEA;AACJ;AACA;EACIzB,OAAO,CAAC8B,OAAO,CAACC,QAAQ,CAAC,GAAGR,eAAe,CAAC;AAChD,CAAC;AAACS,OAAA,CAAAjC,eAAA,GAAAA,eAAA","ignoreList":[]}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_workflow","_contentReview","_reviewer","_comment","_changeRequest","_utils","createApwModels","context","cms","console","warn","isInstallationPending","tenancy","i18n","locale","getContentLocale","WebinyError","changeRequestModelDefinition","createChangeRequestModel","reviewerModelDefinition","createReviewerModel","workflowModelDefinition","createWorkflowModel","reviewerModelId","modelId","commentModelDefinition","createCommentModel","contentReviewModelDefinition","createContentReviewModel","modelDefinitions","cmsModelPlugins","modelDefinition","cmsModelPlugin","createCmsModel","contentModel","titleFieldId","push","plugins","register","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsModelPlugin } from \"@webiny/api-headless-cms\";\nimport { createCmsModel } from \"@webiny/api-headless-cms\";\nimport { createWorkflowModel } from \"./workflow.model\";\nimport { createContentReviewModel } from \"./contentReview.model\";\nimport { createReviewerModel } from \"./reviewer.model\";\nimport { createCommentModel } from \"./comment.model\";\nimport { createChangeRequestModel } from \"./changeRequest.model\";\nimport type { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport { isInstallationPending } from \"~/plugins/utils\";\n\nexport const createApwModels = (context: CmsContext) => {\n /**\n * This should never happen in the actual project.\n * It is to make sure that we load setup context before the CRUD init in our internal code.\n */\n if (!context.cms) {\n console.warn(\"Creating model before cms init.\");\n return;\n }\n\n if (isInstallationPending({ tenancy: context.tenancy, i18n: context.i18n })) {\n return;\n }\n\n const locale = context.i18n.getContentLocale();\n if (!locale) {\n throw new WebinyError(\n \"Missing content locale in api-apw/storageOperations/index.ts\",\n \"LOCALE_ERROR\"\n );\n }\n\n /**\n * Create CmsModel plugins.\n */\n const changeRequestModelDefinition = createChangeRequestModel();\n const reviewerModelDefinition = createReviewerModel();\n const workflowModelDefinition = createWorkflowModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n const commentModelDefinition = createCommentModel({\n modelId: changeRequestModelDefinition.modelId\n });\n const contentReviewModelDefinition = createContentReviewModel({\n reviewerModelId: reviewerModelDefinition.modelId\n });\n\n const modelDefinitions = [\n workflowModelDefinition,\n contentReviewModelDefinition,\n reviewerModelDefinition,\n changeRequestModelDefinition,\n commentModelDefinition\n ];\n\n const cmsModelPlugins: CmsModelPlugin[] = [];\n for (const modelDefinition of modelDefinitions) {\n const cmsModelPlugin = createCmsModel(modelDefinition);\n /**\n * We want \"title\" field as the title field for \"ContentReview\" model.\n * so that we can later search entries by title.\n */\n if (cmsModelPlugin.contentModel.modelId === \"apwContentReviewModelDefinition\") {\n cmsModelPlugin.contentModel.titleFieldId = \"title\";\n }\n cmsModelPlugins.push(cmsModelPlugin);\n }\n\n /**\n * Register them so that they are accessible in cms context\n */\n context.plugins.register(...cmsModelPlugins);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP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,KAAK,iCAAiC,EAAE;MAC3EQ,cAAc,CAACE,YAAY,CAACC,YAAY,GAAG,OAAO;IACtD;IACAL,eAAe,CAACM,IAAI,CAACJ,cAAc,CAAC;EACxC;;EAEA;AACJ;AACA;EACIzB,OAAO,CAAC8B,OAAO,CAACC,QAAQ,CAAC,GAAGR,eAAe,CAAC;AAChD,CAAC;AAACS,OAAA,CAAAjC,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { CmsModelField } from "@webiny/api-headless-cms/types";
2
- import { CreateModelFieldParams } from "../../plugins/utils";
1
+ import type { CmsModelField } from "@webiny/api-headless-cms/types";
2
+ import type { CreateModelFieldParams } from "../../plugins/utils";
3
3
  export declare const createModelField: (params: CreateModelFieldParams) => CmsModelField;
@@ -1 +1 @@
1
- {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","label","fieldId","initialFieldId","type","parent","camelCase","id","storageId","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","exports"],"sources":["utils.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport { CreateModelFieldParams } from \"~/plugins/utils\";\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n const { label, fieldId: initialFieldId, type, parent } = params;\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n return {\n id: `${camelCase(parent)}_${fieldId}`,\n storageId: fieldId,\n fieldId,\n label,\n type,\n settings: params.settings || {},\n listValidation: params.listValidation || [],\n validation: params.validation || [],\n multipleValues: params.multipleValues || false,\n predefinedValues: params.predefinedValues || {\n values: [],\n enabled: false\n }\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC,OAAO,EAAEC,cAAc;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGL,MAAM;EAC/D,MAAME,OAAO,GAAGC,cAAc,GAAG,IAAAG,kBAAS,EAACH,cAAc,CAAC,GAAG,IAAAG,kBAAS,EAACL,KAAK,CAAC;EAC7E,OAAO;IACHM,EAAE,EAAE,GAAG,IAAAD,kBAAS,EAACD,MAAM,CAAC,IAAIH,OAAO,EAAE;IACrCM,SAAS,EAAEN,OAAO;IAClBA,OAAO;IACPD,KAAK;IACLG,IAAI;IACJK,QAAQ,EAAET,MAAM,CAACS,QAAQ,IAAI,CAAC,CAAC;IAC/BC,cAAc,EAAEV,MAAM,CAACU,cAAc,IAAI,EAAE;IAC3CC,UAAU,EAAEX,MAAM,CAACW,UAAU,IAAI,EAAE;IACnCC,cAAc,EAAEZ,MAAM,CAACY,cAAc,IAAI,KAAK;IAC9CC,gBAAgB,EAAEb,MAAM,CAACa,gBAAgB,IAAI;MACzCC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb;EACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAjB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","label","fieldId","initialFieldId","type","parent","camelCase","id","storageId","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","exports"],"sources":["utils.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types\";\nimport type { CreateModelFieldParams } from \"~/plugins/utils\";\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n const { label, fieldId: initialFieldId, type, parent } = params;\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n return {\n id: `${camelCase(parent)}_${fieldId}`,\n storageId: fieldId,\n fieldId,\n label,\n type,\n settings: params.settings || {},\n listValidation: params.listValidation || [],\n validation: params.validation || [],\n multipleValues: params.multipleValues || false,\n predefinedValues: params.predefinedValues || {\n values: [],\n enabled: false\n }\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC,OAAO,EAAEC,cAAc;IAAEC,IAAI;IAAEC;EAAO,CAAC,GAAGL,MAAM;EAC/D,MAAME,OAAO,GAAGC,cAAc,GAAG,IAAAG,kBAAS,EAACH,cAAc,CAAC,GAAG,IAAAG,kBAAS,EAACL,KAAK,CAAC;EAC7E,OAAO;IACHM,EAAE,EAAE,GAAG,IAAAD,kBAAS,EAACD,MAAM,CAAC,IAAIH,OAAO,EAAE;IACrCM,SAAS,EAAEN,OAAO;IAClBA,OAAO;IACPD,KAAK;IACLG,IAAI;IACJK,QAAQ,EAAET,MAAM,CAACS,QAAQ,IAAI,CAAC,CAAC;IAC/BC,cAAc,EAAEV,MAAM,CAACU,cAAc,IAAI,EAAE;IAC3CC,UAAU,EAAEX,MAAM,CAACW,UAAU,IAAI,EAAE;IACnCC,cAAc,EAAEZ,MAAM,CAACY,cAAc,IAAI,KAAK;IAC9CC,gBAAgB,EAAEb,MAAM,CAACa,gBAAgB,IAAI;MACzCC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb;EACJ,CAAC;AACL,CAAC;AAACC,OAAA,CAAAjB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { CmsModelField } from "@webiny/api-headless-cms/types";
1
+ import type { CmsModelField } from "@webiny/api-headless-cms/types";
2
2
  export declare const stepTitleField: () => CmsModelField;
3
3
  export declare const stepTypeField: () => CmsModelField;
4
4
  export declare const stepIdField: () => CmsModelField;
@@ -1 +1 @@
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","createWorkflowModel","createPrivateModel","titleFieldId"],"sources":["workflow.model.ts"],"sourcesContent":["import { createPrivateModel } 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 createWorkflowModel = ({ reviewerModelId }: CreateWorkflowModelDefinitionParams) => {\n return createPrivateModel({\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;EACZC,MAAM,EAAE,UAAU;EAClBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,8CAA8C;IACvDC,IAAI,EAAE;EACV,CAAC;AAET,CAAC,CAAC;AAEN,MAAMC,UAAU,GAAIC,MAAuB,IACvC,IAAAR,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,UAAU;EAClBM,QAAQ,EAAE;IACND;EACJ,CAAC;EACDE,cAAc,EAAE;AACpB,CAAC,CAAC;AAEC,MAAMC,cAAc,GAAGA,CAAA,KAC1B,IAAAX,uBAAgB,EAAC;EACbC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,gBAAgB;EACxBC,UAAU,EAAE,CACR;IACIC,OAAO,EAAE,oDAAoD;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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,mBAAA,GAAAA,mBAAA","ignoreList":[]}
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","createWorkflowModel","createPrivateModel","titleFieldId"],"sources":["workflow.model.ts"],"sourcesContent":["import { createPrivateModel } from \"@webiny/api-headless-cms\";\nimport type { 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 createWorkflowModel = ({ reviewerModelId }: CreateWorkflowModelDefinitionParams) => {\n return createPrivateModel({\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,KAC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,CACJ;EACDQ,gBAAgB,EAAE;IACdC,OAAO,EAAE,IAAI;IACbC,MAAM,EAAE,CACJ;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,GAAAvB,OAAA,CAAAuB,iBAAA,GAAG,4BAA4B;AAEtD,MAAMC,mBAAmB,GAAGA,CAAC;EAAEhB;AAAqD,CAAC,KAAK;EAC7F,OAAO,IAAAiB,kCAAkB,EAAC;IACtB/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,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { ApwReviewerStorageOperations } from "./types";
2
- import { CreateApwStorageOperationsParams } from "./";
1
+ import type { ApwReviewerStorageOperations } from "./types";
2
+ import type { CreateApwStorageOperationsParams } from "./";
3
3
  export declare const createReviewerStorageOperations: ({ cms }: CreateApwStorageOperationsParams) => ApwReviewerStorageOperations;
@@ -1 +1 @@
1
- {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","createReviewerStorageOperations","cms","getReviewerModel","model","getModel","WebinyError","getReviewer","id","entry","getEntryById","pickEntryFieldValues","listReviewers","params","entries","meta","listLatestEntries","where","map","createReviewer","createEntry","data","updateReviewer","existingEntry","updateEntry","savedOn","Date","deleteReviewer","deleteEntry","exports"],"sources":["reviewerStorageOperations.ts"],"sourcesContent":["import { 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}: CreateApwStorageOperationsParams): ApwReviewerStorageOperations => {\n const getReviewerModel = async () => {\n const model = await cms.getModel(\"apwReviewerModelDefinition\");\n if (!model) {\n throw new WebinyError(\n \"Could not find `apwReviewerModelDefinition` model.\",\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getReviewer: ApwReviewerStorageOperations[\"getReviewer\"] = async ({ id }) => {\n const model = await getReviewerModel();\n\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getReviewerModel,\n getReviewer,\n async listReviewers(params) {\n const model = await getReviewerModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwReviewer>), meta];\n },\n async createReviewer(params) {\n const model = await getReviewerModel();\n const entry = await cms.createEntry(model, params.data);\n return pickEntryFieldValues(entry);\n },\n async updateReviewer(params) {\n const model = await getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getReviewer({ id: params.id });\n\n const entry = await cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n return pickEntryFieldValues(entry);\n },\n async deleteReviewer(params) {\n const model =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G,MAAMP,GAAG,CAACkB,WAAW,CAAChB,KAAK,EAAES,MAAM,CAACQ,IAAI,CAAC;MACvD,OAAO,IAAAV,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMa,cAAcA,CAACT,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MACtC;AACZ;AACA;AACA;MACY,MAAMoB,aAAa,GAAG,MAAMhB,WAAW,CAAC;QAAEC,EAAE,EAAEK,MAAM,CAACL;MAAG,CAAC,CAAC;MAE1D,MAAMC,KAAK,GAAG,MAAMP,GAAG,CAACsB,WAAW,CAACpB,KAAK,EAAES,MAAM,CAACL,EAAE,EAAE;QAClD,GAAGe,aAAa;QAChB,GAAGV,MAAM,CAACQ,IAAI;QACdI,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC,CAAC;MACF,OAAO,IAAAf,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAACd,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAES,MAAM,CAACL,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAACqB,OAAA,CAAA5B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","createReviewerStorageOperations","cms","getReviewerModel","model","getModel","WebinyError","getReviewer","id","entry","getEntryById","pickEntryFieldValues","listReviewers","params","entries","meta","listLatestEntries","where","map","createReviewer","createEntry","data","updateReviewer","existingEntry","updateEntry","savedOn","Date","deleteReviewer","deleteEntry","exports"],"sources":["reviewerStorageOperations.ts"],"sourcesContent":["import type { ApwReviewerStorageOperations } from \"./types\";\nimport type { CreateApwStorageOperationsParams } from \"~/storageOperations\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport type { ApwReviewer } from \"~/types\";\n\nexport const createReviewerStorageOperations = ({\n cms\n}: CreateApwStorageOperationsParams): ApwReviewerStorageOperations => {\n const getReviewerModel = async () => {\n const model = await cms.getModel(\"apwReviewerModelDefinition\");\n if (!model) {\n throw new WebinyError(\n \"Could not find `apwReviewerModelDefinition` model.\",\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getReviewer: ApwReviewerStorageOperations[\"getReviewer\"] = async ({ id }) => {\n const model = await getReviewerModel();\n\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getReviewerModel,\n getReviewer,\n async listReviewers(params) {\n const model = await getReviewerModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwReviewer>), meta];\n },\n async createReviewer(params) {\n const model = await getReviewerModel();\n const entry = await cms.createEntry(model, params.data);\n return pickEntryFieldValues(entry);\n },\n async updateReviewer(params) {\n const model = await getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getReviewer({ id: params.id });\n\n const entry = await cms.updateEntry(model, params.id, {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n });\n return pickEntryFieldValues(entry);\n },\n async deleteReviewer(params) {\n const model = await getReviewerModel();\n\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAEA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGO,MAAMG,+BAA+B,GAAGA,CAAC;EAC5CC;AAC8B,CAAC,KAAmC;EAClE,MAAMC,gBAAgB,GAAG,MAAAA,CAAA,KAAY;IACjC,MAAMC,KAAK,GAAG,MAAMF,GAAG,CAACG,QAAQ,CAAC,4BAA4B,CAAC;I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AC;MAE1D,MAAMC,KAAK,GAAG,MAAMP,GAAG,CAACsB,WAAW,CAACpB,KAAK,EAAES,MAAM,CAACL,EAAE,EAAE;QAClD,GAAGe,aAAa;QAChB,GAAGV,MAAM,CAACQ,IAAI;QACdI,OAAO,EAAE,IAAIC,IAAI,CAAC;MACtB,CAAC,CAAC;MACF,OAAO,IAAAf,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAACd,MAAM,EAAE;MACzB,MAAMT,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAES,MAAM,CAACL,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAACqB,OAAA,CAAA5B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { CmsModel } from "@webiny/api-headless-cms/types";
2
- import { ApwReviewerStorageOperations as BaseApwReviewerStorageOperations, ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations, ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations, ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations, ApwCommentStorageOperations as BaseApwCommentStorageOperations } from "../types";
1
+ import type { CmsModel } from "@webiny/api-headless-cms/types";
2
+ import type { ApwReviewerStorageOperations as BaseApwReviewerStorageOperations, ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations, ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations, ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations, ApwCommentStorageOperations as BaseApwCommentStorageOperations } from "../types";
3
3
  export interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {
4
4
  /**
5
5
  * @internal
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport {\n ApwReviewerStorageOperations as BaseApwReviewerStorageOperations,\n ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations,\n ApwCommentStorageOperations as BaseApwCommentStorageOperations\n} from \"~/types\";\n\nexport interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {\n /**\n * @internal\n */\n getCommentModel(): Promise<CmsModel>;\n}\n\nexport interface ApwReviewerStorageOperations extends BaseApwReviewerStorageOperations {\n /**\n * @internal\n */\n getReviewerModel(): Promise<CmsModel>;\n}\n\nexport interface ApwWorkflowStorageOperations extends BaseApwWorkflowStorageOperations {\n /**\n * @internal\n */\n getWorkflowModel(): Promise<CmsModel>;\n}\n\nexport interface ApwContentReviewStorageOperations extends BaseApwContentReviewStorageOperations {\n /**\n * @internal\n */\n getContentReviewModel(): Promise<CmsModel>;\n}\n\nexport interface ApwChangeRequestStorageOperations extends BaseApwChangeRequestStorageOperations {\n /**\n * @internal\n */\n getChangeRequestModel(): Promise<CmsModel>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport type {\n ApwReviewerStorageOperations as BaseApwReviewerStorageOperations,\n ApwWorkflowStorageOperations as BaseApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations as BaseApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations as BaseApwChangeRequestStorageOperations,\n ApwCommentStorageOperations as BaseApwCommentStorageOperations\n} from \"~/types\";\n\nexport interface ApwCommentStorageOperations extends BaseApwCommentStorageOperations {\n /**\n * @internal\n */\n getCommentModel(): Promise<CmsModel>;\n}\n\nexport interface ApwReviewerStorageOperations extends BaseApwReviewerStorageOperations {\n /**\n * @internal\n */\n getReviewerModel(): Promise<CmsModel>;\n}\n\nexport interface ApwWorkflowStorageOperations extends BaseApwWorkflowStorageOperations {\n /**\n * @internal\n */\n getWorkflowModel(): Promise<CmsModel>;\n}\n\nexport interface ApwContentReviewStorageOperations extends BaseApwContentReviewStorageOperations {\n /**\n * @internal\n */\n getContentReviewModel(): Promise<CmsModel>;\n}\n\nexport interface ApwChangeRequestStorageOperations extends BaseApwChangeRequestStorageOperations {\n /**\n * @internal\n */\n getChangeRequestModel(): Promise<CmsModel>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n"],"mappings":"","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { ApwWorkflowStorageOperations } from "./types";
2
- import { CreateApwStorageOperationsParams } from "./index";
1
+ import type { ApwWorkflowStorageOperations } from "./types";
2
+ import type { CreateApwStorageOperationsParams } from "./index";
3
3
  export declare const createWorkflowStorageOperations: (params: CreateApwStorageOperationsParams) => ApwWorkflowStorageOperations;
@@ -1 +1 @@
1
- {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_workflow","formatReviewersForRefInput","data","modelId","steps","map","step","reviewers","id","createWorkflowStorageOperations","params","cms","getWorkflowModel","model","getModel","WORKFLOW_MODEL_ID","WebinyError","getWorkflow","entry","getEntryById","pickEntryFieldValues","listWorkflows","entries","meta","listLatestEntries","where","createWorkflow","reviewerModel","getReviewerModel","createEntry","updateWorkflow","existingEntry","input","savedOn","Date","updateEntry","deleteWorkflow","deleteEntry","exports"],"sources":["workflowStorageOperations.ts"],"sourcesContent":["import { 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 } = params;\n const getWorkflowModel = async () => {\n const model = await cms.getModel(WORKFLOW_MODEL_ID);\n if (!model) {\n throw new WebinyError(\n `Could not find \"${WORKFLOW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getWorkflow: ApwWorkflowStorageOperations[\"getWorkflow\"] = async ({ id }) => {\n const model = await getWorkflowModel();\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getWorkflowModel,\n getWorkflow,\n async listWorkflows(params) {\n const model = await getWorkflowModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwWorkflow>), meta];\n },\n async createWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n\n const data = formatReviewersForRefInput(params.data, reviewerModel.modelId);\n\n const entry = await cms.createEntry(model, data);\n\n return pickEntryFieldValues(entry);\n },\n async updateWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getWorkflow({ id: params.id });\n const input = {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n };\n const data = formatReviewersForRefInput(\n input as CreateApwWorkflowParams,\n reviewerModel.modelId\n );\n\n const entry = await cms.updateEntry(model, params.id, data);\n\n return pickEntryFieldValues(entry);\n },\n async deleteWorkflow(params) {\n const model = await getWorkflowModel();\n\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAIA,MAAMI,0BAA0B,GAAGA,CAC/BC,IAA6B,EAC7BC,OAAe,KACK;EACpB,OAAO;IACH,GAAGD,IAAI;IACPE,KAAK,EAAEF,IAAI,CAACE,KAAK,CAACC,GAAG,CAACC,IAAI,KAAK;MAC3B,GAAGA,IAAI;MACPC,SAAS,EAAED,IAAI,CAACC,SAAS,CAACF,GAAG,CAACG,EAAE,KAAK;QACjCA,EAAE;QACFL;MACJ,CAAC,CAAC;IACN,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAEM,MAAMM,+BAA+B,GACxCC,MAAwC,IACT;EAC/B,MAAM;IAAEC;EAAI,CAAC,GAAGD,MAAM;EACtB,MAAME,gBAAgB,GAAG,MAAAA,CAAA,KAAY;IACjC,MAAMC,KAAK,GAAG,MAAMF,GAAG,CAACG,QAAQ,CAACC,2BAAiB,CAAC;IACnD,IAAI,CAACF,KAAK,EAAE;MACR,MAAM,IAAIG,cAAW,CACjB,mBAAmBD,2BAAiB,UAAU,EAC9C,uBACJ,CAAC;IACL;IACA,OAAOF,KAAK;EAChB,CAAC;EACD,MAAMI,WAAwD,GAAG,MAAAA,CAAO;IAAET;EAAG,CAAC,KAAK;IAC/E,MAAMK,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;IACtC,MAAMM,KAAK,GAAG,MAAMP,GAAG,CAACQ,YAAY,CAACN,KAAK,EAAEL,EAAE,CAAC;IAC/C,OAAO,IAAAY,0CAAoB,EAACF,KAAK,CAAC;EACtC,CAAC;EACD,OAAO;IACHN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ACLL,aAAa,CAACxB,OAClB,CAAC;MAED,MAAMe,KAAK,GAAG,MAAMP,GAAG,CAACwB,WAAW,CAACtB,KAAK,EAAEH,MAAM,CAACF,EAAE,EAAEN,IAAI,CAAC;MAE3D,OAAO,IAAAkB,0CAAoB,EAACF,KAAK,CAAC;IACtC,CAAC;IACD,MAAMkB,cAAcA,CAAC1B,MAAM,EAAE;MACzB,MAAMG,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAEH,MAAM,CAACF,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC8B,OAAA,CAAA7B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_pickEntryFieldValues","require","_error","_interopRequireDefault","_workflow","formatReviewersForRefInput","data","modelId","steps","map","step","reviewers","id","createWorkflowStorageOperations","params","cms","getWorkflowModel","model","getModel","WORKFLOW_MODEL_ID","WebinyError","getWorkflow","entry","getEntryById","pickEntryFieldValues","listWorkflows","entries","meta","listLatestEntries","where","createWorkflow","reviewerModel","getReviewerModel","createEntry","updateWorkflow","existingEntry","input","savedOn","Date","updateEntry","deleteWorkflow","deleteEntry","exports"],"sources":["workflowStorageOperations.ts"],"sourcesContent":["import type { ApwWorkflow, CreateApwWorkflowParams } from \"~/types\";\nimport type { ApwStorageOperations, ApwWorkflowStorageOperations } from \"./types\";\nimport type { CreateApwStorageOperationsParams } from \"~/storageOperations/index\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues\";\nimport WebinyError from \"@webiny/error\";\nimport { WORKFLOW_MODEL_ID } from \"~/storageOperations/models/workflow.model\";\n\ntype ReviewersRefInput = CreateApwWorkflowParams<{ modelId: string; id: string }>;\n\nconst formatReviewersForRefInput = (\n data: CreateApwWorkflowParams,\n modelId: string\n): ReviewersRefInput => {\n return {\n ...data,\n steps: data.steps.map(step => ({\n ...step,\n reviewers: step.reviewers.map(id => ({\n id,\n modelId\n }))\n }))\n };\n};\n\nexport const createWorkflowStorageOperations = (\n params: CreateApwStorageOperationsParams\n): ApwWorkflowStorageOperations => {\n const { cms } = params;\n const getWorkflowModel = async () => {\n const model = await cms.getModel(WORKFLOW_MODEL_ID);\n if (!model) {\n throw new WebinyError(\n `Could not find \"${WORKFLOW_MODEL_ID}\" model.`,\n \"MODEL_NOT_FOUND_ERROR\"\n );\n }\n return model;\n };\n const getWorkflow: ApwWorkflowStorageOperations[\"getWorkflow\"] = async ({ id }) => {\n const model = await getWorkflowModel();\n const entry = await cms.getEntryById(model, id);\n return pickEntryFieldValues(entry);\n };\n return {\n getWorkflowModel,\n getWorkflow,\n async listWorkflows(params) {\n const model = await getWorkflowModel();\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n where: {\n ...params.where\n }\n });\n return [entries.map(pickEntryFieldValues<ApwWorkflow>), meta];\n },\n async createWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n\n const data = formatReviewersForRefInput(params.data, reviewerModel.modelId);\n\n const entry = await cms.createEntry(model, data);\n\n return pickEntryFieldValues(entry);\n },\n async updateWorkflow(this: ApwStorageOperations, params) {\n const model = await getWorkflowModel();\n const reviewerModel = await this.getReviewerModel();\n /**\n * We're fetching the existing entry here because we're not accepting \"app\" field as input,\n * but, we still need to retain its value after the \"update\" operation.\n */\n const existingEntry = await getWorkflow({ id: params.id });\n const input = {\n ...existingEntry,\n ...params.data,\n savedOn: new Date()\n };\n const data = formatReviewersForRefInput(\n input as CreateApwWorkflowParams,\n reviewerModel.modelId\n );\n\n const entry = await cms.updateEntry(model, params.id, data);\n\n return pickEntryFieldValues(entry);\n },\n async deleteWorkflow(params) {\n const model = await getWorkflowModel();\n\n await cms.deleteEntry(model, params.id);\n return true;\n }\n };\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GA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EAAE;MACzB,MAAMG,KAAK,GAAG,MAAMD,gBAAgB,CAAC,CAAC;MAEtC,MAAMD,GAAG,CAAC0B,WAAW,CAACxB,KAAK,EAAEH,MAAM,CAACF,EAAE,CAAC;MACvC,OAAO,IAAI;IACf;EACJ,CAAC;AACL,CAAC;AAAC8B,OAAA,CAAA7B,+BAAA,GAAAA,+BAAA","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,16 +1,14 @@
1
- import { CmsEntry as BaseCmsEntry, OnEntryBeforePublishTopicParams, OnEntryAfterPublishTopicParams, OnEntryAfterUnpublishTopicParams, CmsEntryListSort } from "@webiny/api-headless-cms/types";
2
- import { Page, OnPageBeforeCreateTopicParams, OnPageBeforeCreateFromTopicParams, OnPageBeforeUpdateTopicParams, OnPageBeforePublishTopicParams, PageSettings } from "@webiny/api-page-builder/types";
3
- import { Context } from "@webiny/api/types";
4
- import { PageBuilderContextObject } from "@webiny/api-page-builder/graphql/types";
5
- import { SecurityIdentity, SecurityPermission } from "@webiny/api-security/types";
6
- import { I18NLocale } from "@webiny/api-i18n/types";
7
- import { Tenant } from "@webiny/api-tenancy/types";
8
- import { Topic } from "@webiny/pubsub/types";
9
- import { ApwScheduleActionCrud, ScheduleActionContext } from "./scheduler/types";
10
- import HandlerClient from "@webiny/handler-client/HandlerClient";
11
- import { PluginsContainer } from "@webiny/plugins";
12
- import { WcpContextObject } from "@webiny/api-wcp/types";
13
- import { MailerContext } from "@webiny/api-mailer/types";
1
+ import type { CmsEntry as BaseCmsEntry, OnEntryBeforePublishTopicParams, OnEntryAfterPublishTopicParams, OnEntryAfterUnpublishTopicParams, CmsEntryListSort } from "@webiny/api-headless-cms/types";
2
+ import type { Context } from "@webiny/api/types";
3
+ import type { SecurityIdentity, SecurityPermission } from "@webiny/api-security/types";
4
+ import type { I18NLocale } from "@webiny/api-i18n/types";
5
+ import type { Tenant } from "@webiny/api-tenancy/types";
6
+ import type { Topic } from "@webiny/pubsub/types";
7
+ import type { ApwScheduleActionCrud, ScheduleActionContext } from "./scheduler/types";
8
+ import type HandlerClient from "@webiny/handler-client/HandlerClient";
9
+ import type { PluginsContainer } from "@webiny/plugins";
10
+ import type { WcpContextObject } from "@webiny/api-wcp/types";
11
+ import type { MailerContext } from "@webiny/api-mailer/types";
14
12
  export interface ApwCmsEntry extends BaseCmsEntry {
15
13
  title: string;
16
14
  meta: {
@@ -67,19 +65,6 @@ export declare enum ApwContentTypes {
67
65
  PAGE = "page",
68
66
  CMS_ENTRY = "cms_entry"
69
67
  }
70
- export interface PageSettingsWithWorkflow extends PageSettings {
71
- apw: {
72
- workflowId: string;
73
- contentReviewId: string | null;
74
- };
75
- }
76
- export interface PageWithWorkflow extends Page {
77
- settings: PageSettingsWithWorkflow;
78
- }
79
- export type ApwOnPageBeforeCreateTopicParams = OnPageBeforeCreateTopicParams<PageWithWorkflow>;
80
- export type ApwOnPageBeforeCreateFromTopicParams = OnPageBeforeCreateFromTopicParams<PageWithWorkflow>;
81
- export type ApwOnPageBeforeUpdateTopicParams = OnPageBeforeUpdateTopicParams<PageWithWorkflow>;
82
- export type ApwOnPageBeforePublishTopicParams = OnPageBeforePublishTopicParams<PageWithWorkflow>;
83
68
  export declare enum WorkflowScopeTypes {
84
69
  DEFAULT = "default",
85
70
  CUSTOM = "custom"
@@ -374,7 +359,7 @@ export interface ApwContentReviewCrud extends BaseApwCrud<ApwContentReview, Crea
374
359
  }
375
360
  export type ContentGetter = (id: string, settings: {
376
361
  modelId?: string;
377
- }) => Promise<PageWithWorkflow | ApwCmsEntry | null>;
362
+ }) => Promise<ApwCmsEntry | null>;
378
363
  export type ContentPublisher = (id: string, settings: {
379
364
  modelId?: string;
380
365
  }) => Promise<boolean | null>;
@@ -397,7 +382,6 @@ export interface AdvancedPublishingWorkflow {
397
382
  }
398
383
  export interface ApwContext extends Context, MailerContext {
399
384
  apw: AdvancedPublishingWorkflow;
400
- pageBuilder: PageBuilderContextObject;
401
385
  wcp: WcpContextObject;
402
386
  scheduleAction: ScheduleActionContext["scheduleAction"];
403
387
  }
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ApwContentTypes","exports","WorkflowScopeTypes","ApwContentReviewStepStatus","ApwWorkflowApplications","ApwWorkflowStepTypes","ApwContentReviewStatus","ApwScheduleActionTypes"],"sources":["types.ts"],"sourcesContent":["import {\n CmsEntry as BaseCmsEntry,\n OnEntryBeforePublishTopicParams,\n OnEntryAfterPublishTopicParams,\n OnEntryAfterUnpublishTopicParams,\n CmsEntryListSort\n} from \"@webiny/api-headless-cms/types\";\nimport {\n Page,\n OnPageBeforeCreateTopicParams,\n OnPageBeforeCreateFromTopicParams,\n OnPageBeforeUpdateTopicParams,\n OnPageBeforePublishTopicParams,\n PageSettings\n} from \"@webiny/api-page-builder/types\";\nimport { Context } from \"@webiny/api/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { SecurityIdentity, SecurityPermission } from \"@webiny/api-security/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { Topic } from \"@webiny/pubsub/types\";\nimport { ApwScheduleActionCrud, ScheduleActionContext } from \"~/scheduler/types\";\nimport HandlerClient from \"@webiny/handler-client/HandlerClient\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { WcpContextObject } from \"@webiny/api-wcp/types\";\nimport { MailerContext } from \"@webiny/api-mailer/types\";\n\nexport interface ApwCmsEntry extends BaseCmsEntry {\n title: string;\n meta: {\n apw?: {\n contentReviewId?: string | null;\n workflowId?: string | null;\n };\n };\n}\n\nexport interface ApwFile {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n}\n\nexport interface ListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n}\n\nexport interface ListParams {\n where?: ListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n after?: string | null;\n}\n\nexport interface ListMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\nexport enum ApwContentTypes {\n PAGE = \"page\",\n CMS_ENTRY = \"cms_entry\"\n}\n\nexport interface PageSettingsWithWorkflow extends PageSettings {\n apw: {\n workflowId: string;\n contentReviewId: string | null;\n };\n}\n\nexport interface PageWithWorkflow extends Page {\n settings: PageSettingsWithWorkflow;\n}\n\nexport type ApwOnPageBeforeCreateTopicParams = OnPageBeforeCreateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeCreateFromTopicParams =\n OnPageBeforeCreateFromTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforeUpdateTopicParams = OnPageBeforeUpdateTopicParams<PageWithWorkflow>;\n\nexport type ApwOnPageBeforePublishTopicParams = OnPageBeforePublishTopicParams<PageWithWorkflow>;\n\nexport enum WorkflowScopeTypes {\n DEFAULT = \"default\",\n CUSTOM = \"custom\"\n}\n\nexport enum ApwContentReviewStepStatus {\n DONE = \"done\",\n ACTIVE = \"active\",\n INACTIVE = \"inactive\"\n}\n\nexport enum ApwWorkflowApplications {\n PB = \"pageBuilder\",\n CMS = \"cms\"\n}\n\n/**\n * A interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface ApwIdentity {\n /**\n * ID if the user.\n */\n id: string;\n /**\n * Full name of the user.\n */\n displayName: string | null;\n /**\n * Type of the user (admin, user)\n */\n type: string;\n}\n\nexport interface ApwBaseFields {\n id: string;\n entryId: string;\n\n createdOn: string;\n modifiedOn: string | null;\n savedOn: string;\n createdBy: ApwIdentity;\n modifiedBy: ApwIdentity;\n savedBy: ApwIdentity;\n}\n\nexport interface ApwReviewer extends ApwBaseFields {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string;\n}\n\nexport interface ApwReviewerWithEmail extends Omit<ApwReviewer, \"email\"> {\n email: string;\n}\n\nexport interface ApwComment extends ApwBaseFields {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwChangeRequest extends ApwBaseFields {\n body: Record<string, any>;\n title: string;\n resolved: boolean;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwContentReviewStep {\n type: ApwWorkflowStepTypes;\n title: string;\n slug: string;\n reviewers: ApwReviewer[];\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n totalComments: number;\n signOffProvidedOn: string | null;\n signOffProvidedBy: ApwIdentity | null;\n}\n\nexport interface ApwContentReview extends ApwBaseFields {\n title: string;\n reviewStatus: ApwContentReviewStatus;\n content: ApwContentReviewContent;\n steps: Array<ApwContentReviewStep>;\n latestCommentId: string | null;\n workflowId: string;\n}\n\nexport interface ApwWorkflow extends ApwBaseFields {\n title: string;\n steps: ApwWorkflowStep[];\n scope: ApwWorkflowScope;\n app: ApwWorkflowApplications;\n}\n\ninterface ApwWorkflowScopeCmsEntry {\n id: string;\n modelId: string;\n}\n\nexport interface ApwWorkflowScope {\n type: WorkflowScopeTypes;\n data: {\n categories?: string[];\n pages?: string[];\n models?: string[];\n entries?: ApwWorkflowScopeCmsEntry[];\n };\n}\n\nexport enum ApwWorkflowStepTypes {\n MANDATORY_BLOCKING = \"mandatoryBlocking\",\n MANDATORY_NON_BLOCKING = \"mandatoryNonBlocking\",\n NON_MANDATORY = \"notMandatory\"\n}\n\nexport enum ApwContentReviewStatus {\n UNDER_REVIEW = \"underReview\",\n READY_TO_BE_PUBLISHED = \"readyToBePublished\",\n PUBLISHED = \"published\"\n}\n\nexport type ApwContentReviewListFilter = ApwContentReviewStatus | \"requiresMyAttention\";\n\nexport interface ApwWorkflowStep<TReviewer = ApwReviewer> {\n title: string;\n type: ApwWorkflowStepTypes;\n reviewers: TReviewer[];\n id: string;\n}\n\nexport interface ApwContentReviewStep extends ApwWorkflowStep {\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n}\n\nexport interface CreateApwWorkflowParams<TReviewer = string> {\n app: ApwWorkflowApplications;\n title: string;\n scope: ApwWorkflowScope;\n steps: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface UpdateApwWorkflowParams<TReviewer = string> {\n title?: string;\n scope?: ApwWorkflowScope;\n steps?: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface ListWorkflowsParams extends ListParams {\n where?: ListWhere & {\n app?: ApwWorkflowApplications;\n };\n}\n\ninterface CreateApwCommentParams {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\ninterface UpdateApwCommentParams {\n body: Record<string, any>;\n}\n\ninterface CreateApwChangeRequestParams {\n title: string;\n step: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\ninterface UpdateApwChangeRequestParams {\n title: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\nenum ApwScheduleActionTypes {\n PUBLISH = \"publish\",\n UNPUBLISH = \"unpublish\"\n}\n\nexport interface ApwScheduleActionData {\n action: ApwScheduleActionTypes;\n type: ApwContentTypes;\n datetime: string;\n entryId: string;\n /**\n * We will add modelId to the data for now.\n * TODO extract in separate package?\n */\n modelId?: string;\n}\n\nexport interface ApwContentReviewContent {\n id: string;\n type: ApwContentTypes;\n settings: {\n modelId?: string;\n };\n scheduledOn?: string | null;\n scheduledBy?: string | null;\n scheduledActionId?: string | null;\n publishedBy?: string | null;\n}\n\nexport interface CreateApwContentReviewParams {\n content: ApwContentReviewContent;\n reviewStatus: ApwContentReviewStatus;\n workflowId?: string;\n}\n\nexport interface UpdateApwContentReviewParams {\n title?: string;\n steps?: ApwContentReviewStep[];\n reviewStatus?: ApwContentReviewStatus;\n content?: ApwContentReviewContent;\n}\n\ninterface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {\n get(id: string): Promise<TEntry>;\n\n create(data: TCreateEntryParams): Promise<TEntry>;\n\n update(id: string, data: TUpdateEntryParams): Promise<TEntry>;\n\n delete(id: string): Promise<boolean>;\n}\n\nexport interface ApwWorkflowCrud\n extends BaseApwCrud<ApwWorkflow, CreateApwWorkflowParams, UpdateApwWorkflowParams> {\n list(params?: ListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate: Topic<OnWorkflowBeforeCreateTopicParams>;\n onWorkflowAfterCreate: Topic<OnWorkflowAfterCreateTopicParams>;\n onWorkflowBeforeUpdate: Topic<OnWorkflowBeforeUpdateTopicParams>;\n onWorkflowAfterUpdate: Topic<OnWorkflowAfterUpdateTopicParams>;\n onWorkflowBeforeDelete: Topic<OnWorkflowBeforeDeleteTopicParams>;\n onWorkflowAfterDelete: Topic<OnWorkflowAfterDeleteTopicParams>;\n}\n\nexport interface ApwReviewerListParams extends ListParams {\n where: ListParams[\"where\"] & {\n identityId?: string;\n };\n}\n\nexport interface ApwReviewerCrud\n extends BaseApwCrud<ApwReviewer, CreateApwReviewerData, UpdateApwReviewerData> {\n list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate: Topic<OnReviewerBeforeCreateTopicParams>;\n onReviewerAfterCreate: Topic<OnReviewerAfterCreateTopicParams>;\n onReviewerBeforeUpdate: Topic<OnReviewerBeforeUpdateTopicParams>;\n onReviewerAfterUpdate: Topic<OnReviewerAfterUpdateTopicParams>;\n onReviewerBeforeDelete: Topic<OnReviewerBeforeDeleteTopicParams>;\n onReviewerAfterDelete: Topic<OnReviewerAfterDeleteTopicParams>;\n}\n\nexport interface ApwCommentListParams extends ListParams {\n where: ListParams[\"where\"] & {\n changeRequest?: {\n id?: string;\n };\n };\n}\n\nexport interface ApwCommentCrud\n extends BaseApwCrud<ApwComment, CreateApwCommentParams, UpdateApwCommentParams> {\n list(params: ApwCommentListParams): Promise<[ApwComment[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onCommentBeforeCreate: Topic<OnCommentBeforeCreateTopicParams>;\n onCommentAfterCreate: Topic<OnCommentAfterCreateTopicParams>;\n onCommentBeforeUpdate: Topic<OnCommentBeforeUpdateTopicParams>;\n onCommentAfterUpdate: Topic<OnCommentAfterUpdateTopicParams>;\n onCommentBeforeDelete: Topic<OnCommentBeforeDeleteTopicParams>;\n onCommentAfterDelete: Topic<OnCommentAfterDeleteTopicParams>;\n}\n\nexport interface ApwChangeRequestListParams extends ListParams {\n where: ListParams[\"where\"] & {\n step?: string;\n };\n}\n\nexport interface ApwChangeRequestCrud\n extends BaseApwCrud<\n ApwChangeRequest,\n CreateApwChangeRequestParams,\n UpdateApwChangeRequestParams\n > {\n list(params: ApwChangeRequestListParams): Promise<[ApwChangeRequest[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onChangeRequestBeforeCreate: Topic<OnChangeRequestBeforeCreateTopicParams>;\n onChangeRequestAfterCreate: Topic<OnChangeRequestAfterCreateTopicParams>;\n onChangeRequestBeforeUpdate: Topic<OnChangeRequestBeforeUpdateTopicParams>;\n onChangeRequestAfterUpdate: Topic<OnChangeRequestAfterUpdateTopicParams>;\n onChangeRequestBeforeDelete: Topic<OnChangeRequestBeforeDeleteTopicParams>;\n onChangeRequestAfterDelete: Topic<OnChangeRequestAfterDeleteTopicParams>;\n}\n\nexport interface ApwContentReviewCrud\n extends BaseApwCrud<\n ApwContentReview,\n CreateApwContentReviewParams,\n UpdateApwContentReviewParams\n > {\n list(params: ApwContentReviewListParams): Promise<[ApwContentReview[], ListMeta]>;\n\n provideSignOff(id: string, step: string): Promise<boolean>;\n\n retractSignOff(id: string, step: string): Promise<boolean>;\n\n isReviewRequired(data: ApwContentReviewContent): Promise<{\n isReviewRequired: boolean;\n contentReviewId?: string | null;\n }>;\n\n publishContent(id: string, datetime?: string): Promise<boolean>;\n\n unpublishContent(id: string, datetime?: string): Promise<boolean>;\n\n scheduleAction(data: ApwScheduleActionData): Promise<string>;\n\n deleteScheduledAction(id: string): Promise<boolean>;\n\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate: Topic<OnContentReviewBeforeCreateTopicParams>;\n onContentReviewAfterCreate: Topic<OnContentReviewAfterCreateTopicParams>;\n onContentReviewBeforeUpdate: Topic<OnContentReviewBeforeUpdateTopicParams>;\n onContentReviewAfterUpdate: Topic<OnContentReviewAfterUpdateTopicParams>;\n onContentReviewBeforeDelete: Topic<OnContentReviewBeforeDeleteTopicParams>;\n onContentReviewAfterDelete: Topic<OnContentReviewAfterDeleteTopicParams>;\n onContentReviewBeforeList: Topic<OnContentReviewBeforeListTopicParams>;\n}\n\nexport type ContentGetter = (\n id: string,\n settings: { modelId?: string }\n) => Promise<PageWithWorkflow | ApwCmsEntry | null>;\n\nexport type ContentPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<boolean | null>;\n\nexport type ContentUnPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<boolean | null>;\n\nexport interface AdvancedPublishingWorkflow {\n addContentGetter: (type: ApwContentTypes, func: ContentGetter) => void;\n getContentGetter: (type: ApwContentTypes) => ContentGetter;\n addContentPublisher: (type: ApwContentTypes, func: ContentPublisher) => void;\n getContentPublisher: (type: ApwContentTypes) => ContentPublisher;\n addContentUnPublisher: (type: ApwContentTypes, func: ContentUnPublisher) => void;\n getContentUnPublisher: (type: ApwContentTypes) => ContentUnPublisher;\n workflow: ApwWorkflowCrud;\n reviewer: ApwReviewerCrud;\n comment: ApwCommentCrud;\n changeRequest: ApwChangeRequestCrud;\n contentReview: ApwContentReviewCrud;\n scheduleAction: ApwScheduleActionCrud;\n}\n\nexport interface ApwContext extends Context, MailerContext {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n wcp: WcpContextObject;\n scheduleAction: ScheduleActionContext[\"scheduleAction\"];\n}\n\nexport interface LifeCycleHookCallbackParams {\n apw: ApwContext[\"apw\"];\n security: ApwContext[\"security\"];\n cms?: ApwContext[\"cms\"];\n}\n\nexport interface CreateApwParams {\n getLocale: () => I18NLocale;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getPermission: (name: string) => Promise<SecurityPermission | null>;\n storageOperations: ApwStorageOperations;\n scheduler: ApwScheduleActionCrud;\n handlerClient: HandlerClient;\n plugins: PluginsContainer;\n}\n\ninterface StorageOperationsGetReviewerParams {\n id: string;\n}\n\ntype StorageOperationsListReviewersParams = ApwReviewerListParams;\n\ninterface CreateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\n}\n\ninterface UpdateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\n}\n\ninterface StorageOperationsCreateReviewerParams {\n data: CreateApwReviewerData;\n}\n\ninterface StorageOperationsUpdateReviewerParams {\n id: string;\n data: UpdateApwReviewerData;\n}\n\ninterface StorageOperationsDeleteReviewerParams {\n id: string;\n}\n\ninterface StorageOperationsGetParams {\n id: string;\n}\n\ninterface StorageOperationsDeleteParams {\n id: string;\n}\n\ntype StorageOperationsGetWorkflowParams = StorageOperationsGetParams;\n\ntype StorageOperationsListWorkflowsParams = ListParams;\n\ninterface StorageOperationsCreateWorkflowParams {\n data: CreateApwWorkflowParams;\n}\n\ninterface StorageOperationsUpdateWorkflowParams {\n id: string;\n data: UpdateApwWorkflowParams;\n}\n\ntype StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;\ntype StorageOperationsGetContentReviewParams = StorageOperationsGetParams;\n\nexport interface ApwContentReviewListParams extends ListParams {\n where: ListWhere & {\n reviewStatus?: ApwContentReviewListFilter;\n title?: string;\n title_contains?: string;\n workflowId?: string;\n workflowId_in?: string[];\n };\n}\n\ntype StorageOperationsListContentReviewsParams = ApwContentReviewListParams;\n\ninterface StorageOperationsCreateContentReviewParams {\n data: CreateApwContentReviewParams;\n}\n\ninterface StorageOperationsUpdateContentReviewParams {\n id: string;\n data: UpdateApwContentReviewParams;\n}\n\ntype StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;\ntype StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;\n\ninterface StorageOperationsCreateChangeRequestParams {\n data: CreateApwChangeRequestParams;\n}\n\ninterface StorageOperationsUpdateChangeRequestParams {\n id: string;\n data: UpdateApwChangeRequestParams;\n}\n\ntype StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetCommentParams = StorageOperationsGetParams;\n\ntype StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;\ntype StorageOperationsListCommentsParams = ApwCommentListParams;\n\ninterface StorageOperationsCreateCommentParams {\n data: CreateApwCommentParams;\n}\n\ninterface StorageOperationsUpdateCommentParams {\n id: string;\n data: UpdateApwCommentParams;\n}\n\nexport interface ApwReviewerStorageOperations {\n /*\n * Reviewer methods\n */\n getReviewer(params: StorageOperationsGetReviewerParams): Promise<ApwReviewer>;\n\n listReviewers(params: StorageOperationsListReviewersParams): Promise<[ApwReviewer[], ListMeta]>;\n\n createReviewer(params: StorageOperationsCreateReviewerParams): Promise<ApwReviewer>;\n\n updateReviewer(params: StorageOperationsUpdateReviewerParams): Promise<ApwReviewer>;\n\n deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<boolean>;\n}\n\nexport interface ApwWorkflowStorageOperations {\n /*\n * Workflow methods\n */\n getWorkflow(params: StorageOperationsGetWorkflowParams): Promise<ApwWorkflow>;\n\n listWorkflows(params: StorageOperationsListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n createWorkflow(params: StorageOperationsCreateWorkflowParams): Promise<ApwWorkflow>;\n\n updateWorkflow(params: StorageOperationsUpdateWorkflowParams): Promise<ApwWorkflow>;\n\n deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<boolean>;\n}\n\nexport interface ApwContentReviewStorageOperations {\n /*\n * ContentReview methods\n */\n getContentReview(params: StorageOperationsGetContentReviewParams): Promise<ApwContentReview>;\n\n listContentReviews(\n params: StorageOperationsListContentReviewsParams\n ): Promise<[ApwContentReview[], ListMeta]>;\n\n createContentReview(\n params: StorageOperationsCreateContentReviewParams\n ): Promise<ApwContentReview>;\n\n updateContentReview(\n params: StorageOperationsUpdateContentReviewParams\n ): Promise<ApwContentReview>;\n\n deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<boolean>;\n}\n\nexport interface ApwChangeRequestStorageOperations {\n /*\n * ChangeRequest methods\n */\n getChangeRequest(params: StorageOperationsGetChangeRequestParams): Promise<ApwChangeRequest>;\n\n listChangeRequests(\n params: StorageOperationsListChangeRequestsParams\n ): Promise<[ApwChangeRequest[], ListMeta]>;\n\n createChangeRequest(\n params: StorageOperationsCreateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n updateChangeRequest(\n params: StorageOperationsUpdateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<boolean>;\n}\n\nexport interface ApwCommentStorageOperations {\n /*\n * Comment methods\n */\n getComment(params: StorageOperationsGetCommentParams): Promise<ApwComment>;\n\n listComments(params: StorageOperationsListCommentsParams): Promise<[ApwComment[], ListMeta]>;\n\n createComment(params: StorageOperationsCreateCommentParams): Promise<ApwComment>;\n\n updateComment(params: StorageOperationsUpdateCommentParams): Promise<ApwComment>;\n\n deleteComment(params: StorageOperationsDeleteCommentParams): Promise<boolean>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeCreateTopicParams {\n input: CreateApwCommentParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterCreateTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeUpdateTopicParams {\n original: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterUpdateTopicParams {\n original: ApwComment;\n comment: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeCreateTopicParams {\n input: CreateApwChangeRequestParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterCreateTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeUpdateTopicParams {\n original: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterUpdateTopicParams {\n original: ApwChangeRequest;\n changeRequest: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeCreateTopicParams {\n input: CreateApwContentReviewParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterCreateTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeUpdateTopicParams {\n original: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterUpdateTopicParams {\n original: ApwContentReview;\n contentReview: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeListTopicParams {\n where: ApwContentReviewListParams[\"where\"];\n}\n\nexport interface CreateApwReviewerParams {\n type: string;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeCreateTopicParams {\n input: CreateApwReviewerParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterCreateTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeUpdateTopicParams {\n original: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterUpdateTopicParams {\n original: ApwReviewer;\n reviewer: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeCreateTopicParams {\n input: CreateApwWorkflowParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterCreateTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeUpdateTopicParams {\n original: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterUpdateTopicParams {\n original: ApwWorkflow;\n workflow: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * Headless CMS\n */\nexport interface OnCmsEntryBeforePublishTopicParams\n extends Omit<OnEntryBeforePublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterPublishTopicParams\n extends Omit<OnEntryAfterPublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterUnpublishTopicParams\n extends Omit<OnEntryAfterUnpublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n"],"mappings":";;;;;;IAoFYA,eAAe,GAAAC,OAAA,CAAAD,eAAA,0BAAfA,eAAe;EAAfA,eAAe;EAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAAA,IAyBfE,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAAA,IAKlBC,0BAA0B,GAAAF,OAAA,CAAAE,0BAAA,0BAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAA1BA,0BAA0B;EAAA,OAA1BA,0BAA0B;AAAA;AAAA,IAM1BC,uBAAuB,GAAAH,OAAA,CAAAG,uBAAA,0BAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AAKnC;AACA;AACA;AACA;AACA;AAJA,IAqGYC,oBAAoB,GAAAJ,OAAA,CAAAI,oBAAA,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAAA,OAApBA,oBAAoB;AAAA;AAAA,IAMpBC,sBAAsB,GAAAL,OAAA,CAAAK,sBAAA,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA;AAAA,IAiE7BC,sBAAsB,0BAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAtBA,sBAAsB;EAAA,OAAtBA,sBAAsB;AAAA,EAAtBA,sBAAsB;AA6a3B;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AASA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"names":["ApwContentTypes","exports","WorkflowScopeTypes","ApwContentReviewStepStatus","ApwWorkflowApplications","ApwWorkflowStepTypes","ApwContentReviewStatus","ApwScheduleActionTypes"],"sources":["types.ts"],"sourcesContent":["import type {\n CmsEntry as BaseCmsEntry,\n OnEntryBeforePublishTopicParams,\n OnEntryAfterPublishTopicParams,\n OnEntryAfterUnpublishTopicParams,\n CmsEntryListSort\n} from \"@webiny/api-headless-cms/types\";\nimport type { Context } from \"@webiny/api/types\";\nimport type { SecurityIdentity, SecurityPermission } from \"@webiny/api-security/types\";\nimport type { I18NLocale } from \"@webiny/api-i18n/types\";\nimport type { Tenant } from \"@webiny/api-tenancy/types\";\nimport type { Topic } from \"@webiny/pubsub/types\";\nimport type { ApwScheduleActionCrud, ScheduleActionContext } from \"~/scheduler/types\";\nimport type HandlerClient from \"@webiny/handler-client/HandlerClient\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { WcpContextObject } from \"@webiny/api-wcp/types\";\nimport type { MailerContext } from \"@webiny/api-mailer/types\";\n\nexport interface ApwCmsEntry extends BaseCmsEntry {\n title: string;\n meta: {\n apw?: {\n contentReviewId?: string | null;\n workflowId?: string | null;\n };\n };\n}\n\nexport interface ApwFile {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n}\n\nexport interface ListWhere {\n /**\n * Fields.\n */\n id?: string;\n id_in?: string[];\n id_not?: string;\n id_not_in?: string[];\n /**\n * Who created the entry?\n */\n createdBy?: string;\n createdBy_not?: string;\n createdBy_in?: string[];\n createdBy_not_in?: string[];\n}\n\nexport interface ListParams {\n where?: ListWhere;\n sort?: CmsEntryListSort;\n limit?: number;\n after?: string | null;\n}\n\nexport interface ListMeta {\n /**\n * A cursor for pagination.\n */\n cursor: string | null;\n /**\n * Is there more items to load?\n */\n hasMoreItems: boolean;\n /**\n * Total count of the items in the storage.\n */\n totalCount: number;\n}\n\nexport enum ApwContentTypes {\n PAGE = \"page\",\n CMS_ENTRY = \"cms_entry\"\n}\n\nexport enum WorkflowScopeTypes {\n DEFAULT = \"default\",\n CUSTOM = \"custom\"\n}\n\nexport enum ApwContentReviewStepStatus {\n DONE = \"done\",\n ACTIVE = \"active\",\n INACTIVE = \"inactive\"\n}\n\nexport enum ApwWorkflowApplications {\n PB = \"pageBuilder\",\n CMS = \"cms\"\n}\n\n/**\n * A interface describing the reference to a user that created some data in the database.\n *\n * @category General\n */\nexport interface ApwIdentity {\n /**\n * ID if the user.\n */\n id: string;\n /**\n * Full name of the user.\n */\n displayName: string | null;\n /**\n * Type of the user (admin, user)\n */\n type: string;\n}\n\nexport interface ApwBaseFields {\n id: string;\n entryId: string;\n\n createdOn: string;\n modifiedOn: string | null;\n savedOn: string;\n createdBy: ApwIdentity;\n modifiedBy: ApwIdentity;\n savedBy: ApwIdentity;\n}\n\nexport interface ApwReviewer extends ApwBaseFields {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string;\n}\n\nexport interface ApwReviewerWithEmail extends Omit<ApwReviewer, \"email\"> {\n email: string;\n}\n\nexport interface ApwComment extends ApwBaseFields {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwChangeRequest extends ApwBaseFields {\n body: Record<string, any>;\n title: string;\n resolved: boolean;\n step: string;\n media: ApwFile;\n}\n\nexport interface ApwContentReviewStep {\n type: ApwWorkflowStepTypes;\n title: string;\n slug: string;\n reviewers: ApwReviewer[];\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n totalComments: number;\n signOffProvidedOn: string | null;\n signOffProvidedBy: ApwIdentity | null;\n}\n\nexport interface ApwContentReview extends ApwBaseFields {\n title: string;\n reviewStatus: ApwContentReviewStatus;\n content: ApwContentReviewContent;\n steps: Array<ApwContentReviewStep>;\n latestCommentId: string | null;\n workflowId: string;\n}\n\nexport interface ApwWorkflow extends ApwBaseFields {\n title: string;\n steps: ApwWorkflowStep[];\n scope: ApwWorkflowScope;\n app: ApwWorkflowApplications;\n}\n\ninterface ApwWorkflowScopeCmsEntry {\n id: string;\n modelId: string;\n}\n\nexport interface ApwWorkflowScope {\n type: WorkflowScopeTypes;\n data: {\n categories?: string[];\n pages?: string[];\n models?: string[];\n entries?: ApwWorkflowScopeCmsEntry[];\n };\n}\n\nexport enum ApwWorkflowStepTypes {\n MANDATORY_BLOCKING = \"mandatoryBlocking\",\n MANDATORY_NON_BLOCKING = \"mandatoryNonBlocking\",\n NON_MANDATORY = \"notMandatory\"\n}\n\nexport enum ApwContentReviewStatus {\n UNDER_REVIEW = \"underReview\",\n READY_TO_BE_PUBLISHED = \"readyToBePublished\",\n PUBLISHED = \"published\"\n}\n\nexport type ApwContentReviewListFilter = ApwContentReviewStatus | \"requiresMyAttention\";\n\nexport interface ApwWorkflowStep<TReviewer = ApwReviewer> {\n title: string;\n type: ApwWorkflowStepTypes;\n reviewers: TReviewer[];\n id: string;\n}\n\nexport interface ApwContentReviewStep extends ApwWorkflowStep {\n status: ApwContentReviewStepStatus;\n pendingChangeRequests: number;\n}\n\nexport interface CreateApwWorkflowParams<TReviewer = string> {\n app: ApwWorkflowApplications;\n title: string;\n scope: ApwWorkflowScope;\n steps: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface UpdateApwWorkflowParams<TReviewer = string> {\n title?: string;\n scope?: ApwWorkflowScope;\n steps?: ApwWorkflowStep<TReviewer>[];\n}\n\nexport interface ListWorkflowsParams extends ListParams {\n where?: ListWhere & {\n app?: ApwWorkflowApplications;\n };\n}\n\ninterface CreateApwCommentParams {\n body: Record<string, any>;\n changeRequest: string;\n step: string;\n media: ApwFile;\n}\n\ninterface UpdateApwCommentParams {\n body: Record<string, any>;\n}\n\ninterface CreateApwChangeRequestParams {\n title: string;\n step: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\ninterface UpdateApwChangeRequestParams {\n title: string;\n body: Record<string, any>;\n resolved: boolean;\n media: Record<string, any>;\n}\n\nenum ApwScheduleActionTypes {\n PUBLISH = \"publish\",\n UNPUBLISH = \"unpublish\"\n}\n\nexport interface ApwScheduleActionData {\n action: ApwScheduleActionTypes;\n type: ApwContentTypes;\n datetime: string;\n entryId: string;\n /**\n * We will add modelId to the data for now.\n * TODO extract in separate package?\n */\n modelId?: string;\n}\n\nexport interface ApwContentReviewContent {\n id: string;\n type: ApwContentTypes;\n settings: {\n modelId?: string;\n };\n scheduledOn?: string | null;\n scheduledBy?: string | null;\n scheduledActionId?: string | null;\n publishedBy?: string | null;\n}\n\nexport interface CreateApwContentReviewParams {\n content: ApwContentReviewContent;\n reviewStatus: ApwContentReviewStatus;\n workflowId?: string;\n}\n\nexport interface UpdateApwContentReviewParams {\n title?: string;\n steps?: ApwContentReviewStep[];\n reviewStatus?: ApwContentReviewStatus;\n content?: ApwContentReviewContent;\n}\n\ninterface BaseApwCrud<TEntry, TCreateEntryParams, TUpdateEntryParams> {\n get(id: string): Promise<TEntry>;\n\n create(data: TCreateEntryParams): Promise<TEntry>;\n\n update(id: string, data: TUpdateEntryParams): Promise<TEntry>;\n\n delete(id: string): Promise<boolean>;\n}\n\nexport interface ApwWorkflowCrud\n extends BaseApwCrud<ApwWorkflow, CreateApwWorkflowParams, UpdateApwWorkflowParams> {\n list(params?: ListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onWorkflowBeforeCreate: Topic<OnWorkflowBeforeCreateTopicParams>;\n onWorkflowAfterCreate: Topic<OnWorkflowAfterCreateTopicParams>;\n onWorkflowBeforeUpdate: Topic<OnWorkflowBeforeUpdateTopicParams>;\n onWorkflowAfterUpdate: Topic<OnWorkflowAfterUpdateTopicParams>;\n onWorkflowBeforeDelete: Topic<OnWorkflowBeforeDeleteTopicParams>;\n onWorkflowAfterDelete: Topic<OnWorkflowAfterDeleteTopicParams>;\n}\n\nexport interface ApwReviewerListParams extends ListParams {\n where: ListParams[\"where\"] & {\n identityId?: string;\n };\n}\n\nexport interface ApwReviewerCrud\n extends BaseApwCrud<ApwReviewer, CreateApwReviewerData, UpdateApwReviewerData> {\n list(params: ApwReviewerListParams): Promise<[ApwReviewer[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onReviewerBeforeCreate: Topic<OnReviewerBeforeCreateTopicParams>;\n onReviewerAfterCreate: Topic<OnReviewerAfterCreateTopicParams>;\n onReviewerBeforeUpdate: Topic<OnReviewerBeforeUpdateTopicParams>;\n onReviewerAfterUpdate: Topic<OnReviewerAfterUpdateTopicParams>;\n onReviewerBeforeDelete: Topic<OnReviewerBeforeDeleteTopicParams>;\n onReviewerAfterDelete: Topic<OnReviewerAfterDeleteTopicParams>;\n}\n\nexport interface ApwCommentListParams extends ListParams {\n where: ListParams[\"where\"] & {\n changeRequest?: {\n id?: string;\n };\n };\n}\n\nexport interface ApwCommentCrud\n extends BaseApwCrud<ApwComment, CreateApwCommentParams, UpdateApwCommentParams> {\n list(params: ApwCommentListParams): Promise<[ApwComment[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onCommentBeforeCreate: Topic<OnCommentBeforeCreateTopicParams>;\n onCommentAfterCreate: Topic<OnCommentAfterCreateTopicParams>;\n onCommentBeforeUpdate: Topic<OnCommentBeforeUpdateTopicParams>;\n onCommentAfterUpdate: Topic<OnCommentAfterUpdateTopicParams>;\n onCommentBeforeDelete: Topic<OnCommentBeforeDeleteTopicParams>;\n onCommentAfterDelete: Topic<OnCommentAfterDeleteTopicParams>;\n}\n\nexport interface ApwChangeRequestListParams extends ListParams {\n where: ListParams[\"where\"] & {\n step?: string;\n };\n}\n\nexport interface ApwChangeRequestCrud\n extends BaseApwCrud<\n ApwChangeRequest,\n CreateApwChangeRequestParams,\n UpdateApwChangeRequestParams\n > {\n list(params: ApwChangeRequestListParams): Promise<[ApwChangeRequest[], ListMeta]>;\n\n /**\n * Lifecycle events\n */\n onChangeRequestBeforeCreate: Topic<OnChangeRequestBeforeCreateTopicParams>;\n onChangeRequestAfterCreate: Topic<OnChangeRequestAfterCreateTopicParams>;\n onChangeRequestBeforeUpdate: Topic<OnChangeRequestBeforeUpdateTopicParams>;\n onChangeRequestAfterUpdate: Topic<OnChangeRequestAfterUpdateTopicParams>;\n onChangeRequestBeforeDelete: Topic<OnChangeRequestBeforeDeleteTopicParams>;\n onChangeRequestAfterDelete: Topic<OnChangeRequestAfterDeleteTopicParams>;\n}\n\nexport interface ApwContentReviewCrud\n extends BaseApwCrud<\n ApwContentReview,\n CreateApwContentReviewParams,\n UpdateApwContentReviewParams\n > {\n list(params: ApwContentReviewListParams): Promise<[ApwContentReview[], ListMeta]>;\n\n provideSignOff(id: string, step: string): Promise<boolean>;\n\n retractSignOff(id: string, step: string): Promise<boolean>;\n\n isReviewRequired(data: ApwContentReviewContent): Promise<{\n isReviewRequired: boolean;\n contentReviewId?: string | null;\n }>;\n\n publishContent(id: string, datetime?: string): Promise<boolean>;\n\n unpublishContent(id: string, datetime?: string): Promise<boolean>;\n\n scheduleAction(data: ApwScheduleActionData): Promise<string>;\n\n deleteScheduledAction(id: string): Promise<boolean>;\n\n /**\n * Lifecycle events\n */\n onContentReviewBeforeCreate: Topic<OnContentReviewBeforeCreateTopicParams>;\n onContentReviewAfterCreate: Topic<OnContentReviewAfterCreateTopicParams>;\n onContentReviewBeforeUpdate: Topic<OnContentReviewBeforeUpdateTopicParams>;\n onContentReviewAfterUpdate: Topic<OnContentReviewAfterUpdateTopicParams>;\n onContentReviewBeforeDelete: Topic<OnContentReviewBeforeDeleteTopicParams>;\n onContentReviewAfterDelete: Topic<OnContentReviewAfterDeleteTopicParams>;\n onContentReviewBeforeList: Topic<OnContentReviewBeforeListTopicParams>;\n}\n\nexport type ContentGetter = (\n id: string,\n settings: { modelId?: string }\n) => Promise<ApwCmsEntry | null>;\n\nexport type ContentPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<boolean | null>;\n\nexport type ContentUnPublisher = (\n id: string,\n settings: { modelId?: string }\n) => Promise<boolean | null>;\n\nexport interface AdvancedPublishingWorkflow {\n addContentGetter: (type: ApwContentTypes, func: ContentGetter) => void;\n getContentGetter: (type: ApwContentTypes) => ContentGetter;\n addContentPublisher: (type: ApwContentTypes, func: ContentPublisher) => void;\n getContentPublisher: (type: ApwContentTypes) => ContentPublisher;\n addContentUnPublisher: (type: ApwContentTypes, func: ContentUnPublisher) => void;\n getContentUnPublisher: (type: ApwContentTypes) => ContentUnPublisher;\n workflow: ApwWorkflowCrud;\n reviewer: ApwReviewerCrud;\n comment: ApwCommentCrud;\n changeRequest: ApwChangeRequestCrud;\n contentReview: ApwContentReviewCrud;\n scheduleAction: ApwScheduleActionCrud;\n}\n\nexport interface ApwContext extends Context, MailerContext {\n apw: AdvancedPublishingWorkflow;\n wcp: WcpContextObject;\n scheduleAction: ScheduleActionContext[\"scheduleAction\"];\n}\n\nexport interface LifeCycleHookCallbackParams {\n apw: ApwContext[\"apw\"];\n security: ApwContext[\"security\"];\n cms?: ApwContext[\"cms\"];\n}\n\nexport interface CreateApwParams {\n getLocale: () => I18NLocale;\n getIdentity: () => SecurityIdentity;\n getTenant: () => Tenant;\n getPermission: (name: string) => Promise<SecurityPermission | null>;\n storageOperations: ApwStorageOperations;\n scheduler: ApwScheduleActionCrud;\n handlerClient: HandlerClient;\n plugins: PluginsContainer;\n}\n\ninterface StorageOperationsGetReviewerParams {\n id: string;\n}\n\ntype StorageOperationsListReviewersParams = ApwReviewerListParams;\n\ninterface CreateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\n}\n\ninterface UpdateApwReviewerData {\n identityId: string;\n displayName: string | null;\n type: string;\n email?: string | null;\n}\n\ninterface StorageOperationsCreateReviewerParams {\n data: CreateApwReviewerData;\n}\n\ninterface StorageOperationsUpdateReviewerParams {\n id: string;\n data: UpdateApwReviewerData;\n}\n\ninterface StorageOperationsDeleteReviewerParams {\n id: string;\n}\n\ninterface StorageOperationsGetParams {\n id: string;\n}\n\ninterface StorageOperationsDeleteParams {\n id: string;\n}\n\ntype StorageOperationsGetWorkflowParams = StorageOperationsGetParams;\n\ntype StorageOperationsListWorkflowsParams = ListParams;\n\ninterface StorageOperationsCreateWorkflowParams {\n data: CreateApwWorkflowParams;\n}\n\ninterface StorageOperationsUpdateWorkflowParams {\n id: string;\n data: UpdateApwWorkflowParams;\n}\n\ntype StorageOperationsDeleteWorkflowParams = StorageOperationsDeleteParams;\ntype StorageOperationsGetContentReviewParams = StorageOperationsGetParams;\n\nexport interface ApwContentReviewListParams extends ListParams {\n where: ListWhere & {\n reviewStatus?: ApwContentReviewListFilter;\n title?: string;\n title_contains?: string;\n workflowId?: string;\n workflowId_in?: string[];\n };\n}\n\ntype StorageOperationsListContentReviewsParams = ApwContentReviewListParams;\n\ninterface StorageOperationsCreateContentReviewParams {\n data: CreateApwContentReviewParams;\n}\n\ninterface StorageOperationsUpdateContentReviewParams {\n id: string;\n data: UpdateApwContentReviewParams;\n}\n\ntype StorageOperationsDeleteContentReviewParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetChangeRequestParams = StorageOperationsGetParams;\ntype StorageOperationsListChangeRequestsParams = ApwChangeRequestListParams;\n\ninterface StorageOperationsCreateChangeRequestParams {\n data: CreateApwChangeRequestParams;\n}\n\ninterface StorageOperationsUpdateChangeRequestParams {\n id: string;\n data: UpdateApwChangeRequestParams;\n}\n\ntype StorageOperationsDeleteChangeRequestParams = StorageOperationsDeleteParams;\n\ntype StorageOperationsGetCommentParams = StorageOperationsGetParams;\n\ntype StorageOperationsDeleteCommentParams = StorageOperationsDeleteParams;\ntype StorageOperationsListCommentsParams = ApwCommentListParams;\n\ninterface StorageOperationsCreateCommentParams {\n data: CreateApwCommentParams;\n}\n\ninterface StorageOperationsUpdateCommentParams {\n id: string;\n data: UpdateApwCommentParams;\n}\n\nexport interface ApwReviewerStorageOperations {\n /*\n * Reviewer methods\n */\n getReviewer(params: StorageOperationsGetReviewerParams): Promise<ApwReviewer>;\n\n listReviewers(params: StorageOperationsListReviewersParams): Promise<[ApwReviewer[], ListMeta]>;\n\n createReviewer(params: StorageOperationsCreateReviewerParams): Promise<ApwReviewer>;\n\n updateReviewer(params: StorageOperationsUpdateReviewerParams): Promise<ApwReviewer>;\n\n deleteReviewer(params: StorageOperationsDeleteReviewerParams): Promise<boolean>;\n}\n\nexport interface ApwWorkflowStorageOperations {\n /*\n * Workflow methods\n */\n getWorkflow(params: StorageOperationsGetWorkflowParams): Promise<ApwWorkflow>;\n\n listWorkflows(params: StorageOperationsListWorkflowsParams): Promise<[ApwWorkflow[], ListMeta]>;\n\n createWorkflow(params: StorageOperationsCreateWorkflowParams): Promise<ApwWorkflow>;\n\n updateWorkflow(params: StorageOperationsUpdateWorkflowParams): Promise<ApwWorkflow>;\n\n deleteWorkflow(params: StorageOperationsDeleteWorkflowParams): Promise<boolean>;\n}\n\nexport interface ApwContentReviewStorageOperations {\n /*\n * ContentReview methods\n */\n getContentReview(params: StorageOperationsGetContentReviewParams): Promise<ApwContentReview>;\n\n listContentReviews(\n params: StorageOperationsListContentReviewsParams\n ): Promise<[ApwContentReview[], ListMeta]>;\n\n createContentReview(\n params: StorageOperationsCreateContentReviewParams\n ): Promise<ApwContentReview>;\n\n updateContentReview(\n params: StorageOperationsUpdateContentReviewParams\n ): Promise<ApwContentReview>;\n\n deleteContentReview(params: StorageOperationsDeleteContentReviewParams): Promise<boolean>;\n}\n\nexport interface ApwChangeRequestStorageOperations {\n /*\n * ChangeRequest methods\n */\n getChangeRequest(params: StorageOperationsGetChangeRequestParams): Promise<ApwChangeRequest>;\n\n listChangeRequests(\n params: StorageOperationsListChangeRequestsParams\n ): Promise<[ApwChangeRequest[], ListMeta]>;\n\n createChangeRequest(\n params: StorageOperationsCreateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n updateChangeRequest(\n params: StorageOperationsUpdateChangeRequestParams\n ): Promise<ApwChangeRequest>;\n\n deleteChangeRequest(params: StorageOperationsDeleteChangeRequestParams): Promise<boolean>;\n}\n\nexport interface ApwCommentStorageOperations {\n /*\n * Comment methods\n */\n getComment(params: StorageOperationsGetCommentParams): Promise<ApwComment>;\n\n listComments(params: StorageOperationsListCommentsParams): Promise<[ApwComment[], ListMeta]>;\n\n createComment(params: StorageOperationsCreateCommentParams): Promise<ApwComment>;\n\n updateComment(params: StorageOperationsUpdateCommentParams): Promise<ApwComment>;\n\n deleteComment(params: StorageOperationsDeleteCommentParams): Promise<boolean>;\n}\n\nexport interface ApwStorageOperations\n extends ApwReviewerStorageOperations,\n ApwWorkflowStorageOperations,\n ApwContentReviewStorageOperations,\n ApwChangeRequestStorageOperations,\n ApwCommentStorageOperations {}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeCreateTopicParams {\n input: CreateApwCommentParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterCreateTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeUpdateTopicParams {\n original: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterUpdateTopicParams {\n original: ApwComment;\n comment: ApwComment;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentBeforeDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnCommentAfterDeleteTopicParams {\n comment: ApwComment;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeCreateTopicParams {\n input: CreateApwChangeRequestParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterCreateTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeUpdateTopicParams {\n original: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterUpdateTopicParams {\n original: ApwChangeRequest;\n changeRequest: ApwChangeRequest;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestBeforeDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnChangeRequestAfterDeleteTopicParams {\n changeRequest: ApwChangeRequest;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeCreateTopicParams {\n input: CreateApwContentReviewParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterCreateTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeUpdateTopicParams {\n original: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterUpdateTopicParams {\n original: ApwContentReview;\n contentReview: ApwContentReview;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewAfterDeleteTopicParams {\n contentReview: ApwContentReview;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnContentReviewBeforeListTopicParams {\n where: ApwContentReviewListParams[\"where\"];\n}\n\nexport interface CreateApwReviewerParams {\n type: string;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeCreateTopicParams {\n input: CreateApwReviewerParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterCreateTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeUpdateTopicParams {\n original: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterUpdateTopicParams {\n original: ApwReviewer;\n reviewer: ApwReviewer;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerBeforeDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnReviewerAfterDeleteTopicParams {\n reviewer: ApwReviewer;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeCreateTopicParams {\n input: CreateApwWorkflowParams;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterCreateTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeUpdateTopicParams {\n original: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterUpdateTopicParams {\n original: ApwWorkflow;\n workflow: ApwWorkflow;\n input: Record<string, any>;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowBeforeDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * @category Lifecycle events\n */\nexport interface OnWorkflowAfterDeleteTopicParams {\n workflow: ApwWorkflow;\n}\n\n/**\n * Headless CMS\n */\nexport interface OnCmsEntryBeforePublishTopicParams\n extends Omit<OnEntryBeforePublishTopicParams, \"entry\"> {\n entry: ApwCmsEntry;\n}\n\nexport interface OnCmsEntryAfterPublishTopicParams\n extends Omit<OnEntryAfterPublishTopicParams, \"entry\"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A;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AASA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA;AAMA;AACA;AACA;AAOA;AACA;AACA;AAKA;AACA;AACA;AAKA;AACA;AACA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { ApwContentTypes } from "../types";
2
- import { PluginsContainer } from "@webiny/plugins";
1
+ import type { ApwContentTypes } from "../types";
2
+ import type { PluginsContainer } from "@webiny/plugins";
3
3
  import { ContentApwSettingsPlugin } from "../ContentApwSettingsPlugin";
4
4
  interface GetContentApwSettingsPluginParams {
5
5
  type: ApwContentTypes;
@@ -1 +1 @@
1
- {"version":3,"names":["_ContentApwSettingsPlugin","require","_handlerGraphql","getContentApwSettingsPlugin","params","type","plugins","plugin","byType","ContentApwSettingsPlugin","find","p","canUse","NotFoundError","exports"],"sources":["contentApwSettingsPlugin.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\n\ninterface GetContentApwSettingsPluginParams {\n type: ApwContentTypes;\n plugins: PluginsContainer;\n}\nexport const getContentApwSettingsPlugin = <\n T extends ContentApwSettingsPlugin = ContentApwSettingsPlugin\n>(\n params: GetContentApwSettingsPluginParams\n): T => {\n const { type, plugins } = params;\n const plugin = plugins.byType<T>(ContentApwSettingsPlugin.type).find(p => p.canUse(type));\n if (plugin) {\n return plugin;\n }\n throw new NotFoundError(`Could not find a \"ContentApwSettingsPlugin\" for \"${type}\".`);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAMO,MAAME,2BAA2B,GAGpCC,MAAyC,IACrC;EACJ,MAAM;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAChC,MAAMG,MAAM,GAAGD,OAAO,CAACE,MAAM,CAAIC,kDAAwB,CAACJ,IAAI,CAAC,CAACK,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAACP,IAAI,CAAC,CAAC;EACzF,IAAIE,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;EACA,MAAM,IAAIM,6BAAa,CAAC,oDAAoDR,IAAI,IAAI,CAAC;AACzF,CAAC;AAACS,OAAA,CAAAX,2BAAA,GAAAA,2BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_ContentApwSettingsPlugin","require","_handlerGraphql","getContentApwSettingsPlugin","params","type","plugins","plugin","byType","ContentApwSettingsPlugin","find","p","canUse","NotFoundError","exports"],"sources":["contentApwSettingsPlugin.ts"],"sourcesContent":["import type { ApwContentTypes } from \"~/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\n\ninterface GetContentApwSettingsPluginParams {\n type: ApwContentTypes;\n plugins: PluginsContainer;\n}\nexport const getContentApwSettingsPlugin = <\n T extends ContentApwSettingsPlugin = ContentApwSettingsPlugin\n>(\n params: GetContentApwSettingsPluginParams\n): T => {\n const { type, plugins } = params;\n const plugin = plugins.byType<T>(ContentApwSettingsPlugin.type).find(p => p.canUse(type));\n if (plugin) {\n return plugin;\n }\n throw new NotFoundError(`Could not find a \"ContentApwSettingsPlugin\" for \"${type}\".`);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAMO,MAAME,2BAA2B,GAGpCC,MAAyC,IACrC;EACJ,MAAM;IAAEC,IAAI;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAChC,MAAMG,MAAM,GAAGD,OAAO,CAACE,MAAM,CAAIC,kDAAwB,CAACJ,IAAI,CAAC,CAACK,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,MAAM,CAACP,IAAI,CAAC,CAAC;EACzF,IAAIE,MAAM,EAAE;IACR,OAAOA,MAAM;EACjB;EACA,MAAM,IAAIM,6BAAa,CAAC,oDAAoDR,IAAI,IAAI,CAAC;AACzF,CAAC;AAACS,OAAA,CAAAX,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { CmsContext, CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
2
- import { ApwBaseFields } from "../types";
1
+ import type { CmsContext, CmsEntry, CmsModel } from "@webiny/api-headless-cms/types";
2
+ import type { ApwBaseFields } from "../types";
3
3
  interface Transformer {
4
4
  fieldId: keyof ApwBaseFields;
5
5
  model: any;
@@ -1 +1 @@
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","ignoreList":[]}
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 type { CmsContext, CmsEntry, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { entryFieldFromStorageTransform } from \"@webiny/api-headless-cms\";\nimport type { 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","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { CmsEntry } from "@webiny/api-headless-cms/types";
1
+ import type { CmsEntry } from "@webiny/api-headless-cms/types";
2
2
  export declare const baseFields: string[];
3
3
  export declare function pickEntryFieldValues<T>(entry: CmsEntry): T;
@@ -1 +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,GAAAC,OAAA,CAAAD,UAAA,GAAG;AACtB;AACA,IAAI,EAEJ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,YAAY,EACZ,SAAS,CACZ;AAED,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","ignoreList":[]}
1
+ {"version":3,"names":["baseFields","exports","pickBaseEntryFieldValues","entry","pickedValues","fieldName","srcFieldName","targetFieldName","split","Object","assign","pickEntryFieldValues","values"],"sources":["pickEntryFieldValues.ts"],"sourcesContent":["import type { 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,GAAAC,OAAA,CAAAD,UAAA,GAAG;AACtB;AACA,IAAI,EAEJ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,WAAW,EACX,YAAY,EACZ,SAAS,CACZ;AAED,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","ignoreList":[]}