@xtandard/audit/drizzle-audit
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. Typed structurally —
no dependency on drizzle-audit.
import { … } from "@xtandard/audit/drizzle-audit";Functions
Section titled “Functions”| Name | Summary |
|---|---|
createDrizzleAuditStorage |
Create a drizzle-audit AuditStorage that records into an audit core. |
defaultDrizzleAuditAction |
The default action of an entry. |
drizzleAuditEntryToInput |
Map one entry to a record input (exported for custom pipelines and tests). Returns null when include rejects the entry. |
drizzleAuditEventId |
A deterministic, time-sortable event id for an entry: the entry timestamp (48 bits, like every evt_ id) followed by 80 bits of SHA-256 over the entry’s content (not entry.id, which stored rows do not keep) — so the same change always maps to the same event, live or imported. |
importDrizzleAuditEntries |
Import historical drizzle-audit rows (migration, ADR 0009 §4). Rows are sorted by timestamp (then id) and chained in that order with occurredAt = the entry timestamp. Re-running an import is a no-op for rows already imported (deterministic event ids). Resolves to the recorded events. |
Interfaces
Section titled “Interfaces”| Name | Summary |
|---|---|
DrizzleAuditEntry |
drizzle-audit’s AuditEntry, structurally. timestamp also accepts a string/number so rows read back from any driver can be imported. |
DrizzleAuditMapping |
How a drizzle-audit entry maps to an audit event. |
DrizzleAuditStorageLike |
drizzle-audit’s AuditStorage, structurally. |
DrizzleAuditStorageOptions |
Options for createDrizzleAuditStorage. |
ImportDrizzleAuditOptions |
Options for importDrizzleAuditEntries. |