alepha@docs:~/docs/reference/primitives$
cat $audit.md | pretty
1 min read

#$audit

#Import

typescript
1import { $audit } from "alepha/api/audits";

#Overview

Create an audit type primitive.

#Options

Option Type Required Description
type string Yes Unique audit type identifier (e.g., "auth", "payment", "order").
description string No Human-readable description of this audit type.
actions string[] Yes List of allowed actions for this audit type.
retentionDays number No Number of days entries of this audit type are retained before the periodic cleanup job deletes them
coalesce AuditCoalesceOptions No Merge a burst of identical events into one row carrying a count, instead of writing one row per event

#Examples

ts
1class OrderAudits {2  audit = $audit({3    type: "order",4    description: "Order management events",5    actions: ["create", "update", "cancel", "fulfill", "ship"],6  });7}