@peerbit/libp2p-test-utils 1.0.7 → 2.0.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.
- package/lib/esm/index.d.ts +2 -3
- package/lib/esm/index.js +2 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/session.d.ts +5 -18
- package/lib/esm/session.js +7 -6
- package/lib/esm/session.js.map +1 -1
- package/lib/esm/transports.d.ts +2 -2
- package/lib/esm/transports.js +1 -2
- package/lib/esm/transports.js.map +1 -1
- package/package.json +11 -11
- package/src/index.ts +2 -3
- package/src/session.ts +11 -26
- package/src/transports.ts +7 -5
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export type { LibP2POptions };
|
|
1
|
+
import { TestSession } from "./session.js";
|
|
2
|
+
export { TestSession };
|
package/lib/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { TestSession } from "./session.js";
|
|
2
|
+
export { TestSession };
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/lib/esm/session.d.ts
CHANGED
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
import { Libp2p,
|
|
2
|
-
import {
|
|
3
|
-
import { Datastore } from "interface-datastore";
|
|
4
|
-
import { ConnectionManagerInit } from "libp2p/dist/src/connection-manager";
|
|
5
|
-
import { Components } from "libp2p/components";
|
|
6
|
-
import { CircuitRelayService } from "libp2p/dist/src/circuit-relay/index.js";
|
|
1
|
+
import { Libp2p, Libp2pOptions } from "libp2p";
|
|
2
|
+
import { CircuitRelayService } from "@libp2p/circuit-relay-v2";
|
|
7
3
|
import type { Multiaddr } from "@multiformats/multiaddr";
|
|
8
|
-
import type { Transport } from "@libp2p/interface/transport";
|
|
9
|
-
export type LibP2POptions<T extends Record<string, unknown>> = {
|
|
10
|
-
transports?: RecursivePartial<(components: Components) => Transport>[] | undefined;
|
|
11
|
-
connectionManager?: RecursivePartial<ConnectionManagerInit>;
|
|
12
|
-
datastore?: RecursivePartial<Datastore> | undefined;
|
|
13
|
-
browser?: boolean;
|
|
14
|
-
services?: ServiceFactoryMap<T>;
|
|
15
|
-
start?: boolean;
|
|
16
|
-
};
|
|
17
4
|
type DefaultServices = {
|
|
18
5
|
relay: CircuitRelayService;
|
|
19
6
|
identify: any;
|
|
20
7
|
};
|
|
21
8
|
type Libp2pWithServices<T> = Libp2p<T & DefaultServices>;
|
|
22
|
-
export declare class
|
|
9
|
+
export declare class TestSession<T> {
|
|
23
10
|
peers: Libp2pWithServices<T & DefaultServices>[];
|
|
24
11
|
constructor(peers: Libp2pWithServices<T & DefaultServices>[]);
|
|
25
12
|
connect(groups?: {
|
|
26
13
|
getMultiaddrs: () => Multiaddr[];
|
|
27
14
|
dial: (addres: Multiaddr[]) => Promise<any>;
|
|
28
15
|
}[][]): Promise<this>;
|
|
29
|
-
static connected<T extends Record<string, unknown>>(n: number, options?:
|
|
30
|
-
static disconnected<T extends Record<string, unknown>>(n: number, options?:
|
|
16
|
+
static connected<T extends Record<string, unknown>>(n: number, options?: Libp2pOptions<T> | Libp2pOptions<T>[]): Promise<TestSession<T>>;
|
|
17
|
+
static disconnected<T extends Record<string, unknown>>(n: number, options?: Libp2pOptions<T> | Libp2pOptions<T>[]): Promise<TestSession<T>>;
|
|
31
18
|
stop(): Promise<any>;
|
|
32
19
|
}
|
|
33
20
|
export {};
|
package/lib/esm/session.js
CHANGED
|
@@ -3,8 +3,8 @@ import { noise } from "@dao-xyz/libp2p-noise";
|
|
|
3
3
|
import { mplex } from "@libp2p/mplex";
|
|
4
4
|
import { setMaxListeners } from "events";
|
|
5
5
|
import { relay, transports } from "./transports.js";
|
|
6
|
-
import {
|
|
7
|
-
export class
|
|
6
|
+
import { identify } from "@libp2p/identify";
|
|
7
|
+
export class TestSession {
|
|
8
8
|
peers;
|
|
9
9
|
constructor(peers) {
|
|
10
10
|
this.peers = peers;
|
|
@@ -29,8 +29,8 @@ export class LSession {
|
|
|
29
29
|
return this;
|
|
30
30
|
}
|
|
31
31
|
static async connected(n, options) {
|
|
32
|
-
const libs = (await
|
|
33
|
-
return new
|
|
32
|
+
const libs = (await TestSession.disconnected(n, options)).peers;
|
|
33
|
+
return new TestSession(libs).connect();
|
|
34
34
|
}
|
|
35
35
|
static async disconnected(n, options) {
|
|
36
36
|
// Allow more than 11 listneers
|
|
@@ -46,12 +46,13 @@ export class LSession {
|
|
|
46
46
|
connectionManager: (options?.[i] || options)?.connectionManager ?? {
|
|
47
47
|
minConnections: 0
|
|
48
48
|
},
|
|
49
|
+
peerId: (options?.[i] || options)?.peerId,
|
|
49
50
|
datastore: (options?.[i] || options)?.datastore,
|
|
50
51
|
transports: (options?.[i] || options)?.transports ??
|
|
51
52
|
transports((options?.[i] || options)?.browser),
|
|
52
53
|
services: {
|
|
53
54
|
relay: (options?.[i] || options)?.browser ? undefined : relay(),
|
|
54
|
-
identify:
|
|
55
|
+
identify: identify(),
|
|
55
56
|
...(options?.[i] || options)?.services
|
|
56
57
|
},
|
|
57
58
|
connectionEncryption: [noise()],
|
|
@@ -63,7 +64,7 @@ export class LSession {
|
|
|
63
64
|
promises.push(result());
|
|
64
65
|
}
|
|
65
66
|
const libs = (await Promise.all(promises));
|
|
66
|
-
return new
|
|
67
|
+
return new TestSession(libs);
|
|
67
68
|
}
|
|
68
69
|
stop() {
|
|
69
70
|
return Promise.all(this.peers.map(async (p) => {
|
package/lib/esm/session.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4C,MAAM,QAAQ,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAM5C,MAAM,OAAO,WAAW;IACvB,KAAK,CAA4C;IAEjD,YAAY,KAAgD;QAC3D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,OAAO,CACZ,MAGK;QAEL,oBAAoB;QACpB,MAAM,eAAe,GAAmB,EAAE,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBAC3C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC;yBACrB,aAAa,EAAE;yBACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CA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,4 @@
|
|
|
1
1
|
import { Components } from "libp2p/components";
|
|
2
|
-
import type { Transport } from "@libp2p/interface
|
|
2
|
+
import type { Transport } from "@libp2p/interface";
|
|
3
3
|
export declare const transports: (browser: boolean) => ((components: Components) => Transport)[];
|
|
4
|
-
export declare const relay: () => (components: import("libp2p/dist/src/
|
|
4
|
+
export declare const relay: () => (components: import("@libp2p/circuit-relay-v2/dist/src/server").CircuitRelayServerComponents) => import("@libp2p/circuit-relay-v2").CircuitRelayService;
|
package/lib/esm/transports.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { circuitRelayTransport } from "libp2p/circuit-relay";
|
|
2
|
-
import { circuitRelayServer } from "libp2p/circuit-relay";
|
|
1
|
+
import { circuitRelayTransport, circuitRelayServer } from "@libp2p/circuit-relay-v2";
|
|
3
2
|
import { webRTC } from "@libp2p/webrtc";
|
|
4
3
|
import { webSockets } from "@libp2p/websockets";
|
|
5
4
|
import * as filters from "@libp2p/websockets/filters";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transports.js","sourceRoot":"","sources":["../../src/transports.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"transports.js","sourceRoot":"","sources":["../../src/transports.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EACrB,kBAAkB,EAClB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAIlC,MAAM,CAAC,MAAM,UAAU,GAAG,CACzB,OAAgB,EAC+B,EAAE,CACjD,OAAO;IACN,CAAC,CAAC;QACA,qBAAqB,CAAC;YACrB,cAAc,EAAE,CAAC;SACjB,CAAC;QACF,MAAM,CAAC,EAAE,CAAC;QACV,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;KACnC;IACF,CAAC,CAAE,CAAC,GAAG,EAAE,CAAS,CAAC;AAErB,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peerbit/libp2p-test-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Test utils for Peerbit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"author": "dao.xyz",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@dao-xyz/libp2p-noise": "^
|
|
41
|
-
"@libp2p/
|
|
42
|
-
"@libp2p/
|
|
43
|
-
"@libp2p/
|
|
44
|
-
"@libp2p/
|
|
45
|
-
"
|
|
46
|
-
"libp2p": "0.
|
|
47
|
-
"
|
|
40
|
+
"@dao-xyz/libp2p-noise": "^14.1.2",
|
|
41
|
+
"@libp2p/circuit-relay-v2": "^1.0.9",
|
|
42
|
+
"@libp2p/identify": "^1.0.8",
|
|
43
|
+
"@libp2p/mplex": "^10.0.9",
|
|
44
|
+
"@libp2p/tcp": "^9.0.9",
|
|
45
|
+
"@libp2p/webrtc": "^4.0.13",
|
|
46
|
+
"@libp2p/websockets": "^8.0.9",
|
|
47
|
+
"libp2p": "^1.1.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@peerbit/time": "
|
|
50
|
+
"@peerbit/time": "2.0.0"
|
|
51
51
|
},
|
|
52
52
|
"localMaintainers": [
|
|
53
53
|
"dao.xyz"
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "c48cb37d237a25b0bcc849482b43f6941d53e3d5"
|
|
56
56
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export type { LibP2POptions };
|
|
1
|
+
import { TestSession } from "./session.js";
|
|
2
|
+
export { TestSession };
|
package/src/session.ts
CHANGED
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
import { createLibp2p, Libp2p, ServiceFactoryMap } from "libp2p";
|
|
1
|
+
import { createLibp2p, Libp2p, Libp2pOptions, ServiceFactoryMap } from "libp2p";
|
|
2
2
|
import { noise } from "@dao-xyz/libp2p-noise";
|
|
3
3
|
import { mplex } from "@libp2p/mplex";
|
|
4
4
|
import { setMaxListeners } from "events";
|
|
5
|
-
import { RecursivePartial } from "@libp2p/interfaces";
|
|
6
|
-
import { Datastore } from "interface-datastore";
|
|
7
5
|
import { relay, transports } from "./transports.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { identifyService } from "libp2p/identify";
|
|
11
|
-
import { CircuitRelayService } from "libp2p/dist/src/circuit-relay/index.js";
|
|
6
|
+
import { identify } from "@libp2p/identify";
|
|
7
|
+
import { CircuitRelayService } from "@libp2p/circuit-relay-v2";
|
|
12
8
|
import type { Multiaddr } from "@multiformats/multiaddr";
|
|
13
|
-
import type { Transport } from "@libp2p/interface/transport";
|
|
14
|
-
|
|
15
|
-
export type LibP2POptions<T extends Record<string, unknown>> = {
|
|
16
|
-
transports?:
|
|
17
|
-
| RecursivePartial<(components: Components) => Transport>[]
|
|
18
|
-
| undefined;
|
|
19
|
-
connectionManager?: RecursivePartial<ConnectionManagerInit>;
|
|
20
|
-
datastore?: RecursivePartial<Datastore> | undefined;
|
|
21
|
-
browser?: boolean;
|
|
22
|
-
services?: ServiceFactoryMap<T>;
|
|
23
|
-
start?: boolean;
|
|
24
|
-
};
|
|
25
9
|
|
|
26
10
|
type DefaultServices = { relay: CircuitRelayService; identify: any };
|
|
27
11
|
type Libp2pWithServices<T> = Libp2p<T & DefaultServices>;
|
|
28
|
-
export class
|
|
12
|
+
export class TestSession<T> {
|
|
29
13
|
peers: Libp2pWithServices<T & DefaultServices>[];
|
|
30
14
|
|
|
31
15
|
constructor(peers: Libp2pWithServices<T & DefaultServices>[]) {
|
|
@@ -59,15 +43,15 @@ export class LSession<T> {
|
|
|
59
43
|
}
|
|
60
44
|
static async connected<T extends Record<string, unknown>>(
|
|
61
45
|
n: number,
|
|
62
|
-
options?:
|
|
46
|
+
options?: Libp2pOptions<T> | Libp2pOptions<T>[]
|
|
63
47
|
) {
|
|
64
|
-
const libs = (await
|
|
65
|
-
return new
|
|
48
|
+
const libs = (await TestSession.disconnected<T>(n, options)).peers;
|
|
49
|
+
return new TestSession(libs).connect();
|
|
66
50
|
}
|
|
67
51
|
|
|
68
52
|
static async disconnected<T extends Record<string, unknown>>(
|
|
69
53
|
n: number,
|
|
70
|
-
options?:
|
|
54
|
+
options?: Libp2pOptions<T> | Libp2pOptions<T>[]
|
|
71
55
|
) {
|
|
72
56
|
// Allow more than 11 listneers
|
|
73
57
|
setMaxListeners(Infinity);
|
|
@@ -83,13 +67,14 @@ export class LSession<T> {
|
|
|
83
67
|
connectionManager: (options?.[i] || options)?.connectionManager ?? {
|
|
84
68
|
minConnections: 0
|
|
85
69
|
},
|
|
70
|
+
peerId: (options?.[i] || options)?.peerId,
|
|
86
71
|
datastore: (options?.[i] || options)?.datastore,
|
|
87
72
|
transports:
|
|
88
73
|
(options?.[i] || options)?.transports ??
|
|
89
74
|
transports((options?.[i] || options)?.browser),
|
|
90
75
|
services: {
|
|
91
76
|
relay: (options?.[i] || options)?.browser ? undefined : relay(),
|
|
92
|
-
identify:
|
|
77
|
+
identify: identify(),
|
|
93
78
|
...(options?.[i] || options)?.services
|
|
94
79
|
},
|
|
95
80
|
connectionEncryption: [noise()],
|
|
@@ -102,7 +87,7 @@ export class LSession<T> {
|
|
|
102
87
|
}
|
|
103
88
|
|
|
104
89
|
const libs = (await Promise.all(promises)) as Libp2p<T & DefaultServices>[];
|
|
105
|
-
return new
|
|
90
|
+
return new TestSession(libs);
|
|
106
91
|
}
|
|
107
92
|
|
|
108
93
|
stop(): Promise<any> {
|
package/src/transports.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
circuitRelayTransport,
|
|
3
|
+
circuitRelayServer
|
|
4
|
+
} from "@libp2p/circuit-relay-v2";
|
|
3
5
|
import { webRTC } from "@libp2p/webrtc";
|
|
4
6
|
import { webSockets } from "@libp2p/websockets";
|
|
5
7
|
import * as filters from "@libp2p/websockets/filters";
|
|
6
8
|
import { tcp } from "@libp2p/tcp";
|
|
7
9
|
import { Components } from "libp2p/components";
|
|
8
|
-
import type { Transport } from "@libp2p/interface
|
|
10
|
+
import type { Transport } from "@libp2p/interface";
|
|
9
11
|
|
|
10
12
|
export const transports = (
|
|
11
13
|
browser: boolean
|
|
@@ -17,7 +19,7 @@ export const transports = (
|
|
|
17
19
|
}),
|
|
18
20
|
webRTC({}),
|
|
19
21
|
webSockets({ filter: filters.all })
|
|
20
|
-
|
|
21
|
-
: [tcp()];
|
|
22
|
+
]
|
|
23
|
+
: ([tcp()] as any);
|
|
22
24
|
|
|
23
25
|
export const relay = () => circuitRelayServer({});
|