The hlquery TypeScript API is the official TypeScript client for hlquery. It wraps the HTTP/JSON interface in typed classes so TypeScript and Node.js applications can work with hlquery without manually assembling URLs, request bodies, auth headers, and response parsing.
The library follows the same modular service layout as the JavaScript client: collections, documents, search, SQL, SAM+, aliases, synonyms, stopwords, overrides, keys, and raw request access.
Use the TypeScript API when you want hlquery integration to be explicit, typed, and easy to refactor. The client keeps common operations readable, centralizes auth handling, and gives editors and build tools useful method signatures for the hlquery API surface.
$ npm install hlquery-typescript-clientFor local development inside this repository:
$ npm install
$ npm run build
$ npm testimport Client from 'hlquery-typescript-client';
const client = new Client(process.env.HLQ_BASE_URL || 'http://localhost:9200', {
token: process.env.HLQ_TOKEN,
auth_method: 'bearer',
});
const health = await client.health();
const collections = await client.collections().list(0, 10);
console.log(health.getStatusCode());
console.log(collections.getBody());import Client from 'hlquery-typescript-client';
async function main(): Promise<void> {
const client = new Client('http://localhost:9200');
await client.collections().create('products', {
fields: [
{ name: 'id', type: 'string' },
{ name: 'title', type: 'string' },
{ name: 'content', type: 'string' },
{ name: 'price', type: 'float' },
],
searchable_fields: ['title', 'content'],
filterable_fields: ['price'],
sortable_fields: ['price'],
});
await client.documents().add('products', {
id: 'product1',
title: 'Laptop Computer',
content: 'High-performance laptop with 16GB RAM',
price: 1299.99,
});
const results = await client.search('products', {
q: 'laptop',
query_by: ['title', 'content'],
limit: 10,
});
console.log(results.getBody());
}
main().catch(console.error);