@webiny/api-file-manager 0.0.0-unstable.6f45466a1d → 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/contants.js +2 -1
- package/contants.js.map +1 -1
- package/delivery/AssetDelivery/Asset.js +50 -56
- package/delivery/AssetDelivery/Asset.js.map +1 -1
- package/delivery/AssetDelivery/AssetRequest.js +20 -19
- package/delivery/AssetDelivery/AssetRequest.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetReply.js +28 -27
- package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -1
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +4 -5
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -1
- package/delivery/index.d.ts +3 -12
- package/delivery/index.js +2 -8
- package/delivery/setupAssetDelivery.d.ts +1 -2
- package/delivery/setupAssetDelivery.js +60 -105
- package/delivery/setupAssetDelivery.js.map +1 -1
- package/domain/file/abstractions.js +2 -5
- package/domain/file/abstractions.js.map +1 -1
- package/domain/file/errors.js +67 -76
- package/domain/file/errors.js.map +1 -1
- package/domain/file/file.model.js +57 -45
- package/domain/file/file.model.js.map +1 -1
- package/domain/file/types.d.ts +2 -0
- package/domain/file/types.js +0 -3
- package/domain/identity/Identity.js +9 -8
- package/domain/identity/Identity.js.map +1 -1
- package/domain/permissionsSchema.d.ts +16 -0
- package/domain/permissionsSchema.js +30 -0
- package/domain/permissionsSchema.js.map +1 -0
- package/domain/settings/constants.js +2 -1
- package/domain/settings/constants.js.map +1 -1
- package/domain/settings/errors.js +22 -24
- package/domain/settings/errors.js.map +1 -1
- package/domain/settings/types.js +0 -3
- package/domain/settings/validation.d.ts +4 -12
- package/domain/settings/validation.js +18 -27
- package/domain/settings/validation.js.map +1 -1
- 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 -1
- package/features/FileManagerFeature.js +17 -14
- package/features/FileManagerFeature.js.map +1 -1
- 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.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.js +20 -18
- package/features/file/CreateFile/CreateFileRepository.js.map +1 -1
- package/features/file/CreateFile/CreateFileUseCase.d.ts +4 -4
- package/features/file/CreateFile/CreateFileUseCase.js +70 -78
- package/features/file/CreateFile/CreateFileUseCase.js.map +1 -1
- package/features/file/CreateFile/abstractions.d.ts +3 -0
- package/features/file/CreateFile/abstractions.js +3 -12
- package/features/file/CreateFile/abstractions.js.map +1 -1
- package/features/file/CreateFile/events.d.ts +8 -6
- package/features/file/CreateFile/events.js +18 -23
- package/features/file/CreateFile/events.js.map +1 -1
- package/features/file/CreateFile/feature.d.ts +4 -1
- package/features/file/CreateFile/feature.js +7 -6
- package/features/file/CreateFile/feature.js.map +1 -1
- package/features/file/CreateFile/index.d.ts +1 -1
- package/features/file/CreateFile/index.js +1 -3
- package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js +15 -17
- package/features/file/CreateFilesInBatch/CreateFilesInBatchRepository.js.map +1 -1
- package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.d.ts +4 -4
- package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js +61 -75
- package/features/file/CreateFilesInBatch/CreateFilesInBatchUseCase.js.map +1 -1
- package/features/file/CreateFilesInBatch/abstractions.d.ts +2 -0
- package/features/file/CreateFilesInBatch/abstractions.js +3 -12
- package/features/file/CreateFilesInBatch/abstractions.js.map +1 -1
- package/features/file/CreateFilesInBatch/events.d.ts +8 -6
- package/features/file/CreateFilesInBatch/events.js +18 -23
- package/features/file/CreateFilesInBatch/events.js.map +1 -1
- package/features/file/CreateFilesInBatch/feature.d.ts +4 -1
- package/features/file/CreateFilesInBatch/feature.js +7 -6
- package/features/file/CreateFilesInBatch/feature.js.map +1 -1
- package/features/file/CreateFilesInBatch/index.js +0 -2
- package/features/file/DeleteFile/DeleteFileRepository.js +21 -20
- package/features/file/DeleteFile/DeleteFileRepository.js.map +1 -1
- package/features/file/DeleteFile/DeleteFileUseCase.d.ts +4 -4
- package/features/file/DeleteFile/DeleteFileUseCase.js +33 -38
- package/features/file/DeleteFile/DeleteFileUseCase.js.map +1 -1
- package/features/file/DeleteFile/abstractions.d.ts +2 -0
- package/features/file/DeleteFile/abstractions.js +3 -12
- package/features/file/DeleteFile/abstractions.js.map +1 -1
- package/features/file/DeleteFile/events.d.ts +8 -6
- package/features/file/DeleteFile/events.js +18 -23
- package/features/file/DeleteFile/events.js.map +1 -1
- package/features/file/DeleteFile/feature.d.ts +4 -1
- package/features/file/DeleteFile/feature.js +7 -6
- package/features/file/DeleteFile/feature.js.map +1 -1
- package/features/file/DeleteFile/index.d.ts +1 -1
- package/features/file/DeleteFile/index.js +1 -3
- package/features/file/FileUrlGenerator/abstractions.d.ts +1 -0
- package/features/file/FileUrlGenerator/abstractions.js +2 -1
- package/features/file/FileUrlGenerator/abstractions.js.map +1 -1
- package/features/file/GetFile/GetFileRepository.js +22 -22
- package/features/file/GetFile/GetFileRepository.js.map +1 -1
- package/features/file/GetFile/GetFileUseCase.d.ts +3 -3
- package/features/file/GetFile/GetFileUseCase.js +20 -30
- package/features/file/GetFile/GetFileUseCase.js.map +1 -1
- package/features/file/GetFile/abstractions.d.ts +2 -0
- package/features/file/GetFile/abstractions.js +3 -12
- package/features/file/GetFile/abstractions.js.map +1 -1
- package/features/file/GetFile/feature.d.ts +4 -1
- package/features/file/GetFile/feature.js +7 -6
- package/features/file/GetFile/feature.js.map +1 -1
- package/features/file/GetFile/index.js +0 -2
- 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 +3 -1
- package/features/file/ListFiles/ListFilesRepository.js +42 -34
- package/features/file/ListFiles/ListFilesRepository.js.map +1 -1
- package/features/file/ListFiles/ListFilesUseCase.d.ts +4 -4
- package/features/file/ListFiles/ListFilesUseCase.js +35 -39
- package/features/file/ListFiles/ListFilesUseCase.js.map +1 -1
- package/features/file/ListFiles/abstractions.d.ts +2 -0
- package/features/file/ListFiles/abstractions.js +3 -12
- package/features/file/ListFiles/abstractions.js.map +1 -1
- package/features/file/ListFiles/feature.d.ts +4 -1
- package/features/file/ListFiles/feature.js +7 -6
- package/features/file/ListFiles/feature.js.map +1 -1
- package/features/file/ListFiles/index.js +0 -2
- 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.js +31 -36
- package/features/file/ListTags/ListTagsRepository.js.map +1 -1
- package/features/file/ListTags/ListTagsUseCase.d.ts +3 -3
- package/features/file/ListTags/ListTagsUseCase.js +22 -23
- package/features/file/ListTags/ListTagsUseCase.js.map +1 -1
- package/features/file/ListTags/abstractions.d.ts +2 -0
- package/features/file/ListTags/abstractions.js +3 -12
- package/features/file/ListTags/abstractions.js.map +1 -1
- package/features/file/ListTags/feature.d.ts +4 -1
- package/features/file/ListTags/feature.js +7 -6
- package/features/file/ListTags/feature.js.map +1 -1
- package/features/file/ListTags/index.js +0 -2
- package/features/file/UpdateFile/UpdateFileRepository.js +26 -28
- package/features/file/UpdateFile/UpdateFileRepository.js.map +1 -1
- package/features/file/UpdateFile/UpdateFileUseCase.d.ts +5 -5
- package/features/file/UpdateFile/UpdateFileUseCase.js +60 -70
- package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -1
- package/features/file/UpdateFile/abstractions.d.ts +3 -0
- package/features/file/UpdateFile/abstractions.js +3 -12
- package/features/file/UpdateFile/abstractions.js.map +1 -1
- package/features/file/UpdateFile/events.d.ts +8 -6
- package/features/file/UpdateFile/events.js +18 -23
- package/features/file/UpdateFile/events.js.map +1 -1
- package/features/file/UpdateFile/feature.d.ts +4 -1
- package/features/file/UpdateFile/feature.js +7 -6
- package/features/file/UpdateFile/feature.js.map +1 -1
- package/features/file/UpdateFile/index.d.ts +1 -1
- package/features/file/UpdateFile/index.js +1 -3
- package/features/file/shared/EntryToFileMapper.js +25 -23
- package/features/file/shared/EntryToFileMapper.js.map +1 -1
- package/features/file/shared/FileInputToEntryInputMapper.js +29 -27
- package/features/file/shared/FileInputToEntryInputMapper.js.map +1 -1
- package/features/file/shared/FileToEntryMapper.js +28 -26
- package/features/file/shared/FileToEntryMapper.js.map +1 -1
- 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.js +19 -19
- package/features/settings/GetSettings/GetSettingsUseCase.js.map +1 -1
- package/features/settings/GetSettings/abstractions.d.ts +1 -0
- package/features/settings/GetSettings/abstractions.js +2 -6
- package/features/settings/GetSettings/abstractions.js.map +1 -1
- package/features/settings/GetSettings/feature.d.ts +4 -1
- package/features/settings/GetSettings/feature.js +6 -5
- package/features/settings/GetSettings/feature.js.map +1 -1
- package/features/settings/SettingsInstaller/SettingsInstaller.d.ts +1 -1
- package/features/settings/SettingsInstaller/SettingsInstaller.js +26 -25
- package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -1
- package/features/settings/SettingsInstaller/feature.d.ts +4 -1
- package/features/settings/SettingsInstaller/feature.js +6 -5
- package/features/settings/SettingsInstaller/feature.js.map +1 -1
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.d.ts +1 -1
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js +42 -49
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -1
- package/features/settings/UpdateSettings/abstractions.d.ts +1 -0
- package/features/settings/UpdateSettings/abstractions.js +2 -6
- package/features/settings/UpdateSettings/abstractions.js.map +1 -1
- package/features/settings/UpdateSettings/events.d.ts +8 -6
- package/features/settings/UpdateSettings/events.js +18 -23
- package/features/settings/UpdateSettings/events.js.map +1 -1
- package/features/settings/UpdateSettings/feature.d.ts +4 -1
- package/features/settings/UpdateSettings/feature.js +6 -5
- package/features/settings/UpdateSettings/feature.js.map +1 -1
- package/features/settings/UpdateSettings/index.d.ts +1 -1
- package/features/settings/UpdateSettings/index.js +1 -3
- package/features/shared/abstractions.d.ts +1 -13
- package/features/shared/abstractions.js +1 -5
- package/graphql/baseSchema.js +30 -33
- package/graphql/baseSchema.js.map +1 -1
- package/graphql/createFilesTypeDefs.d.ts +3 -2
- package/graphql/createFilesTypeDefs.js +61 -66
- package/graphql/createFilesTypeDefs.js.map +1 -1
- package/graphql/filesSchema.js +79 -99
- package/graphql/filesSchema.js.map +1 -1
- package/graphql/getFileByUrl.js +45 -53
- package/graphql/getFileByUrl.js.map +1 -1
- package/graphql/index.js +37 -43
- package/graphql/index.js.map +1 -1
- package/graphql/utils.js +9 -14
- package/graphql/utils.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +31 -39
- package/index.js.map +1 -1
- package/modelModifier/CmsModelModifier.js +40 -43
- package/modelModifier/CmsModelModifier.js.map +1 -1
- package/package.json +28 -23
- package/types.d.ts +1 -3
- package/types.js +1 -3
- package/delivery/AssetDelivery/AssetDeliveryConfig.d.ts +0 -65
- package/delivery/AssetDelivery/AssetDeliveryConfig.js +0 -94
- package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +0 -1
- package/delivery/AssetDelivery/FilesAssetRequestResolver.d.ts +0 -6
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js +0 -30
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js.map +0 -1
- package/delivery/AssetDelivery/NullAssetOutputStrategy.d.ts +0 -4
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js +0 -8
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js.map +0 -1
- package/delivery/AssetDelivery/NullAssetReply.js +0 -13
- package/delivery/AssetDelivery/NullAssetReply.js.map +0 -1
- package/delivery/AssetDelivery/NullAssetResolver.d.ts +0 -5
- package/delivery/AssetDelivery/NullAssetResolver.js +0 -7
- package/delivery/AssetDelivery/NullAssetResolver.js.map +0 -1
- package/delivery/AssetDelivery/NullRequestResolver.d.ts +0 -4
- package/delivery/AssetDelivery/NullRequestResolver.js +0 -7
- package/delivery/AssetDelivery/NullRequestResolver.js.map +0 -1
- package/delivery/AssetDelivery/SetCacheControlHeaders.d.ts +0 -8
- package/delivery/AssetDelivery/SetCacheControlHeaders.js +0 -18
- package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +0 -1
- package/delivery/AssetDelivery/SetResponseHeaders.d.ts +0 -18
- package/delivery/AssetDelivery/SetResponseHeaders.js +0 -18
- package/delivery/AssetDelivery/SetResponseHeaders.js.map +0 -1
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.d.ts +0 -4
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js +0 -3
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js.map +0 -1
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.d.ts +0 -4
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js +0 -3
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js.map +0 -1
- package/delivery/AssetDelivery/abstractions/AssetProcessor.d.ts +0 -4
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js +0 -3
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js.map +0 -1
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.d.ts +0 -5
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js +0 -3
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js.map +0 -1
- package/delivery/AssetDelivery/abstractions/AssetResolver.d.ts +0 -4
- package/delivery/AssetDelivery/abstractions/AssetResolver.js +0 -3
- package/delivery/AssetDelivery/abstractions/AssetResolver.js.map +0 -1
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.d.ts +0 -4
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js +0 -3
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.d.ts +0 -4
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js +0 -3
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +0 -4
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js +0 -19
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +0 -4
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +0 -8
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +0 -8
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +0 -20
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/PrivateCache.d.ts +0 -6
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js +0 -21
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +0 -8
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +0 -30
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +0 -13
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js +0 -63
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/PublicCache.d.ts +0 -6
- package/delivery/AssetDelivery/privateFiles/PublicCache.js +0 -21
- package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +0 -7
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +0 -20
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +0 -1
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +0 -7
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +0 -20
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +0 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.d.ts +0 -4
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js +0 -7
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js.map +0 -1
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +0 -4
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js +0 -7
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +0 -1
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.d.ts +0 -6
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js +0 -19
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js.map +0 -1
- package/delivery/index.js.map +0 -1
- package/domain/file/types.js.map +0 -1
- package/domain/settings/types.js.map +0 -1
- package/features/file/CreateFile/index.js.map +0 -1
- package/features/file/CreateFilesInBatch/index.js.map +0 -1
- package/features/file/DeleteFile/index.js.map +0 -1
- package/features/file/GetFile/index.js.map +0 -1
- package/features/file/ListFiles/index.js.map +0 -1
- package/features/file/ListTags/index.js.map +0 -1
- package/features/file/UpdateFile/index.js.map +0 -1
- package/features/settings/UpdateSettings/index.js.map +0 -1
- package/features/shared/abstractions.js.map +0 -1
- package/permissions/FilesPermissions.d.ts +0 -4
- package/permissions/FilesPermissions.js +0 -4
- package/permissions/FilesPermissions.js.map +0 -1
- package/permissions/SettingsPermissions.d.ts +0 -4
- package/permissions/SettingsPermissions.js +0 -4
- package/permissions/SettingsPermissions.js.map +0 -1
- package/types.js.map +0 -1
- /package/{delivery/AssetDelivery → features/assetDelivery}/NullAssetReply.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ErrorResponse","GraphQLSchemaPlugin","ListResponse","Response","emptyResolver","resolve","createFilesTypeDefs","NotAuthorizedResponse","GetFileUseCase","ListFilesUseCase","ListTagsUseCase","CreateFileUseCase","CreateFilesInBatchUseCase","UpdateFileUseCase","DeleteFileUseCase","GetSettingsUseCase","FileModel","createFilesSchema","params","fileManagerGraphQL","typeDefs","resolvers","Query","fileManager","Mutation","FmFile","src","file","_","context","getSettings","container","result","execute","settings","value","srcPrefix","key","FmQuery","getFileModel","__","identity","security","getIdentity","getFile","args","id","isFail","error","listFiles","items","meta","listTags","FmMutation","createFile","data","createFiles","createFilesInBatch","files","updateFile","deleteFile","name"],"sources":["filesSchema.ts"],"sourcesContent":["import {\n ErrorResponse,\n GraphQLSchemaPlugin,\n ListResponse,\n Response\n} from \"@webiny/handler-graphql\";\nimport { emptyResolver, resolve } from \"./utils.js\";\nimport type { CreateFilesTypeDefsParams } from \"~/graphql/createFilesTypeDefs.js\";\nimport { createFilesTypeDefs } from \"~/graphql/createFilesTypeDefs.js\";\nimport NotAuthorizedResponse from \"@webiny/api-core/graphql/security/NotAuthorizedResponse.js\";\nimport { GetFileUseCase } from \"~/features/file/GetFile/abstractions.js\";\nimport { ListFilesUseCase } from \"~/features/file/ListFiles/abstractions.js\";\nimport { ListTagsUseCase } from \"~/features/file/ListTags/abstractions.js\";\nimport { CreateFileUseCase } from \"~/features/file/CreateFile/abstractions.js\";\nimport { CreateFilesInBatchUseCase } from \"~/features/file/CreateFilesInBatch/abstractions.js\";\nimport { UpdateFileUseCase } from \"~/features/file/UpdateFile/abstractions.js\";\nimport { DeleteFileUseCase } from \"~/features/file/DeleteFile/abstractions.js\";\nimport { GetSettingsUseCase } from \"~/features/settings/GetSettings/abstractions.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\n\nexport const createFilesSchema = (params: CreateFilesTypeDefsParams) => {\n const fileManagerGraphQL = new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: createFilesTypeDefs(params),\n resolvers: {\n Query: {\n fileManager: emptyResolver\n },\n Mutation: {\n fileManager: emptyResolver\n },\n FmFile: {\n async src(file, _, context) {\n // TODO: create `FileUrlGenerator` service to use here\n const getSettings = context.container.resolve(GetSettingsUseCase);\n const result = await getSettings.execute();\n const settings = result.value;\n return (settings?.srcPrefix || \"\") + file.key;\n }\n },\n FmQuery: {\n getFileModel(_, __, context) {\n const identity = context.security.getIdentity();\n if (!identity) {\n return new NotAuthorizedResponse();\n }\n\n return resolve(async () => {\n return context.container.resolve(FileModel);\n });\n },\n async getFile(_, args: any, context) {\n const getFile = context.container.resolve(GetFileUseCase);\n const result = await getFile.execute(args.id);\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n },\n async listFiles(_, args, context) {\n const listFiles = context.container.resolve(ListFilesUseCase);\n const result = await listFiles.execute(args);\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new ListResponse(result.value.items, result.value.meta);\n },\n async listTags(_, args: any, context) {\n const listTags = context.container.resolve(ListTagsUseCase);\n const result = await listTags.execute(args || {});\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n }\n },\n FmMutation: {\n async createFile(_, args: any, context) {\n const createFile = context.container.resolve(CreateFileUseCase);\n const result = await createFile.execute(args.data);\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n },\n async createFiles(_, args: any, context) {\n const createFilesInBatch = context.container.resolve(CreateFilesInBatchUseCase);\n const result = await createFilesInBatch.execute({\n files: args.data,\n meta: args.meta\n });\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n },\n async updateFile(_, args: any, context) {\n const updateFile = context.container.resolve(UpdateFileUseCase);\n const result = await updateFile.execute({\n id: args.id,\n ...args.data\n });\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n },\n async deleteFile(_, args: any, context) {\n const deleteFile = context.container.resolve(DeleteFileUseCase);\n const result = await deleteFile.execute(args.id);\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n // TODO: deletion from Cloud storage should be implemented in the `api-file-manager-s3` as an event handler\n return new Response(true);\n }\n }\n }\n });\n fileManagerGraphQL.name = \"fm.graphql.files\";\n\n return fileManagerGraphQL;\n};\n"],"mappings":"AAAA,SACIA,aAAa,EACbC,mBAAmB,EACnBC,YAAY,EACZC,QAAQ,QACL,yBAAyB;AAChC,SAASC,aAAa,EAAEC,OAAO;AAE/B,SAASC,mBAAmB;AAC5B,OAAOC,qBAAqB,MAAM,4DAA4D;AAC9F,SAASC,cAAc;AACvB,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,yBAAyB;AAClC,SAASC,iBAAiB;AAC1B,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAE3B,SAASC,SAAS;AAElB,OAAO,MAAMC,iBAAiB,GAAIC,MAAiC,IAAK;EACpE,MAAMC,kBAAkB,GAAG,IAAIlB,mBAAmB,CAAiB;IAC/DmB,QA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,MAAM+B,UAAU,GAAG/B,OAAO,CAACE,SAAS,CAAC1B,OAAO,CAACS,iBAAiB,CAAC;UAC/D,MAAMkB,MAAM,GAAG,MAAM4B,UAAU,CAAC3B,OAAO,CAACY,IAAI,CAACC,EAAE,CAAC;UAEhD,IAAId,MAAM,CAACe,MAAM,CAAC,CAAC,EAAE;YACjB,OAAO,IAAI/C,aAAa,CAACgC,MAAM,CAACgB,KAAK,CAAC;UAC1C;;UAEA;UACA,OAAO,IAAI7C,QAAQ,CAAC,IAAI,CAAC;QAC7B;MACJ;IACJ;EACJ,CAAC,CAAC;EACFgB,kBAAkB,CAAC0C,IAAI,GAAG,kBAAkB;EAE5C,OAAO1C,kBAAkB;AAC7B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"graphql/filesSchema.js","sources":["../../src/graphql/filesSchema.ts"],"sourcesContent":["import {\n ErrorResponse,\n GraphQLSchemaPlugin,\n ListResponse,\n Response\n} from \"@webiny/handler-graphql\";\nimport { emptyResolver, resolve } from \"./utils.js\";\nimport type { CreateFilesTypeDefsParams } from \"~/graphql/createFilesTypeDefs.js\";\nimport { createFilesTypeDefs } from \"~/graphql/createFilesTypeDefs.js\";\nimport NotAuthorizedResponse from \"@webiny/api-core/graphql/security/NotAuthorizedResponse.js\";\nimport { GetFileUseCase } from \"~/features/file/GetFile/abstractions.js\";\nimport { ListFilesUseCase } from \"~/features/file/ListFiles/abstractions.js\";\nimport { ListTagsUseCase } from \"~/features/file/ListTags/abstractions.js\";\nimport { CreateFileUseCase } from \"~/features/file/CreateFile/abstractions.js\";\nimport { CreateFilesInBatchUseCase } from \"~/features/file/CreateFilesInBatch/abstractions.js\";\nimport { UpdateFileUseCase } from \"~/features/file/UpdateFile/abstractions.js\";\nimport { DeleteFileUseCase } from \"~/features/file/DeleteFile/abstractions.js\";\nimport { GetSettingsUseCase } from \"~/features/settings/GetSettings/abstractions.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\n\nexport const createFilesSchema = (params: CreateFilesTypeDefsParams) => {\n const fileManagerGraphQL = new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: createFilesTypeDefs(params),\n resolvers: {\n Query: {\n fileManager: emptyResolver\n },\n Mutation: {\n fileManager: emptyResolver\n },\n FmFile: {\n async src(file, _, context) {\n // TODO: create `FileUrlGenerator` service to use here\n const getSettings = context.container.resolve(GetSettingsUseCase);\n const result = await getSettings.execute();\n const settings = result.value;\n return (settings?.srcPrefix || \"\") + file.key;\n }\n },\n FmQuery: {\n getFileModel(_, __, context) {\n const identity = context.security.getIdentity();\n if (!identity) {\n return new NotAuthorizedResponse();\n }\n\n return resolve(async () => {\n return context.container.resolve(FileModel);\n });\n },\n async getFile(_, args: any, context) {\n const getFile = context.container.resolve(GetFileUseCase);\n const result = await getFile.execute(args.id);\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n },\n async listFiles(_, args, context) {\n const listFiles = context.container.resolve(ListFilesUseCase);\n const result = await listFiles.execute(args);\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new ListResponse(result.value.items, result.value.meta);\n },\n async listTags(_, args: any, context) {\n const listTags = context.container.resolve(ListTagsUseCase);\n const result = await listTags.execute(args || {});\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n }\n },\n FmMutation: {\n async createFile(_, args: any, context) {\n const createFile = context.container.resolve(CreateFileUseCase);\n const result = await createFile.execute(args.data);\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n },\n async createFiles(_, args: any, context) {\n const createFilesInBatch = context.container.resolve(CreateFilesInBatchUseCase);\n const result = await createFilesInBatch.execute({\n files: args.data,\n meta: args.meta\n });\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n },\n async updateFile(_, args: any, context) {\n const updateFile = context.container.resolve(UpdateFileUseCase);\n const result = await updateFile.execute({\n id: args.id,\n ...args.data\n });\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n return new Response(result.value);\n },\n async deleteFile(_, args: any, context) {\n const deleteFile = context.container.resolve(DeleteFileUseCase);\n const result = await deleteFile.execute(args.id);\n\n if (result.isFail()) {\n return new ErrorResponse(result.error);\n }\n\n // TODO: deletion from Cloud storage should be implemented in the `api-file-manager-s3` as an event handler\n return new Response(true);\n }\n }\n }\n });\n fileManagerGraphQL.name = \"fm.graphql.files\";\n\n return fileManagerGraphQL;\n};\n"],"names":["createFilesSchema","params","fileManagerGraphQL","GraphQLSchemaPlugin","createFilesTypeDefs","emptyResolver","file","_","context","getSettings","GetSettingsUseCase","result","settings","__","identity","NotAuthorizedResponse","resolve","FileModel","args","getFile","GetFileUseCase","ErrorResponse","Response","listFiles","ListFilesUseCase","ListResponse","listTags","ListTagsUseCase","createFile","CreateFileUseCase","createFilesInBatch","CreateFilesInBatchUseCase","updateFile","UpdateFileUseCase","deleteFile","DeleteFileUseCase"],"mappings":";;;;;;;;;;;;;AAqBO,MAAMA,oBAAoB,CAACC;IAC9B,MAAMC,qBAAqB,IAAIC,oBAAoC;QAC/D,UAAUC,oBAAoBH;QAC9B,WAAW;YACP,OAAO;gBACH,aAAaI;YACjB;YACA,UAAU;gBACN,aAAaA;YACjB;YACA,QAAQ;gBACJ,MAAM,KAAIC,IAAI,EAAEC,CAAC,EAAEC,OAAO;oBAEtB,MAAMC,cAAcD,QAAQ,SAAS,CAAC,OAAO,CAACE;oBAC9C,MAAMC,SAAS,MAAMF,YAAY,OAAO;oBACxC,MAAMG,WAAWD,OAAO,KAAK;oBAC7B,OAAQC,AAAAA,CAAAA,UAAU,aAAa,EAAC,IAAKN,KAAK,GAAG;gBACjD;YACJ;YACA,SAAS;gBACL,cAAaC,CAAC,EAAEM,EAAE,EAAEL,OAAO;oBACvB,MAAMM,WAAWN,QAAQ,QAAQ,CAAC,WAAW;oBAC7C,IAAI,CAACM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AASX,OAAO,KAAK;gBACpC;gBACA,MAAM,aAAYJ,CAAC,EAAEW,IAAS,EAAEV,OAAO;oBACnC,MAAMsB,qBAAqBtB,QAAQ,SAAS,CAAC,OAAO,CAACuB;oBACrD,MAAMpB,SAAS,MAAMmB,mBAAmB,OAAO,CAAC;wBAC5C,OAAOZ,KAAK,IAAI;wBAChB,MAAMA,KAAK,IAAI;oBACnB;oBAEA,IAAIP,OAAO,MAAM,IACb,OAAO,IAAIU,cAAcV,OAAO,KAAK;oBAGzC,OAAO,IAAIW,SAASX,OAAO,KAAK;gBACpC;gBACA,MAAM,YAAWJ,CAAC,EAAEW,IAAS,EAAEV,OAAO;oBAClC,MAAMwB,aAAaxB,QAAQ,SAAS,CAAC,OAAO,CAACyB;oBAC7C,MAAMtB,SAAS,MAAMqB,WAAW,OAAO,CAAC;wBACpC,IAAId,KAAK,EAAE;wBACX,GAAGA,KAAK,IAAI;oBAChB;oBAEA,IAAIP,OAAO,MAAM,IACb,OAAO,IAAIU,cAAcV,OAAO,KAAK;oBAGzC,OAAO,IAAIW,SAASX,OAAO,KAAK;gBACpC;gBACA,MAAM,YAAWJ,CAAC,EAAEW,IAAS,EAAEV,OAAO;oBAClC,MAAM0B,aAAa1B,QAAQ,SAAS,CAAC,OAAO,CAAC2B;oBAC7C,MAAMxB,SAAS,MAAMuB,WAAW,OAAO,CAAChB,KAAK,EAAE;oBAE/C,IAAIP,OAAO,MAAM,IACb,OAAO,IAAIU,cAAcV,OAAO,KAAK;oBAIzC,OAAO,IAAIW,SAAS;gBACxB;YACJ;QACJ;IACJ;IACApB,mBAAmB,IAAI,GAAG;IAE1B,OAAOA;AACX"}
|
package/graphql/getFileByUrl.js
CHANGED
|
@@ -1,69 +1,61 @@
|
|
|
1
|
-
import { ErrorResponse, GraphQLSchemaPlugin } from "@webiny/handler-graphql";
|
|
2
|
-
import { Response, NotFoundResponse } from "@webiny/handler-graphql";
|
|
1
|
+
import { ErrorResponse, GraphQLSchemaPlugin, NotFoundResponse, Response } from "@webiny/handler-graphql";
|
|
3
2
|
import { NotAuthorizedError } from "@webiny/api-core/features/security/shared/index.js";
|
|
4
3
|
import { ListFilesUseCase } from "../features/file/ListFiles/index.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const getFileByUrl = ()=>{
|
|
5
|
+
const fileManagerGraphQL = new GraphQLSchemaPlugin({
|
|
6
|
+
typeDefs: `
|
|
8
7
|
extend type FmQuery {
|
|
9
8
|
getFileByUrl(url: String!): FmFileResponse
|
|
10
9
|
}
|
|
11
10
|
`,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
resolvers: {
|
|
12
|
+
FmQuery: {
|
|
13
|
+
async getFileByUrl (_, args, context) {
|
|
14
|
+
const { url } = args;
|
|
15
|
+
const useCase = new SecureGetFileByUrl(context.security, new GetFileByUrlUseCase(context.container.resolve(ListFilesUseCase)));
|
|
16
|
+
try {
|
|
17
|
+
const file = await useCase.execute(url);
|
|
18
|
+
if (file) return new Response(file);
|
|
19
|
+
return new NotFoundResponse("File not found!");
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return new ErrorResponse(error);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
23
24
|
}
|
|
24
|
-
return new NotFoundResponse("File not found!");
|
|
25
|
-
} catch (error) {
|
|
26
|
-
return new ErrorResponse(error);
|
|
27
|
-
}
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
fileManagerGraphQL.name = "fm.graphql.getFileByUrl";
|
|
33
|
-
return fileManagerGraphQL;
|
|
26
|
+
});
|
|
27
|
+
fileManagerGraphQL.name = "fm.graphql.getFileByUrl";
|
|
28
|
+
return fileManagerGraphQL;
|
|
34
29
|
};
|
|
35
30
|
class GetFileByUrlUseCase {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return files.length ? files[0] : undefined;
|
|
52
|
-
}
|
|
31
|
+
constructor(listFiles){
|
|
32
|
+
this.listFiles = listFiles;
|
|
33
|
+
}
|
|
34
|
+
async execute(url) {
|
|
35
|
+
const { pathname } = new URL(url);
|
|
36
|
+
const query = pathname.replace("/files/", "").replace("/private/", "");
|
|
37
|
+
const filesResult = await this.listFiles.execute({
|
|
38
|
+
where: {
|
|
39
|
+
key: query
|
|
40
|
+
},
|
|
41
|
+
limit: 1
|
|
42
|
+
});
|
|
43
|
+
const files = filesResult.value.items;
|
|
44
|
+
return files.length ? files[0] : void 0;
|
|
45
|
+
}
|
|
53
46
|
}
|
|
54
47
|
class SecureGetFileByUrl {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
constructor(security, useCase){
|
|
49
|
+
this.security = security;
|
|
50
|
+
this.useCase = useCase;
|
|
51
|
+
}
|
|
52
|
+
execute(url) {
|
|
53
|
+
if (!this.security.getIdentity()) throw new NotAuthorizedError({
|
|
54
|
+
message: "You're not authorized to edit this file!"
|
|
55
|
+
});
|
|
56
|
+
return this.useCase.execute(url);
|
|
64
57
|
}
|
|
65
|
-
return this.useCase.execute(url);
|
|
66
|
-
}
|
|
67
58
|
}
|
|
59
|
+
export { getFileByUrl };
|
|
68
60
|
|
|
69
61
|
//# sourceMappingURL=getFileByUrl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graphql/getFileByUrl.js","sources":["../../src/graphql/getFileByUrl.ts"],"sourcesContent":["import { ErrorResponse, GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { Response, NotFoundResponse } from \"@webiny/handler-graphql\";\nimport type { File } from \"~/domain/file/types.js\";\nimport type { Security } from \"@webiny/api-core/types/security.js\";\nimport { NotAuthorizedError } from \"@webiny/api-core/features/security/shared/index.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { ListFilesUseCase } from \"~/features/file/ListFiles/index.js\";\n\nexport const getFileByUrl = () => {\n const fileManagerGraphQL = new GraphQLSchemaPlugin<ApiCoreContext>({\n typeDefs: /* GraphQL */ `\n extend type FmQuery {\n getFileByUrl(url: String!): FmFileResponse\n }\n `,\n resolvers: {\n FmQuery: {\n async getFileByUrl(_, args, context) {\n const { url } = args as { url: string };\n const useCase = new SecureGetFileByUrl(\n context.security,\n new GetFileByUrlUseCase(context.container.resolve(ListFilesUseCase))\n );\n try {\n const file = await useCase.execute(url);\n if (file) {\n return new Response(file);\n }\n return new NotFoundResponse(\"File not found!\");\n } catch (error) {\n return new ErrorResponse(error);\n }\n }\n }\n }\n });\n fileManagerGraphQL.name = \"fm.graphql.getFileByUrl\";\n\n return fileManagerGraphQL;\n};\n\ninterface IGetFileByUrl {\n execute(url: string): Promise<File | undefined>;\n}\n\nclass GetFileByUrlUseCase implements IGetFileByUrl {\n constructor(private listFiles: ListFilesUseCase.Interface) {}\n\n async execute(url: string): Promise<File | undefined> {\n const { pathname } = new URL(url);\n const query = pathname.replace(\"/files/\", \"\").replace(\"/private/\", \"\");\n\n const filesResult = await this.listFiles.execute({\n where: {\n key: query\n },\n limit: 1\n });\n\n const files = filesResult.value.items;\n\n return files.length ? files[0] : undefined;\n }\n}\n\nclass SecureGetFileByUrl implements IGetFileByUrl {\n private security: Security;\n private useCase: IGetFileByUrl;\n\n constructor(security: Security, useCase: IGetFileByUrl) {\n this.security = security;\n this.useCase = useCase;\n }\n\n execute(url: string): Promise<File | undefined> {\n if (!this.security.getIdentity()) {\n throw new NotAuthorizedError({ message: \"You're not authorized to edit this file!\" });\n }\n\n return this.useCase.execute(url);\n }\n}\n"],"names":["getFileByUrl","fileManagerGraphQL","GraphQLSchemaPlugin","_","args","context","url","useCase","SecureGetFileByUrl","GetFileByUrlUseCase","ListFilesUseCase","file","Response","NotFoundResponse","error","ErrorResponse","listFiles","pathname","URL","query","filesResult","files","undefined","security","NotAuthorizedError"],"mappings":";;;AAQO,MAAMA,eAAe;IACxB,MAAMC,qBAAqB,IAAIC,oBAAoC;QAC/D,UAAwB,CAAC;;;;QAIzB,CAAC;QACD,WAAW;YACP,SAAS;gBACL,MAAM,cAAaC,CAAC,EAAEC,IAAI,EAAEC,OAAO;oBAC/B,MAAM,EAAEC,GAAG,EAAE,GAAGF;oBAChB,MAAMG,UAAU,IAAIC,mBAChBH,QAAQ,QAAQ,EAChB,IAAII,oBAAoBJ,QAAQ,SAAS,CAAC,OAAO,CAACK;oBAEtD,IAAI;wBACA,MAAMC,OAAO,MAAMJ,QAAQ,OAAO,CAACD;wBACnC,IAAIK,MACA,OAAO,IAAIC,SAASD;wBAExB,OAAO,IAAIE,iBAAiB;oBAChC,EAAE,OAAOC,OAAO;wBACZ,OAAO,IAAIC,cAAcD;oBAC7B;gBACJ;YACJ;QACJ;IACJ;IACAb,mBAAmB,IAAI,GAAG;IAE1B,OAAOA;AACX;AAMA,MAAMQ;IACF,YAAoBO,SAAqC,CAAE;aAAvCA,SAAS,GAATA;IAAwC;IAE5D,MAAM,QAAQV,GAAW,EAA6B;QAClD,MAAM,EAAEW,QAAQ,EAAE,GAAG,IAAIC,IAAIZ;QAC7B,MAAMa,QAAQF,SAAS,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,aAAa;QAEnE,MAAMG,cAAc,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAC7C,OAAO;gBACH,KAAKD;YACT;YACA,OAAO;QACX;QAEA,MAAME,QAAQD,YAAY,KAAK,CAAC,KAAK;QAErC,OAAOC,MAAM,MAAM,GAAGA,KAAK,CAAC,EAAE,GAAGC;IACrC;AACJ;AAEA,MAAMd;IAIF,YAAYe,QAAkB,EAAEhB,OAAsB,CAAE;QACpD,IAAI,CAAC,QAAQ,GAAGgB;QAChB,IAAI,CAAC,OAAO,GAAGhB;IACnB;IAEA,QAAQD,GAAW,EAA6B;QAC5C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAC1B,MAAM,IAAIkB,mBAAmB;YAAE,SAAS;QAA2C;QAGvF,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAClB;IAChC;AACJ"}
|
package/graphql/index.js
CHANGED
|
@@ -1,53 +1,47 @@
|
|
|
1
1
|
import { ContextPlugin } from "@webiny/api";
|
|
2
2
|
import { GraphQLSchemaPlugin } from "@webiny/handler-graphql";
|
|
3
3
|
import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
|
|
4
|
-
import { createFieldTypePluginRecords } from "@webiny/api-headless-cms/graphql/schema/createFieldTypePluginRecords.js";
|
|
5
4
|
import { createGraphQLSchemaPluginFromFieldPlugins } from "@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins.js";
|
|
6
5
|
import { createBaseSchema } from "./baseSchema.js";
|
|
7
6
|
import { createFilesSchema } from "./filesSchema.js";
|
|
8
7
|
import { getFileByUrl } from "./getFileByUrl.js";
|
|
9
8
|
import { FileModel } from "../domain/file/abstractions.js";
|
|
10
|
-
import { TenantContext } from "@webiny/api-core/features/TenantContext";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
context.plugins.register([...plugins, graphQlPlugin, getFileByUrl()]);
|
|
49
|
-
});
|
|
50
|
-
})];
|
|
51
|
-
};
|
|
9
|
+
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
10
|
+
import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
|
|
11
|
+
const createGraphQLSchemaPlugin = ()=>[
|
|
12
|
+
createBaseSchema(),
|
|
13
|
+
new ContextPlugin(async (context)=>{
|
|
14
|
+
const tenantContext = context.container.resolve(TenantContext);
|
|
15
|
+
if (!tenantContext.getTenant()) return;
|
|
16
|
+
const fileModel = context.container.resolve(FileModel);
|
|
17
|
+
const listModels = context.container.resolve(ListModelsUseCase);
|
|
18
|
+
const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);
|
|
19
|
+
await context.security.withoutAuthorization(async ()=>{
|
|
20
|
+
const modelsResult = await listModels.execute();
|
|
21
|
+
const models = modelsResult.value;
|
|
22
|
+
const plugins = createGraphQLSchemaPluginFromFieldPlugins({
|
|
23
|
+
models,
|
|
24
|
+
type: "manage",
|
|
25
|
+
fieldRegistry,
|
|
26
|
+
createPlugin: ({ schema, type, fieldType })=>{
|
|
27
|
+
const plugin = new GraphQLSchemaPlugin(schema);
|
|
28
|
+
plugin.name = `fm.graphql.schema.${type}.field.${fieldType}`;
|
|
29
|
+
return plugin;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const graphQlPlugin = createFilesSchema({
|
|
33
|
+
model: fileModel,
|
|
34
|
+
models,
|
|
35
|
+
fieldRegistry
|
|
36
|
+
});
|
|
37
|
+
context.plugins.register([
|
|
38
|
+
...plugins,
|
|
39
|
+
graphQlPlugin,
|
|
40
|
+
getFileByUrl()
|
|
41
|
+
]);
|
|
42
|
+
});
|
|
43
|
+
})
|
|
44
|
+
];
|
|
45
|
+
export { createGraphQLSchemaPlugin };
|
|
52
46
|
|
|
53
47
|
//# sourceMappingURL=index.js.map
|
package/graphql/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graphql/index.js","sources":["../../src/graphql/index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { createGraphQLSchemaPluginFromFieldPlugins } from \"@webiny/api-headless-cms/utils/getSchemaFromFieldPlugins.js\";\nimport { createBaseSchema } from \"~/graphql/baseSchema.js\";\nimport { createFilesSchema } from \"~/graphql/filesSchema.js\";\nimport { getFileByUrl } from \"~/graphql/getFileByUrl.js\";\nimport { FileModel } from \"~/domain/file/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\n\nexport const createGraphQLSchemaPlugin = () => {\n return [\n createBaseSchema(),\n // Files schema is generated dynamically, based on a CMS model, so we need to\n // register it from a ContextPlugin, to perform additional bootstrap.\n new ContextPlugin<ApiCoreContext>(async context => {\n const tenantContext = context.container.resolve(TenantContext);\n if (!tenantContext.getTenant()) {\n return;\n }\n\n const fileModel = context.container.resolve(FileModel);\n const listModels = context.container.resolve(ListModelsUseCase);\n const fieldRegistry = context.container.resolve(CmsModelFieldToGraphQLRegistry);\n\n await context.security.withoutAuthorization(async () => {\n const modelsResult = await listModels.execute();\n const models = modelsResult.value;\n\n /**\n * We need to register all plugins for all the CMS fields.\n */\n const plugins = createGraphQLSchemaPluginFromFieldPlugins({\n models,\n type: \"manage\",\n fieldRegistry,\n createPlugin: ({ schema, type, fieldType }) => {\n const plugin = new GraphQLSchemaPlugin(schema);\n plugin.name = `fm.graphql.schema.${type}.field.${fieldType}`;\n return plugin;\n }\n });\n\n const graphQlPlugin = createFilesSchema({\n model: fileModel,\n models,\n fieldRegistry\n });\n\n context.plugins.register([...plugins, graphQlPlugin, getFileByUrl()]);\n });\n })\n ];\n};\n"],"names":["createGraphQLSchemaPlugin","createBaseSchema","ContextPlugin","context","tenantContext","TenantContext","fileModel","FileModel","listModels","ListModelsUseCase","fieldRegistry","CmsModelFieldToGraphQLRegistry","modelsResult","models","plugins","createGraphQLSchemaPluginFromFieldPlugins","schema","type","fieldType","plugin","GraphQLSchemaPlugin","graphQlPlugin","createFilesSchema","getFileByUrl"],"mappings":";;;;;;;;;;AAYO,MAAMA,4BAA4B,IAC9B;QACHC;QAGA,IAAIC,cAA8B,OAAMC;YACpC,MAAMC,gBAAgBD,QAAQ,SAAS,CAAC,OAAO,CAACE;YAChD,IAAI,CAACD,cAAc,SAAS,IACxB;YAGJ,MAAME,YAAYH,QAAQ,SAAS,CAAC,OAAO,CAACI;YAC5C,MAAMC,aAAaL,QAAQ,SAAS,CAAC,OAAO,CAACM;YAC7C,MAAMC,gBAAgBP,QAAQ,SAAS,CAAC,OAAO,CAACQ;YAEhD,MAAMR,QAAQ,QAAQ,CAAC,oBAAoB,CAAC;gBACxC,MAAMS,eAAe,MAAMJ,WAAW,OAAO;gBAC7C,MAAMK,SAASD,aAAa,KAAK;gBAKjC,MAAME,UAAUC,0CAA0C;oBACtDF;oBACA,MAAM;oBACNH;oBACA,cAAc,CAAC,EAAEM,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAE;wBACtC,MAAMC,SAAS,IAAIC,oBAAoBJ;wBACvCG,OAAO,IAAI,GAAG,CAAC,kBAAkB,EAAEF,KAAK,OAAO,EAAEC,WAAW;wBAC5D,OAAOC;oBACX;gBACJ;gBAEA,MAAME,gBAAgBC,kBAAkB;oBACpC,OAAOhB;oBACPO;oBACAH;gBACJ;gBAEAP,QAAQ,OAAO,CAAC,QAAQ,CAAC;uBAAIW;oBAASO;oBAAeE;iBAAe;YACxE;QACJ;KACH"}
|
package/graphql/utils.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const resolve = async fn => {
|
|
10
|
-
try {
|
|
11
|
-
return new Response(await fn());
|
|
12
|
-
} catch (e) {
|
|
13
|
-
return new ErrorResponse(e);
|
|
14
|
-
}
|
|
1
|
+
import { ErrorResponse, Response } from "@webiny/handler-graphql";
|
|
2
|
+
const emptyResolver = ()=>({});
|
|
3
|
+
const resolve = async (fn)=>{
|
|
4
|
+
try {
|
|
5
|
+
return new Response(await fn());
|
|
6
|
+
} catch (e) {
|
|
7
|
+
return new ErrorResponse(e);
|
|
8
|
+
}
|
|
15
9
|
};
|
|
10
|
+
export { emptyResolver, resolve };
|
|
16
11
|
|
|
17
12
|
//# sourceMappingURL=utils.js.map
|
package/graphql/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graphql/utils.js","sources":["../../src/graphql/utils.ts"],"sourcesContent":["import { Response, ErrorResponse } from \"@webiny/handler-graphql\";\n\nexport const 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\nexport const resolve = async (fn: ResolveCallable) => {\n try {\n return new Response(await fn());\n } catch (e) {\n return new ErrorResponse(e);\n }\n};\n"],"names":["emptyResolver","resolve","fn","Response","e","ErrorResponse"],"mappings":";AAEO,MAAMA,gBAAgB,IAAO,EAAC;AAU9B,MAAMC,UAAU,OAAOC;IAC1B,IAAI;QACA,OAAO,IAAIC,SAAS,MAAMD;IAC9B,EAAE,OAAOE,GAAG;QACR,OAAO,IAAIC,cAAcD;IAC7B;AACJ"}
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import type { ApiCoreContext } from "@webiny/api-core/types/core.js";
|
|
|
2
2
|
import { ContextPlugin } from "@webiny/api";
|
|
3
3
|
export * from "./modelModifier/CmsModelModifier.js";
|
|
4
4
|
export * from "./delivery/index.js";
|
|
5
|
-
export declare const createFileManagerContext: () => ContextPlugin<ApiCoreContext
|
|
5
|
+
export declare const createFileManagerContext: () => (ContextPlugin<ApiCoreContext> | import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>)[];
|
|
6
6
|
export declare const createFileManagerGraphQL: () => (import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<ApiCoreContext> | ContextPlugin<ApiCoreContext>)[];
|
|
7
|
-
export declare const createAssetDelivery: () => (import("
|
|
7
|
+
export declare const createAssetDelivery: () => (import("@webiny/handler").ModifyFastifyPlugin | import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>)[];
|
package/index.js
CHANGED
|
@@ -1,52 +1,44 @@
|
|
|
1
1
|
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
3
2
|
import { setupAssetDelivery } from "./delivery/setupAssetDelivery.js";
|
|
4
3
|
import { createGraphQLSchemaPlugin } from "./graphql/index.js";
|
|
5
4
|
import { FileManagerFeature } from "./features/FileManagerFeature.js";
|
|
6
|
-
import {
|
|
7
|
-
import { SettingsPermissions as SettingsPermissionsImpl } from "./permissions/SettingsPermissions.js";
|
|
8
|
-
import { FilePermissions, SettingsPermissions } from "./features/shared/abstractions.js";
|
|
5
|
+
import { FmPermissionsFeature } from "./features/permissions/feature.js";
|
|
9
6
|
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
10
|
-
import { FileModel
|
|
7
|
+
import { FileModel } from "./domain/file/abstractions.js";
|
|
11
8
|
import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
|
|
12
|
-
import {
|
|
9
|
+
import { FILE_MODEL_ID, FileModel as file_model_js_FileModel } from "./domain/file/file.model.js";
|
|
10
|
+
import { createRegisterExtensionPlugin } from "@webiny/handler";
|
|
11
|
+
import { AssetDeliveryFeature } from "./features/assetDelivery/feature.js";
|
|
13
12
|
export * from "./modelModifier/CmsModelModifier.js";
|
|
14
13
|
export * from "./delivery/index.js";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
const createFileManagerContext = ()=>{
|
|
15
|
+
const fileManagerContextPlugin = new ContextPlugin(async (context)=>{
|
|
16
|
+
const tenantContext = context.container.resolve(TenantContext);
|
|
17
|
+
const getModel = context.container.resolve(GetModelUseCase);
|
|
18
|
+
if (!tenantContext.getTenant()) return;
|
|
19
|
+
await context.security.withoutAuthorization(async ()=>{
|
|
20
|
+
const fileModel = await getModel.execute(FILE_MODEL_ID);
|
|
21
|
+
context.container.registerInstance(FileModel, fileModel.value);
|
|
22
|
+
});
|
|
23
|
+
FmPermissionsFeature.register(context.container);
|
|
24
|
+
FileManagerFeature.register(context.container);
|
|
26
25
|
});
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
getPermissions: () => identityContext.getPermissions("fm.file"),
|
|
31
|
-
fullAccessPermissionName: "fm.*"
|
|
26
|
+
fileManagerContextPlugin.name = "file-manager.createContext";
|
|
27
|
+
const modelsPlugin = createRegisterExtensionPlugin((context)=>{
|
|
28
|
+
context.container.register(file_model_js_FileModel);
|
|
32
29
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
context.container.registerInstance(FilePermissions, filePermissions);
|
|
39
|
-
context.container.registerInstance(SettingsPermissions, settingsPermissions);
|
|
40
|
-
FileManagerFeature.register(context.container);
|
|
41
|
-
});
|
|
42
|
-
plugin.name = "file-manager.createContext";
|
|
43
|
-
return plugin;
|
|
44
|
-
};
|
|
45
|
-
export const createFileManagerGraphQL = () => {
|
|
46
|
-
return createGraphQLSchemaPlugin();
|
|
47
|
-
};
|
|
48
|
-
export const createAssetDelivery = () => {
|
|
49
|
-
return setupAssetDelivery();
|
|
30
|
+
return [
|
|
31
|
+
fileManagerContextPlugin,
|
|
32
|
+
modelsPlugin
|
|
33
|
+
];
|
|
50
34
|
};
|
|
35
|
+
const createFileManagerGraphQL = ()=>createGraphQLSchemaPlugin();
|
|
36
|
+
const createAssetDelivery = ()=>[
|
|
37
|
+
createRegisterExtensionPlugin((context)=>{
|
|
38
|
+
AssetDeliveryFeature.register(context.container);
|
|
39
|
+
}),
|
|
40
|
+
...setupAssetDelivery()
|
|
41
|
+
];
|
|
42
|
+
export { createAssetDelivery, createFileManagerContext, createFileManagerGraphQL };
|
|
51
43
|
|
|
52
44
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { setupAssetDelivery } from \"./delivery/setupAssetDelivery.js\";\nimport { createGraphQLSchemaPlugin } from \"./graphql/index.js\";\nimport { FileManagerFeature } from \"~/features/FileManagerFeature.js\";\nimport { FmPermissionsFeature } from \"~/features/permissions/feature.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { FileModel as FileModelAbstraction } from \"~/domain/file/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { FileModel, FILE_MODEL_ID } from \"~/domain/file/file.model.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { AssetDeliveryFeature } from \"~/features/assetDelivery/feature.js\";\n\nexport * from \"./modelModifier/CmsModelModifier.js\";\nexport * from \"./delivery/index.js\";\n\nexport const createFileManagerContext = () => {\n const fileManagerContextPlugin = new ContextPlugin<ApiCoreContext>(async context => {\n const tenantContext = context.container.resolve(TenantContext);\n const getModel = context.container.resolve(GetModelUseCase);\n\n if (!tenantContext.getTenant()) {\n return;\n }\n\n await context.security.withoutAuthorization(async () => {\n const fileModel = await getModel.execute(FILE_MODEL_ID);\n context.container.registerInstance(FileModelAbstraction, fileModel.value);\n });\n\n FmPermissionsFeature.register(context.container);\n FileManagerFeature.register(context.container);\n });\n\n fileManagerContextPlugin.name = \"file-manager.createContext\";\n\n const modelsPlugin = createRegisterExtensionPlugin(context => {\n context.container.register(FileModel);\n });\n\n return [fileManagerContextPlugin, modelsPlugin];\n};\n\nexport const createFileManagerGraphQL = () => {\n return createGraphQLSchemaPlugin();\n};\n\nexport const createAssetDelivery = () => {\n return [\n createRegisterExtensionPlugin(context => {\n AssetDeliveryFeature.register(context.container);\n }),\n ...setupAssetDelivery()\n ];\n};\n"],"names":["createFileManagerContext","fileManagerContextPlugin","ContextPlugin","context","tenantContext","TenantContext","getModel","GetModelUseCase","fileModel","FILE_MODEL_ID","FileModelAbstraction","FmPermissionsFeature","FileManagerFeature","modelsPlugin","createRegisterExtensionPlugin","FileModel","createFileManagerGraphQL","createGraphQLSchemaPlugin","createAssetDelivery","AssetDeliveryFeature","setupAssetDelivery"],"mappings":";;;;;;;;;;;;;AAgBO,MAAMA,2BAA2B;IACpC,MAAMC,2BAA2B,IAAIC,cAA8B,OAAMC;QACrE,MAAMC,gBAAgBD,QAAQ,SAAS,CAAC,OAAO,CAACE;QAChD,MAAMC,WAAWH,QAAQ,SAAS,CAAC,OAAO,CAACI;QAE3C,IAAI,CAACH,cAAc,SAAS,IACxB;QAGJ,MAAMD,QAAQ,QAAQ,CAAC,oBAAoB,CAAC;YACxC,MAAMK,YAAY,MAAMF,SAAS,OAAO,CAACG;YACzCN,QAAQ,SAAS,CAAC,gBAAgB,CAACO,WAAsBF,UAAU,KAAK;QAC5E;QAEAG,qBAAqB,QAAQ,CAACR,QAAQ,SAAS;QAC/CS,mBAAmB,QAAQ,CAACT,QAAQ,SAAS;IACjD;IAEAF,yBAAyB,IAAI,GAAG;IAEhC,MAAMY,eAAeC,8BAA8BX,CAAAA;QAC/CA,QAAQ,SAAS,CAAC,QAAQ,CAACY;IAC/B;IAEA,OAAO;QAACd;QAA0BY;KAAa;AACnD;AAEO,MAAMG,2BAA2B,IAC7BC;AAGJ,MAAMC,sBAAsB,IACxB;QACHJ,8BAA8BX,CAAAA;YAC1BgB,qBAAqB,QAAQ,CAAChB,QAAQ,SAAS;QACnD;WACGiB;KACN"}
|
|
@@ -2,53 +2,50 @@ import { Plugin } from "@webiny/plugins";
|
|
|
2
2
|
import { createModelField } from "@webiny/api-headless-cms";
|
|
3
3
|
import { FILE_MODEL_ID } from "../domain/file/file.model.js";
|
|
4
4
|
class CmsModelFieldsModifier {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
}
|
|
5
|
+
constructor(fields){
|
|
6
|
+
this.fields = fields;
|
|
7
|
+
}
|
|
8
|
+
addField(field) {
|
|
9
|
+
const { bulkEdit, tags, ...rest } = field;
|
|
10
|
+
this.fields.push({
|
|
11
|
+
...rest,
|
|
12
|
+
tags: (tags ?? []).concat(bulkEdit ? [
|
|
13
|
+
"$bulk-edit"
|
|
14
|
+
] : []),
|
|
15
|
+
storageId: `${field.type}@${field.id}`
|
|
16
|
+
});
|
|
17
|
+
}
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (model.modelId !== this.modelId) {
|
|
30
|
-
return;
|
|
19
|
+
class CmsModelModifierPlugin extends Plugin {
|
|
20
|
+
static{
|
|
21
|
+
this.type = "fm.cms-model-modifier";
|
|
22
|
+
}
|
|
23
|
+
constructor(modelId, cb){
|
|
24
|
+
super();
|
|
25
|
+
this.modelId = modelId;
|
|
26
|
+
this.cb = cb;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
async modifyModel(model) {
|
|
29
|
+
if (model.modelId !== this.modelId) return;
|
|
30
|
+
let extensionsField = model.fields.find((field)=>"extensions" === field.fieldId);
|
|
31
|
+
if (!extensionsField) {
|
|
32
|
+
extensionsField = createModelField({
|
|
33
|
+
label: "Extensions",
|
|
34
|
+
type: "object",
|
|
35
|
+
settings: {
|
|
36
|
+
layout: [],
|
|
37
|
+
fields: []
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
model.fields.push(extensionsField);
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const modifier = new CmsModelFieldsModifier(extensionsField.settings.fields);
|
|
43
|
+
await this.cb({
|
|
44
|
+
modifier
|
|
45
|
+
});
|
|
43
46
|
}
|
|
44
|
-
const modifier = new CmsModelFieldsModifier(extensionsField.settings.fields);
|
|
45
|
-
await this.cb({
|
|
46
|
-
modifier
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
47
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
48
|
+
const createFileModelModifier = (cb)=>new CmsModelModifierPlugin(FILE_MODEL_ID, cb);
|
|
49
|
+
export { CmsModelModifierPlugin, createFileModelModifier };
|
|
53
50
|
|
|
54
51
|
//# sourceMappingURL=CmsModelModifier.js.map
|