Skip to main content

DomainsDataSource

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

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:1385

Parameters​

ParameterType
dartany

Returns​

DomainsDataSource

Properties​

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

Accessors​

registry​

Get Signature​

get registry(): DomainRegistryClient

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

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:1390

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

Returns​

HttpDataSource<DomainSchema>

Methods​

draft()​

draft(body): Promise<DomainDraft>

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

Drafts a manifest over an external database the caller may introspect and query (requires CreateDomainSchema, and GetSchema + Query on the connection): the manifest as a starting point — remote names kept, the primary key as the business key, one-column foreign keys onto drafted tables as refs — with the inventory of what the warehouse has and why a table or column stayed out (DomainDraft). Nothing is registered; hand the (edited) manifest to createSchema. A malformed remote identifier rejects with a DomainManifestValidationError addressed by path ('schema', 'tables[i]'); no right on the connection with a DomainForbiddenError naming what is missing; an unreachable warehouse with a DomainError code 'external-unreachable' (503).

Parameters​

ParameterType
bodyDomainDraftRequest

Returns​

Promise<DomainDraft>


invalidateUiCaches()​

invalidateUiCaches(): void

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

Drops the client-side domain UI caches (table access, 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:1453

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:1400

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:1412

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]> }>