@webiny/api-file-manager 6.6.0-alpha.10 → 6.6.0-alpha.12

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.
Files changed (55) hide show
  1. package/delivery/AssetDeliveryRoute.d.ts +10 -3
  2. package/delivery/AssetDeliveryRoute.js +23 -18
  3. package/delivery/AssetDeliveryRoute.js.map +1 -1
  4. package/domain/file/FileMimeType.d.ts +12 -0
  5. package/domain/file/FileMimeType.js +24 -0
  6. package/domain/file/FileMimeType.js.map +1 -0
  7. package/domain/file/StoreFileInput.d.ts +52 -0
  8. package/domain/file/StoreFileInput.js +106 -0
  9. package/domain/file/StoreFileInput.js.map +1 -0
  10. package/domain/file/mimeTypes.js.map +1 -0
  11. package/exports/api/file-manager/file.d.ts +3 -0
  12. package/exports/api/file-manager/file.js +2 -0
  13. package/features/FileManagerFeature.js +2 -0
  14. package/features/FileManagerFeature.js.map +1 -1
  15. package/features/assetDelivery/feature.js +3 -1
  16. package/features/assetDelivery/feature.js.map +1 -1
  17. package/features/assetDelivery/privateFiles/PrivateAssetDeliveryRouteDefinition.d.ts +11 -0
  18. package/features/assetDelivery/privateFiles/PrivateAssetDeliveryRouteDefinition.js +17 -0
  19. package/features/assetDelivery/privateFiles/PrivateAssetDeliveryRouteDefinition.js.map +1 -0
  20. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js +1 -2
  21. package/features/assetDelivery/privateFiles/PrivateAuthenticatedAuthorizer.js.map +1 -1
  22. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js +1 -0
  23. package/features/assetDelivery/privateFiles/PrivateFileAssetRequestResolver.js.map +1 -1
  24. package/features/extractMetadata/ExtractMetadataHandler.d.ts +3 -1
  25. package/features/extractMetadata/ExtractMetadataHandler.js +10 -3
  26. package/features/extractMetadata/ExtractMetadataHandler.js.map +1 -1
  27. package/features/file/FileContentsStorage/abstractions.d.ts +41 -0
  28. package/features/file/FileContentsStorage/abstractions.js +5 -0
  29. package/features/file/FileContentsStorage/abstractions.js.map +1 -0
  30. package/features/file/FileContentsStorage/index.d.ts +1 -0
  31. package/features/file/FileContentsStorage/index.js +1 -0
  32. package/features/file/StoreFile/StoreFileUseCase.d.ts +38 -0
  33. package/features/file/StoreFile/StoreFileUseCase.js +156 -0
  34. package/features/file/StoreFile/StoreFileUseCase.js.map +1 -0
  35. package/features/file/StoreFile/abstractions.d.ts +33 -0
  36. package/features/file/StoreFile/abstractions.js +5 -0
  37. package/features/file/StoreFile/abstractions.js.map +1 -0
  38. package/features/file/StoreFile/feature.d.ts +4 -0
  39. package/features/file/StoreFile/feature.js +11 -0
  40. package/features/file/StoreFile/feature.js.map +1 -0
  41. package/features/file/StoreFile/index.d.ts +4 -0
  42. package/features/file/StoreFile/index.js +2 -0
  43. package/features/upload/index.d.ts +4 -1
  44. package/features/upload/index.js +2 -2
  45. package/features/upload/utils/FileExtension.js +2 -2
  46. package/features/upload/utils/FileExtension.js.map +1 -1
  47. package/features/upload/utils/FileNormalizer.js +2 -8
  48. package/features/upload/utils/FileNormalizer.js.map +1 -1
  49. package/features/upload/utils/FileUploadModifier.d.ts +12 -2
  50. package/features/upload/utils/FileUploadModifier.js +5 -3
  51. package/features/upload/utils/FileUploadModifier.js.map +1 -1
  52. package/package.json +16 -16
  53. package/features/upload/utils/mimeTypes.js.map +0 -1
  54. /package/{features/upload/utils → domain/file}/mimeTypes.d.ts +0 -0
  55. /package/{features/upload/utils → domain/file}/mimeTypes.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"features/extractMetadata/ExtractMetadataHandler.js","sources":["../../../src/features/extractMetadata/ExtractMetadataHandler.ts"],"sourcesContent":["import { FileAfterCreateEventHandler } from \"../file/CreateFile/events.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport type { ExtractMetadataInput } from \"./ExtractMetadataInput.js\";\n\nclass ExtractMetadataHandlerImpl implements FileAfterCreateEventHandler.Interface {\n constructor(private readonly taskService: TaskService.Interface) {}\n\n async handle(event: FileAfterCreateEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n\n await this.taskService.trigger<ExtractMetadataInput>({\n definition: \"fileManagerExtractMetadata\",\n input: {\n fileId: file.id\n }\n });\n }\n}\n\nexport const ExtractMetadataHandler = FileAfterCreateEventHandler.createImplementation({\n implementation: ExtractMetadataHandlerImpl,\n dependencies: [TaskService]\n});\n"],"names":["ExtractMetadataHandlerImpl","taskService","event","file","ExtractMetadataHandler","FileAfterCreateEventHandler","TaskService"],"mappings":";;AAIA,MAAMA;IACF,YAA6BC,WAAkC,CAAE;aAApCA,WAAW,GAAXA;IAAqC;IAElE,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAE9B,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAuB;YACjD,YAAY;YACZ,OAAO;gBACH,QAAQC,KAAK,EAAE;YACnB;QACJ;IACJ;AACJ;AAEO,MAAMC,yBAAyBC,4BAA4B,oBAAoB,CAAC;IACnF,gBAAgBL;IAChB,cAAc;QAACM;KAAY;AAC/B"}
1
+ {"version":3,"file":"features/extractMetadata/ExtractMetadataHandler.js","sources":["../../../src/features/extractMetadata/ExtractMetadataHandler.ts"],"sourcesContent":["import { FileAfterCreateEventHandler } from \"../file/CreateFile/events.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport type { ExtractMetadataInput } from \"./ExtractMetadataInput.js\";\n\nclass ExtractMetadataHandlerImpl implements FileAfterCreateEventHandler.Interface {\n constructor(\n private readonly taskService: TaskService.Interface,\n private readonly logger: Logger.Interface\n ) {}\n\n async handle(event: FileAfterCreateEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n\n // The file is already stored, so a task that can't start is logged and doesn't fail the upload.\n const result = await this.taskService.trigger<ExtractMetadataInput>({\n definition: \"fileManagerExtractMetadata\",\n input: {\n fileId: file.id\n }\n });\n if (result.isFail()) {\n this.logger.error(\n { error: result.error, fileId: file.id },\n \"Could not start the metadata extraction.\"\n );\n }\n }\n}\n\nexport const ExtractMetadataHandler = FileAfterCreateEventHandler.createImplementation({\n implementation: ExtractMetadataHandlerImpl,\n dependencies: [TaskService, Logger]\n});\n"],"names":["ExtractMetadataHandlerImpl","taskService","logger","event","file","result","ExtractMetadataHandler","FileAfterCreateEventHandler","TaskService","Logger"],"mappings":";;;AAKA,MAAMA;IACF,YACqBC,WAAkC,EAClCC,MAAwB,CAC3C;aAFmBD,WAAW,GAAXA;aACAC,MAAM,GAANA;IAClB;IAEH,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAG9B,MAAME,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAuB;YAChE,YAAY;YACZ,OAAO;gBACH,QAAQD,KAAK,EAAE;YACnB;QACJ;QACA,IAAIC,OAAO,MAAM,IACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACb;YAAE,OAAOA,OAAO,KAAK;YAAE,QAAQD,KAAK,EAAE;QAAC,GACvC;IAGZ;AACJ;AAEO,MAAME,yBAAyBC,4BAA4B,oBAAoB,CAAC;IACnF,gBAAgBP;IAChB,cAAc;QAACQ;QAAaC;KAAO;AACvC"}
@@ -0,0 +1,41 @@
1
+ import type { Result } from "@webiny/feature/api";
2
+ import type { FileAlreadyExistsError, FilePersistenceError } from "../../../domain/file/errors.js";
3
+ export interface FileContentsStoragePutInput {
4
+ /** The file's key, relative to the current tenant's files (`<id>/<name>`). */
5
+ key: string;
6
+ contents: Buffer;
7
+ contentType: string;
8
+ }
9
+ export interface IFileContentsStorage {
10
+ /**
11
+ * Writes the bytes under the key. Never overwrites: when something is already stored under
12
+ * the key, nothing is written and it fails with `alreadyExists`.
13
+ */
14
+ put(input: FileContentsStoragePutInput): Promise<Result<void, PutError>>;
15
+ /** Deletes the bytes stored under the key. A key with nothing stored under it is not an error. */
16
+ delete(key: string): Promise<Result<void, DeleteError>>;
17
+ }
18
+ export interface IFileContentsStoragePutErrors {
19
+ alreadyExists: FileAlreadyExistsError;
20
+ persistence: FilePersistenceError;
21
+ }
22
+ export interface IFileContentsStorageDeleteErrors {
23
+ persistence: FilePersistenceError;
24
+ }
25
+ type PutError = IFileContentsStoragePutErrors[keyof IFileContentsStoragePutErrors];
26
+ type DeleteError = IFileContentsStorageDeleteErrors[keyof IFileContentsStorageDeleteErrors];
27
+ /**
28
+ * Where File Manager keeps the current tenant's file bytes. Storage packages
29
+ * (`api-file-manager-s3`, `api-file-manager-standalone`) implement it.
30
+ *
31
+ * Internal: it checks neither permissions nor size limits, and creates no file record.
32
+ * Use `StoreFileUseCase` instead.
33
+ */
34
+ export declare const FileContentsStorage: import("@webiny/di").Abstraction<IFileContentsStorage>;
35
+ export declare namespace FileContentsStorage {
36
+ type Interface = IFileContentsStorage;
37
+ type PutInput = FileContentsStoragePutInput;
38
+ type PutError = IFileContentsStoragePutErrors[keyof IFileContentsStoragePutErrors];
39
+ type DeleteError = IFileContentsStorageDeleteErrors[keyof IFileContentsStorageDeleteErrors];
40
+ }
41
+ export {};
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const FileContentsStorage = createAbstraction("FileManager/FileContentsStorage");
3
+ export { FileContentsStorage };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/file/FileContentsStorage/abstractions.js","sources":["../../../../src/features/file/FileContentsStorage/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { FileAlreadyExistsError, FilePersistenceError } from \"~/domain/file/errors.js\";\n\nexport interface FileContentsStoragePutInput {\n /** The file's key, relative to the current tenant's files (`<id>/<name>`). */\n key: string;\n contents: Buffer;\n contentType: string;\n}\n\nexport interface IFileContentsStorage {\n /**\n * Writes the bytes under the key. Never overwrites: when something is already stored under\n * the key, nothing is written and it fails with `alreadyExists`.\n */\n put(input: FileContentsStoragePutInput): Promise<Result<void, PutError>>;\n\n /** Deletes the bytes stored under the key. A key with nothing stored under it is not an error. */\n delete(key: string): Promise<Result<void, DeleteError>>;\n}\n\nexport interface IFileContentsStoragePutErrors {\n alreadyExists: FileAlreadyExistsError;\n persistence: FilePersistenceError;\n}\n\nexport interface IFileContentsStorageDeleteErrors {\n persistence: FilePersistenceError;\n}\n\ntype PutError = IFileContentsStoragePutErrors[keyof IFileContentsStoragePutErrors];\ntype DeleteError = IFileContentsStorageDeleteErrors[keyof IFileContentsStorageDeleteErrors];\n\n/**\n * Where File Manager keeps the current tenant's file bytes. Storage packages\n * (`api-file-manager-s3`, `api-file-manager-standalone`) implement it.\n *\n * Internal: it checks neither permissions nor size limits, and creates no file record.\n * Use `StoreFileUseCase` instead.\n */\nexport const FileContentsStorage = createAbstraction<IFileContentsStorage>(\n \"FileManager/FileContentsStorage\"\n);\n\nexport namespace FileContentsStorage {\n export type Interface = IFileContentsStorage;\n export type PutInput = FileContentsStoragePutInput;\n export type PutError = IFileContentsStoragePutErrors[keyof IFileContentsStoragePutErrors];\n export type DeleteError =\n IFileContentsStorageDeleteErrors[keyof IFileContentsStorageDeleteErrors];\n}\n"],"names":["FileContentsStorage","createAbstraction"],"mappings":";AAyCO,MAAMA,sBAAsBC,kBAC/B"}
@@ -0,0 +1 @@
1
+ export { FileContentsStorage } from "./abstractions.js";
@@ -0,0 +1 @@
1
+ export { FileContentsStorage } from "./abstractions.js";
@@ -0,0 +1,38 @@
1
+ import { Logger } from "@webiny/api-core/features/logger/index.js";
2
+ import { StoreFileUseCase as UseCaseAbstraction } from "./abstractions.js";
3
+ import { FmPermissions } from "../../../features/shared/abstractions.js";
4
+ import { GetSettingsUseCase } from "../../../features/settings/GetSettings/abstractions.js";
5
+ import { CreateFileUseCase } from "../../../features/file/CreateFile/abstractions.js";
6
+ import { GetFileRepository } from "../../../features/file/GetFile/abstractions.js";
7
+ import { FileUrlGenerator } from "../../../features/file/FileUrlGenerator/abstractions.js";
8
+ import { FileContentsStorage } from "../../../features/file/FileContentsStorage/abstractions.js";
9
+ import { FileUploadModifier } from "../../../features/upload/utils/FileUploadModifier.js";
10
+ declare class StoreFileUseCaseImpl implements UseCaseAbstraction.Interface {
11
+ private permissions;
12
+ private getSettings;
13
+ private getFileRepository;
14
+ private createFile;
15
+ private storage;
16
+ private fileUrlGenerator;
17
+ private modifiers;
18
+ private logger;
19
+ constructor(permissions: FmPermissions.Interface, getSettings: GetSettingsUseCase.Interface, getFileRepository: GetFileRepository.Interface, createFile: CreateFileUseCase.Interface, storage: FileContentsStorage.Interface, fileUrlGenerator: FileUrlGenerator.Interface, modifiers: FileUploadModifier.Interface[], logger: Logger.Interface);
20
+ execute(input: UseCaseAbstraction.Input): UseCaseAbstraction.Return;
21
+ private validateSize;
22
+ /**
23
+ * Builds the ID and key the same way an upload does, with the registered upload modifiers.
24
+ */
25
+ private normalize;
26
+ /**
27
+ * A failed create doesn't always mean nothing was written: when a subscriber to the entry's
28
+ * after-create event throws, the record is already stored and the create still fails. So the
29
+ * bytes are deleted only when no record with this ID points at them.
30
+ */
31
+ private deleteContentsWithoutRecord;
32
+ private keepContents;
33
+ private deleteStoredContents;
34
+ }
35
+ export declare const StoreFileUseCase: typeof StoreFileUseCaseImpl & {
36
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions.js").IStoreFileUseCase>;
37
+ };
38
+ export {};
@@ -0,0 +1,156 @@
1
+ import { Result } from "@webiny/feature/api";
2
+ import { Logger } from "@webiny/api-core/features/logger/index.js";
3
+ import { StoreFileUseCase } from "./abstractions.js";
4
+ import { FileAlreadyExistsError, FileNotAuthorizedError, FilePersistenceError, InvalidFileKeyError, InvalidFileSizeError } from "../../../domain/file/errors.js";
5
+ import { FmPermissions } from "../../shared/abstractions.js";
6
+ import { GetSettingsUseCase } from "../../settings/GetSettings/abstractions.js";
7
+ import { CreateFileUseCase } from "../CreateFile/abstractions.js";
8
+ import { GetFileRepository } from "../GetFile/abstractions.js";
9
+ import { FileUrlGenerator } from "../FileUrlGenerator/abstractions.js";
10
+ import { FileContentsStorage } from "../FileContentsStorage/abstractions.js";
11
+ import { FileNormalizer } from "../../upload/utils/FileNormalizer.js";
12
+ import { FileUploadModifier, createModifierFromPlugins } from "../../upload/utils/FileUploadModifier.js";
13
+ class StoreFileUseCaseImpl {
14
+ constructor(permissions, getSettings, getFileRepository, createFile, storage, fileUrlGenerator, modifiers, logger){
15
+ this.permissions = permissions;
16
+ this.getSettings = getSettings;
17
+ this.getFileRepository = getFileRepository;
18
+ this.createFile = createFile;
19
+ this.storage = storage;
20
+ this.fileUrlGenerator = fileUrlGenerator;
21
+ this.modifiers = modifiers;
22
+ this.logger = logger;
23
+ }
24
+ async execute(input) {
25
+ const contents = Buffer.from(input.getContents());
26
+ const size = contents.byteLength;
27
+ const id = input.getId();
28
+ const inputName = input.getName();
29
+ const inputType = input.getType();
30
+ const folderId = input.getFolderId();
31
+ const tags = input.getTags();
32
+ const description = input.getDescription();
33
+ const metadata = structuredClone(input.getMetadata());
34
+ if (!await this.permissions.canCreate("file")) return Result.fail(new FileNotAuthorizedError());
35
+ const sizeResult = await this.validateSize(size);
36
+ if (sizeResult.isFail()) return Result.fail(sizeResult.error);
37
+ const normalized = await this.normalize({
38
+ id,
39
+ name: inputName,
40
+ type: inputType,
41
+ size
42
+ });
43
+ if (normalized.isFail()) return Result.fail(normalized.error);
44
+ const { key, name, type } = normalized.value;
45
+ if (id) {
46
+ const existing = await this.getFileRepository.execute(normalized.value.id);
47
+ if (existing.isOk()) return Result.fail(new FileAlreadyExistsError({
48
+ key: existing.value.key
49
+ }));
50
+ if ("FileManager/File/NotFoundError" !== existing.error.code) return Result.fail(existing.error);
51
+ }
52
+ const putResult = await this.storage.put({
53
+ key,
54
+ contents,
55
+ contentType: type
56
+ });
57
+ if (putResult.isFail()) return Result.fail(putResult.error);
58
+ const createResult = await this.createFile.execute({
59
+ id: normalized.value.id,
60
+ key,
61
+ name,
62
+ size,
63
+ type,
64
+ tags,
65
+ description,
66
+ metadata,
67
+ location: {
68
+ folderId
69
+ }
70
+ });
71
+ if (createResult.isFail()) {
72
+ await this.deleteContentsWithoutRecord(normalized.value.id, key);
73
+ return Result.fail(createResult.error);
74
+ }
75
+ const file = createResult.value;
76
+ const url = await this.fileUrlGenerator.generateUrl(file);
77
+ return Result.ok({
78
+ file,
79
+ url
80
+ });
81
+ }
82
+ async validateSize(size) {
83
+ const settingsResult = await this.getSettings.execute();
84
+ if (settingsResult.isFail()) return Result.ok();
85
+ const { uploadMinFileSize, uploadMaxFileSize } = settingsResult.value;
86
+ if (size < uploadMinFileSize || size > uploadMaxFileSize) return Result.fail(new InvalidFileSizeError({
87
+ size,
88
+ minSize: uploadMinFileSize,
89
+ maxSize: uploadMaxFileSize
90
+ }));
91
+ return Result.ok();
92
+ }
93
+ async normalize(data) {
94
+ const normalizer = new FileNormalizer(createModifierFromPlugins(this.modifiers));
95
+ try {
96
+ return Result.ok(await normalizer.normalizeFile(data));
97
+ } catch (error) {
98
+ if (error instanceof InvalidFileKeyError) return Result.fail(error);
99
+ return Result.fail(new FilePersistenceError(error instanceof Error ? error : new Error(String(error))));
100
+ }
101
+ }
102
+ async deleteContentsWithoutRecord(id, key) {
103
+ let existing;
104
+ try {
105
+ existing = await this.getFileRepository.execute(id);
106
+ } catch (error) {
107
+ this.keepContents(key, error);
108
+ return;
109
+ }
110
+ if (existing.isOk()) {
111
+ if (existing.value.key === key) return void this.keepContents(key);
112
+ } else if ("FileManager/File/NotFoundError" !== existing.error.code) return void this.keepContents(key, existing.error);
113
+ await this.deleteStoredContents(key);
114
+ }
115
+ keepContents(key, lookupError) {
116
+ this.logger.warn({
117
+ key,
118
+ error: lookupError
119
+ }, lookupError ? "Kept the contents of a file whose record failed to create: could not check whether the record exists." : "Kept the contents of a file whose record failed to create: the record exists.");
120
+ }
121
+ async deleteStoredContents(key) {
122
+ try {
123
+ const result = await this.storage.delete(key);
124
+ if (result.isFail()) this.logger.error({
125
+ error: result.error,
126
+ key
127
+ }, "Could not delete the contents of a file whose record wasn't created.");
128
+ } catch (error) {
129
+ this.logger.error({
130
+ error,
131
+ key
132
+ }, "Could not delete the contents of a file whose record wasn't created.");
133
+ }
134
+ }
135
+ }
136
+ const StoreFileUseCase_StoreFileUseCase = StoreFileUseCase.createImplementation({
137
+ implementation: StoreFileUseCaseImpl,
138
+ dependencies: [
139
+ FmPermissions,
140
+ GetSettingsUseCase,
141
+ GetFileRepository,
142
+ CreateFileUseCase,
143
+ FileContentsStorage,
144
+ FileUrlGenerator,
145
+ [
146
+ FileUploadModifier,
147
+ {
148
+ multiple: true
149
+ }
150
+ ],
151
+ Logger
152
+ ]
153
+ });
154
+ export { StoreFileUseCase_StoreFileUseCase as StoreFileUseCase };
155
+
156
+ //# sourceMappingURL=StoreFileUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/file/StoreFile/StoreFileUseCase.js","sources":["../../../../src/features/file/StoreFile/StoreFileUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport { StoreFileUseCase as UseCaseAbstraction } from \"./abstractions.js\";\nimport {\n FileAlreadyExistsError,\n FileNotAuthorizedError,\n FilePersistenceError,\n InvalidFileKeyError,\n InvalidFileSizeError\n} from \"~/domain/file/errors.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\nimport { GetSettingsUseCase } from \"~/features/settings/GetSettings/abstractions.js\";\nimport { CreateFileUseCase } from \"~/features/file/CreateFile/abstractions.js\";\nimport { GetFileRepository } from \"~/features/file/GetFile/abstractions.js\";\nimport { FileUrlGenerator } from \"~/features/file/FileUrlGenerator/abstractions.js\";\nimport { FileContentsStorage } from \"~/features/file/FileContentsStorage/abstractions.js\";\nimport { FileNormalizer } from \"~/features/upload/utils/FileNormalizer.js\";\nimport {\n createModifierFromPlugins,\n FileUploadModifier\n} from \"~/features/upload/utils/FileUploadModifier.js\";\nimport type { FileData } from \"~/features/upload/types.js\";\nimport type { File } from \"~/domain/file/types.js\";\n\nclass StoreFileUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private permissions: FmPermissions.Interface,\n private getSettings: GetSettingsUseCase.Interface,\n private getFileRepository: GetFileRepository.Interface,\n private createFile: CreateFileUseCase.Interface,\n private storage: FileContentsStorage.Interface,\n private fileUrlGenerator: FileUrlGenerator.Interface,\n private modifiers: FileUploadModifier.Interface[],\n private logger: Logger.Interface\n ) {}\n\n async execute(input: UseCaseAbstraction.Input): UseCaseAbstraction.Return {\n // Read the whole input once, before the first await: changes the caller makes after this\n // point, to the input or to its bytes, don't apply.\n const contents = Buffer.from(input.getContents());\n const size = contents.byteLength;\n const id = input.getId();\n const inputName = input.getName();\n const inputType = input.getType();\n const folderId = input.getFolderId();\n const tags = input.getTags();\n const description = input.getDescription();\n // `getMetadata()` copies only the top level, so nested values are copied here.\n const metadata = structuredClone(input.getMetadata());\n\n if (!(await this.permissions.canCreate(\"file\"))) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const sizeResult = await this.validateSize(size);\n if (sizeResult.isFail()) {\n return Result.fail(sizeResult.error);\n }\n\n const normalized = await this.normalize({ id, name: inputName, type: inputType, size });\n if (normalized.isFail()) {\n return Result.fail(normalized.error);\n }\n const { key, name, type } = normalized.value;\n\n // A stable ID that's already taken fails here, before anything is written.\n if (id) {\n const existing = await this.getFileRepository.execute(normalized.value.id);\n if (existing.isOk()) {\n return Result.fail(new FileAlreadyExistsError({ key: existing.value.key }));\n }\n if (existing.error.code !== \"FileManager/File/NotFoundError\") {\n return Result.fail(existing.error);\n }\n }\n\n // The write never overwrites: when two calls race for the same key, the second one fails\n // here with `alreadyExists`. So the bytes deleted below are always the ones this call wrote.\n const putResult = await this.storage.put({ key, contents, contentType: type });\n if (putResult.isFail()) {\n return Result.fail(putResult.error);\n }\n\n const createResult = await this.createFile.execute({\n id: normalized.value.id,\n key,\n name,\n size,\n type,\n tags,\n description,\n metadata,\n location: { folderId }\n });\n\n if (createResult.isFail()) {\n await this.deleteContentsWithoutRecord(normalized.value.id, key);\n return Result.fail(createResult.error);\n }\n\n const file = createResult.value;\n const url = await this.fileUrlGenerator.generateUrl(file);\n\n return Result.ok({ file, url });\n }\n\n private async validateSize(size: number): Promise<Result<void, InvalidFileSizeError>> {\n const settingsResult = await this.getSettings.execute();\n if (settingsResult.isFail()) {\n return Result.ok();\n }\n\n const { uploadMinFileSize, uploadMaxFileSize } = settingsResult.value;\n if (size < uploadMinFileSize || size > uploadMaxFileSize) {\n return Result.fail(\n new InvalidFileSizeError({\n size,\n minSize: uploadMinFileSize,\n maxSize: uploadMaxFileSize\n })\n );\n }\n\n return Result.ok();\n }\n\n /**\n * Builds the ID and key the same way an upload does, with the registered upload modifiers.\n */\n private async normalize(data: {\n id?: string;\n name: string;\n type: string;\n size: number;\n }): Promise<Result<FileData, InvalidFileKeyError | FilePersistenceError>> {\n const normalizer = new FileNormalizer(createModifierFromPlugins(this.modifiers));\n\n try {\n return Result.ok(await normalizer.normalizeFile(data));\n } catch (error) {\n if (error instanceof InvalidFileKeyError) {\n return Result.fail(error);\n }\n return Result.fail(\n new FilePersistenceError(error instanceof Error ? error : new Error(String(error)))\n );\n }\n }\n\n /**\n * A failed create doesn't always mean nothing was written: when a subscriber to the entry's\n * after-create event throws, the record is already stored and the create still fails. So the\n * bytes are deleted only when no record with this ID points at them.\n */\n private async deleteContentsWithoutRecord(id: string, key: string): Promise<void> {\n let existing: Result<File, GetFileRepository.Error>;\n try {\n existing = await this.getFileRepository.execute(id);\n } catch (error) {\n this.keepContents(key, error);\n return;\n }\n\n if (existing.isOk()) {\n if (existing.value.key === key) {\n this.keepContents(key);\n return;\n }\n // Another call stored a record with this ID under a different key: these bytes are\n // only this call's, so they go.\n } else if (existing.error.code !== \"FileManager/File/NotFoundError\") {\n this.keepContents(key, existing.error);\n return;\n }\n\n await this.deleteStoredContents(key);\n }\n\n private keepContents(key: string, lookupError?: unknown): void {\n this.logger.warn(\n { key, error: lookupError },\n lookupError\n ? \"Kept the contents of a file whose record failed to create: could not check whether the record exists.\"\n : \"Kept the contents of a file whose record failed to create: the record exists.\"\n );\n }\n\n private async deleteStoredContents(key: string): Promise<void> {\n try {\n const result = await this.storage.delete(key);\n if (result.isFail()) {\n this.logger.error(\n { error: result.error, key },\n \"Could not delete the contents of a file whose record wasn't created.\"\n );\n }\n } catch (error) {\n this.logger.error(\n { error, key },\n \"Could not delete the contents of a file whose record wasn't created.\"\n );\n }\n }\n}\n\nexport const StoreFileUseCase = UseCaseAbstraction.createImplementation({\n implementation: StoreFileUseCaseImpl,\n dependencies: [\n FmPermissions,\n GetSettingsUseCase,\n GetFileRepository,\n CreateFileUseCase,\n FileContentsStorage,\n FileUrlGenerator,\n [FileUploadModifier, { multiple: true }],\n Logger\n ]\n});\n"],"names":["StoreFileUseCaseImpl","permissions","getSettings","getFileRepository","createFile","storage","fileUrlGenerator","modifiers","logger","input","contents","Buffer","size","id","inputName","inputType","folderId","tags","description","metadata","structuredClone","Result","FileNotAuthorizedError","sizeResult","normalized","key","name","type","existing","FileAlreadyExistsError","putResult","createResult","file","url","settingsResult","uploadMinFileSize","uploadMaxFileSize","InvalidFileSizeError","data","normalizer","FileNormalizer","createModifierFromPlugins","error","InvalidFileKeyError","FilePersistenceError","Error","String","lookupError","result","StoreFileUseCase","UseCaseAbstraction","FmPermissions","GetSettingsUseCase","GetFileRepository","CreateFileUseCase","FileContentsStorage","FileUrlGenerator","FileUploadModifier","Logger"],"mappings":"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"}
@@ -0,0 +1,33 @@
1
+ import type { Result } from "@webiny/feature/api";
2
+ import type { File } from "../../../domain/file/types.js";
3
+ import type { StoreFileInput } from "../../../domain/file/StoreFileInput.js";
4
+ import type { FileAlreadyExistsError, FileNotAuthorizedError, FilePersistenceError, InvalidFileKeyError, InvalidFileSizeError } from "../../../domain/file/errors.js";
5
+ export interface StoreFileResult {
6
+ file: File;
7
+ /** The file's URL, ready to use (e.g. in page content). */
8
+ url: string;
9
+ }
10
+ export interface IStoreFileUseCase {
11
+ execute(input: StoreFileUseCase.Input): StoreFileUseCase.Return;
12
+ }
13
+ export interface IStoreFileUseCaseErrors {
14
+ notAuthorized: FileNotAuthorizedError;
15
+ invalidSize: InvalidFileSizeError;
16
+ invalidKey: InvalidFileKeyError;
17
+ alreadyExists: FileAlreadyExistsError;
18
+ persistence: FilePersistenceError;
19
+ }
20
+ type UseCaseError = IStoreFileUseCaseErrors[keyof IStoreFileUseCaseErrors];
21
+ /**
22
+ * Store a file the system produced itself (a generated image, a report): writes its bytes where
23
+ * File Manager keeps the current tenant's files and creates its record, under the caller's identity.
24
+ * The same permission checks, upload size settings and upload modifiers apply as to an upload.
25
+ */
26
+ export declare const StoreFileUseCase: import("@webiny/di").Abstraction<IStoreFileUseCase>;
27
+ export declare namespace StoreFileUseCase {
28
+ type Interface = IStoreFileUseCase;
29
+ type Input = StoreFileInput;
30
+ type Error = UseCaseError;
31
+ type Return = Promise<Result<StoreFileResult, UseCaseError>>;
32
+ }
33
+ export {};
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/api";
2
+ const StoreFileUseCase = createAbstraction("StoreFileUseCase");
3
+ export { StoreFileUseCase };
4
+
5
+ //# sourceMappingURL=abstractions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/file/StoreFile/abstractions.js","sources":["../../../../src/features/file/StoreFile/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { File } from \"~/domain/file/types.js\";\nimport type { StoreFileInput } from \"~/domain/file/StoreFileInput.js\";\nimport type {\n FileAlreadyExistsError,\n FileNotAuthorizedError,\n FilePersistenceError,\n InvalidFileKeyError,\n InvalidFileSizeError\n} from \"~/domain/file/errors.js\";\n\nexport interface StoreFileResult {\n file: File;\n /** The file's URL, ready to use (e.g. in page content). */\n url: string;\n}\n\nexport interface IStoreFileUseCase {\n execute(input: StoreFileUseCase.Input): StoreFileUseCase.Return;\n}\n\nexport interface IStoreFileUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n invalidSize: InvalidFileSizeError;\n invalidKey: InvalidFileKeyError;\n alreadyExists: FileAlreadyExistsError;\n persistence: FilePersistenceError;\n}\n\ntype UseCaseError = IStoreFileUseCaseErrors[keyof IStoreFileUseCaseErrors];\n\n/**\n * Store a file the system produced itself (a generated image, a report): writes its bytes where\n * File Manager keeps the current tenant's files and creates its record, under the caller's identity.\n * The same permission checks, upload size settings and upload modifiers apply as to an upload.\n */\nexport const StoreFileUseCase = createAbstraction<IStoreFileUseCase>(\"StoreFileUseCase\");\n\nexport namespace StoreFileUseCase {\n export type Interface = IStoreFileUseCase;\n export type Input = StoreFileInput;\n export type Error = UseCaseError;\n export type Return = Promise<Result<StoreFileResult, UseCaseError>>;\n}\n"],"names":["StoreFileUseCase","createAbstraction"],"mappings":";AAqCO,MAAMA,mBAAmBC,kBAAqC"}
@@ -0,0 +1,4 @@
1
+ export declare const StoreFileFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,11 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { StoreFileUseCase } from "./StoreFileUseCase.js";
3
+ const StoreFileFeature = createFeature({
4
+ name: "FileManager/StoreFile",
5
+ register (container) {
6
+ container.register(StoreFileUseCase);
7
+ }
8
+ });
9
+ export { StoreFileFeature };
10
+
11
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features/file/StoreFile/feature.js","sources":["../../../../src/features/file/StoreFile/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { StoreFileUseCase } from \"./StoreFileUseCase.js\";\n\nexport const StoreFileFeature = createFeature({\n name: \"FileManager/StoreFile\",\n register(container) {\n container.register(StoreFileUseCase);\n }\n});\n"],"names":["StoreFileFeature","createFeature","container","StoreFileUseCase"],"mappings":";;AAGO,MAAMA,mBAAmBC,cAAc;IAC1C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -0,0 +1,4 @@
1
+ export { StoreFileUseCase } from "./abstractions.js";
2
+ export type { StoreFileResult } from "./abstractions.js";
3
+ export { StoreFileInput } from "../../../domain/file/StoreFileInput.js";
4
+ export type { StoreFileInputOptions } from "../../../domain/file/StoreFileInput.js";
@@ -0,0 +1,2 @@
1
+ export { StoreFileUseCase } from "./abstractions.js";
2
+ export { StoreFileInput } from "../../../domain/file/StoreFileInput.js";
@@ -6,10 +6,13 @@ export type { CreateMultiPartUploadResult } from "./types.js";
6
6
  export { checkPermissions } from "./utils/checkPermissions.js";
7
7
  export { FileKey } from "./utils/FileKey.js";
8
8
  export { FileExtension } from "./utils/FileExtension.js";
9
- export { mimeTypes } from "./utils/mimeTypes.js";
9
+ export { mimeTypes } from "../../domain/file/mimeTypes.js";
10
10
  export { FileNormalizer } from "./utils/FileNormalizer.js";
11
11
  export { createFileUploadModifier } from "./utils/FileUploadModifier.js";
12
12
  export { FileUploadModifierPlugin } from "./utils/FileUploadModifier.js";
13
+ export { FileUploadModifier } from "./utils/FileUploadModifier.js";
14
+ export type { FileModifier } from "./utils/FileUploadModifier.js";
15
+ export type { FileToSign } from "./utils/FileNormalizer.js";
13
16
  export { createModifierFromPlugins } from "./utils/FileUploadModifier.js";
14
17
  export { createFileNormalizerFromContext } from "./utils/createFileNormalizerFromContext.js";
15
18
  export { GetUploadPayloadUseCase } from "./GetUploadPayload/index.js";
@@ -1,9 +1,9 @@
1
1
  export { checkPermissions } from "./utils/checkPermissions.js";
2
2
  export { FileKey } from "./utils/FileKey.js";
3
3
  export { FileExtension } from "./utils/FileExtension.js";
4
- export { mimeTypes } from "./utils/mimeTypes.js";
4
+ export { mimeTypes } from "../../domain/file/mimeTypes.js";
5
5
  export { FileNormalizer } from "./utils/FileNormalizer.js";
6
- export { FileUploadModifierPlugin, createFileUploadModifier, createModifierFromPlugins } from "./utils/FileUploadModifier.js";
6
+ export { FileUploadModifier, FileUploadModifierPlugin, createFileUploadModifier, createModifierFromPlugins } from "./utils/FileUploadModifier.js";
7
7
  export { createFileNormalizerFromContext } from "./utils/createFileNormalizerFromContext.js";
8
8
  export { GetUploadPayloadUseCase } from "./GetUploadPayload/index.js";
9
9
  export { CreateMultiPartUploadUseCase } from "./CreateMultiPartUpload/index.js";
@@ -1,4 +1,4 @@
1
- import { mimeTypes as external_mimeTypes_js_mimeTypes } from "./mimeTypes.js";
1
+ import { mimeTypes as mimeTypes_js_mimeTypes } from "../../../domain/file/mimeTypes.js";
2
2
  class FileExtension {
3
3
  constructor(data){
4
4
  this.data = data;
@@ -6,7 +6,7 @@ class FileExtension {
6
6
  getValue() {
7
7
  const name = (this.data.key || this.data.name).toLowerCase();
8
8
  const maybeExt = name.split(".").pop();
9
- const extensions = external_mimeTypes_js_mimeTypes[this.data.type];
9
+ const extensions = mimeTypes_js_mimeTypes[this.data.type];
10
10
  if (extensions && !extensions.includes(maybeExt)) return extensions[0];
11
11
  return "";
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"features/upload/utils/FileExtension.js","sources":["../../../../src/features/upload/utils/FileExtension.ts"],"sourcesContent":["import { mimeTypes } from \"./mimeTypes.js\";\nimport type { PresignedPostPayloadData } from \"~/features/upload/types.js\";\n\nexport class FileExtension {\n private data: PresignedPostPayloadData;\n\n constructor(data: PresignedPostPayloadData) {\n this.data = data;\n }\n\n getValue() {\n const name = (this.data.key || this.data.name).toLowerCase();\n\n const maybeExt = name.split(\".\").pop() as string;\n const extensions = mimeTypes[this.data.type];\n if (extensions && !extensions.includes(maybeExt)) {\n return extensions[0];\n }\n\n return \"\";\n }\n}\n"],"names":["FileExtension","data","name","maybeExt","extensions","mimeTypes"],"mappings":";AAGO,MAAMA;IAGT,YAAYC,IAA8B,CAAE;QACxC,IAAI,CAAC,IAAI,GAAGA;IAChB;IAEA,WAAW;QACP,MAAMC,OAAQ,KAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAG,EAAG,WAAW;QAE1D,MAAMC,WAAWD,KAAK,KAAK,CAAC,KAAK,GAAG;QACpC,MAAME,aAAaC,+BAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAC5C,IAAID,cAAc,CAACA,WAAW,QAAQ,CAACD,WACnC,OAAOC,UAAU,CAAC,EAAE;QAGxB,OAAO;IACX;AACJ"}
1
+ {"version":3,"file":"features/upload/utils/FileExtension.js","sources":["../../../../src/features/upload/utils/FileExtension.ts"],"sourcesContent":["import { mimeTypes } from \"~/domain/file/mimeTypes.js\";\nimport type { PresignedPostPayloadData } from \"~/features/upload/types.js\";\n\nexport class FileExtension {\n private data: PresignedPostPayloadData;\n\n constructor(data: PresignedPostPayloadData) {\n this.data = data;\n }\n\n getValue() {\n const name = (this.data.key || this.data.name).toLowerCase();\n\n const maybeExt = name.split(\".\").pop() as string;\n const extensions = mimeTypes[this.data.type];\n if (extensions && !extensions.includes(maybeExt)) {\n return extensions[0];\n }\n\n return \"\";\n }\n}\n"],"names":["FileExtension","data","name","maybeExt","extensions","mimeTypes"],"mappings":";AAGO,MAAMA;IAGT,YAAYC,IAA8B,CAAE;QACxC,IAAI,CAAC,IAAI,GAAGA;IAChB;IAEA,WAAW;QACP,MAAMC,OAAQ,KAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,IAAG,EAAG,WAAW;QAE1D,MAAMC,WAAWD,KAAK,KAAK,CAAC,KAAK,GAAG;QACpC,MAAME,aAAaC,sBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAC5C,IAAID,cAAc,CAACA,WAAW,QAAQ,CAACD,WACnC,OAAOC,UAAU,CAAC,EAAE;QAGxB,OAAO;IACX;AACJ"}
@@ -1,13 +1,7 @@
1
1
  import { mdbid } from "@webiny/utils";
2
2
  import { FileKey } from "./FileKey.js";
3
3
  import { validateFileKey } from "../../../domain/file/validateFileKey.js";
4
- import { mimeTypes as external_mimeTypes_js_mimeTypes } from "./mimeTypes.js";
5
- const extensionToMime = new Map();
6
- for (const [mime, extensions] of Object.entries(external_mimeTypes_js_mimeTypes))for (const ext of extensions)if (!extensionToMime.has(ext)) extensionToMime.set(ext, mime);
7
- function resolveTypeFromName(name) {
8
- const ext = name.slice(name.lastIndexOf(".") + 1).toLowerCase();
9
- return extensionToMime.get(ext) || "application/octet-stream";
10
- }
4
+ import { FileMimeType } from "../../../domain/file/FileMimeType.js";
11
5
  class FileNormalizer {
12
6
  constructor(modifier){
13
7
  this.modifier = modifier;
@@ -16,7 +10,7 @@ class FileNormalizer {
16
10
  const data = {
17
11
  ...payload,
18
12
  id: payload.id || mdbid(),
19
- type: payload.type || resolveTypeFromName(payload.name)
13
+ type: payload.type || FileMimeType.fromName(payload.name).toString()
20
14
  };
21
15
  const key = new FileKey(data);
22
16
  const defaultKey = key.toString();
@@ -1 +1 @@
1
- {"version":3,"file":"features/upload/utils/FileNormalizer.js","sources":["../../../../src/features/upload/utils/FileNormalizer.ts"],"sourcesContent":["import { mdbid } from \"@webiny/utils\";\nimport type { FileData, PresignedPostPayloadData } from \"~/features/upload/types.js\";\nimport { FileKey } from \"./FileKey.js\";\nimport { validateFileKey } from \"~/domain/file/validateFileKey.js\";\nimport { mimeTypes } from \"./mimeTypes.js\";\nimport type { FileModifier } from \"./FileUploadModifier.js\";\n\nexport interface FileToSign {\n name: string;\n key: string;\n type: string;\n size: number;\n}\n\nconst extensionToMime = new Map<string, string>();\nfor (const [mime, extensions] of Object.entries(mimeTypes)) {\n for (const ext of extensions) {\n if (!extensionToMime.has(ext)) {\n extensionToMime.set(ext, mime);\n }\n }\n}\n\nfunction resolveTypeFromName(name: string): string {\n const ext = name.slice(name.lastIndexOf(\".\") + 1).toLowerCase();\n return extensionToMime.get(ext) || \"application/octet-stream\";\n}\n\n/*\n * FileNormalizer normalizes file data, before it's signed for upload.\n * It generates a unique file id, and makes sure that the file key includes the unique id.\n */\nexport class FileNormalizer {\n private readonly modifier: FileModifier | undefined;\n\n constructor(modifier?: FileModifier) {\n this.modifier = modifier;\n }\n\n async normalizeFile(payload: PresignedPostPayloadData): Promise<FileData> {\n const data = {\n ...payload,\n id: payload.id || mdbid(),\n type: payload.type || resolveTypeFromName(payload.name)\n };\n\n const key = new FileKey(data);\n const defaultKey = key.toString();\n\n const file: FileToSign = {\n name: data.name,\n type: data.type,\n key: defaultKey,\n size: data.size\n };\n\n if (this.modifier) {\n Object.assign(file, await this.modifier(file));\n }\n\n if (defaultKey !== file.key) {\n key.setKey(file.key);\n }\n\n // The ID and key prefix come from the client and end up in a storage path.\n const fileKey = key.toString();\n const keyResult = validateFileKey({ key: fileKey, id: data.id });\n if (keyResult.isFail()) {\n throw keyResult.error;\n }\n\n return {\n id: data.id,\n key: fileKey,\n name: file.name,\n size: file.size,\n type: file.type\n };\n }\n}\n"],"names":["extensionToMime","Map","mime","extensions","Object","mimeTypes","ext","resolveTypeFromName","name","FileNormalizer","modifier","payload","data","mdbid","key","FileKey","defaultKey","file","fileKey","keyResult","validateFileKey"],"mappings":";;;;AAcA,MAAMA,kBAAkB,IAAIC;AAC5B,KAAK,MAAM,CAACC,MAAMC,WAAW,IAAIC,OAAO,OAAO,CAACC,iCAC5C,KAAK,MAAMC,OAAOH,WACd,IAAI,CAACH,gBAAgB,GAAG,CAACM,MACrBN,gBAAgB,GAAG,CAACM,KAAKJ;AAKrC,SAASK,oBAAoBC,IAAY;IACrC,MAAMF,MAAME,KAAK,KAAK,CAACA,KAAK,WAAW,CAAC,OAAO,GAAG,WAAW;IAC7D,OAAOR,gBAAgB,GAAG,CAACM,QAAQ;AACvC;AAMO,MAAMG;IAGT,YAAYC,QAAuB,CAAE;QACjC,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,cAAcC,OAAiC,EAAqB;QACtE,MAAMC,OAAO;YACT,GAAGD,OAAO;YACV,IAAIA,QAAQ,EAAE,IAAIE;YAClB,MAAMF,QAAQ,IAAI,IAAIJ,oBAAoBI,QAAQ,IAAI;QAC1D;QAEA,MAAMG,MAAM,IAAIC,QAAQH;QACxB,MAAMI,aAAaF,IAAI,QAAQ;QAE/B,MAAMG,OAAmB;YACrB,MAAML,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;YACf,KAAKI;YACL,MAAMJ,KAAK,IAAI;QACnB;QAEA,IAAI,IAAI,CAAC,QAAQ,EACbR,OAAO,MAAM,CAACa,MAAM,MAAM,IAAI,CAAC,QAAQ,CAACA;QAG5C,IAAID,eAAeC,KAAK,GAAG,EACvBH,IAAI,MAAM,CAACG,KAAK,GAAG;QAIvB,MAAMC,UAAUJ,IAAI,QAAQ;QAC5B,MAAMK,YAAYC,gBAAgB;YAAE,KAAKF;YAAS,IAAIN,KAAK,EAAE;QAAC;QAC9D,IAAIO,UAAU,MAAM,IAChB,MAAMA,UAAU,KAAK;QAGzB,OAAO;YACH,IAAIP,KAAK,EAAE;YACX,KAAKM;YACL,MAAMD,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;QACnB;IACJ;AACJ"}
1
+ {"version":3,"file":"features/upload/utils/FileNormalizer.js","sources":["../../../../src/features/upload/utils/FileNormalizer.ts"],"sourcesContent":["import { mdbid } from \"@webiny/utils\";\nimport type { FileData, PresignedPostPayloadData } from \"~/features/upload/types.js\";\nimport { FileKey } from \"./FileKey.js\";\nimport { validateFileKey } from \"~/domain/file/validateFileKey.js\";\nimport { FileMimeType } from \"~/domain/file/FileMimeType.js\";\nimport type { FileModifier } from \"./FileUploadModifier.js\";\n\nexport interface FileToSign {\n name: string;\n key: string;\n type: string;\n size: number;\n}\n\n/*\n * FileNormalizer normalizes file data, before it's signed for upload.\n * It generates a unique file id, and makes sure that the file key includes the unique id.\n */\nexport class FileNormalizer {\n private readonly modifier: FileModifier | undefined;\n\n constructor(modifier?: FileModifier) {\n this.modifier = modifier;\n }\n\n async normalizeFile(payload: PresignedPostPayloadData): Promise<FileData> {\n const data = {\n ...payload,\n id: payload.id || mdbid(),\n type: payload.type || FileMimeType.fromName(payload.name).toString()\n };\n\n const key = new FileKey(data);\n const defaultKey = key.toString();\n\n const file: FileToSign = {\n name: data.name,\n type: data.type,\n key: defaultKey,\n size: data.size\n };\n\n if (this.modifier) {\n Object.assign(file, await this.modifier(file));\n }\n\n if (defaultKey !== file.key) {\n key.setKey(file.key);\n }\n\n // The ID and key prefix come from the client and end up in a storage path.\n const fileKey = key.toString();\n const keyResult = validateFileKey({ key: fileKey, id: data.id });\n if (keyResult.isFail()) {\n throw keyResult.error;\n }\n\n return {\n id: data.id,\n key: fileKey,\n name: file.name,\n size: file.size,\n type: file.type\n };\n }\n}\n"],"names":["FileNormalizer","modifier","payload","data","mdbid","FileMimeType","key","FileKey","defaultKey","file","Object","fileKey","keyResult","validateFileKey"],"mappings":";;;;AAkBO,MAAMA;IAGT,YAAYC,QAAuB,CAAE;QACjC,IAAI,CAAC,QAAQ,GAAGA;IACpB;IAEA,MAAM,cAAcC,OAAiC,EAAqB;QACtE,MAAMC,OAAO;YACT,GAAGD,OAAO;YACV,IAAIA,QAAQ,EAAE,IAAIE;YAClB,MAAMF,QAAQ,IAAI,IAAIG,aAAa,QAAQ,CAACH,QAAQ,IAAI,EAAE,QAAQ;QACtE;QAEA,MAAMI,MAAM,IAAIC,QAAQJ;QACxB,MAAMK,aAAaF,IAAI,QAAQ;QAE/B,MAAMG,OAAmB;YACrB,MAAMN,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;YACf,KAAKK;YACL,MAAML,KAAK,IAAI;QACnB;QAEA,IAAI,IAAI,CAAC,QAAQ,EACbO,OAAO,MAAM,CAACD,MAAM,MAAM,IAAI,CAAC,QAAQ,CAACA;QAG5C,IAAID,eAAeC,KAAK,GAAG,EACvBH,IAAI,MAAM,CAACG,KAAK,GAAG;QAIvB,MAAME,UAAUL,IAAI,QAAQ;QAC5B,MAAMM,YAAYC,gBAAgB;YAAE,KAAKF;YAAS,IAAIR,KAAK,EAAE;QAAC;QAC9D,IAAIS,UAAU,MAAM,IAChB,MAAMA,UAAU,KAAK;QAGzB,OAAO;YACH,IAAIT,KAAK,EAAE;YACX,KAAKQ;YACL,MAAMF,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;YACf,MAAMA,KAAK,IAAI;QACnB;IACJ;AACJ"}
@@ -3,14 +3,14 @@ import type { FileToSign } from "./FileNormalizer.js";
3
3
  interface Setter<T> {
4
4
  (param: T): T;
5
5
  }
6
- declare class FileUploadModifier {
6
+ declare class FileUploadModifierBuilder {
7
7
  private fileSetters;
8
8
  setFile(setter: Setter<FileToSign>): void;
9
9
  execute(file: FileToSign): Promise<FileToSign>;
10
10
  }
11
11
  interface FileUploadModifierCallbackParams {
12
12
  modifier: {
13
- setFile: FileUploadModifier["setFile"];
13
+ setFile: FileUploadModifierBuilder["setFile"];
14
14
  };
15
15
  }
16
16
  export declare class FileUploadModifierPlugin extends Plugin {
@@ -23,6 +23,16 @@ interface FileUploadModifierCallable {
23
23
  (params: FileUploadModifierCallbackParams): void;
24
24
  }
25
25
  export declare const createFileUploadModifier: (cb: FileUploadModifierCallable) => FileUploadModifierPlugin;
26
+ /**
27
+ * DI multiple-abstraction for file-upload modifiers. Every place that builds a file key (the upload
28
+ * GraphQL resolvers, `StoreFileUseCase`) applies all registered modifiers, so uploaded and stored
29
+ * files share one key layout.
30
+ * Register with `container.registerInstance(FileUploadModifier, createFileUploadModifier(cb))`.
31
+ */
32
+ export declare const FileUploadModifier: import("@webiny/di").Abstraction<FileUploadModifierPlugin>;
33
+ export declare namespace FileUploadModifier {
34
+ type Interface = FileUploadModifierPlugin;
35
+ }
26
36
  export interface FileModifier {
27
37
  (file: FileToSign): Promise<Partial<FileToSign>> | Partial<FileToSign>;
28
38
  }
@@ -1,6 +1,7 @@
1
1
  import p_reduce from "p-reduce";
2
2
  import { Plugin } from "@webiny/plugins";
3
- class FileUploadModifier {
3
+ import { createAbstraction } from "@webiny/feature/api";
4
+ class FileUploadModifierBuilder {
4
5
  setFile(setter) {
5
6
  this.fileSetters.push(setter);
6
7
  }
@@ -27,13 +28,14 @@ class FileUploadModifierPlugin extends Plugin {
27
28
  }
28
29
  }
29
30
  const createFileUploadModifier = (cb)=>new FileUploadModifierPlugin(cb);
31
+ const FileUploadModifier = createAbstraction("FileUploadModifier");
30
32
  const createModifierFromPlugins = (plugins = [])=>{
31
- const modifier = new FileUploadModifier();
33
+ const modifier = new FileUploadModifierBuilder();
32
34
  plugins.forEach((pl)=>pl.execute({
33
35
  modifier
34
36
  }));
35
37
  return (file)=>modifier.execute(file);
36
38
  };
37
- export { FileUploadModifierPlugin, createFileUploadModifier, createModifierFromPlugins };
39
+ export { FileUploadModifier, FileUploadModifierPlugin, createFileUploadModifier, createModifierFromPlugins };
38
40
 
39
41
  //# sourceMappingURL=FileUploadModifier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/upload/utils/FileUploadModifier.js","sources":["../../../../src/features/upload/utils/FileUploadModifier.ts"],"sourcesContent":["import pReduce from \"p-reduce\";\nimport { Plugin } from \"@webiny/plugins\";\nimport type { FileToSign } from \"./FileNormalizer.js\";\n\ninterface Setter<T> {\n (param: T): T;\n}\n\nclass FileUploadModifier {\n private fileSetters: Setter<FileToSign>[] = [];\n\n setFile(setter: Setter<FileToSign>): void {\n this.fileSetters.push(setter);\n }\n\n execute(file: FileToSign) {\n return pReduce(\n this.fileSetters,\n async (file, setter) => {\n /* We need to spread the original file, then add (potentially) partial changes. */\n return { ...file, ...(await setter(file)) };\n },\n file\n );\n }\n}\n\ninterface FileUploadModifierCallbackParams {\n modifier: {\n setFile: FileUploadModifier[\"setFile\"];\n };\n}\n\nexport class FileUploadModifierPlugin extends Plugin {\n public static override type = \"fm.uploadModifier\";\n private readonly cb: FileUploadModifierCallable;\n\n constructor(cb: FileUploadModifierCallable) {\n super();\n this.cb = cb;\n }\n\n execute(params: FileUploadModifierCallbackParams) {\n return this.cb(params);\n }\n}\n\ninterface FileUploadModifierCallable {\n (params: FileUploadModifierCallbackParams): void;\n}\n\nexport const createFileUploadModifier = (cb: FileUploadModifierCallable) => {\n return new FileUploadModifierPlugin(cb);\n};\n\nexport interface FileModifier {\n (file: FileToSign): Promise<Partial<FileToSign>> | Partial<FileToSign>;\n}\n\nexport const createModifierFromPlugins = (\n plugins: FileUploadModifierPlugin[] = []\n): FileModifier => {\n const modifier = new FileUploadModifier();\n plugins.forEach(pl => pl.execute({ modifier }));\n\n return (file: FileToSign) => modifier.execute(file);\n};\n"],"names":["FileUploadModifier","setter","file","pReduce","FileUploadModifierPlugin","Plugin","cb","params","createFileUploadModifier","createModifierFromPlugins","plugins","modifier","pl"],"mappings":";;AAQA,MAAMA;IAGF,QAAQC,MAA0B,EAAQ;QACtC,IAAI,CAAC,WAAW,CAAC,IAAI,CAACA;IAC1B;IAEA,QAAQC,IAAgB,EAAE;QACtB,OAAOC,SACH,IAAI,CAAC,WAAW,EAChB,OAAOD,MAAMD,SAEF;gBAAE,GAAGC,IAAI;gBAAE,GAAI,MAAMD,OAAOC,KAAK;YAAE,IAE9CA;IAER;;aAfQ,WAAW,GAAyB,EAAE;;AAgBlD;AAQO,MAAME,iCAAiCC;;aACnB,IAAI,GAAG;;IAG9B,YAAYC,EAA8B,CAAE;QACxC,KAAK;QACL,IAAI,CAAC,EAAE,GAAGA;IACd;IAEA,QAAQC,MAAwC,EAAE;QAC9C,OAAO,IAAI,CAAC,EAAE,CAACA;IACnB;AACJ;AAMO,MAAMC,2BAA2B,CAACF,KAC9B,IAAIF,yBAAyBE;AAOjC,MAAMG,4BAA4B,CACrCC,UAAsC,EAAE;IAExC,MAAMC,WAAW,IAAIX;IACrBU,QAAQ,OAAO,CAACE,CAAAA,KAAMA,GAAG,OAAO,CAAC;YAAED;QAAS;IAE5C,OAAO,CAACT,OAAqBS,SAAS,OAAO,CAACT;AAClD"}
1
+ {"version":3,"file":"features/upload/utils/FileUploadModifier.js","sources":["../../../../src/features/upload/utils/FileUploadModifier.ts"],"sourcesContent":["import pReduce from \"p-reduce\";\nimport { Plugin } from \"@webiny/plugins\";\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type { FileToSign } from \"./FileNormalizer.js\";\n\ninterface Setter<T> {\n (param: T): T;\n}\n\nclass FileUploadModifierBuilder {\n private fileSetters: Setter<FileToSign>[] = [];\n\n setFile(setter: Setter<FileToSign>): void {\n this.fileSetters.push(setter);\n }\n\n execute(file: FileToSign) {\n return pReduce(\n this.fileSetters,\n async (file, setter) => {\n /* We need to spread the original file, then add (potentially) partial changes. */\n return { ...file, ...(await setter(file)) };\n },\n file\n );\n }\n}\n\ninterface FileUploadModifierCallbackParams {\n modifier: {\n setFile: FileUploadModifierBuilder[\"setFile\"];\n };\n}\n\nexport class FileUploadModifierPlugin extends Plugin {\n public static override type = \"fm.uploadModifier\";\n private readonly cb: FileUploadModifierCallable;\n\n constructor(cb: FileUploadModifierCallable) {\n super();\n this.cb = cb;\n }\n\n execute(params: FileUploadModifierCallbackParams) {\n return this.cb(params);\n }\n}\n\ninterface FileUploadModifierCallable {\n (params: FileUploadModifierCallbackParams): void;\n}\n\nexport const createFileUploadModifier = (cb: FileUploadModifierCallable) => {\n return new FileUploadModifierPlugin(cb);\n};\n\n/**\n * DI multiple-abstraction for file-upload modifiers. Every place that builds a file key (the upload\n * GraphQL resolvers, `StoreFileUseCase`) applies all registered modifiers, so uploaded and stored\n * files share one key layout.\n * Register with `container.registerInstance(FileUploadModifier, createFileUploadModifier(cb))`.\n */\nexport const FileUploadModifier = createAbstraction<FileUploadModifierPlugin>(\"FileUploadModifier\");\n\nexport namespace FileUploadModifier {\n export type Interface = FileUploadModifierPlugin;\n}\n\nexport interface FileModifier {\n (file: FileToSign): Promise<Partial<FileToSign>> | Partial<FileToSign>;\n}\n\nexport const createModifierFromPlugins = (\n plugins: FileUploadModifierPlugin[] = []\n): FileModifier => {\n const modifier = new FileUploadModifierBuilder();\n plugins.forEach(pl => pl.execute({ modifier }));\n\n return (file: FileToSign) => modifier.execute(file);\n};\n"],"names":["FileUploadModifierBuilder","setter","file","pReduce","FileUploadModifierPlugin","Plugin","cb","params","createFileUploadModifier","FileUploadModifier","createAbstraction","createModifierFromPlugins","plugins","modifier","pl"],"mappings":";;;AASA,MAAMA;IAGF,QAAQC,MAA0B,EAAQ;QACtC,IAAI,CAAC,WAAW,CAAC,IAAI,CAACA;IAC1B;IAEA,QAAQC,IAAgB,EAAE;QACtB,OAAOC,SACH,IAAI,CAAC,WAAW,EAChB,OAAOD,MAAMD,SAEF;gBAAE,GAAGC,IAAI;gBAAE,GAAI,MAAMD,OAAOC,KAAK;YAAE,IAE9CA;IAER;;aAfQ,WAAW,GAAyB,EAAE;;AAgBlD;AAQO,MAAME,iCAAiCC;;aACnB,IAAI,GAAG;;IAG9B,YAAYC,EAA8B,CAAE;QACxC,KAAK;QACL,IAAI,CAAC,EAAE,GAAGA;IACd;IAEA,QAAQC,MAAwC,EAAE;QAC9C,OAAO,IAAI,CAAC,EAAE,CAACA;IACnB;AACJ;AAMO,MAAMC,2BAA2B,CAACF,KAC9B,IAAIF,yBAAyBE;AASjC,MAAMG,qBAAqBC,kBAA4C;AAUvE,MAAMC,4BAA4B,CACrCC,UAAsC,EAAE;IAExC,MAAMC,WAAW,IAAIb;IACrBY,QAAQ,OAAO,CAACE,CAAAA,KAAMA,GAAG,OAAO,CAAC;YAAED;QAAS;IAE5C,OAAO,CAACX,OAAqBW,SAAS,OAAO,CAACX;AAClD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-file-manager",
3
- "version": "6.6.0-alpha.10",
3
+ "version": "6.6.0-alpha.12",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -22,19 +22,19 @@
22
22
  ],
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@webiny/api": "6.6.0-alpha.10",
26
- "@webiny/api-core": "6.6.0-alpha.10",
27
- "@webiny/api-graphql": "6.6.0-alpha.10",
28
- "@webiny/api-headless-cms": "6.6.0-alpha.10",
29
- "@webiny/background-tasks": "6.6.0-alpha.10",
30
- "@webiny/build-tools": "6.6.0-alpha.10",
25
+ "@webiny/api": "6.6.0-alpha.12",
26
+ "@webiny/api-core": "6.6.0-alpha.12",
27
+ "@webiny/api-graphql": "6.6.0-alpha.12",
28
+ "@webiny/api-headless-cms": "6.6.0-alpha.12",
29
+ "@webiny/background-tasks": "6.6.0-alpha.12",
30
+ "@webiny/build-tools": "6.6.0-alpha.12",
31
31
  "@webiny/di": "2.0.0",
32
- "@webiny/error": "6.6.0-alpha.10",
33
- "@webiny/event-handler-core": "6.6.0-alpha.10",
34
- "@webiny/feature": "6.6.0-alpha.10",
35
- "@webiny/handler": "6.6.0-alpha.10",
36
- "@webiny/plugins": "6.6.0-alpha.10",
37
- "@webiny/wcp": "6.6.0-alpha.10",
32
+ "@webiny/error": "6.6.0-alpha.12",
33
+ "@webiny/event-handler-core": "6.6.0-alpha.12",
34
+ "@webiny/feature": "6.6.0-alpha.12",
35
+ "@webiny/handler": "6.6.0-alpha.12",
36
+ "@webiny/plugins": "6.6.0-alpha.12",
37
+ "@webiny/wcp": "6.6.0-alpha.12",
38
38
  "cache-control-parser": "2.2.0",
39
39
  "graphql": "16.14.2",
40
40
  "mime": "4.1.2",
@@ -45,9 +45,9 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/object-hash": "3.0.6",
48
- "@webiny/api-core-testing": "6.6.0-alpha.10",
49
- "@webiny/utils": "6.6.0-alpha.10",
50
- "@webiny/wcp": "6.6.0-alpha.10",
48
+ "@webiny/api-core-testing": "6.6.0-alpha.12",
49
+ "@webiny/utils": "6.6.0-alpha.12",
50
+ "@webiny/wcp": "6.6.0-alpha.12",
51
51
  "rimraf": "6.1.3",
52
52
  "typescript": "7.0.2"
53
53
  },