@live-change/framework 0.9.16 → 0.9.18

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.
@@ -81,7 +81,8 @@ async function update(changes, service, app, force) {
81
81
  if(!table) throw new Error("only function indexes are possible without table")
82
82
  if(index.multi) {
83
83
  // if(Array.isArray(index.property)) throw new Error("multi indexes on multiple properties are not supported!")
84
- const properties = (Array.isArray(index.property) ? index.property : [index.property]).map(p => p.split('.'))
84
+ const properties = (Array.isArray(index.property) ? index.property : [index.property])
85
+ .map(propSet => (Array.isArray(propSet) ? propSet : [propSet]).map(p => p.split('.')))
85
86
  const func = async function(input, output, { table, properties }) {
86
87
  const value = (obj, property) => {
87
88
  let at = obj
@@ -91,7 +92,7 @@ async function update(changes, service, app, force) {
91
92
  return [JSON.stringify(at)]
92
93
  }
93
94
  const keys = (obj, id = 0) => {
94
- const values = value(obj, properties[id])
95
+ const values = properties[id].map(property => value(obj, property)).flat()
95
96
  if(id === properties.length - 1) return values
96
97
  return values.flatMap(v => keys(obj, id + 1).map(k => v + ':' + k))
97
98
  }
package/lib/utils.js CHANGED
@@ -37,7 +37,9 @@ export function definitionToJSON(definition, ignoreRoot = false) {
37
37
  return definition.toJSON()
38
38
  }
39
39
  if(typeof definition !== 'object') return definition
40
- if(Array.isArray(definition)) return definition.map(definitionToJSON)
40
+ if(Array.isArray(definition)) {
41
+ return definition.map(d => definitionToJSON(d))
42
+ }
41
43
  return Object.fromEntries(Object.entries(definition).map(
42
44
  ([key, value]) => [key, definitionToJSON(value)])
43
45
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/framework",
3
- "version": "0.9.16",
3
+ "version": "0.9.18",
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.16",
26
- "@live-change/uid": "^0.9.16"
25
+ "@live-change/dao": "^0.9.18",
26
+ "@live-change/uid": "^0.9.18"
27
27
  },
28
- "gitHead": "226df9fa7eb682f6d7da5e4541eb320e8309facf"
28
+ "gitHead": "d7fd7ad0a0ea331caea9dc8385439b9c637525ed"
29
29
  }