@live-change/framework 0.6.5 → 0.6.6

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.
@@ -2,11 +2,13 @@ function getAccessMethod(access) {
2
2
  if(typeof access == 'function') {
3
3
  return access
4
4
  } else if(Array.isArray(access)) {
5
- return (params, {service, client}) => {
6
- for(let role of access) if(client.roles.includes('admin')) return true
5
+ return (params, { service, client }) => {
6
+ if(client.roles.includes('administrator')) return true
7
+ if(client.roles.includes('admin')) return true
8
+ for(let role of access) if(client.roles.includes(role)) return true
7
9
  return false
8
10
  }
9
11
  } else throw new Error("unknown view access definition "+access)
10
12
  }
11
13
 
12
- module.exports = getAccessMethod
14
+ module.exports = getAccessMethod
@@ -39,10 +39,14 @@ class ReaderModel {
39
39
  })`, { tableName: this.tableName, id, fields }]
40
40
  }
41
41
 
42
- rangePath(range = {}) {
43
- if(typeof range != 'object') {
44
- const str = range.toString()
45
- return this.rangePath({ gte: str, lte: str+'\xFF\xFF\xFF\xFF' })
42
+ rangePath(range = {}, pathRange = null) {
43
+ if(typeof range != 'object' || Array.isArray(range)) {
44
+ const values = Array.isArray(range) ? range : [range]
45
+ const prefix = values.map(value => value === undefined ? '' : JSON.stringify(value)).join(':')
46
+ if(pathRange) {
47
+ return this.rangePath(utils.prefixRange(pathRange, prefix, prefix))
48
+ }
49
+ return this.rangePath({ gte: prefix+':', lte: prefix+'_\xFF\xFF\xFF\xFF' })
46
50
  }
47
51
  if(Array.isArray(range)) this.rangePath(range.join(','))
48
52
  return ['database', 'tableRange', this.service.databaseName, this.tableName, range]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/framework",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "description": "Live Change Framework - ultimate solution for real time mobile/web apps",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,13 +21,13 @@
21
21
  },
22
22
  "homepage": "https://github.com/live-change/live-change-framework",
23
23
  "devDependencies": {
24
- "@live-change/dao": "0.4.10",
25
- "@live-change/dao-websocket": "0.4.10",
26
- "@live-change/db": "0.5.10",
27
- "@live-change/db-store-level": "0.5.10",
28
- "@live-change/db-store-lmdb": "0.5.10",
24
+ "@live-change/dao": "0.5.0",
25
+ "@live-change/dao-websocket": "0.4.13",
26
+ "@live-change/db": "0.5.13",
27
+ "@live-change/db-store-level": "0.5.13",
28
+ "@live-change/db-store-lmdb": "0.5.13",
29
29
  "@live-change/sockjs": "^0.4.0-rc.1",
30
- "@live-change/uid": "^0.6.5",
30
+ "@live-change/uid": "^0.6.6",
31
31
  "cookie": "^0.4.1",
32
32
  "express": "^4.17.1",
33
33
  "os-service": "^2.2.0",
@@ -35,5 +35,5 @@
35
35
  "tape": "^5.3.2",
36
36
  "websocket": "^1.0.34"
37
37
  },
38
- "gitHead": "6ffba5113875638abf4203b56bdab5ed6a2e5e55"
38
+ "gitHead": "d6f4e8a34d88ecf90a3bf97bb367d4c8027ce7af"
39
39
  }