@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.
- package/dist/abracadabra-provider.cjs +26 -5
- package/dist/abracadabra-provider.cjs.map +1 -1
- package/dist/abracadabra-provider.esm.js +26 -5
- package/dist/abracadabra-provider.esm.js.map +1 -1
- package/dist/index.d.ts +30 -1
- package/package.json +2 -2
- package/src/AbracadabraProvider.ts +14 -0
- package/src/BackgroundSyncManager.ts +21 -5
- package/src/DeviceRegistrationService.ts +25 -11
- package/src/types.ts +19 -1
|
@@ -3252,6 +3252,19 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
|
|
|
3252
3252
|
return this.childProviders.has(childId);
|
|
3253
3253
|
}
|
|
3254
3254
|
/**
|
|
3255
|
+
* Whether a loaded child is currently transient — loaded with
|
|
3256
|
+
* `{ evictable: false }` (e.g. by a background indexer/sync) and not since
|
|
3257
|
+
* promoted to a normal UI-held child. A later `loadChild(id)` with the
|
|
3258
|
+
* default `evictable: true` clears this flag.
|
|
3259
|
+
*
|
|
3260
|
+
* Background loaders use this to decide whether they still own a child
|
|
3261
|
+
* before unloading it: if the UI opened the same doc mid-sync, the child is
|
|
3262
|
+
* no longer transient and must NOT be destroyed out from under the view.
|
|
3263
|
+
*/
|
|
3264
|
+
isChildTransient(childId) {
|
|
3265
|
+
return this.transientChildren.has(childId);
|
|
3266
|
+
}
|
|
3267
|
+
/**
|
|
3255
3268
|
* Create (or return cached) a child AbracadabraProvider for a given
|
|
3256
3269
|
* child document id. Each child shares the parent's WebSocket via
|
|
3257
3270
|
* multiplexing.
|
|
@@ -16431,7 +16444,7 @@ var BackgroundSyncManager = class extends EventEmitter {
|
|
|
16431
16444
|
isE2E: false
|
|
16432
16445
|
};
|
|
16433
16446
|
}
|
|
16434
|
-
const childProvider = await this.rootProvider.loadChild(docId);
|
|
16447
|
+
const childProvider = await this.rootProvider.loadChild(docId, { evictable: false });
|
|
16435
16448
|
try {
|
|
16436
16449
|
await childProvider.ready;
|
|
16437
16450
|
await this._waitForSynced(childProvider);
|
|
@@ -16455,7 +16468,9 @@ var BackgroundSyncManager = class extends EventEmitter {
|
|
|
16455
16468
|
isE2E: false
|
|
16456
16469
|
};
|
|
16457
16470
|
} finally {
|
|
16458
|
-
if (!alreadyCached)
|
|
16471
|
+
if (!alreadyCached) {
|
|
16472
|
+
if (typeof this.rootProvider.isChildTransient === "function" ? this.rootProvider.isChildTransient(docId) : true) this.rootProvider.unloadChild(docId);
|
|
16473
|
+
}
|
|
16459
16474
|
}
|
|
16460
16475
|
}
|
|
16461
16476
|
async _syncE2EDoc(docId) {
|
|
@@ -17327,6 +17342,7 @@ var DeviceRegistrationService = class {
|
|
|
17327
17342
|
return;
|
|
17328
17343
|
}
|
|
17329
17344
|
const devicesMap = identityDoc.devicesMap;
|
|
17345
|
+
const pendingRevocations = [];
|
|
17330
17346
|
devicesMap.forEach((yEntry, devicePub) => {
|
|
17331
17347
|
const serverEntry = yEntry.get("servers")?.get(serverUrl);
|
|
17332
17348
|
const serverKey = serverKeys.find((k) => k.publicKey === devicePub);
|
|
@@ -17345,11 +17361,16 @@ var DeviceRegistrationService = class {
|
|
|
17345
17361
|
lastVerifiedAt: Date.now(),
|
|
17346
17362
|
keyId: serverKey.id
|
|
17347
17363
|
});
|
|
17348
|
-
if (revokedAt && isMaster)
|
|
17349
|
-
|
|
17350
|
-
|
|
17364
|
+
if (revokedAt && isMaster) pendingRevocations.push({
|
|
17365
|
+
devicePub,
|
|
17366
|
+
keyId: serverKey.id
|
|
17367
|
+
});
|
|
17351
17368
|
}
|
|
17352
17369
|
});
|
|
17370
|
+
for (const { devicePub, keyId } of pendingRevocations) try {
|
|
17371
|
+
await client.revokeKey(keyId);
|
|
17372
|
+
identityDoc.setDeviceServerStatus(devicePub, serverUrl, { registered: false });
|
|
17373
|
+
} catch {}
|
|
17353
17374
|
for (const key of serverKeys) {
|
|
17354
17375
|
if (key.revoked) continue;
|
|
17355
17376
|
if (!devicesMap.has(key.publicKey)) identityDoc.addDevice(key.publicKey, {
|