@webiny/api-file-manager 6.4.11 → 6.6.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FileManagerAppFeature.d.ts +5 -0
- package/FileManagerAppFeature.js +21 -0
- package/FileManagerAppFeature.js.map +1 -0
- package/delivery/AssetDelivery/AssetRequest.d.ts +1 -1
- package/delivery/AssetDelivery/AssetRequest.js.map +1 -1
- package/delivery/AssetDeliveryRoute.d.ts +23 -0
- package/delivery/AssetDeliveryRoute.js +58 -0
- package/delivery/AssetDeliveryRoute.js.map +1 -0
- package/delivery/setupAssetDelivery.d.ts +1 -1
- package/delivery/setupAssetDelivery.js +1 -66
- 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 +10 -6
- package/domain/file/file.model.js.map +1 -1
- package/domain/settings/validation.js +1 -1
- package/domain/settings/validation.js.map +1 -1
- package/exports/api/file-manager/assetDelivery.d.ts +10 -0
- package/exports/api/file-manager/assetDelivery.js +8 -0
- package/exports/api/file-manager/file.d.ts +1 -0
- package/exports/api/file-manager/file.js +1 -0
- package/features/FileManagerFeature.js +6 -0
- package/features/FileManagerFeature.js.map +1 -1
- package/features/assetDelivery/Asset/Asset.d.ts +8 -0
- package/features/assetDelivery/Asset/Asset.js +14 -0
- package/features/assetDelivery/Asset/Asset.js.map +1 -0
- package/features/assetDelivery/Asset/abstractions.d.ts +10 -0
- package/features/assetDelivery/Asset/abstractions.js +5 -0
- package/features/assetDelivery/Asset/abstractions.js.map +1 -0
- package/features/assetDelivery/Asset/index.d.ts +1 -0
- package/features/assetDelivery/Asset/index.js +1 -0
- package/features/assetDelivery/FilesAssetRequestResolver.js +2 -2
- package/features/assetDelivery/FilesAssetRequestResolver.js.map +1 -1
- package/features/assetDelivery/ObjectKey/ObjectKey.d.ts +8 -0
- package/features/assetDelivery/ObjectKey/ObjectKey.js +28 -0
- package/features/assetDelivery/ObjectKey/ObjectKey.js.map +1 -0
- package/features/assetDelivery/ObjectKey/abstractions.d.ts +12 -0
- package/features/assetDelivery/ObjectKey/abstractions.js +5 -0
- package/features/assetDelivery/ObjectKey/abstractions.js.map +1 -0
- package/features/assetDelivery/ObjectKey/index.d.ts +1 -0
- package/features/assetDelivery/ObjectKey/index.js +1 -0
- package/features/assetDelivery/StreamAssetReply/StreamAssetReply.d.ts +8 -0
- package/features/assetDelivery/StreamAssetReply/StreamAssetReply.js +22 -0
- package/features/assetDelivery/StreamAssetReply/StreamAssetReply.js.map +1 -0
- package/features/assetDelivery/StreamAssetReply/abstractions.d.ts +11 -0
- package/features/assetDelivery/StreamAssetReply/abstractions.js +5 -0
- package/features/assetDelivery/StreamAssetReply/abstractions.js.map +1 -0
- package/features/assetDelivery/StreamAssetReply/index.d.ts +1 -0
- package/features/assetDelivery/StreamAssetReply/index.js +1 -0
- package/features/assetDelivery/abstractions/AssetType.d.ts +17 -0
- package/features/assetDelivery/abstractions/AssetType.js +5 -0
- package/features/assetDelivery/abstractions/AssetType.js.map +1 -0
- package/features/assetDelivery/abstractions.d.ts +23 -12
- package/features/assetDelivery/abstractions.js.map +1 -1
- package/features/assetDelivery/assetTypes/image/AssetKeyGenerator.d.ts +12 -0
- package/features/assetDelivery/assetTypes/image/AssetKeyGenerator.js +30 -0
- package/features/assetDelivery/assetTypes/image/AssetKeyGenerator.js.map +1 -0
- package/features/assetDelivery/assetTypes/image/ImageAssetType.d.ts +9 -0
- package/features/assetDelivery/assetTypes/image/ImageAssetType.js +18 -0
- package/features/assetDelivery/assetTypes/image/ImageAssetType.js.map +1 -0
- package/features/assetDelivery/assetTypes/image/ImageAssetTypeHandler.d.ts +5 -0
- package/features/assetDelivery/assetTypes/image/ImageAssetTypeHandler.js +5 -0
- package/features/assetDelivery/assetTypes/image/ImageAssetTypeHandler.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/WidthCollection.d.ts +8 -0
- package/features/assetDelivery/assetTypes/image/WidthCollection.js +22 -0
- package/features/assetDelivery/assetTypes/image/WidthCollection.js.map +1 -0
- package/features/assetDelivery/assetTypes/image/imageFormat.d.ts +26 -0
- package/features/assetDelivery/assetTypes/image/imageFormat.js +51 -0
- package/features/assetDelivery/assetTypes/image/imageFormat.js.map +1 -0
- package/features/assetDelivery/assetTypes/image/imageTypes.d.ts +39 -0
- package/features/assetDelivery/assetTypes/image/imageTypes.js +0 -0
- package/features/assetDelivery/assetTypes/image/index.d.ts +5 -0
- package/features/assetDelivery/assetTypes/image/index.js +4 -0
- package/features/assetDelivery/assetTypes/image/normalizeImageOptions.d.ts +6 -0
- package/features/assetDelivery/assetTypes/image/normalizeImageOptions.js +56 -0
- package/features/assetDelivery/assetTypes/image/normalizeImageOptions.js.map +1 -0
- package/features/assetDelivery/assetTypes/image/transformImage.d.ts +59 -0
- package/features/assetDelivery/assetTypes/image/transformImage.js +146 -0
- package/features/assetDelivery/assetTypes/image/transformImage.js.map +1 -0
- package/features/assetDelivery/assetTypes/image/utils.d.ts +26 -0
- package/features/assetDelivery/assetTypes/image/utils.js +47 -0
- package/features/assetDelivery/assetTypes/image/utils.js.map +1 -0
- package/features/assetDelivery/feature.js +13 -7
- package/features/assetDelivery/feature.js.map +1 -1
- package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +2 -2
- package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -1
- package/features/assetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -1
- package/features/assetDelivery/transformation/CallableContentsReader.d.ts +11 -0
- package/features/assetDelivery/transformation/CallableContentsReader.js +14 -0
- package/features/assetDelivery/transformation/CallableContentsReader.js.map +1 -0
- package/features/assetDelivery/transformation/TransformationAssetProcessor.d.ts +4 -6
- package/features/assetDelivery/transformation/TransformationAssetProcessor.js +13 -11
- package/features/assetDelivery/transformation/TransformationAssetProcessor.js.map +1 -1
- package/features/assetDelivery/transformation/index.d.ts +5 -0
- package/features/assetDelivery/transformation/index.js +4 -0
- package/features/extractMetadata/ExtractMetadataHandler.d.ts +11 -0
- package/features/extractMetadata/ExtractMetadataHandler.js +25 -0
- package/features/extractMetadata/ExtractMetadataHandler.js.map +1 -0
- package/features/extractMetadata/ExtractMetadataInput.d.ts +3 -0
- package/features/extractMetadata/ExtractMetadataInput.js +0 -0
- 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 +14 -0
- package/features/file/FileUrlGenerator/FileUrlGenerator.js +25 -0
- package/features/file/FileUrlGenerator/FileUrlGenerator.js.map +1 -0
- package/features/file/FileUrlGenerator/abstractions.d.ts +3 -3
- package/features/file/FileUrlGenerator/abstractions.js +1 -1
- package/features/file/FileUrlGenerator/abstractions.js.map +1 -1
- package/features/file/FileUrlGenerator/feature.d.ts +4 -0
- package/features/file/FileUrlGenerator/feature.js +11 -0
- package/features/file/FileUrlGenerator/feature.js.map +1 -0
- package/features/file/FileUrlGenerator/index.d.ts +1 -0
- package/features/file/FileUrlGenerator/index.js +1 -0
- 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/GetFileByUrl/GetFileByUrlUseCase.d.ts +15 -0
- package/features/file/GetFileByUrl/GetFileByUrlUseCase.js +37 -0
- package/features/file/GetFileByUrl/GetFileByUrlUseCase.js.map +1 -0
- package/features/file/GetFileByUrl/abstractions.d.ts +18 -0
- package/features/file/GetFileByUrl/abstractions.js +5 -0
- package/features/file/GetFileByUrl/abstractions.js.map +1 -0
- package/features/file/GetFileByUrl/feature.d.ts +4 -0
- package/features/file/GetFileByUrl/feature.js +11 -0
- package/features/file/GetFileByUrl/feature.js.map +1 -0
- package/features/file/GetFileByUrl/index.d.ts +1 -0
- package/features/file/GetFileByUrl/index.js +1 -0
- 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 +5 -0
- package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +5 -0
- 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.d.ts +3 -1
- package/features/settings/SettingsInstaller/SettingsInstaller.js +7 -4
- package/features/settings/SettingsInstaller/SettingsInstaller.js.map +1 -1
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js +0 -1
- package/features/settings/UpdateSettings/UpdateSettingsUseCase.js.map +1 -1
- package/features/upload/CompleteMultiPartUpload/abstractions.d.ts +12 -0
- package/features/upload/CompleteMultiPartUpload/abstractions.js +5 -0
- package/features/upload/CompleteMultiPartUpload/abstractions.js.map +1 -0
- package/features/upload/CompleteMultiPartUpload/index.d.ts +1 -0
- package/features/upload/CompleteMultiPartUpload/index.js +1 -0
- package/features/upload/CreateMultiPartUpload/abstractions.d.ts +14 -0
- package/features/upload/CreateMultiPartUpload/abstractions.js +5 -0
- package/features/upload/CreateMultiPartUpload/abstractions.js.map +1 -0
- package/features/upload/CreateMultiPartUpload/index.d.ts +1 -0
- package/features/upload/CreateMultiPartUpload/index.js +1 -0
- package/features/upload/GetUploadPayload/abstractions.d.ts +10 -0
- package/features/upload/GetUploadPayload/abstractions.js +5 -0
- package/features/upload/GetUploadPayload/abstractions.js.map +1 -0
- package/features/upload/GetUploadPayload/index.d.ts +1 -0
- package/features/upload/GetUploadPayload/index.js +1 -0
- package/features/upload/ReadFileMetadata/MetadataReader.d.ts +11 -0
- package/features/upload/ReadFileMetadata/MetadataReader.js +21 -0
- package/features/upload/ReadFileMetadata/MetadataReader.js.map +1 -0
- package/features/upload/ReadFileMetadata/abstractions.d.ts +15 -0
- package/features/upload/ReadFileMetadata/abstractions.js +5 -0
- package/features/upload/ReadFileMetadata/abstractions.js.map +1 -0
- package/features/upload/ReadFileMetadata/feature.d.ts +4 -0
- package/features/upload/ReadFileMetadata/feature.js +11 -0
- package/features/upload/ReadFileMetadata/feature.js.map +1 -0
- package/features/upload/ReadFileMetadata/index.d.ts +1 -0
- package/features/upload/ReadFileMetadata/index.js +1 -0
- package/features/upload/WriteFileMetadata/MetadataWriter.d.ts +14 -0
- package/features/upload/WriteFileMetadata/MetadataWriter.js +36 -0
- package/features/upload/WriteFileMetadata/MetadataWriter.js.map +1 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterBatchCreateHandler.d.ts +11 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterBatchCreateHandler.js +20 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterBatchCreateHandler.js.map +1 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterCreateHandler.d.ts +11 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterCreateHandler.js +22 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterCreateHandler.js.map +1 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterUpdateHandler.d.ts +11 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterUpdateHandler.js +22 -0
- package/features/upload/WriteFileMetadata/WriteMetadataAfterUpdateHandler.js.map +1 -0
- package/features/upload/WriteFileMetadata/abstractions.d.ts +9 -0
- package/features/upload/WriteFileMetadata/abstractions.js +5 -0
- package/features/upload/WriteFileMetadata/abstractions.js.map +1 -0
- package/features/upload/WriteFileMetadata/feature.d.ts +4 -0
- package/features/upload/WriteFileMetadata/feature.js +17 -0
- package/features/upload/WriteFileMetadata/feature.js.map +1 -0
- package/features/upload/index.d.ts +17 -0
- package/features/upload/index.js +10 -0
- package/features/upload/types.d.ts +28 -0
- package/features/upload/types.js +0 -0
- package/features/upload/utils/FileExtension.d.ts +6 -0
- package/features/upload/utils/FileExtension.js +16 -0
- package/features/upload/utils/FileExtension.js.map +1 -0
- package/features/upload/utils/FileKey.d.ts +11 -0
- package/features/upload/utils/FileKey.js +33 -0
- package/features/upload/utils/FileKey.js.map +1 -0
- package/features/upload/utils/FileNormalizer.d.ts +13 -0
- package/features/upload/utils/FileNormalizer.js +41 -0
- package/features/upload/utils/FileNormalizer.js.map +1 -0
- package/features/upload/utils/FileUploadModifier.d.ts +30 -0
- package/features/upload/utils/FileUploadModifier.js +39 -0
- package/features/upload/utils/FileUploadModifier.js.map +1 -0
- package/features/upload/utils/checkPermissions.d.ts +5 -0
- package/features/upload/utils/checkPermissions.js +22 -0
- package/features/upload/utils/checkPermissions.js.map +1 -0
- package/features/upload/utils/createFileNormalizerFromContext.d.ts +3 -0
- package/features/upload/utils/createFileNormalizerFromContext.js +9 -0
- package/features/upload/utils/createFileNormalizerFromContext.js.map +1 -0
- package/features/upload/utils/mimeTypes.d.ts +1 -0
- package/features/upload/utils/mimeTypes.js +9 -0
- package/features/upload/utils/mimeTypes.js.map +1 -0
- package/graphql/FmGraphQLSchema.d.ts +25 -0
- package/graphql/FmGraphQLSchema.js +452 -0
- package/graphql/FmGraphQLSchema.js.map +1 -0
- package/index.d.ts +3 -6
- package/index.js +3 -33
- package/index.js.map +1 -1
- package/package.json +23 -17
- package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +0 -9
- package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js +0 -13
- package/features/assetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +0 -1
- package/graphql/baseSchema.d.ts +0 -3
- package/graphql/baseSchema.js +0 -100
- package/graphql/baseSchema.js.map +0 -1
- package/graphql/createFilesTypeDefs.d.ts +0 -8
- package/graphql/createFilesTypeDefs.js +0 -191
- package/graphql/createFilesTypeDefs.js.map +0 -1
- package/graphql/filesSchema.d.ts +0 -4
- package/graphql/filesSchema.js +0 -97
- package/graphql/filesSchema.js.map +0 -1
- package/graphql/getFileByUrl.d.ts +0 -3
- package/graphql/getFileByUrl.js +0 -64
- package/graphql/getFileByUrl.js.map +0 -1
- package/graphql/index.d.ts +0 -4
- package/graphql/index.js +0 -48
- package/graphql/index.js.map +0 -1
- package/graphql/utils.d.ts +0 -11
- package/graphql/utils.js +0 -12
- package/graphql/utils.js.map +0 -1
- package/modelModifier/CmsModelModifier.d.ts +0 -26
- package/modelModifier/CmsModelModifier.js +0 -51
- package/modelModifier/CmsModelModifier.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ObjectKey } from "./abstractions.js";
|
|
2
|
+
class ObjectKeyInstance {
|
|
3
|
+
static create(bucketKey) {
|
|
4
|
+
return new ObjectKeyInstance(bucketKey);
|
|
5
|
+
}
|
|
6
|
+
constructor(bucketKey){
|
|
7
|
+
this.bucketKey = bucketKey;
|
|
8
|
+
}
|
|
9
|
+
id() {
|
|
10
|
+
const [id] = this.relativeKey().split("/");
|
|
11
|
+
return id;
|
|
12
|
+
}
|
|
13
|
+
relativeKey() {
|
|
14
|
+
return this.bucketKey.replace(/^tenants\/[^/]+\/files\//, "");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class ObjectKeyImpl {
|
|
18
|
+
from(key) {
|
|
19
|
+
return ObjectKeyInstance.create(key);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const ObjectKey_ObjectKey = ObjectKey.createImplementation({
|
|
23
|
+
implementation: ObjectKeyImpl,
|
|
24
|
+
dependencies: []
|
|
25
|
+
});
|
|
26
|
+
export { ObjectKey_ObjectKey as ObjectKey };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=ObjectKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/ObjectKey/ObjectKey.js","sources":["../../../../src/features/assetDelivery/ObjectKey/ObjectKey.ts"],"sourcesContent":["import {\n ObjectKey as ObjectKeyAbstraction,\n type IObjectKey,\n type IObjectKeyInstance\n} from \"./abstractions.js\";\n\nclass ObjectKeyInstance implements IObjectKeyInstance {\n public static create(bucketKey: string) {\n return new ObjectKeyInstance(bucketKey);\n }\n\n private constructor(private readonly bucketKey: string) {}\n\n public id(): string {\n const [id] = this.relativeKey().split(\"/\");\n return id;\n }\n\n public relativeKey(): string {\n return this.bucketKey.replace(/^tenants\\/[^/]+\\/files\\//, \"\");\n }\n}\n\nclass ObjectKeyImpl implements IObjectKey {\n public from(key: string): IObjectKeyInstance {\n return ObjectKeyInstance.create(key);\n }\n}\n\nexport const ObjectKey = ObjectKeyAbstraction.createImplementation({\n implementation: ObjectKeyImpl,\n dependencies: []\n});\n"],"names":["ObjectKeyInstance","bucketKey","id","ObjectKeyImpl","key","ObjectKey","ObjectKeyAbstraction"],"mappings":";AAMA,MAAMA;IACF,OAAc,OAAOC,SAAiB,EAAE;QACpC,OAAO,IAAID,kBAAkBC;IACjC;IAEA,YAAqCA,SAAiB,CAAE;aAAnBA,SAAS,GAATA;IAAoB;IAElD,KAAa;QAChB,MAAM,CAACC,GAAG,GAAG,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACtC,OAAOA;IACX;IAEO,cAAsB;QACzB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,4BAA4B;IAC9D;AACJ;AAEA,MAAMC;IACK,KAAKC,GAAW,EAAsB;QACzC,OAAOJ,kBAAkB,MAAM,CAACI;IACpC;AACJ;AAEO,MAAMC,sBAAYC,UAAAA,oBAAyC,CAAC;IAC/D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface IObjectKeyInstance {
|
|
2
|
+
id(): string;
|
|
3
|
+
relativeKey(): string;
|
|
4
|
+
}
|
|
5
|
+
export interface IObjectKey {
|
|
6
|
+
from(key: string): IObjectKeyInstance;
|
|
7
|
+
}
|
|
8
|
+
export declare const ObjectKey: import("@webiny/di").Abstraction<IObjectKey>;
|
|
9
|
+
export declare namespace ObjectKey {
|
|
10
|
+
type Interface = IObjectKey;
|
|
11
|
+
type Instance = IObjectKeyInstance;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/ObjectKey/abstractions.js","sources":["../../../../src/features/assetDelivery/ObjectKey/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\n\nexport interface IObjectKeyInstance {\n id(): string;\n relativeKey(): string;\n}\n\nexport interface IObjectKey {\n from(key: string): IObjectKeyInstance;\n}\n\nexport const ObjectKey = createAbstraction<IObjectKey>(\"AssetDelivery/ObjectKey\");\n\nexport namespace ObjectKey {\n export type Interface = IObjectKey;\n export type Instance = IObjectKeyInstance;\n}\n"],"names":["ObjectKey","createAbstraction"],"mappings":";AAWO,MAAMA,YAAYC,kBAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ObjectKey } from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ObjectKey } from "./abstractions.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StreamAssetReply as StreamAssetReplyAbstraction } from "./abstractions.js";
|
|
2
|
+
declare class StreamAssetReplyImpl implements StreamAssetReplyAbstraction.Interface {
|
|
3
|
+
create(asset: StreamAssetReplyAbstraction.Asset): StreamAssetReplyAbstraction.AssetReply;
|
|
4
|
+
}
|
|
5
|
+
export declare const StreamAssetReply: typeof StreamAssetReplyImpl & {
|
|
6
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IStreamAssetReply>;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
|
|
2
|
+
import { ResponseHeaders } from "@webiny/handler";
|
|
3
|
+
import { StreamAssetReply } from "./abstractions.js";
|
|
4
|
+
class StreamAssetReplyImpl {
|
|
5
|
+
create(asset) {
|
|
6
|
+
return new AssetReply({
|
|
7
|
+
code: 200,
|
|
8
|
+
headers: ResponseHeaders.create({
|
|
9
|
+
"cache-control": "public, max-age=31536000",
|
|
10
|
+
"content-type": asset.getContentType()
|
|
11
|
+
}),
|
|
12
|
+
body: ()=>asset.getContents()
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const StreamAssetReply_StreamAssetReply = StreamAssetReply.createImplementation({
|
|
17
|
+
implementation: StreamAssetReplyImpl,
|
|
18
|
+
dependencies: []
|
|
19
|
+
});
|
|
20
|
+
export { StreamAssetReply_StreamAssetReply as StreamAssetReply };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=StreamAssetReply.js.map
|
|
@@ -0,0 +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 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,11 @@
|
|
|
1
|
+
import type { Asset as IAsset } from "../../../delivery/AssetDelivery/Asset.js";
|
|
2
|
+
import type { AssetReply as IAssetReply } from "../../../delivery/AssetDelivery/abstractions/AssetReply.js";
|
|
3
|
+
export interface IStreamAssetReply {
|
|
4
|
+
create(asset: IAsset): IAssetReply;
|
|
5
|
+
}
|
|
6
|
+
export declare const StreamAssetReply: import("@webiny/di").Abstraction<IStreamAssetReply>;
|
|
7
|
+
export declare namespace StreamAssetReply {
|
|
8
|
+
type Interface = IStreamAssetReply;
|
|
9
|
+
type Asset = IAsset;
|
|
10
|
+
type AssetReply = IAssetReply;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/StreamAssetReply/abstractions.js","sources":["../../../../src/features/assetDelivery/StreamAssetReply/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Asset as IAsset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetReply as IAssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\n\nexport interface IStreamAssetReply {\n create(asset: IAsset): IAssetReply;\n}\n\nexport const StreamAssetReply = createAbstraction<IStreamAssetReply>(\n \"AssetDelivery/StreamAssetReply\"\n);\n\nexport namespace StreamAssetReply {\n export type Interface = IStreamAssetReply;\n export type Asset = IAsset;\n export type AssetReply = IAssetReply;\n}\n"],"names":["StreamAssetReply","createAbstraction"],"mappings":";AAQO,MAAMA,mBAAmBC,kBAC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StreamAssetReply } from "./abstractions.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { StreamAssetReply } from "./abstractions.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Abstraction } from "@webiny/di";
|
|
2
|
+
import type { AssetRequest as IAssetRequest } from "../../../delivery/AssetDelivery/AssetRequest.js";
|
|
3
|
+
import type { Asset as IAsset } from "../../../delivery/AssetDelivery/Asset.js";
|
|
4
|
+
export interface IAssetTypeHandler {
|
|
5
|
+
handle(assetRequest: IAssetRequest, asset: IAsset): Promise<IAsset>;
|
|
6
|
+
}
|
|
7
|
+
export interface IAssetType {
|
|
8
|
+
canHandle(asset: IAsset): boolean;
|
|
9
|
+
getHandlerAbstraction(): Abstraction<IAssetTypeHandler>;
|
|
10
|
+
}
|
|
11
|
+
export declare const AssetType: Abstraction<IAssetType>;
|
|
12
|
+
export declare namespace AssetType {
|
|
13
|
+
type Interface = IAssetType;
|
|
14
|
+
type AssetRequest = IAssetRequest;
|
|
15
|
+
type Asset = IAsset;
|
|
16
|
+
type Handler = IAssetTypeHandler;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/abstractions/AssetType.js","sources":["../../../../src/features/assetDelivery/abstractions/AssetType.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { AssetRequest as IAssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport type { Asset as IAsset } from \"~/delivery/AssetDelivery/Asset.js\";\n\nexport interface IAssetTypeHandler {\n handle(assetRequest: IAssetRequest, asset: IAsset): Promise<IAsset>;\n}\n\nexport interface IAssetType {\n canHandle(asset: IAsset): boolean;\n getHandlerAbstraction(): Abstraction<IAssetTypeHandler>;\n}\n\nexport const AssetType = createAbstraction<IAssetType>(\"AssetDelivery/AssetType\");\n\nexport namespace AssetType {\n export type Interface = IAssetType;\n export type AssetRequest = IAssetRequest;\n export type Asset = IAsset;\n export type Handler = IAssetTypeHandler;\n}\n"],"names":["AssetType","createAbstraction"],"mappings":";AAcO,MAAMA,YAAYC,kBAA8B"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import type { Request } from "@webiny/handler/types.js";
|
|
2
|
-
import type { AssetRequest } from "../../delivery/AssetDelivery/AssetRequest.js";
|
|
3
|
-
import type { Asset } from "../../delivery/AssetDelivery/Asset.js";
|
|
4
|
-
import type { AssetReply } from "../../delivery/AssetDelivery/abstractions/AssetReply.js";
|
|
5
|
-
import type { File } from "../../domain/file/types.js";
|
|
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
6
|
export interface IAssetRequestResolver {
|
|
7
|
-
resolve(request:
|
|
7
|
+
resolve(request: IRequest): Promise<IAssetRequest | undefined>;
|
|
8
8
|
}
|
|
9
9
|
export interface IAssetResolver {
|
|
10
|
-
resolve(request:
|
|
10
|
+
resolve(request: IAssetRequest): Promise<IAsset | undefined>;
|
|
11
11
|
}
|
|
12
12
|
export interface IAssetProcessor {
|
|
13
|
-
process(assetRequest:
|
|
13
|
+
process(assetRequest: IAssetRequest, asset: IAsset): Promise<IAsset>;
|
|
14
14
|
}
|
|
15
15
|
export interface IAssetOutputStrategy {
|
|
16
|
-
output(asset:
|
|
16
|
+
output(asset: IAsset): Promise<IAssetReply>;
|
|
17
17
|
}
|
|
18
18
|
export interface IAssetTransformationStrategy {
|
|
19
|
-
transform(assetRequest:
|
|
19
|
+
transform(assetRequest: IAssetRequest, asset: IAsset): Promise<IAsset>;
|
|
20
20
|
}
|
|
21
21
|
export interface IAssetContentsReader {
|
|
22
|
-
read(asset:
|
|
22
|
+
read(asset: IAsset): Promise<Buffer>;
|
|
23
23
|
}
|
|
24
24
|
export interface IAssetAuthorizer {
|
|
25
|
-
authorize(file:
|
|
25
|
+
authorize(file: IFile): Promise<void>;
|
|
26
26
|
}
|
|
27
27
|
export declare const AssetRequestResolver: import("@webiny/di").Abstraction<IAssetRequestResolver>;
|
|
28
28
|
export declare const AssetResolver: import("@webiny/di").Abstraction<IAssetResolver>;
|
|
@@ -33,21 +33,32 @@ export declare const AssetContentsReader: import("@webiny/di").Abstraction<IAsse
|
|
|
33
33
|
export declare const AssetAuthorizer: import("@webiny/di").Abstraction<IAssetAuthorizer>;
|
|
34
34
|
export declare namespace AssetRequestResolver {
|
|
35
35
|
type Interface = IAssetRequestResolver;
|
|
36
|
+
type AssetRequest = IAssetRequest;
|
|
37
|
+
type Request = IRequest;
|
|
36
38
|
}
|
|
37
39
|
export declare namespace AssetResolver {
|
|
38
40
|
type Interface = IAssetResolver;
|
|
41
|
+
type Asset = IAsset;
|
|
42
|
+
type Request = IAssetRequest;
|
|
39
43
|
}
|
|
40
44
|
export declare namespace AssetProcessor {
|
|
41
45
|
type Interface = IAssetProcessor;
|
|
46
|
+
type AssetRequest = IAssetRequest;
|
|
47
|
+
type Asset = IAsset;
|
|
42
48
|
}
|
|
43
49
|
export declare namespace AssetOutputStrategy {
|
|
44
50
|
type Interface = IAssetOutputStrategy;
|
|
51
|
+
type Asset = IAsset;
|
|
52
|
+
type AssetReply = IAssetReply;
|
|
45
53
|
}
|
|
46
54
|
export declare namespace AssetTransformationStrategy {
|
|
47
55
|
type Interface = IAssetTransformationStrategy;
|
|
56
|
+
type AssetRequest = IAssetRequest;
|
|
57
|
+
type Asset = IAsset;
|
|
48
58
|
}
|
|
49
59
|
export declare namespace AssetContentsReader {
|
|
50
60
|
type Interface = IAssetContentsReader;
|
|
61
|
+
type Asset = IAsset;
|
|
51
62
|
}
|
|
52
63
|
export declare namespace AssetAuthorizer {
|
|
53
64
|
type Interface = IAssetAuthorizer;
|
|
@@ -1 +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 } from \"@webiny/handler/types.js\";\nimport type { AssetRequest } from \"~/delivery/AssetDelivery/AssetRequest.js\";\nimport type { Asset } from \"~/delivery/AssetDelivery/Asset.js\";\nimport type { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply.js\";\nimport type { File } from \"~/domain/file/types.js\";\n\nexport interface IAssetRequestResolver {\n resolve(request:
|
|
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,12 @@
|
|
|
1
|
+
import type { Asset } from "../../../../delivery/index.js";
|
|
2
|
+
import type { Framing } from "./imageTypes.js";
|
|
3
|
+
export declare class AssetKeyGenerator {
|
|
4
|
+
private readonly utils;
|
|
5
|
+
private readonly asset;
|
|
6
|
+
private readonly framing?;
|
|
7
|
+
static create(asset: Asset, framing?: Framing): AssetKeyGenerator;
|
|
8
|
+
private constructor();
|
|
9
|
+
private signature;
|
|
10
|
+
getOptimizedImageKey(): string;
|
|
11
|
+
getTransformedImageKey(transformations: Record<string, any>): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as __rspack_external__utils_js_a9c81ddd from "./utils.js";
|
|
2
|
+
class AssetKeyGenerator {
|
|
3
|
+
static create(asset, framing) {
|
|
4
|
+
return new AssetKeyGenerator(asset, framing);
|
|
5
|
+
}
|
|
6
|
+
constructor(asset, framing){
|
|
7
|
+
this.asset = asset;
|
|
8
|
+
this.utils = __rspack_external__utils_js_a9c81ddd;
|
|
9
|
+
this.framing = framing;
|
|
10
|
+
}
|
|
11
|
+
signature() {
|
|
12
|
+
if (this.framing) return this.utils.getFramingSignature(this.framing);
|
|
13
|
+
}
|
|
14
|
+
getOptimizedImageKey() {
|
|
15
|
+
return this.utils.getImageKey({
|
|
16
|
+
key: this.asset.getKey(),
|
|
17
|
+
cropSignature: this.signature()
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
getTransformedImageKey(transformations) {
|
|
21
|
+
return this.utils.getImageKey({
|
|
22
|
+
key: this.asset.getKey(),
|
|
23
|
+
transformations,
|
|
24
|
+
cropSignature: this.signature()
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export { AssetKeyGenerator };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=AssetKeyGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/assetTypes/image/AssetKeyGenerator.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/AssetKeyGenerator.ts"],"sourcesContent":["import type { Asset } from \"../../../../delivery/index.js\";\nimport type { Framing } from \"./imageTypes.js\";\nimport * as newUtils from \"./utils.js\";\n\nexport class AssetKeyGenerator {\n private readonly utils: typeof newUtils;\n private readonly asset: Asset;\n private readonly framing?: Framing;\n\n public static create(asset: Asset, framing?: Framing) {\n return new AssetKeyGenerator(asset, framing);\n }\n\n private constructor(asset: Asset, framing?: Framing) {\n this.asset = asset;\n this.utils = newUtils;\n this.framing = framing;\n }\n\n private signature() {\n if (this.framing) {\n return this.utils.getFramingSignature(this.framing);\n }\n return undefined;\n }\n\n public getOptimizedImageKey() {\n return this.utils.getImageKey({\n key: this.asset.getKey(),\n cropSignature: this.signature()\n });\n }\n\n public getTransformedImageKey(transformations: Record<string, any>) {\n return this.utils.getImageKey({\n key: this.asset.getKey(),\n transformations,\n cropSignature: this.signature()\n });\n }\n}\n"],"names":["AssetKeyGenerator","asset","framing","newUtils","transformations"],"mappings":";AAIO,MAAMA;IAKT,OAAc,OAAOC,KAAY,EAAEC,OAAiB,EAAE;QAClD,OAAO,IAAIF,kBAAkBC,OAAOC;IACxC;IAEA,YAAoBD,KAAY,EAAEC,OAAiB,CAAE;QACjD,IAAI,CAAC,KAAK,GAAGD;QACb,IAAI,CAAC,KAAK,GAAGE;QACb,IAAI,CAAC,OAAO,GAAGD;IACnB;IAEQ,YAAY;QAChB,IAAI,IAAI,CAAC,OAAO,EACZ,OAAO,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,OAAO;IAG1D;IAEO,uBAAuB;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;YAC1B,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM;YACtB,eAAe,IAAI,CAAC,SAAS;QACjC;IACJ;IAEO,uBAAuBE,eAAoC,EAAE;QAChE,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;YAC1B,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM;YACtBA;YACA,eAAe,IAAI,CAAC,SAAS;QACjC;IACJ;AACJ"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AssetType } from "../../abstractions/AssetType.js";
|
|
2
|
+
declare class ImageAssetTypeImpl implements AssetType.Interface {
|
|
3
|
+
canHandle(asset: AssetType.Asset): boolean;
|
|
4
|
+
getHandlerAbstraction(): import("@webiny/di").Abstraction<import("../../abstractions/AssetType.js").IAssetTypeHandler>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ImageAssetType: typeof ImageAssetTypeImpl & {
|
|
7
|
+
__abstraction: import("@webiny/di").Abstraction<import("../../abstractions/AssetType.js").IAssetType>;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AssetType } from "../../abstractions/AssetType.js";
|
|
2
|
+
import { SUPPORTED_TRANSFORMABLE_IMAGES } from "./utils.js";
|
|
3
|
+
import { ImageAssetTypeHandler } from "./ImageAssetTypeHandler.js";
|
|
4
|
+
class ImageAssetTypeImpl {
|
|
5
|
+
canHandle(asset) {
|
|
6
|
+
return SUPPORTED_TRANSFORMABLE_IMAGES.includes(asset.getExtension());
|
|
7
|
+
}
|
|
8
|
+
getHandlerAbstraction() {
|
|
9
|
+
return ImageAssetTypeHandler;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const ImageAssetType = AssetType.createImplementation({
|
|
13
|
+
implementation: ImageAssetTypeImpl,
|
|
14
|
+
dependencies: []
|
|
15
|
+
});
|
|
16
|
+
export { ImageAssetType };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=ImageAssetType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/assetTypes/image/ImageAssetType.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/ImageAssetType.ts"],"sourcesContent":["import { AssetType } from \"../../abstractions/AssetType.js\";\nimport { SUPPORTED_TRANSFORMABLE_IMAGES } from \"./utils.js\";\nimport { ImageAssetTypeHandler } from \"./ImageAssetTypeHandler.js\";\n\nclass ImageAssetTypeImpl implements AssetType.Interface {\n canHandle(asset: AssetType.Asset): boolean {\n return SUPPORTED_TRANSFORMABLE_IMAGES.includes(asset.getExtension());\n }\n\n getHandlerAbstraction() {\n return ImageAssetTypeHandler;\n }\n}\n\nexport const ImageAssetType = AssetType.createImplementation({\n implementation: ImageAssetTypeImpl,\n dependencies: []\n});\n"],"names":["ImageAssetTypeImpl","asset","SUPPORTED_TRANSFORMABLE_IMAGES","ImageAssetTypeHandler","ImageAssetType","AssetType"],"mappings":";;;AAIA,MAAMA;IACF,UAAUC,KAAsB,EAAW;QACvC,OAAOC,+BAA+B,QAAQ,CAACD,MAAM,YAAY;IACrE;IAEA,wBAAwB;QACpB,OAAOE;IACX;AACJ;AAEO,MAAMC,iBAAiBC,UAAU,oBAAoB,CAAC;IACzD,gBAAgBL;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/assetTypes/image/ImageAssetTypeHandler.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/ImageAssetTypeHandler.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { IAssetTypeHandler } from \"../../abstractions/AssetType.js\";\n\nexport const ImageAssetTypeHandler = createAbstraction<IAssetTypeHandler>(\n \"AssetDelivery/ImageAssetTypeHandler\"\n);\n\nexport namespace ImageAssetTypeHandler {\n export type Interface = IAssetTypeHandler;\n}\n"],"names":["ImageAssetTypeHandler","createAbstraction"],"mappings":";AAGO,MAAMA,wBAAwBC,kBACjC"}
|
|
@@ -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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
class WidthCollection {
|
|
2
|
+
static create(values) {
|
|
3
|
+
return new WidthCollection(values);
|
|
4
|
+
}
|
|
5
|
+
constructor(values){
|
|
6
|
+
this.values = values.sort((a, b)=>a - b);
|
|
7
|
+
}
|
|
8
|
+
max() {
|
|
9
|
+
return Math.max(...this.values);
|
|
10
|
+
}
|
|
11
|
+
min() {
|
|
12
|
+
return Math.min(...this.values);
|
|
13
|
+
}
|
|
14
|
+
getClosestOrMax(value) {
|
|
15
|
+
if (!value) return this.max();
|
|
16
|
+
const gteGivenValue = this.values.filter((w)=>w >= value);
|
|
17
|
+
return gteGivenValue.length > 0 ? gteGivenValue[0] : this.max();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export { WidthCollection };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=WidthCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/assetTypes/image/WidthCollection.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/WidthCollection.ts"],"sourcesContent":["export class WidthCollection {\n private readonly values: number[];\n\n public static create(values: number[]) {\n return new WidthCollection(values);\n }\n\n private constructor(values: number[]) {\n this.values = values.sort((a, b) => a - b);\n }\n\n public max() {\n return Math.max(...this.values);\n }\n\n public min() {\n return Math.min(...this.values);\n }\n\n public getClosestOrMax(value: number | undefined): number {\n if (!value) {\n return this.max();\n }\n const gteGivenValue = this.values.filter(w => w >= value);\n return gteGivenValue.length > 0 ? gteGivenValue[0] : this.max();\n }\n}\n"],"names":["WidthCollection","values","a","b","Math","value","gteGivenValue","w"],"mappings":"AAAO,MAAMA;IAGT,OAAc,OAAOC,MAAgB,EAAE;QACnC,OAAO,IAAID,gBAAgBC;IAC/B;IAEA,YAAoBA,MAAgB,CAAE;QAClC,IAAI,CAAC,MAAM,GAAGA,OAAO,IAAI,CAAC,CAACC,GAAGC,IAAMD,IAAIC;IAC5C;IAEO,MAAM;QACT,OAAOC,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM;IAClC;IAEO,MAAM;QACT,OAAOA,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM;IAClC;IAEO,gBAAgBC,KAAyB,EAAU;QACtD,IAAI,CAACA,OACD,OAAO,IAAI,CAAC,GAAG;QAEnB,MAAMC,gBAAgB,IAAI,CAAC,MAAM,CAAC,MAAM,CAACC,CAAAA,IAAKA,KAAKF;QACnD,OAAOC,cAAc,MAAM,GAAG,IAAIA,aAAa,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG;IACjE;AACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure image-format helpers. IMPORTANT: this module must NOT import `sharp` (a
|
|
3
|
+
* native module). It is reachable from the GraphQL API handler via the asset
|
|
4
|
+
* request resolvers, and loading `sharp` there would crash that Lambda. The
|
|
5
|
+
* actual sharp pipeline lives in `transformImage.ts`, which only the transform
|
|
6
|
+
* strategies (the image Lambda) import.
|
|
7
|
+
*/
|
|
8
|
+
export type ImageFormat = "jpeg" | "png" | "webp" | "avif";
|
|
9
|
+
export declare const SUPPORTED_OUTPUT_FORMATS: ImageFormat[];
|
|
10
|
+
/**
|
|
11
|
+
* Default encoder quality per output format. AVIF reaches a comparable visual
|
|
12
|
+
* quality at a lower number than JPEG/WebP, hence the lower default.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_IMAGE_QUALITY: Record<ImageFormat, number>;
|
|
15
|
+
export declare const contentTypeForFormat: (format: ImageFormat) => string;
|
|
16
|
+
export declare const formatFromContentType: (contentType: string) => ImageFormat | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a requested format string into a concrete output format.
|
|
19
|
+
*
|
|
20
|
+
* `"auto"` negotiates from the `Accept` header (AVIF ▸ WebP ▸ keep original), which
|
|
21
|
+
* is how we approach `next/image`'s automatic modern-format delivery. Returns
|
|
22
|
+
* `undefined` when the original format should be kept.
|
|
23
|
+
*/
|
|
24
|
+
export declare const resolveRequestedFormat: (requested: string | undefined, acceptHeader: string | undefined) => ImageFormat | undefined;
|
|
25
|
+
/** Clamp a requested quality into the valid 1–100 range; `undefined` when absent/invalid. */
|
|
26
|
+
export declare const clampQuality: (value: number | undefined) => number | undefined;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const SUPPORTED_OUTPUT_FORMATS = [
|
|
2
|
+
"jpeg",
|
|
3
|
+
"png",
|
|
4
|
+
"webp",
|
|
5
|
+
"avif"
|
|
6
|
+
];
|
|
7
|
+
const DEFAULT_IMAGE_QUALITY = {
|
|
8
|
+
jpeg: 75,
|
|
9
|
+
png: 80,
|
|
10
|
+
webp: 75,
|
|
11
|
+
avif: 55
|
|
12
|
+
};
|
|
13
|
+
const CONTENT_TYPE_BY_FORMAT = {
|
|
14
|
+
jpeg: "image/jpeg",
|
|
15
|
+
png: "image/png",
|
|
16
|
+
webp: "image/webp",
|
|
17
|
+
avif: "image/avif"
|
|
18
|
+
};
|
|
19
|
+
const contentTypeForFormat = (format)=>CONTENT_TYPE_BY_FORMAT[format];
|
|
20
|
+
const formatFromContentType = (contentType)=>{
|
|
21
|
+
switch(contentType){
|
|
22
|
+
case "image/jpeg":
|
|
23
|
+
case "image/jpg":
|
|
24
|
+
return "jpeg";
|
|
25
|
+
case "image/png":
|
|
26
|
+
return "png";
|
|
27
|
+
case "image/webp":
|
|
28
|
+
return "webp";
|
|
29
|
+
case "image/avif":
|
|
30
|
+
return "avif";
|
|
31
|
+
default:
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const resolveRequestedFormat = (requested, acceptHeader)=>{
|
|
36
|
+
if (!requested) return;
|
|
37
|
+
if ("auto" === requested) {
|
|
38
|
+
const accept = acceptHeader ?? "";
|
|
39
|
+
if (accept.includes("image/avif")) return "avif";
|
|
40
|
+
if (accept.includes("image/webp")) return "webp";
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return SUPPORTED_OUTPUT_FORMATS.includes(requested) ? requested : void 0;
|
|
44
|
+
};
|
|
45
|
+
const clampQuality = (value)=>{
|
|
46
|
+
if (void 0 === value || Number.isNaN(value)) return;
|
|
47
|
+
return Math.min(100, Math.max(1, Math.round(value)));
|
|
48
|
+
};
|
|
49
|
+
export { DEFAULT_IMAGE_QUALITY, SUPPORTED_OUTPUT_FORMATS, clampQuality, contentTypeForFormat, formatFromContentType, resolveRequestedFormat };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=imageFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/assetDelivery/assetTypes/image/imageFormat.js","sources":["../../../../../src/features/assetDelivery/assetTypes/image/imageFormat.ts"],"sourcesContent":["/**\n * Pure image-format helpers. IMPORTANT: this module must NOT import `sharp` (a\n * native module). It is reachable from the GraphQL API handler via the asset\n * request resolvers, and loading `sharp` there would crash that Lambda. The\n * actual sharp pipeline lives in `transformImage.ts`, which only the transform\n * strategies (the image Lambda) import.\n */\n\nexport type ImageFormat = \"jpeg\" | \"png\" | \"webp\" | \"avif\";\n\nexport const SUPPORTED_OUTPUT_FORMATS: ImageFormat[] = [\"jpeg\", \"png\", \"webp\", \"avif\"];\n\n/**\n * Default encoder quality per output format. AVIF reaches a comparable visual\n * quality at a lower number than JPEG/WebP, hence the lower default.\n */\nexport const DEFAULT_IMAGE_QUALITY: Record<ImageFormat, number> = {\n jpeg: 75,\n png: 80,\n webp: 75,\n avif: 55\n};\n\nconst CONTENT_TYPE_BY_FORMAT: Record<ImageFormat, string> = {\n jpeg: \"image/jpeg\",\n png: \"image/png\",\n webp: \"image/webp\",\n avif: \"image/avif\"\n};\n\nexport const contentTypeForFormat = (format: ImageFormat): string => CONTENT_TYPE_BY_FORMAT[format];\n\nexport const formatFromContentType = (contentType: string): ImageFormat | undefined => {\n switch (contentType) {\n case \"image/jpeg\":\n case \"image/jpg\":\n return \"jpeg\";\n case \"image/png\":\n return \"png\";\n case \"image/webp\":\n return \"webp\";\n case \"image/avif\":\n return \"avif\";\n default:\n return undefined;\n }\n};\n\n/**\n * Resolve a requested format string into a concrete output format.\n *\n * `\"auto\"` negotiates from the `Accept` header (AVIF ▸ WebP ▸ keep original), which\n * is how we approach `next/image`'s automatic modern-format delivery. Returns\n * `undefined` when the original format should be kept.\n */\nexport const resolveRequestedFormat = (\n requested: string | undefined,\n acceptHeader: string | undefined\n): ImageFormat | undefined => {\n if (!requested) {\n return undefined;\n }\n\n if (requested === \"auto\") {\n const accept = acceptHeader ?? \"\";\n if (accept.includes(\"image/avif\")) {\n return \"avif\";\n }\n if (accept.includes(\"image/webp\")) {\n return \"webp\";\n }\n return undefined;\n }\n\n return SUPPORTED_OUTPUT_FORMATS.includes(requested as ImageFormat)\n ? (requested as ImageFormat)\n : undefined;\n};\n\n/** Clamp a requested quality into the valid 1–100 range; `undefined` when absent/invalid. */\nexport const clampQuality = (value: number | undefined): number | undefined => {\n if (value === undefined || Number.isNaN(value)) {\n return undefined;\n }\n return Math.min(100, Math.max(1, Math.round(value)));\n};\n"],"names":["SUPPORTED_OUTPUT_FORMATS","DEFAULT_IMAGE_QUALITY","CONTENT_TYPE_BY_FORMAT","contentTypeForFormat","format","formatFromContentType","contentType","resolveRequestedFormat","requested","acceptHeader","accept","undefined","clampQuality","value","Number","Math"],"mappings":"AAUO,MAAMA,2BAA0C;IAAC;IAAQ;IAAO;IAAQ;CAAO;AAM/E,MAAMC,wBAAqD;IAC9D,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;AACV;AAEA,MAAMC,yBAAsD;IACxD,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;AACV;AAEO,MAAMC,uBAAuB,CAACC,SAAgCF,sBAAsB,CAACE,OAAO;AAE5F,MAAMC,wBAAwB,CAACC;IAClC,OAAQA;QACJ,KAAK;QACL,KAAK;YACD,OAAO;QACX,KAAK;YACD,OAAO;QACX,KAAK;YACD,OAAO;QACX,KAAK;YACD,OAAO;QACX;YACI;IACR;AACJ;AASO,MAAMC,yBAAyB,CAClCC,WACAC;IAEA,IAAI,CAACD,WACD;IAGJ,IAAIA,AAAc,WAAdA,WAAsB;QACtB,MAAME,SAASD,gBAAgB;QAC/B,IAAIC,OAAO,QAAQ,CAAC,eAChB,OAAO;QAEX,IAAIA,OAAO,QAAQ,CAAC,eAChB,OAAO;QAEX;IACJ;IAEA,OAAOV,yBAAyB,QAAQ,CAACQ,aAClCA,YACDG;AACV;AAGO,MAAMC,eAAe,CAACC;IACzB,IAAIA,AAAUF,WAAVE,SAAuBC,OAAO,KAAK,CAACD,QACpC;IAEJ,OAAOE,KAAK,GAAG,CAAC,KAAKA,KAAK,GAAG,CAAC,GAAGA,KAAK,KAAK,CAACF;AAChD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ImageFormat } from "./imageFormat.js";
|
|
2
|
+
/** Crop expressed as the fraction (0..1) cut off from each edge of the original. */
|
|
3
|
+
export interface AssetCrop {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
bottom: number;
|
|
7
|
+
right: number;
|
|
8
|
+
}
|
|
9
|
+
/** Asset-level, non-destructive image edit applied at delivery time. */
|
|
10
|
+
export interface AssetImageEdit {
|
|
11
|
+
crop?: AssetCrop;
|
|
12
|
+
}
|
|
13
|
+
/** Image-specific request options parsed from query parameters. */
|
|
14
|
+
export interface ImageRequestOptions {
|
|
15
|
+
original?: boolean;
|
|
16
|
+
width?: number;
|
|
17
|
+
/** Encoder quality (1–100). */
|
|
18
|
+
quality?: number;
|
|
19
|
+
/** Concrete output format (already resolved from any "auto" request). */
|
|
20
|
+
format?: ImageFormat;
|
|
21
|
+
/** Per-request crop (normalized 0–1 edge insets). Supersedes asset-level crop. */
|
|
22
|
+
crop?: AssetCrop;
|
|
23
|
+
/** Target aspect ratio (width / height). */
|
|
24
|
+
aspectRatio?: number;
|
|
25
|
+
/** Normalized 0–1 focal point kept in frame when aspectRatio forces extra cutting. */
|
|
26
|
+
focal?: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/** Combined crop + focal + aspect ratio for cache key generation and pixel extraction. */
|
|
32
|
+
export interface Framing {
|
|
33
|
+
crop?: AssetCrop;
|
|
34
|
+
focal?: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
};
|
|
38
|
+
aspectRatio?: number;
|
|
39
|
+
}
|
|
File without changes
|