@dxos/client-services 0.6.3-main.cc41ccb → 0.6.3-main.d16c079
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-RUTIZVA6.mjs → chunk-APJA66TL.mjs} +83 -83
- package/dist/lib/browser/chunk-APJA66TL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +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-2XAIFOAY.cjs → chunk-XATWBGGC.cjs} +81 -81
- package/dist/lib/node/chunk-XATWBGGC.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -45
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/invitations/invitation-guest-extenstion.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-topology.d.ts +2 -2
- package/dist/types/src/packlets/invitations/invitation-topology.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +36 -36
- package/src/packlets/identity/identity-service.ts +2 -2
- package/src/packlets/invitations/invitation-guest-extenstion.ts +8 -5
- package/src/packlets/invitations/invitation-host-extension.ts +5 -5
- package/src/packlets/invitations/invitation-topology.ts +4 -4
- package/src/packlets/invitations/invitations-handler.ts +6 -5
- package/src/packlets/spaces/data-space-manager.test.ts +6 -6
- package/src/packlets/spaces/data-space-manager.ts +6 -6
- package/src/packlets/spaces/data-space.ts +18 -18
- package/src/packlets/spaces/spaces-service.ts +2 -2
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-RUTIZVA6.mjs.map +0 -7
- package/dist/lib/node/chunk-2XAIFOAY.cjs.map +0 -7
|
@@ -30,7 +30,7 @@ __export(testing_exports, {
|
|
|
30
30
|
sanitizeInvitation: () => sanitizeInvitation
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(testing_exports);
|
|
33
|
-
var
|
|
33
|
+
var import_chunk_XATWBGGC = require("../../chunk-XATWBGGC.cjs");
|
|
34
34
|
var import_credentials = require("@dxos/credentials");
|
|
35
35
|
var import_keys = require("@dxos/keys");
|
|
36
36
|
var import_async = require("@dxos/async");
|
|
@@ -227,7 +227,7 @@ var createInvitation = async (host, options) => {
|
|
|
227
227
|
authMethod: import_services.Invitation.AuthMethod.NONE,
|
|
228
228
|
...options ?? {}
|
|
229
229
|
};
|
|
230
|
-
if (host instanceof
|
|
230
|
+
if (host instanceof import_chunk_XATWBGGC.ServiceContext) {
|
|
231
231
|
return host.invitationsManager.createInvitation({
|
|
232
232
|
kind: import_services.Invitation.Kind.SPACE,
|
|
233
233
|
...options
|
|
@@ -237,7 +237,7 @@ var createInvitation = async (host, options) => {
|
|
|
237
237
|
};
|
|
238
238
|
var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
239
239
|
invitation = sanitizeInvitation(invitation);
|
|
240
|
-
if (guest instanceof
|
|
240
|
+
if (guest instanceof import_chunk_XATWBGGC.ServiceContext) {
|
|
241
241
|
return guest.invitationsManager.acceptInvitation({
|
|
242
242
|
invitation,
|
|
243
243
|
deviceProfile: guestDeviceProfile
|
|
@@ -247,7 +247,7 @@ var acceptInvitation = (guest, invitation, guestDeviceProfile) => {
|
|
|
247
247
|
};
|
|
248
248
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/testing/test-builder.ts";
|
|
249
249
|
var createServiceHost = (config, signalManagerContext) => {
|
|
250
|
-
return new
|
|
250
|
+
return new import_chunk_XATWBGGC.ClientServicesHost({
|
|
251
251
|
config,
|
|
252
252
|
signalManager: new import_messaging.MemorySignalManager(signalManagerContext),
|
|
253
253
|
transportFactory: import_network_manager.MemoryTransportFactory
|
|
@@ -263,7 +263,7 @@ var createServiceContext = async ({ signalContext = new import_messaging.MemoryS
|
|
|
263
263
|
});
|
|
264
264
|
const level = (0, import_testing.createTestLevel)();
|
|
265
265
|
await level.open();
|
|
266
|
-
return new
|
|
266
|
+
return new import_chunk_XATWBGGC.ServiceContext(storage, level, networkManager, signalManager, {
|
|
267
267
|
invitationConnectionDefaultParams: {
|
|
268
268
|
controlHeartbeatInterval: 200
|
|
269
269
|
},
|
|
@@ -370,12 +370,12 @@ var TestPeer = class {
|
|
|
370
370
|
});
|
|
371
371
|
}
|
|
372
372
|
get dataSpaceManager() {
|
|
373
|
-
return this._props.dataSpaceManager ??= new
|
|
373
|
+
return this._props.dataSpaceManager ??= new import_chunk_XATWBGGC.DataSpaceManager(this.spaceManager, this.metadataStore, this.keyring, this.identity, this.feedStore, this.echoHost, this.invitationsManager, this._opts.dataSpaceParams);
|
|
374
374
|
}
|
|
375
375
|
get invitationsManager() {
|
|
376
|
-
return this._props.invitationsManager ??= new
|
|
376
|
+
return this._props.invitationsManager ??= new import_chunk_XATWBGGC.InvitationsManager(new import_chunk_XATWBGGC.InvitationsHandler(this.networkManager), (invitation) => {
|
|
377
377
|
if (invitation.kind === import_services2.Invitation.Kind.SPACE) {
|
|
378
|
-
return new
|
|
378
|
+
return new import_chunk_XATWBGGC.SpaceInvitationProtocol(this.dataSpaceManager, this.identity, this.keyring, invitation.spaceKey);
|
|
379
379
|
} else {
|
|
380
380
|
throw new Error("not implemented");
|
|
381
381
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitation-guest-extenstion.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitation-guest-extenstion.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAA4B,MAAM,aAAa,CAAC;AACnE,OAAO,EAAqB,OAAO,EAAE,MAAM,eAAe,CAAC;AAI3D,OAAO,EAAE,KAA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AE,qBAAqB,EAAE,qBAAqB,CAAA;KAAE,CAAC;IAqBlF,MAAM,CAAC,OAAO,EAAE,gBAAgB;IAiChC,OAAO;IAIP,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAIzB,QAAQ;CAQvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitation-host-extension.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitation-host-extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAmB,OAAO,EAAgB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAqB,OAAO,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAEtB,KAAK,qBAAqB,EAE3B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOrE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,KAAK,gCAAgC,GAAG;IACtC,gBAAgB,EAAE,UAAU,GAAG,IAAI,CAAC;IAGpC,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/D,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEhC,aAAa,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC;IAEpD,KAAK,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,YAAY,CACvD;IAAE,qBAAqB,EAAE,qBAAqB,CAAA;CAAE,EAChD;IAAE,qBAAqB,EAAE,qBAAqB,CAAA;CAAE,CACjD;IA8BG,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU;IA1B7B,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"invitation-host-extension.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitation-host-extension.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAmB,OAAO,EAAgB,MAAM,aAAa,CAAC;AACjF,OAAO,EAAqB,OAAO,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EAEtB,KAAK,qBAAqB,EAE3B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOrE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,KAAK,gCAAgC,GAAG;IACtC,gBAAgB,EAAE,UAAU,GAAG,IAAI,CAAC;IAGpC,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/D,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEhC,aAAa,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,KAAK,IAAI,CAAC;IAEpD,KAAK,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,YAAY,CACvD;IAAE,qBAAqB,EAAE,qBAAqB,CAAA;CAAE,EAChD;IAAE,qBAAqB,EAAE,qBAAqB,CAAA;CAAE,CACjD;IA8BG,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU;IA1B7B,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,qBAAqB,CAAiB;IAE9C,OAAO,CAAC,UAAU,CAAC,CAAqB;IAEjC,YAAY,CAAC,EAAE,eAAe,CAAa;IAE3C,oBAAoB,UAAS;IAEpC;;OAEG;IACI,mBAAmB,SAAK;IAE/B;;OAEG;IACI,gBAAgB,qBAA4B;IAEnD;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAA2B;gBAGnC,oBAAoB,EAAE,KAAK,EAC3B,UAAU,EAAE,gCAAgC;IAYxD,WAAW,IAAI,OAAO;cAIJ,WAAW,IAAI,OAAO,CAAC;QAAE,qBAAqB,EAAE,qBAAqB,CAAA;KAAE,CAAC;IA0IlF,MAAM,CAAC,OAAO,EAAE,gBAAgB;IAkC/C,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,sBAAsB;IAWf,OAAO;IAIP,OAAO;YAIR,QAAQ;CAQvB;AAED,eAAO,MAAM,wBAAwB,eAAgB,UAAU,YACT,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PublicKey } from '@dxos/keys';
|
|
2
2
|
import type { SwarmController, Topology } from '@dxos/network-manager';
|
|
3
|
-
import {
|
|
3
|
+
import { InvitationOptions } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
4
4
|
/**
|
|
5
5
|
* Hosts are listening on an invitation topic.
|
|
6
6
|
* They initiate a connection with any new peer if they are not currently in the invitation flow
|
|
@@ -27,7 +27,7 @@ export declare class InvitationTopology implements Topology {
|
|
|
27
27
|
* for guests we failed an invitation flow with (potentially due to a network error).
|
|
28
28
|
*/
|
|
29
29
|
private _seenPeers;
|
|
30
|
-
constructor(_role:
|
|
30
|
+
constructor(_role: InvitationOptions.Role);
|
|
31
31
|
init(controller: SwarmController): void;
|
|
32
32
|
update(): void;
|
|
33
33
|
onOffer(peer: PublicKey): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitation-topology.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitation-topology.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"invitation-topology.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitation-topology.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAGhF;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAmB,YAAW,QAAQ;IAarC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAZlC,OAAO,CAAC,WAAW,CAAC,CAAkB;IAEtC;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU,CAA6C;gBAElC,KAAK,EAAE,iBAAiB,CAAC,IAAI;IAE1D,IAAI,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI;IAKvC,MAAM,IAAI,IAAI;IA6BR,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC;IAK1C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,QAAQ;CAGT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitations-handler.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/invitations/invitations-handler.ts"],"names":[],"mappings":";AAIA,OAAO,EAAS,KAAK,U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,IAAI;YA+JO,UAAU;IA2BxB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAsD3B,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,cAAc;YAUR,mBAAmB;YA6BnB,mBAAmB;CAsBlC;AAED,eAAO,MAAM,sBAAsB,QAAO,gBAGzC,CAAC"}
|
|
@@ -65,7 +65,7 @@ export declare class DataSpace {
|
|
|
65
65
|
private _state;
|
|
66
66
|
private _databaseRoot;
|
|
67
67
|
/**
|
|
68
|
-
* Error for _state === SpaceState.
|
|
68
|
+
* Error for _state === SpaceState.SPACE_ERROR.
|
|
69
69
|
*/
|
|
70
70
|
error: Error | undefined;
|
|
71
71
|
readonly authVerifier: TrustedKeySetAuthVerifier;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-space.d.ts","sourceRoot":"","sources":["../../../../../src/packlets/spaces/data-space.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAwD,MAAM,aAAa,CAAC;AAG1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAA0B,KAAK,aAAa,EAAE,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE7F,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,OAAO,EACL,KAAK,kBAAkB,EACvB,UAAU,EACV,KAAK,KAAK,IAAI,UAAU,EACzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAIL,KAAK,KAAK,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,UAAU,CAEtB;IAGD,IAAI,KAAK,UAER;IAED,IAAI,QAAQ,aAEX;IAED,IAAI,kBAAkB,uBAErB;IAED,IAAI,KAAK,2BAER;IAED,IAAI,mBAAmB,wBAEtB;IAED,IAAI,YAAY,IAAI,YAAY,GAAG,IAAI,CAEtC;IAGD,OAAO,KAAK,cAAc,GAKzB;IAGK,IAAI;YAMI,KAAK;IAgBb,KAAK;YAIG,MAAM;IAmBd,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;YAqBd,gBAAgB;YAWhB,iCAAiC;YAyBjC,oBAAoB;IAiDlC,OAAO,CAAC,mBAAmB;IAkDrB,gBAAgB,CAAC,OAAO,EAAE,eAAe;IAWzC,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IA4C5E,QAAQ;IAWR,UAAU;CAajB;AAED,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACtC,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DXOS_VERSION = "0.6.3-main.
|
|
1
|
+
export declare const DXOS_VERSION = "0.6.3-main.d16c079";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/client-services",
|
|
3
|
-
"version": "0.6.3-main.
|
|
3
|
+
"version": "0.6.3-main.d16c079",
|
|
4
4
|
"description": "DXOS client services implementation",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -23,45 +23,45 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"platform": "^1.3.6",
|
|
26
|
-
"@dxos/async": "0.6.3-main.
|
|
27
|
-
"@dxos/client-protocol": "0.6.3-main.
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/context": "0.6.3-main.
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/echo-
|
|
36
|
-
"@dxos/echo-
|
|
37
|
-
"@dxos/echo-
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/keyring": "0.6.3-main.
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/lock-file": "0.6.3-main.
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/node-std": "0.6.3-main.
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/teleport-extension-gossip": "0.6.3-main.
|
|
55
|
-
"@dxos/teleport-extension-object-sync": "0.6.3-main.
|
|
56
|
-
"@dxos/timeframe": "0.6.3-main.
|
|
57
|
-
"@dxos/tracing": "0.6.3-main.
|
|
58
|
-
"@dxos/util": "0.6.3-main.
|
|
59
|
-
"@dxos/websocket-rpc": "0.6.3-main.
|
|
26
|
+
"@dxos/async": "0.6.3-main.d16c079",
|
|
27
|
+
"@dxos/client-protocol": "0.6.3-main.d16c079",
|
|
28
|
+
"@dxos/config": "0.6.3-main.d16c079",
|
|
29
|
+
"@dxos/context": "0.6.3-main.d16c079",
|
|
30
|
+
"@dxos/credentials": "0.6.3-main.d16c079",
|
|
31
|
+
"@dxos/crypto": "0.6.3-main.d16c079",
|
|
32
|
+
"@dxos/debug": "0.6.3-main.d16c079",
|
|
33
|
+
"@dxos/codec-protobuf": "0.6.3-main.d16c079",
|
|
34
|
+
"@dxos/echo-db": "0.6.3-main.d16c079",
|
|
35
|
+
"@dxos/echo-protocol": "0.6.3-main.d16c079",
|
|
36
|
+
"@dxos/echo-pipeline": "0.6.3-main.d16c079",
|
|
37
|
+
"@dxos/echo-schema": "0.6.3-main.d16c079",
|
|
38
|
+
"@dxos/feed-store": "0.6.3-main.d16c079",
|
|
39
|
+
"@dxos/invariant": "0.6.3-main.d16c079",
|
|
40
|
+
"@dxos/automerge": "0.6.3-main.d16c079",
|
|
41
|
+
"@dxos/indexing": "0.6.3-main.d16c079",
|
|
42
|
+
"@dxos/keyring": "0.6.3-main.d16c079",
|
|
43
|
+
"@dxos/keys": "0.6.3-main.d16c079",
|
|
44
|
+
"@dxos/log": "0.6.3-main.d16c079",
|
|
45
|
+
"@dxos/lock-file": "0.6.3-main.d16c079",
|
|
46
|
+
"@dxos/kv-store": "0.6.3-main.d16c079",
|
|
47
|
+
"@dxos/network-manager": "0.6.3-main.d16c079",
|
|
48
|
+
"@dxos/messaging": "0.6.3-main.d16c079",
|
|
49
|
+
"@dxos/node-std": "0.6.3-main.d16c079",
|
|
50
|
+
"@dxos/random-access-storage": "0.6.3-main.d16c079",
|
|
51
|
+
"@dxos/protocols": "0.6.3-main.d16c079",
|
|
52
|
+
"@dxos/rpc": "0.6.3-main.d16c079",
|
|
53
|
+
"@dxos/teleport": "0.6.3-main.d16c079",
|
|
54
|
+
"@dxos/teleport-extension-gossip": "0.6.3-main.d16c079",
|
|
55
|
+
"@dxos/teleport-extension-object-sync": "0.6.3-main.d16c079",
|
|
56
|
+
"@dxos/timeframe": "0.6.3-main.d16c079",
|
|
57
|
+
"@dxos/tracing": "0.6.3-main.d16c079",
|
|
58
|
+
"@dxos/util": "0.6.3-main.d16c079",
|
|
59
|
+
"@dxos/websocket-rpc": "0.6.3-main.d16c079"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/platform": "^1.3.4",
|
|
63
63
|
"@types/readable-stream": "^2.3.9",
|
|
64
|
-
"@dxos/signal": "0.6.3-main.
|
|
64
|
+
"@dxos/signal": "0.6.3-main.d16c079"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
|
@@ -114,13 +114,13 @@ export class IdentityServiceImpl extends Resource implements IdentityService {
|
|
|
114
114
|
const allProcessed = safeAwaitAll(
|
|
115
115
|
dataSpaceManager.spaces.values(),
|
|
116
116
|
async (space) => {
|
|
117
|
-
if (space.state === SpaceState.
|
|
117
|
+
if (space.state === SpaceState.SPACE_CLOSED) {
|
|
118
118
|
await space.open();
|
|
119
119
|
|
|
120
120
|
// Wait until the space is either READY or REQUIRES_MIGRATION.
|
|
121
121
|
// NOTE: Space could potentially never initialize if the space data is corrupted.
|
|
122
122
|
const requiresMigration = space.stateUpdate.waitForCondition(
|
|
123
|
-
() => space.state === SpaceState.
|
|
123
|
+
() => space.state === SpaceState.SPACE_REQUIRES_MIGRATION,
|
|
124
124
|
);
|
|
125
125
|
await Promise.race([space.initializeDataPipeline(), requiresMigration]);
|
|
126
126
|
}
|
|
@@ -8,7 +8,7 @@ import { invariant } from '@dxos/invariant';
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
import { InvalidInvitationExtensionRoleError, schema } from '@dxos/protocols';
|
|
10
10
|
import { type Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
11
|
-
import { type InvitationHostService,
|
|
11
|
+
import { type InvitationHostService, InvitationOptions } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
12
12
|
import { type ExtensionContext, RpcExtension } from '@dxos/teleport';
|
|
13
13
|
|
|
14
14
|
import { tryAcquireBeforeContextDisposed } from './utils';
|
|
@@ -31,7 +31,7 @@ export class InvitationGuestExtension extends RpcExtension<
|
|
|
31
31
|
{ InvitationHostService: InvitationHostService }
|
|
32
32
|
> {
|
|
33
33
|
private _ctx = new Context();
|
|
34
|
-
private _remoteOptions?:
|
|
34
|
+
private _remoteOptions?: InvitationOptions;
|
|
35
35
|
private _remoteOptionsTrigger = new Trigger();
|
|
36
36
|
/**
|
|
37
37
|
* Held to allow only one invitation flow at a time to be active.
|
|
@@ -84,13 +84,16 @@ export class InvitationGuestExtension extends RpcExtension<
|
|
|
84
84
|
log('guest acquire lock');
|
|
85
85
|
this._invitationFlowLock = await tryAcquireBeforeContextDisposed(this._ctx, this._invitationFlowMutex);
|
|
86
86
|
log('guest lock acquired');
|
|
87
|
-
await cancelWithContext(
|
|
87
|
+
await cancelWithContext(
|
|
88
|
+
this._ctx,
|
|
89
|
+
this.rpc.InvitationHostService.options({ role: InvitationOptions.Role.GUEST }),
|
|
90
|
+
);
|
|
88
91
|
log('options sent');
|
|
89
92
|
await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({ timeout: OPTIONS_TIMEOUT }));
|
|
90
93
|
log('options received');
|
|
91
|
-
if (this._remoteOptions?.role !==
|
|
94
|
+
if (this._remoteOptions?.role !== InvitationOptions.Role.HOST) {
|
|
92
95
|
throw new InvalidInvitationExtensionRoleError(undefined, {
|
|
93
|
-
expected:
|
|
96
|
+
expected: InvitationOptions.Role.HOST,
|
|
94
97
|
remoteOptions: this._remoteOptions,
|
|
95
98
|
remotePeerId: context.remotePeerId,
|
|
96
99
|
});
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
type AdmissionResponse,
|
|
17
17
|
AuthenticationResponse,
|
|
18
18
|
type InvitationHostService,
|
|
19
|
-
|
|
19
|
+
InvitationOptions,
|
|
20
20
|
} from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
21
21
|
import { type ExtensionContext, RpcExtension } from '@dxos/teleport';
|
|
22
22
|
|
|
@@ -50,7 +50,7 @@ export class InvitationHostExtension extends RpcExtension<
|
|
|
50
50
|
* @internal
|
|
51
51
|
*/
|
|
52
52
|
private _ctx = new Context();
|
|
53
|
-
private _remoteOptions?:
|
|
53
|
+
private _remoteOptions?: InvitationOptions;
|
|
54
54
|
private _remoteOptionsTrigger = new Trigger();
|
|
55
55
|
|
|
56
56
|
private _challenge?: Buffer = undefined;
|
|
@@ -239,15 +239,15 @@ export class InvitationHostExtension extends RpcExtension<
|
|
|
239
239
|
log('host lock acquired');
|
|
240
240
|
const lastState = this._requireActiveInvitation().state;
|
|
241
241
|
this._callbacks.onStateUpdate(Invitation.State.CONNECTING);
|
|
242
|
-
await this.rpc.InvitationHostService.options({ role:
|
|
242
|
+
await this.rpc.InvitationHostService.options({ role: InvitationOptions.Role.HOST });
|
|
243
243
|
log('options sent');
|
|
244
244
|
await cancelWithContext(this._ctx, this._remoteOptionsTrigger.wait({ timeout: OPTIONS_TIMEOUT }));
|
|
245
245
|
log('options received');
|
|
246
|
-
if (this._remoteOptions?.role !==
|
|
246
|
+
if (this._remoteOptions?.role !== InvitationOptions.Role.GUEST) {
|
|
247
247
|
// we connected with another host, restore previous real invitation flow status
|
|
248
248
|
this._callbacks.onStateUpdate(lastState);
|
|
249
249
|
throw new InvalidInvitationExtensionRoleError(undefined, {
|
|
250
|
-
expected:
|
|
250
|
+
expected: InvitationOptions.Role.GUEST,
|
|
251
251
|
remoteOptions: this._remoteOptions,
|
|
252
252
|
remotePeerId: context.remotePeerId,
|
|
253
253
|
});
|
|
@@ -6,7 +6,7 @@ import { invariant } from '@dxos/invariant';
|
|
|
6
6
|
import { PublicKey } from '@dxos/keys';
|
|
7
7
|
import { log } from '@dxos/log';
|
|
8
8
|
import type { SwarmController, Topology } from '@dxos/network-manager';
|
|
9
|
-
import {
|
|
9
|
+
import { InvitationOptions } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
10
10
|
import { ComplexSet } from '@dxos/util';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -36,7 +36,7 @@ export class InvitationTopology implements Topology {
|
|
|
36
36
|
*/
|
|
37
37
|
private _seenPeers = new ComplexSet<PublicKey>(PublicKey.hash);
|
|
38
38
|
|
|
39
|
-
constructor(private readonly _role:
|
|
39
|
+
constructor(private readonly _role: InvitationOptions.Role) {}
|
|
40
40
|
|
|
41
41
|
init(controller: SwarmController): void {
|
|
42
42
|
invariant(!this._controller, 'Already initialized.');
|
|
@@ -48,7 +48,7 @@ export class InvitationTopology implements Topology {
|
|
|
48
48
|
const { ownPeerId, candidates, connected, allPeers } = this._controller.getState();
|
|
49
49
|
|
|
50
50
|
// guests don't initiate connections
|
|
51
|
-
if (this._role ===
|
|
51
|
+
if (this._role === InvitationOptions.Role.GUEST) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -82,6 +82,6 @@ export class InvitationTopology implements Topology {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
toString() {
|
|
85
|
-
return `InvitationTopology(${this._role ===
|
|
85
|
+
return `InvitationTopology(${this._role === InvitationOptions.Role.GUEST ? 'guest' : 'host'})`;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -14,7 +14,7 @@ import { InvalidInvitationExtensionRoleError, trace } from '@dxos/protocols';
|
|
|
14
14
|
import { type AdmissionKeypair, Invitation } from '@dxos/protocols/proto/dxos/client/services';
|
|
15
15
|
import { type DeviceProfileDocument } from '@dxos/protocols/proto/dxos/halo/credentials';
|
|
16
16
|
import { AuthenticationResponse, type IntroductionResponse } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
17
|
-
import {
|
|
17
|
+
import { InvitationOptions } from '@dxos/protocols/proto/dxos/halo/invitations';
|
|
18
18
|
import { type ExtensionContext, type TeleportExtension, type TeleportParams } from '@dxos/teleport';
|
|
19
19
|
import { trace as _trace } from '@dxos/tracing';
|
|
20
20
|
import { ComplexSet } from '@dxos/util';
|
|
@@ -26,6 +26,7 @@ import { InvitationTopology } from './invitation-topology';
|
|
|
26
26
|
import { stateToString } from './utils';
|
|
27
27
|
|
|
28
28
|
const metrics = _trace.metrics;
|
|
29
|
+
|
|
29
30
|
const MAX_DELEGATED_INVITATION_HOST_TRIES = 3;
|
|
30
31
|
|
|
31
32
|
type InvitationExtension = InvitationHostExtension | InvitationGuestExtension;
|
|
@@ -187,7 +188,7 @@ export class InvitationsHandler {
|
|
|
187
188
|
|
|
188
189
|
let swarmConnection: SwarmConnection;
|
|
189
190
|
scheduleTask(ctx, async () => {
|
|
190
|
-
swarmConnection = await this._joinSwarm(ctx, invitation,
|
|
191
|
+
swarmConnection = await this._joinSwarm(ctx, invitation, InvitationOptions.Role.HOST, createExtension);
|
|
191
192
|
guardedState.set(null, Invitation.State.CONNECTING);
|
|
192
193
|
});
|
|
193
194
|
}
|
|
@@ -352,7 +353,7 @@ export class InvitationsHandler {
|
|
|
352
353
|
await ctx.dispose();
|
|
353
354
|
} else {
|
|
354
355
|
invariant(invitation.swarmKey);
|
|
355
|
-
await this._joinSwarm(ctx, invitation,
|
|
356
|
+
await this._joinSwarm(ctx, invitation, InvitationOptions.Role.GUEST, createExtension);
|
|
356
357
|
guardedState.set(null, Invitation.State.CONNECTING);
|
|
357
358
|
}
|
|
358
359
|
});
|
|
@@ -361,11 +362,11 @@ export class InvitationsHandler {
|
|
|
361
362
|
private async _joinSwarm(
|
|
362
363
|
ctx: Context,
|
|
363
364
|
invitation: Invitation,
|
|
364
|
-
role:
|
|
365
|
+
role: InvitationOptions.Role,
|
|
365
366
|
extensionFactory: () => TeleportExtension,
|
|
366
367
|
): Promise<SwarmConnection> {
|
|
367
368
|
let label: string;
|
|
368
|
-
if (role ===
|
|
369
|
+
if (role === InvitationOptions.Role.GUEST) {
|
|
369
370
|
label = 'invitation guest';
|
|
370
371
|
} else if (invitation.kind === Invitation.Kind.DEVICE) {
|
|
371
372
|
label = 'invitation host for device';
|
|
@@ -157,14 +157,14 @@ describe('DataSpaceManager', () => {
|
|
|
157
157
|
|
|
158
158
|
const space = await peer.dataSpaceManager.createSpace();
|
|
159
159
|
await space.inner.controlPipeline.state.waitUntilTimeframe(space.inner.controlPipeline.state.endTimeframe);
|
|
160
|
-
expect(space.state).to.equal(SpaceState.
|
|
160
|
+
expect(space.state).to.equal(SpaceState.SPACE_READY);
|
|
161
161
|
|
|
162
162
|
await space.deactivate();
|
|
163
|
-
expect(space.state).to.equal(SpaceState.
|
|
163
|
+
expect(space.state).to.equal(SpaceState.SPACE_INACTIVE);
|
|
164
164
|
|
|
165
165
|
await space.activate();
|
|
166
166
|
await asyncTimeout(
|
|
167
|
-
space.stateUpdate.waitForCondition(() => space.state === SpaceState.
|
|
167
|
+
space.stateUpdate.waitForCondition(() => space.state === SpaceState.SPACE_READY),
|
|
168
168
|
500,
|
|
169
169
|
);
|
|
170
170
|
});
|
|
@@ -180,10 +180,10 @@ describe('DataSpaceManager', () => {
|
|
|
180
180
|
await reloadDataSpaces(peer);
|
|
181
181
|
|
|
182
182
|
const space = getFirstSpace(peer);
|
|
183
|
-
expect(space.state).to.equal(SpaceState.
|
|
183
|
+
expect(space.state).to.equal(SpaceState.SPACE_CLOSED);
|
|
184
184
|
await space.activate();
|
|
185
185
|
await asyncTimeout(
|
|
186
|
-
space.stateUpdate.waitForCondition(() => space.state === SpaceState.
|
|
186
|
+
space.stateUpdate.waitForCondition(() => space.state === SpaceState.SPACE_READY),
|
|
187
187
|
500,
|
|
188
188
|
);
|
|
189
189
|
});
|
|
@@ -202,7 +202,7 @@ describe('DataSpaceManager', () => {
|
|
|
202
202
|
|
|
203
203
|
await reloadDataSpaces(peer);
|
|
204
204
|
|
|
205
|
-
expect(getFirstSpace(peer).state).to.eq(SpaceState.
|
|
205
|
+
expect(getFirstSpace(peer).state).to.eq(SpaceState.SPACE_INACTIVE);
|
|
206
206
|
});
|
|
207
207
|
});
|
|
208
208
|
|
|
@@ -197,7 +197,7 @@ export class DataSpaceManager {
|
|
|
197
197
|
genesisFeedKey: controlFeedKey,
|
|
198
198
|
controlFeedKey,
|
|
199
199
|
dataFeedKey,
|
|
200
|
-
state: SpaceState.
|
|
200
|
+
state: SpaceState.SPACE_ACTIVE,
|
|
201
201
|
};
|
|
202
202
|
|
|
203
203
|
log('creating space...', { spaceKey });
|
|
@@ -336,7 +336,7 @@ export class DataSpaceManager {
|
|
|
336
336
|
this._ctx,
|
|
337
337
|
this.updated.waitForCondition(() => {
|
|
338
338
|
const space = this._spaces.get(spaceKey);
|
|
339
|
-
return !!space && space.state === SpaceState.
|
|
339
|
+
return !!space && space.state === SpaceState.SPACE_READY;
|
|
340
340
|
}),
|
|
341
341
|
);
|
|
342
342
|
}
|
|
@@ -408,7 +408,7 @@ export class DataSpaceManager {
|
|
|
408
408
|
log.warn('auth failure');
|
|
409
409
|
},
|
|
410
410
|
onMemberRolesChanged: async (members: MemberInfo[]) => {
|
|
411
|
-
if (dataSpace?.state === SpaceState.
|
|
411
|
+
if (dataSpace?.state === SpaceState.SPACE_READY) {
|
|
412
412
|
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
413
413
|
}
|
|
414
414
|
},
|
|
@@ -422,7 +422,7 @@ export class DataSpaceManager {
|
|
|
422
422
|
|
|
423
423
|
const dataSpace = new DataSpace({
|
|
424
424
|
inner: space,
|
|
425
|
-
initialState: metadata.state === SpaceState.
|
|
425
|
+
initialState: metadata.state === SpaceState.SPACE_INACTIVE ? SpaceState.SPACE_INACTIVE : SpaceState.SPACE_CLOSED,
|
|
426
426
|
metadataStore: this._metadataStore,
|
|
427
427
|
gossip,
|
|
428
428
|
presence,
|
|
@@ -450,7 +450,7 @@ export class DataSpaceManager {
|
|
|
450
450
|
});
|
|
451
451
|
|
|
452
452
|
presence.newPeer.on((peerState) => {
|
|
453
|
-
if (dataSpace.state === SpaceState.
|
|
453
|
+
if (dataSpace.state === SpaceState.SPACE_READY) {
|
|
454
454
|
this._handleNewPeerConnected(space, peerState);
|
|
455
455
|
}
|
|
456
456
|
});
|
|
@@ -504,7 +504,7 @@ export class DataSpaceManager {
|
|
|
504
504
|
delegatedInvitation: DelegateInvitationCredential,
|
|
505
505
|
isActive: boolean,
|
|
506
506
|
): Promise<void> {
|
|
507
|
-
if (dataSpace?.state !== SpaceState.
|
|
507
|
+
if (dataSpace?.state !== SpaceState.SPACE_READY) {
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
510
|
if (isActive) {
|
|
@@ -101,12 +101,12 @@ export class DataSpace {
|
|
|
101
101
|
|
|
102
102
|
private readonly _epochProcessingMutex = new Mutex();
|
|
103
103
|
|
|
104
|
-
private _state = SpaceState.
|
|
104
|
+
private _state = SpaceState.SPACE_CLOSED;
|
|
105
105
|
|
|
106
106
|
private _databaseRoot: DatabaseRoot | null = null;
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
* Error for _state === SpaceState.
|
|
109
|
+
* Error for _state === SpaceState.SPACE_ERROR.
|
|
110
110
|
*/
|
|
111
111
|
public error: Error | undefined = undefined;
|
|
112
112
|
|
|
@@ -200,7 +200,7 @@ export class DataSpace {
|
|
|
200
200
|
|
|
201
201
|
@synchronized
|
|
202
202
|
async open() {
|
|
203
|
-
if (this._state === SpaceState.
|
|
203
|
+
if (this._state === SpaceState.SPACE_CLOSED) {
|
|
204
204
|
await this._open();
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -213,7 +213,7 @@ export class DataSpace {
|
|
|
213
213
|
await this._automergeSpaceState.open();
|
|
214
214
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
215
215
|
await this._inner.open(new Context());
|
|
216
|
-
this._state = SpaceState.
|
|
216
|
+
this._state = SpaceState.SPACE_CONTROL_ONLY;
|
|
217
217
|
log('new state', { state: SpaceState[this._state] });
|
|
218
218
|
this.stateUpdate.emit();
|
|
219
219
|
this.metrics = {};
|
|
@@ -227,7 +227,7 @@ export class DataSpace {
|
|
|
227
227
|
|
|
228
228
|
private async _close() {
|
|
229
229
|
await this._callbacks.beforeClose?.();
|
|
230
|
-
this._state = SpaceState.
|
|
230
|
+
this._state = SpaceState.SPACE_CLOSED;
|
|
231
231
|
log('new state', { state: SpaceState[this._state] });
|
|
232
232
|
await this._ctx.dispose();
|
|
233
233
|
this._ctx = new Context();
|
|
@@ -267,7 +267,7 @@ export class DataSpace {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
log.error('Error initializing data pipeline', err);
|
|
270
|
-
this._state = SpaceState.
|
|
270
|
+
this._state = SpaceState.SPACE_ERROR;
|
|
271
271
|
log('new state', { state: SpaceState[this._state] });
|
|
272
272
|
this.error = err as Error;
|
|
273
273
|
this.stateUpdate.emit();
|
|
@@ -279,11 +279,11 @@ export class DataSpace {
|
|
|
279
279
|
|
|
280
280
|
@trace.span({ showInBrowserTimeline: true })
|
|
281
281
|
async initializeDataPipeline() {
|
|
282
|
-
if (this._state !== SpaceState.
|
|
282
|
+
if (this._state !== SpaceState.SPACE_CONTROL_ONLY) {
|
|
283
283
|
throw new SystemError('Invalid operation');
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
this._state = SpaceState.
|
|
286
|
+
this._state = SpaceState.SPACE_INITIALIZING;
|
|
287
287
|
log('new state', { state: SpaceState[this._state] });
|
|
288
288
|
|
|
289
289
|
await this._initializeAndReadControlPipeline();
|
|
@@ -291,7 +291,7 @@ export class DataSpace {
|
|
|
291
291
|
// Allow other tasks to run before loading the data pipeline.
|
|
292
292
|
await sleep(1);
|
|
293
293
|
|
|
294
|
-
const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState.
|
|
294
|
+
const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState.SPACE_READY);
|
|
295
295
|
|
|
296
296
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
297
297
|
|
|
@@ -302,7 +302,7 @@ export class DataSpace {
|
|
|
302
302
|
private async _enterReadyState() {
|
|
303
303
|
await this._callbacks.beforeReady?.();
|
|
304
304
|
|
|
305
|
-
this._state = SpaceState.
|
|
305
|
+
this._state = SpaceState.SPACE_READY;
|
|
306
306
|
log('new state', { state: SpaceState[this._state] });
|
|
307
307
|
this.stateUpdate.emit();
|
|
308
308
|
|
|
@@ -417,9 +417,9 @@ export class DataSpace {
|
|
|
417
417
|
// NOTE: Make sure this assignment happens synchronously together with the state change.
|
|
418
418
|
this._databaseRoot = root;
|
|
419
419
|
if (root.getVersion() !== SpaceDocVersion.CURRENT) {
|
|
420
|
-
this._state = SpaceState.
|
|
420
|
+
this._state = SpaceState.SPACE_REQUIRES_MIGRATION;
|
|
421
421
|
this.stateUpdate.emit();
|
|
422
|
-
} else if (this._state !== SpaceState.
|
|
422
|
+
} else if (this._state !== SpaceState.SPACE_READY) {
|
|
423
423
|
await this._enterReadyState();
|
|
424
424
|
} else {
|
|
425
425
|
this.stateUpdate.emit();
|
|
@@ -490,26 +490,26 @@ export class DataSpace {
|
|
|
490
490
|
|
|
491
491
|
@synchronized
|
|
492
492
|
async activate() {
|
|
493
|
-
if (![SpaceState.
|
|
493
|
+
if (![SpaceState.SPACE_CLOSED, SpaceState.SPACE_INACTIVE].includes(this._state)) {
|
|
494
494
|
return;
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
await this._metadataStore.setSpaceState(this.key, SpaceState.
|
|
497
|
+
await this._metadataStore.setSpaceState(this.key, SpaceState.SPACE_ACTIVE);
|
|
498
498
|
await this._open();
|
|
499
499
|
this.initializeDataPipelineAsync();
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
@synchronized
|
|
503
503
|
async deactivate() {
|
|
504
|
-
if (this._state === SpaceState.
|
|
504
|
+
if (this._state === SpaceState.SPACE_INACTIVE) {
|
|
505
505
|
return;
|
|
506
506
|
}
|
|
507
507
|
// Unregister from data service.
|
|
508
|
-
await this._metadataStore.setSpaceState(this.key, SpaceState.
|
|
509
|
-
if (this._state !== SpaceState.
|
|
508
|
+
await this._metadataStore.setSpaceState(this.key, SpaceState.SPACE_INACTIVE);
|
|
509
|
+
if (this._state !== SpaceState.SPACE_CLOSED) {
|
|
510
510
|
await this._close();
|
|
511
511
|
}
|
|
512
|
-
this._state = SpaceState.
|
|
512
|
+
this._state = SpaceState.SPACE_INACTIVE;
|
|
513
513
|
log('new state', { state: SpaceState[this._state] });
|
|
514
514
|
this.stateUpdate.emit();
|
|
515
515
|
}
|