bijection/notes.ts
app({ notes }), these functions are
notes.list and notes.add.
Spec keys
allow decides who may call a function. Labels decide what it may read and
write. The two are separate: an entry allowed to role.anyone that runs
under a label still needs a frame that clears that label. role.anyone and
role.signedIn name principal classes: the program issues each class a grant
at install that enters the functions listing it, and the lock prints that
grant. A class grant clears only the public label, so a non-public entry open
only to a class refuses Disallowed with reason NotCleared when it lacks
clearance. Give its callers a role that
clears the label instead.
The frame
ctx.frame is the host’s read-only record of this invocation.
Read time from
ctx.frame.now.entry. Durations and instants are Temporal values
everywhere in the SDK. See Frames and trials for world
selection and valid-time reads.
Call another function
ctx.call(fn, args) enters another function inside this transaction. A query
calls queries. A mutation calls queries and mutations, and a called mutation
joins the transaction. The callee needs no allow: internal functions are
reached this way.
bijection/notes.ts
Failed. ctx.try(fn, args) answers a Result
instead: a callee that refused or threw leaves no writes, submits or acts,
and the caller goes on. No refusal is sticky; a write guard, judged at
commit, is the one ctx.try cannot catch
(details). A query callee
also takes { in, at } to read another world or valid instant.
Plain helpers need no function boundary. A helper that uses the context takes
ctx first and uses its verbs. Type a helper that only reads Base, which
every function’s context is, a query’s or a mutation’s; type one that writes
MutationCtx. Pass the caller’s ctx as it is, without a cast. The only
type argument is the codes the helper refuses with: Base<"Missing"> lets
it refuse Missing. A context does not depend on the function’s under:
bijection check checks the helper’s reads and writes under the under of
each function that hands it its context.
Entry points
Next
- Effects: targets, tasks and continuations.
- Reactions:
every,cron,route.postand change sources. - Grave acts: the acts
bijection checklists by name. - Results and refusals:
Resultand the host codes.