@leofcoin/peernet 0.10.4 → 0.10.7
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.
- package/dist/browser/peernet.js +33443 -30177
- package/dist/commonjs/codec-6367213c.js +205 -0
- package/dist/commonjs/codec-format-interface.js +7 -7
- package/dist/commonjs/codec.js +1 -1
- package/dist/commonjs/dht-response.js +2 -2
- package/dist/commonjs/dht.js +2 -2
- package/dist/commonjs/hash.js +17 -17
- package/dist/commonjs/peernet-message.js +2 -2
- package/dist/commonjs/peernet.js +25 -24
- package/dist/commonjs/request.js +2 -2
- package/dist/commonjs/response.js +2 -2
- package/dist/module/peernet.js +6 -5
- package/package.json +5 -3
- package/src/peernet.js +5 -4
package/dist/module/peernet.js
CHANGED
|
@@ -151,7 +151,7 @@ class PeernetClient {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
var version = "0.10.
|
|
154
|
+
var version = "0.10.6";
|
|
155
155
|
|
|
156
156
|
var api$1 = {
|
|
157
157
|
version: ({send}) => send({client: '@peernet/api/http', version}),
|
|
@@ -2180,9 +2180,10 @@ 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);
|
|
2185
|
+
} else {
|
|
2186
|
+
store = globalThis[`${store}Store`];
|
|
2186
2187
|
}
|
|
2187
2188
|
if (store && !store.private) {
|
|
2188
2189
|
data = await store.get(hash);
|
|
@@ -2330,7 +2331,7 @@ class Peernet {
|
|
|
2330
2331
|
// get closest peer on earth
|
|
2331
2332
|
const closestPeer = await this.dht.closestPeer(providers);
|
|
2332
2333
|
// get peer instance by id
|
|
2333
|
-
if (!closestPeer || !closestPeer.id) return this.requestData(hash, store)
|
|
2334
|
+
if (!closestPeer || !closestPeer.id) return this.requestData(hash, store.name ? store.name : store)
|
|
2334
2335
|
|
|
2335
2336
|
const id = closestPeer.id.toString();
|
|
2336
2337
|
if (this.peers) {
|
|
@@ -2445,7 +2446,7 @@ class Peernet {
|
|
|
2445
2446
|
if (store && await store.has(hash)) data = await store.get(hash);
|
|
2446
2447
|
if (data) return data
|
|
2447
2448
|
|
|
2448
|
-
return this.requestData(hash, store)
|
|
2449
|
+
return this.requestData(hash, store.name ? store.name : store)
|
|
2449
2450
|
}
|
|
2450
2451
|
|
|
2451
2452
|
/**
|
|
@@ -2528,4 +2529,4 @@ class Peernet {
|
|
|
2528
2529
|
// }
|
|
2529
2530
|
}
|
|
2530
2531
|
|
|
2531
|
-
export default
|
|
2532
|
+
export { Peernet as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/peernet",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
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.
|
|
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.
|
|
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,9 +344,10 @@ 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)
|
|
349
|
+
} else {
|
|
350
|
+
store = globalThis[`${store}Store`]
|
|
350
351
|
}
|
|
351
352
|
if (store && !store.private) {
|
|
352
353
|
data = await store.get(hash)
|
|
@@ -359,7 +360,7 @@ export default class Peernet {
|
|
|
359
360
|
this.bw.up += node.encoded.length
|
|
360
361
|
}
|
|
361
362
|
} else {
|
|
362
|
-
// ban (trying to access private
|
|
363
|
+
// ban (trying to access private st)
|
|
363
364
|
}
|
|
364
365
|
|
|
365
366
|
} else if (proto.name === 'peernet-peer') {
|
|
@@ -496,7 +497,7 @@ export default class Peernet {
|
|
|
496
497
|
// get closest peer on earth
|
|
497
498
|
const closestPeer = await this.dht.closestPeer(providers)
|
|
498
499
|
// get peer instance by id
|
|
499
|
-
if (!closestPeer || !closestPeer.id) return this.requestData(hash, store)
|
|
500
|
+
if (!closestPeer || !closestPeer.id) return this.requestData(hash, store.name ? store.name : store)
|
|
500
501
|
|
|
501
502
|
const id = closestPeer.id.toString()
|
|
502
503
|
if (this.peers) {
|
|
@@ -612,7 +613,7 @@ export default class Peernet {
|
|
|
612
613
|
if (store && await store.has(hash)) data = await store.get(hash)
|
|
613
614
|
if (data) return data
|
|
614
615
|
|
|
615
|
-
return this.requestData(hash, store)
|
|
616
|
+
return this.requestData(hash, store.name ? store.name : store)
|
|
616
617
|
}
|
|
617
618
|
|
|
618
619
|
/**
|