libp2p 0.45.0-752db6d6 → 0.45.0-e93d258d

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.
Files changed (189) hide show
  1. package/README.md +27 -30
  2. package/dist/index.min.js +26 -26
  3. package/dist/src/address-manager/index.d.ts +3 -3
  4. package/dist/src/address-manager/index.d.ts.map +1 -1
  5. package/dist/src/address-manager/index.js +8 -2
  6. package/dist/src/address-manager/index.js.map +1 -1
  7. package/dist/src/autonat/index.d.ts +1 -1
  8. package/dist/src/autonat/index.d.ts.map +1 -1
  9. package/dist/src/autonat/index.js +13 -4
  10. package/dist/src/autonat/index.js.map +1 -1
  11. package/dist/src/circuit-relay/index.d.ts +1 -1
  12. package/dist/src/circuit-relay/index.d.ts.map +1 -1
  13. package/dist/src/circuit-relay/server/advert-service.d.ts +2 -2
  14. package/dist/src/circuit-relay/server/advert-service.d.ts.map +1 -1
  15. package/dist/src/circuit-relay/server/advert-service.js +7 -3
  16. package/dist/src/circuit-relay/server/advert-service.js.map +1 -1
  17. package/dist/src/circuit-relay/server/index.d.ts +8 -8
  18. package/dist/src/circuit-relay/server/index.d.ts.map +1 -1
  19. package/dist/src/circuit-relay/server/index.js +23 -10
  20. package/dist/src/circuit-relay/server/index.js.map +1 -1
  21. package/dist/src/circuit-relay/server/reservation-store.d.ts +5 -5
  22. package/dist/src/circuit-relay/server/reservation-store.d.ts.map +1 -1
  23. package/dist/src/circuit-relay/server/reservation-store.js +10 -3
  24. package/dist/src/circuit-relay/server/reservation-store.js.map +1 -1
  25. package/dist/src/circuit-relay/server/reservation-voucher.d.ts.map +1 -1
  26. package/dist/src/circuit-relay/server/reservation-voucher.js +5 -2
  27. package/dist/src/circuit-relay/server/reservation-voucher.js.map +1 -1
  28. package/dist/src/circuit-relay/transport/discovery.d.ts +4 -4
  29. package/dist/src/circuit-relay/transport/discovery.d.ts.map +1 -1
  30. package/dist/src/circuit-relay/transport/discovery.js +9 -3
  31. package/dist/src/circuit-relay/transport/discovery.js.map +1 -1
  32. package/dist/src/circuit-relay/transport/index.d.ts +8 -9
  33. package/dist/src/circuit-relay/transport/index.d.ts.map +1 -1
  34. package/dist/src/circuit-relay/transport/index.js +20 -14
  35. package/dist/src/circuit-relay/transport/index.js.map +1 -1
  36. package/dist/src/circuit-relay/transport/listener.d.ts +1 -1
  37. package/dist/src/circuit-relay/transport/listener.d.ts.map +1 -1
  38. package/dist/src/circuit-relay/transport/listener.js +15 -19
  39. package/dist/src/circuit-relay/transport/listener.js.map +1 -1
  40. package/dist/src/circuit-relay/transport/reservation-store.d.ts +5 -5
  41. package/dist/src/circuit-relay/transport/reservation-store.d.ts.map +1 -1
  42. package/dist/src/circuit-relay/transport/reservation-store.js +55 -49
  43. package/dist/src/circuit-relay/transport/reservation-store.js.map +1 -1
  44. package/dist/src/circuit-relay/utils.d.ts.map +1 -1
  45. package/dist/src/circuit-relay/utils.js +3 -3
  46. package/dist/src/circuit-relay/utils.js.map +1 -1
  47. package/dist/src/components.d.ts +6 -6
  48. package/dist/src/components.d.ts.map +1 -1
  49. package/dist/src/components.js +2 -2
  50. package/dist/src/components.js.map +1 -1
  51. package/dist/src/config/connection-gater.browser.d.ts.map +1 -1
  52. package/dist/src/config/connection-gater.browser.js.map +1 -1
  53. package/dist/src/config.d.ts +2 -2
  54. package/dist/src/config.d.ts.map +1 -1
  55. package/dist/src/config.js +4 -7
  56. package/dist/src/config.js.map +1 -1
  57. package/dist/src/connection/index.d.ts +3 -3
  58. package/dist/src/connection/index.d.ts.map +1 -1
  59. package/dist/src/connection/index.js +38 -8
  60. package/dist/src/connection/index.js.map +1 -1
  61. package/dist/src/connection-manager/auto-dial.d.ts +3 -3
  62. package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
  63. package/dist/src/connection-manager/auto-dial.js +9 -1
  64. package/dist/src/connection-manager/auto-dial.js.map +1 -1
  65. package/dist/src/connection-manager/connection-pruner.d.ts +2 -2
  66. package/dist/src/connection-manager/connection-pruner.d.ts.map +1 -1
  67. package/dist/src/connection-manager/connection-pruner.js +5 -0
  68. package/dist/src/connection-manager/connection-pruner.js.map +1 -1
  69. package/dist/src/connection-manager/dial-queue.d.ts +6 -6
  70. package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
  71. package/dist/src/connection-manager/dial-queue.js +25 -11
  72. package/dist/src/connection-manager/dial-queue.js.map +1 -1
  73. package/dist/src/connection-manager/index.d.ts +12 -12
  74. package/dist/src/connection-manager/index.d.ts.map +1 -1
  75. package/dist/src/connection-manager/index.js +21 -7
  76. package/dist/src/connection-manager/index.js.map +1 -1
  77. package/dist/src/connection-manager/utils.d.ts +2 -3
  78. package/dist/src/connection-manager/utils.d.ts.map +1 -1
  79. package/dist/src/connection-manager/utils.js +3 -3
  80. package/dist/src/connection-manager/utils.js.map +1 -1
  81. package/dist/src/content-routing/index.d.ts +2 -2
  82. package/dist/src/content-routing/index.d.ts.map +1 -1
  83. package/dist/src/content-routing/index.js +7 -4
  84. package/dist/src/content-routing/index.js.map +1 -1
  85. package/dist/src/content-routing/utils.d.ts +1 -1
  86. package/dist/src/content-routing/utils.d.ts.map +1 -1
  87. package/dist/src/fetch/index.d.ts +2 -2
  88. package/dist/src/fetch/index.d.ts.map +1 -1
  89. package/dist/src/fetch/index.js +12 -7
  90. package/dist/src/fetch/index.js.map +1 -1
  91. package/dist/src/get-peer.d.ts +1 -1
  92. package/dist/src/get-peer.d.ts.map +1 -1
  93. package/dist/src/get-peer.js +3 -3
  94. package/dist/src/get-peer.js.map +1 -1
  95. package/dist/src/identify/identify.d.ts +3 -3
  96. package/dist/src/identify/identify.d.ts.map +1 -1
  97. package/dist/src/identify/identify.js +91 -81
  98. package/dist/src/identify/identify.js.map +1 -1
  99. package/dist/src/identify/index.d.ts +5 -4
  100. package/dist/src/identify/index.d.ts.map +1 -1
  101. package/dist/src/identify/index.js +1 -1
  102. package/dist/src/identify/index.js.map +1 -1
  103. package/dist/src/index.d.ts +19 -15
  104. package/dist/src/index.d.ts.map +1 -1
  105. package/dist/src/index.js.map +1 -1
  106. package/dist/src/insecure/index.js +6 -8
  107. package/dist/src/insecure/index.js.map +1 -1
  108. package/dist/src/libp2p.d.ts +11 -11
  109. package/dist/src/libp2p.d.ts.map +1 -1
  110. package/dist/src/libp2p.js +58 -59
  111. package/dist/src/libp2p.js.map +1 -1
  112. package/dist/src/peer-routing.d.ts +2 -2
  113. package/dist/src/peer-routing.d.ts.map +1 -1
  114. package/dist/src/peer-routing.js +8 -6
  115. package/dist/src/peer-routing.js.map +1 -1
  116. package/dist/src/ping/index.d.ts +2 -2
  117. package/dist/src/ping/index.d.ts.map +1 -1
  118. package/dist/src/ping/index.js +14 -8
  119. package/dist/src/ping/index.js.map +1 -1
  120. package/dist/src/pnet/crypto.js +3 -3
  121. package/dist/src/pnet/crypto.js.map +1 -1
  122. package/dist/src/pnet/index.d.ts.map +1 -1
  123. package/dist/src/pnet/index.js +9 -6
  124. package/dist/src/pnet/index.js.map +1 -1
  125. package/dist/src/pnet/key-generator.js +1 -1
  126. package/dist/src/pnet/key-generator.js.map +1 -1
  127. package/dist/src/pubsub/dummy-pubsub.d.ts.map +1 -1
  128. package/dist/src/pubsub/dummy-pubsub.js +2 -5
  129. package/dist/src/pubsub/dummy-pubsub.js.map +1 -1
  130. package/dist/src/registrar.d.ts +3 -4
  131. package/dist/src/registrar.d.ts.map +1 -1
  132. package/dist/src/registrar.js +6 -3
  133. package/dist/src/registrar.js.map +1 -1
  134. package/dist/src/transport-manager.d.ts +5 -5
  135. package/dist/src/transport-manager.d.ts.map +1 -1
  136. package/dist/src/transport-manager.js +8 -3
  137. package/dist/src/transport-manager.js.map +1 -1
  138. package/dist/src/upgrader.d.ts +8 -8
  139. package/dist/src/upgrader.d.ts.map +1 -1
  140. package/dist/src/upgrader.js +11 -6
  141. package/dist/src/upgrader.js.map +1 -1
  142. package/dist/src/upnp-nat/index.d.ts +32 -3
  143. package/dist/src/upnp-nat/index.d.ts.map +1 -1
  144. package/dist/src/upnp-nat/index.js +13 -4
  145. package/dist/src/upnp-nat/index.js.map +1 -1
  146. package/dist/src/version.d.ts +1 -1
  147. package/dist/src/version.js +1 -1
  148. package/package.json +4 -5
  149. package/src/address-manager/index.ts +6 -6
  150. package/src/autonat/index.ts +14 -14
  151. package/src/circuit-relay/index.ts +1 -1
  152. package/src/circuit-relay/server/advert-service.ts +4 -4
  153. package/src/circuit-relay/server/index.ts +18 -18
  154. package/src/circuit-relay/server/reservation-store.ts +5 -5
  155. package/src/circuit-relay/server/reservation-voucher.ts +1 -1
  156. package/src/circuit-relay/transport/discovery.ts +7 -7
  157. package/src/circuit-relay/transport/index.ts +18 -23
  158. package/src/circuit-relay/transport/listener.ts +8 -8
  159. package/src/circuit-relay/transport/reservation-store.ts +10 -10
  160. package/src/circuit-relay/utils.ts +6 -6
  161. package/src/components.ts +6 -6
  162. package/src/config/connection-gater.browser.ts +1 -1
  163. package/src/config.ts +8 -12
  164. package/src/connection/index.ts +6 -10
  165. package/src/connection-manager/auto-dial.ts +5 -5
  166. package/src/connection-manager/connection-pruner.ts +4 -4
  167. package/src/connection-manager/dial-queue.ts +18 -17
  168. package/src/connection-manager/index.ts +18 -18
  169. package/src/connection-manager/utils.ts +4 -5
  170. package/src/content-routing/index.ts +6 -6
  171. package/src/content-routing/utils.ts +1 -1
  172. package/src/fetch/index.ts +12 -12
  173. package/src/get-peer.ts +4 -4
  174. package/src/identify/identify.ts +20 -20
  175. package/src/identify/index.ts +6 -6
  176. package/src/index.ts +15 -15
  177. package/src/insecure/index.ts +6 -6
  178. package/src/libp2p.ts +35 -35
  179. package/src/peer-routing.ts +9 -9
  180. package/src/ping/index.ts +12 -12
  181. package/src/pnet/crypto.ts +3 -3
  182. package/src/pnet/index.ts +6 -6
  183. package/src/pnet/key-generator.ts +1 -1
  184. package/src/pubsub/dummy-pubsub.ts +2 -2
  185. package/src/registrar.ts +5 -6
  186. package/src/transport-manager.ts +8 -8
  187. package/src/upgrader.ts +17 -17
  188. package/src/upnp-nat/index.ts +9 -9
  189. package/src/version.ts +1 -1
@@ -1,28 +1,28 @@
1
- import { logger } from '@libp2p/logger'
2
- import { CodeError } from '@libp2p/interfaces/errors'
3
- import type { AbortOptions } from '@libp2p/interfaces'
4
- import type { EventEmitter } from '@libp2p/interfaces/events'
5
- import type { Startable } from '@libp2p/interfaces/startable'
6
- import { codes } from '../errors.js'
7
- import type { PeerId } from '@libp2p/interface-peer-id'
8
- import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection'
9
- import type { ConnectionManager } from '@libp2p/interface-connection-manager'
10
- import type { PeerStore } from '@libp2p/interface-peer-store'
11
- import { Multiaddr, Resolver, multiaddr } from '@multiformats/multiaddr'
12
1
  import { KEEP_ALIVE } from '@libp2p/interface-peer-store/tags'
2
+ import { CodeError } from '@libp2p/interfaces/errors'
3
+ import { logger } from '@libp2p/logger'
4
+ import { PeerMap } from '@libp2p/peer-collections'
5
+ import { publicAddressesFirst } from '@libp2p/utils/address-sort'
6
+ import { type Multiaddr, type Resolver, multiaddr } from '@multiformats/multiaddr'
7
+ import { dnsaddrResolver } from '@multiformats/multiaddr/resolvers'
13
8
  import { RateLimiterMemory } from 'rate-limiter-flexible'
14
- import type { Metrics } from '@libp2p/interface-metrics'
15
- import type { TransportManager } from '@libp2p/interface-transport'
9
+ import { codes } from '../errors.js'
16
10
  import { getPeerAddress } from '../get-peer.js'
17
11
  import { AutoDial } from './auto-dial.js'
18
- import { DialQueue } from './dial-queue.js'
19
12
  import { ConnectionPruner } from './connection-pruner.js'
20
- import type { ConnectionGater } from '@libp2p/interface-connection-gater'
21
- import { PeerMap } from '@libp2p/peer-collections'
22
- import { publicAddressesFirst } from '@libp2p/utils/address-sort'
23
13
  import { AUTO_DIAL_CONCURRENCY, AUTO_DIAL_PRIORITY, DIAL_TIMEOUT, INBOUND_CONNECTION_THRESHOLD, MAX_CONNECTIONS, MAX_INCOMING_PENDING_CONNECTIONS, MAX_PARALLEL_DIALS, MAX_PEER_ADDRS_TO_DIAL, MIN_CONNECTIONS } from './constants.js'
24
- import { dnsaddrResolver } from '@multiformats/multiaddr/resolvers'
14
+ import { DialQueue } from './dial-queue.js'
15
+ import type { Connection, MultiaddrConnection } from '@libp2p/interface-connection'
16
+ import type { ConnectionGater } from '@libp2p/interface-connection-gater'
17
+ import type { ConnectionManager } from '@libp2p/interface-connection-manager'
25
18
  import type { PendingDial, AddressSorter, Libp2pEvents } from '@libp2p/interface-libp2p'
19
+ import type { Metrics } from '@libp2p/interface-metrics'
20
+ import type { PeerId } from '@libp2p/interface-peer-id'
21
+ import type { PeerStore } from '@libp2p/interface-peer-store'
22
+ import type { TransportManager } from '@libp2p/interface-transport'
23
+ import type { AbortOptions } from '@libp2p/interfaces'
24
+ import type { EventEmitter } from '@libp2p/interfaces/events'
25
+ import type { Startable } from '@libp2p/interfaces/startable'
26
26
 
27
27
  const log = logger('libp2p:connection-manager')
28
28
 
@@ -1,8 +1,7 @@
1
- import { AbortOptions, multiaddr } from '@multiformats/multiaddr'
2
- import type { Multiaddr } from '@multiformats/multiaddr'
3
- import { logger } from '@libp2p/logger'
4
- import { ClearableSignal, anySignal } from 'any-signal'
5
1
  import { setMaxListeners } from 'events'
2
+ import { logger } from '@libp2p/logger'
3
+ import { type AbortOptions, multiaddr, type Multiaddr } from '@multiformats/multiaddr'
4
+ import { type ClearableSignal, anySignal } from 'any-signal'
6
5
 
7
6
  const log = logger('libp2p:connection-manager:utils')
8
7
 
@@ -21,7 +20,7 @@ export async function resolveMultiaddrs (ma: Multiaddr, options: AbortOptions):
21
20
 
22
21
  const resolvedMultiaddrs = await resolveRecord(ma, options)
23
22
  const recursiveMultiaddrs = await Promise.all(resolvedMultiaddrs.map(async (nm) => {
24
- return await resolveMultiaddrs(nm, options)
23
+ return resolveMultiaddrs(nm, options)
25
24
  }))
26
25
 
27
26
  const addrs = recursiveMultiaddrs.flat()
@@ -1,18 +1,18 @@
1
1
  import { CodeError } from '@libp2p/interfaces/errors'
2
+ import merge from 'it-merge'
3
+ import { pipe } from 'it-pipe'
2
4
  import { messages, codes } from '../errors.js'
3
5
  import {
4
6
  storeAddresses,
5
7
  uniquePeers,
6
8
  requirePeers
7
9
  } from './utils.js'
8
- import merge from 'it-merge'
9
- import { pipe } from 'it-pipe'
10
10
  import type { ContentRouting } from '@libp2p/interface-content-routing'
11
+ import type { PeerInfo } from '@libp2p/interface-peer-info'
12
+ import type { PeerStore } from '@libp2p/interface-peer-store'
11
13
  import type { AbortOptions } from '@libp2p/interfaces'
12
14
  import type { Startable } from '@libp2p/interfaces/startable'
13
15
  import type { CID } from 'multiformats/cid'
14
- import type { PeerStore } from '@libp2p/interface-peer-store'
15
- import type { PeerInfo } from '@libp2p/interface-peer-info'
16
16
 
17
17
  export interface CompoundContentRoutingInit {
18
18
  routers: ContentRouting[]
@@ -97,8 +97,8 @@ export class CompoundContentRouting implements ContentRouting, Startable {
97
97
  throw new CodeError(messages.NOT_STARTED_YET, codes.DHT_NOT_STARTED)
98
98
  }
99
99
 
100
- return await Promise.any(this.routers.map(async (router) => {
101
- return await router.get(key, options)
100
+ return Promise.any(this.routers.map(async (router) => {
101
+ return router.get(key, options)
102
102
  }))
103
103
  }
104
104
  }
@@ -1,9 +1,9 @@
1
1
  import { CodeError } from '@libp2p/interfaces/errors'
2
2
  import filter from 'it-filter'
3
3
  import map from 'it-map'
4
- import type { Source } from 'it-stream-types'
5
4
  import type { PeerInfo } from '@libp2p/interface-peer-info'
6
5
  import type { PeerStore } from '@libp2p/interface-peer-store'
6
+ import type { Source } from 'it-stream-types'
7
7
 
8
8
  /**
9
9
  * Store the multiaddrs from every peer in the passed peer store
@@ -1,21 +1,21 @@
1
- import { logger } from '@libp2p/logger'
1
+ import { setMaxListeners } from 'events'
2
2
  import { CodeError } from '@libp2p/interfaces/errors'
3
- import { codes } from '../errors.js'
4
- import * as lp from 'it-length-prefixed'
5
- import { FetchRequest, FetchResponse } from './pb/proto.js'
6
- import { PROTOCOL_NAME, PROTOCOL_VERSION } from './constants.js'
7
- import type { PeerId } from '@libp2p/interface-peer-id'
8
- import type { Startable } from '@libp2p/interfaces/startable'
9
- import type { Stream } from '@libp2p/interface-connection'
10
- import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
11
- import type { AbortOptions } from '@libp2p/interfaces'
3
+ import { logger } from '@libp2p/logger'
12
4
  import { abortableDuplex } from 'abortable-iterator'
13
- import { pipe } from 'it-pipe'
14
5
  import first from 'it-first'
15
- import { setMaxListeners } from 'events'
6
+ import * as lp from 'it-length-prefixed'
7
+ import { pipe } from 'it-pipe'
16
8
  import { fromString as uint8arrayFromString } from 'uint8arrays/from-string'
17
9
  import { toString as uint8arrayToString } from 'uint8arrays/to-string'
10
+ import { codes } from '../errors.js'
11
+ import { PROTOCOL_NAME, PROTOCOL_VERSION } from './constants.js'
12
+ import { FetchRequest, FetchResponse } from './pb/proto.js'
13
+ import type { Stream } from '@libp2p/interface-connection'
18
14
  import type { ConnectionManager } from '@libp2p/interface-connection-manager'
15
+ import type { PeerId } from '@libp2p/interface-peer-id'
16
+ import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
17
+ import type { AbortOptions } from '@libp2p/interfaces'
18
+ import type { Startable } from '@libp2p/interfaces/startable'
19
19
 
20
20
  const log = logger('libp2p:fetch')
21
21
 
package/src/get-peer.ts CHANGED
@@ -1,11 +1,11 @@
1
+ import { isPeerId } from '@libp2p/interface-peer-id'
2
+ import { CodeError } from '@libp2p/interfaces/errors'
3
+ import { logger } from '@libp2p/logger'
1
4
  import { peerIdFromString } from '@libp2p/peer-id'
2
- import type { Multiaddr } from '@multiformats/multiaddr'
3
5
  import { isMultiaddr } from '@multiformats/multiaddr'
4
- import { CodeError } from '@libp2p/interfaces/errors'
5
6
  import { codes } from './errors.js'
6
- import { isPeerId } from '@libp2p/interface-peer-id'
7
7
  import type { PeerId } from '@libp2p/interface-peer-id'
8
- import { logger } from '@libp2p/logger'
8
+ import type { Multiaddr } from '@multiformats/multiaddr'
9
9
 
10
10
  const log = logger('libp2p:get-peer')
11
11
 
@@ -1,12 +1,19 @@
1
- import { logger } from '@libp2p/logger'
1
+ import { setMaxListeners } from 'events'
2
2
  import { CodeError } from '@libp2p/interfaces/errors'
3
+ import { logger } from '@libp2p/logger'
4
+ import { peerIdFromKeys } from '@libp2p/peer-id'
5
+ import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record'
6
+ import { type Multiaddr, multiaddr, protocols } from '@multiformats/multiaddr'
7
+ import { abortableDuplex } from 'abortable-iterator'
8
+ import { anySignal } from 'any-signal'
9
+ import first from 'it-first'
3
10
  import * as lp from 'it-length-prefixed'
11
+ import { pbStream } from 'it-pb-stream'
4
12
  import { pipe } from 'it-pipe'
5
- import first from 'it-first'
6
13
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
7
- import { Multiaddr, multiaddr, protocols } from '@multiformats/multiaddr'
8
- import { Identify } from './pb/message.js'
9
- import { RecordEnvelope, PeerRecord } from '@libp2p/peer-record'
14
+ import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
15
+ import { isNode, isBrowser, isWebWorker, isElectronMain, isElectronRenderer, isReactNative } from 'wherearewe'
16
+ import { codes } from '../errors.js'
10
17
  import {
11
18
  AGENT_VERSION,
12
19
  IDENTIFY_PROTOCOL_VERSION,
@@ -15,25 +22,18 @@ import {
15
22
  MULTICODEC_IDENTIFY_PROTOCOL_VERSION,
16
23
  MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION
17
24
  } from './consts.js'
18
- import { codes } from '../errors.js'
19
- import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
25
+ import { Identify } from './pb/message.js'
26
+ import type { IdentifyServiceComponents, IdentifyServiceInit } from './index.js'
27
+ import type { AddressManager } from '@libp2p/interface-address-manager'
20
28
  import type { Connection, Stream } from '@libp2p/interface-connection'
21
- import type { Startable } from '@libp2p/interfaces/startable'
22
- import { peerIdFromKeys } from '@libp2p/peer-id'
23
- import type { AbortOptions } from '@libp2p/interfaces'
24
- import { abortableDuplex } from 'abortable-iterator'
25
- import { setMaxListeners } from 'events'
26
29
  import type { ConnectionManager } from '@libp2p/interface-connection-manager'
30
+ import type { Libp2pEvents, IdentifyResult, SignedPeerRecord } from '@libp2p/interface-libp2p'
27
31
  import type { PeerId } from '@libp2p/interface-peer-id'
28
32
  import type { Peer, PeerStore } from '@libp2p/interface-peer-store'
29
- import type { AddressManager } from '@libp2p/interface-address-manager'
30
- import { anySignal } from 'any-signal'
31
- import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
32
- import { pbStream } from 'it-pb-stream'
33
- import { isNode, isBrowser, isWebWorker, isElectronMain, isElectronRenderer, isReactNative } from 'wherearewe'
34
- import type { IdentifyServiceComponents, IdentifyServiceInit } from './index.js'
35
- import type { Libp2pEvents, IdentifyResult, SignedPeerRecord } from '@libp2p/interface-libp2p'
33
+ import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
34
+ import type { AbortOptions } from '@libp2p/interfaces'
36
35
  import type { EventEmitter } from '@libp2p/interfaces/events'
36
+ import type { Startable } from '@libp2p/interfaces/startable'
37
37
 
38
38
  const log = logger('libp2p:identify')
39
39
 
@@ -277,7 +277,7 @@ export class DefaultIdentifyService implements Startable {
277
277
  (source) => lp.decode(source, {
278
278
  maxDataLength: this.maxIdentifyMessageSize ?? MAX_IDENTIFY_MESSAGE_SIZE
279
279
  }),
280
- async (source) => await first(source)
280
+ async (source) => first(source)
281
281
  )
282
282
 
283
283
  if (data == null) {
@@ -1,16 +1,16 @@
1
- import { Identify } from './pb/message.js'
2
1
  import {
3
2
  MULTICODEC_IDENTIFY,
4
3
  MULTICODEC_IDENTIFY_PUSH
5
4
  } from './consts.js'
6
- import type { Registrar } from '@libp2p/interface-registrar'
5
+ import { DefaultIdentifyService } from './identify.js'
6
+ import { Identify } from './pb/message.js'
7
+ import type { AddressManager } from '@libp2p/interface-address-manager'
7
8
  import type { ConnectionManager } from '@libp2p/interface-connection-manager'
9
+ import type { Libp2pEvents } from '@libp2p/interface-libp2p'
8
10
  import type { PeerId } from '@libp2p/interface-peer-id'
9
11
  import type { PeerStore } from '@libp2p/interface-peer-store'
10
- import type { AddressManager } from '@libp2p/interface-address-manager'
12
+ import type { Registrar } from '@libp2p/interface-registrar'
11
13
  import type { EventEmitter } from '@libp2p/interfaces/events'
12
- import type { Libp2pEvents } from '@libp2p/interface-libp2p'
13
- import { DefaultIdentifyService } from './identify.js'
14
14
 
15
15
  export interface IdentifyServiceInit {
16
16
  /**
@@ -60,6 +60,6 @@ export const multicodecs = {
60
60
 
61
61
  export const Message = { Identify }
62
62
 
63
- export function identifyService (init: IdentifyServiceInit = {}): (components: IdentifyServiceComponents) => {} {
63
+ export function identifyService (init: IdentifyServiceInit = {}): (components: IdentifyServiceComponents) => DefaultIdentifyService {
64
64
  return (components) => new DefaultIdentifyService(components, init)
65
65
  }
package/src/index.ts CHANGED
@@ -15,25 +15,25 @@
15
15
  */
16
16
 
17
17
  import { createLibp2pNode } from './libp2p.js'
18
- import type { RecursivePartial } from '@libp2p/interfaces'
18
+ import type { AddressManagerInit } from './address-manager/index.js'
19
+ import type { Components } from './components.js'
20
+ import type { ConnectionManagerInit } from './connection-manager/index.js'
19
21
  import type { TransportManagerInit } from './transport-manager.js'
20
- import type { Datastore } from 'interface-datastore'
21
- import type { PeerId } from '@libp2p/interface-peer-id'
22
- import type { PeerDiscovery } from '@libp2p/interface-peer-discovery'
23
22
  import type { ConnectionProtector } from '@libp2p/interface-connection'
24
- import type { ConnectionGater } from '@libp2p/interface-connection-gater'
25
- import type { Transport } from '@libp2p/interface-transport'
26
- import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer'
27
23
  import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter'
28
- import type { PeerRouting } from '@libp2p/interface-peer-routing'
24
+ import type { ConnectionGater } from '@libp2p/interface-connection-gater'
29
25
  import type { ContentRouting } from '@libp2p/interface-content-routing'
30
- import type { Metrics } from '@libp2p/interface-metrics'
31
- import type { Components } from './components.js'
32
26
  import type { Libp2p, ServiceMap } from '@libp2p/interface-libp2p'
27
+ import type { Metrics } from '@libp2p/interface-metrics'
28
+ import type { PeerDiscovery } from '@libp2p/interface-peer-discovery'
29
+ import type { PeerId } from '@libp2p/interface-peer-id'
30
+ import type { PeerRouting } from '@libp2p/interface-peer-routing'
31
+ import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer'
32
+ import type { Transport } from '@libp2p/interface-transport'
33
+ import type { RecursivePartial } from '@libp2p/interfaces'
33
34
  import type { KeyChainInit } from '@libp2p/keychain'
34
- import type { AddressManagerInit } from './address-manager/index.js'
35
- import type { ConnectionManagerInit } from './connection-manager/index.js'
36
35
  import type { PersistentPeerStoreInit } from '@libp2p/peer-store'
36
+ import type { Datastore } from 'interface-datastore'
37
37
 
38
38
  export type ServiceFactoryMap<T extends Record<string, unknown> = Record<string, unknown>> = {
39
39
  [Property in keyof T]: (components: Components) => T[Property]
@@ -42,7 +42,7 @@ export type ServiceFactoryMap<T extends Record<string, unknown> = Record<string,
42
42
  /**
43
43
  * For Libp2p configurations and modules details read the [Configuration Document](./CONFIGURATION.md).
44
44
  */
45
- export interface Libp2pInit<T extends ServiceMap = {}> {
45
+ export interface Libp2pInit<T extends ServiceMap = { x: Record<string, unknown> }> {
46
46
  /**
47
47
  * peerId instance (it will be created if not provided)
48
48
  */
@@ -113,7 +113,7 @@ export interface Libp2pInit<T extends ServiceMap = {}> {
113
113
 
114
114
  export type { Libp2p }
115
115
 
116
- export type Libp2pOptions<T extends ServiceMap = {}> = RecursivePartial<Libp2pInit<T>> & { start?: boolean }
116
+ export type Libp2pOptions<T extends ServiceMap = Record<string, unknown>> = RecursivePartial<Libp2pInit<T>> & { start?: boolean }
117
117
 
118
118
  /**
119
119
  * Returns a new instance of the Libp2p interface, generating a new PeerId
@@ -141,7 +141,7 @@ export type Libp2pOptions<T extends ServiceMap = {}> = RecursivePartial<Libp2pIn
141
141
  * const libp2p = await createLibp2p(options)
142
142
  * ```
143
143
  */
144
- export async function createLibp2p <T extends ServiceMap = {}> (options: Libp2pOptions<T>): Promise<Libp2p<T>> {
144
+ export async function createLibp2p <T extends ServiceMap = { x: Record<string, unknown> }> (options: Libp2pOptions<T>): Promise<Libp2p<T>> {
145
145
  const node = await createLibp2pNode(options)
146
146
 
147
147
  if (options.start !== false) {
@@ -22,16 +22,16 @@
22
22
  * ```
23
23
  */
24
24
 
25
+ import { UnexpectedPeerError, InvalidCryptoExchangeError } from '@libp2p/interface-connection-encrypter/errors'
25
26
  import { logger } from '@libp2p/logger'
27
+ import { peerIdFromBytes, peerIdFromKeys } from '@libp2p/peer-id'
26
28
  import { handshake } from 'it-handshake'
27
29
  import * as lp from 'it-length-prefixed'
28
- import { UnexpectedPeerError, InvalidCryptoExchangeError } from '@libp2p/interface-connection-encrypter/errors'
30
+ import map from 'it-map'
29
31
  import { Exchange, KeyType } from './pb/proto.js'
30
- import type { PeerId } from '@libp2p/interface-peer-id'
31
- import { peerIdFromBytes, peerIdFromKeys } from '@libp2p/peer-id'
32
32
  import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface-connection-encrypter'
33
+ import type { PeerId } from '@libp2p/interface-peer-id'
33
34
  import type { Duplex, Source } from 'it-stream-types'
34
- import map from 'it-map'
35
35
  import type { Uint8ArrayList } from 'uint8arraylist'
36
36
 
37
37
  const log = logger('libp2p:plaintext')
@@ -125,11 +125,11 @@ class Plaintext implements ConnectionEncrypter {
125
125
  public protocol: string = PROTOCOL
126
126
 
127
127
  async secureInbound (localId: PeerId, conn: Duplex<AsyncGenerator<Uint8Array>, Source<Uint8Array>, Promise<void>>, remoteId?: PeerId): Promise<SecuredConnection> {
128
- return await encrypt(localId, conn, remoteId)
128
+ return encrypt(localId, conn, remoteId)
129
129
  }
130
130
 
131
131
  async secureOutbound (localId: PeerId, conn: Duplex<AsyncGenerator<Uint8Array>, Source<Uint8Array>, Promise<void>>, remoteId?: PeerId): Promise<SecuredConnection> {
132
- return await encrypt(localId, conn, remoteId)
132
+ return encrypt(localId, conn, remoteId)
133
133
  }
134
134
  }
135
135
 
package/src/libp2p.ts CHANGED
@@ -1,48 +1,48 @@
1
- import { logger } from '@libp2p/logger'
2
- import type { AbortOptions } from '@libp2p/interfaces'
1
+ import { setMaxListeners } from 'events'
2
+ import { unmarshalPublicKey } from '@libp2p/crypto/keys'
3
+ import { type ContentRouting, contentRouting } from '@libp2p/interface-content-routing'
4
+ import { peerDiscovery } from '@libp2p/interface-peer-discovery'
5
+ import { type PeerRouting, peerRouting } from '@libp2p/interface-peer-routing'
6
+ import { CodeError } from '@libp2p/interfaces/errors'
3
7
  import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events'
4
- import { isMultiaddr, Multiaddr } from '@multiformats/multiaddr'
8
+ import { DefaultKeyChain } from '@libp2p/keychain'
9
+ import { logger } from '@libp2p/logger'
10
+ import { PeerSet } from '@libp2p/peer-collections'
11
+ import { peerIdFromString } from '@libp2p/peer-id'
12
+ import { createEd25519PeerId } from '@libp2p/peer-id-factory'
13
+ import { PersistentPeerStore } from '@libp2p/peer-store'
14
+ import { isMultiaddr, type Multiaddr } from '@multiformats/multiaddr'
5
15
  import { MemoryDatastore } from 'datastore-core/memory'
6
- import { DefaultPeerRouting } from './peer-routing.js'
7
- import { CompoundContentRouting } from './content-routing/index.js'
8
- import { codes } from './errors.js'
16
+ import mergeOptions from 'merge-options'
17
+ import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
18
+ import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
9
19
  import { DefaultAddressManager } from './address-manager/index.js'
20
+ import { defaultComponents } from './components.js'
21
+ import { connectionGater } from './config/connection-gater.js'
22
+ import { validateConfig } from './config.js'
10
23
  import { DefaultConnectionManager } from './connection-manager/index.js'
11
- import { DefaultKeyChain } from '@libp2p/keychain'
24
+ import { CompoundContentRouting } from './content-routing/index.js'
25
+ import { codes } from './errors.js'
26
+ import { DefaultPeerRouting } from './peer-routing.js'
27
+ import { DefaultRegistrar } from './registrar.js'
12
28
  import { DefaultTransportManager } from './transport-manager.js'
13
29
  import { DefaultUpgrader } from './upgrader.js'
14
- import { DefaultRegistrar } from './registrar.js'
15
- import { PersistentPeerStore } from '@libp2p/peer-store'
16
- import { defaultComponents } from './components.js'
17
30
  import type { Components } from './components.js'
18
- import type { PeerId } from '@libp2p/interface-peer-id'
19
- import type { Connection, Stream } from '@libp2p/interface-connection'
20
- import type { StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar'
21
- import type { PeerInfo } from '@libp2p/interface-peer-info'
22
31
  import type { Libp2p, Libp2pInit, Libp2pOptions } from './index.js'
23
- import type { PeerStore } from '@libp2p/interface-peer-store'
24
- import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
25
- import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
26
- import { CodeError } from '@libp2p/interfaces/errors'
27
- import type { Metrics } from '@libp2p/interface-metrics'
28
- import { PeerSet } from '@libp2p/peer-collections'
32
+ import type { Connection, Stream } from '@libp2p/interface-connection'
29
33
  import type { KeyChain } from '@libp2p/interface-keychain'
30
34
  import type { Libp2pEvents, PendingDial, ServiceMap } from '@libp2p/interface-libp2p'
31
- import { setMaxListeners } from 'events'
32
- import { unmarshalPublicKey } from '@libp2p/crypto/keys'
33
- import { peerIdFromString } from '@libp2p/peer-id'
35
+ import type { Metrics } from '@libp2p/interface-metrics'
36
+ import type { PeerId } from '@libp2p/interface-peer-id'
37
+ import type { PeerInfo } from '@libp2p/interface-peer-info'
38
+ import type { PeerStore } from '@libp2p/interface-peer-store'
39
+ import type { StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar'
40
+ import type { AbortOptions } from '@libp2p/interfaces'
34
41
  import type { Datastore } from 'interface-datastore'
35
- import mergeOptions from 'merge-options'
36
- import { createEd25519PeerId } from '@libp2p/peer-id-factory'
37
- import { validateConfig } from './config.js'
38
- import { ContentRouting, contentRouting } from '@libp2p/interface-content-routing'
39
- import { PeerRouting, peerRouting } from '@libp2p/interface-peer-routing'
40
- import { peerDiscovery } from '@libp2p/interface-peer-discovery'
41
- import { connectionGater } from './config/connection-gater.js'
42
42
 
43
43
  const log = logger('libp2p')
44
44
 
45
- export class Libp2pNode<T extends ServiceMap = {}> extends EventEmitter<Libp2pEvents> implements Libp2p<T> {
45
+ export class Libp2pNode<T extends ServiceMap = Record<string, unknown>> extends EventEmitter<Libp2pEvents> implements Libp2p<T> {
46
46
  public peerId: PeerId
47
47
  public peerStore: PeerStore
48
48
  public contentRouting: ContentRouting
@@ -277,7 +277,7 @@ export class Libp2pNode<T extends ServiceMap = {}> extends EventEmitter<Libp2pEv
277
277
  }
278
278
 
279
279
  async dial (peer: PeerId | Multiaddr | Multiaddr[], options: AbortOptions = {}): Promise<Connection> {
280
- return await this.components.connectionManager.openConnection(peer, options)
280
+ return this.components.connectionManager.openConnection(peer, options)
281
281
  }
282
282
 
283
283
  async dialProtocol (peer: PeerId | Multiaddr | Multiaddr[], protocols: string | string[], options: AbortOptions = {}): Promise<Stream> {
@@ -293,7 +293,7 @@ export class Libp2pNode<T extends ServiceMap = {}> extends EventEmitter<Libp2pEv
293
293
 
294
294
  const connection = await this.dial(peer, options)
295
295
 
296
- return await connection.newStream(protocols, options)
296
+ return connection.newStream(protocols, options)
297
297
  }
298
298
 
299
299
  getMultiaddrs (): Multiaddr[] {
@@ -370,7 +370,7 @@ export class Libp2pNode<T extends ServiceMap = {}> extends EventEmitter<Libp2pEv
370
370
  }
371
371
 
372
372
  async register (protocol: string, topology: Topology): Promise<string> {
373
- return await this.components.registrar.register(protocol, topology)
373
+ return this.components.registrar.register(protocol, topology)
374
374
  }
375
375
 
376
376
  unregister (id: string): void {
@@ -401,7 +401,7 @@ export class Libp2pNode<T extends ServiceMap = {}> extends EventEmitter<Libp2pEv
401
401
  * Returns a new Libp2pNode instance - this exposes more of the internals than the
402
402
  * libp2p interface and is useful for testing and debugging.
403
403
  */
404
- export async function createLibp2pNode <T extends ServiceMap = {}> (options: Libp2pOptions<T>): Promise<Libp2pNode<T>> {
404
+ export async function createLibp2pNode <T extends ServiceMap = Record<string, unknown>> (options: Libp2pOptions<T>): Promise<Libp2pNode<T>> {
405
405
  if (options.peerId == null) {
406
406
  const datastore = options.datastore as Datastore | undefined
407
407
 
@@ -1,20 +1,20 @@
1
- import { logger } from '@libp2p/logger'
2
1
  import { CodeError } from '@libp2p/interfaces/errors'
3
- import { codes, messages } from './errors.js'
2
+ import { logger } from '@libp2p/logger'
3
+ import filter from 'it-filter'
4
+ import first from 'it-first'
5
+ import merge from 'it-merge'
6
+ import { pipe } from 'it-pipe'
4
7
  import {
5
8
  storeAddresses,
6
9
  uniquePeers,
7
10
  requirePeers
8
11
  } from './content-routing/utils.js'
9
- import merge from 'it-merge'
10
- import { pipe } from 'it-pipe'
11
- import first from 'it-first'
12
- import filter from 'it-filter'
12
+ import { codes, messages } from './errors.js'
13
13
  import type { PeerId } from '@libp2p/interface-peer-id'
14
- import type { PeerRouting } from '@libp2p/interface-peer-routing'
15
- import type { AbortOptions } from '@libp2p/interfaces'
16
14
  import type { PeerInfo } from '@libp2p/interface-peer-info'
15
+ import type { PeerRouting } from '@libp2p/interface-peer-routing'
17
16
  import type { PeerStore } from '@libp2p/interface-peer-store'
17
+ import type { AbortOptions } from '@libp2p/interfaces'
18
18
 
19
19
  const log = logger('libp2p:peer-routing')
20
20
 
@@ -60,7 +60,7 @@ export class DefaultPeerRouting implements PeerRouting {
60
60
  ),
61
61
  (source) => filter(source, Boolean),
62
62
  (source) => storeAddresses(source, this.components.peerStore),
63
- async (source) => await first(source)
63
+ async (source) => first(source)
64
64
  )
65
65
 
66
66
  if (output != null) {
package/src/ping/index.ts CHANGED
@@ -1,20 +1,20 @@
1
- import { logger } from '@libp2p/logger'
2
- import { CodeError } from '@libp2p/interfaces/errors'
3
- import { codes } from '../errors.js'
1
+ import { setMaxListeners } from 'events'
4
2
  import { randomBytes } from '@libp2p/crypto'
5
- import { pipe } from 'it-pipe'
3
+ import { CodeError } from '@libp2p/interfaces/errors'
4
+ import { logger } from '@libp2p/logger'
5
+ import { abortableDuplex } from 'abortable-iterator'
6
+ import { anySignal } from 'any-signal'
6
7
  import first from 'it-first'
8
+ import { pipe } from 'it-pipe'
7
9
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
10
+ import { codes } from '../errors.js'
8
11
  import { PROTOCOL_PREFIX, PROTOCOL_NAME, PING_LENGTH, PROTOCOL_VERSION, TIMEOUT, MAX_INBOUND_STREAMS, MAX_OUTBOUND_STREAMS } from './constants.js'
9
- import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
10
- import type { PeerId } from '@libp2p/interface-peer-id'
11
- import type { Startable } from '@libp2p/interfaces/startable'
12
- import type { AbortOptions } from '@libp2p/interfaces'
13
- import { abortableDuplex } from 'abortable-iterator'
14
12
  import type { Stream } from '@libp2p/interface-connection'
15
- import { setMaxListeners } from 'events'
16
13
  import type { ConnectionManager } from '@libp2p/interface-connection-manager'
17
- import { anySignal } from 'any-signal'
14
+ import type { PeerId } from '@libp2p/interface-peer-id'
15
+ import type { IncomingStreamData, Registrar } from '@libp2p/interface-registrar'
16
+ import type { AbortOptions } from '@libp2p/interfaces'
17
+ import type { Startable } from '@libp2p/interfaces/startable'
18
18
  import type { Multiaddr } from '@multiformats/multiaddr'
19
19
 
20
20
  const log = logger('libp2p:ping')
@@ -117,7 +117,7 @@ class DefaultPingService implements Startable, PingService {
117
117
  const result = await pipe(
118
118
  [data],
119
119
  source,
120
- async (source) => await first(source)
120
+ async (source) => first(source)
121
121
  )
122
122
  const end = Date.now()
123
123
 
@@ -1,9 +1,9 @@
1
1
  import { logger } from '@libp2p/logger'
2
- import * as Errors from './errors.js'
3
- import xsalsa20 from 'xsalsa20'
4
- import { KEY_LENGTH } from './key-generator.js'
5
2
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
6
3
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
4
+ import xsalsa20 from 'xsalsa20'
5
+ import * as Errors from './errors.js'
6
+ import { KEY_LENGTH } from './key-generator.js'
7
7
  import type { Source } from 'it-stream-types'
8
8
 
9
9
  const log = logger('libp2p:pnet')
package/src/pnet/index.ts CHANGED
@@ -22,22 +22,22 @@
22
22
  * ```
23
23
  */
24
24
 
25
- import { logger } from '@libp2p/logger'
26
- import { pipe } from 'it-pipe'
25
+ import { randomBytes } from '@libp2p/crypto'
27
26
  import { CodeError } from '@libp2p/interfaces/errors'
27
+ import { logger } from '@libp2p/logger'
28
+ import { handshake } from 'it-handshake'
29
+ import map from 'it-map'
28
30
  import { duplexPair } from 'it-pair/duplex'
29
- import { randomBytes } from '@libp2p/crypto'
30
- import * as Errors from './errors.js'
31
+ import { pipe } from 'it-pipe'
31
32
  import { codes } from '../errors.js'
32
33
  import {
33
34
  createBoxStream,
34
35
  createUnboxStream,
35
36
  decodeV1PSK
36
37
  } from './crypto.js'
37
- import { handshake } from 'it-handshake'
38
+ import * as Errors from './errors.js'
38
39
  import { NONCE_LENGTH } from './key-generator.js'
39
40
  import type { ConnectionProtector, MultiaddrConnection } from '@libp2p/interface-connection'
40
- import map from 'it-map'
41
41
 
42
42
  const log = logger('libp2p:pnet')
43
43
 
@@ -1,6 +1,6 @@
1
1
  import { randomBytes } from '@libp2p/crypto'
2
- import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
3
2
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
3
+ import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
4
4
 
5
5
  /**
6
6
  * Generates a PSK that can be used in a libp2p-pnet private network
@@ -1,8 +1,8 @@
1
+ import { CodeError } from '@libp2p/interfaces/errors'
1
2
  import { EventEmitter } from '@libp2p/interfaces/events'
3
+ import { messages, codes } from '../errors.js'
2
4
  import type { PeerId } from '@libp2p/interface-peer-id'
3
5
  import type { PublishResult, PubSub, PubSubEvents, StrictNoSign, StrictSign, TopicValidatorFn } from '@libp2p/interface-pubsub'
4
- import { CodeError } from '@libp2p/interfaces/errors'
5
- import { messages, codes } from '../errors.js'
6
6
 
7
7
  export class DummyPubSub extends EventEmitter<PubSubEvents> implements PubSub {
8
8
  public topicValidators = new Map<string, TopicValidatorFn>()