DomainsDataSource
Defined in: js-api/src/dapi.ts:1387
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:1390
Parameters
| Parameter | Type |
|---|---|
dart | any |
Returns
DomainsDataSource
Properties
| Property | Type | Defined in |
|---|---|---|
dart | any | js-api/src/dapi.ts:1388 |
Accessors
registry
Get Signature
get registry():
DomainRegistryClient
Defined in: js-api/src/dapi.ts:1465
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
schemas
Get Signature
get schemas():
HttpDataSource<DomainSchema>
Defined in: js-api/src/dapi.ts:1395
Registered domain schemas; use .include('tables') to populate their tables.
Returns
Methods
draft()
draft(
body):Promise<DomainDraft>
Defined in: js-api/src/dapi.ts:1431
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
| Parameter | Type |
|---|---|
body | DomainDraftRequest |
Returns
Promise<DomainDraft>
invalidateUiCaches()
invalidateUiCaches():
void
Defined in: js-api/src/dapi.ts:1473
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:1458
Lifecycle handle for a registered domain schema (mirrors table()).
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
table()
table<
TRow,TInsert,TColumn,TExpand,TUpdate>(name,options?):DomainTableClient<TRow,TInsert,TColumn,TExpand,TUpdate>
Defined in: js-api/src/dapi.ts:1405
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 Parameter | Default type |
|---|---|
TRow | any |
TInsert | DomainRowInsert<TRow> |
TColumn extends string | string |
TExpand extends object | object |
TUpdate | Partial<TRow> |
Parameters
| Parameter | Type |
|---|---|
name | string |
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:1417
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
| Parameter | Type |
|---|---|
schema | string |
ops | [...T[]] |
Returns
Promise<{ [K in string | number | symbol]: DomainOpResultFor<T[K]> }>