{"_id":"@arpabet/vrpc","_rev":"2-d27ed39f8d3ee6d61146d0e08e3b97ae","name":"@arpabet/vrpc","dist-tags":{"latest":"0.2.1"},"versions":{"0.2.0":{"name":"@arpabet/vrpc","version":"0.2.0","keywords":["rpc","websocket","msgpack","streaming","value-rpc","vue","nuxt"],"license":"Apache-2.0","_id":"@arpabet/vrpc@0.2.0","maintainers":[{"name":"karagatan","email":"alex@karagatan.com"}],"homepage":"https://github.com/arpabet/value-rpc-js#readme","bugs":{"url":"https://github.com/arpabet/value-rpc-js/issues"},"dist":{"shasum":"c15eeec93f8653381a052dd66e59a5bfc39c85f4","tarball":"https://registry.npmjs.org/@arpabet/vrpc/-/vrpc-0.2.0.tgz","fileCount":5,"integrity":"sha512-GLgkypyx00zi51PLqQG1Twg8DibSXpbmBUQkGBUTnG/mNmO8NMJ9OPQXPCwnIFRyr6HlOiKKLJOcDyFbSWW3ww==","signatures":[{"sig":"MEMCIA8w5DyLLXkl3sHQtI7IpOAbPGLbPd7r+JT6s8p51IOdAh8Ix18qUmfBC9y3C2vGGlcczIZ2k33wDAgXGpDxa8NZ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":248590},"type":"module","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"c959ca53006317a48d6fd2a7f589e7b1a7286ccc","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"karagatan","email":"alex@karagatan.com"},"repository":{"url":"git+https://github.com/arpabet/value-rpc-js.git","type":"git","directory":"packages/vrpc"},"_npmVersion":"10.9.8","description":"value-rpc client for browsers and Node: msgpack/JSON codecs, streams with credit flow control, reconnect with hash-chain resumption, reverse calls","directories":{},"sideEffects":false,"_nodeVersion":"22.23.1","dependencies":{"happy-dom":"20.11.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.3.0","vitest":"^4.1.10","typescript":"^5.6.0","@types/node":"^26.1.0"},"_npmOperationalInternal":{"tmp":"tmp/vrpc_0.2.0_1784437594025_0.84298831364783","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@arpabet/vrpc","version":"0.2.1","description":"value-rpc client for browsers and Node: msgpack/JSON codecs, streams with credit flow control, reconnect with hash-chain resumption, reverse calls","license":"Apache-2.0","type":"module","sideEffects":false,"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup","test":"vitest run","typecheck":"tsc --noEmit"},"devDependencies":{"@types/node":"^26.1.0","tsup":"^8.3.0","typescript":"^5.6.0","vitest":"^4.1.10"},"engines":{"node":">=22"},"keywords":["rpc","websocket","msgpack","streaming","value-rpc","vue","nuxt"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/arpabet/value-rpc-js.git","directory":"packages/vrpc"},"dependencies":{"happy-dom":"20.11.0"},"_id":"@arpabet/vrpc@0.2.1","gitHead":"43c4f0acdff6bcdbd4b2a7ac29f36f6c6a7ca39e","bugs":{"url":"https://github.com/arpabet/value-rpc-js/issues"},"homepage":"https://github.com/arpabet/value-rpc-js#readme","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-CGwa2sG5xptca0PjAOS+kybB5iwzU49qtd+WSMpu8OVlJsDrGTOhkO8iJdOnVoNoOWHnv2OngHqHFfY6HnEDng==","shasum":"3e99d9d5fbfac83704ba8c255c780725c2b285ce","tarball":"https://registry.npmjs.org/@arpabet/vrpc/-/vrpc-0.2.1.tgz","fileCount":5,"unpackedSize":253638,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAddpGtQ4c83KEY3g43znx2Y4vewQmuDXs//y5BR4ZWQAiEAwZ9MvXkvn9W2MXyHTrpdnRbyTkv6HNaIvSX6SRLiB8Y="}]},"_npmUser":{"name":"karagatan","email":"alex@karagatan.com"},"directories":{},"maintainers":[{"name":"karagatan","email":"alex@karagatan.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vrpc_0.2.1_1785920095566_0.8356663485264473"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-19T05:06:33.851Z","modified":"2026-08-05T08:54:55.916Z","0.2.0":"2026-07-19T05:06:34.211Z","0.2.1":"2026-08-05T08:54:55.705Z"},"bugs":{"url":"https://github.com/arpabet/value-rpc-js/issues"},"license":"Apache-2.0","homepage":"https://github.com/arpabet/value-rpc-js#readme","keywords":["rpc","websocket","msgpack","streaming","value-rpc","vue","nuxt"],"repository":{"type":"git","url":"git+https://github.com/arpabet/value-rpc-js.git","directory":"packages/vrpc"},"description":"value-rpc client for browsers and Node: msgpack/JSON codecs, streams with credit flow control, reconnect with hash-chain resumption, reverse calls","maintainers":[{"name":"karagatan","email":"alex@karagatan.com"}],"readme":"# @arpabet/vrpc\n\nvalue-rpc protocol core for browsers, Node ≥ 22, and Bun. Zero runtime\ndependencies. See the [repo README](../../README.md) for the full tour.\n\n```ts\nimport { createClient } from \"@arpabet/vrpc\";\n\nconst client = createClient({ url: \"wss://example.com/rpc\" });\n\nawait client.call(\"greet\", [\"world\"]);                    // unary\nfor await (const v of client.getStream(\"count\", [10])) {} // server stream\nawait client.putStream(\"upload\", null, values);           // client stream\nconst chat = client.chat(\"chat.echo\");                    // bidirectional\n\nclient.addFunction(\"notify\", (args) => null);             // server calls YOU\n```\n\n## Options (`createClient`)\n\n| Option | Default | Meaning |\n|---|---|---|\n| `url` | — | `ws://` / `wss://` endpoint |\n| `codec` | `\"msgpack\"` | `\"msgpack\"` works with every server; `\"json\"` needs a JSON-codec server (negotiated via the `vrpc.json` subprotocol) |\n| `auth` | — | credential (or async factory) for the handshake `auth` field |\n| `timeoutMs` | `5000` | default unary timeout, sent as the request SLA |\n| `connectTimeoutMs` | `10000` | dial + handshake bound |\n| `metadata` | — | `Metadata` or per-request factory (`traceparent`, …) |\n| `reconnect` | enabled | backoff options or `false` |\n| `resume` | `true` | hash-chain session resumption across reconnects |\n| `maxPending` | `4096` | per-stream receive window (flow-control credit) |\n| `dialect` | standard | wire field names; must match the server's `Dialect` |\n| `webSocket` / `dialer` | global / WS | overrides for tests and custom transports |\n\n## Error model\n\nEvery failure is a `VrpcError` with a `code` mirroring `valuerpc.Code`:\n\n```ts\ntry {\n  await client.call(\"user.get\", [42]);\n} catch (err) {\n  if (err instanceof VrpcError && err.code === Code.Unavailable) retryLater();\n}\n```\n\nTimeouts map to `Code.DeadlineExceeded`, aborts to `Code.Canceled`,\nconnection loss to `Code.Unavailable` — the same branches a Go caller writes\nwith `valuerpc.CodeOf`.\n\n## Value model\n\n`null | boolean | number | bigint | string | Uint8Array | Value[] | {…} |\nVrpcDouble | VrpcDecimal | VrpcExt`\n\n- Integer `number`s encode as value LONG; beyond ±2^53 pass a `bigint`\n  (exact int64 over msgpack). `double(x)` forces a DOUBLE encoding.\n- `Uint8Array` is value RAW bytes.\n- Maps are plain objects; keys encode sorted (canonical frames).\n- `VrpcDecimal` (`decimal(\"1.045\")`) and `VrpcExt` round-trip over msgpack.\n\n## Streams & flow control\n\n`getStream` returns an async iterator; **credit is granted to the server as\nyou consume**, so a slow consumer backpressures the producer losslessly.\n`break`/`return` sends a `CancelRequest`. `putStream`/`chat.send` honor the\ncredit the server grants — a misbehaving peer is cut off with\n`Code.ResourceExhausted`, exactly like the Go client.\n\n## Reverse calls\n\nThe server can invoke functions and open streams on this client\n(`addFunction`, `addOutgoingStream`, `addIncomingStream`, `addChat`) — the\nsame registrar surface `valueserver.Server` has. Handlers receive\n`(args, ctx)` where `ctx.signal` aborts on cancellation/disconnect.\n","readmeFilename":"README.md"}