@punks/backend-entity-manager 0.0.482 → 0.0.484

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/cjs/index.js CHANGED
@@ -35772,6 +35772,9 @@ exports.AwsS3BucketProvider = class AwsS3BucketProvider {
35772
35772
  return (result.ContentLength ?? 0) > 0;
35773
35773
  }
35774
35774
  catch (e) {
35775
+ if (e.Code === "NoSuchKey") {
35776
+ return false;
35777
+ }
35775
35778
  throw new AwsS3BucketError(`AwsS3Bucket | folderExists | Error -> ${e.message}`);
35776
35779
  }
35777
35780
  }
@@ -35787,6 +35790,21 @@ exports.AwsS3BucketProvider = class AwsS3BucketProvider {
35787
35790
  throw new AwsS3BucketError(`AWS BUCKET | downloadFile | ${input.bucket} | ${input.filePath} | Error -> ${e.message}`);
35788
35791
  }
35789
35792
  }
35793
+ async fileExists(input) {
35794
+ try {
35795
+ const result = await this.client.send(new clientS3.GetObjectCommand({
35796
+ Bucket: input.bucket,
35797
+ Key: input.filePath,
35798
+ }));
35799
+ return (result.ContentLength ?? 0) > 0;
35800
+ }
35801
+ catch (e) {
35802
+ if (e.Code === "NoSuchKey") {
35803
+ return false;
35804
+ }
35805
+ throw new AwsS3BucketError(`AwsS3Bucket | fileExists | Error -> ${e.message}`);
35806
+ }
35807
+ }
35790
35808
  async filePublicUrlCreate(input) {
35791
35809
  try {
35792
35810
  return await s3RequestPresigner.getSignedUrl(this.client, new clientS3.GetObjectCommand({
@@ -36026,6 +36044,12 @@ exports.InMemoryBucketProvider = class InMemoryBucketProvider {
36026
36044
  const folderKey = `${input.bucket}/${input.path}`;
36027
36045
  return !!this.inMemoryFolders[folderKey];
36028
36046
  }
36047
+ async fileExists(input) {
36048
+ // Implement fileExists logic here
36049
+ // Check if the file exists in inMemoryStorage
36050
+ const fileKey = `${input.bucket}/${input.filePath}`;
36051
+ return !!this.inMemoryStorage[fileKey];
36052
+ }
36029
36053
  async fileDownload(input) {
36030
36054
  // Implement fileDownload logic here
36031
36055
  // Retrieve the file content from inMemoryStorage based on the filePath