@webiny/api-file-manager 0.0.0-unstable.bca7b3e350 → 0.0.0-unstable.c27f4d8a31
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 +3 -0
- package/contants.js.map +1 -0
- package/delivery/AssetDelivery/Asset.d.ts +28 -0
- package/delivery/AssetDelivery/Asset.js +59 -0
- package/delivery/AssetDelivery/Asset.js.map +1 -0
- package/delivery/AssetDelivery/AssetDeliveryConfig.d.ts +65 -0
- package/delivery/AssetDelivery/AssetDeliveryConfig.js +94 -0
- package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +1 -0
- package/delivery/AssetDelivery/AssetRequest.d.ts +25 -0
- package/delivery/AssetDelivery/AssetRequest.js +22 -0
- package/delivery/AssetDelivery/AssetRequest.js.map +1 -0
- package/delivery/AssetDelivery/FilesAssetRequestResolver.d.ts +6 -0
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js +30 -0
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/NullAssetOutputStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js +8 -0
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/NullAssetReply.d.ts +4 -0
- package/delivery/AssetDelivery/NullAssetReply.js +13 -0
- package/delivery/AssetDelivery/NullAssetReply.js.map +1 -0
- package/delivery/AssetDelivery/NullAssetResolver.d.ts +5 -0
- package/delivery/AssetDelivery/NullAssetResolver.js +7 -0
- package/delivery/AssetDelivery/NullAssetResolver.js.map +1 -0
- package/delivery/AssetDelivery/NullRequestResolver.d.ts +4 -0
- package/delivery/AssetDelivery/NullRequestResolver.js +7 -0
- package/delivery/AssetDelivery/NullRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/SetCacheControlHeaders.d.ts +8 -0
- package/delivery/AssetDelivery/SetCacheControlHeaders.js +18 -0
- package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +1 -0
- package/delivery/AssetDelivery/SetResponseHeaders.d.ts +18 -0
- package/delivery/AssetDelivery/SetResponseHeaders.js +18 -0
- package/delivery/AssetDelivery/SetResponseHeaders.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js +3 -0
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js +3 -0
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetProcessor.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js +3 -0
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.d.ts +25 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.js +31 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.d.ts +5 -0
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js +3 -0
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetResolver.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetResolver.js +3 -0
- package/delivery/AssetDelivery/abstractions/AssetResolver.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js +3 -0
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js.map +1 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.d.ts +2 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +8 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.d.ts +4 -0
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js +3 -0
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +4 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js +19 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +8 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +8 -0
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +20 -0
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PrivateCache.d.ts +6 -0
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js +21 -0
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +8 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +30 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +13 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js +63 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PublicCache.d.ts +6 -0
- package/delivery/AssetDelivery/privateFiles/PublicCache.js +21 -0
- package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +7 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +20 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +7 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +20 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.d.ts +4 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js +7 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js.map +1 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js +7 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +1 -0
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.d.ts +6 -0
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js +19 -0
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js.map +1 -0
- package/delivery/index.d.ts +16 -0
- package/delivery/index.js +12 -0
- package/delivery/index.js.map +1 -0
- package/delivery/setupAssetDelivery.d.ts +2 -0
- package/delivery/setupAssetDelivery.js +114 -0
- package/delivery/setupAssetDelivery.js.map +1 -0
- 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 +6 -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 +3 -0
- package/graphql/baseSchema.js +103 -0
- package/graphql/baseSchema.js.map +1 -0
- package/graphql/createFilesTypeDefs.d.ts +7 -0
- package/graphql/createFilesTypeDefs.js +199 -0
- package/graphql/createFilesTypeDefs.js.map +1 -0
- package/graphql/filesSchema.d.ts +4 -0
- package/graphql/filesSchema.js +116 -0
- package/graphql/filesSchema.js.map +1 -0
- package/graphql/getFileByUrl.d.ts +3 -0
- package/graphql/getFileByUrl.js +69 -0
- package/graphql/getFileByUrl.js.map +1 -0
- package/graphql/index.d.ts +4 -0
- package/graphql/index.js +53 -0
- package/graphql/index.js.map +1 -0
- package/graphql/utils.d.ts +11 -0
- package/graphql/utils.js +17 -0
- package/graphql/utils.js.map +1 -0
- package/index.d.ts +7 -0
- package/index.js +37 -0
- package/index.js.map +1 -0
- package/modelModifier/CmsModelModifier.d.ts +26 -0
- package/modelModifier/CmsModelModifier.js +54 -0
- package/modelModifier/CmsModelModifier.js.map +1 -0
- package/package.json +26 -39
- package/permissions/schema.d.ts +73 -0
- package/permissions/schema.js +20 -0
- package/permissions/schema.js.map +1 -0
- package/types.d.ts +1 -356
- package/types.js +2 -4
- package/types.js.map +1 -1
- 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/utils.d.ts +0 -4
- package/utils.js +0 -16
- package/utils.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
# @webiny/api-file-manager
|
|
2
|
-
[](https://www.npmjs.com/package/@webiny/api-file-manager)
|
|
3
|
-
[](https://www.npmjs.com/package/@webiny/api-file-manager)
|
|
4
|
-
[](https://github.com/prettier/prettier)
|
|
5
|
-
[](http://makeapullrequest.com)
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
npm install --save @webiny/api-file-manager
|
|
12
|
-
```
|
|
7
|
+
📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
13
8
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
package/contants.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ROOT_FOLDER = "root";
|
package/contants.js
ADDED
package/contants.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ROOT_FOLDER"],"sources":["contants.ts"],"sourcesContent":["export const ROOT_FOLDER = \"root\";\n"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,MAAM","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AssetContentsReader, AssetOutputStrategy } from "../../delivery/index.js";
|
|
2
|
+
type Setter<T> = (arg: T | undefined) => T;
|
|
3
|
+
export interface AssetData {
|
|
4
|
+
id: string;
|
|
5
|
+
tenant: string;
|
|
6
|
+
key: string;
|
|
7
|
+
size: number;
|
|
8
|
+
contentType: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class Asset {
|
|
11
|
+
protected readonly props: AssetData;
|
|
12
|
+
private outputStrategy;
|
|
13
|
+
private contentsReader;
|
|
14
|
+
constructor(props: AssetData);
|
|
15
|
+
clone(): Asset;
|
|
16
|
+
withProps(props: Partial<AssetData>): Asset;
|
|
17
|
+
getId(): string;
|
|
18
|
+
getTenant(): string;
|
|
19
|
+
getKey(): string;
|
|
20
|
+
getSize(): number;
|
|
21
|
+
getContentType(): string;
|
|
22
|
+
getExtension(): string;
|
|
23
|
+
getContents(): Promise<Buffer<ArrayBufferLike>>;
|
|
24
|
+
setContentsReader(reader: AssetContentsReader): void;
|
|
25
|
+
output(): Promise<import("~/delivery/index.js").AssetReply>;
|
|
26
|
+
setOutputStrategy(setter: Setter<AssetOutputStrategy> | AssetOutputStrategy): void;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export class Asset {
|
|
2
|
+
constructor(props) {
|
|
3
|
+
this.props = props;
|
|
4
|
+
}
|
|
5
|
+
clone() {
|
|
6
|
+
return this.withProps(structuredClone(this.props));
|
|
7
|
+
}
|
|
8
|
+
withProps(props) {
|
|
9
|
+
const newAsset = new Asset({
|
|
10
|
+
...this.props,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
newAsset.contentsReader = this.contentsReader;
|
|
14
|
+
newAsset.outputStrategy = this.outputStrategy;
|
|
15
|
+
return newAsset;
|
|
16
|
+
}
|
|
17
|
+
getId() {
|
|
18
|
+
return this.props.id;
|
|
19
|
+
}
|
|
20
|
+
getTenant() {
|
|
21
|
+
return this.props.tenant;
|
|
22
|
+
}
|
|
23
|
+
getKey() {
|
|
24
|
+
return this.props.key;
|
|
25
|
+
}
|
|
26
|
+
getSize() {
|
|
27
|
+
return this.props.size;
|
|
28
|
+
}
|
|
29
|
+
getContentType() {
|
|
30
|
+
return this.props.contentType;
|
|
31
|
+
}
|
|
32
|
+
getExtension() {
|
|
33
|
+
return this.getKey().split(".").pop() ?? "";
|
|
34
|
+
}
|
|
35
|
+
getContents() {
|
|
36
|
+
if (!this.contentsReader) {
|
|
37
|
+
throw Error(`Asset contents reader was not configured!`);
|
|
38
|
+
}
|
|
39
|
+
return this.contentsReader.read(this);
|
|
40
|
+
}
|
|
41
|
+
setContentsReader(reader) {
|
|
42
|
+
this.contentsReader = reader;
|
|
43
|
+
}
|
|
44
|
+
output() {
|
|
45
|
+
if (!this.outputStrategy) {
|
|
46
|
+
throw Error(`Asset output strategy was not configured!`);
|
|
47
|
+
}
|
|
48
|
+
return this.outputStrategy.output(this);
|
|
49
|
+
}
|
|
50
|
+
setOutputStrategy(setter) {
|
|
51
|
+
if (typeof setter === "function") {
|
|
52
|
+
this.outputStrategy = setter(this.outputStrategy);
|
|
53
|
+
} else {
|
|
54
|
+
this.outputStrategy = setter;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=Asset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Asset","constructor","props","clone","withProps","structuredClone","newAsset","contentsReader","outputStrategy","getId","id","getTenant","tenant","getKey","key","getSize","size","getContentType","contentType","getExtension","split","pop","getContents","Error","read","setContentsReader","reader","output","setOutputStrategy","setter"],"sources":["Asset.ts"],"sourcesContent":["import type { AssetContentsReader, AssetOutputStrategy } from \"~/delivery/index.js\";\n\ntype Setter<T> = (arg: T | undefined) => T;\n\nexport interface AssetData {\n id: string;\n tenant: string;\n key: string;\n size: number;\n contentType: string;\n}\n\nexport class Asset {\n protected readonly props: AssetData;\n private outputStrategy: AssetOutputStrategy | undefined;\n private contentsReader: AssetContentsReader | undefined;\n\n constructor(props: AssetData) {\n this.props = props;\n }\n\n clone() {\n return this.withProps(structuredClone(this.props));\n }\n\n withProps(props: Partial<AssetData>) {\n const newAsset = new Asset({ ...this.props, ...props });\n newAsset.contentsReader = this.contentsReader;\n newAsset.outputStrategy = this.outputStrategy;\n return newAsset;\n }\n\n getId() {\n return this.props.id;\n }\n getTenant() {\n return this.props.tenant;\n }\n getKey() {\n return this.props.key;\n }\n getSize() {\n return this.props.size;\n }\n getContentType() {\n return this.props.contentType;\n }\n getExtension() {\n return this.getKey().split(\".\").pop() ?? \"\";\n }\n\n getContents() {\n if (!this.contentsReader) {\n throw Error(`Asset contents reader was not configured!`);\n }\n return this.contentsReader.read(this);\n }\n\n setContentsReader(reader: AssetContentsReader) {\n this.contentsReader = reader;\n }\n\n output() {\n if (!this.outputStrategy) {\n throw Error(`Asset output strategy was not configured!`);\n }\n\n return this.outputStrategy.output(this);\n }\n\n setOutputStrategy(setter: Setter<AssetOutputStrategy> | AssetOutputStrategy) {\n if (typeof setter === \"function\") {\n this.outputStrategy = setter(this.outputStrategy);\n } else {\n this.outputStrategy = setter;\n }\n }\n}\n"],"mappings":"AAYA,OAAO,MAAMA,KAAK,CAAC;EAKfC,WAAWA,CAACC,KAAgB,EAAE;IAC1B,IAAI,CAACA,KAAK,GAAGA,KAAK;EACtB;EAEAC,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACC,SAAS,CAACC,eAAe,CAAC,IAAI,CAACH,KAAK,CAAC,CAAC;EACtD;EAEAE,SAASA,CAACF,KAAyB,EAAE;IACjC,MAAMI,QAAQ,GAAG,IAAIN,KAAK,CAAC;MAAE,GAAG,IAAI,CAACE,KAAK;MAAE,GAAGA;IAAM,CAAC,CAAC;IACvDI,QAAQ,CAACC,cAAc,GAAG,IAAI,CAACA,cAAc;IAC7CD,QAAQ,CAACE,cAAc,GAAG,IAAI,CAACA,cAAc;IAC7C,OAAOF,QAAQ;EACnB;EAEAG,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACP,KAAK,CAACQ,EAAE;EACxB;EACAC,SAASA,CAAA,EAAG;IACR,OAAO,IAAI,CAACT,KAAK,CAACU,MAAM;EAC5B;EACAC,MAAMA,CAAA,EAAG;IACL,OAAO,IAAI,CAACX,KAAK,CAACY,GAAG;EACzB;EACAC,OAAOA,CAAA,EAAG;IACN,OAAO,IAAI,CAACb,KAAK,CAACc,IAAI;EAC1B;EACAC,cAAcA,CAAA,EAAG;IACb,OAAO,IAAI,CAACf,KAAK,CAACgB,WAAW;EACjC;EACAC,YAAYA,CAAA,EAAG;IACX,OAAO,IAAI,CAACN,MAAM,CAAC,CAAC,CAACO,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC,IAAI,EAAE;EAC/C;EAEAC,WAAWA,CAAA,EAAG;IACV,IAAI,CAAC,IAAI,CAACf,cAAc,EAAE;MACtB,MAAMgB,KAAK,CAAC,2CAA2C,CAAC;IAC5D;IACA,OAAO,IAAI,CAAChB,cAAc,CAACiB,IAAI,CAAC,IAAI,CAAC;EACzC;EAEAC,iBAAiBA,CAACC,MAA2B,EAAE;IAC3C,IAAI,CAACnB,cAAc,GAAGmB,MAAM;EAChC;EAEAC,MAAMA,CAAA,EAAG;IACL,IAAI,CAAC,IAAI,CAACnB,cAAc,EAAE;MACtB,MAAMe,KAAK,CAAC,2CAA2C,CAAC;IAC5D;IAEA,OAAO,IAAI,CAACf,cAAc,CAACmB,MAAM,CAAC,IAAI,CAAC;EAC3C;EAEAC,iBAAiBA,CAACC,MAAyD,EAAE;IACzE,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;MAC9B,IAAI,CAACrB,cAAc,GAAGqB,MAAM,CAAC,IAAI,CAACrB,cAAc,CAAC;IACrD,CAAC,MAAM;MACH,IAAI,CAACA,cAAc,GAAGqB,MAAM;IAChC;EACJ;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import type { AssetRequestResolver, AssetResolver, AssetProcessor, AssetOutputStrategy, AssetRequest, Asset, AssetTransformationStrategy, ResponseHeadersSetter } from "../../delivery/index.js";
|
|
3
|
+
import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
|
|
4
|
+
import { Container } from "@webiny/di";
|
|
5
|
+
type Setter<TParams, TReturn> = (params: TParams) => TReturn;
|
|
6
|
+
export type AssetRequestResolverDecorator = Setter<{
|
|
7
|
+
assetRequestResolver: AssetRequestResolver;
|
|
8
|
+
}, AssetRequestResolver>;
|
|
9
|
+
export type AssetResolverDecorator = Setter<{
|
|
10
|
+
assetResolver: AssetResolver;
|
|
11
|
+
container: Container;
|
|
12
|
+
}, AssetResolver>;
|
|
13
|
+
export type AssetProcessorDecorator = Setter<{
|
|
14
|
+
context: ApiCoreContext;
|
|
15
|
+
assetProcessor: AssetProcessor;
|
|
16
|
+
}, AssetProcessor>;
|
|
17
|
+
export type AssetTransformationDecorator = Setter<{
|
|
18
|
+
context: ApiCoreContext;
|
|
19
|
+
assetTransformationStrategy: AssetTransformationStrategy;
|
|
20
|
+
}, AssetTransformationStrategy>;
|
|
21
|
+
export interface AssetOutputStrategyDecoratorParams {
|
|
22
|
+
context: ApiCoreContext;
|
|
23
|
+
assetRequest: AssetRequest;
|
|
24
|
+
asset: Asset;
|
|
25
|
+
assetOutputStrategy: AssetOutputStrategy;
|
|
26
|
+
}
|
|
27
|
+
export type AssetOutputStrategyDecorator = Setter<AssetOutputStrategyDecoratorParams, AssetOutputStrategy>;
|
|
28
|
+
export declare class AssetDeliveryConfigBuilder {
|
|
29
|
+
private assetRequestResolverDecorators;
|
|
30
|
+
private assetResolverDecorators;
|
|
31
|
+
private assetProcessorDecorators;
|
|
32
|
+
private assetTransformationStrategyDecorators;
|
|
33
|
+
private assetOutputStrategyDecorators;
|
|
34
|
+
setResponseHeaders(setter: ResponseHeadersSetter): void;
|
|
35
|
+
decorateAssetRequestResolver(decorator: AssetRequestResolverDecorator): void;
|
|
36
|
+
decorateAssetResolver(decorator: AssetResolverDecorator): void;
|
|
37
|
+
decorateAssetProcessor(decorator: AssetProcessorDecorator): void;
|
|
38
|
+
decorateAssetTransformationStrategy(decorator: AssetTransformationDecorator): void;
|
|
39
|
+
decorateAssetOutputStrategy(decorator: AssetOutputStrategyDecorator): void;
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
getAssetRequestResolver(): AssetRequestResolver;
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
getAssetResolver(container: Container): AssetResolver;
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
getAssetProcessor(context: ApiCoreContext): AssetProcessor;
|
|
52
|
+
getAssetOutputStrategy(context: ApiCoreContext, assetRequest: AssetRequest, asset: Asset): AssetOutputStrategy;
|
|
53
|
+
getAssetTransformationStrategy(context: ApiCoreContext): AssetTransformationStrategy;
|
|
54
|
+
}
|
|
55
|
+
export interface AssetDeliveryConfigModifier {
|
|
56
|
+
(config: AssetDeliveryConfigBuilder): Promise<void> | void;
|
|
57
|
+
}
|
|
58
|
+
export declare class AssetDeliveryConfigModifierPlugin extends Plugin {
|
|
59
|
+
static type: string;
|
|
60
|
+
private readonly cb;
|
|
61
|
+
constructor(cb: AssetDeliveryConfigModifier);
|
|
62
|
+
buildConfig(configBuilder: AssetDeliveryConfigBuilder): Promise<void>;
|
|
63
|
+
}
|
|
64
|
+
export declare const createAssetDeliveryConfig: (cb: AssetDeliveryConfigModifier) => AssetDeliveryConfigModifierPlugin;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { SetResponseHeaders } from "../index.js";
|
|
3
|
+
import { NullRequestResolver } from "./NullRequestResolver.js";
|
|
4
|
+
import { NullAssetResolver } from "./NullAssetResolver.js";
|
|
5
|
+
import { NullAssetOutputStrategy } from "./NullAssetOutputStrategy.js";
|
|
6
|
+
import { TransformationAssetProcessor } from "./transformation/TransformationAssetProcessor.js";
|
|
7
|
+
import { PassthroughAssetTransformationStrategy } from "./transformation/PassthroughAssetTransformationStrategy.js";
|
|
8
|
+
export class AssetDeliveryConfigBuilder {
|
|
9
|
+
assetRequestResolverDecorators = [];
|
|
10
|
+
assetResolverDecorators = [];
|
|
11
|
+
assetProcessorDecorators = [];
|
|
12
|
+
assetTransformationStrategyDecorators = [];
|
|
13
|
+
assetOutputStrategyDecorators = [];
|
|
14
|
+
setResponseHeaders(setter) {
|
|
15
|
+
this.decorateAssetOutputStrategy(params => {
|
|
16
|
+
return new SetResponseHeaders(setter, params);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
decorateAssetRequestResolver(decorator) {
|
|
20
|
+
this.assetRequestResolverDecorators.push(decorator);
|
|
21
|
+
}
|
|
22
|
+
decorateAssetResolver(decorator) {
|
|
23
|
+
this.assetResolverDecorators.push(decorator);
|
|
24
|
+
}
|
|
25
|
+
decorateAssetProcessor(decorator) {
|
|
26
|
+
this.assetProcessorDecorators.push(decorator);
|
|
27
|
+
}
|
|
28
|
+
decorateAssetTransformationStrategy(decorator) {
|
|
29
|
+
this.assetTransformationStrategyDecorators.push(decorator);
|
|
30
|
+
}
|
|
31
|
+
decorateAssetOutputStrategy(decorator) {
|
|
32
|
+
this.assetOutputStrategyDecorators.push(decorator);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
getAssetRequestResolver() {
|
|
39
|
+
return this.assetRequestResolverDecorators.reduce((value, decorator) => decorator({
|
|
40
|
+
assetRequestResolver: value
|
|
41
|
+
}), new NullRequestResolver());
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
getAssetResolver(container) {
|
|
48
|
+
return this.assetResolverDecorators.reduce((value, decorator) => decorator({
|
|
49
|
+
container,
|
|
50
|
+
assetResolver: value
|
|
51
|
+
}), new NullAssetResolver());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
getAssetProcessor(context) {
|
|
58
|
+
return this.assetProcessorDecorators.reduce((value, decorator) => decorator({
|
|
59
|
+
assetProcessor: value,
|
|
60
|
+
context
|
|
61
|
+
}), new TransformationAssetProcessor(this.getAssetTransformationStrategy(context)));
|
|
62
|
+
}
|
|
63
|
+
getAssetOutputStrategy(context, assetRequest, asset) {
|
|
64
|
+
return this.assetOutputStrategyDecorators.reduce((value, decorator) => {
|
|
65
|
+
return decorator({
|
|
66
|
+
context,
|
|
67
|
+
assetRequest,
|
|
68
|
+
asset,
|
|
69
|
+
assetOutputStrategy: value
|
|
70
|
+
});
|
|
71
|
+
}, new NullAssetOutputStrategy());
|
|
72
|
+
}
|
|
73
|
+
getAssetTransformationStrategy(context) {
|
|
74
|
+
return this.assetTransformationStrategyDecorators.reduce((value, decorator) => decorator({
|
|
75
|
+
context,
|
|
76
|
+
assetTransformationStrategy: value
|
|
77
|
+
}), new PassthroughAssetTransformationStrategy());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export class AssetDeliveryConfigModifierPlugin extends Plugin {
|
|
81
|
+
static type = "fm.config-modifier";
|
|
82
|
+
constructor(cb) {
|
|
83
|
+
super();
|
|
84
|
+
this.cb = cb;
|
|
85
|
+
}
|
|
86
|
+
async buildConfig(configBuilder) {
|
|
87
|
+
await this.cb(configBuilder);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export const createAssetDeliveryConfig = cb => {
|
|
91
|
+
return new AssetDeliveryConfigModifierPlugin(cb);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=AssetDeliveryConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Plugin","SetResponseHeaders","NullRequestResolver","NullAssetResolver","NullAssetOutputStrategy","TransformationAssetProcessor","PassthroughAssetTransformationStrategy","AssetDeliveryConfigBuilder","assetRequestResolverDecorators","assetResolverDecorators","assetProcessorDecorators","assetTransformationStrategyDecorators","assetOutputStrategyDecorators","setResponseHeaders","setter","decorateAssetOutputStrategy","params","decorateAssetRequestResolver","decorator","push","decorateAssetResolver","decorateAssetProcessor","decorateAssetTransformationStrategy","getAssetRequestResolver","reduce","value","assetRequestResolver","getAssetResolver","container","assetResolver","getAssetProcessor","context","assetProcessor","getAssetTransformationStrategy","getAssetOutputStrategy","assetRequest","asset","assetOutputStrategy","assetTransformationStrategy","AssetDeliveryConfigModifierPlugin","type","constructor","cb","buildConfig","configBuilder","createAssetDeliveryConfig"],"sources":["AssetDeliveryConfig.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type {\n AssetRequestResolver,\n AssetResolver,\n AssetProcessor,\n AssetOutputStrategy,\n AssetRequest,\n Asset,\n AssetTransformationStrategy,\n ResponseHeadersSetter\n} from \"~/delivery/index.js\";\nimport { SetResponseHeaders } from \"~/delivery/index.js\";\nimport { NullRequestResolver } from \"~/delivery/AssetDelivery/NullRequestResolver.js\";\nimport { NullAssetResolver } from \"~/delivery/AssetDelivery/NullAssetResolver.js\";\nimport { NullAssetOutputStrategy } from \"./NullAssetOutputStrategy.js\";\nimport { TransformationAssetProcessor } from \"./transformation/TransformationAssetProcessor.js\";\nimport { PassthroughAssetTransformationStrategy } from \"./transformation/PassthroughAssetTransformationStrategy.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { Container } from \"@webiny/di\";\n\ntype Setter<TParams, TReturn> = (params: TParams) => TReturn;\n\nexport type AssetRequestResolverDecorator = Setter<\n { assetRequestResolver: AssetRequestResolver },\n AssetRequestResolver\n>;\n\nexport type AssetResolverDecorator = Setter<\n { assetResolver: AssetResolver; container: Container },\n AssetResolver\n>;\n\nexport type AssetProcessorDecorator = Setter<\n { context: ApiCoreContext; assetProcessor: AssetProcessor },\n AssetProcessor\n>;\n\nexport type AssetTransformationDecorator = Setter<\n { context: ApiCoreContext; assetTransformationStrategy: AssetTransformationStrategy },\n AssetTransformationStrategy\n>;\n\nexport interface AssetOutputStrategyDecoratorParams {\n context: ApiCoreContext;\n assetRequest: AssetRequest;\n asset: Asset;\n assetOutputStrategy: AssetOutputStrategy;\n}\n\nexport type AssetOutputStrategyDecorator = Setter<\n AssetOutputStrategyDecoratorParams,\n AssetOutputStrategy\n>;\n\nexport class AssetDeliveryConfigBuilder {\n private assetRequestResolverDecorators: AssetRequestResolverDecorator[] = [];\n private assetResolverDecorators: AssetResolverDecorator[] = [];\n private assetProcessorDecorators: AssetProcessorDecorator[] = [];\n private assetTransformationStrategyDecorators: AssetTransformationDecorator[] = [];\n private assetOutputStrategyDecorators: AssetOutputStrategyDecorator[] = [];\n\n setResponseHeaders(setter: ResponseHeadersSetter) {\n this.decorateAssetOutputStrategy(params => {\n return new SetResponseHeaders(setter, params);\n });\n }\n\n decorateAssetRequestResolver(decorator: AssetRequestResolverDecorator) {\n this.assetRequestResolverDecorators.push(decorator);\n }\n\n decorateAssetResolver(decorator: AssetResolverDecorator) {\n this.assetResolverDecorators.push(decorator);\n }\n\n decorateAssetProcessor(decorator: AssetProcessorDecorator) {\n this.assetProcessorDecorators.push(decorator);\n }\n\n decorateAssetTransformationStrategy(decorator: AssetTransformationDecorator) {\n this.assetTransformationStrategyDecorators.push(decorator);\n }\n\n decorateAssetOutputStrategy(decorator: AssetOutputStrategyDecorator) {\n this.assetOutputStrategyDecorators.push(decorator);\n }\n\n /**\n * @internal\n */\n getAssetRequestResolver() {\n return this.assetRequestResolverDecorators.reduce<AssetRequestResolver>(\n (value, decorator) => decorator({ assetRequestResolver: value }),\n new NullRequestResolver()\n );\n }\n\n /**\n * @internal\n */\n getAssetResolver(container: Container) {\n return this.assetResolverDecorators.reduce<AssetResolver>(\n (value, decorator) => decorator({ container, assetResolver: value }),\n new NullAssetResolver()\n );\n }\n\n /**\n * @internal\n */\n getAssetProcessor(context: ApiCoreContext) {\n return this.assetProcessorDecorators.reduce<AssetProcessor>(\n (value, decorator) => decorator({ assetProcessor: value, context }),\n new TransformationAssetProcessor(this.getAssetTransformationStrategy(context))\n );\n }\n\n getAssetOutputStrategy(context: ApiCoreContext, assetRequest: AssetRequest, asset: Asset) {\n return this.assetOutputStrategyDecorators.reduce<AssetOutputStrategy>(\n (value, decorator) => {\n return decorator({ context, assetRequest, asset, assetOutputStrategy: value });\n },\n new NullAssetOutputStrategy()\n );\n }\n\n getAssetTransformationStrategy(context: ApiCoreContext) {\n return this.assetTransformationStrategyDecorators.reduce<AssetTransformationStrategy>(\n (value, decorator) => decorator({ context, assetTransformationStrategy: value }),\n new PassthroughAssetTransformationStrategy()\n );\n }\n}\n\nexport interface AssetDeliveryConfigModifier {\n (config: AssetDeliveryConfigBuilder): Promise<void> | void;\n}\n\nexport class AssetDeliveryConfigModifierPlugin extends Plugin {\n public static override type = \"fm.config-modifier\";\n private readonly cb: AssetDeliveryConfigModifier;\n\n constructor(cb: AssetDeliveryConfigModifier) {\n super();\n this.cb = cb;\n }\n\n async buildConfig(configBuilder: AssetDeliveryConfigBuilder): Promise<void> {\n await this.cb(configBuilder);\n }\n}\n\nexport const createAssetDeliveryConfig = (cb: AssetDeliveryConfigModifier) => {\n return new AssetDeliveryConfigModifierPlugin(cb);\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,iBAAiB;AAWxC,SAASC,kBAAkB;AAC3B,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAC1B,SAASC,uBAAuB;AAChC,SAASC,4BAA4B;AACrC,SAASC,sCAAsC;AAsC/C,OAAO,MAAMC,0BAA0B,CAAC;EAC5BC,8BAA8B,GAAoC,EAAE;EACpEC,uBAAuB,GAA6B,EAAE;EACtDC,wBAAwB,GAA8B,EAAE;EACxDC,qCAAqC,GAAmC,EAAE;EAC1EC,6BAA6B,GAAmC,EAAE;EAE1EC,kBAAkBA,CAACC,MAA6B,EAAE;IAC9C,IAAI,CAACC,2BAA2B,CAACC,MAAM,IAAI;MACvC,OAAO,IAAIf,kBAAkB,CAACa,MAAM,EAAEE,MAAM,CAAC;IACjD,CAAC,CAAC;EACN;EAEAC,4BAA4BA,CAACC,SAAwC,EAAE;IACnE,IAAI,CAACV,8BAA8B,CAACW,IAAI,CAACD,SAAS,CAAC;EACvD;EAEAE,qBAAqBA,CAACF,SAAiC,EAAE;IACrD,IAAI,CAACT,uBAAuB,CAACU,IAAI,CAACD,SAAS,CAAC;EAChD;EAEAG,sBAAsBA,CAACH,SAAkC,EAAE;IACvD,IAAI,CAACR,wBAAwB,CAACS,IAAI,CAACD,SAAS,CAAC;EACjD;EAEAI,mCAAmCA,CAACJ,SAAuC,EAAE;IACzE,IAAI,CAACP,qCAAqC,CAACQ,IAAI,CAACD,SAAS,CAAC;EAC9D;EAEAH,2BAA2BA,CAACG,SAAuC,EAAE;IACjE,IAAI,CAACN,6BAA6B,CAACO,IAAI,CAACD,SAAS,CAAC;EACtD;;EAEA;AACJ;AACA;EACIK,uBAAuBA,CAAA,EAAG;IACtB,OAAO,IAAI,CAACf,8BAA8B,CAACgB,MAAM,CAC7C,CAACC,KAAK,EAAEP,SAAS,KAAKA,SAAS,CAAC;MAAEQ,oBAAoB,EAAED;IAAM,CAAC,CAAC,EAChE,IAAIvB,mBAAmB,CAAC,CAC5B,CAAC;EACL;;EAEA;AACJ;AACA;EACIyB,gBAAgBA,CAACC,SAAoB,EAAE;IACnC,OAAO,IAAI,CAACnB,uBAAuB,CAACe,MAAM,CACtC,CAACC,KAAK,EAAEP,SAAS,KAAKA,SAAS,CAAC;MAAEU,SAAS;MAAEC,aAAa,EAAEJ;IAAM,CAAC,CAAC,EACpE,IAAItB,iBAAiB,CAAC,CAC1B,CAAC;EACL;;EAEA;AACJ;AACA;EACI2B,iBAAiBA,CAACC,OAAuB,EAAE;IACvC,OAAO,IAAI,CAACrB,wBAAwB,CAACc,MAAM,CACvC,CAACC,KAAK,EAAEP,SAAS,KAAKA,SAAS,CAAC;MAAEc,cAAc,EAAEP,KAAK;MAAEM;IAAQ,CAAC,CAAC,EACnE,IAAI1B,4BAA4B,CAAC,IAAI,CAAC4B,8BAA8B,CAACF,OAAO,CAAC,CACjF,CAAC;EACL;EAEAG,sBAAsBA,CAACH,OAAuB,EAAEI,YAA0B,EAAEC,KAAY,EAAE;IACtF,OAAO,IAAI,CAACxB,6BAA6B,CAACY,MAAM,CAC5C,CAACC,KAAK,EAAEP,SAAS,KAAK;MAClB,OAAOA,SAAS,CAAC;QAAEa,OAAO;QAAEI,YAAY;QAAEC,KAAK;QAAEC,mBAAmB,EAAEZ;MAAM,CAAC,CAAC;IAClF,CAAC,EACD,IAAIrB,uBAAuB,CAAC,CAChC,CAAC;EACL;EAEA6B,8BAA8BA,CAACF,OAAuB,EAAE;IACpD,OAAO,IAAI,CAACpB,qCAAqC,CAACa,MAAM,CACpD,CAACC,KAAK,EAAEP,SAAS,KAAKA,SAAS,CAAC;MAAEa,OAAO;MAAEO,2BAA2B,EAAEb;IAAM,CAAC,CAAC,EAChF,IAAInB,sCAAsC,CAAC,CAC/C,CAAC;EACL;AACJ;AAMA,OAAO,MAAMiC,iCAAiC,SAASvC,MAAM,CAAC;EAC1D,OAAuBwC,IAAI,GAAG,oBAAoB;EAGlDC,WAAWA,CAACC,EAA+B,EAAE;IACzC,KAAK,CAAC,CAAC;IACP,IAAI,CAACA,EAAE,GAAGA,EAAE;EAChB;EAEA,MAAMC,WAAWA,CAACC,aAAyC,EAAiB;IACxE,MAAM,IAAI,CAACF,EAAE,CAACE,aAAa,CAAC;EAChC;AACJ;AAEA,OAAO,MAAMC,yBAAyB,GAAIH,EAA+B,IAAK;EAC1E,OAAO,IAAIH,iCAAiC,CAACG,EAAE,CAAC;AACpD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GenericRecord } from "@webiny/api/types.js";
|
|
2
|
+
export interface AssetRequestOptions {
|
|
3
|
+
original?: boolean;
|
|
4
|
+
width?: number;
|
|
5
|
+
}
|
|
6
|
+
export type AssetRequestContext<T extends GenericRecord = GenericRecord> = T & {
|
|
7
|
+
/**
|
|
8
|
+
* Asset request URL.
|
|
9
|
+
*/
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
export interface AssetRequestData<TOptions> {
|
|
13
|
+
key: string;
|
|
14
|
+
context: AssetRequestContext;
|
|
15
|
+
options: TOptions;
|
|
16
|
+
}
|
|
17
|
+
export declare class AssetRequest<TOptions extends AssetRequestOptions = AssetRequestOptions> {
|
|
18
|
+
private data;
|
|
19
|
+
constructor(data: AssetRequestData<TOptions>);
|
|
20
|
+
getKey(): string;
|
|
21
|
+
getOptions(): TOptions;
|
|
22
|
+
setOptions(options: TOptions): void;
|
|
23
|
+
getContext<T extends GenericRecord = GenericRecord>(): AssetRequestContext<T>;
|
|
24
|
+
getExtension(): string | undefined;
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class AssetRequest {
|
|
2
|
+
constructor(data) {
|
|
3
|
+
this.data = data;
|
|
4
|
+
}
|
|
5
|
+
getKey() {
|
|
6
|
+
return this.data.key;
|
|
7
|
+
}
|
|
8
|
+
getOptions() {
|
|
9
|
+
return this.data.options;
|
|
10
|
+
}
|
|
11
|
+
setOptions(options) {
|
|
12
|
+
this.data.options = options;
|
|
13
|
+
}
|
|
14
|
+
getContext() {
|
|
15
|
+
return this.data.context;
|
|
16
|
+
}
|
|
17
|
+
getExtension() {
|
|
18
|
+
return this.data.key.split(".").pop();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=AssetRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AssetRequest","constructor","data","getKey","key","getOptions","options","setOptions","getContext","context","getExtension","split","pop"],"sources":["AssetRequest.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types.js\";\n\nexport interface AssetRequestOptions {\n original?: boolean;\n width?: number;\n}\n\nexport type AssetRequestContext<T extends GenericRecord = GenericRecord> = T & {\n /**\n * Asset request URL.\n */\n url: string;\n};\n\nexport interface AssetRequestData<TOptions> {\n key: string;\n context: AssetRequestContext;\n options: TOptions;\n}\n\nexport class AssetRequest<TOptions extends AssetRequestOptions = AssetRequestOptions> {\n private data: AssetRequestData<TOptions>;\n\n constructor(data: AssetRequestData<TOptions>) {\n this.data = data;\n }\n\n getKey() {\n return this.data.key;\n }\n\n getOptions(): TOptions {\n return this.data.options;\n }\n\n setOptions(options: TOptions) {\n this.data.options = options;\n }\n\n getContext<T extends GenericRecord = GenericRecord>() {\n return this.data.context as AssetRequestContext<T>;\n }\n\n getExtension() {\n return this.data.key.split(\".\").pop();\n }\n}\n"],"mappings":"AAoBA,OAAO,MAAMA,YAAY,CAA6D;EAGlFC,WAAWA,CAACC,IAAgC,EAAE;IAC1C,IAAI,CAACA,IAAI,GAAGA,IAAI;EACpB;EAEAC,MAAMA,CAAA,EAAG;IACL,OAAO,IAAI,CAACD,IAAI,CAACE,GAAG;EACxB;EAEAC,UAAUA,CAAA,EAAa;IACnB,OAAO,IAAI,CAACH,IAAI,CAACI,OAAO;EAC5B;EAEAC,UAAUA,CAACD,OAAiB,EAAE;IAC1B,IAAI,CAACJ,IAAI,CAACI,OAAO,GAAGA,OAAO;EAC/B;EAEAE,UAAUA,CAAA,EAA4C;IAClD,OAAO,IAAI,CAACN,IAAI,CAACO,OAAO;EAC5B;EAEAC,YAAYA,CAAA,EAAG;IACX,OAAO,IAAI,CAACR,IAAI,CAACE,GAAG,CAACO,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC;EACzC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Request } from "@webiny/handler/types.js";
|
|
2
|
+
import type { AssetRequestResolver } from "./abstractions/AssetRequestResolver.js";
|
|
3
|
+
import { AssetRequest } from "./AssetRequest.js";
|
|
4
|
+
export declare class FilesAssetRequestResolver implements AssetRequestResolver {
|
|
5
|
+
resolve(request: Request): Promise<AssetRequest | undefined>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AssetRequest } from "./AssetRequest.js";
|
|
2
|
+
export class FilesAssetRequestResolver {
|
|
3
|
+
async resolve(request) {
|
|
4
|
+
// Example: /files/65722cb5c7824a0008d05963/image-48.jpg?width=300
|
|
5
|
+
if (!request.url.startsWith("/files/")) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const params = request.params ?? {};
|
|
9
|
+
const query = request.query ?? {};
|
|
10
|
+
|
|
11
|
+
// Example: { '*': '/files/65722cb5c7824a0008d05963/image-48.jpg' },
|
|
12
|
+
const path = params["*"];
|
|
13
|
+
const options = {
|
|
14
|
+
...query,
|
|
15
|
+
original: "original" in query
|
|
16
|
+
};
|
|
17
|
+
if (query.width) {
|
|
18
|
+
options.width = parseInt(query.width);
|
|
19
|
+
}
|
|
20
|
+
return new AssetRequest({
|
|
21
|
+
key: decodeURI(path).replace("/files/", ""),
|
|
22
|
+
context: {
|
|
23
|
+
url: request.url
|
|
24
|
+
},
|
|
25
|
+
options
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=FilesAssetRequestResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AssetRequest","FilesAssetRequestResolver","resolve","request","url","startsWith","undefined","params","query","path","options","original","width","parseInt","key","decodeURI","replace","context"],"sources":["FilesAssetRequestResolver.ts"],"sourcesContent":["import type { Request } from \"@webiny/handler/types.js\";\nimport type { AssetRequestResolver } from \"./abstractions/AssetRequestResolver.js\";\nimport type { AssetRequestOptions } from \"./AssetRequest.js\";\nimport { AssetRequest } from \"./AssetRequest.js\";\n\nexport class FilesAssetRequestResolver implements AssetRequestResolver {\n async resolve(request: Request): Promise<AssetRequest | undefined> {\n // Example: /files/65722cb5c7824a0008d05963/image-48.jpg?width=300\n if (!request.url.startsWith(\"/files/\")) {\n return undefined;\n }\n\n const params = (request.params as Record<string, any>) ?? {};\n const query = (request.query as Record<string, any>) ?? {};\n\n // Example: { '*': '/files/65722cb5c7824a0008d05963/image-48.jpg' },\n const path = params[\"*\"];\n\n const options: AssetRequestOptions = {\n ...query,\n original: \"original\" in query\n };\n\n if (query.width) {\n options.width = parseInt(query.width);\n }\n\n return new AssetRequest({\n key: decodeURI(path).replace(\"/files/\", \"\"),\n context: {\n url: request.url\n },\n options\n });\n }\n}\n"],"mappings":"AAGA,SAASA,YAAY;AAErB,OAAO,MAAMC,yBAAyB,CAAiC;EACnE,MAAMC,OAAOA,CAACC,OAAgB,EAAqC;IAC/D;IACA,IAAI,CAACA,OAAO,CAACC,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;MACpC,OAAOC,SAAS;IACpB;IAEA,MAAMC,MAAM,GAAIJ,OAAO,CAACI,MAAM,IAA4B,CAAC,CAAC;IAC5D,MAAMC,KAAK,GAAIL,OAAO,CAACK,KAAK,IAA4B,CAAC,CAAC;;IAE1D;IACA,MAAMC,IAAI,GAAGF,MAAM,CAAC,GAAG,CAAC;IAExB,MAAMG,OAA4B,GAAG;MACjC,GAAGF,KAAK;MACRG,QAAQ,EAAE,UAAU,IAAIH;IAC5B,CAAC;IAED,IAAIA,KAAK,CAACI,KAAK,EAAE;MACbF,OAAO,CAACE,KAAK,GAAGC,QAAQ,CAACL,KAAK,CAACI,KAAK,CAAC;IACzC;IAEA,OAAO,IAAIZ,YAAY,CAAC;MACpBc,GAAG,EAAEC,SAAS,CAACN,IAAI,CAAC,CAACO,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;MAC3CC,OAAO,EAAE;QACLb,GAAG,EAAED,OAAO,CAACC;MACjB,CAAC;MACDM;IACJ,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NullAssetReply","NullAssetOutputStrategy","output"],"sources":["NullAssetOutputStrategy.ts"],"sourcesContent":["import type { AssetOutputStrategy, AssetReply } from \"~/delivery/index.js\";\nimport { NullAssetReply } from \"./NullAssetReply.js\";\n\nexport class NullAssetOutputStrategy implements AssetOutputStrategy {\n async output(): Promise<AssetReply> {\n return new NullAssetReply();\n }\n}\n"],"mappings":"AACA,SAASA,cAAc;AAEvB,OAAO,MAAMC,uBAAuB,CAAgC;EAChE,MAAMC,MAAMA,CAAA,EAAwB;IAChC,OAAO,IAAIF,cAAc,CAAC,CAAC;EAC/B;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AssetReply } from "./abstractions/AssetReply.js";
|
|
2
|
+
export class NullAssetReply extends AssetReply {
|
|
3
|
+
constructor() {
|
|
4
|
+
super({
|
|
5
|
+
code: 404,
|
|
6
|
+
body: () => ({
|
|
7
|
+
error: "Asset output strategy is not implemented!"
|
|
8
|
+
})
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=NullAssetReply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AssetReply","NullAssetReply","constructor","code","body","error"],"sources":["NullAssetReply.ts"],"sourcesContent":["import { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\n\nexport class NullAssetReply extends AssetReply {\n constructor() {\n super({\n code: 404,\n body: () => ({ error: \"Asset output strategy is not implemented!\" })\n });\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU;AAEnB,OAAO,MAAMC,cAAc,SAASD,UAAU,CAAC;EAC3CE,WAAWA,CAAA,EAAG;IACV,KAAK,CAAC;MACFC,IAAI,EAAE,GAAG;MACTC,IAAI,EAAEA,CAAA,MAAO;QAAEC,KAAK,EAAE;MAA4C,CAAC;IACvE,CAAC,CAAC;EACN;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NullAssetResolver","resolve","Promise","undefined"],"sources":["NullAssetResolver.ts"],"sourcesContent":["import type { AssetResolver } from \"./abstractions/AssetResolver.js\";\nimport type { Asset } from \"./Asset.js\";\n\nexport class NullAssetResolver implements AssetResolver {\n resolve(): Promise<Asset | undefined> {\n return Promise.resolve(undefined);\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,iBAAiB,CAA0B;EACpDC,OAAOA,CAAA,EAA+B;IAClC,OAAOC,OAAO,CAACD,OAAO,CAACE,SAAS,CAAC;EACrC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NullRequestResolver","resolve","Promise","undefined"],"sources":["NullRequestResolver.ts"],"sourcesContent":["import type { AssetRequest, AssetRequestResolver } from \"~/delivery/index.js\";\n\nexport class NullRequestResolver implements AssetRequestResolver {\n resolve(): Promise<AssetRequest | undefined> {\n return Promise.resolve(undefined);\n }\n}\n"],"mappings":"AAEA,OAAO,MAAMA,mBAAmB,CAAiC;EAC7DC,OAAOA,CAAA,EAAsC;IACzC,OAAOC,OAAO,CAACD,OAAO,CAACE,SAAS,CAAC;EACrC;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ResponseHeaders } from "@webiny/handler";
|
|
2
|
+
import type { Asset, AssetOutputStrategy, AssetReply } from "../../delivery/index.js";
|
|
3
|
+
export declare class SetCacheControlHeaders implements AssetOutputStrategy {
|
|
4
|
+
private readonly strategy;
|
|
5
|
+
private readonly headers;
|
|
6
|
+
constructor(headers: ResponseHeaders, strategy: AssetOutputStrategy | undefined);
|
|
7
|
+
output(asset: Asset): Promise<AssetReply>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class SetCacheControlHeaders {
|
|
2
|
+
constructor(headers, strategy) {
|
|
3
|
+
this.headers = headers;
|
|
4
|
+
this.strategy = strategy;
|
|
5
|
+
}
|
|
6
|
+
async output(asset) {
|
|
7
|
+
if (!this.strategy) {
|
|
8
|
+
throw Error(`No asset output strategy is configured!`);
|
|
9
|
+
}
|
|
10
|
+
const reply = await this.strategy.output(asset);
|
|
11
|
+
reply.setHeaders(headers => {
|
|
12
|
+
return headers.merge(this.headers);
|
|
13
|
+
});
|
|
14
|
+
return reply;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=SetCacheControlHeaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SetCacheControlHeaders","constructor","headers","strategy","output","asset","Error","reply","setHeaders","merge"],"sources":["SetCacheControlHeaders.ts"],"sourcesContent":["import type { ResponseHeaders } from \"@webiny/handler\";\nimport type { Asset, AssetOutputStrategy, AssetReply } from \"~/delivery/index.js\";\n\nexport class SetCacheControlHeaders implements AssetOutputStrategy {\n private readonly strategy: AssetOutputStrategy | undefined;\n private readonly headers: ResponseHeaders;\n\n constructor(headers: ResponseHeaders, strategy: AssetOutputStrategy | undefined) {\n this.headers = headers;\n this.strategy = strategy;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n if (!this.strategy) {\n throw Error(`No asset output strategy is configured!`);\n }\n\n const reply = await this.strategy.output(asset);\n\n reply.setHeaders(headers => {\n return headers.merge(this.headers);\n });\n\n return reply;\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,sBAAsB,CAAgC;EAI/DC,WAAWA,CAACC,OAAwB,EAAEC,QAAyC,EAAE;IAC7E,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAMC,MAAMA,CAACC,KAAY,EAAuB;IAC5C,IAAI,CAAC,IAAI,CAACF,QAAQ,EAAE;MAChB,MAAMG,KAAK,CAAC,yCAAyC,CAAC;IAC1D;IAEA,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACJ,QAAQ,CAACC,MAAM,CAACC,KAAK,CAAC;IAE/CE,KAAK,CAACC,UAAU,CAACN,OAAO,IAAI;MACxB,OAAOA,OAAO,CAACO,KAAK,CAAC,IAAI,CAACP,OAAO,CAAC;IACtC,CAAC,CAAC;IAEF,OAAOK,KAAK;EAChB;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AssetOutputStrategy, Asset, AssetReply, AssetRequest, AssetOutputStrategyDecoratorParams } from "../../delivery/index.js";
|
|
2
|
+
import type { ResponseHeaders } from "@webiny/handler";
|
|
3
|
+
import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
|
|
4
|
+
export interface ResponseHeadersParams {
|
|
5
|
+
headers: ResponseHeaders;
|
|
6
|
+
context: ApiCoreContext;
|
|
7
|
+
assetRequest: AssetRequest;
|
|
8
|
+
asset: Asset;
|
|
9
|
+
}
|
|
10
|
+
export interface ResponseHeadersSetter {
|
|
11
|
+
(params: ResponseHeadersParams): Promise<void> | void;
|
|
12
|
+
}
|
|
13
|
+
export declare class SetResponseHeaders implements AssetOutputStrategy {
|
|
14
|
+
private readonly setter;
|
|
15
|
+
private strategyDecoratorParams;
|
|
16
|
+
constructor(setter: ResponseHeadersSetter, strategyDecoratorParams: AssetOutputStrategyDecoratorParams);
|
|
17
|
+
output(asset: Asset): Promise<AssetReply>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class SetResponseHeaders {
|
|
2
|
+
constructor(setter, strategyDecoratorParams) {
|
|
3
|
+
this.strategyDecoratorParams = strategyDecoratorParams;
|
|
4
|
+
this.setter = setter;
|
|
5
|
+
}
|
|
6
|
+
async output(asset) {
|
|
7
|
+
const reply = await this.strategyDecoratorParams.assetOutputStrategy.output(asset);
|
|
8
|
+
await this.setter({
|
|
9
|
+
asset: this.strategyDecoratorParams.asset,
|
|
10
|
+
assetRequest: this.strategyDecoratorParams.assetRequest,
|
|
11
|
+
context: this.strategyDecoratorParams.context,
|
|
12
|
+
headers: reply.getHeaders()
|
|
13
|
+
});
|
|
14
|
+
return reply;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=SetResponseHeaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SetResponseHeaders","constructor","setter","strategyDecoratorParams","output","asset","reply","assetOutputStrategy","assetRequest","context","headers","getHeaders"],"sources":["SetResponseHeaders.ts"],"sourcesContent":["import type {\n AssetOutputStrategy,\n Asset,\n AssetReply,\n AssetRequest,\n AssetOutputStrategyDecoratorParams\n} from \"~/delivery/index.js\";\nimport type { ResponseHeaders } from \"@webiny/handler\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\n\nexport interface ResponseHeadersParams {\n headers: ResponseHeaders;\n context: ApiCoreContext;\n assetRequest: AssetRequest;\n asset: Asset;\n}\n\nexport interface ResponseHeadersSetter {\n (params: ResponseHeadersParams): Promise<void> | void;\n}\n\nexport class SetResponseHeaders implements AssetOutputStrategy {\n private readonly setter: ResponseHeadersSetter;\n private strategyDecoratorParams: AssetOutputStrategyDecoratorParams;\n\n constructor(\n setter: ResponseHeadersSetter,\n strategyDecoratorParams: AssetOutputStrategyDecoratorParams\n ) {\n this.strategyDecoratorParams = strategyDecoratorParams;\n this.setter = setter;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const reply = await this.strategyDecoratorParams.assetOutputStrategy.output(asset);\n\n await this.setter({\n asset: this.strategyDecoratorParams.asset,\n assetRequest: this.strategyDecoratorParams.assetRequest,\n context: this.strategyDecoratorParams.context,\n headers: reply.getHeaders()\n });\n\n return reply;\n }\n}\n"],"mappings":"AAqBA,OAAO,MAAMA,kBAAkB,CAAgC;EAI3DC,WAAWA,CACPC,MAA6B,EAC7BC,uBAA2D,EAC7D;IACE,IAAI,CAACA,uBAAuB,GAAGA,uBAAuB;IACtD,IAAI,CAACD,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAME,MAAMA,CAACC,KAAY,EAAuB;IAC5C,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACH,uBAAuB,CAACI,mBAAmB,CAACH,MAAM,CAACC,KAAK,CAAC;IAElF,MAAM,IAAI,CAACH,MAAM,CAAC;MACdG,KAAK,EAAE,IAAI,CAACF,uBAAuB,CAACE,KAAK;MACzCG,YAAY,EAAE,IAAI,CAACL,uBAAuB,CAACK,YAAY;MACvDC,OAAO,EAAE,IAAI,CAACN,uBAAuB,CAACM,OAAO;MAC7CC,OAAO,EAAEJ,KAAK,CAACK,UAAU,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAOL,KAAK;EAChB;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetContentsReader.ts"],"sourcesContent":["import type { Asset } from \"~/delivery/index.js\";\n\nexport interface AssetContentsReader {\n read(asset: Asset): Promise<Buffer>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetOutputStrategy.ts"],"sourcesContent":["import type { Asset, AssetReply } from \"~/delivery/index.js\";\n\nexport interface AssetOutputStrategy {\n output(asset: Asset): Promise<AssetReply>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetProcessor.ts"],"sourcesContent":["import type { Asset, AssetRequest } from \"~/delivery/index.js\";\n\nexport interface AssetProcessor {\n process(assetRequest: AssetRequest, asset: Asset): Promise<Asset>;\n}\n"],"mappings":"","ignoreList":[]}
|