import type { KtxSchemaSnapshot } from './types.js'; export function resolveEnabledTables(connection: Record | undefined): Set | null { const raw = connection?.enabled_tables; if (!Array.isArray(raw) || raw.length === 0) return null; return new Set(raw.filter((v): v is string => typeof v === 'string')); } export function filterSnapshotTables(snapshot: KtxSchemaSnapshot, enabledTables: Set): KtxSchemaSnapshot { return { ...snapshot, tables: snapshot.tables.filter((table) => { const key = table.db ? `${table.db}.${table.name}` : table.name; return enabledTables.has(key); }), }; }