@live-change/db-web
Advanced tools
Comparing version 0.5.22 to 0.5.23
@@ -92,4 +92,8 @@ const ScriptContext = require('@live-change/db/lib/WebScriptContext.js') | ||
async initialize(initOptions = {}) { | ||
const jsonStr = localStorage[`${this.config.dbPrefix || ''}_lcdb`] | ||
this.metadata = jsonStr && JSON.parse(jsonStr) | ||
if(initOptions.metadata) { | ||
this.metadata = initOptions.metadata | ||
} else { | ||
const jsonStr = localStorage[`${this.config.dbPrefix || ''}_lcdb`] | ||
this.metadata = jsonStr && JSON.parse(jsonStr) | ||
} | ||
if(!this.metadata) { | ||
@@ -127,2 +131,3 @@ this.metadata = { | ||
(name) => dbStore.deleteStore(name), | ||
dbName, | ||
(context) => new ScriptContext(context) | ||
@@ -129,0 +134,0 @@ ) |
{ | ||
"name": "@live-change/db-web", | ||
"version": "0.5.22", | ||
"version": "0.5.23", | ||
"author": { | ||
@@ -32,8 +32,8 @@ "email": "michal@laszczewski.com", | ||
"dependencies": { | ||
"@live-change/dao": "0.5.8", | ||
"@live-change/db": "^0.5.22", | ||
"@live-change/db-store-rbtree": "^0.5.22", | ||
"@live-change/dao": "0.5.9", | ||
"@live-change/db": "^0.5.23", | ||
"@live-change/db-store-rbtree": "^0.5.23", | ||
"debug": "^4.3.4" | ||
}, | ||
"gitHead": "8428eb866bd0dc9d9ee247d77c120553713a5987" | ||
"gitHead": "481a5cd01bd21e4caab4638bb0aa76e251fb2709" | ||
} |
@@ -178,4 +178,6 @@ const test = require('tape') | ||
const mapper = (obj) => ({ id: obj.type+'_'+obj.id, to: obj.id }) | ||
await input.log('events').onChange((obj, oldObj) => | ||
output.change(obj && mapper(obj), oldObj && mapper(oldObj)) ) | ||
await input.log('events').onChange((obj, oldObj) => { | ||
output.debug('change', JSON.stringify(obj), JSON.stringify(oldObj)) | ||
output.change(obj && mapper(obj), oldObj && mapper(oldObj)) | ||
}) | ||
} | ||
@@ -187,10 +189,16 @@ })`) | ||
const newEvent = { id: '7', name: 'henry' } | ||
const newEvent = { type: 'new', value: 'henry' } | ||
events.push(newEvent) | ||
await client.request(['database', 'putLog'], 'index.test', 'events', newEvent) | ||
console.log("EVENTS LOGGED:\n ", | ||
(await client.get(['database', 'logRange', 'index.test', 'events', {}])) | ||
.map(e => JSON.stringify(e)).join('\n')) | ||
await delay(100) | ||
results = await client.get(['database', 'indexRange', 'index.test', 'eventsByType', {}]) | ||
console.log("RESULTS", results.map(r => r.id)) | ||
console.log("EVENTS", events.map(e => e.type+'_'+e.id)) | ||
t.deepEqual(results.length, events.length) | ||
}) | ||
}) | ||
}) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
58571
14
1398
1
+ Added@live-change/dao@0.5.9(transitive)
- Removed@live-change/dao@0.5.8(transitive)
Updated@live-change/dao@0.5.9
Updated@live-change/db@^0.5.23