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

@meistrari/audit-sdk

v0.5.0

Published

TypeScript client for the Audit Service. Sends audit events to `POST /v1/events` with retries, backoff and `429 Retry-After` handling. Failures after retries are logged via `@meistrari/logger` instead of throwing.

Readme

@meistrari/audit-sdk

TypeScript client for the Audit Service. Sends audit events to POST /v1/events with retries, backoff and 429 Retry-After handling. Failures after retries are logged via @meistrari/logger instead of throwing.

Install

bun add @meistrari/audit-sdk
# or
npm install @meistrari/audit-sdk

Configuration

| Option | Env var | Default | Description | | --- | --- | --- | --- | | baseUrl | AUDIT_API_BASE_URL | — (required) | Base URL of the Audit API | | sourceApp | AUDIT_SOURCE_APP | — (required) | Identifier of the application sending events (e.g. tela) | | timeoutMs | — | 5000 | Per-request timeout | | maxRetries | — | 3 | Retry attempts on 5xx / network errors |

The constructor throws if baseUrl or sourceApp cannot be resolved from either the config object or the environment.

Event shape

interface AuditEvent {
    action: string                       // required, e.g. 'create'
    object_type: string                  // required, e.g. 'api_key'
    origin: 'api' | 'worker' | 'ui'      // required
    object_id?: string
    actor_type?: 'user' | 'system' | 'api_key'
    correlation_id?: string
    user_agent?: string
    occurred_at?: Date
    ip_address?: string
    metadata?: Record<string, unknown>
}

All calls require a dataToken issued by the API Gateway / Auth API. It carries the workspace (and user, when available) the events belong to.

Examples

Track a single event

import { AuditClient } from '@meistrari/audit-sdk'

const audit = new AuditClient({
    baseUrl: 'https://audit.tela.com',
    sourceApp: 'tela',
})

await audit.track(dataToken, {
    action: 'create',
    object_type: 'api_key',
    object_id: 'key_abc123',
    origin: 'api',
    actor_type: 'user',
    metadata: { name: 'CI token' },
})

Configure from environment

// AUDIT_API_BASE_URL and AUDIT_SOURCE_APP must be set
const audit = new AuditClient()

await audit.track(dataToken, {
    action: 'login',
    object_type: 'session',
    origin: 'ui',
})

Batch multiple events

await audit.trackMany(dataToken, [
    {
        action: 'create',
        object_type: 'document',
        object_id: 'doc_1',
        origin: 'worker',
        actor_type: 'system',
        correlation_id: 'job_42',
    },
    {
        action: 'update',
        object_type: 'document',
        object_id: 'doc_1',
        origin: 'worker',
        actor_type: 'system',
        correlation_id: 'job_42',
        metadata: { fields: ['title'] },
    },
])

Custom timeout and retries

const audit = new AuditClient({
    baseUrl: 'https://audit.tela.com',
    sourceApp: 'my-app',
    timeoutMs: 2000,
    maxRetries: 5,
})

Handling errors

track / trackMany only throw AuditError for 4xx responses (the request is malformed and retrying won't help). 5xx, network errors and timeouts are retried with exponential backoff; if all attempts fail, the SDK logs the failure and resolves without throwing — the caller's flow is never blocked by audit.

import { AuditClient, AuditError } from '@meistrari/audit-sdk'

try {
    await audit.track(dataToken, event)
}
catch (err) {
    if (err instanceof AuditError) {
        // 4xx — bad payload, missing fields, invalid token, etc.
        console.error('Audit rejected event:', err.details)
    }
    throw err
}