cry-synced-db-client 0.1.135 → 0.1.137

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Versions
2
2
 
3
+ ## 0.1.136 (2026-04-20)
4
+
5
+ - `DexieDb.saveMany` is now fail-safe:
6
+ - Items with invalid `_id` (non-string or empty string) are skipped with
7
+ `console.error` that includes collection name and the offending `_id` /
8
+ item payload.
9
+ - `bulkPut` errors are caught and logged (collection + affected `_id` list)
10
+ so a single bad record no longer aborts the entire sync cycle.
11
+
3
12
  ## 0.1.135 (2026-04-20)
4
13
 
5
14
  - Conflict resolution: server wins on primitive field conflicts when `external._rev > local._rev`
package/dist/index.js CHANGED
@@ -5003,8 +5003,30 @@ var DexieDb = class extends Dexie {
5003
5003
  async saveMany(collection, items) {
5004
5004
  if (items.length === 0) return;
5005
5005
  const table = this.getTable(collection);
5006
- for (const item of items) this.ensureStringId(item);
5007
- await table.bulkPut(items);
5006
+ const valid = [];
5007
+ for (const item of items) {
5008
+ this.ensureStringId(item);
5009
+ if (typeof item._id !== "string" || item._id.length === 0) {
5010
+ console.error(
5011
+ `DexieDb.saveMany: skipping item with invalid _id in "${collection}"`,
5012
+ { _id: item._id, _idType: typeof item._id, item }
5013
+ );
5014
+ continue;
5015
+ }
5016
+ valid.push(item);
5017
+ }
5018
+ if (valid.length === 0) return;
5019
+ try {
5020
+ await table.bulkPut(valid);
5021
+ } catch (err) {
5022
+ const ids = valid.map((it) => String(it._id));
5023
+ console.error(
5024
+ `DexieDb.saveMany: bulkPut failed for "${collection}" (${valid.length} items):`,
5025
+ err,
5026
+ "_ids:",
5027
+ ids
5028
+ );
5029
+ }
5008
5030
  }
5009
5031
  async deleteOne(collection, id) {
5010
5032
  const table = this.getTable(collection);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cry-synced-db-client",
3
- "version": "0.1.135",
3
+ "version": "0.1.137",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -38,7 +38,6 @@
38
38
  "dependencies": {
39
39
  "cry-db": "^2.4.28",
40
40
  "cry-helpers": "^2.1.193",
41
- "cry-synced-db-client": "^0.1.111",
42
41
  "msgpackr": "^1.11.9",
43
42
  "notepack": "^0.0.2",
44
43
  "notepack.io": "^3.0.1",