@libp2p/interface-internal 0.1.3-e664d14f → 0.1.4-725f5df1

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.
@@ -3,6 +3,19 @@ import type { Connection, MultiaddrConnection } from '@libp2p/interface/connecti
3
3
  import type { PeerId } from '@libp2p/interface/peer-id';
4
4
  import type { PeerMap } from '@libp2p/peer-collections';
5
5
  import type { Multiaddr } from '@multiformats/multiaddr';
6
+ export interface OpenConnectionOptions extends AbortOptions {
7
+ /**
8
+ * Connection requests with a higher priority will be executed before those
9
+ * with a lower priority. (default: 50)
10
+ */
11
+ priority?: number;
12
+ /**
13
+ * When opening a connection to a remote peer, if a connection already exists
14
+ * it will be returned instead of creating a new connection. Pass true here
15
+ * to override that and dial a new connection anyway. (default: false)
16
+ */
17
+ force?: boolean;
18
+ }
6
19
  export interface ConnectionManager {
7
20
  /**
8
21
  * Return connections, optionally filtering by a PeerId
@@ -34,7 +47,7 @@ export interface ConnectionManager {
34
47
  * const connection = await libp2p.connectionManager.openConnection(peerId)
35
48
  * ```
36
49
  */
37
- openConnection: (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions) => Promise<Connection>;
50
+ openConnection: (peer: PeerId | Multiaddr | Multiaddr[], options?: OpenConnectionOptions) => Promise<Connection>;
38
51
  /**
39
52
  * Close our connections to a peer
40
53
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,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C,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;OASG;IACH,cAAc,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,UAAU,EAAE,CAAA;IAEjD;;;;;;;;OAQG;IACH,iBAAiB,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAE9C;;;;;;;;OAQG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;IAEhH;;OAEG;IACH,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAEzE;;;;;OAKG;IACH,wBAAwB,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAE3E;;OAEG;IACH,mBAAmB,EAAE,MAAM,IAAI,CAAA;IAE/B;;;;;;;;OAQG;IACH,YAAY,EAAE,MAAM,WAAW,EAAE,CAAA;CAClC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/interface-internal",
3
- "version": "0.1.3-e664d14f",
3
+ "version": "0.1.4-725f5df1",
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/master/packages/interface-internal#readme",
@@ -78,8 +78,8 @@
78
78
  "build": "aegir build"
79
79
  },
80
80
  "dependencies": {
81
- "@libp2p/interface": "0.1.2-e664d14f",
82
- "@libp2p/peer-collections": "4.0.3-e664d14f",
81
+ "@libp2p/interface": "0.1.2-725f5df1",
82
+ "@libp2p/peer-collections": "4.0.3-725f5df1",
83
83
  "@multiformats/multiaddr": "^12.1.5",
84
84
  "uint8arraylist": "^2.4.3"
85
85
  },
@@ -4,6 +4,21 @@ import type { PeerId } from '@libp2p/interface/peer-id'
4
4
  import type { PeerMap } from '@libp2p/peer-collections'
5
5
  import type { Multiaddr } from '@multiformats/multiaddr'
6
6
 
7
+ export interface OpenConnectionOptions extends AbortOptions {
8
+ /**
9
+ * Connection requests with a higher priority will be executed before those
10
+ * with a lower priority. (default: 50)
11
+ */
12
+ priority?: number
13
+
14
+ /**
15
+ * When opening a connection to a remote peer, if a connection already exists
16
+ * it will be returned instead of creating a new connection. Pass true here
17
+ * to override that and dial a new connection anyway. (default: false)
18
+ */
19
+ force?: boolean
20
+ }
21
+
7
22
  export interface ConnectionManager {
8
23
  /**
9
24
  * Return connections, optionally filtering by a PeerId
@@ -37,7 +52,7 @@ export interface ConnectionManager {
37
52
  * const connection = await libp2p.connectionManager.openConnection(peerId)
38
53
  * ```
39
54
  */
40
- openConnection: (peer: PeerId | Multiaddr | Multiaddr[], options?: AbortOptions) => Promise<Connection>
55
+ openConnection: (peer: PeerId | Multiaddr | Multiaddr[], options?: OpenConnectionOptions) => Promise<Connection>
41
56
 
42
57
  /**
43
58
  * Close our connections to a peer