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

@cnstra/persist-postgres

v0.3.0

Published

Postgres relational store for CNStra resumable execution (ICNSStimulationRepository: run/attempt/task) — owns its schema + migrations

Readme

@cnstra/persist-postgres

⚠️ Experimental: API may change.

A Postgres relational store for CNStra's resumable run/attempt/task model — implements ICNSStimulationRepository (the run roster → attempt timeline → task waterfall the retry admin renders). Makes the resumable-execution history survive a process restart, and a retried run resumes from the persisted frontier.

This is domain #2 (run/attempt/task history), distinct from the resume checkpoint progress store (domain #1 — @cnstra/pg-boss/postgres-progress, @cnstra/progress-redis).

Install

npm install @cnstra/persist-postgres pg

Use

import { CNSPostgresStimulationRepository } from '@cnstra/persist-postgres';

const repo = new CNSPostgresStimulationRepository({
  connectionString: process.env.DATABASE_URL, // or { pool } / { queryable }
  tablePrefix: 'cns_',                          // default
  autoMigrate: true,                            // lazily create tables on first use
});

// Drives the persistor (write) and the retry UI (read):
//   saveRun / saveStimulation / appendTask ; getRun / listRuns / getStimulations / getTasks / delete

Reuses the IPgQueryable seam, so pg is an optional peer — inject any pg client/pool, or pass a connectionString for the repo to own a Pool (close() ends it).

Schema

Five tables under the prefix (default cns_). The run's progress is normalised: the outstanding frontier into cns_run_frontier (one row per task) and per-neuron context into cns_run_context, so you can query the frontier — rebuilt into TCNSProgress on read.

cns_run(stimulation_run_id PK, entry jsonb, status, created_at, updated_at)
cns_run_frontier(run_id → cns_run, ord, neuron_name, dendrite_collateral_name, input jsonb)
cns_run_context(run_id → cns_run, neuron_name, value jsonb)
cns_stimulation(stimulation_id PK, run_id → cns_run, attempt_number, status, started_at,
                completed_at, hop_count, has_error, replay_of, entry jsonb,
                UNIQUE(run_id, attempt_number))
cns_task(stimulation_id, index, neuron_name, dendrite_collateral_name, input_index,
         output jsonb, status, error, started_at, duration, PK(stimulation_id, index))

Migrations

The package owns its schema. Auto-created on first use, or manage it yourself:

DATABASE_URL=postgres://... npx cnstra-persist-postgres migrate
# CNS_TABLE_PREFIX=my_ to override the prefix

or call ensureSchema(pool, prefix) from @cnstra/persist-postgres.

License

MIT