diff --git a/package.json b/package.json index d728b8bd0..0993dfe20 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "release": "npm run docs:no-publish && aegir run release && npm run docs" }, "dependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "workspaces": [ "packages/*" diff --git a/packages/interface-address-manager/package.json b/packages/interface-address-manager/package.json index 0da6fe1eb..ce2fbd249 100644 --- a/packages/interface-address-manager/package.json +++ b/packages/interface-address-manager/package.json @@ -132,11 +132,10 @@ "release": "aegir release" }, "dependencies": { - "@libp2p/interfaces": "^3.0.0", "@multiformats/multiaddr": "^12.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-address-manager/tsconfig.json b/packages/interface-address-manager/tsconfig.json index 838a878cc..5fe8ea40d 100644 --- a/packages/interface-address-manager/tsconfig.json +++ b/packages/interface-address-manager/tsconfig.json @@ -5,10 +5,5 @@ }, "include": [ "src" - ], - "references": [ - { - "path": "../interfaces" - } ] } diff --git a/packages/interface-compliance-tests/package.json b/packages/interface-compliance-tests/package.json index fa9383477..6b9fe67d9 100644 --- a/packages/interface-compliance-tests/package.json +++ b/packages/interface-compliance-tests/package.json @@ -156,7 +156,7 @@ "release": "aegir release" }, "dependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-compliance-tests/src/index.ts b/packages/interface-compliance-tests/src/index.ts index aba7dd462..7aea8b17d 100644 --- a/packages/interface-compliance-tests/src/index.ts +++ b/packages/interface-compliance-tests/src/index.ts @@ -1,5 +1,5 @@ -export interface TestSetup { +export interface TestSetup> { setup: (args?: SetupArgs) => Promise teardown: () => Promise } diff --git a/packages/interface-connection-compliance-tests/package.json b/packages/interface-connection-compliance-tests/package.json index 7191ceea4..58f1f510c 100644 --- a/packages/interface-connection-compliance-tests/package.json +++ b/packages/interface-connection-compliance-tests/package.json @@ -134,7 +134,7 @@ "dependencies": { "@libp2p/interface-compliance-tests": "^3.0.0", "@libp2p/interface-connection": "^5.0.0", - "aegir": "^38.1.0", + "aegir": "^39.0.5", "sinon": "^15.0.0", "ts-sinon": "^2.0.2" }, diff --git a/packages/interface-connection-encrypter-compliance-tests/package.json b/packages/interface-connection-encrypter-compliance-tests/package.json index a840b6c43..58a37b767 100644 --- a/packages/interface-connection-encrypter-compliance-tests/package.json +++ b/packages/interface-connection-encrypter-compliance-tests/package.json @@ -138,7 +138,7 @@ "@libp2p/interface-peer-id": "^2.0.0", "@libp2p/peer-id-factory": "^2.0.0", "@multiformats/multiaddr": "^12.0.0", - "aegir": "^38.1.0", + "aegir": "^39.0.5", "it-all": "^3.0.1", "it-pair": "^2.0.2", "it-pipe": "^3.0.1", diff --git a/packages/interface-connection-encrypter-compliance-tests/src/index.ts b/packages/interface-connection-encrypter-compliance-tests/src/index.ts index 4e8871c42..c622f67ad 100644 --- a/packages/interface-connection-encrypter-compliance-tests/src/index.ts +++ b/packages/interface-connection-encrypter-compliance-tests/src/index.ts @@ -1,10 +1,10 @@ -import { expect } from 'aegir/chai' -import { pipe } from 'it-pipe' +import peers from '@libp2p/interface-compliance-tests/peers' +import { UnexpectedPeerError } from '@libp2p/interface-connection-encrypter/errors' import * as PeerIdFactory from '@libp2p/peer-id-factory' +import { expect } from 'aegir/chai' import all from 'it-all' +import { pipe } from 'it-pipe' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import peers from '@libp2p/interface-compliance-tests/peers' -import { UnexpectedPeerError } from '@libp2p/interface-connection-encrypter/errors' import { createMaConnPair } from './utils/index.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter' @@ -59,7 +59,7 @@ export default (common: TestSetup): void => { const result = await pipe( [input], outboundResult.conn, - async (source) => await all(source) + async (source) => all(source) ) expect(result).to.eql([input]) diff --git a/packages/interface-connection-encrypter-compliance-tests/src/utils/index.ts b/packages/interface-connection-encrypter-compliance-tests/src/utils/index.ts index f8fadb1bc..4c50901da 100644 --- a/packages/interface-connection-encrypter-compliance-tests/src/utils/index.ts +++ b/packages/interface-connection-encrypter-compliance-tests/src/utils/index.ts @@ -1,5 +1,5 @@ -import { duplexPair } from 'it-pair/duplex' import { multiaddr } from '@multiformats/multiaddr' +import { duplexPair } from 'it-pair/duplex' import type { MultiaddrConnection } from '@libp2p/interface-connection' import type { Duplex, Source } from 'it-stream-types' diff --git a/packages/interface-connection-encrypter/package.json b/packages/interface-connection-encrypter/package.json index c4e23e61c..01a8117c1 100644 --- a/packages/interface-connection-encrypter/package.json +++ b/packages/interface-connection-encrypter/package.json @@ -156,7 +156,7 @@ "it-stream-types": "^2.0.1" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-connection-encrypter/src/errors.ts b/packages/interface-connection-encrypter/src/errors.ts index cfde5f35c..e23304aae 100644 --- a/packages/interface-connection-encrypter/src/errors.ts +++ b/packages/interface-connection-encrypter/src/errors.ts @@ -7,9 +7,7 @@ export class UnexpectedPeerError extends Error { this.code = UnexpectedPeerError.code } - static get code (): string { - return 'ERR_UNEXPECTED_PEER' - } + static readonly code = 'ERR_UNEXPECTED_PEER' } export class InvalidCryptoExchangeError extends Error { @@ -20,9 +18,7 @@ export class InvalidCryptoExchangeError extends Error { this.code = InvalidCryptoExchangeError.code } - static get code (): string { - return 'ERR_INVALID_CRYPTO_EXCHANGE' - } + static readonly code = 'ERR_INVALID_CRYPTO_EXCHANGE' } export class InvalidCryptoTransmissionError extends Error { @@ -33,7 +29,5 @@ export class InvalidCryptoTransmissionError extends Error { this.code = InvalidCryptoTransmissionError.code } - static get code (): string { - return 'ERR_INVALID_CRYPTO_TRANSMISSION' - } + static readonly code = 'ERR_INVALID_CRYPTO_TRANSMISSION' } diff --git a/packages/interface-connection-gater/package.json b/packages/interface-connection-gater/package.json index 159251f02..d9331ae47 100644 --- a/packages/interface-connection-gater/package.json +++ b/packages/interface-connection-gater/package.json @@ -137,7 +137,7 @@ "@multiformats/multiaddr": "^12.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-connection-gater/src/index.ts b/packages/interface-connection-gater/src/index.ts index 96e7db653..923449ca5 100644 --- a/packages/interface-connection-gater/src/index.ts +++ b/packages/interface-connection-gater/src/index.ts @@ -1,6 +1,6 @@ -import type { Multiaddr } from '@multiformats/multiaddr' -import type { PeerId } from '@libp2p/interface-peer-id' import type { MultiaddrConnection } from '@libp2p/interface-connection' +import type { PeerId } from '@libp2p/interface-peer-id' +import type { Multiaddr } from '@multiformats/multiaddr' export interface ConnectionGater { /** diff --git a/packages/interface-connection-gater/tsconfig.json b/packages/interface-connection-gater/tsconfig.json index cbde3d05c..16ab3d8b5 100644 --- a/packages/interface-connection-gater/tsconfig.json +++ b/packages/interface-connection-gater/tsconfig.json @@ -12,9 +12,6 @@ }, { "path": "../interface-peer-id" - }, - { - "path": "../interfaces" } ] } diff --git a/packages/interface-connection-manager/package.json b/packages/interface-connection-manager/package.json index d56dd7c9f..18d21f5cc 100644 --- a/packages/interface-connection-manager/package.json +++ b/packages/interface-connection-manager/package.json @@ -139,7 +139,7 @@ "@multiformats/multiaddr": "^12.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-connection-manager/src/index.ts b/packages/interface-connection-manager/src/index.ts index 2a2e5266c..ca9bebc2d 100644 --- a/packages/interface-connection-manager/src/index.ts +++ b/packages/interface-connection-manager/src/index.ts @@ -1,8 +1,8 @@ -import type { AbortOptions } from '@libp2p/interfaces' import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection' import type { PeerId } from '@libp2p/interface-peer-id' -import type { Multiaddr } from '@multiformats/multiaddr' +import type { AbortOptions } from '@libp2p/interfaces' import type { PeerMap } from '@libp2p/peer-collections' +import type { Multiaddr } from '@multiformats/multiaddr' export type PendingDialStatus = 'queued' | 'active' | 'error' | 'success' diff --git a/packages/interface-connection/package.json b/packages/interface-connection/package.json index da3909c88..762c0c30b 100644 --- a/packages/interface-connection/package.json +++ b/packages/interface-connection/package.json @@ -156,10 +156,10 @@ "@libp2p/interfaces": "^3.0.0", "@multiformats/multiaddr": "^12.0.0", "it-stream-types": "^2.0.1", - "uint8arraylist": "^2.1.2" + "uint8arraylist": "^2.4.3" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-connection/src/index.ts b/packages/interface-connection/src/index.ts index ddcb1ca60..28afab0ff 100644 --- a/packages/interface-connection/src/index.ts +++ b/packages/interface-connection/src/index.ts @@ -1,8 +1,8 @@ -import type { Multiaddr } from '@multiformats/multiaddr' -import type { PeerId } from '@libp2p/interface-peer-id' import type * as Status from './status.js' -import type { Duplex, Source } from 'it-stream-types' +import type { PeerId } from '@libp2p/interface-peer-id' import type { AbortOptions } from '@libp2p/interfaces' +import type { Multiaddr } from '@multiformats/multiaddr' +import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' export interface ConnectionTimeline { diff --git a/packages/interface-content-routing/package.json b/packages/interface-content-routing/package.json index 5f7e4d8ab..d9c045841 100644 --- a/packages/interface-content-routing/package.json +++ b/packages/interface-content-routing/package.json @@ -137,7 +137,7 @@ "multiformats": "^11.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-content-routing/src/index.ts b/packages/interface-content-routing/src/index.ts index e782df635..c22bd19ed 100644 --- a/packages/interface-content-routing/src/index.ts +++ b/packages/interface-content-routing/src/index.ts @@ -1,6 +1,6 @@ -import type { CID } from 'multiformats/cid' -import type { AbortOptions } from '@libp2p/interfaces' import type { PeerInfo } from '@libp2p/interface-peer-info' +import type { AbortOptions } from '@libp2p/interfaces' +import type { CID } from 'multiformats/cid' /** * Any object that implements this Symbol as a property should return a diff --git a/packages/interface-dht/package.json b/packages/interface-dht/package.json index ee5c31c07..b9cdae770 100644 --- a/packages/interface-dht/package.json +++ b/packages/interface-dht/package.json @@ -139,7 +139,7 @@ "multiformats": "^11.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-dht/src/index.ts b/packages/interface-dht/src/index.ts index 8ac543b8a..25f46a7d7 100644 --- a/packages/interface-dht/src/index.ts +++ b/packages/interface-dht/src/index.ts @@ -1,8 +1,8 @@ +import type { PeerDiscovery } from '@libp2p/interface-peer-discovery' import type { PeerId } from '@libp2p/interface-peer-id' -import type { CID } from 'multiformats/cid' import type { PeerInfo } from '@libp2p/interface-peer-info' import type { AbortOptions } from '@libp2p/interfaces' -import type { PeerDiscovery } from '@libp2p/interface-peer-discovery' +import type { CID } from 'multiformats/cid' /** * The types of events emitted during DHT queries diff --git a/packages/interface-keychain/package.json b/packages/interface-keychain/package.json index d668d49a4..377a75a4e 100644 --- a/packages/interface-keychain/package.json +++ b/packages/interface-keychain/package.json @@ -136,7 +136,7 @@ "multiformats": "^11.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-keychain/src/index.ts b/packages/interface-keychain/src/index.ts index dce427e64..1c71ea5b0 100644 --- a/packages/interface-keychain/src/index.ts +++ b/packages/interface-keychain/src/index.ts @@ -20,8 +20,8 @@ * ``` */ -import type { Multibase } from 'multiformats/bases/interface' import type { PeerId } from '@libp2p/interface-peer-id' +import type { Multibase } from 'multiformats/bases/interface' export interface KeyInfo { /** diff --git a/packages/interface-keys/package.json b/packages/interface-keys/package.json index 595cd5c9a..0e422f394 100644 --- a/packages/interface-keys/package.json +++ b/packages/interface-keys/package.json @@ -132,7 +132,7 @@ "release": "aegir release" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-libp2p/package.json b/packages/interface-libp2p/package.json index ade20fe62..b0d67b024 100644 --- a/packages/interface-libp2p/package.json +++ b/packages/interface-libp2p/package.json @@ -134,21 +134,19 @@ "dependencies": { "@libp2p/interface-connection": "^5.0.0", "@libp2p/interface-content-routing": "^2.0.0", - "@libp2p/interface-dht": "^2.0.0", "@libp2p/interface-keychain": "^2.0.0", "@libp2p/interface-metrics": "^4.0.0", "@libp2p/interface-peer-id": "^2.0.0", "@libp2p/interface-peer-info": "^1.0.0", "@libp2p/interface-peer-routing": "^1.0.0", "@libp2p/interface-peer-store": "^2.0.0", - "@libp2p/interface-pubsub": "^4.0.0", "@libp2p/interface-registrar": "^2.0.0", "@libp2p/interface-transport": "^4.0.0", "@libp2p/interfaces": "^3.0.0", "@multiformats/multiaddr": "^12.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-libp2p/src/index.ts b/packages/interface-libp2p/src/index.ts index 67631951c..53bf985f6 100644 --- a/packages/interface-libp2p/src/index.ts +++ b/packages/interface-libp2p/src/index.ts @@ -14,20 +14,20 @@ * ``` */ -import type { AbortOptions } from '@libp2p/interfaces' -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Startable } from '@libp2p/interfaces/startable' -import type { Multiaddr } from '@multiformats/multiaddr' -import type { Address, Peer, PeerStore } from '@libp2p/interface-peer-store' -import type { PeerId } from '@libp2p/interface-peer-id' import type { Connection, Stream } from '@libp2p/interface-connection' -import type { PeerRouting } from '@libp2p/interface-peer-routing' import type { ContentRouting } from '@libp2p/interface-content-routing' -import type { StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar' +import type { KeyChain } from '@libp2p/interface-keychain' import type { Metrics } from '@libp2p/interface-metrics' +import type { PeerId } from '@libp2p/interface-peer-id' import type { PeerInfo } from '@libp2p/interface-peer-info' -import type { KeyChain } from '@libp2p/interface-keychain' +import type { PeerRouting } from '@libp2p/interface-peer-routing' +import type { Address, Peer, PeerStore } from '@libp2p/interface-peer-store' +import type { StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar' import type { Listener } from '@libp2p/interface-transport' +import type { AbortOptions } from '@libp2p/interfaces' +import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Startable } from '@libp2p/interfaces/startable' +import type { Multiaddr } from '@multiformats/multiaddr' /** * Used by the connection manager to sort addresses into order before dialling @@ -208,7 +208,7 @@ export interface PendingDial { /** * Libp2p nodes implement this interface. */ -export interface Libp2p extends Startable, EventEmitter { +export interface Libp2p> extends Startable, EventEmitter { /** * The PeerId is a unique identifier for a node on the network. * diff --git a/packages/interface-libp2p/tsconfig.json b/packages/interface-libp2p/tsconfig.json index fc2c5d600..141be663e 100644 --- a/packages/interface-libp2p/tsconfig.json +++ b/packages/interface-libp2p/tsconfig.json @@ -13,9 +13,6 @@ { "path": "../interface-content-routing" }, - { - "path": "../interface-dht" - }, { "path": "../interface-keychain" }, @@ -35,10 +32,10 @@ "path": "../interface-peer-store" }, { - "path": "../interface-pubsub" + "path": "../interface-registrar" }, { - "path": "../interface-registrar" + "path": "../interface-transport" }, { "path": "../interfaces" diff --git a/packages/interface-metrics/package.json b/packages/interface-metrics/package.json index d15a9717d..645599a4e 100644 --- a/packages/interface-metrics/package.json +++ b/packages/interface-metrics/package.json @@ -135,7 +135,7 @@ "@libp2p/interface-connection": "^5.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-mocks/package.json b/packages/interface-mocks/package.json index 9cf0616e4..cde557dd5 100644 --- a/packages/interface-mocks/package.json +++ b/packages/interface-mocks/package.json @@ -169,7 +169,7 @@ "it-pushable": "^3.1.3", "it-stream-types": "^2.0.1", "merge-options": "^3.0.4", - "uint8arraylist": "^2.1.2", + "uint8arraylist": "^2.4.3", "uint8arrays": "^4.0.2" }, "devDependencies": { @@ -177,7 +177,7 @@ "@libp2p/interface-connection-encrypter-compliance-tests": "^5.0.0", "@libp2p/interface-peer-discovery-compliance-tests": "^2.0.0", "@libp2p/interface-stream-muxer-compliance-tests": "^7.0.0", - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-mocks/src/connection-encrypter.ts b/packages/interface-mocks/src/connection-encrypter.ts index c06816714..281756bb0 100644 --- a/packages/interface-mocks/src/connection-encrypter.ts +++ b/packages/interface-mocks/src/connection-encrypter.ts @@ -1,12 +1,12 @@ +import { UnexpectedPeerError } from '@libp2p/interface-connection-encrypter/errors' import { peerIdFromBytes } from '@libp2p/peer-id' +import { multiaddr } from '@multiformats/multiaddr' import { handshake } from 'it-handshake' +import map from 'it-map' import { duplexPair } from 'it-pair/duplex' import { pipe } from 'it-pipe' -import { UnexpectedPeerError } from '@libp2p/interface-connection-encrypter/errors' -import { multiaddr } from '@multiformats/multiaddr' import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter' import type { Transform, Source } from 'it-stream-types' -import map from 'it-map' // A basic transform that does nothing to the data const transform = (): Transform, AsyncGenerator> => { diff --git a/packages/interface-mocks/src/connection-gater.ts b/packages/interface-mocks/src/connection-gater.ts index 57e60d766..86b873c74 100644 --- a/packages/interface-mocks/src/connection-gater.ts +++ b/packages/interface-mocks/src/connection-gater.ts @@ -2,17 +2,17 @@ import type { ConnectionGater } from '@libp2p/interface-connection-gater' export function mockConnectionGater (): ConnectionGater { return { - denyDialPeer: async () => await Promise.resolve(false), - denyDialMultiaddr: async () => await Promise.resolve(false), - denyInboundConnection: async () => await Promise.resolve(false), - denyOutboundConnection: async () => await Promise.resolve(false), - denyInboundEncryptedConnection: async () => await Promise.resolve(false), - denyOutboundEncryptedConnection: async () => await Promise.resolve(false), - denyInboundUpgradedConnection: async () => await Promise.resolve(false), - denyOutboundUpgradedConnection: async () => await Promise.resolve(false), - denyInboundRelayReservation: async () => await Promise.resolve(false), - denyOutboundRelayedConnection: async () => await Promise.resolve(false), - denyInboundRelayedConnection: async () => await Promise.resolve(false), - filterMultiaddrForPeer: async () => await Promise.resolve(true) + denyDialPeer: async () => Promise.resolve(false), + denyDialMultiaddr: async () => Promise.resolve(false), + denyInboundConnection: async () => Promise.resolve(false), + denyOutboundConnection: async () => Promise.resolve(false), + denyInboundEncryptedConnection: async () => Promise.resolve(false), + denyOutboundEncryptedConnection: async () => Promise.resolve(false), + denyInboundUpgradedConnection: async () => Promise.resolve(false), + denyOutboundUpgradedConnection: async () => Promise.resolve(false), + denyInboundRelayReservation: async () => Promise.resolve(false), + denyOutboundRelayedConnection: async () => Promise.resolve(false), + denyInboundRelayedConnection: async () => Promise.resolve(false), + filterMultiaddrForPeer: async () => Promise.resolve(true) } } diff --git a/packages/interface-mocks/src/connection-manager.ts b/packages/interface-mocks/src/connection-manager.ts index 416eaf90b..e3e5b21d3 100644 --- a/packages/interface-mocks/src/connection-manager.ts +++ b/packages/interface-mocks/src/connection-manager.ts @@ -1,16 +1,16 @@ -import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Startable } from '@libp2p/interfaces/startable' -import type { Connection } from '@libp2p/interface-connection' -import { isPeerId, PeerId } from '@libp2p/interface-peer-id' -import type { ConnectionManager, PendingDial } from '@libp2p/interface-connection-manager' -import { connectionPair } from './connection.js' +import { isPeerId, type PeerId } from '@libp2p/interface-peer-id' import { CodeError } from '@libp2p/interfaces/errors' -import type { Registrar } from '@libp2p/interface-registrar' -import type { PubSub } from '@libp2p/interface-pubsub' -import { isMultiaddr, Multiaddr } from '@multiformats/multiaddr' -import { peerIdFromString } from '@libp2p/peer-id' import { PeerMap } from '@libp2p/peer-collections' +import { peerIdFromString } from '@libp2p/peer-id' +import { isMultiaddr, type Multiaddr } from '@multiformats/multiaddr' +import { connectionPair } from './connection.js' +import type { Connection } from '@libp2p/interface-connection' +import type { ConnectionManager, PendingDial } from '@libp2p/interface-connection-manager' import type { Libp2pEvents } from '@libp2p/interface-libp2p' +import type { PubSub } from '@libp2p/interface-pubsub' +import type { Registrar } from '@libp2p/interface-registrar' +import type { EventEmitter } from '@libp2p/interfaces/events' +import type { Startable } from '@libp2p/interfaces/startable' export interface MockNetworkComponents { peerId: PeerId diff --git a/packages/interface-mocks/src/connection.ts b/packages/interface-mocks/src/connection.ts index 2addc36cd..ad9ab3a9f 100644 --- a/packages/interface-mocks/src/connection.ts +++ b/packages/interface-mocks/src/connection.ts @@ -1,20 +1,20 @@ +import * as STATUS from '@libp2p/interface-connection/status' +import { CodeError } from '@libp2p/interfaces/errors' +import { logger } from '@libp2p/logger' +import * as mss from '@libp2p/multistream-select' import { peerIdFromString } from '@libp2p/peer-id' -import { pipe } from 'it-pipe' import { duplexPair } from 'it-pair/duplex' -import type { MultiaddrConnection, Connection, Stream, ConnectionStat, Direction } from '@libp2p/interface-connection' -import type { Duplex, Source } from 'it-stream-types' +import { pipe } from 'it-pipe' +import { mockMultiaddrConnection } from './multiaddr-connection.js' import { mockMuxer } from './muxer.js' +import { mockRegistrar } from './registrar.js' +import type { MultiaddrConnection, Connection, Stream, ConnectionStat, Direction } from '@libp2p/interface-connection' import type { PeerId } from '@libp2p/interface-peer-id' -import { mockMultiaddrConnection } from './multiaddr-connection.js' import type { Registrar } from '@libp2p/interface-registrar' -import { mockRegistrar } from './registrar.js' -import * as mss from '@libp2p/multistream-select' -import { logger } from '@libp2p/logger' -import * as STATUS from '@libp2p/interface-connection/status' -import type { Multiaddr } from '@multiformats/multiaddr' import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface-stream-muxer' import type { AbortOptions } from '@libp2p/interfaces' -import { CodeError } from '@libp2p/interfaces/errors' +import type { Multiaddr } from '@multiformats/multiaddr' +import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' const log = logger('libp2p:mock-connection') diff --git a/packages/interface-mocks/src/metrics.ts b/packages/interface-mocks/src/metrics.ts index 79e539543..760ac8fcf 100644 --- a/packages/interface-mocks/src/metrics.ts +++ b/packages/interface-mocks/src/metrics.ts @@ -1,5 +1,5 @@ -import type { Metric, MetricGroup, StopTimer, Metrics, CalculatedMetricOptions, MetricOptions } from '@libp2p/interface-metrics' import type { MultiaddrConnection, Stream, Connection } from '@libp2p/interface-connection' +import type { Metric, MetricGroup, StopTimer, Metrics, CalculatedMetricOptions, MetricOptions } from '@libp2p/interface-metrics' class DefaultMetric implements Metric { public value: number = 0 diff --git a/packages/interface-mocks/src/multiaddr-connection.ts b/packages/interface-mocks/src/multiaddr-connection.ts index b15845f42..868bbee1a 100644 --- a/packages/interface-mocks/src/multiaddr-connection.ts +++ b/packages/interface-mocks/src/multiaddr-connection.ts @@ -1,10 +1,10 @@ import { multiaddr } from '@multiformats/multiaddr' -import { duplexPair } from 'it-pair/duplex' import { abortableSource } from 'abortable-iterator' +import { duplexPair } from 'it-pair/duplex' import type { MultiaddrConnection } from '@libp2p/interface-connection' -import type { Duplex } from 'it-stream-types' import type { PeerId } from '@libp2p/interface-peer-id' import type { Multiaddr } from '@multiformats/multiaddr' +import type { Duplex } from 'it-stream-types' export function mockMultiaddrConnection (source: Duplex> & Partial, peerId: PeerId): MultiaddrConnection { const maConn: MultiaddrConnection = { diff --git a/packages/interface-mocks/src/muxer.ts b/packages/interface-mocks/src/muxer.ts index b250a8399..00f4370d7 100644 --- a/packages/interface-mocks/src/muxer.ts +++ b/packages/interface-mocks/src/muxer.ts @@ -1,17 +1,17 @@ -import { Pushable, pushable } from 'it-pushable' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import { CodeError } from '@libp2p/interfaces/errors' +import { type Logger, logger } from '@libp2p/logger' import { abortableSource } from 'abortable-iterator' import { anySignal } from 'any-signal' -import { CodeError } from '@libp2p/interfaces/errors' -import { Logger, logger } from '@libp2p/logger' +import map from 'it-map' import * as ndjson from 'it-ndjson' +import { pipe } from 'it-pipe' +import { type Pushable, pushable } from 'it-pushable' +import { Uint8ArrayList } from 'uint8arraylist' +import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import type { Stream } from '@libp2p/interface-connection' import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface-stream-muxer' import type { Source } from 'it-stream-types' -import { pipe } from 'it-pipe' -import map from 'it-map' -import { Uint8ArrayList } from 'uint8arraylist' let muxers = 0 let streams = 0 diff --git a/packages/interface-mocks/src/peer-discovery.ts b/packages/interface-mocks/src/peer-discovery.ts index 61068333f..340dca182 100644 --- a/packages/interface-mocks/src/peer-discovery.ts +++ b/packages/interface-mocks/src/peer-discovery.ts @@ -1,9 +1,9 @@ -import { multiaddr } from '@multiformats/multiaddr' -import * as PeerIdFactory from '@libp2p/peer-id-factory' +import { symbol } from '@libp2p/interface-peer-discovery' import { EventEmitter } from '@libp2p/interfaces/events' +import * as PeerIdFactory from '@libp2p/peer-id-factory' +import { multiaddr } from '@multiformats/multiaddr' import type { PeerDiscovery, PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' import type { PeerInfo } from '@libp2p/interface-peer-info' -import { symbol } from '@libp2p/interface-peer-discovery' interface MockDiscoveryInit { discoveryDelay?: number @@ -24,13 +24,9 @@ export class MockDiscovery extends EventEmitter implements this._isRunning = false } - get [symbol] (): true { - return true - } + readonly [symbol] = true - get [Symbol.toStringTag] (): string { - return 'MockDiscovery' - } + readonly [Symbol.toStringTag] = 'MockDiscovery' start (): void { this._isRunning = true diff --git a/packages/interface-mocks/src/registrar.ts b/packages/interface-mocks/src/registrar.ts index ed61599cb..c6c148253 100644 --- a/packages/interface-mocks/src/registrar.ts +++ b/packages/interface-mocks/src/registrar.ts @@ -1,11 +1,11 @@ -import type { IncomingStreamData, Registrar, StreamHandler, Topology, StreamHandlerOptions, StreamHandlerRecord } from '@libp2p/interface-registrar' +import merge from 'merge-options' import type { Connection } from '@libp2p/interface-connection' import type { PeerId } from '@libp2p/interface-peer-id' -import merge from 'merge-options' +import type { IncomingStreamData, Registrar, StreamHandler, Topology, StreamHandlerOptions, StreamHandlerRecord } from '@libp2p/interface-registrar' export class MockRegistrar implements Registrar { - private readonly topologies: Map> = new Map() - private readonly handlers: Map = new Map() + private readonly topologies = new Map>() + private readonly handlers = new Map() getProtocols (): string[] { return Array.from(this.handlers.keys()).sort() diff --git a/packages/interface-mocks/src/upgrader.ts b/packages/interface-mocks/src/upgrader.ts index 7d16589cb..773963349 100644 --- a/packages/interface-mocks/src/upgrader.ts +++ b/packages/interface-mocks/src/upgrader.ts @@ -1,9 +1,9 @@ import { mockConnection } from './connection.js' -import type { Upgrader, UpgraderOptions } from '@libp2p/interface-transport' import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection' +import type { Libp2pEvents } from '@libp2p/interface-libp2p' import type { Registrar } from '@libp2p/interface-registrar' +import type { Upgrader, UpgraderOptions } from '@libp2p/interface-transport' import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Libp2pEvents } from '@libp2p/interface-libp2p' export interface MockUpgraderInit { registrar?: Registrar @@ -44,6 +44,6 @@ class MockUpgrader implements Upgrader { } } -export function mockUpgrader (init: MockUpgraderInit): Upgrader { +export function mockUpgrader (init: MockUpgraderInit = {}): Upgrader { return new MockUpgrader(init) } diff --git a/packages/interface-mocks/test/connection.spec.ts b/packages/interface-mocks/test/connection.spec.ts index 4490e838f..901d641fb 100644 --- a/packages/interface-mocks/test/connection.spec.ts +++ b/packages/interface-mocks/test/connection.spec.ts @@ -1,9 +1,9 @@ import tests from '@libp2p/interface-connection-compliance-tests' -import { connectionPair } from '../src/connection.js' import { createEd25519PeerId } from '@libp2p/peer-id-factory' +import { pipe } from 'it-pipe' +import { connectionPair } from '../src/connection.js' import { mockRegistrar } from '../src/registrar.js' import type { Connection } from '@libp2p/interface-connection' -import { pipe } from 'it-pipe' describe('mock connection compliance tests', () => { let connections: Connection[] = [] diff --git a/packages/interface-mocks/tsconfig.json b/packages/interface-mocks/tsconfig.json index cfc7f6a2e..d49aa5945 100644 --- a/packages/interface-mocks/tsconfig.json +++ b/packages/interface-mocks/tsconfig.json @@ -26,6 +26,9 @@ { "path": "../interface-connection-manager" }, + { + "path": "../interface-libp2p" + }, { "path": "../interface-metrics" }, diff --git a/packages/interface-peer-discovery-compliance-tests/package.json b/packages/interface-peer-discovery-compliance-tests/package.json index 37c483047..5240cbc56 100644 --- a/packages/interface-peer-discovery-compliance-tests/package.json +++ b/packages/interface-peer-discovery-compliance-tests/package.json @@ -136,7 +136,7 @@ "@libp2p/interface-peer-discovery": "^1.0.0", "@libp2p/interfaces": "^3.0.0", "@multiformats/multiaddr": "^12.0.0", - "aegir": "^38.1.0", + "aegir": "^39.0.5", "delay": "^5.0.0", "p-defer": "^4.0.0" }, diff --git a/packages/interface-peer-discovery-compliance-tests/src/index.ts b/packages/interface-peer-discovery-compliance-tests/src/index.ts index c955923e7..64c751b59 100644 --- a/packages/interface-peer-discovery-compliance-tests/src/index.ts +++ b/packages/interface-peer-discovery-compliance-tests/src/index.ts @@ -1,8 +1,8 @@ -import { expect } from 'aegir/chai' +import { start, stop } from '@libp2p/interfaces/startable' import { isMultiaddr } from '@multiformats/multiaddr' +import { expect } from 'aegir/chai' import delay from 'delay' import pDefer from 'p-defer' -import { start, stop } from '@libp2p/interfaces/startable' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { PeerDiscovery } from '@libp2p/interface-peer-discovery' diff --git a/packages/interface-peer-discovery/package.json b/packages/interface-peer-discovery/package.json index 35d125232..d8298733e 100644 --- a/packages/interface-peer-discovery/package.json +++ b/packages/interface-peer-discovery/package.json @@ -136,7 +136,7 @@ "@libp2p/interfaces": "^3.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-peer-id/package.json b/packages/interface-peer-id/package.json index 7040ab169..5f9bb3a75 100644 --- a/packages/interface-peer-id/package.json +++ b/packages/interface-peer-id/package.json @@ -135,7 +135,7 @@ "multiformats": "^11.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-peer-info/package.json b/packages/interface-peer-info/package.json index 39f9e51d7..030635707 100644 --- a/packages/interface-peer-info/package.json +++ b/packages/interface-peer-info/package.json @@ -136,7 +136,7 @@ "@multiformats/multiaddr": "^12.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-peer-routing/package.json b/packages/interface-peer-routing/package.json index def6cbb66..b9dc7d3b2 100644 --- a/packages/interface-peer-routing/package.json +++ b/packages/interface-peer-routing/package.json @@ -137,7 +137,7 @@ "@libp2p/interfaces": "^3.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-peer-store/package.json b/packages/interface-peer-store/package.json index 6bee6f361..10105a962 100644 --- a/packages/interface-peer-store/package.json +++ b/packages/interface-peer-store/package.json @@ -153,12 +153,10 @@ }, "dependencies": { "@libp2p/interface-peer-id": "^2.0.0", - "@libp2p/interface-peer-info": "^1.0.0", - "@libp2p/interfaces": "^3.0.0", "@multiformats/multiaddr": "^12.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-peer-store/tsconfig.json b/packages/interface-peer-store/tsconfig.json index 6f6f8aed5..d8db0b667 100644 --- a/packages/interface-peer-store/tsconfig.json +++ b/packages/interface-peer-store/tsconfig.json @@ -9,15 +9,6 @@ "references": [ { "path": "../interface-peer-id" - }, - { - "path": "../interface-peer-info" - }, - { - "path": "../interface-record" - }, - { - "path": "../interfaces" } ] } diff --git a/packages/interface-pubsub-compliance-tests/package.json b/packages/interface-pubsub-compliance-tests/package.json index 35d75cec9..8282e02de 100644 --- a/packages/interface-pubsub-compliance-tests/package.json +++ b/packages/interface-pubsub-compliance-tests/package.json @@ -140,7 +140,7 @@ "@libp2p/interface-registrar": "^2.0.0", "@libp2p/interfaces": "^3.0.0", "@libp2p/peer-id-factory": "^2.0.0", - "aegir": "^38.1.0", + "aegir": "^39.0.5", "delay": "^5.0.0", "p-defer": "^4.0.0", "p-event": "^5.0.1", diff --git a/packages/interface-pubsub-compliance-tests/src/api.ts b/packages/interface-pubsub-compliance-tests/src/api.ts index e49c9890e..00b180f1c 100644 --- a/packages/interface-pubsub-compliance-tests/src/api.ts +++ b/packages/interface-pubsub-compliance-tests/src/api.ts @@ -1,15 +1,15 @@ +import { mockNetwork } from '@libp2p/interface-mocks' +import { isStartable, start, stop } from '@libp2p/interfaces/startable' import { expect } from 'aegir/chai' -import sinon from 'sinon' +import delay from 'delay' import pDefer from 'p-defer' import pWaitFor from 'p-wait-for' +import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import delay from 'delay' +import { createComponents } from './utils.js' +import type { PubSubArgs, PubSubComponents } from './index.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { PubSub } from '@libp2p/interface-pubsub' -import type { PubSubArgs, PubSubComponents } from './index.js' -import { createComponents } from './utils.js' -import { isStartable, start, stop } from '@libp2p/interfaces/startable' -import { mockNetwork } from '@libp2p/interface-mocks' const topic = 'foo' const data = uint8ArrayFromString('bar') diff --git a/packages/interface-pubsub-compliance-tests/src/connection-handlers.ts b/packages/interface-pubsub-compliance-tests/src/connection-handlers.ts index fd60d9102..24656a0c7 100644 --- a/packages/interface-pubsub-compliance-tests/src/connection-handlers.ts +++ b/packages/interface-pubsub-compliance-tests/src/connection-handlers.ts @@ -1,17 +1,17 @@ +import { mockNetwork } from '@libp2p/interface-mocks' +import { start, stop } from '@libp2p/interfaces/startable' import { expect } from 'aegir/chai' -import sinon from 'sinon' import pDefer from 'p-defer' +import { pEvent } from 'p-event' import pWaitFor from 'p-wait-for' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Message, PubSub } from '@libp2p/interface-pubsub' -import type { PubSubArgs } from './index.js' -import { start, stop } from '@libp2p/interfaces/startable' +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { createComponents } from './utils.js' -import { pEvent } from 'p-event' -import { mockNetwork } from '@libp2p/interface-mocks' +import type { PubSubArgs } from './index.js' +import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { MockNetworkComponents } from '@libp2p/interface-mocks' +import type { Message, PubSub } from '@libp2p/interface-pubsub' export default (common: TestSetup): void => { describe('pubsub connection handlers', () => { @@ -116,7 +116,7 @@ export default (common: TestSetup): void => { it('should get notified of connected peers on dial', async () => { await componentsA.connectionManager.openConnection(componentsB.peerId) - return await Promise.all([ + return Promise.all([ pWaitFor(() => psA.getPeers().length === 1), pWaitFor(() => psB.getPeers().length === 1) ]) @@ -190,7 +190,7 @@ export default (common: TestSetup): void => { await componentsA.connectionManager.openConnection(componentsB.peerId) - return await Promise.all([ + return Promise.all([ pWaitFor(() => psA.getPeers().length === 1), pWaitFor(() => psB.getPeers().length === 1) ]) diff --git a/packages/interface-pubsub-compliance-tests/src/emit-self.ts b/packages/interface-pubsub-compliance-tests/src/emit-self.ts index fa2383139..956a1f214 100644 --- a/packages/interface-pubsub-compliance-tests/src/emit-self.ts +++ b/packages/interface-pubsub-compliance-tests/src/emit-self.ts @@ -1,12 +1,12 @@ +import { mockNetwork } from '@libp2p/interface-mocks' +import { start, stop } from '@libp2p/interfaces/startable' import { expect } from 'aegir/chai' import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { mockNetwork } from '@libp2p/interface-mocks' -import type { TestSetup } from '@libp2p/interface-compliance-tests' +import { createComponents } from './utils.js' import type { PubSubArgs, PubSubComponents } from './index.js' -import { start, stop } from '@libp2p/interfaces/startable' +import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { PubSub } from '@libp2p/interface-pubsub' -import { createComponents } from './utils.js' const topic = 'foo' const data = uint8ArrayFromString('bar') diff --git a/packages/interface-pubsub-compliance-tests/src/index.ts b/packages/interface-pubsub-compliance-tests/src/index.ts index e89392b28..7cf2d45fc 100644 --- a/packages/interface-pubsub-compliance-tests/src/index.ts +++ b/packages/interface-pubsub-compliance-tests/src/index.ts @@ -1,14 +1,14 @@ import apiTest from './api.js' +import connectionHandlersTest from './connection-handlers.js' import emitSelfTest from './emit-self.js' import messagesTest from './messages.js' -import connectionHandlersTest from './connection-handlers.js' -import twoNodesTest from './two-nodes.js' import multipleNodesTest from './multiple-nodes.js' +import twoNodesTest from './two-nodes.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { PubSub, PubSubInit } from '@libp2p/interface-pubsub' +import type { ConnectionManager } from '@libp2p/interface-connection-manager' import type { PeerId } from '@libp2p/interface-peer-id' +import type { PubSub, PubSubInit } from '@libp2p/interface-pubsub' import type { Registrar } from '@libp2p/interface-registrar' -import type { ConnectionManager } from '@libp2p/interface-connection-manager' export interface PubSubComponents { peerId: PeerId diff --git a/packages/interface-pubsub-compliance-tests/src/messages.ts b/packages/interface-pubsub-compliance-tests/src/messages.ts index da4664f75..ddbd9d59c 100644 --- a/packages/interface-pubsub-compliance-tests/src/messages.ts +++ b/packages/interface-pubsub-compliance-tests/src/messages.ts @@ -1,13 +1,13 @@ +import { mockNetwork } from '@libp2p/interface-mocks' +import { start, stop } from '@libp2p/interfaces/startable' import { expect } from 'aegir/chai' +import { pEvent } from 'p-event' import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { createComponents } from './utils.js' +import type { PubSubArgs, PubSubComponents } from './index.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { Message, PubSub } from '@libp2p/interface-pubsub' -import type { PubSubArgs, PubSubComponents } from './index.js' -import { start, stop } from '@libp2p/interfaces/startable' -import { pEvent } from 'p-event' -import { createComponents } from './utils.js' -import { mockNetwork } from '@libp2p/interface-mocks' const topic = 'foo' const data = uint8ArrayFromString('bar') diff --git a/packages/interface-pubsub-compliance-tests/src/multiple-nodes.ts b/packages/interface-pubsub-compliance-tests/src/multiple-nodes.ts index daed0e1d7..d5c4c5854 100644 --- a/packages/interface-pubsub-compliance-tests/src/multiple-nodes.ts +++ b/packages/interface-pubsub-compliance-tests/src/multiple-nodes.ts @@ -1,17 +1,17 @@ /* eslint max-nested-callbacks: ["error", 6] */ +import { mockNetwork } from '@libp2p/interface-mocks' +import { start, stop } from '@libp2p/interfaces/startable' import { expect } from 'aegir/chai' -import sinon from 'sinon' +import delay from 'delay' import pDefer from 'p-defer' import pWaitFor from 'p-wait-for' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { createComponents, waitForSubscriptionUpdate } from './utils.js' +import type { PubSubArgs, PubSubComponents } from './index.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { Message, PubSub } from '@libp2p/interface-pubsub' -import type { PubSubArgs, PubSubComponents } from './index.js' -import { start, stop } from '@libp2p/interfaces/startable' -import delay from 'delay' -import { mockNetwork } from '@libp2p/interface-mocks' export default (common: TestSetup): void => { describe('pubsub with multiple nodes', function () { @@ -125,7 +125,7 @@ export default (common: TestSetup): void => { once: true }) - return await defer.promise + return defer.promise }) it('publish on node a', async () => { @@ -175,7 +175,7 @@ export default (common: TestSetup): void => { } } - return await defer.promise + return defer.promise }) // since the topology is the same, just the publish @@ -231,7 +231,7 @@ export default (common: TestSetup): void => { } } - return await defer.promise + return defer.promise }) }) }) @@ -397,7 +397,7 @@ export default (common: TestSetup): void => { } } - return await defer.promise + return defer.promise }) }) }) diff --git a/packages/interface-pubsub-compliance-tests/src/two-nodes.ts b/packages/interface-pubsub-compliance-tests/src/two-nodes.ts index c99dbb57e..77862601d 100644 --- a/packages/interface-pubsub-compliance-tests/src/two-nodes.ts +++ b/packages/interface-pubsub-compliance-tests/src/two-nodes.ts @@ -1,17 +1,17 @@ /* eslint max-nested-callbacks: ["error", 6] */ +import { mockNetwork } from '@libp2p/interface-mocks' +import { TopicValidatorResult } from '@libp2p/interface-pubsub' +import { start, stop } from '@libp2p/interfaces/startable' import { expect } from 'aegir/chai' -import sinon from 'sinon' import pDefer from 'p-defer' import pWaitFor from 'p-wait-for' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import { createComponents, waitForSubscriptionUpdate } from './utils.js' +import type { PubSubArgs, PubSubComponents } from './index.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { Message, PubSub } from '@libp2p/interface-pubsub' -import type { PubSubArgs, PubSubComponents } from './index.js' -import { start, stop } from '@libp2p/interfaces/startable' -import { mockNetwork } from '@libp2p/interface-mocks' -import { TopicValidatorResult } from '@libp2p/interface-pubsub' const topic = 'foo' @@ -83,7 +83,7 @@ export default (common: TestSetup): void => { }) psA.subscribe(topic) - return await defer.promise + return defer.promise }) it('Publish to a topic in nodeA', async () => { @@ -110,7 +110,7 @@ export default (common: TestSetup): void => { await psA.publish(topic, uint8ArrayFromString('hey')) - return await defer.promise + return defer.promise }) it('Publish to a topic in nodeB', async () => { @@ -153,7 +153,7 @@ export default (common: TestSetup): void => { await psB.publish(topic, uint8ArrayFromString('banana')) - return await defer.promise + return defer.promise }) it('validate topic message', async () => { @@ -184,7 +184,7 @@ export default (common: TestSetup): void => { await psA.publish(topic, uint8ArrayFromString('hey')) - return await defer.promise + return defer.promise }) it('Publish 10 msg to a topic in nodeB', async () => { @@ -228,7 +228,7 @@ export default (common: TestSetup): void => { }) ) - return await defer.promise + return defer.promise }) it('Unsubscribe from topic in nodeA', async () => { @@ -267,7 +267,7 @@ export default (common: TestSetup): void => { psA.unsubscribe(topic) expect(psA.getTopics()).to.be.empty() - return await defer.promise + return defer.promise }) }) } diff --git a/packages/interface-pubsub-compliance-tests/src/utils.ts b/packages/interface-pubsub-compliance-tests/src/utils.ts index 1b5ab8f6e..80e52c536 100644 --- a/packages/interface-pubsub-compliance-tests/src/utils.ts +++ b/packages/interface-pubsub-compliance-tests/src/utils.ts @@ -1,10 +1,10 @@ +import { mockConnectionManager, mockRegistrar, mockNetwork } from '@libp2p/interface-mocks' +import { createEd25519PeerId } from '@libp2p/peer-id-factory' import { pEvent } from 'p-event' import pWaitFor from 'p-wait-for' -import type { PubSub, SubscriptionChangeData } from '@libp2p/interface-pubsub' -import type { PeerId } from '@libp2p/interface-peer-id' -import { createEd25519PeerId } from '@libp2p/peer-id-factory' -import { mockConnectionManager, mockRegistrar, mockNetwork } from '@libp2p/interface-mocks' import type { MockNetworkComponents } from '@libp2p/interface-mocks' +import type { PeerId } from '@libp2p/interface-peer-id' +import type { PubSub, SubscriptionChangeData } from '@libp2p/interface-pubsub' export async function waitForSubscriptionUpdate (a: PubSub, b: PeerId): Promise { await pWaitFor(async () => { diff --git a/packages/interface-pubsub/package.json b/packages/interface-pubsub/package.json index 9ef773953..d9647c186 100644 --- a/packages/interface-pubsub/package.json +++ b/packages/interface-pubsub/package.json @@ -136,10 +136,10 @@ "@libp2p/interface-peer-id": "^2.0.0", "@libp2p/interfaces": "^3.0.0", "it-pushable": "^3.1.3", - "uint8arraylist": "^2.1.2" + "uint8arraylist": "^2.4.3" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-pubsub/src/index.ts b/packages/interface-pubsub/src/index.ts index fe3022ee0..575bebfb4 100644 --- a/packages/interface-pubsub/src/index.ts +++ b/packages/interface-pubsub/src/index.ts @@ -1,7 +1,7 @@ +import type { Stream } from '@libp2p/interface-connection' import type { PeerId } from '@libp2p/interface-peer-id' -import type { Pushable } from 'it-pushable' import type { EventEmitter } from '@libp2p/interfaces/events' -import type { Stream } from '@libp2p/interface-connection' +import type { Pushable } from 'it-pushable' import type { Uint8ArrayList } from 'uint8arraylist' /** diff --git a/packages/interface-record-compliance-tests/package.json b/packages/interface-record-compliance-tests/package.json index 601d993cd..a3cad210b 100644 --- a/packages/interface-record-compliance-tests/package.json +++ b/packages/interface-record-compliance-tests/package.json @@ -134,7 +134,7 @@ "dependencies": { "@libp2p/interface-compliance-tests": "^3.0.0", "@libp2p/interface-record": "^2.0.0", - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-record/package.json b/packages/interface-record/package.json index cf9d3a7ab..26c5cf409 100644 --- a/packages/interface-record/package.json +++ b/packages/interface-record/package.json @@ -133,10 +133,10 @@ }, "dependencies": { "@libp2p/interface-peer-id": "^2.0.0", - "uint8arraylist": "^2.1.2" + "uint8arraylist": "^2.4.3" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-registrar/package.json b/packages/interface-registrar/package.json index 15c6515a6..853f55a3d 100644 --- a/packages/interface-registrar/package.json +++ b/packages/interface-registrar/package.json @@ -136,7 +136,7 @@ "@libp2p/interface-peer-id": "^2.0.0" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-stream-muxer-compliance-tests/package.json b/packages/interface-stream-muxer-compliance-tests/package.json index b8315a108..a438d7132 100644 --- a/packages/interface-stream-muxer-compliance-tests/package.json +++ b/packages/interface-stream-muxer-compliance-tests/package.json @@ -136,7 +136,7 @@ "@libp2p/interface-connection": "^5.0.0", "@libp2p/interface-stream-muxer": "^4.0.0", "abortable-iterator": "^5.0.0", - "aegir": "^38.1.0", + "aegir": "^39.0.5", "delay": "^5.0.0", "it-all": "^3.0.1", "it-drain": "^3.0.1", @@ -146,7 +146,7 @@ "it-stream-types": "^2.0.1", "p-defer": "^4.0.0", "p-limit": "^4.0.0", - "uint8arraylist": "^2.1.2", + "uint8arraylist": "^2.4.3", "uint8arrays": "^4.0.2" }, "typedoc": { diff --git a/packages/interface-stream-muxer-compliance-tests/src/base-test.ts b/packages/interface-stream-muxer-compliance-tests/src/base-test.ts index a5abb45ef..5cda0d545 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/base-test.ts +++ b/packages/interface-stream-muxer-compliance-tests/src/base-test.ts @@ -1,19 +1,19 @@ +import { isValidTick } from '@libp2p/interface-compliance-tests/is-valid-tick' import { expect } from 'aegir/chai' -import { duplexPair } from 'it-pair/duplex' -import { pipe } from 'it-pipe' +import all from 'it-all' import drain from 'it-drain' import map from 'it-map' -import all from 'it-all' +import { duplexPair } from 'it-pair/duplex' +import { pipe } from 'it-pipe' import defer from 'p-defer' -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' +import { Uint8ArrayList } from 'uint8arraylist' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { isValidTick } from '@libp2p/interface-compliance-tests/is-valid-tick' -import type { DeferredPromise } from 'p-defer' +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { Stream } from '@libp2p/interface-connection' import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' import type { Source, Duplex } from 'it-stream-types' -import { Uint8ArrayList } from 'uint8arraylist' +import type { DeferredPromise } from 'p-defer' async function drainAndClose (stream: Duplex): Promise { await pipe([], stream, drain) @@ -185,8 +185,8 @@ export default (common: TestSetup): void => { listenerChunks, dialerChunks ] = await Promise.all([ - pipe(listenerStream, toString, async (source) => await all(source)), - pipe(dialerStream, toString, async (source) => await all(source)) + pipe(listenerStream, toString, async (source) => all(source)), + pipe(dialerStream, toString, async (source) => all(source)) ]) expect(listenerChunks).to.be.eql(['hey']) diff --git a/packages/interface-stream-muxer-compliance-tests/src/close-test.ts b/packages/interface-stream-muxer-compliance-tests/src/close-test.ts index 003653dec..aceb203a8 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/close-test.ts +++ b/packages/interface-stream-muxer-compliance-tests/src/close-test.ts @@ -1,16 +1,16 @@ /* eslint max-nested-callbacks: ["error", 8] */ -import { pipe } from 'it-pipe' -import { duplexPair } from 'it-pair/duplex' import { abortableSource } from 'abortable-iterator' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import drain from 'it-drain' import { expect } from 'aegir/chai' import delay from 'delay' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' -import pDefer from 'p-defer' import all from 'it-all' +import drain from 'it-drain' +import { duplexPair } from 'it-pair/duplex' +import { pipe } from 'it-pipe' +import pDefer from 'p-defer' import { Uint8ArrayList } from 'uint8arraylist' +import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' +import type { TestSetup } from '@libp2p/interface-compliance-tests' +import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' function randomBuffer (): Uint8Array { return uint8ArrayFromString(Math.random().toString()) @@ -47,7 +47,7 @@ export default (common: TestSetup): void => { void pipe(p[0], dialer, p[0]) void pipe(p[1], listener, p[1]) - const streams = await Promise.all(Array(expectedStreams).fill(0).map(async () => await dialer.newStream())) + const streams = await Promise.all(Array(expectedStreams).fill(0).map(async () => dialer.newStream())) void Promise.all( streams.map(async stream => { @@ -89,7 +89,7 @@ export default (common: TestSetup): void => { void pipe(p[0], dialer, p[0]) void pipe(p[1], listener, p[1]) - const streams = await Promise.all(Array(expectedStreams).fill(0).map(async () => await dialer.newStream())) + const streams = await Promise.all(Array(expectedStreams).fill(0).map(async () => dialer.newStream())) void Promise.all( streams.map(async stream => { @@ -132,7 +132,7 @@ export default (common: TestSetup): void => { void pipe(p[0], dialer, p[0]) void pipe(p[1], listener, p[1]) - const streams = await Promise.all(Array(expectedStreams).fill(0).map(async () => await dialer.newStream())) + const streams = await Promise.all(Array(expectedStreams).fill(0).map(async () => dialer.newStream())) const streamPipes = streams.map(async stream => { await pipe( @@ -201,7 +201,7 @@ export default (common: TestSetup): void => { void pipe(p[1], listener, p[1]) const stream = await dialer.newStream() - const streams = await Promise.all(Array.from(Array(5), async () => await dialer.newStream())) + const streams = await Promise.all(Array.from(Array(5), async () => dialer.newStream())) let closed = false const controllers: AbortController[] = [] diff --git a/packages/interface-stream-muxer-compliance-tests/src/index.ts b/packages/interface-stream-muxer-compliance-tests/src/index.ts index 38af55bda..016637421 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/index.ts +++ b/packages/interface-stream-muxer-compliance-tests/src/index.ts @@ -1,7 +1,7 @@ import baseTest from './base-test.js' import closeTest from './close-test.js' -import stressTest from './stress-test.js' import megaStressTest from './mega-stress-test.js' +import stressTest from './stress-test.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' diff --git a/packages/interface-stream-muxer-compliance-tests/src/spawner.ts b/packages/interface-stream-muxer-compliance-tests/src/spawner.ts index 31cf2cb8b..da1636186 100644 --- a/packages/interface-stream-muxer-compliance-tests/src/spawner.ts +++ b/packages/interface-stream-muxer-compliance-tests/src/spawner.ts @@ -1,12 +1,12 @@ import { expect } from 'aegir/chai' +import all from 'it-all' +import drain from 'it-drain' import { duplexPair } from 'it-pair/duplex' import { pipe } from 'it-pipe' import pLimit from 'p-limit' +import { Uint8ArrayList } from 'uint8arraylist' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import drain from 'it-drain' -import all from 'it-all' import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface-stream-muxer' -import { Uint8ArrayList } from 'uint8arraylist' export default async (createMuxer: (init?: StreamMuxerInit) => Promise, nStreams: number, nMsg: number, limit?: number): Promise => { const [dialerSocket, listenerSocket] = duplexPair() @@ -40,7 +40,7 @@ export default async (createMuxer: (init?: StreamMuxerInit) => Promise await all(source) + async (source) => all(source) ) expect(res).to.be.eql([]) diff --git a/packages/interface-stream-muxer/package.json b/packages/interface-stream-muxer/package.json index 888e0f277..4038f1ab5 100644 --- a/packages/interface-stream-muxer/package.json +++ b/packages/interface-stream-muxer/package.json @@ -138,7 +138,7 @@ "uint8arraylist": "^2.4.3" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-stream-muxer/src/index.ts b/packages/interface-stream-muxer/src/index.ts index cf2aa57e9..da782d531 100644 --- a/packages/interface-stream-muxer/src/index.ts +++ b/packages/interface-stream-muxer/src/index.ts @@ -1,6 +1,6 @@ -import type { Duplex, Source } from 'it-stream-types' import type { Direction, Stream } from '@libp2p/interface-connection' import type { AbortOptions } from '@libp2p/interfaces' +import type { Duplex, Source } from 'it-stream-types' import type { Uint8ArrayList } from 'uint8arraylist' export interface StreamMuxerFactory { diff --git a/packages/interface-transport-compliance-tests/package.json b/packages/interface-transport-compliance-tests/package.json index a7493b797..8d8abb851 100644 --- a/packages/interface-transport-compliance-tests/package.json +++ b/packages/interface-transport-compliance-tests/package.json @@ -139,7 +139,7 @@ "@libp2p/interface-transport": "^4.0.0", "@libp2p/interfaces": "^3.0.0", "@multiformats/multiaddr": "^12.0.0", - "aegir": "^38.1.0", + "aegir": "^39.0.5", "it-all": "^3.0.1", "it-drain": "^3.0.1", "it-pipe": "^3.0.1", diff --git a/packages/interface-transport-compliance-tests/src/dial-test.ts b/packages/interface-transport-compliance-tests/src/dial-test.ts index 111d3a363..855d911f7 100644 --- a/packages/interface-transport-compliance-tests/src/dial-test.ts +++ b/packages/interface-transport-compliance-tests/src/dial-test.ts @@ -1,18 +1,18 @@ -import { expect } from 'aegir/chai' import { isValidTick } from '@libp2p/interface-compliance-tests/is-valid-tick' import { mockUpgrader, mockRegistrar } from '@libp2p/interface-mocks' +import { AbortError } from '@libp2p/interfaces/errors' +import { EventEmitter } from '@libp2p/interfaces/events' +import { expect } from 'aegir/chai' import all from 'it-all' +import drain from 'it-drain' import { pipe } from 'it-pipe' -import { AbortError } from '@libp2p/interfaces/errors' import sinon from 'sinon' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import drain from 'it-drain' +import type { TransportTestFixtures, Connector } from './index.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' +import type { Registrar } from '@libp2p/interface-registrar' import type { Transport, Listener, Upgrader } from '@libp2p/interface-transport' -import type { TransportTestFixtures, Connector } from './index.js' import type { Multiaddr } from '@multiformats/multiaddr' -import type { Registrar } from '@libp2p/interface-registrar' -import { EventEmitter } from '@libp2p/interfaces/events' export default (common: TestSetup): void => { describe('dial', () => { diff --git a/packages/interface-transport-compliance-tests/src/filter-test.ts b/packages/interface-transport-compliance-tests/src/filter-test.ts index 52a1951df..713f86f00 100644 --- a/packages/interface-transport-compliance-tests/src/filter-test.ts +++ b/packages/interface-transport-compliance-tests/src/filter-test.ts @@ -1,7 +1,7 @@ import { expect } from 'aegir/chai' +import type { TransportTestFixtures } from './index.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { Transport } from '@libp2p/interface-transport' -import type { TransportTestFixtures } from './index.js' import type { Multiaddr } from '@multiformats/multiaddr' export default (common: TestSetup): void => { diff --git a/packages/interface-transport-compliance-tests/src/index.ts b/packages/interface-transport-compliance-tests/src/index.ts index dedf37859..59ff8b02c 100644 --- a/packages/interface-transport-compliance-tests/src/index.ts +++ b/packages/interface-transport-compliance-tests/src/index.ts @@ -1,6 +1,6 @@ import dial from './dial-test.js' -import listen from './listen-test.js' import filter from './filter-test.js' +import listen from './listen-test.js' import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { Transport } from '@libp2p/interface-transport' import type { Multiaddr } from '@multiformats/multiaddr' diff --git a/packages/interface-transport-compliance-tests/src/listen-test.ts b/packages/interface-transport-compliance-tests/src/listen-test.ts index 5bb56a078..d507e2ca0 100644 --- a/packages/interface-transport-compliance-tests/src/listen-test.ts +++ b/packages/interface-transport-compliance-tests/src/listen-test.ts @@ -1,20 +1,20 @@ /* eslint max-nested-callbacks: ["error", 8] */ -import { expect } from 'aegir/chai' -import sinon from 'sinon' -import pWaitFor from 'p-wait-for' -import { pipe } from 'it-pipe' -import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { isValidTick } from '@libp2p/interface-compliance-tests/is-valid-tick' import { mockUpgrader, mockRegistrar } from '@libp2p/interface-mocks' -import defer from 'p-defer' -import drain from 'it-drain' import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events' -import type { TestSetup } from '@libp2p/interface-compliance-tests' -import type { Transport, Upgrader } from '@libp2p/interface-transport' +import { expect } from 'aegir/chai' +import drain from 'it-drain' +import { pipe } from 'it-pipe' +import defer from 'p-defer' +import pWaitFor from 'p-wait-for' +import sinon from 'sinon' +import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import type { TransportTestFixtures } from './index.js' -import type { Multiaddr } from '@multiformats/multiaddr' +import type { TestSetup } from '@libp2p/interface-compliance-tests' import type { Connection } from '@libp2p/interface-connection' import type { Registrar } from '@libp2p/interface-registrar' +import type { Transport, Upgrader } from '@libp2p/interface-transport' +import type { Multiaddr } from '@multiformats/multiaddr' export default (common: TestSetup): void => { describe('listen', () => { diff --git a/packages/interface-transport/package.json b/packages/interface-transport/package.json index c8bc2ca00..80d13e04e 100644 --- a/packages/interface-transport/package.json +++ b/packages/interface-transport/package.json @@ -139,7 +139,7 @@ "it-stream-types": "^2.0.1" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interface-transport/src/index.ts b/packages/interface-transport/src/index.ts index 9eb1c2514..c770e8484 100644 --- a/packages/interface-transport/src/index.ts +++ b/packages/interface-transport/src/index.ts @@ -1,8 +1,8 @@ +import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection' +import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' import type { AbortOptions } from '@libp2p/interfaces' import type { EventEmitter } from '@libp2p/interfaces/events' -import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer' import type { Multiaddr } from '@multiformats/multiaddr' -import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection' import type { Duplex } from 'it-stream-types' export const symbol = Symbol.for('@libp2p/transport') diff --git a/packages/interfaces/package.json b/packages/interfaces/package.json index 7811fa9ab..c3514a943 100644 --- a/packages/interfaces/package.json +++ b/packages/interfaces/package.json @@ -160,7 +160,7 @@ "release": "aegir release" }, "devDependencies": { - "aegir": "^38.1.0" + "aegir": "^39.0.5" }, "typedoc": { "entryPoint": "./src/index.ts" diff --git a/packages/interfaces/src/errors.ts b/packages/interfaces/src/errors.ts index 8bfd0838a..a25be515d 100644 --- a/packages/interfaces/src/errors.ts +++ b/packages/interfaces/src/errors.ts @@ -14,13 +14,9 @@ export class AbortError extends Error { this.type = AbortError.type } - static get code (): string { - return 'ABORT_ERR' - } + static readonly code = 'ABORT_ERR' - static get type (): string { - return 'aborted' - } + static readonly type = 'aborted' } export class CodeError = Record> extends Error { diff --git a/packages/interfaces/src/events.ts b/packages/interfaces/src/events.ts index fa1eac05c..b92e51879 100644 --- a/packages/interfaces/src/events.ts +++ b/packages/interfaces/src/events.ts @@ -17,7 +17,7 @@ interface Listener { * etc */ export class EventEmitter> extends EventTarget { - #listeners: Map = new Map() + #listeners = new Map() listenerCount (type: string): number { const listeners = this.#listeners.get(type)