forked from bai/curriculum-project-hub
26523d1b54
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
66 lines
1.8 KiB
TypeScript
66 lines
1.8 KiB
TypeScript
/**
|
|
* 审计日志模块(横切能力)对外唯一入口。
|
|
*
|
|
* 依赖方向单向:业务 → 审计。本模块不 import 任何 filelib 业务类型,
|
|
* 业务侧也只 import 这个 barrel,不深入子文件 —— 换实现(比如日后拆成
|
|
* 独立审计服务)只需重写本目录,业务代码不动。
|
|
*
|
|
* 结构:
|
|
* | auditModel.ts | 动作词表、记录形状、哈希链、保留期常量(纯逻辑) |
|
|
* | auditWriter.ts | 落库:事务内(成功)与事务外(失败/冲突)两条路径 |
|
|
* | auditQuery.ts | 组合查询 + 三级可见性 + CSV 导出 |
|
|
* | auditRetention.ts | ≥180 天保留归档 + 哈希链校验 |
|
|
* | requestContext.ts | 客户端 IP / User-Agent 采集 |
|
|
* | auditRoutes.ts | /database/api/audit/* HTTP 面 |
|
|
*/
|
|
|
|
export {
|
|
AUDIT_ACTIONS,
|
|
ALL_AUDIT_ACTIONS,
|
|
AUDIT_ACTION_GROUPS,
|
|
AUDIT_RETENTION_DAYS_MIN,
|
|
actorName,
|
|
canonicalize,
|
|
computeEntryHash,
|
|
resolveRetentionDays,
|
|
type AuditAction,
|
|
type AuditActor,
|
|
type AuditClient,
|
|
type AuditObjectType,
|
|
type AuditRecordInput,
|
|
type AuditResult,
|
|
} from "./auditModel.js";
|
|
|
|
export {
|
|
writeAudit,
|
|
writeAuditMany,
|
|
writeAuditOutOfBand,
|
|
type AuditWriteDeps,
|
|
type OutOfBandDeps,
|
|
} from "./auditWriter.js";
|
|
|
|
export {
|
|
AUDIT_EXPORT_ROWS_MAX,
|
|
AUDIT_PAGE_SIZE_MAX,
|
|
collectAuditLogsForExport,
|
|
queryAuditLogs,
|
|
toCsv,
|
|
type AuditEntryDto,
|
|
type AuditPage,
|
|
type AuditQueryActor,
|
|
type AuditQueryDeps,
|
|
type AuditQueryFilter,
|
|
} from "./auditQuery.js";
|
|
|
|
export {
|
|
archiveExpiredAuditLogs,
|
|
verifyAuditChain,
|
|
type ArchiveResult,
|
|
type ChainBreak,
|
|
type VerifyResult,
|
|
} from "./auditRetention.js";
|
|
|
|
export { requestClient, type RequestLike } from "./requestContext.js";
|
|
|
|
export { registerAuditRoutes, type AuditRouteDeps } from "./auditRoutes.js";
|