Files
OmniRoute/src/lib/usageDb.ts
diegosouzapw 47468636e4 feat(dashboard): expand observability and provider tooling
Unify audit access under the logs experience and add richer active
request visibility with sanitized client and provider payload previews.

Expose provider warnings from upstream responses in compliance audit
logs, surface learned rate-limit header data in health monitoring, and
add MCP cache stats and cache flush tools with test coverage.

Also add local provider catalog support for SD WebUI and ComfyUI,
include video generation in endpoint docs and UI, add eval run storage
migrations, and refresh docs and translations to match the expanded
feature set.
2026-04-23 16:57:43 -03:00

37 lines
1.1 KiB
TypeScript

/**
* usageDb.js — Facade (T-15 decomposition)
*
* This file is now a thin re-export layer. All logic has been
* extracted into focused modules under `./usage/`:
*
* migrations.js — Legacy file + JSON→SQLite migration
* usageHistory.js — Usage tracking, request log, pending requests
* costCalculator.js — Cost calculation (pure function)
* usageStats.js — Aggregated stats for dashboard
* callLogs.js — Structured call log management
*
* Existing imports like `import { getUsageStats } from "@/lib/usageDb"`
* continue to work unchanged.
*/
// Trigger migrations on module load (side-effect)
import "./usage/migrations";
// Re-export everything for backward compatibility
export {
trackPendingRequest,
updatePendingRequest,
getUsageDb,
saveRequestUsage,
getUsageHistory,
getModelLatencyStats,
appendRequestLog,
getRecentLogs,
} from "./usage/usageHistory";
export { calculateCost } from "./usage/costCalculator";
export { getUsageStats } from "./usage/usageStats";
export { saveCallLog, rotateCallLogs, getCallLogs, getCallLogById } from "./usage/callLogs";