@webiny/api-aco 6.6.0-alpha.1 → 6.6.0-alpha.10

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 (308) hide show
  1. package/AcoFeature.js +14 -36
  2. package/AcoFeature.js.map +1 -1
  3. package/AcoFolderSchemaFactory.d.ts +2 -0
  4. package/AcoFolderSchemaFactory.js +25 -7
  5. package/AcoFolderSchemaFactory.js.map +1 -1
  6. package/domain/folder/folder.model.js +2 -1
  7. package/domain/folder/folder.model.js.map +1 -1
  8. package/exports/api/aco/flp.d.ts +3 -3
  9. package/exports/api/aco/flp.js +2 -3
  10. package/features/ai/CreateFolderTool.d.ts +11 -6
  11. package/features/ai/CreateFolderTool.js +20 -11
  12. package/features/ai/CreateFolderTool.js.map +1 -1
  13. package/features/ai/CreateTeamTool.d.ts +11 -6
  14. package/features/ai/CreateTeamTool.js +20 -11
  15. package/features/ai/CreateTeamTool.js.map +1 -1
  16. package/features/ai/DeleteFolderTool.d.ts +48 -0
  17. package/features/ai/DeleteFolderTool.js +55 -0
  18. package/features/ai/DeleteFolderTool.js.map +1 -0
  19. package/features/ai/GrantFolderAccessTool.d.ts +13 -8
  20. package/features/ai/GrantFolderAccessTool.js +20 -11
  21. package/features/ai/GrantFolderAccessTool.js.map +1 -1
  22. package/features/ai/ListFoldersTool.d.ts +11 -6
  23. package/features/ai/ListFoldersTool.js +21 -12
  24. package/features/ai/ListFoldersTool.js.map +1 -1
  25. package/features/ai/ListRolesTool.d.ts +11 -6
  26. package/features/ai/ListRolesTool.js +21 -12
  27. package/features/ai/ListRolesTool.js.map +1 -1
  28. package/features/ai/ListTeamsTool.d.ts +11 -6
  29. package/features/ai/ListTeamsTool.js +21 -12
  30. package/features/ai/ListTeamsTool.js.map +1 -1
  31. package/features/ai/RevokeFolderAccessTool.d.ts +12 -7
  32. package/features/ai/RevokeFolderAccessTool.js +21 -12
  33. package/features/ai/RevokeFolderAccessTool.js.map +1 -1
  34. package/features/ai/feature.d.ts +1 -1
  35. package/features/ai/feature.js +2 -0
  36. package/features/ai/feature.js.map +1 -1
  37. package/features/ai/index.d.ts +1 -0
  38. package/features/ai/index.js +1 -0
  39. package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.d.ts +4 -4
  40. package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js +7 -8
  41. package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js.map +1 -1
  42. package/features/cms/decorators/ListEntriesWithFlpDecorator.d.ts +3 -3
  43. package/features/cms/decorators/ListEntriesWithFlpDecorator.js +7 -8
  44. package/features/cms/decorators/ListEntriesWithFlpDecorator.js.map +1 -1
  45. package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.d.ts +4 -4
  46. package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js +7 -8
  47. package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js.map +1 -1
  48. package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.d.ts +4 -4
  49. package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js +7 -8
  50. package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js.map +1 -1
  51. package/features/flp/CreateFlp/index.d.ts +0 -1
  52. package/features/flp/CreateFlp/index.js +0 -1
  53. package/features/flp/DeleteFlp/index.d.ts +0 -1
  54. package/features/flp/DeleteFlp/index.js +0 -1
  55. package/features/flp/FolderAccessListFilter/abstractions.d.ts +33 -0
  56. package/features/flp/FolderAccessListFilter/abstractions.js +5 -0
  57. package/features/flp/FolderAccessListFilter/abstractions.js.map +1 -0
  58. package/features/flp/FolderAccessListFilter/index.d.ts +1 -0
  59. package/features/flp/FolderAccessListFilter/index.js +1 -0
  60. package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.d.ts +8 -0
  61. package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.js +15 -0
  62. package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.js.map +1 -0
  63. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.d.ts +11 -0
  64. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js +19 -0
  65. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js.map +1 -0
  66. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.d.ts +11 -0
  67. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js +19 -0
  68. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js.map +1 -0
  69. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.d.ts +11 -0
  70. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js +23 -0
  71. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js.map +1 -0
  72. package/features/flp/FolderCatalogSync/abstractions.d.ts +25 -0
  73. package/features/flp/FolderCatalogSync/abstractions.js +5 -0
  74. package/features/flp/FolderCatalogSync/abstractions.js.map +1 -0
  75. package/features/flp/FolderCatalogSync/index.d.ts +2 -0
  76. package/features/flp/FolderCatalogSync/index.js +2 -0
  77. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.d.ts +5 -2
  78. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +19 -5
  79. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
  80. package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.d.ts +1 -0
  81. package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js +3 -0
  82. package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js.map +1 -1
  83. package/features/flp/FolderLevelPermissions/abstractions.d.ts +8 -2
  84. package/features/flp/FolderLevelPermissions/abstractions.js.map +1 -1
  85. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.d.ts +12 -0
  86. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js +22 -14
  87. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js.map +1 -1
  88. package/features/flp/FolderPermissionsRepository/abstractions.d.ts +28 -0
  89. package/features/flp/FolderPermissionsRepository/abstractions.js +5 -0
  90. package/features/flp/FolderPermissionsRepository/abstractions.js.map +1 -0
  91. package/features/flp/FolderPermissionsRepository/index.d.ts +1 -0
  92. package/features/flp/FolderPermissionsRepository/index.js +1 -0
  93. package/features/flp/GetFlp/GetFlpUseCase.d.ts +10 -5
  94. package/features/flp/GetFlp/GetFlpUseCase.js +13 -5
  95. package/features/flp/GetFlp/GetFlpUseCase.js.map +1 -1
  96. package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.d.ts +13 -0
  97. package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js +26 -0
  98. package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js.map +1 -0
  99. package/features/flp/GetFlp/feature.js +1 -3
  100. package/features/flp/GetFlp/feature.js.map +1 -1
  101. package/features/flp/ListFlps/ListFlpsUseCase.d.ts +11 -6
  102. package/features/flp/ListFlps/ListFlpsUseCase.js +13 -5
  103. package/features/flp/ListFlps/ListFlpsUseCase.js.map +1 -1
  104. package/features/flp/ListFlps/abstractions.d.ts +3 -9
  105. package/features/flp/ListFlps/abstractions.js.map +1 -1
  106. package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.d.ts +13 -0
  107. package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js +27 -0
  108. package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js.map +1 -0
  109. package/features/flp/ListFlps/feature.js +1 -3
  110. package/features/flp/ListFlps/feature.js.map +1 -1
  111. package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.d.ts +14 -0
  112. package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js +36 -0
  113. package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js.map +1 -0
  114. package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.d.ts +25 -0
  115. package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js +75 -0
  116. package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js.map +1 -0
  117. package/features/flp/ListFolderAccess/ListEntryAccessUseCase.d.ts +13 -0
  118. package/features/flp/ListFolderAccess/ListEntryAccessUseCase.js +28 -0
  119. package/features/flp/ListFolderAccess/ListEntryAccessUseCase.js.map +1 -0
  120. package/features/flp/ListFolderAccess/ListFolderAccessUseCase.d.ts +24 -0
  121. package/features/flp/ListFolderAccess/ListFolderAccessUseCase.js +107 -0
  122. package/features/flp/ListFolderAccess/ListFolderAccessUseCase.js.map +1 -0
  123. package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.d.ts +28 -0
  124. package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.js +98 -0
  125. package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.js.map +1 -0
  126. package/features/flp/ListFolderAccess/UserFolderCandidates.d.ts +13 -0
  127. package/features/flp/ListFolderAccess/UserFolderCandidates.js +26 -0
  128. package/features/flp/ListFolderAccess/UserFolderCandidates.js.map +1 -0
  129. package/features/flp/ListFolderAccess/abstractions.d.ts +182 -0
  130. package/features/flp/ListFolderAccess/abstractions.js +10 -0
  131. package/features/flp/ListFolderAccess/abstractions.js.map +1 -0
  132. package/features/flp/{CreateFlpOnFolderCreated → ListFolderAccess}/feature.d.ts +1 -1
  133. package/features/flp/ListFolderAccess/feature.js +21 -0
  134. package/features/flp/ListFolderAccess/feature.js.map +1 -0
  135. package/features/flp/ListFolderAccess/index.d.ts +2 -0
  136. package/features/flp/ListFolderAccess/index.js +2 -0
  137. package/features/flp/ListFolderAccess/mayAskAboutUser.d.ts +3 -0
  138. package/features/flp/ListFolderAccess/mayAskAboutUser.js +9 -0
  139. package/features/flp/ListFolderAccess/mayAskAboutUser.js.map +1 -0
  140. package/features/flp/ListFolderAccess/userFolderLevel.d.ts +31 -0
  141. package/features/flp/ListFolderAccess/userFolderLevel.js +48 -0
  142. package/features/flp/ListFolderAccess/userFolderLevel.js.map +1 -0
  143. package/features/flp/UpdateFlp/abstractions.d.ts +6 -2
  144. package/features/flp/UpdateFlp/abstractions.js.map +1 -1
  145. package/features/flp/UpdateFlp/index.d.ts +0 -1
  146. package/features/flp/UpdateFlp/index.js +0 -1
  147. package/features/flp/shared/CodeFlpMerger.d.ts +26 -0
  148. package/features/flp/shared/CodeFlpMerger.js +20 -0
  149. package/features/flp/shared/CodeFlpMerger.js.map +1 -0
  150. package/features/flp/shared/CodeFlpPath.d.ts +15 -0
  151. package/features/flp/shared/CodeFlpPath.js +29 -0
  152. package/features/flp/shared/CodeFlpPath.js.map +1 -0
  153. package/features/flp/shared/CodeFlpTarget.d.ts +10 -0
  154. package/features/flp/shared/CodeFlpTarget.js +26 -0
  155. package/features/flp/shared/CodeFlpTarget.js.map +1 -0
  156. package/features/flp/shared/CodeFlpsProvider.d.ts +15 -0
  157. package/features/flp/shared/CodeFlpsProvider.js +36 -0
  158. package/features/flp/shared/CodeFlpsProvider.js.map +1 -0
  159. package/features/flp/shared/abstractions.d.ts +79 -0
  160. package/features/flp/shared/abstractions.js +19 -0
  161. package/features/flp/shared/abstractions.js.map +1 -0
  162. package/features/flp/shared/feature.d.ts +5 -0
  163. package/features/flp/shared/feature.js +17 -0
  164. package/features/flp/shared/feature.js.map +1 -0
  165. package/features/flp/shared/index.d.ts +4 -0
  166. package/features/flp/shared/index.js +4 -0
  167. package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.d.ts +9 -1
  168. package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js +20 -3
  169. package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js.map +1 -1
  170. package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.d.ts +3 -7
  171. package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js +5 -50
  172. package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js.map +1 -1
  173. package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.d.ts +11 -0
  174. package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js +38 -0
  175. package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js.map +1 -0
  176. package/features/{flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.d.ts → folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.d.ts} +5 -7
  177. package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js +24 -0
  178. package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js.map +1 -0
  179. package/features/folder/NotifyFolderChange/abstractions.d.ts +28 -0
  180. package/features/folder/NotifyFolderChange/abstractions.js +8 -0
  181. package/features/folder/NotifyFolderChange/abstractions.js.map +1 -0
  182. package/features/folder/NotifyFolderChange/feature.d.ts +8 -0
  183. package/features/folder/NotifyFolderChange/feature.js +13 -0
  184. package/features/folder/NotifyFolderChange/feature.js.map +1 -0
  185. package/features/folder/NotifyFolderChange/index.d.ts +2 -0
  186. package/features/folder/NotifyFolderChange/index.js +2 -0
  187. package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.d.ts +14 -1
  188. package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js +52 -4
  189. package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js.map +1 -1
  190. package/filter/filter.model.js +2 -1
  191. package/filter/filter.model.js.map +1 -1
  192. package/filter/filter.so.d.ts +0 -2
  193. package/filter/filter.so.js +20 -8
  194. package/filter/filter.so.js.map +1 -1
  195. package/flp/flp.types.d.ts +6 -1
  196. package/flp/index.d.ts +0 -1
  197. package/flp/index.js +0 -1
  198. package/flpTaskCatalog/CatalogFolderPermissionsRepository.d.ts +17 -0
  199. package/flpTaskCatalog/CatalogFolderPermissionsRepository.js +34 -0
  200. package/flpTaskCatalog/CatalogFolderPermissionsRepository.js.map +1 -0
  201. package/flpTaskCatalog/PostLoadFolderAccessListFilter.d.ts +24 -0
  202. package/flpTaskCatalog/PostLoadFolderAccessListFilter.js +63 -0
  203. package/flpTaskCatalog/PostLoadFolderAccessListFilter.js.map +1 -0
  204. package/flpTaskCatalog/TaskCatalogFlpFeature.d.ts +12 -0
  205. package/flpTaskCatalog/TaskCatalogFlpFeature.js +49 -0
  206. package/flpTaskCatalog/TaskCatalogFlpFeature.js.map +1 -0
  207. package/flpTaskCatalog/TaskFolderCatalogSync.d.ts +29 -0
  208. package/flpTaskCatalog/TaskFolderCatalogSync.js +57 -0
  209. package/flpTaskCatalog/TaskFolderCatalogSync.js.map +1 -0
  210. package/{flp → flpTaskCatalog}/flp.crud.d.ts +1 -1
  211. package/flpTaskCatalog/flp.crud.js.map +1 -0
  212. package/flpTaskCatalog/index.d.ts +1 -0
  213. package/flpTaskCatalog/index.js +1 -0
  214. package/{utils/decorators → flpTaskCatalog/listEntries}/ListEntriesFactory.d.ts +1 -1
  215. package/flpTaskCatalog/listEntries/ListEntriesFactory.js.map +1 -0
  216. package/flpTaskCatalog/listEntries/hasRootFolderId.js.map +1 -0
  217. package/{utils/decorators → flpTaskCatalog/listEntries}/isPageModel.js +1 -1
  218. package/flpTaskCatalog/listEntries/isPageModel.js.map +1 -0
  219. package/flpTaskCatalog/tasks/createFlp.task.d.ts +25 -0
  220. package/{flp → flpTaskCatalog}/tasks/createFlp.task.js +34 -17
  221. package/flpTaskCatalog/tasks/createFlp.task.js.map +1 -0
  222. package/flpTaskCatalog/tasks/deleteFlp.task.d.ts +23 -0
  223. package/{flp → flpTaskCatalog}/tasks/deleteFlp.task.js +24 -15
  224. package/flpTaskCatalog/tasks/deleteFlp.task.js.map +1 -0
  225. package/{flp → flpTaskCatalog}/tasks/syncFlp.task.d.ts +11 -6
  226. package/{flp → flpTaskCatalog}/tasks/syncFlp.task.js +25 -16
  227. package/flpTaskCatalog/tasks/syncFlp.task.js.map +1 -0
  228. package/flpTaskCatalog/tasks/updateFlp.task.d.ts +25 -0
  229. package/flpTaskCatalog/tasks/updateFlp.task.js +64 -0
  230. package/flpTaskCatalog/tasks/updateFlp.task.js.map +1 -0
  231. package/flpTaskCatalog/useCases/CreateFlpUseCase.d.ts +8 -0
  232. package/{features/flp/CreateFlp → flpTaskCatalog/useCases}/CreateFlpUseCase.js +1 -1
  233. package/flpTaskCatalog/useCases/CreateFlpUseCase.js.map +1 -0
  234. package/flpTaskCatalog/useCases/DeleteFlpUseCase.d.ts +8 -0
  235. package/flpTaskCatalog/useCases/DeleteFlpUseCase.js.map +1 -0
  236. package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.d.ts +8 -9
  237. package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.js +23 -30
  238. package/flpTaskCatalog/useCases/UpdateFlpUseCase.js.map +1 -0
  239. package/folder/createFolderTypeDefs.js +4 -1
  240. package/folder/createFolderTypeDefs.js.map +1 -1
  241. package/index.d.ts +1 -0
  242. package/index.js +1 -0
  243. package/package.json +22 -22
  244. package/types.d.ts +2 -3
  245. package/types.js.map +1 -1
  246. package/utils/createOperationsWrapper.d.ts +2 -2
  247. package/utils/createOperationsWrapper.js +5 -5
  248. package/utils/createOperationsWrapper.js.map +1 -1
  249. package/features/flp/CreateFlp/CreateFlpUseCase.d.ts +0 -8
  250. package/features/flp/CreateFlp/CreateFlpUseCase.js.map +0 -1
  251. package/features/flp/CreateFlp/feature.d.ts +0 -5
  252. package/features/flp/CreateFlp/feature.js +0 -13
  253. package/features/flp/CreateFlp/feature.js.map +0 -1
  254. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.d.ts +0 -14
  255. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js +0 -37
  256. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js.map +0 -1
  257. package/features/flp/CreateFlpOnFolderCreated/feature.js +0 -11
  258. package/features/flp/CreateFlpOnFolderCreated/feature.js.map +0 -1
  259. package/features/flp/CreateFlpOnFolderCreated/index.d.ts +0 -1
  260. package/features/flp/CreateFlpOnFolderCreated/index.js +0 -1
  261. package/features/flp/DeleteFlp/DeleteFlpUseCase.d.ts +0 -8
  262. package/features/flp/DeleteFlp/DeleteFlpUseCase.js.map +0 -1
  263. package/features/flp/DeleteFlp/feature.d.ts +0 -5
  264. package/features/flp/DeleteFlp/feature.js +0 -13
  265. package/features/flp/DeleteFlp/feature.js.map +0 -1
  266. package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js +0 -37
  267. package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js.map +0 -1
  268. package/features/flp/DeleteFlpOnFolderDeleted/feature.d.ts +0 -4
  269. package/features/flp/DeleteFlpOnFolderDeleted/feature.js +0 -11
  270. package/features/flp/DeleteFlpOnFolderDeleted/feature.js.map +0 -1
  271. package/features/flp/DeleteFlpOnFolderDeleted/index.d.ts +0 -1
  272. package/features/flp/DeleteFlpOnFolderDeleted/index.js +0 -1
  273. package/features/flp/UpdateFlp/UpdateFlpUseCase.js.map +0 -1
  274. package/features/flp/UpdateFlp/feature.d.ts +0 -5
  275. package/features/flp/UpdateFlp/feature.js +0 -17
  276. package/features/flp/UpdateFlp/feature.js.map +0 -1
  277. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.d.ts +0 -14
  278. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js +0 -39
  279. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js.map +0 -1
  280. package/features/flp/UpdateFlpOnFolderUpdated/feature.d.ts +0 -4
  281. package/features/flp/UpdateFlpOnFolderUpdated/feature.js +0 -11
  282. package/features/flp/UpdateFlpOnFolderUpdated/feature.js.map +0 -1
  283. package/features/flp/UpdateFlpOnFolderUpdated/index.d.ts +0 -1
  284. package/features/flp/UpdateFlpOnFolderUpdated/index.js +0 -1
  285. package/flp/flp.crud.js.map +0 -1
  286. package/flp/tasks/createFlp.task.d.ts +0 -18
  287. package/flp/tasks/createFlp.task.js.map +0 -1
  288. package/flp/tasks/deleteFlp.task.d.ts +0 -18
  289. package/flp/tasks/deleteFlp.task.js.map +0 -1
  290. package/flp/tasks/syncFlp.task.js.map +0 -1
  291. package/flp/tasks/updateFlp.task.d.ts +0 -18
  292. package/flp/tasks/updateFlp.task.js +0 -43
  293. package/flp/tasks/updateFlp.task.js.map +0 -1
  294. package/utils/decorators/CmsEntriesCrudDecorators.d.ts +0 -11
  295. package/utils/decorators/CmsEntriesCrudDecorators.js +0 -179
  296. package/utils/decorators/CmsEntriesCrudDecorators.js.map +0 -1
  297. package/utils/decorators/FilterEntriesByFolderFactory.d.ts +0 -7
  298. package/utils/decorators/FilterEntriesByFolderFactory.js +0 -22
  299. package/utils/decorators/FilterEntriesByFolderFactory.js.map +0 -1
  300. package/utils/decorators/ListEntriesFactory.js.map +0 -1
  301. package/utils/decorators/hasRootFolderId.js.map +0 -1
  302. package/utils/decorators/isPageModel.js.map +0 -1
  303. /package/{flp → flpTaskCatalog}/flp.crud.js +0 -0
  304. /package/{utils/decorators → flpTaskCatalog/listEntries}/ListEntriesFactory.js +0 -0
  305. /package/{utils/decorators → flpTaskCatalog/listEntries}/hasRootFolderId.d.ts +0 -0
  306. /package/{utils/decorators → flpTaskCatalog/listEntries}/hasRootFolderId.js +0 -0
  307. /package/{utils/decorators → flpTaskCatalog/listEntries}/isPageModel.d.ts +0 -0
  308. /package/{features/flp/DeleteFlp → flpTaskCatalog/useCases}/DeleteFlpUseCase.js +0 -0
@@ -0,0 +1,26 @@
1
+ import { GetFlpUseCase } from "../abstractions.js";
2
+ import { CodeFlpMerger, CodeFlpsProvider } from "../../shared/index.js";
3
+ class GetFlpWithCodeFlpsImpl {
4
+ constructor(codeFlpsProvider, decoratee){
5
+ this.codeFlpsProvider = codeFlpsProvider;
6
+ this.decoratee = decoratee;
7
+ }
8
+ async execute(id) {
9
+ const flp = await this.decoratee.execute(id);
10
+ if (!flp) return null;
11
+ const codePermissions = await this.codeFlpsProvider.getPermissions({
12
+ type: flp.type,
13
+ path: flp.path
14
+ });
15
+ return CodeFlpMerger.merge(flp, codePermissions);
16
+ }
17
+ }
18
+ const GetFlpWithCodeFlps = GetFlpUseCase.createDecorator({
19
+ decorator: GetFlpWithCodeFlpsImpl,
20
+ dependencies: [
21
+ CodeFlpsProvider
22
+ ]
23
+ });
24
+ export { GetFlpWithCodeFlps };
25
+
26
+ //# sourceMappingURL=GetFlpWithCodeFlps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js","sources":["../../../../../src/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.ts"],"sourcesContent":["import { GetFlpUseCase } from \"../abstractions.js\";\nimport { CodeFlpMerger, CodeFlpsProvider } from \"~/features/flp/shared/index.js\";\nimport type { FolderLevelPermission } from \"~/flp/flp.types.js\";\n\nclass GetFlpWithCodeFlpsImpl implements GetFlpUseCase.Interface {\n constructor(\n private codeFlpsProvider: CodeFlpsProvider.Interface,\n private decoratee: GetFlpUseCase.Interface\n ) {}\n\n async execute(id: string): Promise<FolderLevelPermission | null> {\n const flp = await this.decoratee.execute(id);\n\n if (!flp) {\n return null;\n }\n\n const codePermissions = await this.codeFlpsProvider.getPermissions({\n type: flp.type,\n path: flp.path\n });\n\n return CodeFlpMerger.merge(flp, codePermissions);\n }\n}\n\nexport const GetFlpWithCodeFlps = GetFlpUseCase.createDecorator({\n decorator: GetFlpWithCodeFlpsImpl,\n dependencies: [CodeFlpsProvider]\n});\n"],"names":["GetFlpWithCodeFlpsImpl","codeFlpsProvider","decoratee","id","flp","codePermissions","CodeFlpMerger","GetFlpWithCodeFlps","GetFlpUseCase","CodeFlpsProvider"],"mappings":";;AAIA,MAAMA;IACF,YACYC,gBAA4C,EAC5CC,SAAkC,CAC5C;aAFUD,gBAAgB,GAAhBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAyC;QAC7D,MAAMC,MAAM,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACD;QAEzC,IAAI,CAACC,KACD,OAAO;QAGX,MAAMC,kBAAkB,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC;YAC/D,MAAMD,IAAI,IAAI;YACd,MAAMA,IAAI,IAAI;QAClB;QAEA,OAAOE,cAAc,KAAK,CAACF,KAAKC;IACpC;AACJ;AAEO,MAAME,qBAAqBC,cAAc,eAAe,CAAC;IAC5D,WAAWR;IACX,cAAc;QAACS;KAAiB;AACpC"}
@@ -1,11 +1,9 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { GetFlpUseCase } from "./GetFlpUseCase.js";
3
- import { GetFlpUseCase as external_abstractions_js_GetFlpUseCase } from "./abstractions.js";
4
- import { AcoFlpCrud } from "../../folder/shared/abstractions.js";
5
3
  const GetFlpFeature = createFeature({
6
4
  name: "GetFlpFeature",
7
5
  register (container) {
8
- container.registerFactory(external_abstractions_js_GetFlpUseCase, ()=>new GetFlpUseCase(container.resolve(AcoFlpCrud).get));
6
+ container.register(GetFlpUseCase);
9
7
  }
10
8
  });
11
9
  export { GetFlpFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/flp/GetFlp/feature.js","sources":["../../../../src/features/flp/GetFlp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFlpUseCase } from \"./GetFlpUseCase.js\";\nimport { GetFlpUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { AcoFlpCrud } from \"~/features/folder/shared/abstractions.js\";\n\nexport const GetFlpFeature = createFeature({\n name: \"GetFlpFeature\",\n register(container) {\n container.registerFactory(UseCaseAbstraction, () => {\n return new GetFlpUseCase(container.resolve(AcoFlpCrud).get);\n });\n }\n});\n"],"names":["GetFlpFeature","createFeature","container","UseCaseAbstraction","GetFlpUseCase","AcoFlpCrud"],"mappings":";;;;AAKO,MAAMA,gBAAgBC,cAAc;IACvC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,eAAe,CAACC,wCAAoB,IACnC,IAAIC,cAAcF,UAAU,OAAO,CAACG,YAAY,GAAG;IAElE;AACJ"}
1
+ {"version":3,"file":"features/flp/GetFlp/feature.js","sources":["../../../../src/features/flp/GetFlp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFlpUseCase } from \"./GetFlpUseCase.js\";\n\nexport const GetFlpFeature = createFeature({\n name: \"GetFlpFeature\",\n register(container) {\n container.register(GetFlpUseCase);\n }\n});\n"],"names":["GetFlpFeature","createFeature","container","GetFlpUseCase"],"mappings":";;AAGO,MAAMA,gBAAgBC,cAAc;IACvC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,7 +1,12 @@
1
- import type { ListFlpsUseCase as UseCaseAbstraction } from "./abstractions.js";
2
- import type { AcoFolderLevelPermissionsCrud, ListFlpsParams } from "../../../flp/flp.types.js";
3
- export declare class ListFlpsUseCase implements UseCaseAbstraction.Interface {
4
- private readonly list;
5
- constructor(list: AcoFolderLevelPermissionsCrud["list"]);
6
- execute(params: ListFlpsParams): Promise<import("~/flp/flp.types.js").FolderLevelPermission[]>;
1
+ import { ListFlpsUseCase as UseCaseAbstraction } from "./abstractions.js";
2
+ import { FolderPermissionsRepository } from "../../../features/flp/FolderPermissionsRepository/index.js";
3
+ import type { FolderLevelPermission } from "../../../flp/flp.types.js";
4
+ declare class ListFlpsUseCaseImpl implements UseCaseAbstraction.Interface {
5
+ private repository;
6
+ constructor(repository: FolderPermissionsRepository.Interface);
7
+ execute(params: UseCaseAbstraction.Params): Promise<FolderLevelPermission[]>;
7
8
  }
9
+ export declare const ListFlpsUseCase: typeof ListFlpsUseCaseImpl & {
10
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListFlps>;
11
+ };
12
+ export {};
@@ -1,11 +1,19 @@
1
- class ListFlpsUseCase {
2
- constructor(list){
3
- this.list = list;
1
+ import { ListFlpsUseCase } from "./abstractions.js";
2
+ import { FolderPermissionsRepository } from "../FolderPermissionsRepository/index.js";
3
+ class ListFlpsUseCaseImpl {
4
+ constructor(repository){
5
+ this.repository = repository;
4
6
  }
5
7
  async execute(params) {
6
- return this.list(params);
8
+ return this.repository.list(params);
7
9
  }
8
10
  }
9
- export { ListFlpsUseCase };
11
+ const ListFlpsUseCase_ListFlpsUseCase = ListFlpsUseCase.createImplementation({
12
+ implementation: ListFlpsUseCaseImpl,
13
+ dependencies: [
14
+ FolderPermissionsRepository
15
+ ]
16
+ });
17
+ export { ListFlpsUseCase_ListFlpsUseCase as ListFlpsUseCase };
10
18
 
11
19
  //# sourceMappingURL=ListFlpsUseCase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/flp/ListFlps/ListFlpsUseCase.js","sources":["../../../../src/features/flp/ListFlps/ListFlpsUseCase.ts"],"sourcesContent":["import type { ListFlpsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type { AcoFolderLevelPermissionsCrud, ListFlpsParams } from \"~/flp/flp.types.js\";\n\nexport class ListFlpsUseCase implements UseCaseAbstraction.Interface {\n private readonly list: AcoFolderLevelPermissionsCrud[\"list\"];\n\n constructor(list: AcoFolderLevelPermissionsCrud[\"list\"]) {\n this.list = list;\n }\n\n async execute(params: ListFlpsParams) {\n return this.list(params);\n }\n}\n"],"names":["ListFlpsUseCase","list","params"],"mappings":"AAGO,MAAMA;IAGT,YAAYC,IAA2C,CAAE;QACrD,IAAI,CAAC,IAAI,GAAGA;IAChB;IAEA,MAAM,QAAQC,MAAsB,EAAE;QAClC,OAAO,IAAI,CAAC,IAAI,CAACA;IACrB;AACJ"}
1
+ {"version":3,"file":"features/flp/ListFlps/ListFlpsUseCase.js","sources":["../../../../src/features/flp/ListFlps/ListFlpsUseCase.ts"],"sourcesContent":["import { ListFlpsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { FolderPermissionsRepository } from \"~/features/flp/FolderPermissionsRepository/index.js\";\nimport type { FolderLevelPermission } from \"~/flp/flp.types.js\";\n\nclass ListFlpsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private repository: FolderPermissionsRepository.Interface) {}\n\n async execute(params: UseCaseAbstraction.Params): Promise<FolderLevelPermission[]> {\n return this.repository.list(params);\n }\n}\n\nexport const ListFlpsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListFlpsUseCaseImpl,\n dependencies: [FolderPermissionsRepository]\n});\n"],"names":["ListFlpsUseCaseImpl","repository","params","ListFlpsUseCase","UseCaseAbstraction","FolderPermissionsRepository"],"mappings":";;AAIA,MAAMA;IACF,YAAoBC,UAAiD,CAAE;aAAnDA,UAAU,GAAVA;IAAoD;IAExE,MAAM,QAAQC,MAAiC,EAAoC;QAC/E,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAACA;IAChC;AACJ;AAEO,MAAMC,kCAAkBC,gBAAAA,oBAAuC,CAAC;IACnE,gBAAgBJ;IAChB,cAAc;QAACK;KAA4B;AAC/C"}
@@ -1,17 +1,11 @@
1
1
  import type { FolderLevelPermission } from "../../../types.js";
2
- interface ListFlpsParams {
3
- where: {
4
- path_startsWith?: string;
5
- parentId?: string;
6
- type: string;
7
- };
8
- }
2
+ import type { ListFolderPermissionsParams } from "../../../features/flp/FolderPermissionsRepository/abstractions.js";
9
3
  export interface IListFlps {
10
- execute: (params: ListFlpsParams) => Promise<FolderLevelPermission[]>;
4
+ execute: (params: ListFolderPermissionsParams) => Promise<FolderLevelPermission[]>;
11
5
  }
12
6
  /** List folder-level permissions. */
13
7
  export declare const ListFlpsUseCase: import("@webiny/di").Abstraction<IListFlps>;
14
8
  export declare namespace ListFlpsUseCase {
15
9
  type Interface = IListFlps;
10
+ type Params = ListFolderPermissionsParams;
16
11
  }
17
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"features/flp/ListFlps/abstractions.js","sources":["../../../../src/features/flp/ListFlps/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { FolderLevelPermission } from \"~/types.js\";\n\ninterface ListFlpsParams {\n where: {\n path_startsWith?: string;\n parentId?: string;\n type: string;\n };\n}\n\nexport interface IListFlps {\n execute: (params: ListFlpsParams) => Promise<FolderLevelPermission[]>;\n}\n\n/** List folder-level permissions. */\nexport const ListFlpsUseCase = createAbstraction<IListFlps>(\"ListFlpsUseCase\");\n\nexport namespace ListFlpsUseCase {\n export type Interface = IListFlps;\n}\n"],"names":["ListFlpsUseCase","createAbstraction"],"mappings":";AAgBO,MAAMA,kBAAkBC,kBAA6B"}
1
+ {"version":3,"file":"features/flp/ListFlps/abstractions.js","sources":["../../../../src/features/flp/ListFlps/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { FolderLevelPermission } from \"~/types.js\";\nimport type { ListFolderPermissionsParams } from \"~/features/flp/FolderPermissionsRepository/abstractions.js\";\n\nexport interface IListFlps {\n execute: (params: ListFolderPermissionsParams) => Promise<FolderLevelPermission[]>;\n}\n\n/** List folder-level permissions. */\nexport const ListFlpsUseCase = createAbstraction<IListFlps>(\"ListFlpsUseCase\");\n\nexport namespace ListFlpsUseCase {\n export type Interface = IListFlps;\n export type Params = ListFolderPermissionsParams;\n}\n"],"names":["ListFlpsUseCase","createAbstraction"],"mappings":";AASO,MAAMA,kBAAkBC,kBAA6B"}
@@ -0,0 +1,13 @@
1
+ import { ListFlpsUseCase } from "../abstractions.js";
2
+ import { CodeFlpsProvider } from "../../../../features/flp/shared/index.js";
3
+ import type { FolderLevelPermission } from "../../../../flp/flp.types.js";
4
+ declare class ListFlpsWithCodeFlpsImpl implements ListFlpsUseCase.Interface {
5
+ private codeFlpsProvider;
6
+ private decoratee;
7
+ constructor(codeFlpsProvider: CodeFlpsProvider.Interface, decoratee: ListFlpsUseCase.Interface);
8
+ execute(params: ListFlpsUseCase.Params): Promise<FolderLevelPermission[]>;
9
+ }
10
+ export declare const ListFlpsWithCodeFlps: typeof ListFlpsWithCodeFlpsImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("../abstractions.js").IListFlps>;
12
+ };
13
+ export {};
@@ -0,0 +1,27 @@
1
+ import { ListFlpsUseCase } from "../abstractions.js";
2
+ import { CodeFlpMerger, CodeFlpsProvider } from "../../shared/index.js";
3
+ class ListFlpsWithCodeFlpsImpl {
4
+ constructor(codeFlpsProvider, decoratee){
5
+ this.codeFlpsProvider = codeFlpsProvider;
6
+ this.decoratee = decoratee;
7
+ }
8
+ async execute(params) {
9
+ const flps = await this.decoratee.execute(params);
10
+ return Promise.all(flps.map(async (flp)=>{
11
+ const codePermissions = await this.codeFlpsProvider.getPermissions({
12
+ type: flp.type,
13
+ path: flp.path
14
+ });
15
+ return CodeFlpMerger.merge(flp, codePermissions);
16
+ }));
17
+ }
18
+ }
19
+ const ListFlpsWithCodeFlps = ListFlpsUseCase.createDecorator({
20
+ decorator: ListFlpsWithCodeFlpsImpl,
21
+ dependencies: [
22
+ CodeFlpsProvider
23
+ ]
24
+ });
25
+ export { ListFlpsWithCodeFlps };
26
+
27
+ //# sourceMappingURL=ListFlpsWithCodeFlps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js","sources":["../../../../../src/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.ts"],"sourcesContent":["import { ListFlpsUseCase } from \"../abstractions.js\";\nimport { CodeFlpMerger, CodeFlpsProvider } from \"~/features/flp/shared/index.js\";\nimport type { FolderLevelPermission } from \"~/flp/flp.types.js\";\n\nclass ListFlpsWithCodeFlpsImpl implements ListFlpsUseCase.Interface {\n constructor(\n private codeFlpsProvider: CodeFlpsProvider.Interface,\n private decoratee: ListFlpsUseCase.Interface\n ) {}\n\n async execute(params: ListFlpsUseCase.Params): Promise<FolderLevelPermission[]> {\n const flps = await this.decoratee.execute(params);\n\n return Promise.all(\n flps.map(async flp => {\n const codePermissions = await this.codeFlpsProvider.getPermissions({\n type: flp.type,\n path: flp.path\n });\n\n return CodeFlpMerger.merge(flp, codePermissions);\n })\n );\n }\n}\n\nexport const ListFlpsWithCodeFlps = ListFlpsUseCase.createDecorator({\n decorator: ListFlpsWithCodeFlpsImpl,\n dependencies: [CodeFlpsProvider]\n});\n"],"names":["ListFlpsWithCodeFlpsImpl","codeFlpsProvider","decoratee","params","flps","Promise","flp","codePermissions","CodeFlpMerger","ListFlpsWithCodeFlps","ListFlpsUseCase","CodeFlpsProvider"],"mappings":";;AAIA,MAAMA;IACF,YACYC,gBAA4C,EAC5CC,SAAoC,CAC9C;aAFUD,gBAAgB,GAAhBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,MAA8B,EAAoC;QAC5E,MAAMC,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACD;QAE1C,OAAOE,QAAQ,GAAG,CACdD,KAAK,GAAG,CAAC,OAAME;YACX,MAAMC,kBAAkB,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC;gBAC/D,MAAMD,IAAI,IAAI;gBACd,MAAMA,IAAI,IAAI;YAClB;YAEA,OAAOE,cAAc,KAAK,CAACF,KAAKC;QACpC;IAER;AACJ;AAEO,MAAME,uBAAuBC,gBAAgB,eAAe,CAAC;IAChE,WAAWV;IACX,cAAc;QAACW;KAAiB;AACpC"}
@@ -1,11 +1,9 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { ListFlpsUseCase } from "./ListFlpsUseCase.js";
3
- import { ListFlpsUseCase as external_abstractions_js_ListFlpsUseCase } from "./abstractions.js";
4
- import { AcoFlpCrud } from "../../folder/shared/abstractions.js";
5
3
  const ListFlpsFeature = createFeature({
6
4
  name: "ListFlpsFeature",
7
5
  register (container) {
8
- container.registerFactory(external_abstractions_js_ListFlpsUseCase, ()=>new ListFlpsUseCase(container.resolve(AcoFlpCrud).list));
6
+ container.register(ListFlpsUseCase);
9
7
  }
10
8
  });
11
9
  export { ListFlpsFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/flp/ListFlps/feature.js","sources":["../../../../src/features/flp/ListFlps/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListFlpsUseCase } from \"./ListFlpsUseCase.js\";\nimport { ListFlpsUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { AcoFlpCrud } from \"~/features/folder/shared/abstractions.js\";\n\nexport const ListFlpsFeature = createFeature({\n name: \"ListFlpsFeature\",\n register(container) {\n container.registerFactory(UseCaseAbstraction, () => {\n return new ListFlpsUseCase(container.resolve(AcoFlpCrud).list);\n });\n }\n});\n"],"names":["ListFlpsFeature","createFeature","container","UseCaseAbstraction","ListFlpsUseCase","AcoFlpCrud"],"mappings":";;;;AAKO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,eAAe,CAACC,0CAAoB,IACnC,IAAIC,gBAAgBF,UAAU,OAAO,CAACG,YAAY,IAAI;IAErE;AACJ"}
1
+ {"version":3,"file":"features/flp/ListFlps/feature.js","sources":["../../../../src/features/flp/ListFlps/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListFlpsUseCase } from \"./ListFlpsUseCase.js\";\n\nexport const ListFlpsFeature = createFeature({\n name: \"ListFlpsFeature\",\n register(container) {\n container.register(ListFlpsUseCase);\n }\n});\n"],"names":["ListFlpsFeature","createFeature","container","ListFlpsUseCase"],"mappings":";;AAGO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,14 @@
1
+ import { GetLatestRevisionByEntryIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
2
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
3
+ import { GetUserEntryAccessUseCase as UseCaseAbstraction, GetUserFolderAccessUseCase } from "./abstractions.js";
4
+ declare class GetUserEntryAccessUseCaseImpl implements UseCaseAbstraction.Interface {
5
+ private identityContext;
6
+ private getLatestRevision;
7
+ private getUserFolderAccess;
8
+ constructor(identityContext: IdentityContext.Interface, getLatestRevision: GetLatestRevisionByEntryIdUseCase.Interface, getUserFolderAccess: GetUserFolderAccessUseCase.Interface);
9
+ execute({ userId, model, entryId }: UseCaseAbstraction.Params): UseCaseAbstraction.Return;
10
+ }
11
+ export declare const GetUserEntryAccessUseCase: typeof GetUserEntryAccessUseCaseImpl & {
12
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetUserEntryAccessUseCase>;
13
+ };
14
+ export {};
@@ -0,0 +1,36 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { GetLatestRevisionByEntryIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
3
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
4
+ import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
5
+ import { GetUserEntryAccessUseCase, GetUserFolderAccessUseCase } from "./abstractions.js";
6
+ import { mayAskAboutUser } from "./mayAskAboutUser.js";
7
+ class GetUserEntryAccessUseCaseImpl {
8
+ constructor(identityContext, getLatestRevision, getUserFolderAccess){
9
+ this.identityContext = identityContext;
10
+ this.getLatestRevision = getLatestRevision;
11
+ this.getUserFolderAccess = getUserFolderAccess;
12
+ }
13
+ async execute({ userId, model, entryId }) {
14
+ if (!await mayAskAboutUser(this.identityContext, userId)) return Result.fail(new NotAuthorizedError());
15
+ const result = await this.identityContext.withoutAuthorization(()=>this.getLatestRevision.execute(model, {
16
+ id: entryId
17
+ }));
18
+ if (result.isFail()) return Result.fail(result.error);
19
+ const folderId = result.value.location?.folderId ?? null;
20
+ return this.getUserFolderAccess.execute({
21
+ userId,
22
+ folderId
23
+ });
24
+ }
25
+ }
26
+ const GetUserEntryAccessUseCase_GetUserEntryAccessUseCase = GetUserEntryAccessUseCase.createImplementation({
27
+ implementation: GetUserEntryAccessUseCaseImpl,
28
+ dependencies: [
29
+ IdentityContext,
30
+ GetLatestRevisionByEntryIdUseCase,
31
+ GetUserFolderAccessUseCase
32
+ ]
33
+ });
34
+ export { GetUserEntryAccessUseCase_GetUserEntryAccessUseCase as GetUserEntryAccessUseCase };
35
+
36
+ //# sourceMappingURL=GetUserEntryAccessUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js","sources":["../../../../src/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetLatestRevisionByEntryIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport {\n GetUserEntryAccessUseCase as UseCaseAbstraction,\n GetUserFolderAccessUseCase\n} from \"./abstractions.js\";\nimport { mayAskAboutUser } from \"./mayAskAboutUser.js\";\n\nclass GetUserEntryAccessUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private getLatestRevision: GetLatestRevisionByEntryIdUseCase.Interface,\n private getUserFolderAccess: GetUserFolderAccessUseCase.Interface\n ) {}\n\n async execute({\n userId,\n model,\n entryId\n }: UseCaseAbstraction.Params): UseCaseAbstraction.Return {\n // Checked before reading the entry, so a refused caller learns nothing about it.\n if (!(await mayAskAboutUser(this.identityContext, userId))) {\n return Result.fail(new NotAuthorizedError());\n }\n // The entry is read whoever asks: the answer is about the user, not the caller.\n const result = await this.identityContext.withoutAuthorization(() =>\n this.getLatestRevision.execute(model, { id: entryId })\n );\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n const folderId = result.value.location?.folderId ?? null;\n return this.getUserFolderAccess.execute({ userId, folderId });\n }\n}\n\nexport const GetUserEntryAccessUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetUserEntryAccessUseCaseImpl,\n dependencies: [IdentityContext, GetLatestRevisionByEntryIdUseCase, GetUserFolderAccessUseCase]\n});\n"],"names":["GetUserEntryAccessUseCaseImpl","identityContext","getLatestRevision","getUserFolderAccess","userId","model","entryId","mayAskAboutUser","Result","NotAuthorizedError","result","folderId","GetUserEntryAccessUseCase","UseCaseAbstraction","IdentityContext","GetLatestRevisionByEntryIdUseCase","GetUserFolderAccessUseCase"],"mappings":";;;;;;AAUA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,iBAA8D,EAC9DC,mBAAyD,CACnE;aAHUF,eAAe,GAAfA;aACAC,iBAAiB,GAAjBA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQ,EACVC,MAAM,EACNC,KAAK,EACLC,OAAO,EACiB,EAA6B;QAErD,IAAI,CAAE,MAAMC,gBAAgB,IAAI,CAAC,eAAe,EAAEH,SAC9C,OAAOI,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAAS,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,IAC3D,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAACL,OAAO;gBAAE,IAAIC;YAAQ;QAExD,IAAII,OAAO,MAAM,IACb,OAAOF,OAAO,IAAI,CAACE,OAAO,KAAK;QAEnC,MAAMC,WAAWD,OAAO,KAAK,CAAC,QAAQ,EAAE,YAAY;QACpD,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC;YAAEN;YAAQO;QAAS;IAC/D;AACJ;AAEO,MAAMC,sDAA4BC,0BAAAA,oBAAuC,CAAC;IAC7E,gBAAgBb;IAChB,cAAc;QAACc;QAAiBC;QAAmCC;KAA2B;AAClG"}
@@ -0,0 +1,25 @@
1
+ import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
2
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
3
+ import { GetUserUseCase } from "@webiny/api-core/features/users/GetUser/index.js";
4
+ import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
5
+ import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
6
+ import { GetUserFolderAccessUseCase as UseCaseAbstraction } from "./abstractions.js";
7
+ import { GetFlpUseCase } from "../../../features/flp/GetFlp/abstractions.js";
8
+ /**
9
+ * One folder's permissions (`GetFlpUseCase`, inherited and code-defined ones included) checked with
10
+ * one user's level (see `getUserFolderLevel`), as `ListFolderAccessUseCase` does for every user.
11
+ */
12
+ declare class GetUserFolderAccessUseCaseImpl implements UseCaseAbstraction.Interface {
13
+ private featureFlags;
14
+ private identityContext;
15
+ private getFlp;
16
+ private getUser;
17
+ private listTeams;
18
+ private listRoles;
19
+ constructor(featureFlags: FeatureFlags.Interface, identityContext: IdentityContext.Interface, getFlp: GetFlpUseCase.Interface, getUser: GetUserUseCase.Interface, listTeams: ListTeamsUseCase.Interface, listRoles: ListRolesUseCase.Interface);
20
+ execute({ userId, folderId }: UseCaseAbstraction.Params): UseCaseAbstraction.Return;
21
+ }
22
+ export declare const GetUserFolderAccessUseCase: typeof GetUserFolderAccessUseCaseImpl & {
23
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetUserFolderAccessUseCase>;
24
+ };
25
+ export {};
@@ -0,0 +1,75 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
3
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
4
+ import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
5
+ import { GetUserUseCase } from "@webiny/api-core/features/users/GetUser/index.js";
6
+ import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
7
+ import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
8
+ import { GetUserFolderAccessUseCase } from "./abstractions.js";
9
+ import { GetFlpUseCase } from "../GetFlp/abstractions.js";
10
+ import { ROOT_FOLDER } from "../../../constants.js";
11
+ import { createAccessDirectory, createUserAccessProfile, getUserFolderLevel } from "./userFolderLevel.js";
12
+ import { mayAskAboutUser } from "./mayAskAboutUser.js";
13
+ class GetUserFolderAccessUseCaseImpl {
14
+ constructor(featureFlags, identityContext, getFlp, getUser, listTeams, listRoles){
15
+ this.featureFlags = featureFlags;
16
+ this.identityContext = identityContext;
17
+ this.getFlp = getFlp;
18
+ this.getUser = getUser;
19
+ this.listTeams = listTeams;
20
+ this.listRoles = listRoles;
21
+ }
22
+ async execute({ userId, folderId }) {
23
+ if (!await mayAskAboutUser(this.identityContext, userId)) return Result.fail(new NotAuthorizedError());
24
+ const unrestricted = Result.ok({
25
+ userId,
26
+ folderId,
27
+ restricted: false,
28
+ canAccess: true
29
+ });
30
+ const flags = this.featureFlags.get();
31
+ if (!folderId || folderId === ROOT_FOLDER || !flags.isEnabled("advancedAccessControlLayer.folderLevelPermissions")) return unrestricted;
32
+ const flp = await this.identityContext.withoutAuthorization(()=>this.getFlp.execute(folderId));
33
+ const permissions = flp?.permissions ?? [];
34
+ if (0 === permissions.length) return unrestricted;
35
+ const teamsEnabled = flags.isEnabled("advancedAccessControlLayer.teams");
36
+ const lookup = await this.identityContext.withoutAuthorization(async ()=>{
37
+ const [user, teams, roles] = await Promise.all([
38
+ this.getUser.execute({
39
+ id: userId
40
+ }),
41
+ teamsEnabled ? this.listTeams.execute() : null,
42
+ this.listRoles.execute()
43
+ ]);
44
+ return {
45
+ user,
46
+ teams,
47
+ roles
48
+ };
49
+ });
50
+ if (lookup.user.isFail()) return Result.fail(lookup.user.error);
51
+ const directory = createAccessDirectory(lookup.teams?.isOk() ? lookup.teams.value : [], lookup.roles.isOk() ? lookup.roles.value : [], teamsEnabled);
52
+ const access = getUserFolderLevel(createUserAccessProfile(lookup.user.value, directory), permissions, teamsEnabled);
53
+ return Result.ok({
54
+ userId,
55
+ folderId,
56
+ restricted: true,
57
+ canAccess: !!access,
58
+ ...access ?? {}
59
+ });
60
+ }
61
+ }
62
+ const GetUserFolderAccessUseCase_GetUserFolderAccessUseCase = GetUserFolderAccessUseCase.createImplementation({
63
+ implementation: GetUserFolderAccessUseCaseImpl,
64
+ dependencies: [
65
+ FeatureFlags,
66
+ IdentityContext,
67
+ GetFlpUseCase,
68
+ GetUserUseCase,
69
+ ListTeamsUseCase,
70
+ ListRolesUseCase
71
+ ]
72
+ });
73
+ export { GetUserFolderAccessUseCase_GetUserFolderAccessUseCase as GetUserFolderAccessUseCase };
74
+
75
+ //# sourceMappingURL=GetUserFolderAccessUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js","sources":["../../../../src/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { GetUserUseCase } from \"@webiny/api-core/features/users/GetUser/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\nimport { ListRolesUseCase } from \"@webiny/api-core/features/security/roles/ListRoles/index.js\";\nimport { GetUserFolderAccessUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport { GetFlpUseCase } from \"~/features/flp/GetFlp/abstractions.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport {\n createAccessDirectory,\n createUserAccessProfile,\n getUserFolderLevel\n} from \"./userFolderLevel.js\";\nimport { mayAskAboutUser } from \"./mayAskAboutUser.js\";\n\n/**\n * One folder's permissions (`GetFlpUseCase`, inherited and code-defined ones included) checked with\n * one user's level (see `getUserFolderLevel`), as `ListFolderAccessUseCase` does for every user.\n */\nclass GetUserFolderAccessUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private featureFlags: FeatureFlags.Interface,\n private identityContext: IdentityContext.Interface,\n private getFlp: GetFlpUseCase.Interface,\n private getUser: GetUserUseCase.Interface,\n private listTeams: ListTeamsUseCase.Interface,\n private listRoles: ListRolesUseCase.Interface\n ) {}\n\n async execute({ userId, folderId }: UseCaseAbstraction.Params): UseCaseAbstraction.Return {\n if (!(await mayAskAboutUser(this.identityContext, userId))) {\n return Result.fail(new NotAuthorizedError());\n }\n\n const unrestricted = Result.ok({ userId, folderId, restricted: false, canAccess: true });\n const flags = this.featureFlags.get();\n if (\n !folderId ||\n folderId === ROOT_FOLDER ||\n !flags.isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n return unrestricted;\n }\n\n const flp = await this.identityContext.withoutAuthorization(() =>\n this.getFlp.execute(folderId)\n );\n const permissions = flp?.permissions ?? [];\n if (permissions.length === 0) {\n return unrestricted;\n }\n\n const teamsEnabled = flags.isEnabled(\"advancedAccessControlLayer.teams\");\n const lookup = await this.identityContext.withoutAuthorization(async () => {\n const [user, teams, roles] = await Promise.all([\n this.getUser.execute({ id: userId }),\n teamsEnabled ? this.listTeams.execute() : null,\n this.listRoles.execute()\n ]);\n return { user, teams, roles };\n });\n if (lookup.user.isFail()) {\n return Result.fail(lookup.user.error);\n }\n\n const directory = createAccessDirectory(\n lookup.teams?.isOk() ? lookup.teams.value : [],\n lookup.roles.isOk() ? lookup.roles.value : [],\n teamsEnabled\n );\n const access = getUserFolderLevel(\n createUserAccessProfile(lookup.user.value, directory),\n permissions,\n teamsEnabled\n );\n\n return Result.ok({\n userId,\n folderId,\n restricted: true,\n canAccess: !!access,\n ...(access ?? {})\n });\n }\n}\n\nexport const GetUserFolderAccessUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetUserFolderAccessUseCaseImpl,\n dependencies: [\n FeatureFlags,\n IdentityContext,\n GetFlpUseCase,\n GetUserUseCase,\n ListTeamsUseCase,\n ListRolesUseCase\n ]\n});\n"],"names":["GetUserFolderAccessUseCaseImpl","featureFlags","identityContext","getFlp","getUser","listTeams","listRoles","userId","folderId","mayAskAboutUser","Result","NotAuthorizedError","unrestricted","flags","ROOT_FOLDER","flp","permissions","teamsEnabled","lookup","user","teams","roles","Promise","directory","createAccessDirectory","access","getUserFolderLevel","createUserAccessProfile","GetUserFolderAccessUseCase","UseCaseAbstraction","FeatureFlags","IdentityContext","GetFlpUseCase","GetUserUseCase","ListTeamsUseCase","ListRolesUseCase"],"mappings":";;;;;;;;;;;;AAqBA,MAAMA;IACF,YACYC,YAAoC,EACpCC,eAA0C,EAC1CC,MAA+B,EAC/BC,OAAiC,EACjCC,SAAqC,EACrCC,SAAqC,CAC/C;aANUL,YAAY,GAAZA;aACAC,eAAe,GAAfA;aACAC,MAAM,GAANA;aACAC,OAAO,GAAPA;aACAC,SAAS,GAATA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQ,EAAEC,MAAM,EAAEC,QAAQ,EAA6B,EAA6B;QACtF,IAAI,CAAE,MAAMC,gBAAgB,IAAI,CAAC,eAAe,EAAEF,SAC9C,OAAOG,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,eAAeF,OAAO,EAAE,CAAC;YAAEH;YAAQC;YAAU,YAAY;YAAO,WAAW;QAAK;QACtF,MAAMK,QAAQ,IAAI,CAAC,YAAY,CAAC,GAAG;QACnC,IACI,CAACL,YACDA,aAAaM,eACb,CAACD,MAAM,SAAS,CAAC,sDAEjB,OAAOD;QAGX,MAAMG,MAAM,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC,IACxD,IAAI,CAAC,MAAM,CAAC,OAAO,CAACP;QAExB,MAAMQ,cAAcD,KAAK,eAAe,EAAE;QAC1C,IAAIC,AAAuB,MAAvBA,YAAY,MAAM,EAClB,OAAOJ;QAGX,MAAMK,eAAeJ,MAAM,SAAS,CAAC;QACrC,MAAMK,SAAS,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC;YAC3D,MAAM,CAACC,MAAMC,OAAOC,MAAM,GAAG,MAAMC,QAAQ,GAAG,CAAC;gBAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;oBAAE,IAAIf;gBAAO;gBAClCU,eAAe,IAAI,CAAC,SAAS,CAAC,OAAO,KAAK;gBAC1C,IAAI,CAAC,SAAS,CAAC,OAAO;aACzB;YACD,OAAO;gBAAEE;gBAAMC;gBAAOC;YAAM;QAChC;QACA,IAAIH,OAAO,IAAI,CAAC,MAAM,IAClB,OAAOR,OAAO,IAAI,CAACQ,OAAO,IAAI,CAAC,KAAK;QAGxC,MAAMK,YAAYC,sBACdN,OAAO,KAAK,EAAE,SAASA,OAAO,KAAK,CAAC,KAAK,GAAG,EAAE,EAC9CA,OAAO,KAAK,CAAC,IAAI,KAAKA,OAAO,KAAK,CAAC,KAAK,GAAG,EAAE,EAC7CD;QAEJ,MAAMQ,SAASC,mBACXC,wBAAwBT,OAAO,IAAI,CAAC,KAAK,EAAEK,YAC3CP,aACAC;QAGJ,OAAOP,OAAO,EAAE,CAAC;YACbH;YACAC;YACA,YAAY;YACZ,WAAW,CAAC,CAACiB;YACb,GAAIA,UAAU,CAAC,CAAC;QACpB;IACJ;AACJ;AAEO,MAAMG,wDAA6BC,2BAAAA,oBAAuC,CAAC;IAC9E,gBAAgB7B;IAChB,cAAc;QACV8B;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -0,0 +1,13 @@
1
+ import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
2
+ import { GetLatestRevisionByEntryIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
3
+ import { ListEntryAccessUseCase as UseCaseAbstraction, ListFolderAccessUseCase } from "./abstractions.js";
4
+ declare class ListEntryAccessUseCaseImpl implements UseCaseAbstraction.Interface {
5
+ private getLatestRevision;
6
+ private listFolderAccess;
7
+ constructor(getLatestRevision: GetLatestRevisionByEntryIdUseCase.Interface, listFolderAccess: ListFolderAccessUseCase.Interface);
8
+ execute(model: CmsModel, entryId: string): UseCaseAbstraction.Return;
9
+ }
10
+ export declare const ListEntryAccessUseCase: typeof ListEntryAccessUseCaseImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListEntryAccessUseCase>;
12
+ };
13
+ export {};
@@ -0,0 +1,28 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { GetLatestRevisionByEntryIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js";
3
+ import { ListEntryAccessUseCase, ListFolderAccessUseCase } from "./abstractions.js";
4
+ class ListEntryAccessUseCaseImpl {
5
+ constructor(getLatestRevision, listFolderAccess){
6
+ this.getLatestRevision = getLatestRevision;
7
+ this.listFolderAccess = listFolderAccess;
8
+ }
9
+ async execute(model, entryId) {
10
+ const result = await this.getLatestRevision.execute(model, {
11
+ id: entryId
12
+ });
13
+ if (result.isFail()) return Result.fail(result.error);
14
+ const entry = result.value;
15
+ const folderId = entry.location?.folderId ?? null;
16
+ return this.listFolderAccess.execute(folderId);
17
+ }
18
+ }
19
+ const ListEntryAccessUseCase_ListEntryAccessUseCase = ListEntryAccessUseCase.createImplementation({
20
+ implementation: ListEntryAccessUseCaseImpl,
21
+ dependencies: [
22
+ GetLatestRevisionByEntryIdUseCase,
23
+ ListFolderAccessUseCase
24
+ ]
25
+ });
26
+ export { ListEntryAccessUseCase_ListEntryAccessUseCase as ListEntryAccessUseCase };
27
+
28
+ //# sourceMappingURL=ListEntryAccessUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/ListFolderAccess/ListEntryAccessUseCase.js","sources":["../../../../src/features/flp/ListFolderAccess/ListEntryAccessUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestRevisionByEntryIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetLatestRevisionByEntryId/index.js\";\nimport {\n ListEntryAccessUseCase as UseCaseAbstraction,\n ListFolderAccessUseCase\n} from \"./abstractions.js\";\n\nclass ListEntryAccessUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private getLatestRevision: GetLatestRevisionByEntryIdUseCase.Interface,\n private listFolderAccess: ListFolderAccessUseCase.Interface\n ) {}\n\n async execute(model: CmsModel, entryId: string): UseCaseAbstraction.Return {\n const result = await this.getLatestRevision.execute(model, { id: entryId });\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n const entry = result.value;\n const folderId = entry.location?.folderId ?? null;\n return this.listFolderAccess.execute(folderId);\n }\n}\n\nexport const ListEntryAccessUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListEntryAccessUseCaseImpl,\n dependencies: [GetLatestRevisionByEntryIdUseCase, ListFolderAccessUseCase]\n});\n"],"names":["ListEntryAccessUseCaseImpl","getLatestRevision","listFolderAccess","model","entryId","result","Result","entry","folderId","ListEntryAccessUseCase","UseCaseAbstraction","GetLatestRevisionByEntryIdUseCase","ListFolderAccessUseCase"],"mappings":";;;AAQA,MAAMA;IACF,YACYC,iBAA8D,EAC9DC,gBAAmD,CAC7D;aAFUD,iBAAiB,GAAjBA;aACAC,gBAAgB,GAAhBA;IACT;IAEH,MAAM,QAAQC,KAAe,EAAEC,OAAe,EAA6B;QACvE,MAAMC,SAAS,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAACF,OAAO;YAAE,IAAIC;QAAQ;QACzE,IAAIC,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAACD,OAAO,KAAK;QAEnC,MAAME,QAAQF,OAAO,KAAK;QAC1B,MAAMG,WAAWD,MAAM,QAAQ,EAAE,YAAY;QAC7C,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAACC;IACzC;AACJ;AAEO,MAAMC,gDAAyBC,uBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBV;IAChB,cAAc;QAACW;QAAmCC;KAAwB;AAC9E"}
@@ -0,0 +1,24 @@
1
+ import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
2
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
3
+ import { ListUsersUseCase } from "@webiny/api-core/features/users/ListUsers/index.js";
4
+ import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
5
+ import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
6
+ import { ListFolderAccessUseCase as UseCaseAbstraction } from "./abstractions.js";
7
+ import { GetFlpUseCase } from "../../../features/flp/GetFlp/abstractions.js";
8
+ import { FolderLevelPermissions } from "../../../features/flp/FolderLevelPermissions/abstractions.js";
9
+ /** For every admin user, the level they would get on the folder (see `getUserFolderLevel`). */
10
+ declare class ListFolderAccessUseCaseImpl implements UseCaseAbstraction.Interface {
11
+ private featureFlags;
12
+ private identityContext;
13
+ private folderLevelPermissions;
14
+ private getFlp;
15
+ private listUsers;
16
+ private listTeams;
17
+ private listRoles;
18
+ constructor(featureFlags: FeatureFlags.Interface, identityContext: IdentityContext.Interface, folderLevelPermissions: FolderLevelPermissions.Interface, getFlp: GetFlpUseCase.Interface, listUsers: ListUsersUseCase.Interface, listTeams: ListTeamsUseCase.Interface, listRoles: ListRolesUseCase.Interface);
19
+ execute(folderId: string | null): UseCaseAbstraction.Return;
20
+ }
21
+ export declare const ListFolderAccessUseCase: typeof ListFolderAccessUseCaseImpl & {
22
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListFolderAccessUseCase>;
23
+ };
24
+ export {};
@@ -0,0 +1,107 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
3
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
4
+ import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/errors.js";
5
+ import { ListUsersUseCase } from "@webiny/api-core/features/users/ListUsers/index.js";
6
+ import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
7
+ import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
8
+ import { ListFolderAccessUseCase } from "./abstractions.js";
9
+ import { GetFlpUseCase } from "../GetFlp/abstractions.js";
10
+ import { FolderLevelPermissions } from "../FolderLevelPermissions/abstractions.js";
11
+ import { ROOT_FOLDER } from "../../../constants.js";
12
+ import { createAccessDirectory, createUserAccessProfile, getUserFolderLevel } from "./userFolderLevel.js";
13
+ const unrestricted = (folderId)=>({
14
+ folderId,
15
+ restricted: false,
16
+ users: [],
17
+ teams: []
18
+ });
19
+ class ListFolderAccessUseCaseImpl {
20
+ constructor(featureFlags, identityContext, folderLevelPermissions, getFlp, listUsers, listTeams, listRoles){
21
+ this.featureFlags = featureFlags;
22
+ this.identityContext = identityContext;
23
+ this.folderLevelPermissions = folderLevelPermissions;
24
+ this.getFlp = getFlp;
25
+ this.listUsers = listUsers;
26
+ this.listTeams = listTeams;
27
+ this.listRoles = listRoles;
28
+ }
29
+ async execute(folderId) {
30
+ const flags = this.featureFlags.get();
31
+ if (!folderId || folderId === ROOT_FOLDER || !flags.isEnabled("advancedAccessControlLayer.folderLevelPermissions")) return Result.ok(unrestricted(folderId));
32
+ const flp = await this.getFlp.execute(folderId);
33
+ const permissions = flp?.permissions ?? [];
34
+ if (0 === permissions.length) return Result.ok(unrestricted(folderId));
35
+ if (this.identityContext.isAuthorizationEnabled()) {
36
+ const canManage = await this.folderLevelPermissions.canManageFolderPermissions({
37
+ ...flp,
38
+ permissions: await this.folderLevelPermissions.getDefaultPermissions(permissions)
39
+ });
40
+ if (!canManage) return Result.fail(new NotAuthorizedError());
41
+ }
42
+ const teamsEnabled = flags.isEnabled("advancedAccessControlLayer.teams");
43
+ const { users, teams, roles } = await this.identityContext.withoutAuthorization(async ()=>{
44
+ const [users, teams, roles] = await Promise.all([
45
+ this.listUsers.execute(),
46
+ this.listTeams.execute(),
47
+ this.listRoles.execute()
48
+ ]);
49
+ return {
50
+ users: users.isOk() ? users.value : [],
51
+ teams: teams.isOk() ? teams.value : [],
52
+ roles: roles.isOk() ? roles.value : []
53
+ };
54
+ });
55
+ const directory = createAccessDirectory(teams, roles, teamsEnabled);
56
+ const teamsBySlug = new Map(teams.map((team)=>[
57
+ team.slug,
58
+ team
59
+ ]));
60
+ const accessUsers = [];
61
+ for (const user of users){
62
+ const access = getUserFolderLevel(createUserAccessProfile(user, directory), permissions, teamsEnabled);
63
+ if (access) accessUsers.push({
64
+ id: user.id,
65
+ displayName: user.displayName,
66
+ email: user.email,
67
+ ...access
68
+ });
69
+ }
70
+ const accessTeams = permissions.filter((p)=>p.target.startsWith("team:") && "no-access" !== p.level).map((p)=>{
71
+ const slug = p.target.slice(5);
72
+ const team = teamsBySlug.get(slug);
73
+ return {
74
+ ...team ? {
75
+ id: team.id,
76
+ name: team.name
77
+ } : {},
78
+ slug,
79
+ level: p.level,
80
+ ...p.inheritedFrom ? {
81
+ inheritedFrom: p.inheritedFrom
82
+ } : {}
83
+ };
84
+ });
85
+ return Result.ok({
86
+ folderId,
87
+ restricted: true,
88
+ users: accessUsers,
89
+ teams: teamsEnabled ? accessTeams : []
90
+ });
91
+ }
92
+ }
93
+ const ListFolderAccessUseCase_ListFolderAccessUseCase = ListFolderAccessUseCase.createImplementation({
94
+ implementation: ListFolderAccessUseCaseImpl,
95
+ dependencies: [
96
+ FeatureFlags,
97
+ IdentityContext,
98
+ FolderLevelPermissions,
99
+ GetFlpUseCase,
100
+ ListUsersUseCase,
101
+ ListTeamsUseCase,
102
+ ListRolesUseCase
103
+ ]
104
+ });
105
+ export { ListFolderAccessUseCase_ListFolderAccessUseCase as ListFolderAccessUseCase };
106
+
107
+ //# sourceMappingURL=ListFolderAccessUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/ListFolderAccess/ListFolderAccessUseCase.js","sources":["../../../../src/features/flp/ListFolderAccess/ListFolderAccessUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/errors.js\";\nimport { ListUsersUseCase } from \"@webiny/api-core/features/users/ListUsers/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\nimport { ListRolesUseCase } from \"@webiny/api-core/features/security/roles/ListRoles/index.js\";\nimport type { Team } from \"@webiny/api-core/types/security.js\";\nimport { ListFolderAccessUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport type { FolderAccess, FolderAccessTeam, FolderAccessUser } from \"./abstractions.js\";\nimport { GetFlpUseCase } from \"~/features/flp/GetFlp/abstractions.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/abstractions.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport {\n createAccessDirectory,\n createUserAccessProfile,\n getUserFolderLevel\n} from \"./userFolderLevel.js\";\n\nconst unrestricted = (folderId: string | null): FolderAccess => ({\n folderId,\n restricted: false,\n users: [],\n teams: []\n});\n\n/** For every admin user, the level they would get on the folder (see `getUserFolderLevel`). */\nclass ListFolderAccessUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private featureFlags: FeatureFlags.Interface,\n private identityContext: IdentityContext.Interface,\n private folderLevelPermissions: FolderLevelPermissions.Interface,\n private getFlp: GetFlpUseCase.Interface,\n private listUsers: ListUsersUseCase.Interface,\n private listTeams: ListTeamsUseCase.Interface,\n private listRoles: ListRolesUseCase.Interface\n ) {}\n\n async execute(folderId: string | null): UseCaseAbstraction.Return {\n const flags = this.featureFlags.get();\n if (\n !folderId ||\n folderId === ROOT_FOLDER ||\n !flags.isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n return Result.ok(unrestricted(folderId));\n }\n\n const flp = await this.getFlp.execute(folderId);\n const permissions = flp?.permissions ?? [];\n if (permissions.length === 0) {\n return Result.ok(unrestricted(folderId));\n }\n\n // Who can access a folder is shown to those who can manage its permissions.\n if (this.identityContext.isAuthorizationEnabled()) {\n const canManage = await this.folderLevelPermissions.canManageFolderPermissions({\n ...flp!,\n permissions: await this.folderLevelPermissions.getDefaultPermissions(permissions)\n });\n if (!canManage) {\n return Result.fail(new NotAuthorizedError());\n }\n }\n\n const teamsEnabled = flags.isEnabled(\"advancedAccessControlLayer.teams\");\n const { users, teams, roles } = await this.identityContext.withoutAuthorization(\n async () => {\n const [users, teams, roles] = await Promise.all([\n this.listUsers.execute(),\n this.listTeams.execute(),\n this.listRoles.execute()\n ]);\n return {\n users: users.isOk() ? users.value : [],\n teams: teams.isOk() ? teams.value : [],\n roles: roles.isOk() ? roles.value : []\n };\n }\n );\n\n const directory = createAccessDirectory(teams, roles, teamsEnabled);\n const teamsBySlug = new Map<string, Team>(teams.map(team => [team.slug, team]));\n\n const accessUsers: FolderAccessUser[] = [];\n for (const user of users) {\n const access = getUserFolderLevel(\n createUserAccessProfile(user, directory),\n permissions,\n teamsEnabled\n );\n if (access) {\n accessUsers.push({\n id: user.id,\n displayName: user.displayName,\n email: user.email,\n ...access\n });\n }\n }\n\n const accessTeams: FolderAccessTeam[] = permissions\n .filter(p => p.target.startsWith(\"team:\") && p.level !== \"no-access\")\n .map(p => {\n const slug = p.target.slice(\"team:\".length);\n const team = teamsBySlug.get(slug);\n return {\n ...(team ? { id: team.id, name: team.name } : {}),\n slug,\n level: p.level,\n ...(p.inheritedFrom ? { inheritedFrom: p.inheritedFrom } : {})\n };\n });\n\n return Result.ok({\n folderId,\n restricted: true,\n users: accessUsers,\n teams: teamsEnabled ? accessTeams : []\n });\n }\n}\n\nexport const ListFolderAccessUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListFolderAccessUseCaseImpl,\n dependencies: [\n FeatureFlags,\n IdentityContext,\n FolderLevelPermissions,\n GetFlpUseCase,\n ListUsersUseCase,\n ListTeamsUseCase,\n ListRolesUseCase\n ]\n});\n"],"names":["unrestricted","folderId","ListFolderAccessUseCaseImpl","featureFlags","identityContext","folderLevelPermissions","getFlp","listUsers","listTeams","listRoles","flags","ROOT_FOLDER","Result","flp","permissions","canManage","NotAuthorizedError","teamsEnabled","users","teams","roles","Promise","directory","createAccessDirectory","teamsBySlug","Map","team","accessUsers","user","access","getUserFolderLevel","createUserAccessProfile","accessTeams","p","slug","ListFolderAccessUseCase","UseCaseAbstraction","FeatureFlags","IdentityContext","FolderLevelPermissions","GetFlpUseCase","ListUsersUseCase","ListTeamsUseCase","ListRolesUseCase"],"mappings":";;;;;;;;;;;;AAmBA,MAAMA,eAAe,CAACC,WAA2C;QAC7DA;QACA,YAAY;QACZ,OAAO,EAAE;QACT,OAAO,EAAE;IACb;AAGA,MAAMC;IACF,YACYC,YAAoC,EACpCC,eAA0C,EAC1CC,sBAAwD,EACxDC,MAA+B,EAC/BC,SAAqC,EACrCC,SAAqC,EACrCC,SAAqC,CAC/C;aAPUN,YAAY,GAAZA;aACAC,eAAe,GAAfA;aACAC,sBAAsB,GAAtBA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;aACAC,SAAS,GAATA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQR,QAAuB,EAA6B;QAC9D,MAAMS,QAAQ,IAAI,CAAC,YAAY,CAAC,GAAG;QACnC,IACI,CAACT,YACDA,aAAaU,eACb,CAACD,MAAM,SAAS,CAAC,sDAEjB,OAAOE,OAAO,EAAE,CAACZ,aAAaC;QAGlC,MAAMY,MAAM,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAACZ;QACtC,MAAMa,cAAcD,KAAK,eAAe,EAAE;QAC1C,IAAIC,AAAuB,MAAvBA,YAAY,MAAM,EAClB,OAAOF,OAAO,EAAE,CAACZ,aAAaC;QAIlC,IAAI,IAAI,CAAC,eAAe,CAAC,sBAAsB,IAAI;YAC/C,MAAMc,YAAY,MAAM,IAAI,CAAC,sBAAsB,CAAC,0BAA0B,CAAC;gBAC3E,GAAGF,GAAG;gBACN,aAAa,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CAACC;YACzE;YACA,IAAI,CAACC,WACD,OAAOH,OAAO,IAAI,CAAC,IAAII;QAE/B;QAEA,MAAMC,eAAeP,MAAM,SAAS,CAAC;QACrC,MAAM,EAAEQ,KAAK,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAC3E;YACI,MAAM,CAACF,OAAOC,OAAOC,MAAM,GAAG,MAAMC,QAAQ,GAAG,CAAC;gBAC5C,IAAI,CAAC,SAAS,CAAC,OAAO;gBACtB,IAAI,CAAC,SAAS,CAAC,OAAO;gBACtB,IAAI,CAAC,SAAS,CAAC,OAAO;aACzB;YACD,OAAO;gBACH,OAAOH,MAAM,IAAI,KAAKA,MAAM,KAAK,GAAG,EAAE;gBACtC,OAAOC,MAAM,IAAI,KAAKA,MAAM,KAAK,GAAG,EAAE;gBACtC,OAAOC,MAAM,IAAI,KAAKA,MAAM,KAAK,GAAG,EAAE;YAC1C;QACJ;QAGJ,MAAME,YAAYC,sBAAsBJ,OAAOC,OAAOH;QACtD,MAAMO,cAAc,IAAIC,IAAkBN,MAAM,GAAG,CAACO,CAAAA,OAAQ;gBAACA,KAAK,IAAI;gBAAEA;aAAK;QAE7E,MAAMC,cAAkC,EAAE;QAC1C,KAAK,MAAMC,QAAQV,MAAO;YACtB,MAAMW,SAASC,mBACXC,wBAAwBH,MAAMN,YAC9BR,aACAG;YAEJ,IAAIY,QACAF,YAAY,IAAI,CAAC;gBACb,IAAIC,KAAK,EAAE;gBACX,aAAaA,KAAK,WAAW;gBAC7B,OAAOA,KAAK,KAAK;gBACjB,GAAGC,MAAM;YACb;QAER;QAEA,MAAMG,cAAkClB,YACnC,MAAM,CAACmB,CAAAA,IAAKA,EAAE,MAAM,CAAC,UAAU,CAAC,YAAYA,AAAY,gBAAZA,EAAE,KAAK,EACnD,GAAG,CAACA,CAAAA;YACD,MAAMC,OAAOD,EAAE,MAAM,CAAC,KAAK,CAAC;YAC5B,MAAMP,OAAOF,YAAY,GAAG,CAACU;YAC7B,OAAO;gBACH,GAAIR,OAAO;oBAAE,IAAIA,KAAK,EAAE;oBAAE,MAAMA,KAAK,IAAI;gBAAC,IAAI,CAAC,CAAC;gBAChDQ;gBACA,OAAOD,EAAE,KAAK;gBACd,GAAIA,EAAE,aAAa,GAAG;oBAAE,eAAeA,EAAE,aAAa;gBAAC,IAAI,CAAC,CAAC;YACjE;QACJ;QAEJ,OAAOrB,OAAO,EAAE,CAAC;YACbX;YACA,YAAY;YACZ,OAAO0B;YACP,OAAOV,eAAee,cAAc,EAAE;QAC1C;IACJ;AACJ;AAEO,MAAMG,kDAA0BC,wBAAAA,oBAAuC,CAAC;IAC3E,gBAAgBlC;IAChB,cAAc;QACVmC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}