Skip to main content
A resource declares the external data your application uses. Deployment bindings supply its coordinates and a reference to a private credential. The generated resources namespace connects these two parts without handwritten addresses.

Declare resources

bijection/sources.ts
These declarations contain schemas and provider semantics. Endpoints, dataset names, subscriptions, namespaces and credentials belong to the deployment. Dataset fields default to the schema’s names; supply fields when source names differ.
bijection/schema.ts
The example uses one read policy for signed-in application users. Bind your application’s narrower policies here when resources belong to different owners. Source-owned tables already have their native write boundary.
bijection/access.ts
defineTable(resource) infers the record type. There is no second validator to keep synchronized. Pub/Sub rows are message occurrences with messageId, publishedAt, attributes and typed data. Pods expose typed metadata, spec and status fields.

Bind a deployment

Provision each private credential with bijection connection credential create <name> --from-file <file>. The credential’s provider-specific envelope contains authentication material; put non-secret installation values in setup. Place this file next to bijection.json:
bijection.bindings.ts
The usual bijection dev and deployment push load this file after code generation and apply it after the code and schema are deployed. Imported configuration files participate in the dev watch. Dry runs validate the file without applying it. The bindings program runs in the CLI and is never uploaded as application code. The deployed resource contract validates setup and credential references. Binding verifies provider identity, installs the existing source owner and schedules acquisition. Reapplying unchanged configuration preserves its generation. Removing a binding entry retains imported data and private credentials.

Query and observe

bijection/inventory.ts
These are ordinary reactive queries. useQuery(api.inventory.list) receives typed rows through the normal client. Resource status uses the installed source’s existing authority and query dependencies. It reports serving evidence separately from acquisition work. An acquisition interval does not promise population coverage or freshness. A missing or ambiguous installation produces a diagnostic; use an explicit sourceId to select among authorized installations.

Share a connection

The simple binding above supplies everything at once. An operator program can share connection-owned fields and credential custody across several resources:
The deployed declaration determines which fields the connection owns. A shared binding cannot override those fields or its credential. Connections are immutable and identified by their admitted configuration. Changing one creates a new connection; each binding explicitly selects it and pins its own generation and credential revision. Background work never silently switches configuration.

Preserve atomic acquisition groups

Some providers acquire several tables together. Declare one group and bind it once:
bijection/sources.ts
Use defineTable(sales.tables.orders) and defineTable(sales.tables.lines) in the schema. PostgreSQL keeps its consistent initial snapshot and atomic transaction publication. Mail accounts similarly expose tables.messages, tables.contents and tables.memberships under one acquisition owner. A group status read selects a typed collection name:

Commands use durable calls

Generated resource references expose only declared commands, with inferred arguments, under resources.<module>.<export>.commands. Submit them from mutations through ctx.calls.add. A command changing a record requires its local target. A collection create can infer its target when exactly one resource source is installed. A child create still requires its parent record. For example, a Calendar resource’s update capability uses the ordinary mutation and generated-reference conventions:
The native command owner retains occurrence identity, policy, approval, connection and source custody. Retrying a mutation retains the same call. A lost provider answer remains unknown when the provider supplies no proof or safe retry contract. Resource declarations do not invent write capabilities or delivery guarantees.

Provider recipes

All constructors are exported by @bijectionhq/component-support/connectors. They compose the existing native protocols and their evidence rules. Broker routing names remain logical declarations where the native protocol owns routing. Endpoints, subscriptions and credentials remain deployment configuration. Operational messages validate JSON and the declared schema before acknowledging receipts. Raw archives, event histories, conditional writes and custom HTTP protocols remain explicit capabilities of the lower-level authoring primitives. Connector authors use defineResource or defineResourceGroup from bijection/connectors over an ordinary integration. These primitives emit the resource metadata that code generation, shared connections, bindings and the native admission owner all consume.