@dxos/client-services 0.8.4-main.ae835ea → 0.8.4-main.bc2380dfbc
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/browser/chunk-QCWEHHJW.mjs +24 -0
- package/dist/lib/browser/chunk-QCWEHHJW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KPYVJG6G.mjs → chunk-TUCJORVO.mjs} +2153 -3654
- package/dist/lib/browser/chunk-TUCJORVO.mjs.map +7 -0
- package/dist/lib/browser/chunk-XJRPB3GA.mjs +22 -0
- package/dist/lib/browser/chunk-XJRPB3GA.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +424 -137
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs +88 -0
- package/dist/lib/browser/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
- package/dist/lib/browser/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/browser.mjs +86 -0
- package/dist/lib/browser/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/browser/packlets/locks/node.mjs +48 -0
- package/dist/lib/browser/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +28 -29
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/chunk-2DT3MZRL.mjs +22 -0
- package/dist/lib/node-esm/chunk-2DT3MZRL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs +24 -0
- package/dist/lib/node-esm/chunk-2SZHAWBN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BBBSS6UL.mjs → chunk-IQLAKNSR.mjs} +2099 -3469
- package/dist/lib/node-esm/chunk-IQLAKNSR.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +424 -137
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs +88 -0
- package/dist/lib/node-esm/packlets/diagnostics/browser-diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs +11 -0
- package/dist/lib/node-esm/packlets/diagnostics/diagnostics-broadcast.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs +86 -0
- package/dist/lib/node-esm/packlets/locks/browser.mjs.map +7 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs +48 -0
- package/dist/lib/node-esm/packlets/locks/node.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +28 -29
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/packlets/agents/edge-agent-manager.d.ts +3 -2
- package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts +2 -1
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/devtools.d.ts +2 -2
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-collector.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts +2 -3
- package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/index.d.ts +1 -1
- package/dist/types/src/packlets/diagnostics/index.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts +2 -2
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/contacts-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts +6 -6
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +8 -7
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-service.d.ts +6 -10
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +8 -11
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +6 -5
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts +1 -1
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +7 -4
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-topology.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +4 -4
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts +3 -3
- package/dist/types/src/packlets/invitations/invitations-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +3 -3
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +4 -3
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/browser.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/index.d.ts +1 -1
- package/dist/types/src/packlets/locks/index.d.ts.map +1 -1
- package/dist/types/src/packlets/locks/node.d.ts.map +1 -1
- package/dist/types/src/packlets/logging/logging-service.d.ts +4 -0
- package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +5 -4
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/client-rpc-server.d.ts +5 -5
- package/dist/types/src/packlets/services/client-rpc-server.d.ts.map +1 -1
- package/dist/types/src/packlets/services/feed-syncer.d.ts +59 -0
- package/dist/types/src/packlets/services/feed-syncer.d.ts.map +1 -0
- package/dist/types/src/packlets/services/feed-syncer.test.d.ts +2 -0
- package/dist/types/src/packlets/services/feed-syncer.test.d.ts.map +1 -0
- package/dist/types/src/packlets/services/platform.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +13 -9
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +20 -7
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-registry.d.ts.map +1 -1
- package/dist/types/src/packlets/services/util.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/archive-format.d.ts +9 -0
- package/dist/types/src/packlets/space-export/archive-format.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/index.d.ts +4 -1
- package/dist/types/src/packlets/space-export/index.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/serialized-space-reader.d.ts +23 -0
- package/dist/types/src/packlets/space-export/serialized-space-reader.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/serialized-space-writer.d.ts +36 -0
- package/dist/types/src/packlets/space-export/serialized-space-writer.d.ts.map +1 -0
- package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +9 -1
- package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts +7 -1
- package/dist/types/src/packlets/space-export/space-archive-writer.d.ts.map +1 -1
- package/dist/types/src/packlets/space-export/space-archive.test.d.ts +2 -0
- package/dist/types/src/packlets/space-export/space-archive.test.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +30 -19
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +26 -9
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +2 -2
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/genesis.d.ts +2 -1
- package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +6 -9
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +10 -7
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/util.d.ts.map +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/credential-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +6 -3
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +6 -5
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts +41 -4
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-session.d.ts +2 -4
- package/dist/types/src/packlets/worker/worker-session.d.ts.map +1 -1
- package/dist/types/src/testing/setup.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +71 -56
- package/src/index.ts +1 -0
- package/src/packlets/agents/edge-agent-manager.ts +8 -5
- package/src/packlets/agents/edge-agent-service.ts +4 -2
- package/src/packlets/devices/devices-service.test.ts +0 -1
- package/src/packlets/devtools/devtools.ts +2 -3
- package/src/packlets/diagnostics/diagnostics.ts +1 -2
- package/src/packlets/diagnostics/index.ts +1 -1
- package/src/packlets/identity/authenticator.ts +2 -2
- package/src/packlets/identity/contacts-service.ts +0 -1
- package/src/packlets/identity/identity-manager.test.ts +5 -5
- package/src/packlets/identity/identity-manager.ts +23 -22
- package/src/packlets/identity/identity-recovery-manager.ts +22 -18
- package/src/packlets/identity/identity-service.test.ts +6 -27
- package/src/packlets/identity/identity-service.ts +13 -81
- package/src/packlets/identity/identity.test.ts +2 -2
- package/src/packlets/identity/identity.ts +11 -34
- package/src/packlets/invitations/device-invitation-protocol.ts +8 -7
- package/src/packlets/invitations/edge-invitation-handler.ts +9 -5
- package/src/packlets/invitations/invitation-guest-extenstion.ts +6 -4
- package/src/packlets/invitations/invitation-host-extension.ts +13 -14
- package/src/packlets/invitations/invitation-protocol.ts +7 -4
- package/src/packlets/invitations/invitation-state.ts +1 -15
- package/src/packlets/invitations/invitations-handler.test.ts +4 -5
- package/src/packlets/invitations/invitations-handler.ts +74 -22
- package/src/packlets/invitations/invitations-manager.ts +40 -15
- package/src/packlets/invitations/invitations-service.ts +9 -9
- package/src/packlets/invitations/space-invitation-protocol.test.ts +17 -16
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -16
- package/src/packlets/locks/index.ts +1 -1
- package/src/packlets/logging/logging-service.ts +20 -16
- package/src/packlets/network/network-service.test.ts +0 -1
- package/src/packlets/network/network-service.ts +10 -8
- package/src/packlets/services/client-rpc-server.ts +19 -16
- package/src/packlets/services/feed-syncer.test.ts +340 -0
- package/src/packlets/services/feed-syncer.ts +377 -0
- package/src/packlets/services/platform.ts +7 -1
- package/src/packlets/services/service-context.test.ts +3 -2
- package/src/packlets/services/service-context.ts +153 -61
- package/src/packlets/services/service-host.test.ts +8 -8
- package/src/packlets/services/service-host.ts +70 -40
- package/src/packlets/services/service-registry.test.ts +0 -1
- package/src/packlets/space-export/archive-format.ts +42 -0
- package/src/packlets/space-export/index.ts +4 -1
- package/src/packlets/space-export/serialized-space-reader.ts +111 -0
- package/src/packlets/space-export/serialized-space-writer.ts +252 -0
- package/src/packlets/space-export/space-archive-reader.ts +64 -3
- package/src/packlets/space-export/space-archive-writer.ts +41 -3
- package/src/packlets/space-export/space-archive.test.ts +461 -0
- package/src/packlets/spaces/data-space-manager.test.ts +79 -13
- package/src/packlets/spaces/data-space-manager.ts +108 -120
- package/src/packlets/spaces/data-space.ts +64 -36
- package/src/packlets/spaces/edge-feed-replicator.test.ts +1 -1
- package/src/packlets/spaces/edge-feed-replicator.ts +11 -9
- package/src/packlets/spaces/epoch-migrations.ts +6 -5
- package/src/packlets/spaces/genesis.ts +6 -1
- package/src/packlets/spaces/notarization-plugin.test.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.ts +10 -9
- package/src/packlets/spaces/spaces-service.test.ts +18 -11
- package/src/packlets/spaces/spaces-service.ts +124 -24
- package/src/packlets/storage/storage.ts +4 -4
- package/src/packlets/testing/invitation-utils.ts +10 -6
- package/src/packlets/testing/test-builder.ts +36 -10
- package/src/packlets/worker/worker-runtime.ts +188 -17
- package/src/packlets/worker/worker-session.ts +12 -18
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-KPYVJG6G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BBBSS6UL.mjs.map +0 -7
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts +0 -19
- package/dist/types/src/packlets/identity/default-space-state-machine.d.ts.map +0 -1
- package/src/packlets/identity/default-space-state-machine.ts +0 -44
|
@@ -5,13 +5,7 @@
|
|
|
5
5
|
import { Event } from '@dxos/async';
|
|
6
6
|
import { Stream } from '@dxos/codec-protobuf/stream';
|
|
7
7
|
import { PublicKey } from '@dxos/keys';
|
|
8
|
-
import {
|
|
9
|
-
type LogLevel,
|
|
10
|
-
type LogProcessor,
|
|
11
|
-
type LogEntry as NaturalLogEntry,
|
|
12
|
-
getContextFromEntry,
|
|
13
|
-
log,
|
|
14
|
-
} from '@dxos/log';
|
|
8
|
+
import { type LogLevel, type LogProcessor, type LogEntry as NaturalLogEntry, log } from '@dxos/log';
|
|
15
9
|
import {
|
|
16
10
|
type ControlMetricsRequest,
|
|
17
11
|
type ControlMetricsResponse,
|
|
@@ -22,10 +16,14 @@ import {
|
|
|
22
16
|
type QueryMetricsRequest,
|
|
23
17
|
type QueryMetricsResponse,
|
|
24
18
|
} from '@dxos/protocols/proto/dxos/client/services';
|
|
25
|
-
import {
|
|
19
|
+
import { numericalValues, tracer } from '@dxos/util';
|
|
26
20
|
|
|
27
21
|
/**
|
|
28
22
|
* Logging service used to spy on logs of the host.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated This was created so that logs from the shared worker (WorkerClientServices) could be
|
|
25
|
+
* seen in the main window console without opening the shared worker DevTools. Shared worker client
|
|
26
|
+
* services is deprecated; dedicated worker logs already show in the main window console.
|
|
29
27
|
*/
|
|
30
28
|
export class LoggingServiceImpl implements LoggingService {
|
|
31
29
|
private readonly _logs = new Event<NaturalLogEntry>();
|
|
@@ -37,7 +35,7 @@ export class LoggingServiceImpl implements LoggingService {
|
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
async close(): Promise<void> {
|
|
40
|
-
const index = log.runtimeConfig.processors.findIndex((processor) => processor === this._logProcessor);
|
|
38
|
+
const index = log.runtimeConfig.processors.findIndex((processor: LogProcessor) => processor === this._logProcessor);
|
|
41
39
|
log.runtimeConfig.processors.splice(index, 1);
|
|
42
40
|
}
|
|
43
41
|
|
|
@@ -110,19 +108,25 @@ export class LoggingServiceImpl implements LoggingService {
|
|
|
110
108
|
return;
|
|
111
109
|
}
|
|
112
110
|
|
|
111
|
+
const { filename, line, context: scopeName } = entry.computedMeta;
|
|
112
|
+
const recordContext: Record<string, any> = { ...entry.computedContext };
|
|
113
|
+
if (entry.computedError !== undefined) {
|
|
114
|
+
recordContext.error = entry.computedError;
|
|
115
|
+
}
|
|
116
|
+
|
|
113
117
|
const record: LogEntry = {
|
|
114
|
-
|
|
115
|
-
message: entry.message ??
|
|
116
|
-
context:
|
|
117
|
-
timestamp: new Date(),
|
|
118
|
+
level: entry.level,
|
|
119
|
+
message: entry.message ?? entry.computedError ?? '',
|
|
120
|
+
context: recordContext,
|
|
121
|
+
timestamp: new Date(entry.timestamp),
|
|
118
122
|
meta: {
|
|
119
123
|
// TODO(dmaretskyi): Fix proto.
|
|
120
|
-
file:
|
|
121
|
-
line:
|
|
124
|
+
file: filename ?? '',
|
|
125
|
+
line: line ?? 0,
|
|
122
126
|
scope: {
|
|
123
127
|
hostSessionId: this._sessionId,
|
|
124
128
|
uptimeSeconds: (Date.now() - this._started) / 1000,
|
|
125
|
-
name:
|
|
129
|
+
name: scopeName ?? '',
|
|
126
130
|
},
|
|
127
131
|
},
|
|
128
132
|
};
|
|
@@ -10,7 +10,6 @@ import { ConnectionState, type NetworkService } from '@dxos/protocols/proto/dxos
|
|
|
10
10
|
|
|
11
11
|
import { type ServiceContext } from '../services';
|
|
12
12
|
import { createServiceContext } from '../testing';
|
|
13
|
-
|
|
14
13
|
import { NetworkServiceImpl } from './network-service';
|
|
15
14
|
|
|
16
15
|
describe('NetworkService', () => {
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type RequestOptions } from '@dxos/codec-protobuf';
|
|
5
6
|
import { Stream } from '@dxos/codec-protobuf/stream';
|
|
7
|
+
import { Context } from '@dxos/context';
|
|
6
8
|
import { type EdgeConnection } from '@dxos/edge-client';
|
|
7
9
|
import { type SignalManager } from '@dxos/messaging';
|
|
8
10
|
import { type SwarmNetworkManager } from '@dxos/network-manager';
|
|
@@ -47,16 +49,16 @@ export class NetworkServiceImpl implements NetworkService {
|
|
|
47
49
|
await this.networkManager.setConnectionState(request.swarm);
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
async joinSwarm(request: JoinRequest): Promise<void> {
|
|
51
|
-
return this.signalManager.join(request);
|
|
52
|
+
async joinSwarm(request: JoinRequest, options?: RequestOptions): Promise<void> {
|
|
53
|
+
return this.signalManager.join(options?.ctx ?? Context.default(), request);
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
async leaveSwarm(request: LeaveRequest): Promise<void> {
|
|
55
|
-
return this.signalManager.leave(request);
|
|
56
|
+
async leaveSwarm(request: LeaveRequest, options?: RequestOptions): Promise<void> {
|
|
57
|
+
return this.signalManager.leave(options?.ctx ?? Context.default(), request);
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
async querySwarm(request: QueryRequest): Promise<SwarmResponse> {
|
|
59
|
-
return this.signalManager.query(request);
|
|
60
|
+
async querySwarm(request: QueryRequest, options?: RequestOptions): Promise<SwarmResponse> {
|
|
61
|
+
return this.signalManager.query(options?.ctx ?? Context.default(), request);
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
subscribeSwarmState(request: SubscribeSwarmStateRequest): Stream<SwarmResponse> {
|
|
@@ -69,8 +71,8 @@ export class NetworkServiceImpl implements NetworkService {
|
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
async sendMessage(message: Message): Promise<void> {
|
|
73
|
-
return this.signalManager.sendMessage(message);
|
|
74
|
+
async sendMessage(message: Message, options?: RequestOptions): Promise<void> {
|
|
75
|
+
return this.signalManager.sendMessage(options?.ctx ?? Context.default(), message);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
subscribeMessages(peer: Peer): Stream<Message> {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type ClientServices } from '@dxos/client-protocol';
|
|
6
|
-
import { type Any, type ServiceHandler, Stream } from '@dxos/codec-protobuf';
|
|
6
|
+
import { type Any, type RequestOptions, type ServiceHandler, Stream } from '@dxos/codec-protobuf';
|
|
7
7
|
import { raise } from '@dxos/debug';
|
|
8
8
|
import { RpcPeer, type RpcPeerOptions, type ServiceBundle, parseMethodName } from '@dxos/rpc';
|
|
9
9
|
import { MapCounter, trace } from '@dxos/tracing';
|
|
@@ -11,17 +11,19 @@ import { type MaybePromise } from '@dxos/util';
|
|
|
11
11
|
|
|
12
12
|
import { type ServiceRegistry } from './service-registry';
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type ClientRpcServerProps = {
|
|
15
15
|
serviceRegistry: ServiceRegistry<ClientServices>;
|
|
16
16
|
handleCall?: (
|
|
17
17
|
method: string,
|
|
18
18
|
params: Any,
|
|
19
|
-
handler: (method: string, params: Any) => MaybePromise<Any>,
|
|
19
|
+
handler: (method: string, params: Any, options?: RequestOptions) => MaybePromise<Any>,
|
|
20
|
+
options?: RequestOptions,
|
|
20
21
|
) => Promise<Any>;
|
|
21
22
|
handleStream?: (
|
|
22
23
|
method: string,
|
|
23
24
|
params: Any,
|
|
24
|
-
handler: (method: string, params: Any) => Stream<Any>,
|
|
25
|
+
handler: (method: string, params: Any, options?: RequestOptions) => Stream<Any>,
|
|
26
|
+
options?: RequestOptions,
|
|
25
27
|
) => MaybePromise<Stream<Any>>;
|
|
26
28
|
} & Omit<RpcPeerOptions, 'callHandler' | 'streamHandler'>;
|
|
27
29
|
|
|
@@ -30,8 +32,8 @@ export class ClientRpcServer {
|
|
|
30
32
|
private readonly _serviceRegistry: ServiceRegistry<ClientServices>;
|
|
31
33
|
private readonly _rpcPeer: RpcPeer;
|
|
32
34
|
private readonly _handlerCache = new Map<string, ServiceHandler<any>>();
|
|
33
|
-
private readonly _handleCall:
|
|
34
|
-
private readonly _handleStream:
|
|
35
|
+
private readonly _handleCall: ClientRpcServerProps['handleCall'];
|
|
36
|
+
private readonly _handleStream: ClientRpcServerProps['handleStream'];
|
|
35
37
|
|
|
36
38
|
@trace.metricsCounter()
|
|
37
39
|
private readonly _callMetrics = new MapCounter();
|
|
@@ -41,7 +43,7 @@ export class ClientRpcServer {
|
|
|
41
43
|
return Object.keys(this._serviceRegistry.services);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
constructor(params:
|
|
46
|
+
constructor(params: ClientRpcServerProps) {
|
|
45
47
|
const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
|
|
46
48
|
this._handleCall = handleCall;
|
|
47
49
|
this._handleStream = handleStream;
|
|
@@ -49,32 +51,33 @@ export class ClientRpcServer {
|
|
|
49
51
|
this._serviceRegistry = serviceRegistry;
|
|
50
52
|
this._rpcPeer = new RpcPeer({
|
|
51
53
|
...rpcOptions,
|
|
52
|
-
callHandler: (method, params) => {
|
|
54
|
+
callHandler: (method, params, options) => {
|
|
53
55
|
const [serviceName, methodName] = parseMethodName(method);
|
|
54
|
-
const handler = (method: string, params: Any
|
|
56
|
+
const handler = (method: string, params: Any, handlerOptions?: RequestOptions) =>
|
|
57
|
+
this._getServiceHandler(serviceName).call(method, params, handlerOptions);
|
|
55
58
|
|
|
56
59
|
this._callMetrics.inc(`${serviceName}.${methodName} request`);
|
|
57
60
|
|
|
58
61
|
if (this._handleCall) {
|
|
59
|
-
return this._handleCall(methodName, params, handler);
|
|
62
|
+
return this._handleCall(methodName, params, handler, options);
|
|
60
63
|
} else {
|
|
61
|
-
return handler(methodName, params);
|
|
64
|
+
return handler(methodName, params, options);
|
|
62
65
|
}
|
|
63
66
|
},
|
|
64
|
-
streamHandler: (method, params) => {
|
|
67
|
+
streamHandler: (method, params, options) => {
|
|
65
68
|
const [serviceName, methodName] = parseMethodName(method);
|
|
66
|
-
const handler = (method: string, params: Any) =>
|
|
67
|
-
this._getServiceHandler(serviceName).callStream(method, params);
|
|
69
|
+
const handler = (method: string, params: Any, handlerOptions?: RequestOptions) =>
|
|
70
|
+
this._getServiceHandler(serviceName).callStream(method, params, handlerOptions);
|
|
68
71
|
|
|
69
72
|
this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
|
|
70
73
|
|
|
71
74
|
if (this._handleStream) {
|
|
72
|
-
return Stream.map(Stream.unwrapPromise(this._handleStream(methodName, params, handler)), (data) => {
|
|
75
|
+
return Stream.map(Stream.unwrapPromise(this._handleStream(methodName, params, handler, options)), (data) => {
|
|
73
76
|
this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
|
|
74
77
|
return data;
|
|
75
78
|
});
|
|
76
79
|
} else {
|
|
77
|
-
return handler(methodName, params);
|
|
80
|
+
return handler(methodName, params, options);
|
|
78
81
|
}
|
|
79
82
|
},
|
|
80
83
|
});
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Encoder, decode as cborDecode } from 'cbor-x';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Layer from 'effect/Layer';
|
|
8
|
+
import * as ManagedRuntime from 'effect/ManagedRuntime';
|
|
9
|
+
import { describe, expect, onTestFinished, test, vi } from 'vitest';
|
|
10
|
+
|
|
11
|
+
import { Event } from '@dxos/async';
|
|
12
|
+
import { Context } from '@dxos/context';
|
|
13
|
+
import { type EdgeConnection, MessageSchema } from '@dxos/edge-client';
|
|
14
|
+
import { RuntimeProvider } from '@dxos/effect';
|
|
15
|
+
import { FeedStore, SyncServer } from '@dxos/feed';
|
|
16
|
+
import { ObjectId, SpaceId } from '@dxos/keys';
|
|
17
|
+
import { FeedProtocol } from '@dxos/protocols';
|
|
18
|
+
import { EdgeService } from '@dxos/protocols';
|
|
19
|
+
import { createBuf } from '@dxos/protocols/buf';
|
|
20
|
+
import { type Message as RouterMessage } from '@dxos/protocols/buf/dxos/edge/messenger_pb';
|
|
21
|
+
import { EdgeStatus } from '@dxos/protocols/proto/dxos/client/services';
|
|
22
|
+
import { SqlTransaction } from '@dxos/sql-sqlite';
|
|
23
|
+
import { layerMemory } from '@dxos/sql-sqlite/platform';
|
|
24
|
+
import { bufferToArray } from '@dxos/util';
|
|
25
|
+
|
|
26
|
+
import { FeedSyncer } from './feed-syncer';
|
|
27
|
+
|
|
28
|
+
type ProtocolMessage = FeedProtocol.ProtocolMessage;
|
|
29
|
+
|
|
30
|
+
const encoder = new Encoder({ tagUint8Array: false, useRecords: false });
|
|
31
|
+
const syncNamespace = FeedProtocol.WellKnownNamespaces.data;
|
|
32
|
+
const syncNamespaces = [FeedProtocol.WellKnownNamespaces.data, FeedProtocol.WellKnownNamespaces.trace];
|
|
33
|
+
|
|
34
|
+
const createRuntime = () => {
|
|
35
|
+
const baseLayer = layerMemory;
|
|
36
|
+
const transactionLayer = SqlTransaction.layer.pipe(Layer.provide(baseLayer));
|
|
37
|
+
return ManagedRuntime.make(Layer.merge(baseLayer, transactionLayer).pipe(Layer.orDie));
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const createFeedStore = (localActorId: string, assignPositions: boolean) =>
|
|
41
|
+
new FeedStore({ localActorId, assignPositions });
|
|
42
|
+
|
|
43
|
+
const createEdgeConnection = ({
|
|
44
|
+
syncServer,
|
|
45
|
+
serverRuntime,
|
|
46
|
+
messageListeners,
|
|
47
|
+
}: {
|
|
48
|
+
syncServer: SyncServer;
|
|
49
|
+
serverRuntime: ReturnType<typeof createRuntime>;
|
|
50
|
+
messageListeners: Set<(message: RouterMessage) => void>;
|
|
51
|
+
}): EdgeConnection => {
|
|
52
|
+
const reconnectListeners = new Set<() => void>();
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
statusChanged: new Event<any>(),
|
|
56
|
+
info: {},
|
|
57
|
+
identityKey: 'client-identity',
|
|
58
|
+
peerKey: 'client-peer',
|
|
59
|
+
isOpen: true,
|
|
60
|
+
status: {
|
|
61
|
+
state: EdgeStatus.ConnectionState.CONNECTED,
|
|
62
|
+
rtt: 0,
|
|
63
|
+
uptime: 0,
|
|
64
|
+
rateBytesUp: 0,
|
|
65
|
+
rateBytesDown: 0,
|
|
66
|
+
messagesSent: 0,
|
|
67
|
+
messagesReceived: 0,
|
|
68
|
+
},
|
|
69
|
+
setIdentity: () => {},
|
|
70
|
+
open: async () => {},
|
|
71
|
+
close: async () => {},
|
|
72
|
+
send: async (ctx, routerMessage: RouterMessage) => {
|
|
73
|
+
const decoded = cborDecode(routerMessage.payload!.value) as ProtocolMessage;
|
|
74
|
+
await syncServer.handleMessage(ctx, decoded).pipe(RuntimeProvider.runPromise(serverRuntime.runtimeEffect));
|
|
75
|
+
},
|
|
76
|
+
onMessage: (listener: (message: RouterMessage) => void) => {
|
|
77
|
+
messageListeners.add(listener);
|
|
78
|
+
return () => messageListeners.delete(listener);
|
|
79
|
+
},
|
|
80
|
+
onReconnected: (listener: () => void) => {
|
|
81
|
+
reconnectListeners.add(listener);
|
|
82
|
+
return () => reconnectListeners.delete(listener);
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const createFeedSyncHarness = async ({
|
|
88
|
+
spaceId,
|
|
89
|
+
pollingInterval,
|
|
90
|
+
syncNamespaces: namespaces = [syncNamespace],
|
|
91
|
+
}: {
|
|
92
|
+
spaceId: SpaceId;
|
|
93
|
+
pollingInterval?: number;
|
|
94
|
+
syncNamespaces?: string[];
|
|
95
|
+
}) => {
|
|
96
|
+
const serverRuntime = createRuntime();
|
|
97
|
+
const clientRuntime = createRuntime();
|
|
98
|
+
const serverFeedStore = createFeedStore('server', true);
|
|
99
|
+
const clientFeedStore = createFeedStore('client', false);
|
|
100
|
+
|
|
101
|
+
await serverFeedStore.migrate().pipe(RuntimeProvider.runPromise(serverRuntime.runtimeEffect));
|
|
102
|
+
await clientFeedStore.migrate().pipe(RuntimeProvider.runPromise(clientRuntime.runtimeEffect));
|
|
103
|
+
|
|
104
|
+
const messageListeners = new Set<(message: RouterMessage) => void>();
|
|
105
|
+
const syncServer = new SyncServer({
|
|
106
|
+
peerId: 'server',
|
|
107
|
+
feedStore: serverFeedStore,
|
|
108
|
+
sendMessage: (_ctx, message) =>
|
|
109
|
+
Effect.promise(async () => {
|
|
110
|
+
const routerMessage = createBuf(MessageSchema, {
|
|
111
|
+
source: {
|
|
112
|
+
identityKey: 'server-identity',
|
|
113
|
+
peerKey: 'server-peer',
|
|
114
|
+
},
|
|
115
|
+
serviceId: `${EdgeService.QUEUE_REPLICATOR}:test`,
|
|
116
|
+
payload: { value: bufferToArray(encoder.encode(message)) },
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
for (const listener of messageListeners) {
|
|
120
|
+
listener(routerMessage);
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const edgeClient = createEdgeConnection({ syncServer, serverRuntime, messageListeners });
|
|
126
|
+
|
|
127
|
+
const syncer = new FeedSyncer({
|
|
128
|
+
runtime: clientRuntime.runtimeEffect,
|
|
129
|
+
feedStore: clientFeedStore,
|
|
130
|
+
edgeClient: edgeClient as any,
|
|
131
|
+
peerId: 'client',
|
|
132
|
+
getSpaceIds: () => [spaceId],
|
|
133
|
+
syncNamespaces: namespaces,
|
|
134
|
+
pollingInterval,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const close = async () => {
|
|
138
|
+
await syncer.close();
|
|
139
|
+
await clientRuntime.dispose();
|
|
140
|
+
await serverRuntime.dispose();
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
onTestFinished(close);
|
|
144
|
+
|
|
145
|
+
return { serverRuntime, clientRuntime, serverFeedStore, clientFeedStore, syncer, close };
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
describe('FeedSyncer', () => {
|
|
149
|
+
test('syncs mixed pull and push traffic', async () => {
|
|
150
|
+
const spaceId = SpaceId.random();
|
|
151
|
+
const { serverRuntime, clientRuntime, serverFeedStore, clientFeedStore, syncer } = await createFeedSyncHarness({
|
|
152
|
+
spaceId,
|
|
153
|
+
});
|
|
154
|
+
const serverFeedId = ObjectId.random();
|
|
155
|
+
const clientFeedId = ObjectId.random();
|
|
156
|
+
|
|
157
|
+
await serverFeedStore
|
|
158
|
+
.appendLocal([
|
|
159
|
+
{
|
|
160
|
+
spaceId,
|
|
161
|
+
feedId: serverFeedId,
|
|
162
|
+
feedNamespace: syncNamespace,
|
|
163
|
+
data: new Uint8Array([1, 2, 3]),
|
|
164
|
+
},
|
|
165
|
+
])
|
|
166
|
+
.pipe(RuntimeProvider.runPromise(serverRuntime.runtimeEffect));
|
|
167
|
+
|
|
168
|
+
await syncer.open(new Context());
|
|
169
|
+
|
|
170
|
+
await vi.waitFor(async () => {
|
|
171
|
+
const { blocks } = await clientFeedStore
|
|
172
|
+
.query({
|
|
173
|
+
spaceId,
|
|
174
|
+
feedNamespace: syncNamespace,
|
|
175
|
+
position: -1,
|
|
176
|
+
query: { feedIds: [serverFeedId] },
|
|
177
|
+
})
|
|
178
|
+
.pipe(RuntimeProvider.runPromise(clientRuntime.runtimeEffect));
|
|
179
|
+
|
|
180
|
+
expect(blocks).toHaveLength(1);
|
|
181
|
+
expect(blocks[0].data).toEqual(new Uint8Array([1, 2, 3]));
|
|
182
|
+
expect(blocks[0].position).toBeDefined();
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
await clientFeedStore
|
|
186
|
+
.appendLocal([
|
|
187
|
+
{
|
|
188
|
+
spaceId,
|
|
189
|
+
feedId: clientFeedId,
|
|
190
|
+
feedNamespace: syncNamespace,
|
|
191
|
+
data: new Uint8Array([9, 8, 7]),
|
|
192
|
+
},
|
|
193
|
+
])
|
|
194
|
+
.pipe(RuntimeProvider.runPromise(clientRuntime.runtimeEffect));
|
|
195
|
+
|
|
196
|
+
await vi.waitFor(async () => {
|
|
197
|
+
const { blocks } = await serverFeedStore
|
|
198
|
+
.query({
|
|
199
|
+
spaceId,
|
|
200
|
+
feedNamespace: syncNamespace,
|
|
201
|
+
position: -1,
|
|
202
|
+
query: { feedIds: [clientFeedId] },
|
|
203
|
+
})
|
|
204
|
+
.pipe(RuntimeProvider.runPromise(serverRuntime.runtimeEffect));
|
|
205
|
+
|
|
206
|
+
expect(blocks).toHaveLength(1);
|
|
207
|
+
expect(blocks[0].data).toEqual(new Uint8Array([9, 8, 7]));
|
|
208
|
+
expect(blocks[0].position).toBeDefined();
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
test('requestPoll triggers best-effort pull for a space', async () => {
|
|
213
|
+
const spaceId = SpaceId.random();
|
|
214
|
+
const { serverRuntime, clientRuntime, serverFeedStore, clientFeedStore, syncer } = await createFeedSyncHarness({
|
|
215
|
+
spaceId,
|
|
216
|
+
pollingInterval: 60_000,
|
|
217
|
+
});
|
|
218
|
+
const serverFeedId = ObjectId.random();
|
|
219
|
+
|
|
220
|
+
await serverFeedStore
|
|
221
|
+
.appendLocal([
|
|
222
|
+
{
|
|
223
|
+
spaceId,
|
|
224
|
+
feedId: serverFeedId,
|
|
225
|
+
feedNamespace: syncNamespace,
|
|
226
|
+
data: new Uint8Array([1, 2, 3]),
|
|
227
|
+
},
|
|
228
|
+
])
|
|
229
|
+
.pipe(RuntimeProvider.runPromise(serverRuntime.runtimeEffect));
|
|
230
|
+
|
|
231
|
+
await syncer.open(new Context());
|
|
232
|
+
|
|
233
|
+
await vi.waitFor(async () => {
|
|
234
|
+
const { blocks } = await clientFeedStore
|
|
235
|
+
.query({
|
|
236
|
+
spaceId,
|
|
237
|
+
feedNamespace: syncNamespace,
|
|
238
|
+
position: -1,
|
|
239
|
+
query: { feedIds: [serverFeedId] },
|
|
240
|
+
})
|
|
241
|
+
.pipe(RuntimeProvider.runPromise(clientRuntime.runtimeEffect));
|
|
242
|
+
|
|
243
|
+
expect(blocks).toHaveLength(1);
|
|
244
|
+
expect(blocks[0].data).toEqual(new Uint8Array([1, 2, 3]));
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
await serverFeedStore
|
|
248
|
+
.appendLocal([
|
|
249
|
+
{
|
|
250
|
+
spaceId,
|
|
251
|
+
feedId: serverFeedId,
|
|
252
|
+
feedNamespace: syncNamespace,
|
|
253
|
+
data: new Uint8Array([4, 5, 6]),
|
|
254
|
+
},
|
|
255
|
+
])
|
|
256
|
+
.pipe(RuntimeProvider.runPromise(serverRuntime.runtimeEffect));
|
|
257
|
+
|
|
258
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
259
|
+
{
|
|
260
|
+
const { blocks } = await clientFeedStore
|
|
261
|
+
.query({
|
|
262
|
+
spaceId,
|
|
263
|
+
feedNamespace: syncNamespace,
|
|
264
|
+
position: -1,
|
|
265
|
+
query: { feedIds: [serverFeedId] },
|
|
266
|
+
})
|
|
267
|
+
.pipe(RuntimeProvider.runPromise(clientRuntime.runtimeEffect));
|
|
268
|
+
expect(blocks).toHaveLength(1);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
syncer.schedulePoll();
|
|
272
|
+
|
|
273
|
+
await vi.waitFor(async () => {
|
|
274
|
+
const { blocks } = await clientFeedStore
|
|
275
|
+
.query({
|
|
276
|
+
spaceId,
|
|
277
|
+
feedNamespace: syncNamespace,
|
|
278
|
+
position: -1,
|
|
279
|
+
query: { feedIds: [serverFeedId] },
|
|
280
|
+
})
|
|
281
|
+
.pipe(RuntimeProvider.runPromise(clientRuntime.runtimeEffect));
|
|
282
|
+
|
|
283
|
+
expect(blocks).toHaveLength(2);
|
|
284
|
+
expect(blocks[1].data).toEqual(new Uint8Array([4, 5, 6]));
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
test('syncs all configured namespaces', async () => {
|
|
289
|
+
const spaceId = SpaceId.random();
|
|
290
|
+
const { serverRuntime, clientRuntime, serverFeedStore, clientFeedStore, syncer } = await createFeedSyncHarness({
|
|
291
|
+
spaceId,
|
|
292
|
+
syncNamespaces,
|
|
293
|
+
});
|
|
294
|
+
const serverDataFeedId = ObjectId.random();
|
|
295
|
+
const serverTraceFeedId = ObjectId.random();
|
|
296
|
+
|
|
297
|
+
await serverFeedStore
|
|
298
|
+
.appendLocal([
|
|
299
|
+
{
|
|
300
|
+
spaceId,
|
|
301
|
+
feedId: serverDataFeedId,
|
|
302
|
+
feedNamespace: FeedProtocol.WellKnownNamespaces.data,
|
|
303
|
+
data: new Uint8Array([1, 2, 3]),
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
spaceId,
|
|
307
|
+
feedId: serverTraceFeedId,
|
|
308
|
+
feedNamespace: FeedProtocol.WellKnownNamespaces.trace,
|
|
309
|
+
data: new Uint8Array([7, 8, 9]),
|
|
310
|
+
},
|
|
311
|
+
])
|
|
312
|
+
.pipe(RuntimeProvider.runPromise(serverRuntime.runtimeEffect));
|
|
313
|
+
|
|
314
|
+
await syncer.open(new Context());
|
|
315
|
+
|
|
316
|
+
await vi.waitFor(async () => {
|
|
317
|
+
const dataResult = await clientFeedStore
|
|
318
|
+
.query({
|
|
319
|
+
spaceId,
|
|
320
|
+
feedNamespace: FeedProtocol.WellKnownNamespaces.data,
|
|
321
|
+
position: -1,
|
|
322
|
+
query: { feedIds: [serverDataFeedId] },
|
|
323
|
+
})
|
|
324
|
+
.pipe(RuntimeProvider.runPromise(clientRuntime.runtimeEffect));
|
|
325
|
+
const traceResult = await clientFeedStore
|
|
326
|
+
.query({
|
|
327
|
+
spaceId,
|
|
328
|
+
feedNamespace: FeedProtocol.WellKnownNamespaces.trace,
|
|
329
|
+
position: -1,
|
|
330
|
+
query: { feedIds: [serverTraceFeedId] },
|
|
331
|
+
})
|
|
332
|
+
.pipe(RuntimeProvider.runPromise(clientRuntime.runtimeEffect));
|
|
333
|
+
|
|
334
|
+
expect(dataResult.blocks).toHaveLength(1);
|
|
335
|
+
expect(traceResult.blocks).toHaveLength(1);
|
|
336
|
+
expect(dataResult.blocks[0].data).toEqual(new Uint8Array([1, 2, 3]));
|
|
337
|
+
expect(traceResult.blocks[0].data).toEqual(new Uint8Array([7, 8, 9]));
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
});
|