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

weave-typescript

v0.11.4

Published

TypeScript bindings for the Weave platform. The package ships generated protobuf message types, gRPC service clients, and Postgres query helpers so applications can talk to Weave services and databases from Node.js and modern TypeScript runtimes.

Downloads

721

Readme

weave-typescript

TypeScript bindings for the Weave platform. The package ships generated protobuf message types, gRPC service clients, and Postgres query helpers so applications can talk to Weave services and databases from Node.js and modern TypeScript runtimes.

  • gRPC-ready service clients produced from Buf-managed protobuf definitions.
  • Strongly-typed SQL helpers generated with sqlc for the WeaveSQL datasets.

Installation

pnpm add weave-typescript
# or
npm install weave-typescript
# or
yarn add weave-typescript

The package includes runtime dependencies on @grpc/grpc-js, @bufbuild/protobuf, and pg; no extra installs are required when using the default export.

Quick start

import { credentials } from "@grpc/grpc-js";
import { auth } from "weave-typescript";

const client = new auth.AuthClient(
  "api.weave.com:443",
  credentials.createSsl()
);

client.initiateOAuth(
  {
    provider: "github",
    redirectUri: "https://example.com/oauth/callback",
    state: "csrf-token",
    scope: "openid profile email",
    providerParams: {},
  },
  (err, response) => {
    if (err) throw err;
    console.log(response.authUrl);
  }
);

Every protobuf module under src/weaveapi/** is re-exported from the root package. Service namespaces expose message types, client constructors, and server implementations that the @grpc/grpc-js ecosystem expects.

Query helpers for WeaveSQL

import { Client } from "pg";
import { getModel } from "weave-typescript/weavesql/llmxdb/models_sql";

const client = new Client({ connectionString: process.env.DATABASE_URL });
await client.connect();

const row = await getModel(client, { slug: "weave/sonnet-3" });
if (!row) {
  console.log("model not found");
} else {
  console.log(row.name, row.capabilities);
}

Each helper follows the sqlc convention: the exported SQL text constants match the query names while the functions perform typed marshalling to and from pg array results. When you regenerate SQL code, the TypeScript bindings stay in sync with new database migrations.

Development

pnpm install           # install dependencies
pnpm build             # emit dist/ with JS and type declarations
pnpm test              # run sqlc generator unit tests (tools/sqlcgen.test.js)
pnpm generate          # rebuild src/index.ts barrel exports
pnpm generate:sqlc-config --schema ../schema/weavesql
                       # regenerate sqlc.yaml for local schemas

Regenerating protobuf clients

  1. Sync the schema/ directory (or point Buf at the shared schema checkout).
  2. Run buf generate (Buf picks up buf.gen.yaml and writes into src/).
  3. Execute pnpm generate to rebuild the barrel exports.
  4. Re-run pnpm build so dist/ reflects the new artifacts.

SQL code generation

The tools/sqlcgen.js utility scans schema/weavesql/** (or the directory passed via --schema) and writes an sqlc.yaml that targets the TypeScript sqlc plugin. Regenerate it before running sqlc generate so new databases or query directories are included.

Contributing

Follow the project coding guidelines in CODE_STYLE.md, prefer small focused commits, and keep generated artifacts out of Git history unless they are part of a release. Pull requests should include regenerated protobufs/SQL bindings when schemas change and cover the relevant tooling scripts with tests where practical.