Skip to content

@xtandard/audit/schema

Core type definitions for @xtandard/audit.

This module is types only — no runtime code beyond tiny guards and constants, no dependencies. It is safe to import from the record hot path and the zero-dependency verifier. Runtime validation (which pulls in valibot) lives in validation.

import { … } from "@xtandard/audit/schema";
Name Summary
ActionDefinition Action catalog entry (documentation + UI; schemas live in code, ADR 0012).
AuditActor Who performed the action. id is required; everything else is presentational.
AuditCheckpoint A signed chain head (ADR 0004).
AuditContext Where the action came from. Well-known keys are typed; any other JSON key is allowed (e.g. sessionId, apiVersion).
AuditEvent A stored, chained audit event.
AuditEventInput What callers pass to record(). Everything the log derives itself (seq, recordedAt, integrity) is omitted; id and occurredAt are optional.
AuditIntegrity The tamper-evidence block carried by every stored event (ADR 0004).
AuditPage One page of results — the @xtandard/lib Paginated<T> envelope shape, so a host can feed it to createPaginator({ fetchCursor }) unchanged (ADR 0007).
AuditQuery The query model (ADR 0007). All filters are AND-ed; list-valued filters are OR-ed within themselves.
AuditTarget A resource the action was performed on.
AuditTenant Tenant summary for listings.
ChainHead The current head of one tenant’s chain.
Name Summary
AuditDuration A duration for configuration options: either milliseconds as a number, or a human-friendly string such as "5s", "30m", "2h", "90d". Parsed by ./duration.durationToMs.
AuditOutcome Outcome of the audited action.
AuditSection The privacy-bearing sections of an event. Each is hashed separately (salted with the event id) so it can be erased without breaking the chain (ADR 0004, ADR 0011).
JsonObject A JSON object (the shape of metadata, context, and actor/target metadata). undefined members are allowed for ergonomics and dropped on serialization, exactly like JSON.stringify.
JsonValue JSON-serializable value, used for metadata, context, and catalog schemas.
Name Summary
AUDIT_SECTIONS All sections, in canonical order.
ERASED_MARKER Marker that replaces the content of an erased section.
SCHEMA_VERSION Current schema version for stored records.