ObjectStackObjectStack

External Catalog

External Catalog protocol schemas

ExternalCatalog — cached remote-schema snapshot for a federated datasource

(ADR-0015 §4.3).

Introspecting a mature warehouse on every boot is expensive, so the

IExternalDatasourceService.refreshCatalog persists a snapshot of the

remote tables/columns as an external_catalog metadata record. The

boot-validation gate (Gate 2) and Studio's schema browser read from it;

drift is detected by diffing a fresh introspection against the snapshot.

Source: packages/spec/src/data/external-catalog.zod.ts

TypeScript Usage

import { ExternalCatalog, ExternalColumn, ExternalTable } from '@objectstack/spec/data';
import type { ExternalCatalog, ExternalColumn, ExternalTable } from '@objectstack/spec/data';

// Validate data
const result = ExternalCatalog.parse(data);

ExternalCatalog

Properties

PropertyTypeRequiredDescription
namestringCatalog id, conventionally <datasource>_catalog.
datasourcestringDatasource.name this catalog snapshots.
snapshotAtstringWhen the snapshot was taken (ISO 8601).
dialectstringoptionalRemote SQL dialect, when known.
tablesObject[]Snapshotted remote tables.

ExternalColumn

Properties

PropertyTypeRequiredDescription
namestringRemote column name
sqlTypestringRaw remote SQL type (e.g. "numeric(10,2)")
nullablebooleanWhether the remote column is nullable
primaryKeybooleanPart of the remote primary key
suggestedFieldTypestringoptionalObjectStack field type suggested by the type-compat matrix

ExternalTable

Properties

PropertyTypeRequiredDescription
remoteSchemastringoptionalRemote schema/database qualifier
remoteNamestringRemote table/view name
columnsObject[]Remote columns
indexesObject[]optionalRemote indexes, when introspectable
rowCountEstimatenumberoptionalApproximate row count

On this page