@webiny/app-headless-cms 6.6.0-alpha.1 → 6.6.0-alpha.11

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 (360) hide show
  1. package/ContentEntriesModule.js +20 -3
  2. package/ContentEntriesModule.js.map +1 -1
  3. package/admin/RoutesConfig.js +5 -1
  4. package/admin/RoutesConfig.js.map +1 -1
  5. package/admin/components/ContentEntries/BulkActions/ActionDelete.js +2 -1
  6. package/admin/components/ContentEntries/BulkActions/ActionDelete.js.map +1 -1
  7. package/admin/components/ContentEntries/BulkActions/ActionDelete.test.d.ts +1 -0
  8. package/admin/components/ContentEntries/BulkActions/ActionDelete.test.js +125 -0
  9. package/admin/components/ContentEntries/BulkActions/ActionDelete.test.js.map +1 -0
  10. package/admin/components/ContentEntries/Filters/RefFieldRenderer.d.ts +2 -0
  11. package/admin/components/ContentEntries/Filters/RefFieldRenderer.js +85 -0
  12. package/admin/components/ContentEntries/Filters/RefFieldRenderer.js.map +1 -0
  13. package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.d.ts +2 -0
  14. package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.js +34 -0
  15. package/admin/components/ContentEntries/Table/Actions/DuplicateEntry.js.map +1 -0
  16. package/admin/components/ContentEntries/Table/Actions/index.d.ts +1 -0
  17. package/admin/components/ContentEntries/Table/Actions/index.js +1 -0
  18. package/admin/components/ContentEntries/Table/Cells/CellLive.js +9 -2
  19. package/admin/components/ContentEntries/Table/Cells/CellLive.js.map +1 -1
  20. package/admin/components/ContentModelEditor/ContentModelEditor.js +1 -1
  21. package/admin/components/ContentModelEditor/ContentModelEditor.js.map +1 -1
  22. package/admin/components/ContentModelEditor/evaluateExpression.d.ts +1 -1
  23. package/admin/components/ContentModelEditor/evaluateExpression.js +6 -0
  24. package/admin/components/ContentModelEditor/evaluateExpression.js.map +1 -1
  25. package/admin/components/ContentModelEditor/operatorOptions.js +12 -0
  26. package/admin/components/ContentModelEditor/operatorOptions.js.map +1 -1
  27. package/admin/components/Dialogs/DuplicateEntryConfirmDialog.d.ts +2 -0
  28. package/admin/components/Dialogs/DuplicateEntryConfirmDialog.js +22 -0
  29. package/admin/components/Dialogs/DuplicateEntryConfirmDialog.js.map +1 -0
  30. package/admin/components/Dialogs/EditRevisionNoteDialog.d.ts +2 -0
  31. package/admin/components/Dialogs/EditRevisionNoteDialog.js +33 -0
  32. package/admin/components/Dialogs/EditRevisionNoteDialog.js.map +1 -0
  33. package/admin/components/FieldEditor/Field.js +4 -4
  34. package/admin/components/FieldEditor/Field.js.map +1 -1
  35. package/admin/components/ModelFieldProvider/ModelFieldContext.d.ts +1 -0
  36. package/admin/config/contentEntries/editor/ContentEntryEditorConfig.d.ts +1 -1
  37. package/admin/graphql/contentModels.d.ts +2 -2
  38. package/admin/graphql/contentModels.js +1 -0
  39. package/admin/graphql/contentModels.js.map +1 -1
  40. package/admin/hooks/usePermission.js +6 -34
  41. package/admin/hooks/usePermission.js.map +1 -1
  42. package/admin/plugins/editor/defaultBar/Name/Name.d.ts +0 -5
  43. package/admin/plugins/editor/defaultBar/Name/Name.js +0 -2
  44. package/admin/plugins/editor/defaultBar/Name/Name.js.map +1 -1
  45. package/admin/plugins/editor/formSettings/components/GeneralSettings.js +0 -16
  46. package/admin/plugins/editor/formSettings/components/GeneralSettings.js.map +1 -1
  47. package/domain/permissions/checkCmsPermission.d.ts +14 -0
  48. package/domain/permissions/checkCmsPermission.js +20 -0
  49. package/domain/permissions/checkCmsPermission.js.map +1 -0
  50. package/domain/permissions/hasAccessForModel.d.ts +11 -0
  51. package/domain/permissions/hasAccessForModel.js +20 -0
  52. package/domain/permissions/hasAccessForModel.js.map +1 -0
  53. package/domain/permissions/isModelAllowed.d.ts +2 -0
  54. package/domain/permissions/isModelAllowed.js +11 -0
  55. package/domain/permissions/isModelAllowed.js.map +1 -0
  56. package/features/contentEntry/CmsEntryError.d.ts +10 -0
  57. package/features/contentEntry/CmsEntryError.js +11 -0
  58. package/features/contentEntry/CmsEntryError.js.map +1 -0
  59. package/features/contentEntry/bulkAction/BulkActionGateway.js +6 -1
  60. package/features/contentEntry/bulkAction/BulkActionGateway.js.map +1 -1
  61. package/features/contentEntry/bulkAction/BulkActionGateway.test.d.ts +1 -0
  62. package/features/contentEntry/bulkAction/BulkActionGateway.test.js +134 -0
  63. package/features/contentEntry/bulkAction/BulkActionGateway.test.js.map +1 -0
  64. package/features/contentEntry/createEntry/CreateEntryGateway.d.ts +0 -1
  65. package/features/contentEntry/createEntry/CreateEntryGateway.js +3 -10
  66. package/features/contentEntry/createEntry/CreateEntryGateway.js.map +1 -1
  67. package/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.d.ts +3 -1
  68. package/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.js +8 -3
  69. package/features/contentEntry/createRevisionFrom/CreateRevisionFromGateway.js.map +1 -1
  70. package/features/contentEntry/deleteEntry/DeleteEntryGateway.js +6 -1
  71. package/features/contentEntry/deleteEntry/DeleteEntryGateway.js.map +1 -1
  72. package/features/contentEntry/deleteEntry/DeleteEntryGateway.test.d.ts +1 -0
  73. package/features/contentEntry/deleteEntry/DeleteEntryGateway.test.js +116 -0
  74. package/features/contentEntry/deleteEntry/DeleteEntryGateway.test.js.map +1 -0
  75. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.js +6 -1
  76. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.js.map +1 -1
  77. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.test.d.ts +1 -0
  78. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.test.js +112 -0
  79. package/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.test.js.map +1 -0
  80. package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.d.ts +14 -0
  81. package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.js +43 -0
  82. package/features/contentEntry/duplicateEntry/DuplicateEntryGateway.js.map +1 -0
  83. package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.d.ts +15 -0
  84. package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.js +34 -0
  85. package/features/contentEntry/duplicateEntry/DuplicateEntryRepository.js.map +1 -0
  86. package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.d.ts +11 -0
  87. package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.js +18 -0
  88. package/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.js.map +1 -0
  89. package/features/contentEntry/duplicateEntry/abstractions.d.ts +26 -0
  90. package/features/contentEntry/duplicateEntry/abstractions.js +7 -0
  91. package/features/contentEntry/duplicateEntry/abstractions.js.map +1 -0
  92. package/features/contentEntry/duplicateEntry/feature.d.ts +3 -0
  93. package/features/contentEntry/duplicateEntry/feature.js +21 -0
  94. package/features/contentEntry/duplicateEntry/feature.js.map +1 -0
  95. package/features/contentEntry/entryValueGateways.test.d.ts +1 -0
  96. package/features/contentEntry/entryValueGateways.test.js +106 -0
  97. package/features/contentEntry/entryValueGateways.test.js.map +1 -0
  98. package/features/contentEntry/feature.js +4 -2
  99. package/features/contentEntry/feature.js.map +1 -1
  100. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.js +6 -1
  101. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.js.map +1 -1
  102. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.test.d.ts +1 -0
  103. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.test.js +130 -0
  104. package/features/contentEntry/permanentlyDeleteEntry/PermanentlyDeleteEntryGateway.test.js.map +1 -0
  105. package/features/contentEntry/referenceTitles/ReferenceTitles.d.ts +18 -0
  106. package/features/contentEntry/referenceTitles/ReferenceTitles.js +58 -0
  107. package/features/contentEntry/referenceTitles/ReferenceTitles.js.map +1 -0
  108. package/features/contentEntry/referenceTitles/ReferenceTitles.test.d.ts +1 -0
  109. package/features/contentEntry/referenceTitles/ReferenceTitles.test.js +173 -0
  110. package/features/contentEntry/referenceTitles/ReferenceTitles.test.js.map +1 -0
  111. package/features/contentEntry/referenceTitles/RememberTitlesDecorators.d.ts +22 -0
  112. package/features/contentEntry/referenceTitles/RememberTitlesDecorators.js +40 -0
  113. package/features/contentEntry/referenceTitles/RememberTitlesDecorators.js.map +1 -0
  114. package/features/contentEntry/referenceTitles/abstractions.d.ts +16 -0
  115. package/features/contentEntry/referenceTitles/abstractions.js +5 -0
  116. package/features/contentEntry/referenceTitles/abstractions.js.map +1 -0
  117. package/features/contentEntry/referenceTitles/feature.d.ts +3 -0
  118. package/features/contentEntry/referenceTitles/feature.js +20 -0
  119. package/features/contentEntry/referenceTitles/feature.js.map +1 -0
  120. package/features/contentEntry/singletonEntry/UpdateSingletonEntryGateway.d.ts +0 -1
  121. package/features/contentEntry/singletonEntry/UpdateSingletonEntryGateway.js +3 -10
  122. package/features/contentEntry/singletonEntry/UpdateSingletonEntryGateway.js.map +1 -1
  123. package/features/contentEntry/updateEntry/UpdateEntryGateway.d.ts +0 -1
  124. package/features/contentEntry/updateEntry/UpdateEntryGateway.js +3 -10
  125. package/features/contentEntry/updateEntry/UpdateEntryGateway.js.map +1 -1
  126. package/features/contentEntry/valueTransformers/DynamicZoneValueTransformer.js +7 -2
  127. package/features/contentEntry/valueTransformers/DynamicZoneValueTransformer.js.map +1 -1
  128. package/features/contentEntry/valueTransformers/EntryDataPreparer.d.ts +9 -0
  129. package/features/contentEntry/valueTransformers/EntryDataPreparer.js +8 -0
  130. package/features/contentEntry/valueTransformers/EntryDataPreparer.js.map +1 -1
  131. package/features/contentEntry/valueTransformers/EntryDataPreparer.test.d.ts +1 -0
  132. package/features/contentEntry/valueTransformers/EntryDataPreparer.test.js +113 -0
  133. package/features/contentEntry/valueTransformers/EntryDataPreparer.test.js.map +1 -0
  134. package/features/contentEntry/valueTransformers/ObjectValueTransformer.js +16 -2
  135. package/features/contentEntry/valueTransformers/ObjectValueTransformer.js.map +1 -1
  136. package/features/contentEntry/valueTransformers/entryValueFixtures.d.ts +146 -0
  137. package/features/contentEntry/valueTransformers/entryValueFixtures.js +171 -0
  138. package/features/contentEntry/valueTransformers/entryValueFixtures.js.map +1 -0
  139. package/features/formModel/CmsFormModelBuilder.d.ts +9 -1
  140. package/features/formModel/CmsFormModelBuilder.js +26 -15
  141. package/features/formModel/CmsFormModelBuilder.js.map +1 -1
  142. package/features/formModel/CmsFormModelBuilder.test.d.ts +1 -0
  143. package/features/formModel/CmsFormModelBuilder.test.js +465 -0
  144. package/features/formModel/CmsFormModelBuilder.test.js.map +1 -0
  145. package/features/formModel/CmsLayoutMapper.d.ts +8 -1
  146. package/features/formModel/CmsLayoutMapper.js +27 -5
  147. package/features/formModel/CmsLayoutMapper.js.map +1 -1
  148. package/features/formModel/CmsRefFieldValueFormatter.d.ts +12 -0
  149. package/features/formModel/CmsRefFieldValueFormatter.js +29 -0
  150. package/features/formModel/CmsRefFieldValueFormatter.js.map +1 -0
  151. package/features/formModel/CmsValidationMapper.d.ts +9 -0
  152. package/features/formModel/CmsValidationMapper.js +25 -19
  153. package/features/formModel/CmsValidationMapper.js.map +1 -1
  154. package/features/formModel/feature.js +2 -2
  155. package/features/formModel/feature.js.map +1 -1
  156. package/features/formModel/mappers/DateTimeFieldMapper.js +3 -0
  157. package/features/formModel/mappers/DateTimeFieldMapper.js.map +1 -1
  158. package/features/formModel/mappers/DynamicZoneFieldMapper.js +8 -2
  159. package/features/formModel/mappers/DynamicZoneFieldMapper.js.map +1 -1
  160. package/features/formModel/mappers/ObjectFieldMapper.js +12 -5
  161. package/features/formModel/mappers/ObjectFieldMapper.js.map +1 -1
  162. package/features/formModel/mappers/applyFieldProps.js +2 -1
  163. package/features/formModel/mappers/applyFieldProps.js.map +1 -1
  164. package/features/formModel/mappers/applyFieldProps.test.d.ts +1 -0
  165. package/features/formModel/mappers/applyFieldProps.test.js +59 -0
  166. package/features/formModel/mappers/applyFieldProps.test.js.map +1 -0
  167. package/features/model/deleteModel/DeleteModelGateway.js +6 -1
  168. package/features/model/deleteModel/DeleteModelGateway.js.map +1 -1
  169. package/features/model/deleteModel/DeleteModelGateway.test.d.ts +1 -0
  170. package/features/model/deleteModel/DeleteModelGateway.test.js +71 -0
  171. package/features/model/deleteModel/DeleteModelGateway.test.js.map +1 -0
  172. package/features/model/exportModels/ExportModelsGateway.d.ts +1 -1
  173. package/features/model/exportModels/ExportModelsGateway.js.map +1 -1
  174. package/features/model/exportModels/ExportModelsUseCase.js +7 -1
  175. package/features/model/exportModels/ExportModelsUseCase.js.map +1 -1
  176. package/features/model/exportModels/abstractions.d.ts +8 -2
  177. package/features/model/exportModels/abstractions.js.map +1 -1
  178. package/package.json +30 -28
  179. package/presentation/cloneContentModel/CloneContentModelPresenter.d.ts +1 -0
  180. package/presentation/cloneContentModel/CloneContentModelPresenter.js +8 -6
  181. package/presentation/cloneContentModel/CloneContentModelPresenter.js.map +1 -1
  182. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.d.ts +1 -1
  183. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.js +6 -1
  184. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.js.map +1 -1
  185. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.test.d.ts +1 -0
  186. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.test.js +124 -0
  187. package/presentation/contentEntries/bulkActions/BulkDeletePresenter.test.js.map +1 -0
  188. package/presentation/contentEntries/bulkActions/abstractions.d.ts +1 -1
  189. package/presentation/contentEntries/bulkActions/abstractions.js.map +1 -1
  190. package/presentation/contentEntries/form/ContentEntryFormPresenter.d.ts +2 -0
  191. package/presentation/contentEntries/form/ContentEntryFormPresenter.deleteEntry.test.d.ts +1 -0
  192. package/presentation/contentEntries/form/ContentEntryFormPresenter.deleteEntry.test.js +107 -0
  193. package/presentation/contentEntries/form/ContentEntryFormPresenter.deleteEntry.test.js.map +1 -0
  194. package/presentation/contentEntries/form/ContentEntryFormPresenter.js +47 -30
  195. package/presentation/contentEntries/form/ContentEntryFormPresenter.js.map +1 -1
  196. package/presentation/contentEntries/form/ContentEntryFormPresenter.test.d.ts +1 -0
  197. package/presentation/contentEntries/form/ContentEntryFormPresenter.test.js +244 -0
  198. package/presentation/contentEntries/form/ContentEntryFormPresenter.test.js.map +1 -0
  199. package/presentation/contentEntries/form/abstractions.d.ts +1 -0
  200. package/presentation/contentEntries/form/abstractions.js.map +1 -1
  201. package/presentation/contentEntries/form/getFieldBuilders.test.js +4 -2
  202. package/presentation/contentEntries/form/getFieldBuilders.test.js.map +1 -1
  203. package/presentation/contentEntries/form/toFormErrors.d.ts +7 -0
  204. package/presentation/contentEntries/form/toFormErrors.js +49 -0
  205. package/presentation/contentEntries/form/toFormErrors.js.map +1 -0
  206. package/presentation/contentEntries/form/toFormErrors.test.d.ts +1 -0
  207. package/presentation/contentEntries/form/toFormErrors.test.js +175 -0
  208. package/presentation/contentEntries/form/toFormErrors.test.js.map +1 -0
  209. package/presentation/contentEntries/list/ContentEntriesDataSource.d.ts +5 -0
  210. package/presentation/contentEntries/list/ContentEntriesDataSource.js +16 -4
  211. package/presentation/contentEntries/list/ContentEntriesDataSource.js.map +1 -1
  212. package/presentation/contentEntries/list/ContentEntriesPresenter.d.ts +6 -2
  213. package/presentation/contentEntries/list/ContentEntriesPresenter.js +27 -2
  214. package/presentation/contentEntries/list/ContentEntriesPresenter.js.map +1 -1
  215. package/presentation/contentEntries/list/ContentEntriesPresenter.test.js +130 -5
  216. package/presentation/contentEntries/list/ContentEntriesPresenter.test.js.map +1 -1
  217. package/presentation/contentEntries/list/abstractions.d.ts +12 -0
  218. package/presentation/contentEntries/list/abstractions.js.map +1 -1
  219. package/presentation/contentEntries/preview/ComponentDiscoveryIframe.d.ts +3 -2
  220. package/presentation/contentEntries/preview/ComponentDiscoveryIframe.js +2 -2
  221. package/presentation/contentEntries/preview/ComponentDiscoveryIframe.js.map +1 -1
  222. package/presentation/contentEntries/preview/LivePreviewPresenter.d.ts +12 -1
  223. package/presentation/contentEntries/preview/LivePreviewPresenter.js +48 -5
  224. package/presentation/contentEntries/preview/LivePreviewPresenter.js.map +1 -1
  225. package/presentation/contentEntries/preview/LivePreviewPresenter.test.d.ts +1 -0
  226. package/presentation/contentEntries/preview/LivePreviewPresenter.test.js +81 -0
  227. package/presentation/contentEntries/preview/LivePreviewPresenter.test.js.map +1 -0
  228. package/presentation/contentEntries/preview/ModelEditorComponentDiscovery.js +8 -5
  229. package/presentation/contentEntries/preview/ModelEditorComponentDiscovery.js.map +1 -1
  230. package/presentation/contentEntries/preview/PreviewDecorator.js +30 -10
  231. package/presentation/contentEntries/preview/PreviewDecorator.js.map +1 -1
  232. package/presentation/contentEntries/preview/PreviewDomainStatus.d.ts +10 -0
  233. package/presentation/contentEntries/preview/PreviewDomainStatus.js +19 -0
  234. package/presentation/contentEntries/preview/PreviewDomainStatus.js.map +1 -0
  235. package/presentation/contentEntries/preview/PreviewPane.d.ts +12 -3
  236. package/presentation/contentEntries/preview/PreviewPane.js +82 -46
  237. package/presentation/contentEntries/preview/PreviewPane.js.map +1 -1
  238. package/presentation/contentEntries/preview/abstractions.d.ts +8 -0
  239. package/presentation/contentEntries/preview/abstractions.js.map +1 -1
  240. package/presentation/contentEntries/preview/resolvePreviewUrl.d.ts +23 -2
  241. package/presentation/contentEntries/preview/resolvePreviewUrl.js +62 -10
  242. package/presentation/contentEntries/preview/resolvePreviewUrl.js.map +1 -1
  243. package/presentation/contentEntries/preview/resolvePreviewUrl.test.d.ts +1 -0
  244. package/presentation/contentEntries/preview/resolvePreviewUrl.test.js +127 -0
  245. package/presentation/contentEntries/preview/resolvePreviewUrl.test.js.map +1 -0
  246. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.d.ts +21 -2
  247. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.js +143 -6
  248. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.js.map +1 -1
  249. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.test.d.ts +1 -0
  250. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.test.js +384 -0
  251. package/presentation/contentEntries/revisionsList/RevisionsListPresenter.test.js.map +1 -0
  252. package/presentation/contentEntries/revisionsList/abstractions.d.ts +16 -0
  253. package/presentation/contentEntries/revisionsList/abstractions.js.map +1 -1
  254. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.js +9 -4
  255. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.js.map +1 -1
  256. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.test.d.ts +1 -0
  257. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.test.js +122 -0
  258. package/presentation/contentEntries/singleEntry/SingleEntryPresenter.test.js.map +1 -0
  259. package/presentation/contentEntries/views/ContentEntriesListLayout.js +1 -0
  260. package/presentation/contentEntries/views/ContentEntriesListLayout.js.map +1 -1
  261. package/presentation/contentEntries/views/ContentEntriesView.js +2 -0
  262. package/presentation/contentEntries/views/ContentEntriesView.js.map +1 -1
  263. package/presentation/contentEntries/views/ContentEntryFormView.js +4 -1
  264. package/presentation/contentEntries/views/ContentEntryFormView.js.map +1 -1
  265. package/presentation/contentEntries/views/OlderRevisionAlert.d.ts +4 -0
  266. package/presentation/contentEntries/views/OlderRevisionAlert.js +43 -0
  267. package/presentation/contentEntries/views/OlderRevisionAlert.js.map +1 -0
  268. package/presentation/contentEntries/views/RevisionDrawer.js +4 -0
  269. package/presentation/contentEntries/views/RevisionDrawer.js.map +1 -1
  270. package/presentation/contentEntries/views/RevisionListItem.d.ts +3 -3
  271. package/presentation/contentEntries/views/RevisionListItem.js +82 -14
  272. package/presentation/contentEntries/views/RevisionListItem.js.map +1 -1
  273. package/presentation/contentEntries/views/RevisionsList.js +3 -3
  274. package/presentation/contentEntries/views/RevisionsList.js.map +1 -1
  275. package/presentation/contentEntries/views/actions/CreateNewRevisionButton.js +11 -0
  276. package/presentation/contentEntries/views/actions/CreateNewRevisionButton.js.map +1 -1
  277. package/presentation/contentModels/ContentModelsPresenter.d.ts +5 -5
  278. package/presentation/contentModels/ContentModelsPresenter.js +1 -1
  279. package/presentation/contentModels/ContentModelsPresenter.js.map +1 -1
  280. package/presentation/contentModels/abstractions.d.ts +7 -2
  281. package/presentation/contentModels/abstractions.js.map +1 -1
  282. package/presentation/contentModels/components/ContentModelsDataList.js +6 -5
  283. package/presentation/contentModels/components/ContentModelsDataList.js.map +1 -1
  284. package/presentation/contentModels/components/fullDelete/FullyDeleteModelDialog.js +8 -3
  285. package/presentation/contentModels/components/fullDelete/FullyDeleteModelDialog.js.map +1 -1
  286. package/presentation/contentModels/components/fullDelete/dialog/Content.js +7 -2
  287. package/presentation/contentModels/components/fullDelete/dialog/Content.js.map +1 -1
  288. package/presentation/contentModels/components/fullDelete/dialog/Content.test.d.ts +1 -0
  289. package/presentation/contentModels/components/fullDelete/dialog/Content.test.js +54 -0
  290. package/presentation/contentModels/components/fullDelete/dialog/Content.test.js.map +1 -0
  291. package/presentation/contentModels/components/fullDelete/dialog/FullyDeleteModelError.d.ts +25 -0
  292. package/presentation/contentModels/components/fullDelete/dialog/FullyDeleteModelError.js +9 -0
  293. package/presentation/contentModels/components/fullDelete/dialog/FullyDeleteModelError.js.map +1 -0
  294. package/presentation/fieldEditor/groups/AppearanceGroup.js +12 -0
  295. package/presentation/fieldEditor/groups/AppearanceGroup.js.map +1 -1
  296. package/presentation/fieldEditor/groups/GeneralGroup.d.ts +5 -5
  297. package/presentation/fieldEditor/groups/GeneralGroup.js +5 -1
  298. package/presentation/fieldEditor/groups/GeneralGroup.js.map +1 -1
  299. package/presentation/fieldEditor/groups/GeneralGroup.test.d.ts +1 -0
  300. package/presentation/fieldEditor/groups/GeneralGroup.test.js +68 -0
  301. package/presentation/fieldEditor/groups/GeneralGroup.test.js.map +1 -0
  302. package/presentation/fieldEditor/groups/ValidationsGroup.d.ts +2 -0
  303. package/presentation/fieldEditor/groups/ValidationsGroup.js +20 -6
  304. package/presentation/fieldEditor/groups/ValidationsGroup.js.map +1 -1
  305. package/presentation/fieldEditor/renderers/CmsValidatorsRenderer.js +2 -2
  306. package/presentation/fieldEditor/renderers/CmsValidatorsRenderer.js.map +1 -1
  307. package/presentation/fieldRenderers/feature.js +2 -1
  308. package/presentation/fieldRenderers/feature.js.map +1 -1
  309. package/presentation/fieldRenderers/ref/CmsRefInputRenderer.js +1 -0
  310. package/presentation/fieldRenderers/ref/CmsRefInputRenderer.js.map +1 -1
  311. package/presentation/fieldRenderers/ref/CmsRefInputsRenderer.js +1 -0
  312. package/presentation/fieldRenderers/ref/CmsRefInputsRenderer.js.map +1 -1
  313. package/presentation/fieldRenderers/ref/autocomplete/BaseAutocompletePresenter.d.ts +1 -0
  314. package/presentation/fieldRenderers/ref/autocomplete/BaseAutocompletePresenter.js +8 -2
  315. package/presentation/fieldRenderers/ref/autocomplete/BaseAutocompletePresenter.js.map +1 -1
  316. package/presentation/fieldRenderers/ref/autocomplete/RefAutocompletePresenters.test.d.ts +1 -0
  317. package/presentation/fieldRenderers/ref/autocomplete/RefAutocompletePresenters.test.js +185 -0
  318. package/presentation/fieldRenderers/ref/autocomplete/RefAutocompletePresenters.test.js.map +1 -0
  319. package/presentation/fieldRenderers/ref/autocomplete/multi/RefMultiAutocompletePresenter.js +1 -1
  320. package/presentation/fieldRenderers/ref/autocomplete/multi/RefMultiAutocompletePresenter.js.map +1 -1
  321. package/presentation/fieldRenderers/ref/autocomplete/single/RefSingleAutocompletePresenter.js +1 -1
  322. package/presentation/fieldRenderers/ref/autocomplete/single/RefSingleAutocompletePresenter.js.map +1 -1
  323. package/presentation/fieldRenderers/ref/components/RefFieldOptions.js +3 -2
  324. package/presentation/fieldRenderers/ref/components/RefFieldOptions.js.map +1 -1
  325. package/presentation/fieldTypes/renderers/dateTime/BirthdayInputRenderer.d.ts +15 -0
  326. package/presentation/fieldTypes/renderers/dateTime/BirthdayInputRenderer.js +19 -0
  327. package/presentation/fieldTypes/renderers/dateTime/BirthdayInputRenderer.js.map +1 -0
  328. package/presentation/fieldTypes/renderers/index.d.ts +1 -0
  329. package/presentation/fieldTypes/renderers/index.js +1 -0
  330. package/presentation/fieldValidators/abstractions.d.ts +7 -0
  331. package/presentation/fieldValidators/abstractions.js.map +1 -1
  332. package/presentation/fieldValidators/validators/DateGteValidator.d.ts +6 -0
  333. package/presentation/fieldValidators/validators/DateGteValidator.js +17 -25
  334. package/presentation/fieldValidators/validators/DateGteValidator.js.map +1 -1
  335. package/presentation/fieldValidators/validators/DateLteValidator.d.ts +6 -0
  336. package/presentation/fieldValidators/validators/DateLteValidator.js +17 -25
  337. package/presentation/fieldValidators/validators/DateLteValidator.js.map +1 -1
  338. package/presentation/fieldValidators/validators/dateLimitSettings.d.ts +20 -0
  339. package/presentation/fieldValidators/validators/dateLimitSettings.js +124 -0
  340. package/presentation/fieldValidators/validators/dateLimitSettings.js.map +1 -0
  341. package/presentation/fieldValidators/validators/dateLimitSettings.test.d.ts +1 -0
  342. package/presentation/fieldValidators/validators/dateLimitSettings.test.js +111 -0
  343. package/presentation/fieldValidators/validators/dateLimitSettings.test.js.map +1 -0
  344. package/presentation/importContentModels/ImportContentModelsPresenter.js +1 -1
  345. package/presentation/importContentModels/ImportContentModelsPresenter.js.map +1 -1
  346. package/presentation/importContentModels/components/Model/DataListModelItem.js +3 -3
  347. package/presentation/importContentModels/components/Model/DataListModelItem.js.map +1 -1
  348. package/presentation/importContentModels/components/Model/DataListModelItemInfo.js +2 -2
  349. package/presentation/importContentModels/components/Model/DataListModelItemInfo.js.map +1 -1
  350. package/presentation/modelGroup/ModelGroupPresenter.js +1 -2
  351. package/presentation/modelGroup/ModelGroupPresenter.js.map +1 -1
  352. package/presentation/newContentModel/NewContentModelPresenter.d.ts +1 -0
  353. package/presentation/newContentModel/NewContentModelPresenter.js +8 -6
  354. package/presentation/newContentModel/NewContentModelPresenter.js.map +1 -1
  355. package/utils/normalizeIcon.d.ts +4 -0
  356. package/utils/normalizeIcon.js +9 -6
  357. package/utils/normalizeIcon.js.map +1 -1
  358. package/features/formModel/CmsAccessControlRuleEvaluator.d.ts +0 -9
  359. package/features/formModel/CmsAccessControlRuleEvaluator.js +0 -16
  360. package/features/formModel/CmsAccessControlRuleEvaluator.js.map +0 -1
@@ -0,0 +1,116 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { Container } from "@webiny/di";
3
+ import { GraphQLOperationError } from "@webiny/app/errors/index.js";
4
+ import { CmsGraphQLClient } from "../../graphQLClient/abstractions.js";
5
+ import { DeleteEntryGateway } from "./abstractions.js";
6
+ import { DeleteEntryGateway as external_DeleteEntryGateway_js_DeleteEntryGateway } from "./DeleteEntryGateway.js";
7
+ const model = {
8
+ modelId: "article",
9
+ singularApiName: "Article"
10
+ };
11
+ const blockedData = {
12
+ model: "cms.article",
13
+ action: "trash",
14
+ reviews: [
15
+ {
16
+ reviewId: "review-1",
17
+ model: "cms.article",
18
+ targetId: "entry-1",
19
+ targetRevisionId: "entry-1#0001",
20
+ title: "Launch article",
21
+ stepPosition: 2,
22
+ stepCount: 3,
23
+ stepName: "Legal"
24
+ }
25
+ ]
26
+ };
27
+ function setup() {
28
+ const client = {
29
+ execute: vi.fn()
30
+ };
31
+ const container = new Container();
32
+ container.registerInstance(CmsGraphQLClient, client);
33
+ container.register(external_DeleteEntryGateway_js_DeleteEntryGateway).inSingletonScope();
34
+ const gateway = container.resolve(DeleteEntryGateway);
35
+ return {
36
+ client,
37
+ gateway
38
+ };
39
+ }
40
+ describe("DeleteEntryGateway", ()=>{
41
+ it("returns true and sends the entry id as the trash revision", async ()=>{
42
+ const { client, gateway } = setup();
43
+ client.execute.mockResolvedValue({
44
+ content: {
45
+ data: true,
46
+ error: null
47
+ }
48
+ });
49
+ const result = await gateway.execute({
50
+ model: model,
51
+ id: "entry-1#0001"
52
+ });
53
+ expect(result).toBe(true);
54
+ expect(client.execute).toHaveBeenCalledTimes(1);
55
+ const request = client.execute.mock.calls[0][0];
56
+ expect(request.variables).toEqual({
57
+ revision: "entry-1#0001",
58
+ permanently: false
59
+ });
60
+ expect(request.query).toContain("error { message code data }");
61
+ });
62
+ it("throws a GraphQLOperationError carrying the code, data and message of the envelope error", async ()=>{
63
+ const { client, gateway } = setup();
64
+ client.execute.mockResolvedValue({
65
+ content: {
66
+ data: null,
67
+ error: {
68
+ message: "This content has a review in progress. Trashing it cancels the review.",
69
+ code: "Workflows/Review/ActiveReviewOnTrash",
70
+ data: blockedData
71
+ }
72
+ }
73
+ });
74
+ const error = await gateway.execute({
75
+ model: model,
76
+ id: "entry-1#0001"
77
+ }).catch((e)=>e);
78
+ expect(error).toBeInstanceOf(GraphQLOperationError);
79
+ expect(error.message).toBe("This content has a review in progress. Trashing it cancels the review.");
80
+ expect(error.code).toBe("Workflows/Review/ActiveReviewOnTrash");
81
+ expect(error.data).toEqual(blockedData);
82
+ });
83
+ it("falls back to the existing message when the server sends none", async ()=>{
84
+ const { client, gateway } = setup();
85
+ client.execute.mockResolvedValue({
86
+ content: {
87
+ data: null,
88
+ error: {
89
+ message: "",
90
+ code: "Some/Code",
91
+ data: null
92
+ }
93
+ }
94
+ });
95
+ const error = await gateway.execute({
96
+ model: model,
97
+ id: "entry-1#0001"
98
+ }).catch((e)=>e);
99
+ expect(error).toBeInstanceOf(GraphQLOperationError);
100
+ expect(error.message).toBe("Could not delete entry");
101
+ expect(error.code).toBe("Some/Code");
102
+ expect(error.data).toBeNull();
103
+ });
104
+ it("lets a transport failure pass through unchanged", async ()=>{
105
+ const { client, gateway } = setup();
106
+ client.execute.mockRejectedValue(new Error("Network down"));
107
+ const error = await gateway.execute({
108
+ model: model,
109
+ id: "entry-1#0001"
110
+ }).catch((e)=>e);
111
+ expect(error).not.toBeInstanceOf(GraphQLOperationError);
112
+ expect(error.message).toBe("Network down");
113
+ });
114
+ });
115
+
116
+ //# sourceMappingURL=DeleteEntryGateway.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/contentEntry/deleteEntry/DeleteEntryGateway.test.js","sources":["../../../../src/features/contentEntry/deleteEntry/DeleteEntryGateway.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { vi } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport { GraphQLOperationError } from \"@webiny/app/errors/index.js\";\nimport { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsModel } from \"~/types.js\";\nimport { DeleteEntryGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport { DeleteEntryGateway } from \"./DeleteEntryGateway.js\";\n\nconst model = { modelId: \"article\", singularApiName: \"Article\" } as CmsModel;\n\nconst blockedData = {\n model: \"cms.article\",\n action: \"trash\",\n reviews: [\n {\n reviewId: \"review-1\",\n model: \"cms.article\",\n targetId: \"entry-1\",\n targetRevisionId: \"entry-1#0001\",\n title: \"Launch article\",\n stepPosition: 2,\n stepCount: 3,\n stepName: \"Legal\"\n }\n ]\n};\n\nfunction setup() {\n const client = { execute: vi.fn() };\n const container = new Container();\n container.registerInstance(CmsGraphQLClient, client);\n container.register(DeleteEntryGateway).inSingletonScope();\n const gateway = container.resolve(GatewayAbstraction);\n return { client, gateway };\n}\n\ndescribe(\"DeleteEntryGateway\", () => {\n it(\"returns true and sends the entry id as the trash revision\", async () => {\n const { client, gateway } = setup();\n client.execute.mockResolvedValue({ content: { data: true, error: null } });\n\n const result = await gateway.execute({ model, id: \"entry-1#0001\" });\n\n expect(result).toBe(true);\n expect(client.execute).toHaveBeenCalledTimes(1);\n const request = client.execute.mock.calls[0][0];\n expect(request.variables).toEqual({ revision: \"entry-1#0001\", permanently: false });\n expect(request.query).toContain(\"error { message code data }\");\n });\n\n it(\"throws a GraphQLOperationError carrying the code, data and message of the envelope error\", async () => {\n const { client, gateway } = setup();\n client.execute.mockResolvedValue({\n content: {\n data: null,\n error: {\n message:\n \"This content has a review in progress. Trashing it cancels the review.\",\n code: \"Workflows/Review/ActiveReviewOnTrash\",\n data: blockedData\n }\n }\n });\n\n const error = await gateway.execute({ model, id: \"entry-1#0001\" }).catch(e => e);\n\n expect(error).toBeInstanceOf(GraphQLOperationError);\n expect(error.message).toBe(\n \"This content has a review in progress. Trashing it cancels the review.\"\n );\n expect(error.code).toBe(\"Workflows/Review/ActiveReviewOnTrash\");\n expect(error.data).toEqual(blockedData);\n });\n\n it(\"falls back to the existing message when the server sends none\", async () => {\n const { client, gateway } = setup();\n client.execute.mockResolvedValue({\n content: { data: null, error: { message: \"\", code: \"Some/Code\", data: null } }\n });\n\n const error = await gateway.execute({ model, id: \"entry-1#0001\" }).catch(e => e);\n\n expect(error).toBeInstanceOf(GraphQLOperationError);\n expect(error.message).toBe(\"Could not delete entry\");\n expect(error.code).toBe(\"Some/Code\");\n expect(error.data).toBeNull();\n });\n\n it(\"lets a transport failure pass through unchanged\", async () => {\n const { client, gateway } = setup();\n client.execute.mockRejectedValue(new Error(\"Network down\"));\n\n const error = await gateway.execute({ model, id: \"entry-1#0001\" }).catch(e => e);\n\n expect(error).not.toBeInstanceOf(GraphQLOperationError);\n expect(error.message).toBe(\"Network down\");\n });\n});\n"],"names":["model","blockedData","setup","client","vi","container","Container","CmsGraphQLClient","DeleteEntryGateway","gateway","GatewayAbstraction","describe","it","result","expect","request","error","e","GraphQLOperationError","Error"],"mappings":";;;;;;AAWA,MAAMA,QAAQ;IAAE,SAAS;IAAW,iBAAiB;AAAU;AAE/D,MAAMC,cAAc;IAChB,OAAO;IACP,QAAQ;IACR,SAAS;QACL;YACI,UAAU;YACV,OAAO;YACP,UAAU;YACV,kBAAkB;YAClB,OAAO;YACP,cAAc;YACd,WAAW;YACX,UAAU;QACd;KACH;AACL;AAEA,SAASC;IACL,MAAMC,SAAS;QAAE,SAASC,GAAG,EAAE;IAAG;IAClC,MAAMC,YAAY,IAAIC;IACtBD,UAAU,gBAAgB,CAACE,kBAAkBJ;IAC7CE,UAAU,QAAQ,CAACG,mDAAoB,gBAAgB;IACvD,MAAMC,UAAUJ,UAAU,OAAO,CAACK;IAClC,OAAO;QAAEP;QAAQM;IAAQ;AAC7B;AAEAE,SAAS,sBAAsB;IAC3BC,GAAG,6DAA6D;QAC5D,MAAM,EAAET,MAAM,EAAEM,OAAO,EAAE,GAAGP;QAC5BC,OAAO,OAAO,CAAC,iBAAiB,CAAC;YAAE,SAAS;gBAAE,MAAM;gBAAM,OAAO;YAAK;QAAE;QAExE,MAAMU,SAAS,MAAMJ,QAAQ,OAAO,CAAC;YAAET,OAAAA;YAAO,IAAI;QAAe;QAEjEc,OAAOD,QAAQ,IAAI,CAAC;QACpBC,OAAOX,OAAO,OAAO,EAAE,qBAAqB,CAAC;QAC7C,MAAMY,UAAUZ,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;QAC/CW,OAAOC,QAAQ,SAAS,EAAE,OAAO,CAAC;YAAE,UAAU;YAAgB,aAAa;QAAM;QACjFD,OAAOC,QAAQ,KAAK,EAAE,SAAS,CAAC;IACpC;IAEAH,GAAG,4FAA4F;QAC3F,MAAM,EAAET,MAAM,EAAEM,OAAO,EAAE,GAAGP;QAC5BC,OAAO,OAAO,CAAC,iBAAiB,CAAC;YAC7B,SAAS;gBACL,MAAM;gBACN,OAAO;oBACH,SACI;oBACJ,MAAM;oBACN,MAAMF;gBACV;YACJ;QACJ;QAEA,MAAMe,QAAQ,MAAMP,QAAQ,OAAO,CAAC;YAAET,OAAAA;YAAO,IAAI;QAAe,GAAG,KAAK,CAACiB,CAAAA,IAAKA;QAE9EH,OAAOE,OAAO,cAAc,CAACE;QAC7BJ,OAAOE,MAAM,OAAO,EAAE,IAAI,CACtB;QAEJF,OAAOE,MAAM,IAAI,EAAE,IAAI,CAAC;QACxBF,OAAOE,MAAM,IAAI,EAAE,OAAO,CAACf;IAC/B;IAEAW,GAAG,iEAAiE;QAChE,MAAM,EAAET,MAAM,EAAEM,OAAO,EAAE,GAAGP;QAC5BC,OAAO,OAAO,CAAC,iBAAiB,CAAC;YAC7B,SAAS;gBAAE,MAAM;gBAAM,OAAO;oBAAE,SAAS;oBAAI,MAAM;oBAAa,MAAM;gBAAK;YAAE;QACjF;QAEA,MAAMa,QAAQ,MAAMP,QAAQ,OAAO,CAAC;YAAET,OAAAA;YAAO,IAAI;QAAe,GAAG,KAAK,CAACiB,CAAAA,IAAKA;QAE9EH,OAAOE,OAAO,cAAc,CAACE;QAC7BJ,OAAOE,MAAM,OAAO,EAAE,IAAI,CAAC;QAC3BF,OAAOE,MAAM,IAAI,EAAE,IAAI,CAAC;QACxBF,OAAOE,MAAM,IAAI,EAAE,QAAQ;IAC/B;IAEAJ,GAAG,mDAAmD;QAClD,MAAM,EAAET,MAAM,EAAEM,OAAO,EAAE,GAAGP;QAC5BC,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAIgB,MAAM;QAE3C,MAAMH,QAAQ,MAAMP,QAAQ,OAAO,CAAC;YAAET,OAAAA;YAAO,IAAI;QAAe,GAAG,KAAK,CAACiB,CAAAA,IAAKA;QAE9EH,OAAOE,OAAO,GAAG,CAAC,cAAc,CAACE;QACjCJ,OAAOE,MAAM,OAAO,EAAE,IAAI,CAAC;IAC/B;AACJ"}
@@ -1,3 +1,4 @@
1
+ import { GraphQLOperationError } from "@webiny/app/errors/index.js";
1
2
  import { CmsGraphQLClient } from "../../graphQLClient/abstractions.js";
2
3
  import { DeleteEntryRevisionGateway } from "./abstractions.js";
3
4
  function createMutation(model) {
@@ -22,7 +23,11 @@ class DeleteEntryRevisionGatewayImpl {
22
23
  }
23
24
  });
24
25
  const { error } = response.content;
25
- if (error) throw new Error(error.message || "Could not delete entry revision");
26
+ if (error) throw new GraphQLOperationError({
27
+ message: error.message || "Could not delete entry revision",
28
+ code: error.code,
29
+ data: error.data
30
+ });
26
31
  return true;
27
32
  }
28
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.js","sources":["../../../../src/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.ts"],"sourcesContent":["import { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsErrorResponse, CmsModel } from \"~/types.js\";\nimport {\n DeleteEntryRevisionGateway as GatewayAbstraction,\n type IDeleteEntryRevisionParams\n} from \"./abstractions.js\";\n\ninterface DeleteEntryRevisionResponse {\n content: {\n data: boolean | null;\n error: CmsErrorResponse | null;\n };\n}\n\nfunction createMutation(model: CmsModel) {\n return /* GraphQL */ `\n mutation CmsEntriesDelete${model.singularApiName}($revision: ID!) {\n content: delete${model.singularApiName}(revision: $revision) {\n data\n error { message code data }\n }\n }\n `;\n}\n\nclass DeleteEntryRevisionGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: CmsGraphQLClient.Interface) {}\n\n async execute({ model, revisionId }: IDeleteEntryRevisionParams) {\n const response = await this.client.execute<DeleteEntryRevisionResponse>({\n query: createMutation(model),\n variables: { revision: revisionId }\n });\n\n const { error } = response.content;\n\n if (error) {\n throw new Error(error.message || \"Could not delete entry revision\");\n }\n\n return true;\n }\n}\n\nexport const DeleteEntryRevisionGateway = GatewayAbstraction.createImplementation({\n implementation: DeleteEntryRevisionGatewayImpl,\n dependencies: [CmsGraphQLClient]\n});\n"],"names":["createMutation","model","DeleteEntryRevisionGatewayImpl","client","revisionId","response","error","Error","DeleteEntryRevisionGateway","GatewayAbstraction","CmsGraphQLClient"],"mappings":";;AAcA,SAASA,eAAeC,KAAe;IACnC,OAAqB,CAAC;iCACO,EAAEA,MAAM,eAAe,CAAC;2BAC9B,EAAEA,MAAM,eAAe,CAAC;;;;;IAK/C,CAAC;AACL;AAEA,MAAMC;IACF,YAAoBC,MAAkC,CAAE;aAApCA,MAAM,GAANA;IAAqC;IAEzD,MAAM,QAAQ,EAAEF,KAAK,EAAEG,UAAU,EAA8B,EAAE;QAC7D,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8B;YACpE,OAAOL,eAAeC;YACtB,WAAW;gBAAE,UAAUG;YAAW;QACtC;QAEA,MAAM,EAAEE,KAAK,EAAE,GAAGD,SAAS,OAAO;QAElC,IAAIC,OACA,MAAM,IAAIC,MAAMD,MAAM,OAAO,IAAI;QAGrC,OAAO;IACX;AACJ;AAEO,MAAME,wDAA6BC,2BAAAA,oBAAuC,CAAC;IAC9E,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
1
+ {"version":3,"file":"features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.js","sources":["../../../../src/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.ts"],"sourcesContent":["import { GraphQLOperationError } from \"@webiny/app/errors/index.js\";\nimport { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsErrorResponse, CmsModel } from \"~/types.js\";\nimport {\n DeleteEntryRevisionGateway as GatewayAbstraction,\n type IDeleteEntryRevisionParams\n} from \"./abstractions.js\";\n\ninterface DeleteEntryRevisionResponse {\n content: {\n data: boolean | null;\n error: CmsErrorResponse | null;\n };\n}\n\nfunction createMutation(model: CmsModel) {\n return /* GraphQL */ `\n mutation CmsEntriesDelete${model.singularApiName}($revision: ID!) {\n content: delete${model.singularApiName}(revision: $revision) {\n data\n error { message code data }\n }\n }\n `;\n}\n\nclass DeleteEntryRevisionGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: CmsGraphQLClient.Interface) {}\n\n async execute({ model, revisionId }: IDeleteEntryRevisionParams) {\n const response = await this.client.execute<DeleteEntryRevisionResponse>({\n query: createMutation(model),\n variables: { revision: revisionId }\n });\n\n const { error } = response.content;\n\n if (error) {\n throw new GraphQLOperationError({\n message: error.message || \"Could not delete entry revision\",\n code: error.code,\n data: error.data\n });\n }\n\n return true;\n }\n}\n\nexport const DeleteEntryRevisionGateway = GatewayAbstraction.createImplementation({\n implementation: DeleteEntryRevisionGatewayImpl,\n dependencies: [CmsGraphQLClient]\n});\n"],"names":["createMutation","model","DeleteEntryRevisionGatewayImpl","client","revisionId","response","error","GraphQLOperationError","DeleteEntryRevisionGateway","GatewayAbstraction","CmsGraphQLClient"],"mappings":";;;AAeA,SAASA,eAAeC,KAAe;IACnC,OAAqB,CAAC;iCACO,EAAEA,MAAM,eAAe,CAAC;2BAC9B,EAAEA,MAAM,eAAe,CAAC;;;;;IAK/C,CAAC;AACL;AAEA,MAAMC;IACF,YAAoBC,MAAkC,CAAE;aAApCA,MAAM,GAANA;IAAqC;IAEzD,MAAM,QAAQ,EAAEF,KAAK,EAAEG,UAAU,EAA8B,EAAE;QAC7D,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8B;YACpE,OAAOL,eAAeC;YACtB,WAAW;gBAAE,UAAUG;YAAW;QACtC;QAEA,MAAM,EAAEE,KAAK,EAAE,GAAGD,SAAS,OAAO;QAElC,IAAIC,OACA,MAAM,IAAIC,sBAAsB;YAC5B,SAASD,MAAM,OAAO,IAAI;YAC1B,MAAMA,MAAM,IAAI;YAChB,MAAMA,MAAM,IAAI;QACpB;QAGJ,OAAO;IACX;AACJ;AAEO,MAAME,wDAA6BC,2BAAAA,oBAAuC,CAAC;IAC9E,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
@@ -0,0 +1,112 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { Container } from "@webiny/di";
3
+ import { GraphQLOperationError } from "@webiny/app/errors/index.js";
4
+ import { CmsGraphQLClient } from "../../graphQLClient/abstractions.js";
5
+ import { DeleteEntryRevisionGateway } from "./abstractions.js";
6
+ import { DeleteEntryRevisionGateway as external_DeleteEntryRevisionGateway_js_DeleteEntryRevisionGateway } from "./DeleteEntryRevisionGateway.js";
7
+ const model = {
8
+ modelId: "article",
9
+ singularApiName: "Article"
10
+ };
11
+ const blockedData = {
12
+ model: "cms.article",
13
+ action: "delete",
14
+ reviews: [
15
+ {
16
+ reviewId: "review-1",
17
+ model: "cms.article",
18
+ targetId: "entry-1",
19
+ targetRevisionId: "entry-1#0002",
20
+ title: "Launch article",
21
+ stepPosition: 1,
22
+ stepCount: 2,
23
+ stepName: "Editor"
24
+ }
25
+ ]
26
+ };
27
+ function setup() {
28
+ const client = {
29
+ execute: vi.fn()
30
+ };
31
+ const container = new Container();
32
+ container.registerInstance(CmsGraphQLClient, client);
33
+ container.register(external_DeleteEntryRevisionGateway_js_DeleteEntryRevisionGateway).inSingletonScope();
34
+ const gateway = container.resolve(DeleteEntryRevisionGateway);
35
+ return {
36
+ client,
37
+ gateway
38
+ };
39
+ }
40
+ describe("DeleteEntryRevisionGateway", ()=>{
41
+ it("returns true and sends only the revision id", async ()=>{
42
+ const { client, gateway } = setup();
43
+ client.execute.mockResolvedValue({
44
+ content: {
45
+ data: true,
46
+ error: null
47
+ }
48
+ });
49
+ const result = await gateway.execute({
50
+ model: model,
51
+ revisionId: "entry-1#0002"
52
+ });
53
+ expect(result).toBe(true);
54
+ const request = client.execute.mock.calls[0][0];
55
+ expect(request.variables).toEqual({
56
+ revision: "entry-1#0002"
57
+ });
58
+ expect(request.query).toContain("error { message code data }");
59
+ });
60
+ it("throws a GraphQLOperationError carrying the code, data and message of the envelope error", async ()=>{
61
+ const { client, gateway } = setup();
62
+ client.execute.mockResolvedValue({
63
+ content: {
64
+ data: null,
65
+ error: {
66
+ message: "This content has a review in progress. Deleting it cancels the review.",
67
+ code: "Workflows/Review/ActiveReviewOnTrash",
68
+ data: blockedData
69
+ }
70
+ }
71
+ });
72
+ const error = await gateway.execute({
73
+ model: model,
74
+ revisionId: "entry-1#0002"
75
+ }).catch((e)=>e);
76
+ expect(error).toBeInstanceOf(GraphQLOperationError);
77
+ expect(error.message).toBe("This content has a review in progress. Deleting it cancels the review.");
78
+ expect(error.code).toBe("Workflows/Review/ActiveReviewOnTrash");
79
+ expect(error.data).toEqual(blockedData);
80
+ });
81
+ it("falls back to the existing message when the server sends none", async ()=>{
82
+ const { client, gateway } = setup();
83
+ client.execute.mockResolvedValue({
84
+ content: {
85
+ data: null,
86
+ error: {
87
+ message: "",
88
+ code: "Some/Code",
89
+ data: null
90
+ }
91
+ }
92
+ });
93
+ const error = await gateway.execute({
94
+ model: model,
95
+ revisionId: "entry-1#0002"
96
+ }).catch((e)=>e);
97
+ expect(error).toBeInstanceOf(GraphQLOperationError);
98
+ expect(error.message).toBe("Could not delete entry revision");
99
+ });
100
+ it("lets a transport failure pass through unchanged", async ()=>{
101
+ const { client, gateway } = setup();
102
+ client.execute.mockRejectedValue(new Error("Network down"));
103
+ const error = await gateway.execute({
104
+ model: model,
105
+ revisionId: "entry-1#0002"
106
+ }).catch((e)=>e);
107
+ expect(error).not.toBeInstanceOf(GraphQLOperationError);
108
+ expect(error.message).toBe("Network down");
109
+ });
110
+ });
111
+
112
+ //# sourceMappingURL=DeleteEntryRevisionGateway.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.test.js","sources":["../../../../src/features/contentEntry/deleteEntryRevision/DeleteEntryRevisionGateway.test.ts"],"sourcesContent":["import { describe } from \"vitest\";\nimport { expect } from \"vitest\";\nimport { it } from \"vitest\";\nimport { vi } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport { GraphQLOperationError } from \"@webiny/app/errors/index.js\";\nimport { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsModel } from \"~/types.js\";\nimport { DeleteEntryRevisionGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport { DeleteEntryRevisionGateway } from \"./DeleteEntryRevisionGateway.js\";\n\nconst model = { modelId: \"article\", singularApiName: \"Article\" } as CmsModel;\n\nconst blockedData = {\n model: \"cms.article\",\n action: \"delete\",\n reviews: [\n {\n reviewId: \"review-1\",\n model: \"cms.article\",\n targetId: \"entry-1\",\n targetRevisionId: \"entry-1#0002\",\n title: \"Launch article\",\n stepPosition: 1,\n stepCount: 2,\n stepName: \"Editor\"\n }\n ]\n};\n\nfunction setup() {\n const client = { execute: vi.fn() };\n const container = new Container();\n container.registerInstance(CmsGraphQLClient, client);\n container.register(DeleteEntryRevisionGateway).inSingletonScope();\n const gateway = container.resolve(GatewayAbstraction);\n return { client, gateway };\n}\n\ndescribe(\"DeleteEntryRevisionGateway\", () => {\n it(\"returns true and sends only the revision id\", async () => {\n const { client, gateway } = setup();\n client.execute.mockResolvedValue({ content: { data: true, error: null } });\n\n const result = await gateway.execute({ model, revisionId: \"entry-1#0002\" });\n\n expect(result).toBe(true);\n const request = client.execute.mock.calls[0][0];\n expect(request.variables).toEqual({ revision: \"entry-1#0002\" });\n expect(request.query).toContain(\"error { message code data }\");\n });\n\n it(\"throws a GraphQLOperationError carrying the code, data and message of the envelope error\", async () => {\n const { client, gateway } = setup();\n client.execute.mockResolvedValue({\n content: {\n data: null,\n error: {\n message:\n \"This content has a review in progress. Deleting it cancels the review.\",\n code: \"Workflows/Review/ActiveReviewOnTrash\",\n data: blockedData\n }\n }\n });\n\n const error = await gateway.execute({ model, revisionId: \"entry-1#0002\" }).catch(e => e);\n\n expect(error).toBeInstanceOf(GraphQLOperationError);\n expect(error.message).toBe(\n \"This content has a review in progress. Deleting it cancels the review.\"\n );\n expect(error.code).toBe(\"Workflows/Review/ActiveReviewOnTrash\");\n expect(error.data).toEqual(blockedData);\n });\n\n it(\"falls back to the existing message when the server sends none\", async () => {\n const { client, gateway } = setup();\n client.execute.mockResolvedValue({\n content: { data: null, error: { message: \"\", code: \"Some/Code\", data: null } }\n });\n\n const error = await gateway.execute({ model, revisionId: \"entry-1#0002\" }).catch(e => e);\n\n expect(error).toBeInstanceOf(GraphQLOperationError);\n expect(error.message).toBe(\"Could not delete entry revision\");\n });\n\n it(\"lets a transport failure pass through unchanged\", async () => {\n const { client, gateway } = setup();\n client.execute.mockRejectedValue(new Error(\"Network down\"));\n\n const error = await gateway.execute({ model, revisionId: \"entry-1#0002\" }).catch(e => e);\n\n expect(error).not.toBeInstanceOf(GraphQLOperationError);\n expect(error.message).toBe(\"Network down\");\n });\n});\n"],"names":["model","blockedData","setup","client","vi","container","Container","CmsGraphQLClient","DeleteEntryRevisionGateway","gateway","GatewayAbstraction","describe","it","result","expect","request","error","e","GraphQLOperationError","Error"],"mappings":";;;;;;AAWA,MAAMA,QAAQ;IAAE,SAAS;IAAW,iBAAiB;AAAU;AAE/D,MAAMC,cAAc;IAChB,OAAO;IACP,QAAQ;IACR,SAAS;QACL;YACI,UAAU;YACV,OAAO;YACP,UAAU;YACV,kBAAkB;YAClB,OAAO;YACP,cAAc;YACd,WAAW;YACX,UAAU;QACd;KACH;AACL;AAEA,SAASC;IACL,MAAMC,SAAS;QAAE,SAASC,GAAG,EAAE;IAAG;IAClC,MAAMC,YAAY,IAAIC;IACtBD,UAAU,gBAAgB,CAACE,kBAAkBJ;IAC7CE,UAAU,QAAQ,CAACG,mEAA4B,gBAAgB;IAC/D,MAAMC,UAAUJ,UAAU,OAAO,CAACK;IAClC,OAAO;QAAEP;QAAQM;IAAQ;AAC7B;AAEAE,SAAS,8BAA8B;IACnCC,GAAG,+CAA+C;QAC9C,MAAM,EAAET,MAAM,EAAEM,OAAO,EAAE,GAAGP;QAC5BC,OAAO,OAAO,CAAC,iBAAiB,CAAC;YAAE,SAAS;gBAAE,MAAM;gBAAM,OAAO;YAAK;QAAE;QAExE,MAAMU,SAAS,MAAMJ,QAAQ,OAAO,CAAC;YAAET,OAAAA;YAAO,YAAY;QAAe;QAEzEc,OAAOD,QAAQ,IAAI,CAAC;QACpB,MAAME,UAAUZ,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE;QAC/CW,OAAOC,QAAQ,SAAS,EAAE,OAAO,CAAC;YAAE,UAAU;QAAe;QAC7DD,OAAOC,QAAQ,KAAK,EAAE,SAAS,CAAC;IACpC;IAEAH,GAAG,4FAA4F;QAC3F,MAAM,EAAET,MAAM,EAAEM,OAAO,EAAE,GAAGP;QAC5BC,OAAO,OAAO,CAAC,iBAAiB,CAAC;YAC7B,SAAS;gBACL,MAAM;gBACN,OAAO;oBACH,SACI;oBACJ,MAAM;oBACN,MAAMF;gBACV;YACJ;QACJ;QAEA,MAAMe,QAAQ,MAAMP,QAAQ,OAAO,CAAC;YAAET,OAAAA;YAAO,YAAY;QAAe,GAAG,KAAK,CAACiB,CAAAA,IAAKA;QAEtFH,OAAOE,OAAO,cAAc,CAACE;QAC7BJ,OAAOE,MAAM,OAAO,EAAE,IAAI,CACtB;QAEJF,OAAOE,MAAM,IAAI,EAAE,IAAI,CAAC;QACxBF,OAAOE,MAAM,IAAI,EAAE,OAAO,CAACf;IAC/B;IAEAW,GAAG,iEAAiE;QAChE,MAAM,EAAET,MAAM,EAAEM,OAAO,EAAE,GAAGP;QAC5BC,OAAO,OAAO,CAAC,iBAAiB,CAAC;YAC7B,SAAS;gBAAE,MAAM;gBAAM,OAAO;oBAAE,SAAS;oBAAI,MAAM;oBAAa,MAAM;gBAAK;YAAE;QACjF;QAEA,MAAMa,QAAQ,MAAMP,QAAQ,OAAO,CAAC;YAAET,OAAAA;YAAO,YAAY;QAAe,GAAG,KAAK,CAACiB,CAAAA,IAAKA;QAEtFH,OAAOE,OAAO,cAAc,CAACE;QAC7BJ,OAAOE,MAAM,OAAO,EAAE,IAAI,CAAC;IAC/B;IAEAJ,GAAG,mDAAmD;QAClD,MAAM,EAAET,MAAM,EAAEM,OAAO,EAAE,GAAGP;QAC5BC,OAAO,OAAO,CAAC,iBAAiB,CAAC,IAAIgB,MAAM;QAE3C,MAAMH,QAAQ,MAAMP,QAAQ,OAAO,CAAC;YAAET,OAAAA;YAAO,YAAY;QAAe,GAAG,KAAK,CAACiB,CAAAA,IAAKA;QAEtFH,OAAOE,OAAO,GAAG,CAAC,cAAc,CAACE;QACjCJ,OAAOE,MAAM,OAAO,EAAE,IAAI,CAAC;IAC/B;AACJ"}
@@ -0,0 +1,14 @@
1
+ import { CmsGraphQLClient } from "../../../features/graphQLClient/abstractions.js";
2
+ import type { CmsContentEntry } from "../../../types.js";
3
+ import { EntryGraphQLFields } from "../abstractions.js";
4
+ import { DuplicateEntryGateway as GatewayAbstraction, type IDuplicateEntryParams } from "./abstractions.js";
5
+ declare class DuplicateEntryGatewayImpl implements GatewayAbstraction.Interface {
6
+ private client;
7
+ private fields;
8
+ constructor(client: CmsGraphQLClient.Interface, fields: EntryGraphQLFields.Interface);
9
+ execute({ model, revisionId }: IDuplicateEntryParams): Promise<CmsContentEntry<import("@webiny/app/types.js").GenericRecord>>;
10
+ }
11
+ export declare const DuplicateEntryGateway: typeof DuplicateEntryGatewayImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDuplicateEntryGateway>;
13
+ };
14
+ export {};
@@ -0,0 +1,43 @@
1
+ import { CmsGraphQLClient } from "../../graphQLClient/abstractions.js";
2
+ import { EntryGraphQLFields } from "../abstractions.js";
3
+ import { DuplicateEntryGateway } from "./abstractions.js";
4
+ function createMutation(model, fields) {
5
+ return `
6
+ mutation CmsEntriesDuplicate${model.singularApiName}($revision: ID!) {
7
+ content: duplicate${model.singularApiName}(revision: $revision) {
8
+ data {
9
+ ${fields.getSystemFields(model)}
10
+ ${fields.getValuesBlock(model)}
11
+ }
12
+ error { message code data }
13
+ }
14
+ }
15
+ `;
16
+ }
17
+ class DuplicateEntryGatewayImpl {
18
+ constructor(client, fields){
19
+ this.client = client;
20
+ this.fields = fields;
21
+ }
22
+ async execute({ model, revisionId }) {
23
+ const response = await this.client.execute({
24
+ query: createMutation(model, this.fields),
25
+ variables: {
26
+ revision: revisionId
27
+ }
28
+ });
29
+ const { data: entry, error } = response.content;
30
+ if (!entry) throw new Error(error?.message || "Could not duplicate entry");
31
+ return entry;
32
+ }
33
+ }
34
+ const DuplicateEntryGateway_DuplicateEntryGateway = DuplicateEntryGateway.createImplementation({
35
+ implementation: DuplicateEntryGatewayImpl,
36
+ dependencies: [
37
+ CmsGraphQLClient,
38
+ EntryGraphQLFields
39
+ ]
40
+ });
41
+ export { DuplicateEntryGateway_DuplicateEntryGateway as DuplicateEntryGateway };
42
+
43
+ //# sourceMappingURL=DuplicateEntryGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/contentEntry/duplicateEntry/DuplicateEntryGateway.js","sources":["../../../../src/features/contentEntry/duplicateEntry/DuplicateEntryGateway.ts"],"sourcesContent":["import { CmsGraphQLClient } from \"~/features/graphQLClient/abstractions.js\";\nimport type { CmsContentEntry, CmsErrorResponse, CmsModel } from \"~/types.js\";\nimport { EntryGraphQLFields } from \"../abstractions.js\";\nimport {\n DuplicateEntryGateway as GatewayAbstraction,\n type IDuplicateEntryParams\n} from \"./abstractions.js\";\n\ninterface DuplicateEntryResponse {\n content: {\n data: CmsContentEntry | null;\n error: CmsErrorResponse | null;\n };\n}\n\nfunction createMutation(model: CmsModel, fields: EntryGraphQLFields.Interface) {\n return /* GraphQL */ `\n mutation CmsEntriesDuplicate${model.singularApiName}($revision: ID!) {\n content: duplicate${model.singularApiName}(revision: $revision) {\n data {\n ${fields.getSystemFields(model)}\n ${fields.getValuesBlock(model)}\n }\n error { message code data }\n }\n }\n `;\n}\n\nclass DuplicateEntryGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: CmsGraphQLClient.Interface,\n private fields: EntryGraphQLFields.Interface\n ) {}\n\n async execute({ model, revisionId }: IDuplicateEntryParams) {\n const response = await this.client.execute<DuplicateEntryResponse>({\n query: createMutation(model, this.fields),\n variables: { revision: revisionId }\n });\n\n const { data: entry, error } = response.content;\n\n if (!entry) {\n throw new Error(error?.message || \"Could not duplicate entry\");\n }\n\n return entry;\n }\n}\n\nexport const DuplicateEntryGateway = GatewayAbstraction.createImplementation({\n implementation: DuplicateEntryGatewayImpl,\n dependencies: [CmsGraphQLClient, EntryGraphQLFields]\n});\n"],"names":["createMutation","model","fields","DuplicateEntryGatewayImpl","client","revisionId","response","entry","error","Error","DuplicateEntryGateway","GatewayAbstraction","CmsGraphQLClient","EntryGraphQLFields"],"mappings":";;;AAeA,SAASA,eAAeC,KAAe,EAAEC,MAAoC;IACzE,OAAqB,CAAC;oCACU,EAAED,MAAM,eAAe,CAAC;8BAC9B,EAAEA,MAAM,eAAe,CAAC;;oBAElC,EAAEC,OAAO,eAAe,CAACD,OAAO;oBAChC,EAAEC,OAAO,cAAc,CAACD,OAAO;;;;;IAK/C,CAAC;AACL;AAEA,MAAME;IACF,YACYC,MAAkC,EAClCF,MAAoC,CAC9C;aAFUE,MAAM,GAANA;aACAF,MAAM,GAANA;IACT;IAEH,MAAM,QAAQ,EAAED,KAAK,EAAEI,UAAU,EAAyB,EAAE;QACxD,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyB;YAC/D,OAAON,eAAeC,OAAO,IAAI,CAAC,MAAM;YACxC,WAAW;gBAAE,UAAUI;YAAW;QACtC;QAEA,MAAM,EAAE,MAAME,KAAK,EAAEC,KAAK,EAAE,GAAGF,SAAS,OAAO;QAE/C,IAAI,CAACC,OACD,MAAM,IAAIE,MAAMD,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAMG,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgBR;IAChB,cAAc;QAACS;QAAkBC;KAAmB;AACxD"}
@@ -0,0 +1,15 @@
1
+ import { DuplicateEntryRepository as RepositoryAbstraction, DuplicateEntryGateway } from "./abstractions.js";
2
+ import type { IDuplicateEntryParams } from "./abstractions.js";
3
+ import { ContentEntriesCacheProvider } from "../../../features/contentEntry/abstractions.js";
4
+ import { EventPublisher } from "@webiny/app/features/eventPublisher/index.js";
5
+ declare class DuplicateEntryRepositoryImpl implements RepositoryAbstraction.Interface {
6
+ private cacheProvider;
7
+ private gateway;
8
+ private eventPublisher;
9
+ constructor(cacheProvider: ContentEntriesCacheProvider.Interface, gateway: DuplicateEntryGateway.Interface, eventPublisher: EventPublisher.Interface);
10
+ execute(params: IDuplicateEntryParams): Promise<import("@webiny/app-headless-cms-common/types/index.js").CmsContentEntry<import("@webiny/app/types.js").GenericRecord>>;
11
+ }
12
+ export declare const DuplicateEntryRepository: typeof DuplicateEntryRepositoryImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDuplicateEntryRepository>;
14
+ };
15
+ export {};
@@ -0,0 +1,34 @@
1
+ import { DuplicateEntryGateway, DuplicateEntryRepository } from "./abstractions.js";
2
+ import { ContentEntriesCacheProvider } from "../abstractions.js";
3
+ import { EventPublisher } from "@webiny/app/features/eventPublisher/index.js";
4
+ import { EntryAfterCreateEvent } from "../events/EntryAfterCreateEvent.js";
5
+ class DuplicateEntryRepositoryImpl {
6
+ constructor(cacheProvider, gateway, eventPublisher){
7
+ this.cacheProvider = cacheProvider;
8
+ this.gateway = gateway;
9
+ this.eventPublisher = eventPublisher;
10
+ }
11
+ async execute(params) {
12
+ const entry = await this.gateway.execute(params);
13
+ const cache = this.cacheProvider.get(params.model.modelId);
14
+ cache.addItems([
15
+ entry
16
+ ]);
17
+ await this.eventPublisher.publish(new EntryAfterCreateEvent({
18
+ entry,
19
+ model: params.model
20
+ }));
21
+ return entry;
22
+ }
23
+ }
24
+ const DuplicateEntryRepository_DuplicateEntryRepository = DuplicateEntryRepository.createImplementation({
25
+ implementation: DuplicateEntryRepositoryImpl,
26
+ dependencies: [
27
+ ContentEntriesCacheProvider,
28
+ DuplicateEntryGateway,
29
+ EventPublisher
30
+ ]
31
+ });
32
+ export { DuplicateEntryRepository_DuplicateEntryRepository as DuplicateEntryRepository };
33
+
34
+ //# sourceMappingURL=DuplicateEntryRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/contentEntry/duplicateEntry/DuplicateEntryRepository.js","sources":["../../../../src/features/contentEntry/duplicateEntry/DuplicateEntryRepository.ts"],"sourcesContent":["import {\n DuplicateEntryRepository as RepositoryAbstraction,\n DuplicateEntryGateway\n} from \"./abstractions.js\";\nimport type { IDuplicateEntryParams } from \"./abstractions.js\";\nimport { ContentEntriesCacheProvider } from \"~/features/contentEntry/abstractions.js\";\nimport { EventPublisher } from \"@webiny/app/features/eventPublisher/index.js\";\nimport { EntryAfterCreateEvent } from \"~/features/contentEntry/events/EntryAfterCreateEvent.js\";\n\nclass DuplicateEntryRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private cacheProvider: ContentEntriesCacheProvider.Interface,\n private gateway: DuplicateEntryGateway.Interface,\n private eventPublisher: EventPublisher.Interface\n ) {}\n\n async execute(params: IDuplicateEntryParams) {\n const entry = await this.gateway.execute(params);\n\n const cache = this.cacheProvider.get(params.model.modelId);\n cache.addItems([entry]);\n\n // Duplicating results in a brand-new entry, so we notify the same listeners as on create.\n await this.eventPublisher.publish(\n new EntryAfterCreateEvent({ entry, model: params.model })\n );\n\n return entry;\n }\n}\n\nexport const DuplicateEntryRepository = RepositoryAbstraction.createImplementation({\n implementation: DuplicateEntryRepositoryImpl,\n dependencies: [ContentEntriesCacheProvider, DuplicateEntryGateway, EventPublisher]\n});\n"],"names":["DuplicateEntryRepositoryImpl","cacheProvider","gateway","eventPublisher","params","entry","cache","EntryAfterCreateEvent","DuplicateEntryRepository","RepositoryAbstraction","ContentEntriesCacheProvider","DuplicateEntryGateway","EventPublisher"],"mappings":";;;;AASA,MAAMA;IACF,YACYC,aAAoD,EACpDC,OAAwC,EACxCC,cAAwC,CAClD;aAHUF,aAAa,GAAbA;aACAC,OAAO,GAAPA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQC,MAA6B,EAAE;QACzC,MAAMC,QAAQ,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAACD;QAEzC,MAAME,QAAQ,IAAI,CAAC,aAAa,CAAC,GAAG,CAACF,OAAO,KAAK,CAAC,OAAO;QACzDE,MAAM,QAAQ,CAAC;YAACD;SAAM;QAGtB,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B,IAAIE,sBAAsB;YAAEF;YAAO,OAAOD,OAAO,KAAK;QAAC;QAG3D,OAAOC;IACX;AACJ;AAEO,MAAMG,oDAA2BC,yBAAAA,oBAA0C,CAAC;IAC/E,gBAAgBT;IAChB,cAAc;QAACU;QAA6BC;QAAuBC;KAAe;AACtF"}
@@ -0,0 +1,11 @@
1
+ import { DuplicateEntryUseCase as UseCaseAbstraction, DuplicateEntryRepository } from "./abstractions.js";
2
+ import type { IDuplicateEntryParams } from "./abstractions.js";
3
+ declare class DuplicateEntryUseCaseImpl implements UseCaseAbstraction.Interface {
4
+ private repository;
5
+ constructor(repository: DuplicateEntryRepository.Interface);
6
+ execute(params: IDuplicateEntryParams): Promise<import("@webiny/app-headless-cms-common/types/index.js").CmsContentEntry<import("@webiny/app/types.js").GenericRecord>>;
7
+ }
8
+ export declare const DuplicateEntryUseCase: typeof DuplicateEntryUseCaseImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IDuplicateEntryUseCase>;
10
+ };
11
+ export {};
@@ -0,0 +1,18 @@
1
+ import { DuplicateEntryRepository, DuplicateEntryUseCase } from "./abstractions.js";
2
+ class DuplicateEntryUseCaseImpl {
3
+ constructor(repository){
4
+ this.repository = repository;
5
+ }
6
+ async execute(params) {
7
+ return this.repository.execute(params);
8
+ }
9
+ }
10
+ const DuplicateEntryUseCase_DuplicateEntryUseCase = DuplicateEntryUseCase.createImplementation({
11
+ implementation: DuplicateEntryUseCaseImpl,
12
+ dependencies: [
13
+ DuplicateEntryRepository
14
+ ]
15
+ });
16
+ export { DuplicateEntryUseCase_DuplicateEntryUseCase as DuplicateEntryUseCase };
17
+
18
+ //# sourceMappingURL=DuplicateEntryUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/contentEntry/duplicateEntry/DuplicateEntryUseCase.js","sources":["../../../../src/features/contentEntry/duplicateEntry/DuplicateEntryUseCase.ts"],"sourcesContent":["import {\n DuplicateEntryUseCase as UseCaseAbstraction,\n DuplicateEntryRepository\n} from \"./abstractions.js\";\nimport type { IDuplicateEntryParams } from \"./abstractions.js\";\n\nclass DuplicateEntryUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private repository: DuplicateEntryRepository.Interface) {}\n\n async execute(params: IDuplicateEntryParams) {\n return this.repository.execute(params);\n }\n}\n\nexport const DuplicateEntryUseCase = UseCaseAbstraction.createImplementation({\n implementation: DuplicateEntryUseCaseImpl,\n dependencies: [DuplicateEntryRepository]\n});\n"],"names":["DuplicateEntryUseCaseImpl","repository","params","DuplicateEntryUseCase","UseCaseAbstraction","DuplicateEntryRepository"],"mappings":";AAMA,MAAMA;IACF,YAAoBC,UAA8C,CAAE;aAAhDA,UAAU,GAAVA;IAAiD;IAErE,MAAM,QAAQC,MAA6B,EAAE;QACzC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAACA;IACnC;AACJ;AAEO,MAAMC,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgBJ;IAChB,cAAc;QAACK;KAAyB;AAC5C"}
@@ -0,0 +1,26 @@
1
+ import type { CmsContentEntry, CmsModel } from "../../../types.js";
2
+ export interface IDuplicateEntryParams {
3
+ model: CmsModel;
4
+ revisionId: string;
5
+ }
6
+ export interface IDuplicateEntryGateway {
7
+ execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;
8
+ }
9
+ export declare const DuplicateEntryGateway: import("@webiny/di").Abstraction<IDuplicateEntryGateway>;
10
+ export declare namespace DuplicateEntryGateway {
11
+ type Interface = IDuplicateEntryGateway;
12
+ }
13
+ export interface IDuplicateEntryRepository {
14
+ execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;
15
+ }
16
+ export declare const DuplicateEntryRepository: import("@webiny/di").Abstraction<IDuplicateEntryRepository>;
17
+ export declare namespace DuplicateEntryRepository {
18
+ type Interface = IDuplicateEntryRepository;
19
+ }
20
+ export interface IDuplicateEntryUseCase {
21
+ execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;
22
+ }
23
+ export declare const DuplicateEntryUseCase: import("@webiny/di").Abstraction<IDuplicateEntryUseCase>;
24
+ export declare namespace DuplicateEntryUseCase {
25
+ type Interface = IDuplicateEntryUseCase;
26
+ }
@@ -0,0 +1,7 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const DuplicateEntryGateway = createAbstraction("DuplicateEntryGateway");
3
+ const DuplicateEntryRepository = createAbstraction("DuplicateEntryRepository");
4
+ const DuplicateEntryUseCase = createAbstraction("DuplicateEntryUseCase");
5
+ export { DuplicateEntryGateway, DuplicateEntryRepository, DuplicateEntryUseCase };
6
+
7
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/contentEntry/duplicateEntry/abstractions.js","sources":["../../../../src/features/contentEntry/duplicateEntry/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { CmsContentEntry, CmsModel } from \"~/types.js\";\n\nexport interface IDuplicateEntryParams {\n model: CmsModel;\n revisionId: string;\n}\n\n// Gateway\n\nexport interface IDuplicateEntryGateway {\n execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;\n}\n\nexport const DuplicateEntryGateway =\n createAbstraction<IDuplicateEntryGateway>(\"DuplicateEntryGateway\");\n\nexport namespace DuplicateEntryGateway {\n export type Interface = IDuplicateEntryGateway;\n}\n\n// Repository\n\nexport interface IDuplicateEntryRepository {\n execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;\n}\n\nexport const DuplicateEntryRepository = createAbstraction<IDuplicateEntryRepository>(\n \"DuplicateEntryRepository\"\n);\n\nexport namespace DuplicateEntryRepository {\n export type Interface = IDuplicateEntryRepository;\n}\n\n// UseCase\n\nexport interface IDuplicateEntryUseCase {\n execute(params: IDuplicateEntryParams): Promise<CmsContentEntry>;\n}\n\nexport const DuplicateEntryUseCase =\n createAbstraction<IDuplicateEntryUseCase>(\"DuplicateEntryUseCase\");\n\nexport namespace DuplicateEntryUseCase {\n export type Interface = IDuplicateEntryUseCase;\n}\n"],"names":["DuplicateEntryGateway","createAbstraction","DuplicateEntryRepository","DuplicateEntryUseCase"],"mappings":";AAcO,MAAMA,wBACTC,kBAA0C;AAYvC,MAAMC,2BAA2BD,kBACpC;AAaG,MAAME,wBACTF,kBAA0C"}
@@ -0,0 +1,3 @@
1
+ export declare const DuplicateEntryFeature: import("@webiny/feature/admin").FeatureDefinition<{
2
+ useCase: import("./abstractions.js").IDuplicateEntryUseCase;
3
+ }, []>;
@@ -0,0 +1,21 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { DuplicateEntryUseCase } from "./abstractions.js";
3
+ import { DuplicateEntryUseCase as external_DuplicateEntryUseCase_js_DuplicateEntryUseCase } from "./DuplicateEntryUseCase.js";
4
+ import { DuplicateEntryRepository } from "./DuplicateEntryRepository.js";
5
+ import { DuplicateEntryGateway } from "./DuplicateEntryGateway.js";
6
+ const DuplicateEntryFeature = createFeature({
7
+ name: "CmsContentEntry/DuplicateEntry",
8
+ register (container) {
9
+ container.register(external_DuplicateEntryUseCase_js_DuplicateEntryUseCase);
10
+ container.register(DuplicateEntryRepository).inSingletonScope();
11
+ container.register(DuplicateEntryGateway).inSingletonScope();
12
+ },
13
+ resolve (container) {
14
+ return {
15
+ useCase: container.resolve(DuplicateEntryUseCase)
16
+ };
17
+ }
18
+ });
19
+ export { DuplicateEntryFeature };
20
+
21
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/contentEntry/duplicateEntry/feature.js","sources":["../../../../src/features/contentEntry/duplicateEntry/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { DuplicateEntryUseCase as UseCase } from \"./abstractions.js\";\nimport { DuplicateEntryUseCase } from \"./DuplicateEntryUseCase.js\";\nimport { DuplicateEntryRepository } from \"./DuplicateEntryRepository.js\";\nimport { DuplicateEntryGateway } from \"./DuplicateEntryGateway.js\";\n\nexport const DuplicateEntryFeature = createFeature({\n name: \"CmsContentEntry/DuplicateEntry\",\n register(container) {\n container.register(DuplicateEntryUseCase);\n container.register(DuplicateEntryRepository).inSingletonScope();\n container.register(DuplicateEntryGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCase)\n };\n }\n});\n"],"names":["DuplicateEntryFeature","createFeature","container","DuplicateEntryUseCase","DuplicateEntryRepository","DuplicateEntryGateway","UseCase"],"mappings":";;;;;AAMO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,0BAA0B,gBAAgB;QAC7DF,UAAU,QAAQ,CAACG,uBAAuB,gBAAgB;IAC9D;IACA,SAAQH,SAAS;QACb,OAAO;YACH,SAASA,UAAU,OAAO,CAACI;QAC/B;IACJ;AACJ"}
@@ -0,0 +1 @@
1
+ export {};