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
| Parameter | Type |
|---|---|
dart | any |
Returns
DomainsDataSource
Properties
| Property | Type | Defined in |
|---|---|---|
dart | any | js-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
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
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
| Parameter | Type |
|---|---|
name | string |
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
| 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: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 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: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
| Parameter | Type |
|---|---|
schema | string |
ops | [...T[]] |
Returns
Promise<{ [K in string | number | symbol]: DomainOpResultFor<T[K]> }>