@dxos/client-services 0.3.11-main.b00882f → 0.3.11-main.b3f97d8
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-LGP2K56V.mjs → chunk-STIGESOC.mjs} +198 -91
- package/dist/lib/browser/chunk-STIGESOC.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 +4 -11
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/{chunk-TMJJVXE4.cjs → chunk-LS6Q564P.cjs} +341 -234
- package/dist/lib/node/chunk-LS6Q564P.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 +11 -18
- package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +2 -0
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts +28 -3
- package/dist/types/src/packlets/invitations/invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +2 -0
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
- package/dist/types/src/packlets/services/diagnostics.d.ts +32 -16
- package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/services/platform.d.ts +1 -14
- package/dist/types/src/packlets/services/platform.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts +2 -0
- package/dist/types/src/packlets/spaces/automerge-space-state.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts +2 -0
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/system/system-service.d.ts +3 -2
- package/dist/types/src/packlets/system/system-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/identity/identity-manager.ts +1 -1
- package/src/packlets/invitations/device-invitation-protocol.test.ts +14 -0
- package/src/packlets/invitations/device-invitation-protocol.ts +14 -0
- package/src/packlets/invitations/invitation-protocol.ts +44 -6
- package/src/packlets/invitations/invitations-handler.ts +19 -17
- package/src/packlets/invitations/space-invitation-protocol.test.ts +28 -0
- package/src/packlets/invitations/space-invitation-protocol.ts +11 -0
- package/src/packlets/network/network-service.ts +5 -1
- package/src/packlets/services/diagnostics.ts +52 -16
- package/src/packlets/services/platform.ts +7 -19
- package/src/packlets/spaces/automerge-space-state.ts +4 -0
- package/src/packlets/spaces/data-space-manager.ts +5 -1
- package/src/packlets/spaces/data-space.ts +37 -4
- package/src/packlets/spaces/spaces-service.ts +3 -3
- package/src/packlets/system/system-service.ts +7 -1
- package/src/packlets/testing/invitation-utils.ts +2 -10
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-LGP2K56V.mjs.map +0 -7
- package/dist/lib/node/chunk-TMJJVXE4.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_LS6Q564P_exports = {};
|
|
30
|
+
__export(chunk_LS6Q564P_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -60,7 +60,7 @@ __export(chunk_TMJJVXE4_exports, {
|
|
|
60
60
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
61
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
62
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
63
|
+
module.exports = __toCommonJS(chunk_LS6Q564P_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");
|
|
@@ -108,6 +108,7 @@ var import_credentials6 = require("@dxos/credentials");
|
|
|
108
108
|
var import_debug2 = require("@dxos/debug");
|
|
109
109
|
var import_invariant3 = require("@dxos/invariant");
|
|
110
110
|
var import_invariant4 = require("@dxos/invariant");
|
|
111
|
+
var import_protocols3 = require("@dxos/protocols");
|
|
111
112
|
var import_services = require("@dxos/protocols/proto/dxos/client/services");
|
|
112
113
|
var import_async7 = require("@dxos/async");
|
|
113
114
|
var import_client_protocol2 = require("@dxos/client-protocol");
|
|
@@ -117,7 +118,7 @@ var import_invariant5 = require("@dxos/invariant");
|
|
|
117
118
|
var import_keys5 = require("@dxos/keys");
|
|
118
119
|
var import_log4 = require("@dxos/log");
|
|
119
120
|
var import_network_manager = require("@dxos/network-manager");
|
|
120
|
-
var
|
|
121
|
+
var import_protocols4 = require("@dxos/protocols");
|
|
121
122
|
var import_services2 = require("@dxos/protocols/proto/dxos/client/services");
|
|
122
123
|
var import_invitations = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
123
124
|
var import_async8 = require("@dxos/async");
|
|
@@ -125,7 +126,7 @@ var import_context5 = require("@dxos/context");
|
|
|
125
126
|
var import_invariant6 = require("@dxos/invariant");
|
|
126
127
|
var import_keys6 = require("@dxos/keys");
|
|
127
128
|
var import_log5 = require("@dxos/log");
|
|
128
|
-
var
|
|
129
|
+
var import_protocols5 = require("@dxos/protocols");
|
|
129
130
|
var import_services3 = require("@dxos/protocols/proto/dxos/client/services");
|
|
130
131
|
var import_invitations2 = require("@dxos/protocols/proto/dxos/halo/invitations");
|
|
131
132
|
var import_teleport = require("@dxos/teleport");
|
|
@@ -138,6 +139,7 @@ var import_credentials8 = require("@dxos/credentials");
|
|
|
138
139
|
var import_feed_store3 = require("@dxos/feed-store");
|
|
139
140
|
var import_invariant8 = require("@dxos/invariant");
|
|
140
141
|
var import_log7 = require("@dxos/log");
|
|
142
|
+
var import_protocols6 = require("@dxos/protocols");
|
|
141
143
|
var import_services5 = require("@dxos/protocols/proto/dxos/client/services");
|
|
142
144
|
var import_codec_protobuf9 = require("@dxos/codec-protobuf");
|
|
143
145
|
var import_debug3 = require("@dxos/debug");
|
|
@@ -149,38 +151,41 @@ var import_document_model = require("@dxos/document-model");
|
|
|
149
151
|
var import_echo_db = require("@dxos/echo-db");
|
|
150
152
|
var import_invariant9 = require("@dxos/invariant");
|
|
151
153
|
var import_log8 = require("@dxos/log");
|
|
152
|
-
var
|
|
154
|
+
var import_protocols7 = require("@dxos/protocols");
|
|
153
155
|
var import_services6 = require("@dxos/protocols/proto/dxos/client/services");
|
|
156
|
+
var import_tracing4 = require("@dxos/tracing");
|
|
157
|
+
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
154
158
|
var import_async10 = require("@dxos/async");
|
|
155
159
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
156
160
|
var import_context6 = require("@dxos/context");
|
|
157
161
|
var import_debug4 = require("@dxos/debug");
|
|
158
162
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
163
|
+
var import_invariant10 = require("@dxos/invariant");
|
|
159
164
|
var import_keys7 = require("@dxos/keys");
|
|
160
165
|
var import_log9 = require("@dxos/log");
|
|
161
|
-
var
|
|
162
|
-
var
|
|
166
|
+
var import_protocols8 = require("@dxos/protocols");
|
|
167
|
+
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
163
168
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
164
169
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
165
|
-
var
|
|
170
|
+
var import_tracing5 = require("@dxos/tracing");
|
|
166
171
|
var import_util4 = require("@dxos/util");
|
|
167
172
|
var import_credentials11 = require("@dxos/credentials");
|
|
168
173
|
var import_async11 = require("@dxos/async");
|
|
169
174
|
var import_context7 = require("@dxos/context");
|
|
170
|
-
var
|
|
175
|
+
var import_invariant11 = require("@dxos/invariant");
|
|
171
176
|
var import_keys8 = require("@dxos/keys");
|
|
172
177
|
var import_log10 = require("@dxos/log");
|
|
173
|
-
var
|
|
178
|
+
var import_protocols9 = require("@dxos/protocols");
|
|
174
179
|
var import_teleport2 = require("@dxos/teleport");
|
|
175
180
|
var import_util5 = require("@dxos/util");
|
|
176
181
|
var import_async12 = require("@dxos/async");
|
|
177
182
|
var import_context8 = require("@dxos/context");
|
|
178
183
|
var import_credentials12 = require("@dxos/credentials");
|
|
179
|
-
var
|
|
184
|
+
var import_invariant12 = require("@dxos/invariant");
|
|
180
185
|
var import_keys9 = require("@dxos/keys");
|
|
181
186
|
var import_log11 = require("@dxos/log");
|
|
182
|
-
var
|
|
183
|
-
var
|
|
187
|
+
var import_protocols10 = require("@dxos/protocols");
|
|
188
|
+
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
184
189
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
185
190
|
var import_util6 = require("@dxos/util");
|
|
186
191
|
var import_credentials13 = require("@dxos/credentials");
|
|
@@ -190,30 +195,30 @@ var import_timeframe3 = require("@dxos/timeframe");
|
|
|
190
195
|
var import_async13 = require("@dxos/async");
|
|
191
196
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
192
197
|
var import_debug6 = require("@dxos/debug");
|
|
193
|
-
var
|
|
198
|
+
var import_invariant13 = require("@dxos/invariant");
|
|
194
199
|
var import_log12 = require("@dxos/log");
|
|
195
|
-
var
|
|
196
|
-
var
|
|
200
|
+
var import_protocols11 = require("@dxos/protocols");
|
|
201
|
+
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
197
202
|
var import_async14 = require("@dxos/async");
|
|
198
203
|
var import_context9 = require("@dxos/context");
|
|
199
204
|
var import_credentials15 = require("@dxos/credentials");
|
|
200
205
|
var import_debug7 = require("@dxos/debug");
|
|
201
206
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
202
207
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
203
|
-
var
|
|
208
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
204
209
|
var import_keyring = require("@dxos/keyring");
|
|
205
210
|
var import_keys10 = require("@dxos/keys");
|
|
206
211
|
var import_log13 = require("@dxos/log");
|
|
207
|
-
var
|
|
208
|
-
var
|
|
212
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
213
|
+
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
209
214
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
210
|
-
var
|
|
215
|
+
var import_tracing6 = require("@dxos/tracing");
|
|
211
216
|
var import_util7 = require("@dxos/util");
|
|
212
|
-
var
|
|
217
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
213
218
|
var import_lock_file = require("@dxos/lock-file");
|
|
214
219
|
var import_log14 = require("@dxos/log");
|
|
215
220
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
216
|
-
var
|
|
221
|
+
var import_protocols13 = require("@dxos/protocols");
|
|
217
222
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
218
223
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
219
224
|
var import_util8 = require("@dxos/util");
|
|
@@ -223,28 +228,28 @@ var import_context10 = require("@dxos/context");
|
|
|
223
228
|
var import_document_model2 = require("@dxos/document-model");
|
|
224
229
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
225
230
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
226
|
-
var
|
|
231
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
227
232
|
var import_keys11 = require("@dxos/keys");
|
|
228
233
|
var import_log15 = require("@dxos/log");
|
|
229
234
|
var import_messaging = require("@dxos/messaging");
|
|
230
235
|
var import_model_factory = require("@dxos/model-factory");
|
|
231
236
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
232
|
-
var
|
|
233
|
-
var
|
|
237
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
238
|
+
var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
|
|
234
239
|
var import_text_model = require("@dxos/text-model");
|
|
235
|
-
var
|
|
240
|
+
var import_tracing7 = require("@dxos/tracing");
|
|
236
241
|
var import_websocket_rpc = require("@dxos/websocket-rpc");
|
|
237
242
|
var import_async16 = require("@dxos/async");
|
|
238
243
|
var import_codec_protobuf12 = require("@dxos/codec-protobuf");
|
|
239
|
-
var
|
|
244
|
+
var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
|
|
240
245
|
var import_async17 = require("@dxos/async");
|
|
241
246
|
var import_codec_protobuf13 = require("@dxos/codec-protobuf");
|
|
242
247
|
var import_log16 = require("@dxos/log");
|
|
243
|
-
var
|
|
248
|
+
var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
|
|
244
249
|
var import_util9 = require("@dxos/util");
|
|
245
250
|
var import_codec_protobuf14 = require("@dxos/codec-protobuf");
|
|
246
251
|
var import_codec_protobuf15 = require("@dxos/codec-protobuf");
|
|
247
|
-
var
|
|
252
|
+
var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
|
|
248
253
|
var import_util10 = require("@dxos/util");
|
|
249
254
|
var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
|
|
250
255
|
return new import_codec_protobuf.Stream(({ next }) => {
|
|
@@ -1174,7 +1179,7 @@ var IdentityManager = class {
|
|
|
1174
1179
|
genesisFeedKey: spaceRecord.genesisFeedKey
|
|
1175
1180
|
},
|
|
1176
1181
|
swarmIdentity,
|
|
1177
|
-
|
|
1182
|
+
onAuthorizedConnection: () => {
|
|
1178
1183
|
},
|
|
1179
1184
|
onAuthFailure: () => {
|
|
1180
1185
|
import_log3.log.warn("auth failure", void 0, {
|
|
@@ -1282,7 +1287,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1282
1287
|
async admit(request) {
|
|
1283
1288
|
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1284
1289
|
F: __dxlog_file5,
|
|
1285
|
-
L:
|
|
1290
|
+
L: 36,
|
|
1286
1291
|
S: this,
|
|
1287
1292
|
A: [
|
|
1288
1293
|
"request.device",
|
|
@@ -1300,6 +1305,15 @@ var DeviceInvitationProtocol = class {
|
|
|
1300
1305
|
}
|
|
1301
1306
|
};
|
|
1302
1307
|
}
|
|
1308
|
+
checkInvitation(invitation) {
|
|
1309
|
+
try {
|
|
1310
|
+
const identity = this._getIdentity();
|
|
1311
|
+
if (identity) {
|
|
1312
|
+
return new import_protocols3.AlreadyJoinedError("Currently only one identity per client is supported.");
|
|
1313
|
+
}
|
|
1314
|
+
} catch {
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1303
1317
|
createIntroduction() {
|
|
1304
1318
|
return {};
|
|
1305
1319
|
}
|
|
@@ -1318,7 +1332,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1318
1332
|
async accept(response, request) {
|
|
1319
1333
|
(0, import_invariant4.invariant)(response.device, void 0, {
|
|
1320
1334
|
F: __dxlog_file5,
|
|
1321
|
-
L:
|
|
1335
|
+
L: 80,
|
|
1322
1336
|
S: this,
|
|
1323
1337
|
A: [
|
|
1324
1338
|
"response.device",
|
|
@@ -1328,7 +1342,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1328
1342
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1329
1343
|
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1330
1344
|
F: __dxlog_file5,
|
|
1331
|
-
L:
|
|
1345
|
+
L: 83,
|
|
1332
1346
|
S: this,
|
|
1333
1347
|
A: [
|
|
1334
1348
|
"request.device",
|
|
@@ -1357,10 +1371,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1357
1371
|
constructor(_callbacks) {
|
|
1358
1372
|
super({
|
|
1359
1373
|
requested: {
|
|
1360
|
-
InvitationHostService:
|
|
1374
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1361
1375
|
},
|
|
1362
1376
|
exposed: {
|
|
1363
|
-
InvitationHostService:
|
|
1377
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1364
1378
|
}
|
|
1365
1379
|
});
|
|
1366
1380
|
this._callbacks = _callbacks;
|
|
@@ -1393,7 +1407,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1393
1407
|
introduce: async (request) => {
|
|
1394
1408
|
const { profile, invitationId } = request;
|
|
1395
1409
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1396
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce",
|
|
1410
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.begin({
|
|
1397
1411
|
id: traceId
|
|
1398
1412
|
}), {
|
|
1399
1413
|
F: __dxlog_file6,
|
|
@@ -1430,7 +1444,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1430
1444
|
...this.invitation,
|
|
1431
1445
|
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1432
1446
|
});
|
|
1433
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce",
|
|
1447
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.end({
|
|
1434
1448
|
id: traceId
|
|
1435
1449
|
}), {
|
|
1436
1450
|
F: __dxlog_file6,
|
|
@@ -1444,7 +1458,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1444
1458
|
},
|
|
1445
1459
|
authenticate: async ({ authCode: code }) => {
|
|
1446
1460
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1447
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate",
|
|
1461
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.begin({
|
|
1448
1462
|
id: traceId
|
|
1449
1463
|
}), {
|
|
1450
1464
|
F: __dxlog_file6,
|
|
@@ -1507,7 +1521,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1507
1521
|
break;
|
|
1508
1522
|
}
|
|
1509
1523
|
}
|
|
1510
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate",
|
|
1524
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.end({
|
|
1511
1525
|
id: traceId,
|
|
1512
1526
|
data: {
|
|
1513
1527
|
status
|
|
@@ -1524,7 +1538,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1524
1538
|
},
|
|
1525
1539
|
admit: async (request) => {
|
|
1526
1540
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1527
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit",
|
|
1541
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols5.trace.begin({
|
|
1528
1542
|
id: traceId
|
|
1529
1543
|
}), {
|
|
1530
1544
|
F: __dxlog_file6,
|
|
@@ -1546,7 +1560,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1546
1560
|
throw new Error("Not authenticated");
|
|
1547
1561
|
}
|
|
1548
1562
|
const response = await this._callbacks.admit(request);
|
|
1549
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit",
|
|
1563
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols5.trace.end({
|
|
1550
1564
|
id: traceId
|
|
1551
1565
|
}), {
|
|
1552
1566
|
F: __dxlog_file6,
|
|
@@ -1573,7 +1587,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1573
1587
|
timeout: OPTIONS_TIMEOUT
|
|
1574
1588
|
}));
|
|
1575
1589
|
if (this._remoteOptions?.role !== import_invitations2.Options.Role.GUEST) {
|
|
1576
|
-
throw new
|
|
1590
|
+
throw new import_protocols5.InvalidInvitationExtensionRoleError(void 0, {
|
|
1577
1591
|
expected: import_invitations2.Options.Role.GUEST,
|
|
1578
1592
|
remoteOptions: this._remoteOptions
|
|
1579
1593
|
});
|
|
@@ -1591,10 +1605,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1591
1605
|
constructor(_callbacks) {
|
|
1592
1606
|
super({
|
|
1593
1607
|
requested: {
|
|
1594
|
-
InvitationHostService:
|
|
1608
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1595
1609
|
},
|
|
1596
1610
|
exposed: {
|
|
1597
|
-
InvitationHostService:
|
|
1611
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1598
1612
|
}
|
|
1599
1613
|
});
|
|
1600
1614
|
this._callbacks = _callbacks;
|
|
@@ -1651,7 +1665,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1651
1665
|
C: (f, a) => f(...a)
|
|
1652
1666
|
});
|
|
1653
1667
|
if (this._remoteOptions?.role !== import_invitations2.Options.Role.HOST) {
|
|
1654
|
-
throw new
|
|
1668
|
+
throw new import_protocols5.InvalidInvitationExtensionRoleError(void 0, {
|
|
1655
1669
|
expected: import_invitations2.Options.Role.HOST,
|
|
1656
1670
|
remoteOptions: this._remoteOptions
|
|
1657
1671
|
});
|
|
@@ -1764,7 +1778,7 @@ var InvitationsHandler = class {
|
|
|
1764
1778
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
1765
1779
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1766
1780
|
try {
|
|
1767
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1781
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
1768
1782
|
id: traceId
|
|
1769
1783
|
}), {
|
|
1770
1784
|
F: __dxlog_file7,
|
|
@@ -1800,7 +1814,7 @@ var InvitationsHandler = class {
|
|
|
1800
1814
|
...invitation,
|
|
1801
1815
|
state: import_services2.Invitation.State.SUCCESS
|
|
1802
1816
|
});
|
|
1803
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1817
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
1804
1818
|
id: traceId
|
|
1805
1819
|
}), {
|
|
1806
1820
|
F: __dxlog_file7,
|
|
@@ -1831,7 +1845,7 @@ var InvitationsHandler = class {
|
|
|
1831
1845
|
});
|
|
1832
1846
|
stream.error(err);
|
|
1833
1847
|
}
|
|
1834
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1848
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.error({
|
|
1835
1849
|
id: traceId,
|
|
1836
1850
|
error: err
|
|
1837
1851
|
}), {
|
|
@@ -1849,7 +1863,7 @@ var InvitationsHandler = class {
|
|
|
1849
1863
|
});
|
|
1850
1864
|
},
|
|
1851
1865
|
onError: (err) => {
|
|
1852
|
-
if (err instanceof
|
|
1866
|
+
if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
|
|
1853
1867
|
return;
|
|
1854
1868
|
}
|
|
1855
1869
|
if (err instanceof import_async7.TimeoutError) {
|
|
@@ -1997,7 +2011,7 @@ var InvitationsHandler = class {
|
|
|
1997
2011
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
1998
2012
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1999
2013
|
try {
|
|
2000
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2014
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
2001
2015
|
id: traceId
|
|
2002
2016
|
}), {
|
|
2003
2017
|
F: __dxlog_file7,
|
|
@@ -2084,16 +2098,12 @@ var InvitationsHandler = class {
|
|
|
2084
2098
|
}
|
|
2085
2099
|
}
|
|
2086
2100
|
}
|
|
2087
|
-
} else {
|
|
2088
|
-
setState({
|
|
2089
|
-
state: import_services2.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2090
|
-
});
|
|
2091
2101
|
}
|
|
2092
2102
|
(0, import_log4.log)("request admission", {
|
|
2093
2103
|
...protocol.toJSON()
|
|
2094
2104
|
}, {
|
|
2095
2105
|
F: __dxlog_file7,
|
|
2096
|
-
L:
|
|
2106
|
+
L: 309,
|
|
2097
2107
|
S: this,
|
|
2098
2108
|
C: (f, a) => f(...a)
|
|
2099
2109
|
});
|
|
@@ -2105,7 +2115,7 @@ var InvitationsHandler = class {
|
|
|
2105
2115
|
...protocol.toJSON()
|
|
2106
2116
|
}, {
|
|
2107
2117
|
F: __dxlog_file7,
|
|
2108
|
-
L:
|
|
2118
|
+
L: 320,
|
|
2109
2119
|
S: this,
|
|
2110
2120
|
C: (f, a) => f(...a)
|
|
2111
2121
|
});
|
|
@@ -2114,11 +2124,11 @@ var InvitationsHandler = class {
|
|
|
2114
2124
|
target: invitation.target,
|
|
2115
2125
|
state: import_services2.Invitation.State.SUCCESS
|
|
2116
2126
|
});
|
|
2117
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2127
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
2118
2128
|
id: traceId
|
|
2119
2129
|
}), {
|
|
2120
2130
|
F: __dxlog_file7,
|
|
2121
|
-
L:
|
|
2131
|
+
L: 322,
|
|
2122
2132
|
S: this,
|
|
2123
2133
|
C: (f, a) => f(...a)
|
|
2124
2134
|
});
|
|
@@ -2128,7 +2138,7 @@ var InvitationsHandler = class {
|
|
|
2128
2138
|
...protocol.toJSON()
|
|
2129
2139
|
}, {
|
|
2130
2140
|
F: __dxlog_file7,
|
|
2131
|
-
L:
|
|
2141
|
+
L: 325,
|
|
2132
2142
|
S: this,
|
|
2133
2143
|
C: (f, a) => f(...a)
|
|
2134
2144
|
});
|
|
@@ -2138,18 +2148,18 @@ var InvitationsHandler = class {
|
|
|
2138
2148
|
} else {
|
|
2139
2149
|
(0, import_log4.log)("auth failed", err, {
|
|
2140
2150
|
F: __dxlog_file7,
|
|
2141
|
-
L:
|
|
2151
|
+
L: 328,
|
|
2142
2152
|
S: this,
|
|
2143
2153
|
C: (f, a) => f(...a)
|
|
2144
2154
|
});
|
|
2145
2155
|
stream.error(err);
|
|
2146
2156
|
}
|
|
2147
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2157
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.error({
|
|
2148
2158
|
id: traceId,
|
|
2149
2159
|
error: err
|
|
2150
2160
|
}), {
|
|
2151
2161
|
F: __dxlog_file7,
|
|
2152
|
-
L:
|
|
2162
|
+
L: 331,
|
|
2153
2163
|
S: this,
|
|
2154
2164
|
C: (f, a) => f(...a)
|
|
2155
2165
|
});
|
|
@@ -2159,7 +2169,7 @@ var InvitationsHandler = class {
|
|
|
2159
2169
|
});
|
|
2160
2170
|
},
|
|
2161
2171
|
onError: (err) => {
|
|
2162
|
-
if (err instanceof
|
|
2172
|
+
if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
|
|
2163
2173
|
return;
|
|
2164
2174
|
}
|
|
2165
2175
|
if (err instanceof import_async7.TimeoutError) {
|
|
@@ -2167,7 +2177,7 @@ var InvitationsHandler = class {
|
|
|
2167
2177
|
...protocol.toJSON()
|
|
2168
2178
|
}, {
|
|
2169
2179
|
F: __dxlog_file7,
|
|
2170
|
-
L:
|
|
2180
|
+
L: 342,
|
|
2171
2181
|
S: this,
|
|
2172
2182
|
C: (f, a) => f(...a)
|
|
2173
2183
|
});
|
|
@@ -2177,7 +2187,7 @@ var InvitationsHandler = class {
|
|
|
2177
2187
|
} else {
|
|
2178
2188
|
(0, import_log4.log)("auth failed", err, {
|
|
2179
2189
|
F: __dxlog_file7,
|
|
2180
|
-
L:
|
|
2190
|
+
L: 345,
|
|
2181
2191
|
S: this,
|
|
2182
2192
|
C: (f, a) => f(...a)
|
|
2183
2193
|
});
|
|
@@ -2188,29 +2198,34 @@ var InvitationsHandler = class {
|
|
|
2188
2198
|
return extension;
|
|
2189
2199
|
};
|
|
2190
2200
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2201
|
+
const error = protocol.checkInvitation(invitation);
|
|
2202
|
+
if (error) {
|
|
2203
|
+
stream.error(error);
|
|
2204
|
+
} else {
|
|
2205
|
+
(0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
|
|
2206
|
+
F: __dxlog_file7,
|
|
2207
|
+
L: 359,
|
|
2208
|
+
S: this,
|
|
2209
|
+
A: [
|
|
2210
|
+
"invitation.swarmKey",
|
|
2211
|
+
""
|
|
2212
|
+
]
|
|
2213
|
+
});
|
|
2214
|
+
const topic = invitation.swarmKey;
|
|
2215
|
+
const swarmConnection = await this._networkManager.joinSwarm({
|
|
2216
|
+
topic,
|
|
2217
|
+
peerId: import_keys5.PublicKey.random(),
|
|
2218
|
+
protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
|
|
2219
|
+
teleport.addExtension("dxos.halo.invitations", createExtension());
|
|
2220
|
+
}),
|
|
2221
|
+
topology: new import_network_manager.StarTopology(topic),
|
|
2222
|
+
label: "invitation guest"
|
|
2223
|
+
});
|
|
2224
|
+
ctx.onDispose(() => swarmConnection.close());
|
|
2225
|
+
setState({
|
|
2226
|
+
state: import_services2.Invitation.State.CONNECTING
|
|
2227
|
+
});
|
|
2228
|
+
}
|
|
2214
2229
|
});
|
|
2215
2230
|
const observable = new import_client_protocol2.AuthenticatingInvitation({
|
|
2216
2231
|
initialInvitation: invitation,
|
|
@@ -2426,7 +2441,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2426
2441
|
async admit(request, guestProfile) {
|
|
2427
2442
|
(0, import_invariant8.invariant)(this._spaceKey, void 0, {
|
|
2428
2443
|
F: __dxlog_file9,
|
|
2429
|
-
L:
|
|
2444
|
+
L: 47,
|
|
2430
2445
|
S: this,
|
|
2431
2446
|
A: [
|
|
2432
2447
|
"this._spaceKey",
|
|
@@ -2436,7 +2451,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2436
2451
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2437
2452
|
(0, import_invariant8.invariant)(space, void 0, {
|
|
2438
2453
|
F: __dxlog_file9,
|
|
2439
|
-
L:
|
|
2454
|
+
L: 49,
|
|
2440
2455
|
S: this,
|
|
2441
2456
|
A: [
|
|
2442
2457
|
"space",
|
|
@@ -2445,7 +2460,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2445
2460
|
});
|
|
2446
2461
|
(0, import_invariant8.invariant)(request.space, void 0, {
|
|
2447
2462
|
F: __dxlog_file9,
|
|
2448
|
-
L:
|
|
2463
|
+
L: 51,
|
|
2449
2464
|
S: this,
|
|
2450
2465
|
A: [
|
|
2451
2466
|
"request.space",
|
|
@@ -2458,14 +2473,14 @@ var SpaceInvitationProtocol = class {
|
|
|
2458
2473
|
guest: deviceKey
|
|
2459
2474
|
}, {
|
|
2460
2475
|
F: __dxlog_file9,
|
|
2461
|
-
L:
|
|
2476
|
+
L: 54,
|
|
2462
2477
|
S: this,
|
|
2463
2478
|
C: (f, a) => f(...a)
|
|
2464
2479
|
});
|
|
2465
2480
|
const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
2466
2481
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2467
2482
|
F: __dxlog_file9,
|
|
2468
|
-
L:
|
|
2483
|
+
L: 65,
|
|
2469
2484
|
S: this,
|
|
2470
2485
|
A: [
|
|
2471
2486
|
"credentials[0].credential",
|
|
@@ -2475,7 +2490,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2475
2490
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2476
2491
|
(0, import_invariant8.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2477
2492
|
F: __dxlog_file9,
|
|
2478
|
-
L:
|
|
2493
|
+
L: 67,
|
|
2479
2494
|
S: this,
|
|
2480
2495
|
A: [
|
|
2481
2496
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2491,6 +2506,11 @@ var SpaceInvitationProtocol = class {
|
|
|
2491
2506
|
}
|
|
2492
2507
|
};
|
|
2493
2508
|
}
|
|
2509
|
+
checkInvitation(invitation) {
|
|
2510
|
+
if (invitation.spaceKey && this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
2511
|
+
return new import_protocols6.AlreadyJoinedError("Already joined space.");
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2494
2514
|
createIntroduction() {
|
|
2495
2515
|
return {
|
|
2496
2516
|
profile: this._signingContext.getProfile()
|
|
@@ -2511,7 +2531,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2511
2531
|
async accept(response) {
|
|
2512
2532
|
(0, import_invariant8.invariant)(response.space, void 0, {
|
|
2513
2533
|
F: __dxlog_file9,
|
|
2514
|
-
L:
|
|
2534
|
+
L: 108,
|
|
2515
2535
|
S: this,
|
|
2516
2536
|
A: [
|
|
2517
2537
|
"response.space",
|
|
@@ -2522,7 +2542,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2522
2542
|
const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
|
|
2523
2543
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2524
2544
|
F: __dxlog_file9,
|
|
2525
|
-
L:
|
|
2545
|
+
L: 111,
|
|
2526
2546
|
S: this,
|
|
2527
2547
|
A: [
|
|
2528
2548
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2531,13 +2551,16 @@ var SpaceInvitationProtocol = class {
|
|
|
2531
2551
|
});
|
|
2532
2552
|
(0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2533
2553
|
F: __dxlog_file9,
|
|
2534
|
-
L:
|
|
2554
|
+
L: 112,
|
|
2535
2555
|
S: this,
|
|
2536
2556
|
A: [
|
|
2537
2557
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
2538
2558
|
""
|
|
2539
2559
|
]
|
|
2540
2560
|
});
|
|
2561
|
+
if (this._spaceManager.spaces.has(assertion.spaceKey)) {
|
|
2562
|
+
throw new import_protocols6.AlreadyJoinedError("Already joined space.");
|
|
2563
|
+
}
|
|
2541
2564
|
await this._spaceManager.acceptSpace({
|
|
2542
2565
|
spaceKey: assertion.spaceKey,
|
|
2543
2566
|
genesisFeedKey: assertion.genesisFeedKey,
|
|
@@ -2630,28 +2653,29 @@ var getPlatform = () => {
|
|
|
2630
2653
|
if (typeof window !== "undefined") {
|
|
2631
2654
|
const { userAgent } = window.navigator;
|
|
2632
2655
|
return {
|
|
2633
|
-
type:
|
|
2656
|
+
type: import_services7.Platform.PLATFORM_TYPE.BROWSER,
|
|
2634
2657
|
userAgent,
|
|
2635
2658
|
uptime: Math.floor((Date.now() - window.performance.timeOrigin) / 1e3)
|
|
2636
2659
|
};
|
|
2637
2660
|
} else {
|
|
2638
2661
|
return {
|
|
2639
|
-
type:
|
|
2662
|
+
type: import_services7.Platform.PLATFORM_TYPE.SHARED_WORKER,
|
|
2640
2663
|
uptime: Math.floor((Date.now() - performance.timeOrigin) / 1e3)
|
|
2641
2664
|
};
|
|
2642
2665
|
}
|
|
2643
2666
|
} else {
|
|
2644
2667
|
const { platform: platform2, version, arch } = process;
|
|
2645
2668
|
return {
|
|
2646
|
-
type:
|
|
2647
|
-
platform:
|
|
2648
|
-
|
|
2669
|
+
type: import_services7.Platform.PLATFORM_TYPE.NODE,
|
|
2670
|
+
platform: platform2,
|
|
2671
|
+
arch,
|
|
2672
|
+
runtime: version,
|
|
2649
2673
|
uptime: Math.floor(process.uptime()),
|
|
2650
2674
|
memory: process.memoryUsage()
|
|
2651
2675
|
};
|
|
2652
2676
|
}
|
|
2653
2677
|
};
|
|
2654
|
-
var DXOS_VERSION = "0.3.11-main.
|
|
2678
|
+
var DXOS_VERSION = "0.3.11-main.b3f97d8";
|
|
2655
2679
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2656
2680
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2657
2681
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -2661,14 +2685,15 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2661
2685
|
client: {
|
|
2662
2686
|
version: DXOS_VERSION,
|
|
2663
2687
|
storage: {
|
|
2664
|
-
version:
|
|
2688
|
+
version: import_protocols7.STORAGE_VERSION
|
|
2665
2689
|
}
|
|
2666
|
-
}
|
|
2690
|
+
},
|
|
2691
|
+
trace: import_tracing4.TRACE_PROCESSOR.getDiagnostics()
|
|
2667
2692
|
};
|
|
2668
2693
|
{
|
|
2669
2694
|
(0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
2670
2695
|
F: __dxlog_file10,
|
|
2671
|
-
L:
|
|
2696
|
+
L: 111,
|
|
2672
2697
|
S: void 0,
|
|
2673
2698
|
A: [
|
|
2674
2699
|
"clientServices.LoggingService",
|
|
@@ -2679,6 +2704,21 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2679
2704
|
timeout: DEFAULT_TIMEOUT
|
|
2680
2705
|
}).catch(() => void 0);
|
|
2681
2706
|
}
|
|
2707
|
+
if (typeof navigator !== "undefined" && navigator.storage) {
|
|
2708
|
+
const map = /* @__PURE__ */ new Map();
|
|
2709
|
+
const dir = await navigator.storage.getDirectory();
|
|
2710
|
+
for await (const filename of dir?.keys()) {
|
|
2711
|
+
const idx = filename.indexOf("-", filename.indexOf("-") + 1);
|
|
2712
|
+
if (idx === -1) {
|
|
2713
|
+
continue;
|
|
2714
|
+
}
|
|
2715
|
+
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
2716
|
+
}
|
|
2717
|
+
diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
|
|
2718
|
+
file,
|
|
2719
|
+
count
|
|
2720
|
+
}));
|
|
2721
|
+
}
|
|
2682
2722
|
const identity = serviceContext.identityManager.identity;
|
|
2683
2723
|
if (identity) {
|
|
2684
2724
|
diagnostics.identity = {
|
|
@@ -2719,7 +2759,7 @@ var getProperties = (space) => {
|
|
|
2719
2759
|
} catch (err) {
|
|
2720
2760
|
import_log8.log.warn(err.message, void 0, {
|
|
2721
2761
|
F: __dxlog_file10,
|
|
2722
|
-
L:
|
|
2762
|
+
L: 196,
|
|
2723
2763
|
S: void 0,
|
|
2724
2764
|
C: (f, a) => f(...a)
|
|
2725
2765
|
});
|
|
@@ -2774,7 +2814,8 @@ var getSpaceStats = async (space) => {
|
|
|
2774
2814
|
return stats;
|
|
2775
2815
|
};
|
|
2776
2816
|
var AutomergeSpaceState = class {
|
|
2777
|
-
constructor() {
|
|
2817
|
+
constructor(_onNewRoot) {
|
|
2818
|
+
this._onNewRoot = _onNewRoot;
|
|
2778
2819
|
this.rootUrl = void 0;
|
|
2779
2820
|
this.lastEpoch = void 0;
|
|
2780
2821
|
}
|
|
@@ -2785,6 +2826,7 @@ var AutomergeSpaceState = class {
|
|
|
2785
2826
|
this.lastEpoch = credential;
|
|
2786
2827
|
if (credential.subject.assertion.automergeRoot) {
|
|
2787
2828
|
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
2829
|
+
this._onNewRoot(this.rootUrl);
|
|
2788
2830
|
}
|
|
2789
2831
|
}
|
|
2790
2832
|
};
|
|
@@ -2821,7 +2863,7 @@ var NotarizationPlugin = class {
|
|
|
2821
2863
|
S: this,
|
|
2822
2864
|
C: (f, a) => f(...a)
|
|
2823
2865
|
});
|
|
2824
|
-
(0,
|
|
2866
|
+
(0, import_invariant11.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
2825
2867
|
F: __dxlog_file11,
|
|
2826
2868
|
L: 91,
|
|
2827
2869
|
S: this,
|
|
@@ -2946,7 +2988,7 @@ var NotarizationPlugin = class {
|
|
|
2946
2988
|
this._processCredentialsTriggers.delete(credential.id);
|
|
2947
2989
|
}
|
|
2948
2990
|
setWriter(writer) {
|
|
2949
|
-
(0,
|
|
2991
|
+
(0, import_invariant11.invariant)(!this._writer, "Writer already set.", {
|
|
2950
2992
|
F: __dxlog_file11,
|
|
2951
2993
|
L: 181,
|
|
2952
2994
|
S: this,
|
|
@@ -2971,7 +3013,7 @@ var NotarizationPlugin = class {
|
|
|
2971
3013
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
2972
3014
|
}
|
|
2973
3015
|
for (const credential of request.credentials ?? []) {
|
|
2974
|
-
(0,
|
|
3016
|
+
(0, import_invariant11.invariant)(credential.id, "Credential must have an id", {
|
|
2975
3017
|
F: __dxlog_file11,
|
|
2976
3018
|
L: 200,
|
|
2977
3019
|
S: this,
|
|
@@ -3020,10 +3062,10 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
|
|
|
3020
3062
|
constructor(_params) {
|
|
3021
3063
|
super({
|
|
3022
3064
|
requested: {
|
|
3023
|
-
NotarizationService:
|
|
3065
|
+
NotarizationService: import_protocols9.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3024
3066
|
},
|
|
3025
3067
|
exposed: {
|
|
3026
|
-
NotarizationService:
|
|
3068
|
+
NotarizationService: import_protocols9.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3027
3069
|
}
|
|
3028
3070
|
});
|
|
3029
3071
|
this._params = _params;
|
|
@@ -3063,8 +3105,8 @@ var DataSpace = class {
|
|
|
3063
3105
|
this._ctx = new import_context6.Context();
|
|
3064
3106
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3065
3107
|
this._cache = void 0;
|
|
3066
|
-
this._automergeSpaceState = new AutomergeSpaceState();
|
|
3067
|
-
this._state =
|
|
3108
|
+
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
3109
|
+
this._state = import_services8.SpaceState.CLOSED;
|
|
3068
3110
|
this.error = void 0;
|
|
3069
3111
|
this.stateUpdate = new import_async10.Event();
|
|
3070
3112
|
this.metrics = {};
|
|
@@ -3086,10 +3128,10 @@ var DataSpace = class {
|
|
|
3086
3128
|
this._cache = params.cache;
|
|
3087
3129
|
this._state = params.initialState;
|
|
3088
3130
|
(0, import_log9.log)("new state", {
|
|
3089
|
-
state:
|
|
3131
|
+
state: import_services8.SpaceState[this._state]
|
|
3090
3132
|
}, {
|
|
3091
3133
|
F: __dxlog_file12,
|
|
3092
|
-
L:
|
|
3134
|
+
L: 141,
|
|
3093
3135
|
S: this,
|
|
3094
3136
|
C: (f, a) => f(...a)
|
|
3095
3137
|
});
|
|
@@ -3122,6 +3164,12 @@ var DataSpace = class {
|
|
|
3122
3164
|
get automergeSpaceState() {
|
|
3123
3165
|
return this._automergeSpaceState;
|
|
3124
3166
|
}
|
|
3167
|
+
get _automergeInfo() {
|
|
3168
|
+
return {
|
|
3169
|
+
rootUrl: this._automergeSpaceState.rootUrl,
|
|
3170
|
+
lastEpoch: this._automergeSpaceState.lastEpoch
|
|
3171
|
+
};
|
|
3172
|
+
}
|
|
3125
3173
|
async open() {
|
|
3126
3174
|
await this._open();
|
|
3127
3175
|
}
|
|
@@ -3131,12 +3179,12 @@ var DataSpace = class {
|
|
|
3131
3179
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
3132
3180
|
await this._inner.spaceState.addCredentialProcessor(this._automergeSpaceState);
|
|
3133
3181
|
await this._inner.open(new import_context6.Context());
|
|
3134
|
-
this._state =
|
|
3182
|
+
this._state = import_services8.SpaceState.CONTROL_ONLY;
|
|
3135
3183
|
(0, import_log9.log)("new state", {
|
|
3136
|
-
state:
|
|
3184
|
+
state: import_services8.SpaceState[this._state]
|
|
3137
3185
|
}, {
|
|
3138
3186
|
F: __dxlog_file12,
|
|
3139
|
-
L:
|
|
3187
|
+
L: 203,
|
|
3140
3188
|
S: this,
|
|
3141
3189
|
C: (f, a) => f(...a)
|
|
3142
3190
|
});
|
|
@@ -3149,12 +3197,12 @@ var DataSpace = class {
|
|
|
3149
3197
|
}
|
|
3150
3198
|
async _close() {
|
|
3151
3199
|
await this._callbacks.beforeClose?.();
|
|
3152
|
-
this._state =
|
|
3200
|
+
this._state = import_services8.SpaceState.CLOSED;
|
|
3153
3201
|
(0, import_log9.log)("new state", {
|
|
3154
|
-
state:
|
|
3202
|
+
state: import_services8.SpaceState[this._state]
|
|
3155
3203
|
}, {
|
|
3156
3204
|
F: __dxlog_file12,
|
|
3157
|
-
L:
|
|
3205
|
+
L: 217,
|
|
3158
3206
|
S: this,
|
|
3159
3207
|
C: (f, a) => f(...a)
|
|
3160
3208
|
});
|
|
@@ -3183,10 +3231,10 @@ var DataSpace = class {
|
|
|
3183
3231
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
3184
3232
|
await this.initializeDataPipeline();
|
|
3185
3233
|
} catch (err) {
|
|
3186
|
-
if (err instanceof
|
|
3234
|
+
if (err instanceof import_protocols8.CancelledError || err instanceof import_context6.ContextDisposedError) {
|
|
3187
3235
|
(0, import_log9.log)("data pipeline initialization cancelled", err, {
|
|
3188
3236
|
F: __dxlog_file12,
|
|
3189
|
-
L:
|
|
3237
|
+
L: 250,
|
|
3190
3238
|
S: this,
|
|
3191
3239
|
C: (f, a) => f(...a)
|
|
3192
3240
|
});
|
|
@@ -3194,16 +3242,16 @@ var DataSpace = class {
|
|
|
3194
3242
|
}
|
|
3195
3243
|
import_log9.log.error("Error initializing data pipeline", err, {
|
|
3196
3244
|
F: __dxlog_file12,
|
|
3197
|
-
L:
|
|
3245
|
+
L: 254,
|
|
3198
3246
|
S: this,
|
|
3199
3247
|
C: (f, a) => f(...a)
|
|
3200
3248
|
});
|
|
3201
|
-
this._state =
|
|
3249
|
+
this._state = import_services8.SpaceState.ERROR;
|
|
3202
3250
|
(0, import_log9.log)("new state", {
|
|
3203
|
-
state:
|
|
3251
|
+
state: import_services8.SpaceState[this._state]
|
|
3204
3252
|
}, {
|
|
3205
3253
|
F: __dxlog_file12,
|
|
3206
|
-
L:
|
|
3254
|
+
L: 256,
|
|
3207
3255
|
S: this,
|
|
3208
3256
|
C: (f, a) => f(...a)
|
|
3209
3257
|
});
|
|
@@ -3215,15 +3263,15 @@ var DataSpace = class {
|
|
|
3215
3263
|
});
|
|
3216
3264
|
}
|
|
3217
3265
|
async initializeDataPipeline() {
|
|
3218
|
-
if (this._state !==
|
|
3219
|
-
throw new
|
|
3266
|
+
if (this._state !== import_services8.SpaceState.CONTROL_ONLY) {
|
|
3267
|
+
throw new import_protocols8.SystemError("Invalid operation");
|
|
3220
3268
|
}
|
|
3221
|
-
this._state =
|
|
3269
|
+
this._state = import_services8.SpaceState.INITIALIZING;
|
|
3222
3270
|
(0, import_log9.log)("new state", {
|
|
3223
|
-
state:
|
|
3271
|
+
state: import_services8.SpaceState[this._state]
|
|
3224
3272
|
}, {
|
|
3225
3273
|
F: __dxlog_file12,
|
|
3226
|
-
L:
|
|
3274
|
+
L: 272,
|
|
3227
3275
|
S: this,
|
|
3228
3276
|
C: (f, a) => f(...a)
|
|
3229
3277
|
});
|
|
@@ -3234,7 +3282,7 @@ var DataSpace = class {
|
|
|
3234
3282
|
await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3235
3283
|
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3236
3284
|
F: __dxlog_file12,
|
|
3237
|
-
L:
|
|
3285
|
+
L: 286,
|
|
3238
3286
|
S: this,
|
|
3239
3287
|
C: (f, a) => f(...a)
|
|
3240
3288
|
});
|
|
@@ -3245,17 +3293,17 @@ var DataSpace = class {
|
|
|
3245
3293
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3246
3294
|
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
3247
3295
|
F: __dxlog_file12,
|
|
3248
|
-
L:
|
|
3296
|
+
L: 295,
|
|
3249
3297
|
S: this,
|
|
3250
3298
|
C: (f, a) => f(...a)
|
|
3251
3299
|
});
|
|
3252
3300
|
await this._callbacks.beforeReady?.();
|
|
3253
|
-
this._state =
|
|
3301
|
+
this._state = import_services8.SpaceState.READY;
|
|
3254
3302
|
(0, import_log9.log)("new state", {
|
|
3255
|
-
state:
|
|
3303
|
+
state: import_services8.SpaceState[this._state]
|
|
3256
3304
|
}, {
|
|
3257
3305
|
F: __dxlog_file12,
|
|
3258
|
-
L:
|
|
3306
|
+
L: 299,
|
|
3259
3307
|
S: this,
|
|
3260
3308
|
C: (f, a) => f(...a)
|
|
3261
3309
|
});
|
|
@@ -3271,7 +3319,7 @@ var DataSpace = class {
|
|
|
3271
3319
|
await this._createWritableFeeds();
|
|
3272
3320
|
(0, import_log9.log)("writable feeds created", void 0, {
|
|
3273
3321
|
F: __dxlog_file12,
|
|
3274
|
-
L:
|
|
3322
|
+
L: 315,
|
|
3275
3323
|
S: this,
|
|
3276
3324
|
C: (f, a) => f(...a)
|
|
3277
3325
|
});
|
|
@@ -3328,6 +3376,40 @@ var DataSpace = class {
|
|
|
3328
3376
|
await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
|
|
3329
3377
|
}
|
|
3330
3378
|
}
|
|
3379
|
+
_onNewAutomergeRoot(rootUrl) {
|
|
3380
|
+
(0, import_log9.log)("loading automerge root doc for space", {
|
|
3381
|
+
space: this.key,
|
|
3382
|
+
rootUrl
|
|
3383
|
+
}, {
|
|
3384
|
+
F: __dxlog_file12,
|
|
3385
|
+
L: 381,
|
|
3386
|
+
S: this,
|
|
3387
|
+
C: (f, a) => f(...a)
|
|
3388
|
+
});
|
|
3389
|
+
const handle = this._automergeHost.repo.find(rootUrl);
|
|
3390
|
+
queueMicrotask(async () => {
|
|
3391
|
+
try {
|
|
3392
|
+
await (0, import_async10.asyncTimeout)(handle.whenReady(), 5e3);
|
|
3393
|
+
const doc = handle.docSync() ?? (0, import_invariant10.failedInvariant)();
|
|
3394
|
+
if (!doc.experimental_spaceKey) {
|
|
3395
|
+
handle.change((doc2) => {
|
|
3396
|
+
doc2.experimental_spaceKey = this.key.toHex();
|
|
3397
|
+
});
|
|
3398
|
+
}
|
|
3399
|
+
} catch (err) {
|
|
3400
|
+
import_log9.log.warn("error loading automerge root doc", {
|
|
3401
|
+
space: this.key,
|
|
3402
|
+
rootUrl,
|
|
3403
|
+
err
|
|
3404
|
+
}, {
|
|
3405
|
+
F: __dxlog_file12,
|
|
3406
|
+
L: 394,
|
|
3407
|
+
S: this,
|
|
3408
|
+
C: (f, a) => f(...a)
|
|
3409
|
+
});
|
|
3410
|
+
}
|
|
3411
|
+
});
|
|
3412
|
+
}
|
|
3331
3413
|
// TODO(dmaretskyi): Use profile from signing context.
|
|
3332
3414
|
async updateOwnProfile(profile) {
|
|
3333
3415
|
const credential = await this._signingContext.credentialSigner.createCredential({
|
|
@@ -3347,12 +3429,12 @@ var DataSpace = class {
|
|
|
3347
3429
|
let epoch;
|
|
3348
3430
|
switch (options?.migration) {
|
|
3349
3431
|
case void 0:
|
|
3350
|
-
case
|
|
3432
|
+
case import_services8.CreateEpochRequest.Migration.NONE:
|
|
3351
3433
|
{
|
|
3352
3434
|
epoch = await this.dataPipeline.createEpoch();
|
|
3353
3435
|
}
|
|
3354
3436
|
break;
|
|
3355
|
-
case
|
|
3437
|
+
case import_services8.CreateEpochRequest.Migration.INIT_AUTOMERGE: {
|
|
3356
3438
|
const document = this._automergeHost.repo.create();
|
|
3357
3439
|
epoch = {
|
|
3358
3440
|
previousId: this._automergeSpaceState.lastEpoch?.id,
|
|
@@ -3393,31 +3475,47 @@ var DataSpace = class {
|
|
|
3393
3475
|
}
|
|
3394
3476
|
}
|
|
3395
3477
|
async activate() {
|
|
3396
|
-
if (this._state !==
|
|
3478
|
+
if (this._state !== import_services8.SpaceState.INACTIVE) {
|
|
3397
3479
|
return;
|
|
3398
3480
|
}
|
|
3399
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3481
|
+
await this._metadataStore.setSpaceState(this.key, import_services8.SpaceState.ACTIVE);
|
|
3400
3482
|
await this._open();
|
|
3401
3483
|
this.initializeDataPipelineAsync();
|
|
3402
3484
|
}
|
|
3403
3485
|
async deactivate() {
|
|
3404
|
-
if (this._state ===
|
|
3486
|
+
if (this._state === import_services8.SpaceState.INACTIVE) {
|
|
3405
3487
|
return;
|
|
3406
3488
|
}
|
|
3407
|
-
await this._metadataStore.setSpaceState(this.key,
|
|
3489
|
+
await this._metadataStore.setSpaceState(this.key, import_services8.SpaceState.INACTIVE);
|
|
3408
3490
|
await this._close();
|
|
3409
|
-
this._state =
|
|
3491
|
+
this._state = import_services8.SpaceState.INACTIVE;
|
|
3410
3492
|
(0, import_log9.log)("new state", {
|
|
3411
|
-
state:
|
|
3493
|
+
state: import_services8.SpaceState[this._state]
|
|
3412
3494
|
}, {
|
|
3413
3495
|
F: __dxlog_file12,
|
|
3414
|
-
L:
|
|
3496
|
+
L: 483,
|
|
3415
3497
|
S: this,
|
|
3416
3498
|
C: (f, a) => f(...a)
|
|
3417
3499
|
});
|
|
3418
3500
|
this.stateUpdate.emit();
|
|
3419
3501
|
}
|
|
3420
3502
|
};
|
|
3503
|
+
_ts_decorate4([
|
|
3504
|
+
import_tracing5.trace.info()
|
|
3505
|
+
], DataSpace.prototype, "_inner", void 0);
|
|
3506
|
+
_ts_decorate4([
|
|
3507
|
+
import_tracing5.trace.info()
|
|
3508
|
+
], DataSpace.prototype, "key", null);
|
|
3509
|
+
_ts_decorate4([
|
|
3510
|
+
import_tracing5.trace.info({
|
|
3511
|
+
enum: import_services8.SpaceState
|
|
3512
|
+
})
|
|
3513
|
+
], DataSpace.prototype, "state", null);
|
|
3514
|
+
_ts_decorate4([
|
|
3515
|
+
import_tracing5.trace.info({
|
|
3516
|
+
depth: null
|
|
3517
|
+
})
|
|
3518
|
+
], DataSpace.prototype, "_automergeInfo", null);
|
|
3421
3519
|
_ts_decorate4([
|
|
3422
3520
|
import_async10.synchronized
|
|
3423
3521
|
], DataSpace.prototype, "open", null);
|
|
@@ -3425,12 +3523,12 @@ _ts_decorate4([
|
|
|
3425
3523
|
import_async10.synchronized
|
|
3426
3524
|
], DataSpace.prototype, "close", null);
|
|
3427
3525
|
_ts_decorate4([
|
|
3428
|
-
|
|
3526
|
+
import_tracing5.trace.span({
|
|
3429
3527
|
showInBrowserTimeline: true
|
|
3430
3528
|
})
|
|
3431
3529
|
], DataSpace.prototype, "initializeDataPipeline", null);
|
|
3432
3530
|
_ts_decorate4([
|
|
3433
|
-
|
|
3531
|
+
import_tracing5.trace.span({
|
|
3434
3532
|
showInBrowserTimeline: true
|
|
3435
3533
|
})
|
|
3436
3534
|
], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
|
|
@@ -3444,7 +3542,8 @@ _ts_decorate4([
|
|
|
3444
3542
|
import_async10.synchronized
|
|
3445
3543
|
], DataSpace.prototype, "deactivate", null);
|
|
3446
3544
|
DataSpace = _ts_decorate4([
|
|
3447
|
-
(0, import_async10.trackLeaks)("open", "close")
|
|
3545
|
+
(0, import_async10.trackLeaks)("open", "close"),
|
|
3546
|
+
import_tracing5.trace.resource()
|
|
3448
3547
|
], DataSpace);
|
|
3449
3548
|
var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
|
|
3450
3549
|
const credentials = [
|
|
@@ -3549,7 +3648,7 @@ var DataSpaceManager = class {
|
|
|
3549
3648
|
S: this,
|
|
3550
3649
|
C: (f, a) => f(...a)
|
|
3551
3650
|
});
|
|
3552
|
-
import_log11.log.trace("dxos.echo.data-space-manager.open",
|
|
3651
|
+
import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.begin({
|
|
3553
3652
|
id: this._instanceId
|
|
3554
3653
|
}), {
|
|
3555
3654
|
F: __dxlog_file13,
|
|
@@ -3591,11 +3690,11 @@ var DataSpaceManager = class {
|
|
|
3591
3690
|
this._isOpen = true;
|
|
3592
3691
|
this.updated.emit();
|
|
3593
3692
|
for (const space of this._spaces.values()) {
|
|
3594
|
-
if (space.state !==
|
|
3693
|
+
if (space.state !== import_services9.SpaceState.INACTIVE) {
|
|
3595
3694
|
space.initializeDataPipelineAsync();
|
|
3596
3695
|
}
|
|
3597
3696
|
}
|
|
3598
|
-
import_log11.log.trace("dxos.echo.data-space-manager.open",
|
|
3697
|
+
import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.end({
|
|
3599
3698
|
id: this._instanceId
|
|
3600
3699
|
}), {
|
|
3601
3700
|
F: __dxlog_file13,
|
|
@@ -3621,7 +3720,7 @@ var DataSpaceManager = class {
|
|
|
3621
3720
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
3622
3721
|
*/
|
|
3623
3722
|
async createSpace() {
|
|
3624
|
-
(0,
|
|
3723
|
+
(0, import_invariant12.invariant)(this._isOpen, "Not open.", {
|
|
3625
3724
|
F: __dxlog_file13,
|
|
3626
3725
|
L: 130,
|
|
3627
3726
|
S: this,
|
|
@@ -3638,7 +3737,7 @@ var DataSpaceManager = class {
|
|
|
3638
3737
|
genesisFeedKey: controlFeedKey,
|
|
3639
3738
|
controlFeedKey,
|
|
3640
3739
|
dataFeedKey,
|
|
3641
|
-
state:
|
|
3740
|
+
state: import_services9.SpaceState.ACTIVE
|
|
3642
3741
|
};
|
|
3643
3742
|
(0, import_log11.log)("creating space...", {
|
|
3644
3743
|
spaceKey
|
|
@@ -3650,12 +3749,15 @@ var DataSpaceManager = class {
|
|
|
3650
3749
|
});
|
|
3651
3750
|
const space = await this._constructSpace(metadata);
|
|
3652
3751
|
const automergeRoot = this._automergeHost.repo.create();
|
|
3752
|
+
automergeRoot.change((doc) => {
|
|
3753
|
+
doc.experimental_spaceKey = spaceKey.toHex();
|
|
3754
|
+
});
|
|
3653
3755
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
|
|
3654
3756
|
await this._metadataStore.addSpace(metadata);
|
|
3655
3757
|
const memberCredential = credentials[1];
|
|
3656
|
-
(0,
|
|
3758
|
+
(0, import_invariant12.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3657
3759
|
F: __dxlog_file13,
|
|
3658
|
-
L:
|
|
3760
|
+
L: 154,
|
|
3659
3761
|
S: this,
|
|
3660
3762
|
A: [
|
|
3661
3763
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3673,22 +3775,22 @@ var DataSpaceManager = class {
|
|
|
3673
3775
|
opts
|
|
3674
3776
|
}, {
|
|
3675
3777
|
F: __dxlog_file13,
|
|
3676
|
-
L:
|
|
3778
|
+
L: 166,
|
|
3677
3779
|
S: this,
|
|
3678
3780
|
C: (f, a) => f(...a)
|
|
3679
3781
|
});
|
|
3680
|
-
(0,
|
|
3782
|
+
(0, import_invariant12.invariant)(this._isOpen, "Not open.", {
|
|
3681
3783
|
F: __dxlog_file13,
|
|
3682
|
-
L:
|
|
3784
|
+
L: 167,
|
|
3683
3785
|
S: this,
|
|
3684
3786
|
A: [
|
|
3685
3787
|
"this._isOpen",
|
|
3686
3788
|
"'Not open.'"
|
|
3687
3789
|
]
|
|
3688
3790
|
});
|
|
3689
|
-
(0,
|
|
3791
|
+
(0, import_invariant12.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
3690
3792
|
F: __dxlog_file13,
|
|
3691
|
-
L:
|
|
3793
|
+
L: 168,
|
|
3692
3794
|
S: this,
|
|
3693
3795
|
A: [
|
|
3694
3796
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -3715,7 +3817,7 @@ var DataSpaceManager = class {
|
|
|
3715
3817
|
async waitUntilSpaceReady(spaceKey) {
|
|
3716
3818
|
await (0, import_context8.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
|
|
3717
3819
|
const space = this._spaces.get(spaceKey);
|
|
3718
|
-
return !!space && space.state ===
|
|
3820
|
+
return !!space && space.state === import_services9.SpaceState.READY;
|
|
3719
3821
|
}));
|
|
3720
3822
|
}
|
|
3721
3823
|
async _constructSpace(metadata) {
|
|
@@ -3723,7 +3825,7 @@ var DataSpaceManager = class {
|
|
|
3723
3825
|
metadata
|
|
3724
3826
|
}, {
|
|
3725
3827
|
F: __dxlog_file13,
|
|
3726
|
-
L:
|
|
3828
|
+
L: 201,
|
|
3727
3829
|
S: this,
|
|
3728
3830
|
C: (f, a) => f(...a)
|
|
3729
3831
|
});
|
|
@@ -3750,17 +3852,18 @@ var DataSpaceManager = class {
|
|
|
3750
3852
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
3751
3853
|
credentialAuthenticator: (0, import_util6.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
3752
3854
|
},
|
|
3753
|
-
|
|
3855
|
+
onAuthorizedConnection: (session) => {
|
|
3754
3856
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
3755
3857
|
remotePeerId: session.remotePeerId
|
|
3756
3858
|
}));
|
|
3757
3859
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
3860
|
+
this._automergeHost.authorizeDevice(space.key, session.remotePeerId);
|
|
3758
3861
|
session.addExtension("dxos.mesh.teleport.automerge", this._automergeHost.createExtension());
|
|
3759
3862
|
},
|
|
3760
3863
|
onAuthFailure: () => {
|
|
3761
3864
|
import_log11.log.warn("auth failure", void 0, {
|
|
3762
3865
|
F: __dxlog_file13,
|
|
3763
|
-
L:
|
|
3866
|
+
L: 238,
|
|
3764
3867
|
S: this,
|
|
3765
3868
|
C: (f, a) => f(...a)
|
|
3766
3869
|
});
|
|
@@ -3771,7 +3874,7 @@ var DataSpaceManager = class {
|
|
|
3771
3874
|
dataFeed && space.setDataFeed(dataFeed);
|
|
3772
3875
|
const dataSpace = new DataSpace({
|
|
3773
3876
|
inner: space,
|
|
3774
|
-
initialState: metadata.state ===
|
|
3877
|
+
initialState: metadata.state === import_services9.SpaceState.INACTIVE ? import_services9.SpaceState.INACTIVE : import_services9.SpaceState.CLOSED,
|
|
3775
3878
|
metadataStore: this._metadataStore,
|
|
3776
3879
|
gossip,
|
|
3777
3880
|
presence,
|
|
@@ -3784,7 +3887,7 @@ var DataSpaceManager = class {
|
|
|
3784
3887
|
space: space.key
|
|
3785
3888
|
}, {
|
|
3786
3889
|
F: __dxlog_file13,
|
|
3787
|
-
L:
|
|
3890
|
+
L: 256,
|
|
3788
3891
|
S: this,
|
|
3789
3892
|
C: (f, a) => f(...a)
|
|
3790
3893
|
});
|
|
@@ -3796,7 +3899,7 @@ var DataSpaceManager = class {
|
|
|
3796
3899
|
open: this._isOpen
|
|
3797
3900
|
}, {
|
|
3798
3901
|
F: __dxlog_file13,
|
|
3799
|
-
L:
|
|
3902
|
+
L: 263,
|
|
3800
3903
|
S: this,
|
|
3801
3904
|
C: (f, a) => f(...a)
|
|
3802
3905
|
});
|
|
@@ -3809,7 +3912,7 @@ var DataSpaceManager = class {
|
|
|
3809
3912
|
space: space.key
|
|
3810
3913
|
}, {
|
|
3811
3914
|
F: __dxlog_file13,
|
|
3812
|
-
L:
|
|
3915
|
+
L: 269,
|
|
3813
3916
|
S: this,
|
|
3814
3917
|
C: (f, a) => f(...a)
|
|
3815
3918
|
});
|
|
@@ -3819,7 +3922,7 @@ var DataSpaceManager = class {
|
|
|
3819
3922
|
cache: metadata.cache,
|
|
3820
3923
|
automergeHost: this._automergeHost
|
|
3821
3924
|
});
|
|
3822
|
-
if (metadata.state !==
|
|
3925
|
+
if (metadata.state !== import_services9.SpaceState.INACTIVE) {
|
|
3823
3926
|
await dataSpace.open();
|
|
3824
3927
|
}
|
|
3825
3928
|
if (metadata.controlTimeframe) {
|
|
@@ -3857,7 +3960,7 @@ var SpacesServiceImpl = class {
|
|
|
3857
3960
|
}
|
|
3858
3961
|
async createSpace() {
|
|
3859
3962
|
if (!this._identityManager.identity) {
|
|
3860
|
-
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/halo");
|
|
3963
|
+
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo");
|
|
3861
3964
|
}
|
|
3862
3965
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3863
3966
|
const space = await dataSpaceManager.createSpace();
|
|
@@ -3865,17 +3968,17 @@ var SpacesServiceImpl = class {
|
|
|
3865
3968
|
}
|
|
3866
3969
|
async updateSpace({ spaceKey, state }) {
|
|
3867
3970
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3868
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3971
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3869
3972
|
if (state) {
|
|
3870
3973
|
switch (state) {
|
|
3871
|
-
case
|
|
3974
|
+
case import_services10.SpaceState.ACTIVE:
|
|
3872
3975
|
await space.activate();
|
|
3873
3976
|
break;
|
|
3874
|
-
case
|
|
3977
|
+
case import_services10.SpaceState.INACTIVE:
|
|
3875
3978
|
await space.deactivate();
|
|
3876
3979
|
break;
|
|
3877
3980
|
default:
|
|
3878
|
-
throw new
|
|
3981
|
+
throw new import_protocols11.ApiError("Invalid space state");
|
|
3879
3982
|
}
|
|
3880
3983
|
}
|
|
3881
3984
|
}
|
|
@@ -3930,14 +4033,14 @@ var SpacesServiceImpl = class {
|
|
|
3930
4033
|
}
|
|
3931
4034
|
async postMessage({ spaceKey, channel, message }) {
|
|
3932
4035
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3933
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4036
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3934
4037
|
await space.postMessage(getChannelId(channel), message);
|
|
3935
4038
|
}
|
|
3936
4039
|
subscribeMessages({ spaceKey, channel }) {
|
|
3937
4040
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
3938
4041
|
(0, import_async13.scheduleTask)(ctx, async () => {
|
|
3939
4042
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3940
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4043
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3941
4044
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
3942
4045
|
next(message);
|
|
3943
4046
|
});
|
|
@@ -3947,7 +4050,7 @@ var SpacesServiceImpl = class {
|
|
|
3947
4050
|
}
|
|
3948
4051
|
queryCredentials({ spaceKey, noTail }) {
|
|
3949
4052
|
return new import_codec_protobuf11.Stream(({ ctx, next, close }) => {
|
|
3950
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4053
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3951
4054
|
const processor = {
|
|
3952
4055
|
processCredential: async (credential) => {
|
|
3953
4056
|
next(credential);
|
|
@@ -3963,7 +4066,7 @@ var SpacesServiceImpl = class {
|
|
|
3963
4066
|
});
|
|
3964
4067
|
}
|
|
3965
4068
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3966
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4069
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3967
4070
|
for (const credential of credentials ?? []) {
|
|
3968
4071
|
if (credential.proof) {
|
|
3969
4072
|
await space.controlPipeline.writer.write({
|
|
@@ -3972,7 +4075,7 @@ var SpacesServiceImpl = class {
|
|
|
3972
4075
|
}
|
|
3973
4076
|
});
|
|
3974
4077
|
} else {
|
|
3975
|
-
(0,
|
|
4078
|
+
(0, import_invariant13.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
3976
4079
|
F: __dxlog_file14,
|
|
3977
4080
|
L: 168,
|
|
3978
4081
|
S: this,
|
|
@@ -3981,7 +4084,7 @@ var SpacesServiceImpl = class {
|
|
|
3981
4084
|
"'Id on unsigned credentials is not allowed'"
|
|
3982
4085
|
]
|
|
3983
4086
|
});
|
|
3984
|
-
(0,
|
|
4087
|
+
(0, import_invariant13.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
3985
4088
|
F: __dxlog_file14,
|
|
3986
4089
|
L: 169,
|
|
3987
4090
|
S: this,
|
|
@@ -3991,7 +4094,7 @@ var SpacesServiceImpl = class {
|
|
|
3991
4094
|
]
|
|
3992
4095
|
});
|
|
3993
4096
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
3994
|
-
(0,
|
|
4097
|
+
(0, import_invariant13.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
3995
4098
|
F: __dxlog_file14,
|
|
3996
4099
|
L: 171,
|
|
3997
4100
|
S: this,
|
|
@@ -4014,14 +4117,14 @@ var SpacesServiceImpl = class {
|
|
|
4014
4117
|
}
|
|
4015
4118
|
async createEpoch({ spaceKey }) {
|
|
4016
4119
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4017
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4120
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
4018
4121
|
await space.createEpoch();
|
|
4019
4122
|
}
|
|
4020
4123
|
_serializeSpace(space) {
|
|
4021
4124
|
return {
|
|
4022
4125
|
spaceKey: space.key,
|
|
4023
4126
|
state: space.state,
|
|
4024
|
-
error: space.error ? (0,
|
|
4127
|
+
error: space.error ? (0, import_protocols11.encodeError)(space.error) : void 0,
|
|
4025
4128
|
pipeline: {
|
|
4026
4129
|
currentEpoch: space.dataPipeline.currentEpoch,
|
|
4027
4130
|
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
@@ -4048,7 +4151,7 @@ var SpacesServiceImpl = class {
|
|
|
4048
4151
|
displayName: member.profile?.displayName
|
|
4049
4152
|
}
|
|
4050
4153
|
},
|
|
4051
|
-
presence: member.removed ?
|
|
4154
|
+
presence: member.removed ? import_services10.SpaceMember.PresenceState.REMOVED : isMe || peers.length > 0 ? import_services10.SpaceMember.PresenceState.ONLINE : import_services10.SpaceMember.PresenceState.OFFLINE,
|
|
4052
4155
|
peerStates: peers
|
|
4053
4156
|
};
|
|
4054
4157
|
}),
|
|
@@ -4105,7 +4208,7 @@ var ServiceContext = class {
|
|
|
4105
4208
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
4106
4209
|
this.automergeHost = new import_echo_pipeline2.AutomergeHost(storage.createDirectory("automerge"));
|
|
4107
4210
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
4108
|
-
this._handlerFactories.set(
|
|
4211
|
+
this._handlerFactories.set(import_services11.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? (0, import_debug7.failUndefined)(), this._acceptIdentity.bind(this)));
|
|
4109
4212
|
}
|
|
4110
4213
|
async open(ctx) {
|
|
4111
4214
|
await this._checkStorageVersion();
|
|
@@ -4115,7 +4218,7 @@ var ServiceContext = class {
|
|
|
4115
4218
|
S: this,
|
|
4116
4219
|
C: (f, a) => f(...a)
|
|
4117
4220
|
});
|
|
4118
|
-
import_log13.log.trace("dxos.sdk.service-context.open",
|
|
4221
|
+
import_log13.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.begin({
|
|
4119
4222
|
id: this._instanceId
|
|
4120
4223
|
}), {
|
|
4121
4224
|
F: __dxlog_file15,
|
|
@@ -4131,7 +4234,7 @@ var ServiceContext = class {
|
|
|
4131
4234
|
if (this.identityManager.identity) {
|
|
4132
4235
|
await this._initialize(ctx);
|
|
4133
4236
|
}
|
|
4134
|
-
import_log13.log.trace("dxos.sdk.service-context.open",
|
|
4237
|
+
import_log13.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.end({
|
|
4135
4238
|
id: this._instanceId
|
|
4136
4239
|
}), {
|
|
4137
4240
|
F: __dxlog_file15,
|
|
@@ -4179,7 +4282,7 @@ var ServiceContext = class {
|
|
|
4179
4282
|
}
|
|
4180
4283
|
getInvitationHandler(invitation) {
|
|
4181
4284
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4182
|
-
(0,
|
|
4285
|
+
(0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4183
4286
|
F: __dxlog_file15,
|
|
4184
4287
|
L: 173,
|
|
4185
4288
|
S: this,
|
|
@@ -4205,8 +4308,8 @@ var ServiceContext = class {
|
|
|
4205
4308
|
}
|
|
4206
4309
|
async _checkStorageVersion() {
|
|
4207
4310
|
await this.metadataStore.load();
|
|
4208
|
-
if (this.metadataStore.version !==
|
|
4209
|
-
throw new
|
|
4311
|
+
if (this.metadataStore.version !== import_protocols12.STORAGE_VERSION) {
|
|
4312
|
+
throw new import_protocols12.InvalidStorageVersionError(import_protocols12.STORAGE_VERSION, this.metadataStore.version);
|
|
4210
4313
|
}
|
|
4211
4314
|
}
|
|
4212
4315
|
// Called when identity is created.
|
|
@@ -4233,8 +4336,8 @@ var ServiceContext = class {
|
|
|
4233
4336
|
};
|
|
4234
4337
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4235
4338
|
await this.dataSpaceManager.open();
|
|
4236
|
-
this._handlerFactories.set(
|
|
4237
|
-
(0,
|
|
4339
|
+
this._handlerFactories.set(import_services11.Invitation.Kind.SPACE, (invitation) => {
|
|
4340
|
+
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4238
4341
|
F: __dxlog_file15,
|
|
4239
4342
|
L: 228,
|
|
4240
4343
|
S: this,
|
|
@@ -4304,14 +4407,14 @@ var ServiceContext = class {
|
|
|
4304
4407
|
}
|
|
4305
4408
|
};
|
|
4306
4409
|
_ts_decorate6([
|
|
4307
|
-
|
|
4410
|
+
import_tracing6.trace.span()
|
|
4308
4411
|
], ServiceContext.prototype, "open", null);
|
|
4309
4412
|
_ts_decorate6([
|
|
4310
|
-
|
|
4413
|
+
import_tracing6.trace.span()
|
|
4311
4414
|
], ServiceContext.prototype, "_initialize", null);
|
|
4312
4415
|
ServiceContext = _ts_decorate6([
|
|
4313
4416
|
(0, import_util7.safeInstanceof)("dxos.client-services.ServiceContext"),
|
|
4314
|
-
|
|
4417
|
+
import_tracing6.trace.resource()
|
|
4315
4418
|
], ServiceContext);
|
|
4316
4419
|
var ServiceRegistry = class {
|
|
4317
4420
|
// prettier-ignore
|
|
@@ -4373,7 +4476,7 @@ var Lock = class {
|
|
|
4373
4476
|
}
|
|
4374
4477
|
async release() {
|
|
4375
4478
|
await this._onRelease?.();
|
|
4376
|
-
(0,
|
|
4479
|
+
(0, import_invariant15.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
4377
4480
|
F: __dxlog_file16,
|
|
4378
4481
|
L: 42,
|
|
4379
4482
|
S: this,
|
|
@@ -4393,16 +4496,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
|
4393
4496
|
var createStorageObjects = (config) => {
|
|
4394
4497
|
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4395
4498
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4396
|
-
throw new
|
|
4499
|
+
throw new import_protocols13.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4397
4500
|
}
|
|
4398
4501
|
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
4399
|
-
throw new
|
|
4502
|
+
throw new import_protocols13.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4400
4503
|
}
|
|
4401
4504
|
if (persistent && keyStore === StorageDriver.RAM) {
|
|
4402
|
-
throw new
|
|
4505
|
+
throw new import_protocols13.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4403
4506
|
}
|
|
4404
4507
|
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
4405
|
-
throw new
|
|
4508
|
+
throw new import_protocols13.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4406
4509
|
}
|
|
4407
4510
|
return {
|
|
4408
4511
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -4450,7 +4553,7 @@ var DevicesServiceImpl = class {
|
|
|
4450
4553
|
next({
|
|
4451
4554
|
devices: Array.from(deviceKeys.entries()).map(([key, profile]) => ({
|
|
4452
4555
|
deviceKey: key,
|
|
4453
|
-
kind: this._identityManager.identity?.deviceKey.equals(key) ?
|
|
4556
|
+
kind: this._identityManager.identity?.deviceKey.equals(key) ? import_services13.DeviceKind.CURRENT : import_services13.DeviceKind.TRUSTED,
|
|
4454
4557
|
profile
|
|
4455
4558
|
}))
|
|
4456
4559
|
});
|
|
@@ -4565,16 +4668,16 @@ var LoggingServiceImpl = class {
|
|
|
4565
4668
|
};
|
|
4566
4669
|
var matchFilter = (filter, level, path, options) => {
|
|
4567
4670
|
switch (options) {
|
|
4568
|
-
case
|
|
4671
|
+
case import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE:
|
|
4569
4672
|
return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
4570
|
-
case
|
|
4673
|
+
case import_services14.QueryLogsRequest.MatchingOptions.EXPLICIT:
|
|
4571
4674
|
return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
|
|
4572
4675
|
}
|
|
4573
4676
|
};
|
|
4574
4677
|
var shouldLog = (entry2, request) => {
|
|
4575
|
-
const options = request.options ??
|
|
4678
|
+
const options = request.options ?? import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
4576
4679
|
if (request.filters === void 0) {
|
|
4577
|
-
return options ===
|
|
4680
|
+
return options === import_services14.QueryLogsRequest.MatchingOptions.INCLUSIVE;
|
|
4578
4681
|
} else {
|
|
4579
4682
|
return request.filters.some((filter) => matchFilter(filter, entry2.level, entry2.meta?.F ?? "", options));
|
|
4580
4683
|
}
|
|
@@ -4590,6 +4693,7 @@ var NetworkServiceImpl = class {
|
|
|
4590
4693
|
const update = () => {
|
|
4591
4694
|
next({
|
|
4592
4695
|
swarm: this.networkManager.connectionState,
|
|
4696
|
+
connectionInfo: this.networkManager.connectionLog?.swarms,
|
|
4593
4697
|
signaling: this.signalManager.getStatus().map(({ host, state }) => ({
|
|
4594
4698
|
server: host,
|
|
4595
4699
|
state
|
|
@@ -4629,11 +4733,14 @@ var SystemServiceImpl = class {
|
|
|
4629
4733
|
return {
|
|
4630
4734
|
timestamp: /* @__PURE__ */ new Date(),
|
|
4631
4735
|
diagnostics: JSON.parse(JSON.stringify(diagnostics, (0, import_util10.jsonKeyReplacer)({
|
|
4632
|
-
truncate: keys ===
|
|
4633
|
-
humanize: keys ===
|
|
4736
|
+
truncate: keys === import_services15.GetDiagnosticsRequest.KEY_OPTION.TRUNCATE,
|
|
4737
|
+
humanize: keys === import_services15.GetDiagnosticsRequest.KEY_OPTION.HUMANIZE
|
|
4634
4738
|
})))
|
|
4635
4739
|
};
|
|
4636
4740
|
}
|
|
4741
|
+
async getPlatform() {
|
|
4742
|
+
return getPlatform();
|
|
4743
|
+
}
|
|
4637
4744
|
async updateStatus({ status }) {
|
|
4638
4745
|
await this._onUpdateStatus(status);
|
|
4639
4746
|
}
|
|
@@ -4695,7 +4802,7 @@ var ClientServicesHost = class {
|
|
|
4695
4802
|
lockKey,
|
|
4696
4803
|
callbacks
|
|
4697
4804
|
} = {}) {
|
|
4698
|
-
this._tracingService =
|
|
4805
|
+
this._tracingService = import_tracing7.TRACE_PROCESSOR.createTraceSender();
|
|
4699
4806
|
this._statusUpdate = new import_async15.Event();
|
|
4700
4807
|
this._opening = false;
|
|
4701
4808
|
this._open = false;
|
|
@@ -4723,14 +4830,14 @@ var ClientServicesHost = class {
|
|
|
4723
4830
|
this._systemService = new SystemServiceImpl({
|
|
4724
4831
|
config: this._config,
|
|
4725
4832
|
statusUpdate: this._statusUpdate,
|
|
4726
|
-
getCurrentStatus: () => this.isOpen ?
|
|
4833
|
+
getCurrentStatus: () => this.isOpen ? import_services12.SystemStatus.ACTIVE : import_services12.SystemStatus.INACTIVE,
|
|
4727
4834
|
getDiagnostics: () => {
|
|
4728
4835
|
return createDiagnostics(this._serviceRegistry.services, this._serviceContext, this._config);
|
|
4729
4836
|
},
|
|
4730
4837
|
onUpdateStatus: async (status) => {
|
|
4731
|
-
if (!this.isOpen && status ===
|
|
4838
|
+
if (!this.isOpen && status === import_services12.SystemStatus.ACTIVE) {
|
|
4732
4839
|
await this._resourceLock?.acquire();
|
|
4733
|
-
} else if (this.isOpen && status ===
|
|
4840
|
+
} else if (this.isOpen && status === import_services12.SystemStatus.INACTIVE) {
|
|
4734
4841
|
await this._resourceLock?.release();
|
|
4735
4842
|
}
|
|
4736
4843
|
},
|
|
@@ -4768,7 +4875,7 @@ var ClientServicesHost = class {
|
|
|
4768
4875
|
* Can only be called once.
|
|
4769
4876
|
*/
|
|
4770
4877
|
initialize({ config, ...options }) {
|
|
4771
|
-
(0,
|
|
4878
|
+
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
4772
4879
|
F: __dxlog_file17,
|
|
4773
4880
|
L: 201,
|
|
4774
4881
|
S: this,
|
|
@@ -4784,7 +4891,7 @@ var ClientServicesHost = class {
|
|
|
4784
4891
|
C: (f, a) => f(...a)
|
|
4785
4892
|
});
|
|
4786
4893
|
if (config) {
|
|
4787
|
-
(0,
|
|
4894
|
+
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
4788
4895
|
F: __dxlog_file17,
|
|
4789
4896
|
L: 205,
|
|
4790
4897
|
S: this,
|
|
@@ -4802,7 +4909,7 @@ var ClientServicesHost = class {
|
|
|
4802
4909
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4803
4910
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4804
4911
|
this._signalManager = signalManager;
|
|
4805
|
-
(0,
|
|
4912
|
+
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
4806
4913
|
F: __dxlog_file17,
|
|
4807
4914
|
L: 221,
|
|
4808
4915
|
S: this,
|
|
@@ -4828,7 +4935,7 @@ var ClientServicesHost = class {
|
|
|
4828
4935
|
return;
|
|
4829
4936
|
}
|
|
4830
4937
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
4831
|
-
import_log15.log.trace("dxos.client-services.host.open",
|
|
4938
|
+
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.begin({
|
|
4832
4939
|
id: traceId
|
|
4833
4940
|
}), {
|
|
4834
4941
|
F: __dxlog_file17,
|
|
@@ -4836,7 +4943,7 @@ var ClientServicesHost = class {
|
|
|
4836
4943
|
S: this,
|
|
4837
4944
|
C: (f, a) => f(...a)
|
|
4838
4945
|
});
|
|
4839
|
-
(0,
|
|
4946
|
+
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
4840
4947
|
F: __dxlog_file17,
|
|
4841
4948
|
L: 241,
|
|
4842
4949
|
S: this,
|
|
@@ -4845,7 +4952,7 @@ var ClientServicesHost = class {
|
|
|
4845
4952
|
"'config not set'"
|
|
4846
4953
|
]
|
|
4847
4954
|
});
|
|
4848
|
-
(0,
|
|
4955
|
+
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
4849
4956
|
F: __dxlog_file17,
|
|
4850
4957
|
L: 242,
|
|
4851
4958
|
S: this,
|
|
@@ -4854,7 +4961,7 @@ var ClientServicesHost = class {
|
|
|
4854
4961
|
"'storage not set'"
|
|
4855
4962
|
]
|
|
4856
4963
|
});
|
|
4857
|
-
(0,
|
|
4964
|
+
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
4858
4965
|
F: __dxlog_file17,
|
|
4859
4966
|
L: 243,
|
|
4860
4967
|
S: this,
|
|
@@ -4863,7 +4970,7 @@ var ClientServicesHost = class {
|
|
|
4863
4970
|
"'signal manager not set'"
|
|
4864
4971
|
]
|
|
4865
4972
|
});
|
|
4866
|
-
(0,
|
|
4973
|
+
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
4867
4974
|
F: __dxlog_file17,
|
|
4868
4975
|
L: 244,
|
|
4869
4976
|
S: this,
|
|
@@ -4927,7 +5034,7 @@ var ClientServicesHost = class {
|
|
|
4927
5034
|
S: this,
|
|
4928
5035
|
C: (f, a) => f(...a)
|
|
4929
5036
|
});
|
|
4930
|
-
import_log15.log.trace("dxos.client-services.host.open",
|
|
5037
|
+
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.end({
|
|
4931
5038
|
id: traceId
|
|
4932
5039
|
}), {
|
|
4933
5040
|
F: __dxlog_file17,
|
|
@@ -4968,7 +5075,7 @@ var ClientServicesHost = class {
|
|
|
4968
5075
|
}
|
|
4969
5076
|
async reset() {
|
|
4970
5077
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
4971
|
-
import_log15.log.trace("dxos.sdk.client-services-host.reset",
|
|
5078
|
+
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.begin({
|
|
4972
5079
|
id: traceId
|
|
4973
5080
|
}), {
|
|
4974
5081
|
F: __dxlog_file17,
|
|
@@ -4990,7 +5097,7 @@ var ClientServicesHost = class {
|
|
|
4990
5097
|
S: this,
|
|
4991
5098
|
C: (f, a) => f(...a)
|
|
4992
5099
|
});
|
|
4993
|
-
import_log15.log.trace("dxos.sdk.client-services-host.reset",
|
|
5100
|
+
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.end({
|
|
4994
5101
|
id: traceId
|
|
4995
5102
|
}), {
|
|
4996
5103
|
F: __dxlog_file17,
|
|
@@ -5022,7 +5129,7 @@ var ClientServicesHost = class {
|
|
|
5022
5129
|
});
|
|
5023
5130
|
} else {
|
|
5024
5131
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5025
|
-
(0,
|
|
5132
|
+
(0, import_invariant16.invariant)(automergeIndex, void 0, {
|
|
5026
5133
|
F: __dxlog_file17,
|
|
5027
5134
|
L: 375,
|
|
5028
5135
|
S: this,
|
|
@@ -5042,21 +5149,21 @@ var ClientServicesHost = class {
|
|
|
5042
5149
|
}
|
|
5043
5150
|
};
|
|
5044
5151
|
_ts_decorate8([
|
|
5045
|
-
|
|
5152
|
+
import_tracing7.trace.info()
|
|
5046
5153
|
], ClientServicesHost.prototype, "_opening", void 0);
|
|
5047
5154
|
_ts_decorate8([
|
|
5048
|
-
|
|
5155
|
+
import_tracing7.trace.info()
|
|
5049
5156
|
], ClientServicesHost.prototype, "_open", void 0);
|
|
5050
5157
|
_ts_decorate8([
|
|
5051
5158
|
import_async15.synchronized,
|
|
5052
|
-
|
|
5159
|
+
import_tracing7.trace.span()
|
|
5053
5160
|
], ClientServicesHost.prototype, "open", null);
|
|
5054
5161
|
_ts_decorate8([
|
|
5055
5162
|
import_async15.synchronized,
|
|
5056
|
-
|
|
5163
|
+
import_tracing7.trace.span()
|
|
5057
5164
|
], ClientServicesHost.prototype, "close", null);
|
|
5058
5165
|
ClientServicesHost = _ts_decorate8([
|
|
5059
|
-
|
|
5166
|
+
import_tracing7.trace.resource()
|
|
5060
5167
|
], ClientServicesHost);
|
|
5061
5168
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5062
5169
|
0 && (module.exports = {
|
|
@@ -5092,4 +5199,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5092
5199
|
subscribeToSpaces,
|
|
5093
5200
|
subscribeToSwarmInfo
|
|
5094
5201
|
});
|
|
5095
|
-
//# sourceMappingURL=chunk-
|
|
5202
|
+
//# sourceMappingURL=chunk-LS6Q564P.cjs.map
|