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

retold-harness-consistency-proxy

v1.0.0

Published

Splitter proxy that fans out requests to multiple retold-harness backends and compares responses for consistency.

Readme

Retold Harness Consistency Proxy

License: MIT

Splitter HTTP proxy that fans out every incoming request to multiple retold-harness backends in parallel, compares their responses, and returns a JSON envelope showing agreement or differences.

Features

  • Parallel Fan-out -- sends identical requests to all configured backends simultaneously
  • Automatic Field Exclusion -- ignores auto-generated fields (IDs, GUIDs, timestamps) during comparison
  • Type Normalization -- handles type coercions between databases (numeric strings vs numbers)
  • Array Comparison -- sorts and compares list responses element-by-element on business fields
  • Auto-Discovery -- probes default ports to find running retold-harness instances
  • Per-Provider Timing -- measures response time for each backend independently
  • JSON Envelope -- returns complete comparison report with per-provider results and diff paths
  • Graceful Error Handling -- continues operating when individual backends fail
  • CLI and Programmatic -- run as a standalone server or embed in your own Node.js application
  • Fable Service Architecture -- built on fable-serviceproviderbase for service injection

Installation

npm install retold-harness-consistency-proxy

Quick Start

CLI Usage

# Explicit backends
retold-harness-consistency-proxy --backends sqlite:8086,mysql:8087 --port 9090

# Auto-discover running backends on default ports
retold-harness-consistency-proxy --discover --port 9090

Programmatic Usage

const ConsistencyProxy = require('retold-harness-consistency-proxy');

let tmpProxy = new ConsistencyProxy(
	{
		port: 9090,
		backends: { 'sqlite': 8086, 'mysql': 8087 }
	});

tmpProxy.start(
	function (pError)
	{
		if (pError)
		{
			console.error('Failed to start:', pError);
			return;
		}
		console.log('Proxy listening on port 9090');
	});

Then send requests to the proxy on port 9090. Every request is forwarded to all backends and a comparison envelope is returned:

curl http://localhost:9090/1.0/Book/1

Response Envelope

Every response from the proxy follows this structure:

{
	"request": {
		"method": "GET",
		"path": "/1.0/Book/1",
		"timestamp": "2024-08-01T00:00:00.000Z"
	},
	"consistent": true,
	"providerCount": 2,
	"providers": {
		"sqlite": {
			"status": 200,
			"timingMs": 12,
			"body": { "IDBook": 1, "Title": "Dune", "Genre": "Science Fiction" },
			"error": null
		},
		"mysql": {
			"status": 200,
			"timingMs": 18,
			"body": { "IDBook": 50, "Title": "Dune", "Genre": "Science Fiction" },
			"error": null
		}
	},
	"differences": [],
	"summary": "All 2 providers agree"
}

CLI Options

| Flag | Short | Description | Default | |------|-------|-------------|---------| | --backends | -b | Comma-separated key:port pairs | (none) | | --discover | -d | Auto-discover running backends on default ports | false | | --port | -p | Port for the proxy server to listen on | 9090 |

Default Port Map

When using --discover, the proxy probes these default ports:

| Provider | Port | |----------|------| | SQLite | 8086 | | MySQL | 8087 | | MSSQL | 8088 | | PostgreSQL | 8089 | | MongoDB | 8090 | | DGraph | 8091 | | Solr | 8092 |

Excluded Fields

The comparator automatically excludes these fields from value comparison, since they differ across independent database instances:

| Pattern | Examples | |---------|----------| | /^ID[A-Z]/ | IDBook, IDAuthor, IDBookAuthorJoin | | /^GUID[A-Z]/ | GUIDBook, GUIDAuthor | | CreateDate | Timestamp auto-set on create | | UpdateDate | Timestamp auto-set on update | | DeleteDate | Timestamp auto-set on soft delete | | CreatingIDUser | User ID for create audit | | UpdatingIDUser | User ID for update audit | | DeletingIDUser | User ID for delete audit |

Architecture

The proxy is composed of three internal components:

| Component | Description | |-----------|-------------| | ConsistencyProxy | HTTP server that receives requests and orchestrates the flow | | RequestFanout | Fable service that sends identical requests to all backends in parallel | | ResponseComparator | Fable service that normalizes and diffs responses across providers | | Provider Discovery | Utility module for CLI parsing and port probing |

Testing

npm test

Tests use mock HTTP servers to simulate multiple retold-harness backends with different IDs and timestamps for the same business data.

Documentation

Full documentation is available in the docs directory.

Related Packages

License

MIT