@webiny/api-file-manager 6.0.0-beta.0 → 6.0.0-rc.1
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 +6 -8
- package/delivery/AssetDelivery/Asset.js +13 -18
- package/delivery/AssetDelivery/Asset.js.map +1 -1
- package/delivery/AssetDelivery/AssetDeliveryConfig.d.ts +17 -15
- package/delivery/AssetDelivery/AssetDeliveryConfig.js +18 -26
- package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +1 -1
- package/delivery/AssetDelivery/AssetRequest.d.ts +3 -2
- 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 +11 -14
- 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 +2 -2
- package/delivery/AssetDelivery/SetCacheControlHeaders.js +1 -8
- package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +1 -1
- package/delivery/AssetDelivery/SetResponseHeaders.d.ts +4 -4
- package/delivery/AssetDelivery/SetResponseHeaders.js +1 -8
- package/delivery/AssetDelivery/SetResponseHeaders.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.d.ts +1 -2
- 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 +5 -12
- 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 +5 -3
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js +17 -14
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +3 -2
- 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 +24 -22
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/PublicCache.d.ts +5 -3
- package/delivery/AssetDelivery/privateFiles/PublicCache.js +17 -14
- package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +1 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +2 -1
- 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 -1
- 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 +2 -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 +23 -36
- 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 -63
- package/index.js.map +1 -1
- package/modelModifier/CmsModelModifier.d.ts +3 -3
- package/modelModifier/CmsModelModifier.js +7 -15
- package/modelModifier/CmsModelModifier.js.map +1 -1
- package/package.json +26 -38
- package/permissions/schema.d.ts +81 -0
- package/permissions/schema.js +22 -0
- package/permissions/schema.js.map +1 -0
- package/types.d.ts +1 -365
- package/types.js +1 -27
- package/types.js.map +1 -1
- package/FileManagerContextSetup.d.ts +0 -13
- package/FileManagerContextSetup.js +0 -108
- 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 -15
- 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/settings.crud.d.ts +0 -3
- package/createFileManager/settings.crud.js +0 -109
- 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/delivery/AssetDelivery/AliasAssetRequestResolver.d.ts +0 -10
- 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/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 -21
- 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 -33
- package/storage/FileStorage.js +0 -90
- package/storage/FileStorage.js.map +0 -1
- package/types/file.d.ts +0 -48
- 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,15 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* DeleteFile repository interface
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const DeleteFileRepository = createAbstraction("DeleteFileRepository");
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* DeleteFile use case interface
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const DeleteFileUseCase = createAbstraction("DeleteFileUseCase");
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","DeleteFileRepository","DeleteFileUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport {\n type FilePersistenceError,\n type FileNotFoundError,\n FileNotAuthorizedError\n} from \"~/domain/file/errors.js\";\nimport { File } from \"~/domain/file/types.js\";\n\n/**\n * DeleteFile repository interface\n */\nexport interface IDeleteFileRepository {\n delete(file: File): Promise<Result<void, RepositoryError>>;\n}\n\nexport interface IDeleteFileRepositoryErrors {\n notFound: FileNotFoundError;\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = IDeleteFileRepositoryErrors[keyof IDeleteFileRepositoryErrors];\n\nexport const DeleteFileRepository =\n createAbstraction<IDeleteFileRepository>(\"DeleteFileRepository\");\n\nexport namespace DeleteFileRepository {\n export type Interface = IDeleteFileRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * DeleteFile use case interface\n */\nexport interface IDeleteFileUseCase {\n execute(id: string): Promise<Result<void, UseCaseError>>;\n}\n\nexport interface IDeleteFileUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n notFound: FileNotFoundError;\n persistence: FilePersistenceError;\n}\n\ntype UseCaseError = IDeleteFileUseCaseErrors[keyof IDeleteFileUseCaseErrors];\n\nexport const DeleteFileUseCase = createAbstraction<IDeleteFileUseCase>(\"DeleteFileUseCase\");\n\nexport namespace DeleteFileUseCase {\n export type Interface = IDeleteFileUseCase;\n export type Error = UseCaseError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AASvD;AACA;AACA;;AAYA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;;AAOpE;AACA;AACA;;AAaA,OAAO,MAAME,iBAAiB,GAAGF,iBAAiB,CAAqB,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
|
|
2
|
+
import type { IEventHandler } from "@webiny/api-core/features/EventPublisher";
|
|
3
|
+
import type { File } from "../../../domain/file/types.js";
|
|
4
|
+
export interface FileBeforeDeletePayload {
|
|
5
|
+
file: File;
|
|
6
|
+
}
|
|
7
|
+
export declare class FileBeforeDeleteEvent extends DomainEvent<FileBeforeDeletePayload> {
|
|
8
|
+
eventType: "FileManager/File/BeforeDelete";
|
|
9
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<FileBeforeDeleteEvent>>;
|
|
10
|
+
}
|
|
11
|
+
export declare const FileBeforeDeleteHandler: import("@webiny/di").Abstraction<IEventHandler<FileBeforeDeleteEvent>>;
|
|
12
|
+
export declare namespace FileBeforeDeleteHandler {
|
|
13
|
+
type Interface = IEventHandler<FileBeforeDeleteEvent>;
|
|
14
|
+
type Event = FileBeforeDeleteEvent;
|
|
15
|
+
}
|
|
16
|
+
export interface FileAfterDeletePayload {
|
|
17
|
+
file: File;
|
|
18
|
+
}
|
|
19
|
+
export declare class FileAfterDeleteEvent extends DomainEvent<FileAfterDeletePayload> {
|
|
20
|
+
eventType: "FileManager/File/AfterDelete";
|
|
21
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<IEventHandler<FileAfterDeleteEvent>>;
|
|
22
|
+
}
|
|
23
|
+
export declare const FileAfterDeleteHandler: import("@webiny/di").Abstraction<IEventHandler<FileAfterDeleteEvent>>;
|
|
24
|
+
export declare namespace FileAfterDeleteHandler {
|
|
25
|
+
type Interface = IEventHandler<FileAfterDeleteEvent>;
|
|
26
|
+
type Event = FileAfterDeleteEvent;
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
import { DomainEvent } from "@webiny/api-core/features/EventPublisher";
|
|
3
|
+
|
|
4
|
+
// ============================================================================
|
|
5
|
+
// FileBeforeDelete Event
|
|
6
|
+
// ============================================================================
|
|
7
|
+
|
|
8
|
+
export class FileBeforeDeleteEvent extends DomainEvent {
|
|
9
|
+
eventType = "FileManager/File/BeforeDelete";
|
|
10
|
+
getHandlerAbstraction() {
|
|
11
|
+
return FileBeforeDeleteHandler;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export const FileBeforeDeleteHandler = createAbstraction("FileBeforeDeleteHandler");
|
|
15
|
+
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// FileAfterDelete Event
|
|
18
|
+
// ============================================================================
|
|
19
|
+
|
|
20
|
+
export class FileAfterDeleteEvent extends DomainEvent {
|
|
21
|
+
eventType = "FileManager/File/AfterDelete";
|
|
22
|
+
getHandlerAbstraction() {
|
|
23
|
+
return FileAfterDeleteHandler;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export const FileAfterDeleteHandler = createAbstraction("FileAfterDeleteHandler");
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAbstraction","DomainEvent","FileBeforeDeleteEvent","eventType","getHandlerAbstraction","FileBeforeDeleteHandler","FileAfterDeleteEvent","FileAfterDeleteHandler"],"sources":["events.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport { DomainEvent } from \"@webiny/api-core/features/EventPublisher\";\nimport type { IEventHandler } from \"@webiny/api-core/features/EventPublisher\";\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 FileBeforeDeleteHandler;\n }\n}\n\nexport const FileBeforeDeleteHandler =\n createAbstraction<IEventHandler<FileBeforeDeleteEvent>>(\"FileBeforeDeleteHandler\");\n\nexport namespace FileBeforeDeleteHandler {\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 FileAfterDeleteHandler;\n }\n}\n\nexport const FileAfterDeleteHandler =\n createAbstraction<IEventHandler<FileAfterDeleteEvent>>(\"FileAfterDeleteHandler\");\n\nexport namespace FileAfterDeleteHandler {\n export type Interface = IEventHandler<FileAfterDeleteEvent>;\n export type Event = FileAfterDeleteEvent;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,WAAW,QAAQ,0CAA0C;;AAItE;AACA;AACA;;AAMA,OAAO,MAAMC,qBAAqB,SAASD,WAAW,CAA0B;EAC5EE,SAAS,GAAG,+BAA+B;EAE3CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOC,uBAAuB;EAClC;AACJ;AAEA,OAAO,MAAMA,uBAAuB,GAChCL,iBAAiB,CAAuC,yBAAyB,CAAC;;AAOtF;AACA;AACA;;AAMA,OAAO,MAAMM,oBAAoB,SAASL,WAAW,CAAyB;EAC1EE,SAAS,GAAG,8BAA8B;EAE1CC,qBAAqBA,CAAA,EAAG;IACpB,OAAOG,sBAAsB;EACjC;AACJ;AAEA,OAAO,MAAMA,sBAAsB,GAC/BP,iBAAiB,CAAsC,wBAAwB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DeleteFileFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
|
|
@@ -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","FileBeforeDeleteHandler","FileAfterDeleteHandler"],"sources":["index.ts"],"sourcesContent":["export { DeleteFileUseCase } from \"./abstractions.js\";\nexport { FileBeforeDeleteHandler, FileAfterDeleteHandler } from \"./events.js\";\n"],"mappings":"AAAA,SAASA,iBAAiB;AAC1B,SAASC,uBAAuB,EAAEC,sBAAsB","ignoreList":[]}
|
|
@@ -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\nexport const FileUrlGenerator = createAbstraction<IFileUrlGenerator>(\"IFileUrlGenerator\");\n\nexport namespace FileUrlGenerator {\n export type Interface = IFileUrlGenerator;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;AAMvD,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.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";
|