@leofcoin/peernet 0.10.5 → 0.10.8
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 -30179
- 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 -26
- package/dist/commonjs/request.js +2 -2
- package/dist/commonjs/response.js +2 -2
- package/dist/module/peernet.js +6 -7
- package/package.json +5 -3
- package/src/peernet.js +4 -5
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.7";
|
|
155
155
|
|
|
156
156
|
var api$1 = {
|
|
157
157
|
version: ({send}) => send({client: '@peernet/api/http', version}),
|
|
@@ -2180,11 +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);
|
|
2186
2185
|
} else {
|
|
2187
|
-
store = globalThis
|
|
2186
|
+
store = globalThis[`${store}Store`];
|
|
2188
2187
|
}
|
|
2189
2188
|
if (store && !store.private) {
|
|
2190
2189
|
data = await store.get(hash);
|
|
@@ -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) {
|
|
@@ -2340,7 +2339,7 @@ class Peernet {
|
|
|
2340
2339
|
if (this._getPeerId(peer.id) === id) return peer
|
|
2341
2340
|
});
|
|
2342
2341
|
|
|
2343
|
-
let data = new DataMessage({hash, store});
|
|
2342
|
+
let data = new DataMessage({hash, store: store.name ? store.name : store});
|
|
2344
2343
|
|
|
2345
2344
|
const node = await this.prepareMessage(id, data.encoded);
|
|
2346
2345
|
if (closest[0]) data = await closest[0].request(node.encoded);
|
|
@@ -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
|
|
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.8",
|
|
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,11 +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)
|
|
350
349
|
} else {
|
|
351
|
-
store = globalThis
|
|
350
|
+
store = globalThis[`${store}Store`]
|
|
352
351
|
}
|
|
353
352
|
if (store && !store.private) {
|
|
354
353
|
data = await store.get(hash)
|
|
@@ -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) {
|
|
@@ -506,7 +505,7 @@ export default class Peernet {
|
|
|
506
505
|
if (this._getPeerId(peer.id) === id) return peer
|
|
507
506
|
})
|
|
508
507
|
|
|
509
|
-
let data = new DataMessage({hash, store})
|
|
508
|
+
let data = new DataMessage({hash, store: store.name ? store.name : store});
|
|
510
509
|
|
|
511
510
|
const node = await this.prepareMessage(id, data.encoded)
|
|
512
511
|
if (closest[0]) data = await closest[0].request(node.encoded)
|
|
@@ -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
|
/**
|