@plyaz/core 1.13.2 → 1.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -17353,9 +17353,18 @@ var BackendFilesDomainService = class _BackendFilesDomainService extends BaseBac
17353
17353
  ERROR_CODES.CORE_PROVIDER_INITIALIZATION_FAILED
17354
17354
  );
17355
17355
  }
17356
+ const fileRecord = await this.getById(params.fileId);
17357
+ if (!fileRecord) {
17358
+ throw new CorePackageError(
17359
+ `File not found in database: ${params.fileId}`,
17360
+ ERROR_CODES.CORE_OPERATION_FAILED,
17361
+ { context: { fileId: params.fileId, reason: "file_not_found" } }
17362
+ );
17363
+ }
17356
17364
  const storage = this.storageService.getStorage();
17357
17365
  const result = await storage.downloadFile({
17358
- fileId: params.fileId
17366
+ fileId: params.fileId,
17367
+ bucket: fileRecord.bucket
17359
17368
  });
17360
17369
  const response = {
17361
17370
  buffer: result?.file?.toString("base64") ?? "",
@@ -17396,9 +17405,18 @@ var BackendFilesDomainService = class _BackendFilesDomainService extends BaseBac
17396
17405
  ERROR_CODES.CORE_PROVIDER_INITIALIZATION_FAILED
17397
17406
  );
17398
17407
  }
17408
+ const fileRecord = await this.getById(params.fileId);
17409
+ if (!fileRecord) {
17410
+ throw new CorePackageError(
17411
+ `File not found in database: ${params.fileId}`,
17412
+ ERROR_CODES.CORE_OPERATION_FAILED,
17413
+ { context: { fileId: params.fileId, reason: "file_not_found" } }
17414
+ );
17415
+ }
17399
17416
  const storage = this.storageService.getStorage();
17400
17417
  const result = await storage.getSignedUrl({
17401
17418
  fileId: params.fileId,
17419
+ bucket: fileRecord.bucket,
17402
17420
  expiresIn: params.expiresIn ?? DOWNLOAD_CONFIG.DEFAULT_SIGNED_URL_EXPIRY_SECONDS,
17403
17421
  operation: "get"
17404
17422
  });