UNPKG

claude-usage-tracker

Version:

Advanced analytics for Claude Code usage with cost optimization, conversation length analysis, and rate limit tracking

68 lines 1.79 kB
import type { UsageEntry } from "./types.js"; export interface QueryResult { data: any[]; metadata: { totalRows: number; executionTime: number; fields: string[]; }; explanation?: QueryExplanation; } export interface QueryExplanation { query: ParsedQuery; plan: { step: string; description: string; estimatedCost: number; rowsProcessed: number; }[]; totalExecutionSteps: number; optimizationHints: string[]; } export interface SelectField { field: string; alias?: string; aggregation?: "count" | "sum" | "avg" | "min" | "max"; } export interface WhereCondition { field: string; operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "like" | "in"; value: any; logical?: "and" | "or"; } export interface OrderBy { field: string; direction: "asc" | "desc"; } export interface ParsedQuery { select: SelectField[]; from: "conversations" | "entries"; where?: WhereCondition[]; groupBy?: string[]; having?: WhereCondition[]; orderBy?: OrderBy[]; limit?: number; } export declare class QueryEngine { private entries; constructor(entries: UsageEntry[]); execute(queryString: string, explain?: boolean): Promise<QueryResult>; private parseQuery; private parseSelectFields; private parseWhereConditions; private parseOrderBy; private parseValue; private executeQuery; private prepareData; private calculateDuration; private applyWhere; private getFieldValue; private evaluateCondition; private applySelect; private applyGroupBy; private calculateAggregation; private applyOrderBy; private explainQuery; private estimateSelectivity; } //# sourceMappingURL=query-engine.d.ts.map