@webiny/api-file-manager 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.f6dc066313
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 +56 -0
- package/domain/file/file.model.js.map +1 -0
- package/domain/file/types.d.ts +51 -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/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 +14 -0
- package/domain/settings/validation.js +36 -0
- package/domain/settings/validation.js.map +1 -0
- package/features/FileManagerFeature.d.ts +1 -0
- package/features/FileManagerFeature.js +28 -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 +89 -0
- package/features/file/CreateFile/CreateFileUseCase.js.map +1 -0
- package/features/file/CreateFile/abstractions.d.ts +57 -0
- package/features/file/CreateFile/abstractions.js +15 -0
- package/features/file/CreateFile/abstractions.js.map +1 -0
- package/features/file/CreateFile/events.d.ts +29 -0
- package/features/file/CreateFile/events.js +28 -0
- package/features/file/CreateFile/events.js.map +1 -0
- package/features/file/CreateFile/feature.d.ts +1 -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 +40 -0
- package/features/file/CreateFilesInBatch/abstractions.js +15 -0
- package/features/file/CreateFilesInBatch/abstractions.js.map +1 -0
- package/features/file/CreateFilesInBatch/events.d.ts +29 -0
- package/features/file/CreateFilesInBatch/events.js +28 -0
- package/features/file/CreateFilesInBatch/events.js.map +1 -0
- package/features/file/CreateFilesInBatch/feature.d.ts +1 -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 +37 -0
- package/features/file/DeleteFile/abstractions.js +15 -0
- package/features/file/DeleteFile/abstractions.js.map +1 -0
- package/features/file/DeleteFile/events.d.ts +27 -0
- package/features/file/DeleteFile/events.js +28 -0
- package/features/file/DeleteFile/events.js.map +1 -0
- package/features/file/DeleteFile/feature.d.ts +1 -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 +8 -0
- package/features/file/FileUrlGenerator/abstractions.js +4 -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 +38 -0
- package/features/file/GetFile/abstractions.js +15 -0
- package/features/file/GetFile/abstractions.js.map +1 -0
- package/features/file/GetFile/feature.d.ts +1 -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/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 +47 -0
- package/features/file/ListFiles/abstractions.js +15 -0
- package/features/file/ListFiles/abstractions.js.map +1 -0
- package/features/file/ListFiles/feature.d.ts +1 -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/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 +43 -0
- package/features/file/ListTags/abstractions.js +15 -0
- package/features/file/ListTags/abstractions.js.map +1 -0
- package/features/file/ListTags/feature.d.ts +1 -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 +78 -0
- package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -0
- package/features/file/UpdateFile/abstractions.d.ts +53 -0
- package/features/file/UpdateFile/abstractions.js +15 -0
- package/features/file/UpdateFile/abstractions.js.map +1 -0
- package/features/file/UpdateFile/events.d.ts +32 -0
- package/features/file/UpdateFile/events.js +28 -0
- package/features/file/UpdateFile/events.js.map +1 -0
- package/features/file/UpdateFile/feature.d.ts +1 -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 +26 -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 +30 -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 +29 -0
- package/features/file/shared/FileToEntryMapper.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 +17 -0
- package/features/settings/GetSettings/abstractions.js +9 -0
- package/features/settings/GetSettings/abstractions.js.map +1 -0
- package/features/settings/GetSettings/feature.d.ts +1 -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 +1 -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 +22 -0
- package/features/settings/UpdateSettings/abstractions.js +9 -0
- package/features/settings/UpdateSettings/abstractions.js.map +1 -0
- package/features/settings/UpdateSettings/events.d.ts +32 -0
- package/features/settings/UpdateSettings/events.js +28 -0
- package/features/settings/UpdateSettings/events.js.map +1 -0
- package/features/settings/UpdateSettings/feature.d.ts +1 -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 +1 -1
- package/graphql/createFilesTypeDefs.js +40 -25
- 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 +24 -26
- package/graphql/index.js.map +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 +26 -28
- package/permissions/schema.d.ts +73 -0
- package/permissions/schema.js +20 -0
- package/permissions/schema.js.map +1 -0
- package/types.d.ts +1 -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,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.Abstraction, 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","Abstraction"],"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.Abstraction, 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,CAACoB,WAAW,EAAEtB,iBAAiB;AAC/D,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
export declare const GetFileRepository: import("@webiny/di").Abstraction<IGetFileRepository>;
|
|
17
|
+
export declare namespace GetFileRepository {
|
|
18
|
+
type Interface = IGetFileRepository;
|
|
19
|
+
type Error = RepositoryError;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* GetFile use case interface
|
|
23
|
+
*/
|
|
24
|
+
export interface IGetFileUseCase {
|
|
25
|
+
execute(id: string): Promise<Result<File, UseCaseError>>;
|
|
26
|
+
}
|
|
27
|
+
export interface IGetFileUseCaseErrors {
|
|
28
|
+
notAuthorized: FileNotAuthorizedError;
|
|
29
|
+
notFound: FileNotFoundError;
|
|
30
|
+
persistence: FilePersistenceError;
|
|
31
|
+
}
|
|
32
|
+
type UseCaseError = IGetFileUseCaseErrors[keyof IGetFileUseCaseErrors];
|
|
33
|
+
export declare const GetFileUseCase: import("@webiny/di").Abstraction<IGetFileUseCase>;
|
|
34
|
+
export declare namespace GetFileUseCase {
|
|
35
|
+
type Interface = IGetFileUseCase;
|
|
36
|
+
type Error = UseCaseError;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GetFile repository interface
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const GetFileRepository = createAbstraction("GetFileRepository");
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* GetFile use case interface
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const GetFileUseCase = createAbstraction("GetFileUseCase");
|
|
14
|
+
|
|
15
|
+
//# 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\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\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,OAAO,MAAMC,iBAAiB,GAAGD,iBAAiB,CAAqB,mBAAmB,CAAC;;AAO3F;AACA;AACA;;AAaA,OAAO,MAAME,cAAc,GAAGF,iBAAiB,CAAkB,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GetFileFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
|
|
@@ -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,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.Abstraction, 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","Abstraction"],"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.Abstraction, 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,CAAC6B,WAAW,EAAE5B,eAAe,EAAEH,mBAAmB;AAClF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
export declare const ListFilesRepository: import("@webiny/di").Abstraction<IListFilesRepository>;
|
|
27
|
+
export declare namespace ListFilesRepository {
|
|
28
|
+
type Interface = IListFilesRepository;
|
|
29
|
+
type Error = RepositoryError;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* ListFiles use case interface
|
|
33
|
+
*/
|
|
34
|
+
export interface IListFilesUseCase {
|
|
35
|
+
execute(input: ListFilesInput): Promise<Result<ListFilesOutput, UseCaseError>>;
|
|
36
|
+
}
|
|
37
|
+
export interface IListFilesUseCaseErrors {
|
|
38
|
+
notAuthorized: FileNotAuthorizedError;
|
|
39
|
+
persistence: FilePersistenceError;
|
|
40
|
+
}
|
|
41
|
+
type UseCaseError = IListFilesUseCaseErrors[keyof IListFilesUseCaseErrors];
|
|
42
|
+
export declare const ListFilesUseCase: import("@webiny/di").Abstraction<IListFilesUseCase>;
|
|
43
|
+
export declare namespace ListFilesUseCase {
|
|
44
|
+
type Interface = IListFilesUseCase;
|
|
45
|
+
type Error = UseCaseError;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ListFiles repository interface
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const ListFilesRepository = createAbstraction("ListFilesRepository");
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ListFiles use case interface
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const ListFilesUseCase = createAbstraction("ListFilesUseCase");
|
|
14
|
+
|
|
15
|
+
//# 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\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\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,OAAO,MAAMC,mBAAmB,GAAGD,iBAAiB,CAAuB,qBAAqB,CAAC;;AAOjG;AACA;AACA;;AAYA,OAAO,MAAME,gBAAgB,GAAGF,iBAAiB,CAAoB,kBAAkB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ListFilesFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
|
|
@@ -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":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetUniqueFieldValuesUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetUniqueFieldValues";
|
|
3
|
+
import { ListTagsInput, ListTagsRepository as RepositoryAbstraction, TagItem } from "./abstractions.js";
|
|
4
|
+
import { FileModel } from "../../../domain/file/abstractions.js";
|
|
5
|
+
import { CmsWhereMapper } from "@webiny/api-headless-cms";
|
|
6
|
+
declare class ListTagsRepositoryImpl implements RepositoryAbstraction.Interface {
|
|
7
|
+
private getUniqueFieldValues;
|
|
8
|
+
private fileModel;
|
|
9
|
+
private cmsWhereMapper;
|
|
10
|
+
constructor(getUniqueFieldValues: GetUniqueFieldValuesUseCase.Interface, fileModel: FileModel.Interface, cmsWhereMapper: CmsWhereMapper.Interface);
|
|
11
|
+
execute(input: ListTagsInput): Promise<Result<TagItem[], RepositoryAbstraction.Error>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const ListTagsRepository: typeof ListTagsRepositoryImpl & {
|
|
14
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListTagsRepository>;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { GetUniqueFieldValuesUseCase } from "@webiny/api-headless-cms/features/contentEntry/GetUniqueFieldValues";
|
|
3
|
+
import { ListTagsRepository as RepositoryAbstraction } from "./abstractions.js";
|
|
4
|
+
import { FileModel } from "../../../domain/file/abstractions.js";
|
|
5
|
+
import { FilePersistenceError } from "../../../domain/file/errors.js";
|
|
6
|
+
import { CmsWhereMapper } from "@webiny/api-headless-cms";
|
|
7
|
+
class ListTagsRepositoryImpl {
|
|
8
|
+
constructor(getUniqueFieldValues, fileModel, cmsWhereMapper) {
|
|
9
|
+
this.getUniqueFieldValues = getUniqueFieldValues;
|
|
10
|
+
this.fileModel = fileModel;
|
|
11
|
+
this.cmsWhereMapper = cmsWhereMapper;
|
|
12
|
+
}
|
|
13
|
+
async execute(input) {
|
|
14
|
+
const result = await this.getUniqueFieldValues.execute(this.fileModel, {
|
|
15
|
+
fieldId: "tags",
|
|
16
|
+
// TODO fix with proper types
|
|
17
|
+
// @ts-expect-error
|
|
18
|
+
where: this.cmsWhereMapper.map({
|
|
19
|
+
input: {
|
|
20
|
+
...(input.where || {}),
|
|
21
|
+
latest: true
|
|
22
|
+
},
|
|
23
|
+
fields: this.fileModel.fields
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
if (result.isFail()) {
|
|
27
|
+
return Result.fail(new FilePersistenceError(result.error));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Map to TagItem format
|
|
31
|
+
const tags = result.value.map(uv => ({
|
|
32
|
+
tag: uv.value,
|
|
33
|
+
count: uv.count
|
|
34
|
+
}))
|
|
35
|
+
// Sort by tag name alphabetically
|
|
36
|
+
.sort((a, b) => a.tag < b.tag ? -1 : 1)
|
|
37
|
+
// Then sort by count descending (most used first)
|
|
38
|
+
.sort((a, b) => a.count > b.count ? -1 : 1);
|
|
39
|
+
return Result.ok(tags);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const ListTagsRepository = RepositoryAbstraction.createImplementation({
|
|
43
|
+
implementation: ListTagsRepositoryImpl,
|
|
44
|
+
dependencies: [GetUniqueFieldValuesUseCase, FileModel, CmsWhereMapper]
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=ListTagsRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Result","GetUniqueFieldValuesUseCase","ListTagsRepository","RepositoryAbstraction","FileModel","FilePersistenceError","CmsWhereMapper","ListTagsRepositoryImpl","constructor","getUniqueFieldValues","fileModel","cmsWhereMapper","execute","input","result","fieldId","where","map","latest","fields","isFail","fail","error","tags","value","uv","tag","count","sort","a","b","ok","createImplementation","implementation","dependencies"],"sources":["ListTagsRepository.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { GetUniqueFieldValuesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/GetUniqueFieldValues\";\nimport {\n ListTagsInput,\n ListTagsRepository as RepositoryAbstraction,\n TagItem\n} from \"./abstractions.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport { FilePersistenceError } from \"~/domain/file/errors.js\";\nimport { CmsWhereMapper } from \"@webiny/api-headless-cms\";\n\nclass ListTagsRepositoryImpl implements RepositoryAbstraction.Interface {\n constructor(\n private getUniqueFieldValues: GetUniqueFieldValuesUseCase.Interface,\n private fileModel: FileModel.Interface,\n private cmsWhereMapper: CmsWhereMapper.Interface\n ) {}\n\n async execute(input: ListTagsInput): Promise<Result<TagItem[], RepositoryAbstraction.Error>> {\n const result = await this.getUniqueFieldValues.execute(this.fileModel, {\n fieldId: \"tags\",\n // TODO fix with proper types\n // @ts-expect-error\n where: this.cmsWhereMapper.map({\n input: {\n ...(input.where || {}),\n latest: true\n },\n fields: this.fileModel.fields\n })\n });\n\n if (result.isFail()) {\n return Result.fail(new FilePersistenceError(result.error));\n }\n\n // Map to TagItem format\n const tags: TagItem[] = result.value\n .map(uv => ({\n tag: uv.value as string,\n count: uv.count\n }))\n // Sort by tag name alphabetically\n .sort((a, b) => (a.tag < b.tag ? -1 : 1))\n // Then sort by count descending (most used first)\n .sort((a, b) => (a.count > b.count ? -1 : 1));\n\n return Result.ok(tags);\n }\n}\n\nexport const ListTagsRepository = RepositoryAbstraction.createImplementation({\n implementation: ListTagsRepositoryImpl,\n dependencies: [GetUniqueFieldValuesUseCase, FileModel, CmsWhereMapper]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,2BAA2B,QAAQ,qEAAqE;AACjH,SAEIC,kBAAkB,IAAIC,qBAAqB;AAG/C,SAASC,SAAS;AAClB,SAASC,oBAAoB;AAC7B,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,MAAMC,sBAAsB,CAA4C;EACpEC,WAAWA,CACCC,oBAA2D,EAC3DC,SAA8B,EAC9BC,cAAwC,EAClD;IAAA,KAHUF,oBAA2D,GAA3DA,oBAA2D;IAAA,KAC3DC,SAA8B,GAA9BA,SAA8B;IAAA,KAC9BC,cAAwC,GAAxCA,cAAwC;EACjD;EAEH,MAAMC,OAAOA,CAACC,KAAoB,EAA2D;IACzF,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACL,oBAAoB,CAACG,OAAO,CAAC,IAAI,CAACF,SAAS,EAAE;MACnEK,OAAO,EAAE,MAAM;MACf;MACA;MACAC,KAAK,EAAE,IAAI,CAACL,cAAc,CAACM,GAAG,CAAC;QAC3BJ,KAAK,EAAE;UACH,IAAIA,KAAK,CAACG,KAAK,IAAI,CAAC,CAAC,CAAC;UACtBE,MAAM,EAAE;QACZ,CAAC;QACDC,MAAM,EAAE,IAAI,CAACT,SAAS,CAACS;MAC3B,CAAC;IACL,CAAC,CAAC;IAEF,IAAIL,MAAM,CAACM,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOpB,MAAM,CAACqB,IAAI,CAAC,IAAIhB,oBAAoB,CAACS,MAAM,CAACQ,KAAK,CAAC,CAAC;IAC9D;;IAEA;IACA,MAAMC,IAAe,GAAGT,MAAM,CAACU,KAAK,CAC/BP,GAAG,CAACQ,EAAE,KAAK;MACRC,GAAG,EAAED,EAAE,CAACD,KAAe;MACvBG,KAAK,EAAEF,EAAE,CAACE;IACd,CAAC,CAAC;IACF;IAAA,CACCC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAMD,CAAC,CAACH,GAAG,GAAGI,CAAC,CAACJ,GAAG,GAAG,CAAC,CAAC,GAAG,CAAE;IACxC;IAAA,CACCE,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAMD,CAAC,CAACF,KAAK,GAAGG,CAAC,CAACH,KAAK,GAAG,CAAC,CAAC,GAAG,CAAE,CAAC;IAEjD,OAAO3B,MAAM,CAAC+B,EAAE,CAACR,IAAI,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMrB,kBAAkB,GAAGC,qBAAqB,CAAC6B,oBAAoB,CAAC;EACzEC,cAAc,EAAE1B,sBAAsB;EACtC2B,YAAY,EAAE,CAACjC,2BAA2B,EAAEG,SAAS,EAAEE,cAAc;AACzE,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListTagsUseCase as UseCaseAbstraction, ListTagsInput, TagItem, ListTagsRepository } from "./abstractions.js";
|
|
3
|
+
import { FmPermissions } from "../../../features/shared/abstractions.js";
|
|
4
|
+
declare class ListTagsUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
5
|
+
private permissions;
|
|
6
|
+
private repository;
|
|
7
|
+
constructor(permissions: FmPermissions.Interface, repository: ListTagsRepository.Interface);
|
|
8
|
+
execute(input: ListTagsInput): Promise<Result<TagItem[], UseCaseAbstraction.Error>>;
|
|
9
|
+
}
|
|
10
|
+
export declare const ListTagsUseCase: typeof ListTagsUseCaseImpl & {
|
|
11
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IListTagsUseCase>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Result } from "@webiny/feature/api";
|
|
2
|
+
import { ListTagsUseCase as UseCaseAbstraction, ListTagsRepository } from "./abstractions.js";
|
|
3
|
+
import { FileNotAuthorizedError } from "../../../domain/file/errors.js";
|
|
4
|
+
import { FmPermissions } from "../../shared/abstractions.js";
|
|
5
|
+
class ListTagsUseCaseImpl {
|
|
6
|
+
constructor(permissions, repository) {
|
|
7
|
+
this.permissions = permissions;
|
|
8
|
+
this.repository = repository;
|
|
9
|
+
}
|
|
10
|
+
async execute(input) {
|
|
11
|
+
const hasPermission = await this.permissions.canAccess("file");
|
|
12
|
+
if (!hasPermission) {
|
|
13
|
+
return Result.fail(new FileNotAuthorizedError());
|
|
14
|
+
}
|
|
15
|
+
const enrichedInput = {
|
|
16
|
+
...input,
|
|
17
|
+
limit: input.limit || 1000000
|
|
18
|
+
};
|
|
19
|
+
const result = await this.repository.execute(enrichedInput);
|
|
20
|
+
if (result.isFail()) {
|
|
21
|
+
return Result.fail(result.error);
|
|
22
|
+
}
|
|
23
|
+
return Result.ok(result.value);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export const ListTagsUseCase = UseCaseAbstraction.createImplementation({
|
|
27
|
+
implementation: ListTagsUseCaseImpl,
|
|
28
|
+
dependencies: [FmPermissions.Abstraction, ListTagsRepository]
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=ListTagsUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Result","ListTagsUseCase","UseCaseAbstraction","ListTagsRepository","FileNotAuthorizedError","FmPermissions","ListTagsUseCaseImpl","constructor","permissions","repository","execute","input","hasPermission","canAccess","fail","enrichedInput","limit","result","isFail","error","ok","value","createImplementation","implementation","dependencies","Abstraction"],"sources":["ListTagsUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n ListTagsUseCase as UseCaseAbstraction,\n ListTagsInput,\n TagItem,\n ListTagsRepository\n} from \"./abstractions.js\";\nimport { FileNotAuthorizedError } from \"~/domain/file/errors.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\n\nclass ListTagsUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private permissions: FmPermissions.Interface,\n private repository: ListTagsRepository.Interface\n ) {}\n\n async execute(input: ListTagsInput): Promise<Result<TagItem[], UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canAccess(\"file\");\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const enrichedInput: ListTagsInput = {\n ...input,\n limit: input.limit || 1000000\n };\n\n const result = await this.repository.execute(enrichedInput);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n return Result.ok(result.value);\n }\n}\n\nexport const ListTagsUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListTagsUseCaseImpl,\n dependencies: [FmPermissions.Abstraction, ListTagsRepository]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,eAAe,IAAIC,kBAAkB,EAGrCC,kBAAkB;AAEtB,SAASC,sBAAsB;AAC/B,SAASC,aAAa;AAEtB,MAAMC,mBAAmB,CAAyC;EAC9DC,WAAWA,CACCC,WAAoC,EACpCC,UAAwC,EAClD;IAAA,KAFUD,WAAoC,GAApCA,WAAoC;IAAA,KACpCC,UAAwC,GAAxCA,UAAwC;EACjD;EAEH,MAAMC,OAAOA,CAACC,KAAoB,EAAwD;IACtF,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACJ,WAAW,CAACK,SAAS,CAAC,MAAM,CAAC;IAC9D,IAAI,CAACD,aAAa,EAAE;MAChB,OAAOZ,MAAM,CAACc,IAAI,CAAC,IAAIV,sBAAsB,CAAC,CAAC,CAAC;IACpD;IAEA,MAAMW,aAA4B,GAAG;MACjC,GAAGJ,KAAK;MACRK,KAAK,EAAEL,KAAK,CAACK,KAAK,IAAI;IAC1B,CAAC;IAED,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACR,UAAU,CAACC,OAAO,CAACK,aAAa,CAAC;IAE3D,IAAIE,MAAM,CAACC,MAAM,CAAC,CAAC,EAAE;MACjB,OAAOlB,MAAM,CAACc,IAAI,CAACG,MAAM,CAACE,KAAK,CAAC;IACpC;IAEA,OAAOnB,MAAM,CAACoB,EAAE,CAACH,MAAM,CAACI,KAAK,CAAC;EAClC;AACJ;AAEA,OAAO,MAAMpB,eAAe,GAAGC,kBAAkB,CAACoB,oBAAoB,CAAC;EACnEC,cAAc,EAAEjB,mBAAmB;EACnCkB,YAAY,EAAE,CAACnB,aAAa,CAACoB,WAAW,EAAEtB,kBAAkB;AAChE,CAAC,CAAC","ignoreList":[]}
|