feat(core-audit): IAuditLog interface + AUDIT_SYMBOLS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 16:11:30 +02:00
parent 0c5ad08dcd
commit 12a8391944
2 changed files with 25 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import type { AuditLogProtocol } from "@repo/core-shared/di/bind-protocols";
import type { AuditEntry } from "@repo/core-shared/audit";
/**
* Full audit log interface. Extends the minimal `AuditLogProtocol` from
* core-shared with the privileged `eraseSubject` op for GDPR erasure.
*
* Feature binders that receive `ctx.auditLog` see only `AuditLogProtocol`
* (record). Admin-path code that needs erasure imports this full interface.
*
* The `extends` link forces typecheck failure if either side narrows below
* the protocol surface — same safety net as IEventBus, IRealtimeBroadcaster,
* IRealtimeHandlerRegistry, IMetrics.
*/
export interface IAuditLog extends AuditLogProtocol {
// record(entry: AuditEntry): Promise<void> — inherited from protocol
eraseSubject(actorId: string, mode: "pseudonymize" | "delete"): Promise<void>;
}
// Re-export AuditEntry for convenience (so consumers don't always need
// to dual-import from @repo/core-shared/audit).
export type { AuditEntry };

View File

@@ -0,0 +1,3 @@
export const AUDIT_SYMBOLS = {
IAuditLog: Symbol.for("core-audit:IAuditLog"),
} as const;