triangle-utils 1.4.129 → 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.
- package/dist/src/UtilsRDS.d.ts +11 -25
- package/dist/src/UtilsRDS.js +3 -2
- package/dist/src/f.js +2 -0
- package/package.json +1 -1
- package/src/UtilsRDS.ts +3 -2
- package/src/f.ts +4 -1
package/dist/src/UtilsRDS.d.ts
CHANGED
|
@@ -10,48 +10,34 @@ export declare class UtilsRDS {
|
|
|
10
10
|
disconnect(): Promise<void>;
|
|
11
11
|
query(sql: string, options?: {
|
|
12
12
|
is_verbose?: boolean;
|
|
13
|
-
}): Promise<import("pg").QueryResult<any>>;
|
|
14
|
-
exec(sql: string, options?: {
|
|
15
|
-
is_verbose?: boolean;
|
|
16
13
|
}): Promise<{
|
|
17
14
|
[k: string]: unknown;
|
|
18
15
|
}[]>;
|
|
16
|
+
exec(sql: string, options?: {
|
|
17
|
+
is_verbose?: boolean;
|
|
18
|
+
}): Promise<any[]>;
|
|
19
19
|
get(table_id: string, primary_key: Record<string, any>, attribute_names?: string[], options?: {
|
|
20
20
|
is_verbose?: boolean;
|
|
21
|
-
}): Promise<Record<string, any
|
|
21
|
+
}): Promise<Record<string, any> | undefined>;
|
|
22
22
|
batch_get(table_id: string, primary_key: Record<string, any[]>, attribute_names?: string[], options?: {
|
|
23
23
|
is_verbose?: boolean;
|
|
24
|
-
}): Promise<
|
|
25
|
-
[k: string]: unknown;
|
|
26
|
-
}[]>;
|
|
24
|
+
}): Promise<any[]>;
|
|
27
25
|
create(table_id: string, item: Record<string, any>, options?: {
|
|
28
26
|
is_verbose?: boolean;
|
|
29
|
-
}): Promise<
|
|
30
|
-
[k: string]: unknown;
|
|
31
|
-
}[] | undefined>;
|
|
27
|
+
}): Promise<any[] | undefined>;
|
|
32
28
|
batch_create(table_id: string, items: Record<string, any>[], options?: {
|
|
33
29
|
is_verbose?: boolean;
|
|
34
|
-
}): Promise<
|
|
35
|
-
[k: string]: unknown;
|
|
36
|
-
}[] | undefined>;
|
|
30
|
+
}): Promise<any[] | undefined>;
|
|
37
31
|
put(table_id: string, item: Record<string, any>, options?: {
|
|
38
32
|
is_verbose?: boolean;
|
|
39
|
-
}): Promise<
|
|
40
|
-
[k: string]: unknown;
|
|
41
|
-
}[] | undefined>;
|
|
33
|
+
}): Promise<any[] | undefined>;
|
|
42
34
|
batch_put(table_id: string, items: Record<string, any>[], options?: {
|
|
43
35
|
is_verbose?: boolean;
|
|
44
|
-
}): Promise<
|
|
45
|
-
[k: string]: unknown;
|
|
46
|
-
}[] | undefined>;
|
|
36
|
+
}): Promise<any[] | undefined>;
|
|
47
37
|
delete(table_id: string, primary_key: Record<string, any>, options?: {
|
|
48
38
|
is_verbose?: boolean;
|
|
49
|
-
}): Promise<
|
|
50
|
-
[k: string]: unknown;
|
|
51
|
-
}[]>;
|
|
39
|
+
}): Promise<any[]>;
|
|
52
40
|
batch_delete(table_id: string, primary_key: Record<string, any[]>, options?: {
|
|
53
41
|
is_verbose?: boolean;
|
|
54
|
-
}): Promise<
|
|
55
|
-
[k: string]: unknown;
|
|
56
|
-
}[]>;
|
|
42
|
+
}): Promise<any[]>;
|
|
57
43
|
}
|
package/dist/src/UtilsRDS.js
CHANGED
|
@@ -63,7 +63,7 @@ export class UtilsRDS {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
const response = await this.postgres.query(sql);
|
|
66
|
-
return response;
|
|
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)) {
|
|
@@ -87,7 +88,7 @@ export class UtilsRDS {
|
|
|
87
88
|
}
|
|
88
89
|
return [];
|
|
89
90
|
}
|
|
90
|
-
return items
|
|
91
|
+
return items;
|
|
91
92
|
}
|
|
92
93
|
async get(table_id, primary_key, attribute_names, options = {}) {
|
|
93
94
|
const sql = "SELECT " + (attribute_names === undefined ? "*" : attribute_names.join(", ")) + " FROM " + table_id + " WHERE " + Object.entries(primary_key).map(([key_name, value]) => key_name + " = " + convert_rds_input(value)).join(" AND ");
|
package/dist/src/f.js
CHANGED
package/package.json
CHANGED
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
|
|
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)) {
|
|
@@ -108,7 +109,7 @@ export class UtilsRDS {
|
|
|
108
109
|
}
|
|
109
110
|
return []
|
|
110
111
|
}
|
|
111
|
-
return items
|
|
112
|
+
return items
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
async get(
|
package/src/f.ts
CHANGED