@libp2p/interface-compliance-tests 6.3.4-f465c5473 → 6.3.5-4939ef7ae
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrader.d.ts","sourceRoot":"","sources":["../../../src/mocks/upgrader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgrader.d.ts","sourceRoot":"","sources":["../../../src/mocks/upgrader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAmC,gBAAgB,EAAE,QAAQ,EAAoC,MAAM,mBAAmB,CAAA;AACpJ,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAE3D,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAA;CACxC;AA4CD,wBAAgB,YAAY,CAAE,IAAI,GAAE,gBAAqB,GAAG,QAAQ,CAEnE"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { setMaxListeners } from '@libp2p/interface';
|
|
2
|
+
import { anySignal } from 'any-signal';
|
|
1
3
|
import { mockConnection } from './connection.js';
|
|
2
4
|
class MockUpgrader {
|
|
3
5
|
registrar;
|
|
@@ -6,7 +8,7 @@ class MockUpgrader {
|
|
|
6
8
|
this.registrar = init.registrar;
|
|
7
9
|
this.events = init.events;
|
|
8
10
|
}
|
|
9
|
-
async upgradeOutbound(multiaddrConnection, opts
|
|
11
|
+
async upgradeOutbound(multiaddrConnection, opts) {
|
|
10
12
|
const connection = mockConnection(multiaddrConnection, {
|
|
11
13
|
direction: 'outbound',
|
|
12
14
|
registrar: this.registrar,
|
|
@@ -15,7 +17,7 @@ class MockUpgrader {
|
|
|
15
17
|
this.events?.safeDispatchEvent('connection:open', { detail: connection });
|
|
16
18
|
return connection;
|
|
17
19
|
}
|
|
18
|
-
async upgradeInbound(multiaddrConnection, opts
|
|
20
|
+
async upgradeInbound(multiaddrConnection, opts) {
|
|
19
21
|
const connection = mockConnection(multiaddrConnection, {
|
|
20
22
|
direction: 'inbound',
|
|
21
23
|
registrar: this.registrar,
|
|
@@ -23,6 +25,14 @@ class MockUpgrader {
|
|
|
23
25
|
});
|
|
24
26
|
this.events?.safeDispatchEvent('connection:open', { detail: connection });
|
|
25
27
|
}
|
|
28
|
+
createInboundAbortSignal(signal) {
|
|
29
|
+
const output = anySignal([
|
|
30
|
+
AbortSignal.timeout(10_000),
|
|
31
|
+
signal
|
|
32
|
+
]);
|
|
33
|
+
setMaxListeners(Infinity, output);
|
|
34
|
+
return output;
|
|
35
|
+
}
|
|
26
36
|
}
|
|
27
37
|
export function mockUpgrader(init = {}) {
|
|
28
38
|
return new MockUpgrader(init);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrader.js","sourceRoot":"","sources":["../../../src/mocks/upgrader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAShD,MAAM,YAAY;IACC,SAAS,CAAY;IACrB,MAAM,CAAiC;IAExD,YAAa,IAAsB;QACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAA;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IAC3B,CAAC;IAED,KAAK,CAAC,eAAe,CAAE,mBAAwC,EAAE,
|
|
1
|
+
{"version":3,"file":"upgrader.js","sourceRoot":"","sources":["../../../src/mocks/upgrader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAShD,MAAM,YAAY;IACC,SAAS,CAAY;IACrB,MAAM,CAAiC;IAExD,YAAa,IAAsB;QACj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5-4939ef7ae",
|
|
4
4
|
"description": "Compliance tests for JS libp2p interfaces",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface-compliance-tests#readme",
|
|
@@ -104,21 +104,22 @@
|
|
|
104
104
|
"test:electron-main": "aegir test -t electron-main"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@libp2p/crypto": "5.0.
|
|
108
|
-
"@libp2p/echo": "2.1.
|
|
109
|
-
"@libp2p/interface": "2.6.
|
|
110
|
-
"@libp2p/interface-internal": "2.3.
|
|
111
|
-
"@libp2p/logger": "5.1.
|
|
112
|
-
"@libp2p/memory": "1.1.
|
|
113
|
-
"@libp2p/multistream-select": "6.0.
|
|
114
|
-
"@libp2p/peer-collections": "6.0.
|
|
115
|
-
"@libp2p/peer-id": "5.0.
|
|
116
|
-
"@libp2p/plaintext": "2.0.
|
|
117
|
-
"@libp2p/utils": "6.5.
|
|
107
|
+
"@libp2p/crypto": "5.0.13-4939ef7ae",
|
|
108
|
+
"@libp2p/echo": "2.1.14-4939ef7ae",
|
|
109
|
+
"@libp2p/interface": "2.6.1-4939ef7ae",
|
|
110
|
+
"@libp2p/interface-internal": "2.3.5-4939ef7ae",
|
|
111
|
+
"@libp2p/logger": "5.1.10-4939ef7ae",
|
|
112
|
+
"@libp2p/memory": "1.1.1-4939ef7ae",
|
|
113
|
+
"@libp2p/multistream-select": "6.0.17-4939ef7ae",
|
|
114
|
+
"@libp2p/peer-collections": "6.0.21-4939ef7ae",
|
|
115
|
+
"@libp2p/peer-id": "5.0.14-4939ef7ae",
|
|
116
|
+
"@libp2p/plaintext": "2.0.17-4939ef7ae",
|
|
117
|
+
"@libp2p/utils": "6.5.5-4939ef7ae",
|
|
118
118
|
"@multiformats/multiaddr": "^12.3.3",
|
|
119
119
|
"@multiformats/multiaddr-matcher": "^1.6.0",
|
|
120
120
|
"abortable-iterator": "^5.1.0",
|
|
121
|
-
"aegir": "^45.
|
|
121
|
+
"aegir": "^45.1.1",
|
|
122
|
+
"any-signal": "^4.1.1",
|
|
122
123
|
"delay": "^6.0.0",
|
|
123
124
|
"it-all": "^3.0.6",
|
|
124
125
|
"it-byte-stream": "^1.1.0",
|
|
@@ -131,7 +132,7 @@
|
|
|
131
132
|
"it-pushable": "^3.2.3",
|
|
132
133
|
"it-stream-types": "^2.0.2",
|
|
133
134
|
"it-to-buffer": "^4.0.7",
|
|
134
|
-
"libp2p": "2.7.
|
|
135
|
+
"libp2p": "2.7.3-4939ef7ae",
|
|
135
136
|
"merge-options": "^3.0.4",
|
|
136
137
|
"p-defer": "^4.0.1",
|
|
137
138
|
"p-event": "^6.0.1",
|
package/src/mocks/upgrader.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { setMaxListeners } from '@libp2p/interface'
|
|
2
|
+
import { anySignal } from 'any-signal'
|
|
1
3
|
import { mockConnection } from './connection.js'
|
|
2
|
-
import type { Libp2pEvents, Connection, MultiaddrConnection, TypedEventTarget, Upgrader, UpgraderOptions } from '@libp2p/interface'
|
|
4
|
+
import type { Libp2pEvents, Connection, MultiaddrConnection, TypedEventTarget, Upgrader, UpgraderOptions, ClearableSignal } from '@libp2p/interface'
|
|
3
5
|
import type { Registrar } from '@libp2p/interface-internal'
|
|
4
6
|
|
|
5
7
|
export interface MockUpgraderInit {
|
|
@@ -16,7 +18,7 @@ class MockUpgrader implements Upgrader {
|
|
|
16
18
|
this.events = init.events
|
|
17
19
|
}
|
|
18
20
|
|
|
19
|
-
async upgradeOutbound (multiaddrConnection: MultiaddrConnection, opts: UpgraderOptions
|
|
21
|
+
async upgradeOutbound (multiaddrConnection: MultiaddrConnection, opts: UpgraderOptions): Promise<Connection> {
|
|
20
22
|
const connection = mockConnection(multiaddrConnection, {
|
|
21
23
|
direction: 'outbound',
|
|
22
24
|
registrar: this.registrar,
|
|
@@ -28,7 +30,7 @@ class MockUpgrader implements Upgrader {
|
|
|
28
30
|
return connection
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
async upgradeInbound (multiaddrConnection: MultiaddrConnection, opts: UpgraderOptions
|
|
33
|
+
async upgradeInbound (multiaddrConnection: MultiaddrConnection, opts: UpgraderOptions): Promise<void> {
|
|
32
34
|
const connection = mockConnection(multiaddrConnection, {
|
|
33
35
|
direction: 'inbound',
|
|
34
36
|
registrar: this.registrar,
|
|
@@ -37,6 +39,16 @@ class MockUpgrader implements Upgrader {
|
|
|
37
39
|
|
|
38
40
|
this.events?.safeDispatchEvent('connection:open', { detail: connection })
|
|
39
41
|
}
|
|
42
|
+
|
|
43
|
+
createInboundAbortSignal (signal?: AbortSignal): ClearableSignal {
|
|
44
|
+
const output = anySignal([
|
|
45
|
+
AbortSignal.timeout(10_000),
|
|
46
|
+
signal
|
|
47
|
+
])
|
|
48
|
+
setMaxListeners(Infinity, output)
|
|
49
|
+
|
|
50
|
+
return output
|
|
51
|
+
}
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
export function mockUpgrader (init: MockUpgraderInit = {}): Upgrader {
|