Skip to main content

In the same repository

Set "browserClient": true in bijection.json. The app starter enables it. bijection dev refreshes .bijection/_generated/client.ts as it prepares the app. Run bijection check --write-lock to review changes to the lock.
apps/main/src/client.ts
client.mutate(app.notes.add, { text: "Hello" }) gets its argument type, answer type and declared refusal payloads from the declaration. The generated module carries the runtime validators and pins without bundling the app’s server code. Use client.under(app.tenants.of(org)) to select a family member’s label.

Calling contracts

bijection check --write-lock writes one contract <path> <digest> line per exposed function. Each digest covers the function’s kind, arguments, return value and declared refusals. Review the lock diff with the code change. A generated client supplies a map of expected digests. It sends the entry for the function it calls. If the entry is missing, the client refuses before sending the request. When a reference comes from a different generated client, its digest must match the connection’s pin for that path. A mismatch returns Conflict with reason ContractStale before sending a request.
For a dynamic tool, pass contract: "discover" to call the serving interface without a pin. Use api("notes.list") when you only know the path. A dynamic call can return a host refusal or an application refusal. For kind: "app", the code is a string and the payload needs to be narrowed from unknown. api<typeof App>() supplies typed paths, arguments and wire-shaped answers. A File in an answer comes back as its key string. To receive a File point, declare the position with t.file and call through a generated reference or one created with api(appDeclaration). A change to a pinned function returns Conflict with reason ContractStale. Adding a function or narrowing its roles leaves the other paths’ pins valid. Use bijection deploy --trial to list changes to existing contracts. For a production deployment, pass the reviewed paths as a comma-separated list to --accept-breaking-contracts. A pinned mutation keeps its original session slot for retries on the same connection. Use the same once and call arguments to recover its ordered result while the registration and recovery authority are live.

For another repository

The package exports app, the typed reference tree, and connect, which supplies the digests from the reviewed lock. It also contains a language-neutral interface document. The command compares the lock’s per-path digests with the source before writing the package.
For a language other than TypeScript, see Other languages.