@abraca/dabra 1.3.2 → 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.
|
@@ -3037,6 +3037,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
|
|
|
3037
3037
|
if (origin === this) return;
|
|
3038
3038
|
if (this.offlineStore !== null && origin === this.offlineStore) return;
|
|
3039
3039
|
this.offlineStore?.persistUpdate(update).catch(() => null);
|
|
3040
|
+
if (!this.canWrite) return;
|
|
3040
3041
|
super.documentUpdateHandler(update, origin);
|
|
3041
3042
|
}
|
|
3042
3043
|
/**
|
|
@@ -3050,6 +3051,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
|
|
|
3050
3051
|
* errors across async await boundaries.
|
|
3051
3052
|
*/
|
|
3052
3053
|
async flushPendingUpdates() {
|
|
3054
|
+
if (!this.canWrite) return;
|
|
3053
3055
|
const store = this.offlineStore;
|
|
3054
3056
|
if (!store) return;
|
|
3055
3057
|
const updates = await store.getPendingUpdates();
|
|
@@ -10828,6 +10830,19 @@ var E2EAbracadabraProvider = class E2EAbracadabraProvider extends AbracadabraPro
|
|
|
10828
10830
|
//#endregion
|
|
10829
10831
|
//#region packages/provider/src/TreeTimestamps.ts
|
|
10830
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
|
+
/**
|
|
10831
10846
|
* Attach an observer that writes `updatedAt: Date.now()` to the root
|
|
10832
10847
|
* doc-tree entry for `childDocId` whenever the child doc receives a
|
|
10833
10848
|
* non-offline update.
|
|
@@ -10843,8 +10858,9 @@ var E2EAbracadabraProvider = class E2EAbracadabraProvider extends AbracadabraPro
|
|
|
10843
10858
|
function attachUpdatedAtObserver(treeMap, childDocId, childDoc, offlineStore) {
|
|
10844
10859
|
function handler(update, origin) {
|
|
10845
10860
|
if (offlineStore !== null && origin === offlineStore) return;
|
|
10846
|
-
const
|
|
10847
|
-
if (!
|
|
10861
|
+
const raw = treeMap.get(childDocId);
|
|
10862
|
+
if (!raw) return;
|
|
10863
|
+
const entry = raw instanceof Y.Map ? raw.toJSON() : raw;
|
|
10848
10864
|
treeMap.set(childDocId, {
|
|
10849
10865
|
...entry,
|
|
10850
10866
|
updatedAt: Date.now()
|