@leofcoin/peernet 1.1.68 → 1.1.69

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.
@@ -1,4 +1,4 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-b93a3e33.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-4d189113.js';
2
2
  import './value-4e80eeeb.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './peernet-b93a3e33.js';
1
+ import { F as FormatInterface } from './peernet-4d189113.js';
2
2
  import './value-4e80eeeb.js';
3
3
 
4
4
  var proto$b = {
@@ -27088,7 +27088,7 @@ class Identity {
27088
27088
  this.selectedAccount = new TextDecoder().decode(selected);
27089
27089
  }
27090
27090
  else {
27091
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-e6b55b51.js');
27091
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-7dedefe5.js');
27092
27092
  const { identity, accounts } = await importee.default(password, this.network);
27093
27093
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
27094
27094
  await globalThis.walletStore.put('version', String(1));
@@ -27255,13 +27255,10 @@ class Peernet {
27255
27255
  * @return {Array} peerId
27256
27256
  */
27257
27257
  get peers() {
27258
- return Object.entries(this.client.connections);
27258
+ return Object.entries(this.client?.connections);
27259
27259
  }
27260
27260
  get connections() {
27261
- return this.client.connections;
27262
- }
27263
- get peerEntries() {
27264
- return Object.values(this.client.connections);
27261
+ return this.client?.connections || {};
27265
27262
  }
27266
27263
  /**
27267
27264
  * @return {String} id - peerId
@@ -27282,7 +27279,7 @@ class Peernet {
27282
27279
  this.root = options.root;
27283
27280
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
27284
27281
  // FolderMessageResponse
27285
- } = await import(/* webpackChunkName: "messages" */ './messages-606d459f.js');
27282
+ } = await import(/* webpackChunkName: "messages" */ './messages-7cab2a51.js');
27286
27283
  /**
27287
27284
  * proto Object containing protos
27288
27285
  * @type {Object}
@@ -28051,16 +28048,15 @@ class Peernet {
28051
28048
  }
28052
28049
  async removePeer(peer) {
28053
28050
  console.log('removepeer', peer.id);
28054
- const id = peer.id;
28055
- await this.client._removePeer(peer);
28056
- if (this.client.peers[id]) {
28057
- for (const connection of Object.keys(this.client.peers[id])) {
28058
- // if (this.client.peers[id][connection].connected === false) delete this.client.peers[id][connection]
28059
- // @ts-ignore
28060
- if (this.client.peers[id][connection].connected)
28061
- return this.client.emit('peerconnect', connection);
28062
- }
28063
- }
28051
+ peer.id;
28052
+ // await this.client.connections(peer)
28053
+ // if (this.client.peers[id]) {
28054
+ // for (const connection of Object.keys(this.client.peers[id])) {
28055
+ // // if (this.client.peers[id][connection].connected === false) delete this.client.peers[id][connection]
28056
+ // // @ts-ignore
28057
+ // if (this.client.peers[id][connection].connected) return this.client.emit('peerconnect', connection)
28058
+ // }
28059
+ // }
28064
28060
  }
28065
28061
  get Buffer() {
28066
28062
  return Buffer;
@@ -7,7 +7,6 @@ import MessageHandler from './handlers/message.js';
7
7
  import { Storage as LeofcoinStorageClass } from '@leofcoin/storage';
8
8
  import Identity from './identity.js';
9
9
  import swarm from '@netpeer/swarm/client';
10
- import SwarmPeer from '@netpeer/swarm/peer';
11
10
  declare global {
12
11
  var LeofcoinStorage: typeof LeofcoinStorageClass;
13
12
  var peernet: Peernet;
@@ -85,15 +84,14 @@ export default class Peernet {
85
84
  *
86
85
  * @return {Array} peerId
87
86
  */
88
- get peers(): [string, SwarmPeer][];
87
+ get peers(): [string, import("@netpeer/swarm/peer").default][];
89
88
  get connections(): {
90
- [x: string]: SwarmPeer;
89
+ [x: string]: import("@netpeer/swarm/peer").default;
91
90
  };
92
- get peerEntries(): SwarmPeer[];
93
91
  /**
94
92
  * @return {String} id - peerId
95
93
  */
96
- getConnection(id: any): SwarmPeer;
94
+ getConnection(id: any): import("@netpeer/swarm/peer").default;
97
95
  /**
98
96
  * @private
99
97
  *
@@ -243,6 +241,6 @@ export default class Peernet {
243
241
  * @param {Method} cb
244
242
  */
245
243
  subscribe(topic: string, callback: Function): Promise<void>;
246
- removePeer(peer: any): Promise<any>;
244
+ removePeer(peer: any): Promise<void>;
247
245
  get Buffer(): BufferConstructor;
248
246
  }
@@ -1,2 +1,2 @@
1
- export { P as default } from './peernet-b93a3e33.js';
1
+ export { P as default } from './peernet-4d189113.js';
2
2
  import './value-4e80eeeb.js';
@@ -516,13 +516,10 @@ class Peernet {
516
516
  * @return {Array} peerId
517
517
  */
518
518
  get peers() {
519
- return Object.entries(this.client.connections);
519
+ return Object.entries(this.client?.connections);
520
520
  }
521
521
  get connections() {
522
- return this.client.connections;
523
- }
524
- get peerEntries() {
525
- return Object.values(this.client.connections);
522
+ return this.client?.connections || {};
526
523
  }
527
524
  /**
528
525
  * @return {String} id - peerId
@@ -1081,16 +1078,15 @@ class Peernet {
1081
1078
  }
1082
1079
  async removePeer(peer) {
1083
1080
  console.log('removepeer', peer.id);
1084
- const id = peer.id;
1085
- await this.client._removePeer(peer);
1086
- if (this.client.peers[id]) {
1087
- for (const connection of Object.keys(this.client.peers[id])) {
1088
- // if (this.client.peers[id][connection].connected === false) delete this.client.peers[id][connection]
1089
- // @ts-ignore
1090
- if (this.client.peers[id][connection].connected)
1091
- return this.client.emit('peerconnect', connection);
1092
- }
1093
- }
1081
+ peer.id;
1082
+ // await this.client.connections(peer)
1083
+ // if (this.client.peers[id]) {
1084
+ // for (const connection of Object.keys(this.client.peers[id])) {
1085
+ // // if (this.client.peers[id][connection].connected === false) delete this.client.peers[id][connection]
1086
+ // // @ts-ignore
1087
+ // if (this.client.peers[id][connection].connected) return this.client.emit('peerconnect', connection)
1088
+ // }
1089
+ // }
1094
1090
  }
1095
1091
  get Buffer() {
1096
1092
  return Buffer;
@@ -7,7 +7,6 @@ import MessageHandler from './handlers/message.js';
7
7
  import { Storage as LeofcoinStorageClass } from '@leofcoin/storage';
8
8
  import Identity from './identity.js';
9
9
  import swarm from '@netpeer/swarm/client';
10
- import SwarmPeer from '@netpeer/swarm/peer';
11
10
  declare global {
12
11
  var LeofcoinStorage: typeof LeofcoinStorageClass;
13
12
  var peernet: Peernet;
@@ -85,15 +84,14 @@ export default class Peernet {
85
84
  *
86
85
  * @return {Array} peerId
87
86
  */
88
- get peers(): [string, SwarmPeer][];
87
+ get peers(): [string, import("@netpeer/swarm/peer").default][];
89
88
  get connections(): {
90
- [x: string]: SwarmPeer;
89
+ [x: string]: import("@netpeer/swarm/peer").default;
91
90
  };
92
- get peerEntries(): SwarmPeer[];
93
91
  /**
94
92
  * @return {String} id - peerId
95
93
  */
96
- getConnection(id: any): SwarmPeer;
94
+ getConnection(id: any): import("@netpeer/swarm/peer").default;
97
95
  /**
98
96
  * @private
99
97
  *
@@ -243,6 +241,6 @@ export default class Peernet {
243
241
  * @param {Method} cb
244
242
  */
245
243
  subscribe(topic: string, callback: Function): Promise<void>;
246
- removePeer(peer: any): Promise<any>;
244
+ removePeer(peer: any): Promise<void>;
247
245
  get Buffer(): BufferConstructor;
248
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "1.1.68",
3
+ "version": "1.1.69",
4
4
  "description": "",
5
5
  "main": "src/peernet.js",
6
6
  "exports": {
package/src/peernet.ts CHANGED
@@ -10,7 +10,6 @@ import { Storage as LeofcoinStorageClass } from '@leofcoin/storage'
10
10
  import { utils as codecUtils } from '@leofcoin/codecs'
11
11
  import Identity from './identity.js'
12
12
  import swarm from '@netpeer/swarm/client'
13
- import SwarmPeer from '@netpeer/swarm/peer'
14
13
 
15
14
  globalThis.LeofcoinStorage = LeofcoinStorageClass
16
15
 
@@ -164,15 +163,11 @@ export default class Peernet {
164
163
  * @return {Array} peerId
165
164
  */
166
165
  get peers() {
167
- return Object.entries(this.client.connections)
166
+ return Object.entries(this.client?.connections)
168
167
  }
169
168
 
170
169
  get connections() {
171
- return this.client.connections
172
- }
173
-
174
- get peerEntries() {
175
- return Object.values(this.client.connections)
170
+ return this.client?.connections || {}
176
171
  }
177
172
 
178
173
  /**
@@ -784,14 +779,14 @@ export default class Peernet {
784
779
  async removePeer(peer) {
785
780
  console.log('removepeer', peer.id)
786
781
  const id = peer.id
787
- await this.client._removePeer(peer)
788
- if (this.client.peers[id]) {
789
- for (const connection of Object.keys(this.client.peers[id])) {
790
- // if (this.client.peers[id][connection].connected === false) delete this.client.peers[id][connection]
791
- // @ts-ignore
792
- if (this.client.peers[id][connection].connected) return this.client.emit('peerconnect', connection)
793
- }
794
- }
782
+ // await this.client.connections(peer)
783
+ // if (this.client.peers[id]) {
784
+ // for (const connection of Object.keys(this.client.peers[id])) {
785
+ // // if (this.client.peers[id][connection].connected === false) delete this.client.peers[id][connection]
786
+ // // @ts-ignore
787
+ // if (this.client.peers[id][connection].connected) return this.client.emit('peerconnect', connection)
788
+ // }
789
+ // }
795
790
  }
796
791
 
797
792
  get Buffer() {