TypeScript SDK
Connect RPC Node.js Browser
The QQL TypeScript SDK is a Connect RPC client that wraps the QQL gateway. Works in Node.js and browser environments.
Prerequisites
Section titled “Prerequisites”Start the QQL gateway:
qql-go serve --qdrant-url http://localhost:6334Install
Section titled “Install”The QQL TypeScript SDK is not yet published to npm. Build from the repository:
npm:
npm install qql-clientyarn:
yarn add qql-clientfrom source:
cd sdks/typescriptnpm installnpm run buildQuick Start
Section titled “Quick Start”import { QQLClient } from "qql-client";
const client = new QQLClient("http://localhost:50051");
// Execute a queryconst result = await client.exec("QUERY 'emergency triage' FROM docs LIMIT 5 USING HYBRID");console.log(result.data);
// Batch queriesconst results = await client.execBatch([ "QUERY 'emergency triage' FROM docs LIMIT 5", "QUERY 'cardiac arrest' FROM docs LIMIT 5",]);
// Explain without executingconst plan = await client.explain("QUERY 'search' FROM docs LIMIT 5 USING HYBRID RERANK");console.log(plan);
// Health checkconst health = await client.health();console.log(health);With Authentication
Section titled “With Authentication”const client = new QQLClient("http://localhost:50051", { token: "eyJhbGciOiJSUzI1NiIs..." // JWT bearer token});| Method | Description |
|---|---|
client.exec(query) | Execute a single QQL statement |
client.execBatch(queries) | Execute multiple statements |
client.explain(query) | Return execution plan without running |
client.health() | Check gateway + Qdrant connectivity |
Module Support
Section titled “Module Support”The TypeScript SDK ships dual CJS/ESM builds:
{ "main": "dist/cjs/index.js", "module": "dist/esm/index.js", "types": "dist/types/index.d.ts"}Response Type
Section titled “Response Type”interface ExecResult { ok: boolean; operation: string; message: string; data: unknown; // decoded JSON}Using with curl (HTTP JSON)
Section titled “Using with curl (HTTP JSON)”The gateway also accepts raw HTTP calls without any SDK:
curl -X POST http://localhost:50051/qql.QQL/Exec-H "Content-Type: application/json"-d '{"query": "QUERY "search" FROM docs LIMIT 5 USING HYBRID"}'