Comparing version 2.13.1 to 2.13.2
15
index.js
@@ -295,2 +295,3 @@ const codecs = require('codecs') | ||
this._view = !!opts._view | ||
this._updated = false | ||
@@ -452,3 +453,3 @@ this._onappendBound = this._view ? null : this._onappend.bind(this) | ||
// TODO: better if we could encapsulate this in hypercore in the future | ||
return this._checkout <= this.core.length ? this.core.snapshot() : this.core.session() | ||
return (this._checkout <= this.core.length || this._checkout <= 1) ? this.core.snapshot() : this.core.session() | ||
} | ||
@@ -461,3 +462,3 @@ | ||
? this.core | ||
: version <= this.core.length ? this.core.snapshot() : this.core.session() | ||
: (version <= this.core.length || version <= 1) ? this.core.snapshot() : this.core.session() | ||
@@ -478,3 +479,3 @@ return new Hyperbee(snap, { | ||
snapshot (opts) { | ||
return this.checkout(this.version, opts) | ||
return this.checkout(Math.max(1, this.version), opts) | ||
} | ||
@@ -567,2 +568,3 @@ | ||
this.shouldUpdate = this.options.update !== false | ||
this.updating = null | ||
this.encoding = { | ||
@@ -597,3 +599,6 @@ key: options.keyEncoding ? codecs(options.keyEncoding) : tree.keyEncoding, | ||
} | ||
if (this.tree._checkout === 0 && this.shouldUpdate) await this.core.update() | ||
if (this.tree._checkout === 0 && this.shouldUpdate) { | ||
if (this.updating === null) this.updating = this.core.update() | ||
await this.updating | ||
} | ||
if (this.version < 2) return null | ||
@@ -1358,3 +1363,3 @@ return (await this.getBlock(this.version - 1)).getTreeNode(0) | ||
function defaultDiffer (currentSnap, previousSnap, opts) { | ||
return currentSnap.createDiffStream(previousSnap.version, opts) | ||
return currentSnap.createDiffStream(previousSnap, opts) | ||
} | ||
@@ -1361,0 +1366,0 @@ |
{ | ||
"name": "hyperbee", | ||
"version": "2.13.1", | ||
"version": "2.13.2", | ||
"description": "An append-only B-tree running on a Hypercore.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90131
2493