@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
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
InvitationsManager,
|
|
8
8
|
ServiceContext,
|
|
9
9
|
SpaceInvitationProtocol
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-HJR7N476.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_JU4QYYUL_exports = {};
|
|
30
|
+
__export(chunk_JU4QYYUL_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -70,7 +70,7 @@ __export(chunk_NZL66D6K_exports, {
|
|
|
70
70
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
71
71
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
72
72
|
});
|
|
73
|
-
module.exports = __toCommonJS(
|
|
73
|
+
module.exports = __toCommonJS(chunk_JU4QYYUL_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");
|
|
@@ -177,6 +177,7 @@ var import_keys8 = require("@dxos/keys");
|
|
|
177
177
|
var import_log9 = require("@dxos/log");
|
|
178
178
|
var import_protocols5 = require("@dxos/protocols");
|
|
179
179
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
180
|
+
var import_metadata = require("@dxos/protocols/proto/dxos/echo/metadata");
|
|
180
181
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
181
182
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
182
183
|
var import_tracing5 = require("@dxos/tracing");
|
|
@@ -706,7 +707,7 @@ var DevtoolsServiceImpl = class {
|
|
|
706
707
|
});
|
|
707
708
|
}
|
|
708
709
|
};
|
|
709
|
-
var DXOS_VERSION = "0.6.12-main.
|
|
710
|
+
var DXOS_VERSION = "0.6.12-main.ac23639";
|
|
710
711
|
var getPlatform = () => {
|
|
711
712
|
if (process.browser) {
|
|
712
713
|
if (typeof window !== "undefined") {
|
|
@@ -2541,12 +2542,36 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2541
2542
|
}
|
|
2542
2543
|
});
|
|
2543
2544
|
}
|
|
2545
|
+
async setSpaceEdgeReplicationSetting(spaceKey, setting) {
|
|
2546
|
+
const space = this._spaces.get(spaceKey);
|
|
2547
|
+
(0, import_invariant7.invariant)(space, "Space not found.", {
|
|
2548
|
+
F: __dxlog_file9,
|
|
2549
|
+
L: 399,
|
|
2550
|
+
S: this,
|
|
2551
|
+
A: [
|
|
2552
|
+
"space",
|
|
2553
|
+
"'Space not found.'"
|
|
2554
|
+
]
|
|
2555
|
+
});
|
|
2556
|
+
await this._metadataStore.setSpaceEdgeReplicationSetting(spaceKey, setting);
|
|
2557
|
+
if (space.isOpen) {
|
|
2558
|
+
switch (setting) {
|
|
2559
|
+
case import_metadata.EdgeReplicationSetting.DISABLED:
|
|
2560
|
+
await this._echoEdgeReplicator?.disconnectFromSpace(space.id);
|
|
2561
|
+
break;
|
|
2562
|
+
case import_metadata.EdgeReplicationSetting.ENABLED:
|
|
2563
|
+
await this._echoEdgeReplicator?.connectToSpace(space.id);
|
|
2564
|
+
break;
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
space.stateUpdate.emit();
|
|
2568
|
+
}
|
|
2544
2569
|
async _constructSpace(metadata) {
|
|
2545
2570
|
(0, import_log9.log)("construct space", {
|
|
2546
2571
|
metadata
|
|
2547
2572
|
}, {
|
|
2548
2573
|
F: __dxlog_file9,
|
|
2549
|
-
L:
|
|
2574
|
+
L: 418,
|
|
2550
2575
|
S: this,
|
|
2551
2576
|
C: (f, a) => f(...a)
|
|
2552
2577
|
});
|
|
@@ -2590,7 +2615,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2590
2615
|
err
|
|
2591
2616
|
}, {
|
|
2592
2617
|
F: __dxlog_file9,
|
|
2593
|
-
L:
|
|
2618
|
+
L: 460,
|
|
2594
2619
|
S: this,
|
|
2595
2620
|
C: (f, a) => f(...a)
|
|
2596
2621
|
});
|
|
@@ -2600,7 +2625,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2600
2625
|
onAuthFailure: () => {
|
|
2601
2626
|
import_log9.log.warn("auth failure", void 0, {
|
|
2602
2627
|
F: __dxlog_file9,
|
|
2603
|
-
L:
|
|
2628
|
+
L: 465,
|
|
2604
2629
|
S: this,
|
|
2605
2630
|
C: (f, a) => f(...a)
|
|
2606
2631
|
});
|
|
@@ -2633,7 +2658,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2633
2658
|
space: space.key
|
|
2634
2659
|
}, {
|
|
2635
2660
|
F: __dxlog_file9,
|
|
2636
|
-
L:
|
|
2661
|
+
L: 492,
|
|
2637
2662
|
S: this,
|
|
2638
2663
|
C: (f, a) => f(...a)
|
|
2639
2664
|
});
|
|
@@ -2644,7 +2669,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2644
2669
|
open: this._lifecycleState === import_context7.LifecycleState.OPEN
|
|
2645
2670
|
}, {
|
|
2646
2671
|
F: __dxlog_file9,
|
|
2647
|
-
L:
|
|
2672
|
+
L: 495,
|
|
2648
2673
|
S: this,
|
|
2649
2674
|
C: (f, a) => f(...a)
|
|
2650
2675
|
});
|
|
@@ -2663,7 +2688,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2663
2688
|
space: space.key
|
|
2664
2689
|
}, {
|
|
2665
2690
|
F: __dxlog_file9,
|
|
2666
|
-
L:
|
|
2691
|
+
L: 503,
|
|
2667
2692
|
S: this,
|
|
2668
2693
|
C: (f, a) => f(...a)
|
|
2669
2694
|
});
|
|
@@ -2675,10 +2700,16 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2675
2700
|
edgeFeatures: this._edgeFeatures
|
|
2676
2701
|
});
|
|
2677
2702
|
dataSpace.postOpen.append(async () => {
|
|
2678
|
-
|
|
2703
|
+
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2704
|
+
if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2705
|
+
await this._echoEdgeReplicator?.connectToSpace(dataSpace.id);
|
|
2706
|
+
}
|
|
2679
2707
|
});
|
|
2680
2708
|
dataSpace.preClose.append(async () => {
|
|
2681
|
-
|
|
2709
|
+
const setting = dataSpace.getEdgeReplicationSetting();
|
|
2710
|
+
if (setting === import_metadata.EdgeReplicationSetting.ENABLED) {
|
|
2711
|
+
await this._echoEdgeReplicator?.disconnectFromSpace(dataSpace.id);
|
|
2712
|
+
}
|
|
2682
2713
|
});
|
|
2683
2714
|
presence.newPeer.on((peerState) => {
|
|
2684
2715
|
if (dataSpace.state === import_services6.SpaceState.SPACE_READY) {
|
|
@@ -2698,7 +2729,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2698
2729
|
space: space.key
|
|
2699
2730
|
}, {
|
|
2700
2731
|
F: __dxlog_file9,
|
|
2701
|
-
L:
|
|
2732
|
+
L: 541,
|
|
2702
2733
|
S: this,
|
|
2703
2734
|
C: (f, a) => f(...a)
|
|
2704
2735
|
});
|
|
@@ -2731,7 +2762,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2731
2762
|
closedSessions
|
|
2732
2763
|
}, {
|
|
2733
2764
|
F: __dxlog_file9,
|
|
2734
|
-
L:
|
|
2765
|
+
L: 567,
|
|
2735
2766
|
S: this,
|
|
2736
2767
|
C: (f, a) => f(...a)
|
|
2737
2768
|
});
|
|
@@ -2746,7 +2777,7 @@ var DataSpaceManager = class extends import_context7.Resource {
|
|
|
2746
2777
|
peerId: peerState.peerId
|
|
2747
2778
|
}, {
|
|
2748
2779
|
F: __dxlog_file9,
|
|
2749
|
-
L:
|
|
2780
|
+
L: 581,
|
|
2750
2781
|
S: this,
|
|
2751
2782
|
C: (f, a) => f(...a)
|
|
2752
2783
|
});
|
|
@@ -2819,7 +2850,7 @@ var SpacesServiceImpl = class {
|
|
|
2819
2850
|
await this._updateMetrics();
|
|
2820
2851
|
return this._serializeSpace(space);
|
|
2821
2852
|
}
|
|
2822
|
-
async updateSpace({ spaceKey, state }) {
|
|
2853
|
+
async updateSpace({ spaceKey, state, edgeReplication }) {
|
|
2823
2854
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
2824
2855
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug3.raise)(new import_protocols6.SpaceNotFoundError(spaceKey));
|
|
2825
2856
|
if (state) {
|
|
@@ -2834,6 +2865,9 @@ var SpacesServiceImpl = class {
|
|
|
2834
2865
|
throw new import_protocols6.ApiError("Invalid space state");
|
|
2835
2866
|
}
|
|
2836
2867
|
}
|
|
2868
|
+
if (edgeReplication !== void 0) {
|
|
2869
|
+
await dataSpaceManager.setSpaceEdgeReplicationSetting(spaceKey, edgeReplication);
|
|
2870
|
+
}
|
|
2837
2871
|
}
|
|
2838
2872
|
async updateMemberRole(request) {
|
|
2839
2873
|
const identity = this._requireIdentity();
|
|
@@ -2850,7 +2884,7 @@ var SpacesServiceImpl = class {
|
|
|
2850
2884
|
const credentials = await (0, import_credentials13.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
|
|
2851
2885
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2852
2886
|
F: __dxlog_file10,
|
|
2853
|
-
L:
|
|
2887
|
+
L: 106,
|
|
2854
2888
|
S: this,
|
|
2855
2889
|
A: [
|
|
2856
2890
|
"credentials[0].credential",
|
|
@@ -2860,7 +2894,7 @@ var SpacesServiceImpl = class {
|
|
|
2860
2894
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2861
2895
|
(0, import_invariant8.invariant)((0, import_credentials13.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2862
2896
|
F: __dxlog_file10,
|
|
2863
|
-
L:
|
|
2897
|
+
L: 108,
|
|
2864
2898
|
S: this,
|
|
2865
2899
|
A: [
|
|
2866
2900
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2878,7 +2912,7 @@ var SpacesServiceImpl = class {
|
|
|
2878
2912
|
ids: spaces.map((space) => space.id)
|
|
2879
2913
|
}), {
|
|
2880
2914
|
F: __dxlog_file10,
|
|
2881
|
-
L:
|
|
2915
|
+
L: 119,
|
|
2882
2916
|
S: this,
|
|
2883
2917
|
C: (f, a) => f(...a)
|
|
2884
2918
|
});
|
|
@@ -2970,7 +3004,7 @@ var SpacesServiceImpl = class {
|
|
|
2970
3004
|
} else {
|
|
2971
3005
|
(0, import_invariant8.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
2972
3006
|
F: __dxlog_file10,
|
|
2973
|
-
L:
|
|
3007
|
+
L: 217,
|
|
2974
3008
|
S: this,
|
|
2975
3009
|
A: [
|
|
2976
3010
|
"!credential.id",
|
|
@@ -2979,7 +3013,7 @@ var SpacesServiceImpl = class {
|
|
|
2979
3013
|
});
|
|
2980
3014
|
(0, import_invariant8.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
2981
3015
|
F: __dxlog_file10,
|
|
2982
|
-
L:
|
|
3016
|
+
L: 218,
|
|
2983
3017
|
S: this,
|
|
2984
3018
|
A: [
|
|
2985
3019
|
"this._identityManager.identity",
|
|
@@ -2989,7 +3023,7 @@ var SpacesServiceImpl = class {
|
|
|
2989
3023
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
2990
3024
|
(0, import_invariant8.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
2991
3025
|
F: __dxlog_file10,
|
|
2992
|
-
L:
|
|
3026
|
+
L: 220,
|
|
2993
3027
|
S: this,
|
|
2994
3028
|
A: [
|
|
2995
3029
|
"credential.issuer.equals(signer.getIssuer())",
|
|
@@ -3039,7 +3073,7 @@ var SpacesServiceImpl = class {
|
|
|
3039
3073
|
const assertion = (0, import_credentials13.getCredentialAssertion)(credential);
|
|
3040
3074
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
3041
3075
|
F: __dxlog_file10,
|
|
3042
|
-
L:
|
|
3076
|
+
L: 254,
|
|
3043
3077
|
S: this,
|
|
3044
3078
|
A: [
|
|
3045
3079
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3049,7 +3083,7 @@ var SpacesServiceImpl = class {
|
|
|
3049
3083
|
const myIdentity = this._identityManager.identity;
|
|
3050
3084
|
(0, import_invariant8.invariant)(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
|
|
3051
3085
|
F: __dxlog_file10,
|
|
3052
|
-
L:
|
|
3086
|
+
L: 256,
|
|
3053
3087
|
S: this,
|
|
3054
3088
|
A: [
|
|
3055
3089
|
"myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
|
|
@@ -3111,7 +3145,8 @@ var SpacesServiceImpl = class {
|
|
|
3111
3145
|
}),
|
|
3112
3146
|
creator: space.inner.spaceState.creator?.key,
|
|
3113
3147
|
cache: space.cache,
|
|
3114
|
-
metrics: space.metrics
|
|
3148
|
+
metrics: space.metrics,
|
|
3149
|
+
edgeReplication: space.getEdgeReplicationSetting()
|
|
3115
3150
|
};
|
|
3116
3151
|
}
|
|
3117
3152
|
_requireIdentity() {
|
|
@@ -4527,6 +4562,9 @@ var DataSpace = class {
|
|
|
4527
4562
|
});
|
|
4528
4563
|
this.stateUpdate.emit();
|
|
4529
4564
|
}
|
|
4565
|
+
getEdgeReplicationSetting() {
|
|
4566
|
+
return this._metadataStore.getSpaceEdgeReplicationSetting(this.key);
|
|
4567
|
+
}
|
|
4530
4568
|
};
|
|
4531
4569
|
_ts_decorate6([
|
|
4532
4570
|
import_tracing3.trace.info()
|
|
@@ -8101,4 +8139,4 @@ ClientServicesHost = _ts_decorate10([
|
|
|
8101
8139
|
subscribeToSpaces,
|
|
8102
8140
|
subscribeToSwarmInfo
|
|
8103
8141
|
});
|
|
8104
|
-
//# sourceMappingURL=chunk-
|
|
8142
|
+
//# sourceMappingURL=chunk-JU4QYYUL.cjs.map
|