@live-change/framework 0.9.8 → 0.9.10
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/App.js +6 -0
- package/lib/updaters/database.js +4 -4
- package/package.json +4 -4
package/lib/App.js
CHANGED
|
@@ -578,6 +578,9 @@ class App {
|
|
|
578
578
|
|
|
579
579
|
serviceViewObservable(serviceName, viewName, params) {
|
|
580
580
|
const service = this.startedServices[serviceName]
|
|
581
|
+
if(!service) throw new Error(
|
|
582
|
+
`Service ${serviceName} not found, available services: ${Object.keys(this.startedServices).join(', ')}`
|
|
583
|
+
)
|
|
581
584
|
const view = service.views[viewName]
|
|
582
585
|
if(!view) throw new Error(`View ${viewName} not found in service ${serviceName}`)
|
|
583
586
|
const result = view.observable(params, { internal: true, roles: ['admin'] })
|
|
@@ -586,6 +589,9 @@ class App {
|
|
|
586
589
|
|
|
587
590
|
async serviceViewGet(serviceName, viewName, params) {
|
|
588
591
|
const service = this.startedServices[serviceName]
|
|
592
|
+
if(!service) throw new Error(
|
|
593
|
+
`Service ${serviceName} not found, available services: ${Object.keys(this.startedServices).join(', ')}`
|
|
594
|
+
)
|
|
589
595
|
const view = service.views[viewName]
|
|
590
596
|
if(!view) throw new Error(`View ${viewName} not found in service ${serviceName}`)
|
|
591
597
|
return await view.get(params, { internal: true, roles: ['admin'] })
|
package/lib/updaters/database.js
CHANGED
|
@@ -28,8 +28,8 @@ async function update(changes, service, app, force) {
|
|
|
28
28
|
dao.request(['database', 'createIndex'], database, 'commands_byTimestamp', `${
|
|
29
29
|
async (input, output) => {
|
|
30
30
|
await input.table('commands').onChange((obj, oldObj) => {
|
|
31
|
-
if(obj) output.change({ id: obj.timestamp, to: obj.id })
|
|
32
|
-
if(oldObj) output.change(null, { id: oldObj.timestamp, to: oldObj.id })
|
|
31
|
+
if(obj && !oldObj) output.change({ id: obj.timestamp+'_'+obj.id, to: obj.id }, null)
|
|
32
|
+
if(!obj && oldObj) output.change(null, { id: oldObj.timestamp+'_'+oldObj.id, to: oldObj.id })
|
|
33
33
|
})
|
|
34
34
|
}
|
|
35
35
|
}`, {}).catch(e => 'ok')
|
|
@@ -44,8 +44,8 @@ async function update(changes, service, app, force) {
|
|
|
44
44
|
dao.request(['database', 'createIndex'], database, 'triggers_byTimestamp', `${
|
|
45
45
|
async (input, output) => {
|
|
46
46
|
await input.table('triggers').onChange((obj, oldObj) => {
|
|
47
|
-
if(obj) output.change({ id: obj.timestamp, to: obj.id })
|
|
48
|
-
if(oldObj) output.change(null, { id: oldObj.timestamp, to: oldObj.id })
|
|
47
|
+
if(obj && !oldObj) output.change({ id: obj.timestamp+'_'+obj.id, to: obj.id }, null)
|
|
48
|
+
if(!obj && oldObj) output.change(null, { id: oldObj.timestamp+'_'+oldObj.id, to: oldObj.id })
|
|
49
49
|
})
|
|
50
50
|
}
|
|
51
51
|
}`, {}).catch(e => 'ok')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/framework",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.10",
|
|
4
4
|
"description": "Live Change Framework - ultimate solution for real time mobile/web apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://github.com/live-change/live-change-stack",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@live-change/dao": "^0.9.
|
|
26
|
-
"@live-change/uid": "^0.9.
|
|
25
|
+
"@live-change/dao": "^0.9.10",
|
|
26
|
+
"@live-change/uid": "^0.9.10"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "d41e404c1933e9ed6e3927d85a5dadf66da0f951"
|
|
29
29
|
}
|