corestore 7.0.5 → 7.0.6

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.
Files changed (2) hide show
  1. package/index.js +2 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -137,6 +137,7 @@ class Corestore extends ReadyResource {
137
137
  this.cores = this.root ? this.root.cores : new CoreTracker()
138
138
  this.sessions = new SessionTracker()
139
139
  this.corestores = this.root ? this.root.corestores : new Set()
140
+ this.readOnly = opts.writable === false
140
141
  this.globalCache = this.root ? this.root.globalCache : (opts.globalCache || null)
141
142
  this.primaryKey = this.root ? this.root.primaryKey : (opts.primaryKey || null)
142
143
  this.ns = opts.namespace || DEFAULT_NAMESPACE
@@ -314,7 +315,7 @@ class Corestore extends ReadyResource {
314
315
  wait: opts.wait !== false,
315
316
  timeout: opts.timeout || 0,
316
317
  draft: !!opts.draft,
317
- writable: opts.writable
318
+ writable: opts.writable === undefined && this.readOnly ? false : opts.writable
318
319
  }
319
320
 
320
321
  // name requires us to rt to storage + ready, so needs preload
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "7.0.5",
3
+ "version": "7.0.6",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "files": [