client.query or watch it with client.watch and useWatch.
The host records what the query read and runs it again when that changes.
bijection/notes.ts
Reads
A query’sctx has the five reads, open(sealed), call and refuse.
Opening through a declared release requires a mutation.
Addresses say what to read:
notes(key) is a point, and
notes.where({ author }).by("written").descending() is a selection. An index
must serve every selection; see Reading data and
Indexes. A query that writes, submits or performs a grave
act does not type-check: the sentence names mutation(…) as the fix.
Paging
A query that pages takes{ size, cursor } and returns ctx.page(…):
bijection/notes.ts
t.cursor admits null, the first page. next is the cursor of the
following page, or null after the last. Pass the opaque next back to the
same selection and order. An ordinary index cursor marks a position in
that order. Each invocation chooses the version it reads, so rerunning an
earlier page can move the boundary for the pages that follow.
React’s usePages holds such a query’s pages.
Labels and exposure
allow exposes the query at its tree path; without it the query is internal
and only ctx.call reaches it. under is the label it answers under: it reads
facts at or below that label, and its caller’s frame must clear it. A query
open only to role.anyone or role.signedIn clears only the public label.
If its under requires more clearance, entry refuses Disallowed with
reason NotCleared. See Functions and
Labels.
Other worlds and instants
A query reads the head at the present by default, or atctx.frame.at when
the call names a valid instant.
A client picks another world or instant with client.in(world) and
client.at(instant); inside a function, ctx.call(query, args, { in, at })
and the address methods .in(world) and .at(instant) do the same. A watch
in a branch or at a version is one read; the head is watched live.
Run a query from a client
client.query answers a Result. In React,
useWatch(app.notes.latest) is undefined while loading and then the
latest Result, kept current. See JavaScript clients
and React.