automerge / automerge-go

MIT License
97 stars 6 forks source link

Export the LoadSyncMessage function #31

Closed astromechza closed 1 month ago

astromechza commented 1 month ago

TL;DR: this change makes an existing loadSyncMessage function public by capitalising it.

I'd like to have access to the LoadSyncMessage function so that I can inspect a received message before merging it into the document. This would allow me to do things like:

  1. Accept only empty sync messages and reject those with changes
  2. Inspecting the actor id and message of a change within the sync message and rejecting or verifying based on the information

Right now I can only achieve this by accepting the change, checking it, and then forking the document based on the previous heads in order to "rollback" which is obviously more expensive than I'd like.

Thanks!

astromechza commented 1 month ago

cc @ConradIrwin

astromechza commented 1 month ago

Build failed on 1 runner due to a panic in the static linter 🤣 https://github.com/automerge/automerge-go/actions/runs/11534888217/job/32194058725?pr=31