@dxos/echo-pipeline 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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-XGG76KKU.mjs → neutral/chunk-VIHYDCCC.mjs} +404 -963
- package/dist/lib/neutral/chunk-VIHYDCCC.mjs.map +7 -0
- package/dist/lib/{browser/chunk-BVR7OOZK.mjs → neutral/chunk-YBC6ONBZ.mjs} +23 -27
- package/dist/lib/neutral/chunk-YBC6ONBZ.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/filter/index.mjs +1 -2
- package/dist/lib/{browser → neutral}/index.mjs +3143 -2206
- 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 +103 -395
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/types/src/automerge/automerge-host.d.ts +43 -23
- package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts +1 -1
- package/dist/types/src/automerge/automerge-repo.test.d.ts.map +1 -1
- package/dist/types/src/automerge/collection-synchronizer.d.ts +5 -3
- package/dist/types/src/automerge/collection-synchronizer.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-data-monitor.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-network-adapter.d.ts +17 -11
- package/dist/types/src/automerge/echo-network-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/echo-replicator.d.ts +20 -16
- package/dist/types/src/automerge/echo-replicator.d.ts.map +1 -1
- package/dist/types/src/automerge/heads-store.d.ts +9 -2
- package/dist/types/src/automerge/heads-store.d.ts.map +1 -1
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts +4 -4
- package/dist/types/src/automerge/leveldb-storage-adapter.d.ts.map +1 -1
- package/dist/types/src/automerge/mesh-echo-replicator-connection.d.ts +8 -8
- 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/automerge/network-protocol.d.ts.map +1 -1
- package/dist/types/src/automerge/space-collection.d.ts.map +1 -1
- package/dist/types/src/common/feeds.d.ts.map +1 -1
- package/dist/types/src/common/space-id.d.ts.map +1 -1
- package/dist/types/src/db-host/automerge-data-source.d.ts +35 -0
- package/dist/types/src/db-host/automerge-data-source.d.ts.map +1 -0
- package/dist/types/src/db-host/automerge-data-source.test.d.ts +2 -0
- package/dist/types/src/db-host/automerge-data-source.test.d.ts.map +1 -0
- package/dist/types/src/db-host/automerge-metrics.d.ts.map +1 -1
- package/dist/types/src/db-host/data-service.d.ts +7 -6
- package/dist/types/src/db-host/data-service.d.ts.map +1 -1
- package/dist/types/src/db-host/database-root.d.ts.map +1 -1
- package/dist/types/src/db-host/documents-synchronizer.d.ts +8 -7
- package/dist/types/src/db-host/documents-synchronizer.d.ts.map +1 -1
- package/dist/types/src/db-host/echo-host.d.ts +58 -28
- package/dist/types/src/db-host/echo-host.d.ts.map +1 -1
- package/dist/types/src/db-host/index.d.ts +2 -0
- package/dist/types/src/db-host/index.d.ts.map +1 -1
- package/dist/types/src/db-host/invalidation-hint.d.ts +19 -0
- package/dist/types/src/db-host/invalidation-hint.d.ts.map +1 -0
- package/dist/types/src/db-host/local-queue-service.d.ts +19 -0
- package/dist/types/src/db-host/local-queue-service.d.ts.map +1 -0
- package/dist/types/src/db-host/query-invalidation.test.d.ts +2 -0
- package/dist/types/src/db-host/query-invalidation.test.d.ts.map +1 -0
- package/dist/types/src/db-host/query-service.d.ts +18 -10
- package/dist/types/src/db-host/query-service.d.ts.map +1 -1
- package/dist/types/src/db-host/queue-data-source.d.ts +38 -0
- package/dist/types/src/db-host/queue-data-source.d.ts.map +1 -0
- package/dist/types/src/db-host/queue-service.test.d.ts +2 -0
- package/dist/types/src/db-host/queue-service.test.d.ts.map +1 -0
- package/dist/types/src/db-host/space-state-manager.d.ts +1 -0
- package/dist/types/src/db-host/space-state-manager.d.ts.map +1 -1
- package/dist/types/src/db-host/stub.d.ts +11 -0
- package/dist/types/src/db-host/stub.d.ts.map +1 -0
- package/dist/types/src/edge/echo-edge-replicator.d.ts +7 -6
- package/dist/types/src/edge/echo-edge-replicator.d.ts.map +1 -1
- package/dist/types/src/edge/inflight-request-limiter.d.ts.map +1 -1
- package/dist/types/src/filter/filter-match.d.ts +2 -2
- package/dist/types/src/filter/filter-match.d.ts.map +1 -1
- package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
- package/dist/types/src/pipeline/message-selector.d.ts.map +1 -1
- package/dist/types/src/pipeline/pipeline.d.ts +2 -2
- package/dist/types/src/pipeline/pipeline.d.ts.map +1 -1
- package/dist/types/src/pipeline/timeframe-clock.d.ts.map +1 -1
- package/dist/types/src/query/errors.d.ts +16 -20
- package/dist/types/src/query/errors.d.ts.map +1 -1
- package/dist/types/src/query/plan.d.ts +59 -8
- package/dist/types/src/query/plan.d.ts.map +1 -1
- package/dist/types/src/query/query-executor.d.ts +62 -10
- package/dist/types/src/query/query-executor.d.ts.map +1 -1
- package/dist/types/src/query/query-planner.d.ts +10 -1
- package/dist/types/src/query/query-planner.d.ts.map +1 -1
- package/dist/types/src/space/admission-discovery-extension.d.ts.map +1 -1
- package/dist/types/src/space/auth.d.ts +3 -3
- package/dist/types/src/space/auth.d.ts.map +1 -1
- package/dist/types/src/space/control-pipeline.d.ts +4 -3
- package/dist/types/src/space/control-pipeline.d.ts.map +1 -1
- package/dist/types/src/space/space-manager.d.ts +7 -7
- package/dist/types/src/space/space-manager.d.ts.map +1 -1
- package/dist/types/src/space/space-protocol.d.ts +9 -8
- package/dist/types/src/space/space-protocol.d.ts.map +1 -1
- package/dist/types/src/space/space.d.ts +5 -5
- package/dist/types/src/space/space.d.ts.map +1 -1
- package/dist/types/src/testing/change-metadata.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -2
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/test-agent-builder.d.ts.map +1 -1
- package/dist/types/src/testing/test-feed-builder.d.ts.map +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts +1 -1
- package/dist/types/src/testing/test-network-adapter.d.ts.map +1 -1
- package/dist/types/src/testing/test-replicator.d.ts +13 -13
- package/dist/types/src/testing/test-replicator.d.ts.map +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -54
- package/src/automerge/automerge-host.test.ts +42 -23
- package/src/automerge/automerge-host.ts +163 -88
- package/src/automerge/automerge-repo.test.ts +149 -32
- package/src/automerge/collection-synchronizer.test.ts +19 -13
- package/src/automerge/collection-synchronizer.ts +69 -28
- package/src/automerge/echo-network-adapter.test.ts +2 -1
- package/src/automerge/echo-network-adapter.ts +40 -29
- package/src/automerge/echo-replicator.ts +21 -16
- package/src/automerge/heads-store.ts +42 -3
- package/src/automerge/leveldb-storage-adapter.ts +4 -4
- package/src/automerge/mesh-echo-replicator-connection.ts +8 -8
- package/src/automerge/mesh-echo-replicator.ts +14 -11
- package/src/db-host/automerge-data-source.test.ts +299 -0
- package/src/db-host/automerge-data-source.ts +186 -0
- package/src/db-host/data-service.ts +17 -10
- package/src/db-host/documents-synchronizer.test.ts +143 -14
- package/src/db-host/documents-synchronizer.ts +54 -51
- package/src/db-host/echo-host.ts +321 -86
- package/src/db-host/index.ts +2 -0
- package/src/db-host/invalidation-hint.ts +50 -0
- package/src/db-host/local-queue-service.ts +127 -0
- package/src/db-host/query-invalidation.test.ts +270 -0
- package/src/db-host/query-service.ts +110 -112
- package/src/db-host/queue-data-source.ts +159 -0
- package/src/db-host/queue-service.test.ts +145 -0
- package/src/db-host/space-state-manager.ts +5 -1
- package/src/db-host/stub.ts +33 -0
- package/src/edge/echo-edge-replicator.test.ts +9 -9
- package/src/edge/echo-edge-replicator.ts +76 -47
- package/src/filter/filter-match.test.ts +41 -25
- package/src/filter/filter-match.ts +33 -36
- package/src/metadata/metadata-store.ts +8 -5
- package/src/pipeline/pipeline-stress.test.ts +1 -3
- package/src/pipeline/pipeline.test.ts +0 -1
- package/src/pipeline/pipeline.ts +2 -3
- package/src/query/errors.ts +2 -2
- package/src/query/plan.ts +71 -8
- package/src/query/query-executor.ts +1170 -197
- package/src/query/query-planner.test.ts +854 -86
- package/src/query/query-planner.ts +408 -38
- package/src/space/admission-discovery-extension.ts +1 -1
- package/src/space/auth.ts +6 -6
- package/src/space/control-pipeline.test.ts +2 -2
- package/src/space/control-pipeline.ts +7 -7
- package/src/space/space-manager.ts +12 -17
- package/src/space/space-protocol.browser.test.ts +13 -12
- package/src/space/space-protocol.test.ts +13 -13
- package/src/space/space-protocol.ts +16 -15
- package/src/space/space.test.ts +2 -2
- package/src/space/space.ts +9 -10
- package/src/testing/index.ts +0 -2
- package/src/testing/test-agent-builder.ts +0 -1
- package/src/testing/test-network-adapter.ts +16 -3
- package/src/testing/test-replicator.ts +19 -18
- package/src/util.ts +7 -3
- package/dist/lib/browser/chunk-BVR7OOZK.mjs.map +0 -7
- package/dist/lib/browser/chunk-CGS2ULMK.mjs +0 -11
- package/dist/lib/browser/chunk-CGS2ULMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-XGG76KKU.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CHMJJ4DG.mjs +0 -2230
- package/dist/lib/node-esm/chunk-CHMJJ4DG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-L3ZEKVDR.mjs +0 -251
- package/dist/lib/node-esm/chunk-L3ZEKVDR.mjs.map +0 -7
- package/dist/lib/node-esm/filter/index.mjs +0 -13
- package/dist/lib/node-esm/filter/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -5560
- 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 -805
- 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/dist/types/src/testing/test-data.d.ts +0 -18
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/dist/types/src/testing/test-schema.d.ts +0 -37
- package/dist/types/src/testing/test-schema.d.ts.map +0 -1
- package/src/db-host/documents-iterator.ts +0 -74
- package/src/testing/test-data.ts +0 -127
- package/src/testing/test-schema.ts +0 -53
- /package/dist/lib/{browser → neutral}/filter/index.mjs.map +0 -0
|
@@ -7,6 +7,7 @@ import { getRandomPort } from 'get-port-please';
|
|
|
7
7
|
import { describe, expect, onTestFinished, test } from 'vitest';
|
|
8
8
|
|
|
9
9
|
import { Event } from '@dxos/async';
|
|
10
|
+
import { Context } from '@dxos/context';
|
|
10
11
|
import { EdgeClient, type EdgeHttpClient, MessageSchema, createEphemeralEdgeIdentity } from '@dxos/edge-client';
|
|
11
12
|
import { createTestEdgeWsServer } from '@dxos/edge-client/testing';
|
|
12
13
|
import { PublicKey, SpaceId } from '@dxos/keys';
|
|
@@ -16,8 +17,7 @@ import { createBuf } from '@dxos/protocols/buf';
|
|
|
16
17
|
import type { Peer } from '@dxos/protocols/proto/dxos/edge/messenger';
|
|
17
18
|
import { openAndClose } from '@dxos/test-utils';
|
|
18
19
|
|
|
19
|
-
import type {
|
|
20
|
-
|
|
20
|
+
import type { AutomergeReplicatorConnection, AutomergeReplicatorContext } from '../automerge';
|
|
21
21
|
import { EchoEdgeReplicator } from './echo-edge-replicator';
|
|
22
22
|
|
|
23
23
|
describe('EchoEdgeReplicator', () => {
|
|
@@ -28,7 +28,7 @@ describe('EchoEdgeReplicator', () => {
|
|
|
28
28
|
|
|
29
29
|
const { context, connectionOpen } = createMockContext();
|
|
30
30
|
const replicator = await connectReplicator(client, context);
|
|
31
|
-
await replicator.connectToSpace(spaceId);
|
|
31
|
+
await replicator.connectToSpace(Context.default(), spaceId);
|
|
32
32
|
|
|
33
33
|
client.setIdentity(await createEphemeralEdgeIdentity());
|
|
34
34
|
await connectionOpen.waitForCount(1);
|
|
@@ -55,7 +55,7 @@ describe('EchoEdgeReplicator', () => {
|
|
|
55
55
|
documentSpaceId: { [documentId]: spaceId },
|
|
56
56
|
});
|
|
57
57
|
const replicator = await connectReplicator(client, context);
|
|
58
|
-
await replicator.connectToSpace(spaceId);
|
|
58
|
+
await replicator.connectToSpace(Context.default(), spaceId);
|
|
59
59
|
|
|
60
60
|
await expect.poll(() => openConnections.length === 1).toBeTruthy();
|
|
61
61
|
expect(openConnections[0].shouldAdvertise({ documentId })).toBeTruthy();
|
|
@@ -69,7 +69,7 @@ describe('EchoEdgeReplicator', () => {
|
|
|
69
69
|
const remoteCollections: { [peerId: string]: { [documentId: string]: boolean } } = {};
|
|
70
70
|
const { context, openConnections } = createMockContext({ remoteCollections });
|
|
71
71
|
const replicator = await connectReplicator(client, context);
|
|
72
|
-
await replicator.connectToSpace(spaceId);
|
|
72
|
+
await replicator.connectToSpace(Context.default(), spaceId);
|
|
73
73
|
|
|
74
74
|
await expect.poll(() => openConnections.length === 1).toBeTruthy();
|
|
75
75
|
const connection = openConnections[0];
|
|
@@ -79,10 +79,10 @@ describe('EchoEdgeReplicator', () => {
|
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
const connectReplicator = async (client: EdgeClient, context:
|
|
82
|
+
const connectReplicator = async (client: EdgeClient, context: AutomergeReplicatorContext) => {
|
|
83
83
|
// EdgeHttpClient functionality is not tested here.
|
|
84
84
|
const replicator = new EchoEdgeReplicator({ edgeConnection: client, edgeHttpClient: {} as EdgeHttpClient });
|
|
85
|
-
await replicator.connect(context);
|
|
85
|
+
await replicator.connect(Context.default(), context);
|
|
86
86
|
onTestFinished(() => replicator.disconnect());
|
|
87
87
|
return replicator;
|
|
88
88
|
};
|
|
@@ -101,7 +101,7 @@ const createMockContext = (args?: {
|
|
|
101
101
|
documentSpaceId?: { [documentId: string]: SpaceId };
|
|
102
102
|
}) => {
|
|
103
103
|
const connectionOpen = new Event();
|
|
104
|
-
const openConnections:
|
|
104
|
+
const openConnections: AutomergeReplicatorConnection[] = [];
|
|
105
105
|
return {
|
|
106
106
|
context: {
|
|
107
107
|
getContainingSpaceIdForDocument: async (documentId) => args?.documentSpaceId?.[documentId] ?? null,
|
|
@@ -121,7 +121,7 @@ const createMockContext = (args?: {
|
|
|
121
121
|
},
|
|
122
122
|
|
|
123
123
|
peerId: PublicKey.random().toHex(),
|
|
124
|
-
} satisfies
|
|
124
|
+
} satisfies AutomergeReplicatorContext,
|
|
125
125
|
|
|
126
126
|
openConnections,
|
|
127
127
|
connectionOpen,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as A from '@automerge/automerge';
|
|
5
6
|
import { type DocumentId, type Heads, cbor } from '@automerge/automerge-repo';
|
|
6
7
|
|
|
7
8
|
import { Mutex, scheduleMicroTask, scheduleTask } from '@dxos/async';
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
type AutomergeProtocolMessage,
|
|
17
18
|
DocumentCodec,
|
|
18
19
|
EdgeService,
|
|
20
|
+
type ErrorProtocolMessage,
|
|
19
21
|
type ExportBundleRequest,
|
|
20
22
|
type ImportBundleRequest,
|
|
21
23
|
type PeerId,
|
|
@@ -25,17 +27,17 @@ import {
|
|
|
25
27
|
type Message as RouterMessage,
|
|
26
28
|
MessageSchema as RouterMessageSchema,
|
|
27
29
|
} from '@dxos/protocols/buf/dxos/edge/messenger_pb';
|
|
28
|
-
import {
|
|
30
|
+
import { trace } from '@dxos/tracing';
|
|
31
|
+
import { bufferToArray, compositeKey, setDeep } from '@dxos/util';
|
|
29
32
|
|
|
30
33
|
import {
|
|
31
|
-
type
|
|
32
|
-
type
|
|
33
|
-
type
|
|
34
|
-
type
|
|
35
|
-
type
|
|
34
|
+
type AutomergeReplicator,
|
|
35
|
+
type AutomergeReplicatorConnection,
|
|
36
|
+
type AutomergeReplicatorContext,
|
|
37
|
+
type ShouldAdvertiseProps,
|
|
38
|
+
type ShouldSyncCollectionProps,
|
|
36
39
|
getSpaceIdFromCollectionId,
|
|
37
40
|
} from '../automerge';
|
|
38
|
-
|
|
39
41
|
import { InflightRequestLimiter } from './inflight-request-limiter';
|
|
40
42
|
|
|
41
43
|
/**
|
|
@@ -45,33 +47,34 @@ const INITIAL_RESTART_DELAY = 500;
|
|
|
45
47
|
const RESTART_DELAY_JITTER = 250;
|
|
46
48
|
const MAX_RESTART_DELAY = 5000;
|
|
47
49
|
|
|
48
|
-
export type
|
|
50
|
+
export type EchoEdgeReplicatorProps = {
|
|
49
51
|
edgeConnection: EdgeConnection;
|
|
50
52
|
edgeHttpClient: EdgeHttpClient;
|
|
51
53
|
disableSharePolicy?: boolean;
|
|
52
54
|
};
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
@trace.resource()
|
|
57
|
+
export class EchoEdgeReplicator implements AutomergeReplicator {
|
|
55
58
|
private readonly _edgeConnection: EdgeConnection;
|
|
56
59
|
private readonly _edgeHttpClient: EdgeHttpClient;
|
|
57
60
|
private readonly _mutex = new Mutex();
|
|
58
61
|
|
|
59
62
|
private _ctx?: Context = undefined;
|
|
60
|
-
private _context:
|
|
63
|
+
private _context: AutomergeReplicatorContext | null = null;
|
|
61
64
|
private _connectedSpaces = new Set<SpaceId>();
|
|
62
65
|
private _connections = new Map<SpaceId, EdgeReplicatorConnection>();
|
|
63
66
|
private _sharePolicyEnabled = true;
|
|
64
67
|
|
|
65
|
-
constructor({ edgeConnection, edgeHttpClient, disableSharePolicy }:
|
|
68
|
+
constructor({ edgeConnection, edgeHttpClient, disableSharePolicy }: EchoEdgeReplicatorProps) {
|
|
66
69
|
this._edgeConnection = edgeConnection;
|
|
67
70
|
this._edgeHttpClient = edgeHttpClient;
|
|
68
71
|
this._sharePolicyEnabled = !disableSharePolicy;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
|
-
async connect(context:
|
|
74
|
+
async connect(ctx: Context, context: AutomergeReplicatorContext): Promise<void> {
|
|
72
75
|
log('connecting...', { peerId: context.peerId, connectedSpaces: this._connectedSpaces.size });
|
|
73
76
|
this._context = context;
|
|
74
|
-
this._ctx =
|
|
77
|
+
this._ctx = ctx.derive();
|
|
75
78
|
this._ctx.onDispose(
|
|
76
79
|
this._edgeConnection.onReconnected(() => {
|
|
77
80
|
this._ctx && scheduleMicroTask(this._ctx, () => this._handleReconnect());
|
|
@@ -90,7 +93,7 @@ export class EchoEdgeReplicator implements EchoReplicator {
|
|
|
90
93
|
|
|
91
94
|
if (this._context !== null) {
|
|
92
95
|
for (const spaceId of spaces) {
|
|
93
|
-
await this._openConnection(spaceId);
|
|
96
|
+
await this._openConnection(this._ctx!, spaceId);
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
}
|
|
@@ -105,7 +108,9 @@ export class EchoEdgeReplicator implements EchoReplicator {
|
|
|
105
108
|
this._connections.clear();
|
|
106
109
|
}
|
|
107
110
|
|
|
108
|
-
|
|
111
|
+
@trace.span({ showInBrowserTimeline: true, op: 'replication' })
|
|
112
|
+
async connectToSpace(ctx: Context, spaceId: SpaceId): Promise<void> {
|
|
113
|
+
log('connectToSpace', { spaceId });
|
|
109
114
|
using _guard = await this._mutex.acquire();
|
|
110
115
|
|
|
111
116
|
if (this._connectedSpaces.has(spaceId)) {
|
|
@@ -113,9 +118,8 @@ export class EchoEdgeReplicator implements EchoReplicator {
|
|
|
113
118
|
}
|
|
114
119
|
this._connectedSpaces.add(spaceId);
|
|
115
120
|
|
|
116
|
-
// Check if AM-repo requested that we connect to remote peers.
|
|
117
121
|
if (this._context !== null) {
|
|
118
|
-
await this._openConnection(spaceId);
|
|
122
|
+
await this._openConnection(ctx, spaceId);
|
|
119
123
|
}
|
|
120
124
|
}
|
|
121
125
|
|
|
@@ -131,7 +135,8 @@ export class EchoEdgeReplicator implements EchoReplicator {
|
|
|
131
135
|
}
|
|
132
136
|
}
|
|
133
137
|
|
|
134
|
-
|
|
138
|
+
@trace.span({ showInBrowserTimeline: true, op: 'replication' })
|
|
139
|
+
private async _openConnection(ctx: Context, spaceId: SpaceId, reconnects: number = 0): Promise<void> {
|
|
135
140
|
invariant(this._context);
|
|
136
141
|
invariant(!this._connections.has(spaceId));
|
|
137
142
|
|
|
@@ -163,21 +168,21 @@ export class EchoEdgeReplicator implements EchoReplicator {
|
|
|
163
168
|
|
|
164
169
|
restartScheduled = true;
|
|
165
170
|
scheduleTask(
|
|
166
|
-
this._ctx
|
|
171
|
+
this._ctx!,
|
|
167
172
|
async () => {
|
|
168
173
|
using _guard = await this._mutex.acquire();
|
|
169
174
|
if (this._connections.get(spaceId) !== connection) {
|
|
170
175
|
return;
|
|
171
176
|
}
|
|
172
177
|
|
|
173
|
-
const
|
|
174
|
-
await connection.close();
|
|
178
|
+
const replicatorCtx = this._ctx;
|
|
179
|
+
await connection.close();
|
|
175
180
|
this._connections.delete(spaceId);
|
|
176
|
-
if (
|
|
181
|
+
if (replicatorCtx?.disposed) {
|
|
177
182
|
return;
|
|
178
183
|
}
|
|
179
184
|
log.trace('dxos.echo.edge.replicator.restart', { spaceId, reconnects, restartDelay });
|
|
180
|
-
await this._openConnection(spaceId, reconnects + 1);
|
|
185
|
+
await this._openConnection(replicatorCtx!, spaceId, reconnects + 1);
|
|
181
186
|
},
|
|
182
187
|
restartDelay,
|
|
183
188
|
);
|
|
@@ -185,15 +190,15 @@ export class EchoEdgeReplicator implements EchoReplicator {
|
|
|
185
190
|
});
|
|
186
191
|
this._connections.set(spaceId, connection);
|
|
187
192
|
|
|
188
|
-
await connection.open();
|
|
193
|
+
await connection.open(ctx);
|
|
189
194
|
}
|
|
190
195
|
}
|
|
191
196
|
|
|
192
|
-
type
|
|
197
|
+
type EdgeReplicatorConnectionsProps = {
|
|
193
198
|
edgeConnection: EdgeConnection;
|
|
194
199
|
edgeHttpClient: EdgeHttpClient;
|
|
195
200
|
spaceId: SpaceId;
|
|
196
|
-
context:
|
|
201
|
+
context: AutomergeReplicatorContext;
|
|
197
202
|
sharedPolicyEnabled: boolean;
|
|
198
203
|
onRemoteConnected: () => Promise<void>;
|
|
199
204
|
onRemoteDisconnected: () => Promise<void>;
|
|
@@ -203,17 +208,19 @@ type EdgeReplicatorConnectionsParams = {
|
|
|
203
208
|
const MAX_INFLIGHT_REQUESTS = 5;
|
|
204
209
|
const MAX_RATE_LIMIT_WAIT_TIME_MS = 3000;
|
|
205
210
|
|
|
206
|
-
class EdgeReplicatorConnection extends Resource implements
|
|
211
|
+
class EdgeReplicatorConnection extends Resource implements AutomergeReplicatorConnection {
|
|
212
|
+
private readonly _connectionId = randomUUID();
|
|
207
213
|
private readonly _edgeConnection: EdgeConnection;
|
|
208
214
|
private readonly _edgeHttpClient: EdgeHttpClient;
|
|
209
215
|
private readonly _remotePeerId: string | null = null;
|
|
210
216
|
private readonly _targetServiceId: string;
|
|
211
217
|
private readonly _spaceId: SpaceId;
|
|
212
|
-
private readonly _context:
|
|
218
|
+
private readonly _context: AutomergeReplicatorContext;
|
|
213
219
|
private readonly _sharedPolicyEnabled: boolean;
|
|
214
220
|
private readonly _onRemoteConnected: () => Promise<void>;
|
|
215
221
|
private readonly _onRemoteDisconnected: () => Promise<void>;
|
|
216
222
|
private readonly _onRestartRequested: () => void;
|
|
223
|
+
private _sequence = 0;
|
|
217
224
|
|
|
218
225
|
private _requestLimiter = new InflightRequestLimiter({
|
|
219
226
|
maxInflightRequests: MAX_INFLIGHT_REQUESTS,
|
|
@@ -234,7 +241,7 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
234
241
|
onRemoteConnected,
|
|
235
242
|
onRemoteDisconnected,
|
|
236
243
|
onRestartRequested,
|
|
237
|
-
}:
|
|
244
|
+
}: EdgeReplicatorConnectionsProps) {
|
|
238
245
|
super();
|
|
239
246
|
this._edgeConnection = edgeConnection;
|
|
240
247
|
this._edgeHttpClient = edgeHttpClient;
|
|
@@ -244,8 +251,9 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
244
251
|
// This way automerge-repo will have separate sync states for every connection.
|
|
245
252
|
// This is important because the previous connection might have had some messages that failed to deliver
|
|
246
253
|
// abd if we don't clear the sync-state, automerge will not attempt to deliver them again.
|
|
247
|
-
this.
|
|
248
|
-
|
|
254
|
+
this._targetServiceId = compositeKey(EdgeService.AUTOMERGE_REPLICATOR, spaceId);
|
|
255
|
+
// TODO(wittjosiah): Use compositeKey.
|
|
256
|
+
this._remotePeerId = `${this._targetServiceId}-${this._connectionId}`;
|
|
249
257
|
this._sharedPolicyEnabled = sharedPolicyEnabled;
|
|
250
258
|
this._onRemoteConnected = onRemoteConnected;
|
|
251
259
|
this._onRemoteDisconnected = onRemoteDisconnected;
|
|
@@ -261,7 +269,7 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
261
269
|
write: async (message: AutomergeProtocolMessage, controller) => {
|
|
262
270
|
await this._requestLimiter.rateLimit(message);
|
|
263
271
|
|
|
264
|
-
await this._sendMessage(message);
|
|
272
|
+
await this._sendMessage(this._ctx, message);
|
|
265
273
|
},
|
|
266
274
|
});
|
|
267
275
|
}
|
|
@@ -294,7 +302,7 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
294
302
|
await this._onRemoteConnected();
|
|
295
303
|
}
|
|
296
304
|
|
|
297
|
-
protected override async _close(): Promise<void> {
|
|
305
|
+
protected override async _close(ctx: Context): Promise<void> {
|
|
298
306
|
log('closing...');
|
|
299
307
|
this._readableStreamController.close();
|
|
300
308
|
|
|
@@ -308,7 +316,7 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
308
316
|
return this._remotePeerId;
|
|
309
317
|
}
|
|
310
318
|
|
|
311
|
-
async shouldAdvertise(params:
|
|
319
|
+
async shouldAdvertise(params: ShouldAdvertiseProps): Promise<boolean> {
|
|
312
320
|
if (!this._sharedPolicyEnabled) {
|
|
313
321
|
return true;
|
|
314
322
|
}
|
|
@@ -333,7 +341,7 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
333
341
|
return spaceId === this._spaceId;
|
|
334
342
|
}
|
|
335
343
|
|
|
336
|
-
shouldSyncCollection(params:
|
|
344
|
+
shouldSyncCollection(params: ShouldSyncCollectionProps): boolean {
|
|
337
345
|
if (!this._sharedPolicyEnabled) {
|
|
338
346
|
return true;
|
|
339
347
|
}
|
|
@@ -349,8 +357,7 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
349
357
|
|
|
350
358
|
const payload = cbor.decode(message.payload!.value) as AutomergeProtocolMessage;
|
|
351
359
|
log.verbose('received', {
|
|
352
|
-
|
|
353
|
-
documentId: payload.type === 'sync' && payload.documentId,
|
|
360
|
+
...getMessageInfo(payload),
|
|
354
361
|
remoteId: this._remotePeerId,
|
|
355
362
|
});
|
|
356
363
|
|
|
@@ -363,7 +370,7 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
363
370
|
return true;
|
|
364
371
|
}
|
|
365
372
|
|
|
366
|
-
async pushBundle(bundle: { documentId: DocumentId; data: Uint8Array; heads: Heads }[]) {
|
|
373
|
+
async pushBundle(ctx: Context, bundle: { documentId: DocumentId; data: Uint8Array; heads: Heads }[]) {
|
|
367
374
|
const request: ImportBundleRequest = {
|
|
368
375
|
bundle: bundle.map(({ documentId, data, heads }) => ({
|
|
369
376
|
documentId,
|
|
@@ -371,12 +378,12 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
371
378
|
heads,
|
|
372
379
|
})),
|
|
373
380
|
};
|
|
374
|
-
await this._edgeHttpClient.importBundle(this._spaceId, request);
|
|
381
|
+
await this._edgeHttpClient.importBundle(ctx, this._spaceId, request);
|
|
375
382
|
}
|
|
376
383
|
|
|
377
|
-
async pullBundle(docHeads: Record<DocumentId, Heads>): Promise<Record<DocumentId, Uint8Array>> {
|
|
384
|
+
async pullBundle(ctx: Context, docHeads: Record<DocumentId, Heads>): Promise<Record<DocumentId, Uint8Array>> {
|
|
378
385
|
const request: ExportBundleRequest = { docHeads };
|
|
379
|
-
const response = await this._edgeHttpClient.exportBundle(this._spaceId, request);
|
|
386
|
+
const response = await this._edgeHttpClient.exportBundle(ctx, this._spaceId, request);
|
|
380
387
|
return Object.fromEntries(response.bundle.map((doc) => [doc.documentId, DocumentCodec.decode(doc.mutation)]));
|
|
381
388
|
}
|
|
382
389
|
|
|
@@ -384,7 +391,8 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
384
391
|
// There's a race between the credentials being replicated that are needed for access control and the data replication.
|
|
385
392
|
// AutomergeReplicator might return a Forbidden error if the credentials are not yet replicated.
|
|
386
393
|
// We restart the connection with some delay to account for that.
|
|
387
|
-
if (
|
|
394
|
+
if (isErrorMessage(message)) {
|
|
395
|
+
log.verbose('stream error', { error: (message as ErrorProtocolMessage).message });
|
|
388
396
|
this._onRestartRequested();
|
|
389
397
|
return;
|
|
390
398
|
}
|
|
@@ -394,13 +402,16 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
394
402
|
this._readableStreamController.enqueue(message);
|
|
395
403
|
}
|
|
396
404
|
|
|
397
|
-
private async _sendMessage(message: AutomergeProtocolMessage): Promise<void> {
|
|
405
|
+
private async _sendMessage(ctx: Context, message: AutomergeProtocolMessage): Promise<void> {
|
|
398
406
|
// Fix the peer id.
|
|
399
407
|
(message as any).targetId = this._targetServiceId as PeerId;
|
|
400
408
|
|
|
409
|
+
// Note: This is used on EDGE to detect out-of-order messages per connection.
|
|
410
|
+
setDeep(message, ['metadata', 'dxos_sequence'], this._getSequence());
|
|
411
|
+
setDeep(message, ['metadata', 'dxos_connectionId'], this._connectionId);
|
|
412
|
+
|
|
401
413
|
log.verbose('sending...', {
|
|
402
|
-
|
|
403
|
-
documentId: message.type === 'sync' && message.documentId,
|
|
414
|
+
...getMessageInfo(message),
|
|
404
415
|
remoteId: this._remotePeerId,
|
|
405
416
|
});
|
|
406
417
|
|
|
@@ -408,6 +419,7 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
408
419
|
|
|
409
420
|
try {
|
|
410
421
|
await this._edgeConnection.send(
|
|
422
|
+
ctx,
|
|
411
423
|
buf.create(RouterMessageSchema, {
|
|
412
424
|
serviceId: this._targetServiceId,
|
|
413
425
|
source: {
|
|
@@ -421,10 +433,27 @@ class EdgeReplicatorConnection extends Resource implements ReplicatorConnection
|
|
|
421
433
|
log.error('failed to send message', { err });
|
|
422
434
|
}
|
|
423
435
|
}
|
|
436
|
+
|
|
437
|
+
private _getSequence(): number {
|
|
438
|
+
return this._sequence++;
|
|
439
|
+
}
|
|
424
440
|
}
|
|
425
441
|
|
|
426
442
|
/**
|
|
427
443
|
* This message is sent by EDGE AutomergeReplicator when the authorization is denied.
|
|
428
444
|
*/
|
|
429
|
-
const
|
|
430
|
-
|
|
445
|
+
const isErrorMessage = (message: AutomergeProtocolMessage) => message.type === 'error';
|
|
446
|
+
|
|
447
|
+
const getMessageInfo = (msg: AutomergeProtocolMessage) => {
|
|
448
|
+
const { have, heads, need, changes } = msg.type === 'sync' ? A.decodeSyncMessage(msg.data) : {};
|
|
449
|
+
return {
|
|
450
|
+
type: msg.type,
|
|
451
|
+
documentId: 'documentId' in msg ? msg.documentId : undefined,
|
|
452
|
+
collectionId: 'collectionId' in msg ? msg.collectionId : undefined,
|
|
453
|
+
have,
|
|
454
|
+
heads,
|
|
455
|
+
need,
|
|
456
|
+
changes: changes?.length,
|
|
457
|
+
sequence: msg.metadata?.dxos_sequence,
|
|
458
|
+
};
|
|
459
|
+
};
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
|
-
import { Filter } from '@dxos/echo';
|
|
7
|
+
import { Filter, Ref } from '@dxos/echo';
|
|
8
8
|
import { ObjectStructure } from '@dxos/echo-protocol';
|
|
9
|
-
import {
|
|
9
|
+
import { TestSchema } from '@dxos/echo/testing';
|
|
10
10
|
import { DXN, ObjectId, SpaceId } from '@dxos/keys';
|
|
11
11
|
|
|
12
12
|
import { type MatchedObject, filterMatchObject } from './filter-match';
|
|
@@ -23,32 +23,34 @@ describe('filterMatch', () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
test('properties', () => {
|
|
26
|
-
expect(filterMatchObject(Filter.type(Expando, { title: 'test' }).ast, OBJECT_1)).to.be.true;
|
|
27
|
-
expect(filterMatchObject(Filter.type(Expando, { value: 100 }).ast, OBJECT_1)).to.be.true;
|
|
28
|
-
expect(filterMatchObject(Filter.type(Expando, { complete: false }).ast, OBJECT_1)).to.be.false;
|
|
29
|
-
expect(filterMatchObject(Filter.type(Expando, { missing: undefined }).ast, OBJECT_1)).to.be.true;
|
|
30
|
-
expect(filterMatchObject(Filter.type(Expando, { properties: { subject: 'test' } }).ast, OBJECT_1)).to.be
|
|
31
|
-
|
|
26
|
+
expect(filterMatchObject(Filter.type(TestSchema.Expando, { title: 'test' }).ast, OBJECT_1)).to.be.true;
|
|
27
|
+
expect(filterMatchObject(Filter.type(TestSchema.Expando, { value: 100 }).ast, OBJECT_1)).to.be.true;
|
|
28
|
+
expect(filterMatchObject(Filter.type(TestSchema.Expando, { complete: false }).ast, OBJECT_1)).to.be.false;
|
|
29
|
+
expect(filterMatchObject(Filter.type(TestSchema.Expando, { missing: undefined }).ast, OBJECT_1)).to.be.true;
|
|
30
|
+
expect(filterMatchObject(Filter.type(TestSchema.Expando, { properties: { subject: 'test' } }).ast, OBJECT_1)).to.be
|
|
31
|
+
.true;
|
|
32
|
+
expect(filterMatchObject(Filter.type(TestSchema.Expando, { array: Filter.contains('two') }).ast, OBJECT_1)).to.be
|
|
33
|
+
.true;
|
|
32
34
|
});
|
|
33
35
|
|
|
34
36
|
test('and', () => {
|
|
35
|
-
const filter1 = Filter.type(Expando, { title: 'test' });
|
|
36
|
-
const filter2 = Filter.type(Expando, { value: 100 });
|
|
37
|
-
const filter3 = Filter.type(Expando, { complete: true });
|
|
37
|
+
const filter1 = Filter.type(TestSchema.Expando, { title: 'test' });
|
|
38
|
+
const filter2 = Filter.type(TestSchema.Expando, { value: 100 });
|
|
39
|
+
const filter3 = Filter.type(TestSchema.Expando, { complete: true });
|
|
38
40
|
|
|
39
41
|
expect(filterMatchObject(Filter.and(filter1, filter2, filter3).ast, OBJECT_1)).to.be.true;
|
|
40
42
|
});
|
|
41
43
|
|
|
42
44
|
test('or', () => {
|
|
43
|
-
const filter1 = Filter.type(Expando, { value: 200 });
|
|
44
|
-
const filter2 = Filter.type(Expando, { title: 'test' });
|
|
45
|
-
const filter3 = Filter.type(Expando, { complete: false });
|
|
45
|
+
const filter1 = Filter.type(TestSchema.Expando, { value: 200 });
|
|
46
|
+
const filter2 = Filter.type(TestSchema.Expando, { title: 'test' });
|
|
47
|
+
const filter3 = Filter.type(TestSchema.Expando, { complete: false });
|
|
46
48
|
|
|
47
49
|
expect(filterMatchObject(Filter.or(filter1, filter2, filter3).ast, OBJECT_1)).to.be.true;
|
|
48
50
|
});
|
|
49
51
|
|
|
50
52
|
test('not', () => {
|
|
51
|
-
const filter1 = Filter.type(Expando, { title: 'test' });
|
|
53
|
+
const filter1 = Filter.type(TestSchema.Expando, { title: 'test' });
|
|
52
54
|
const filter2 = Filter.not(filter1);
|
|
53
55
|
|
|
54
56
|
expect(filterMatchObject(filter1.ast, OBJECT_1)).to.be.true;
|
|
@@ -56,41 +58,55 @@ describe('filterMatch', () => {
|
|
|
56
58
|
});
|
|
57
59
|
|
|
58
60
|
test('contains', () => {
|
|
59
|
-
expect(filterMatchObject(Filter.type(Expando, { properties: { label: Filter.contains('test') } }).ast, OBJECT_1)).to
|
|
60
|
-
.be.true;
|
|
61
61
|
expect(
|
|
62
62
|
filterMatchObject(
|
|
63
|
-
Filter.type(Expando, {
|
|
63
|
+
Filter.type(TestSchema.Expando, { properties: { label: Filter.contains('test') } }).ast,
|
|
64
|
+
OBJECT_1,
|
|
65
|
+
),
|
|
66
|
+
).to.be.true;
|
|
67
|
+
expect(
|
|
68
|
+
filterMatchObject(
|
|
69
|
+
Filter.type(TestSchema.Expando, { fields: Filter.contains({ label: 'label', value: 'test' }) }).ast,
|
|
64
70
|
OBJECT_1,
|
|
65
71
|
),
|
|
66
72
|
).to.be.true;
|
|
67
73
|
});
|
|
68
74
|
|
|
69
75
|
test('complex', () => {
|
|
70
|
-
const filter1 = Filter.type(Expando, { title: 'bad' });
|
|
71
|
-
const filter2 = Filter.type(Expando, { value: 0 });
|
|
76
|
+
const filter1 = Filter.type(TestSchema.Expando, { title: 'bad' });
|
|
77
|
+
const filter2 = Filter.type(TestSchema.Expando, { value: 0 });
|
|
72
78
|
expect(filterMatchObject(Filter.not(Filter.or(filter1, filter2)).ast, OBJECT_1)).to.be.true;
|
|
73
79
|
});
|
|
74
80
|
|
|
75
81
|
test('ids', () => {
|
|
76
|
-
const filter = Filter.
|
|
82
|
+
const filter = Filter.id(OBJECT_1.id);
|
|
77
83
|
expect(filterMatchObject(filter.ast, OBJECT_1)).to.be.true;
|
|
78
84
|
expect(filterMatchObject(filter.ast, OBJECT_2)).to.be.false;
|
|
79
85
|
});
|
|
80
86
|
|
|
81
87
|
test('refs', () => {
|
|
82
|
-
const filter = Filter.type(Expando, { parent: Ref.fromDXN(DXN.fromLocalObjectId(OBJECT_1.id)) });
|
|
88
|
+
const filter = Filter.type(TestSchema.Expando, { parent: Ref.fromDXN(DXN.fromLocalObjectId(OBJECT_1.id)) });
|
|
83
89
|
expect(filterMatchObject(filter.ast, OBJECT_1)).to.be.false;
|
|
84
90
|
expect(filterMatchObject(filter.ast, OBJECT_2)).to.be.false;
|
|
85
91
|
expect(filterMatchObject(filter.ast, OBJECT_3)).to.be.true;
|
|
86
92
|
});
|
|
93
|
+
|
|
94
|
+
test('standalone timestamp filter throws invariant (must be handled at index level)', () => {
|
|
95
|
+
expect(() => filterMatchObject(Filter.updated({ after: Date.now() - 1000 }).ast, OBJECT_1)).to.throw();
|
|
96
|
+
expect(() => filterMatchObject(Filter.created({ before: Date.now() + 1000 }).ast, OBJECT_1)).to.throw();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('and(type, timestamp) throws on timestamp part', () => {
|
|
100
|
+
const filter = Filter.and(Filter.type(TestSchema.Expando), Filter.updated({ after: Date.now() - 1000 }));
|
|
101
|
+
expect(() => filterMatchObject(filter.ast, OBJECT_1)).to.throw();
|
|
102
|
+
});
|
|
87
103
|
});
|
|
88
104
|
|
|
89
105
|
const OBJECT_1: MatchedObject = {
|
|
90
106
|
id: ObjectId.make('01JVS9YYT5VMVJW0GGTM1YHCCH'),
|
|
91
107
|
spaceId: SpaceId.make('B2NJDFNVZIW77OQSXUBNAD7BUMBD3G5PO'),
|
|
92
108
|
doc: ObjectStructure.makeObject({
|
|
93
|
-
type: DXN.fromTypenameAndVersion(
|
|
109
|
+
type: DXN.fromTypenameAndVersion(TestSchema.Expando.typename, '0.1.0').toString(),
|
|
94
110
|
data: {
|
|
95
111
|
title: 'test',
|
|
96
112
|
value: 100,
|
|
@@ -106,7 +122,7 @@ const OBJECT_2: MatchedObject = {
|
|
|
106
122
|
id: ObjectId.make('01JT5TD6K9FFJ3VNM5FGMS5C0Q'),
|
|
107
123
|
spaceId: SpaceId.make('B2NJDFNVZIW77OQSXUBNAD7BUMBD3G5PO'),
|
|
108
124
|
doc: ObjectStructure.makeObject({
|
|
109
|
-
type: DXN.fromTypenameAndVersion(
|
|
125
|
+
type: DXN.fromTypenameAndVersion(TestSchema.Expando.typename, '0.1.0').toString(),
|
|
110
126
|
data: { title: 'test', value: 100, complete: true },
|
|
111
127
|
deleted: true,
|
|
112
128
|
}),
|
|
@@ -116,7 +132,7 @@ const OBJECT_3: MatchedObject = {
|
|
|
116
132
|
id: ObjectId.make('01JT5TD6K9FFJ3VNM5FGMS5C0Q'),
|
|
117
133
|
spaceId: SpaceId.make('B2NJDFNVZIW77OQSXUBNAD7BUMBD3G5PO'),
|
|
118
134
|
doc: ObjectStructure.makeObject({
|
|
119
|
-
type: DXN.fromTypenameAndVersion(
|
|
135
|
+
type: DXN.fromTypenameAndVersion(TestSchema.Expando.typename, '0.1.0').toString(),
|
|
120
136
|
data: { title: 'test', value: 100, complete: true, parent: { '/': DXN.fromLocalObjectId(OBJECT_1.id).toString() } },
|
|
121
137
|
}),
|
|
122
138
|
};
|