export declare const actions: unique symbol; export declare const base: unique symbol; export declare const loaded: unique symbol; export declare const size: unique symbol; export declare const transaction: unique symbol; export type TxAction = { action: "remove"; records: number; } | { action: "save"; records: number | false; }; export declare class EntryBase { constructor(from?: Partial); construct(): void; postCommit(actions: TxAction[]): void; postLoad(): void; postRemove(deletedRecords: number): void; postSave(savedRecords: number | false): void; preCommit(actions: TxAction[]): void; preLoad(): void; preRemove(): void; preSave(): void; remove(): Promise; save(): Promise; } export type ForeignKeyActions = "cascade" | "no action" | "restrict" | "set default" | "set null"; export interface ForeignKeyOptions { onDelete?: ForeignKeyActions; onUpdate?: ForeignKeyActions; } export interface Type { [base]: unknown; entry?: E; native?: T; notNull?: N; [size]?: number; type: string; foreignKey?: { attributeName: string; fieldName: string; options?: ForeignKeyOptions; tableName: string; }; } export declare class Type { constructor(from: Type); } export interface Attribute extends Type { attributeName: string; defaultValue?: unknown; fieldName: string; modelName: string; notNull: N; tableName: string; unique?: boolean; } export declare class Attribute extends Type { constructor(from: Attribute); } export interface Constraint { attribute: Attribute; constraintName: string; type: "f" | "u"; } export interface Index { fields: string[]; indexName: string; type: "btree" | "hash"; unique: boolean; } interface ITable { attributes: Attribute[]; autoIncrement: boolean; constraints: Constraint[]; indexes: Index[]; model: { load: (where: any, order?: any, tx?: Transaction) => Promise; }; parent?: Attribute; pk: Attribute; sync: boolean; tableName: string; } declare const Table_base: new (defaults?: ITable | undefined) => ITable; export declare class Table extends Table_base { autoIncrementOwn?: boolean; oid?: number; findAttribute(name: string): Attribute; findField(name: string): Attribute; } export declare abstract class DB { tables: Table[]; protected log: (message: string) => void; protected sync: boolean; abstract connect(): Promise; abstract end(): Promise; constructor(log: (message: string) => void); findTable(name: string): Table; protected indexesEq(a: Index, b: Index): boolean; syncDataBase(): Promise; protected syncLog(message: string): void; abstract begin(): Promise; abstract cancel(tableName: string): (where: string, tx?: Transaction) => Promise; abstract escape(value: unknown): string; abstract load(tableName: string, attributes: Record, pk: Attribute, model: new () => EntryBase, table: Table): (where: string, order?: string | string[], limit?: number, tx?: Transaction, lock?: boolean) => Promise; abstract remove(tableName: string, pk: Attribute): (this: EntryBase & Record) => Promise; abstract save(tableName: string, attr2field: Record, pk: Attribute): (this: EntryBase & Record) => Promise; abstract dropConstraints(table: Table): Promise; abstract dropFields(table: Table): Promise; abstract dropIndexes(table: Table, constraintIndexes: number[]): Promise; abstract syncConstraints(table: Table): Promise; abstract syncFields(table: Table): Promise; abstract syncIndexes(table: Table): Promise; abstract syncSequence(table: Table): Promise; abstract syncTable(table: Table): Promise; } export declare class Transaction { private entries; private closed; protected log: (message: string) => void; constructor(log: (message: string) => void); addEntry(entry: EntryBase): void; clean(): void; commit(): Promise; protected preCommit(): void; rollback(): Promise; } export declare function deepCopy(o: unknown): any; export declare function deepDiff(a: unknown, b: unknown): boolean; export {};