Skip to content

API reference

Generated from the source by TypeDoc, so it always matches the published types. Each entry point is a separate import; its optional peer dependencies are listed in its description.

Import Exports Description
@xtandard/audit 115 The self-hosted, embeddable, tamper-evident audit-log control plane for B2B SaaS, in one import.
@xtandard/audit/core 16 The audit core — the operations layer the API, CLI, recorder, stream runner and UI sit on.
@xtandard/audit/schema 20 Core type definitions for @xtandard/audit.
@xtandard/audit/verify 18 The zero-dependency verifier for auditors and customers: re-derive every hash of an exported log, check its links, and verify the signed checkpoints, with nothing but Web Crypto (ADR 0004).
@xtandard/audit/context 6 Ambient request context (ADR 0013): open a scope per request with the actor, tenant, IP, user agent and request id, and every record() inside it picks them up — no threading through call sites.
@xtandard/audit/testing 8 Testing utilities: an in-memory core, a collecting sink and assertions, so a host app (or this package’s own suite) can test its audit wiring without a database, timers or the network.
@xtandard/audit/storage/memory 3 In-memory storage: createMemoryStorage(), for tests, development and the demo.
@xtandard/audit/storage/file 3 File-system storage: createFileStorage() persists each key as a JSON file under a base directory.
@xtandard/audit/storage/redis 4 Redis storage: createRedisStorage() (JSON strings) and createRedisJSONStorage() (RedisJSON documents) over node-redis, with a Lua compare-and-swap (safe multi-writer appends) and keyspace-notification watch.
@xtandard/audit/storage/postgres 3 Postgres storage: createPostgresStorage() keeps a jsonb key/value table plus the native event-log tables (indexed queries, atomic appends), all created on first use.
@xtandard/audit/storage/drizzle 4 Drizzle storage: createDrizzleStorage() reads and writes tables you own (built with the drizzle/* factories) through the Drizzle database you pass — the KV table, plus the events tables for the native event log.
@xtandard/audit/storage/mongodb 5 MongoDB storage: createMongoStorage() over the mongodb driver — a KV collection of { _id: key, value } documents for control data plus a native, indexed events collection (the EventLogStorage capability).
@xtandard/audit/storage/sqlite 3 SQLite storage on bun:sqlite: createSqliteStorage(), for single-node deployments and local persistence, with the native event log.
@xtandard/audit/storage/libsql 5 libSQL / Turso storage: createLibsqlStorage() over @libsql/client, for remote, replicated or embedded SQLite-dialect databases, with the native event log.
@xtandard/audit/drizzle/pg 6 Postgres Drizzle table factories for the audit store: pgAuditTables() (or the per-table factories) puts the KV and event-log tables in your Drizzle schema and migrations.
@xtandard/audit/drizzle/mysql 8 MySQL Drizzle table factories for the audit store: mysqlAuditTables() (or the per-table factories) puts the KV and event-log tables in your Drizzle schema and migrations.
@xtandard/audit/drizzle/sqlite 5 SQLite Drizzle table factories for the audit store: sqliteAuditTables() (or the per-table factories) puts the KV and event-log tables in your Drizzle schema and migrations.
@xtandard/audit/hooks/log 2 A reference hook: createLogHook() logs mutation events.
@xtandard/audit/sinks/http 3 Generic HTTP sink: httpSink() POSTs each stream batch as JSON or NDJSON; non-2xx throws so the stream runner backs off.
@xtandard/audit/sinks/webhook 5 Standard Webhooks sink: webhookSink() POSTs signed batches (or items), verifiable by @xtandard/webhooks/receiver, Svix and the official standardwebhooks libraries.
@xtandard/audit/sinks/xtandard-webhooks 3 The @xtandard/webhooks bridge: xtandardWebhooksSink() publishes streamed events and checkpoints into a webhooks core, so tenants self-serve their own SIEM endpoints.
@xtandard/audit/sinks/datadog 9 Datadog sink: datadogSink() ships events to the Logs intake API v2, chunked to the intake limits.
@xtandard/audit/sinks/splunk 3 Splunk sink: splunkSink() ships events to the HTTP Event Collector.
@xtandard/audit/sinks/s3 4 S3-compatible archive sink: s3Sink() writes one JSONL object per batch at an idempotent key (AWS S3, R2, MinIO, …).
@xtandard/audit/sinks/console 3 Console sink: consoleSink() prints streamed items as readable lines or JSON lines.
@xtandard/audit/sinks/file 6 File sink and recorder fallback: fileSink() appends streamed items as JSON Lines; fileFallback() parks batches the buffered recorder could not persist.
@xtandard/audit/drizzle-audit 10 The drizzle-audit bridge: createDrizzleAuditStorage() turns drizzle-audit’s row-level change entries into tenant-scoped, hash-chained audit events, and importDrizzleAuditEntries() migrates historical rows.
@xtandard/audit/auth/basic 2 HTTP Basic authentication for the panel: basicAuth() checks the Authorization: Basic header against a configured user list (scrypt password hashes via hashPassword, a custom verifier, or plaintext for development only).
@xtandard/audit/authorization/none 1 No authorization: noAuthorization() allows every action.
@xtandard/audit/authorization/roles 6 Role-based authorization: rolesAuthorization() maps role names to the actions they grant (built-in admin/auditor/viewer policy by default), with a readonly switch that denies every mutating action.
@xtandard/audit/authorization/delegated 2 Delegated authorization: delegatedAuthorization() wraps your own authorize function, for ABAC, a policy engine (OPA, Cedar) or per-tenant ownership checks.
@xtandard/audit/bun 7 Bun adapter: auditPanel() returns the web-standard panel handler to hand to Bun.serve({ fetch }), with the core and the stream runner attached; withAuditContext() wraps a fetch handler so every request runs in an audit context scope (actor, tenant, IP, user agent, request id).
@xtandard/audit/elysia 6 Elysia 1.x adapter: auditPanel() to mount the panel as a plain handler, auditElysia(), a typed plugin whose API routes Eden treaty can see, and auditContext(), the request-context plugin.
@xtandard/audit/elysia2 3 Elysia 2 adapter: the same surface as @xtandard/audit/elysia (auditPanel(), the typed auditElysia() plugin, auditContext()), built against Elysia 2 and @elysia/eden.
@xtandard/audit/express 3 Express adapter: auditPanel() bridges Node’s req/res to the web-standard panel handler (mount it before any body parser), and auditContext() opens a request-context scope around next().
@xtandard/audit/hono 2 Hono adapter: auditPanel() returns a Hono sub-app serving the panel, to compose with app.route(path, panel), and auditContext(), the request-context middleware.
@xtandard/audit/react 9 The admin dashboard and the customer portal as React components, to embed in your own app (advanced mode).