@dxos/client-services 0.3.8 → 0.3.9-main.03b62b6
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-OTXAXY25.mjs → chunk-K4EJUKL6.mjs} +128 -78
- package/dist/lib/browser/{chunk-OTXAXY25.mjs.map → chunk-K4EJUKL6.mjs.map} +4 -4
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +2 -2
- package/dist/lib/node/{chunk-MTUUVEA5.cjs → chunk-BGDX55G3.cjs} +137 -90
- package/dist/lib/node/chunk-BGDX55G3.cjs.map +7 -0
- package/dist/lib/node/index.cjs +42 -42
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +9 -9
- package/dist/types/src/packlets/services/service-context.d.ts +2 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +8 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -0
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +3 -2
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +7 -2
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/dist/types/src/version.d.ts.map +1 -1
- package/package.json +35 -35
- package/src/packlets/services/service-context.ts +5 -0
- package/src/packlets/services/service-host.ts +4 -1
- package/src/packlets/spaces/automerge-space-state.ts +22 -0
- package/src/packlets/spaces/data-space-manager.ts +11 -1
- package/src/packlets/spaces/data-space.ts +53 -6
- package/src/version.ts +1 -5
- package/dist/lib/node/chunk-MTUUVEA5.cjs.map +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
2
|
import { type CredentialSigner } from '@dxos/credentials';
|
|
3
|
-
import { type DataServiceSubscriptions, type MetadataStore, type SpaceManager } from '@dxos/echo-pipeline';
|
|
3
|
+
import { type AutomergeHost, type DataServiceSubscriptions, type MetadataStore, type SpaceManager } from '@dxos/echo-pipeline';
|
|
4
4
|
import { type FeedStore } from '@dxos/feed-store';
|
|
5
5
|
import { type Keyring } from '@dxos/keyring';
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
@@ -37,12 +37,13 @@ export declare class DataSpaceManager {
|
|
|
37
37
|
private readonly _keyring;
|
|
38
38
|
private readonly _signingContext;
|
|
39
39
|
private readonly _feedStore;
|
|
40
|
+
private readonly _automergeHost?;
|
|
40
41
|
private readonly _ctx;
|
|
41
42
|
readonly updated: Event<void>;
|
|
42
43
|
private readonly _spaces;
|
|
43
44
|
private _isOpen;
|
|
44
45
|
private readonly _instanceId;
|
|
45
|
-
constructor(_spaceManager: SpaceManager, _metadataStore: MetadataStore, _dataServiceSubscriptions: DataServiceSubscriptions, _keyring: Keyring, _signingContext: SigningContext, _feedStore: FeedStore<FeedMessage
|
|
46
|
+
constructor(_spaceManager: SpaceManager, _metadataStore: MetadataStore, _dataServiceSubscriptions: DataServiceSubscriptions, _keyring: Keyring, _signingContext: SigningContext, _feedStore: FeedStore<FeedMessage>, _automergeHost?: AutomergeHost | undefined);
|
|
46
47
|
get spaces(): ComplexMap<PublicKey, DataSpace>;
|
|
47
48
|
open(): Promise<void>;
|
|
48
49
|
close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space-manager.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA4B,MAAM,aAAa,CAAC;AAE9D,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,mBAAmB,CAAC;AAClF,OAAO,
|
|
1
|
+
{"version":3,"file":"data-space-manager.d.ts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AAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAG3B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAlBlC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;IAEtC,SAAgB,OAAO,cAAe;IAEtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwD;IAEhF,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA8B;gBAGvC,aAAa,EAAE,YAAY,EAC3B,cAAc,EAAE,aAAa,EAC7B,yBAAyB,EAAE,wBAAwB,EACnD,QAAQ,EAAE,OAAO,EACjB,eAAe,EAAE,cAAc,EAC/B,UAAU,EAAE,SAAS,CAAC,WAAW,CAAC,EAGlC,cAAc,CAAC,2BAAe;IAIjD,IAAI,MAAM,qCAET;IAGK,IAAI;IA2BJ,KAAK;IASX;;OAEG;IAEG,WAAW;IA+BX,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;IAoB/D;;;;OAIG;IACG,mBAAmB,CAAC,QAAQ,EAAE,SAAS;YAU/B,eAAe;CAyF9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Event } from '@dxos/async';
|
|
2
|
-
import { type MetadataStore, type Space, type DataPipeline } from '@dxos/echo-pipeline';
|
|
2
|
+
import { type MetadataStore, type Space, type DataPipeline, type CreateEpochOptions, type AutomergeHost } from '@dxos/echo-pipeline';
|
|
3
3
|
import { type FeedStore } from '@dxos/feed-store';
|
|
4
4
|
import { type Keyring } from '@dxos/keyring';
|
|
5
5
|
import { PublicKey } from '@dxos/keys';
|
|
@@ -9,6 +9,7 @@ import { type SpaceCache } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
|
9
9
|
import { type ProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
10
10
|
import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
|
|
11
11
|
import { type Gossip, type Presence } from '@dxos/teleport-extension-gossip';
|
|
12
|
+
import { AutomergeSpaceState } from './automerge-space-state';
|
|
12
13
|
import { type SigningContext } from './data-space-manager';
|
|
13
14
|
import { NotarizationPlugin } from './notarization-plugin';
|
|
14
15
|
import { TrustedKeySetAuthVerifier } from '../identity';
|
|
@@ -37,6 +38,7 @@ export type DataSpaceParams = {
|
|
|
37
38
|
signingContext: SigningContext;
|
|
38
39
|
callbacks?: DataSpaceCallbacks;
|
|
39
40
|
cache?: SpaceCache;
|
|
41
|
+
automergeHost?: AutomergeHost;
|
|
40
42
|
};
|
|
41
43
|
export declare class DataSpace {
|
|
42
44
|
private _ctx;
|
|
@@ -50,6 +52,8 @@ export declare class DataSpace {
|
|
|
50
52
|
private readonly _notarizationPlugin;
|
|
51
53
|
private readonly _callbacks;
|
|
52
54
|
private readonly _cache?;
|
|
55
|
+
private readonly _automergeHost?;
|
|
56
|
+
private readonly _automergeSpaceState;
|
|
53
57
|
private _state;
|
|
54
58
|
/**
|
|
55
59
|
* Error for _state === SpaceState.ERROR.
|
|
@@ -67,6 +71,7 @@ export declare class DataSpace {
|
|
|
67
71
|
get presence(): Presence;
|
|
68
72
|
get notarizationPlugin(): NotarizationPlugin;
|
|
69
73
|
get cache(): SpaceCache | undefined;
|
|
74
|
+
get automergeSpaceState(): AutomergeSpaceState;
|
|
70
75
|
open(): Promise<void>;
|
|
71
76
|
private _open;
|
|
72
77
|
close(): Promise<void>;
|
|
@@ -83,7 +88,7 @@ export declare class DataSpace {
|
|
|
83
88
|
private _initializeAndReadControlPipeline;
|
|
84
89
|
private _createWritableFeeds;
|
|
85
90
|
updateOwnProfile(profile: ProfileDocument): Promise<void>;
|
|
86
|
-
createEpoch(): Promise<void>;
|
|
91
|
+
createEpoch(options?: CreateEpochOptions): Promise<void>;
|
|
87
92
|
activate(): Promise<void>;
|
|
88
93
|
deactivate(): Promise<void>;
|
|
89
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAiD,MAAM,aAAa,CAAC;AAInF,OAAO,
|
|
1
|
+
{"version":3,"file":"data-space.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAiD,MAAM,aAAa,CAAC;AAInF,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,KAAK,EAEV,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAE,KAAK,KAAK,IAAI,UAAU,EAAsB,MAAM,4CAA4C,CAAC;AACtH,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAEL,KAAK,eAAe,EAGrB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAK7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC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sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.9-main.03b62b6",
|
|
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,44 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"platform": "^1.3.6",
|
|
25
|
-
"@dxos/
|
|
26
|
-
"@dxos/
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/echo-pipeline": "0.3.
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/messaging": "0.3.
|
|
44
|
-
"@dxos/model-factory": "0.3.
|
|
45
|
-
"@dxos/network-manager": "0.3.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/random-access-storage": "0.3.
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/rpc": "0.3.
|
|
50
|
-
"@dxos/teleport": "0.3.
|
|
51
|
-
"@dxos/teleport
|
|
52
|
-
"@dxos/teleport-extension-object-sync": "0.3.
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
25
|
+
"@dxos/codec-protobuf": "0.3.9-main.03b62b6",
|
|
26
|
+
"@dxos/async": "0.3.9-main.03b62b6",
|
|
27
|
+
"@dxos/client-protocol": "0.3.9-main.03b62b6",
|
|
28
|
+
"@dxos/context": "0.3.9-main.03b62b6",
|
|
29
|
+
"@dxos/credentials": "0.3.9-main.03b62b6",
|
|
30
|
+
"@dxos/crypto": "0.3.9-main.03b62b6",
|
|
31
|
+
"@dxos/debug": "0.3.9-main.03b62b6",
|
|
32
|
+
"@dxos/config": "0.3.9-main.03b62b6",
|
|
33
|
+
"@dxos/echo-db": "0.3.9-main.03b62b6",
|
|
34
|
+
"@dxos/echo-pipeline": "0.3.9-main.03b62b6",
|
|
35
|
+
"@dxos/echo-schema": "0.3.9-main.03b62b6",
|
|
36
|
+
"@dxos/document-model": "0.3.9-main.03b62b6",
|
|
37
|
+
"@dxos/feed-store": "0.3.9-main.03b62b6",
|
|
38
|
+
"@dxos/invariant": "0.3.9-main.03b62b6",
|
|
39
|
+
"@dxos/keyring": "0.3.9-main.03b62b6",
|
|
40
|
+
"@dxos/lock-file": "0.3.9-main.03b62b6",
|
|
41
|
+
"@dxos/keys": "0.3.9-main.03b62b6",
|
|
42
|
+
"@dxos/log": "0.3.9-main.03b62b6",
|
|
43
|
+
"@dxos/messaging": "0.3.9-main.03b62b6",
|
|
44
|
+
"@dxos/model-factory": "0.3.9-main.03b62b6",
|
|
45
|
+
"@dxos/network-manager": "0.3.9-main.03b62b6",
|
|
46
|
+
"@dxos/protocols": "0.3.9-main.03b62b6",
|
|
47
|
+
"@dxos/random-access-storage": "0.3.9-main.03b62b6",
|
|
48
|
+
"@dxos/node-std": "0.3.9-main.03b62b6",
|
|
49
|
+
"@dxos/rpc": "0.3.9-main.03b62b6",
|
|
50
|
+
"@dxos/teleport-extension-gossip": "0.3.9-main.03b62b6",
|
|
51
|
+
"@dxos/teleport": "0.3.9-main.03b62b6",
|
|
52
|
+
"@dxos/teleport-extension-object-sync": "0.3.9-main.03b62b6",
|
|
53
|
+
"@dxos/text-model": "0.3.9-main.03b62b6",
|
|
54
|
+
"@dxos/tracing": "0.3.9-main.03b62b6",
|
|
55
|
+
"@dxos/util": "0.3.9-main.03b62b6",
|
|
56
|
+
"@dxos/websocket-rpc": "0.3.9-main.03b62b6",
|
|
57
|
+
"@dxos/timeframe": "0.3.9-main.03b62b6"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/platform": "^1.3.4",
|
|
61
61
|
"@types/readable-stream": "^2.3.9",
|
|
62
|
-
"@dxos/signal": "0.3.
|
|
62
|
+
"@dxos/signal": "0.3.9-main.03b62b6"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
SpaceManager,
|
|
13
13
|
DataServiceSubscriptions,
|
|
14
14
|
SnapshotStore,
|
|
15
|
+
AutomergeHost,
|
|
15
16
|
} from '@dxos/echo-pipeline';
|
|
16
17
|
import { FeedFactory, FeedStore } from '@dxos/feed-store';
|
|
17
18
|
import { invariant } from '@dxos/invariant';
|
|
@@ -60,6 +61,7 @@ export class ServiceContext {
|
|
|
60
61
|
public readonly spaceManager: SpaceManager;
|
|
61
62
|
public readonly identityManager: IdentityManager;
|
|
62
63
|
public readonly invitations: InvitationsHandler;
|
|
64
|
+
public readonly automergeHost: AutomergeHost;
|
|
63
65
|
|
|
64
66
|
// Initialized after identity is initialized.
|
|
65
67
|
public dataSpaceManager?: DataSpaceManager;
|
|
@@ -107,6 +109,8 @@ export class ServiceContext {
|
|
|
107
109
|
|
|
108
110
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
109
111
|
|
|
112
|
+
this.automergeHost = new AutomergeHost(storage.createDirectory('automerge'));
|
|
113
|
+
|
|
110
114
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
111
115
|
|
|
112
116
|
// TODO(burdon): _initialize called in multiple places.
|
|
@@ -215,6 +219,7 @@ export class ServiceContext {
|
|
|
215
219
|
this.keyring,
|
|
216
220
|
signingContext,
|
|
217
221
|
this.feedStore,
|
|
222
|
+
this.automergeHost,
|
|
218
223
|
);
|
|
219
224
|
await this.dataSpaceManager.open();
|
|
220
225
|
|
|
@@ -282,7 +282,10 @@ export class ClientServicesHost {
|
|
|
282
282
|
},
|
|
283
283
|
),
|
|
284
284
|
|
|
285
|
-
DataService: new DataServiceImpl(
|
|
285
|
+
DataService: new DataServiceImpl(
|
|
286
|
+
this._serviceContext.dataServiceSubscriptions,
|
|
287
|
+
this._serviceContext.automergeHost,
|
|
288
|
+
),
|
|
286
289
|
|
|
287
290
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
288
291
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type CredentialProcessor, type SpecificCredential, checkCredentialType } from '@dxos/credentials';
|
|
6
|
+
import { type Credential, type Epoch } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
7
|
+
|
|
8
|
+
export class AutomergeSpaceState implements CredentialProcessor {
|
|
9
|
+
public rootUrl: string | undefined = undefined;
|
|
10
|
+
public lastEpoch: SpecificCredential<Epoch> | undefined = undefined;
|
|
11
|
+
|
|
12
|
+
async processCredential(credential: Credential) {
|
|
13
|
+
if (!checkCredentialType(credential, 'dxos.halo.credentials.Epoch')) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
this.lastEpoch = credential;
|
|
18
|
+
if (credential.subject.assertion.automergeRoot) {
|
|
19
|
+
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
import { Event, synchronized, trackLeaks } from '@dxos/async';
|
|
6
6
|
import { cancelWithContext, Context } from '@dxos/context';
|
|
7
7
|
import { type CredentialSigner, getCredentialAssertion } from '@dxos/credentials';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
type AutomergeHost,
|
|
10
|
+
type DataServiceSubscriptions,
|
|
11
|
+
type MetadataStore,
|
|
12
|
+
type Space,
|
|
13
|
+
type SpaceManager,
|
|
14
|
+
} from '@dxos/echo-pipeline';
|
|
9
15
|
import { type FeedStore } from '@dxos/feed-store';
|
|
10
16
|
import { invariant } from '@dxos/invariant';
|
|
11
17
|
import { type Keyring } from '@dxos/keyring';
|
|
@@ -71,6 +77,9 @@ export class DataSpaceManager {
|
|
|
71
77
|
private readonly _keyring: Keyring,
|
|
72
78
|
private readonly _signingContext: SigningContext,
|
|
73
79
|
private readonly _feedStore: FeedStore<FeedMessage>,
|
|
80
|
+
|
|
81
|
+
// TODO(dmaretskyi): Make required.
|
|
82
|
+
private readonly _automergeHost?: AutomergeHost,
|
|
74
83
|
) {}
|
|
75
84
|
|
|
76
85
|
// TODO(burdon): Remove.
|
|
@@ -257,6 +266,7 @@ export class DataSpaceManager {
|
|
|
257
266
|
},
|
|
258
267
|
},
|
|
259
268
|
cache: metadata.cache,
|
|
269
|
+
automergeHost: this._automergeHost,
|
|
260
270
|
});
|
|
261
271
|
|
|
262
272
|
if (metadata.state !== SpaceState.INACTIVE) {
|
|
@@ -6,22 +6,35 @@ import { Event, scheduleTask, sleep, synchronized, trackLeaks } from '@dxos/asyn
|
|
|
6
6
|
import { AUTH_TIMEOUT } from '@dxos/client-protocol';
|
|
7
7
|
import { cancelWithContext, Context } from '@dxos/context';
|
|
8
8
|
import { timed } from '@dxos/debug';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
type MetadataStore,
|
|
11
|
+
type Space,
|
|
12
|
+
createMappedFeedWriter,
|
|
13
|
+
type DataPipeline,
|
|
14
|
+
type CreateEpochOptions,
|
|
15
|
+
type AutomergeHost,
|
|
16
|
+
} from '@dxos/echo-pipeline';
|
|
10
17
|
import { type FeedStore } from '@dxos/feed-store';
|
|
11
18
|
import { type Keyring } from '@dxos/keyring';
|
|
12
19
|
import { PublicKey } from '@dxos/keys';
|
|
13
20
|
import { log } from '@dxos/log';
|
|
14
21
|
import { CancelledError, SystemError } from '@dxos/protocols';
|
|
15
|
-
import { SpaceState, type Space as SpaceProto } from '@dxos/protocols/proto/dxos/client/services';
|
|
22
|
+
import { SpaceState, type Space as SpaceProto, CreateEpochRequest } from '@dxos/protocols/proto/dxos/client/services';
|
|
16
23
|
import { type FeedMessage } from '@dxos/protocols/proto/dxos/echo/feed';
|
|
17
24
|
import { type SpaceCache } from '@dxos/protocols/proto/dxos/echo/metadata';
|
|
18
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
AdmittedFeed,
|
|
27
|
+
type ProfileDocument,
|
|
28
|
+
type Credential,
|
|
29
|
+
type Epoch,
|
|
30
|
+
} from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
19
31
|
import { type GossipMessage } from '@dxos/protocols/proto/dxos/mesh/teleport/gossip';
|
|
20
32
|
import { type Gossip, type Presence } from '@dxos/teleport-extension-gossip';
|
|
21
33
|
import { Timeframe } from '@dxos/timeframe';
|
|
22
34
|
import { trace } from '@dxos/tracing';
|
|
23
35
|
import { ComplexSet } from '@dxos/util';
|
|
24
36
|
|
|
37
|
+
import { AutomergeSpaceState } from './automerge-space-state';
|
|
25
38
|
import { type SigningContext } from './data-space-manager';
|
|
26
39
|
import { NotarizationPlugin } from './notarization-plugin';
|
|
27
40
|
import { TrustedKeySetAuthVerifier } from '../identity';
|
|
@@ -54,6 +67,9 @@ export type DataSpaceParams = {
|
|
|
54
67
|
signingContext: SigningContext;
|
|
55
68
|
callbacks?: DataSpaceCallbacks;
|
|
56
69
|
cache?: SpaceCache;
|
|
70
|
+
|
|
71
|
+
// TODO(dmaretskyi): Make required.
|
|
72
|
+
automergeHost?: AutomergeHost;
|
|
57
73
|
};
|
|
58
74
|
|
|
59
75
|
/**
|
|
@@ -74,7 +90,11 @@ export class DataSpace {
|
|
|
74
90
|
private readonly _signingContext: SigningContext;
|
|
75
91
|
private readonly _notarizationPlugin = new NotarizationPlugin();
|
|
76
92
|
private readonly _callbacks: DataSpaceCallbacks;
|
|
77
|
-
private readonly _cache?: SpaceCache;
|
|
93
|
+
private readonly _cache?: SpaceCache = undefined;
|
|
94
|
+
private readonly _automergeHost?: AutomergeHost = undefined;
|
|
95
|
+
|
|
96
|
+
// TODO(dmaretskyi): Move into Space?
|
|
97
|
+
private readonly _automergeSpaceState = new AutomergeSpaceState();
|
|
78
98
|
|
|
79
99
|
private _state = SpaceState.CLOSED;
|
|
80
100
|
|
|
@@ -151,6 +171,10 @@ export class DataSpace {
|
|
|
151
171
|
return this._cache;
|
|
152
172
|
}
|
|
153
173
|
|
|
174
|
+
get automergeSpaceState() {
|
|
175
|
+
return this._automergeSpaceState;
|
|
176
|
+
}
|
|
177
|
+
|
|
154
178
|
@synchronized
|
|
155
179
|
async open() {
|
|
156
180
|
await this._open();
|
|
@@ -160,6 +184,7 @@ export class DataSpace {
|
|
|
160
184
|
await this._gossip.open();
|
|
161
185
|
await this._notarizationPlugin.open();
|
|
162
186
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
187
|
+
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
163
188
|
await this._inner.open(new Context());
|
|
164
189
|
this._state = SpaceState.CONTROL_ONLY;
|
|
165
190
|
log('new state', { state: SpaceState[this._state] });
|
|
@@ -183,6 +208,7 @@ export class DataSpace {
|
|
|
183
208
|
await this.authVerifier.close();
|
|
184
209
|
|
|
185
210
|
await this._inner.close();
|
|
211
|
+
await this._inner.spaceState.removeCredentialProcessor(this._automergeSpaceState);
|
|
186
212
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
187
213
|
await this._notarizationPlugin.close();
|
|
188
214
|
|
|
@@ -350,8 +376,29 @@ export class DataSpace {
|
|
|
350
376
|
await this.inner.controlPipeline.writer.write({ credential: { credential } });
|
|
351
377
|
}
|
|
352
378
|
|
|
353
|
-
async createEpoch() {
|
|
354
|
-
|
|
379
|
+
async createEpoch(options?: CreateEpochOptions) {
|
|
380
|
+
let epoch: Epoch | undefined;
|
|
381
|
+
switch (options?.migration) {
|
|
382
|
+
case undefined:
|
|
383
|
+
case CreateEpochRequest.Migration.NONE:
|
|
384
|
+
{
|
|
385
|
+
epoch = await this.dataPipeline.createEpoch();
|
|
386
|
+
}
|
|
387
|
+
break;
|
|
388
|
+
case CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
389
|
+
const document = this._automergeHost?.repo.create();
|
|
390
|
+
epoch = {
|
|
391
|
+
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
392
|
+
number: (this._automergeSpaceState.lastEpoch?.subject.assertion.number ?? -1) + 1,
|
|
393
|
+
timeframe: this._automergeSpaceState.lastEpoch?.subject.assertion.timeframe ?? new Timeframe(),
|
|
394
|
+
automergeRoot: document?.url,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (!epoch) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
355
402
|
|
|
356
403
|
const receipt = await this.inner.controlPipeline.writer.write({
|
|
357
404
|
credential: {
|
package/src/version.ts
CHANGED