import { e as GraphDef, Q as QueryAst } from '../types-BynPp5kU.cjs'; export { C as ContributionDiagnostic, a as ContributionDiagnosticState, b as ContributionRepairEntry, c as ContributionRepairResult } from '../types-BynPp5kU.cjs'; import { b as Store } from '../store-3nfPQK5j.cjs'; export { B as BatchReadBuilder, C as CompiledOneStatementRead } from '../store-3nfPQK5j.cjs'; import { P as ProfilerOptions, a as ProfileReport } from '../types-JG-4CG6P.cjs'; export { D as DeclaredIndex, I as IndexRecommendation, b as ProfileSummary, c as PropertyAccessStats, d as PropertyPath, R as RecommendationPriority, U as UsageContext } from '../types-JG-4CG6P.cjs'; import 'zod'; import '../searchable-C7Xt6g45.cjs'; import '../resolve-CoYqHqno.cjs'; /** * A Store with profiling capabilities. * * Behaves exactly like a regular Store but tracks all query executions. * Access the profiler via the `profiler` property. */ type ProfiledStore = Store & { /** The profiler instance attached to this store */ readonly profiler: QueryProfiler; }; /** * QueryProfiler captures and analyzes query patterns. * * Attach to a store to automatically track all query executions, * then generate reports with index recommendations. * * @example * ```typescript * import { QueryProfiler } from "@nicia-ai/typegraph/profiler"; * * const profiler = new QueryProfiler({ * declaredIndexes: [ * { nodeKind: "Person", fields: ["email"], unique: true, name: "idx_email" }, * ], * }); * * const profiledStore = profiler.attachToStore(store); * * // Run queries... * await profiledStore.query() * .from("Person", "p") * .whereNode("p", (p) => p.email.eq("alice@example.com")) * .select((ctx) => ctx.p) * .execute(); * * // Get report * const report = profiler.getReport(); * console.log(report.recommendations); * ``` */ declare class QueryProfiler { #private; constructor(options?: ProfilerOptions); /** * Records a query execution from its AST. * * This is called automatically when attached to a store. * Can also be called manually for custom integrations. * * @param ast - The query AST to analyze */ recordQuery(ast: QueryAst): void; /** * Attaches the profiler to a store. * * Returns a wrapped store that tracks all query executions. * The wrapped store behaves identically to the original. * * @param store - The store to attach to * @returns A profiled store with the `profiler` property * @throws Error if the profiler is already attached to another store */ attachToStore(store: Store): ProfiledStore; /** * Generates a complete profile report. * * The report includes: * - All property access patterns with frequency and context * - Index recommendations sorted by priority * - List of unindexed filter properties * - Summary statistics * * @returns The profile report */ getReport(): ProfileReport; /** * Checks if all filtered properties are covered by indexes. * * Throws an error if any filtered properties lack indexes. * Useful for test assertions to ensure query performance. * * @throws Error if unindexed filter properties are found * * @example * ```typescript * // In your test file * it("all filtered properties should be indexed", () => { * profiler.assertIndexCoverage(); * }); * ``` */ assertIndexCoverage(): void; /** * Resets all collected data. * * Clears patterns and query count. Useful for starting a fresh * profiling session without creating a new profiler instance. */ reset(): void; /** * Marks the profiler as detached. * * Call this when you're done profiling to allow reattachment * to the same or a different store. */ detach(): void; /** * Whether the profiler is currently attached to a store. */ get isAttached(): boolean; } export { ProfileReport, type ProfiledStore, ProfilerOptions, QueryProfiler };