cry-synced-db-client 0.1.94 → 0.1.97
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/index.js +8 -8
- package/dist/src/db/SyncedDb.d.ts +2 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -2637,6 +2637,9 @@ var _SyncEngine = class _SyncEngine {
|
|
|
2637
2637
|
}
|
|
2638
2638
|
}
|
|
2639
2639
|
}
|
|
2640
|
+
if (updates.length === 0 && deletes.length === 0) {
|
|
2641
|
+
return { sentCount: 0 };
|
|
2642
|
+
}
|
|
2640
2643
|
const collectionBatches = [[{
|
|
2641
2644
|
collection,
|
|
2642
2645
|
batch: {
|
|
@@ -4320,23 +4323,20 @@ var SyncedDb = class _SyncedDb {
|
|
|
4320
4323
|
}
|
|
4321
4324
|
/**
|
|
4322
4325
|
* Load a single collection from Dexie into in-memory cache.
|
|
4323
|
-
*
|
|
4326
|
+
* Accumulates all items first, then does a single initCollection
|
|
4327
|
+
* call to minimize reactive update overhead.
|
|
4324
4328
|
*/
|
|
4325
4329
|
async loadCollectionToInMem(name) {
|
|
4326
|
-
|
|
4330
|
+
const allItems = [];
|
|
4327
4331
|
await this.dexieDb.forEachBatch(name, 2e3, async (chunk) => {
|
|
4328
|
-
let writeIdx = 0;
|
|
4329
4332
|
for (let i = 0; i < chunk.length; i++) {
|
|
4330
4333
|
const item = chunk[i];
|
|
4331
4334
|
if (!item._deleted && !item._archived) {
|
|
4332
|
-
|
|
4335
|
+
allItems.push(item);
|
|
4333
4336
|
}
|
|
4334
4337
|
}
|
|
4335
|
-
chunk.length = writeIdx;
|
|
4336
|
-
if (chunk.length > 0) {
|
|
4337
|
-
this.inMemManager.writeBatch(name, chunk, "upsert");
|
|
4338
|
-
}
|
|
4339
4338
|
});
|
|
4339
|
+
this.inMemManager.initCollection(name, allItems);
|
|
4340
4340
|
const meta = await this.dexieDb.getSyncMeta(name);
|
|
4341
4341
|
if (meta) {
|
|
4342
4342
|
this.syncMetaCache.set(name, meta);
|
|
@@ -138,7 +138,8 @@ export declare class SyncedDb implements I_SyncedDb {
|
|
|
138
138
|
private isSyncAllowed;
|
|
139
139
|
/**
|
|
140
140
|
* Load a single collection from Dexie into in-memory cache.
|
|
141
|
-
*
|
|
141
|
+
* Accumulates all items first, then does a single initCollection
|
|
142
|
+
* call to minimize reactive update overhead.
|
|
142
143
|
*/
|
|
143
144
|
private loadCollectionToInMem;
|
|
144
145
|
private assertCollection;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cry-synced-db-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.97",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -35,9 +35,8 @@
|
|
|
35
35
|
"vitest": "^4.1.2"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"cry-db": "^2.4.
|
|
38
|
+
"cry-db": "^2.4.24",
|
|
39
39
|
"cry-helpers": "^2.1.193",
|
|
40
|
-
"cry-synced-db-client": "0.1.84",
|
|
41
40
|
"msgpackr": "^1.11.9",
|
|
42
41
|
"notepack": "^0.0.2",
|
|
43
42
|
"notepack.io": "^3.0.1",
|