import { QueryBuilder } from './query-builder.js'; import { ValidationRule } from './types.js'; export declare class ActiveRecord<_T = any> { id?: string; _version?: number; _deletedAt?: string | null; updatedAt?: string; protected static db: IDBDatabase | null; protected static tableName: string; protected static indexes: any[]; protected static belongsTo: Record; protected static hasMany: Record; protected static hasOne: Record; protected static beforeCreate?: (record: any) => void; protected static afterCreate?: (record: any) => void; protected static beforeUpdate?: (record: any) => void; protected static afterUpdate?: (record: any) => void; protected static beforeDestroy?: (record: any) => void; protected static afterDestroy?: (record: any) => void; protected static validates?: Record; static enableSync: boolean; static softDelete: boolean; /** * Optional explicit column declarations. When set, these are the source of * truth for the model's schema and are used by SyncEngine to call * adapter.ensureTable(). Each entry can omit fields — sensible defaults * are applied (nullable: true, type: 'string'). * * Example: * static columns = { * title: { type: 'string', nullable: false }, * priority: { type: 'integer', default: 0 } * }; */ static columns?: Record>; /** * Normalize the static `columns` declaration into a ColumnDef[] array * suitable for adapter.ensureTable(). Returns null if no columns declared. */ static getColumnDefs(): Array<{ name: string; type: string; nullable: boolean; default?: unknown; primaryKey?: boolean; autoIncrement?: boolean; }> | null; errors: string[]; static setDatabase(db: IDBDatabase): void; static find(id: string): Promise; static all(options?: { withDeleted?: boolean; }): Promise; static withDeleted(): Promise; static onlyDeleted(): Promise; private static generateUUID; static create(data: any): Promise; static where(field: string, operator: string, value?: any): QueryBuilder; static transaction(callback: () => Promise): Promise; update(data: any): Promise; destroy(): Promise; static restore(id: string): Promise; /** * Optional listener invoked after a change is logged. Used by Database to * trigger auto-sync. Set via ActiveRecord.setChangeListener(). */ private static changeListener; static setChangeListener(listener: ((table: string) => void) | null): void; /** * Log a sync change to the __sync_changes store */ private static logChange; isValid(): Promise; private static _defineRelationshipAccessors; hasOne(relationshipName: string): Promise; hasMany(relationshipName: string): Promise; belongsTo(relationshipName: string): Promise; static beginTransaction(): Promise; } //# sourceMappingURL=activerecord.d.ts.map