import { QualifiedTablename, Statement } from '../util/index.js'; import { QueryBuilder } from './query-builder/index.js'; export type ForeignKey = { table: string; childKey: string; parentKey: string; }; type ColumnName = string; type ColumnType = string; type ColumnTypes = Record; export type Table = { qualifiedTableName: QualifiedTablename; columns: ColumnName[]; primary: ColumnName[]; foreignKeys: ForeignKey[]; columnTypes: ColumnTypes; }; type TableFullName = string; type Tables = Map; /** * Generates the triggers Satellite needs for the given table. * Assumes that the necessary meta tables already exist. * @param table - A new or existing table for which to create/update the triggers. * @returns An array of SQLite statements that add the necessary oplog triggers. * * @remarks * We return an array of SQL statements because the DB drivers * do not accept queries containing more than one SQL statement. */ export declare function generateOplogTriggers(table: Omit, builder: QueryBuilder): Statement[]; /** * Generates the oplog triggers and compensation triggers for the provided table. * @param tableFullName - Full name of the table for which to create the triggers. * @param tables - Dictionary mapping full table names to the corresponding tables. * @returns An array of SQLite statements that add the necessary oplog and compensation triggers. */ export declare function generateTableTriggers(table: Table, builder: QueryBuilder): Statement[]; /** * Generates triggers for all the provided tables. * @param tables - Dictionary mapping full table names to the corresponding tables. * @returns An array of SQLite statements that add the necessary oplog and compensation triggers for all tables. */ export declare function generateTriggers(tables: Tables, builder: QueryBuilder): Statement[]; export {};