@dxos/client-services 0.6.12-main.89e9959 → 0.6.12-main.ac23639
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-XVI3VSJT.mjs → chunk-HJR7N476.mjs} +61 -23
- package/dist/lib/browser/chunk-HJR7N476.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -1
- package/dist/lib/node/{chunk-NZL66D6K.cjs → chunk-JU4QYYUL.cjs} +64 -26
- package/dist/lib/node/chunk-JU4QYYUL.cjs.map +7 -0
- package/dist/lib/node/index.cjs +45 -45
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +8 -8
- package/dist/lib/node-esm/{chunk-6747X7GN.mjs → chunk-MIHFUPW7.mjs} +61 -23
- package/dist/lib/node-esm/chunk-MIHFUPW7.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts +2 -0
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +1 -0
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +38 -38
- package/src/packlets/spaces/data-space-manager.ts +29 -3
- package/src/packlets/spaces/data-space.ts +4 -0
- package/src/packlets/spaces/spaces-service.ts +6 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-XVI3VSJT.mjs.map +0 -7
- package/dist/lib/node/chunk-NZL66D6K.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-6747X7GN.mjs.map +0 -7
|
@@ -404,7 +404,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
|
404
404
|
import { TRACE_PROCESSOR } from "@dxos/tracing";
|
|
405
405
|
|
|
406
406
|
// packages/sdk/client-services/src/version.ts
|
|
407
|
-
var DXOS_VERSION = "0.6.12-main.
|
|
407
|
+
var DXOS_VERSION = "0.6.12-main.ac23639";
|
|
408
408
|
|
|
409
409
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
410
410
|
import { Platform } from "@dxos/protocols/proto/dxos/client/services";
|
|
@@ -2020,6 +2020,7 @@ import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
|
2020
2020
|
import { log as log8 } from "@dxos/log";
|
|
2021
2021
|
import { AlreadyJoinedError, trace as Trace } from "@dxos/protocols";
|
|
2022
2022
|
import { Invitation, SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
2023
|
+
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
2023
2024
|
import { SpaceMember as SpaceMember3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2024
2025
|
import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
|
|
2025
2026
|
import { trace } from "@dxos/tracing";
|
|
@@ -2445,12 +2446,36 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2445
2446
|
}
|
|
2446
2447
|
});
|
|
2447
2448
|
}
|
|
2449
|
+
async setSpaceEdgeReplicationSetting(spaceKey, setting) {
|
|
2450
|
+
const space = this._spaces.get(spaceKey);
|
|
2451
|
+
invariant5(space, "Space not found.", {
|
|
2452
|
+
F: __dxlog_file10,
|
|
2453
|
+
L: 399,
|
|
2454
|
+
S: this,
|
|
2455
|
+
A: [
|
|
2456
|
+
"space",
|
|
2457
|
+
"'Space not found.'"
|
|
2458
|
+
]
|
|
2459
|
+
});
|
|
2460
|
+
await this._metadataStore.setSpaceEdgeReplicationSetting(spaceKey, setting);
|
|
2461
|
+
if (space.isOpen) {
|
|
2462
|
+
switch (setting) {
|
|
2463
|
+
case EdgeReplicationSetting.DISABLED:
|
|
2464
|
+
await this._echoEdgeReplicator?.disconnectFromSpace(space.id);
|
|
2465
|
+
break;
|
|
2466
|
+
case EdgeReplicationSetting.ENABLED:
|
|
2467
|
+
await this._echoEdgeReplicator?.connectToSpace(space.id);
|
|
2468
|
+
break;
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
space.stateUpdate.emit();
|
|
2472
|
+
}
|
|
2448
2473
|
async _constructSpace(metadata) {
|
|
2449
2474
|
log8("construct space", {
|
|
2450
2475
|
metadata
|
|
2451
2476
|
}, {
|
|
2452
2477
|
F: __dxlog_file10,
|
|
2453
|
-
L:
|
|
2478
|
+
L: 418,
|
|
2454
2479
|
S: this,
|
|
2455
2480
|
C: (f, a) => f(...a)
|
|
2456
2481
|
});
|
|
@@ -2494,7 +2519,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2494
2519
|
err
|
|
2495
2520
|
}, {
|
|
2496
2521
|
F: __dxlog_file10,
|
|
2497
|
-
L:
|
|
2522
|
+
L: 460,
|
|
2498
2523
|
S: this,
|
|
2499
2524
|
C: (f, a) => f(...a)
|
|
2500
2525
|
});
|
|
@@ -2504,7 +2529,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2504
2529
|
onAuthFailure: () => {
|
|
2505
2530
|
log8.warn("auth failure", void 0, {
|
|
2506
2531
|
F: __dxlog_file10,
|
|
2507
|
-
L:
|
|
2532
|
+
L: 465,
|
|
2508
2533
|
S: this,
|
|
2509
2534
|
C: (f, a) => f(...a)
|
|
2510
2535
|
});
|
|
@@ -2537,7 +2562,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2537
2562
|
space: space.key
|
|
2538
2563
|
}, {
|
|
2539
2564
|
F: __dxlog_file10,
|
|
2540
|
-
L:
|
|
2565
|
+
L: 492,
|
|
2541
2566
|
S: this,
|
|
2542
2567
|
C: (f, a) => f(...a)
|
|
2543
2568
|
});
|
|
@@ -2548,7 +2573,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2548
2573
|
open: this._lifecycleState === LifecycleState.OPEN
|
|
2549
2574
|
}, {
|
|
2550
2575
|
F: __dxlog_file10,
|
|
2551
|
-
L:
|
|
2576
|
+
L: 495,
|
|
2552
2577
|
S: this,
|
|
2553
2578
|
C: (f, a) => f(...a)
|
|
2554
2579
|
});
|
|
@@ -2567,7 +2592,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2567
2592
|
space: space.key
|
|
2568
2593
|
}, {
|
|
2569
2594
|
F: __dxlog_file10,
|
|
2570
|
-
L:
|
|
2595
|
+
L: 503,
|
|
2571
2596
|
S: this,
|
|
2572
2597
|
C: (f, a) => f(...a)
|
|
2573
2598
|
});
|
|
@@ -2579,10 +2604,16 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2579
2604
|
edgeFeatures: this._edgeFeatures
|
|
2580
2605
|
});
|
|
2581
2606
|
dataSpace.postOpen.append(async () => {
|
|
2582
|
-
|
|
2607
|
+
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2608
|
+
if (setting === EdgeReplicationSetting.ENABLED) {
|
|
2609
|
+
await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
|
|
2610
|
+
}
|
|
2583
2611
|
});
|
|
2584
2612
|
dataSpace.preClose.append(async () => {
|
|
2585
|
-
|
|
2613
|
+
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2614
|
+
if (setting === EdgeReplicationSetting.ENABLED) {
|
|
2615
|
+
await this._echoEdgeReplicator?.disconnectFromSpace(dataSpace.id);
|
|
2616
|
+
}
|
|
2586
2617
|
});
|
|
2587
2618
|
presence.newPeer.on((peerState) => {
|
|
2588
2619
|
if (dataSpace.state === SpaceState.SPACE_READY) {
|
|
@@ -2602,7 +2633,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2602
2633
|
space: space.key
|
|
2603
2634
|
}, {
|
|
2604
2635
|
F: __dxlog_file10,
|
|
2605
|
-
L:
|
|
2636
|
+
L: 541,
|
|
2606
2637
|
S: this,
|
|
2607
2638
|
C: (f, a) => f(...a)
|
|
2608
2639
|
});
|
|
@@ -2635,7 +2666,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2635
2666
|
closedSessions
|
|
2636
2667
|
}, {
|
|
2637
2668
|
F: __dxlog_file10,
|
|
2638
|
-
L:
|
|
2669
|
+
L: 567,
|
|
2639
2670
|
S: this,
|
|
2640
2671
|
C: (f, a) => f(...a)
|
|
2641
2672
|
});
|
|
@@ -2650,7 +2681,7 @@ var DataSpaceManager = class extends Resource4 {
|
|
|
2650
2681
|
peerId: peerState.peerId
|
|
2651
2682
|
}, {
|
|
2652
2683
|
F: __dxlog_file10,
|
|
2653
|
-
L:
|
|
2684
|
+
L: 581,
|
|
2654
2685
|
S: this,
|
|
2655
2686
|
C: (f, a) => f(...a)
|
|
2656
2687
|
});
|
|
@@ -2735,7 +2766,7 @@ var SpacesServiceImpl = class {
|
|
|
2735
2766
|
await this._updateMetrics();
|
|
2736
2767
|
return this._serializeSpace(space);
|
|
2737
2768
|
}
|
|
2738
|
-
async updateSpace({ spaceKey, state }) {
|
|
2769
|
+
async updateSpace({ spaceKey, state, edgeReplication }) {
|
|
2739
2770
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2740
2771
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? raise(new SpaceNotFoundError(spaceKey));
|
|
2741
2772
|
if (state) {
|
|
@@ -2750,6 +2781,9 @@ var SpacesServiceImpl = class {
|
|
|
2750
2781
|
throw new ApiError("Invalid space state");
|
|
2751
2782
|
}
|
|
2752
2783
|
}
|
|
2784
|
+
if (edgeReplication !== void 0) {
|
|
2785
|
+
await dataSpaceManager.setSpaceEdgeReplicationSetting(spaceKey, edgeReplication);
|
|
2786
|
+
}
|
|
2753
2787
|
}
|
|
2754
2788
|
async updateMemberRole(request) {
|
|
2755
2789
|
const identity = this._requireIdentity();
|
|
@@ -2766,7 +2800,7 @@ var SpacesServiceImpl = class {
|
|
|
2766
2800
|
const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
2767
2801
|
invariant6(credentials[0].credential, void 0, {
|
|
2768
2802
|
F: __dxlog_file11,
|
|
2769
|
-
L:
|
|
2803
|
+
L: 106,
|
|
2770
2804
|
S: this,
|
|
2771
2805
|
A: [
|
|
2772
2806
|
"credentials[0].credential",
|
|
@@ -2776,7 +2810,7 @@ var SpacesServiceImpl = class {
|
|
|
2776
2810
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2777
2811
|
invariant6(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2778
2812
|
F: __dxlog_file11,
|
|
2779
|
-
L:
|
|
2813
|
+
L: 108,
|
|
2780
2814
|
S: this,
|
|
2781
2815
|
A: [
|
|
2782
2816
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2794,7 +2828,7 @@ var SpacesServiceImpl = class {
|
|
|
2794
2828
|
ids: spaces.map((space) => space.id)
|
|
2795
2829
|
}), {
|
|
2796
2830
|
F: __dxlog_file11,
|
|
2797
|
-
L:
|
|
2831
|
+
L: 119,
|
|
2798
2832
|
S: this,
|
|
2799
2833
|
C: (f, a) => f(...a)
|
|
2800
2834
|
});
|
|
@@ -2886,7 +2920,7 @@ var SpacesServiceImpl = class {
|
|
|
2886
2920
|
} else {
|
|
2887
2921
|
invariant6(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
2888
2922
|
F: __dxlog_file11,
|
|
2889
|
-
L:
|
|
2923
|
+
L: 217,
|
|
2890
2924
|
S: this,
|
|
2891
2925
|
A: [
|
|
2892
2926
|
"!credential.id",
|
|
@@ -2895,7 +2929,7 @@ var SpacesServiceImpl = class {
|
|
|
2895
2929
|
});
|
|
2896
2930
|
invariant6(this._identityManager.identity, "Identity is not available", {
|
|
2897
2931
|
F: __dxlog_file11,
|
|
2898
|
-
L:
|
|
2932
|
+
L: 218,
|
|
2899
2933
|
S: this,
|
|
2900
2934
|
A: [
|
|
2901
2935
|
"this._identityManager.identity",
|
|
@@ -2905,7 +2939,7 @@ var SpacesServiceImpl = class {
|
|
|
2905
2939
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
2906
2940
|
invariant6(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
2907
2941
|
F: __dxlog_file11,
|
|
2908
|
-
L:
|
|
2942
|
+
L: 220,
|
|
2909
2943
|
S: this,
|
|
2910
2944
|
A: [
|
|
2911
2945
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -2955,7 +2989,7 @@ var SpacesServiceImpl = class {
|
|
|
2955
2989
|
const assertion = getCredentialAssertion3(credential);
|
|
2956
2990
|
invariant6(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2957
2991
|
F: __dxlog_file11,
|
|
2958
|
-
L:
|
|
2992
|
+
L: 254,
|
|
2959
2993
|
S: this,
|
|
2960
2994
|
A: [
|
|
2961
2995
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2965,7 +2999,7 @@ var SpacesServiceImpl = class {
|
|
|
2965
2999
|
const myIdentity = this._identityManager.identity;
|
|
2966
3000
|
invariant6(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
2967
3001
|
F: __dxlog_file11,
|
|
2968
|
-
L:
|
|
3002
|
+
L: 256,
|
|
2969
3003
|
S: this,
|
|
2970
3004
|
A: [
|
|
2971
3005
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -3027,7 +3061,8 @@ var SpacesServiceImpl = class {
|
|
|
3027
3061
|
}),
|
|
3028
3062
|
creator: space.inner.spaceState.creator?.key,
|
|
3029
3063
|
cache: space.cache,
|
|
3030
|
-
metrics: space.metrics
|
|
3064
|
+
metrics: space.metrics,
|
|
3065
|
+
edgeReplication: space.getEdgeReplicationSetting()
|
|
3031
3066
|
};
|
|
3032
3067
|
}
|
|
3033
3068
|
_requireIdentity() {
|
|
@@ -4478,6 +4513,9 @@ var DataSpace = class {
|
|
|
4478
4513
|
});
|
|
4479
4514
|
this.stateUpdate.emit();
|
|
4480
4515
|
}
|
|
4516
|
+
getEdgeReplicationSetting() {
|
|
4517
|
+
return this._metadataStore.getSpaceEdgeReplicationSetting(this.key);
|
|
4518
|
+
}
|
|
4481
4519
|
};
|
|
4482
4520
|
_ts_decorate6([
|
|
4483
4521
|
trace5.info()
|
|
@@ -8302,4 +8340,4 @@ export {
|
|
|
8302
8340
|
importProfileData,
|
|
8303
8341
|
ClientServicesHost
|
|
8304
8342
|
};
|
|
8305
|
-
//# sourceMappingURL=chunk-
|
|
8343
|
+
//# sourceMappingURL=chunk-HJR7N476.mjs.map
|