@leofcoin/peernet 1.1.28 → 1.1.29

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 { g as getDefaultExportFromCjs, c as commonjsGlobal } from './peernet-54d061e3.js';
1
+ import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './peernet-c9f2ef1e.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  function commonjsRequire(path) {
@@ -1,4 +1,4 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-54d061e3.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-c9f2ef1e.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './peernet-54d061e3.js';
1
+ import { F as FormatInterface } from './peernet-c9f2ef1e.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  var proto$b = {
@@ -20184,7 +20184,7 @@ class Identity {
20184
20184
  globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
20185
20185
  }
20186
20186
  else {
20187
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-5ed49438.js');
20187
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-ff3a61f6.js');
20188
20188
  const { identity, accounts } = await importee.default(password, this.network);
20189
20189
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
20190
20190
  await globalThis.walletStore.put('version', String(1));
@@ -20355,7 +20355,7 @@ class Peernet {
20355
20355
  this.root = options.root;
20356
20356
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
20357
20357
  // FolderMessageResponse
20358
- } = await import(/* webpackChunkName: "messages" */ './messages-c26f8e97.js');
20358
+ } = await import(/* webpackChunkName: "messages" */ './messages-8b773ecf.js');
20359
20359
  /**
20360
20360
  * proto Object containing protos
20361
20361
  * @type {Object}
@@ -20434,7 +20434,7 @@ class Peernet {
20434
20434
  if (this.#starting || this.#started)
20435
20435
  return;
20436
20436
  this.#starting = true;
20437
- const importee = await import('./client-345f1d43.js');
20437
+ const importee = await import('./client-0ebd5821.js');
20438
20438
  /**
20439
20439
  * @access public
20440
20440
  * @type {PeernetClient}
@@ -20445,7 +20445,7 @@ class Peernet {
20445
20445
  }
20446
20446
  #peerLeft(peer) {
20447
20447
  for (const [id, _peer] of Object.entries(this.#connections)) {
20448
- if (_peer.id === peer.id) {
20448
+ if (_peer.id === peer.id && this.#connections[id] && !this.#connections[id].connected) {
20449
20449
  delete this.#connections[id];
20450
20450
  this.removePeer(_peer);
20451
20451
  }
@@ -1,2 +1,2 @@
1
- export { P as default } from './peernet-54d061e3.js';
1
+ export { P as default } from './peernet-c9f2ef1e.js';
2
2
  import './value-157ab062.js';
@@ -603,7 +603,7 @@ class Peernet {
603
603
  }
604
604
  #peerLeft(peer) {
605
605
  for (const [id, _peer] of Object.entries(this.#connections)) {
606
- if (_peer.id === peer.id) {
606
+ if (_peer.id === peer.id && this.#connections[id] && !this.#connections[id].connected) {
607
607
  delete this.#connections[id];
608
608
  this.removePeer(_peer);
609
609
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "description": "",
5
5
  "main": "src/peernet.js",
6
6
  "exports": {
package/src/peernet.ts CHANGED
@@ -288,7 +288,7 @@ export default class Peernet {
288
288
 
289
289
  #peerLeft(peer) {
290
290
  for (const [id, _peer] of Object.entries(this.#connections)) {
291
- if (_peer.id === peer.id) {
291
+ if (_peer.id === peer.id && this.#connections[id] && !this.#connections[id].connected) {
292
292
  delete this.#connections[id]
293
293
  this.removePeer(_peer)
294
294
  }
package/test.js CHANGED
@@ -12,6 +12,11 @@ import Client from './exports/peernet.js'
12
12
  pubsub.subscribe('peer:data', (data) => {
13
13
  console.log(data);
14
14
  })
15
+
16
+ setInterval(() => {
17
+ console.log(`connections: ${peernet.connections.length}`);
18
+ console.log(`discovered: ${Object.keys(peernet.client.discovered).length}`);
19
+ }, 3000)
15
20
  // peernet.addFolder([{
16
21
  // path: 'assets/asset.png',
17
22
  // content: Buffer.from('png')