@leofcoin/peernet 1.1.100 → 1.1.101

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-CP4375lb.js';
1
+ import { L as LittlePubSub } from './peernet-CnZz_eNn.js';
2
2
  import './identity-Cn0iQbY3.js';
3
3
  import './value-C3vAp-wb.js';
4
4
 
@@ -428,7 +428,6 @@ class Client {
428
428
  #connections = {};
429
429
  #stars = {};
430
430
  #starListeners = {};
431
- #handlersSetup = false;
432
431
  #reinitLock = null;
433
432
  #connectEvent = 'peer:connected';
434
433
  #retryOptions = { retries: 5, factor: 2, minTimeout: 1000, maxTimeout: 30000 };
@@ -561,8 +560,6 @@ class Client {
561
560
  else {
562
561
  globalThis.addEventListener('beforeunload', this.close.bind(this));
563
562
  }
564
- // Setup resume/sleep detection so we can reinit connections after wake
565
- this._setupResumeHandler();
566
563
  }
567
564
  setupStarListeners(starConnection, starId) {
568
565
  // create stable references to handlers so we can unsubscribe later
@@ -584,46 +581,6 @@ class Client {
584
581
  { topic: 'signal', handler: onSignal }
585
582
  ];
586
583
  }
587
- _setupResumeHandler() {
588
- if (this.#handlersSetup)
589
- return;
590
- this.#handlersSetup = true;
591
- const THRESHOLD = 10 * 1000; // 10s gap indicates sleep/wake
592
- let last = Date.now();
593
- const check = () => {
594
- const now = Date.now();
595
- const delta = now - last;
596
- last = now;
597
- if (delta > THRESHOLD) {
598
- debug(`resume detected (gap ${delta}ms)`);
599
- this.reinit().catch((e) => debug('reinit error', e));
600
- }
601
- };
602
- // Start interval checker
603
- const iv = setInterval(check, 2000);
604
- // Browser specific events
605
- if (typeof document !== 'undefined' && document.addEventListener) {
606
- document.addEventListener('visibilitychange', () => {
607
- if (document.visibilityState === 'visible') {
608
- // small delay to let timers update
609
- setTimeout(() => check(), 50);
610
- }
611
- });
612
- window.addEventListener('online', () => setTimeout(() => check(), 50));
613
- }
614
- // Node: listen for SIGCONT (process continued) as well
615
- if (globalThis.process?.on) {
616
- try {
617
- process.on('SIGCONT', () => setTimeout(() => check(), 50));
618
- }
619
- catch (e) {
620
- // ignore
621
- }
622
- }
623
- // keep reference so it can be cleared on close
624
- // @ts-ignore
625
- this._resumeInterval = iv;
626
- }
627
584
  #starJoined = (id) => {
628
585
  if (this.#stars[id]) {
629
586
  this.#stars[id].close(0);
@@ -742,7 +699,8 @@ class Client {
742
699
  to: peer.peerId,
743
700
  channelName: peer.channelName,
744
701
  version,
745
- signal
702
+ signal,
703
+ initiator: peer.initiator
746
704
  }
747
705
  });
748
706
  };
@@ -824,10 +782,6 @@ class Client {
824
782
  }
825
783
  }
826
784
  }
827
- // Ensure we wait for all peer and star close/destroy operations.
828
- // Previous code passed an array of arrays to Promise.allSettled which
829
- // resolves immediately; flatten into a single array of promises (or
830
- // values) so we actually wait for async close operations.
831
785
  const peerClosers = Object.values(this.#connections).map((connection) => {
832
786
  try {
833
787
  // destroy() may be sync or return a promise
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './peernet-CP4375lb.js';
1
+ import { F as FormatInterface } from './peernet-CnZz_eNn.js';
2
2
  import './identity-Cn0iQbY3.js';
3
3
  import './value-C3vAp-wb.js';
4
4
 
@@ -8366,7 +8366,7 @@ class Peernet {
8366
8366
  this.root = options.root;
8367
8367
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
8368
8368
  // FolderMessageResponse
8369
- } = await import(/* webpackChunkName: "messages" */ './messages-Bx4w-Pqo.js');
8369
+ } = await import(/* webpackChunkName: "messages" */ './messages-DYI_YkZS.js');
8370
8370
  /**
8371
8371
  * proto Object containing protos
8372
8372
  * @type {Object}
@@ -8460,7 +8460,7 @@ class Peernet {
8460
8460
  if (this.#starting || this.#started)
8461
8461
  return;
8462
8462
  this.#starting = true;
8463
- const importee = await import('./client-DgmVTCEc.js');
8463
+ const importee = await import('./client-C6OfbHKI.js');
8464
8464
  /**
8465
8465
  * @access public
8466
8466
  * @type {PeernetClient}
@@ -1,3 +1,3 @@
1
- export { P as default } from './peernet-CP4375lb.js';
1
+ export { P as default } from './peernet-CnZz_eNn.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.100",
3
+ "version": "1.1.101",
4
4
  "description": "",
5
5
  "browser": "./exports/browser/peernet.js",
6
6
  "exports": {
@@ -37,7 +37,7 @@
37
37
  "@leofcoin/identity-utils": "^1.0.2",
38
38
  "@leofcoin/multi-wallet": "^3.1.8",
39
39
  "@leofcoin/storage": "^3.5.38",
40
- "@netpeer/swarm": "^0.8.30",
40
+ "@netpeer/swarm": "^0.8.31",
41
41
  "@vandeurenglenn/base32": "^1.2.4",
42
42
  "@vandeurenglenn/base58": "^1.1.9",
43
43
  "@vandeurenglenn/debug": "^1.2.6",
@@ -55,7 +55,7 @@
55
55
  "@rollup/plugin-commonjs": "^28.0.8",
56
56
  "@rollup/plugin-json": "^6.1.0",
57
57
  "@rollup/plugin-node-resolve": "^16.0.3",
58
- "@rollup/plugin-typescript": "^12.2.0",
58
+ "@rollup/plugin-typescript": "^12.3.0",
59
59
  "@rollup/plugin-wasm": "^6.2.2",
60
60
  "@types/bs58check": "^3.0.1",
61
61
  "@types/node": "^24.9.1",