@webiny/api-file-manager 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.a85ef555b2
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/FileManagerAppFeature.d.ts +5 -0
- package/FileManagerAppFeature.js +21 -0
- package/FileManagerAppFeature.js.map +1 -0
- package/{constants.js → contants.js} +1 -1
- package/contants.js.map +1 -0
- package/delivery/AssetDelivery/Asset.d.ts +1 -2
- package/delivery/AssetDelivery/Asset.js +1 -4
- package/delivery/AssetDelivery/Asset.js.map +1 -1
- package/delivery/AssetDelivery/AssetRequest.d.ts +2 -3
- package/delivery/AssetDelivery/AssetRequest.js +0 -3
- package/delivery/AssetDelivery/AssetRequest.js.map +1 -1
- package/delivery/AssetDelivery/abstractions/AssetReply.d.ts +1 -2
- package/delivery/AssetDelivery/abstractions/AssetReply.js +0 -5
- package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -1
- package/delivery/AssetDeliveryRoute.d.ts +24 -0
- package/delivery/AssetDeliveryRoute.js +69 -0
- package/delivery/AssetDeliveryRoute.js.map +1 -0
- package/delivery/index.d.ts +3 -3
- package/delivery/index.js +2 -0
- package/delivery/setupAssetDelivery.d.ts +1 -1
- package/delivery/setupAssetDelivery.js +1 -69
- package/delivery/setupAssetDelivery.js.map +1 -1
- package/domain/file/abstractions.d.ts +13 -5
- package/domain/file/abstractions.js +2 -2
- package/domain/file/abstractions.js.map +1 -1
- package/domain/file/file.model.d.ts +3 -3
- package/domain/file/file.model.js +7 -6
- package/domain/file/file.model.js.map +1 -1
- package/domain/settings/validation.js +3 -10
- package/domain/settings/validation.js.map +1 -1
- package/exports/api/file-manager/assetDelivery.d.ts +1 -9
- package/exports/api/file-manager/assetDelivery.js +1 -8
- package/exports/api/file-manager/file.d.ts +1 -1
- package/exports/api/file-manager/file.js +1 -1
- package/features/FileManagerFeature.js +0 -6
- package/features/FileManagerFeature.js.map +1 -1
- package/features/assetDelivery/Asset/Asset.js +1 -1
- package/features/assetDelivery/Asset/Asset.js.map +1 -1
- package/features/assetDelivery/FilesAssetRequestResolver.d.ts +7 -9
- package/features/assetDelivery/FilesAssetRequestResolver.js +16 -20
- package/features/assetDelivery/FilesAssetRequestResolver.js.map +1 -1
- package/features/assetDelivery/NullAssetOutputStrategy.d.ts +6 -6
- package/features/assetDelivery/NullAssetOutputStrategy.js +6 -6
- package/features/assetDelivery/NullAssetOutputStrategy.js.map +1 -1
- package/features/assetDelivery/NullAssetReply.d.ts +1 -2
- package/features/assetDelivery/NullAssetReply.js +0 -3
- package/features/assetDelivery/NullAssetReply.js.map +1 -1
- package/features/assetDelivery/NullAssetResolver.d.ts +6 -6
- package/features/assetDelivery/NullAssetResolver.js +5 -5
- package/features/assetDelivery/NullAssetResolver.js.map +1 -1
- package/features/assetDelivery/StreamAssetReply/StreamAssetReply.js +1 -1
- package/features/assetDelivery/StreamAssetReply/StreamAssetReply.js.map +1 -1
- package/features/assetDelivery/abstractions.d.ts +65 -0
- package/features/assetDelivery/abstractions.js +11 -0
- package/features/assetDelivery/abstractions.js.map +1 -0
- package/features/assetDelivery/assetTypes/image/SharpTransformer.d.ts +18 -0
- package/features/assetDelivery/assetTypes/image/SharpTransformer.js +47 -0
- package/features/assetDelivery/assetTypes/image/SharpTransformer.js.map +1 -0
- package/features/assetDelivery/assetTypes/image/normalizeImageOptions.js +1 -1
- package/features/assetDelivery/assetTypes/image/normalizeImageOptions.js.map +1 -1
- package/features/assetDelivery/feature.js +17 -20
- package/features/assetDelivery/feature.js.map +1 -1
- package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +2 -2
- package/features/assetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -1
- package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +3 -3
- package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +1 -1
- package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -1
- package/features/assetDelivery/privateFiles/PrivateCache.d.ts +3 -3
- package/features/assetDelivery/privateFiles/PrivateCache.js.map +1 -1
- package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +8 -9
- package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +14 -17
- package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -1
- package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +8 -8
- package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js +7 -8
- package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -1
- package/features/assetDelivery/privateFiles/PublicCache.d.ts +3 -3
- package/features/assetDelivery/privateFiles/PublicCache.js.map +1 -1
- package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +4 -5
- package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +1 -4
- package/features/assetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -1
- package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +4 -5
- package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +1 -4
- package/features/assetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -1
- package/features/assetDelivery/transformation/CallableContentsReader.d.ts +1 -1
- package/features/assetDelivery/transformation/CallableContentsReader.js.map +1 -1
- package/features/assetDelivery/transformation/TransformationAssetProcessor.d.ts +5 -3
- package/features/assetDelivery/transformation/TransformationAssetProcessor.js.map +1 -1
- package/features/file/CreateFile/CreateFileRepository.d.ts +3 -3
- package/features/file/CreateFile/CreateFileRepository.js +6 -5
- package/features/file/CreateFile/CreateFileRepository.js.map +1 -1
- package/features/file/DeleteFile/DeleteFileRepository.d.ts +3 -3
- package/features/file/DeleteFile/DeleteFileRepository.js +6 -5
- package/features/file/DeleteFile/DeleteFileRepository.js.map +1 -1
- package/features/file/FileModelProvider.d.ts +31 -0
- package/features/file/FileModelProvider.js +22 -0
- package/features/file/FileModelProvider.js.map +1 -0
- package/features/file/FileUrlGenerator/FileUrlGenerator.d.ts +3 -6
- package/features/file/FileUrlGenerator/FileUrlGenerator.js +5 -19
- package/features/file/FileUrlGenerator/FileUrlGenerator.js.map +1 -1
- package/features/file/FileUrlGenerator/SettingsFileUrlPrefixProvider.d.ts +13 -0
- package/features/file/FileUrlGenerator/SettingsFileUrlPrefixProvider.js +29 -0
- package/features/file/FileUrlGenerator/SettingsFileUrlPrefixProvider.js.map +1 -0
- package/features/file/FileUrlGenerator/abstractions.d.ts +12 -0
- package/features/file/FileUrlGenerator/abstractions.js +2 -1
- package/features/file/FileUrlGenerator/abstractions.js.map +1 -1
- package/features/file/FileUrlGenerator/feature.js +2 -0
- package/features/file/FileUrlGenerator/feature.js.map +1 -1
- package/features/file/FileUrlGenerator/index.d.ts +1 -0
- package/features/file/FileUrlGenerator/index.js +1 -1
- package/features/file/GetFile/GetFileRepository.d.ts +3 -3
- package/features/file/GetFile/GetFileRepository.js +6 -5
- package/features/file/GetFile/GetFileRepository.js.map +1 -1
- package/features/file/ListFiles/ListFilesRepository.d.ts +3 -3
- package/features/file/ListFiles/ListFilesRepository.js +8 -7
- package/features/file/ListFiles/ListFilesRepository.js.map +1 -1
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.d.ts +15 -5
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +21 -7
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.js.map +1 -1
- package/features/file/ListTags/ListTagsRepository.d.ts +3 -3
- package/features/file/ListTags/ListTagsRepository.js +7 -6
- package/features/file/ListTags/ListTagsRepository.js.map +1 -1
- package/features/file/UpdateFile/UpdateFileRepository.d.ts +3 -3
- package/features/file/UpdateFile/UpdateFileRepository.js +6 -5
- package/features/file/UpdateFile/UpdateFileRepository.js.map +1 -1
- package/features/settings/SettingsInstaller/SettingsInstaller.js +1 -4
- package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -1
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.d.ts +3 -1
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js +10 -3
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -1
- package/graphql/FmGraphQLSchema.d.ts +8 -9
- package/graphql/FmGraphQLSchema.js +27 -19
- package/graphql/FmGraphQLSchema.js.map +1 -1
- package/index.d.ts +4 -4
- package/index.js +4 -33
- package/index.js.map +1 -1
- package/package.json +18 -18
- package/constants.js.map +0 -1
- package/features/assetDelivery/AssetRequest/AssetRequest.d.ts +0 -8
- package/features/assetDelivery/AssetRequest/AssetRequest.js +0 -14
- package/features/assetDelivery/AssetRequest/AssetRequest.js.map +0 -1
- package/features/assetDelivery/AssetRequest/abstractions.d.ts +0 -11
- package/features/assetDelivery/AssetRequest/abstractions.js +0 -5
- package/features/assetDelivery/AssetRequest/abstractions.js.map +0 -1
- package/features/assetDelivery/AssetRequest/index.d.ts +0 -1
- package/features/assetDelivery/AssetRequest/index.js +0 -1
- package/features/assetDelivery/abstractions/AssetAuthorizer.d.ts +0 -9
- package/features/assetDelivery/abstractions/AssetAuthorizer.js +0 -5
- package/features/assetDelivery/abstractions/AssetAuthorizer.js.map +0 -1
- package/features/assetDelivery/abstractions/AssetContentsReader.d.ts +0 -9
- package/features/assetDelivery/abstractions/AssetContentsReader.js +0 -5
- package/features/assetDelivery/abstractions/AssetContentsReader.js.map +0 -1
- package/features/assetDelivery/abstractions/AssetOutputStrategy.d.ts +0 -11
- package/features/assetDelivery/abstractions/AssetOutputStrategy.js +0 -5
- package/features/assetDelivery/abstractions/AssetOutputStrategy.js.map +0 -1
- package/features/assetDelivery/abstractions/AssetProcessor.d.ts +0 -11
- package/features/assetDelivery/abstractions/AssetProcessor.js +0 -5
- package/features/assetDelivery/abstractions/AssetProcessor.js.map +0 -1
- package/features/assetDelivery/abstractions/AssetRequestResolver.d.ts +0 -11
- package/features/assetDelivery/abstractions/AssetRequestResolver.js +0 -5
- package/features/assetDelivery/abstractions/AssetRequestResolver.js.map +0 -1
- package/features/assetDelivery/abstractions/AssetResolver.d.ts +0 -11
- package/features/assetDelivery/abstractions/AssetResolver.js +0 -5
- package/features/assetDelivery/abstractions/AssetResolver.js.map +0 -1
- package/features/assetDelivery/abstractions/AssetTransformationStrategy.d.ts +0 -11
- package/features/assetDelivery/abstractions/AssetTransformationStrategy.js +0 -5
- package/features/assetDelivery/abstractions/AssetTransformationStrategy.js.map +0 -1
- package/graphql/FmUploadGraphQLSchema.d.ts +0 -11
- package/graphql/FmUploadGraphQLSchema.js +0 -231
- package/graphql/FmUploadGraphQLSchema.js.map +0 -1
- /package/{constants.d.ts → contants.d.ts} +0 -0
|
@@ -6,7 +6,7 @@ export { UpdateFileRepository, UpdateFileUseCase } from "../../../features/file/
|
|
|
6
6
|
export { FileAfterUpdateEventHandler, FileBeforeUpdateEventHandler } from "../../../features/file/UpdateFile/events.js";
|
|
7
7
|
export { DeleteFileRepository, DeleteFileUseCase } from "../../../features/file/DeleteFile/abstractions.js";
|
|
8
8
|
export { FileAfterDeleteEventHandler, FileBeforeDeleteEventHandler } from "../../../features/file/DeleteFile/events.js";
|
|
9
|
-
export { FileUrlGenerator } from "../../../features/file/FileUrlGenerator/abstractions.js";
|
|
9
|
+
export { FileUrlGenerator, FileUrlPrefixProvider } from "../../../features/file/FileUrlGenerator/abstractions.js";
|
|
10
10
|
export { GetFileRepository, GetFileUseCase } from "../../../features/file/GetFile/abstractions.js";
|
|
11
11
|
export { GetFileByUrlUseCase } from "../../../features/file/GetFileByUrl/abstractions.js";
|
|
12
12
|
export { ListFilesRepository, ListFilesUseCase } from "../../../features/file/ListFiles/abstractions.js";
|
|
@@ -6,7 +6,7 @@ export { UpdateFileRepository, UpdateFileUseCase } from "../../../features/file/
|
|
|
6
6
|
export { FileAfterUpdateEventHandler, FileBeforeUpdateEventHandler } from "../../../features/file/UpdateFile/events.js";
|
|
7
7
|
export { DeleteFileRepository, DeleteFileUseCase } from "../../../features/file/DeleteFile/abstractions.js";
|
|
8
8
|
export { FileAfterDeleteEventHandler, FileBeforeDeleteEventHandler } from "../../../features/file/DeleteFile/events.js";
|
|
9
|
-
export { FileUrlGenerator } from "../../../features/file/FileUrlGenerator/abstractions.js";
|
|
9
|
+
export { FileUrlGenerator, FileUrlPrefixProvider } from "../../../features/file/FileUrlGenerator/abstractions.js";
|
|
10
10
|
export { GetFileRepository, GetFileUseCase } from "../../../features/file/GetFile/abstractions.js";
|
|
11
11
|
export { GetFileByUrlUseCase } from "../../../features/file/GetFileByUrl/abstractions.js";
|
|
12
12
|
export { ListFilesRepository, ListFilesUseCase } from "../../../features/file/ListFiles/abstractions.js";
|
|
@@ -12,10 +12,7 @@ import { UpdateSettingsFeature } from "./settings/UpdateSettings/feature.js";
|
|
|
12
12
|
import { ListImagesByTagToolFeature } from "./file/ListImagesByTagTool/feature.js";
|
|
13
13
|
import { FileUrlGeneratorFeature } from "./file/FileUrlGenerator/feature.js";
|
|
14
14
|
import { GetFileByUrlFeature } from "./file/GetFileByUrl/feature.js";
|
|
15
|
-
import { ReadFileMetadataFeature } from "./upload/ReadFileMetadata/feature.js";
|
|
16
|
-
import { WriteFileMetadataFeature } from "./upload/WriteFileMetadata/feature.js";
|
|
17
15
|
import { FmGraphQLSchema } from "../graphql/FmGraphQLSchema.js";
|
|
18
|
-
import { FmUploadGraphQLSchema } from "../graphql/FmUploadGraphQLSchema.js";
|
|
19
16
|
const FileManagerFeature = createFeature({
|
|
20
17
|
name: "FileManager",
|
|
21
18
|
register (container) {
|
|
@@ -32,10 +29,7 @@ const FileManagerFeature = createFeature({
|
|
|
32
29
|
ListImagesByTagToolFeature.register(container);
|
|
33
30
|
FileUrlGeneratorFeature.register(container);
|
|
34
31
|
GetFileByUrlFeature.register(container);
|
|
35
|
-
ReadFileMetadataFeature.register(container);
|
|
36
|
-
WriteFileMetadataFeature.register(container);
|
|
37
32
|
container.register(FmGraphQLSchema);
|
|
38
|
-
container.register(FmUploadGraphQLSchema);
|
|
39
33
|
}
|
|
40
34
|
});
|
|
41
35
|
export { FileManagerFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/FileManagerFeature.js","sources":["../../src/features/FileManagerFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateFileFeature } from \"~/features/file/CreateFile/feature.js\";\nimport { CreateFilesInBatchFeature } from \"~/features/file/CreateFilesInBatch/feature.js\";\nimport { DeleteFileFeature } from \"~/features/file/DeleteFile/feature.js\";\nimport { GetFileFeature } from \"~/features/file/GetFile/feature.js\";\nimport { ListFilesFeature } from \"~/features/file/ListFiles/feature.js\";\nimport { ListTagsFeature } from \"~/features/file/ListTags/feature.js\";\nimport { UpdateFileFeature } from \"~/features/file/UpdateFile/feature.js\";\nimport { SettingsInstallerFeature } from \"~/features/settings/SettingsInstaller/feature.js\";\nimport { GetSettingsFeature } from \"~/features/settings/GetSettings/feature.js\";\nimport { UpdateSettingsFeature } from \"~/features/settings/UpdateSettings/feature.js\";\nimport { ListImagesByTagToolFeature } from \"~/features/file/ListImagesByTagTool/feature.js\";\nimport { FileUrlGeneratorFeature } from \"~/features/file/FileUrlGenerator/feature.js\";\nimport { GetFileByUrlFeature } from \"~/features/file/GetFileByUrl/feature.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/FileManagerFeature.js","sources":["../../src/features/FileManagerFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateFileFeature } from \"~/features/file/CreateFile/feature.js\";\nimport { CreateFilesInBatchFeature } from \"~/features/file/CreateFilesInBatch/feature.js\";\nimport { DeleteFileFeature } from \"~/features/file/DeleteFile/feature.js\";\nimport { GetFileFeature } from \"~/features/file/GetFile/feature.js\";\nimport { ListFilesFeature } from \"~/features/file/ListFiles/feature.js\";\nimport { ListTagsFeature } from \"~/features/file/ListTags/feature.js\";\nimport { UpdateFileFeature } from \"~/features/file/UpdateFile/feature.js\";\nimport { SettingsInstallerFeature } from \"~/features/settings/SettingsInstaller/feature.js\";\nimport { GetSettingsFeature } from \"~/features/settings/GetSettings/feature.js\";\nimport { UpdateSettingsFeature } from \"~/features/settings/UpdateSettings/feature.js\";\nimport { ListImagesByTagToolFeature } from \"~/features/file/ListImagesByTagTool/feature.js\";\nimport { FileUrlGeneratorFeature } from \"~/features/file/FileUrlGenerator/feature.js\";\nimport { GetFileByUrlFeature } from \"~/features/file/GetFileByUrl/feature.js\";\nimport { FmGraphQLSchema } from \"~/graphql/FmGraphQLSchema.js\";\n\nexport const FileManagerFeature = createFeature({\n name: \"FileManager\",\n register(container) {\n CreateFileFeature.register(container);\n CreateFilesInBatchFeature.register(container);\n UpdateFileFeature.register(container);\n DeleteFileFeature.register(container);\n GetFileFeature.register(container);\n ListFilesFeature.register(container);\n ListTagsFeature.register(container);\n SettingsInstallerFeature.register(container);\n GetSettingsFeature.register(container);\n UpdateSettingsFeature.register(container);\n ListImagesByTagToolFeature.register(container);\n FileUrlGeneratorFeature.register(container);\n GetFileByUrlFeature.register(container);\n\n /* GraphQL schema factory. */\n container.register(FmGraphQLSchema);\n }\n});\n"],"names":["FileManagerFeature","createFeature","container","CreateFileFeature","CreateFilesInBatchFeature","UpdateFileFeature","DeleteFileFeature","GetFileFeature","ListFilesFeature","ListTagsFeature","SettingsInstallerFeature","GetSettingsFeature","UpdateSettingsFeature","ListImagesByTagToolFeature","FileUrlGeneratorFeature","GetFileByUrlFeature","FmGraphQLSchema"],"mappings":";;;;;;;;;;;;;;;AAgBO,MAAMA,qBAAqBC,cAAc;IAC5C,MAAM;IACN,UAASC,SAAS;QACdC,kBAAkB,QAAQ,CAACD;QAC3BE,0BAA0B,QAAQ,CAACF;QACnCG,kBAAkB,QAAQ,CAACH;QAC3BI,kBAAkB,QAAQ,CAACJ;QAC3BK,eAAe,QAAQ,CAACL;QACxBM,iBAAiB,QAAQ,CAACN;QAC1BO,gBAAgB,QAAQ,CAACP;QACzBQ,yBAAyB,QAAQ,CAACR;QAClCS,mBAAmB,QAAQ,CAACT;QAC5BU,sBAAsB,QAAQ,CAACV;QAC/BW,2BAA2B,QAAQ,CAACX;QACpCY,wBAAwB,QAAQ,CAACZ;QACjCa,oBAAoB,QAAQ,CAACb;QAG7BA,UAAU,QAAQ,CAACc;IACvB;AACJ"}
|
|
@@ -2,7 +2,7 @@ import { Asset } from "../../../delivery/AssetDelivery/Asset.js";
|
|
|
2
2
|
import { AssetFactory } from "./abstractions.js";
|
|
3
3
|
class AssetFactoryImpl {
|
|
4
4
|
create(data) {
|
|
5
|
-
return Asset
|
|
5
|
+
return new Asset(data);
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
const Asset_AssetFactory = AssetFactory.createImplementation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/assetDelivery/Asset/Asset.js","sources":["../../../../src/features/assetDelivery/Asset/Asset.ts"],"sourcesContent":["import { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport { AssetFactory as AssetFactoryAbstraction, type IAssetFactory } from \"./abstractions.js\";\n\nclass AssetFactoryImpl implements IAssetFactory {\n create(data: AssetFactoryAbstraction.AssetData): AssetFactoryAbstraction.Asset {\n return Asset
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/Asset/Asset.js","sources":["../../../../src/features/assetDelivery/Asset/Asset.ts"],"sourcesContent":["import { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport { AssetFactory as AssetFactoryAbstraction, type IAssetFactory } from \"./abstractions.js\";\n\nclass AssetFactoryImpl implements IAssetFactory {\n create(data: AssetFactoryAbstraction.AssetData): AssetFactoryAbstraction.Asset {\n return new Asset(data);\n }\n}\n\nexport const AssetFactory = AssetFactoryAbstraction.createImplementation({\n implementation: AssetFactoryImpl,\n dependencies: []\n});\n"],"names":["AssetFactoryImpl","data","Asset","AssetFactory","AssetFactoryAbstraction"],"mappings":";;AAGA,MAAMA;IACF,OAAOC,IAAuC,EAAiC;QAC3E,OAAO,IAAIC,MAAMD;IACrB;AACJ;AAEO,MAAME,qBAAeC,aAAAA,oBAA4C,CAAC;IACrE,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
resolve(request: AssetRequestResolver.Request): Promise<AssetRequestResolver.AssetRequest | undefined>;
|
|
1
|
+
import type { Request } from "@webiny/handler/types.js";
|
|
2
|
+
import { AssetRequest } from "../../delivery/AssetDelivery/AssetRequest.js";
|
|
3
|
+
import { type IAssetRequestResolver } from "./abstractions.js";
|
|
4
|
+
export declare class FilesAssetRequestResolver implements IAssetRequestResolver {
|
|
5
|
+
resolve(request: Request): Promise<AssetRequest | undefined>;
|
|
7
6
|
}
|
|
8
|
-
export declare const
|
|
9
|
-
__abstraction: import("@webiny/di").Abstraction<
|
|
7
|
+
export declare const FilesAssetRequestResolverImpl: typeof FilesAssetRequestResolver & {
|
|
8
|
+
__abstraction: import("@webiny/di").Abstraction<IAssetRequestResolver>;
|
|
10
9
|
};
|
|
11
|
-
export {};
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
class
|
|
4
|
-
constructor(assetRequestFactory){
|
|
5
|
-
this.assetRequestFactory = assetRequestFactory;
|
|
6
|
-
}
|
|
1
|
+
import { AssetRequest } from "../../delivery/AssetDelivery/AssetRequest.js";
|
|
2
|
+
import { AssetRequestResolver } from "./abstractions.js";
|
|
3
|
+
class FilesAssetRequestResolver {
|
|
7
4
|
async resolve(request) {
|
|
8
|
-
if (!request.url
|
|
5
|
+
if (!request.url?.startsWith("/files/")) return;
|
|
9
6
|
const params = request.params ?? {};
|
|
10
7
|
const query = request.query ?? {};
|
|
11
8
|
const path = params["*"];
|
|
12
|
-
|
|
9
|
+
const options = {
|
|
10
|
+
...query,
|
|
11
|
+
original: "original" in query
|
|
12
|
+
};
|
|
13
|
+
if (query.width) options.width = parseInt(query.width);
|
|
14
|
+
return new AssetRequest({
|
|
13
15
|
key: decodeURI(path).replace("/files/", ""),
|
|
14
16
|
context: {
|
|
15
|
-
url: request.url
|
|
16
|
-
accept: request.headers?.accept
|
|
17
|
+
url: request.url ?? ""
|
|
17
18
|
},
|
|
18
|
-
options
|
|
19
|
-
...query,
|
|
20
|
-
original: "original" in query
|
|
21
|
-
}
|
|
19
|
+
options
|
|
22
20
|
});
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
|
-
const
|
|
26
|
-
implementation:
|
|
27
|
-
dependencies: [
|
|
28
|
-
AssetRequestFactory
|
|
29
|
-
]
|
|
23
|
+
const FilesAssetRequestResolverImpl = AssetRequestResolver.createImplementation({
|
|
24
|
+
implementation: FilesAssetRequestResolver,
|
|
25
|
+
dependencies: []
|
|
30
26
|
});
|
|
31
|
-
export { FilesAssetRequestResolver };
|
|
27
|
+
export { FilesAssetRequestResolver, FilesAssetRequestResolverImpl };
|
|
32
28
|
|
|
33
29
|
//# sourceMappingURL=FilesAssetRequestResolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/assetDelivery/FilesAssetRequestResolver.js","sources":["../../../src/features/assetDelivery/FilesAssetRequestResolver.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/FilesAssetRequestResolver.js","sources":["../../../src/features/assetDelivery/FilesAssetRequestResolver.ts"],"sourcesContent":["import type { Request } from \"@webiny/handler/types.js\";\nimport type { AssetRequestOptions } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport { AssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport { AssetRequestResolver, type IAssetRequestResolver } from \"./abstractions.js\";\n\nexport class FilesAssetRequestResolver implements IAssetRequestResolver {\n async resolve(request: Request): Promise<AssetRequest | undefined> {\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 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\nexport const FilesAssetRequestResolverImpl = AssetRequestResolver.createImplementation({\n implementation: FilesAssetRequestResolver,\n dependencies: []\n});\n"],"names":["FilesAssetRequestResolver","request","params","query","path","options","parseInt","AssetRequest","decodeURI","FilesAssetRequestResolverImpl","AssetRequestResolver"],"mappings":";;AAKO,MAAMA;IACT,MAAM,QAAQC,OAAgB,EAAqC;QAC/D,IAAI,CAACA,QAAQ,GAAG,EAAE,WAAW,YACzB;QAGJ,MAAMC,SAAUD,QAAQ,MAAM,IAA4B,CAAC;QAC3D,MAAME,QAASF,QAAQ,KAAK,IAA4B,CAAC;QAEzD,MAAMG,OAAOF,MAAM,CAAC,IAAI;QAExB,MAAMG,UAA+B;YACjC,GAAGF,KAAK;YACR,UAAU,cAAcA;QAC5B;QAEA,IAAIA,MAAM,KAAK,EACXE,QAAQ,KAAK,GAAGC,SAASH,MAAM,KAAK;QAGxC,OAAO,IAAII,aAAa;YACpB,KAAKC,UAAUJ,MAAM,OAAO,CAAC,WAAW;YACxC,SAAS;gBACL,KAAKH,QAAQ,GAAG,IAAI;YACxB;YACAI;QACJ;IACJ;AACJ;AAEO,MAAMI,gCAAgCC,qBAAqB,oBAAoB,CAAC;IACnF,gBAAgBV;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { AssetReply } from "../../delivery/AssetDelivery/abstractions/AssetReply.js";
|
|
2
|
+
import { type IAssetOutputStrategy } from "./abstractions.js";
|
|
3
|
+
export declare class NullAssetOutputStrategy implements IAssetOutputStrategy {
|
|
4
|
+
output(): Promise<AssetReply>;
|
|
4
5
|
}
|
|
5
|
-
export declare const
|
|
6
|
-
__abstraction: import("@webiny/di").Abstraction<
|
|
6
|
+
export declare const NullAssetOutputStrategyImpl: typeof NullAssetOutputStrategy & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<IAssetOutputStrategy>;
|
|
7
8
|
};
|
|
8
|
-
export {};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { NullAssetReply } from "./NullAssetReply.js";
|
|
2
|
-
import { AssetOutputStrategy } from "./abstractions
|
|
3
|
-
class
|
|
2
|
+
import { AssetOutputStrategy } from "./abstractions.js";
|
|
3
|
+
class NullAssetOutputStrategy {
|
|
4
4
|
async output() {
|
|
5
|
-
return NullAssetReply
|
|
5
|
+
return new NullAssetReply();
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
const
|
|
9
|
-
implementation:
|
|
8
|
+
const NullAssetOutputStrategyImpl = AssetOutputStrategy.createImplementation({
|
|
9
|
+
implementation: NullAssetOutputStrategy,
|
|
10
10
|
dependencies: []
|
|
11
11
|
});
|
|
12
|
-
export { NullAssetOutputStrategy };
|
|
12
|
+
export { NullAssetOutputStrategy, NullAssetOutputStrategyImpl };
|
|
13
13
|
|
|
14
14
|
//# sourceMappingURL=NullAssetOutputStrategy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/assetDelivery/NullAssetOutputStrategy.js","sources":["../../../src/features/assetDelivery/NullAssetOutputStrategy.ts"],"sourcesContent":["import { NullAssetReply } from \"./NullAssetReply.js\";\nimport { AssetOutputStrategy } from \"./abstractions
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/NullAssetOutputStrategy.js","sources":["../../../src/features/assetDelivery/NullAssetOutputStrategy.ts"],"sourcesContent":["import type { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport { NullAssetReply } from \"./NullAssetReply.js\";\nimport { AssetOutputStrategy, type IAssetOutputStrategy } from \"./abstractions.js\";\n\nexport class NullAssetOutputStrategy implements IAssetOutputStrategy {\n async output(): Promise<AssetReply> {\n return new NullAssetReply();\n }\n}\n\nexport const NullAssetOutputStrategyImpl = AssetOutputStrategy.createImplementation({\n implementation: NullAssetOutputStrategy,\n dependencies: []\n});\n"],"names":["NullAssetOutputStrategy","NullAssetReply","NullAssetOutputStrategyImpl","AssetOutputStrategy"],"mappings":";;AAIO,MAAMA;IACT,MAAM,SAA8B;QAChC,OAAO,IAAIC;IACf;AACJ;AAEO,MAAMC,8BAA8BC,oBAAoB,oBAAoB,CAAC;IAChF,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/assetDelivery/NullAssetReply.js","sources":["../../../src/features/assetDelivery/NullAssetReply.ts"],"sourcesContent":["import { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\n\nexport class NullAssetReply extends AssetReply {\n
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/NullAssetReply.js","sources":["../../../src/features/assetDelivery/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"],"names":["NullAssetReply","AssetReply"],"mappings":";AAEO,MAAMA,uBAAuBC;IAChC,aAAc;QACV,KAAK,CAAC;YACF,MAAM;YACN,MAAM,IAAO;oBAAE,OAAO;gBAA4C;QACtE;IACJ;AACJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Asset } from "../../delivery/AssetDelivery/Asset.js";
|
|
2
|
+
import { type IAssetResolver } from "./abstractions.js";
|
|
3
|
+
export declare class NullAssetResolver implements IAssetResolver {
|
|
4
|
+
resolve(): Promise<Asset | undefined>;
|
|
4
5
|
}
|
|
5
|
-
export declare const
|
|
6
|
-
__abstraction: import("@webiny/di").Abstraction<
|
|
6
|
+
export declare const NullAssetResolverImpl: typeof NullAssetResolver & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<IAssetResolver>;
|
|
7
8
|
};
|
|
8
|
-
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AssetResolver } from "./abstractions
|
|
2
|
-
class
|
|
1
|
+
import { AssetResolver } from "./abstractions.js";
|
|
2
|
+
class NullAssetResolver {
|
|
3
3
|
resolve() {
|
|
4
4
|
return Promise.resolve(void 0);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
implementation:
|
|
7
|
+
const NullAssetResolverImpl = AssetResolver.createImplementation({
|
|
8
|
+
implementation: NullAssetResolver,
|
|
9
9
|
dependencies: []
|
|
10
10
|
});
|
|
11
|
-
export { NullAssetResolver };
|
|
11
|
+
export { NullAssetResolver, NullAssetResolverImpl };
|
|
12
12
|
|
|
13
13
|
//# sourceMappingURL=NullAssetResolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/assetDelivery/NullAssetResolver.js","sources":["../../../src/features/assetDelivery/NullAssetResolver.ts"],"sourcesContent":["import { AssetResolver } from \"./abstractions
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/NullAssetResolver.js","sources":["../../../src/features/assetDelivery/NullAssetResolver.ts"],"sourcesContent":["import type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport { AssetResolver, type IAssetResolver } from \"./abstractions.js\";\n\nexport class NullAssetResolver implements IAssetResolver {\n resolve(): Promise<Asset | undefined> {\n return Promise.resolve(undefined);\n }\n}\n\nexport const NullAssetResolverImpl = AssetResolver.createImplementation({\n implementation: NullAssetResolver,\n dependencies: []\n});\n"],"names":["NullAssetResolver","Promise","undefined","NullAssetResolverImpl","AssetResolver"],"mappings":";AAGO,MAAMA;IACT,UAAsC;QAClC,OAAOC,QAAQ,OAAO,CAACC;IAC3B;AACJ;AAEO,MAAMC,wBAAwBC,cAAc,oBAAoB,CAAC;IACpE,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -3,7 +3,7 @@ import { ResponseHeaders } from "@webiny/handler";
|
|
|
3
3
|
import { StreamAssetReply } from "./abstractions.js";
|
|
4
4
|
class StreamAssetReplyImpl {
|
|
5
5
|
create(asset) {
|
|
6
|
-
return AssetReply
|
|
6
|
+
return new AssetReply({
|
|
7
7
|
code: 200,
|
|
8
8
|
headers: ResponseHeaders.create({
|
|
9
9
|
"cache-control": "public, max-age=31536000",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/assetDelivery/StreamAssetReply/StreamAssetReply.js","sources":["../../../../src/features/assetDelivery/StreamAssetReply/StreamAssetReply.ts"],"sourcesContent":["import { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport { ResponseHeaders } from \"@webiny/handler\";\nimport { StreamAssetReply as StreamAssetReplyAbstraction } from \"./abstractions.js\";\n\nclass StreamAssetReplyImpl implements StreamAssetReplyAbstraction.Interface {\n create(asset: StreamAssetReplyAbstraction.Asset): StreamAssetReplyAbstraction.AssetReply {\n return AssetReply
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/StreamAssetReply/StreamAssetReply.js","sources":["../../../../src/features/assetDelivery/StreamAssetReply/StreamAssetReply.ts"],"sourcesContent":["import { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport { ResponseHeaders } from \"@webiny/handler\";\nimport { StreamAssetReply as StreamAssetReplyAbstraction } from \"./abstractions.js\";\n\nclass StreamAssetReplyImpl implements StreamAssetReplyAbstraction.Interface {\n create(asset: StreamAssetReplyAbstraction.Asset): StreamAssetReplyAbstraction.AssetReply {\n return new AssetReply({\n code: 200,\n headers: ResponseHeaders.create({\n \"cache-control\": `public, max-age=${86400 * 365}`,\n \"content-type\": asset.getContentType()\n }),\n body: () => asset.getContents()\n });\n }\n}\n\nexport const StreamAssetReply = StreamAssetReplyAbstraction.createImplementation({\n implementation: StreamAssetReplyImpl,\n dependencies: []\n});\n"],"names":["StreamAssetReplyImpl","asset","AssetReply","ResponseHeaders","StreamAssetReply","StreamAssetReplyAbstraction"],"mappings":";;;AAIA,MAAMA;IACF,OAAOC,KAAwC,EAA0C;QACrF,OAAO,IAAIC,WAAW;YAClB,MAAM;YACN,SAASC,gBAAgB,MAAM,CAAC;gBAC5B,iBAAiB;gBACjB,gBAAgBF,MAAM,cAAc;YACxC;YACA,MAAM,IAAMA,MAAM,WAAW;QACjC;IACJ;AACJ;AAEO,MAAMG,oCAAmBC,iBAAAA,oBAAgD,CAAC;IAC7E,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Request as IRequest } from "@webiny/handler/types.js";
|
|
2
|
+
import type { AssetRequest as IAssetRequest } from "../../delivery/AssetDelivery/AssetRequest.js";
|
|
3
|
+
import type { Asset as IAsset } from "../../delivery/AssetDelivery/Asset.js";
|
|
4
|
+
import type { AssetReply as IAssetReply } from "../../delivery/AssetDelivery/abstractions/AssetReply.js";
|
|
5
|
+
import type { File as IFile } from "../../domain/file/types.js";
|
|
6
|
+
export interface IAssetRequestResolver {
|
|
7
|
+
resolve(request: IRequest): Promise<IAssetRequest | undefined>;
|
|
8
|
+
}
|
|
9
|
+
export interface IAssetResolver {
|
|
10
|
+
resolve(request: IAssetRequest): Promise<IAsset | undefined>;
|
|
11
|
+
}
|
|
12
|
+
export interface IAssetProcessor {
|
|
13
|
+
process(assetRequest: IAssetRequest, asset: IAsset): Promise<IAsset>;
|
|
14
|
+
}
|
|
15
|
+
export interface IAssetOutputStrategy {
|
|
16
|
+
output(asset: IAsset): Promise<IAssetReply>;
|
|
17
|
+
}
|
|
18
|
+
export interface IAssetTransformationStrategy {
|
|
19
|
+
transform(assetRequest: IAssetRequest, asset: IAsset): Promise<IAsset>;
|
|
20
|
+
}
|
|
21
|
+
export interface IAssetContentsReader {
|
|
22
|
+
read(asset: IAsset): Promise<Buffer>;
|
|
23
|
+
}
|
|
24
|
+
export interface IAssetAuthorizer {
|
|
25
|
+
authorize(file: IFile): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export declare const AssetRequestResolver: import("@webiny/di").Abstraction<IAssetRequestResolver>;
|
|
28
|
+
export declare const AssetResolver: import("@webiny/di").Abstraction<IAssetResolver>;
|
|
29
|
+
export declare const AssetProcessor: import("@webiny/di").Abstraction<IAssetProcessor>;
|
|
30
|
+
export declare const AssetOutputStrategy: import("@webiny/di").Abstraction<IAssetOutputStrategy>;
|
|
31
|
+
export declare const AssetTransformationStrategy: import("@webiny/di").Abstraction<IAssetTransformationStrategy>;
|
|
32
|
+
export declare const AssetContentsReader: import("@webiny/di").Abstraction<IAssetContentsReader>;
|
|
33
|
+
export declare const AssetAuthorizer: import("@webiny/di").Abstraction<IAssetAuthorizer>;
|
|
34
|
+
export declare namespace AssetRequestResolver {
|
|
35
|
+
type Interface = IAssetRequestResolver;
|
|
36
|
+
type AssetRequest = IAssetRequest;
|
|
37
|
+
type Request = IRequest;
|
|
38
|
+
}
|
|
39
|
+
export declare namespace AssetResolver {
|
|
40
|
+
type Interface = IAssetResolver;
|
|
41
|
+
type Asset = IAsset;
|
|
42
|
+
type Request = IAssetRequest;
|
|
43
|
+
}
|
|
44
|
+
export declare namespace AssetProcessor {
|
|
45
|
+
type Interface = IAssetProcessor;
|
|
46
|
+
type AssetRequest = IAssetRequest;
|
|
47
|
+
type Asset = IAsset;
|
|
48
|
+
}
|
|
49
|
+
export declare namespace AssetOutputStrategy {
|
|
50
|
+
type Interface = IAssetOutputStrategy;
|
|
51
|
+
type Asset = IAsset;
|
|
52
|
+
type AssetReply = IAssetReply;
|
|
53
|
+
}
|
|
54
|
+
export declare namespace AssetTransformationStrategy {
|
|
55
|
+
type Interface = IAssetTransformationStrategy;
|
|
56
|
+
type AssetRequest = IAssetRequest;
|
|
57
|
+
type Asset = IAsset;
|
|
58
|
+
}
|
|
59
|
+
export declare namespace AssetContentsReader {
|
|
60
|
+
type Interface = IAssetContentsReader;
|
|
61
|
+
type Asset = IAsset;
|
|
62
|
+
}
|
|
63
|
+
export declare namespace AssetAuthorizer {
|
|
64
|
+
type Interface = IAssetAuthorizer;
|
|
65
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createAbstraction } from "@webiny/feature/api";
|
|
2
|
+
const AssetRequestResolver = createAbstraction("AssetDelivery/AssetRequestResolver");
|
|
3
|
+
const AssetResolver = createAbstraction("AssetDelivery/AssetResolver");
|
|
4
|
+
const AssetProcessor = createAbstraction("AssetDelivery/AssetProcessor");
|
|
5
|
+
const AssetOutputStrategy = createAbstraction("AssetDelivery/AssetOutputStrategy");
|
|
6
|
+
const AssetTransformationStrategy = createAbstraction("AssetDelivery/AssetTransformationStrategy");
|
|
7
|
+
const AssetContentsReader = createAbstraction("AssetDelivery/AssetContentsReader");
|
|
8
|
+
const AssetAuthorizer = createAbstraction("AssetDelivery/AssetAuthorizer");
|
|
9
|
+
export { AssetAuthorizer, AssetContentsReader, AssetOutputStrategy, AssetProcessor, AssetRequestResolver, AssetResolver, AssetTransformationStrategy };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=abstractions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/abstractions.js","sources":["../../../src/features/assetDelivery/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Request as IRequest } from \"@webiny/handler/types.js\";\nimport type { AssetRequest as IAssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport type { Asset as IAsset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetReply as IAssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport type { File as IFile } from \"~/domain/file/types.js\";\n\nexport interface IAssetRequestResolver {\n resolve(request: IRequest): Promise<IAssetRequest | undefined>;\n}\n\nexport interface IAssetResolver {\n resolve(request: IAssetRequest): Promise<IAsset | undefined>;\n}\n\nexport interface IAssetProcessor {\n process(assetRequest: IAssetRequest, asset: IAsset): Promise<IAsset>;\n}\n\nexport interface IAssetOutputStrategy {\n output(asset: IAsset): Promise<IAssetReply>;\n}\n\nexport interface IAssetTransformationStrategy {\n transform(assetRequest: IAssetRequest, asset: IAsset): Promise<IAsset>;\n}\n\nexport interface IAssetContentsReader {\n read(asset: IAsset): Promise<Buffer>;\n}\n\nexport interface IAssetAuthorizer {\n authorize(file: IFile): Promise<void>;\n}\n\nexport const AssetRequestResolver = createAbstraction<IAssetRequestResolver>(\n \"AssetDelivery/AssetRequestResolver\"\n);\n\nexport const AssetResolver = createAbstraction<IAssetResolver>(\"AssetDelivery/AssetResolver\");\n\nexport const AssetProcessor = createAbstraction<IAssetProcessor>(\"AssetDelivery/AssetProcessor\");\n\nexport const AssetOutputStrategy = createAbstraction<IAssetOutputStrategy>(\n \"AssetDelivery/AssetOutputStrategy\"\n);\n\nexport const AssetTransformationStrategy = createAbstraction<IAssetTransformationStrategy>(\n \"AssetDelivery/AssetTransformationStrategy\"\n);\n\nexport const AssetContentsReader = createAbstraction<IAssetContentsReader>(\n \"AssetDelivery/AssetContentsReader\"\n);\n\nexport const AssetAuthorizer = createAbstraction<IAssetAuthorizer>(\"AssetDelivery/AssetAuthorizer\");\n\nexport namespace AssetRequestResolver {\n export type Interface = IAssetRequestResolver;\n export type AssetRequest = IAssetRequest;\n export type Request = IRequest;\n}\n\nexport namespace AssetResolver {\n export type Interface = IAssetResolver;\n export type Asset = IAsset;\n export type Request = IAssetRequest;\n}\n\nexport namespace AssetProcessor {\n export type Interface = IAssetProcessor;\n export type AssetRequest = IAssetRequest;\n export type Asset = IAsset;\n}\n\nexport namespace AssetOutputStrategy {\n export type Interface = IAssetOutputStrategy;\n export type Asset = IAsset;\n export type AssetReply = IAssetReply;\n}\n\nexport namespace AssetTransformationStrategy {\n export type Interface = IAssetTransformationStrategy;\n export type AssetRequest = IAssetRequest;\n export type Asset = IAsset;\n}\n\nexport namespace AssetContentsReader {\n export type Interface = IAssetContentsReader;\n export type Asset = IAsset;\n}\n\nexport namespace AssetAuthorizer {\n export type Interface = IAssetAuthorizer;\n}\n"],"names":["AssetRequestResolver","createAbstraction","AssetResolver","AssetProcessor","AssetOutputStrategy","AssetTransformationStrategy","AssetContentsReader","AssetAuthorizer"],"mappings":";AAmCO,MAAMA,uBAAuBC,kBAChC;AAGG,MAAMC,gBAAgBD,kBAAkC;AAExD,MAAME,iBAAiBF,kBAAmC;AAE1D,MAAMG,sBAAsBH,kBAC/B;AAGG,MAAMI,8BAA8BJ,kBACvC;AAGG,MAAMK,sBAAsBL,kBAC/B;AAGG,MAAMM,kBAAkBN,kBAAoC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TransformImageParams, TransformImageResult } from "./transformImage.js";
|
|
2
|
+
import type { Framing } from "./imageTypes.js";
|
|
3
|
+
export declare class SharpTransformer {
|
|
4
|
+
private module?;
|
|
5
|
+
private sharp?;
|
|
6
|
+
private load;
|
|
7
|
+
private getSharp;
|
|
8
|
+
transformBuffer(params: TransformImageParams): Promise<TransformImageResult>;
|
|
9
|
+
extractFramedRegion(buffer: Buffer, framing: Framing): Promise<Buffer>;
|
|
10
|
+
cropBuffer(buffer: Buffer, crop: {
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
bottom: number;
|
|
14
|
+
right: number;
|
|
15
|
+
}): Promise<Buffer>;
|
|
16
|
+
optimizePng(buffer: Buffer): Promise<import("sharp").Sharp>;
|
|
17
|
+
optimizeJpeg(buffer: Buffer): Promise<import("sharp").Sharp>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
class SharpTransformer {
|
|
2
|
+
async load() {
|
|
3
|
+
if (!this.module) this.module = await import("./transformImage.js");
|
|
4
|
+
return this.module;
|
|
5
|
+
}
|
|
6
|
+
async getSharp() {
|
|
7
|
+
if (!this.sharp) this.sharp = (await import("sharp")).default;
|
|
8
|
+
return this.sharp;
|
|
9
|
+
}
|
|
10
|
+
async transformBuffer(params) {
|
|
11
|
+
const m = await this.load();
|
|
12
|
+
return m.transformImageBuffer(params);
|
|
13
|
+
}
|
|
14
|
+
async extractFramedRegion(buffer, framing) {
|
|
15
|
+
const m = await this.load();
|
|
16
|
+
return m.extractFramedRegion(buffer, framing);
|
|
17
|
+
}
|
|
18
|
+
async cropBuffer(buffer, crop) {
|
|
19
|
+
const m = await this.load();
|
|
20
|
+
return m.cropImageBuffer(buffer, crop);
|
|
21
|
+
}
|
|
22
|
+
async optimizePng(buffer) {
|
|
23
|
+
const s = await this.getSharp();
|
|
24
|
+
return s(buffer).resize({
|
|
25
|
+
width: 2560,
|
|
26
|
+
withoutEnlargement: true,
|
|
27
|
+
fit: "inside"
|
|
28
|
+
}).png({
|
|
29
|
+
compressionLevel: 9,
|
|
30
|
+
adaptiveFiltering: true,
|
|
31
|
+
force: true
|
|
32
|
+
}).withMetadata();
|
|
33
|
+
}
|
|
34
|
+
async optimizeJpeg(buffer) {
|
|
35
|
+
const s = await this.getSharp();
|
|
36
|
+
return s(buffer).resize({
|
|
37
|
+
width: 2560,
|
|
38
|
+
withoutEnlargement: true,
|
|
39
|
+
fit: "inside"
|
|
40
|
+
}).withMetadata().toFormat("jpeg", {
|
|
41
|
+
quality: 90
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export { SharpTransformer };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=SharpTransformer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/assetTypes/image/SharpTransformer.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/SharpTransformer.ts"],"sourcesContent":["import type { TransformImageParams, TransformImageResult } from \"./transformImage.js\";\nimport type { Framing } from \"./imageTypes.js\";\n\nexport class SharpTransformer {\n private module?: typeof import(\"./transformImage.js\");\n private sharp?: typeof import(\"sharp\").default;\n\n private async load() {\n if (!this.module) {\n this.module = await import(\"./transformImage.js\");\n }\n return this.module;\n }\n\n private async getSharp() {\n if (!this.sharp) {\n this.sharp = (await import(\"sharp\")).default;\n }\n return this.sharp;\n }\n\n async transformBuffer(params: TransformImageParams): Promise<TransformImageResult> {\n const m = await this.load();\n return m.transformImageBuffer(params);\n }\n\n async extractFramedRegion(buffer: Buffer, framing: Framing): Promise<Buffer> {\n const m = await this.load();\n return m.extractFramedRegion(buffer, framing);\n }\n\n async cropBuffer(\n buffer: Buffer,\n crop: { top: number; left: number; bottom: number; right: number }\n ): Promise<Buffer> {\n const m = await this.load();\n return m.cropImageBuffer(buffer, crop);\n }\n\n async optimizePng(buffer: Buffer) {\n const s = await this.getSharp();\n return s(buffer)\n .resize({ width: 2560, withoutEnlargement: true, fit: \"inside\" })\n .png({ compressionLevel: 9, adaptiveFiltering: true, force: true })\n .withMetadata();\n }\n\n async optimizeJpeg(buffer: Buffer) {\n const s = await this.getSharp();\n return s(buffer)\n .resize({ width: 2560, withoutEnlargement: true, fit: \"inside\" })\n .withMetadata()\n .toFormat(\"jpeg\", { quality: 90 });\n }\n}\n"],"names":["SharpTransformer","params","m","buffer","framing","crop","s"],"mappings":"AAGO,MAAMA;IAIT,MAAc,OAAO;QACjB,IAAI,CAAC,IAAI,CAAC,MAAM,EACZ,IAAI,CAAC,MAAM,GAAG,MAAM,MAAM,CAAC;QAE/B,OAAO,IAAI,CAAC,MAAM;IACtB;IAEA,MAAc,WAAW;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,EACX,IAAI,CAAC,KAAK,GAAI,OAAM,MAAM,CAAC,QAAO,EAAG,OAAO;QAEhD,OAAO,IAAI,CAAC,KAAK;IACrB;IAEA,MAAM,gBAAgBC,MAA4B,EAAiC;QAC/E,MAAMC,IAAI,MAAM,IAAI,CAAC,IAAI;QACzB,OAAOA,EAAE,oBAAoB,CAACD;IAClC;IAEA,MAAM,oBAAoBE,MAAc,EAAEC,OAAgB,EAAmB;QACzE,MAAMF,IAAI,MAAM,IAAI,CAAC,IAAI;QACzB,OAAOA,EAAE,mBAAmB,CAACC,QAAQC;IACzC;IAEA,MAAM,WACFD,MAAc,EACdE,IAAkE,EACnD;QACf,MAAMH,IAAI,MAAM,IAAI,CAAC,IAAI;QACzB,OAAOA,EAAE,eAAe,CAACC,QAAQE;IACrC;IAEA,MAAM,YAAYF,MAAc,EAAE;QAC9B,MAAMG,IAAI,MAAM,IAAI,CAAC,QAAQ;QAC7B,OAAOA,EAAEH,QACJ,MAAM,CAAC;YAAE,OAAO;YAAM,oBAAoB;YAAM,KAAK;QAAS,GAC9D,GAAG,CAAC;YAAE,kBAAkB;YAAG,mBAAmB;YAAM,OAAO;QAAK,GAChE,YAAY;IACrB;IAEA,MAAM,aAAaA,MAAc,EAAE;QAC/B,MAAMG,IAAI,MAAM,IAAI,CAAC,QAAQ;QAC7B,OAAOA,EAAEH,QACJ,MAAM,CAAC;YAAE,OAAO;YAAM,oBAAoB;YAAM,KAAK;QAAS,GAC9D,YAAY,GACZ,QAAQ,CAAC,QAAQ;YAAE,SAAS;QAAG;IACxC;AACJ"}
|
|
@@ -3,7 +3,7 @@ const normalizeImageOptions = (query, acceptHeader)=>{
|
|
|
3
3
|
const result = {
|
|
4
4
|
original: "original" in query
|
|
5
5
|
};
|
|
6
|
-
const width = query.width ? parseInt(query.width, 10) :
|
|
6
|
+
const width = query.width ? parseInt(query.width, 10) : 0 / 0;
|
|
7
7
|
if (!Number.isNaN(width) && width > 0) result.width = width;
|
|
8
8
|
const quality = void 0 !== query.quality ? clampQuality(parseInt(query.quality, 10)) : void 0;
|
|
9
9
|
if (void 0 !== quality) result.quality = quality;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/assetDelivery/assetTypes/image/normalizeImageOptions.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/normalizeImageOptions.ts"],"sourcesContent":["import type { ImageRequestOptions } from \"./imageTypes.js\";\nimport { clampQuality, resolveRequestedFormat } from \"./imageFormat.js\";\n\n/**\n * Parse raw query params into typed image request options.\n * Returns a new `ImageRequestOptions` object; does not mutate the input.\n */\nexport const normalizeImageOptions = (\n query: Record<string, any>,\n acceptHeader: string | undefined\n): ImageRequestOptions => {\n const result: ImageRequestOptions = {\n original: \"original\" in query\n };\n\n const width = query.width ? parseInt(query.width, 10) : NaN;\n if (!Number.isNaN(width) && width > 0) {\n result.width = width;\n }\n\n const quality =\n query.quality !== undefined ? clampQuality(parseInt(query.quality, 10)) : undefined;\n if (quality !== undefined) {\n result.quality = quality;\n }\n\n const format = resolveRequestedFormat(query.format, acceptHeader);\n if (format) {\n result.format = format;\n }\n\n const crop = parseCrop(query.crop);\n if (crop) {\n result.crop = crop;\n }\n\n const aspectRatio = parseAspectRatio(query.aspectRatio);\n if (aspectRatio) {\n result.aspectRatio = aspectRatio;\n }\n\n const focal = parseFocal(query.focal);\n if (focal) {\n result.focal = focal;\n }\n\n return result;\n};\n\nconst parseAspectRatio = (raw: unknown): number | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n if (raw.includes(\":\")) {\n const [w, h] = raw.split(\":\").map(v => parseFloat(v));\n return w > 0 && h > 0 ? w / h : undefined;\n }\n const value = parseFloat(raw);\n return !Number.isNaN(value) && value > 0 ? value : undefined;\n};\n\nconst parseFocal = (raw: unknown): { x: number; y: number } | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n const parts = raw.split(\",\").map(v => parseFloat(v));\n if (parts.length !== 2 || parts.some(n => Number.isNaN(n))) {\n return undefined;\n }\n const clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n return { x: clamp01(parts[0]), y: clamp01(parts[1]) };\n};\n\nconst parseCrop = (\n raw: unknown\n): { top: number; left: number; bottom: number; right: number } | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n const parts = raw.split(\",\").map(v => parseFloat(v));\n if (parts.length !== 4 || parts.some(n => Number.isNaN(n))) {\n return undefined;\n }\n const clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n const [top, left, bottom, right] = parts.map(clamp01);\n if (top === 0 && left === 0 && bottom === 0 && right === 0) {\n return undefined;\n }\n if (top + bottom >= 1 || left + right >= 1) {\n return undefined;\n }\n return { top, left, bottom, right };\n};\n"],"names":["normalizeImageOptions","query","acceptHeader","result","width","parseInt","NaN","Number","quality","undefined","clampQuality","format","resolveRequestedFormat","crop","parseCrop","aspectRatio","parseAspectRatio","focal","parseFocal","raw","w","h","v","parseFloat","value","parts","n","clamp01","Math","top","left","bottom","right"],"mappings":";AAOO,MAAMA,wBAAwB,CACjCC,OACAC;IAEA,MAAMC,SAA8B;QAChC,UAAU,cAAcF;IAC5B;IAEA,MAAMG,QAAQH,MAAM,KAAK,GAAGI,SAASJ,MAAM,KAAK,EAAE,MAAMK;
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/assetTypes/image/normalizeImageOptions.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/normalizeImageOptions.ts"],"sourcesContent":["import type { ImageRequestOptions } from \"./imageTypes.js\";\nimport { clampQuality, resolveRequestedFormat } from \"./imageFormat.js\";\n\n/**\n * Parse raw query params into typed image request options.\n * Returns a new `ImageRequestOptions` object; does not mutate the input.\n */\nexport const normalizeImageOptions = (\n query: Record<string, any>,\n acceptHeader: string | undefined\n): ImageRequestOptions => {\n const result: ImageRequestOptions = {\n original: \"original\" in query\n };\n\n const width = query.width ? parseInt(query.width, 10) : NaN;\n if (!Number.isNaN(width) && width > 0) {\n result.width = width;\n }\n\n const quality =\n query.quality !== undefined ? clampQuality(parseInt(query.quality, 10)) : undefined;\n if (quality !== undefined) {\n result.quality = quality;\n }\n\n const format = resolveRequestedFormat(query.format, acceptHeader);\n if (format) {\n result.format = format;\n }\n\n const crop = parseCrop(query.crop);\n if (crop) {\n result.crop = crop;\n }\n\n const aspectRatio = parseAspectRatio(query.aspectRatio);\n if (aspectRatio) {\n result.aspectRatio = aspectRatio;\n }\n\n const focal = parseFocal(query.focal);\n if (focal) {\n result.focal = focal;\n }\n\n return result;\n};\n\nconst parseAspectRatio = (raw: unknown): number | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n if (raw.includes(\":\")) {\n const [w, h] = raw.split(\":\").map(v => parseFloat(v));\n return w > 0 && h > 0 ? w / h : undefined;\n }\n const value = parseFloat(raw);\n return !Number.isNaN(value) && value > 0 ? value : undefined;\n};\n\nconst parseFocal = (raw: unknown): { x: number; y: number } | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n const parts = raw.split(\",\").map(v => parseFloat(v));\n if (parts.length !== 2 || parts.some(n => Number.isNaN(n))) {\n return undefined;\n }\n const clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n return { x: clamp01(parts[0]), y: clamp01(parts[1]) };\n};\n\nconst parseCrop = (\n raw: unknown\n): { top: number; left: number; bottom: number; right: number } | undefined => {\n if (typeof raw !== \"string\") {\n return undefined;\n }\n const parts = raw.split(\",\").map(v => parseFloat(v));\n if (parts.length !== 4 || parts.some(n => Number.isNaN(n))) {\n return undefined;\n }\n const clamp01 = (n: number) => Math.min(1, Math.max(0, n));\n const [top, left, bottom, right] = parts.map(clamp01);\n if (top === 0 && left === 0 && bottom === 0 && right === 0) {\n return undefined;\n }\n if (top + bottom >= 1 || left + right >= 1) {\n return undefined;\n }\n return { top, left, bottom, right };\n};\n"],"names":["normalizeImageOptions","query","acceptHeader","result","width","parseInt","NaN","Number","quality","undefined","clampQuality","format","resolveRequestedFormat","crop","parseCrop","aspectRatio","parseAspectRatio","focal","parseFocal","raw","w","h","v","parseFloat","value","parts","n","clamp01","Math","top","left","bottom","right"],"mappings":";AAOO,MAAMA,wBAAwB,CACjCC,OACAC;IAEA,MAAMC,SAA8B;QAChC,UAAU,cAAcF;IAC5B;IAEA,MAAMG,QAAQH,MAAM,KAAK,GAAGI,SAASJ,MAAM,KAAK,EAAE,MAAMK,KAAG;IAC3D,IAAI,CAACC,OAAO,KAAK,CAACH,UAAUA,QAAQ,GAChCD,OAAO,KAAK,GAAGC;IAGnB,MAAMI,UACFP,AAAkBQ,WAAlBR,MAAM,OAAO,GAAiBS,aAAaL,SAASJ,MAAM,OAAO,EAAE,OAAOQ;IAC9E,IAAID,AAAYC,WAAZD,SACAL,OAAO,OAAO,GAAGK;IAGrB,MAAMG,SAASC,uBAAuBX,MAAM,MAAM,EAAEC;IACpD,IAAIS,QACAR,OAAO,MAAM,GAAGQ;IAGpB,MAAME,OAAOC,UAAUb,MAAM,IAAI;IACjC,IAAIY,MACAV,OAAO,IAAI,GAAGU;IAGlB,MAAME,cAAcC,iBAAiBf,MAAM,WAAW;IACtD,IAAIc,aACAZ,OAAO,WAAW,GAAGY;IAGzB,MAAME,QAAQC,WAAWjB,MAAM,KAAK;IACpC,IAAIgB,OACAd,OAAO,KAAK,GAAGc;IAGnB,OAAOd;AACX;AAEA,MAAMa,mBAAmB,CAACG;IACtB,IAAI,AAAe,YAAf,OAAOA,KACP;IAEJ,IAAIA,IAAI,QAAQ,CAAC,MAAM;QACnB,MAAM,CAACC,GAAGC,EAAE,GAAGF,IAAI,KAAK,CAAC,KAAK,GAAG,CAACG,CAAAA,IAAKC,WAAWD;QAClD,OAAOF,IAAI,KAAKC,IAAI,IAAID,IAAIC,IAAIZ;IACpC;IACA,MAAMe,QAAQD,WAAWJ;IACzB,OAAO,CAACZ,OAAO,KAAK,CAACiB,UAAUA,QAAQ,IAAIA,QAAQf;AACvD;AAEA,MAAMS,aAAa,CAACC;IAChB,IAAI,AAAe,YAAf,OAAOA,KACP;IAEJ,MAAMM,QAAQN,IAAI,KAAK,CAAC,KAAK,GAAG,CAACG,CAAAA,IAAKC,WAAWD;IACjD,IAAIG,AAAiB,MAAjBA,MAAM,MAAM,IAAUA,MAAM,IAAI,CAACC,CAAAA,IAAKnB,OAAO,KAAK,CAACmB,KACnD;IAEJ,MAAMC,UAAU,CAACD,IAAcE,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC,GAAGF;IACvD,OAAO;QAAE,GAAGC,QAAQF,KAAK,CAAC,EAAE;QAAG,GAAGE,QAAQF,KAAK,CAAC,EAAE;IAAE;AACxD;AAEA,MAAMX,YAAY,CACdK;IAEA,IAAI,AAAe,YAAf,OAAOA,KACP;IAEJ,MAAMM,QAAQN,IAAI,KAAK,CAAC,KAAK,GAAG,CAACG,CAAAA,IAAKC,WAAWD;IACjD,IAAIG,AAAiB,MAAjBA,MAAM,MAAM,IAAUA,MAAM,IAAI,CAACC,CAAAA,IAAKnB,OAAO,KAAK,CAACmB,KACnD;IAEJ,MAAMC,UAAU,CAACD,IAAcE,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC,GAAGF;IACvD,MAAM,CAACG,KAAKC,MAAMC,QAAQC,MAAM,GAAGP,MAAM,GAAG,CAACE;IAC7C,IAAIE,AAAQ,MAARA,OAAaC,AAAS,MAATA,QAAcC,AAAW,MAAXA,UAAgBC,AAAU,MAAVA,OAC3C;IAEJ,IAAIH,MAAME,UAAU,KAAKD,OAAOE,SAAS,GACrC;IAEJ,OAAO;QAAEH;QAAKC;QAAMC;QAAQC;IAAM;AACtC"}
|
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
import { createFeature } from "@webiny/feature/api";
|
|
2
|
-
import {
|
|
2
|
+
import { FeatureFlags } from "@webiny/api-core/features/featureFlags/abstractions.js";
|
|
3
|
+
import { AssetProcessor } from "./abstractions.js";
|
|
4
|
+
import { FilesAssetRequestResolverImpl } from "./FilesAssetRequestResolver.js";
|
|
5
|
+
import { NullAssetResolverImpl } from "./NullAssetResolver.js";
|
|
6
|
+
import { NullAssetOutputStrategyImpl } from "./NullAssetOutputStrategy.js";
|
|
3
7
|
import { AssetFactory } from "./Asset/Asset.js";
|
|
4
|
-
import { AssetRequestFactory } from "./AssetRequest/AssetRequest.js";
|
|
5
|
-
import { FilesAssetRequestResolver } from "./FilesAssetRequestResolver.js";
|
|
6
|
-
import { NullAssetResolver } from "./NullAssetResolver.js";
|
|
7
|
-
import { NullAssetOutputStrategy } from "./NullAssetOutputStrategy.js";
|
|
8
|
-
import { StreamAssetReply } from "./StreamAssetReply/StreamAssetReply.js";
|
|
9
8
|
import { ObjectKey } from "./ObjectKey/ObjectKey.js";
|
|
10
|
-
import {
|
|
9
|
+
import { StreamAssetReply } from "./StreamAssetReply/StreamAssetReply.js";
|
|
11
10
|
import { TransformationAssetProcessor } from "./transformation/TransformationAssetProcessor.js";
|
|
12
11
|
import { ImageAssetType } from "./assetTypes/image/ImageAssetType.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { PrivateFileAssetRequestResolverDecorator } from "./privateFiles/PrivateFileAssetRequestResolver.js";
|
|
13
|
+
import { PrivateAuthenticatedAuthorizerImpl } from "./privateFiles/PrivateAuthenticatedAuthorizer.js";
|
|
14
|
+
import { PrivateFilesAssetProcessorDecorator } from "./privateFiles/PrivateFilesAssetProcessor.js";
|
|
16
15
|
const AssetDeliveryFeature = createFeature({
|
|
17
16
|
name: "AssetDelivery",
|
|
18
17
|
register (container) {
|
|
18
|
+
container.register(FilesAssetRequestResolverImpl);
|
|
19
|
+
container.register(NullAssetResolverImpl);
|
|
20
|
+
container.register(NullAssetOutputStrategyImpl);
|
|
19
21
|
container.register(AssetFactory).inSingletonScope();
|
|
20
|
-
container.register(AssetRequestFactory).inSingletonScope();
|
|
21
|
-
container.register(FilesAssetRequestResolver).inSingletonScope();
|
|
22
|
-
container.register(NullAssetResolver).inSingletonScope();
|
|
23
|
-
container.register(NullAssetOutputStrategy).inSingletonScope();
|
|
24
|
-
container.register(StreamAssetReply).inSingletonScope();
|
|
25
22
|
container.register(ObjectKey).inSingletonScope();
|
|
23
|
+
container.register(StreamAssetReply).inSingletonScope();
|
|
26
24
|
container.register(ImageAssetType);
|
|
27
25
|
container.registerInstance(AssetProcessor, new TransformationAssetProcessor(container));
|
|
28
|
-
container.registerDecorator(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
container.
|
|
32
|
-
container.registerDecorator(PrivateFilesAssetProcessor);
|
|
26
|
+
container.registerDecorator(PrivateFileAssetRequestResolverDecorator);
|
|
27
|
+
if (container.resolve(FeatureFlags).get().isEnabled("advancedAccessControlLayer.privateFiles")) {
|
|
28
|
+
container.register(PrivateAuthenticatedAuthorizerImpl);
|
|
29
|
+
container.registerDecorator(PrivateFilesAssetProcessorDecorator);
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/assetDelivery/feature.js","sources":["../../../src/features/assetDelivery/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/feature.js","sources":["../../../src/features/assetDelivery/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { FeatureFlags } from \"@webiny/api-core/features/featureFlags/abstractions.js\";\nimport { AssetProcessor } from \"./abstractions.js\";\nimport { FilesAssetRequestResolverImpl } from \"./FilesAssetRequestResolver.js\";\nimport { NullAssetResolverImpl } from \"./NullAssetResolver.js\";\nimport { NullAssetOutputStrategyImpl } from \"./NullAssetOutputStrategy.js\";\nimport { AssetFactory } from \"./Asset/Asset.js\";\nimport { ObjectKey } from \"./ObjectKey/ObjectKey.js\";\nimport { StreamAssetReply } from \"./StreamAssetReply/StreamAssetReply.js\";\nimport { TransformationAssetProcessor } from \"./transformation/TransformationAssetProcessor.js\";\nimport { ImageAssetType } from \"./assetTypes/image/ImageAssetType.js\";\nimport { PrivateFileAssetRequestResolverDecorator } from \"./privateFiles/PrivateFileAssetRequestResolver.js\";\nimport { PrivateAuthenticatedAuthorizerImpl } from \"./privateFiles/PrivateAuthenticatedAuthorizer.js\";\nimport { PrivateFilesAssetProcessorDecorator } from \"./privateFiles/PrivateFilesAssetProcessor.js\";\n\nexport const AssetDeliveryFeature = createFeature({\n name: \"AssetDelivery\",\n register(container) {\n container.register(FilesAssetRequestResolverImpl);\n container.register(NullAssetResolverImpl);\n container.register(NullAssetOutputStrategyImpl);\n container.register(AssetFactory).inSingletonScope();\n container.register(ObjectKey).inSingletonScope();\n container.register(StreamAssetReply).inSingletonScope();\n container.register(ImageAssetType);\n container.registerInstance(AssetProcessor, new TransformationAssetProcessor(container));\n\n container.registerDecorator(PrivateFileAssetRequestResolverDecorator);\n\n // Register-time gate on the effective feature flags (userFlag && live WCP license). Valid at\n // register() time because the license is refreshed PRE-register (WcpLicenseLoader.load in\n // registerApiRequestStack) and FeatureFlags reads that process cache — and it re-evaluates per\n // request since the child re-registers, so a license change takes effect on the next request.\n if (\n container\n .resolve(FeatureFlags)\n .get()\n .isEnabled(\"advancedAccessControlLayer.privateFiles\")\n ) {\n container.register(PrivateAuthenticatedAuthorizerImpl);\n container.registerDecorator(PrivateFilesAssetProcessorDecorator);\n }\n }\n});\n"],"names":["AssetDeliveryFeature","createFeature","container","FilesAssetRequestResolverImpl","NullAssetResolverImpl","NullAssetOutputStrategyImpl","AssetFactory","ObjectKey","StreamAssetReply","ImageAssetType","AssetProcessor","TransformationAssetProcessor","PrivateFileAssetRequestResolverDecorator","FeatureFlags","PrivateAuthenticatedAuthorizerImpl","PrivateFilesAssetProcessorDecorator"],"mappings":";;;;;;;;;;;;;;AAeO,MAAMA,uBAAuBC,cAAc;IAC9C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;QACnBF,UAAU,QAAQ,CAACG;QACnBH,UAAU,QAAQ,CAACI,cAAc,gBAAgB;QACjDJ,UAAU,QAAQ,CAACK,WAAW,gBAAgB;QAC9CL,UAAU,QAAQ,CAACM,kBAAkB,gBAAgB;QACrDN,UAAU,QAAQ,CAACO;QACnBP,UAAU,gBAAgB,CAACQ,gBAAgB,IAAIC,6BAA6BT;QAE5EA,UAAU,iBAAiB,CAACU;QAM5B,IACIV,UACK,OAAO,CAACW,cACR,GAAG,GACH,SAAS,CAAC,4CACjB;YACEX,UAAU,QAAQ,CAACY;YACnBZ,UAAU,iBAAiB,CAACa;QAChC;IACJ;AACJ"}
|