@webiny/api-file-manager-server 0.0.0-unstable.0d717d18dd → 0.0.0-unstable.a4f3e4ea8b

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 (86) hide show
  1. package/assetDelivery/LocalAssetResolver.d.ts +4 -6
  2. package/assetDelivery/LocalAssetResolver.js +9 -9
  3. package/assetDelivery/LocalAssetResolver.js.map +1 -1
  4. package/assetDelivery/LocalOutputStrategy.d.ts +2 -3
  5. package/assetDelivery/LocalOutputStrategy.js +4 -4
  6. package/assetDelivery/LocalOutputStrategy.js.map +1 -1
  7. package/assetDelivery/LocalSharpTransform.d.ts +2 -2
  8. package/assetDelivery/LocalSharpTransform.js +34 -21
  9. package/assetDelivery/LocalSharpTransform.js.map +1 -1
  10. package/assetDelivery/assetDeliveryConfig.d.ts +1 -1
  11. package/assetDelivery/feature.js +6 -11
  12. package/assetDelivery/feature.js.map +1 -1
  13. package/features/CleanupStaleMultipartUploads/CleanupStaleMultipartUploadsTask.d.ts +0 -3
  14. package/features/CleanupStaleMultipartUploads/CleanupStaleMultipartUploadsTask.js +14 -18
  15. package/features/CleanupStaleMultipartUploads/CleanupStaleMultipartUploadsTask.js.map +1 -1
  16. package/features/CompleteMultiPartUpload/CompleteMultiPartUploadUseCase.d.ts +5 -7
  17. package/features/CompleteMultiPartUpload/CompleteMultiPartUploadUseCase.js +5 -8
  18. package/features/CompleteMultiPartUpload/CompleteMultiPartUploadUseCase.js.map +1 -1
  19. package/features/CompleteMultiPartUpload/feature.js +2 -2
  20. package/features/CompleteMultiPartUpload/feature.js.map +1 -1
  21. package/features/CreateMultiPartUpload/CreateMultiPartUploadUseCase.d.ts +7 -7
  22. package/features/CreateMultiPartUpload/CreateMultiPartUploadUseCase.js +10 -9
  23. package/features/CreateMultiPartUpload/CreateMultiPartUploadUseCase.js.map +1 -1
  24. package/features/CreateMultiPartUpload/feature.js +2 -2
  25. package/features/CreateMultiPartUpload/feature.js.map +1 -1
  26. package/features/DeleteFileFromDisk/DeleteFileFromDiskHandler.d.ts +1 -3
  27. package/features/DeleteFileFromDisk/DeleteFileFromDiskHandler.js +3 -6
  28. package/features/DeleteFileFromDisk/DeleteFileFromDiskHandler.js.map +1 -1
  29. package/features/ExtractMetadata/ExtractMetadataTask.d.ts +1 -3
  30. package/features/ExtractMetadata/ExtractMetadataTask.js +3 -6
  31. package/features/ExtractMetadata/ExtractMetadataTask.js.map +1 -1
  32. package/features/GetFileContentsById/GetFileContentsByIdUseCase.d.ts +5 -7
  33. package/features/GetFileContentsById/GetFileContentsByIdUseCase.js +5 -8
  34. package/features/GetFileContentsById/GetFileContentsByIdUseCase.js.map +1 -1
  35. package/features/GetFileContentsById/feature.js +2 -2
  36. package/features/GetFileContentsById/feature.js.map +1 -1
  37. package/features/GetFileContentsByKey/GetFileContentsByKeyUseCase.d.ts +5 -7
  38. package/features/GetFileContentsByKey/GetFileContentsByKeyUseCase.js +5 -8
  39. package/features/GetFileContentsByKey/GetFileContentsByKeyUseCase.js.map +1 -1
  40. package/features/GetFileContentsByKey/feature.js +2 -2
  41. package/features/GetFileContentsByKey/feature.js.map +1 -1
  42. package/features/GetUploadPayload/GetUploadPayloadUseCase.d.ts +6 -6
  43. package/features/GetUploadPayload/GetUploadPayloadUseCase.js +9 -8
  44. package/features/GetUploadPayload/GetUploadPayloadUseCase.js.map +1 -1
  45. package/features/GetUploadPayload/feature.js +2 -2
  46. package/features/GetUploadPayload/feature.js.map +1 -1
  47. package/index.d.ts +2 -1
  48. package/index.js +40 -1
  49. package/index.js.map +1 -0
  50. package/package.json +13 -13
  51. package/routes/uploadRoutes.d.ts +4 -0
  52. package/routes/uploadRoutes.js +130 -0
  53. package/routes/uploadRoutes.js.map +1 -0
  54. package/utils/resolveServerUrl.d.ts +2 -0
  55. package/utils/resolveServerUrl.js +10 -0
  56. package/utils/resolveServerUrl.js.map +1 -0
  57. package/FileManagerServerFeature.d.ts +0 -5
  58. package/FileManagerServerFeature.js +0 -41
  59. package/FileManagerServerFeature.js.map +0 -1
  60. package/features/FileManagerServerConfig/FileManagerServerConfig.d.ts +0 -12
  61. package/features/FileManagerServerConfig/FileManagerServerConfig.js +0 -28
  62. package/features/FileManagerServerConfig/FileManagerServerConfig.js.map +0 -1
  63. package/features/FileManagerServerConfig/abstractions.d.ts +0 -10
  64. package/features/FileManagerServerConfig/abstractions.js +0 -5
  65. package/features/FileManagerServerConfig/abstractions.js.map +0 -1
  66. package/features/FileManagerServerConfig/feature.d.ts +0 -4
  67. package/features/FileManagerServerConfig/feature.js +0 -11
  68. package/features/FileManagerServerConfig/feature.js.map +0 -1
  69. package/graphql/ServerGraphQLSchema.d.ts +0 -15
  70. package/graphql/ServerGraphQLSchema.js +0 -221
  71. package/graphql/ServerGraphQLSchema.js.map +0 -1
  72. package/routes/UploadPartRoute/UploadPartRoute.d.ts +0 -14
  73. package/routes/UploadPartRoute/UploadPartRoute.js +0 -66
  74. package/routes/UploadPartRoute/UploadPartRoute.js.map +0 -1
  75. package/routes/UploadPartRoute/feature.d.ts +0 -4
  76. package/routes/UploadPartRoute/feature.js +0 -11
  77. package/routes/UploadPartRoute/feature.js.map +0 -1
  78. package/routes/UploadSingleFileRoute/UploadSingleFileRoute.d.ts +0 -14
  79. package/routes/UploadSingleFileRoute/UploadSingleFileRoute.js +0 -70
  80. package/routes/UploadSingleFileRoute/UploadSingleFileRoute.js.map +0 -1
  81. package/routes/UploadSingleFileRoute/feature.d.ts +0 -4
  82. package/routes/UploadSingleFileRoute/feature.js +0 -11
  83. package/routes/UploadSingleFileRoute/feature.js.map +0 -1
  84. package/routes/utils.d.ts +0 -20
  85. package/routes/utils.js +0 -62
  86. package/routes/utils.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
2
- import { CreateMultiPartUploadUseCase as CreateMultiPartUploadUseCaseAbstraction } from "@webiny/api-file-manager/features/upload/CreateMultiPartUpload/index.js";
2
+ import { Request } from "@webiny/handler/abstractions/Request.js";
3
+ import { CreateMultiPartUploadUseCase } from "@webiny/api-file-manager/features/upload/CreateMultiPartUpload/index.js";
3
4
  import type { CreateMultiPartUploadResult } from "@webiny/api-file-manager/features/upload/types.js";
4
- import { FileManagerServerConfig } from "../../features/FileManagerServerConfig/abstractions.js";
5
- declare class CreateMultiPartUploadUseCaseImpl implements CreateMultiPartUploadUseCaseAbstraction.Interface {
5
+ declare class CreateMultiPartUploadUseCaseImpl implements CreateMultiPartUploadUseCase.Interface {
6
6
  private readonly tenantContext;
7
- private readonly config;
8
- constructor(tenantContext: TenantContext.Interface, config: FileManagerServerConfig.Interface);
9
- execute(params: CreateMultiPartUploadUseCaseAbstraction.Params): Promise<CreateMultiPartUploadResult>;
7
+ private readonly request;
8
+ constructor(tenantContext: TenantContext.Interface, request: Request.Interface);
9
+ execute(params: CreateMultiPartUploadUseCase.Params): Promise<CreateMultiPartUploadResult>;
10
10
  }
11
- export declare const CreateMultiPartUploadUseCase: typeof CreateMultiPartUploadUseCaseImpl & {
11
+ export declare const CreateMultiPartUploadUseCaseImplementation: typeof CreateMultiPartUploadUseCaseImpl & {
12
12
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-file-manager/features/upload/CreateMultiPartUpload/abstractions").ICreateMultiPartUploadUseCase>;
13
13
  };
14
14
  export {};
@@ -2,25 +2,26 @@ import node_path from "node:path";
2
2
  import { mkdir } from "node:fs/promises";
3
3
  import { mdbid } from "@webiny/utils";
4
4
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
5
+ import { Request } from "@webiny/handler/abstractions/Request.js";
5
6
  import { CreateMultiPartUploadUseCase } from "@webiny/api-file-manager/features/upload/CreateMultiPartUpload/index.js";
6
7
  import { createUploadToken } from "../../utils/uploadToken.js";
7
- import { FileManagerServerConfig } from "../FileManagerServerConfig/abstractions.js";
8
+ import { resolveServerUrl } from "../../utils/resolveServerUrl.js";
8
9
  class CreateMultiPartUploadUseCaseImpl {
9
- constructor(tenantContext, config){
10
+ constructor(tenantContext, request){
10
11
  this.tenantContext = tenantContext;
11
- this.config = config;
12
+ this.request = request;
12
13
  }
13
14
  async execute(params) {
14
15
  const { file, numberOfParts } = params;
15
- const storagePath = this.config.storagePath;
16
+ const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);
16
17
  const tenant = this.tenantContext.getTenant();
17
- const serverUrl = this.config.apiUrl;
18
+ const serverUrl = await resolveServerUrl(this.request);
18
19
  const uploadId = mdbid();
19
20
  const multipartDir = node_path.join(storagePath, "tenants", tenant.id, "multipart", uploadId);
20
21
  await mkdir(multipartDir, {
21
22
  recursive: true
22
23
  });
23
- const secret = this.config.uploadSecret;
24
+ const secret = process.env.WEBINY_UPLOAD_SECRET;
24
25
  const expiresAt = Date.now() + 86400000;
25
26
  const parts = Array.from({
26
27
  length: numberOfParts
@@ -46,13 +47,13 @@ class CreateMultiPartUploadUseCaseImpl {
46
47
  };
47
48
  }
48
49
  }
49
- const CreateMultiPartUploadUseCase_CreateMultiPartUploadUseCase = CreateMultiPartUploadUseCase.createImplementation({
50
+ const CreateMultiPartUploadUseCaseImplementation = CreateMultiPartUploadUseCase.createImplementation({
50
51
  implementation: CreateMultiPartUploadUseCaseImpl,
51
52
  dependencies: [
52
53
  TenantContext,
53
- FileManagerServerConfig
54
+ Request
54
55
  ]
55
56
  });
56
- export { CreateMultiPartUploadUseCase_CreateMultiPartUploadUseCase as CreateMultiPartUploadUseCase };
57
+ export { CreateMultiPartUploadUseCaseImplementation };
57
58
 
58
59
  //# sourceMappingURL=CreateMultiPartUploadUseCase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/CreateMultiPartUpload/CreateMultiPartUploadUseCase.js","sources":["../../../src/features/CreateMultiPartUpload/CreateMultiPartUploadUseCase.ts"],"sourcesContent":["import path from \"node:path\";\nimport { mkdir } from \"node:fs/promises\";\nimport { mdbid } from \"@webiny/utils\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { CreateMultiPartUploadUseCase as CreateMultiPartUploadUseCaseAbstraction } from \"@webiny/api-file-manager/features/upload/CreateMultiPartUpload/index.js\";\nimport type { CreateMultiPartUploadResult } from \"@webiny/api-file-manager/features/upload/types.js\";\nimport { createUploadToken } from \"~/utils/uploadToken.js\";\nimport { FileManagerServerConfig } from \"~/features/FileManagerServerConfig/abstractions.js\";\n\nclass CreateMultiPartUploadUseCaseImpl\n implements CreateMultiPartUploadUseCaseAbstraction.Interface\n{\n public constructor(\n private readonly tenantContext: TenantContext.Interface,\n private readonly config: FileManagerServerConfig.Interface\n ) {}\n\n public async execute(\n params: CreateMultiPartUploadUseCaseAbstraction.Params\n ): Promise<CreateMultiPartUploadResult> {\n const { file, numberOfParts } = params;\n const storagePath = this.config.storagePath;\n const tenant = this.tenantContext.getTenant();\n const serverUrl = this.config.apiUrl;\n\n const uploadId = mdbid();\n\n const multipartDir = path.join(storagePath, \"tenants\", tenant.id, \"multipart\", uploadId);\n await mkdir(multipartDir, { recursive: true });\n\n const secret = this.config.uploadSecret;\n const expiresAt = Date.now() + 86_400_000; /* 24h */\n\n const parts = Array.from({ length: numberOfParts }, (_, index) => {\n const partNumber = index + 1;\n\n const token = createUploadToken(\n {\n key: `tenants/${tenant.id}/multipart/${uploadId}/part-${partNumber}`,\n tenantId: tenant.id,\n expiresAt,\n uploadMinFileSize: 0,\n uploadMaxFileSize: 1_099_511_627_776\n },\n secret\n );\n\n const url = `${serverUrl}/webiny-file-upload/parts?uploadId=${uploadId}&partNumber=${partNumber}&token=${token}`;\n\n return { partNumber, url };\n });\n\n return { file, uploadId, parts };\n }\n}\n\nexport const CreateMultiPartUploadUseCase =\n CreateMultiPartUploadUseCaseAbstraction.createImplementation({\n implementation: CreateMultiPartUploadUseCaseImpl,\n dependencies: [TenantContext, FileManagerServerConfig]\n });\n"],"names":["CreateMultiPartUploadUseCaseImpl","tenantContext","config","params","file","numberOfParts","storagePath","tenant","serverUrl","uploadId","mdbid","multipartDir","path","mkdir","secret","expiresAt","Date","parts","Array","_","index","partNumber","token","createUploadToken","url","CreateMultiPartUploadUseCase","CreateMultiPartUploadUseCaseAbstraction","TenantContext","FileManagerServerConfig"],"mappings":";;;;;;;AASA,MAAMA;IAGF,YACqBC,aAAsC,EACtCC,MAAyC,CAC5D;aAFmBD,aAAa,GAAbA;aACAC,MAAM,GAANA;IAClB;IAEH,MAAa,QACTC,MAAsD,EAClB;QACpC,MAAM,EAAEC,IAAI,EAAEC,aAAa,EAAE,GAAGF;QAChC,MAAMG,cAAc,IAAI,CAAC,MAAM,CAAC,WAAW;QAC3C,MAAMC,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS;QAC3C,MAAMC,YAAY,IAAI,CAAC,MAAM,CAAC,MAAM;QAEpC,MAAMC,WAAWC;QAEjB,MAAMC,eAAeC,UAAAA,IAAS,CAACN,aAAa,WAAWC,OAAO,EAAE,EAAE,aAAaE;QAC/E,MAAMI,MAAMF,cAAc;YAAE,WAAW;QAAK;QAE5C,MAAMG,SAAS,IAAI,CAAC,MAAM,CAAC,YAAY;QACvC,MAAMC,YAAYC,KAAK,GAAG,KAAK;QAE/B,MAAMC,QAAQC,MAAM,IAAI,CAAC;YAAE,QAAQb;QAAc,GAAG,CAACc,GAAGC;YACpD,MAAMC,aAAaD,QAAQ;YAE3B,MAAME,QAAQC,kBACV;gBACI,KAAK,CAAC,QAAQ,EAAEhB,OAAO,EAAE,CAAC,WAAW,EAAEE,SAAS,MAAM,EAAEY,YAAY;gBACpE,UAAUd,OAAO,EAAE;gBACnBQ;gBACA,mBAAmB;gBACnB,mBAAmB;YACvB,GACAD;YAGJ,MAAMU,MAAM,GAAGhB,UAAU,mCAAmC,EAAEC,SAAS,YAAY,EAAEY,WAAW,OAAO,EAAEC,OAAO;YAEhH,OAAO;gBAAED;gBAAYG;YAAI;QAC7B;QAEA,OAAO;YAAEpB;YAAMK;YAAUQ;QAAM;IACnC;AACJ;AAEO,MAAMQ,4DACTC,6BAAAA,oBAA4D,CAAC;IACzD,gBAAgB1B;IAChB,cAAc;QAAC2B;QAAeC;KAAwB;AAC1D"}
1
+ {"version":3,"file":"features/CreateMultiPartUpload/CreateMultiPartUploadUseCase.js","sources":["../../../src/features/CreateMultiPartUpload/CreateMultiPartUploadUseCase.ts"],"sourcesContent":["import path from \"node:path\";\nimport { mkdir } from \"node:fs/promises\";\nimport { mdbid } from \"@webiny/utils\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { Request } from \"@webiny/handler/abstractions/Request.js\";\nimport { CreateMultiPartUploadUseCase } from \"@webiny/api-file-manager/features/upload/CreateMultiPartUpload/index.js\";\nimport type { CreateMultiPartUploadResult } from \"@webiny/api-file-manager/features/upload/types.js\";\nimport { createUploadToken } from \"~/utils/uploadToken.js\";\nimport { resolveServerUrl } from \"~/utils/resolveServerUrl.js\";\n\nclass CreateMultiPartUploadUseCaseImpl implements CreateMultiPartUploadUseCase.Interface {\n public constructor(\n private readonly tenantContext: TenantContext.Interface,\n private readonly request: Request.Interface\n ) {}\n\n public async execute(\n params: CreateMultiPartUploadUseCase.Params\n ): Promise<CreateMultiPartUploadResult> {\n const { file, numberOfParts } = params;\n const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);\n const tenant = this.tenantContext.getTenant();\n const serverUrl = await resolveServerUrl(this.request);\n\n const uploadId = mdbid();\n\n const multipartDir = path.join(storagePath, \"tenants\", tenant.id, \"multipart\", uploadId);\n await mkdir(multipartDir, { recursive: true });\n\n const secret = process.env.WEBINY_UPLOAD_SECRET as string;\n const expiresAt = Date.now() + 86_400_000; /* 24h */\n\n const parts = Array.from({ length: numberOfParts }, (_, index) => {\n const partNumber = index + 1;\n\n const token = createUploadToken(\n {\n key: `tenants/${tenant.id}/multipart/${uploadId}/part-${partNumber}`,\n tenantId: tenant.id,\n expiresAt,\n uploadMinFileSize: 0,\n uploadMaxFileSize: 1_099_511_627_776\n },\n secret\n );\n\n const url = `${serverUrl}/webiny-file-upload/parts?uploadId=${uploadId}&partNumber=${partNumber}&token=${token}`;\n\n return { partNumber, url };\n });\n\n return { file, uploadId, parts };\n }\n}\n\nexport const CreateMultiPartUploadUseCaseImplementation =\n CreateMultiPartUploadUseCase.createImplementation({\n implementation: CreateMultiPartUploadUseCaseImpl,\n dependencies: [TenantContext, Request]\n });\n"],"names":["CreateMultiPartUploadUseCaseImpl","tenantContext","request","params","file","numberOfParts","storagePath","String","process","tenant","serverUrl","resolveServerUrl","uploadId","mdbid","multipartDir","path","mkdir","secret","expiresAt","Date","parts","Array","_","index","partNumber","token","createUploadToken","url","CreateMultiPartUploadUseCaseImplementation","CreateMultiPartUploadUseCase","TenantContext","Request"],"mappings":";;;;;;;;AAUA,MAAMA;IACF,YACqBC,aAAsC,EACtCC,OAA0B,CAC7C;aAFmBD,aAAa,GAAbA;aACAC,OAAO,GAAPA;IAClB;IAEH,MAAa,QACTC,MAA2C,EACP;QACpC,MAAM,EAAEC,IAAI,EAAEC,aAAa,EAAE,GAAGF;QAChC,MAAMG,cAAcC,OAAOC,QAAQ,GAAG,CAAC,yBAAyB;QAChE,MAAMC,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS;QAC3C,MAAMC,YAAY,MAAMC,iBAAiB,IAAI,CAAC,OAAO;QAErD,MAAMC,WAAWC;QAEjB,MAAMC,eAAeC,UAAAA,IAAS,CAACT,aAAa,WAAWG,OAAO,EAAE,EAAE,aAAaG;QAC/E,MAAMI,MAAMF,cAAc;YAAE,WAAW;QAAK;QAE5C,MAAMG,SAAST,QAAQ,GAAG,CAAC,oBAAoB;QAC/C,MAAMU,YAAYC,KAAK,GAAG,KAAK;QAE/B,MAAMC,QAAQC,MAAM,IAAI,CAAC;YAAE,QAAQhB;QAAc,GAAG,CAACiB,GAAGC;YACpD,MAAMC,aAAaD,QAAQ;YAE3B,MAAME,QAAQC,kBACV;gBACI,KAAK,CAAC,QAAQ,EAAEjB,OAAO,EAAE,CAAC,WAAW,EAAEG,SAAS,MAAM,EAAEY,YAAY;gBACpE,UAAUf,OAAO,EAAE;gBACnBS;gBACA,mBAAmB;gBACnB,mBAAmB;YACvB,GACAD;YAGJ,MAAMU,MAAM,GAAGjB,UAAU,mCAAmC,EAAEE,SAAS,YAAY,EAAEY,WAAW,OAAO,EAAEC,OAAO;YAEhH,OAAO;gBAAED;gBAAYG;YAAI;QAC7B;QAEA,OAAO;YAAEvB;YAAMQ;YAAUQ;QAAM;IACnC;AACJ;AAEO,MAAMQ,6CACTC,6BAA6B,oBAAoB,CAAC;IAC9C,gBAAgB7B;IAChB,cAAc;QAAC8B;QAAeC;KAAQ;AAC1C"}
@@ -1,9 +1,9 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
- import { CreateMultiPartUploadUseCase } from "./CreateMultiPartUploadUseCase.js";
2
+ import { CreateMultiPartUploadUseCaseImplementation } from "./CreateMultiPartUploadUseCase.js";
3
3
  const CreateMultiPartUploadFeature = createFeature({
4
4
  name: "FileManagerServer/CreateMultiPartUpload",
5
5
  register (container) {
6
- container.register(CreateMultiPartUploadUseCase);
6
+ container.register(CreateMultiPartUploadUseCaseImplementation);
7
7
  }
8
8
  });
9
9
  export { CreateMultiPartUploadFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/CreateMultiPartUpload/feature.js","sources":["../../../src/features/CreateMultiPartUpload/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateMultiPartUploadUseCase } from \"./CreateMultiPartUploadUseCase.js\";\n\nexport const CreateMultiPartUploadFeature = createFeature({\n name: \"FileManagerServer/CreateMultiPartUpload\",\n register(container) {\n container.register(CreateMultiPartUploadUseCase);\n }\n});\n"],"names":["CreateMultiPartUploadFeature","createFeature","container","CreateMultiPartUploadUseCase"],"mappings":";;AAGO,MAAMA,+BAA+BC,cAAc;IACtD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
1
+ {"version":3,"file":"features/CreateMultiPartUpload/feature.js","sources":["../../../src/features/CreateMultiPartUpload/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateMultiPartUploadUseCaseImplementation } from \"./CreateMultiPartUploadUseCase.js\";\n\nexport const CreateMultiPartUploadFeature = createFeature({\n name: \"FileManagerServer/CreateMultiPartUpload\",\n register(container) {\n container.register(CreateMultiPartUploadUseCaseImplementation);\n }\n});\n"],"names":["CreateMultiPartUploadFeature","createFeature","container","CreateMultiPartUploadUseCaseImplementation"],"mappings":";;AAGO,MAAMA,+BAA+BC,cAAc;IACtD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,12 +1,10 @@
1
1
  import { FileAfterDeleteEventHandler } from "@webiny/api-file-manager/features/file/DeleteFile/events.js";
2
2
  import { GlobalKeyValueStore } from "@webiny/api-core/features/keyValueStore/index.js";
3
3
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
4
- import { FileManagerServerConfig } from "../../features/FileManagerServerConfig/abstractions.js";
5
4
  declare class DeleteFileFromDiskHandlerImpl implements FileAfterDeleteEventHandler.Interface {
6
5
  private readonly tenantContext;
7
6
  private readonly keyValueStore;
8
- private readonly config;
9
- constructor(tenantContext: TenantContext.Interface, keyValueStore: GlobalKeyValueStore.Interface, config: FileManagerServerConfig.Interface);
7
+ constructor(tenantContext: TenantContext.Interface, keyValueStore: GlobalKeyValueStore.Interface);
10
8
  handle(event: FileAfterDeleteEventHandler.Event): Promise<void>;
11
9
  }
12
10
  export declare const DeleteFileFromDiskHandler: typeof DeleteFileFromDiskHandlerImpl & {
@@ -2,17 +2,15 @@ import { promises } from "node:fs";
2
2
  import { FileAfterDeleteEventHandler } from "@webiny/api-file-manager/features/file/DeleteFile/events.js";
3
3
  import { GlobalKeyValueStore } from "@webiny/api-core/features/keyValueStore/index.js";
4
4
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
5
- import { FileManagerServerConfig } from "../FileManagerServerConfig/abstractions.js";
6
5
  class DeleteFileFromDiskHandlerImpl {
7
- constructor(tenantContext, keyValueStore, config){
6
+ constructor(tenantContext, keyValueStore){
8
7
  this.tenantContext = tenantContext;
9
8
  this.keyValueStore = keyValueStore;
10
- this.config = config;
11
9
  }
12
10
  async handle(event) {
13
11
  const { file } = event.payload;
14
12
  const tenant = this.tenantContext.getTenant();
15
- const storagePath = this.config.storagePath;
13
+ const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);
16
14
  const folderPath = `${storagePath}/tenants/${tenant.id}/files/${file.id}`;
17
15
  await promises.rm(folderPath, {
18
16
  recursive: true,
@@ -25,8 +23,7 @@ const DeleteFileFromDiskHandler = FileAfterDeleteEventHandler.createImplementati
25
23
  implementation: DeleteFileFromDiskHandlerImpl,
26
24
  dependencies: [
27
25
  TenantContext,
28
- GlobalKeyValueStore,
29
- FileManagerServerConfig
26
+ GlobalKeyValueStore
30
27
  ]
31
28
  });
32
29
  export { DeleteFileFromDiskHandler };
@@ -1 +1 @@
1
- {"version":3,"file":"features/DeleteFileFromDisk/DeleteFileFromDiskHandler.js","sources":["../../../src/features/DeleteFileFromDisk/DeleteFileFromDiskHandler.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport { FileAfterDeleteEventHandler } from \"@webiny/api-file-manager/features/file/DeleteFile/events.js\";\nimport { GlobalKeyValueStore } from \"@webiny/api-core/features/keyValueStore/index.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { FileManagerServerConfig } from \"~/features/FileManagerServerConfig/abstractions.js\";\n\nclass DeleteFileFromDiskHandlerImpl implements FileAfterDeleteEventHandler.Interface {\n constructor(\n private readonly tenantContext: TenantContext.Interface,\n private readonly keyValueStore: GlobalKeyValueStore.Interface,\n private readonly config: FileManagerServerConfig.Interface\n ) {}\n\n async handle(event: FileAfterDeleteEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n const tenant = this.tenantContext.getTenant();\n const storagePath = this.config.storagePath;\n const folderPath = `${storagePath}/tenants/${tenant.id}/files/${file.id}`;\n\n /* Delete the file folder from local disk. */\n await fs.rm(folderPath, { recursive: true, force: true });\n\n /* Delete file metadata from the key-value store. */\n await this.keyValueStore.delete(`FileManager/File/${file.id}/Metadata`);\n }\n}\n\nexport const DeleteFileFromDiskHandler = FileAfterDeleteEventHandler.createImplementation({\n implementation: DeleteFileFromDiskHandlerImpl,\n dependencies: [TenantContext, GlobalKeyValueStore, FileManagerServerConfig]\n});\n"],"names":["DeleteFileFromDiskHandlerImpl","tenantContext","keyValueStore","config","event","file","tenant","storagePath","folderPath","fs","DeleteFileFromDiskHandler","FileAfterDeleteEventHandler","TenantContext","GlobalKeyValueStore","FileManagerServerConfig"],"mappings":";;;;;AAMA,MAAMA;IACF,YACqBC,aAAsC,EACtCC,aAA4C,EAC5CC,MAAyC,CAC5D;aAHmBF,aAAa,GAAbA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;IAClB;IAEH,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAC9B,MAAME,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS;QAC3C,MAAMC,cAAc,IAAI,CAAC,MAAM,CAAC,WAAW;QAC3C,MAAMC,aAAa,GAAGD,YAAY,SAAS,EAAED,OAAO,EAAE,CAAC,OAAO,EAAED,KAAK,EAAE,EAAE;QAGzE,MAAMI,SAAAA,EAAK,CAACD,YAAY;YAAE,WAAW;YAAM,OAAO;QAAK;QAGvD,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAEH,KAAK,EAAE,CAAC,SAAS,CAAC;IAC1E;AACJ;AAEO,MAAMK,4BAA4BC,4BAA4B,oBAAoB,CAAC;IACtF,gBAAgBX;IAChB,cAAc;QAACY;QAAeC;QAAqBC;KAAwB;AAC/E"}
1
+ {"version":3,"file":"features/DeleteFileFromDisk/DeleteFileFromDiskHandler.js","sources":["../../../src/features/DeleteFileFromDisk/DeleteFileFromDiskHandler.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport { FileAfterDeleteEventHandler } from \"@webiny/api-file-manager/features/file/DeleteFile/events.js\";\nimport { GlobalKeyValueStore } from \"@webiny/api-core/features/keyValueStore/index.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\n\nclass DeleteFileFromDiskHandlerImpl implements FileAfterDeleteEventHandler.Interface {\n constructor(\n private readonly tenantContext: TenantContext.Interface,\n private readonly keyValueStore: GlobalKeyValueStore.Interface\n ) {}\n\n async handle(event: FileAfterDeleteEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n const tenant = this.tenantContext.getTenant();\n const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);\n const folderPath = `${storagePath}/tenants/${tenant.id}/files/${file.id}`;\n\n /* Delete the file folder from local disk. */\n await fs.rm(folderPath, { recursive: true, force: true });\n\n /* Delete file metadata from the key-value store. */\n await this.keyValueStore.delete(`FileManager/File/${file.id}/Metadata`);\n }\n}\n\nexport const DeleteFileFromDiskHandler = FileAfterDeleteEventHandler.createImplementation({\n implementation: DeleteFileFromDiskHandlerImpl,\n dependencies: [TenantContext, GlobalKeyValueStore]\n});\n"],"names":["DeleteFileFromDiskHandlerImpl","tenantContext","keyValueStore","event","file","tenant","storagePath","String","process","folderPath","fs","DeleteFileFromDiskHandler","FileAfterDeleteEventHandler","TenantContext","GlobalKeyValueStore"],"mappings":";;;;AAKA,MAAMA;IACF,YACqBC,aAAsC,EACtCC,aAA4C,CAC/D;aAFmBD,aAAa,GAAbA;aACAC,aAAa,GAAbA;IAClB;IAEH,MAAM,OAAOC,KAAwC,EAAiB;QAClE,MAAM,EAAEC,IAAI,EAAE,GAAGD,MAAM,OAAO;QAC9B,MAAME,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS;QAC3C,MAAMC,cAAcC,OAAOC,QAAQ,GAAG,CAAC,yBAAyB;QAChE,MAAMC,aAAa,GAAGH,YAAY,SAAS,EAAED,OAAO,EAAE,CAAC,OAAO,EAAED,KAAK,EAAE,EAAE;QAGzE,MAAMM,SAAAA,EAAK,CAACD,YAAY;YAAE,WAAW;YAAM,OAAO;QAAK;QAGvD,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAEL,KAAK,EAAE,CAAC,SAAS,CAAC;IAC1E;AACJ;AAEO,MAAMO,4BAA4BC,4BAA4B,oBAAoB,CAAC;IACtF,gBAAgBZ;IAChB,cAAc;QAACa;QAAeC;KAAoB;AACtD"}
@@ -2,11 +2,9 @@ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/in
2
2
  import { UpdateFileUseCase } from "@webiny/api-file-manager/features/file/UpdateFile/index.js";
3
3
  import { MetadataReader } from "@webiny/api-file-manager/features/upload/ReadFileMetadata/abstractions.js";
4
4
  import type { ExtractMetadataInput } from "@webiny/api-file-manager/features/extractMetadata/ExtractMetadataInput.js";
5
- import { FileManagerServerConfig } from "../../features/FileManagerServerConfig/abstractions.js";
6
5
  declare class ExtractMetadataTaskImpl implements TaskDefinition.Interface<ExtractMetadataInput> {
7
6
  private readonly metadataReader;
8
7
  private readonly updateFileUseCase;
9
- private readonly config;
10
8
  readonly id = "fileManagerExtractMetadata";
11
9
  readonly title = "Extract image metadata (dimensions, EXIF, IPTC)";
12
10
  readonly description = "A task to extract metadata from uploaded image files";
@@ -14,7 +12,7 @@ declare class ExtractMetadataTaskImpl implements TaskDefinition.Interface<Extrac
14
12
  readonly isPrivate = true;
15
13
  readonly databaseLogs = false;
16
14
  readonly selfCleanup: ("onAbort" | "onSuccess")[];
17
- constructor(metadataReader: MetadataReader.Interface, updateFileUseCase: UpdateFileUseCase.Interface, config: FileManagerServerConfig.Interface);
15
+ constructor(metadataReader: MetadataReader.Interface, updateFileUseCase: UpdateFileUseCase.Interface);
18
16
  run({ input, controller }: TaskDefinition.RunParams<ExtractMetadataInput>): Promise<TaskDefinition.Result<ExtractMetadataInput>>;
19
17
  private cleanValues;
20
18
  }
@@ -2,12 +2,10 @@ import { promises } from "node:fs";
2
2
  import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
3
3
  import { UpdateFileUseCase } from "@webiny/api-file-manager/features/file/UpdateFile/index.js";
4
4
  import { MetadataReader } from "@webiny/api-file-manager/features/upload/ReadFileMetadata/abstractions.js";
5
- import { FileManagerServerConfig } from "../FileManagerServerConfig/abstractions.js";
6
5
  class ExtractMetadataTaskImpl {
7
- constructor(metadataReader, updateFileUseCase, config){
6
+ constructor(metadataReader, updateFileUseCase){
8
7
  this.metadataReader = metadataReader;
9
8
  this.updateFileUseCase = updateFileUseCase;
10
- this.config = config;
11
9
  this.id = "fileManagerExtractMetadata";
12
10
  this.title = "Extract image metadata (dimensions, EXIF, IPTC)";
13
11
  this.description = "A task to extract metadata from uploaded image files";
@@ -26,7 +24,7 @@ class ExtractMetadataTaskImpl {
26
24
  message: `File metadata not found for file ID: ${input.fileId}`
27
25
  });
28
26
  if (!fileMetadata.contentType.startsWith("image/")) return controller.response.done();
29
- const storagePath = this.config.storagePath;
27
+ const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);
30
28
  const filePath = `${storagePath}/${fileMetadata.bucketKey}`;
31
29
  try {
32
30
  const buffer = await promises.readFile(filePath);
@@ -75,8 +73,7 @@ const ExtractMetadataTaskDefinition = TaskDefinition.createImplementation({
75
73
  implementation: ExtractMetadataTaskImpl,
76
74
  dependencies: [
77
75
  MetadataReader,
78
- UpdateFileUseCase,
79
- FileManagerServerConfig
76
+ UpdateFileUseCase
80
77
  ]
81
78
  });
82
79
  export { ExtractMetadataTaskDefinition };
@@ -1 +1 @@
1
- {"version":3,"file":"features/ExtractMetadata/ExtractMetadataTask.js","sources":["../../../src/features/ExtractMetadata/ExtractMetadataTask.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport type { ExifTags } from \"exifreader\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { UpdateFileUseCase } from \"@webiny/api-file-manager/features/file/UpdateFile/index.js\";\nimport { MetadataReader } from \"@webiny/api-file-manager/features/upload/ReadFileMetadata/abstractions.js\";\nimport type { ExtractMetadataInput } from \"@webiny/api-file-manager/features/extractMetadata/ExtractMetadataInput.js\";\nimport { FileManagerServerConfig } from \"~/features/FileManagerServerConfig/abstractions.js\";\n\nclass ExtractMetadataTaskImpl implements TaskDefinition.Interface<ExtractMetadataInput> {\n public readonly id = \"fileManagerExtractMetadata\";\n public readonly title = \"Extract image metadata (dimensions, EXIF, IPTC)\";\n public readonly description = \"A task to extract metadata from uploaded image files\";\n public readonly maxIterations = 1;\n public readonly isPrivate = true;\n public readonly databaseLogs = false;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n public constructor(\n private readonly metadataReader: MetadataReader.Interface,\n private readonly updateFileUseCase: UpdateFileUseCase.Interface,\n private readonly config: FileManagerServerConfig.Interface\n ) {}\n\n public async run({\n input,\n controller\n }: TaskDefinition.RunParams<ExtractMetadataInput>): Promise<\n TaskDefinition.Result<ExtractMetadataInput>\n > {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n /* Load file metadata from the key-value store. */\n const fileMetadata = await this.metadataReader.read(input.fileId);\n\n if (!fileMetadata) {\n return controller.response.error({\n message: `File metadata not found for file ID: ${input.fileId}`\n });\n }\n\n /* Only process image files. */\n if (!fileMetadata.contentType.startsWith(\"image/\")) {\n return controller.response.done();\n }\n\n const storagePath = this.config.storagePath;\n const filePath = `${storagePath}/${fileMetadata.bucketKey}`;\n\n try {\n /* Read the image file from local disk. */\n const buffer = await fs.readFile(filePath);\n\n const sharp = await import(/* webpackChunkName: \"sharp\" */ \"sharp\").then(\n m => m.default\n );\n\n const ExifReader = await import(/* webpackChunkName: \"exifreader\" */ \"exifreader\").then(\n m => m.default\n );\n\n /* Extract image dimensions using Sharp. */\n const sharpInstance = sharp(buffer);\n const sharpMetadata = await sharpInstance.metadata();\n\n /* Use ExifReader to extract EXIF and IPTC data. */\n const tags = ExifReader.load(buffer, { expanded: true });\n\n /* Build metadata object. */\n const metadata: Record<string, unknown> = {\n image: {\n width: sharpMetadata.width,\n height: sharpMetadata.height,\n format: sharpMetadata.format,\n orientation: sharpMetadata.orientation ?? 1\n }\n };\n\n /* Extract EXIF data if available. */\n if (tags.exif) {\n metadata.exif = this.cleanValues(tags.exif);\n }\n\n /* Extract IPTC data if available. */\n if (tags.iptc) {\n metadata.iptc = this.cleanValues(tags.iptc);\n }\n\n /* Update the file with extracted metadata. */\n const updateResult = await this.updateFileUseCase.execute({\n id: input.fileId,\n metadata\n });\n\n if (updateResult.isFail()) {\n return controller.response.error({\n message: `Failed to update file with metadata: ${updateResult.error.message}`\n });\n }\n\n return controller.response.done();\n } catch (error) {\n return controller.response.error({\n message: `Failed to extract metadata: ${\n error instanceof Error ? error.message : String(error)\n }`\n });\n }\n }\n\n private cleanValues(tags: ExifTags) {\n const cleaned: Record<string, unknown> = {};\n\n for (const [key, tag] of Object.entries(tags)) {\n if (!tag || typeof tag !== \"object\") {\n continue;\n }\n\n /* Use description if available, otherwise value. */\n if (tag.description !== undefined && tag.description !== null) {\n cleaned[key] = tag.description;\n } else if (Array.isArray(tag.value) && tag.value.length > 20) {\n /* Skip large byte arrays. */\n } else if (tag.value !== undefined) {\n cleaned[key] = tag.value;\n }\n }\n\n return cleaned;\n }\n}\n\nexport const ExtractMetadataTaskDefinition = TaskDefinition.createImplementation({\n implementation: ExtractMetadataTaskImpl,\n dependencies: [MetadataReader, UpdateFileUseCase, FileManagerServerConfig]\n});\n"],"names":["ExtractMetadataTaskImpl","metadataReader","updateFileUseCase","config","input","controller","fileMetadata","storagePath","filePath","buffer","fs","sharp","m","ExifReader","sharpInstance","sharpMetadata","tags","metadata","updateResult","error","Error","String","cleaned","key","tag","Object","undefined","Array","ExtractMetadataTaskDefinition","TaskDefinition","MetadataReader","UpdateFileUseCase","FileManagerServerConfig"],"mappings":"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"}
1
+ {"version":3,"file":"features/ExtractMetadata/ExtractMetadataTask.js","sources":["../../../src/features/ExtractMetadata/ExtractMetadataTask.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport type { ExifTags } from \"exifreader\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { UpdateFileUseCase } from \"@webiny/api-file-manager/features/file/UpdateFile/index.js\";\nimport { MetadataReader } from \"@webiny/api-file-manager/features/upload/ReadFileMetadata/abstractions.js\";\nimport type { ExtractMetadataInput } from \"@webiny/api-file-manager/features/extractMetadata/ExtractMetadataInput.js\";\n\nclass ExtractMetadataTaskImpl implements TaskDefinition.Interface<ExtractMetadataInput> {\n public readonly id = \"fileManagerExtractMetadata\";\n public readonly title = \"Extract image metadata (dimensions, EXIF, IPTC)\";\n public readonly description = \"A task to extract metadata from uploaded image files\";\n public readonly maxIterations = 1;\n public readonly isPrivate = true;\n public readonly databaseLogs = false;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n public constructor(\n private readonly metadataReader: MetadataReader.Interface,\n private readonly updateFileUseCase: UpdateFileUseCase.Interface\n ) {}\n\n public async run({\n input,\n controller\n }: TaskDefinition.RunParams<ExtractMetadataInput>): Promise<\n TaskDefinition.Result<ExtractMetadataInput>\n > {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n /* Load file metadata from the key-value store. */\n const fileMetadata = await this.metadataReader.read(input.fileId);\n\n if (!fileMetadata) {\n return controller.response.error({\n message: `File metadata not found for file ID: ${input.fileId}`\n });\n }\n\n /* Only process image files. */\n if (!fileMetadata.contentType.startsWith(\"image/\")) {\n return controller.response.done();\n }\n\n const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);\n const filePath = `${storagePath}/${fileMetadata.bucketKey}`;\n\n try {\n /* Read the image file from local disk. */\n const buffer = await fs.readFile(filePath);\n\n const sharp = await import(/* webpackChunkName: \"sharp\" */ \"sharp\").then(\n m => m.default\n );\n\n const ExifReader = await import(/* webpackChunkName: \"exifreader\" */ \"exifreader\").then(\n m => m.default\n );\n\n /* Extract image dimensions using Sharp. */\n const sharpInstance = sharp(buffer);\n const sharpMetadata = await sharpInstance.metadata();\n\n /* Use ExifReader to extract EXIF and IPTC data. */\n const tags = ExifReader.load(buffer, { expanded: true });\n\n /* Build metadata object. */\n const metadata: Record<string, unknown> = {\n image: {\n width: sharpMetadata.width,\n height: sharpMetadata.height,\n format: sharpMetadata.format,\n orientation: sharpMetadata.orientation ?? 1\n }\n };\n\n /* Extract EXIF data if available. */\n if (tags.exif) {\n metadata.exif = this.cleanValues(tags.exif);\n }\n\n /* Extract IPTC data if available. */\n if (tags.iptc) {\n metadata.iptc = this.cleanValues(tags.iptc);\n }\n\n /* Update the file with extracted metadata. */\n const updateResult = await this.updateFileUseCase.execute({\n id: input.fileId,\n metadata\n });\n\n if (updateResult.isFail()) {\n return controller.response.error({\n message: `Failed to update file with metadata: ${updateResult.error.message}`\n });\n }\n\n return controller.response.done();\n } catch (error) {\n return controller.response.error({\n message: `Failed to extract metadata: ${\n error instanceof Error ? error.message : String(error)\n }`\n });\n }\n }\n\n private cleanValues(tags: ExifTags) {\n const cleaned: Record<string, unknown> = {};\n\n for (const [key, tag] of Object.entries(tags)) {\n if (!tag || typeof tag !== \"object\") {\n continue;\n }\n\n /* Use description if available, otherwise value. */\n if (tag.description !== undefined && tag.description !== null) {\n cleaned[key] = tag.description;\n } else if (Array.isArray(tag.value) && tag.value.length > 20) {\n /* Skip large byte arrays. */\n } else if (tag.value !== undefined) {\n cleaned[key] = tag.value;\n }\n }\n\n return cleaned;\n }\n}\n\nexport const ExtractMetadataTaskDefinition = TaskDefinition.createImplementation({\n implementation: ExtractMetadataTaskImpl,\n dependencies: [MetadataReader, UpdateFileUseCase]\n});\n"],"names":["ExtractMetadataTaskImpl","metadataReader","updateFileUseCase","input","controller","fileMetadata","storagePath","String","process","filePath","buffer","fs","sharp","m","ExifReader","sharpInstance","sharpMetadata","tags","metadata","updateResult","error","Error","cleaned","key","tag","Object","undefined","Array","ExtractMetadataTaskDefinition","TaskDefinition","MetadataReader","UpdateFileUseCase"],"mappings":"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"}
@@ -1,15 +1,13 @@
1
1
  import { Result } from "@webiny/feature/api";
2
- import { GetFileContentsByIdUseCase as GetFileContentsByIdUseCaseAbstraction } from "@webiny/api-file-manager/features/file/GetFileContentsById/index.js";
2
+ import { GetFileContentsByIdUseCase } from "@webiny/api-file-manager/features/file/GetFileContentsById/index.js";
3
3
  import type { FileContents } from "@webiny/api-file-manager/features/file/GetFileContentsById/index.js";
4
4
  import { MetadataReader } from "@webiny/api-file-manager/features/upload/ReadFileMetadata/abstractions.js";
5
- import { FileManagerServerConfig } from "../../features/FileManagerServerConfig/abstractions.js";
6
- declare class GetFileContentsByIdUseCaseImpl implements GetFileContentsByIdUseCaseAbstraction.Interface {
5
+ declare class GetFileContentsByIdUseCaseImpl implements GetFileContentsByIdUseCase.Interface {
7
6
  private readonly metadataReader;
8
- private readonly config;
9
- constructor(metadataReader: MetadataReader.Interface, config: FileManagerServerConfig.Interface);
10
- execute(fileId: string): Promise<Result<FileContents, GetFileContentsByIdUseCaseAbstraction.Error>>;
7
+ constructor(metadataReader: MetadataReader.Interface);
8
+ execute(fileId: string): Promise<Result<FileContents, GetFileContentsByIdUseCase.Error>>;
11
9
  }
12
- export declare const GetFileContentsByIdUseCase: typeof GetFileContentsByIdUseCaseImpl & {
10
+ export declare const GetFileContentsByIdUseCaseImplementation: typeof GetFileContentsByIdUseCaseImpl & {
13
11
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-file-manager/features/file/GetFileContentsById/abstractions").IGetFileContentsByIdUseCase>;
14
12
  };
15
13
  export {};
@@ -3,16 +3,14 @@ import { Result } from "@webiny/feature/api";
3
3
  import { GetFileContentsByIdUseCase } from "@webiny/api-file-manager/features/file/GetFileContentsById/index.js";
4
4
  import { FileNotFoundError, FilePersistenceError } from "@webiny/api-file-manager/domain/file/errors.js";
5
5
  import { MetadataReader } from "@webiny/api-file-manager/features/upload/ReadFileMetadata/abstractions.js";
6
- import { FileManagerServerConfig } from "../FileManagerServerConfig/abstractions.js";
7
6
  class GetFileContentsByIdUseCaseImpl {
8
- constructor(metadataReader, config){
7
+ constructor(metadataReader){
9
8
  this.metadataReader = metadataReader;
10
- this.config = config;
11
9
  }
12
10
  async execute(fileId) {
13
11
  const metadata = await this.metadataReader.read(fileId);
14
12
  if (!metadata) return Result.fail(new FileNotFoundError(fileId));
15
- const storagePath = this.config.storagePath;
13
+ const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);
16
14
  try {
17
15
  const filePath = `${storagePath}/${metadata.bucketKey}`;
18
16
  const buffer = await promises.readFile(filePath);
@@ -26,13 +24,12 @@ class GetFileContentsByIdUseCaseImpl {
26
24
  }
27
25
  }
28
26
  }
29
- const GetFileContentsByIdUseCase_GetFileContentsByIdUseCase = GetFileContentsByIdUseCase.createImplementation({
27
+ const GetFileContentsByIdUseCaseImplementation = GetFileContentsByIdUseCase.createImplementation({
30
28
  implementation: GetFileContentsByIdUseCaseImpl,
31
29
  dependencies: [
32
- MetadataReader,
33
- FileManagerServerConfig
30
+ MetadataReader
34
31
  ]
35
32
  });
36
- export { GetFileContentsByIdUseCase_GetFileContentsByIdUseCase as GetFileContentsByIdUseCase };
33
+ export { GetFileContentsByIdUseCaseImplementation };
37
34
 
38
35
  //# sourceMappingURL=GetFileContentsByIdUseCase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/GetFileContentsById/GetFileContentsByIdUseCase.js","sources":["../../../src/features/GetFileContentsById/GetFileContentsByIdUseCase.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport { Result } from \"@webiny/feature/api\";\nimport { GetFileContentsByIdUseCase as GetFileContentsByIdUseCaseAbstraction } from \"@webiny/api-file-manager/features/file/GetFileContentsById/index.js\";\nimport type { FileContents } from \"@webiny/api-file-manager/features/file/GetFileContentsById/index.js\";\nimport {\n FileNotFoundError,\n FilePersistenceError\n} from \"@webiny/api-file-manager/domain/file/errors.js\";\nimport { MetadataReader } from \"@webiny/api-file-manager/features/upload/ReadFileMetadata/abstractions.js\";\nimport { FileManagerServerConfig } from \"~/features/FileManagerServerConfig/abstractions.js\";\n\nclass GetFileContentsByIdUseCaseImpl implements GetFileContentsByIdUseCaseAbstraction.Interface {\n private readonly metadataReader: MetadataReader.Interface;\n private readonly config: FileManagerServerConfig.Interface;\n\n public constructor(\n metadataReader: MetadataReader.Interface,\n config: FileManagerServerConfig.Interface\n ) {\n this.metadataReader = metadataReader;\n this.config = config;\n }\n\n public async execute(\n fileId: string\n ): Promise<Result<FileContents, GetFileContentsByIdUseCaseAbstraction.Error>> {\n const metadata = await this.metadataReader.read(fileId);\n if (!metadata) {\n return Result.fail(new FileNotFoundError(fileId));\n }\n\n const storagePath = this.config.storagePath;\n\n try {\n const filePath = `${storagePath}/${metadata.bucketKey}`;\n const buffer = await fs.readFile(filePath);\n return Result.ok({ buffer, contentType: metadata.contentType });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return Result.fail(new FileNotFoundError(fileId));\n }\n return Result.fail(\n new FilePersistenceError(error instanceof Error ? error : new Error(String(error)))\n );\n }\n }\n}\n\nexport const GetFileContentsByIdUseCase =\n GetFileContentsByIdUseCaseAbstraction.createImplementation({\n implementation: GetFileContentsByIdUseCaseImpl,\n dependencies: [MetadataReader, FileManagerServerConfig]\n });\n"],"names":["GetFileContentsByIdUseCaseImpl","metadataReader","config","fileId","metadata","Result","FileNotFoundError","storagePath","filePath","buffer","fs","error","FilePersistenceError","Error","String","GetFileContentsByIdUseCase","GetFileContentsByIdUseCaseAbstraction","MetadataReader","FileManagerServerConfig"],"mappings":";;;;;;AAWA,MAAMA;IAIF,YACIC,cAAwC,EACxCC,MAAyC,CAC3C;QACE,IAAI,CAAC,cAAc,GAAGD;QACtB,IAAI,CAAC,MAAM,GAAGC;IAClB;IAEA,MAAa,QACTC,MAAc,EAC4D;QAC1E,MAAMC,WAAW,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAACD;QAChD,IAAI,CAACC,UACD,OAAOC,OAAO,IAAI,CAAC,IAAIC,kBAAkBH;QAG7C,MAAMI,cAAc,IAAI,CAAC,MAAM,CAAC,WAAW;QAE3C,IAAI;YACA,MAAMC,WAAW,GAAGD,YAAY,CAAC,EAAEH,SAAS,SAAS,EAAE;YACvD,MAAMK,SAAS,MAAMC,SAAAA,QAAW,CAACF;YACjC,OAAOH,OAAO,EAAE,CAAC;gBAAEI;gBAAQ,aAAaL,SAAS,WAAW;YAAC;QACjE,EAAE,OAAOO,OAAO;YACZ,IAAKA,AAAyC,aAAzCA,MAAgC,IAAI,EACrC,OAAON,OAAO,IAAI,CAAC,IAAIC,kBAAkBH;YAE7C,OAAOE,OAAO,IAAI,CACd,IAAIO,qBAAqBD,iBAAiBE,QAAQF,QAAQ,IAAIE,MAAMC,OAAOH;QAEnF;IACJ;AACJ;AAEO,MAAMI,wDACTC,2BAAAA,oBAA0D,CAAC;IACvD,gBAAgBhB;IAChB,cAAc;QAACiB;QAAgBC;KAAwB;AAC3D"}
1
+ {"version":3,"file":"features/GetFileContentsById/GetFileContentsByIdUseCase.js","sources":["../../../src/features/GetFileContentsById/GetFileContentsByIdUseCase.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport { Result } from \"@webiny/feature/api\";\nimport { GetFileContentsByIdUseCase } from \"@webiny/api-file-manager/features/file/GetFileContentsById/index.js\";\nimport type { FileContents } from \"@webiny/api-file-manager/features/file/GetFileContentsById/index.js\";\nimport {\n FileNotFoundError,\n FilePersistenceError\n} from \"@webiny/api-file-manager/domain/file/errors.js\";\nimport { MetadataReader } from \"@webiny/api-file-manager/features/upload/ReadFileMetadata/abstractions.js\";\n\nclass GetFileContentsByIdUseCaseImpl implements GetFileContentsByIdUseCase.Interface {\n private readonly metadataReader: MetadataReader.Interface;\n\n public constructor(metadataReader: MetadataReader.Interface) {\n this.metadataReader = metadataReader;\n }\n\n public async execute(\n fileId: string\n ): Promise<Result<FileContents, GetFileContentsByIdUseCase.Error>> {\n const metadata = await this.metadataReader.read(fileId);\n if (!metadata) {\n return Result.fail(new FileNotFoundError(fileId));\n }\n\n const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);\n\n try {\n const filePath = `${storagePath}/${metadata.bucketKey}`;\n const buffer = await fs.readFile(filePath);\n return Result.ok({ buffer, contentType: metadata.contentType });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return Result.fail(new FileNotFoundError(fileId));\n }\n return Result.fail(\n new FilePersistenceError(error instanceof Error ? error : new Error(String(error)))\n );\n }\n }\n}\n\nexport const GetFileContentsByIdUseCaseImplementation =\n GetFileContentsByIdUseCase.createImplementation({\n implementation: GetFileContentsByIdUseCaseImpl,\n dependencies: [MetadataReader]\n });\n"],"names":["GetFileContentsByIdUseCaseImpl","metadataReader","fileId","metadata","Result","FileNotFoundError","storagePath","String","process","filePath","buffer","fs","error","FilePersistenceError","Error","GetFileContentsByIdUseCaseImplementation","GetFileContentsByIdUseCase","MetadataReader"],"mappings":";;;;;AAUA,MAAMA;IAGF,YAAmBC,cAAwC,CAAE;QACzD,IAAI,CAAC,cAAc,GAAGA;IAC1B;IAEA,MAAa,QACTC,MAAc,EACiD;QAC/D,MAAMC,WAAW,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAACD;QAChD,IAAI,CAACC,UACD,OAAOC,OAAO,IAAI,CAAC,IAAIC,kBAAkBH;QAG7C,MAAMI,cAAcC,OAAOC,QAAQ,GAAG,CAAC,yBAAyB;QAEhE,IAAI;YACA,MAAMC,WAAW,GAAGH,YAAY,CAAC,EAAEH,SAAS,SAAS,EAAE;YACvD,MAAMO,SAAS,MAAMC,SAAAA,QAAW,CAACF;YACjC,OAAOL,OAAO,EAAE,CAAC;gBAAEM;gBAAQ,aAAaP,SAAS,WAAW;YAAC;QACjE,EAAE,OAAOS,OAAO;YACZ,IAAKA,AAAyC,aAAzCA,MAAgC,IAAI,EACrC,OAAOR,OAAO,IAAI,CAAC,IAAIC,kBAAkBH;YAE7C,OAAOE,OAAO,IAAI,CACd,IAAIS,qBAAqBD,iBAAiBE,QAAQF,QAAQ,IAAIE,MAAMP,OAAOK;QAEnF;IACJ;AACJ;AAEO,MAAMG,2CACTC,2BAA2B,oBAAoB,CAAC;IAC5C,gBAAgBhB;IAChB,cAAc;QAACiB;KAAe;AAClC"}
@@ -1,9 +1,9 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
- import { GetFileContentsByIdUseCase } from "./GetFileContentsByIdUseCase.js";
2
+ import { GetFileContentsByIdUseCaseImplementation } from "./GetFileContentsByIdUseCase.js";
3
3
  const GetFileContentsByIdFeature = createFeature({
4
4
  name: "FileManagerServer/GetFileContentsById",
5
5
  register (container) {
6
- container.register(GetFileContentsByIdUseCase);
6
+ container.register(GetFileContentsByIdUseCaseImplementation);
7
7
  }
8
8
  });
9
9
  export { GetFileContentsByIdFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/GetFileContentsById/feature.js","sources":["../../../src/features/GetFileContentsById/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFileContentsByIdUseCase } from \"./GetFileContentsByIdUseCase.js\";\n\nexport const GetFileContentsByIdFeature = createFeature({\n name: \"FileManagerServer/GetFileContentsById\",\n register(container) {\n container.register(GetFileContentsByIdUseCase);\n }\n});\n"],"names":["GetFileContentsByIdFeature","createFeature","container","GetFileContentsByIdUseCase"],"mappings":";;AAGO,MAAMA,6BAA6BC,cAAc;IACpD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
1
+ {"version":3,"file":"features/GetFileContentsById/feature.js","sources":["../../../src/features/GetFileContentsById/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFileContentsByIdUseCaseImplementation } from \"./GetFileContentsByIdUseCase.js\";\n\nexport const GetFileContentsByIdFeature = createFeature({\n name: \"FileManagerServer/GetFileContentsById\",\n register(container) {\n container.register(GetFileContentsByIdUseCaseImplementation);\n }\n});\n"],"names":["GetFileContentsByIdFeature","createFeature","container","GetFileContentsByIdUseCaseImplementation"],"mappings":";;AAGO,MAAMA,6BAA6BC,cAAc;IACpD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,15 +1,13 @@
1
1
  import { Result } from "@webiny/feature/api";
2
2
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
3
- import { GetFileContentsByKeyUseCase as GetFileContentsByKeyUseCaseAbstraction } from "@webiny/api-file-manager/features/file/GetFileContentsByKey/index.js";
3
+ import { GetFileContentsByKeyUseCase } from "@webiny/api-file-manager/features/file/GetFileContentsByKey/index.js";
4
4
  import type { FileContents } from "@webiny/api-file-manager/features/file/GetFileContentsById/index.js";
5
- import { FileManagerServerConfig } from "../../features/FileManagerServerConfig/abstractions.js";
6
- declare class GetFileContentsByKeyUseCaseImpl implements GetFileContentsByKeyUseCaseAbstraction.Interface {
5
+ declare class GetFileContentsByKeyUseCaseImpl implements GetFileContentsByKeyUseCase.Interface {
7
6
  private readonly tenantContext;
8
- private readonly config;
9
- constructor(tenantContext: TenantContext.Interface, config: FileManagerServerConfig.Interface);
10
- execute(key: string): Promise<Result<FileContents, GetFileContentsByKeyUseCaseAbstraction.Error>>;
7
+ constructor(tenantContext: TenantContext.Interface);
8
+ execute(key: string): Promise<Result<FileContents, GetFileContentsByKeyUseCase.Error>>;
11
9
  }
12
- export declare const GetFileContentsByKeyUseCase: typeof GetFileContentsByKeyUseCaseImpl & {
10
+ export declare const GetFileContentsByKeyUseCaseImplementation: typeof GetFileContentsByKeyUseCaseImpl & {
13
11
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-file-manager/features/file/GetFileContentsByKey/abstractions").IGetFileContentsByKeyUseCase>;
14
12
  };
15
13
  export {};
@@ -3,7 +3,6 @@ import { Result } from "@webiny/feature/api";
3
3
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
4
4
  import { GetFileContentsByKeyUseCase } from "@webiny/api-file-manager/features/file/GetFileContentsByKey/index.js";
5
5
  import { FileNotFoundError, FilePersistenceError } from "@webiny/api-file-manager/domain/file/errors.js";
6
- import { FileManagerServerConfig } from "../FileManagerServerConfig/abstractions.js";
7
6
  const CONTENT_TYPE_MAP = {
8
7
  jpg: "image/jpeg",
9
8
  jpeg: "image/jpeg",
@@ -38,14 +37,13 @@ function resolveContentType(key) {
38
37
  return CONTENT_TYPE_MAP[ext] ?? "application/octet-stream";
39
38
  }
40
39
  class GetFileContentsByKeyUseCaseImpl {
41
- constructor(tenantContext, config){
40
+ constructor(tenantContext){
42
41
  this.tenantContext = tenantContext;
43
- this.config = config;
44
42
  }
45
43
  async execute(key) {
46
44
  const tenant = this.tenantContext.getTenant();
47
45
  const bucketKey = `tenants/${tenant.id}/files/${key}`;
48
- const storagePath = this.config.storagePath;
46
+ const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);
49
47
  const filePath = `${storagePath}/${bucketKey}`;
50
48
  try {
51
49
  const buffer = await promises.readFile(filePath);
@@ -60,13 +58,12 @@ class GetFileContentsByKeyUseCaseImpl {
60
58
  }
61
59
  }
62
60
  }
63
- const GetFileContentsByKeyUseCase_GetFileContentsByKeyUseCase = GetFileContentsByKeyUseCase.createImplementation({
61
+ const GetFileContentsByKeyUseCaseImplementation = GetFileContentsByKeyUseCase.createImplementation({
64
62
  implementation: GetFileContentsByKeyUseCaseImpl,
65
63
  dependencies: [
66
- TenantContext,
67
- FileManagerServerConfig
64
+ TenantContext
68
65
  ]
69
66
  });
70
- export { GetFileContentsByKeyUseCase_GetFileContentsByKeyUseCase as GetFileContentsByKeyUseCase };
67
+ export { GetFileContentsByKeyUseCaseImplementation };
71
68
 
72
69
  //# sourceMappingURL=GetFileContentsByKeyUseCase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"features/GetFileContentsByKey/GetFileContentsByKeyUseCase.js","sources":["../../../src/features/GetFileContentsByKey/GetFileContentsByKeyUseCase.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport { Result } from \"@webiny/feature/api\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { GetFileContentsByKeyUseCase as GetFileContentsByKeyUseCaseAbstraction } from \"@webiny/api-file-manager/features/file/GetFileContentsByKey/index.js\";\nimport type { FileContents } from \"@webiny/api-file-manager/features/file/GetFileContentsById/index.js\";\nimport {\n FileNotFoundError,\n FilePersistenceError\n} from \"@webiny/api-file-manager/domain/file/errors.js\";\nimport { FileManagerServerConfig } from \"~/features/FileManagerServerConfig/abstractions.js\";\n\nconst CONTENT_TYPE_MAP: Record<string, string> = {\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n png: \"image/png\",\n gif: \"image/gif\",\n webp: \"image/webp\",\n svg: \"image/svg+xml\",\n ico: \"image/x-icon\",\n bmp: \"image/bmp\",\n tiff: \"image/tiff\",\n tif: \"image/tiff\",\n pdf: \"application/pdf\",\n json: \"application/json\",\n xml: \"application/xml\",\n zip: \"application/zip\",\n gz: \"application/gzip\",\n txt: \"text/plain\",\n html: \"text/html\",\n htm: \"text/html\",\n css: \"text/css\",\n js: \"application/javascript\",\n ts: \"application/typescript\",\n mp4: \"video/mp4\",\n webm: \"video/webm\",\n mp3: \"audio/mpeg\",\n wav: \"audio/wav\",\n ogg: \"audio/ogg\"\n};\n\nfunction resolveContentType(key: string): string {\n const ext = key.split(\".\").pop()?.toLowerCase();\n if (!ext) {\n return \"application/octet-stream\";\n }\n return CONTENT_TYPE_MAP[ext] ?? \"application/octet-stream\";\n}\n\nclass GetFileContentsByKeyUseCaseImpl implements GetFileContentsByKeyUseCaseAbstraction.Interface {\n constructor(\n private readonly tenantContext: TenantContext.Interface,\n private readonly config: FileManagerServerConfig.Interface\n ) {}\n\n async execute(\n key: string\n ): Promise<Result<FileContents, GetFileContentsByKeyUseCaseAbstraction.Error>> {\n const tenant = this.tenantContext.getTenant();\n const bucketKey = `tenants/${tenant.id}/files/${key}`;\n const storagePath = this.config.storagePath;\n const filePath = `${storagePath}/${bucketKey}`;\n\n try {\n const buffer = await fs.readFile(filePath);\n const contentType = resolveContentType(key);\n return Result.ok({ buffer, contentType });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return Result.fail(new FileNotFoundError(key));\n }\n return Result.fail(\n new FilePersistenceError(error instanceof Error ? error : new Error(String(error)))\n );\n }\n }\n}\n\nexport const GetFileContentsByKeyUseCase =\n GetFileContentsByKeyUseCaseAbstraction.createImplementation({\n implementation: GetFileContentsByKeyUseCaseImpl,\n dependencies: [TenantContext, FileManagerServerConfig]\n });\n"],"names":["CONTENT_TYPE_MAP","resolveContentType","key","ext","GetFileContentsByKeyUseCaseImpl","tenantContext","config","tenant","bucketKey","storagePath","filePath","buffer","fs","contentType","Result","error","FileNotFoundError","FilePersistenceError","Error","String","GetFileContentsByKeyUseCase","GetFileContentsByKeyUseCaseAbstraction","TenantContext","FileManagerServerConfig"],"mappings":";;;;;;AAWA,MAAMA,mBAA2C;IAC7C,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,IAAI;IACJ,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;AACT;AAEA,SAASC,mBAAmBC,GAAW;IACnC,MAAMC,MAAMD,IAAI,KAAK,CAAC,KAAK,GAAG,IAAI;IAClC,IAAI,CAACC,KACD,OAAO;IAEX,OAAOH,gBAAgB,CAACG,IAAI,IAAI;AACpC;AAEA,MAAMC;IACF,YACqBC,aAAsC,EACtCC,MAAyC,CAC5D;aAFmBD,aAAa,GAAbA;aACAC,MAAM,GAANA;IAClB;IAEH,MAAM,QACFJ,GAAW,EACgE;QAC3E,MAAMK,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS;QAC3C,MAAMC,YAAY,CAAC,QAAQ,EAAED,OAAO,EAAE,CAAC,OAAO,EAAEL,KAAK;QACrD,MAAMO,cAAc,IAAI,CAAC,MAAM,CAAC,WAAW;QAC3C,MAAMC,WAAW,GAAGD,YAAY,CAAC,EAAED,WAAW;QAE9C,IAAI;YACA,MAAMG,SAAS,MAAMC,SAAAA,QAAW,CAACF;YACjC,MAAMG,cAAcZ,mBAAmBC;YACvC,OAAOY,OAAO,EAAE,CAAC;gBAAEH;gBAAQE;YAAY;QAC3C,EAAE,OAAOE,OAAO;YACZ,IAAKA,AAAyC,aAAzCA,MAAgC,IAAI,EACrC,OAAOD,OAAO,IAAI,CAAC,IAAIE,kBAAkBd;YAE7C,OAAOY,OAAO,IAAI,CACd,IAAIG,qBAAqBF,iBAAiBG,QAAQH,QAAQ,IAAIG,MAAMC,OAAOJ;QAEnF;IACJ;AACJ;AAEO,MAAMK,0DACTC,4BAAAA,oBAA2D,CAAC;IACxD,gBAAgBjB;IAChB,cAAc;QAACkB;QAAeC;KAAwB;AAC1D"}
1
+ {"version":3,"file":"features/GetFileContentsByKey/GetFileContentsByKeyUseCase.js","sources":["../../../src/features/GetFileContentsByKey/GetFileContentsByKeyUseCase.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport { Result } from \"@webiny/feature/api\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { GetFileContentsByKeyUseCase } from \"@webiny/api-file-manager/features/file/GetFileContentsByKey/index.js\";\nimport type { FileContents } from \"@webiny/api-file-manager/features/file/GetFileContentsById/index.js\";\nimport {\n FileNotFoundError,\n FilePersistenceError\n} from \"@webiny/api-file-manager/domain/file/errors.js\";\n\nconst CONTENT_TYPE_MAP: Record<string, string> = {\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n png: \"image/png\",\n gif: \"image/gif\",\n webp: \"image/webp\",\n svg: \"image/svg+xml\",\n ico: \"image/x-icon\",\n bmp: \"image/bmp\",\n tiff: \"image/tiff\",\n tif: \"image/tiff\",\n pdf: \"application/pdf\",\n json: \"application/json\",\n xml: \"application/xml\",\n zip: \"application/zip\",\n gz: \"application/gzip\",\n txt: \"text/plain\",\n html: \"text/html\",\n htm: \"text/html\",\n css: \"text/css\",\n js: \"application/javascript\",\n ts: \"application/typescript\",\n mp4: \"video/mp4\",\n webm: \"video/webm\",\n mp3: \"audio/mpeg\",\n wav: \"audio/wav\",\n ogg: \"audio/ogg\"\n};\n\nfunction resolveContentType(key: string): string {\n const ext = key.split(\".\").pop()?.toLowerCase();\n if (!ext) {\n return \"application/octet-stream\";\n }\n return CONTENT_TYPE_MAP[ext] ?? \"application/octet-stream\";\n}\n\nclass GetFileContentsByKeyUseCaseImpl implements GetFileContentsByKeyUseCase.Interface {\n constructor(private readonly tenantContext: TenantContext.Interface) {}\n\n async execute(key: string): Promise<Result<FileContents, GetFileContentsByKeyUseCase.Error>> {\n const tenant = this.tenantContext.getTenant();\n const bucketKey = `tenants/${tenant.id}/files/${key}`;\n const storagePath = String(process.env.WEBINY_LOCAL_STORAGE_PATH);\n const filePath = `${storagePath}/${bucketKey}`;\n\n try {\n const buffer = await fs.readFile(filePath);\n const contentType = resolveContentType(key);\n return Result.ok({ buffer, contentType });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return Result.fail(new FileNotFoundError(key));\n }\n return Result.fail(\n new FilePersistenceError(error instanceof Error ? error : new Error(String(error)))\n );\n }\n }\n}\n\nexport const GetFileContentsByKeyUseCaseImplementation =\n GetFileContentsByKeyUseCase.createImplementation({\n implementation: GetFileContentsByKeyUseCaseImpl,\n dependencies: [TenantContext]\n });\n"],"names":["CONTENT_TYPE_MAP","resolveContentType","key","ext","GetFileContentsByKeyUseCaseImpl","tenantContext","tenant","bucketKey","storagePath","String","process","filePath","buffer","fs","contentType","Result","error","FileNotFoundError","FilePersistenceError","Error","GetFileContentsByKeyUseCaseImplementation","GetFileContentsByKeyUseCase","TenantContext"],"mappings":";;;;;AAUA,MAAMA,mBAA2C;IAC7C,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,IAAI;IACJ,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;AACT;AAEA,SAASC,mBAAmBC,GAAW;IACnC,MAAMC,MAAMD,IAAI,KAAK,CAAC,KAAK,GAAG,IAAI;IAClC,IAAI,CAACC,KACD,OAAO;IAEX,OAAOH,gBAAgB,CAACG,IAAI,IAAI;AACpC;AAEA,MAAMC;IACF,YAA6BC,aAAsC,CAAE;aAAxCA,aAAa,GAAbA;IAAyC;IAEtE,MAAM,QAAQH,GAAW,EAAoE;QACzF,MAAMI,SAAS,IAAI,CAAC,aAAa,CAAC,SAAS;QAC3C,MAAMC,YAAY,CAAC,QAAQ,EAAED,OAAO,EAAE,CAAC,OAAO,EAAEJ,KAAK;QACrD,MAAMM,cAAcC,OAAOC,QAAQ,GAAG,CAAC,yBAAyB;QAChE,MAAMC,WAAW,GAAGH,YAAY,CAAC,EAAED,WAAW;QAE9C,IAAI;YACA,MAAMK,SAAS,MAAMC,SAAAA,QAAW,CAACF;YACjC,MAAMG,cAAcb,mBAAmBC;YACvC,OAAOa,OAAO,EAAE,CAAC;gBAAEH;gBAAQE;YAAY;QAC3C,EAAE,OAAOE,OAAO;YACZ,IAAKA,AAAyC,aAAzCA,MAAgC,IAAI,EACrC,OAAOD,OAAO,IAAI,CAAC,IAAIE,kBAAkBf;YAE7C,OAAOa,OAAO,IAAI,CACd,IAAIG,qBAAqBF,iBAAiBG,QAAQH,QAAQ,IAAIG,MAAMV,OAAOO;QAEnF;IACJ;AACJ;AAEO,MAAMI,4CACTC,4BAA4B,oBAAoB,CAAC;IAC7C,gBAAgBjB;IAChB,cAAc;QAACkB;KAAc;AACjC"}
@@ -1,9 +1,9 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
- import { GetFileContentsByKeyUseCase } from "./GetFileContentsByKeyUseCase.js";
2
+ import { GetFileContentsByKeyUseCaseImplementation } from "./GetFileContentsByKeyUseCase.js";
3
3
  const GetFileContentsByKeyFeature = createFeature({
4
4
  name: "FileManagerServer/GetFileContentsByKey",
5
5
  register (container) {
6
- container.register(GetFileContentsByKeyUseCase);
6
+ container.register(GetFileContentsByKeyUseCaseImplementation);
7
7
  }
8
8
  });
9
9
  export { GetFileContentsByKeyFeature };
@@ -1 +1 @@
1
- {"version":3,"file":"features/GetFileContentsByKey/feature.js","sources":["../../../src/features/GetFileContentsByKey/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFileContentsByKeyUseCase } from \"./GetFileContentsByKeyUseCase.js\";\n\nexport const GetFileContentsByKeyFeature = createFeature({\n name: \"FileManagerServer/GetFileContentsByKey\",\n register(container) {\n container.register(GetFileContentsByKeyUseCase);\n }\n});\n"],"names":["GetFileContentsByKeyFeature","createFeature","container","GetFileContentsByKeyUseCase"],"mappings":";;AAGO,MAAMA,8BAA8BC,cAAc;IACrD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
1
+ {"version":3,"file":"features/GetFileContentsByKey/feature.js","sources":["../../../src/features/GetFileContentsByKey/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { GetFileContentsByKeyUseCaseImplementation } from \"./GetFileContentsByKeyUseCase.js\";\n\nexport const GetFileContentsByKeyFeature = createFeature({\n name: \"FileManagerServer/GetFileContentsByKey\",\n register(container) {\n container.register(GetFileContentsByKeyUseCaseImplementation);\n }\n});\n"],"names":["GetFileContentsByKeyFeature","createFeature","container","GetFileContentsByKeyUseCaseImplementation"],"mappings":";;AAGO,MAAMA,8BAA8BC,cAAc;IACrD,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,16 +1,16 @@
1
1
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
2
- import { GetUploadPayloadUseCase as GetUploadPayloadUseCaseAbstraction } from "@webiny/api-file-manager/features/upload/GetUploadPayload/index.js";
2
+ import { Request } from "@webiny/handler/abstractions/Request.js";
3
+ import { GetUploadPayloadUseCase } from "@webiny/api-file-manager/features/upload/GetUploadPayload/index.js";
3
4
  import type { FileData } from "@webiny/api-file-manager/features/upload/types.js";
4
5
  import type { UploadPayloadResponse } from "@webiny/api-file-manager/features/upload/types.js";
5
6
  import type { FileManagerSettings } from "@webiny/api-file-manager/domain/settings/types.js";
6
- import { FileManagerServerConfig } from "../../features/FileManagerServerConfig/abstractions.js";
7
- declare class GetUploadPayloadUseCaseImpl implements GetUploadPayloadUseCaseAbstraction.Interface {
7
+ declare class GetUploadPayloadUseCaseImpl implements GetUploadPayloadUseCase.Interface {
8
8
  private readonly tenantContext;
9
- private readonly config;
10
- constructor(tenantContext: TenantContext.Interface, config: FileManagerServerConfig.Interface);
9
+ private readonly request;
10
+ constructor(tenantContext: TenantContext.Interface, request: Request.Interface);
11
11
  execute(file: FileData, settings: FileManagerSettings): Promise<UploadPayloadResponse>;
12
12
  }
13
- export declare const GetUploadPayloadUseCase: typeof GetUploadPayloadUseCaseImpl & {
13
+ export declare const GetUploadPayloadUseCaseImplementation: typeof GetUploadPayloadUseCaseImpl & {
14
14
  __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-file-manager/features/upload/GetUploadPayload/abstractions").IGetUploadPayloadUseCase>;
15
15
  };
16
16
  export {};
@@ -1,8 +1,9 @@
1
1
  import { validation } from "@webiny/validation";
2
2
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
3
+ import { Request } from "@webiny/handler/abstractions/Request.js";
3
4
  import { GetUploadPayloadUseCase } from "@webiny/api-file-manager/features/upload/GetUploadPayload/index.js";
4
5
  import { createUploadToken } from "../../utils/uploadToken.js";
5
- import { FileManagerServerConfig } from "../FileManagerServerConfig/abstractions.js";
6
+ import { resolveServerUrl } from "../../utils/resolveServerUrl.js";
6
7
  const UPLOAD_MAX_FILE_SIZE_DEFAULT = 1099511627776;
7
8
  const sanitizeFileSizeValue = (value, defaultValue)=>{
8
9
  try {
@@ -13,16 +14,16 @@ const sanitizeFileSizeValue = (value, defaultValue)=>{
13
14
  }
14
15
  };
15
16
  class GetUploadPayloadUseCaseImpl {
16
- constructor(tenantContext, config){
17
+ constructor(tenantContext, request){
17
18
  this.tenantContext = tenantContext;
18
- this.config = config;
19
+ this.request = request;
19
20
  }
20
21
  async execute(file, settings) {
21
22
  const uploadMinFileSize = sanitizeFileSizeValue(settings.uploadMinFileSize, 0);
22
23
  const uploadMaxFileSize = sanitizeFileSizeValue(settings.uploadMaxFileSize, UPLOAD_MAX_FILE_SIZE_DEFAULT);
23
24
  const tenant = this.tenantContext.getTenant();
24
25
  const storageKey = `tenants/${tenant.id}/files/${file.key}`;
25
- const secret = this.config.uploadSecret;
26
+ const secret = process.env.WEBINY_UPLOAD_SECRET;
26
27
  const expiresAt = Date.now() + 60000;
27
28
  const token = createUploadToken({
28
29
  key: storageKey,
@@ -31,7 +32,7 @@ class GetUploadPayloadUseCaseImpl {
31
32
  uploadMinFileSize,
32
33
  uploadMaxFileSize
33
34
  }, secret);
34
- const serverUrl = this.config.apiUrl;
35
+ const serverUrl = await resolveServerUrl(this.request);
35
36
  const data = {
36
37
  url: `${serverUrl}/webiny-file-upload`,
37
38
  fields: {
@@ -45,13 +46,13 @@ class GetUploadPayloadUseCaseImpl {
45
46
  };
46
47
  }
47
48
  }
48
- const GetUploadPayloadUseCase_GetUploadPayloadUseCase = GetUploadPayloadUseCase.createImplementation({
49
+ const GetUploadPayloadUseCaseImplementation = GetUploadPayloadUseCase.createImplementation({
49
50
  implementation: GetUploadPayloadUseCaseImpl,
50
51
  dependencies: [
51
52
  TenantContext,
52
- FileManagerServerConfig
53
+ Request
53
54
  ]
54
55
  });
55
- export { GetUploadPayloadUseCase_GetUploadPayloadUseCase as GetUploadPayloadUseCase };
56
+ export { GetUploadPayloadUseCaseImplementation };
56
57
 
57
58
  //# sourceMappingURL=GetUploadPayloadUseCase.js.map