@mmstack/mesh 22.10.1 → 22.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -98,6 +98,22 @@ The default is last-writer-wins on a leaf, which drops one side of a true clash
98
98
  For a field where losing a write matters, set `preserve` on its path and resolve the `Conflicted`
99
99
  value in the UI.
100
100
 
101
+ A new container is a different case: by default an added record ships as one whole `set`, so two
102
+ clients that create the same missing container at once (say the first two suppressions under a
103
+ missing `lint`) race, and only one survives. Pass `emit: { added }` to choose per path. Use
104
+ `'leaves'` for a collection (an empty anchor plus its entries, so concurrent first writers merge)
105
+ and `'whole'` for an entry that must arrive as one atomic `set`:
106
+
107
+ ```ts
108
+ const leafy = new Set(['lint', 'lint.rules', 'lint.suppress']);
109
+ meshSync(doc, {
110
+ room,
111
+ writer,
112
+ transport,
113
+ emit: { added: (path) => (leafy.has(path.join('.')) ? 'leaves' : 'whole') },
114
+ });
115
+ ```
116
+
101
117
  ## Interop with other CRDTs
102
118
 
103
119
  A merge policy is a plain function, so one path can hold another CRDT and merge through that
@@ -505,6 +521,8 @@ fresh: pointer positions, viewports. Each peer publishes one value; every other
505
521
  latest one per sender. Frames go peer to peer over a lossy, unordered data channel, because a
506
522
  pointer that waits for a retransmit is already stale. Nothing is persisted and nothing is caught
507
523
  up: a peer that connects sees a sender's value when that sender next moves.
524
+ Nothing is minted while no link carries the channel: a sender alone costs no frames, no numbers
525
+ and no timers.
508
526
 
509
527
  It rides on `peerLinks`, the link layer `webRtcMesh` is built on: one peer connection per remote,
510
528
  set up from the relay's membership and negotiated over its `signal` frames, carrying the labelled