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

@gomagentic/verdict-audit

v0.1.1

Published

Verdict async audit pipeline: batching sink with bounded buffering, retry, drop accounting, and queue adapters. Decisions never block on audit I/O.

Readme

@gomagentic/verdict-audit

Async audit pipeline: batched, bounded, retrying. Never blocks a decision.

Part of Verdict — a serverless-first authorization engine. Policies (RBAC / ABAC / ReBAC) compile once and decide in microseconds, embedded in your app, behind a central PDP, or synced to the edge.

Authorization decisions are the hot path; writing the audit trail is not. This sink buffers decision records in memory and flushes them in batches to your store or queue. The buffer is bounded: past its limit it drops the oldest records — and counts the drops — rather than growing without limit or making a request wait on audit I/O. An audit outage degrades to dropped records, never to failed or slowed decisions.

Install

npm install @gomagentic/verdict-audit

Usage

Wrap any downstream sink — anything with writeAudit(records), such as a @gomagentic/verdict-store audit sink — in a BufferedAuditSink. Calls to writeAudit append to the buffer and return immediately; flushes happen on batch size, on interval, or explicitly.

import { BufferedAuditSink } from "@gomagentic/verdict-audit";
import type { AuditRecord } from "@gomagentic/verdict-core";

// `store` is any AuditSinkLike: async writeAudit(records: readonly AuditRecord[])
const sink = new BufferedAuditSink(store, {
  maxBatch: 200,          // records per downstream write (default 200)
  flushIntervalMs: 2_000, // time-based flush (default 2000 ms)
  maxBuffered: 10_000,    // bounded buffer; oldest dropped beyond this (default 10 000)
  onError: (err) => console.error("audit write failed", err),
  onDrop: (count) => console.warn(`audit dropped ${count} records`),
});

// On the request path: fire-and-forget, never awaited on the hot path.
await sink.writeAudit(records); // returns as soon as the records are buffered

// On Workers, drain in the background instead of blocking the response:
ctx.waitUntil(sink.flush());

// On shutdown (or between requests elsewhere): final drain.
await sink.stop(); // flushes, then rejects further records

flush() drains the buffer in maxBatch chunks and coalesces concurrent callers; stop() performs a final flush and stops accepting records.

Backpressure & drops

The buffer is capped at maxBuffered. When it would overflow, the oldest records are evicted (recent history wins) and the drop count is incremented — onDrop fires with the number evicted. A downstream write failure increments failures, invokes onError, and re-queues the batch at the front (subject to the same bound) to retry on the next write, interval, or explicit flush().

The stats getter exposes live counters:

const { buffered, written, dropped, failures } = sink.stats;
// buffered — records currently in memory awaiting flush
// written  — records successfully handed to the downstream sink
// dropped  — records evicted because the buffer was full
// failures — downstream write failures (each re-queues its batch)

Queue adapter

QueueAuditSink adapts a batch queue — anything exposing sendBatch(messages: { body: AuditRecord }[]), such as Cloudflare Queues, SQS, or a Kafka producer — into an AuditSinkLike. Each record becomes one queue message for durable, out-of-band delivery. Compose it under a BufferedAuditSink to get batching and bounded buffering in front of the queue:

import { BufferedAuditSink, QueueAuditSink } from "@gomagentic/verdict-audit";

// `env.AUDIT_QUEUE` is a Cloudflare Queue binding (has sendBatch)
const sink = new BufferedAuditSink(new QueueAuditSink(env.AUDIT_QUEUE));

Documentation

License

Apache-2.0