@dxos/client-services 0.4.10-main.93fda5f → 0.4.10-main.a14f081

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.93fda5f",
3
+ "version": "0.4.10-main.a14f081",
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/automerge": "0.4.10-main.93fda5f",
26
- "@dxos/async": "0.4.10-main.93fda5f",
27
- "@dxos/client-protocol": "0.4.10-main.93fda5f",
28
- "@dxos/config": "0.4.10-main.93fda5f",
29
- "@dxos/codec-protobuf": "0.4.10-main.93fda5f",
30
- "@dxos/context": "0.4.10-main.93fda5f",
31
- "@dxos/credentials": "0.4.10-main.93fda5f",
32
- "@dxos/crypto": "0.4.10-main.93fda5f",
33
- "@dxos/debug": "0.4.10-main.93fda5f",
34
- "@dxos/echo-pipeline": "0.4.10-main.93fda5f",
35
- "@dxos/echo-schema": "0.4.10-main.93fda5f",
36
- "@dxos/echo-db": "0.4.10-main.93fda5f",
37
- "@dxos/feed-store": "0.4.10-main.93fda5f",
38
- "@dxos/indexing": "0.4.10-main.93fda5f",
39
- "@dxos/invariant": "0.4.10-main.93fda5f",
40
- "@dxos/keyring": "0.4.10-main.93fda5f",
41
- "@dxos/log": "0.4.10-main.93fda5f",
42
- "@dxos/messaging": "0.4.10-main.93fda5f",
43
- "@dxos/network-manager": "0.4.10-main.93fda5f",
44
- "@dxos/keys": "0.4.10-main.93fda5f",
45
- "@dxos/lock-file": "0.4.10-main.93fda5f",
46
- "@dxos/node-std": "0.4.10-main.93fda5f",
47
- "@dxos/protocols": "0.4.10-main.93fda5f",
48
- "@dxos/rpc": "0.4.10-main.93fda5f",
49
- "@dxos/random-access-storage": "0.4.10-main.93fda5f",
50
- "@dxos/teleport-extension-object-sync": "0.4.10-main.93fda5f",
51
- "@dxos/teleport-extension-gossip": "0.4.10-main.93fda5f",
52
- "@dxos/timeframe": "0.4.10-main.93fda5f",
53
- "@dxos/teleport": "0.4.10-main.93fda5f",
54
- "@dxos/tracing": "0.4.10-main.93fda5f",
55
- "@dxos/util": "0.4.10-main.93fda5f",
56
- "@dxos/websocket-rpc": "0.4.10-main.93fda5f"
25
+ "@dxos/client-protocol": "0.4.10-main.a14f081",
26
+ "@dxos/automerge": "0.4.10-main.a14f081",
27
+ "@dxos/codec-protobuf": "0.4.10-main.a14f081",
28
+ "@dxos/async": "0.4.10-main.a14f081",
29
+ "@dxos/context": "0.4.10-main.a14f081",
30
+ "@dxos/config": "0.4.10-main.a14f081",
31
+ "@dxos/credentials": "0.4.10-main.a14f081",
32
+ "@dxos/crypto": "0.4.10-main.a14f081",
33
+ "@dxos/echo-pipeline": "0.4.10-main.a14f081",
34
+ "@dxos/debug": "0.4.10-main.a14f081",
35
+ "@dxos/feed-store": "0.4.10-main.a14f081",
36
+ "@dxos/echo-db": "0.4.10-main.a14f081",
37
+ "@dxos/indexing": "0.4.10-main.a14f081",
38
+ "@dxos/echo-schema": "0.4.10-main.a14f081",
39
+ "@dxos/invariant": "0.4.10-main.a14f081",
40
+ "@dxos/keyring": "0.4.10-main.a14f081",
41
+ "@dxos/keys": "0.4.10-main.a14f081",
42
+ "@dxos/lock-file": "0.4.10-main.a14f081",
43
+ "@dxos/log": "0.4.10-main.a14f081",
44
+ "@dxos/messaging": "0.4.10-main.a14f081",
45
+ "@dxos/network-manager": "0.4.10-main.a14f081",
46
+ "@dxos/protocols": "0.4.10-main.a14f081",
47
+ "@dxos/node-std": "0.4.10-main.a14f081",
48
+ "@dxos/random-access-storage": "0.4.10-main.a14f081",
49
+ "@dxos/rpc": "0.4.10-main.a14f081",
50
+ "@dxos/teleport-extension-gossip": "0.4.10-main.a14f081",
51
+ "@dxos/teleport": "0.4.10-main.a14f081",
52
+ "@dxos/teleport-extension-object-sync": "0.4.10-main.a14f081",
53
+ "@dxos/timeframe": "0.4.10-main.a14f081",
54
+ "@dxos/tracing": "0.4.10-main.a14f081",
55
+ "@dxos/util": "0.4.10-main.a14f081",
56
+ "@dxos/websocket-rpc": "0.4.10-main.a14f081"
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.93fda5f"
61
+ "@dxos/signal": "0.4.10-main.a14f081"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"
@@ -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 } from '@dxos/echo-pipeline';
10
- import { getAutomergeObjectCore, getRawDoc, type SpaceDoc, type TypedObject } from '@dxos/echo-schema';
9
+ import { DataServiceImpl, type SpaceDoc } from '@dxos/echo-pipeline';
10
+ import { getAutomergeObjectCore, getRawDoc, type TypedObject } 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';
@@ -6,7 +6,15 @@ import { Event, asyncTimeout, scheduleTask, sleep, synchronized, trackLeaks } fr
6
6
  import { AUTH_TIMEOUT } from '@dxos/client-protocol';
7
7
  import { cancelWithContext, Context, ContextDisposedError } from '@dxos/context';
8
8
  import { timed, warnAfterTimeout } from '@dxos/debug';
9
- import { type MetadataStore, type Space, createMappedFeedWriter, type AutomergeHost } from '@dxos/echo-pipeline';
9
+ import { TYPE_PROPERTIES } from '@dxos/echo-db';
10
+ import {
11
+ type MetadataStore,
12
+ type Space,
13
+ createMappedFeedWriter,
14
+ type AutomergeHost,
15
+ type SpaceDoc,
16
+ } from '@dxos/echo-pipeline';
17
+ import { AutomergeDocumentLoaderImpl } from '@dxos/echo-pipeline';
10
18
  import { type FeedStore } from '@dxos/feed-store';
11
19
  import { failedInvariant, invariant } from '@dxos/invariant';
12
20
  import { type Keyring } from '@dxos/keyring';
@@ -26,7 +34,7 @@ import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gos
26
34
  import { type Gossip, type Presence } from '@dxos/teleport-extension-gossip';
27
35
  import { Timeframe } from '@dxos/timeframe';
28
36
  import { trace } from '@dxos/tracing';
29
- import { ComplexSet } from '@dxos/util';
37
+ import { ComplexSet, assignDeep } from '@dxos/util';
30
38
 
31
39
  import { AutomergeSpaceState } from './automerge-space-state';
32
40
  import { type SigningContext } from './data-space-manager';
@@ -437,6 +445,47 @@ export class DataSpace {
437
445
  };
438
446
  }
439
447
  break;
448
+ case CreateEpochRequest.Migration.FRAGMENT_AUTOMERGE_ROOT:
449
+ {
450
+ log.info('Fragmenting');
451
+
452
+ const currentRootUrl = this._automergeSpaceState.rootUrl;
453
+ const rootHandle = this._automergeHost.repo.find<SpaceDoc>(currentRootUrl as any);
454
+ await cancelWithContext(this._ctx, asyncTimeout(rootHandle.whenReady(), 10_000));
455
+
456
+ // Find properties object.
457
+ const objects = Object.entries((rootHandle.docSync() as SpaceDoc).objects!);
458
+ const properties = objects.find(([_, value]) => value.system.type?.itemId === TYPE_PROPERTIES);
459
+ const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
460
+ invariant(properties, 'Properties not found');
461
+
462
+ // Create a new space doc with the properties object.
463
+ const newSpaceDoc: SpaceDoc = { ...rootHandle.docSync(), objects: Object.fromEntries([properties]) };
464
+ const newRoot = this._automergeHost.repo.create(newSpaceDoc);
465
+ invariant(typeof newRoot.url === 'string' && newRoot.url.length > 0);
466
+
467
+ // Create new automerge documents for all objects.
468
+ const docLoader = new AutomergeDocumentLoaderImpl(this.key, this._automergeHost.repo);
469
+ await docLoader.loadSpaceRootDocHandle(this._ctx, { rootUrl: newRoot.url });
470
+
471
+ otherObjects.forEach(([key, value]) => {
472
+ const handle = docLoader.createDocumentForObject(key);
473
+ handle.change((doc: any) => {
474
+ assignDeep(doc, ['objects', key], value);
475
+ });
476
+ });
477
+
478
+ // TODO(mykola): Delete old root.
479
+
480
+ // TODO(dmaretskyi): Unify epoch construction.
481
+ epoch = {
482
+ previousId: this._automergeSpaceState.lastEpoch?.id,
483
+ number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
484
+ timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe(),
485
+ automergeRoot: newRoot.url,
486
+ };
487
+ }
488
+ break;
440
489
  }
441
490
 
442
491
  if (!epoch) {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const DXOS_VERSION = "0.4.10-main.93fda5f";
1
+ export const DXOS_VERSION = "0.4.10-main.a14f081";