These examples describe the current Bijection CLI and SDK source. Use builds
from the same source commit for these APIs. The public CLI and npm SDK
are published independently and may lag this reference.
@bijectionhq/library-documents, keeps
collaboratively authored documents for the app that places it: notes and
templates, their collaborative text and history, comments, locked embeds,
published templates, and the reports rendered from them. documents({...})
returns a subtree. Place it in the app tree and its tables and functions
take their paths there: docs.documents.create, docs.tables.reports.
app.ts
A client reaches the functions as
api<typeof App>().docs.<group>.<function>.
Every function refuses with the codes in DOCUMENTS_REFUSES
(Unavailable, NotAuthor, InvalidRequest, InvalidInput,
StateConflict, BoundExceeded, HistoryUnavailable, NotSignedIn).
A call whose version moved since it was read refuses the host code
Conflict.
Arguments that may be absent are null. Listings take { size, cursor }
and answer { facts, next }, so usePages reads them.
The model
- Spaces. Documents are grouped under a
spacekey the app chooses, such as a project or a notebook. Listings and bounds are per space, up to 10,000 documents. - Text. A ProseMirror document in a closed node set, with Tiptap names.
Editors submit steps at a version (
text.submitSteps); a client behind the newest version is told to rebase. Snapshots (text.submitSnapshot) and server edits (text.append) are checked against the node set and its 900 KiB bound. The library keeps the latest 100 autosave revisions and every named one. - Private documents answer their author only, and only the author shares or removes them.
- Comments are anchored to a selection and follow later edits, or become orphaned when the range is replaced. Replies are one level deep.
- Locked embeds. Your own function reads what an embed shows and calls
docs.helpers.lockEmbed(ctx, { space, doc, embed, payload })in the same transaction, so a report captures the locked value, not a live one. - Templates publish immutable versions with typed inputs
(
templates.publish).docs.helpers.instantiate(ctx, { space, source, inputs, resolved })creates a document from one.
Your own functions use the in-transaction helpers under
docs.helpers:
createDocument, lockEmbed, instantiate, generate, release,
current and transform.
Collaborative editing
@bijectionhq/library-documents/sync binds a Tiptap editor to the text
functions over the client:
Reports
A report renders a document’s current text, or a report your app composed, into PDF, DOCX, PPTX, CSV or image files. Rendering runs on a renderer you host, so Bijection runs no rendering capacity. See generate your first document and generate, continue and release reports.Document databases
To mirror collections from MongoDB, DynamoDB, Cosmos DB, Elasticsearch and other document stores into your app, mount the document source app,@bijectionhq/app-documents: documents({ data, provider }) with a
receiver bound by one of its binders. See the
MongoDB and
DynamoDB guides.