[]
Defines the interface for a database adapter in operational transformation.
Name | Type | Description |
---|---|---|
S |
unknown |
The type of snapshot data. |
T |
unknown |
The type of operation data. |
▸ close(): Promise
<void
>
Closes the database connection.
Promise
<void
>
A promise that resolves when the database is closed.
▸ commitOp(id
, op
, document
, options?
): Promise
<boolean
>
Commits an operation to the database.
Name | Type | Description |
---|---|---|
id |
string |
The document ID. |
op |
IOp <T > |
The operation to commit. |
document |
IDocument |
The document metadata. |
options? |
unknown |
- |
Promise
<boolean
>
A promise resolving to true if the operation was committed, false otherwise.
▸ commitSnapshot(id
, snapshot
, options?
): Promise
<boolean
>
Commits a snapshot to the database.
Name | Type | Description |
---|---|---|
id |
string |
The document ID. |
snapshot |
ICommitSnapshot <S > |
The snapshot to commit. |
options? |
unknown |
- |
Promise
<boolean
>
A promise resolving to true if the snapshot was committed, false otherwise.
▸ getCommittedOpVersion(id
, to
, op
): Promise
<undefined
| number
>
Retrieves the committed version of an operation, if it exists.
Name | Type | Description |
---|---|---|
id |
string |
The document ID. |
to |
number |
The ending version to check up to. |
op |
IOp <unknown > |
The operation to verify. |
Promise
<undefined
| number
>
A promise resolving to the committed version or undefined if not committed.
▸ getDocument(id
, options?
): Promise
<undefined
| null
| IDocument
>
Retrieves document information by ID.
Name | Type | Description |
---|---|---|
id |
string |
The document ID. |
options? |
unknown |
- |
Promise
<undefined
| null
| IDocument
>
A promise resolving to the document info or undefined/null if not found.
▸ getFragment(id
, fragmentId
, options?
): Promise
<undefined
| null
| S
>
Retrieves a specific fragment of a document by ID.
Name | Type | Description |
---|---|---|
id |
string |
The document ID. |
fragmentId |
string |
The ID of the fragment. |
options? |
unknown |
- |
Promise
<undefined
| null
| S
>
A promise resolving to the fragment data or undefined/null if not found.
▸ getFragments(id
, fragmentIds?
, options?
): Promise
<{ [id: string]
: S
; }>
Retrieves multiple fragments of a document by ID.
Name | Type | Description |
---|---|---|
id |
string |
The document ID. |
fragmentIds? |
string [] |
- |
options? |
unknown |
- |
Promise
<{ [id: string]
: S
; }>
} A promise resolving to an object mapping fragment IDs to their data.
▸ getOps(id
, from
, to?
, options?
): Promise
<IOp
<T
>[]>
Retrieves operations between two versions (inclusive of 'from', exclusive of 'to').
Name | Type | Description |
---|---|---|
id |
string |
The document ID. |
from |
number |
The starting version. |
to? |
number |
- |
options? |
unknown |
- |
Promise
<IOp
<T
>[]>
A promise resolving to an array of operations.
▸ getSnapshot(id
, options?
): Promise
<undefined
| null
| ISnapshot
<S
>>
Retrieves the snapshot of a document by ID.
Name | Type | Description |
---|---|---|
id |
string |
The document ID. |
options? |
unknown |
- |
Promise
<undefined
| null
| ISnapshot
<S
>>
A promise resolving to the snapshot or undefined/null if not found.