corestore 6.6.0 → 6.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 +6 -3
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -33,6 +33,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
33
33
|
this._root = root || this
|
|
34
34
|
this._replicationStreams = root ? root._replicationStreams : []
|
|
35
35
|
this._overwrite = opts.overwrite === true
|
|
36
|
+
this._readonly = opts.writable === false
|
|
36
37
|
|
|
37
38
|
this._sessions = new Set() // sessions for THIS namespace
|
|
38
39
|
this._rootStoreSessions = new Set()
|
|
@@ -263,6 +264,7 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
263
264
|
}
|
|
264
265
|
|
|
265
266
|
const core = new Hypercore(null, {
|
|
267
|
+
writable: !this._readonly,
|
|
266
268
|
...opts,
|
|
267
269
|
name: null,
|
|
268
270
|
preload: () => this._preload(opts)
|
|
@@ -311,17 +313,18 @@ module.exports = class Corestore extends ReadyResource {
|
|
|
311
313
|
return stream
|
|
312
314
|
}
|
|
313
315
|
|
|
314
|
-
namespace (name) {
|
|
316
|
+
namespace (name, opts) {
|
|
315
317
|
if (name instanceof Hypercore) {
|
|
316
|
-
return this.session({ _bootstrap: name })
|
|
318
|
+
return this.session({ ...opts, _bootstrap: name })
|
|
317
319
|
}
|
|
318
|
-
return this.session({ namespace: generateNamespace(this._namespace, name) })
|
|
320
|
+
return this.session({ ...opts, namespace: generateNamespace(this._namespace, name) })
|
|
319
321
|
}
|
|
320
322
|
|
|
321
323
|
session (opts) {
|
|
322
324
|
const session = new Corestore(this.storage, {
|
|
323
325
|
namespace: this._namespace,
|
|
324
326
|
cache: this.cache,
|
|
327
|
+
writable: !this._readonly,
|
|
325
328
|
_root: this._root,
|
|
326
329
|
...opts
|
|
327
330
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "corestore",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "A Hypercore factory that simplifies managing collections of cores.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"b4a": "^1.3.1",
|
|
33
|
-
"hypercore": "^10.
|
|
33
|
+
"hypercore": "^10.12.0",
|
|
34
34
|
"hypercore-crypto": "^3.2.1",
|
|
35
35
|
"ready-resource": "^1.0.0",
|
|
36
36
|
"safety-catch": "^1.0.1",
|