A type alias for a store change.
A base type for describing the location of data in a datastore, to be consumed by some object. The only requirement is that it has a datastore object. Objects extending from this will, in general, have some combination of table, record, and field locations.
An interface for referring to a specific field in a datastore.
The field must exist in the schema.
A type alias for a store patch.
An interface for referring to a specific record in a datastore.
An interface for referring to a specific table in a datastore.
An object representing a datastore transaction.
A factory function for generating a unique transaction id.
A type alias for kinds of transactions.
Create a new datastore.
The tables of the datastore.
The handler for broadcasting transactions to peers.
A signal emitted when changes are made to the store.
This signal is emitted either at the end of a local mutation, or after a remote mutation has been applied. The storeId can be used to determine its source.
The payload represents the set of local changes that were made to bring the store to its current state.
O(1)
The unique id of the store.
The id is unique among all other collaborating peers.
O(1)
Whether the datastore has been disposed.
The current version of the datastore.
This version is automatically increased for each transaction to the store. However, it might not increase linearly (i.e. it might make jumps).
O(1)
Finalize the context state for a transaction in progress.
Reset the context state for a new transaction.
The id of the new transaction.
The version of the datastore after the transaction.
Handle a redo from the server adapter.
Handle a transaction from the server adapter.
Handle an undo from the server adapter.
Process all transactions currently queued.
Apply a transaction to the datastore.
Queue a transaction for later application.
the transaction to queue.
Begin a new transaction in the store.
The id of the new transaction
Dispose of the resources held by the datastore.
Completes a transaction.
This completes a transaction previously started with
beginTransaction
. If a change has occurred, the
changed
signal will be emitted.
Handle a message.
Redo a patch that was previously undone.
The transaction to redo.
A promise which resolves when the action is complete.
Serialize the state of the datastore to a string.
The serialized state.
Undo a patch that was previously applied.
The transaction to undo.
A promise which resolves when the action is complete.
Get a given field by its location.
the field in question.
This will throw an error if the record does not exist in the given table.
Get a given record by its location.
the record, or undefined if it does not exist.
Get a given table by its location.
the table.
Listen to changes in a fields in a table. Changes to other tables, other records in the same table, and other fields in the same record are ignored.
an IDisposable
that can be disposed to remove the listener.
Listen to changes in a record in a table. Changes to other tables and other records in the same table are ignored.
an IDisposable
that can be disposed to remove the listener.
Listen to changes in a table. Changes to other tables are ignored.
an IDisposable
that can be disposed to remove the listener.
Update a field in a table.
Update a record in a table.
Update a table.
A helper function to wrap an update to the datastore in calls to
beginTransaction
and endTransaction
.
the transaction ID.
If the datastore is already in a transaction, this does not attempt to start a new one, and returns an empty string for the transaction id. This allows for transactions to be composed a bit more easily.
Generated using TypeDoc
A multi-user collaborative datastore. The namespace for the
Datastore
class statics.Notes
A store is structured in a maximally flat way using a hierarchy of tables, records, and fields. Internally, the object graph is synchronized among all users via CRDT algorithms.
https://en.wikipedia.org/wiki/Conflict-free_replicated_data_type https://hal.inria.fr/file/index/docid/555588/filename/techreport.pdf