export type Scalar = null | boolean | number | string; export type FilterSpec = string | { and?: FilterSpec[]; or?: FilterSpec[]; not?: FilterSpec; }; export type SortDirection = "asc" | "desc"; export interface SortSpec { by: string; direction: SortDirection; } export interface GroupBySpec { property: string; direction: SortDirection; } export interface PropertyConfig { displayName?: string; [key: string]: unknown; } export interface ViewSpec { type: string; name: string; filters?: FilterSpec; sort?: SortSpec[]; order?: string[]; groupBy?: string | GroupBySpec; limit?: number; summaries?: Record; properties?: string[]; } export interface QuerySpec { filters?: FilterSpec; formulas?: Record; properties?: string[]; propertyConfigs?: Record; summaries?: Record; views: ViewSpec[]; warnings?: string[]; } export interface QueryDiagnostics { warnings: string[]; errors: string[]; } export interface QueryStats { scannedFiles: number; markdownFiles: number; matchedRows: number; returnedRows: number; elapsedMs: number; } export interface QueryGroup { key: unknown; rows: Record[]; } export interface QueryResult { rows: QueryRow[]; columns: string[]; columnLabels?: Record; groups?: QueryGroup[]; summaries?: Record; stats: QueryStats; diagnostics: QueryDiagnostics; } export interface QueryRow { note: Record; file: FileRecord; formula: Record; this: Record; projected: Record; evalContext?: unknown; } export interface FileRecord { name: string; basename: string; path: string; folder: string; ext: string; size: number; ctime: Date; mtime: Date; properties: Record; tags: string[]; links: string[]; embeds: string[]; backlinks: string[]; } export interface NoteRecord { frontmatter: Record; } export interface IndexedDocument { note: NoteRecord; file: FileRecord; } export type OutputFormat = "json" | "jsonl" | "yaml" | "csv" | "md"; export interface QueryBaseOptions { spec?: QuerySpec; basePath?: string; yaml?: string; view?: string; dir?: string; strict?: boolean; include?: string[]; exclude?: string[]; debug?: boolean; adapter?: RuntimeAdapter; } export interface RuntimeFileStat { isFile: boolean; size: number; ctime: Date; mtime: Date; } export interface RuntimeFileEntry { path: string; stat: RuntimeFileStat; } export interface RuntimeAdapter { cwd(): string; resolve(...parts: string[]): string; relative(from: string, to: string): string; basename(path: string): string; extname(path: string): string; readTextFile(path: string): Promise; writeTextFile(path: string, content: string): Promise; listFilesRecursive(path: string): Promise; exists(path: string): Promise; }