@dxos/client-services 0.4.10-main.6134ea4 → 0.4.10-main.697c7a4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/client-services",
3
- "version": "0.4.10-main.6134ea4",
3
+ "version": "0.4.10-main.697c7a4",
4
4
  "description": "DXOS client services implementation",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -22,43 +22,43 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "platform": "^1.3.6",
25
- "@dxos/async": "0.4.10-main.6134ea4",
26
- "@dxos/automerge": "0.4.10-main.6134ea4",
27
- "@dxos/codec-protobuf": "0.4.10-main.6134ea4",
28
- "@dxos/client-protocol": "0.4.10-main.6134ea4",
29
- "@dxos/config": "0.4.10-main.6134ea4",
30
- "@dxos/context": "0.4.10-main.6134ea4",
31
- "@dxos/crypto": "0.4.10-main.6134ea4",
32
- "@dxos/debug": "0.4.10-main.6134ea4",
33
- "@dxos/credentials": "0.4.10-main.6134ea4",
34
- "@dxos/echo-db": "0.4.10-main.6134ea4",
35
- "@dxos/echo-pipeline": "0.4.10-main.6134ea4",
36
- "@dxos/echo-schema": "0.4.10-main.6134ea4",
37
- "@dxos/indexing": "0.4.10-main.6134ea4",
38
- "@dxos/feed-store": "0.4.10-main.6134ea4",
39
- "@dxos/invariant": "0.4.10-main.6134ea4",
40
- "@dxos/keyring": "0.4.10-main.6134ea4",
41
- "@dxos/keys": "0.4.10-main.6134ea4",
42
- "@dxos/log": "0.4.10-main.6134ea4",
43
- "@dxos/messaging": "0.4.10-main.6134ea4",
44
- "@dxos/lock-file": "0.4.10-main.6134ea4",
45
- "@dxos/network-manager": "0.4.10-main.6134ea4",
46
- "@dxos/node-std": "0.4.10-main.6134ea4",
47
- "@dxos/protocols": "0.4.10-main.6134ea4",
48
- "@dxos/random-access-storage": "0.4.10-main.6134ea4",
49
- "@dxos/teleport": "0.4.10-main.6134ea4",
50
- "@dxos/teleport-extension-gossip": "0.4.10-main.6134ea4",
51
- "@dxos/rpc": "0.4.10-main.6134ea4",
52
- "@dxos/teleport-extension-object-sync": "0.4.10-main.6134ea4",
53
- "@dxos/timeframe": "0.4.10-main.6134ea4",
54
- "@dxos/tracing": "0.4.10-main.6134ea4",
55
- "@dxos/util": "0.4.10-main.6134ea4",
56
- "@dxos/websocket-rpc": "0.4.10-main.6134ea4"
25
+ "@dxos/async": "0.4.10-main.697c7a4",
26
+ "@dxos/automerge": "0.4.10-main.697c7a4",
27
+ "@dxos/client-protocol": "0.4.10-main.697c7a4",
28
+ "@dxos/codec-protobuf": "0.4.10-main.697c7a4",
29
+ "@dxos/config": "0.4.10-main.697c7a4",
30
+ "@dxos/credentials": "0.4.10-main.697c7a4",
31
+ "@dxos/context": "0.4.10-main.697c7a4",
32
+ "@dxos/crypto": "0.4.10-main.697c7a4",
33
+ "@dxos/debug": "0.4.10-main.697c7a4",
34
+ "@dxos/echo-db": "0.4.10-main.697c7a4",
35
+ "@dxos/echo-pipeline": "0.4.10-main.697c7a4",
36
+ "@dxos/feed-store": "0.4.10-main.697c7a4",
37
+ "@dxos/invariant": "0.4.10-main.697c7a4",
38
+ "@dxos/echo-schema": "0.4.10-main.697c7a4",
39
+ "@dxos/keyring": "0.4.10-main.697c7a4",
40
+ "@dxos/indexing": "0.4.10-main.697c7a4",
41
+ "@dxos/keys": "0.4.10-main.697c7a4",
42
+ "@dxos/lock-file": "0.4.10-main.697c7a4",
43
+ "@dxos/log": "0.4.10-main.697c7a4",
44
+ "@dxos/messaging": "0.4.10-main.697c7a4",
45
+ "@dxos/network-manager": "0.4.10-main.697c7a4",
46
+ "@dxos/node-std": "0.4.10-main.697c7a4",
47
+ "@dxos/protocols": "0.4.10-main.697c7a4",
48
+ "@dxos/rpc": "0.4.10-main.697c7a4",
49
+ "@dxos/random-access-storage": "0.4.10-main.697c7a4",
50
+ "@dxos/teleport": "0.4.10-main.697c7a4",
51
+ "@dxos/teleport-extension-gossip": "0.4.10-main.697c7a4",
52
+ "@dxos/teleport-extension-object-sync": "0.4.10-main.697c7a4",
53
+ "@dxos/timeframe": "0.4.10-main.697c7a4",
54
+ "@dxos/tracing": "0.4.10-main.697c7a4",
55
+ "@dxos/util": "0.4.10-main.697c7a4",
56
+ "@dxos/websocket-rpc": "0.4.10-main.697c7a4"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/platform": "^1.3.4",
60
60
  "@types/readable-stream": "^2.3.9",
61
- "@dxos/signal": "0.4.10-main.6134ea4"
61
+ "@dxos/signal": "0.4.10-main.697c7a4"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"
@@ -12,7 +12,7 @@ import { idCodec } from '@dxos/protocols';
12
12
  /**
13
13
  * Factory for `loadDocuments` iterator.
14
14
  */
15
- export const createLoadDocuments = (automergeHost: AutomergeHost) =>
15
+ export const createSelectedDocumentsIterator = (automergeHost: AutomergeHost) =>
16
16
  /**
17
17
  * Get object data blobs from Automerge Repo by ids.
18
18
  * @param ids
@@ -25,14 +25,14 @@ export const createLoadDocuments = (automergeHost: AutomergeHost) =>
25
25
  await warnAfterTimeout(5000, 'to long to load doc', () => handle.whenReady());
26
26
  const doc = handle.docSync();
27
27
  const hash = getHeads(doc).join('');
28
- yield [{ id, object: doc.objects[objectId], currentHash: hash }];
28
+ yield doc.objects?.[objectId] ? [{ id, object: doc.objects[objectId], currentHash: hash }] : [];
29
29
  }
30
30
  };
31
31
 
32
32
  /**
33
33
  * Factory for `getAllDocuments` iterator.
34
34
  */
35
- export const createGetAllDocuments = (automergeHost: AutomergeHost) =>
35
+ export const createDocumentsIterator = (automergeHost: AutomergeHost) =>
36
36
  /**
37
37
  * Recursively get all object data blobs from Automerge Repo.
38
38
  * @param ids
@@ -57,7 +57,7 @@ export const createGetAllDocuments = (automergeHost: AutomergeHost) =>
57
57
  return {
58
58
  id: idCodec.encode({ documentId: handle.documentId, objectId }),
59
59
  object,
60
- currentHash: heads.at(-1)!,
60
+ currentHash: heads.join(''),
61
61
  };
62
62
  });
63
63
  }
@@ -30,7 +30,7 @@ import {
30
30
  type IdentityManagerRuntimeParams,
31
31
  type JoinIdentityParams,
32
32
  } from '../identity';
33
- import { createGetAllDocuments, createLoadDocuments } from '../indexing';
33
+ import { createDocumentsIterator, createSelectedDocumentsIterator } from '../indexing';
34
34
  import {
35
35
  DeviceInvitationProtocol,
36
36
  InvitationsHandler,
@@ -125,8 +125,8 @@ export class ServiceContext {
125
125
  this.indexer = new Indexer({
126
126
  indexStore: new IndexStore({ directory: storage.createDirectory('index-store') }),
127
127
  metadataStore: this.indexMetadata,
128
- loadDocuments: createLoadDocuments(this.automergeHost),
129
- getAllDocuments: createGetAllDocuments(this.automergeHost),
128
+ loadDocuments: createSelectedDocumentsIterator(this.automergeHost),
129
+ getAllDocuments: createDocumentsIterator(this.automergeHost),
130
130
  });
131
131
 
132
132
  this.invitations = new InvitationsHandler(this.networkManager);
@@ -6,8 +6,8 @@ import { Event, synchronized } from '@dxos/async';
6
6
  import { Properties, clientServiceBundle, defaultKey, type ClientServices } from '@dxos/client-protocol';
7
7
  import { type Config } from '@dxos/config';
8
8
  import { Context } from '@dxos/context';
9
- import { DataServiceImpl, type SpaceDoc } from '@dxos/echo-pipeline';
10
- import { getAutomergeObjectCore, getRawDoc, type TypedObject } from '@dxos/echo-schema';
9
+ import { DataServiceImpl, type ObjectStructure, encodeReference, type SpaceDoc } from '@dxos/echo-pipeline';
10
+ import * as E from '@dxos/echo-schema';
11
11
  import { IndexServiceImpl } from '@dxos/indexing';
12
12
  import { invariant } from '@dxos/invariant';
13
13
  import { PublicKey } from '@dxos/keys';
@@ -347,18 +347,30 @@ export class ClientServicesHost {
347
347
  await this._serviceContext.initialized.wait();
348
348
  const space = await this._serviceContext.dataSpaceManager!.createSpace();
349
349
 
350
- const obj: TypedObject = new Properties(undefined);
351
- obj[defaultKey] = identity.identityKey.toHex();
352
-
353
350
  const automergeIndex = space.automergeSpaceState.rootUrl;
354
351
  invariant(automergeIndex);
355
352
  const document = await this._serviceContext.automergeHost.repo.find<SpaceDoc>(automergeIndex as any);
356
353
  await document.whenReady();
357
354
 
355
+ // TODO(dmaretskyi): Better API for low-level data access.
356
+ const properties: ObjectStructure = {
357
+ system: {
358
+ type: encodeReference(E.getTypeReference(Properties)!),
359
+ },
360
+ data: {
361
+ [defaultKey]: identity.identityKey.toHex(),
362
+ },
363
+ meta: {
364
+ keys: [],
365
+ },
366
+ };
367
+ const propertiesId = PublicKey.random().toHex();
358
368
  document.change((doc: SpaceDoc) => {
359
- assignDeep(doc, ['objects', getAutomergeObjectCore(obj).id], getRawDoc(obj).handle.docSync());
369
+ assignDeep(doc, ['objects', propertiesId], properties);
360
370
  });
361
371
 
372
+ await this._serviceContext.automergeHost.repo.flush();
373
+
362
374
  return identity;
363
375
  }
364
376
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const DXOS_VERSION = "0.4.10-main.6134ea4";
1
+ export const DXOS_VERSION = "0.4.10-main.697c7a4";