@dxos/client-services 0.4.5-main.ec866f5 → 0.4.5-main.f10c180
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-BWQLRXYM.mjs → chunk-5W4FJWOL.mjs} +62 -26
- package/dist/lib/browser/chunk-5W4FJWOL.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-XW7ODPZC.cjs → chunk-KGR7HQTP.cjs} +164 -128
- package/dist/lib/node/chunk-KGR7HQTP.cjs.map +7 -0
- package/dist/lib/node/index.cjs +37 -37
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +8 -8
- package/dist/types/src/packlets/identity/identity-manager.d.ts +3 -1
- package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/devices/devices-service.test.ts +12 -1
- package/src/packlets/devices/devices-service.ts +1 -1
- package/src/packlets/identity/identity-manager.test.ts +19 -0
- package/src/packlets/identity/identity-manager.ts +27 -1
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-BWQLRXYM.mjs.map +0 -7
- package/dist/lib/node/chunk-XW7ODPZC.cjs.map +0 -7
|
@@ -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_KGR7HQTP_exports = {};
|
|
30
|
+
__export(chunk_KGR7HQTP_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -60,7 +60,7 @@ __export(chunk_XW7ODPZC_exports, {
|
|
|
60
60
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
61
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
62
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
63
|
+
module.exports = __toCommonJS(chunk_KGR7HQTP_exports);
|
|
64
64
|
var import_async = require("@dxos/async");
|
|
65
65
|
var import_codec_protobuf = require("@dxos/codec-protobuf");
|
|
66
66
|
var import_feed_store = require("@dxos/feed-store");
|
|
@@ -99,6 +99,7 @@ var import_invariant2 = require("@dxos/invariant");
|
|
|
99
99
|
var import_keys4 = require("@dxos/keys");
|
|
100
100
|
var import_log3 = require("@dxos/log");
|
|
101
101
|
var import_protocols2 = require("@dxos/protocols");
|
|
102
|
+
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
102
103
|
var import_credentials5 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
103
104
|
var import_timeframe = require("@dxos/timeframe");
|
|
104
105
|
var import_tracing2 = require("@dxos/tracing");
|
|
@@ -109,7 +110,7 @@ var import_debug2 = require("@dxos/debug");
|
|
|
109
110
|
var import_invariant3 = require("@dxos/invariant");
|
|
110
111
|
var import_invariant4 = require("@dxos/invariant");
|
|
111
112
|
var import_protocols3 = require("@dxos/protocols");
|
|
112
|
-
var
|
|
113
|
+
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
113
114
|
var import_async7 = require("@dxos/async");
|
|
114
115
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
115
116
|
var import_context4 = require("@dxos/context");
|
|
@@ -119,7 +120,7 @@ var import_keys5 = require("@dxos/keys");
|
|
|
119
120
|
var import_log4 = require("@dxos/log");
|
|
120
121
|
var import_network_manager = require("@dxos/network-manager");
|
|
121
122
|
var import_protocols4 = require("@dxos/protocols");
|
|
122
|
-
var
|
|
123
|
+
var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
123
124
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
124
125
|
var import_async8 = require("@dxos/async");
|
|
125
126
|
var import_context5 = require("@dxos/context");
|
|
@@ -127,20 +128,20 @@ var import_invariant6 = require("@dxos/invariant");
|
|
|
127
128
|
var import_keys6 = require("@dxos/keys");
|
|
128
129
|
var import_log5 = require("@dxos/log");
|
|
129
130
|
var import_protocols5 = require("@dxos/protocols");
|
|
130
|
-
var
|
|
131
|
+
var import_services4 = require("@dxos/protocols/proto/dxos/client/services");
|
|
131
132
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
132
133
|
var import_teleport = require("@dxos/teleport");
|
|
133
134
|
var import_async9 = require("@dxos/async");
|
|
134
135
|
var import_codec_protobuf8 = require("@dxos/codec-protobuf");
|
|
135
136
|
var import_invariant7 = require("@dxos/invariant");
|
|
136
137
|
var import_log6 = require("@dxos/log");
|
|
137
|
-
var
|
|
138
|
+
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
138
139
|
var import_credentials8 = require("@dxos/credentials");
|
|
139
140
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
140
141
|
var import_invariant8 = require("@dxos/invariant");
|
|
141
142
|
var import_log7 = require("@dxos/log");
|
|
142
143
|
var import_protocols6 = require("@dxos/protocols");
|
|
143
|
-
var
|
|
144
|
+
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
144
145
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
145
146
|
var import_debug3 = require("@dxos/debug");
|
|
146
147
|
var import_rpc = require("@dxos/rpc");
|
|
@@ -152,9 +153,9 @@ var import_echo_db = require("@dxos/echo-db");
|
|
|
152
153
|
var import_invariant9 = require("@dxos/invariant");
|
|
153
154
|
var import_log8 = require("@dxos/log");
|
|
154
155
|
var import_protocols7 = require("@dxos/protocols");
|
|
155
|
-
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
156
|
-
var import_tracing4 = require("@dxos/tracing");
|
|
157
156
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
157
|
+
var import_tracing4 = require("@dxos/tracing");
|
|
158
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
158
159
|
var import_async10 = require("@dxos/async");
|
|
159
160
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
160
161
|
var import_context6 = require("@dxos/context");
|
|
@@ -164,7 +165,7 @@ var import_invariant10 = require("@dxos/invariant");
|
|
|
164
165
|
var import_keys7 = require("@dxos/keys");
|
|
165
166
|
var import_log9 = require("@dxos/log");
|
|
166
167
|
var import_protocols8 = require("@dxos/protocols");
|
|
167
|
-
var
|
|
168
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
168
169
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
169
170
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
170
171
|
var import_tracing5 = require("@dxos/tracing");
|
|
@@ -185,7 +186,7 @@ var import_invariant12 = require("@dxos/invariant");
|
|
|
185
186
|
var import_keys9 = require("@dxos/keys");
|
|
186
187
|
var import_log11 = require("@dxos/log");
|
|
187
188
|
var import_protocols10 = require("@dxos/protocols");
|
|
188
|
-
var
|
|
189
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
189
190
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
190
191
|
var import_util6 = require("@dxos/util");
|
|
191
192
|
var import_credentials13 = require("@dxos/credentials");
|
|
@@ -198,7 +199,7 @@ var import_debug6 = require("@dxos/debug");
|
|
|
198
199
|
var import_invariant13 = require("@dxos/invariant");
|
|
199
200
|
var import_log12 = require("@dxos/log");
|
|
200
201
|
var import_protocols11 = require("@dxos/protocols");
|
|
201
|
-
var
|
|
202
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
202
203
|
var import_async14 = require("@dxos/async");
|
|
203
204
|
var import_context9 = require("@dxos/context");
|
|
204
205
|
var import_credentials15 = require("@dxos/credentials");
|
|
@@ -210,7 +211,7 @@ var import_keyring = require("@dxos/keyring");
|
|
|
210
211
|
var import_keys10 = require("@dxos/keys");
|
|
211
212
|
var import_log13 = require("@dxos/log");
|
|
212
213
|
var import_protocols12 = require("@dxos/protocols");
|
|
213
|
-
var
|
|
214
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
214
215
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
215
216
|
var import_tracing6 = require("@dxos/tracing");
|
|
216
217
|
var import_util7 = require("@dxos/util");
|
|
@@ -235,22 +236,22 @@ var import_messaging = require("@dxos/messaging");
|
|
|
235
236
|
var import_model_factory = require("@dxos/model-factory");
|
|
236
237
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
237
238
|
var import_protocols14 = require("@dxos/protocols");
|
|
238
|
-
var
|
|
239
|
+
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
239
240
|
var import_text_model = require("@dxos/text-model");
|
|
240
241
|
var import_tracing7 = require("@dxos/tracing");
|
|
241
242
|
var import_util9 = require("@dxos/util");
|
|
242
243
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
243
244
|
var import_async16 = require("@dxos/async");
|
|
244
245
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
245
|
-
var
|
|
246
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
246
247
|
var import_async17 = require("@dxos/async");
|
|
247
248
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
248
249
|
var import_log16 = require("@dxos/log");
|
|
249
|
-
var
|
|
250
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
250
251
|
var import_util10 = require("@dxos/util");
|
|
251
252
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
252
253
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
253
|
-
var
|
|
254
|
+
var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
|
|
254
255
|
var import_util11 = require("@dxos/util");
|
|
255
256
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
256
257
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
@@ -868,7 +869,7 @@ var IdentityManager = class {
|
|
|
868
869
|
id: traceId
|
|
869
870
|
}), {
|
|
870
871
|
F: __dxlog_file3,
|
|
871
|
-
L:
|
|
872
|
+
L: 80,
|
|
872
873
|
S: this,
|
|
873
874
|
C: (f, a) => f(...a)
|
|
874
875
|
});
|
|
@@ -877,7 +878,7 @@ var IdentityManager = class {
|
|
|
877
878
|
identityRecord
|
|
878
879
|
}, {
|
|
879
880
|
F: __dxlog_file3,
|
|
880
|
-
L:
|
|
881
|
+
L: 83,
|
|
881
882
|
S: this,
|
|
882
883
|
C: (f, a) => f(...a)
|
|
883
884
|
});
|
|
@@ -890,7 +891,7 @@ var IdentityManager = class {
|
|
|
890
891
|
displayName: this._identity.profileDocument?.displayName
|
|
891
892
|
}, {
|
|
892
893
|
F: __dxlog_file3,
|
|
893
|
-
L:
|
|
894
|
+
L: 88,
|
|
894
895
|
S: this,
|
|
895
896
|
C: (f, a) => f(...a)
|
|
896
897
|
});
|
|
@@ -900,7 +901,7 @@ var IdentityManager = class {
|
|
|
900
901
|
id: traceId
|
|
901
902
|
}), {
|
|
902
903
|
F: __dxlog_file3,
|
|
903
|
-
L:
|
|
904
|
+
L: 94,
|
|
904
905
|
S: this,
|
|
905
906
|
C: (f, a) => f(...a)
|
|
906
907
|
});
|
|
@@ -911,7 +912,7 @@ var IdentityManager = class {
|
|
|
911
912
|
async createIdentity({ displayName } = {}) {
|
|
912
913
|
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
913
914
|
F: __dxlog_file3,
|
|
914
|
-
L:
|
|
915
|
+
L: 102,
|
|
915
916
|
S: this,
|
|
916
917
|
A: [
|
|
917
918
|
"!this._identity",
|
|
@@ -920,7 +921,7 @@ var IdentityManager = class {
|
|
|
920
921
|
});
|
|
921
922
|
(0, import_log3.log)("creating identity...", void 0, {
|
|
922
923
|
F: __dxlog_file3,
|
|
923
|
-
L:
|
|
924
|
+
L: 103,
|
|
924
925
|
S: this,
|
|
925
926
|
C: (f, a) => f(...a)
|
|
926
927
|
});
|
|
@@ -941,7 +942,7 @@ var IdentityManager = class {
|
|
|
941
942
|
const generator = new import_credentials4.CredentialGenerator(this._keyring, identityRecord.identityKey, identityRecord.deviceKey);
|
|
942
943
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.genesisFeedKey, "Genesis feed key is required.", {
|
|
943
944
|
F: __dxlog_file3,
|
|
944
|
-
L:
|
|
945
|
+
L: 122,
|
|
945
946
|
S: this,
|
|
946
947
|
A: [
|
|
947
948
|
"identityRecord.haloSpace.genesisFeedKey",
|
|
@@ -950,7 +951,7 @@ var IdentityManager = class {
|
|
|
950
951
|
});
|
|
951
952
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, "Data feed key is required.", {
|
|
952
953
|
F: __dxlog_file3,
|
|
953
|
-
L:
|
|
954
|
+
L: 123,
|
|
954
955
|
S: this,
|
|
955
956
|
A: [
|
|
956
957
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -992,7 +993,7 @@ var IdentityManager = class {
|
|
|
992
993
|
displayName: this._identity.profileDocument?.displayName
|
|
993
994
|
}, {
|
|
994
995
|
F: __dxlog_file3,
|
|
995
|
-
L:
|
|
996
|
+
L: 168,
|
|
996
997
|
S: this,
|
|
997
998
|
C: (f, a) => f(...a)
|
|
998
999
|
});
|
|
@@ -1002,7 +1003,7 @@ var IdentityManager = class {
|
|
|
1002
1003
|
deviceKey: identity.deviceKey
|
|
1003
1004
|
}, {
|
|
1004
1005
|
F: __dxlog_file3,
|
|
1005
|
-
L:
|
|
1006
|
+
L: 174,
|
|
1006
1007
|
S: this,
|
|
1007
1008
|
C: (f, a) => f(...a)
|
|
1008
1009
|
});
|
|
@@ -1016,13 +1017,13 @@ var IdentityManager = class {
|
|
|
1016
1017
|
params
|
|
1017
1018
|
}, {
|
|
1018
1019
|
F: __dxlog_file3,
|
|
1019
|
-
L:
|
|
1020
|
+
L: 182,
|
|
1020
1021
|
S: this,
|
|
1021
1022
|
C: (f, a) => f(...a)
|
|
1022
1023
|
});
|
|
1023
1024
|
(0, import_invariant2.invariant)(!this._identity, "Identity already exists.", {
|
|
1024
1025
|
F: __dxlog_file3,
|
|
1025
|
-
L:
|
|
1026
|
+
L: 183,
|
|
1026
1027
|
S: this,
|
|
1027
1028
|
A: [
|
|
1028
1029
|
"!this._identity",
|
|
@@ -1050,7 +1051,7 @@ var IdentityManager = class {
|
|
|
1050
1051
|
displayName: this._identity.profileDocument?.displayName
|
|
1051
1052
|
}, {
|
|
1052
1053
|
F: __dxlog_file3,
|
|
1053
|
-
L:
|
|
1054
|
+
L: 202,
|
|
1054
1055
|
S: this,
|
|
1055
1056
|
C: (f, a) => f(...a)
|
|
1056
1057
|
});
|
|
@@ -1060,7 +1061,7 @@ var IdentityManager = class {
|
|
|
1060
1061
|
deviceKey: identity.deviceKey
|
|
1061
1062
|
}, {
|
|
1062
1063
|
F: __dxlog_file3,
|
|
1063
|
-
L:
|
|
1064
|
+
L: 208,
|
|
1064
1065
|
S: this,
|
|
1065
1066
|
C: (f, a) => f(...a)
|
|
1066
1067
|
});
|
|
@@ -1072,7 +1073,7 @@ var IdentityManager = class {
|
|
|
1072
1073
|
async updateProfile(profile) {
|
|
1073
1074
|
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
1074
1075
|
F: __dxlog_file3,
|
|
1075
|
-
L:
|
|
1076
|
+
L: 216,
|
|
1076
1077
|
S: this,
|
|
1077
1078
|
A: [
|
|
1078
1079
|
"this._identity",
|
|
@@ -1100,10 +1101,45 @@ var IdentityManager = class {
|
|
|
1100
1101
|
this.stateUpdate.emit();
|
|
1101
1102
|
return profile;
|
|
1102
1103
|
}
|
|
1104
|
+
async updateDeviceProfile(profile) {
|
|
1105
|
+
(0, import_invariant2.invariant)(this._identity, "Identity not initialized.", {
|
|
1106
|
+
F: __dxlog_file3,
|
|
1107
|
+
L: 233,
|
|
1108
|
+
S: this,
|
|
1109
|
+
A: [
|
|
1110
|
+
"this._identity",
|
|
1111
|
+
"'Identity not initialized.'"
|
|
1112
|
+
]
|
|
1113
|
+
});
|
|
1114
|
+
const credential = await this._identity.getIdentityCredentialSigner().createCredential({
|
|
1115
|
+
subject: this._identity.deviceKey,
|
|
1116
|
+
assertion: {
|
|
1117
|
+
"@type": "dxos.halo.credentials.DeviceProfile",
|
|
1118
|
+
profile
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
const receipt = await this._identity.controlPipeline.writer.write({
|
|
1122
|
+
credential: {
|
|
1123
|
+
credential
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
await this._identity.controlPipeline.state.waitUntilTimeframe(new import_timeframe.Timeframe([
|
|
1127
|
+
[
|
|
1128
|
+
receipt.feedKey,
|
|
1129
|
+
receipt.seq
|
|
1130
|
+
]
|
|
1131
|
+
]));
|
|
1132
|
+
this.stateUpdate.emit();
|
|
1133
|
+
return {
|
|
1134
|
+
deviceKey: this._identity.deviceKey,
|
|
1135
|
+
kind: import_services.DeviceKind.CURRENT,
|
|
1136
|
+
profile
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1103
1139
|
async _constructIdentity(identityRecord) {
|
|
1104
1140
|
(0, import_invariant2.invariant)(!this._identity, void 0, {
|
|
1105
1141
|
F: __dxlog_file3,
|
|
1106
|
-
L:
|
|
1142
|
+
L: 254,
|
|
1107
1143
|
S: this,
|
|
1108
1144
|
A: [
|
|
1109
1145
|
"!this._identity",
|
|
@@ -1114,13 +1150,13 @@ var IdentityManager = class {
|
|
|
1114
1150
|
identityRecord
|
|
1115
1151
|
}, {
|
|
1116
1152
|
F: __dxlog_file3,
|
|
1117
|
-
L:
|
|
1153
|
+
L: 255,
|
|
1118
1154
|
S: this,
|
|
1119
1155
|
C: (f, a) => f(...a)
|
|
1120
1156
|
});
|
|
1121
1157
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.controlFeedKey, void 0, {
|
|
1122
1158
|
F: __dxlog_file3,
|
|
1123
|
-
L:
|
|
1159
|
+
L: 258,
|
|
1124
1160
|
S: this,
|
|
1125
1161
|
A: [
|
|
1126
1162
|
"identityRecord.haloSpace.controlFeedKey",
|
|
@@ -1132,7 +1168,7 @@ var IdentityManager = class {
|
|
|
1132
1168
|
});
|
|
1133
1169
|
(0, import_invariant2.invariant)(identityRecord.haloSpace.dataFeedKey, void 0, {
|
|
1134
1170
|
F: __dxlog_file3,
|
|
1135
|
-
L:
|
|
1171
|
+
L: 262,
|
|
1136
1172
|
S: this,
|
|
1137
1173
|
A: [
|
|
1138
1174
|
"identityRecord.haloSpace.dataFeedKey",
|
|
@@ -1164,7 +1200,7 @@ var IdentityManager = class {
|
|
|
1164
1200
|
identityKey: identityRecord.identityKey
|
|
1165
1201
|
}, {
|
|
1166
1202
|
F: __dxlog_file3,
|
|
1167
|
-
L:
|
|
1203
|
+
L: 286,
|
|
1168
1204
|
S: this,
|
|
1169
1205
|
C: (f, a) => f(...a)
|
|
1170
1206
|
});
|
|
@@ -1185,7 +1221,7 @@ var IdentityManager = class {
|
|
|
1185
1221
|
onAuthFailure: () => {
|
|
1186
1222
|
import_log3.log.warn("auth failure", void 0, {
|
|
1187
1223
|
F: __dxlog_file3,
|
|
1188
|
-
L:
|
|
1224
|
+
L: 305,
|
|
1189
1225
|
S: this,
|
|
1190
1226
|
C: (f, a) => f(...a)
|
|
1191
1227
|
});
|
|
@@ -1281,7 +1317,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1281
1317
|
}
|
|
1282
1318
|
getInvitationContext() {
|
|
1283
1319
|
return {
|
|
1284
|
-
kind:
|
|
1320
|
+
kind: import_services2.Invitation.Kind.DEVICE
|
|
1285
1321
|
};
|
|
1286
1322
|
}
|
|
1287
1323
|
async admit(request) {
|
|
@@ -1427,7 +1463,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1427
1463
|
});
|
|
1428
1464
|
this._callbacks.onError(new Error("Invitation not found."));
|
|
1429
1465
|
return {
|
|
1430
|
-
authMethod:
|
|
1466
|
+
authMethod: import_services4.Invitation.AuthMethod.NONE
|
|
1431
1467
|
};
|
|
1432
1468
|
}
|
|
1433
1469
|
this.invitation = invitation;
|
|
@@ -1442,7 +1478,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1442
1478
|
this.guestProfile = profile;
|
|
1443
1479
|
this._callbacks.onStateUpdate({
|
|
1444
1480
|
...this.invitation,
|
|
1445
|
-
state:
|
|
1481
|
+
state: import_services4.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1446
1482
|
});
|
|
1447
1483
|
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.end({
|
|
1448
1484
|
id: traceId
|
|
@@ -1485,7 +1521,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1485
1521
|
]
|
|
1486
1522
|
});
|
|
1487
1523
|
switch (this.invitation.authMethod) {
|
|
1488
|
-
case
|
|
1524
|
+
case import_services4.Invitation.AuthMethod.NONE: {
|
|
1489
1525
|
(0, import_log5.log)("authentication not required", void 0, {
|
|
1490
1526
|
F: __dxlog_file6,
|
|
1491
1527
|
L: 131,
|
|
@@ -1496,7 +1532,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1496
1532
|
status: import_invitations2.AuthenticationResponse.Status.OK
|
|
1497
1533
|
};
|
|
1498
1534
|
}
|
|
1499
|
-
case
|
|
1535
|
+
case import_services4.Invitation.AuthMethod.SHARED_SECRET: {
|
|
1500
1536
|
if (this.invitation.authCode) {
|
|
1501
1537
|
if (this.authenticationRetry++ > MAX_OTP_ATTEMPTS) {
|
|
1502
1538
|
status = import_invitations2.AuthenticationResponse.Status.INVALID_OPT_ATTEMPTS;
|
|
@@ -1691,7 +1727,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1691
1727
|
await this._ctx.dispose();
|
|
1692
1728
|
}
|
|
1693
1729
|
};
|
|
1694
|
-
var isAuthenticationRequired = (invitation) => invitation.authMethod !==
|
|
1730
|
+
var isAuthenticationRequired = (invitation) => invitation.authMethod !== import_services4.Invitation.AuthMethod.NONE;
|
|
1695
1731
|
var __dxlog_file7 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts";
|
|
1696
1732
|
var InvitationsHandler = class {
|
|
1697
1733
|
/**
|
|
@@ -1701,8 +1737,8 @@ var InvitationsHandler = class {
|
|
|
1701
1737
|
this._networkManager = _networkManager;
|
|
1702
1738
|
}
|
|
1703
1739
|
createInvitation(protocol, options) {
|
|
1704
|
-
const { invitationId = import_keys5.PublicKey.random().toHex(), type =
|
|
1705
|
-
const authCode = options?.authCode ?? (authMethod ===
|
|
1740
|
+
const { invitationId = import_keys5.PublicKey.random().toHex(), type = import_services3.Invitation.Type.INTERACTIVE, authMethod = import_services3.Invitation.AuthMethod.SHARED_SECRET, state = import_services3.Invitation.State.INIT, timeout = import_client_protocol2.INVITATION_TIMEOUT, swarmKey = import_keys5.PublicKey.random() } = options ?? {};
|
|
1741
|
+
const authCode = options?.authCode ?? (authMethod === import_services3.Invitation.AuthMethod.SHARED_SECRET ? (0, import_credentials7.generatePasscode)(import_client_protocol2.AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1706
1742
|
(0, import_invariant5.invariant)(protocol, void 0, {
|
|
1707
1743
|
F: __dxlog_file7,
|
|
1708
1744
|
L: 80,
|
|
@@ -1745,7 +1781,7 @@ var InvitationsHandler = class {
|
|
|
1745
1781
|
onStateUpdate: (invitation2) => {
|
|
1746
1782
|
stream.next({
|
|
1747
1783
|
...invitation2,
|
|
1748
|
-
state:
|
|
1784
|
+
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1749
1785
|
});
|
|
1750
1786
|
},
|
|
1751
1787
|
resolveInvitation: async ({ invitationId: invitationId2 }) => {
|
|
@@ -1796,7 +1832,7 @@ var InvitationsHandler = class {
|
|
|
1796
1832
|
});
|
|
1797
1833
|
stream.next({
|
|
1798
1834
|
...invitation,
|
|
1799
|
-
state:
|
|
1835
|
+
state: import_services3.Invitation.State.CONNECTED
|
|
1800
1836
|
});
|
|
1801
1837
|
const deviceKey = await extension.completedTrigger.wait({
|
|
1802
1838
|
timeout
|
|
@@ -1812,7 +1848,7 @@ var InvitationsHandler = class {
|
|
|
1812
1848
|
});
|
|
1813
1849
|
stream.next({
|
|
1814
1850
|
...invitation,
|
|
1815
|
-
state:
|
|
1851
|
+
state: import_services3.Invitation.State.SUCCESS
|
|
1816
1852
|
});
|
|
1817
1853
|
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
1818
1854
|
id: traceId
|
|
@@ -1834,7 +1870,7 @@ var InvitationsHandler = class {
|
|
|
1834
1870
|
});
|
|
1835
1871
|
stream.next({
|
|
1836
1872
|
...invitation,
|
|
1837
|
-
state:
|
|
1873
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
1838
1874
|
});
|
|
1839
1875
|
} else {
|
|
1840
1876
|
import_log4.log.error("failed", err, {
|
|
@@ -1855,7 +1891,7 @@ var InvitationsHandler = class {
|
|
|
1855
1891
|
C: (f, a) => f(...a)
|
|
1856
1892
|
});
|
|
1857
1893
|
} finally {
|
|
1858
|
-
if (type !==
|
|
1894
|
+
if (type !== import_services3.Invitation.Type.MULTIUSE) {
|
|
1859
1895
|
await swarmConnection.close();
|
|
1860
1896
|
await ctx.dispose();
|
|
1861
1897
|
}
|
|
@@ -1877,7 +1913,7 @@ var InvitationsHandler = class {
|
|
|
1877
1913
|
});
|
|
1878
1914
|
stream.next({
|
|
1879
1915
|
...invitation,
|
|
1880
|
-
state:
|
|
1916
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
1881
1917
|
});
|
|
1882
1918
|
} else {
|
|
1883
1919
|
import_log4.log.error("failed", err, {
|
|
@@ -1907,7 +1943,7 @@ var InvitationsHandler = class {
|
|
|
1907
1943
|
ctx.onDispose(() => swarmConnection.close());
|
|
1908
1944
|
stream.next({
|
|
1909
1945
|
...invitation,
|
|
1910
|
-
state:
|
|
1946
|
+
state: import_services3.Invitation.State.CONNECTING
|
|
1911
1947
|
});
|
|
1912
1948
|
});
|
|
1913
1949
|
const observable = new import_client_protocol2.CancellableInvitation({
|
|
@@ -1916,7 +1952,7 @@ var InvitationsHandler = class {
|
|
|
1916
1952
|
onCancel: async () => {
|
|
1917
1953
|
stream.next({
|
|
1918
1954
|
...invitation,
|
|
1919
|
-
state:
|
|
1955
|
+
state: import_services3.Invitation.State.CANCELLED
|
|
1920
1956
|
});
|
|
1921
1957
|
await ctx.dispose();
|
|
1922
1958
|
}
|
|
@@ -1966,7 +2002,7 @@ var InvitationsHandler = class {
|
|
|
1966
2002
|
C: (f, a) => f(...a)
|
|
1967
2003
|
});
|
|
1968
2004
|
setState({
|
|
1969
|
-
state:
|
|
2005
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
1970
2006
|
});
|
|
1971
2007
|
} else {
|
|
1972
2008
|
import_log4.log.warn("auth failed", err, {
|
|
@@ -2032,7 +2068,7 @@ var InvitationsHandler = class {
|
|
|
2032
2068
|
C: (f, a) => f(...a)
|
|
2033
2069
|
});
|
|
2034
2070
|
setState({
|
|
2035
|
-
state:
|
|
2071
|
+
state: import_services3.Invitation.State.CONNECTED
|
|
2036
2072
|
});
|
|
2037
2073
|
(0, import_log4.log)("introduce", {
|
|
2038
2074
|
...protocol.toJSON()
|
|
@@ -2062,7 +2098,7 @@ var InvitationsHandler = class {
|
|
|
2062
2098
|
C: (f, a) => f(...a)
|
|
2063
2099
|
});
|
|
2064
2100
|
setState({
|
|
2065
|
-
state:
|
|
2101
|
+
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2066
2102
|
});
|
|
2067
2103
|
const authCode = await authenticated.wait({
|
|
2068
2104
|
timeout
|
|
@@ -2074,7 +2110,7 @@ var InvitationsHandler = class {
|
|
|
2074
2110
|
C: (f, a) => f(...a)
|
|
2075
2111
|
});
|
|
2076
2112
|
setState({
|
|
2077
|
-
state:
|
|
2113
|
+
state: import_services3.Invitation.State.AUTHENTICATING
|
|
2078
2114
|
});
|
|
2079
2115
|
const response = await extension.rpc.InvitationHostService.authenticate({
|
|
2080
2116
|
authCode
|
|
@@ -2122,7 +2158,7 @@ var InvitationsHandler = class {
|
|
|
2122
2158
|
setState({
|
|
2123
2159
|
...result,
|
|
2124
2160
|
target: invitation.target,
|
|
2125
|
-
state:
|
|
2161
|
+
state: import_services3.Invitation.State.SUCCESS
|
|
2126
2162
|
});
|
|
2127
2163
|
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
2128
2164
|
id: traceId
|
|
@@ -2143,7 +2179,7 @@ var InvitationsHandler = class {
|
|
|
2143
2179
|
C: (f, a) => f(...a)
|
|
2144
2180
|
});
|
|
2145
2181
|
setState({
|
|
2146
|
-
state:
|
|
2182
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
2147
2183
|
});
|
|
2148
2184
|
} else {
|
|
2149
2185
|
(0, import_log4.log)("auth failed", err, {
|
|
@@ -2182,7 +2218,7 @@ var InvitationsHandler = class {
|
|
|
2182
2218
|
C: (f, a) => f(...a)
|
|
2183
2219
|
});
|
|
2184
2220
|
setState({
|
|
2185
|
-
state:
|
|
2221
|
+
state: import_services3.Invitation.State.TIMEOUT
|
|
2186
2222
|
});
|
|
2187
2223
|
} else {
|
|
2188
2224
|
(0, import_log4.log)("auth failed", err, {
|
|
@@ -2223,7 +2259,7 @@ var InvitationsHandler = class {
|
|
|
2223
2259
|
});
|
|
2224
2260
|
ctx.onDispose(() => swarmConnection.close());
|
|
2225
2261
|
setState({
|
|
2226
|
-
state:
|
|
2262
|
+
state: import_services3.Invitation.State.CONNECTING
|
|
2227
2263
|
});
|
|
2228
2264
|
}
|
|
2229
2265
|
});
|
|
@@ -2232,7 +2268,7 @@ var InvitationsHandler = class {
|
|
|
2232
2268
|
subscriber: stream.observable,
|
|
2233
2269
|
onCancel: async () => {
|
|
2234
2270
|
setState({
|
|
2235
|
-
state:
|
|
2271
|
+
state: import_services3.Invitation.State.CANCELLED
|
|
2236
2272
|
});
|
|
2237
2273
|
await ctx.dispose();
|
|
2238
2274
|
},
|
|
@@ -2278,7 +2314,7 @@ var InvitationsServiceImpl = class {
|
|
|
2278
2314
|
}, () => {
|
|
2279
2315
|
close();
|
|
2280
2316
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
2281
|
-
if (invitation.get().type !==
|
|
2317
|
+
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2282
2318
|
this._removedCreated.emit(invitation.get());
|
|
2283
2319
|
}
|
|
2284
2320
|
});
|
|
@@ -2303,7 +2339,7 @@ var InvitationsServiceImpl = class {
|
|
|
2303
2339
|
}, () => {
|
|
2304
2340
|
close();
|
|
2305
2341
|
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2306
|
-
if (invitation.get().type !==
|
|
2342
|
+
if (invitation.get().type !== import_services5.Invitation.Type.MULTIUSE) {
|
|
2307
2343
|
this._removedAccepted.emit(invitation.get());
|
|
2308
2344
|
}
|
|
2309
2345
|
});
|
|
@@ -2371,8 +2407,8 @@ var InvitationsServiceImpl = class {
|
|
|
2371
2407
|
return new import_codec_protobuf8.Stream(({ next, ctx }) => {
|
|
2372
2408
|
this._invitationCreated.on(ctx, (invitation) => {
|
|
2373
2409
|
next({
|
|
2374
|
-
action:
|
|
2375
|
-
type:
|
|
2410
|
+
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2411
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2376
2412
|
invitations: [
|
|
2377
2413
|
invitation
|
|
2378
2414
|
]
|
|
@@ -2380,8 +2416,8 @@ var InvitationsServiceImpl = class {
|
|
|
2380
2416
|
});
|
|
2381
2417
|
this._invitationAccepted.on(ctx, (invitation) => {
|
|
2382
2418
|
next({
|
|
2383
|
-
action:
|
|
2384
|
-
type:
|
|
2419
|
+
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2420
|
+
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2385
2421
|
invitations: [
|
|
2386
2422
|
invitation
|
|
2387
2423
|
]
|
|
@@ -2389,8 +2425,8 @@ var InvitationsServiceImpl = class {
|
|
|
2389
2425
|
});
|
|
2390
2426
|
this._removedCreated.on(ctx, (invitation) => {
|
|
2391
2427
|
next({
|
|
2392
|
-
action:
|
|
2393
|
-
type:
|
|
2428
|
+
action: import_services5.QueryInvitationsResponse.Action.REMOVED,
|
|
2429
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2394
2430
|
invitations: [
|
|
2395
2431
|
invitation
|
|
2396
2432
|
]
|
|
@@ -2398,21 +2434,21 @@ var InvitationsServiceImpl = class {
|
|
|
2398
2434
|
});
|
|
2399
2435
|
this._removedAccepted.on(ctx, (invitation) => {
|
|
2400
2436
|
next({
|
|
2401
|
-
action:
|
|
2402
|
-
type:
|
|
2437
|
+
action: import_services5.QueryInvitationsResponse.Action.REMOVED,
|
|
2438
|
+
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2403
2439
|
invitations: [
|
|
2404
2440
|
invitation
|
|
2405
2441
|
]
|
|
2406
2442
|
});
|
|
2407
2443
|
});
|
|
2408
2444
|
next({
|
|
2409
|
-
action:
|
|
2410
|
-
type:
|
|
2445
|
+
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2446
|
+
type: import_services5.QueryInvitationsResponse.Type.CREATED,
|
|
2411
2447
|
invitations: Array.from(this._createInvitations.values()).map((invitation) => invitation.get())
|
|
2412
2448
|
});
|
|
2413
2449
|
next({
|
|
2414
|
-
action:
|
|
2415
|
-
type:
|
|
2450
|
+
action: import_services5.QueryInvitationsResponse.Action.ADDED,
|
|
2451
|
+
type: import_services5.QueryInvitationsResponse.Type.ACCEPTED,
|
|
2416
2452
|
invitations: Array.from(this._acceptInvitations.values()).map((invitation) => invitation.get())
|
|
2417
2453
|
});
|
|
2418
2454
|
});
|
|
@@ -2434,7 +2470,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2434
2470
|
}
|
|
2435
2471
|
getInvitationContext() {
|
|
2436
2472
|
return {
|
|
2437
|
-
kind:
|
|
2473
|
+
kind: import_services6.Invitation.Kind.SPACE,
|
|
2438
2474
|
spaceKey: this._spaceKey
|
|
2439
2475
|
};
|
|
2440
2476
|
}
|
|
@@ -2653,20 +2689,20 @@ var getPlatform = () => {
|
|
|
2653
2689
|
if (typeof window !== "undefined") {
|
|
2654
2690
|
const { userAgent } = window.navigator;
|
|
2655
2691
|
return {
|
|
2656
|
-
type:
|
|
2692
|
+
type: import_services8.Platform.PLATFORM_TYPE.BROWSER,
|
|
2657
2693
|
userAgent,
|
|
2658
2694
|
uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
|
|
2659
2695
|
};
|
|
2660
2696
|
} else {
|
|
2661
2697
|
return {
|
|
2662
|
-
type:
|
|
2698
|
+
type: import_services8.Platform.PLATFORM_TYPE.SHARED_WORKER,
|
|
2663
2699
|
uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
|
|
2664
2700
|
};
|
|
2665
2701
|
}
|
|
2666
2702
|
} else {
|
|
2667
2703
|
const { platform: platform2, version, arch } = process;
|
|
2668
2704
|
return {
|
|
2669
|
-
type:
|
|
2705
|
+
type: import_services8.Platform.PLATFORM_TYPE.NODE,
|
|
2670
2706
|
platform: platform2,
|
|
2671
2707
|
arch,
|
|
2672
2708
|
runtime: version,
|
|
@@ -2675,7 +2711,7 @@ var getPlatform = () => {
|
|
|
2675
2711
|
};
|
|
2676
2712
|
}
|
|
2677
2713
|
};
|
|
2678
|
-
var DXOS_VERSION = "0.4.5-main.
|
|
2714
|
+
var DXOS_VERSION = "0.4.5-main.f10c180";
|
|
2679
2715
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2680
2716
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2681
2717
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -2781,7 +2817,7 @@ var getSpaceStats = async (space) => {
|
|
|
2781
2817
|
displayName: member.assertion.profile?.displayName
|
|
2782
2818
|
}
|
|
2783
2819
|
},
|
|
2784
|
-
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ?
|
|
2820
|
+
presence: space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services7.SpaceMember.PresenceState.ONLINE : import_services7.SpaceMember.PresenceState.OFFLINE
|
|
2785
2821
|
})),
|
|
2786
2822
|
pipeline: {
|
|
2787
2823
|
// TODO(burdon): Pick properties from credentials if needed.
|
|
@@ -3106,7 +3142,7 @@ var DataSpace = class {
|
|
|
3106
3142
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3107
3143
|
this._cache = void 0;
|
|
3108
3144
|
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
3109
|
-
this._state =
|
|
3145
|
+
this._state = import_services9.SpaceState.CLOSED;
|
|
3110
3146
|
this.error = void 0;
|
|
3111
3147
|
this.stateUpdate = new import_async10.Event();
|
|
3112
3148
|
this.metrics = {};
|
|
@@ -3128,7 +3164,7 @@ var DataSpace = class {
|
|
|
3128
3164
|
this._cache = params.cache;
|
|
3129
3165
|
this._state = params.initialState;
|
|
3130
3166
|
(0, import_log9.log)("new state", {
|
|
3131
|
-
state:
|
|
3167
|
+
state: import_services9.SpaceState[this._state]
|
|
3132
3168
|
}, {
|
|
3133
3169
|
F: __dxlog_file12,
|
|
3134
3170
|
L: 141,
|
|
@@ -3179,9 +3215,9 @@ var DataSpace = class {
|
|
|
3179
3215
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3180
3216
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3181
3217
|
await this._inner.open(new import_context6.Context());
|
|
3182
|
-
this._state =
|
|
3218
|
+
this._state = import_services9.SpaceState.CONTROL_ONLY;
|
|
3183
3219
|
(0, import_log9.log)("new state", {
|
|
3184
|
-
state:
|
|
3220
|
+
state: import_services9.SpaceState[this._state]
|
|
3185
3221
|
}, {
|
|
3186
3222
|
F: __dxlog_file12,
|
|
3187
3223
|
L: 203,
|
|
@@ -3197,9 +3233,9 @@ var DataSpace = class {
|
|
|
3197
3233
|
}
|
|
3198
3234
|
async _close() {
|
|
3199
3235
|
await this._callbacks.beforeClose?.();
|
|
3200
|
-
this._state =
|
|
3236
|
+
this._state = import_services9.SpaceState.CLOSED;
|
|
3201
3237
|
(0, import_log9.log)("new state", {
|
|
3202
|
-
state:
|
|
3238
|
+
state: import_services9.SpaceState[this._state]
|
|
3203
3239
|
}, {
|
|
3204
3240
|
F: __dxlog_file12,
|
|
3205
3241
|
L: 217,
|
|
@@ -3246,9 +3282,9 @@ var DataSpace = class {
|
|
|
3246
3282
|
S: this,
|
|
3247
3283
|
C: (f, a) => f(...a)
|
|
3248
3284
|
});
|
|
3249
|
-
this._state =
|
|
3285
|
+
this._state = import_services9.SpaceState.ERROR;
|
|
3250
3286
|
(0, import_log9.log)("new state", {
|
|
3251
|
-
state:
|
|
3287
|
+
state: import_services9.SpaceState[this._state]
|
|
3252
3288
|
}, {
|
|
3253
3289
|
F: __dxlog_file12,
|
|
3254
3290
|
L: 256,
|
|
@@ -3263,12 +3299,12 @@ var DataSpace = class {
|
|
|
3263
3299
|
});
|
|
3264
3300
|
}
|
|
3265
3301
|
async initializeDataPipeline() {
|
|
3266
|
-
if (this._state !==
|
|
3302
|
+
if (this._state !== import_services9.SpaceState.CONTROL_ONLY) {
|
|
3267
3303
|
throw new import_protocols8.SystemError("Invalid operation");
|
|
3268
3304
|
}
|
|
3269
|
-
this._state =
|
|
3305
|
+
this._state = import_services9.SpaceState.INITIALIZING;
|
|
3270
3306
|
(0, import_log9.log)("new state", {
|
|
3271
|
-
state:
|
|
3307
|
+
state: import_services9.SpaceState[this._state]
|
|
3272
3308
|
}, {
|
|
3273
3309
|
F: __dxlog_file12,
|
|
3274
3310
|
L: 272,
|
|
@@ -3298,9 +3334,9 @@ var DataSpace = class {
|
|
|
3298
3334
|
C: (f, a) => f(...a)
|
|
3299
3335
|
});
|
|
3300
3336
|
await this._callbacks.beforeReady?.();
|
|
3301
|
-
this._state =
|
|
3337
|
+
this._state = import_services9.SpaceState.READY;
|
|
3302
3338
|
(0, import_log9.log)("new state", {
|
|
3303
|
-
state:
|
|
3339
|
+
state: import_services9.SpaceState[this._state]
|
|
3304
3340
|
}, {
|
|
3305
3341
|
F: __dxlog_file12,
|
|
3306
3342
|
L: 298,
|
|
@@ -3438,12 +3474,12 @@ var DataSpace = class {
|
|
|
3438
3474
|
let epoch;
|
|
3439
3475
|
switch (options?.migration) {
|
|
3440
3476
|
case void 0:
|
|
3441
|
-
case
|
|
3477
|
+
case import_services9.CreateEpochRequest.Migration.NONE:
|
|
3442
3478
|
{
|
|
3443
3479
|
epoch = await this.dataPipeline.createEpoch();
|
|
3444
3480
|
}
|
|
3445
3481
|
break;
|
|
3446
|
-
case
|
|
3482
|
+
case import_services9.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3447
3483
|
const document = this._automergeHost.repo.create();
|
|
3448
3484
|
epoch = {
|
|
3449
3485
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
@@ -3484,22 +3520,22 @@ var DataSpace = class {
|
|
|
3484
3520
|
}
|
|
3485
3521
|
}
|
|
3486
3522
|
async activate() {
|
|
3487
|
-
if (this._state !==
|
|
3523
|
+
if (this._state !== import_services9.SpaceState.INACTIVE) {
|
|
3488
3524
|
return;
|
|
3489
3525
|
}
|
|
3490
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3526
|
+
await this._metadataStore.setSpaceState(this.key, import_services9.SpaceState.ACTIVE);
|
|
3491
3527
|
await this._open();
|
|
3492
3528
|
this.initializeDataPipelineAsync();
|
|
3493
3529
|
}
|
|
3494
3530
|
async deactivate() {
|
|
3495
|
-
if (this._state ===
|
|
3531
|
+
if (this._state === import_services9.SpaceState.INACTIVE) {
|
|
3496
3532
|
return;
|
|
3497
3533
|
}
|
|
3498
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3534
|
+
await this._metadataStore.setSpaceState(this.key, import_services9.SpaceState.INACTIVE);
|
|
3499
3535
|
await this._close();
|
|
3500
|
-
this._state =
|
|
3536
|
+
this._state = import_services9.SpaceState.INACTIVE;
|
|
3501
3537
|
(0, import_log9.log)("new state", {
|
|
3502
|
-
state:
|
|
3538
|
+
state: import_services9.SpaceState[this._state]
|
|
3503
3539
|
}, {
|
|
3504
3540
|
F: __dxlog_file12,
|
|
3505
3541
|
L: 492,
|
|
@@ -3517,7 +3553,7 @@ _ts_decorate4([
|
|
|
3517
3553
|
], DataSpace.prototype, "key", null);
|
|
3518
3554
|
_ts_decorate4([
|
|
3519
3555
|
import_tracing5.trace.info({
|
|
3520
|
-
enum:
|
|
3556
|
+
enum: import_services9.SpaceState
|
|
3521
3557
|
})
|
|
3522
3558
|
], DataSpace.prototype, "state", null);
|
|
3523
3559
|
_ts_decorate4([
|
|
@@ -3699,7 +3735,7 @@ var DataSpaceManager = class {
|
|
|
3699
3735
|
this._isOpen = true;
|
|
3700
3736
|
this.updated.emit();
|
|
3701
3737
|
for (const space of this._spaces.values()) {
|
|
3702
|
-
if (space.state !==
|
|
3738
|
+
if (space.state !== import_services10.SpaceState.INACTIVE) {
|
|
3703
3739
|
space.initializeDataPipelineAsync();
|
|
3704
3740
|
}
|
|
3705
3741
|
}
|
|
@@ -3746,7 +3782,7 @@ var DataSpaceManager = class {
|
|
|
3746
3782
|
genesisFeedKey: controlFeedKey,
|
|
3747
3783
|
controlFeedKey,
|
|
3748
3784
|
dataFeedKey,
|
|
3749
|
-
state:
|
|
3785
|
+
state: import_services10.SpaceState.ACTIVE
|
|
3750
3786
|
};
|
|
3751
3787
|
(0, import_log11.log)("creating space...", {
|
|
3752
3788
|
spaceKey
|
|
@@ -3826,7 +3862,7 @@ var DataSpaceManager = class {
|
|
|
3826
3862
|
async waitUntilSpaceReady(spaceKey) {
|
|
3827
3863
|
await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
3828
3864
|
const space = this._spaces.get(spaceKey);
|
|
3829
|
-
return !!space && space.state ===
|
|
3865
|
+
return !!space && space.state === import_services10.SpaceState.READY;
|
|
3830
3866
|
}));
|
|
3831
3867
|
}
|
|
3832
3868
|
async _constructSpace(metadata) {
|
|
@@ -3883,7 +3919,7 @@ var DataSpaceManager = class {
|
|
|
3883
3919
|
dataFeed && space.setDataFeed(dataFeed);
|
|
3884
3920
|
const dataSpace = new DataSpace({
|
|
3885
3921
|
inner: space,
|
|
3886
|
-
initialState: metadata.state ===
|
|
3922
|
+
initialState: metadata.state === import_services10.SpaceState.INACTIVE ? import_services10.SpaceState.INACTIVE : import_services10.SpaceState.CLOSED,
|
|
3887
3923
|
metadataStore: this._metadataStore,
|
|
3888
3924
|
gossip,
|
|
3889
3925
|
presence,
|
|
@@ -3931,7 +3967,7 @@ var DataSpaceManager = class {
|
|
|
3931
3967
|
cache: metadata.cache,
|
|
3932
3968
|
automergeHost: this._automergeHost
|
|
3933
3969
|
});
|
|
3934
|
-
if (metadata.state !==
|
|
3970
|
+
if (metadata.state !== import_services10.SpaceState.INACTIVE) {
|
|
3935
3971
|
await dataSpace.open();
|
|
3936
3972
|
}
|
|
3937
3973
|
if (metadata.controlTimeframe) {
|
|
@@ -3980,10 +4016,10 @@ var SpacesServiceImpl = class {
|
|
|
3980
4016
|
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3981
4017
|
if (state) {
|
|
3982
4018
|
switch (state) {
|
|
3983
|
-
case
|
|
4019
|
+
case import_services11.SpaceState.ACTIVE:
|
|
3984
4020
|
await space.activate();
|
|
3985
4021
|
break;
|
|
3986
|
-
case
|
|
4022
|
+
case import_services11.SpaceState.INACTIVE:
|
|
3987
4023
|
await space.deactivate();
|
|
3988
4024
|
break;
|
|
3989
4025
|
default:
|
|
@@ -4160,7 +4196,7 @@ var SpacesServiceImpl = class {
|
|
|
4160
4196
|
displayName: member.profile?.displayName
|
|
4161
4197
|
}
|
|
4162
4198
|
},
|
|
4163
|
-
presence: member.removed ?
|
|
4199
|
+
presence: member.removed ? import_services11.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services11.SpaceMember.PresenceState.ONLINE : import_services11.SpaceMember.PresenceState.OFFLINE,
|
|
4164
4200
|
peerStates: peers
|
|
4165
4201
|
};
|
|
4166
4202
|
}),
|
|
@@ -4217,7 +4253,7 @@ var ServiceContext = class {
|
|
|
4217
4253
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
4218
4254
|
this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
|
|
4219
4255
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4220
|
-
this._handlerFactories.set(
|
|
4256
|
+
this._handlerFactories.set(import_services12.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug7.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4221
4257
|
}
|
|
4222
4258
|
async open(ctx) {
|
|
4223
4259
|
await this._checkStorageVersion();
|
|
@@ -4345,7 +4381,7 @@ var ServiceContext = class {
|
|
|
4345
4381
|
};
|
|
4346
4382
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4347
4383
|
await this.dataSpaceManager.open();
|
|
4348
|
-
this._handlerFactories.set(
|
|
4384
|
+
this._handlerFactories.set(import_services12.Invitation.Kind.SPACE, (invitation) => {
|
|
4349
4385
|
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4350
4386
|
F: __dxlog_file15,
|
|
4351
4387
|
L: 228,
|
|
@@ -4548,7 +4584,7 @@ var DevicesServiceImpl = class {
|
|
|
4548
4584
|
this._identityManager = _identityManager;
|
|
4549
4585
|
}
|
|
4550
4586
|
async updateDevice(profile) {
|
|
4551
|
-
|
|
4587
|
+
return this._identityManager.updateDeviceProfile(profile);
|
|
4552
4588
|
}
|
|
4553
4589
|
queryDevices() {
|
|
4554
4590
|
return new import_codec_protobuf12.Stream(({ next }) => {
|
|
@@ -4562,7 +4598,7 @@ var DevicesServiceImpl = class {
|
|
|
4562
4598
|
next({
|
|
4563
4599
|
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
|
|
4564
4600
|
deviceKey: key,
|
|
4565
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
4601
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services14.DeviceKind.CURRENT : import_services14.DeviceKind.TRUSTED,
|
|
4566
4602
|
profile
|
|
4567
4603
|
}))
|
|
4568
4604
|
});
|
|
@@ -4677,16 +4713,16 @@ var LoggingServiceImpl = class {
|
|
|
4677
4713
|
};
|
|
4678
4714
|
var matchFilter = (filter, level, path, options) => {
|
|
4679
4715
|
switch (options) {
|
|
4680
|
-
case
|
|
4716
|
+
case import_services15.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
4681
4717
|
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
4682
|
-
case
|
|
4718
|
+
case import_services15.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
4683
4719
|
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
4684
4720
|
}
|
|
4685
4721
|
};
|
|
4686
4722
|
var shouldLog = (entry2, request) => {
|
|
4687
|
-
const options = request.options ??
|
|
4723
|
+
const options = request.options ?? import_services15.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
4688
4724
|
if (request.filters === void 0) {
|
|
4689
|
-
return options ===
|
|
4725
|
+
return options === import_services15.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
4690
4726
|
} else {
|
|
4691
4727
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
4692
4728
|
}
|
|
@@ -4742,8 +4778,8 @@ var SystemServiceImpl = class {
|
|
|
4742
4778
|
return {
|
|
4743
4779
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4744
4780
|
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util11.jsonKeyReplacer)({
|
|
4745
|
-
truncate: keys ===
|
|
4746
|
-
humanize: keys ===
|
|
4781
|
+
truncate: keys === import_services16.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
4782
|
+
humanize: keys === import_services16.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
4747
4783
|
})))
|
|
4748
4784
|
};
|
|
4749
4785
|
}
|
|
@@ -4827,14 +4863,14 @@ var ClientServicesHost = class {
|
|
|
4827
4863
|
this._systemService = new SystemServiceImpl({
|
|
4828
4864
|
config: () => this._config,
|
|
4829
4865
|
statusUpdate: this._statusUpdate,
|
|
4830
|
-
getCurrentStatus: () => this.isOpen ?
|
|
4866
|
+
getCurrentStatus: () => this.isOpen ? import_services13.SystemStatus.ACTIVE : import_services13.SystemStatus.INACTIVE,
|
|
4831
4867
|
getDiagnostics: () => {
|
|
4832
4868
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
4833
4869
|
},
|
|
4834
4870
|
onUpdateStatus: async (status) => {
|
|
4835
|
-
if (!this.isOpen && status ===
|
|
4871
|
+
if (!this.isOpen && status === import_services13.SystemStatus.ACTIVE) {
|
|
4836
4872
|
await this._resourceLock?.acquire();
|
|
4837
|
-
} else if (this.isOpen && status ===
|
|
4873
|
+
} else if (this.isOpen && status === import_services13.SystemStatus.INACTIVE) {
|
|
4838
4874
|
await this._resourceLock?.release();
|
|
4839
4875
|
}
|
|
4840
4876
|
},
|
|
@@ -5182,4 +5218,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5182
5218
|
subscribeToSpaces,
|
|
5183
5219
|
subscribeToSwarmInfo
|
|
5184
5220
|
});
|
|
5185
|
-
//# sourceMappingURL=chunk-
|
|
5221
|
+
//# sourceMappingURL=chunk-KGR7HQTP.cjs.map
|