@dxos/client-services 0.1.58-main.ca7a0bc → 0.1.58-main.d647118
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-VRV74Z4M.mjs → chunk-OOVT67MV.mjs} +55 -23
- package/dist/lib/browser/{chunk-VRV74Z4M.mjs.map → chunk-OOVT67MV.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 +1 -1
- package/dist/lib/node/index.cjs +53 -21
- 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 +53 -21
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- 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/version.d.ts +1 -1
- package/package.json +35 -34
- package/src/packlets/services/service-host.ts +39 -3
- package/src/version.ts +1 -1
|
@@ -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,MAAM,6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C,CAAgB;IACvC,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,CAAU;IAC3B,OAAO,CAAC,UAAU,CAAC,CAA8B;IACjD,OAAO,CAAC,cAAc,CAAC,CAAyC;IAEhE,OAAO,CAAC,eAAe,CAAkB;IAGzC,OAAO,CAAC,QAAQ,CAAS;IAGzB,OAAO,CAAC,KAAK,CAAS;gBAEV,EACV,MAAM,EACN,YAA0C,EAC1C,gBAAgB,EAChB,aAAa,EACb,OAAO,EAEP,OAAO,EACP,SAAS,GACV,GAAE,wBAA6B;IAiDhC,IAAI,MAAM,YAET;IAED,IAAI,MAAM,uBAET;IAED,IAAI,OAAO,mBAEV;IAED,IAAI,eAAe,oCAElB;IAED,IAAI,WAAW,sDAEd;IAED,IAAI,QAAQ,4BAEX;IAED;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,EAAE,iBAAiB;IAiC9C,IAAI,CAAC,GAAG,EAAE,OAAO;IAyFjB,KAAK;IAgBL,KAAK;YAYG,eAAe;CAkB9B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.1.58-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.1.58-main.d647118";
|
|
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.d647118",
|
|
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/network-manager": "0.1.58-main.
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/teleport": "0.1.58-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/teleport-extension-
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
24
|
+
"@dxos/async": "0.1.58-main.d647118",
|
|
25
|
+
"@dxos/client-protocol": "0.1.58-main.d647118",
|
|
26
|
+
"@dxos/codec-protobuf": "0.1.58-main.d647118",
|
|
27
|
+
"@dxos/config": "0.1.58-main.d647118",
|
|
28
|
+
"@dxos/context": "0.1.58-main.d647118",
|
|
29
|
+
"@dxos/credentials": "0.1.58-main.d647118",
|
|
30
|
+
"@dxos/crypto": "0.1.58-main.d647118",
|
|
31
|
+
"@dxos/debug": "0.1.58-main.d647118",
|
|
32
|
+
"@dxos/document-model": "0.1.58-main.d647118",
|
|
33
|
+
"@dxos/echo-db": "0.1.58-main.d647118",
|
|
34
|
+
"@dxos/echo-pipeline": "0.1.58-main.d647118",
|
|
35
|
+
"@dxos/echo-schema": "0.1.58-main.d647118",
|
|
36
|
+
"@dxos/feed-store": "0.1.58-main.d647118",
|
|
37
|
+
"@dxos/invariant": "0.1.58-main.d647118",
|
|
38
|
+
"@dxos/keyring": "0.1.58-main.d647118",
|
|
39
|
+
"@dxos/keys": "0.1.58-main.d647118",
|
|
40
|
+
"@dxos/lock-file": "0.1.58-main.d647118",
|
|
41
|
+
"@dxos/log": "0.1.58-main.d647118",
|
|
42
|
+
"@dxos/messaging": "0.1.58-main.d647118",
|
|
43
|
+
"@dxos/network-manager": "0.1.58-main.d647118",
|
|
44
|
+
"@dxos/model-factory": "0.1.58-main.d647118",
|
|
45
|
+
"@dxos/node-std": "0.1.58-main.d647118",
|
|
46
|
+
"@dxos/protocols": "0.1.58-main.d647118",
|
|
47
|
+
"@dxos/random-access-storage": "0.1.58-main.d647118",
|
|
48
|
+
"@dxos/teleport": "0.1.58-main.d647118",
|
|
49
|
+
"@dxos/rpc": "0.1.58-main.d647118",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.1.58-main.d647118",
|
|
51
|
+
"@dxos/teleport-extension-object-sync": "0.1.58-main.d647118",
|
|
52
|
+
"@dxos/text-model": "0.1.58-main.d647118",
|
|
53
|
+
"@dxos/timeframe": "0.1.58-main.d647118",
|
|
54
|
+
"@dxos/tracing": "0.1.58-main.d647118",
|
|
55
|
+
"@dxos/util": "0.1.58-main.d647118",
|
|
56
|
+
"@dxos/websocket-rpc": "0.1.58-main.d647118"
|
|
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.d647118"
|
|
60
61
|
},
|
|
61
62
|
"publishConfig": {
|
|
62
63
|
"access": "public"
|
|
@@ -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
|
}
|
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.d647118";
|