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.
Files changed (2) hide show
  1. package/dist/index.js +13 -8
  2. 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
- const fullItem = await this.restInterface.findById(
3121
- collectionName,
3122
- deltaData._id
3123
- );
3124
- if (fullItem) {
3125
- await this.handleServerItemInsert(collectionName, fullItem);
3126
- updatedIds.push(String(fullItem._id));
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.137",
3
+ "version": "0.1.138",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",