UNPKG

@ooples/token-optimizer-mcp

Version:

Intelligent context window optimization for Claude Code - store content externally via caching and compression, freeing up your context window for what matters

60 lines 1.62 kB
/** * Persistent storage for analytics data using SQLite */ import type { AnalyticsEntry, AnalyticsStorage } from './analytics-types.js'; /** * SQLite-backed analytics storage */ export declare class SqliteAnalyticsStorage implements AnalyticsStorage { private db; private batchQueue; private batchTimer; private readonly BATCH_SIZE; private readonly BATCH_DELAY_MS; constructor(dbPath?: string); /** * Initialize database schema */ private initializeDatabase; /** * Save a single analytics entry (batched for performance) */ save(entry: AnalyticsEntry): Promise<void>; /** * Save multiple analytics entries in a single transaction */ saveBatch(entries: AnalyticsEntry[]): Promise<void>; /** * Schedule a delayed batch flush */ private scheduleBatchFlush; /** * Flush the current batch to database */ private flushBatch; /** * Query analytics entries with optional filters */ query(filters?: Partial<AnalyticsEntry>): Promise<AnalyticsEntry[]>; /** * Get all entries within a date range */ queryByDateRange(startDate: string, endDate: string): Promise<AnalyticsEntry[]>; /** * Clear all analytics data */ clear(): Promise<void>; /** * Get total count of stored entries */ count(): Promise<number>; /** * Convert database rows to AnalyticsEntry objects */ private rowsToEntries; /** * Close the database connection */ close(): Promise<void>; } //# sourceMappingURL=analytics-storage.d.ts.map