@dxos/client-services 0.6.3-main.cc41ccb → 0.6.3-main.d76104f
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-TRX3WZGF.mjs} +83 -83
- package/dist/lib/browser/chunk-TRX3WZGF.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-JYYVESTN.cjs} +81 -81
- package/dist/lib/node/chunk-JYYVESTN.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
|
@@ -359,7 +359,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
359
359
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
360
360
|
|
|
361
361
|
// packages/sdk/client-services/src/version.ts
|
|
362
|
-
var DXOS_VERSION = "0.6.3-main.
|
|
362
|
+
var DXOS_VERSION = "0.6.3-main.d76104f";
|
|
363
363
|
|
|
364
364
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
365
365
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -1644,9 +1644,9 @@ var IdentityServiceImpl = class extends Resource {
|
|
|
1644
1644
|
const dataSpaceManager = this._dataSpaceManagerProvider();
|
|
1645
1645
|
const recordedDefaultSpaceTrigger = new Trigger3();
|
|
1646
1646
|
const allProcessed = safeAwaitAll(dataSpaceManager.spaces.values(), async (space) => {
|
|
1647
|
-
if (space.state === SpaceState.
|
|
1647
|
+
if (space.state === SpaceState.SPACE_CLOSED) {
|
|
1648
1648
|
await space.open();
|
|
1649
|
-
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === SpaceState.
|
|
1649
|
+
const requiresMigration = space.stateUpdate.waitForCondition(() => space.state === SpaceState.SPACE_REQUIRES_MIGRATION);
|
|
1650
1650
|
await Promise.race([
|
|
1651
1651
|
space.initializeDataPipeline(),
|
|
1652
1652
|
requiresMigration
|
|
@@ -1811,7 +1811,7 @@ import { createTeleportProtocolFactory } from "@dxos/network-manager";
|
|
|
1811
1811
|
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError3, trace as trace5 } from "@dxos/protocols";
|
|
1812
1812
|
import { Invitation as Invitation4 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1813
1813
|
import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1814
|
-
import {
|
|
1814
|
+
import { InvitationOptions as InvitationOptions4 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1815
1815
|
import { trace as _trace } from "@dxos/tracing";
|
|
1816
1816
|
import { ComplexSet as ComplexSet3 } from "@dxos/util";
|
|
1817
1817
|
|
|
@@ -1821,7 +1821,7 @@ import { cancelWithContext as cancelWithContext2, Context as Context4 } from "@d
|
|
|
1821
1821
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1822
1822
|
import { log as log7 } from "@dxos/log";
|
|
1823
1823
|
import { InvalidInvitationExtensionRoleError, schema as schema2 } from "@dxos/protocols";
|
|
1824
|
-
import {
|
|
1824
|
+
import { InvitationOptions } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1825
1825
|
import { RpcExtension } from "@dxos/teleport";
|
|
1826
1826
|
|
|
1827
1827
|
// packages/sdk/client-services/src/packlets/invitations/utils.ts
|
|
@@ -1913,11 +1913,11 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1913
1913
|
C: (f, a) => f(...a)
|
|
1914
1914
|
});
|
|
1915
1915
|
await cancelWithContext2(this._ctx, this.rpc.InvitationHostService.options({
|
|
1916
|
-
role:
|
|
1916
|
+
role: InvitationOptions.Role.GUEST
|
|
1917
1917
|
}));
|
|
1918
1918
|
log7("options sent", void 0, {
|
|
1919
1919
|
F: __dxlog_file10,
|
|
1920
|
-
L:
|
|
1920
|
+
L: 91,
|
|
1921
1921
|
S: this,
|
|
1922
1922
|
C: (f, a) => f(...a)
|
|
1923
1923
|
});
|
|
@@ -1926,13 +1926,13 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1926
1926
|
}));
|
|
1927
1927
|
log7("options received", void 0, {
|
|
1928
1928
|
F: __dxlog_file10,
|
|
1929
|
-
L:
|
|
1929
|
+
L: 93,
|
|
1930
1930
|
S: this,
|
|
1931
1931
|
C: (f, a) => f(...a)
|
|
1932
1932
|
});
|
|
1933
|
-
if (this._remoteOptions?.role !==
|
|
1933
|
+
if (this._remoteOptions?.role !== InvitationOptions.Role.HOST) {
|
|
1934
1934
|
throw new InvalidInvitationExtensionRoleError(void 0, {
|
|
1935
|
-
expected:
|
|
1935
|
+
expected: InvitationOptions.Role.HOST,
|
|
1936
1936
|
remoteOptions: this._remoteOptions,
|
|
1937
1937
|
remotePeerId: context.remotePeerId
|
|
1938
1938
|
});
|
|
@@ -1960,7 +1960,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1960
1960
|
this._invitationFlowLock = null;
|
|
1961
1961
|
log7("invitation flow lock released", void 0, {
|
|
1962
1962
|
F: __dxlog_file10,
|
|
1963
|
-
L:
|
|
1963
|
+
L: 126,
|
|
1964
1964
|
S: this,
|
|
1965
1965
|
C: (f, a) => f(...a)
|
|
1966
1966
|
});
|
|
@@ -1977,7 +1977,7 @@ import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
|
1977
1977
|
import { log as log8 } from "@dxos/log";
|
|
1978
1978
|
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, schema as schema3, trace as trace4 } from "@dxos/protocols";
|
|
1979
1979
|
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1980
|
-
import { AuthenticationResponse,
|
|
1980
|
+
import { AuthenticationResponse, InvitationOptions as InvitationOptions2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1981
1981
|
import { RpcExtension as RpcExtension2 } from "@dxos/teleport";
|
|
1982
1982
|
var __dxlog_file11 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-host-extension.ts";
|
|
1983
1983
|
var OPTIONS_TIMEOUT2 = 1e4;
|
|
@@ -2235,7 +2235,7 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2235
2235
|
const lastState = this._requireActiveInvitation().state;
|
|
2236
2236
|
this._callbacks.onStateUpdate(Invitation3.State.CONNECTING);
|
|
2237
2237
|
await this.rpc.InvitationHostService.options({
|
|
2238
|
-
role:
|
|
2238
|
+
role: InvitationOptions2.Role.HOST
|
|
2239
2239
|
});
|
|
2240
2240
|
log8("options sent", void 0, {
|
|
2241
2241
|
F: __dxlog_file11,
|
|
@@ -2252,10 +2252,10 @@ var InvitationHostExtension = class extends RpcExtension2 {
|
|
|
2252
2252
|
S: this,
|
|
2253
2253
|
C: (f, a) => f(...a)
|
|
2254
2254
|
});
|
|
2255
|
-
if (this._remoteOptions?.role !==
|
|
2255
|
+
if (this._remoteOptions?.role !== InvitationOptions2.Role.GUEST) {
|
|
2256
2256
|
this._callbacks.onStateUpdate(lastState);
|
|
2257
2257
|
throw new InvalidInvitationExtensionRoleError2(void 0, {
|
|
2258
|
-
expected:
|
|
2258
|
+
expected: InvitationOptions2.Role.GUEST,
|
|
2259
2259
|
remoteOptions: this._remoteOptions,
|
|
2260
2260
|
remotePeerId: context.remotePeerId
|
|
2261
2261
|
});
|
|
@@ -2315,7 +2315,7 @@ var isAuthenticationRequired = (invitation) => invitation.authMethod !== Invitat
|
|
|
2315
2315
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
2316
2316
|
import { PublicKey as PublicKey6 } from "@dxos/keys";
|
|
2317
2317
|
import { log as log9 } from "@dxos/log";
|
|
2318
|
-
import {
|
|
2318
|
+
import { InvitationOptions as InvitationOptions3 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
2319
2319
|
import { ComplexSet as ComplexSet2 } from "@dxos/util";
|
|
2320
2320
|
var __dxlog_file12 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitation-topology.ts";
|
|
2321
2321
|
var InvitationTopology = class {
|
|
@@ -2346,7 +2346,7 @@ var InvitationTopology = class {
|
|
|
2346
2346
|
]
|
|
2347
2347
|
});
|
|
2348
2348
|
const { ownPeerId, candidates, connected, allPeers } = this._controller.getState();
|
|
2349
|
-
if (this._role ===
|
|
2349
|
+
if (this._role === InvitationOptions3.Role.GUEST) {
|
|
2350
2350
|
return;
|
|
2351
2351
|
}
|
|
2352
2352
|
if (connected.length > 0) {
|
|
@@ -2385,7 +2385,7 @@ var InvitationTopology = class {
|
|
|
2385
2385
|
this._seenPeers.clear();
|
|
2386
2386
|
}
|
|
2387
2387
|
toString() {
|
|
2388
|
-
return `InvitationTopology(${this._role ===
|
|
2388
|
+
return `InvitationTopology(${this._role === InvitationOptions3.Role.GUEST ? "guest" : "host"})`;
|
|
2389
2389
|
}
|
|
2390
2390
|
};
|
|
2391
2391
|
|
|
@@ -2418,7 +2418,7 @@ var InvitationsHandler = class {
|
|
|
2418
2418
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
2419
2419
|
invariant9(deviceKey, void 0, {
|
|
2420
2420
|
F: __dxlog_file13,
|
|
2421
|
-
L:
|
|
2421
|
+
L: 94,
|
|
2422
2422
|
S: this,
|
|
2423
2423
|
A: [
|
|
2424
2424
|
"deviceKey",
|
|
@@ -2447,7 +2447,7 @@ var InvitationsHandler = class {
|
|
|
2447
2447
|
id: traceId
|
|
2448
2448
|
}), {
|
|
2449
2449
|
F: __dxlog_file13,
|
|
2450
|
-
L:
|
|
2450
|
+
L: 119,
|
|
2451
2451
|
S: this,
|
|
2452
2452
|
C: (f, a) => f(...a)
|
|
2453
2453
|
});
|
|
@@ -2455,7 +2455,7 @@ var InvitationsHandler = class {
|
|
|
2455
2455
|
...protocol.toJSON()
|
|
2456
2456
|
}, {
|
|
2457
2457
|
F: __dxlog_file13,
|
|
2458
|
-
L:
|
|
2458
|
+
L: 120,
|
|
2459
2459
|
S: this,
|
|
2460
2460
|
C: (f, a) => f(...a)
|
|
2461
2461
|
});
|
|
@@ -2467,7 +2467,7 @@ var InvitationsHandler = class {
|
|
|
2467
2467
|
...protocol.toJSON()
|
|
2468
2468
|
}, {
|
|
2469
2469
|
F: __dxlog_file13,
|
|
2470
|
-
L:
|
|
2470
|
+
L: 122,
|
|
2471
2471
|
S: this,
|
|
2472
2472
|
C: (f, a) => f(...a)
|
|
2473
2473
|
});
|
|
@@ -2477,7 +2477,7 @@ var InvitationsHandler = class {
|
|
|
2477
2477
|
id: traceId
|
|
2478
2478
|
}), {
|
|
2479
2479
|
F: __dxlog_file13,
|
|
2480
|
-
L:
|
|
2480
|
+
L: 125,
|
|
2481
2481
|
S: this,
|
|
2482
2482
|
C: (f, a) => f(...a)
|
|
2483
2483
|
});
|
|
@@ -2493,7 +2493,7 @@ var InvitationsHandler = class {
|
|
|
2493
2493
|
...protocol.toJSON()
|
|
2494
2494
|
}, {
|
|
2495
2495
|
F: __dxlog_file13,
|
|
2496
|
-
L:
|
|
2496
|
+
L: 135,
|
|
2497
2497
|
S: this,
|
|
2498
2498
|
C: (f, a) => f(...a)
|
|
2499
2499
|
});
|
|
@@ -2503,7 +2503,7 @@ var InvitationsHandler = class {
|
|
|
2503
2503
|
metrics.increment("dxos.invitation.failed");
|
|
2504
2504
|
log10.error("failed", err, {
|
|
2505
2505
|
F: __dxlog_file13,
|
|
2506
|
-
L:
|
|
2506
|
+
L: 140,
|
|
2507
2507
|
S: this,
|
|
2508
2508
|
C: (f, a) => f(...a)
|
|
2509
2509
|
});
|
|
@@ -2514,7 +2514,7 @@ var InvitationsHandler = class {
|
|
|
2514
2514
|
error: err
|
|
2515
2515
|
}), {
|
|
2516
2516
|
F: __dxlog_file13,
|
|
2517
|
-
L:
|
|
2517
|
+
L: 143,
|
|
2518
2518
|
S: this,
|
|
2519
2519
|
C: (f, a) => f(...a)
|
|
2520
2520
|
});
|
|
@@ -2528,7 +2528,7 @@ var InvitationsHandler = class {
|
|
|
2528
2528
|
...err.context
|
|
2529
2529
|
}, {
|
|
2530
2530
|
F: __dxlog_file13,
|
|
2531
|
-
L:
|
|
2531
|
+
L: 151,
|
|
2532
2532
|
S: this,
|
|
2533
2533
|
C: (f, a) => f(...a)
|
|
2534
2534
|
});
|
|
@@ -2541,7 +2541,7 @@ var InvitationsHandler = class {
|
|
|
2541
2541
|
err
|
|
2542
2542
|
}, {
|
|
2543
2543
|
F: __dxlog_file13,
|
|
2544
|
-
L:
|
|
2544
|
+
L: 157,
|
|
2545
2545
|
S: this,
|
|
2546
2546
|
C: (f, a) => f(...a)
|
|
2547
2547
|
});
|
|
@@ -2551,7 +2551,7 @@ var InvitationsHandler = class {
|
|
|
2551
2551
|
metrics.increment("dxos.invitation.failed");
|
|
2552
2552
|
log10.error("failed", err, {
|
|
2553
2553
|
F: __dxlog_file13,
|
|
2554
|
-
L:
|
|
2554
|
+
L: 162,
|
|
2555
2555
|
S: this,
|
|
2556
2556
|
C: (f, a) => f(...a)
|
|
2557
2557
|
});
|
|
@@ -2565,7 +2565,7 @@ var InvitationsHandler = class {
|
|
|
2565
2565
|
if (invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
|
|
2566
2566
|
log10.warn("invitation has already expired", void 0, {
|
|
2567
2567
|
F: __dxlog_file13,
|
|
2568
|
-
L:
|
|
2568
|
+
L: 173,
|
|
2569
2569
|
S: this,
|
|
2570
2570
|
C: (f, a) => f(...a)
|
|
2571
2571
|
});
|
|
@@ -2580,7 +2580,7 @@ var InvitationsHandler = class {
|
|
|
2580
2580
|
}
|
|
2581
2581
|
let swarmConnection;
|
|
2582
2582
|
scheduleTask3(ctx, async () => {
|
|
2583
|
-
swarmConnection = await this._joinSwarm(ctx, invitation,
|
|
2583
|
+
swarmConnection = await this._joinSwarm(ctx, invitation, InvitationOptions4.Role.HOST, createExtension);
|
|
2584
2584
|
guardedState.set(null, Invitation4.State.CONNECTING);
|
|
2585
2585
|
});
|
|
2586
2586
|
}
|
|
@@ -2589,7 +2589,7 @@ var InvitationsHandler = class {
|
|
|
2589
2589
|
if (deviceProfile) {
|
|
2590
2590
|
invariant9(invitation.kind === Invitation4.Kind.DEVICE, "deviceProfile provided for non-device invitation", {
|
|
2591
2591
|
F: __dxlog_file13,
|
|
2592
|
-
L:
|
|
2592
|
+
L: 207,
|
|
2593
2593
|
S: this,
|
|
2594
2594
|
A: [
|
|
2595
2595
|
"invitation.kind === Invitation.Kind.DEVICE",
|
|
@@ -2607,7 +2607,7 @@ var InvitationsHandler = class {
|
|
|
2607
2607
|
triedPeers: triedPeersIds.size
|
|
2608
2608
|
}, {
|
|
2609
2609
|
F: __dxlog_file13,
|
|
2610
|
-
L:
|
|
2610
|
+
L: 215,
|
|
2611
2611
|
S: this,
|
|
2612
2612
|
C: (f, a) => f(...a)
|
|
2613
2613
|
});
|
|
@@ -2634,7 +2634,7 @@ var InvitationsHandler = class {
|
|
|
2634
2634
|
currentState: guardedState.current.state
|
|
2635
2635
|
}, {
|
|
2636
2636
|
F: __dxlog_file13,
|
|
2637
|
-
L:
|
|
2637
|
+
L: 243,
|
|
2638
2638
|
S: this,
|
|
2639
2639
|
C: (f, a) => f(...a)
|
|
2640
2640
|
});
|
|
@@ -2652,7 +2652,7 @@ var InvitationsHandler = class {
|
|
|
2652
2652
|
id: traceId
|
|
2653
2653
|
}), {
|
|
2654
2654
|
F: __dxlog_file13,
|
|
2655
|
-
L:
|
|
2655
|
+
L: 255,
|
|
2656
2656
|
S: this,
|
|
2657
2657
|
C: (f, a) => f(...a)
|
|
2658
2658
|
});
|
|
@@ -2664,7 +2664,7 @@ var InvitationsHandler = class {
|
|
|
2664
2664
|
...protocol.toJSON()
|
|
2665
2665
|
}, {
|
|
2666
2666
|
F: __dxlog_file13,
|
|
2667
|
-
L:
|
|
2667
|
+
L: 266,
|
|
2668
2668
|
S: this,
|
|
2669
2669
|
C: (f, a) => f(...a)
|
|
2670
2670
|
});
|
|
@@ -2673,7 +2673,7 @@ var InvitationsHandler = class {
|
|
|
2673
2673
|
...protocol.toJSON()
|
|
2674
2674
|
}, {
|
|
2675
2675
|
F: __dxlog_file13,
|
|
2676
|
-
L:
|
|
2676
|
+
L: 270,
|
|
2677
2677
|
S: this,
|
|
2678
2678
|
C: (f, a) => f(...a)
|
|
2679
2679
|
});
|
|
@@ -2686,7 +2686,7 @@ var InvitationsHandler = class {
|
|
|
2686
2686
|
response: introductionResponse
|
|
2687
2687
|
}, {
|
|
2688
2688
|
F: __dxlog_file13,
|
|
2689
|
-
L:
|
|
2689
|
+
L: 275,
|
|
2690
2690
|
S: this,
|
|
2691
2691
|
C: (f, a) => f(...a)
|
|
2692
2692
|
});
|
|
@@ -2707,7 +2707,7 @@ var InvitationsHandler = class {
|
|
|
2707
2707
|
...protocol.toJSON()
|
|
2708
2708
|
}, {
|
|
2709
2709
|
F: __dxlog_file13,
|
|
2710
|
-
L:
|
|
2710
|
+
L: 301,
|
|
2711
2711
|
S: this,
|
|
2712
2712
|
C: (f, a) => f(...a)
|
|
2713
2713
|
});
|
|
@@ -2719,7 +2719,7 @@ var InvitationsHandler = class {
|
|
|
2719
2719
|
...protocol.toJSON()
|
|
2720
2720
|
}, {
|
|
2721
2721
|
F: __dxlog_file13,
|
|
2722
|
-
L:
|
|
2722
|
+
L: 312,
|
|
2723
2723
|
S: this,
|
|
2724
2724
|
C: (f, a) => f(...a)
|
|
2725
2725
|
});
|
|
@@ -2732,7 +2732,7 @@ var InvitationsHandler = class {
|
|
|
2732
2732
|
id: traceId
|
|
2733
2733
|
}), {
|
|
2734
2734
|
F: __dxlog_file13,
|
|
2735
|
-
L:
|
|
2735
|
+
L: 318,
|
|
2736
2736
|
S: this,
|
|
2737
2737
|
C: (f, a) => f(...a)
|
|
2738
2738
|
});
|
|
@@ -2742,7 +2742,7 @@ var InvitationsHandler = class {
|
|
|
2742
2742
|
...protocol.toJSON()
|
|
2743
2743
|
}, {
|
|
2744
2744
|
F: __dxlog_file13,
|
|
2745
|
-
L:
|
|
2745
|
+
L: 321,
|
|
2746
2746
|
S: this,
|
|
2747
2747
|
C: (f, a) => f(...a)
|
|
2748
2748
|
});
|
|
@@ -2750,7 +2750,7 @@ var InvitationsHandler = class {
|
|
|
2750
2750
|
} else {
|
|
2751
2751
|
log10("auth failed", err, {
|
|
2752
2752
|
F: __dxlog_file13,
|
|
2753
|
-
L:
|
|
2753
|
+
L: 324,
|
|
2754
2754
|
S: this,
|
|
2755
2755
|
C: (f, a) => f(...a)
|
|
2756
2756
|
});
|
|
@@ -2762,7 +2762,7 @@ var InvitationsHandler = class {
|
|
|
2762
2762
|
error: err
|
|
2763
2763
|
}), {
|
|
2764
2764
|
F: __dxlog_file13,
|
|
2765
|
-
L:
|
|
2765
|
+
L: 328,
|
|
2766
2766
|
S: this,
|
|
2767
2767
|
C: (f, a) => f(...a)
|
|
2768
2768
|
});
|
|
@@ -2778,7 +2778,7 @@ var InvitationsHandler = class {
|
|
|
2778
2778
|
...protocol.toJSON()
|
|
2779
2779
|
}, {
|
|
2780
2780
|
F: __dxlog_file13,
|
|
2781
|
-
L:
|
|
2781
|
+
L: 337,
|
|
2782
2782
|
S: this,
|
|
2783
2783
|
C: (f, a) => f(...a)
|
|
2784
2784
|
});
|
|
@@ -2786,7 +2786,7 @@ var InvitationsHandler = class {
|
|
|
2786
2786
|
} else {
|
|
2787
2787
|
log10("auth failed", err, {
|
|
2788
2788
|
F: __dxlog_file13,
|
|
2789
|
-
L:
|
|
2789
|
+
L: 340,
|
|
2790
2790
|
S: this,
|
|
2791
2791
|
C: (f, a) => f(...a)
|
|
2792
2792
|
});
|
|
@@ -2804,21 +2804,21 @@ var InvitationsHandler = class {
|
|
|
2804
2804
|
} else {
|
|
2805
2805
|
invariant9(invitation.swarmKey, void 0, {
|
|
2806
2806
|
F: __dxlog_file13,
|
|
2807
|
-
L:
|
|
2807
|
+
L: 355,
|
|
2808
2808
|
S: this,
|
|
2809
2809
|
A: [
|
|
2810
2810
|
"invitation.swarmKey",
|
|
2811
2811
|
""
|
|
2812
2812
|
]
|
|
2813
2813
|
});
|
|
2814
|
-
await this._joinSwarm(ctx, invitation,
|
|
2814
|
+
await this._joinSwarm(ctx, invitation, InvitationOptions4.Role.GUEST, createExtension);
|
|
2815
2815
|
guardedState.set(null, Invitation4.State.CONNECTING);
|
|
2816
2816
|
}
|
|
2817
2817
|
});
|
|
2818
2818
|
}
|
|
2819
2819
|
async _joinSwarm(ctx, invitation, role, extensionFactory) {
|
|
2820
2820
|
let label;
|
|
2821
|
-
if (role ===
|
|
2821
|
+
if (role === InvitationOptions4.Role.GUEST) {
|
|
2822
2822
|
label = "invitation guest";
|
|
2823
2823
|
} else if (invitation.kind === Invitation4.Kind.DEVICE) {
|
|
2824
2824
|
label = "invitation host for device";
|
|
@@ -2904,7 +2904,7 @@ var InvitationsHandler = class {
|
|
|
2904
2904
|
oldState: stateToString(invitation.state)
|
|
2905
2905
|
}, {
|
|
2906
2906
|
F: __dxlog_file13,
|
|
2907
|
-
L:
|
|
2907
|
+
L: 449,
|
|
2908
2908
|
S: this,
|
|
2909
2909
|
C: (f, a) => f(...a)
|
|
2910
2910
|
});
|
|
@@ -2915,7 +2915,7 @@ var InvitationsHandler = class {
|
|
|
2915
2915
|
oldState: stateToString(invitation.state)
|
|
2916
2916
|
}, {
|
|
2917
2917
|
F: __dxlog_file13,
|
|
2918
|
-
L:
|
|
2918
|
+
L: 455,
|
|
2919
2919
|
S: this,
|
|
2920
2920
|
C: (f, a) => f(...a)
|
|
2921
2921
|
});
|
|
@@ -2934,7 +2934,7 @@ var InvitationsHandler = class {
|
|
|
2934
2934
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
2935
2935
|
log10("guest waiting for authentication code...", void 0, {
|
|
2936
2936
|
F: __dxlog_file13,
|
|
2937
|
-
L:
|
|
2937
|
+
L: 480,
|
|
2938
2938
|
S: this,
|
|
2939
2939
|
C: (f, a) => f(...a)
|
|
2940
2940
|
});
|
|
@@ -2942,7 +2942,7 @@ var InvitationsHandler = class {
|
|
|
2942
2942
|
const authCode = await authenticated.wait(options);
|
|
2943
2943
|
log10("sending authentication request", void 0, {
|
|
2944
2944
|
F: __dxlog_file13,
|
|
2945
|
-
L:
|
|
2945
|
+
L: 484,
|
|
2946
2946
|
S: this,
|
|
2947
2947
|
C: (f, a) => f(...a)
|
|
2948
2948
|
});
|
|
@@ -2961,7 +2961,7 @@ var InvitationsHandler = class {
|
|
|
2961
2961
|
attempt
|
|
2962
2962
|
}, {
|
|
2963
2963
|
F: __dxlog_file13,
|
|
2964
|
-
L:
|
|
2964
|
+
L: 495,
|
|
2965
2965
|
S: this,
|
|
2966
2966
|
C: (f, a) => f(...a)
|
|
2967
2967
|
});
|
|
@@ -2979,7 +2979,7 @@ var InvitationsHandler = class {
|
|
|
2979
2979
|
}
|
|
2980
2980
|
log10("sending authentication request", void 0, {
|
|
2981
2981
|
F: __dxlog_file13,
|
|
2982
|
-
L:
|
|
2982
|
+
L: 514,
|
|
2983
2983
|
S: this,
|
|
2984
2984
|
C: (f, a) => f(...a)
|
|
2985
2985
|
});
|
|
@@ -4322,10 +4322,10 @@ var DataSpace = class {
|
|
|
4322
4322
|
// TODO(dmaretskyi): Move into Space?
|
|
4323
4323
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
4324
4324
|
this._epochProcessingMutex = new Mutex2();
|
|
4325
|
-
this._state = SpaceState2.
|
|
4325
|
+
this._state = SpaceState2.SPACE_CLOSED;
|
|
4326
4326
|
this._databaseRoot = null;
|
|
4327
4327
|
/**
|
|
4328
|
-
* Error for _state === SpaceState.
|
|
4328
|
+
* Error for _state === SpaceState.SPACE_ERROR.
|
|
4329
4329
|
*/
|
|
4330
4330
|
this.error = void 0;
|
|
4331
4331
|
this.stateUpdate = new Event6();
|
|
@@ -4394,7 +4394,7 @@ var DataSpace = class {
|
|
|
4394
4394
|
};
|
|
4395
4395
|
}
|
|
4396
4396
|
async open() {
|
|
4397
|
-
if (this._state === SpaceState2.
|
|
4397
|
+
if (this._state === SpaceState2.SPACE_CLOSED) {
|
|
4398
4398
|
await this._open();
|
|
4399
4399
|
}
|
|
4400
4400
|
}
|
|
@@ -4409,7 +4409,7 @@ var DataSpace = class {
|
|
|
4409
4409
|
F: __dxlog_file18,
|
|
4410
4410
|
L: 215
|
|
4411
4411
|
}));
|
|
4412
|
-
this._state = SpaceState2.
|
|
4412
|
+
this._state = SpaceState2.SPACE_CONTROL_ONLY;
|
|
4413
4413
|
log15("new state", {
|
|
4414
4414
|
state: SpaceState2[this._state]
|
|
4415
4415
|
}, {
|
|
@@ -4427,7 +4427,7 @@ var DataSpace = class {
|
|
|
4427
4427
|
}
|
|
4428
4428
|
async _close() {
|
|
4429
4429
|
await this._callbacks.beforeClose?.();
|
|
4430
|
-
this._state = SpaceState2.
|
|
4430
|
+
this._state = SpaceState2.SPACE_CLOSED;
|
|
4431
4431
|
log15("new state", {
|
|
4432
4432
|
state: SpaceState2[this._state]
|
|
4433
4433
|
}, {
|
|
@@ -4480,7 +4480,7 @@ var DataSpace = class {
|
|
|
4480
4480
|
S: this,
|
|
4481
4481
|
C: (f, a) => f(...a)
|
|
4482
4482
|
});
|
|
4483
|
-
this._state = SpaceState2.
|
|
4483
|
+
this._state = SpaceState2.SPACE_ERROR;
|
|
4484
4484
|
log15("new state", {
|
|
4485
4485
|
state: SpaceState2[this._state]
|
|
4486
4486
|
}, {
|
|
@@ -4497,10 +4497,10 @@ var DataSpace = class {
|
|
|
4497
4497
|
});
|
|
4498
4498
|
}
|
|
4499
4499
|
async initializeDataPipeline() {
|
|
4500
|
-
if (this._state !== SpaceState2.
|
|
4500
|
+
if (this._state !== SpaceState2.SPACE_CONTROL_ONLY) {
|
|
4501
4501
|
throw new SystemError("Invalid operation");
|
|
4502
4502
|
}
|
|
4503
|
-
this._state = SpaceState2.
|
|
4503
|
+
this._state = SpaceState2.SPACE_INITIALIZING;
|
|
4504
4504
|
log15("new state", {
|
|
4505
4505
|
state: SpaceState2[this._state]
|
|
4506
4506
|
}, {
|
|
@@ -4511,13 +4511,13 @@ var DataSpace = class {
|
|
|
4511
4511
|
});
|
|
4512
4512
|
await this._initializeAndReadControlPipeline();
|
|
4513
4513
|
await sleep3(1);
|
|
4514
|
-
const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState2.
|
|
4514
|
+
const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState2.SPACE_READY);
|
|
4515
4515
|
this._automergeSpaceState.startProcessingRootDocs();
|
|
4516
4516
|
await ready;
|
|
4517
4517
|
}
|
|
4518
4518
|
async _enterReadyState() {
|
|
4519
4519
|
await this._callbacks.beforeReady?.();
|
|
4520
|
-
this._state = SpaceState2.
|
|
4520
|
+
this._state = SpaceState2.SPACE_READY;
|
|
4521
4521
|
log15("new state", {
|
|
4522
4522
|
state: SpaceState2[this._state]
|
|
4523
4523
|
}, {
|
|
@@ -4631,9 +4631,9 @@ var DataSpace = class {
|
|
|
4631
4631
|
const root = await this._echoHost.openSpaceRoot(this.id, handle.url);
|
|
4632
4632
|
this._databaseRoot = root;
|
|
4633
4633
|
if (root.getVersion() !== SpaceDocVersion2.CURRENT) {
|
|
4634
|
-
this._state = SpaceState2.
|
|
4634
|
+
this._state = SpaceState2.SPACE_REQUIRES_MIGRATION;
|
|
4635
4635
|
this.stateUpdate.emit();
|
|
4636
|
-
} else if (this._state !== SpaceState2.
|
|
4636
|
+
} else if (this._state !== SpaceState2.SPACE_READY) {
|
|
4637
4637
|
await this._enterReadyState();
|
|
4638
4638
|
} else {
|
|
4639
4639
|
this.stateUpdate.emit();
|
|
@@ -4721,24 +4721,24 @@ var DataSpace = class {
|
|
|
4721
4721
|
}
|
|
4722
4722
|
async activate() {
|
|
4723
4723
|
if (![
|
|
4724
|
-
SpaceState2.
|
|
4725
|
-
SpaceState2.
|
|
4724
|
+
SpaceState2.SPACE_CLOSED,
|
|
4725
|
+
SpaceState2.SPACE_INACTIVE
|
|
4726
4726
|
].includes(this._state)) {
|
|
4727
4727
|
return;
|
|
4728
4728
|
}
|
|
4729
|
-
await this._metadataStore.setSpaceState(this.key, SpaceState2.
|
|
4729
|
+
await this._metadataStore.setSpaceState(this.key, SpaceState2.SPACE_ACTIVE);
|
|
4730
4730
|
await this._open();
|
|
4731
4731
|
this.initializeDataPipelineAsync();
|
|
4732
4732
|
}
|
|
4733
4733
|
async deactivate() {
|
|
4734
|
-
if (this._state === SpaceState2.
|
|
4734
|
+
if (this._state === SpaceState2.SPACE_INACTIVE) {
|
|
4735
4735
|
return;
|
|
4736
4736
|
}
|
|
4737
|
-
await this._metadataStore.setSpaceState(this.key, SpaceState2.
|
|
4738
|
-
if (this._state !== SpaceState2.
|
|
4737
|
+
await this._metadataStore.setSpaceState(this.key, SpaceState2.SPACE_INACTIVE);
|
|
4738
|
+
if (this._state !== SpaceState2.SPACE_CLOSED) {
|
|
4739
4739
|
await this._close();
|
|
4740
4740
|
}
|
|
4741
|
-
this._state = SpaceState2.
|
|
4741
|
+
this._state = SpaceState2.SPACE_INACTIVE;
|
|
4742
4742
|
log15("new state", {
|
|
4743
4743
|
state: SpaceState2[this._state]
|
|
4744
4744
|
}, {
|
|
@@ -5042,7 +5042,7 @@ var DataSpaceManager = class {
|
|
|
5042
5042
|
genesisFeedKey: controlFeedKey,
|
|
5043
5043
|
controlFeedKey,
|
|
5044
5044
|
dataFeedKey,
|
|
5045
|
-
state: SpaceState3.
|
|
5045
|
+
state: SpaceState3.SPACE_ACTIVE
|
|
5046
5046
|
};
|
|
5047
5047
|
log16("creating space...", {
|
|
5048
5048
|
spaceKey
|
|
@@ -5224,7 +5224,7 @@ var DataSpaceManager = class {
|
|
|
5224
5224
|
async waitUntilSpaceReady(spaceKey) {
|
|
5225
5225
|
await cancelWithContext5(this._ctx, this.updated.waitForCondition(() => {
|
|
5226
5226
|
const space = this._spaces.get(spaceKey);
|
|
5227
|
-
return !!space && space.state === SpaceState3.
|
|
5227
|
+
return !!space && space.state === SpaceState3.SPACE_READY;
|
|
5228
5228
|
}));
|
|
5229
5229
|
}
|
|
5230
5230
|
async requestSpaceAdmissionCredential(spaceKey) {
|
|
@@ -5307,7 +5307,7 @@ var DataSpaceManager = class {
|
|
|
5307
5307
|
});
|
|
5308
5308
|
},
|
|
5309
5309
|
onMemberRolesChanged: async (members) => {
|
|
5310
|
-
if (dataSpace?.state === SpaceState3.
|
|
5310
|
+
if (dataSpace?.state === SpaceState3.SPACE_READY) {
|
|
5311
5311
|
this._handleMemberRoleChanges(presence, space.protocol, members);
|
|
5312
5312
|
}
|
|
5313
5313
|
},
|
|
@@ -5320,7 +5320,7 @@ var DataSpaceManager = class {
|
|
|
5320
5320
|
dataFeed && await space.setDataFeed(dataFeed);
|
|
5321
5321
|
const dataSpace = new DataSpace({
|
|
5322
5322
|
inner: space,
|
|
5323
|
-
initialState: metadata.state === SpaceState3.
|
|
5323
|
+
initialState: metadata.state === SpaceState3.SPACE_INACTIVE ? SpaceState3.SPACE_INACTIVE : SpaceState3.SPACE_CLOSED,
|
|
5324
5324
|
metadataStore: this._metadataStore,
|
|
5325
5325
|
gossip,
|
|
5326
5326
|
presence,
|
|
@@ -5373,7 +5373,7 @@ var DataSpaceManager = class {
|
|
|
5373
5373
|
cache: metadata.cache
|
|
5374
5374
|
});
|
|
5375
5375
|
presence.newPeer.on((peerState) => {
|
|
5376
|
-
if (dataSpace.state === SpaceState3.
|
|
5376
|
+
if (dataSpace.state === SpaceState3.SPACE_READY) {
|
|
5377
5377
|
this._handleNewPeerConnected(space, peerState);
|
|
5378
5378
|
}
|
|
5379
5379
|
});
|
|
@@ -5429,7 +5429,7 @@ var DataSpaceManager = class {
|
|
|
5429
5429
|
}
|
|
5430
5430
|
}
|
|
5431
5431
|
async _handleInvitationStatusChange(dataSpace, delegatedInvitation, isActive) {
|
|
5432
|
-
if (dataSpace?.state !== SpaceState3.
|
|
5432
|
+
if (dataSpace?.state !== SpaceState3.SPACE_READY) {
|
|
5433
5433
|
return;
|
|
5434
5434
|
}
|
|
5435
5435
|
if (isActive) {
|
|
@@ -5510,10 +5510,10 @@ var SpacesServiceImpl = class {
|
|
|
5510
5510
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError2(spaceKey));
|
|
5511
5511
|
if (state) {
|
|
5512
5512
|
switch (state) {
|
|
5513
|
-
case SpaceState4.
|
|
5513
|
+
case SpaceState4.SPACE_ACTIVE:
|
|
5514
5514
|
await space.activate();
|
|
5515
5515
|
break;
|
|
5516
|
-
case SpaceState4.
|
|
5516
|
+
case SpaceState4.SPACE_INACTIVE:
|
|
5517
5517
|
await space.deactivate();
|
|
5518
5518
|
break;
|
|
5519
5519
|
default:
|
|
@@ -7353,4 +7353,4 @@ export {
|
|
|
7353
7353
|
ClientServicesProviderResource,
|
|
7354
7354
|
DiagnosticsCollector
|
|
7355
7355
|
};
|
|
7356
|
-
//# sourceMappingURL=chunk-
|
|
7356
|
+
//# sourceMappingURL=chunk-TRX3WZGF.mjs.map
|