import type { LixEngine } from "../../engine/boot.js"; import type { NewStateByVersionRow, StateByVersionRow } from "../index.js"; type NewTransactionStateRow = Omit & { snapshot_content: string | null; metadata?: string | null; }; export type TransactionStateRow = Omit & { snapshot_content: string | null; metadata: string | null; }; /** * Inserts a state change into the transaction stage. * * This function handles the TRANSACTION stage of the state mutation flow, where * changes are temporarily stored in the transaction table before being committed * to permanent storage. All changes (both tracked and untracked) are stored * in the transaction table until commit time. * * @param args.engine - The engine with SQLite database and Kysely query builder * @param args.data - The state data to insert, including entity details and snapshot * @param args.timestamp - Timestamp to use for the changes * @param args.createChangeAuthors - Whether to create change_author records (defaults to true) * * @returns The inserted state row with generated fields like change_id * * @example * // Insert a new entity state * insertTransactionState({ * engine: { sqlite, db, hooks }, * data: { * entity_id: "user-123", * schema_key: "user", * file_id: "file1", * plugin_key: "my-plugin", * snapshot_content: JSON.stringify({ name: "John", email: "john@example.com" }), * schema_version: "1.0", * version_id: "version-abc", * untracked: false * } * }); * * @example * // Delete an entity (null snapshot_content) * insertTransactionState({ * engine, * data: { * entity_id: "user-123", * schema_key: "user", * file_id: "file1", * plugin_key: "my-plugin", * snapshot_content: null, // Deletion * schema_version: "1.0", * version_id: "version-abc", * untracked: false * } * }); */ export declare function insertTransactionState(args: { engine: Pick; data: NewTransactionStateRow[]; timestamp: string; createChangeAuthors?: boolean; }): TransactionStateRow[]; export {}; //# sourceMappingURL=insert-transaction-state.d.ts.map