fix(core-testing): RecordingAuditLog uses inline type alias (boundary: tooling cannot depend on core)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { RecordingAuditLog } from "./recording-audit-log";
|
||||
import type { AuditEntry } from "@repo/core-shared/audit";
|
||||
|
||||
const sample: AuditEntry = {
|
||||
// Inline type to avoid importing from @repo/core-shared (boundary: tooling cannot depend on core)
|
||||
type SampleEntry = Parameters<RecordingAuditLog["record"]>[0];
|
||||
|
||||
const sample: SampleEntry = {
|
||||
actorId: "user_1",
|
||||
actorType: "user",
|
||||
actorRoles: [],
|
||||
|
||||
@@ -1,4 +1,34 @@
|
||||
import type { AuditEntry } from "@repo/core-shared/audit";
|
||||
// Local type alias mirroring `AuditEntry` from `@repo/core-shared/audit`.
|
||||
// Kept inline to avoid a build-graph cycle between core-testing (tooling)
|
||||
// and core-shared (core). Same pattern used by recording-event-bus,
|
||||
// recording-realtime-broadcaster, and recording-metrics.
|
||||
|
||||
type AuditAction =
|
||||
| "VIEW"
|
||||
| "CREATE"
|
||||
| "UPDATE"
|
||||
| "DELETE"
|
||||
| "EXPORT"
|
||||
| "PERMISSION_CHANGE";
|
||||
|
||||
type AuditEntry = {
|
||||
actorId: string;
|
||||
actorType: "user" | "system" | "service";
|
||||
actorRoles: string[];
|
||||
action: AuditAction;
|
||||
resource: { type: string; id?: string };
|
||||
changedFields?: string[];
|
||||
at: Date;
|
||||
scope: { feature: string; environment: string; tenant: string };
|
||||
reason?: string;
|
||||
correlationId?: string;
|
||||
requestId?: string;
|
||||
from: { ipTruncated: string; userAgent: string };
|
||||
containsPii: boolean;
|
||||
piiCategories?: string[];
|
||||
outcome: "success" | "denied" | "error";
|
||||
errorCode?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Test-side recording double for IAuditLog. Mirrors Payload semantics in
|
||||
|
||||
Reference in New Issue
Block a user