@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 type { FolderLevelPermission, FolderPermission } from "../../../flp/flp.types.js";
2
+ export declare class CodeFlpMerger {
3
+ /**
4
+ * Merge code-defined permissions into a stored FLP record.
5
+ *
6
+ * A code-defined permission always wins over a stored one for the same target, and that takes
7
+ * both steps below — ordering alone is not enough, because the two downstream consumers pick a
8
+ * target's permission in different ways:
9
+ *
10
+ * - `CanAccessFolder` takes the first match (`permissions.find(p => p.target === ...)`), so code
11
+ * permissions go first.
12
+ * - `DefaultPermissionsMerger` instead collects *every* permission for the identity and reduces
13
+ * them by access level, preferring `no-access` and then `owner`. A leftover duplicate would
14
+ * join that reduce and could outrank the code-defined entry — a stored `owner` would beat a
15
+ * code-defined `viewer`. Dropping the stored permission for a code-defined target is what
16
+ * prevents it.
17
+ *
18
+ * So: exactly one permission per target, and for code-defined targets it is the code one.
19
+ */
20
+ static merge(flp: FolderLevelPermission, codePermissions: FolderPermission[]): FolderLevelPermission;
21
+ /**
22
+ * The same merge, for callers that hold a plain permission list rather than a stored FLP record
23
+ * — the write paths, which resolve code permissions from the folder's own type and path.
24
+ */
25
+ static mergePermissions(permissions: FolderPermission[], codePermissions: FolderPermission[]): FolderPermission[];
26
+ }
@@ -0,0 +1,20 @@
1
+ class CodeFlpMerger {
2
+ static merge(flp, codePermissions) {
3
+ if (!codePermissions.length) return flp;
4
+ return {
5
+ ...flp,
6
+ permissions: CodeFlpMerger.mergePermissions(flp.permissions, codePermissions)
7
+ };
8
+ }
9
+ static mergePermissions(permissions, codePermissions) {
10
+ if (!codePermissions.length) return permissions;
11
+ const codeTargets = new Set(codePermissions.map((permission)=>permission.target));
12
+ return [
13
+ ...codePermissions,
14
+ ...permissions.filter((permission)=>!codeTargets.has(permission.target))
15
+ ];
16
+ }
17
+ }
18
+ export { CodeFlpMerger };
19
+
20
+ //# sourceMappingURL=CodeFlpMerger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/shared/CodeFlpMerger.js","sources":["../../../../src/features/flp/shared/CodeFlpMerger.ts"],"sourcesContent":["import type { FolderLevelPermission, FolderPermission } from \"~/flp/flp.types.js\";\n\nexport class CodeFlpMerger {\n /**\n * Merge code-defined permissions into a stored FLP record.\n *\n * A code-defined permission always wins over a stored one for the same target, and that takes\n * both steps below — ordering alone is not enough, because the two downstream consumers pick a\n * target's permission in different ways:\n *\n * - `CanAccessFolder` takes the first match (`permissions.find(p => p.target === ...)`), so code\n * permissions go first.\n * - `DefaultPermissionsMerger` instead collects *every* permission for the identity and reduces\n * them by access level, preferring `no-access` and then `owner`. A leftover duplicate would\n * join that reduce and could outrank the code-defined entry — a stored `owner` would beat a\n * code-defined `viewer`. Dropping the stored permission for a code-defined target is what\n * prevents it.\n *\n * So: exactly one permission per target, and for code-defined targets it is the code one.\n */\n static merge(\n flp: FolderLevelPermission,\n codePermissions: FolderPermission[]\n ): FolderLevelPermission {\n if (!codePermissions.length) {\n return flp;\n }\n\n return {\n ...flp,\n permissions: CodeFlpMerger.mergePermissions(flp.permissions, codePermissions)\n };\n }\n\n /**\n * The same merge, for callers that hold a plain permission list rather than a stored FLP record\n * — the write paths, which resolve code permissions from the folder's own type and path.\n */\n static mergePermissions(\n permissions: FolderPermission[],\n codePermissions: FolderPermission[]\n ): FolderPermission[] {\n if (!codePermissions.length) {\n return permissions;\n }\n\n const codeTargets = new Set(codePermissions.map(permission => permission.target));\n\n return [\n ...codePermissions,\n ...permissions.filter(permission => !codeTargets.has(permission.target))\n ];\n }\n}\n"],"names":["CodeFlpMerger","flp","codePermissions","permissions","codeTargets","Set","permission"],"mappings":"AAEO,MAAMA;IAkBT,OAAO,MACHC,GAA0B,EAC1BC,eAAmC,EACd;QACrB,IAAI,CAACA,gBAAgB,MAAM,EACvB,OAAOD;QAGX,OAAO;YACH,GAAGA,GAAG;YACN,aAAaD,cAAc,gBAAgB,CAACC,IAAI,WAAW,EAAEC;QACjE;IACJ;IAMA,OAAO,iBACHC,WAA+B,EAC/BD,eAAmC,EACjB;QAClB,IAAI,CAACA,gBAAgB,MAAM,EACvB,OAAOC;QAGX,MAAMC,cAAc,IAAIC,IAAIH,gBAAgB,GAAG,CAACI,CAAAA,aAAcA,WAAW,MAAM;QAE/E,OAAO;eACAJ;eACAC,YAAY,MAAM,CAACG,CAAAA,aAAc,CAACF,YAAY,GAAG,CAACE,WAAW,MAAM;SACzE;IACL;AACJ"}
@@ -0,0 +1,15 @@
1
+ interface ParsedPath {
2
+ /** Normalized path, without the wildcard suffix, e.g. `root/marketing`. */
3
+ base: string;
4
+ /** Whether the rule was written with a trailing `/*`, meaning "this folder and its subtree". */
5
+ subtree: boolean;
6
+ }
7
+ /**
8
+ * Folder paths are stored as `root/<slug>[/<slug>...]` (see `~/utils/Path.ts`). Code-defined FLPs
9
+ * are authored by hand, so we accept the friendlier `/marketing` form as well and normalize it.
10
+ */
11
+ export declare class CodeFlpPath {
12
+ static parse(path: string): ParsedPath;
13
+ static matches(rulePath: string, folderPath: string): boolean;
14
+ }
15
+ export {};
@@ -0,0 +1,29 @@
1
+ import { ROOT_FOLDER } from "@webiny/shared-aco";
2
+ class CodeFlpPath {
3
+ static parse(path) {
4
+ let value = path.trim();
5
+ let subtree = false;
6
+ if (value.endsWith("*")) {
7
+ subtree = true;
8
+ value = value.slice(0, -1);
9
+ }
10
+ value = value.replace(/^\/+/, "").replace(/\/+$/, "");
11
+ if (value === ROOT_FOLDER || "" === value) return {
12
+ base: ROOT_FOLDER,
13
+ subtree: "" === value ? true : subtree
14
+ };
15
+ const base = value.startsWith(`${ROOT_FOLDER}/`) ? value : `${ROOT_FOLDER}/${value}`;
16
+ return {
17
+ base,
18
+ subtree
19
+ };
20
+ }
21
+ static matches(rulePath, folderPath) {
22
+ const { base, subtree } = CodeFlpPath.parse(rulePath);
23
+ if (folderPath === base) return true;
24
+ return subtree ? folderPath.startsWith(`${base}/`) : false;
25
+ }
26
+ }
27
+ export { CodeFlpPath };
28
+
29
+ //# sourceMappingURL=CodeFlpPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/shared/CodeFlpPath.js","sources":["../../../../src/features/flp/shared/CodeFlpPath.ts"],"sourcesContent":["import { ROOT_FOLDER } from \"@webiny/shared-aco\";\n\ninterface ParsedPath {\n /** Normalized path, without the wildcard suffix, e.g. `root/marketing`. */\n base: string;\n /** Whether the rule was written with a trailing `/*`, meaning \"this folder and its subtree\". */\n subtree: boolean;\n}\n\n/**\n * Folder paths are stored as `root/<slug>[/<slug>...]` (see `~/utils/Path.ts`). Code-defined FLPs\n * are authored by hand, so we accept the friendlier `/marketing` form as well and normalize it.\n */\nexport class CodeFlpPath {\n static parse(path: string): ParsedPath {\n let value = path.trim();\n let subtree = false;\n\n // A trailing \"*\" (with or without the separator) means \"this folder and everything below\".\n if (value.endsWith(\"*\")) {\n subtree = true;\n value = value.slice(0, -1);\n }\n\n // Strip surrounding separators, so \"/marketing/\" and \"marketing\" normalize the same way.\n value = value.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n\n if (value === ROOT_FOLDER || value === \"\") {\n return { base: ROOT_FOLDER, subtree: value === \"\" ? true : subtree };\n }\n\n // The \"root\" prefix is an implementation detail of stored paths — make it optional.\n const base = value.startsWith(`${ROOT_FOLDER}/`) ? value : `${ROOT_FOLDER}/${value}`;\n\n return { base, subtree };\n }\n\n static matches(rulePath: string, folderPath: string): boolean {\n const { base, subtree } = CodeFlpPath.parse(rulePath);\n\n if (folderPath === base) {\n return true;\n }\n\n return subtree ? folderPath.startsWith(`${base}/`) : false;\n }\n}\n"],"names":["CodeFlpPath","path","value","subtree","ROOT_FOLDER","base","rulePath","folderPath"],"mappings":";AAaO,MAAMA;IACT,OAAO,MAAMC,IAAY,EAAc;QACnC,IAAIC,QAAQD,KAAK,IAAI;QACrB,IAAIE,UAAU;QAGd,IAAID,MAAM,QAAQ,CAAC,MAAM;YACrBC,UAAU;YACVD,QAAQA,MAAM,KAAK,CAAC,GAAG;QAC3B;QAGAA,QAAQA,MAAM,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ;QAElD,IAAIA,UAAUE,eAAeF,AAAU,OAAVA,OACzB,OAAO;YAAE,MAAME;YAAa,SAASF,AAAU,OAAVA,QAAe,OAAOC;QAAQ;QAIvE,MAAME,OAAOH,MAAM,UAAU,CAAC,GAAGE,YAAY,CAAC,CAAC,IAAIF,QAAQ,GAAGE,YAAY,CAAC,EAAEF,OAAO;QAEpF,OAAO;YAAEG;YAAMF;QAAQ;IAC3B;IAEA,OAAO,QAAQG,QAAgB,EAAEC,UAAkB,EAAW;QAC1D,MAAM,EAAEF,IAAI,EAAEF,OAAO,EAAE,GAAGH,YAAY,KAAK,CAACM;QAE5C,IAAIC,eAAeF,MACf,OAAO;QAGX,OAAOF,UAAUI,WAAW,UAAU,CAAC,GAAGF,KAAK,CAAC,CAAC,IAAI;IACzD;AACJ"}
@@ -0,0 +1,10 @@
1
+ import type { CodeFolderPermission } from "./abstractions.js";
2
+ import type { FolderPermission } from "../../../flp/flp.types.js";
3
+ /**
4
+ * Code-defined permissions are authored as `{ team: "editors" }` or `{ user: "<id>" }`. Internally,
5
+ * a permission's target is a single string — `team:editors` or `admin:<id>` — so this is where the
6
+ * authored form is turned into the stored one.
7
+ */
8
+ export declare class CodeFlpTarget {
9
+ static resolve(permission: CodeFolderPermission): FolderPermission;
10
+ }
@@ -0,0 +1,26 @@
1
+ import { WebinyError } from "@webiny/error";
2
+ class CodeFlpTarget {
3
+ static resolve(permission) {
4
+ const { team, user, level } = permission;
5
+ if (void 0 !== team && void 0 !== user) throw new WebinyError("A code-defined folder permission must target either a team or a user, not both.", "CODE_FLP_AMBIGUOUS_TARGET", {
6
+ team,
7
+ user
8
+ });
9
+ if (void 0 !== team) return {
10
+ target: `team:${team}`,
11
+ level,
12
+ plugin: true
13
+ };
14
+ if (void 0 !== user) return {
15
+ target: `admin:${user}`,
16
+ level,
17
+ plugin: true
18
+ };
19
+ throw new WebinyError('A code-defined folder permission must specify either "team" or "user".', "CODE_FLP_MISSING_TARGET", {
20
+ permission
21
+ });
22
+ }
23
+ }
24
+ export { CodeFlpTarget };
25
+
26
+ //# sourceMappingURL=CodeFlpTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/shared/CodeFlpTarget.js","sources":["../../../../src/features/flp/shared/CodeFlpTarget.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport type { CodeFolderPermission } from \"./abstractions.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\n\n/**\n * Code-defined permissions are authored as `{ team: \"editors\" }` or `{ user: \"<id>\" }`. Internally,\n * a permission's target is a single string — `team:editors` or `admin:<id>` — so this is where the\n * authored form is turned into the stored one.\n */\nexport class CodeFlpTarget {\n static resolve(permission: CodeFolderPermission): FolderPermission {\n const { team, user, level } = permission;\n\n if (team !== undefined && user !== undefined) {\n throw new WebinyError(\n `A code-defined folder permission must target either a team or a user, not both.`,\n \"CODE_FLP_AMBIGUOUS_TARGET\",\n { team, user }\n );\n }\n\n if (team !== undefined) {\n return { target: `team:${team}`, level, plugin: true };\n }\n\n if (user !== undefined) {\n return { target: `admin:${user}`, level, plugin: true };\n }\n\n // Without a target we'd silently produce a permission that matches nobody. For a rule that\n // denies access, dropping it quietly would mean accidental exposure — so fail loudly.\n throw new WebinyError(\n `A code-defined folder permission must specify either \"team\" or \"user\".`,\n \"CODE_FLP_MISSING_TARGET\",\n { permission }\n );\n }\n}\n"],"names":["CodeFlpTarget","permission","team","user","level","undefined","WebinyError"],"mappings":";AASO,MAAMA;IACT,OAAO,QAAQC,UAAgC,EAAoB;QAC/D,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH;QAE9B,IAAIC,AAASG,WAATH,QAAsBC,AAASE,WAATF,MACtB,MAAM,IAAIG,YACN,mFACA,6BACA;YAAEJ;YAAMC;QAAK;QAIrB,IAAID,AAASG,WAATH,MACA,OAAO;YAAE,QAAQ,CAAC,KAAK,EAAEA,MAAM;YAAEE;YAAO,QAAQ;QAAK;QAGzD,IAAID,AAASE,WAATF,MACA,OAAO;YAAE,QAAQ,CAAC,MAAM,EAAEA,MAAM;YAAEC;YAAO,QAAQ;QAAK;QAK1D,MAAM,IAAIE,YACN,0EACA,2BACA;YAAEL;QAAW;IAErB;AACJ"}
@@ -0,0 +1,15 @@
1
+ import { type CodeFlp, CodeFlpsProvider as CodeFlpsProviderAbstraction, FlpFactory, type GetCodePermissionsParams } from "./abstractions.js";
2
+ import type { FolderPermission } from "../../../flp/flp.types.js";
3
+ declare class CodeFlpsProviderImpl implements CodeFlpsProviderAbstraction.Interface {
4
+ private flpFactories;
5
+ private cache;
6
+ constructor(flpFactories: FlpFactory.Interface[]);
7
+ getPermissions({ type, path }: GetCodePermissionsParams): Promise<FolderPermission[]>;
8
+ listFlps(): Promise<CodeFlp[]>;
9
+ /** All code-defined FLPs, collected from every registered `FlpFactory`. */
10
+ private getCodeFlps;
11
+ }
12
+ export declare const CodeFlpsProvider: typeof CodeFlpsProviderImpl & {
13
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").ICodeFlpsProvider>;
14
+ };
15
+ export {};
@@ -0,0 +1,36 @@
1
+ import { CodeFlpsProvider, FlpFactory } from "./abstractions.js";
2
+ import { CodeFlpPath } from "./CodeFlpPath.js";
3
+ import { CodeFlpTarget } from "./CodeFlpTarget.js";
4
+ class CodeFlpsProviderImpl {
5
+ constructor(flpFactories){
6
+ this.flpFactories = flpFactories;
7
+ }
8
+ async getPermissions({ type, path }) {
9
+ const codeFlps = await this.getCodeFlps();
10
+ return codeFlps.filter((flp)=>flp.type === type && CodeFlpPath.matches(flp.path, path)).flatMap((flp)=>flp.permissions.map((permission)=>CodeFlpTarget.resolve(permission)));
11
+ }
12
+ listFlps() {
13
+ return this.getCodeFlps();
14
+ }
15
+ async getCodeFlps() {
16
+ if (void 0 === this.cache) {
17
+ const results = await Promise.all(this.flpFactories.map((factory)=>factory.execute()));
18
+ this.cache = results.flat();
19
+ }
20
+ return this.cache;
21
+ }
22
+ }
23
+ const CodeFlpsProvider_CodeFlpsProvider = CodeFlpsProvider.createImplementation({
24
+ implementation: CodeFlpsProviderImpl,
25
+ dependencies: [
26
+ [
27
+ FlpFactory,
28
+ {
29
+ multiple: true
30
+ }
31
+ ]
32
+ ]
33
+ });
34
+ export { CodeFlpsProvider_CodeFlpsProvider as CodeFlpsProvider };
35
+
36
+ //# sourceMappingURL=CodeFlpsProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/shared/CodeFlpsProvider.js","sources":["../../../../src/features/flp/shared/CodeFlpsProvider.ts"],"sourcesContent":["import {\n type CodeFlp,\n CodeFlpsProvider as CodeFlpsProviderAbstraction,\n FlpFactory,\n type GetCodePermissionsParams\n} from \"./abstractions.js\";\nimport { CodeFlpPath } from \"./CodeFlpPath.js\";\nimport { CodeFlpTarget } from \"./CodeFlpTarget.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\n\nclass CodeFlpsProviderImpl implements CodeFlpsProviderAbstraction.Interface {\n private cache: CodeFlp[] | undefined;\n\n constructor(private flpFactories: FlpFactory.Interface[]) {}\n\n async getPermissions({ type, path }: GetCodePermissionsParams): Promise<FolderPermission[]> {\n const codeFlps = await this.getCodeFlps();\n\n return codeFlps\n .filter(flp => flp.type === type && CodeFlpPath.matches(flp.path, path))\n .flatMap<FolderPermission>(flp => {\n return flp.permissions.map(permission => CodeFlpTarget.resolve(permission));\n });\n }\n\n public listFlps(): Promise<CodeFlp[]> {\n return this.getCodeFlps();\n }\n\n /** All code-defined FLPs, collected from every registered `FlpFactory`. */\n private async getCodeFlps(): Promise<CodeFlp[]> {\n if (this.cache === undefined) {\n const results = await Promise.all(this.flpFactories.map(factory => factory.execute()));\n this.cache = results.flat();\n }\n\n return this.cache;\n }\n}\n\nexport const CodeFlpsProvider = CodeFlpsProviderAbstraction.createImplementation({\n implementation: CodeFlpsProviderImpl,\n dependencies: [[FlpFactory, { multiple: true }]]\n});\n"],"names":["CodeFlpsProviderImpl","flpFactories","type","path","codeFlps","flp","CodeFlpPath","permission","CodeFlpTarget","undefined","results","Promise","factory","CodeFlpsProvider","CodeFlpsProviderAbstraction","FlpFactory"],"mappings":";;;AAUA,MAAMA;IAGF,YAAoBC,YAAoC,CAAE;aAAtCA,YAAY,GAAZA;IAAuC;IAE3D,MAAM,eAAe,EAAEC,IAAI,EAAEC,IAAI,EAA4B,EAA+B;QACxF,MAAMC,WAAW,MAAM,IAAI,CAAC,WAAW;QAEvC,OAAOA,SACF,MAAM,CAACC,CAAAA,MAAOA,IAAI,IAAI,KAAKH,QAAQI,YAAY,OAAO,CAACD,IAAI,IAAI,EAAEF,OACjE,OAAO,CAAmBE,CAAAA,MAChBA,IAAI,WAAW,CAAC,GAAG,CAACE,CAAAA,aAAcC,cAAc,OAAO,CAACD;IAE3E;IAEO,WAA+B;QAClC,OAAO,IAAI,CAAC,WAAW;IAC3B;IAGA,MAAc,cAAkC;QAC5C,IAAI,AAAeE,WAAf,IAAI,CAAC,KAAK,EAAgB;YAC1B,MAAMC,UAAU,MAAMC,QAAQ,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAACC,CAAAA,UAAWA,QAAQ,OAAO;YAClF,IAAI,CAAC,KAAK,GAAGF,QAAQ,IAAI;QAC7B;QAEA,OAAO,IAAI,CAAC,KAAK;IACrB;AACJ;AAEO,MAAMG,oCAAmBC,iBAAAA,oBAAgD,CAAC;IAC7E,gBAAgBd;IAChB,cAAc;QAAC;YAACe;YAAY;gBAAE,UAAU;YAAK;SAAE;KAAC;AACpD"}
@@ -0,0 +1,79 @@
1
+ import type { FolderAccessLevel, FolderPermission } from "../../../flp/flp.types.js";
2
+ interface CodeTeamPermission {
3
+ /** Slug of the team the permission is granted to. */
4
+ team: string;
5
+ user?: never;
6
+ level: FolderAccessLevel;
7
+ }
8
+ interface CodeUserPermission {
9
+ /** ID of the admin user the permission is granted to. */
10
+ user: string;
11
+ team?: never;
12
+ level: FolderAccessLevel;
13
+ }
14
+ /**
15
+ * A permission grants a level to exactly one target: either a team or a single admin user. The
16
+ * `team:` / `admin:` target strings used internally are generated from these.
17
+ *
18
+ * Prefer `team` — team slugs are authored by hand and stable, while user IDs are generated at
19
+ * runtime and differ per environment.
20
+ */
21
+ export type CodeFolderPermission = CodeTeamPermission | CodeUserPermission;
22
+ export type CodeFlp = {
23
+ /**
24
+ * Folder type the rule applies to. Use `FlpFactory.FolderType` to build the built-in ones
25
+ * instead of writing the string by hand.
26
+ */
27
+ type: string;
28
+ /**
29
+ * Folder path the rule binds to. The leading `root` segment is optional, so both `/marketing`
30
+ * and `root/marketing` are accepted. A trailing `/*` matches the folder and its whole subtree.
31
+ */
32
+ path: string;
33
+ permissions: CodeFolderPermission[];
34
+ };
35
+ export interface IFlpFactory {
36
+ execute(): Promise<CodeFlp[]>;
37
+ }
38
+ /** Provide code-defined folder-level permissions. */
39
+ export declare const FlpFactory: import("@webiny/di").Abstraction<IFlpFactory> & {
40
+ FolderType: {
41
+ /** File Manager folders. */
42
+ FileManager: {
43
+ /** Folders holding files. */
44
+ Files: string;
45
+ };
46
+ /** Headless CMS folders. */
47
+ Cms: {
48
+ /** Folders holding entries of a content model, addressed by its `modelId`. */
49
+ Entries(modelId: string): string;
50
+ };
51
+ };
52
+ };
53
+ export declare namespace FlpFactory {
54
+ type Interface = IFlpFactory;
55
+ type Return = Promise<CodeFlp[]>;
56
+ type Flp = CodeFlp;
57
+ type Permission = CodeFolderPermission;
58
+ }
59
+ export interface GetCodePermissionsParams {
60
+ type: string;
61
+ path: string;
62
+ }
63
+ export interface ICodeFlpsProvider {
64
+ /**
65
+ * Return all code-defined permissions that apply to the given folder type and path.
66
+ */
67
+ getPermissions(params: GetCodePermissionsParams): Promise<FolderPermission[]>;
68
+ /** All code-defined FLPs, as the registered `FlpFactory` implementations return them. */
69
+ listFlps(): Promise<CodeFlp[]>;
70
+ }
71
+ /**
72
+ * Resolve code-defined folder-level permissions for a given folder. Only permissions contributed by
73
+ * an `FlpFactory` are considered — the ones stored in the database are loaded separately.
74
+ */
75
+ export declare const CodeFlpsProvider: import("@webiny/di").Abstraction<ICodeFlpsProvider>;
76
+ export declare namespace CodeFlpsProvider {
77
+ type Interface = ICodeFlpsProvider;
78
+ }
79
+ export {};
@@ -0,0 +1,19 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ import { FM_FILE_TYPE } from "../../../constants.js";
3
+ const FolderType = {
4
+ FileManager: {
5
+ Files: FM_FILE_TYPE
6
+ },
7
+ Cms: {
8
+ Entries (modelId) {
9
+ return `cms:${modelId}`;
10
+ }
11
+ }
12
+ };
13
+ const FlpFactory = Object.assign(createAbstraction("FlpFactory"), {
14
+ FolderType: FolderType
15
+ });
16
+ const CodeFlpsProvider = createAbstraction("CodeFlpsProvider");
17
+ export { CodeFlpsProvider, FlpFactory };
18
+
19
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/shared/abstractions.js","sources":["../../../../src/features/flp/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { FM_FILE_TYPE } from \"~/constants.js\";\nimport type { FolderAccessLevel, FolderPermission } from \"~/flp/flp.types.js\";\n\ninterface CodeTeamPermission {\n /** Slug of the team the permission is granted to. */\n team: string;\n user?: never;\n level: FolderAccessLevel;\n}\n\ninterface CodeUserPermission {\n /** ID of the admin user the permission is granted to. */\n user: string;\n team?: never;\n level: FolderAccessLevel;\n}\n\n/**\n * A permission grants a level to exactly one target: either a team or a single admin user. The\n * `team:` / `admin:` target strings used internally are generated from these.\n *\n * Prefer `team` — team slugs are authored by hand and stable, while user IDs are generated at\n * runtime and differ per environment.\n */\nexport type CodeFolderPermission = CodeTeamPermission | CodeUserPermission;\n\nexport type CodeFlp = {\n /**\n * Folder type the rule applies to. Use `FlpFactory.FolderType` to build the built-in ones\n * instead of writing the string by hand.\n */\n type: string;\n /**\n * Folder path the rule binds to. The leading `root` segment is optional, so both `/marketing`\n * and `root/marketing` are accepted. A trailing `/*` matches the folder and its whole subtree.\n */\n path: string;\n permissions: CodeFolderPermission[];\n};\n\nexport interface IFlpFactory {\n execute(): Promise<CodeFlp[]>;\n}\n\n/**\n * The folder types shipped with Webiny, grouped by the app that owns them, so `CodeFlp.type` does\n * not have to be written by hand.\n *\n * Folder types stay open-ended — every app registering folders picks its own type — so `type`\n * remains a plain `string` and a custom app can still pass its own value directly.\n */\nconst FolderType = {\n /** File Manager folders. */\n FileManager: {\n /** Folders holding files. */\n Files: FM_FILE_TYPE as string\n },\n /** Headless CMS folders. */\n Cms: {\n /** Folders holding entries of a content model, addressed by its `modelId`. */\n Entries(modelId: string): string {\n return `cms:${modelId}`;\n }\n }\n};\n\n/** Provide code-defined folder-level permissions. */\nexport const FlpFactory = Object.assign(createAbstraction<IFlpFactory>(\"FlpFactory\"), {\n FolderType\n});\n\nexport namespace FlpFactory {\n export type Interface = IFlpFactory;\n export type Return = Promise<CodeFlp[]>;\n export type Flp = CodeFlp;\n export type Permission = CodeFolderPermission;\n}\n\nexport interface GetCodePermissionsParams {\n type: string;\n path: string;\n}\n\nexport interface ICodeFlpsProvider {\n /**\n * Return all code-defined permissions that apply to the given folder type and path.\n */\n getPermissions(params: GetCodePermissionsParams): Promise<FolderPermission[]>;\n /** All code-defined FLPs, as the registered `FlpFactory` implementations return them. */\n listFlps(): Promise<CodeFlp[]>;\n}\n\n/**\n * Resolve code-defined folder-level permissions for a given folder. Only permissions contributed by\n * an `FlpFactory` are considered — the ones stored in the database are loaded separately.\n */\nexport const CodeFlpsProvider = createAbstraction<ICodeFlpsProvider>(\"CodeFlpsProvider\");\n\nexport namespace CodeFlpsProvider {\n export type Interface = ICodeFlpsProvider;\n}\n"],"names":["FolderType","FM_FILE_TYPE","modelId","FlpFactory","Object","createAbstraction","CodeFlpsProvider"],"mappings":";;AAoDA,MAAMA,aAAa;IAEf,aAAa;QAET,OAAOC;IACX;IAEA,KAAK;QAED,SAAQC,OAAe;YACnB,OAAO,CAAC,IAAI,EAAEA,SAAS;QAC3B;IACJ;AACJ;AAGO,MAAMC,aAAaC,OAAO,MAAM,CAACC,kBAA+B,eAAe;IAClFL,YAAAA;AACJ;AA2BO,MAAMM,mBAAmBD,kBAAqC"}
@@ -0,0 +1,5 @@
1
+ import { type Container } from "@webiny/feature/api";
2
+ export declare const CodeFlpsFeature: {
3
+ name: string;
4
+ register(container: Container): void;
5
+ };
@@ -0,0 +1,17 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
3
+ import { CodeFlpsProvider } from "./CodeFlpsProvider.js";
4
+ import { GetFlpWithCodeFlps } from "../GetFlp/decorators/GetFlpWithCodeFlps.js";
5
+ import { ListFlpsWithCodeFlps } from "../ListFlps/decorators/ListFlpsWithCodeFlps.js";
6
+ const CodeFlpsFeature = createFeature({
7
+ name: "CodeFlps",
8
+ register (container) {
9
+ if (!container.resolve(FeatureFlags).get().isEnabled("advancedAccessControlLayer.folderLevelPermissions")) return;
10
+ container.register(CodeFlpsProvider).inSingletonScope();
11
+ container.registerDecorator(GetFlpWithCodeFlps);
12
+ container.registerDecorator(ListFlpsWithCodeFlps);
13
+ }
14
+ });
15
+ export { CodeFlpsFeature };
16
+
17
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/flp/shared/feature.js","sources":["../../../../src/features/flp/shared/feature.ts"],"sourcesContent":["import { type Container, createFeature } from \"@webiny/feature/api\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { CodeFlpsProvider } from \"./CodeFlpsProvider.js\";\nimport { GetFlpWithCodeFlps } from \"~/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js\";\nimport { ListFlpsWithCodeFlps } from \"~/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js\";\n\nexport const CodeFlpsFeature = createFeature({\n name: \"CodeFlps\",\n register(container: Container) {\n // Code-defined FLPs are part of folder-level permissions, which is license-gated. Check at\n // register time so nothing wires up — and no code permission is ever enforced — without the\n // entitlement.\n if (\n !container\n .resolve(FeatureFlags)\n .get()\n .isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n return;\n }\n\n container.register(CodeFlpsProvider).inSingletonScope();\n container.registerDecorator(GetFlpWithCodeFlps);\n container.registerDecorator(ListFlpsWithCodeFlps);\n }\n});\n"],"names":["CodeFlpsFeature","createFeature","container","FeatureFlags","CodeFlpsProvider","GetFlpWithCodeFlps","ListFlpsWithCodeFlps"],"mappings":";;;;;AAMO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAoB;QAIzB,IACI,CAACA,UACI,OAAO,CAACC,cACR,GAAG,GACH,SAAS,CAAC,sDAEf;QAGJD,UAAU,QAAQ,CAACE,kBAAkB,gBAAgB;QACrDF,UAAU,iBAAiB,CAACG;QAC5BH,UAAU,iBAAiB,CAACI;IAChC;AACJ"}
@@ -0,0 +1,4 @@
1
+ export * from "./abstractions.js";
2
+ export * from "./CodeFlpMerger.js";
3
+ export * from "./CodeFlpPath.js";
4
+ export * from "./CodeFlpTarget.js";
@@ -0,0 +1,4 @@
1
+ export * from "./abstractions.js";
2
+ export * from "./CodeFlpMerger.js";
3
+ export * from "./CodeFlpPath.js";
4
+ export * from "./CodeFlpTarget.js";
@@ -1,11 +1,19 @@
1
1
  import { FolderLevelPermissions } from "../../../../features/flp/FolderLevelPermissions/index.js";
2
2
  import { CreateFolderUseCase } from "../abstractions.js";
3
3
  import type { CreateFolderParams } from "../../../../folder/folder.types.js";
4
+ import { CodeFlpsProvider } from "../../../../features/flp/shared/index.js";
4
5
  declare class CreateFolderWithFolderLevelPermissionsImpl implements CreateFolderUseCase.Interface {
5
6
  private folderLevelPermissions;
6
7
  private readonly decoretee;
7
- constructor(folderLevelPermissions: FolderLevelPermissions.Interface, decoretee: CreateFolderUseCase.Interface);
8
+ private readonly codeFlpsProvider?;
9
+ constructor(folderLevelPermissions: FolderLevelPermissions.Interface, codeFlpsProvider: CodeFlpsProvider.Interface | undefined, decoretee: CreateFolderUseCase.Interface);
8
10
  execute(params: CreateFolderParams): CreateFolderUseCase.Return;
11
+ /**
12
+ * Code-defined permissions are resolved from the folder's own type and path rather than the FLP
13
+ * catalog: the record for a folder this new is written by an event handler and may not exist
14
+ * yet. Without this the response would omit them until something refetched the folder.
15
+ */
16
+ private withCodePermissions;
9
17
  }
10
18
  export declare const CreateFolderWithFolderLevelPermissions: typeof CreateFolderWithFolderLevelPermissionsImpl;
11
19
  export {};
@@ -2,9 +2,11 @@ import { FolderLevelPermissions } from "../../../flp/FolderLevelPermissions/inde
2
2
  import { CreateFolderUseCase } from "../abstractions.js";
3
3
  import { Result, createDecorator } from "@webiny/feature/api";
4
4
  import { FolderNotAuthorizedError } from "../../../../domain/folder/errors.js";
5
+ import { CodeFlpMerger, CodeFlpsProvider } from "../../../flp/shared/index.js";
5
6
  class CreateFolderWithFolderLevelPermissionsImpl {
6
- constructor(folderLevelPermissions, decoretee){
7
+ constructor(folderLevelPermissions, codeFlpsProvider, decoretee){
7
8
  this.folderLevelPermissions = folderLevelPermissions;
9
+ this.codeFlpsProvider = codeFlpsProvider;
8
10
  this.decoretee = decoretee;
9
11
  }
10
12
  async execute(params) {
@@ -20,18 +22,33 @@ class CreateFolderWithFolderLevelPermissionsImpl {
20
22
  const result = await this.decoretee.execute(params);
21
23
  if (result.isFail()) return Result.fail(result.error);
22
24
  const folder = result.value;
23
- const permissionsWithDefaults = await this.folderLevelPermissions.getDefaultPermissions(folder?.permissions ?? []);
25
+ const permissions = await this.withCodePermissions(folder, folder?.permissions ?? []);
26
+ const permissionsWithDefaults = await this.folderLevelPermissions.getDefaultPermissions(permissions);
24
27
  return Result.ok({
25
28
  ...folder,
26
29
  permissions: permissionsWithDefaults
27
30
  });
28
31
  }
32
+ async withCodePermissions(folder, permissions) {
33
+ if (!this.codeFlpsProvider) return permissions;
34
+ const codePermissions = await this.codeFlpsProvider.getPermissions({
35
+ type: folder.type,
36
+ path: folder.path
37
+ });
38
+ return CodeFlpMerger.mergePermissions(permissions, codePermissions);
39
+ }
29
40
  }
30
41
  const CreateFolderWithFolderLevelPermissions = createDecorator({
31
42
  abstraction: CreateFolderUseCase,
32
43
  decorator: CreateFolderWithFolderLevelPermissionsImpl,
33
44
  dependencies: [
34
- FolderLevelPermissions
45
+ FolderLevelPermissions,
46
+ [
47
+ CodeFlpsProvider,
48
+ {
49
+ optional: true
50
+ }
51
+ ]
35
52
  ]
36
53
  });
37
54
  export { CreateFolderWithFolderLevelPermissions };
@@ -1 +1 @@
1
- {"version":3,"file":"features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js","sources":["../../../../../src/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.ts"],"sourcesContent":["import { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { CreateFolderUseCase } from \"../abstractions.js\";\nimport type { CreateFolderParams } from \"~/folder/folder.types.js\";\nimport { createDecorator, Result } from \"@webiny/feature/api\";\nimport { FolderNotAuthorizedError } from \"~/domain/folder/errors.js\";\n\nclass CreateFolderWithFolderLevelPermissionsImpl implements CreateFolderUseCase.Interface {\n private folderLevelPermissions: FolderLevelPermissions.Interface;\n private readonly decoretee: CreateFolderUseCase.Interface;\n\n constructor(\n folderLevelPermissions: FolderLevelPermissions.Interface,\n decoretee: CreateFolderUseCase.Interface\n ) {\n this.folderLevelPermissions = folderLevelPermissions;\n this.decoretee = decoretee;\n }\n\n async execute(params: CreateFolderParams): CreateFolderUseCase.Return {\n let canCreateFolder: boolean;\n if (params.parentId) {\n const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(\n params.parentId\n );\n canCreateFolder = await this.folderLevelPermissions.canAccessFolder({\n permissions,\n rwd: \"w\"\n });\n } else {\n canCreateFolder = this.folderLevelPermissions.canCreateFolderInRoot();\n }\n\n if (!canCreateFolder) {\n return Result.fail(new FolderNotAuthorizedError());\n }\n\n const result = await this.decoretee.execute(params);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const folder = result.value;\n\n // Let's set default permissions based on the current user.\n const permissionsWithDefaults = await this.folderLevelPermissions.getDefaultPermissions(\n folder?.permissions ?? []\n );\n\n return Result.ok({\n ...folder,\n permissions: permissionsWithDefaults\n });\n }\n}\n\nexport const CreateFolderWithFolderLevelPermissions = createDecorator({\n abstraction: CreateFolderUseCase,\n decorator: CreateFolderWithFolderLevelPermissionsImpl,\n dependencies: [FolderLevelPermissions]\n});\n"],"names":["CreateFolderWithFolderLevelPermissionsImpl","folderLevelPermissions","decoretee","params","canCreateFolder","permissions","Result","FolderNotAuthorizedError","result","folder","permissionsWithDefaults","CreateFolderWithFolderLevelPermissions","createDecorator","CreateFolderUseCase","FolderLevelPermissions"],"mappings":";;;;AAMA,MAAMA;IAIF,YACIC,sBAAwD,EACxDC,SAAwC,CAC1C;QACE,IAAI,CAAC,sBAAsB,GAAGD;QAC9B,IAAI,CAAC,SAAS,GAAGC;IACrB;IAEA,MAAM,QAAQC,MAA0B,EAA8B;QAClE,IAAIC;QACJ,IAAID,OAAO,QAAQ,EAAE;YACjB,MAAME,cAAc,MAAM,IAAI,CAAC,sBAAsB,CAAC,yBAAyB,CAC3EF,OAAO,QAAQ;YAEnBC,kBAAkB,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC;gBAChEC;gBACA,KAAK;YACT;QACJ,OACID,kBAAkB,IAAI,CAAC,sBAAsB,CAAC,qBAAqB;QAGvE,IAAI,CAACA,iBACD,OAAOE,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACL;QAE5C,IAAIK,OAAO,MAAM,IACb,OAAOF,OAAO,IAAI,CAACE,OAAO,KAAK;QAGnC,MAAMC,SAASD,OAAO,KAAK;QAG3B,MAAME,0BAA0B,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CACnFD,QAAQ,eAAe,EAAE;QAG7B,OAAOH,OAAO,EAAE,CAAC;YACb,GAAGG,MAAM;YACT,aAAaC;QACjB;IACJ;AACJ;AAEO,MAAMC,yCAAyCC,gBAAgB;IAClE,aAAaC;IACb,WAAWb;IACX,cAAc;QAACc;KAAuB;AAC1C"}
1
+ {"version":3,"file":"features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js","sources":["../../../../../src/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.ts"],"sourcesContent":["import { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { CreateFolderUseCase } from \"../abstractions.js\";\nimport type { CreateFolderParams } from \"~/folder/folder.types.js\";\nimport type { Folder } from \"~/folder/folder.types.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport { createDecorator, Result } from \"@webiny/feature/api\";\nimport { FolderNotAuthorizedError } from \"~/domain/folder/errors.js\";\nimport { CodeFlpMerger } from \"~/features/flp/shared/index.js\";\nimport { CodeFlpsProvider } from \"~/features/flp/shared/index.js\";\n\nclass CreateFolderWithFolderLevelPermissionsImpl implements CreateFolderUseCase.Interface {\n private folderLevelPermissions: FolderLevelPermissions.Interface;\n private readonly decoretee: CreateFolderUseCase.Interface;\n private readonly codeFlpsProvider?: CodeFlpsProvider.Interface;\n\n constructor(\n folderLevelPermissions: FolderLevelPermissions.Interface,\n codeFlpsProvider: CodeFlpsProvider.Interface | undefined,\n decoretee: CreateFolderUseCase.Interface\n ) {\n this.folderLevelPermissions = folderLevelPermissions;\n this.codeFlpsProvider = codeFlpsProvider;\n this.decoretee = decoretee;\n }\n\n async execute(params: CreateFolderParams): CreateFolderUseCase.Return {\n let canCreateFolder: boolean;\n if (params.parentId) {\n const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(\n params.parentId\n );\n canCreateFolder = await this.folderLevelPermissions.canAccessFolder({\n permissions,\n rwd: \"w\"\n });\n } else {\n canCreateFolder = this.folderLevelPermissions.canCreateFolderInRoot();\n }\n\n if (!canCreateFolder) {\n return Result.fail(new FolderNotAuthorizedError());\n }\n\n const result = await this.decoretee.execute(params);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const folder = result.value;\n\n const permissions = await this.withCodePermissions(folder, folder?.permissions ?? []);\n\n // Let's set default permissions based on the current user.\n const permissionsWithDefaults =\n await this.folderLevelPermissions.getDefaultPermissions(permissions);\n\n return Result.ok({\n ...folder,\n permissions: permissionsWithDefaults\n });\n }\n\n /**\n * Code-defined permissions are resolved from the folder's own type and path rather than the FLP\n * catalog: the record for a folder this new is written by an event handler and may not exist\n * yet. Without this the response would omit them until something refetched the folder.\n */\n private async withCodePermissions(\n folder: Pick<Folder, \"type\" | \"path\">,\n permissions: FolderPermission[]\n ): Promise<FolderPermission[]> {\n if (!this.codeFlpsProvider) {\n return permissions;\n }\n\n const codePermissions = await this.codeFlpsProvider.getPermissions({\n type: folder.type,\n path: folder.path\n });\n\n return CodeFlpMerger.mergePermissions(permissions, codePermissions);\n }\n}\n\nexport const CreateFolderWithFolderLevelPermissions = createDecorator({\n abstraction: CreateFolderUseCase,\n decorator: CreateFolderWithFolderLevelPermissionsImpl,\n // `CodeFlpsProvider` is optional: `CodeFlpsFeature` does not register it unless the project has\n // the folder-level permissions entitlement.\n dependencies: [FolderLevelPermissions, [CodeFlpsProvider, { optional: true }]]\n});\n"],"names":["CreateFolderWithFolderLevelPermissionsImpl","folderLevelPermissions","codeFlpsProvider","decoretee","params","canCreateFolder","permissions","Result","FolderNotAuthorizedError","result","folder","permissionsWithDefaults","codePermissions","CodeFlpMerger","CreateFolderWithFolderLevelPermissions","createDecorator","CreateFolderUseCase","FolderLevelPermissions","CodeFlpsProvider"],"mappings":";;;;;AAUA,MAAMA;IAKF,YACIC,sBAAwD,EACxDC,gBAAwD,EACxDC,SAAwC,CAC1C;QACE,IAAI,CAAC,sBAAsB,GAAGF;QAC9B,IAAI,CAAC,gBAAgB,GAAGC;QACxB,IAAI,CAAC,SAAS,GAAGC;IACrB;IAEA,MAAM,QAAQC,MAA0B,EAA8B;QAClE,IAAIC;QACJ,IAAID,OAAO,QAAQ,EAAE;YACjB,MAAME,cAAc,MAAM,IAAI,CAAC,sBAAsB,CAAC,yBAAyB,CAC3EF,OAAO,QAAQ;YAEnBC,kBAAkB,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC;gBAChEC;gBACA,KAAK;YACT;QACJ,OACID,kBAAkB,IAAI,CAAC,sBAAsB,CAAC,qBAAqB;QAGvE,IAAI,CAACA,iBACD,OAAOE,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACL;QAE5C,IAAIK,OAAO,MAAM,IACb,OAAOF,OAAO,IAAI,CAACE,OAAO,KAAK;QAGnC,MAAMC,SAASD,OAAO,KAAK;QAE3B,MAAMH,cAAc,MAAM,IAAI,CAAC,mBAAmB,CAACI,QAAQA,QAAQ,eAAe,EAAE;QAGpF,MAAMC,0BACF,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CAACL;QAE5D,OAAOC,OAAO,EAAE,CAAC;YACb,GAAGG,MAAM;YACT,aAAaC;QACjB;IACJ;IAOA,MAAc,oBACVD,MAAqC,EACrCJ,WAA+B,EACJ;QAC3B,IAAI,CAAC,IAAI,CAAC,gBAAgB,EACtB,OAAOA;QAGX,MAAMM,kBAAkB,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC;YAC/D,MAAMF,OAAO,IAAI;YACjB,MAAMA,OAAO,IAAI;QACrB;QAEA,OAAOG,cAAc,gBAAgB,CAACP,aAAaM;IACvD;AACJ;AAEO,MAAME,yCAAyCC,gBAAgB;IAClE,aAAaC;IACb,WAAWhB;IAGX,cAAc;QAACiB;QAAwB;YAACC;YAAkB;gBAAE,UAAU;YAAK;SAAE;KAAC;AAClF"}
@@ -1,15 +1,11 @@
1
1
  import type { ListFoldersParams } from "../../../../folder/folder.types.js";
2
2
  import { ListFoldersUseCase } from "../abstractions.js";
3
- import { FolderLevelPermissions } from "../../../../features/flp/FolderLevelPermissions/index.js";
3
+ import { FolderAccessListFilter } from "../../../../features/flp/FolderAccessListFilter/index.js";
4
4
  declare class ListFoldersWithFolderLevelPermissionsImpl implements ListFoldersUseCase.Interface {
5
- private folderLevelPermissions;
5
+ private folderAccessListFilter;
6
6
  private decoratee;
7
- private flpCatalog;
8
- constructor(folderLevelPermissions: FolderLevelPermissions.Interface, decoratee: ListFoldersUseCase.Interface);
7
+ constructor(folderAccessListFilter: FolderAccessListFilter.Interface, decoratee: ListFoldersUseCase.Interface);
9
8
  execute(params: ListFoldersParams): ListFoldersUseCase.Return;
10
- private hasFlp;
11
- private getFlp;
12
- private setFlp;
13
9
  }
14
10
  export declare const ListFoldersWithFolderLevelPermissions: typeof ListFoldersWithFolderLevelPermissionsImpl & {
15
11
  __abstraction: import("@webiny/di").Abstraction<import("../abstractions.js").IListFoldersUseCase>;
@@ -1,63 +1,18 @@
1
- import { Result } from "@webiny/feature/api";
2
1
  import { ListFoldersUseCase } from "../abstractions.js";
3
- import { FolderLevelPermissions } from "../../../flp/FolderLevelPermissions/index.js";
4
- import { ROOT_FOLDER } from "../../../../constants.js";
2
+ import { FolderAccessListFilter } from "../../../flp/FolderAccessListFilter/index.js";
5
3
  class ListFoldersWithFolderLevelPermissionsImpl {
6
- constructor(folderLevelPermissions, decoratee){
7
- this.folderLevelPermissions = folderLevelPermissions;
4
+ constructor(folderAccessListFilter, decoratee){
5
+ this.folderAccessListFilter = folderAccessListFilter;
8
6
  this.decoratee = decoratee;
9
- this.flpCatalog = new Map();
10
7
  }
11
8
  async execute(params) {
12
- const result = await this.decoratee.execute(params);
13
- if (result.isFail()) return Result.fail(result.error);
14
- const { folders, meta } = result.value;
15
- const rootFlps = await this.folderLevelPermissions.listFolderLevelPermissions({
16
- where: {
17
- type: params.where.type,
18
- parentId: ROOT_FOLDER
19
- }
20
- });
21
- rootFlps.forEach((flp)=>this.setFlp(flp.id, flp.permissions));
22
- await Promise.all(folders.map(async (folder)=>{
23
- if (!this.hasFlp(folder.id)) {
24
- const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(folder.id);
25
- this.setFlp(folder.id, permissions);
26
- }
27
- }));
28
- const foldersWithPermissions = await Promise.all(folders.map(async (folder)=>{
29
- const permissions = this.getFlp(folder.id);
30
- if (!permissions) return null;
31
- const canAccessFolder = await this.folderLevelPermissions.canAccessFolder({
32
- permissions,
33
- rwd: "r"
34
- });
35
- if (!canAccessFolder) return null;
36
- const folderWithFlp = {
37
- ...folder,
38
- permissions
39
- };
40
- return canAccessFolder ? folderWithFlp : null;
41
- }));
42
- return Result.ok({
43
- folders: foldersWithPermissions.filter(Boolean),
44
- meta
45
- });
46
- }
47
- hasFlp(id) {
48
- return this.flpCatalog.has(id);
49
- }
50
- getFlp(id) {
51
- return this.flpCatalog.get(id);
52
- }
53
- setFlp(id, permissions) {
54
- this.flpCatalog.set(id, permissions);
9
+ return this.folderAccessListFilter.listFolders(params, (params)=>this.decoratee.execute(params));
55
10
  }
56
11
  }
57
12
  const ListFoldersWithFolderLevelPermissions = ListFoldersUseCase.createDecorator({
58
13
  decorator: ListFoldersWithFolderLevelPermissionsImpl,
59
14
  dependencies: [
60
- FolderLevelPermissions
15
+ FolderAccessListFilter
61
16
  ]
62
17
  });
63
18
  export { ListFoldersWithFolderLevelPermissions };
@@ -1 +1 @@
1
- {"version":3,"file":"features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js","sources":["../../../../../src/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport type { Folder, ListFoldersParams } from \"~/folder/folder.types.js\";\nimport { ListFoldersUseCase } from \"../abstractions.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\n\nclass ListFoldersWithFolderLevelPermissionsImpl implements ListFoldersUseCase.Interface {\n private flpCatalog: Map<string, FolderPermission[]> = new Map();\n\n constructor(\n private folderLevelPermissions: FolderLevelPermissions.Interface,\n private decoratee: ListFoldersUseCase.Interface\n ) {}\n\n async execute(params: ListFoldersParams): ListFoldersUseCase.Return {\n const result = await this.decoratee.execute(params);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const { folders, meta } = result.value;\n\n // Fetch FLP records for ROOT folders and populate the catalog.\n const rootFlps = await this.folderLevelPermissions.listFolderLevelPermissions({\n where: {\n type: params.where.type,\n parentId: ROOT_FOLDER\n }\n });\n\n rootFlps.forEach(flp => this.setFlp(flp.id, flp.permissions));\n\n // Fetch FLP for folders not already in the catalog.\n await Promise.all(\n folders.map(async folder => {\n if (!this.hasFlp(folder.id)) {\n const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(\n folder.id\n );\n this.setFlp(folder.id, permissions);\n }\n })\n );\n\n // Filter folders based on permissions.\n const foldersWithPermissions = await Promise.all(\n folders.map(async folder => {\n const permissions = this.getFlp(folder.id);\n if (!permissions) {\n return null;\n }\n\n const canAccessFolder = await this.folderLevelPermissions.canAccessFolder({\n permissions,\n rwd: \"r\"\n });\n\n if (!canAccessFolder) {\n return null;\n }\n\n const folderWithFlp = { ...folder, permissions };\n return canAccessFolder ? folderWithFlp : null;\n })\n );\n\n return Result.ok({ folders: foldersWithPermissions.filter(Boolean) as Folder[], meta });\n }\n\n private hasFlp(id: string): boolean {\n return this.flpCatalog.has(id);\n }\n\n private getFlp(id: string): FolderPermission[] | undefined {\n return this.flpCatalog.get(id);\n }\n\n private setFlp(id: string, permissions: FolderPermission[]): void {\n this.flpCatalog.set(id, permissions);\n }\n}\n\nexport const ListFoldersWithFolderLevelPermissions = ListFoldersUseCase.createDecorator({\n decorator: ListFoldersWithFolderLevelPermissionsImpl,\n dependencies: [FolderLevelPermissions]\n});\n"],"names":["ListFoldersWithFolderLevelPermissionsImpl","folderLevelPermissions","decoratee","Map","params","result","Result","folders","meta","rootFlps","ROOT_FOLDER","flp","Promise","folder","permissions","foldersWithPermissions","canAccessFolder","folderWithFlp","Boolean","id","ListFoldersWithFolderLevelPermissions","ListFoldersUseCase","FolderLevelPermissions"],"mappings":";;;;AAOA,MAAMA;IAGF,YACYC,sBAAwD,EACxDC,SAAuC,CACjD;aAFUD,sBAAsB,GAAtBA;aACAC,SAAS,GAATA;aAJJ,UAAU,GAAoC,IAAIC;IAKvD;IAEH,MAAM,QAAQC,MAAyB,EAA6B;QAChE,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACD;QAC5C,IAAIC,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAACD,OAAO,KAAK;QAGnC,MAAM,EAAEE,OAAO,EAAEC,IAAI,EAAE,GAAGH,OAAO,KAAK;QAGtC,MAAMI,WAAW,MAAM,IAAI,CAAC,sBAAsB,CAAC,0BAA0B,CAAC;YAC1E,OAAO;gBACH,MAAML,OAAO,KAAK,CAAC,IAAI;gBACvB,UAAUM;YACd;QACJ;QAEAD,SAAS,OAAO,CAACE,CAAAA,MAAO,IAAI,CAAC,MAAM,CAACA,IAAI,EAAE,EAAEA,IAAI,WAAW;QAG3D,MAAMC,QAAQ,GAAG,CACbL,QAAQ,GAAG,CAAC,OAAMM;YACd,IAAI,CAAC,IAAI,CAAC,MAAM,CAACA,OAAO,EAAE,GAAG;gBACzB,MAAMC,cAAc,MAAM,IAAI,CAAC,sBAAsB,CAAC,yBAAyB,CAC3ED,OAAO,EAAE;gBAEb,IAAI,CAAC,MAAM,CAACA,OAAO,EAAE,EAAEC;YAC3B;QACJ;QAIJ,MAAMC,yBAAyB,MAAMH,QAAQ,GAAG,CAC5CL,QAAQ,GAAG,CAAC,OAAMM;YACd,MAAMC,cAAc,IAAI,CAAC,MAAM,CAACD,OAAO,EAAE;YACzC,IAAI,CAACC,aACD,OAAO;YAGX,MAAME,kBAAkB,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC;gBACtEF;gBACA,KAAK;YACT;YAEA,IAAI,CAACE,iBACD,OAAO;YAGX,MAAMC,gBAAgB;gBAAE,GAAGJ,MAAM;gBAAEC;YAAY;YAC/C,OAAOE,kBAAkBC,gBAAgB;QAC7C;QAGJ,OAAOX,OAAO,EAAE,CAAC;YAAE,SAASS,uBAAuB,MAAM,CAACG;YAAsBV;QAAK;IACzF;IAEQ,OAAOW,EAAU,EAAW;QAChC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAACA;IAC/B;IAEQ,OAAOA,EAAU,EAAkC;QACvD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAACA;IAC/B;IAEQ,OAAOA,EAAU,EAAEL,WAA+B,EAAQ;QAC9D,IAAI,CAAC,UAAU,CAAC,GAAG,CAACK,IAAIL;IAC5B;AACJ;AAEO,MAAMM,wCAAwCC,mBAAmB,eAAe,CAAC;IACpF,WAAWrB;IACX,cAAc;QAACsB;KAAuB;AAC1C"}
1
+ {"version":3,"file":"features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js","sources":["../../../../../src/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.ts"],"sourcesContent":["import type { ListFoldersParams } from \"~/folder/folder.types.js\";\nimport { ListFoldersUseCase } from \"../abstractions.js\";\nimport { FolderAccessListFilter } from \"~/features/flp/FolderAccessListFilter/index.js\";\n\nclass ListFoldersWithFolderLevelPermissionsImpl implements ListFoldersUseCase.Interface {\n constructor(\n private folderAccessListFilter: FolderAccessListFilter.Interface,\n private decoratee: ListFoldersUseCase.Interface\n ) {}\n\n async execute(params: ListFoldersParams): ListFoldersUseCase.Return {\n return this.folderAccessListFilter.listFolders(params, params =>\n this.decoratee.execute(params)\n );\n }\n}\n\nexport const ListFoldersWithFolderLevelPermissions = ListFoldersUseCase.createDecorator({\n decorator: ListFoldersWithFolderLevelPermissionsImpl,\n dependencies: [FolderAccessListFilter]\n});\n"],"names":["ListFoldersWithFolderLevelPermissionsImpl","folderAccessListFilter","decoratee","params","ListFoldersWithFolderLevelPermissions","ListFoldersUseCase","FolderAccessListFilter"],"mappings":";;AAIA,MAAMA;IACF,YACYC,sBAAwD,EACxDC,SAAuC,CACjD;aAFUD,sBAAsB,GAAtBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,MAAyB,EAA6B;QAChE,OAAO,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAACA,QAAQA,CAAAA,SACnD,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA;IAE/B;AACJ;AAEO,MAAMC,wCAAwCC,mBAAmB,eAAe,CAAC;IACpF,WAAWL;IACX,cAAc;QAACM;KAAuB;AAC1C"}
@@ -0,0 +1,11 @@
1
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
2
+ import { WebsocketsSendToIdentityUseCase } from "@webiny/api-websockets/exports/api.js";
3
+ import { NotifyFolderChangeUseCase as UseCaseAbstraction } from "./abstractions.js";
4
+ declare class NotifyFolderChangeUseCaseImpl implements UseCaseAbstraction.Interface {
5
+ private identityContext;
6
+ private sendToIdentity;
7
+ constructor(identityContext: IdentityContext.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
8
+ execute({ id, change, identityId }: UseCaseAbstraction.Params): Promise<void>;
9
+ }
10
+ export declare const NotifyFolderChangeUseCase: import("@webiny/di").Implementation<typeof NotifyFolderChangeUseCaseImpl>;
11
+ export {};