import { Kysely, Transaction } from 'kysely'; import { KyselyDatabase } from './KyselyDatabase.js'; import { Database } from '../../Database.js'; import { DatabaseTransaction } from '../../DatabaseTransaction.js'; /** * Represents a transaction for querying a database with a specific schema. * @param DBSchema - The schema of the database. * @type {KyselyTransactionImpl & Transaction} */ export type KyselyTransaction = KyselyTransactionImpl & Transaction; /** * Represents a transaction in a Postgres database. */ export declare class KyselyTransactionImpl extends DatabaseTransaction { /** * A readonly property representing a writer for a Kysely object. * @type {Kysely} */ readonly writer: Kysely; /** * A readonly property representing a reader of type Kysely. * This property allows reading data of any type using the Kysely interface. */ readonly reader: Kysely; /** * A protected property representing a transaction of type any. */ protected transaction: Transaction; /** * A protected property representing a database instance. * @type {Database>} */ protected database: Database>; /** * A private property that represents a deferred object. * @type {Deferred} */ private txWrapper; /** * Constructs a new instance of the class. * @param {Kysely} delegate - The delegate object for the database query. * @param {KyselyDatabase} database - The database object for the query. * @param {Kysely} [reader] - An optional reader object for the query. * @returns None */ private constructor(); /** * Creates a new database transaction for the given database schema. * @param {Kysely} connection - The connection object for the transaction. * @param {KyselyDatabase} database - The database object for the transaction. * @param {Kysely} [reader] - An optional reader object for the transaction. * @returns {Promise>} A promise that resolves to the created transaction. */ static newTransaction(connection: Kysely, database: KyselyDatabase, reader?: Kysely): Promise>; /** * Asynchronously begins a transaction using a writer and resolves the transaction once it is executed. * @returns A Promise that resolves with the transaction object once the transaction is executed. */ protected doBegin: () => Promise; /** * Executes the commit operation by resolving the transaction wrapper and returning a resolved Promise. * @returns A Promise that resolves to null. */ protected doCommit: () => Promise; /** * Performs a rollback operation by rejecting the transaction wrapper with an error. * @returns A resolved Promise after the rollback operation is completed. */ protected doRollback: () => Promise; }