Skip to content

js-bao-wss-client


js-bao-wss-client / DocumentContext

Interface: DocumentContext ​

Scoped API for operating on a single document without repeating the document ID.

Methods ​

blobs() ​

blobs(): DocumentBlobContext

Get the blob API context for this document.

Returns ​

DocumentBlobContext


clearLinkAccess() ​

clearLinkAccess(): Promise<LinkAccessResult>

Turn off "anyone with the link" access for this document.

Returns ​

Promise<LinkAccessResult>


delete() ​

delete(options?): Promise<void>

Delete this document from the server and evict its local data.

Parameters ​

options? ​

DeleteDocumentOptions

Options for document deletion

Returns ​

Promise<void>


get() ​

get(): Promise<DocumentInfo<unknown>>

Fetch this document's metadata from the server.

Returns ​

Promise<DocumentInfo<unknown>>


getLinkAccess() ​

getLinkAccess(): Promise<LinkAccessResult>

Read the current "anyone with the link" access state for this document.

Returns ​

Promise<LinkAccessResult>


getLocalMetadata() ​

getLocalMetadata(): Promise<LocalMetadataEntry | null>

Get locally cached metadata for this document.

Returns ​

Promise<LocalMetadataEntry | null>


getPermissions() ​

getPermissions(): Promise<DocumentPermissionEntry[]>

Get the list of user permissions for this document.

Returns ​

Promise<DocumentPermissionEntry[]>


getUploadConcurrency() ​

getUploadConcurrency(): number

Get the current maximum number of concurrent blob uploads.

Returns ​

number


grantGroupPermission() ​

grantGroupPermission(params): Promise<DocumentGroupPermissionEntry>

Grant a group permission on this document.

Parameters ​

params ​

GrantGroupPermissionParams

The group permission to grant

Returns ​

Promise<DocumentGroupPermissionEntry>


isReadOnly() ​

isReadOnly(): boolean

Check whether this document is read-only for the current user.

Returns ​

boolean


isRoot() ​

isRoot(): boolean

Check whether this document is the app's root document.

Returns ​

boolean


listGroupPermissions() ​

listGroupPermissions(options?): Promise<DocumentGroupPermissionEntry[]>

List all group-based permissions for this document.

By default, platform-managed internal groups (groupType prefixed with _) are excluded. Pass { includeSystem: true } to include them.

Parameters ​

options? ​
includeSystem? ​

boolean

Returns ​

Promise<DocumentGroupPermissionEntry[]>


pauseAllUploads() ​

pauseAllUploads(): void

Pause all blob uploads for this document.

Returns ​

void


pauseUpload() ​

pauseUpload(blobId): boolean

Pause a specific blob upload for this document.

Parameters ​

blobId ​

string

The identifier of the blob upload to pause

Returns ​

boolean


resumeAllUploads() ​

resumeAllUploads(): void

Resume all paused blob uploads for this document.

Returns ​

void


resumeUpload() ​

resumeUpload(blobId): boolean

Resume a specific paused blob upload for this document.

Parameters ​

blobId ​

string

The identifier of the paused blob upload to resume

Returns ​

boolean


revokeGroupPermission() ​

revokeGroupPermission(groupType, groupId): Promise<{ success: boolean; }>

Revoke a group's permission on this document.

Parameters ​

groupType ​

string

The type of group whose permission to revoke

groupId ​

string

The identifier of the group whose permission to revoke

Returns ​

Promise<{ success: boolean; }>


setLinkAccess() ​

setLinkAccess(level): Promise<LinkAccessResult>

Turn on "anyone with the link" access for this document.

Parameters ​

level ​

"read-write" | "reader"

The shared level: "reader" or "read-write".

Returns ​

Promise<LinkAccessResult>


setUploadConcurrency() ​

setUploadConcurrency(concurrency): void

Set the maximum number of concurrent blob uploads.

Parameters ​

concurrency ​

number

The maximum number of blob uploads that can run simultaneously

Returns ​

void


transferOwnership() ​

transferOwnership(newOwnerId): Promise<void>

Transfer ownership of this document to another user.

Parameters ​

newOwnerId ​

string

The user ID of the new owner

Returns ​

Promise<void>


update() ​

update(data): Promise<DocumentInfo<unknown>>

Update this document's metadata such as its title.

Parameters ​

data ​

UpdateDocumentData

The document metadata fields to update

Returns ​

Promise<DocumentInfo<unknown>>


uploads() ​

uploads(): BlobUploadStatus[]

List active blob uploads for this document.

Returns ​

BlobUploadStatus[]

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