1+ import type { Host , Port , ProxyConfig } from '../network/types' ;
2+ import type { NodeId } from '../nodes/types' ;
13import type { TLSConfig } from '../network/types' ;
24
3- import { GRPCClient , utils as grpcUtils } from '../grpc' ;
4- import * as agentPB from '../proto/js/Agent_pb' ;
5- import { AgentClient } from '../proto/js/Agent_grpc_pb' ;
6- import { NodeId } from '../nodes/types' ;
7- import { Host , Port , ProxyConfig } from '../network/types' ;
85import Logger from '@matrixai/logger' ;
96import {
107 CreateDestroyStartStop ,
118 ready ,
129} from '@matrixai/async-init/dist/CreateDestroyStartStop' ;
13- import { errors as grpcErrors } from '../grpc' ;
10+ import { GRPCClient , utils as grpcUtils , errors as grpcErrors } from '../grpc' ;
11+ import { AgentServiceClient } from '../proto/js/polykey/v1/agent_service_grpc_pb' ;
12+ import * as utilsPB from '../proto/js/polykey/v1/utils/utils_pb' ;
13+ import * as vaultsPB from '../proto/js/polykey/v1/vaults/vaults_pb' ;
14+ import * as nodesPB from '../proto/js/polykey/v1/nodes/nodes_pb' ;
15+ import * as notificationsPB from '../proto/js/polykey/v1/notifications/notifications_pb' ;
1416
1517/**
1618 * GRPC Agent Endpoints.
@@ -20,7 +22,7 @@ import { errors as grpcErrors } from '../grpc';
2022 new grpcErrors . ErrorGRPCClientNotStarted ( ) ,
2123 new grpcErrors . ErrorGRPCClientDestroyed ( ) ,
2224)
23- class GRPCClientAgent extends GRPCClient < AgentClient > {
25+ class GRPCClientAgent extends GRPCClient < AgentServiceClient > {
2426 static async createGRPCClientAgent ( {
2527 nodeId,
2628 host,
@@ -55,23 +57,23 @@ class GRPCClientAgent extends GRPCClient<AgentClient> {
5557 timeout ?: number ;
5658 } = { } ) : Promise < void > {
5759 await super . start ( {
58- clientConstructor : AgentClient ,
60+ clientConstructor : AgentServiceClient ,
5961 tlsConfig,
6062 timeout,
6163 } ) ;
6264 }
6365
6466 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
6567 public echo ( ...args ) {
66- return grpcUtils . promisifyUnaryCall < agentPB . EchoMessage > (
68+ return grpcUtils . promisifyUnaryCall < utilsPB . EchoMessage > (
6769 this . client ,
6870 this . client . echo ,
6971 ) ( ...args ) ;
7072 }
7173
7274 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
7375 public vaultsGitInfoGet ( ...args ) {
74- return grpcUtils . promisifyReadableStreamCall < agentPB . PackChunk > (
76+ return grpcUtils . promisifyReadableStreamCall < vaultsPB . PackChunk > (
7577 this . client ,
7678 this . client . vaultsGitInfoGet ,
7779 ) ( ...args ) ;
@@ -84,55 +86,55 @@ class GRPCClientAgent extends GRPCClient<AgentClient> {
8486
8587 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
8688 public vaultsScan ( ...args ) {
87- return grpcUtils . promisifyReadableStreamCall < agentPB . VaultListMessage > (
89+ return grpcUtils . promisifyReadableStreamCall < vaultsPB . Vault > (
8890 this . client ,
8991 this . client . vaultsScan ,
9092 ) ( ...args ) ;
9193 }
9294
9395 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
9496 public nodesClosestLocalNodesGet ( ...args ) {
95- return grpcUtils . promisifyUnaryCall < agentPB . NodeTableMessage > (
97+ return grpcUtils . promisifyUnaryCall < nodesPB . NodeTable > (
9698 this . client ,
9799 this . client . nodesClosestLocalNodesGet ,
98100 ) ( ...args ) ;
99101 }
100102
101103 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
102104 public nodesClaimsGet ( ...args ) {
103- return grpcUtils . promisifyUnaryCall < agentPB . ClaimsMessage > (
105+ return grpcUtils . promisifyUnaryCall < nodesPB . Claims > (
104106 this . client ,
105107 this . client . nodesClaimsGet ,
106108 ) ( ...args ) ;
107109 }
108110
109111 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
110112 public nodesChainDataGet ( ...args ) {
111- return grpcUtils . promisifyUnaryCall < agentPB . ChainDataMessage > (
113+ return grpcUtils . promisifyUnaryCall < nodesPB . ChainData > (
112114 this . client ,
113115 this . client . nodesChainDataGet ,
114116 ) ( ...args ) ;
115117 }
116118
117119 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
118120 public nodesHolePunchMessageSend ( ...args ) {
119- return grpcUtils . promisifyUnaryCall < agentPB . EmptyMessage > (
121+ return grpcUtils . promisifyUnaryCall < utilsPB . EmptyMessage > (
120122 this . client ,
121123 this . client . nodesHolePunchMessageSend ,
122124 ) ( ...args ) ;
123125 }
124126
125127 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
126128 public notificationsSend ( ...args ) {
127- return grpcUtils . promisifyUnaryCall < agentPB . NotificationMessage > (
129+ return grpcUtils . promisifyUnaryCall < notificationsPB . AgentNotification > (
128130 this . client ,
129131 this . client . notificationsSend ,
130132 ) ( ...args ) ;
131133 }
132134
133135 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
134136 public vaultsPermisssionsCheck ( ...args ) {
135- return grpcUtils . promisifyUnaryCall < agentPB . PermissionMessage > (
137+ return grpcUtils . promisifyUnaryCall < vaultsPB . NodePermissionAllowed > (
136138 this . client ,
137139 this . client . vaultsPermisssionsCheck ,
138140 ) ( ...args ) ;
@@ -141,8 +143,8 @@ class GRPCClientAgent extends GRPCClient<AgentClient> {
141143 @ready ( new grpcErrors . ErrorGRPCClientNotStarted ( ) )
142144 public nodesCrossSignClaim ( ...args ) {
143145 return grpcUtils . promisifyDuplexStreamCall <
144- agentPB . CrossSignMessage ,
145- agentPB . CrossSignMessage
146+ nodesPB . CrossSign ,
147+ nodesPB . CrossSign
146148 > (
147149 this . client ,
148150 this . client . nodesCrossSignClaim ,
0 commit comments