cry-synced-db-client 0.1.137 → 0.1.138
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 +13 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3110,6 +3110,7 @@ var ServerUpdateHandler = class {
|
|
|
3110
3110
|
if (updates.length > 0) {
|
|
3111
3111
|
const updateIds = updates.map((u) => u._id);
|
|
3112
3112
|
const localItems = await this.dexieDb.getByIds(collectionName, updateIds);
|
|
3113
|
+
const missingIds = [];
|
|
3113
3114
|
for (let i = 0; i < updates.length; i++) {
|
|
3114
3115
|
const deltaData = updates[i];
|
|
3115
3116
|
const localItem = localItems[i];
|
|
@@ -3117,14 +3118,18 @@ var ServerUpdateHandler = class {
|
|
|
3117
3118
|
await this.handleServerItemUpdate(collectionName, localItem, deltaData);
|
|
3118
3119
|
updatedIds.push(String(deltaData._id));
|
|
3119
3120
|
} else {
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3121
|
+
missingIds.push(deltaData._id);
|
|
3122
|
+
}
|
|
3123
|
+
}
|
|
3124
|
+
if (missingIds.length > 0) {
|
|
3125
|
+
const fullItems = await this.restInterface.findByIds(
|
|
3126
|
+
collectionName,
|
|
3127
|
+
missingIds
|
|
3128
|
+
);
|
|
3129
|
+
for (const fullItem of fullItems) {
|
|
3130
|
+
if (!fullItem) continue;
|
|
3131
|
+
await this.handleServerItemInsert(collectionName, fullItem);
|
|
3132
|
+
updatedIds.push(String(fullItem._id));
|
|
3128
3133
|
}
|
|
3129
3134
|
}
|
|
3130
3135
|
}
|