Comparing version 6.0.0-rc6 to 6.0.0-rc7
28
index.js
@@ -503,2 +503,5 @@ const b4a = require('b4a') | ||
if (!this.opened) await this.ready() | ||
if (this.closing) throw new Error('Autobase is closing') | ||
await this._advanced // ensure all local state has been applied, only needed until persistent batches | ||
@@ -588,3 +591,5 @@ | ||
await this._presystem | ||
await this._primaryBootstrap.setUserData(key, val) | ||
const core = this._primaryBootstrap === null ? this.local : this._primaryBootstrap | ||
await core.setUserData(key, val) | ||
} | ||
@@ -594,3 +599,5 @@ | ||
await this._presystem | ||
return await this._primaryBootstrap.getUserData(key) | ||
const core = this._primaryBootstrap === null ? this.local : this._primaryBootstrap | ||
return await core.getUserData(key) | ||
} | ||
@@ -761,7 +768,3 @@ | ||
_onUpgrade (version) { | ||
if (version > this.maxSupportedVersion) { | ||
this._onError(new Error('Autobase upgrade required')) | ||
return false | ||
} | ||
return true | ||
if (version > this.maxSupportedVersion) throw new Error('Autobase upgrade required') | ||
} | ||
@@ -1439,3 +1442,3 @@ | ||
if (update.version > this.version) { | ||
if (!this._onUpgrade(update.version)) return // failed | ||
this._onUpgrade(update.version) // throws if not supported | ||
upgraded = true | ||
@@ -1505,8 +1508,3 @@ } | ||
if (applyBatch.length && this._hasApply === true) { | ||
try { | ||
await this._handlers.apply(applyBatch, this.view, this) | ||
} catch (err) { | ||
this._onError(err) | ||
return null | ||
} | ||
await this._handlers.apply(applyBatch, this.view, this) | ||
} | ||
@@ -1536,3 +1534,3 @@ | ||
if (update.version > this.version) { | ||
if (!this._onUpgrade(update.version)) return // failed | ||
this._onUpgrade(update.version) // throws if not supported | ||
upgraded = true | ||
@@ -1539,0 +1537,0 @@ } |
{ | ||
"name": "autobase", | ||
"version": "6.0.0-rc6", | ||
"version": "6.0.0-rc7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
160760
4290