1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Audit logging system for EnvelopeCLI
//!
//! Records all create, update, delete operations with before/after values
//! in an append-only audit log.
//!
//! # Architecture
//!
//! The audit system consists of three components:
//!
//! - `AuditEntry`: Represents a single audit log entry with timestamp, operation,
//! entity information, and optional before/after values.
//! - `AuditLogger`: Handles writing entries to the audit log file using a
//! line-delimited JSON format (JSONL).
//! - `generate_diff`: Utility function to create human-readable diffs between
//! entity states.
//!
//! # Example
//!
//! ```rust,ignore
//! use envelope::audit::{AuditEntry, AuditLogger, EntityType, generate_diff};
//! use serde_json::json;
//!
//! let logger = AuditLogger::new(audit_log_path);
//!
//! // Log a create operation
//! let entry = AuditEntry::create(
//! EntityType::Account,
//! "acc-12345678",
//! Some("Checking".to_string()),
//! &account,
//! );
//! logger.log(&entry)?;
//!
//! // Log an update with diff
//! let diff = generate_diff(&before_json, &after_json);
//! let entry = AuditEntry::update(
//! EntityType::Account,
//! "acc-12345678",
//! Some("Checking".to_string()),
//! &before,
//! &after,
//! diff,
//! );
//! logger.log(&entry)?;
//! ```
pub use ;
pub use ;
pub use AuditLogger;