Change ingestor
With the through-the-DB write pattern, we can "standardise" a transactions: [[change, …], […]] payload format for handling locally made changes. The change message can be our existing message format. The transaction wrapper is fairly simple. As per the payload posted and handled by the through-the-DB write pattern. We can image a standard implementation that handles this data structure for you and has hooks for authorising and validating the writes. I think this probably is a module with some functions that can be used easily in a controller. It could also be that we provide a phoenix generator to generate the controller that uses this. Then we probably want it to feel like an Ecto extension somehow. Maybe with some kind of matching pattern of key / Ecto schema → changeset style function. So a user can run the conn through the function and register handlers via pattern matching to authorise by schema. And the handler function gets the full context (the conn, the tx stack, the current tx, all the sibling ops, …) along with the primary change message. We should then document and make an example, e.g.: an alternative Elixir backend for the through the DB write-pattern example might be simplest.
This is implemented asPhoenix.Sync.Writer here: https://github.com/electric-sql/phoenix_sync/pull/14