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

@scrunchee/client

v0.4.0

Published

TypeScript SDK for Neumann database

Downloads

96

Readme

@neumann/client

TypeScript SDK for the Neumann database.

Installation

npm install @neumann/client

For browser support with gRPC-Web:

npm install @neumann/client grpc-web

Quick Start

import { NeumannClient, isRowsResult, rowToObject } from '@neumann/client';

// Connect to a remote server
const client = await NeumannClient.connect('localhost:9200', {
  apiKey: 'your-api-key',
  tls: true,
});

// Execute a query
const result = await client.execute('SELECT users');

if (isRowsResult(result)) {
  for (const row of result.rows) {
    console.log(rowToObject(row));
  }
}

// Close the connection
client.close();

Features

  • Dual environment support: Node.js (gRPC) and browser (gRPC-Web)
  • Type-safe: Full TypeScript support with discriminated unions
  • Streaming: Support for streaming query results
  • Batch queries: Execute multiple queries efficiently
  • Error handling: Typed error hierarchy with error codes

Connection Options

Node.js (gRPC)

const client = await NeumannClient.connect('localhost:9200', {
  apiKey: 'your-api-key',
  tls: true,
  metadata: { 'custom-header': 'value' },
});

Browser (gRPC-Web)

const client = await NeumannClient.connectWeb('https://api.example.com', {
  apiKey: 'your-api-key',
});

Query Execution

Single Query

const result = await client.execute('SELECT users WHERE age > 21');

Streaming Query

for await (const result of client.executeStream('SELECT large_table')) {
  if (isRowsResult(result)) {
    console.log(`Batch of ${result.rows.length} rows`);
  }
}

Batch Queries

const results = await client.executeBatch([
  'SELECT users',
  'SELECT orders',
  'SELECT products',
]);

Result Types

Query results use discriminated unions for type safety:

import {
  isRowsResult,
  isNodesResult,
  isEdgesResult,
  isPathsResult,
  isSimilarResult,
  isErrorResult,
} from '@neumann/client';

const result = await client.execute(query);

switch (result.type) {
  case 'rows':
    for (const row of result.rows) {
      console.log(rowToObject(row));
    }
    break;
  case 'nodes':
    for (const node of result.nodes) {
      console.log(nodeToObject(node));
    }
    break;
  case 'similar':
    for (const item of result.items) {
      console.log(`${item.key}: ${item.score}`);
    }
    break;
  case 'error':
    console.error(result.message);
    break;
}

Value Types

The SDK provides type-safe value handling:

import {
  intValue,
  stringValue,
  valueToNative,
  valueFromNative,
} from '@neumann/client';

// Create typed values
const age = intValue(25);
const name = stringValue('Alice');

// Convert to native JavaScript types
const nativeAge = valueToNative(age); // number: 25

// Convert from native JavaScript values
const value = valueFromNative(42); // { type: 'int', data: 42 }

Error Handling

import {
  NeumannError,
  ConnectionError,
  AuthenticationError,
  QueryError,
  ErrorCode,
} from '@neumann/client';

try {
  const result = await client.execute(query);
} catch (error) {
  if (error instanceof ConnectionError) {
    console.error('Connection failed:', error.message);
  } else if (error instanceof AuthenticationError) {
    console.error('Auth failed:', error.message);
  } else if (error instanceof QueryError) {
    console.error('Query failed:', error.message);
  } else if (error instanceof NeumannError) {
    console.error(`Error [${ErrorCode[error.code]}]:`, error.message);
  }
}

API Reference

NeumannClient

| Method | Description | | ------ | ----------- | | connect(address, options) | Connect via gRPC (Node.js) | | connectWeb(address, options) | Connect via gRPC-Web (browser) | | execute(query, options) | Execute a single query | | executeStream(query, options) | Stream query results | | executeBatch(queries, options) | Execute multiple queries | | close() | Close the connection | | isConnected | Check connection status | | clientMode | Get client mode (remote/embedded) |

ConnectOptions

| Option | Type | Description | | ------ | ---- | ----------- | | apiKey | string | API key for authentication | | tls | boolean | Enable TLS encryption | | metadata | Record<string, string> | Custom headers |

QueryOptions

| Option | Type | Description | | ------ | ---- | ----------- | | identity | string | Identity for vault access |

Requirements

  • Node.js 18.0.0 or later
  • TypeScript 5.0+ (for type definitions)

License

MIT