@dxos/network-manager 2.33.7-dev.c2ba88fb → 2.33.8-dev.6bc74570
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/dist/browser-mocha/bundle.js +62376 -62233
- package/dist/src/connection-log.d.ts +1 -1
- package/dist/src/connection-log.d.ts.map +1 -1
- package/dist/src/connection-log.js.map +1 -1
- package/dist/src/network-manager.blueprint-test.js +23 -23
- package/dist/src/network-manager.blueprint-test.js.map +1 -1
- package/dist/src/network-manager.d.ts +1 -1
- package/dist/src/network-manager.d.ts.map +1 -1
- package/dist/src/network-manager.js +3 -3
- package/dist/src/network-manager.js.map +1 -1
- package/dist/src/presence.test.js +4 -4
- package/dist/src/presence.test.js.map +1 -1
- package/dist/src/protocol-factory.d.ts +1 -1
- package/dist/src/protocol-factory.d.ts.map +1 -1
- package/dist/src/protocol-factory.js +4 -3
- package/dist/src/protocol-factory.js.map +1 -1
- package/dist/src/signal/in-memory-signal-manager.d.ts +1 -1
- package/dist/src/signal/in-memory-signal-manager.d.ts.map +1 -1
- package/dist/src/signal/signal-api.d.ts +1 -1
- package/dist/src/signal/signal-api.d.ts.map +1 -1
- package/dist/src/signal/signal-client.d.ts +1 -1
- package/dist/src/signal/signal-client.d.ts.map +1 -1
- package/dist/src/signal/signal-client.js +11 -11
- package/dist/src/signal/signal-client.js.map +1 -1
- package/dist/src/signal/signal-client.test.js +7 -7
- package/dist/src/signal/signal-client.test.js.map +1 -1
- package/dist/src/signal/signal-manager.d.ts +1 -1
- package/dist/src/signal/signal-manager.d.ts.map +1 -1
- package/dist/src/signal/websocket-signal-manager.d.ts +1 -1
- package/dist/src/signal/websocket-signal-manager.d.ts.map +1 -1
- package/dist/src/swarm/connection.d.ts +1 -1
- package/dist/src/swarm/connection.d.ts.map +1 -1
- package/dist/src/swarm/connection.js.map +1 -1
- package/dist/src/swarm/swarm-mapper.d.ts +1 -1
- package/dist/src/swarm/swarm-mapper.d.ts.map +1 -1
- package/dist/src/swarm/swarm-mapper.js +4 -4
- package/dist/src/swarm/swarm-mapper.js.map +1 -1
- package/dist/src/swarm/swarm.d.ts +1 -1
- package/dist/src/swarm/swarm.d.ts.map +1 -1
- package/dist/src/swarm/swarm.js +3 -2
- package/dist/src/swarm/swarm.js.map +1 -1
- package/dist/src/swarm/swarm.test.js +4 -4
- package/dist/src/swarm/swarm.test.js.map +1 -1
- package/dist/src/testing/test-protocol.d.ts.map +1 -1
- package/dist/src/testing/test-protocol.js +7 -7
- package/dist/src/testing/test-protocol.js.map +1 -1
- package/dist/src/topology/fully-connected-topology.d.ts +1 -1
- package/dist/src/topology/fully-connected-topology.d.ts.map +1 -1
- package/dist/src/topology/mmst-topology.d.ts +1 -1
- package/dist/src/topology/mmst-topology.d.ts.map +1 -1
- package/dist/src/topology/star-topology.d.ts +1 -1
- package/dist/src/topology/star-topology.d.ts.map +1 -1
- package/dist/src/topology/topology.d.ts +1 -1
- package/dist/src/topology/topology.d.ts.map +1 -1
- package/dist/src/transport/in-memory-transport.d.ts +1 -1
- package/dist/src/transport/in-memory-transport.d.ts.map +1 -1
- package/dist/src/transport/in-memory-transport.js.map +1 -1
- package/dist/src/transport/in-memory-transport.test.js +5 -4
- package/dist/src/transport/in-memory-transport.test.js.map +1 -1
- package/dist/src/transport/transport.d.ts +1 -1
- package/dist/src/transport/transport.d.ts.map +1 -1
- package/dist/src/transport/webrtc-transport.d.ts +1 -1
- package/dist/src/transport/webrtc-transport.d.ts.map +1 -1
- package/dist/src/transport/webrtc-transport.js.map +1 -1
- package/dist/src/transport/webrtc-transport.test.js +6 -5
- package/dist/src/transport/webrtc-transport.test.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -12
- package/src/connection-log.ts +1 -1
- package/src/network-manager.blueprint-test.ts +1 -1
- package/src/network-manager.ts +1 -1
- package/src/presence.test.ts +1 -1
- package/src/protocol-factory.ts +5 -4
- package/src/signal/in-memory-signal-manager.ts +1 -1
- package/src/signal/signal-api.ts +1 -1
- package/src/signal/signal-client.test.ts +1 -1
- package/src/signal/signal-client.ts +1 -1
- package/src/signal/signal-manager.ts +1 -1
- package/src/signal/websocket-signal-manager.ts +1 -1
- package/src/swarm/connection.ts +1 -1
- package/src/swarm/swarm-mapper.ts +1 -1
- package/src/swarm/swarm.test.ts +1 -1
- package/src/swarm/swarm.ts +2 -1
- package/src/testing/test-protocol.ts +7 -7
- package/src/topology/fully-connected-topology.ts +1 -1
- package/src/topology/mmst-topology.ts +1 -1
- package/src/topology/star-topology.ts +1 -1
- package/src/topology/topology.ts +1 -1
- package/src/transport/in-memory-transport.test.ts +2 -1
- package/src/transport/in-memory-transport.ts +1 -1
- package/src/transport/transport.ts +1 -1
- package/src/transport/webrtc-transport.test.ts +2 -1
- package/src/transport/webrtc-transport.ts +1 -1
- package/src/types.ts +1 -1
package/src/presence.test.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
import waitForExpect from 'wait-for-expect';
|
|
7
7
|
|
|
8
|
-
import { PublicKey } from '@dxos/crypto';
|
|
9
8
|
import { PresencePlugin } from '@dxos/protocol-plugin-presence';
|
|
9
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
10
|
import { afterTest } from '@dxos/testutils';
|
|
11
11
|
|
|
12
12
|
import { NetworkManager } from './network-manager';
|
package/src/protocol-factory.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import assert from 'assert';
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
|
-
import { discoveryKey
|
|
8
|
+
import { discoveryKey } from '@dxos/crypto';
|
|
9
9
|
import { Extension, Protocol } from '@dxos/mesh-protocol';
|
|
10
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
11
|
|
|
11
12
|
import { ProtocolProvider } from './network-manager';
|
|
12
13
|
|
|
@@ -36,7 +37,7 @@ export const protocolFactory = ({ session = {}, plugins = [], getTopics }: Proto
|
|
|
36
37
|
discoveryToPublicKey: (dk) => {
|
|
37
38
|
const publicKey = getTopics().find(topic => discoveryKey(topic).equals(dk));
|
|
38
39
|
if (publicKey) {
|
|
39
|
-
protocol.setContext({ topic:
|
|
40
|
+
protocol.setContext({ topic: PublicKey.stringify(publicKey) });
|
|
40
41
|
}
|
|
41
42
|
assert(publicKey, 'PublicKey not found in discovery.');
|
|
42
43
|
return publicKey;
|
|
@@ -61,7 +62,7 @@ export interface Plugin {
|
|
|
61
62
|
|
|
62
63
|
export const createProtocolFactory = (topic: PublicKey, peerId: PublicKey, plugins: Plugin[]) => protocolFactory({
|
|
63
64
|
getTopics: () => [topic.asBuffer()],
|
|
64
|
-
session: { peerId:
|
|
65
|
+
session: { peerId: PublicKey.stringify(peerId.asBuffer()) },
|
|
65
66
|
plugins
|
|
66
67
|
});
|
|
67
68
|
|
|
@@ -71,6 +72,6 @@ export const createProtocolFactory = (topic: PublicKey, peerId: PublicKey, plugi
|
|
|
71
72
|
*/
|
|
72
73
|
export const transportProtocolProvider = (rendezvousKey: Buffer, peerId: Buffer, protocolPlugin: any): ProtocolProvider => protocolFactory({
|
|
73
74
|
getTopics: () => [rendezvousKey],
|
|
74
|
-
session: { peerId:
|
|
75
|
+
session: { peerId: PublicKey.stringify(peerId) },
|
|
75
76
|
plugins: [protocolPlugin]
|
|
76
77
|
});
|
package/src/signal/signal-api.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { it as test, describe } from 'mocha';
|
|
|
7
7
|
import waitForExpect from 'wait-for-expect';
|
|
8
8
|
|
|
9
9
|
import { Awaited, sleep } from '@dxos/async';
|
|
10
|
-
import { PublicKey } from '@dxos/
|
|
10
|
+
import { PublicKey } from '@dxos/protocols';
|
|
11
11
|
import { createTestBroker } from '@dxos/signal';
|
|
12
12
|
import { randomInt } from '@dxos/util';
|
|
13
13
|
|
|
@@ -6,7 +6,7 @@ import assert from 'assert';
|
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
8
|
import { Event, synchronized } from '@dxos/async';
|
|
9
|
-
import { PublicKey } from '@dxos/
|
|
9
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
10
|
import { ComplexMap } from '@dxos/util';
|
|
11
11
|
|
|
12
12
|
import { SignalApi } from './signal-api';
|
package/src/swarm/connection.ts
CHANGED
|
@@ -6,9 +6,9 @@ import assert from 'assert';
|
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
8
|
import { Event, synchronized } from '@dxos/async';
|
|
9
|
-
import { PublicKey } from '@dxos/crypto';
|
|
10
9
|
import { ErrorStream } from '@dxos/debug';
|
|
11
10
|
import { Protocol } from '@dxos/mesh-protocol';
|
|
11
|
+
import { PublicKey } from '@dxos/protocols';
|
|
12
12
|
|
|
13
13
|
import { SignalApi } from '../signal';
|
|
14
14
|
import { Transport, TransportFactory } from '../transport';
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import debug from 'debug';
|
|
6
6
|
|
|
7
7
|
import { Event } from '@dxos/async';
|
|
8
|
-
import { PublicKey } from '@dxos/crypto';
|
|
9
8
|
import { PresencePlugin } from '@dxos/protocol-plugin-presence';
|
|
9
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
10
|
import { ComplexMap, SubscriptionGroup } from '@dxos/util';
|
|
11
11
|
|
|
12
12
|
import { ConnectionState } from './connection';
|
package/src/swarm/swarm.test.ts
CHANGED
|
@@ -8,8 +8,8 @@ import { it as test } from 'mocha';
|
|
|
8
8
|
import waitForExpect from 'wait-for-expect';
|
|
9
9
|
|
|
10
10
|
import { sleep, promiseTimeout } from '@dxos/async';
|
|
11
|
-
import { PublicKey } from '@dxos/crypto';
|
|
12
11
|
import { Protocol } from '@dxos/mesh-protocol';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
13
|
import { afterTest } from '@dxos/testutils';
|
|
14
14
|
|
|
15
15
|
import { SignalApi, SignalConnection } from '../signal';
|
package/src/swarm/swarm.ts
CHANGED
|
@@ -6,8 +6,9 @@ import assert from 'assert';
|
|
|
6
6
|
import debug from 'debug';
|
|
7
7
|
|
|
8
8
|
import { Event } from '@dxos/async';
|
|
9
|
-
import { discoveryKey
|
|
9
|
+
import { discoveryKey } from '@dxos/crypto';
|
|
10
10
|
import { ErrorStream } from '@dxos/debug';
|
|
11
|
+
import { PublicKey } from '@dxos/protocols';
|
|
11
12
|
import { ComplexMap, ComplexSet } from '@dxos/util';
|
|
12
13
|
|
|
13
14
|
import { ProtocolProvider } from '../network-manager';
|
|
@@ -8,8 +8,8 @@ import assert from 'assert';
|
|
|
8
8
|
import debug from 'debug';
|
|
9
9
|
import { EventEmitter } from 'events';
|
|
10
10
|
|
|
11
|
-
import { keyToBuffer, keyToString } from '@dxos/crypto';
|
|
12
11
|
import { Extension, Protocol } from '@dxos/mesh-protocol';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
13
|
|
|
14
14
|
import { protocolFactory } from '../protocol-factory';
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ const EXTENSION_NAME = 'test';
|
|
|
20
20
|
// TODO(dboreham): This method should be added to Protocol (and one for "my ID"?).
|
|
21
21
|
export const getPeerId = (protocol: Protocol) => {
|
|
22
22
|
const { peerId } = protocol.getSession() ?? {};
|
|
23
|
-
return
|
|
23
|
+
return PublicKey.bufferize(peerId);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -97,7 +97,7 @@ export class TestProtocolPlugin extends EventEmitter {
|
|
|
97
97
|
*/
|
|
98
98
|
async send (peerId: Buffer, payload: string): Promise<string> {
|
|
99
99
|
assert(Buffer.isBuffer(peerId));
|
|
100
|
-
const peerIdStr =
|
|
100
|
+
const peerIdStr = PublicKey.stringify(peerId);
|
|
101
101
|
const peer = this._peers.get(peerIdStr);
|
|
102
102
|
// TODO(dboreham): Throw fatal error if peer not found.
|
|
103
103
|
const extension = peer.getExtension(EXTENSION_NAME);
|
|
@@ -111,7 +111,7 @@ export class TestProtocolPlugin extends EventEmitter {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
async _receive (protocol: Protocol, data: any) {
|
|
114
|
-
const peerIdStr =
|
|
114
|
+
const peerIdStr = PublicKey.stringify(getPeerId(protocol));
|
|
115
115
|
let payload = data.data.toString();
|
|
116
116
|
if (this._uppercase) {
|
|
117
117
|
payload = payload.toUpperCase();
|
|
@@ -125,7 +125,7 @@ export class TestProtocolPlugin extends EventEmitter {
|
|
|
125
125
|
if (peerId === undefined) {
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
const peerIdStr =
|
|
128
|
+
const peerIdStr = PublicKey.stringify(peerId);
|
|
129
129
|
if (this._peers.has(peerIdStr)) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
@@ -140,7 +140,7 @@ export class TestProtocolPlugin extends EventEmitter {
|
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
this._peers.delete(
|
|
143
|
+
this._peers.delete(PublicKey.stringify(peerId));
|
|
144
144
|
this.emit('disconnect', peerId);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -151,6 +151,6 @@ export class TestProtocolPlugin extends EventEmitter {
|
|
|
151
151
|
// TODO(dboreham): Try to encapsulate swarmKey, nodeId.
|
|
152
152
|
export const testProtocolProvider = (swarmKey: Buffer, nodeId: Buffer, protocolPlugin: any) => protocolFactory({
|
|
153
153
|
getTopics: () => [swarmKey],
|
|
154
|
-
session: { peerId:
|
|
154
|
+
session: { peerId: PublicKey.stringify(nodeId) },
|
|
155
155
|
plugins: [protocolPlugin]
|
|
156
156
|
});
|
package/src/topology/topology.ts
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import expect from 'expect';
|
|
6
6
|
import waitForExpect from 'wait-for-expect';
|
|
7
7
|
|
|
8
|
-
import { discoveryKey
|
|
8
|
+
import { discoveryKey } from '@dxos/crypto';
|
|
9
9
|
import { Protocol } from '@dxos/mesh-protocol';
|
|
10
|
+
import { PublicKey } from '@dxos/protocols';
|
|
10
11
|
import { afterTest } from '@dxos/testutils';
|
|
11
12
|
import { range } from '@dxos/util';
|
|
12
13
|
|
|
@@ -7,8 +7,8 @@ import debug from 'debug';
|
|
|
7
7
|
import { Transform } from 'stream';
|
|
8
8
|
|
|
9
9
|
import { Event } from '@dxos/async';
|
|
10
|
-
import { PublicKey } from '@dxos/crypto';
|
|
11
10
|
import { ErrorStream } from '@dxos/debug';
|
|
11
|
+
import { PublicKey } from '@dxos/protocols';
|
|
12
12
|
import { ComplexMap } from '@dxos/util';
|
|
13
13
|
|
|
14
14
|
import { SignalApi } from '../signal';
|
|
@@ -8,8 +8,9 @@ import { Duplex } from 'stream';
|
|
|
8
8
|
import waitForExpect from 'wait-for-expect';
|
|
9
9
|
|
|
10
10
|
import { sleep } from '@dxos/async';
|
|
11
|
-
import { discoveryKey
|
|
11
|
+
import { discoveryKey } from '@dxos/crypto';
|
|
12
12
|
import { Protocol } from '@dxos/mesh-protocol';
|
|
13
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
14
|
import { afterTest } from '@dxos/testutils';
|
|
14
15
|
|
|
15
16
|
import { TestProtocolPlugin, testProtocolProvider } from '../testing/test-protocol';
|
|
@@ -8,8 +8,8 @@ import debug from 'debug';
|
|
|
8
8
|
import SimplePeerConstructor, { Instance as SimplePeer } from 'simple-peer';
|
|
9
9
|
|
|
10
10
|
import { Event } from '@dxos/async';
|
|
11
|
-
import { PublicKey } from '@dxos/crypto';
|
|
12
11
|
import { ErrorStream } from '@dxos/debug';
|
|
12
|
+
import { PublicKey } from '@dxos/protocols';
|
|
13
13
|
|
|
14
14
|
import { SignalApi } from '../signal';
|
|
15
15
|
import { Transport, TransportFactory } from './transport';
|