@waku/core 0.0.23 → 0.0.24
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/CHANGELOG.md +34 -0
- package/bundle/{base_protocol-84d9b670.js → base_protocol-2a0c882e.js} +182 -130
- package/bundle/{browser-bde977a3.js → browser-90197c87.js} +26 -1
- package/bundle/index.js +19159 -2228
- package/bundle/lib/base_protocol.js +2 -2
- package/bundle/lib/message/version_0.js +2 -2
- package/bundle/{version_0-74b4b9db.js → version_0-f4afd324.js} +33 -21
- package/dist/.tsbuildinfo +1 -1
- package/dist/lib/connection_manager.d.ts +15 -3
- package/dist/lib/connection_manager.js +83 -25
- package/dist/lib/connection_manager.js.map +1 -1
- package/dist/lib/filter/index.js +25 -20
- package/dist/lib/filter/index.js.map +1 -1
- package/dist/lib/keep_alive_manager.d.ts +1 -0
- package/dist/lib/keep_alive_manager.js +38 -14
- package/dist/lib/keep_alive_manager.js.map +1 -1
- package/dist/lib/light_push/index.js +49 -31
- package/dist/lib/light_push/index.js.map +1 -1
- package/dist/lib/light_push/push_rpc.d.ts +1 -1
- package/dist/lib/light_push/push_rpc.js +2 -2
- package/dist/lib/message/version_0.d.ts +13 -13
- package/dist/lib/message/version_0.js +19 -16
- package/dist/lib/message/version_0.js.map +1 -1
- package/dist/lib/store/history_rpc.d.ts +1 -1
- package/dist/lib/store/history_rpc.js +1 -1
- package/dist/lib/store/index.d.ts +1 -1
- package/dist/lib/store/index.js +37 -10
- package/dist/lib/store/index.js.map +1 -1
- package/dist/lib/stream_manager.d.ts +1 -1
- package/dist/lib/stream_manager.js +5 -2
- package/dist/lib/stream_manager.js.map +1 -1
- package/dist/lib/wait_for_remote_peer.d.ts +2 -2
- package/dist/lib/wait_for_remote_peer.js +10 -7
- package/dist/lib/wait_for_remote_peer.js.map +1 -1
- package/dist/lib/waku.d.ts +4 -3
- package/dist/lib/waku.js +5 -3
- package/dist/lib/waku.js.map +1 -1
- package/package.json +8 -18
- package/src/lib/connection_manager.ts +118 -31
- package/src/lib/filter/index.ts +36 -23
- package/src/lib/keep_alive_manager.ts +49 -16
- package/src/lib/light_push/index.ts +56 -31
- package/src/lib/light_push/push_rpc.ts +2 -2
- package/src/lib/message/version_0.ts +22 -13
- package/src/lib/store/history_rpc.ts +2 -2
- package/src/lib/store/index.ts +53 -14
- package/src/lib/stream_manager.ts +7 -4
- package/src/lib/wait_for_remote_peer.ts +10 -7
- package/src/lib/waku.ts +4 -1
- package/dist/lib/push_or_init_map.d.ts +0 -1
- package/dist/lib/push_or_init_map.js +0 -9
- package/dist/lib/push_or_init_map.js.map +0 -1
- package/src/lib/push_or_init_map.ts +0 -13
package/CHANGELOG.md
CHANGED
@@ -5,6 +5,40 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The file is maintained by [Release Please](https://github.com/googleapis/release-please) based on [Conventional Commits](https://www.conventionalcommits.org) specification,
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.0.24](https://github.com/waku-org/js-waku/compare/core-v0.0.23...core-v0.0.24) (2023-10-16)
|
9
|
+
|
10
|
+
|
11
|
+
### ⚠ BREAKING CHANGES
|
12
|
+
|
13
|
+
* **store:** use `pubSubTopic` from `DecodedMessage` for `createCursor` ([#1640](https://github.com/waku-org/js-waku/issues/1640))
|
14
|
+
* **static-sharding:** allow multiple pubSubTopics ([#1586](https://github.com/waku-org/js-waku/issues/1586))
|
15
|
+
* return `REMOTE_PEER_REJECTED` if remote peer rejected the message
|
16
|
+
|
17
|
+
### Features
|
18
|
+
|
19
|
+
* Add Firefox and Webkit to karma ([#1598](https://github.com/waku-org/js-waku/issues/1598)) ([d9e4bcb](https://github.com/waku-org/js-waku/commit/d9e4bcbe3f7bcc092f20621bd362d76426701dab))
|
20
|
+
* Enable pinging connected peers by default ([#1647](https://github.com/waku-org/js-waku/issues/1647)) ([1d60c4b](https://github.com/waku-org/js-waku/commit/1d60c4ba44f7fd511371e926247d9151590edec5))
|
21
|
+
* Return `REMOTE_PEER_REJECTED` if remote peer rejected the message ([053b654](https://github.com/waku-org/js-waku/commit/053b6545ad0c2450af5687495eb7b6049c0f21ad))
|
22
|
+
* **static-sharding:** Allow multiple pubSubTopics ([#1586](https://github.com/waku-org/js-waku/issues/1586)) ([a3c45b6](https://github.com/waku-org/js-waku/commit/a3c45b6e1a9beae488cae3c71c48949fa47bcaf6))
|
23
|
+
* **static-sharding:** Filter peer connections per shards ([#1626](https://github.com/waku-org/js-waku/issues/1626)) ([124a29e](https://github.com/waku-org/js-waku/commit/124a29ebba59c05fbbf199d969e6ba3f9e57d45b))
|
24
|
+
|
25
|
+
|
26
|
+
### Bug Fixes
|
27
|
+
|
28
|
+
* Catch stream creation promise rejection for `lightPush.send` ([b696a89](https://github.com/waku-org/js-waku/commit/b696a8957211bf20577f419a207a23ceca03d23f))
|
29
|
+
* Catch top level exception when preemptively creating streams ([fb37c89](https://github.com/waku-org/js-waku/commit/fb37c89e40a9d7c98bef17a085876478486fca8b))
|
30
|
+
* **store:** Use `pubSubTopic` from `DecodedMessage` for `createCursor` ([#1640](https://github.com/waku-org/js-waku/issues/1640)) ([b10c46b](https://github.com/waku-org/js-waku/commit/b10c46b910511418a048d7092dfd8b500a71a931))
|
31
|
+
* Throw error when no response ([#1567](https://github.com/waku-org/js-waku/issues/1567)) ([d049ebb](https://github.com/waku-org/js-waku/commit/d049ebbc3417e5c20eccba3aa1b9fc5382e8d7fc))
|
32
|
+
|
33
|
+
|
34
|
+
### Dependencies
|
35
|
+
|
36
|
+
* The following workspace dependencies were updated
|
37
|
+
* dependencies
|
38
|
+
* @waku/enr bumped from ^0.0.17 to ^0.0.18
|
39
|
+
* @waku/interfaces bumped from 0.0.18 to 0.0.19
|
40
|
+
* @waku/utils bumped from 0.0.11 to 0.0.12
|
41
|
+
|
8
42
|
## [0.0.23](https://github.com/waku-org/js-waku/compare/core-v0.0.22...core-v0.0.23) (2023-09-11)
|
9
43
|
|
10
44
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { d as debug } from './browser-
|
1
|
+
import { d as debug } from './browser-90197c87.js';
|
2
2
|
|
3
3
|
// base-x encoding / decoding
|
4
4
|
// Copyright (c) 2018 base-x contributors
|
@@ -126,6 +126,25 @@ var src = base;
|
|
126
126
|
|
127
127
|
var _brrp__multiformats_scope_baseX = src;
|
128
128
|
|
129
|
+
/**
|
130
|
+
* @param {Uint8Array} aa
|
131
|
+
* @param {Uint8Array} bb
|
132
|
+
*/
|
133
|
+
const equals = (aa, bb) => {
|
134
|
+
if (aa === bb) return true
|
135
|
+
if (aa.byteLength !== bb.byteLength) {
|
136
|
+
return false
|
137
|
+
}
|
138
|
+
|
139
|
+
for (let ii = 0; ii < aa.byteLength; ii++) {
|
140
|
+
if (aa[ii] !== bb[ii]) {
|
141
|
+
return false
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
return true
|
146
|
+
};
|
147
|
+
|
129
148
|
/**
|
130
149
|
* @param {ArrayBufferView|ArrayBuffer|Uint8Array} o
|
131
150
|
* @returns {Uint8Array}
|
@@ -493,83 +512,22 @@ const rfc4648 = ({ name, prefix, bitsPerChar, alphabet }) => {
|
|
493
512
|
})
|
494
513
|
};
|
495
514
|
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
prefix: '\x00',
|
501
|
-
name: 'identity',
|
502
|
-
encode: (buf) => toString$1(buf),
|
503
|
-
decode: (str) => fromString$1(str)
|
504
|
-
});
|
505
|
-
|
506
|
-
var identityBase = /*#__PURE__*/Object.freeze({
|
507
|
-
__proto__: null,
|
508
|
-
identity: identity
|
509
|
-
});
|
510
|
-
|
511
|
-
// @ts-check
|
512
|
-
|
513
|
-
|
514
|
-
const base2 = rfc4648({
|
515
|
-
prefix: '0',
|
516
|
-
name: 'base2',
|
517
|
-
alphabet: '01',
|
518
|
-
bitsPerChar: 1
|
519
|
-
});
|
520
|
-
|
521
|
-
var base2$1 = /*#__PURE__*/Object.freeze({
|
522
|
-
__proto__: null,
|
523
|
-
base2: base2
|
524
|
-
});
|
525
|
-
|
526
|
-
// @ts-check
|
527
|
-
|
528
|
-
|
529
|
-
const base8 = rfc4648({
|
530
|
-
prefix: '7',
|
531
|
-
name: 'base8',
|
532
|
-
alphabet: '01234567',
|
533
|
-
bitsPerChar: 3
|
534
|
-
});
|
535
|
-
|
536
|
-
var base8$1 = /*#__PURE__*/Object.freeze({
|
537
|
-
__proto__: null,
|
538
|
-
base8: base8
|
539
|
-
});
|
540
|
-
|
541
|
-
const base10 = baseX({
|
542
|
-
prefix: '9',
|
543
|
-
name: 'base10',
|
544
|
-
alphabet: '0123456789'
|
545
|
-
});
|
546
|
-
|
547
|
-
var base10$1 = /*#__PURE__*/Object.freeze({
|
548
|
-
__proto__: null,
|
549
|
-
base10: base10
|
550
|
-
});
|
551
|
-
|
552
|
-
// @ts-check
|
553
|
-
|
554
|
-
|
555
|
-
const base16 = rfc4648({
|
556
|
-
prefix: 'f',
|
557
|
-
name: 'base16',
|
558
|
-
alphabet: '0123456789abcdef',
|
559
|
-
bitsPerChar: 4
|
515
|
+
const base58btc = baseX({
|
516
|
+
name: 'base58btc',
|
517
|
+
prefix: 'z',
|
518
|
+
alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
560
519
|
});
|
561
520
|
|
562
|
-
const
|
563
|
-
|
564
|
-
|
565
|
-
alphabet: '
|
566
|
-
bitsPerChar: 4
|
521
|
+
const base58flickr = baseX({
|
522
|
+
name: 'base58flickr',
|
523
|
+
prefix: 'Z',
|
524
|
+
alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
|
567
525
|
});
|
568
526
|
|
569
|
-
var
|
527
|
+
var base58 = /*#__PURE__*/Object.freeze({
|
570
528
|
__proto__: null,
|
571
|
-
|
572
|
-
|
529
|
+
base58btc: base58btc,
|
530
|
+
base58flickr: base58flickr
|
573
531
|
});
|
574
532
|
|
575
533
|
const base32 = rfc4648({
|
@@ -648,6 +606,98 @@ var base32$1 = /*#__PURE__*/Object.freeze({
|
|
648
606
|
base32z: base32z
|
649
607
|
});
|
650
608
|
|
609
|
+
const base10 = baseX({
|
610
|
+
prefix: '9',
|
611
|
+
name: 'base10',
|
612
|
+
alphabet: '0123456789'
|
613
|
+
});
|
614
|
+
|
615
|
+
var base10$1 = /*#__PURE__*/Object.freeze({
|
616
|
+
__proto__: null,
|
617
|
+
base10: base10
|
618
|
+
});
|
619
|
+
|
620
|
+
// @ts-check
|
621
|
+
|
622
|
+
|
623
|
+
const base16 = rfc4648({
|
624
|
+
prefix: 'f',
|
625
|
+
name: 'base16',
|
626
|
+
alphabet: '0123456789abcdef',
|
627
|
+
bitsPerChar: 4
|
628
|
+
});
|
629
|
+
|
630
|
+
const base16upper = rfc4648({
|
631
|
+
prefix: 'F',
|
632
|
+
name: 'base16upper',
|
633
|
+
alphabet: '0123456789ABCDEF',
|
634
|
+
bitsPerChar: 4
|
635
|
+
});
|
636
|
+
|
637
|
+
var base16$1 = /*#__PURE__*/Object.freeze({
|
638
|
+
__proto__: null,
|
639
|
+
base16: base16,
|
640
|
+
base16upper: base16upper
|
641
|
+
});
|
642
|
+
|
643
|
+
// @ts-check
|
644
|
+
|
645
|
+
|
646
|
+
const base2 = rfc4648({
|
647
|
+
prefix: '0',
|
648
|
+
name: 'base2',
|
649
|
+
alphabet: '01',
|
650
|
+
bitsPerChar: 1
|
651
|
+
});
|
652
|
+
|
653
|
+
var base2$1 = /*#__PURE__*/Object.freeze({
|
654
|
+
__proto__: null,
|
655
|
+
base2: base2
|
656
|
+
});
|
657
|
+
|
658
|
+
const alphabet = Array.from('🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂');
|
659
|
+
const alphabetBytesToChars = /** @type {string[]} */ (alphabet.reduce((p, c, i) => { p[i] = c; return p }, /** @type {string[]} */([])));
|
660
|
+
const alphabetCharsToBytes = /** @type {number[]} */ (alphabet.reduce((p, c, i) => { p[/** @type {number} */ (c.codePointAt(0))] = i; return p }, /** @type {number[]} */([])));
|
661
|
+
|
662
|
+
/**
|
663
|
+
* @param {Uint8Array} data
|
664
|
+
* @returns {string}
|
665
|
+
*/
|
666
|
+
function encode (data) {
|
667
|
+
return data.reduce((p, c) => {
|
668
|
+
p += alphabetBytesToChars[c];
|
669
|
+
return p
|
670
|
+
}, '')
|
671
|
+
}
|
672
|
+
|
673
|
+
/**
|
674
|
+
* @param {string} str
|
675
|
+
* @returns {Uint8Array}
|
676
|
+
*/
|
677
|
+
function decode (str) {
|
678
|
+
const byts = [];
|
679
|
+
for (const char of str) {
|
680
|
+
const byt = alphabetCharsToBytes[/** @type {number} */ (char.codePointAt(0))];
|
681
|
+
if (byt === undefined) {
|
682
|
+
throw new Error(`Non-base256emoji character: ${char}`)
|
683
|
+
}
|
684
|
+
byts.push(byt);
|
685
|
+
}
|
686
|
+
return new Uint8Array(byts)
|
687
|
+
}
|
688
|
+
|
689
|
+
const base256emoji = from({
|
690
|
+
prefix: '🚀',
|
691
|
+
name: 'base256emoji',
|
692
|
+
encode,
|
693
|
+
decode
|
694
|
+
});
|
695
|
+
|
696
|
+
var base256emoji$1 = /*#__PURE__*/Object.freeze({
|
697
|
+
__proto__: null,
|
698
|
+
base256emoji: base256emoji
|
699
|
+
});
|
700
|
+
|
651
701
|
const base36 = baseX({
|
652
702
|
prefix: 'k',
|
653
703
|
name: 'base36',
|
@@ -666,24 +716,6 @@ var base36$1 = /*#__PURE__*/Object.freeze({
|
|
666
716
|
base36upper: base36upper
|
667
717
|
});
|
668
718
|
|
669
|
-
const base58btc = baseX({
|
670
|
-
name: 'base58btc',
|
671
|
-
prefix: 'z',
|
672
|
-
alphabet: '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
|
673
|
-
});
|
674
|
-
|
675
|
-
const base58flickr = baseX({
|
676
|
-
name: 'base58flickr',
|
677
|
-
prefix: 'Z',
|
678
|
-
alphabet: '123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ'
|
679
|
-
});
|
680
|
-
|
681
|
-
var base58 = /*#__PURE__*/Object.freeze({
|
682
|
-
__proto__: null,
|
683
|
-
base58btc: base58btc,
|
684
|
-
base58flickr: base58flickr
|
685
|
-
});
|
686
|
-
|
687
719
|
// @ts-check
|
688
720
|
|
689
721
|
|
@@ -723,47 +755,34 @@ var base64$1 = /*#__PURE__*/Object.freeze({
|
|
723
755
|
base64urlpad: base64urlpad
|
724
756
|
});
|
725
757
|
|
726
|
-
|
727
|
-
const alphabetBytesToChars = /** @type {string[]} */ (alphabet.reduce((p, c, i) => { p[i] = c; return p }, /** @type {string[]} */([])));
|
728
|
-
const alphabetCharsToBytes = /** @type {number[]} */ (alphabet.reduce((p, c, i) => { p[/** @type {number} */ (c.codePointAt(0))] = i; return p }, /** @type {number[]} */([])));
|
758
|
+
// @ts-check
|
729
759
|
|
730
|
-
/**
|
731
|
-
* @param {Uint8Array} data
|
732
|
-
* @returns {string}
|
733
|
-
*/
|
734
|
-
function encode (data) {
|
735
|
-
return data.reduce((p, c) => {
|
736
|
-
p += alphabetBytesToChars[c];
|
737
|
-
return p
|
738
|
-
}, '')
|
739
|
-
}
|
740
760
|
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
for (const char of str) {
|
748
|
-
const byt = alphabetCharsToBytes[/** @type {number} */ (char.codePointAt(0))];
|
749
|
-
if (byt === undefined) {
|
750
|
-
throw new Error(`Non-base256emoji character: ${char}`)
|
751
|
-
}
|
752
|
-
byts.push(byt);
|
753
|
-
}
|
754
|
-
return new Uint8Array(byts)
|
755
|
-
}
|
761
|
+
const base8 = rfc4648({
|
762
|
+
prefix: '7',
|
763
|
+
name: 'base8',
|
764
|
+
alphabet: '01234567',
|
765
|
+
bitsPerChar: 3
|
766
|
+
});
|
756
767
|
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
encode,
|
761
|
-
decode
|
768
|
+
var base8$1 = /*#__PURE__*/Object.freeze({
|
769
|
+
__proto__: null,
|
770
|
+
base8: base8
|
762
771
|
});
|
763
772
|
|
764
|
-
|
773
|
+
// @ts-check
|
774
|
+
|
775
|
+
|
776
|
+
const identity = from({
|
777
|
+
prefix: '\x00',
|
778
|
+
name: 'identity',
|
779
|
+
encode: (buf) => toString$1(buf),
|
780
|
+
decode: (str) => fromString$1(str)
|
781
|
+
});
|
782
|
+
|
783
|
+
var identityBase = /*#__PURE__*/Object.freeze({
|
765
784
|
__proto__: null,
|
766
|
-
|
785
|
+
identity: identity
|
767
786
|
});
|
768
787
|
|
769
788
|
// @ts-check
|
@@ -906,11 +925,41 @@ var Protocols;
|
|
906
925
|
})(Protocols || (Protocols = {}));
|
907
926
|
var SendError;
|
908
927
|
(function (SendError) {
|
928
|
+
/** Could not determine the origin of the fault. Best to check connectivity and try again */
|
909
929
|
SendError["GENERIC_FAIL"] = "Generic error";
|
930
|
+
/** Failure to protobuf encode the message. This is not recoverable and needs
|
931
|
+
* further investigation. */
|
910
932
|
SendError["ENCODE_FAILED"] = "Failed to encode";
|
933
|
+
/** Failure to protobuf decode the message. May be due to a remote peer issue,
|
934
|
+
* ensuring that messages are sent via several peer enable mitigation of this error.. */
|
911
935
|
SendError["DECODE_FAILED"] = "Failed to decode";
|
936
|
+
/** The message size is above the maximum message size allowed on the Waku Network.
|
937
|
+
* Compressing the message or using an alternative strategy for large messages is recommended.
|
938
|
+
*/
|
912
939
|
SendError["SIZE_TOO_BIG"] = "Size is too big";
|
913
|
-
|
940
|
+
/**
|
941
|
+
* The PubSubTopic passed to the send function is not configured on the Waku node.
|
942
|
+
* Please ensure that the PubSubTopic is used when initializing the Waku node.
|
943
|
+
*/
|
944
|
+
SendError["TOPIC_NOT_CONFIGURED"] = "Topic not configured";
|
945
|
+
/**
|
946
|
+
* Failure to find a peer with suitable protocols. This may due to a connection issue.
|
947
|
+
* Mitigation can be: retrying after a given time period, display connectivity issue
|
948
|
+
* to user or listening for `peer:connected:bootstrap` or `peer:connected:peer-exchange`
|
949
|
+
* on the connection manager before retrying.
|
950
|
+
*/
|
951
|
+
SendError["NO_PEER_AVAILABLE"] = "No peer available";
|
952
|
+
/**
|
953
|
+
* The remote peer did not behave as expected. Mitigation for `NO_PEER_AVAILABLE`
|
954
|
+
* or `DECODE_FAILED` can be used.
|
955
|
+
*/
|
956
|
+
SendError["REMOTE_PEER_FAULT"] = "Remote peer fault";
|
957
|
+
/**
|
958
|
+
* The remote peer rejected the message. Information provided by the remote peer
|
959
|
+
* is logged. Review message validity, or mitigation for `NO_PEER_AVAILABLE`
|
960
|
+
* or `DECODE_FAILED` can be used.
|
961
|
+
*/
|
962
|
+
SendError["REMOTE_PEER_REJECTED"] = "Remote peer rejected";
|
914
963
|
})(SendError || (SendError = {}));
|
915
964
|
|
916
965
|
var PageDirection;
|
@@ -1114,7 +1163,7 @@ class StreamManager {
|
|
1114
1163
|
this.streamPool.delete(peerIdStr);
|
1115
1164
|
this.prepareNewStream(peer);
|
1116
1165
|
const stream = await streamPromise;
|
1117
|
-
if (stream.status === "closed") {
|
1166
|
+
if (!stream || stream.status === "closed") {
|
1118
1167
|
return this.newStream(peer); // fallback by creating a new stream on the spot
|
1119
1168
|
}
|
1120
1169
|
return stream;
|
@@ -1128,7 +1177,10 @@ class StreamManager {
|
|
1128
1177
|
return connection.newStream(this.multicodec);
|
1129
1178
|
}
|
1130
1179
|
prepareNewStream(peer) {
|
1131
|
-
const streamPromise = this.newStream(peer)
|
1180
|
+
const streamPromise = this.newStream(peer).catch(() => {
|
1181
|
+
// No error thrown as this call is not triggered by the user
|
1182
|
+
this.log(`Failed to prepare a new stream for ${peer.id.toString()}`);
|
1183
|
+
});
|
1132
1184
|
this.streamPool.set(peer.id.toString(), streamPromise);
|
1133
1185
|
}
|
1134
1186
|
handlePeerUpdateStreamPool = (evt) => {
|
@@ -1195,4 +1247,4 @@ class BaseProtocol {
|
|
1195
1247
|
}
|
1196
1248
|
}
|
1197
1249
|
|
1198
|
-
export { BaseProtocol as B, EPeersByDiscoveryEvents as E, Protocols as P, SendError as S, Tags as T,
|
1250
|
+
export { BaseProtocol as B, EPeersByDiscoveryEvents as E, Protocols as P, SendError as S, Tags as T, base58btc as a, base32 as b, coerce as c, allocUnsafe as d, equals as e, asUint8Array as f, bases as g, fromString as h, alloc as i, concat as j, StreamManager as k, toString as t, utf8ToBytes as u };
|
@@ -4,6 +4,31 @@ function getDefaultExportFromCjs (x) {
|
|
4
4
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
5
5
|
}
|
6
6
|
|
7
|
+
function getAugmentedNamespace(n) {
|
8
|
+
if (n.__esModule) return n;
|
9
|
+
var f = n.default;
|
10
|
+
if (typeof f == "function") {
|
11
|
+
var a = function a () {
|
12
|
+
if (this instanceof a) {
|
13
|
+
return Reflect.construct(f, arguments, this.constructor);
|
14
|
+
}
|
15
|
+
return f.apply(this, arguments);
|
16
|
+
};
|
17
|
+
a.prototype = f.prototype;
|
18
|
+
} else a = {};
|
19
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
20
|
+
Object.keys(n).forEach(function (k) {
|
21
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
22
|
+
Object.defineProperty(a, k, d.get ? d : {
|
23
|
+
enumerable: true,
|
24
|
+
get: function () {
|
25
|
+
return n[k];
|
26
|
+
}
|
27
|
+
});
|
28
|
+
});
|
29
|
+
return a;
|
30
|
+
}
|
31
|
+
|
7
32
|
var browser = {exports: {}};
|
8
33
|
|
9
34
|
/**
|
@@ -726,4 +751,4 @@ var common = setup;
|
|
726
751
|
var browserExports = browser.exports;
|
727
752
|
var debug = /*@__PURE__*/getDefaultExportFromCjs(browserExports);
|
728
753
|
|
729
|
-
export { commonjsGlobal as c, debug as d,
|
754
|
+
export { getDefaultExportFromCjs as a, commonjsGlobal as c, debug as d, getAugmentedNamespace as g };
|