@libp2p/interface-internal 2.3.18 → 2.3.19-8484de8a2

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.
@@ -1,4 +1,4 @@
1
- import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId, IsDialableOptions, OpenConnectionProgressEvents } from '@libp2p/interface';
1
+ import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId, IsDialableOptions, OpenConnectionProgressEvents, Stream, NewStreamOptions } from '@libp2p/interface';
2
2
  import type { PeerMap } from '@libp2p/peer-collections';
3
3
  import type { Multiaddr } from '@multiformats/multiaddr';
4
4
  import type { ProgressOptions } from 'progress-events';
@@ -73,6 +73,21 @@ export interface ConnectionManager {
73
73
  * @returns A promise that resolves to a `Connection` object.
74
74
  */
75
75
  openConnection(peer: PeerId | Multiaddr | Multiaddr[], options?: OpenConnectionOptions): Promise<Connection>;
76
+ /**
77
+ * Open a protocol stream with a remote peer. If the peer is already connected
78
+ * an existing connection will be used to open the stream, otherwise they will
79
+ * be dialed first.
80
+ *
81
+ * This is preferable to opening a connection manually as it allows libp2p to
82
+ * decide what the "best" connection is, and in future, migrate streams across
83
+ * connections as better connections become available.
84
+ *
85
+ * @param peer - The target `PeerId`, `Multiaddr`, or an array of `Multiaddr`s.
86
+ * @param protocol - The protocol string or strings
87
+ * @param options - Optional parameters for connection handling.
88
+ * @returns A promise that resolves to a `Connection` object.
89
+ */
90
+ openStream(peer: PeerId | Multiaddr | Multiaddr[], protocol: string | string[], options?: OpenConnectionOptions & NewStreamOptions): Promise<Stream>;
76
91
  /**
77
92
  * Close our connections to a peer
78
93
  *
@@ -88,9 +103,9 @@ export interface ConnectionManager {
88
103
  * otherwise it will return false.
89
104
  *
90
105
  * @param maConn - The multiaddr connection to evaluate.
91
- * @returns A promise that resolves to `true` if the connection can be accepted, `false` otherwise.
106
+ * @returns `true` if the connection can be accepted, `false` otherwise.
92
107
  */
93
- acceptIncomingConnection(maConn: MultiaddrConnection): Promise<boolean>;
108
+ acceptIncomingConnection(maConn: MultiaddrConnection): boolean;
94
109
  /**
95
110
  * Invoked after upgrading an inbound multiaddr connection has finished
96
111
  */
@@ -1 +1 @@
1
- {"version":3,"file":"connection-manager.d.ts","sourceRoot":"","sources":["../../src/connection-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAC5J,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEtD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,YAAY,EAAE,eAAe,CAAC,4BAA4B,CAAC;IACxG;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE,CAAA;IAE7C;;;;OAIG;IACH,iBAAiB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAE1C;;;;;OAKG;IACH,iBAAiB,IAAI,MAAM,CAAA;IAE3B;;;;OAIG;IACH,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAE/C;;;;;;OAMG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC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E,MAAM,GAAG,UAAU,EAAE,CAAA;IAE7C;;;;OAIG;IACH,iBAAiB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAE1C;;;;;OAKG;IACH,iBAAiB,IAAI,MAAM,CAAA;IAE3B;;;;OAIG;IACH,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAE/C;;;;;;OAMG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IAE5G;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEpJ;;;;;;OAMG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAErE;;;;;;;;OAQG;IACH,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAA;IAE9D;;OAEG;IACH,mBAAmB,IAAI,IAAI,CAAA;IAE3B;;;;OAIG;IACH,YAAY,IAAI,WAAW,EAAE,CAAA;IAE7B;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9F"}
@@ -1,10 +1,5 @@
1
- import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology, IncomingStreamData } from '@libp2p/interface';
2
- import type { AbortOptions } from '@multiformats/multiaddr';
1
+ import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology, AbortOptions } from '@libp2p/interface';
3
2
  export type {
4
- /**
5
- * @deprecated This type should be imported from @libp2p/interface directly
6
- */
7
- IncomingStreamData,
8
3
  /**
9
4
  * @deprecated This type should be imported from @libp2p/interface directly
10
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"registrar.d.ts","sourceRoot":"","sources":["../../src/registrar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC/H,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,YAAY;AACV;;GAEG;AACH,kBAAkB;AAElB;;GAEG;AACH,aAAa;AAEb;;GAEG;AACH,oBAAoB;AAEpB;;GAEG;AACH,mBAAmB,EACpB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,YAAY,IAAI,MAAM,EAAE,CAAA;IAExB;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/F;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjE;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAAA;IAEjD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvF;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE5B;;;;;;OAMG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAA;CAC5C"}
1
+ {"version":3,"file":"registrar.d.ts","sourceRoot":"","sources":["../../src/registrar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEzH,YAAY;AACV;;GAEG;AACH,aAAa;AAEb;;GAEG;AACH,oBAAoB;AAEpB;;GAEG;AACH,mBAAmB,EACpB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB;;;;OAIG;IACH,YAAY,IAAI,MAAM,EAAE,CAAA;IAExB;;;;;;;OAOG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/F;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEjE;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAAA;IAEjD;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEvF;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAE5B;;;;;;OAMG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAA;CAC5C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/interface-internal",
3
- "version": "2.3.18",
3
+ "version": "2.3.19-8484de8a2",
4
4
  "description": "Interfaces implemented by internal libp2p components",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface-internal#readme",
@@ -41,13 +41,13 @@
41
41
  "build": "aegir build"
42
42
  },
43
43
  "dependencies": {
44
- "@libp2p/interface": "^2.10.5",
45
- "@libp2p/peer-collections": "^6.0.34",
46
- "@multiformats/multiaddr": "^12.4.4",
44
+ "@libp2p/interface": "2.11.0-8484de8a2",
45
+ "@libp2p/peer-collections": "6.0.35-8484de8a2",
46
+ "@multiformats/multiaddr": "^13.0.1",
47
47
  "progress-events": "^1.0.1"
48
48
  },
49
49
  "devDependencies": {
50
- "aegir": "^47.0.14"
50
+ "aegir": "^47.0.21"
51
51
  },
52
52
  "sideEffects": false
53
53
  }
@@ -1,4 +1,4 @@
1
- import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId, IsDialableOptions, OpenConnectionProgressEvents } from '@libp2p/interface'
1
+ import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId, IsDialableOptions, OpenConnectionProgressEvents, Stream, NewStreamOptions } from '@libp2p/interface'
2
2
  import type { PeerMap } from '@libp2p/peer-collections'
3
3
  import type { Multiaddr } from '@multiformats/multiaddr'
4
4
  import type { ProgressOptions } from 'progress-events'
@@ -82,6 +82,22 @@ export interface ConnectionManager {
82
82
  */
83
83
  openConnection(peer: PeerId | Multiaddr | Multiaddr[], options?: OpenConnectionOptions): Promise<Connection>
84
84
 
85
+ /**
86
+ * Open a protocol stream with a remote peer. If the peer is already connected
87
+ * an existing connection will be used to open the stream, otherwise they will
88
+ * be dialed first.
89
+ *
90
+ * This is preferable to opening a connection manually as it allows libp2p to
91
+ * decide what the "best" connection is, and in future, migrate streams across
92
+ * connections as better connections become available.
93
+ *
94
+ * @param peer - The target `PeerId`, `Multiaddr`, or an array of `Multiaddr`s.
95
+ * @param protocol - The protocol string or strings
96
+ * @param options - Optional parameters for connection handling.
97
+ * @returns A promise that resolves to a `Connection` object.
98
+ */
99
+ openStream(peer: PeerId | Multiaddr | Multiaddr[], protocol: string | string[], options?: OpenConnectionOptions & NewStreamOptions): Promise<Stream>
100
+
85
101
  /**
86
102
  * Close our connections to a peer
87
103
  *
@@ -98,9 +114,9 @@ export interface ConnectionManager {
98
114
  * otherwise it will return false.
99
115
  *
100
116
  * @param maConn - The multiaddr connection to evaluate.
101
- * @returns A promise that resolves to `true` if the connection can be accepted, `false` otherwise.
117
+ * @returns `true` if the connection can be accepted, `false` otherwise.
102
118
  */
103
- acceptIncomingConnection(maConn: MultiaddrConnection): Promise<boolean>
119
+ acceptIncomingConnection(maConn: MultiaddrConnection): boolean
104
120
 
105
121
  /**
106
122
  * Invoked after upgrading an inbound multiaddr connection has finished
package/src/registrar.ts CHANGED
@@ -1,12 +1,6 @@
1
- import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology, IncomingStreamData } from '@libp2p/interface'
2
- import type { AbortOptions } from '@multiformats/multiaddr'
1
+ import type { StreamHandler, StreamHandlerOptions, StreamHandlerRecord, Topology, AbortOptions } from '@libp2p/interface'
3
2
 
4
3
  export type {
5
- /**
6
- * @deprecated This type should be imported from @libp2p/interface directly
7
- */
8
- IncomingStreamData,
9
-
10
4
  /**
11
5
  * @deprecated This type should be imported from @libp2p/interface directly
12
6
  */
@@ -1,12 +0,0 @@
1
- {
2
- "AddressManager": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.AddressManager.html",
3
- "ConfirmAddressOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.ConfirmAddressOptions.html",
4
- "ConnectionManager": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.ConnectionManager.html",
5
- "NodeAddress": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.NodeAddress.html",
6
- "OpenConnectionOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.OpenConnectionOptions.html",
7
- "RandomWalk": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.RandomWalk.html",
8
- "Registrar": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.Registrar.html",
9
- "TransportManager": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.TransportManager.html",
10
- "TransportManagerDialOptions": "https://libp2p.github.io/js-libp2p/interfaces/_libp2p_interface-internal.TransportManagerDialOptions.html",
11
- "AddressType": "https://libp2p.github.io/js-libp2p/types/_libp2p_interface-internal.AddressType.html"
12
- }