triangle-utils 1.4.27 → 1.4.29
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/UtilsBedrock.js
CHANGED
|
@@ -22,7 +22,10 @@ export class UtilsBedrock {
|
|
|
22
22
|
const response = JSON.parse(this.text_decoder.decode(output.body));
|
|
23
23
|
return response.generation;
|
|
24
24
|
}
|
|
25
|
-
catch (
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (error instanceof Error) {
|
|
27
|
+
console.log(error.stack);
|
|
28
|
+
}
|
|
26
29
|
console.log("Failed to get from Bedrock.");
|
|
27
30
|
}
|
|
28
31
|
}
|
|
@@ -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(
|
|
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(
|
|
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:
|
|
170
|
+
TableName: table_name,
|
|
171
|
+
IndexName: index_name,
|
|
169
172
|
ExpressionAttributeNames: {
|
|
170
173
|
"#a": key
|
|
171
174
|
},
|
package/package.json
CHANGED
package/src/UtilsBedrock.ts
CHANGED
|
@@ -25,7 +25,10 @@ export class UtilsBedrock {
|
|
|
25
25
|
})
|
|
26
26
|
const response = JSON.parse(this.text_decoder.decode(output.body))
|
|
27
27
|
return response.generation
|
|
28
|
-
} catch (
|
|
28
|
+
} catch (error) {
|
|
29
|
+
if (error instanceof Error) {
|
|
30
|
+
console.log(error.stack)
|
|
31
|
+
}
|
|
29
32
|
console.log("Failed to get from Bedrock.")
|
|
30
33
|
}
|
|
31
34
|
}
|
package/src/UtilsDynamoDB.ts
CHANGED
|
@@ -182,9 +182,11 @@ export class UtilsDynamoDB {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
async get_max(
|
|
185
|
-
|
|
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 :
|
|
199
|
+
TableName : table_name,
|
|
200
|
+
IndexName : index_name,
|
|
198
201
|
ExpressionAttributeNames: {
|
|
199
202
|
"#a": key
|
|
200
203
|
},
|