Skip to content

MethodDefinition

Defined in: src/types.ts:229

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:261

Default values applied to omitted request parameters.


optional doc?: string;

Defined in: src/types.ts:259

Human-readable method documentation, surfaced via introspection.


optional exchangeFn?: ExchangeFn<any>;

Defined in: src/types.ts:251

Handles each input batch of an exchange stream.


optional exchangeInit?: ExchangeInit<any>;

Defined in: src/types.ts:249

Builds the initial state object for an exchange stream.


optional handler?: UnaryHandler;

Defined in: src/types.ts:243

Implementation for unary methods.


optional headerInit?: HeaderInit;

Defined in: src/types.ts:255

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


optional headerSchema?: VgiSchema;

Defined in: src/types.ts:253

Schema of the optional per-stream header batch.


optional inputSchema?: VgiSchema;

Defined in: src/types.ts:241

Schema of streamed input batches (exchange streams only).


name: string;

Defined in: src/types.ts:231

Method name as registered on the protocol.


optional onCancel?: OnCancelFn<any>;

Defined in: src/types.ts:257

Optional hook run when the client cancels a stream.


optional outputSchema?: VgiSchema;

Defined in: src/types.ts:239

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


paramsSchema: VgiSchema;

Defined in: src/types.ts:235

Schema of the request parameters batch.


optional paramTypes?: Record<string, string>;

Defined in: src/types.ts:263

Human-readable parameter type names, surfaced via introspection.


optional producerFn?: ProducerFn<any>;

Defined in: src/types.ts:247

Produces output batches for a producer stream.


optional producerInit?: ProducerInit<any>;

Defined in: src/types.ts:245

Builds the initial state object for a producer stream.


resultSchema: VgiSchema;

Defined in: src/types.ts:237

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


type: MethodType;

Defined in: src/types.ts:233

Whether the method is unary or streaming.