@riocrypto/common-server 1.0.1002 → 1.0.1004
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,9 @@
|
|
|
1
|
+
import { RioEnv } from "@riocrypto/common";
|
|
2
|
+
declare class GoogleSheetsAPIClient {
|
|
3
|
+
private env;
|
|
4
|
+
googleAuth: any;
|
|
5
|
+
constructor(env: RioEnv);
|
|
6
|
+
getSheetValues(sheetId: string, range: string): Promise<any[][] | null | undefined>;
|
|
7
|
+
}
|
|
8
|
+
export declare const googleSheetsAPIClient: GoogleSheetsAPIClient;
|
|
9
|
+
export {};
|
|
@@ -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.googleSheetsAPIClient = void 0;
|
|
13
|
+
const googleapis_1 = require("googleapis");
|
|
14
|
+
class GoogleSheetsAPIClient {
|
|
15
|
+
constructor(env) {
|
|
16
|
+
this.env = env;
|
|
17
|
+
this.googleAuth = new googleapis_1.google.auth.GoogleAuth({
|
|
18
|
+
keyFile: "/etc/secrets/google-sheets/google-sheets-service-account-key.json",
|
|
19
|
+
scopes: ["https://www.googleapis.com/auth/spreadsheets"],
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
getSheetValues(sheetId, range) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const authClientObject = yield this.googleAuth.getClient();
|
|
25
|
+
const sheets = googleapis_1.google.sheets({ version: "v4", auth: authClientObject });
|
|
26
|
+
const response = yield sheets.spreadsheets.values.get({
|
|
27
|
+
spreadsheetId: sheetId,
|
|
28
|
+
range,
|
|
29
|
+
});
|
|
30
|
+
return response.data.values;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.googleSheetsAPIClient = new GoogleSheetsAPIClient(process.env.RIO_ENV || process.env.NEXT_PUBLIC_RIO_ENV);
|
package/build/index.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export * from "./clients/gcloud-storage-client";
|
|
|
52
52
|
export * from "./clients/currency-api-client";
|
|
53
53
|
export * from "./clients/aiprise-client";
|
|
54
54
|
export * from "./clients/bridge-client";
|
|
55
|
+
export * from "./clients/google-sheets-api-client";
|
|
55
56
|
export * from "./helpers/get-user-helper";
|
|
56
57
|
export * from "./helpers/get-platform-and-partner-fees";
|
|
57
58
|
export * from "./helpers/get-processor-fees";
|
package/build/index.js
CHANGED
|
@@ -68,6 +68,7 @@ __exportStar(require("./clients/gcloud-storage-client"), exports);
|
|
|
68
68
|
__exportStar(require("./clients/currency-api-client"), exports);
|
|
69
69
|
__exportStar(require("./clients/aiprise-client"), exports);
|
|
70
70
|
__exportStar(require("./clients/bridge-client"), exports);
|
|
71
|
+
__exportStar(require("./clients/google-sheets-api-client"), exports);
|
|
71
72
|
__exportStar(require("./helpers/get-user-helper"), exports);
|
|
72
73
|
__exportStar(require("./helpers/get-platform-and-partner-fees"), exports);
|
|
73
74
|
__exportStar(require("./helpers/get-processor-fees"), 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.1004",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -24,13 +24,15 @@
|
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
25
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
26
26
|
"@google-cloud/storage": "^6.9.5",
|
|
27
|
-
"@riocrypto/common": "^1.0.
|
|
27
|
+
"@riocrypto/common": "^1.0.867",
|
|
28
28
|
"@types/express": "^4.17.13",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"ccxt": "^3.0.30",
|
|
31
31
|
"express": "^4.18.1",
|
|
32
32
|
"express-validator": "^6.14.2",
|
|
33
33
|
"fireblocks-sdk": "^4.0.0",
|
|
34
|
+
"google-auth-library": "^9.0.0",
|
|
35
|
+
"googleapis": "^123.0.0",
|
|
34
36
|
"jsonwebtoken": "^8.5.1",
|
|
35
37
|
"mongoose": "^7.0.2",
|
|
36
38
|
"node-cache": "^5.1.2",
|