Skip to content

@xtandard/audit/core

The audit core — the operations layer the API, CLI, recorder, stream runner and UI sit on.

Owns the split between the record plane (record() / recordMany() — the hot path: validate, transform, chain, append; synchronous-commit, throws on failure, ADR 0002) and the control plane (query, export, verify, checkpoints, erasure, retention, the action catalog — hook-guarded and self-audited).

import { … } from "@xtandard/audit/core";
Name Summary
createAuditCore Create the audit core.
eraseSections Erase sections of an event, keeping its digests (ADR 0011).
Name Summary
ConflictError Thrown when an operation conflicts with existing state. Maps to HTTP 409.
NotFoundError Thrown when a referenced entity does not exist. Maps to HTTP 404.
ReadonlyError Thrown by mutating operations when the core is in readonly mode.
SignerRequiredError Thrown when an operation needs a signer and none is configured. Maps to HTTP 409.
Name Summary
ActorOptions Per-call actor attribution for control-plane operations.
AuditCore The audit core surface.
AuditCoreOptions Options for createAuditCore.
CheckpointOptions Automatic checkpointing (requires a signer).
EraseInput Input to AuditCore.erase.
PruneResult Result of one tenant’s prune.
RetentionOptions Retention policy for AuditCoreOptions.retention.
RetentionRule One retention rule. When both fields are set an event is kept if either rule keeps it (union of keeps, the sibling packages’ semantics): pruned only when it is outside the keepLast most recent AND older than maxAge. Retention always removes a prefix of a tenant’s chain (by seq), anchored by a base checkpoint, so what remains still verifies (ADR 0004).
Name Summary
RecordInput A record input, typed by the action map when one is given (ADR 0012).
Name Summary
SELF_AUDIT_ACTIONS Self-audit action names (always accepted, even with strictActions).