@webiny/api-aco 6.6.0-alpha.0 → 6.6.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AcoFeature.js +23 -38
- package/AcoFeature.js.map +1 -1
- package/AcoFolderSchemaFactory.d.ts +32 -0
- package/AcoFolderSchemaFactory.js +82 -0
- package/AcoFolderSchemaFactory.js.map +1 -0
- package/createAcoGraphQL.d.ts +3 -2
- package/createAcoGraphQL.js.map +1 -1
- package/domain/folder/abstractions.d.ts +12 -5
- package/domain/folder/abstractions.js +2 -2
- package/domain/folder/abstractions.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 +49 -0
- package/features/ai/CreateFolderTool.js +58 -0
- package/features/ai/CreateFolderTool.js.map +1 -0
- package/features/ai/CreateTeamTool.d.ts +48 -0
- package/features/ai/CreateTeamTool.js +56 -0
- package/features/ai/CreateTeamTool.js.map +1 -0
- 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/GrantFolderAccessTool.d.ts +77 -0
- package/features/ai/GrantFolderAccessTool.js +80 -0
- package/features/ai/GrantFolderAccessTool.js.map +1 -0
- package/features/ai/ListFoldersTool.d.ts +47 -0
- package/features/ai/ListFoldersTool.js +57 -0
- package/features/ai/ListFoldersTool.js.map +1 -0
- package/features/ai/ListRolesTool.d.ts +39 -0
- package/features/ai/ListRolesTool.js +48 -0
- package/features/ai/ListRolesTool.js.map +1 -0
- package/features/ai/ListTeamsTool.d.ts +39 -0
- package/features/ai/ListTeamsTool.js +48 -0
- package/features/ai/ListTeamsTool.js.map +1 -0
- package/features/ai/RevokeFolderAccessTool.d.ts +63 -0
- package/features/ai/RevokeFolderAccessTool.js +69 -0
- package/features/ai/RevokeFolderAccessTool.js.map +1 -0
- package/features/ai/assertTargetIsUsable.d.ts +10 -0
- package/features/ai/assertTargetIsUsable.js +14 -0
- package/features/ai/assertTargetIsUsable.js.map +1 -0
- package/features/ai/feature.d.ts +12 -0
- package/features/ai/feature.js +25 -0
- package/features/ai/feature.js.map +1 -0
- package/features/ai/index.d.ts +9 -0
- package/features/ai/index.js +9 -0
- package/features/ai/loadFolderPermissions.d.ts +16 -0
- package/features/ai/loadFolderPermissions.js +14 -0
- package/features/ai/loadFolderPermissions.js.map +1 -0
- 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 +8 -5
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +25 -11
- 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/{UpdateFlpOnFolderUpdated → 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/CreateFolderRepository.d.ts +3 -3
- package/features/folder/CreateFolder/CreateFolderRepository.js +10 -7
- package/features/folder/CreateFolder/CreateFolderRepository.js.map +1 -1
- 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/DeleteFolder/DeleteFolderRepository.d.ts +3 -3
- package/features/folder/DeleteFolder/DeleteFolderRepository.js +6 -5
- package/features/folder/DeleteFolder/DeleteFolderRepository.js.map +1 -1
- package/features/folder/FolderModelProvider.d.ts +26 -0
- package/features/folder/FolderModelProvider.js +22 -0
- package/features/folder/FolderModelProvider.js.map +1 -0
- package/features/folder/GetAncestors/GetAncestorsRepository.d.ts +3 -3
- package/features/folder/GetAncestors/GetAncestorsRepository.js +6 -5
- package/features/folder/GetAncestors/GetAncestorsRepository.js.map +1 -1
- package/features/folder/GetFolder/GetFolderRepository.d.ts +3 -3
- package/features/folder/GetFolder/GetFolderRepository.js +6 -5
- package/features/folder/GetFolder/GetFolderRepository.js.map +1 -1
- package/features/folder/GetFolderHierarchy/GetFolderHierarchyRepository.d.ts +3 -3
- package/features/folder/GetFolderHierarchy/GetFolderHierarchyRepository.js +10 -8
- package/features/folder/GetFolderHierarchy/GetFolderHierarchyRepository.js.map +1 -1
- package/features/folder/ListFolders/ListFoldersRepository.d.ts +3 -3
- package/features/folder/ListFolders/ListFoldersRepository.js +8 -7
- package/features/folder/ListFolders/ListFoldersRepository.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/UpdateFolderRepository.d.ts +3 -3
- package/features/folder/UpdateFolder/UpdateFolderRepository.js +11 -8
- package/features/folder/UpdateFolder/UpdateFolderRepository.js.map +1 -1
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.d.ts +14 -1
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js +52 -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 +25 -16
- 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 +10 -11
- package/{features/flp/UpdateFlp → flpTaskCatalog/useCases}/UpdateFlpUseCase.js +27 -33
- package/flpTaskCatalog/useCases/UpdateFlpUseCase.js.map +1 -0
- package/folder/createFolderTypeDefs.js +4 -1
- package/folder/createFolderTypeDefs.js.map +1 -1
- package/folder/folder.gql.js +2 -2
- package/folder/folder.gql.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +23 -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/AcoInitializer.d.ts +0 -25
- package/AcoInitializer.js +0 -79
- package/AcoInitializer.js.map +0 -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.d.ts +0 -4
- 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.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,63 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { FolderAccessListFilter } from "../features/flp/FolderAccessListFilter/abstractions.js";
|
|
3
|
+
import { FolderLevelPermissions } from "../features/flp/FolderLevelPermissions/abstractions.js";
|
|
4
|
+
import { ListEntriesFactory } from "./listEntries/ListEntriesFactory.js";
|
|
5
|
+
import { ROOT_FOLDER } from "../constants.js";
|
|
6
|
+
class PostLoadFolderAccessListFilterImpl {
|
|
7
|
+
constructor(folderLevelPermissions){
|
|
8
|
+
this.folderLevelPermissions = folderLevelPermissions;
|
|
9
|
+
this.folderPermissions = new Map();
|
|
10
|
+
this.listEntriesHandler = new ListEntriesFactory(folderLevelPermissions);
|
|
11
|
+
}
|
|
12
|
+
async listEntries({ model, params, loader }) {
|
|
13
|
+
return this.listEntriesHandler.execute({
|
|
14
|
+
model,
|
|
15
|
+
dataLoader: loader,
|
|
16
|
+
initialParams: params
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async listFolders(params, loader) {
|
|
20
|
+
const result = await loader(params);
|
|
21
|
+
if (result.isFail()) return Result.fail(result.error);
|
|
22
|
+
const { folders, meta } = result.value;
|
|
23
|
+
const rootFlps = await this.folderLevelPermissions.listFolderLevelPermissions({
|
|
24
|
+
where: {
|
|
25
|
+
type: params.where.type,
|
|
26
|
+
parentId: ROOT_FOLDER
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
rootFlps.forEach((flp)=>this.folderPermissions.set(flp.id, flp.permissions));
|
|
30
|
+
await Promise.all(folders.map(async (folder)=>{
|
|
31
|
+
if (!this.folderPermissions.has(folder.id)) {
|
|
32
|
+
const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(folder.id);
|
|
33
|
+
this.folderPermissions.set(folder.id, permissions);
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
const foldersWithPermissions = await Promise.all(folders.map(async (folder)=>{
|
|
37
|
+
const permissions = this.folderPermissions.get(folder.id);
|
|
38
|
+
if (!permissions) return null;
|
|
39
|
+
const canAccessFolder = await this.folderLevelPermissions.canAccessFolder({
|
|
40
|
+
permissions,
|
|
41
|
+
rwd: "r"
|
|
42
|
+
});
|
|
43
|
+
if (!canAccessFolder) return null;
|
|
44
|
+
return {
|
|
45
|
+
...folder,
|
|
46
|
+
permissions
|
|
47
|
+
};
|
|
48
|
+
}));
|
|
49
|
+
return Result.ok({
|
|
50
|
+
folders: foldersWithPermissions.filter(Boolean),
|
|
51
|
+
meta
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const PostLoadFolderAccessListFilter = FolderAccessListFilter.createImplementation({
|
|
56
|
+
implementation: PostLoadFolderAccessListFilterImpl,
|
|
57
|
+
dependencies: [
|
|
58
|
+
FolderLevelPermissions
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
export { PostLoadFolderAccessListFilter };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=PostLoadFolderAccessListFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/PostLoadFolderAccessListFilter.js","sources":["../../src/flpTaskCatalog/PostLoadFolderAccessListFilter.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport type { CmsEntryValues } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IListEntriesResult } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/abstractions.js\";\nimport { FolderAccessListFilter } from \"~/features/flp/FolderAccessListFilter/abstractions.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/abstractions.js\";\nimport { ListEntriesFactory } from \"./listEntries/ListEntriesFactory.js\";\nimport type { ListFoldersUseCase } from \"~/features/folder/ListFolders/abstractions.js\";\nimport type { Folder, ListFoldersParams } from \"~/folder/folder.types.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\n\n/**\n * Loads a page, then drops the items in folders the identity cannot read. Entries are loaded page by\n * page until the requested number is reached.\n *\n * Permissions are cached per folder for the lifetime of this instance.\n */\nclass PostLoadFolderAccessListFilterImpl implements FolderAccessListFilter.Interface {\n private readonly listEntriesHandler: ListEntriesFactory;\n private readonly folderPermissions: Map<string, FolderPermission[]> = new Map();\n\n constructor(private folderLevelPermissions: FolderLevelPermissions.Interface) {\n this.listEntriesHandler = new ListEntriesFactory(folderLevelPermissions);\n }\n\n async listEntries<T extends CmsEntryValues>({\n model,\n params,\n loader\n }: FolderAccessListFilter.ListEntriesParams<T>): Promise<IListEntriesResult<T>> {\n return this.listEntriesHandler.execute<T>({\n model,\n dataLoader: loader,\n initialParams: params\n });\n }\n\n async listFolders(\n params: ListFoldersParams,\n loader: FolderAccessListFilter.ListFoldersLoader\n ): ListFoldersUseCase.Return {\n const result = await loader(params);\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const { folders, meta } = result.value;\n\n // Fetch FLP records for ROOT folders and populate the cache.\n const rootFlps = await this.folderLevelPermissions.listFolderLevelPermissions({\n where: {\n type: params.where.type,\n parentId: ROOT_FOLDER\n }\n });\n\n rootFlps.forEach(flp => this.folderPermissions.set(flp.id, flp.permissions));\n\n // Fetch FLP for folders not already in the cache.\n await Promise.all(\n folders.map(async folder => {\n if (!this.folderPermissions.has(folder.id)) {\n const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(\n folder.id\n );\n this.folderPermissions.set(folder.id, permissions);\n }\n })\n );\n\n // Filter folders based on permissions.\n const foldersWithPermissions = await Promise.all(\n folders.map(async folder => {\n const permissions = this.folderPermissions.get(folder.id);\n if (!permissions) {\n return null;\n }\n\n const canAccessFolder = await this.folderLevelPermissions.canAccessFolder({\n permissions,\n rwd: \"r\"\n });\n\n if (!canAccessFolder) {\n return null;\n }\n\n return { ...folder, permissions };\n })\n );\n\n return Result.ok({ folders: foldersWithPermissions.filter(Boolean) as Folder[], meta });\n }\n}\n\nexport const PostLoadFolderAccessListFilter = FolderAccessListFilter.createImplementation({\n implementation: PostLoadFolderAccessListFilterImpl,\n dependencies: [FolderLevelPermissions]\n});\n"],"names":["PostLoadFolderAccessListFilterImpl","folderLevelPermissions","Map","ListEntriesFactory","model","params","loader","result","Result","folders","meta","rootFlps","ROOT_FOLDER","flp","Promise","folder","permissions","foldersWithPermissions","canAccessFolder","Boolean","PostLoadFolderAccessListFilter","FolderAccessListFilter","FolderLevelPermissions"],"mappings":";;;;;AAiBA,MAAMA;IAIF,YAAoBC,sBAAwD,CAAE;aAA1DA,sBAAsB,GAAtBA;aAFH,iBAAiB,GAAoC,IAAIC;QAGtE,IAAI,CAAC,kBAAkB,GAAG,IAAIC,mBAAmBF;IACrD;IAEA,MAAM,YAAsC,EACxCG,KAAK,EACLC,MAAM,EACNC,MAAM,EACoC,EAAkC;QAC5E,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAI;YACtCF;YACA,YAAYE;YACZ,eAAeD;QACnB;IACJ;IAEA,MAAM,YACFA,MAAyB,EACzBC,MAAgD,EACvB;QACzB,MAAMC,SAAS,MAAMD,OAAOD;QAC5B,IAAIE,OAAO,MAAM,IACb,OAAOC,OAAO,IAAI,CAACD,OAAO,KAAK;QAGnC,MAAM,EAAEE,OAAO,EAAEC,IAAI,EAAE,GAAGH,OAAO,KAAK;QAGtC,MAAMI,WAAW,MAAM,IAAI,CAAC,sBAAsB,CAAC,0BAA0B,CAAC;YAC1E,OAAO;gBACH,MAAMN,OAAO,KAAK,CAAC,IAAI;gBACvB,UAAUO;YACd;QACJ;QAEAD,SAAS,OAAO,CAACE,CAAAA,MAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAACA,IAAI,EAAE,EAAEA,IAAI,WAAW;QAG1E,MAAMC,QAAQ,GAAG,CACbL,QAAQ,GAAG,CAAC,OAAMM;YACd,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAACA,OAAO,EAAE,GAAG;gBACxC,MAAMC,cAAc,MAAM,IAAI,CAAC,sBAAsB,CAAC,yBAAyB,CAC3ED,OAAO,EAAE;gBAEb,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAACA,OAAO,EAAE,EAAEC;YAC1C;QACJ;QAIJ,MAAMC,yBAAyB,MAAMH,QAAQ,GAAG,CAC5CL,QAAQ,GAAG,CAAC,OAAMM;YACd,MAAMC,cAAc,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAACD,OAAO,EAAE;YACxD,IAAI,CAACC,aACD,OAAO;YAGX,MAAME,kBAAkB,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC;gBACtEF;gBACA,KAAK;YACT;YAEA,IAAI,CAACE,iBACD,OAAO;YAGX,OAAO;gBAAE,GAAGH,MAAM;gBAAEC;YAAY;QACpC;QAGJ,OAAOR,OAAO,EAAE,CAAC;YAAE,SAASS,uBAAuB,MAAM,CAACE;YAAsBT;QAAK;IACzF;AACJ;AAEO,MAAMU,iCAAiCC,uBAAuB,oBAAoB,CAAC;IACtF,gBAAgBrB;IAChB,cAAc;QAACsB;KAAuB;AAC1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Container } from "@webiny/di";
|
|
2
|
+
/**
|
|
3
|
+
* The FLP strategy built on a catalog: one record per folder with the inherited permissions copied
|
|
4
|
+
* in, kept in step with folder changes by background tasks, and lists filtered after loading.
|
|
5
|
+
*
|
|
6
|
+
* Storages register it next to their `FlpStorageOperations`. `AcoFeature` does not register any
|
|
7
|
+
* FLP strategy, so a setup without one fails at the first permission check.
|
|
8
|
+
*/
|
|
9
|
+
export declare const TaskCatalogFlpFeature: {
|
|
10
|
+
name: string;
|
|
11
|
+
register(container: Container): void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
3
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
4
|
+
import { UpdateEntryUseCase } from "@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js";
|
|
5
|
+
import { AcoFlpCrud, FlpStorageOperations } from "../features/folder/shared/abstractions.js";
|
|
6
|
+
import { CreateFlpUseCase } from "../features/flp/CreateFlp/abstractions.js";
|
|
7
|
+
import { UpdateFlpUseCase } from "../features/flp/UpdateFlp/abstractions.js";
|
|
8
|
+
import { DeleteFlpUseCase } from "../features/flp/DeleteFlp/abstractions.js";
|
|
9
|
+
import { ListFoldersUseCase } from "../features/folder/ListFolders/abstractions.js";
|
|
10
|
+
import { FolderModelProvider } from "../domain/folder/abstractions.js";
|
|
11
|
+
import { createFlpCrudMethods } from "./flp.crud.js";
|
|
12
|
+
import { CreateFlpUseCase as CreateFlpUseCase_js_CreateFlpUseCase } from "./useCases/CreateFlpUseCase.js";
|
|
13
|
+
import { UpdateFlpUseCase as UpdateFlpUseCase_js_UpdateFlpUseCase } from "./useCases/UpdateFlpUseCase.js";
|
|
14
|
+
import { DeleteFlpUseCase as DeleteFlpUseCase_js_DeleteFlpUseCase } from "./useCases/DeleteFlpUseCase.js";
|
|
15
|
+
import { CreateFlpTask } from "./tasks/createFlp.task.js";
|
|
16
|
+
import { UpdateFlpTask } from "./tasks/updateFlp.task.js";
|
|
17
|
+
import { DeleteFlpTask } from "./tasks/deleteFlp.task.js";
|
|
18
|
+
import { SyncFlpTask } from "./tasks/syncFlp.task.js";
|
|
19
|
+
import { CatalogFolderPermissionsRepository } from "./CatalogFolderPermissionsRepository.js";
|
|
20
|
+
import { TaskFolderCatalogSync } from "./TaskFolderCatalogSync.js";
|
|
21
|
+
import { PostLoadFolderAccessListFilter } from "./PostLoadFolderAccessListFilter.js";
|
|
22
|
+
const TaskCatalogFlpFeature = createFeature({
|
|
23
|
+
name: "Aco/TaskCatalogFlp",
|
|
24
|
+
register (container) {
|
|
25
|
+
let flpCrudMethods;
|
|
26
|
+
container.registerFactory(AcoFlpCrud, ()=>{
|
|
27
|
+
if (!flpCrudMethods) flpCrudMethods = createFlpCrudMethods({
|
|
28
|
+
getTenant: ()=>container.resolve(TenantContext).getTenant(),
|
|
29
|
+
storageOperations: {
|
|
30
|
+
flp: container.resolve(FlpStorageOperations)
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return flpCrudMethods;
|
|
34
|
+
});
|
|
35
|
+
container.registerFactory(CreateFlpUseCase, ()=>new CreateFlpUseCase_js_CreateFlpUseCase(container.resolve(AcoFlpCrud)));
|
|
36
|
+
container.registerFactory(UpdateFlpUseCase, ()=>new UpdateFlpUseCase_js_UpdateFlpUseCase(container.resolve(AcoFlpCrud), container.resolve(ListFoldersUseCase), container.resolve(FolderModelProvider), container.resolve(UpdateEntryUseCase), container.resolve(IdentityContext)));
|
|
37
|
+
container.registerFactory(DeleteFlpUseCase, ()=>new DeleteFlpUseCase_js_DeleteFlpUseCase(container.resolve(AcoFlpCrud)));
|
|
38
|
+
container.register(CreateFlpTask);
|
|
39
|
+
container.register(UpdateFlpTask);
|
|
40
|
+
container.register(DeleteFlpTask);
|
|
41
|
+
container.register(SyncFlpTask);
|
|
42
|
+
container.register(CatalogFolderPermissionsRepository);
|
|
43
|
+
container.register(TaskFolderCatalogSync);
|
|
44
|
+
container.register(PostLoadFolderAccessListFilter);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export { TaskCatalogFlpFeature };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=TaskCatalogFlpFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/TaskCatalogFlpFeature.js","sources":["../../src/flpTaskCatalog/TaskCatalogFlpFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport type { Container } from \"@webiny/di\";\nimport type { Tenant } from \"@webiny/api-core/types/tenancy.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { UpdateEntryUseCase } from \"@webiny/api-headless-cms/features/contentEntry/UpdateEntry/index.js\";\nimport { AcoFlpCrud, FlpStorageOperations } from \"~/features/folder/shared/abstractions.js\";\nimport { CreateFlpUseCase as CreateFlpUseCaseAbstraction } from \"~/features/flp/CreateFlp/abstractions.js\";\nimport { UpdateFlpUseCase as UpdateFlpUseCaseAbstraction } from \"~/features/flp/UpdateFlp/abstractions.js\";\nimport { DeleteFlpUseCase as DeleteFlpUseCaseAbstraction } from \"~/features/flp/DeleteFlp/abstractions.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/abstractions.js\";\nimport { FolderModelProvider } from \"~/domain/folder/abstractions.js\";\nimport { createFlpCrudMethods } from \"./flp.crud.js\";\nimport { CreateFlpUseCase } from \"./useCases/CreateFlpUseCase.js\";\nimport { UpdateFlpUseCase } from \"./useCases/UpdateFlpUseCase.js\";\nimport { DeleteFlpUseCase } from \"./useCases/DeleteFlpUseCase.js\";\nimport { CreateFlpTask } from \"./tasks/createFlp.task.js\";\nimport { UpdateFlpTask } from \"./tasks/updateFlp.task.js\";\nimport { DeleteFlpTask } from \"./tasks/deleteFlp.task.js\";\nimport { SyncFlpTask } from \"./tasks/syncFlp.task.js\";\nimport { CatalogFolderPermissionsRepository } from \"./CatalogFolderPermissionsRepository.js\";\nimport { TaskFolderCatalogSync } from \"./TaskFolderCatalogSync.js\";\nimport { PostLoadFolderAccessListFilter } from \"./PostLoadFolderAccessListFilter.js\";\n\n/**\n * The FLP strategy built on a catalog: one record per folder with the inherited permissions copied\n * in, kept in step with folder changes by background tasks, and lists filtered after loading.\n *\n * Storages register it next to their `FlpStorageOperations`. `AcoFeature` does not register any\n * FLP strategy, so a setup without one fails at the first permission check.\n */\nexport const TaskCatalogFlpFeature = createFeature({\n name: \"Aco/TaskCatalogFlp\",\n register(container: Container) {\n // The catalog. Built on first resolve (post-auth), memoised per container.\n let flpCrudMethods: ReturnType<typeof createFlpCrudMethods> | undefined;\n container.registerFactory(AcoFlpCrud, () => {\n if (!flpCrudMethods) {\n flpCrudMethods = createFlpCrudMethods({\n getTenant: (): Tenant => container.resolve(TenantContext).getTenant(),\n storageOperations: { flp: container.resolve(FlpStorageOperations) }\n });\n }\n return flpCrudMethods;\n });\n\n // Writes to the catalog.\n container.registerFactory(CreateFlpUseCaseAbstraction, () => {\n return new CreateFlpUseCase(container.resolve(AcoFlpCrud));\n });\n container.registerFactory(UpdateFlpUseCaseAbstraction, () => {\n return new UpdateFlpUseCase(\n container.resolve(AcoFlpCrud),\n container.resolve(ListFoldersUseCase),\n container.resolve(FolderModelProvider),\n container.resolve(UpdateEntryUseCase),\n container.resolve(IdentityContext)\n );\n });\n container.registerFactory(DeleteFlpUseCaseAbstraction, () => {\n return new DeleteFlpUseCase(container.resolve(AcoFlpCrud));\n });\n\n // Background tasks that keep the catalog in step.\n container.register(CreateFlpTask);\n container.register(UpdateFlpTask);\n container.register(DeleteFlpTask);\n container.register(SyncFlpTask);\n\n // The strategy itself.\n container.register(CatalogFolderPermissionsRepository);\n container.register(TaskFolderCatalogSync);\n container.register(PostLoadFolderAccessListFilter);\n }\n});\n"],"names":["TaskCatalogFlpFeature","createFeature","container","flpCrudMethods","AcoFlpCrud","createFlpCrudMethods","TenantContext","FlpStorageOperations","CreateFlpUseCaseAbstraction","CreateFlpUseCase","UpdateFlpUseCaseAbstraction","UpdateFlpUseCase","ListFoldersUseCase","FolderModelProvider","UpdateEntryUseCase","IdentityContext","DeleteFlpUseCaseAbstraction","DeleteFlpUseCase","CreateFlpTask","UpdateFlpTask","DeleteFlpTask","SyncFlpTask","CatalogFolderPermissionsRepository","TaskFolderCatalogSync","PostLoadFolderAccessListFilter"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAoB;QAEzB,IAAIC;QACJD,UAAU,eAAe,CAACE,YAAY;YAClC,IAAI,CAACD,gBACDA,iBAAiBE,qBAAqB;gBAClC,WAAW,IAAcH,UAAU,OAAO,CAACI,eAAe,SAAS;gBACnE,mBAAmB;oBAAE,KAAKJ,UAAU,OAAO,CAACK;gBAAsB;YACtE;YAEJ,OAAOJ;QACX;QAGAD,UAAU,eAAe,CAACM,kBAA6B,IAC5C,IAAIC,qCAAiBP,UAAU,OAAO,CAACE;QAElDF,UAAU,eAAe,CAACQ,kBAA6B,IAC5C,IAAIC,qCACPT,UAAU,OAAO,CAACE,aAClBF,UAAU,OAAO,CAACU,qBAClBV,UAAU,OAAO,CAACW,sBAClBX,UAAU,OAAO,CAACY,qBAClBZ,UAAU,OAAO,CAACa;QAG1Bb,UAAU,eAAe,CAACc,kBAA6B,IAC5C,IAAIC,qCAAiBf,UAAU,OAAO,CAACE;QAIlDF,UAAU,QAAQ,CAACgB;QACnBhB,UAAU,QAAQ,CAACiB;QACnBjB,UAAU,QAAQ,CAACkB;QACnBlB,UAAU,QAAQ,CAACmB;QAGnBnB,UAAU,QAAQ,CAACoB;QACnBpB,UAAU,QAAQ,CAACqB;QACnBrB,UAAU,QAAQ,CAACsB;IACvB;AACJ"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
2
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
3
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
4
|
+
import { FolderCatalogSync } from "../features/flp/FolderCatalogSync/abstractions.js";
|
|
5
|
+
import type { Folder } from "../folder/folder.types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Keeps the FLP catalog in step by triggering the FLP tasks.
|
|
8
|
+
*
|
|
9
|
+
* Folder reads report permissions from the FLP records, which the tasks write later. So the create
|
|
10
|
+
* and update tasks, not this class, tell the admin about the change, and they need to know whom to
|
|
11
|
+
* tell. A change rewrites the folder's record and every descendant's.
|
|
12
|
+
*
|
|
13
|
+
* The folder change is already saved, so it stands even when a task cannot be triggered. The logged
|
|
14
|
+
* error is then the only trace of why the catalog is behind.
|
|
15
|
+
*/
|
|
16
|
+
declare class TaskFolderCatalogSyncImpl implements FolderCatalogSync.Interface {
|
|
17
|
+
private identityContext;
|
|
18
|
+
private tasks;
|
|
19
|
+
private logger;
|
|
20
|
+
constructor(identityContext: IdentityContext.Interface, tasks: TaskService.Interface, logger: Logger.Interface);
|
|
21
|
+
folderCreated(folder: Folder): Promise<void>;
|
|
22
|
+
folderUpdated({ folder }: FolderCatalogSync.UpdatedParams): Promise<void>;
|
|
23
|
+
folderDeleted(folder: Folder): Promise<void>;
|
|
24
|
+
private trigger;
|
|
25
|
+
}
|
|
26
|
+
export declare const TaskFolderCatalogSync: typeof TaskFolderCatalogSyncImpl & {
|
|
27
|
+
__abstraction: import("@webiny/di").Abstraction<import("~/features/flp/FolderCatalogSync/abstractions.js").IFolderCatalogSync>;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
2
|
+
import { Logger } from "@webiny/api-core/features/logger/index.js";
|
|
3
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
4
|
+
import { FolderCatalogSync } from "../features/flp/FolderCatalogSync/abstractions.js";
|
|
5
|
+
import { CREATE_FLP_TASK_ID, DELETE_FLP_TASK_ID, UPDATE_FLP_TASK_ID } from "../flp/tasks/index.js";
|
|
6
|
+
class TaskFolderCatalogSyncImpl {
|
|
7
|
+
constructor(identityContext, tasks, logger){
|
|
8
|
+
this.identityContext = identityContext;
|
|
9
|
+
this.tasks = tasks;
|
|
10
|
+
this.logger = logger;
|
|
11
|
+
}
|
|
12
|
+
async folderCreated(folder) {
|
|
13
|
+
await this.trigger(CREATE_FLP_TASK_ID, {
|
|
14
|
+
folder,
|
|
15
|
+
notifyIdentityId: this.identityContext.getIdentity()?.id
|
|
16
|
+
}, "Could not trigger the task that creates the folder's FLP record.");
|
|
17
|
+
}
|
|
18
|
+
async folderUpdated({ folder }) {
|
|
19
|
+
await this.trigger(UPDATE_FLP_TASK_ID, {
|
|
20
|
+
folder,
|
|
21
|
+
notifyIdentityId: this.identityContext.getIdentity()?.id
|
|
22
|
+
}, "Could not trigger the task that updates the FLP records of the folder and its subtree.");
|
|
23
|
+
}
|
|
24
|
+
async folderDeleted(folder) {
|
|
25
|
+
await this.trigger(DELETE_FLP_TASK_ID, {
|
|
26
|
+
folder
|
|
27
|
+
}, "Could not trigger the task that deletes the folder's FLP record.");
|
|
28
|
+
}
|
|
29
|
+
async trigger(definition, input, failureMessage) {
|
|
30
|
+
try {
|
|
31
|
+
const result = await this.tasks.trigger({
|
|
32
|
+
definition,
|
|
33
|
+
input
|
|
34
|
+
});
|
|
35
|
+
if (result.isFail()) this.logger.error({
|
|
36
|
+
error: result.error,
|
|
37
|
+
folderId: input.folder.id
|
|
38
|
+
}, failureMessage);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
this.logger.error({
|
|
41
|
+
error,
|
|
42
|
+
folderId: input.folder.id
|
|
43
|
+
}, failureMessage);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const TaskFolderCatalogSync = FolderCatalogSync.createImplementation({
|
|
48
|
+
implementation: TaskFolderCatalogSyncImpl,
|
|
49
|
+
dependencies: [
|
|
50
|
+
IdentityContext,
|
|
51
|
+
TaskService,
|
|
52
|
+
Logger
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
export { TaskFolderCatalogSync };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=TaskFolderCatalogSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/TaskFolderCatalogSync.js","sources":["../../src/flpTaskCatalog/TaskFolderCatalogSync.ts"],"sourcesContent":["import { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport { FolderCatalogSync } from \"~/features/flp/FolderCatalogSync/abstractions.js\";\nimport type { Folder } from \"~/folder/folder.types.js\";\nimport type { ICreateFlpTaskInput, IDeleteFlpTaskInput, IUpdateFlpTaskInput } from \"~/types.js\";\nimport { CREATE_FLP_TASK_ID, DELETE_FLP_TASK_ID, UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\n\n/**\n * Keeps the FLP catalog in step by triggering the FLP tasks.\n *\n * Folder reads report permissions from the FLP records, which the tasks write later. So the create\n * and update tasks, not this class, tell the admin about the change, and they need to know whom to\n * tell. A change rewrites the folder's record and every descendant's.\n *\n * The folder change is already saved, so it stands even when a task cannot be triggered. The logged\n * error is then the only trace of why the catalog is behind.\n */\nclass TaskFolderCatalogSyncImpl implements FolderCatalogSync.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private tasks: TaskService.Interface,\n private logger: Logger.Interface\n ) {}\n\n async folderCreated(folder: Folder): Promise<void> {\n await this.trigger<ICreateFlpTaskInput>(\n CREATE_FLP_TASK_ID,\n // Nobody to tell when there is no identity, as in some system calls.\n { folder, notifyIdentityId: this.identityContext.getIdentity()?.id },\n \"Could not trigger the task that creates the folder's FLP record.\"\n );\n }\n\n async folderUpdated({ folder }: FolderCatalogSync.UpdatedParams): Promise<void> {\n await this.trigger<IUpdateFlpTaskInput>(\n UPDATE_FLP_TASK_ID,\n // Nobody to tell when there is no identity, as in some system calls.\n { folder, notifyIdentityId: this.identityContext.getIdentity()?.id },\n \"Could not trigger the task that updates the FLP records of the folder and its subtree.\"\n );\n }\n\n async folderDeleted(folder: Folder): Promise<void> {\n await this.trigger<IDeleteFlpTaskInput>(\n DELETE_FLP_TASK_ID,\n { folder },\n \"Could not trigger the task that deletes the folder's FLP record.\"\n );\n }\n\n private async trigger<TInput extends { folder: Folder }>(\n definition: string,\n input: TInput,\n failureMessage: string\n ): Promise<void> {\n try {\n const result = await this.tasks.trigger<TInput>({ definition, input });\n if (result.isFail()) {\n this.logger.error(\n { error: result.error, folderId: input.folder.id },\n failureMessage\n );\n }\n } catch (error) {\n this.logger.error({ error, folderId: input.folder.id }, failureMessage);\n }\n }\n}\n\nexport const TaskFolderCatalogSync = FolderCatalogSync.createImplementation({\n implementation: TaskFolderCatalogSyncImpl,\n dependencies: [IdentityContext, TaskService, Logger]\n});\n"],"names":["TaskFolderCatalogSyncImpl","identityContext","tasks","logger","folder","CREATE_FLP_TASK_ID","UPDATE_FLP_TASK_ID","DELETE_FLP_TASK_ID","definition","input","failureMessage","result","error","TaskFolderCatalogSync","FolderCatalogSync","IdentityContext","TaskService","Logger"],"mappings":";;;;;AAkBA,MAAMA;IACF,YACYC,eAA0C,EAC1CC,KAA4B,EAC5BC,MAAwB,CAClC;aAHUF,eAAe,GAAfA;aACAC,KAAK,GAALA;aACAC,MAAM,GAANA;IACT;IAEH,MAAM,cAAcC,MAAc,EAAiB;QAC/C,MAAM,IAAI,CAAC,OAAO,CACdC,oBAEA;YAAED;YAAQ,kBAAkB,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QAAG,GACnE;IAER;IAEA,MAAM,cAAc,EAAEA,MAAM,EAAmC,EAAiB;QAC5E,MAAM,IAAI,CAAC,OAAO,CACdE,oBAEA;YAAEF;YAAQ,kBAAkB,IAAI,CAAC,eAAe,CAAC,WAAW,IAAI;QAAG,GACnE;IAER;IAEA,MAAM,cAAcA,MAAc,EAAiB;QAC/C,MAAM,IAAI,CAAC,OAAO,CACdG,oBACA;YAAEH;QAAO,GACT;IAER;IAEA,MAAc,QACVI,UAAkB,EAClBC,KAAa,EACbC,cAAsB,EACT;QACb,IAAI;YACA,MAAMC,SAAS,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAS;gBAAEH;gBAAYC;YAAM;YACpE,IAAIE,OAAO,MAAM,IACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACb;gBAAE,OAAOA,OAAO,KAAK;gBAAE,UAAUF,MAAM,MAAM,CAAC,EAAE;YAAC,GACjDC;QAGZ,EAAE,OAAOE,OAAO;YACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAEA;gBAAO,UAAUH,MAAM,MAAM,CAAC,EAAE;YAAC,GAAGC;QAC5D;IACJ;AACJ;AAEO,MAAMG,wBAAwBC,kBAAkB,oBAAoB,CAAC;IACxE,gBAAgBd;IAChB,cAAc;QAACe;QAAiBC;QAAaC;KAAO;AACxD"}
|
|
@@ -2,6 +2,6 @@ import { type AcoFolderLevelPermissionsCrud, type AcoStorageOperations } from ".
|
|
|
2
2
|
import type { Tenant } from "@webiny/api-core/types/tenancy.js";
|
|
3
3
|
export interface CreateFlpCrudMethodsParams {
|
|
4
4
|
getTenant: () => Tenant;
|
|
5
|
-
storageOperations: AcoStorageOperations
|
|
5
|
+
storageOperations: Pick<AcoStorageOperations, "flp">;
|
|
6
6
|
}
|
|
7
7
|
export declare const createFlpCrudMethods: ({ storageOperations, getTenant }: CreateFlpCrudMethodsParams) => AcoFolderLevelPermissionsCrud;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/flp.crud.js","sources":["../../src/flpTaskCatalog/flp.crud.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport {\n type AcoFolderLevelPermissionsCrud,\n type AcoStorageOperations,\n type CreateFlpParams,\n type UpdateFlpParams\n} from \"~/types.js\";\nimport type { Tenant } from \"@webiny/api-core/types/tenancy.js\";\nimport { EntryId } from \"@webiny/api-headless-cms/exports/api/cms/entry.js\";\n\nexport interface CreateFlpCrudMethodsParams {\n getTenant: () => Tenant;\n storageOperations: Pick<AcoStorageOperations, \"flp\">;\n}\n\nexport const createFlpCrudMethods = ({\n storageOperations,\n getTenant\n}: CreateFlpCrudMethodsParams): AcoFolderLevelPermissionsCrud => {\n return {\n async create(params: CreateFlpParams) {\n return await storageOperations.flp.create({\n data: { ...params, tenant: getTenant().id }\n });\n },\n async update(id: string, data: UpdateFlpParams) {\n const original = await this.get(id);\n if (!original) {\n throw new WebinyError(\n `Folder level permission with id \"${id}\" not found.`,\n \"GET_ITEM_UPDATE_FLP_ERROR\",\n {\n id,\n data\n }\n );\n }\n\n return await storageOperations.flp.update({\n original,\n data: {\n ...data,\n tenant: getTenant().id\n }\n });\n },\n async batchUpdate(items: Array<{ id: string; data: UpdateFlpParams }>) {\n const batchItems = (\n await Promise.all(\n items.map(async ({ id, data }) => {\n const original = await this.get(id);\n if (!original) {\n return null;\n }\n return {\n original,\n data: {\n ...data,\n tenant: getTenant().id\n }\n };\n })\n )\n ).filter((item): item is NonNullable<typeof item> => item !== null);\n\n if (batchItems.length === 0) {\n return [];\n }\n\n return await storageOperations.flp.batchUpdate({\n items: batchItems\n });\n },\n async delete(id: string) {\n const flp = await this.get(id);\n if (!flp) {\n throw new WebinyError(\n `Folder level permission with id \"${id}\" not found.`,\n \"GET_ITEM_DELETE_FLP_ERROR\",\n {\n id\n }\n );\n }\n\n await storageOperations.flp.delete({\n flp: {\n ...flp,\n tenant: getTenant().id\n }\n });\n\n return true;\n },\n async get(id: string) {\n const entryId = EntryId.from(id);\n return await storageOperations.flp.get({\n id: entryId.id,\n tenant: getTenant().id\n });\n },\n async list({ where }) {\n return await storageOperations.flp.list({\n where: {\n ...where,\n tenant: getTenant().id\n }\n });\n }\n };\n};\n"],"names":["createFlpCrudMethods","storageOperations","getTenant","params","id","data","original","WebinyError","items","batchItems","Promise","item","flp","entryId","EntryId","where"],"mappings":";;AAeO,MAAMA,uBAAuB,CAAC,EACjCC,iBAAiB,EACjBC,SAAS,EACgB,GAClB;QACH,MAAM,QAAOC,MAAuB;YAChC,OAAO,MAAMF,kBAAkB,GAAG,CAAC,MAAM,CAAC;gBACtC,MAAM;oBAAE,GAAGE,MAAM;oBAAE,QAAQD,YAAY,EAAE;gBAAC;YAC9C;QACJ;QACA,MAAM,QAAOE,EAAU,EAAEC,IAAqB;YAC1C,MAAMC,WAAW,MAAM,IAAI,CAAC,GAAG,CAACF;YAChC,IAAI,CAACE,UACD,MAAM,IAAIC,YACN,CAAC,iCAAiC,EAAEH,GAAG,YAAY,CAAC,EACpD,6BACA;gBACIA;gBACAC;YACJ;YAIR,OAAO,MAAMJ,kBAAkB,GAAG,CAAC,MAAM,CAAC;gBACtCK;gBACA,MAAM;oBACF,GAAGD,IAAI;oBACP,QAAQH,YAAY,EAAE;gBAC1B;YACJ;QACJ;QACA,MAAM,aAAYM,KAAmD;YACjE,MAAMC,aACF,OAAMC,QAAQ,GAAG,CACbF,MAAM,GAAG,CAAC,OAAO,EAAEJ,EAAE,EAAEC,IAAI,EAAE;gBACzB,MAAMC,WAAW,MAAM,IAAI,CAAC,GAAG,CAACF;gBAChC,IAAI,CAACE,UACD,OAAO;gBAEX,OAAO;oBACHA;oBACA,MAAM;wBACF,GAAGD,IAAI;wBACP,QAAQH,YAAY,EAAE;oBAC1B;gBACJ;YACJ,GAAE,EAER,MAAM,CAAC,CAACS,OAA2CA,AAAS,SAATA;YAErD,IAAIF,AAAsB,MAAtBA,WAAW,MAAM,EACjB,OAAO,EAAE;YAGb,OAAO,MAAMR,kBAAkB,GAAG,CAAC,WAAW,CAAC;gBAC3C,OAAOQ;YACX;QACJ;QACA,MAAM,QAAOL,EAAU;YACnB,MAAMQ,MAAM,MAAM,IAAI,CAAC,GAAG,CAACR;YAC3B,IAAI,CAACQ,KACD,MAAM,IAAIL,YACN,CAAC,iCAAiC,EAAEH,GAAG,YAAY,CAAC,EACpD,6BACA;gBACIA;YACJ;YAIR,MAAMH,kBAAkB,GAAG,CAAC,MAAM,CAAC;gBAC/B,KAAK;oBACD,GAAGW,GAAG;oBACN,QAAQV,YAAY,EAAE;gBAC1B;YACJ;YAEA,OAAO;QACX;QACA,MAAM,KAAIE,EAAU;YAChB,MAAMS,UAAUC,QAAQ,IAAI,CAACV;YAC7B,OAAO,MAAMH,kBAAkB,GAAG,CAAC,GAAG,CAAC;gBACnC,IAAIY,QAAQ,EAAE;gBACd,QAAQX,YAAY,EAAE;YAC1B;QACJ;QACA,MAAM,MAAK,EAAEa,KAAK,EAAE;YAChB,OAAO,MAAMd,kBAAkB,GAAG,CAAC,IAAI,CAAC;gBACpC,OAAO;oBACH,GAAGc,KAAK;oBACR,QAAQb,YAAY,EAAE;gBAC1B;YACJ;QACJ;IACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TaskCatalogFlpFeature } from "./TaskCatalogFlpFeature.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TaskCatalogFlpFeature } from "./TaskCatalogFlpFeature.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CmsEntryListParams, CmsEntryValues } from "@webiny/api-headless-cms/types/index.js";
|
|
2
2
|
import { type CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
3
3
|
import type { IListEntriesResult } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/abstractions.js";
|
|
4
|
-
import { FolderLevelPermissions } from "../../features/flp/FolderLevelPermissions/
|
|
4
|
+
import { FolderLevelPermissions } from "../../features/flp/FolderLevelPermissions/abstractions.js";
|
|
5
5
|
interface ListEntriesFactoryCallbackParams<T extends CmsEntryValues> {
|
|
6
6
|
model: CmsModel;
|
|
7
7
|
dataLoader: (params?: CmsEntryListParams) => Promise<IListEntriesResult<T>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/listEntries/ListEntriesFactory.js","sources":["../../../src/flpTaskCatalog/listEntries/ListEntriesFactory.ts"],"sourcesContent":["import type {\n CmsEntry,\n CmsEntryListParams,\n CmsEntryValues\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { type CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IListEntriesResult } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/abstractions.js\";\nimport { hasRootFolderId } from \"./hasRootFolderId.js\";\nimport type { FolderPermission } from \"~/flp/flp.types.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/abstractions.js\";\n\ninterface ListEntriesFactoryCallbackParams<T extends CmsEntryValues> {\n model: CmsModel;\n dataLoader: (params?: CmsEntryListParams) => Promise<IListEntriesResult<T>>;\n initialParams?: CmsEntryListParams;\n}\n\nexport class ListEntriesFactory {\n private readonly folderLevelPermissions: FolderLevelPermissions.Interface;\n private readonly permissionsCache: Map<string, FolderPermission[]>;\n\n constructor(folderLevelPermissions: FolderLevelPermissions.Interface) {\n this.folderLevelPermissions = folderLevelPermissions;\n this.permissionsCache = new Map();\n }\n\n public async execute<T extends CmsEntryValues = CmsEntryValues>({\n model,\n dataLoader,\n initialParams = {}\n }: ListEntriesFactoryCallbackParams<T>): Promise<IListEntriesResult<T>> {\n const limit = initialParams?.limit || 50;\n const where = initialParams?.where;\n const params = { ...initialParams, limit };\n const hasRootFolder = hasRootFolderId({ model, where });\n\n // If FLP should be skipped, or we're querying the root folder, skip permission checks\n if (!this.folderLevelPermissions.canUseFolderLevelPermissions() || hasRootFolder) {\n return dataLoader(params);\n }\n\n const resultEntries: CmsEntry<T>[] = [];\n let totalCount = 0;\n let hasMoreItems = true;\n let cursor: string | null = null;\n let fetchedAll = false;\n let afterCursor = params.after;\n\n // Process entries in batches until we have enough results or reach the end\n while (!fetchedAll) {\n const queryParams: CmsEntryListParams = { ...params, after: afterCursor };\n const { entries, meta } = await dataLoader(queryParams);\n\n if (totalCount === 0) {\n totalCount = meta.totalCount;\n }\n\n // Process each entry and check folder permissions\n for (const entry of entries) {\n const folderId = entry.values?.location?.folderId || entry.location?.folderId;\n\n // If entry has no folderId, it's not using ACO folders system\n // Include it in results as it's not subject to folder permissions\n if (!folderId) {\n resultEntries.push(entry);\n continue;\n }\n\n const permissions = await this.getPermissions(folderId);\n\n // If no FLP exists for the folder, the entry is accessible\n // This means the folder doesn't have any permission restrictions\n if (!permissions.length) {\n resultEntries.push(entry);\n continue;\n }\n\n // Check if user has read permission for the folder\n if (\n await this.folderLevelPermissions.canAccessFolderContent({\n permissions,\n rwd: \"r\"\n })\n ) {\n resultEntries.push(entry);\n } else {\n totalCount--;\n }\n }\n\n // Determine if we need to fetch more entries\n if (!meta.hasMoreItems || resultEntries.length >= limit) {\n fetchedAll = true;\n hasMoreItems = meta.hasMoreItems;\n cursor = meta.cursor;\n } else {\n afterCursor = meta.cursor;\n }\n }\n\n return { entries: resultEntries, meta: { totalCount, hasMoreItems, cursor } };\n }\n\n private async getPermissions(folderId: string): Promise<FolderPermission[]> {\n if (this.permissionsCache.has(folderId)) {\n return this.permissionsCache.get(folderId) ?? [];\n }\n\n const permissions = await this.folderLevelPermissions.getFolderLevelPermissions(folderId);\n this.permissionsCache.set(folderId, permissions);\n return permissions;\n }\n}\n"],"names":["ListEntriesFactory","folderLevelPermissions","Map","model","dataLoader","initialParams","limit","where","params","hasRootFolder","hasRootFolderId","resultEntries","totalCount","hasMoreItems","cursor","fetchedAll","afterCursor","queryParams","entries","meta","entry","folderId","permissions"],"mappings":";AAiBO,MAAMA;IAIT,YAAYC,sBAAwD,CAAE;QAClE,IAAI,CAAC,sBAAsB,GAAGA;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAIC;IAChC;IAEA,MAAa,QAAmD,EAC5DC,KAAK,EACLC,UAAU,EACVC,gBAAgB,CAAC,CAAC,EACgB,EAAkC;QACpE,MAAMC,QAAQD,eAAe,SAAS;QACtC,MAAME,QAAQF,eAAe;QAC7B,MAAMG,SAAS;YAAE,GAAGH,aAAa;YAAEC;QAAM;QACzC,MAAMG,gBAAgBC,gBAAgB;YAAEP;YAAOI;QAAM;QAGrD,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,4BAA4B,MAAME,eAC/D,OAAOL,WAAWI;QAGtB,MAAMG,gBAA+B,EAAE;QACvC,IAAIC,aAAa;QACjB,IAAIC,eAAe;QACnB,IAAIC,SAAwB;QAC5B,IAAIC,aAAa;QACjB,IAAIC,cAAcR,OAAO,KAAK;QAG9B,MAAO,CAACO,WAAY;YAChB,MAAME,cAAkC;gBAAE,GAAGT,MAAM;gBAAE,OAAOQ;YAAY;YACxE,MAAM,EAAEE,OAAO,EAAEC,IAAI,EAAE,GAAG,MAAMf,WAAWa;YAE3C,IAAIL,AAAe,MAAfA,YACAA,aAAaO,KAAK,UAAU;YAIhC,KAAK,MAAMC,SAASF,QAAS;gBACzB,MAAMG,WAAWD,MAAM,MAAM,EAAE,UAAU,YAAYA,MAAM,QAAQ,EAAE;gBAIrE,IAAI,CAACC,UAAU;oBACXV,cAAc,IAAI,CAACS;oBACnB;gBACJ;gBAEA,MAAME,cAAc,MAAM,IAAI,CAAC,cAAc,CAACD;gBAI9C,IAAI,CAACC,YAAY,MAAM,EAAE;oBACrBX,cAAc,IAAI,CAACS;oBACnB;gBACJ;gBAGA,IACI,MAAM,IAAI,CAAC,sBAAsB,CAAC,sBAAsB,CAAC;oBACrDE;oBACA,KAAK;gBACT,IAEAX,cAAc,IAAI,CAACS;qBAEnBR;YAER;YAGA,IAAI,CAACO,KAAK,YAAY,IAAIR,cAAc,MAAM,IAAIL,OAAO;gBACrDS,aAAa;gBACbF,eAAeM,KAAK,YAAY;gBAChCL,SAASK,KAAK,MAAM;YACxB,OACIH,cAAcG,KAAK,MAAM;QAEjC;QAEA,OAAO;YAAE,SAASR;YAAe,MAAM;gBAAEC;gBAAYC;gBAAcC;YAAO;QAAE;IAChF;IAEA,MAAc,eAAeO,QAAgB,EAA+B;QACxE,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAACA,WAC1B,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAACA,aAAa,EAAE;QAGpD,MAAMC,cAAc,MAAM,IAAI,CAAC,sBAAsB,CAAC,yBAAyB,CAACD;QAChF,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAACA,UAAUC;QACpC,OAAOA;IACX;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/listEntries/hasRootFolderId.js","sources":["../../../src/flpTaskCatalog/listEntries/hasRootFolderId.ts"],"sourcesContent":["import isPlainObject from \"lodash/isPlainObject.js\";\nimport { isPageModel } from \"./isPageModel.js\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\n\ninterface Params {\n model: CmsModel;\n where: CmsEntryListWhere | undefined;\n}\n\nexport const hasRootFolderId = ({ model, where }: Params): boolean => {\n if (!where) {\n return false;\n }\n\n const key = isPageModel(model) ? \"location\" : \"wbyAco_location\";\n const location = where[key];\n\n if (typeof location === \"object\" && location !== null && isPlainObject(location)) {\n return (location as Record<string, any>).folderId === ROOT_FOLDER;\n }\n\n return false;\n};\n"],"names":["hasRootFolderId","model","where","key","isPageModel","location","isPlainObject","ROOT_FOLDER"],"mappings":";;;AAUO,MAAMA,kBAAkB,CAAC,EAAEC,KAAK,EAAEC,KAAK,EAAU;IACpD,IAAI,CAACA,OACD,OAAO;IAGX,MAAMC,MAAMC,YAAYH,SAAS,aAAa;IAC9C,MAAMI,WAAWH,KAAK,CAACC,IAAI;IAE3B,IAAI,AAAoB,YAApB,OAAOE,YAAyBA,AAAa,SAAbA,YAAqBC,cAAcD,WACnE,OAAQA,SAAiC,QAAQ,KAAKE;IAG1D,OAAO;AACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/listEntries/isPageModel.js","sources":["../../../src/flpTaskCatalog/listEntries/isPageModel.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\n/**\n * Keep this until we figure out how to fetch the folders.\n */\nexport const isPageModel = (model: CmsModel): boolean => {\n if (model.modelId === \"pbPage\") {\n return true;\n } else if (model.modelId === \"acoSearchRecord-pbpage\") {\n return true;\n }\n return false;\n};\n"],"names":["isPageModel","model"],"mappings":"AAKO,MAAMA,cAAc,CAACC;IACxB,IAAIA,AAAkB,aAAlBA,MAAM,OAAO,EACb,OAAO;SACJ,IAAIA,AAAkB,6BAAlBA,MAAM,OAAO,EACpB,OAAO;IAEX,OAAO;AACX"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
import { type ICreateFlpTaskInput } from "../../types.js";
|
|
3
|
+
import { CreateFlpUseCase } from "../../features/flp/CreateFlp/abstractions.js";
|
|
4
|
+
import { NotifyFolderChangeUseCase } from "../../features/folder/NotifyFolderChange/abstractions.js";
|
|
5
|
+
declare class CreateFlpTaskHandlerImpl implements TaskHandler.Interface<ICreateFlpTaskInput> {
|
|
6
|
+
private createFlp;
|
|
7
|
+
private notifyFolderChange;
|
|
8
|
+
constructor(createFlp: CreateFlpUseCase.Interface, notifyFolderChange: NotifyFolderChangeUseCase.Interface);
|
|
9
|
+
run({ input, controller }: TaskHandler.RunParams<ICreateFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<ICreateFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
10
|
+
}
|
|
11
|
+
declare class CreateFlpTaskImpl implements TaskDefinition.Interface {
|
|
12
|
+
readonly id = "acoCreateFlp";
|
|
13
|
+
readonly title = "ACO - Create FLP record";
|
|
14
|
+
readonly description = "Synchronizes the FLP catalog by creating the FLP record based on the provided folder.";
|
|
15
|
+
readonly databaseLogs = false;
|
|
16
|
+
readonly isPrivate = true;
|
|
17
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
18
|
+
handler: typeof CreateFlpTaskHandlerImpl & {
|
|
19
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare const CreateFlpTask: typeof CreateFlpTaskImpl & {
|
|
23
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -1,36 +1,53 @@
|
|
|
1
|
-
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
-
import { CREATE_FLP_TASK_ID } from "
|
|
3
|
-
import { CreateFlpUseCase } from "../../features/flp/CreateFlp/
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
import { CREATE_FLP_TASK_ID } from "../../flp/tasks/index.js";
|
|
3
|
+
import { CreateFlpUseCase } from "../../features/flp/CreateFlp/abstractions.js";
|
|
4
|
+
import { NotifyFolderChangeUseCase } from "../../features/folder/NotifyFolderChange/abstractions.js";
|
|
5
|
+
class CreateFlpTaskHandlerImpl {
|
|
6
|
+
constructor(createFlp, notifyFolderChange){
|
|
6
7
|
this.createFlp = createFlp;
|
|
7
|
-
this.
|
|
8
|
-
this.title = "ACO - Create FLP record";
|
|
9
|
-
this.description = "Synchronizes the FLP catalog by creating the FLP record based on the provided folder.";
|
|
10
|
-
this.databaseLogs = false;
|
|
11
|
-
this.isPrivate = true;
|
|
12
|
-
this.selfCleanup = [
|
|
13
|
-
"onSuccess",
|
|
14
|
-
"onAbort"
|
|
15
|
-
];
|
|
8
|
+
this.notifyFolderChange = notifyFolderChange;
|
|
16
9
|
}
|
|
17
10
|
async run({ input, controller }) {
|
|
18
11
|
try {
|
|
19
12
|
if (controller.runtime.isAborted()) return controller.response.aborted();
|
|
20
13
|
if (controller.runtime.isCloseToTimeout()) return controller.response.continue(input);
|
|
21
14
|
await this.createFlp.execute(input.folder);
|
|
15
|
+
if (input.notifyIdentityId) await this.notifyFolderChange.execute({
|
|
16
|
+
id: input.folder.id,
|
|
17
|
+
change: "created",
|
|
18
|
+
identityId: input.notifyIdentityId
|
|
19
|
+
});
|
|
22
20
|
return controller.response.done("Task done: FLP record created.");
|
|
23
21
|
} catch (error) {
|
|
24
22
|
return controller.response.error(error);
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
|
-
const
|
|
29
|
-
implementation:
|
|
26
|
+
const CreateFlpTaskHandler = TaskHandler.createImplementation({
|
|
27
|
+
implementation: CreateFlpTaskHandlerImpl,
|
|
30
28
|
dependencies: [
|
|
31
|
-
CreateFlpUseCase
|
|
29
|
+
CreateFlpUseCase,
|
|
30
|
+
NotifyFolderChangeUseCase
|
|
32
31
|
]
|
|
33
32
|
});
|
|
33
|
+
class CreateFlpTaskImpl {
|
|
34
|
+
constructor(){
|
|
35
|
+
this.id = CREATE_FLP_TASK_ID;
|
|
36
|
+
this.title = "ACO - Create FLP record";
|
|
37
|
+
this.description = "Synchronizes the FLP catalog by creating the FLP record based on the provided folder.";
|
|
38
|
+
this.databaseLogs = false;
|
|
39
|
+
this.isPrivate = true;
|
|
40
|
+
this.selfCleanup = [
|
|
41
|
+
"onSuccess",
|
|
42
|
+
"onAbort"
|
|
43
|
+
];
|
|
44
|
+
this.handler = CreateFlpTaskHandler;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const CreateFlpTask = TaskDefinition.createImplementation({
|
|
48
|
+
implementation: CreateFlpTaskImpl,
|
|
49
|
+
dependencies: []
|
|
50
|
+
});
|
|
34
51
|
export { CreateFlpTask };
|
|
35
52
|
|
|
36
53
|
//# sourceMappingURL=createFlp.task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/tasks/createFlp.task.js","sources":["../../../src/flpTaskCatalog/tasks/createFlp.task.ts"],"sourcesContent":["import {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { CREATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type ICreateFlpTaskInput } from \"~/types.js\";\nimport { CreateFlpUseCase } from \"~/features/flp/CreateFlp/abstractions.js\";\nimport { NotifyFolderChangeUseCase } from \"~/features/folder/NotifyFolderChange/abstractions.js\";\n\nclass CreateFlpTaskHandlerImpl implements TaskHandler.Interface<ICreateFlpTaskInput> {\n constructor(\n private createFlp: CreateFlpUseCase.Interface,\n private notifyFolderChange: NotifyFolderChangeUseCase.Interface\n ) {}\n\n async run({ input, controller }: TaskHandler.RunParams<ICreateFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n if (controller.runtime.isCloseToTimeout()) {\n return controller.response.continue(input);\n }\n\n await this.createFlp.execute(input.folder);\n\n // Only now can the admin read the folder back with its permissions.\n if (input.notifyIdentityId) {\n await this.notifyFolderChange.execute({\n id: input.folder.id,\n change: \"created\",\n identityId: input.notifyIdentityId\n });\n }\n\n return controller.response.done(\"Task done: FLP record created.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nconst CreateFlpTaskHandler = TaskHandler.createImplementation({\n implementation: CreateFlpTaskHandlerImpl,\n dependencies: [CreateFlpUseCase, NotifyFolderChangeUseCase]\n});\n\nclass CreateFlpTaskImpl implements TaskDefinition.Interface {\n public readonly id = CREATE_FLP_TASK_ID;\n public readonly title = \"ACO - Create FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by creating the FLP record based on the provided folder.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = CreateFlpTaskHandler;\n}\n\nexport const CreateFlpTask = TaskDefinition.createImplementation({\n implementation: CreateFlpTaskImpl,\n dependencies: []\n});\n"],"names":["CreateFlpTaskHandlerImpl","createFlp","notifyFolderChange","input","controller","error","CreateFlpTaskHandler","TaskHandler","CreateFlpUseCase","NotifyFolderChangeUseCase","CreateFlpTaskImpl","CREATE_FLP_TASK_ID","CreateFlpTask","TaskDefinition"],"mappings":";;;;AASA,MAAMA;IACF,YACYC,SAAqC,EACrCC,kBAAuD,CACjE;aAFUD,SAAS,GAATA;aACAC,kBAAkB,GAAlBA;IACT;IAEH,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA8C,EAAE;QACzE,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAGtC,IAAIA,WAAW,OAAO,CAAC,gBAAgB,IACnC,OAAOA,WAAW,QAAQ,CAAC,QAAQ,CAACD;YAGxC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA,MAAM,MAAM;YAGzC,IAAIA,MAAM,gBAAgB,EACtB,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;gBAClC,IAAIA,MAAM,MAAM,CAAC,EAAE;gBACnB,QAAQ;gBACR,YAAYA,MAAM,gBAAgB;YACtC;YAGJ,OAAOC,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOC,OAAO;YACZ,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC;QACrC;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,YAAY,oBAAoB,CAAC;IAC1D,gBAAgBP;IAChB,cAAc;QAACQ;QAAkBC;KAA0B;AAC/D;AAEA,MAAMC;;aACc,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;aAExE,OAAO,GAAGL;;AACd;AAEO,MAAMM,gBAAgBC,eAAe,oBAAoB,CAAC;IAC7D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
import { type IDeleteFlpTaskInput } from "../../types.js";
|
|
3
|
+
import { DeleteFlpUseCase } from "../../features/flp/DeleteFlp/abstractions.js";
|
|
4
|
+
declare class DeleteFlpTaskHandlerImpl implements TaskHandler.Interface<IDeleteFlpTaskInput> {
|
|
5
|
+
private deleteFlp;
|
|
6
|
+
constructor(deleteFlp: DeleteFlpUseCase.Interface);
|
|
7
|
+
run({ input, controller }: TaskHandler.RunParams<IDeleteFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<IDeleteFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
8
|
+
}
|
|
9
|
+
declare class DeleteFlpTaskImpl implements TaskDefinition.Interface {
|
|
10
|
+
readonly id = "acoDeleteFlp";
|
|
11
|
+
readonly title = "ACO - Delete FLP record";
|
|
12
|
+
readonly description = "Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.";
|
|
13
|
+
readonly databaseLogs = false;
|
|
14
|
+
readonly isPrivate = true;
|
|
15
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
16
|
+
handler: typeof DeleteFlpTaskHandlerImpl & {
|
|
17
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const DeleteFlpTask: typeof DeleteFlpTaskImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
-
import { DELETE_FLP_TASK_ID } from "
|
|
3
|
-
import { DeleteFlpUseCase } from "../../features/flp/DeleteFlp/
|
|
4
|
-
class
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
|
+
import { DELETE_FLP_TASK_ID } from "../../flp/tasks/index.js";
|
|
3
|
+
import { DeleteFlpUseCase } from "../../features/flp/DeleteFlp/abstractions.js";
|
|
4
|
+
class DeleteFlpTaskHandlerImpl {
|
|
5
5
|
constructor(deleteFlp){
|
|
6
6
|
this.deleteFlp = deleteFlp;
|
|
7
|
-
this.id = DELETE_FLP_TASK_ID;
|
|
8
|
-
this.title = "ACO - Delete FLP record";
|
|
9
|
-
this.description = "Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.";
|
|
10
|
-
this.databaseLogs = false;
|
|
11
|
-
this.isPrivate = true;
|
|
12
|
-
this.selfCleanup = [
|
|
13
|
-
"onSuccess",
|
|
14
|
-
"onAbort"
|
|
15
|
-
];
|
|
16
7
|
}
|
|
17
8
|
async run({ input, controller }) {
|
|
18
9
|
try {
|
|
@@ -25,12 +16,30 @@ class DeleteFlpTaskImpl {
|
|
|
25
16
|
}
|
|
26
17
|
}
|
|
27
18
|
}
|
|
28
|
-
const
|
|
29
|
-
implementation:
|
|
19
|
+
const DeleteFlpTaskHandler = TaskHandler.createImplementation({
|
|
20
|
+
implementation: DeleteFlpTaskHandlerImpl,
|
|
30
21
|
dependencies: [
|
|
31
22
|
DeleteFlpUseCase
|
|
32
23
|
]
|
|
33
24
|
});
|
|
25
|
+
class DeleteFlpTaskImpl {
|
|
26
|
+
constructor(){
|
|
27
|
+
this.id = DELETE_FLP_TASK_ID;
|
|
28
|
+
this.title = "ACO - Delete FLP record";
|
|
29
|
+
this.description = "Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.";
|
|
30
|
+
this.databaseLogs = false;
|
|
31
|
+
this.isPrivate = true;
|
|
32
|
+
this.selfCleanup = [
|
|
33
|
+
"onSuccess",
|
|
34
|
+
"onAbort"
|
|
35
|
+
];
|
|
36
|
+
this.handler = DeleteFlpTaskHandler;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const DeleteFlpTask = TaskDefinition.createImplementation({
|
|
40
|
+
implementation: DeleteFlpTaskImpl,
|
|
41
|
+
dependencies: []
|
|
42
|
+
});
|
|
34
43
|
export { DeleteFlpTask };
|
|
35
44
|
|
|
36
45
|
//# sourceMappingURL=deleteFlp.task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flpTaskCatalog/tasks/deleteFlp.task.js","sources":["../../../src/flpTaskCatalog/tasks/deleteFlp.task.ts"],"sourcesContent":["import {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { DELETE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type IDeleteFlpTaskInput } from \"~/types.js\";\nimport { DeleteFlpUseCase } from \"~/features/flp/DeleteFlp/abstractions.js\";\n\nclass DeleteFlpTaskHandlerImpl implements TaskHandler.Interface<IDeleteFlpTaskInput> {\n constructor(private deleteFlp: DeleteFlpUseCase.Interface) {}\n\n async run({ input, controller }: TaskHandler.RunParams<IDeleteFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n if (controller.runtime.isCloseToTimeout()) {\n return controller.response.continue(input);\n }\n\n await this.deleteFlp.execute(input.folder);\n\n return controller.response.done(\"Task done: FLP record deleted.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nconst DeleteFlpTaskHandler = TaskHandler.createImplementation({\n implementation: DeleteFlpTaskHandlerImpl,\n dependencies: [DeleteFlpUseCase]\n});\n\nclass DeleteFlpTaskImpl implements TaskDefinition.Interface {\n public readonly id = DELETE_FLP_TASK_ID;\n public readonly title = \"ACO - Delete FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = DeleteFlpTaskHandler;\n}\n\nexport const DeleteFlpTask = TaskDefinition.createImplementation({\n implementation: DeleteFlpTaskImpl,\n dependencies: []\n});\n"],"names":["DeleteFlpTaskHandlerImpl","deleteFlp","input","controller","error","DeleteFlpTaskHandler","TaskHandler","DeleteFlpUseCase","DeleteFlpTaskImpl","DELETE_FLP_TASK_ID","DeleteFlpTask","TaskDefinition"],"mappings":";;;AAQA,MAAMA;IACF,YAAoBC,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA8C,EAAE;QACzE,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAGtC,IAAIA,WAAW,OAAO,CAAC,gBAAgB,IACnC,OAAOA,WAAW,QAAQ,CAAC,QAAQ,CAACD;YAGxC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAACA,MAAM,MAAM;YAEzC,OAAOC,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOC,OAAO;YACZ,OAAOD,WAAW,QAAQ,CAAC,KAAK,CAACC;QACrC;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,YAAY,oBAAoB,CAAC;IAC1D,gBAAgBN;IAChB,cAAc;QAACO;KAAiB;AACpC;AAEA,MAAMC;;aACc,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;aAExE,OAAO,GAAGJ;;AACd;AAEO,MAAMK,gBAAgBC,eAAe,oBAAoB,CAAC;IAC7D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
2
|
import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
|
|
3
3
|
import { type ISyncFlpTaskInput } from "../../types.js";
|
|
4
|
-
import { GetFolderUseCase } from "../../features/folder/GetFolder/
|
|
5
|
-
import { ListFoldersUseCase } from "../../features/folder/ListFolders/
|
|
6
|
-
declare class
|
|
4
|
+
import { GetFolderUseCase } from "../../features/folder/GetFolder/abstractions.js";
|
|
5
|
+
import { ListFoldersUseCase } from "../../features/folder/ListFolders/abstractions.js";
|
|
6
|
+
declare class SyncFlpTaskHandlerImpl implements TaskHandler.Interface<ISyncFlpTaskInput> {
|
|
7
7
|
private getFolder;
|
|
8
8
|
private listFolders;
|
|
9
9
|
private listModels;
|
|
10
|
+
constructor(getFolder: GetFolderUseCase.Interface, listFolders: ListFoldersUseCase.Interface, listModels: ListModelsUseCase.Interface);
|
|
11
|
+
run({ input, controller }: TaskHandler.RunParams<ISyncFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
12
|
+
}
|
|
13
|
+
declare class SyncFlpTaskImpl implements TaskDefinition.Interface {
|
|
10
14
|
readonly id = "acoSyncFlp";
|
|
11
15
|
readonly title = "ACO - Sync FLP record";
|
|
12
16
|
readonly description = "Synchronizes the FLP catalog by updating the FLP record and its descendants.";
|
|
13
17
|
readonly databaseLogs = false;
|
|
14
18
|
readonly isPrivate = true;
|
|
15
19
|
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
handler: typeof SyncFlpTaskHandlerImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
22
|
+
};
|
|
18
23
|
}
|
|
19
24
|
export declare const SyncFlpTask: typeof SyncFlpTaskImpl & {
|
|
20
25
|
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|