@dxos/client-services 0.3.11-main.c86e105 → 0.3.11-main.c95bc86
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-DYGDMYBC.mjs → chunk-4ZZIUZXZ.mjs} +153 -77
- package/dist/lib/browser/chunk-4ZZIUZXZ.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-5SWPWBZB.cjs → chunk-KA7FPK35.cjs} +240 -164
- package/dist/lib/node/chunk-KA7FPK35.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/services/diagnostics.d.ts +4 -0
- package/dist/types/src/packlets/services/diagnostics.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 +1 -0
- package/dist/types/src/packlets/spaces/data-space.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/services/diagnostics.ts +18 -0
- 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 +21 -1
- package/src/packlets/spaces/spaces-service.ts +1 -1
- package/src/packlets/testing/invitation-utils.ts +2 -10
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-DYGDMYBC.mjs.map +0 -7
- package/dist/lib/node/chunk-5SWPWBZB.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_KA7FPK35_exports = {};
|
|
30
|
+
__export(chunk_KA7FPK35_exports, {
|
|
31
31
|
ClientRpcServer: () => ClientRpcServer,
|
|
32
32
|
ClientServicesHost: () => ClientServicesHost,
|
|
33
33
|
DataSpace: () => DataSpace,
|
|
@@ -60,7 +60,7 @@ __export(chunk_5SWPWBZB_exports, {
|
|
|
60
60
|
subscribeToSpaces: () => subscribeToSpaces,
|
|
61
61
|
subscribeToSwarmInfo: () => subscribeToSwarmInfo
|
|
62
62
|
});
|
|
63
|
-
module.exports = __toCommonJS(
|
|
63
|
+
module.exports = __toCommonJS(chunk_KA7FPK35_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,16 +151,17 @@ 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");
|
|
154
156
|
var import_async10 = require("@dxos/async");
|
|
155
157
|
var import_client_protocol3 = require("@dxos/client-protocol");
|
|
156
158
|
var import_context6 = require("@dxos/context");
|
|
157
159
|
var import_debug4 = require("@dxos/debug");
|
|
158
160
|
var import_echo_pipeline = require("@dxos/echo-pipeline");
|
|
161
|
+
var import_invariant10 = require("@dxos/invariant");
|
|
159
162
|
var import_keys7 = require("@dxos/keys");
|
|
160
163
|
var import_log9 = require("@dxos/log");
|
|
161
|
-
var
|
|
164
|
+
var import_protocols8 = require("@dxos/protocols");
|
|
162
165
|
var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
|
|
163
166
|
var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
|
|
164
167
|
var import_timeframe2 = require("@dxos/timeframe");
|
|
@@ -167,19 +170,19 @@ var import_util4 = require("@dxos/util");
|
|
|
167
170
|
var import_credentials11 = require("@dxos/credentials");
|
|
168
171
|
var import_async11 = require("@dxos/async");
|
|
169
172
|
var import_context7 = require("@dxos/context");
|
|
170
|
-
var
|
|
173
|
+
var import_invariant11 = require("@dxos/invariant");
|
|
171
174
|
var import_keys8 = require("@dxos/keys");
|
|
172
175
|
var import_log10 = require("@dxos/log");
|
|
173
|
-
var
|
|
176
|
+
var import_protocols9 = require("@dxos/protocols");
|
|
174
177
|
var import_teleport2 = require("@dxos/teleport");
|
|
175
178
|
var import_util5 = require("@dxos/util");
|
|
176
179
|
var import_async12 = require("@dxos/async");
|
|
177
180
|
var import_context8 = require("@dxos/context");
|
|
178
181
|
var import_credentials12 = require("@dxos/credentials");
|
|
179
|
-
var
|
|
182
|
+
var import_invariant12 = require("@dxos/invariant");
|
|
180
183
|
var import_keys9 = require("@dxos/keys");
|
|
181
184
|
var import_log11 = require("@dxos/log");
|
|
182
|
-
var
|
|
185
|
+
var import_protocols10 = require("@dxos/protocols");
|
|
183
186
|
var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
|
|
184
187
|
var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
|
|
185
188
|
var import_util6 = require("@dxos/util");
|
|
@@ -190,9 +193,9 @@ var import_timeframe3 = require("@dxos/timeframe");
|
|
|
190
193
|
var import_async13 = require("@dxos/async");
|
|
191
194
|
var import_codec_protobuf11 = require("@dxos/codec-protobuf");
|
|
192
195
|
var import_debug6 = require("@dxos/debug");
|
|
193
|
-
var
|
|
196
|
+
var import_invariant13 = require("@dxos/invariant");
|
|
194
197
|
var import_log12 = require("@dxos/log");
|
|
195
|
-
var
|
|
198
|
+
var import_protocols11 = require("@dxos/protocols");
|
|
196
199
|
var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
|
|
197
200
|
var import_async14 = require("@dxos/async");
|
|
198
201
|
var import_context9 = require("@dxos/context");
|
|
@@ -200,20 +203,20 @@ var import_credentials15 = require("@dxos/credentials");
|
|
|
200
203
|
var import_debug7 = require("@dxos/debug");
|
|
201
204
|
var import_echo_pipeline2 = require("@dxos/echo-pipeline");
|
|
202
205
|
var import_feed_store4 = require("@dxos/feed-store");
|
|
203
|
-
var
|
|
206
|
+
var import_invariant14 = require("@dxos/invariant");
|
|
204
207
|
var import_keyring = require("@dxos/keyring");
|
|
205
208
|
var import_keys10 = require("@dxos/keys");
|
|
206
209
|
var import_log13 = require("@dxos/log");
|
|
207
|
-
var
|
|
210
|
+
var import_protocols12 = require("@dxos/protocols");
|
|
208
211
|
var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
|
|
209
212
|
var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
|
|
210
213
|
var import_tracing5 = require("@dxos/tracing");
|
|
211
214
|
var import_util7 = require("@dxos/util");
|
|
212
|
-
var
|
|
215
|
+
var import_invariant15 = require("@dxos/invariant");
|
|
213
216
|
var import_lock_file = require("@dxos/lock-file");
|
|
214
217
|
var import_log14 = require("@dxos/log");
|
|
215
218
|
var import_client_protocol4 = require("@dxos/client-protocol");
|
|
216
|
-
var
|
|
219
|
+
var import_protocols13 = require("@dxos/protocols");
|
|
217
220
|
var import_config = require("@dxos/protocols/proto/dxos/config");
|
|
218
221
|
var import_random_access_storage = require("@dxos/random-access-storage");
|
|
219
222
|
var import_util8 = require("@dxos/util");
|
|
@@ -223,13 +226,13 @@ var import_context10 = require("@dxos/context");
|
|
|
223
226
|
var import_document_model2 = require("@dxos/document-model");
|
|
224
227
|
var import_echo_pipeline3 = require("@dxos/echo-pipeline");
|
|
225
228
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
226
|
-
var
|
|
229
|
+
var import_invariant16 = require("@dxos/invariant");
|
|
227
230
|
var import_keys11 = require("@dxos/keys");
|
|
228
231
|
var import_log15 = require("@dxos/log");
|
|
229
232
|
var import_messaging = require("@dxos/messaging");
|
|
230
233
|
var import_model_factory = require("@dxos/model-factory");
|
|
231
234
|
var import_network_manager2 = require("@dxos/network-manager");
|
|
232
|
-
var
|
|
235
|
+
var import_protocols14 = require("@dxos/protocols");
|
|
233
236
|
var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
|
|
234
237
|
var import_text_model = require("@dxos/text-model");
|
|
235
238
|
var import_tracing6 = require("@dxos/tracing");
|
|
@@ -1174,7 +1177,7 @@ var IdentityManager = class {
|
|
|
1174
1177
|
genesisFeedKey: spaceRecord.genesisFeedKey
|
|
1175
1178
|
},
|
|
1176
1179
|
swarmIdentity,
|
|
1177
|
-
|
|
1180
|
+
onAuthorizedConnection: () => {
|
|
1178
1181
|
},
|
|
1179
1182
|
onAuthFailure: () => {
|
|
1180
1183
|
import_log3.log.warn("auth failure", void 0, {
|
|
@@ -1282,7 +1285,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1282
1285
|
async admit(request) {
|
|
1283
1286
|
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1284
1287
|
F: __dxlog_file5,
|
|
1285
|
-
L:
|
|
1288
|
+
L: 36,
|
|
1286
1289
|
S: this,
|
|
1287
1290
|
A: [
|
|
1288
1291
|
"request.device",
|
|
@@ -1300,6 +1303,15 @@ var DeviceInvitationProtocol = class {
|
|
|
1300
1303
|
}
|
|
1301
1304
|
};
|
|
1302
1305
|
}
|
|
1306
|
+
checkInvitation(invitation) {
|
|
1307
|
+
try {
|
|
1308
|
+
const identity = this._getIdentity();
|
|
1309
|
+
if (identity) {
|
|
1310
|
+
return new import_protocols3.AlreadyJoinedError("Currently only one identity per client is supported.");
|
|
1311
|
+
}
|
|
1312
|
+
} catch {
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1303
1315
|
createIntroduction() {
|
|
1304
1316
|
return {};
|
|
1305
1317
|
}
|
|
@@ -1318,7 +1330,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1318
1330
|
async accept(response, request) {
|
|
1319
1331
|
(0, import_invariant4.invariant)(response.device, void 0, {
|
|
1320
1332
|
F: __dxlog_file5,
|
|
1321
|
-
L:
|
|
1333
|
+
L: 80,
|
|
1322
1334
|
S: this,
|
|
1323
1335
|
A: [
|
|
1324
1336
|
"response.device",
|
|
@@ -1328,7 +1340,7 @@ var DeviceInvitationProtocol = class {
|
|
|
1328
1340
|
const { identityKey, haloSpaceKey, genesisFeedKey, controlTimeframe } = response.device;
|
|
1329
1341
|
(0, import_invariant4.invariant)(request.device, void 0, {
|
|
1330
1342
|
F: __dxlog_file5,
|
|
1331
|
-
L:
|
|
1343
|
+
L: 83,
|
|
1332
1344
|
S: this,
|
|
1333
1345
|
A: [
|
|
1334
1346
|
"request.device",
|
|
@@ -1357,10 +1369,10 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1357
1369
|
constructor(_callbacks) {
|
|
1358
1370
|
super({
|
|
1359
1371
|
requested: {
|
|
1360
|
-
InvitationHostService:
|
|
1372
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1361
1373
|
},
|
|
1362
1374
|
exposed: {
|
|
1363
|
-
InvitationHostService:
|
|
1375
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1364
1376
|
}
|
|
1365
1377
|
});
|
|
1366
1378
|
this._callbacks = _callbacks;
|
|
@@ -1393,7 +1405,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1393
1405
|
introduce: async (request) => {
|
|
1394
1406
|
const { profile, invitationId } = request;
|
|
1395
1407
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1396
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce",
|
|
1408
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.begin({
|
|
1397
1409
|
id: traceId
|
|
1398
1410
|
}), {
|
|
1399
1411
|
F: __dxlog_file6,
|
|
@@ -1430,7 +1442,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1430
1442
|
...this.invitation,
|
|
1431
1443
|
state: import_services3.Invitation.State.READY_FOR_AUTHENTICATION
|
|
1432
1444
|
});
|
|
1433
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce",
|
|
1445
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols5.trace.end({
|
|
1434
1446
|
id: traceId
|
|
1435
1447
|
}), {
|
|
1436
1448
|
F: __dxlog_file6,
|
|
@@ -1444,7 +1456,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1444
1456
|
},
|
|
1445
1457
|
authenticate: async ({ authCode: code }) => {
|
|
1446
1458
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1447
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate",
|
|
1459
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.begin({
|
|
1448
1460
|
id: traceId
|
|
1449
1461
|
}), {
|
|
1450
1462
|
F: __dxlog_file6,
|
|
@@ -1507,7 +1519,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1507
1519
|
break;
|
|
1508
1520
|
}
|
|
1509
1521
|
}
|
|
1510
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate",
|
|
1522
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols5.trace.end({
|
|
1511
1523
|
id: traceId,
|
|
1512
1524
|
data: {
|
|
1513
1525
|
status
|
|
@@ -1524,7 +1536,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1524
1536
|
},
|
|
1525
1537
|
admit: async (request) => {
|
|
1526
1538
|
const traceId = import_keys6.PublicKey.random().toHex();
|
|
1527
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit",
|
|
1539
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols5.trace.begin({
|
|
1528
1540
|
id: traceId
|
|
1529
1541
|
}), {
|
|
1530
1542
|
F: __dxlog_file6,
|
|
@@ -1546,7 +1558,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1546
1558
|
throw new Error("Not authenticated");
|
|
1547
1559
|
}
|
|
1548
1560
|
const response = await this._callbacks.admit(request);
|
|
1549
|
-
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit",
|
|
1561
|
+
import_log5.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols5.trace.end({
|
|
1550
1562
|
id: traceId
|
|
1551
1563
|
}), {
|
|
1552
1564
|
F: __dxlog_file6,
|
|
@@ -1573,7 +1585,7 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
|
|
|
1573
1585
|
timeout: OPTIONS_TIMEOUT
|
|
1574
1586
|
}));
|
|
1575
1587
|
if (this._remoteOptions?.role !== import_invitations2.Options.Role.GUEST) {
|
|
1576
|
-
throw new
|
|
1588
|
+
throw new import_protocols5.InvalidInvitationExtensionRoleError(void 0, {
|
|
1577
1589
|
expected: import_invitations2.Options.Role.GUEST,
|
|
1578
1590
|
remoteOptions: this._remoteOptions
|
|
1579
1591
|
});
|
|
@@ -1591,10 +1603,10 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1591
1603
|
constructor(_callbacks) {
|
|
1592
1604
|
super({
|
|
1593
1605
|
requested: {
|
|
1594
|
-
InvitationHostService:
|
|
1606
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1595
1607
|
},
|
|
1596
1608
|
exposed: {
|
|
1597
|
-
InvitationHostService:
|
|
1609
|
+
InvitationHostService: import_protocols5.schema.getService("dxos.halo.invitations.InvitationHostService")
|
|
1598
1610
|
}
|
|
1599
1611
|
});
|
|
1600
1612
|
this._callbacks = _callbacks;
|
|
@@ -1651,7 +1663,7 @@ var InvitationGuestExtension = class extends import_teleport.RpcExtension {
|
|
|
1651
1663
|
C: (f, a) => f(...a)
|
|
1652
1664
|
});
|
|
1653
1665
|
if (this._remoteOptions?.role !== import_invitations2.Options.Role.HOST) {
|
|
1654
|
-
throw new
|
|
1666
|
+
throw new import_protocols5.InvalidInvitationExtensionRoleError(void 0, {
|
|
1655
1667
|
expected: import_invitations2.Options.Role.HOST,
|
|
1656
1668
|
remoteOptions: this._remoteOptions
|
|
1657
1669
|
});
|
|
@@ -1764,7 +1776,7 @@ var InvitationsHandler = class {
|
|
|
1764
1776
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
1765
1777
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1766
1778
|
try {
|
|
1767
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1779
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.begin({
|
|
1768
1780
|
id: traceId
|
|
1769
1781
|
}), {
|
|
1770
1782
|
F: __dxlog_file7,
|
|
@@ -1800,7 +1812,7 @@ var InvitationsHandler = class {
|
|
|
1800
1812
|
...invitation,
|
|
1801
1813
|
state: import_services2.Invitation.State.SUCCESS
|
|
1802
1814
|
});
|
|
1803
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1815
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.end({
|
|
1804
1816
|
id: traceId
|
|
1805
1817
|
}), {
|
|
1806
1818
|
F: __dxlog_file7,
|
|
@@ -1831,7 +1843,7 @@ var InvitationsHandler = class {
|
|
|
1831
1843
|
});
|
|
1832
1844
|
stream.error(err);
|
|
1833
1845
|
}
|
|
1834
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen",
|
|
1846
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols4.trace.error({
|
|
1835
1847
|
id: traceId,
|
|
1836
1848
|
error: err
|
|
1837
1849
|
}), {
|
|
@@ -1849,7 +1861,7 @@ var InvitationsHandler = class {
|
|
|
1849
1861
|
});
|
|
1850
1862
|
},
|
|
1851
1863
|
onError: (err) => {
|
|
1852
|
-
if (err instanceof
|
|
1864
|
+
if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
|
|
1853
1865
|
return;
|
|
1854
1866
|
}
|
|
1855
1867
|
if (err instanceof import_async7.TimeoutError) {
|
|
@@ -1997,7 +2009,7 @@ var InvitationsHandler = class {
|
|
|
1997
2009
|
(0, import_async7.scheduleTask)(ctx, async () => {
|
|
1998
2010
|
const traceId = import_keys5.PublicKey.random().toHex();
|
|
1999
2011
|
try {
|
|
2000
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2012
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.begin({
|
|
2001
2013
|
id: traceId
|
|
2002
2014
|
}), {
|
|
2003
2015
|
F: __dxlog_file7,
|
|
@@ -2084,16 +2096,12 @@ var InvitationsHandler = class {
|
|
|
2084
2096
|
}
|
|
2085
2097
|
}
|
|
2086
2098
|
}
|
|
2087
|
-
} else {
|
|
2088
|
-
setState({
|
|
2089
|
-
state: import_services2.Invitation.State.READY_FOR_AUTHENTICATION
|
|
2090
|
-
});
|
|
2091
2099
|
}
|
|
2092
2100
|
(0, import_log4.log)("request admission", {
|
|
2093
2101
|
...protocol.toJSON()
|
|
2094
2102
|
}, {
|
|
2095
2103
|
F: __dxlog_file7,
|
|
2096
|
-
L:
|
|
2104
|
+
L: 309,
|
|
2097
2105
|
S: this,
|
|
2098
2106
|
C: (f, a) => f(...a)
|
|
2099
2107
|
});
|
|
@@ -2105,7 +2113,7 @@ var InvitationsHandler = class {
|
|
|
2105
2113
|
...protocol.toJSON()
|
|
2106
2114
|
}, {
|
|
2107
2115
|
F: __dxlog_file7,
|
|
2108
|
-
L:
|
|
2116
|
+
L: 320,
|
|
2109
2117
|
S: this,
|
|
2110
2118
|
C: (f, a) => f(...a)
|
|
2111
2119
|
});
|
|
@@ -2114,11 +2122,11 @@ var InvitationsHandler = class {
|
|
|
2114
2122
|
target: invitation.target,
|
|
2115
2123
|
state: import_services2.Invitation.State.SUCCESS
|
|
2116
2124
|
});
|
|
2117
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2125
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.end({
|
|
2118
2126
|
id: traceId
|
|
2119
2127
|
}), {
|
|
2120
2128
|
F: __dxlog_file7,
|
|
2121
|
-
L:
|
|
2129
|
+
L: 322,
|
|
2122
2130
|
S: this,
|
|
2123
2131
|
C: (f, a) => f(...a)
|
|
2124
2132
|
});
|
|
@@ -2128,7 +2136,7 @@ var InvitationsHandler = class {
|
|
|
2128
2136
|
...protocol.toJSON()
|
|
2129
2137
|
}, {
|
|
2130
2138
|
F: __dxlog_file7,
|
|
2131
|
-
L:
|
|
2139
|
+
L: 325,
|
|
2132
2140
|
S: this,
|
|
2133
2141
|
C: (f, a) => f(...a)
|
|
2134
2142
|
});
|
|
@@ -2138,18 +2146,18 @@ var InvitationsHandler = class {
|
|
|
2138
2146
|
} else {
|
|
2139
2147
|
(0, import_log4.log)("auth failed", err, {
|
|
2140
2148
|
F: __dxlog_file7,
|
|
2141
|
-
L:
|
|
2149
|
+
L: 328,
|
|
2142
2150
|
S: this,
|
|
2143
2151
|
C: (f, a) => f(...a)
|
|
2144
2152
|
});
|
|
2145
2153
|
stream.error(err);
|
|
2146
2154
|
}
|
|
2147
|
-
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen",
|
|
2155
|
+
import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols4.trace.error({
|
|
2148
2156
|
id: traceId,
|
|
2149
2157
|
error: err
|
|
2150
2158
|
}), {
|
|
2151
2159
|
F: __dxlog_file7,
|
|
2152
|
-
L:
|
|
2160
|
+
L: 331,
|
|
2153
2161
|
S: this,
|
|
2154
2162
|
C: (f, a) => f(...a)
|
|
2155
2163
|
});
|
|
@@ -2159,7 +2167,7 @@ var InvitationsHandler = class {
|
|
|
2159
2167
|
});
|
|
2160
2168
|
},
|
|
2161
2169
|
onError: (err) => {
|
|
2162
|
-
if (err instanceof
|
|
2170
|
+
if (err instanceof import_protocols4.InvalidInvitationExtensionRoleError) {
|
|
2163
2171
|
return;
|
|
2164
2172
|
}
|
|
2165
2173
|
if (err instanceof import_async7.TimeoutError) {
|
|
@@ -2167,7 +2175,7 @@ var InvitationsHandler = class {
|
|
|
2167
2175
|
...protocol.toJSON()
|
|
2168
2176
|
}, {
|
|
2169
2177
|
F: __dxlog_file7,
|
|
2170
|
-
L:
|
|
2178
|
+
L: 342,
|
|
2171
2179
|
S: this,
|
|
2172
2180
|
C: (f, a) => f(...a)
|
|
2173
2181
|
});
|
|
@@ -2177,7 +2185,7 @@ var InvitationsHandler = class {
|
|
|
2177
2185
|
} else {
|
|
2178
2186
|
(0, import_log4.log)("auth failed", err, {
|
|
2179
2187
|
F: __dxlog_file7,
|
|
2180
|
-
L:
|
|
2188
|
+
L: 345,
|
|
2181
2189
|
S: this,
|
|
2182
2190
|
C: (f, a) => f(...a)
|
|
2183
2191
|
});
|
|
@@ -2188,29 +2196,34 @@ var InvitationsHandler = class {
|
|
|
2188
2196
|
return extension;
|
|
2189
2197
|
};
|
|
2190
2198
|
(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
|
-
|
|
2199
|
+
const error = protocol.checkInvitation(invitation);
|
|
2200
|
+
if (error) {
|
|
2201
|
+
stream.error(error);
|
|
2202
|
+
} else {
|
|
2203
|
+
(0, import_invariant5.invariant)(invitation.swarmKey, void 0, {
|
|
2204
|
+
F: __dxlog_file7,
|
|
2205
|
+
L: 359,
|
|
2206
|
+
S: this,
|
|
2207
|
+
A: [
|
|
2208
|
+
"invitation.swarmKey",
|
|
2209
|
+
""
|
|
2210
|
+
]
|
|
2211
|
+
});
|
|
2212
|
+
const topic = invitation.swarmKey;
|
|
2213
|
+
const swarmConnection = await this._networkManager.joinSwarm({
|
|
2214
|
+
topic,
|
|
2215
|
+
peerId: import_keys5.PublicKey.random(),
|
|
2216
|
+
protocolProvider: (0, import_network_manager.createTeleportProtocolFactory)(async (teleport) => {
|
|
2217
|
+
teleport.addExtension("dxos.halo.invitations", createExtension());
|
|
2218
|
+
}),
|
|
2219
|
+
topology: new import_network_manager.StarTopology(topic),
|
|
2220
|
+
label: "invitation guest"
|
|
2221
|
+
});
|
|
2222
|
+
ctx.onDispose(() => swarmConnection.close());
|
|
2223
|
+
setState({
|
|
2224
|
+
state: import_services2.Invitation.State.CONNECTING
|
|
2225
|
+
});
|
|
2226
|
+
}
|
|
2214
2227
|
});
|
|
2215
2228
|
const observable = new import_client_protocol2.AuthenticatingInvitation({
|
|
2216
2229
|
initialInvitation: invitation,
|
|
@@ -2426,7 +2439,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2426
2439
|
async admit(request, guestProfile) {
|
|
2427
2440
|
(0, import_invariant8.invariant)(this._spaceKey, void 0, {
|
|
2428
2441
|
F: __dxlog_file9,
|
|
2429
|
-
L:
|
|
2442
|
+
L: 47,
|
|
2430
2443
|
S: this,
|
|
2431
2444
|
A: [
|
|
2432
2445
|
"this._spaceKey",
|
|
@@ -2436,7 +2449,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2436
2449
|
const space = await this._spaceManager.spaces.get(this._spaceKey);
|
|
2437
2450
|
(0, import_invariant8.invariant)(space, void 0, {
|
|
2438
2451
|
F: __dxlog_file9,
|
|
2439
|
-
L:
|
|
2452
|
+
L: 49,
|
|
2440
2453
|
S: this,
|
|
2441
2454
|
A: [
|
|
2442
2455
|
"space",
|
|
@@ -2445,7 +2458,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2445
2458
|
});
|
|
2446
2459
|
(0, import_invariant8.invariant)(request.space, void 0, {
|
|
2447
2460
|
F: __dxlog_file9,
|
|
2448
|
-
L:
|
|
2461
|
+
L: 51,
|
|
2449
2462
|
S: this,
|
|
2450
2463
|
A: [
|
|
2451
2464
|
"request.space",
|
|
@@ -2458,14 +2471,14 @@ var SpaceInvitationProtocol = class {
|
|
|
2458
2471
|
guest: deviceKey
|
|
2459
2472
|
}, {
|
|
2460
2473
|
F: __dxlog_file9,
|
|
2461
|
-
L:
|
|
2474
|
+
L: 54,
|
|
2462
2475
|
S: this,
|
|
2463
2476
|
C: (f, a) => f(...a)
|
|
2464
2477
|
});
|
|
2465
2478
|
const credentials = await (0, import_credentials8.createAdmissionCredentials)(this._signingContext.credentialSigner, identityKey, space.key, space.inner.genesisFeedKey, guestProfile);
|
|
2466
2479
|
(0, import_invariant8.invariant)(credentials[0].credential, void 0, {
|
|
2467
2480
|
F: __dxlog_file9,
|
|
2468
|
-
L:
|
|
2481
|
+
L: 65,
|
|
2469
2482
|
S: this,
|
|
2470
2483
|
A: [
|
|
2471
2484
|
"credentials[0].credential",
|
|
@@ -2475,7 +2488,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2475
2488
|
const spaceMemberCredential = credentials[0].credential.credential;
|
|
2476
2489
|
(0, import_invariant8.invariant)((0, import_credentials8.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
2477
2490
|
F: __dxlog_file9,
|
|
2478
|
-
L:
|
|
2491
|
+
L: 67,
|
|
2479
2492
|
S: this,
|
|
2480
2493
|
A: [
|
|
2481
2494
|
"getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2491,6 +2504,11 @@ var SpaceInvitationProtocol = class {
|
|
|
2491
2504
|
}
|
|
2492
2505
|
};
|
|
2493
2506
|
}
|
|
2507
|
+
checkInvitation(invitation) {
|
|
2508
|
+
if (invitation.spaceKey && this._spaceManager.spaces.has(invitation.spaceKey)) {
|
|
2509
|
+
return new import_protocols6.AlreadyJoinedError("Already joined space.");
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2494
2512
|
createIntroduction() {
|
|
2495
2513
|
return {
|
|
2496
2514
|
profile: this._signingContext.getProfile()
|
|
@@ -2511,7 +2529,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2511
2529
|
async accept(response) {
|
|
2512
2530
|
(0, import_invariant8.invariant)(response.space, void 0, {
|
|
2513
2531
|
F: __dxlog_file9,
|
|
2514
|
-
L:
|
|
2532
|
+
L: 108,
|
|
2515
2533
|
S: this,
|
|
2516
2534
|
A: [
|
|
2517
2535
|
"response.space",
|
|
@@ -2522,7 +2540,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2522
2540
|
const assertion = (0, import_credentials8.getCredentialAssertion)(credential);
|
|
2523
2541
|
(0, import_invariant8.invariant)(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
|
|
2524
2542
|
F: __dxlog_file9,
|
|
2525
|
-
L:
|
|
2543
|
+
L: 111,
|
|
2526
2544
|
S: this,
|
|
2527
2545
|
A: [
|
|
2528
2546
|
"assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -2531,13 +2549,16 @@ var SpaceInvitationProtocol = class {
|
|
|
2531
2549
|
});
|
|
2532
2550
|
(0, import_invariant8.invariant)(credential.subject.id.equals(this._signingContext.identityKey), void 0, {
|
|
2533
2551
|
F: __dxlog_file9,
|
|
2534
|
-
L:
|
|
2552
|
+
L: 112,
|
|
2535
2553
|
S: this,
|
|
2536
2554
|
A: [
|
|
2537
2555
|
"credential.subject.id.equals(this._signingContext.identityKey)",
|
|
2538
2556
|
""
|
|
2539
2557
|
]
|
|
2540
2558
|
});
|
|
2559
|
+
if (this._spaceManager.spaces.has(assertion.spaceKey)) {
|
|
2560
|
+
throw new import_protocols6.AlreadyJoinedError("Already joined space.");
|
|
2561
|
+
}
|
|
2541
2562
|
await this._spaceManager.acceptSpace({
|
|
2542
2563
|
spaceKey: assertion.spaceKey,
|
|
2543
2564
|
genesisFeedKey: assertion.genesisFeedKey,
|
|
@@ -2651,7 +2672,7 @@ var getPlatform = () => {
|
|
|
2651
2672
|
};
|
|
2652
2673
|
}
|
|
2653
2674
|
};
|
|
2654
|
-
var DXOS_VERSION = "0.3.11-main.
|
|
2675
|
+
var DXOS_VERSION = "0.3.11-main.c95bc86";
|
|
2655
2676
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2656
2677
|
var DEFAULT_TIMEOUT = 1e3;
|
|
2657
2678
|
var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
@@ -2661,14 +2682,14 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2661
2682
|
client: {
|
|
2662
2683
|
version: DXOS_VERSION,
|
|
2663
2684
|
storage: {
|
|
2664
|
-
version:
|
|
2685
|
+
version: import_protocols7.STORAGE_VERSION
|
|
2665
2686
|
}
|
|
2666
2687
|
}
|
|
2667
2688
|
};
|
|
2668
2689
|
{
|
|
2669
2690
|
(0, import_invariant9.invariant)(clientServices.LoggingService, "SystemService is not available.", {
|
|
2670
2691
|
F: __dxlog_file10,
|
|
2671
|
-
L:
|
|
2692
|
+
L: 93,
|
|
2672
2693
|
S: void 0,
|
|
2673
2694
|
A: [
|
|
2674
2695
|
"clientServices.LoggingService",
|
|
@@ -2679,6 +2700,21 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
|
|
|
2679
2700
|
timeout: DEFAULT_TIMEOUT
|
|
2680
2701
|
}).catch(() => void 0);
|
|
2681
2702
|
}
|
|
2703
|
+
if (typeof navigator !== "undefined" && navigator.storage) {
|
|
2704
|
+
const map = /* @__PURE__ */ new Map();
|
|
2705
|
+
const dir = await navigator.storage.getDirectory();
|
|
2706
|
+
for await (const filename of dir?.keys()) {
|
|
2707
|
+
const idx = filename.indexOf("-", filename.indexOf("-") + 1);
|
|
2708
|
+
if (idx === -1) {
|
|
2709
|
+
continue;
|
|
2710
|
+
}
|
|
2711
|
+
map.set(filename.slice(0, idx), (map.get(filename.slice(0, idx)) ?? 0) + 1);
|
|
2712
|
+
}
|
|
2713
|
+
diagnostics.storage = Array.from(map.entries()).sort((a, b) => b[1] - a[1]).map(([file, count]) => ({
|
|
2714
|
+
file,
|
|
2715
|
+
count
|
|
2716
|
+
}));
|
|
2717
|
+
}
|
|
2682
2718
|
const identity = serviceContext.identityManager.identity;
|
|
2683
2719
|
if (identity) {
|
|
2684
2720
|
diagnostics.identity = {
|
|
@@ -2719,7 +2755,7 @@ var getProperties = (space) => {
|
|
|
2719
2755
|
} catch (err) {
|
|
2720
2756
|
import_log8.log.warn(err.message, void 0, {
|
|
2721
2757
|
F: __dxlog_file10,
|
|
2722
|
-
L:
|
|
2758
|
+
L: 178,
|
|
2723
2759
|
S: void 0,
|
|
2724
2760
|
C: (f, a) => f(...a)
|
|
2725
2761
|
});
|
|
@@ -2774,7 +2810,8 @@ var getSpaceStats = async (space) => {
|
|
|
2774
2810
|
return stats;
|
|
2775
2811
|
};
|
|
2776
2812
|
var AutomergeSpaceState = class {
|
|
2777
|
-
constructor() {
|
|
2813
|
+
constructor(_onNewRoot) {
|
|
2814
|
+
this._onNewRoot = _onNewRoot;
|
|
2778
2815
|
this.rootUrl = void 0;
|
|
2779
2816
|
this.lastEpoch = void 0;
|
|
2780
2817
|
}
|
|
@@ -2785,6 +2822,7 @@ var AutomergeSpaceState = class {
|
|
|
2785
2822
|
this.lastEpoch = credential;
|
|
2786
2823
|
if (credential.subject.assertion.automergeRoot) {
|
|
2787
2824
|
this.rootUrl = credential.subject.assertion.automergeRoot;
|
|
2825
|
+
this._onNewRoot(this.rootUrl);
|
|
2788
2826
|
}
|
|
2789
2827
|
}
|
|
2790
2828
|
};
|
|
@@ -2821,7 +2859,7 @@ var NotarizationPlugin = class {
|
|
|
2821
2859
|
S: this,
|
|
2822
2860
|
C: (f, a) => f(...a)
|
|
2823
2861
|
});
|
|
2824
|
-
(0,
|
|
2862
|
+
(0, import_invariant11.invariant)(credentials.every((credential) => credential.id), "Credentials must have an id", {
|
|
2825
2863
|
F: __dxlog_file11,
|
|
2826
2864
|
L: 91,
|
|
2827
2865
|
S: this,
|
|
@@ -2946,7 +2984,7 @@ var NotarizationPlugin = class {
|
|
|
2946
2984
|
this._processCredentialsTriggers.delete(credential.id);
|
|
2947
2985
|
}
|
|
2948
2986
|
setWriter(writer) {
|
|
2949
|
-
(0,
|
|
2987
|
+
(0, import_invariant11.invariant)(!this._writer, "Writer already set.", {
|
|
2950
2988
|
F: __dxlog_file11,
|
|
2951
2989
|
L: 181,
|
|
2952
2990
|
S: this,
|
|
@@ -2971,7 +3009,7 @@ var NotarizationPlugin = class {
|
|
|
2971
3009
|
throw new Error(WRITER_NOT_SET_ERROR_CODE);
|
|
2972
3010
|
}
|
|
2973
3011
|
for (const credential of request.credentials ?? []) {
|
|
2974
|
-
(0,
|
|
3012
|
+
(0, import_invariant11.invariant)(credential.id, "Credential must have an id", {
|
|
2975
3013
|
F: __dxlog_file11,
|
|
2976
3014
|
L: 200,
|
|
2977
3015
|
S: this,
|
|
@@ -3020,10 +3058,10 @@ var NotarizationTeleportExtension = class extends import_teleport2.RpcExtension
|
|
|
3020
3058
|
constructor(_params) {
|
|
3021
3059
|
super({
|
|
3022
3060
|
requested: {
|
|
3023
|
-
NotarizationService:
|
|
3061
|
+
NotarizationService: import_protocols9.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3024
3062
|
},
|
|
3025
3063
|
exposed: {
|
|
3026
|
-
NotarizationService:
|
|
3064
|
+
NotarizationService: import_protocols9.schema.getService("dxos.mesh.teleport.notarization.NotarizationService")
|
|
3027
3065
|
}
|
|
3028
3066
|
});
|
|
3029
3067
|
this._params = _params;
|
|
@@ -3063,7 +3101,7 @@ var DataSpace = class {
|
|
|
3063
3101
|
this._ctx = new import_context6.Context();
|
|
3064
3102
|
this._notarizationPlugin = new NotarizationPlugin();
|
|
3065
3103
|
this._cache = void 0;
|
|
3066
|
-
this._automergeSpaceState = new AutomergeSpaceState();
|
|
3104
|
+
this._automergeSpaceState = new AutomergeSpaceState((rootUrl) => this._onNewAutomergeRoot(rootUrl));
|
|
3067
3105
|
this._state = import_services7.SpaceState.CLOSED;
|
|
3068
3106
|
this.error = void 0;
|
|
3069
3107
|
this.stateUpdate = new import_async10.Event();
|
|
@@ -3089,7 +3127,7 @@ var DataSpace = class {
|
|
|
3089
3127
|
state: import_services7.SpaceState[this._state]
|
|
3090
3128
|
}, {
|
|
3091
3129
|
F: __dxlog_file12,
|
|
3092
|
-
L:
|
|
3130
|
+
L: 138,
|
|
3093
3131
|
S: this,
|
|
3094
3132
|
C: (f, a) => f(...a)
|
|
3095
3133
|
});
|
|
@@ -3136,7 +3174,7 @@ var DataSpace = class {
|
|
|
3136
3174
|
state: import_services7.SpaceState[this._state]
|
|
3137
3175
|
}, {
|
|
3138
3176
|
F: __dxlog_file12,
|
|
3139
|
-
L:
|
|
3177
|
+
L: 190,
|
|
3140
3178
|
S: this,
|
|
3141
3179
|
C: (f, a) => f(...a)
|
|
3142
3180
|
});
|
|
@@ -3154,7 +3192,7 @@ var DataSpace = class {
|
|
|
3154
3192
|
state: import_services7.SpaceState[this._state]
|
|
3155
3193
|
}, {
|
|
3156
3194
|
F: __dxlog_file12,
|
|
3157
|
-
L:
|
|
3195
|
+
L: 204,
|
|
3158
3196
|
S: this,
|
|
3159
3197
|
C: (f, a) => f(...a)
|
|
3160
3198
|
});
|
|
@@ -3183,10 +3221,10 @@ var DataSpace = class {
|
|
|
3183
3221
|
this.metrics.pipelineInitBegin = /* @__PURE__ */ new Date();
|
|
3184
3222
|
await this.initializeDataPipeline();
|
|
3185
3223
|
} catch (err) {
|
|
3186
|
-
if (err instanceof
|
|
3224
|
+
if (err instanceof import_protocols8.CancelledError) {
|
|
3187
3225
|
(0, import_log9.log)("data pipeline initialization cancelled", err, {
|
|
3188
3226
|
F: __dxlog_file12,
|
|
3189
|
-
L:
|
|
3227
|
+
L: 237,
|
|
3190
3228
|
S: this,
|
|
3191
3229
|
C: (f, a) => f(...a)
|
|
3192
3230
|
});
|
|
@@ -3194,7 +3232,7 @@ var DataSpace = class {
|
|
|
3194
3232
|
}
|
|
3195
3233
|
import_log9.log.error("Error initializing data pipeline", err, {
|
|
3196
3234
|
F: __dxlog_file12,
|
|
3197
|
-
L:
|
|
3235
|
+
L: 241,
|
|
3198
3236
|
S: this,
|
|
3199
3237
|
C: (f, a) => f(...a)
|
|
3200
3238
|
});
|
|
@@ -3203,7 +3241,7 @@ var DataSpace = class {
|
|
|
3203
3241
|
state: import_services7.SpaceState[this._state]
|
|
3204
3242
|
}, {
|
|
3205
3243
|
F: __dxlog_file12,
|
|
3206
|
-
L:
|
|
3244
|
+
L: 243,
|
|
3207
3245
|
S: this,
|
|
3208
3246
|
C: (f, a) => f(...a)
|
|
3209
3247
|
});
|
|
@@ -3216,14 +3254,14 @@ var DataSpace = class {
|
|
|
3216
3254
|
}
|
|
3217
3255
|
async initializeDataPipeline() {
|
|
3218
3256
|
if (this._state !== import_services7.SpaceState.CONTROL_ONLY) {
|
|
3219
|
-
throw new
|
|
3257
|
+
throw new import_protocols8.SystemError("Invalid operation");
|
|
3220
3258
|
}
|
|
3221
3259
|
this._state = import_services7.SpaceState.INITIALIZING;
|
|
3222
3260
|
(0, import_log9.log)("new state", {
|
|
3223
3261
|
state: import_services7.SpaceState[this._state]
|
|
3224
3262
|
}, {
|
|
3225
3263
|
F: __dxlog_file12,
|
|
3226
|
-
L:
|
|
3264
|
+
L: 259,
|
|
3227
3265
|
S: this,
|
|
3228
3266
|
C: (f, a) => f(...a)
|
|
3229
3267
|
});
|
|
@@ -3234,7 +3272,7 @@ var DataSpace = class {
|
|
|
3234
3272
|
await (0, import_context6.cancelWithContext)(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3235
3273
|
(0, import_log9.log)("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3236
3274
|
F: __dxlog_file12,
|
|
3237
|
-
L:
|
|
3275
|
+
L: 273,
|
|
3238
3276
|
S: this,
|
|
3239
3277
|
C: (f, a) => f(...a)
|
|
3240
3278
|
});
|
|
@@ -3245,7 +3283,7 @@ var DataSpace = class {
|
|
|
3245
3283
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3246
3284
|
(0, import_log9.log)("data pipeline ready", void 0, {
|
|
3247
3285
|
F: __dxlog_file12,
|
|
3248
|
-
L:
|
|
3286
|
+
L: 282,
|
|
3249
3287
|
S: this,
|
|
3250
3288
|
C: (f, a) => f(...a)
|
|
3251
3289
|
});
|
|
@@ -3255,7 +3293,7 @@ var DataSpace = class {
|
|
|
3255
3293
|
state: import_services7.SpaceState[this._state]
|
|
3256
3294
|
}, {
|
|
3257
3295
|
F: __dxlog_file12,
|
|
3258
|
-
L:
|
|
3296
|
+
L: 286,
|
|
3259
3297
|
S: this,
|
|
3260
3298
|
C: (f, a) => f(...a)
|
|
3261
3299
|
});
|
|
@@ -3271,7 +3309,7 @@ var DataSpace = class {
|
|
|
3271
3309
|
await this._createWritableFeeds();
|
|
3272
3310
|
(0, import_log9.log)("writable feeds created", void 0, {
|
|
3273
3311
|
F: __dxlog_file12,
|
|
3274
|
-
L:
|
|
3312
|
+
L: 302,
|
|
3275
3313
|
S: this,
|
|
3276
3314
|
C: (f, a) => f(...a)
|
|
3277
3315
|
});
|
|
@@ -3328,6 +3366,40 @@ var DataSpace = class {
|
|
|
3328
3366
|
await this._metadataStore.setWritableFeedKeys(this.key, this.inner.controlFeedKey, this.inner.dataFeedKey);
|
|
3329
3367
|
}
|
|
3330
3368
|
}
|
|
3369
|
+
_onNewAutomergeRoot(rootUrl) {
|
|
3370
|
+
import_log9.log.info("loading automerge root doc for space", {
|
|
3371
|
+
space: this.key,
|
|
3372
|
+
rootUrl
|
|
3373
|
+
}, {
|
|
3374
|
+
F: __dxlog_file12,
|
|
3375
|
+
L: 368,
|
|
3376
|
+
S: this,
|
|
3377
|
+
C: (f, a) => f(...a)
|
|
3378
|
+
});
|
|
3379
|
+
const handle = this._automergeHost.repo.find(rootUrl);
|
|
3380
|
+
queueMicrotask(async () => {
|
|
3381
|
+
try {
|
|
3382
|
+
await handle.whenReady();
|
|
3383
|
+
const doc = handle.docSync() ?? (0, import_invariant10.failedInvariant)();
|
|
3384
|
+
if (!doc.experimental_spaceKey) {
|
|
3385
|
+
handle.change((doc2) => {
|
|
3386
|
+
doc2.experimental_spaceKey = this.key.toHex();
|
|
3387
|
+
});
|
|
3388
|
+
}
|
|
3389
|
+
} catch (err) {
|
|
3390
|
+
import_log9.log.warn("error loading automerge root doc", {
|
|
3391
|
+
space: this.key,
|
|
3392
|
+
rootUrl,
|
|
3393
|
+
err
|
|
3394
|
+
}, {
|
|
3395
|
+
F: __dxlog_file12,
|
|
3396
|
+
L: 381,
|
|
3397
|
+
S: this,
|
|
3398
|
+
C: (f, a) => f(...a)
|
|
3399
|
+
});
|
|
3400
|
+
}
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3331
3403
|
// TODO(dmaretskyi): Use profile from signing context.
|
|
3332
3404
|
async updateOwnProfile(profile) {
|
|
3333
3405
|
const credential = await this._signingContext.credentialSigner.createCredential({
|
|
@@ -3411,7 +3483,7 @@ var DataSpace = class {
|
|
|
3411
3483
|
state: import_services7.SpaceState[this._state]
|
|
3412
3484
|
}, {
|
|
3413
3485
|
F: __dxlog_file12,
|
|
3414
|
-
L:
|
|
3486
|
+
L: 470,
|
|
3415
3487
|
S: this,
|
|
3416
3488
|
C: (f, a) => f(...a)
|
|
3417
3489
|
});
|
|
@@ -3549,7 +3621,7 @@ var DataSpaceManager = class {
|
|
|
3549
3621
|
S: this,
|
|
3550
3622
|
C: (f, a) => f(...a)
|
|
3551
3623
|
});
|
|
3552
|
-
import_log11.log.trace("dxos.echo.data-space-manager.open",
|
|
3624
|
+
import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.begin({
|
|
3553
3625
|
id: this._instanceId
|
|
3554
3626
|
}), {
|
|
3555
3627
|
F: __dxlog_file13,
|
|
@@ -3595,7 +3667,7 @@ var DataSpaceManager = class {
|
|
|
3595
3667
|
space.initializeDataPipelineAsync();
|
|
3596
3668
|
}
|
|
3597
3669
|
}
|
|
3598
|
-
import_log11.log.trace("dxos.echo.data-space-manager.open",
|
|
3670
|
+
import_log11.log.trace("dxos.echo.data-space-manager.open", import_protocols10.trace.end({
|
|
3599
3671
|
id: this._instanceId
|
|
3600
3672
|
}), {
|
|
3601
3673
|
F: __dxlog_file13,
|
|
@@ -3621,7 +3693,7 @@ var DataSpaceManager = class {
|
|
|
3621
3693
|
* Creates a new space writing the genesis credentials to the control feed.
|
|
3622
3694
|
*/
|
|
3623
3695
|
async createSpace() {
|
|
3624
|
-
(0,
|
|
3696
|
+
(0, import_invariant12.invariant)(this._isOpen, "Not open.", {
|
|
3625
3697
|
F: __dxlog_file13,
|
|
3626
3698
|
L: 130,
|
|
3627
3699
|
S: this,
|
|
@@ -3650,12 +3722,15 @@ var DataSpaceManager = class {
|
|
|
3650
3722
|
});
|
|
3651
3723
|
const space = await this._constructSpace(metadata);
|
|
3652
3724
|
const automergeRoot = this._automergeHost.repo.create();
|
|
3725
|
+
automergeRoot.change((doc) => {
|
|
3726
|
+
doc.experimental_spaceKey = spaceKey.toHex();
|
|
3727
|
+
});
|
|
3653
3728
|
const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRoot.url);
|
|
3654
3729
|
await this._metadataStore.addSpace(metadata);
|
|
3655
3730
|
const memberCredential = credentials[1];
|
|
3656
|
-
(0,
|
|
3731
|
+
(0, import_invariant12.invariant)((0, import_credentials12.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
|
|
3657
3732
|
F: __dxlog_file13,
|
|
3658
|
-
L:
|
|
3733
|
+
L: 154,
|
|
3659
3734
|
S: this,
|
|
3660
3735
|
A: [
|
|
3661
3736
|
"getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
|
|
@@ -3673,22 +3748,22 @@ var DataSpaceManager = class {
|
|
|
3673
3748
|
opts
|
|
3674
3749
|
}, {
|
|
3675
3750
|
F: __dxlog_file13,
|
|
3676
|
-
L:
|
|
3751
|
+
L: 166,
|
|
3677
3752
|
S: this,
|
|
3678
3753
|
C: (f, a) => f(...a)
|
|
3679
3754
|
});
|
|
3680
|
-
(0,
|
|
3755
|
+
(0, import_invariant12.invariant)(this._isOpen, "Not open.", {
|
|
3681
3756
|
F: __dxlog_file13,
|
|
3682
|
-
L:
|
|
3757
|
+
L: 167,
|
|
3683
3758
|
S: this,
|
|
3684
3759
|
A: [
|
|
3685
3760
|
"this._isOpen",
|
|
3686
3761
|
"'Not open.'"
|
|
3687
3762
|
]
|
|
3688
3763
|
});
|
|
3689
|
-
(0,
|
|
3764
|
+
(0, import_invariant12.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
|
|
3690
3765
|
F: __dxlog_file13,
|
|
3691
|
-
L:
|
|
3766
|
+
L: 168,
|
|
3692
3767
|
S: this,
|
|
3693
3768
|
A: [
|
|
3694
3769
|
"!this._spaces.has(opts.spaceKey)",
|
|
@@ -3723,7 +3798,7 @@ var DataSpaceManager = class {
|
|
|
3723
3798
|
metadata
|
|
3724
3799
|
}, {
|
|
3725
3800
|
F: __dxlog_file13,
|
|
3726
|
-
L:
|
|
3801
|
+
L: 201,
|
|
3727
3802
|
S: this,
|
|
3728
3803
|
C: (f, a) => f(...a)
|
|
3729
3804
|
});
|
|
@@ -3750,17 +3825,18 @@ var DataSpaceManager = class {
|
|
|
3750
3825
|
credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
|
|
3751
3826
|
credentialAuthenticator: (0, import_util6.deferFunction)(() => dataSpace.authVerifier.verifier)
|
|
3752
3827
|
},
|
|
3753
|
-
|
|
3828
|
+
onAuthorizedConnection: (session) => {
|
|
3754
3829
|
session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
|
|
3755
3830
|
remotePeerId: session.remotePeerId
|
|
3756
3831
|
}));
|
|
3757
3832
|
session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
|
|
3833
|
+
this._automergeHost.authorizeDevice(space.key, session.remotePeerId);
|
|
3758
3834
|
session.addExtension("dxos.mesh.teleport.automerge", this._automergeHost.createExtension());
|
|
3759
3835
|
},
|
|
3760
3836
|
onAuthFailure: () => {
|
|
3761
3837
|
import_log11.log.warn("auth failure", void 0, {
|
|
3762
3838
|
F: __dxlog_file13,
|
|
3763
|
-
L:
|
|
3839
|
+
L: 238,
|
|
3764
3840
|
S: this,
|
|
3765
3841
|
C: (f, a) => f(...a)
|
|
3766
3842
|
});
|
|
@@ -3784,7 +3860,7 @@ var DataSpaceManager = class {
|
|
|
3784
3860
|
space: space.key
|
|
3785
3861
|
}, {
|
|
3786
3862
|
F: __dxlog_file13,
|
|
3787
|
-
L:
|
|
3863
|
+
L: 256,
|
|
3788
3864
|
S: this,
|
|
3789
3865
|
C: (f, a) => f(...a)
|
|
3790
3866
|
});
|
|
@@ -3796,7 +3872,7 @@ var DataSpaceManager = class {
|
|
|
3796
3872
|
open: this._isOpen
|
|
3797
3873
|
}, {
|
|
3798
3874
|
F: __dxlog_file13,
|
|
3799
|
-
L:
|
|
3875
|
+
L: 263,
|
|
3800
3876
|
S: this,
|
|
3801
3877
|
C: (f, a) => f(...a)
|
|
3802
3878
|
});
|
|
@@ -3809,7 +3885,7 @@ var DataSpaceManager = class {
|
|
|
3809
3885
|
space: space.key
|
|
3810
3886
|
}, {
|
|
3811
3887
|
F: __dxlog_file13,
|
|
3812
|
-
L:
|
|
3888
|
+
L: 269,
|
|
3813
3889
|
S: this,
|
|
3814
3890
|
C: (f, a) => f(...a)
|
|
3815
3891
|
});
|
|
@@ -3857,7 +3933,7 @@ var SpacesServiceImpl = class {
|
|
|
3857
3933
|
}
|
|
3858
3934
|
async createSpace() {
|
|
3859
3935
|
if (!this._identityManager.identity) {
|
|
3860
|
-
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/halo");
|
|
3936
|
+
throw new Error("This device has no HALO identity available. See https://docs.dxos.org/guide/platform/halo");
|
|
3861
3937
|
}
|
|
3862
3938
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3863
3939
|
const space = await dataSpaceManager.createSpace();
|
|
@@ -3865,7 +3941,7 @@ var SpacesServiceImpl = class {
|
|
|
3865
3941
|
}
|
|
3866
3942
|
async updateSpace({ spaceKey, state }) {
|
|
3867
3943
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3868
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
3944
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3869
3945
|
if (state) {
|
|
3870
3946
|
switch (state) {
|
|
3871
3947
|
case import_services9.SpaceState.ACTIVE:
|
|
@@ -3875,7 +3951,7 @@ var SpacesServiceImpl = class {
|
|
|
3875
3951
|
await space.deactivate();
|
|
3876
3952
|
break;
|
|
3877
3953
|
default:
|
|
3878
|
-
throw new
|
|
3954
|
+
throw new import_protocols11.ApiError("Invalid space state");
|
|
3879
3955
|
}
|
|
3880
3956
|
}
|
|
3881
3957
|
}
|
|
@@ -3930,14 +4006,14 @@ var SpacesServiceImpl = class {
|
|
|
3930
4006
|
}
|
|
3931
4007
|
async postMessage({ spaceKey, channel, message }) {
|
|
3932
4008
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3933
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4009
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3934
4010
|
await space.postMessage(getChannelId(channel), message);
|
|
3935
4011
|
}
|
|
3936
4012
|
subscribeMessages({ spaceKey, channel }) {
|
|
3937
4013
|
return new import_codec_protobuf11.Stream(({ ctx, next }) => {
|
|
3938
4014
|
(0, import_async13.scheduleTask)(ctx, async () => {
|
|
3939
4015
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
3940
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4016
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3941
4017
|
const handle = space.listen(getChannelId(channel), (message) => {
|
|
3942
4018
|
next(message);
|
|
3943
4019
|
});
|
|
@@ -3947,7 +4023,7 @@ var SpacesServiceImpl = class {
|
|
|
3947
4023
|
}
|
|
3948
4024
|
queryCredentials({ spaceKey, noTail }) {
|
|
3949
4025
|
return new import_codec_protobuf11.Stream(({ ctx, next, close }) => {
|
|
3950
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4026
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3951
4027
|
const processor = {
|
|
3952
4028
|
processCredential: async (credential) => {
|
|
3953
4029
|
next(credential);
|
|
@@ -3963,7 +4039,7 @@ var SpacesServiceImpl = class {
|
|
|
3963
4039
|
});
|
|
3964
4040
|
}
|
|
3965
4041
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3966
|
-
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4042
|
+
const space = this._spaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
3967
4043
|
for (const credential of credentials ?? []) {
|
|
3968
4044
|
if (credential.proof) {
|
|
3969
4045
|
await space.controlPipeline.writer.write({
|
|
@@ -3972,7 +4048,7 @@ var SpacesServiceImpl = class {
|
|
|
3972
4048
|
}
|
|
3973
4049
|
});
|
|
3974
4050
|
} else {
|
|
3975
|
-
(0,
|
|
4051
|
+
(0, import_invariant13.invariant)(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
3976
4052
|
F: __dxlog_file14,
|
|
3977
4053
|
L: 168,
|
|
3978
4054
|
S: this,
|
|
@@ -3981,7 +4057,7 @@ var SpacesServiceImpl = class {
|
|
|
3981
4057
|
"'Id on unsigned credentials is not allowed'"
|
|
3982
4058
|
]
|
|
3983
4059
|
});
|
|
3984
|
-
(0,
|
|
4060
|
+
(0, import_invariant13.invariant)(this._identityManager.identity, "Identity is not available", {
|
|
3985
4061
|
F: __dxlog_file14,
|
|
3986
4062
|
L: 169,
|
|
3987
4063
|
S: this,
|
|
@@ -3991,7 +4067,7 @@ var SpacesServiceImpl = class {
|
|
|
3991
4067
|
]
|
|
3992
4068
|
});
|
|
3993
4069
|
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
3994
|
-
(0,
|
|
4070
|
+
(0, import_invariant13.invariant)(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
3995
4071
|
F: __dxlog_file14,
|
|
3996
4072
|
L: 171,
|
|
3997
4073
|
S: this,
|
|
@@ -4014,14 +4090,14 @@ var SpacesServiceImpl = class {
|
|
|
4014
4090
|
}
|
|
4015
4091
|
async createEpoch({ spaceKey }) {
|
|
4016
4092
|
const dataSpaceManager = await this._getDataSpaceManager();
|
|
4017
|
-
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new
|
|
4093
|
+
const space = dataSpaceManager.spaces.get(spaceKey) ?? (0, import_debug6.raise)(new import_protocols11.SpaceNotFoundError(spaceKey));
|
|
4018
4094
|
await space.createEpoch();
|
|
4019
4095
|
}
|
|
4020
4096
|
_serializeSpace(space) {
|
|
4021
4097
|
return {
|
|
4022
4098
|
spaceKey: space.key,
|
|
4023
4099
|
state: space.state,
|
|
4024
|
-
error: space.error ? (0,
|
|
4100
|
+
error: space.error ? (0, import_protocols11.encodeError)(space.error) : void 0,
|
|
4025
4101
|
pipeline: {
|
|
4026
4102
|
currentEpoch: space.dataPipeline.currentEpoch,
|
|
4027
4103
|
appliedEpoch: space.dataPipeline.appliedEpoch,
|
|
@@ -4115,7 +4191,7 @@ var ServiceContext = class {
|
|
|
4115
4191
|
S: this,
|
|
4116
4192
|
C: (f, a) => f(...a)
|
|
4117
4193
|
});
|
|
4118
|
-
import_log13.log.trace("dxos.sdk.service-context.open",
|
|
4194
|
+
import_log13.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.begin({
|
|
4119
4195
|
id: this._instanceId
|
|
4120
4196
|
}), {
|
|
4121
4197
|
F: __dxlog_file15,
|
|
@@ -4131,7 +4207,7 @@ var ServiceContext = class {
|
|
|
4131
4207
|
if (this.identityManager.identity) {
|
|
4132
4208
|
await this._initialize(ctx);
|
|
4133
4209
|
}
|
|
4134
|
-
import_log13.log.trace("dxos.sdk.service-context.open",
|
|
4210
|
+
import_log13.log.trace("dxos.sdk.service-context.open", import_protocols12.trace.end({
|
|
4135
4211
|
id: this._instanceId
|
|
4136
4212
|
}), {
|
|
4137
4213
|
F: __dxlog_file15,
|
|
@@ -4179,7 +4255,7 @@ var ServiceContext = class {
|
|
|
4179
4255
|
}
|
|
4180
4256
|
getInvitationHandler(invitation) {
|
|
4181
4257
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
4182
|
-
(0,
|
|
4258
|
+
(0, import_invariant14.invariant)(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
4183
4259
|
F: __dxlog_file15,
|
|
4184
4260
|
L: 173,
|
|
4185
4261
|
S: this,
|
|
@@ -4205,8 +4281,8 @@ var ServiceContext = class {
|
|
|
4205
4281
|
}
|
|
4206
4282
|
async _checkStorageVersion() {
|
|
4207
4283
|
await this.metadataStore.load();
|
|
4208
|
-
if (this.metadataStore.version !==
|
|
4209
|
-
throw new
|
|
4284
|
+
if (this.metadataStore.version !== import_protocols12.STORAGE_VERSION) {
|
|
4285
|
+
throw new import_protocols12.InvalidStorageVersionError(import_protocols12.STORAGE_VERSION, this.metadataStore.version);
|
|
4210
4286
|
}
|
|
4211
4287
|
}
|
|
4212
4288
|
// Called when identity is created.
|
|
@@ -4234,7 +4310,7 @@ var ServiceContext = class {
|
|
|
4234
4310
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore, this.automergeHost);
|
|
4235
4311
|
await this.dataSpaceManager.open();
|
|
4236
4312
|
this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
|
|
4237
|
-
(0,
|
|
4313
|
+
(0, import_invariant14.invariant)(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4238
4314
|
F: __dxlog_file15,
|
|
4239
4315
|
L: 228,
|
|
4240
4316
|
S: this,
|
|
@@ -4373,7 +4449,7 @@ var Lock = class {
|
|
|
4373
4449
|
}
|
|
4374
4450
|
async release() {
|
|
4375
4451
|
await this._onRelease?.();
|
|
4376
|
-
(0,
|
|
4452
|
+
(0, import_invariant15.invariant)(this._fileHandle, "Lock is not acquired", {
|
|
4377
4453
|
F: __dxlog_file16,
|
|
4378
4454
|
L: 42,
|
|
4379
4455
|
S: this,
|
|
@@ -4393,16 +4469,16 @@ var StorageDriver = import_config.Runtime.Client.Storage.StorageDriver;
|
|
|
4393
4469
|
var createStorageObjects = (config) => {
|
|
4394
4470
|
const { persistent = false, keyStore, dataStore, dataRoot = (0, import_util8.isNode)() ? import_client_protocol4.DX_DATA : "dxos/storage" } = config ?? {};
|
|
4395
4471
|
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4396
|
-
throw new
|
|
4472
|
+
throw new import_protocols13.InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4397
4473
|
}
|
|
4398
4474
|
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
4399
|
-
throw new
|
|
4475
|
+
throw new import_protocols13.InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4400
4476
|
}
|
|
4401
4477
|
if (persistent && keyStore === StorageDriver.RAM) {
|
|
4402
|
-
throw new
|
|
4478
|
+
throw new import_protocols13.InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4403
4479
|
}
|
|
4404
4480
|
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
4405
|
-
throw new
|
|
4481
|
+
throw new import_protocols13.InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4406
4482
|
}
|
|
4407
4483
|
return {
|
|
4408
4484
|
storage: (0, import_random_access_storage.createStorage)({
|
|
@@ -4768,7 +4844,7 @@ var ClientServicesHost = class {
|
|
|
4768
4844
|
* Can only be called once.
|
|
4769
4845
|
*/
|
|
4770
4846
|
initialize({ config, ...options }) {
|
|
4771
|
-
(0,
|
|
4847
|
+
(0, import_invariant16.invariant)(!this._open, "service host is open", {
|
|
4772
4848
|
F: __dxlog_file17,
|
|
4773
4849
|
L: 201,
|
|
4774
4850
|
S: this,
|
|
@@ -4784,7 +4860,7 @@ var ClientServicesHost = class {
|
|
|
4784
4860
|
C: (f, a) => f(...a)
|
|
4785
4861
|
});
|
|
4786
4862
|
if (config) {
|
|
4787
|
-
(0,
|
|
4863
|
+
(0, import_invariant16.invariant)(!this._config, "config already set", {
|
|
4788
4864
|
F: __dxlog_file17,
|
|
4789
4865
|
L: 205,
|
|
4790
4866
|
S: this,
|
|
@@ -4802,7 +4878,7 @@ var ClientServicesHost = class {
|
|
|
4802
4878
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4803
4879
|
}), signalManager = new import_messaging.WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4804
4880
|
this._signalManager = signalManager;
|
|
4805
|
-
(0,
|
|
4881
|
+
(0, import_invariant16.invariant)(!this._networkManager, "network manager already set", {
|
|
4806
4882
|
F: __dxlog_file17,
|
|
4807
4883
|
L: 221,
|
|
4808
4884
|
S: this,
|
|
@@ -4828,7 +4904,7 @@ var ClientServicesHost = class {
|
|
|
4828
4904
|
return;
|
|
4829
4905
|
}
|
|
4830
4906
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
4831
|
-
import_log15.log.trace("dxos.client-services.host.open",
|
|
4907
|
+
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.begin({
|
|
4832
4908
|
id: traceId
|
|
4833
4909
|
}), {
|
|
4834
4910
|
F: __dxlog_file17,
|
|
@@ -4836,7 +4912,7 @@ var ClientServicesHost = class {
|
|
|
4836
4912
|
S: this,
|
|
4837
4913
|
C: (f, a) => f(...a)
|
|
4838
4914
|
});
|
|
4839
|
-
(0,
|
|
4915
|
+
(0, import_invariant16.invariant)(this._config, "config not set", {
|
|
4840
4916
|
F: __dxlog_file17,
|
|
4841
4917
|
L: 241,
|
|
4842
4918
|
S: this,
|
|
@@ -4845,7 +4921,7 @@ var ClientServicesHost = class {
|
|
|
4845
4921
|
"'config not set'"
|
|
4846
4922
|
]
|
|
4847
4923
|
});
|
|
4848
|
-
(0,
|
|
4924
|
+
(0, import_invariant16.invariant)(this._storage, "storage not set", {
|
|
4849
4925
|
F: __dxlog_file17,
|
|
4850
4926
|
L: 242,
|
|
4851
4927
|
S: this,
|
|
@@ -4854,7 +4930,7 @@ var ClientServicesHost = class {
|
|
|
4854
4930
|
"'storage not set'"
|
|
4855
4931
|
]
|
|
4856
4932
|
});
|
|
4857
|
-
(0,
|
|
4933
|
+
(0, import_invariant16.invariant)(this._signalManager, "signal manager not set", {
|
|
4858
4934
|
F: __dxlog_file17,
|
|
4859
4935
|
L: 243,
|
|
4860
4936
|
S: this,
|
|
@@ -4863,7 +4939,7 @@ var ClientServicesHost = class {
|
|
|
4863
4939
|
"'signal manager not set'"
|
|
4864
4940
|
]
|
|
4865
4941
|
});
|
|
4866
|
-
(0,
|
|
4942
|
+
(0, import_invariant16.invariant)(this._networkManager, "network manager not set", {
|
|
4867
4943
|
F: __dxlog_file17,
|
|
4868
4944
|
L: 244,
|
|
4869
4945
|
S: this,
|
|
@@ -4927,7 +5003,7 @@ var ClientServicesHost = class {
|
|
|
4927
5003
|
S: this,
|
|
4928
5004
|
C: (f, a) => f(...a)
|
|
4929
5005
|
});
|
|
4930
|
-
import_log15.log.trace("dxos.client-services.host.open",
|
|
5006
|
+
import_log15.log.trace("dxos.client-services.host.open", import_protocols14.trace.end({
|
|
4931
5007
|
id: traceId
|
|
4932
5008
|
}), {
|
|
4933
5009
|
F: __dxlog_file17,
|
|
@@ -4968,7 +5044,7 @@ var ClientServicesHost = class {
|
|
|
4968
5044
|
}
|
|
4969
5045
|
async reset() {
|
|
4970
5046
|
const traceId = import_keys11.PublicKey.random().toHex();
|
|
4971
|
-
import_log15.log.trace("dxos.sdk.client-services-host.reset",
|
|
5047
|
+
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.begin({
|
|
4972
5048
|
id: traceId
|
|
4973
5049
|
}), {
|
|
4974
5050
|
F: __dxlog_file17,
|
|
@@ -4990,7 +5066,7 @@ var ClientServicesHost = class {
|
|
|
4990
5066
|
S: this,
|
|
4991
5067
|
C: (f, a) => f(...a)
|
|
4992
5068
|
});
|
|
4993
|
-
import_log15.log.trace("dxos.sdk.client-services-host.reset",
|
|
5069
|
+
import_log15.log.trace("dxos.sdk.client-services-host.reset", import_protocols14.trace.end({
|
|
4994
5070
|
id: traceId
|
|
4995
5071
|
}), {
|
|
4996
5072
|
F: __dxlog_file17,
|
|
@@ -5022,7 +5098,7 @@ var ClientServicesHost = class {
|
|
|
5022
5098
|
});
|
|
5023
5099
|
} else {
|
|
5024
5100
|
const automergeIndex = space.automergeSpaceState.rootUrl;
|
|
5025
|
-
(0,
|
|
5101
|
+
(0, import_invariant16.invariant)(automergeIndex, void 0, {
|
|
5026
5102
|
F: __dxlog_file17,
|
|
5027
5103
|
L: 375,
|
|
5028
5104
|
S: this,
|
|
@@ -5092,4 +5168,4 @@ ClientServicesHost = _ts_decorate8([
|
|
|
5092
5168
|
subscribeToSpaces,
|
|
5093
5169
|
subscribeToSwarmInfo
|
|
5094
5170
|
});
|
|
5095
|
-
//# sourceMappingURL=chunk-
|
|
5171
|
+
//# sourceMappingURL=chunk-KA7FPK35.cjs.map
|