npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

hyperspace-sdk-ts

v2.2.1

Published

Official TypeScript SDK for HyperspaceDB gRPC API

Readme

HyperspaceDB TypeScript SDK

Official TypeScript client for HyperspaceDB gRPC API (v2.2.1).

Use this SDK for:

  • collection lifecycle management
  • vector insert and search
  • high-throughput batched search (searchBatch)
  • bulk insertion (batchInsert)
  • advanced filtering and hybrid search
  • typed metadata (string | number | boolean)
  • graph traversal APIs (getNode, getNeighbors, getConceptParents, traverse, findSemanticClusters)
  • rebuild with metadata pruning (rebuildIndexWithFilter)
  • multi-tenant authentication headers (x-api-key, x-hyperspace-user-id)

Requirements

  • Node.js 18+
  • Running HyperspaceDB server (default gRPC endpoint: localhost:50051)

Installation

npm install hyperspace-sdk-ts

Quick Start

import { HyperspaceClient } from "hyperspace-sdk-ts";

async function main() {
  const client = new HyperspaceClient("localhost:50051", "I_LOVE_HYPERSPACEDB");
  const collection = "docs_ts";

  await client.deleteCollection(collection).catch(() => {});
  await client.createCollection(collection, 3, "cosine");

  await client.insert(1, [0.1, 0.2, 0.3], { source: "demo" }, collection);
  await client.insert(2, [0.2, 0.1, 0.4], { source: "demo" }, collection);

  const results = await client.search([0.1, 0.2, 0.3], 5, collection);
  console.log(results);

  client.close();
}

main().catch(console.error);

API Overview

new HyperspaceClient(host?, apiKey?, userId?)

  • host: gRPC endpoint, default localhost:50051
  • apiKey: optional API key
  • userId: optional tenant/user ID

createCollection(name, dimension, metric)

Create a new collection.

  • metric: "l2" | "cosine" | "poincare"

deleteCollection(name)

Delete collection and all its data.

insert(id, vector, meta?, collection?, durability?)

Insert one vector. Accepts number[], Float32Array, Float64Array. Optional typedMetadata supports typed values for range/boolean filters.

batchInsert(items, collection?, durability?)

Efficient bulk insertion.

await client.batchInsert([
  { id: 10, vector: [0.1, 0.1, 0.1], metadata: { tag: "a" } },
  { id: 11, vector: [0.2, 0.2, 0.2], metadata: { tag: "b" } }
], "my_collection");

search(vector, topK, collection?, options?)

Run nearest-neighbor search. Options include filters, hybridQuery, and hybridAlpha. Decimal range values are supported and sent as gte_f64/lte_f64 in gRPC payload.

const results = await client.search(vector, 10, "coll", {
  filters: [
    { match: { key: "category", value: "electronics" } },
    { range: { key: "price", gte: 100, lte: 500 } }
  ],
  hybridQuery: "latest smartphone",
  hybridAlpha: 0.5
});

searchBatch(vectors, topK, collection?)

Run multiple searches in one gRPC request to reduce RPC overhead.

getDigest(collection?)

Retrieve collection stats and logical clock.

close()

Close underlying gRPC channel.

subscribeToEvents(options, onEvent, onError?)

Subscribe to CDC stream events from server:

const stream = client.subscribeToEvents(
  { types: ["insert", "delete"], collection: "docs_ts" },
  (event) => console.log("event:", event.toObject()),
  (err) => console.error(err),
);

rebuildIndex(collection)

Trigger index rebuild/vacuum for a collection.

rebuildIndexWithFilter(collection, filter)

Rebuild with metadata pruning for sleep/reconsolidation workflows.

await client.rebuildIndexWithFilter("docs_ts", {
  key: "energy",
  op: "lt",
  value: 0.1,
});

HyperbolicMath

import { HyperbolicMath } from "hyperspace-sdk-ts";

const z = HyperbolicMath.mobiusAdd([0.1, 0.0], [0.2, 0.0]);

Provided utilities:

  • mobiusAdd(x, y, c?)
  • expMap(x, v, c?)
  • logMap(x, y, c?)
  • riemannianGradient(x, euclideanGrad, c?)
  • parallelTransport(x, y, v, c?)
  • frechetMean(points, c?, maxIter?, tol?)

Performance Notes

  • Prefer searchBatch and batchInsert for throughput-heavy services.
  • Reuse one client instance per process or worker.

Error Handling

All methods reject on transport/protocol errors. Targets gRPC data plane operations. For control plane endpoints (/api/*), use regular HTTP requests to the server's HTTP port.