@dxos/client-services 0.5.8-main.f69e6e4 → 0.5.8
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-BHK4D7JV.mjs → chunk-JECXTGZA.mjs} +27 -34
- package/dist/lib/browser/chunk-JECXTGZA.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +4 -4
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-PIZD2NZ4.cjs → chunk-OR7LRWDY.cjs} +27 -34
- package/dist/lib/node/chunk-OR7LRWDY.cjs.map +7 -0
- package/dist/lib/node/index.cjs +44 -44
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +10 -10
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/devtools/network.d.ts +4 -4
- package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts +2 -2
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts +5 -4
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +0 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +3 -3
- package/dist/types/src/packlets/testing/test-builder.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/package.json +36 -36
- package/src/packlets/devtools/network.ts +4 -4
- package/src/packlets/identity/identity-manager.test.ts +2 -2
- package/src/packlets/identity/identity.test.ts +4 -8
- package/src/packlets/invitations/invitations-handler.ts +2 -2
- package/src/packlets/network/network-service.ts +2 -2
- package/src/packlets/services/service-context.ts +3 -3
- package/src/packlets/services/service-host.ts +7 -6
- package/src/packlets/spaces/data-space.ts +1 -11
- package/src/packlets/spaces/spaces-service.ts +0 -1
- package/src/packlets/testing/test-builder.ts +4 -4
- package/src/version.ts +5 -1
- package/dist/lib/browser/chunk-BHK4D7JV.mjs.map +0 -7
- package/dist/lib/node/chunk-PIZD2NZ4.cjs.map +0 -7
|
@@ -7,7 +7,6 @@ import expect from 'expect';
|
|
|
7
7
|
import { Context } from '@dxos/context';
|
|
8
8
|
import { CredentialGenerator, verifyCredential } from '@dxos/credentials';
|
|
9
9
|
import {
|
|
10
|
-
createIdFromSpaceKey,
|
|
11
10
|
MetadataStore,
|
|
12
11
|
MOCK_AUTH_PROVIDER,
|
|
13
12
|
MOCK_AUTH_VERIFIER,
|
|
@@ -21,7 +20,7 @@ import { FeedFactory, FeedStore } from '@dxos/feed-store';
|
|
|
21
20
|
import { Keyring } from '@dxos/keyring';
|
|
22
21
|
import { type PublicKey } from '@dxos/keys';
|
|
23
22
|
import { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';
|
|
24
|
-
import { MemoryTransportFactory,
|
|
23
|
+
import { MemoryTransportFactory, NetworkManager } from '@dxos/network-manager';
|
|
25
24
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
26
25
|
import { AdmittedFeed } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
27
26
|
import { createStorage, StorageType } from '@dxos/random-access-storage';
|
|
@@ -79,7 +78,7 @@ describe('identity/identity', () => {
|
|
|
79
78
|
credentialAuthenticator: MOCK_AUTH_VERIFIER,
|
|
80
79
|
},
|
|
81
80
|
blobStore,
|
|
82
|
-
networkManager: new
|
|
81
|
+
networkManager: new NetworkManager({
|
|
83
82
|
signalManager: new MemorySignalManager(new MemorySignalManagerContext()),
|
|
84
83
|
transportFactory: MemoryTransportFactory,
|
|
85
84
|
}),
|
|
@@ -87,7 +86,6 @@ describe('identity/identity', () => {
|
|
|
87
86
|
|
|
88
87
|
await metadataStore.setIdentityRecord({ haloSpace: { key: spaceKey }, identityKey, deviceKey });
|
|
89
88
|
const space: Space = new Space({
|
|
90
|
-
id: await createIdFromSpaceKey(spaceKey),
|
|
91
89
|
spaceKey,
|
|
92
90
|
protocol,
|
|
93
91
|
genesisFeed: controlFeed,
|
|
@@ -195,7 +193,7 @@ describe('identity/identity', () => {
|
|
|
195
193
|
credentialAuthenticator: MOCK_AUTH_VERIFIER, // createHaloAuthVerifier(() => identity.authorizedDeviceKeys),
|
|
196
194
|
},
|
|
197
195
|
blobStore,
|
|
198
|
-
networkManager: new
|
|
196
|
+
networkManager: new NetworkManager({
|
|
199
197
|
signalManager: new MemorySignalManager(signalContext),
|
|
200
198
|
transportFactory: MemoryTransportFactory,
|
|
201
199
|
}),
|
|
@@ -203,7 +201,6 @@ describe('identity/identity', () => {
|
|
|
203
201
|
|
|
204
202
|
await metadataStore.setIdentityRecord({ haloSpace: { key: spaceKey }, identityKey, deviceKey });
|
|
205
203
|
const space = new Space({
|
|
206
|
-
id: await createIdFromSpaceKey(spaceKey),
|
|
207
204
|
spaceKey,
|
|
208
205
|
protocol,
|
|
209
206
|
genesisFeed: controlFeed,
|
|
@@ -284,7 +281,7 @@ describe('identity/identity', () => {
|
|
|
284
281
|
credentialAuthenticator: MOCK_AUTH_VERIFIER, // createHaloAuthVerifier(() => identity.authorizedDeviceKeys),
|
|
285
282
|
},
|
|
286
283
|
blobStore,
|
|
287
|
-
networkManager: new
|
|
284
|
+
networkManager: new NetworkManager({
|
|
288
285
|
signalManager: new MemorySignalManager(signalContext),
|
|
289
286
|
transportFactory: MemoryTransportFactory,
|
|
290
287
|
}),
|
|
@@ -296,7 +293,6 @@ describe('identity/identity', () => {
|
|
|
296
293
|
deviceKey,
|
|
297
294
|
});
|
|
298
295
|
const space = new Space({
|
|
299
|
-
id: await createIdFromSpaceKey(spaceKey),
|
|
300
296
|
spaceKey,
|
|
301
297
|
protocol,
|
|
302
298
|
genesisFeed: await feedStore.openFeed(genesisFeedKey),
|
|
@@ -9,7 +9,7 @@ import { createKeyPair, sign } from '@dxos/crypto';
|
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { PublicKey } from '@dxos/keys';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
|
-
import { createTeleportProtocolFactory, type
|
|
12
|
+
import { createTeleportProtocolFactory, type NetworkManager, type SwarmConnection } from '@dxos/network-manager';
|
|
13
13
|
import { InvalidInvitationExtensionRoleError, trace } from '@dxos/protocols';
|
|
14
14
|
import { type AdmissionKeypair, Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
15
15
|
import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
@@ -61,7 +61,7 @@ export class InvitationsHandler {
|
|
|
61
61
|
* @internal
|
|
62
62
|
*/
|
|
63
63
|
constructor(
|
|
64
|
-
private readonly _networkManager:
|
|
64
|
+
private readonly _networkManager: NetworkManager,
|
|
65
65
|
private readonly _defaultTeleportParams?: Partial<TeleportParams>,
|
|
66
66
|
) {}
|
|
67
67
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { Stream } from '@dxos/codec-protobuf';
|
|
6
6
|
import { type SignalManager } from '@dxos/messaging';
|
|
7
|
-
import { type
|
|
7
|
+
import { type NetworkManager } from '@dxos/network-manager';
|
|
8
8
|
import {
|
|
9
9
|
type NetworkService,
|
|
10
10
|
type NetworkStatus,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
export class NetworkServiceImpl implements NetworkService {
|
|
15
15
|
constructor(
|
|
16
|
-
private readonly networkManager:
|
|
16
|
+
private readonly networkManager: NetworkManager,
|
|
17
17
|
private readonly signalManager: SignalManager,
|
|
18
18
|
) {}
|
|
19
19
|
|
|
@@ -15,7 +15,7 @@ import { PublicKey } from '@dxos/keys';
|
|
|
15
15
|
import { type LevelDB } from '@dxos/kv-store';
|
|
16
16
|
import { log } from '@dxos/log';
|
|
17
17
|
import { type SignalManager } from '@dxos/messaging';
|
|
18
|
-
import { type
|
|
18
|
+
import { type NetworkManager } from '@dxos/network-manager';
|
|
19
19
|
import { InvalidStorageVersionError, STORAGE_VERSION, trace } from '@dxos/protocols';
|
|
20
20
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
21
21
|
import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
import {
|
|
36
36
|
DeviceInvitationProtocol,
|
|
37
37
|
InvitationsHandler,
|
|
38
|
-
InvitationsManager,
|
|
39
38
|
SpaceInvitationProtocol,
|
|
40
39
|
type InvitationProtocol,
|
|
41
40
|
} from '../invitations';
|
|
41
|
+
import { InvitationsManager } from '../invitations/invitations-manager';
|
|
42
42
|
import { DataSpaceManager, type DataSpaceManagerRuntimeParams, type SigningContext } from '../spaces';
|
|
43
43
|
|
|
44
44
|
export type ServiceContextRuntimeParams = IdentityManagerRuntimeParams &
|
|
@@ -81,7 +81,7 @@ export class ServiceContext extends Resource {
|
|
|
81
81
|
constructor(
|
|
82
82
|
public readonly storage: Storage,
|
|
83
83
|
public readonly level: LevelDB,
|
|
84
|
-
public readonly networkManager:
|
|
84
|
+
public readonly networkManager: NetworkManager,
|
|
85
85
|
public readonly signalManager: SignalManager,
|
|
86
86
|
public readonly _runtimeParams?: ServiceContextRuntimeParams,
|
|
87
87
|
) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Event, synchronized } from '@dxos/async';
|
|
6
|
-
import { clientServiceBundle, defaultKey, type ClientServices,
|
|
6
|
+
import { clientServiceBundle, defaultKey, type ClientServices, Properties } from '@dxos/client-protocol';
|
|
7
7
|
import { type Config } from '@dxos/config';
|
|
8
8
|
import { Context } from '@dxos/context';
|
|
9
9
|
import { type ObjectStructure, encodeReference, type SpaceDoc } from '@dxos/echo-protocol';
|
|
@@ -13,7 +13,7 @@ import { PublicKey } from '@dxos/keys';
|
|
|
13
13
|
import { type LevelDB } from '@dxos/kv-store';
|
|
14
14
|
import { log } from '@dxos/log';
|
|
15
15
|
import { WebsocketSignalManager, type SignalManager } from '@dxos/messaging';
|
|
16
|
-
import {
|
|
16
|
+
import { NetworkManager, createSimplePeerTransportFactory, type TransportFactory } from '@dxos/network-manager';
|
|
17
17
|
import { trace } from '@dxos/protocols';
|
|
18
18
|
import { SystemStatus } from '@dxos/protocols/proto/dxos/client/services';
|
|
19
19
|
import { type Storage } from '@dxos/random-access-storage';
|
|
@@ -79,7 +79,7 @@ export class ClientServicesHost {
|
|
|
79
79
|
private _config?: Config;
|
|
80
80
|
private readonly _statusUpdate = new Event<void>();
|
|
81
81
|
private _signalManager?: SignalManager;
|
|
82
|
-
private _networkManager?:
|
|
82
|
+
private _networkManager?: NetworkManager;
|
|
83
83
|
private _storage?: Storage;
|
|
84
84
|
private _level?: LevelDB;
|
|
85
85
|
private _callbacks?: ClientServicesHostCallbacks;
|
|
@@ -210,7 +210,7 @@ export class ClientServicesHost {
|
|
|
210
210
|
this._signalManager = signalManager;
|
|
211
211
|
|
|
212
212
|
invariant(!this._networkManager, 'network manager already set');
|
|
213
|
-
this._networkManager = new
|
|
213
|
+
this._networkManager = new NetworkManager({
|
|
214
214
|
log: connectionLog,
|
|
215
215
|
transportFactory,
|
|
216
216
|
signalManager,
|
|
@@ -356,13 +356,13 @@ export class ClientServicesHost {
|
|
|
356
356
|
|
|
357
357
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
358
358
|
invariant(automergeIndex);
|
|
359
|
-
const document = this._serviceContext.echoHost.automergeRepo.find<SpaceDoc>(automergeIndex as any);
|
|
359
|
+
const document = await this._serviceContext.echoHost.automergeRepo.find<SpaceDoc>(automergeIndex as any);
|
|
360
360
|
await document.whenReady();
|
|
361
361
|
|
|
362
362
|
// TODO(dmaretskyi): Better API for low-level data access.
|
|
363
363
|
const properties: ObjectStructure = {
|
|
364
364
|
system: {
|
|
365
|
-
type: encodeReference(getTypeReference(
|
|
365
|
+
type: encodeReference(getTypeReference(Properties)!),
|
|
366
366
|
},
|
|
367
367
|
data: {
|
|
368
368
|
[defaultKey]: identity.identityKey.toHex(),
|
|
@@ -377,6 +377,7 @@ export class ClientServicesHost {
|
|
|
377
377
|
});
|
|
378
378
|
|
|
379
379
|
await this._serviceContext.echoHost.flush();
|
|
380
|
+
|
|
380
381
|
return identity;
|
|
381
382
|
}
|
|
382
383
|
}
|
|
@@ -9,7 +9,6 @@ import { timed, warnAfterTimeout } from '@dxos/debug';
|
|
|
9
9
|
import { type EchoHost } from '@dxos/echo-db';
|
|
10
10
|
import {
|
|
11
11
|
AutomergeDocumentLoaderImpl,
|
|
12
|
-
createIdFromSpaceKey,
|
|
13
12
|
createMappedFeedWriter,
|
|
14
13
|
type MetadataStore,
|
|
15
14
|
type Space,
|
|
@@ -142,11 +141,6 @@ export class DataSpace {
|
|
|
142
141
|
log('new state', { state: SpaceState[this._state] });
|
|
143
142
|
}
|
|
144
143
|
|
|
145
|
-
@trace.info()
|
|
146
|
-
get id() {
|
|
147
|
-
return this._inner.id;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
144
|
@trace.info()
|
|
151
145
|
get key() {
|
|
152
146
|
return this._inner.key;
|
|
@@ -482,11 +476,7 @@ export class DataSpace {
|
|
|
482
476
|
invariant(typeof newRoot.url === 'string' && newRoot.url.length > 0);
|
|
483
477
|
|
|
484
478
|
// Create new automerge documents for all objects.
|
|
485
|
-
const docLoader = new AutomergeDocumentLoaderImpl(
|
|
486
|
-
await createIdFromSpaceKey(this.key),
|
|
487
|
-
this._echoHost.automergeRepo,
|
|
488
|
-
this.key,
|
|
489
|
-
);
|
|
479
|
+
const docLoader = new AutomergeDocumentLoaderImpl(this.key, this._echoHost.automergeRepo);
|
|
490
480
|
await docLoader.loadSpaceRootDocHandle(this._ctx, { rootUrl: newRoot.url });
|
|
491
481
|
|
|
492
482
|
otherObjects.forEach(([key, value]) => {
|
|
@@ -216,7 +216,6 @@ export class SpacesServiceImpl implements SpacesService {
|
|
|
216
216
|
|
|
217
217
|
private _serializeSpace(space: DataSpace): Space {
|
|
218
218
|
return {
|
|
219
|
-
id: space.id,
|
|
220
219
|
spaceKey: space.key,
|
|
221
220
|
state: space.state,
|
|
222
221
|
error: space.error ? encodeError(space.error) : undefined,
|
|
@@ -13,7 +13,7 @@ import { Keyring } from '@dxos/keyring';
|
|
|
13
13
|
import { type LevelDB } from '@dxos/kv-store';
|
|
14
14
|
import { createTestLevel } from '@dxos/kv-store/testing';
|
|
15
15
|
import { MemorySignalManager, MemorySignalManagerContext } from '@dxos/messaging';
|
|
16
|
-
import { MemoryTransportFactory,
|
|
16
|
+
import { MemoryTransportFactory, NetworkManager } from '@dxos/network-manager';
|
|
17
17
|
import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
18
18
|
import { createStorage, StorageType, type Storage } from '@dxos/random-access-storage';
|
|
19
19
|
import { BlobStore } from '@dxos/teleport-extension-object-sync';
|
|
@@ -42,7 +42,7 @@ export const createServiceContext = async ({
|
|
|
42
42
|
storage?: Storage;
|
|
43
43
|
} = {}) => {
|
|
44
44
|
const signalManager = new MemorySignalManager(signalContext);
|
|
45
|
-
const networkManager = new
|
|
45
|
+
const networkManager = new NetworkManager({
|
|
46
46
|
signalManager,
|
|
47
47
|
transportFactory: MemoryTransportFactory,
|
|
48
48
|
});
|
|
@@ -96,7 +96,7 @@ export type TestPeerProps = {
|
|
|
96
96
|
feedStore?: FeedStore<any>;
|
|
97
97
|
metadataStore?: MetadataStore;
|
|
98
98
|
keyring?: Keyring;
|
|
99
|
-
networkManager?:
|
|
99
|
+
networkManager?: NetworkManager;
|
|
100
100
|
spaceManager?: SpaceManager;
|
|
101
101
|
dataSpaceManager?: DataSpaceManager;
|
|
102
102
|
snapshotStore?: SnapshotStore;
|
|
@@ -155,7 +155,7 @@ export class TestPeer {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
get networkManager() {
|
|
158
|
-
return (this._props.networkManager ??= new
|
|
158
|
+
return (this._props.networkManager ??= new NetworkManager({
|
|
159
159
|
signalManager: new MemorySignalManager(this.signalContext),
|
|
160
160
|
transportFactory: MemoryTransportFactory,
|
|
161
161
|
}));
|
package/src/version.ts
CHANGED