@dxos/echo-pipeline 0.6.12 → 0.6.13-main.548ca8d
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/lib/browser/chunk-PESZVYAN.mjs +2050 -0
- package/dist/lib/browser/chunk-PESZVYAN.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3463 -17
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +3 -4
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-7HHYCGUR.cjs → chunk-6EZVIJNE.cjs} +89 -47
- package/dist/lib/node/chunk-6EZVIJNE.cjs.map +7 -0
- package/dist/lib/node/index.cjs +3440 -35
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +11 -12
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/{browser/chunk-UKXIJW43.mjs → node-esm/chunk-4LW7MDPZ.mjs} +76 -36
- package/dist/lib/node-esm/chunk-4LW7MDPZ.mjs.map +7 -0
- package/dist/lib/{browser/chunk-MPWFDDQK.mjs → node-esm/index.mjs} +1702 -335
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +551 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/automerge/automerge-host.d.ts +24 -1
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/collection-synchronizer.d.ts +2 -0
- package/dist/types/src/automerge/collection-synchronizer.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +3 -3
- package/dist/types/src/automerge/echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts +3 -3
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/space-collection.d.ts +3 -2
- package/dist/types/src/automerge/space-collection.d.ts.map +1 -1
- package/dist/types/src/db-host/automerge-metrics.d.ts +11 -0
- package/dist/types/src/db-host/automerge-metrics.d.ts.map +1 -0
- package/dist/types/src/db-host/data-service.d.ts +3 -2
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/database-root.d.ts +20 -0
- package/dist/types/src/db-host/database-root.d.ts.map +1 -0
- package/dist/types/src/db-host/documents-iterator.d.ts +7 -0
- package/dist/types/src/db-host/documents-iterator.d.ts.map +1 -0
- package/dist/types/src/db-host/echo-host.d.ts +73 -0
- package/dist/types/src/db-host/echo-host.d.ts.map +1 -0
- package/dist/types/src/db-host/index.d.ts +5 -0
- package/dist/types/src/db-host/index.d.ts.map +1 -1
- package/dist/types/src/db-host/migration.d.ts +8 -0
- package/dist/types/src/db-host/migration.d.ts.map +1 -0
- package/dist/types/src/db-host/query-service.d.ts +25 -0
- package/dist/types/src/db-host/query-service.d.ts.map +1 -0
- package/dist/types/src/db-host/query-state.d.ts +41 -0
- package/dist/types/src/db-host/query-state.d.ts.map +1 -0
- package/dist/types/src/db-host/space-state-manager.d.ts +23 -0
- package/dist/types/src/db-host/space-state-manager.d.ts.map +1 -0
- package/dist/types/src/edge/echo-edge-replicator.d.ts +23 -0
- package/dist/types/src/edge/echo-edge-replicator.d.ts.map +1 -0
- package/dist/types/src/edge/echo-edge-replicator.test.d.ts +2 -0
- package/dist/types/src/edge/echo-edge-replicator.test.d.ts.map +1 -0
- package/dist/types/src/edge/index.d.ts +2 -0
- package/dist/types/src/edge/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts +4 -1
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/dist/types/src/testing/test-replicator.d.ts +4 -4
- package/dist/types/src/testing/test-replicator.d.ts.map +1 -1
- package/package.json +40 -50
- package/src/automerge/automerge-host.test.ts +8 -9
- package/src/automerge/automerge-host.ts +46 -7
- package/src/automerge/automerge-repo.test.ts +18 -16
- package/src/automerge/collection-synchronizer.test.ts +10 -5
- package/src/automerge/collection-synchronizer.ts +17 -6
- package/src/automerge/echo-data-monitor.test.ts +1 -3
- package/src/automerge/echo-network-adapter.test.ts +4 -3
- package/src/automerge/echo-network-adapter.ts +5 -4
- package/src/automerge/echo-replicator.ts +3 -3
- package/src/automerge/mesh-echo-replicator-connection.ts +10 -9
- package/src/automerge/mesh-echo-replicator.ts +2 -1
- package/src/automerge/space-collection.ts +3 -2
- package/src/automerge/storage-adapter.test.ts +2 -3
- package/src/db-host/automerge-metrics.ts +38 -0
- package/src/db-host/data-service.ts +29 -14
- package/src/db-host/database-root.ts +86 -0
- package/src/db-host/documents-iterator.ts +73 -0
- package/src/db-host/documents-synchronizer.test.ts +2 -2
- package/src/db-host/echo-host.ts +257 -0
- package/src/db-host/index.ts +6 -1
- package/src/db-host/migration.ts +57 -0
- package/src/db-host/query-service.ts +208 -0
- package/src/db-host/query-state.ts +200 -0
- package/src/db-host/space-state-manager.ts +90 -0
- package/src/edge/echo-edge-replicator.test.ts +96 -0
- package/src/edge/echo-edge-replicator.ts +337 -0
- package/src/edge/index.ts +5 -0
- package/src/index.ts +1 -0
- package/src/metadata/metadata-store.ts +20 -0
- package/src/pipeline/pipeline-stress.test.ts +44 -47
- package/src/pipeline/pipeline.test.ts +3 -4
- package/src/space/control-pipeline.test.ts +2 -3
- package/src/space/control-pipeline.ts +10 -1
- package/src/space/replication.browser.test.ts +2 -8
- package/src/space/space-manager.browser.test.ts +6 -5
- package/src/space/space-protocol.browser.test.ts +29 -34
- package/src/space/space-protocol.test.ts +29 -27
- package/src/space/space.test.ts +28 -11
- package/src/testing/test-agent-builder.ts +2 -2
- package/src/testing/test-replicator.ts +3 -3
- package/dist/lib/browser/chunk-MPWFDDQK.mjs.map +0 -7
- package/dist/lib/browser/chunk-UKXIJW43.mjs.map +0 -7
- package/dist/lib/browser/chunk-XPCF2V5U.mjs +0 -31
- package/dist/lib/browser/chunk-XPCF2V5U.mjs.map +0 -7
- package/dist/lib/browser/light.mjs +0 -32
- package/dist/lib/browser/light.mjs.map +0 -7
- package/dist/lib/node/chunk-5DH4KR2S.cjs +0 -2148
- package/dist/lib/node/chunk-5DH4KR2S.cjs.map +0 -7
- package/dist/lib/node/chunk-7HHYCGUR.cjs.map +0 -7
- package/dist/lib/node/chunk-DZVH7HDD.cjs +0 -43
- package/dist/lib/node/chunk-DZVH7HDD.cjs.map +0 -7
- package/dist/lib/node/light.cjs +0 -52
- package/dist/lib/node/light.cjs.map +0 -7
- package/dist/types/src/light.d.ts +0 -4
- package/dist/types/src/light.d.ts.map +0 -1
- package/src/light.ts +0 -7
|
@@ -2,15 +2,11 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import expect from 'expect';
|
|
8
|
-
import waitForExpect from 'wait-for-expect';
|
|
5
|
+
import { describe, expect, test, onTestFinished } from 'vitest';
|
|
9
6
|
|
|
10
7
|
import { Keyring } from '@dxos/keyring';
|
|
11
8
|
import { PublicKey } from '@dxos/keys';
|
|
12
9
|
import { createStorage } from '@dxos/random-access-storage';
|
|
13
|
-
import { describe, test, afterTest } from '@dxos/test';
|
|
14
10
|
import { Timeframe } from '@dxos/timeframe';
|
|
15
11
|
|
|
16
12
|
import { TestFeedBuilder, TestAgentBuilder, WebsocketNetworkManagerProvider } from '../testing';
|
|
@@ -23,7 +19,9 @@ const SIGNAL_URL = `ws://localhost:${port}/.well-known/dx/signal`;
|
|
|
23
19
|
describe('space/space-protocol', () => {
|
|
24
20
|
test('two peers discover each other', async () => {
|
|
25
21
|
const builder = new TestAgentBuilder();
|
|
26
|
-
|
|
22
|
+
onTestFinished(async () => {
|
|
23
|
+
await builder.close();
|
|
24
|
+
});
|
|
27
25
|
const topic = PublicKey.random();
|
|
28
26
|
|
|
29
27
|
const peer1 = await builder.createPeer();
|
|
@@ -39,18 +37,22 @@ describe('space/space-protocol', () => {
|
|
|
39
37
|
await protocol1.start();
|
|
40
38
|
await protocol2.start();
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
onTestFinished(() => protocol1.stop());
|
|
41
|
+
onTestFinished(() => protocol2.stop());
|
|
44
42
|
|
|
45
|
-
await
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
await expect
|
|
44
|
+
.poll(() => presence1.getPeersOnline().some(({ identityKey }) => identityKey.equals(peer2.identityKey)))
|
|
45
|
+
.toBeTruthy();
|
|
46
|
+
await expect
|
|
47
|
+
.poll(() => presence2.getPeersOnline().some(({ identityKey }) => identityKey.equals(peer1.identityKey)))
|
|
48
|
+
.toBeTruthy();
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
test('replicates a feed', async () => {
|
|
52
52
|
const builder = new TestAgentBuilder();
|
|
53
|
-
|
|
53
|
+
onTestFinished(async () => {
|
|
54
|
+
await builder.close();
|
|
55
|
+
});
|
|
54
56
|
const topic = PublicKey.random();
|
|
55
57
|
|
|
56
58
|
const peer1 = await builder.createPeer();
|
|
@@ -62,8 +64,8 @@ describe('space/space-protocol', () => {
|
|
|
62
64
|
await protocol1.start();
|
|
63
65
|
await protocol2.start();
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
onTestFinished(() => protocol1.stop());
|
|
68
|
+
onTestFinished(() => protocol2.stop());
|
|
67
69
|
|
|
68
70
|
const builder1 = new TestFeedBuilder();
|
|
69
71
|
const feedStore1 = builder1.createFeedStore();
|
|
@@ -79,24 +81,23 @@ describe('space/space-protocol', () => {
|
|
|
79
81
|
await protocol2.addFeed(feed2);
|
|
80
82
|
|
|
81
83
|
await feed1.append({ timeframe: new Timeframe() });
|
|
82
|
-
await
|
|
83
|
-
expect(feed2.properties.length).toEqual(1);
|
|
84
|
-
});
|
|
84
|
+
await expect.poll(() => feed2.properties.length).toEqual(1);
|
|
85
85
|
|
|
86
86
|
await feed1.append({ timeframe: new Timeframe() });
|
|
87
|
-
await
|
|
88
|
-
expect(feed2.properties.length).toEqual(2);
|
|
89
|
-
});
|
|
87
|
+
await expect.poll(() => feed2.properties.length).toEqual(2);
|
|
90
88
|
|
|
91
89
|
await builder.close();
|
|
92
90
|
});
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
// TODO: Some storage drivers may break when there are multiple storage instances.
|
|
93
|
+
test.skip('replicates a feed through a webrtc connection', async () => {
|
|
95
94
|
const builder = new TestAgentBuilder({
|
|
96
95
|
storage: createStorage(),
|
|
97
96
|
networkManagerProvider: WebsocketNetworkManagerProvider(SIGNAL_URL),
|
|
98
97
|
});
|
|
99
|
-
|
|
98
|
+
onTestFinished(async () => {
|
|
99
|
+
await builder.close();
|
|
100
|
+
});
|
|
100
101
|
|
|
101
102
|
const keyring = new Keyring();
|
|
102
103
|
const topic = await keyring.createKey();
|
|
@@ -110,8 +111,8 @@ describe('space/space-protocol', () => {
|
|
|
110
111
|
await protocol1.start();
|
|
111
112
|
await protocol2.start();
|
|
112
113
|
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
onTestFinished(() => protocol1.stop());
|
|
115
|
+
onTestFinished(() => protocol2.stop());
|
|
115
116
|
|
|
116
117
|
const feedKey = await peer1.keyring.createKey();
|
|
117
118
|
|
|
@@ -122,17 +123,11 @@ describe('space/space-protocol', () => {
|
|
|
122
123
|
await protocol2.addFeed(feed2);
|
|
123
124
|
|
|
124
125
|
await feed1.append({ timeframe: new Timeframe() });
|
|
125
|
-
await
|
|
126
|
-
expect(feed2.properties.length).toEqual(1);
|
|
127
|
-
});
|
|
126
|
+
await expect.poll(() => feed2.properties.length).toEqual(1);
|
|
128
127
|
|
|
129
128
|
await feed1.append({ timeframe: new Timeframe() });
|
|
130
|
-
await
|
|
131
|
-
expect(feed2.properties.length).toEqual(2);
|
|
132
|
-
});
|
|
129
|
+
await expect.poll(() => feed2.properties.length).toEqual(2);
|
|
133
130
|
|
|
134
131
|
await builder.close();
|
|
135
|
-
})
|
|
136
|
-
.skipEnvironments('webkit')
|
|
137
|
-
.tag('flaky'); // Some storage drivers may break when there are multiple storage instances.
|
|
132
|
+
});
|
|
138
133
|
});
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import expect from '
|
|
6
|
-
import waitForExpect from 'wait-for-expect';
|
|
5
|
+
import { describe, expect, test, onTestFinished } from 'vitest';
|
|
7
6
|
|
|
8
7
|
import { PublicKey } from '@dxos/keys';
|
|
9
8
|
import { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';
|
|
10
9
|
import { MemoryTransportFactory, SwarmNetworkManager } from '@dxos/network-manager';
|
|
11
10
|
import { StorageType, createStorage } from '@dxos/random-access-storage';
|
|
12
11
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
13
|
-
import { describe, test, afterTest } from '@dxos/test';
|
|
14
12
|
import { Timeframe } from '@dxos/timeframe';
|
|
15
13
|
|
|
16
14
|
import { AuthStatus, MOCK_AUTH_PROVIDER, MOCK_AUTH_VERIFIER, SpaceProtocol } from './space-protocol';
|
|
@@ -19,7 +17,9 @@ import { TestAgentBuilder, TestFeedBuilder } from '../testing';
|
|
|
19
17
|
describe('space/space-protocol', () => {
|
|
20
18
|
test('two peers discover each other via presence', async () => {
|
|
21
19
|
const builder = new TestAgentBuilder();
|
|
22
|
-
|
|
20
|
+
onTestFinished(async () => {
|
|
21
|
+
await builder.close();
|
|
22
|
+
});
|
|
23
23
|
const topic = PublicKey.random();
|
|
24
24
|
|
|
25
25
|
const peer1 = await builder.createPeer();
|
|
@@ -35,15 +35,21 @@ describe('space/space-protocol', () => {
|
|
|
35
35
|
const protocol2 = peer2.createSpaceProtocol(topic, gossip2);
|
|
36
36
|
|
|
37
37
|
await protocol1.start();
|
|
38
|
-
|
|
38
|
+
onTestFinished(() => protocol1.stop());
|
|
39
39
|
|
|
40
40
|
await protocol2.start();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
await
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
onTestFinished(() => protocol2.stop());
|
|
42
|
+
|
|
43
|
+
await expect
|
|
44
|
+
.poll(() => presence1.getPeersOnline().some(({ identityKey }) => identityKey.equals(peer2.identityKey)), {
|
|
45
|
+
timeout: 1_000,
|
|
46
|
+
})
|
|
47
|
+
.toBeTruthy();
|
|
48
|
+
await expect
|
|
49
|
+
.poll(() => presence2.getPeersOnline().some(({ identityKey }) => identityKey.equals(peer1.identityKey)), {
|
|
50
|
+
timeout: 1_000,
|
|
51
|
+
})
|
|
52
|
+
.toBeTruthy();
|
|
47
53
|
});
|
|
48
54
|
|
|
49
55
|
test('failing authentication', async () => {
|
|
@@ -81,19 +87,19 @@ describe('space/space-protocol', () => {
|
|
|
81
87
|
});
|
|
82
88
|
|
|
83
89
|
await protocol1.start();
|
|
84
|
-
|
|
90
|
+
onTestFinished(() => protocol1.stop());
|
|
85
91
|
|
|
86
92
|
await protocol2.start();
|
|
87
|
-
|
|
93
|
+
onTestFinished(() => protocol2.stop());
|
|
88
94
|
|
|
89
|
-
await
|
|
90
|
-
expect(protocol1.sessions.get(peerId2)?.authStatus).toEqual(AuthStatus.FAILURE);
|
|
91
|
-
});
|
|
95
|
+
await expect.poll(() => protocol1.sessions.get(peerId2)?.authStatus).toEqual(AuthStatus.FAILURE);
|
|
92
96
|
});
|
|
93
97
|
|
|
94
98
|
test('replicates a feed', async () => {
|
|
95
99
|
const builder = new TestAgentBuilder();
|
|
96
|
-
|
|
100
|
+
onTestFinished(async () => {
|
|
101
|
+
await builder.close();
|
|
102
|
+
});
|
|
97
103
|
|
|
98
104
|
const topic = PublicKey.random();
|
|
99
105
|
|
|
@@ -106,8 +112,8 @@ describe('space/space-protocol', () => {
|
|
|
106
112
|
await protocol1.start();
|
|
107
113
|
await protocol2.start();
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
onTestFinished(() => protocol1.stop());
|
|
116
|
+
onTestFinished(() => protocol2.stop());
|
|
111
117
|
|
|
112
118
|
//
|
|
113
119
|
// Create feeds.
|
|
@@ -131,16 +137,12 @@ describe('space/space-protocol', () => {
|
|
|
131
137
|
|
|
132
138
|
// TODO(burdon): Append batch of messages.
|
|
133
139
|
await feed1.append({ timeframe: new Timeframe() });
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
expect(feed2.properties.length).toEqual(1);
|
|
137
|
-
});
|
|
140
|
+
// Received message appended before replication.
|
|
141
|
+
await expect.poll(() => feed2.properties.length).toEqual(1);
|
|
138
142
|
|
|
139
143
|
// TODO(burdon): Append batch of messages.
|
|
140
144
|
await feed1.append({ timeframe: new Timeframe() });
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
expect(feed2.properties.length).toEqual(2);
|
|
144
|
-
});
|
|
145
|
+
// Received message appended after replication.
|
|
146
|
+
await expect.poll(() => feed2.properties.length).toEqual(2);
|
|
145
147
|
});
|
|
146
148
|
});
|
package/src/space/space.test.ts
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import expect from '
|
|
5
|
+
import { onTestFinished, describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Context } from '@dxos/context';
|
|
8
8
|
import { CredentialGenerator } from '@dxos/credentials';
|
|
9
|
-
import { afterTest, describe, test } from '@dxos/test';
|
|
10
9
|
|
|
11
10
|
import { TestAgentBuilder } from '../testing';
|
|
12
11
|
|
|
@@ -16,13 +15,17 @@ const run = <T>(cb: () => Promise<T>): Promise<T> => cb();
|
|
|
16
15
|
describe('space/space', () => {
|
|
17
16
|
test('creates a database with object model', async () => {
|
|
18
17
|
const builder = new TestAgentBuilder();
|
|
19
|
-
|
|
18
|
+
onTestFinished(async () => {
|
|
19
|
+
await builder.close();
|
|
20
|
+
});
|
|
20
21
|
const agent = await builder.createPeer();
|
|
21
22
|
const space = await agent.createSpace();
|
|
22
23
|
|
|
23
24
|
await space.open(Context.default());
|
|
24
25
|
expect(space.isOpen).toBeTruthy();
|
|
25
|
-
|
|
26
|
+
onTestFinished(async () => {
|
|
27
|
+
await space.close();
|
|
28
|
+
});
|
|
26
29
|
|
|
27
30
|
await agent.spaceGenesis(space);
|
|
28
31
|
|
|
@@ -34,7 +37,9 @@ describe('space/space', () => {
|
|
|
34
37
|
|
|
35
38
|
test('two spaces replicating', async () => {
|
|
36
39
|
const builder = new TestAgentBuilder();
|
|
37
|
-
|
|
40
|
+
onTestFinished(async () => {
|
|
41
|
+
await builder.close();
|
|
42
|
+
});
|
|
38
43
|
|
|
39
44
|
//
|
|
40
45
|
// Agent 1
|
|
@@ -45,7 +50,9 @@ describe('space/space', () => {
|
|
|
45
50
|
|
|
46
51
|
await space.open(Context.default());
|
|
47
52
|
expect(space.isOpen).toBeTruthy();
|
|
48
|
-
|
|
53
|
+
onTestFinished(async () => {
|
|
54
|
+
await space.close();
|
|
55
|
+
});
|
|
49
56
|
|
|
50
57
|
await agent.spaceGenesis(space);
|
|
51
58
|
|
|
@@ -64,7 +71,9 @@ describe('space/space', () => {
|
|
|
64
71
|
|
|
65
72
|
await space.open(Context.default());
|
|
66
73
|
expect(space.isOpen).toBeTruthy();
|
|
67
|
-
|
|
74
|
+
onTestFinished(async () => {
|
|
75
|
+
await space.close();
|
|
76
|
+
});
|
|
68
77
|
|
|
69
78
|
return [agent, space];
|
|
70
79
|
});
|
|
@@ -110,13 +119,17 @@ describe('space/space', () => {
|
|
|
110
119
|
|
|
111
120
|
test('open & close', async () => {
|
|
112
121
|
const builder = new TestAgentBuilder();
|
|
113
|
-
|
|
122
|
+
onTestFinished(async () => {
|
|
123
|
+
await builder.close();
|
|
124
|
+
});
|
|
114
125
|
const agent = await builder.createPeer();
|
|
115
126
|
const space1 = await agent.createSpace();
|
|
116
127
|
|
|
117
128
|
await space1.open(Context.default());
|
|
118
129
|
expect(space1.isOpen).toBeTruthy();
|
|
119
|
-
|
|
130
|
+
onTestFinished(async () => {
|
|
131
|
+
await space1.close();
|
|
132
|
+
});
|
|
120
133
|
|
|
121
134
|
await agent.spaceGenesis(space1);
|
|
122
135
|
|
|
@@ -134,13 +147,17 @@ describe('space/space', () => {
|
|
|
134
147
|
|
|
135
148
|
test('re-open', async () => {
|
|
136
149
|
const builder = new TestAgentBuilder();
|
|
137
|
-
|
|
150
|
+
onTestFinished(async () => {
|
|
151
|
+
await builder.close();
|
|
152
|
+
});
|
|
138
153
|
const agent = await builder.createPeer();
|
|
139
154
|
const space = await agent.createSpace();
|
|
140
155
|
|
|
141
156
|
{
|
|
142
157
|
await space.open(Context.default());
|
|
143
|
-
|
|
158
|
+
onTestFinished(async () => {
|
|
159
|
+
await space.close();
|
|
160
|
+
});
|
|
144
161
|
expect(space.isOpen).toBeTruthy();
|
|
145
162
|
|
|
146
163
|
await agent.spaceGenesis(space);
|
|
@@ -8,7 +8,7 @@ import { type FeedStore } from '@dxos/feed-store';
|
|
|
8
8
|
import { type Keyring } from '@dxos/keyring';
|
|
9
9
|
import { PublicKey } from '@dxos/keys';
|
|
10
10
|
import { MemorySignalManager, MemorySignalManagerContext, WebsocketSignalManager } from '@dxos/messaging';
|
|
11
|
-
import { MemoryTransportFactory, SwarmNetworkManager,
|
|
11
|
+
import { MemoryTransportFactory, SwarmNetworkManager, createRtcTransportFactory } from '@dxos/network-manager';
|
|
12
12
|
import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
13
13
|
import { type SpaceMetadata } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
14
14
|
import { AdmittedFeed } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
@@ -36,7 +36,7 @@ export const WebsocketNetworkManagerProvider =
|
|
|
36
36
|
() =>
|
|
37
37
|
new SwarmNetworkManager({
|
|
38
38
|
signalManager: new WebsocketSignalManager([{ server: signalUrl }]),
|
|
39
|
-
transportFactory:
|
|
39
|
+
transportFactory: createRtcTransportFactory(),
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
export type TestAgentBuilderOptions = {
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { sleep, synchronized } from '@dxos/async';
|
|
6
|
-
import { type Message } from '@dxos/automerge/automerge-repo';
|
|
7
6
|
import { type Context, LifecycleState, Resource } from '@dxos/context';
|
|
8
7
|
import { invariant } from '@dxos/invariant';
|
|
9
8
|
import { log } from '@dxos/log';
|
|
9
|
+
import type { AutomergeProtocolMessage } from '@dxos/protocols';
|
|
10
10
|
import { AutomergeReplicator, type AutomergeReplicatorFactory } from '@dxos/teleport-extension-automerge-replicator';
|
|
11
11
|
|
|
12
12
|
import type {
|
|
@@ -159,8 +159,8 @@ export class TestReplicatorConnection implements ReplicatorConnection {
|
|
|
159
159
|
|
|
160
160
|
constructor(
|
|
161
161
|
public readonly peerId: string,
|
|
162
|
-
public readonly readable: ReadableStream<
|
|
163
|
-
public readonly writable: WritableStream<
|
|
162
|
+
public readonly readable: ReadableStream<AutomergeProtocolMessage>,
|
|
163
|
+
public readonly writable: WritableStream<AutomergeProtocolMessage>,
|
|
164
164
|
) {}
|
|
165
165
|
|
|
166
166
|
async shouldAdvertise(params: ShouldAdvertiseParams): Promise<boolean> {
|