corestore 7.0.23 → 7.2.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 +6 -3
  3. package/package.json +3 -2
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
@@ -238,12 +238,11 @@ class Corestore extends ReadyResource {
238
238
  this.globalCache = this.root ? this.root.globalCache : (opts.globalCache || null)
239
239
  this.primaryKey = this.root ? this.root.primaryKey : (opts.primaryKey || null)
240
240
  this.ns = opts.namespace || DEFAULT_NAMESPACE
241
+ this.manifestVersion = opts.manifestVersion || 1
241
242
 
242
243
  this.watchers = null
243
244
  this.watchIndex = -1
244
245
 
245
- this.manifestVersion = 1 // just compat
246
-
247
246
  this._findingPeers = null // here for legacy
248
247
  this._ongcBound = this._ongc.bind(this)
249
248
 
@@ -306,6 +305,10 @@ class Corestore extends ReadyResource {
306
305
  return this.session({ ...opts, namespace: generateNamespace(this.ns, name) })
307
306
  }
308
307
 
308
+ list (namespace) {
309
+ return this.storage.createDiscoveryKeyStream(namespace)
310
+ }
311
+
309
312
  getAuth (discoveryKey) {
310
313
  return this.storage.getAuth(discoveryKey)
311
314
  }
@@ -517,7 +520,7 @@ class Corestore extends ReadyResource {
517
520
  if (opts.manifest) {
518
521
  result.manifest = opts.manifest
519
522
  } else if (result.keyPair && !result.discoveryKey) {
520
- result.manifest = { version: 1, signers: [{ publicKey: result.keyPair.publicKey }] }
523
+ result.manifest = { version: this.manifestVersion, signers: [{ publicKey: result.keyPair.publicKey }] }
521
524
  }
522
525
 
523
526
  if (opts.key) result.key = ID.decode(opts.key)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "7.0.23",
3
+ "version": "7.2.0",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -23,7 +23,8 @@
23
23
  "test-tmp": "^1.3.0"
24
24
  },
25
25
  "scripts": {
26
- "test": "standard && brittle test/*.js"
26
+ "test": "standard && brittle test/*.js",
27
+ "test:bare": "bare test/basic.js"
27
28
  },
28
29
  "repository": {
29
30
  "type": "git",