@query-farm/vgi-rpc 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://vgi-rpc.query.farm">
|
|
3
|
+
<img src="https://vgi-rpc.query.farm/logo-hero.png" alt="VGI — The Vector Gateway Interface" width="200">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
1
7
|
# vgi-rpc
|
|
2
8
|
|
|
3
|
-
TypeScript server library for the [vgi-rpc](https://
|
|
9
|
+
TypeScript server library for the [vgi-rpc](https://vgi-rpc.query.farm) framework. Implements RPC servers that communicate over stdin/stdout using [Apache Arrow](https://arrow.apache.org/) IPC serialization.
|
|
4
10
|
|
|
5
11
|
Define RPC methods with Arrow-typed schemas, serve them over stdin/stdout, and interact with them using the Python `vgi-rpc` CLI or any vgi-rpc client. Unlike JSON-over-HTTP, structured data stays in Arrow columnar format for efficient transfer.
|
|
6
12
|
|
|
@@ -18,7 +24,7 @@ Define RPC methods with Arrow-typed schemas, serve them over stdin/stdout, and i
|
|
|
18
24
|
## Installation
|
|
19
25
|
|
|
20
26
|
```bash
|
|
21
|
-
bun add vgi-rpc
|
|
27
|
+
bun add @query-farm/vgi-rpc
|
|
22
28
|
```
|
|
23
29
|
|
|
24
30
|
Requires [Bun](https://bun.sh/) runtime.
|
|
@@ -26,7 +32,7 @@ Requires [Bun](https://bun.sh/) runtime.
|
|
|
26
32
|
## Quick Start
|
|
27
33
|
|
|
28
34
|
```typescript
|
|
29
|
-
import { Protocol, VgiRpcServer, str, float } from "vgi-rpc";
|
|
35
|
+
import { Protocol, VgiRpcServer, str, float } from "@query-farm/vgi-rpc";
|
|
30
36
|
|
|
31
37
|
const protocol = new Protocol("Calculator");
|
|
32
38
|
|
|
@@ -53,7 +59,7 @@ server.run();
|
|
|
53
59
|
Connect to any vgi-rpc server programmatically:
|
|
54
60
|
|
|
55
61
|
```typescript
|
|
56
|
-
import { httpConnect, subprocessConnect } from "vgi-rpc";
|
|
62
|
+
import { httpConnect, subprocessConnect } from "@query-farm/vgi-rpc";
|
|
57
63
|
|
|
58
64
|
// HTTP transport
|
|
59
65
|
const client = httpConnect("http://localhost:8080");
|
|
@@ -180,7 +186,7 @@ protocol.producer<{ count: number; current: number }>("produce_with_header", {
|
|
|
180
186
|
Declare schemas using convenient type singletons instead of manual `Schema`/`Field` construction:
|
|
181
187
|
|
|
182
188
|
```typescript
|
|
183
|
-
import { str, bytes, int, int32, float, float32, bool } from "vgi-rpc";
|
|
189
|
+
import { str, bytes, int, int32, float, float32, bool } from "@query-farm/vgi-rpc";
|
|
184
190
|
|
|
185
191
|
// Shorthand
|
|
186
192
|
protocol.unary("echo", {
|
|
@@ -275,7 +281,7 @@ Errors are transmitted as zero-row Arrow batches with `EXCEPTION`-level metadata
|
|
|
275
281
|
|
|
276
282
|
## Testing with the Python CLI
|
|
277
283
|
|
|
278
|
-
The [vgi-rpc CLI](https://github.com/
|
|
284
|
+
The [vgi-rpc CLI](https://github.com/Query-farm/vgi-rpc-python) can introspect and call methods on any TypeScript server:
|
|
279
285
|
|
|
280
286
|
```bash
|
|
281
287
|
pip install vgi-rpc[cli]
|
|
@@ -295,7 +301,7 @@ vgi-rpc --cmd "bun run examples/streaming.ts" call scale factor=2.0
|
|
|
295
301
|
|
|
296
302
|
## Wire Protocol Compatibility
|
|
297
303
|
|
|
298
|
-
This library implements the same wire protocol as the Python [vgi-rpc](https://github.com/
|
|
304
|
+
This library implements the same wire protocol as the Python [vgi-rpc](https://github.com/Query-farm/vgi-rpc-python) framework:
|
|
299
305
|
|
|
300
306
|
- Multiple sequential Arrow IPC streams on stdin/stdout
|
|
301
307
|
- Request batches carry method name and version in batch metadata
|
|
@@ -303,7 +309,7 @@ This library implements the same wire protocol as the Python [vgi-rpc](https://g
|
|
|
303
309
|
- Zero-row batches for log messages and errors
|
|
304
310
|
- `__describe__` introspection method for cross-language service discovery
|
|
305
311
|
|
|
306
|
-
See the
|
|
312
|
+
See the [Wire Protocol Specification](https://vgi-rpc.query.farm/wire-protocol) for the full protocol details.
|
|
307
313
|
|
|
308
314
|
## Examples
|
|
309
315
|
|