@libp2p/interface 2.9.0-f1de46607 → 2.10.0

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 (56) hide show
  1. package/dist/index.min.js +1 -1
  2. package/dist/index.min.js.map +3 -3
  3. package/dist/src/content-routing.d.ts +2 -2
  4. package/dist/src/content-routing.d.ts.map +1 -1
  5. package/dist/src/content-routing.js +1 -1
  6. package/dist/src/errors.d.ts +8 -1
  7. package/dist/src/errors.d.ts.map +1 -1
  8. package/dist/src/errors.js +11 -1
  9. package/dist/src/errors.js.map +1 -1
  10. package/dist/src/event-target.d.ts +2 -2
  11. package/dist/src/event-target.d.ts.map +1 -1
  12. package/dist/src/event-target.js +0 -1
  13. package/dist/src/event-target.js.map +1 -1
  14. package/dist/src/index.d.ts +38 -1
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/metrics.d.ts +1 -2
  18. package/dist/src/metrics.d.ts.map +1 -1
  19. package/dist/src/peer-discovery.d.ts +5 -0
  20. package/dist/src/peer-discovery.d.ts.map +1 -1
  21. package/dist/src/peer-routing.d.ts +3 -3
  22. package/dist/src/peer-routing.d.ts.map +1 -1
  23. package/dist/src/peer-routing.js +2 -2
  24. package/dist/src/peer-store.d.ts +26 -0
  25. package/dist/src/peer-store.d.ts.map +1 -1
  26. package/dist/src/peer-store.js.map +1 -1
  27. package/dist/src/pubsub.d.ts +3 -0
  28. package/dist/src/pubsub.d.ts.map +1 -1
  29. package/dist/src/pubsub.js.map +1 -1
  30. package/dist/src/record.d.ts +25 -1
  31. package/dist/src/record.d.ts.map +1 -1
  32. package/dist/src/startable.d.ts +52 -1
  33. package/dist/src/startable.d.ts.map +1 -1
  34. package/dist/src/startable.js +51 -0
  35. package/dist/src/startable.js.map +1 -1
  36. package/dist/src/topology.d.ts +2 -1
  37. package/dist/src/topology.d.ts.map +1 -1
  38. package/dist/src/transport.d.ts +37 -1
  39. package/dist/src/transport.d.ts.map +1 -1
  40. package/dist/src/transport.js +3 -0
  41. package/dist/src/transport.js.map +1 -1
  42. package/dist/typedoc-urls.json +223 -0
  43. package/package.json +1 -1
  44. package/src/content-routing.ts +2 -2
  45. package/src/errors.ts +13 -1
  46. package/src/event-target.ts +2 -2
  47. package/src/index.ts +38 -1
  48. package/src/metrics.ts +1 -1
  49. package/src/peer-discovery.ts +5 -0
  50. package/src/peer-routing.ts +3 -3
  51. package/src/peer-store.ts +27 -0
  52. package/src/pubsub.ts +3 -0
  53. package/src/record.ts +30 -1
  54. package/src/startable.ts +52 -1
  55. package/src/topology.ts +2 -1
  56. package/src/transport.ts +44 -2
@@ -1,6 +1,33 @@
1
+ /**
2
+ * Returns `true` if the object has type overlap with `Startable`
3
+ */
1
4
  export function isStartable(obj) {
2
5
  return obj != null && typeof obj.start === 'function' && typeof obj.stop === 'function';
3
6
  }
7
+ /**
8
+ * A function that can be used to start and objects passed to it. This checks
9
+ * that an object is startable before invoking its lifecycle methods so it is
10
+ * safe to pass non-`Startable`s in.
11
+ *
12
+ * @example
13
+ *
14
+ * ```TypeScript
15
+ * import { start } from '@libp2p/interface'
16
+ * import type { Startable } from '@libp2p/interface'
17
+ *
18
+ * const startable: Startable = {
19
+ * start: () => {},
20
+ * stop: () => {}
21
+ * }
22
+ *
23
+ * const notStartable = 5
24
+ *
25
+ * await start(
26
+ * startable,
27
+ * notStartable
28
+ * )
29
+ * ```
30
+ */
4
31
  export async function start(...objs) {
5
32
  const startables = [];
6
33
  for (const obj of objs) {
@@ -22,6 +49,30 @@ export async function start(...objs) {
22
49
  }
23
50
  }));
24
51
  }
52
+ /**
53
+ * A function that can be used to stop and objects passed to it. This checks
54
+ * that an object is startable before invoking its lifecycle methods so it is
55
+ * safe to pass non-`Startable`s in.
56
+ *
57
+ * @example
58
+ *
59
+ * ```TypeScript
60
+ * import { stop } from '@libp2p/interface'
61
+ * import type { Startable } from '@libp2p/interface'
62
+ *
63
+ * const startable: Startable = {
64
+ * start: () => {},
65
+ * stop: () => {}
66
+ * }
67
+ *
68
+ * const notStartable = 5
69
+ *
70
+ * await stop(
71
+ * startable,
72
+ * notStartable
73
+ * )
74
+ * ```
75
+ */
25
76
  export async function stop(...objs) {
26
77
  const startables = [];
27
78
  for (const obj of objs) {
@@ -1 +1 @@
1
- {"version":3,"file":"startable.js","sourceRoot":"","sources":["../../src/startable.ts"],"names":[],"mappings":"AA+CA,MAAM,UAAU,WAAW,CAAE,GAAQ;IACnC,OAAO,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,UAAU,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,UAAU,CAAA;AACzF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,KAAK,CAAE,GAAG,IAAW;IACzC,MAAM,UAAU,GAAgB,EAAE,CAAA;IAElC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACtB,CAAC;IACH,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CACf,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;QACvB,IAAI,CAAC,CAAC,WAAW,IAAI,IAAI,EAAE,CAAC;YAC1B,MAAM,CAAC,CAAC,WAAW,EAAE,CAAA;QACvB,CAAC;IACH,CAAC,CAAC,CACH,CAAA;IAED,MAAM,OAAO,CAAC,GAAG,CACf,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;QACvB,MAAM,CAAC,CAAC,KAAK,EAAE,CAAA;IACjB,CAAC,CAAC,CACH,CAAA;IAED,MAAM,OAAO,CAAC,GAAG,CACf,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;QACvB,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;YACzB,MAAM,CAAC,CA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KAAK,EAAC,CAAC,EAAC,EAAE;QACvB,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;YACzB,MAAM,CAAC,CAAC,UAAU,EAAE,CAAA;QACtB,CAAC;IACH,CAAC,CAAC,CACH,CAAA;IAED,MAAM,OAAO,CAAC,GAAG,CACf,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;QACvB,MAAM,CAAC,CAAC,IAAI,EAAE,CAAA;IAChB,CAAC,CAAC,CACH,CAAA;IAED,MAAM,OAAO,CAAC,GAAG,CACf,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;QACvB,IAAI,CAAC,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,CAAC,CAAC,SAAS,EAAE,CAAA;QACrB,CAAC;IACH,CAAC,CAAC,CACH,CAAA;AACH,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import type { Connection } from './connection.js';
2
2
  import type { PeerId } from './peer-id.js';
3
3
  /**
4
- * A topology filter
4
+ * A topology filter - this can be used by topologies to ensure they do not
5
+ * receive duplicate notifications of individual peers
5
6
  *
6
7
  * @see https://libp2p.github.io/js-libp2p/functions/_libp2p_peer_collections.peerFilter-1.html
7
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../src/topology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IAC7B,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,MAAM,CAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IAEvB;;;;;;OAMG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;IAEnC;;;OAGG;IACH,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;IAElD;;;OAGG;IACH,YAAY,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC"}
1
+ {"version":3,"file":"topology.d.ts","sourceRoot":"","sources":["../../src/topology.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IAC7B,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,MAAM,CAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB;;;OAGG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IAEvB;;;;;;OAMG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;IAEnC;;;OAGG;IACH,SAAS,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;IAElD;;;OAGG;IACH,YAAY,CAAC,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC"}
@@ -42,6 +42,9 @@ export interface Listener extends TypedEventTarget<ListenerEvents> {
42
42
  updateAnnounceAddrs(addrs: Multiaddr[]): void;
43
43
  }
44
44
  export declare const transportSymbol: unique symbol;
45
+ /**
46
+ * A filter that acts on a list of multiaddrs
47
+ */
45
48
  export interface MultiaddrFilter {
46
49
  (multiaddrs: Multiaddr[]): Multiaddr[];
47
50
  }
@@ -90,7 +93,10 @@ export interface Transport<DialEvents extends ProgressEvent = ProgressEvent> {
90
93
  */
91
94
  dialFilter: MultiaddrFilter;
92
95
  }
93
- export declare function isTransport(other: any): other is Transport;
96
+ /**
97
+ * Used to disambiguate transport implementations
98
+ */
99
+ export declare function isTransport(other?: any): other is Transport;
94
100
  /**
95
101
  * Enum Transport Manager Fault Tolerance values
96
102
  */
@@ -104,11 +110,41 @@ export declare enum FaultTolerance {
104
110
  */
105
111
  NO_FATAL = 1
106
112
  }
113
+ /**
114
+ * Options accepted by the upgrader during connection establishment
115
+ */
107
116
  export interface UpgraderOptions<ConnectionUpgradeEvents extends ProgressEvent = ProgressEvent> extends ProgressOptions<ConnectionUpgradeEvents>, Required<AbortOptions> {
117
+ /**
118
+ * If true the invoking transport is expected to implement it's own encryption
119
+ * and an encryption protocol will not attempted to be negotiated via
120
+ * multi-stream select
121
+ *
122
+ * @default false
123
+ */
108
124
  skipEncryption?: boolean;
125
+ /**
126
+ * If true no connection protection will be performed on the connection.
127
+ */
109
128
  skipProtection?: boolean;
129
+ /**
130
+ * By default a stream muxer protocol will be negotiated via multi-stream
131
+ * select after an encryption protocol has been agreed on.
132
+ *
133
+ * If a transport provides it's own stream muxing facility pass a muxer
134
+ * factory instance here to skip muxer negotiation.
135
+ */
110
136
  muxerFactory?: StreamMuxerFactory;
137
+ /**
138
+ * If the connection is to have limits applied to it, pass them here
139
+ */
111
140
  limits?: ConnectionLimits;
141
+ /**
142
+ * Multi-stream select is a initiator/responder protocol. By default a
143
+ * connection returned from `upgrader.upgradeOutbound` will be the initiator
144
+ * and one returned from `upgrader.upgradeInbound` will be the responder.
145
+ *
146
+ * Pass a value here to override the default.
147
+ */
112
148
  initiator?: boolean;
113
149
  }
114
150
  export type InboundConnectionUpgradeEvents = ProgressEvent<'upgrader:encrypt-inbound-connection'> | ProgressEvent<'upgrader:multiplex-inbound-connection'>;
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","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eAAe,IAAK,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAEnD;;OAEG;IACH,uBAAuB,IAAK,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;CAC7D"}
@@ -1,4 +1,7 @@
1
1
  export const transportSymbol = Symbol.for('@libp2p/transport');
2
+ /**
3
+ * Used to disambiguate transport implementations
4
+ */
2
5
  export function isTransport(other) {
3
6
  return other != null && Boolean(other[transportSymbol]);
4
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":"AAgDA,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AAyD9D,MAAM,UAAU,WAAW,CAAE,KAAU;IACrC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB;;OAEG;IACH,6DAAa,CAAA;IAEb;;OAEG;IACH,2DAAQ,CAAA;AACV,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB"}
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":"AAgDA,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;AA8D9D;;GAEG;AACH,MAAM,UAAU,WAAW,CAAE,KAAW;IACtC,OAAO,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACxB;;OAEG;IACH,6DAAa,CAAA;IAEb;;OAEG;IACH,2DAAQ,CAAA;AACV,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB"}
@@ -0,0 +1,223 @@
1
+ {
2
+ "FaultTolerance": "https://libp2p.github.io/js-libp2p/enums/_libp2p_interface.FaultTolerance.html",
3
+ "TopicValidatorResult": "https://libp2p.github.io/js-libp2p/enums/_libp2p_interface.TopicValidatorResult.html",
4
+ "AbortError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.AbortError.html",
5
+ "AlreadyStartedError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.AlreadyStartedError.html",
6
+ "ConnectionClosedError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.ConnectionClosedError.html",
7
+ "ConnectionClosingError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.ConnectionClosingError.html",
8
+ "ConnectionFailedError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.ConnectionFailedError.html",
9
+ "DialError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.DialError.html",
10
+ "InvalidCIDError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidCIDError.html",
11
+ "InvalidCryptoExchangeError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidCryptoExchangeError.html",
12
+ "InvalidMessageError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidMessageError.html",
13
+ "InvalidMultiaddrError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidMultiaddrError.html",
14
+ "InvalidMultihashError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidMultihashError.html",
15
+ "InvalidParametersError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidParametersError.html",
16
+ "InvalidPeerIdError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidPeerIdError.html",
17
+ "InvalidPrivateKeyError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidPrivateKeyError.html",
18
+ "InvalidPublicKeyError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.InvalidPublicKeyError.html",
19
+ "LimitedConnectionError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.LimitedConnectionError.html",
20
+ "ListenError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.ListenError.html",
21
+ "MuxerClosedError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.MuxerClosedError.html",
22
+ "NotFoundError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.NotFoundError.html",
23
+ "NotImplementedError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.NotImplementedError.html",
24
+ "NotStartedError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.NotStartedError.html",
25
+ "ProtocolError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.ProtocolError.html",
26
+ "StreamResetError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.StreamResetError.html",
27
+ "StreamStateError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.StreamStateError.html",
28
+ "TimeoutError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.TimeoutError.html",
29
+ "TooManyInboundProtocolStreamsError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.TooManyInboundProtocolStreamsError.html",
30
+ "TooManyOutboundProtocolStreamsError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.TooManyOutboundProtocolStreamsError.html",
31
+ "TypedEventEmitter": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.TypedEventEmitter.html",
32
+ "UnexpectedPeerError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.UnexpectedPeerError.html",
33
+ "UnsupportedKeyTypeError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.UnsupportedKeyTypeError.html",
34
+ "UnsupportedOperationError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.UnsupportedOperationError.html",
35
+ "UnsupportedProtocolError": "https://libp2p.github.io/js-libp2p/classes/_libp2p_interface.UnsupportedProtocolError.html",
36
+ "AbortOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AbortOptions.html",
37
+ ".:AbortOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AbortOptions.html",
38
+ "Address": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Address.html",
39
+ "AddressSorter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AddressSorter.html",
40
+ ".:AddressSorter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.AddressSorter.html",
41
+ "CalculatedHistogramOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CalculatedHistogramOptions.html",
42
+ "CalculatedMetricOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CalculatedMetricOptions.html",
43
+ "CalculatedSummaryOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CalculatedSummaryOptions.html",
44
+ "ClearableSignal": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ClearableSignal.html",
45
+ ".:ClearableSignal": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ClearableSignal.html",
46
+ "ComponentLogger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ComponentLogger.html",
47
+ ".:ComponentLogger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ComponentLogger.html",
48
+ "Connection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Connection.html",
49
+ "ConnectionEncrypter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionEncrypter.html",
50
+ "ConnectionGater": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionGater.html",
51
+ "ConnectionLimits": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionLimits.html",
52
+ "ConnectionProtector": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionProtector.html",
53
+ "ConnectionTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ConnectionTimeline.html",
54
+ "ContentRouting": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ContentRouting.html",
55
+ "ContentRoutingProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ContentRoutingProvider.html",
56
+ "Counter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Counter.html",
57
+ "CounterGroup": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CounterGroup.html",
58
+ "CreateListenerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.CreateListenerOptions.html",
59
+ "DialOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.DialOptions.html",
60
+ ".:DialOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.DialOptions.html",
61
+ "DialProtocolOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.DialProtocolOptions.html",
62
+ ".:DialProtocolOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.DialProtocolOptions.html",
63
+ "DialTransportOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.DialTransportOptions.html",
64
+ "ECDSAPrivateKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ECDSAPrivateKey.html",
65
+ "ECDSAPublicKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ECDSAPublicKey.html",
66
+ "Ed25519PeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Ed25519PeerId.html",
67
+ "Ed25519PrivateKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Ed25519PrivateKey.html",
68
+ "Ed25519PublicKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Ed25519PublicKey.html",
69
+ "Envelope": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Envelope.html",
70
+ "EventCallback": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.EventCallback.html",
71
+ "EventObject": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.EventObject.html",
72
+ "Histogram": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Histogram.html",
73
+ "HistogramGroup": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.HistogramGroup.html",
74
+ "HistogramOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.HistogramOptions.html",
75
+ "IdentifyResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IdentifyResult.html",
76
+ ".:IdentifyResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IdentifyResult.html",
77
+ "IncomingStreamData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IncomingStreamData.html",
78
+ "IsDialableOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IsDialableOptions.html",
79
+ ".:IsDialableOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.IsDialableOptions.html",
80
+ "Libp2p": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2p.html",
81
+ ".:Libp2p": "https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.Libp2p.html",
82
+ "Libp2pEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2pEvents.html",
83
+ ".:Libp2pEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Libp2pEvents.html",
84
+ "Listener": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Listener.html",
85
+ "ListenerEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.ListenerEvents.html",
86
+ "Logger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Logger.html",
87
+ ".:Logger": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Logger.html",
88
+ "LoggerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.LoggerOptions.html",
89
+ ".:LoggerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.LoggerOptions.html",
90
+ "Metric": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Metric.html",
91
+ "MetricGroup": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MetricGroup.html",
92
+ "MetricOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MetricOptions.html",
93
+ "Metrics": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Metrics.html",
94
+ "MultiaddrConnection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrConnection.html",
95
+ "MultiaddrConnectionTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrConnectionTimeline.html",
96
+ "MultiaddrFilter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.MultiaddrFilter.html",
97
+ "NewStreamOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NewStreamOptions.html",
98
+ "NodeInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NodeInfo.html",
99
+ ".:NodeInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.NodeInfo.html",
100
+ "Peer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Peer.html",
101
+ "PeerData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerData.html",
102
+ "PeerDiscovery": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscovery.html",
103
+ "PeerDiscoveryEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscoveryEvents.html",
104
+ "PeerDiscoveryProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerDiscoveryProvider.html",
105
+ "PeerInfo": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerInfo.html",
106
+ "PeerQuery": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQuery.html",
107
+ "PeerQueryFilter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQueryFilter.html",
108
+ "PeerQueryOrder": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerQueryOrder.html",
109
+ "PeerRouting": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerRouting.html",
110
+ "PeerRoutingProvider": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerRoutingProvider.html",
111
+ "PeerStore": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStore.html",
112
+ "PeerStreamEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStreamEvents.html",
113
+ "PeerStreams": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerStreams.html",
114
+ "PeerUpdate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerUpdate.html",
115
+ ".:PeerUpdate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PeerUpdate.html",
116
+ "PendingDial": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PendingDial.html",
117
+ ".:PendingDial": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PendingDial.html",
118
+ "PubSub": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSub.html",
119
+ "PubSubEvents": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubEvents.html",
120
+ "PubSubInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubInit.html",
121
+ "PubSubRPC": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPC.html",
122
+ "PubSubRPCMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPCMessage.html",
123
+ "PubSubRPCSubscription": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PubSubRPCSubscription.html",
124
+ "PublishResult": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.PublishResult.html",
125
+ "RSAPeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RSAPeerId.html",
126
+ "RSAPrivateKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RSAPrivateKey.html",
127
+ "RSAPublicKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RSAPublicKey.html",
128
+ "Record": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Record.html",
129
+ "RoutingOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RoutingOptions.html",
130
+ ".:RoutingOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.RoutingOptions.html",
131
+ "Secp256k1PeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Secp256k1PeerId.html",
132
+ "Secp256k1PrivateKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Secp256k1PrivateKey.html",
133
+ "Secp256k1PublicKey": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Secp256k1PublicKey.html",
134
+ "SecureConnectionOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SecureConnectionOptions.html",
135
+ "SecuredConnection": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SecuredConnection.html",
136
+ "SignedMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedMessage.html",
137
+ "SignedPeerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedPeerRecord.html",
138
+ ".:SignedPeerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SignedPeerRecord.html",
139
+ "Startable": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Startable.html",
140
+ "StopTimer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StopTimer.html",
141
+ "Stream": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Stream.html",
142
+ "StreamHandler": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandler.html",
143
+ "StreamHandlerOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandlerOptions.html",
144
+ "StreamHandlerRecord": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamHandlerRecord.html",
145
+ "StreamMuxer": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxer.html",
146
+ "StreamMuxerFactory": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxerFactory.html",
147
+ "StreamMuxerInit": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamMuxerInit.html",
148
+ "StreamTimeline": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.StreamTimeline.html",
149
+ "Subscription": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Subscription.html",
150
+ "SubscriptionChangeData": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SubscriptionChangeData.html",
151
+ "Summary": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Summary.html",
152
+ "SummaryGroup": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SummaryGroup.html",
153
+ "SummaryOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.SummaryOptions.html",
154
+ "TLSCertificate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TLSCertificate.html",
155
+ ".:TLSCertificate": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TLSCertificate.html",
156
+ "Tag": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Tag.html",
157
+ "TagOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TagOptions.html",
158
+ "TopicValidatorFn": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TopicValidatorFn.html",
159
+ "Topology": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Topology.html",
160
+ "TopologyFilter": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TopologyFilter.html",
161
+ "TraceFunctionOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TraceFunctionOptions.html",
162
+ "TraceGeneratorFunctionOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TraceGeneratorFunctionOptions.html",
163
+ "TraceOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TraceOptions.html",
164
+ ".:TraceOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TraceOptions.html",
165
+ "Transport": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Transport.html",
166
+ "TypedEventTarget": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.TypedEventTarget.html",
167
+ "URLPeerId": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.URLPeerId.html",
168
+ "UnsignedMessage": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.UnsignedMessage.html",
169
+ "Upgrader": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.Upgrader.html",
170
+ "UpgraderOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface.UpgraderOptions.html",
171
+ "CalculateMetric": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.CalculateMetric.html",
172
+ "ConnectionStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ConnectionStatus.html",
173
+ "Direction": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Direction.html",
174
+ "EventHandler": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.EventHandler.html",
175
+ "InboundConnectionUpgradeEvents": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.InboundConnectionUpgradeEvents.html",
176
+ "KeyType": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.KeyType.html",
177
+ "Libp2pStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Libp2pStatus.html",
178
+ ".:Libp2pStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Libp2pStatus.html",
179
+ "Message": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.Message.html",
180
+ "OpenConnectionProgressEvents": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.OpenConnectionProgressEvents.html",
181
+ ".:OpenConnectionProgressEvents": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.OpenConnectionProgressEvents.html",
182
+ "OutboundConnectionUpgradeEvents": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.OutboundConnectionUpgradeEvents.html",
183
+ "PeerId": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PeerId.html",
184
+ "PeerIdType": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PeerIdType.html",
185
+ "PendingDialStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PendingDialStatus.html",
186
+ ".:PendingDialStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PendingDialStatus.html",
187
+ "PrivateKey": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PrivateKey.html",
188
+ "PublicKey": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.PublicKey.html",
189
+ "ReadStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ReadStatus.html",
190
+ "ServiceMap": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ServiceMap.html",
191
+ ".:ServiceMap": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.ServiceMap.html",
192
+ "SignaturePolicy": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.SignaturePolicy.html",
193
+ "StreamStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.StreamStatus.html",
194
+ "TraceAttributes": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.TraceAttributes.html",
195
+ "TransportManagerDialProgressEvents": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.TransportManagerDialProgressEvents.html",
196
+ ".:TransportManagerDialProgressEvents": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.TransportManagerDialProgressEvents.html",
197
+ "WriteStatus": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.WriteStatus.html",
198
+ "YieldType": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface.YieldType.html",
199
+ "KEEP_ALIVE": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.KEEP_ALIVE.html",
200
+ "StrictNoSign": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.StrictNoSign.html",
201
+ "StrictSign": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.StrictSign.html",
202
+ "connectionSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.connectionSymbol.html",
203
+ "contentRoutingSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.contentRoutingSymbol.html",
204
+ "peerDiscoverySymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerDiscoverySymbol.html",
205
+ "peerIdSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerIdSymbol.html",
206
+ "peerRoutingSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.peerRoutingSymbol.html",
207
+ "pubSubSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.pubSubSymbol.html",
208
+ "serviceCapabilities": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.serviceCapabilities.html",
209
+ ".:serviceCapabilities": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.serviceCapabilities.html",
210
+ "serviceDependencies": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.serviceDependencies.html",
211
+ ".:serviceDependencies": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.serviceDependencies.html",
212
+ "transportSymbol": "https://libp2p.github.io/js-libp2p/variables/_libp2p_interface.transportSymbol.html",
213
+ "isConnection": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isConnection.html",
214
+ "isPeerId": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isPeerId.html",
215
+ "isPrivateKey": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isPrivateKey.html",
216
+ "isPubSub": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isPubSub.html",
217
+ "isPublicKey": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isPublicKey.html",
218
+ "isStartable": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isStartable.html",
219
+ "isTransport": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.isTransport.html",
220
+ "setMaxListeners": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.setMaxListeners.html",
221
+ "start": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.start.html",
222
+ "stop": "https://libp2p.github.io/js-libp2p/functions/_libp2p_interface.stop.html"
223
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/interface",
3
- "version": "2.9.0-f1de46607",
3
+ "version": "2.10.0",
4
4
  "description": "The interface implemented by a libp2p node",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface#readme",
@@ -4,7 +4,7 @@ import type { CID } from 'multiformats/cid'
4
4
 
5
5
  /**
6
6
  * Any object that implements this Symbol as a property should return a
7
- * ContentRouting instance as the property value, similar to how
7
+ * Partial<ContentRouting> instance as the property value, similar to how
8
8
  * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.
9
9
  *
10
10
  * @example
@@ -28,7 +28,7 @@ export const contentRoutingSymbol = Symbol.for('@libp2p/content-routing')
28
28
  * interested callers.
29
29
  */
30
30
  export interface ContentRoutingProvider {
31
- [contentRoutingSymbol]: ContentRouting
31
+ [contentRoutingSymbol]: Partial<ContentRouting>
32
32
  }
33
33
 
34
34
  export interface ContentRouting {
package/src/errors.ts CHANGED
@@ -353,7 +353,7 @@ export class TooManyOutboundProtocolStreamsError extends Error {
353
353
  }
354
354
 
355
355
  /**
356
- * Thrown when and attempt to operate on an unsupported key was made
356
+ * Thrown when an attempt to operate on an unsupported key was made
357
357
  */
358
358
  export class UnsupportedKeyTypeError extends Error {
359
359
  static name = 'UnsupportedKeyTypeError'
@@ -363,3 +363,15 @@ export class UnsupportedKeyTypeError extends Error {
363
363
  this.name = 'UnsupportedKeyTypeError'
364
364
  }
365
365
  }
366
+
367
+ /**
368
+ * Thrown when an operation has not been implemented
369
+ */
370
+ export class NotImplementedError extends Error {
371
+ static name = 'NotImplementedError'
372
+
373
+ constructor (message = 'Not implemented') {
374
+ super(message)
375
+ this.name = 'NotImplementedError'
376
+ }
377
+ }
@@ -10,7 +10,8 @@ interface Listener {
10
10
  }
11
11
 
12
12
  /**
13
- * Adds types to the EventTarget class. Hopefully this won't be necessary forever.
13
+ * Adds types to the EventTarget class. Hopefully this won't be necessary
14
+ * forever.
14
15
  *
15
16
  * https://github.com/microsoft/TypeScript/issues/28357
16
17
  * https://github.com/microsoft/TypeScript/issues/43477
@@ -31,7 +32,6 @@ export interface TypedEventTarget <EventMap extends Record<string, any>> extends
31
32
 
32
33
  /**
33
34
  * An implementation of a typed event target
34
- * etc
35
35
  */
36
36
  export class TypedEventEmitter<EventMap extends Record<string, any>> extends EventTarget implements TypedEventTarget<EventMap> {
37
37
  readonly #listeners = new Map<any, Listener[]>()
package/src/index.ts CHANGED
@@ -53,6 +53,9 @@ export interface SignedPeerRecord {
53
53
  seq: bigint
54
54
  }
55
55
 
56
+ /**
57
+ * A certificate that can be used to secure connections
58
+ */
56
59
  export interface TLSCertificate {
57
60
  /**
58
61
  * The private key that corresponds to the certificate in PEM format
@@ -130,9 +133,43 @@ export interface Logger {
130
133
  }
131
134
 
132
135
  /**
133
- * Peer logger component for libp2p
136
+ * Peer logger component for libp2p. This can be used to create loggers that are
137
+ * scoped to individual system components or services.
138
+ *
139
+ * To see logs, run your app with `DEBUG` set as an env var or for browsers, in
140
+ * `localStorage`:
141
+ *
142
+ * ```console
143
+ * $ DEBUG=libp2p* node index.js
144
+ * libp2p:my-service hello +0ms
145
+ * ```
134
146
  */
135
147
  export interface ComponentLogger {
148
+ /**
149
+ * Returns a logger for the specified component.
150
+ *
151
+ * @example
152
+ *
153
+ * ```TypeScript
154
+ * import { ComponentLogger, Logger } from '@libp2p/interface'
155
+ *
156
+ * interface MyServiceComponents {
157
+ * logger: ComponentLogger
158
+ * }
159
+ *
160
+ * class MyService {
161
+ * private readonly log: Logger
162
+ *
163
+ * constructor (components) {
164
+ * this.log = components.logger.forComponent('libp2p:my-service')
165
+ *
166
+ * this.log('hello')
167
+ * // logs:
168
+ * // libp2p:my-service hello +0ms
169
+ * }
170
+ * }
171
+ * ```
172
+ */
136
173
  forComponent(name: string): Logger
137
174
  }
138
175
 
package/src/metrics.ts CHANGED
@@ -510,7 +510,7 @@ export interface Metrics {
510
510
  /**
511
511
  * Infer the yielded type of an (async)iterable
512
512
  */
513
- type YieldType<T extends AsyncIterator<any> | Iterator<any>> = T extends AsyncIterator<infer Y> ? Y : T extends Iterator<infer Y, any, any> ? Y : never
513
+ export type YieldType<T extends AsyncIterator<any> | Iterator<any>> = T extends AsyncIterator<infer Y> ? Y : T extends Iterator<infer Y, any, any> ? Y : never
514
514
 
515
515
  export type TraceAttributes = Record<string, number | string | boolean | number[] | string[] | boolean[]>
516
516
 
@@ -34,4 +34,9 @@ export interface PeerDiscoveryEvents {
34
34
  'peer': CustomEvent<PeerInfo>
35
35
  }
36
36
 
37
+ /**
38
+ * A class that implements the `PeerDiscovery` interface uses an
39
+ * implementation-specific method to discover peers. These peers are then added
40
+ * to the peer store for use by other system components and services.
41
+ */
37
42
  export interface PeerDiscovery extends TypedEventTarget<PeerDiscoveryEvents> {}
@@ -4,8 +4,8 @@ import type { PeerInfo } from './peer-info.js'
4
4
 
5
5
  /**
6
6
  * Any object that implements this Symbol as a property should return a
7
- * PeerRouting instance as the property value, similar to how
8
- * `Symbol.Iterable` can be used to return an `Iterable` from an `Iterator`.
7
+ * PeerRouting instance as the property value, similar to how `Symbol.Iterable`
8
+ * can be used to return an `Iterable` from an `Iterator`.
9
9
  *
10
10
  * @example
11
11
  *
@@ -28,7 +28,7 @@ export const peerRoutingSymbol = Symbol.for('@libp2p/peer-routing')
28
28
  * interested callers.
29
29
  */
30
30
  export interface PeerRoutingProvider {
31
- [peerRoutingSymbol]: PeerRouting
31
+ [peerRoutingSymbol]: Partial<PeerRouting>
32
32
  }
33
33
 
34
34
  export interface PeerRouting {