@webiny/api-aco 0.0.0-unstable.6f45466a1d → 0.0.0-unstable.7be00a75a9

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 (412) hide show
  1. package/constants.js +2 -1
  2. package/constants.js.map +1 -1
  3. package/createAcoContext.d.ts +1 -1
  4. package/createAcoContext.js +75 -107
  5. package/createAcoContext.js.map +1 -1
  6. package/createAcoGraphQL.js +43 -44
  7. package/createAcoGraphQL.js.map +1 -1
  8. package/createAcoStorageOperations.js +5 -6
  9. package/createAcoStorageOperations.js.map +1 -1
  10. package/createAcoTasks.js +7 -8
  11. package/createAcoTasks.js.map +1 -1
  12. package/domain/folder/abstractions.js +2 -5
  13. package/domain/folder/abstractions.js.map +1 -1
  14. package/domain/folder/errors.js +42 -47
  15. package/domain/folder/errors.js.map +1 -1
  16. package/domain/folder/folder.model.js +52 -33
  17. package/domain/folder/folder.model.js.map +1 -1
  18. package/exports/api/aco/flp.d.ts +6 -0
  19. package/exports/api/aco/flp.js +6 -0
  20. package/exports/api/aco/folder.d.ts +10 -0
  21. package/exports/api/aco/folder.js +10 -0
  22. package/features/cms/decorators/CreateEntryRevisionFromWithFlpDecorator.js +27 -31
  23. package/features/cms/decorators/CreateEntryRevisionFromWithFlpDecorator.js.map +1 -1
  24. package/features/cms/decorators/CreateEntryWithFlpDecorator.js +22 -25
  25. package/features/cms/decorators/CreateEntryWithFlpDecorator.js.map +1 -1
  26. package/features/cms/decorators/DeleteEntryRevisionWithFlpDecorator.js +27 -31
  27. package/features/cms/decorators/DeleteEntryRevisionWithFlpDecorator.js.map +1 -1
  28. package/features/cms/decorators/DeleteEntryWithFlpDecorator.js +29 -33
  29. package/features/cms/decorators/DeleteEntryWithFlpDecorator.js.map +1 -1
  30. package/features/cms/decorators/GetEntryByIdWithFlpDecorator.js +25 -30
  31. package/features/cms/decorators/GetEntryByIdWithFlpDecorator.js.map +1 -1
  32. package/features/cms/decorators/GetEntryWithFlpDecorator.js +25 -30
  33. package/features/cms/decorators/GetEntryWithFlpDecorator.js.map +1 -1
  34. package/features/cms/decorators/GetLatestEntriesByIdsWithFlpDecorator.js +31 -35
  35. package/features/cms/decorators/GetLatestEntriesByIdsWithFlpDecorator.js.map +1 -1
  36. package/features/cms/decorators/GetPublishedEntriesByIdsWithFlpDecorator.js +31 -34
  37. package/features/cms/decorators/GetPublishedEntriesByIdsWithFlpDecorator.js.map +1 -1
  38. package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js +27 -28
  39. package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js.map +1 -1
  40. package/features/cms/decorators/ListEntriesWithFlpDecorator.js +27 -27
  41. package/features/cms/decorators/ListEntriesWithFlpDecorator.js.map +1 -1
  42. package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js +27 -28
  43. package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js.map +1 -1
  44. package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js +27 -28
  45. package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js.map +1 -1
  46. package/features/cms/decorators/MoveEntryWithFlpDecorator.js +37 -51
  47. package/features/cms/decorators/MoveEntryWithFlpDecorator.js.map +1 -1
  48. package/features/cms/decorators/UpdateEntryWithFlpDecorator.d.ts +1 -2
  49. package/features/cms/decorators/UpdateEntryWithFlpDecorator.js +27 -31
  50. package/features/cms/decorators/UpdateEntryWithFlpDecorator.js.map +1 -1
  51. package/features/cms/feature.d.ts +4 -1
  52. package/features/cms/feature.js +19 -25
  53. package/features/cms/feature.js.map +1 -1
  54. package/features/cms/index.js +0 -2
  55. package/features/flp/CreateFlp/CreateFlpUseCase.js +26 -33
  56. package/features/flp/CreateFlp/CreateFlpUseCase.js.map +1 -1
  57. package/features/flp/CreateFlp/abstractions.d.ts +1 -0
  58. package/features/flp/CreateFlp/abstractions.js +2 -4
  59. package/features/flp/CreateFlp/abstractions.js.map +1 -1
  60. package/features/flp/CreateFlp/feature.d.ts +5 -1
  61. package/features/flp/CreateFlp/feature.js +7 -8
  62. package/features/flp/CreateFlp/feature.js.map +1 -1
  63. package/features/flp/CreateFlp/index.js +0 -2
  64. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.d.ts +3 -3
  65. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js +28 -28
  66. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js.map +1 -1
  67. package/features/flp/CreateFlpOnFolderCreated/feature.d.ts +4 -1
  68. package/features/flp/CreateFlpOnFolderCreated/feature.js +6 -5
  69. package/features/flp/CreateFlpOnFolderCreated/feature.js.map +1 -1
  70. package/features/flp/CreateFlpOnFolderCreated/index.js +0 -2
  71. package/features/flp/DeleteFlp/DeleteFlpUseCase.js +17 -18
  72. package/features/flp/DeleteFlp/DeleteFlpUseCase.js.map +1 -1
  73. package/features/flp/DeleteFlp/abstractions.d.ts +1 -0
  74. package/features/flp/DeleteFlp/abstractions.js +2 -4
  75. package/features/flp/DeleteFlp/abstractions.js.map +1 -1
  76. package/features/flp/DeleteFlp/feature.d.ts +5 -1
  77. package/features/flp/DeleteFlp/feature.js +7 -8
  78. package/features/flp/DeleteFlp/feature.js.map +1 -1
  79. package/features/flp/DeleteFlp/index.js +0 -2
  80. package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.d.ts +3 -3
  81. package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js +28 -28
  82. package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js.map +1 -1
  83. package/features/flp/DeleteFlpOnFolderDeleted/feature.d.ts +4 -1
  84. package/features/flp/DeleteFlpOnFolderDeleted/feature.js +6 -5
  85. package/features/flp/DeleteFlpOnFolderDeleted/feature.js.map +1 -1
  86. package/features/flp/DeleteFlpOnFolderDeleted/index.js +0 -2
  87. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.d.ts +3 -3
  88. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +90 -111
  89. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
  90. package/features/flp/FolderLevelPermissions/abstractions.d.ts +1 -0
  91. package/features/flp/FolderLevelPermissions/abstractions.js +2 -1
  92. package/features/flp/FolderLevelPermissions/abstractions.js.map +1 -1
  93. package/features/flp/FolderLevelPermissions/feature.d.ts +5 -1
  94. package/features/flp/FolderLevelPermissions/feature.js +6 -5
  95. package/features/flp/FolderLevelPermissions/feature.js.map +1 -1
  96. package/features/flp/FolderLevelPermissions/index.js +0 -2
  97. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/CanAccessFolder.d.ts +1 -1
  98. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/CanAccessFolder.js +14 -36
  99. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/CanAccessFolder.js.map +1 -1
  100. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/ICanAccessFolder.js +0 -3
  101. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/index.js +0 -2
  102. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/CanAccessFolderContent.d.ts +1 -1
  103. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/CanAccessFolderContent.js +12 -29
  104. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/CanAccessFolderContent.js.map +1 -1
  105. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/ICanAccessFolderContent.js +0 -3
  106. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/index.js +0 -2
  107. package/features/flp/FolderLevelPermissions/useCases/CanCreateFolderInRoot/CanCreateFolderInRoot.js +5 -4
  108. package/features/flp/FolderLevelPermissions/useCases/CanCreateFolderInRoot/CanCreateFolderInRoot.js.map +1 -1
  109. package/features/flp/FolderLevelPermissions/useCases/CanCreateFolderInRoot/ICanCreateFolderInRoot.js +0 -3
  110. package/features/flp/FolderLevelPermissions/useCases/CanCreateFolderInRoot/index.js +0 -2
  111. package/features/flp/FolderLevelPermissions/useCases/CheckNotInheritedPermissions/CheckNotInheritedPermissions.js +5 -4
  112. package/features/flp/FolderLevelPermissions/useCases/CheckNotInheritedPermissions/CheckNotInheritedPermissions.js.map +1 -1
  113. package/features/flp/FolderLevelPermissions/useCases/CheckNotInheritedPermissions/ICheckNotInheritedPermissions.js +0 -3
  114. package/features/flp/FolderLevelPermissions/useCases/CheckNotInheritedPermissions/index.js +0 -2
  115. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/DefaultPermissionsMerger.js +43 -66
  116. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/DefaultPermissionsMerger.js.map +1 -1
  117. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissions.d.ts +1 -1
  118. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissions.js +10 -9
  119. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissions.js.map +1 -1
  120. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.d.ts +2 -2
  121. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js +22 -33
  122. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js.map +1 -1
  123. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/IGetDefaultPermissions.js +0 -3
  124. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/index.js +0 -2
  125. package/features/flp/FolderLevelPermissions/useCases/index.js +0 -2
  126. package/features/flp/GetFlp/GetFlpUseCase.js +8 -7
  127. package/features/flp/GetFlp/GetFlpUseCase.js.map +1 -1
  128. package/features/flp/GetFlp/abstractions.d.ts +1 -0
  129. package/features/flp/GetFlp/abstractions.js +2 -1
  130. package/features/flp/GetFlp/abstractions.js.map +1 -1
  131. package/features/flp/GetFlp/feature.d.ts +4 -1
  132. package/features/flp/GetFlp/feature.js +7 -8
  133. package/features/flp/GetFlp/feature.js.map +1 -1
  134. package/features/flp/GetFlp/index.js +0 -2
  135. package/features/flp/ListFlps/ListFlpsUseCase.js +8 -7
  136. package/features/flp/ListFlps/ListFlpsUseCase.js.map +1 -1
  137. package/features/flp/ListFlps/abstractions.d.ts +1 -0
  138. package/features/flp/ListFlps/abstractions.js +2 -1
  139. package/features/flp/ListFlps/abstractions.js.map +1 -1
  140. package/features/flp/ListFlps/feature.d.ts +4 -1
  141. package/features/flp/ListFlps/feature.js +7 -8
  142. package/features/flp/ListFlps/feature.js.map +1 -1
  143. package/features/flp/ListFlps/index.js +0 -2
  144. package/features/flp/UpdateFlp/UpdateFlpUseCase.js +133 -184
  145. package/features/flp/UpdateFlp/UpdateFlpUseCase.js.map +1 -1
  146. package/features/flp/UpdateFlp/abstractions.d.ts +1 -0
  147. package/features/flp/UpdateFlp/abstractions.js +2 -4
  148. package/features/flp/UpdateFlp/abstractions.js.map +1 -1
  149. package/features/flp/UpdateFlp/feature.d.ts +5 -1
  150. package/features/flp/UpdateFlp/feature.js +7 -8
  151. package/features/flp/UpdateFlp/feature.js.map +1 -1
  152. package/features/flp/UpdateFlp/index.js +0 -2
  153. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.d.ts +3 -3
  154. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js +30 -30
  155. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js.map +1 -1
  156. package/features/flp/UpdateFlpOnFolderUpdated/feature.d.ts +4 -1
  157. package/features/flp/UpdateFlpOnFolderUpdated/feature.js +6 -5
  158. package/features/flp/UpdateFlpOnFolderUpdated/feature.js.map +1 -1
  159. package/features/flp/UpdateFlpOnFolderUpdated/index.js +0 -2
  160. package/features/folder/CreateFolder/CreateFolderRepository.js +67 -90
  161. package/features/folder/CreateFolder/CreateFolderRepository.js.map +1 -1
  162. package/features/folder/CreateFolder/CreateFolderUseCase.d.ts +1 -1
  163. package/features/folder/CreateFolder/CreateFolderUseCase.js +28 -31
  164. package/features/folder/CreateFolder/CreateFolderUseCase.js.map +1 -1
  165. package/features/folder/CreateFolder/abstractions.d.ts +9 -5
  166. package/features/folder/CreateFolder/abstractions.js +5 -18
  167. package/features/folder/CreateFolder/abstractions.js.map +1 -1
  168. package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js +29 -34
  169. package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js.map +1 -1
  170. package/features/folder/CreateFolder/events.d.ts +3 -3
  171. package/features/folder/CreateFolder/events.js +17 -15
  172. package/features/folder/CreateFolder/events.js.map +1 -1
  173. package/features/folder/CreateFolder/feature.d.ts +5 -1
  174. package/features/folder/CreateFolder/feature.js +8 -7
  175. package/features/folder/CreateFolder/feature.js.map +1 -1
  176. package/features/folder/CreateFolder/index.d.ts +1 -1
  177. package/features/folder/CreateFolder/index.js +1 -3
  178. package/features/folder/DeleteFolder/DeleteFolderRepository.js +22 -20
  179. package/features/folder/DeleteFolder/DeleteFolderRepository.js.map +1 -1
  180. package/features/folder/DeleteFolder/DeleteFolderUseCase.d.ts +1 -1
  181. package/features/folder/DeleteFolder/DeleteFolderUseCase.js +36 -44
  182. package/features/folder/DeleteFolder/DeleteFolderUseCase.js.map +1 -1
  183. package/features/folder/DeleteFolder/abstractions.d.ts +9 -5
  184. package/features/folder/DeleteFolder/abstractions.js +5 -18
  185. package/features/folder/DeleteFolder/abstractions.js.map +1 -1
  186. package/features/folder/DeleteFolder/decorators/DeleteFolderWithFolderLevelPermissions.js +21 -20
  187. package/features/folder/DeleteFolder/decorators/DeleteFolderWithFolderLevelPermissions.js.map +1 -1
  188. package/features/folder/DeleteFolder/events.d.ts +3 -3
  189. package/features/folder/DeleteFolder/events.js +17 -15
  190. package/features/folder/DeleteFolder/events.js.map +1 -1
  191. package/features/folder/DeleteFolder/feature.d.ts +5 -1
  192. package/features/folder/DeleteFolder/feature.js +8 -7
  193. package/features/folder/DeleteFolder/feature.js.map +1 -1
  194. package/features/folder/DeleteFolder/index.d.ts +1 -1
  195. package/features/folder/DeleteFolder/index.js +1 -3
  196. package/features/folder/EnsureFolderIsEmpty/EnsureFolderIsEmpty.js +43 -44
  197. package/features/folder/EnsureFolderIsEmpty/EnsureFolderIsEmpty.js.map +1 -1
  198. package/features/folder/EnsureFolderIsEmpty/abstractions.d.ts +1 -0
  199. package/features/folder/EnsureFolderIsEmpty/abstractions.js +2 -1
  200. package/features/folder/EnsureFolderIsEmpty/abstractions.js.map +1 -1
  201. package/features/folder/EnsureFolderIsEmpty/feature.d.ts +4 -1
  202. package/features/folder/EnsureFolderIsEmpty/feature.js +6 -5
  203. package/features/folder/EnsureFolderIsEmpty/feature.js.map +1 -1
  204. package/features/folder/EnsureFolderIsEmpty/index.js +0 -2
  205. package/features/folder/EnsureFolderIsEmptyOnDelete/GenericFolderBeforeDeleteHandler.d.ts +3 -3
  206. package/features/folder/EnsureFolderIsEmptyOnDelete/GenericFolderBeforeDeleteHandler.js +17 -21
  207. package/features/folder/EnsureFolderIsEmptyOnDelete/GenericFolderBeforeDeleteHandler.js.map +1 -1
  208. package/features/folder/EnsureFolderIsEmptyOnDelete/feature.d.ts +4 -1
  209. package/features/folder/EnsureFolderIsEmptyOnDelete/feature.js +6 -12
  210. package/features/folder/EnsureFolderIsEmptyOnDelete/feature.js.map +1 -1
  211. package/features/folder/EnsureFolderIsEmptyOnDelete/index.js +0 -2
  212. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.d.ts +3 -3
  213. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.js +37 -45
  214. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.js.map +1 -1
  215. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/feature.d.ts +4 -1
  216. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/feature.js +6 -5
  217. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/feature.js.map +1 -1
  218. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/index.js +0 -2
  219. package/features/folder/GetAncestors/GetAncestorsRepository.js +45 -75
  220. package/features/folder/GetAncestors/GetAncestorsRepository.js.map +1 -1
  221. package/features/folder/GetAncestors/GetAncestorsUseCase.js +14 -11
  222. package/features/folder/GetAncestors/GetAncestorsUseCase.js.map +1 -1
  223. package/features/folder/GetAncestors/abstractions.d.ts +2 -0
  224. package/features/folder/GetAncestors/abstractions.js +3 -12
  225. package/features/folder/GetAncestors/abstractions.js.map +1 -1
  226. package/features/folder/GetAncestors/feature.d.ts +5 -1
  227. package/features/folder/GetAncestors/feature.js +7 -6
  228. package/features/folder/GetAncestors/feature.js.map +1 -1
  229. package/features/folder/GetAncestors/index.js +0 -2
  230. package/features/folder/GetFolder/GetFolderRepository.js +21 -19
  231. package/features/folder/GetFolder/GetFolderRepository.js.map +1 -1
  232. package/features/folder/GetFolder/GetFolderUseCase.js +14 -11
  233. package/features/folder/GetFolder/GetFolderUseCase.js.map +1 -1
  234. package/features/folder/GetFolder/abstractions.d.ts +8 -5
  235. package/features/folder/GetFolder/abstractions.js +5 -18
  236. package/features/folder/GetFolder/abstractions.js.map +1 -1
  237. package/features/folder/GetFolder/decorators/GetFolderWithFolderLevelPermissions.js +23 -26
  238. package/features/folder/GetFolder/decorators/GetFolderWithFolderLevelPermissions.js.map +1 -1
  239. package/features/folder/GetFolder/feature.d.ts +5 -1
  240. package/features/folder/GetFolder/feature.js +8 -7
  241. package/features/folder/GetFolder/feature.js.map +1 -1
  242. package/features/folder/GetFolder/index.d.ts +1 -1
  243. package/features/folder/GetFolder/index.js +1 -3
  244. package/features/folder/GetFolderHierarchy/GetFolderHierarchyRepository.js +67 -86
  245. package/features/folder/GetFolderHierarchy/GetFolderHierarchyRepository.js.map +1 -1
  246. package/features/folder/GetFolderHierarchy/GetFolderHierarchyUseCase.js +14 -11
  247. package/features/folder/GetFolderHierarchy/GetFolderHierarchyUseCase.js.map +1 -1
  248. package/features/folder/GetFolderHierarchy/abstractions.d.ts +2 -0
  249. package/features/folder/GetFolderHierarchy/abstractions.js +3 -12
  250. package/features/folder/GetFolderHierarchy/abstractions.js.map +1 -1
  251. package/features/folder/GetFolderHierarchy/decorators/GetFolderHierarchyWithFolderLevelPermissions.js +55 -56
  252. package/features/folder/GetFolderHierarchy/decorators/GetFolderHierarchyWithFolderLevelPermissions.js.map +1 -1
  253. package/features/folder/GetFolderHierarchy/feature.d.ts +5 -1
  254. package/features/folder/GetFolderHierarchy/feature.js +8 -7
  255. package/features/folder/GetFolderHierarchy/feature.js.map +1 -1
  256. package/features/folder/GetFolderHierarchy/index.js +0 -2
  257. package/features/folder/ListFolderLevelPermissionsTargets/ListFolderLevelPermissionsTargetsUseCase.d.ts +2 -2
  258. package/features/folder/ListFolderLevelPermissionsTargets/ListFolderLevelPermissionsTargetsUseCase.js +67 -60
  259. package/features/folder/ListFolderLevelPermissionsTargets/ListFolderLevelPermissionsTargetsUseCase.js.map +1 -1
  260. package/features/folder/ListFolderLevelPermissionsTargets/abstractions.d.ts +1 -0
  261. package/features/folder/ListFolderLevelPermissionsTargets/abstractions.js +2 -4
  262. package/features/folder/ListFolderLevelPermissionsTargets/abstractions.js.map +1 -1
  263. package/features/folder/ListFolderLevelPermissionsTargets/feature.d.ts +4 -1
  264. package/features/folder/ListFolderLevelPermissionsTargets/feature.js +6 -5
  265. package/features/folder/ListFolderLevelPermissionsTargets/feature.js.map +1 -1
  266. package/features/folder/ListFolderLevelPermissionsTargets/index.js +0 -2
  267. package/features/folder/ListFolders/ListFoldersRepository.js +39 -41
  268. package/features/folder/ListFolders/ListFoldersRepository.js.map +1 -1
  269. package/features/folder/ListFolders/ListFoldersUseCase.js +14 -11
  270. package/features/folder/ListFolders/ListFoldersUseCase.js.map +1 -1
  271. package/features/folder/ListFolders/abstractions.d.ts +2 -0
  272. package/features/folder/ListFolders/abstractions.js +3 -12
  273. package/features/folder/ListFolders/abstractions.js.map +1 -1
  274. package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js +55 -67
  275. package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js.map +1 -1
  276. package/features/folder/ListFolders/feature.d.ts +5 -1
  277. package/features/folder/ListFolders/feature.js +8 -7
  278. package/features/folder/ListFolders/feature.js.map +1 -1
  279. package/features/folder/ListFolders/index.js +0 -2
  280. package/features/folder/UpdateFolder/UpdateFolderRepository.js +66 -92
  281. package/features/folder/UpdateFolder/UpdateFolderRepository.js.map +1 -1
  282. package/features/folder/UpdateFolder/UpdateFolderUseCase.d.ts +1 -1
  283. package/features/folder/UpdateFolder/UpdateFolderUseCase.js +39 -46
  284. package/features/folder/UpdateFolder/UpdateFolderUseCase.js.map +1 -1
  285. package/features/folder/UpdateFolder/abstractions.d.ts +9 -5
  286. package/features/folder/UpdateFolder/abstractions.js +5 -18
  287. package/features/folder/UpdateFolder/abstractions.js.map +1 -1
  288. package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js +45 -64
  289. package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js.map +1 -1
  290. package/features/folder/UpdateFolder/events.d.ts +3 -3
  291. package/features/folder/UpdateFolder/events.js +17 -15
  292. package/features/folder/UpdateFolder/events.js.map +1 -1
  293. package/features/folder/UpdateFolder/feature.d.ts +5 -1
  294. package/features/folder/UpdateFolder/feature.js +8 -7
  295. package/features/folder/UpdateFolder/feature.js.map +1 -1
  296. package/features/folder/UpdateFolder/index.d.ts +1 -1
  297. package/features/folder/UpdateFolder/index.js +1 -3
  298. package/features/folder/shared/EntryToFolderMapper.js +20 -19
  299. package/features/folder/shared/EntryToFolderMapper.js.map +1 -1
  300. package/features/folder/shared/abstractions.d.ts +1 -0
  301. package/features/folder/shared/abstractions.js +2 -1
  302. package/features/folder/shared/abstractions.js.map +1 -1
  303. package/filter/filter.crud.js +28 -31
  304. package/filter/filter.crud.js.map +1 -1
  305. package/filter/filter.gql.js +32 -48
  306. package/filter/filter.gql.js.map +1 -1
  307. package/filter/filter.model.js +44 -32
  308. package/filter/filter.model.js.map +1 -1
  309. package/filter/filter.so.js +73 -93
  310. package/filter/filter.so.js.map +1 -1
  311. package/filter/filter.types.js +5 -4
  312. package/filter/filter.types.js.map +1 -1
  313. package/flp/flp.crud.js +69 -86
  314. package/flp/flp.crud.js.map +1 -1
  315. package/flp/flp.so.js +162 -199
  316. package/flp/flp.so.js.map +1 -1
  317. package/flp/flp.types.js +0 -3
  318. package/flp/index.js +0 -2
  319. package/flp/tasks/createFlp.task.d.ts +6 -4
  320. package/flp/tasks/createFlp.task.js +27 -26
  321. package/flp/tasks/createFlp.task.js.map +1 -1
  322. package/flp/tasks/deleteFlp.task.d.ts +6 -4
  323. package/flp/tasks/deleteFlp.task.js +27 -26
  324. package/flp/tasks/deleteFlp.task.js.map +1 -1
  325. package/flp/tasks/index.js +13 -12
  326. package/flp/tasks/index.js.map +1 -1
  327. package/flp/tasks/syncFlp.task.d.ts +6 -4
  328. package/flp/tasks/syncFlp.task.js +84 -111
  329. package/flp/tasks/syncFlp.task.js.map +1 -1
  330. package/flp/tasks/updateFlp.task.d.ts +6 -4
  331. package/flp/tasks/updateFlp.task.js +34 -31
  332. package/flp/tasks/updateFlp.task.js.map +1 -1
  333. package/folder/createFolderModelModifier.js +50 -50
  334. package/folder/createFolderModelModifier.js.map +1 -1
  335. package/folder/createFolderTypeDefs.d.ts +3 -2
  336. package/folder/createFolderTypeDefs.js +39 -50
  337. package/folder/createFolderTypeDefs.js.map +1 -1
  338. package/folder/folder.gql.js +100 -133
  339. package/folder/folder.gql.js.map +1 -1
  340. package/folder/folder.types.js +0 -3
  341. package/index.d.ts +1 -1
  342. package/index.js +7 -4
  343. package/index.js.map +1 -1
  344. package/package.json +31 -41
  345. package/types.js +5 -4
  346. package/types.js.map +1 -1
  347. package/utils/FoldersCacheFactory.js +20 -19
  348. package/utils/FoldersCacheFactory.js.map +1 -1
  349. package/utils/ListCache.js +20 -19
  350. package/utils/ListCache.js.map +1 -1
  351. package/utils/Path.js +5 -6
  352. package/utils/Path.js.map +1 -1
  353. package/utils/compress.js +8 -7
  354. package/utils/compress.js.map +1 -1
  355. package/utils/createListSort.js +4 -7
  356. package/utils/createListSort.js.map +1 -1
  357. package/utils/createOperationsWrapper.js +12 -19
  358. package/utils/createOperationsWrapper.js.map +1 -1
  359. package/utils/decorators/CmsEntriesCrudDecorators.js +165 -196
  360. package/utils/decorators/CmsEntriesCrudDecorators.js.map +1 -1
  361. package/utils/decorators/FilterEntriesByFolderFactory.js +18 -19
  362. package/utils/decorators/FilterEntriesByFolderFactory.js.map +1 -1
  363. package/utils/decorators/ListEntriesFactory.js +65 -98
  364. package/utils/decorators/ListEntriesFactory.js.map +1 -1
  365. package/utils/decorators/hasRootFolderId.js +6 -12
  366. package/utils/decorators/hasRootFolderId.js.map +1 -1
  367. package/utils/decorators/isPageModel.js +5 -10
  368. package/utils/decorators/isPageModel.js.map +1 -1
  369. package/utils/ensureAuthentication.js +6 -7
  370. package/utils/ensureAuthentication.js.map +1 -1
  371. package/utils/pickEntryFieldValues.js +24 -18
  372. package/utils/pickEntryFieldValues.js.map +1 -1
  373. package/utils/resolve.js +7 -6
  374. package/utils/resolve.js.map +1 -1
  375. package/features/cms/index.js.map +0 -1
  376. package/features/flp/CreateFlp/index.js.map +0 -1
  377. package/features/flp/CreateFlpOnFolderCreated/index.js.map +0 -1
  378. package/features/flp/DeleteFlp/index.js.map +0 -1
  379. package/features/flp/DeleteFlpOnFolderDeleted/index.js.map +0 -1
  380. package/features/flp/FolderLevelPermissions/index.js.map +0 -1
  381. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/ICanAccessFolder.js.map +0 -1
  382. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolder/index.js.map +0 -1
  383. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/ICanAccessFolderContent.js.map +0 -1
  384. package/features/flp/FolderLevelPermissions/useCases/CanAccessFolderContent/index.js.map +0 -1
  385. package/features/flp/FolderLevelPermissions/useCases/CanCreateFolderInRoot/ICanCreateFolderInRoot.js.map +0 -1
  386. package/features/flp/FolderLevelPermissions/useCases/CanCreateFolderInRoot/index.js.map +0 -1
  387. package/features/flp/FolderLevelPermissions/useCases/CheckNotInheritedPermissions/ICheckNotInheritedPermissions.js.map +0 -1
  388. package/features/flp/FolderLevelPermissions/useCases/CheckNotInheritedPermissions/index.js.map +0 -1
  389. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/IGetDefaultPermissions.js.map +0 -1
  390. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/index.js.map +0 -1
  391. package/features/flp/FolderLevelPermissions/useCases/index.js.map +0 -1
  392. package/features/flp/GetFlp/index.js.map +0 -1
  393. package/features/flp/ListFlps/index.js.map +0 -1
  394. package/features/flp/UpdateFlp/index.js.map +0 -1
  395. package/features/flp/UpdateFlpOnFolderUpdated/index.js.map +0 -1
  396. package/features/folder/CreateFolder/index.js.map +0 -1
  397. package/features/folder/DeleteFolder/index.js.map +0 -1
  398. package/features/folder/EnsureFolderIsEmpty/index.js.map +0 -1
  399. package/features/folder/EnsureFolderIsEmptyOnDelete/index.js.map +0 -1
  400. package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/index.js.map +0 -1
  401. package/features/folder/GetAncestors/index.js.map +0 -1
  402. package/features/folder/GetFolder/index.js.map +0 -1
  403. package/features/folder/GetFolderHierarchy/index.js.map +0 -1
  404. package/features/folder/ListFolderLevelPermissionsTargets/index.js.map +0 -1
  405. package/features/folder/ListFolders/index.js.map +0 -1
  406. package/features/folder/UpdateFolder/index.js.map +0 -1
  407. package/flp/flp.types.js.map +0 -1
  408. package/flp/index.js.map +0 -1
  409. package/folder/folder.types.js.map +0 -1
  410. package/utils/acoRecordId.d.ts +0 -6
  411. package/utils/acoRecordId.js +0 -27
  412. package/utils/acoRecordId.js.map +0 -1
@@ -4,200 +4,149 @@ import { Permissions, ROOT_FOLDER } from "@webiny/shared-aco";
4
4
  import { ListFoldersUseCase } from "../../folder/ListFolders/index.js";
5
5
  import { FolderModel } from "../../../domain/folder/abstractions.js";
6
6
  import { EntryId } from "@webiny/api-headless-cms/exports/api/cms/entry.js";
7
- export class UpdateFlpUseCase {
8
- queued = new Set();
9
- flpsToUpdate = new Map();
10
- constructor(context) {
11
- this.context = context;
12
- }
13
- async execute(params) {
14
- this.isCloseToTimeout = params.isCloseToTimeout;
15
- this.handleTimeout = params.handleTimeout;
16
- if (params.queued) {
17
- params.queued.forEach(id => this.queued.add(id));
7
+ class UpdateFlpUseCase {
8
+ constructor(context){
9
+ this.queued = new Set();
10
+ this.flpsToUpdate = new Map();
11
+ this.context = context;
18
12
  }
19
- try {
20
- const {
21
- folder
22
- } = params;
23
- if (!folder) {
24
- throw new WebinyError("Missing `folder`, I can't update the FLP record.", "ERROR_UPDATING_FLP_USE_CASE_FOLDER_NOT_PROVIDED", {
25
- folder
26
- });
27
- }
28
- const flp = await this.getFlp(folder);
29
- const parentFlp = folder.parentId ? await this.context.aco.flp.get(folder.parentId) : null;
30
-
31
- // Add the root folder to the update collection
32
- this.flpsToUpdate.set(folder.id, {
33
- slug: folder.slug,
34
- parentId: folder.parentId ?? ROOT_FOLDER,
35
- path: Path.create(folder.slug, parentFlp?.path),
36
- permissions: Permissions.create(folder.permissions, parentFlp)
37
- });
38
-
39
- // Let's set the FLP as in queue
40
- this.setQueued(flp.id);
41
-
42
- // Get direct children and process each branch completely
43
- const directChildren = await this.listDirectChildren(flp);
44
- for (const child of directChildren) {
45
- if (this.isCloseToTimeout?.()) {
46
- await this.executeBatchUpdate();
47
- this.handleTimeout?.(this.getQueuedList());
48
- return;
13
+ async execute(params) {
14
+ this.isCloseToTimeout = params.isCloseToTimeout;
15
+ this.handleTimeout = params.handleTimeout;
16
+ if (params.queued) params.queued.forEach((id)=>this.queued.add(id));
17
+ try {
18
+ const { folder } = params;
19
+ if (!folder) throw new WebinyError("Missing `folder`, I can't update the FLP record.", "ERROR_UPDATING_FLP_USE_CASE_FOLDER_NOT_PROVIDED", {
20
+ folder
21
+ });
22
+ const flp = await this.getFlp(folder);
23
+ const parentFlp = folder.parentId ? await this.context.aco.flp.get(folder.parentId) : null;
24
+ this.flpsToUpdate.set(folder.id, {
25
+ slug: folder.slug,
26
+ parentId: folder.parentId ?? ROOT_FOLDER,
27
+ path: Path.create(folder.slug, parentFlp?.path),
28
+ permissions: Permissions.create(folder.permissions, parentFlp)
29
+ });
30
+ this.setQueued(flp.id);
31
+ const directChildren = await this.listDirectChildren(flp);
32
+ for (const child of directChildren){
33
+ if (this.isCloseToTimeout?.()) {
34
+ await this.executeBatchUpdate();
35
+ this.handleTimeout?.(this.getQueuedList());
36
+ return;
37
+ }
38
+ await this.collectBranchForUpdate(child, flp);
39
+ }
40
+ await this.executeBatchUpdate();
41
+ } catch (error) {
42
+ this.flpsToUpdate.clear();
43
+ this.queued.clear();
44
+ throw WebinyError.from(error, {
45
+ message: "Error while updating FLP",
46
+ code: "ERROR_UPDATING_FLP_USE_CASE"
47
+ });
49
48
  }
50
- await this.collectBranchForUpdate(child, flp);
51
- }
52
-
53
- // Execute batch update
54
- await this.executeBatchUpdate();
55
- } catch (error) {
56
- // Clear the update collection in case of error
57
- this.flpsToUpdate.clear();
58
- this.queued.clear();
59
- throw WebinyError.from(error, {
60
- message: "Error while updating FLP",
61
- code: "ERROR_UPDATING_FLP_USE_CASE"
62
- });
63
49
  }
64
- }
65
- async collectBranchForUpdate(flp, parentFlp) {
66
- if (this.isQueued(flp.id)) {
67
- return;
68
- }
69
-
70
- // Get the parent's permissions from the update collection if available
71
- const parentFlpData = this.flpsToUpdate.get(parentFlp.id);
72
- const currentParentFlp = {
73
- ...parentFlp,
74
- ...(parentFlpData && {
75
- ...parentFlpData
76
- })
77
- };
78
-
79
- // Add the FLP to the update collection with inherited permissions
80
- this.flpsToUpdate.set(flp.id, {
81
- slug: flp.slug,
82
- parentId: flp.parentId,
83
- path: Path.create(flp.slug, currentParentFlp.path),
84
- permissions: Permissions.create(flp.permissions, currentParentFlp)
85
- });
86
-
87
- // Add the FLP to the queue list so we don't fetch it again
88
- this.setQueued(flp.id);
89
-
90
- // Process all children of this folder before moving to siblings
91
- const children = await this.listDirectChildren(flp);
92
- for (const child of children) {
93
- if (this.isCloseToTimeout?.()) {
94
- await this.executeBatchUpdate();
95
- this.handleTimeout?.(this.getQueuedList());
96
- return;
97
- }
98
- // Pass the current FLP as the parent for the child
99
- await this.collectBranchForUpdate(child, flp);
100
- }
101
- }
102
- async executeBatchUpdate() {
103
- try {
104
- const items = Array.from(this.flpsToUpdate.entries()).map(([id, {
105
- slug,
106
- parentId,
107
- path,
108
- permissions
109
- }]) => {
110
- return {
111
- id,
112
- data: {
113
- slug,
114
- parentId,
115
- path,
116
- permissions
117
- }
50
+ async collectBranchForUpdate(flp, parentFlp) {
51
+ if (this.isQueued(flp.id)) return;
52
+ const parentFlpData = this.flpsToUpdate.get(parentFlp.id);
53
+ const currentParentFlp = {
54
+ ...parentFlp,
55
+ ...parentFlpData && {
56
+ ...parentFlpData
57
+ }
118
58
  };
119
- });
120
- await this.context.aco.flp.batchUpdate(items);
121
-
122
- // Update all folders with the new path
123
- const folderModel = this.context.container.resolve(FolderModel);
124
- for (const item of items) {
125
- const {
126
- id,
127
- data
128
- } = item;
129
- // Directly update the folder in CMS storage to bypass any folder update event triggers.
130
- const entryId = EntryId.from(id);
131
- await this.context.cms.updateEntry(folderModel, entryId.toString(), {
132
- values: {
133
- path: data.path
134
- }
59
+ this.flpsToUpdate.set(flp.id, {
60
+ slug: flp.slug,
61
+ parentId: flp.parentId,
62
+ path: Path.create(flp.slug, currentParentFlp.path),
63
+ permissions: Permissions.create(flp.permissions, currentParentFlp)
135
64
  });
136
- }
137
- } catch (error) {
138
- throw WebinyError.from(error, {
139
- message: "Error while executing batch update of FLPs",
140
- code: "BATCH_UPDATE_FLP_ERROR",
141
- data: {
142
- items: Array.from(this.flpsToUpdate.keys())
65
+ this.setQueued(flp.id);
66
+ const children = await this.listDirectChildren(flp);
67
+ for (const child of children){
68
+ if (this.isCloseToTimeout?.()) {
69
+ await this.executeBatchUpdate();
70
+ this.handleTimeout?.(this.getQueuedList());
71
+ return;
72
+ }
73
+ await this.collectBranchForUpdate(child, flp);
143
74
  }
144
- });
145
- } finally {
146
- // Clear the update collection after the batch update
147
- this.flpsToUpdate.clear();
148
-
149
- //Let's remove all the updated FLPs ids from the queue cache
150
- this.clearQueuedList();
151
75
  }
152
- }
153
- getQueuedList() {
154
- return Array.from(this.queued);
155
- }
156
- setQueued(id) {
157
- this.queued.add(id);
158
- }
159
- isQueued(id) {
160
- return this.queued.has(id);
161
- }
162
- clearQueuedList() {
163
- this.queued.clear();
164
- }
165
- async listDirectChildren(flp) {
166
- const listFolders = this.context.container.resolve(ListFoldersUseCase);
167
- const result = await this.context.security.withoutAuthorization(() => {
168
- return listFolders.execute({
169
- where: {
170
- type: flp.type,
171
- parentId: flp.id
76
+ async executeBatchUpdate() {
77
+ try {
78
+ const items = Array.from(this.flpsToUpdate.entries()).map(([id, { slug, parentId, path, permissions }])=>({
79
+ id,
80
+ data: {
81
+ slug,
82
+ parentId,
83
+ path,
84
+ permissions
85
+ }
86
+ }));
87
+ await this.context.aco.flp.batchUpdate(items);
88
+ const folderModel = this.context.container.resolve(FolderModel);
89
+ for (const item of items){
90
+ const { id, data } = item;
91
+ const entryId = EntryId.from(id);
92
+ await this.context.cms.updateEntry(folderModel, entryId.toString(), {
93
+ values: {
94
+ path: data.path
95
+ }
96
+ });
97
+ }
98
+ } catch (error) {
99
+ throw WebinyError.from(error, {
100
+ message: "Error while executing batch update of FLPs",
101
+ code: "BATCH_UPDATE_FLP_ERROR",
102
+ data: {
103
+ items: Array.from(this.flpsToUpdate.keys())
104
+ }
105
+ });
106
+ } finally{
107
+ this.flpsToUpdate.clear();
108
+ this.clearQueuedList();
172
109
  }
173
- });
174
- });
175
- if (result.isFail()) {
176
- throw result.error;
177
110
  }
178
- return await Promise.all(result.value.folders.map(folder => this.getFlp(folder)));
179
- }
180
- async getFlp({
181
- id,
182
- type,
183
- parentId,
184
- slug,
185
- permissions
186
- }) {
187
- const flp = await this.context.aco.flp.get(id);
188
- if (!flp) {
189
- const parentFlp = parentId ? await this.context.aco.flp.get(parentId) : null;
190
- return await this.context.aco.flp.create({
191
- id,
192
- type,
193
- slug,
194
- parentId: parentId ?? ROOT_FOLDER,
195
- path: Path.create(slug, parentFlp?.path),
196
- permissions: Permissions.create(permissions, parentFlp)
197
- });
111
+ getQueuedList() {
112
+ return Array.from(this.queued);
113
+ }
114
+ setQueued(id) {
115
+ this.queued.add(id);
116
+ }
117
+ isQueued(id) {
118
+ return this.queued.has(id);
119
+ }
120
+ clearQueuedList() {
121
+ this.queued.clear();
122
+ }
123
+ async listDirectChildren(flp) {
124
+ const listFolders = this.context.container.resolve(ListFoldersUseCase);
125
+ const result = await this.context.security.withoutAuthorization(()=>listFolders.execute({
126
+ where: {
127
+ type: flp.type,
128
+ parentId: flp.id
129
+ }
130
+ }));
131
+ if (result.isFail()) throw result.error;
132
+ return await Promise.all(result.value.folders.map((folder)=>this.getFlp(folder)));
133
+ }
134
+ async getFlp({ id, type, parentId, slug, permissions }) {
135
+ const flp = await this.context.aco.flp.get(id);
136
+ if (!flp) {
137
+ const parentFlp = parentId ? await this.context.aco.flp.get(parentId) : null;
138
+ return await this.context.aco.flp.create({
139
+ id,
140
+ type,
141
+ slug,
142
+ parentId: parentId ?? ROOT_FOLDER,
143
+ path: Path.create(slug, parentFlp?.path),
144
+ permissions: Permissions.create(permissions, parentFlp)
145
+ });
146
+ }
147
+ return flp;
198
148
  }
199
- return flp;
200
- }
201
149
  }
150
+ export { UpdateFlpUseCase };
202
151
 
203
152
  //# sourceMappingURL=UpdateFlpUseCase.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","Path","Permissions","ROOT_FOLDER","ListFoldersUseCase","FolderModel","EntryId","UpdateFlpUseCase","queued","Set","flpsToUpdate","Map","constructor","context","execute","params","isCloseToTimeout","handleTimeout","forEach","id","add","folder","flp","getFlp","parentFlp","parentId","aco","get","set","slug","path","create","permissions","setQueued","directChildren","listDirectChildren","child","executeBatchUpdate","getQueuedList","collectBranchForUpdate","error","clear","from","message","code","isQueued","parentFlpData","currentParentFlp","children","items","Array","entries","map","data","batchUpdate","folderModel","container","resolve","item","entryId","cms","updateEntry","toString","values","keys","clearQueuedList","has","listFolders","result","security","withoutAuthorization","where","type","isFail","Promise","all","value","folders"],"sources":["UpdateFlpUseCase.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { Path } from \"~/utils/Path.js\";\nimport { Permissions, ROOT_FOLDER } from \"@webiny/shared-aco\";\nimport type { UpdateFlpParams, UpdateFlpUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type { AcoContext, Folder, FolderLevelPermission, FolderPermission } from \"~/types.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/index.js\";\nimport { FolderModel } from \"~/domain/folder/abstractions.js\";\nimport { EntryId } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\n\ninterface FlpUpdateData {\n parentId: string;\n slug: string;\n path: string;\n permissions: FolderPermission[];\n}\n\nexport class UpdateFlpUseCase implements UseCaseAbstraction.Interface {\n private context: AcoContext;\n private isCloseToTimeout?: () => boolean;\n private handleTimeout?: (updated: string[]) => void;\n\n private readonly queued: Set<string> = new Set();\n private readonly flpsToUpdate: Map<string, FlpUpdateData> = new Map();\n\n constructor(context: AcoContext) {\n this.context = context;\n }\n\n async execute(params: UpdateFlpParams): Promise<void> {\n this.isCloseToTimeout = params.isCloseToTimeout;\n this.handleTimeout = params.handleTimeout;\n\n if (params.queued) {\n params.queued.forEach(id => this.queued.add(id));\n }\n\n try {\n const { folder } = params;\n\n if (!folder) {\n throw new WebinyError(\n \"Missing `folder`, I can't update the FLP record.\",\n \"ERROR_UPDATING_FLP_USE_CASE_FOLDER_NOT_PROVIDED\",\n { folder }\n );\n }\n\n const flp = await this.getFlp(folder);\n const parentFlp = folder.parentId\n ? await this.context.aco.flp.get(folder.parentId)\n : null;\n\n // Add the root folder to the update collection\n this.flpsToUpdate.set(folder.id, {\n slug: folder.slug,\n parentId: folder.parentId ?? ROOT_FOLDER,\n path: Path.create(folder.slug, parentFlp?.path),\n permissions: Permissions.create(folder.permissions, parentFlp)\n });\n\n // Let's set the FLP as in queue\n this.setQueued(flp.id);\n\n // Get direct children and process each branch completely\n const directChildren = await this.listDirectChildren(flp);\n\n for (const child of directChildren) {\n if (this.isCloseToTimeout?.()) {\n await this.executeBatchUpdate();\n this.handleTimeout?.(this.getQueuedList());\n return;\n }\n await this.collectBranchForUpdate(child, flp);\n }\n\n // Execute batch update\n await this.executeBatchUpdate();\n } catch (error) {\n // Clear the update collection in case of error\n this.flpsToUpdate.clear();\n this.queued.clear();\n throw WebinyError.from(error, {\n message: \"Error while updating FLP\",\n code: \"ERROR_UPDATING_FLP_USE_CASE\"\n });\n }\n }\n\n private async collectBranchForUpdate(\n flp: FolderLevelPermission,\n parentFlp: FolderLevelPermission\n ): Promise<void> {\n if (this.isQueued(flp.id)) {\n return;\n }\n\n // Get the parent's permissions from the update collection if available\n const parentFlpData = this.flpsToUpdate.get(parentFlp.id);\n const currentParentFlp = {\n ...parentFlp,\n ...(parentFlpData && { ...parentFlpData })\n };\n\n // Add the FLP to the update collection with inherited permissions\n this.flpsToUpdate.set(flp.id, {\n slug: flp.slug,\n parentId: flp.parentId,\n path: Path.create(flp.slug, currentParentFlp.path),\n permissions: Permissions.create(flp.permissions, currentParentFlp)\n });\n\n // Add the FLP to the queue list so we don't fetch it again\n this.setQueued(flp.id);\n\n // Process all children of this folder before moving to siblings\n const children = await this.listDirectChildren(flp);\n\n for (const child of children) {\n if (this.isCloseToTimeout?.()) {\n await this.executeBatchUpdate();\n this.handleTimeout?.(this.getQueuedList());\n return;\n }\n // Pass the current FLP as the parent for the child\n await this.collectBranchForUpdate(child, flp);\n }\n }\n\n private async executeBatchUpdate(): Promise<void> {\n try {\n const items = Array.from(this.flpsToUpdate.entries()).map(\n ([id, { slug, parentId, path, permissions }]) => {\n return {\n id,\n data: {\n slug,\n parentId,\n path,\n permissions\n }\n };\n }\n );\n\n await this.context.aco.flp.batchUpdate(items);\n\n // Update all folders with the new path\n const folderModel = this.context.container.resolve(FolderModel);\n for (const item of items) {\n const { id, data } = item;\n // Directly update the folder in CMS storage to bypass any folder update event triggers.\n const entryId = EntryId.from(id);\n await this.context.cms.updateEntry(folderModel, entryId.toString(), {\n values: {\n path: data.path\n }\n });\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing batch update of FLPs\",\n code: \"BATCH_UPDATE_FLP_ERROR\",\n data: {\n items: Array.from(this.flpsToUpdate.keys())\n }\n });\n } finally {\n // Clear the update collection after the batch update\n this.flpsToUpdate.clear();\n\n //Let's remove all the updated FLPs ids from the queue cache\n this.clearQueuedList();\n }\n }\n\n private getQueuedList(): string[] {\n return Array.from(this.queued);\n }\n\n private setQueued(id: string): void {\n this.queued.add(id);\n }\n\n private isQueued(id: string): boolean {\n return this.queued.has(id);\n }\n\n private clearQueuedList(): void {\n this.queued.clear();\n }\n\n private async listDirectChildren(flp: FolderLevelPermission): Promise<FolderLevelPermission[]> {\n const listFolders = this.context.container.resolve(ListFoldersUseCase);\n\n const result = await this.context.security.withoutAuthorization(() => {\n return listFolders.execute({\n where: {\n type: flp.type,\n parentId: flp.id\n }\n });\n });\n\n if (result.isFail()) {\n throw result.error;\n }\n\n return await Promise.all(result.value.folders.map(folder => this.getFlp(folder)));\n }\n\n private async getFlp({\n id,\n type,\n parentId,\n slug,\n permissions\n }: Folder): Promise<FolderLevelPermission> {\n const flp = await this.context.aco.flp.get(id);\n\n if (!flp) {\n const parentFlp = parentId ? await this.context.aco.flp.get(parentId) : null;\n\n return await this.context.aco.flp.create({\n id,\n type,\n slug,\n parentId: parentId ?? ROOT_FOLDER,\n path: Path.create(slug, parentFlp?.path),\n permissions: Permissions.create(permissions, parentFlp)\n });\n }\n\n return flp;\n }\n}\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,IAAI;AACb,SAASC,WAAW,EAAEC,WAAW,QAAQ,oBAAoB;AAG7D,SAASC,kBAAkB;AAC3B,SAASC,WAAW;AACpB,SAASC,OAAO,QAAQ,mDAAmD;AAS3E,OAAO,MAAMC,gBAAgB,CAAyC;EAKjDC,MAAM,GAAgB,IAAIC,GAAG,CAAC,CAAC;EAC/BC,YAAY,GAA+B,IAAIC,GAAG,CAAC,CAAC;EAErEC,WAAWA,CAACC,OAAmB,EAAE;IAC7B,IAAI,CAACA,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAMC,OAAOA,CAACC,MAAuB,EAAiB;IAClD,IAAI,CAACC,gBAAgB,GAAGD,MAAM,CAACC,gBAAgB;IAC/C,IAAI,CAACC,aAAa,GAAGF,MAAM,CAACE,aAAa;IAEzC,IAAIF,MAAM,CAACP,MAAM,EAAE;MACfO,MAAM,CAACP,MAAM,CAACU,OAAO,CAACC,EAAE,IAAI,IAAI,CAACX,MAAM,CAACY,GAAG,CAACD,EAAE,CAAC,CAAC;IACpD;IAEA,IAAI;MACA,MAAM;QAAEE;MAAO,CAAC,GAAGN,MAAM;MAEzB,IAAI,CAACM,MAAM,EAAE;QACT,MAAM,IAAIrB,WAAW,CACjB,kDAAkD,EAClD,iDAAiD,EACjD;UAAEqB;QAAO,CACb,CAAC;MACL;MAEA,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACC,MAAM,CAACF,MAAM,CAAC;MACrC,MAAMG,SAAS,GAAGH,MAAM,CAACI,QAAQ,GAC3B,MAAM,IAAI,CAACZ,OAAO,CAACa,GAAG,CAACJ,GAAG,CAACK,GAAG,CAACN,MAAM,CAACI,QAAQ,CAAC,GAC/C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EAAE;MACN,MAAME,SAAS,GAAGC,QAAQ,GAAG,MAAM,IAAI,CAACZ,OAAO,CAACa,GAAG,CAACJ,GAAG,CAACK,GAAG,CAACF,QAAQ,CAAC,GAAG,IAAI;MAE5E,OAAO,MAAM,IAAI,CAACZ,OAAO,CAACa,GAAG,CAACJ,GAAG,CAACS,MAAM,CAAC;QACrCZ,EAAE;QACFqD,IAAI;QACJ3C,IAAI;QACJJ,QAAQ,EAAEA,QAAQ,IAAItB,WAAW;QACjC2B,IAAI,EAAE7B,IAAI,CAAC8B,MAAM,CAACF,IAAI,EAAEL,SAAS,EAAEM,IAAI,CAAC;QACxCE,WAAW,EAAE9B,WAAW,CAAC6B,MAAM,CAACC,WAAW,EAAER,SAAS;MAC1D,CAAC,CAAC;IACN;IAEA,OAAOF,GAAG;EACd;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"features/flp/UpdateFlp/UpdateFlpUseCase.js","sources":["../../../../src/features/flp/UpdateFlp/UpdateFlpUseCase.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { Path } from \"~/utils/Path.js\";\nimport { Permissions, ROOT_FOLDER } from \"@webiny/shared-aco\";\nimport type { UpdateFlpParams, UpdateFlpUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type { AcoContext, Folder, FolderLevelPermission, FolderPermission } from \"~/types.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/index.js\";\nimport { FolderModel } from \"~/domain/folder/abstractions.js\";\nimport { EntryId } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\n\ninterface FlpUpdateData {\n parentId: string;\n slug: string;\n path: string;\n permissions: FolderPermission[];\n}\n\nexport class UpdateFlpUseCase implements UseCaseAbstraction.Interface {\n private context: AcoContext;\n private isCloseToTimeout?: () => boolean;\n private handleTimeout?: (updated: string[]) => void;\n\n private readonly queued: Set<string> = new Set();\n private readonly flpsToUpdate: Map<string, FlpUpdateData> = new Map();\n\n constructor(context: AcoContext) {\n this.context = context;\n }\n\n async execute(params: UpdateFlpParams): Promise<void> {\n this.isCloseToTimeout = params.isCloseToTimeout;\n this.handleTimeout = params.handleTimeout;\n\n if (params.queued) {\n params.queued.forEach(id => this.queued.add(id));\n }\n\n try {\n const { folder } = params;\n\n if (!folder) {\n throw new WebinyError(\n \"Missing `folder`, I can't update the FLP record.\",\n \"ERROR_UPDATING_FLP_USE_CASE_FOLDER_NOT_PROVIDED\",\n { folder }\n );\n }\n\n const flp = await this.getFlp(folder);\n const parentFlp = folder.parentId\n ? await this.context.aco.flp.get(folder.parentId)\n : null;\n\n // Add the root folder to the update collection\n this.flpsToUpdate.set(folder.id, {\n slug: folder.slug,\n parentId: folder.parentId ?? ROOT_FOLDER,\n path: Path.create(folder.slug, parentFlp?.path),\n permissions: Permissions.create(folder.permissions, parentFlp)\n });\n\n // Let's set the FLP as in queue\n this.setQueued(flp.id);\n\n // Get direct children and process each branch completely\n const directChildren = await this.listDirectChildren(flp);\n\n for (const child of directChildren) {\n if (this.isCloseToTimeout?.()) {\n await this.executeBatchUpdate();\n this.handleTimeout?.(this.getQueuedList());\n return;\n }\n await this.collectBranchForUpdate(child, flp);\n }\n\n // Execute batch update\n await this.executeBatchUpdate();\n } catch (error) {\n // Clear the update collection in case of error\n this.flpsToUpdate.clear();\n this.queued.clear();\n throw WebinyError.from(error, {\n message: \"Error while updating FLP\",\n code: \"ERROR_UPDATING_FLP_USE_CASE\"\n });\n }\n }\n\n private async collectBranchForUpdate(\n flp: FolderLevelPermission,\n parentFlp: FolderLevelPermission\n ): Promise<void> {\n if (this.isQueued(flp.id)) {\n return;\n }\n\n // Get the parent's permissions from the update collection if available\n const parentFlpData = this.flpsToUpdate.get(parentFlp.id);\n const currentParentFlp = {\n ...parentFlp,\n ...(parentFlpData && { ...parentFlpData })\n };\n\n // Add the FLP to the update collection with inherited permissions\n this.flpsToUpdate.set(flp.id, {\n slug: flp.slug,\n parentId: flp.parentId,\n path: Path.create(flp.slug, currentParentFlp.path),\n permissions: Permissions.create(flp.permissions, currentParentFlp)\n });\n\n // Add the FLP to the queue list so we don't fetch it again\n this.setQueued(flp.id);\n\n // Process all children of this folder before moving to siblings\n const children = await this.listDirectChildren(flp);\n\n for (const child of children) {\n if (this.isCloseToTimeout?.()) {\n await this.executeBatchUpdate();\n this.handleTimeout?.(this.getQueuedList());\n return;\n }\n // Pass the current FLP as the parent for the child\n await this.collectBranchForUpdate(child, flp);\n }\n }\n\n private async executeBatchUpdate(): Promise<void> {\n try {\n const items = Array.from(this.flpsToUpdate.entries()).map(\n ([id, { slug, parentId, path, permissions }]) => {\n return {\n id,\n data: {\n slug,\n parentId,\n path,\n permissions\n }\n };\n }\n );\n\n await this.context.aco.flp.batchUpdate(items);\n\n // Update all folders with the new path\n const folderModel = this.context.container.resolve(FolderModel);\n for (const item of items) {\n const { id, data } = item;\n // Directly update the folder in CMS storage to bypass any folder update event triggers.\n const entryId = EntryId.from(id);\n await this.context.cms.updateEntry(folderModel, entryId.toString(), {\n values: {\n path: data.path\n }\n });\n }\n } catch (error) {\n throw WebinyError.from(error, {\n message: \"Error while executing batch update of FLPs\",\n code: \"BATCH_UPDATE_FLP_ERROR\",\n data: {\n items: Array.from(this.flpsToUpdate.keys())\n }\n });\n } finally {\n // Clear the update collection after the batch update\n this.flpsToUpdate.clear();\n\n //Let's remove all the updated FLPs ids from the queue cache\n this.clearQueuedList();\n }\n }\n\n private getQueuedList(): string[] {\n return Array.from(this.queued);\n }\n\n private setQueued(id: string): void {\n this.queued.add(id);\n }\n\n private isQueued(id: string): boolean {\n return this.queued.has(id);\n }\n\n private clearQueuedList(): void {\n this.queued.clear();\n }\n\n private async listDirectChildren(flp: FolderLevelPermission): Promise<FolderLevelPermission[]> {\n const listFolders = this.context.container.resolve(ListFoldersUseCase);\n\n const result = await this.context.security.withoutAuthorization(() => {\n return listFolders.execute({\n where: {\n type: flp.type,\n parentId: flp.id\n }\n });\n });\n\n if (result.isFail()) {\n throw result.error;\n }\n\n return await Promise.all(result.value.folders.map(folder => this.getFlp(folder)));\n }\n\n private async getFlp({\n id,\n type,\n parentId,\n slug,\n permissions\n }: Folder): Promise<FolderLevelPermission> {\n const flp = await this.context.aco.flp.get(id);\n\n if (!flp) {\n const parentFlp = parentId ? await this.context.aco.flp.get(parentId) : null;\n\n return await this.context.aco.flp.create({\n id,\n type,\n slug,\n parentId: parentId ?? ROOT_FOLDER,\n path: Path.create(slug, parentFlp?.path),\n permissions: Permissions.create(permissions, parentFlp)\n });\n }\n\n return flp;\n }\n}\n"],"names":["UpdateFlpUseCase","context","Set","Map","params","id","folder","WebinyError","flp","parentFlp","ROOT_FOLDER","Path","Permissions","directChildren","child","error","parentFlpData","currentParentFlp","children","items","Array","slug","parentId","path","permissions","folderModel","FolderModel","item","data","entryId","EntryId","listFolders","ListFoldersUseCase","result","Promise","type"],"mappings":";;;;;;AAgBO,MAAMA;IAQT,YAAYC,OAAmB,CAAE;aAHhB,MAAM,GAAgB,IAAIC;aAC1B,YAAY,GAA+B,IAAIC;QAG5D,IAAI,CAAC,OAAO,GAAGF;IACnB;IAEA,MAAM,QAAQG,MAAuB,EAAiB;QAClD,IAAI,CAAC,gBAAgB,GAAGA,OAAO,gBAAgB;QAC/C,IAAI,CAAC,aAAa,GAAGA,OAAO,aAAa;QAEzC,IAAIA,OAAO,MAAM,EACbA,OAAO,MAAM,CAAC,OAAO,CAACC,CAAAA,KAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAACA;QAGhD,IAAI;YACA,MAAM,EAAEC,MAAM,EAAE,GAAGF;YAEnB,IAAI,CAACE,QACD,MAAM,IAAIC,YACN,oDACA,mDACA;gBAAED;YAAO;YAIjB,MAAME,MAAM,MAAM,IAAI,CAAC,MAAM,CAACF;YAC9B,MAAMG,YAAYH,OAAO,QAAQ,GAC3B,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAACA,OAAO,QAAQ,IAC9C;YAGN,IAAI,CAAC,YAAY,CAAC,GAAG,CAACA,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AAUC,YAAYZ;gBACtB,MAAMC,KAAK,MAAM,CAACU,MAAMZ,WAAW;gBACnC,aAAaG,YAAY,MAAM,CAACY,aAAaf;YACjD;QACJ;QAEA,OAAOD;IACX;AACJ"}
@@ -8,6 +8,7 @@ export interface UpdateFlpParams {
8
8
  export interface IUpdateFlpUseCase {
9
9
  execute: (params: UpdateFlpParams) => Promise<void>;
10
10
  }
11
+ /** Update a folder-level permission. */
11
12
  export declare const UpdateFlpUseCase: import("@webiny/di").Abstraction<IUpdateFlpUseCase>;
12
13
  export declare namespace UpdateFlpUseCase {
13
14
  type Interface = IUpdateFlpUseCase;
@@ -1,7 +1,5 @@
1
1
  import { createAbstraction } from "@webiny/feature/api";
2
-
3
- // Use Case Abstraction
4
-
5
- export const UpdateFlpUseCase = createAbstraction("UpdateFlpUseCase");
2
+ const UpdateFlpUseCase = createAbstraction("UpdateFlpUseCase");
3
+ export { UpdateFlpUseCase };
6
4
 
7
5
  //# sourceMappingURL=abstractions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","UpdateFlpUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Folder } from \"~/folder/folder.types.js\";\n\nexport interface UpdateFlpParams {\n folder: Folder;\n queued?: string[];\n isCloseToTimeout?: () => boolean;\n handleTimeout?: (queued: string[]) => void;\n}\n\n// Use Case Abstraction\nexport interface IUpdateFlpUseCase {\n execute: (params: UpdateFlpParams) => Promise<void>;\n}\n\nexport const UpdateFlpUseCase = createAbstraction<IUpdateFlpUseCase>(\"UpdateFlpUseCase\");\n\nexport namespace UpdateFlpUseCase {\n export type Interface = IUpdateFlpUseCase;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAUvD;;AAKA,OAAO,MAAMC,gBAAgB,GAAGD,iBAAiB,CAAoB,kBAAkB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/flp/UpdateFlp/abstractions.js","sources":["../../../../src/features/flp/UpdateFlp/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Folder } from \"~/folder/folder.types.js\";\n\nexport interface UpdateFlpParams {\n folder: Folder;\n queued?: string[];\n isCloseToTimeout?: () => boolean;\n handleTimeout?: (queued: string[]) => void;\n}\n\n// Use Case Abstraction\nexport interface IUpdateFlpUseCase {\n execute: (params: UpdateFlpParams) => Promise<void>;\n}\n\n/** Update a folder-level permission. */\nexport const UpdateFlpUseCase = createAbstraction<IUpdateFlpUseCase>(\"UpdateFlpUseCase\");\n\nexport namespace UpdateFlpUseCase {\n export type Interface = IUpdateFlpUseCase;\n}\n"],"names":["UpdateFlpUseCase","createAbstraction"],"mappings":";AAgBO,MAAMA,mBAAmBC,kBAAqC"}
@@ -1,6 +1,10 @@
1
+ import type { Container } from "@webiny/di";
1
2
  import type { AcoContext } from "../../../types.js";
2
3
  interface LegacyDeps {
3
4
  context: AcoContext;
4
5
  }
5
- export declare const UpdateFlpFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<LegacyDeps>;
6
+ export declare const UpdateFlpFeature: {
7
+ name: string;
8
+ register(container: Container, context: LegacyDeps): void;
9
+ };
6
10
  export {};
@@ -1,13 +1,12 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { UpdateFlpUseCase } from "./UpdateFlpUseCase.js";
3
- import { UpdateFlpUseCase as UseCaseAbstraction } from "./abstractions.js";
4
- export const UpdateFlpFeature = createFeature({
5
- name: "UpdateFlp",
6
- register(container, deps) {
7
- container.registerFactory(UseCaseAbstraction, () => {
8
- return new UpdateFlpUseCase(deps.context);
9
- });
10
- }
3
+ import { UpdateFlpUseCase as external_abstractions_js_UpdateFlpUseCase } from "./abstractions.js";
4
+ const UpdateFlpFeature = createFeature({
5
+ name: "UpdateFlp",
6
+ register (container, deps) {
7
+ container.registerFactory(external_abstractions_js_UpdateFlpUseCase, ()=>new UpdateFlpUseCase(deps.context));
8
+ }
11
9
  });
10
+ export { UpdateFlpFeature };
12
11
 
13
12
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","UpdateFlpUseCase","UseCaseAbstraction","UpdateFlpFeature","name","register","container","deps","registerFactory","context"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport { UpdateFlpUseCase } from \"./UpdateFlpUseCase.js\";\nimport { UpdateFlpUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type { AcoContext } from \"~/types.js\";\n\ninterface LegacyDeps {\n context: AcoContext;\n}\n\nexport const UpdateFlpFeature = createFeature({\n name: \"UpdateFlp\",\n register(container: Container, deps: LegacyDeps) {\n container.registerFactory(UseCaseAbstraction, () => {\n return new UpdateFlpUseCase(deps.context);\n });\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AAEnD,SAASC,gBAAgB;AACzB,SAASA,gBAAgB,IAAIC,kBAAkB;AAO/C,OAAO,MAAMC,gBAAgB,GAAGH,aAAa,CAAC;EAC1CI,IAAI,EAAE,WAAW;EACjBC,QAAQA,CAACC,SAAoB,EAAEC,IAAgB,EAAE;IAC7CD,SAAS,CAACE,eAAe,CAACN,kBAAkB,EAAE,MAAM;MAChD,OAAO,IAAID,gBAAgB,CAACM,IAAI,CAACE,OAAO,CAAC;IAC7C,CAAC,CAAC;EACN;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/flp/UpdateFlp/feature.js","sources":["../../../../src/features/flp/UpdateFlp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport { UpdateFlpUseCase } from \"./UpdateFlpUseCase.js\";\nimport { UpdateFlpUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type { AcoContext } from \"~/types.js\";\n\ninterface LegacyDeps {\n context: AcoContext;\n}\n\nexport const UpdateFlpFeature = createFeature({\n name: \"UpdateFlp\",\n register(container: Container, deps: LegacyDeps) {\n container.registerFactory(UseCaseAbstraction, () => {\n return new UpdateFlpUseCase(deps.context);\n });\n }\n});\n"],"names":["UpdateFlpFeature","createFeature","container","deps","UseCaseAbstraction","UpdateFlpUseCase"],"mappings":";;;AAUO,MAAMA,mBAAmBC,cAAc;IAC1C,MAAM;IACN,UAASC,SAAoB,EAAEC,IAAgB;QAC3CD,UAAU,eAAe,CAACE,2CAAoB,IACnC,IAAIC,iBAAiBF,KAAK,OAAO;IAEhD;AACJ"}
@@ -1,4 +1,2 @@
1
1
  export { UpdateFlpFeature } from "./feature.js";
2
2
  export { UpdateFlpUseCase } from "./abstractions.js";
3
-
4
- //# sourceMappingURL=index.js.map
@@ -1,14 +1,14 @@
1
1
  import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
2
2
  import { UpdateFlpUseCase } from "../UpdateFlp/abstractions.js";
3
3
  import type { FolderAfterUpdateEvent } from "../../../features/folder/UpdateFolder/events.js";
4
- import { FolderAfterUpdateHandler } from "../../../features/folder/UpdateFolder/index.js";
5
- declare class UpdateFlpOnFolderUpdatedHandlerImpl implements FolderAfterUpdateHandler.Interface {
4
+ import { FolderAfterUpdateEventHandler } from "../../../features/folder/UpdateFolder/index.js";
5
+ declare class UpdateFlpOnFolderUpdatedHandlerImpl implements FolderAfterUpdateEventHandler.Interface {
6
6
  private updateFlpUseCase;
7
7
  private tasks?;
8
8
  constructor(updateFlpUseCase: UpdateFlpUseCase.Interface, tasks?: TaskService.Interface | undefined);
9
9
  handle(event: FolderAfterUpdateEvent): Promise<void>;
10
10
  }
11
11
  export declare const UpdateFlpOnFolderUpdatedHandler: typeof UpdateFlpOnFolderUpdatedHandlerImpl & {
12
- __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-core/features/EventPublisher").DomainEvent<import("../../folder/UpdateFolder/abstractions.js").FolderAfterUpdatePayload>>>;
12
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-core/features/eventPublisher/abstractions.js").DomainEvent<import("../../folder/UpdateFolder/abstractions.js").FolderAfterUpdatePayload>>>;
13
13
  };
14
14
  export {};
@@ -1,39 +1,39 @@
1
1
  import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
2
2
  import { UpdateFlpUseCase } from "../UpdateFlp/abstractions.js";
3
3
  import { UPDATE_FLP_TASK_ID } from "../../../flp/tasks/index.js";
4
- import { FolderAfterUpdateHandler } from "../../folder/UpdateFolder/index.js";
4
+ import { FolderAfterUpdateEventHandler } from "../../folder/UpdateFolder/index.js";
5
5
  class UpdateFlpOnFolderUpdatedHandlerImpl {
6
- constructor(updateFlpUseCase, tasks) {
7
- this.updateFlpUseCase = updateFlpUseCase;
8
- this.tasks = tasks;
9
- }
10
- async handle(event) {
11
- const {
12
- folder
13
- } = event.payload;
14
- try {
15
- if (this.tasks) {
16
- await this.tasks.trigger({
17
- definition: UPDATE_FLP_TASK_ID,
18
- input: {
19
- folder
20
- }
21
- });
22
- } else {
23
- await this.updateFlpUseCase.execute({
24
- folder
25
- });
26
- }
27
- } catch {
28
- // Ignore errors
6
+ constructor(updateFlpUseCase, tasks){
7
+ this.updateFlpUseCase = updateFlpUseCase;
8
+ this.tasks = tasks;
9
+ }
10
+ async handle(event) {
11
+ const { folder } = event.payload;
12
+ try {
13
+ if (this.tasks) await this.tasks.trigger({
14
+ definition: UPDATE_FLP_TASK_ID,
15
+ input: {
16
+ folder
17
+ }
18
+ });
19
+ else await this.updateFlpUseCase.execute({
20
+ folder
21
+ });
22
+ } catch {}
29
23
  }
30
- }
31
24
  }
32
- export const UpdateFlpOnFolderUpdatedHandler = FolderAfterUpdateHandler.createImplementation({
33
- implementation: UpdateFlpOnFolderUpdatedHandlerImpl,
34
- dependencies: [UpdateFlpUseCase, [TaskService, {
35
- optional: true
36
- }]]
25
+ const UpdateFlpOnFolderUpdatedHandler = FolderAfterUpdateEventHandler.createImplementation({
26
+ implementation: UpdateFlpOnFolderUpdatedHandlerImpl,
27
+ dependencies: [
28
+ UpdateFlpUseCase,
29
+ [
30
+ TaskService,
31
+ {
32
+ optional: true
33
+ }
34
+ ]
35
+ ]
37
36
  });
37
+ export { UpdateFlpOnFolderUpdatedHandler };
38
38
 
39
39
  //# sourceMappingURL=UpdateFlpOnFolderUpdatedHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TaskService","UpdateFlpUseCase","UPDATE_FLP_TASK_ID","FolderAfterUpdateHandler","UpdateFlpOnFolderUpdatedHandlerImpl","constructor","updateFlpUseCase","tasks","handle","event","folder","payload","trigger","definition","input","execute","UpdateFlpOnFolderUpdatedHandler","createImplementation","implementation","dependencies","optional"],"sources":["UpdateFlpOnFolderUpdatedHandler.ts"],"sourcesContent":["import { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { UpdateFlpUseCase } from \"../UpdateFlp/abstractions.js\";\nimport type { FolderAfterUpdateEvent } from \"~/features/folder/UpdateFolder/events.js\";\nimport type { IUpdateFlpTaskInput } from \"~/types.js\";\nimport { UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { FolderAfterUpdateHandler } from \"~/features/folder/UpdateFolder/index.js\";\n\nclass UpdateFlpOnFolderUpdatedHandlerImpl implements FolderAfterUpdateHandler.Interface {\n constructor(\n private updateFlpUseCase: UpdateFlpUseCase.Interface,\n private tasks?: TaskService.Interface\n ) {}\n\n async handle(event: FolderAfterUpdateEvent): Promise<void> {\n const { folder } = event.payload;\n\n try {\n if (this.tasks) {\n await this.tasks.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: { folder }\n });\n } else {\n await this.updateFlpUseCase.execute({ folder });\n }\n } catch {\n // Ignore errors\n }\n }\n}\n\nexport const UpdateFlpOnFolderUpdatedHandler = FolderAfterUpdateHandler.createImplementation({\n implementation: UpdateFlpOnFolderUpdatedHandlerImpl,\n dependencies: [UpdateFlpUseCase, [TaskService, { optional: true }]]\n});\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,qDAAqD;AACjF,SAASC,gBAAgB;AAGzB,SAASC,kBAAkB;AAC3B,SAASC,wBAAwB;AAEjC,MAAMC,mCAAmC,CAA+C;EACpFC,WAAWA,CACCC,gBAA4C,EAC5CC,KAA6B,EACvC;IAAA,KAFUD,gBAA4C,GAA5CA,gBAA4C;IAAA,KAC5CC,KAA6B,GAA7BA,KAA6B;EACtC;EAEH,MAAMC,MAAMA,CAACC,KAA6B,EAAiB;IACvD,MAAM;MAAEC;IAAO,CAAC,GAAGD,KAAK,CAACE,OAAO;IAEhC,IAAI;MACA,IAAI,IAAI,CAACJ,KAAK,EAAE;QACZ,MAAM,IAAI,CAACA,KAAK,CAACK,OAAO,CAAsB;UAC1CC,UAAU,EAAEX,kBAAkB;UAC9BY,KAAK,EAAE;YAAEJ;UAAO;QACpB,CAAC,CAAC;MACN,CAAC,MAAM;QACH,MAAM,IAAI,CAACJ,gBAAgB,CAACS,OAAO,CAAC;UAAEL;QAAO,CAAC,CAAC;MACnD;IACJ,CAAC,CAAC,MAAM;MACJ;IAAA;EAER;AACJ;AAEA,OAAO,MAAMM,+BAA+B,GAAGb,wBAAwB,CAACc,oBAAoB,CAAC;EACzFC,cAAc,EAAEd,mCAAmC;EACnDe,YAAY,EAAE,CAAClB,gBAAgB,EAAE,CAACD,WAAW,EAAE;IAAEoB,QAAQ,EAAE;EAAK,CAAC,CAAC;AACtE,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js","sources":["../../../../src/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.ts"],"sourcesContent":["import { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { UpdateFlpUseCase } from \"../UpdateFlp/abstractions.js\";\nimport type { FolderAfterUpdateEvent } from \"~/features/folder/UpdateFolder/events.js\";\nimport type { IUpdateFlpTaskInput } from \"~/types.js\";\nimport { UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { FolderAfterUpdateEventHandler } from \"~/features/folder/UpdateFolder/index.js\";\n\nclass UpdateFlpOnFolderUpdatedHandlerImpl implements FolderAfterUpdateEventHandler.Interface {\n constructor(\n private updateFlpUseCase: UpdateFlpUseCase.Interface,\n private tasks?: TaskService.Interface\n ) {}\n\n async handle(event: FolderAfterUpdateEvent): Promise<void> {\n const { folder } = event.payload;\n\n try {\n if (this.tasks) {\n await this.tasks.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: { folder }\n });\n } else {\n await this.updateFlpUseCase.execute({ folder });\n }\n } catch {\n // Ignore errors\n }\n }\n}\n\nexport const UpdateFlpOnFolderUpdatedHandler = FolderAfterUpdateEventHandler.createImplementation({\n implementation: UpdateFlpOnFolderUpdatedHandlerImpl,\n dependencies: [UpdateFlpUseCase, [TaskService, { optional: true }]]\n});\n"],"names":["UpdateFlpOnFolderUpdatedHandlerImpl","updateFlpUseCase","tasks","event","folder","UPDATE_FLP_TASK_ID","UpdateFlpOnFolderUpdatedHandler","FolderAfterUpdateEventHandler","UpdateFlpUseCase","TaskService"],"mappings":";;;;AAOA,MAAMA;IACF,YACYC,gBAA4C,EAC5CC,KAA6B,CACvC;aAFUD,gBAAgB,GAAhBA;aACAC,KAAK,GAALA;IACT;IAEH,MAAM,OAAOC,KAA6B,EAAiB;QACvD,MAAM,EAAEC,MAAM,EAAE,GAAGD,MAAM,OAAO;QAEhC,IAAI;YACA,IAAI,IAAI,CAAC,KAAK,EACV,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAsB;gBAC1C,YAAYE;gBACZ,OAAO;oBAAED;gBAAO;YACpB;iBAEA,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;gBAAEA;YAAO;QAErD,EAAE,OAAM,CAER;IACJ;AACJ;AAEO,MAAME,kCAAkCC,8BAA8B,oBAAoB,CAAC;IAC9F,gBAAgBP;IAChB,cAAc;QAACQ;QAAkB;YAACC;YAAa;gBAAE,UAAU;YAAK;SAAE;KAAC;AACvE"}
@@ -1 +1,4 @@
1
- export declare const UpdateFlpOnFolderUpdatedFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const UpdateFlpOnFolderUpdatedFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1,10 +1,11 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { UpdateFlpOnFolderUpdatedHandler } from "./UpdateFlpOnFolderUpdatedHandler.js";
3
- export const UpdateFlpOnFolderUpdatedFeature = createFeature({
4
- name: "UpdateFlpOnFolderUpdated",
5
- register(container) {
6
- container.register(UpdateFlpOnFolderUpdatedHandler);
7
- }
3
+ const UpdateFlpOnFolderUpdatedFeature = createFeature({
4
+ name: "UpdateFlpOnFolderUpdated",
5
+ register (container) {
6
+ container.register(UpdateFlpOnFolderUpdatedHandler);
7
+ }
8
8
  });
9
+ export { UpdateFlpOnFolderUpdatedFeature };
9
10
 
10
11
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","UpdateFlpOnFolderUpdatedHandler","UpdateFlpOnFolderUpdatedFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { UpdateFlpOnFolderUpdatedHandler } from \"./UpdateFlpOnFolderUpdatedHandler.js\";\n\nexport const UpdateFlpOnFolderUpdatedFeature = createFeature({\n name: \"UpdateFlpOnFolderUpdated\",\n register(container) {\n container.register(UpdateFlpOnFolderUpdatedHandler);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,+BAA+B;AAExC,OAAO,MAAMC,+BAA+B,GAAGF,aAAa,CAAC;EACzDG,IAAI,EAAE,0BAA0B;EAChCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,+BAA+B,CAAC;EACvD;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/flp/UpdateFlpOnFolderUpdated/feature.js","sources":["../../../../src/features/flp/UpdateFlpOnFolderUpdated/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { UpdateFlpOnFolderUpdatedHandler } from \"./UpdateFlpOnFolderUpdatedHandler.js\";\n\nexport const UpdateFlpOnFolderUpdatedFeature = createFeature({\n name: \"UpdateFlpOnFolderUpdated\",\n register(container) {\n container.register(UpdateFlpOnFolderUpdatedHandler);\n }\n});\n"],"names":["UpdateFlpOnFolderUpdatedFeature","createFeature","container","UpdateFlpOnFolderUpdatedHandler"],"mappings":";;AAGO,MAAMA,kCAAkCC,cAAc;IACzD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,3 +1 @@
1
1
  export { UpdateFlpOnFolderUpdatedFeature } from "./feature.js";
2
-
3
- //# sourceMappingURL=index.js.map