@webiny/api-aco 6.6.0-alpha.1 → 6.6.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AcoFeature.js +14 -36
- package/AcoFeature.js.map +1 -1
- package/AcoFolderSchemaFactory.d.ts +2 -0
- package/AcoFolderSchemaFactory.js +25 -7
- package/AcoFolderSchemaFactory.js.map +1 -1
- package/domain/folder/folder.model.js +2 -1
- package/domain/folder/folder.model.js.map +1 -1
- package/exports/api/aco/flp.d.ts +3 -3
- package/exports/api/aco/flp.js +2 -3
- package/features/ai/CreateFolderTool.d.ts +11 -6
- package/features/ai/CreateFolderTool.js +20 -11
- package/features/ai/CreateFolderTool.js.map +1 -1
- package/features/ai/CreateRoleTool.d.ts +54 -0
- package/features/ai/CreateRoleTool.js +71 -0
- package/features/ai/CreateRoleTool.js.map +1 -0
- package/features/ai/CreateTeamTool.d.ts +11 -6
- package/features/ai/CreateTeamTool.js +20 -11
- package/features/ai/CreateTeamTool.js.map +1 -1
- package/features/ai/DeleteFolderTool.d.ts +48 -0
- package/features/ai/DeleteFolderTool.js +55 -0
- package/features/ai/DeleteFolderTool.js.map +1 -0
- package/features/ai/DeleteRoleTool.d.ts +52 -0
- package/features/ai/DeleteRoleTool.js +79 -0
- package/features/ai/DeleteRoleTool.js.map +1 -0
- package/features/ai/DeleteTeamTool.d.ts +46 -0
- package/features/ai/DeleteTeamTool.js +56 -0
- package/features/ai/DeleteTeamTool.js.map +1 -0
- package/features/ai/GrantFolderAccessTool.d.ts +13 -8
- package/features/ai/GrantFolderAccessTool.js +20 -11
- package/features/ai/GrantFolderAccessTool.js.map +1 -1
- package/features/ai/ListFoldersTool.d.ts +11 -6
- package/features/ai/ListFoldersTool.js +21 -12
- package/features/ai/ListFoldersTool.js.map +1 -1
- package/features/ai/ListRolesTool.d.ts +12 -7
- package/features/ai/ListRolesTool.js +21 -12
- package/features/ai/ListRolesTool.js.map +1 -1
- package/features/ai/ListTeamsTool.d.ts +14 -7
- package/features/ai/ListTeamsTool.js +23 -13
- package/features/ai/ListTeamsTool.js.map +1 -1
- package/features/ai/RevokeFolderAccessTool.d.ts +12 -7
- package/features/ai/RevokeFolderAccessTool.js +21 -12
- package/features/ai/RevokeFolderAccessTool.js.map +1 -1
- package/features/ai/UpdateFolderTool.d.ts +57 -0
- package/features/ai/UpdateFolderTool.js +72 -0
- package/features/ai/UpdateFolderTool.js.map +1 -0
- package/features/ai/UpdateRoleTool.d.ts +46 -0
- package/features/ai/UpdateRoleTool.js +53 -0
- package/features/ai/UpdateRoleTool.js.map +1 -0
- package/features/ai/UpdateTeamTool.d.ts +52 -0
- package/features/ai/UpdateTeamTool.js +56 -0
- package/features/ai/UpdateTeamTool.js.map +1 -0
- package/features/ai/feature.d.ts +2 -2
- package/features/ai/feature.js +14 -0
- package/features/ai/feature.js.map +1 -1
- package/features/ai/index.d.ts +7 -0
- package/features/ai/index.js +7 -0
- package/features/ai/loadFolderPermissions.d.ts +4 -1
- package/features/ai/loadFolderPermissions.js +1 -1
- package/features/ai/loadFolderPermissions.js.map +1 -1
- package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.d.ts +4 -4
- package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js +7 -8
- package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListEntriesWithFlpDecorator.d.ts +3 -3
- package/features/cms/decorators/ListEntriesWithFlpDecorator.js +7 -8
- package/features/cms/decorators/ListEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.d.ts +4 -4
- package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js +7 -8
- package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.d.ts +4 -4
- package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js +7 -8
- package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js.map +1 -1
- package/features/flp/CreateFlp/index.d.ts +0 -1
- package/features/flp/CreateFlp/index.js +0 -1
- package/features/flp/DeleteFlp/index.d.ts +0 -1
- package/features/flp/DeleteFlp/index.js +0 -1
- package/features/flp/FolderAccessListFilter/abstractions.d.ts +33 -0
- package/features/flp/FolderAccessListFilter/abstractions.js +5 -0
- package/features/flp/FolderAccessListFilter/abstractions.js.map +1 -0
- package/features/flp/FolderAccessListFilter/index.d.ts +1 -0
- package/features/flp/FolderAccessListFilter/index.js +1 -0
- package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.d.ts +8 -0
- package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.js +15 -0
- package/features/flp/FolderCatalogSync/FolderCatalogSyncHandlersFeature.js.map +1 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.d.ts +11 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js +19 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderCreatedHandler.js.map +1 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.d.ts +11 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js +19 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderDeletedHandler.js.map +1 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.d.ts +11 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js +23 -0
- package/features/flp/FolderCatalogSync/SyncFolderCatalogOnFolderUpdatedHandler.js.map +1 -0
- package/features/flp/FolderCatalogSync/abstractions.d.ts +25 -0
- package/features/flp/FolderCatalogSync/abstractions.js +5 -0
- package/features/flp/FolderCatalogSync/abstractions.js.map +1 -0
- package/features/flp/FolderCatalogSync/index.d.ts +2 -0
- package/features/flp/FolderCatalogSync/index.js +2 -0
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.d.ts +5 -2
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +19 -5
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.d.ts +1 -0
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js +3 -0
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js.map +1 -1
- package/features/flp/FolderLevelPermissions/abstractions.d.ts +8 -2
- package/features/flp/FolderLevelPermissions/abstractions.js.map +1 -1
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.d.ts +12 -0
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js +22 -14
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js.map +1 -1
- package/features/flp/FolderPermissionsRepository/abstractions.d.ts +28 -0
- package/features/flp/FolderPermissionsRepository/abstractions.js +5 -0
- package/features/flp/FolderPermissionsRepository/abstractions.js.map +1 -0
- package/features/flp/FolderPermissionsRepository/index.d.ts +1 -0
- package/features/flp/FolderPermissionsRepository/index.js +1 -0
- package/features/flp/GetFlp/GetFlpUseCase.d.ts +10 -5
- package/features/flp/GetFlp/GetFlpUseCase.js +13 -5
- package/features/flp/GetFlp/GetFlpUseCase.js.map +1 -1
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.d.ts +13 -0
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js +26 -0
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js.map +1 -0
- package/features/flp/GetFlp/feature.js +1 -3
- package/features/flp/GetFlp/feature.js.map +1 -1
- package/features/flp/ListFlps/ListFlpsUseCase.d.ts +11 -6
- package/features/flp/ListFlps/ListFlpsUseCase.js +13 -5
- package/features/flp/ListFlps/ListFlpsUseCase.js.map +1 -1
- package/features/flp/ListFlps/abstractions.d.ts +3 -9
- package/features/flp/ListFlps/abstractions.js.map +1 -1
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.d.ts +13 -0
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js +27 -0
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js.map +1 -0
- package/features/flp/ListFlps/feature.js +1 -3
- package/features/flp/ListFlps/feature.js.map +1 -1
- package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.d.ts +14 -0
- package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js +36 -0
- package/features/flp/ListFolderAccess/GetUserEntryAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.d.ts +25 -0
- package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js +75 -0
- package/features/flp/ListFolderAccess/GetUserFolderAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/ListEntryAccessUseCase.d.ts +13 -0
- package/features/flp/ListFolderAccess/ListEntryAccessUseCase.js +28 -0
- package/features/flp/ListFolderAccess/ListEntryAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/ListFolderAccessUseCase.d.ts +24 -0
- package/features/flp/ListFolderAccess/ListFolderAccessUseCase.js +107 -0
- package/features/flp/ListFolderAccess/ListFolderAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.d.ts +28 -0
- package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.js +98 -0
- package/features/flp/ListFolderAccess/ListUserFolderAccessUseCase.js.map +1 -0
- package/features/flp/ListFolderAccess/UserFolderCandidates.d.ts +13 -0
- package/features/flp/ListFolderAccess/UserFolderCandidates.js +26 -0
- package/features/flp/ListFolderAccess/UserFolderCandidates.js.map +1 -0
- package/features/flp/ListFolderAccess/abstractions.d.ts +182 -0
- package/features/flp/ListFolderAccess/abstractions.js +10 -0
- package/features/flp/ListFolderAccess/abstractions.js.map +1 -0
- package/features/flp/{CreateFlpOnFolderCreated → ListFolderAccess}/feature.d.ts +1 -1
- package/features/flp/ListFolderAccess/feature.js +21 -0
- package/features/flp/ListFolderAccess/feature.js.map +1 -0
- package/features/flp/ListFolderAccess/index.d.ts +2 -0
- package/features/flp/ListFolderAccess/index.js +2 -0
- package/features/flp/ListFolderAccess/mayAskAboutUser.d.ts +3 -0
- package/features/flp/ListFolderAccess/mayAskAboutUser.js +9 -0
- package/features/flp/ListFolderAccess/mayAskAboutUser.js.map +1 -0
- package/features/flp/ListFolderAccess/userFolderLevel.d.ts +31 -0
- package/features/flp/ListFolderAccess/userFolderLevel.js +48 -0
- package/features/flp/ListFolderAccess/userFolderLevel.js.map +1 -0
- package/features/flp/UpdateFlp/abstractions.d.ts +6 -2
- package/features/flp/UpdateFlp/abstractions.js.map +1 -1
- package/features/flp/UpdateFlp/index.d.ts +0 -1
- package/features/flp/UpdateFlp/index.js +0 -1
- package/features/flp/shared/CodeFlpMerger.d.ts +26 -0
- package/features/flp/shared/CodeFlpMerger.js +20 -0
- package/features/flp/shared/CodeFlpMerger.js.map +1 -0
- package/features/flp/shared/CodeFlpPath.d.ts +15 -0
- package/features/flp/shared/CodeFlpPath.js +29 -0
- package/features/flp/shared/CodeFlpPath.js.map +1 -0
- package/features/flp/shared/CodeFlpTarget.d.ts +10 -0
- package/features/flp/shared/CodeFlpTarget.js +26 -0
- package/features/flp/shared/CodeFlpTarget.js.map +1 -0
- package/features/flp/shared/CodeFlpsProvider.d.ts +15 -0
- package/features/flp/shared/CodeFlpsProvider.js +36 -0
- package/features/flp/shared/CodeFlpsProvider.js.map +1 -0
- package/features/flp/shared/abstractions.d.ts +79 -0
- package/features/flp/shared/abstractions.js +19 -0
- package/features/flp/shared/abstractions.js.map +1 -0
- package/features/flp/shared/feature.d.ts +5 -0
- package/features/flp/shared/feature.js +17 -0
- package/features/flp/shared/feature.js.map +1 -0
- package/features/flp/shared/index.d.ts +4 -0
- package/features/flp/shared/index.js +4 -0
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.d.ts +9 -1
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js +20 -3
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js.map +1 -1
- package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.d.ts +3 -7
- package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js +5 -50
- package/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js.map +1 -1
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.d.ts +11 -0
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js +38 -0
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js.map +1 -0
- package/features/{flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.d.ts → folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.d.ts} +5 -7
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js +24 -0
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js.map +1 -0
- package/features/folder/NotifyFolderChange/abstractions.d.ts +28 -0
- package/features/folder/NotifyFolderChange/abstractions.js +8 -0
- package/features/folder/NotifyFolderChange/abstractions.js.map +1 -0
- package/features/folder/NotifyFolderChange/feature.d.ts +8 -0
- package/features/folder/NotifyFolderChange/feature.js +13 -0
- package/features/folder/NotifyFolderChange/feature.js.map +1 -0
- package/features/folder/NotifyFolderChange/index.d.ts +2 -0
- package/features/folder/NotifyFolderChange/index.js +2 -0
- package/features/folder/UpdateFolder/UpdateFolderUseCase.d.ts +1 -0
- package/features/folder/UpdateFolder/UpdateFolderUseCase.js +13 -0
- package/features/folder/UpdateFolder/UpdateFolderUseCase.js.map +1 -1
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.d.ts +14 -1
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js +54 -4
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js.map +1 -1
- package/filter/filter.model.js +2 -1
- package/filter/filter.model.js.map +1 -1
- package/filter/filter.so.d.ts +0 -2
- package/filter/filter.so.js +20 -8
- package/filter/filter.so.js.map +1 -1
- package/flp/flp.types.d.ts +6 -1
- package/flp/index.d.ts +0 -1
- package/flp/index.js +0 -1
- package/flpTaskCatalog/CatalogFolderPermissionsRepository.d.ts +17 -0
- package/flpTaskCatalog/CatalogFolderPermissionsRepository.js +34 -0
- package/flpTaskCatalog/CatalogFolderPermissionsRepository.js.map +1 -0
- package/flpTaskCatalog/PostLoadFolderAccessListFilter.d.ts +24 -0
- package/flpTaskCatalog/PostLoadFolderAccessListFilter.js +63 -0
- package/flpTaskCatalog/PostLoadFolderAccessListFilter.js.map +1 -0
- package/flpTaskCatalog/TaskCatalogFlpFeature.d.ts +12 -0
- package/flpTaskCatalog/TaskCatalogFlpFeature.js +49 -0
- package/flpTaskCatalog/TaskCatalogFlpFeature.js.map +1 -0
- package/flpTaskCatalog/TaskFolderCatalogSync.d.ts +29 -0
- package/flpTaskCatalog/TaskFolderCatalogSync.js +57 -0
- package/flpTaskCatalog/TaskFolderCatalogSync.js.map +1 -0
- package/{flp → flpTaskCatalog}/flp.crud.d.ts +1 -1
- package/flpTaskCatalog/flp.crud.js.map +1 -0
- package/flpTaskCatalog/index.d.ts +1 -0
- package/flpTaskCatalog/index.js +1 -0
- package/{utils/decorators → flpTaskCatalog/listEntries}/ListEntriesFactory.d.ts +1 -1
- package/flpTaskCatalog/listEntries/ListEntriesFactory.js.map +1 -0
- package/flpTaskCatalog/listEntries/hasRootFolderId.js.map +1 -0
- package/{utils/decorators → flpTaskCatalog/listEntries}/isPageModel.js +1 -1
- package/flpTaskCatalog/listEntries/isPageModel.js.map +1 -0
- package/flpTaskCatalog/tasks/createFlp.task.d.ts +25 -0
- package/{flp → flpTaskCatalog}/tasks/createFlp.task.js +34 -17
- package/flpTaskCatalog/tasks/createFlp.task.js.map +1 -0
- package/flpTaskCatalog/tasks/deleteFlp.task.d.ts +23 -0
- package/{flp → flpTaskCatalog}/tasks/deleteFlp.task.js +24 -15
- package/flpTaskCatalog/tasks/deleteFlp.task.js.map +1 -0
- package/{flp → flpTaskCatalog}/tasks/syncFlp.task.d.ts +11 -6
- package/{flp → flpTaskCatalog}/tasks/syncFlp.task.js +45 -29
- package/flpTaskCatalog/tasks/syncFlp.task.js.map +1 -0
- package/flpTaskCatalog/tasks/updateFlp.task.d.ts +25 -0
- package/flpTaskCatalog/tasks/updateFlp.task.js +64 -0
- package/flpTaskCatalog/tasks/updateFlp.task.js.map +1 -0
- package/flpTaskCatalog/useCases/CreateFlpUseCase.d.ts +8 -0
- package/{features/flp/CreateFlp → flpTaskCatalog/useCases}/CreateFlpUseCase.js +1 -1
- package/flpTaskCatalog/useCases/CreateFlpUseCase.js.map +1 -0
- package/flpTaskCatalog/useCases/DeleteFlpUseCase.d.ts +8 -0
- package/flpTaskCatalog/useCases/DeleteFlpUseCase.js.map +1 -0
- package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.d.ts +8 -9
- package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.js +23 -30
- package/flpTaskCatalog/useCases/UpdateFlpUseCase.js.map +1 -0
- package/folder/createFolderTypeDefs.js +4 -1
- package/folder/createFolderTypeDefs.js.map +1 -1
- package/folder/folder.types.d.ts +2 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +21 -22
- package/types.d.ts +2 -3
- package/types.js.map +1 -1
- package/utils/createOperationsWrapper.d.ts +2 -2
- package/utils/createOperationsWrapper.js +5 -5
- package/utils/createOperationsWrapper.js.map +1 -1
- package/features/flp/CreateFlp/CreateFlpUseCase.d.ts +0 -8
- package/features/flp/CreateFlp/CreateFlpUseCase.js.map +0 -1
- package/features/flp/CreateFlp/feature.d.ts +0 -5
- package/features/flp/CreateFlp/feature.js +0 -13
- package/features/flp/CreateFlp/feature.js.map +0 -1
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.d.ts +0 -14
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js +0 -37
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js.map +0 -1
- package/features/flp/CreateFlpOnFolderCreated/feature.js +0 -11
- package/features/flp/CreateFlpOnFolderCreated/feature.js.map +0 -1
- package/features/flp/CreateFlpOnFolderCreated/index.d.ts +0 -1
- package/features/flp/CreateFlpOnFolderCreated/index.js +0 -1
- package/features/flp/DeleteFlp/DeleteFlpUseCase.d.ts +0 -8
- package/features/flp/DeleteFlp/DeleteFlpUseCase.js.map +0 -1
- package/features/flp/DeleteFlp/feature.d.ts +0 -5
- package/features/flp/DeleteFlp/feature.js +0 -13
- package/features/flp/DeleteFlp/feature.js.map +0 -1
- package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js +0 -37
- package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js.map +0 -1
- package/features/flp/DeleteFlpOnFolderDeleted/feature.d.ts +0 -4
- package/features/flp/DeleteFlpOnFolderDeleted/feature.js +0 -11
- package/features/flp/DeleteFlpOnFolderDeleted/feature.js.map +0 -1
- package/features/flp/DeleteFlpOnFolderDeleted/index.d.ts +0 -1
- package/features/flp/DeleteFlpOnFolderDeleted/index.js +0 -1
- package/features/flp/UpdateFlp/UpdateFlpUseCase.js.map +0 -1
- package/features/flp/UpdateFlp/feature.d.ts +0 -5
- package/features/flp/UpdateFlp/feature.js +0 -17
- package/features/flp/UpdateFlp/feature.js.map +0 -1
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.d.ts +0 -14
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js +0 -39
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js.map +0 -1
- package/features/flp/UpdateFlpOnFolderUpdated/feature.d.ts +0 -4
- package/features/flp/UpdateFlpOnFolderUpdated/feature.js +0 -11
- package/features/flp/UpdateFlpOnFolderUpdated/feature.js.map +0 -1
- package/features/flp/UpdateFlpOnFolderUpdated/index.d.ts +0 -1
- package/features/flp/UpdateFlpOnFolderUpdated/index.js +0 -1
- package/flp/flp.crud.js.map +0 -1
- package/flp/tasks/createFlp.task.d.ts +0 -18
- package/flp/tasks/createFlp.task.js.map +0 -1
- package/flp/tasks/deleteFlp.task.d.ts +0 -18
- package/flp/tasks/deleteFlp.task.js.map +0 -1
- package/flp/tasks/syncFlp.task.js.map +0 -1
- package/flp/tasks/updateFlp.task.d.ts +0 -18
- package/flp/tasks/updateFlp.task.js +0 -43
- package/flp/tasks/updateFlp.task.js.map +0 -1
- package/utils/decorators/CmsEntriesCrudDecorators.d.ts +0 -11
- package/utils/decorators/CmsEntriesCrudDecorators.js +0 -179
- package/utils/decorators/CmsEntriesCrudDecorators.js.map +0 -1
- package/utils/decorators/FilterEntriesByFolderFactory.d.ts +0 -7
- package/utils/decorators/FilterEntriesByFolderFactory.js +0 -22
- package/utils/decorators/FilterEntriesByFolderFactory.js.map +0 -1
- package/utils/decorators/ListEntriesFactory.js.map +0 -1
- package/utils/decorators/hasRootFolderId.js.map +0 -1
- package/utils/decorators/isPageModel.js.map +0 -1
- /package/{flp → flpTaskCatalog}/flp.crud.js +0 -0
- /package/{utils/decorators → flpTaskCatalog/listEntries}/ListEntriesFactory.js +0 -0
- /package/{utils/decorators → flpTaskCatalog/listEntries}/hasRootFolderId.d.ts +0 -0
- /package/{utils/decorators → flpTaskCatalog/listEntries}/hasRootFolderId.js +0 -0
- /package/{utils/decorators → flpTaskCatalog/listEntries}/isPageModel.d.ts +0 -0
- /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,
|
|
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 {
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
const models =
|
|
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
|
|
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;
|
|
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"}
|
package/exports/api/aco/flp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
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 {
|
|
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";
|
package/exports/api/aco/flp.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export {
|
|
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 {
|
|
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
|
|
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
|
|
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
|
-
|
|
39
|
-
|
|
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<
|
|
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 {
|
|
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
|
|
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
|
|
42
|
-
implementation:
|
|
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 {
|
|
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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AiSdkToolDefinition } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
+
import { AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
4
|
+
import { CreateRoleUseCase } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
|
|
5
|
+
import { GetRoleUseCase } from "@webiny/api-core/features/security/roles/GetRole/index.js";
|
|
6
|
+
declare const inputSchema: z.ZodObject<{
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
slug: z.ZodString;
|
|
9
|
+
description: z.ZodOptional<z.ZodString>;
|
|
10
|
+
copyPermissionsFrom: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
type Input = z.infer<typeof inputSchema>;
|
|
13
|
+
interface CreatedRole {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
slug: string;
|
|
17
|
+
/** The role the permissions were copied from, so the reply can say where they came from. */
|
|
18
|
+
permissionsCopiedFrom?: string;
|
|
19
|
+
}
|
|
20
|
+
declare class CreateRoleToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {
|
|
21
|
+
private getRole;
|
|
22
|
+
private createRole;
|
|
23
|
+
constructor(getRole: GetRoleUseCase.Interface, createRole: CreateRoleUseCase.Interface);
|
|
24
|
+
execute(input: Input): Promise<CreatedRole>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a role, empty or with the permissions of an existing one.
|
|
28
|
+
*
|
|
29
|
+
* The model never writes permission objects. They are app-specific records with keys the model
|
|
30
|
+
* would have to guess, and the approval card would show a list of them the user cannot check. A
|
|
31
|
+
* role it creates either starts empty, for the user to fill in on the Roles screen, or copies a
|
|
32
|
+
* role the user names, which the approval shows by id.
|
|
33
|
+
*/
|
|
34
|
+
declare class CreateRoleToolImpl implements AiSdkToolDefinition.Interface<Input> {
|
|
35
|
+
readonly name = "createRole";
|
|
36
|
+
readonly title = "Create role";
|
|
37
|
+
readonly description = "Creates a security role. It starts with no permissions, or with a copy of an existing role's permissions when `copyPermissionsFrom` is given (call listRoles for the id). Permissions cannot be written directly; the user edits them on the Roles screen. Requires user approval.";
|
|
38
|
+
readonly inputSchema: z.ZodObject<{
|
|
39
|
+
name: z.ZodString;
|
|
40
|
+
slug: z.ZodString;
|
|
41
|
+
description: z.ZodOptional<z.ZodString>;
|
|
42
|
+
copyPermissionsFrom: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
readonly annotations: {
|
|
45
|
+
readOnlyHint: boolean;
|
|
46
|
+
};
|
|
47
|
+
readonly handler: typeof CreateRoleToolHandlerImpl & {
|
|
48
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolHandler<any>>;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export declare const CreateRoleTool: typeof CreateRoleToolImpl & {
|
|
52
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/ai/abstractions").IAiSdkToolDefinition<any>>;
|
|
53
|
+
};
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AiSdkToolDefinition, AiSdkToolHandler } from "@webiny/api-core/features/ai/index.js";
|
|
3
|
+
import { CreateRoleUseCase } from "@webiny/api-core/features/security/roles/CreateRole/index.js";
|
|
4
|
+
import { GetRoleUseCase } from "@webiny/api-core/features/security/roles/GetRole/index.js";
|
|
5
|
+
import { descriptionOnCreate } from "@webiny/api-core/features/security/shared/index.js";
|
|
6
|
+
const inputSchema = z.object({
|
|
7
|
+
name: z.string().min(3).describe("Human-readable role name, e.g. 'Blog editor'."),
|
|
8
|
+
slug: z.string().min(3).describe("URL-safe identifier, e.g. 'blog-editor'. Lowercase, hyphens instead of spaces."),
|
|
9
|
+
description: z.string().max(500).optional().describe("What the role is for. Shown in the admin UI. Omit it if the user did not say."),
|
|
10
|
+
copyPermissionsFrom: z.string().optional().describe("Id of an existing role, from listRoles, whose permissions the new role starts with. Omit it to create the role with no permissions.")
|
|
11
|
+
});
|
|
12
|
+
class CreateRoleToolHandlerImpl {
|
|
13
|
+
constructor(getRole, createRole){
|
|
14
|
+
this.getRole = getRole;
|
|
15
|
+
this.createRole = createRole;
|
|
16
|
+
}
|
|
17
|
+
async execute(input) {
|
|
18
|
+
let permissions = [];
|
|
19
|
+
let source;
|
|
20
|
+
if (input.copyPermissionsFrom) {
|
|
21
|
+
const found = await this.getRole.execute({
|
|
22
|
+
id: input.copyPermissionsFrom
|
|
23
|
+
});
|
|
24
|
+
if (found.isFail()) throw new Error(`Role "${input.copyPermissionsFrom}" not found: ${found.error.message}. Call listRoles for valid ids.`);
|
|
25
|
+
permissions = found.value.permissions;
|
|
26
|
+
source = found.value.name;
|
|
27
|
+
}
|
|
28
|
+
const description = descriptionOnCreate(input.description);
|
|
29
|
+
const result = await this.createRole.execute({
|
|
30
|
+
name: input.name,
|
|
31
|
+
slug: input.slug,
|
|
32
|
+
description,
|
|
33
|
+
permissions
|
|
34
|
+
});
|
|
35
|
+
if (result.isFail()) throw new Error(`Could not create the role: ${result.error.message}`);
|
|
36
|
+
const role = result.value;
|
|
37
|
+
const created = {
|
|
38
|
+
id: role.id,
|
|
39
|
+
name: role.name,
|
|
40
|
+
slug: role.slug
|
|
41
|
+
};
|
|
42
|
+
if (source) created.permissionsCopiedFrom = source;
|
|
43
|
+
return created;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const CreateRoleToolHandler = AiSdkToolHandler.createImplementation({
|
|
47
|
+
implementation: CreateRoleToolHandlerImpl,
|
|
48
|
+
dependencies: [
|
|
49
|
+
GetRoleUseCase,
|
|
50
|
+
CreateRoleUseCase
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
class CreateRoleToolImpl {
|
|
54
|
+
constructor(){
|
|
55
|
+
this.name = "createRole";
|
|
56
|
+
this.title = "Create role";
|
|
57
|
+
this.description = "Creates a security role. It starts with no permissions, or with a copy of an existing role's permissions when `copyPermissionsFrom` is given (call listRoles for the id). Permissions cannot be written directly; the user edits them on the Roles screen. Requires user approval.";
|
|
58
|
+
this.inputSchema = inputSchema;
|
|
59
|
+
this.annotations = {
|
|
60
|
+
readOnlyHint: false
|
|
61
|
+
};
|
|
62
|
+
this.handler = CreateRoleToolHandler;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const CreateRoleTool = AiSdkToolDefinition.createImplementation({
|
|
66
|
+
implementation: CreateRoleToolImpl,
|
|
67
|
+
dependencies: []
|
|
68
|
+
});
|
|
69
|
+
export { CreateRoleTool };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=CreateRoleTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/ai/CreateRoleTool.js","sources":["../../../src/features/ai/CreateRoleTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkToolDefinition } from \"@webiny/api-core/features/ai/index.js\";\nimport { AiSdkToolHandler } from \"@webiny/api-core/features/ai/index.js\";\nimport { CreateRoleUseCase } from \"@webiny/api-core/features/security/roles/CreateRole/index.js\";\nimport { GetRoleUseCase } from \"@webiny/api-core/features/security/roles/GetRole/index.js\";\nimport { descriptionOnCreate } from \"@webiny/api-core/features/security/shared/index.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\n\nconst inputSchema = z.object({\n name: z.string().min(3).describe(\"Human-readable role name, e.g. 'Blog editor'.\"),\n slug: z\n .string()\n .min(3)\n .describe(\"URL-safe identifier, e.g. 'blog-editor'. Lowercase, hyphens instead of spaces.\"),\n description: z\n .string()\n .max(500)\n .optional()\n .describe(\"What the role is for. Shown in the admin UI. Omit it if the user did not say.\"),\n copyPermissionsFrom: z\n .string()\n .optional()\n .describe(\n \"Id of an existing role, from listRoles, whose permissions the new role starts with. Omit it to create the role with no permissions.\"\n )\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface CreatedRole {\n id: string;\n name: string;\n slug: string;\n /** The role the permissions were copied from, so the reply can say where they came from. */\n permissionsCopiedFrom?: string;\n}\n\nclass CreateRoleToolHandlerImpl implements AiSdkToolHandler.Interface<Input> {\n constructor(\n private getRole: GetRoleUseCase.Interface,\n private createRole: CreateRoleUseCase.Interface\n ) {}\n\n async execute(input: Input): Promise<CreatedRole> {\n let permissions: SecurityPermission[] = [];\n let source: string | undefined;\n\n if (input.copyPermissionsFrom) {\n const found = await this.getRole.execute({ id: input.copyPermissionsFrom });\n\n if (found.isFail()) {\n throw new Error(\n `Role \"${input.copyPermissionsFrom}\" not found: ${found.error.message}. Call listRoles for valid ids.`\n );\n }\n\n permissions = found.value.permissions;\n source = found.value.name;\n }\n\n const description = descriptionOnCreate(input.description);\n const result = await this.createRole.execute({\n name: input.name,\n slug: input.slug,\n description,\n permissions\n });\n\n if (result.isFail()) {\n throw new Error(`Could not create the role: ${result.error.message}`);\n }\n\n const role = result.value;\n const created: CreatedRole = { id: role.id, name: role.name, slug: role.slug };\n\n if (source) {\n created.permissionsCopiedFrom = source;\n }\n\n return created;\n }\n}\n\nconst CreateRoleToolHandler = AiSdkToolHandler.createImplementation({\n implementation: CreateRoleToolHandlerImpl,\n dependencies: [GetRoleUseCase, CreateRoleUseCase]\n});\n\n/**\n * Creates a role, empty or with the permissions of an existing one.\n *\n * The model never writes permission objects. They are app-specific records with keys the model\n * would have to guess, and the approval card would show a list of them the user cannot check. A\n * role it creates either starts empty, for the user to fill in on the Roles screen, or copies a\n * role the user names, which the approval shows by id.\n */\nclass CreateRoleToolImpl implements AiSdkToolDefinition.Interface<Input> {\n readonly name = \"createRole\";\n readonly title = \"Create role\";\n readonly description =\n \"Creates a security role. It starts with no permissions, or with a copy of an existing role's permissions when `copyPermissionsFrom` is given (call listRoles for the id). Permissions cannot be written directly; the user edits them on the Roles screen. Requires user approval.\";\n readonly inputSchema = inputSchema;\n readonly annotations = { readOnlyHint: false };\n readonly handler = CreateRoleToolHandler;\n}\n\nexport const CreateRoleTool = AiSdkToolDefinition.createImplementation({\n implementation: CreateRoleToolImpl,\n dependencies: []\n});\n"],"names":["inputSchema","z","CreateRoleToolHandlerImpl","getRole","createRole","input","permissions","source","found","Error","description","descriptionOnCreate","result","role","created","CreateRoleToolHandler","AiSdkToolHandler","GetRoleUseCase","CreateRoleUseCase","CreateRoleToolImpl","CreateRoleTool","AiSdkToolDefinition"],"mappings":";;;;;AAQA,MAAMA,cAAcC,EAAE,MAAM,CAAC;IACzB,MAAMA,EAAE,MAAM,GAAG,GAAG,CAAC,GAAG,QAAQ,CAAC;IACjC,MAAMA,EAAAA,MACK,GACN,GAAG,CAAC,GACJ,QAAQ,CAAC;IACd,aAAaA,EAAAA,MACF,GACN,GAAG,CAAC,KACJ,QAAQ,GACR,QAAQ,CAAC;IACd,qBAAqBA,EAAAA,MACV,GACN,QAAQ,GACR,QAAQ,CACL;AAEZ;AAYA,MAAMC;IACF,YACYC,OAAiC,EACjCC,UAAuC,CACjD;aAFUD,OAAO,GAAPA;aACAC,UAAU,GAAVA;IACT;IAEH,MAAM,QAAQC,KAAY,EAAwB;QAC9C,IAAIC,cAAoC,EAAE;QAC1C,IAAIC;QAEJ,IAAIF,MAAM,mBAAmB,EAAE;YAC3B,MAAMG,QAAQ,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;gBAAE,IAAIH,MAAM,mBAAmB;YAAC;YAEzE,IAAIG,MAAM,MAAM,IACZ,MAAM,IAAIC,MACN,CAAC,MAAM,EAAEJ,MAAM,mBAAmB,CAAC,aAAa,EAAEG,MAAM,KAAK,CAAC,OAAO,CAAC,+BAA+B,CAAC;YAI9GF,cAAcE,MAAM,KAAK,CAAC,WAAW;YACrCD,SAASC,MAAM,KAAK,CAAC,IAAI;QAC7B;QAEA,MAAME,cAAcC,oBAAoBN,MAAM,WAAW;QACzD,MAAMO,SAAS,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACzC,MAAMP,MAAM,IAAI;YAChB,MAAMA,MAAM,IAAI;YAChBK;YACAJ;QACJ;QAEA,IAAIM,OAAO,MAAM,IACb,MAAM,IAAIH,MAAM,CAAC,2BAA2B,EAAEG,OAAO,KAAK,CAAC,OAAO,EAAE;QAGxE,MAAMC,OAAOD,OAAO,KAAK;QACzB,MAAME,UAAuB;YAAE,IAAID,KAAK,EAAE;YAAE,MAAMA,KAAK,IAAI;YAAE,MAAMA,KAAK,IAAI;QAAC;QAE7E,IAAIN,QACAO,QAAQ,qBAAqB,GAAGP;QAGpC,OAAOO;IACX;AACJ;AAEA,MAAMC,wBAAwBC,iBAAiB,oBAAoB,CAAC;IAChE,gBAAgBd;IAChB,cAAc;QAACe;QAAgBC;KAAkB;AACrD;AAUA,MAAMC;;aACO,IAAI,GAAG;aACP,KAAK,GAAG;aACR,WAAW,GAChB;aACK,WAAW,GAAGnB;aACd,WAAW,GAAG;YAAE,cAAc;QAAM;aACpC,OAAO,GAAGe;;AACvB;AAEO,MAAMK,iBAAiBC,oBAAoB,oBAAoB,CAAC;IACnE,gBAAgBF;IAChB,cAAc,EAAE;AACpB"}
|