@adtrackify/at-service-common 3.0.43 → 3.0.44
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/clients/generic/singlestore-db-client.d.ts +3 -3
- package/dist/cjs/clients/generic/singlestore-db-client.js +17 -23
- package/dist/cjs/clients/generic/singlestore-db-client.js.map +1 -1
- package/dist/esm/clients/generic/singlestore-db-client.d.ts +3 -3
- package/dist/esm/clients/generic/singlestore-db-client.js +16 -21
- package/dist/esm/clients/generic/singlestore-db-client.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as mysql from 'mysql2/promise';
|
|
2
|
-
export declare const getPool: () => mysql.Pool;
|
|
3
2
|
export declare class SingleStoreDBClient {
|
|
4
|
-
|
|
5
|
-
constructor();
|
|
3
|
+
_pool: mysql.Pool;
|
|
4
|
+
constructor(host: string, user: string, password: string, database: string, port: string);
|
|
5
|
+
private getPool;
|
|
6
6
|
private getConnection;
|
|
7
7
|
executeQuery(query: string, values?: any): Promise<{
|
|
8
8
|
rows: mysql.QueryResult;
|
|
@@ -23,37 +23,31 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.SingleStoreDBClient =
|
|
26
|
+
exports.SingleStoreDBClient = void 0;
|
|
27
27
|
const mysql = __importStar(require("mysql2/promise"));
|
|
28
28
|
const helpers_1 = require("../../helpers");
|
|
29
|
-
const host = process.env.SINGLESTORE_HOST;
|
|
30
|
-
const user = process.env.SINGLESTORE_USER;
|
|
31
|
-
const password = process.env.SINGLESTORE_PASSWORD;
|
|
32
|
-
const database = process.env.SINGLESTORE_DATABASE;
|
|
33
|
-
const port = process.env.SINGLESTORE_PORT;
|
|
34
|
-
const getPool = () => {
|
|
35
|
-
let pool = null;
|
|
36
|
-
pool = mysql.createPool({
|
|
37
|
-
host: host,
|
|
38
|
-
port: +port,
|
|
39
|
-
user: user,
|
|
40
|
-
password: password,
|
|
41
|
-
database: database,
|
|
42
|
-
multipleStatements: true,
|
|
43
|
-
});
|
|
44
|
-
return pool;
|
|
45
|
-
};
|
|
46
|
-
exports.getPool = getPool;
|
|
47
|
-
const _pool = (0, exports.getPool)();
|
|
48
29
|
class SingleStoreDBClient {
|
|
49
|
-
|
|
50
|
-
constructor() {
|
|
30
|
+
_pool;
|
|
31
|
+
constructor(host, user, password, database, port) {
|
|
51
32
|
if (!host || !user || !password || !database || !port) {
|
|
52
33
|
throw new Error('SingleStore env values not found');
|
|
53
34
|
}
|
|
35
|
+
this._pool = this.getPool(host, user, password, database, port);
|
|
36
|
+
}
|
|
37
|
+
getPool(host, user, password, database, port) {
|
|
38
|
+
let pool = null;
|
|
39
|
+
pool = mysql.createPool({
|
|
40
|
+
host: host,
|
|
41
|
+
port: +port,
|
|
42
|
+
user: user,
|
|
43
|
+
password: password,
|
|
44
|
+
database: database,
|
|
45
|
+
multipleStatements: true,
|
|
46
|
+
});
|
|
47
|
+
return pool;
|
|
54
48
|
}
|
|
55
49
|
async getConnection() {
|
|
56
|
-
return _pool;
|
|
50
|
+
return this._pool;
|
|
57
51
|
}
|
|
58
52
|
async executeQuery(query, values) {
|
|
59
53
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singlestore-db-client.js","sourceRoot":"","sources":["../../../../src/clients/generic/singlestore-db-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,2CAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"singlestore-db-client.js","sourceRoot":"","sources":["../../../../src/clients/generic/singlestore-db-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,2CAAuC;AAEvC,MAAa,mBAAmB;IAC9B,KAAK,CAAa;IAElB,YAAY,IAAY,EAAE,IAAY,EAAE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AAC,OAAO,KAAK,EAAE;YACd,gBAAM,CAAC,KAAK,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACxD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;SAC3B;IACH,CAAC;CACF;AAzCD,kDAyCC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as mysql from 'mysql2/promise';
|
|
2
|
-
export declare const getPool: () => mysql.Pool;
|
|
3
2
|
export declare class SingleStoreDBClient {
|
|
4
|
-
|
|
5
|
-
constructor();
|
|
3
|
+
_pool: mysql.Pool;
|
|
4
|
+
constructor(host: string, user: string, password: string, database: string, port: string);
|
|
5
|
+
private getPool;
|
|
6
6
|
private getConnection;
|
|
7
7
|
executeQuery(query: string, values?: any): Promise<{
|
|
8
8
|
rows: mysql.QueryResult;
|
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
import * as mysql from 'mysql2/promise';
|
|
2
2
|
import { Logger } from '../../helpers';
|
|
3
|
-
const host = process.env.SINGLESTORE_HOST;
|
|
4
|
-
const user = process.env.SINGLESTORE_USER;
|
|
5
|
-
const password = process.env.SINGLESTORE_PASSWORD;
|
|
6
|
-
const database = process.env.SINGLESTORE_DATABASE;
|
|
7
|
-
const port = process.env.SINGLESTORE_PORT;
|
|
8
|
-
export const getPool = () => {
|
|
9
|
-
let pool = null;
|
|
10
|
-
pool = mysql.createPool({
|
|
11
|
-
host: host,
|
|
12
|
-
port: +port,
|
|
13
|
-
user: user,
|
|
14
|
-
password: password,
|
|
15
|
-
database: database,
|
|
16
|
-
multipleStatements: true,
|
|
17
|
-
});
|
|
18
|
-
return pool;
|
|
19
|
-
};
|
|
20
|
-
const _pool = getPool();
|
|
21
3
|
export class SingleStoreDBClient {
|
|
22
|
-
|
|
23
|
-
constructor() {
|
|
4
|
+
_pool;
|
|
5
|
+
constructor(host, user, password, database, port) {
|
|
24
6
|
if (!host || !user || !password || !database || !port) {
|
|
25
7
|
throw new Error('SingleStore env values not found');
|
|
26
8
|
}
|
|
9
|
+
this._pool = this.getPool(host, user, password, database, port);
|
|
10
|
+
}
|
|
11
|
+
getPool(host, user, password, database, port) {
|
|
12
|
+
let pool = null;
|
|
13
|
+
pool = mysql.createPool({
|
|
14
|
+
host: host,
|
|
15
|
+
port: +port,
|
|
16
|
+
user: user,
|
|
17
|
+
password: password,
|
|
18
|
+
database: database,
|
|
19
|
+
multipleStatements: true,
|
|
20
|
+
});
|
|
21
|
+
return pool;
|
|
27
22
|
}
|
|
28
23
|
async getConnection() {
|
|
29
|
-
return _pool;
|
|
24
|
+
return this._pool;
|
|
30
25
|
}
|
|
31
26
|
async executeQuery(query, values) {
|
|
32
27
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singlestore-db-client.js","sourceRoot":"","sources":["../../../../src/clients/generic/singlestore-db-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,
|
|
1
|
+
{"version":3,"file":"singlestore-db-client.js","sourceRoot":"","sources":["../../../../src/clients/generic/singlestore-db-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,OAAO,mBAAmB;IAC9B,KAAK,CAAa;IAElB,YAAY,IAAY,EAAE,IAAY,EAAE,QAAgB,EAAE,QAAgB,EAAE,IAAY;QACtF,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE;YACrD,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACrD;QAED,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EA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