@@ -295,15 +295,15 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
295
295
if ( sessionId ) {
296
296
this . _transportMap . set ( sessionId , transport ) ;
297
297
}
298
- }
298
+ } ;
299
299
300
300
const originalOnSessionClosed = transport . onsessionclosed ;
301
301
transport . onsessionclosed = async ( sessionId : string ) => {
302
302
await originalOnSessionClosed ?.( sessionId ) ;
303
303
if ( sessionId ) {
304
304
this . _transportMap . delete ( sessionId ) ;
305
305
}
306
- }
306
+ } ;
307
307
308
308
// client init has only one transport, not invoke onsessioninitialized
309
309
this . _transportMap . set ( DEFAULT_TRANSPROT_KEY , transport ) ;
@@ -318,7 +318,7 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
318
318
_onerror ?.( error ) ;
319
319
this . _onerror ( error ) ;
320
320
} ;
321
-
321
+
322
322
const _onmessage = transport ?. onmessage ;
323
323
transport . onmessage = ( message , extra ) => {
324
324
_onmessage ?.( message , extra ) ;
@@ -340,7 +340,7 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
340
340
if ( sessionId ) {
341
341
this . _transportMap . delete ( sessionId ) ;
342
342
} else {
343
- this . _transportMap . delete ( DEFAULT_TRANSPROT_KEY )
343
+ this . _transportMap . delete ( DEFAULT_TRANSPROT_KEY ) ;
344
344
}
345
345
const responseHandlers = this . _responseHandlers ;
346
346
this . _responseHandlers = new Map ( ) ;
@@ -409,7 +409,8 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
409
409
sessionId : capturedTransport ?. sessionId ,
410
410
_meta : request . params ?. _meta ,
411
411
sendNotification : notification => this . notification ( notification , { relatedRequestId : request . id , sessionId } ) ,
412
- sendRequest : ( r , resultSchema , options ?) => this . request ( r , resultSchema , { ...options , relatedRequestId : request . id , sessionId } ) ,
412
+ sendRequest : ( r , resultSchema , options ?) =>
413
+ this . request ( r , resultSchema , { ...options , relatedRequestId : request . id , sessionId } ) ,
413
414
authInfo : extra ?. authInfo ,
414
415
requestId : request . id ,
415
416
requestInfo : extra ?. requestInfo
@@ -539,7 +540,7 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
539
540
if ( sessionId ) {
540
541
transport = this . _transportMap . get ( sessionId ) ;
541
542
}
542
-
543
+
543
544
return new Promise ( ( resolve , reject ) => {
544
545
if ( ! transport ) {
545
546
reject ( new Error ( 'Not connected' ) ) ;
@@ -629,13 +630,10 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
629
630
* Emits a notification, which is a one-way message that does not expect a response.
630
631
*/
631
632
async notification ( notification : SendNotificationT , options ?: NotificationOptions ) : Promise < void > {
632
-
633
633
let transports : Transport [ ] = Array . from ( this . _transportMap . values ( ) ) ;
634
634
635
635
if ( options ?. sessionId && this . _transportMap . has ( options . sessionId ) ) {
636
- transports = [
637
- this . _transportMap . get ( options . sessionId ) !
638
- ] ;
636
+ transports = [ this . _transportMap . get ( options . sessionId ) ! ] ;
639
637
}
640
638
641
639
if ( transports . length === 0 ) {
@@ -666,9 +664,7 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
666
664
let transports : Transport [ ] = Array . from ( this . _transportMap . values ( ) ) ;
667
665
668
666
if ( options ?. sessionId && this . _transportMap . has ( options . sessionId ) ) {
669
- transports = [
670
- this . _transportMap . get ( options . sessionId ) !
671
- ] ;
667
+ transports = [ this . _transportMap . get ( options . sessionId ) ! ] ;
672
668
}
673
669
674
670
// SAFETY CHECK: If the connection was closed while this was pending, abort.
0 commit comments