corestore 6.4.0 → 6.4.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 (3) hide show
  1. package/README.md +4 -2
  2. package/index.js +7 -2
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -1,12 +1,14 @@
1
1
  # Corestore
2
2
 
3
+ ### [See the full API docs at docs.holepunch.to](https://docs.holepunch.to/building-blocks/corestore)
4
+
3
5
  Corestore is a Hypercore factory that makes it easier to manage large collections of named Hypercores.
4
6
 
5
7
  Corestore provides:
6
8
  1. __Key Derivation__ - All writable Hypercore keys are derived from a single master key and a user-provided name.
7
9
  2. __Session Handling__ - If a single Hypercore is loaded multiple times through the `get` method, the underlying resources will only be opened once (using Hypercore 10's new session feature). Once all sessions are closed, the resources will be released.
8
10
  3. __Storage Management__ - Hypercores can be stored in any random-access-storage instance, where they will be keyed by their discovery keys.
9
- 4. __Namespacing__ - You can share a single Corestore instance between multiple applications or components without worrying about naming collisions by creating "namespaces" (e.g. `corestore.namespace('my-app').get({ name: 'main' })
11
+ 4. __Namespacing__ - You can share a single Corestore instance between multiple applications or components without worrying about naming collisions by creating "namespaces" (e.g. `corestore.namespace('my-app').get({ name: 'main' })`)
10
12
 
11
13
  ### Installation
12
14
  `npm install corestore`
@@ -43,7 +45,7 @@ Corestore replicates in an "all-to-all" fashion, meaning that when replication b
43
45
 
44
46
  If the remote side dynamically adds a new Hypercore to the replication stream, Corestore will load and replicate that core if possible.
45
47
 
46
- Using [Hyperswarm](https://github.com/hyperswarm/hyperswarm) you can easily replicate corestores
48
+ Using [Hyperswarm](https://github.com/holepunchto/hyperswarm) you can easily replicate corestores
47
49
 
48
50
  ``` js
49
51
  const swarm = new Hyperswarm()
package/index.js CHANGED
@@ -60,6 +60,11 @@ module.exports = class Corestore extends EventEmitter {
60
60
  }
61
61
  }
62
62
 
63
+ _emitCore (name, core) {
64
+ this.emit(name, core)
65
+ if (this !== this._root) this._root.emit(name, core)
66
+ }
67
+
63
68
  _incFindingPeers () {
64
69
  if (++this._findingPeersCount !== 1) return
65
70
 
@@ -201,7 +206,7 @@ module.exports = class Corestore extends EventEmitter {
201
206
  this.cores.set(id, core)
202
207
  core.ready().then(() => {
203
208
  if (core.closing) return // extra safety here as ready is a tick after open
204
- this.emit('core-open', core)
209
+ this._emitCore('core-open', core)
205
210
  for (const { stream } of this._replicationStreams) {
206
211
  core.replicate(stream, { session: true })
207
212
  }
@@ -209,7 +214,7 @@ module.exports = class Corestore extends EventEmitter {
209
214
  this.cores.delete(id)
210
215
  })
211
216
  core.once('close', () => {
212
- this.emit('core-close', core)
217
+ this._emitCore('core-close', core)
213
218
  this.cores.delete(id)
214
219
  })
215
220
  core.on('conflict', (len, fork, proof) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "6.4.0",
3
+ "version": "6.4.2",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "git+https://github.com/hypercore-protocol/corestore.git"
11
+ "url": "git+https://github.com/holepunchto/corestore.git"
12
12
  },
13
13
  "keywords": [
14
14
  "corestore"
@@ -16,9 +16,9 @@
16
16
  "author": "Andrew Osheroff <andrewosh@gmail.com>",
17
17
  "license": "MIT",
18
18
  "bugs": {
19
- "url": "https://github.com/hypercore-protocol/corestore/issues"
19
+ "url": "https://github.com/holepunchto/corestore/issues"
20
20
  },
21
- "homepage": "https://github.com/hypercore-protocol/corestore#readme",
21
+ "homepage": "https://github.com/holepunchto/corestore#readme",
22
22
  "files": [
23
23
  "index.js",
24
24
  "lib/**.js"
@@ -33,7 +33,7 @@
33
33
  "hypercore": "^10.5.3",
34
34
  "hypercore-crypto": "^3.2.1",
35
35
  "safety-catch": "^1.0.1",
36
- "sodium-universal": "^3.0.4",
36
+ "sodium-universal": "^4.0.0",
37
37
  "xache": "^1.1.0"
38
38
  }
39
39
  }