@leofcoin/peernet 0.10.5 → 0.10.6

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.
@@ -151,7 +151,7 @@ class PeernetClient {
151
151
  }
152
152
  }
153
153
 
154
- var version = "0.10.4";
154
+ var version = "0.10.5";
155
155
 
156
156
  var api$1 = {
157
157
  version: ({send}) => send({client: '@peernet/api/http', version}),
@@ -2180,7 +2180,6 @@ class Peernet {
2180
2180
  } else if (proto.name === 'peernet-data') {
2181
2181
  let { hash, store } = proto.decoded;
2182
2182
  let data;
2183
-
2184
2183
  if (!store) {
2185
2184
  store = await this.whichStore([...this.stores], hash);
2186
2185
  } else {
@@ -2332,7 +2331,7 @@ class Peernet {
2332
2331
  // get closest peer on earth
2333
2332
  const closestPeer = await this.dht.closestPeer(providers);
2334
2333
  // get peer instance by id
2335
- if (!closestPeer || !closestPeer.id) return this.requestData(hash, store)
2334
+ if (!closestPeer || !closestPeer.id) return this.requestData(hash, store.name ? store.name : store)
2336
2335
 
2337
2336
  const id = closestPeer.id.toString();
2338
2337
  if (this.peers) {
@@ -2447,7 +2446,7 @@ class Peernet {
2447
2446
  if (store && await store.has(hash)) data = await store.get(hash);
2448
2447
  if (data) return data
2449
2448
 
2450
- return this.requestData(hash, store)
2449
+ return this.requestData(hash, store.name ? store.name : store)
2451
2450
  }
2452
2451
 
2453
2452
  /**
@@ -2530,4 +2529,4 @@ class Peernet {
2530
2529
  // }
2531
2530
  }
2532
2531
 
2533
- export default Peernet;
2532
+ export { Peernet as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "0.10.5",
3
+ "version": "0.10.6",
4
4
  "description": "",
5
5
  "main": "dist/commonjs/peernet.js",
6
6
  "scripts": {
@@ -21,8 +21,9 @@
21
21
  "dependencies": {
22
22
  "@leofcoin/generate-account": "^1.0.2",
23
23
  "@leofcoin/multi-wallet": "^2.0.6",
24
- "@leofcoin/storage": "^2.1.0",
24
+ "@leofcoin/storage": "^2.1.1",
25
25
  "@vandeurenglenn/little-pubsub": "^1.3.1",
26
+ "async_hooks": "^1.0.0",
26
27
  "bs32": "^0.1.6",
27
28
  "bs58": "^4.0.1",
28
29
  "bs58check": "^2.1.2",
@@ -30,6 +31,7 @@
30
31
  "keccak": "^3.0.1",
31
32
  "koa": "^2.13.1",
32
33
  "node-fetch": "^2.6.1",
34
+ "on-finished": "^2.4.1",
33
35
  "p2pt": "^1.5.0",
34
36
  "protons": "^2.0.1",
35
37
  "socket-request-client": "^1.5.0",
@@ -41,7 +43,7 @@
41
43
  "@rollup/plugin-eslint": "^8.0.1",
42
44
  "@rollup/plugin-json": "^4.1.0",
43
45
  "@rollup/plugin-node-resolve": "^13.0.4",
44
- "browserify": "^16.5.2",
46
+ "browserify": "^16.5.0",
45
47
  "coveralls": "^3.1.1",
46
48
  "esdoc": "^1.1.0",
47
49
  "esdoc-ecmascript-proposal-plugin": "^1.0.0",
package/src/peernet.js CHANGED
@@ -344,7 +344,6 @@ export default class Peernet {
344
344
  } else if (proto.name === 'peernet-data') {
345
345
  let { hash, store } = proto.decoded
346
346
  let data
347
-
348
347
  if (!store) {
349
348
  store = await this.whichStore([...this.stores], hash)
350
349
  } else {
@@ -498,7 +497,7 @@ export default class Peernet {
498
497
  // get closest peer on earth
499
498
  const closestPeer = await this.dht.closestPeer(providers)
500
499
  // get peer instance by id
501
- if (!closestPeer || !closestPeer.id) return this.requestData(hash, store)
500
+ if (!closestPeer || !closestPeer.id) return this.requestData(hash, store.name ? store.name : store)
502
501
 
503
502
  const id = closestPeer.id.toString()
504
503
  if (this.peers) {
@@ -614,7 +613,7 @@ export default class Peernet {
614
613
  if (store && await store.has(hash)) data = await store.get(hash)
615
614
  if (data) return data
616
615
 
617
- return this.requestData(hash, store)
616
+ return this.requestData(hash, store.name ? store.name : store)
618
617
  }
619
618
 
620
619
  /**