Skip to content

basalt / files-versions/src / MemoryFileVersionStore

Class: MemoryFileVersionStore ​

Defined in: files-versions/src/store.ts:54

Where the revision history lives.

Every method is scoped by tenant, and that is not decoration. The obvious signature — history(groupId) — reads one firm's document history from another firm's session the moment a group id leaks into a URL. A group id is exactly the kind of value that ends up in a URL.

Implements ​

Constructors ​

Constructor ​

> new MemoryFileVersionStore(): MemoryFileVersionStore

Returns ​

MemoryFileVersionStore

Methods ​

append() ​

> append(tenantId, groupId, fileId, meta?): Promise<FileVersion>

Defined in: files-versions/src/store.ts:61

Records a new revision and returns it with the version number it was given.

The number is the store's to assign: a caller that reads the latest and adds one has a race, and two uploads landing together would both claim the same revision — of a contract, in a business where which draft you are reading is the whole question.

Parameters ​

tenantId ​

string

groupId ​

string

fileId ​

string

meta? ​
by? ​

string

note? ​

string

Returns ​

Promise<FileVersion>

Implementation of ​

FileVersionStore.append


at() ​

> at(tenantId, groupId, version): Promise<FileVersion | null>

Defined in: files-versions/src/store.ts:91

One revision by number, or null.

Parameters ​

tenantId ​

string

groupId ​

string

version ​

number

Returns ​

Promise<FileVersion | null>

Implementation of ​

FileVersionStore.at


history() ​

> history(tenantId, groupId): Promise<FileVersion[]>

Defined in: files-versions/src/store.ts:87

Every revision, newest first.

Parameters ​

tenantId ​

string

groupId ​

string

Returns ​

Promise<FileVersion[]>

Implementation of ​

FileVersionStore.history


latest() ​

> latest(tenantId, groupId): Promise<FileVersion | null>

Defined in: files-versions/src/store.ts:81

The current revision, or null for a group that has none.

Parameters ​

tenantId ​

string

groupId ​

string

Returns ​

Promise<FileVersion | null>

Implementation of ​

FileVersionStore.latest

Released under the MIT License.