AuditSink
Αυτό το περιεχόμενο δεν είναι ακόμη διαθέσιμο στη γλώσσα σου.
Defined in: pipeline-audit/src/interfaces/audit-sink.interface.ts:18
Backend-agnostic sink for audit records — the single seam every storage backend implements.
Implement this once per backend; the bundled implementations are LogAuditSink (default, zero-dependency) and PostgresAuditSink. Because AuditBehavior depends only on this interface, swapping the backend (Postgres, an event store, Kafka, an HTTP collector, …) is a one-line change: the sink passed to its constructor.
Methods
Section titled “Methods”begin()?
Section titled “begin()?”
optionalbegin(record):void|Promise<void>
Defined in: pipeline-audit/src/interfaces/audit-sink.interface.ts:42
Persist the start of an operation, before its handler runs. Optional:
when implemented, AuditBehavior calls it first (unless
recordStart: false), then calls write with the final record
under the same id, which must replace this one. An attempt interrupted
by a process stop then stays visible as 'pending' instead of being lost.
A throw here is logged by the behavior; with failOpen: false it also
stops the request before its handler runs.
Parameters
Section titled “Parameters”record
Section titled “record”The pending entry for the operation about to run.
Returns
Section titled “Returns”void | Promise<void>
write()
Section titled “write()”write(
record):void|Promise<void>
Defined in: pipeline-audit/src/interfaces/audit-sink.interface.ts:28
Persist / publish a single audit record.
Implementations should be resilient. A throw here is logged by the
behavior; with failOpen: false it also fails a successful request. A
handler error is always rethrown unchanged.
Parameters
Section titled “Parameters”record
Section titled “record”The completed audit entry to forward.
Returns
Section titled “Returns”void | Promise<void>