@live-change/framework
Advanced tools
Comparing version 0.9.20 to 0.9.21
@@ -86,3 +86,3 @@ import * as utils from "../utils.js" | ||
.map(propSet => (Array.isArray(propSet) ? propSet : [propSet]).map(p => p.split('.'))) | ||
const func = async function(input, output, { table, properties }) { | ||
const func = async function(input, output, { table, properties, hash }) { | ||
const value = (obj, property) => { | ||
@@ -105,11 +105,15 @@ let at = obj | ||
for(let pointer of pointers) if(!oldPointers.has(pointer)) { | ||
output.change({ id: pointer+'_'+obj.id, to: obj.id }, null) | ||
output.change({ id: pointer+'_'+(hash ? sha1(obj.id, 'base64') : obj.id), to: obj.id }, null) | ||
} | ||
for(let pointer of oldPointers) if(!pointers.has(pointer)) { | ||
output.change(null, { id: pointer+'_'+obj.id, to: obj.id }) | ||
output.change(null, { id: pointer+'_'+(hash ? sha1(obj.id, 'base64') : obj.id), to: obj.id }) | ||
} | ||
} else if(obj) { | ||
keys(obj).forEach(k => output.change({ id: k+'_'+obj.id, to: obj.id }, null)) | ||
keys(obj).forEach(k => output.change({ | ||
id: k+'_'+(hash ? sha1(obj.id, 'base64') : obj.id), | ||
to: obj.id }, null)) | ||
} else if(oldObj) { | ||
keys(oldObj).forEach(k => output.change(null, { id: k+'_'+oldObj.id, to: oldObj.id })) | ||
keys(oldObj).forEach(k => output.change(null, { | ||
id: k+'_'+(hash ? sha1(obj.id, 'base64') : obj.id), | ||
to: oldObj.id })) | ||
} | ||
@@ -121,7 +125,7 @@ }) | ||
await dao.requestWithSettings(indexRequestSettings, ['database', 'createIndex'], database, indexName, | ||
functionCode, { properties, table }, index.storage ?? {}) | ||
functionCode, { properties, table, hash: index.hash }, index.storage ?? {}) | ||
} else { | ||
if(!table) throw new Error("only function indexes are possible without table") | ||
const properties = (Array.isArray(index.property) ? index.property : [index.property]).map(p => p.split('.')) | ||
const func = async function(input, output, { table, properties }) { | ||
const func = async function(input, output, { table, properties, hash }) { | ||
const mapper = (obj) => ({ | ||
@@ -132,3 +136,3 @@ id: properties.map(path => { | ||
return at === undefined ? '' : JSON.stringify(at) | ||
}).join(':')+'_'+obj.id, | ||
}).join(':')+'_'+(hash ? sha1(obj.id, 'base64') : obj.id), | ||
to: obj.id | ||
@@ -142,3 +146,3 @@ }) | ||
await dao.requestWithSettings(indexRequestSettings, ['database', 'createIndex'], database, indexName, | ||
functionCode, { properties, table }, index.storage ?? {}) | ||
functionCode, { properties, table, hash: index.hash }, index.storage ?? {}) | ||
} | ||
@@ -145,0 +149,0 @@ } |
{ | ||
"name": "@live-change/framework", | ||
"version": "0.9.20", | ||
"version": "0.9.21", | ||
"description": "Live Change Framework - ultimate solution for real time mobile/web apps", | ||
@@ -25,6 +25,6 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@live-change/dao": "^0.9.20", | ||
"@live-change/uid": "^0.9.20" | ||
"@live-change/dao": "^0.9.21", | ||
"@live-change/uid": "^0.9.21" | ||
}, | ||
"gitHead": "6524c2dedbb137e95e9aa07eaf9503d68d7b9093" | ||
"gitHead": "362e325d1c636f9c0f2fb6432e209c5c56f46919" | ||
} |
165636
4385