corestore 7.0.22 → 7.1.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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/index.js +5 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -76,6 +76,9 @@ const core1 = ns1.get({ name: 'main' }) // These will load different Hypercores
76
76
  const core2 = ns2.get({ name: 'main' })
77
77
  ```
78
78
 
79
+ #### `const stream = store.list(namespace)`
80
+ Creates a discovery key stream of all cores within a namespace or all cores in general if no namespace is provided.
81
+
79
82
  #### `await store.close()`
80
83
  Fully close this Corestore instance.
81
84
 
package/index.js CHANGED
@@ -229,7 +229,7 @@ class Corestore extends ReadyResource {
229
229
  super()
230
230
 
231
231
  this.root = opts.root || null
232
- this.storage = this.root ? this.root.storage : Hypercore.defaultStorage(storage)
232
+ this.storage = this.root ? this.root.storage : Hypercore.defaultStorage(storage, { id: opts.id })
233
233
  this.streamTracker = this.root ? this.root.streamTracker : new StreamTracker()
234
234
  this.cores = this.root ? this.root.cores : new CoreTracker()
235
235
  this.sessions = new SessionTracker()
@@ -306,6 +306,10 @@ class Corestore extends ReadyResource {
306
306
  return this.session({ ...opts, namespace: generateNamespace(this.ns, name) })
307
307
  }
308
308
 
309
+ list (namespace) {
310
+ return this.storage.createDiscoveryKeyStream(namespace)
311
+ }
312
+
309
313
  getAuth (discoveryKey) {
310
314
  return this.storage.getAuth(discoveryKey)
311
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "7.0.22",
3
+ "version": "7.1.0",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "files": [