mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-12 10:47:13 +00:00
chore: merge typedefs newest updates
This commit is contained in:
commit
c4bb3faf0c
@ -24,6 +24,7 @@ const transportSymbol = Symbol.for('@libp2p/js-libp2p-circuit/circuit')
|
||||
* @typedef {import('multiaddr')} Multiaddr
|
||||
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
|
||||
* @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream
|
||||
* @typedef {import('../types').CircuitRequest} CircuitRequest
|
||||
*/
|
||||
|
||||
class Circuit {
|
||||
@ -53,6 +54,7 @@ class Circuit {
|
||||
* @param {MuxedStream} props.stream
|
||||
*/
|
||||
async _onProtocol ({ connection, stream }) {
|
||||
/** @type {import('./circuit/stream-handler')<CircuitRequest>} */
|
||||
const streamHandler = new StreamHandler({ stream })
|
||||
const request = await streamHandler.read()
|
||||
|
||||
|
@ -394,7 +394,7 @@ class Libp2p extends EventEmitter {
|
||||
*
|
||||
* @async
|
||||
* @param {PeerId|Multiaddr|string} peer - The peer to dial
|
||||
* @param {null|string[]|string} protocols
|
||||
* @param {string[]|string} protocols
|
||||
* @param {object} [options]
|
||||
* @param {AbortSignal} [options.signal]
|
||||
* @returns {Promise<Connection|*>}
|
||||
|
@ -65,10 +65,14 @@ class PeerRecord {
|
||||
/**
|
||||
* Returns true if `this` record equals the `other`.
|
||||
*
|
||||
* @param {PeerRecord} other
|
||||
* @returns {other is Record}
|
||||
* @param {unknown} other
|
||||
* @returns {boolean}
|
||||
*/
|
||||
equals (other) {
|
||||
if (!(other instanceof PeerRecord)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Validate PeerId
|
||||
if (!this.peerId.equals(other.peerId)) {
|
||||
return false
|
||||
|
Loading…
x
Reference in New Issue
Block a user