Skip to content

Commit

Permalink
fix batchcallback where rows are not unmarkshalled
Browse files Browse the repository at this point in the history
  • Loading branch information
frankleng committed Oct 20, 2023
1 parent 04dd78b commit 462fc2e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dynadash",
"version": "1.9.16",
"version": "1.9.17",
"description": "DynamoDb helpers",
"main": "dist/index.js",
"types": "dist/types/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function handleQueryCommand<R>(
result = await client.send(new QueryCommand(query));

if (batchCallback) {
await batchCallback([...(result.Items || [])] as R[]);
await batchCallback((result.Items || []).map((row) => unmarshall(row) as R));
result.Items = undefined;
} else {
// Concatenating the retrieved items
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ function mergeIndexCapacities(

const mergedIndexes: Record<string, Capacity> = { ...statsIndexes };

for (const index in resultIndexes) {
for (const index in resultIndexes || {}) {
const capacity = mergeCapacity(mergedIndexes[index], resultIndexes[index]);
if (capacity) mergedIndexes[index as keyof typeof resultIndexes] = capacity;
}
Expand Down

0 comments on commit 462fc2e

Please sign in to comment.