corestore 7.12.1 → 7.12.3

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 +5 -11
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -105,7 +105,7 @@ class CoreTracker {
105
105
  store.watchIndex = -1
106
106
  }
107
107
 
108
- resume(id, group) {
108
+ resume(id) {
109
109
  const core = this.map.get(id)
110
110
 
111
111
  if (!core) return null
@@ -119,8 +119,6 @@ class CoreTracker {
119
119
  core.gc = 0
120
120
  }
121
121
 
122
- if (group) resumeGroup(core, group).catch(noop)
123
-
124
122
  return core
125
123
  }
126
124
 
@@ -263,7 +261,7 @@ class Corestore extends ReadyResource {
263
261
  this.watchers = null
264
262
  this.watchIndex = -1
265
263
 
266
- this._groupNotifiers = new Map() // group notifications
264
+ this._groupNotifiers = this.root ? this.root._groupNotifiers : new Map() // group notifications
267
265
  this._findingPeers = null // here for legacy
268
266
  this._ongcBound = this._ongc.bind(this)
269
267
  this._onGroupActiveBound = this._onGroupActive.bind(this)
@@ -582,7 +580,8 @@ class Corestore extends ReadyResource {
582
580
  wait: opts.wait !== false,
583
581
  timeout: opts.timeout || 0,
584
582
  draft: !!opts.draft,
585
- writable: opts.writable === undefined && this.readOnly ? false : opts.writable
583
+ writable: opts.writable === undefined && this.readOnly ? false : opts.writable,
584
+ group: opts.group || null
586
585
  }
587
586
 
588
587
  // name requires us to rt to storage + ready, so needs preload
@@ -692,7 +691,7 @@ class Corestore extends ReadyResource {
692
691
  const auth = this._auth(discoveryKey, opts)
693
692
 
694
693
  const id = toHex(auth.discoveryKey)
695
- const existing = this.cores.resume(id, auth.group)
694
+ const existing = this.cores.resume(id)
696
695
  if (existing && !existing.closing) return existing
697
696
 
698
697
  const core = Hypercore.createCore(this.storage, {
@@ -767,8 +766,3 @@ function noop() {}
767
766
  function toHex(discoveryKey) {
768
767
  return b4a.toString(discoveryKey, 'hex')
769
768
  }
770
-
771
- async function resumeGroup(core, group) {
772
- await core.opening
773
- if (!core.header.group) await core.setGroup(group)
774
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "7.12.1",
3
+ "version": "7.12.3",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "b4a": "^1.6.7",
18
18
  "bare-events": "^2.8.3",
19
- "hypercore": "^11.32.0",
19
+ "hypercore": "^11.35.4",
20
20
  "hypercore-crypto": "^3.4.2",
21
21
  "hypercore-errors": "^1.4.0",
22
22
  "hypercore-id-encoding": "^1.3.0",