@dxos/client-services 0.1.58-main.b605d47 → 0.1.58-main.ba8fa9e
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-GRLE5OOK.mjs → chunk-XT2TMICH.mjs} +271 -193
- package/dist/lib/browser/chunk-XT2TMICH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +11 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/packlets/testing/index.mjs +5 -5
- package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
- package/dist/lib/node/index.cjs +313 -235
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/packlets/testing/index.cjs +310 -232
- package/dist/lib/node/packlets/testing/index.cjs.map +4 -4
- package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
- package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts +1 -1
- package/dist/types/src/packlets/invitations/device-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitation-extension.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts +3 -3
- package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/invitations-service.d.ts.map +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts +1 -1
- package/dist/types/src/packlets/invitations/space-invitation-protocol.d.ts.map +1 -1
- package/dist/types/src/packlets/services/diagnostics.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
- package/dist/types/src/packlets/services/service-host.d.ts +1 -0
- package/dist/types/src/packlets/services/service-host.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 -1
- package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
- package/dist/types/src/packlets/spaces/spaces-service.d.ts +2 -2
- package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/invitation-utils.d.ts +5 -5
- package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts +1 -1
- package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/iframe-host-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts +1 -1
- package/dist/types/src/packlets/vault/shell-runtime.d.ts.map +1 -1
- package/dist/types/src/packlets/vault/worker-runtime.d.ts.map +1 -1
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +35 -35
- package/src/packlets/devices/devices-service.test.ts +1 -1
- package/src/packlets/devtools/devtools.ts +1 -1
- package/src/packlets/identity/authenticator.ts +2 -5
- package/src/packlets/identity/identity-manager.test.ts +1 -1
- package/src/packlets/identity/identity-service.test.ts +1 -1
- package/src/packlets/identity/identity.test.ts +1 -1
- package/src/packlets/invitations/device-invitation-protocol.ts +1 -1
- package/src/packlets/invitations/invitation-extension.ts +1 -2
- package/src/packlets/invitations/invitations-handler.ts +7 -8
- package/src/packlets/invitations/invitations-service.ts +11 -7
- package/src/packlets/invitations/space-invitation-protocol.ts +1 -1
- package/src/packlets/network/network-service.test.ts +1 -1
- package/src/packlets/services/diagnostics.ts +2 -2
- package/src/packlets/services/service-context.ts +7 -13
- package/src/packlets/services/service-host.test.ts +3 -3
- package/src/packlets/services/service-host.ts +42 -6
- package/src/packlets/services/service-registry.test.ts +1 -1
- package/src/packlets/spaces/data-space-manager.test.ts +1 -1
- package/src/packlets/spaces/data-space-manager.ts +1 -1
- package/src/packlets/spaces/data-space.ts +11 -3
- package/src/packlets/spaces/spaces-service.test.ts +1 -1
- package/src/packlets/spaces/spaces-service.ts +31 -10
- package/src/packlets/storage/storage.ts +10 -10
- package/src/packlets/testing/invitation-utils.ts +9 -9
- package/src/packlets/testing/test-builder.ts +3 -3
- package/src/packlets/vault/iframe-host-runtime.ts +1 -1
- package/src/packlets/vault/iframe-proxy-runtime.ts +1 -1
- package/src/packlets/vault/shell-runtime.ts +4 -4
- package/src/packlets/vault/worker-runtime.ts +9 -6
- package/src/version.ts +1 -1
- package/dist/lib/browser/chunk-GRLE5OOK.mjs.map +0 -7
|
@@ -357,7 +357,6 @@ var createAuthProvider = (signer) => async (nonce) => {
|
|
|
357
357
|
return Credential.encode(credential);
|
|
358
358
|
};
|
|
359
359
|
var TrustedKeySetAuthVerifier = class {
|
|
360
|
-
// prettier-ignore
|
|
361
360
|
constructor(_params) {
|
|
362
361
|
this._params = _params;
|
|
363
362
|
this._ctx = new Context2();
|
|
@@ -372,7 +371,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
372
371
|
credential
|
|
373
372
|
}, {
|
|
374
373
|
F: __dxlog_file,
|
|
375
|
-
L:
|
|
374
|
+
L: 56,
|
|
376
375
|
S: this,
|
|
377
376
|
C: (f, a) => f(...a)
|
|
378
377
|
});
|
|
@@ -382,7 +381,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
382
381
|
result
|
|
383
382
|
}, {
|
|
384
383
|
F: __dxlog_file,
|
|
385
|
-
L:
|
|
384
|
+
L: 60,
|
|
386
385
|
S: this,
|
|
387
386
|
C: (f, a) => f(...a)
|
|
388
387
|
});
|
|
@@ -394,7 +393,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
394
393
|
credential
|
|
395
394
|
}, {
|
|
396
395
|
F: __dxlog_file,
|
|
397
|
-
L:
|
|
396
|
+
L: 65,
|
|
398
397
|
S: this,
|
|
399
398
|
C: (f, a) => f(...a)
|
|
400
399
|
});
|
|
@@ -405,7 +404,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
405
404
|
key: credential.issuer
|
|
406
405
|
}, {
|
|
407
406
|
F: __dxlog_file,
|
|
408
|
-
L:
|
|
407
|
+
L: 70,
|
|
409
408
|
S: this,
|
|
410
409
|
C: (f, a) => f(...a)
|
|
411
410
|
});
|
|
@@ -421,7 +420,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
421
420
|
key: credential.issuer
|
|
422
421
|
}, {
|
|
423
422
|
F: __dxlog_file,
|
|
424
|
-
L:
|
|
423
|
+
L: 81,
|
|
425
424
|
S: this,
|
|
426
425
|
C: (f, a) => f(...a)
|
|
427
426
|
});
|
|
@@ -431,7 +430,7 @@ var TrustedKeySetAuthVerifier = class {
|
|
|
431
430
|
key: credential.issuer
|
|
432
431
|
}, {
|
|
433
432
|
F: __dxlog_file,
|
|
434
|
-
L:
|
|
433
|
+
L: 84,
|
|
435
434
|
S: this,
|
|
436
435
|
C: (f, a) => f(...a)
|
|
437
436
|
});
|
|
@@ -1158,26 +1157,24 @@ var DeviceInvitationProtocol = class {
|
|
|
1158
1157
|
|
|
1159
1158
|
// packages/sdk/client-services/src/packlets/invitations/invitations-handler.ts
|
|
1160
1159
|
import { PushStream, scheduleTask as scheduleTask2, TimeoutError, Trigger as Trigger3 } from "@dxos/async";
|
|
1161
|
-
import {
|
|
1160
|
+
import { AuthenticatingInvitation, AUTHENTICATION_CODE_LENGTH, CancellableInvitation, INVITATION_TIMEOUT } from "@dxos/client-protocol";
|
|
1162
1161
|
import { Context as Context5 } from "@dxos/context";
|
|
1163
1162
|
import { generatePasscode } from "@dxos/credentials";
|
|
1164
|
-
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2 } from "@dxos/errors";
|
|
1165
1163
|
import { invariant as invariant6 } from "@dxos/invariant";
|
|
1166
1164
|
import { PublicKey as PublicKey5 } from "@dxos/keys";
|
|
1167
1165
|
import { log as log5 } from "@dxos/log";
|
|
1168
1166
|
import { createTeleportProtocolFactory, StarTopology } from "@dxos/network-manager";
|
|
1169
|
-
import { trace as trace4 } from "@dxos/protocols";
|
|
1167
|
+
import { InvalidInvitationExtensionRoleError as InvalidInvitationExtensionRoleError2, trace as trace4 } from "@dxos/protocols";
|
|
1170
1168
|
import { Invitation as Invitation3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1171
1169
|
import { AuthenticationResponse as AuthenticationResponse2 } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1172
1170
|
|
|
1173
1171
|
// packages/sdk/client-services/src/packlets/invitations/invitation-extension.ts
|
|
1174
1172
|
import { Trigger as Trigger2 } from "@dxos/async";
|
|
1175
1173
|
import { cancelWithContext, Context as Context4 } from "@dxos/context";
|
|
1176
|
-
import { InvalidInvitationExtensionRoleError } from "@dxos/errors";
|
|
1177
1174
|
import { invariant as invariant5 } from "@dxos/invariant";
|
|
1178
1175
|
import { PublicKey as PublicKey4 } from "@dxos/keys";
|
|
1179
1176
|
import { log as log4 } from "@dxos/log";
|
|
1180
|
-
import { schema as schema2, trace as trace3 } from "@dxos/protocols";
|
|
1177
|
+
import { InvalidInvitationExtensionRoleError, schema as schema2, trace as trace3 } from "@dxos/protocols";
|
|
1181
1178
|
import { Invitation as Invitation2 } from "@dxos/protocols/proto/dxos/client/services";
|
|
1182
1179
|
import { AuthenticationResponse, Options } from "@dxos/protocols/proto/dxos/halo/invitations";
|
|
1183
1180
|
import { RpcExtension } from "@dxos/teleport";
|
|
@@ -1211,7 +1208,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1211
1208
|
options: async (options) => {
|
|
1212
1209
|
invariant5(!this._remoteOptions, "Remote options already set.", {
|
|
1213
1210
|
F: __dxlog_file6,
|
|
1214
|
-
L:
|
|
1211
|
+
L: 87,
|
|
1215
1212
|
S: this,
|
|
1216
1213
|
A: [
|
|
1217
1214
|
"!this._remoteOptions",
|
|
@@ -1228,7 +1225,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1228
1225
|
id: traceId
|
|
1229
1226
|
}), {
|
|
1230
1227
|
F: __dxlog_file6,
|
|
1231
|
-
L:
|
|
1228
|
+
L: 96,
|
|
1232
1229
|
S: this,
|
|
1233
1230
|
C: (f, a) => f(...a)
|
|
1234
1231
|
});
|
|
@@ -1238,7 +1235,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1238
1235
|
invitationId
|
|
1239
1236
|
}, {
|
|
1240
1237
|
F: __dxlog_file6,
|
|
1241
|
-
L:
|
|
1238
|
+
L: 100,
|
|
1242
1239
|
S: this,
|
|
1243
1240
|
C: (f, a) => f(...a)
|
|
1244
1241
|
});
|
|
@@ -1252,7 +1249,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1252
1249
|
guestProfile: profile
|
|
1253
1250
|
}, {
|
|
1254
1251
|
F: __dxlog_file6,
|
|
1255
|
-
L:
|
|
1252
|
+
L: 109,
|
|
1256
1253
|
S: this,
|
|
1257
1254
|
C: (f, a) => f(...a)
|
|
1258
1255
|
});
|
|
@@ -1265,7 +1262,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1265
1262
|
id: traceId
|
|
1266
1263
|
}), {
|
|
1267
1264
|
F: __dxlog_file6,
|
|
1268
|
-
L:
|
|
1265
|
+
L: 116,
|
|
1269
1266
|
S: this,
|
|
1270
1267
|
C: (f, a) => f(...a)
|
|
1271
1268
|
});
|
|
@@ -1280,7 +1277,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1280
1277
|
id: traceId
|
|
1281
1278
|
}), {
|
|
1282
1279
|
F: __dxlog_file6,
|
|
1283
|
-
L:
|
|
1280
|
+
L: 125,
|
|
1284
1281
|
S: this,
|
|
1285
1282
|
C: (f, a) => f(...a)
|
|
1286
1283
|
});
|
|
@@ -1288,14 +1285,14 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1288
1285
|
authCode: code
|
|
1289
1286
|
}, {
|
|
1290
1287
|
F: __dxlog_file6,
|
|
1291
|
-
L:
|
|
1288
|
+
L: 126,
|
|
1292
1289
|
S: this,
|
|
1293
1290
|
C: (f, a) => f(...a)
|
|
1294
1291
|
});
|
|
1295
1292
|
let status = AuthenticationResponse.Status.OK;
|
|
1296
1293
|
invariant5(this.invitation, "Invitation is not set.", {
|
|
1297
1294
|
F: __dxlog_file6,
|
|
1298
|
-
L:
|
|
1295
|
+
L: 129,
|
|
1299
1296
|
S: this,
|
|
1300
1297
|
A: [
|
|
1301
1298
|
"this.invitation",
|
|
@@ -1306,7 +1303,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1306
1303
|
case Invitation2.AuthMethod.NONE: {
|
|
1307
1304
|
log4("authentication not required", void 0, {
|
|
1308
1305
|
F: __dxlog_file6,
|
|
1309
|
-
L:
|
|
1306
|
+
L: 132,
|
|
1310
1307
|
S: this,
|
|
1311
1308
|
C: (f, a) => f(...a)
|
|
1312
1309
|
});
|
|
@@ -1331,7 +1328,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1331
1328
|
authMethod: this.invitation.authMethod
|
|
1332
1329
|
}, {
|
|
1333
1330
|
F: __dxlog_file6,
|
|
1334
|
-
L:
|
|
1331
|
+
L: 150,
|
|
1335
1332
|
S: this,
|
|
1336
1333
|
C: (f, a) => f(...a)
|
|
1337
1334
|
});
|
|
@@ -1346,7 +1343,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1346
1343
|
}
|
|
1347
1344
|
}), {
|
|
1348
1345
|
F: __dxlog_file6,
|
|
1349
|
-
L:
|
|
1346
|
+
L: 156,
|
|
1350
1347
|
S: this,
|
|
1351
1348
|
C: (f, a) => f(...a)
|
|
1352
1349
|
});
|
|
@@ -1360,14 +1357,14 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1360
1357
|
id: traceId
|
|
1361
1358
|
}), {
|
|
1362
1359
|
F: __dxlog_file6,
|
|
1363
|
-
L:
|
|
1360
|
+
L: 162,
|
|
1364
1361
|
S: this,
|
|
1365
1362
|
C: (f, a) => f(...a)
|
|
1366
1363
|
});
|
|
1367
1364
|
try {
|
|
1368
1365
|
invariant5(this.invitation, "Invitation is not set.", {
|
|
1369
1366
|
F: __dxlog_file6,
|
|
1370
|
-
L:
|
|
1367
|
+
L: 165,
|
|
1371
1368
|
S: this,
|
|
1372
1369
|
A: [
|
|
1373
1370
|
"this.invitation",
|
|
@@ -1382,7 +1379,7 @@ var InvitationHostExtension = class extends RpcExtension {
|
|
|
1382
1379
|
id: traceId
|
|
1383
1380
|
}), {
|
|
1384
1381
|
F: __dxlog_file6,
|
|
1385
|
-
L:
|
|
1382
|
+
L: 173,
|
|
1386
1383
|
S: this,
|
|
1387
1384
|
C: (f, a) => f(...a)
|
|
1388
1385
|
});
|
|
@@ -1439,7 +1436,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1439
1436
|
options: async (options) => {
|
|
1440
1437
|
invariant5(!this._remoteOptions, "Remote options already set.", {
|
|
1441
1438
|
F: __dxlog_file6,
|
|
1442
|
-
L:
|
|
1439
|
+
L: 240,
|
|
1443
1440
|
S: this,
|
|
1444
1441
|
A: [
|
|
1445
1442
|
"!this._remoteOptions",
|
|
@@ -1466,7 +1463,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1466
1463
|
try {
|
|
1467
1464
|
log4("begin options", void 0, {
|
|
1468
1465
|
F: __dxlog_file6,
|
|
1469
|
-
L:
|
|
1466
|
+
L: 261,
|
|
1470
1467
|
S: this,
|
|
1471
1468
|
C: (f, a) => f(...a)
|
|
1472
1469
|
});
|
|
@@ -1478,7 +1475,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1478
1475
|
}));
|
|
1479
1476
|
log4("end options", void 0, {
|
|
1480
1477
|
F: __dxlog_file6,
|
|
1481
|
-
L:
|
|
1478
|
+
L: 264,
|
|
1482
1479
|
S: this,
|
|
1483
1480
|
C: (f, a) => f(...a)
|
|
1484
1481
|
});
|
|
@@ -1492,7 +1489,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1492
1489
|
} catch (err) {
|
|
1493
1490
|
log4("openError", err, {
|
|
1494
1491
|
F: __dxlog_file6,
|
|
1495
|
-
L:
|
|
1492
|
+
L: 274,
|
|
1496
1493
|
S: this,
|
|
1497
1494
|
C: (f, a) => f(...a)
|
|
1498
1495
|
});
|
|
@@ -1502,7 +1499,7 @@ var InvitationGuestExtension = class extends RpcExtension {
|
|
|
1502
1499
|
async onClose() {
|
|
1503
1500
|
log4("onClose", void 0, {
|
|
1504
1501
|
F: __dxlog_file6,
|
|
1505
|
-
L:
|
|
1502
|
+
L: 280,
|
|
1506
1503
|
S: this,
|
|
1507
1504
|
C: (f, a) => f(...a)
|
|
1508
1505
|
});
|
|
@@ -1525,7 +1522,7 @@ var InvitationsHandler = class {
|
|
|
1525
1522
|
const authCode = options?.authCode ?? (authMethod === Invitation3.AuthMethod.SHARED_SECRET ? generatePasscode(AUTHENTICATION_CODE_LENGTH) : void 0);
|
|
1526
1523
|
invariant6(protocol, void 0, {
|
|
1527
1524
|
F: __dxlog_file7,
|
|
1528
|
-
L:
|
|
1525
|
+
L: 75,
|
|
1529
1526
|
S: this,
|
|
1530
1527
|
A: [
|
|
1531
1528
|
"protocol",
|
|
@@ -1554,7 +1551,7 @@ var InvitationsHandler = class {
|
|
|
1554
1551
|
...protocol.toJSON()
|
|
1555
1552
|
}, {
|
|
1556
1553
|
F: __dxlog_file7,
|
|
1557
|
-
L:
|
|
1554
|
+
L: 97,
|
|
1558
1555
|
S: this,
|
|
1559
1556
|
C: (f, a) => f(...a)
|
|
1560
1557
|
});
|
|
@@ -1579,7 +1576,7 @@ var InvitationsHandler = class {
|
|
|
1579
1576
|
const deviceKey = admissionRequest.device?.deviceKey ?? admissionRequest.space?.deviceKey;
|
|
1580
1577
|
invariant6(deviceKey, void 0, {
|
|
1581
1578
|
F: __dxlog_file7,
|
|
1582
|
-
L:
|
|
1579
|
+
L: 118,
|
|
1583
1580
|
S: this,
|
|
1584
1581
|
A: [
|
|
1585
1582
|
"deviceKey",
|
|
@@ -1602,7 +1599,7 @@ var InvitationsHandler = class {
|
|
|
1602
1599
|
id: traceId
|
|
1603
1600
|
}), {
|
|
1604
1601
|
F: __dxlog_file7,
|
|
1605
|
-
L:
|
|
1602
|
+
L: 136,
|
|
1606
1603
|
S: this,
|
|
1607
1604
|
C: (f, a) => f(...a)
|
|
1608
1605
|
});
|
|
@@ -1610,7 +1607,7 @@ var InvitationsHandler = class {
|
|
|
1610
1607
|
...protocol.toJSON()
|
|
1611
1608
|
}, {
|
|
1612
1609
|
F: __dxlog_file7,
|
|
1613
|
-
L:
|
|
1610
|
+
L: 137,
|
|
1614
1611
|
S: this,
|
|
1615
1612
|
C: (f, a) => f(...a)
|
|
1616
1613
|
});
|
|
@@ -1626,7 +1623,7 @@ var InvitationsHandler = class {
|
|
|
1626
1623
|
...protocol.toJSON()
|
|
1627
1624
|
}, {
|
|
1628
1625
|
F: __dxlog_file7,
|
|
1629
|
-
L:
|
|
1626
|
+
L: 140,
|
|
1630
1627
|
S: this,
|
|
1631
1628
|
C: (f, a) => f(...a)
|
|
1632
1629
|
});
|
|
@@ -1638,7 +1635,7 @@ var InvitationsHandler = class {
|
|
|
1638
1635
|
id: traceId
|
|
1639
1636
|
}), {
|
|
1640
1637
|
F: __dxlog_file7,
|
|
1641
|
-
L:
|
|
1638
|
+
L: 142,
|
|
1642
1639
|
S: this,
|
|
1643
1640
|
C: (f, a) => f(...a)
|
|
1644
1641
|
});
|
|
@@ -1648,7 +1645,7 @@ var InvitationsHandler = class {
|
|
|
1648
1645
|
...protocol.toJSON()
|
|
1649
1646
|
}, {
|
|
1650
1647
|
F: __dxlog_file7,
|
|
1651
|
-
L:
|
|
1648
|
+
L: 145,
|
|
1652
1649
|
S: this,
|
|
1653
1650
|
C: (f, a) => f(...a)
|
|
1654
1651
|
});
|
|
@@ -1659,7 +1656,7 @@ var InvitationsHandler = class {
|
|
|
1659
1656
|
} else {
|
|
1660
1657
|
log5.error("failed", err, {
|
|
1661
1658
|
F: __dxlog_file7,
|
|
1662
|
-
L:
|
|
1659
|
+
L: 148,
|
|
1663
1660
|
S: this,
|
|
1664
1661
|
C: (f, a) => f(...a)
|
|
1665
1662
|
});
|
|
@@ -1670,7 +1667,7 @@ var InvitationsHandler = class {
|
|
|
1670
1667
|
error: err
|
|
1671
1668
|
}), {
|
|
1672
1669
|
F: __dxlog_file7,
|
|
1673
|
-
L:
|
|
1670
|
+
L: 151,
|
|
1674
1671
|
S: this,
|
|
1675
1672
|
C: (f, a) => f(...a)
|
|
1676
1673
|
});
|
|
@@ -1691,7 +1688,7 @@ var InvitationsHandler = class {
|
|
|
1691
1688
|
...protocol.toJSON()
|
|
1692
1689
|
}, {
|
|
1693
1690
|
F: __dxlog_file7,
|
|
1694
|
-
L:
|
|
1691
|
+
L: 166,
|
|
1695
1692
|
S: this,
|
|
1696
1693
|
C: (f, a) => f(...a)
|
|
1697
1694
|
});
|
|
@@ -1702,7 +1699,7 @@ var InvitationsHandler = class {
|
|
|
1702
1699
|
} else {
|
|
1703
1700
|
log5.error("failed", err, {
|
|
1704
1701
|
F: __dxlog_file7,
|
|
1705
|
-
L:
|
|
1702
|
+
L: 169,
|
|
1706
1703
|
S: this,
|
|
1707
1704
|
C: (f, a) => f(...a)
|
|
1708
1705
|
});
|
|
@@ -1730,7 +1727,7 @@ var InvitationsHandler = class {
|
|
|
1730
1727
|
state: Invitation3.State.CONNECTING
|
|
1731
1728
|
});
|
|
1732
1729
|
});
|
|
1733
|
-
const observable = new
|
|
1730
|
+
const observable = new CancellableInvitation({
|
|
1734
1731
|
initialInvitation: invitation,
|
|
1735
1732
|
subscriber: stream.observable,
|
|
1736
1733
|
onCancel: async () => {
|
|
@@ -1747,7 +1744,7 @@ var InvitationsHandler = class {
|
|
|
1747
1744
|
const { timeout = INVITATION_TIMEOUT } = invitation;
|
|
1748
1745
|
invariant6(protocol, void 0, {
|
|
1749
1746
|
F: __dxlog_file7,
|
|
1750
|
-
L:
|
|
1747
|
+
L: 210,
|
|
1751
1748
|
S: this,
|
|
1752
1749
|
A: [
|
|
1753
1750
|
"protocol",
|
|
@@ -1761,7 +1758,7 @@ var InvitationsHandler = class {
|
|
|
1761
1758
|
const setState = (newData) => {
|
|
1762
1759
|
invariant6(newData.state !== void 0, void 0, {
|
|
1763
1760
|
F: __dxlog_file7,
|
|
1764
|
-
L:
|
|
1761
|
+
L: 221,
|
|
1765
1762
|
S: this,
|
|
1766
1763
|
A: [
|
|
1767
1764
|
"newData.state !== undefined",
|
|
@@ -1781,7 +1778,7 @@ var InvitationsHandler = class {
|
|
|
1781
1778
|
...protocol.toJSON()
|
|
1782
1779
|
}, {
|
|
1783
1780
|
F: __dxlog_file7,
|
|
1784
|
-
L:
|
|
1781
|
+
L: 229,
|
|
1785
1782
|
S: this,
|
|
1786
1783
|
C: (f, a) => f(...a)
|
|
1787
1784
|
});
|
|
@@ -1791,7 +1788,7 @@ var InvitationsHandler = class {
|
|
|
1791
1788
|
} else {
|
|
1792
1789
|
log5.warn("auth failed", err, {
|
|
1793
1790
|
F: __dxlog_file7,
|
|
1794
|
-
L:
|
|
1791
|
+
L: 232,
|
|
1795
1792
|
S: this,
|
|
1796
1793
|
C: (f, a) => f(...a)
|
|
1797
1794
|
});
|
|
@@ -1805,7 +1802,7 @@ var InvitationsHandler = class {
|
|
|
1805
1802
|
...protocol.toJSON()
|
|
1806
1803
|
}, {
|
|
1807
1804
|
F: __dxlog_file7,
|
|
1808
|
-
L:
|
|
1805
|
+
L: 240,
|
|
1809
1806
|
S: this,
|
|
1810
1807
|
C: (f, a) => f(...a)
|
|
1811
1808
|
});
|
|
@@ -1820,7 +1817,7 @@ var InvitationsHandler = class {
|
|
|
1820
1817
|
currentState
|
|
1821
1818
|
}, {
|
|
1822
1819
|
F: __dxlog_file7,
|
|
1823
|
-
L:
|
|
1820
|
+
L: 250,
|
|
1824
1821
|
S: this,
|
|
1825
1822
|
C: (f, a) => f(...a)
|
|
1826
1823
|
});
|
|
@@ -1835,7 +1832,7 @@ var InvitationsHandler = class {
|
|
|
1835
1832
|
id: traceId
|
|
1836
1833
|
}), {
|
|
1837
1834
|
F: __dxlog_file7,
|
|
1838
|
-
L:
|
|
1835
|
+
L: 259,
|
|
1839
1836
|
S: this,
|
|
1840
1837
|
C: (f, a) => f(...a)
|
|
1841
1838
|
});
|
|
@@ -1847,7 +1844,7 @@ var InvitationsHandler = class {
|
|
|
1847
1844
|
...protocol.toJSON()
|
|
1848
1845
|
}, {
|
|
1849
1846
|
F: __dxlog_file7,
|
|
1850
|
-
L:
|
|
1847
|
+
L: 267,
|
|
1851
1848
|
S: this,
|
|
1852
1849
|
C: (f, a) => f(...a)
|
|
1853
1850
|
});
|
|
@@ -1858,7 +1855,7 @@ var InvitationsHandler = class {
|
|
|
1858
1855
|
...protocol.toJSON()
|
|
1859
1856
|
}, {
|
|
1860
1857
|
F: __dxlog_file7,
|
|
1861
|
-
L:
|
|
1858
|
+
L: 271,
|
|
1862
1859
|
S: this,
|
|
1863
1860
|
C: (f, a) => f(...a)
|
|
1864
1861
|
});
|
|
@@ -1868,7 +1865,7 @@ var InvitationsHandler = class {
|
|
|
1868
1865
|
response: introductionResponse
|
|
1869
1866
|
}, {
|
|
1870
1867
|
F: __dxlog_file7,
|
|
1871
|
-
L:
|
|
1868
|
+
L: 275,
|
|
1872
1869
|
S: this,
|
|
1873
1870
|
C: (f, a) => f(...a)
|
|
1874
1871
|
});
|
|
@@ -1880,7 +1877,7 @@ var InvitationsHandler = class {
|
|
|
1880
1877
|
for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
|
|
1881
1878
|
log5("guest waiting for authentication code...", void 0, {
|
|
1882
1879
|
F: __dxlog_file7,
|
|
1883
|
-
L:
|
|
1880
|
+
L: 284,
|
|
1884
1881
|
S: this,
|
|
1885
1882
|
C: (f, a) => f(...a)
|
|
1886
1883
|
});
|
|
@@ -1892,7 +1889,7 @@ var InvitationsHandler = class {
|
|
|
1892
1889
|
});
|
|
1893
1890
|
log5("sending authentication request", void 0, {
|
|
1894
1891
|
F: __dxlog_file7,
|
|
1895
|
-
L:
|
|
1892
|
+
L: 288,
|
|
1896
1893
|
S: this,
|
|
1897
1894
|
C: (f, a) => f(...a)
|
|
1898
1895
|
});
|
|
@@ -1913,7 +1910,7 @@ var InvitationsHandler = class {
|
|
|
1913
1910
|
attempt
|
|
1914
1911
|
}, {
|
|
1915
1912
|
F: __dxlog_file7,
|
|
1916
|
-
L:
|
|
1913
|
+
L: 299,
|
|
1917
1914
|
S: this,
|
|
1918
1915
|
C: (f, a) => f(...a)
|
|
1919
1916
|
});
|
|
@@ -1930,7 +1927,7 @@ var InvitationsHandler = class {
|
|
|
1930
1927
|
...protocol.toJSON()
|
|
1931
1928
|
}, {
|
|
1932
1929
|
F: __dxlog_file7,
|
|
1933
|
-
L:
|
|
1930
|
+
L: 310,
|
|
1934
1931
|
S: this,
|
|
1935
1932
|
C: (f, a) => f(...a)
|
|
1936
1933
|
});
|
|
@@ -1942,7 +1939,7 @@ var InvitationsHandler = class {
|
|
|
1942
1939
|
...protocol.toJSON()
|
|
1943
1940
|
}, {
|
|
1944
1941
|
F: __dxlog_file7,
|
|
1945
|
-
L:
|
|
1942
|
+
L: 321,
|
|
1946
1943
|
S: this,
|
|
1947
1944
|
C: (f, a) => f(...a)
|
|
1948
1945
|
});
|
|
@@ -1954,7 +1951,7 @@ var InvitationsHandler = class {
|
|
|
1954
1951
|
id: traceId
|
|
1955
1952
|
}), {
|
|
1956
1953
|
F: __dxlog_file7,
|
|
1957
|
-
L:
|
|
1954
|
+
L: 323,
|
|
1958
1955
|
S: this,
|
|
1959
1956
|
C: (f, a) => f(...a)
|
|
1960
1957
|
});
|
|
@@ -1964,7 +1961,7 @@ var InvitationsHandler = class {
|
|
|
1964
1961
|
...protocol.toJSON()
|
|
1965
1962
|
}, {
|
|
1966
1963
|
F: __dxlog_file7,
|
|
1967
|
-
L:
|
|
1964
|
+
L: 326,
|
|
1968
1965
|
S: this,
|
|
1969
1966
|
C: (f, a) => f(...a)
|
|
1970
1967
|
});
|
|
@@ -1974,7 +1971,7 @@ var InvitationsHandler = class {
|
|
|
1974
1971
|
} else {
|
|
1975
1972
|
log5("auth failed", err, {
|
|
1976
1973
|
F: __dxlog_file7,
|
|
1977
|
-
L:
|
|
1974
|
+
L: 329,
|
|
1978
1975
|
S: this,
|
|
1979
1976
|
C: (f, a) => f(...a)
|
|
1980
1977
|
});
|
|
@@ -1985,7 +1982,7 @@ var InvitationsHandler = class {
|
|
|
1985
1982
|
error: err
|
|
1986
1983
|
}), {
|
|
1987
1984
|
F: __dxlog_file7,
|
|
1988
|
-
L:
|
|
1985
|
+
L: 332,
|
|
1989
1986
|
S: this,
|
|
1990
1987
|
C: (f, a) => f(...a)
|
|
1991
1988
|
});
|
|
@@ -2003,7 +2000,7 @@ var InvitationsHandler = class {
|
|
|
2003
2000
|
...protocol.toJSON()
|
|
2004
2001
|
}, {
|
|
2005
2002
|
F: __dxlog_file7,
|
|
2006
|
-
L:
|
|
2003
|
+
L: 343,
|
|
2007
2004
|
S: this,
|
|
2008
2005
|
C: (f, a) => f(...a)
|
|
2009
2006
|
});
|
|
@@ -2013,7 +2010,7 @@ var InvitationsHandler = class {
|
|
|
2013
2010
|
} else {
|
|
2014
2011
|
log5("auth failed", err, {
|
|
2015
2012
|
F: __dxlog_file7,
|
|
2016
|
-
L:
|
|
2013
|
+
L: 346,
|
|
2017
2014
|
S: this,
|
|
2018
2015
|
C: (f, a) => f(...a)
|
|
2019
2016
|
});
|
|
@@ -2026,7 +2023,7 @@ var InvitationsHandler = class {
|
|
|
2026
2023
|
scheduleTask2(ctx, async () => {
|
|
2027
2024
|
invariant6(invitation.swarmKey, void 0, {
|
|
2028
2025
|
F: __dxlog_file7,
|
|
2029
|
-
L:
|
|
2026
|
+
L: 356,
|
|
2030
2027
|
S: this,
|
|
2031
2028
|
A: [
|
|
2032
2029
|
"invitation.swarmKey",
|
|
@@ -2048,7 +2045,7 @@ var InvitationsHandler = class {
|
|
|
2048
2045
|
state: Invitation3.State.CONNECTING
|
|
2049
2046
|
});
|
|
2050
2047
|
});
|
|
2051
|
-
const observable = new
|
|
2048
|
+
const observable = new AuthenticatingInvitation({
|
|
2052
2049
|
initialInvitation: invitation,
|
|
2053
2050
|
subscriber: stream.observable,
|
|
2054
2051
|
onCancel: async () => {
|
|
@@ -2070,7 +2067,7 @@ import { Event as Event3 } from "@dxos/async";
|
|
|
2070
2067
|
import { Stream as Stream8 } from "@dxos/codec-protobuf";
|
|
2071
2068
|
import { invariant as invariant7 } from "@dxos/invariant";
|
|
2072
2069
|
import { log as log6 } from "@dxos/log";
|
|
2073
|
-
import { QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
2070
|
+
import { Invitation as Invitation4, QueryInvitationsResponse } from "@dxos/protocols/proto/dxos/client/services";
|
|
2074
2071
|
var __dxlog_file8 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/invitations-service.ts";
|
|
2075
2072
|
var InvitationsServiceImpl = class {
|
|
2076
2073
|
constructor(_invitationsHandler, _getHandler) {
|
|
@@ -2106,7 +2103,9 @@ var InvitationsServiceImpl = class {
|
|
|
2106
2103
|
}, () => {
|
|
2107
2104
|
close();
|
|
2108
2105
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
2109
|
-
|
|
2106
|
+
if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
|
|
2107
|
+
this._removedCreated.emit(invitation.get());
|
|
2108
|
+
}
|
|
2110
2109
|
});
|
|
2111
2110
|
});
|
|
2112
2111
|
}
|
|
@@ -2129,20 +2128,22 @@ var InvitationsServiceImpl = class {
|
|
|
2129
2128
|
}, () => {
|
|
2130
2129
|
close();
|
|
2131
2130
|
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2132
|
-
|
|
2131
|
+
if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
|
|
2132
|
+
this._removedAccepted.emit(invitation.get());
|
|
2133
|
+
}
|
|
2133
2134
|
});
|
|
2134
2135
|
});
|
|
2135
2136
|
}
|
|
2136
2137
|
async authenticate({ invitationId, authCode }) {
|
|
2137
2138
|
log6("authenticating...", void 0, {
|
|
2138
2139
|
F: __dxlog_file8,
|
|
2139
|
-
L:
|
|
2140
|
+
L: 108,
|
|
2140
2141
|
S: this,
|
|
2141
2142
|
C: (f, a) => f(...a)
|
|
2142
2143
|
});
|
|
2143
2144
|
invariant7(invitationId, void 0, {
|
|
2144
2145
|
F: __dxlog_file8,
|
|
2145
|
-
L:
|
|
2146
|
+
L: 109,
|
|
2146
2147
|
S: this,
|
|
2147
2148
|
A: [
|
|
2148
2149
|
"invitationId",
|
|
@@ -2155,7 +2156,7 @@ var InvitationsServiceImpl = class {
|
|
|
2155
2156
|
invitationId
|
|
2156
2157
|
}, {
|
|
2157
2158
|
F: __dxlog_file8,
|
|
2158
|
-
L:
|
|
2159
|
+
L: 112,
|
|
2159
2160
|
S: this,
|
|
2160
2161
|
C: (f, a) => f(...a)
|
|
2161
2162
|
});
|
|
@@ -2166,13 +2167,13 @@ var InvitationsServiceImpl = class {
|
|
|
2166
2167
|
async cancelInvitation({ invitationId }) {
|
|
2167
2168
|
log6("deleting...", void 0, {
|
|
2168
2169
|
F: __dxlog_file8,
|
|
2169
|
-
L:
|
|
2170
|
+
L: 119,
|
|
2170
2171
|
S: this,
|
|
2171
2172
|
C: (f, a) => f(...a)
|
|
2172
2173
|
});
|
|
2173
2174
|
invariant7(invitationId, void 0, {
|
|
2174
2175
|
F: __dxlog_file8,
|
|
2175
|
-
L:
|
|
2176
|
+
L: 120,
|
|
2176
2177
|
S: this,
|
|
2177
2178
|
A: [
|
|
2178
2179
|
"invitationId",
|
|
@@ -2194,7 +2195,7 @@ var InvitationsServiceImpl = class {
|
|
|
2194
2195
|
invitationId
|
|
2195
2196
|
}, {
|
|
2196
2197
|
F: __dxlog_file8,
|
|
2197
|
-
L:
|
|
2198
|
+
L: 132,
|
|
2198
2199
|
S: this,
|
|
2199
2200
|
C: (f, a) => f(...a)
|
|
2200
2201
|
});
|
|
@@ -2257,7 +2258,7 @@ import { createAdmissionCredentials, getCredentialAssertion } from "@dxos/creden
|
|
|
2257
2258
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
2258
2259
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
2259
2260
|
import { log as log7 } from "@dxos/log";
|
|
2260
|
-
import { Invitation as
|
|
2261
|
+
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
2261
2262
|
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
2262
2263
|
var SpaceInvitationProtocol = class {
|
|
2263
2264
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
@@ -2274,7 +2275,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2274
2275
|
}
|
|
2275
2276
|
getInvitationContext() {
|
|
2276
2277
|
return {
|
|
2277
|
-
kind:
|
|
2278
|
+
kind: Invitation5.Kind.SPACE,
|
|
2278
2279
|
spaceKey: this._spaceKey
|
|
2279
2280
|
};
|
|
2280
2281
|
}
|
|
@@ -2468,9 +2469,6 @@ import { log as log8 } from "@dxos/log";
|
|
|
2468
2469
|
import { STORAGE_VERSION } from "@dxos/protocols";
|
|
2469
2470
|
import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
2470
2471
|
|
|
2471
|
-
// packages/sdk/client-services/src/version.ts
|
|
2472
|
-
var DXOS_VERSION = "0.1.58-main.b605d47";
|
|
2473
|
-
|
|
2474
2472
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
2475
2473
|
var getPlatform = () => {
|
|
2476
2474
|
if (process.browser) {
|
|
@@ -2499,6 +2497,9 @@ var getPlatform = () => {
|
|
|
2499
2497
|
}
|
|
2500
2498
|
};
|
|
2501
2499
|
|
|
2500
|
+
// packages/sdk/client-services/src/version.ts
|
|
2501
|
+
var DXOS_VERSION = "0.1.58-main.ba8fa9e";
|
|
2502
|
+
|
|
2502
2503
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2503
2504
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2504
2505
|
var DEFAULT_TIMEOUT = 1e3;
|
|
@@ -2623,9 +2624,9 @@ import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
|
|
|
2623
2624
|
import { cancelWithContext as cancelWithContext2, Context as Context7 } from "@dxos/context";
|
|
2624
2625
|
import { timed } from "@dxos/debug";
|
|
2625
2626
|
import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
2626
|
-
import { CancelledError, SystemError } from "@dxos/errors";
|
|
2627
2627
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
2628
2628
|
import { log as log10 } from "@dxos/log";
|
|
2629
|
+
import { CancelledError, SystemError } from "@dxos/protocols";
|
|
2629
2630
|
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
2630
2631
|
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2631
2632
|
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
@@ -2934,7 +2935,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2934
2935
|
this._signingContext = params.signingContext;
|
|
2935
2936
|
this._callbacks = params.callbacks ?? {};
|
|
2936
2937
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
2937
|
-
trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.
|
|
2938
|
+
trustedKeysProvider: () => new ComplexSet2(PublicKey7.hash, Array.from(this._inner.spaceState.members.values()).filter((member) => !member.removed).map((member) => member.key)),
|
|
2938
2939
|
update: this._inner.stateUpdate,
|
|
2939
2940
|
authTimeout: AUTH_TIMEOUT2
|
|
2940
2941
|
});
|
|
@@ -2944,7 +2945,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2944
2945
|
state: SpaceState[this._state]
|
|
2945
2946
|
}, {
|
|
2946
2947
|
F: __dxlog_file12,
|
|
2947
|
-
L:
|
|
2948
|
+
L: 118,
|
|
2948
2949
|
S: this,
|
|
2949
2950
|
C: (f, a) => f(...a)
|
|
2950
2951
|
});
|
|
@@ -2978,6 +2979,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2978
2979
|
await this._open();
|
|
2979
2980
|
}
|
|
2980
2981
|
async _open() {
|
|
2982
|
+
await this._gossip.open();
|
|
2981
2983
|
await this._notarizationPlugin.open();
|
|
2982
2984
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
2983
2985
|
await this._inner.open(new Context7());
|
|
@@ -2986,7 +2988,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2986
2988
|
state: SpaceState[this._state]
|
|
2987
2989
|
}, {
|
|
2988
2990
|
F: __dxlog_file12,
|
|
2989
|
-
L:
|
|
2991
|
+
L: 165,
|
|
2990
2992
|
S: this,
|
|
2991
2993
|
C: (f, a) => f(...a)
|
|
2992
2994
|
});
|
|
@@ -3004,7 +3006,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3004
3006
|
state: SpaceState[this._state]
|
|
3005
3007
|
}, {
|
|
3006
3008
|
F: __dxlog_file12,
|
|
3007
|
-
L:
|
|
3009
|
+
L: 179,
|
|
3008
3010
|
S: this,
|
|
3009
3011
|
C: (f, a) => f(...a)
|
|
3010
3012
|
});
|
|
@@ -3015,6 +3017,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3015
3017
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
3016
3018
|
await this._notarizationPlugin.close();
|
|
3017
3019
|
await this._presence.destroy();
|
|
3020
|
+
await this._gossip.close();
|
|
3018
3021
|
}
|
|
3019
3022
|
async postMessage(channel, message) {
|
|
3020
3023
|
return this._gossip.postMessage(channel, message);
|
|
@@ -3034,7 +3037,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3034
3037
|
if (err instanceof CancelledError) {
|
|
3035
3038
|
log10("data pipeline initialization cancelled", err, {
|
|
3036
3039
|
F: __dxlog_file12,
|
|
3037
|
-
L:
|
|
3040
|
+
L: 211,
|
|
3038
3041
|
S: this,
|
|
3039
3042
|
C: (f, a) => f(...a)
|
|
3040
3043
|
});
|
|
@@ -3042,7 +3045,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3042
3045
|
}
|
|
3043
3046
|
log10.error("Error initializing data pipeline", err, {
|
|
3044
3047
|
F: __dxlog_file12,
|
|
3045
|
-
L:
|
|
3048
|
+
L: 215,
|
|
3046
3049
|
S: this,
|
|
3047
3050
|
C: (f, a) => f(...a)
|
|
3048
3051
|
});
|
|
@@ -3051,7 +3054,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3051
3054
|
state: SpaceState[this._state]
|
|
3052
3055
|
}, {
|
|
3053
3056
|
F: __dxlog_file12,
|
|
3054
|
-
L:
|
|
3057
|
+
L: 217,
|
|
3055
3058
|
S: this,
|
|
3056
3059
|
C: (f, a) => f(...a)
|
|
3057
3060
|
});
|
|
@@ -3071,7 +3074,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3071
3074
|
state: SpaceState[this._state]
|
|
3072
3075
|
}, {
|
|
3073
3076
|
F: __dxlog_file12,
|
|
3074
|
-
L:
|
|
3077
|
+
L: 233,
|
|
3075
3078
|
S: this,
|
|
3076
3079
|
C: (f, a) => f(...a)
|
|
3077
3080
|
});
|
|
@@ -3082,7 +3085,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3082
3085
|
await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3083
3086
|
log10("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3084
3087
|
F: __dxlog_file12,
|
|
3085
|
-
L:
|
|
3088
|
+
L: 247,
|
|
3086
3089
|
S: this,
|
|
3087
3090
|
C: (f, a) => f(...a)
|
|
3088
3091
|
});
|
|
@@ -3093,7 +3096,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3093
3096
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3094
3097
|
log10("data pipeline ready", void 0, {
|
|
3095
3098
|
F: __dxlog_file12,
|
|
3096
|
-
L:
|
|
3099
|
+
L: 256,
|
|
3097
3100
|
S: this,
|
|
3098
3101
|
C: (f, a) => f(...a)
|
|
3099
3102
|
});
|
|
@@ -3103,7 +3106,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3103
3106
|
state: SpaceState[this._state]
|
|
3104
3107
|
}, {
|
|
3105
3108
|
F: __dxlog_file12,
|
|
3106
|
-
L:
|
|
3109
|
+
L: 260,
|
|
3107
3110
|
S: this,
|
|
3108
3111
|
C: (f, a) => f(...a)
|
|
3109
3112
|
});
|
|
@@ -3119,7 +3122,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3119
3122
|
await this._createWritableFeeds();
|
|
3120
3123
|
log10("writable feeds created", void 0, {
|
|
3121
3124
|
F: __dxlog_file12,
|
|
3122
|
-
L:
|
|
3125
|
+
L: 276,
|
|
3123
3126
|
S: this,
|
|
3124
3127
|
C: (f, a) => f(...a)
|
|
3125
3128
|
});
|
|
@@ -3224,7 +3227,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3224
3227
|
state: SpaceState[this._state]
|
|
3225
3228
|
}, {
|
|
3226
3229
|
F: __dxlog_file12,
|
|
3227
|
-
L:
|
|
3230
|
+
L: 392,
|
|
3228
3231
|
S: this,
|
|
3229
3232
|
C: (f, a) => f(...a)
|
|
3230
3233
|
});
|
|
@@ -3678,10 +3681,9 @@ DataSpaceManager = _ts_decorate4([
|
|
|
3678
3681
|
import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask5 } from "@dxos/async";
|
|
3679
3682
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
3680
3683
|
import { raise as raise2 } from "@dxos/debug";
|
|
3681
|
-
import {
|
|
3682
|
-
import { ApiError } from "@dxos/errors";
|
|
3684
|
+
import { invariant as invariant12 } from "@dxos/invariant";
|
|
3683
3685
|
import { log as log12 } from "@dxos/log";
|
|
3684
|
-
import { encodeError } from "@dxos/protocols";
|
|
3686
|
+
import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
|
|
3685
3687
|
import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3686
3688
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
3687
3689
|
var SpacesServiceImpl = class {
|
|
@@ -3744,7 +3746,7 @@ var SpacesServiceImpl = class {
|
|
|
3744
3746
|
subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
|
|
3745
3747
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
3746
3748
|
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
3747
|
-
space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
|
|
3749
|
+
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
3748
3750
|
if (space.dataPipeline.pipelineState) {
|
|
3749
3751
|
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
3750
3752
|
}
|
|
@@ -3781,8 +3783,8 @@ var SpacesServiceImpl = class {
|
|
|
3781
3783
|
});
|
|
3782
3784
|
});
|
|
3783
3785
|
}
|
|
3784
|
-
queryCredentials({ spaceKey }) {
|
|
3785
|
-
return new Stream10(({ ctx, next }) => {
|
|
3786
|
+
queryCredentials({ spaceKey, noTail }) {
|
|
3787
|
+
return new Stream10(({ ctx, next, close }) => {
|
|
3786
3788
|
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
|
|
3787
3789
|
const processor = {
|
|
3788
3790
|
processCredential: async (credential) => {
|
|
@@ -3790,17 +3792,62 @@ var SpacesServiceImpl = class {
|
|
|
3790
3792
|
}
|
|
3791
3793
|
};
|
|
3792
3794
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
3793
|
-
scheduleTask5(ctx, () =>
|
|
3795
|
+
scheduleTask5(ctx, async () => {
|
|
3796
|
+
await space.spaceState.addCredentialProcessor(processor);
|
|
3797
|
+
if (noTail) {
|
|
3798
|
+
close();
|
|
3799
|
+
}
|
|
3800
|
+
});
|
|
3794
3801
|
});
|
|
3795
3802
|
}
|
|
3796
3803
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3797
3804
|
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
|
|
3798
3805
|
for (const credential of credentials ?? []) {
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
credential
|
|
3802
|
-
|
|
3803
|
-
|
|
3806
|
+
if (credential.proof) {
|
|
3807
|
+
await space.controlPipeline.writer.write({
|
|
3808
|
+
credential: {
|
|
3809
|
+
credential
|
|
3810
|
+
}
|
|
3811
|
+
});
|
|
3812
|
+
} else {
|
|
3813
|
+
invariant12(!credential.id, "Id on unsigned credentials is not allowed", {
|
|
3814
|
+
F: __dxlog_file14,
|
|
3815
|
+
L: 168,
|
|
3816
|
+
S: this,
|
|
3817
|
+
A: [
|
|
3818
|
+
"!credential.id",
|
|
3819
|
+
"'Id on unsigned credentials is not allowed'"
|
|
3820
|
+
]
|
|
3821
|
+
});
|
|
3822
|
+
invariant12(this._identityManager.identity, "Identity is not available", {
|
|
3823
|
+
F: __dxlog_file14,
|
|
3824
|
+
L: 169,
|
|
3825
|
+
S: this,
|
|
3826
|
+
A: [
|
|
3827
|
+
"this._identityManager.identity",
|
|
3828
|
+
"'Identity is not available'"
|
|
3829
|
+
]
|
|
3830
|
+
});
|
|
3831
|
+
const signer = this._identityManager.identity.getIdentityCredentialSigner();
|
|
3832
|
+
invariant12(credential.issuer.equals(signer.getIssuer()), void 0, {
|
|
3833
|
+
F: __dxlog_file14,
|
|
3834
|
+
L: 171,
|
|
3835
|
+
S: this,
|
|
3836
|
+
A: [
|
|
3837
|
+
"credential.issuer.equals(signer.getIssuer())",
|
|
3838
|
+
""
|
|
3839
|
+
]
|
|
3840
|
+
});
|
|
3841
|
+
const signedCredential = await signer.createCredential({
|
|
3842
|
+
subject: credential.subject.id,
|
|
3843
|
+
assertion: credential.subject.assertion
|
|
3844
|
+
});
|
|
3845
|
+
await space.controlPipeline.writer.write({
|
|
3846
|
+
credential: {
|
|
3847
|
+
credential: signedCredential
|
|
3848
|
+
}
|
|
3849
|
+
});
|
|
3850
|
+
}
|
|
3804
3851
|
}
|
|
3805
3852
|
}
|
|
3806
3853
|
async createEpoch({ spaceKey }) {
|
|
@@ -3839,7 +3886,7 @@ var SpacesServiceImpl = class {
|
|
|
3839
3886
|
displayName: member.assertion.profile?.displayName
|
|
3840
3887
|
}
|
|
3841
3888
|
},
|
|
3842
|
-
presence: isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
|
|
3889
|
+
presence: member.removed ? SpaceMember3.PresenceState.REMOVED : isMe || peers.length > 0 ? SpaceMember3.PresenceState.ONLINE : SpaceMember3.PresenceState.OFFLINE,
|
|
3843
3890
|
peerStates: peers
|
|
3844
3891
|
};
|
|
3845
3892
|
}),
|
|
@@ -3858,12 +3905,12 @@ import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credent
|
|
|
3858
3905
|
import { failUndefined as failUndefined3 } from "@dxos/debug";
|
|
3859
3906
|
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from "@dxos/echo-pipeline";
|
|
3860
3907
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
3861
|
-
import { invariant as
|
|
3908
|
+
import { invariant as invariant13 } from "@dxos/invariant";
|
|
3862
3909
|
import { Keyring } from "@dxos/keyring";
|
|
3863
3910
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
3864
3911
|
import { log as log13 } from "@dxos/log";
|
|
3865
|
-
import { STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
|
|
3866
|
-
import { Invitation as
|
|
3912
|
+
import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
|
|
3913
|
+
import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3867
3914
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
3868
3915
|
import { trace as Trace2 } from "@dxos/tracing";
|
|
3869
3916
|
import { safeInstanceof } from "@dxos/util";
|
|
@@ -3879,7 +3926,6 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3879
3926
|
}
|
|
3880
3927
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
3881
3928
|
var ServiceContext = class ServiceContext2 {
|
|
3882
|
-
// prettier-ignore
|
|
3883
3929
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
3884
3930
|
this.storage = storage;
|
|
3885
3931
|
this.networkManager = networkManager;
|
|
@@ -3913,13 +3959,13 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3913
3959
|
});
|
|
3914
3960
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
3915
3961
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
3916
|
-
this._handlerFactories.set(
|
|
3962
|
+
this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined3(), this._acceptIdentity.bind(this)));
|
|
3917
3963
|
}
|
|
3918
3964
|
async open(ctx) {
|
|
3919
3965
|
await this._checkStorageVersion();
|
|
3920
3966
|
log13("opening...", void 0, {
|
|
3921
3967
|
F: __dxlog_file15,
|
|
3922
|
-
L:
|
|
3968
|
+
L: 129,
|
|
3923
3969
|
S: this,
|
|
3924
3970
|
C: (f, a) => f(...a)
|
|
3925
3971
|
});
|
|
@@ -3927,7 +3973,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3927
3973
|
id: this._instanceId
|
|
3928
3974
|
}), {
|
|
3929
3975
|
F: __dxlog_file15,
|
|
3930
|
-
L:
|
|
3976
|
+
L: 130,
|
|
3931
3977
|
S: this,
|
|
3932
3978
|
C: (f, a) => f(...a)
|
|
3933
3979
|
});
|
|
@@ -3943,13 +3989,13 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3943
3989
|
id: this._instanceId
|
|
3944
3990
|
}), {
|
|
3945
3991
|
F: __dxlog_file15,
|
|
3946
|
-
L:
|
|
3992
|
+
L: 140,
|
|
3947
3993
|
S: this,
|
|
3948
3994
|
C: (f, a) => f(...a)
|
|
3949
3995
|
});
|
|
3950
3996
|
log13("opened", void 0, {
|
|
3951
3997
|
F: __dxlog_file15,
|
|
3952
|
-
L:
|
|
3998
|
+
L: 141,
|
|
3953
3999
|
S: this,
|
|
3954
4000
|
C: (f, a) => f(...a)
|
|
3955
4001
|
});
|
|
@@ -3957,7 +4003,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3957
4003
|
async close() {
|
|
3958
4004
|
log13("closing...", void 0, {
|
|
3959
4005
|
F: __dxlog_file15,
|
|
3960
|
-
L:
|
|
4006
|
+
L: 145,
|
|
3961
4007
|
S: this,
|
|
3962
4008
|
C: (f, a) => f(...a)
|
|
3963
4009
|
});
|
|
@@ -3974,7 +4020,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3974
4020
|
await this.metadataStore.close();
|
|
3975
4021
|
log13("closed", void 0, {
|
|
3976
4022
|
F: __dxlog_file15,
|
|
3977
|
-
L:
|
|
4023
|
+
L: 157,
|
|
3978
4024
|
S: this,
|
|
3979
4025
|
C: (f, a) => f(...a)
|
|
3980
4026
|
});
|
|
@@ -3986,9 +4032,9 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3986
4032
|
}
|
|
3987
4033
|
getInvitationHandler(invitation) {
|
|
3988
4034
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
3989
|
-
|
|
4035
|
+
invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
3990
4036
|
F: __dxlog_file15,
|
|
3991
|
-
L:
|
|
4037
|
+
L: 168,
|
|
3992
4038
|
S: this,
|
|
3993
4039
|
A: [
|
|
3994
4040
|
"factory",
|
|
@@ -4005,14 +4051,14 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4005
4051
|
async _checkStorageVersion() {
|
|
4006
4052
|
await this.metadataStore.load();
|
|
4007
4053
|
if (this.metadataStore.version !== STORAGE_VERSION2) {
|
|
4008
|
-
throw new
|
|
4054
|
+
throw new InvalidStorageVersionError(STORAGE_VERSION2, this.metadataStore.version);
|
|
4009
4055
|
}
|
|
4010
4056
|
}
|
|
4011
4057
|
// Called when identity is created.
|
|
4012
4058
|
async _initialize(ctx) {
|
|
4013
4059
|
log13("initializing spaces...", void 0, {
|
|
4014
4060
|
F: __dxlog_file15,
|
|
4015
|
-
L:
|
|
4061
|
+
L: 189,
|
|
4016
4062
|
S: this,
|
|
4017
4063
|
C: (f, a) => f(...a)
|
|
4018
4064
|
});
|
|
@@ -4032,10 +4078,10 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4032
4078
|
};
|
|
4033
4079
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
4034
4080
|
await this.dataSpaceManager.open();
|
|
4035
|
-
this._handlerFactories.set(
|
|
4036
|
-
|
|
4081
|
+
this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
|
|
4082
|
+
invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4037
4083
|
F: __dxlog_file15,
|
|
4038
|
-
L:
|
|
4084
|
+
L: 212,
|
|
4039
4085
|
S: this,
|
|
4040
4086
|
A: [
|
|
4041
4087
|
"this.dataSpaceManager",
|
|
@@ -4059,7 +4105,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4059
4105
|
details: assertion
|
|
4060
4106
|
}, {
|
|
4061
4107
|
F: __dxlog_file15,
|
|
4062
|
-
L:
|
|
4108
|
+
L: 228,
|
|
4063
4109
|
S: this,
|
|
4064
4110
|
C: (f, a) => f(...a)
|
|
4065
4111
|
});
|
|
@@ -4070,7 +4116,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4070
4116
|
details: assertion
|
|
4071
4117
|
}, {
|
|
4072
4118
|
F: __dxlog_file15,
|
|
4073
|
-
L:
|
|
4119
|
+
L: 232,
|
|
4074
4120
|
S: this,
|
|
4075
4121
|
C: (f, a) => f(...a)
|
|
4076
4122
|
});
|
|
@@ -4081,7 +4127,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4081
4127
|
details: assertion
|
|
4082
4128
|
}, {
|
|
4083
4129
|
F: __dxlog_file15,
|
|
4084
|
-
L:
|
|
4130
|
+
L: 237,
|
|
4085
4131
|
S: this,
|
|
4086
4132
|
C: (f, a) => f(...a)
|
|
4087
4133
|
});
|
|
@@ -4092,7 +4138,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4092
4138
|
} catch (err) {
|
|
4093
4139
|
log13.catch(err, void 0, {
|
|
4094
4140
|
F: __dxlog_file15,
|
|
4095
|
-
L:
|
|
4141
|
+
L: 243,
|
|
4096
4142
|
S: this,
|
|
4097
4143
|
C: (f, a) => f(...a)
|
|
4098
4144
|
});
|
|
@@ -4113,6 +4159,30 @@ ServiceContext = _ts_decorate5([
|
|
|
4113
4159
|
Trace2.resource()
|
|
4114
4160
|
], ServiceContext);
|
|
4115
4161
|
|
|
4162
|
+
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
4163
|
+
var ServiceRegistry = class {
|
|
4164
|
+
// prettier-ignore
|
|
4165
|
+
constructor(_serviceBundle, _handlers = {}) {
|
|
4166
|
+
this._serviceBundle = _serviceBundle;
|
|
4167
|
+
this._handlers = _handlers;
|
|
4168
|
+
}
|
|
4169
|
+
get descriptors() {
|
|
4170
|
+
return this._serviceBundle;
|
|
4171
|
+
}
|
|
4172
|
+
get services() {
|
|
4173
|
+
return this._handlers;
|
|
4174
|
+
}
|
|
4175
|
+
setServices(services) {
|
|
4176
|
+
this._handlers = services;
|
|
4177
|
+
}
|
|
4178
|
+
addService(name, service) {
|
|
4179
|
+
this._handlers[name] = service;
|
|
4180
|
+
}
|
|
4181
|
+
removeService(name) {
|
|
4182
|
+
delete this._handlers[name];
|
|
4183
|
+
}
|
|
4184
|
+
};
|
|
4185
|
+
|
|
4116
4186
|
// packages/sdk/client-services/src/packlets/locks/browser.ts
|
|
4117
4187
|
import { asyncTimeout, Trigger as Trigger6 } from "@dxos/async";
|
|
4118
4188
|
import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
|
|
@@ -4239,29 +4309,29 @@ var isLocked = (lockPath) => {
|
|
|
4239
4309
|
|
|
4240
4310
|
// packages/sdk/client-services/src/packlets/storage/storage.ts
|
|
4241
4311
|
import { DX_DATA } from "@dxos/client-protocol";
|
|
4242
|
-
import { InvalidConfigError } from "@dxos/
|
|
4312
|
+
import { InvalidConfigError } from "@dxos/protocols";
|
|
4243
4313
|
import { Runtime } from "@dxos/protocols/proto/dxos/config";
|
|
4244
4314
|
import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
4245
4315
|
import { isNode } from "@dxos/util";
|
|
4246
4316
|
var StorageDriver = Runtime.Client.Storage.StorageDriver;
|
|
4247
4317
|
var createStorageObjects = (config) => {
|
|
4248
|
-
const {
|
|
4249
|
-
if (persistent &&
|
|
4318
|
+
const { persistent = false, keyStore, dataStore, dataRoot = isNode() ? DX_DATA : "dxos/storage" } = config ?? {};
|
|
4319
|
+
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4250
4320
|
throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4251
4321
|
}
|
|
4252
|
-
if (!persistent &&
|
|
4322
|
+
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
4253
4323
|
throw new InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4254
4324
|
}
|
|
4255
|
-
if (persistent &&
|
|
4325
|
+
if (persistent && keyStore === StorageDriver.RAM) {
|
|
4256
4326
|
throw new InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4257
4327
|
}
|
|
4258
|
-
if (!persistent &&
|
|
4328
|
+
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
4259
4329
|
throw new InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4260
4330
|
}
|
|
4261
4331
|
return {
|
|
4262
4332
|
storage: createStorage({
|
|
4263
|
-
type: persistent ? toStorageType(
|
|
4264
|
-
root: `${
|
|
4333
|
+
type: persistent ? toStorageType(dataStore) : StorageType.RAM,
|
|
4334
|
+
root: `${dataRoot}/`
|
|
4265
4335
|
})
|
|
4266
4336
|
};
|
|
4267
4337
|
};
|
|
@@ -4286,37 +4356,14 @@ var toStorageType = (type) => {
|
|
|
4286
4356
|
}
|
|
4287
4357
|
};
|
|
4288
4358
|
|
|
4289
|
-
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
4290
|
-
var ServiceRegistry = class {
|
|
4291
|
-
// prettier-ignore
|
|
4292
|
-
constructor(_serviceBundle, _handlers = {}) {
|
|
4293
|
-
this._serviceBundle = _serviceBundle;
|
|
4294
|
-
this._handlers = _handlers;
|
|
4295
|
-
}
|
|
4296
|
-
get descriptors() {
|
|
4297
|
-
return this._serviceBundle;
|
|
4298
|
-
}
|
|
4299
|
-
get services() {
|
|
4300
|
-
return this._handlers;
|
|
4301
|
-
}
|
|
4302
|
-
setServices(services) {
|
|
4303
|
-
this._handlers = services;
|
|
4304
|
-
}
|
|
4305
|
-
addService(name, service) {
|
|
4306
|
-
this._handlers[name] = service;
|
|
4307
|
-
}
|
|
4308
|
-
removeService(name) {
|
|
4309
|
-
delete this._handlers[name];
|
|
4310
|
-
}
|
|
4311
|
-
};
|
|
4312
|
-
|
|
4313
4359
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
4314
4360
|
import { Event as Event8, synchronized as synchronized3 } from "@dxos/async";
|
|
4315
|
-
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
4361
|
+
import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protocol";
|
|
4316
4362
|
import { Context as Context10 } from "@dxos/context";
|
|
4317
4363
|
import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
|
|
4318
4364
|
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
4319
|
-
import {
|
|
4365
|
+
import { base } from "@dxos/echo-schema";
|
|
4366
|
+
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4320
4367
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
4321
4368
|
import { log as log16 } from "@dxos/log";
|
|
4322
4369
|
import { WebsocketSignalManager } from "@dxos/messaging";
|
|
@@ -4589,6 +4636,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
4589
4636
|
var createDefaultModelFactory = () => {
|
|
4590
4637
|
return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
|
|
4591
4638
|
};
|
|
4639
|
+
var createGenesisMutationFromTypedObject = (obj) => {
|
|
4640
|
+
const snapshot = obj[base]._createSnapshot();
|
|
4641
|
+
return {
|
|
4642
|
+
objectId: obj[base]._id,
|
|
4643
|
+
genesis: {
|
|
4644
|
+
modelType: obj[base]._modelConstructor.meta.type
|
|
4645
|
+
},
|
|
4646
|
+
snapshot: {
|
|
4647
|
+
model: snapshot
|
|
4648
|
+
}
|
|
4649
|
+
};
|
|
4650
|
+
};
|
|
4592
4651
|
var ClientServicesHost = class ClientServicesHost2 {
|
|
4593
4652
|
constructor({
|
|
4594
4653
|
config,
|
|
@@ -4673,9 +4732,9 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4673
4732
|
* Can only be called once.
|
|
4674
4733
|
*/
|
|
4675
4734
|
initialize({ config, ...options }) {
|
|
4676
|
-
|
|
4735
|
+
invariant14(!this._open, "service host is open", {
|
|
4677
4736
|
F: __dxlog_file17,
|
|
4678
|
-
L:
|
|
4737
|
+
L: 201,
|
|
4679
4738
|
S: this,
|
|
4680
4739
|
A: [
|
|
4681
4740
|
"!this._open",
|
|
@@ -4684,14 +4743,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4684
4743
|
});
|
|
4685
4744
|
log16("initializing...", void 0, {
|
|
4686
4745
|
F: __dxlog_file17,
|
|
4687
|
-
L:
|
|
4746
|
+
L: 202,
|
|
4688
4747
|
S: this,
|
|
4689
4748
|
C: (f, a) => f(...a)
|
|
4690
4749
|
});
|
|
4691
4750
|
if (config) {
|
|
4692
|
-
|
|
4751
|
+
invariant14(!this._config, "config already set", {
|
|
4693
4752
|
F: __dxlog_file17,
|
|
4694
|
-
L:
|
|
4753
|
+
L: 205,
|
|
4695
4754
|
S: this,
|
|
4696
4755
|
A: [
|
|
4697
4756
|
"!this._config",
|
|
@@ -4707,9 +4766,9 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4707
4766
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4708
4767
|
}), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4709
4768
|
this._signalManager = signalManager;
|
|
4710
|
-
|
|
4769
|
+
invariant14(!this._networkManager, "network manager already set", {
|
|
4711
4770
|
F: __dxlog_file17,
|
|
4712
|
-
L:
|
|
4771
|
+
L: 221,
|
|
4713
4772
|
S: this,
|
|
4714
4773
|
A: [
|
|
4715
4774
|
"!this._networkManager",
|
|
@@ -4723,7 +4782,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4723
4782
|
});
|
|
4724
4783
|
log16("initialized", void 0, {
|
|
4725
4784
|
F: __dxlog_file17,
|
|
4726
|
-
L:
|
|
4785
|
+
L: 228,
|
|
4727
4786
|
S: this,
|
|
4728
4787
|
C: (f, a) => f(...a)
|
|
4729
4788
|
});
|
|
@@ -4737,40 +4796,40 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4737
4796
|
id: traceId
|
|
4738
4797
|
}), {
|
|
4739
4798
|
F: __dxlog_file17,
|
|
4740
|
-
L:
|
|
4799
|
+
L: 239,
|
|
4741
4800
|
S: this,
|
|
4742
4801
|
C: (f, a) => f(...a)
|
|
4743
4802
|
});
|
|
4744
|
-
|
|
4803
|
+
invariant14(this._config, "config not set", {
|
|
4745
4804
|
F: __dxlog_file17,
|
|
4746
|
-
L:
|
|
4805
|
+
L: 241,
|
|
4747
4806
|
S: this,
|
|
4748
4807
|
A: [
|
|
4749
4808
|
"this._config",
|
|
4750
4809
|
"'config not set'"
|
|
4751
4810
|
]
|
|
4752
4811
|
});
|
|
4753
|
-
|
|
4812
|
+
invariant14(this._storage, "storage not set", {
|
|
4754
4813
|
F: __dxlog_file17,
|
|
4755
|
-
L:
|
|
4814
|
+
L: 242,
|
|
4756
4815
|
S: this,
|
|
4757
4816
|
A: [
|
|
4758
4817
|
"this._storage",
|
|
4759
4818
|
"'storage not set'"
|
|
4760
4819
|
]
|
|
4761
4820
|
});
|
|
4762
|
-
|
|
4821
|
+
invariant14(this._signalManager, "signal manager not set", {
|
|
4763
4822
|
F: __dxlog_file17,
|
|
4764
|
-
L:
|
|
4823
|
+
L: 243,
|
|
4765
4824
|
S: this,
|
|
4766
4825
|
A: [
|
|
4767
4826
|
"this._signalManager",
|
|
4768
4827
|
"'signal manager not set'"
|
|
4769
4828
|
]
|
|
4770
4829
|
});
|
|
4771
|
-
|
|
4830
|
+
invariant14(this._networkManager, "network manager not set", {
|
|
4772
4831
|
F: __dxlog_file17,
|
|
4773
|
-
L:
|
|
4832
|
+
L: 244,
|
|
4774
4833
|
S: this,
|
|
4775
4834
|
A: [
|
|
4776
4835
|
"this._networkManager",
|
|
@@ -4782,7 +4841,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4782
4841
|
lockKey: this._resourceLock?.lockKey
|
|
4783
4842
|
}, {
|
|
4784
4843
|
F: __dxlog_file17,
|
|
4785
|
-
L:
|
|
4844
|
+
L: 247,
|
|
4786
4845
|
S: this,
|
|
4787
4846
|
C: (f, a) => f(...a)
|
|
4788
4847
|
});
|
|
@@ -4791,7 +4850,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4791
4850
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
4792
4851
|
this._serviceRegistry.setServices({
|
|
4793
4852
|
SystemService: this._systemService,
|
|
4794
|
-
IdentityService: new IdentityServiceImpl((params) => this.
|
|
4853
|
+
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
|
|
4795
4854
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
4796
4855
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
4797
4856
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
@@ -4828,7 +4887,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4828
4887
|
deviceKey
|
|
4829
4888
|
}, {
|
|
4830
4889
|
F: __dxlog_file17,
|
|
4831
|
-
L:
|
|
4890
|
+
L: 316,
|
|
4832
4891
|
S: this,
|
|
4833
4892
|
C: (f, a) => f(...a)
|
|
4834
4893
|
});
|
|
@@ -4836,7 +4895,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4836
4895
|
id: traceId
|
|
4837
4896
|
}), {
|
|
4838
4897
|
F: __dxlog_file17,
|
|
4839
|
-
L:
|
|
4898
|
+
L: 317,
|
|
4840
4899
|
S: this,
|
|
4841
4900
|
C: (f, a) => f(...a)
|
|
4842
4901
|
});
|
|
@@ -4850,7 +4909,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4850
4909
|
deviceKey
|
|
4851
4910
|
}, {
|
|
4852
4911
|
F: __dxlog_file17,
|
|
4853
|
-
L:
|
|
4912
|
+
L: 328,
|
|
4854
4913
|
S: this,
|
|
4855
4914
|
C: (f, a) => f(...a)
|
|
4856
4915
|
});
|
|
@@ -4866,7 +4925,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4866
4925
|
deviceKey
|
|
4867
4926
|
}, {
|
|
4868
4927
|
F: __dxlog_file17,
|
|
4869
|
-
L:
|
|
4928
|
+
L: 335,
|
|
4870
4929
|
S: this,
|
|
4871
4930
|
C: (f, a) => f(...a)
|
|
4872
4931
|
});
|
|
@@ -4877,13 +4936,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4877
4936
|
id: traceId
|
|
4878
4937
|
}), {
|
|
4879
4938
|
F: __dxlog_file17,
|
|
4880
|
-
L:
|
|
4939
|
+
L: 340,
|
|
4881
4940
|
S: this,
|
|
4882
4941
|
C: (f, a) => f(...a)
|
|
4883
4942
|
});
|
|
4884
4943
|
log16("resetting...", void 0, {
|
|
4885
4944
|
F: __dxlog_file17,
|
|
4886
|
-
L:
|
|
4945
|
+
L: 342,
|
|
4887
4946
|
S: this,
|
|
4888
4947
|
C: (f, a) => f(...a)
|
|
4889
4948
|
});
|
|
@@ -4891,7 +4950,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4891
4950
|
await this._storage.reset();
|
|
4892
4951
|
log16("reset", void 0, {
|
|
4893
4952
|
F: __dxlog_file17,
|
|
4894
|
-
L:
|
|
4953
|
+
L: 345,
|
|
4895
4954
|
S: this,
|
|
4896
4955
|
C: (f, a) => f(...a)
|
|
4897
4956
|
});
|
|
@@ -4899,12 +4958,31 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4899
4958
|
id: traceId
|
|
4900
4959
|
}), {
|
|
4901
4960
|
F: __dxlog_file17,
|
|
4902
|
-
L:
|
|
4961
|
+
L: 346,
|
|
4903
4962
|
S: this,
|
|
4904
4963
|
C: (f, a) => f(...a)
|
|
4905
4964
|
});
|
|
4906
4965
|
await this._callbacks?.onReset?.();
|
|
4907
4966
|
}
|
|
4967
|
+
async _createIdentity(params) {
|
|
4968
|
+
const identity = await this._serviceContext.createIdentity(params);
|
|
4969
|
+
await this._serviceContext.initialized.wait();
|
|
4970
|
+
const space = await this._serviceContext.dataSpaceManager.createSpace();
|
|
4971
|
+
const obj = new Properties();
|
|
4972
|
+
obj[defaultKey] = identity.identityKey.toHex();
|
|
4973
|
+
await this._serviceRegistry.services.DataService.write({
|
|
4974
|
+
spaceKey: space.key,
|
|
4975
|
+
batch: {
|
|
4976
|
+
objects: [
|
|
4977
|
+
createGenesisMutationFromTypedObject(obj)
|
|
4978
|
+
]
|
|
4979
|
+
}
|
|
4980
|
+
});
|
|
4981
|
+
await this._serviceRegistry.services.DataService.flush({
|
|
4982
|
+
spaceKey: space.key
|
|
4983
|
+
});
|
|
4984
|
+
return identity;
|
|
4985
|
+
}
|
|
4908
4986
|
};
|
|
4909
4987
|
_ts_decorate7([
|
|
4910
4988
|
Trace3.info()
|
|
@@ -4950,11 +5028,11 @@ export {
|
|
|
4950
5028
|
DataSpaceManager,
|
|
4951
5029
|
SpacesServiceImpl,
|
|
4952
5030
|
ServiceContext,
|
|
5031
|
+
ServiceRegistry,
|
|
4953
5032
|
Lock,
|
|
4954
5033
|
isLocked,
|
|
4955
5034
|
createStorageObjects,
|
|
4956
|
-
ServiceRegistry,
|
|
4957
5035
|
createDefaultModelFactory,
|
|
4958
5036
|
ClientServicesHost
|
|
4959
5037
|
};
|
|
4960
|
-
//# sourceMappingURL=chunk-
|
|
5038
|
+
//# sourceMappingURL=chunk-XT2TMICH.mjs.map
|