@dxos/client-services 0.6.3-main.9e4e207 → 0.6.3-main.a95c491
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-LOXM2SQM.mjs → chunk-FUR5CTMN.mjs} +91 -91
- package/dist/lib/browser/chunk-FUR5CTMN.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-MMUSO27N.cjs → chunk-SP2FG3SA.cjs} +89 -89
- package/dist/lib/node/chunk-SP2FG3SA.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 +13 -12
- 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 +3 -3
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-LOXM2SQM.mjs.map +0 -7
- package/dist/lib/node/chunk-MMUSO27N.cjs.map +0 -7
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
InvitationsManager,
|
|
8
8
|
ServiceContext,
|
|
9
9
|
SpaceInvitationProtocol
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-FUR5CTMN.mjs";
|
|
11
11
|
|
|
12
12
|
// packages/sdk/client-services/src/packlets/testing/credential-utils.ts
|
|
13
13
|
import { createCredential } from "@dxos/credentials";
|
|
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_SP2FG3SA_exports = {};
|
|
30
|
+
__export(chunk_SP2FG3SA_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
ClientServicesProviderResource: () => ClientServicesProviderResource,
|
|
@@ -70,7 +70,7 @@ __export(chunk_MMUSO27N_exports, {
|
|
|
70
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
71
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
72
72
|
});
|
|
73
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_SP2FG3SA_exports);
|
|
74
74
|
var import_async = require("@dxos/async");
|
|
75
75
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
76
76
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -647,7 +647,7 @@ var DevtoolsServiceImpl = class {
|
|
|
647
647
|
});
|
|
648
648
|
}
|
|
649
649
|
};
|
|
650
|
-
var DXOS_VERSION = "0.6.3-main.
|
|
650
|
+
var DXOS_VERSION = "0.6.3-main.a95c491";
|
|
651
651
|
var getPlatform = () => {
|
|
652
652
|
if (process.browser) {
|
|
653
653
|
if (typeof window !== "undefined") {
|
|
@@ -1787,9 +1787,9 @@ var IdentityServiceImpl = class extends import_context4.Resource {
|
|
|
1787
1787
|
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
1788
1788
|
const recordedDefaultSpaceTrigger = new import_async8.Trigger();
|
|
1789
1789
|
const allProcessed = (0, import_util4.safeAwaitAll)(dataSpaceManager.spaces.values(), async (space) => {
|
|
1790
|
-
if (space.state === import_services4.SpaceState.
|
|
1790
|
+
if (space.state === import_services4.SpaceState.SPACE_CLOSED) {
|
|
1791
1791
|
await space.open();
|
|
1792
|
-
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services4.SpaceState.
|
|
1792
|
+
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === import_services4.SpaceState.SPACE_REQUIRES_MIGRATION);
|
|
1793
1793
|
await Promise.race([
|
|
1794
1794
|
space.initializeDataPipeline(),
|
|
1795
1795
|
requiresMigration
|
|
@@ -2020,11 +2020,11 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2020
2020
|
C: (f, a) => f(...a)
|
|
2021
2021
|
});
|
|
2022
2022
|
await (0, import_context6.cancelWithContext)(this._ctx, this.rpc.InvitationHostService.options({
|
|
2023
|
-
role: import_invitations3.
|
|
2023
|
+
role: import_invitations3.InvitationOptions.Role.GUEST
|
|
2024
2024
|
}));
|
|
2025
2025
|
(0, import_log7.log)("options sent", void 0, {
|
|
2026
2026
|
F: __dxlog_file9,
|
|
2027
|
-
L:
|
|
2027
|
+
L: 91,
|
|
2028
2028
|
S: this,
|
|
2029
2029
|
C: (f, a) => f(...a)
|
|
2030
2030
|
});
|
|
@@ -2033,13 +2033,13 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2033
2033
|
}));
|
|
2034
2034
|
(0, import_log7.log)("options received", void 0, {
|
|
2035
2035
|
F: __dxlog_file9,
|
|
2036
|
-
L:
|
|
2036
|
+
L: 93,
|
|
2037
2037
|
S: this,
|
|
2038
2038
|
C: (f, a) => f(...a)
|
|
2039
2039
|
});
|
|
2040
|
-
if (this._remoteOptions?.role !== import_invitations3.
|
|
2040
|
+
if (this._remoteOptions?.role !== import_invitations3.InvitationOptions.Role.HOST) {
|
|
2041
2041
|
throw new import_protocols6.InvalidInvitationExtensionRoleError(void 0, {
|
|
2042
|
-
expected: import_invitations3.
|
|
2042
|
+
expected: import_invitations3.InvitationOptions.Role.HOST,
|
|
2043
2043
|
remoteOptions: this._remoteOptions,
|
|
2044
2044
|
remotePeerId: context.remotePeerId
|
|
2045
2045
|
});
|
|
@@ -2067,7 +2067,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
2067
2067
|
this._invitationFlowLock = null;
|
|
2068
2068
|
(0, import_log7.log)("invitation flow lock released", void 0, {
|
|
2069
2069
|
F: __dxlog_file9,
|
|
2070
|
-
L:
|
|
2070
|
+
L: 126,
|
|
2071
2071
|
S: this,
|
|
2072
2072
|
C: (f, a) => f(...a)
|
|
2073
2073
|
});
|
|
@@ -2330,7 +2330,7 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2330
2330
|
const lastState = this._requireActiveInvitation().state;
|
|
2331
2331
|
this._callbacks.onStateUpdate(import_services8.Invitation.State.CONNECTING);
|
|
2332
2332
|
await this.rpc.InvitationHostService.options({
|
|
2333
|
-
role: import_invitations4.
|
|
2333
|
+
role: import_invitations4.InvitationOptions.Role.HOST
|
|
2334
2334
|
});
|
|
2335
2335
|
(0, import_log8.log)("options sent", void 0, {
|
|
2336
2336
|
F: __dxlog_file10,
|
|
@@ -2347,10 +2347,10 @@ var InvitationHostExtension = class extends import_teleport2.RpcExtension {
|
|
|
2347
2347
|
S: this,
|
|
2348
2348
|
C: (f, a) => f(...a)
|
|
2349
2349
|
});
|
|
2350
|
-
if (this._remoteOptions?.role !== import_invitations4.
|
|
2350
|
+
if (this._remoteOptions?.role !== import_invitations4.InvitationOptions.Role.GUEST) {
|
|
2351
2351
|
this._callbacks.onStateUpdate(lastState);
|
|
2352
2352
|
throw new import_protocols7.InvalidInvitationExtensionRoleError(void 0, {
|
|
2353
|
-
expected: import_invitations4.
|
|
2353
|
+
expected: import_invitations4.InvitationOptions.Role.GUEST,
|
|
2354
2354
|
remoteOptions: this._remoteOptions,
|
|
2355
2355
|
remotePeerId: context.remotePeerId
|
|
2356
2356
|
});
|
|
@@ -2434,7 +2434,7 @@ var InvitationTopology = class {
|
|
|
2434
2434
|
]
|
|
2435
2435
|
});
|
|
2436
2436
|
const { ownPeerId, candidates, connected, allPeers } = this._controller.getState();
|
|
2437
|
-
if (this._role === import_invitations5.
|
|
2437
|
+
if (this._role === import_invitations5.InvitationOptions.Role.GUEST) {
|
|
2438
2438
|
return;
|
|
2439
2439
|
}
|
|
2440
2440
|
if (connected.length > 0) {
|
|
@@ -2473,7 +2473,7 @@ var InvitationTopology = class {
|
|
|
2473
2473
|
this._seenPeers.clear();
|
|
2474
2474
|
}
|
|
2475
2475
|
toString() {
|
|
2476
|
-
return `InvitationTopology(${this._role === import_invitations5.
|
|
2476
|
+
return `InvitationTopology(${this._role === import_invitations5.InvitationOptions.Role.GUEST ? "guest" : "host"})`;
|
|
2477
2477
|
}
|
|
2478
2478
|
};
|
|
2479
2479
|
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
@@ -2488,7 +2488,7 @@ var InvitationsHandler = class {
|
|
|
2488
2488
|
this._defaultTeleportParams = _defaultTeleportParams;
|
|
2489
2489
|
}
|
|
2490
2490
|
handleInvitationFlow(ctx, stream, protocol, invitation) {
|
|
2491
|
-
metrics.increment("invitation.created");
|
|
2491
|
+
metrics.increment("dxos.invitation.created");
|
|
2492
2492
|
const guardedState = this._createGuardedState(ctx, invitation, stream);
|
|
2493
2493
|
const createExtension = () => {
|
|
2494
2494
|
const extension = new InvitationHostExtension(guardedState.mutex, {
|
|
@@ -2504,7 +2504,7 @@ var InvitationsHandler = class {
|
|
|
2504
2504
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2505
2505
|
(0, import_invariant6.invariant)(deviceKey, void 0, {
|
|
2506
2506
|
F: __dxlog_file12,
|
|
2507
|
-
L:
|
|
2507
|
+
L: 94,
|
|
2508
2508
|
S: this,
|
|
2509
2509
|
A: [
|
|
2510
2510
|
"deviceKey",
|
|
@@ -2533,7 +2533,7 @@ var InvitationsHandler = class {
|
|
|
2533
2533
|
id: traceId
|
|
2534
2534
|
}), {
|
|
2535
2535
|
F: __dxlog_file12,
|
|
2536
|
-
L:
|
|
2536
|
+
L: 119,
|
|
2537
2537
|
S: this,
|
|
2538
2538
|
C: (f, a) => f(...a)
|
|
2539
2539
|
});
|
|
@@ -2541,7 +2541,7 @@ var InvitationsHandler = class {
|
|
|
2541
2541
|
...protocol.toJSON()
|
|
2542
2542
|
}, {
|
|
2543
2543
|
F: __dxlog_file12,
|
|
2544
|
-
L:
|
|
2544
|
+
L: 120,
|
|
2545
2545
|
S: this,
|
|
2546
2546
|
C: (f, a) => f(...a)
|
|
2547
2547
|
});
|
|
@@ -2553,17 +2553,17 @@ var InvitationsHandler = class {
|
|
|
2553
2553
|
...protocol.toJSON()
|
|
2554
2554
|
}, {
|
|
2555
2555
|
F: __dxlog_file12,
|
|
2556
|
-
L:
|
|
2556
|
+
L: 122,
|
|
2557
2557
|
S: this,
|
|
2558
2558
|
C: (f, a) => f(...a)
|
|
2559
2559
|
});
|
|
2560
2560
|
guardedState.set(extension, import_services6.Invitation.State.SUCCESS);
|
|
2561
|
-
metrics.increment("invitation.success");
|
|
2561
|
+
metrics.increment("dxos.invitation.success");
|
|
2562
2562
|
import_log6.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols5.trace.end({
|
|
2563
2563
|
id: traceId
|
|
2564
2564
|
}), {
|
|
2565
2565
|
F: __dxlog_file12,
|
|
2566
|
-
L:
|
|
2566
|
+
L: 125,
|
|
2567
2567
|
S: this,
|
|
2568
2568
|
C: (f, a) => f(...a)
|
|
2569
2569
|
});
|
|
@@ -2574,22 +2574,22 @@ var InvitationsHandler = class {
|
|
|
2574
2574
|
} catch (err) {
|
|
2575
2575
|
if (err instanceof import_async9.TimeoutError) {
|
|
2576
2576
|
if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
|
|
2577
|
-
metrics.increment("invitation.timeout");
|
|
2577
|
+
metrics.increment("dxos.invitation.timeout");
|
|
2578
2578
|
(0, import_log6.log)("timeout", {
|
|
2579
2579
|
...protocol.toJSON()
|
|
2580
2580
|
}, {
|
|
2581
2581
|
F: __dxlog_file12,
|
|
2582
|
-
L:
|
|
2582
|
+
L: 135,
|
|
2583
2583
|
S: this,
|
|
2584
2584
|
C: (f, a) => f(...a)
|
|
2585
2585
|
});
|
|
2586
2586
|
}
|
|
2587
2587
|
} else {
|
|
2588
2588
|
if (guardedState.error(extension, err)) {
|
|
2589
|
-
metrics.increment("invitation.failed");
|
|
2589
|
+
metrics.increment("dxos.invitation.failed");
|
|
2590
2590
|
import_log6.log.error("failed", err, {
|
|
2591
2591
|
F: __dxlog_file12,
|
|
2592
|
-
L:
|
|
2592
|
+
L: 140,
|
|
2593
2593
|
S: this,
|
|
2594
2594
|
C: (f, a) => f(...a)
|
|
2595
2595
|
});
|
|
@@ -2600,7 +2600,7 @@ var InvitationsHandler = class {
|
|
|
2600
2600
|
error: err
|
|
2601
2601
|
}), {
|
|
2602
2602
|
F: __dxlog_file12,
|
|
2603
|
-
L:
|
|
2603
|
+
L: 143,
|
|
2604
2604
|
S: this,
|
|
2605
2605
|
C: (f, a) => f(...a)
|
|
2606
2606
|
});
|
|
@@ -2614,7 +2614,7 @@ var InvitationsHandler = class {
|
|
|
2614
2614
|
...err.context
|
|
2615
2615
|
}, {
|
|
2616
2616
|
F: __dxlog_file12,
|
|
2617
|
-
L:
|
|
2617
|
+
L: 151,
|
|
2618
2618
|
S: this,
|
|
2619
2619
|
C: (f, a) => f(...a)
|
|
2620
2620
|
});
|
|
@@ -2622,22 +2622,22 @@ var InvitationsHandler = class {
|
|
|
2622
2622
|
}
|
|
2623
2623
|
if (err instanceof import_async9.TimeoutError) {
|
|
2624
2624
|
if (guardedState.set(extension, import_services6.Invitation.State.TIMEOUT)) {
|
|
2625
|
-
metrics.increment("invitation.timeout");
|
|
2625
|
+
metrics.increment("dxos.invitation.timeout");
|
|
2626
2626
|
(0, import_log6.log)("timeout", {
|
|
2627
2627
|
err
|
|
2628
2628
|
}, {
|
|
2629
2629
|
F: __dxlog_file12,
|
|
2630
|
-
L:
|
|
2630
|
+
L: 157,
|
|
2631
2631
|
S: this,
|
|
2632
2632
|
C: (f, a) => f(...a)
|
|
2633
2633
|
});
|
|
2634
2634
|
}
|
|
2635
2635
|
} else {
|
|
2636
2636
|
if (guardedState.error(extension, err)) {
|
|
2637
|
-
metrics.increment("invitation.failed");
|
|
2637
|
+
metrics.increment("dxos.invitation.failed");
|
|
2638
2638
|
import_log6.log.error("failed", err, {
|
|
2639
2639
|
F: __dxlog_file12,
|
|
2640
|
-
L:
|
|
2640
|
+
L: 162,
|
|
2641
2641
|
S: this,
|
|
2642
2642
|
C: (f, a) => f(...a)
|
|
2643
2643
|
});
|
|
@@ -2651,7 +2651,7 @@ var InvitationsHandler = class {
|
|
|
2651
2651
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2652
2652
|
import_log6.log.warn("invitation has already expired", void 0, {
|
|
2653
2653
|
F: __dxlog_file12,
|
|
2654
|
-
L:
|
|
2654
|
+
L: 173,
|
|
2655
2655
|
S: this,
|
|
2656
2656
|
C: (f, a) => f(...a)
|
|
2657
2657
|
});
|
|
@@ -2659,14 +2659,14 @@ var InvitationsHandler = class {
|
|
|
2659
2659
|
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2660
2660
|
await swarmConnection.close();
|
|
2661
2661
|
guardedState.set(null, import_services6.Invitation.State.EXPIRED);
|
|
2662
|
-
metrics.increment("invitation.expired");
|
|
2662
|
+
metrics.increment("dxos.invitation.expired");
|
|
2663
2663
|
await ctx.dispose();
|
|
2664
2664
|
}, invitation.created.getTime() + invitation.lifetime * 1e3 - Date.now());
|
|
2665
2665
|
}
|
|
2666
2666
|
}
|
|
2667
2667
|
let swarmConnection;
|
|
2668
2668
|
(0, import_async9.scheduleTask)(ctx, async () => {
|
|
2669
|
-
swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.
|
|
2669
|
+
swarmConnection = await this._joinSwarm(ctx, invitation, import_invitations2.InvitationOptions.Role.HOST, createExtension);
|
|
2670
2670
|
guardedState.set(null, import_services6.Invitation.State.CONNECTING);
|
|
2671
2671
|
});
|
|
2672
2672
|
}
|
|
@@ -2675,7 +2675,7 @@ var InvitationsHandler = class {
|
|
|
2675
2675
|
if (deviceProfile) {
|
|
2676
2676
|
(0, import_invariant6.invariant)(invitation.kind === import_services6.Invitation.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2677
2677
|
F: __dxlog_file12,
|
|
2678
|
-
L:
|
|
2678
|
+
L: 207,
|
|
2679
2679
|
S: this,
|
|
2680
2680
|
A: [
|
|
2681
2681
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -2693,7 +2693,7 @@ var InvitationsHandler = class {
|
|
|
2693
2693
|
triedPeers: triedPeersIds.size
|
|
2694
2694
|
}, {
|
|
2695
2695
|
F: __dxlog_file12,
|
|
2696
|
-
L:
|
|
2696
|
+
L: 215,
|
|
2697
2697
|
S: this,
|
|
2698
2698
|
C: (f, a) => f(...a)
|
|
2699
2699
|
});
|
|
@@ -2720,7 +2720,7 @@ var InvitationsHandler = class {
|
|
|
2720
2720
|
currentState: guardedState.current.state
|
|
2721
2721
|
}, {
|
|
2722
2722
|
F: __dxlog_file12,
|
|
2723
|
-
L:
|
|
2723
|
+
L: 243,
|
|
2724
2724
|
S: this,
|
|
2725
2725
|
C: (f, a) => f(...a)
|
|
2726
2726
|
});
|
|
@@ -2738,7 +2738,7 @@ var InvitationsHandler = class {
|
|
|
2738
2738
|
id: traceId
|
|
2739
2739
|
}), {
|
|
2740
2740
|
F: __dxlog_file12,
|
|
2741
|
-
L:
|
|
2741
|
+
L: 255,
|
|
2742
2742
|
S: this,
|
|
2743
2743
|
C: (f, a) => f(...a)
|
|
2744
2744
|
});
|
|
@@ -2750,7 +2750,7 @@ var InvitationsHandler = class {
|
|
|
2750
2750
|
...protocol.toJSON()
|
|
2751
2751
|
}, {
|
|
2752
2752
|
F: __dxlog_file12,
|
|
2753
|
-
L:
|
|
2753
|
+
L: 266,
|
|
2754
2754
|
S: this,
|
|
2755
2755
|
C: (f, a) => f(...a)
|
|
2756
2756
|
});
|
|
@@ -2759,7 +2759,7 @@ var InvitationsHandler = class {
|
|
|
2759
2759
|
...protocol.toJSON()
|
|
2760
2760
|
}, {
|
|
2761
2761
|
F: __dxlog_file12,
|
|
2762
|
-
L:
|
|
2762
|
+
L: 270,
|
|
2763
2763
|
S: this,
|
|
2764
2764
|
C: (f, a) => f(...a)
|
|
2765
2765
|
});
|
|
@@ -2772,7 +2772,7 @@ var InvitationsHandler = class {
|
|
|
2772
2772
|
response: introductionResponse
|
|
2773
2773
|
}, {
|
|
2774
2774
|
F: __dxlog_file12,
|
|
2775
|
-
L:
|
|
2775
|
+
L: 275,
|
|
2776
2776
|
S: this,
|
|
2777
2777
|
C: (f, a) => f(...a)
|
|
2778
2778
|
});
|
|
@@ -2793,7 +2793,7 @@ var InvitationsHandler = class {
|
|
|
2793
2793
|
...protocol.toJSON()
|
|
2794
2794
|
}, {
|
|
2795
2795
|
F: __dxlog_file12,
|
|
2796
|
-
L:
|
|
2796
|
+
L: 301,
|
|
2797
2797
|
S: this,
|
|
2798
2798
|
C: (f, a) => f(...a)
|
|
2799
2799
|
});
|
|
@@ -2805,7 +2805,7 @@ var InvitationsHandler = class {
|
|
|
2805
2805
|
...protocol.toJSON()
|
|
2806
2806
|
}, {
|
|
2807
2807
|
F: __dxlog_file12,
|
|
2808
|
-
L:
|
|
2808
|
+
L: 312,
|
|
2809
2809
|
S: this,
|
|
2810
2810
|
C: (f, a) => f(...a)
|
|
2811
2811
|
});
|
|
@@ -2818,7 +2818,7 @@ var InvitationsHandler = class {
|
|
|
2818
2818
|
id: traceId
|
|
2819
2819
|
}), {
|
|
2820
2820
|
F: __dxlog_file12,
|
|
2821
|
-
L:
|
|
2821
|
+
L: 318,
|
|
2822
2822
|
S: this,
|
|
2823
2823
|
C: (f, a) => f(...a)
|
|
2824
2824
|
});
|
|
@@ -2828,7 +2828,7 @@ var InvitationsHandler = class {
|
|
|
2828
2828
|
...protocol.toJSON()
|
|
2829
2829
|
}, {
|
|
2830
2830
|
F: __dxlog_file12,
|
|
2831
|
-
L:
|
|
2831
|
+
L: 321,
|
|
2832
2832
|
S: this,
|
|
2833
2833
|
C: (f, a) => f(...a)
|
|
2834
2834
|
});
|
|
@@ -2836,7 +2836,7 @@ var InvitationsHandler = class {
|
|
|
2836
2836
|
} else {
|
|
2837
2837
|
(0, import_log6.log)("auth failed", err, {
|
|
2838
2838
|
F: __dxlog_file12,
|
|
2839
|
-
L:
|
|
2839
|
+
L: 324,
|
|
2840
2840
|
S: this,
|
|
2841
2841
|
C: (f, a) => f(...a)
|
|
2842
2842
|
});
|
|
@@ -2848,7 +2848,7 @@ var InvitationsHandler = class {
|
|
|
2848
2848
|
error: err
|
|
2849
2849
|
}), {
|
|
2850
2850
|
F: __dxlog_file12,
|
|
2851
|
-
L:
|
|
2851
|
+
L: 328,
|
|
2852
2852
|
S: this,
|
|
2853
2853
|
C: (f, a) => f(...a)
|
|
2854
2854
|
});
|
|
@@ -2864,7 +2864,7 @@ var InvitationsHandler = class {
|
|
|
2864
2864
|
...protocol.toJSON()
|
|
2865
2865
|
}, {
|
|
2866
2866
|
F: __dxlog_file12,
|
|
2867
|
-
L:
|
|
2867
|
+
L: 337,
|
|
2868
2868
|
S: this,
|
|
2869
2869
|
C: (f, a) => f(...a)
|
|
2870
2870
|
});
|
|
@@ -2872,7 +2872,7 @@ var InvitationsHandler = class {
|
|
|
2872
2872
|
} else {
|
|
2873
2873
|
(0, import_log6.log)("auth failed", err, {
|
|
2874
2874
|
F: __dxlog_file12,
|
|
2875
|
-
L:
|
|
2875
|
+
L: 340,
|
|
2876
2876
|
S: this,
|
|
2877
2877
|
C: (f, a) => f(...a)
|
|
2878
2878
|
});
|
|
@@ -2890,21 +2890,21 @@ var InvitationsHandler = class {
|
|
|
2890
2890
|
} else {
|
|
2891
2891
|
(0, import_invariant6.invariant)(invitation.swarmKey, void 0, {
|
|
2892
2892
|
F: __dxlog_file12,
|
|
2893
|
-
L:
|
|
2893
|
+
L: 355,
|
|
2894
2894
|
S: this,
|
|
2895
2895
|
A: [
|
|
2896
2896
|
"invitation.swarmKey",
|
|
2897
2897
|
""
|
|
2898
2898
|
]
|
|
2899
2899
|
});
|
|
2900
|
-
await this._joinSwarm(ctx, invitation, import_invitations2.
|
|
2900
|
+
await this._joinSwarm(ctx, invitation, import_invitations2.InvitationOptions.Role.GUEST, createExtension);
|
|
2901
2901
|
guardedState.set(null, import_services6.Invitation.State.CONNECTING);
|
|
2902
2902
|
}
|
|
2903
2903
|
});
|
|
2904
2904
|
}
|
|
2905
2905
|
async _joinSwarm(ctx, invitation, role, extensionFactory) {
|
|
2906
2906
|
let label;
|
|
2907
|
-
if (role === import_invitations2.
|
|
2907
|
+
if (role === import_invitations2.InvitationOptions.Role.GUEST) {
|
|
2908
2908
|
label = "invitation guest";
|
|
2909
2909
|
} else if (invitation.kind === import_services6.Invitation.Kind.DEVICE) {
|
|
2910
2910
|
label = "invitation host for device";
|
|
@@ -2990,7 +2990,7 @@ var InvitationsHandler = class {
|
|
|
2990
2990
|
oldState: stateToString(invitation.state)
|
|
2991
2991
|
}, {
|
|
2992
2992
|
F: __dxlog_file12,
|
|
2993
|
-
L:
|
|
2993
|
+
L: 449,
|
|
2994
2994
|
S: this,
|
|
2995
2995
|
C: (f, a) => f(...a)
|
|
2996
2996
|
});
|
|
@@ -3001,7 +3001,7 @@ var InvitationsHandler = class {
|
|
|
3001
3001
|
oldState: stateToString(invitation.state)
|
|
3002
3002
|
}, {
|
|
3003
3003
|
F: __dxlog_file12,
|
|
3004
|
-
L:
|
|
3004
|
+
L: 455,
|
|
3005
3005
|
S: this,
|
|
3006
3006
|
C: (f, a) => f(...a)
|
|
3007
3007
|
});
|
|
@@ -3020,7 +3020,7 @@ var InvitationsHandler = class {
|
|
|
3020
3020
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
3021
3021
|
(0, import_log6.log)("guest waiting for authentication code...", void 0, {
|
|
3022
3022
|
F: __dxlog_file12,
|
|
3023
|
-
L:
|
|
3023
|
+
L: 480,
|
|
3024
3024
|
S: this,
|
|
3025
3025
|
C: (f, a) => f(...a)
|
|
3026
3026
|
});
|
|
@@ -3028,7 +3028,7 @@ var InvitationsHandler = class {
|
|
|
3028
3028
|
const authCode = await authenticated.wait(options);
|
|
3029
3029
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3030
3030
|
F: __dxlog_file12,
|
|
3031
|
-
L:
|
|
3031
|
+
L: 484,
|
|
3032
3032
|
S: this,
|
|
3033
3033
|
C: (f, a) => f(...a)
|
|
3034
3034
|
});
|
|
@@ -3047,7 +3047,7 @@ var InvitationsHandler = class {
|
|
|
3047
3047
|
attempt
|
|
3048
3048
|
}, {
|
|
3049
3049
|
F: __dxlog_file12,
|
|
3050
|
-
L:
|
|
3050
|
+
L: 495,
|
|
3051
3051
|
S: this,
|
|
3052
3052
|
C: (f, a) => f(...a)
|
|
3053
3053
|
});
|
|
@@ -3065,7 +3065,7 @@ var InvitationsHandler = class {
|
|
|
3065
3065
|
}
|
|
3066
3066
|
(0, import_log6.log)("sending authentication request", void 0, {
|
|
3067
3067
|
F: __dxlog_file12,
|
|
3068
|
-
L:
|
|
3068
|
+
L: 514,
|
|
3069
3069
|
S: this,
|
|
3070
3070
|
C: (f, a) => f(...a)
|
|
3071
3071
|
});
|
|
@@ -4340,7 +4340,7 @@ var DataSpace = class {
|
|
|
4340
4340
|
this._cache = void 0;
|
|
4341
4341
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
4342
4342
|
this._epochProcessingMutex = new import_async13.Mutex();
|
|
4343
|
-
this._state = import_services12.SpaceState.
|
|
4343
|
+
this._state = import_services12.SpaceState.SPACE_CLOSED;
|
|
4344
4344
|
this._databaseRoot = null;
|
|
4345
4345
|
this.error = void 0;
|
|
4346
4346
|
this.stateUpdate = new import_async13.Event();
|
|
@@ -4409,7 +4409,7 @@ var DataSpace = class {
|
|
|
4409
4409
|
};
|
|
4410
4410
|
}
|
|
4411
4411
|
async open() {
|
|
4412
|
-
if (this._state === import_services12.SpaceState.
|
|
4412
|
+
if (this._state === import_services12.SpaceState.SPACE_CLOSED) {
|
|
4413
4413
|
await this._open();
|
|
4414
4414
|
}
|
|
4415
4415
|
}
|
|
@@ -4424,7 +4424,7 @@ var DataSpace = class {
|
|
|
4424
4424
|
F: __dxlog_file17,
|
|
4425
4425
|
L: 215
|
|
4426
4426
|
}));
|
|
4427
|
-
this._state = import_services12.SpaceState.
|
|
4427
|
+
this._state = import_services12.SpaceState.SPACE_CONTROL_ONLY;
|
|
4428
4428
|
(0, import_log12.log)("new state", {
|
|
4429
4429
|
state: import_services12.SpaceState[this._state]
|
|
4430
4430
|
}, {
|
|
@@ -4442,7 +4442,7 @@ var DataSpace = class {
|
|
|
4442
4442
|
}
|
|
4443
4443
|
async _close() {
|
|
4444
4444
|
await this._callbacks.beforeClose?.();
|
|
4445
|
-
this._state = import_services12.SpaceState.
|
|
4445
|
+
this._state = import_services12.SpaceState.SPACE_CLOSED;
|
|
4446
4446
|
(0, import_log12.log)("new state", {
|
|
4447
4447
|
state: import_services12.SpaceState[this._state]
|
|
4448
4448
|
}, {
|
|
@@ -4495,7 +4495,7 @@ var DataSpace = class {
|
|
|
4495
4495
|
S: this,
|
|
4496
4496
|
C: (f, a) => f(...a)
|
|
4497
4497
|
});
|
|
4498
|
-
this._state = import_services12.SpaceState.
|
|
4498
|
+
this._state = import_services12.SpaceState.SPACE_ERROR;
|
|
4499
4499
|
(0, import_log12.log)("new state", {
|
|
4500
4500
|
state: import_services12.SpaceState[this._state]
|
|
4501
4501
|
}, {
|
|
@@ -4512,10 +4512,10 @@ var DataSpace = class {
|
|
|
4512
4512
|
});
|
|
4513
4513
|
}
|
|
4514
4514
|
async initializeDataPipeline() {
|
|
4515
|
-
if (this._state !== import_services12.SpaceState.
|
|
4515
|
+
if (this._state !== import_services12.SpaceState.SPACE_CONTROL_ONLY) {
|
|
4516
4516
|
throw new import_protocols9.SystemError("Invalid operation");
|
|
4517
4517
|
}
|
|
4518
|
-
this._state = import_services12.SpaceState.
|
|
4518
|
+
this._state = import_services12.SpaceState.SPACE_INITIALIZING;
|
|
4519
4519
|
(0, import_log12.log)("new state", {
|
|
4520
4520
|
state: import_services12.SpaceState[this._state]
|
|
4521
4521
|
}, {
|
|
@@ -4526,13 +4526,13 @@ var DataSpace = class {
|
|
|
4526
4526
|
});
|
|
4527
4527
|
await this._initializeAndReadControlPipeline();
|
|
4528
4528
|
await (0, import_async13.sleep)(1);
|
|
4529
|
-
const ready = this.stateUpdate.waitForCondition(() => this._state === import_services12.SpaceState.
|
|
4529
|
+
const ready = this.stateUpdate.waitForCondition(() => this._state === import_services12.SpaceState.SPACE_READY);
|
|
4530
4530
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4531
4531
|
await ready;
|
|
4532
4532
|
}
|
|
4533
4533
|
async _enterReadyState() {
|
|
4534
4534
|
await this._callbacks.beforeReady?.();
|
|
4535
|
-
this._state = import_services12.SpaceState.
|
|
4535
|
+
this._state = import_services12.SpaceState.SPACE_READY;
|
|
4536
4536
|
(0, import_log12.log)("new state", {
|
|
4537
4537
|
state: import_services12.SpaceState[this._state]
|
|
4538
4538
|
}, {
|
|
@@ -4646,9 +4646,9 @@ var DataSpace = class {
|
|
|
4646
4646
|
const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
|
|
4647
4647
|
this._databaseRoot = root;
|
|
4648
4648
|
if (root.getVersion() !== import_echo_protocol.SpaceDocVersion.CURRENT) {
|
|
4649
|
-
this._state = import_services12.SpaceState.
|
|
4649
|
+
this._state = import_services12.SpaceState.SPACE_REQUIRES_MIGRATION;
|
|
4650
4650
|
this.stateUpdate.emit();
|
|
4651
|
-
} else if (this._state !== import_services12.SpaceState.
|
|
4651
|
+
} else if (this._state !== import_services12.SpaceState.SPACE_READY) {
|
|
4652
4652
|
await this._enterReadyState();
|
|
4653
4653
|
} else {
|
|
4654
4654
|
this.stateUpdate.emit();
|
|
@@ -4736,24 +4736,24 @@ var DataSpace = class {
|
|
|
4736
4736
|
}
|
|
4737
4737
|
async activate() {
|
|
4738
4738
|
if (![
|
|
4739
|
-
import_services12.SpaceState.
|
|
4740
|
-
import_services12.SpaceState.
|
|
4739
|
+
import_services12.SpaceState.SPACE_CLOSED,
|
|
4740
|
+
import_services12.SpaceState.SPACE_INACTIVE
|
|
4741
4741
|
].includes(this._state)) {
|
|
4742
4742
|
return;
|
|
4743
4743
|
}
|
|
4744
|
-
await this._metadataStore.setSpaceState(this.key, import_services12.SpaceState.
|
|
4744
|
+
await this._metadataStore.setSpaceState(this.key, import_services12.SpaceState.SPACE_ACTIVE);
|
|
4745
4745
|
await this._open();
|
|
4746
4746
|
this.initializeDataPipelineAsync();
|
|
4747
4747
|
}
|
|
4748
4748
|
async deactivate() {
|
|
4749
|
-
if (this._state === import_services12.SpaceState.
|
|
4749
|
+
if (this._state === import_services12.SpaceState.SPACE_INACTIVE) {
|
|
4750
4750
|
return;
|
|
4751
4751
|
}
|
|
4752
|
-
await this._metadataStore.setSpaceState(this.key, import_services12.SpaceState.
|
|
4753
|
-
if (this._state !== import_services12.SpaceState.
|
|
4752
|
+
await this._metadataStore.setSpaceState(this.key, import_services12.SpaceState.SPACE_INACTIVE);
|
|
4753
|
+
if (this._state !== import_services12.SpaceState.SPACE_CLOSED) {
|
|
4754
4754
|
await this._close();
|
|
4755
4755
|
}
|
|
4756
|
-
this._state = import_services12.SpaceState.
|
|
4756
|
+
this._state = import_services12.SpaceState.SPACE_INACTIVE;
|
|
4757
4757
|
(0, import_log12.log)("new state", {
|
|
4758
4758
|
state: import_services12.SpaceState[this._state]
|
|
4759
4759
|
}, {
|
|
@@ -5028,7 +5028,7 @@ var DataSpaceManager = class {
|
|
|
5028
5028
|
genesisFeedKey: controlFeedKey,
|
|
5029
5029
|
controlFeedKey,
|
|
5030
5030
|
dataFeedKey,
|
|
5031
|
-
state: import_services14.SpaceState.
|
|
5031
|
+
state: import_services14.SpaceState.SPACE_ACTIVE
|
|
5032
5032
|
};
|
|
5033
5033
|
(0, import_log15.log)("creating space...", {
|
|
5034
5034
|
spaceKey
|
|
@@ -5210,7 +5210,7 @@ var DataSpaceManager = class {
|
|
|
5210
5210
|
async waitUntilSpaceReady(spaceKey) {
|
|
5211
5211
|
await (0, import_context13.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
5212
5212
|
const space = this._spaces.get(spaceKey);
|
|
5213
|
-
return !!space && space.state === import_services14.SpaceState.
|
|
5213
|
+
return !!space && space.state === import_services14.SpaceState.SPACE_READY;
|
|
5214
5214
|
}));
|
|
5215
5215
|
}
|
|
5216
5216
|
async requestSpaceAdmissionCredential(spaceKey) {
|
|
@@ -5293,7 +5293,7 @@ var DataSpaceManager = class {
|
|
|
5293
5293
|
});
|
|
5294
5294
|
},
|
|
5295
5295
|
onMemberRolesChanged: async (members) => {
|
|
5296
|
-
if (dataSpace?.state === import_services14.SpaceState.
|
|
5296
|
+
if (dataSpace?.state === import_services14.SpaceState.SPACE_READY) {
|
|
5297
5297
|
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
5298
5298
|
}
|
|
5299
5299
|
},
|
|
@@ -5306,7 +5306,7 @@ var DataSpaceManager = class {
|
|
|
5306
5306
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
5307
5307
|
const dataSpace = new DataSpace({
|
|
5308
5308
|
inner: space,
|
|
5309
|
-
initialState: metadata.state === import_services14.SpaceState.
|
|
5309
|
+
initialState: metadata.state === import_services14.SpaceState.SPACE_INACTIVE ? import_services14.SpaceState.SPACE_INACTIVE : import_services14.SpaceState.SPACE_CLOSED,
|
|
5310
5310
|
metadataStore: this._metadataStore,
|
|
5311
5311
|
gossip,
|
|
5312
5312
|
presence,
|
|
@@ -5359,7 +5359,7 @@ var DataSpaceManager = class {
|
|
|
5359
5359
|
cache: metadata.cache
|
|
5360
5360
|
});
|
|
5361
5361
|
presence.newPeer.on((peerState) => {
|
|
5362
|
-
if (dataSpace.state === import_services14.SpaceState.
|
|
5362
|
+
if (dataSpace.state === import_services14.SpaceState.SPACE_READY) {
|
|
5363
5363
|
this._handleNewPeerConnected(space, peerState);
|
|
5364
5364
|
}
|
|
5365
5365
|
});
|
|
@@ -5415,7 +5415,7 @@ var DataSpaceManager = class {
|
|
|
5415
5415
|
}
|
|
5416
5416
|
}
|
|
5417
5417
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
5418
|
-
if (dataSpace?.state !== import_services14.SpaceState.
|
|
5418
|
+
if (dataSpace?.state !== import_services14.SpaceState.SPACE_READY) {
|
|
5419
5419
|
return;
|
|
5420
5420
|
}
|
|
5421
5421
|
if (isActive) {
|
|
@@ -5484,10 +5484,10 @@ var SpacesServiceImpl = class {
|
|
|
5484
5484
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug5.raise)(new import_protocols12.SpaceNotFoundError(spaceKey));
|
|
5485
5485
|
if (state) {
|
|
5486
5486
|
switch (state) {
|
|
5487
|
-
case import_services15.SpaceState.
|
|
5487
|
+
case import_services15.SpaceState.SPACE_ACTIVE:
|
|
5488
5488
|
await space.activate();
|
|
5489
5489
|
break;
|
|
5490
|
-
case import_services15.SpaceState.
|
|
5490
|
+
case import_services15.SpaceState.SPACE_INACTIVE:
|
|
5491
5491
|
await space.deactivate();
|
|
5492
5492
|
break;
|
|
5493
5493
|
default:
|
|
@@ -5784,7 +5784,7 @@ var SpacesServiceImpl = class {
|
|
|
5784
5784
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
5785
5785
|
const identity = this._identityManager.identity?.identityKey.truncate();
|
|
5786
5786
|
if (identity) {
|
|
5787
|
-
import_tracing8.trace.metrics.gauge("echo.space.count", dataSpaceManager.spaces.size, {
|
|
5787
|
+
import_tracing8.trace.metrics.gauge("dxos.echo.space.count", dataSpaceManager.spaces.size, {
|
|
5788
5788
|
tags: {
|
|
5789
5789
|
identity
|
|
5790
5790
|
}
|
|
@@ -7156,4 +7156,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
7156
7156
|
subscribeToSpaces,
|
|
7157
7157
|
subscribeToSwarmInfo
|
|
7158
7158
|
});
|
|
7159
|
-
//# sourceMappingURL=chunk-
|
|
7159
|
+
//# sourceMappingURL=chunk-SP2FG3SA.cjs.map
|