Skip to content

js-bao-wss-client


js-bao-wss-client / YjsPersistenceContext

Interface: YjsPersistenceContext ​

Context passed to the Yjs persistence factory.

documentId, documentFormat and epoch describe what the store the factory is being asked for holds. All three are optional, so a context literal a caller declared for itself before they existed still satisfies this type.

Properties ​

appId ​

appId: string

The application ID


documentFormat? ​

optional documentFormat?: 1 | 2

2 for a large document, 1 for an ordinary one.

Absent when nothing local knows the format yet — the very first open of a document created elsewhere, whose format the client settles from the document read that open already makes. It is never guessed: a factory that branches on this is not told a large document is an ordinary one. The store name is the plain document id in that case either way, because a document this client has never held has no epoch to scope it to.


documentId? ​

optional documentId?: string

The document the store belongs to — the plain id, without the epoch suffix the store name may carry. Use this to key anything that is about the DOCUMENT rather than about one of its stores.


epoch? ​

optional epoch?: number | null

The epoch the store name is scoped to, or null when the name is the plain document id — an ordinary document, or a large one that has not rotated yet.


userId ​

userId: string

The current user's ID (or "anon" if not authenticated)

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