Skip to main content

DomainQueryBuilder<TRow, TColumn, TExpand, TResult, TDf>

Defined in: js-api/src/domains.ts:627

Thenable query builder (returned by no-arg query()): build with .where/.orderBy/.select/.expand/.top/.skip, then await it (rows), or finish with .df()/.first()/.count()/.exists(). Prefer the condition forms of where (and the cond/and/or helpers) over template-built filter strings — condition values are bound server-side, so any string value is safe (apostrophes included). Without .top() the server's default limit (100) applies; page larger sets with .top()/.skip(). Immutable-ish: expand()/select() return a re-typed builder; other methods mutate and return this. Invariants: the builder is PromiseLike only — there is no .catch()/.finally(), use try { await b } catch; EVERY await (or terminal) re-executes the query — two awaits are two round trips, cache the rows instead.

Type Parameters

Type ParameterDefault type
TRow-
TColumn extends stringstring
TExpand extends objectobject
TResultTRow
TDfany

Implements

  • PromiseLike<TResult[]>

Constructors

Constructor

new DomainQueryBuilder<TRow, TColumn, TExpand, TResult, TDf>(client): DomainQueryBuilder<TRow, TColumn, TExpand, TResult, TDf>

Defined in: js-api/src/domains.ts:638

Parameters

ParameterType
clientIDomainQueryExecutor<TRow>

Returns

DomainQueryBuilder<TRow, TColumn, TExpand, TResult, TDf>

Methods

count()

count(): Promise<number>

Defined in: js-api/src/domains.ts:751

Matching-row count under the built filter (ignores top/skip/select/expand).

Returns

Promise<number>


df()

df(): Promise<TDf>

Defined in: js-api/src/domains.ts:738

The same query as a typed DataFrame (d42; 'details:' expand is JSON-only and rejected server-side — await the builder for detail arrays instead).

Returns

Promise<TDf>


exists()

exists(): Promise<boolean>

Defined in: js-api/src/domains.ts:756

Whether at least one row matches.

Returns

Promise<boolean>


expand()

expand<K>(key): DomainQueryBuilder<TRow, TColumn, TExpand, TResult & TExpand[K], TDf>

Defined in: js-api/src/domains.ts:691

Adds an expand and intersects its fields into the awaited row type ('details:' child rows are full child rows — dayjs datetimes included).

Type Parameters

Type Parameter
K extends string

Parameters

ParameterType
keyK

Returns

DomainQueryBuilder<TRow, TColumn, TExpand, TResult & TExpand[K], TDf>


first()

first(): Promise<TResult | null>

Defined in: js-api/src/domains.ts:744

First matching row or null. NB: permanently overwrites the builder's limit with 1 — a later await of the same builder returns at most one row.

Returns

Promise<TResult | null>


orderBy()

orderBy(column, desc?): this

Defined in: js-api/src/domains.ts:673

Appends a sort key (the 'col,!col2' grammar; [desc] adds the !).

Parameters

ParameterTypeDefault value
columnDomainColumnRef<TColumn>undefined
descbooleanfalse

Returns

this


select()

select<K>(...columns): DomainQueryBuilder<TRow, TColumn, TExpand, Pick<TRow, K | Extract<keyof TRow, DomainSystemColumn>>, TDf>

Defined in: js-api/src/domains.ts:682

Narrows the projection to [columns] (system columns always ride along). NB: select() re-types the result from TRow — call it BEFORE expand(): the select-then-expand order composes, while expand-then-select keeps the expanded fields at runtime but drops them from the compile-time type.

Type Parameters

Type Parameter
K extends string

Parameters

ParameterType
...columnsK[]

Returns

DomainQueryBuilder<TRow, TColumn, TExpand, Pick<TRow, K | Extract<keyof TRow, DomainSystemColumn>>, TDf>


skip()

skip(count): this

Defined in: js-api/src/domains.ts:704

Row offset (pair with top to page).

Parameters

ParameterType
countnumber

Returns

this


then()

then<TR1, TR2>(onfulfilled?, onrejected?): Promise<TR1 | TR2>

Defined in: js-api/src/domains.ts:780

Attaches callbacks for the resolution and/or rejection of the Promise.

Type Parameters

Type ParameterDefault type
TR1TResult[]
TR2never

Parameters

ParameterTypeDescription
onfulfilled?((value) => TR1 | PromiseLike<TR1>) | nullThe callback to execute when the Promise is resolved.
onrejected?((reason) => TR2 | PromiseLike<TR2>) | nullThe callback to execute when the Promise is rejected.

Returns

Promise<TR1 | TR2>

A Promise for the completion of which ever callback is executed.

Implementation of

PromiseLike.then


top()

top(count): this

Defined in: js-api/src/domains.ts:698

Row cap for this query (server default 100 without it).

Parameters

ParameterType
countnumber

Returns

this


toQuery()

toQuery(): DomainQuery

Defined in: js-api/src/domains.ts:769

This builder's accumulated state as a serializable DomainQuery (the URL / deep-link / recorded-run form of the same query). Conditions become filter elements: top-level AND conjuncts are emitted one per element (so a URL can bind filters[0] alone), anything else travels as one JSON element.

The row cap travels, but its DEFAULT does not: without .top(), awaiting the builder takes the server default of 100 rows while toQuery().toSpec() falls back to DOMAIN_QUERY_ROW_LIMIT — the same builder, two row counts. Pin one with .top() when the two forms must agree.

Returns

DomainQuery


where()

Call Signature

where(values): this

Defined in: js-api/src/domains.ts:644

Equality map (AND-combined), a single typed condition (3-arg or node), or a raw smart-filter string escape hatch; multiple where() calls AND-combine. A raw string cannot be combined with conditions (the string parses server-side) — use cond()/and()/or() to express everything as one tree instead.

Parameters
ParameterType
values{ [K in string]?: DomainFilterValue }
Returns

this

Call Signature

where(property, operator, value?): this

Defined in: js-api/src/domains.ts:645

Equality map (AND-combined), a single typed condition (3-arg or node), or a raw smart-filter string escape hatch; multiple where() calls AND-combine. A raw string cannot be combined with conditions (the string parses server-side) — use cond()/and()/or() to express everything as one tree instead.

Parameters
ParameterType
propertyDomainColumnRef<TColumn>
operatorDomainConditionOperator
value?DomainFilterValue
Returns

this

Call Signature

where(filter): this

Defined in: js-api/src/domains.ts:647

Equality map (AND-combined), a single typed condition (3-arg or node), or a raw smart-filter string escape hatch; multiple where() calls AND-combine. A raw string cannot be combined with conditions (the string parses server-side) — use cond()/and()/or() to express everything as one tree instead.

Parameters
ParameterType
filterDomainFilter<TColumn>
Returns

this