@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.
- package/lib/runtime/Model.js +3 -0
- package/lib/updaters/database.js +1 -1
- package/lib/utils.js +4 -2
- package/package.json +4 -4
package/lib/runtime/Model.js
CHANGED
package/lib/updaters/database.js
CHANGED
|
@@ -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.
|
|
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)
|
|
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.
|
|
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.
|
|
26
|
-
"@live-change/uid": "^0.8.
|
|
25
|
+
"@live-change/dao": "^0.8.15",
|
|
26
|
+
"@live-change/uid": "^0.8.15"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "4897eefbf3ce9ace57630127da89503c71114563"
|
|
29
29
|
}
|