@@ -33,6 +33,7 @@ import type {
3333import type NodeConnectionManager from './NodeConnectionManager.js' ;
3434import type NodeGraph from './NodeGraph.js' ;
3535import type { ServicePOJO } from '@matrixai/mdns' ;
36+ import type { AgentClientManifest } from './agent/callers/index.js' ;
3637import { withF } from '@matrixai/resources' ;
3738import { events as mdnsEvents , MDNS , utils as mdnsUtils } from '@matrixai/mdns' ;
3839import Logger from '@matrixai/logger' ;
@@ -100,7 +101,7 @@ class NodeManager {
100101 protected gestaltGraph : GestaltGraph ;
101102 protected taskManager : TaskManager ;
102103 protected nodeGraph : NodeGraph ;
103- protected nodeConnectionManager : NodeConnectionManager ;
104+ protected nodeConnectionManager : NodeConnectionManager < AgentClientManifest > ;
104105 protected mdnsOptions :
105106 | {
106107 groups : Array < Host > ;
@@ -243,7 +244,7 @@ class NodeManager {
243244 ) ;
244245 const successfulConnections = connectionResults . filter (
245246 ( r ) => r . status === 'fulfilled' ,
246- ) as Array < PromiseFulfilledResult < NodeConnection > > ;
247+ ) as Array < PromiseFulfilledResult < NodeConnection < AgentClientManifest > > > ;
247248 if ( successfulConnections . length === 0 ) {
248249 const failedConnectionErrors = connectionResults
249250 . filter ( ( r ) => r . status === 'rejected' )
@@ -343,7 +344,7 @@ class NodeManager {
343344 groups : Array < Host > ;
344345 port : Port ;
345346 } ;
346- nodeConnectionManager : NodeConnectionManager ;
347+ nodeConnectionManager : NodeConnectionManager < AgentClientManifest > ;
347348 connectionConnectTimeoutTime ?: number ;
348349 refreshBucketDelayTime ?: number ;
349350 refreshBucketDelayJitter ?: number ;
@@ -459,7 +460,7 @@ class NodeManager {
459460 public acquireConnection (
460461 nodeId : NodeId ,
461462 ctx : ContextTimed ,
462- ) : ResourceAcquire < NodeConnection > {
463+ ) : ResourceAcquire < NodeConnection < AgentClientManifest > > {
463464 if ( this . keyRing . getNodeId ( ) . equals ( nodeId ) ) {
464465 throw new nodesErrors . ErrorNodeManagerNodeIdOwn ( ) ;
465466 }
@@ -497,13 +498,13 @@ class NodeManager {
497498 public async withConnF < T > (
498499 nodeId : NodeId ,
499500 ctx : Partial < ContextTimedInput > | undefined ,
500- f : ( conn : NodeConnection ) => Promise < T > ,
501+ f : ( conn : NodeConnection < AgentClientManifest > ) => Promise < T > ,
501502 ) : Promise < T > ;
502503 @startStop . ready ( new nodesErrors . ErrorNodeManagerNotRunning ( ) )
503504 public async withConnF < T > (
504505 nodeId : NodeId ,
505506 @decorators . context ctx : ContextTimed ,
506- f : ( conn : NodeConnection ) => Promise < T > ,
507+ f : ( conn : NodeConnection < AgentClientManifest > ) => Promise < T > ,
507508 ) : Promise < T > {
508509 return await withF (
509510 [ this . acquireConnection ( nodeId , ctx ) ] ,
@@ -525,14 +526,18 @@ class NodeManager {
525526 public withConnG < T , TReturn , TNext > (
526527 nodeId : NodeId ,
527528 ctx : Partial < ContextTimedInput > | undefined ,
528- g : ( conn : NodeConnection ) => AsyncGenerator < T , TReturn , TNext > ,
529+ g : (
530+ conn : NodeConnection < AgentClientManifest > ,
531+ ) => AsyncGenerator < T , TReturn , TNext > ,
529532 ) : AsyncGenerator < T , TReturn , TNext > ;
530533 @startStop . ready ( new nodesErrors . ErrorNodeManagerNotRunning ( ) )
531534 @decorators . timed ( )
532535 public async * withConnG < T , TReturn , TNext > (
533536 nodeId : NodeId ,
534537 @decorators . context ctx : ContextTimed ,
535- g : ( conn : NodeConnection ) => AsyncGenerator < T , TReturn , TNext > ,
538+ g : (
539+ conn : NodeConnection < AgentClientManifest > ,
540+ ) => AsyncGenerator < T , TReturn , TNext > ,
536541 ) : AsyncGenerator < T , TReturn , TNext > {
537542 const acquire = this . acquireConnection ( nodeId , ctx ) ;
538543 const [ release , conn ] = await acquire ( ) ;
@@ -707,7 +712,7 @@ class NodeManager {
707712 ctx . signal . throwIfAborted ( ) ;
708713 const isDone = await nodeConnectionsQueue . withNodeSignal (
709714 async ( nodeIdTarget , nodeIdSignaller ) => {
710- let nodeConnection : NodeConnection | undefined ;
715+ let nodeConnection : NodeConnection < AgentClientManifest > | undefined ;
711716 if (
712717 ! this . nodeConnectionManager . hasConnection ( nodeIdTarget ) &&
713718 nodeIdSignaller != null
@@ -1162,7 +1167,7 @@ class NodeManager {
11621167 @startStop . ready ( new nodesErrors . ErrorNodeConnectionManagerNotRunning ( ) )
11631168 @decorators . timedCancellable (
11641169 true ,
1165- ( nodeConnectionManager : NodeConnectionManager ) =>
1170+ ( nodeConnectionManager : NodeConnectionManager < AgentClientManifest > ) =>
11661171 nodeConnectionManager . connectionConnectTimeoutTime ,
11671172 )
11681173 public async pingNode (
@@ -1194,7 +1199,7 @@ class NodeManager {
11941199 @startStop . ready ( new nodesErrors . ErrorNodeConnectionManagerNotRunning ( ) )
11951200 @decorators . timedCancellable (
11961201 true ,
1197- ( nodeConnectionManager : NodeConnectionManager ) =>
1202+ ( nodeConnectionManager : NodeConnectionManager < AgentClientManifest > ) =>
11981203 nodeConnectionManager . connectionConnectTimeoutTime ,
11991204 )
12001205 public async pingNodeAddress (
0 commit comments