corestore 7.0.4 → 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 -3
  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
@@ -299,7 +300,6 @@ class Corestore extends ReadyResource {
299
300
 
300
301
  const conf = {
301
302
  preload: null,
302
- parent: opts.parent || null,
303
303
  sessions: null,
304
304
  ongc: null,
305
305
  core: null,
@@ -315,7 +315,7 @@ class Corestore extends ReadyResource {
315
315
  wait: opts.wait !== false,
316
316
  timeout: opts.timeout || 0,
317
317
  draft: !!opts.draft,
318
- writable: opts.writable
318
+ writable: opts.writable === undefined && this.readOnly ? false : opts.writable
319
319
  }
320
320
 
321
321
  // name requires us to rt to storage + ready, so needs preload
@@ -351,7 +351,6 @@ class Corestore extends ReadyResource {
351
351
  const core = this._getCore(discoveryKey, opts)
352
352
 
353
353
  return {
354
- parent: opts.parent || null,
355
354
  core,
356
355
  sessions: this.sessions.get(core.id),
357
356
  ongc: this._ongcBound,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "7.0.4",
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": [