@abraca/dabra 2.30.0 → 2.32.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.
@@ -3282,6 +3282,19 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
3282
3282
  return this.childProviders.has(childId);
3283
3283
  }
3284
3284
  /**
3285
+ * Whether a loaded child is currently transient — loaded with
3286
+ * `{ evictable: false }` (e.g. by a background indexer/sync) and not since
3287
+ * promoted to a normal UI-held child. A later `loadChild(id)` with the
3288
+ * default `evictable: true` clears this flag.
3289
+ *
3290
+ * Background loaders use this to decide whether they still own a child
3291
+ * before unloading it: if the UI opened the same doc mid-sync, the child is
3292
+ * no longer transient and must NOT be destroyed out from under the view.
3293
+ */
3294
+ isChildTransient(childId) {
3295
+ return this.transientChildren.has(childId);
3296
+ }
3297
+ /**
3285
3298
  * Create (or return cached) a child AbracadabraProvider for a given
3286
3299
  * child document id. Each child shares the parent's WebSocket via
3287
3300
  * multiplexing.
@@ -16484,7 +16497,7 @@ var BackgroundSyncManager = class extends EventEmitter {
16484
16497
  isE2E: false
16485
16498
  };
16486
16499
  }
16487
- const childProvider = await this.rootProvider.loadChild(docId);
16500
+ const childProvider = await this.rootProvider.loadChild(docId, { evictable: false });
16488
16501
  try {
16489
16502
  await childProvider.ready;
16490
16503
  await this._waitForSynced(childProvider);
@@ -16508,7 +16521,9 @@ var BackgroundSyncManager = class extends EventEmitter {
16508
16521
  isE2E: false
16509
16522
  };
16510
16523
  } finally {
16511
- if (!alreadyCached) this.rootProvider.unloadChild(docId);
16524
+ if (!alreadyCached) {
16525
+ if (typeof this.rootProvider.isChildTransient === "function" ? this.rootProvider.isChildTransient(docId) : true) this.rootProvider.unloadChild(docId);
16526
+ }
16512
16527
  }
16513
16528
  }
16514
16529
  async _syncE2EDoc(docId) {
@@ -17380,6 +17395,7 @@ var DeviceRegistrationService = class {
17380
17395
  return;
17381
17396
  }
17382
17397
  const devicesMap = identityDoc.devicesMap;
17398
+ const pendingRevocations = [];
17383
17399
  devicesMap.forEach((yEntry, devicePub) => {
17384
17400
  const serverEntry = yEntry.get("servers")?.get(serverUrl);
17385
17401
  const serverKey = serverKeys.find((k) => k.publicKey === devicePub);
@@ -17398,11 +17414,16 @@ var DeviceRegistrationService = class {
17398
17414
  lastVerifiedAt: Date.now(),
17399
17415
  keyId: serverKey.id
17400
17416
  });
17401
- if (revokedAt && isMaster) client.revokeKey(serverKey.id).then(() => {
17402
- identityDoc.setDeviceServerStatus(devicePub, serverUrl, { registered: false });
17403
- }).catch(() => {});
17417
+ if (revokedAt && isMaster) pendingRevocations.push({
17418
+ devicePub,
17419
+ keyId: serverKey.id
17420
+ });
17404
17421
  }
17405
17422
  });
17423
+ for (const { devicePub, keyId } of pendingRevocations) try {
17424
+ await client.revokeKey(keyId);
17425
+ identityDoc.setDeviceServerStatus(devicePub, serverUrl, { registered: false });
17426
+ } catch {}
17406
17427
  for (const key of serverKeys) {
17407
17428
  if (key.revoked) continue;
17408
17429
  if (!devicesMap.has(key.publicKey)) identityDoc.addDevice(key.publicKey, {