ObjectStackObjectStack

Object Query Source — AI Protocol reference

Object Query Source schemas of the ObjectStack AI Protocol: ObjectQuerySource — each property with its type, default and a TypeScript example.

Source: packages/spec/src/ai/object-query-source.zod.ts

TypeScript Usage

import { ObjectQuerySourceSchema } from '@objectstack/spec/ai';
import type { ObjectQuerySource } from '@objectstack/spec/ai';

// Validate data
const result = ObjectQuerySourceSchema.parse(data);

ObjectQuerySource

Properties

PropertyTypeRequiredDescription
objectstring✅The machine name of the object the figures were read from
labelstringoptionalThe object's plural label, or its label when it declares no plural. Translated only when the request is in Chinese and a zh* translation pack names the object; otherwise the authored label, not the caller's UI locale. Absent when the producer sets none: a reader falls back to object
filteranyoptionalThe caller's where, in the $ query dialect, exactly as the engine accepted it: machine names only, no field labels, date placeholders such as {today} as written. Absent when no condition applied
scope'visible_to_you'✅The row scope the figures cover: only the records the caller may read, after sharing and row-level narrowing. Always present; this is its only value
groupBystring[]optionalThe field names the figures were grouped by, in order
aggregations{ function: Enum<'count' | 'sum' | 'avg' | 'min' | 'max' | 'count_distinct'>; field?: string }[]optionalThe aggregations computed, in order
orderBy{ field: string; order?: Enum<'asc' | 'desc'> }[]optionalThe ordering applied, in order of precedence
limitintegeroptionalThe row or group cut applied (a top-N read or a group cut). Present only together with orderBy
relatedstring[]optionalThe lookup paths read in the same call, dotted from the object (for example client.relationship_manager)
latestPer{ groupBy: string; orderField: string }optionalPresent when the answer keeps only the latest row per group
recordsintegeroptionalHow many records the figures cover — a count, never a list: the match total for a page read, the summed group counts for an aggregate or a chart, 1 for get_record. Absent when unknown, never guessed
linestring✅The finished one-line citation, in the request language. The producer keeps it to at most 280 characters; a reader does not refuse a longer one

Nested Shape: ObjectQuerySource.aggregations[number]

PropertyTypeRequiredDescription
functionEnum<'count' | 'sum' | 'avg' | 'min' | 'max' | 'count_distinct'>✅The aggregation function
fieldstringoptionalThe field aggregated; absent for a bare count

Nested Shape: ObjectQuerySource.orderBy[number]

PropertyTypeRequiredDescription
fieldstring✅The field the records were ordered by
orderEnum<'asc' | 'desc'>optionalThe direction; absent when the query named none

Nested Shape: ObjectQuerySource.latestPer

PropertyTypeRequiredDescription
groupBystring✅The field the latest row is taken per
orderFieldstring✅The field that decides which row is latest

On this page