triangle-utils 1.4.132 → 1.4.133
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/src/UtilsRDS.d.ts +1 -2
- package/dist/src/UtilsRDS.js +1 -12
- package/package.json +1 -1
- package/src/UtilsRDS.ts +1 -12
package/dist/src/UtilsRDS.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Client } from "pg";
|
|
2
1
|
export declare class UtilsRDS {
|
|
3
2
|
private readonly postgres;
|
|
4
3
|
private is_connected;
|
|
@@ -6,7 +5,7 @@ export declare class UtilsRDS {
|
|
|
6
5
|
private readonly rds_cluster_arn;
|
|
7
6
|
private readonly rds_secret_arn;
|
|
8
7
|
constructor(region: string, rds_cluster_arn: string, rds_secret_arn: string, rds_host: string, rds_username: string, rds_password: string);
|
|
9
|
-
connect(): Promise<
|
|
8
|
+
connect(): Promise<void>;
|
|
10
9
|
disconnect(): Promise<void>;
|
|
11
10
|
query(sql: string, options?: {
|
|
12
11
|
is_verbose?: boolean;
|
package/dist/src/UtilsRDS.js
CHANGED
|
@@ -43,27 +43,16 @@ export class UtilsRDS {
|
|
|
43
43
|
this.rds_secret_arn = rds_secret_arn;
|
|
44
44
|
}
|
|
45
45
|
async connect() {
|
|
46
|
-
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this.is_connected = true;
|
|
50
|
-
return await this.postgres.connect();
|
|
46
|
+
await this.postgres.connect();
|
|
51
47
|
}
|
|
52
48
|
async disconnect() {
|
|
53
49
|
await this.postgres.end();
|
|
54
|
-
this.is_connected = false;
|
|
55
50
|
}
|
|
56
51
|
async query(sql, options = {}) {
|
|
57
52
|
const is_verbose = Boolean(options.is_verbose);
|
|
58
53
|
if (is_verbose) {
|
|
59
54
|
console.log(sql);
|
|
60
55
|
}
|
|
61
|
-
if (!this.is_connected) {
|
|
62
|
-
const response_connect = await this.connect();
|
|
63
|
-
if (is_verbose) {
|
|
64
|
-
console.log(response_connect);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
56
|
const response = await this.postgres.query(sql);
|
|
68
57
|
return response.rows.map(item => Object.fromEntries(Object.entries(item).filter(([key, value]) => value !== null)));
|
|
69
58
|
}
|
package/package.json
CHANGED
package/src/UtilsRDS.ts
CHANGED
|
@@ -51,16 +51,11 @@ export class UtilsRDS {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
async connect() {
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
this.is_connected = true
|
|
58
|
-
return await this.postgres.connect()
|
|
54
|
+
await this.postgres.connect()
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
async disconnect() {
|
|
62
58
|
await this.postgres.end()
|
|
63
|
-
this.is_connected = false
|
|
64
59
|
}
|
|
65
60
|
|
|
66
61
|
async query(
|
|
@@ -73,12 +68,6 @@ export class UtilsRDS {
|
|
|
73
68
|
if (is_verbose) {
|
|
74
69
|
console.log(sql)
|
|
75
70
|
}
|
|
76
|
-
if (!this.is_connected) {
|
|
77
|
-
const response_connect = await this.connect()
|
|
78
|
-
if (is_verbose) {
|
|
79
|
-
console.log(response_connect)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
71
|
const response = await this.postgres.query(sql)
|
|
83
72
|
return response.rows.map(item => Object.fromEntries(Object.entries(item).filter(([key, value]) => value !== null)))
|
|
84
73
|
}
|