"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initializeDBBlocker = initializeDBBlocker;
exports.isDBBlocked = isDBBlocked;
exports.blockDBInit = blockDBInit;
exports.blockPrismaInit = blockPrismaInit;
exports.blockPostgresInit = blockPostgresInit;
exports.blockSQLiteInit = blockSQLiteInit;
exports.blockRedisInit = blockRedisInit;
exports.blockORMInit = blockORMInit;
exports.blockConnectionPoolInit = blockConnectionPoolInit;
exports.createNoOpDBClient = createNoOpDBClient;
let isBlocked = false;
function initializeDBBlocker(isMemoryMode) {
    isBlocked = isMemoryMode;
    if (isMemoryMode) {
        console.warn('[No-Persistence] Database client blocker activated. All DB initialization will be blocked.');
    }
}
function isDBBlocked() {
    return isBlocked;
}
function blockDBInit(clientType) {
    if (isBlocked) {
        throw new Error(`[No-Persistence] Persistent DB initialization blocked. Attempted to initialize: ${clientType}`);
    }
}
function blockPrismaInit() {
    blockDBInit('Prisma');
}
function blockPostgresInit() {
    blockDBInit('PostgreSQL');
}
function blockSQLiteInit() {
    blockDBInit('SQLite');
}
function blockRedisInit() {
    blockDBInit('Redis');
}
function blockORMInit() {
    blockDBInit('ORM');
}
function blockConnectionPoolInit() {
    blockDBInit('Connection Pool');
}
function createNoOpDBClient(clientType) {
    return new Proxy({}, {
        get(target, prop) {
            if (prop === 'connect' || prop === 'query' || prop === 'execute') {
                return () => {
                    throw new Error(`[No-Persistence] ${clientType} operations are disabled in memory mode`);
                };
            }
            return () => { };
        }
    });
}
//# sourceMappingURL=db-blocker.js.map