triangle-utils 1.4.128 → 1.4.130

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.
@@ -10,7 +10,9 @@ export declare class UtilsRDS {
10
10
  disconnect(): Promise<void>;
11
11
  query(sql: string, options?: {
12
12
  is_verbose?: boolean;
13
- }): Promise<any[]>;
13
+ }): Promise<{
14
+ [k: string]: unknown;
15
+ }[]>;
14
16
  exec(sql: string, options?: {
15
17
  is_verbose?: boolean;
16
18
  }): Promise<any[]>;
@@ -63,7 +63,7 @@ export class UtilsRDS {
63
63
  }
64
64
  }
65
65
  const response = await this.postgres.query(sql);
66
- return response.rows;
66
+ return response.rows.map(item => Object.fromEntries(Object.entries(item).filter(([key, value]) => value !== null)));
67
67
  }
68
68
  async exec(sql, options = {}) {
69
69
  const is_verbose = Boolean(options.is_verbose);
@@ -79,6 +79,7 @@ export class UtilsRDS {
79
79
  formatRecordsAs: "JSON"
80
80
  })
81
81
  .then(response => JSON.parse(response.formattedRecords || "[]"))
82
+ .then(items => items.map((item) => Object.fromEntries(Object.entries(item).filter(([key, value]) => value !== null))))
82
83
  :
83
84
  await this.query(sql, options);
84
85
  if (!Array.isArray(items)) {
package/dist/src/f.js CHANGED
@@ -67,3 +67,5 @@ const utils = new TriangleUtils(config);
67
67
  // }, { is_verbose : true })
68
68
  // console.log(response)
69
69
  // }
70
+ const lal_file_voters = await utils.rds.query("SELECT * FROM lal_file_voters LIMIT 3;");
71
+ console.log(lal_file_voters);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.128",
3
+ "version": "1.4.130",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/UtilsRDS.ts CHANGED
@@ -78,7 +78,7 @@ export class UtilsRDS {
78
78
  }
79
79
  }
80
80
  const response = await this.postgres.query(sql)
81
- return response.rows
81
+ return response.rows.map(item => Object.fromEntries(Object.entries(item).filter(([key, value]) => value !== null)))
82
82
  }
83
83
 
84
84
  async exec(
@@ -100,6 +100,7 @@ export class UtilsRDS {
100
100
  formatRecordsAs : "JSON"
101
101
  })
102
102
  .then(response => JSON.parse(response.formattedRecords || "[]"))
103
+ .then(items => items.map((item : any) => Object.fromEntries(Object.entries(item).filter(([key, value]) => value !== null))))
103
104
  :
104
105
  await this.query(sql, options)
105
106
  if (!Array.isArray(items)) {
package/src/f.ts CHANGED
@@ -82,4 +82,7 @@ const utils = new TriangleUtils(config)
82
82
  // }
83
83
  // }, { is_verbose : true })
84
84
  // console.log(response)
85
- // }
85
+ // }
86
+
87
+ const lal_file_voters = await utils.rds.query("SELECT * FROM lal_file_voters LIMIT 3;")
88
+ console.log(lal_file_voters)