npm / SDK 0.8.3
JavaScript & TypeScript
ES modules with TypeScript declarations.
Node.js 24+ · No runtime dependencies.
npm install @polymathbase/polybase-client@0.8.3View on npm ↗Client SDKs / 0.8.3
Connect your application to a local Polybase console with the published JavaScript, TypeScript and Rust clients. SDK 0.8.3 is qualified against database 0.8.2.
npm / SDK 0.8.3
ES modules with TypeScript declarations.
Node.js 24+ · No runtime dependencies.
npm install @polymathbase/polybase-client@0.8.3View on npm ↗crates.io / SDK 0.8.3
Synchronous local HTTP client.
Rust 1.89+ · serde & serde_json.
cargo add polybase-client@0.8.3View on crates.io ↗Download the matching database tools, extract the archive and run these commands from the extracted directory:
./bin/polybase init ./my-db
./bin/polybase-console ./my-db 7340The SDKs connect to http://127.0.0.1:7340. They contain no database engine or hosted service. Keep the console on loopback.
The npm package includes compiled JavaScript and declarations. Import it from an ES module; no TypeScript compiler is required to run JavaScript:
import {Client, hex, unhex} from '@polymathbase/polybase-client';
const client = new Client();
const read = await client.readRevision('tasks/1');
await client.writeRevision(read.revision, JSON.stringify({status: 'open'}));
const page = await client.page({
key_prefix: hex('tasks/'), predicate: 'json', value: '',
json: {op: 'eq', path: ['status'], value: 'open'},
});
for (const row of page.rows) {
console.log(new TextDecoder().decode(unhex(row.value)));
}
The Rust client uses blocking HTTP over standard-library TCP. Start with a revision read, a conditional write and a bounded query:
use polybase_client::{Client, Query};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new("127.0.0.1:7340".parse()?)?;
let read = client.read_revision(b"tasks/1")?;
client.write_revision(&read.revision, Some(br#"{"status":"open"}"#))?;
let page = client.page(&Query::all(b"tasks/"), None, 64)?;
println!("{} rows at {}", page.rows.len(), page.position);
Ok(())
}
A timed-out write can still commit. Neither SDK automatically retries writes. Reconcile application state before another write; a stale revision is reported as HTTP 409.
Persist subscription rows and the last applied token atomically before asking for the next page. Use resume(savedToken) in JavaScript or resume(&saved_token) in Rust after restart. Resume returns a session identity, without taking another snapshot. Delivery can repeat and tokens can expire.
Requests are bounded to 128 KiB and responses to 8 MiB. JavaScript rejects unsafe integers before transport. Returned keys and values use lowercase hex; positions use decimal strings. JavaScript applies a five-second request timeout; Rust sets five-second connect, read and write socket timeouts.
search calls /api/search for bounded current-head JSON scalar equality or Unicode whole-word search. It returns rows at one committed position without a subscription. searchIndex in JavaScript and search_index in Rust instead search one named equality index. Use query pages for captured-snapshot pagination.
The server's index-create route accepts its prefix as a JSON byte array; the named client helpers perform that conversion. Other key and key_prefix fields use lowercase hex. Read the HTTP reference.
Both SDKs are public source under MIT. The repository fields point to that source, and tag clients-v0.8.3 identifies the package revision. The database engine remains private, and its downloadable executables retain their separate binary evaluation terms.
SDK 0.8.3 adds the missing Rust resume, backup-verification, index and compaction helpers, and named search methods in both clients. HTTP error responses preserve their status even when the body is not JSON. See the TypeScript guide and Rust guide for the complete client contract.
Hosted SaaS is coming soon. These clients connect to your local console today.