Skip to content

API reference / @docmentis/udoc-server / DocumentStore

Interface: DocumentStore ​

Where the server keeps each document, by id.

Methods ​

put() ​

ts
put(id, document): Promise<void>;

Keep a new document as id. Refused when id is already kept.

Parameters ​

ParameterType
idstring
documentKeptDocument

getOriginal() ​

ts
getOriginal(id): Promise<Original | undefined>;

Document id's original, or undefined when nothing is kept.

Parameters ​

ParameterType
idstring

getCheckpoint() ​

ts
getCheckpoint(id): Promise<Uint8Array<ArrayBufferLike> | undefined>;

Document id's latest checkpoint, or undefined when nothing is kept.

Parameters ​

ParameterType
idstring

putCheckpoint() ​

ts
putCheckpoint(
   id, 
   version, 
   checkpoint
): Promise<void>;

Keep checkpoint, the udoc package of document id's checkpoint version, beside the earlier ones, as its latest; then forget each opaque part and blob kept beside them that it holds. Refused when no checkpoint is kept as id, or version is kept already.

Parameters ​

ParameterType
idstring
versionnumber
checkpointUint8Array

getDescription() ​

ts
getDescription(id): Promise<PackageDescription | undefined>;

Document id's package description, from its latest checkpoint, or undefined when it has none.

Parameters ​

ParameterType
idstring

getPart() ​

ts
getPart(
   id, 
   kinds, 
   partId
): Promise<Uint8Array<ArrayBufferLike> | undefined>;

One part of document id, as its JSON deflated — raw DEFLATE (RFC 1951) — by its route: kinds, its kind in kebab-case and plural, and partId, its id's key. Its latest checkpoint's, or an opaque part an edit brought, kept beside the checkpoints, or, held by neither, the newest earlier checkpoint's. undefined when there is no such part, or no checkpoint.

Parameters ​

ParameterType
idstring
kindsstring
partIdstring

getBlob() ​

ts
getBlob(id, key): Promise<Uint8Array<ArrayBufferLike> | undefined>;

One blob of document id, deflated, by its key — found as a part is — or undefined when it has none.

Parameters ​

ParameterType
idstring
keystring

putOpaqueParts() ​

ts
putOpaqueParts(id, parts): Promise<void>;

Keep every part and blob of parts — a client's opaque parts, a zip in a package's own layout — beside document id's checkpoints, by route. What is kept already stays as it was. Refused when nothing is kept as id.

Parameters ​

ParameterType
idstring
partsUint8Array

getLog() ​

ts
getLog(id): Promise<Uint8Array<ArrayBufferLike> | undefined>;

Document id's edit log, or undefined when it has none: the one kept, or, for a document checkpointed before any edit was kept, its latest checkpoint's own.

Parameters ​

ParameterType
idstring

putLog() ​

ts
putLog(id, log): Promise<void>;

Keep log as document id's edit log, in place of the one kept — whole or not at all. Refused when nothing is kept as id.

Parameters ​

ParameterType
idstring
logUint8Array

delete() ​

ts
delete(id): Promise<boolean>;

Forget document id; answers whether anything was kept.

Parameters ​

ParameterType
idstring