bijection integration commands, or from the Sources page
of the console.
1
Deploy the integration and schema
Push the integration definition and the schema that binds its collections,
for example with
bijection dev. Synced tables exist from this point on,
empty.2
Store the credential
Create a private credential from a file or from piped stdin:
3
Configure the connection
Name the connection, point it at the integration’s address and the
provider’s base URL, and reference the credential:
4
Verify the account
Admit an identity check under a request ID of your choice, then run it:
5
Install the source
Install the synced table’s source on the verified connection:The command prints the new source’s ID. From now on the collection is read
on its
sync.every schedule and the customers table fills in.Store the credential
credential-create reads the value from --from-file or from piped stdin,
never from an argument, and never prints it. The value must be valid UTF-8 and
at most 8 KiB, and every byte is kept, including a trailing newline. Use
credential-rotate with the same name to replace it later, and
credential-status to inspect its metadata.
For an HTTP integration, the credential is a JSON envelope that names its kind
and the origins it may be sent to:
crm-credential.json
allowed_resource_origins lists one to eight origins, and one of them must be
the origin of the connection’s base URL. The credential is never sent anywhere
else. A bare secret is refused with IntegrationCredentialEnvelope.
Every kind also takes
allowed_resource_origins.
PostgreSQL and mail
integrations use their own private configuration instead of an envelope.
Configure the connection
configure creates or updates a named connection. The name, crm above, is
how the other commands refer to it.
--moduleand--exportname the integration’s address: the module path insidebijection/, with.js, and the export name.--base-urlis the provider’s API address. It must usehttps(plainhttponly for a loopback address) and carry no query, fragment or user info. The contracts’ routes are appended to it. Omit it for PostgreSQL and mail integrations.--credential-refnames the credential.--componentselects a component; the default is the root.--setup key=valuesupplies a setup field the definition declares.--show-setuplists them without changing anything.
Verify the account
identify admits a run of the definition’s
identify handler,
and run executes it. The provider account it reads becomes the connection’s
verified identity, and later syncs are checked against it.
The request ID is yours to choose and identifies the work. If a command’s
response is lost, run it again with the same ID to recover the same request
instead of starting another. bijection integration status <request-id> shows
where a request stands.
Install sources
install <connection> <table> installs the source that fills one synced table
from a verified connection. It prints the source ID, the same value synced
documents carry in source_id. Install each synced table of the integration
you want to fill.
bijection integration sources lists the installed sources with their
connection and sync health.
Following syncs
bijection integration source-status <source> shows a source’s schedule, its
state and any work it retains. The console’s Sources page shows the same
information for every source, grouped by connection.
A source is in one of these states:
- Scheduled: it syncs on its interval.
- Retrying: a sync failed in a way that can succeed later, and a retry is scheduled.
- Blocked: a sync can’t continue without you. Published data stays readable.
Sync history
Each source keeps its open sync and its newest 50 finished syncs. For each run you see when it started, what started it (the schedule, a manual request, a provider notification, reconciliation or a repair), its state, and what it admitted: pages, requests, response bytes and records received. Records received count what the run admitted, not the rows that changed in the table: a sync that found nothing new completes with records received and nothing published. The history appears under each source in the console, and in thesyncs
field of source-status.
Sync now
To sync a source before its next scheduled run:Test connection
Test connection on a source in the console runs the connection’sidentify handler again and compares the answer with the verified account,
without changing the connection. The result is one of:
- Confirmed: the connection answers as the account it was verified as.
- Identity differs: the connection now answers as a different account. Syncs keep their verified connection; reconfigure or verify it again.
- Unverified: the connection answered, but was never verified.
- Failed, with the reason.
From your application
An application built withapplicationQueries from bijection/server also
exposes three functions for its synced collections, for signed-in users only:
sourceSyncs({ collection, source? })lists the collection’s sources, each with its handle (thesource_idits rows carry), status, open and latest sync and connection check. Name asourceto also get its history, newest first, at most 50 syncs. Counts and times are exactbigints. A user who may not read the collection’s rows is refused.requestSourceSync({ collection, source })is Sync now. It answersaccepted, orcoalescedwhen a sync was already requested. It is refused for a source whose connection was reconfigured since it was installed; install it again first.requestConnectionCheck({ collection, source })records a check for the calling user and answers itsrequestID. The user then runs it withrunConnectionCheckfrombijection/appsand their own token. If the response is lost, running the same ID again finishes the check or returns its result.
sourceControl. It runs after your authorize function, and
only true allows the request. The user also needs read access to the
source’s rows.
bijection/application.ts
When a sync stops
When a source is blocked,source-status reports the reason and the ID of the
retained work. After fixing the cause, resume exactly that work:
install again for the
same connection and table to update its binding, then resume it. The
console does both with Update binding and resume.
Connected accounts
A connection configured withconfigure uses one deployment credential. An
integration can instead be connected by an application user with their own
provider account, through the provider’s authorization flow. The
account-* commands and the connected accounts panel on the Sources page drive
this flow:
account-authorizestarts an authorization for an application user and returns the provider URL to visit.account-callbackcompletes it with the code the provider returns.account-resourceslists what the account offers to read, andaccount-selectinstalls the chosen resources.
Disconnecting is final for that authorization: reconnecting starts a new one.
Erasing requires a disconnected account and removes the records its sources
published, but not effects already delivered to the provider. See the
CLI reference for every option.