File size: 1,086 Bytes
9e4583c | 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 | /**
* 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,
getUsageDb,
saveRequestUsage,
getUsageHistory,
appendRequestLog,
getRecentLogs,
} from "./usage/usageHistory";
export { calculateCost } from "./usage/costCalculator";
export { getUsageStats } from "./usage/usageStats";
export { saveCallLog, rotateCallLogs, getCallLogs, getCallLogById } from "./usage/callLogs";
|