@toa.io/extensions.storages 1.0.0-alpha.0 → 1.0.0-alpha.2

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 (88) hide show
  1. package/package.json +12 -11
  2. package/readme.md +63 -19
  3. package/schemas/annotation.cos.yaml +10 -0
  4. package/schemas/fs.cos.yaml +9 -0
  5. package/schemas/mem.cos.yaml +6 -0
  6. package/schemas/s3.cos.yaml +16 -0
  7. package/schemas/test.cos.yaml +8 -0
  8. package/schemas/tmp.cos.yaml +9 -0
  9. package/source/Annotation.ts +39 -0
  10. package/source/Aspect.ts +6 -4
  11. package/source/Factory.ts +31 -28
  12. package/source/Provider.ts +30 -5
  13. package/source/Scanner.ts +3 -3
  14. package/source/Storage.test.ts +110 -105
  15. package/source/Storage.ts +13 -6
  16. package/source/deployment.ts +21 -29
  17. package/source/providers/Declaration.ts +10 -0
  18. package/source/providers/FileSystem.test.ts +1 -9
  19. package/source/providers/FileSystem.ts +20 -15
  20. package/source/providers/Memory.ts +41 -0
  21. package/source/providers/S3.test.ts +133 -0
  22. package/source/providers/S3.ts +114 -39
  23. package/source/providers/Temporary.ts +8 -6
  24. package/source/providers/Test.ts +8 -8
  25. package/source/providers/index.test.ts +24 -19
  26. package/source/providers/index.ts +10 -9
  27. package/source/providers/readme.md +1 -1
  28. package/source/schemas.test.ts +58 -0
  29. package/source/schemas.ts +15 -0
  30. package/source/test/util.ts +25 -54
  31. package/transpiled/Annotation.d.ts +3 -0
  32. package/transpiled/Annotation.js +57 -0
  33. package/transpiled/Annotation.js.map +1 -0
  34. package/transpiled/Aspect.d.ts +8 -0
  35. package/transpiled/Aspect.js +25 -0
  36. package/transpiled/Aspect.js.map +1 -0
  37. package/transpiled/Entry.d.ts +14 -0
  38. package/transpiled/Entry.js +3 -0
  39. package/transpiled/Entry.js.map +1 -0
  40. package/transpiled/Factory.d.ts +9 -0
  41. package/transpiled/Factory.js +53 -0
  42. package/transpiled/Factory.js.map +1 -0
  43. package/transpiled/Provider.d.ts +20 -0
  44. package/transpiled/Provider.js +36 -0
  45. package/transpiled/Provider.js.map +1 -0
  46. package/transpiled/Scanner.d.ts +26 -0
  47. package/transpiled/Scanner.js +98 -0
  48. package/transpiled/Scanner.js.map +1 -0
  49. package/transpiled/Storage.d.ts +32 -0
  50. package/transpiled/Storage.js +176 -0
  51. package/transpiled/Storage.js.map +1 -0
  52. package/transpiled/deployment.d.ts +5 -0
  53. package/transpiled/deployment.js +68 -0
  54. package/transpiled/deployment.js.map +1 -0
  55. package/transpiled/index.d.ts +4 -0
  56. package/transpiled/index.js +10 -0
  57. package/transpiled/index.js.map +1 -0
  58. package/transpiled/manifest.d.ts +1 -0
  59. package/transpiled/manifest.js +9 -0
  60. package/transpiled/manifest.js.map +1 -0
  61. package/transpiled/providers/Declaration.d.ts +14 -0
  62. package/transpiled/providers/Declaration.js +3 -0
  63. package/transpiled/providers/Declaration.js.map +1 -0
  64. package/transpiled/providers/FileSystem.d.ts +15 -0
  65. package/transpiled/providers/FileSystem.js +44 -0
  66. package/transpiled/providers/FileSystem.js.map +1 -0
  67. package/transpiled/providers/Memory.d.ts +13 -0
  68. package/transpiled/providers/Memory.js +60 -0
  69. package/transpiled/providers/Memory.js.map +1 -0
  70. package/transpiled/providers/S3.d.ts +27 -0
  71. package/transpiled/providers/S3.js +154 -0
  72. package/transpiled/providers/S3.js.map +1 -0
  73. package/transpiled/providers/Temporary.d.ts +8 -0
  74. package/transpiled/providers/Temporary.js +14 -0
  75. package/transpiled/providers/Temporary.js.map +1 -0
  76. package/transpiled/providers/Test.d.ts +6 -0
  77. package/transpiled/providers/Test.js +15 -0
  78. package/transpiled/providers/Test.js.map +1 -0
  79. package/transpiled/providers/index.d.ts +13 -0
  80. package/transpiled/providers/index.js +16 -0
  81. package/transpiled/providers/index.js.map +1 -0
  82. package/transpiled/schemas.d.ts +9 -0
  83. package/transpiled/schemas.js +14 -0
  84. package/transpiled/schemas.js.map +1 -0
  85. package/transpiled/test/util.d.ts +29 -0
  86. package/transpiled/test/util.js +38 -0
  87. package/transpiled/test/util.js.map +1 -0
  88. package/transpiled/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.S3 = void 0;
30
+ const node_stream_1 = require("node:stream");
31
+ const node_buffer_1 = require("node:buffer");
32
+ const posix_1 = require("node:path/posix");
33
+ const node_assert_1 = __importDefault(require("node:assert"));
34
+ const lib_storage_1 = require("@aws-sdk/lib-storage");
35
+ const client_s3_1 = require("@aws-sdk/client-s3");
36
+ const nodeNativeFetch = __importStar(require("smithy-node-native-fetch"));
37
+ const Provider_1 = require("../Provider");
38
+ class S3 extends Provider_1.Provider {
39
+ static SECRETS = [
40
+ { name: 'ACCESS_KEY_ID', optional: true },
41
+ { name: 'SECRET_ACCESS_KEY', optional: true }
42
+ ];
43
+ bucket;
44
+ client;
45
+ constructor(options, secrets) {
46
+ super(options);
47
+ this.bucket = options.bucket;
48
+ const s3Config = {
49
+ retryMode: 'adaptive',
50
+ ...nodeNativeFetch
51
+ };
52
+ if (options.endpoint !== undefined) {
53
+ s3Config.forcePathStyle = options.endpoint.startsWith('http://');
54
+ s3Config.endpoint = options.endpoint;
55
+ }
56
+ if (options.region !== undefined)
57
+ s3Config.region = options.region;
58
+ if (typeof secrets?.ACCESS_KEY_ID === 'string') {
59
+ node_assert_1.default.ok(secrets.SECRET_ACCESS_KEY !== undefined, 'SECRET_ACCESS_KEY is required if ACCESS_KEY_ID is provided');
60
+ s3Config.credentials = {
61
+ accessKeyId: secrets.ACCESS_KEY_ID,
62
+ secretAccessKey: secrets.SECRET_ACCESS_KEY
63
+ };
64
+ }
65
+ this.client = new client_s3_1.S3Client(s3Config);
66
+ this.client.middlewareStack.add((next, _context) => async (args) => {
67
+ if ('Key' in args.input && typeof args.input.Key === 'string')
68
+ // removes leading slash
69
+ args.input.Key = args.input.Key.replace(/^\//, '');
70
+ if ('Prefix' in args.input && typeof args.input.Prefix === 'string')
71
+ // removes leading slash and ensures finishing slash
72
+ args.input.Prefix = args.input.Prefix.replace(/^\/|\/$/g, '') + '/';
73
+ return next(args);
74
+ }, {
75
+ step: 'initialize',
76
+ priority: 'high',
77
+ name: 'normalizesSlashesInPath'
78
+ });
79
+ }
80
+ async get(Key) {
81
+ try {
82
+ const fileResponse = await this.client.send(new client_s3_1.GetObjectCommand({
83
+ Bucket: this.bucket,
84
+ Key
85
+ }));
86
+ if (fileResponse.Body === undefined)
87
+ return null; // should never happen
88
+ if (fileResponse.Body instanceof node_stream_1.Readable)
89
+ return fileResponse.Body;
90
+ return node_stream_1.Readable.fromWeb((fileResponse.Body instanceof node_buffer_1.Blob
91
+ ? fileResponse.Body.stream()
92
+ : fileResponse.Body)); // types mismatch between Node 20 and aws-sdk
93
+ }
94
+ catch (err) {
95
+ if (err instanceof client_s3_1.NotFound || err instanceof client_s3_1.NoSuchKey)
96
+ return null;
97
+ else
98
+ throw err;
99
+ }
100
+ }
101
+ async put(path, filename, stream) {
102
+ await new lib_storage_1.Upload({
103
+ client: this.client,
104
+ params: {
105
+ Bucket: this.bucket,
106
+ Key: (0, posix_1.join)(path, filename),
107
+ Body: stream
108
+ }
109
+ }).done();
110
+ }
111
+ /**
112
+ * Deletes either a single object or "directory" - all objects
113
+ * with given prefix (prefix will be enforced to finish with `/`)
114
+ * @param Key - key name or path prefix
115
+ */
116
+ async delete(Key) {
117
+ const { client, bucket: Bucket } = this;
118
+ // checking if given key is a single file
119
+ if (!Key.endsWith('/'))
120
+ try {
121
+ // DeleteObject on S3 returns no error if object does not exist
122
+ await client.send(new client_s3_1.HeadObjectCommand({ Bucket, Key }));
123
+ await client.send(new client_s3_1.DeleteObjectCommand({ Bucket, Key }));
124
+ return;
125
+ }
126
+ catch (err) {
127
+ node_assert_1.default.ok(err instanceof client_s3_1.NotFound || err instanceof client_s3_1.NoSuchKey, err);
128
+ }
129
+ const objectsToRemove = [];
130
+ for await (const page of (0, client_s3_1.paginateListObjectsV2)({ client }, { Bucket, Prefix: Key }))
131
+ for (const { Key } of page.Contents ?? [])
132
+ objectsToRemove.push({ Key });
133
+ // Removing all objects in parallel in batches
134
+ await Promise.all((function* () {
135
+ while (objectsToRemove.length > 0)
136
+ yield client.send(new client_s3_1.DeleteObjectsCommand({
137
+ Bucket,
138
+ Delete: {
139
+ Objects: objectsToRemove.splice(0, 1000 /* max batch size for DeleteObjects */)
140
+ }
141
+ }));
142
+ })());
143
+ }
144
+ async move(from, keyTo) {
145
+ await this.client.send(new client_s3_1.CopyObjectCommand({
146
+ Bucket: this.bucket,
147
+ Key: keyTo,
148
+ CopySource: (0, posix_1.join)(this.bucket, from)
149
+ }));
150
+ await this.client.send(new client_s3_1.DeleteObjectCommand({ Bucket: this.bucket, Key: from }));
151
+ }
152
+ }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EAAE,IAAI,EAAE,CAAC,CAAC,CAAA;IACrF,CAAC;;AArIH,gBAsIC"}
@@ -0,0 +1,8 @@
1
+ import { FileSystem } from './FileSystem';
2
+ import type { ProviderSecrets } from '../Provider';
3
+ export interface TemporaryOptions {
4
+ directory: string;
5
+ }
6
+ export declare class Temporary extends FileSystem {
7
+ constructor(options: TemporaryOptions, secrets?: ProviderSecrets);
8
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Temporary = void 0;
4
+ const node_os_1 = require("node:os");
5
+ const node_path_1 = require("node:path");
6
+ const FileSystem_1 = require("./FileSystem");
7
+ class Temporary extends FileSystem_1.FileSystem {
8
+ constructor(options, secrets) {
9
+ const path = (0, node_path_1.join)((0, node_os_1.tmpdir)(), options.directory);
10
+ super({ path }, secrets);
11
+ }
12
+ }
13
+ exports.Temporary = Temporary;
14
+ //# sourceMappingURL=Temporary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Temporary.js","sourceRoot":"","sources":["../../source/providers/Temporary.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAChC,yCAAgC;AAChC,6CAAyC;AAOzC,MAAa,SAAU,SAAQ,uBAAU;IACvC,YAAoB,OAAyB,EAAE,OAAyB;QACtE,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,IAAA,gBAAM,GAAE,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;QAE9C,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,CAAA;IAC1B,CAAC;CACF;AAND,8BAMC"}
@@ -0,0 +1,6 @@
1
+ import { Temporary, type TemporaryOptions } from './Temporary';
2
+ import type { ProviderSecret, ProviderSecrets } from '../Provider';
3
+ export declare class Test extends Temporary {
4
+ static readonly SECRETS: readonly ProviderSecret[];
5
+ constructor(options: TemporaryOptions, secrets?: ProviderSecrets);
6
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Test = void 0;
4
+ const Temporary_1 = require("./Temporary");
5
+ class Test extends Temporary_1.Temporary {
6
+ static SECRETS = [
7
+ { name: 'USERNAME' },
8
+ { name: 'PASSWORD' }
9
+ ];
10
+ constructor(options, secrets) {
11
+ super(options, secrets);
12
+ }
13
+ }
14
+ exports.Test = Test;
15
+ //# sourceMappingURL=Test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Test.js","sourceRoot":"","sources":["../../source/providers/Test.ts"],"names":[],"mappings":";;;AAAA,2CAA8D;AAG9D,MAAa,IAAK,SAAQ,qBAAS;IAC1B,MAAM,CAAmB,OAAO,GAA8B;QACnE,EAAE,IAAI,EAAE,UAAU,EAAE;QACpB,EAAE,IAAI,EAAE,UAAU,EAAE;KACrB,CAAA;IAED,YAAoB,OAAyB,EAAE,OAAyB;QACtE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACzB,CAAC;;AARH,oBASC"}
@@ -0,0 +1,13 @@
1
+ import { FileSystem } from './FileSystem';
2
+ import { S3 } from './S3';
3
+ import { Temporary } from './Temporary';
4
+ import { Test } from './Test';
5
+ import { InMemory } from './Memory';
6
+ export declare const providers: {
7
+ readonly s3: typeof S3;
8
+ readonly fs: typeof FileSystem;
9
+ readonly tmp: typeof Temporary;
10
+ readonly mem: typeof InMemory;
11
+ readonly test: typeof Test;
12
+ };
13
+ export type { Declaration } from './Declaration';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.providers = void 0;
4
+ const FileSystem_1 = require("./FileSystem");
5
+ const S3_1 = require("./S3");
6
+ const Temporary_1 = require("./Temporary");
7
+ const Test_1 = require("./Test");
8
+ const Memory_1 = require("./Memory");
9
+ exports.providers = {
10
+ s3: S3_1.S3,
11
+ fs: FileSystem_1.FileSystem,
12
+ tmp: Temporary_1.Temporary,
13
+ mem: Memory_1.InMemory,
14
+ test: Test_1.Test
15
+ };
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/providers/index.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,6BAAyB;AACzB,2CAAuC;AACvC,iCAA6B;AAC7B,qCAAmC;AAGtB,QAAA,SAAS,GAAG;IACvB,EAAE,EAAE,OAAE;IACN,EAAE,EAAE,uBAAU;IACd,GAAG,EAAE,qBAAS;IACd,GAAG,EAAE,iBAAQ;IACb,IAAI,EAAE,WAAI;CAC4C,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { Declaration } from './providers';
2
+ import type { Schema } from '@toa.io/schemas';
3
+ import type { Annotation } from './Annotation';
4
+ export declare const annotation: Schema<Annotation>;
5
+ export declare const s3: Schema<Declaration>;
6
+ export declare const fs: Schema<Declaration>;
7
+ export declare const mem: Schema<Declaration>;
8
+ export declare const tmp: Schema<Declaration>;
9
+ export declare const test: Schema<Declaration>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.test = exports.tmp = exports.mem = exports.fs = exports.s3 = exports.annotation = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const schemas_1 = require("@toa.io/schemas");
6
+ const path = (0, node_path_1.resolve)(__dirname, '../schemas');
7
+ const ns = (0, schemas_1.namespace)(path);
8
+ exports.annotation = ns.schema('annotation');
9
+ exports.s3 = ns.schema('s3');
10
+ exports.fs = ns.schema('fs');
11
+ exports.mem = ns.schema('mem');
12
+ exports.tmp = ns.schema('tmp');
13
+ exports.test = ns.schema('test');
14
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":";;;AAAA,yCAAmC;AACnC,6CAA2C;AAK3C,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AAC7C,MAAM,EAAE,GAAG,IAAA,mBAAS,EAAC,IAAI,CAAC,CAAA;AAEb,QAAA,UAAU,GAAuB,EAAE,CAAC,MAAM,CAAa,YAAY,CAAC,CAAA;AACpE,QAAA,EAAE,GAAwB,EAAE,CAAC,MAAM,CAAc,IAAI,CAAC,CAAA;AACtD,QAAA,EAAE,GAAwB,EAAE,CAAC,MAAM,CAAc,IAAI,CAAC,CAAA;AACtD,QAAA,GAAG,GAAwB,EAAE,CAAC,MAAM,CAAc,KAAK,CAAC,CAAA;AACxD,QAAA,GAAG,GAAwB,EAAE,CAAC,MAAM,CAAc,KAAK,CAAC,CAAA;AACxD,QAAA,IAAI,GAAwB,EAAE,CAAC,MAAM,CAAc,MAAM,CAAC,CAAA"}
@@ -0,0 +1,29 @@
1
+ export declare const suites: ({
2
+ run: true;
3
+ provider: "tmp";
4
+ options: {
5
+ directory: string;
6
+ endpoint?: undefined;
7
+ region?: undefined;
8
+ bucket?: undefined;
9
+ };
10
+ secrets?: undefined;
11
+ } | {
12
+ run: true;
13
+ provider: "mem";
14
+ options?: undefined;
15
+ secrets?: undefined;
16
+ } | {
17
+ run: boolean;
18
+ provider: "s3";
19
+ options: {
20
+ endpoint: string;
21
+ region: string;
22
+ bucket: string;
23
+ directory?: undefined;
24
+ };
25
+ secrets: {
26
+ ACCESS_KEY_ID: string;
27
+ SECRET_ACCESS_KEY: string;
28
+ };
29
+ })[];
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.suites = void 0;
7
+ const node_path_1 = require("node:path");
8
+ const dotenv_1 = __importDefault(require("dotenv"));
9
+ dotenv_1.default.config({ path: (0, node_path_1.join)(__dirname, '.env') });
10
+ exports.suites = [
11
+ {
12
+ run: true,
13
+ provider: 'tmp',
14
+ options: {
15
+ directory: 'toa-storages-temp'
16
+ }
17
+ },
18
+ {
19
+ run: true,
20
+ provider: 'mem'
21
+ },
22
+ {
23
+ run: process.env.RUN_S3 === '1',
24
+ provider: 's3',
25
+ options: {
26
+ endpoint: 'http://localhost:4566',
27
+ region: 'us-west-1',
28
+ bucket: 'test-bucket'
29
+ },
30
+ secrets: {
31
+ ACCESS_KEY_ID: 'developer',
32
+ SECRET_ACCESS_KEY: 'secret'
33
+ }
34
+ }
35
+ // add more providers here, use `run` as a condition to run the test
36
+ // e.g.: `run: process.env.ACCESS_KEY_ID !== undefined`
37
+ ];
38
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../source/test/util.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAgC;AAChC,oDAA2B;AAO3B,gBAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAA,gBAAI,EAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;AAEnC,QAAA,MAAM,GAAG;IACpB;QACE,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE;YACP,SAAS,EAAE,mBAAmB;SAC/B;KACF;IACD;QACE,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,KAAK;KAChB;IACD;QACE,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG;QAC/B,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACP,QAAQ,EAAE,uBAAuB;YACjC,MAAM,EAAE,WAAW;YACnB,MAAM,EAAE,aAAa;SACtB;QACD,OAAO,EAAE;YACP,aAAa,EAAE,WAAW;YAC1B,iBAAiB,EAAE,QAAQ;SAC5B;KACF;IACD,oEAAoE;IACpE,uDAAuD;CACtC,CAAA"}