@dxos/client-services 0.1.58-main.f4192cb → 0.1.58-main.f69fa2f
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-ZQHNJIE4.mjs → chunk-5WTEAZYV.mjs} +62 -30
- package/dist/lib/browser/{chunk-ZQHNJIE4.mjs.map → chunk-5WTEAZYV.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +3 -3
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +60 -28
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +62 -30
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -34
- package/src/packlets/network/network-service.ts +1 -4
- package/src/packlets/services/service-host.test.ts +3 -3
- package/src/packlets/services/service-host.ts +39 -3
- package/src/packlets/spaces/data-space-manager.test.ts +1 -1
- package/src/packlets/storage/storage.ts +9 -9
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/network/network-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAEhH,qBAAa,kBAAmB,YAAW,cAAc;
|
|
1
|
+
{"version":3,"file":"network-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/network/network-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAEhH,qBAAa,kBAAmB,YAAW,cAAc;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc;IAAkB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAA9D,cAAc,EAAE,cAAc,EAAmB,aAAa,EAAE,aAAa;IAE1G,WAAW;IAoBL,YAAY,CAAC,OAAO,EAAE,mBAAmB;CAGhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,cAAc,
|
|
1
|
+
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,cAAc,EAA0B,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAOxC,OAAO,EAAE,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAoD,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI3G,OAAO,EAAE,OAAO,EAAE,MAA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AK,kBAER;IAED,IAAI,OAAO,YAEV;IAED,IAAI,OAAO,YAEV;IAED,IAAI,SAAS,mBAUZ;IAED,IAAI,aAAa,kBAEhB;IAED,IAAI,SAAS,cAEZ;IAED,IAAI,aAAa,kBAEhB;IAED,IAAI,cAAc,mBAKjB;IAED,IAAI,YAAY,iBASf;IAED,IAAI,QAAQ,mBAEX;IAED,IAAI,gBAAgB,qBASnB;IAEK,cAAc;IAId,OAAO;CAGd;AAED,eAAO,MAAM,oBAAoB,YAAmB,OAAO,KAAG,QAAQ,cAAc,CAgBnF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.1.58-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.1.58-main.f69fa2f";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.1.58-main.
|
|
3
|
+
"version": "0.1.58-main.f69fa2f",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -21,42 +21,43 @@
|
|
|
21
21
|
"src"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@dxos/async": "0.1.58-main.
|
|
25
|
-
"@dxos/client-protocol": "0.1.58-main.
|
|
26
|
-
"@dxos/codec-protobuf": "0.1.58-main.
|
|
27
|
-
"@dxos/config": "0.1.58-main.
|
|
28
|
-
"@dxos/context": "0.1.58-main.
|
|
29
|
-
"@dxos/credentials": "0.1.58-main.
|
|
30
|
-
"@dxos/crypto": "0.1.58-main.
|
|
31
|
-
"@dxos/debug": "0.1.58-main.
|
|
32
|
-
"@dxos/document-model": "0.1.58-main.
|
|
33
|
-
"@dxos/echo-db": "0.1.58-main.
|
|
34
|
-
"@dxos/echo-pipeline": "0.1.58-main.
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/teleport
|
|
50
|
-
"@dxos/teleport-extension-
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
24
|
+
"@dxos/async": "0.1.58-main.f69fa2f",
|
|
25
|
+
"@dxos/client-protocol": "0.1.58-main.f69fa2f",
|
|
26
|
+
"@dxos/codec-protobuf": "0.1.58-main.f69fa2f",
|
|
27
|
+
"@dxos/config": "0.1.58-main.f69fa2f",
|
|
28
|
+
"@dxos/context": "0.1.58-main.f69fa2f",
|
|
29
|
+
"@dxos/credentials": "0.1.58-main.f69fa2f",
|
|
30
|
+
"@dxos/crypto": "0.1.58-main.f69fa2f",
|
|
31
|
+
"@dxos/debug": "0.1.58-main.f69fa2f",
|
|
32
|
+
"@dxos/document-model": "0.1.58-main.f69fa2f",
|
|
33
|
+
"@dxos/echo-db": "0.1.58-main.f69fa2f",
|
|
34
|
+
"@dxos/echo-pipeline": "0.1.58-main.f69fa2f",
|
|
35
|
+
"@dxos/echo-schema": "0.1.58-main.f69fa2f",
|
|
36
|
+
"@dxos/feed-store": "0.1.58-main.f69fa2f",
|
|
37
|
+
"@dxos/invariant": "0.1.58-main.f69fa2f",
|
|
38
|
+
"@dxos/keyring": "0.1.58-main.f69fa2f",
|
|
39
|
+
"@dxos/keys": "0.1.58-main.f69fa2f",
|
|
40
|
+
"@dxos/lock-file": "0.1.58-main.f69fa2f",
|
|
41
|
+
"@dxos/log": "0.1.58-main.f69fa2f",
|
|
42
|
+
"@dxos/messaging": "0.1.58-main.f69fa2f",
|
|
43
|
+
"@dxos/model-factory": "0.1.58-main.f69fa2f",
|
|
44
|
+
"@dxos/network-manager": "0.1.58-main.f69fa2f",
|
|
45
|
+
"@dxos/node-std": "0.1.58-main.f69fa2f",
|
|
46
|
+
"@dxos/protocols": "0.1.58-main.f69fa2f",
|
|
47
|
+
"@dxos/random-access-storage": "0.1.58-main.f69fa2f",
|
|
48
|
+
"@dxos/rpc": "0.1.58-main.f69fa2f",
|
|
49
|
+
"@dxos/teleport": "0.1.58-main.f69fa2f",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.1.58-main.f69fa2f",
|
|
51
|
+
"@dxos/teleport-extension-object-sync": "0.1.58-main.f69fa2f",
|
|
52
|
+
"@dxos/text-model": "0.1.58-main.f69fa2f",
|
|
53
|
+
"@dxos/timeframe": "0.1.58-main.f69fa2f",
|
|
54
|
+
"@dxos/tracing": "0.1.58-main.f69fa2f",
|
|
55
|
+
"@dxos/util": "0.1.58-main.f69fa2f",
|
|
56
|
+
"@dxos/websocket-rpc": "0.1.58-main.f69fa2f"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@types/readable-stream": "^2.3.9",
|
|
59
|
-
"@dxos/signal": "0.1.58-main.
|
|
60
|
+
"@dxos/signal": "0.1.58-main.f69fa2f"
|
|
60
61
|
},
|
|
61
62
|
"publishConfig": {
|
|
62
63
|
"access": "public"
|
|
@@ -8,10 +8,7 @@ import { NetworkManager } from '@dxos/network-manager';
|
|
|
8
8
|
import { NetworkService, NetworkStatus, UpdateConfigRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
9
9
|
|
|
10
10
|
export class NetworkServiceImpl implements NetworkService {
|
|
11
|
-
constructor(
|
|
12
|
-
private readonly networkManager: NetworkManager,
|
|
13
|
-
private readonly signalManager: SignalManager,
|
|
14
|
-
) {}
|
|
11
|
+
constructor(private readonly networkManager: NetworkManager, private readonly signalManager: SignalManager) {}
|
|
15
12
|
|
|
16
13
|
queryStatus() {
|
|
17
14
|
return new Stream<NetworkStatus>(({ next }) => {
|
|
@@ -22,11 +22,11 @@ import { createMockCredential, createServiceHost } from '../testing';
|
|
|
22
22
|
chai.use(chaiAsPromised);
|
|
23
23
|
|
|
24
24
|
describe('ClientServicesHost', () => {
|
|
25
|
-
const
|
|
25
|
+
const dataRoot = '/tmp/dxos/client-services/service-host/storage';
|
|
26
26
|
|
|
27
27
|
afterEach(async () => {
|
|
28
28
|
// Clean up.
|
|
29
|
-
isNode() && rmSync(
|
|
29
|
+
isNode() && rmSync(dataRoot, { recursive: true, force: true });
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
test('queryCredentials', async () => {
|
|
@@ -114,7 +114,7 @@ describe('ClientServicesHost', () => {
|
|
|
114
114
|
|
|
115
115
|
test('storage reset', async () => {
|
|
116
116
|
const config = new Config({
|
|
117
|
-
runtime: { client: { storage: { persistent: true,
|
|
117
|
+
runtime: { client: { storage: { persistent: true, dataRoot } } },
|
|
118
118
|
});
|
|
119
119
|
{
|
|
120
120
|
const host = createServiceHost(config, new MemorySignalManagerContext());
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Event, synchronized } from '@dxos/async';
|
|
6
|
-
import { clientServiceBundle, ClientServices } from '@dxos/client-protocol';
|
|
6
|
+
import { clientServiceBundle, ClientServices, defaultKey, Properties } from '@dxos/client-protocol';
|
|
7
7
|
import { Config } from '@dxos/config';
|
|
8
8
|
import { Context } from '@dxos/context';
|
|
9
9
|
import { DocumentModel } from '@dxos/document-model';
|
|
10
10
|
import { DataServiceImpl } from '@dxos/echo-pipeline';
|
|
11
|
+
import { TypedObject, base } from '@dxos/echo-schema';
|
|
11
12
|
import { invariant } from '@dxos/invariant';
|
|
12
13
|
import { PublicKey } from '@dxos/keys';
|
|
13
14
|
import { log } from '@dxos/log';
|
|
@@ -16,6 +17,7 @@ import { ModelFactory } from '@dxos/model-factory';
|
|
|
16
17
|
import { createSimplePeerTransportFactory, NetworkManager, TransportFactory } from '@dxos/network-manager';
|
|
17
18
|
import { trace } from '@dxos/protocols';
|
|
18
19
|
import { SystemStatus } from '@dxos/protocols/proto/dxos/client/services';
|
|
20
|
+
import { EchoObject } from '@dxos/protocols/proto/dxos/echo/object';
|
|
19
21
|
import { Storage } from '@dxos/random-access-storage';
|
|
20
22
|
import { TextModel } from '@dxos/text-model';
|
|
21
23
|
import { TRACE_PROCESSOR, trace as Trace } from '@dxos/tracing';
|
|
@@ -26,7 +28,7 @@ import { ServiceContext } from './service-context';
|
|
|
26
28
|
import { ServiceRegistry } from './service-registry';
|
|
27
29
|
import { DevicesServiceImpl } from '../devices';
|
|
28
30
|
import { DevtoolsServiceImpl, DevtoolsHostEvents } from '../devtools';
|
|
29
|
-
import { IdentityServiceImpl } from '../identity';
|
|
31
|
+
import { CreateIdentityOptions, IdentityServiceImpl } from '../identity';
|
|
30
32
|
import { InvitationsServiceImpl } from '../invitations';
|
|
31
33
|
import { Lock, ResourceLock } from '../locks';
|
|
32
34
|
import { LoggingServiceImpl } from '../logging';
|
|
@@ -40,6 +42,21 @@ export const createDefaultModelFactory = () => {
|
|
|
40
42
|
return new ModelFactory().registerModel(DocumentModel).registerModel(TextModel);
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
// TODO(wittjosiah): Factor out.
|
|
46
|
+
const createGenesisMutationFromTypedObject = (obj: TypedObject): EchoObject => {
|
|
47
|
+
const snapshot = obj[base]._createSnapshot();
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
objectId: obj[base]._id,
|
|
51
|
+
genesis: {
|
|
52
|
+
modelType: obj[base]._modelConstructor.meta.type,
|
|
53
|
+
},
|
|
54
|
+
snapshot: {
|
|
55
|
+
model: snapshot,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
43
60
|
export type ClientServicesHostParams = {
|
|
44
61
|
/**
|
|
45
62
|
* Can be omitted if `initialize` is later called.
|
|
@@ -243,7 +260,7 @@ export class ClientServicesHost {
|
|
|
243
260
|
SystemService: this._systemService,
|
|
244
261
|
|
|
245
262
|
IdentityService: new IdentityServiceImpl(
|
|
246
|
-
(params) => this.
|
|
263
|
+
(params) => this._createIdentity(params),
|
|
247
264
|
this._serviceContext.identityManager,
|
|
248
265
|
this._serviceContext.keyring,
|
|
249
266
|
),
|
|
@@ -329,4 +346,23 @@ export class ClientServicesHost {
|
|
|
329
346
|
log.trace('dxos.sdk.client-services-host.reset', trace.end({ id: traceId }));
|
|
330
347
|
await this._callbacks?.onReset?.();
|
|
331
348
|
}
|
|
349
|
+
|
|
350
|
+
private async _createIdentity(params?: CreateIdentityOptions) {
|
|
351
|
+
const identity = await this._serviceContext.createIdentity(params);
|
|
352
|
+
|
|
353
|
+
// Setup default space.
|
|
354
|
+
await this._serviceContext.initialized.wait();
|
|
355
|
+
const space = await this._serviceContext.dataSpaceManager!.createSpace();
|
|
356
|
+
const obj: TypedObject = new Properties();
|
|
357
|
+
obj[defaultKey] = identity.identityKey.toHex();
|
|
358
|
+
await this._serviceRegistry.services.DataService!.write({
|
|
359
|
+
spaceKey: space.key,
|
|
360
|
+
batch: {
|
|
361
|
+
objects: [createGenesisMutationFromTypedObject(obj)],
|
|
362
|
+
},
|
|
363
|
+
});
|
|
364
|
+
await this._serviceRegistry.services.DataService!.flush({ spaceKey: space.key });
|
|
365
|
+
|
|
366
|
+
return identity;
|
|
367
|
+
}
|
|
332
368
|
}
|
|
@@ -164,7 +164,7 @@ describe('DataSpaceManager', () => {
|
|
|
164
164
|
afterTest(async () => builder.destroy());
|
|
165
165
|
|
|
166
166
|
const peer = builder.createPeer({
|
|
167
|
-
|
|
167
|
+
dataStore: typeof window === 'undefined' ? StorageType.NODE : StorageType.WEBFS,
|
|
168
168
|
});
|
|
169
169
|
await peer.createIdentity();
|
|
170
170
|
await openAndClose(peer.dataSpaceManager);
|
|
@@ -15,29 +15,29 @@ import StorageDriver = Runtime.Client.Storage.StorageDriver;
|
|
|
15
15
|
// TODO(burdon): Factor out.
|
|
16
16
|
export const createStorageObjects = (config: Runtime.Client.Storage) => {
|
|
17
17
|
const {
|
|
18
|
-
path = isNode() ? DX_DATA : 'dxos/storage', // TODO(burdon): Factor out const.
|
|
19
|
-
storageType,
|
|
20
|
-
keyStorage,
|
|
21
18
|
persistent = false,
|
|
19
|
+
keyStore,
|
|
20
|
+
dataStore,
|
|
21
|
+
dataRoot = isNode() ? DX_DATA : 'dxos/storage', // TODO(burdon): Factor out const.
|
|
22
22
|
} = config ?? {};
|
|
23
23
|
|
|
24
|
-
if (persistent &&
|
|
24
|
+
if (persistent && dataStore === StorageDriver.RAM) {
|
|
25
25
|
throw new InvalidConfigError('RAM storage cannot be used in persistent mode.');
|
|
26
26
|
}
|
|
27
|
-
if (!persistent &&
|
|
27
|
+
if (!persistent && dataStore !== undefined && dataStore !== StorageDriver.RAM) {
|
|
28
28
|
throw new InvalidConfigError('Cannot use a persistent storage in not persistent mode.');
|
|
29
29
|
}
|
|
30
|
-
if (persistent &&
|
|
30
|
+
if (persistent && keyStore === StorageDriver.RAM) {
|
|
31
31
|
throw new InvalidConfigError('RAM key storage cannot be used in persistent mode.');
|
|
32
32
|
}
|
|
33
|
-
if (!persistent &&
|
|
33
|
+
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== undefined) {
|
|
34
34
|
throw new InvalidConfigError('Cannot use a persistent key storage in not persistent mode.');
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return {
|
|
38
38
|
storage: createStorage({
|
|
39
|
-
type: persistent ? toStorageType(
|
|
40
|
-
root: `${
|
|
39
|
+
type: persistent ? toStorageType(dataStore) : StorageType.RAM,
|
|
40
|
+
root: `${dataRoot}/`,
|
|
41
41
|
}),
|
|
42
42
|
};
|
|
43
43
|
};
|
|
@@ -94,7 +94,7 @@ export class TestBuilder {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export type TestPeerOpts = {
|
|
97
|
-
|
|
97
|
+
dataStore?: StorageType;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
export type TestPeerProps = {
|
|
@@ -115,7 +115,7 @@ export class TestPeer {
|
|
|
115
115
|
|
|
116
116
|
constructor(
|
|
117
117
|
private readonly signalContext: MemorySignalManagerContext,
|
|
118
|
-
private readonly opts: TestPeerOpts = {
|
|
118
|
+
private readonly opts: TestPeerOpts = { dataStore: StorageType.RAM },
|
|
119
119
|
) {}
|
|
120
120
|
|
|
121
121
|
get props() {
|
|
@@ -123,7 +123,7 @@ export class TestPeer {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
get storage() {
|
|
126
|
-
return (this._props.storage ??= createStorage({ type: this.opts.
|
|
126
|
+
return (this._props.storage ??= createStorage({ type: this.opts.dataStore }));
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
get keyring() {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DXOS_VERSION = "0.1.58-main.
|
|
1
|
+
export const DXOS_VERSION = "0.1.58-main.f69fa2f";
|