Skip to content

js-bao-wss-client


js-bao-wss-client / CreateDocumentOptions

Interface: CreateDocumentOptions ​

Options for creating a new document.

Properties ​

documentFormat? ​

optional documentFormat?: 1 | 2

Create a LARGE document (2) instead of an ordinary one.

A large document keeps its records in a persisted table on both ends and carries only the current epoch's changes in its document, so it scales far past an ordinary document's ~10 MB — at the cost of needing a local store that outlives the session (Node has one; a browser needs databaseConfig: { type: "opfs", ... }). The choice is made here and is never migrated.

Omitted — the default — sends nothing, so an ordinary create's request is exactly what it was before this option existed. 1 is the ordinary format, named explicitly. Any other value, including the string "2", is refused with INVALID_ARGUMENT before anything is created, and 2 with localOnly: true is refused with LOCAL_ONLY_UNSUPPORTED_OPTION.


localOnly? ​

optional localOnly?: boolean

If true, the document is created and stays entirely on-device: it is never sent to the server, in the creating session or any later one, and no commit ever applies to it. Open it with documents.open(id, { waitForLoad: "local", enableNetworkSync: false }); opening it with waitForLoad: "network" or enableNetworkSync: true (the default) throws LOCAL_ONLY_UNSUPPORTED_OPTION.


metadata? ​

optional metadata?: unknown

Opaque JSON-serializable metadata blob to attach at creation time (≤ 4 KB serialized UTF-8). Note: thumbnailBlobId cannot be set on create — create the document first, upload the blob (which will reference the doc), then call documents.update with thumbnailBlobId.


tags? ​

optional tags?: string[]

Tags to attach to the document at creation time.


title? ​

optional title?: string

The display title for the new document.

Documentation validated against js-bao-wss-client 3.4.0 · js-bao 0.11.0 · primitive-admin 1.0.62 · primitive-app 3.1.0 — 2026-09-30