@live-change/framework 0.8.40 → 0.8.42

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,6 +2,9 @@ import * as utils from "../utils.js"
2
2
  import Debug from 'debug'
3
3
  const debug = Debug('framework:updaters:db')
4
4
 
5
+ const cartesian =
6
+ (...a) => a.reduce((a, b) => a.flatMap(d => b.map(e => [d, e].flat())));
7
+
5
8
  async function update(changes, service, app, force) {
6
9
 
7
10
  const dao = app.dao
@@ -61,7 +64,7 @@ async function update(changes, service, app, force) {
61
64
  } else {
62
65
  if(!table) throw new Error("only function indexes are possible without table")
63
66
  if(index.multi) {
64
- if(Array.isArray(index.property)) throw new Error("multi indexes on multiple properties are not supported!")
67
+ // if(Array.isArray(index.property)) throw new Error("multi indexes on multiple properties are not supported!")
65
68
  const properties = (Array.isArray(index.property) ? index.property : [index.property]).map(p => p.split('.'))
66
69
  const func = async function(input, output, { table, properties }) {
67
70
  const value = (obj, property) => {
@@ -69,9 +72,9 @@ async function update(changes, service, app, force) {
69
72
  for(const p of property) at = at && at[p]
70
73
  if(at === undefined) return []
71
74
  if(Array.isArray(at)) return at.map(v => JSON.stringify(v))
72
- return [at]
75
+ return [JSON.stringify(at)]
73
76
  }
74
- const keys = (obj, id) => {
77
+ const keys = (obj, id = 0) => {
75
78
  const values = value(obj, properties[id])
76
79
  if(id === properties.length - 1) return values
77
80
  return values.flatMap(v => keys(obj, id + 1).map(k => v + ':' + k))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/framework",
3
- "version": "0.8.40",
3
+ "version": "0.8.42",
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.8.40",
26
- "@live-change/uid": "^0.8.40"
25
+ "@live-change/dao": "^0.8.42",
26
+ "@live-change/uid": "^0.8.42"
27
27
  },
28
- "gitHead": "5a12ec795f6fa16f30203aef3ad1534660fa5146"
28
+ "gitHead": "3aee0e7026e57fb72343e1254f0137959d958b6f"
29
29
  }