← All packages

@lacspace/audit-log

v1.0.0Commerce & Ledger0 deps

Structured audit-trail toolkit — record who did what, when, with before/after diffs, actor attribution and redaction. Build tamper-evident activity logs. Zero-dependency, isomorphic.

npm i @lacspace/audit-log

Usage

audit-log.ts
import { createAuditor } from "@lacspace/audit-log";

const audit = createAuditor({ redact: ["password", "token"] });

const evt = audit.record({
  actor:  { id: "admin_2", role: "admin" },
  action: "product.price.update",
  target: "sku_1",
  before: { price: 1200 },
  after:  { price: 999 },
});
// evt.changes -> [{ field: "price", from: 1200, to: 999 }] — who did what, attributed

Exports 6

auditEventdiffredactEventformatEventcreateAuditorREDACTED

Keywords

audit-logaudit-trailactivity-logattributioncompliancediff

More in Commerce & Ledger