With the `OpObserver` moving to the transaction rather than being passed
in to the `Transaction::commit` method we have needed to add a way to
get the observer back out of the transaction (via
`Transaction::observer` and `AutoCommit::observer`). This `Observer`
type is then used to handle patch generation logic. However, there are
cases where we might not want an `OpObserver` and in these cases we can
execute various things fast - so we need to have something like an
`Option<OpObserver>`. In order to track the presence or otherwise of the
observer at the type level introduce
`automerge::transaction::observation`, which is a type level `Option`.
This allows us to efficiently choose the right code paths whilst
maintaining correct types for `Transaction::observer` and
`AutoCommit::observer`
For the path to be accurate it needs to be calculated at the moment of op insert
not at commit. This is because the path may contain list indexes in parent
objects that could change by inserts and deletes later in the transaction.
The primary change was adding op_observer to the transaction object and
removing it from commit options. The beginnings of a wasm level
`applyPatch` system is laid out here.
By moving to wasm-bindgens `bundler` target rather than using the `web`
target we remove the need for an async initialization step on the
automerge-wasm package. This means that the automerge-js package can now
depend directly on automerge-wasm and perform initialization itself,
thus making automerge-js a drop in replacement for the `automerge` JS
package (hopefully).
We bump the versions of automerge-wasm
The colunar storage format allows for values which we do not know the
type of. In order that we can handle these types in a forward compatible
way we add ScalarValue::Unknown.
Signed-off-by: Alex Good <alex@memoryandthought.me>
- Commit now returns just a single hash rather than a vec. Since the
change we create from committing has all of the heads as deps there
can only be one hash/head after committing.
- Apply changes now takes a Vec rather than a slice. This avoids having
to clone them inside.
- transact_with now passes the result of the closure to the commit
options function
- Remove patch struct
- Change receive_sync_message to return a () instead of the
`Option<Patch>`
- Change `Transaction*` structs to just `*` and use the transaction
module
- Make CommitOptions fields public