hypercore 11.6.3 → 11.7.0
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/index.js +2 -2
- package/lib/session-state.js +6 -1
- package/lib/streams.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -213,7 +213,7 @@ class Hypercore extends EventEmitter {
|
|
|
213
213
|
throw SESSION_CLOSED('Cannot make sessions on a closing core')
|
|
214
214
|
}
|
|
215
215
|
if (opts.checkout !== undefined && !opts.name && !opts.atom) {
|
|
216
|
-
throw
|
|
216
|
+
throw ASSERTION('Checkouts are only supported on atoms or named sessions')
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
const wait = opts.wait === false ? false : this.wait
|
|
@@ -249,7 +249,7 @@ class Hypercore extends EventEmitter {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
if (!isEncryptionProvider(encryption)) {
|
|
252
|
-
throw
|
|
252
|
+
throw ASSERTION('Provider does not satisfy HypercoreEncryption interface')
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
this.encryption = encryption
|
package/lib/session-state.js
CHANGED
|
@@ -543,7 +543,12 @@ module.exports = class SessionState {
|
|
|
543
543
|
|
|
544
544
|
tx.setHead(tree)
|
|
545
545
|
|
|
546
|
-
if (this.isDefault())
|
|
546
|
+
if (this.isDefault()) {
|
|
547
|
+
await storeBitfieldRange(this.storage, tx, batch.ancestors, batch.length, true)
|
|
548
|
+
if (this.length === this.core.header.hints.contiguousLength) {
|
|
549
|
+
tx.setHints({ contiguousLength: this.length + values.length })
|
|
550
|
+
}
|
|
551
|
+
}
|
|
547
552
|
|
|
548
553
|
for (let i = 0; i < values.length; i++) {
|
|
549
554
|
tx.putBlock(this.length + i, values[i])
|
package/lib/streams.js
CHANGED
|
@@ -8,7 +8,7 @@ class ReadStream extends Readable {
|
|
|
8
8
|
this.start = opts.start || 0
|
|
9
9
|
this.end = typeof opts.end === 'number' ? opts.end : -1
|
|
10
10
|
this.snapshot = !opts.live && opts.snapshot !== false
|
|
11
|
-
this.live = !!opts.live
|
|
11
|
+
this.live = this.end === -1 ? !!opts.live : false
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
_open (cb) {
|