tableSchemaOf
The table declared as table in the codebase (its name), with its row type: what writing to it needs.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import type { TableSchema } from "#codebase/tcmts/core/schema"; export function tableSchemaOf(cb: Codebase, table: string): TableSchema | undefined { for (const n of cb.store.names()) { const t = n.kind === "term" ? cb.store.getDef(n.hash)?.table : undefined; if (t?.name === table) return t; } return undefined; }