@dxos/client-services 0.4.7 → 0.4.8-main.0602afb
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-NI6XJLUJ.mjs → chunk-WAR4XN64.mjs} +348 -160
- package/dist/lib/browser/chunk-WAR4XN64.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -1
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-RH65IX2V.cjs → chunk-S4SHWFEU.cjs} +323 -134
- package/dist/lib/node/chunk-S4SHWFEU.cjs.map +7 -0
- package/dist/lib/node/index.cjs +39 -37
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +1 -0
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts +9 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- 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 +2 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.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 +37 -35
- package/src/packlets/identity/identity-manager.ts +1 -1
- package/src/packlets/invitations/invitations-handler.ts +37 -2
- package/src/packlets/invitations/invitations-service.ts +83 -5
- package/src/packlets/services/service-context.ts +26 -4
- package/src/packlets/services/service-host.ts +15 -2
- package/src/packlets/spaces/automerge-space-state.ts +15 -0
- package/src/packlets/spaces/data-space.ts +33 -11
- package/src/packlets/spaces/spaces-service.ts +2 -2
- package/src/version.ts +1 -5
- package/dist/lib/browser/chunk-NI6XJLUJ.mjs.map +0 -7
- package/dist/lib/node/chunk-RH65IX2V.cjs.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"invitations-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-service.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,UAAU,EACV,KAAK,kBAAkB,EACvB,wBAAwB,EACzB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEnF;;GAEG;AACH,qBAAa,sBAAuB,YAAW,kBAAkB;IAY7D,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAbjC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA4C;IAC/E,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA+C;IAClF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA2B;IAC9D,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA2B;IAC/D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA2B;IAC3D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA2B;IAC5D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAClD,OAAO,CAAC,QAAQ,CAAC,iCAAiC,CAAe;IACjE,OAAO,CAAC,4BAA4B,CAAS;gBAG1B,mBAAmB,EAAE,kBAAkB,EACvC,WAAW,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,kBAAkB,EAC3D,cAAc,EAAE,aAAa;IAIhD,iBAAiB;IAMjB,gBAAgB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IAoDnD,yBAAyB;;;IAoB/B,gBAAgB,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC;IAqC/F,YAAY,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAW9E,gBAAgB,CAAC,EAAE,YAAY,EAAE,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBjF,gBAAgB,IAAI,MAAM,CAAC,wBAAwB,CAAC;CA+ErD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Trigger } from '@dxos/async';
|
|
2
2
|
import { Context } from '@dxos/context';
|
|
3
3
|
import { MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore, AutomergeHost } from '@dxos/echo-pipeline';
|
|
4
|
-
import { IndexMetadataStore } from '@dxos/echo-schema';
|
|
5
4
|
import { FeedStore } from '@dxos/feed-store';
|
|
5
|
+
import { IndexMetadataStore, Indexer } from '@dxos/indexing';
|
|
6
6
|
import { Keyring } from '@dxos/keyring';
|
|
7
7
|
import { type SignalManager } from '@dxos/messaging';
|
|
8
8
|
import { type ModelFactory } from '@dxos/model-factory';
|
|
@@ -40,6 +40,7 @@ export declare class ServiceContext {
|
|
|
40
40
|
readonly invitations: InvitationsHandler;
|
|
41
41
|
readonly automergeHost: AutomergeHost;
|
|
42
42
|
readonly indexMetadata: IndexMetadataStore;
|
|
43
|
+
readonly indexer: Indexer;
|
|
43
44
|
dataSpaceManager?: DataSpaceManager;
|
|
44
45
|
private readonly _handlerFactories;
|
|
45
46
|
private _deviceSpaceSync?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-context.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"service-context.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACb,aAAa,EACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAe,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAc,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAmB,MAAM,6CAA6C,CAAC;AACpG,OAAO,EAAE,KAAK,O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AO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,cAAc,CAAC,4EAA8D;IA6EzF,IAAI,CAAC,GAAG,EAAE,OAAO;IAkBjB,KAAK;IAkBL,cAAc,CAAC,MAAM,GAAE,qBAA0B;IAMvD,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,kBAAkB;IAM9F,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS;YAUnD,eAAe;YAMf,oBAAoB;YAUpB,WAAW;CAgE1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,cAAc,EAA0B,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"service-host.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/services/service-host.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,cAAc,EAA0B,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAQxC,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAoD,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGhH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAO3D,OAAO,EAAE,cAAc,EAAE,KAAK,2BAA2B,EAA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AAgB;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;IACzC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAA8B;IAG9D,OAAO,CAAC,QAAQ,CAAS;IAGzB,OAAO,CAAC,KAAK,CAAS;gBAEV,EACV,MAAM,EACN,YAA0C,EAC1C,gBAAgB,EAChB,aAAa,EACb,OAAO,EAEP,OAAO,EACP,SAAS,EACT,aAAa,GACd,GAAE,wBAA6B;IAkDhC,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;IA0GjB,KAAK;IAgBL,KAAK;YAYG,eAAe;CAqB9B"}
|
|
@@ -4,7 +4,9 @@ export declare class AutomergeSpaceState implements CredentialProcessor {
|
|
|
4
4
|
private readonly _onNewRoot;
|
|
5
5
|
rootUrl: string | undefined;
|
|
6
6
|
lastEpoch: SpecificCredential<Epoch> | undefined;
|
|
7
|
+
private _isProcessingRootDocs;
|
|
7
8
|
constructor(_onNewRoot: (rootUrl: string) => void);
|
|
8
9
|
processCredential(credential: Credential): Promise<void>;
|
|
10
|
+
startProcessingRootDocs(): void;
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=automerge-space-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automerge-space-state.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/automerge-space-state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,6CAA6C,CAAC;AAE1F,qBAAa,mBAAoB,YAAW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"automerge-space-state.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/automerge-space-state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,kBAAkB,EAAuB,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,KAAK,EAAE,MAAM,6CAA6C,CAAC;AAE1F,qBAAa,mBAAoB,YAAW,mBAAmB;IAMjD,OAAO,CAAC,QAAQ,CAAC,UAAU;IALhC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAa;IACxC,SAAS,EAAE,kBAAkB,CAAC,KAAK,CAAC,GAAG,SAAS,CAAa;IAEpE,OAAO,CAAC,qBAAqB,CAAS;gBAET,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI;IAE5D,iBAAiB,CAAC,UAAU,EAAE,UAAU;IAe9C,uBAAuB;CAUxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"data-space.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAA+D,MAAM,aAAa,CAAC;AAIjG,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,C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KAAK,cAAc,GAKzB;IAGK,IAAI;YAII,KAAK;IAcb,KAAK;YAIG,MAAM;IAkBd,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IAI/C,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI;;;IAIlE;;OAEG;IACH,2BAA2B;IAuBrB,sBAAsB;YAyCd,iCAAiC;YAyBjC,oBAAoB;IAiDlC,OAAO,CAAC,mBAAmB;IA8BrB,gBAAgB,CAAC,OAAO,EAAE,eAAe;IAWzC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB;IAwExC,QAAQ;IAWR,UAAU;CAYjB"}
|
|
@@ -19,7 +19,7 @@ export declare class SpacesServiceImpl implements SpacesService {
|
|
|
19
19
|
subscribeMessages({ spaceKey, channel }: SubscribeMessagesRequest): Stream<GossipMessage>;
|
|
20
20
|
queryCredentials({ spaceKey, noTail }: QueryCredentialsRequest): Stream<Credential>;
|
|
21
21
|
writeCredentials({ spaceKey, credentials }: WriteCredentialsRequest): Promise<void>;
|
|
22
|
-
createEpoch({ spaceKey }: CreateEpochRequest): Promise<void>;
|
|
22
|
+
createEpoch({ spaceKey, migration }: CreateEpochRequest): Promise<void>;
|
|
23
23
|
private _serializeSpace;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=spaces-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaces-service.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/spaces-service.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIvF,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,KA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I,MAAM,CAAC,mBAAmB,CAAC;IAqDpC,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB;IAMpE,iBAAiB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,wBAAwB;IAajE,gBAAgB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,uBAAuB,GAAG,MAAM,CAAC,UAAU,CAAC;IAmB7E,gBAAgB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,EAAE,uBAAuB;IAmBnE,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,kBAAkB;IAM7D,OAAO,CAAC,eAAe;CA8CxB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.4.
|
|
1
|
+
export declare const DXOS_VERSION = "0.4.8-main.0602afb";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","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.4.
|
|
3
|
+
"version": "0.4.8-main.0602afb",
|
|
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.
|
|
26
|
-
"@dxos/
|
|
27
|
-
"@dxos/
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/document-model": "0.4.
|
|
34
|
-
"@dxos/echo-db": "0.4.
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/echo-
|
|
37
|
-
"@dxos/feed-store": "0.4.
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/teleport": "0.4.
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
25
|
+
"@dxos/async": "0.4.8-main.0602afb",
|
|
26
|
+
"@dxos/client-protocol": "0.4.8-main.0602afb",
|
|
27
|
+
"@dxos/config": "0.4.8-main.0602afb",
|
|
28
|
+
"@dxos/automerge": "0.4.8-main.0602afb",
|
|
29
|
+
"@dxos/codec-protobuf": "0.4.8-main.0602afb",
|
|
30
|
+
"@dxos/context": "0.4.8-main.0602afb",
|
|
31
|
+
"@dxos/credentials": "0.4.8-main.0602afb",
|
|
32
|
+
"@dxos/crypto": "0.4.8-main.0602afb",
|
|
33
|
+
"@dxos/document-model": "0.4.8-main.0602afb",
|
|
34
|
+
"@dxos/echo-db": "0.4.8-main.0602afb",
|
|
35
|
+
"@dxos/echo-schema": "0.4.8-main.0602afb",
|
|
36
|
+
"@dxos/echo-pipeline": "0.4.8-main.0602afb",
|
|
37
|
+
"@dxos/feed-store": "0.4.8-main.0602afb",
|
|
38
|
+
"@dxos/debug": "0.4.8-main.0602afb",
|
|
39
|
+
"@dxos/indexing": "0.4.8-main.0602afb",
|
|
40
|
+
"@dxos/invariant": "0.4.8-main.0602afb",
|
|
41
|
+
"@dxos/keyring": "0.4.8-main.0602afb",
|
|
42
|
+
"@dxos/keys": "0.4.8-main.0602afb",
|
|
43
|
+
"@dxos/log": "0.4.8-main.0602afb",
|
|
44
|
+
"@dxos/messaging": "0.4.8-main.0602afb",
|
|
45
|
+
"@dxos/lock-file": "0.4.8-main.0602afb",
|
|
46
|
+
"@dxos/model-factory": "0.4.8-main.0602afb",
|
|
47
|
+
"@dxos/network-manager": "0.4.8-main.0602afb",
|
|
48
|
+
"@dxos/protocols": "0.4.8-main.0602afb",
|
|
49
|
+
"@dxos/node-std": "0.4.8-main.0602afb",
|
|
50
|
+
"@dxos/random-access-storage": "0.4.8-main.0602afb",
|
|
51
|
+
"@dxos/rpc": "0.4.8-main.0602afb",
|
|
52
|
+
"@dxos/teleport": "0.4.8-main.0602afb",
|
|
53
|
+
"@dxos/teleport-extension-gossip": "0.4.8-main.0602afb",
|
|
54
|
+
"@dxos/teleport-extension-object-sync": "0.4.8-main.0602afb",
|
|
55
|
+
"@dxos/text-model": "0.4.8-main.0602afb",
|
|
56
|
+
"@dxos/timeframe": "0.4.8-main.0602afb",
|
|
57
|
+
"@dxos/tracing": "0.4.8-main.0602afb",
|
|
58
|
+
"@dxos/util": "0.4.8-main.0602afb",
|
|
59
|
+
"@dxos/websocket-rpc": "0.4.8-main.0602afb"
|
|
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.
|
|
64
|
+
"@dxos/signal": "0.4.8-main.0602afb"
|
|
63
65
|
},
|
|
64
66
|
"publishConfig": {
|
|
65
67
|
"access": "public"
|
|
@@ -348,7 +348,7 @@ export class IdentityManager {
|
|
|
348
348
|
identityKey: identityRecord.identityKey,
|
|
349
349
|
});
|
|
350
350
|
await space.setControlFeed(controlFeed);
|
|
351
|
-
|
|
351
|
+
await space.setDataFeed(dataFeed);
|
|
352
352
|
|
|
353
353
|
const identity: Identity = new Identity({
|
|
354
354
|
space,
|
|
@@ -74,6 +74,9 @@ export class InvitationsHandler {
|
|
|
74
74
|
state = Invitation.State.INIT,
|
|
75
75
|
timeout = INVITATION_TIMEOUT,
|
|
76
76
|
swarmKey = PublicKey.random(),
|
|
77
|
+
persistent = true,
|
|
78
|
+
created = new Date(),
|
|
79
|
+
lifetime = 86400, // 1 day
|
|
77
80
|
} = options ?? {};
|
|
78
81
|
const authCode =
|
|
79
82
|
options?.authCode ??
|
|
@@ -88,14 +91,17 @@ export class InvitationsHandler {
|
|
|
88
91
|
swarmKey,
|
|
89
92
|
authCode,
|
|
90
93
|
timeout,
|
|
94
|
+
persistent,
|
|
95
|
+
created,
|
|
96
|
+
lifetime,
|
|
91
97
|
...protocol.getInvitationContext(),
|
|
92
98
|
};
|
|
93
99
|
|
|
94
100
|
const stream = new PushStream<Invitation>();
|
|
95
101
|
const ctx = new Context({
|
|
96
102
|
onError: (err) => {
|
|
97
|
-
void ctx.dispose();
|
|
98
103
|
stream.error(err);
|
|
104
|
+
void ctx.dispose();
|
|
99
105
|
},
|
|
100
106
|
});
|
|
101
107
|
|
|
@@ -181,7 +187,27 @@ export class InvitationsHandler {
|
|
|
181
187
|
return extension;
|
|
182
188
|
};
|
|
183
189
|
|
|
190
|
+
if (invitation.lifetime && invitation.created && invitation.lifetime !== 0) {
|
|
191
|
+
if (invitation.created.getTime() + invitation.lifetime * 1000 < Date.now()) {
|
|
192
|
+
log.warn('invitation has already expired');
|
|
193
|
+
} else {
|
|
194
|
+
scheduleTask(
|
|
195
|
+
ctx,
|
|
196
|
+
async () => {
|
|
197
|
+
// ensure the swarm is closed before changing state and closing the stream.
|
|
198
|
+
await swarmConnection.close();
|
|
199
|
+
stream.next({ ...invitation, state: Invitation.State.EXPIRED });
|
|
200
|
+
await ctx.dispose();
|
|
201
|
+
},
|
|
202
|
+
invitation.created.getTime() + invitation.lifetime * 1000 - Date.now(),
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
184
207
|
let swarmConnection: SwarmConnection;
|
|
208
|
+
const invitationLabel =
|
|
209
|
+
'invitation host for ' +
|
|
210
|
+
(invitation.kind === Invitation.Kind.DEVICE ? 'device' : `space ${invitation.spaceKey?.truncate()}`);
|
|
185
211
|
scheduleTask(ctx, async () => {
|
|
186
212
|
const topic = invitation.swarmKey!;
|
|
187
213
|
swarmConnection = await this._networkManager.joinSwarm({
|
|
@@ -191,7 +217,7 @@ export class InvitationsHandler {
|
|
|
191
217
|
teleport.addExtension('dxos.halo.invitations', createExtension());
|
|
192
218
|
}),
|
|
193
219
|
topology: new StarTopology(topic),
|
|
194
|
-
label:
|
|
220
|
+
label: invitationLabel,
|
|
195
221
|
});
|
|
196
222
|
ctx.onDispose(() => swarmConnection.close());
|
|
197
223
|
|
|
@@ -398,3 +424,12 @@ export class InvitationsHandler {
|
|
|
398
424
|
return observable;
|
|
399
425
|
}
|
|
400
426
|
}
|
|
427
|
+
|
|
428
|
+
export const invitationExpired = (invitation: Invitation) => {
|
|
429
|
+
return (
|
|
430
|
+
invitation.created &&
|
|
431
|
+
invitation.lifetime &&
|
|
432
|
+
invitation.lifetime !== 0 &&
|
|
433
|
+
invitation.created.getTime() + invitation.lifetime * 1000 < Date.now()
|
|
434
|
+
);
|
|
435
|
+
};
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// Copyright 2022 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Event } from '@dxos/async';
|
|
5
|
+
import { Event, scheduleTask } from '@dxos/async';
|
|
6
6
|
import { type AuthenticatingInvitation, type CancellableInvitation } from '@dxos/client-protocol';
|
|
7
7
|
import { Stream } from '@dxos/codec-protobuf';
|
|
8
|
+
import { Context } from '@dxos/context';
|
|
9
|
+
import { type MetadataStore } from '@dxos/echo-pipeline';
|
|
8
10
|
import { invariant } from '@dxos/invariant';
|
|
9
11
|
import { log } from '@dxos/log';
|
|
10
12
|
import {
|
|
@@ -16,7 +18,7 @@ import {
|
|
|
16
18
|
} from '@dxos/protocols/proto/dxos/client/services';
|
|
17
19
|
|
|
18
20
|
import { type InvitationProtocol } from './invitation-protocol';
|
|
19
|
-
import { type InvitationsHandler } from './invitations-handler';
|
|
21
|
+
import { invitationExpired, type InvitationsHandler } from './invitations-handler';
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* Adapts invitation service observable to client/service stream.
|
|
@@ -28,10 +30,14 @@ export class InvitationsServiceImpl implements InvitationsService {
|
|
|
28
30
|
private readonly _invitationAccepted = new Event<Invitation>();
|
|
29
31
|
private readonly _removedCreated = new Event<Invitation>();
|
|
30
32
|
private readonly _removedAccepted = new Event<Invitation>();
|
|
33
|
+
private readonly _saved = new Event<Invitation>();
|
|
34
|
+
private readonly _persistentInvitationsLoadedEvent = new Event();
|
|
35
|
+
private _persistentInvitationsLoaded = false;
|
|
31
36
|
|
|
32
37
|
constructor(
|
|
33
38
|
private readonly _invitationsHandler: InvitationsHandler,
|
|
34
39
|
private readonly _getHandler: (invitation: Invitation) => InvitationProtocol,
|
|
40
|
+
private readonly _metadataStore: MetadataStore,
|
|
35
41
|
) {}
|
|
36
42
|
|
|
37
43
|
// TODO(burdon): Guest/host label.
|
|
@@ -44,6 +50,7 @@ export class InvitationsServiceImpl implements InvitationsService {
|
|
|
44
50
|
createInvitation(options: Invitation): Stream<Invitation> {
|
|
45
51
|
let invitation: CancellableInvitation;
|
|
46
52
|
|
|
53
|
+
const savePersistentInvitationCtx = new Context();
|
|
47
54
|
const existingInvitation = this._createInvitations.get(options.invitationId);
|
|
48
55
|
if (existingInvitation) {
|
|
49
56
|
invitation = existingInvitation;
|
|
@@ -55,15 +62,34 @@ export class InvitationsServiceImpl implements InvitationsService {
|
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
return new Stream<Invitation>(({ next, close }) => {
|
|
65
|
+
if (invitation.get().persistent) {
|
|
66
|
+
scheduleTask(savePersistentInvitationCtx, async () => {
|
|
67
|
+
try {
|
|
68
|
+
await this._metadataStore.addInvitation(invitation.get());
|
|
69
|
+
this._saved.emit(invitation.get());
|
|
70
|
+
} catch (err: any) {
|
|
71
|
+
close(err);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
58
75
|
invitation.subscribe(
|
|
59
76
|
(invitation) => {
|
|
60
77
|
next(invitation);
|
|
61
78
|
},
|
|
62
|
-
(err: Error) => {
|
|
79
|
+
async (err: Error) => {
|
|
80
|
+
await savePersistentInvitationCtx.dispose();
|
|
81
|
+
|
|
82
|
+
// TODO(nf): also remove from storage?
|
|
63
83
|
close(err);
|
|
64
84
|
},
|
|
65
|
-
() => {
|
|
85
|
+
async () => {
|
|
66
86
|
close();
|
|
87
|
+
if (invitation.get().persistent) {
|
|
88
|
+
await savePersistentInvitationCtx.dispose();
|
|
89
|
+
// TODO(nf): remove on all complete conditions?
|
|
90
|
+
await this._metadataStore.removeInvitation(invitation.get().invitationId);
|
|
91
|
+
}
|
|
92
|
+
|
|
67
93
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
68
94
|
if (invitation.get().type !== Invitation.Type.MULTIUSE) {
|
|
69
95
|
this._removedCreated.emit(invitation.get());
|
|
@@ -73,6 +99,26 @@ export class InvitationsServiceImpl implements InvitationsService {
|
|
|
73
99
|
});
|
|
74
100
|
}
|
|
75
101
|
|
|
102
|
+
async loadPersistentInvitations() {
|
|
103
|
+
const persistentInvitations = this._metadataStore.getInvitations();
|
|
104
|
+
|
|
105
|
+
// get saved persistent invitations, filter and remove from storage those that have expired.
|
|
106
|
+
const freshInvitations = persistentInvitations.filter(async (invitation) => !invitationExpired(invitation));
|
|
107
|
+
|
|
108
|
+
const cInvitations = freshInvitations.map((persistentInvitation) => {
|
|
109
|
+
invariant(!this._createInvitations.get(persistentInvitation.invitationId), 'invitation already exists');
|
|
110
|
+
|
|
111
|
+
const handler = this._getHandler(persistentInvitation);
|
|
112
|
+
const invitation = this._invitationsHandler.createInvitation(handler, persistentInvitation);
|
|
113
|
+
this._createInvitations.set(invitation.get().invitationId, invitation);
|
|
114
|
+
this._invitationCreated.emit(invitation.get());
|
|
115
|
+
return persistentInvitation;
|
|
116
|
+
});
|
|
117
|
+
this._persistentInvitationsLoadedEvent.emit();
|
|
118
|
+
this._persistentInvitationsLoaded = true;
|
|
119
|
+
return { invitations: cInvitations };
|
|
120
|
+
}
|
|
121
|
+
|
|
76
122
|
acceptInvitation({ invitation: options, deviceProfile }: AcceptInvitationRequest): Stream<Invitation> {
|
|
77
123
|
let invitation: AuthenticatingInvitation;
|
|
78
124
|
|
|
@@ -122,7 +168,7 @@ export class InvitationsServiceImpl implements InvitationsService {
|
|
|
122
168
|
}
|
|
123
169
|
|
|
124
170
|
async cancelInvitation({ invitationId }: { invitationId: string }): Promise<void> {
|
|
125
|
-
log('
|
|
171
|
+
log('cancelInvitation...', { invitationId });
|
|
126
172
|
invariant(invitationId);
|
|
127
173
|
const created = this._createInvitations.get(invitationId);
|
|
128
174
|
const accepted = this._acceptInvitations.get(invitationId);
|
|
@@ -130,6 +176,9 @@ export class InvitationsServiceImpl implements InvitationsService {
|
|
|
130
176
|
await created.cancel();
|
|
131
177
|
this._createInvitations.delete(invitationId);
|
|
132
178
|
this._removedCreated.emit(created.get());
|
|
179
|
+
if (created.get().persistent) {
|
|
180
|
+
await this._metadataStore.removeInvitation(created.get().invitationId);
|
|
181
|
+
}
|
|
133
182
|
} else if (accepted) {
|
|
134
183
|
await accepted.cancel();
|
|
135
184
|
this._acceptInvitations.delete(invitationId);
|
|
@@ -173,18 +222,47 @@ export class InvitationsServiceImpl implements InvitationsService {
|
|
|
173
222
|
});
|
|
174
223
|
});
|
|
175
224
|
|
|
225
|
+
// used only for testing
|
|
226
|
+
this._saved.on(ctx, (invitation) => {
|
|
227
|
+
next({
|
|
228
|
+
action: QueryInvitationsResponse.Action.SAVED,
|
|
229
|
+
type: QueryInvitationsResponse.Type.CREATED,
|
|
230
|
+
invitations: [invitation],
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
|
|
176
234
|
// Push existing invitations to the stream.
|
|
177
235
|
next({
|
|
178
236
|
action: QueryInvitationsResponse.Action.ADDED,
|
|
179
237
|
type: QueryInvitationsResponse.Type.CREATED,
|
|
180
238
|
invitations: Array.from(this._createInvitations.values()).map((invitation) => invitation.get()),
|
|
239
|
+
existing: true,
|
|
181
240
|
});
|
|
182
241
|
|
|
183
242
|
next({
|
|
184
243
|
action: QueryInvitationsResponse.Action.ADDED,
|
|
185
244
|
type: QueryInvitationsResponse.Type.ACCEPTED,
|
|
186
245
|
invitations: Array.from(this._acceptInvitations.values()).map((invitation) => invitation.get()),
|
|
246
|
+
existing: true,
|
|
187
247
|
});
|
|
248
|
+
|
|
249
|
+
if (this._persistentInvitationsLoaded) {
|
|
250
|
+
next({
|
|
251
|
+
action: QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
252
|
+
type: QueryInvitationsResponse.Type.CREATED,
|
|
253
|
+
// TODO(nf): populate with invitations
|
|
254
|
+
});
|
|
255
|
+
} else {
|
|
256
|
+
this._persistentInvitationsLoadedEvent.on(ctx, () => {
|
|
257
|
+
next({
|
|
258
|
+
action: QueryInvitationsResponse.Action.LOAD_COMPLETE,
|
|
259
|
+
type: QueryInvitationsResponse.Type.CREATED,
|
|
260
|
+
// TODO(nf): populate with invitations
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// TODO(nf): expired invitations?
|
|
188
266
|
});
|
|
189
267
|
}
|
|
190
268
|
}
|
|
@@ -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';
|
|
@@ -256,8 +257,10 @@ export class ClientServicesHost {
|
|
|
256
257
|
(profile) => this._serviceContext.broadcastProfileUpdate(profile),
|
|
257
258
|
),
|
|
258
259
|
|
|
259
|
-
InvitationsService: new InvitationsServiceImpl(
|
|
260
|
-
this._serviceContext.
|
|
260
|
+
InvitationsService: new InvitationsServiceImpl(
|
|
261
|
+
this._serviceContext.invitations,
|
|
262
|
+
(invitation) => this._serviceContext.getInvitationHandler(invitation),
|
|
263
|
+
this._serviceContext.metadataStore,
|
|
261
264
|
),
|
|
262
265
|
|
|
263
266
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
@@ -277,6 +280,11 @@ export class ClientServicesHost {
|
|
|
277
280
|
this._serviceContext.automergeHost,
|
|
278
281
|
),
|
|
279
282
|
|
|
283
|
+
IndexService: new IndexServiceImpl({
|
|
284
|
+
indexer: this._serviceContext.indexer,
|
|
285
|
+
automergeHost: this._serviceContext.automergeHost,
|
|
286
|
+
}),
|
|
287
|
+
|
|
280
288
|
NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
|
|
281
289
|
|
|
282
290
|
LoggingService: this._loggingService,
|
|
@@ -291,6 +299,11 @@ export class ClientServicesHost {
|
|
|
291
299
|
});
|
|
292
300
|
|
|
293
301
|
await this._serviceContext.open(ctx);
|
|
302
|
+
// TODO(nf): move to InvitationManager in ServiceContext?
|
|
303
|
+
invariant(this.serviceRegistry.services.InvitationsService);
|
|
304
|
+
const loadedInvitations = await this.serviceRegistry.services.InvitationsService.loadPersistentInvitations();
|
|
305
|
+
|
|
306
|
+
log('loaded persistent invitations', { count: loadedInvitations.invitations?.length });
|
|
294
307
|
|
|
295
308
|
const devtoolsProxy = this._config?.get('runtime.client.devtoolsProxy');
|
|
296
309
|
if (devtoolsProxy) {
|
|
@@ -9,6 +9,8 @@ export class AutomergeSpaceState implements CredentialProcessor {
|
|
|
9
9
|
public rootUrl: string | undefined = undefined;
|
|
10
10
|
public lastEpoch: SpecificCredential<Epoch> | undefined = undefined;
|
|
11
11
|
|
|
12
|
+
private _isProcessingRootDocs = false;
|
|
13
|
+
|
|
12
14
|
constructor(private readonly _onNewRoot: (rootUrl: string) => void) {}
|
|
13
15
|
|
|
14
16
|
async processCredential(credential: Credential) {
|
|
@@ -20,7 +22,20 @@ export class AutomergeSpaceState implements CredentialProcessor {
|
|
|
20
22
|
if (credential.subject.assertion.automergeRoot) {
|
|
21
23
|
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
22
24
|
|
|
25
|
+
if (this._isProcessingRootDocs) {
|
|
26
|
+
this._onNewRoot(this.rootUrl);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
startProcessingRootDocs() {
|
|
32
|
+
if (this._isProcessingRootDocs) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (this.rootUrl) {
|
|
23
37
|
this._onNewRoot(this.rootUrl);
|
|
24
38
|
}
|
|
39
|
+
this._isProcessingRootDocs = true;
|
|
25
40
|
}
|
|
26
41
|
}
|