@dxos/echo-pipeline 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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-WIQUYO7H.mjs → neutral/chunk-DN4YBAWV.mjs} +35 -41
- package/dist/lib/neutral/chunk-DN4YBAWV.mjs.map +7 -0
- package/dist/lib/{browser/chunk-FJPXA75J.mjs → neutral/chunk-IMPFMBJK.mjs} +7 -1
- package/dist/lib/neutral/chunk-IMPFMBJK.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/filter/index.mjs +1 -1
- package/dist/lib/{browser → neutral}/index.mjs +1428 -1288
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/testing/index.mjs +4 -4
- package/dist/lib/{browser → neutral}/testing/index.mjs.map +3 -3
- package/dist/types/src/automerge/automerge-host.d.ts +9 -12
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +7 -6
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +11 -10
- package/dist/types/src/automerge/echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/heads-store.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts +2 -2
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts +6 -5
- package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
- package/dist/types/src/db-host/automerge-data-source.d.ts +2 -1
- package/dist/types/src/db-host/automerge-data-source.d.ts.map +1 -1
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts +2 -2
- package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -1
- package/dist/types/src/db-host/echo-host.d.ts +33 -35
- package/dist/types/src/db-host/echo-host.d.ts.map +1 -1
- package/dist/types/src/db-host/local-queue-service.d.ts +5 -2
- package/dist/types/src/db-host/local-queue-service.d.ts.map +1 -1
- package/dist/types/src/db-host/query-service.d.ts +8 -8
- package/dist/types/src/db-host/query-service.d.ts.map +1 -1
- package/dist/types/src/db-host/queue-data-source.d.ts +11 -1
- package/dist/types/src/db-host/queue-data-source.d.ts.map +1 -1
- package/dist/types/src/db-host/stub.d.ts +2 -1
- package/dist/types/src/db-host/stub.d.ts.map +1 -1
- package/dist/types/src/edge/echo-edge-replicator.d.ts +5 -4
- package/dist/types/src/edge/echo-edge-replicator.d.ts.map +1 -1
- package/dist/types/src/filter/filter-match.d.ts.map +1 -1
- package/dist/types/src/query/plan.d.ts +30 -13
- package/dist/types/src/query/plan.d.ts.map +1 -1
- package/dist/types/src/query/query-executor.d.ts +15 -15
- package/dist/types/src/query/query-executor.d.ts.map +1 -1
- package/dist/types/src/query/query-planner.d.ts +4 -1
- package/dist/types/src/query/query-planner.d.ts.map +1 -1
- package/dist/types/src/space/control-pipeline.d.ts +2 -1
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +2 -1
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +3 -2
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +2 -2
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/test-replicator.d.ts +8 -8
- package/dist/types/src/testing/test-replicator.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +44 -49
- package/src/automerge/automerge-host.test.ts +8 -10
- package/src/automerge/automerge-host.ts +25 -42
- package/src/automerge/automerge-repo.test.ts +2 -1
- package/src/automerge/echo-network-adapter.test.ts +2 -1
- package/src/automerge/echo-network-adapter.ts +17 -17
- package/src/automerge/echo-replicator.ts +11 -10
- package/src/automerge/heads-store.ts +28 -1
- package/src/automerge/mesh-echo-replicator-connection.ts +2 -2
- package/src/automerge/mesh-echo-replicator.ts +13 -9
- package/src/db-host/automerge-data-source.test.ts +31 -25
- package/src/db-host/automerge-data-source.ts +48 -5
- package/src/db-host/data-service.ts +4 -3
- package/src/db-host/documents-synchronizer.test.ts +0 -4
- package/src/db-host/documents-synchronizer.ts +5 -3
- package/src/db-host/echo-host.ts +128 -141
- package/src/db-host/local-queue-service.ts +45 -46
- package/src/db-host/query-service.ts +21 -109
- package/src/db-host/queue-data-source.ts +50 -23
- package/src/db-host/queue-service.test.ts +15 -11
- package/src/db-host/space-state-manager.ts +1 -1
- package/src/db-host/stub.ts +5 -0
- package/src/edge/echo-edge-replicator.test.ts +9 -8
- package/src/edge/echo-edge-replicator.ts +27 -22
- package/src/filter/filter-match.test.ts +10 -0
- package/src/filter/filter-match.ts +13 -5
- package/src/metadata/metadata-store.ts +3 -3
- package/src/query/plan.ts +35 -17
- package/src/query/query-executor.ts +545 -378
- package/src/query/query-planner.test.ts +457 -163
- package/src/query/query-planner.ts +208 -55
- package/src/space/control-pipeline.test.ts +2 -1
- package/src/space/control-pipeline.ts +2 -3
- package/src/space/space-manager.ts +7 -3
- package/src/space/space-protocol.browser.test.ts +13 -12
- package/src/space/space-protocol.test.ts +13 -12
- package/src/space/space-protocol.ts +5 -4
- package/src/space/space.test.ts +2 -2
- package/src/space/space.ts +5 -5
- package/src/testing/test-replicator.ts +11 -11
- package/dist/lib/browser/chunk-FJPXA75J.mjs.map +0 -7
- package/dist/lib/browser/chunk-WIQUYO7H.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/chunk-7PL6UK4B.mjs +0 -2154
- package/dist/lib/node-esm/chunk-7PL6UK4B.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-S5KGVQFZ.mjs +0 -235
- package/dist/lib/node-esm/chunk-S5KGVQFZ.mjs.map +0 -7
- package/dist/lib/node-esm/filter/index.mjs +0 -12
- package/dist/lib/node-esm/filter/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -6805
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/testing/index.mjs +0 -591
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/types/src/db-host/documents-iterator.d.ts +0 -7
- package/dist/types/src/db-host/documents-iterator.d.ts.map +0 -1
- package/src/db-host/documents-iterator.ts +0 -76
- /package/dist/lib/{browser → neutral}/filter/index.mjs.map +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/echo-pipeline",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bcb3aa67d6",
|
|
4
4
|
"description": "ECHO database.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -16,20 +16,17 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"source": "./src/index.ts",
|
|
18
18
|
"types": "./dist/types/src/index.d.ts",
|
|
19
|
-
"
|
|
20
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
19
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
21
20
|
},
|
|
22
21
|
"./testing": {
|
|
23
22
|
"source": "./src/testing/index.ts",
|
|
24
23
|
"types": "./dist/types/src/testing/index.d.ts",
|
|
25
|
-
"
|
|
26
|
-
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
24
|
+
"default": "./dist/lib/neutral/testing/index.mjs"
|
|
27
25
|
},
|
|
28
26
|
"./filter": {
|
|
29
27
|
"source": "./src/filter/index.ts",
|
|
30
28
|
"types": "./dist/types/src/filter/index.d.ts",
|
|
31
|
-
"
|
|
32
|
-
"node": "./dist/lib/node-esm/filter/index.mjs"
|
|
29
|
+
"default": "./dist/lib/neutral/filter/index.mjs"
|
|
33
30
|
}
|
|
34
31
|
},
|
|
35
32
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -49,54 +46,52 @@
|
|
|
49
46
|
"dependencies": {
|
|
50
47
|
"@automerge/automerge": "3.2.3",
|
|
51
48
|
"@automerge/automerge-repo": "2.5.1",
|
|
52
|
-
"@effect/sql": "0.
|
|
53
|
-
"@effect/sql-sqlite-node": "0.
|
|
49
|
+
"@effect/sql": "0.49.0",
|
|
50
|
+
"@effect/sql-sqlite-node": "0.50.1",
|
|
54
51
|
"crc-32": "^1.2.2",
|
|
55
|
-
"effect": "3.
|
|
52
|
+
"effect": "3.20.0",
|
|
53
|
+
"fast-deep-equal": "^3.1.3",
|
|
56
54
|
"level-transcoder": "^1.0.1",
|
|
57
|
-
"
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/debug": "0.8.4-main.
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/echo": "0.8.4-main.
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/feed": "0.8.4-main.
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/index-core": "0.8.4-main.
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/invariant": "0.8.4-main.
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/
|
|
84
|
-
"@dxos/
|
|
85
|
-
"@dxos/
|
|
86
|
-
"@dxos/teleport-extension-
|
|
87
|
-
"@dxos/teleport-extension-
|
|
88
|
-
"@dxos/
|
|
89
|
-
"@dxos/
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/util": "0.8.4-main.bc674ce",
|
|
93
|
-
"@dxos/typings": "0.8.4-main.bc674ce"
|
|
55
|
+
"@dxos/async": "0.8.4-main.bcb3aa67d6",
|
|
56
|
+
"@dxos/codec-protobuf": "0.8.4-main.bcb3aa67d6",
|
|
57
|
+
"@dxos/credentials": "0.8.4-main.bcb3aa67d6",
|
|
58
|
+
"@dxos/crypto": "0.8.4-main.bcb3aa67d6",
|
|
59
|
+
"@dxos/context": "0.8.4-main.bcb3aa67d6",
|
|
60
|
+
"@dxos/debug": "0.8.4-main.bcb3aa67d6",
|
|
61
|
+
"@dxos/echo": "0.8.4-main.bcb3aa67d6",
|
|
62
|
+
"@dxos/echo-protocol": "0.8.4-main.bcb3aa67d6",
|
|
63
|
+
"@dxos/errors": "0.8.4-main.bcb3aa67d6",
|
|
64
|
+
"@dxos/effect": "0.8.4-main.bcb3aa67d6",
|
|
65
|
+
"@dxos/edge-client": "0.8.4-main.bcb3aa67d6",
|
|
66
|
+
"@dxos/feed-store": "0.8.4-main.bcb3aa67d6",
|
|
67
|
+
"@dxos/feed": "0.8.4-main.bcb3aa67d6",
|
|
68
|
+
"@dxos/hypercore": "0.8.4-main.bcb3aa67d6",
|
|
69
|
+
"@dxos/index-core": "0.8.4-main.bcb3aa67d6",
|
|
70
|
+
"@dxos/keyring": "0.8.4-main.bcb3aa67d6",
|
|
71
|
+
"@dxos/invariant": "0.8.4-main.bcb3aa67d6",
|
|
72
|
+
"@dxos/keys": "0.8.4-main.bcb3aa67d6",
|
|
73
|
+
"@dxos/kv-store": "0.8.4-main.bcb3aa67d6",
|
|
74
|
+
"@dxos/log": "0.8.4-main.bcb3aa67d6",
|
|
75
|
+
"@dxos/network-manager": "0.8.4-main.bcb3aa67d6",
|
|
76
|
+
"@dxos/protocols": "0.8.4-main.bcb3aa67d6",
|
|
77
|
+
"@dxos/random-access-storage": "0.8.4-main.bcb3aa67d6",
|
|
78
|
+
"@dxos/node-std": "0.8.4-main.bcb3aa67d6",
|
|
79
|
+
"@dxos/messaging": "0.8.4-main.bcb3aa67d6",
|
|
80
|
+
"@dxos/teleport-extension-automerge-replicator": "0.8.4-main.bcb3aa67d6",
|
|
81
|
+
"@dxos/teleport": "0.8.4-main.bcb3aa67d6",
|
|
82
|
+
"@dxos/teleport-extension-gossip": "0.8.4-main.bcb3aa67d6",
|
|
83
|
+
"@dxos/sql-sqlite": "0.8.4-main.bcb3aa67d6",
|
|
84
|
+
"@dxos/teleport-extension-object-sync": "0.8.4-main.bcb3aa67d6",
|
|
85
|
+
"@dxos/teleport-extension-replicator": "0.8.4-main.bcb3aa67d6",
|
|
86
|
+
"@dxos/timeframe": "0.8.4-main.bcb3aa67d6",
|
|
87
|
+
"@dxos/typings": "0.8.4-main.bcb3aa67d6",
|
|
88
|
+
"@dxos/util": "0.8.4-main.bcb3aa67d6",
|
|
89
|
+
"@dxos/tracing": "0.8.4-main.bcb3aa67d6"
|
|
94
90
|
},
|
|
95
91
|
"devDependencies": {
|
|
96
|
-
"@types/lodash.isequal": "^4.5.0",
|
|
97
92
|
"fast-check": "^3.19.0",
|
|
98
93
|
"get-port-please": "^3.1.1",
|
|
99
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
94
|
+
"@dxos/test-utils": "0.8.4-main.bcb3aa67d6"
|
|
100
95
|
},
|
|
101
96
|
"publishConfig": {
|
|
102
97
|
"access": "public"
|
|
@@ -8,7 +8,6 @@ import { type DocumentId, type Heads, generateAutomergeUrl, parseAutomergeUrl }
|
|
|
8
8
|
import { describe, expect, onTestFinished, test } from 'vitest';
|
|
9
9
|
|
|
10
10
|
import { Context } from '@dxos/context';
|
|
11
|
-
import { IndexMetadataStore } from '@dxos/indexing';
|
|
12
11
|
import { PublicKey } from '@dxos/keys';
|
|
13
12
|
import type { LevelDB } from '@dxos/kv-store';
|
|
14
13
|
import { createTestLevel } from '@dxos/kv-store/testing';
|
|
@@ -27,7 +26,7 @@ describe('AutomergeHost', () => {
|
|
|
27
26
|
handle.change((doc: any) => {
|
|
28
27
|
doc.text = 'Hello world';
|
|
29
28
|
});
|
|
30
|
-
await host.flush();
|
|
29
|
+
await host.flush(Context.default());
|
|
31
30
|
expect(handle.doc()!.text).toEqual('Hello world');
|
|
32
31
|
});
|
|
33
32
|
|
|
@@ -40,14 +39,14 @@ describe('AutomergeHost', () => {
|
|
|
40
39
|
});
|
|
41
40
|
const url = handle.url;
|
|
42
41
|
|
|
43
|
-
await host.flush();
|
|
42
|
+
await host.flush(Context.default());
|
|
44
43
|
await host.close();
|
|
45
44
|
|
|
46
45
|
const host2 = await setupAutomergeHost({ level });
|
|
47
46
|
const handle2 = await host2.loadDoc<any>(Context.default(), url);
|
|
48
47
|
await handle2.whenReady();
|
|
49
48
|
expect(handle2.doc()!.text).toEqual('Hello world');
|
|
50
|
-
await host2.flush();
|
|
49
|
+
await host2.flush(Context.default());
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
test('load resolves when document is created from binary', async () => {
|
|
@@ -77,7 +76,7 @@ describe('AutomergeHost', () => {
|
|
|
77
76
|
const host = await setupAutomergeHost({ level });
|
|
78
77
|
const handle = await host.createDoc({ text: 'Hello world' });
|
|
79
78
|
const expectedHeads = getHeads(handle.doc()!);
|
|
80
|
-
await host.flush();
|
|
79
|
+
await host.flush(Context.default());
|
|
81
80
|
|
|
82
81
|
expect(await host.getHeads([handle.documentId])).toEqual([expectedHeads]);
|
|
83
82
|
await host.close();
|
|
@@ -97,7 +96,7 @@ describe('AutomergeHost', () => {
|
|
|
97
96
|
const host = await setupAutomergeHost({ level });
|
|
98
97
|
const handles = await Promise.all(range(2, () => host.createDoc({ text: 'Hello world' })));
|
|
99
98
|
const expectedHeads: (Heads | undefined)[] = handles.map((handle) => getHeads(handle.doc()!));
|
|
100
|
-
await host.flush();
|
|
99
|
+
await host.flush(Context.default());
|
|
101
100
|
|
|
102
101
|
const ids = handles.map((handle) => handle.documentId);
|
|
103
102
|
ids.splice(1, 0, 'non-existent-id' as DocumentId);
|
|
@@ -131,15 +130,15 @@ describe('AutomergeHost', () => {
|
|
|
131
130
|
const handle = await host2.createDoc({ docIndex: i });
|
|
132
131
|
documentIds.push(handle.documentId);
|
|
133
132
|
}
|
|
134
|
-
await host2.flush();
|
|
133
|
+
await host2.flush(Context.default());
|
|
135
134
|
await host2.close();
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
const host2 = await setupAutomergeHost({ level: level2 });
|
|
139
138
|
|
|
140
139
|
const network = await new TestReplicationNetwork().open();
|
|
141
|
-
await host1.addReplicator(await network.createReplicator());
|
|
142
|
-
await host2.addReplicator(await network.createReplicator());
|
|
140
|
+
await host1.addReplicator(Context.default(), await network.createReplicator());
|
|
141
|
+
await host2.addReplicator(Context.default(), await network.createReplicator());
|
|
143
142
|
|
|
144
143
|
const collectionId = 'test-collection';
|
|
145
144
|
await host1.updateLocalCollectionState(collectionId, documentIds);
|
|
@@ -164,7 +163,6 @@ describe('AutomergeHost', () => {
|
|
|
164
163
|
const setupAutomergeHost = async ({ level }: { level: LevelDB }) => {
|
|
165
164
|
const host = new AutomergeHost({
|
|
166
165
|
db: level,
|
|
167
|
-
indexMetadataStore: new IndexMetadataStore({ db: level.sublevel('index-metadata') }),
|
|
168
166
|
});
|
|
169
167
|
await host.open();
|
|
170
168
|
onTestFinished(async () => {
|
|
@@ -30,12 +30,10 @@ import type * as Record from 'effect/Record';
|
|
|
30
30
|
import { DeferredTask, Event, asyncTimeout } from '@dxos/async';
|
|
31
31
|
import { Context, type Lifecycle, Resource, cancelWithContext } from '@dxos/context';
|
|
32
32
|
import { type CollectionId, DatabaseDirectory } from '@dxos/echo-protocol';
|
|
33
|
-
import { type IndexMetadataStore } from '@dxos/indexing';
|
|
34
33
|
import { invariant } from '@dxos/invariant';
|
|
35
34
|
import { PublicKey } from '@dxos/keys';
|
|
36
35
|
import { type LevelDB } from '@dxos/kv-store';
|
|
37
36
|
import { log } from '@dxos/log';
|
|
38
|
-
import { objectPointerCodec } from '@dxos/protocols';
|
|
39
37
|
import { type SpaceSyncState } from '@dxos/protocols/proto/dxos/echo/service';
|
|
40
38
|
import { type DocHeadsList, type FlushRequest } from '@dxos/protocols/proto/dxos/echo/service';
|
|
41
39
|
import { trace } from '@dxos/tracing';
|
|
@@ -44,7 +42,7 @@ import { ComplexSet, bufferToArray, defaultMap, isNonNullable, range } from '@dx
|
|
|
44
42
|
import { type CollectionState, CollectionSynchronizer, diffCollectionState } from './collection-synchronizer';
|
|
45
43
|
import { type EchoDataMonitor } from './echo-data-monitor';
|
|
46
44
|
import { EchoNetworkAdapter, isEchoPeerMetadata } from './echo-network-adapter';
|
|
47
|
-
import { type
|
|
45
|
+
import { type AutomergeReplicator, type RemoteDocumentExistenceCheckProps } from './echo-replicator';
|
|
48
46
|
import { HeadsStore } from './heads-store';
|
|
49
47
|
import { type BeforeSaveProps, LevelDBStorageAdapter } from './leveldb-storage-adapter';
|
|
50
48
|
|
|
@@ -54,7 +52,6 @@ export type RootDocumentSpaceKeyProvider = (documentId: string) => PublicKey | u
|
|
|
54
52
|
|
|
55
53
|
export type AutomergeHostProps = {
|
|
56
54
|
db: LevelDB;
|
|
57
|
-
indexMetadataStore: IndexMetadataStore;
|
|
58
55
|
dataMonitor?: EchoDataMonitor;
|
|
59
56
|
|
|
60
57
|
/**
|
|
@@ -111,7 +108,6 @@ const OPTIMIZED_SHARE_POLICY = true;
|
|
|
111
108
|
@trace.resource()
|
|
112
109
|
export class AutomergeHost extends Resource {
|
|
113
110
|
private readonly _db: LevelDB;
|
|
114
|
-
private readonly _indexMetadataStore: IndexMetadataStore;
|
|
115
111
|
private readonly _echoNetworkAdapter: EchoNetworkAdapter;
|
|
116
112
|
|
|
117
113
|
private readonly _collectionSynchronizer = new CollectionSynchronizer({
|
|
@@ -170,13 +166,7 @@ export class AutomergeHost extends Resource {
|
|
|
170
166
|
|
|
171
167
|
private _sharePolicyChangedTask?: DeferredTask;
|
|
172
168
|
|
|
173
|
-
constructor({
|
|
174
|
-
db,
|
|
175
|
-
indexMetadataStore,
|
|
176
|
-
dataMonitor,
|
|
177
|
-
peerIdProvider,
|
|
178
|
-
getSpaceKeyByRootDocumentId,
|
|
179
|
-
}: AutomergeHostProps) {
|
|
169
|
+
constructor({ db, dataMonitor, peerIdProvider, getSpaceKeyByRootDocumentId }: AutomergeHostProps) {
|
|
180
170
|
super();
|
|
181
171
|
this._db = db;
|
|
182
172
|
this._storage = new LevelDBStorageAdapter({
|
|
@@ -199,12 +189,11 @@ export class AutomergeHost extends Resource {
|
|
|
199
189
|
this._sharePolicyChangedTask!.schedule();
|
|
200
190
|
});
|
|
201
191
|
this._headsStore = new HeadsStore({ db: db.sublevel('heads') });
|
|
202
|
-
this._indexMetadataStore = indexMetadataStore;
|
|
203
192
|
this._peerIdProvider = peerIdProvider;
|
|
204
193
|
this._getSpaceKeyByRootDocumentId = getSpaceKeyByRootDocumentId;
|
|
205
194
|
}
|
|
206
195
|
|
|
207
|
-
protected override async _open(): Promise<void> {
|
|
196
|
+
protected override async _open(ctx: Context): Promise<void> {
|
|
208
197
|
this._peerId = `host-${this._peerIdProvider?.() ?? PublicKey.random().toHex()}` as PeerId;
|
|
209
198
|
|
|
210
199
|
this._onHeadsChangedTask = new DeferredTask(this._ctx, async () => {
|
|
@@ -258,7 +247,7 @@ export class AutomergeHost extends Resource {
|
|
|
258
247
|
await Promise.all(
|
|
259
248
|
collectionToSync.map(async ({ collectionId, peerId }) => {
|
|
260
249
|
try {
|
|
261
|
-
await this._handleCollectionSync(collectionId, peerId);
|
|
250
|
+
await this._handleCollectionSync(this._ctx, collectionId, peerId);
|
|
262
251
|
} catch (err) {
|
|
263
252
|
log.error('failed to sync collection', { collectionId, peerId, err });
|
|
264
253
|
}
|
|
@@ -272,13 +261,13 @@ export class AutomergeHost extends Resource {
|
|
|
272
261
|
});
|
|
273
262
|
|
|
274
263
|
await this._echoNetworkAdapter.open();
|
|
275
|
-
await this._collectionSynchronizer.open();
|
|
264
|
+
await this._collectionSynchronizer.open(ctx);
|
|
276
265
|
await this._echoNetworkAdapter.open();
|
|
277
266
|
await this._echoNetworkAdapter.whenConnected();
|
|
278
267
|
}
|
|
279
268
|
|
|
280
|
-
protected override async _close(): Promise<void> {
|
|
281
|
-
await this._collectionSynchronizer.close();
|
|
269
|
+
protected override async _close(ctx: Context): Promise<void> {
|
|
270
|
+
await this._collectionSynchronizer.close(ctx);
|
|
282
271
|
await this._storage.close?.();
|
|
283
272
|
await this._echoNetworkAdapter.close();
|
|
284
273
|
this._syncTask = undefined;
|
|
@@ -298,12 +287,12 @@ export class AutomergeHost extends Resource {
|
|
|
298
287
|
return this._repo.handles;
|
|
299
288
|
}
|
|
300
289
|
|
|
301
|
-
async addReplicator(replicator:
|
|
290
|
+
async addReplicator(ctx: Context, replicator: AutomergeReplicator): Promise<void> {
|
|
302
291
|
invariant(this.isOpen, 'AutomergeHost is not open');
|
|
303
|
-
await this._echoNetworkAdapter.addReplicator(replicator);
|
|
292
|
+
await this._echoNetworkAdapter.addReplicator(ctx, replicator);
|
|
304
293
|
}
|
|
305
294
|
|
|
306
|
-
async removeReplicator(replicator:
|
|
295
|
+
async removeReplicator(replicator: AutomergeReplicator): Promise<void> {
|
|
307
296
|
invariant(this.isOpen, 'AutomergeHost is not open');
|
|
308
297
|
await this._echoNetworkAdapter.removeReplicator(replicator);
|
|
309
298
|
}
|
|
@@ -349,7 +338,7 @@ export class AutomergeHost extends Resource {
|
|
|
349
338
|
return handle;
|
|
350
339
|
}
|
|
351
340
|
|
|
352
|
-
async exportDoc(
|
|
341
|
+
async exportDoc(id: AnyDocumentId): Promise<Uint8Array> {
|
|
353
342
|
invariant(this.isOpen, 'AutomergeHost is not open');
|
|
354
343
|
const documentId = interpretAsDocumentId(id);
|
|
355
344
|
|
|
@@ -391,7 +380,7 @@ export class AutomergeHost extends Resource {
|
|
|
391
380
|
}
|
|
392
381
|
}
|
|
393
382
|
|
|
394
|
-
async waitUntilHeadsReplicated(heads: DocHeadsList): Promise<void> {
|
|
383
|
+
async waitUntilHeadsReplicated(ctx: Context, heads: DocHeadsList): Promise<void> {
|
|
395
384
|
invariant(this.isOpen, 'AutomergeHost is not open');
|
|
396
385
|
const entries = heads.entries;
|
|
397
386
|
if (!entries?.length) {
|
|
@@ -410,7 +399,7 @@ export class AutomergeHost extends Resource {
|
|
|
410
399
|
if (headsToWait.length > 0) {
|
|
411
400
|
await Promise.all(
|
|
412
401
|
headsToWait.map(async (entry) => {
|
|
413
|
-
const handle = await this.loadDoc<DatabaseDirectory>(
|
|
402
|
+
const handle = await this.loadDoc<DatabaseDirectory>(ctx, entry.documentId as DocumentId);
|
|
414
403
|
await waitForHeads(handle, entry.heads!);
|
|
415
404
|
}),
|
|
416
405
|
);
|
|
@@ -487,14 +476,6 @@ export class AutomergeHost extends Resource {
|
|
|
487
476
|
|
|
488
477
|
const heads = getHeads(doc);
|
|
489
478
|
this._headsStore.setHeads(handle.documentId, heads, batch);
|
|
490
|
-
|
|
491
|
-
const spaceKey = DatabaseDirectory.getSpaceKey(doc) ?? undefined;
|
|
492
|
-
const objectIds = Object.keys(doc.objects ?? {});
|
|
493
|
-
const encodedIds = objectIds.map((objectId) =>
|
|
494
|
-
objectPointerCodec.encode({ documentId: handle.documentId, objectId, spaceKey }),
|
|
495
|
-
);
|
|
496
|
-
const idToLastHash = new Map(encodedIds.map((id) => [id, heads]));
|
|
497
|
-
this._indexMetadataStore.markDirty(idToLastHash, batch);
|
|
498
479
|
}
|
|
499
480
|
|
|
500
481
|
private _shouldSyncCollection(collectionId: string, peerId: PeerId): boolean {
|
|
@@ -514,7 +495,6 @@ export class AutomergeHost extends Resource {
|
|
|
514
495
|
return undefined;
|
|
515
496
|
}
|
|
516
497
|
|
|
517
|
-
this._indexMetadataStore.notifyMarkedDirty();
|
|
518
498
|
const documentId = path[0] as DocumentId;
|
|
519
499
|
const handle = this._repo.handles[documentId];
|
|
520
500
|
if (!handle || !handle.isReady()) {
|
|
@@ -576,7 +556,7 @@ export class AutomergeHost extends Resource {
|
|
|
576
556
|
* Flush documents to disk.
|
|
577
557
|
*/
|
|
578
558
|
@trace.span({ showInBrowserTimeline: true })
|
|
579
|
-
async flush({ documentIds }: FlushRequest = {}): Promise<void> {
|
|
559
|
+
async flush(ctx: Context, { documentIds }: FlushRequest = {}): Promise<void> {
|
|
580
560
|
// Note: Sync protocol for client and services ensures that all handles should have all changes.
|
|
581
561
|
|
|
582
562
|
const loadedDocuments = (documentIds ?? Object.keys(this._repo.handles)).filter(
|
|
@@ -722,7 +702,7 @@ export class AutomergeHost extends Resource {
|
|
|
722
702
|
this._syncTask?.schedule();
|
|
723
703
|
}
|
|
724
704
|
|
|
725
|
-
private async _handleCollectionSync(collectionId: string, peerId: PeerId) {
|
|
705
|
+
private async _handleCollectionSync(ctx: Context, collectionId: string, peerId: PeerId) {
|
|
726
706
|
const localState = this._collectionSynchronizer.getLocalCollectionState(collectionId);
|
|
727
707
|
const remoteState = this._collectionSynchronizer.getRemoteCollectionStates(collectionId).get(peerId);
|
|
728
708
|
|
|
@@ -740,7 +720,7 @@ export class AutomergeHost extends Resource {
|
|
|
740
720
|
const bundleSyncEnabled = this._echoNetworkAdapter.bundleSyncEnabledForPeer(peerId);
|
|
741
721
|
if (bundleSyncEnabled && missingOnRemote.length >= BUNDLE_SYNC_THRESHOLD) {
|
|
742
722
|
log('pushing bundle', { amount: missingOnRemote.length });
|
|
743
|
-
const { syncInteractively } = await this._pushInBundles(peerId, missingOnRemote);
|
|
723
|
+
const { syncInteractively } = await this._pushInBundles(ctx, peerId, missingOnRemote);
|
|
744
724
|
toReplicateWithoutBatching.push(...syncInteractively);
|
|
745
725
|
} else {
|
|
746
726
|
log.verbose('failed to push bundle, replicating interactively', {
|
|
@@ -752,7 +732,7 @@ export class AutomergeHost extends Resource {
|
|
|
752
732
|
}
|
|
753
733
|
if (bundleSyncEnabled && missingOnLocal.length >= BUNDLE_SYNC_THRESHOLD) {
|
|
754
734
|
log('pulling bundle', { amount: missingOnLocal.length });
|
|
755
|
-
const { syncInteractively } = await this._pullInBundles(peerId, missingOnLocal);
|
|
735
|
+
const { syncInteractively } = await this._pullInBundles(ctx, peerId, missingOnLocal);
|
|
756
736
|
toReplicateWithoutBatching.push(...syncInteractively);
|
|
757
737
|
} else {
|
|
758
738
|
log.verbose('failed to pull bundle, replicating interactively', {
|
|
@@ -785,6 +765,7 @@ export class AutomergeHost extends Resource {
|
|
|
785
765
|
|
|
786
766
|
// TODO(mykola): Add retries of batches https://gist.github.com/mykola-vrmchk/fde270259e9209fcbf1331e5abbf12cf
|
|
787
767
|
private async _pushInBundles(
|
|
768
|
+
ctx: Context,
|
|
788
769
|
peerId: PeerId,
|
|
789
770
|
documentIds: DocumentId[],
|
|
790
771
|
): Promise<{ syncInteractively: DocumentId[] }> {
|
|
@@ -799,7 +780,7 @@ export class AutomergeHost extends Resource {
|
|
|
799
780
|
if (bundle.length === 0) {
|
|
800
781
|
return;
|
|
801
782
|
}
|
|
802
|
-
await this._pushBundle(peerId, bundle).catch((err) => {
|
|
783
|
+
await this._pushBundle(ctx, peerId, bundle).catch((err) => {
|
|
803
784
|
log.warn('failed to push bundle, replicating interactively', { peerId, bundle, err });
|
|
804
785
|
syncInteractively.push(...bundle);
|
|
805
786
|
});
|
|
@@ -810,7 +791,7 @@ export class AutomergeHost extends Resource {
|
|
|
810
791
|
return { syncInteractively };
|
|
811
792
|
}
|
|
812
793
|
|
|
813
|
-
private async _pushBundle(peerId: PeerId, documentIds: DocumentId[]): Promise<void> {
|
|
794
|
+
private async _pushBundle(ctx: Context, peerId: PeerId, documentIds: DocumentId[]): Promise<void> {
|
|
814
795
|
if (this._ctx.disposed) {
|
|
815
796
|
return;
|
|
816
797
|
}
|
|
@@ -833,10 +814,11 @@ export class AutomergeHost extends Resource {
|
|
|
833
814
|
};
|
|
834
815
|
});
|
|
835
816
|
|
|
836
|
-
await this._echoNetworkAdapter.pushBundle(peerId, docs.filter(isNonNullable));
|
|
817
|
+
await this._echoNetworkAdapter.pushBundle(ctx, peerId, docs.filter(isNonNullable));
|
|
837
818
|
}
|
|
838
819
|
|
|
839
820
|
private async _pullInBundles(
|
|
821
|
+
ctx: Context,
|
|
840
822
|
peerId: PeerId,
|
|
841
823
|
documentIds: DocumentId[],
|
|
842
824
|
): Promise<{ syncInteractively: DocumentId[] }> {
|
|
@@ -852,7 +834,7 @@ export class AutomergeHost extends Resource {
|
|
|
852
834
|
if (bundle.length === 0) {
|
|
853
835
|
return;
|
|
854
836
|
}
|
|
855
|
-
const result = await this._pullBundle(peerId, bundle).catch((err) => {
|
|
837
|
+
const result = await this._pullBundle(ctx, peerId, bundle).catch((err) => {
|
|
856
838
|
log.warn('failed to pull bundle, replicating interactively', { peerId, bundle, err });
|
|
857
839
|
syncInteractively.push(...bundle);
|
|
858
840
|
});
|
|
@@ -872,6 +854,7 @@ export class AutomergeHost extends Resource {
|
|
|
872
854
|
}
|
|
873
855
|
|
|
874
856
|
private async _pullBundle(
|
|
857
|
+
ctx: Context,
|
|
875
858
|
peerId: PeerId,
|
|
876
859
|
documentIds: DocumentId[],
|
|
877
860
|
): Promise<{ docsToImport: Record<DocumentId, Uint8Array> } | undefined> {
|
|
@@ -880,7 +863,7 @@ export class AutomergeHost extends Resource {
|
|
|
880
863
|
}
|
|
881
864
|
// NOTE: We are expecting that documents that are being pulled are not present locally, so we are pulling all changes.
|
|
882
865
|
const docHeads = Object.fromEntries(documentIds.map((documentId) => [documentId, []]));
|
|
883
|
-
const bundle = await this._echoNetworkAdapter.pullBundle(peerId, docHeads);
|
|
866
|
+
const bundle = await this._echoNetworkAdapter.pullBundle(ctx, peerId, docHeads);
|
|
884
867
|
return { docsToImport: bundle };
|
|
885
868
|
}
|
|
886
869
|
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
import { describe, expect, onTestFinished, test } from 'vitest';
|
|
31
31
|
|
|
32
32
|
import { asyncTimeout, sleep } from '@dxos/async';
|
|
33
|
+
import { Context } from '@dxos/context';
|
|
33
34
|
import { randomBytes } from '@dxos/crypto';
|
|
34
35
|
import { PublicKey } from '@dxos/keys';
|
|
35
36
|
import { createTestLevel } from '@dxos/kv-store/testing';
|
|
@@ -961,7 +962,7 @@ const createTeleportTestPeer = async (
|
|
|
961
962
|
});
|
|
962
963
|
await echoAdapter.open();
|
|
963
964
|
await echoAdapter.whenConnected();
|
|
964
|
-
await echoAdapter.addReplicator(meshAdapter);
|
|
965
|
+
await echoAdapter.addReplicator(Context.default(), meshAdapter);
|
|
965
966
|
const [teleport] = teleportBuilder.createPeers({ factory: () => new TeleportPeer() });
|
|
966
967
|
return { repo, meshAdapter, teleport };
|
|
967
968
|
};
|
|
@@ -6,6 +6,7 @@ import { type PeerId, cbor } from '@automerge/automerge-repo';
|
|
|
6
6
|
import { describe, expect, onTestFinished, test } from 'vitest';
|
|
7
7
|
|
|
8
8
|
import { Trigger, sleep, waitForCondition } from '@dxos/async';
|
|
9
|
+
import { Context } from '@dxos/context';
|
|
9
10
|
import { invariant } from '@dxos/invariant';
|
|
10
11
|
import { PublicKey } from '@dxos/keys';
|
|
11
12
|
import { type SyncMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/automerge';
|
|
@@ -113,7 +114,7 @@ describe('EchoNetworkAdapter', () => {
|
|
|
113
114
|
onTestFinished(async () => {
|
|
114
115
|
await adapter.close();
|
|
115
116
|
});
|
|
116
|
-
await adapter.addReplicator(replicator);
|
|
117
|
+
await adapter.addReplicator(Context.default(), replicator);
|
|
117
118
|
return adapter;
|
|
118
119
|
};
|
|
119
120
|
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@automerge/automerge-repo';
|
|
13
13
|
|
|
14
14
|
import { Event, Trigger, synchronized } from '@dxos/async';
|
|
15
|
-
import { LifecycleState } from '@dxos/context';
|
|
15
|
+
import { type Context, LifecycleState } from '@dxos/context';
|
|
16
16
|
import { invariant } from '@dxos/invariant';
|
|
17
17
|
import { type PublicKey } from '@dxos/keys';
|
|
18
18
|
import { log } from '@dxos/log';
|
|
@@ -22,9 +22,9 @@ import { isNonNullable } from '@dxos/util';
|
|
|
22
22
|
import { createIdFromSpaceKey } from '../common/space-id';
|
|
23
23
|
|
|
24
24
|
import {
|
|
25
|
-
type
|
|
25
|
+
type AutomergeReplicator,
|
|
26
|
+
type AutomergeReplicatorConnection,
|
|
26
27
|
type RemoteDocumentExistenceCheckProps,
|
|
27
|
-
type ReplicatorConnection,
|
|
28
28
|
type ShouldAdvertiseProps,
|
|
29
29
|
type ShouldSyncCollectionProps,
|
|
30
30
|
} from './echo-replicator';
|
|
@@ -53,17 +53,17 @@ export type EchoNetworkAdapterProps = {
|
|
|
53
53
|
|
|
54
54
|
type ConnectionEntry = {
|
|
55
55
|
isOpen: boolean;
|
|
56
|
-
connection:
|
|
56
|
+
connection: AutomergeReplicatorConnection;
|
|
57
57
|
reader: ReadableStreamDefaultReader<AutomergeProtocolMessage>;
|
|
58
58
|
writer: WritableStreamDefaultWriter<AutomergeProtocolMessage>;
|
|
59
59
|
requestedDocuments: Set<DocumentId>;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* Manages a set of {@link
|
|
63
|
+
* Manages a set of {@link AutomergeReplicator} instances.
|
|
64
64
|
*/
|
|
65
65
|
export class EchoNetworkAdapter extends NetworkAdapter {
|
|
66
|
-
private readonly _replicators = new Set<
|
|
66
|
+
private readonly _replicators = new Set<AutomergeReplicator>();
|
|
67
67
|
/**
|
|
68
68
|
* Remote peer id -> connection.
|
|
69
69
|
*/
|
|
@@ -136,13 +136,13 @@ export class EchoNetworkAdapter extends NetworkAdapter {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
@synchronized
|
|
139
|
-
async addReplicator(replicator:
|
|
139
|
+
async addReplicator(ctx: Context, replicator: AutomergeReplicator): Promise<void> {
|
|
140
140
|
invariant(this._lifecycleState === LifecycleState.OPEN);
|
|
141
141
|
invariant(this.peerId);
|
|
142
142
|
invariant(!this._replicators.has(replicator));
|
|
143
143
|
|
|
144
144
|
this._replicators.add(replicator);
|
|
145
|
-
await replicator.connect({
|
|
145
|
+
await replicator.connect(ctx, {
|
|
146
146
|
peerId: this.peerId,
|
|
147
147
|
onConnectionOpen: this._onConnectionOpen.bind(this),
|
|
148
148
|
onConnectionClosed: this._onConnectionClosed.bind(this),
|
|
@@ -157,7 +157,7 @@ export class EchoNetworkAdapter extends NetworkAdapter {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
@synchronized
|
|
160
|
-
async removeReplicator(replicator:
|
|
160
|
+
async removeReplicator(replicator: AutomergeReplicator): Promise<void> {
|
|
161
161
|
invariant(this._lifecycleState === LifecycleState.OPEN);
|
|
162
162
|
invariant(this._replicators.has(replicator));
|
|
163
163
|
await replicator.disconnect();
|
|
@@ -222,20 +222,20 @@ export class EchoNetworkAdapter extends NetworkAdapter {
|
|
|
222
222
|
return connection.connection.bundleSyncEnabled;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
async pushBundle(peerId: PeerId, bundle: { documentId: DocumentId; data: Uint8Array; heads: Heads }[]) {
|
|
225
|
+
async pushBundle(ctx: Context, peerId: PeerId, bundle: { documentId: DocumentId; data: Uint8Array; heads: Heads }[]) {
|
|
226
226
|
const connection = this._connections.get(peerId);
|
|
227
227
|
if (!connection) {
|
|
228
228
|
throw new Error('Connection not found.');
|
|
229
229
|
}
|
|
230
|
-
return connection.connection.pushBundle!(bundle);
|
|
230
|
+
return connection.connection.pushBundle!(ctx, bundle);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
async pullBundle(peerId: PeerId, docHeads: Record<DocumentId, Heads>) {
|
|
233
|
+
async pullBundle(ctx: Context, peerId: PeerId, docHeads: Record<DocumentId, Heads>) {
|
|
234
234
|
const connection = this._connections.get(peerId);
|
|
235
235
|
if (!connection) {
|
|
236
236
|
throw new Error('Connection not found.');
|
|
237
237
|
}
|
|
238
|
-
return connection.connection.pullBundle!(docHeads);
|
|
238
|
+
return connection.connection.pullBundle!(ctx, docHeads);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
private _send(message: Message): void {
|
|
@@ -260,7 +260,7 @@ export class EchoNetworkAdapter extends NetworkAdapter {
|
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
private _onConnectionOpen(connection:
|
|
263
|
+
private _onConnectionOpen(connection: AutomergeReplicatorConnection): void {
|
|
264
264
|
log('connection opened', { peerId: connection.peerId });
|
|
265
265
|
invariant(!this._connections.has(connection.peerId as PeerId));
|
|
266
266
|
const connectionEntry: ConnectionEntry = {
|
|
@@ -316,7 +316,7 @@ export class EchoNetworkAdapter extends NetworkAdapter {
|
|
|
316
316
|
this._params.monitor?.recordMessageReceived(message);
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
private _onConnectionClosed(connection:
|
|
319
|
+
private _onConnectionClosed(connection: AutomergeReplicatorConnection): void {
|
|
320
320
|
log('connection closed', { peerId: connection.peerId });
|
|
321
321
|
const entry = this._connections.get(connection.peerId as PeerId);
|
|
322
322
|
invariant(entry);
|
|
@@ -335,7 +335,7 @@ export class EchoNetworkAdapter extends NetworkAdapter {
|
|
|
335
335
|
* Trigger doc-synchronizer shared documents set recalculation. Happens on peer-candidate.
|
|
336
336
|
* TODO(y): replace with a proper API call when sharePolicy update becomes supported by automerge-repo
|
|
337
337
|
*/
|
|
338
|
-
private _onConnectionAuthScopeChanged(connection:
|
|
338
|
+
private _onConnectionAuthScopeChanged(connection: AutomergeReplicatorConnection): void {
|
|
339
339
|
log('Connection auth scope changed', { peerId: connection.peerId });
|
|
340
340
|
const entry = this._connections.get(connection.peerId as PeerId);
|
|
341
341
|
invariant(entry);
|
|
@@ -343,7 +343,7 @@ export class EchoNetworkAdapter extends NetworkAdapter {
|
|
|
343
343
|
this._emitPeerCandidate(connection);
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
private _emitPeerCandidate(connection:
|
|
346
|
+
private _emitPeerCandidate(connection: AutomergeReplicatorConnection): void {
|
|
347
347
|
this.emit('peer-candidate', {
|
|
348
348
|
peerId: connection.peerId as PeerId,
|
|
349
349
|
peerMetadata: createEchoPeerMetadata(),
|