@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
package/AcoFeature.js CHANGED
@@ -1,23 +1,18 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
+ import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
2
3
  import { GraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
3
4
  import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
4
5
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
5
- import { HeadlessCms } from "@webiny/api-headless-cms/features/shared/abstractions.js";
6
6
  import { addAcoBaseSchema } from "./createAcoGraphQL.js";
7
7
  import { addFilterSchema } from "./filter/filter.gql.js";
8
8
  import { AcoFolderSchemaFactory } from "./AcoFolderSchemaFactory.js";
9
9
  import { FolderModelProvider } from "./features/folder/FolderModelProvider.js";
10
10
  import { CmsFlpFeature } from "./features/cms/index.js";
11
11
  import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
12
- import { CreateFlpTask } from "./flp/tasks/createFlp.task.js";
13
- import { UpdateFlpTask } from "./flp/tasks/updateFlp.task.js";
14
- import { DeleteFlpTask } from "./flp/tasks/deleteFlp.task.js";
15
- import { SyncFlpTask } from "./flp/tasks/syncFlp.task.js";
16
12
  import { FolderModel } from "./domain/folder/folder.model.js";
17
13
  import { FilterPrivateModel } from "./filter/filter.model.js";
18
14
  import { createFilterOperations } from "./filter/filter.so.js";
19
15
  import { createFilterCrudMethods } from "./filter/filter.crud.js";
20
- import { createFlpCrudMethods } from "./flp/index.js";
21
16
  import { FolderLevelPermissions, FolderLevelPermissionsFeature } from "./features/flp/FolderLevelPermissions/index.js";
22
17
  import { UpdateFolderFeature } from "./features/folder/UpdateFolder/index.js";
23
18
  import { DeleteFolderFeature } from "./features/folder/DeleteFolder/index.js";
@@ -26,26 +21,27 @@ import { GetFolderFeature } from "./features/folder/GetFolder/index.js";
26
21
  import { ListFoldersFeature } from "./features/folder/ListFolders/index.js";
27
22
  import { GetFolderHierarchyFeature } from "./features/folder/GetFolderHierarchy/index.js";
28
23
  import { GetAncestorsFeature } from "./features/folder/GetAncestors/index.js";
29
- import { UpdateFlpOnFolderUpdatedFeature } from "./features/flp/UpdateFlpOnFolderUpdated/index.js";
30
- import { DeleteFlpOnFolderDeletedFeature } from "./features/flp/DeleteFlpOnFolderDeleted/index.js";
31
24
  import { EnsureHcmsFolderIsEmptyOnDeleteFeature } from "./features/folder/EnsureHcmsFolderIsEmptyOnDelete/index.js";
32
- import { CreateFlpFeature } from "./features/flp/CreateFlp/index.js";
33
- import { DeleteFlpFeature } from "./features/flp/DeleteFlp/index.js";
34
- import { UpdateFlpFeature } from "./features/flp/UpdateFlp/index.js";
35
25
  import { EnsureFolderIsEmptyOnDeleteFeature } from "./features/folder/EnsureFolderIsEmptyOnDelete/index.js";
36
- import { AcoFilterCrud, AcoFlpCrud, FilterStorageOperations, FlpStorageOperations } from "./features/folder/shared/abstractions.js";
26
+ import { AcoFilterCrud, FilterStorageOperations } from "./features/folder/shared/abstractions.js";
37
27
  import { ListFlpsFeature } from "./features/flp/ListFlps/feature.js";
38
28
  import { GetFlpFeature } from "./features/flp/GetFlp/feature.js";
29
+ import { CodeFlpsFeature } from "./features/flp/shared/feature.js";
39
30
  import { ListFolderLevelPermissionsTargetsFeature } from "./features/folder/ListFolderLevelPermissionsTargets/feature.js";
40
- import { CreateFlpOnFolderCreatedFeature } from "./features/flp/CreateFlpOnFolderCreated/index.js";
31
+ import { FolderCatalogSyncHandlersFeature } from "./features/flp/FolderCatalogSync/index.js";
32
+ import { ListFolderAccessFeature } from "./features/flp/ListFolderAccess/index.js";
41
33
  import { EnsureFolderIsEmptyFeature } from "./features/folder/EnsureFolderIsEmpty/feature.js";
42
34
  import { AcoAiToolsFeature } from "./features/ai/index.js";
35
+ import { NotifyFolderChangeFeature } from "./features/folder/NotifyFolderChange/index.js";
43
36
  class AcoSchemaFactoryImpl {
44
37
  async execute(builder) {
45
38
  addAcoBaseSchema(builder);
46
39
  addFilterSchema(builder);
47
40
  return builder;
48
41
  }
42
+ constructor(){
43
+ this.getSchemaKey = staticSchemaKey("api-aco/AcoSchemaFactoryImpl");
44
+ }
49
45
  }
50
46
  const AcoSchemaFactory = GraphQLSchemaFactory.createImplementation({
51
47
  implementation: AcoSchemaFactoryImpl,
@@ -57,10 +53,6 @@ const AcoFeature = createFeature({
57
53
  container.register(FolderModel);
58
54
  AcoAiToolsFeature.register(container);
59
55
  container.register(FilterPrivateModel);
60
- container.register(CreateFlpTask);
61
- container.register(UpdateFlpTask);
62
- container.register(DeleteFlpTask);
63
- container.register(SyncFlpTask);
64
56
  FolderLevelPermissionsFeature.register(container);
65
57
  CreateFolderFeature.register(container);
66
58
  UpdateFolderFeature.register(container);
@@ -71,42 +63,28 @@ const AcoFeature = createFeature({
71
63
  GetFolderHierarchyFeature.register(container);
72
64
  GetAncestorsFeature.register(container);
73
65
  EnsureFolderIsEmptyFeature.register(container);
74
- CreateFlpFeature.register(container);
75
- UpdateFlpFeature.register(container);
76
- DeleteFlpFeature.register(container);
77
66
  ListFlpsFeature.register(container);
78
67
  GetFlpFeature.register(container);
79
- CreateFlpOnFolderCreatedFeature.register(container);
80
- UpdateFlpOnFolderUpdatedFeature.register(container);
81
- DeleteFlpOnFolderDeletedFeature.register(container);
68
+ ListFolderAccessFeature.register(container);
69
+ CodeFlpsFeature.register(container);
70
+ FolderCatalogSyncHandlersFeature.register(container);
71
+ NotifyFolderChangeFeature.register(container);
82
72
  EnsureFolderIsEmptyOnDeleteFeature.register(container);
83
73
  EnsureHcmsFolderIsEmptyOnDeleteFeature.register(container);
84
74
  const getTenant = ()=>container.resolve(TenantContext).getTenant();
85
75
  let storageOperations;
86
76
  const getStorageOperations = ()=>{
87
77
  if (!storageOperations) {
88
- const cms = container.resolve(HeadlessCms);
89
78
  const identityContext = container.resolve(IdentityContext);
90
79
  storageOperations = {
91
80
  filter: createFilterOperations({
92
- cms,
93
81
  identityContext,
94
82
  container
95
- }),
96
- flp: container.resolve(FlpStorageOperations)
83
+ })
97
84
  };
98
85
  }
99
86
  return storageOperations;
100
87
  };
101
- let flpCrudMethods;
102
- const getFlpCrudMethods = ()=>{
103
- if (!flpCrudMethods) flpCrudMethods = createFlpCrudMethods({
104
- getTenant,
105
- storageOperations: getStorageOperations()
106
- });
107
- return flpCrudMethods;
108
- };
109
- container.registerFactory(AcoFlpCrud, ()=>getFlpCrudMethods());
110
88
  container.registerFactory(FilterStorageOperations, ()=>getStorageOperations().filter);
111
89
  let filterCrudMethods;
112
90
  container.registerFactory(AcoFilterCrud, ()=>{
package/AcoFeature.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"AcoFeature.js","sources":["../src/AcoFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport type { Container } from \"@webiny/di\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { HeadlessCms } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { addAcoBaseSchema } from \"./createAcoGraphQL.js\";\nimport { addFilterSchema } from \"~/filter/filter.gql.js\";\nimport { AcoFolderSchemaFactory } from \"./AcoFolderSchemaFactory.js\";\nimport { FolderModelProvider } from \"~/features/folder/FolderModelProvider.js\";\nimport { CmsFlpFeature } from \"~/features/cms/index.js\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { CreateFlpTask } from \"~/flp/tasks/createFlp.task.js\";\nimport { UpdateFlpTask } from \"~/flp/tasks/updateFlp.task.js\";\nimport { DeleteFlpTask } from \"~/flp/tasks/deleteFlp.task.js\";\nimport { SyncFlpTask } from \"~/flp/tasks/syncFlp.task.js\";\nimport type { AcoStorageOperations } from \"~/types.js\";\nimport type { Tenant } from \"@webiny/api-core/types/tenancy.js\";\nimport { FolderModel } from \"~/domain/folder/folder.model.js\";\nimport { FilterPrivateModel } from \"~/filter/filter.model.js\";\n// Facade wiring (moved here from createAcoContext so the ACO facade can be a lazy DI factory).\nimport { createFilterOperations } from \"~/filter/filter.so.js\";\nimport { createFilterCrudMethods } from \"~/filter/filter.crud.js\";\nimport { createFlpCrudMethods } from \"~/flp/index.js\";\nimport {\n FolderLevelPermissions,\n FolderLevelPermissionsFeature\n} from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { UpdateFolderFeature } from \"~/features/folder/UpdateFolder/index.js\";\nimport { DeleteFolderFeature } from \"~/features/folder/DeleteFolder/index.js\";\nimport { CreateFolderFeature } from \"~/features/folder/CreateFolder/index.js\";\nimport { GetFolderFeature } from \"~/features/folder/GetFolder/index.js\";\nimport { ListFoldersFeature } from \"~/features/folder/ListFolders/index.js\";\nimport { GetFolderHierarchyFeature } from \"~/features/folder/GetFolderHierarchy/index.js\";\nimport { GetAncestorsFeature } from \"~/features/folder/GetAncestors/index.js\";\nimport { UpdateFlpOnFolderUpdatedFeature } from \"~/features/flp/UpdateFlpOnFolderUpdated/index.js\";\nimport { DeleteFlpOnFolderDeletedFeature } from \"~/features/flp/DeleteFlpOnFolderDeleted/index.js\";\nimport { EnsureHcmsFolderIsEmptyOnDeleteFeature } from \"~/features/folder/EnsureHcmsFolderIsEmptyOnDelete/index.js\";\nimport { CreateFlpFeature } from \"~/features/flp/CreateFlp/index.js\";\nimport { DeleteFlpFeature } from \"~/features/flp/DeleteFlp/index.js\";\nimport { UpdateFlpFeature } from \"~/features/flp/UpdateFlp/index.js\";\nimport { EnsureFolderIsEmptyOnDeleteFeature } from \"~/features/folder/EnsureFolderIsEmptyOnDelete/index.js\";\nimport {\n AcoFilterCrud,\n AcoFlpCrud,\n FilterStorageOperations,\n FlpStorageOperations\n} from \"~/features/folder/shared/abstractions.js\";\nimport { ListFlpsFeature } from \"~/features/flp/ListFlps/feature.js\";\nimport { GetFlpFeature } from \"~/features/flp/GetFlp/feature.js\";\nimport { ListFolderLevelPermissionsTargetsFeature } from \"~/features/folder/ListFolderLevelPermissionsTargets/feature.js\";\nimport { CreateFlpOnFolderCreatedFeature } from \"~/features/flp/CreateFlpOnFolderCreated/index.js\";\nimport { EnsureFolderIsEmptyFeature } from \"~/features/folder/EnsureFolderIsEmpty/feature.js\";\nimport { AcoAiToolsFeature } from \"~/features/ai/index.js\";\n\nclass AcoSchemaFactoryImpl implements GraphQLSchemaFactory.Interface {\n async execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder> {\n // Static ACO base + filter schema (DI-native contributors declaring their deps). The\n // dynamic, per-tenant folder schema is built by AcoFolderSchemaFactory.\n addAcoBaseSchema(builder);\n addFilterSchema(builder);\n return builder;\n }\n}\n\nconst AcoSchemaFactory = GraphQLSchemaFactory.createImplementation({\n implementation: AcoSchemaFactoryImpl,\n dependencies: []\n});\n\nexport const AcoFeature = createFeature({\n name: \"Aco\",\n register(container: Container) {\n container.register(FolderModel);\n AcoAiToolsFeature.register(container);\n container.register(FilterPrivateModel);\n\n // Background task definitions — pure wiring, no tenant/identity needed.\n container.register(CreateFlpTask);\n container.register(UpdateFlpTask);\n container.register(DeleteFlpTask);\n container.register(SyncFlpTask);\n\n // Folder + FLP use-case features — pure DI wiring (all lazy). Moved out of the per-request\n // initializer so they're registered for every event, not only GraphQL requests.\n FolderLevelPermissionsFeature.register(container);\n CreateFolderFeature.register(container);\n UpdateFolderFeature.register(container);\n DeleteFolderFeature.register(container);\n GetFolderFeature.register(container);\n ListFoldersFeature.register(container);\n ListFolderLevelPermissionsTargetsFeature.register(container);\n GetFolderHierarchyFeature.register(container);\n GetAncestorsFeature.register(container);\n EnsureFolderIsEmptyFeature.register(container);\n CreateFlpFeature.register(container);\n UpdateFlpFeature.register(container);\n DeleteFlpFeature.register(container);\n ListFlpsFeature.register(container);\n GetFlpFeature.register(container);\n CreateFlpOnFolderCreatedFeature.register(container);\n UpdateFlpOnFolderUpdatedFeature.register(container);\n DeleteFlpOnFolderDeletedFeature.register(container);\n EnsureFolderIsEmptyOnDeleteFeature.register(container);\n EnsureHcmsFolderIsEmptyOnDeleteFeature.register(container);\n\n // ===== Lazy ACO facade =====\n // Built on first resolve (post-auth) so the HeadlessCms facade (also lazy) is resolved on\n // demand. Memoised per request container. Consumers resolve AcoFlpCrud / AcoFilterCrud /\n // FilterStorageOperations via DI.\n const getTenant = (): Tenant => container.resolve(TenantContext).getTenant();\n\n let storageOperations: AcoStorageOperations | undefined;\n const getStorageOperations = (): AcoStorageOperations => {\n if (!storageOperations) {\n const cms = container.resolve(HeadlessCms);\n const identityContext = container.resolve(IdentityContext);\n storageOperations = {\n filter: createFilterOperations({ cms, identityContext, container }),\n flp: container.resolve(FlpStorageOperations)\n };\n }\n return storageOperations;\n };\n\n let flpCrudMethods: ReturnType<typeof createFlpCrudMethods> | undefined;\n const getFlpCrudMethods = () => {\n if (!flpCrudMethods) {\n flpCrudMethods = createFlpCrudMethods({\n getTenant,\n storageOperations: getStorageOperations()\n });\n }\n return flpCrudMethods;\n };\n container.registerFactory(AcoFlpCrud, () => getFlpCrudMethods());\n container.registerFactory(FilterStorageOperations, () => getStorageOperations().filter);\n\n let filterCrudMethods: ReturnType<typeof createFilterCrudMethods> | undefined;\n container.registerFactory(AcoFilterCrud, () => {\n if (!filterCrudMethods) {\n filterCrudMethods = createFilterCrudMethods({\n container,\n getTenant,\n storageOperations: getStorageOperations(),\n folderLevelPermissions: container.resolve(FolderLevelPermissions)\n });\n }\n return filterCrudMethods;\n });\n\n // The per-tenant folder model is resolved on demand — see FolderModelProvider.\n container.register(FolderModelProvider);\n\n // CMS-entry folder-level-permission decorators, feature-flag gated. These must be\n // registered before any CMS-entry abstraction they wrap is first resolved, which is why\n // they used to sit in a pre-resolver initializer. Register time is strictly earlier and the\n // gate is valid here: the WCP license is refreshed before any feature registers (see\n // registerApiRequestStack).\n if (\n container\n .resolve(FeatureFlags)\n .get()\n .isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n CmsFlpFeature.register(container);\n }\n\n container.register(AcoSchemaFactory);\n container.register(AcoFolderSchemaFactory);\n }\n});\n"],"names":["AcoSchemaFactoryImpl","builder","addAcoBaseSchema","addFilterSchema","AcoSchemaFactory","GraphQLSchemaFactory","AcoFeature","createFeature","container","FolderModel","AcoAiToolsFeature","FilterPrivateModel","CreateFlpTask","UpdateFlpTask","DeleteFlpTask","SyncFlpTask","FolderLevelPermissionsFeature","CreateFolderFeature","UpdateFolderFeature","DeleteFolderFeature","GetFolderFeature","ListFoldersFeature","ListFolderLevelPermissionsTargetsFeature","GetFolderHierarchyFeature","GetAncestorsFeature","EnsureFolderIsEmptyFeature","CreateFlpFeature","UpdateFlpFeature","DeleteFlpFeature","ListFlpsFeature","GetFlpFeature","CreateFlpOnFolderCreatedFeature","UpdateFlpOnFolderUpdatedFeature","DeleteFlpOnFolderDeletedFeature","EnsureFolderIsEmptyOnDeleteFeature","EnsureHcmsFolderIsEmptyOnDeleteFeature","getTenant","TenantContext","storageOperations","getStorageOperations","cms","HeadlessCms","identityContext","IdentityContext","createFilterOperations","FlpStorageOperations","flpCrudMethods","getFlpCrudMethods","createFlpCrudMethods","AcoFlpCrud","FilterStorageOperations","filterCrudMethods","AcoFilterCrud","createFilterCrudMethods","FolderLevelPermissions","FolderModelProvider","FeatureFlags","CmsFlpFeature","AcoFolderSchemaFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAMA;IACF,MAAM,QAAQC,OAA8B,EAAkC;QAG1EC,iBAAiBD;QACjBE,gBAAgBF;QAChB,OAAOA;IACX;AACJ;AAEA,MAAMG,mBAAmBC,qBAAqB,oBAAoB,CAAC;IAC/D,gBAAgBL;IAChB,cAAc,EAAE;AACpB;AAEO,MAAMM,aAAaC,cAAc;IACpC,MAAM;IACN,UAASC,SAAoB;QACzBA,UAAU,QAAQ,CAACC;QACnBC,kBAAkB,QAAQ,CAACF;QAC3BA,UAAU,QAAQ,CAACG;QAGnBH,UAAU,QAAQ,CAACI;QACnBJ,UAAU,QAAQ,CAACK;QACnBL,UAAU,QAAQ,CAACM;QACnBN,UAAU,QAAQ,CAACO;QAInBC,8BAA8B,QAAQ,CAACR;QACvCS,oBAAoB,QAAQ,CAACT;QAC7BU,oBAAoB,QAAQ,CAACV;QAC7BW,oBAAoB,QAAQ,CAACX;QAC7BY,iBAAiB,QAAQ,CAACZ;QAC1Ba,mBAAmB,QAAQ,CAACb;QAC5Bc,yCAAyC,QAAQ,CAACd;QAClDe,0BAA0B,QAAQ,CAACf;QACnCgB,oBAAoB,QAAQ,CAAChB;QAC7BiB,2BAA2B,QAAQ,CAACjB;QACpCkB,iBAAiB,QAAQ,CAAClB;QAC1BmB,iBAAiB,QAAQ,CAACnB;QAC1BoB,iBAAiB,QAAQ,CAACpB;QAC1BqB,gBAAgB,QAAQ,CAACrB;QACzBsB,cAAc,QAAQ,CAACtB;QACvBuB,gCAAgC,QAAQ,CAACvB;QACzCwB,gCAAgC,QAAQ,CAACxB;QACzCyB,gCAAgC,QAAQ,CAACzB;QACzC0B,mCAAmC,QAAQ,CAAC1B;QAC5C2B,uCAAuC,QAAQ,CAAC3B;QAMhD,MAAM4B,YAAY,IAAc5B,UAAU,OAAO,CAAC6B,eAAe,SAAS;QAE1E,IAAIC;QACJ,MAAMC,uBAAuB;YACzB,IAAI,CAACD,mBAAmB;gBACpB,MAAME,MAAMhC,UAAU,OAAO,CAACiC;gBAC9B,MAAMC,kBAAkBlC,UAAU,OAAO,CAACmC;gBAC1CL,oBAAoB;oBAChB,QAAQM,uBAAuB;wBAAEJ;wBAAKE;wBAAiBlC;oBAAU;oBACjE,KAAKA,UAAU,OAAO,CAACqC;gBAC3B;YACJ;YACA,OAAOP;QACX;QAEA,IAAIQ;QACJ,MAAMC,oBAAoB;YACtB,IAAI,CAACD,gBACDA,iBAAiBE,qBAAqB;gBAClCZ;gBACA,mBAAmBG;YACvB;YAEJ,OAAOO;QACX;QACAtC,UAAU,eAAe,CAACyC,YAAY,IAAMF;QAC5CvC,UAAU,eAAe,CAAC0C,yBAAyB,IAAMX,uBAAuB,MAAM;QAEtF,IAAIY;QACJ3C,UAAU,eAAe,CAAC4C,eAAe;YACrC,IAAI,CAACD,mBACDA,oBAAoBE,wBAAwB;gBACxC7C;gBACA4B;gBACA,mBAAmBG;gBACnB,wBAAwB/B,UAAU,OAAO,CAAC8C;YAC9C;YAEJ,OAAOH;QACX;QAGA3C,UAAU,QAAQ,CAAC+C;QAOnB,IACI/C,UACK,OAAO,CAACgD,cACR,GAAG,GACH,SAAS,CAAC,sDAEfC,cAAc,QAAQ,CAACjD;QAG3BA,UAAU,QAAQ,CAACJ;QACnBI,UAAU,QAAQ,CAACkD;IACvB;AACJ"}
1
+ {"version":3,"file":"AcoFeature.js","sources":["../src/AcoFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { GraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport type { Container } from \"@webiny/di\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { addAcoBaseSchema } from \"./createAcoGraphQL.js\";\nimport { addFilterSchema } from \"~/filter/filter.gql.js\";\nimport { AcoFolderSchemaFactory } from \"./AcoFolderSchemaFactory.js\";\nimport { FolderModelProvider } from \"~/features/folder/FolderModelProvider.js\";\nimport { CmsFlpFeature } from \"~/features/cms/index.js\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport type { AcoStorageOperations } from \"~/types.js\";\nimport type { Tenant } from \"@webiny/api-core/types/tenancy.js\";\nimport { FolderModel } from \"~/domain/folder/folder.model.js\";\nimport { FilterPrivateModel } from \"~/filter/filter.model.js\";\n// Facade wiring (moved here from createAcoContext so the ACO facade can be a lazy DI factory).\nimport { createFilterOperations } from \"~/filter/filter.so.js\";\nimport { createFilterCrudMethods } from \"~/filter/filter.crud.js\";\nimport {\n FolderLevelPermissions,\n FolderLevelPermissionsFeature\n} from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { UpdateFolderFeature } from \"~/features/folder/UpdateFolder/index.js\";\nimport { DeleteFolderFeature } from \"~/features/folder/DeleteFolder/index.js\";\nimport { CreateFolderFeature } from \"~/features/folder/CreateFolder/index.js\";\nimport { GetFolderFeature } from \"~/features/folder/GetFolder/index.js\";\nimport { ListFoldersFeature } from \"~/features/folder/ListFolders/index.js\";\nimport { GetFolderHierarchyFeature } from \"~/features/folder/GetFolderHierarchy/index.js\";\nimport { GetAncestorsFeature } from \"~/features/folder/GetAncestors/index.js\";\nimport { EnsureHcmsFolderIsEmptyOnDeleteFeature } from \"~/features/folder/EnsureHcmsFolderIsEmptyOnDelete/index.js\";\nimport { EnsureFolderIsEmptyOnDeleteFeature } from \"~/features/folder/EnsureFolderIsEmptyOnDelete/index.js\";\nimport { AcoFilterCrud, FilterStorageOperations } from \"~/features/folder/shared/abstractions.js\";\nimport { ListFlpsFeature } from \"~/features/flp/ListFlps/feature.js\";\nimport { GetFlpFeature } from \"~/features/flp/GetFlp/feature.js\";\nimport { CodeFlpsFeature } from \"~/features/flp/shared/feature.js\";\nimport { ListFolderLevelPermissionsTargetsFeature } from \"~/features/folder/ListFolderLevelPermissionsTargets/feature.js\";\nimport { FolderCatalogSyncHandlersFeature } from \"~/features/flp/FolderCatalogSync/index.js\";\nimport { ListFolderAccessFeature } from \"~/features/flp/ListFolderAccess/index.js\";\nimport { EnsureFolderIsEmptyFeature } from \"~/features/folder/EnsureFolderIsEmpty/feature.js\";\nimport { AcoAiToolsFeature } from \"~/features/ai/index.js\";\nimport { NotifyFolderChangeFeature } from \"~/features/folder/NotifyFolderChange/index.js\";\n\nclass AcoSchemaFactoryImpl implements GraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"api-aco/AcoSchemaFactoryImpl\");\n\n async execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder> {\n // Static ACO base + filter schema (DI-native contributors declaring their deps). The\n // dynamic, per-tenant folder schema is built by AcoFolderSchemaFactory.\n addAcoBaseSchema(builder);\n addFilterSchema(builder);\n return builder;\n }\n}\n\nconst AcoSchemaFactory = GraphQLSchemaFactory.createImplementation({\n implementation: AcoSchemaFactoryImpl,\n dependencies: []\n});\n\nexport const AcoFeature = createFeature({\n name: \"Aco\",\n register(container: Container) {\n container.register(FolderModel);\n AcoAiToolsFeature.register(container);\n container.register(FilterPrivateModel);\n\n // Folder + FLP use-case features — pure DI wiring (all lazy). Moved out of the per-request\n // initializer so they're registered for every event, not only GraphQL requests.\n FolderLevelPermissionsFeature.register(container);\n CreateFolderFeature.register(container);\n UpdateFolderFeature.register(container);\n DeleteFolderFeature.register(container);\n GetFolderFeature.register(container);\n ListFoldersFeature.register(container);\n ListFolderLevelPermissionsTargetsFeature.register(container);\n GetFolderHierarchyFeature.register(container);\n GetAncestorsFeature.register(container);\n EnsureFolderIsEmptyFeature.register(container);\n ListFlpsFeature.register(container);\n GetFlpFeature.register(container);\n ListFolderAccessFeature.register(container);\n // Must come after ListFlps/GetFlp — it decorates both.\n CodeFlpsFeature.register(container);\n // Folder changes go to FolderCatalogSync. Its implementation, like those of\n // FolderPermissionsRepository and FolderAccessListFilter, comes from the storage's FLP\n // strategy (e.g. TaskCatalogFlpFeature), not from here.\n FolderCatalogSyncHandlersFeature.register(container);\n NotifyFolderChangeFeature.register(container);\n EnsureFolderIsEmptyOnDeleteFeature.register(container);\n EnsureHcmsFolderIsEmptyOnDeleteFeature.register(container);\n\n // ===== Lazy ACO facade =====\n // Built on first resolve (post-auth), memoised per request container. Consumers resolve\n // AcoFilterCrud / FilterStorageOperations via DI. AcoFlpCrud comes from the FLP strategy.\n const getTenant = (): Tenant => container.resolve(TenantContext).getTenant();\n\n let storageOperations: Pick<AcoStorageOperations, \"filter\"> | undefined;\n const getStorageOperations = (): Pick<AcoStorageOperations, \"filter\"> => {\n if (!storageOperations) {\n const identityContext = container.resolve(IdentityContext);\n storageOperations = {\n filter: createFilterOperations({ identityContext, container })\n };\n }\n return storageOperations;\n };\n\n container.registerFactory(FilterStorageOperations, () => getStorageOperations().filter);\n\n let filterCrudMethods: ReturnType<typeof createFilterCrudMethods> | undefined;\n container.registerFactory(AcoFilterCrud, () => {\n if (!filterCrudMethods) {\n filterCrudMethods = createFilterCrudMethods({\n container,\n getTenant,\n storageOperations: getStorageOperations(),\n folderLevelPermissions: container.resolve(FolderLevelPermissions)\n });\n }\n return filterCrudMethods;\n });\n\n // The per-tenant folder model is resolved on demand — see FolderModelProvider.\n container.register(FolderModelProvider);\n\n // CMS-entry folder-level-permission decorators, feature-flag gated. These must be\n // registered before any CMS-entry abstraction they wrap is first resolved, which is why\n // they used to sit in a pre-resolver initializer. Register time is strictly earlier and the\n // gate is valid here: the WCP license is refreshed before any feature registers (see\n // registerApiRequestStack).\n if (\n container\n .resolve(FeatureFlags)\n .get()\n .isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n CmsFlpFeature.register(container);\n }\n\n container.register(AcoSchemaFactory);\n container.register(AcoFolderSchemaFactory);\n }\n});\n"],"names":["AcoSchemaFactoryImpl","builder","addAcoBaseSchema","addFilterSchema","staticSchemaKey","AcoSchemaFactory","GraphQLSchemaFactory","AcoFeature","createFeature","container","FolderModel","AcoAiToolsFeature","FilterPrivateModel","FolderLevelPermissionsFeature","CreateFolderFeature","UpdateFolderFeature","DeleteFolderFeature","GetFolderFeature","ListFoldersFeature","ListFolderLevelPermissionsTargetsFeature","GetFolderHierarchyFeature","GetAncestorsFeature","EnsureFolderIsEmptyFeature","ListFlpsFeature","GetFlpFeature","ListFolderAccessFeature","CodeFlpsFeature","FolderCatalogSyncHandlersFeature","NotifyFolderChangeFeature","EnsureFolderIsEmptyOnDeleteFeature","EnsureHcmsFolderIsEmptyOnDeleteFeature","getTenant","TenantContext","storageOperations","getStorageOperations","identityContext","IdentityContext","createFilterOperations","FilterStorageOperations","filterCrudMethods","AcoFilterCrud","createFilterCrudMethods","FolderLevelPermissions","FolderModelProvider","FeatureFlags","CmsFlpFeature","AcoFolderSchemaFactory"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAMA;IAGF,MAAM,QAAQC,OAA8B,EAAkC;QAG1EC,iBAAiBD;QACjBE,gBAAgBF;QAChB,OAAOA;IACX;;aARO,YAAY,GAAGG,gBAAgB;;AAS1C;AAEA,MAAMC,mBAAmBC,qBAAqB,oBAAoB,CAAC;IAC/D,gBAAgBN;IAChB,cAAc,EAAE;AACpB;AAEO,MAAMO,aAAaC,cAAc;IACpC,MAAM;IACN,UAASC,SAAoB;QACzBA,UAAU,QAAQ,CAACC;QACnBC,kBAAkB,QAAQ,CAACF;QAC3BA,UAAU,QAAQ,CAACG;QAInBC,8BAA8B,QAAQ,CAACJ;QACvCK,oBAAoB,QAAQ,CAACL;QAC7BM,oBAAoB,QAAQ,CAACN;QAC7BO,oBAAoB,QAAQ,CAACP;QAC7BQ,iBAAiB,QAAQ,CAACR;QAC1BS,mBAAmB,QAAQ,CAACT;QAC5BU,yCAAyC,QAAQ,CAACV;QAClDW,0BAA0B,QAAQ,CAACX;QACnCY,oBAAoB,QAAQ,CAACZ;QAC7Ba,2BAA2B,QAAQ,CAACb;QACpCc,gBAAgB,QAAQ,CAACd;QACzBe,cAAc,QAAQ,CAACf;QACvBgB,wBAAwB,QAAQ,CAAChB;QAEjCiB,gBAAgB,QAAQ,CAACjB;QAIzBkB,iCAAiC,QAAQ,CAAClB;QAC1CmB,0BAA0B,QAAQ,CAACnB;QACnCoB,mCAAmC,QAAQ,CAACpB;QAC5CqB,uCAAuC,QAAQ,CAACrB;QAKhD,MAAMsB,YAAY,IAActB,UAAU,OAAO,CAACuB,eAAe,SAAS;QAE1E,IAAIC;QACJ,MAAMC,uBAAuB;YACzB,IAAI,CAACD,mBAAmB;gBACpB,MAAME,kBAAkB1B,UAAU,OAAO,CAAC2B;gBAC1CH,oBAAoB;oBAChB,QAAQI,uBAAuB;wBAAEF;wBAAiB1B;oBAAU;gBAChE;YACJ;YACA,OAAOwB;QACX;QAEAxB,UAAU,eAAe,CAAC6B,yBAAyB,IAAMJ,uBAAuB,MAAM;QAEtF,IAAIK;QACJ9B,UAAU,eAAe,CAAC+B,eAAe;YACrC,IAAI,CAACD,mBACDA,oBAAoBE,wBAAwB;gBACxChC;gBACAsB;gBACA,mBAAmBG;gBACnB,wBAAwBzB,UAAU,OAAO,CAACiC;YAC9C;YAEJ,OAAOH;QACX;QAGA9B,UAAU,QAAQ,CAACkC;QAOnB,IACIlC,UACK,OAAO,CAACmC,cACR,GAAG,GACH,SAAS,CAAC,sDAEfC,cAAc,QAAQ,CAACpC;QAG3BA,UAAU,QAAQ,CAACJ;QACnBI,UAAU,QAAQ,CAACqC;IACvB;AACJ"}
@@ -22,7 +22,9 @@ declare class AcoFolderSchemaFactoryImpl implements CoreGraphQLSchemaFactory.Int
22
22
  private identityContext;
23
23
  private tenantContext;
24
24
  constructor(folderModelProvider: FolderModelProvider.Interface, listModels: ListModelsUseCase.Interface, fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface, identityContext: IdentityContext.Interface, tenantContext: TenantContext.Interface);
25
+ getSchemaKey(): Promise<string>;
25
26
  execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder>;
27
+ private loadInputs;
26
28
  }
27
29
  export declare const AcoFolderSchemaFactory: typeof AcoFolderSchemaFactoryImpl & {
28
30
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-graphql/graphql/abstractions.core").ICoreGraphQLSchemaFactory>;
@@ -1,4 +1,5 @@
1
1
  import { GraphQLSchemaPlugin } from "@webiny/api-graphql";
2
+ import { createModelSchemaKey } from "@webiny/api-headless-cms/utils/createModelSchemaKey.js";
2
3
  import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
3
4
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
4
5
  import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
@@ -15,14 +16,18 @@ class AcoFolderSchemaFactoryImpl {
15
16
  this.identityContext = identityContext;
16
17
  this.tenantContext = tenantContext;
17
18
  }
19
+ async getSchemaKey() {
20
+ const inputs = await this.loadInputs();
21
+ if (!inputs) return "Aco/Folder:no-tenant";
22
+ const modelKey = createModelSchemaKey([
23
+ inputs.model
24
+ ], inputs.models);
25
+ return `Aco/Folder:${modelKey}`;
26
+ }
18
27
  async execute(builder) {
19
- if (!this.tenantContext.getTenant()) return builder;
20
- const model = await this.folderModelProvider.get();
21
- const models = await this.identityContext.withoutAuthorization(async ()=>{
22
- const result = await this.listModels.execute();
23
- if (result.isFail()) throw result.error;
24
- return result.value;
25
- });
28
+ const inputs = await this.loadInputs();
29
+ if (!inputs) return builder;
30
+ const { model, models } = inputs;
26
31
  const fieldPlugins = createGraphQLSchemaPluginFromFieldPlugins({
27
32
  models,
28
33
  type: "manage",
@@ -48,6 +53,19 @@ class AcoFolderSchemaFactoryImpl {
48
53
  }
49
54
  return builder;
50
55
  }
56
+ async loadInputs() {
57
+ if (!this.tenantContext.getTenant()) return null;
58
+ const model = await this.folderModelProvider.get();
59
+ const models = await this.identityContext.withoutAuthorization(async ()=>{
60
+ const result = await this.listModels.execute();
61
+ if (result.isFail()) throw result.error;
62
+ return result.value;
63
+ });
64
+ return {
65
+ model,
66
+ models
67
+ };
68
+ }
51
69
  }
52
70
  const AcoFolderSchemaFactory = CoreGraphQLSchemaFactory.createImplementation({
53
71
  implementation: AcoFolderSchemaFactoryImpl,
@@ -1 +1 @@
1
- {"version":3,"file":"AcoFolderSchemaFactory.js","sources":["../src/AcoFolderSchemaFactory.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/api-graphql\";\nimport { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport type { IGraphQLSchemaPlugin } from \"@webiny/api-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { createGraphQLSchemaPluginFromFieldPlugins } from \"@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins.js\";\nimport { FolderModelProvider } from \"~/domain/folder/abstractions.js\";\nimport { createFoldersSchema } from \"~/folder/folder.gql.js\";\n\n/**\n * Builds the dynamic folder GraphQL schema — the `Folder` type's fields are rendered from the\n * tenant's folder model, so the shape differs per tenant.\n *\n * Previously done by `AcoInitializer`, which had to run as a per-request hook before any resolver:\n * it fetched the model, then registered one `CoreGraphQLSchemaFactory` per generated plugin. That\n * indirection is unnecessary — `CoreGraphQLSchemaFactory.execute()` is already awaited by\n * `GraphQLSchemaComposer`, so this factory can be registered once at compose time and do its async\n * work inside `execute()`, at the moment the schema is actually built.\n */\nclass AcoFolderSchemaFactoryImpl implements CoreGraphQLSchemaFactory.Interface {\n constructor(\n private folderModelProvider: FolderModelProvider.Interface,\n private listModels: ListModelsUseCase.Interface,\n private fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface,\n private identityContext: IdentityContext.Interface,\n private tenantContext: TenantContext.Interface\n ) {}\n\n async execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder> {\n // On a fresh project there is no tenant until installation completes, and there is no model\n // to render a schema from. (This is what `isHeadlessCmsReady` checked in the initializer.)\n if (!this.tenantContext.getTenant()) {\n return builder;\n }\n\n const model = await this.folderModelProvider.get();\n\n // The model list feeds `ref` field rendering, so it must be the COMPLETE set — access\n // control filters models by permission, which would otherwise make the generated schema\n // vary by identity. Hence the unauthorized read, exactly as the initializer did.\n const models = await this.identityContext.withoutAuthorization(async () => {\n const result = await this.listModels.execute();\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n\n const fieldPlugins = createGraphQLSchemaPluginFromFieldPlugins({\n models,\n type: \"manage\",\n fieldRegistry: this.fieldRegistry,\n createPlugin: ({ schema, type, fieldType }) => {\n const plugin = new GraphQLSchemaPlugin(schema);\n plugin.name = `aco.graphql.folder.schema.${type}.field.${fieldType}`;\n return plugin;\n }\n });\n\n const folderPlugin = createFoldersSchema({\n model,\n models,\n fieldRegistry: this.fieldRegistry\n });\n\n for (const plugin of [...fieldPlugins, folderPlugin] as IGraphQLSchemaPlugin[]) {\n if (plugin.schema.typeDefs) {\n builder.addTypeDefs(plugin.schema.typeDefs);\n }\n if (plugin.schema.resolvers) {\n builder.addLegacyResolvers(plugin.schema.resolvers as Record<string, any>);\n }\n if (plugin.schema.resolverDecorators) {\n for (const [path, decorators] of Object.entries(plugin.schema.resolverDecorators)) {\n for (const decorator of decorators as any[]) {\n builder.addResolverDecorator(path, decorator);\n }\n }\n }\n }\n\n return builder;\n }\n}\n\nexport const AcoFolderSchemaFactory = CoreGraphQLSchemaFactory.createImplementation({\n implementation: AcoFolderSchemaFactoryImpl,\n dependencies: [\n FolderModelProvider,\n ListModelsUseCase,\n CmsModelFieldToGraphQLRegistry,\n IdentityContext,\n TenantContext\n ]\n});\n"],"names":["AcoFolderSchemaFactoryImpl","folderModelProvider","listModels","fieldRegistry","identityContext","tenantContext","builder","model","models","result","fieldPlugins","createGraphQLSchemaPluginFromFieldPlugins","schema","type","fieldType","plugin","GraphQLSchemaPlugin","folderPlugin","createFoldersSchema","path","decorators","Object","decorator","AcoFolderSchemaFactory","CoreGraphQLSchemaFactory","FolderModelProvider","ListModelsUseCase","CmsModelFieldToGraphQLRegistry","IdentityContext","TenantContext"],"mappings":";;;;;;;;;AAsBA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,UAAuC,EACvCC,aAAuD,EACvDC,eAA0C,EAC1CC,aAAsC,CAChD;aALUJ,mBAAmB,GAAnBA;aACAC,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,eAAe,GAAfA;aACAC,aAAa,GAAbA;IACT;IAEH,MAAM,QAAQC,OAA8B,EAAkC;QAG1E,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,IAC7B,OAAOA;QAGX,MAAMC,QAAQ,MAAM,IAAI,CAAC,mBAAmB,CAAC,GAAG;QAKhD,MAAMC,SAAS,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC;YAC3D,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;YAC5C,IAAIA,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;YAEtB,OAAOA,OAAO,KAAK;QACvB;QAEA,MAAMC,eAAeC,0CAA0C;YAC3DH;YACA,MAAM;YACN,eAAe,IAAI,CAAC,aAAa;YACjC,cAAc,CAAC,EAAEI,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAE;gBACtC,MAAMC,SAAS,IAAIC,oBAAoBJ;gBACvCG,OAAO,IAAI,GAAG,CAAC,0BAA0B,EAAEF,KAAK,OAAO,EAAEC,WAAW;gBACpE,OAAOC;YACX;QACJ;QAEA,MAAME,eAAeC,oBAAoB;YACrCX;YACAC;YACA,eAAe,IAAI,CAAC,aAAa;QACrC;QAEA,KAAK,MAAMO,UAAU;eAAIL;YAAcO;SAAa,CAA4B;YAC5E,IAAIF,OAAO,MAAM,CAAC,QAAQ,EACtBT,QAAQ,WAAW,CAACS,OAAO,MAAM,CAAC,QAAQ;YAE9C,IAAIA,OAAO,MAAM,CAAC,SAAS,EACvBT,QAAQ,kBAAkB,CAACS,OAAO,MAAM,CAAC,SAAS;YAEtD,IAAIA,OAAO,MAAM,CAAC,kBAAkB,EAChC,KAAK,MAAM,CAACI,MAAMC,WAAW,IAAIC,OAAO,OAAO,CAACN,OAAO,MAAM,CAAC,kBAAkB,EAC5E,KAAK,MAAMO,aAAaF,WACpBd,QAAQ,oBAAoB,CAACa,MAAMG;QAInD;QAEA,OAAOhB;IACX;AACJ;AAEO,MAAMiB,yBAAyBC,yBAAyB,oBAAoB,CAAC;IAChF,gBAAgBxB;IAChB,cAAc;QACVyB;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
1
+ {"version":3,"file":"AcoFolderSchemaFactory.js","sources":["../src/AcoFolderSchemaFactory.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/api-graphql\";\nimport { createModelSchemaKey } from \"@webiny/api-headless-cms/utils/createModelSchemaKey.js\";\nimport { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport type { IGraphQLSchemaPlugin } from \"@webiny/api-graphql/plugins/GraphQLSchemaPlugin.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { createGraphQLSchemaPluginFromFieldPlugins } from \"@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins.js\";\nimport { FolderModelProvider } from \"~/domain/folder/abstractions.js\";\nimport { createFoldersSchema } from \"~/folder/folder.gql.js\";\n\n/**\n * Builds the dynamic folder GraphQL schema — the `Folder` type's fields are rendered from the\n * tenant's folder model, so the shape differs per tenant.\n *\n * Previously done by `AcoInitializer`, which had to run as a per-request hook before any resolver:\n * it fetched the model, then registered one `CoreGraphQLSchemaFactory` per generated plugin. That\n * indirection is unnecessary — `CoreGraphQLSchemaFactory.execute()` is already awaited by\n * `GraphQLSchemaComposer`, so this factory can be registered once at compose time and do its async\n * work inside `execute()`, at the moment the schema is actually built.\n */\nclass AcoFolderSchemaFactoryImpl implements CoreGraphQLSchemaFactory.Interface {\n constructor(\n private folderModelProvider: FolderModelProvider.Interface,\n private listModels: ListModelsUseCase.Interface,\n private fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface,\n private identityContext: IdentityContext.Interface,\n private tenantContext: TenantContext.Interface\n ) {}\n\n async getSchemaKey(): Promise<string> {\n const inputs = await this.loadInputs();\n if (!inputs) {\n return \"Aco/Folder:no-tenant\";\n }\n\n const modelKey = createModelSchemaKey([inputs.model], inputs.models);\n return `Aco/Folder:${modelKey}`;\n }\n\n async execute(builder: IGraphQLSchemaBuilder): Promise<IGraphQLSchemaBuilder> {\n const inputs = await this.loadInputs();\n if (!inputs) {\n return builder;\n }\n\n const { model, models } = inputs;\n\n const fieldPlugins = createGraphQLSchemaPluginFromFieldPlugins({\n models,\n type: \"manage\",\n fieldRegistry: this.fieldRegistry,\n createPlugin: ({ schema, type, fieldType }) => {\n const plugin = new GraphQLSchemaPlugin(schema);\n plugin.name = `aco.graphql.folder.schema.${type}.field.${fieldType}`;\n return plugin;\n }\n });\n\n const folderPlugin = createFoldersSchema({\n model,\n models,\n fieldRegistry: this.fieldRegistry\n });\n\n for (const plugin of [...fieldPlugins, folderPlugin] as IGraphQLSchemaPlugin[]) {\n if (plugin.schema.typeDefs) {\n builder.addTypeDefs(plugin.schema.typeDefs);\n }\n if (plugin.schema.resolvers) {\n builder.addLegacyResolvers(plugin.schema.resolvers as Record<string, any>);\n }\n if (plugin.schema.resolverDecorators) {\n for (const [path, decorators] of Object.entries(plugin.schema.resolverDecorators)) {\n for (const decorator of decorators as any[]) {\n builder.addResolverDecorator(path, decorator);\n }\n }\n }\n }\n\n return builder;\n }\n\n private async loadInputs() {\n // On a fresh project there is no tenant until installation completes, and there is no model\n // to render a schema from. (This is what `isHeadlessCmsReady` checked in the initializer.)\n if (!this.tenantContext.getTenant()) {\n return null;\n }\n\n const model = await this.folderModelProvider.get();\n\n // The model list feeds `ref` field rendering, so it must be the COMPLETE set — access\n // control filters models by permission, which would otherwise make the generated schema\n // vary by identity. Hence the unauthorized read, exactly as the initializer did.\n const models = await this.identityContext.withoutAuthorization(async () => {\n const result = await this.listModels.execute();\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n\n return { model, models };\n }\n}\n\nexport const AcoFolderSchemaFactory = CoreGraphQLSchemaFactory.createImplementation({\n implementation: AcoFolderSchemaFactoryImpl,\n dependencies: [\n FolderModelProvider,\n ListModelsUseCase,\n CmsModelFieldToGraphQLRegistry,\n IdentityContext,\n TenantContext\n ]\n});\n"],"names":["AcoFolderSchemaFactoryImpl","folderModelProvider","listModels","fieldRegistry","identityContext","tenantContext","inputs","modelKey","createModelSchemaKey","builder","model","models","fieldPlugins","createGraphQLSchemaPluginFromFieldPlugins","schema","type","fieldType","plugin","GraphQLSchemaPlugin","folderPlugin","createFoldersSchema","path","decorators","Object","decorator","result","AcoFolderSchemaFactory","CoreGraphQLSchemaFactory","FolderModelProvider","ListModelsUseCase","CmsModelFieldToGraphQLRegistry","IdentityContext","TenantContext"],"mappings":";;;;;;;;;;AAuBA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,UAAuC,EACvCC,aAAuD,EACvDC,eAA0C,EAC1CC,aAAsC,CAChD;aALUJ,mBAAmB,GAAnBA;aACAC,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,eAAe,GAAfA;aACAC,aAAa,GAAbA;IACT;IAEH,MAAM,eAAgC;QAClC,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU;QACpC,IAAI,CAACA,QACD,OAAO;QAGX,MAAMC,WAAWC,qBAAqB;YAACF,OAAO,KAAK;SAAC,EAAEA,OAAO,MAAM;QACnE,OAAO,CAAC,WAAW,EAAEC,UAAU;IACnC;IAEA,MAAM,QAAQE,OAA8B,EAAkC;QAC1E,MAAMH,SAAS,MAAM,IAAI,CAAC,UAAU;QACpC,IAAI,CAACA,QACD,OAAOG;QAGX,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGL;QAE1B,MAAMM,eAAeC,0CAA0C;YAC3DF;YACA,MAAM;YACN,eAAe,IAAI,CAAC,aAAa;YACjC,cAAc,CAAC,EAAEG,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAE;gBACtC,MAAMC,SAAS,IAAIC,oBAAoBJ;gBACvCG,OAAO,IAAI,GAAG,CAAC,0BAA0B,EAAEF,KAAK,OAAO,EAAEC,WAAW;gBACpE,OAAOC;YACX;QACJ;QAEA,MAAME,eAAeC,oBAAoB;YACrCV;YACAC;YACA,eAAe,IAAI,CAAC,aAAa;QACrC;QAEA,KAAK,MAAMM,UAAU;eAAIL;YAAcO;SAAa,CAA4B;YAC5E,IAAIF,OAAO,MAAM,CAAC,QAAQ,EACtBR,QAAQ,WAAW,CAACQ,OAAO,MAAM,CAAC,QAAQ;YAE9C,IAAIA,OAAO,MAAM,CAAC,SAAS,EACvBR,QAAQ,kBAAkB,CAACQ,OAAO,MAAM,CAAC,SAAS;YAEtD,IAAIA,OAAO,MAAM,CAAC,kBAAkB,EAChC,KAAK,MAAM,CAACI,MAAMC,WAAW,IAAIC,OAAO,OAAO,CAACN,OAAO,MAAM,CAAC,kBAAkB,EAC5E,KAAK,MAAMO,aAAaF,WACpBb,QAAQ,oBAAoB,CAACY,MAAMG;QAInD;QAEA,OAAOf;IACX;IAEA,MAAc,aAAa;QAGvB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS,IAC7B,OAAO;QAGX,MAAMC,QAAQ,MAAM,IAAI,CAAC,mBAAmB,CAAC,GAAG;QAKhD,MAAMC,SAAS,MAAM,IAAI,CAAC,eAAe,CAAC,oBAAoB,CAAC;YAC3D,MAAMc,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO;YAC5C,IAAIA,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;YAEtB,OAAOA,OAAO,KAAK;QACvB;QAEA,OAAO;YAAEf;YAAOC;QAAO;IAC3B;AACJ;AAEO,MAAMe,yBAAyBC,yBAAyB,oBAAoB,CAAC;IAChF,gBAAgB3B;IAChB,cAAc;QACV4B;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -5,7 +5,8 @@ class FolderPrivateModelImpl {
5
5
  return [
6
6
  builder.private({
7
7
  modelId: FOLDER_MODEL_ID,
8
- name: "ACO - Folder"
8
+ name: "ACO - Folder",
9
+ lifecycleEvents: false
9
10
  }).fields((fields)=>({
10
11
  title: fields.text().label("Title").required("Value is required."),
11
12
  slug: fields.text().label("Slug").required("Value is required.").pattern("^[a-z0-9]+(-[a-z0-9]+)*$", "g", "Value must consist of only 'a-z', '0-9' and '-'."),
@@ -1 +1 @@
1
- {"version":3,"file":"domain/folder/folder.model.js","sources":["../../../src/domain/folder/folder.model.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\n\nexport const FOLDER_MODEL_ID = process.env.WEBINY_API_LEGACY_MODELS ? \"acoFolder\" : \"wbyAcoFolder\";\n\nclass FolderPrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: FOLDER_MODEL_ID,\n name: \"ACO - Folder\"\n })\n .fields(fields => ({\n title: fields.text().label(\"Title\").required(\"Value is required.\"),\n slug: fields\n .text()\n .label(\"Slug\")\n .required(\"Value is required.\")\n .pattern(\n \"^[a-z0-9]+(-[a-z0-9]+)*$\",\n \"g\",\n \"Value must consist of only 'a-z', '0-9' and '-'.\"\n ),\n type: fields.text().label(\"Type\").required(\"Value is required.\"),\n parentId: fields.text().label(\"Parent Id\"),\n path: fields.text().label(\"Path\"),\n permissions: fields\n .object()\n .label(\"Permissions\")\n .list()\n .fields(fields => ({\n target: fields.text().label(\"Target\").required(\"Value is required.\"),\n level: fields\n .text()\n .label(\"Level\")\n .required(\"Value is required.\")\n .predefinedValues([\n {\n label: \"Viewer\",\n value: \"viewer\"\n },\n {\n label: \"Editor\",\n value: \"editor\"\n },\n {\n label: \"Owner\",\n value: \"owner\"\n },\n {\n label: \"Public\",\n value: \"public\"\n },\n {\n label: \"No Access\",\n value: \"no-access\"\n }\n ])\n }))\n .layout([[\"target\"], [\"level\"]]),\n extensions: fields.object().label(\"Extensions\")\n }))\n ];\n }\n}\n\nexport const FolderModel = ModelFactory.createImplementation({\n implementation: FolderPrivateModelImpl,\n dependencies: []\n});\n"],"names":["FOLDER_MODEL_ID","process","FolderPrivateModelImpl","builder","fields","FolderModel","ModelFactory"],"mappings":";AAEO,MAAMA,kBAAkBC,QAAQ,GAAG,CAAC,wBAAwB,GAAG,cAAc;AAEpF,MAAMC;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASH;gBACT,MAAM;YACV,GACC,MAAM,CAACI,CAAAA,SAAW;oBACf,OAAOA,OAAO,IAAI,GAAG,KAAK,CAAC,SAAS,QAAQ,CAAC;oBAC7C,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,QACN,QAAQ,CAAC,sBACT,OAAO,CACJ,4BACA,KACA;oBAER,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ,CAAC;oBAC3C,UAAUA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC9B,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC1B,aAAaA,OACR,MAAM,GACN,KAAK,CAAC,eACN,IAAI,GACJ,MAAM,CAACA,CAAAA,SAAW;4BACf,QAAQA,OAAO,IAAI,GAAG,KAAK,CAAC,UAAU,QAAQ,CAAC;4BAC/C,OAAOA,OACF,IAAI,GACJ,KAAK,CAAC,SACN,QAAQ,CAAC,sBACT,gBAAgB,CAAC;gCACd;oCACI,OAAO;oCACP,OAAO;gCACX;gCACA;oCACI,OAAO;oCACP,OAAO;gCACX;gCACA;oCACI,OAAO;oCACP,OAAO;gCACX;gCACA;oCACI,OAAO;oCACP,OAAO;gCACX;gCACA;oCACI,OAAO;oCACP,OAAO;gCACX;6BACH;wBACT,IACC,MAAM,CAAC;wBAAC;4BAAC;yBAAS;wBAAE;4BAAC;yBAAQ;qBAAC;oBACnC,YAAYA,OAAO,MAAM,GAAG,KAAK,CAAC;gBACtC;SACP;IACL;AACJ;AAEO,MAAMC,cAAcC,aAAa,oBAAoB,CAAC;IACzD,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
1
+ {"version":3,"file":"domain/folder/folder.model.js","sources":["../../../src/domain/folder/folder.model.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\n\nexport const FOLDER_MODEL_ID = process.env.WEBINY_API_LEGACY_MODELS ? \"acoFolder\" : \"wbyAcoFolder\";\n\nclass FolderPrivateModelImpl implements ModelFactory.Interface {\n public async execute(builder: ModelFactory.Builder) {\n return [\n builder\n .private({\n modelId: FOLDER_MODEL_ID,\n name: \"ACO - Folder\",\n lifecycleEvents: false\n })\n .fields(fields => ({\n title: fields.text().label(\"Title\").required(\"Value is required.\"),\n slug: fields\n .text()\n .label(\"Slug\")\n .required(\"Value is required.\")\n .pattern(\n \"^[a-z0-9]+(-[a-z0-9]+)*$\",\n \"g\",\n \"Value must consist of only 'a-z', '0-9' and '-'.\"\n ),\n type: fields.text().label(\"Type\").required(\"Value is required.\"),\n parentId: fields.text().label(\"Parent Id\"),\n path: fields.text().label(\"Path\"),\n permissions: fields\n .object()\n .label(\"Permissions\")\n .list()\n .fields(fields => ({\n target: fields.text().label(\"Target\").required(\"Value is required.\"),\n level: fields\n .text()\n .label(\"Level\")\n .required(\"Value is required.\")\n .predefinedValues([\n {\n label: \"Viewer\",\n value: \"viewer\"\n },\n {\n label: \"Editor\",\n value: \"editor\"\n },\n {\n label: \"Owner\",\n value: \"owner\"\n },\n {\n label: \"Public\",\n value: \"public\"\n },\n {\n label: \"No Access\",\n value: \"no-access\"\n }\n ])\n }))\n .layout([[\"target\"], [\"level\"]]),\n extensions: fields.object().label(\"Extensions\")\n }))\n ];\n }\n}\n\nexport const FolderModel = ModelFactory.createImplementation({\n implementation: FolderPrivateModelImpl,\n dependencies: []\n});\n"],"names":["FOLDER_MODEL_ID","process","FolderPrivateModelImpl","builder","fields","FolderModel","ModelFactory"],"mappings":";AAEO,MAAMA,kBAAkBC,QAAQ,GAAG,CAAC,wBAAwB,GAAG,cAAc;AAEpF,MAAMC;IACF,MAAa,QAAQC,OAA6B,EAAE;QAChD,OAAO;YACHA,QACK,OAAO,CAAC;gBACL,SAASH;gBACT,MAAM;gBACN,iBAAiB;YACrB,GACC,MAAM,CAACI,CAAAA,SAAW;oBACf,OAAOA,OAAO,IAAI,GAAG,KAAK,CAAC,SAAS,QAAQ,CAAC;oBAC7C,MAAMA,OACD,IAAI,GACJ,KAAK,CAAC,QACN,QAAQ,CAAC,sBACT,OAAO,CACJ,4BACA,KACA;oBAER,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC,QAAQ,QAAQ,CAAC;oBAC3C,UAAUA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC9B,MAAMA,OAAO,IAAI,GAAG,KAAK,CAAC;oBAC1B,aAAaA,OACR,MAAM,GACN,KAAK,CAAC,eACN,IAAI,GACJ,MAAM,CAACA,CAAAA,SAAW;4BACf,QAAQA,OAAO,IAAI,GAAG,KAAK,CAAC,UAAU,QAAQ,CAAC;4BAC/C,OAAOA,OACF,IAAI,GACJ,KAAK,CAAC,SACN,QAAQ,CAAC,sBACT,gBAAgB,CAAC;gCACd;oCACI,OAAO;oCACP,OAAO;gCACX;gCACA;oCACI,OAAO;oCACP,OAAO;gCACX;gCACA;oCACI,OAAO;oCACP,OAAO;gCACX;gCACA;oCACI,OAAO;oCACP,OAAO;gCACX;gCACA;oCACI,OAAO;oCACP,OAAO;gCACX;6BACH;wBACT,IACC,MAAM,CAAC;wBAAC;4BAAC;yBAAS;wBAAE;4BAAC;yBAAQ;qBAAC;oBACnC,YAAYA,OAAO,MAAM,GAAG,KAAK,CAAC;gBACtC;SACP;IACL;AACJ;AAEO,MAAMC,cAAcC,aAAa,oBAAoB,CAAC;IACzD,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
@@ -1,6 +1,6 @@
1
- export { CreateFlpUseCase } from "../../../features/flp/CreateFlp/abstractions.js";
2
- export { DeleteFlpUseCase } from "../../../features/flp/DeleteFlp/abstractions.js";
1
+ export { FlpFactory } from "../../../features/flp/shared/abstractions.js";
3
2
  export { FolderLevelPermissions } from "../../../features/flp/FolderLevelPermissions/abstractions.js";
4
3
  export { GetFlpUseCase } from "../../../features/flp/GetFlp/abstractions.js";
5
4
  export { ListFlpsUseCase } from "../../../features/flp/ListFlps/abstractions.js";
6
- export { UpdateFlpUseCase } from "../../../features/flp/UpdateFlp/abstractions.js";
5
+ export { ListFolderAccessUseCase, ListEntryAccessUseCase, ListUserFolderAccessUseCase, GetUserFolderAccessUseCase, GetUserEntryAccessUseCase } from "../../../features/flp/ListFolderAccess/abstractions.js";
6
+ export type { FolderAccess, FolderAccessUser, FolderAccessTeam, UserFolderAccess, UserFolderAccessFolder, UserAccessCheck } from "../../../features/flp/ListFolderAccess/abstractions.js";
@@ -1,6 +1,5 @@
1
- export { CreateFlpUseCase } from "../../../features/flp/CreateFlp/abstractions.js";
2
- export { DeleteFlpUseCase } from "../../../features/flp/DeleteFlp/abstractions.js";
1
+ export { FlpFactory } from "../../../features/flp/shared/abstractions.js";
3
2
  export { FolderLevelPermissions } from "../../../features/flp/FolderLevelPermissions/abstractions.js";
4
3
  export { GetFlpUseCase } from "../../../features/flp/GetFlp/abstractions.js";
5
4
  export { ListFlpsUseCase } from "../../../features/flp/ListFlps/abstractions.js";
6
- export { UpdateFlpUseCase } from "../../../features/flp/UpdateFlp/abstractions.js";
5
+ export { GetUserEntryAccessUseCase, GetUserFolderAccessUseCase, ListEntryAccessUseCase, ListFolderAccessUseCase, ListUserFolderAccessUseCase } from "../../../features/flp/ListFolderAccess/abstractions.js";
@@ -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 { CreateFolderUseCase } from "../../features/folder/CreateFolder/index.js";
4
4
  declare const inputSchema: z.ZodObject<{
5
5
  title: z.ZodString;
@@ -15,14 +15,18 @@ interface CreatedFolder {
15
15
  path: string;
16
16
  type: string;
17
17
  }
18
+ declare class CreateFolderToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
19
+ private createFolder;
20
+ constructor(createFolder: CreateFolderUseCase.Interface);
21
+ execute(input: Input): Promise<CreatedFolder>;
22
+ }
18
23
  /**
19
24
  * Creates a folder.
20
25
  *
21
26
  * Additive and reversible, so it is not flagged destructive — but it still changes the project, so it
22
27
  * is not read-only either and therefore needs the user to approve the exact arguments.
23
28
  */
24
- declare class CreateFolderToolImpl implements IAiSdkTool<Input> {
25
- private createFolder;
29
+ declare class CreateFolderToolImpl implements AiSdkToolDefinition.Interface<Input> {
26
30
  readonly name = "createFolder";
27
31
  readonly title = "Create folder";
28
32
  readonly description = "Creates a folder in the File Manager ('FmFile') or under a content model ('cms:<modelId>'). Call listFolders first to pick a parent, or omit parentId for the root. Requires user approval.";
@@ -35,10 +39,11 @@ declare class CreateFolderToolImpl implements IAiSdkTool<Input> {
35
39
  readonly annotations: {
36
40
  readOnlyHint: boolean;
37
41
  };
38
- constructor(createFolder: CreateFolderUseCase.Interface);
39
- execute(input: Input): Promise<CreatedFolder>;
42
+ readonly handler: typeof CreateFolderToolHandlerImpl & {
43
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
44
+ };
40
45
  }
41
46
  export declare const CreateFolderTool: typeof CreateFolderToolImpl & {
42
- __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
47
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
43
48
  };
44
49
  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 { CreateFolderUseCase } from "../folder/CreateFolder/index.js";
4
4
  const inputSchema = z.object({
5
5
  title: z.string().describe("Human-readable folder name, e.g. 'Marketing'."),
@@ -7,16 +7,9 @@ const inputSchema = z.object({
7
7
  type: z.string().describe("Folder namespace: 'FmFile' for File Manager, or 'cms:<modelId>' for a content model's folders."),
8
8
  parentId: z.string().optional().describe("Id of the parent folder. Omit to create at the root of that namespace.")
9
9
  });
10
- class CreateFolderToolImpl {
10
+ class CreateFolderToolHandlerImpl {
11
11
  constructor(createFolder){
12
12
  this.createFolder = createFolder;
13
- this.name = "createFolder";
14
- this.title = "Create folder";
15
- this.description = "Creates a folder in the File Manager ('FmFile') or under a content model ('cms:<modelId>'). Call listFolders first to pick a parent, or omit parentId for the root. Requires user approval.";
16
- this.inputSchema = inputSchema;
17
- this.annotations = {
18
- readOnlyHint: false
19
- };
20
13
  }
21
14
  async execute(input) {
22
15
  const params = {
@@ -38,12 +31,28 @@ class CreateFolderToolImpl {
38
31
  };
39
32
  }
40
33
  }
41
- const CreateFolderTool = AiSdkTool.createImplementation({
42
- implementation: CreateFolderToolImpl,
34
+ const CreateFolderToolHandler = AiSdkToolHandler.createImplementation({
35
+ implementation: CreateFolderToolHandlerImpl,
43
36
  dependencies: [
44
37
  CreateFolderUseCase
45
38
  ]
46
39
  });
40
+ class CreateFolderToolImpl {
41
+ constructor(){
42
+ this.name = "createFolder";
43
+ this.title = "Create folder";
44
+ this.description = "Creates a folder in the File Manager ('FmFile') or under a content model ('cms:<modelId>'). Call listFolders first to pick a parent, or omit parentId for the root. Requires user approval.";
45
+ this.inputSchema = inputSchema;
46
+ this.annotations = {
47
+ readOnlyHint: false
48
+ };
49
+ this.handler = CreateFolderToolHandler;
50
+ }
51
+ }
52
+ const CreateFolderTool = AiSdkToolDefinition.createImplementation({
53
+ implementation: CreateFolderToolImpl,
54
+ dependencies: []
55
+ });
47
56
  export { CreateFolderTool };
48
57
 
49
58
  //# sourceMappingURL=CreateFolderTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/CreateFolderTool.js","sources":["../../../src/features/ai/CreateFolderTool.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 { CreateFolderUseCase } from \"~/features/folder/CreateFolder/index.js\";\n\nconst inputSchema = z.object({\n title: z.string().describe(\"Human-readable folder name, e.g. 'Marketing'.\"),\n slug: z\n .string()\n .describe(\"URL-safe identifier, e.g. 'marketing'. Lowercase, hyphens instead of spaces.\"),\n type: z\n .string()\n .describe(\n \"Folder namespace: 'FmFile' for File Manager, or 'cms:<modelId>' for a content model's folders.\"\n ),\n parentId: z\n .string()\n .optional()\n .describe(\"Id of the parent folder. Omit to create at the root of that namespace.\")\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface CreatedFolder {\n id: string;\n title: string;\n slug: string;\n path: string;\n type: string;\n}\n\n/**\n * Creates a folder.\n *\n * Additive and reversible, so it is not flagged destructive — but it still changes the project, so it\n * is not read-only either and therefore needs the user to approve the exact arguments.\n */\nclass CreateFolderToolImpl implements IAiSdkTool<Input> {\n readonly name = \"createFolder\";\n readonly title = \"Create folder\";\n readonly description =\n \"Creates a folder in the File Manager ('FmFile') or under a content model ('cms:<modelId>'). Call listFolders first to pick a parent, or omit parentId for the root. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false };\n\n constructor(private createFolder: CreateFolderUseCase.Interface) {}\n\n async execute(input: Input): Promise<CreatedFolder> {\n const params: {\n title: string;\n slug: string;\n type: string;\n parentId: string | null;\n } = {\n title: input.title,\n slug: input.slug,\n type: input.type,\n parentId: null\n };\n\n if (input.parentId) {\n params.parentId = input.parentId;\n }\n\n const result = await this.createFolder.execute(params);\n\n if (result.isFail()) {\n throw new Error(`Could not create the folder: ${result.error.message}`);\n }\n\n const folder = result.value;\n\n return {\n id: folder.id,\n title: folder.title,\n slug: folder.slug,\n path: folder.path,\n type: folder.type\n };\n }\n}\n\nexport const CreateFolderTool = AiSdkTool.createImplementation({\n implementation: CreateFolderToolImpl,\n dependencies: [CreateFolderUseCase]\n});\n"],"names":["inputSchema","z","CreateFolderToolImpl","createFolder","input","params","result","Error","folder","CreateFolderTool","AiSdkTool","CreateFolderUseCase"],"mappings":";;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,OAAOA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,MAAMA,EAAAA,MACK,GACN,QAAQ,CAAC;IACd,MAAMA,EAAAA,MACK,GACN,QAAQ,CACL;IAER,UAAUA,EAAAA,MACC,GACN,QAAQ,GACR,QAAQ,CAAC;AAClB;AAkBA,MAAMC;IAQF,YAAoBC,YAA2C,CAAE;aAA7CA,YAAY,GAAZA;aAPX,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGH;aACd,WAAW,GAAG;YAAE,cAAc;QAAM;IAEqB;IAElE,MAAM,QAAQI,KAAY,EAA0B;QAChD,MAAMC,SAKF;YACA,OAAOD,MAAM,KAAK;YAClB,MAAMA,MAAM,IAAI;YAChB,MAAMA,MAAM,IAAI;YAChB,UAAU;QACd;QAEA,IAAIA,MAAM,QAAQ,EACdC,OAAO,QAAQ,GAAGD,MAAM,QAAQ;QAGpC,MAAME,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAACD;QAE/C,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,6BAA6B,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAG1E,MAAME,SAASF,OAAO,KAAK;QAE3B,OAAO;YACH,IAAIE,OAAO,EAAE;YACb,OAAOA,OAAO,KAAK;YACnB,MAAMA,OAAO,IAAI;YACjB,MAAMA,OAAO,IAAI;YACjB,MAAMA,OAAO,IAAI;QACrB;IACJ;AACJ;AAEO,MAAMC,mBAAmBC,UAAU,oBAAoB,CAAC;IAC3D,gBAAgBR;IAChB,cAAc;QAACS;KAAoB;AACvC"}
1
+ {"version":3,"file":"features/ai/CreateFolderTool.js","sources":["../../../src/features/ai/CreateFolderTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { CreateFolderUseCase } from \"~/features/folder/CreateFolder/index.js\";\n\nconst inputSchema = z.object({\n title: z.string().describe(\"Human-readable folder name, e.g. 'Marketing'.\"),\n slug: z\n .string()\n .describe(\"URL-safe identifier, e.g. 'marketing'. Lowercase, hyphens instead of spaces.\"),\n type: z\n .string()\n .describe(\n \"Folder namespace: 'FmFile' for File Manager, or 'cms:<modelId>' for a content model's folders.\"\n ),\n parentId: z\n .string()\n .optional()\n .describe(\"Id of the parent folder. Omit to create at the root of that namespace.\")\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface CreatedFolder {\n id: string;\n title: string;\n slug: string;\n path: string;\n type: string;\n}\n\nclass CreateFolderToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private createFolder: CreateFolderUseCase.Interface) {}\n\n async execute(input: Input): Promise<CreatedFolder> {\n const params: {\n title: string;\n slug: string;\n type: string;\n parentId: string | null;\n } = {\n title: input.title,\n slug: input.slug,\n type: input.type,\n parentId: null\n };\n\n if (input.parentId) {\n params.parentId = input.parentId;\n }\n\n const result = await this.createFolder.execute(params);\n\n if (result.isFail()) {\n throw new Error(`Could not create the folder: ${result.error.message}`);\n }\n\n const folder = result.value;\n\n return {\n id: folder.id,\n title: folder.title,\n slug: folder.slug,\n path: folder.path,\n type: folder.type\n };\n }\n}\n\nconst CreateFolderToolHandler = AiSdkToolHandler.createImplementation({\n implementation: CreateFolderToolHandlerImpl,\n dependencies: [CreateFolderUseCase]\n});\n\n/**\n * Creates a folder.\n *\n * Additive and reversible, so it is not flagged destructive — but it still changes the project, so it\n * is not read-only either and therefore needs the user to approve the exact arguments.\n */\nclass CreateFolderToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"createFolder\";\n readonly title = \"Create folder\";\n readonly description =\n \"Creates a folder in the File Manager ('FmFile') or under a content model ('cms:<modelId>'). Call listFolders first to pick a parent, or omit parentId for the root. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false };\n readonly handler = CreateFolderToolHandler;\n}\n\nexport const CreateFolderTool = AiSdkToolDefinition.createImplementation({\n implementation: CreateFolderToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","CreateFolderToolHandlerImpl","createFolder","input","params","result","Error","folder","CreateFolderToolHandler","AiSdkToolHandler","CreateFolderUseCase","CreateFolderToolImpl","CreateFolderTool","AiSdkToolDefinition"],"mappings":";;;AAIA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,OAAOA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC3B,MAAMA,EAAAA,MACK,GACN,QAAQ,CAAC;IACd,MAAMA,EAAAA,MACK,GACN,QAAQ,CACL;IAER,UAAUA,EAAAA,MACC,GACN,QAAQ,GACR,QAAQ,CAAC;AAClB;AAYA,MAAMC;IACF,YAAoBC,YAA2C,CAAE;aAA7CA,YAAY,GAAZA;IAA8C;IAElE,MAAM,QAAQC,KAAY,EAA0B;QAChD,MAAMC,SAKF;YACA,OAAOD,MAAM,KAAK;YAClB,MAAMA,MAAM,IAAI;YAChB,MAAMA,MAAM,IAAI;YAChB,UAAU;QACd;QAEA,IAAIA,MAAM,QAAQ,EACdC,OAAO,QAAQ,GAAGD,MAAM,QAAQ;QAGpC,MAAME,SAAS,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAACD;QAE/C,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIC,MAAM,CAAC,6BAA6B,EAAED,OAAO,KAAK,CAAC,OAAO,EAAE;QAG1E,MAAME,SAASF,OAAO,KAAK;QAE3B,OAAO;YACH,IAAIE,OAAO,EAAE;YACb,OAAOA,OAAO,KAAK;YACnB,MAAMA,OAAO,IAAI;YACjB,MAAMA,OAAO,IAAI;YACjB,MAAMA,OAAO,IAAI;QACrB;IACJ;AACJ;AAEA,MAAMC,0BAA0BC,iBAAiB,oBAAoB,CAAC;IAClE,gBAAgBR;IAChB,cAAc;QAACS;KAAoB;AACvC;AAQA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGZ;aACd,WAAW,GAAG;YAAE,cAAc;QAAM;aACpC,OAAO,GAAGS;;AACvB;AAEO,MAAMI,mBAAmBC,oBAAoB,oBAAoB,CAAC;IACrE,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 { CreateTeam } from "@webiny/api-core/features/security/teams/CreateTeam/index.js";
4
4
  declare const inputSchema: z.ZodObject<{
5
5
  name: z.ZodString;
@@ -14,14 +14,18 @@ interface CreatedTeam {
14
14
  slug: string;
15
15
  roles: string[];
16
16
  }
17
+ declare class CreateTeamToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
18
+ private createTeam;
19
+ constructor(createTeam: CreateTeam.Interface);
20
+ execute(input: Input): Promise<CreatedTeam>;
21
+ }
17
22
  /**
18
23
  * Creates a team.
19
24
  *
20
25
  * Not read-only, so it needs approval: a team is an access-control object, and the roles it carries
21
26
  * decide what its members can do. The user should see which roles are being granted before it exists.
22
27
  */
23
- declare class CreateTeamToolImpl implements IAiSdkTool<Input> {
24
- private createTeam;
28
+ declare class CreateTeamToolImpl implements AiSdkToolDefinition.Interface<Input> {
25
29
  readonly name = "createTeam";
26
30
  readonly title = "Create team";
27
31
  readonly description = "Creates a team with a set of roles. Call listRoles first and pass what it returns; do not guess role identifiers. Requires user approval.";
@@ -34,10 +38,11 @@ declare class CreateTeamToolImpl implements IAiSdkTool<Input> {
34
38
  readonly annotations: {
35
39
  readOnlyHint: boolean;
36
40
  };
37
- constructor(createTeam: CreateTeam.Interface);
38
- execute(input: Input): Promise<CreatedTeam>;
41
+ readonly handler: typeof CreateTeamToolHandlerImpl & {
42
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
43
+ };
39
44
  }
40
45
  export declare const CreateTeamTool: typeof CreateTeamToolImpl & {
41
- __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
46
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
42
47
  };
43
48
  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 { CreateTeam } from "@webiny/api-core/features/security/teams/CreateTeam/index.js";
4
4
  import { descriptionOnCreate } from "@webiny/api-core/features/security/shared/index.js";
5
5
  const inputSchema = z.object({
@@ -8,16 +8,9 @@ const inputSchema = z.object({
8
8
  description: z.string().max(500).optional().describe("What the team is for. Shown in the admin UI. Omit it if the user did not say."),
9
9
  roles: z.array(z.string()).describe("Roles from listRoles. Prefer the `id`; a `slug` is accepted and resolved for you. Resolve them with listRoles first, since an unknown value is rejected rather than stored.")
10
10
  });
11
- class CreateTeamToolImpl {
11
+ class CreateTeamToolHandlerImpl {
12
12
  constructor(createTeam){
13
13
  this.createTeam = createTeam;
14
- this.name = "createTeam";
15
- this.title = "Create team";
16
- this.description = "Creates a team with a set of roles. Call listRoles first and pass what it returns; do not guess role identifiers. Requires user approval.";
17
- this.inputSchema = inputSchema;
18
- this.annotations = {
19
- readOnlyHint: false
20
- };
21
14
  }
22
15
  async execute(input) {
23
16
  const result = await this.createTeam.execute({
@@ -36,12 +29,28 @@ class CreateTeamToolImpl {
36
29
  };
37
30
  }
38
31
  }
39
- const CreateTeamTool = AiSdkTool.createImplementation({
40
- implementation: CreateTeamToolImpl,
32
+ const CreateTeamToolHandler = AiSdkToolHandler.createImplementation({
33
+ implementation: CreateTeamToolHandlerImpl,
41
34
  dependencies: [
42
35
  CreateTeam
43
36
  ]
44
37
  });
38
+ class CreateTeamToolImpl {
39
+ constructor(){
40
+ this.name = "createTeam";
41
+ this.title = "Create team";
42
+ this.description = "Creates a team with a set of roles. Call listRoles first and pass what it returns; do not guess role identifiers. Requires user approval.";
43
+ this.inputSchema = inputSchema;
44
+ this.annotations = {
45
+ readOnlyHint: false
46
+ };
47
+ this.handler = CreateTeamToolHandler;
48
+ }
49
+ }
50
+ const CreateTeamTool = AiSdkToolDefinition.createImplementation({
51
+ implementation: CreateTeamToolImpl,
52
+ dependencies: []
53
+ });
45
54
  export { CreateTeamTool };
46
55
 
47
56
  //# sourceMappingURL=CreateTeamTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/ai/CreateTeamTool.js","sources":["../../../src/features/ai/CreateTeamTool.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 { CreateTeam } from \"@webiny/api-core/features/security/teams/CreateTeam/index.js\";\nimport { descriptionOnCreate } from \"@webiny/api-core/features/security/shared/index.js\";\n\nconst inputSchema = z.object({\n name: z.string().describe(\"Human-readable team name, e.g. 'Marketing'.\"),\n slug: z\n .string()\n .describe(\"URL-safe identifier, e.g. 'marketing'. Lowercase, hyphens instead of spaces.\"),\n /*\n * Optional and capped, mirroring the use case's own schema. Requiring it made the model invent a\n * description for every team; `CreateTeam` treats an absent one as empty via `descriptionOnCreate`.\n */\n description: z\n .string()\n .max(500)\n .optional()\n .describe(\"What the team is for. Shown in the admin UI. Omit it if the user did not say.\"),\n roles: z\n .array(z.string())\n .describe(\n \"Roles from listRoles. Prefer the `id`; a `slug` is accepted and resolved for you. Resolve them with listRoles first, since an unknown value is rejected rather than stored.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface CreatedTeam {\n id: string;\n name: string;\n slug: string;\n roles: string[];\n}\n\n/**\n * Creates a team.\n *\n * Not read-only, so it needs approval: a team is an access-control object, and the roles it carries\n * decide what its members can do. The user should see which roles are being granted before it exists.\n */\nclass CreateTeamToolImpl implements IAiSdkTool<Input> {\n readonly name = \"createTeam\";\n readonly title = \"Create team\";\n readonly description =\n \"Creates a team with a set of roles. Call listRoles first and pass what it returns; do not guess role identifiers. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false };\n\n constructor(private createTeam: CreateTeam.Interface) {}\n\n async execute(input: Input): Promise<CreatedTeam> {\n /*\n * Roles go through untouched. `CreateTeam` accepts a role id or a slug and resolves either to\n * the id a team stores, so the tool has nothing to add: doing it here too would read the roles\n * a second time and leave two copies of the same rule to keep in step.\n */\n const result = await this.createTeam.execute({\n name: input.name,\n slug: input.slug,\n // An omitted description becomes \"\", the same mapping the use case applies to its own input.\n description: descriptionOnCreate(input.description),\n roles: input.roles\n });\n\n if (result.isFail()) {\n throw new Error(`Could not create the team: ${result.error.message}`);\n }\n\n const team = result.value;\n\n return {\n id: team.id,\n name: team.name,\n slug: team.slug,\n // From the created team, so the caller sees the resolved ids that were actually stored.\n roles: team.roles\n };\n }\n}\n\nexport const CreateTeamTool = AiSdkTool.createImplementation({\n implementation: CreateTeamToolImpl,\n dependencies: [CreateTeam]\n});\n"],"names":["inputSchema","z","CreateTeamToolImpl","createTeam","input","result","descriptionOnCreate","Error","team","CreateTeamTool","AiSdkTool","CreateTeam"],"mappings":";;;;AAMA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,MAAMA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,MAAMA,EAAAA,MACK,GACN,QAAQ,CAAC;IAKd,aAAaA,EAAAA,MACF,GACN,GAAG,CAAC,KACJ,QAAQ,GACR,QAAQ,CAAC;IACd,OAAOA,EAAAA,KACG,CAACA,EAAE,MAAM,IACd,QAAQ,CACL;AAEZ;AAiBA,MAAMC;IAQF,YAAoBC,UAAgC,CAAE;aAAlCA,UAAU,GAAVA;aAPX,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGH;aACd,WAAW,GAAG;YAAE,cAAc;QAAM;IAEU;IAEvD,MAAM,QAAQI,KAAY,EAAwB;QAM9C,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACzC,MAAMD,MAAM,IAAI;YAChB,MAAMA,MAAM,IAAI;YAEhB,aAAaE,oBAAoBF,MAAM,WAAW;YAClD,OAAOA,MAAM,KAAK;QACtB;QAEA,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIE,MAAM,CAAC,2BAA2B,EAAEF,OAAO,KAAK,CAAC,OAAO,EAAE;QAGxE,MAAMG,OAAOH,OAAO,KAAK;QAEzB,OAAO;YACH,IAAIG,KAAK,EAAE;YACX,MAAMA,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;YAEf,OAAOA,KAAK,KAAK;QACrB;IACJ;AACJ;AAEO,MAAMC,iBAAiBC,UAAU,oBAAoB,CAAC;IACzD,gBAAgBR;IAChB,cAAc;QAACS;KAAW;AAC9B"}
1
+ {"version":3,"file":"features/ai/CreateTeamTool.js","sources":["../../../src/features/ai/CreateTeamTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition, AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { CreateTeam } from \"@webiny/api-core/features/security/teams/CreateTeam/index.js\";\nimport { descriptionOnCreate } from \"@webiny/api-core/features/security/shared/index.js\";\n\nconst inputSchema = z.object({\n name: z.string().describe(\"Human-readable team name, e.g. 'Marketing'.\"),\n slug: z\n .string()\n .describe(\"URL-safe identifier, e.g. 'marketing'. Lowercase, hyphens instead of spaces.\"),\n /*\n * Optional and capped, mirroring the use case's own schema. Requiring it made the model invent a\n * description for every team; `CreateTeam` treats an absent one as empty via `descriptionOnCreate`.\n */\n description: z\n .string()\n .max(500)\n .optional()\n .describe(\"What the team is for. Shown in the admin UI. Omit it if the user did not say.\"),\n roles: z\n .array(z.string())\n .describe(\n \"Roles from listRoles. Prefer the `id`; a `slug` is accepted and resolved for you. Resolve them with listRoles first, since an unknown value is rejected rather than stored.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface CreatedTeam {\n id: string;\n name: string;\n slug: string;\n roles: string[];\n}\n\nclass CreateTeamToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(private createTeam: CreateTeam.Interface) {}\n\n async execute(input: Input): Promise<CreatedTeam> {\n /*\n * Roles go through untouched. `CreateTeam` accepts a role id or a slug and resolves either to\n * the id a team stores, so the tool has nothing to add: doing it here too would read the roles\n * a second time and leave two copies of the same rule to keep in step.\n */\n const result = await this.createTeam.execute({\n name: input.name,\n slug: input.slug,\n // An omitted description becomes \"\", the same mapping the use case applies to its own input.\n description: descriptionOnCreate(input.description),\n roles: input.roles\n });\n\n if (result.isFail()) {\n throw new Error(`Could not create the team: ${result.error.message}`);\n }\n\n const team = result.value;\n\n return {\n id: team.id,\n name: team.name,\n slug: team.slug,\n // From the created team, so the caller sees the resolved ids that were actually stored.\n roles: team.roles\n };\n }\n}\n\nconst CreateTeamToolHandler = AiSdkToolHandler.createImplementation({\n implementation: CreateTeamToolHandlerImpl,\n dependencies: [CreateTeam]\n});\n\n/**\n * Creates a team.\n *\n * Not read-only, so it needs approval: a team is an access-control object, and the roles it carries\n * decide what its members can do. The user should see which roles are being granted before it exists.\n */\nclass CreateTeamToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"createTeam\";\n readonly title = \"Create team\";\n readonly description =\n \"Creates a team with a set of roles. Call listRoles first and pass what it returns; do not guess role identifiers. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false };\n readonly handler = CreateTeamToolHandler;\n}\n\nexport const CreateTeamTool = AiSdkToolDefinition.createImplementation({\n implementation: CreateTeamToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","CreateTeamToolHandlerImpl","createTeam","input","result","descriptionOnCreate","Error","team","CreateTeamToolHandler","AiSdkToolHandler","CreateTeam","CreateTeamToolImpl","CreateTeamTool","AiSdkToolDefinition"],"mappings":";;;;AAKA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,MAAMA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,MAAMA,EAAAA,MACK,GACN,QAAQ,CAAC;IAKd,aAAaA,EAAAA,MACF,GACN,GAAG,CAAC,KACJ,QAAQ,GACR,QAAQ,CAAC;IACd,OAAOA,EAAAA,KACG,CAACA,EAAE,MAAM,IACd,QAAQ,CACL;AAEZ;AAWA,MAAMC;IACF,YAAoBC,UAAgC,CAAE;aAAlCA,UAAU,GAAVA;IAAmC;IAEvD,MAAM,QAAQC,KAAY,EAAwB;QAM9C,MAAMC,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACzC,MAAMD,MAAM,IAAI;YAChB,MAAMA,MAAM,IAAI;YAEhB,aAAaE,oBAAoBF,MAAM,WAAW;YAClD,OAAOA,MAAM,KAAK;QACtB;QAEA,IAAIC,OAAO,MAAM,IACb,MAAM,IAAIE,MAAM,CAAC,2BAA2B,EAAEF,OAAO,KAAK,CAAC,OAAO,EAAE;QAGxE,MAAMG,OAAOH,OAAO,KAAK;QAEzB,OAAO;YACH,IAAIG,KAAK,EAAE;YACX,MAAMA,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;YAEf,OAAOA,KAAK,KAAK;QACrB;IACJ;AACJ;AAEA,MAAMC,wBAAwBC,iBAAiB,oBAAoB,CAAC;IAChE,gBAAgBR;IAChB,cAAc;QAACS;KAAW;AAC9B;AAQA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGZ;aACd,WAAW,GAAG;YAAE,cAAc;QAAM;aACpC,OAAO,GAAGS;;AACvB;AAEO,MAAMI,iBAAiBC,oBAAoB,oBAAoB,CAAC;IACnE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}