Data Definition Document: Unified Audit
Domain: Unified (audit, communications, identity, library, notifications, search, signals, vault, workflow)
Logical Sub-Domain: Audit (Forensics)
Physical Packages: @sd/mod-unified-audit
Related Documents: Process Blueprint
Context: This document defines the Data Structures for the immutable Audit Log.
Source: packages/modules/unified/audit/src/schema.ts
0. Entity Relationship Diagram (ERD)
erDiagram
AUDIT_LOG {
string id PK
string actorId FK
string resourceId FK
string resource "Collection Name"
enum mutation "create, update, delete"
json diff "prev vs next"
}
USER ||--o{ AUDIT_LOG : "triggers"
ANY_ENTITY ||--o{ AUDIT_LOG : "has_history"
1. Primary Entities
Entity: AuditLog
An immutable record of a data change.
| Field | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | Unique ID. |
actorId |
string |
Yes | User ID who performed the action. |
mutationType |
string |
Yes | Enum: create, update, delete. |
resource |
string |
Yes | The collection name (e.g. work_orders). |
resourceId |
string |
Yes | ID of the modified document. |
diff |
object |
No | { prev: any, next: any }. |
metadata |
json |
No | Contextual info (IP address, User Agent). |
createdAt |
Timestamp |
Yes | Server time. |
4. Changelog
| Date | Author | Description | Reference |
|---|---|---|---|
| 2026-01-24 | Antigravity | Initial creation | Implementation Plan |