{"_id":"@beblurt/blurt-rpc-core","name":"@beblurt/blurt-rpc-core","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@beblurt/blurt-rpc-core","version":"0.1.0","description":"Generic JSON-RPC 2.0 core for transports, retries, endpoint pools, hooks and observability.","license":"MIT","type":"module","packageManager":"npm@10.9.8","repository":{"type":"git","url":"git+ssh://git@gitlab.com/blurt-blockchain/blurt-rpc-core.git"},"bugs":{"url":"https://gitlab.com/blurt-blockchain/blurt-rpc-core/-/issues"},"homepage":"https://gitlab.com/blurt-blockchain/blurt-rpc-core#readme","publishConfig":{"access":"public"},"sideEffects":false,"main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./testing":{"types":"./dist/testing/index.d.ts","import":"./dist/testing/index.js","default":"./dist/testing/index.js"}},"scripts":{"build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","lint":"eslint src tests --max-warnings=0","lint:fix":"eslint src tests --fix","test":"vitest run","test:watch":"vitest"},"engines":{"node":">=18"},"keywords":["json-rpc","rpc","typescript","transport","failover","retry"],"devDependencies":{"@eslint/js":"^9.39.1","@types/node":"^24.10.1","eslint":"^9.39.1","typescript":"^5.9.3","typescript-eslint":"^8.48.0","vitest":"^4.0.14"},"_id":"@beblurt/blurt-rpc-core@0.1.0","gitHead":"933d44ca6ea028ef864f1df6e26516408dbc870f","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-qj/Kk+95R+ZiLDMAS/AjS4vOvgQlBHWfcOxDCJ5j9A4VL7tWappoXl+92GWAeNalME+wLcPPhpaZpvBXChXE1Q==","shasum":"fdbc35266a3c5e2f34e8ea24a77c3e1140813f1e","tarball":"https://registry.npmjs.org/@beblurt/blurt-rpc-core/-/blurt-rpc-core-0.1.0.tgz","fileCount":81,"unpackedSize":173243,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHQnvgXR9nJ+ydL5FifkEpPtNL+vuvNStsqKu7X8r4NKAiAEtIX4KXcQ+335Sj9BC9JYRIIPml3ToxXlmYNtT+oz4Q=="}]},"_npmUser":{"name":"beblurt","email":"dev@beblurt.com"},"directories":{},"maintainers":[{"name":"beblurt","email":"dev@beblurt.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/blurt-rpc-core_0.1.0_1782126463848_0.7472113804459444"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-22T11:07:43.649Z","0.1.0":"2026-06-22T11:07:43.982Z","modified":"2026-06-22T11:07:44.437Z"},"maintainers":[{"name":"beblurt","email":"dev@beblurt.com"}],"description":"Generic JSON-RPC 2.0 core for transports, retries, endpoint pools, hooks and observability.","homepage":"https://gitlab.com/blurt-blockchain/blurt-rpc-core#readme","keywords":["json-rpc","rpc","typescript","transport","failover","retry"],"repository":{"type":"git","url":"git+ssh://git@gitlab.com/blurt-blockchain/blurt-rpc-core.git"},"bugs":{"url":"https://gitlab.com/blurt-blockchain/blurt-rpc-core/-/issues"},"license":"MIT","readme":"# blurt-rpc-core\n\nGeneric JSON-RPC 2.0 core for TypeScript projects.\n\nThis package is intentionally domain-agnostic. It provides implemented primitives for:\n\n- JSON-RPC requests and responses;\n- a `RpcClient` facade for single calls, raw calls, notifications and batches;\n- `fetch`-based HTTP transport with timeout and abort support;\n- retries and backoff;\n- endpoint pools and selection strategies;\n- ordered lifecycle hooks;\n- generic metrics;\n- optional explicit cache;\n- structured public errors;\n- testing helpers.\n\nIt does not implement blockchain logic, health checks, scoring, cryptographic signatures, chain validation or MCP server behavior.\n\n## Status\n\nMVP implemented. The core is usable as a generic JSON-RPC engine and is covered by unit tests for client orchestration, transport, retry/failover, node-pool selection, cache, hooks, metrics and structured errors.\n\n## Install\n\n```bash\nnpm install @beblurt/blurt-rpc-core\n```\n\nThe package is ESM-only, targets Node.js >= 18, and also runs in browser runtimes\nthat provide `fetch`, `AbortController`, `URL` and `setTimeout`.\n\n## Scripts\n\n```bash\nnpm run build\nnpm run typecheck\nnpm run lint\nnpm test\nnpm audit --audit-level=high\n```\n\n## Minimal usage\n\n```ts\nimport { RpcClient } from '@beblurt/blurt-rpc-core'\n\nconst rpc = new RpcClient('https://rpc.example.org', { timeoutMs: 4000 })\nconst result = await rpc.call('namespace.method', { limit: 10 })\n```\n\n## Raw responses\n\n```ts\nconst response = await rpc.call('namespace.method', { limit: 10 }, { responseMode: 'response' })\n```\n\n## Multiple endpoints and retry/failover\n\n```ts\nimport { fixedBackoff, RpcClient } from '@beblurt/blurt-rpc-core'\n\nconst rpc = new RpcClient(['https://rpc-a.example.org', 'https://rpc-b.example.org'], {\n  retry: { maxAttempts: 3, backoff: fixedBackoff(250) }\n})\n\nconst value = await rpc.call('namespace.method')\n```\n\n## Explicit cache\n\nCaching is never implicit and the core never decides cacheability from method names.\n\n```ts\nimport { MemoryCacheProvider, RpcClient } from '@beblurt/blurt-rpc-core'\n\nconst rpc = new RpcClient('https://rpc.example.org', {\n  cache: { provider: new MemoryCacheProvider(), ttlMs: 5000 }\n})\n\nawait rpc.call('namespace.method', { limit: 10 }, { cache: { ttlMs: 5000 } })\n```\n\n## Hooks and metrics\n\n```ts\nimport { InMemoryMetricsCollector, RpcClient } from '@beblurt/blurt-rpc-core'\n\nconst metrics = new InMemoryMetricsCollector()\nconst rpc = new RpcClient('https://rpc.example.org', {\n  metrics,\n  hooks: {\n    beforeRequest: (request, context) => {\n      // Return a replacement request to mutate, or void to continue unchanged.\n    },\n    afterAttempt: (outcome) => {\n      // Observe success/error for each concrete attempt.\n    }\n  }\n})\n```\n\n## Documentation\n\nStart with:\n\n- `ARCHITECTURE.md`\n- `API.md`\n- `DESIGN_DECISIONS.md`\n- `docs/public-api.md`\n- `docs/release-0.1.0.md`\n- module reference pages under `docs/`\n\n## Non-goals\n\nNo blockchain, scoring, signatures, health checks, method-specific behavior or MCP server code belongs in this package.\n","readmeFilename":"README.md","_rev":"1-f3c838e3d9e70c40bb3d2f74521fa00a"}