@webiny/api-file-manager 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7be00a75a9
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.d.ts +1 -0
- package/contants.js +4 -0
- package/contants.js.map +1 -0
- package/delivery/AssetDelivery/Asset.d.ts +28 -0
- package/delivery/AssetDelivery/Asset.js +53 -0
- package/delivery/AssetDelivery/Asset.js.map +1 -0
- package/delivery/AssetDelivery/AssetRequest.d.ts +25 -0
- package/delivery/AssetDelivery/AssetRequest.js +23 -0
- package/delivery/AssetDelivery/AssetRequest.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.d.ts +25 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.js +32 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.d.ts +2 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +7 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -0
- package/delivery/index.d.ts +7 -0
- package/delivery/index.js +6 -0
- package/delivery/setupAssetDelivery.d.ts +1 -0
- package/delivery/setupAssetDelivery.js +69 -0
- package/delivery/setupAssetDelivery.js.map +1 -0
- package/domain/file/abstractions.d.ts +9 -0
- package/domain/file/abstractions.js +5 -0
- package/domain/file/abstractions.js.map +1 -0
- package/domain/file/errors.d.ts +59 -0
- package/domain/file/errors.js +80 -0
- package/domain/file/errors.js.map +1 -0
- package/domain/file/file.model.d.ts +12 -0
- package/domain/file/file.model.js +65 -0
- package/domain/file/file.model.js.map +1 -0
- package/domain/file/types.d.ts +53 -0
- package/domain/file/types.js +0 -0
- package/domain/identity/Identity.d.ts +9 -0
- package/domain/identity/Identity.js +12 -0
- package/domain/identity/Identity.js.map +1 -0
- package/domain/permissionsSchema.d.ts +16 -0
- package/domain/permissionsSchema.js +30 -0
- package/domain/permissionsSchema.js.map +1 -0
- package/domain/settings/constants.d.ts +1 -0
- package/domain/settings/constants.js +4 -0
- package/domain/settings/constants.js.map +1 -0
- package/domain/settings/errors.d.ts +18 -0
- package/domain/settings/errors.js +28 -0
- package/domain/settings/errors.js.map +1 -0
- package/domain/settings/types.d.ts +10 -0
- package/domain/settings/types.js +0 -0
- package/domain/settings/validation.d.ts +6 -0
- package/domain/settings/validation.js +27 -0
- package/domain/settings/validation.js.map +1 -0
- package/exports/api/file-manager/file.d.ts +12 -0
- package/exports/api/file-manager/file.js +12 -0
- package/exports/api/file-manager/permissions.d.ts +1 -0
- package/exports/api/file-manager/permissions.js +1 -0
- package/exports/api/file-manager/settings.d.ts +3 -0
- package/exports/api/file-manager/settings.js +3 -0
- package/features/FileManagerFeature.d.ts +4 -0
- package/features/FileManagerFeature.js +31 -0
- package/features/FileManagerFeature.js.map +1 -0
- package/features/assetDelivery/FilesAssetRequestResolver.d.ts +9 -0
- package/features/assetDelivery/FilesAssetRequestResolver.js +29 -0
- package/features/assetDelivery/FilesAssetRequestResolver.js.map +1 -0
- package/features/assetDelivery/NullAssetOutputStrategy.d.ts +8 -0
- package/features/assetDelivery/NullAssetOutputStrategy.js +14 -0
- package/features/assetDelivery/NullAssetOutputStrategy.js.map +1 -0
- package/features/assetDelivery/NullAssetReply.d.ts +4 -0
- package/features/assetDelivery/NullAssetReply.js +14 -0
- package/features/assetDelivery/NullAssetReply.js.map +1 -0
- package/features/assetDelivery/NullAssetResolver.d.ts +8 -0
- package/features/assetDelivery/NullAssetResolver.js +13 -0
- package/features/assetDelivery/NullAssetResolver.js.map +1 -0
- package/features/assetDelivery/abstractions.d.ts +54 -0
- package/features/assetDelivery/abstractions.js +11 -0
- package/features/assetDelivery/abstractions.js.map +1 -0
- package/features/assetDelivery/feature.d.ts +4 -0
- package/features/assetDelivery/feature.js +29 -0
- package/features/assetDelivery/feature.js.map +1 -0
- package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +4 -0
- package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js +20 -0
- package/features/assetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +1 -0
- package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +5 -0
- package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +9 -0
- package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -0
- package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +11 -0
- package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +26 -0
- package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -0
- package/features/assetDelivery/privateFiles/PrivateCache.d.ts +8 -0
- package/features/assetDelivery/privateFiles/PrivateCache.js +22 -0
- package/features/assetDelivery/privateFiles/PrivateCache.js.map +1 -0
- package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +11 -0
- package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +31 -0
- package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -0
- package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +19 -0
- package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js +65 -0
- package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -0
- package/features/assetDelivery/privateFiles/PublicCache.d.ts +8 -0
- package/features/assetDelivery/privateFiles/PublicCache.js +22 -0
- package/features/assetDelivery/privateFiles/PublicCache.js.map +1 -0
- package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +9 -0
- package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +21 -0
- package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -0
- package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +9 -0
- package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +21 -0
- package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -0
- package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +9 -0
- package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js +13 -0
- package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +1 -0
- package/features/assetDelivery/transformation/TransformationAssetProcessor.d.ts +11 -0
- package/features/assetDelivery/transformation/TransformationAssetProcessor.js +23 -0
- package/features/assetDelivery/transformation/TransformationAssetProcessor.js.map +1 -0
- package/features/file/CreateFile/CreateFileRepository.d.ts +15 -0
- package/features/file/CreateFile/CreateFileRepository.js +32 -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 +83 -0
- package/features/file/CreateFile/CreateFileUseCase.js.map +1 -0
- package/features/file/CreateFile/abstractions.d.ts +60 -0
- package/features/file/CreateFile/abstractions.js +6 -0
- package/features/file/CreateFile/abstractions.js.map +1 -0
- package/features/file/CreateFile/events.d.ts +31 -0
- package/features/file/CreateFile/events.js +23 -0
- package/features/file/CreateFile/events.js.map +1 -0
- package/features/file/CreateFile/feature.d.ts +4 -0
- package/features/file/CreateFile/feature.js +13 -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 +2 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.d.ts +13 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js +22 -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 +73 -0
- package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js.map +1 -0
- package/features/file/CreateFilesInBatch/abstractions.d.ts +42 -0
- package/features/file/CreateFilesInBatch/abstractions.js +6 -0
- package/features/file/CreateFilesInBatch/abstractions.js.map +1 -0
- package/features/file/CreateFilesInBatch/events.d.ts +31 -0
- package/features/file/CreateFilesInBatch/events.js +23 -0
- package/features/file/CreateFilesInBatch/events.js.map +1 -0
- package/features/file/CreateFilesInBatch/feature.d.ts +4 -0
- package/features/file/CreateFilesInBatch/feature.js +13 -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 +1 -0
- package/features/file/DeleteFile/DeleteFileRepository.d.ts +15 -0
- package/features/file/DeleteFile/DeleteFileRepository.js +31 -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 +43 -0
- package/features/file/DeleteFile/DeleteFileUseCase.js.map +1 -0
- package/features/file/DeleteFile/abstractions.d.ts +39 -0
- package/features/file/DeleteFile/abstractions.js +6 -0
- package/features/file/DeleteFile/abstractions.js.map +1 -0
- package/features/file/DeleteFile/events.d.ts +29 -0
- package/features/file/DeleteFile/events.js +23 -0
- package/features/file/DeleteFile/events.js.map +1 -0
- package/features/file/DeleteFile/feature.d.ts +4 -0
- package/features/file/DeleteFile/feature.js +13 -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 +2 -0
- package/features/file/FileUrlGenerator/abstractions.d.ts +9 -0
- package/features/file/FileUrlGenerator/abstractions.js +5 -0
- package/features/file/FileUrlGenerator/abstractions.js.map +1 -0
- package/features/file/GetFile/GetFileRepository.d.ts +15 -0
- package/features/file/GetFile/GetFileRepository.js +33 -0
- package/features/file/GetFile/GetFileRepository.js.map +1 -0
- package/features/file/GetFile/GetFileUseCase.d.ts +14 -0
- package/features/file/GetFile/GetFileUseCase.js +29 -0
- package/features/file/GetFile/GetFileUseCase.js.map +1 -0
- package/features/file/GetFile/abstractions.d.ts +40 -0
- package/features/file/GetFile/abstractions.js +6 -0
- package/features/file/GetFile/abstractions.js.map +1 -0
- package/features/file/GetFile/feature.d.ts +4 -0
- package/features/file/GetFile/feature.js +13 -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 +1 -0
- package/features/file/GetFileContentsById/abstractions.d.ts +20 -0
- package/features/file/GetFileContentsById/abstractions.js +5 -0
- package/features/file/GetFileContentsById/abstractions.js.map +1 -0
- package/features/file/GetFileContentsById/index.d.ts +1 -0
- package/features/file/GetFileContentsById/index.js +1 -0
- package/features/file/GetFileContentsByKey/abstractions.d.ts +17 -0
- package/features/file/GetFileContentsByKey/abstractions.js +5 -0
- package/features/file/GetFileContentsByKey/abstractions.js.map +1 -0
- package/features/file/GetFileContentsByKey/index.d.ts +1 -0
- package/features/file/GetFileContentsByKey/index.js +1 -0
- package/features/file/ListFiles/ListFilesRepository.d.ts +18 -0
- package/features/file/ListFiles/ListFilesRepository.js +53 -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 +44 -0
- package/features/file/ListFiles/ListFilesUseCase.js.map +1 -0
- package/features/file/ListFiles/abstractions.d.ts +49 -0
- package/features/file/ListFiles/abstractions.js +6 -0
- package/features/file/ListFiles/abstractions.js.map +1 -0
- package/features/file/ListFiles/feature.d.ts +4 -0
- package/features/file/ListFiles/feature.js +13 -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 +1 -0
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.d.ts +27 -0
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +42 -0
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.js.map +1 -0
- package/features/file/ListImagesByTagTool/feature.d.ts +4 -0
- package/features/file/ListImagesByTagTool/feature.js +11 -0
- package/features/file/ListImagesByTagTool/feature.js.map +1 -0
- package/features/file/ListTags/ListTagsRepository.d.ts +16 -0
- package/features/file/ListTags/ListTagsRepository.js +42 -0
- package/features/file/ListTags/ListTagsRepository.js.map +1 -0
- package/features/file/ListTags/ListTagsUseCase.d.ts +13 -0
- package/features/file/ListTags/ListTagsUseCase.js +31 -0
- package/features/file/ListTags/ListTagsUseCase.js.map +1 -0
- package/features/file/ListTags/abstractions.d.ts +45 -0
- package/features/file/ListTags/abstractions.js +6 -0
- package/features/file/ListTags/abstractions.js.map +1 -0
- package/features/file/ListTags/feature.d.ts +4 -0
- package/features/file/ListTags/feature.js +13 -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 +1 -0
- package/features/file/UpdateFile/UpdateFileRepository.d.ts +15 -0
- package/features/file/UpdateFile/UpdateFileRepository.js +37 -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 +71 -0
- package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -0
- package/features/file/UpdateFile/abstractions.d.ts +56 -0
- package/features/file/UpdateFile/abstractions.js +6 -0
- package/features/file/UpdateFile/abstractions.js.map +1 -0
- package/features/file/UpdateFile/events.d.ts +34 -0
- package/features/file/UpdateFile/events.js +23 -0
- package/features/file/UpdateFile/events.js.map +1 -0
- package/features/file/UpdateFile/feature.d.ts +4 -0
- package/features/file/UpdateFile/feature.js +13 -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 +2 -0
- package/features/file/shared/EntryToFileMapper.d.ts +5 -0
- package/features/file/shared/EntryToFileMapper.js +28 -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 +32 -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 +31 -0
- package/features/file/shared/FileToEntryMapper.js.map +1 -0
- package/features/permissions/abstractions.d.ts +21 -0
- package/features/permissions/abstractions.js +6 -0
- package/features/permissions/abstractions.js.map +1 -0
- package/features/permissions/feature.d.ts +4 -0
- package/features/permissions/feature.js +7 -0
- package/features/permissions/feature.js.map +1 -0
- package/features/settings/GetSettings/GetSettingsUseCase.d.ts +13 -0
- package/features/settings/GetSettings/GetSettingsUseCase.js +28 -0
- package/features/settings/GetSettings/GetSettingsUseCase.js.map +1 -0
- package/features/settings/GetSettings/abstractions.d.ts +18 -0
- package/features/settings/GetSettings/abstractions.js +5 -0
- package/features/settings/GetSettings/abstractions.js.map +1 -0
- package/features/settings/GetSettings/feature.d.ts +4 -0
- package/features/settings/GetSettings/feature.js +11 -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 +36 -0
- package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -0
- package/features/settings/SettingsInstaller/feature.d.ts +4 -0
- package/features/settings/SettingsInstaller/feature.js +11 -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 +55 -0
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -0
- package/features/settings/UpdateSettings/abstractions.d.ts +23 -0
- package/features/settings/UpdateSettings/abstractions.js +5 -0
- package/features/settings/UpdateSettings/abstractions.js.map +1 -0
- package/features/settings/UpdateSettings/events.d.ts +34 -0
- package/features/settings/UpdateSettings/events.js +23 -0
- package/features/settings/UpdateSettings/events.js.map +1 -0
- package/features/settings/UpdateSettings/feature.d.ts +4 -0
- package/features/settings/UpdateSettings/feature.js +11 -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 +2 -0
- package/features/shared/abstractions.d.ts +1 -0
- package/features/shared/abstractions.js +1 -0
- package/graphql/baseSchema.d.ts +3 -0
- package/graphql/baseSchema.js +100 -0
- package/graphql/baseSchema.js.map +1 -0
- package/graphql/createFilesTypeDefs.d.ts +8 -0
- package/graphql/createFilesTypeDefs.js +191 -0
- package/graphql/createFilesTypeDefs.js.map +1 -0
- package/graphql/filesSchema.d.ts +4 -0
- package/graphql/filesSchema.js +96 -0
- package/graphql/filesSchema.js.map +1 -0
- package/graphql/getFileByUrl.d.ts +3 -0
- package/graphql/getFileByUrl.js +61 -0
- package/graphql/getFileByUrl.js.map +1 -0
- package/graphql/index.d.ts +4 -0
- package/graphql/index.js +47 -0
- package/graphql/index.js.map +1 -0
- package/graphql/utils.d.ts +11 -0
- package/graphql/utils.js +12 -0
- package/graphql/utils.js.map +1 -0
- package/index.d.ts +7 -0
- package/index.js +44 -0
- package/index.js.map +1 -0
- package/modelModifier/CmsModelModifier.d.ts +26 -0
- package/modelModifier/CmsModelModifier.js +51 -0
- package/modelModifier/CmsModelModifier.js.map +1 -0
- package/package.json +34 -42
- package/types.d.ts +2 -356
- package/types.js +1 -5
- package/handlers/download/index.d.ts +0 -3
- package/handlers/download/index.js +0 -132
- package/handlers/download/index.js.map +0 -1
- package/handlers/manage/index.d.ts +0 -5
- package/handlers/manage/index.js +0 -71
- package/handlers/manage/index.js.map +0 -1
- package/handlers/transform/index.d.ts +0 -2
- package/handlers/transform/index.js +0 -91
- package/handlers/transform/index.js.map +0 -1
- package/handlers/transform/loaders/imageLoader.d.ts +0 -30
- package/handlers/transform/loaders/imageLoader.js +0 -105
- package/handlers/transform/loaders/imageLoader.js.map +0 -1
- package/handlers/transform/loaders/index.d.ts +0 -8
- package/handlers/transform/loaders/index.js +0 -13
- package/handlers/transform/loaders/index.js.map +0 -1
- package/handlers/transform/loaders/sanitizeImageTransformations.d.ts +0 -11
- package/handlers/transform/loaders/sanitizeImageTransformations.js +0 -58
- package/handlers/transform/loaders/sanitizeImageTransformations.js.map +0 -1
- package/handlers/transform/managers/imageManager.d.ts +0 -15
- package/handlers/transform/managers/imageManager.js +0 -63
- package/handlers/transform/managers/imageManager.js.map +0 -1
- package/handlers/transform/managers/index.d.ts +0 -5
- package/handlers/transform/managers/index.js +0 -13
- package/handlers/transform/managers/index.js.map +0 -1
- package/handlers/transform/optimizeImage.d.ts +0 -3
- package/handlers/transform/optimizeImage.js +0 -48
- package/handlers/transform/optimizeImage.js.map +0 -1
- package/handlers/transform/transformImage.d.ts +0 -10
- package/handlers/transform/transformImage.js +0 -30
- package/handlers/transform/transformImage.js.map +0 -1
- package/handlers/transform/utils.d.ts +0 -12
- package/handlers/transform/utils.js +0 -46
- package/handlers/transform/utils.js.map +0 -1
- package/handlers/types.d.ts +0 -8
- package/handlers/types.js +0 -5
- 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 -25
- package/handlers/utils/getObjectParams.js.map +0 -1
- package/handlers/utils/index.d.ts +0 -2
- package/handlers/utils/index.js +0 -23
- package/handlers/utils/index.js.map +0 -1
- package/plugins/crud/files/validation.d.ts +0 -3
- package/plugins/crud/files/validation.js +0 -41
- package/plugins/crud/files/validation.js.map +0 -1
- package/plugins/crud/files.crud.d.ts +0 -4
- package/plugins/crud/files.crud.js +0 -431
- package/plugins/crud/files.crud.js.map +0 -1
- package/plugins/crud/settings.crud.d.ts +0 -5
- package/plugins/crud/settings.crud.js +0 -116
- package/plugins/crud/settings.crud.js.map +0 -1
- package/plugins/crud/system.crud.d.ts +0 -4
- package/plugins/crud/system.crud.js +0 -153
- package/plugins/crud/system.crud.js.map +0 -1
- package/plugins/crud/utils/checkBasePermissions.d.ts +0 -5
- package/plugins/crud/utils/checkBasePermissions.js +0 -33
- package/plugins/crud/utils/checkBasePermissions.js.map +0 -1
- package/plugins/crud/utils/createFileModel.d.ts +0 -5
- package/plugins/crud/utils/createFileModel.js +0 -77
- package/plugins/crud/utils/createFileModel.js.map +0 -1
- package/plugins/crud/utils/lifecycleEvents.d.ts +0 -6
- package/plugins/crud/utils/lifecycleEvents.js +0 -38
- package/plugins/crud/utils/lifecycleEvents.js.map +0 -1
- package/plugins/definitions/FilePhysicalStoragePlugin.d.ts +0 -21
- package/plugins/definitions/FilePhysicalStoragePlugin.js +0 -42
- package/plugins/definitions/FilePhysicalStoragePlugin.js.map +0 -1
- package/plugins/definitions/FilePlugin.d.ts +0 -136
- package/plugins/definitions/FilePlugin.js +0 -70
- package/plugins/definitions/FilePlugin.js.map +0 -1
- package/plugins/definitions/FileStorageTransformPlugin.d.ts +0 -34
- package/plugins/definitions/FileStorageTransformPlugin.js +0 -51
- package/plugins/definitions/FileStorageTransformPlugin.js.map +0 -1
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.d.ts +0 -9
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.js +0 -17
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.js.map +0 -1
- package/plugins/definitions/InstallationPlugin.d.ts +0 -19
- package/plugins/definitions/InstallationPlugin.js +0 -42
- package/plugins/definitions/InstallationPlugin.js.map +0 -1
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.d.ts +0 -9
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js +0 -17
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js.map +0 -1
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.d.ts +0 -9
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.js +0 -17
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.js.map +0 -1
- package/plugins/graphql.d.ts +0 -4
- package/plugins/graphql.js +0 -290
- package/plugins/graphql.js.map +0 -1
- package/plugins/index.d.ts +0 -2
- package/plugins/index.js +0 -24
- package/plugins/index.js.map +0 -1
- package/plugins/storage/FileStorage.d.ts +0 -30
- package/plugins/storage/FileStorage.js +0 -103
- package/plugins/storage/FileStorage.js.map +0 -1
- package/plugins/storage/index.d.ts +0 -4
- package/plugins/storage/index.js +0 -26
- package/plugins/storage/index.js.map +0 -1
- package/types.js.map +0 -1
- package/utils.d.ts +0 -4
- package/utils.js +0 -16
- package/utils.js.map +0 -1
package/plugins/graphql.js
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
9
|
-
|
|
10
|
-
const emptyResolver = () => ({});
|
|
11
|
-
/**
|
|
12
|
-
* Use any because it really can be any.
|
|
13
|
-
* TODO @ts-refactor maybe use generics at some point?
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const resolve = async fn => {
|
|
18
|
-
try {
|
|
19
|
-
return new _handlerGraphql.Response(await fn());
|
|
20
|
-
} catch (e) {
|
|
21
|
-
return new _handlerGraphql.ErrorResponse(e);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const plugin = {
|
|
26
|
-
type: "graphql-schema",
|
|
27
|
-
schema: {
|
|
28
|
-
typeDefs:
|
|
29
|
-
/* GraphQL */
|
|
30
|
-
`
|
|
31
|
-
type FmCreatedBy {
|
|
32
|
-
id: ID
|
|
33
|
-
displayName: String
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
input FileInput {
|
|
37
|
-
key: String
|
|
38
|
-
name: String
|
|
39
|
-
size: Int
|
|
40
|
-
type: String
|
|
41
|
-
tags: [String]
|
|
42
|
-
meta: JSON
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
type UploadFileResponseDataFile {
|
|
46
|
-
name: String
|
|
47
|
-
type: String
|
|
48
|
-
size: Int
|
|
49
|
-
key: String
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
type UploadFileResponseData {
|
|
53
|
-
# Contains data that is necessary for initiating a file upload.
|
|
54
|
-
data: JSON
|
|
55
|
-
file: UploadFileResponseDataFile
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
type FileListMeta {
|
|
59
|
-
cursor: String
|
|
60
|
-
totalCount: Int
|
|
61
|
-
hasMoreItems: Boolean
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
type FileError {
|
|
65
|
-
code: String
|
|
66
|
-
message: String
|
|
67
|
-
data: JSON
|
|
68
|
-
stack: String
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
type FileListResponse {
|
|
72
|
-
data: [File]
|
|
73
|
-
meta: FileListMeta
|
|
74
|
-
error: FileError
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
type FileResponse {
|
|
78
|
-
data: File
|
|
79
|
-
error: FileError
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
type CreateFilesResponse {
|
|
83
|
-
data: [File]!
|
|
84
|
-
error: FileError
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
type File {
|
|
88
|
-
id: ID
|
|
89
|
-
key: String
|
|
90
|
-
name: String
|
|
91
|
-
size: Int
|
|
92
|
-
type: String
|
|
93
|
-
src: String
|
|
94
|
-
tags: [String]
|
|
95
|
-
meta: JSON
|
|
96
|
-
createdOn: DateTime
|
|
97
|
-
createdBy: FmCreatedBy
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
type FileManagerBooleanResponse {
|
|
101
|
-
data: Boolean
|
|
102
|
-
error: FileError
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
type FileManagerSettings {
|
|
106
|
-
uploadMinFileSize: Number
|
|
107
|
-
uploadMaxFileSize: Number
|
|
108
|
-
srcPrefix: String
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
input FileManagerSettingsInput {
|
|
112
|
-
uploadMinFileSize: Number
|
|
113
|
-
uploadMaxFileSize: Number
|
|
114
|
-
srcPrefix: String
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
type FileManagerSettingsResponse {
|
|
118
|
-
data: FileManagerSettings
|
|
119
|
-
error: FileError
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
input FileWhereInput {
|
|
123
|
-
search: String
|
|
124
|
-
type: String
|
|
125
|
-
type_in: [String!]
|
|
126
|
-
tag: String
|
|
127
|
-
tag_in: [String!]
|
|
128
|
-
tag_and_in: [String!]
|
|
129
|
-
tag_startsWith: String
|
|
130
|
-
tag_not_startsWith: String
|
|
131
|
-
id_in: [ID!]
|
|
132
|
-
id: ID
|
|
133
|
-
createdBy: ID
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
input TagWhereInput {
|
|
137
|
-
tag_startsWith: String
|
|
138
|
-
tag_not_startsWith: String
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
type FmQuery {
|
|
142
|
-
getFile(id: ID, where: JSON, sort: String): FileResponse
|
|
143
|
-
|
|
144
|
-
listFiles(
|
|
145
|
-
limit: Int
|
|
146
|
-
after: String
|
|
147
|
-
types: [String]
|
|
148
|
-
tags: [String]
|
|
149
|
-
ids: [ID]
|
|
150
|
-
search: String
|
|
151
|
-
where: FileWhereInput
|
|
152
|
-
): FileListResponse
|
|
153
|
-
|
|
154
|
-
listTags(where: TagWhereInput): [String]
|
|
155
|
-
|
|
156
|
-
# Get installed version
|
|
157
|
-
version: String
|
|
158
|
-
|
|
159
|
-
getSettings: FileManagerSettingsResponse
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
type FilesDeleteResponse {
|
|
163
|
-
data: Boolean
|
|
164
|
-
error: FileError
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
type FmMutation {
|
|
168
|
-
createFile(data: FileInput!): FileResponse
|
|
169
|
-
createFiles(data: [FileInput]!): CreateFilesResponse
|
|
170
|
-
updateFile(id: ID!, data: FileInput!): FileResponse
|
|
171
|
-
deleteFile(id: ID!): FilesDeleteResponse
|
|
172
|
-
|
|
173
|
-
# Install File manager
|
|
174
|
-
install(srcPrefix: String): FileManagerBooleanResponse
|
|
175
|
-
|
|
176
|
-
upgrade(version: String!): FileManagerBooleanResponse
|
|
177
|
-
|
|
178
|
-
updateSettings(data: FileManagerSettingsInput): FileManagerSettingsResponse
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
input FilesInstallInput {
|
|
182
|
-
srcPrefix: String!
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
extend type Query {
|
|
186
|
-
fileManager: FmQuery
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
extend type Mutation {
|
|
190
|
-
fileManager: FmMutation
|
|
191
|
-
}
|
|
192
|
-
`,
|
|
193
|
-
resolvers: {
|
|
194
|
-
File: {
|
|
195
|
-
async src(file, _, context) {
|
|
196
|
-
const settings = await context.fileManager.settings.getSettings();
|
|
197
|
-
return ((settings === null || settings === void 0 ? void 0 : settings.srcPrefix) || "") + file.key;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
},
|
|
201
|
-
Query: {
|
|
202
|
-
fileManager: emptyResolver
|
|
203
|
-
},
|
|
204
|
-
Mutation: {
|
|
205
|
-
fileManager: emptyResolver
|
|
206
|
-
},
|
|
207
|
-
FmQuery: {
|
|
208
|
-
getFile(_, args, context) {
|
|
209
|
-
return resolve(() => context.fileManager.files.getFile(args.id));
|
|
210
|
-
},
|
|
211
|
-
|
|
212
|
-
async listFiles(_, args, context) {
|
|
213
|
-
try {
|
|
214
|
-
const [data, meta] = await context.fileManager.files.listFiles(args);
|
|
215
|
-
return new _handlerGraphql.ListResponse(data, meta);
|
|
216
|
-
} catch (e) {
|
|
217
|
-
return new _handlerGraphql.ErrorResponse(e);
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
|
|
221
|
-
async listTags(_, args, context) {
|
|
222
|
-
try {
|
|
223
|
-
return await context.fileManager.files.listTags(args || {});
|
|
224
|
-
} catch (error) {
|
|
225
|
-
return new _handlerGraphql.ErrorResponse(error);
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
|
|
229
|
-
async version(_, __, context) {
|
|
230
|
-
const {
|
|
231
|
-
i18n,
|
|
232
|
-
tenancy,
|
|
233
|
-
fileManager
|
|
234
|
-
} = context;
|
|
235
|
-
|
|
236
|
-
if (!tenancy.getCurrentTenant() || !i18n.getContentLocale()) {
|
|
237
|
-
return null;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return await fileManager.system.getVersion();
|
|
241
|
-
},
|
|
242
|
-
|
|
243
|
-
async getSettings(_, __, context) {
|
|
244
|
-
return resolve(() => context.fileManager.settings.getSettings());
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
},
|
|
248
|
-
FmMutation: {
|
|
249
|
-
async createFile(_, args, context) {
|
|
250
|
-
return resolve(() => context.fileManager.files.createFile(args.data));
|
|
251
|
-
},
|
|
252
|
-
|
|
253
|
-
async updateFile(_, args, context) {
|
|
254
|
-
return resolve(() => context.fileManager.files.updateFile(args.id, args.data));
|
|
255
|
-
},
|
|
256
|
-
|
|
257
|
-
async createFiles(_, args, context) {
|
|
258
|
-
return resolve(() => context.fileManager.files.createFilesInBatch(args.data));
|
|
259
|
-
},
|
|
260
|
-
|
|
261
|
-
async deleteFile(_, args, context) {
|
|
262
|
-
return resolve(async () => {
|
|
263
|
-
const file = await context.fileManager.files.getFile(args.id);
|
|
264
|
-
return await context.fileManager.storage.delete({
|
|
265
|
-
id: file.id,
|
|
266
|
-
key: file.key
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
},
|
|
270
|
-
|
|
271
|
-
async install(_, args, context) {
|
|
272
|
-
return resolve(() => context.fileManager.system.install({
|
|
273
|
-
srcPrefix: args.srcPrefix
|
|
274
|
-
}));
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
async upgrade(_, args, context) {
|
|
278
|
-
return resolve(() => context.fileManager.system.upgrade(args.version));
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
async updateSettings(_, args, context) {
|
|
282
|
-
return resolve(() => context.fileManager.settings.updateSettings(args.data));
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
var _default = plugin;
|
|
290
|
-
exports.default = _default;
|
package/plugins/graphql.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["emptyResolver","resolve","fn","Response","e","ErrorResponse","plugin","type","schema","typeDefs","resolvers","File","src","file","_","context","settings","fileManager","getSettings","srcPrefix","key","Query","Mutation","FmQuery","getFile","args","files","id","listFiles","data","meta","ListResponse","listTags","error","version","__","i18n","tenancy","getCurrentTenant","getContentLocale","system","getVersion","FmMutation","createFile","updateFile","createFiles","createFilesInBatch","deleteFile","storage","delete","install","upgrade","updateSettings"],"sources":["graphql.ts"],"sourcesContent":["import { Response, ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { FileManagerContext, FilesListOpts } from \"~/types\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/types\";\n\nconst emptyResolver = () => ({});\n\n/**\n * Use any because it really can be any.\n * TODO @ts-refactor maybe use generics at some point?\n */\ninterface ResolveCallable {\n (): Promise<any>;\n}\n\nconst resolve = async (fn: ResolveCallable) => {\n try {\n return new Response(await fn());\n } catch (e) {\n return new ErrorResponse(e);\n }\n};\n\nconst plugin: GraphQLSchemaPlugin<FileManagerContext> = {\n type: \"graphql-schema\",\n schema: {\n typeDefs: /* GraphQL */ `\n type FmCreatedBy {\n id: ID\n displayName: String\n }\n\n input FileInput {\n key: String\n name: String\n size: Int\n type: String\n tags: [String]\n meta: JSON\n }\n\n type UploadFileResponseDataFile {\n name: String\n type: String\n size: Int\n key: String\n }\n\n type UploadFileResponseData {\n # Contains data that is necessary for initiating a file upload.\n data: JSON\n file: UploadFileResponseDataFile\n }\n\n type FileListMeta {\n cursor: String\n totalCount: Int\n hasMoreItems: Boolean\n }\n\n type FileError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type FileListResponse {\n data: [File]\n meta: FileListMeta\n error: FileError\n }\n\n type FileResponse {\n data: File\n error: FileError\n }\n\n type CreateFilesResponse {\n data: [File]!\n error: FileError\n }\n\n type File {\n id: ID\n key: String\n name: String\n size: Int\n type: String\n src: String\n tags: [String]\n meta: JSON\n createdOn: DateTime\n createdBy: FmCreatedBy\n }\n\n type FileManagerBooleanResponse {\n data: Boolean\n error: FileError\n }\n\n type FileManagerSettings {\n uploadMinFileSize: Number\n uploadMaxFileSize: Number\n srcPrefix: String\n }\n\n input FileManagerSettingsInput {\n uploadMinFileSize: Number\n uploadMaxFileSize: Number\n srcPrefix: String\n }\n\n type FileManagerSettingsResponse {\n data: FileManagerSettings\n error: FileError\n }\n\n input FileWhereInput {\n search: String\n type: String\n type_in: [String!]\n tag: String\n tag_in: [String!]\n tag_and_in: [String!]\n tag_startsWith: String\n tag_not_startsWith: String\n id_in: [ID!]\n id: ID\n createdBy: ID\n }\n\n input TagWhereInput {\n tag_startsWith: String\n tag_not_startsWith: String\n }\n\n type FmQuery {\n getFile(id: ID, where: JSON, sort: String): FileResponse\n\n listFiles(\n limit: Int\n after: String\n types: [String]\n tags: [String]\n ids: [ID]\n search: String\n where: FileWhereInput\n ): FileListResponse\n\n listTags(where: TagWhereInput): [String]\n\n # Get installed version\n version: String\n\n getSettings: FileManagerSettingsResponse\n }\n\n type FilesDeleteResponse {\n data: Boolean\n error: FileError\n }\n\n type FmMutation {\n createFile(data: FileInput!): FileResponse\n createFiles(data: [FileInput]!): CreateFilesResponse\n updateFile(id: ID!, data: FileInput!): FileResponse\n deleteFile(id: ID!): FilesDeleteResponse\n\n # Install File manager\n install(srcPrefix: String): FileManagerBooleanResponse\n\n upgrade(version: String!): FileManagerBooleanResponse\n\n updateSettings(data: FileManagerSettingsInput): FileManagerSettingsResponse\n }\n\n input FilesInstallInput {\n srcPrefix: String!\n }\n\n extend type Query {\n fileManager: FmQuery\n }\n\n extend type Mutation {\n fileManager: FmMutation\n }\n `,\n resolvers: {\n File: {\n async src(file, _, context: FileManagerContext) {\n const settings = await context.fileManager.settings.getSettings();\n return (settings?.srcPrefix || \"\") + file.key;\n }\n },\n Query: {\n fileManager: emptyResolver\n },\n Mutation: {\n fileManager: emptyResolver\n },\n FmQuery: {\n getFile(_, args: any, context) {\n return resolve(() => context.fileManager.files.getFile(args.id));\n },\n async listFiles(_, args: FilesListOpts, context) {\n try {\n const [data, meta] = await context.fileManager.files.listFiles(args);\n return new ListResponse(data, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n async listTags(_, args: any, context) {\n try {\n return await context.fileManager.files.listTags(args || {});\n } catch (error) {\n return new ErrorResponse(error);\n }\n },\n async version(_, __, context) {\n const { i18n, tenancy, fileManager } = context;\n if (!tenancy.getCurrentTenant() || !i18n.getContentLocale()) {\n return null;\n }\n\n return await fileManager.system.getVersion();\n },\n async getSettings(_, __, context) {\n return resolve(() => context.fileManager.settings.getSettings());\n }\n },\n FmMutation: {\n async createFile(_, args: any, context) {\n return resolve(() => context.fileManager.files.createFile(args.data));\n },\n async updateFile(_, args: any, context) {\n return resolve(() => context.fileManager.files.updateFile(args.id, args.data));\n },\n async createFiles(_, args: any, context) {\n return resolve(() => context.fileManager.files.createFilesInBatch(args.data));\n },\n async deleteFile(_, args: any, context) {\n return resolve(async () => {\n const file = await context.fileManager.files.getFile(args.id);\n return await context.fileManager.storage.delete({\n id: file.id,\n key: file.key\n });\n });\n },\n async install(_, args: any, context) {\n return resolve(() =>\n context.fileManager.system.install({ srcPrefix: args.srcPrefix })\n );\n },\n async upgrade(_, args: any, context) {\n return resolve(() => context.fileManager.system.upgrade(args.version));\n },\n async updateSettings(_, args: any, context) {\n return resolve(() => context.fileManager.settings.updateSettings(args.data));\n }\n }\n }\n }\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;AAAA;;AAIA,MAAMA,aAAa,GAAG,OAAO,EAAP,CAAtB;AAEA;AACA;AACA;AACA;;;AAKA,MAAMC,OAAO,GAAG,MAAOC,EAAP,IAA+B;EAC3C,IAAI;IACA,OAAO,IAAIC,wBAAJ,CAAa,MAAMD,EAAE,EAArB,CAAP;EACH,CAFD,CAEE,OAAOE,CAAP,EAAU;IACR,OAAO,IAAIC,6BAAJ,CAAkBD,CAAlB,CAAP;EACH;AACJ,CAND;;AAQA,MAAME,MAA+C,GAAG;EACpDC,IAAI,EAAE,gBAD8C;EAEpDC,MAAM,EAAE;IACJC,QAAQ;IAAE;IAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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AxD;eAqPevB,M"}
|
package/plugins/index.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: () => (import("@webiny/handler-graphql/types").GraphQLSchemaPlugin<import("../types").FileManagerContext> | import("./definitions/FilePlugin").FilePlugin[] | import("@webiny/api").ContextPlugin<import("../types").FileManagerContext>)[];
|
|
2
|
-
export default _default;
|
package/plugins/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _graphql = _interopRequireDefault(require("./graphql"));
|
|
11
|
-
|
|
12
|
-
var _files = _interopRequireDefault(require("./crud/files.crud"));
|
|
13
|
-
|
|
14
|
-
var _validation = _interopRequireDefault(require("./crud/files/validation"));
|
|
15
|
-
|
|
16
|
-
var _settings = _interopRequireDefault(require("./crud/settings.crud"));
|
|
17
|
-
|
|
18
|
-
var _system = _interopRequireDefault(require("./crud/system.crud"));
|
|
19
|
-
|
|
20
|
-
var _storage = _interopRequireDefault(require("./storage"));
|
|
21
|
-
|
|
22
|
-
var _default = () => [_system.default, _settings.default, _files.default, _storage.default, _graphql.default, (0, _validation.default)()];
|
|
23
|
-
|
|
24
|
-
exports.default = _default;
|
package/plugins/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["systemCRUD","settingsCRUD","filesCRUD","storage","graphql","fileValidationPlugin"],"sources":["index.ts"],"sourcesContent":["import graphql from \"./graphql\";\nimport filesCRUD from \"./crud/files.crud\";\nimport fileValidationPlugin from \"./crud/files/validation\";\nimport settingsCRUD from \"./crud/settings.crud\";\nimport systemCRUD from \"./crud/system.crud\";\nimport storage from \"./storage\";\n\nexport default () => [\n systemCRUD,\n settingsCRUD,\n filesCRUD,\n storage,\n graphql,\n fileValidationPlugin()\n];\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;eAEe,MAAM,CACjBA,eADiB,EAEjBC,iBAFiB,EAGjBC,cAHiB,EAIjBC,gBAJiB,EAKjBC,gBALiB,EAMjB,IAAAC,mBAAA,GANiB,C"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { FileManagerContext } from "../../types";
|
|
3
|
-
export declare type Result = Record<string, any>;
|
|
4
|
-
export interface FileStorageUploadParams {
|
|
5
|
-
buffer: Buffer;
|
|
6
|
-
hideInFileManager: boolean | string;
|
|
7
|
-
tags?: string[];
|
|
8
|
-
size: number;
|
|
9
|
-
name: string;
|
|
10
|
-
keyPrefix: string;
|
|
11
|
-
type: string;
|
|
12
|
-
}
|
|
13
|
-
export interface FileStorageDeleteParams {
|
|
14
|
-
id: string;
|
|
15
|
-
key: string;
|
|
16
|
-
}
|
|
17
|
-
export interface FileStorageUploadMultipleParams {
|
|
18
|
-
files: FileStorageUploadParams[];
|
|
19
|
-
}
|
|
20
|
-
export interface FileStorageParams {
|
|
21
|
-
context: FileManagerContext;
|
|
22
|
-
}
|
|
23
|
-
export declare class FileStorage {
|
|
24
|
-
private readonly storagePlugin;
|
|
25
|
-
private readonly context;
|
|
26
|
-
constructor({ context }: FileStorageParams);
|
|
27
|
-
upload(params: FileStorageUploadParams): Promise<Result>;
|
|
28
|
-
uploadFiles(params: FileStorageUploadMultipleParams): Promise<import("../../types").File[]>;
|
|
29
|
-
delete(params: FileStorageDeleteParams): Promise<boolean>;
|
|
30
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.FileStorage = void 0;
|
|
9
|
-
|
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
-
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
-
|
|
16
|
-
const storagePluginType = "api-file-manager-storage";
|
|
17
|
-
|
|
18
|
-
class FileStorage {
|
|
19
|
-
constructor({
|
|
20
|
-
context
|
|
21
|
-
}) {
|
|
22
|
-
(0, _defineProperty2.default)(this, "storagePlugin", void 0);
|
|
23
|
-
(0, _defineProperty2.default)(this, "context", void 0);
|
|
24
|
-
const storagePlugin = context.plugins.byType(storagePluginType).pop();
|
|
25
|
-
|
|
26
|
-
if (!storagePlugin) {
|
|
27
|
-
throw new _error.default(`Missing plugin of type "${storagePluginType}".`, "STORAGE_PLUGIN_ERROR");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
this.storagePlugin = storagePlugin;
|
|
31
|
-
this.context = context;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async upload(params) {
|
|
35
|
-
const settings = await this.context.fileManager.settings.getSettings();
|
|
36
|
-
|
|
37
|
-
if (!settings) {
|
|
38
|
-
throw new _error.default("Missing File Manager Settings.", "FILE_MANAGER_ERROR");
|
|
39
|
-
} // Add file to cloud storage.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const {
|
|
43
|
-
file: fileData
|
|
44
|
-
} = await this.storagePlugin.upload((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
|
|
45
|
-
settings
|
|
46
|
-
}));
|
|
47
|
-
const {
|
|
48
|
-
fileManager
|
|
49
|
-
} = this.context; // Save file in DB.
|
|
50
|
-
|
|
51
|
-
return await fileManager.files.createFile((0, _objectSpread2.default)((0, _objectSpread2.default)({}, fileData), {}, {
|
|
52
|
-
meta: {
|
|
53
|
-
private: Boolean(params.hideInFileManager)
|
|
54
|
-
},
|
|
55
|
-
tags: Array.isArray(params.tags) ? params.tags : []
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async uploadFiles(params) {
|
|
60
|
-
const settings = await this.context.fileManager.settings.getSettings();
|
|
61
|
-
|
|
62
|
-
if (!settings) {
|
|
63
|
-
throw new _error.default("Missing File Manager Settings.", "FILE_MANAGER_ERROR");
|
|
64
|
-
} // Upload files to cloud storage.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const promises = [];
|
|
68
|
-
|
|
69
|
-
for (const item of params.files) {
|
|
70
|
-
promises.push(this.storagePlugin.upload((0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
71
|
-
settings
|
|
72
|
-
})));
|
|
73
|
-
} // Wait for all to resolve.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const uploadFileResponses = await Promise.all(promises);
|
|
77
|
-
const filesData = uploadFileResponses.map(response => response.file);
|
|
78
|
-
const {
|
|
79
|
-
fileManager
|
|
80
|
-
} = this.context; // Save files in DB.
|
|
81
|
-
|
|
82
|
-
return fileManager.files.createFilesInBatch(filesData);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
async delete(params) {
|
|
86
|
-
const {
|
|
87
|
-
id,
|
|
88
|
-
key
|
|
89
|
-
} = params;
|
|
90
|
-
const {
|
|
91
|
-
fileManager
|
|
92
|
-
} = this.context; // Delete file from cloud storage.
|
|
93
|
-
|
|
94
|
-
await this.storagePlugin.delete({
|
|
95
|
-
key
|
|
96
|
-
}); // Delete file from the DB.
|
|
97
|
-
|
|
98
|
-
return await fileManager.files.deleteFile(id);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
exports.FileStorage = FileStorage;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["storagePluginType","FileStorage","constructor","context","storagePlugin","plugins","byType","pop","WebinyError","upload","params","settings","fileManager","getSettings","file","fileData","files","createFile","meta","private","Boolean","hideInFileManager","tags","Array","isArray","uploadFiles","promises","item","push","uploadFileResponses","Promise","all","filesData","map","response","createFilesInBatch","delete","id","key","deleteFile"],"sources":["FileStorage.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { FilePhysicalStoragePlugin } from \"~/plugins/definitions/FilePhysicalStoragePlugin\";\n\nexport type Result = Record<string, any>;\n\nconst storagePluginType = \"api-file-manager-storage\";\n\nexport interface FileStorageUploadParams {\n buffer: Buffer;\n hideInFileManager: boolean | string;\n tags?: string[];\n size: number;\n name: string;\n keyPrefix: string;\n type: string;\n}\nexport interface FileStorageDeleteParams {\n id: string;\n key: string;\n}\n\nexport interface FileStorageUploadMultipleParams {\n files: FileStorageUploadParams[];\n}\n\nexport interface FileStorageParams {\n context: FileManagerContext;\n}\nexport class FileStorage {\n private readonly storagePlugin: FilePhysicalStoragePlugin;\n private readonly context: FileManagerContext;\n\n constructor({ context }: FileStorageParams) {\n const storagePlugin = context.plugins\n .byType<FilePhysicalStoragePlugin>(storagePluginType)\n .pop();\n if (!storagePlugin) {\n throw new WebinyError(\n `Missing plugin of type \"${storagePluginType}\".`,\n \"STORAGE_PLUGIN_ERROR\"\n );\n }\n this.storagePlugin = storagePlugin;\n this.context = context;\n }\n\n async upload(params: FileStorageUploadParams): Promise<Result> {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Add file to cloud storage.\n const { file: fileData } = await this.storagePlugin.upload({\n ...params,\n settings\n });\n\n const { fileManager } = this.context;\n\n // Save file in DB.\n return await fileManager.files.createFile({\n ...(fileData as any),\n meta: {\n private: Boolean(params.hideInFileManager)\n },\n tags: Array.isArray(params.tags) ? params.tags : []\n });\n }\n\n async uploadFiles(params: FileStorageUploadMultipleParams) {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Upload files to cloud storage.\n const promises = [];\n for (const item of params.files) {\n promises.push(\n this.storagePlugin.upload({\n ...item,\n settings\n })\n );\n }\n // Wait for all to resolve.\n const uploadFileResponses = await Promise.all(promises);\n\n const filesData = uploadFileResponses.map(response => response.file);\n\n const { fileManager } = this.context;\n // Save files in DB.\n return fileManager.files.createFilesInBatch(filesData);\n }\n\n async delete(params: FileStorageDeleteParams) {\n const { id, key } = params;\n const { fileManager } = this.context;\n // Delete file from cloud storage.\n await this.storagePlugin.delete({\n key\n });\n // Delete file from the DB.\n return await fileManager.files.deleteFile(id);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;;AAKA,MAAMA,iBAAiB,GAAG,0BAA1B;;AAuBO,MAAMC,WAAN,CAAkB;EAIrBC,WAAW,CAAC;IAAEC;EAAF,CAAD,EAAiC;IAAA;IAAA;IACxC,MAAMC,aAAa,GAAGD,OAAO,CAACE,OAAR,CACjBC,MADiB,CACiBN,iBADjB,EAEjBO,GAFiB,EAAtB;;IAGA,IAAI,CAACH,aAAL,EAAoB;MAChB,MAAM,IAAII,cAAJ,CACD,2BAA0BR,iBAAkB,IAD3C,EAEF,sBAFE,CAAN;IAIH;;IACD,KAAKI,aAAL,GAAqBA,aAArB;IACA,KAAKD,OAAL,GAAeA,OAAf;EACH;;EAEW,MAANM,MAAM,CAACC,MAAD,EAAmD;IAC3D,MAAMC,QAAQ,GAAG,MAAM,KAAKR,OAAL,CAAaS,WAAb,CAAyBD,QAAzB,CAAkCE,WAAlC,EAAvB;;IACA,IAAI,CAACF,QAAL,EAAe;MACX,MAAM,IAAIH,cAAJ,CAAgB,gCAAhB,EAAkD,oBAAlD,CAAN;IACH,CAJ0D,CAK3D;;;IACA,MAAM;MAAEM,IAAI,EAAEC;IAAR,IAAqB,MAAM,KAAKX,aAAL,CAAmBK,MAAnB,6DAC1BC,MAD0B;MAE7BC;IA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F,IAAkB,KAAKT,OAA7B,CAF0C,CAG1C;;IACA,MAAM,KAAKC,aAAL,CAAmBgC,MAAnB,CAA0B;MAC5BE;IAD4B,CAA1B,CAAN,CAJ0C,CAO1C;;IACA,OAAO,MAAM1B,WAAW,CAACI,KAAZ,CAAkBuB,UAAlB,CAA6BF,EAA7B,CAAb;EACH;;AA3EoB"}
|
package/plugins/storage/index.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _api = require("@webiny/api");
|
|
9
|
-
|
|
10
|
-
var _FileStorage = require("./FileStorage");
|
|
11
|
-
|
|
12
|
-
const fileStorageContextPlugin = new _api.ContextPlugin(async context => {
|
|
13
|
-
if (!context.fileManager) {
|
|
14
|
-
/**
|
|
15
|
-
* We need to define the fileManager initial property as empty object.
|
|
16
|
-
* When casting as FileManagerContext, typescript is complaining.
|
|
17
|
-
*/
|
|
18
|
-
context.fileManager = {};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
context.fileManager.storage = new _FileStorage.FileStorage({
|
|
22
|
-
context
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
var _default = fileStorageContextPlugin;
|
|
26
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["fileStorageContextPlugin","ContextPlugin","context","fileManager","storage","FileStorage"],"sources":["index.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { FileStorage } from \"./FileStorage\";\n\nconst fileStorageContextPlugin = new ContextPlugin<FileManagerContext>(async context => {\n if (!context.fileManager) {\n /**\n * We need to define the fileManager initial property as empty object.\n * When casting as FileManagerContext, typescript is complaining.\n */\n context.fileManager = {} as any;\n }\n context.fileManager.storage = new FileStorage({\n context\n });\n});\n\nexport default fileStorageContextPlugin;\n"],"mappings":";;;;;;;AACA;;AACA;;AAEA,MAAMA,wBAAwB,GAAG,IAAIC,kBAAJ,CAAsC,MAAMC,OAAN,IAAiB;EACpF,IAAI,CAACA,OAAO,CAACC,WAAb,EAA0B;IACtB;AACR;AACA;AACA;IACQD,OAAO,CAACC,WAAR,GAAsB,EAAtB;EACH;;EACDD,OAAO,CAACC,WAAR,CAAoBC,OAApB,GAA8B,IAAIC,wBAAJ,CAAgB;IAC1CH;EAD0C,CAAhB,CAA9B;AAGH,CAXgC,CAAjC;eAaeF,wB"}
|
package/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { I18NContext } from \"@webiny/api-i18n/types\";\nimport { FileStorage } from \"./plugins/storage/FileStorage\";\nimport { TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { SecurityContext, SecurityPermission } from \"@webiny/api-security/types\";\nimport { Context } from \"@webiny/api/types\";\n\nexport interface FileManagerContext extends Context, SecurityContext, TenancyContext, I18NContext {\n fileManager: {\n files: FilesCRUD;\n settings: SettingsCRUD;\n storage: FileStorage;\n system: SystemCRUD;\n };\n}\n\nexport interface FilePermission extends SecurityPermission {\n name: \"fm.file\";\n rwd?: string;\n own?: boolean;\n}\n\nexport interface File {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n meta: Record<string, any>;\n tags: string[];\n createdOn: string;\n createdBy: CreatedBy;\n /**\n * Added with new storage operations refactoring.\n */\n tenant: string;\n locale: string;\n webinyVersion: string;\n /**\n * User can add new fields to the File object so we must allow it in the types.\n */\n [key: string]: any;\n}\n\nexport interface CreatedBy {\n id: string;\n displayName: string | null;\n type: string;\n}\n\nexport interface FileInput {\n key: string;\n name: string;\n size: number;\n type: string;\n meta: Record<string, any>;\n tags: string[];\n}\n\nexport interface FileListWhereParams {\n search?: string;\n type?: string;\n type_in?: string[];\n tag?: string;\n tag_in?: string[];\n tag_and_in?: string[];\n id_in?: string[];\n id?: string;\n}\nexport interface FilesListOpts {\n search?: string;\n types?: string[];\n tags?: string[];\n ids?: string[];\n limit?: number;\n after?: string;\n where?: FileListWhereParams;\n sort?: string[];\n}\n\nexport interface FileListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\ninterface FilesCrudListTagsWhere {\n tag?: string;\n tag_contains?: string;\n tag_in?: string[];\n tag_not_startsWith?: string;\n tag_startsWith?: string;\n}\ninterface FilesCrudListTagsParams {\n where?: FilesCrudListTagsWhere;\n limit?: number;\n after?: string;\n}\n\nexport interface FilesCRUD {\n getFile(id: string): Promise<File>;\n listFiles(opts?: FilesListOpts): Promise<[File[], FileListMeta]>;\n listTags(params: FilesCrudListTagsParams): Promise<string[]>;\n createFile(data: FileInput): Promise<File>;\n updateFile(id: string, data: Partial<FileInput>): Promise<File>;\n deleteFile(id: string): Promise<boolean>;\n createFilesInBatch(data: FileInput[]): Promise<File[]>;\n}\n\nexport interface SystemCRUD {\n getVersion(): Promise<string | null>;\n setVersion(version: string): Promise<void>;\n install(args: { srcPrefix: string }): Promise<boolean>;\n upgrade(version: string, data?: Record<string, any>): Promise<boolean>;\n}\n\nexport interface FileManagerSettings {\n key: string;\n uploadMinFileSize: number;\n uploadMaxFileSize: number;\n srcPrefix: string;\n}\n\nexport interface FileManagerSystem {\n version: string;\n tenant: string;\n}\n\nexport type SettingsCRUD = {\n getSettings(): Promise<FileManagerSettings | null>;\n createSettings(data?: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n updateSettings(data: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n deleteSettings(): Promise<boolean>;\n};\n/********\n * Storage operations\n *******/\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsUpdateParams {\n /**\n * The system data to be updated.\n */\n original: FileManagerSystem;\n /**\n * The system data with the updated fields.\n */\n data: FileManagerSystem;\n}\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsCreateParams {\n /**\n * The system fields.\n */\n data: FileManagerSystem;\n}\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n */\nexport interface FileManagerSystemStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: () => Promise<FileManagerSystem | null>;\n /**\n * Update the FileManager system data..\n */\n update: (params: FileManagerSystemStorageOperationsUpdateParams) => Promise<FileManagerSystem>;\n /**\n * Create the FileManagerSystemData\n */\n create: (params: FileManagerSystemStorageOperationsCreateParams) => Promise<FileManagerSystem>;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsUpdateParams {\n /**\n * Original settings to be updated.\n */\n original: FileManagerSettings;\n /**\n * The settings with the updated fields.\n */\n data: FileManagerSettings;\n}\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsCreateParams {\n /**\n * The settings fields.\n */\n data: FileManagerSettings;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n */\nexport interface FileManagerSettingsStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: () => Promise<FileManagerSettings | null>;\n /**\n * Create the FileManagerSettingsData\n */\n create: (\n params: FileManagerSettingsStorageOperationsCreateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Update the FileManager system data..\n */\n update: (\n params: FileManagerSettingsStorageOperationsUpdateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Delete the existing settings.\n */\n delete: () => Promise<void>;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsGetParams {\n where: {\n id: string;\n tenant: string;\n locale: string;\n };\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsUpdateParams {\n original: File;\n file: File;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsDeleteParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateBatchParams {\n files: File[];\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParamsWhere {\n id?: string;\n id_in?: string[];\n name?: string;\n name_contains?: string;\n tag?: string;\n tag_contains?: string;\n tag_in?: string[];\n createdBy?: string;\n locale: string;\n tenant: string;\n private?: boolean;\n type?: string;\n type_in?: string[];\n search?: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParams {\n where: FileManagerFilesStorageOperationsListParamsWhere;\n sort: string[];\n limit: number;\n after: string | null;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListResponseMeta {\n hasMoreItems: boolean;\n totalCount: number;\n cursor: string | null;\n}\nexport type FileManagerFilesStorageOperationsListResponse = [\n File[],\n FileManagerFilesStorageOperationsListResponseMeta\n];\n\nexport type FileManagerFilesStorageOperationsTagsResponse = [\n string[],\n FileManagerFilesStorageOperationsListResponseMeta\n];\n\nexport interface FileManagerFilesStorageOperationsTagsParamsWhere extends FilesCrudListTagsWhere {\n locale: string;\n tenant: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsTagsParams {\n where: FileManagerFilesStorageOperationsTagsParamsWhere;\n limit: number;\n after?: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n */\nexport interface FileManagerFilesStorageOperations {\n /**\n * Get a single file with given ID from the storage.\n */\n get: (params: FileManagerFilesStorageOperationsGetParams) => Promise<File | null>;\n /**\n * Insert the file data into the database.\n */\n create: (params: FileManagerFilesStorageOperationsCreateParams) => Promise<File>;\n /**\n * Update the file data in the database.\n */\n update: (params: FileManagerFilesStorageOperationsUpdateParams) => Promise<File>;\n /**\n * Delete the file from the database.\n */\n delete: (params: FileManagerFilesStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Store multiple files at once to the database.\n */\n createBatch: (params: FileManagerFilesStorageOperationsCreateBatchParams) => Promise<File[]>;\n /**\n * Get a list of files filtered by given parameters.\n */\n list: (\n params: FileManagerFilesStorageOperationsListParams\n ) => Promise<FileManagerFilesStorageOperationsListResponse>;\n /**\n * Get a list of all file tags filtered by given parameters.\n */\n tags: (\n params: FileManagerFilesStorageOperationsTagsParams\n ) => Promise<FileManagerFilesStorageOperationsTagsResponse>;\n}\n"],"mappings":""}
|
package/utils.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Plugin } from "@webiny/plugins/types";
|
|
2
|
-
declare type CallbackFallback = (args: any) => void | Promise<void>;
|
|
3
|
-
export declare const executeCallbacks: <TCallbackFunction extends CallbackFallback = CallbackFallback>(plugins: Plugin[], hook: string, args: Parameters<TCallbackFunction>[0]) => Promise<void>;
|
|
4
|
-
export {};
|
package/utils.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.executeCallbacks = void 0;
|
|
7
|
-
|
|
8
|
-
const executeCallbacks = async (plugins, hook, args) => {
|
|
9
|
-
for (const plugin of plugins) {
|
|
10
|
-
if (typeof plugin[hook] === "function") {
|
|
11
|
-
await plugin[hook](args);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.executeCallbacks = executeCallbacks;
|
package/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["executeCallbacks","plugins","hook","args","plugin"],"sources":["utils.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\n\ntype CallbackFallback = (args: any) => void | Promise<void>;\n\nexport const executeCallbacks = async <\n TCallbackFunction extends CallbackFallback = CallbackFallback\n>(\n plugins: Plugin[],\n hook: string,\n args: Parameters<TCallbackFunction>[0]\n) => {\n for (const plugin of plugins) {\n if (typeof plugin[hook] === \"function\") {\n await plugin[hook](args);\n }\n }\n};\n"],"mappings":";;;;;;;AAIO,MAAMA,gBAAgB,GAAG,OAG5BC,OAH4B,EAI5BC,IAJ4B,EAK5BC,IAL4B,KAM3B;EACD,KAAK,MAAMC,MAAX,IAAqBH,OAArB,EAA8B;IAC1B,IAAI,OAAOG,MAAM,CAACF,IAAD,CAAb,KAAwB,UAA5B,EAAwC;MACpC,MAAME,MAAM,CAACF,IAAD,CAAN,CAAaC,IAAb,CAAN;IACH;EACJ;AACJ,CAZM"}
|