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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) 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/CreateRoleTool.d.ts +54 -0
  14. package/features/ai/CreateRoleTool.js +71 -0
  15. package/features/ai/CreateRoleTool.js.map +1 -0
  16. package/features/ai/CreateTeamTool.d.ts +11 -6
  17. package/features/ai/CreateTeamTool.js +20 -11
  18. package/features/ai/CreateTeamTool.js.map +1 -1
  19. package/features/ai/DeleteFolderTool.d.ts +48 -0
  20. package/features/ai/DeleteFolderTool.js +55 -0
  21. package/features/ai/DeleteFolderTool.js.map +1 -0
  22. package/features/ai/DeleteRoleTool.d.ts +52 -0
  23. package/features/ai/DeleteRoleTool.js +79 -0
  24. package/features/ai/DeleteRoleTool.js.map +1 -0
  25. package/features/ai/DeleteTeamTool.d.ts +46 -0
  26. package/features/ai/DeleteTeamTool.js +56 -0
  27. package/features/ai/DeleteTeamTool.js.map +1 -0
  28. package/features/ai/GrantFolderAccessTool.d.ts +13 -8
  29. package/features/ai/GrantFolderAccessTool.js +20 -11
  30. package/features/ai/GrantFolderAccessTool.js.map +1 -1
  31. package/features/ai/ListFoldersTool.d.ts +11 -6
  32. package/features/ai/ListFoldersTool.js +21 -12
  33. package/features/ai/ListFoldersTool.js.map +1 -1
  34. package/features/ai/ListRolesTool.d.ts +12 -7
  35. package/features/ai/ListRolesTool.js +21 -12
  36. package/features/ai/ListRolesTool.js.map +1 -1
  37. package/features/ai/ListTeamsTool.d.ts +14 -7
  38. package/features/ai/ListTeamsTool.js +23 -13
  39. package/features/ai/ListTeamsTool.js.map +1 -1
  40. package/features/ai/RevokeFolderAccessTool.d.ts +12 -7
  41. package/features/ai/RevokeFolderAccessTool.js +21 -12
  42. package/features/ai/RevokeFolderAccessTool.js.map +1 -1
  43. package/features/ai/UpdateFolderTool.d.ts +57 -0
  44. package/features/ai/UpdateFolderTool.js +72 -0
  45. package/features/ai/UpdateFolderTool.js.map +1 -0
  46. package/features/ai/UpdateRoleTool.d.ts +46 -0
  47. package/features/ai/UpdateRoleTool.js +53 -0
  48. package/features/ai/UpdateRoleTool.js.map +1 -0
  49. package/features/ai/UpdateTeamTool.d.ts +52 -0
  50. package/features/ai/UpdateTeamTool.js +56 -0
  51. package/features/ai/UpdateTeamTool.js.map +1 -0
  52. package/features/ai/feature.d.ts +2 -2
  53. package/features/ai/feature.js +14 -0
  54. package/features/ai/feature.js.map +1 -1
  55. package/features/ai/index.d.ts +7 -0
  56. package/features/ai/index.js +7 -0
  57. package/features/ai/loadFolderPermissions.d.ts +4 -1
  58. package/features/ai/loadFolderPermissions.js +1 -1
  59. package/features/ai/loadFolderPermissions.js.map +1 -1
  60. package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.d.ts +4 -4
  61. package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js +7 -8
  62. package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js.map +1 -1
  63. package/features/cms/decorators/ListEntriesWithFlpDecorator.d.ts +3 -3
  64. package/features/cms/decorators/ListEntriesWithFlpDecorator.js +7 -8
  65. package/features/cms/decorators/ListEntriesWithFlpDecorator.js.map +1 -1
  66. package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.d.ts +4 -4
  67. package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js +7 -8
  68. package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js.map +1 -1
  69. package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.d.ts +4 -4
  70. package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js +7 -8
  71. package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js.map +1 -1
  72. package/features/flp/CreateFlp/index.d.ts +0 -1
  73. package/features/flp/CreateFlp/index.js +0 -1
  74. package/features/flp/DeleteFlp/index.d.ts +0 -1
  75. package/features/flp/DeleteFlp/index.js +0 -1
  76. package/features/flp/FolderAccessListFilter/abstractions.d.ts +33 -0
  77. package/features/flp/FolderAccessListFilter/abstractions.js +5 -0
  78. package/features/flp/FolderAccessListFilter/abstractions.js.map +1 -0
  79. package/features/flp/FolderAccessListFilter/index.d.ts +1 -0
  80. package/features/flp/FolderAccessListFilter/index.js +1 -0
  81. package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.d.ts +8 -0
  82. package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.js +15 -0
  83. package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.js.map +1 -0
  84. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.d.ts +11 -0
  85. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js +19 -0
  86. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js.map +1 -0
  87. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.d.ts +11 -0
  88. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js +19 -0
  89. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js.map +1 -0
  90. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.d.ts +11 -0
  91. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js +23 -0
  92. package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js.map +1 -0
  93. package/features/flp/FolderCatalogSync/abstractions.d.ts +25 -0
  94. package/features/flp/FolderCatalogSync/abstractions.js +5 -0
  95. package/features/flp/FolderCatalogSync/abstractions.js.map +1 -0
  96. package/features/flp/FolderCatalogSync/index.d.ts +2 -0
  97. package/features/flp/FolderCatalogSync/index.js +2 -0
  98. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.d.ts +5 -2
  99. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +19 -5
  100. package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
  101. package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.d.ts +1 -0
  102. package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js +3 -0
  103. package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js.map +1 -1
  104. package/features/flp/FolderLevelPermissions/abstractions.d.ts +8 -2
  105. package/features/flp/FolderLevelPermissions/abstractions.js.map +1 -1
  106. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.d.ts +12 -0
  107. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js +22 -14
  108. package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js.map +1 -1
  109. package/features/flp/FolderPermissionsRepository/abstractions.d.ts +28 -0
  110. package/features/flp/FolderPermissionsRepository/abstractions.js +5 -0
  111. package/features/flp/FolderPermissionsRepository/abstractions.js.map +1 -0
  112. package/features/flp/FolderPermissionsRepository/index.d.ts +1 -0
  113. package/features/flp/FolderPermissionsRepository/index.js +1 -0
  114. package/features/flp/GetFlp/GetFlpUseCase.d.ts +10 -5
  115. package/features/flp/GetFlp/GetFlpUseCase.js +13 -5
  116. package/features/flp/GetFlp/GetFlpUseCase.js.map +1 -1
  117. package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.d.ts +13 -0
  118. package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js +26 -0
  119. package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js.map +1 -0
  120. package/features/flp/GetFlp/feature.js +1 -3
  121. package/features/flp/GetFlp/feature.js.map +1 -1
  122. package/features/flp/ListFlps/ListFlpsUseCase.d.ts +11 -6
  123. package/features/flp/ListFlps/ListFlpsUseCase.js +13 -5
  124. package/features/flp/ListFlps/ListFlpsUseCase.js.map +1 -1
  125. package/features/flp/ListFlps/abstractions.d.ts +3 -9
  126. package/features/flp/ListFlps/abstractions.js.map +1 -1
  127. package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.d.ts +13 -0
  128. package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js +27 -0
  129. package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js.map +1 -0
  130. package/features/flp/ListFlps/feature.js +1 -3
  131. package/features/flp/ListFlps/feature.js.map +1 -1
  132. package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.d.ts +14 -0
  133. package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js +36 -0
  134. package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js.map +1 -0
  135. package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.d.ts +25 -0
  136. package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js +75 -0
  137. package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js.map +1 -0
  138. package/features/flp/ListFolderAccess/ListEntryAccessUseCase.d.ts +13 -0
  139. package/features/flp/ListFolderAccess/ListEntryAccessUseCase.js +28 -0
  140. package/features/flp/ListFolderAccess/ListEntryAccessUseCase.js.map +1 -0
  141. package/features/flp/ListFolderAccess/ListFolderAccessUseCase.d.ts +24 -0
  142. package/features/flp/ListFolderAccess/ListFolderAccessUseCase.js +107 -0
  143. package/features/flp/ListFolderAccess/ListFolderAccessUseCase.js.map +1 -0
  144. package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.d.ts +28 -0
  145. package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.js +98 -0
  146. package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.js.map +1 -0
  147. package/features/flp/ListFolderAccess/UserFolderCandidates.d.ts +13 -0
  148. package/features/flp/ListFolderAccess/UserFolderCandidates.js +26 -0
  149. package/features/flp/ListFolderAccess/UserFolderCandidates.js.map +1 -0
  150. package/features/flp/ListFolderAccess/abstractions.d.ts +182 -0
  151. package/features/flp/ListFolderAccess/abstractions.js +10 -0
  152. package/features/flp/ListFolderAccess/abstractions.js.map +1 -0
  153. package/features/flp/{CreateFlpOnFolderCreated → ListFolderAccess}/feature.d.ts +1 -1
  154. package/features/flp/ListFolderAccess/feature.js +21 -0
  155. package/features/flp/ListFolderAccess/feature.js.map +1 -0
  156. package/features/flp/ListFolderAccess/index.d.ts +2 -0
  157. package/features/flp/ListFolderAccess/index.js +2 -0
  158. package/features/flp/ListFolderAccess/mayAskAboutUser.d.ts +3 -0
  159. package/features/flp/ListFolderAccess/mayAskAboutUser.js +9 -0
  160. package/features/flp/ListFolderAccess/mayAskAboutUser.js.map +1 -0
  161. package/features/flp/ListFolderAccess/userFolderLevel.d.ts +31 -0
  162. package/features/flp/ListFolderAccess/userFolderLevel.js +48 -0
  163. package/features/flp/ListFolderAccess/userFolderLevel.js.map +1 -0
  164. package/features/flp/UpdateFlp/abstractions.d.ts +6 -2
  165. package/features/flp/UpdateFlp/abstractions.js.map +1 -1
  166. package/features/flp/UpdateFlp/index.d.ts +0 -1
  167. package/features/flp/UpdateFlp/index.js +0 -1
  168. package/features/flp/shared/CodeFlpMerger.d.ts +26 -0
  169. package/features/flp/shared/CodeFlpMerger.js +20 -0
  170. package/features/flp/shared/CodeFlpMerger.js.map +1 -0
  171. package/features/flp/shared/CodeFlpPath.d.ts +15 -0
  172. package/features/flp/shared/CodeFlpPath.js +29 -0
  173. package/features/flp/shared/CodeFlpPath.js.map +1 -0
  174. package/features/flp/shared/CodeFlpTarget.d.ts +10 -0
  175. package/features/flp/shared/CodeFlpTarget.js +26 -0
  176. package/features/flp/shared/CodeFlpTarget.js.map +1 -0
  177. package/features/flp/shared/CodeFlpsProvider.d.ts +15 -0
  178. package/features/flp/shared/CodeFlpsProvider.js +36 -0
  179. package/features/flp/shared/CodeFlpsProvider.js.map +1 -0
  180. package/features/flp/shared/abstractions.d.ts +79 -0
  181. package/features/flp/shared/abstractions.js +19 -0
  182. package/features/flp/shared/abstractions.js.map +1 -0
  183. package/features/flp/shared/feature.d.ts +5 -0
  184. package/features/flp/shared/feature.js +17 -0
  185. package/features/flp/shared/feature.js.map +1 -0
  186. package/features/flp/shared/index.d.ts +4 -0
  187. package/features/flp/shared/index.js +4 -0
  188. package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.d.ts +9 -1
  189. package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js +20 -3
  190. package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js.map +1 -1
  191. package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.d.ts +3 -7
  192. package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js +5 -50
  193. package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js.map +1 -1
  194. package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.d.ts +11 -0
  195. package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js +38 -0
  196. package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js.map +1 -0
  197. package/features/{flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.d.ts → folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.d.ts} +5 -7
  198. package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js +24 -0
  199. package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js.map +1 -0
  200. package/features/folder/NotifyFolderChange/abstractions.d.ts +28 -0
  201. package/features/folder/NotifyFolderChange/abstractions.js +8 -0
  202. package/features/folder/NotifyFolderChange/abstractions.js.map +1 -0
  203. package/features/folder/NotifyFolderChange/feature.d.ts +8 -0
  204. package/features/folder/NotifyFolderChange/feature.js +13 -0
  205. package/features/folder/NotifyFolderChange/feature.js.map +1 -0
  206. package/features/folder/NotifyFolderChange/index.d.ts +2 -0
  207. package/features/folder/NotifyFolderChange/index.js +2 -0
  208. package/features/folder/UpdateFolder/UpdateFolderUseCase.d.ts +1 -0
  209. package/features/folder/UpdateFolder/UpdateFolderUseCase.js +13 -0
  210. package/features/folder/UpdateFolder/UpdateFolderUseCase.js.map +1 -1
  211. package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.d.ts +14 -1
  212. package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js +54 -4
  213. package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js.map +1 -1
  214. package/filter/filter.model.js +2 -1
  215. package/filter/filter.model.js.map +1 -1
  216. package/filter/filter.so.d.ts +0 -2
  217. package/filter/filter.so.js +20 -8
  218. package/filter/filter.so.js.map +1 -1
  219. package/flp/flp.types.d.ts +6 -1
  220. package/flp/index.d.ts +0 -1
  221. package/flp/index.js +0 -1
  222. package/flpTaskCatalog/CatalogFolderPermissionsRepository.d.ts +17 -0
  223. package/flpTaskCatalog/CatalogFolderPermissionsRepository.js +34 -0
  224. package/flpTaskCatalog/CatalogFolderPermissionsRepository.js.map +1 -0
  225. package/flpTaskCatalog/PostLoadFolderAccessListFilter.d.ts +24 -0
  226. package/flpTaskCatalog/PostLoadFolderAccessListFilter.js +63 -0
  227. package/flpTaskCatalog/PostLoadFolderAccessListFilter.js.map +1 -0
  228. package/flpTaskCatalog/TaskCatalogFlpFeature.d.ts +12 -0
  229. package/flpTaskCatalog/TaskCatalogFlpFeature.js +49 -0
  230. package/flpTaskCatalog/TaskCatalogFlpFeature.js.map +1 -0
  231. package/flpTaskCatalog/TaskFolderCatalogSync.d.ts +29 -0
  232. package/flpTaskCatalog/TaskFolderCatalogSync.js +57 -0
  233. package/flpTaskCatalog/TaskFolderCatalogSync.js.map +1 -0
  234. package/{flp → flpTaskCatalog}/flp.crud.d.ts +1 -1
  235. package/flpTaskCatalog/flp.crud.js.map +1 -0
  236. package/flpTaskCatalog/index.d.ts +1 -0
  237. package/flpTaskCatalog/index.js +1 -0
  238. package/{utils/decorators → flpTaskCatalog/listEntries}/ListEntriesFactory.d.ts +1 -1
  239. package/flpTaskCatalog/listEntries/ListEntriesFactory.js.map +1 -0
  240. package/flpTaskCatalog/listEntries/hasRootFolderId.js.map +1 -0
  241. package/{utils/decorators → flpTaskCatalog/listEntries}/isPageModel.js +1 -1
  242. package/flpTaskCatalog/listEntries/isPageModel.js.map +1 -0
  243. package/flpTaskCatalog/tasks/createFlp.task.d.ts +25 -0
  244. package/{flp → flpTaskCatalog}/tasks/createFlp.task.js +34 -17
  245. package/flpTaskCatalog/tasks/createFlp.task.js.map +1 -0
  246. package/flpTaskCatalog/tasks/deleteFlp.task.d.ts +23 -0
  247. package/{flp → flpTaskCatalog}/tasks/deleteFlp.task.js +24 -15
  248. package/flpTaskCatalog/tasks/deleteFlp.task.js.map +1 -0
  249. package/{flp → flpTaskCatalog}/tasks/syncFlp.task.d.ts +11 -6
  250. package/{flp → flpTaskCatalog}/tasks/syncFlp.task.js +45 -29
  251. package/flpTaskCatalog/tasks/syncFlp.task.js.map +1 -0
  252. package/flpTaskCatalog/tasks/updateFlp.task.d.ts +25 -0
  253. package/flpTaskCatalog/tasks/updateFlp.task.js +64 -0
  254. package/flpTaskCatalog/tasks/updateFlp.task.js.map +1 -0
  255. package/flpTaskCatalog/useCases/CreateFlpUseCase.d.ts +8 -0
  256. package/{features/flp/CreateFlp → flpTaskCatalog/useCases}/CreateFlpUseCase.js +1 -1
  257. package/flpTaskCatalog/useCases/CreateFlpUseCase.js.map +1 -0
  258. package/flpTaskCatalog/useCases/DeleteFlpUseCase.d.ts +8 -0
  259. package/flpTaskCatalog/useCases/DeleteFlpUseCase.js.map +1 -0
  260. package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.d.ts +8 -9
  261. package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.js +23 -30
  262. package/flpTaskCatalog/useCases/UpdateFlpUseCase.js.map +1 -0
  263. package/folder/createFolderTypeDefs.js +4 -1
  264. package/folder/createFolderTypeDefs.js.map +1 -1
  265. package/folder/folder.types.d.ts +2 -1
  266. package/index.d.ts +1 -0
  267. package/index.js +1 -0
  268. package/package.json +21 -22
  269. package/types.d.ts +2 -3
  270. package/types.js.map +1 -1
  271. package/utils/createOperationsWrapper.d.ts +2 -2
  272. package/utils/createOperationsWrapper.js +5 -5
  273. package/utils/createOperationsWrapper.js.map +1 -1
  274. package/features/flp/CreateFlp/CreateFlpUseCase.d.ts +0 -8
  275. package/features/flp/CreateFlp/CreateFlpUseCase.js.map +0 -1
  276. package/features/flp/CreateFlp/feature.d.ts +0 -5
  277. package/features/flp/CreateFlp/feature.js +0 -13
  278. package/features/flp/CreateFlp/feature.js.map +0 -1
  279. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.d.ts +0 -14
  280. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js +0 -37
  281. package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js.map +0 -1
  282. package/features/flp/CreateFlpOnFolderCreated/feature.js +0 -11
  283. package/features/flp/CreateFlpOnFolderCreated/feature.js.map +0 -1
  284. package/features/flp/CreateFlpOnFolderCreated/index.d.ts +0 -1
  285. package/features/flp/CreateFlpOnFolderCreated/index.js +0 -1
  286. package/features/flp/DeleteFlp/DeleteFlpUseCase.d.ts +0 -8
  287. package/features/flp/DeleteFlp/DeleteFlpUseCase.js.map +0 -1
  288. package/features/flp/DeleteFlp/feature.d.ts +0 -5
  289. package/features/flp/DeleteFlp/feature.js +0 -13
  290. package/features/flp/DeleteFlp/feature.js.map +0 -1
  291. package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js +0 -37
  292. package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js.map +0 -1
  293. package/features/flp/DeleteFlpOnFolderDeleted/feature.d.ts +0 -4
  294. package/features/flp/DeleteFlpOnFolderDeleted/feature.js +0 -11
  295. package/features/flp/DeleteFlpOnFolderDeleted/feature.js.map +0 -1
  296. package/features/flp/DeleteFlpOnFolderDeleted/index.d.ts +0 -1
  297. package/features/flp/DeleteFlpOnFolderDeleted/index.js +0 -1
  298. package/features/flp/UpdateFlp/UpdateFlpUseCase.js.map +0 -1
  299. package/features/flp/UpdateFlp/feature.d.ts +0 -5
  300. package/features/flp/UpdateFlp/feature.js +0 -17
  301. package/features/flp/UpdateFlp/feature.js.map +0 -1
  302. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.d.ts +0 -14
  303. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js +0 -39
  304. package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js.map +0 -1
  305. package/features/flp/UpdateFlpOnFolderUpdated/feature.d.ts +0 -4
  306. package/features/flp/UpdateFlpOnFolderUpdated/feature.js +0 -11
  307. package/features/flp/UpdateFlpOnFolderUpdated/feature.js.map +0 -1
  308. package/features/flp/UpdateFlpOnFolderUpdated/index.d.ts +0 -1
  309. package/features/flp/UpdateFlpOnFolderUpdated/index.js +0 -1
  310. package/flp/flp.crud.js.map +0 -1
  311. package/flp/tasks/createFlp.task.d.ts +0 -18
  312. package/flp/tasks/createFlp.task.js.map +0 -1
  313. package/flp/tasks/deleteFlp.task.d.ts +0 -18
  314. package/flp/tasks/deleteFlp.task.js.map +0 -1
  315. package/flp/tasks/syncFlp.task.js.map +0 -1
  316. package/flp/tasks/updateFlp.task.d.ts +0 -18
  317. package/flp/tasks/updateFlp.task.js +0 -43
  318. package/flp/tasks/updateFlp.task.js.map +0 -1
  319. package/utils/decorators/CmsEntriesCrudDecorators.d.ts +0 -11
  320. package/utils/decorators/CmsEntriesCrudDecorators.js +0 -179
  321. package/utils/decorators/CmsEntriesCrudDecorators.js.map +0 -1
  322. package/utils/decorators/FilterEntriesByFolderFactory.d.ts +0 -7
  323. package/utils/decorators/FilterEntriesByFolderFactory.js +0 -22
  324. package/utils/decorators/FilterEntriesByFolderFactory.js.map +0 -1
  325. package/utils/decorators/ListEntriesFactory.js.map +0 -1
  326. package/utils/decorators/hasRootFolderId.js.map +0 -1
  327. package/utils/decorators/isPageModel.js.map +0 -1
  328. /package/{flp → flpTaskCatalog}/flp.crud.js +0 -0
  329. /package/{utils/decorators → flpTaskCatalog/listEntries}/ListEntriesFactory.js +0 -0
  330. /package/{utils/decorators → flpTaskCatalog/listEntries}/hasRootFolderId.d.ts +0 -0
  331. /package/{utils/decorators → flpTaskCatalog/listEntries}/hasRootFolderId.js +0 -0
  332. /package/{utils/decorators → flpTaskCatalog/listEntries}/isPageModel.d.ts +0 -0
  333. /package/{features/flp/DeleteFlp → flpTaskCatalog/useCases}/DeleteFlpUseCase.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/GrantFolderAccessTool.js","sources":["../../../src/features/ai/GrantFolderAccessTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport type { IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { UpdateFolderUseCase } from \"~/features/folder/UpdateFolder/index.js\";\nimport type { FolderPermission } from \"~/types.js\";\nimport { loadFolderPermissions } from \"./loadFolderPermissions.js\";\nimport { assertTargetIsUsable } from \"./assertTargetIsUsable.js\";\n\nconst ACCESS_LEVELS = [\"owner\", \"editor\", \"viewer\", \"public\", \"no-access\"] as const;\n\nconst inputSchema = z.object({\n folderId: z.string().describe(\"Folder id as returned by listFolders.\"),\n target: z\n .string()\n .describe(\n \"Who to grant access to. A team is 'team:<slug>' — the SLUG, not the id. A user is 'admin:<userId>'. Resolve with listTeams first.\"\n ),\n level: z\n .enum(ACCESS_LEVELS)\n .describe(\n \"owner = full control including permissions; editor = change content; viewer = read only; no-access = explicitly denied.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface GrantResult {\n folderId: string;\n title: string;\n path: string;\n /**\n * Every direct rule on the folder afterwards.\n *\n * This is the set the update was asked to store, not an independent read of it:\n * `UpdateFolderWithFolderLevelPermissions` returns the permissions it derived from the input\n * rather than the ones the repository wrote. Treating it as a verification would let the tool\n * confirm its own request back to itself.\n */\n permissions: { target: string; level: string }[];\n /** True when the target already had a direct rule and its level was changed. */\n replacedExistingLevel?: string;\n}\n\n/**\n * Grants one target access to one folder, leaving every other rule alone.\n *\n * Additive by design. The earlier tool took the complete permission set and replaced it, which meant\n * approving a change showed what would be SET and said nothing about what would be removed — a rule\n * the model omitted disappeared silently. One target per call keeps the approval honest: what the user\n * sees in the plan is the whole change.\n */\nclass GrantFolderAccessToolImpl implements IAiSdkTool<Input> {\n readonly name = \"grantFolderAccess\";\n readonly title = \"Grant folder access\";\n readonly description =\n \"Grants one team or user a level of access on one folder, leaving all other permissions untouched. Use listFolders for the folder id and listTeams for a team slug. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false };\n\n constructor(\n private getFolder: GetFolderUseCase.Interface,\n private updateFolder: UpdateFolderUseCase.Interface,\n private listTeams: ListTeamsUseCase.Interface\n ) {}\n\n async execute(input: Input): Promise<GrantResult> {\n const loaded = await loadFolderPermissions(this.getFolder, input.folderId);\n\n await assertTargetIsUsable(this.listTeams, input.target, loaded.inheritedTargets);\n\n const existing = loaded.direct.find(\n permission => String(permission.target) === input.target\n );\n\n const permissions: FolderPermission[] = loaded.direct\n .filter(permission => String(permission.target) !== input.target)\n .concat([{ target: input.target, level: input.level } as FolderPermission]);\n\n const result = await this.updateFolder.execute(input.folderId, { permissions });\n\n if (result.isFail()) {\n throw new Error(`Could not grant access: ${result.error.message}`);\n }\n\n const folder = result.value;\n\n const granted: GrantResult = {\n folderId: folder.id,\n title: folder.title,\n path: folder.path,\n permissions: (folder.permissions ?? [])\n .filter(permission => !permission.inheritedFrom)\n .map(permission => ({ target: String(permission.target), level: permission.level }))\n };\n\n if (existing) {\n granted.replacedExistingLevel = existing.level;\n }\n\n return granted;\n }\n}\n\nexport const GrantFolderAccessTool = AiSdkTool.createImplementation({\n implementation: GrantFolderAccessToolImpl,\n dependencies: [GetFolderUseCase, UpdateFolderUseCase, ListTeamsUseCase]\n});\n"],"names":["ACCESS_LEVELS","inputSchema","z","GrantFolderAccessToolImpl","getFolder","updateFolder","listTeams","input","loaded","loadFolderPermissions","assertTargetIsUsable","existing","permission","String","permissions","result","Error","folder","granted","GrantFolderAccessTool","AiSdkTool","GetFolderUseCase","UpdateFolderUseCase","ListTeamsUseCase"],"mappings":";;;;;;;AAUA,MAAMA,gBAAgB;IAAC;IAAS;IAAU;IAAU;IAAU;CAAY;AAE1E,MAAMC,cAAcC,EAAE,MAAM,CAAC;IACzB,UAAUA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B,QAAQA,EAAAA,MACG,GACN,QAAQ,CACL;IAER,OAAOA,CAAC,CAADA,OACE,CAACF,eACL,QAAQ,CACL;AAEZ;AA6BA,MAAMG;IAQF,YACYC,SAAqC,EACrCC,YAA2C,EAC3CC,SAAqC,CAC/C;aAHUF,SAAS,GAATA;aACAC,YAAY,GAAZA;aACAC,SAAS,GAATA;aAVH,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGL;aACd,WAAW,GAAG;YAAE,cAAc;QAAM;IAM1C;IAEH,MAAM,QAAQM,KAAY,EAAwB;QAC9C,MAAMC,SAAS,MAAMC,sBAAsB,IAAI,CAAC,SAAS,EAAEF,MAAM,QAAQ;QAEzE,MAAMG,qBAAqB,IAAI,CAAC,SAAS,EAAEH,MAAM,MAAM,EAAEC,OAAO,gBAAgB;QAEhF,MAAMG,WAAWH,OAAO,MAAM,CAAC,IAAI,CAC/BI,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAML,MAAM,MAAM;QAG5D,MAAMO,cAAkCN,OAAO,MAAM,CAChD,MAAM,CAACI,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAML,MAAM,MAAM,EAC/D,MAAM,CAAC;YAAC;gBAAE,QAAQA,MAAM,MAAM;gBAAE,OAAOA,MAAM,KAAK;YAAC;SAAsB;QAE9E,MAAMQ,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAACR,MAAM,QAAQ,EAAE;YAAEO;QAAY;QAE7E,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,wBAAwB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGrE,MAAME,SAASF,OAAO,KAAK;QAE3B,MAAMG,UAAuB;YACzB,UAAUD,OAAO,EAAE;YACnB,OAAOA,OAAO,KAAK;YACnB,MAAMA,OAAO,IAAI;YACjB,aAAcA,AAAAA,CAAAA,OAAO,WAAW,IAAI,EAAC,EAChC,MAAM,CAACL,CAAAA,aAAc,CAACA,WAAW,aAAa,EAC9C,GAAG,CAACA,CAAAA,aAAe;oBAAE,QAAQC,OAAOD,WAAW,MAAM;oBAAG,OAAOA,WAAW,KAAK;gBAAC;QACzF;QAEA,IAAID,UACAO,QAAQ,qBAAqB,GAAGP,SAAS,KAAK;QAGlD,OAAOO;IACX;AACJ;AAEO,MAAMC,wBAAwBC,UAAU,oBAAoB,CAAC;IAChE,gBAAgBjB;IAChB,cAAc;QAACkB;QAAkBC;QAAqBC;KAAiB;AAC3E"}
1
+ {"version":3,"file":"features/ai/GrantFolderAccessTool.js","sources":["../../../src/features/ai/GrantFolderAccessTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { UpdateFolderUseCase } from \"~/features/folder/UpdateFolder/index.js\";\nimport type { FolderPermission } from \"~/types.js\";\nimport { loadFolderPermissions } from \"./loadFolderPermissions.js\";\nimport { assertTargetIsUsable } from \"./assertTargetIsUsable.js\";\n\nconst ACCESS_LEVELS = [\"owner\", \"editor\", \"viewer\", \"public\", \"no-access\"] as const;\n\nconst inputSchema = z.object({\n folderId: z.string().describe(\"Folder id as returned by listFolders.\"),\n target: z\n .string()\n .describe(\n \"Who to grant access to. A team is 'team:<slug>' — the SLUG, not the id. A user is 'admin:<userId>'. Resolve with listTeams first.\"\n ),\n level: z\n .enum(ACCESS_LEVELS)\n .describe(\n \"owner = full control including permissions; editor = change content; viewer = read only; no-access = explicitly denied.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface GrantResult {\n folderId: string;\n title: string;\n path: string;\n /**\n * Every direct rule on the folder afterwards.\n *\n * This is the set the update was asked to store, not an independent read of it:\n * `UpdateFolderWithFolderLevelPermissions` returns the permissions it derived from the input\n * rather than the ones the repository wrote. Treating it as a verification would let the tool\n * confirm its own request back to itself.\n */\n permissions: { target: string; level: string }[];\n /** True when the target already had a direct rule and its level was changed. */\n replacedExistingLevel?: string;\n}\n\nclass GrantFolderAccessToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(\n private getFolder: GetFolderUseCase.Interface,\n private updateFolder: UpdateFolderUseCase.Interface,\n private listTeams: ListTeamsUseCase.Interface\n ) {}\n\n async execute(input: Input): Promise<GrantResult> {\n const loaded = await loadFolderPermissions(this.getFolder, input.folderId);\n\n await assertTargetIsUsable(this.listTeams, input.target, loaded.inheritedTargets);\n\n const existing = loaded.direct.find(\n permission => String(permission.target) === input.target\n );\n\n const permissions: FolderPermission[] = loaded.direct\n .filter(permission => String(permission.target) !== input.target)\n .concat([{ target: input.target, level: input.level } as FolderPermission]);\n\n const result = await this.updateFolder.execute(input.folderId, { permissions });\n\n if (result.isFail()) {\n throw new Error(`Could not grant access: ${result.error.message}`);\n }\n\n const folder = result.value;\n\n const granted: GrantResult = {\n folderId: folder.id,\n title: folder.title,\n path: folder.path,\n permissions: (folder.permissions ?? [])\n .filter(permission => !permission.inheritedFrom)\n .map(permission => ({ target: String(permission.target), level: permission.level }))\n };\n\n if (existing) {\n granted.replacedExistingLevel = existing.level;\n }\n\n return granted;\n }\n}\n\nconst GrantFolderAccessToolHandler = AiSdkToolHandler.createImplementation({\n implementation: GrantFolderAccessToolHandlerImpl,\n dependencies: [GetFolderUseCase, UpdateFolderUseCase, ListTeamsUseCase]\n});\n\n/**\n * Grants one target access to one folder, leaving every other rule alone.\n *\n * Additive by design. The earlier tool took the complete permission set and replaced it, which meant\n * approving a change showed what would be SET and said nothing about what would be removed — a rule\n * the model omitted disappeared silently. One target per call keeps the approval honest: what the user\n * sees in the plan is the whole change.\n */\nclass GrantFolderAccessToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"grantFolderAccess\";\n readonly title = \"Grant folder access\";\n readonly description =\n \"Grants one team or user a level of access on one folder, leaving all other permissions untouched. Use listFolders for the folder id and listTeams for a team slug. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false };\n readonly handler = GrantFolderAccessToolHandler;\n}\n\nexport const GrantFolderAccessTool = AiSdkToolDefinition.createImplementation({\n implementation: GrantFolderAccessToolImpl,\n dependencies: []\n});\n"],"names":["ACCESS_LEVELS","inputSchema","z","GrantFolderAccessToolHandlerImpl","getFolder","updateFolder","listTeams","input","loaded","loadFolderPermissions","assertTargetIsUsable","existing","permission","String","permissions","result","Error","folder","granted","GrantFolderAccessToolHandler","AiSdkToolHandler","GetFolderUseCase","UpdateFolderUseCase","ListTeamsUseCase","GrantFolderAccessToolImpl","GrantFolderAccessTool","AiSdkToolDefinition"],"mappings":";;;;;;;AASA,MAAMA,gBAAgB;IAAC;IAAS;IAAU;IAAU;IAAU;CAAY;AAE1E,MAAMC,cAAcC,EAAE,MAAM,CAAC;IACzB,UAAUA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B,QAAQA,EAAAA,MACG,GACN,QAAQ,CACL;IAER,OAAOA,CAAC,CAADA,OACE,CAACF,eACL,QAAQ,CACL;AAEZ;AAqBA,MAAMG;IACF,YACYC,SAAqC,EACrCC,YAA2C,EAC3CC,SAAqC,CAC/C;aAHUF,SAAS,GAATA;aACAC,YAAY,GAAZA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,KAAY,EAAwB;QAC9C,MAAMC,SAAS,MAAMC,sBAAsB,IAAI,CAAC,SAAS,EAAEF,MAAM,QAAQ;QAEzE,MAAMG,qBAAqB,IAAI,CAAC,SAAS,EAAEH,MAAM,MAAM,EAAEC,OAAO,gBAAgB;QAEhF,MAAMG,WAAWH,OAAO,MAAM,CAAC,IAAI,CAC/BI,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAML,MAAM,MAAM;QAG5D,MAAMO,cAAkCN,OAAO,MAAM,CAChD,MAAM,CAACI,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAML,MAAM,MAAM,EAC/D,MAAM,CAAC;YAAC;gBAAE,QAAQA,MAAM,MAAM;gBAAE,OAAOA,MAAM,KAAK;YAAC;SAAsB;QAE9E,MAAMQ,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAACR,MAAM,QAAQ,EAAE;YAAEO;QAAY;QAE7E,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,wBAAwB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGrE,MAAME,SAASF,OAAO,KAAK;QAE3B,MAAMG,UAAuB;YACzB,UAAUD,OAAO,EAAE;YACnB,OAAOA,OAAO,KAAK;YACnB,MAAMA,OAAO,IAAI;YACjB,aAAcA,AAAAA,CAAAA,OAAO,WAAW,IAAI,EAAC,EAChC,MAAM,CAACL,CAAAA,aAAc,CAACA,WAAW,aAAa,EAC9C,GAAG,CAACA,CAAAA,aAAe;oBAAE,QAAQC,OAAOD,WAAW,MAAM;oBAAG,OAAOA,WAAW,KAAK;gBAAC;QACzF;QAEA,IAAID,UACAO,QAAQ,qBAAqB,GAAGP,SAAS,KAAK;QAGlD,OAAOO;IACX;AACJ;AAEA,MAAMC,+BAA+BC,iBAAiB,oBAAoB,CAAC;IACvE,gBAAgBjB;IAChB,cAAc;QAACkB;QAAkBC;QAAqBC;KAAiB;AAC3E;AAUA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGvB;aACd,WAAW,GAAG;YAAE,cAAc;QAAM;aACpC,OAAO,GAAGkB;;AACvB;AAEO,MAAMM,wBAAwBC,oBAAoB,oBAAoB,CAAC;IAC1E,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { IAiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { ListFoldersUseCase } from "../../features/folder/ListFolders/index.js";
4
4
  declare const inputSchema: z.ZodObject<{
5
5
  type: z.ZodString;
@@ -17,12 +17,16 @@ interface FolderSummary {
17
17
  inherited: boolean;
18
18
  }[];
19
19
  }
20
+ declare class ListFoldersToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
21
+ private listFolders;
22
+ constructor(listFolders: ListFoldersUseCase.Interface);
23
+ execute(input: Input): Promise<FolderSummary[]>;
24
+ }
20
25
  /**
21
26
  * Lists folders with their current access rules, so a permission change is proposed against a real
22
27
  * folder id and the user can see what the access already is before approving a change to it.
23
28
  */
24
- declare class ListFoldersToolImpl implements IAiSdkTool<Input> {
25
- private listFolders;
29
+ declare class ListFoldersToolImpl implements AiSdkToolDefinition.Interface<Input> {
26
30
  readonly name = "listFolders";
27
31
  readonly title = "List folders";
28
32
  readonly description = "Lists folders of a given type with their ids, paths and current access permissions. Call this before changing folder permissions so the change targets a real folder.";
@@ -33,10 +37,11 @@ declare class ListFoldersToolImpl implements IAiSdkTool<Input> {
33
37
  readOnlyHint: boolean;
34
38
  idempotentHint: boolean;
35
39
  };
36
- constructor(listFolders: ListFoldersUseCase.Interface);
37
- execute(input: Input): Promise<FolderSummary[]>;
40
+ readonly handler: typeof ListFoldersToolHandlerImpl & {
41
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
42
+ };
38
43
  }
39
44
  export declare const ListFoldersTool: typeof ListFoldersToolImpl & {
40
- __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
45
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
41
46
  };
42
47
  export {};
@@ -1,20 +1,12 @@
1
1
  import { z } from "zod";
2
- import { AiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { ListFoldersUseCase } from "../folder/ListFolders/index.js";
4
4
  const inputSchema = z.object({
5
5
  type: z.string().describe("Folder namespace, e.g. 'FmFile' for the file manager or 'cms:<modelId>' for a content model's folders.")
6
6
  });
7
- class ListFoldersToolImpl {
7
+ class ListFoldersToolHandlerImpl {
8
8
  constructor(listFolders){
9
9
  this.listFolders = listFolders;
10
- this.name = "listFolders";
11
- this.title = "List folders";
12
- this.description = "Lists folders of a given type with their ids, paths and current access permissions. Call this before changing folder permissions so the change targets a real folder.";
13
- this.inputSchema = inputSchema;
14
- this.annotations = {
15
- readOnlyHint: true,
16
- idempotentHint: true
17
- };
18
10
  }
19
11
  async execute(input) {
20
12
  const result = await this.listFolders.execute({
@@ -37,12 +29,29 @@ class ListFoldersToolImpl {
37
29
  }));
38
30
  }
39
31
  }
40
- const ListFoldersTool = AiSdkTool.createImplementation({
41
- implementation: ListFoldersToolImpl,
32
+ const ListFoldersToolHandler = AiSdkToolHandler.createImplementation({
33
+ implementation: ListFoldersToolHandlerImpl,
42
34
  dependencies: [
43
35
  ListFoldersUseCase
44
36
  ]
45
37
  });
38
+ class ListFoldersToolImpl {
39
+ constructor(){
40
+ this.name = "listFolders";
41
+ this.title = "List folders";
42
+ this.description = "Lists folders of a given type with their ids, paths and current access permissions. Call this before changing folder permissions so the change targets a real folder.";
43
+ this.inputSchema = inputSchema;
44
+ this.annotations = {
45
+ readOnlyHint: true,
46
+ idempotentHint: true
47
+ };
48
+ this.handler = ListFoldersToolHandler;
49
+ }
50
+ }
51
+ const ListFoldersTool = AiSdkToolDefinition.createImplementation({
52
+ implementation: ListFoldersToolImpl,
53
+ dependencies: []
54
+ });
46
55
  export { ListFoldersTool };
47
56
 
48
57
  //# sourceMappingURL=ListFoldersTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/ListFoldersTool.js","sources":["../../../src/features/ai/ListFoldersTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport type { IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/index.js\";\n\nconst inputSchema = z.object({\n type: z\n .string()\n .describe(\n \"Folder namespace, e.g. 'FmFile' for the file manager or 'cms:<modelId>' for a content model's folders.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface FolderSummary {\n id: string;\n title: string;\n slug: string;\n path: string;\n parentId?: string | null;\n permissions: { target: string; level: string; inherited: boolean }[];\n}\n\n/**\n * Lists folders with their current access rules, so a permission change is proposed against a real\n * folder id and the user can see what the access already is before approving a change to it.\n */\nclass ListFoldersToolImpl implements IAiSdkTool<Input> {\n readonly name = \"listFolders\";\n readonly title = \"List folders\";\n readonly description =\n \"Lists folders of a given type with their ids, paths and current access permissions. Call this before changing folder permissions so the change targets a real folder.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n\n constructor(private listFolders: ListFoldersUseCase.Interface) {}\n\n async execute(input: Input): Promise<FolderSummary[]> {\n const result = await this.listFolders.execute({ where: { type: input.type } });\n\n if (result.isFail()) {\n throw new Error(`Could not list folders: ${result.error.message}`);\n }\n\n return result.value.folders.map(folder => ({\n id: folder.id,\n title: folder.title,\n slug: folder.slug,\n path: folder.path,\n parentId: folder.parentId,\n permissions: (folder.permissions ?? []).map(permission => ({\n target: permission.target,\n level: permission.level,\n // Inherited rules cannot be edited on this folder — only on the ancestor that set them.\n inherited: Boolean(permission.inheritedFrom)\n }))\n }));\n }\n}\n\nexport const ListFoldersTool = AiSdkTool.createImplementation({\n implementation: ListFoldersToolImpl,\n dependencies: [ListFoldersUseCase]\n});\n"],"names":["inputSchema","z","ListFoldersToolImpl","listFolders","input","result","Error","folder","permission","Boolean","ListFoldersTool","AiSdkTool","ListFoldersUseCase"],"mappings":";;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,MAAMA,EAAAA,MACK,GACN,QAAQ,CACL;AAEZ;AAiBA,MAAMC;IAQF,YAAoBC,WAAyC,CAAE;aAA3CA,WAAW,GAAXA;aAPX,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGH;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;IAEF;IAEhE,MAAM,QAAQI,KAAY,EAA4B;QAClD,MAAMC,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAAE,OAAO;gBAAE,MAAMD,MAAM,IAAI;YAAC;QAAE;QAE5E,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,wBAAwB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGrE,OAAOA,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAACE,CAAAA,SAAW;gBACvC,IAAIA,OAAO,EAAE;gBACb,OAAOA,OAAO,KAAK;gBACnB,MAAMA,OAAO,IAAI;gBACjB,MAAMA,OAAO,IAAI;gBACjB,UAAUA,OAAO,QAAQ;gBACzB,aAAcA,AAAAA,CAAAA,OAAO,WAAW,IAAI,EAAC,EAAG,GAAG,CAACC,CAAAA,aAAe;wBACvD,QAAQA,WAAW,MAAM;wBACzB,OAAOA,WAAW,KAAK;wBAEvB,WAAWC,QAAQD,WAAW,aAAa;oBAC/C;YACJ;IACJ;AACJ;AAEO,MAAME,kBAAkBC,UAAU,oBAAoB,CAAC;IAC1D,gBAAgBT;IAChB,cAAc;QAACU;KAAmB;AACtC"}
1
+ {"version":3,"file":"features/ai/ListFoldersTool.js","sources":["../../../src/features/ai/ListFoldersTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/index.js\";\n\nconst inputSchema = z.object({\n type: z\n .string()\n .describe(\n \"Folder namespace, e.g. 'FmFile' for the file manager or 'cms:<modelId>' for a content model's folders.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface FolderSummary {\n id: string;\n title: string;\n slug: string;\n path: string;\n parentId?: string | null;\n permissions: { target: string; level: string; inherited: boolean }[];\n}\n\nclass ListFoldersToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private listFolders: ListFoldersUseCase.Interface) {}\n\n async execute(input: Input): Promise<FolderSummary[]> {\n const result = await this.listFolders.execute({ where: { type: input.type } });\n\n if (result.isFail()) {\n throw new Error(`Could not list folders: ${result.error.message}`);\n }\n\n return result.value.folders.map(folder => ({\n id: folder.id,\n title: folder.title,\n slug: folder.slug,\n path: folder.path,\n parentId: folder.parentId,\n permissions: (folder.permissions ?? []).map(permission => ({\n target: permission.target,\n level: permission.level,\n // Inherited rules cannot be edited on this folder — only on the ancestor that set them.\n inherited: Boolean(permission.inheritedFrom)\n }))\n }));\n }\n}\n\nconst ListFoldersToolHandler = AiSdkToolHandler.createImplementation({\n implementation: ListFoldersToolHandlerImpl,\n dependencies: [ListFoldersUseCase]\n});\n\n/**\n * Lists folders with their current access rules, so a permission change is proposed against a real\n * folder id and the user can see what the access already is before approving a change to it.\n */\nclass ListFoldersToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"listFolders\";\n readonly title = \"List folders\";\n readonly description =\n \"Lists folders of a given type with their ids, paths and current access permissions. Call this before changing folder permissions so the change targets a real folder.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = ListFoldersToolHandler;\n}\n\nexport const ListFoldersTool = AiSdkToolDefinition.createImplementation({\n implementation: ListFoldersToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","ListFoldersToolHandlerImpl","listFolders","input","result","Error","folder","permission","Boolean","ListFoldersToolHandler","AiSdkToolHandler","ListFoldersUseCase","ListFoldersToolImpl","ListFoldersTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,MAAMA,EAAAA,MACK,GACN,QAAQ,CACL;AAEZ;AAaA,MAAMC;IACF,YAAoBC,WAAyC,CAAE;aAA3CA,WAAW,GAAXA;IAA4C;IAEhE,MAAM,QAAQC,KAAY,EAA4B;QAClD,MAAMC,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC;YAAE,OAAO;gBAAE,MAAMD,MAAM,IAAI;YAAC;QAAE;QAE5E,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,wBAAwB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGrE,OAAOA,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAACE,CAAAA,SAAW;gBACvC,IAAIA,OAAO,EAAE;gBACb,OAAOA,OAAO,KAAK;gBACnB,MAAMA,OAAO,IAAI;gBACjB,MAAMA,OAAO,IAAI;gBACjB,UAAUA,OAAO,QAAQ;gBACzB,aAAcA,AAAAA,CAAAA,OAAO,WAAW,IAAI,EAAC,EAAG,GAAG,CAACC,CAAAA,aAAe;wBACvD,QAAQA,WAAW,MAAM;wBACzB,OAAOA,WAAW,KAAK;wBAEvB,WAAWC,QAAQD,WAAW,aAAa;oBAC/C;YACJ;IACJ;AACJ;AAEA,MAAME,yBAAyBC,iBAAiB,oBAAoB,CAAC;IACjE,gBAAgBT;IAChB,cAAc;QAACU;KAAmB;AACtC;AAMA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGb;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;aACzD,OAAO,GAAGU;;AACvB;AAEO,MAAMI,kBAAkBC,oBAAoB,oBAAoB,CAAC;IACpE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { IAiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
4
4
  interface RoleSummary {
5
5
  id: string;
@@ -7,6 +7,11 @@ interface RoleSummary {
7
7
  slug: string;
8
8
  description?: string;
9
9
  }
10
+ declare class ListRolesToolHandlerImpl implements AiSdkToolHandler.Interface<Record<string, never>> {
11
+ private listRoles;
12
+ constructor(listRoles: ListRolesUseCase.Interface);
13
+ execute(): Promise<RoleSummary[]>;
14
+ }
10
15
  /**
11
16
  * Resolves role names to the IDs `createTeam` takes. Separate from the write, so the user approves a
12
17
  * team with roles that were looked up rather than guessed.
@@ -15,20 +20,20 @@ interface RoleSummary {
15
20
  * `id` is what a team actually stores. Nothing at the type level separates the two, so `createTeam`
16
21
  * accepts either and resolves it rather than making the caller guess which one that field wants.
17
22
  */
18
- declare class ListRolesToolImpl implements IAiSdkTool<Record<string, never>> {
19
- private listRoles;
23
+ declare class ListRolesToolImpl implements AiSdkToolDefinition.Interface<Record<string, never>> {
20
24
  readonly name = "listRoles";
21
25
  readonly title = "List roles";
22
- readonly description = "Lists the security roles in this project. Call this before createTeam and pass the `id` of each role you want. A slug also works, but a value that is neither is rejected.";
26
+ readonly description = "Lists the security roles in this project with their ids, names and slugs. createTeam and updateTeam take role ids (a slug also works; anything else is rejected). updateRole and deleteRole take the id, and deleteRole also the exact name.";
23
27
  readonly inputSchema: z.ZodObject<{}, z.core.$strip>;
24
28
  readonly annotations: {
25
29
  readOnlyHint: boolean;
26
30
  idempotentHint: boolean;
27
31
  };
28
- constructor(listRoles: ListRolesUseCase.Interface);
29
- execute(): Promise<RoleSummary[]>;
32
+ readonly handler: typeof ListRolesToolHandlerImpl & {
33
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
34
+ };
30
35
  }
31
36
  export declare const ListRolesTool: typeof ListRolesToolImpl & {
32
- __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
37
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
33
38
  };
34
39
  export {};
@@ -1,18 +1,10 @@
1
1
  import { z } from "zod";
2
- import { AiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { ListRolesUseCase } from "@webiny/api-core/features/security/roles/ListRoles/index.js";
4
4
  const inputSchema = z.object({});
5
- class ListRolesToolImpl {
5
+ class ListRolesToolHandlerImpl {
6
6
  constructor(listRoles){
7
7
  this.listRoles = listRoles;
8
- this.name = "listRoles";
9
- this.title = "List roles";
10
- this.description = "Lists the security roles in this project. Call this before createTeam and pass the `id` of each role you want. A slug also works, but a value that is neither is rejected.";
11
- this.inputSchema = inputSchema;
12
- this.annotations = {
13
- readOnlyHint: true,
14
- idempotentHint: true
15
- };
16
8
  }
17
9
  async execute() {
18
10
  const result = await this.listRoles.execute();
@@ -28,12 +20,29 @@ class ListRolesToolImpl {
28
20
  });
29
21
  }
30
22
  }
31
- const ListRolesTool = AiSdkTool.createImplementation({
32
- implementation: ListRolesToolImpl,
23
+ const ListRolesToolHandler = AiSdkToolHandler.createImplementation({
24
+ implementation: ListRolesToolHandlerImpl,
33
25
  dependencies: [
34
26
  ListRolesUseCase
35
27
  ]
36
28
  });
29
+ class ListRolesToolImpl {
30
+ constructor(){
31
+ this.name = "listRoles";
32
+ this.title = "List roles";
33
+ this.description = "Lists the security roles in this project with their ids, names and slugs. createTeam and updateTeam take role ids (a slug also works; anything else is rejected). updateRole and deleteRole take the id, and deleteRole also the exact name.";
34
+ this.inputSchema = inputSchema;
35
+ this.annotations = {
36
+ readOnlyHint: true,
37
+ idempotentHint: true
38
+ };
39
+ this.handler = ListRolesToolHandler;
40
+ }
41
+ }
42
+ const ListRolesTool = AiSdkToolDefinition.createImplementation({
43
+ implementation: ListRolesToolImpl,
44
+ dependencies: []
45
+ });
37
46
  export { ListRolesTool };
38
47
 
39
48
  //# sourceMappingURL=ListRolesTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/ListRolesTool.js","sources":["../../../src/features/ai/ListRolesTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport type { IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListRolesUseCase } from \"@webiny/api-core/features/security/roles/ListRoles/index.js\";\n\nconst inputSchema = z.object({});\n\ninterface RoleSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\n/**\n * Resolves role names to the IDs `createTeam` takes. Separate from the write, so the user approves a\n * team with roles that were looked up rather than guessed.\n *\n * Returns the slug too, because it is what a human recognises and what the admin UI shows, while\n * `id` is what a team actually stores. Nothing at the type level separates the two, so `createTeam`\n * accepts either and resolves it rather than making the caller guess which one that field wants.\n */\nclass ListRolesToolImpl implements IAiSdkTool<Record<string, never>> {\n readonly name = \"listRoles\";\n readonly title = \"List roles\";\n readonly description =\n \"Lists the security roles in this project. Call this before createTeam and pass the `id` of each role you want. A slug also works, but a value that is neither is rejected.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n\n constructor(private listRoles: ListRolesUseCase.Interface) {}\n\n async execute(): Promise<RoleSummary[]> {\n const result = await this.listRoles.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list roles: ${result.error.message}`);\n }\n\n return result.value.map(role => {\n const summary: RoleSummary = {\n id: role.id,\n name: role.name,\n slug: role.slug\n };\n\n if (role.description) {\n summary.description = role.description;\n }\n\n return summary;\n });\n }\n}\n\nexport const ListRolesTool = AiSdkTool.createImplementation({\n implementation: ListRolesToolImpl,\n dependencies: [ListRolesUseCase]\n});\n"],"names":["inputSchema","z","ListRolesToolImpl","listRoles","result","Error","role","summary","ListRolesTool","AiSdkTool","ListRolesUseCase"],"mappings":";;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAiB9B,MAAMC;IAQF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;aAPX,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGH;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;IAEN;IAE5D,MAAM,UAAkC;QACpC,MAAMI,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,UAAU,oBAAoB,CAAC;IACxD,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
1
+ {"version":3,"file":"features/ai/ListRolesTool.js","sources":["../../../src/features/ai/ListRolesTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListRolesUseCase } from \"@webiny/api-core/features/security/roles/ListRoles/index.js\";\n\nconst inputSchema = z.object({});\n\ninterface RoleSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\nclass ListRolesToolHandlerImpl implements AiSdkToolHandler.Interface<Record<string, never>> {\n constructor(private listRoles: ListRolesUseCase.Interface) {}\n\n async execute(): Promise<RoleSummary[]> {\n const result = await this.listRoles.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list roles: ${result.error.message}`);\n }\n\n return result.value.map(role => {\n const summary: RoleSummary = {\n id: role.id,\n name: role.name,\n slug: role.slug\n };\n\n if (role.description) {\n summary.description = role.description;\n }\n\n return summary;\n });\n }\n}\n\nconst ListRolesToolHandler = AiSdkToolHandler.createImplementation({\n implementation: ListRolesToolHandlerImpl,\n dependencies: [ListRolesUseCase]\n});\n\n/**\n * Resolves role names to the IDs `createTeam` takes. Separate from the write, so the user approves a\n * team with roles that were looked up rather than guessed.\n *\n * Returns the slug too, because it is what a human recognises and what the admin UI shows, while\n * `id` is what a team actually stores. Nothing at the type level separates the two, so `createTeam`\n * accepts either and resolves it rather than making the caller guess which one that field wants.\n */\nclass ListRolesToolImpl implements AiSdkToolDefinition.Interface<Record<string, never>> {\n readonly name = \"listRoles\";\n readonly title = \"List roles\";\n readonly description =\n \"Lists the security roles in this project with their ids, names and slugs. createTeam and updateTeam take role ids (a slug also works; anything else is rejected). updateRole and deleteRole take the id, and deleteRole also the exact name.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = ListRolesToolHandler;\n}\n\nexport const ListRolesTool = AiSdkToolDefinition.createImplementation({\n implementation: ListRolesToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","ListRolesToolHandlerImpl","listRoles","result","Error","role","summary","ListRolesToolHandler","AiSdkToolHandler","ListRolesUseCase","ListRolesToolImpl","ListRolesTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAS9B,MAAMC;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,UAAkC;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,iBAAiB,oBAAoB,CAAC;IAC/D,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC;AAUA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGX;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;aACzD,OAAO,GAAGQ;;AACvB;AAEO,MAAMI,gBAAgBC,oBAAoB,oBAAoB,CAAC;IAClE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { IAiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
4
4
  declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
5
5
  type Input = z.infer<typeof inputSchema>;
@@ -8,6 +8,13 @@ interface TeamSummary {
8
8
  name: string;
9
9
  slug: string;
10
10
  description?: string;
11
+ /** Role ids, so `updateTeam` can be given the full list with one role added or removed. */
12
+ roles: string[];
13
+ }
14
+ declare class ListTeamsToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
15
+ private listTeams;
16
+ constructor(listTeams: ListTeamsUseCase.Interface);
17
+ execute(): Promise<TeamSummary[]>;
11
18
  }
12
19
  /**
13
20
  * Resolves human names ("team A") to the ids folder permissions actually take.
@@ -15,20 +22,20 @@ interface TeamSummary {
15
22
  * Kept separate from setFolderPermissions rather than accepting a team name there: the user approves
16
23
  * the arguments of a write, so the id has to be looked up and shown, not guessed inside the write.
17
24
  */
18
- declare class ListTeamsToolImpl implements IAiSdkTool<Input> {
19
- private listTeams;
25
+ declare class ListTeamsToolImpl implements AiSdkToolDefinition.Interface<Input> {
20
26
  readonly name = "listTeams";
21
27
  readonly title = "List teams";
22
- readonly description = "Lists the teams in this project with their ids, names and slugs. Folder permission targets use the SLUG (`team:<slug>`), not the id.";
28
+ readonly description = "Lists the teams in this project with their ids, names, slugs and role ids. Folder permission targets use the SLUG (`team:<slug>`), not the id; updateTeam and deleteTeam take the id.";
23
29
  readonly inputSchema: z.ZodObject<{}, z.core.$strip>;
24
30
  readonly annotations: {
25
31
  readOnlyHint: boolean;
26
32
  idempotentHint: boolean;
27
33
  };
28
- constructor(listTeams: ListTeamsUseCase.Interface);
29
- execute(): Promise<TeamSummary[]>;
34
+ readonly handler: typeof ListTeamsToolHandlerImpl & {
35
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
36
+ };
30
37
  }
31
38
  export declare const ListTeamsTool: typeof ListTeamsToolImpl & {
32
- __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
39
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
33
40
  };
34
41
  export {};
@@ -1,18 +1,10 @@
1
1
  import { z } from "zod";
2
- import { AiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { ListTeamsUseCase } from "@webiny/api-core/features/security/teams/ListTeams/index.js";
4
4
  const inputSchema = z.object({});
5
- class ListTeamsToolImpl {
5
+ class ListTeamsToolHandlerImpl {
6
6
  constructor(listTeams){
7
7
  this.listTeams = listTeams;
8
- this.name = "listTeams";
9
- this.title = "List teams";
10
- this.description = "Lists the teams in this project with their ids, names and slugs. Folder permission targets use the SLUG (`team:<slug>`), not the id.";
11
- this.inputSchema = inputSchema;
12
- this.annotations = {
13
- readOnlyHint: true,
14
- idempotentHint: true
15
- };
16
8
  }
17
9
  async execute() {
18
10
  const result = await this.listTeams.execute();
@@ -21,19 +13,37 @@ class ListTeamsToolImpl {
21
13
  const summary = {
22
14
  id: team.id,
23
15
  name: team.name,
24
- slug: team.slug
16
+ slug: team.slug,
17
+ roles: team.roles
25
18
  };
26
19
  if (team.description) summary.description = team.description;
27
20
  return summary;
28
21
  });
29
22
  }
30
23
  }
31
- const ListTeamsTool = AiSdkTool.createImplementation({
32
- implementation: ListTeamsToolImpl,
24
+ const ListTeamsToolHandler = AiSdkToolHandler.createImplementation({
25
+ implementation: ListTeamsToolHandlerImpl,
33
26
  dependencies: [
34
27
  ListTeamsUseCase
35
28
  ]
36
29
  });
30
+ class ListTeamsToolImpl {
31
+ constructor(){
32
+ this.name = "listTeams";
33
+ this.title = "List teams";
34
+ this.description = "Lists the teams in this project with their ids, names, slugs and role ids. Folder permission targets use the SLUG (`team:<slug>`), not the id; updateTeam and deleteTeam take the id.";
35
+ this.inputSchema = inputSchema;
36
+ this.annotations = {
37
+ readOnlyHint: true,
38
+ idempotentHint: true
39
+ };
40
+ this.handler = ListTeamsToolHandler;
41
+ }
42
+ }
43
+ const ListTeamsTool = AiSdkToolDefinition.createImplementation({
44
+ implementation: ListTeamsToolImpl,
45
+ dependencies: []
46
+ });
37
47
  export { ListTeamsTool };
38
48
 
39
49
  //# sourceMappingURL=ListTeamsTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/ListTeamsTool.js","sources":["../../../src/features/ai/ListTeamsTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport type { IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\n\nconst inputSchema = z.object({});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface TeamSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n}\n\n/**\n * Resolves human names (\"team A\") to the ids folder permissions actually take.\n *\n * Kept separate from setFolderPermissions rather than accepting a team name there: the user approves\n * the arguments of a write, so the id has to be looked up and shown, not guessed inside the write.\n */\nclass ListTeamsToolImpl implements IAiSdkTool<Input> {\n readonly name = \"listTeams\";\n readonly title = \"List teams\";\n readonly description =\n \"Lists the teams in this project with their ids, names and slugs. Folder permission targets use the SLUG (`team:<slug>`), not the id.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n\n constructor(private listTeams: ListTeamsUseCase.Interface) {}\n\n async execute(): Promise<TeamSummary[]> {\n const result = await this.listTeams.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list teams: ${result.error.message}`);\n }\n\n return result.value.map(team => {\n const summary: TeamSummary = {\n id: team.id,\n name: team.name,\n slug: team.slug\n };\n\n if (team.description) {\n summary.description = team.description;\n }\n\n return summary;\n });\n }\n}\n\nexport const ListTeamsTool = AiSdkTool.createImplementation({\n implementation: ListTeamsToolImpl,\n dependencies: [ListTeamsUseCase]\n});\n"],"names":["inputSchema","z","ListTeamsToolImpl","listTeams","result","Error","team","summary","ListTeamsTool","AiSdkTool","ListTeamsUseCase"],"mappings":";;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAiB9B,MAAMC;IAQF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;aAPX,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGH;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;IAEN;IAE5D,MAAM,UAAkC;QACpC,MAAMI,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;YACnB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,UAAU,oBAAoB,CAAC;IACxD,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
1
+ {"version":3,"file":"features/ai/ListTeamsTool.js","sources":["../../../src/features/ai/ListTeamsTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListTeamsUseCase } from \"@webiny/api-core/features/security/teams/ListTeams/index.js\";\n\nconst inputSchema = z.object({});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface TeamSummary {\n id: string;\n name: string;\n slug: string;\n description?: string;\n /** Role ids, so `updateTeam` can be given the full list with one role added or removed. */\n roles: string[];\n}\n\nclass ListTeamsToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private listTeams: ListTeamsUseCase.Interface) {}\n\n async execute(): Promise<TeamSummary[]> {\n const result = await this.listTeams.execute();\n\n if (result.isFail()) {\n throw new Error(`Could not list teams: ${result.error.message}`);\n }\n\n return result.value.map(team => {\n const summary: TeamSummary = {\n id: team.id,\n name: team.name,\n slug: team.slug,\n roles: team.roles\n };\n\n if (team.description) {\n summary.description = team.description;\n }\n\n return summary;\n });\n }\n}\n\nconst ListTeamsToolHandler = AiSdkToolHandler.createImplementation({\n implementation: ListTeamsToolHandlerImpl,\n dependencies: [ListTeamsUseCase]\n});\n\n/**\n * Resolves human names (\"team A\") to the ids folder permissions actually take.\n *\n * Kept separate from setFolderPermissions rather than accepting a team name there: the user approves\n * the arguments of a write, so the id has to be looked up and shown, not guessed inside the write.\n */\nclass ListTeamsToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"listTeams\";\n readonly title = \"List teams\";\n readonly description =\n \"Lists the teams in this project with their ids, names, slugs and role ids. Folder permission targets use the SLUG (`team:<slug>`), not the id; updateTeam and deleteTeam take the id.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: true, idempotentHint: true };\n readonly handler = ListTeamsToolHandler;\n}\n\nexport const ListTeamsTool = AiSdkToolDefinition.createImplementation({\n implementation: ListTeamsToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","ListTeamsToolHandlerImpl","listTeams","result","Error","team","summary","ListTeamsToolHandler","AiSdkToolHandler","ListTeamsUseCase","ListTeamsToolImpl","ListTeamsTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC,CAAC;AAa9B,MAAMC;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,UAAkC;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO;QAE3C,IAAIA,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,sBAAsB,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAGnE,OAAOA,OAAO,KAAK,CAAC,GAAG,CAACE,CAAAA;YACpB,MAAMC,UAAuB;gBACzB,IAAID,KAAK,EAAE;gBACX,MAAMA,KAAK,IAAI;gBACf,MAAMA,KAAK,IAAI;gBACf,OAAOA,KAAK,KAAK;YACrB;YAEA,IAAIA,KAAK,WAAW,EAChBC,QAAQ,WAAW,GAAGD,KAAK,WAAW;YAG1C,OAAOC;QACX;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,iBAAiB,oBAAoB,CAAC;IAC/D,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC;AAQA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGX;aACd,WAAW,GAAG;YAAE,cAAc;YAAM,gBAAgB;QAAK;aACzD,OAAO,GAAGQ;;AACvB;AAEO,MAAMI,gBAAgBC,oBAAoB,oBAAoB,CAAC;IAClE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import type { IAiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { GetFolderUseCase } from "../../features/folder/GetFolder/index.js";
4
4
  import { UpdateFolderUseCase } from "../../features/folder/UpdateFolder/index.js";
5
5
  declare const inputSchema: z.ZodObject<{
@@ -28,6 +28,12 @@ interface RevokeResult {
28
28
  level: string;
29
29
  }[];
30
30
  }
31
+ declare class RevokeFolderAccessToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
32
+ private getFolder;
33
+ private updateFolder;
34
+ constructor(getFolder: GetFolderUseCase.Interface, updateFolder: UpdateFolderUseCase.Interface);
35
+ execute(input: Input): Promise<RevokeResult>;
36
+ }
31
37
  /**
32
38
  * Removes one target's direct access to one folder.
33
39
  *
@@ -35,9 +41,7 @@ interface RevokeResult {
35
41
  * rather than reporting a removal that changed nothing — an inherited grant cannot be revoked here,
36
42
  * only where it is defined, and saying otherwise would leave the user believing access was withdrawn.
37
43
  */
38
- declare class RevokeFolderAccessToolImpl implements IAiSdkTool<Input> {
39
- private getFolder;
40
- private updateFolder;
44
+ declare class RevokeFolderAccessToolImpl implements AiSdkToolDefinition.Interface<Input> {
41
45
  readonly name = "revokeFolderAccess";
42
46
  readonly title = "Revoke folder access";
43
47
  readonly description = "Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.";
@@ -49,10 +53,11 @@ declare class RevokeFolderAccessToolImpl implements IAiSdkTool<Input> {
49
53
  readOnlyHint: boolean;
50
54
  destructiveHint: boolean;
51
55
  };
52
- constructor(getFolder: GetFolderUseCase.Interface, updateFolder: UpdateFolderUseCase.Interface);
53
- execute(input: Input): Promise<RevokeResult>;
56
+ readonly handler: typeof RevokeFolderAccessToolHandlerImpl & {
57
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions.js").IAiSdkToolHandler<any>>;
58
+ };
54
59
  }
55
60
  export declare const RevokeFolderAccessTool: typeof RevokeFolderAccessToolImpl & {
56
- __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
61
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions.js").IAiSdkToolDefinition<any>>;
57
62
  };
58
63
  export {};
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { AiSdkTool } from "@webiny/api-core/features/ai/index.js";
2
+ import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
3
3
  import { GetFolderUseCase } from "../folder/GetFolder/index.js";
4
4
  import { UpdateFolderUseCase } from "../folder/UpdateFolder/index.js";
5
5
  import { loadFolderPermissions } from "./loadFolderPermissions.js";
@@ -7,18 +7,10 @@ const inputSchema = z.object({
7
7
  folderId: z.string().describe("Folder id as returned by listFolders."),
8
8
  target: z.string().describe("Whose access to remove: 'team:<slug>' or 'admin:<userId>', exactly as listFolders reports it.")
9
9
  });
10
- class RevokeFolderAccessToolImpl {
10
+ class RevokeFolderAccessToolHandlerImpl {
11
11
  constructor(getFolder, updateFolder){
12
12
  this.getFolder = getFolder;
13
13
  this.updateFolder = updateFolder;
14
- this.name = "revokeFolderAccess";
15
- this.title = "Revoke folder access";
16
- this.description = "Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.";
17
- this.inputSchema = inputSchema;
18
- this.annotations = {
19
- readOnlyHint: false,
20
- destructiveHint: true
21
- };
22
14
  }
23
15
  async execute(input) {
24
16
  const loaded = await loadFolderPermissions(this.getFolder, input.folderId);
@@ -48,13 +40,30 @@ class RevokeFolderAccessToolImpl {
48
40
  };
49
41
  }
50
42
  }
51
- const RevokeFolderAccessTool = AiSdkTool.createImplementation({
52
- implementation: RevokeFolderAccessToolImpl,
43
+ const RevokeFolderAccessToolHandler = AiSdkToolHandler.createImplementation({
44
+ implementation: RevokeFolderAccessToolHandlerImpl,
53
45
  dependencies: [
54
46
  GetFolderUseCase,
55
47
  UpdateFolderUseCase
56
48
  ]
57
49
  });
50
+ class RevokeFolderAccessToolImpl {
51
+ constructor(){
52
+ this.name = "revokeFolderAccess";
53
+ this.title = "Revoke folder access";
54
+ this.description = "Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.";
55
+ this.inputSchema = inputSchema;
56
+ this.annotations = {
57
+ readOnlyHint: false,
58
+ destructiveHint: true
59
+ };
60
+ this.handler = RevokeFolderAccessToolHandler;
61
+ }
62
+ }
63
+ const RevokeFolderAccessTool = AiSdkToolDefinition.createImplementation({
64
+ implementation: RevokeFolderAccessToolImpl,
65
+ dependencies: []
66
+ });
58
67
  export { RevokeFolderAccessTool };
59
68
 
60
69
  //# sourceMappingURL=RevokeFolderAccessTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/RevokeFolderAccessTool.js","sources":["../../../src/features/ai/RevokeFolderAccessTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport type { IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { UpdateFolderUseCase } from \"~/features/folder/UpdateFolder/index.js\";\nimport { loadFolderPermissions } from \"./loadFolderPermissions.js\";\n\nconst inputSchema = z.object({\n folderId: z.string().describe(\"Folder id as returned by listFolders.\"),\n target: z\n .string()\n .describe(\n \"Whose access to remove: 'team:<slug>' or 'admin:<userId>', exactly as listFolders reports it.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface RevokeResult {\n folderId: string;\n title: string;\n path: string;\n removed: { target: string; level: string };\n /**\n * Every direct rule remaining afterwards.\n *\n * This is the set the update was asked to store, not an independent read of it:\n * `UpdateFolderWithFolderLevelPermissions` returns the permissions it derived from the input\n * rather than the ones the repository wrote. Treating it as a verification would let the tool\n * confirm its own request back to itself.\n */\n permissions: { target: string; level: string }[];\n}\n\n/**\n * Removes one target's direct access to one folder.\n *\n * Destructive: somebody loses access, and there is no undo. Refuses when the target has no DIRECT rule\n * rather than reporting a removal that changed nothing — an inherited grant cannot be revoked here,\n * only where it is defined, and saying otherwise would leave the user believing access was withdrawn.\n */\nclass RevokeFolderAccessToolImpl implements IAiSdkTool<Input> {\n readonly name = \"revokeFolderAccess\";\n readonly title = \"Revoke folder access\";\n readonly description =\n \"Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false, destructiveHint: true };\n\n constructor(\n private getFolder: GetFolderUseCase.Interface,\n private updateFolder: UpdateFolderUseCase.Interface\n ) {}\n\n async execute(input: Input): Promise<RevokeResult> {\n const loaded = await loadFolderPermissions(this.getFolder, input.folderId);\n\n const existing = loaded.direct.find(\n permission => String(permission.target) === input.target\n );\n\n if (!existing) {\n if (loaded.inheritedTargets.has(input.target)) {\n throw new Error(\n `\"${input.target}\" has inherited access to this folder, not a direct rule, so it cannot be revoked here. Change it where it is defined.`\n );\n }\n\n throw new Error(\n `\"${input.target}\" has no direct access to this folder, so there is nothing to revoke.`\n );\n }\n\n const permissions = loaded.direct.filter(\n permission => String(permission.target) !== input.target\n );\n\n const result = await this.updateFolder.execute(input.folderId, { permissions });\n\n if (result.isFail()) {\n throw new Error(`Could not revoke access: ${result.error.message}`);\n }\n\n const folder = result.value;\n\n return {\n folderId: folder.id,\n title: folder.title,\n path: folder.path,\n removed: { target: input.target, level: existing.level },\n permissions: (folder.permissions ?? [])\n .filter(permission => !permission.inheritedFrom)\n .map(permission => ({ target: String(permission.target), level: permission.level }))\n };\n }\n}\n\nexport const RevokeFolderAccessTool = AiSdkTool.createImplementation({\n implementation: RevokeFolderAccessToolImpl,\n dependencies: [GetFolderUseCase, UpdateFolderUseCase]\n});\n"],"names":["inputSchema","z","RevokeFolderAccessToolImpl","getFolder","updateFolder","input","loaded","loadFolderPermissions","existing","permission","String","Error","permissions","result","folder","RevokeFolderAccessTool","AiSdkTool","GetFolderUseCase","UpdateFolderUseCase"],"mappings":";;;;;AAOA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,UAAUA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B,QAAQA,EAAAA,MACG,GACN,QAAQ,CACL;AAEZ;AA2BA,MAAMC;IAQF,YACYC,SAAqC,EACrCC,YAA2C,CACrD;aAFUD,SAAS,GAATA;aACAC,YAAY,GAAZA;aATH,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGJ;aACd,WAAW,GAAG;YAAE,cAAc;YAAO,iBAAiB;QAAK;IAKjE;IAEH,MAAM,QAAQK,KAAY,EAAyB;QAC/C,MAAMC,SAAS,MAAMC,sBAAsB,IAAI,CAAC,SAAS,EAAEF,MAAM,QAAQ;QAEzE,MAAMG,WAAWF,OAAO,MAAM,CAAC,IAAI,CAC/BG,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAMJ,MAAM,MAAM;QAG5D,IAAI,CAACG,UAAU;YACX,IAAIF,OAAO,gBAAgB,CAAC,GAAG,CAACD,MAAM,MAAM,GACxC,MAAM,IAAIM,MACN,CAAC,CAAC,EAAEN,MAAM,MAAM,CAAC,sHAAsH,CAAC;YAIhJ,MAAM,IAAIM,MACN,CAAC,CAAC,EAAEN,MAAM,MAAM,CAAC,qEAAqE,CAAC;QAE/F;QAEA,MAAMO,cAAcN,OAAO,MAAM,CAAC,MAAM,CACpCG,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAMJ,MAAM,MAAM;QAG5D,MAAMQ,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAACR,MAAM,QAAQ,EAAE;YAAEO;QAAY;QAE7E,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIF,MAAM,CAAC,yBAAyB,EAAEE,OAAO,KAAK,CAAC,OAAO,EAAE;QAGtE,MAAMC,SAASD,OAAO,KAAK;QAE3B,OAAO;YACH,UAAUC,OAAO,EAAE;YACnB,OAAOA,OAAO,KAAK;YACnB,MAAMA,OAAO,IAAI;YACjB,SAAS;gBAAE,QAAQT,MAAM,MAAM;gBAAE,OAAOG,SAAS,KAAK;YAAC;YACvD,aAAcM,AAAAA,CAAAA,OAAO,WAAW,IAAI,EAAC,EAChC,MAAM,CAACL,CAAAA,aAAc,CAACA,WAAW,aAAa,EAC9C,GAAG,CAACA,CAAAA,aAAe;oBAAE,QAAQC,OAAOD,WAAW,MAAM;oBAAG,OAAOA,WAAW,KAAK;gBAAC;QACzF;IACJ;AACJ;AAEO,MAAMM,yBAAyBC,UAAU,oBAAoB,CAAC;IACjE,gBAAgBd;IAChB,cAAc;QAACe;QAAkBC;KAAoB;AACzD"}
1
+ {"version":3,"file":"features/ai/RevokeFolderAccessTool.js","sources":["../../../src/features/ai/RevokeFolderAccessTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { UpdateFolderUseCase } from \"~/features/folder/UpdateFolder/index.js\";\nimport { loadFolderPermissions } from \"./loadFolderPermissions.js\";\n\nconst inputSchema = z.object({\n folderId: z.string().describe(\"Folder id as returned by listFolders.\"),\n target: z\n .string()\n .describe(\n \"Whose access to remove: 'team:<slug>' or 'admin:<userId>', exactly as listFolders reports it.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface RevokeResult {\n folderId: string;\n title: string;\n path: string;\n removed: { target: string; level: string };\n /**\n * Every direct rule remaining afterwards.\n *\n * This is the set the update was asked to store, not an independent read of it:\n * `UpdateFolderWithFolderLevelPermissions` returns the permissions it derived from the input\n * rather than the ones the repository wrote. Treating it as a verification would let the tool\n * confirm its own request back to itself.\n */\n permissions: { target: string; level: string }[];\n}\n\nclass RevokeFolderAccessToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(\n private getFolder: GetFolderUseCase.Interface,\n private updateFolder: UpdateFolderUseCase.Interface\n ) {}\n\n async execute(input: Input): Promise<RevokeResult> {\n const loaded = await loadFolderPermissions(this.getFolder, input.folderId);\n\n const existing = loaded.direct.find(\n permission => String(permission.target) === input.target\n );\n\n if (!existing) {\n if (loaded.inheritedTargets.has(input.target)) {\n throw new Error(\n `\"${input.target}\" has inherited access to this folder, not a direct rule, so it cannot be revoked here. Change it where it is defined.`\n );\n }\n\n throw new Error(\n `\"${input.target}\" has no direct access to this folder, so there is nothing to revoke.`\n );\n }\n\n const permissions = loaded.direct.filter(\n permission => String(permission.target) !== input.target\n );\n\n const result = await this.updateFolder.execute(input.folderId, { permissions });\n\n if (result.isFail()) {\n throw new Error(`Could not revoke access: ${result.error.message}`);\n }\n\n const folder = result.value;\n\n return {\n folderId: folder.id,\n title: folder.title,\n path: folder.path,\n removed: { target: input.target, level: existing.level },\n permissions: (folder.permissions ?? [])\n .filter(permission => !permission.inheritedFrom)\n .map(permission => ({ target: String(permission.target), level: permission.level }))\n };\n }\n}\n\nconst RevokeFolderAccessToolHandler = AiSdkToolHandler.createImplementation({\n implementation: RevokeFolderAccessToolHandlerImpl,\n dependencies: [GetFolderUseCase, UpdateFolderUseCase]\n});\n\n/**\n * Removes one target's direct access to one folder.\n *\n * Destructive: somebody loses access, and there is no undo. Refuses when the target has no DIRECT rule\n * rather than reporting a removal that changed nothing — an inherited grant cannot be revoked here,\n * only where it is defined, and saying otherwise would leave the user believing access was withdrawn.\n */\nclass RevokeFolderAccessToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"revokeFolderAccess\";\n readonly title = \"Revoke folder access\";\n readonly description =\n \"Removes one team's or user's direct access to one folder, leaving all other permissions untouched. Cannot remove inherited access. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false, destructiveHint: true };\n readonly handler = RevokeFolderAccessToolHandler;\n}\n\nexport const RevokeFolderAccessTool = AiSdkToolDefinition.createImplementation({\n implementation: RevokeFolderAccessToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","RevokeFolderAccessToolHandlerImpl","getFolder","updateFolder","input","loaded","loadFolderPermissions","existing","permission","String","Error","permissions","result","folder","RevokeFolderAccessToolHandler","AiSdkToolHandler","GetFolderUseCase","UpdateFolderUseCase","RevokeFolderAccessToolImpl","RevokeFolderAccessTool","AiSdkToolDefinition"],"mappings":";;;;;AAMA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,UAAUA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B,QAAQA,EAAAA,MACG,GACN,QAAQ,CACL;AAEZ;AAoBA,MAAMC;IACF,YACYC,SAAqC,EACrCC,YAA2C,CACrD;aAFUD,SAAS,GAATA;aACAC,YAAY,GAAZA;IACT;IAEH,MAAM,QAAQC,KAAY,EAAyB;QAC/C,MAAMC,SAAS,MAAMC,sBAAsB,IAAI,CAAC,SAAS,EAAEF,MAAM,QAAQ;QAEzE,MAAMG,WAAWF,OAAO,MAAM,CAAC,IAAI,CAC/BG,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAMJ,MAAM,MAAM;QAG5D,IAAI,CAACG,UAAU;YACX,IAAIF,OAAO,gBAAgB,CAAC,GAAG,CAACD,MAAM,MAAM,GACxC,MAAM,IAAIM,MACN,CAAC,CAAC,EAAEN,MAAM,MAAM,CAAC,sHAAsH,CAAC;YAIhJ,MAAM,IAAIM,MACN,CAAC,CAAC,EAAEN,MAAM,MAAM,CAAC,qEAAqE,CAAC;QAE/F;QAEA,MAAMO,cAAcN,OAAO,MAAM,CAAC,MAAM,CACpCG,CAAAA,aAAcC,OAAOD,WAAW,MAAM,MAAMJ,MAAM,MAAM;QAG5D,MAAMQ,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAACR,MAAM,QAAQ,EAAE;YAAEO;QAAY;QAE7E,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIF,MAAM,CAAC,yBAAyB,EAAEE,OAAO,KAAK,CAAC,OAAO,EAAE;QAGtE,MAAMC,SAASD,OAAO,KAAK;QAE3B,OAAO;YACH,UAAUC,OAAO,EAAE;YACnB,OAAOA,OAAO,KAAK;YACnB,MAAMA,OAAO,IAAI;YACjB,SAAS;gBAAE,QAAQT,MAAM,MAAM;gBAAE,OAAOG,SAAS,KAAK;YAAC;YACvD,aAAcM,AAAAA,CAAAA,OAAO,WAAW,IAAI,EAAC,EAChC,MAAM,CAACL,CAAAA,aAAc,CAACA,WAAW,aAAa,EAC9C,GAAG,CAACA,CAAAA,aAAe;oBAAE,QAAQC,OAAOD,WAAW,MAAM;oBAAG,OAAOA,WAAW,KAAK;gBAAC;QACzF;IACJ;AACJ;AAEA,MAAMM,gCAAgCC,iBAAiB,oBAAoB,CAAC;IACxE,gBAAgBd;IAChB,cAAc;QAACe;QAAkBC;KAAoB;AACzD;AASA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGnB;aACd,WAAW,GAAG;YAAE,cAAc;YAAO,iBAAiB;QAAK;aAC3D,OAAO,GAAGe;;AACvB;AAEO,MAAMK,yBAAyBC,oBAAoB,oBAAoB,CAAC;IAC3E,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ import { AiSdkToolDefinition } from "@webiny/api-core/features/ai/index.js";
3
+ import { AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
4
+ import { GetFolderUseCase } from "../../features/folder/GetFolder/index.js";
5
+ import { UpdateFolderUseCase } from "../../features/folder/UpdateFolder/index.js";
6
+ declare const inputSchema: z.ZodObject<{
7
+ folderId: z.ZodString;
8
+ currentTitle: z.ZodString;
9
+ title: z.ZodOptional<z.ZodString>;
10
+ slug: z.ZodOptional<z.ZodString>;
11
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ }, z.core.$strip>;
13
+ type Input = z.infer<typeof inputSchema>;
14
+ interface UpdatedFolder {
15
+ id: string;
16
+ title: string;
17
+ slug: string;
18
+ path: string;
19
+ parentId: string | null;
20
+ type: string;
21
+ }
22
+ declare class UpdateFolderToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
23
+ private getFolder;
24
+ private updateFolder;
25
+ constructor(getFolder: GetFolderUseCase.Interface, updateFolder: UpdateFolderUseCase.Interface);
26
+ execute(input: Input): Promise<UpdatedFolder>;
27
+ private ensureSameType;
28
+ }
29
+ /**
30
+ * Renames or moves one folder.
31
+ *
32
+ * Not destructive: the old title, slug and parent can be set again. A new slug or parent changes the
33
+ * folder's path and its subfolders' paths, and with them which code-defined access rules apply, so
34
+ * it still waits for the user to approve the exact arguments.
35
+ */
36
+ declare class UpdateFolderToolImpl implements AiSdkToolDefinition.Interface<Input> {
37
+ readonly name = "updateFolder";
38
+ readonly title = "Update folder";
39
+ readonly description = "Renames a folder, changes its slug, or moves it under another folder of the same type (parentId null moves it to the root). Call listFolders first for the id, the exact current title and the new parent. Access rules are changed with grantFolderAccess and revokeFolderAccess, not here. Requires user approval.";
40
+ readonly inputSchema: z.ZodObject<{
41
+ folderId: z.ZodString;
42
+ currentTitle: z.ZodString;
43
+ title: z.ZodOptional<z.ZodString>;
44
+ slug: z.ZodOptional<z.ZodString>;
45
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ }, z.core.$strip>;
47
+ readonly annotations: {
48
+ readOnlyHint: boolean;
49
+ };
50
+ readonly handler: typeof UpdateFolderToolHandlerImpl & {
51
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
52
+ };
53
+ }
54
+ export declare const UpdateFolderTool: typeof UpdateFolderToolImpl & {
55
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
56
+ };
57
+ export {};