mirror of
https://github.com/Kaelio/ktx.git
synced 2026-07-13 11:22:11 +02:00
feat(scan): enforce table scope at fetch boundary
This commit is contained in:
parent
a698389bc9
commit
5b8292cacd
19 changed files with 208 additions and 160 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { hasTableRef, tableRefSet, type KtxTableRefKey } from './table-ref.js';
|
||||
import type { KtxSchemaSnapshot, KtxTableRef } from './types.js';
|
||||
import { tableRefSet, type KtxTableRefKey } from './table-ref.js';
|
||||
import type { KtxTableRef } from './types.js';
|
||||
|
||||
/**
|
||||
* Parses the `enabled_tables` field on a connection into a scope of
|
||||
|
|
@ -61,16 +61,3 @@ function parseDottedEntry(value: string): KtxTableRef | null {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** @internal — kept as a defensive backstop for the live-database adapter and tests. */
|
||||
export function filterSnapshotTables(
|
||||
snapshot: KtxSchemaSnapshot,
|
||||
enabledTables: ReadonlySet<KtxTableRefKey>,
|
||||
): KtxSchemaSnapshot {
|
||||
return {
|
||||
...snapshot,
|
||||
tables: snapshot.tables.filter((table) =>
|
||||
hasTableRef(enabledTables, { catalog: table.catalog, db: table.db, name: table.name }),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue