@abraca/dabra 1.3.3 → 1.3.4
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.
|
@@ -10830,6 +10830,19 @@ var E2EAbracadabraProvider = class E2EAbracadabraProvider extends AbracadabraPro
|
|
|
10830
10830
|
//#endregion
|
|
10831
10831
|
//#region packages/provider/src/TreeTimestamps.ts
|
|
10832
10832
|
/**
|
|
10833
|
+
* TreeTimestamps
|
|
10834
|
+
*
|
|
10835
|
+
* Attaches an afterUpdate observer on a child Y.Doc so that whenever a
|
|
10836
|
+
* non-offline update is applied, the `updatedAt` timestamp on the
|
|
10837
|
+
* corresponding entry in the root doc's `doc-tree` map is written.
|
|
10838
|
+
*
|
|
10839
|
+
* This propagates "last edited" timestamps to all peers via the root CRDT,
|
|
10840
|
+
* without requiring any server-side changes.
|
|
10841
|
+
*
|
|
10842
|
+
* Limitation: at least one client must have the child doc open after an edit
|
|
10843
|
+
* for the timestamp to propagate (eventually consistent).
|
|
10844
|
+
*/
|
|
10845
|
+
/**
|
|
10833
10846
|
* Attach an observer that writes `updatedAt: Date.now()` to the root
|
|
10834
10847
|
* doc-tree entry for `childDocId` whenever the child doc receives a
|
|
10835
10848
|
* non-offline update.
|
|
@@ -10845,8 +10858,9 @@ var E2EAbracadabraProvider = class E2EAbracadabraProvider extends AbracadabraPro
|
|
|
10845
10858
|
function attachUpdatedAtObserver(treeMap, childDocId, childDoc, offlineStore) {
|
|
10846
10859
|
function handler(update, origin) {
|
|
10847
10860
|
if (offlineStore !== null && origin === offlineStore) return;
|
|
10848
|
-
const
|
|
10849
|
-
if (!
|
|
10861
|
+
const raw = treeMap.get(childDocId);
|
|
10862
|
+
if (!raw) return;
|
|
10863
|
+
const entry = raw instanceof Y.Map ? raw.toJSON() : raw;
|
|
10850
10864
|
treeMap.set(childDocId, {
|
|
10851
10865
|
...entry,
|
|
10852
10866
|
updatedAt: Date.now()
|