@leofcoin/peernet 1.1.88 → 1.1.90

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 { L as LittlePubSub } from './peernet-CZhvkXXp.js';
1
+ import { L as LittlePubSub } from './peernet-plahMKpJ.js';
2
2
  import './identity-Cn0iQbY3.js';
3
3
  import './value-C3vAp-wb.js';
4
4
 
@@ -526,6 +526,22 @@ class Client {
526
526
  }
527
527
  debug(`peer ${id} left`);
528
528
  };
529
+ connect(peerId, star, initiator = true) {
530
+ if (this.#connections[peerId]) {
531
+ debug(`peer ${peerId} already connected`);
532
+ return;
533
+ }
534
+ if (this.#stars[star]?.connectionState() !== 'open') {
535
+ console.warn(`Star ${star} is not connected, cannot reconnect to peer ${peerId}`);
536
+ return;
537
+ }
538
+ this.#createRTCPeerConnection(peerId, star, this.version, initiator);
539
+ }
540
+ reconnect(peerId, star, initiator = true) {
541
+ delete this.#connections[peerId];
542
+ debug(`reconnecting to peer ${peerId}`);
543
+ return this.connect(peerId, star, initiator);
544
+ }
529
545
  #createRTCPeerConnection = (peerId, star, version, initiator = false) => {
530
546
  const peer = new Peer({
531
547
  initiator: initiator,
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './peernet-CZhvkXXp.js';
1
+ import { F as FormatInterface } from './peernet-plahMKpJ.js';
2
2
  import './identity-Cn0iQbY3.js';
3
3
  import './value-C3vAp-wb.js';
4
4
 
@@ -8371,7 +8371,7 @@ class Peernet {
8371
8371
  this.root = options.root;
8372
8372
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
8373
8373
  // FolderMessageResponse
8374
- } = await import(/* webpackChunkName: "messages" */ './messages-D9OyBKBu.js');
8374
+ } = await import(/* webpackChunkName: "messages" */ './messages-CWqbyda0.js');
8375
8375
  /**
8376
8376
  * proto Object containing protos
8377
8377
  * @type {Object}
@@ -8465,7 +8465,7 @@ class Peernet {
8465
8465
  if (this.#starting || this.#started)
8466
8466
  return;
8467
8467
  this.#starting = true;
8468
- const importee = await import('./client-D7CuvpPv.js');
8468
+ const importee = await import('./client-D9SOK3zV.js');
8469
8469
  /**
8470
8470
  * @access public
8471
8471
  * @type {PeernetClient}
@@ -1,3 +1,3 @@
1
- export { P as default } from './peernet-CZhvkXXp.js';
1
+ export { P as default } from './peernet-plahMKpJ.js';
2
2
  import './identity-Cn0iQbY3.js';
3
3
  import './value-C3vAp-wb.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "1.1.88",
3
+ "version": "1.1.90",
4
4
  "description": "",
5
5
  "browser": "./exports/browser/peernet.js",
6
6
  "exports": {