@@ -110,7 +110,7 @@ class Connection extends EventEmitter {
110110 options . connection = this ;
111111 if ( options . keepInStmtCache === undefined )
112112 options . keepInStmtCache = true ;
113- if ( options . suspendOnSuccess == undefined )
113+ if ( options . suspendOnSuccess === undefined )
114114 options . suspendOnSuccess = false ;
115115 settings . addToOptions ( options ,
116116 "autoCommit" ,
@@ -720,11 +720,12 @@ class Connection extends EventEmitter {
720720 // If transactionId wasn't provided a random-generated transactionId will be
721721 // used and returned.
722722 //---------------------------------------------------------------------------
723- async beginSessionlessTransaction ( options ) {
723+ async beginSessionlessTransaction ( options = { } ) {
724+ errors . assertArgCount ( arguments , 0 , 1 ) ;
724725 errors . assertParamValue ( nodbUtil . isObject ( options ) , 1 ) ;
725- if ( options . transactionId != undefined )
726- errors . assertParamValue (
727- nodbUtil . isTransactionId ( options . transactionId ) , 1 ) ;
726+ if ( options . transactionId !== undefined )
727+ errors . assertParamPropValue (
728+ nodbUtil . isTransactionId ( options . transactionId ) , 1 , 'transactionId' ) ;
728729 errors . assertParamPropUnsignedIntNonZero ( options , 1 , 'timeout' ) ;
729730 errors . assertParamPropBool ( options , 1 , 'deferRoundTrip' ) ;
730731 const normalizedTransactionId =
@@ -1458,14 +1459,14 @@ class Connection extends EventEmitter {
14581459 //
14591460 // Resume an existing sessionlesss transaction using given transactionId
14601461 //---------------------------------------------------------------------------
1461- async resumeSessionlessTransaction ( options ) {
1462- errors . assertParamValue ( nodbUtil . isObject ( options ) , 1 ) ;
1463- errors . assertParamPropUnsignedInt ( options , 1 , 'timeout' ) ;
1464- errors . assertParamPropBool ( options , 1 , 'deferRoundTrip' ) ;
1465- errors . assertParamValue (
1466- nodbUtil . isTransactionId ( options . transactionId ) , 1 ) ;
1462+ async resumeSessionlessTransaction ( transactionId , options = { } ) {
1463+ errors . assertArgCount ( arguments , 1 , 2 ) ;
1464+ errors . assertParamValue ( nodbUtil . isTransactionId ( transactionId ) , 1 ) ;
1465+ errors . assertParamValue ( nodbUtil . isObject ( options ) , 2 ) ;
1466+ errors . assertParamPropUnsignedInt ( options , 2 , 'timeout' ) ;
1467+ errors . assertParamPropBool ( options , 2 , 'deferRoundTrip' ) ;
14671468 const normalizedTransactionId =
1468- nodbUtil . normalizeTransactionId ( options . transactionId ) ;
1469+ nodbUtil . normalizeTransactionId ( transactionId ) ;
14691470 const { timeout = 60 , deferRoundTrip = false } = options ;
14701471 await this . _impl . startSessionlessTransaction ( normalizedTransactionId ,
14711472 timeout , constants . TPC_BEGIN_RESUME , deferRoundTrip ) ;
@@ -1592,6 +1593,7 @@ class Connection extends EventEmitter {
15921593 // Suspend any active sessionless transaction immediately
15931594 //---------------------------------------------------------------------------
15941595 async suspendSessionlessTransaction ( ) {
1596+ errors . assertArgCount ( arguments , 0 , 0 ) ;
15951597 errors . assert ( this . _impl , errors . ERR_INVALID_CONNECTION ) ;
15961598 await this . _impl . suspendSessionlessTransaction ( ) ;
15971599 }
0 commit comments