@webiny/api-file-manager 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.9bd236cf5e
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/FileManagerContextSetup.d.ts +2 -2
- package/FileManagerContextSetup.js +16 -14
- package/FileManagerContextSetup.js.map +1 -1
- package/README.md +1 -1
- package/cmsFileStorage/CmsFilesStorage.d.ts +3 -3
- package/cmsFileStorage/CmsFilesStorage.js +52 -61
- package/cmsFileStorage/CmsFilesStorage.js.map +1 -1
- package/cmsFileStorage/ListFilesWhereProcessor.d.ts +2 -2
- package/cmsFileStorage/ListFilesWhereProcessor.js +8 -10
- package/cmsFileStorage/ListFilesWhereProcessor.js.map +1 -1
- package/cmsFileStorage/ListTagsWhereProcessor.d.ts +2 -2
- package/cmsFileStorage/ListTagsWhereProcessor.js +8 -10
- package/cmsFileStorage/ListTagsWhereProcessor.js.map +1 -1
- package/cmsFileStorage/file.model.d.ts +5 -3
- package/cmsFileStorage/file.model.js +83 -43
- package/cmsFileStorage/file.model.js.map +1 -1
- package/contants.js +3 -2
- package/contants.js.map +1 -1
- package/createFileManager/files.crud.d.ts +3 -3
- package/createFileManager/files.crud.js +83 -55
- package/createFileManager/files.crud.js.map +1 -1
- package/createFileManager/index.d.ts +2 -14
- package/createFileManager/index.js +8 -5
- package/createFileManager/index.js.map +1 -1
- package/createFileManager/permissions/FilesPermissions.d.ts +1 -1
- package/createFileManager/permissions/FilesPermissions.js +3 -1
- package/createFileManager/permissions/FilesPermissions.js.map +1 -1
- package/createFileManager/permissions/SettingsPermissions.d.ts +4 -0
- package/createFileManager/permissions/SettingsPermissions.js +11 -0
- package/createFileManager/permissions/SettingsPermissions.js.map +1 -0
- package/createFileManager/settings.crud.d.ts +3 -3
- package/createFileManager/settings.crud.js +74 -48
- package/createFileManager/settings.crud.js.map +1 -1
- package/createFileManager/system.crud.d.ts +3 -3
- package/createFileManager/system.crud.js +6 -4
- package/createFileManager/system.crud.js.map +1 -1
- package/createFileManager/types.d.ts +16 -0
- package/createFileManager/types.js +7 -0
- package/createFileManager/types.js.map +1 -0
- package/delivery/AssetDelivery/AliasAssetRequestResolver.d.ts +11 -0
- package/delivery/AssetDelivery/AliasAssetRequestResolver.js +74 -0
- package/delivery/AssetDelivery/AliasAssetRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/Asset.d.ts +32 -0
- package/delivery/AssetDelivery/Asset.js +69 -0
- package/delivery/AssetDelivery/Asset.js.map +1 -0
- package/delivery/AssetDelivery/AssetDeliveryConfig.d.ts +63 -0
- package/delivery/AssetDelivery/AssetDeliveryConfig.js +102 -0
- package/delivery/AssetDelivery/AssetDeliveryConfig.js.map +1 -0
- package/delivery/AssetDelivery/AssetRequest.d.ts +25 -0
- package/delivery/AssetDelivery/AssetRequest.js +29 -0
- package/delivery/AssetDelivery/AssetRequest.js.map +1 -0
- package/delivery/AssetDelivery/FilesAssetRequestResolver.d.ts +6 -0
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js +37 -0
- package/delivery/AssetDelivery/FilesAssetRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/NullAssetOutputStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js +15 -0
- package/delivery/AssetDelivery/NullAssetOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/NullAssetReply.d.ts +4 -0
- package/delivery/AssetDelivery/NullAssetReply.js +20 -0
- package/delivery/AssetDelivery/NullAssetReply.js.map +1 -0
- package/delivery/AssetDelivery/NullAssetResolver.d.ts +5 -0
- package/delivery/AssetDelivery/NullAssetResolver.js +14 -0
- package/delivery/AssetDelivery/NullAssetResolver.js.map +1 -0
- package/delivery/AssetDelivery/NullRequestResolver.d.ts +4 -0
- package/delivery/AssetDelivery/NullRequestResolver.js +14 -0
- package/delivery/AssetDelivery/NullRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/SetCacheControlHeaders.d.ts +8 -0
- package/delivery/AssetDelivery/SetCacheControlHeaders.js +25 -0
- package/delivery/AssetDelivery/SetCacheControlHeaders.js.map +1 -0
- package/delivery/AssetDelivery/SetResponseHeaders.d.ts +18 -0
- package/delivery/AssetDelivery/SetResponseHeaders.js +25 -0
- package/delivery/AssetDelivery/SetResponseHeaders.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.d.ts +6 -0
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js +7 -0
- package/delivery/AssetDelivery/abstractions/AssetContentsReader.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js +7 -0
- package/delivery/AssetDelivery/abstractions/AssetOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetProcessor.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js +7 -0
- package/delivery/AssetDelivery/abstractions/AssetProcessor.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.d.ts +25 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.js +38 -0
- package/delivery/AssetDelivery/abstractions/AssetReply.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.d.ts +5 -0
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js +7 -0
- package/delivery/AssetDelivery/abstractions/AssetRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetResolver.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetResolver.js +7 -0
- package/delivery/AssetDelivery/abstractions/AssetResolver.js.map +1 -0
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js +7 -0
- package/delivery/AssetDelivery/abstractions/AssetTransformationStrategy.js.map +1 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.d.ts +2 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js +15 -0
- package/delivery/AssetDelivery/createAssetDeliveryPluginLoader.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.d.ts +4 -0
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js +7 -0
- package/delivery/AssetDelivery/privateFiles/AssetAuthorizer.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.d.ts +4 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js +26 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedAssetReply.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js +15 -0
- package/delivery/AssetDelivery/privateFiles/NotAuthorizedOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.d.ts +7 -0
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +28 -0
- package/delivery/AssetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PrivateCache.d.ts +6 -0
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js +28 -0
- package/delivery/AssetDelivery/privateFiles/PrivateCache.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.d.ts +8 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +37 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.d.ts +13 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js +63 -0
- package/delivery/AssetDelivery/privateFiles/PrivateFilesAssetProcessor.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/PublicCache.d.ts +6 -0
- package/delivery/AssetDelivery/privateFiles/PublicCache.js +28 -0
- package/delivery/AssetDelivery/privateFiles/PublicCache.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.d.ts +7 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js +27 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPrivateUrlOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.d.ts +7 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js +27 -0
- package/delivery/AssetDelivery/privateFiles/RedirectToPublicUrlOutputStrategy.js.map +1 -0
- package/delivery/AssetDelivery/privateFiles/internalIdentity.d.ts +7 -0
- package/delivery/AssetDelivery/privateFiles/internalIdentity.js +18 -0
- package/delivery/AssetDelivery/privateFiles/internalIdentity.js.map +1 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.d.ts +4 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js +14 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetProcessor.js.map +1 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.d.ts +4 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js +14 -0
- package/delivery/AssetDelivery/transformation/PassthroughAssetTransformationStrategy.js.map +1 -0
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.d.ts +6 -0
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js +26 -0
- package/delivery/AssetDelivery/transformation/TransformationAssetProcessor.js.map +1 -0
- package/delivery/index.d.ts +17 -0
- package/delivery/index.js +194 -0
- package/delivery/index.js.map +1 -0
- package/delivery/setupAssetDelivery.d.ts +6 -0
- package/delivery/setupAssetDelivery.js +128 -0
- package/delivery/setupAssetDelivery.js.map +1 -0
- package/enterprise/applyThreatScanning.d.ts +2 -0
- package/enterprise/applyThreatScanning.js +20 -0
- package/enterprise/applyThreatScanning.js.map +1 -0
- package/graphql/baseSchema.d.ts +1 -1
- package/graphql/baseSchema.js +6 -2
- package/graphql/baseSchema.js.map +1 -1
- package/graphql/createFilesTypeDefs.d.ts +1 -1
- package/graphql/createFilesTypeDefs.js +31 -9
- package/graphql/createFilesTypeDefs.js.map +1 -1
- package/graphql/filesSchema.d.ts +2 -2
- package/graphql/filesSchema.js +14 -8
- package/graphql/filesSchema.js.map +1 -1
- package/graphql/getFileByUrl.d.ts +3 -0
- package/graphql/getFileByUrl.js +78 -0
- package/graphql/getFileByUrl.js.map +1 -0
- package/graphql/index.d.ts +3 -2
- package/graphql/index.js +27 -5
- package/graphql/index.js.map +1 -1
- package/graphql/utils.js +3 -1
- package/graphql/utils.js.map +1 -1
- package/handlers/{transform/managers → manage}/imageManager.d.ts +2 -3
- package/handlers/{transform/managers → manage}/imageManager.js +10 -9
- package/handlers/manage/imageManager.js.map +1 -0
- package/handlers/manage/index.d.ts +1 -1
- package/handlers/manage/index.js +9 -5
- package/handlers/manage/index.js.map +1 -1
- package/handlers/{transform → manage}/legacyUtils.d.ts +0 -5
- package/handlers/{transform → manage}/legacyUtils.js +7 -15
- package/handlers/manage/legacyUtils.js.map +1 -0
- package/handlers/{transform → manage}/utils.js +7 -9
- package/handlers/manage/utils.js.map +1 -0
- package/handlers/types.d.ts +1 -1
- package/handlers/types.js +3 -1
- package/handlers/types.js.map +1 -1
- package/handlers/utils/getEnvironment.js +3 -1
- package/handlers/utils/getEnvironment.js.map +1 -1
- package/handlers/utils/getObjectParams.js +3 -1
- package/handlers/utils/getObjectParams.js.map +1 -1
- package/handlers/utils/index.js +3 -1
- package/handlers/utils/index.js.map +1 -1
- package/index.d.ts +6 -3
- package/index.js +31 -7
- package/index.js.map +1 -1
- package/modelModifier/CmsModelModifier.d.ts +5 -3
- package/modelModifier/CmsModelModifier.js +15 -12
- package/modelModifier/CmsModelModifier.js.map +1 -1
- package/package.json +25 -35
- package/plugins/FilePhysicalStoragePlugin.d.ts +2 -1
- package/plugins/FilePhysicalStoragePlugin.js +3 -3
- package/plugins/FilePhysicalStoragePlugin.js.map +1 -1
- package/plugins/FileStorageTransformPlugin.d.ts +1 -1
- package/plugins/FileStorageTransformPlugin.js +3 -4
- package/plugins/FileStorageTransformPlugin.js.map +1 -1
- package/plugins/index.js +3 -1
- package/plugins/index.js.map +1 -1
- package/storage/FileStorage.d.ts +5 -3
- package/storage/FileStorage.js +20 -16
- package/storage/FileStorage.js.map +1 -1
- package/types/file.d.ts +12 -0
- package/types/file.js +3 -1
- package/types/file.js.map +1 -1
- package/types/file.lifecycle.d.ts +2 -2
- package/types/file.lifecycle.js +3 -1
- package/types/file.lifecycle.js.map +1 -1
- package/types.d.ts +37 -15
- package/types.js +3 -1
- package/types.js.map +1 -1
- package/cmsFileStorage/createFileManagerPlugins.d.ts +0 -5
- package/cmsFileStorage/createFileManagerPlugins.js +0 -34
- package/cmsFileStorage/createFileManagerPlugins.js.map +0 -1
- package/cmsFileStorage/createModelField.d.ts +0 -5
- package/cmsFileStorage/createModelField.js +0 -37
- package/cmsFileStorage/createModelField.js.map +0 -1
- package/cmsFileStorage/isInstallationPending.d.ts +0 -4
- package/cmsFileStorage/isInstallationPending.js +0 -21
- package/cmsFileStorage/isInstallationPending.js.map +0 -1
- package/createFileManager/filevalidation.disabled.d.ts +0 -0
- package/createFileManager/filevalidation.disabled.js +0 -55
- package/createFileManager/filevalidation.disabled.js.map +0 -1
- package/handlers/download/byAlias.d.ts +0 -6
- package/handlers/download/byAlias.js +0 -89
- package/handlers/download/byAlias.js.map +0 -1
- package/handlers/download/byExactKey.d.ts +0 -2
- package/handlers/download/byExactKey.js +0 -57
- package/handlers/download/byExactKey.js.map +0 -1
- package/handlers/download/extractFileInformation.d.ts +0 -9
- package/handlers/download/extractFileInformation.js +0 -20
- package/handlers/download/extractFileInformation.js.map +0 -1
- package/handlers/download/getS3Object.d.ts +0 -12
- package/handlers/download/getS3Object.js +0 -72
- package/handlers/download/getS3Object.js.map +0 -1
- package/handlers/download/index.d.ts +0 -2
- package/handlers/download/index.js +0 -27
- package/handlers/download/index.js.map +0 -1
- package/handlers/transform/index.d.ts +0 -2
- package/handlers/transform/index.js +0 -92
- package/handlers/transform/index.js.map +0 -1
- package/handlers/transform/legacyUtils.js.map +0 -1
- package/handlers/transform/loaders/imageLoader.d.ts +0 -30
- package/handlers/transform/loaders/imageLoader.js +0 -94
- package/handlers/transform/loaders/imageLoader.js.map +0 -1
- package/handlers/transform/loaders/index.d.ts +0 -8
- package/handlers/transform/loaders/index.js +0 -10
- package/handlers/transform/loaders/index.js.map +0 -1
- package/handlers/transform/loaders/sanitizeImageTransformations.d.ts +0 -11
- package/handlers/transform/loaders/sanitizeImageTransformations.js +0 -45
- package/handlers/transform/loaders/sanitizeImageTransformations.js.map +0 -1
- package/handlers/transform/managers/imageManager.js.map +0 -1
- package/handlers/transform/managers/index.d.ts +0 -5
- package/handlers/transform/managers/index.js +0 -10
- package/handlers/transform/managers/index.js.map +0 -1
- package/handlers/transform/optimizeImage.d.ts +0 -3
- package/handlers/transform/optimizeImage.js +0 -42
- package/handlers/transform/optimizeImage.js.map +0 -1
- package/handlers/transform/transformImage.d.ts +0 -13
- package/handlers/transform/transformImage.js +0 -28
- package/handlers/transform/transformImage.js.map +0 -1
- package/handlers/transform/utils.js.map +0 -1
- /package/handlers/{transform → manage}/utils.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Asset","constructor","props","clone","withProps","structuredClone","newAsset","contentsReader","outputStrategy","getId","id","getTenant","tenant","getLocale","locale","getKey","key","getSize","size","getContentType","contentType","getExtension","split","pop","getContents","Error","read","setContentsReader","reader","output","setOutputStrategy","setter","exports"],"sources":["Asset.ts"],"sourcesContent":["import type { AssetContentsReader, AssetOutputStrategy } from \"~/delivery\";\n\ntype Setter<T> = (arg: T | undefined) => T;\n\nexport interface AssetData {\n id: string;\n tenant: string;\n locale: string;\n key: string;\n size: number;\n contentType: string;\n}\n\nexport class Asset {\n protected readonly props: AssetData;\n private outputStrategy: AssetOutputStrategy | undefined;\n private contentsReader: AssetContentsReader | undefined;\n\n constructor(props: AssetData) {\n this.props = props;\n }\n\n clone() {\n return this.withProps(structuredClone(this.props));\n }\n\n withProps(props: Partial<AssetData>) {\n const newAsset = new Asset({ ...this.props, ...props });\n newAsset.contentsReader = this.contentsReader;\n newAsset.outputStrategy = this.outputStrategy;\n return newAsset;\n }\n\n getId() {\n return this.props.id;\n }\n getTenant() {\n return this.props.tenant;\n }\n getLocale() {\n return this.props.locale;\n }\n getKey() {\n return this.props.key;\n }\n getSize() {\n return this.props.size;\n }\n getContentType() {\n return this.props.contentType;\n }\n getExtension() {\n return this.getKey().split(\".\").pop() ?? \"\";\n }\n\n getContents() {\n if (!this.contentsReader) {\n throw Error(`Asset contents reader was not configured!`);\n }\n return this.contentsReader.read(this);\n }\n\n setContentsReader(reader: AssetContentsReader) {\n this.contentsReader = reader;\n }\n\n output() {\n if (!this.outputStrategy) {\n throw Error(`Asset output strategy was not configured!`);\n }\n\n return this.outputStrategy.output(this);\n }\n\n setOutputStrategy(setter: Setter<AssetOutputStrategy> | AssetOutputStrategy) {\n if (typeof setter === \"function\") {\n this.outputStrategy = setter(this.outputStrategy);\n } else {\n this.outputStrategy = setter;\n }\n }\n}\n"],"mappings":";;;;;;AAaO,MAAMA,KAAK,CAAC;EAKfC,WAAWA,CAACC,KAAgB,EAAE;IAC1B,IAAI,CAACA,KAAK,GAAGA,KAAK;EACtB;EAEAC,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACC,SAAS,CAACC,eAAe,CAAC,IAAI,CAACH,KAAK,CAAC,CAAC;EACtD;EAEAE,SAASA,CAACF,KAAyB,EAAE;IACjC,MAAMI,QAAQ,GAAG,IAAIN,KAAK,CAAC;MAAE,GAAG,IAAI,CAACE,KAAK;MAAE,GAAGA;IAAM,CAAC,CAAC;IACvDI,QAAQ,CAACC,cAAc,GAAG,IAAI,CAACA,cAAc;IAC7CD,QAAQ,CAACE,cAAc,GAAG,IAAI,CAACA,cAAc;IAC7C,OAAOF,QAAQ;EACnB;EAEAG,KAAKA,CAAA,EAAG;IACJ,OAAO,IAAI,CAACP,KAAK,CAACQ,EAAE;EACxB;EACAC,SAASA,CAAA,EAAG;IACR,OAAO,IAAI,CAACT,KAAK,CAACU,MAAM;EAC5B;EACAC,SAASA,CAAA,EAAG;IACR,OAAO,IAAI,CAACX,KAAK,CAACY,MAAM;EAC5B;EACAC,MAAMA,CAAA,EAAG;IACL,OAAO,IAAI,CAACb,KAAK,CAACc,GAAG;EACzB;EACAC,OAAOA,CAAA,EAAG;IACN,OAAO,IAAI,CAACf,KAAK,CAACgB,IAAI;EAC1B;EACAC,cAAcA,CAAA,EAAG;IACb,OAAO,IAAI,CAACjB,KAAK,CAACkB,WAAW;EACjC;EACAC,YAAYA,CAAA,EAAG;IACX,OAAO,IAAI,CAACN,MAAM,CAAC,CAAC,CAACO,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC,IAAI,EAAE;EAC/C;EAEAC,WAAWA,CAAA,EAAG;IACV,IAAI,CAAC,IAAI,CAACjB,cAAc,EAAE;MACtB,MAAMkB,KAAK,CAAC,2CAA2C,CAAC;IAC5D;IACA,OAAO,IAAI,CAAClB,cAAc,CAACmB,IAAI,CAAC,IAAI,CAAC;EACzC;EAEAC,iBAAiBA,CAACC,MAA2B,EAAE;IAC3C,IAAI,CAACrB,cAAc,GAAGqB,MAAM;EAChC;EAEAC,MAAMA,CAAA,EAAG;IACL,IAAI,CAAC,IAAI,CAACrB,cAAc,EAAE;MACtB,MAAMiB,KAAK,CAAC,2CAA2C,CAAC;IAC5D;IAEA,OAAO,IAAI,CAACjB,cAAc,CAACqB,MAAM,CAAC,IAAI,CAAC;EAC3C;EAEAC,iBAAiBA,CAACC,MAAyD,EAAE;IACzE,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;MAC9B,IAAI,CAACvB,cAAc,GAAGuB,MAAM,CAAC,IAAI,CAACvB,cAAc,CAAC;IACrD,CAAC,MAAM;MACH,IAAI,CAACA,cAAc,GAAGuB,MAAM;IAChC;EACJ;AACJ;AAACC,OAAA,CAAAhC,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import type { AssetRequestResolver, AssetResolver, AssetProcessor, AssetOutputStrategy, AssetRequest, Asset, AssetTransformationStrategy, ResponseHeadersSetter } from "..";
|
|
3
|
+
import type { FileManagerContext } from "../../types";
|
|
4
|
+
type Setter<TParams, TReturn> = (params: TParams) => TReturn;
|
|
5
|
+
export type AssetRequestResolverDecorator = Setter<{
|
|
6
|
+
assetRequestResolver: AssetRequestResolver;
|
|
7
|
+
}, AssetRequestResolver>;
|
|
8
|
+
export type AssetResolverDecorator = Setter<{
|
|
9
|
+
assetResolver: AssetResolver;
|
|
10
|
+
}, AssetResolver>;
|
|
11
|
+
export type AssetProcessorDecorator = Setter<{
|
|
12
|
+
context: FileManagerContext;
|
|
13
|
+
assetProcessor: AssetProcessor;
|
|
14
|
+
}, AssetProcessor>;
|
|
15
|
+
export type AssetTransformationDecorator = Setter<{
|
|
16
|
+
context: FileManagerContext;
|
|
17
|
+
assetTransformationStrategy: AssetTransformationStrategy;
|
|
18
|
+
}, AssetTransformationStrategy>;
|
|
19
|
+
export interface AssetOutputStrategyDecoratorParams {
|
|
20
|
+
context: FileManagerContext;
|
|
21
|
+
assetRequest: AssetRequest;
|
|
22
|
+
asset: Asset;
|
|
23
|
+
assetOutputStrategy: AssetOutputStrategy;
|
|
24
|
+
}
|
|
25
|
+
export type AssetOutputStrategyDecorator = Setter<AssetOutputStrategyDecoratorParams, AssetOutputStrategy>;
|
|
26
|
+
export declare class AssetDeliveryConfigBuilder {
|
|
27
|
+
private assetRequestResolverDecorators;
|
|
28
|
+
private assetResolverDecorators;
|
|
29
|
+
private assetProcessorDecorators;
|
|
30
|
+
private assetTransformationStrategyDecorators;
|
|
31
|
+
private assetOutputStrategyDecorators;
|
|
32
|
+
setResponseHeaders(setter: ResponseHeadersSetter): void;
|
|
33
|
+
decorateAssetRequestResolver(decorator: AssetRequestResolverDecorator): void;
|
|
34
|
+
decorateAssetResolver(decorator: AssetResolverDecorator): void;
|
|
35
|
+
decorateAssetProcessor(decorator: AssetProcessorDecorator): void;
|
|
36
|
+
decorateAssetTransformationStrategy(decorator: AssetTransformationDecorator): void;
|
|
37
|
+
decorateAssetOutputStrategy(decorator: AssetOutputStrategyDecorator): void;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
getAssetRequestResolver(): AssetRequestResolver;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
getAssetResolver(): AssetResolver;
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
getAssetProcessor(context: FileManagerContext): AssetProcessor;
|
|
50
|
+
getAssetOutputStrategy(context: FileManagerContext, assetRequest: AssetRequest, asset: Asset): AssetOutputStrategy;
|
|
51
|
+
getAssetTransformationStrategy(context: FileManagerContext): AssetTransformationStrategy;
|
|
52
|
+
}
|
|
53
|
+
export interface AssetDeliveryConfigModifier {
|
|
54
|
+
(config: AssetDeliveryConfigBuilder): Promise<void> | void;
|
|
55
|
+
}
|
|
56
|
+
export declare class AssetDeliveryConfigModifierPlugin extends Plugin {
|
|
57
|
+
static type: string;
|
|
58
|
+
private readonly cb;
|
|
59
|
+
constructor(cb: AssetDeliveryConfigModifier);
|
|
60
|
+
buildConfig(configBuilder: AssetDeliveryConfigBuilder): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
export declare const createAssetDeliveryConfig: (cb: AssetDeliveryConfigModifier) => AssetDeliveryConfigModifierPlugin;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createAssetDeliveryConfig = exports.AssetDeliveryConfigModifierPlugin = exports.AssetDeliveryConfigBuilder = void 0;
|
|
7
|
+
var _plugins = require("@webiny/plugins");
|
|
8
|
+
var _ = require("./..");
|
|
9
|
+
var _NullRequestResolver = require("./NullRequestResolver");
|
|
10
|
+
var _NullAssetResolver = require("./NullAssetResolver");
|
|
11
|
+
var _NullAssetOutputStrategy = require("./NullAssetOutputStrategy");
|
|
12
|
+
var _TransformationAssetProcessor = require("./transformation/TransformationAssetProcessor");
|
|
13
|
+
var _PassthroughAssetTransformationStrategy = require("./transformation/PassthroughAssetTransformationStrategy");
|
|
14
|
+
class AssetDeliveryConfigBuilder {
|
|
15
|
+
assetRequestResolverDecorators = [];
|
|
16
|
+
assetResolverDecorators = [];
|
|
17
|
+
assetProcessorDecorators = [];
|
|
18
|
+
assetTransformationStrategyDecorators = [];
|
|
19
|
+
assetOutputStrategyDecorators = [];
|
|
20
|
+
setResponseHeaders(setter) {
|
|
21
|
+
this.decorateAssetOutputStrategy(params => {
|
|
22
|
+
return new _.SetResponseHeaders(setter, params);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
decorateAssetRequestResolver(decorator) {
|
|
26
|
+
this.assetRequestResolverDecorators.push(decorator);
|
|
27
|
+
}
|
|
28
|
+
decorateAssetResolver(decorator) {
|
|
29
|
+
this.assetResolverDecorators.push(decorator);
|
|
30
|
+
}
|
|
31
|
+
decorateAssetProcessor(decorator) {
|
|
32
|
+
this.assetProcessorDecorators.push(decorator);
|
|
33
|
+
}
|
|
34
|
+
decorateAssetTransformationStrategy(decorator) {
|
|
35
|
+
this.assetTransformationStrategyDecorators.push(decorator);
|
|
36
|
+
}
|
|
37
|
+
decorateAssetOutputStrategy(decorator) {
|
|
38
|
+
this.assetOutputStrategyDecorators.push(decorator);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
getAssetRequestResolver() {
|
|
45
|
+
return this.assetRequestResolverDecorators.reduce((value, decorator) => decorator({
|
|
46
|
+
assetRequestResolver: value
|
|
47
|
+
}), new _NullRequestResolver.NullRequestResolver());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
getAssetResolver() {
|
|
54
|
+
return this.assetResolverDecorators.reduce((value, decorator) => decorator({
|
|
55
|
+
assetResolver: value
|
|
56
|
+
}), new _NullAssetResolver.NullAssetResolver());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
getAssetProcessor(context) {
|
|
63
|
+
return this.assetProcessorDecorators.reduce((value, decorator) => decorator({
|
|
64
|
+
assetProcessor: value,
|
|
65
|
+
context
|
|
66
|
+
}), new _TransformationAssetProcessor.TransformationAssetProcessor(this.getAssetTransformationStrategy(context)));
|
|
67
|
+
}
|
|
68
|
+
getAssetOutputStrategy(context, assetRequest, asset) {
|
|
69
|
+
return this.assetOutputStrategyDecorators.reduce((value, decorator) => {
|
|
70
|
+
return decorator({
|
|
71
|
+
context,
|
|
72
|
+
assetRequest,
|
|
73
|
+
asset,
|
|
74
|
+
assetOutputStrategy: value
|
|
75
|
+
});
|
|
76
|
+
}, new _NullAssetOutputStrategy.NullAssetOutputStrategy());
|
|
77
|
+
}
|
|
78
|
+
getAssetTransformationStrategy(context) {
|
|
79
|
+
return this.assetTransformationStrategyDecorators.reduce((value, decorator) => decorator({
|
|
80
|
+
context,
|
|
81
|
+
assetTransformationStrategy: value
|
|
82
|
+
}), new _PassthroughAssetTransformationStrategy.PassthroughAssetTransformationStrategy());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.AssetDeliveryConfigBuilder = AssetDeliveryConfigBuilder;
|
|
86
|
+
class AssetDeliveryConfigModifierPlugin extends _plugins.Plugin {
|
|
87
|
+
static type = "fm.config-modifier";
|
|
88
|
+
constructor(cb) {
|
|
89
|
+
super();
|
|
90
|
+
this.cb = cb;
|
|
91
|
+
}
|
|
92
|
+
async buildConfig(configBuilder) {
|
|
93
|
+
await this.cb(configBuilder);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.AssetDeliveryConfigModifierPlugin = AssetDeliveryConfigModifierPlugin;
|
|
97
|
+
const createAssetDeliveryConfig = cb => {
|
|
98
|
+
return new AssetDeliveryConfigModifierPlugin(cb);
|
|
99
|
+
};
|
|
100
|
+
exports.createAssetDeliveryConfig = createAssetDeliveryConfig;
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=AssetDeliveryConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_plugins","require","_","_NullRequestResolver","_NullAssetResolver","_NullAssetOutputStrategy","_TransformationAssetProcessor","_PassthroughAssetTransformationStrategy","AssetDeliveryConfigBuilder","assetRequestResolverDecorators","assetResolverDecorators","assetProcessorDecorators","assetTransformationStrategyDecorators","assetOutputStrategyDecorators","setResponseHeaders","setter","decorateAssetOutputStrategy","params","SetResponseHeaders","decorateAssetRequestResolver","decorator","push","decorateAssetResolver","decorateAssetProcessor","decorateAssetTransformationStrategy","getAssetRequestResolver","reduce","value","assetRequestResolver","NullRequestResolver","getAssetResolver","assetResolver","NullAssetResolver","getAssetProcessor","context","assetProcessor","TransformationAssetProcessor","getAssetTransformationStrategy","getAssetOutputStrategy","assetRequest","asset","assetOutputStrategy","NullAssetOutputStrategy","assetTransformationStrategy","PassthroughAssetTransformationStrategy","exports","AssetDeliveryConfigModifierPlugin","Plugin","type","constructor","cb","buildConfig","configBuilder","createAssetDeliveryConfig"],"sources":["AssetDeliveryConfig.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport type {\n AssetRequestResolver,\n AssetResolver,\n AssetProcessor,\n AssetOutputStrategy,\n AssetRequest,\n Asset,\n AssetTransformationStrategy,\n ResponseHeadersSetter\n} from \"~/delivery\";\nimport { SetResponseHeaders } from \"~/delivery\";\nimport type { FileManagerContext } from \"~/types\";\nimport { NullRequestResolver } from \"~/delivery/AssetDelivery/NullRequestResolver\";\nimport { NullAssetResolver } from \"~/delivery/AssetDelivery/NullAssetResolver\";\nimport { NullAssetOutputStrategy } from \"./NullAssetOutputStrategy\";\nimport { TransformationAssetProcessor } from \"./transformation/TransformationAssetProcessor\";\nimport { PassthroughAssetTransformationStrategy } from \"./transformation/PassthroughAssetTransformationStrategy\";\n\ntype Setter<TParams, TReturn> = (params: TParams) => TReturn;\n\nexport type AssetRequestResolverDecorator = Setter<\n { assetRequestResolver: AssetRequestResolver },\n AssetRequestResolver\n>;\n\nexport type AssetResolverDecorator = Setter<{ assetResolver: AssetResolver }, AssetResolver>;\n\nexport type AssetProcessorDecorator = Setter<\n { context: FileManagerContext; assetProcessor: AssetProcessor },\n AssetProcessor\n>;\n\nexport type AssetTransformationDecorator = Setter<\n { context: FileManagerContext; assetTransformationStrategy: AssetTransformationStrategy },\n AssetTransformationStrategy\n>;\n\nexport interface AssetOutputStrategyDecoratorParams {\n context: FileManagerContext;\n assetRequest: AssetRequest;\n asset: Asset;\n assetOutputStrategy: AssetOutputStrategy;\n}\n\nexport type AssetOutputStrategyDecorator = Setter<\n AssetOutputStrategyDecoratorParams,\n AssetOutputStrategy\n>;\n\nexport class AssetDeliveryConfigBuilder {\n private assetRequestResolverDecorators: AssetRequestResolverDecorator[] = [];\n private assetResolverDecorators: AssetResolverDecorator[] = [];\n private assetProcessorDecorators: AssetProcessorDecorator[] = [];\n private assetTransformationStrategyDecorators: AssetTransformationDecorator[] = [];\n private assetOutputStrategyDecorators: AssetOutputStrategyDecorator[] = [];\n\n setResponseHeaders(setter: ResponseHeadersSetter) {\n this.decorateAssetOutputStrategy(params => {\n return new SetResponseHeaders(setter, params);\n });\n }\n\n decorateAssetRequestResolver(decorator: AssetRequestResolverDecorator) {\n this.assetRequestResolverDecorators.push(decorator);\n }\n\n decorateAssetResolver(decorator: AssetResolverDecorator) {\n this.assetResolverDecorators.push(decorator);\n }\n\n decorateAssetProcessor(decorator: AssetProcessorDecorator) {\n this.assetProcessorDecorators.push(decorator);\n }\n\n decorateAssetTransformationStrategy(decorator: AssetTransformationDecorator) {\n this.assetTransformationStrategyDecorators.push(decorator);\n }\n\n decorateAssetOutputStrategy(decorator: AssetOutputStrategyDecorator) {\n this.assetOutputStrategyDecorators.push(decorator);\n }\n\n /**\n * @internal\n */\n getAssetRequestResolver() {\n return this.assetRequestResolverDecorators.reduce<AssetRequestResolver>(\n (value, decorator) => decorator({ assetRequestResolver: value }),\n new NullRequestResolver()\n );\n }\n\n /**\n * @internal\n */\n getAssetResolver() {\n return this.assetResolverDecorators.reduce<AssetResolver>(\n (value, decorator) => decorator({ assetResolver: value }),\n new NullAssetResolver()\n );\n }\n\n /**\n * @internal\n */\n getAssetProcessor(context: FileManagerContext) {\n return this.assetProcessorDecorators.reduce<AssetProcessor>(\n (value, decorator) => decorator({ assetProcessor: value, context }),\n new TransformationAssetProcessor(this.getAssetTransformationStrategy(context))\n );\n }\n\n getAssetOutputStrategy(context: FileManagerContext, assetRequest: AssetRequest, asset: Asset) {\n return this.assetOutputStrategyDecorators.reduce<AssetOutputStrategy>(\n (value, decorator) => {\n return decorator({ context, assetRequest, asset, assetOutputStrategy: value });\n },\n new NullAssetOutputStrategy()\n );\n }\n\n getAssetTransformationStrategy(context: FileManagerContext) {\n return this.assetTransformationStrategyDecorators.reduce<AssetTransformationStrategy>(\n (value, decorator) => decorator({ context, assetTransformationStrategy: value }),\n new PassthroughAssetTransformationStrategy()\n );\n }\n}\n\nexport interface AssetDeliveryConfigModifier {\n (config: AssetDeliveryConfigBuilder): Promise<void> | void;\n}\n\nexport class AssetDeliveryConfigModifierPlugin extends Plugin {\n public static override type = \"fm.config-modifier\";\n private readonly cb: AssetDeliveryConfigModifier;\n\n constructor(cb: AssetDeliveryConfigModifier) {\n super();\n this.cb = cb;\n }\n\n async buildConfig(configBuilder: AssetDeliveryConfigBuilder): Promise<void> {\n await this.cb(configBuilder);\n }\n}\n\nexport const createAssetDeliveryConfig = (cb: AssetDeliveryConfigModifier) => {\n return new AssetDeliveryConfigModifierPlugin(cb);\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { GenericRecord } from "@webiny/api/types";
|
|
2
|
+
export interface AssetRequestOptions {
|
|
3
|
+
original?: boolean;
|
|
4
|
+
width?: number;
|
|
5
|
+
}
|
|
6
|
+
export type AssetRequestContext<T extends GenericRecord = GenericRecord> = T & {
|
|
7
|
+
/**
|
|
8
|
+
* Asset request URL.
|
|
9
|
+
*/
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
12
|
+
export interface AssetRequestData<TOptions> {
|
|
13
|
+
key: string;
|
|
14
|
+
context: AssetRequestContext;
|
|
15
|
+
options: TOptions;
|
|
16
|
+
}
|
|
17
|
+
export declare class AssetRequest<TOptions extends AssetRequestOptions = AssetRequestOptions> {
|
|
18
|
+
private data;
|
|
19
|
+
constructor(data: AssetRequestData<TOptions>);
|
|
20
|
+
getKey(): string;
|
|
21
|
+
getOptions(): TOptions;
|
|
22
|
+
setOptions(options: TOptions): void;
|
|
23
|
+
getContext<T extends GenericRecord = GenericRecord>(): AssetRequestContext<T>;
|
|
24
|
+
getExtension(): string | undefined;
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AssetRequest = void 0;
|
|
7
|
+
class AssetRequest {
|
|
8
|
+
constructor(data) {
|
|
9
|
+
this.data = data;
|
|
10
|
+
}
|
|
11
|
+
getKey() {
|
|
12
|
+
return this.data.key;
|
|
13
|
+
}
|
|
14
|
+
getOptions() {
|
|
15
|
+
return this.data.options;
|
|
16
|
+
}
|
|
17
|
+
setOptions(options) {
|
|
18
|
+
this.data.options = options;
|
|
19
|
+
}
|
|
20
|
+
getContext() {
|
|
21
|
+
return this.data.context;
|
|
22
|
+
}
|
|
23
|
+
getExtension() {
|
|
24
|
+
return this.data.key.split(".").pop();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AssetRequest = AssetRequest;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=AssetRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AssetRequest","constructor","data","getKey","key","getOptions","options","setOptions","getContext","context","getExtension","split","pop","exports"],"sources":["AssetRequest.ts"],"sourcesContent":["import type { GenericRecord } from \"@webiny/api/types\";\n\nexport interface AssetRequestOptions {\n original?: boolean;\n width?: number;\n}\n\nexport type AssetRequestContext<T extends GenericRecord = GenericRecord> = T & {\n /**\n * Asset request URL.\n */\n url: string;\n};\n\nexport interface AssetRequestData<TOptions> {\n key: string;\n context: AssetRequestContext;\n options: TOptions;\n}\n\nexport class AssetRequest<TOptions extends AssetRequestOptions = AssetRequestOptions> {\n private data: AssetRequestData<TOptions>;\n\n constructor(data: AssetRequestData<TOptions>) {\n this.data = data;\n }\n\n getKey() {\n return this.data.key;\n }\n\n getOptions(): TOptions {\n return this.data.options;\n }\n\n setOptions(options: TOptions) {\n this.data.options = options;\n }\n\n getContext<T extends GenericRecord = GenericRecord>() {\n return this.data.context as AssetRequestContext<T>;\n }\n\n getExtension() {\n return this.data.key.split(\".\").pop();\n }\n}\n"],"mappings":";;;;;;AAoBO,MAAMA,YAAY,CAA6D;EAGlFC,WAAWA,CAACC,IAAgC,EAAE;IAC1C,IAAI,CAACA,IAAI,GAAGA,IAAI;EACpB;EAEAC,MAAMA,CAAA,EAAG;IACL,OAAO,IAAI,CAACD,IAAI,CAACE,GAAG;EACxB;EAEAC,UAAUA,CAAA,EAAa;IACnB,OAAO,IAAI,CAACH,IAAI,CAACI,OAAO;EAC5B;EAEAC,UAAUA,CAACD,OAAiB,EAAE;IAC1B,IAAI,CAACJ,IAAI,CAACI,OAAO,GAAGA,OAAO;EAC/B;EAEAE,UAAUA,CAAA,EAA4C;IAClD,OAAO,IAAI,CAACN,IAAI,CAACO,OAAO;EAC5B;EAEAC,YAAYA,CAAA,EAAG;IACX,OAAO,IAAI,CAACR,IAAI,CAACE,GAAG,CAACO,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAAC,CAAC;EACzC;AACJ;AAACC,OAAA,CAAAb,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Request } from "@webiny/handler/types";
|
|
2
|
+
import type { AssetRequestResolver } from "./abstractions/AssetRequestResolver";
|
|
3
|
+
import { AssetRequest } from "./AssetRequest";
|
|
4
|
+
export declare class FilesAssetRequestResolver implements AssetRequestResolver {
|
|
5
|
+
resolve(request: Request): Promise<AssetRequest | undefined>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FilesAssetRequestResolver = void 0;
|
|
7
|
+
var _AssetRequest = require("./AssetRequest");
|
|
8
|
+
class FilesAssetRequestResolver {
|
|
9
|
+
async resolve(request) {
|
|
10
|
+
// Example: /files/65722cb5c7824a0008d05963/image-48.jpg?width=300
|
|
11
|
+
if (!request.url.startsWith("/files/")) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const params = request.params ?? {};
|
|
15
|
+
const query = request.query ?? {};
|
|
16
|
+
|
|
17
|
+
// Example: { '*': '/files/65722cb5c7824a0008d05963/image-48.jpg' },
|
|
18
|
+
const path = params["*"];
|
|
19
|
+
const options = {
|
|
20
|
+
...query,
|
|
21
|
+
original: "original" in query
|
|
22
|
+
};
|
|
23
|
+
if (query.width) {
|
|
24
|
+
options.width = parseInt(query.width);
|
|
25
|
+
}
|
|
26
|
+
return new _AssetRequest.AssetRequest({
|
|
27
|
+
key: decodeURI(path).replace("/files/", ""),
|
|
28
|
+
context: {
|
|
29
|
+
url: request.url
|
|
30
|
+
},
|
|
31
|
+
options
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.FilesAssetRequestResolver = FilesAssetRequestResolver;
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=FilesAssetRequestResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_AssetRequest","require","FilesAssetRequestResolver","resolve","request","url","startsWith","undefined","params","query","path","options","original","width","parseInt","AssetRequest","key","decodeURI","replace","context","exports"],"sources":["FilesAssetRequestResolver.ts"],"sourcesContent":["import type { Request } from \"@webiny/handler/types\";\nimport type { AssetRequestResolver } from \"./abstractions/AssetRequestResolver\";\nimport type { AssetRequestOptions } from \"./AssetRequest\";\nimport { AssetRequest } from \"./AssetRequest\";\n\nexport class FilesAssetRequestResolver implements AssetRequestResolver {\n async resolve(request: Request): Promise<AssetRequest | undefined> {\n // Example: /files/65722cb5c7824a0008d05963/image-48.jpg?width=300\n if (!request.url.startsWith(\"/files/\")) {\n return undefined;\n }\n\n const params = (request.params as Record<string, any>) ?? {};\n const query = (request.query as Record<string, any>) ?? {};\n\n // Example: { '*': '/files/65722cb5c7824a0008d05963/image-48.jpg' },\n const path = params[\"*\"];\n\n const options: AssetRequestOptions = {\n ...query,\n original: \"original\" in query\n };\n\n if (query.width) {\n options.width = parseInt(query.width);\n }\n\n return new AssetRequest({\n key: decodeURI(path).replace(\"/files/\", \"\"),\n context: {\n url: request.url\n },\n options\n });\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAEO,MAAMC,yBAAyB,CAAiC;EACnE,MAAMC,OAAOA,CAACC,OAAgB,EAAqC;IAC/D;IACA,IAAI,CAACA,OAAO,CAACC,GAAG,CAACC,UAAU,CAAC,SAAS,CAAC,EAAE;MACpC,OAAOC,SAAS;IACpB;IAEA,MAAMC,MAAM,GAAIJ,OAAO,CAACI,MAAM,IAA4B,CAAC,CAAC;IAC5D,MAAMC,KAAK,GAAIL,OAAO,CAACK,KAAK,IAA4B,CAAC,CAAC;;IAE1D;IACA,MAAMC,IAAI,GAAGF,MAAM,CAAC,GAAG,CAAC;IAExB,MAAMG,OAA4B,GAAG;MACjC,GAAGF,KAAK;MACRG,QAAQ,EAAE,UAAU,IAAIH;IAC5B,CAAC;IAED,IAAIA,KAAK,CAACI,KAAK,EAAE;MACbF,OAAO,CAACE,KAAK,GAAGC,QAAQ,CAACL,KAAK,CAACI,KAAK,CAAC;IACzC;IAEA,OAAO,IAAIE,0BAAY,CAAC;MACpBC,GAAG,EAAEC,SAAS,CAACP,IAAI,CAAC,CAACQ,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;MAC3CC,OAAO,EAAE;QACLd,GAAG,EAAED,OAAO,CAACC;MACjB,CAAC;MACDM;IACJ,CAAC,CAAC;EACN;AACJ;AAACS,OAAA,CAAAlB,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NullAssetOutputStrategy = void 0;
|
|
7
|
+
var _NullAssetReply = require("./NullAssetReply");
|
|
8
|
+
class NullAssetOutputStrategy {
|
|
9
|
+
async output() {
|
|
10
|
+
return new _NullAssetReply.NullAssetReply();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.NullAssetOutputStrategy = NullAssetOutputStrategy;
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=NullAssetOutputStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NullAssetReply","require","NullAssetOutputStrategy","output","NullAssetReply","exports"],"sources":["NullAssetOutputStrategy.ts"],"sourcesContent":["import type { AssetOutputStrategy, AssetReply } from \"~/delivery\";\nimport { NullAssetReply } from \"./NullAssetReply\";\n\nexport class NullAssetOutputStrategy implements AssetOutputStrategy {\n async output(): Promise<AssetReply> {\n return new NullAssetReply();\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,eAAA,GAAAC,OAAA;AAEO,MAAMC,uBAAuB,CAAgC;EAChE,MAAMC,MAAMA,CAAA,EAAwB;IAChC,OAAO,IAAIC,8BAAc,CAAC,CAAC;EAC/B;AACJ;AAACC,OAAA,CAAAH,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NullAssetReply = void 0;
|
|
7
|
+
var _AssetReply = require("./abstractions/AssetReply");
|
|
8
|
+
class NullAssetReply extends _AssetReply.AssetReply {
|
|
9
|
+
constructor() {
|
|
10
|
+
super({
|
|
11
|
+
code: 404,
|
|
12
|
+
body: () => ({
|
|
13
|
+
error: "Asset output strategy is not implemented!"
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.NullAssetReply = NullAssetReply;
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=NullAssetReply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_AssetReply","require","NullAssetReply","AssetReply","constructor","code","body","error","exports"],"sources":["NullAssetReply.ts"],"sourcesContent":["import { AssetReply } from \"~/delivery/AssetDelivery/abstractions/AssetReply\";\n\nexport class NullAssetReply extends AssetReply {\n constructor() {\n super({\n code: 404,\n body: () => ({ error: \"Asset output strategy is not implemented!\" })\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEO,MAAMC,cAAc,SAASC,sBAAU,CAAC;EAC3CC,WAAWA,CAAA,EAAG;IACV,KAAK,CAAC;MACFC,IAAI,EAAE,GAAG;MACTC,IAAI,EAAEA,CAAA,MAAO;QAAEC,KAAK,EAAE;MAA4C,CAAC;IACvE,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAAN,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NullAssetResolver = void 0;
|
|
7
|
+
class NullAssetResolver {
|
|
8
|
+
resolve() {
|
|
9
|
+
return Promise.resolve(undefined);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.NullAssetResolver = NullAssetResolver;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=NullAssetResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NullAssetResolver","resolve","Promise","undefined","exports"],"sources":["NullAssetResolver.ts"],"sourcesContent":["import type { AssetResolver } from \"./abstractions/AssetResolver\";\nimport type { Asset } from \"./Asset\";\n\nexport class NullAssetResolver implements AssetResolver {\n resolve(): Promise<Asset | undefined> {\n return Promise.resolve(undefined);\n }\n}\n"],"mappings":";;;;;;AAGO,MAAMA,iBAAiB,CAA0B;EACpDC,OAAOA,CAAA,EAA+B;IAClC,OAAOC,OAAO,CAACD,OAAO,CAACE,SAAS,CAAC;EACrC;AACJ;AAACC,OAAA,CAAAJ,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NullRequestResolver = void 0;
|
|
7
|
+
class NullRequestResolver {
|
|
8
|
+
resolve() {
|
|
9
|
+
return Promise.resolve(undefined);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.NullRequestResolver = NullRequestResolver;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=NullRequestResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NullRequestResolver","resolve","Promise","undefined","exports"],"sources":["NullRequestResolver.ts"],"sourcesContent":["import type { AssetRequest, AssetRequestResolver } from \"~/delivery\";\n\nexport class NullRequestResolver implements AssetRequestResolver {\n resolve(): Promise<AssetRequest | undefined> {\n return Promise.resolve(undefined);\n }\n}\n"],"mappings":";;;;;;AAEO,MAAMA,mBAAmB,CAAiC;EAC7DC,OAAOA,CAAA,EAAsC;IACzC,OAAOC,OAAO,CAACD,OAAO,CAACE,SAAS,CAAC;EACrC;AACJ;AAACC,OAAA,CAAAJ,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ResponseHeaders } from "@webiny/handler";
|
|
2
|
+
import type { Asset, AssetOutputStrategy, AssetReply } from "..";
|
|
3
|
+
export declare class SetCacheControlHeaders implements AssetOutputStrategy {
|
|
4
|
+
private readonly strategy;
|
|
5
|
+
private readonly headers;
|
|
6
|
+
constructor(headers: ResponseHeaders, strategy: AssetOutputStrategy | undefined);
|
|
7
|
+
output(asset: Asset): Promise<AssetReply>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SetCacheControlHeaders = void 0;
|
|
7
|
+
class SetCacheControlHeaders {
|
|
8
|
+
constructor(headers, strategy) {
|
|
9
|
+
this.headers = headers;
|
|
10
|
+
this.strategy = strategy;
|
|
11
|
+
}
|
|
12
|
+
async output(asset) {
|
|
13
|
+
if (!this.strategy) {
|
|
14
|
+
throw Error(`No asset output strategy is configured!`);
|
|
15
|
+
}
|
|
16
|
+
const reply = await this.strategy.output(asset);
|
|
17
|
+
reply.setHeaders(headers => {
|
|
18
|
+
return headers.merge(this.headers);
|
|
19
|
+
});
|
|
20
|
+
return reply;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.SetCacheControlHeaders = SetCacheControlHeaders;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=SetCacheControlHeaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SetCacheControlHeaders","constructor","headers","strategy","output","asset","Error","reply","setHeaders","merge","exports"],"sources":["SetCacheControlHeaders.ts"],"sourcesContent":["import type { ResponseHeaders } from \"@webiny/handler\";\nimport type { Asset, AssetOutputStrategy, AssetReply } from \"~/delivery\";\n\nexport class SetCacheControlHeaders implements AssetOutputStrategy {\n private readonly strategy: AssetOutputStrategy | undefined;\n private readonly headers: ResponseHeaders;\n\n constructor(headers: ResponseHeaders, strategy: AssetOutputStrategy | undefined) {\n this.headers = headers;\n this.strategy = strategy;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n if (!this.strategy) {\n throw Error(`No asset output strategy is configured!`);\n }\n\n const reply = await this.strategy.output(asset);\n\n reply.setHeaders(headers => {\n return headers.merge(this.headers);\n });\n\n return reply;\n }\n}\n"],"mappings":";;;;;;AAGO,MAAMA,sBAAsB,CAAgC;EAI/DC,WAAWA,CAACC,OAAwB,EAAEC,QAAyC,EAAE;IAC7E,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAMC,MAAMA,CAACC,KAAY,EAAuB;IAC5C,IAAI,CAAC,IAAI,CAACF,QAAQ,EAAE;MAChB,MAAMG,KAAK,CAAC,yCAAyC,CAAC;IAC1D;IAEA,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACJ,QAAQ,CAACC,MAAM,CAACC,KAAK,CAAC;IAE/CE,KAAK,CAACC,UAAU,CAACN,OAAO,IAAI;MACxB,OAAOA,OAAO,CAACO,KAAK,CAAC,IAAI,CAACP,OAAO,CAAC;IACtC,CAAC,CAAC;IAEF,OAAOK,KAAK;EAChB;AACJ;AAACG,OAAA,CAAAV,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AssetOutputStrategy, Asset, AssetReply, AssetRequest, AssetOutputStrategyDecoratorParams } from "..";
|
|
2
|
+
import type { FileManagerContext } from "../../types";
|
|
3
|
+
import type { ResponseHeaders } from "@webiny/handler";
|
|
4
|
+
export interface ResponseHeadersParams {
|
|
5
|
+
headers: ResponseHeaders;
|
|
6
|
+
context: FileManagerContext;
|
|
7
|
+
assetRequest: AssetRequest;
|
|
8
|
+
asset: Asset;
|
|
9
|
+
}
|
|
10
|
+
export interface ResponseHeadersSetter {
|
|
11
|
+
(params: ResponseHeadersParams): Promise<void> | void;
|
|
12
|
+
}
|
|
13
|
+
export declare class SetResponseHeaders implements AssetOutputStrategy {
|
|
14
|
+
private readonly setter;
|
|
15
|
+
private strategyDecoratorParams;
|
|
16
|
+
constructor(setter: ResponseHeadersSetter, strategyDecoratorParams: AssetOutputStrategyDecoratorParams);
|
|
17
|
+
output(asset: Asset): Promise<AssetReply>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SetResponseHeaders = void 0;
|
|
7
|
+
class SetResponseHeaders {
|
|
8
|
+
constructor(setter, strategyDecoratorParams) {
|
|
9
|
+
this.strategyDecoratorParams = strategyDecoratorParams;
|
|
10
|
+
this.setter = setter;
|
|
11
|
+
}
|
|
12
|
+
async output(asset) {
|
|
13
|
+
const reply = await this.strategyDecoratorParams.assetOutputStrategy.output(asset);
|
|
14
|
+
await this.setter({
|
|
15
|
+
asset: this.strategyDecoratorParams.asset,
|
|
16
|
+
assetRequest: this.strategyDecoratorParams.assetRequest,
|
|
17
|
+
context: this.strategyDecoratorParams.context,
|
|
18
|
+
headers: reply.getHeaders()
|
|
19
|
+
});
|
|
20
|
+
return reply;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.SetResponseHeaders = SetResponseHeaders;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=SetResponseHeaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SetResponseHeaders","constructor","setter","strategyDecoratorParams","output","asset","reply","assetOutputStrategy","assetRequest","context","headers","getHeaders","exports"],"sources":["SetResponseHeaders.ts"],"sourcesContent":["import type {\n AssetOutputStrategy,\n Asset,\n AssetReply,\n AssetRequest,\n AssetOutputStrategyDecoratorParams\n} from \"~/delivery\";\nimport type { FileManagerContext } from \"~/types\";\nimport type { ResponseHeaders } from \"@webiny/handler\";\n\nexport interface ResponseHeadersParams {\n headers: ResponseHeaders;\n context: FileManagerContext;\n assetRequest: AssetRequest;\n asset: Asset;\n}\n\nexport interface ResponseHeadersSetter {\n (params: ResponseHeadersParams): Promise<void> | void;\n}\n\nexport class SetResponseHeaders implements AssetOutputStrategy {\n private readonly setter: ResponseHeadersSetter;\n private strategyDecoratorParams: AssetOutputStrategyDecoratorParams;\n\n constructor(\n setter: ResponseHeadersSetter,\n strategyDecoratorParams: AssetOutputStrategyDecoratorParams\n ) {\n this.strategyDecoratorParams = strategyDecoratorParams;\n this.setter = setter;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const reply = await this.strategyDecoratorParams.assetOutputStrategy.output(asset);\n\n await this.setter({\n asset: this.strategyDecoratorParams.asset,\n assetRequest: this.strategyDecoratorParams.assetRequest,\n context: this.strategyDecoratorParams.context,\n headers: reply.getHeaders()\n });\n\n return reply;\n }\n}\n"],"mappings":";;;;;;AAqBO,MAAMA,kBAAkB,CAAgC;EAI3DC,WAAWA,CACPC,MAA6B,EAC7BC,uBAA2D,EAC7D;IACE,IAAI,CAACA,uBAAuB,GAAGA,uBAAuB;IACtD,IAAI,CAACD,MAAM,GAAGA,MAAM;EACxB;EAEA,MAAME,MAAMA,CAACC,KAAY,EAAuB;IAC5C,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACH,uBAAuB,CAACI,mBAAmB,CAACH,MAAM,CAACC,KAAK,CAAC;IAElF,MAAM,IAAI,CAACH,MAAM,CAAC;MACdG,KAAK,EAAE,IAAI,CAACF,uBAAuB,CAACE,KAAK;MACzCG,YAAY,EAAE,IAAI,CAACL,uBAAuB,CAACK,YAAY;MACvDC,OAAO,EAAE,IAAI,CAACN,uBAAuB,CAACM,OAAO;MAC7CC,OAAO,EAAEJ,KAAK,CAACK,UAAU,CAAC;IAC9B,CAAC,CAAC;IAEF,OAAOL,KAAK;EAChB;AACJ;AAACM,OAAA,CAAAZ,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetContentsReader.ts"],"sourcesContent":["import type { Asset } from \"~/delivery\";\n\nexport interface AssetContentsReader {\n read(asset: Asset): Promise<Buffer>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetOutputStrategy.ts"],"sourcesContent":["import type { Asset, AssetReply } from \"~/delivery\";\n\nexport interface AssetOutputStrategy {\n output(asset: Asset): Promise<AssetReply>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetProcessor.ts"],"sourcesContent":["import type { Asset, AssetRequest } from \"~/delivery\";\n\nexport interface AssetProcessor {\n process(assetRequest: AssetRequest, asset: Asset): Promise<Asset>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ResponseHeaders } from "@webiny/handler";
|
|
2
|
+
interface HeadersSetter {
|
|
3
|
+
(headers: ResponseHeaders): ResponseHeaders;
|
|
4
|
+
}
|
|
5
|
+
interface AssetReplyParams {
|
|
6
|
+
code: number;
|
|
7
|
+
headers?: ResponseHeaders;
|
|
8
|
+
body?: AssetReplyBody;
|
|
9
|
+
}
|
|
10
|
+
interface AssetReplyBody {
|
|
11
|
+
(): Promise<unknown> | unknown;
|
|
12
|
+
}
|
|
13
|
+
export declare class AssetReply {
|
|
14
|
+
private headers;
|
|
15
|
+
private code;
|
|
16
|
+
private body;
|
|
17
|
+
constructor(params?: AssetReplyParams);
|
|
18
|
+
setHeaders(cb: HeadersSetter): void;
|
|
19
|
+
getHeaders(): ResponseHeaders;
|
|
20
|
+
setCode(code: number): void;
|
|
21
|
+
getCode(): number;
|
|
22
|
+
setBody(body: AssetReplyBody): void;
|
|
23
|
+
getBody(): unknown;
|
|
24
|
+
}
|
|
25
|
+
export {};
|