@punks/backend-entity-manager 0.0.482 → 0.0.483
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 +18 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/buckets.d.ts +5 -0
- package/dist/cjs/types/platforms/nest/plugins/buckets/aws-s3/provider/bucket.d.ts +2 -1
- package/dist/cjs/types/platforms/nest/plugins/buckets/testing/mock.d.ts +2 -1
- package/dist/esm/index.js +18 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/buckets.d.ts +5 -0
- package/dist/esm/types/platforms/nest/plugins/buckets/aws-s3/provider/bucket.d.ts +2 -1
- package/dist/esm/types/platforms/nest/plugins/buckets/testing/mock.d.ts +2 -1
- package/dist/index.d.ts +8 -1
- package/package.json +1 -1
|
@@ -29,6 +29,10 @@ export type BucketFolderExistsInput = {
|
|
|
29
29
|
bucket: string;
|
|
30
30
|
path: string;
|
|
31
31
|
};
|
|
32
|
+
export type BucketFileExistsInput = {
|
|
33
|
+
bucket: string;
|
|
34
|
+
filePath: string;
|
|
35
|
+
};
|
|
32
36
|
export type BucketFileDownloadInput = {
|
|
33
37
|
bucket: string;
|
|
34
38
|
filePath: string;
|
|
@@ -64,6 +68,7 @@ export interface IBucketProvider {
|
|
|
64
68
|
folderList(input: BucketFolderListInput): Promise<BucketFolderListResult>;
|
|
65
69
|
folderEnsure(input: BucketFolderEnsureInput): Promise<void>;
|
|
66
70
|
folderExists(input: BucketFolderExistsInput): Promise<boolean>;
|
|
71
|
+
fileExists(input: BucketFileExistsInput): Promise<boolean>;
|
|
67
72
|
fileDownload(input: BucketFileDownloadInput): Promise<Buffer>;
|
|
68
73
|
filePublicUrlCreate(input: BucketFilePublicUrlCreateInput): Promise<string>;
|
|
69
74
|
fileUpload(input: BucketFileUploadInput): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { BucketFileCopyInput, BucketFileDeleteInput, BucketFileDownloadInput, BucketFileMoveInput, BucketFilePublicUrlCreateInput, BucketFileUploadInput, BucketFolderEnsureInput, BucketFolderExistsInput, BucketFolderListInput, BucketFolderListResult, IBucketProvider } from "../../../../../../abstractions/buckets";
|
|
2
|
+
import { BucketFileCopyInput, BucketFileDeleteInput, BucketFileDownloadInput, BucketFileExistsInput, BucketFileMoveInput, BucketFilePublicUrlCreateInput, BucketFileUploadInput, BucketFolderEnsureInput, BucketFolderExistsInput, BucketFolderListInput, BucketFolderListResult, IBucketProvider } from "../../../../../../abstractions/buckets";
|
|
3
3
|
export declare class AwsS3BucketProvider implements IBucketProvider {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor();
|
|
@@ -8,6 +8,7 @@ export declare class AwsS3BucketProvider implements IBucketProvider {
|
|
|
8
8
|
folderCreate(input: BucketFolderEnsureInput): Promise<void>;
|
|
9
9
|
folderExists(input: BucketFolderExistsInput): Promise<boolean>;
|
|
10
10
|
fileDownload(input: BucketFileDownloadInput): Promise<Buffer>;
|
|
11
|
+
fileExists(input: BucketFileExistsInput): Promise<boolean>;
|
|
11
12
|
filePublicUrlCreate(input: BucketFilePublicUrlCreateInput): Promise<string>;
|
|
12
13
|
fileUpload(input: BucketFileUploadInput): Promise<void>;
|
|
13
14
|
fileDelete(input: BucketFileDeleteInput): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { FileProviderDownloadData, FileProviderDownloadUrl, FileProviderReference, FileProviderUploadData, IFileProvider } from "../../../../../abstractions";
|
|
3
|
-
import { BucketFileDeleteInput, BucketFileDownloadInput, BucketFilePublicUrlCreateInput, BucketFileUploadInput, BucketFolderEnsureInput, BucketFolderExistsInput, BucketFolderListInput, BucketFolderListResult, IBucketProvider } from "../../../../../abstractions/buckets";
|
|
3
|
+
import { BucketFileDeleteInput, BucketFileDownloadInput, BucketFileExistsInput, BucketFilePublicUrlCreateInput, BucketFileUploadInput, BucketFolderEnsureInput, BucketFolderExistsInput, BucketFolderListInput, BucketFolderListResult, IBucketProvider } from "../../../../../abstractions/buckets";
|
|
4
4
|
export declare class InMemoryFileProvider implements IFileProvider {
|
|
5
5
|
private readonly provider;
|
|
6
6
|
constructor();
|
|
@@ -17,6 +17,7 @@ export declare class InMemoryBucketProvider implements IBucketProvider {
|
|
|
17
17
|
folderList(input: BucketFolderListInput): Promise<BucketFolderListResult>;
|
|
18
18
|
folderEnsure(input: BucketFolderEnsureInput): Promise<void>;
|
|
19
19
|
folderExists(input: BucketFolderExistsInput): Promise<boolean>;
|
|
20
|
+
fileExists(input: BucketFileExistsInput): Promise<boolean>;
|
|
20
21
|
fileDownload(input: BucketFileDownloadInput): Promise<Buffer>;
|
|
21
22
|
filePublicUrlCreate(input: BucketFilePublicUrlCreateInput): Promise<string>;
|
|
22
23
|
fileUpload(input: BucketFileUploadInput): Promise<void>;
|
package/dist/esm/index.js
CHANGED
|
@@ -35772,6 +35772,18 @@ let AwsS3BucketProvider = class AwsS3BucketProvider {
|
|
|
35772
35772
|
throw new AwsS3BucketError(`AWS BUCKET | downloadFile | ${input.bucket} | ${input.filePath} | Error -> ${e.message}`);
|
|
35773
35773
|
}
|
|
35774
35774
|
}
|
|
35775
|
+
async fileExists(input) {
|
|
35776
|
+
try {
|
|
35777
|
+
const result = await this.client.send(new GetObjectCommand({
|
|
35778
|
+
Bucket: input.bucket,
|
|
35779
|
+
Key: input.filePath,
|
|
35780
|
+
}));
|
|
35781
|
+
return (result.ContentLength ?? 0) > 0;
|
|
35782
|
+
}
|
|
35783
|
+
catch (e) {
|
|
35784
|
+
throw new AwsS3BucketError(`AwsS3Bucket | fileExists | Error -> ${e.message}`);
|
|
35785
|
+
}
|
|
35786
|
+
}
|
|
35775
35787
|
async filePublicUrlCreate(input) {
|
|
35776
35788
|
try {
|
|
35777
35789
|
return await getSignedUrl(this.client, new GetObjectCommand({
|
|
@@ -36011,6 +36023,12 @@ let InMemoryBucketProvider = class InMemoryBucketProvider {
|
|
|
36011
36023
|
const folderKey = `${input.bucket}/${input.path}`;
|
|
36012
36024
|
return !!this.inMemoryFolders[folderKey];
|
|
36013
36025
|
}
|
|
36026
|
+
async fileExists(input) {
|
|
36027
|
+
// Implement fileExists logic here
|
|
36028
|
+
// Check if the file exists in inMemoryStorage
|
|
36029
|
+
const fileKey = `${input.bucket}/${input.filePath}`;
|
|
36030
|
+
return !!this.inMemoryStorage[fileKey];
|
|
36031
|
+
}
|
|
36014
36032
|
async fileDownload(input) {
|
|
36015
36033
|
// Implement fileDownload logic here
|
|
36016
36034
|
// Retrieve the file content from inMemoryStorage based on the filePath
|