File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 QueryCommand ,
1313 UpdateItemCommand ,
1414 UpdateItemCommandInput ,
15+ QueryOutput ,
1516} from '@aws-sdk/client-dynamodb' ;
1617import { marshall , unmarshall } from '@aws-sdk/util-dynamodb' ;
1718import { captureAWSv3Client } from 'aws-xray-sdk-core' ;
@@ -258,7 +259,7 @@ export async function queryTableIndex(
258259 keyCondExpressionMap ?: KeyCondExpressionMap ;
259260 filterExpressionMap ?: FilterExpressionMap ;
260261 } ,
261- ) {
262+ ) : Promise < ( QueryOutput & { list : any [ ] } ) | null > {
262263 try {
263264 const client = captureAWSv3Client ( new DynamoDBClient ( { } ) ) ;
264265 let query : QueryCommandInput = {
@@ -308,7 +309,7 @@ export async function queryTableIndex(
308309 }
309310 }
310311 const { Items, ...rest } = await client . send ( new QueryCommand ( query ) ) ;
311- return { list : Items ?. length ? Items . map ( ( row ) => unmarshall ( row ) ) : [ ] , ... rest } ;
312+ return { ... rest , list : Items ?. length ? Items . map ( ( row ) => unmarshall ( row ) ) : [ ] } ;
312313 } catch ( e ) {
313314 console . error ( e ) ;
314315 return null ;
You can’t perform that action at this time.
0 commit comments