triangle-utils 1.4.134 → 1.4.135

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.
@@ -13,6 +13,9 @@ function convert_rds_input(input) {
13
13
  else if (typeof input === "boolean") {
14
14
  return input.toString().toUpperCase();
15
15
  }
16
+ else if (Array.isArray(input)) {
17
+ return "ARRAY[" + input.map(a => convert_rds_input(a)).join(", ") + "]";
18
+ }
16
19
  else if (typeof input === "object") {
17
20
  if (input.expression !== undefined) {
18
21
  return input.expression;
@@ -33,6 +36,14 @@ function convert_rds_output(input) {
33
36
  else if (input.booleanValue !== undefined) {
34
37
  return input.booleanValue;
35
38
  }
39
+ else if (input.arrayValue !== undefined) {
40
+ return [
41
+ ...(input.arrayValue.stringValues || []),
42
+ ...(input.arrayValue.longValues || []),
43
+ ...(input.arrayValue.booleanValues || [])
44
+ ]
45
+ .filter(value => value !== null);
46
+ }
36
47
  return undefined;
37
48
  }
38
49
  export class UtilsRDS {
package/dist/src/f.js CHANGED
@@ -67,7 +67,10 @@ const utils = new TriangleUtils(config);
67
67
  // }, { is_verbose : true })
68
68
  // console.log(response)
69
69
  // }
70
- await utils.rds.connect();
71
- const lal_file_voters = await utils.rds.query("SELECT lal_file_voter_id, address_residence_city, address_residence_latitude, address_residence_longitude, address_residence_property_sqft FROM lal_file_voters LIMIT 3;");
72
- console.log(lal_file_voters);
73
- await utils.rds.disconnect();
70
+ // console.log(await utils.rds.put("prisms", {
71
+ // prism_id : crypto.randomUUID(),
72
+ // state_id : "ND",
73
+ // name : "2026 Election in North Dakota",
74
+ // target_ids : ["TURNOUT-2026-11-03"]
75
+ // }, { is_verbose : true }))
76
+ // console.log(await utils.rds.exec("SELECT * FROM prisms", { is_verbose : true }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.134",
3
+ "version": "1.4.135",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/UtilsRDS.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Field, RDSData } from "@aws-sdk/client-rds-data"
2
2
  import { Client } from "pg"
3
3
 
4
- function convert_rds_input(input : string | boolean | number | Record<string, any> | undefined) : string {
4
+ function convert_rds_input(input : string | boolean | number | any[] | Record<string, any> | undefined) : string {
5
5
  if (input === undefined) {
6
6
  return "NULL"
7
7
  } else if (typeof input === "string") {
@@ -10,6 +10,8 @@ function convert_rds_input(input : string | boolean | number | Record<string, an
10
10
  return input.toString()
11
11
  } else if (typeof input === "boolean") {
12
12
  return input.toString().toUpperCase()
13
+ } else if (Array.isArray(input)) {
14
+ return "ARRAY[" + input.map(a => convert_rds_input(a)).join(", ") + "]"
13
15
  } else if (typeof input === "object") {
14
16
  if (input.expression !== undefined) {
15
17
  return input.expression
@@ -27,6 +29,13 @@ function convert_rds_output(input : Field) {
27
29
  return input.longValue
28
30
  } else if (input.booleanValue !== undefined) {
29
31
  return input.booleanValue
32
+ } else if (input.arrayValue !== undefined) {
33
+ return [
34
+ ...(input.arrayValue.stringValues || []),
35
+ ...(input.arrayValue.longValues || []),
36
+ ...(input.arrayValue.booleanValues || [])
37
+ ]
38
+ .filter(value => value !== null)
30
39
  }
31
40
  return undefined
32
41
  }
package/src/f.ts CHANGED
@@ -84,7 +84,11 @@ const utils = new TriangleUtils(config)
84
84
  // console.log(response)
85
85
  // }
86
86
 
87
- await utils.rds.connect()
88
- const lal_file_voters = await utils.rds.query("SELECT lal_file_voter_id, address_residence_city, address_residence_latitude, address_residence_longitude, address_residence_property_sqft FROM lal_file_voters LIMIT 3;")
89
- console.log(lal_file_voters)
90
- await utils.rds.disconnect()
87
+ // console.log(await utils.rds.put("prisms", {
88
+ // prism_id : crypto.randomUUID(),
89
+ // state_id : "ND",
90
+ // name : "2026 Election in North Dakota",
91
+ // target_ids : ["TURNOUT-2026-11-03"]
92
+ // }, { is_verbose : true }))
93
+
94
+ // console.log(await utils.rds.exec("SELECT * FROM prisms", { is_verbose : true }))