@live-change/framework 0.8.13 → 0.8.15

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.
@@ -31,6 +31,9 @@ class Model extends ReaderModel {
31
31
  if (prop.hasOwnProperty('defaultValue')) {
32
32
  prepData[key] = prop.defaultValue
33
33
  }
34
+ if (prop.hasOwnProperty('default')) {
35
+ prepData[key] = prop.default
36
+ }
34
37
  }
35
38
  }
36
39
  //console.log("CREATE PREP DATA", prepData)
@@ -211,7 +211,7 @@ async function update(changes, service, app, force) {
211
211
  const table = generateTableName(change.model)
212
212
  const property = change.property
213
213
  let update = {}
214
- update[change.name] = property.defaultValue
214
+ update[change.name] = property.defaultValue ?? property.default
215
215
  debug("CREATE PROPERTY UPDATE", update)
216
216
  await dao.request(['database', 'query'], database, `(${
217
217
  async (input, output, { table, update }) =>
package/lib/utils.js CHANGED
@@ -183,7 +183,9 @@ function generateDefault(properties) {
183
183
  const property = properties[propName]
184
184
  if(property.hasOwnProperty('defaultValue')) {
185
185
  result[propName] = property.defaultValue
186
- } else if(property.type == Object) {
186
+ } else if(property.hasOwnProperty('default')) {
187
+ result[propName] = property.default
188
+ } else if(property.type === Object) {
187
189
  result[propName] = generateDefault(property.properties)
188
190
  }
189
191
  }
@@ -193,7 +195,7 @@ function generateDefault(properties) {
193
195
  function prefixRange({ gt, lt, gte, lte, limit, reverse }, prefix, from = "") {
194
196
  function getPrefix(id) {
195
197
  if(id.length > from.length) {
196
- if(id.slice(0, from.length) != from) {
198
+ if(id.slice(0, from.length) !== from) {
197
199
  console.error("ID:", id, "does not start with", from)
198
200
  throw new Error("id does not match prefix")
199
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/framework",
3
- "version": "0.8.13",
3
+ "version": "0.8.15",
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.13",
26
- "@live-change/uid": "^0.8.13"
25
+ "@live-change/dao": "^0.8.15",
26
+ "@live-change/uid": "^0.8.15"
27
27
  },
28
- "gitHead": "4453aa639a9fe1a857d93d73ebd28a82c97fdd87"
28
+ "gitHead": "4897eefbf3ce9ace57630127da89503c71114563"
29
29
  }