import type { AggregateProperty } from '../aggregates.js'; export interface OrmDbConfig { file: string; schema: string; mode: string; directory: string; autosave: string; saveInterval: string | number; } export interface OrmMysqlConfig { host: string; port?: number; user: string; password: string; database: string; connectionLimit?: number; migrationsDir?: string; migrationsTable?: string; [key: string]: unknown; } export interface OrmPostgresConfig { host: string; port: number; user: string; password: string; database: string; connectionLimit?: number; migrationsDir?: string; migrationsTable?: string; [key: string]: unknown; } export interface OrmPaths { model: string; serializer: string; transform: string; view?: string; access?: string; [key: string]: string | undefined; } export interface OrmRestServerConfig { enabled: string; route: string; metaRoute: boolean; } export interface OrmSection { db: OrmDbConfig; paths: OrmPaths; restServer: OrmRestServerConfig; mysql?: OrmMysqlConfig; postgres?: OrmPostgresConfig; timescale?: OrmPostgresConfig; [key: string]: unknown; } export interface OrmConfig { rootPath: string; orm: OrmSection; [key: string]: unknown; } export interface SourceRecord { __model: { __name: string; [key: string]: unknown; }; __data?: Record; __relationships?: Record; id: string | number; [key: string]: unknown; } export interface OrmRecord { id: string | number; __model?: { __name: string; }; __data: Record & { id?: string | number; __pendingSqlId?: boolean; }; __relationships: Record; toJSON?(options?: { fields?: Set; baseUrl?: string; }): Record; [key: string]: unknown; } export interface ForeignKeyDef { references: string; column: string; } export interface HypertableConfig { timeColumn: string; chunkInterval?: string; compress?: { segmentBy?: string; orderBy?: string; after?: string; }; } export interface ModelSchema { table: string; idType: string; columns: Record; foreignKeys: Record; relationships: { belongsTo: Record; hasMany: Record; }; vectorColumns?: Record; hypertable?: HypertableConfig; memory: boolean; } export interface ViewSchema { viewName: string; source: string; groupBy?: string; columns: Record; foreignKeys: Record; aggregates: Record; relationships: { belongsTo: Record; hasMany: Record; }; isView: boolean; memory: boolean; } /** * Typed relationship registry maps. * Each key in Orm.relationships stores a different nested Map structure. */ /** Relationship registry map types — source → target → recordId → value */ export type HasManyMap = Map>>; export type BelongsToMap = Map>>; export type GlobalMap = Map; export type PendingMap = Map>; export type PendingBelongsToMap = Map>; export interface RelationshipMaps { hasMany: HasManyMap; belongsTo: BelongsToMap; global: GlobalMap; pending: PendingMap; pendingBelongsTo: PendingBelongsToMap; } export interface SnapshotEntry { table?: string; idType?: string; columns?: Record; foreignKeys?: Record; vectorColumns?: Record; hypertable?: HypertableConfig; isView?: boolean; viewName?: string; source?: string; viewQuery?: string; }