triangle-utils 1.4.27 → 1.4.28

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,7 @@ export declare class UtilsDynamoDB {
10
10
  concurrency?: number;
11
11
  }): Promise<Record<string, any>[]>;
12
12
  get(table: string, key: Record<string, any>, consistent?: boolean): Promise<Record<string, any> | undefined>;
13
- get_max(table: string, primary_key: Record<string, any>): Promise<Record<string, any> | undefined>;
13
+ get_max(table_index_name: string, primary_key: Record<string, any>): Promise<Record<string, any> | undefined>;
14
14
  query(table_index_name: string, primary_key: Record<string, any>, options?: {
15
15
  reverse?: boolean;
16
16
  compile?: boolean;
@@ -155,7 +155,9 @@ export class UtilsDynamoDB {
155
155
  }
156
156
  return converted_output;
157
157
  }
158
- async get_max(table, primary_key) {
158
+ async get_max(table_index_name, primary_key) {
159
+ const table_name = table_index_name.split(":")[0];
160
+ const index_name = table_index_name.split(":")[1];
159
161
  if (Object.keys(primary_key).length !== 1) {
160
162
  return undefined;
161
163
  }
@@ -165,7 +167,8 @@ export class UtilsDynamoDB {
165
167
  return undefined;
166
168
  }
167
169
  const request = {
168
- TableName: table,
170
+ TableName: table_name,
171
+ IndexName: index_name,
169
172
  ExpressionAttributeNames: {
170
173
  "#a": key
171
174
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.27",
3
+ "version": "1.4.28",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -182,9 +182,11 @@ export class UtilsDynamoDB {
182
182
  }
183
183
 
184
184
  async get_max(
185
- table : string,
185
+ table_index_name : string,
186
186
  primary_key : Record<string, any>
187
187
  ) : Promise<Record<string, any> | undefined> {
188
+ const table_name : string = table_index_name.split(":")[0]
189
+ const index_name : string | undefined = table_index_name.split(":")[1]
188
190
  if (Object.keys(primary_key).length !== 1) {
189
191
  return undefined
190
192
  }
@@ -194,7 +196,8 @@ export class UtilsDynamoDB {
194
196
  return undefined
195
197
  }
196
198
  const request : QueryCommandInput = {
197
- TableName : table,
199
+ TableName : table_name,
200
+ IndexName : index_name,
198
201
  ExpressionAttributeNames: {
199
202
  "#a": key
200
203
  },