Skip to main content

DomainsDataSource

Defined in: js-api/src/dapi.ts:1099

Generic client for domain tables — entity-mapped PostgreSQL schemas that plugins declare via databases/<schema>/schema.json manifests. Rows are plain JSON objects; column metadata and security come from the server-side schema registry.

Constructors

Constructor

new DomainsDataSource(dart): DomainsDataSource

Defined in: js-api/src/dapi.ts:1102

Parameters

ParameterType
dartany

Returns

DomainsDataSource

Properties

PropertyTypeDefined in
dartanyjs-api/src/dapi.ts:1100

Accessors

registry

Get Signature

get registry(): DomainRegistryClient

Defined in: js-api/src/dapi.ts:1149

Reflection over the domain registry: the runtime Property metadata, table info with FK-inverted child tables, and batched display-name resolution — what reflective UI components consume to work on any table without codegen.

Returns

DomainRegistryClient


schemas

Get Signature

get schemas(): HttpDataSource<DomainSchema>

Defined in: js-api/src/dapi.ts:1107

Registered domain schemas; use .include('tables') to populate their tables.

Returns

HttpDataSource<DomainSchema>

Methods

createSchema()

createSchema(name, options?): Promise<{[key: string]: any; }>

Defined in: js-api/src/dapi.ts:1136

Creates an empty user-managed domain schema (physical PG schema 'usr_<name>'); requires the CreateDomainSchema privilege. Add tables via schema(name).apply().

Parameters

ParameterType
namestring
options?{ description?: string; friendlyName?: string; }
options.description?string
options.friendlyName?string

Returns

Promise<{[key: string]: any; }>


invalidateUiCaches()

invalidateUiCaches(): void

Defined in: js-api/src/dapi.ts:1157

Drops the client-side domain UI caches (table capabilities, row permissions, writable columns, resolved display names) so the next read re-probes server truth. Grant changes made through this client invalidate automatically; call this after out-of-band grant changes (another session, grok s, server-side).

Returns

void


schema()

schema(name): DomainSchemaClient

Defined in: js-api/src/dapi.ts:1142

Lifecycle handle for a registered domain schema (mirrors table()).

Parameters

ParameterType
namestring

Returns

DomainSchemaClient


table()

table<TRow, TInsert, TColumn, TExpand, TUpdate>(name, options?): DomainTableClient<TRow, TInsert, TColumn, TExpand, TUpdate>

Defined in: js-api/src/dapi.ts:1117

Returns a client for the domain table addressed as '<schema>.<table>', e.g. 'plates.plate'. Pass a row interface for a typed client: grok.dapi.domains.table<PlateRow>('plates.plate'); pass an insert interface as the second generic to also gate DomainTableClient.insert, a column-name union as the third to compile-check filters/columns/sorts, an expand map as the fourth to compile-check expand keys, and an update payload as the fifth when the table declares relations (grok api-generated clients pass them all).

Type Parameters

Type ParameterDefault type
TRowany
TInsertDomainRowInsert<TRow>
TColumn extends stringstring
TExpand extends objectobject
TUpdatePartial<TRow>

Parameters

ParameterType
namestring
options?DomainTableClientOptions

Returns

DomainTableClient<TRow, TInsert, TColumn, TExpand, TUpdate>


transaction()

transaction<T>(schema, ops): Promise<{ [K in string | number | symbol]: DomainOpResultFor<T[K]> }>

Defined in: js-api/src/dapi.ts:1129

Executes ordered [ops] (≤1000) atomically within domain schema [schema]; any failure rolls the whole transaction back (the error carries opIndex). Resolves to ordered per-op results shaped like the corresponding single-op endpoints — a tuple ops literal gets per-op result types ([{op: 'update', ...}, {op: 'insert', ...}][DomainUpdateResult, DomainInsertResult], no positional casts).

Type Parameters

Type Parameter
T extends DomainTransactionOp[]

Parameters

ParameterType
schemastring
ops[...T[]]

Returns

Promise<{ [K in string | number | symbol]: DomainOpResultFor<T[K]> }>