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

@birtalanrobert/audit

v1.0.0

Published

Append-only audit log that joins the caller transaction

Downloads

421

Readme

@birtalanrobert/audit

An append-only audit trail that joins the caller's transaction.

Why this package exists in this form

record() writes through the active EntityManager when one is open. That single property is the reason mortar adopted TypeORM at all: a package holding its own connection pool cannot join the caller's transaction, so a rollback would leave behind an audit row for a change that never happened — a confident record of a lie, which is worse than no record.

await runInTransaction(dataSource, async () => {
  await bookingRepo.save(booking);
  await audit.record({
    action: 'booking.cancelled',
    entityType: 'booking',
    entityId: booking.id,
    before,
    after,
  });
});
// Both commit, or neither does.

Append-only is enforced by the database

The service exposes no update or delete for individual rows, and the migration installs a trigger that raises on UPDATE. A trail that merely happens not to be edited is worth less than one that cannot be — and these projects use it to settle disputes about money, hours worked and who saw whose data.

Bulk time-based purging (purgeOlderThan) still works, because retention is a policy rather than a way to remove one inconvenient row.

Context is captured automatically

Tenant, actor, actor name, impersonator, request id, correlation id, address and user agent all come from the ambient request context. A caller writes one line and the entry is complete.

Impersonation records both parties — the operator and the account they acted as — because "who did this" has two answers when support is involved.

The actor's name is denormalised on purpose: a user who is later renamed or deleted must still be identifiable, and a join to a mutable table would quietly rewrite history.

Only changes are stored, and secrets never are

computeChanges() records just the fields that differ, with password, token, key, PIN, card and IBAN-shaped fields replaced by [redacted] — the fact of the change is recorded, the value is not.

Dates compare by instant rather than identity, so a record re-read from the database does not register as changed.