@@ -436,6 +436,7 @@ class Table {
436436
437437 // If auto execute enabled
438438 if ( options . execute || ( this . autoExecute && options . execute !== false ) ) {
439+
439440 const result = await this . DocumentClient ! . query ( payload ) . promise ( )
440441
441442 // If auto parse enable
@@ -1134,7 +1135,7 @@ class Table {
11341135
11351136
11361137
1137- parseBatchWriteResponse (
1138+ private parseBatchWriteResponse (
11381139 result : any ,
11391140 options :batchWriteOptions = { }
11401141 ) : any {
@@ -1277,10 +1278,26 @@ class Table {
12771278 * Creates a TransactGetItems object: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html
12781279 */
12791280 transactGetParams (
1280- items : ( { Entity ?: any } & DocumentClient . TransactGetItem ) [ ] = [ ] ,
1281+ _items : ( { Entity ?: any } & DocumentClient . TransactGetItem ) [ ] ,
1282+ options ?: transactGetParamsOptions ,
1283+ meta ?: false | undefined
1284+ ) : DocumentClient . TransactGetItemsInput
1285+ transactGetParams (
1286+ _items : ( { Entity ?: any } & DocumentClient . TransactGetItem ) [ ] ,
1287+ options : transactGetParamsOptions ,
1288+ meta : true
1289+ ) : transactGetParamsMeta
1290+ transactGetParams (
1291+ _items : ( { Entity ?: any } & DocumentClient . TransactGetItem ) [ ] ,
12811292 options : transactGetParamsOptions = { } ,
12821293 meta : boolean = false
1283- ) {
1294+ ) : DocumentClient . TransactGetItemsInput | transactGetParamsMeta {
1295+
1296+ let items = Array . isArray ( _items ) ? _items : _items ? [ _items ] : [ ]
1297+
1298+ // Error on no items
1299+ if ( items . length === 0 )
1300+ error ( `No items supplied` )
12841301
12851302 // Extract valid options
12861303 const {
@@ -1292,8 +1309,8 @@ class Table {
12921309 const args = Object . keys ( _args ) . filter ( x => ! [ 'execute' , 'parse' ] . includes ( x ) )
12931310
12941311 // Error on extraneous arguments
1295- if ( Object . keys ( args ) . length > 0 )
1296- error ( `Invalid transactGet options: ${ Object . keys ( args ) . join ( ', ' ) } ` )
1312+ if ( args . length > 0 )
1313+ error ( `Invalid transactGet options: ${ args . join ( ', ' ) } ` )
12971314
12981315 // Verify capacity
12991316 if ( capacity !== undefined
@@ -1317,9 +1334,9 @@ class Table {
13171334 capacity ? { ReturnConsumedCapacity : capacity . toUpperCase ( ) } : null
13181335 )
13191336
1320- return meta ?
1321- { Entities, payload } as transactGetParamsMeta
1322- : payload as DocumentClient . TransactGetItemsInput
1337+ // Return transact items
1338+ return ( meta ) ? { Entities, payload } : payload
1339+
13231340 } // end transactGetParams
13241341
13251342
@@ -1365,10 +1382,16 @@ class Table {
13651382 * Creates a TransactWriteItems object: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html
13661383 */
13671384 transactWriteParams (
1368- items : DocumentClient . TransactWriteItemList = [ ] ,
1385+ _items : DocumentClient . TransactWriteItemList ,
13691386 options : transactWriteParamsOptions = { }
13701387 ) : DocumentClient . TransactWriteItemsInput {
13711388
1389+ let items = Array . isArray ( _items ) ? _items : _items ? [ _items ] : [ ]
1390+
1391+ // Error on no items
1392+ if ( items . length === 0 )
1393+ error ( `No items supplied` )
1394+
13721395 // Extract valid options
13731396 const {
13741397 capacity, // ReturnConsumedCapacity (none, total, or indexes)
@@ -1381,8 +1404,8 @@ class Table {
13811404 const args = Object . keys ( _args ) . filter ( x => ! [ 'execute' , 'parse' ] . includes ( x ) )
13821405
13831406 // Error on extraneous arguments
1384- if ( Object . keys ( args ) . length > 0 )
1385- error ( `Invalid transactWrite options: ${ Object . keys ( args ) . join ( ', ' ) } ` )
1407+ if ( args . length > 0 )
1408+ error ( `Invalid transactWrite options: ${ args . join ( ', ' ) } ` )
13861409
13871410 // Verify capacity
13881411 if ( capacity !== undefined
0 commit comments