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

toondb

v1.0.0

Published

Official JavaScript SDK for TOONDB service layer

Readme

toondb

Official JavaScript SDK for communicating with a TOONDB instance.

Overview

toondb provides a clean client for:

  • service health checks
  • collection management
  • CRUD operations
  • schema updates
  • TOON dumps
  • bridge-compatible action execution

TOONDB Instance Setup

To create and run a TOONDB database instance, use the main TOONDB project:

This SDK assumes you already have a running TOONDB service URL and credentials.

Requirements

  • Node.js >=18

Installation

npm install toondb

Quick Start

import { ToonDBClient } from "toondb";

const client = new ToonDBClient({
  baseUrl: "https://your-toondb-service-url",
  username: "your-username",
  password: "your-password",
});

const health = await client.health();
console.log(health);

Configuration

Explicit configuration

const client = new ToonDBClient({
  baseUrl: "https://example.toondb.io",
  username: "amit",
  password: "amit098",
  timeoutMs: 30000, // optional
});

Environment fallback

If omitted in constructor options, SDK auto-loads values from env vars:

  • TOONDB_URL
  • TOONDB_USER or TOONDB_USERNAME
  • TOONDB_PASS or TOONDB_PASSWORD
// works if env vars are set
const client = new ToonDBClient();

API Reference

Health

  • health()

Collection operations

  • createCollection(collection, schema)
  • updateCollectionSchema(collection, schema)
  • dump(collection) -> returns TOON string

Document operations

  • insert(collection, doc)
  • find(collection, filter?)
  • update(collection, filter, patch)
  • delete(collection, filter)

Bridge-compatible operations

  • bridge(request)
  • execute(action, payload?)
  • shutdown()

Supported bridge actions:

  • create_collection
  • insert
  • update
  • update_schema
  • find
  • delete
  • dump
  • shutdown

Usage Example (CRUD)

await client.createCollection("users", {
  fields: { name: "string", age: "number", active: "boolean" },
  indexed_fields: ["name"],
});

await client.insert("users", { name: "milo", age: 7, active: true });

const found = await client.find("users", {
  conditions: [{ field: "name", op: "eq", value: "milo" }],
});

await client.update(
  "users",
  { conditions: [{ field: "name", op: "eq", value: "milo" }] },
  { age: 8 }
);

const toonDump = await client.dump("users");
console.log(toonDump);

Error Handling

The SDK throws typed errors:

  • ToonDBAuthError for auth failures
  • ToonDBResponseError for API/server response failures
  • ToonDBNetworkError for transport/network failures
import { ToonDBAuthError, ToonDBNetworkError } from "toondb";

try {
  await client.health();
} catch (err) {
  if (err instanceof ToonDBAuthError) {
    console.error("Invalid credentials");
  } else if (err instanceof ToonDBNetworkError) {
    console.error("Network issue");
  } else {
    console.error(err);
  }
}

Development

Run tests:

npm test

Run smoke example:

TOONDB_URL=http://127.0.0.1:6767 TOONDB_USER=amit TOONDB_PASS=amit098 npm run smoke

Smoke script location:

  • examples/smoke.js

Contributing

Please see: