Skip to content

envelopeToChange

envelopeToChange(target, envelope): ChangeLike

Defined in: packages/client/src/circuits/envelope-to-change.ts:178

Translate a Circuits envelope into the message the applier consumes.

There is no operation mapping to do — SyncOperation is the wire’s own vocabulary. What this function carries is the one structural difference: a delete has no row body, only its key, so the pk columns are reconstructed here. That is a privacy improvement (an eviction discloses the key and nothing else) and an implementation hazard in the same change, which is why the reconstruction is a named, tested function rather than an inline split.

An upsert carries the complete projected row every time — the engine’s row_to_json_cols emits every column of the shape’s out_cols, never a changed-column subset — which is what lets the apply path refresh every non-pk column from excluded without knowing whether the row already existed locally.

ApplyTarget

StreamEnvelope

ChangeLike