@@ -319,7 +319,7 @@ export class StateMachine {
319319 */
320320 async kmsRequest (
321321 request : MongoCryptKMSRequest ,
322- options : { timeoutContext ?: TimeoutContext } & Abortable
322+ options ? : { timeoutContext ?: TimeoutContext } & Abortable
323323 ) : Promise < void > {
324324 const parsedUrl = request . endpoint . split ( ':' ) ;
325325 const port = parsedUrl [ 1 ] != null ? Number . parseInt ( parsedUrl [ 1 ] , 10 ) : HTTPS_PORT ;
@@ -428,7 +428,7 @@ export class StateMachine {
428428 resolve
429429 } = promiseWithResolvers < void > ( ) ;
430430
431- abortListener = addAbortListener ( options . signal , error => {
431+ abortListener = addAbortListener ( options ? .signal , error => {
432432 destroySockets ( ) ;
433433 rejectOnTlsSocketError ( error ) ;
434434 } ) ;
@@ -447,7 +447,7 @@ export class StateMachine {
447447 resolve ( ) ;
448448 }
449449 } ) ;
450- await ( options . timeoutContext ?. csotEnabled ( )
450+ await ( options ? .timeoutContext ?. csotEnabled ( )
451451 ? Promise . all ( [
452452 willResolveKmsRequest ,
453453 Timeout . expires ( options . timeoutContext ?. remainingTimeMS )
@@ -464,7 +464,7 @@ export class StateMachine {
464464 }
465465 }
466466
467- * requests ( context : MongoCryptContext , options : { timeoutContext ?: TimeoutContext } & Abortable ) {
467+ * requests ( context : MongoCryptContext , options ? : { timeoutContext ?: TimeoutContext } & Abortable ) {
468468 for (
469469 let request = context . nextKMSRequest ( ) ;
470470 request != null ;
@@ -531,16 +531,16 @@ export class StateMachine {
531531 client : MongoClient ,
532532 ns : string ,
533533 filter : Document ,
534- options : { timeoutContext ?: TimeoutContext } & Abortable
534+ options ? : { timeoutContext ?: TimeoutContext } & Abortable
535535 ) : Promise < Uint8Array | null > {
536536 const { db } = MongoDBCollectionNamespace . fromString ( ns ) ;
537537
538538 const cursor = client . db ( db ) . listCollections ( filter , {
539539 promoteLongs : false ,
540540 promoteValues : false ,
541541 timeoutContext :
542- options . timeoutContext && new CursorTimeoutContext ( options . timeoutContext , Symbol ( ) ) ,
543- signal : options . signal
542+ options ? .timeoutContext && new CursorTimeoutContext ( options ? .timeoutContext , Symbol ( ) ) ,
543+ signal : options ? .signal
544544 } ) ;
545545
546546 // There is always exactly zero or one matching documents, so this should always exhaust the cursor
@@ -564,7 +564,7 @@ export class StateMachine {
564564 client : MongoClient ,
565565 ns : string ,
566566 command : Uint8Array ,
567- options : { timeoutContext ?: TimeoutContext } & Abortable
567+ options ? : { timeoutContext ?: TimeoutContext } & Abortable
568568 ) : Promise < Uint8Array > {
569569 const { db } = MongoDBCollectionNamespace . fromString ( ns ) ;
570570 const bsonOptions = { promoteLongs : false , promoteValues : false } ;
@@ -578,10 +578,10 @@ export class StateMachine {
578578 signal : undefined
579579 } ;
580580
581- if ( options . timeoutContext ?. csotEnabled ( ) ) {
581+ if ( options ? .timeoutContext ?. csotEnabled ( ) ) {
582582 commandOptions . timeoutMS = options . timeoutContext . remainingTimeMS ;
583583 }
584- if ( options . signal ) {
584+ if ( options ? .signal ) {
585585 commandOptions . signal = options . signal ;
586586 }
587587
@@ -605,7 +605,7 @@ export class StateMachine {
605605 client : MongoClient ,
606606 keyVaultNamespace : string ,
607607 filter : Uint8Array ,
608- options : { timeoutContext ?: TimeoutContext } & Abortable
608+ options ? : { timeoutContext ?: TimeoutContext } & Abortable
609609 ) : Promise < Array < DataKey > > {
610610 const { db : dbName , collection : collectionName } =
611611 MongoDBCollectionNamespace . fromString ( keyVaultNamespace ) ;
@@ -618,10 +618,10 @@ export class StateMachine {
618618 signal : undefined
619619 } ;
620620
621- if ( options . timeoutContext != null ) {
621+ if ( options ? .timeoutContext != null ) {
622622 commandOptions . timeoutContext = new CursorTimeoutContext ( options . timeoutContext , Symbol ( ) ) ;
623623 }
624- if ( options . signal != null ) {
624+ if ( options ? .signal != null ) {
625625 commandOptions . signal = options . signal ;
626626 }
627627
0 commit comments