@webiny/api-file-manager 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
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/README.md +7 -13
- package/contants.js +1 -7
- package/contants.js.map +1 -1
- package/delivery/AssetDelivery/Asset.d.ts +3 -7
- package/delivery/AssetDelivery/Asset.js +1 -11
- package/delivery/AssetDelivery/Asset.js.map +1 -1
- package/delivery/AssetDelivery/AssetDeliveryConfig.d.ts +11 -9
- package/delivery/AssetDelivery/AssetDeliveryConfig.js +18 -26
- package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +1 -1
- package/delivery/AssetDelivery/AssetRequest.d.ts +1 -1
- package/delivery/AssetDelivery/AssetRequest.js +1 -8
- package/delivery/AssetDelivery/AssetRequest.js.map +1 -1
- package/delivery/AssetDelivery/FilesAssetRequestResolver.d.ts +3 -3
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js +3 -10
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/NullAssetOutputStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js +3 -10
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/NullAssetReply.d.ts +1 -1
- package/delivery/AssetDelivery/NullAssetReply.js +2 -9
- package/delivery/AssetDelivery/NullAssetReply.js.map +1 -1
- package/delivery/AssetDelivery/NullAssetResolver.d.ts +2 -2
- package/delivery/AssetDelivery/NullAssetResolver.js +1 -8
- package/delivery/AssetDelivery/NullAssetResolver.js.map +1 -1
- package/delivery/AssetDelivery/NullRequestResolver.d.ts +1 -1
- package/delivery/AssetDelivery/NullRequestResolver.js +1 -8
- package/delivery/AssetDelivery/NullRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/SetCacheControlHeaders.d.ts +1 -1
- package/delivery/AssetDelivery/SetCacheControlHeaders.js +1 -8
- package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +1 -1
- package/delivery/AssetDelivery/SetResponseHeaders.d.ts +3 -3
- package/delivery/AssetDelivery/SetResponseHeaders.js +1 -8
- package/delivery/AssetDelivery/SetResponseHeaders.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.d.ts +1 -3
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js +1 -5
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js +1 -5
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetProcessor.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js +1 -5
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetReply.js +3 -10
- package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.d.ts +2 -2
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js +1 -5
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetResolver.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetResolver.js +1 -5
- package/delivery/AssetDelivery/abstractions/AssetResolver.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js +1 -5
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js.map +1 -1
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.d.ts +1 -1
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +1 -8
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js +1 -5
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js +4 -11
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +3 -10
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +4 -3
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +3 -11
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateCache.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js +4 -11
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +3 -3
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +3 -10
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +4 -4
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js +21 -21
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PublicCache.d.ts +1 -1
- package/delivery/AssetDelivery/privateFiles/PublicCache.js +4 -11
- package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +2 -2
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +5 -12
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +2 -2
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +5 -12
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.d.ts +1 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js +1 -8
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js.map +1 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +1 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js +1 -8
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +1 -1
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.d.ts +1 -1
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js +1 -8
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js.map +1 -1
- package/delivery/index.d.ts +16 -17
- package/delivery/index.js +10 -192
- package/delivery/index.js.map +1 -1
- package/delivery/setupAssetDelivery.d.ts +2 -6
- package/delivery/setupAssetDelivery.js +21 -35
- package/delivery/setupAssetDelivery.js.map +1 -1
- package/domain/file/abstractions.d.ts +9 -0
- package/domain/file/abstractions.js +8 -0
- package/domain/file/abstractions.js.map +1 -0
- package/domain/file/errors.d.ts +59 -0
- package/domain/file/errors.js +89 -0
- package/domain/file/errors.js.map +1 -0
- package/domain/file/file.model.d.ts +12 -0
- package/domain/file/file.model.js +57 -0
- package/domain/file/file.model.js.map +1 -0
- package/domain/file/types.d.ts +53 -0
- package/domain/file/types.js +3 -0
- package/domain/file/types.js.map +1 -0
- package/domain/identity/Identity.d.ts +9 -0
- package/domain/identity/Identity.js +11 -0
- package/domain/identity/Identity.js.map +1 -0
- package/domain/permissionsSchema.d.ts +16 -0
- package/domain/permissionsSchema.js +19 -0
- package/domain/permissionsSchema.js.map +1 -0
- package/domain/settings/constants.d.ts +1 -0
- package/domain/settings/constants.js +3 -0
- package/domain/settings/constants.js.map +1 -0
- package/domain/settings/errors.d.ts +18 -0
- package/domain/settings/errors.js +30 -0
- package/domain/settings/errors.js.map +1 -0
- package/domain/settings/types.d.ts +10 -0
- package/domain/settings/types.js +3 -0
- package/domain/settings/types.js.map +1 -0
- package/domain/settings/validation.d.ts +6 -0
- package/domain/settings/validation.js +36 -0
- package/domain/settings/validation.js.map +1 -0
- package/exports/api/file-manager/file.d.ts +12 -0
- package/exports/api/file-manager/file.js +14 -0
- package/exports/api/file-manager/file.js.map +1 -0
- package/exports/api/file-manager/permissions.d.ts +1 -0
- package/exports/api/file-manager/permissions.js +3 -0
- package/exports/api/file-manager/permissions.js.map +1 -0
- package/exports/api/file-manager/settings.d.ts +3 -0
- package/exports/api/file-manager/settings.js +5 -0
- package/exports/api/file-manager/settings.js.map +1 -0
- package/features/FileManagerFeature.d.ts +4 -0
- package/features/FileManagerFeature.js +30 -0
- package/features/FileManagerFeature.js.map +1 -0
- package/features/file/CreateFile/CreateFileRepository.d.ts +15 -0
- package/features/file/CreateFile/CreateFileRepository.js +30 -0
- package/features/file/CreateFile/CreateFileRepository.js.map +1 -0
- package/features/file/CreateFile/CreateFileUseCase.d.ts +21 -0
- package/features/file/CreateFile/CreateFileUseCase.js +90 -0
- package/features/file/CreateFile/CreateFileUseCase.js.map +1 -0
- package/features/file/CreateFile/abstractions.d.ts +60 -0
- package/features/file/CreateFile/abstractions.js +17 -0
- package/features/file/CreateFile/abstractions.js.map +1 -0
- package/features/file/CreateFile/events.d.ts +31 -0
- package/features/file/CreateFile/events.js +32 -0
- package/features/file/CreateFile/events.js.map +1 -0
- package/features/file/CreateFile/feature.d.ts +4 -0
- package/features/file/CreateFile/feature.js +12 -0
- package/features/file/CreateFile/feature.js.map +1 -0
- package/features/file/CreateFile/index.d.ts +2 -0
- package/features/file/CreateFile/index.js +4 -0
- package/features/file/CreateFile/index.js.map +1 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.d.ts +13 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js +24 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js.map +1 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.d.ts +19 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js +84 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js.map +1 -0
- package/features/file/CreateFilesInBatch/abstractions.d.ts +42 -0
- package/features/file/CreateFilesInBatch/abstractions.js +17 -0
- package/features/file/CreateFilesInBatch/abstractions.js.map +1 -0
- package/features/file/CreateFilesInBatch/events.d.ts +31 -0
- package/features/file/CreateFilesInBatch/events.js +32 -0
- package/features/file/CreateFilesInBatch/events.js.map +1 -0
- package/features/file/CreateFilesInBatch/feature.d.ts +4 -0
- package/features/file/CreateFilesInBatch/feature.js +12 -0
- package/features/file/CreateFilesInBatch/feature.js.map +1 -0
- package/features/file/CreateFilesInBatch/index.d.ts +1 -0
- package/features/file/CreateFilesInBatch/index.js +3 -0
- package/features/file/CreateFilesInBatch/index.js.map +1 -0
- package/features/file/DeleteFile/DeleteFileRepository.d.ts +15 -0
- package/features/file/DeleteFile/DeleteFileRepository.js +30 -0
- package/features/file/DeleteFile/DeleteFileRepository.js.map +1 -0
- package/features/file/DeleteFile/DeleteFileUseCase.d.ts +17 -0
- package/features/file/DeleteFile/DeleteFileUseCase.js +45 -0
- package/features/file/DeleteFile/DeleteFileUseCase.js.map +1 -0
- package/features/file/DeleteFile/abstractions.d.ts +39 -0
- package/features/file/DeleteFile/abstractions.js +17 -0
- package/features/file/DeleteFile/abstractions.js.map +1 -0
- package/features/file/DeleteFile/events.d.ts +29 -0
- package/features/file/DeleteFile/events.js +32 -0
- package/features/file/DeleteFile/events.js.map +1 -0
- package/features/file/DeleteFile/feature.d.ts +4 -0
- package/features/file/DeleteFile/feature.js +12 -0
- package/features/file/DeleteFile/feature.js.map +1 -0
- package/features/file/DeleteFile/index.d.ts +2 -0
- package/features/file/DeleteFile/index.js +4 -0
- package/features/file/DeleteFile/index.js.map +1 -0
- package/features/file/FileUrlGenerator/abstractions.d.ts +9 -0
- package/features/file/FileUrlGenerator/abstractions.js +5 -0
- package/features/file/FileUrlGenerator/abstractions.js.map +1 -0
- package/features/file/GetFile/GetFileRepository.d.ts +15 -0
- package/features/file/GetFile/GetFileRepository.js +33 -0
- package/features/file/GetFile/GetFileRepository.js.map +1 -0
- package/features/file/GetFile/GetFileUseCase.d.ts +14 -0
- package/features/file/GetFile/GetFileUseCase.js +31 -0
- package/features/file/GetFile/GetFileUseCase.js.map +1 -0
- package/features/file/GetFile/abstractions.d.ts +40 -0
- package/features/file/GetFile/abstractions.js +17 -0
- package/features/file/GetFile/abstractions.js.map +1 -0
- package/features/file/GetFile/feature.d.ts +4 -0
- package/features/file/GetFile/feature.js +12 -0
- package/features/file/GetFile/feature.js.map +1 -0
- package/features/file/GetFile/index.d.ts +1 -0
- package/features/file/GetFile/index.js +3 -0
- package/features/file/GetFile/index.js.map +1 -0
- package/features/file/GetFileContents/abstractions.d.ts +20 -0
- package/features/file/GetFileContents/abstractions.js +4 -0
- package/features/file/GetFileContents/abstractions.js.map +1 -0
- package/features/file/GetFileContents/index.d.ts +1 -0
- package/features/file/GetFileContents/index.js +3 -0
- package/features/file/GetFileContents/index.js.map +1 -0
- package/features/file/ListFiles/ListFilesRepository.d.ts +18 -0
- package/features/file/ListFiles/ListFilesRepository.js +51 -0
- package/features/file/ListFiles/ListFilesRepository.js.map +1 -0
- package/features/file/ListFiles/ListFilesUseCase.d.ts +15 -0
- package/features/file/ListFiles/ListFilesUseCase.js +45 -0
- package/features/file/ListFiles/ListFilesUseCase.js.map +1 -0
- package/features/file/ListFiles/abstractions.d.ts +49 -0
- package/features/file/ListFiles/abstractions.js +17 -0
- package/features/file/ListFiles/abstractions.js.map +1 -0
- package/features/file/ListFiles/feature.d.ts +4 -0
- package/features/file/ListFiles/feature.js +12 -0
- package/features/file/ListFiles/feature.js.map +1 -0
- package/features/file/ListFiles/index.d.ts +1 -0
- package/features/file/ListFiles/index.js +3 -0
- package/features/file/ListFiles/index.js.map +1 -0
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.d.ts +27 -0
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +39 -0
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.js.map +1 -0
- package/features/file/ListImagesByTagTool/feature.d.ts +4 -0
- package/features/file/ListImagesByTagTool/feature.js +10 -0
- package/features/file/ListImagesByTagTool/feature.js.map +1 -0
- package/features/file/ListTags/ListTagsRepository.d.ts +16 -0
- package/features/file/ListTags/ListTagsRepository.js +47 -0
- package/features/file/ListTags/ListTagsRepository.js.map +1 -0
- package/features/file/ListTags/ListTagsUseCase.d.ts +13 -0
- package/features/file/ListTags/ListTagsUseCase.js +31 -0
- package/features/file/ListTags/ListTagsUseCase.js.map +1 -0
- package/features/file/ListTags/abstractions.d.ts +45 -0
- package/features/file/ListTags/abstractions.js +17 -0
- package/features/file/ListTags/abstractions.js.map +1 -0
- package/features/file/ListTags/feature.d.ts +4 -0
- package/features/file/ListTags/feature.js +12 -0
- package/features/file/ListTags/feature.js.map +1 -0
- package/features/file/ListTags/index.d.ts +1 -0
- package/features/file/ListTags/index.js +3 -0
- package/features/file/ListTags/index.js.map +1 -0
- package/features/file/UpdateFile/UpdateFileRepository.d.ts +15 -0
- package/features/file/UpdateFile/UpdateFileRepository.js +39 -0
- package/features/file/UpdateFile/UpdateFileRepository.js.map +1 -0
- package/features/file/UpdateFile/UpdateFileUseCase.d.ts +20 -0
- package/features/file/UpdateFile/UpdateFileUseCase.js +79 -0
- package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -0
- package/features/file/UpdateFile/abstractions.d.ts +56 -0
- package/features/file/UpdateFile/abstractions.js +17 -0
- package/features/file/UpdateFile/abstractions.js.map +1 -0
- package/features/file/UpdateFile/events.d.ts +34 -0
- package/features/file/UpdateFile/events.js +32 -0
- package/features/file/UpdateFile/events.js.map +1 -0
- package/features/file/UpdateFile/feature.d.ts +4 -0
- package/features/file/UpdateFile/feature.js +12 -0
- package/features/file/UpdateFile/feature.js.map +1 -0
- package/features/file/UpdateFile/index.d.ts +2 -0
- package/features/file/UpdateFile/index.js +4 -0
- package/features/file/UpdateFile/index.js.map +1 -0
- package/features/file/shared/EntryToFileMapper.d.ts +5 -0
- package/features/file/shared/EntryToFileMapper.js +27 -0
- package/features/file/shared/EntryToFileMapper.js.map +1 -0
- package/features/file/shared/FileInputToEntryInputMapper.d.ts +5 -0
- package/features/file/shared/FileInputToEntryInputMapper.js +31 -0
- package/features/file/shared/FileInputToEntryInputMapper.js.map +1 -0
- package/features/file/shared/FileToEntryMapper.d.ts +5 -0
- package/features/file/shared/FileToEntryMapper.js +30 -0
- package/features/file/shared/FileToEntryMapper.js.map +1 -0
- package/features/permissions/abstractions.d.ts +21 -0
- package/features/permissions/abstractions.js +5 -0
- package/features/permissions/abstractions.js.map +1 -0
- package/features/permissions/feature.d.ts +4 -0
- package/features/permissions/feature.js +6 -0
- package/features/permissions/feature.js.map +1 -0
- package/features/settings/GetSettings/GetSettingsUseCase.d.ts +13 -0
- package/features/settings/GetSettings/GetSettingsUseCase.js +28 -0
- package/features/settings/GetSettings/GetSettingsUseCase.js.map +1 -0
- package/features/settings/GetSettings/abstractions.d.ts +18 -0
- package/features/settings/GetSettings/abstractions.js +10 -0
- package/features/settings/GetSettings/abstractions.js.map +1 -0
- package/features/settings/GetSettings/feature.d.ts +4 -0
- package/features/settings/GetSettings/feature.js +10 -0
- package/features/settings/GetSettings/feature.js.map +1 -0
- package/features/settings/SettingsInstaller/SettingsInstaller.d.ts +15 -0
- package/features/settings/SettingsInstaller/SettingsInstaller.js +35 -0
- package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -0
- package/features/settings/SettingsInstaller/feature.d.ts +4 -0
- package/features/settings/SettingsInstaller/feature.js +10 -0
- package/features/settings/SettingsInstaller/feature.js.map +1 -0
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.d.ts +18 -0
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js +62 -0
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -0
- package/features/settings/UpdateSettings/abstractions.d.ts +23 -0
- package/features/settings/UpdateSettings/abstractions.js +10 -0
- package/features/settings/UpdateSettings/abstractions.js.map +1 -0
- package/features/settings/UpdateSettings/events.d.ts +34 -0
- package/features/settings/UpdateSettings/events.js +32 -0
- package/features/settings/UpdateSettings/events.js.map +1 -0
- package/features/settings/UpdateSettings/feature.d.ts +4 -0
- package/features/settings/UpdateSettings/feature.js +10 -0
- package/features/settings/UpdateSettings/feature.js.map +1 -0
- package/features/settings/UpdateSettings/index.d.ts +2 -0
- package/features/settings/UpdateSettings/index.js +4 -0
- package/features/settings/UpdateSettings/index.js.map +1 -0
- package/features/shared/abstractions.d.ts +1 -0
- package/features/shared/abstractions.js +3 -0
- package/features/shared/abstractions.js.map +1 -0
- package/graphql/baseSchema.d.ts +2 -2
- package/graphql/baseSchema.js +20 -38
- package/graphql/baseSchema.js.map +1 -1
- package/graphql/createFilesTypeDefs.d.ts +3 -2
- package/graphql/createFilesTypeDefs.js +45 -30
- package/graphql/createFilesTypeDefs.js.map +1 -1
- package/graphql/filesSchema.d.ts +3 -3
- package/graphql/filesSchema.js +73 -46
- package/graphql/filesSchema.js.map +1 -1
- package/graphql/getFileByUrl.d.ts +2 -2
- package/graphql/getFileByUrl.js +17 -26
- package/graphql/getFileByUrl.js.map +1 -1
- package/graphql/index.d.ts +2 -2
- package/graphql/index.js +27 -28
- package/graphql/index.js.map +1 -1
- package/graphql/utils.d.ts +1 -1
- package/graphql/utils.js +6 -13
- package/graphql/utils.js.map +1 -1
- package/index.d.ts +6 -9
- package/index.js +28 -67
- package/index.js.map +1 -1
- package/modelModifier/CmsModelModifier.d.ts +1 -1
- package/modelModifier/CmsModelModifier.js +7 -15
- package/modelModifier/CmsModelModifier.js.map +1 -1
- package/package.json +31 -29
- package/types.d.ts +2 -367
- package/types.js +1 -27
- package/types.js.map +1 -1
- package/FileManagerContextSetup.d.ts +0 -13
- package/FileManagerContextSetup.js +0 -115
- package/FileManagerContextSetup.js.map +0 -1
- package/cmsFileStorage/CmsFilesStorage.d.ts +0 -27
- package/cmsFileStorage/CmsFilesStorage.js +0 -164
- package/cmsFileStorage/CmsFilesStorage.js.map +0 -1
- package/cmsFileStorage/ListFilesWhereProcessor.d.ts +0 -7
- package/cmsFileStorage/ListFilesWhereProcessor.js +0 -33
- package/cmsFileStorage/ListFilesWhereProcessor.js.map +0 -1
- package/cmsFileStorage/ListTagsWhereProcessor.d.ts +0 -7
- package/cmsFileStorage/ListTagsWhereProcessor.js +0 -33
- package/cmsFileStorage/ListTagsWhereProcessor.js.map +0 -1
- package/cmsFileStorage/file.model.d.ts +0 -6
- package/cmsFileStorage/file.model.js +0 -158
- package/cmsFileStorage/file.model.js.map +0 -1
- package/createFileManager/files.crud.d.ts +0 -3
- package/createFileManager/files.crud.js +0 -328
- package/createFileManager/files.crud.js.map +0 -1
- package/createFileManager/index.d.ts +0 -3
- package/createFileManager/index.js +0 -23
- package/createFileManager/index.js.map +0 -1
- package/createFileManager/permissions/FilesPermissions.d.ts +0 -4
- package/createFileManager/permissions/FilesPermissions.js +0 -11
- package/createFileManager/permissions/FilesPermissions.js.map +0 -1
- package/createFileManager/permissions/SettingsPermissions.d.ts +0 -4
- package/createFileManager/permissions/SettingsPermissions.js +0 -11
- package/createFileManager/permissions/SettingsPermissions.js.map +0 -1
- package/createFileManager/settings.crud.d.ts +0 -3
- package/createFileManager/settings.crud.js +0 -117
- package/createFileManager/settings.crud.js.map +0 -1
- package/createFileManager/system.crud.d.ts +0 -3
- package/createFileManager/system.crud.js +0 -88
- package/createFileManager/system.crud.js.map +0 -1
- package/createFileManager/types.d.ts +0 -16
- package/createFileManager/types.js +0 -7
- package/createFileManager/types.js.map +0 -1
- package/delivery/AssetDelivery/AliasAssetRequestResolver.d.ts +0 -11
- package/delivery/AssetDelivery/AliasAssetRequestResolver.js +0 -74
- package/delivery/AssetDelivery/AliasAssetRequestResolver.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/internalIdentity.d.ts +0 -7
- package/delivery/AssetDelivery/privateFiles/internalIdentity.js +0 -18
- package/delivery/AssetDelivery/privateFiles/internalIdentity.js.map +0 -1
- package/enterprise/applyThreatScanning.d.ts +0 -2
- package/enterprise/applyThreatScanning.js +0 -20
- package/enterprise/applyThreatScanning.js.map +0 -1
- package/handlers/manage/imageManager.d.ts +0 -14
- package/handlers/manage/imageManager.js +0 -75
- package/handlers/manage/imageManager.js.map +0 -1
- package/handlers/manage/index.d.ts +0 -5
- package/handlers/manage/index.js +0 -59
- package/handlers/manage/index.js.map +0 -1
- package/handlers/manage/legacyUtils.d.ts +0 -12
- package/handlers/manage/legacyUtils.js +0 -34
- package/handlers/manage/legacyUtils.js.map +0 -1
- package/handlers/manage/utils.d.ts +0 -12
- package/handlers/manage/utils.js +0 -34
- package/handlers/manage/utils.js.map +0 -1
- package/handlers/types.d.ts +0 -8
- package/handlers/types.js +0 -7
- package/handlers/types.js.map +0 -1
- package/handlers/utils/getEnvironment.d.ts +0 -5
- package/handlers/utils/getEnvironment.js +0 -13
- package/handlers/utils/getEnvironment.js.map +0 -1
- package/handlers/utils/getObjectParams.d.ts +0 -9
- package/handlers/utils/getObjectParams.js +0 -23
- package/handlers/utils/getObjectParams.js.map +0 -1
- package/handlers/utils/index.d.ts +0 -2
- package/handlers/utils/index.js +0 -22
- package/handlers/utils/index.js.map +0 -1
- package/plugins/FilePhysicalStoragePlugin.d.ts +0 -22
- package/plugins/FilePhysicalStoragePlugin.js +0 -31
- package/plugins/FilePhysicalStoragePlugin.js.map +0 -1
- package/plugins/FileStorageTransformPlugin.d.ts +0 -34
- package/plugins/FileStorageTransformPlugin.js +0 -39
- package/plugins/FileStorageTransformPlugin.js.map +0 -1
- package/plugins/index.d.ts +0 -2
- package/plugins/index.js +0 -29
- package/plugins/index.js.map +0 -1
- package/storage/FileStorage.d.ts +0 -34
- package/storage/FileStorage.js +0 -90
- package/storage/FileStorage.js.map +0 -1
- package/types/file.d.ts +0 -49
- package/types/file.js +0 -7
- package/types/file.js.map +0 -1
- package/types/file.lifecycle.d.ts +0 -44
- package/types/file.lifecycle.js +0 -7
- package/types/file.lifecycle.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","DomainEvent","FileBeforeDeleteEvent","eventType","getHandlerAbstraction","FileBeforeDeleteEventHandler","FileAfterDeleteEvent","FileAfterDeleteEventHandler"],"sources":["events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { IEventHandler } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { File } from \"~/domain/file/types.js\";\n\n// ============================================================================\n// FileBeforeDelete Event\n// ============================================================================\n\nexport interface FileBeforeDeletePayload {\n file: File;\n}\n\nexport class FileBeforeDeleteEvent extends DomainEvent<FileBeforeDeletePayload> {\n eventType = \"FileManager/File/BeforeDelete\" as const;\n\n getHandlerAbstraction() {\n return FileBeforeDeleteEventHandler;\n }\n}\n\n/** Hook into file lifecycle before a file is deleted. */\nexport const FileBeforeDeleteEventHandler = createAbstraction<IEventHandler<FileBeforeDeleteEvent>>(\n \"FileBeforeDeleteEventHandler\"\n);\n\nexport namespace FileBeforeDeleteEventHandler {\n export type Interface = IEventHandler<FileBeforeDeleteEvent>;\n export type Event = FileBeforeDeleteEvent;\n}\n\n// ============================================================================\n// FileAfterDelete Event\n// ============================================================================\n\nexport interface FileAfterDeletePayload {\n file: File;\n}\n\nexport class FileAfterDeleteEvent extends DomainEvent<FileAfterDeletePayload> {\n eventType = \"FileManager/File/AfterDelete\" as const;\n\n getHandlerAbstraction() {\n return FileAfterDeleteEventHandler;\n }\n}\n\n/** Hook into file lifecycle after a file is deleted. */\nexport const FileAfterDeleteEventHandler = createAbstraction<IEventHandler<FileAfterDeleteEvent>>(\n \"FileAfterDeleteEventHandler\"\n);\n\nexport namespace FileAfterDeleteEventHandler {\n export type Interface = IEventHandler<FileAfterDeleteEvent>;\n export type Event = FileAfterDeleteEvent;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,mDAAmD;;AAI/E;AACA;AACA;;AAMA,OAAO,MAAMC,qBAAqB,SAASD,WAAW,CAA0B;EAC5EE,SAAS,GAAG,+BAA+B;EAE3CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,4BAA4B;EACvC;AACJ;;AAEA;AACA,OAAO,MAAMA,4BAA4B,GAAGL,iBAAiB,CACzD,8BACJ,CAAC;;AAOD;AACA;AACA;;AAMA,OAAO,MAAMM,oBAAoB,SAASL,WAAW,CAAyB;EAC1EE,SAAS,GAAG,8BAA8B;EAE1CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,2BAA2B;EACtC;AACJ;;AAEA;AACA,OAAO,MAAMA,2BAA2B,GAAGP,iBAAiB,CACxD,6BACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { DeleteFileRepository } from "./DeleteFileRepository.js";
|
|
3
|
+
import { DeleteFileUseCase } from "./DeleteFileUseCase.js";
|
|
4
|
+
export const DeleteFileFeature = createFeature({
|
|
5
|
+
name: "FileManager/DeleteFile",
|
|
6
|
+
register(container) {
|
|
7
|
+
container.register(DeleteFileUseCase);
|
|
8
|
+
container.register(DeleteFileRepository).inSingletonScope();
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","DeleteFileRepository","DeleteFileUseCase","DeleteFileFeature","name","register","container","inSingletonScope"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { DeleteFileRepository } from \"./DeleteFileRepository.js\";\nimport { DeleteFileUseCase } from \"./DeleteFileUseCase.js\";\n\nexport const DeleteFileFeature = createFeature({\n name: \"FileManager/DeleteFile\",\n register(container) {\n container.register(DeleteFileUseCase);\n container.register(DeleteFileRepository).inSingletonScope();\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAE1B,OAAO,MAAMC,iBAAiB,GAAGH,aAAa,CAAC;EAC3CI,IAAI,EAAE,wBAAwB;EAC9BC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,iBAAiB,CAAC;IACrCI,SAAS,CAACD,QAAQ,CAACJ,oBAAoB,CAAC,CAACM,gBAAgB,CAAC,CAAC;EAC/D;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DeleteFileUseCase","FileBeforeDeleteEventHandler","FileAfterDeleteEventHandler"],"sources":["index.ts"],"sourcesContent":["export { DeleteFileUseCase } from \"./abstractions.js\";\nexport { FileBeforeDeleteEventHandler, FileAfterDeleteEventHandler } from \"./events.js\";\n"],"mappings":"AAAA,SAASA,iBAAiB;AAC1B,SAASC,4BAA4B,EAAEC,2BAA2B","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface IFileUrlGenerator {
|
|
2
|
+
generateUrl(file: File): string;
|
|
3
|
+
}
|
|
4
|
+
/** Generate URLs for uploaded files. */
|
|
5
|
+
export declare const FileUrlGenerator: import("@webiny/di").Abstraction<IFileUrlGenerator>;
|
|
6
|
+
export declare namespace FileUrlGenerator {
|
|
7
|
+
type Interface = IFileUrlGenerator;
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","FileUrlGenerator"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\ninterface IFileUrlGenerator {\n generateUrl(file: File): string;\n}\n\n/** Generate URLs for uploaded files. */\nexport const FileUrlGenerator = createAbstraction<IFileUrlGenerator>(\"IFileUrlGenerator\");\n\nexport namespace FileUrlGenerator {\n export type Interface = IFileUrlGenerator;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAMvD;AACA,OAAO,MAAMC,gBAAgB,GAAGD,iBAAiB,CAAoB,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById";
|
|
3
|
+
import { GetFileRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
4
|
+
import { FileModel } from "../../../domain/file/abstractions.js";
|
|
5
|
+
import type { File } from "../../../domain/file/types.js";
|
|
6
|
+
declare class GetFileRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
7
|
+
private getEntryById;
|
|
8
|
+
private fileModel;
|
|
9
|
+
constructor(getEntryById: GetEntryByIdUseCase.Interface, fileModel: FileModel.Interface);
|
|
10
|
+
execute(id: string): Promise<Result<File, RepositoryAbstraction.Error>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const GetFileRepository: typeof GetFileRepositoryImpl & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetFileRepository>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetEntryByIdUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetEntryById";
|
|
3
|
+
import { GetFileRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
4
|
+
import { FileModel } from "../../../domain/file/abstractions.js";
|
|
5
|
+
import { FileNotAuthorizedError, FileNotFoundError, FilePersistenceError } from "../../../domain/file/errors.js";
|
|
6
|
+
import { EntryToFileMapper } from "../shared/EntryToFileMapper.js";
|
|
7
|
+
class GetFileRepositoryImpl {
|
|
8
|
+
constructor(getEntryById, fileModel) {
|
|
9
|
+
this.getEntryById = getEntryById;
|
|
10
|
+
this.fileModel = fileModel;
|
|
11
|
+
}
|
|
12
|
+
async execute(id) {
|
|
13
|
+
const result = await this.getEntryById.execute(this.fileModel, `${id}#0001`);
|
|
14
|
+
if (result.isFail()) {
|
|
15
|
+
const error = result.error;
|
|
16
|
+
if (error.code === "Cms/Entry/NotFound") {
|
|
17
|
+
return Result.fail(new FileNotFoundError(id));
|
|
18
|
+
}
|
|
19
|
+
if (error.code === "Cms/Entry/NotAuthorized") {
|
|
20
|
+
return Result.fail(new FileNotAuthorizedError());
|
|
21
|
+
}
|
|
22
|
+
return Result.fail(new FilePersistenceError(result.error));
|
|
23
|
+
}
|
|
24
|
+
const file = EntryToFileMapper.toFile(result.value);
|
|
25
|
+
return Result.ok(file);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export const GetFileRepository = RepositoryAbstraction.createImplementation({
|
|
29
|
+
implementation: GetFileRepositoryImpl,
|
|
30
|
+
dependencies: [GetEntryByIdUseCase, FileModel]
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=GetFileRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Result","GetEntryByIdUseCase","GetFileRepository","RepositoryAbstraction","FileModel","FileNotAuthorizedError","FileNotFoundError","FilePersistenceError","EntryToFileMapper","GetFileRepositoryImpl","constructor","getEntryById","fileModel","execute","id","result","isFail","error","code","fail","file","toFile","value","ok","createImplementation","implementation","dependencies"],"sources":["GetFileRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetEntryByIdUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetEntryById\";\nimport { GetFileRepository as RepositoryAbstraction } from \"./abstractions.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport type { File } from \"~/domain/file/types.js\";\nimport {\n FileNotAuthorizedError,\n FileNotFoundError,\n FilePersistenceError\n} from \"~/domain/file/errors.js\";\nimport { EntryToFileMapper } from \"../shared/EntryToFileMapper.js\";\n\nclass GetFileRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private getEntryById: GetEntryByIdUseCase.Interface,\n private fileModel: FileModel.Interface\n ) {}\n\n async execute(id: string): Promise<Result<File, RepositoryAbstraction.Error>> {\n const result = await this.getEntryById.execute(this.fileModel, `${id}#0001`);\n\n if (result.isFail()) {\n const error = result.error;\n\n if (error.code === \"Cms/Entry/NotFound\") {\n return Result.fail(new FileNotFoundError(id));\n }\n\n if (error.code === \"Cms/Entry/NotAuthorized\") {\n return Result.fail(new FileNotAuthorizedError());\n }\n return Result.fail(new FilePersistenceError(result.error));\n }\n\n const file = EntryToFileMapper.toFile(result.value);\n\n return Result.ok(file);\n }\n}\n\nexport const GetFileRepository = RepositoryAbstraction.createImplementation({\n implementation: GetFileRepositoryImpl,\n dependencies: [GetEntryByIdUseCase, FileModel]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,mBAAmB,QAAQ,6DAA6D;AACjG,SAASC,iBAAiB,IAAIC,qBAAqB;AACnD,SAASC,SAAS;AAElB,SACIC,sBAAsB,EACtBC,iBAAiB,EACjBC,oBAAoB;AAExB,SAASC,iBAAiB;AAE1B,MAAMC,qBAAqB,CAA4C;EACnEC,WAAWA,CACCC,YAA2C,EAC3CC,SAA8B,EACxC;IAAA,KAFUD,YAA2C,GAA3CA,YAA2C;IAAA,KAC3CC,SAA8B,GAA9BA,SAA8B;EACvC;EAEH,MAAMC,OAAOA,CAACC,EAAU,EAAsD;IAC1E,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACJ,YAAY,CAACE,OAAO,CAAC,IAAI,CAACD,SAAS,EAAE,GAAGE,EAAE,OAAO,CAAC;IAE5E,IAAIC,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MACjB,MAAMC,KAAK,GAAGF,MAAM,CAACE,KAAK;MAE1B,IAAIA,KAAK,CAACC,IAAI,KAAK,oBAAoB,EAAE;QACrC,OAAOlB,MAAM,CAACmB,IAAI,CAAC,IAAIb,iBAAiB,CAACQ,EAAE,CAAC,CAAC;MACjD;MAEA,IAAIG,KAAK,CAACC,IAAI,KAAK,yBAAyB,EAAE;QAC1C,OAAOlB,MAAM,CAACmB,IAAI,CAAC,IAAId,sBAAsB,CAAC,CAAC,CAAC;MACpD;MACA,OAAOL,MAAM,CAACmB,IAAI,CAAC,IAAIZ,oBAAoB,CAACQ,MAAM,CAACE,KAAK,CAAC,CAAC;IAC9D;IAEA,MAAMG,IAAI,GAAGZ,iBAAiB,CAACa,MAAM,CAACN,MAAM,CAACO,KAAK,CAAC;IAEnD,OAAOtB,MAAM,CAACuB,EAAE,CAACH,IAAI,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMlB,iBAAiB,GAAGC,qBAAqB,CAACqB,oBAAoB,CAAC;EACxEC,cAAc,EAAEhB,qBAAqB;EACrCiB,YAAY,EAAE,CAACzB,mBAAmB,EAAEG,SAAS;AACjD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetFileUseCase as UseCaseAbstraction, GetFileRepository } from "./abstractions.js";
|
|
3
|
+
import type { File } from "../../../domain/file/types.js";
|
|
4
|
+
import { FmPermissions } from "../../../features/shared/abstractions.js";
|
|
5
|
+
declare class GetFileUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
6
|
+
private permissions;
|
|
7
|
+
private repository;
|
|
8
|
+
constructor(permissions: FmPermissions.Interface, repository: GetFileRepository.Interface);
|
|
9
|
+
execute(id: string): Promise<Result<File, UseCaseAbstraction.Error>>;
|
|
10
|
+
}
|
|
11
|
+
export declare const GetFileUseCase: typeof GetFileUseCaseImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IGetFileUseCase>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetFileUseCase as UseCaseAbstraction, GetFileRepository } from "./abstractions.js";
|
|
3
|
+
import { FileNotAuthorizedError } from "../../../domain/file/errors.js";
|
|
4
|
+
import { FmPermissions } from "../../shared/abstractions.js";
|
|
5
|
+
class GetFileUseCaseImpl {
|
|
6
|
+
constructor(permissions, repository) {
|
|
7
|
+
this.permissions = permissions;
|
|
8
|
+
this.repository = repository;
|
|
9
|
+
}
|
|
10
|
+
async execute(id) {
|
|
11
|
+
const hasPermission = await this.permissions.canRead("file");
|
|
12
|
+
if (!hasPermission) {
|
|
13
|
+
return Result.fail(new FileNotAuthorizedError());
|
|
14
|
+
}
|
|
15
|
+
const result = await this.repository.execute(id);
|
|
16
|
+
if (result.isFail()) {
|
|
17
|
+
return Result.fail(result.error);
|
|
18
|
+
}
|
|
19
|
+
const file = result.value;
|
|
20
|
+
if (!(await this.permissions.canAccess("file", file))) {
|
|
21
|
+
return Result.fail(new FileNotAuthorizedError());
|
|
22
|
+
}
|
|
23
|
+
return Result.ok(file);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export const GetFileUseCase = UseCaseAbstraction.createImplementation({
|
|
27
|
+
implementation: GetFileUseCaseImpl,
|
|
28
|
+
dependencies: [FmPermissions, GetFileRepository]
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=GetFileUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Result","GetFileUseCase","UseCaseAbstraction","GetFileRepository","FileNotAuthorizedError","FmPermissions","GetFileUseCaseImpl","constructor","permissions","repository","execute","id","hasPermission","canRead","fail","result","isFail","error","file","value","canAccess","ok","createImplementation","implementation","dependencies"],"sources":["GetFileUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetFileUseCase as UseCaseAbstraction, GetFileRepository } from \"./abstractions.js\";\nimport type { File } from \"~/domain/file/types.js\";\nimport { FileNotAuthorizedError } from \"~/domain/file/errors.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\n\nclass GetFileUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private permissions: FmPermissions.Interface,\n private repository: GetFileRepository.Interface\n ) {}\n\n async execute(id: string): Promise<Result<File, UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canRead(\"file\");\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const result = await this.repository.execute(id);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n const file = result.value;\n\n if (!(await this.permissions.canAccess(\"file\", file))) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n return Result.ok(file);\n }\n}\n\nexport const GetFileUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetFileUseCaseImpl,\n dependencies: [FmPermissions, GetFileRepository]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,cAAc,IAAIC,kBAAkB,EAAEC,iBAAiB;AAEhE,SAASC,sBAAsB;AAC/B,SAASC,aAAa;AAEtB,MAAMC,kBAAkB,CAAyC;EAC7DC,WAAWA,CACCC,WAAoC,EACpCC,UAAuC,EACjD;IAAA,KAFUD,WAAoC,GAApCA,WAAoC;IAAA,KACpCC,UAAuC,GAAvCA,UAAuC;EAChD;EAEH,MAAMC,OAAOA,CAACC,EAAU,EAAmD;IACvE,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACJ,WAAW,CAACK,OAAO,CAAC,MAAM,CAAC;IAC5D,IAAI,CAACD,aAAa,EAAE;MAChB,OAAOZ,MAAM,CAACc,IAAI,CAAC,IAAIV,sBAAsB,CAAC,CAAC,CAAC;IACpD;IAEA,MAAMW,MAAM,GAAG,MAAM,IAAI,CAACN,UAAU,CAACC,OAAO,CAACC,EAAE,CAAC;IAEhD,IAAII,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOhB,MAAM,CAACc,IAAI,CAACC,MAAM,CAACE,KAAK,CAAC;IACpC;IAEA,MAAMC,IAAI,GAAGH,MAAM,CAACI,KAAK;IAEzB,IAAI,EAAE,MAAM,IAAI,CAACX,WAAW,CAACY,SAAS,CAAC,MAAM,EAAEF,IAAI,CAAC,CAAC,EAAE;MACnD,OAAOlB,MAAM,CAACc,IAAI,CAAC,IAAIV,sBAAsB,CAAC,CAAC,CAAC;IACpD;IAEA,OAAOJ,MAAM,CAACqB,EAAE,CAACH,IAAI,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMjB,cAAc,GAAGC,kBAAkB,CAACoB,oBAAoB,CAAC;EAClEC,cAAc,EAAEjB,kBAAkB;EAClCkB,YAAY,EAAE,CAACnB,aAAa,EAAEF,iBAAiB;AACnD,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { File } from "../../../domain/file/types.js";
|
|
3
|
+
import { type FilePersistenceError, type FileNotFoundError, FileNotAuthorizedError } from "../../../domain/file/errors.js";
|
|
4
|
+
/**
|
|
5
|
+
* GetFile repository interface
|
|
6
|
+
*/
|
|
7
|
+
export interface IGetFileRepository {
|
|
8
|
+
execute(id: string): Promise<Result<File, RepositoryError>>;
|
|
9
|
+
}
|
|
10
|
+
export interface IGetFileRepositoryErrors {
|
|
11
|
+
notFound: FileNotFoundError;
|
|
12
|
+
notAuthorized: FileNotAuthorizedError;
|
|
13
|
+
persistence: FilePersistenceError;
|
|
14
|
+
}
|
|
15
|
+
type RepositoryError = IGetFileRepositoryErrors[keyof IGetFileRepositoryErrors];
|
|
16
|
+
/** Fetch a file from storage. */
|
|
17
|
+
export declare const GetFileRepository: import("@webiny/di").Abstraction<IGetFileRepository>;
|
|
18
|
+
export declare namespace GetFileRepository {
|
|
19
|
+
type Interface = IGetFileRepository;
|
|
20
|
+
type Error = RepositoryError;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* GetFile use case interface
|
|
24
|
+
*/
|
|
25
|
+
export interface IGetFileUseCase {
|
|
26
|
+
execute(id: string): Promise<Result<File, UseCaseError>>;
|
|
27
|
+
}
|
|
28
|
+
export interface IGetFileUseCaseErrors {
|
|
29
|
+
notAuthorized: FileNotAuthorizedError;
|
|
30
|
+
notFound: FileNotFoundError;
|
|
31
|
+
persistence: FilePersistenceError;
|
|
32
|
+
}
|
|
33
|
+
type UseCaseError = IGetFileUseCaseErrors[keyof IGetFileUseCaseErrors];
|
|
34
|
+
/** Retrieve a file by ID. */
|
|
35
|
+
export declare const GetFileUseCase: import("@webiny/di").Abstraction<IGetFileUseCase>;
|
|
36
|
+
export declare namespace GetFileUseCase {
|
|
37
|
+
type Interface = IGetFileUseCase;
|
|
38
|
+
type Error = UseCaseError;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GetFile repository interface
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Fetch a file from storage. */
|
|
8
|
+
export const GetFileRepository = createAbstraction("GetFileRepository");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* GetFile use case interface
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Retrieve a file by ID. */
|
|
15
|
+
export const GetFileUseCase = createAbstraction("GetFileUseCase");
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","GetFileRepository","GetFileUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { File } from \"~/domain/file/types.js\";\nimport {\n type FilePersistenceError,\n type FileNotFoundError,\n FileNotAuthorizedError\n} from \"~/domain/file/errors.js\";\n\n/**\n * GetFile repository interface\n */\nexport interface IGetFileRepository {\n execute(id: string): Promise<Result<File, RepositoryError>>;\n}\n\nexport interface IGetFileRepositoryErrors {\n notFound: FileNotFoundError;\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = IGetFileRepositoryErrors[keyof IGetFileRepositoryErrors];\n\n/** Fetch a file from storage. */\nexport const GetFileRepository = createAbstraction<IGetFileRepository>(\"GetFileRepository\");\n\nexport namespace GetFileRepository {\n export type Interface = IGetFileRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * GetFile use case interface\n */\nexport interface IGetFileUseCase {\n execute(id: string): Promise<Result<File, UseCaseError>>;\n}\n\nexport interface IGetFileUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n notFound: FileNotFoundError;\n persistence: FilePersistenceError;\n}\n\ntype UseCaseError = IGetFileUseCaseErrors[keyof IGetFileUseCaseErrors];\n\n/** Retrieve a file by ID. */\nexport const GetFileUseCase = createAbstraction<IGetFileUseCase>(\"GetFileUseCase\");\n\nexport namespace GetFileUseCase {\n export type Interface = IGetFileUseCase;\n export type Error = UseCaseError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AASvD;AACA;AACA;;AAaA;AACA,OAAO,MAAMC,iBAAiB,GAAGD,iBAAiB,CAAqB,mBAAmB,CAAC;;AAO3F;AACA;AACA;;AAaA;AACA,OAAO,MAAME,cAAc,GAAGF,iBAAiB,CAAkB,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { GetFileRepository } from "./GetFileRepository.js";
|
|
3
|
+
import { GetFileUseCase } from "./GetFileUseCase.js";
|
|
4
|
+
export const GetFileFeature = createFeature({
|
|
5
|
+
name: "FileManager/GetFile",
|
|
6
|
+
register(container) {
|
|
7
|
+
container.register(GetFileUseCase);
|
|
8
|
+
container.register(GetFileRepository).inSingletonScope();
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","GetFileRepository","GetFileUseCase","GetFileFeature","name","register","container","inSingletonScope"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFileRepository } from \"./GetFileRepository.js\";\nimport { GetFileUseCase } from \"./GetFileUseCase.js\";\n\nexport const GetFileFeature = createFeature({\n name: \"FileManager/GetFile\",\n register(container) {\n container.register(GetFileUseCase);\n container.register(GetFileRepository).inSingletonScope();\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AAEvB,OAAO,MAAMC,cAAc,GAAGH,aAAa,CAAC;EACxCI,IAAI,EAAE,qBAAqB;EAC3BC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,cAAc,CAAC;IAClCI,SAAS,CAACD,QAAQ,CAACJ,iBAAiB,CAAC,CAACM,gBAAgB,CAAC,CAAC;EAC5D;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GetFileUseCase } from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GetFileUseCase"],"sources":["index.ts"],"sourcesContent":["export { GetFileUseCase } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import { type FileNotFoundError, type FilePersistenceError } from "../../../domain/file/errors.js";
|
|
3
|
+
export interface FileContents {
|
|
4
|
+
buffer: Buffer;
|
|
5
|
+
contentType: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IGetFileContentsUseCase {
|
|
8
|
+
execute(fileId: string): Promise<Result<FileContents, GetFileContentsError>>;
|
|
9
|
+
}
|
|
10
|
+
export interface IGetFileContentsUseCaseErrors {
|
|
11
|
+
notFound: FileNotFoundError;
|
|
12
|
+
persistence: FilePersistenceError;
|
|
13
|
+
}
|
|
14
|
+
type GetFileContentsError = IGetFileContentsUseCaseErrors[keyof IGetFileContentsUseCaseErrors];
|
|
15
|
+
export declare const GetFileContentsUseCase: import("@webiny/di").Abstraction<IGetFileContentsUseCase>;
|
|
16
|
+
export declare namespace GetFileContentsUseCase {
|
|
17
|
+
type Interface = IGetFileContentsUseCase;
|
|
18
|
+
type Error = GetFileContentsError;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","GetFileContentsUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport { type FileNotFoundError, type FilePersistenceError } from \"~/domain/file/errors.js\";\n\nexport interface FileContents {\n buffer: Buffer;\n contentType: string;\n}\n\nexport interface IGetFileContentsUseCase {\n execute(fileId: string): Promise<Result<FileContents, GetFileContentsError>>;\n}\n\nexport interface IGetFileContentsUseCaseErrors {\n notFound: FileNotFoundError;\n persistence: FilePersistenceError;\n}\n\ntype GetFileContentsError = IGetFileContentsUseCaseErrors[keyof IGetFileContentsUseCaseErrors];\n\nexport const GetFileContentsUseCase =\n createAbstraction<IGetFileContentsUseCase>(\"GetFileContentsUseCase\");\n\nexport namespace GetFileContentsUseCase {\n export type Interface = IGetFileContentsUseCase;\n export type Error = GetFileContentsError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAoBvD,OAAO,MAAMC,sBAAsB,GAC/BD,iBAAiB,CAA0B,wBAAwB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GetFileContentsUseCase, type FileContents } from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["GetFileContentsUseCase"],"sources":["index.ts"],"sourcesContent":["export { GetFileContentsUseCase, type FileContents } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,sBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListLatestEntriesUseCase } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js";
|
|
3
|
+
import { ListFilesInput, ListFilesOutput, ListFilesRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
4
|
+
import { FileModel } from "../../../domain/file/abstractions.js";
|
|
5
|
+
import { CmsWhereMapper } from "@webiny/api-headless-cms";
|
|
6
|
+
import { CmsSortMapper } from "@webiny/api-headless-cms";
|
|
7
|
+
declare class ListFilesRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
8
|
+
private listLatestEntries;
|
|
9
|
+
private fileModel;
|
|
10
|
+
private cmsWhereMapper;
|
|
11
|
+
private cmsSortMapper;
|
|
12
|
+
constructor(listLatestEntries: ListLatestEntriesUseCase.Interface, fileModel: FileModel.Interface, cmsWhereMapper: CmsWhereMapper.Interface, cmsSortMapper: CmsSortMapper.Interface);
|
|
13
|
+
execute(input: ListFilesInput): Promise<Result<ListFilesOutput, RepositoryAbstraction.Error>>;
|
|
14
|
+
}
|
|
15
|
+
export declare const ListFilesRepository: typeof ListFilesRepositoryImpl & {
|
|
16
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListFilesRepository>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListLatestEntriesUseCase } from "@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js";
|
|
3
|
+
import { ListFilesRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
4
|
+
import { FileModel } from "../../../domain/file/abstractions.js";
|
|
5
|
+
import { FilePersistenceError } from "../../../domain/file/errors.js";
|
|
6
|
+
import { EntryToFileMapper } from "../shared/EntryToFileMapper.js";
|
|
7
|
+
import { CmsWhereMapper } from "@webiny/api-headless-cms";
|
|
8
|
+
import { CmsSortMapper } from "@webiny/api-headless-cms";
|
|
9
|
+
class ListFilesRepositoryImpl {
|
|
10
|
+
constructor(listLatestEntries, fileModel, cmsWhereMapper, cmsSortMapper) {
|
|
11
|
+
this.listLatestEntries = listLatestEntries;
|
|
12
|
+
this.fileModel = fileModel;
|
|
13
|
+
this.cmsWhereMapper = cmsWhereMapper;
|
|
14
|
+
this.cmsSortMapper = cmsSortMapper;
|
|
15
|
+
}
|
|
16
|
+
async execute(input) {
|
|
17
|
+
const where = this.cmsWhereMapper.map({
|
|
18
|
+
input: input.where || {},
|
|
19
|
+
fields: this.fileModel.fields
|
|
20
|
+
});
|
|
21
|
+
const sort = this.cmsSortMapper.map({
|
|
22
|
+
input: input.sort,
|
|
23
|
+
fields: this.fileModel.fields
|
|
24
|
+
});
|
|
25
|
+
const result = await this.listLatestEntries.execute(this.fileModel, {
|
|
26
|
+
where,
|
|
27
|
+
limit: input.limit || 40,
|
|
28
|
+
after: input.after || undefined,
|
|
29
|
+
sort: sort || ["id_DESC"],
|
|
30
|
+
search: input.search
|
|
31
|
+
});
|
|
32
|
+
if (result.isFail()) {
|
|
33
|
+
return Result.fail(new FilePersistenceError(result.error));
|
|
34
|
+
}
|
|
35
|
+
const {
|
|
36
|
+
entries,
|
|
37
|
+
meta
|
|
38
|
+
} = result.value;
|
|
39
|
+
const files = entries.map(entry => EntryToFileMapper.toFile(entry));
|
|
40
|
+
return Result.ok({
|
|
41
|
+
items: files,
|
|
42
|
+
meta
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export const ListFilesRepository = RepositoryAbstraction.createImplementation({
|
|
47
|
+
implementation: ListFilesRepositoryImpl,
|
|
48
|
+
dependencies: [ListLatestEntriesUseCase, FileModel, CmsWhereMapper, CmsSortMapper]
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=ListFilesRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Result","ListLatestEntriesUseCase","ListFilesRepository","RepositoryAbstraction","FileModel","FilePersistenceError","EntryToFileMapper","CmsWhereMapper","CmsSortMapper","ListFilesRepositoryImpl","constructor","listLatestEntries","fileModel","cmsWhereMapper","cmsSortMapper","execute","input","where","map","fields","sort","result","limit","after","undefined","search","isFail","fail","error","entries","meta","value","files","entry","toFile","ok","items","createImplementation","implementation","dependencies"],"sources":["ListFilesRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { ListLatestEntriesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/index.js\";\nimport {\n ListFilesInput,\n ListFilesOutput,\n ListFilesRepository as RepositoryAbstraction\n} from \"./abstractions.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport { FilePersistenceError } from \"~/domain/file/errors.js\";\nimport { EntryToFileMapper } from \"../shared/EntryToFileMapper.js\";\nimport { CmsWhereMapper } from \"@webiny/api-headless-cms\";\nimport { CmsSortMapper } from \"@webiny/api-headless-cms\";\nimport { GenericRecord } from \"@webiny/api/types.js\";\n\nclass ListFilesRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private listLatestEntries: ListLatestEntriesUseCase.Interface,\n private fileModel: FileModel.Interface,\n private cmsWhereMapper: CmsWhereMapper.Interface,\n private cmsSortMapper: CmsSortMapper.Interface\n ) {}\n\n async execute(\n input: ListFilesInput\n ): Promise<Result<ListFilesOutput, RepositoryAbstraction.Error>> {\n const where = this.cmsWhereMapper.map<GenericRecord>({\n input: input.where || {},\n fields: this.fileModel.fields\n });\n\n const sort = this.cmsSortMapper.map({\n input: input.sort,\n fields: this.fileModel.fields\n });\n\n const result = await this.listLatestEntries.execute(this.fileModel, {\n where,\n limit: input.limit || 40,\n after: input.after || undefined,\n sort: sort || [\"id_DESC\"],\n search: input.search\n });\n\n if (result.isFail()) {\n return Result.fail(new FilePersistenceError(result.error));\n }\n\n const { entries, meta } = result.value;\n\n const files = entries.map(entry => EntryToFileMapper.toFile(entry));\n\n return Result.ok({\n items: files,\n meta\n });\n }\n}\n\nexport const ListFilesRepository = RepositoryAbstraction.createImplementation({\n implementation: ListFilesRepositoryImpl,\n dependencies: [ListLatestEntriesUseCase, FileModel, CmsWhereMapper, CmsSortMapper]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,wBAAwB,QAAQ,qEAAqE;AAC9G,SAGIC,mBAAmB,IAAIC,qBAAqB;AAEhD,SAASC,SAAS;AAClB,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,aAAa,QAAQ,0BAA0B;AAGxD,MAAMC,uBAAuB,CAA4C;EACrEC,WAAWA,CACCC,iBAAqD,EACrDC,SAA8B,EAC9BC,cAAwC,EACxCC,aAAsC,EAChD;IAAA,KAJUH,iBAAqD,GAArDA,iBAAqD;IAAA,KACrDC,SAA8B,GAA9BA,SAA8B;IAAA,KAC9BC,cAAwC,GAAxCA,cAAwC;IAAA,KACxCC,aAAsC,GAAtCA,aAAsC;EAC/C;EAEH,MAAMC,OAAOA,CACTC,KAAqB,EACwC;IAC7D,MAAMC,KAAK,GAAG,IAAI,CAACJ,cAAc,CAACK,GAAG,CAAgB;MACjDF,KAAK,EAAEA,KAAK,CAACC,KAAK,IAAI,CAAC,CAAC;MACxBE,MAAM,EAAE,IAAI,CAACP,SAAS,CAACO;IAC3B,CAAC,CAAC;IAEF,MAAMC,IAAI,GAAG,IAAI,CAACN,aAAa,CAACI,GAAG,CAAC;MAChCF,KAAK,EAAEA,KAAK,CAACI,IAAI;MACjBD,MAAM,EAAE,IAAI,CAACP,SAAS,CAACO;IAC3B,CAAC,CAAC;IAEF,MAAME,MAAM,GAAG,MAAM,IAAI,CAACV,iBAAiB,CAACI,OAAO,CAAC,IAAI,CAACH,SAAS,EAAE;MAChEK,KAAK;MACLK,KAAK,EAAEN,KAAK,CAACM,KAAK,IAAI,EAAE;MACxBC,KAAK,EAAEP,KAAK,CAACO,KAAK,IAAIC,SAAS;MAC/BJ,IAAI,EAAEA,IAAI,IAAI,CAAC,SAAS,CAAC;MACzBK,MAAM,EAAET,KAAK,CAACS;IAClB,CAAC,CAAC;IAEF,IAAIJ,MAAM,CAACK,MAAM,CAAC,CAAC,EAAE;MACjB,OAAO1B,MAAM,CAAC2B,IAAI,CAAC,IAAItB,oBAAoB,CAACgB,MAAM,CAACO,KAAK,CAAC,CAAC;IAC9D;IAEA,MAAM;MAAEC,OAAO;MAAEC;IAAK,CAAC,GAAGT,MAAM,CAACU,KAAK;IAEtC,MAAMC,KAAK,GAAGH,OAAO,CAACX,GAAG,CAACe,KAAK,IAAI3B,iBAAiB,CAAC4B,MAAM,CAACD,KAAK,CAAC,CAAC;IAEnE,OAAOjC,MAAM,CAACmC,EAAE,CAAC;MACbC,KAAK,EAAEJ,KAAK;MACZF;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAM5B,mBAAmB,GAAGC,qBAAqB,CAACkC,oBAAoB,CAAC;EAC1EC,cAAc,EAAE7B,uBAAuB;EACvC8B,YAAY,EAAE,CAACtC,wBAAwB,EAAEG,SAAS,EAAEG,cAAc,EAAEC,aAAa;AACrF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListFilesUseCase as UseCaseAbstraction, ListFilesInput, ListFilesOutput, ListFilesRepository } from "./abstractions.js";
|
|
3
|
+
import { FmPermissions } from "../../../features/shared/abstractions.js";
|
|
4
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
5
|
+
declare class ListFilesUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
6
|
+
private permissions;
|
|
7
|
+
private identityContext;
|
|
8
|
+
private repository;
|
|
9
|
+
constructor(permissions: FmPermissions.Interface, identityContext: IdentityContext.Interface, repository: ListFilesRepository.Interface);
|
|
10
|
+
execute(input: ListFilesInput): Promise<Result<ListFilesOutput, UseCaseAbstraction.Error>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const ListFilesUseCase: typeof ListFilesUseCaseImpl & {
|
|
13
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListFilesUseCase>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListFilesUseCase as UseCaseAbstraction, ListFilesRepository } from "./abstractions.js";
|
|
3
|
+
import { FileNotAuthorizedError } from "../../../domain/file/errors.js";
|
|
4
|
+
import { FmPermissions } from "../../shared/abstractions.js";
|
|
5
|
+
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
6
|
+
class ListFilesUseCaseImpl {
|
|
7
|
+
constructor(permissions, identityContext, repository) {
|
|
8
|
+
this.permissions = permissions;
|
|
9
|
+
this.identityContext = identityContext;
|
|
10
|
+
this.repository = repository;
|
|
11
|
+
}
|
|
12
|
+
async execute(input) {
|
|
13
|
+
const hasPermission = await this.permissions.canRead("file");
|
|
14
|
+
if (!hasPermission) {
|
|
15
|
+
return Result.fail(new FileNotAuthorizedError());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Build where clause.
|
|
19
|
+
const where = {
|
|
20
|
+
...(input.where || {})
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Filter by createdBy if user can only access own records.
|
|
24
|
+
if (await this.permissions.onlyOwnRecords("file")) {
|
|
25
|
+
const identity = this.identityContext.getIdentity();
|
|
26
|
+
where.createdBy = identity.id;
|
|
27
|
+
}
|
|
28
|
+
const result = await this.repository.execute({
|
|
29
|
+
...input,
|
|
30
|
+
where,
|
|
31
|
+
limit: input.limit || 40,
|
|
32
|
+
sort: input.sort && input.sort.length > 0 ? input.sort : ["id_DESC"]
|
|
33
|
+
});
|
|
34
|
+
if (result.isFail()) {
|
|
35
|
+
return Result.fail(result.error);
|
|
36
|
+
}
|
|
37
|
+
return Result.ok(result.value);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const ListFilesUseCase = UseCaseAbstraction.createImplementation({
|
|
41
|
+
implementation: ListFilesUseCaseImpl,
|
|
42
|
+
dependencies: [FmPermissions, IdentityContext, ListFilesRepository]
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=ListFilesUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Result","ListFilesUseCase","UseCaseAbstraction","ListFilesRepository","FileNotAuthorizedError","FmPermissions","IdentityContext","ListFilesUseCaseImpl","constructor","permissions","identityContext","repository","execute","input","hasPermission","canRead","fail","where","onlyOwnRecords","identity","getIdentity","createdBy","id","result","limit","sort","length","isFail","error","ok","value","createImplementation","implementation","dependencies"],"sources":["ListFilesUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n ListFilesUseCase as UseCaseAbstraction,\n ListFilesInput,\n ListFilesOutput,\n ListFilesRepository\n} from \"./abstractions.js\";\nimport { FileNotAuthorizedError } from \"~/domain/file/errors.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\n\nclass ListFilesUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private permissions: FmPermissions.Interface,\n private identityContext: IdentityContext.Interface,\n private repository: ListFilesRepository.Interface\n ) {}\n\n async execute(\n input: ListFilesInput\n ): Promise<Result<ListFilesOutput, UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canRead(\"file\");\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n // Build where clause.\n const where: ListFilesInput[\"where\"] = {\n ...(input.where || {})\n };\n\n // Filter by createdBy if user can only access own records.\n if (await this.permissions.onlyOwnRecords(\"file\")) {\n const identity = this.identityContext.getIdentity();\n where.createdBy = identity.id;\n }\n\n const result = await this.repository.execute({\n ...input,\n where,\n limit: input.limit || 40,\n sort: input.sort && input.sort.length > 0 ? input.sort : [\"id_DESC\"]\n });\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n return Result.ok(result.value);\n }\n}\n\nexport const ListFilesUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListFilesUseCaseImpl,\n dependencies: [FmPermissions, IdentityContext, ListFilesRepository]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,gBAAgB,IAAIC,kBAAkB,EAGtCC,mBAAmB;AAEvB,SAASC,sBAAsB;AAC/B,SAASC,aAAa;AACtB,SAASC,eAAe,QAAQ,6DAA6D;AAE7F,MAAMC,oBAAoB,CAAyC;EAC/DC,WAAWA,CACCC,WAAoC,EACpCC,eAA0C,EAC1CC,UAAyC,EACnD;IAAA,KAHUF,WAAoC,GAApCA,WAAoC;IAAA,KACpCC,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,UAAyC,GAAzCA,UAAyC;EAClD;EAEH,MAAMC,OAAOA,CACTC,KAAqB,EACqC;IAC1D,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACL,WAAW,CAACM,OAAO,CAAC,MAAM,CAAC;IAC5D,IAAI,CAACD,aAAa,EAAE;MAChB,OAAOd,MAAM,CAACgB,IAAI,CAAC,IAAIZ,sBAAsB,CAAC,CAAC,CAAC;IACpD;;IAEA;IACA,MAAMa,KAA8B,GAAG;MACnC,IAAIJ,KAAK,CAACI,KAAK,IAAI,CAAC,CAAC;IACzB,CAAC;;IAED;IACA,IAAI,MAAM,IAAI,CAACR,WAAW,CAACS,cAAc,CAAC,MAAM,CAAC,EAAE;MAC/C,MAAMC,QAAQ,GAAG,IAAI,CAACT,eAAe,CAACU,WAAW,CAAC,CAAC;MACnDH,KAAK,CAACI,SAAS,GAAGF,QAAQ,CAACG,EAAE;IACjC;IAEA,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACZ,UAAU,CAACC,OAAO,CAAC;MACzC,GAAGC,KAAK;MACRI,KAAK;MACLO,KAAK,EAAEX,KAAK,CAACW,KAAK,IAAI,EAAE;MACxBC,IAAI,EAAEZ,KAAK,CAACY,IAAI,IAAIZ,KAAK,CAACY,IAAI,CAACC,MAAM,GAAG,CAAC,GAAGb,KAAK,CAACY,IAAI,GAAG,CAAC,SAAS;IACvE,CAAC,CAAC;IAEF,IAAIF,MAAM,CAACI,MAAM,CAAC,CAAC,EAAE;MACjB,OAAO3B,MAAM,CAACgB,IAAI,CAACO,MAAM,CAACK,KAAK,CAAC;IACpC;IAEA,OAAO5B,MAAM,CAAC6B,EAAE,CAACN,MAAM,CAACO,KAAK,CAAC;EAClC;AACJ;AAEA,OAAO,MAAM7B,gBAAgB,GAAGC,kBAAkB,CAAC6B,oBAAoB,CAAC;EACpEC,cAAc,EAAEzB,oBAAoB;EACpC0B,YAAY,EAAE,CAAC5B,aAAa,EAAEC,eAAe,EAAEH,mBAAmB;AACtE,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Result } from "@webiny/feature/api";
|
|
2
|
+
import type { File } from "../../../domain/file/types.js";
|
|
3
|
+
import { type FilePersistenceError, FileNotAuthorizedError } from "../../../domain/file/errors.js";
|
|
4
|
+
import type { CmsEntryMeta } from "@webiny/api-headless-cms/types";
|
|
5
|
+
export interface ListFilesInput {
|
|
6
|
+
limit?: number;
|
|
7
|
+
after?: string | null;
|
|
8
|
+
where?: Record<string, any>;
|
|
9
|
+
sort?: Array<`${string}_ASC` | `${string}_DESC`>;
|
|
10
|
+
search?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ListFilesOutput {
|
|
13
|
+
items: File[];
|
|
14
|
+
meta: CmsEntryMeta;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* ListFiles repository interface
|
|
18
|
+
*/
|
|
19
|
+
export interface IListFilesRepository {
|
|
20
|
+
execute(input: ListFilesInput): Promise<Result<ListFilesOutput, RepositoryError>>;
|
|
21
|
+
}
|
|
22
|
+
export interface IListFilesRepositoryErrors {
|
|
23
|
+
persistence: FilePersistenceError;
|
|
24
|
+
}
|
|
25
|
+
type RepositoryError = IListFilesRepositoryErrors[keyof IListFilesRepositoryErrors];
|
|
26
|
+
/** Fetch files from storage with filtering. */
|
|
27
|
+
export declare const ListFilesRepository: import("@webiny/di").Abstraction<IListFilesRepository>;
|
|
28
|
+
export declare namespace ListFilesRepository {
|
|
29
|
+
type Interface = IListFilesRepository;
|
|
30
|
+
type Error = RepositoryError;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* ListFiles use case interface
|
|
34
|
+
*/
|
|
35
|
+
export interface IListFilesUseCase {
|
|
36
|
+
execute(input: ListFilesInput): Promise<Result<ListFilesOutput, UseCaseError>>;
|
|
37
|
+
}
|
|
38
|
+
export interface IListFilesUseCaseErrors {
|
|
39
|
+
notAuthorized: FileNotAuthorizedError;
|
|
40
|
+
persistence: FilePersistenceError;
|
|
41
|
+
}
|
|
42
|
+
type UseCaseError = IListFilesUseCaseErrors[keyof IListFilesUseCaseErrors];
|
|
43
|
+
/** List files with filtering and pagination. */
|
|
44
|
+
export declare const ListFilesUseCase: import("@webiny/di").Abstraction<IListFilesUseCase>;
|
|
45
|
+
export declare namespace ListFilesUseCase {
|
|
46
|
+
type Interface = IListFilesUseCase;
|
|
47
|
+
type Error = UseCaseError;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ListFiles repository interface
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Fetch files from storage with filtering. */
|
|
8
|
+
export const ListFilesRepository = createAbstraction("ListFilesRepository");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ListFiles use case interface
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** List files with filtering and pagination. */
|
|
15
|
+
export const ListFilesUseCase = createAbstraction("ListFilesUseCase");
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","ListFilesRepository","ListFilesUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { File } from \"~/domain/file/types.js\";\nimport { type FilePersistenceError, FileNotAuthorizedError } from \"~/domain/file/errors.js\";\nimport type { CmsEntryMeta } from \"@webiny/api-headless-cms/types\";\n\nexport interface ListFilesInput {\n limit?: number;\n after?: string | null;\n where?: Record<string, any>;\n sort?: Array<`${string}_ASC` | `${string}_DESC`>;\n search?: string;\n}\n\nexport interface ListFilesOutput {\n items: File[];\n meta: CmsEntryMeta;\n}\n\n/**\n * ListFiles repository interface\n */\nexport interface IListFilesRepository {\n execute(input: ListFilesInput): Promise<Result<ListFilesOutput, RepositoryError>>;\n}\n\nexport interface IListFilesRepositoryErrors {\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = IListFilesRepositoryErrors[keyof IListFilesRepositoryErrors];\n\n/** Fetch files from storage with filtering. */\nexport const ListFilesRepository = createAbstraction<IListFilesRepository>(\"ListFilesRepository\");\n\nexport namespace ListFilesRepository {\n export type Interface = IListFilesRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * ListFiles use case interface\n */\nexport interface IListFilesUseCase {\n execute(input: ListFilesInput): Promise<Result<ListFilesOutput, UseCaseError>>;\n}\n\nexport interface IListFilesUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n}\n\ntype UseCaseError = IListFilesUseCaseErrors[keyof IListFilesUseCaseErrors];\n\n/** List files with filtering and pagination. */\nexport const ListFilesUseCase = createAbstraction<IListFilesUseCase>(\"ListFilesUseCase\");\n\nexport namespace ListFilesUseCase {\n export type Interface = IListFilesUseCase;\n export type Error = UseCaseError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAmBvD;AACA;AACA;;AAWA;AACA,OAAO,MAAMC,mBAAmB,GAAGD,iBAAiB,CAAuB,qBAAqB,CAAC;;AAOjG;AACA;AACA;;AAYA;AACA,OAAO,MAAME,gBAAgB,GAAGF,iBAAiB,CAAoB,kBAAkB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { ListFilesRepository } from "./ListFilesRepository.js";
|
|
3
|
+
import { ListFilesUseCase } from "./ListFilesUseCase.js";
|
|
4
|
+
export const ListFilesFeature = createFeature({
|
|
5
|
+
name: "FileManager/ListFiles",
|
|
6
|
+
register(container) {
|
|
7
|
+
container.register(ListFilesUseCase);
|
|
8
|
+
container.register(ListFilesRepository).inSingletonScope();
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","ListFilesRepository","ListFilesUseCase","ListFilesFeature","name","register","container","inSingletonScope"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListFilesRepository } from \"./ListFilesRepository.js\";\nimport { ListFilesUseCase } from \"./ListFilesUseCase.js\";\n\nexport const ListFilesFeature = createFeature({\n name: \"FileManager/ListFiles\",\n register(container) {\n container.register(ListFilesUseCase);\n container.register(ListFilesRepository).inSingletonScope();\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,mBAAmB;AAC5B,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,gBAAgB,GAAGH,aAAa,CAAC;EAC1CI,IAAI,EAAE,uBAAuB;EAC7BC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,gBAAgB,CAAC;IACpCI,SAAS,CAACD,QAAQ,CAACJ,mBAAmB,CAAC,CAACM,gBAAgB,CAAC,CAAC;EAC9D;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ListFilesUseCase } from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ListFilesUseCase"],"sources":["index.ts"],"sourcesContent":["export { ListFilesUseCase } from \"./abstractions.js\";\n"],"mappings":"AAAA,SAASA,gBAAgB","ignoreList":[]}
|