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

@pactmark/driver-postgres-worker

v0.2.0

Published

Durable fenced PostgreSQL worker driver contracts and loop for Pactmark

Downloads

36

Readme

@pactmark/driver-postgres-worker

Durable-worker contracts, a concrete PostgreSQL queue, and a bounded, fenced polling loop for a PostgreSQL-backed Pactmark host.

The package does not open a database connection by itself. A host can inject its transaction-capable PostgreSQL client into DurablePostgresWorkerQueue; the minimal interface deliberately has no dependency on @pactmark/store-postgres. Each claim transaction uses database time and FOR UPDATE SKIP LOCKED, acquires or advances the run lease/fencing token, and binds the wakeup to the immutable tenant/run WorkOrder record. Renew, complete, release, and stale recovery match the exact receipt, request digest, lease ID, holder, and fence. Stale or replayed receipts therefore fail closed.

Claims reconstruct only the narrowed worker metadata persisted by migration 007: principal identity, purpose registry version, resource-scope ceiling, execution-definition digest, and the durable request. WorkOrder goal, input, challenge proof, credentials, and hidden reasoning are never loaded into the claim. Request and execution-definition digests are rechecked before dispatch. Grant authority is not cached in the queue and must still be verified at the runtime boundary immediately before an effect.

PostgresRunWorker.runOnce() recovers stale claims, claims at most the configured concurrency, issues a run-scoped delegated authority, verifies it immediately before dispatch, and records completion or a bounded retry. Human-decision states are parked by the injected RunDriver; the worker cannot manufacture decision rights.

Production readiness additionally requires the queue implementation, command unit of work, and wake-up outbox to share the same PostgreSQL transaction domain. This package alone is not evidence that a host satisfies that requirement.

Tests

The unit suite includes stateful SQL-boundary races. The integration suite must be pointed at a disposable real PostgreSQL database and proves competing claims, stale recovery, monotonically increasing fences, stale completion rejection, parked completion, and reconstruction after a new queue instance:

pnpm --filter @pactmark/driver-postgres-worker test

PACTMARK_TEST_POSTGRES_URL='postgresql://…' \
pnpm --filter @pactmark/driver-postgres-worker test:integration