{"id":49244955,"url":"https://github.com/oxia-db/oxia-client-node","last_synced_at":"2026-04-30T02:00:56.695Z","repository":{"id":353454244,"uuid":"1219489724","full_name":"oxia-db/oxia-client-node","owner":"oxia-db","description":"Oxia Node.js Client SDK","archived":false,"fork":false,"pushed_at":"2026-04-24T20:17:49.000Z","size":179,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-29T01:03:39.705Z","etag":null,"topics":["client","grpc","nodejs","oxia","oxia-db","sdk","typescript"],"latest_commit_sha":null,"homepage":"https://oxia-db.github.io/docs/clients/node","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxia-db.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T23:43:33.000Z","updated_at":"2026-04-24T20:17:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/oxia-db/oxia-client-node","commit_stats":null,"previous_names":["oxia-db/oxia-client-node"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oxia-db/oxia-client-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxia-db%2Foxia-client-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxia-db%2Foxia-client-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxia-db%2Foxia-client-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxia-db%2Foxia-client-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxia-db","download_url":"https://codeload.github.com/oxia-db/oxia-client-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxia-db%2Foxia-client-node/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32451481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","grpc","nodejs","oxia","oxia-db","sdk","typescript"],"created_at":"2026-04-24T21:03:54.098Z","updated_at":"2026-04-30T02:00:56.624Z","avatar_url":"https://github.com/oxia-db.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oxia Node.js Client SDK\n\n[![CI](https://github.com/oxia-db/oxia-client-node/actions/workflows/ci.yml/badge.svg)](https://github.com/oxia-db/oxia-client-node/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/@oxia-db/client.svg)](https://www.npmjs.com/package/@oxia-db/client)\n[![License](https://img.shields.io/badge/license-Apache%202.0-white.svg)](https://github.com/oxia-db/oxia-client-node/blob/main/LICENSE)\n\nNode.js / TypeScript client for [Oxia](https://oxia-db.github.io/), a scalable metadata store and\ncoordination system for large-scale distributed systems.\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://oxia-db.github.io/docs/getting-started\"\u003eGetting Started\u003c/a\u003e |\n  \u003ca href=\"https://oxia-db.github.io/docs/clients/node\"\u003eDocumentation\u003c/a\u003e |\n  \u003ca href=\"https://oxia-db.github.io/oxia-client-node/api/\"\u003eTSDoc reference\u003c/a\u003e |\n  \u003ca href=\"https://www.npmjs.com/package/@oxia-db/client\"\u003enpm\u003c/a\u003e |\n  \u003ca href=\"https://github.com/oxia-db/oxia/discussions/new/choose\"\u003eDiscussion\u003c/a\u003e\n\u003c/p\u003e\n\n## Requirements\n\n* Node.js 20+\n\n## Install\n\n```bash\nnpm install @oxia-db/client\n```\n\n## Quick start\n\n```ts\nimport { OxiaClient, EXPECTED_RECORD_DOES_NOT_EXIST } from '@oxia-db/client';\n\nconst client = await OxiaClient.connect('localhost:6648');\ntry {\n  const { key, version } = await client.put('/users/alice', 'hello', {\n    expectedVersionId: EXPECTED_RECORD_DOES_NOT_EXIST, // fail if already exists\n  });\n\n  const got = await client.get('/users/alice');\n  console.log(got.key, new TextDecoder().decode(got.value), got.version.versionId);\n\n  await client.delete('/users/alice');\n} finally {\n  await client.close();\n}\n```\n\n## Client options\n\n```ts\nawait OxiaClient.connect('localhost:6648', {\n  namespace: 'default',          // default: 'default'\n  sessionTimeoutMs: 30_000,      // default: 30s; min 2000ms\n  heartbeatIntervalMs: 3_000,    // default: ~sessionTimeoutMs/10, floored at 2s\n  clientIdentifier: 'my-worker', // default: random UUID hex\n  requestTimeoutMs: 30_000,      // default: 30s; applied to unary RPCs only\n  initTimeoutMs: 30_000,         // time to wait for the first shard map\n  authentication: undefined,     // see \"Authentication\" below\n});\n```\n\n## Operations\n\n### put / delete / get\n\n```ts\nawait client.put('/k', 'v');\nawait client.put('/k', 'v2', { expectedVersionId: v1.version.versionId });\nawait client.put('/k', 'v',  { ephemeral: true });                  // removed when client closes\nawait client.put('/k', 'v',  { secondaryIndexes: { 'by-user': 'alice' } });\n\nawait client.delete('/k');\nawait client.delete('/k', { expectedVersionId: v.version.versionId });\n\nconst r = await client.get('/k');                                   // EQUAL\nconst r2 = await client.get('/k', { comparisonType: ComparisonType.FLOOR });\nconst r3 = await client.get('alice', { useIndex: 'by-user' });      // by secondary index\n```\n\n### Range operations\n\n```ts\n// List all keys in a range (hierarchical ordering; see note below).\nconst keys = await client.list('/users/', '/users/~');\n\n// Stream records in a range.\nfor await (const rec of client.rangeScan('/users/', '/users/~')) {\n  console.log(rec.key, new TextDecoder().decode(rec.value));\n}\n\n// Delete a range.\nawait client.deleteRange('/tmp/', '/tmp/~');\n```\n\nWith a `partitionKey`, operations are limited to a single shard:\n\n```ts\nawait client.put('entry-a', 'v', { partitionKey: 'session-42' });\nawait client.list('entry-', 'entry-~', { partitionKey: 'session-42' });\n```\n\n### Sequential keys\n\n```ts\nconst r = await client.put('ticket', 'payload', {\n  partitionKey: 'queue',\n  sequenceKeysDeltas: [1],  // server assigns a zero-padded suffix\n});\nconsole.log(r.key); // -\u003e \"ticket-00000000000000000001\"\n```\n\n### Notifications\n\n```ts\nconst notifications = client.getNotifications();\nfor await (const n of notifications) {\n  console.log(n.type, n.key, n.versionId);\n  if (shouldStop()) notifications.close(); // ends the loop\n}\n```\n\n### Sequence updates\n\n```ts\nconst updates = client.getSequenceUpdates('ticket', { partitionKey: 'queue' });\nfor await (const latestKey of updates) {\n  console.log('sequence advanced to', latestKey);\n}\n```\n\n## Authentication\n\n```ts\nimport { OxiaClient, TokenAuthentication } from '@oxia-db/client';\n\n// Static bearer token:\nconst client = await OxiaClient.connect('oxia.example.com:6648', {\n  authentication: new TokenAuthentication('my-token'),\n});\n\n// Or a refresh-on-demand supplier:\nconst client2 = await OxiaClient.connect('oxia.example.com:6648', {\n  authentication: new TokenAuthentication(async () =\u003e fetchTokenFromIdp()),\n});\n```\n\nYou can also implement the `Authentication` interface directly to add\narbitrary gRPC metadata headers to every outgoing RPC:\n\n```ts\nimport type { Authentication } from '@oxia-db/client';\n\nclass MyAuth implements Authentication {\n  generateCredentials() {\n    return { 'x-my-header': 'value' };\n  }\n}\n```\n\n## Errors\n\nAll client errors extend `OxiaError`:\n\n| Error                       | Meaning                                                    |\n| --------------------------- | ---------------------------------------------------------- |\n| `KeyNotFoundError`          | `get` / `delete` against a missing key                     |\n| `UnexpectedVersionIdError`  | conditional `put` / `delete` saw a different version       |\n| `SessionNotFoundError`      | ephemeral `put` referenced a session the server has closed |\n| `InvalidOptionsError`       | incompatible option combination (e.g. `sequenceKeysDeltas` without `partitionKey`) |\n\n## Verifying the published package\n\nEvery release is published from a GitHub Actions run with\n[SLSA provenance](https://slsa.dev/spec/v1.0/provenance) signed by\nSigstore. You can verify that a given `@oxia-db/client` version came from\nthis repository's `release.yml` workflow — with no long-lived npm token\nanywhere in the chain — before installing it:\n\n```bash\nnpm audit signatures @oxia-db/client\n```\n\nnpm also shows the provenance attestation on the\n[package page](https://www.npmjs.com/package/@oxia-db/client) under\n*Provenance*.\n\n## License\n\nApache License 2.0. See `LICENSE` and `NOTICE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxia-db%2Foxia-client-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxia-db%2Foxia-client-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxia-db%2Foxia-client-node/lists"}