triangle-utils 1.4.135 → 1.4.136

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.
@@ -12,10 +12,12 @@ export declare class UtilsRDS {
12
12
  exec(sql: string, options?: {
13
13
  is_verbose?: boolean;
14
14
  }): Promise<any[]>;
15
- get(table_id: string, primary_key: Record<string, any>, attribute_names?: string[], options?: {
15
+ get(table_id: string, primary_key: Record<string, any>, options?: {
16
+ attribute_names?: string[];
16
17
  is_verbose?: boolean;
17
18
  }): Promise<Record<string, any> | undefined>;
18
- batch_get(table_id: string, primary_key: Record<string, any[]>, attribute_names?: string[], options?: {
19
+ batch_get(table_id: string, primary_key: Record<string, any[]>, options?: {
20
+ attribute_names?: string[];
19
21
  is_verbose?: boolean;
20
22
  }): Promise<any[]>;
21
23
  create(table_id: string, item: Record<string, any>, options?: {
@@ -112,14 +112,14 @@ export class UtilsRDS {
112
112
  }
113
113
  return items;
114
114
  }
115
- async get(table_id, primary_key, attribute_names, options = {}) {
116
- 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 ");
115
+ async get(table_id, primary_key, options = {}) {
116
+ const sql = "SELECT " + (options.attribute_names === undefined ? "*" : options.attribute_names.join(", ")) + " FROM " + table_id + " WHERE " + Object.entries(primary_key).map(([key_name, value]) => key_name + " = " + convert_rds_input(value)).join(" AND ");
117
117
  const items = await this.exec(sql, options);
118
118
  const item = items[0];
119
119
  return item;
120
120
  }
121
- async batch_get(table_id, primary_key, attribute_names, options = {}) {
122
- const sql = "SELECT " + (attribute_names === undefined ? "*" : attribute_names.join(", ")) + " FROM " + table_id + " WHERE " + Object.entries(primary_key).map(([key_name, values]) => key_name + " IN " + "(" + values.map(value => convert_rds_input(value)).join(", ") + ")").join(" AND ");
121
+ async batch_get(table_id, primary_key, options = {}) {
122
+ const sql = "SELECT " + (options.attribute_names === undefined ? "*" : options.attribute_names.join(", ")) + " FROM " + table_id + " WHERE " + Object.entries(primary_key).map(([key_name, values]) => key_name + " IN " + "(" + values.map(value => convert_rds_input(value)).join(", ") + ")").join(" AND ");
123
123
  const items = await this.exec(sql, options);
124
124
  return items;
125
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.135",
3
+ "version": "1.4.136",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/UtilsRDS.ts CHANGED
@@ -137,12 +137,12 @@ export class UtilsRDS {
137
137
  async get(
138
138
  table_id : string,
139
139
  primary_key : Record<string, any>,
140
- attribute_names? : string[],
141
140
  options : {
141
+ attribute_names? : string[],
142
142
  is_verbose? : boolean
143
143
  } = {}
144
144
  ) {
145
- 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 ")
145
+ const sql = "SELECT " + (options.attribute_names === undefined ? "*" : options.attribute_names.join(", ")) + " FROM " + table_id + " WHERE " + Object.entries(primary_key).map(([key_name, value]) => key_name + " = " + convert_rds_input(value)).join(" AND ")
146
146
  const items = await this.exec(sql, options)
147
147
  const item : Record<string, any> | undefined = items[0]
148
148
  return item
@@ -151,12 +151,12 @@ export class UtilsRDS {
151
151
  async batch_get(
152
152
  table_id : string,
153
153
  primary_key : Record<string, any[]>,
154
- attribute_names? : string[],
155
154
  options : {
155
+ attribute_names? : string[],
156
156
  is_verbose? : boolean
157
157
  } = {}
158
158
  ) {
159
- const sql = "SELECT " + (attribute_names === undefined ? "*" : attribute_names.join(", ")) + " FROM " + table_id + " WHERE " + Object.entries(primary_key).map(([key_name, values]) => key_name + " IN " + "(" + values.map(value => convert_rds_input(value)).join(", ") + ")").join(" AND ")
159
+ const sql = "SELECT " + (options.attribute_names === undefined ? "*" : options.attribute_names.join(", ")) + " FROM " + table_id + " WHERE " + Object.entries(primary_key).map(([key_name, values]) => key_name + " IN " + "(" + values.map(value => convert_rds_input(value)).join(", ") + ")").join(" AND ")
160
160
  const items = await this.exec(sql, options)
161
161
  return items
162
162
  }