libp2p 0.45.9-d853d124 → 0.45.9-e9cafd3d

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 (173) hide show
  1. package/README.md +96 -77
  2. package/dist/index.min.js +28 -28
  3. package/dist/src/address-manager/index.d.ts +5 -5
  4. package/dist/src/address-manager/index.d.ts.map +1 -1
  5. package/dist/src/autonat/index.d.ts +6 -6
  6. package/dist/src/autonat/index.d.ts.map +1 -1
  7. package/dist/src/autonat/index.js +3 -3
  8. package/dist/src/circuit-relay/index.d.ts +1 -1
  9. package/dist/src/circuit-relay/index.d.ts.map +1 -1
  10. package/dist/src/circuit-relay/server/advert-service.d.ts +3 -3
  11. package/dist/src/circuit-relay/server/advert-service.d.ts.map +1 -1
  12. package/dist/src/circuit-relay/server/advert-service.js +1 -1
  13. package/dist/src/circuit-relay/server/advert-service.js.map +1 -1
  14. package/dist/src/circuit-relay/server/index.d.ts +7 -7
  15. package/dist/src/circuit-relay/server/index.d.ts.map +1 -1
  16. package/dist/src/circuit-relay/server/index.js +9 -9
  17. package/dist/src/circuit-relay/server/index.js.map +1 -1
  18. package/dist/src/circuit-relay/server/reservation-store.d.ts +3 -3
  19. package/dist/src/circuit-relay/server/reservation-store.d.ts.map +1 -1
  20. package/dist/src/circuit-relay/server/reservation-voucher.d.ts +2 -2
  21. package/dist/src/circuit-relay/transport/discovery.d.ts +8 -8
  22. package/dist/src/circuit-relay/transport/discovery.d.ts.map +1 -1
  23. package/dist/src/circuit-relay/transport/discovery.js +3 -4
  24. package/dist/src/circuit-relay/transport/discovery.js.map +1 -1
  25. package/dist/src/circuit-relay/transport/index.d.ts +10 -10
  26. package/dist/src/circuit-relay/transport/index.d.ts.map +1 -1
  27. package/dist/src/circuit-relay/transport/index.js +7 -7
  28. package/dist/src/circuit-relay/transport/index.js.map +1 -1
  29. package/dist/src/circuit-relay/transport/listener.d.ts +2 -2
  30. package/dist/src/circuit-relay/transport/listener.d.ts.map +1 -1
  31. package/dist/src/circuit-relay/transport/listener.js +3 -3
  32. package/dist/src/circuit-relay/transport/listener.js.map +1 -1
  33. package/dist/src/circuit-relay/transport/reservation-store.d.ts +7 -7
  34. package/dist/src/circuit-relay/transport/reservation-store.d.ts.map +1 -1
  35. package/dist/src/circuit-relay/transport/reservation-store.js +2 -2
  36. package/dist/src/circuit-relay/transport/reservation-store.js.map +1 -1
  37. package/dist/src/circuit-relay/utils.d.ts +1 -1
  38. package/dist/src/components.d.ts +15 -14
  39. package/dist/src/components.d.ts.map +1 -1
  40. package/dist/src/components.js +2 -2
  41. package/dist/src/components.js.map +1 -1
  42. package/dist/src/config/connection-gater.browser.d.ts +1 -1
  43. package/dist/src/config/connection-gater.d.ts +1 -1
  44. package/dist/src/config.d.ts +1 -2
  45. package/dist/src/config.d.ts.map +1 -1
  46. package/dist/src/config.js +2 -2
  47. package/dist/src/config.js.map +1 -1
  48. package/dist/src/connection/index.d.ts +14 -9
  49. package/dist/src/connection/index.d.ts.map +1 -1
  50. package/dist/src/connection/index.js +22 -20
  51. package/dist/src/connection/index.js.map +1 -1
  52. package/dist/src/connection-manager/auto-dial.d.ts +5 -5
  53. package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
  54. package/dist/src/connection-manager/connection-pruner.d.ts +4 -4
  55. package/dist/src/connection-manager/connection-pruner.d.ts.map +1 -1
  56. package/dist/src/connection-manager/connection-pruner.js +2 -2
  57. package/dist/src/connection-manager/connection-pruner.js.map +1 -1
  58. package/dist/src/connection-manager/dial-queue.d.ts +7 -8
  59. package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
  60. package/dist/src/connection-manager/dial-queue.js +6 -6
  61. package/dist/src/connection-manager/dial-queue.js.map +1 -1
  62. package/dist/src/connection-manager/index.d.ts +10 -11
  63. package/dist/src/connection-manager/index.d.ts.map +1 -1
  64. package/dist/src/connection-manager/index.js +9 -9
  65. package/dist/src/connection-manager/index.js.map +1 -1
  66. package/dist/src/content-routing/index.d.ts +5 -5
  67. package/dist/src/content-routing/index.d.ts.map +1 -1
  68. package/dist/src/content-routing/index.js +1 -1
  69. package/dist/src/content-routing/index.js.map +1 -1
  70. package/dist/src/content-routing/utils.d.ts +2 -2
  71. package/dist/src/content-routing/utils.js +1 -1
  72. package/dist/src/content-routing/utils.js.map +1 -1
  73. package/dist/src/fetch/index.d.ts +5 -5
  74. package/dist/src/fetch/index.d.ts.map +1 -1
  75. package/dist/src/fetch/index.js +1 -1
  76. package/dist/src/fetch/index.js.map +1 -1
  77. package/dist/src/get-peer.d.ts +1 -1
  78. package/dist/src/get-peer.js +2 -2
  79. package/dist/src/get-peer.js.map +1 -1
  80. package/dist/src/identify/identify.d.ts +7 -7
  81. package/dist/src/identify/identify.d.ts.map +1 -1
  82. package/dist/src/identify/identify.js +13 -9
  83. package/dist/src/identify/identify.js.map +1 -1
  84. package/dist/src/identify/index.d.ts +24 -9
  85. package/dist/src/identify/index.d.ts.map +1 -1
  86. package/dist/src/identify/index.js.map +1 -1
  87. package/dist/src/index.d.ts +11 -12
  88. package/dist/src/index.d.ts.map +1 -1
  89. package/dist/src/index.js.map +1 -1
  90. package/dist/src/insecure/index.d.ts +1 -1
  91. package/dist/src/insecure/index.js +1 -1
  92. package/dist/src/insecure/index.js.map +1 -1
  93. package/dist/src/libp2p.d.ts +11 -11
  94. package/dist/src/libp2p.d.ts.map +1 -1
  95. package/dist/src/libp2p.js +5 -5
  96. package/dist/src/libp2p.js.map +1 -1
  97. package/dist/src/peer-routing.d.ts +5 -5
  98. package/dist/src/peer-routing.d.ts.map +1 -1
  99. package/dist/src/peer-routing.js +1 -1
  100. package/dist/src/peer-routing.js.map +1 -1
  101. package/dist/src/ping/index.d.ts +4 -4
  102. package/dist/src/ping/index.d.ts.map +1 -1
  103. package/dist/src/ping/index.js +1 -1
  104. package/dist/src/ping/index.js.map +1 -1
  105. package/dist/src/pnet/index.d.ts +1 -1
  106. package/dist/src/pnet/index.js +1 -1
  107. package/dist/src/pnet/index.js.map +1 -1
  108. package/dist/src/registrar.d.ts +7 -6
  109. package/dist/src/registrar.d.ts.map +1 -1
  110. package/dist/src/registrar.js +7 -11
  111. package/dist/src/registrar.js.map +1 -1
  112. package/dist/src/transport-manager.d.ts +9 -9
  113. package/dist/src/transport-manager.d.ts.map +1 -1
  114. package/dist/src/transport-manager.js +4 -4
  115. package/dist/src/transport-manager.js.map +1 -1
  116. package/dist/src/upgrader.d.ts +12 -12
  117. package/dist/src/upgrader.d.ts.map +1 -1
  118. package/dist/src/upgrader.js +12 -14
  119. package/dist/src/upgrader.js.map +1 -1
  120. package/dist/src/upnp-nat/index.d.ts +4 -4
  121. package/dist/src/upnp-nat/index.d.ts.map +1 -1
  122. package/dist/src/upnp-nat/index.js +1 -1
  123. package/dist/src/upnp-nat/index.js.map +1 -1
  124. package/dist/src/utils/peer-job-queue.d.ts +1 -1
  125. package/dist/src/utils/peer-job-queue.js +1 -1
  126. package/dist/src/utils/peer-job-queue.js.map +1 -1
  127. package/dist/src/version.d.ts +1 -1
  128. package/dist/src/version.js +1 -1
  129. package/package.json +35 -60
  130. package/src/address-manager/index.ts +5 -5
  131. package/src/autonat/index.ts +12 -12
  132. package/src/circuit-relay/index.ts +1 -1
  133. package/src/circuit-relay/server/advert-service.ts +3 -3
  134. package/src/circuit-relay/server/index.ts +17 -17
  135. package/src/circuit-relay/server/reservation-store.ts +3 -3
  136. package/src/circuit-relay/server/reservation-voucher.ts +2 -2
  137. package/src/circuit-relay/transport/discovery.ts +10 -11
  138. package/src/circuit-relay/transport/index.ts +17 -18
  139. package/src/circuit-relay/transport/listener.ts +7 -7
  140. package/src/circuit-relay/transport/reservation-store.ts +9 -9
  141. package/src/circuit-relay/utils.ts +1 -1
  142. package/src/components.ts +16 -15
  143. package/src/config/connection-gater.browser.ts +1 -1
  144. package/src/config/connection-gater.ts +1 -1
  145. package/src/config.ts +3 -4
  146. package/src/connection/index.ts +31 -24
  147. package/src/connection-manager/auto-dial.ts +5 -5
  148. package/src/connection-manager/connection-pruner.ts +6 -6
  149. package/src/connection-manager/dial-queue.ts +13 -14
  150. package/src/connection-manager/index.ts +19 -20
  151. package/src/content-routing/index.ts +6 -6
  152. package/src/content-routing/utils.ts +3 -3
  153. package/src/fetch/index.ts +7 -7
  154. package/src/get-peer.ts +3 -3
  155. package/src/identify/identify.ts +26 -22
  156. package/src/identify/index.ts +27 -8
  157. package/src/index.ts +11 -12
  158. package/src/insecure/index.ts +3 -3
  159. package/src/libp2p.ts +14 -14
  160. package/src/peer-routing.ts +6 -6
  161. package/src/ping/index.ts +7 -7
  162. package/src/pnet/index.ts +2 -2
  163. package/src/registrar.ts +14 -17
  164. package/src/transport-manager.ts +12 -12
  165. package/src/upgrader.ts +24 -27
  166. package/src/upnp-nat/index.ts +5 -5
  167. package/src/utils/peer-job-queue.ts +2 -2
  168. package/src/version.ts +1 -1
  169. package/dist/src/pubsub/dummy-pubsub.d.ts +0 -18
  170. package/dist/src/pubsub/dummy-pubsub.d.ts.map +0 -1
  171. package/dist/src/pubsub/dummy-pubsub.js +0 -38
  172. package/dist/src/pubsub/dummy-pubsub.js.map +0 -1
  173. package/src/pubsub/dummy-pubsub.ts +0 -53
package/src/upgrader.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { setMaxListeners } from 'events'
2
- import { CodeError } from '@libp2p/interfaces/errors'
2
+ import { CodeError } from '@libp2p/interface/errors'
3
3
  import { logger } from '@libp2p/logger'
4
4
  import * as mss from '@libp2p/multistream-select'
5
5
  import { peerIdFromString } from '@libp2p/peer-id'
@@ -9,19 +9,18 @@ import { createConnection } from './connection/index.js'
9
9
  import { INBOUND_UPGRADE_TIMEOUT } from './connection-manager/constants.js'
10
10
  import { codes } from './errors.js'
11
11
  import { DEFAULT_MAX_INBOUND_STREAMS, DEFAULT_MAX_OUTBOUND_STREAMS } from './registrar.js'
12
- import type { MultiaddrConnection, Connection, Stream, ConnectionProtector, NewStreamOptions } from '@libp2p/interface-connection'
13
- import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface-connection-encrypter'
14
- import type { ConnectionGater } from '@libp2p/interface-connection-gater'
15
- import type { ConnectionManager } from '@libp2p/interface-connection-manager'
16
- import type { Libp2pEvents } from '@libp2p/interface-libp2p'
17
- import type { Metrics } from '@libp2p/interface-metrics'
18
- import type { PeerId } from '@libp2p/interface-peer-id'
19
- import type { PeerStore } from '@libp2p/interface-peer-store'
20
- import type { Registrar } from '@libp2p/interface-registrar'
21
- import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface-stream-muxer'
22
- import type { Upgrader, UpgraderOptions } from '@libp2p/interface-transport'
23
- import type { AbortOptions } from '@libp2p/interfaces'
24
- import type { EventEmitter } from '@libp2p/interfaces/events'
12
+ import type { Libp2pEvents, AbortOptions } from '@libp2p/interface'
13
+ import type { MultiaddrConnection, Connection, Stream, ConnectionProtector, NewStreamOptions } from '@libp2p/interface/connection'
14
+ import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface/connection-encrypter'
15
+ import type { ConnectionGater } from '@libp2p/interface/connection-gater'
16
+ import type { EventEmitter } from '@libp2p/interface/events'
17
+ import type { Metrics } from '@libp2p/interface/metrics'
18
+ import type { PeerId } from '@libp2p/interface/peer-id'
19
+ import type { PeerStore } from '@libp2p/interface/peer-store'
20
+ import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface/stream-muxer'
21
+ import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
22
+ import type { Registrar } from '@libp2p/interface-internal/registrar'
23
+ import type { Upgrader, UpgraderOptions } from '@libp2p/interface-internal/upgrader'
25
24
  import type { Duplex, Source } from 'it-stream-types'
26
25
 
27
26
  const log = logger('libp2p:upgrader')
@@ -90,7 +89,7 @@ function countStreams (protocol: string, direction: 'inbound' | 'outbound', conn
90
89
  let streamCount = 0
91
90
 
92
91
  connection.streams.forEach(stream => {
93
- if (stream.stat.direction === direction && stream.stat.protocol === protocol) {
92
+ if (stream.direction === direction && stream.protocol === protocol) {
94
93
  streamCount++
95
94
  }
96
95
  })
@@ -404,7 +403,7 @@ export class DefaultUpgrader implements Upgrader {
404
403
  // the souce/sink
405
404
  muxedStream.source = stream.source
406
405
  muxedStream.sink = stream.sink
407
- muxedStream.stat.protocol = protocol
406
+ muxedStream.protocol = protocol
408
407
 
409
408
  // If a protocol stream has been successfully negotiated and is to be passed to the application,
410
409
  // the peerstore should ensure that the peer is registered with that protocol
@@ -420,7 +419,7 @@ export class DefaultUpgrader implements Upgrader {
420
419
  .catch(err => {
421
420
  log.error(err)
422
421
 
423
- if (muxedStream.stat.timeline.close == null) {
422
+ if (muxedStream.timeline.close == null) {
424
423
  muxedStream.close()
425
424
  }
426
425
  })
@@ -473,7 +472,7 @@ export class DefaultUpgrader implements Upgrader {
473
472
  // the souce/sink
474
473
  muxedStream.source = stream.source
475
474
  muxedStream.sink = stream.sink
476
- muxedStream.stat.protocol = protocol
475
+ muxedStream.protocol = protocol
477
476
 
478
477
  this.components.metrics?.trackProtocolStream(muxedStream, connection)
479
478
 
@@ -481,7 +480,7 @@ export class DefaultUpgrader implements Upgrader {
481
480
  } catch (err: any) {
482
481
  log.error('could not create new stream', err)
483
482
 
484
- if (muxedStream.stat.timeline.close == null) {
483
+ if (muxedStream.timeline.close == null) {
485
484
  muxedStream.close()
486
485
  }
487
486
 
@@ -509,7 +508,7 @@ export class DefaultUpgrader implements Upgrader {
509
508
  // Wait for close to finish before notifying of the closure
510
509
  (async () => {
511
510
  try {
512
- if (connection.stat.status === 'OPEN') {
511
+ if (connection.status === 'OPEN') {
513
512
  await connection.close()
514
513
  }
515
514
  } catch (err: any) {
@@ -537,13 +536,11 @@ export class DefaultUpgrader implements Upgrader {
537
536
  connection = createConnection({
538
537
  remoteAddr: maConn.remoteAddr,
539
538
  remotePeer,
540
- stat: {
541
- status: 'OPEN',
542
- direction,
543
- timeline: maConn.timeline,
544
- multiplexer: muxer?.protocol,
545
- encryption: cryptoProtocol
546
- },
539
+ status: 'OPEN',
540
+ direction,
541
+ timeline: maConn.timeline,
542
+ multiplexer: muxer?.protocol,
543
+ encryption: cryptoProtocol,
547
544
  newStream: newStream ?? errConnectionNotMultiplexed,
548
545
  getStreams: () => { if (muxer != null) { return muxer.streams } else { return errConnectionNotMultiplexed() } },
549
546
  close: async () => {
@@ -1,5 +1,5 @@
1
1
  import { upnpNat, type NatAPI } from '@achingbrain/nat-port-mapper'
2
- import { CodeError } from '@libp2p/interfaces/errors'
2
+ import { CodeError } from '@libp2p/interface/errors'
3
3
  import { logger } from '@libp2p/logger'
4
4
  import { isLoopback } from '@libp2p/utils/multiaddr/is-loopback'
5
5
  import { fromNodeAddress } from '@multiformats/multiaddr'
@@ -7,10 +7,10 @@ import isPrivateIp from 'private-ip'
7
7
  import { isBrowser } from 'wherearewe'
8
8
  import { codes } from '../errors.js'
9
9
  import * as pkg from '../version.js'
10
- import type { AddressManager } from '@libp2p/interface-address-manager'
11
- import type { PeerId } from '@libp2p/interface-peer-id'
12
- import type { TransportManager } from '@libp2p/interface-transport'
13
- import type { Startable } from '@libp2p/interfaces/startable'
10
+ import type { PeerId } from '@libp2p/interface/peer-id'
11
+ import type { Startable } from '@libp2p/interface/startable'
12
+ import type { AddressManager } from '@libp2p/interface-internal/address-manager'
13
+ import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
14
14
 
15
15
  const log = logger('libp2p:upnp-nat')
16
16
  const DEFAULT_TTL = 7200
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
2
 
3
- import { CodeError } from '@libp2p/interfaces/errors'
3
+ import { CodeError } from '@libp2p/interface/errors'
4
4
  import PQueue from 'p-queue'
5
5
  import { codes } from '../errors.js'
6
- import type { PeerId } from '@libp2p/interface-peer-id'
6
+ import type { PeerId } from '@libp2p/interface/peer-id'
7
7
  import type { QueueAddOptions, Options, Queue } from 'p-queue'
8
8
 
9
9
  // Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
- export const version = '0.45.9-d853d124'
1
+ export const version = '0.45.9-e9cafd3d'
2
2
  export const name = 'libp2p'
@@ -1,18 +0,0 @@
1
- import { EventEmitter } from '@libp2p/interfaces/events';
2
- import type { PeerId } from '@libp2p/interface-peer-id';
3
- import type { PublishResult, PubSub, PubSubEvents, StrictNoSign, StrictSign, TopicValidatorFn } from '@libp2p/interface-pubsub';
4
- export declare class DummyPubSub extends EventEmitter<PubSubEvents> implements PubSub {
5
- topicValidators: Map<string, TopicValidatorFn>;
6
- isStarted(): boolean;
7
- start(): void | Promise<void>;
8
- stop(): void | Promise<void>;
9
- get globalSignaturePolicy(): typeof StrictSign | typeof StrictNoSign;
10
- get multicodecs(): string[];
11
- getPeers(): PeerId[];
12
- getTopics(): string[];
13
- subscribe(): void;
14
- unsubscribe(): void;
15
- getSubscribers(): PeerId[];
16
- publish(): Promise<PublishResult>;
17
- }
18
- //# sourceMappingURL=dummy-pubsub.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dummy-pubsub.d.ts","sourceRoot":"","sources":["../../../src/pubsub/dummy-pubsub.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE/H,qBAAa,WAAY,SAAQ,YAAY,CAAC,YAAY,CAAE,YAAW,MAAM;IACpE,eAAe,gCAAsC;IAE5D,SAAS,IAAK,OAAO;IAIrB,KAAK,IAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9B,IAAI,IAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7B,IAAI,qBAAqB,IAAK,OAAO,UAAU,GAAG,OAAO,YAAY,CAEpE;IAED,IAAI,WAAW,IAAK,MAAM,EAAE,CAE3B;IAED,QAAQ,IAAK,MAAM,EAAE;IAIrB,SAAS,IAAK,MAAM,EAAE;IAItB,SAAS,IAAK,IAAI;IAIlB,WAAW,IAAK,IAAI;IAIpB,cAAc,IAAK,MAAM,EAAE;IAIrB,OAAO,IAAK,OAAO,CAAC,aAAa,CAAC;CAGzC"}
@@ -1,38 +0,0 @@
1
- import { CodeError } from '@libp2p/interfaces/errors';
2
- import { EventEmitter } from '@libp2p/interfaces/events';
3
- import { messages, codes } from '../errors.js';
4
- export class DummyPubSub extends EventEmitter {
5
- topicValidators = new Map();
6
- isStarted() {
7
- return false;
8
- }
9
- start() {
10
- }
11
- stop() {
12
- }
13
- get globalSignaturePolicy() {
14
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
15
- }
16
- get multicodecs() {
17
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
18
- }
19
- getPeers() {
20
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
21
- }
22
- getTopics() {
23
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
24
- }
25
- subscribe() {
26
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
27
- }
28
- unsubscribe() {
29
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
30
- }
31
- getSubscribers() {
32
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
33
- }
34
- async publish() {
35
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
36
- }
37
- }
38
- //# sourceMappingURL=dummy-pubsub.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dummy-pubsub.js","sourceRoot":"","sources":["../../../src/pubsub/dummy-pubsub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAI9C,MAAM,OAAO,WAAY,SAAQ,YAA0B;IAClD,eAAe,GAAG,IAAI,GAAG,EAA4B,CAAA;IAE5D,SAAS;QACP,OAAO,KAAK,CAAA;IACd,CAAC;IAED,KAAK;IAEL,CAAC;IAED,IAAI;IAEJ,CAAC;IAED,IAAI,qBAAqB;QACvB,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,IAAI,WAAW;QACb,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,QAAQ;QACN,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,SAAS;QACP,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,SAAS;QACP,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,WAAW;QACT,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,cAAc;QACZ,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;CACF"}
@@ -1,53 +0,0 @@
1
- import { CodeError } from '@libp2p/interfaces/errors'
2
- import { EventEmitter } from '@libp2p/interfaces/events'
3
- import { messages, codes } from '../errors.js'
4
- import type { PeerId } from '@libp2p/interface-peer-id'
5
- import type { PublishResult, PubSub, PubSubEvents, StrictNoSign, StrictSign, TopicValidatorFn } from '@libp2p/interface-pubsub'
6
-
7
- export class DummyPubSub extends EventEmitter<PubSubEvents> implements PubSub {
8
- public topicValidators = new Map<string, TopicValidatorFn>()
9
-
10
- isStarted (): boolean {
11
- return false
12
- }
13
-
14
- start (): void | Promise<void> {
15
-
16
- }
17
-
18
- stop (): void | Promise<void> {
19
-
20
- }
21
-
22
- get globalSignaturePolicy (): typeof StrictSign | typeof StrictNoSign {
23
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
24
- }
25
-
26
- get multicodecs (): string[] {
27
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
28
- }
29
-
30
- getPeers (): PeerId[] {
31
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
32
- }
33
-
34
- getTopics (): string[] {
35
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
36
- }
37
-
38
- subscribe (): void {
39
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
40
- }
41
-
42
- unsubscribe (): void {
43
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
44
- }
45
-
46
- getSubscribers (): PeerId[] {
47
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
48
- }
49
-
50
- async publish (): Promise<PublishResult> {
51
- throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
52
- }
53
- }