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

@parmanasystems/audit-db

v1.98.56

Published

Deterministic audit persistence infrastructure for immutable governance lineage, replay-safe execution history, provenance continuity, and independently verifiable governance evidence storage.

Readme

@parmanasystems/audit-db

Append-only PostgreSQL audit persistence for the Parmana governance runtime. Every governed execution, verification result, security event, and API access is recorded fire-and-forget — writes never block server responses. The schema is managed by runMigrations(), which is called automatically during server startup. The AuditDb class exposes typed read methods for the dashboard and /audit/* API routes.


Public API

class AuditDb {
  constructor(connectionString: string)

  /** Check database connectivity. Throws on failure. */
  async ping(): Promise<void>

  /** Run schema migrations. Called automatically by the server on startup. */
  async migrate(): Promise<void>

  /** Alias for migrate(). */
  async runMigrations(): Promise<void>

  /** Close the connection pool. */
  async close(): Promise<void>
  async disconnect(): Promise<void>

  // ── Write methods (fire-and-forget — do not await) ──────────────────────

  /** Record a governance execution attestation. Idempotent on execution_id. */
  recordDecision(attestation: ExecutionAttestation): void

  /** Record the result of an attestation verification. */
  recordVerification(executionId: string, result: OperationalVerificationResult): void

  /** Record a security event (auth failure, replay attempt, etc.). */
  recordSecurityEvent(event: SecurityEventInput): void

  /** Record an API access log entry. */
  recordApiAccess(access: ApiAccessInput): void

  // ── Read methods ─────────────────────────────────────────────────────────

  /** Paginated decision timeline with optional filters. */
  async getDecisionTimeline(
    limit?: number,             // default: 100
    filter?: DecisionFilter
  ): Promise<DecisionTimelineRow[]>

  /** Aggregate statistics (counts of decisions, verifications, security events, API calls). */
  async getStats(): Promise<AuditStats>

  /** Look up a single decision record by execution ID. Returns null if not found. */
  async getDecisionById(executionId: string): Promise<AuditDecision | null>
}

/** Run schema migrations using a pre-existing PoolClient. */
async function runMigrations(client: PoolClient): Promise<void>

// ── Input types ─────────────────────────────────────────────────────────────

interface SecurityEventInput {
  event_type: string;
  severity: SecurityEventSeverity;
  ip_address?: string;
  path?: string;
  method?: string;
  user_agent?: string;
  details?: Record<string, unknown>;
}

type SecurityEventSeverity = "low" | "medium" | "high" | "critical"

interface ApiAccessInput {
  method: string;
  path: string;
  status_code: number;
  response_time_ms?: number;
  ip_address?: string;
  user_agent?: string;
  executionId?: string;
}

interface DecisionFilter {
  policyId?: string;
  decision?: string;
  from_date?: string;
  to_date?: string;
}

// ── Row types ────────────────────────────────────────────────────────────────

interface AuditStats {
  total_decisions: string;
  decisions_today: string;
  total_verifications: string;
  valid_verifications: string;
  invalid_verifications: string;
  total_security_events: string;
  total_api_calls: string;
}

interface DecisionTimelineRow { /* columns from view_decision_timeline */ }

Environment variables

| Variable | Description | |---|---| | AUDIT_DATABASE_URL | PostgreSQL DSN. The server reads this directly — if unset, AuditDb is not instantiated and all /audit/* routes are absent. |

In the docker-compose setup, this is constructed automatically:

postgresql://Parmana:${POSTGRES_PASSWORD}@postgres:5432/Parmana_audit

Package wiring

@parmanasystems/audit-db imports ExecutionAttestation from @parmanasystems/execution and OperationalVerificationResult from @parmanasystems/verifier. It has no other internal @parmanasystems dependencies. The server creates a single AuditDb instance on startup and passes it to route handlers, which call recordDecision, recordVerification, and recordSecurityEvent after each request.