@dxos/client-services 0.4.8-main.c1d1c78 → 0.4.8-main.eb5ae94

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.8-main.c1d1c78",
3
+ "version": "0.4.8-main.eb5ae94",
4
4
  "description": "DXOS client services implementation",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -22,44 +22,46 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "platform": "^1.3.6",
25
- "@dxos/async": "0.4.8-main.c1d1c78",
26
- "@dxos/config": "0.4.8-main.c1d1c78",
27
- "@dxos/client-protocol": "0.4.8-main.c1d1c78",
28
- "@dxos/context": "0.4.8-main.c1d1c78",
29
- "@dxos/codec-protobuf": "0.4.8-main.c1d1c78",
30
- "@dxos/credentials": "0.4.8-main.c1d1c78",
31
- "@dxos/debug": "0.4.8-main.c1d1c78",
32
- "@dxos/document-model": "0.4.8-main.c1d1c78",
33
- "@dxos/echo-db": "0.4.8-main.c1d1c78",
34
- "@dxos/crypto": "0.4.8-main.c1d1c78",
35
- "@dxos/echo-pipeline": "0.4.8-main.c1d1c78",
36
- "@dxos/echo-schema": "0.4.8-main.c1d1c78",
37
- "@dxos/invariant": "0.4.8-main.c1d1c78",
38
- "@dxos/feed-store": "0.4.8-main.c1d1c78",
39
- "@dxos/keys": "0.4.8-main.c1d1c78",
40
- "@dxos/keyring": "0.4.8-main.c1d1c78",
41
- "@dxos/log": "0.4.8-main.c1d1c78",
42
- "@dxos/lock-file": "0.4.8-main.c1d1c78",
43
- "@dxos/model-factory": "0.4.8-main.c1d1c78",
44
- "@dxos/messaging": "0.4.8-main.c1d1c78",
45
- "@dxos/network-manager": "0.4.8-main.c1d1c78",
46
- "@dxos/node-std": "0.4.8-main.c1d1c78",
47
- "@dxos/protocols": "0.4.8-main.c1d1c78",
48
- "@dxos/random-access-storage": "0.4.8-main.c1d1c78",
49
- "@dxos/teleport": "0.4.8-main.c1d1c78",
50
- "@dxos/rpc": "0.4.8-main.c1d1c78",
51
- "@dxos/teleport-extension-object-sync": "0.4.8-main.c1d1c78",
52
- "@dxos/teleport-extension-gossip": "0.4.8-main.c1d1c78",
53
- "@dxos/text-model": "0.4.8-main.c1d1c78",
54
- "@dxos/timeframe": "0.4.8-main.c1d1c78",
55
- "@dxos/tracing": "0.4.8-main.c1d1c78",
56
- "@dxos/util": "0.4.8-main.c1d1c78",
57
- "@dxos/websocket-rpc": "0.4.8-main.c1d1c78"
25
+ "@dxos/async": "0.4.8-main.eb5ae94",
26
+ "@dxos/config": "0.4.8-main.eb5ae94",
27
+ "@dxos/automerge": "0.4.8-main.eb5ae94",
28
+ "@dxos/codec-protobuf": "0.4.8-main.eb5ae94",
29
+ "@dxos/client-protocol": "0.4.8-main.eb5ae94",
30
+ "@dxos/context": "0.4.8-main.eb5ae94",
31
+ "@dxos/crypto": "0.4.8-main.eb5ae94",
32
+ "@dxos/credentials": "0.4.8-main.eb5ae94",
33
+ "@dxos/debug": "0.4.8-main.eb5ae94",
34
+ "@dxos/echo-db": "0.4.8-main.eb5ae94",
35
+ "@dxos/document-model": "0.4.8-main.eb5ae94",
36
+ "@dxos/echo-schema": "0.4.8-main.eb5ae94",
37
+ "@dxos/echo-pipeline": "0.4.8-main.eb5ae94",
38
+ "@dxos/feed-store": "0.4.8-main.eb5ae94",
39
+ "@dxos/invariant": "0.4.8-main.eb5ae94",
40
+ "@dxos/indexing": "0.4.8-main.eb5ae94",
41
+ "@dxos/keys": "0.4.8-main.eb5ae94",
42
+ "@dxos/keyring": "0.4.8-main.eb5ae94",
43
+ "@dxos/messaging": "0.4.8-main.eb5ae94",
44
+ "@dxos/log": "0.4.8-main.eb5ae94",
45
+ "@dxos/model-factory": "0.4.8-main.eb5ae94",
46
+ "@dxos/lock-file": "0.4.8-main.eb5ae94",
47
+ "@dxos/network-manager": "0.4.8-main.eb5ae94",
48
+ "@dxos/random-access-storage": "0.4.8-main.eb5ae94",
49
+ "@dxos/protocols": "0.4.8-main.eb5ae94",
50
+ "@dxos/node-std": "0.4.8-main.eb5ae94",
51
+ "@dxos/rpc": "0.4.8-main.eb5ae94",
52
+ "@dxos/teleport": "0.4.8-main.eb5ae94",
53
+ "@dxos/teleport-extension-gossip": "0.4.8-main.eb5ae94",
54
+ "@dxos/text-model": "0.4.8-main.eb5ae94",
55
+ "@dxos/teleport-extension-object-sync": "0.4.8-main.eb5ae94",
56
+ "@dxos/timeframe": "0.4.8-main.eb5ae94",
57
+ "@dxos/tracing": "0.4.8-main.eb5ae94",
58
+ "@dxos/util": "0.4.8-main.eb5ae94",
59
+ "@dxos/websocket-rpc": "0.4.8-main.eb5ae94"
58
60
  },
59
61
  "devDependencies": {
60
62
  "@types/platform": "^1.3.4",
61
63
  "@types/readable-stream": "^2.3.9",
62
- "@dxos/signal": "0.4.8-main.c1d1c78"
64
+ "@dxos/signal": "0.4.8-main.eb5ae94"
63
65
  },
64
66
  "publishConfig": {
65
67
  "access": "public"
@@ -3,9 +3,10 @@
3
3
  //
4
4
 
5
5
  import { Trigger } from '@dxos/async';
6
+ import { getHeads } from '@dxos/automerge/automerge';
6
7
  import { Context } from '@dxos/context';
7
8
  import { type CredentialProcessor, getCredentialAssertion } from '@dxos/credentials';
8
- import { failUndefined } from '@dxos/debug';
9
+ import { failUndefined, warnAfterTimeout } from '@dxos/debug';
9
10
  import {
10
11
  valueEncoding,
11
12
  MetadataStore,
@@ -14,8 +15,8 @@ import {
14
15
  SnapshotStore,
15
16
  AutomergeHost,
16
17
  } from '@dxos/echo-pipeline';
17
- import { IndexMetadataStore } from '@dxos/echo-schema';
18
18
  import { FeedFactory, FeedStore } from '@dxos/feed-store';
19
+ import { IndexMetadataStore, IndexStore, Indexer } from '@dxos/indexing';
19
20
  import { invariant } from '@dxos/invariant';
20
21
  import { Keyring } from '@dxos/keyring';
21
22
  import { PublicKey } from '@dxos/keys';
@@ -23,7 +24,7 @@ import { log } from '@dxos/log';
23
24
  import { type SignalManager } from '@dxos/messaging';
24
25
  import { type ModelFactory } from '@dxos/model-factory';
25
26
  import { type NetworkManager } from '@dxos/network-manager';
26
- import { InvalidStorageVersionError, STORAGE_VERSION, trace } from '@dxos/protocols';
27
+ import { InvalidStorageVersionError, STORAGE_VERSION, idCodec, trace } from '@dxos/protocols';
27
28
  import { Invitation } from '@dxos/protocols/proto/dxos/client/services';
28
29
  import type { FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
29
30
  import { type ProfileDocument, type Credential } from '@dxos/protocols/proto/dxos/halo/credentials';
@@ -70,6 +71,7 @@ export class ServiceContext {
70
71
  public readonly invitations: InvitationsHandler;
71
72
  public readonly automergeHost: AutomergeHost;
72
73
  public readonly indexMetadata: IndexMetadataStore;
74
+ public readonly indexer: Indexer;
73
75
 
74
76
  // Initialized after identity is initialized.
75
77
  public dataSpaceManager?: DataSpaceManager;
@@ -92,7 +94,6 @@ export class ServiceContext {
92
94
  ) {
93
95
  // TODO(burdon): Move strings to constants.
94
96
  this.metadataStore = new MetadataStore(storage.createDirectory('metadata'));
95
- this.indexMetadata = new IndexMetadataStore({ directory: storage.createDirectory('index-metadata') });
96
97
  this.snapshotStore = new SnapshotStore(storage.createDirectory('snapshots'));
97
98
  this.blobStore = new BlobStore(storage.createDirectory('blobs'));
98
99
 
@@ -125,11 +126,31 @@ export class ServiceContext {
125
126
  this._runtimeParams as IdentityManagerRuntimeParams,
126
127
  );
127
128
 
129
+ this.indexMetadata = new IndexMetadataStore({ directory: storage.createDirectory('index-metadata') });
130
+
128
131
  this.automergeHost = new AutomergeHost({
129
132
  directory: storage.createDirectory('automerge'),
130
133
  metadata: this.indexMetadata,
131
134
  });
132
135
 
136
+ this.indexer = new Indexer({
137
+ indexStore: new IndexStore({ directory: storage.createDirectory('index-store') }),
138
+ metadataStore: this.indexMetadata,
139
+ loadDocuments: async (ids: string[]) => {
140
+ const snapshots = await Promise.all(
141
+ ids.map(async (id) => {
142
+ const { documentId, objectId } = idCodec.decode(id);
143
+ const handle = this.automergeHost.repo.find(documentId as any);
144
+ await warnAfterTimeout(1000, 'to long to load doc', () => handle.whenReady());
145
+ const doc = handle.docSync();
146
+ const heads = getHeads(doc);
147
+ return { id, object: doc.objects[objectId], currentHash: heads.at(-1)! };
148
+ }),
149
+ );
150
+ return snapshots.filter((snapshot) => snapshot.object);
151
+ },
152
+ });
153
+
133
154
  this.invitations = new InvitationsHandler(this.networkManager);
134
155
 
135
156
  // TODO(burdon): _initialize called in multiple places.
@@ -178,6 +199,7 @@ export class ServiceContext {
178
199
  await this.signalManager.close();
179
200
  this.dataServiceSubscriptions.clear();
180
201
  await this.metadataStore.close();
202
+ await this.indexer.destroy();
181
203
  log('closed');
182
204
  }
183
205
 
@@ -9,6 +9,7 @@ import { Context } from '@dxos/context';
9
9
  import { DocumentModel } from '@dxos/document-model';
10
10
  import { DataServiceImpl } from '@dxos/echo-pipeline';
11
11
  import { type TypedObject, getRawDoc, type SpaceDoc, getAutomergeObjectCore } from '@dxos/echo-schema';
12
+ import { IndexServiceImpl } from '@dxos/indexing';
12
13
  import { invariant } from '@dxos/invariant';
13
14
  import { PublicKey } from '@dxos/keys';
14
15
  import { log } from '@dxos/log';
@@ -279,6 +280,11 @@ export class ClientServicesHost {
279
280
  this._serviceContext.automergeHost,
280
281
  ),
281
282
 
283
+ IndexService: new IndexServiceImpl({
284
+ indexer: this._serviceContext.indexer,
285
+ automergeHost: this._serviceContext.automergeHost,
286
+ }),
287
+
282
288
  NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
283
289
 
284
290
  LoggingService: this._loggingService,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const DXOS_VERSION = "0.4.8-main.c1d1c78";
1
+ export const DXOS_VERSION = "0.4.8-main.eb5ae94";