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

@openknot-ts/redis-client

v0.0.6-preview

Published

Redis client resources, connection watch and health check for OpenKnot applications, over node-redis.

Readme

@openknot-ts/redis-client

Manages application-created node-redis command and subscription clients as a Wire resource, with a connection watch and a health check. Types derive from the SDK.

Usage

const redis = redisClient({
  requirements: { settings },
  create: ({ settings }) => ({
    commands: createClient({ url: settings.REDIS_URL }),
    subscriber: createClient({ url: settings.REDIS_URL }),
  }),
});

API

| Export | Description | | --- | --- | | redisClient({ requirements?, create }) | The clients as a resource. Resolves to them plus connection. | | redisHealthCheck({ redis, name?, timeoutMs? }) | The subscriber client must be ready and PING must answer PONG within the check's deadline (one second by default). | | redisConnectionOf(client) | A ConnectionWatch over a client this resource does not manage. | | RedisConnections, RedisCommands, RedisSubscriber | Types. |

Lifecycle

  • Both clients connect at acquisition. A client's first error before it is ready fails startup; once ready, its native reconnection applies.
  • Once ready, a client's first error of each outage goes to unattendedFailures from @openknot-ts/error-reporting/wire, which logs it as openknot.redis failed and reports it. The attribute openknot.redis.client names the client, commands or subscriber. The errors of its reconnection attempts are not reported again until it is ready once more.
  • A failed or cancelled startup destroys both. Release closes each once: a ready client first receives the replies to the commands it already sent, a client that is not ready is destroyed at once, and a connection that fails while closing ends the release with its error.
  • node-redis's command timeout only covers sending. Set socket.socketTimeout with pingInterval so a server that stops answering cannot hold a command, or the application's stop.
  • Consumers share the resource through requirements; cache adapters never close it.

Connection

connection holds a ConnectionWatch from @openknot-ts/wire per client, connection.commands and connection.subscriber, which @openknot-ts/cache, @openknot-ts/replication and the outbox accept. Work listens to the client it uses:

export const replicaStorage = redisReplicaStore({
  requirements: { redis },
  commands: ({ redis }) => redis.commands,
  connection: ({ redis }) => redis.connection.commands,
});

export const replicaChannel = redisReplicationChannel({
  requirements: { redis },
  connections: ({ redis }) => redis,
  connection: ({ redis }) => redis.connection.subscriber,
});

Each watch's watch({ lost, restored }) returns an unsubscribe. It follows its own client: reconnecting or end reports lost once, the next ready reports restored.

Tests

test/resource.test.ts runs without a server. With REDIS_URL set, pnpm --filter @openknot-ts/redis-client test:redis runs test/redis.integration.ts.