UNPKG

mcp-postgres-full-access

Version:

Full-access PostgreSQL server for Model Context Protocol with read/write capabilities and enhanced schema metadata

47 lines (46 loc) 1.27 kB
import pg from "pg"; import { TrackedTransaction } from "./types.js"; export declare class TransactionManager { private activeTransactions; private monitorInterval; private transactionTimeoutMs; private monitorIntervalMs; private monitorEnabled; constructor(transactionTimeoutMs?: number, monitorIntervalMs?: number, monitorEnabled?: boolean); /** * Add a new transaction to the manager */ addTransaction(id: string, client: pg.PoolClient, sql: string): void; /** * Get a transaction by ID */ getTransaction(id: string): TrackedTransaction | undefined; /** * Remove a transaction from the manager */ removeTransaction(id: string): boolean; /** * Check if a transaction exists */ hasTransaction(id: string): boolean; /** * Get count of active transactions */ get transactionCount(): number; /** * Start the transaction monitor */ startMonitor(): void; /** * Stop the transaction monitor */ stopMonitor(): void; /** * Monitor for stuck transactions and roll them back */ private checkStuckTransactions; /** * Clean up any pending transactions */ cleanupTransactions(): Promise<void>; }