@live-change/db 0.5.10 → 0.5.11

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/lib/Index.js +12 -8
  2. package/package.json +4 -4
package/lib/Index.js CHANGED
@@ -403,16 +403,20 @@ class IndexWriter {
403
403
  this.index.update(id, ops)
404
404
  }
405
405
  change(obj, oldObj) {
406
- //if(this.index.name == 'triggers_new') console.log("INDEX WRITE", obj, oldObj)
407
- if(obj) {
408
- if(oldObj && oldObj.id != obj.id) {
409
- this.index.delete(oldObj.id)
410
- this.index.put(obj)
406
+ try {
407
+ if (obj) {
408
+ if (oldObj && oldObj.id != obj.id) {
409
+ this.index.delete(oldObj.id)
410
+ this.index.put(obj)
411
+ } else {
412
+ this.index.put(obj)
413
+ }
411
414
  } else {
412
- this.index.put(obj)
415
+ if (oldObj) this.index.delete(oldObj.id)
413
416
  }
414
- } else {
415
- if(oldObj) this.index.delete(oldObj.id)
417
+ } catch(error) {
418
+ console.error("ERROR", error, "ON CHANGE", oldObj, "=>", obj)
419
+ throw error
416
420
  }
417
421
  }
418
422
  get(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/db",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
4
4
  "description": "Database with observable data for live queries",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,8 +21,8 @@
21
21
  },
22
22
  "homepage": "https://github.com/live-change/live-change-db",
23
23
  "devDependencies": {
24
- "@live-change/db-store-level": "^0.5.10",
25
- "@live-change/db-store-lmdb": "^0.5.10",
24
+ "@live-change/db-store-level": "^0.5.11",
25
+ "@live-change/db-store-lmdb": "^0.5.11",
26
26
  "minimist": ">=1.2.3",
27
27
  "rimraf": "^3.0.2",
28
28
  "sockjs": "^0.3.24",
@@ -34,5 +34,5 @@
34
34
  "get-random-values": "^1.2.2",
35
35
  "node-interval-tree": "^1.3.3"
36
36
  },
37
- "gitHead": "6236c001558f60998b0e5bce5e97e7ebb1f50e45"
37
+ "gitHead": "459aba0a8b3096f664d4820df8cac99a7ea0d26e"
38
38
  }