Create a new DocumentManager.
Private
clientWraps a fetch request with authorization and error handling.
Creates a new document on the y-sweet server given an optional docId. If a document with given ID already exists, this is a no-op.
Optional
docId: stringThe ID of the document to be created. If not provided, a random ID will be generated.
A DocCreationResult object containing the ID of the created document.
Creates a new document with initial content.
A Yjs update byte string representing the initial content.
A DocCreationResult object containing the ID of the created document.
Get a client token for the given document.
If you are using authorization, this is expected to be called from your server after a user has authenticated. The returned token should then be passed to the client.
The ID of the document to get a token for.
Optional
authDocRequest: AuthDocRequestAn optional AuthDocRequest providing options for the token request.
A ClientToken object containing the URL and token needed to connect to the document.
Optional
authDocRequest: AuthDocRequestA convenience wrapper around DocumentManager.createDoc and DocumentManager.getClientToken for getting a client token for a document. If a docId is provided, ensures that a document exists with that ID or that one is created. If no docId is provided, a new document is created with a random ID.
Optional
docId: stringThe ID of the document to get or create. If not provided, a new document with a random ID will be created.
Optional
authDocRequest: AuthDocRequestAn optional AuthDocRequest providing options for the token request.
A ClientToken object containing the URL and token needed to connect to the document.
Represents an interface to a y-sweet document management endpoint.