Skip to main content
Version: latest (master)

Function: decodeAuditEvent()

decodeAuditEvent(payload): AuditEvent

Defined in: src/audit/encode.ts:174

Deserialize a JSON wire payload into a typed AuditEvent.

Accepts either the raw JSON string (the gateway's standard transport) or an already-parsed object (handy for tests and for callers that received a JSON object via another path). Symmetric inverse of encodeAuditEvent: snake_case keys map back to camelCase fields, and missing / empty optionals decode to undefined so an AuditEvent produced from a legacy payload (no call_stack, empty trace_id, …) matches what AAASM-1436's existing consumer-side tests expect.

Parameters

payload

string | Record<string, unknown>

Returns

AuditEvent