Query ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from configurator-runtime.d.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Type · import type { Query } from '@holostep-configurators/runtime-client/contract'; · stable · since 2.0.0 · section 6. Queries, rules and parts

All fields are ANDed; an array of queries matches any of them. Every field is authored or fixed at creation: no rule and no Frame write can change it, so a rule never changes its own members. (Only Collection.set changes an item's name, tags or meta; membership is re-evaluated at that commit.)

Inherited from Part: id, name, kind, source, node, collection, key, role, tags, slot, meta, parent, children, exists, visible, pose, worldPose, restPose, material.

Inherited from PartActions: set, bounds, find, follow.

Declaration ​

ts
export type Query = {
  node?: string;
  collection?: string;
  key?: string;
  id?: string;
  name?: string;
  slot?: string;
  kind?: 'group' | 'mesh' | 'joint' | 'light' | 'lines' | 'label';
  tag?: string;
  role?: Role;
  meta?: Readonly<Record<string, JsonPrimitive>>;
  root?: boolean;
} | Part | readonly Query[];

Example ​

Imports: values (has, validate, the Holo*Error classes, the pure helpers) from @holostep-configurators/runtime-client, types from @holostep-configurators/runtime-client/contract, /math and /testing names from those entries; boot from the runtime module the root's loadRuntimeAtFloor resolves to. A type your page defines is your app's: declare it there, never import it from the package.

Compiled under the contract's strict settings (examples/declaration/06-Query.ts):

ts
import type { Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
// Hide the 'matte black' primitive of one named node in one placed unit. When the slot is
// unique in the model, `{ node: unitId, slot: 'matte black' }` is enough.
declare const unitId: string;
const body = session.find({ node: unitId, name: 'Corpus.012', kind: 'group' }).first();
for (const p of body?.children ?? []) {
  if (p.slot === 'matte black') await p.set({ visible: false });
}
// A node's or a collection's query also matches its root group part: count meshes, not parts.
export const meshCount = (q: { node: string } | { collection: string }): number =>
  session.find({ ...q, kind: 'mesh' }).count;

Generic-API test (spec 3.1) ​

Rule Result
1. Neutral name pass: Query names no product
2. A precedent pass: DOM Document.querySelectorAll (row K58)
3. Two apps, or labs pass: 28 apps (ledger: app-bcb7ef21da, app-f3598fad77, app-f9a32142f1, app-fc07850558, app-fc306ec3dc, app-fd09090420; fleet cross-check: app-04c2774145, app-0c773a4ee3, app-37356bf09f, app-378d190f1b, app-4762caacdc, app-4f16d2f6da, app-4fd23bc869, app-510d750508 and 20 more)
4. The cheaper fix first decided per need in Appendix B: rows K58 at tier stable (a member only where no rule, data, asset or app code serves the need)