✨ types(audit): excludeFields und AuditEntry (#67)

collection.audit.excludeFields (dot notation) hält Werte aus dem Audit-Verlauf
heraus; AuditLog.redactedFields nennt die betroffenen Pfade. AuditEntry ist
jetzt als Typ deklariert, damit Clients das Feld sehen.

Refs cms/tibi-server#67
This commit is contained in:
apairon committed 2026-11-04 13:33:58 +00:00
1 parent 779dd574fc
commit cbec4753a1
2 files changed
+35

No files matched your search

Vendored
+27
View File
@@ -272,6 +272,33 @@ declare global {
| "bulkUpdate"
| "bulkDelete"
>
/**
* Document paths (dot notation, e.g. `security.twoFactor.secret`) whose
* values are never written to the audit history. The values are dropped,
* not replaced: the paths are recorded in `AuditEntry.redactedFields`
* instead, so a client-side audit restore cannot write a placeholder into
* the document. Snapshot backups (`snapshotPath`) are not affected.
*/
excludeFields?: string[]
}
/** One audit history entry as returned by `GET /api/v1/audit`. */
export interface AuditEntry {
id?: string
projectNamespace?: string
projectName?: string
collection: string
action: string
documentId?: string
snapshot?: Record<string, unknown>
changes?: Record<string, unknown>
filter?: Record<string, unknown>
/**
* Paths removed from `snapshot`/`changes` because the collection lists
* them in `audit.excludeFields`. Metadata only — the values are gone.
*/
redactedFields?: string[]
[key: string]: any
}
export interface UploadConfig {
+8
View File
@@ -124,6 +124,14 @@
"bulkDelete"
]
}
},
"excludeFields": {
"description": "Document paths (dot notation) whose values are never stored in the audit history. The paths are recorded in AuditLog.redactedFields; snapshot backups are not affected.",
"type": "array",
"items": {
"type": "string",
"minLength": 1
}
}
}
},