@live-change/db 0.9.28 → 0.9.29

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.
@@ -30,7 +30,7 @@ class ChangeStream {
30
30
  const oldIndList = oldObj && func(oldObj)
31
31
  const ind = indList && indList.map(v => JSON.stringify(v)).join(':')+'_'+id
32
32
  const oldInd = oldIndList && oldIndList.map(v => JSON.stringify(v)).join(':')+'_'+id
33
- if(ind == oldInd) return // no index change, ignore
33
+ if(ind === oldInd) return // no index change, ignore
34
34
  if(ind) {
35
35
  pipe.change({ id: ind, to: id }, null, ind, timestamp)
36
36
  }
@@ -55,8 +55,8 @@ class ChangeStreamPipe extends ChangeStream {
55
55
  }
56
56
  async unobserve(cb) {
57
57
  const cbIndex = this.callbacks.indexOf(cb)
58
- if(cbIndex == -1) throw new Error("observer not found")
59
- if(this.callbacks.length == 0) {
58
+ if(cbIndex === -1) throw new Error("observer not found")
59
+ if(this.callbacks.length === 0) {
60
60
  this.master.unobservePromise = await this.observerPromise
61
61
  }
62
62
  }
package/lib/Index.js CHANGED
@@ -11,7 +11,7 @@ import { ChangeStream } from './ChangeStream.js'
11
11
  import Debug from 'debug'
12
12
  const debug = Debug('db')
13
13
 
14
- const opLogBatchSize = 128 /// TODO: incrase after testing
14
+ const opLogBatchSize = 128 /// TODO: increase after testing
15
15
 
16
16
  class ObjectReader extends ChangeStream {
17
17
  constructor(tableReader, id) {
@@ -228,6 +228,9 @@ class TableReader extends ChangeStream {
228
228
  this.opLogBuffer.push(object)
229
229
  this.opLogReader.handleSignal()
230
230
  }
231
+ async objectGet(id) {
232
+ return await (await this.table).objectGet(id)
233
+ }
231
234
  async get(range = {}) {
232
235
  return await (await this.table).rangeGet(range)
233
236
  }
@@ -452,8 +455,11 @@ class IndexWriter {
452
455
  throw error
453
456
  }
454
457
  }
455
- get(id) {
456
- return this.index.get(id)
458
+ objectGet(id) {
459
+ return this.index.objectGet(id)
460
+ }
461
+ rangeGet(range) {
462
+ return this.index.rangeGet(range)
457
463
  }
458
464
  synchronized(key, code) {
459
465
  return this.index.synchronized(key, code)
package/lib/queryGet.js CHANGED
@@ -79,6 +79,9 @@ class TableReader extends ChangeStream {
79
79
  object(id) {
80
80
  return new ObjectReader(this.#table, id, this.#time)
81
81
  }
82
+ objectGet(id) {
83
+ return this.#table.objectGet(id)
84
+ }
82
85
  async get(range = {}) {
83
86
  return (await this.#table).rangeGet(range)
84
87
  }
@@ -180,6 +180,9 @@ class TableReader extends Reader {
180
180
  return this._queryReader.getExistingReaderOrCreate(this.#prefix+'#'+id,
181
181
  () => new ObjectReader(this._queryReader, this.#table, id))
182
182
  }
183
+ objectGet(id) {
184
+ return this.#table.objectGet(id)
185
+ }
183
186
  async get(range = {}) {
184
187
  return await (await this.#table).rangeGet(range)
185
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/db",
3
- "version": "0.9.28",
3
+ "version": "0.9.29",
4
4
  "description": "Database with observable data for live queries",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  "type": "module",
23
23
  "homepage": "https://github.com/live-change/live-change-stack",
24
24
  "devDependencies": {
25
- "@live-change/db-store-level": "^0.9.28",
26
- "@live-change/db-store-lmdb": "^0.9.28",
25
+ "@live-change/db-store-level": "^0.9.29",
26
+ "@live-change/db-store-lmdb": "^0.9.29",
27
27
  "minimist": ">=1.2.3",
28
28
  "next-tick": "^1.1.0",
29
29
  "rimraf": "^5.0.5",
@@ -32,9 +32,9 @@
32
32
  "websocket-extensions": ">=0.1.4"
33
33
  },
34
34
  "dependencies": {
35
- "@live-change/dao": "^0.9.28",
35
+ "@live-change/dao": "^0.9.29",
36
36
  "get-random-values": "^1.2.2",
37
37
  "node-interval-tree": "^1.3.3"
38
38
  },
39
- "gitHead": "f308e368e678fa38ddef6a6d4999ad730b18e8ce"
39
+ "gitHead": "425e1d43a7359693059b41692d1fe04e12d5f0b1"
40
40
  }