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 { ExternalCatalogSchema, ExternalColumnSchema, ExternalTableSchema } from '@objectstack/spec/data';
import type { ExternalCatalog, ExternalColumn, ExternalTable } from '@objectstack/spec/data';

// Validate data
const result = ExternalCatalogSchema.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.
tables{ remoteSchema?: string; remoteName: string; columns: object[]; indexes?: object[]; … }[]Snapshotted remote tables.

Nested Shape: ExternalCatalog.tables[number]

PropertyTypeRequiredDescription
remoteSchemastringoptionalRemote schema/database qualifier
remoteNamestringRemote table/view name
columns{ name: string; sqlType: string; nullable: boolean; primaryKey: boolean; … }[]Remote columns
indexes{ name: string; columns: string[]; unique: boolean }[]optionalRemote indexes, when introspectable
rowCountEstimatenumberoptionalApproximate row count

ExternalColumn

Properties

PropertyTypeRequiredDescription
namestringRemote column name
sqlTypestringRaw remote SQL type (e.g. "numeric(10,2)")
nullablebooleanWhether the remote column is nullable
primaryKeybooleanoptional (default: false)Part 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
columns{ name: string; sqlType: string; nullable: boolean; primaryKey: boolean; … }[]Remote columns
indexes{ name: string; columns: string[]; unique: boolean }[]optionalRemote indexes, when introspectable
rowCountEstimatenumberoptionalApproximate row count

Nested Shape: ExternalTable.columns[number]

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

On this page