@tc-libs/storage 0.5.0 → 0.9.0

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 (37) hide show
  1. package/package.json +2 -2
  2. package/src/constants/acl.enum.d.ts +9 -0
  3. package/src/constants/acl.enum.js +14 -0
  4. package/src/constants/acl.enum.js.map +1 -0
  5. package/src/index.d.ts +6 -2
  6. package/src/index.js +6 -2
  7. package/src/index.js.map +1 -1
  8. package/src/interface/istorage.service.d.ts +22 -0
  9. package/src/interface/istorage.service.js +3 -0
  10. package/src/interface/istorage.service.js.map +1 -0
  11. package/src/serializations/storage.multipart.serialization.d.ts +11 -0
  12. package/src/serializations/storage.multipart.serialization.js +66 -0
  13. package/src/serializations/storage.multipart.serialization.js.map +1 -0
  14. package/src/serializations/storage.serialization.d.ts +14 -0
  15. package/src/serializations/storage.serialization.js +87 -0
  16. package/src/serializations/storage.serialization.js.map +1 -0
  17. package/src/services/aws-s3/storage.aws-s3.service.d.ts +33 -0
  18. package/src/services/aws-s3/storage.aws-s3.service.js +386 -0
  19. package/src/services/aws-s3/storage.aws-s3.service.js.map +1 -0
  20. package/src/services/azure-blob/storage.azure-blob.service.d.ts +0 -0
  21. package/src/services/azure-blob/storage.azure-blob.service.js +2 -0
  22. package/src/services/azure-blob/storage.azure-blob.service.js.map +1 -0
  23. package/src/storage.module.d.ts +6 -0
  24. package/src/storage.module.js +37 -0
  25. package/src/storage.module.js.map +1 -0
  26. package/src/storage.module.options.d.ts +18 -0
  27. package/src/storage.module.options.js +5 -0
  28. package/src/storage.module.options.js.map +1 -0
  29. package/src/storage.types.d.ts +18 -0
  30. package/src/storage.types.js +3 -0
  31. package/src/storage.types.js.map +1 -0
  32. package/src/lib/storage.module.d.ts +0 -2
  33. package/src/lib/storage.module.js +0 -18
  34. package/src/lib/storage.module.js.map +0 -1
  35. package/src/lib/storage.service.d.ts +0 -3
  36. package/src/lib/storage.service.js +0 -16
  37. package/src/lib/storage.service.js.map +0 -1
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@tc-libs/storage",
3
- "version": "0.5.0",
3
+ "version": "0.9.0",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "@nestjs/common": "^10.0.2",
7
- "@tc-libs/helper": "0.5.0",
7
+ "@tc-libs/helper": "0.9.0",
8
8
  "jsonc-eslint-parser": "2.4.0"
9
9
  },
10
10
  "type": "commonjs",
@@ -0,0 +1,9 @@
1
+ export declare enum ACL {
2
+ authenticated_read = "authenticated-read",
3
+ aws_exec_read = "aws-exec-read",
4
+ bucket_owner_full_control = "bucket-owner-full-control",
5
+ bucket_owner_read = "bucket-owner-read",
6
+ private = "private",
7
+ public_read = "public-read",
8
+ public_read_write = "public-read-write"
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ACL = void 0;
4
+ var ACL;
5
+ (function (ACL) {
6
+ ACL["authenticated_read"] = "authenticated-read";
7
+ ACL["aws_exec_read"] = "aws-exec-read";
8
+ ACL["bucket_owner_full_control"] = "bucket-owner-full-control";
9
+ ACL["bucket_owner_read"] = "bucket-owner-read";
10
+ ACL["private"] = "private";
11
+ ACL["public_read"] = "public-read";
12
+ ACL["public_read_write"] = "public-read-write";
13
+ })(ACL || (exports.ACL = ACL = {}));
14
+ //# sourceMappingURL=acl.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acl.enum.js","sourceRoot":"","sources":["../../../../../packages/storage/src/constants/acl.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,GAQX;AARD,WAAY,GAAG;IACb,gDAAyC,CAAA;IACzC,sCAA+B,CAAA;IAC/B,8DAAuD,CAAA;IACvD,8CAAuC,CAAA;IACvC,0BAAmB,CAAA;IACnB,kCAA2B,CAAA;IAC3B,8CAAuC,CAAA;AACzC,CAAC,EARW,GAAG,mBAAH,GAAG,QAQd"}
package/src/index.d.ts CHANGED
@@ -1,2 +1,6 @@
1
- export * from './lib/storage.module';
2
- export * from './lib/storage.service';
1
+ export * from './serializations/storage.multipart.serialization';
2
+ export * from './serializations/storage.serialization';
3
+ export * from './storage.module';
4
+ export * from './storage.types';
5
+ export * from './services/aws-s3/storage.aws-s3.service';
6
+ export * from './constants/acl.enum';
package/src/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./lib/storage.module"), exports);
5
- tslib_1.__exportStar(require("./lib/storage.service"), exports);
4
+ tslib_1.__exportStar(require("./serializations/storage.multipart.serialization"), exports);
5
+ tslib_1.__exportStar(require("./serializations/storage.serialization"), exports);
6
+ tslib_1.__exportStar(require("./storage.module"), exports);
7
+ tslib_1.__exportStar(require("./storage.types"), exports);
8
+ tslib_1.__exportStar(require("./services/aws-s3/storage.aws-s3.service"), exports);
9
+ tslib_1.__exportStar(require("./constants/acl.enum"), exports);
6
10
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/storage/src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,gEAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/storage/src/index.ts"],"names":[],"mappings":";;;AAAA,2FAAiE;AACjE,iFAAuD;AACvD,2DAAiC;AACjC,0DAAgC;AAChC,mFAAyD;AACzD,+DAAqC"}
@@ -0,0 +1,22 @@
1
+ import { Readable } from 'stream';
2
+ import { StorageMultipartPartsSerialization, StorageMultipartSerialization } from '../serializations/storage.multipart.serialization';
3
+ import { StorageReadBaseOptions, StorageReadOptions, StorageUploadItemOptions, StorageWriteBaseOptions } from '../storage.types';
4
+ import { CompletedPart, UploadPartRequest } from '@aws-sdk/client-s3';
5
+ import { StorageFileResponseSerialization, StorageFileSerialization } from '../serializations/storage.serialization';
6
+ export interface IStorageService {
7
+ provider: string;
8
+ checkConnection(options?: StorageReadBaseOptions): Promise<any>;
9
+ listContainers(): Promise<string[]>;
10
+ listFileWithPrefix(prefix: string, options?: StorageReadOptions): Promise<StorageFileResponseSerialization>;
11
+ listAllFileWithPrefix(prefix: string, options?: StorageReadBaseOptions): Promise<StorageFileResponseSerialization>;
12
+ downloadFile(filename: string, path?: string, options?: StorageReadOptions): Promise<Readable | ReadableStream<any> | Blob | undefined>;
13
+ delete(filename: string, path?: string, options?: StorageWriteBaseOptions): Promise<boolean>;
14
+ deleteMany(paths: string[], options?: StorageWriteBaseOptions): Promise<any>;
15
+ deleteFolder(dir: string, options?: StorageWriteBaseOptions): Promise<void>;
16
+ createMultiPart(filename: string, options?: StorageUploadItemOptions): Promise<StorageMultipartSerialization>;
17
+ uploadItem(filename: string, content: string | Uint8Array | Buffer | Readable | ReadableStream | Blob, options?: StorageUploadItemOptions): Promise<StorageFileSerialization>;
18
+ uploadPart(path: string, content: UploadPartRequest['Body'] | string | Uint8Array | Buffer, uploadId: string, partNumber: number, options?: StorageWriteBaseOptions): Promise<StorageMultipartPartsSerialization>;
19
+ completeMultipart(path: string, uploadId: string, parts: CompletedPart[], options?: StorageWriteBaseOptions): Promise<void>;
20
+ abortMultipart(path: string, uploadId: string, options?: StorageWriteBaseOptions): Promise<void>;
21
+ getSignedUrl(filename: string, path?: string, options?: StorageReadOptions): Promise<string>;
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=istorage.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"istorage.service.js","sourceRoot":"","sources":["../../../../../packages/storage/src/interface/istorage.service.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { StorageFileSerialization } from './storage.serialization';
2
+ export declare class StorageMultipartPartsSerialization {
3
+ ETag: string;
4
+ PartNumber: number;
5
+ }
6
+ export declare class StorageMultipartSerialization extends StorageFileSerialization {
7
+ uploadId: string;
8
+ partNumber?: number;
9
+ maxPartNumber?: number;
10
+ parts?: StorageMultipartPartsSerialization[];
11
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StorageMultipartSerialization = exports.StorageMultipartPartsSerialization = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const faker_1 = require("@faker-js/faker");
6
+ const swagger_1 = require("@nestjs/swagger");
7
+ const class_transformer_1 = require("class-transformer");
8
+ const storage_serialization_1 = require("./storage.serialization");
9
+ class StorageMultipartPartsSerialization {
10
+ }
11
+ exports.StorageMultipartPartsSerialization = StorageMultipartPartsSerialization;
12
+ tslib_1.__decorate([
13
+ (0, swagger_1.ApiProperty)({
14
+ example: faker_1.faker.string.alpha(10),
15
+ description: 'ETag from aws after init multipart',
16
+ }),
17
+ (0, class_transformer_1.Type)(() => String),
18
+ tslib_1.__metadata("design:type", String)
19
+ ], StorageMultipartPartsSerialization.prototype, "ETag", void 0);
20
+ tslib_1.__decorate([
21
+ (0, swagger_1.ApiProperty)({
22
+ example: 1,
23
+ }),
24
+ (0, class_transformer_1.Type)(() => Number),
25
+ tslib_1.__metadata("design:type", Number)
26
+ ], StorageMultipartPartsSerialization.prototype, "PartNumber", void 0);
27
+ class StorageMultipartSerialization extends storage_serialization_1.StorageFileSerialization {
28
+ }
29
+ exports.StorageMultipartSerialization = StorageMultipartSerialization;
30
+ tslib_1.__decorate([
31
+ (0, swagger_1.ApiProperty)({
32
+ example: faker_1.faker.string.alpha(20),
33
+ description: 'Upload id from aws after init multipart',
34
+ }),
35
+ (0, class_transformer_1.Type)(() => String),
36
+ tslib_1.__metadata("design:type", String)
37
+ ], StorageMultipartSerialization.prototype, "uploadId", void 0);
38
+ tslib_1.__decorate([
39
+ (0, swagger_1.ApiProperty)({
40
+ example: 1,
41
+ description: 'Last part number uploaded',
42
+ }),
43
+ (0, class_transformer_1.Type)(() => Number),
44
+ tslib_1.__metadata("design:type", Number)
45
+ ], StorageMultipartSerialization.prototype, "partNumber", void 0);
46
+ tslib_1.__decorate([
47
+ (0, swagger_1.ApiProperty)({
48
+ example: 200,
49
+ description: 'Max part number, or length of the chunk',
50
+ }),
51
+ (0, class_transformer_1.Type)(() => Number),
52
+ tslib_1.__metadata("design:type", Number)
53
+ ], StorageMultipartSerialization.prototype, "maxPartNumber", void 0);
54
+ tslib_1.__decorate([
55
+ (0, swagger_1.ApiProperty)({
56
+ oneOf: [
57
+ {
58
+ $ref: (0, swagger_1.getSchemaPath)(StorageMultipartPartsSerialization),
59
+ type: 'array',
60
+ },
61
+ ],
62
+ }),
63
+ (0, class_transformer_1.Type)(() => StorageMultipartPartsSerialization),
64
+ tslib_1.__metadata("design:type", Array)
65
+ ], StorageMultipartSerialization.prototype, "parts", void 0);
66
+ //# sourceMappingURL=storage.multipart.serialization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.multipart.serialization.js","sourceRoot":"","sources":["../../../../../packages/storage/src/serializations/storage.multipart.serialization.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,6CAA6D;AAC7D,yDAAyC;AACzC,mEAAmE;AAEnE,MAAa,kCAAkC;CAa9C;AAbD,gFAaC;AAPC;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,WAAW,EAAE,oCAAoC;KAClD,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;gEACN;AAMb;IAJC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,CAAC;KACX,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;sEACA;AAGrB,MAAa,6BAA8B,SAAQ,gDAAwB;CAgC1E;AAhCD,sEAgCC;AA1BC;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,WAAW,EAAE,yCAAyC;KACvD,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;+DACF;AAOjB;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,2BAA2B;KACzC,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;iEACC;AAOpB;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,GAAG;QACZ,WAAW,EAAE,yCAAyC;KACvD,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;oEACI;AAWvB;IATC,IAAA,qBAAW,EAAC;QACX,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,IAAA,uBAAa,EAAC,kCAAkC,CAAC;gBACvD,IAAI,EAAE,OAAO;aACd;SACF;KACF,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,kCAAkC,CAAC;;4DACF"}
@@ -0,0 +1,14 @@
1
+ export declare class StorageFileSerialization {
2
+ path: string;
3
+ pathWithFilename: string;
4
+ filename: string;
5
+ completeUrl: string;
6
+ baseUrl: string;
7
+ mime?: string;
8
+ provider: string;
9
+ }
10
+ export declare class StorageFileResponseSerialization {
11
+ files: StorageFileSerialization[];
12
+ isTruncated: boolean;
13
+ continuationToken?: string;
14
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StorageFileResponseSerialization = exports.StorageFileSerialization = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const faker_1 = require("@faker-js/faker");
6
+ const swagger_1 = require("@nestjs/swagger");
7
+ const class_transformer_1 = require("class-transformer");
8
+ class StorageFileSerialization {
9
+ }
10
+ exports.StorageFileSerialization = StorageFileSerialization;
11
+ tslib_1.__decorate([
12
+ (0, swagger_1.ApiProperty)({
13
+ example: faker_1.faker.system.directoryPath(),
14
+ }),
15
+ (0, class_transformer_1.Type)(() => String),
16
+ tslib_1.__metadata("design:type", String)
17
+ ], StorageFileSerialization.prototype, "path", void 0);
18
+ tslib_1.__decorate([
19
+ (0, swagger_1.ApiProperty)({
20
+ example: faker_1.faker.system.filePath(),
21
+ }),
22
+ (0, class_transformer_1.Type)(() => String),
23
+ tslib_1.__metadata("design:type", String)
24
+ ], StorageFileSerialization.prototype, "pathWithFilename", void 0);
25
+ tslib_1.__decorate([
26
+ (0, swagger_1.ApiProperty)({
27
+ example: faker_1.faker.system.fileName(),
28
+ }),
29
+ (0, class_transformer_1.Type)(() => String),
30
+ tslib_1.__metadata("design:type", String)
31
+ ], StorageFileSerialization.prototype, "filename", void 0);
32
+ tslib_1.__decorate([
33
+ (0, swagger_1.ApiProperty)({
34
+ example: `${faker_1.faker.internet.url()}/${faker_1.faker.system.filePath()}`,
35
+ }),
36
+ (0, class_transformer_1.Type)(() => String),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], StorageFileSerialization.prototype, "completeUrl", void 0);
39
+ tslib_1.__decorate([
40
+ (0, swagger_1.ApiProperty)({
41
+ example: faker_1.faker.internet.url(),
42
+ }),
43
+ (0, class_transformer_1.Type)(() => String),
44
+ tslib_1.__metadata("design:type", String)
45
+ ], StorageFileSerialization.prototype, "baseUrl", void 0);
46
+ tslib_1.__decorate([
47
+ (0, swagger_1.ApiProperty)({
48
+ example: faker_1.faker.system.mimeType(),
49
+ }),
50
+ (0, class_transformer_1.Type)(() => String),
51
+ tslib_1.__metadata("design:type", String)
52
+ ], StorageFileSerialization.prototype, "mime", void 0);
53
+ tslib_1.__decorate([
54
+ (0, swagger_1.ApiProperty)({
55
+ example: 'aws-s3',
56
+ required: true,
57
+ }),
58
+ tslib_1.__metadata("design:type", String)
59
+ ], StorageFileSerialization.prototype, "provider", void 0);
60
+ class StorageFileResponseSerialization {
61
+ }
62
+ exports.StorageFileResponseSerialization = StorageFileResponseSerialization;
63
+ tslib_1.__decorate([
64
+ (0, swagger_1.ApiProperty)({
65
+ isArray: true,
66
+ type: () => StorageFileSerialization,
67
+ }),
68
+ (0, class_transformer_1.Type)(() => StorageFileSerialization),
69
+ tslib_1.__metadata("design:type", Array)
70
+ ], StorageFileResponseSerialization.prototype, "files", void 0);
71
+ tslib_1.__decorate([
72
+ (0, swagger_1.ApiProperty)({
73
+ example: true,
74
+ nullable: false,
75
+ required: true,
76
+ }),
77
+ tslib_1.__metadata("design:type", Boolean)
78
+ ], StorageFileResponseSerialization.prototype, "isTruncated", void 0);
79
+ tslib_1.__decorate([
80
+ (0, swagger_1.ApiProperty)({
81
+ example: faker_1.faker.string.alphanumeric(18),
82
+ nullable: true,
83
+ required: false,
84
+ }),
85
+ tslib_1.__metadata("design:type", String)
86
+ ], StorageFileResponseSerialization.prototype, "continuationToken", void 0);
87
+ //# sourceMappingURL=storage.serialization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.serialization.js","sourceRoot":"","sources":["../../../../../packages/storage/src/serializations/storage.serialization.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,6CAA8C;AAC9C,yDAAyC;AAEzC,MAAa,wBAAwB;CA0CpC;AA1CD,4DA0CC;AArCC;IAJC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,aAAK,CAAC,MAAM,CAAC,aAAa,EAAE;KACtC,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;sDACN;AAMb;IAJC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,aAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;KACjC,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;kEACM;AAMzB;IAJC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,aAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;KACjC,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;0DACF;AAMjB;IAJC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,GAAG,aAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,aAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE;KAC9D,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;6DACC;AAMpB;IAJC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,aAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;KAC9B,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;yDACH;AAMhB;IAJC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,aAAK,CAAC,MAAM,CAAC,QAAQ,EAAE;KACjC,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;sDACL;AAMd;IAJC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,IAAI;KACf,CAAC;;0DACe;AAGnB,MAAa,gCAAgC;CAmB5C;AAnBD,4EAmBC;AAbC;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,GAAG,EAAE,CAAC,wBAAwB;KACrC,CAAC;IACD,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC;;+DACH;AAMlC;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,IAAI;KACf,CAAC;;qEACmB;AAMrB;IALC,IAAA,qBAAW,EAAC;QACX,OAAO,EAAE,aAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;QACtC,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,KAAK;KAChB,CAAC;;2EACyB"}
@@ -0,0 +1,33 @@
1
+ import { StorageFileResponseSerialization, StorageFileSerialization } from '../../serializations/storage.serialization';
2
+ import { StorageReadOptions, StorageUploadItemOptions, StorageWriteBaseOptions } from '../../storage.types';
3
+ import { Readable } from 'stream';
4
+ import { IStorageService } from '../../interface/istorage.service';
5
+ import { Logger } from '@nestjs/common';
6
+ import { CompletedPart, S3Client, UploadPartRequest } from '@aws-sdk/client-s3';
7
+ import { StorageMultipartSerialization, StorageMultipartPartsSerialization } from '../../serializations/storage.multipart.serialization';
8
+ import { StorageModuleOptions } from '../../storage.module.options';
9
+ export declare class StorageAwsS3Service implements IStorageService {
10
+ private readonly _options;
11
+ provider: string;
12
+ protected readonly _s3: S3Client;
13
+ protected readonly _bucket: string;
14
+ protected readonly _baseUrl: string;
15
+ protected readonly _logger: Logger;
16
+ constructor(_options: StorageModuleOptions);
17
+ private _send;
18
+ checkConnection(options?: StorageReadOptions): Promise<any>;
19
+ listContainers(): Promise<string[]>;
20
+ listFileWithPrefix(prefix: string, options?: StorageReadOptions): Promise<StorageFileResponseSerialization>;
21
+ listAllFileWithPrefix(prefix: string, options?: StorageReadOptions): Promise<StorageFileResponseSerialization>;
22
+ downloadFile(filename: string, path?: string, options?: StorageReadOptions): Promise<Readable | ReadableStream<any> | Blob | undefined>;
23
+ getSignedUrl(filename: string, path?: string, options?: StorageReadOptions): Promise<string>;
24
+ getTextFromFile(filename: string, path?: string, options?: StorageReadOptions): Promise<string>;
25
+ delete(filename: string, path?: string, options?: StorageWriteBaseOptions): Promise<boolean>;
26
+ deleteMany(paths: string[], options?: StorageWriteBaseOptions): Promise<any>;
27
+ deleteFolder(dir: string, options?: StorageWriteBaseOptions): Promise<void>;
28
+ createMultiPart(filename: string, options?: StorageUploadItemOptions): Promise<StorageMultipartSerialization>;
29
+ uploadItem(filename: string, content: string | Readable | ReadableStream<any> | Blob | Buffer | Uint8Array, options?: StorageUploadItemOptions): Promise<StorageFileSerialization>;
30
+ uploadPart(path: string, content: UploadPartRequest['Body'] | string | Uint8Array | Buffer, uploadId: string, partNumber: number, options?: StorageWriteBaseOptions): Promise<StorageMultipartPartsSerialization>;
31
+ completeMultipart(path: string, uploadId: string, parts: CompletedPart[], options?: StorageWriteBaseOptions): Promise<void>;
32
+ abortMultipart(path: string, uploadId: string, options?: StorageWriteBaseOptions): Promise<void>;
33
+ }
@@ -0,0 +1,386 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StorageAwsS3Service = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_1 = require("@nestjs/common");
6
+ const client_s3_1 = require("@aws-sdk/client-s3");
7
+ const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
8
+ const constant_1 = require("@tc-libs/constant");
9
+ let StorageAwsS3Service = class StorageAwsS3Service {
10
+ constructor(_options) {
11
+ this._options = _options;
12
+ this.provider = 'aws-s3';
13
+ this._logger = new common_1.Logger('StorageAwsS3');
14
+ const accessKeyId = this._options.aws.credential.key;
15
+ const secretAccessKey = this._options.aws.credential.secret;
16
+ const region = this._options.aws.s3.region;
17
+ this._s3 = new client_s3_1.S3Client({
18
+ credentials: {
19
+ accessKeyId,
20
+ secretAccessKey,
21
+ },
22
+ region,
23
+ });
24
+ this._bucket = this._options.aws.s3.bucket;
25
+ this._baseUrl = this._options.aws.s3.baseUrl;
26
+ }
27
+ async _send(command) {
28
+ const maxRetries = 5;
29
+ let retryCount = 0;
30
+ let delay = 100;
31
+ let lastError;
32
+ while (retryCount < maxRetries) {
33
+ try {
34
+ return await this._s3.send(command);
35
+ }
36
+ catch (err) {
37
+ lastError = err;
38
+ this._logger.error(err);
39
+ retryCount++;
40
+ delay = delay * (retryCount * retryCount * retryCount);
41
+ await new Promise((resolve) => setTimeout(resolve, delay));
42
+ }
43
+ }
44
+ throw lastError;
45
+ }
46
+ async checkConnection(options = { container: this._bucket }) {
47
+ this._logger.debug('checking aws connection');
48
+ // creaft command
49
+ const command = new client_s3_1.HeadBucketCommand({
50
+ Bucket: options.container,
51
+ });
52
+ try {
53
+ const check = await this._send(command);
54
+ return check;
55
+ }
56
+ catch (err) {
57
+ this._logger.error(err);
58
+ throw err;
59
+ }
60
+ }
61
+ async listContainers() {
62
+ this._logger.debug('listing containers');
63
+ const command = new client_s3_1.ListBucketsCommand({});
64
+ try {
65
+ const listBucket = await this._send(command);
66
+ const mapList = listBucket.Buckets?.map((val) => val.Name ?? '') ?? [];
67
+ return mapList;
68
+ }
69
+ catch (err) {
70
+ this._logger.error(err);
71
+ throw err;
72
+ }
73
+ }
74
+ async listFileWithPrefix(prefix, options = { container: this._bucket }) {
75
+ this._logger.debug(`Listing files with prefix [${prefix}]`);
76
+ const listObjectCommandOptions = {
77
+ Bucket: options.container,
78
+ Prefix: prefix,
79
+ };
80
+ // limit max results
81
+ if ((options.limit ?? 0) > 0)
82
+ listObjectCommandOptions.MaxKeys = options.limit;
83
+ // start after a given file key
84
+ if (options.startAfter)
85
+ listObjectCommandOptions.StartAfter = options.startAfter;
86
+ // if has a continuation token, add it
87
+ if (options.continuationToken)
88
+ listObjectCommandOptions.ContinuationToken = options.continuationToken;
89
+ // craft command
90
+ const command = new client_s3_1.ListObjectsV2Command(listObjectCommandOptions);
91
+ try {
92
+ const listItems = await this._send(command);
93
+ const mapList = listItems.Contents?.map((val) => {
94
+ const lastIndex = val.Key?.lastIndexOf('/');
95
+ const path = val.Key?.substring(0, lastIndex) ?? '';
96
+ const filename = lastIndex
97
+ ? val.Key?.substring(lastIndex, val.Key.length)
98
+ : undefined;
99
+ const mime = filename
100
+ ? filename
101
+ .substring(filename.lastIndexOf('.') + 1, filename.length)
102
+ .toLocaleUpperCase()
103
+ : undefined;
104
+ return {
105
+ path,
106
+ pathWithFilename: val.Key ?? '',
107
+ filename: filename ?? '',
108
+ provider: this.provider,
109
+ completeUrl: `${this._baseUrl}/${val.Key}`,
110
+ baseUrl: this._baseUrl,
111
+ mime,
112
+ };
113
+ });
114
+ return {
115
+ isTruncated: !!listItems.IsTruncated,
116
+ continuationToken: listItems.ContinuationToken,
117
+ files: mapList ?? [],
118
+ };
119
+ }
120
+ catch (err) {
121
+ this._logger.error(err);
122
+ throw err;
123
+ }
124
+ }
125
+ async listAllFileWithPrefix(prefix, options = { container: this._bucket }) {
126
+ this._logger.debug(`Listing all files with prefix [${prefix}]`);
127
+ let truncated = false;
128
+ let nextToken = undefined;
129
+ let files = [];
130
+ do {
131
+ const data = await this.listFileWithPrefix(prefix, {
132
+ ...options,
133
+ continuationToken: nextToken,
134
+ });
135
+ const returnFiles = data && data.files && data.files.length ? data.files : [];
136
+ files = [...files, ...returnFiles];
137
+ truncated = !!data.isTruncated;
138
+ nextToken =
139
+ truncated && data.continuationToken
140
+ ? data.continuationToken
141
+ : undefined;
142
+ } while (truncated);
143
+ this._logger.debug(`Listed [${files.length}] files with prefix [${prefix}]`);
144
+ return {
145
+ isTruncated: false,
146
+ continuationToken: undefined,
147
+ files,
148
+ };
149
+ }
150
+ async downloadFile(filename, path, options = { container: this._bucket }) {
151
+ if (path)
152
+ path = path.startsWith('/') ? path.replace('/', '') : `${path}`;
153
+ const key = path ? `${path}/${filename}` : filename;
154
+ const input = {
155
+ Bucket: options.container,
156
+ Key: key,
157
+ };
158
+ const command = new client_s3_1.GetObjectCommand(input);
159
+ try {
160
+ const item = await this._send(command);
161
+ return item.Body;
162
+ }
163
+ catch (err) {
164
+ this._logger.error(err);
165
+ throw err;
166
+ }
167
+ }
168
+ async getSignedUrl(filename, path, options = { container: this._bucket }) {
169
+ if (path)
170
+ path = path.startsWith('/') ? path.replace('/', '') : `${path}`;
171
+ const key = path ? `${path}/${filename}` : filename;
172
+ const input = {
173
+ Bucket: options.container,
174
+ Key: key,
175
+ };
176
+ const command = new client_s3_1.GetObjectCommand(input);
177
+ try {
178
+ return (0, s3_request_presigner_1.getSignedUrl)(this._s3, command, {
179
+ expiresIn: 3600,
180
+ });
181
+ }
182
+ catch (err) {
183
+ this._logger.error(err);
184
+ throw err;
185
+ }
186
+ }
187
+ async getTextFromFile(filename, path, options = { container: this._bucket }) {
188
+ if (path)
189
+ path = path.startsWith('/') ? path.replace('/', '') : `${path}`;
190
+ const key = path ? `${path}/${filename}` : filename;
191
+ const input = {
192
+ Bucket: options.container,
193
+ Key: key,
194
+ ResponseContentType: constant_1.ENUM_FILE_PLAIN_TEXT_MIME.TXT,
195
+ };
196
+ const command = new client_s3_1.GetObjectCommand(input);
197
+ try {
198
+ const item = await this._send(command);
199
+ return new Promise((resolve, reject) => {
200
+ // Store all of data chunks returned from the response data stream
201
+ // into an array then use Array#join() to use the returned contents as a String
202
+ const responseDataChunks = [];
203
+ const body = item.Body;
204
+ // Handle an error while streaming the response body
205
+ body.once('error', (err) => reject(err));
206
+ // Attach a 'data' listener to add the chunks of data to our array
207
+ // Each chunk is a Buffer instance
208
+ body.on('data', (chunk) => responseDataChunks.push(chunk));
209
+ // Once the stream has no more data, join the chunks into a string and return the string
210
+ body.once('end', () => resolve(responseDataChunks.join('')));
211
+ });
212
+ }
213
+ catch (err) {
214
+ if (err.Code === 'NoSuchKey') {
215
+ return '';
216
+ }
217
+ this._logger.error(err);
218
+ throw err;
219
+ }
220
+ }
221
+ async delete(filename, path, options = { container: this._bucket }) {
222
+ if (path)
223
+ path = path.startsWith('/') ? path.replace('/', '') : `${path}`;
224
+ const key = path ? `${path}/${filename}` : filename;
225
+ // craft command
226
+ const command = new client_s3_1.DeleteObjectCommand({
227
+ Bucket: options.container,
228
+ Key: key,
229
+ });
230
+ try {
231
+ await this._send(command);
232
+ return true;
233
+ }
234
+ catch (err) {
235
+ this._logger.error(err);
236
+ return false;
237
+ }
238
+ }
239
+ async deleteMany(paths, options = { container: this._bucket }) {
240
+ const keys = paths.map((val) => ({
241
+ Key: val,
242
+ }));
243
+ const command = new client_s3_1.DeleteObjectsCommand({
244
+ Bucket: options.container,
245
+ Delete: {
246
+ Objects: keys,
247
+ },
248
+ });
249
+ try {
250
+ await this._send(command);
251
+ return;
252
+ }
253
+ catch (err) {
254
+ this._logger.error(err);
255
+ throw err;
256
+ }
257
+ }
258
+ async deleteFolder(dir, options = { container: this._bucket }) {
259
+ const commandList = new client_s3_1.ListObjectsV2Command({
260
+ Bucket: options.container,
261
+ Prefix: dir,
262
+ });
263
+ const lists = await this._send(commandList);
264
+ try {
265
+ const listItems = lists.Contents.map((val) => ({
266
+ Key: val.Key,
267
+ }));
268
+ const commandDeleteItems = new client_s3_1.DeleteObjectsCommand({
269
+ Bucket: options.container,
270
+ Delete: {
271
+ Objects: listItems,
272
+ },
273
+ });
274
+ await this._send(commandDeleteItems);
275
+ const commandDelete = new client_s3_1.DeleteObjectCommand({
276
+ Bucket: options.container,
277
+ Key: dir,
278
+ });
279
+ await this._send(commandDelete);
280
+ return;
281
+ }
282
+ catch (err) {
283
+ this._logger.error(err);
284
+ throw err;
285
+ }
286
+ }
287
+ async createMultiPart(filename, options) {
288
+ const bucket = options?.container || this._bucket;
289
+ let path = options?.path;
290
+ const acl = options?.acl ? options.acl : 'public-read';
291
+ if (path)
292
+ path = path.startsWith('/') ? path.replace('/', '') : `${path}`;
293
+ const mime = filename
294
+ .substring(filename.lastIndexOf('.') + 1, filename.length)
295
+ .toUpperCase();
296
+ const key = path ? `${path}/${filename}` : filename;
297
+ const multiPartInput = {
298
+ Bucket: bucket,
299
+ Key: key,
300
+ ACL: acl,
301
+ };
302
+ const multiPartCommand = new client_s3_1.CreateMultipartUploadCommand(multiPartInput);
303
+ const response = await this._send(multiPartCommand);
304
+ return {
305
+ uploadId: response.UploadId,
306
+ path: path ?? '',
307
+ provider: this.provider,
308
+ pathWithFilename: key,
309
+ filename: filename,
310
+ completeUrl: `${this._baseUrl}/${key}`,
311
+ baseUrl: this._baseUrl,
312
+ mime,
313
+ };
314
+ }
315
+ async uploadItem(filename, content, options) {
316
+ const bucket = options?.container || this._bucket;
317
+ let path = options?.path;
318
+ const acl = options?.acl
319
+ ? options.acl
320
+ : client_s3_1.ObjectCannedACL.public_read;
321
+ if (path)
322
+ path = path.startsWith('/') ? path.replace('/', '') : `${path}`;
323
+ const key = path ? `${path}/${filename}` : filename;
324
+ const command = new client_s3_1.PutObjectCommand({
325
+ Bucket: bucket,
326
+ Key: key,
327
+ Body: content,
328
+ ContentType: options?.mime,
329
+ ACL: acl,
330
+ });
331
+ await this._send(command);
332
+ return {
333
+ path: path ?? '',
334
+ provider: this.provider,
335
+ pathWithFilename: key,
336
+ filename: filename,
337
+ completeUrl: `${this._baseUrl}/${key}`,
338
+ baseUrl: this._baseUrl,
339
+ mime: options?.mime,
340
+ };
341
+ }
342
+ async uploadPart(path, content, uploadId, partNumber, options = { container: this._bucket }) {
343
+ const uploadPartInput = {
344
+ Bucket: options.container,
345
+ Key: path,
346
+ Body: content,
347
+ PartNumber: partNumber,
348
+ UploadId: uploadId,
349
+ };
350
+ const uploadPartCommand = new client_s3_1.UploadPartCommand(uploadPartInput);
351
+ const { ETag } = await this._send(uploadPartCommand);
352
+ return {
353
+ ETag,
354
+ PartNumber: partNumber,
355
+ };
356
+ }
357
+ async completeMultipart(path, uploadId, parts, options = { container: this._bucket }) {
358
+ const completeMultipartInput = {
359
+ Bucket: options.container,
360
+ Key: path,
361
+ UploadId: uploadId,
362
+ MultipartUpload: {
363
+ Parts: parts,
364
+ },
365
+ };
366
+ const completeMultipartCommand = new client_s3_1.CompleteMultipartUploadCommand(completeMultipartInput);
367
+ await this._send(completeMultipartCommand);
368
+ return;
369
+ }
370
+ async abortMultipart(path, uploadId, options = { container: this._bucket }) {
371
+ const abortMultipartInput = {
372
+ Bucket: options.container,
373
+ Key: path,
374
+ UploadId: uploadId,
375
+ };
376
+ const abortMultipartCommand = new client_s3_1.AbortMultipartUploadCommand(abortMultipartInput);
377
+ await this._send(abortMultipartCommand);
378
+ return;
379
+ }
380
+ };
381
+ exports.StorageAwsS3Service = StorageAwsS3Service;
382
+ exports.StorageAwsS3Service = StorageAwsS3Service = tslib_1.__decorate([
383
+ (0, common_1.Injectable)(),
384
+ tslib_1.__metadata("design:paramtypes", [Object])
385
+ ], StorageAwsS3Service);
386
+ //# sourceMappingURL=storage.aws-s3.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.aws-s3.service.js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,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAE3C,OAAO;IACT,CAAC;IACD,KAAK,CAAC,cAAc,CAClB,IAAY,EACZ,QAAgB,EAChB,UAAmC,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE;QAE9D,MAAM,mBAAmB,GAAqC;YAC5D,MAAM,EAAE,OAAO,CAAC,SAAS;YACzB,GAAG,EAAE,IAAI;YACT,QAAQ,EAAE,QAAQ;SACnB,CAAC;QAEF,MAAM,qBAAqB,GACzB,IAAI,uCAA2B,CAAC,mBAAmB,CAAC,CAAC;QAEvD,MAAM,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAExC,OAAO;IACT,CAAC;CACF,CAAA;AA5dY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;;GACA,mBAAmB,CA4d/B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=storage.azure-blob.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.azure-blob.service.js","sourceRoot":"","sources":["../../../../../../packages/storage/src/services/azure-blob/storage.azure-blob.service.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { DynamicModule } from '@nestjs/common';
2
+ import StorageModuleAsyncOptions, { StorageModuleOptions } from './storage.module.options';
3
+ export declare class StorageModule {
4
+ static register(options: StorageModuleOptions, isGlobal?: boolean): DynamicModule;
5
+ static registerAsync(options: StorageModuleAsyncOptions, isGlobal?: boolean): DynamicModule;
6
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StorageModule = void 0;
4
+ const storage_aws_s3_service_1 = require("./services/aws-s3/storage.aws-s3.service");
5
+ const storage_module_options_1 = require("./storage.module.options");
6
+ class StorageModule {
7
+ static register(options, isGlobal) {
8
+ return {
9
+ module: StorageModule,
10
+ imports: [],
11
+ providers: [
12
+ { provide: storage_module_options_1.STORAGE_CONFIG_OPTIONS, useValue: options },
13
+ storage_aws_s3_service_1.StorageAwsS3Service,
14
+ ],
15
+ exports: [storage_aws_s3_service_1.StorageAwsS3Service],
16
+ global: isGlobal,
17
+ };
18
+ }
19
+ static registerAsync(options, isGlobal) {
20
+ return {
21
+ module: StorageModule,
22
+ imports: [...(options.imports || [])],
23
+ providers: [
24
+ {
25
+ provide: storage_module_options_1.STORAGE_CONFIG_OPTIONS,
26
+ useFactory: options.useFactory,
27
+ inject: options.inject,
28
+ },
29
+ storage_aws_s3_service_1.StorageAwsS3Service,
30
+ ],
31
+ exports: [storage_aws_s3_service_1.StorageAwsS3Service],
32
+ global: isGlobal,
33
+ };
34
+ }
35
+ }
36
+ exports.StorageModule = StorageModule;
37
+ //# sourceMappingURL=storage.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.module.js","sourceRoot":"","sources":["../../../../packages/storage/src/storage.module.ts"],"names":[],"mappings":";;;AACA,qFAA+E;AAC/E,qEAGkC;AAElC,MAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CACb,OAA6B,EAC7B,QAAkB;QAElB,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE,EAAE;YACX,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,+CAAsB,EAAE,QAAQ,EAAE,OAAO,EAAE;gBACtD,4CAAmB;aACpB;YACD,OAAO,EAAE,CAAC,4CAAmB,CAAC;YAC9B,MAAM,EAAE,QAAQ;SACjB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,aAAa,CAClB,OAAkC,EAClC,QAAkB;QAElB,OAAO;YACL,MAAM,EAAE,aAAa;YACrB,OAAO,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;YACrC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,+CAAsB;oBAC/B,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;iBACvB;gBACD,4CAAmB;aACpB;YACD,OAAO,EAAE,CAAC,4CAAmB,CAAC;YAC9B,MAAM,EAAE,QAAQ;SACjB,CAAC;IACJ,CAAC;CACF;AApCD,sCAoCC"}
@@ -0,0 +1,18 @@
1
+ import { ModuleMetadata } from '@nestjs/common';
2
+ import { FactoryProvider } from '@nestjs/common/interfaces/modules/provider.interface';
3
+ export declare const STORAGE_CONFIG_OPTIONS = "STORAGE_CONFIG_OPTIONS";
4
+ export interface StorageModuleOptions {
5
+ aws: {
6
+ credential: {
7
+ key: string;
8
+ secret: string;
9
+ };
10
+ s3: {
11
+ region: string;
12
+ bucket: string;
13
+ baseUrl: string;
14
+ };
15
+ };
16
+ }
17
+ type StorageModuleAsyncOptions = Pick<ModuleMetadata, 'imports'> & Pick<FactoryProvider<StorageModuleOptions>, 'useFactory' | 'inject'>;
18
+ export default StorageModuleAsyncOptions;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STORAGE_CONFIG_OPTIONS = void 0;
4
+ exports.STORAGE_CONFIG_OPTIONS = 'STORAGE_CONFIG_OPTIONS';
5
+ //# sourceMappingURL=storage.module.options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.module.options.js","sourceRoot":"","sources":["../../../../packages/storage/src/storage.module.options.ts"],"names":[],"mappings":";;;AAGa,QAAA,sBAAsB,GAAG,wBAAwB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { ObjectCannedACL } from '@aws-sdk/client-s3';
2
+ export type StorageReadBaseOptions = {
3
+ container: string;
4
+ startAfter?: string;
5
+ limit?: number;
6
+ };
7
+ export type StorageWriteBaseOptions = {
8
+ container: string;
9
+ };
10
+ export type StorageReadOptions = StorageReadBaseOptions & {
11
+ continuationToken?: string;
12
+ };
13
+ export type StorageUploadItemOptions = {
14
+ container?: string;
15
+ path: string;
16
+ mime: string;
17
+ acl?: ObjectCannedACL;
18
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=storage.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.types.js","sourceRoot":"","sources":["../../../../packages/storage/src/storage.types.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export declare class StorageModule {
2
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StorageModule = void 0;
4
- const tslib_1 = require("tslib");
5
- const common_1 = require("@nestjs/common");
6
- const storage_service_1 = require("./storage.service");
7
- let StorageModule = class StorageModule {
8
- };
9
- exports.StorageModule = StorageModule;
10
- exports.StorageModule = StorageModule = tslib_1.__decorate([
11
- (0, common_1.Module)({
12
- imports: [],
13
- controllers: [],
14
- providers: [storage_service_1.StorageService],
15
- exports: [storage_service_1.StorageService],
16
- })
17
- ], StorageModule);
18
- //# sourceMappingURL=storage.module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.module.js","sourceRoot":"","sources":["../../../../../packages/storage/src/lib/storage.module.ts"],"names":[],"mappings":";;;;AAAA,2CAAwC;AACxC,uDAAmD;AAQ5C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IANzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,CAAC,gCAAc,CAAC;QAC3B,OAAO,EAAE,CAAC,gCAAc,CAAC;KAC1B,CAAC;GACW,aAAa,CAAG"}
@@ -1,3 +0,0 @@
1
- export declare class StorageService {
2
- getHello(): void;
3
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- var StorageService_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.StorageService = void 0;
5
- const tslib_1 = require("tslib");
6
- const common_1 = require("@nestjs/common");
7
- let StorageService = StorageService_1 = class StorageService {
8
- getHello() {
9
- console.log(StorageService_1.name, 'Hello World!');
10
- }
11
- };
12
- exports.StorageService = StorageService;
13
- exports.StorageService = StorageService = StorageService_1 = tslib_1.__decorate([
14
- (0, common_1.Injectable)()
15
- ], StorageService);
16
- //# sourceMappingURL=storage.service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.service.js","sourceRoot":"","sources":["../../../../../packages/storage/src/lib/storage.service.ts"],"names":[],"mappings":";;;;;AAAA,2CAA4C;AAGrC,IAAM,cAAc,sBAApB,MAAM,cAAc;IACzB,QAAQ;QACN,OAAO,CAAC,GAAG,CAAC,gBAAc,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AAJY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;GACA,cAAc,CAI1B"}