@leofcoin/peernet 0.11.11 → 0.11.14
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
CHANGED
|
@@ -84595,7 +84595,7 @@ class Peernet {
|
|
|
84595
84595
|
Storage = globalThis.LeofcoinStorage?.default ? globalThis.LeofcoinStorage.default : (browser_default())
|
|
84596
84596
|
}
|
|
84597
84597
|
globalThis[`${name}Store`] = globalThis[`${name}Store`] ||
|
|
84598
|
-
await new Storage(
|
|
84598
|
+
await new Storage(name, root)
|
|
84599
84599
|
|
|
84600
84600
|
globalThis[`${name}Store`].private = isPrivate
|
|
84601
84601
|
if (!isPrivate) this.stores.push(name)
|
|
@@ -84626,6 +84626,13 @@ class Peernet {
|
|
|
84626
84626
|
return Object.entries(this.client.connections)
|
|
84627
84627
|
}
|
|
84628
84628
|
|
|
84629
|
+
/**
|
|
84630
|
+
* @return {String} id - peerId
|
|
84631
|
+
*/
|
|
84632
|
+
getConnection(id) {
|
|
84633
|
+
return this.client.connections[id]
|
|
84634
|
+
}
|
|
84635
|
+
|
|
84629
84636
|
/**
|
|
84630
84637
|
* @private
|
|
84631
84638
|
*
|
|
@@ -84645,7 +84652,6 @@ class Peernet {
|
|
|
84645
84652
|
* @type {Map}
|
|
84646
84653
|
* @property {Object} peer Instance of Peer
|
|
84647
84654
|
*/
|
|
84648
|
-
this.peerMap = new Map()
|
|
84649
84655
|
this.stores = []
|
|
84650
84656
|
this.requestProtos = {}
|
|
84651
84657
|
this.storePrefix = options.storePrefix
|
|
@@ -84745,14 +84751,6 @@ class Peernet {
|
|
|
84745
84751
|
return this
|
|
84746
84752
|
}
|
|
84747
84753
|
|
|
84748
|
-
_getPeerId(id) {
|
|
84749
|
-
for (const entry of [...this.peerMap.entries()]) {
|
|
84750
|
-
for (const _id of entry[1]) {
|
|
84751
|
-
if (_id === id) return entry[0]
|
|
84752
|
-
}
|
|
84753
|
-
}
|
|
84754
|
-
}
|
|
84755
|
-
|
|
84756
84754
|
addRequestHandler(name, method) {
|
|
84757
84755
|
this.requestProtos[name] = method
|
|
84758
84756
|
}
|
|
@@ -10,7 +10,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
var PubSub__default = /*#__PURE__*/_interopDefaultLegacy(PubSub);
|
|
11
11
|
var Koa__default = /*#__PURE__*/_interopDefaultLegacy(Koa);
|
|
12
12
|
|
|
13
|
-
var version = "0.11.
|
|
13
|
+
var version = "0.11.13";
|
|
14
14
|
|
|
15
15
|
var api$1 = {
|
|
16
16
|
version: ({send}) => send({client: '@peernet/api/http', version}),
|
package/dist/commonjs/peernet.js
CHANGED
|
@@ -1541,7 +1541,7 @@ class Peernet {
|
|
|
1541
1541
|
Storage = globalThis.LeofcoinStorage?.default ? globalThis.LeofcoinStorage.default : LeofcoinStorage__default["default"];
|
|
1542
1542
|
}
|
|
1543
1543
|
globalThis[`${name}Store`] = globalThis[`${name}Store`] ||
|
|
1544
|
-
await new Storage(
|
|
1544
|
+
await new Storage(name, root);
|
|
1545
1545
|
|
|
1546
1546
|
globalThis[`${name}Store`].private = isPrivate;
|
|
1547
1547
|
if (!isPrivate) this.stores.push(name);
|
|
@@ -1572,6 +1572,13 @@ class Peernet {
|
|
|
1572
1572
|
return Object.entries(this.client.connections)
|
|
1573
1573
|
}
|
|
1574
1574
|
|
|
1575
|
+
/**
|
|
1576
|
+
* @return {String} id - peerId
|
|
1577
|
+
*/
|
|
1578
|
+
getConnection(id) {
|
|
1579
|
+
return this.client.connections[id]
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1575
1582
|
/**
|
|
1576
1583
|
* @private
|
|
1577
1584
|
*
|
|
@@ -1591,7 +1598,6 @@ class Peernet {
|
|
|
1591
1598
|
* @type {Map}
|
|
1592
1599
|
* @property {Object} peer Instance of Peer
|
|
1593
1600
|
*/
|
|
1594
|
-
this.peerMap = new Map();
|
|
1595
1601
|
this.stores = [];
|
|
1596
1602
|
this.requestProtos = {};
|
|
1597
1603
|
this.storePrefix = options.storePrefix;
|
|
@@ -1634,7 +1640,7 @@ class Peernet {
|
|
|
1634
1640
|
protocol: 'peernet-v0.1.0', host: '127.0.0.1', port: options.port
|
|
1635
1641
|
});
|
|
1636
1642
|
} else {
|
|
1637
|
-
const http = await Promise.resolve().then(function () { return require('./http-
|
|
1643
|
+
const http = await Promise.resolve().then(function () { return require('./http-68dd2b96.js'); });
|
|
1638
1644
|
if (environment !== 'browser') http.default(options);
|
|
1639
1645
|
}
|
|
1640
1646
|
|
|
@@ -1698,14 +1704,6 @@ class Peernet {
|
|
|
1698
1704
|
return this
|
|
1699
1705
|
}
|
|
1700
1706
|
|
|
1701
|
-
_getPeerId(id) {
|
|
1702
|
-
for (const entry of [...this.peerMap.entries()]) {
|
|
1703
|
-
for (const _id of entry[1]) {
|
|
1704
|
-
if (_id === id) return entry[0]
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
1707
|
addRequestHandler(name, method) {
|
|
1710
1708
|
this.requestProtos[name] = method;
|
|
1711
1709
|
}
|
package/dist/module/peernet.js
CHANGED
|
@@ -2138,7 +2138,7 @@ class Peernet {
|
|
|
2138
2138
|
Storage = globalThis.LeofcoinStorage?.default ? globalThis.LeofcoinStorage.default : LeofcoinStorage;
|
|
2139
2139
|
}
|
|
2140
2140
|
globalThis[`${name}Store`] = globalThis[`${name}Store`] ||
|
|
2141
|
-
await new Storage(
|
|
2141
|
+
await new Storage(name, root);
|
|
2142
2142
|
|
|
2143
2143
|
globalThis[`${name}Store`].private = isPrivate;
|
|
2144
2144
|
if (!isPrivate) this.stores.push(name);
|
|
@@ -2169,6 +2169,13 @@ class Peernet {
|
|
|
2169
2169
|
return Object.entries(this.client.connections)
|
|
2170
2170
|
}
|
|
2171
2171
|
|
|
2172
|
+
/**
|
|
2173
|
+
* @return {String} id - peerId
|
|
2174
|
+
*/
|
|
2175
|
+
getConnection(id) {
|
|
2176
|
+
return this.client.connections[id]
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2172
2179
|
/**
|
|
2173
2180
|
* @private
|
|
2174
2181
|
*
|
|
@@ -2188,7 +2195,6 @@ class Peernet {
|
|
|
2188
2195
|
* @type {Map}
|
|
2189
2196
|
* @property {Object} peer Instance of Peer
|
|
2190
2197
|
*/
|
|
2191
|
-
this.peerMap = new Map();
|
|
2192
2198
|
this.stores = [];
|
|
2193
2199
|
this.requestProtos = {};
|
|
2194
2200
|
this.storePrefix = options.storePrefix;
|
|
@@ -2287,14 +2293,6 @@ class Peernet {
|
|
|
2287
2293
|
return this
|
|
2288
2294
|
}
|
|
2289
2295
|
|
|
2290
|
-
_getPeerId(id) {
|
|
2291
|
-
for (const entry of [...this.peerMap.entries()]) {
|
|
2292
|
-
for (const _id of entry[1]) {
|
|
2293
|
-
if (_id === id) return entry[0]
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
2296
|
addRequestHandler(name, method) {
|
|
2299
2297
|
this.requestProtos[name] = method;
|
|
2300
2298
|
}
|
package/package.json
CHANGED
package/src/peernet.js
CHANGED
|
@@ -89,7 +89,7 @@ export default class Peernet {
|
|
|
89
89
|
Storage = globalThis.LeofcoinStorage?.default ? globalThis.LeofcoinStorage.default : LeofcoinStorage
|
|
90
90
|
}
|
|
91
91
|
globalThis[`${name}Store`] = globalThis[`${name}Store`] ||
|
|
92
|
-
await new Storage(
|
|
92
|
+
await new Storage(name, root)
|
|
93
93
|
|
|
94
94
|
globalThis[`${name}Store`].private = isPrivate
|
|
95
95
|
if (!isPrivate) this.stores.push(name)
|
|
@@ -120,6 +120,13 @@ export default class Peernet {
|
|
|
120
120
|
return Object.entries(this.client.connections)
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* @return {String} id - peerId
|
|
125
|
+
*/
|
|
126
|
+
getConnection(id) {
|
|
127
|
+
return this.client.connections[id]
|
|
128
|
+
}
|
|
129
|
+
|
|
123
130
|
/**
|
|
124
131
|
* @private
|
|
125
132
|
*
|
|
@@ -139,7 +146,6 @@ export default class Peernet {
|
|
|
139
146
|
* @type {Map}
|
|
140
147
|
* @property {Object} peer Instance of Peer
|
|
141
148
|
*/
|
|
142
|
-
this.peerMap = new Map()
|
|
143
149
|
this.stores = []
|
|
144
150
|
this.requestProtos = {}
|
|
145
151
|
this.storePrefix = options.storePrefix
|
|
@@ -239,14 +245,6 @@ export default class Peernet {
|
|
|
239
245
|
return this
|
|
240
246
|
}
|
|
241
247
|
|
|
242
|
-
_getPeerId(id) {
|
|
243
|
-
for (const entry of [...this.peerMap.entries()]) {
|
|
244
|
-
for (const _id of entry[1]) {
|
|
245
|
-
if (_id === id) return entry[0]
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
248
|
addRequestHandler(name, method) {
|
|
251
249
|
this.requestProtos[name] = method
|
|
252
250
|
}
|