corestore 7.12.0 → 7.12.2

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 +9 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -105,7 +105,7 @@ class CoreTracker {
105
105
  store.watchIndex = -1
106
106
  }
107
107
 
108
- resume(id) {
108
+ resume(id, group) {
109
109
  const core = this.map.get(id)
110
110
 
111
111
  if (!core) return null
@@ -119,6 +119,8 @@ class CoreTracker {
119
119
  core.gc = 0
120
120
  }
121
121
 
122
+ if (group) resumeGroup(core, group).catch(noop)
123
+
122
124
  return core
123
125
  }
124
126
 
@@ -261,7 +263,7 @@ class Corestore extends ReadyResource {
261
263
  this.watchers = null
262
264
  this.watchIndex = -1
263
265
 
264
- this._groupNotifiers = new Map() // group notifications
266
+ this._groupNotifiers = this.root ? this.root._groupNotifiers : new Map() // group notifications
265
267
  this._findingPeers = null // here for legacy
266
268
  this._ongcBound = this._ongc.bind(this)
267
269
  this._onGroupActiveBound = this._onGroupActive.bind(this)
@@ -765,3 +767,8 @@ function noop() {}
765
767
  function toHex(discoveryKey) {
766
768
  return b4a.toString(discoveryKey, 'hex')
767
769
  }
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.0",
3
+ "version": "7.12.2",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "files": [