Skip to main content
The Approvals app records attributed votes and decides requests against a requirement of seats. Mount it by calling it at a path of your tree:
bijection/mounts.ts
bijection/app.ts
The mount brings its own approvals.reviewer role. Reviewers decide at the exposed paths approvals.decisions.decide, approvals.decisions.pending and approvals.requests.history. Enrol a reviewer from your own mutation with ctx.call(approvals.reviewers.enrol, { class, principal, kind }). Pass the installer roles allowed to enrol reviewers and re-arm landings in operators. To let another installer role withdraw requests, pass it in requesters.

Ask for a decision

ask(ctx, approvals, request, { once, within, then }) submits the mount’s decided target in your transaction and returns its Task. The request names the subject, a digest of exactly what reviewers approve, and the requirement.
bijection/release.ts
The task settles in the commit of the vote that decides it. Its value is a Decision: status (approved or rejected), the request, the digest, the effective requirement and the counted votes. A request refused at ask (InvalidRequirement, …), a withdrawn ask (Withdrawn) and a missed deadline (Expired) arrive as refusals. Withdraw a pending ask with ctx.call(approvals.requests.withdraw, { task }). It answers the request’s latch, so a decision that settled first wins.

Govern a landing

Pass a landing policy when you mount the app, and ask with act: { kind: "land", branch }. The policy is a query answering the seen version it approves. When the request is approved, the mount lands exactly that version, and a branch that moved past it refuses Conflict. See Review, approve and land a branch. The purchase orders example runs an approval as the first step of a chain.