Skip to content

MethodDefinition

Defined in: src/types.ts:224

In-memory definition of one registered RPC method, produced by the Protocol builder and consumed by the dispatch layer. Which optional fields are populated depends on the method type: handler for unary methods, producerInit/producerFn for producer streams, and exchangeInit/exchangeFn for exchange streams.

optional defaults?: Record<string, any>;

Defined in: src/types.ts:256

Default values applied to omitted request parameters.


optional doc?: string;

Defined in: src/types.ts:254

Human-readable method documentation, surfaced via introspection.


optional exchangeFn?: ExchangeFn<any>;

Defined in: src/types.ts:246

Handles each input batch of an exchange stream.


optional exchangeInit?: ExchangeInit<any>;

Defined in: src/types.ts:244

Builds the initial state object for an exchange stream.


optional handler?: UnaryHandler;

Defined in: src/types.ts:238

Implementation for unary methods.


optional headerInit?: HeaderInit;

Defined in: src/types.ts:250

Builds the optional header batch emitted before the first output batch.


optional headerSchema?: VgiSchema;

Defined in: src/types.ts:248

Schema of the optional per-stream header batch.


optional inputSchema?: VgiSchema;

Defined in: src/types.ts:236

Schema of streamed input batches (exchange streams only).


name: string;

Defined in: src/types.ts:226

Method name as registered on the protocol.


optional onCancel?: OnCancelFn<any>;

Defined in: src/types.ts:252

Optional hook run when the client cancels a stream.


optional outputSchema?: VgiSchema;

Defined in: src/types.ts:234

Schema of streamed output batches (producer and exchange streams).


paramsSchema: VgiSchema;

Defined in: src/types.ts:230

Schema of the request parameters batch.


optional paramTypes?: Record<string, string>;

Defined in: src/types.ts:258

Human-readable parameter type names, surfaced via introspection.


optional producerFn?: ProducerFn<any>;

Defined in: src/types.ts:242

Produces output batches for a producer stream.


optional producerInit?: ProducerInit<any>;

Defined in: src/types.ts:240

Builds the initial state object for a producer stream.


resultSchema: VgiSchema;

Defined in: src/types.ts:232

Schema of the unary result batch (unused for streams).


type: MethodType;

Defined in: src/types.ts:228

Whether the method is unary or streaming.