Skip to content

Commit 3427f5b

Browse files
committed
docs: added doc-blocks describing RPC manifests
[ci skip]
1 parent c5da3d4 commit 3427f5b

6 files changed

Lines changed: 32 additions & 3 deletions

File tree

src/agent/handlers/clientManifest.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ const vaultsScan = new ServerCaller<
5454
AgentRPCResponseResult<VaultsScanMessage>
5555
>();
5656

57-
// No type used here, it will override type inference
57+
/**
58+
* All the client caller definitions for the AgentClient RPC.
59+
* Used by the RPCClient to register callers and enforce types.
60+
*
61+
* No type used here, it will override type inference.
62+
*/
5863
const clientManifest = {
5964
nodesClaimsGet,
6065
nodesClosestLocalNodesGet,

src/agent/handlers/serverManifest.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ import { VaultsScanHandler } from './vaultsScan';
1717
import { VaultsGitInfoGetHandler } from './vaultsGitInfoGet';
1818
import { VaultsGitPackGetHandler } from './vaultsGitPackGet';
1919

20+
/**
21+
* All the server handler definitions for the AgentServer RPC.
22+
* This will take the container of all the required dependencies and create the server handlers.
23+
*
24+
* Used by the RPCServer to register handlers and enforce types.
25+
*/
2026
const serverManifest = (container: {
2127
db: DB;
2228
sigchain: Sigchain;

src/client/handlers/clientManifest.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,12 @@ const vaultsVersion = new UnaryCaller<
403403
ClientRPCResponseResult<VaultsLatestVersionMessage>
404404
>();
405405

406-
// No type used here, it will override type inference
406+
/**
407+
* All the client caller definitions for the ClientClient RPC.
408+
* Used by the RPCClient to register callers and enforce types.
409+
*
410+
* No type used here, it will override type inference.
411+
*/
407412
const clientManifest = {
408413
agentLockAll,
409414
agentStatus,

src/client/handlers/serverManifest.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ import { VaultsVersionHandler } from './vaultsVersion';
8383
import { KeysVerifyHandler } from '../../client/handlers/keysVerify';
8484
import { KeysSignHandler } from '../../client/handlers/keysSign';
8585

86+
/**
87+
* All the server handler definitions for the ClientServer RPC.
88+
* This will take the container of all the required dependencies and create the server handlers.
89+
*
90+
* Used by the RPCServer to register handlers and enforce types.
91+
*/
8692
const serverManifest = (container: {
8793
pkAgentProm: Promise<PolykeyAgent>;
8894
keyRing: KeyRing;

src/rpc/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,14 @@ type ConvertCaller<T extends Caller> = T extends DuplexCaller
291291
? RawCallerImplementation
292292
: never;
293293

294+
/**
295+
* Contains the handler Classes that defines the handling logic and types for the server handlers.
296+
*/
294297
type ServerManifest = Record<string, Handler>;
298+
299+
/**
300+
* Contains the Caller classes that defines the types for the client callers.
301+
*/
295302
type ClientManifest = Record<string, Caller>;
296303

297304
type HandlerType = 'DUPLEX' | 'SERVER' | 'CLIENT' | 'UNARY' | 'RAW';

tests/PolykeyClient.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('PolykeyClient', () => {
6060
fs,
6161
logger,
6262
fresh: true,
63-
rpcClientClient: {} as any,
63+
rpcClientClient: { destroy: () => {} } as any,
6464
});
6565
expect(await session.readToken()).toBeUndefined();
6666
await session.writeToken('abc' as SessionToken);

0 commit comments

Comments
 (0)