@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/shared/CodeFlpsProvider.js","sources":["../../../../src/features/flp/shared/CodeFlpsProvider.ts"],"sourcesContent":["import {\n type CodeFlp,\n CodeFlpsProvider as CodeFlpsProviderAbstraction,\n FlpFactory,\n type GetCodePermissionsParams\n} from \"./abstractions.js\";\nimport { CodeFlpPath } from \"./CodeFlpPath.js\";\nimport { CodeFlpTarget } from \"./CodeFlpTarget.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\n\nclass CodeFlpsProviderImpl implements CodeFlpsProviderAbstraction.Interface {\n private cache: CodeFlp[] | undefined;\n\n constructor(private flpFactories: FlpFactory.Interface[]) {}\n\n async getPermissions({ type, path }: GetCodePermissionsParams): Promise<FolderPermission[]> {\n const codeFlps = await this.getCodeFlps();\n\n return codeFlps\n .filter(flp => flp.type === type && CodeFlpPath.matches(flp.path, path))\n .flatMap<FolderPermission>(flp => {\n return flp.permissions.map(permission => CodeFlpTarget.resolve(permission));\n });\n }\n\n public listFlps(): Promise<CodeFlp[]> {\n return this.getCodeFlps();\n }\n\n /** All code-defined FLPs, collected from every registered `FlpFactory`. */\n private async getCodeFlps(): Promise<CodeFlp[]> {\n if (this.cache === undefined) {\n const results = await Promise.all(this.flpFactories.map(factory => factory.execute()));\n this.cache = results.flat();\n }\n\n return this.cache;\n }\n}\n\nexport const CodeFlpsProvider = CodeFlpsProviderAbstraction.createImplementation({\n implementation: CodeFlpsProviderImpl,\n dependencies: [[FlpFactory, { multiple: true }]]\n});\n"],"names":["CodeFlpsProviderImpl","flpFactories","type","path","codeFlps","flp","CodeFlpPath","permission","CodeFlpTarget","undefined","results","Promise","factory","CodeFlpsProvider","CodeFlpsProviderAbstraction","FlpFactory"],"mappings":";;;AAUA,MAAMA;IAGF,YAAoBC,YAAoC,CAAE;aAAtCA,YAAY,GAAZA;IAAuC;IAE3D,MAAM,eAAe,EAAEC,IAAI,EAAEC,IAAI,EAA4B,EAA+B;QACxF,MAAMC,WAAW,MAAM,IAAI,CAAC,WAAW;QAEvC,OAAOA,SACF,MAAM,CAACC,CAAAA,MAAOA,IAAI,IAAI,KAAKH,QAAQI,YAAY,OAAO,CAACD,IAAI,IAAI,EAAEF,OACjE,OAAO,CAAmBE,CAAAA,MAChBA,IAAI,WAAW,CAAC,GAAG,CAACE,CAAAA,aAAcC,cAAc,OAAO,CAACD;IAE3E;IAEO,WAA+B;QAClC,OAAO,IAAI,CAAC,WAAW;IAC3B;IAGA,MAAc,cAAkC;QAC5C,IAAI,AAAeE,WAAf,IAAI,CAAC,KAAK,EAAgB;YAC1B,MAAMC,UAAU,MAAMC,QAAQ,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAACC,CAAAA,UAAWA,QAAQ,OAAO;YAClF,IAAI,CAAC,KAAK,GAAGF,QAAQ,IAAI;QAC7B;QAEA,OAAO,IAAI,CAAC,KAAK;IACrB;AACJ;AAEO,MAAMG,oCAAmBC,iBAAAA,oBAAgD,CAAC;IAC7E,gBAAgBd;IAChB,cAAc;QAAC;YAACe;YAAY;gBAAE,UAAU;YAAK;SAAE;KAAC;AACpD"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { FolderAccessLevel, FolderPermission } from "../../../flp/flp.types.js";
|
|
2
|
+
interface CodeTeamPermission {
|
|
3
|
+
/** Slug of the team the permission is granted to. */
|
|
4
|
+
team: string;
|
|
5
|
+
user?: never;
|
|
6
|
+
level: FolderAccessLevel;
|
|
7
|
+
}
|
|
8
|
+
interface CodeUserPermission {
|
|
9
|
+
/** ID of the admin user the permission is granted to. */
|
|
10
|
+
user: string;
|
|
11
|
+
team?: never;
|
|
12
|
+
level: FolderAccessLevel;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A permission grants a level to exactly one target: either a team or a single admin user. The
|
|
16
|
+
* `team:` / `admin:` target strings used internally are generated from these.
|
|
17
|
+
*
|
|
18
|
+
* Prefer `team` — team slugs are authored by hand and stable, while user IDs are generated at
|
|
19
|
+
* runtime and differ per environment.
|
|
20
|
+
*/
|
|
21
|
+
export type CodeFolderPermission = CodeTeamPermission | CodeUserPermission;
|
|
22
|
+
export type CodeFlp = {
|
|
23
|
+
/**
|
|
24
|
+
* Folder type the rule applies to. Use `FlpFactory.FolderType` to build the built-in ones
|
|
25
|
+
* instead of writing the string by hand.
|
|
26
|
+
*/
|
|
27
|
+
type: string;
|
|
28
|
+
/**
|
|
29
|
+
* Folder path the rule binds to. The leading `root` segment is optional, so both `/marketing`
|
|
30
|
+
* and `root/marketing` are accepted. A trailing `/*` matches the folder and its whole subtree.
|
|
31
|
+
*/
|
|
32
|
+
path: string;
|
|
33
|
+
permissions: CodeFolderPermission[];
|
|
34
|
+
};
|
|
35
|
+
export interface IFlpFactory {
|
|
36
|
+
execute(): Promise<CodeFlp[]>;
|
|
37
|
+
}
|
|
38
|
+
/** Provide code-defined folder-level permissions. */
|
|
39
|
+
export declare const FlpFactory: import("@webiny/di").Abstraction<IFlpFactory> & {
|
|
40
|
+
FolderType: {
|
|
41
|
+
/** File Manager folders. */
|
|
42
|
+
FileManager: {
|
|
43
|
+
/** Folders holding files. */
|
|
44
|
+
Files: string;
|
|
45
|
+
};
|
|
46
|
+
/** Headless CMS folders. */
|
|
47
|
+
Cms: {
|
|
48
|
+
/** Folders holding entries of a content model, addressed by its `modelId`. */
|
|
49
|
+
Entries(modelId: string): string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export declare namespace FlpFactory {
|
|
54
|
+
type Interface = IFlpFactory;
|
|
55
|
+
type Return = Promise<CodeFlp[]>;
|
|
56
|
+
type Flp = CodeFlp;
|
|
57
|
+
type Permission = CodeFolderPermission;
|
|
58
|
+
}
|
|
59
|
+
export interface GetCodePermissionsParams {
|
|
60
|
+
type: string;
|
|
61
|
+
path: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ICodeFlpsProvider {
|
|
64
|
+
/**
|
|
65
|
+
* Return all code-defined permissions that apply to the given folder type and path.
|
|
66
|
+
*/
|
|
67
|
+
getPermissions(params: GetCodePermissionsParams): Promise<FolderPermission[]>;
|
|
68
|
+
/** All code-defined FLPs, as the registered `FlpFactory` implementations return them. */
|
|
69
|
+
listFlps(): Promise<CodeFlp[]>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolve code-defined folder-level permissions for a given folder. Only permissions contributed by
|
|
73
|
+
* an `FlpFactory` are considered — the ones stored in the database are loaded separately.
|
|
74
|
+
*/
|
|
75
|
+
export declare const CodeFlpsProvider: import("@webiny/di").Abstraction<ICodeFlpsProvider>;
|
|
76
|
+
export declare namespace CodeFlpsProvider {
|
|
77
|
+
type Interface = ICodeFlpsProvider;
|
|
78
|
+
}
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
import { FM_FILE_TYPE } from "../../../constants.js";
|
|
3
|
+
const FolderType = {
|
|
4
|
+
FileManager: {
|
|
5
|
+
Files: FM_FILE_TYPE
|
|
6
|
+
},
|
|
7
|
+
Cms: {
|
|
8
|
+
Entries (modelId) {
|
|
9
|
+
return `cms:${modelId}`;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const FlpFactory = Object.assign(createAbstraction("FlpFactory"), {
|
|
14
|
+
FolderType: FolderType
|
|
15
|
+
});
|
|
16
|
+
const CodeFlpsProvider = createAbstraction("CodeFlpsProvider");
|
|
17
|
+
export { CodeFlpsProvider, FlpFactory };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/shared/abstractions.js","sources":["../../../../src/features/flp/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { FM_FILE_TYPE } from \"~/constants.js\";\nimport type { FolderAccessLevel, FolderPermission } from \"~/flp/flp.types.js\";\n\ninterface CodeTeamPermission {\n /** Slug of the team the permission is granted to. */\n team: string;\n user?: never;\n level: FolderAccessLevel;\n}\n\ninterface CodeUserPermission {\n /** ID of the admin user the permission is granted to. */\n user: string;\n team?: never;\n level: FolderAccessLevel;\n}\n\n/**\n * A permission grants a level to exactly one target: either a team or a single admin user. The\n * `team:` / `admin:` target strings used internally are generated from these.\n *\n * Prefer `team` — team slugs are authored by hand and stable, while user IDs are generated at\n * runtime and differ per environment.\n */\nexport type CodeFolderPermission = CodeTeamPermission | CodeUserPermission;\n\nexport type CodeFlp = {\n /**\n * Folder type the rule applies to. Use `FlpFactory.FolderType` to build the built-in ones\n * instead of writing the string by hand.\n */\n type: string;\n /**\n * Folder path the rule binds to. The leading `root` segment is optional, so both `/marketing`\n * and `root/marketing` are accepted. A trailing `/*` matches the folder and its whole subtree.\n */\n path: string;\n permissions: CodeFolderPermission[];\n};\n\nexport interface IFlpFactory {\n execute(): Promise<CodeFlp[]>;\n}\n\n/**\n * The folder types shipped with Webiny, grouped by the app that owns them, so `CodeFlp.type` does\n * not have to be written by hand.\n *\n * Folder types stay open-ended — every app registering folders picks its own type — so `type`\n * remains a plain `string` and a custom app can still pass its own value directly.\n */\nconst FolderType = {\n /** File Manager folders. */\n FileManager: {\n /** Folders holding files. */\n Files: FM_FILE_TYPE as string\n },\n /** Headless CMS folders. */\n Cms: {\n /** Folders holding entries of a content model, addressed by its `modelId`. */\n Entries(modelId: string): string {\n return `cms:${modelId}`;\n }\n }\n};\n\n/** Provide code-defined folder-level permissions. */\nexport const FlpFactory = Object.assign(createAbstraction<IFlpFactory>(\"FlpFactory\"), {\n FolderType\n});\n\nexport namespace FlpFactory {\n export type Interface = IFlpFactory;\n export type Return = Promise<CodeFlp[]>;\n export type Flp = CodeFlp;\n export type Permission = CodeFolderPermission;\n}\n\nexport interface GetCodePermissionsParams {\n type: string;\n path: string;\n}\n\nexport interface ICodeFlpsProvider {\n /**\n * Return all code-defined permissions that apply to the given folder type and path.\n */\n getPermissions(params: GetCodePermissionsParams): Promise<FolderPermission[]>;\n /** All code-defined FLPs, as the registered `FlpFactory` implementations return them. */\n listFlps(): Promise<CodeFlp[]>;\n}\n\n/**\n * Resolve code-defined folder-level permissions for a given folder. Only permissions contributed by\n * an `FlpFactory` are considered — the ones stored in the database are loaded separately.\n */\nexport const CodeFlpsProvider = createAbstraction<ICodeFlpsProvider>(\"CodeFlpsProvider\");\n\nexport namespace CodeFlpsProvider {\n export type Interface = ICodeFlpsProvider;\n}\n"],"names":["FolderType","FM_FILE_TYPE","modelId","FlpFactory","Object","createAbstraction","CodeFlpsProvider"],"mappings":";;AAoDA,MAAMA,aAAa;IAEf,aAAa;QAET,OAAOC;IACX;IAEA,KAAK;QAED,SAAQC,OAAe;YACnB,OAAO,CAAC,IAAI,EAAEA,SAAS;QAC3B;IACJ;AACJ;AAGO,MAAMC,aAAaC,OAAO,MAAM,CAACC,kBAA+B,eAAe;IAClFL,YAAAA;AACJ;AA2BO,MAAMM,mBAAmBD,kBAAqC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
|
|
3
|
+
import { CodeFlpsProvider } from "./CodeFlpsProvider.js";
|
|
4
|
+
import { GetFlpWithCodeFlps } from "../GetFlp/decorators/GetFlpWithCodeFlps.js";
|
|
5
|
+
import { ListFlpsWithCodeFlps } from "../ListFlps/decorators/ListFlpsWithCodeFlps.js";
|
|
6
|
+
const CodeFlpsFeature = createFeature({
|
|
7
|
+
name: "CodeFlps",
|
|
8
|
+
register (container) {
|
|
9
|
+
if (!container.resolve(FeatureFlags).get().isEnabled("advancedAccessControlLayer.folderLevelPermissions")) return;
|
|
10
|
+
container.register(CodeFlpsProvider).inSingletonScope();
|
|
11
|
+
container.registerDecorator(GetFlpWithCodeFlps);
|
|
12
|
+
container.registerDecorator(ListFlpsWithCodeFlps);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
export { CodeFlpsFeature };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/flp/shared/feature.js","sources":["../../../../src/features/flp/shared/feature.ts"],"sourcesContent":["import { type Container, createFeature } from \"@webiny/feature/api\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { CodeFlpsProvider } from \"./CodeFlpsProvider.js\";\nimport { GetFlpWithCodeFlps } from \"~/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js\";\nimport { ListFlpsWithCodeFlps } from \"~/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js\";\n\nexport const CodeFlpsFeature = createFeature({\n name: \"CodeFlps\",\n register(container: Container) {\n // Code-defined FLPs are part of folder-level permissions, which is license-gated. Check at\n // register time so nothing wires up — and no code permission is ever enforced — without the\n // entitlement.\n if (\n !container\n .resolve(FeatureFlags)\n .get()\n .isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n return;\n }\n\n container.register(CodeFlpsProvider).inSingletonScope();\n container.registerDecorator(GetFlpWithCodeFlps);\n container.registerDecorator(ListFlpsWithCodeFlps);\n }\n});\n"],"names":["CodeFlpsFeature","createFeature","container","FeatureFlags","CodeFlpsProvider","GetFlpWithCodeFlps","ListFlpsWithCodeFlps"],"mappings":";;;;;AAMO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAoB;QAIzB,IACI,CAACA,UACI,OAAO,CAACC,cACR,GAAG,GACH,SAAS,CAAC,sDAEf;QAGJD,UAAU,QAAQ,CAACE,kBAAkB,gBAAgB;QACrDF,UAAU,iBAAiB,CAACG;QAC5BH,UAAU,iBAAiB,CAACI;IAChC;AACJ"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { FolderLevelPermissions } from "../../../../features/flp/FolderLevelPermissions/index.js";
|
|
2
2
|
import { CreateFolderUseCase } from "../abstractions.js";
|
|
3
3
|
import type { CreateFolderParams } from "../../../../folder/folder.types.js";
|
|
4
|
+
import { CodeFlpsProvider } from "../../../../features/flp/shared/index.js";
|
|
4
5
|
declare class CreateFolderWithFolderLevelPermissionsImpl implements CreateFolderUseCase.Interface {
|
|
5
6
|
private folderLevelPermissions;
|
|
6
7
|
private readonly decoretee;
|
|
7
|
-
|
|
8
|
+
private readonly codeFlpsProvider?;
|
|
9
|
+
constructor(folderLevelPermissions: FolderLevelPermissions.Interface, codeFlpsProvider: CodeFlpsProvider.Interface | undefined, decoretee: CreateFolderUseCase.Interface);
|
|
8
10
|
execute(params: CreateFolderParams): CreateFolderUseCase.Return;
|
|
11
|
+
/**
|
|
12
|
+
* Code-defined permissions are resolved from the folder's own type and path rather than the FLP
|
|
13
|
+
* catalog: the record for a folder this new is written by an event handler and may not exist
|
|
14
|
+
* yet. Without this the response would omit them until something refetched the folder.
|
|
15
|
+
*/
|
|
16
|
+
private withCodePermissions;
|
|
9
17
|
}
|
|
10
18
|
export declare const CreateFolderWithFolderLevelPermissions: typeof CreateFolderWithFolderLevelPermissionsImpl;
|
|
11
19
|
export {};
|
|
@@ -2,9 +2,11 @@ import { FolderLevelPermissions } from "../../../flp/FolderLevelPermissions/inde
|
|
|
2
2
|
import { CreateFolderUseCase } from "../abstractions.js";
|
|
3
3
|
import { Result, createDecorator } from "@webiny/feature/api";
|
|
4
4
|
import { FolderNotAuthorizedError } from "../../../../domain/folder/errors.js";
|
|
5
|
+
import { CodeFlpMerger, CodeFlpsProvider } from "../../../flp/shared/index.js";
|
|
5
6
|
class CreateFolderWithFolderLevelPermissionsImpl {
|
|
6
|
-
constructor(folderLevelPermissions, decoretee){
|
|
7
|
+
constructor(folderLevelPermissions, codeFlpsProvider, decoretee){
|
|
7
8
|
this.folderLevelPermissions = folderLevelPermissions;
|
|
9
|
+
this.codeFlpsProvider = codeFlpsProvider;
|
|
8
10
|
this.decoretee = decoretee;
|
|
9
11
|
}
|
|
10
12
|
async execute(params) {
|
|
@@ -20,18 +22,33 @@ class CreateFolderWithFolderLevelPermissionsImpl {
|
|
|
20
22
|
const result = await this.decoretee.execute(params);
|
|
21
23
|
if (result.isFail()) return Result.fail(result.error);
|
|
22
24
|
const folder = result.value;
|
|
23
|
-
const
|
|
25
|
+
const permissions = await this.withCodePermissions(folder, folder?.permissions ?? []);
|
|
26
|
+
const permissionsWithDefaults = await this.folderLevelPermissions.getDefaultPermissions(permissions);
|
|
24
27
|
return Result.ok({
|
|
25
28
|
...folder,
|
|
26
29
|
permissions: permissionsWithDefaults
|
|
27
30
|
});
|
|
28
31
|
}
|
|
32
|
+
async withCodePermissions(folder, permissions) {
|
|
33
|
+
if (!this.codeFlpsProvider) return permissions;
|
|
34
|
+
const codePermissions = await this.codeFlpsProvider.getPermissions({
|
|
35
|
+
type: folder.type,
|
|
36
|
+
path: folder.path
|
|
37
|
+
});
|
|
38
|
+
return CodeFlpMerger.mergePermissions(permissions, codePermissions);
|
|
39
|
+
}
|
|
29
40
|
}
|
|
30
41
|
const CreateFolderWithFolderLevelPermissions = createDecorator({
|
|
31
42
|
abstraction: CreateFolderUseCase,
|
|
32
43
|
decorator: CreateFolderWithFolderLevelPermissionsImpl,
|
|
33
44
|
dependencies: [
|
|
34
|
-
FolderLevelPermissions
|
|
45
|
+
FolderLevelPermissions,
|
|
46
|
+
[
|
|
47
|
+
CodeFlpsProvider,
|
|
48
|
+
{
|
|
49
|
+
optional: true
|
|
50
|
+
}
|
|
51
|
+
]
|
|
35
52
|
]
|
|
36
53
|
});
|
|
37
54
|
export { CreateFolderWithFolderLevelPermissions };
|
package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js","sources":["../../../../../src/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.ts"],"sourcesContent":["import { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { CreateFolderUseCase } from \"../abstractions.js\";\nimport type { CreateFolderParams } from \"~/folder/folder.types.js\";\nimport { createDecorator, Result } from \"@webiny/feature/api\";\nimport { FolderNotAuthorizedError } from \"~/domain/folder/errors.js\";\n\nclass CreateFolderWithFolderLevelPermissionsImpl implements CreateFolderUseCase.Interface {\n private folderLevelPermissions: FolderLevelPermissions.Interface;\n private readonly decoretee: CreateFolderUseCase.Interface;\n\n constructor(\n folderLevelPermissions: FolderLevelPermissions.Interface,\n decoretee: CreateFolderUseCase.Interface\n ) {\n this.folderLevelPermissions = folderLevelPermissions;\n this.decoretee = decoretee;\n }\n\n async execute(params: CreateFolderParams): CreateFolderUseCase.Return {\n let canCreateFolder: boolean;\n if (params.parentId) {\n const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(\n params.parentId\n );\n canCreateFolder = await this.folderLevelPermissions.canAccessFolder({\n permissions,\n rwd: \"w\"\n });\n } else {\n canCreateFolder = this.folderLevelPermissions.canCreateFolderInRoot();\n }\n\n if (!canCreateFolder) {\n return Result.fail(new FolderNotAuthorizedError());\n }\n\n const result = await this.decoretee.execute(params);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const folder = result.value;\n\n // Let's set default permissions based on the current user.\n const permissionsWithDefaults
|
|
1
|
+
{"version":3,"file":"features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js","sources":["../../../../../src/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.ts"],"sourcesContent":["import { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { CreateFolderUseCase } from \"../abstractions.js\";\nimport type { CreateFolderParams } from \"~/folder/folder.types.js\";\nimport type { Folder } from \"~/folder/folder.types.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport { createDecorator, Result } from \"@webiny/feature/api\";\nimport { FolderNotAuthorizedError } from \"~/domain/folder/errors.js\";\nimport { CodeFlpMerger } from \"~/features/flp/shared/index.js\";\nimport { CodeFlpsProvider } from \"~/features/flp/shared/index.js\";\n\nclass CreateFolderWithFolderLevelPermissionsImpl implements CreateFolderUseCase.Interface {\n private folderLevelPermissions: FolderLevelPermissions.Interface;\n private readonly decoretee: CreateFolderUseCase.Interface;\n private readonly codeFlpsProvider?: CodeFlpsProvider.Interface;\n\n constructor(\n folderLevelPermissions: FolderLevelPermissions.Interface,\n codeFlpsProvider: CodeFlpsProvider.Interface | undefined,\n decoretee: CreateFolderUseCase.Interface\n ) {\n this.folderLevelPermissions = folderLevelPermissions;\n this.codeFlpsProvider = codeFlpsProvider;\n this.decoretee = decoretee;\n }\n\n async execute(params: CreateFolderParams): CreateFolderUseCase.Return {\n let canCreateFolder: boolean;\n if (params.parentId) {\n const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(\n params.parentId\n );\n canCreateFolder = await this.folderLevelPermissions.canAccessFolder({\n permissions,\n rwd: \"w\"\n });\n } else {\n canCreateFolder = this.folderLevelPermissions.canCreateFolderInRoot();\n }\n\n if (!canCreateFolder) {\n return Result.fail(new FolderNotAuthorizedError());\n }\n\n const result = await this.decoretee.execute(params);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const folder = result.value;\n\n const permissions = await this.withCodePermissions(folder, folder?.permissions ?? []);\n\n // Let's set default permissions based on the current user.\n const permissionsWithDefaults =\n await this.folderLevelPermissions.getDefaultPermissions(permissions);\n\n return Result.ok({\n ...folder,\n permissions: permissionsWithDefaults\n });\n }\n\n /**\n * Code-defined permissions are resolved from the folder's own type and path rather than the FLP\n * catalog: the record for a folder this new is written by an event handler and may not exist\n * yet. Without this the response would omit them until something refetched the folder.\n */\n private async withCodePermissions(\n folder: Pick<Folder, \"type\" | \"path\">,\n permissions: FolderPermission[]\n ): Promise<FolderPermission[]> {\n if (!this.codeFlpsProvider) {\n return permissions;\n }\n\n const codePermissions = await this.codeFlpsProvider.getPermissions({\n type: folder.type,\n path: folder.path\n });\n\n return CodeFlpMerger.mergePermissions(permissions, codePermissions);\n }\n}\n\nexport const CreateFolderWithFolderLevelPermissions = createDecorator({\n abstraction: CreateFolderUseCase,\n decorator: CreateFolderWithFolderLevelPermissionsImpl,\n // `CodeFlpsProvider` is optional: `CodeFlpsFeature` does not register it unless the project has\n // the folder-level permissions entitlement.\n dependencies: [FolderLevelPermissions, [CodeFlpsProvider, { optional: true }]]\n});\n"],"names":["CreateFolderWithFolderLevelPermissionsImpl","folderLevelPermissions","codeFlpsProvider","decoretee","params","canCreateFolder","permissions","Result","FolderNotAuthorizedError","result","folder","permissionsWithDefaults","codePermissions","CodeFlpMerger","CreateFolderWithFolderLevelPermissions","createDecorator","CreateFolderUseCase","FolderLevelPermissions","CodeFlpsProvider"],"mappings":";;;;;AAUA,MAAMA;IAKF,YACIC,sBAAwD,EACxDC,gBAAwD,EACxDC,SAAwC,CAC1C;QACE,IAAI,CAAC,sBAAsB,GAAGF;QAC9B,IAAI,CAAC,gBAAgB,GAAGC;QACxB,IAAI,CAAC,SAAS,GAAGC;IACrB;IAEA,MAAM,QAAQC,MAA0B,EAA8B;QAClE,IAAIC;QACJ,IAAID,OAAO,QAAQ,EAAE;YACjB,MAAME,cAAc,MAAM,IAAI,CAAC,sBAAsB,CAAC,yBAAyB,CAC3EF,OAAO,QAAQ;YAEnBC,kBAAkB,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC;gBAChEC;gBACA,KAAK;YACT;QACJ,OACID,kBAAkB,IAAI,CAAC,sBAAsB,CAAC,qBAAqB;QAGvE,IAAI,CAACA,iBACD,OAAOE,OAAO,IAAI,CAAC,IAAIC;QAG3B,MAAMC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACL;QAE5C,IAAIK,OAAO,MAAM,IACb,OAAOF,OAAO,IAAI,CAACE,OAAO,KAAK;QAGnC,MAAMC,SAASD,OAAO,KAAK;QAE3B,MAAMH,cAAc,MAAM,IAAI,CAAC,mBAAmB,CAACI,QAAQA,QAAQ,eAAe,EAAE;QAGpF,MAAMC,0BACF,MAAM,IAAI,CAAC,sBAAsB,CAAC,qBAAqB,CAACL;QAE5D,OAAOC,OAAO,EAAE,CAAC;YACb,GAAGG,MAAM;YACT,aAAaC;QACjB;IACJ;IAOA,MAAc,oBACVD,MAAqC,EACrCJ,WAA+B,EACJ;QAC3B,IAAI,CAAC,IAAI,CAAC,gBAAgB,EACtB,OAAOA;QAGX,MAAMM,kBAAkB,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC;YAC/D,MAAMF,OAAO,IAAI;YACjB,MAAMA,OAAO,IAAI;QACrB;QAEA,OAAOG,cAAc,gBAAgB,CAACP,aAAaM;IACvD;AACJ;AAEO,MAAME,yCAAyCC,gBAAgB;IAClE,aAAaC;IACb,WAAWhB;IAGX,cAAc;QAACiB;QAAwB;YAACC;YAAkB;gBAAE,UAAU;YAAK;SAAE;KAAC;AAClF"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import type { ListFoldersParams } from "../../../../folder/folder.types.js";
|
|
2
2
|
import { ListFoldersUseCase } from "../abstractions.js";
|
|
3
|
-
import {
|
|
3
|
+
import { FolderAccessListFilter } from "../../../../features/flp/FolderAccessListFilter/index.js";
|
|
4
4
|
declare class ListFoldersWithFolderLevelPermissionsImpl implements ListFoldersUseCase.Interface {
|
|
5
|
-
private
|
|
5
|
+
private folderAccessListFilter;
|
|
6
6
|
private decoratee;
|
|
7
|
-
|
|
8
|
-
constructor(folderLevelPermissions: FolderLevelPermissions.Interface, decoratee: ListFoldersUseCase.Interface);
|
|
7
|
+
constructor(folderAccessListFilter: FolderAccessListFilter.Interface, decoratee: ListFoldersUseCase.Interface);
|
|
9
8
|
execute(params: ListFoldersParams): ListFoldersUseCase.Return;
|
|
10
|
-
private hasFlp;
|
|
11
|
-
private getFlp;
|
|
12
|
-
private setFlp;
|
|
13
9
|
}
|
|
14
10
|
export declare const ListFoldersWithFolderLevelPermissions: typeof ListFoldersWithFolderLevelPermissionsImpl & {
|
|
15
11
|
__abstraction: import("@webiny/di").Abstraction<import("../abstractions.js").IListFoldersUseCase>;
|
|
@@ -1,63 +1,18 @@
|
|
|
1
|
-
import { Result } from "@webiny/feature/api";
|
|
2
1
|
import { ListFoldersUseCase } from "../abstractions.js";
|
|
3
|
-
import {
|
|
4
|
-
import { ROOT_FOLDER } from "../../../../constants.js";
|
|
2
|
+
import { FolderAccessListFilter } from "../../../flp/FolderAccessListFilter/index.js";
|
|
5
3
|
class ListFoldersWithFolderLevelPermissionsImpl {
|
|
6
|
-
constructor(
|
|
7
|
-
this.
|
|
4
|
+
constructor(folderAccessListFilter, decoratee){
|
|
5
|
+
this.folderAccessListFilter = folderAccessListFilter;
|
|
8
6
|
this.decoratee = decoratee;
|
|
9
|
-
this.flpCatalog = new Map();
|
|
10
7
|
}
|
|
11
8
|
async execute(params) {
|
|
12
|
-
|
|
13
|
-
if (result.isFail()) return Result.fail(result.error);
|
|
14
|
-
const { folders, meta } = result.value;
|
|
15
|
-
const rootFlps = await this.folderLevelPermissions.listFolderLevelPermissions({
|
|
16
|
-
where: {
|
|
17
|
-
type: params.where.type,
|
|
18
|
-
parentId: ROOT_FOLDER
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
rootFlps.forEach((flp)=>this.setFlp(flp.id, flp.permissions));
|
|
22
|
-
await Promise.all(folders.map(async (folder)=>{
|
|
23
|
-
if (!this.hasFlp(folder.id)) {
|
|
24
|
-
const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(folder.id);
|
|
25
|
-
this.setFlp(folder.id, permissions);
|
|
26
|
-
}
|
|
27
|
-
}));
|
|
28
|
-
const foldersWithPermissions = await Promise.all(folders.map(async (folder)=>{
|
|
29
|
-
const permissions = this.getFlp(folder.id);
|
|
30
|
-
if (!permissions) return null;
|
|
31
|
-
const canAccessFolder = await this.folderLevelPermissions.canAccessFolder({
|
|
32
|
-
permissions,
|
|
33
|
-
rwd: "r"
|
|
34
|
-
});
|
|
35
|
-
if (!canAccessFolder) return null;
|
|
36
|
-
const folderWithFlp = {
|
|
37
|
-
...folder,
|
|
38
|
-
permissions
|
|
39
|
-
};
|
|
40
|
-
return canAccessFolder ? folderWithFlp : null;
|
|
41
|
-
}));
|
|
42
|
-
return Result.ok({
|
|
43
|
-
folders: foldersWithPermissions.filter(Boolean),
|
|
44
|
-
meta
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
hasFlp(id) {
|
|
48
|
-
return this.flpCatalog.has(id);
|
|
49
|
-
}
|
|
50
|
-
getFlp(id) {
|
|
51
|
-
return this.flpCatalog.get(id);
|
|
52
|
-
}
|
|
53
|
-
setFlp(id, permissions) {
|
|
54
|
-
this.flpCatalog.set(id, permissions);
|
|
9
|
+
return this.folderAccessListFilter.listFolders(params, (params)=>this.decoratee.execute(params));
|
|
55
10
|
}
|
|
56
11
|
}
|
|
57
12
|
const ListFoldersWithFolderLevelPermissions = ListFoldersUseCase.createDecorator({
|
|
58
13
|
decorator: ListFoldersWithFolderLevelPermissionsImpl,
|
|
59
14
|
dependencies: [
|
|
60
|
-
|
|
15
|
+
FolderAccessListFilter
|
|
61
16
|
]
|
|
62
17
|
});
|
|
63
18
|
export { ListFoldersWithFolderLevelPermissions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js","sources":["../../../../../src/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.js","sources":["../../../../../src/features/folder/ListFolders/decorators/ListFoldersWithFolderLevelPermissions.ts"],"sourcesContent":["import type { ListFoldersParams } from \"~/folder/folder.types.js\";\nimport { ListFoldersUseCase } from \"../abstractions.js\";\nimport { FolderAccessListFilter } from \"~/features/flp/FolderAccessListFilter/index.js\";\n\nclass ListFoldersWithFolderLevelPermissionsImpl implements ListFoldersUseCase.Interface {\n constructor(\n private folderAccessListFilter: FolderAccessListFilter.Interface,\n private decoratee: ListFoldersUseCase.Interface\n ) {}\n\n async execute(params: ListFoldersParams): ListFoldersUseCase.Return {\n return this.folderAccessListFilter.listFolders(params, params =>\n this.decoratee.execute(params)\n );\n }\n}\n\nexport const ListFoldersWithFolderLevelPermissions = ListFoldersUseCase.createDecorator({\n decorator: ListFoldersWithFolderLevelPermissionsImpl,\n dependencies: [FolderAccessListFilter]\n});\n"],"names":["ListFoldersWithFolderLevelPermissionsImpl","folderAccessListFilter","decoratee","params","ListFoldersWithFolderLevelPermissions","ListFoldersUseCase","FolderAccessListFilter"],"mappings":";;AAIA,MAAMA;IACF,YACYC,sBAAwD,EACxDC,SAAuC,CACjD;aAFUD,sBAAsB,GAAtBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,QAAQC,MAAyB,EAA6B;QAChE,OAAO,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAACA,QAAQA,CAAAA,SACnD,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA;IAE/B;AACJ;AAEO,MAAMC,wCAAwCC,mBAAmB,eAAe,CAAC;IACpF,WAAWL;IACX,cAAc;QAACM;KAAuB;AAC1C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
2
|
+
import { WebsocketsSendToIdentityUseCase } from "@webiny/api-core/features/websockets/index.js";
|
|
3
|
+
import { NotifyFolderChangeUseCase as UseCaseAbstraction } from "./abstractions.js";
|
|
4
|
+
declare class NotifyFolderChangeUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
+
private identityContext;
|
|
6
|
+
private sendToIdentity;
|
|
7
|
+
constructor(identityContext: IdentityContext.Interface, sendToIdentity: WebsocketsSendToIdentityUseCase.Interface);
|
|
8
|
+
execute({ id, change, identityId }: UseCaseAbstraction.Params): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare const NotifyFolderChangeUseCase: import("@webiny/di").Implementation<typeof NotifyFolderChangeUseCaseImpl>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
3
|
+
import { WebsocketsSendToIdentityUseCase } from "@webiny/api-core/features/websockets/index.js";
|
|
4
|
+
import { FOLDER_CREATED_WEBSOCKET_ACTION, FOLDER_DELETED_WEBSOCKET_ACTION, FOLDER_UPDATED_WEBSOCKET_ACTION, NotifyFolderChangeUseCase } from "./abstractions.js";
|
|
5
|
+
const ACTIONS = {
|
|
6
|
+
created: FOLDER_CREATED_WEBSOCKET_ACTION,
|
|
7
|
+
updated: FOLDER_UPDATED_WEBSOCKET_ACTION,
|
|
8
|
+
deleted: FOLDER_DELETED_WEBSOCKET_ACTION
|
|
9
|
+
};
|
|
10
|
+
class NotifyFolderChangeUseCaseImpl {
|
|
11
|
+
constructor(identityContext, sendToIdentity){
|
|
12
|
+
this.identityContext = identityContext;
|
|
13
|
+
this.sendToIdentity = sendToIdentity;
|
|
14
|
+
}
|
|
15
|
+
async execute({ id, change, identityId }) {
|
|
16
|
+
const recipient = identityId ?? this.identityContext.getIdentity()?.id;
|
|
17
|
+
if (!recipient) return;
|
|
18
|
+
await this.sendToIdentity.execute({
|
|
19
|
+
id: recipient
|
|
20
|
+
}, {
|
|
21
|
+
action: ACTIONS[change],
|
|
22
|
+
data: {
|
|
23
|
+
id
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const NotifyFolderChangeUseCase_NotifyFolderChangeUseCase = createImplementation({
|
|
29
|
+
abstraction: NotifyFolderChangeUseCase,
|
|
30
|
+
implementation: NotifyFolderChangeUseCaseImpl,
|
|
31
|
+
dependencies: [
|
|
32
|
+
IdentityContext,
|
|
33
|
+
WebsocketsSendToIdentityUseCase
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
export { NotifyFolderChangeUseCase_NotifyFolderChangeUseCase as NotifyFolderChangeUseCase };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=NotifyFolderChangeUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js","sources":["../../../../src/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { WebsocketsSendToIdentityUseCase } from \"@webiny/api-core/features/websockets/index.js\";\nimport {\n FOLDER_CREATED_WEBSOCKET_ACTION,\n FOLDER_DELETED_WEBSOCKET_ACTION,\n FOLDER_UPDATED_WEBSOCKET_ACTION,\n NotifyFolderChangeUseCase as UseCaseAbstraction\n} from \"./abstractions.js\";\n\nconst ACTIONS: Record<UseCaseAbstraction.Params[\"change\"], string> = {\n created: FOLDER_CREATED_WEBSOCKET_ACTION,\n updated: FOLDER_UPDATED_WEBSOCKET_ACTION,\n deleted: FOLDER_DELETED_WEBSOCKET_ACTION\n};\n\n/*\n * The change is already saved whether or not the message goes out, so the send's result is not the\n * caller's result. When it fails, the admin shows the change after its next reload, as it did before.\n */\nclass NotifyFolderChangeUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private sendToIdentity: WebsocketsSendToIdentityUseCase.Interface\n ) {}\n\n async execute({ id, change, identityId }: UseCaseAbstraction.Params): Promise<void> {\n const recipient = identityId ?? this.identityContext.getIdentity()?.id;\n if (!recipient) {\n return;\n }\n\n await this.sendToIdentity.execute(\n { id: recipient },\n { action: ACTIONS[change], data: { id } }\n );\n }\n}\n\nexport const NotifyFolderChangeUseCase = createImplementation({\n abstraction: UseCaseAbstraction,\n implementation: NotifyFolderChangeUseCaseImpl,\n dependencies: [IdentityContext, WebsocketsSendToIdentityUseCase]\n});\n"],"names":["ACTIONS","FOLDER_CREATED_WEBSOCKET_ACTION","FOLDER_UPDATED_WEBSOCKET_ACTION","FOLDER_DELETED_WEBSOCKET_ACTION","NotifyFolderChangeUseCaseImpl","identityContext","sendToIdentity","id","change","identityId","recipient","NotifyFolderChangeUseCase","createImplementation","UseCaseAbstraction","IdentityContext","WebsocketsSendToIdentityUseCase"],"mappings":";;;;AAUA,MAAMA,UAA+D;IACjE,SAASC;IACT,SAASC;IACT,SAASC;AACb;AAMA,MAAMC;IACF,YACYC,eAA0C,EAC1CC,cAAyD,CACnE;aAFUD,eAAe,GAAfA;aACAC,cAAc,GAAdA;IACT;IAEH,MAAM,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAAEC,UAAU,EAA6B,EAAiB;QAChF,MAAMC,YAAYD,cAAc,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QACpE,IAAI,CAACC,WACD;QAGJ,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAC7B;YAAE,IAAIA;QAAU,GAChB;YAAE,QAAQV,OAAO,CAACQ,OAAO;YAAE,MAAM;gBAAED;YAAG;QAAE;IAEhD;AACJ;AAEO,MAAMI,sDAA4BC,qBAAqB;IAC1D,aAAaC;IACb,gBAAgBT;IAChB,cAAc;QAACU;QAAiBC;KAAgC;AACpE"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { DeleteFlpUseCase } from "../DeleteFlp/abstractions.js";
|
|
2
1
|
import { FolderAfterDeleteEventHandler } from "../../../features/folder/DeleteFolder/abstractions.js";
|
|
3
2
|
import type { FolderAfterDeleteEvent } from "../../../features/folder/DeleteFolder/events.js";
|
|
4
|
-
import {
|
|
5
|
-
declare class
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
constructor(deleteFlpUseCase: DeleteFlpUseCase.Interface, tasks?: TaskService.Interface | undefined);
|
|
3
|
+
import { NotifyFolderChangeUseCase } from "./abstractions.js";
|
|
4
|
+
declare class NotifyOnFolderDeletedHandlerImpl implements FolderAfterDeleteEventHandler.Interface {
|
|
5
|
+
private notifyFolderChange;
|
|
6
|
+
constructor(notifyFolderChange: NotifyFolderChangeUseCase.Interface);
|
|
9
7
|
handle(event: FolderAfterDeleteEvent): Promise<void>;
|
|
10
8
|
}
|
|
11
|
-
export declare const
|
|
9
|
+
export declare const NotifyOnFolderDeletedHandler: typeof NotifyOnFolderDeletedHandlerImpl & {
|
|
12
10
|
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher/abstractions.js").IEventHandler<import("@webiny/api-core/features/eventPublisher/abstractions.js").DomainEvent<import("~/features/folder/DeleteFolder/abstractions.js").FolderAfterDeletePayload>>>;
|
|
13
11
|
};
|
|
14
12
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FolderAfterDeleteEventHandler } from "../DeleteFolder/abstractions.js";
|
|
2
|
+
import { NotifyFolderChangeUseCase } from "./abstractions.js";
|
|
3
|
+
class NotifyOnFolderDeletedHandlerImpl {
|
|
4
|
+
constructor(notifyFolderChange){
|
|
5
|
+
this.notifyFolderChange = notifyFolderChange;
|
|
6
|
+
}
|
|
7
|
+
async handle(event) {
|
|
8
|
+
try {
|
|
9
|
+
await this.notifyFolderChange.execute({
|
|
10
|
+
id: event.payload.folder.id,
|
|
11
|
+
change: "deleted"
|
|
12
|
+
});
|
|
13
|
+
} catch {}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const NotifyOnFolderDeletedHandler = FolderAfterDeleteEventHandler.createImplementation({
|
|
17
|
+
implementation: NotifyOnFolderDeletedHandlerImpl,
|
|
18
|
+
dependencies: [
|
|
19
|
+
NotifyFolderChangeUseCase
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
export { NotifyOnFolderDeletedHandler };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=NotifyOnFolderDeletedHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js","sources":["../../../../src/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.ts"],"sourcesContent":["import { FolderAfterDeleteEventHandler } from \"~/features/folder/DeleteFolder/abstractions.js\";\nimport type { FolderAfterDeleteEvent } from \"~/features/folder/DeleteFolder/events.js\";\nimport { NotifyFolderChangeUseCase } from \"./abstractions.js\";\n\n/*\n * Created and updated folders are announced by the FLP tasks, once the admin can read them back. A\n * deleted folder is only dropped from the admin's cache, so there is nothing to wait for.\n */\nclass NotifyOnFolderDeletedHandlerImpl implements FolderAfterDeleteEventHandler.Interface {\n constructor(private notifyFolderChange: NotifyFolderChangeUseCase.Interface) {}\n\n async handle(event: FolderAfterDeleteEvent): Promise<void> {\n try {\n await this.notifyFolderChange.execute({\n id: event.payload.folder.id,\n change: \"deleted\"\n });\n } catch {\n // The folder is gone either way; the admin drops it on its next reload.\n }\n }\n}\n\nexport const NotifyOnFolderDeletedHandler = FolderAfterDeleteEventHandler.createImplementation({\n implementation: NotifyOnFolderDeletedHandlerImpl,\n dependencies: [NotifyFolderChangeUseCase]\n});\n"],"names":["NotifyOnFolderDeletedHandlerImpl","notifyFolderChange","event","NotifyOnFolderDeletedHandler","FolderAfterDeleteEventHandler","NotifyFolderChangeUseCase"],"mappings":";;AAQA,MAAMA;IACF,YAAoBC,kBAAuD,CAAE;aAAzDA,kBAAkB,GAAlBA;IAA0D;IAE9E,MAAM,OAAOC,KAA6B,EAAiB;QACvD,IAAI;YACA,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;gBAClC,IAAIA,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE;gBAC3B,QAAQ;YACZ;QACJ,EAAE,OAAM,CAER;IACJ;AACJ;AAEO,MAAMC,+BAA+BC,8BAA8B,oBAAoB,CAAC;IAC3F,gBAAgBJ;IAChB,cAAc;QAACK;KAA0B;AAC7C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sent to the user's open admin tabs when a folder changes. The admin keeps its own folder cache,
|
|
3
|
+
* and a change made on the server never passes through it, so without these the admin shows the old
|
|
4
|
+
* state until a reload. Each carries the folder id only; the admin reads the folder back.
|
|
5
|
+
*
|
|
6
|
+
* `created` and `updated` go out when the FLP tasks finish, since folder reads report permissions
|
|
7
|
+
* from the FLP records. `deleted` goes out right after the delete: nothing is read back.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FOLDER_CREATED_WEBSOCKET_ACTION = "aco.folder.created";
|
|
10
|
+
export declare const FOLDER_UPDATED_WEBSOCKET_ACTION = "aco.folder.updated";
|
|
11
|
+
export declare const FOLDER_DELETED_WEBSOCKET_ACTION = "aco.folder.deleted";
|
|
12
|
+
export interface NotifyFolderChangeParams {
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* Whose open tabs to tell. Defaults to the current identity. The FLP tasks pass the identity
|
|
16
|
+
* that made the change, because they run later, outside that request.
|
|
17
|
+
*/
|
|
18
|
+
identityId?: string;
|
|
19
|
+
change: "created" | "updated" | "deleted";
|
|
20
|
+
}
|
|
21
|
+
export interface INotifyFolderChangeUseCase {
|
|
22
|
+
execute(params: NotifyFolderChangeParams): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export declare const NotifyFolderChangeUseCase: import("@webiny/di").Abstraction<INotifyFolderChangeUseCase>;
|
|
25
|
+
export declare namespace NotifyFolderChangeUseCase {
|
|
26
|
+
type Interface = INotifyFolderChangeUseCase;
|
|
27
|
+
type Params = NotifyFolderChangeParams;
|
|
28
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const FOLDER_CREATED_WEBSOCKET_ACTION = "aco.folder.created";
|
|
3
|
+
const FOLDER_UPDATED_WEBSOCKET_ACTION = "aco.folder.updated";
|
|
4
|
+
const FOLDER_DELETED_WEBSOCKET_ACTION = "aco.folder.deleted";
|
|
5
|
+
const NotifyFolderChangeUseCase = createAbstraction("Aco/NotifyFolderChangeUseCase");
|
|
6
|
+
export { FOLDER_CREATED_WEBSOCKET_ACTION, FOLDER_DELETED_WEBSOCKET_ACTION, FOLDER_UPDATED_WEBSOCKET_ACTION, NotifyFolderChangeUseCase };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/folder/NotifyFolderChange/abstractions.js","sources":["../../../../src/features/folder/NotifyFolderChange/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\n/**\n * Sent to the user's open admin tabs when a folder changes. The admin keeps its own folder cache,\n * and a change made on the server never passes through it, so without these the admin shows the old\n * state until a reload. Each carries the folder id only; the admin reads the folder back.\n *\n * `created` and `updated` go out when the FLP tasks finish, since folder reads report permissions\n * from the FLP records. `deleted` goes out right after the delete: nothing is read back.\n */\nexport const FOLDER_CREATED_WEBSOCKET_ACTION = \"aco.folder.created\";\nexport const FOLDER_UPDATED_WEBSOCKET_ACTION = \"aco.folder.updated\";\nexport const FOLDER_DELETED_WEBSOCKET_ACTION = \"aco.folder.deleted\";\n\nexport interface NotifyFolderChangeParams {\n id: string;\n /**\n * Whose open tabs to tell. Defaults to the current identity. The FLP tasks pass the identity\n * that made the change, because they run later, outside that request.\n */\n identityId?: string;\n change: \"created\" | \"updated\" | \"deleted\";\n}\n\nexport interface INotifyFolderChangeUseCase {\n execute(params: NotifyFolderChangeParams): Promise<void>;\n}\n\nexport const NotifyFolderChangeUseCase = createAbstraction<INotifyFolderChangeUseCase>(\n \"Aco/NotifyFolderChangeUseCase\"\n);\n\nexport namespace NotifyFolderChangeUseCase {\n export type Interface = INotifyFolderChangeUseCase;\n export type Params = NotifyFolderChangeParams;\n}\n"],"names":["FOLDER_CREATED_WEBSOCKET_ACTION","FOLDER_UPDATED_WEBSOCKET_ACTION","FOLDER_DELETED_WEBSOCKET_ACTION","NotifyFolderChangeUseCase","createAbstraction"],"mappings":";AAUO,MAAMA,kCAAkC;AACxC,MAAMC,kCAAkC;AACxC,MAAMC,kCAAkC;AAgBxC,MAAMC,4BAA4BC,kBACrC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tells the user's open admin tabs when a folder is created, updated or deleted. The FLP tasks send
|
|
3
|
+
* created and updated (triggered by `TaskFolderCatalogSync`); deleted goes out from here.
|
|
4
|
+
*/
|
|
5
|
+
export declare const NotifyFolderChangeFeature: {
|
|
6
|
+
name: string;
|
|
7
|
+
register(container: import("@webiny/di").Container): void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { NotifyFolderChangeUseCase } from "./NotifyFolderChangeUseCase.js";
|
|
3
|
+
import { NotifyOnFolderDeletedHandler } from "./NotifyOnFolderDeletedHandler.js";
|
|
4
|
+
const NotifyFolderChangeFeature = createFeature({
|
|
5
|
+
name: "NotifyFolderChange",
|
|
6
|
+
register (container) {
|
|
7
|
+
container.register(NotifyFolderChangeUseCase);
|
|
8
|
+
container.register(NotifyOnFolderDeletedHandler);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export { NotifyFolderChangeFeature };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/folder/NotifyFolderChange/feature.js","sources":["../../../../src/features/folder/NotifyFolderChange/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { NotifyFolderChangeUseCase } from \"./NotifyFolderChangeUseCase.js\";\nimport { NotifyOnFolderDeletedHandler } from \"./NotifyOnFolderDeletedHandler.js\";\n\n/**\n * Tells the user's open admin tabs when a folder is created, updated or deleted. The FLP tasks send\n * created and updated (triggered by `TaskFolderCatalogSync`); deleted goes out from here.\n */\nexport const NotifyFolderChangeFeature = createFeature({\n name: \"NotifyFolderChange\",\n register(container) {\n container.register(NotifyFolderChangeUseCase);\n container.register(NotifyOnFolderDeletedHandler);\n }\n});\n"],"names":["NotifyFolderChangeFeature","createFeature","container","NotifyFolderChangeUseCase","NotifyOnFolderDeletedHandler"],"mappings":";;;AAQO,MAAMA,4BAA4BC,cAAc;IACnD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ"}
|
|
@@ -9,6 +9,7 @@ declare class UpdateFolderUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
|
9
9
|
private repository;
|
|
10
10
|
constructor(eventPublisher: EventPublisherAbstraction.Interface, getFolderRepository: GetFolderRepository.Interface, repository: UpdateFolderRepository.Interface);
|
|
11
11
|
execute(id: string, input: UpdateFolderParams): Promise<Result<Folder, UseCaseAbstraction.Error>>;
|
|
12
|
+
private ensureCanMoveInto;
|
|
12
13
|
}
|
|
13
14
|
export declare const UpdateFolderUseCase: import("@webiny/di").Implementation<typeof UpdateFolderUseCaseImpl>;
|
|
14
15
|
export {};
|
|
@@ -3,6 +3,7 @@ import { EventPublisher } from "@webiny/api-core/features/eventPublisher/index.j
|
|
|
3
3
|
import { UpdateFolderRepository, UpdateFolderUseCase } from "./abstractions.js";
|
|
4
4
|
import { GetFolderRepository } from "../GetFolder/abstractions.js";
|
|
5
5
|
import { FolderAfterUpdateEvent, FolderBeforeUpdateEvent } from "./events.js";
|
|
6
|
+
import { FolderValidationError } from "../../../domain/folder/errors.js";
|
|
6
7
|
class UpdateFolderUseCaseImpl {
|
|
7
8
|
constructor(eventPublisher, getFolderRepository, repository){
|
|
8
9
|
this.eventPublisher = eventPublisher;
|
|
@@ -17,6 +18,10 @@ class UpdateFolderUseCaseImpl {
|
|
|
17
18
|
const originalResult = await this.getFolderRepository.execute(id);
|
|
18
19
|
if (originalResult.isFail()) return originalResult;
|
|
19
20
|
const original = originalResult.value;
|
|
21
|
+
if (input.parentId && input.parentId !== original.parentId) {
|
|
22
|
+
const moveResult = await this.ensureCanMoveInto(original, input.parentId);
|
|
23
|
+
if (moveResult.isFail()) return Result.fail(moveResult.error);
|
|
24
|
+
}
|
|
20
25
|
const beforeUpdateEvent = new FolderBeforeUpdateEvent({
|
|
21
26
|
original,
|
|
22
27
|
input: useCaseInput
|
|
@@ -33,6 +38,14 @@ class UpdateFolderUseCaseImpl {
|
|
|
33
38
|
await this.eventPublisher.publish(afterUpdateEvent);
|
|
34
39
|
return Result.ok(folder);
|
|
35
40
|
}
|
|
41
|
+
async ensureCanMoveInto(folder, parentId) {
|
|
42
|
+
if (parentId === folder.id) return Result.fail(new FolderValidationError("A folder cannot be moved into itself."));
|
|
43
|
+
const parentResult = await this.getFolderRepository.execute(parentId);
|
|
44
|
+
if (parentResult.isFail()) return Result.fail(parentResult.error);
|
|
45
|
+
const parent = parentResult.value;
|
|
46
|
+
if (parent.path.startsWith(`${folder.path}/`)) return Result.fail(new FolderValidationError(`Folder "${parent.title}" is inside the folder being moved, so it cannot be its new parent.`));
|
|
47
|
+
return Result.ok();
|
|
48
|
+
}
|
|
36
49
|
}
|
|
37
50
|
const UpdateFolderUseCase_UpdateFolderUseCase = createImplementation({
|
|
38
51
|
abstraction: UpdateFolderUseCase,
|