@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,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AssetReply = void 0;
|
|
7
|
+
var _handler = require("@webiny/handler");
|
|
8
|
+
const defaultBody = () => "";
|
|
9
|
+
class AssetReply {
|
|
10
|
+
constructor(params = {
|
|
11
|
+
code: 200
|
|
12
|
+
}) {
|
|
13
|
+
this.code = params.code;
|
|
14
|
+
this.headers = params.headers || _handler.ResponseHeaders.create();
|
|
15
|
+
this.body = params.body || defaultBody;
|
|
16
|
+
}
|
|
17
|
+
setHeaders(cb) {
|
|
18
|
+
this.headers = cb(this.headers);
|
|
19
|
+
}
|
|
20
|
+
getHeaders() {
|
|
21
|
+
return this.headers;
|
|
22
|
+
}
|
|
23
|
+
setCode(code) {
|
|
24
|
+
this.code = code;
|
|
25
|
+
}
|
|
26
|
+
getCode() {
|
|
27
|
+
return this.code;
|
|
28
|
+
}
|
|
29
|
+
setBody(body) {
|
|
30
|
+
this.body = body;
|
|
31
|
+
}
|
|
32
|
+
getBody() {
|
|
33
|
+
return this.body();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.AssetReply = AssetReply;
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=AssetReply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_handler","require","defaultBody","AssetReply","constructor","params","code","headers","ResponseHeaders","create","body","setHeaders","cb","getHeaders","setCode","getCode","setBody","getBody","exports"],"sources":["AssetReply.ts"],"sourcesContent":["import { ResponseHeaders } from \"@webiny/handler\";\n\ninterface HeadersSetter {\n (headers: ResponseHeaders): ResponseHeaders;\n}\n\ninterface AssetReplyParams {\n code: number;\n headers?: ResponseHeaders;\n body?: AssetReplyBody;\n}\n\ninterface AssetReplyBody {\n (): Promise<unknown> | unknown;\n}\n\nconst defaultBody = () => \"\";\n\nexport class AssetReply {\n private headers: ResponseHeaders;\n private code: number;\n private body: AssetReplyBody;\n\n constructor(params: AssetReplyParams = { code: 200 }) {\n this.code = params.code;\n this.headers = params.headers || ResponseHeaders.create();\n this.body = params.body || defaultBody;\n }\n\n setHeaders(cb: HeadersSetter) {\n this.headers = cb(this.headers);\n }\n\n getHeaders() {\n return this.headers;\n }\n\n setCode(code: number) {\n this.code = code;\n }\n\n getCode() {\n return this.code;\n }\n\n setBody(body: AssetReplyBody) {\n this.body = body;\n }\n\n getBody() {\n return this.body();\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAgBA,MAAMC,WAAW,GAAGA,CAAA,KAAM,EAAE;AAErB,MAAMC,UAAU,CAAC;EAKpBC,WAAWA,CAACC,MAAwB,GAAG;IAAEC,IAAI,EAAE;EAAI,CAAC,EAAE;IAClD,IAAI,CAACA,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,OAAO,GAAGF,MAAM,CAACE,OAAO,IAAIC,wBAAe,CAACC,MAAM,CAAC,CAAC;IACzD,IAAI,CAACC,IAAI,GAAGL,MAAM,CAACK,IAAI,IAAIR,WAAW;EAC1C;EAEAS,UAAUA,CAACC,EAAiB,EAAE;IAC1B,IAAI,CAACL,OAAO,GAAGK,EAAE,CAAC,IAAI,CAACL,OAAO,CAAC;EACnC;EAEAM,UAAUA,CAAA,EAAG;IACT,OAAO,IAAI,CAACN,OAAO;EACvB;EAEAO,OAAOA,CAACR,IAAY,EAAE;IAClB,IAAI,CAACA,IAAI,GAAGA,IAAI;EACpB;EAEAS,OAAOA,CAAA,EAAG;IACN,OAAO,IAAI,CAACT,IAAI;EACpB;EAEAU,OAAOA,CAACN,IAAoB,EAAE;IAC1B,IAAI,CAACA,IAAI,GAAGA,IAAI;EACpB;EAEAO,OAAOA,CAAA,EAAG;IACN,OAAO,IAAI,CAACP,IAAI,CAAC,CAAC;EACtB;AACJ;AAACQ,OAAA,CAAAf,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetRequestResolver.ts"],"sourcesContent":["import type { Request } from \"@webiny/handler/types\";\nimport type { AssetRequest } from \"~/delivery\";\n\nexport interface AssetRequestResolver {\n resolve(request: Request): Promise<AssetRequest | undefined>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetResolver.ts"],"sourcesContent":["import type { Asset, AssetRequest } from \"~/delivery\";\n\nexport interface AssetResolver {\n resolve(request: AssetRequest): Promise<Asset | undefined>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetTransformationStrategy.ts"],"sourcesContent":["import type { Asset, AssetRequest } from \"~/delivery\";\n\nexport interface AssetTransformationStrategy {\n transform(assetRequest: AssetRequest, asset: Asset): Promise<Asset>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createAssetDeliveryPluginLoader = void 0;
|
|
7
|
+
const createAssetDeliveryPluginLoader = cb => {
|
|
8
|
+
if (process.env.WEBINY_FUNCTION_TYPE === "asset-delivery") {
|
|
9
|
+
return () => cb();
|
|
10
|
+
}
|
|
11
|
+
return () => Promise.resolve([]);
|
|
12
|
+
};
|
|
13
|
+
exports.createAssetDeliveryPluginLoader = createAssetDeliveryPluginLoader;
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=createAssetDeliveryPluginLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createAssetDeliveryPluginLoader","cb","process","env","WEBINY_FUNCTION_TYPE","Promise","resolve","exports"],"sources":["createAssetDeliveryPluginLoader.ts"],"sourcesContent":["import type { PluginFactory } from \"@webiny/plugins/types\";\n\nexport const createAssetDeliveryPluginLoader = (cb: PluginFactory): PluginFactory => {\n if (process.env.WEBINY_FUNCTION_TYPE === \"asset-delivery\") {\n return () => cb();\n }\n\n return () => Promise.resolve([]);\n};\n"],"mappings":";;;;;;AAEO,MAAMA,+BAA+B,GAAIC,EAAiB,IAAoB;EACjF,IAAIC,OAAO,CAACC,GAAG,CAACC,oBAAoB,KAAK,gBAAgB,EAAE;IACvD,OAAO,MAAMH,EAAE,CAAC,CAAC;EACrB;EAEA,OAAO,MAAMI,OAAO,CAACC,OAAO,CAAC,EAAE,CAAC;AACpC,CAAC;AAACC,OAAA,CAAAP,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["AssetAuthorizer.ts"],"sourcesContent":["import type { File } from \"~/types\";\n\nexport interface AssetAuthorizer {\n authorize(file: File): Promise<void>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NotAuthorizedAssetReply = void 0;
|
|
7
|
+
var _handler = require("@webiny/handler");
|
|
8
|
+
var _ = require("../..");
|
|
9
|
+
class NotAuthorizedAssetReply extends _.AssetReply {
|
|
10
|
+
constructor() {
|
|
11
|
+
super({
|
|
12
|
+
code: 403,
|
|
13
|
+
headers: _handler.ResponseHeaders.create({
|
|
14
|
+
"cache-control": "no-store",
|
|
15
|
+
"content-type": "application/json; charset=utf-8"
|
|
16
|
+
}),
|
|
17
|
+
body: () => ({
|
|
18
|
+
error: "Not authorized!",
|
|
19
|
+
code: "NOT_AUTHORIZED"
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.NotAuthorizedAssetReply = NotAuthorizedAssetReply;
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=NotAuthorizedAssetReply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_handler","require","_","NotAuthorizedAssetReply","AssetReply","constructor","code","headers","ResponseHeaders","create","body","error","exports"],"sources":["NotAuthorizedAssetReply.ts"],"sourcesContent":["import { ResponseHeaders } from \"@webiny/handler\";\nimport { AssetReply } from \"~/delivery\";\n\nexport class NotAuthorizedAssetReply extends AssetReply {\n constructor() {\n super({\n code: 403,\n headers: ResponseHeaders.create({\n \"cache-control\": \"no-store\",\n \"content-type\": \"application/json; charset=utf-8\"\n }),\n body: () => ({ error: \"Not authorized!\", code: \"NOT_AUTHORIZED\" })\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AAEO,MAAME,uBAAuB,SAASC,YAAU,CAAC;EACpDC,WAAWA,CAAA,EAAG;IACV,KAAK,CAAC;MACFC,IAAI,EAAE,GAAG;MACTC,OAAO,EAAEC,wBAAe,CAACC,MAAM,CAAC;QAC5B,eAAe,EAAE,UAAU;QAC3B,cAAc,EAAE;MACpB,CAAC,CAAC;MACFC,IAAI,EAAEA,CAAA,MAAO;QAAEC,KAAK,EAAE,iBAAiB;QAAEL,IAAI,EAAE;MAAiB,CAAC;IACrE,CAAC,CAAC;EACN;AACJ;AAACM,OAAA,CAAAT,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NotAuthorizedOutputStrategy = void 0;
|
|
7
|
+
var _NotAuthorizedAssetReply = require("./NotAuthorizedAssetReply");
|
|
8
|
+
class NotAuthorizedOutputStrategy {
|
|
9
|
+
async output() {
|
|
10
|
+
return new _NotAuthorizedAssetReply.NotAuthorizedAssetReply();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.NotAuthorizedOutputStrategy = NotAuthorizedOutputStrategy;
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=NotAuthorizedOutputStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NotAuthorizedAssetReply","require","NotAuthorizedOutputStrategy","output","NotAuthorizedAssetReply","exports"],"sources":["NotAuthorizedOutputStrategy.ts"],"sourcesContent":["import type { AssetOutputStrategy, AssetReply } from \"~/delivery\";\nimport { NotAuthorizedAssetReply } from \"./NotAuthorizedAssetReply\";\n\nexport class NotAuthorizedOutputStrategy implements AssetOutputStrategy {\n async output(): Promise<AssetReply> {\n return new NotAuthorizedAssetReply();\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,wBAAA,GAAAC,OAAA;AAEO,MAAMC,2BAA2B,CAAgC;EACpE,MAAMC,MAAMA,CAAA,EAAwB;IAChC,OAAO,IAAIC,gDAAuB,CAAC,CAAC;EACxC;AACJ;AAACC,OAAA,CAAAH,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { File, FileManagerContext } from "../../../types";
|
|
2
|
+
import type { AssetAuthorizer } from "./AssetAuthorizer";
|
|
3
|
+
export declare class PrivateAuthenticatedAuthorizer implements AssetAuthorizer {
|
|
4
|
+
private context;
|
|
5
|
+
constructor(context: FileManagerContext);
|
|
6
|
+
authorize(file: File): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PrivateAuthenticatedAuthorizer = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
class PrivateAuthenticatedAuthorizer {
|
|
10
|
+
constructor(context) {
|
|
11
|
+
this.context = context;
|
|
12
|
+
}
|
|
13
|
+
async authorize(file) {
|
|
14
|
+
if (file.accessControl && file.accessControl.type === "private-authenticated") {
|
|
15
|
+
// Make sure there's a valid identity!
|
|
16
|
+
const identity = this.context.security.getIdentity();
|
|
17
|
+
if (!identity) {
|
|
18
|
+
throw new _error.default({
|
|
19
|
+
code: "NOT_AUTHORIZED",
|
|
20
|
+
message: "You're not authorized to access this asset!"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.PrivateAuthenticatedAuthorizer = PrivateAuthenticatedAuthorizer;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=PrivateAuthenticatedAuthorizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","PrivateAuthenticatedAuthorizer","constructor","context","authorize","file","accessControl","type","identity","security","getIdentity","Error","code","message","exports"],"sources":["PrivateAuthenticatedAuthorizer.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport type { File, FileManagerContext } from \"~/types\";\nimport type { AssetAuthorizer } from \"./AssetAuthorizer\";\n\nexport class PrivateAuthenticatedAuthorizer implements AssetAuthorizer {\n private context: FileManagerContext;\n\n constructor(context: FileManagerContext) {\n this.context = context;\n }\n\n async authorize(file: File) {\n if (file.accessControl && file.accessControl.type === \"private-authenticated\") {\n // Make sure there's a valid identity!\n const identity = this.context.security.getIdentity();\n\n if (!identity) {\n throw new Error({\n code: \"NOT_AUTHORIZED\",\n message: \"You're not authorized to access this asset!\"\n });\n }\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIO,MAAMC,8BAA8B,CAA4B;EAGnEC,WAAWA,CAACC,OAA2B,EAAE;IACrC,IAAI,CAACA,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAMC,SAASA,CAACC,IAAU,EAAE;IACxB,IAAIA,IAAI,CAACC,aAAa,IAAID,IAAI,CAACC,aAAa,CAACC,IAAI,KAAK,uBAAuB,EAAE;MAC3E;MACA,MAAMC,QAAQ,GAAG,IAAI,CAACL,OAAO,CAACM,QAAQ,CAACC,WAAW,CAAC,CAAC;MAEpD,IAAI,CAACF,QAAQ,EAAE;QACX,MAAM,IAAIG,cAAK,CAAC;UACZC,IAAI,EAAE,gBAAgB;UACtBC,OAAO,EAAE;QACb,CAAC,CAAC;MACN;IACJ;EACJ;AACJ;AAACC,OAAA,CAAAb,8BAAA,GAAAA,8BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PrivateCache = void 0;
|
|
7
|
+
var _cacheControlParser = require("cache-control-parser");
|
|
8
|
+
class PrivateCache {
|
|
9
|
+
constructor(strategy) {
|
|
10
|
+
this.strategy = strategy;
|
|
11
|
+
}
|
|
12
|
+
async output(asset) {
|
|
13
|
+
const reply = await this.strategy.output(asset);
|
|
14
|
+
reply.setHeaders(headers => {
|
|
15
|
+
headers.set("cache-control", (value = "") => {
|
|
16
|
+
const cacheControl = (0, _cacheControlParser.parse)(value);
|
|
17
|
+
cacheControl["private"] = true;
|
|
18
|
+
cacheControl["public"] = false;
|
|
19
|
+
return (0, _cacheControlParser.stringify)(cacheControl);
|
|
20
|
+
});
|
|
21
|
+
return headers;
|
|
22
|
+
});
|
|
23
|
+
return reply;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.PrivateCache = PrivateCache;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=PrivateCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_cacheControlParser","require","PrivateCache","constructor","strategy","output","asset","reply","setHeaders","headers","set","value","cacheControl","parse","stringify","exports"],"sources":["PrivateCache.ts"],"sourcesContent":["import { parse, stringify } from \"cache-control-parser\";\nimport type { Asset, AssetOutputStrategy, AssetReply } from \"~/delivery\";\n\nexport class PrivateCache implements AssetOutputStrategy {\n private strategy: AssetOutputStrategy;\n\n constructor(strategy: AssetOutputStrategy) {\n this.strategy = strategy;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const reply = await this.strategy.output(asset);\n\n reply.setHeaders(headers => {\n headers.set(\"cache-control\", (value = \"\") => {\n const cacheControl = parse(value);\n cacheControl[\"private\"] = true;\n cacheControl[\"public\"] = false;\n return stringify(cacheControl);\n });\n return headers;\n });\n\n return reply;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAGO,MAAMC,YAAY,CAAgC;EAGrDC,WAAWA,CAACC,QAA6B,EAAE;IACvC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAMC,MAAMA,CAACC,KAAY,EAAuB;IAC5C,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACH,QAAQ,CAACC,MAAM,CAACC,KAAK,CAAC;IAE/CC,KAAK,CAACC,UAAU,CAACC,OAAO,IAAI;MACxBA,OAAO,CAACC,GAAG,CAAC,eAAe,EAAE,CAACC,KAAK,GAAG,EAAE,KAAK;QACzC,MAAMC,YAAY,GAAG,IAAAC,yBAAK,EAACF,KAAK,CAAC;QACjCC,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI;QAC9BA,YAAY,CAAC,QAAQ,CAAC,GAAG,KAAK;QAC9B,OAAO,IAAAE,6BAAS,EAACF,YAAY,CAAC;MAClC,CAAC,CAAC;MACF,OAAOH,OAAO;IAClB,CAAC,CAAC;IAEF,OAAOF,KAAK;EAChB;AACJ;AAACQ,OAAA,CAAAb,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AssetRequestResolver } from "../..";
|
|
2
|
+
import { AssetRequest } from "../..";
|
|
3
|
+
import type { Request } from "@webiny/handler/types";
|
|
4
|
+
export declare class PrivateFileAssetRequestResolver implements AssetRequestResolver {
|
|
5
|
+
private readonly resolver;
|
|
6
|
+
constructor(resolver: AssetRequestResolver);
|
|
7
|
+
resolve(request: Request): Promise<AssetRequest | undefined>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PrivateFileAssetRequestResolver = void 0;
|
|
7
|
+
var _ = require("../..");
|
|
8
|
+
class PrivateFileAssetRequestResolver {
|
|
9
|
+
constructor(resolver) {
|
|
10
|
+
this.resolver = resolver;
|
|
11
|
+
}
|
|
12
|
+
async resolve(request) {
|
|
13
|
+
// Example: /private/65722cb5c7824a0008d05963/image-48.jpg?width=300
|
|
14
|
+
if (!request.url.startsWith("/private/")) {
|
|
15
|
+
return this.resolver.resolve(request);
|
|
16
|
+
}
|
|
17
|
+
const params = request.params ?? {};
|
|
18
|
+
const query = request.query ?? {};
|
|
19
|
+
|
|
20
|
+
// Example: { '*': '/private/65722cb5c7824a0008d05963/image-48.jpg' },
|
|
21
|
+
const path = params["*"];
|
|
22
|
+
return new _.AssetRequest({
|
|
23
|
+
key: decodeURI(path).replace("/private/", ""),
|
|
24
|
+
context: {
|
|
25
|
+
url: request.url,
|
|
26
|
+
private: true
|
|
27
|
+
},
|
|
28
|
+
options: {
|
|
29
|
+
...query,
|
|
30
|
+
width: query.width ? parseInt(query.width) : undefined
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.PrivateFileAssetRequestResolver = PrivateFileAssetRequestResolver;
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=PrivateFileAssetRequestResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_","require","PrivateFileAssetRequestResolver","constructor","resolver","resolve","request","url","startsWith","params","query","path","AssetRequest","key","decodeURI","replace","context","private","options","width","parseInt","undefined","exports"],"sources":["PrivateFileAssetRequestResolver.ts"],"sourcesContent":["import type { AssetRequestResolver } from \"~/delivery\";\nimport { AssetRequest } from \"~/delivery\";\nimport type { Request } from \"@webiny/handler/types\";\n\nexport class PrivateFileAssetRequestResolver implements AssetRequestResolver {\n private readonly resolver: AssetRequestResolver;\n\n constructor(resolver: AssetRequestResolver) {\n this.resolver = resolver;\n }\n\n async resolve(request: Request): Promise<AssetRequest | undefined> {\n // Example: /private/65722cb5c7824a0008d05963/image-48.jpg?width=300\n if (!request.url.startsWith(\"/private/\")) {\n return this.resolver.resolve(request);\n }\n\n const params = (request.params ?? {}) as Record<string, any>;\n const query = (request.query ?? {}) as Record<string, any>;\n\n // Example: { '*': '/private/65722cb5c7824a0008d05963/image-48.jpg' },\n const path = params[\"*\"];\n\n return new AssetRequest({\n key: decodeURI(path).replace(\"/private/\", \"\"),\n context: {\n url: request.url,\n private: true\n },\n options: {\n ...query,\n width: query.width ? parseInt(query.width) : undefined\n }\n });\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,CAAA,GAAAC,OAAA;AAGO,MAAMC,+BAA+B,CAAiC;EAGzEC,WAAWA,CAACC,QAA8B,EAAE;IACxC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAMC,OAAOA,CAACC,OAAgB,EAAqC;IAC/D;IACA,IAAI,CAACA,OAAO,CAACC,GAAG,CAACC,UAAU,CAAC,WAAW,CAAC,EAAE;MACtC,OAAO,IAAI,CAACJ,QAAQ,CAACC,OAAO,CAACC,OAAO,CAAC;IACzC;IAEA,MAAMG,MAAM,GAAIH,OAAO,CAACG,MAAM,IAAI,CAAC,CAAyB;IAC5D,MAAMC,KAAK,GAAIJ,OAAO,CAACI,KAAK,IAAI,CAAC,CAAyB;;IAE1D;IACA,MAAMC,IAAI,GAAGF,MAAM,CAAC,GAAG,CAAC;IAExB,OAAO,IAAIG,cAAY,CAAC;MACpBC,GAAG,EAAEC,SAAS,CAACH,IAAI,CAAC,CAACI,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;MAC7CC,OAAO,EAAE;QACLT,GAAG,EAAED,OAAO,CAACC,GAAG;QAChBU,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACL,GAAGR,KAAK;QACRS,KAAK,EAAET,KAAK,CAACS,KAAK,GAAGC,QAAQ,CAACV,KAAK,CAACS,KAAK,CAAC,GAAGE;MACjD;IACJ,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAApB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FileManagerContext } from "../../../types";
|
|
2
|
+
import type { Asset, AssetProcessor, AssetRequest } from "../..";
|
|
3
|
+
import type { AssetAuthorizer } from "./AssetAuthorizer";
|
|
4
|
+
export declare class PrivateFilesAssetProcessor implements AssetProcessor {
|
|
5
|
+
private readonly context;
|
|
6
|
+
private assetProcessor;
|
|
7
|
+
private assetAuthorizer;
|
|
8
|
+
constructor(context: FileManagerContext, assetAuthorizer: AssetAuthorizer, assetProcessor: AssetProcessor);
|
|
9
|
+
process(assetRequest: AssetRequest, asset: Asset): Promise<Asset>;
|
|
10
|
+
private isPrivate;
|
|
11
|
+
private requestedViaPrivateEndpoint;
|
|
12
|
+
private requestedViaPublicEndpoint;
|
|
13
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PrivateFilesAssetProcessor = void 0;
|
|
7
|
+
var _NotAuthorizedOutputStrategy = require("./NotAuthorizedOutputStrategy");
|
|
8
|
+
var _RedirectToPublicUrlOutputStrategy = require("./RedirectToPublicUrlOutputStrategy");
|
|
9
|
+
var _RedirectToPrivateUrlOutputStrategy = require("./RedirectToPrivateUrlOutputStrategy");
|
|
10
|
+
var _PrivateCache = require("./PrivateCache");
|
|
11
|
+
var _PublicCache = require("./PublicCache");
|
|
12
|
+
class PrivateFilesAssetProcessor {
|
|
13
|
+
constructor(context, assetAuthorizer, assetProcessor) {
|
|
14
|
+
this.assetAuthorizer = assetAuthorizer;
|
|
15
|
+
this.context = context;
|
|
16
|
+
this.assetProcessor = assetProcessor;
|
|
17
|
+
}
|
|
18
|
+
async process(assetRequest, asset) {
|
|
19
|
+
const id = asset.getId();
|
|
20
|
+
const {
|
|
21
|
+
security,
|
|
22
|
+
fileManager
|
|
23
|
+
} = this.context;
|
|
24
|
+
|
|
25
|
+
// Get file from File Manager by `id`.
|
|
26
|
+
const file = await security.withoutAuthorization(() => fileManager.getFile(id));
|
|
27
|
+
const isPrivateFile = this.isPrivate(file);
|
|
28
|
+
if (!isPrivateFile && this.requestedViaPrivateEndpoint(assetRequest)) {
|
|
29
|
+
asset.setOutputStrategy(new _RedirectToPublicUrlOutputStrategy.RedirectToPublicUrlOutputStrategy(assetRequest));
|
|
30
|
+
return asset;
|
|
31
|
+
}
|
|
32
|
+
if (isPrivateFile && this.requestedViaPublicEndpoint(assetRequest)) {
|
|
33
|
+
asset.setOutputStrategy(new _RedirectToPrivateUrlOutputStrategy.RedirectToPrivateUrlOutputStrategy(assetRequest));
|
|
34
|
+
return asset;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
await this.assetAuthorizer.authorize(file);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
asset.setOutputStrategy(new _NotAuthorizedOutputStrategy.NotAuthorizedOutputStrategy());
|
|
40
|
+
return asset;
|
|
41
|
+
}
|
|
42
|
+
const processedAsset = await this.assetProcessor.process(assetRequest, asset);
|
|
43
|
+
processedAsset.setOutputStrategy(strategy => {
|
|
44
|
+
if (!strategy) {
|
|
45
|
+
throw Error(`No asset output strategy is configured!`);
|
|
46
|
+
}
|
|
47
|
+
return isPrivateFile ? new _PrivateCache.PrivateCache(strategy) : new _PublicCache.PublicCache(strategy);
|
|
48
|
+
});
|
|
49
|
+
return processedAsset;
|
|
50
|
+
}
|
|
51
|
+
isPrivate(file) {
|
|
52
|
+
return file.accessControl && file.accessControl.type.startsWith("private-");
|
|
53
|
+
}
|
|
54
|
+
requestedViaPrivateEndpoint(assetRequest) {
|
|
55
|
+
return assetRequest.getContext().private;
|
|
56
|
+
}
|
|
57
|
+
requestedViaPublicEndpoint(assetRequest) {
|
|
58
|
+
return !this.requestedViaPrivateEndpoint(assetRequest);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.PrivateFilesAssetProcessor = PrivateFilesAssetProcessor;
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=PrivateFilesAssetProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NotAuthorizedOutputStrategy","require","_RedirectToPublicUrlOutputStrategy","_RedirectToPrivateUrlOutputStrategy","_PrivateCache","_PublicCache","PrivateFilesAssetProcessor","constructor","context","assetAuthorizer","assetProcessor","process","assetRequest","asset","id","getId","security","fileManager","file","withoutAuthorization","getFile","isPrivateFile","isPrivate","requestedViaPrivateEndpoint","setOutputStrategy","RedirectToPublicUrlOutputStrategy","requestedViaPublicEndpoint","RedirectToPrivateUrlOutputStrategy","authorize","error","NotAuthorizedOutputStrategy","processedAsset","strategy","Error","PrivateCache","PublicCache","accessControl","type","startsWith","getContext","private","exports"],"sources":["PrivateFilesAssetProcessor.ts"],"sourcesContent":["import type { File, FileManagerContext } from \"~/types\";\nimport type { Asset, AssetProcessor, AssetRequest } from \"~/delivery\";\nimport type { AssetAuthorizer } from \"./AssetAuthorizer\";\nimport { NotAuthorizedOutputStrategy } from \"./NotAuthorizedOutputStrategy\";\nimport { RedirectToPublicUrlOutputStrategy } from \"./RedirectToPublicUrlOutputStrategy\";\nimport { RedirectToPrivateUrlOutputStrategy } from \"./RedirectToPrivateUrlOutputStrategy\";\nimport { PrivateCache } from \"./PrivateCache\";\nimport { PublicCache } from \"./PublicCache\";\n\ninterface MaybePrivate {\n private?: boolean;\n}\n\nexport class PrivateFilesAssetProcessor implements AssetProcessor {\n private readonly context: FileManagerContext;\n private assetProcessor: AssetProcessor;\n private assetAuthorizer: AssetAuthorizer;\n\n constructor(\n context: FileManagerContext,\n assetAuthorizer: AssetAuthorizer,\n assetProcessor: AssetProcessor\n ) {\n this.assetAuthorizer = assetAuthorizer;\n this.context = context;\n this.assetProcessor = assetProcessor;\n }\n\n async process(assetRequest: AssetRequest, asset: Asset): Promise<Asset> {\n const id = asset.getId();\n const { security, fileManager } = this.context;\n\n // Get file from File Manager by `id`.\n const file = await security.withoutAuthorization(() => fileManager.getFile(id));\n\n const isPrivateFile = this.isPrivate(file);\n\n if (!isPrivateFile && this.requestedViaPrivateEndpoint(assetRequest)) {\n asset.setOutputStrategy(new RedirectToPublicUrlOutputStrategy(assetRequest));\n return asset;\n }\n\n if (isPrivateFile && this.requestedViaPublicEndpoint(assetRequest)) {\n asset.setOutputStrategy(new RedirectToPrivateUrlOutputStrategy(assetRequest));\n return asset;\n }\n\n try {\n await this.assetAuthorizer.authorize(file);\n } catch (error) {\n asset.setOutputStrategy(new NotAuthorizedOutputStrategy());\n\n return asset;\n }\n\n const processedAsset = await this.assetProcessor.process(assetRequest, asset);\n\n processedAsset.setOutputStrategy(strategy => {\n if (!strategy) {\n throw Error(`No asset output strategy is configured!`);\n }\n return isPrivateFile ? new PrivateCache(strategy) : new PublicCache(strategy);\n });\n\n return processedAsset;\n }\n\n private isPrivate(file: File) {\n return file.accessControl && file.accessControl.type.startsWith(\"private-\");\n }\n\n private requestedViaPrivateEndpoint(assetRequest: AssetRequest) {\n return assetRequest.getContext<MaybePrivate>().private;\n }\n\n private requestedViaPublicEndpoint(assetRequest: AssetRequest) {\n return !this.requestedViaPrivateEndpoint(assetRequest);\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,4BAAA,GAAAC,OAAA;AACA,IAAAC,kCAAA,GAAAD,OAAA;AACA,IAAAE,mCAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAMO,MAAMK,0BAA0B,CAA2B;EAK9DC,WAAWA,CACPC,OAA2B,EAC3BC,eAAgC,EAChCC,cAA8B,EAChC;IACE,IAAI,CAACD,eAAe,GAAGA,eAAe;IACtC,IAAI,CAACD,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,cAAc,GAAGA,cAAc;EACxC;EAEA,MAAMC,OAAOA,CAACC,YAA0B,EAAEC,KAAY,EAAkB;IACpE,MAAMC,EAAE,GAAGD,KAAK,CAACE,KAAK,CAAC,CAAC;IACxB,MAAM;MAAEC,QAAQ;MAAEC;IAAY,CAAC,GAAG,IAAI,CAACT,OAAO;;IAE9C;IACA,MAAMU,IAAI,GAAG,MAAMF,QAAQ,CAACG,oBAAoB,CAAC,MAAMF,WAAW,CAACG,OAAO,CAACN,EAAE,CAAC,CAAC;IAE/E,MAAMO,aAAa,GAAG,IAAI,CAACC,SAAS,CAACJ,IAAI,CAAC;IAE1C,IAAI,CAACG,aAAa,IAAI,IAAI,CAACE,2BAA2B,CAACX,YAAY,CAAC,EAAE;MAClEC,KAAK,CAACW,iBAAiB,CAAC,IAAIC,oEAAiC,CAACb,YAAY,CAAC,CAAC;MAC5E,OAAOC,KAAK;IAChB;IAEA,IAAIQ,aAAa,IAAI,IAAI,CAACK,0BAA0B,CAACd,YAAY,CAAC,EAAE;MAChEC,KAAK,CAACW,iBAAiB,CAAC,IAAIG,sEAAkC,CAACf,YAAY,CAAC,CAAC;MAC7E,OAAOC,KAAK;IAChB;IAEA,IAAI;MACA,MAAM,IAAI,CAACJ,eAAe,CAACmB,SAAS,CAACV,IAAI,CAAC;IAC9C,CAAC,CAAC,OAAOW,KAAK,EAAE;MACZhB,KAAK,CAACW,iBAAiB,CAAC,IAAIM,wDAA2B,CAAC,CAAC,CAAC;MAE1D,OAAOjB,KAAK;IAChB;IAEA,MAAMkB,cAAc,GAAG,MAAM,IAAI,CAACrB,cAAc,CAACC,OAAO,CAACC,YAAY,EAAEC,KAAK,CAAC;IAE7EkB,cAAc,CAACP,iBAAiB,CAACQ,QAAQ,IAAI;MACzC,IAAI,CAACA,QAAQ,EAAE;QACX,MAAMC,KAAK,CAAC,yCAAyC,CAAC;MAC1D;MACA,OAAOZ,aAAa,GAAG,IAAIa,0BAAY,CAACF,QAAQ,CAAC,GAAG,IAAIG,wBAAW,CAACH,QAAQ,CAAC;IACjF,CAAC,CAAC;IAEF,OAAOD,cAAc;EACzB;EAEQT,SAASA,CAACJ,IAAU,EAAE;IAC1B,OAAOA,IAAI,CAACkB,aAAa,IAAIlB,IAAI,CAACkB,aAAa,CAACC,IAAI,CAACC,UAAU,CAAC,UAAU,CAAC;EAC/E;EAEQf,2BAA2BA,CAACX,YAA0B,EAAE;IAC5D,OAAOA,YAAY,CAAC2B,UAAU,CAAe,CAAC,CAACC,OAAO;EAC1D;EAEQd,0BAA0BA,CAACd,YAA0B,EAAE;IAC3D,OAAO,CAAC,IAAI,CAACW,2BAA2B,CAACX,YAAY,CAAC;EAC1D;AACJ;AAAC6B,OAAA,CAAAnC,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PublicCache = void 0;
|
|
7
|
+
var _cacheControlParser = require("cache-control-parser");
|
|
8
|
+
class PublicCache {
|
|
9
|
+
constructor(strategy) {
|
|
10
|
+
this.strategy = strategy;
|
|
11
|
+
}
|
|
12
|
+
async output(asset) {
|
|
13
|
+
const reply = await this.strategy.output(asset);
|
|
14
|
+
reply.setHeaders(headers => {
|
|
15
|
+
headers.set("cache-control", (value = "") => {
|
|
16
|
+
const cacheControl = (0, _cacheControlParser.parse)(value);
|
|
17
|
+
cacheControl["private"] = false;
|
|
18
|
+
cacheControl["public"] = true;
|
|
19
|
+
return (0, _cacheControlParser.stringify)(cacheControl);
|
|
20
|
+
});
|
|
21
|
+
return headers;
|
|
22
|
+
});
|
|
23
|
+
return reply;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.PublicCache = PublicCache;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=PublicCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_cacheControlParser","require","PublicCache","constructor","strategy","output","asset","reply","setHeaders","headers","set","value","cacheControl","parse","stringify","exports"],"sources":["PublicCache.ts"],"sourcesContent":["import { parse, stringify } from \"cache-control-parser\";\nimport type { Asset, AssetOutputStrategy, AssetReply } from \"~/delivery\";\n\nexport class PublicCache implements AssetOutputStrategy {\n private strategy: AssetOutputStrategy;\n\n constructor(strategy: AssetOutputStrategy) {\n this.strategy = strategy;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const reply = await this.strategy.output(asset);\n\n reply.setHeaders(headers => {\n headers.set(\"cache-control\", (value = \"\") => {\n const cacheControl = parse(value);\n cacheControl[\"private\"] = false;\n cacheControl[\"public\"] = true;\n return stringify(cacheControl);\n });\n return headers;\n });\n\n return reply;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAGO,MAAMC,WAAW,CAAgC;EAGpDC,WAAWA,CAACC,QAA6B,EAAE;IACvC,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC5B;EAEA,MAAMC,MAAMA,CAACC,KAAY,EAAuB;IAC5C,MAAMC,KAAK,GAAG,MAAM,IAAI,CAACH,QAAQ,CAACC,MAAM,CAACC,KAAK,CAAC;IAE/CC,KAAK,CAACC,UAAU,CAACC,OAAO,IAAI;MACxBA,OAAO,CAACC,GAAG,CAAC,eAAe,EAAE,CAACC,KAAK,GAAG,EAAE,KAAK;QACzC,MAAMC,YAAY,GAAG,IAAAC,yBAAK,EAACF,KAAK,CAAC;QACjCC,YAAY,CAAC,SAAS,CAAC,GAAG,KAAK;QAC/BA,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI;QAC7B,OAAO,IAAAE,6BAAS,EAACF,YAAY,CAAC;MAClC,CAAC,CAAC;MACF,OAAOH,OAAO;IAClB,CAAC,CAAC;IAEF,OAAOF,KAAK;EAChB;AACJ;AAACQ,OAAA,CAAAb,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Asset, AssetOutputStrategy, AssetRequest } from "../..";
|
|
2
|
+
import { AssetReply } from "../..";
|
|
3
|
+
export declare class RedirectToPrivateUrlOutputStrategy implements AssetOutputStrategy {
|
|
4
|
+
private assetRequest;
|
|
5
|
+
constructor(assetRequest: AssetRequest);
|
|
6
|
+
output(asset: Asset): Promise<AssetReply>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RedirectToPrivateUrlOutputStrategy = void 0;
|
|
7
|
+
var _ = require("../..");
|
|
8
|
+
var _handler = require("@webiny/handler");
|
|
9
|
+
class RedirectToPrivateUrlOutputStrategy {
|
|
10
|
+
constructor(assetRequest) {
|
|
11
|
+
this.assetRequest = assetRequest;
|
|
12
|
+
}
|
|
13
|
+
async output(asset) {
|
|
14
|
+
const requestUrl = this.assetRequest.getContext().url;
|
|
15
|
+
return new _.AssetReply({
|
|
16
|
+
code: 301,
|
|
17
|
+
headers: _handler.ResponseHeaders.create({
|
|
18
|
+
location: requestUrl.replace("/files/", "/private/"),
|
|
19
|
+
"content-type": asset.getContentType(),
|
|
20
|
+
"cache-control": `public, max-age=${86400 * 30}`
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.RedirectToPrivateUrlOutputStrategy = RedirectToPrivateUrlOutputStrategy;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=RedirectToPrivateUrlOutputStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_","require","_handler","RedirectToPrivateUrlOutputStrategy","constructor","assetRequest","output","asset","requestUrl","getContext","url","AssetReply","code","headers","ResponseHeaders","create","location","replace","getContentType","exports"],"sources":["RedirectToPrivateUrlOutputStrategy.ts"],"sourcesContent":["import type { Asset, AssetOutputStrategy, AssetRequest } from \"~/delivery\";\nimport { AssetReply } from \"~/delivery\";\nimport { ResponseHeaders } from \"@webiny/handler\";\n\nexport class RedirectToPrivateUrlOutputStrategy implements AssetOutputStrategy {\n private assetRequest: AssetRequest;\n\n constructor(assetRequest: AssetRequest) {\n this.assetRequest = assetRequest;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const requestUrl = this.assetRequest.getContext().url;\n\n return new AssetReply({\n code: 301,\n headers: ResponseHeaders.create({\n location: requestUrl.replace(\"/files/\", \"/private/\"),\n \"content-type\": asset.getContentType(),\n \"cache-control\": `public, max-age=${86400 * 30}`\n })\n });\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,CAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,kCAAkC,CAAgC;EAG3EC,WAAWA,CAACC,YAA0B,EAAE;IACpC,IAAI,CAACA,YAAY,GAAGA,YAAY;EACpC;EAEA,MAAMC,MAAMA,CAACC,KAAY,EAAuB;IAC5C,MAAMC,UAAU,GAAG,IAAI,CAACH,YAAY,CAACI,UAAU,CAAC,CAAC,CAACC,GAAG;IAErD,OAAO,IAAIC,YAAU,CAAC;MAClBC,IAAI,EAAE,GAAG;MACTC,OAAO,EAAEC,wBAAe,CAACC,MAAM,CAAC;QAC5BC,QAAQ,EAAER,UAAU,CAACS,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC;QACpD,cAAc,EAAEV,KAAK,CAACW,cAAc,CAAC,CAAC;QACtC,eAAe,EAAE,mBAAmB,KAAK,GAAG,EAAE;MAClD,CAAC;IACL,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAAhB,kCAAA,GAAAA,kCAAA","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Asset, AssetOutputStrategy, AssetRequest } from "../..";
|
|
2
|
+
import { AssetReply } from "../..";
|
|
3
|
+
export declare class RedirectToPublicUrlOutputStrategy implements AssetOutputStrategy {
|
|
4
|
+
private assetRequest;
|
|
5
|
+
constructor(assetRequest: AssetRequest);
|
|
6
|
+
output(asset: Asset): Promise<AssetReply>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.RedirectToPublicUrlOutputStrategy = void 0;
|
|
7
|
+
var _ = require("../..");
|
|
8
|
+
var _handler = require("@webiny/handler");
|
|
9
|
+
class RedirectToPublicUrlOutputStrategy {
|
|
10
|
+
constructor(assetRequest) {
|
|
11
|
+
this.assetRequest = assetRequest;
|
|
12
|
+
}
|
|
13
|
+
async output(asset) {
|
|
14
|
+
const requestUrl = this.assetRequest.getContext().url;
|
|
15
|
+
return new _.AssetReply({
|
|
16
|
+
code: 301,
|
|
17
|
+
headers: _handler.ResponseHeaders.create({
|
|
18
|
+
location: requestUrl.replace("/private/", "/files/"),
|
|
19
|
+
"content-type": asset.getContentType(),
|
|
20
|
+
"cache-control": `public, max-age=${86400 * 30}`
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.RedirectToPublicUrlOutputStrategy = RedirectToPublicUrlOutputStrategy;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=RedirectToPublicUrlOutputStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_","require","_handler","RedirectToPublicUrlOutputStrategy","constructor","assetRequest","output","asset","requestUrl","getContext","url","AssetReply","code","headers","ResponseHeaders","create","location","replace","getContentType","exports"],"sources":["RedirectToPublicUrlOutputStrategy.ts"],"sourcesContent":["import type { Asset, AssetOutputStrategy, AssetRequest } from \"~/delivery\";\nimport { AssetReply } from \"~/delivery\";\nimport { ResponseHeaders } from \"@webiny/handler\";\n\nexport class RedirectToPublicUrlOutputStrategy implements AssetOutputStrategy {\n private assetRequest: AssetRequest;\n\n constructor(assetRequest: AssetRequest) {\n this.assetRequest = assetRequest;\n }\n\n async output(asset: Asset): Promise<AssetReply> {\n const requestUrl = this.assetRequest.getContext().url;\n\n return new AssetReply({\n code: 301,\n headers: ResponseHeaders.create({\n location: requestUrl.replace(\"/private/\", \"/files/\"),\n \"content-type\": asset.getContentType(),\n \"cache-control\": `public, max-age=${86400 * 30}`\n })\n });\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,CAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,iCAAiC,CAAgC;EAG1EC,WAAWA,CAACC,YAA0B,EAAE;IACpC,IAAI,CAACA,YAAY,GAAGA,YAAY;EACpC;EAEA,MAAMC,MAAMA,CAACC,KAAY,EAAuB;IAC5C,MAAMC,UAAU,GAAG,IAAI,CAACH,YAAY,CAACI,UAAU,CAAC,CAAC,CAACC,GAAG;IAErD,OAAO,IAAIC,YAAU,CAAC;MAClBC,IAAI,EAAE,GAAG;MACTC,OAAO,EAAEC,wBAAe,CAACC,MAAM,CAAC;QAC5BC,QAAQ,EAAER,UAAU,CAACS,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC;QACpD,cAAc,EAAEV,KAAK,CAACW,cAAc,CAAC,CAAC;QACtC,eAAe,EAAE,mBAAmB,KAAK,GAAG,EAAE;MAClD,CAAC;IACL,CAAC,CAAC;EACN;AACJ;AAACC,OAAA,CAAAhB,iCAAA,GAAAA,iCAAA","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SecurityIdentity } from "@webiny/api-security/types";
|
|
2
|
+
/**
|
|
3
|
+
* This identity is used to bypass the current behavior of FLP. Even when using `withoutAuthorization`,
|
|
4
|
+
* FLP will complain, if the identity is `undefined`. Using this mock identity and `security.withIdentity`,
|
|
5
|
+
* we set this temporary identity for the duration of the callback execution, and FLP is happy.
|
|
6
|
+
*/
|
|
7
|
+
export declare const internalIdentity: SecurityIdentity;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.internalIdentity = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This identity is used to bypass the current behavior of FLP. Even when using `withoutAuthorization`,
|
|
9
|
+
* FLP will complain, if the identity is `undefined`. Using this mock identity and `security.withIdentity`,
|
|
10
|
+
* we set this temporary identity for the duration of the callback execution, and FLP is happy.
|
|
11
|
+
*/
|
|
12
|
+
const internalIdentity = exports.internalIdentity = {
|
|
13
|
+
id: "asset-delivery",
|
|
14
|
+
type: "asset-delivery",
|
|
15
|
+
displayName: ""
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=internalIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["internalIdentity","exports","id","type","displayName"],"sources":["internalIdentity.ts"],"sourcesContent":["import type { SecurityIdentity } from \"@webiny/api-security/types\";\n\n/**\n * This identity is used to bypass the current behavior of FLP. Even when using `withoutAuthorization`,\n * FLP will complain, if the identity is `undefined`. Using this mock identity and `security.withIdentity`,\n * we set this temporary identity for the duration of the callback execution, and FLP is happy.\n */\nexport const internalIdentity: SecurityIdentity = {\n id: \"asset-delivery\",\n type: \"asset-delivery\",\n displayName: \"\"\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMA,gBAAkC,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9CE,EAAE,EAAE,gBAAgB;EACpBC,IAAI,EAAE,gBAAgB;EACtBC,WAAW,EAAE;AACjB,CAAC","ignoreList":[]}
|