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

@hitl-sdk/state-pg

v1.1.0

Published

Postgres store for hitl. Bring your own pg-compatible pool.

Readme

@hitl-sdk/state-pg

Postgres-backed State for Hitl. Bring your own pg pool — the package implements approval persistence and ships a setup CLI (same idea as Workflow DevKit's workflow-postgres-setup).

Install

npm install @hitl-sdk/hitl @hitl-sdk/state-pg pg

hitl and pg are peer dependencies in practice: you need a Postgres client to construct PostgresState.

Setup

Run migrations before deploying or on first boot in production. The default table is hitl.human_requests.

export HITL_POSTGRES_URL=postgres://user:password@host:5432/database
npx @hitl-sdk/state-pg setup

DATABASE_URL and WORKFLOW_POSTGRES_URL are also accepted as fallbacks (same precedence as other HITL_* env vars in this SDK). Prefer HITL_POSTGRES_URL so Hitl persistence is explicit and separate from WDK's Postgres world.

Custom table name:

npx @hitl-sdk/state-pg setup --table custom_approvals

Export DDL (no database connection)

Print idempotent SQL to stdout — useful for hand-managed migration pipelines:

npx @hitl-sdk/state-pg schema
npx @hitl-sdk/state-pg schema --table custom_approvals

Programmatically:

import { schemaSql, migrationSql, SCHEMA_VERSION } from "@hitl-sdk/state-pg";

schemaSql(); // all migrations concatenated
migrationSql("001_initial", "hitl.human_requests"); // single migration

Workflow DevKit Postgres world

This package only creates Hitl tables. If you use Workflow DevKit with the Postgres world, run its migrations separately:

npx workflow-postgres-setup

Usage

import pg from "pg";
import { Hitl } from "@hitl-sdk/hitl";
import { PostgresState } from "@hitl-sdk/state-pg";

const pool = new pg.Pool({
  connectionString: process.env.HITL_POSTGRES_URL ?? process.env.DATABASE_URL,
});

const state = new PostgresState(pool);
await state.ensureSchema(); // idempotent; or rely on `npx @hitl-sdk/state-pg setup` at deploy time

export const hitl = new Hitl({ state, /* resolver, adapters, … */ });

PostgresState accepts any object that implements PgQueryable (query(sql, params?)), so Neon, Supabase, or pg-mem pools work as long as they speak Postgres SQL.

Migrations

Schema changes are versioned inside this package (SCHEMA_VERSION). Re-run setup or ensureSchema() after upgrading @hitl-sdk/state-pg to apply new migrations idempotently.

Upgrading from the legacy default table hitl.approvals is handled automatically by migration 006_rename_human_requests when you use the new default hitl.human_requests. Custom --table names are not renamed automatically.