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

@reactorynet/workflow-es-postgres

v2.0.0

Published

PostgreSQL persistence provider for Workflow ES (Reactory fork)

Readme

@reactorynet/workflow-es-postgres

PostgreSQL persistence provider for Workflow ES (Reactory fork).

Built on Sequelize 6 and sequelize-typescript. It implements the IPersistenceProvider contract so a Workflow ES host can store workflow instances, execution pointers, event subscriptions, and events in Postgres.

Install

npm install @reactorynet/workflow-es-postgres pg pg-hstore

Usage

import { configureWorkflow } from "@reactorynet/workflow-es";
import { PostgresPersistence } from "@reactorynet/workflow-es-postgres";

const persistence = new PostgresPersistence(
    "postgres://user:password@localhost:5432/workflow"
);

// Wait for the connection + schema sync before starting the host.
await persistence.connect;

const config = configureWorkflow();
config.usePersistence(persistence);

const host = config.getHost();
// register workflows, then:
await host.start();

Constructor

new PostgresPersistence(connectionString: string, options?: SequelizeOptions)
  • connectionString — a Postgres connection URI.
  • options — optional Sequelize options merged over the defaults (dialect: "postgres", logging: false). Use this to configure the connection pool, schema, logging, SSL dialectOptions, etc.

On construction the provider opens a connection and runs sequelize.sync() to create the workflows, execution_pointers, subscriptions, and events tables if they do not exist. Await the connect promise before use.

Schema notes

  • nextExecution / sleepUntil are stored as BIGINT (they hold Date.now() epoch milliseconds, which overflow a 4-byte INTEGER) and normalised back to JS numbers on read.
  • Document fields (data, persistenceData, eventKey, eventData, outcome, children, contextItem, scope) are stored as JSONB.
  • Execution pointers are owned by their workflow: persistWorkflow replaces a workflow's pointers wholesale inside a transaction, preserving the factory-assigned pointer ids.

Using MySQL (and other Sequelize dialects)

The PostgresPersistence class passes its options argument directly to Sequelize, which is a multi-dialect ORM. You can point it at a MySQL database by setting dialect: "mysql" and installing the mysql2 driver:

npm install @reactorynet/workflow-es-postgres mysql2
import { PostgresPersistence } from "@reactorynet/workflow-es-postgres";

const persistence = new PostgresPersistence(
    "mysql://user:password@localhost:3306/workflow",
    { dialect: "mysql" }
);
await persistence.connect;

Under MySQL, Sequelize maps JSONB columns to JSON and UUID columns to CHAR(36) automatically. No source changes are needed.

Note on existing MySQL data: if you are migrating from the deprecated workflow-es-mysql package (which used Sequelize 4), the schema produced by Sequelize 6 may differ. Greenfield installs are unaffected — sequelize.sync() creates the correct tables on first connect.

Testing

The spec runs against a real Postgres instance. By default it connects to the Reactory develop compose service:

npm test

Override the target with an environment variable:

WORKFLOW_ES_PG_TEST_URL="postgres://user:password@host:5432/db" npm test