@libp2p/interface-internal 0.1.12 → 1.0.0-738dd40f1

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.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  [![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
2
2
  [![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
3
3
  [![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p)
4
- [![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster)
4
+ [![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=main\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amain)
5
5
 
6
6
  > Interfaces implemented by internal libp2p components
7
7
 
package/dist/index.min.js CHANGED
@@ -1,3 +1,3 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PInterfaceInternal = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PInterfaceInternal=(()=>{var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(o,e,x,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of b(e))!c.call(o,p)&&p!==x&&t(o,p,{get:()=>e[p],enumerable:!(r=a(e,p))||r.enumerable});return o};var f=o=>d(t({},"__esModule",{value:!0}),o);var g={};return f(g);})();
2
+ "use strict";var Libp2PInterfaceInternal=(()=>{var t=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var a=Object.prototype.hasOwnProperty;var b=(r,o,x,p)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of m(o))!a.call(r,e)&&e!==x&&t(r,e,{get:()=>o[e],enumerable:!(p=f(o,e))||p.enumerable});return r};var c=r=>b(t({},"__esModule",{value:!0}),r);var d={};return c(d);})();
3
3
  return Libp2PInterfaceInternal}));
@@ -1,6 +1,4 @@
1
- import type { AbortOptions, PendingDial } from '@libp2p/interface';
2
- import type { Connection, MultiaddrConnection } from '@libp2p/interface/connection';
3
- import type { PeerId } from '@libp2p/interface/peer-id';
1
+ import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId } from '@libp2p/interface';
4
2
  import type { PeerMap } from '@libp2p/peer-collections';
5
3
  import type { Multiaddr } from '@multiformats/multiaddr';
6
4
  export interface OpenConnectionOptions extends AbortOptions {
@@ -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,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;OASG;IACH,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE,CAAA;IAE7C;;;;;;;;OAQG;IACH,iBAAiB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IAE1C;;;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AAC,UAAU,CAAC,CAAA;IAE5G;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAErE;;;;;OAKG;IACH,wBAAwB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAEvE;;OAEG;IACH,mBAAmB,IAAI,IAAI,CAAA;IAE3B;;;;;;;;OAQG;IACH,YAAY,IAAI,WAAW,EAAE,CAAA;CAC9B"}
@@ -1,2 +1,6 @@
1
- export {};
1
+ export * from './address-manager/index.js';
2
+ export * from './connection-manager/index.js';
3
+ export * from './record/index.js';
4
+ export * from './registrar/index.js';
5
+ export * from './transport-manager/index.js';
2
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA"}
package/dist/src/index.js CHANGED
@@ -1,2 +1,6 @@
1
- export {};
1
+ export * from './address-manager/index.js';
2
+ export * from './connection-manager/index.js';
3
+ export * from './record/index.js';
4
+ export * from './registrar/index.js';
5
+ export * from './transport-manager/index.js';
2
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { PeerId } from '@libp2p/interface/peer-id';
1
+ import type { PeerId } from '@libp2p/interface';
2
2
  import type { Uint8ArrayList } from 'uint8arraylist';
3
3
  /**
4
4
  * Record is the base implementation of a record that can be used as the payload of a libp2p envelope.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/record/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,EAAE,UAAU,CAAA;IACjB;;OAEG;IACH,OAAO,IAAI,UAAU,CAAA;IACrB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CAC/B;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,UAAU,GAAG,cAAc,CAAA;IACxC,OAAO,EAAE,UAAU,CAAA;IACnB,SAAS,EAAE,UAAU,GAAG,cAAc,CAAA;IAEtC,OAAO,IAAI,UAAU,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAA;CACjC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/record/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,KAAK,EAAE,UAAU,CAAA;IACjB;;OAEG;IACH,OAAO,IAAI,UAAU,CAAA;IACrB;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CAC/B;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,UAAU,GAAG,cAAc,CAAA;IACxC,OAAO,EAAE,UAAU,CAAA;IACnB,SAAS,EAAE,UAAU,GAAG,cAAc,CAAA;IAEtC,OAAO,IAAI,UAAU,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1C,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAA;CACjC"}
@@ -1,7 +1,12 @@
1
- import type { Connection, Stream } from '@libp2p/interface/connection';
2
- import type { Topology } from '@libp2p/interface/topology';
1
+ import type { Connection, Stream, Topology } from '@libp2p/interface';
3
2
  export interface IncomingStreamData {
3
+ /**
4
+ * The stream that has been opened
5
+ */
4
6
  stream: Stream;
7
+ /**
8
+ * The connection that the stream was opened on
9
+ */
5
10
  connection: Connection;
6
11
  }
7
12
  export interface StreamHandler {
@@ -24,7 +29,13 @@ export interface StreamHandlerOptions {
24
29
  runOnTransientConnection?: boolean;
25
30
  }
26
31
  export interface StreamHandlerRecord {
32
+ /**
33
+ * The handler that was registered to handle streams opened on the protocol
34
+ */
27
35
  handler: StreamHandler;
36
+ /**
37
+ * The options that were used to register the stream handler
38
+ */
28
39
  options: StreamHandlerOptions;
29
40
  }
30
41
  export interface Registrar {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/registrar/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,EAAE,QAAQ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ection } from '@libp2p/interface/connection';
2
- import type { Listener, Transport } from '@libp2p/interface/transport';
1
+ import type { Connection, Listener, Transport } from '@libp2p/interface';
3
2
  import type { Multiaddr } from '@multiformats/multiaddr';
4
3
  export interface TransportManager {
4
+ /**
5
+ * Add a transport to the transport manager
6
+ */
5
7
  add(transport: Transport): void;
8
+ /**
9
+ * Dial a multiaddr. Connections returned by this method will not be tracked
10
+ * by the connection manager so can cause memory leaks. If you need to dial
11
+ * a multiaddr, you may want to call openConnection on the connection manager
12
+ * instead.
13
+ */
6
14
  dial(ma: Multiaddr, options?: any): Promise<Connection>;
15
+ /**
16
+ * Return all addresses currently being listened on
17
+ */
7
18
  getAddrs(): Multiaddr[];
19
+ /**
20
+ * Return all registered transports
21
+ */
8
22
  getTransports(): Transport[];
23
+ /**
24
+ * Return all listeners
25
+ */
9
26
  getListeners(): Listener[];
27
+ /**
28
+ * Get the transport for a given multiaddr, if one has been configured
29
+ */
10
30
  transportForMultiaddr(ma: Multiaddr): Transport | undefined;
31
+ /**
32
+ * Listen on the passed multiaddrs
33
+ */
11
34
  listen(addrs: Multiaddr[]): Promise<void>;
35
+ /**
36
+ * Remove a previously configured transport
37
+ */
12
38
  remove(key: string): Promise<void>;
39
+ /**
40
+ * Remove all transports
41
+ */
13
42
  removeAll(): Promise<void>;
14
43
  }
15
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/transport-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;IAC/B,IAAI,CAAC,EAAE,EAA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H,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAElC;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3B"}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@libp2p/interface-internal",
3
- "version": "0.1.12",
3
+ "version": "1.0.0-738dd40f1",
4
4
  "description": "Interfaces implemented by internal libp2p components",
5
5
  "license": "Apache-2.0 OR MIT",
6
- "homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/interface-internal#readme",
6
+ "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface-internal#readme",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/libp2p/js-libp2p.git"
@@ -11,6 +11,10 @@
11
11
  "bugs": {
12
12
  "url": "https://github.com/libp2p/js-libp2p/issues"
13
13
  },
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "provenance": true
17
+ },
14
18
  "keywords": [
15
19
  "interface",
16
20
  "libp2p"
@@ -43,26 +47,6 @@
43
47
  ".": {
44
48
  "types": "./dist/src/index.d.ts",
45
49
  "import": "./dist/src/index.js"
46
- },
47
- "./address-manager": {
48
- "types": "./dist/src/address-manager/index.d.ts",
49
- "import": "./dist/src/address-manager/index.js"
50
- },
51
- "./connection-manager": {
52
- "types": "./dist/src/connection-manager/index.d.ts",
53
- "import": "./dist/src/connection-manager/index.js"
54
- },
55
- "./record": {
56
- "types": "./dist/src/record/index.d.ts",
57
- "import": "./dist/src/record/index.js"
58
- },
59
- "./registrar": {
60
- "types": "./dist/src/registrar/index.d.ts",
61
- "import": "./dist/src/registrar/index.js"
62
- },
63
- "./transport-manager": {
64
- "types": "./dist/src/transport-manager/index.d.ts",
65
- "import": "./dist/src/transport-manager/index.js"
66
50
  }
67
51
  },
68
52
  "eslintConfig": {
@@ -79,9 +63,9 @@
79
63
  "build": "aegir build"
80
64
  },
81
65
  "dependencies": {
82
- "@libp2p/interface": "^0.1.6",
83
- "@libp2p/peer-collections": "^4.0.8",
84
- "@multiformats/multiaddr": "^12.1.5",
66
+ "@libp2p/interface": "1.0.1-738dd40f1",
67
+ "@libp2p/peer-collections": "4.0.10-738dd40f1",
68
+ "@multiformats/multiaddr": "^12.1.10",
85
69
  "uint8arraylist": "^2.4.3"
86
70
  },
87
71
  "devDependencies": {
@@ -1,6 +1,4 @@
1
- import type { AbortOptions, PendingDial } from '@libp2p/interface'
2
- import type { Connection, MultiaddrConnection } from '@libp2p/interface/connection'
3
- import type { PeerId } from '@libp2p/interface/peer-id'
1
+ import type { AbortOptions, PendingDial, Connection, MultiaddrConnection, PeerId } from '@libp2p/interface'
4
2
  import type { PeerMap } from '@libp2p/peer-collections'
5
3
  import type { Multiaddr } from '@multiformats/multiaddr'
6
4
 
package/src/index.ts CHANGED
@@ -1 +1,5 @@
1
- export {}
1
+ export * from './address-manager/index.js'
2
+ export * from './connection-manager/index.js'
3
+ export * from './record/index.js'
4
+ export * from './registrar/index.js'
5
+ export * from './transport-manager/index.js'
@@ -1,4 +1,4 @@
1
- import type { PeerId } from '@libp2p/interface/peer-id'
1
+ import type { PeerId } from '@libp2p/interface'
2
2
  import type { Uint8ArrayList } from 'uint8arraylist'
3
3
 
4
4
  /**
@@ -1,8 +1,14 @@
1
- import type { Connection, Stream } from '@libp2p/interface/connection'
2
- import type { Topology } from '@libp2p/interface/topology'
1
+ import type { Connection, Stream, Topology } from '@libp2p/interface'
3
2
 
4
3
  export interface IncomingStreamData {
4
+ /**
5
+ * The stream that has been opened
6
+ */
5
7
  stream: Stream
8
+
9
+ /**
10
+ * The connection that the stream was opened on
11
+ */
6
12
  connection: Connection
7
13
  }
8
14
 
@@ -30,7 +36,14 @@ export interface StreamHandlerOptions {
30
36
  }
31
37
 
32
38
  export interface StreamHandlerRecord {
39
+ /**
40
+ * The handler that was registered to handle streams opened on the protocol
41
+ */
33
42
  handler: StreamHandler
43
+
44
+ /**
45
+ * The options that were used to register the stream handler
46
+ */
34
47
  options: StreamHandlerOptions
35
48
  }
36
49
 
@@ -1,15 +1,52 @@
1
- import type { Connection } from '@libp2p/interface/connection'
2
- import type { Listener, Transport } from '@libp2p/interface/transport'
1
+ import type { Connection, Listener, Transport } from '@libp2p/interface'
3
2
  import type { Multiaddr } from '@multiformats/multiaddr'
4
3
 
5
4
  export interface TransportManager {
5
+ /**
6
+ * Add a transport to the transport manager
7
+ */
6
8
  add(transport: Transport): void
9
+
10
+ /**
11
+ * Dial a multiaddr. Connections returned by this method will not be tracked
12
+ * by the connection manager so can cause memory leaks. If you need to dial
13
+ * a multiaddr, you may want to call openConnection on the connection manager
14
+ * instead.
15
+ */
7
16
  dial(ma: Multiaddr, options?: any): Promise<Connection>
17
+
18
+ /**
19
+ * Return all addresses currently being listened on
20
+ */
8
21
  getAddrs(): Multiaddr[]
22
+
23
+ /**
24
+ * Return all registered transports
25
+ */
9
26
  getTransports(): Transport[]
27
+
28
+ /**
29
+ * Return all listeners
30
+ */
10
31
  getListeners(): Listener[]
32
+
33
+ /**
34
+ * Get the transport for a given multiaddr, if one has been configured
35
+ */
11
36
  transportForMultiaddr(ma: Multiaddr): Transport | undefined
37
+
38
+ /**
39
+ * Listen on the passed multiaddrs
40
+ */
12
41
  listen(addrs: Multiaddr[]): Promise<void>
42
+
43
+ /**
44
+ * Remove a previously configured transport
45
+ */
13
46
  remove(key: string): Promise<void>
47
+
48
+ /**
49
+ * Remove all transports
50
+ */
14
51
  removeAll(): Promise<void>
15
52
  }