@riocrypto/common-server 1.0.562 → 1.0.563
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.
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildGCloudStorageClient = exports.GCloudStorageClient = void 0;
|
|
13
|
+
const storage_1 = require("@google-cloud/storage");
|
|
14
|
+
const secret_manager_client_1 = require("./secret-manager-client");
|
|
15
|
+
class GCloudStorageClient {
|
|
16
|
+
constructor(bucket) {
|
|
17
|
+
const storage = new storage_1.Storage({
|
|
18
|
+
keyFilename: "/etc/secrets/secret-manager-service-account-key.json",
|
|
19
|
+
});
|
|
20
|
+
this._client = storage.bucket(bucket);
|
|
21
|
+
}
|
|
22
|
+
get client() {
|
|
23
|
+
return this._client;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.GCloudStorageClient = GCloudStorageClient;
|
|
27
|
+
const buildGCloudStorageClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
const BUCKET = yield secret_manager_client_1.secretManagerClient.getSecretValue("BUCKET");
|
|
29
|
+
if (!BUCKET) {
|
|
30
|
+
throw new Error("Unable to get BUCKET");
|
|
31
|
+
}
|
|
32
|
+
return new GCloudStorageClient(BUCKET);
|
|
33
|
+
});
|
|
34
|
+
exports.buildGCloudStorageClient = buildGCloudStorageClient;
|
package/build/index.d.ts
CHANGED
|
@@ -37,6 +37,6 @@ export * from "./clients/fireblocks-client";
|
|
|
37
37
|
export * from "./clients/kapstar-client";
|
|
38
38
|
export * from "./clients/etherscan-client";
|
|
39
39
|
export * from "./clients/rio-client";
|
|
40
|
-
export * from "./clients/s3-client";
|
|
41
40
|
export * from "./clients/secret-manager-client";
|
|
41
|
+
export * from "./clients/gcloud-storage-client";
|
|
42
42
|
export * from "./helpers/get-user-helper";
|
package/build/index.js
CHANGED
|
@@ -53,6 +53,6 @@ __exportStar(require("./clients/fireblocks-client"), exports);
|
|
|
53
53
|
__exportStar(require("./clients/kapstar-client"), exports);
|
|
54
54
|
__exportStar(require("./clients/etherscan-client"), exports);
|
|
55
55
|
__exportStar(require("./clients/rio-client"), exports);
|
|
56
|
-
__exportStar(require("./clients/s3-client"), exports);
|
|
57
56
|
__exportStar(require("./clients/secret-manager-client"), exports);
|
|
57
|
+
__exportStar(require("./clients/gcloud-storage-client"), exports);
|
|
58
58
|
__exportStar(require("./helpers/get-user-helper"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.563",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
|
-
"@
|
|
25
|
+
"@google-cloud/storage": "^6.9.5",
|
|
26
|
+
"@riocrypto/common": "^1.0.552",
|
|
26
27
|
"@types/express": "^4.17.13",
|
|
27
28
|
"axios": "^0.27.2",
|
|
28
29
|
"ccxt": "^3.0.30",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.buildS3Client = exports.s3 = void 0;
|
|
13
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
14
|
-
const secret_manager_client_1 = require("./secret-manager-client");
|
|
15
|
-
class s3 {
|
|
16
|
-
constructor(endpoint, region, accessKey, secretKey) {
|
|
17
|
-
this._client = new client_s3_1.S3Client({
|
|
18
|
-
endpoint,
|
|
19
|
-
forcePathStyle: false,
|
|
20
|
-
region,
|
|
21
|
-
credentials: {
|
|
22
|
-
accessKeyId: accessKey,
|
|
23
|
-
secretAccessKey: secretKey, // Secret access key defined through an environment variable.
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
get client() {
|
|
28
|
-
return this._client;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.s3 = s3;
|
|
32
|
-
const buildS3Client = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
const S3_ENDPOINT = yield secret_manager_client_1.secretManagerClient.getSecretValue("S3_ENDPOINT");
|
|
34
|
-
if (!S3_ENDPOINT) {
|
|
35
|
-
throw new Error("Unable to get S3_ENDPOINT");
|
|
36
|
-
}
|
|
37
|
-
const S3_ACCESS_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("S3_ACCESS_KEY");
|
|
38
|
-
if (!S3_ACCESS_KEY) {
|
|
39
|
-
throw new Error("Unable to get S3_ACCESS_KEY");
|
|
40
|
-
}
|
|
41
|
-
const S3_SECRET_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("S3_SECRET_KEY");
|
|
42
|
-
if (!S3_SECRET_KEY) {
|
|
43
|
-
throw new Error("Unable to get S3_SECRET_KEY");
|
|
44
|
-
}
|
|
45
|
-
const S3_REGION = yield secret_manager_client_1.secretManagerClient.getSecretValue("S3_REGION");
|
|
46
|
-
if (!S3_REGION) {
|
|
47
|
-
throw new Error("Unable to get S3_REGION");
|
|
48
|
-
}
|
|
49
|
-
return new s3(S3_ENDPOINT, S3_REGION, S3_ACCESS_KEY, S3_SECRET_KEY);
|
|
50
|
-
});
|
|
51
|
-
exports.buildS3Client = buildS3Client;
|