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

@86d-app/audit-log

v0.0.25

Published

Audit logging for admin actions and system events in 86d commerce platform

Readme

[!WARNING] This project is under active development and is not ready for production use. Please proceed with caution. Use at your own risk.

Audit Log Module

Records admin actions, system events, and API key usage for security auditing, compliance, and accountability. Other modules can record audit entries through the exported controller interface.

Installation

npm install @86d-app/audit-log

Usage

import auditLog from "@86d-app/audit-log";

const module = auditLog({
  retentionDays: 90, // auto-purge entries older than 90 days
});

Configuration

| Option | Type | Default | Description | |---|---|---|---| | retentionDays | number | 0 | Days to retain audit entries before auto-purge. 0 disables auto-purge. |

Admin Endpoints

| Method | Path | Description | |---|---|---| | GET | /admin/audit-log/entries | List audit entries (filterable by action, resource, actor, date range) | | GET | /admin/audit-log/entries/:id | Get a single audit entry | | GET | /admin/audit-log/resource/:resource/:resourceId | Get audit history for a specific resource | | GET | /admin/audit-log/actor/:actorId | Get audit history for a specific actor | | GET | /admin/audit-log/summary | Get aggregate activity summary | | POST | /admin/audit-log/purge | Purge entries older than a specified date |

Store Endpoints

| Method | Path | Description | |---|---|---| | GET | /audit-log/my-activity | Get the authenticated user's own audit history (paginated via take/skip query params). Requires an active session. |

Controller API

The AuditLogController interface is exported for use by other modules to record audit entries.

interface AuditLogController {
  log(params: CreateAuditEntryParams): Promise<AuditEntry>;
  getById(id: string): Promise<AuditEntry | null>;
  list(params?: AuditListParams): Promise<{ entries: AuditEntry[]; total: number }>;
  listForResource(resource: string, resourceId: string, params?: { take?: number; skip?: number }): Promise<AuditEntry[]>;
  listForActor(actorId: string, params?: { take?: number; skip?: number }): Promise<AuditEntry[]>;
  getSummary(params?: { dateFrom?: Date; dateTo?: Date }): Promise<AuditSummary>;
  purge(olderThan: Date): Promise<number>;
}

Types

type AuditAction =
  | "create" | "update" | "delete"
  | "bulk_create" | "bulk_update" | "bulk_delete"
  | "login" | "logout"
  | "export" | "import"
  | "settings_change" | "status_change" | "custom";

type ActorType = "admin" | "system" | "api_key";

interface AuditEntry {
  id: string;
  action: AuditAction;
  resource: string;
  resourceId?: string;
  actorId?: string;
  actorEmail?: string;
  actorType: ActorType;
  description: string;
  changes?: Record<string, unknown>;
  metadata?: Record<string, unknown>;
  ipAddress?: string;
  userAgent?: string;
  createdAt: Date;
}

interface AuditSummary {
  totalEntries: number;
  entriesByAction: Record<string, number>;
  entriesByResource: Record<string, number>;
  recentActors: Array<{ actorId: string; actorEmail?: string; count: number }>;
}

Notes

  • The /audit-log/my-activity store endpoint lets authenticated customers view their own audit trail.
  • Other modules should use AuditLogController.log() to record audit entries through inter-module contracts.
  • Date range filtering is performed in-memory since ModuleDataService does not support range queries.
  • The summary endpoint returns counts grouped by action, resource, and the top 10 most active actors.
  • Purging deletes entries one by one; use retention policies for automatic cleanup.