@dxos/client-services 0.6.13 → 0.6.14-main.1366248
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-CRXXOI45.mjs → chunk-KQURG5PQ.mjs} +6537 -5279
- package/dist/lib/browser/chunk-KQURG5PQ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +7 -3
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +20 -9
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-PZ3JJJ3K.cjs → chunk-WNXJ7EP5.cjs} +6324 -5068
- package/dist/lib/node/chunk-WNXJ7EP5.cjs.map +7 -0
- package/dist/lib/node/index.cjs +50 -46
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +26 -14
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node-esm/chunk-OQSP5ADY.mjs +8982 -0
- package/dist/lib/node-esm/chunk-OQSP5ADY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +420 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +431 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- 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 +35 -0
- package/dist/types/src/packlets/agents/edge-agent-manager.d.ts.map +1 -0
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts +10 -0
- package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -0
- package/dist/types/src/packlets/agents/index.d.ts +3 -0
- package/dist/types/src/packlets/agents/index.d.ts.map +1 -0
- package/dist/types/src/packlets/devices/devices-service.d.ts +3 -1
- package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
- package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.node.test.d.ts +2 -0
- package/dist/types/src/packlets/identity/authenticator.node.test.d.ts.map +1 -0
- package/dist/types/src/packlets/identity/contacts-service.d.ts +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 +28 -9
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts +18 -0
- package/dist/types/src/packlets/identity/identity-recovery-manager.d.ts.map +1 -0
- package/dist/types/src/packlets/identity/identity-service.d.ts +7 -2
- package/dist/types/src/packlets/identity/identity-service.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/identity.d.ts +12 -3
- package/dist/types/src/packlets/identity/identity.d.ts.map +1 -1
- 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 +31 -0
- package/dist/types/src/packlets/invitations/edge-invitation-handler.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts +2 -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 +2 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-state.d.ts +19 -0
- package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -0
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +8 -8
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +14 -9
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +2 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +7 -3
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +5 -3
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts +4 -0
- package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/edge-feed-replicator.test.d.ts +2 -0
- package/dist/types/src/packlets/spaces/edge-feed-replicator.test.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts +1 -1
- package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts +35 -6
- package/dist/types/src/packlets/spaces/notarization-plugin.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -2
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/worker/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/testing/setup.d.ts +3 -0
- package/dist/types/src/testing/setup.d.ts.map +1 -0
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +44 -45
- package/src/index.ts +1 -0
- package/src/packlets/agents/edge-agent-manager.ts +163 -0
- package/src/packlets/agents/edge-agent-service.ts +42 -0
- package/src/packlets/agents/index.ts +6 -0
- package/src/packlets/devices/devices-service.test.ts +4 -5
- package/src/packlets/devices/devices-service.ts +18 -7
- package/src/packlets/diagnostics/diagnostics-broadcast.ts +1 -0
- package/src/packlets/identity/{authenticator.test.ts → authenticator.node.test.ts} +2 -3
- package/src/packlets/identity/authenticator.ts +5 -2
- package/src/packlets/identity/contacts-service.ts +1 -1
- package/src/packlets/identity/identity-manager.test.ts +31 -16
- package/src/packlets/identity/identity-manager.ts +76 -32
- package/src/packlets/identity/identity-recovery-manager.ts +95 -0
- package/src/packlets/identity/identity-service.test.ts +5 -8
- package/src/packlets/identity/identity-service.ts +11 -5
- package/src/packlets/identity/identity.test.ts +141 -239
- package/src/packlets/identity/identity.ts +60 -17
- package/src/packlets/invitations/device-invitation-protocol.test.ts +7 -4
- package/src/packlets/invitations/device-invitation-protocol.ts +8 -2
- package/src/packlets/invitations/edge-invitation-handler.ts +188 -0
- package/src/packlets/invitations/invitation-guest-extenstion.ts +13 -9
- package/src/packlets/invitations/invitation-host-extension.ts +15 -17
- package/src/packlets/invitations/invitation-state.ts +112 -0
- package/src/packlets/invitations/invitations-handler.test.ts +19 -15
- package/src/packlets/invitations/invitations-handler.ts +91 -126
- package/src/packlets/invitations/invitations-service.ts +5 -1
- package/src/packlets/invitations/space-invitation-protocol.test.ts +4 -3
- package/src/packlets/invitations/space-invitation-protocol.ts +5 -0
- package/src/packlets/logging/logging.test.ts +1 -2
- package/src/packlets/network/network-service.test.ts +2 -3
- package/src/packlets/services/service-context.test.ts +3 -1
- package/src/packlets/services/service-context.ts +113 -35
- package/src/packlets/services/service-host.test.ts +8 -12
- package/src/packlets/services/service-host.ts +26 -8
- package/src/packlets/services/service-registry.test.ts +1 -2
- package/src/packlets/spaces/data-space-manager.test.ts +2 -2
- package/src/packlets/spaces/data-space-manager.ts +44 -7
- package/src/packlets/spaces/data-space.ts +37 -6
- package/src/packlets/spaces/edge-feed-replicator.test.ts +257 -0
- package/src/packlets/spaces/edge-feed-replicator.ts +84 -22
- package/src/packlets/spaces/epoch-migrations.ts +2 -2
- package/src/packlets/spaces/notarization-plugin.test.ts +10 -7
- package/src/packlets/spaces/notarization-plugin.ts +196 -29
- package/src/packlets/spaces/spaces-service.test.ts +5 -9
- package/src/packlets/spaces/spaces-service.ts +6 -1
- package/src/packlets/storage/storage.ts +0 -1
- package/src/packlets/system/system-service.test.ts +1 -2
- package/src/packlets/testing/invitation-utils.ts +7 -0
- package/src/packlets/testing/test-builder.ts +7 -4
- package/src/packlets/worker/worker-runtime.ts +2 -2
- package/src/testing/setup.ts +11 -0
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-CRXXOI45.mjs.map +0 -7
- package/dist/lib/node/chunk-PZ3JJJ3K.cjs.map +0 -7
- package/dist/types/src/packlets/identity/authenticator.test.d.ts +0 -2
- package/dist/types/src/packlets/identity/authenticator.test.d.ts.map +0 -1
- package/dist/types/src/packlets/services/automerge-host.test.d.ts +0 -2
- package/dist/types/src/packlets/services/automerge-host.test.d.ts.map +0 -1
- package/src/packlets/services/automerge-host.test.ts +0 -60
|
@@ -60,7 +60,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
60
60
|
return this._serializeSpace(space);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
async updateSpace({ spaceKey, state }: UpdateSpaceRequest) {
|
|
63
|
+
async updateSpace({ spaceKey, state, edgeReplication }: UpdateSpaceRequest) {
|
|
64
64
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
65
65
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise(new SpaceNotFoundError(spaceKey));
|
|
66
66
|
|
|
@@ -77,6 +77,10 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
77
77
|
throw new ApiError('Invalid space state');
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
if (edgeReplication !== undefined) {
|
|
82
|
+
await dataSpaceManager.setSpaceEdgeReplicationSetting(spaceKey, edgeReplication);
|
|
83
|
+
}
|
|
80
84
|
}
|
|
81
85
|
|
|
82
86
|
async updateMemberRole(request: UpdateMemberRoleRequest): Promise<void> {
|
|
@@ -308,6 +312,7 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
308
312
|
creator: space.inner.spaceState.creator?.key,
|
|
309
313
|
cache: space.cache,
|
|
310
314
|
metrics: space.metrics,
|
|
315
|
+
edgeReplication: space.getEdgeReplicationSetting(),
|
|
311
316
|
};
|
|
312
317
|
}
|
|
313
318
|
|
|
@@ -14,7 +14,6 @@ import { getRootPath } from './util';
|
|
|
14
14
|
// TODO(burdon): Factor out.
|
|
15
15
|
export const createStorageObjects = (config: Runtime.Client.Storage) => {
|
|
16
16
|
const { persistent = false, keyStore, dataStore } = config ?? {};
|
|
17
|
-
|
|
18
17
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
19
18
|
throw new InvalidConfigError('RAM storage cannot be used in persistent mode.');
|
|
20
19
|
}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { expect } from '
|
|
5
|
+
import { beforeEach, describe, expect, test } from 'vitest';
|
|
6
6
|
|
|
7
7
|
import { Event, Trigger } from '@dxos/async';
|
|
8
8
|
import { Config } from '@dxos/config';
|
|
9
9
|
import { type SystemService, SystemStatus, type QueryStatusResponse } from '@dxos/protocols/proto/dxos/client/services';
|
|
10
|
-
import { beforeEach, describe, test } from '@dxos/test';
|
|
11
10
|
|
|
12
11
|
import { SystemServiceImpl } from './system-service';
|
|
13
12
|
|
|
@@ -62,6 +62,7 @@ export const performInvitation = ({
|
|
|
62
62
|
}: PerformInvitationParams): [Promise<Result>, Promise<Result>] => {
|
|
63
63
|
let guestError = false;
|
|
64
64
|
let guestConnected = false;
|
|
65
|
+
let wereConnected = false;
|
|
65
66
|
const hostComplete = new Trigger<Result>();
|
|
66
67
|
const guestComplete = new Trigger<Result>();
|
|
67
68
|
const authCode = new Trigger<string>();
|
|
@@ -72,12 +73,17 @@ export const performInvitation = ({
|
|
|
72
73
|
switch (hostInvitation.state) {
|
|
73
74
|
case Invitation.State.CONNECTING: {
|
|
74
75
|
if (guestConnected) {
|
|
76
|
+
if (wereConnected) {
|
|
77
|
+
hostComplete.wake({ invitation: hostInvitation });
|
|
78
|
+
}
|
|
75
79
|
break;
|
|
76
80
|
}
|
|
81
|
+
|
|
77
82
|
guestConnected = true;
|
|
78
83
|
if (hooks?.host?.onConnecting?.(hostObservable)) {
|
|
79
84
|
break;
|
|
80
85
|
}
|
|
86
|
+
|
|
81
87
|
const guestObservable = acceptInvitation(guest, hostInvitation, guestDeviceProfile);
|
|
82
88
|
guestObservable.subscribe(
|
|
83
89
|
async (guestInvitation: Invitation) => {
|
|
@@ -153,6 +159,7 @@ export const performInvitation = ({
|
|
|
153
159
|
}
|
|
154
160
|
|
|
155
161
|
case Invitation.State.CONNECTED: {
|
|
162
|
+
wereConnected = true;
|
|
156
163
|
hooks?.host?.onConnected?.(hostObservable);
|
|
157
164
|
break;
|
|
158
165
|
}
|
|
@@ -6,8 +6,7 @@ import { type Config } from '@dxos/config';
|
|
|
6
6
|
import { Context } from '@dxos/context';
|
|
7
7
|
import { createCredentialSignerWithChain, CredentialGenerator } from '@dxos/credentials';
|
|
8
8
|
import { failUndefined } from '@dxos/debug';
|
|
9
|
-
import { EchoHost } from '@dxos/echo-
|
|
10
|
-
import { MetadataStore, SpaceManager, valueEncoding, MeshEchoReplicator } from '@dxos/echo-pipeline';
|
|
9
|
+
import { EchoHost, MetadataStore, SpaceManager, valueEncoding, MeshEchoReplicator } from '@dxos/echo-pipeline';
|
|
11
10
|
import { FeedFactory, FeedStore } from '@dxos/feed-store';
|
|
12
11
|
import { Keyring } from '@dxos/keyring';
|
|
13
12
|
import { type LevelDB } from '@dxos/kv-store';
|
|
@@ -54,8 +53,8 @@ export const createServiceContext = async ({
|
|
|
54
53
|
const level = createTestLevel();
|
|
55
54
|
await level.open();
|
|
56
55
|
|
|
57
|
-
return new ServiceContext(storage, level, networkManager, signalManager, undefined, {
|
|
58
|
-
invitationConnectionDefaultParams: { controlHeartbeatInterval: 200 },
|
|
56
|
+
return new ServiceContext(storage, level, networkManager, signalManager, undefined, undefined, {
|
|
57
|
+
invitationConnectionDefaultParams: { teleport: { controlHeartbeatInterval: 200 } },
|
|
59
58
|
...runtimeParams,
|
|
60
59
|
});
|
|
61
60
|
};
|
|
@@ -219,6 +218,10 @@ export class TestPeer {
|
|
|
219
218
|
|
|
220
219
|
async createIdentity() {
|
|
221
220
|
this._props.signingContext ??= await createSigningContext(this.keyring);
|
|
221
|
+
this.networkManager.setPeerInfo({
|
|
222
|
+
identityKey: this._props.signingContext.identityKey.toHex(),
|
|
223
|
+
peerKey: this._props.signingContext.deviceKey.toHex(),
|
|
224
|
+
});
|
|
222
225
|
}
|
|
223
226
|
|
|
224
227
|
async destroy() {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
WebsocketSignalManager,
|
|
15
15
|
setIdentityTags,
|
|
16
16
|
} from '@dxos/messaging';
|
|
17
|
-
import {
|
|
17
|
+
import { RtcTransportProxyFactory } from '@dxos/network-manager';
|
|
18
18
|
import { type RpcPort } from '@dxos/rpc';
|
|
19
19
|
import { type MaybePromise } from '@dxos/util';
|
|
20
20
|
|
|
@@ -46,7 +46,7 @@ export class WorkerRuntime {
|
|
|
46
46
|
private readonly _acquireLock: () => Promise<void>;
|
|
47
47
|
private readonly _releaseLock: () => void;
|
|
48
48
|
private readonly _onStop?: () => Promise<void>;
|
|
49
|
-
private readonly _transportFactory = new
|
|
49
|
+
private readonly _transportFactory = new RtcTransportProxyFactory();
|
|
50
50
|
private readonly _ready = new Trigger<Error | undefined>();
|
|
51
51
|
private readonly _sessions = new Set<WorkerSession>();
|
|
52
52
|
private readonly _clientServices!: ClientServicesHost;
|
package/src/version.ts
CHANGED