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

@g3-toolkit/core

v1.2.0

Published

Framework-agnostic graph data model, adapters, and algorithms for the g3-toolkit.

Readme

@g3-toolkit/core

Framework-agnostic data model, adapters, projection pipeline, and algorithms for the g3-toolkit. Zero React dependency; usable from Vue, Angular, Svelte, or plain JavaScript.

Live: playground · Storybook · wiring guide (every guide snippet runs in CI).

Install

npm install @g3-toolkit/core
# or
pnpm add @g3-toolkit/core

Quick start

import { SparqlAdapter } from "@g3-toolkit/core";

const ugm = await new SparqlAdapter("https://example.org/sparql").query(
  "SELECT * WHERE { ?s ?p ?o } LIMIT 200",
);

console.log(`Graph has ${ugm.nodeCount} nodes, ${ugm.edgeCount} edges.`);

Subpath imports

@g3-toolkit/core ships subpath exports so consumers can pull only what they need:

import { ForceLayout } from "@g3-toolkit/core/layout";
import { ShaclValidator } from "@g3-toolkit/core/shacl";
import { ProjectionPipeline } from "@g3-toolkit/core/projection";

Available subpaths: adapters, middleware, events, projection, pipeline, shacl, diff, layout, algorithms, undo-redo, theme, path-analysis.

Adapter requests: timeouts, cancellation, and failures

Every remote adapter times out after 30 seconds by default. Override it per adapter, or pass 0 to turn it off:

import { SparqlAdapter, RestAdapter } from "@g3-toolkit/core";

const sparql = new SparqlAdapter("https://example.org/sparql", undefined, {
  timeoutMs: 60_000,
});

const rest = new RestAdapter({
  url: "https://example.org/graph",
  mapResponse: () => ({ nodes: [], edges: [] }),
  timeoutMs: 5_000,
});

void [sparql, rest];

Failures arrive as named errors rather than as bare strings, so a host can branch on them:

import { SparqlAdapter } from "@g3-toolkit/core";
import { AdapterHttpError, AdapterArgumentError } from "@g3-toolkit/core/adapters";
import { AdapterTimeoutError } from "@g3-toolkit/core/middleware";

const adapter = new SparqlAdapter("https://example.org/sparql");

try {
  await adapter.query("SELECT * WHERE { ?s ?p ?o }");
} catch (err) {
  if (err instanceof AdapterArgumentError) {
    // The request never left: an argument could not be safely placed.
  } else if (err instanceof AdapterTimeoutError) {
    // `err.timedOut` separates the timeout from a caller cancellation.
  } else if (err instanceof AdapterHttpError) {
    // The endpoint answered and refused. `err.status`, `err.url` and
    // `err.body` carry what it said, truncated to 1000 characters.
  }
}

To cancel an in-flight request, pass an AbortSignal on the request through middleware; the default transport honors it alongside its own timeout.

Building a middleware chain by hand needs a base transport at the end of it. createDefaultFetch is that transport, and it takes the same timeout the adapters do:

import {
  composeMiddleware,
  createDefaultFetch,
  bearerAuth,
  DEFAULT_TIMEOUT_MS,
} from "@g3-toolkit/core/middleware";

const fetcher = composeMiddleware(
  [bearerAuth(() => sessionStorage.getItem("token") ?? "")],
  createDefaultFetch({ timeoutMs: DEFAULT_TIMEOUT_MS }),
);

void fetcher;

Before wiring a browser directly to a graph store, read SECURITY.md on what the auth middleware does and does not protect.

Documentation

Full documentation, architecture overview, and integration examples: g3-toolkit repository.

See ARCHITECTURE.md for the toolkit/application boundary and docs/source/ for adopter guides.

License

Apache-2.0