@live-change/db 0.9.96 → 0.9.98
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/lib/Database.js +2 -2
- package/lib/Index.js +4 -3
- package/lib/Log.js +1 -0
- package/lib/ScriptContext.js +2 -2
- package/lib/Table.js +1 -0
- package/package.json +5 -5
package/lib/Database.js
CHANGED
|
@@ -251,9 +251,9 @@ class Database {
|
|
|
251
251
|
console.error("DELETINGww INDEX", name)
|
|
252
252
|
delete this.config.indexes[name]
|
|
253
253
|
this.indexesListObservable.remove(name)
|
|
254
|
-
if(this.onAutoRemoveIndex && config) this.onAutoRemoveIndex(name, config.uid)
|
|
254
|
+
if(this.onAutoRemoveIndex && config) this.onAutoRemoveIndex(name, config.uid)
|
|
255
|
+
await this.saveConfig(this.config)
|
|
255
256
|
console.error("DELETED INDEX", name)
|
|
256
|
-
await this.saveConfig(this.config)
|
|
257
257
|
throw error
|
|
258
258
|
}
|
|
259
259
|
this.indexes.set(name, index)
|
package/lib/Index.js
CHANGED
|
@@ -224,7 +224,7 @@ class TableReader extends ChangeStream {
|
|
|
224
224
|
if(this.opLogObservable && this.opLogObservable.list && this.opLogObservable.list.length < opLogBatchSize) {
|
|
225
225
|
console.error("SHOULD NOT READ NOT FINISHED OPLOG", this.opLogObservable.list)
|
|
226
226
|
console.trace("READ OP LOG TOO EARLY!!!")
|
|
227
|
-
process.exit(
|
|
227
|
+
process.exit(10)
|
|
228
228
|
}
|
|
229
229
|
//console.log("DO READ OPLOG", key)
|
|
230
230
|
if(this.opLogObservable) {
|
|
@@ -283,7 +283,7 @@ class TableReader extends ChangeStream {
|
|
|
283
283
|
await this.opLogPromise
|
|
284
284
|
if(this.opLogPromise != null) {
|
|
285
285
|
console.trace("IMPOSIBBLE!")
|
|
286
|
-
process.exit(
|
|
286
|
+
process.exit(11)
|
|
287
287
|
}
|
|
288
288
|
//console.log("FB", this.opLogBuffer && this.opLogBuffer.length)
|
|
289
289
|
if (this.opLogBuffer && this.opLogBuffer.length) return this.opLogBuffer[0].id
|
|
@@ -521,6 +521,7 @@ class Index extends Table {
|
|
|
521
521
|
super(database, name, config)
|
|
522
522
|
this.database = database
|
|
523
523
|
this.codeObservable = new ReactiveDao.ObservableValue(code)
|
|
524
|
+
this.codeObservable.observe(() => {}) // prevent dispose and clear
|
|
524
525
|
this.params = params
|
|
525
526
|
this.code = code
|
|
526
527
|
this.startPromise = null
|
|
@@ -541,7 +542,7 @@ class Index extends Table {
|
|
|
541
542
|
if(typeof queryFunction != 'function') {
|
|
542
543
|
console.error("INDEX CODE", this.code)
|
|
543
544
|
console.error("QUERY FUNCTION", typeof queryFunction, queryFunction)
|
|
544
|
-
process.exit(
|
|
545
|
+
process.exit(15)
|
|
545
546
|
throw new Error("Index code is not a function")
|
|
546
547
|
}
|
|
547
548
|
this.codeFunction = (input, output) => queryFunction(input, output, this.params)
|
package/lib/Log.js
CHANGED
|
@@ -6,6 +6,7 @@ class Log {
|
|
|
6
6
|
this.database = database
|
|
7
7
|
this.name = name
|
|
8
8
|
this.configObservable = new ReactiveDao.ObservableValue(config)
|
|
9
|
+
this.configObservable.observe(() => {}) // prevent dispose and clear
|
|
9
10
|
|
|
10
11
|
this.data = database.store(config.uid + '.log', {...config, ...config.data})
|
|
11
12
|
|
package/lib/ScriptContext.js
CHANGED
|
@@ -96,14 +96,14 @@ class ScriptContext {
|
|
|
96
96
|
/* console.log("found compiled function!", cleanCode) */
|
|
97
97
|
if(typeof compiledFunction != 'function') {
|
|
98
98
|
console.error("compiled function is not a function!", cleanCode)
|
|
99
|
-
process.exit(
|
|
99
|
+
process.exit(20)
|
|
100
100
|
}
|
|
101
101
|
return compiledFunction
|
|
102
102
|
}
|
|
103
103
|
const queryFunction = this.run(code, filename)
|
|
104
104
|
if(typeof queryFunction != 'function') {
|
|
105
105
|
console.error("compiled query function is not a function!", cleanCode)
|
|
106
|
-
process.exit(
|
|
106
|
+
process.exit(21)
|
|
107
107
|
}
|
|
108
108
|
globalThis.compiledFunctions[cleanCode] = queryFunction
|
|
109
109
|
return queryFunction
|
package/lib/Table.js
CHANGED
|
@@ -24,6 +24,7 @@ class Table {
|
|
|
24
24
|
this.database = database
|
|
25
25
|
this.name = name
|
|
26
26
|
this.configObservable = new ReactiveDao.ObservableValue(config)
|
|
27
|
+
this.configObservable.observe(() => {}) // prevent dispose and clear
|
|
27
28
|
|
|
28
29
|
this.data = database.store(config.uid + '.data', { ...config, ...config.data })
|
|
29
30
|
this.opLog = database.store(config.uid + '.opLog', { ...config, ...config.opLog })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/db",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.98",
|
|
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.
|
|
26
|
-
"@live-change/db-store-lmdb": "^0.9.
|
|
25
|
+
"@live-change/db-store-level": "^0.9.98",
|
|
26
|
+
"@live-change/db-store-lmdb": "^0.9.98",
|
|
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.
|
|
35
|
+
"@live-change/dao": "^0.9.98",
|
|
36
36
|
"get-random-values": "^1.2.2",
|
|
37
37
|
"node-interval-tree": "^1.3.3"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "a0e25c0ac835707d27763e56a2c20bd75d978583"
|
|
40
40
|
}
|