import { type QueryRelation } from "./query-schema.js"; /** Canonical rows are deliberately source-neutral; public ids are semantic values. */ export type QueryRow = Readonly>; export type QueryRowSets = Readonly>; /** A directional join from the owning row to a target relation row. */ export interface QueryEdgeLookup { /** Whether the snapshot contains every target needed to traverse this edge. Defaults to true. */ readonly complete?: boolean; /** Public row paths, retained for legacy datasets. */ readonly from?: readonly string[]; readonly to?: readonly string[]; /** * Snapshot-local join values aligned by source/target row position. They are * deliberately stored beside the rows rather than attached to them so query * results expose only schema fields. */ readonly privateKeys?: Readonly<{ readonly source: readonly (readonly unknown[])[]; readonly target: readonly (readonly unknown[])[]; }>; } export type QueryEdgeLookups = Readonly>>>>; /** * A deterministic, in-memory canonical data source. `uniqueKeys` documents * public row uniqueness only; the evaluator never gives those fields special semantics. */ export interface QueryDataset { readonly rows: QueryRowSets; readonly edges: QueryEdgeLookups; readonly uniqueKeys: Readonly>; } /** An edge is declared by the schema but its targets were unavailable in this snapshot. */ export declare class IncompleteQueryEdgeError extends Error { readonly relation: QueryRelation; readonly edge: string; constructor(relation: QueryRelation, edge: string); } /** Validates and freezes source-neutral rows, then builds deterministic edge indexes once. */ export declare function createQueryDataset(input: QueryDataset): QueryDataset; /** Uses the factory index, compiling a legacy dataset on first use for compatibility. */ export declare function relatedQueryRows(dataset: QueryDataset, relation: QueryRelation, row: QueryRow, edge: string): readonly QueryRow[]; /** A Date which preserves Date's public read API but rejects mutation. */ export declare class ImmutableQueryDate extends Date { /** Legacy Date API, absent from newer TypeScript lib declarations. */ setYear(): never; setTime(): never; setMilliseconds(): never; setSeconds(): never; setMinutes(): never; setHours(): never; setDate(): never; setMonth(): never; setFullYear(): never; setUTCMilliseconds(): never; setUTCSeconds(): never; setUTCMinutes(): never; setUTCHours(): never; setUTCDate(): never; setUTCMonth(): never; setUTCFullYear(): never; } /** Recursively clones and freezes query values without retaining mutable input references. */ export declare function immutableQueryValue(value: T): T;