@live-change/framework
Advanced tools
Comparing version 0.2.10 to 0.2.11
@@ -38,2 +38,4 @@ const ReactiveDao = require("@live-change/dao") | ||
this.requestTimeout = env.API_REQUEST_TIMEOUT || 10*1000 | ||
this.defaultProcessors = [ | ||
@@ -66,3 +68,3 @@ crudGenerator, | ||
requestSendTimeout: 2000, | ||
requestTimeout: 5000, | ||
requestTimeout: this.requestTimeout, | ||
queueActiveRequestsOnDisconnect: false, | ||
@@ -221,2 +223,7 @@ autoReconnectDelay: 200, | ||
objectObservable.observe(observer) | ||
if(this.requestTimeout) { | ||
setTimeout(() => { | ||
reject('timeout') | ||
}, this.requestTimeout) | ||
} | ||
}).finally(() => { | ||
@@ -223,0 +230,0 @@ objectObservable.unobserve(observer) |
@@ -44,3 +44,2 @@ const ReactiveDao = require("@live-change/dao") | ||
get(parameters) { | ||
return view.get(parameters, clientData) | ||
@@ -47,0 +46,0 @@ } |
@@ -31,3 +31,2 @@ const ReactiveDao = require("@live-change/dao") | ||
} | ||
if(Array.isArray(range)) this.indexRangePath(index, range.join(',')) | ||
return ['database', 'query', this.service.databaseName, `(${ | ||
@@ -49,3 +48,2 @@ async (input, output, { tableName, indexName, range }) => { | ||
} | ||
if(Array.isArray(range)) this.indexObjectPath(index, range.join(',')) | ||
return ['database', 'queryObject', this.service.databaseName, `(${ | ||
@@ -61,2 +59,33 @@ async (input, output, { tableName, indexName, range }) => { | ||
indexRangeDelete(index, range = {}) { | ||
if(typeof range != 'object' || Array.isArray(range)) { | ||
const values = Array.isArray(range) ? range : [range] | ||
const str = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')+'_' | ||
return this.indexRangeDelete(index,{ gte: str, lte: str+'\xFF\xFF\xFF\xFF' }) | ||
} | ||
this.service.dao.request(['database', 'query'], this.service.databaseName, `(${ | ||
async (input, output, { tableName, indexName, range }) => { | ||
await (await input.index(indexName)).range(range).onChange(async (ind, oldInd) => { | ||
output.table(tableName).delete(ind.to) | ||
}) | ||
} | ||
})`, { indexName: this.tableName+'_'+index, tableName: this.tableName, range }) | ||
} | ||
indexRangeUpdate(index, range = {}, update) { | ||
if(typeof range != 'object' || Array.isArray(range)) { | ||
const values = Array.isArray(range) ? range : [range] | ||
const str = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')+'_' | ||
return this.indexRangeDelete(index,{ gte: str, lte: str+'\xFF\xFF\xFF\xFF' }, update) | ||
} | ||
const operations = Array.isArray(update) ? update : [{ op:'merge', property: null, value: update }] | ||
this.service.dao.request(['database', 'query'], this.service.databaseName, `(${ | ||
async (input, output, { tableName, indexName, range, operations }) => { | ||
await (await input.index(indexName)).range(range).onChange(async (ind, oldInd) => { | ||
output.table(tableName).update(ind.to, operations) | ||
}) | ||
} | ||
})`, { indexName: this.tableName+'_'+index, tableName: this.tableName, range, operations }) | ||
} | ||
observable(id) { | ||
@@ -63,0 +92,0 @@ return this.service.dao.observable(this.path(id), ReactiveDao.ObservableValue) |
{ | ||
"name": "@live-change/framework", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"description": "Live Change Framework - ultimate solution for real time mobile/web apps", | ||
@@ -24,6 +24,6 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@live-change/dao-websocket": "^0.2.3", | ||
"@live-change/dao-websocket": "^0.2.4", | ||
"@live-change/db": "^0.2.5", | ||
"@live-change/db-store-level": "^0.1.8", | ||
"@live-change/db-store-lmdb": "^0.1.7", | ||
"@live-change/db-store-level": "^0.1.9", | ||
"@live-change/db-store-lmdb": "^0.1.8", | ||
"encoding-down": "^6.3.0", | ||
@@ -45,6 +45,6 @@ "express": "^4.17.1", | ||
"dependencies": { | ||
"@elastic/elasticsearch": "^7.6.1", | ||
"@live-change/dao": "^0.2.5", | ||
"@elastic/elasticsearch": "^7.7.1", | ||
"@live-change/dao": "^0.2.6", | ||
"@live-change/event-sourcing": "^0.1.6" | ||
} | ||
} |
105604
2922
Updated@live-change/dao@^0.2.6