@dxos/client-services 0.1.58-main.ffbb8a1 → 0.1.58-next.6d0af18
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-YLR3BYMV.mjs → chunk-DJ4JCFP7.mjs} +271 -191
- package/dist/lib/browser/chunk-DJ4JCFP7.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 -233
- 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 -230
- 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 -5
- 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-YLR3BYMV.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,6 +2103,9 @@ var InvitationsServiceImpl = class {
|
|
|
2106
2103
|
}, () => {
|
|
2107
2104
|
close();
|
|
2108
2105
|
this._createInvitations.delete(invitation.get().invitationId);
|
|
2106
|
+
if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
|
|
2107
|
+
this._removedCreated.emit(invitation.get());
|
|
2108
|
+
}
|
|
2109
2109
|
});
|
|
2110
2110
|
});
|
|
2111
2111
|
}
|
|
@@ -2128,19 +2128,22 @@ var InvitationsServiceImpl = class {
|
|
|
2128
2128
|
}, () => {
|
|
2129
2129
|
close();
|
|
2130
2130
|
this._acceptInvitations.delete(invitation.get().invitationId);
|
|
2131
|
+
if (invitation.get().type !== Invitation4.Type.MULTIUSE) {
|
|
2132
|
+
this._removedAccepted.emit(invitation.get());
|
|
2133
|
+
}
|
|
2131
2134
|
});
|
|
2132
2135
|
});
|
|
2133
2136
|
}
|
|
2134
2137
|
async authenticate({ invitationId, authCode }) {
|
|
2135
2138
|
log6("authenticating...", void 0, {
|
|
2136
2139
|
F: __dxlog_file8,
|
|
2137
|
-
L:
|
|
2140
|
+
L: 108,
|
|
2138
2141
|
S: this,
|
|
2139
2142
|
C: (f, a) => f(...a)
|
|
2140
2143
|
});
|
|
2141
2144
|
invariant7(invitationId, void 0, {
|
|
2142
2145
|
F: __dxlog_file8,
|
|
2143
|
-
L:
|
|
2146
|
+
L: 109,
|
|
2144
2147
|
S: this,
|
|
2145
2148
|
A: [
|
|
2146
2149
|
"invitationId",
|
|
@@ -2153,7 +2156,7 @@ var InvitationsServiceImpl = class {
|
|
|
2153
2156
|
invitationId
|
|
2154
2157
|
}, {
|
|
2155
2158
|
F: __dxlog_file8,
|
|
2156
|
-
L:
|
|
2159
|
+
L: 112,
|
|
2157
2160
|
S: this,
|
|
2158
2161
|
C: (f, a) => f(...a)
|
|
2159
2162
|
});
|
|
@@ -2164,13 +2167,13 @@ var InvitationsServiceImpl = class {
|
|
|
2164
2167
|
async cancelInvitation({ invitationId }) {
|
|
2165
2168
|
log6("deleting...", void 0, {
|
|
2166
2169
|
F: __dxlog_file8,
|
|
2167
|
-
L:
|
|
2170
|
+
L: 119,
|
|
2168
2171
|
S: this,
|
|
2169
2172
|
C: (f, a) => f(...a)
|
|
2170
2173
|
});
|
|
2171
2174
|
invariant7(invitationId, void 0, {
|
|
2172
2175
|
F: __dxlog_file8,
|
|
2173
|
-
L:
|
|
2176
|
+
L: 120,
|
|
2174
2177
|
S: this,
|
|
2175
2178
|
A: [
|
|
2176
2179
|
"invitationId",
|
|
@@ -2192,7 +2195,7 @@ var InvitationsServiceImpl = class {
|
|
|
2192
2195
|
invitationId
|
|
2193
2196
|
}, {
|
|
2194
2197
|
F: __dxlog_file8,
|
|
2195
|
-
L:
|
|
2198
|
+
L: 132,
|
|
2196
2199
|
S: this,
|
|
2197
2200
|
C: (f, a) => f(...a)
|
|
2198
2201
|
});
|
|
@@ -2255,7 +2258,7 @@ import { createAdmissionCredentials, getCredentialAssertion } from "@dxos/creden
|
|
|
2255
2258
|
import { writeMessages as writeMessages2 } from "@dxos/feed-store";
|
|
2256
2259
|
import { invariant as invariant8 } from "@dxos/invariant";
|
|
2257
2260
|
import { log as log7 } from "@dxos/log";
|
|
2258
|
-
import { Invitation as
|
|
2261
|
+
import { Invitation as Invitation5 } from "@dxos/protocols/proto/dxos/client/services";
|
|
2259
2262
|
var __dxlog_file9 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/invitations/space-invitation-protocol.ts";
|
|
2260
2263
|
var SpaceInvitationProtocol = class {
|
|
2261
2264
|
constructor(_spaceManager, _signingContext, _keyring, _spaceKey) {
|
|
@@ -2272,7 +2275,7 @@ var SpaceInvitationProtocol = class {
|
|
|
2272
2275
|
}
|
|
2273
2276
|
getInvitationContext() {
|
|
2274
2277
|
return {
|
|
2275
|
-
kind:
|
|
2278
|
+
kind: Invitation5.Kind.SPACE,
|
|
2276
2279
|
spaceKey: this._spaceKey
|
|
2277
2280
|
};
|
|
2278
2281
|
}
|
|
@@ -2466,9 +2469,6 @@ import { log as log8 } from "@dxos/log";
|
|
|
2466
2469
|
import { STORAGE_VERSION } from "@dxos/protocols";
|
|
2467
2470
|
import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
|
|
2468
2471
|
|
|
2469
|
-
// packages/sdk/client-services/src/version.ts
|
|
2470
|
-
var DXOS_VERSION = "0.1.58-main.ffbb8a1";
|
|
2471
|
-
|
|
2472
2472
|
// packages/sdk/client-services/src/packlets/services/platform.ts
|
|
2473
2473
|
var getPlatform = () => {
|
|
2474
2474
|
if (process.browser) {
|
|
@@ -2497,6 +2497,9 @@ var getPlatform = () => {
|
|
|
2497
2497
|
}
|
|
2498
2498
|
};
|
|
2499
2499
|
|
|
2500
|
+
// packages/sdk/client-services/src/version.ts
|
|
2501
|
+
var DXOS_VERSION = "0.1.58-next.6d0af18";
|
|
2502
|
+
|
|
2500
2503
|
// packages/sdk/client-services/src/packlets/services/diagnostics.ts
|
|
2501
2504
|
var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
|
|
2502
2505
|
var DEFAULT_TIMEOUT = 1e3;
|
|
@@ -2621,9 +2624,9 @@ import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
|
|
|
2621
2624
|
import { cancelWithContext as cancelWithContext2, Context as Context7 } from "@dxos/context";
|
|
2622
2625
|
import { timed } from "@dxos/debug";
|
|
2623
2626
|
import { createMappedFeedWriter } from "@dxos/echo-pipeline";
|
|
2624
|
-
import { CancelledError, SystemError } from "@dxos/errors";
|
|
2625
2627
|
import { PublicKey as PublicKey7 } from "@dxos/keys";
|
|
2626
2628
|
import { log as log10 } from "@dxos/log";
|
|
2629
|
+
import { CancelledError, SystemError } from "@dxos/protocols";
|
|
2627
2630
|
import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
|
|
2628
2631
|
import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
|
|
2629
2632
|
import { Timeframe as Timeframe2 } from "@dxos/timeframe";
|
|
@@ -2932,7 +2935,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2932
2935
|
this._signingContext = params.signingContext;
|
|
2933
2936
|
this._callbacks = params.callbacks ?? {};
|
|
2934
2937
|
this.authVerifier = new TrustedKeySetAuthVerifier({
|
|
2935
|
-
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)),
|
|
2936
2939
|
update: this._inner.stateUpdate,
|
|
2937
2940
|
authTimeout: AUTH_TIMEOUT2
|
|
2938
2941
|
});
|
|
@@ -2942,7 +2945,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2942
2945
|
state: SpaceState[this._state]
|
|
2943
2946
|
}, {
|
|
2944
2947
|
F: __dxlog_file12,
|
|
2945
|
-
L:
|
|
2948
|
+
L: 118,
|
|
2946
2949
|
S: this,
|
|
2947
2950
|
C: (f, a) => f(...a)
|
|
2948
2951
|
});
|
|
@@ -2976,6 +2979,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2976
2979
|
await this._open();
|
|
2977
2980
|
}
|
|
2978
2981
|
async _open() {
|
|
2982
|
+
await this._gossip.open();
|
|
2979
2983
|
await this._notarizationPlugin.open();
|
|
2980
2984
|
await this._inner.spaceState.addCredentialProcessor(this._notarizationPlugin);
|
|
2981
2985
|
await this._inner.open(new Context7());
|
|
@@ -2984,7 +2988,7 @@ var DataSpace = class DataSpace2 {
|
|
|
2984
2988
|
state: SpaceState[this._state]
|
|
2985
2989
|
}, {
|
|
2986
2990
|
F: __dxlog_file12,
|
|
2987
|
-
L:
|
|
2991
|
+
L: 165,
|
|
2988
2992
|
S: this,
|
|
2989
2993
|
C: (f, a) => f(...a)
|
|
2990
2994
|
});
|
|
@@ -3002,7 +3006,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3002
3006
|
state: SpaceState[this._state]
|
|
3003
3007
|
}, {
|
|
3004
3008
|
F: __dxlog_file12,
|
|
3005
|
-
L:
|
|
3009
|
+
L: 179,
|
|
3006
3010
|
S: this,
|
|
3007
3011
|
C: (f, a) => f(...a)
|
|
3008
3012
|
});
|
|
@@ -3013,6 +3017,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3013
3017
|
await this._inner.spaceState.removeCredentialProcessor(this._notarizationPlugin);
|
|
3014
3018
|
await this._notarizationPlugin.close();
|
|
3015
3019
|
await this._presence.destroy();
|
|
3020
|
+
await this._gossip.close();
|
|
3016
3021
|
}
|
|
3017
3022
|
async postMessage(channel, message) {
|
|
3018
3023
|
return this._gossip.postMessage(channel, message);
|
|
@@ -3032,7 +3037,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3032
3037
|
if (err instanceof CancelledError) {
|
|
3033
3038
|
log10("data pipeline initialization cancelled", err, {
|
|
3034
3039
|
F: __dxlog_file12,
|
|
3035
|
-
L:
|
|
3040
|
+
L: 211,
|
|
3036
3041
|
S: this,
|
|
3037
3042
|
C: (f, a) => f(...a)
|
|
3038
3043
|
});
|
|
@@ -3040,7 +3045,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3040
3045
|
}
|
|
3041
3046
|
log10.error("Error initializing data pipeline", err, {
|
|
3042
3047
|
F: __dxlog_file12,
|
|
3043
|
-
L:
|
|
3048
|
+
L: 215,
|
|
3044
3049
|
S: this,
|
|
3045
3050
|
C: (f, a) => f(...a)
|
|
3046
3051
|
});
|
|
@@ -3049,7 +3054,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3049
3054
|
state: SpaceState[this._state]
|
|
3050
3055
|
}, {
|
|
3051
3056
|
F: __dxlog_file12,
|
|
3052
|
-
L:
|
|
3057
|
+
L: 217,
|
|
3053
3058
|
S: this,
|
|
3054
3059
|
C: (f, a) => f(...a)
|
|
3055
3060
|
});
|
|
@@ -3069,7 +3074,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3069
3074
|
state: SpaceState[this._state]
|
|
3070
3075
|
}, {
|
|
3071
3076
|
F: __dxlog_file12,
|
|
3072
|
-
L:
|
|
3077
|
+
L: 233,
|
|
3073
3078
|
S: this,
|
|
3074
3079
|
C: (f, a) => f(...a)
|
|
3075
3080
|
});
|
|
@@ -3080,7 +3085,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3080
3085
|
await cancelWithContext2(this._ctx, this._inner.dataPipeline.ensureEpochInitialized());
|
|
3081
3086
|
log10("waiting for data pipeline to reach target timeframe", void 0, {
|
|
3082
3087
|
F: __dxlog_file12,
|
|
3083
|
-
L:
|
|
3088
|
+
L: 247,
|
|
3084
3089
|
S: this,
|
|
3085
3090
|
C: (f, a) => f(...a)
|
|
3086
3091
|
});
|
|
@@ -3091,7 +3096,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3091
3096
|
this.metrics.dataPipelineReady = /* @__PURE__ */ new Date();
|
|
3092
3097
|
log10("data pipeline ready", void 0, {
|
|
3093
3098
|
F: __dxlog_file12,
|
|
3094
|
-
L:
|
|
3099
|
+
L: 256,
|
|
3095
3100
|
S: this,
|
|
3096
3101
|
C: (f, a) => f(...a)
|
|
3097
3102
|
});
|
|
@@ -3101,7 +3106,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3101
3106
|
state: SpaceState[this._state]
|
|
3102
3107
|
}, {
|
|
3103
3108
|
F: __dxlog_file12,
|
|
3104
|
-
L:
|
|
3109
|
+
L: 260,
|
|
3105
3110
|
S: this,
|
|
3106
3111
|
C: (f, a) => f(...a)
|
|
3107
3112
|
});
|
|
@@ -3117,7 +3122,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3117
3122
|
await this._createWritableFeeds();
|
|
3118
3123
|
log10("writable feeds created", void 0, {
|
|
3119
3124
|
F: __dxlog_file12,
|
|
3120
|
-
L:
|
|
3125
|
+
L: 276,
|
|
3121
3126
|
S: this,
|
|
3122
3127
|
C: (f, a) => f(...a)
|
|
3123
3128
|
});
|
|
@@ -3222,7 +3227,7 @@ var DataSpace = class DataSpace2 {
|
|
|
3222
3227
|
state: SpaceState[this._state]
|
|
3223
3228
|
}, {
|
|
3224
3229
|
F: __dxlog_file12,
|
|
3225
|
-
L:
|
|
3230
|
+
L: 392,
|
|
3226
3231
|
S: this,
|
|
3227
3232
|
C: (f, a) => f(...a)
|
|
3228
3233
|
});
|
|
@@ -3676,10 +3681,9 @@ DataSpaceManager = _ts_decorate4([
|
|
|
3676
3681
|
import { EventSubscriptions as EventSubscriptions2, UpdateScheduler, scheduleTask as scheduleTask5 } from "@dxos/async";
|
|
3677
3682
|
import { Stream as Stream10 } from "@dxos/codec-protobuf";
|
|
3678
3683
|
import { raise as raise2 } from "@dxos/debug";
|
|
3679
|
-
import {
|
|
3680
|
-
import { ApiError } from "@dxos/errors";
|
|
3684
|
+
import { invariant as invariant12 } from "@dxos/invariant";
|
|
3681
3685
|
import { log as log12 } from "@dxos/log";
|
|
3682
|
-
import { encodeError } from "@dxos/protocols";
|
|
3686
|
+
import { ApiError, SpaceNotFoundError, encodeError } from "@dxos/protocols";
|
|
3683
3687
|
import { SpaceMember as SpaceMember3, SpaceState as SpaceState3 } from "@dxos/protocols/proto/dxos/client/services";
|
|
3684
3688
|
var __dxlog_file14 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/spaces/spaces-service.ts";
|
|
3685
3689
|
var SpacesServiceImpl = class {
|
|
@@ -3742,7 +3746,7 @@ var SpacesServiceImpl = class {
|
|
|
3742
3746
|
subscriptions.add(space.stateUpdate.on(ctx, () => scheduler.forceTrigger()));
|
|
3743
3747
|
subscriptions.add(space.presence.updated.on(ctx, () => scheduler.trigger()));
|
|
3744
3748
|
subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, () => scheduler.trigger()));
|
|
3745
|
-
space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger());
|
|
3749
|
+
subscriptions.add(space.inner.controlPipeline.state.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
3746
3750
|
if (space.dataPipeline.pipelineState) {
|
|
3747
3751
|
subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.on(ctx, () => scheduler.trigger()));
|
|
3748
3752
|
}
|
|
@@ -3779,8 +3783,8 @@ var SpacesServiceImpl = class {
|
|
|
3779
3783
|
});
|
|
3780
3784
|
});
|
|
3781
3785
|
}
|
|
3782
|
-
queryCredentials({ spaceKey }) {
|
|
3783
|
-
return new Stream10(({ ctx, next }) => {
|
|
3786
|
+
queryCredentials({ spaceKey, noTail }) {
|
|
3787
|
+
return new Stream10(({ ctx, next, close }) => {
|
|
3784
3788
|
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
|
|
3785
3789
|
const processor = {
|
|
3786
3790
|
processCredential: async (credential) => {
|
|
@@ -3788,17 +3792,62 @@ var SpacesServiceImpl = class {
|
|
|
3788
3792
|
}
|
|
3789
3793
|
};
|
|
3790
3794
|
ctx.onDispose(() => space.spaceState.removeCredentialProcessor(processor));
|
|
3791
|
-
scheduleTask5(ctx, () =>
|
|
3795
|
+
scheduleTask5(ctx, async () => {
|
|
3796
|
+
await space.spaceState.addCredentialProcessor(processor);
|
|
3797
|
+
if (noTail) {
|
|
3798
|
+
close();
|
|
3799
|
+
}
|
|
3800
|
+
});
|
|
3792
3801
|
});
|
|
3793
3802
|
}
|
|
3794
3803
|
async writeCredentials({ spaceKey, credentials }) {
|
|
3795
3804
|
const space = this._spaceManager.spaces.get(spaceKey) ?? raise2(new SpaceNotFoundError(spaceKey));
|
|
3796
3805
|
for (const credential of credentials ?? []) {
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
credential
|
|
3800
|
-
|
|
3801
|
-
|
|
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
|
+
}
|
|
3802
3851
|
}
|
|
3803
3852
|
}
|
|
3804
3853
|
async createEpoch({ spaceKey }) {
|
|
@@ -3837,7 +3886,7 @@ var SpacesServiceImpl = class {
|
|
|
3837
3886
|
displayName: member.assertion.profile?.displayName
|
|
3838
3887
|
}
|
|
3839
3888
|
},
|
|
3840
|
-
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,
|
|
3841
3890
|
peerStates: peers
|
|
3842
3891
|
};
|
|
3843
3892
|
}),
|
|
@@ -3856,12 +3905,12 @@ import { getCredentialAssertion as getCredentialAssertion3 } from "@dxos/credent
|
|
|
3856
3905
|
import { failUndefined as failUndefined3 } from "@dxos/debug";
|
|
3857
3906
|
import { valueEncoding, MetadataStore, SpaceManager, DataServiceSubscriptions, SnapshotStore } from "@dxos/echo-pipeline";
|
|
3858
3907
|
import { FeedFactory, FeedStore } from "@dxos/feed-store";
|
|
3859
|
-
import { invariant as
|
|
3908
|
+
import { invariant as invariant13 } from "@dxos/invariant";
|
|
3860
3909
|
import { Keyring } from "@dxos/keyring";
|
|
3861
3910
|
import { PublicKey as PublicKey9 } from "@dxos/keys";
|
|
3862
3911
|
import { log as log13 } from "@dxos/log";
|
|
3863
|
-
import { STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
|
|
3864
|
-
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";
|
|
3865
3914
|
import { BlobStore } from "@dxos/teleport-extension-object-sync";
|
|
3866
3915
|
import { trace as Trace2 } from "@dxos/tracing";
|
|
3867
3916
|
import { safeInstanceof } from "@dxos/util";
|
|
@@ -3877,7 +3926,6 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
3877
3926
|
}
|
|
3878
3927
|
var __dxlog_file15 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/service-context.ts";
|
|
3879
3928
|
var ServiceContext = class ServiceContext2 {
|
|
3880
|
-
// prettier-ignore
|
|
3881
3929
|
constructor(storage, networkManager, signalManager, modelFactory) {
|
|
3882
3930
|
this.storage = storage;
|
|
3883
3931
|
this.networkManager = networkManager;
|
|
@@ -3911,13 +3959,13 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3911
3959
|
});
|
|
3912
3960
|
this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
|
|
3913
3961
|
this.invitations = new InvitationsHandler(this.networkManager);
|
|
3914
|
-
this._handlerFactories.set(
|
|
3962
|
+
this._handlerFactories.set(Invitation6.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => this.identityManager.identity ?? failUndefined3(), this._acceptIdentity.bind(this)));
|
|
3915
3963
|
}
|
|
3916
3964
|
async open(ctx) {
|
|
3917
3965
|
await this._checkStorageVersion();
|
|
3918
3966
|
log13("opening...", void 0, {
|
|
3919
3967
|
F: __dxlog_file15,
|
|
3920
|
-
L:
|
|
3968
|
+
L: 129,
|
|
3921
3969
|
S: this,
|
|
3922
3970
|
C: (f, a) => f(...a)
|
|
3923
3971
|
});
|
|
@@ -3925,7 +3973,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3925
3973
|
id: this._instanceId
|
|
3926
3974
|
}), {
|
|
3927
3975
|
F: __dxlog_file15,
|
|
3928
|
-
L:
|
|
3976
|
+
L: 130,
|
|
3929
3977
|
S: this,
|
|
3930
3978
|
C: (f, a) => f(...a)
|
|
3931
3979
|
});
|
|
@@ -3941,13 +3989,13 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3941
3989
|
id: this._instanceId
|
|
3942
3990
|
}), {
|
|
3943
3991
|
F: __dxlog_file15,
|
|
3944
|
-
L:
|
|
3992
|
+
L: 140,
|
|
3945
3993
|
S: this,
|
|
3946
3994
|
C: (f, a) => f(...a)
|
|
3947
3995
|
});
|
|
3948
3996
|
log13("opened", void 0, {
|
|
3949
3997
|
F: __dxlog_file15,
|
|
3950
|
-
L:
|
|
3998
|
+
L: 141,
|
|
3951
3999
|
S: this,
|
|
3952
4000
|
C: (f, a) => f(...a)
|
|
3953
4001
|
});
|
|
@@ -3955,7 +4003,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3955
4003
|
async close() {
|
|
3956
4004
|
log13("closing...", void 0, {
|
|
3957
4005
|
F: __dxlog_file15,
|
|
3958
|
-
L:
|
|
4006
|
+
L: 145,
|
|
3959
4007
|
S: this,
|
|
3960
4008
|
C: (f, a) => f(...a)
|
|
3961
4009
|
});
|
|
@@ -3972,7 +4020,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3972
4020
|
await this.metadataStore.close();
|
|
3973
4021
|
log13("closed", void 0, {
|
|
3974
4022
|
F: __dxlog_file15,
|
|
3975
|
-
L:
|
|
4023
|
+
L: 157,
|
|
3976
4024
|
S: this,
|
|
3977
4025
|
C: (f, a) => f(...a)
|
|
3978
4026
|
});
|
|
@@ -3984,9 +4032,9 @@ var ServiceContext = class ServiceContext2 {
|
|
|
3984
4032
|
}
|
|
3985
4033
|
getInvitationHandler(invitation) {
|
|
3986
4034
|
const factory = this._handlerFactories.get(invitation.kind);
|
|
3987
|
-
|
|
4035
|
+
invariant13(factory, `Unknown invitation kind: ${invitation.kind}`, {
|
|
3988
4036
|
F: __dxlog_file15,
|
|
3989
|
-
L:
|
|
4037
|
+
L: 168,
|
|
3990
4038
|
S: this,
|
|
3991
4039
|
A: [
|
|
3992
4040
|
"factory",
|
|
@@ -4003,14 +4051,14 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4003
4051
|
async _checkStorageVersion() {
|
|
4004
4052
|
await this.metadataStore.load();
|
|
4005
4053
|
if (this.metadataStore.version !== STORAGE_VERSION2) {
|
|
4006
|
-
throw new
|
|
4054
|
+
throw new InvalidStorageVersionError(STORAGE_VERSION2, this.metadataStore.version);
|
|
4007
4055
|
}
|
|
4008
4056
|
}
|
|
4009
4057
|
// Called when identity is created.
|
|
4010
4058
|
async _initialize(ctx) {
|
|
4011
4059
|
log13("initializing spaces...", void 0, {
|
|
4012
4060
|
F: __dxlog_file15,
|
|
4013
|
-
L:
|
|
4061
|
+
L: 189,
|
|
4014
4062
|
S: this,
|
|
4015
4063
|
C: (f, a) => f(...a)
|
|
4016
4064
|
});
|
|
@@ -4030,10 +4078,10 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4030
4078
|
};
|
|
4031
4079
|
this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
|
|
4032
4080
|
await this.dataSpaceManager.open();
|
|
4033
|
-
this._handlerFactories.set(
|
|
4034
|
-
|
|
4081
|
+
this._handlerFactories.set(Invitation6.Kind.SPACE, (invitation) => {
|
|
4082
|
+
invariant13(this.dataSpaceManager, "dataSpaceManager not initialized yet", {
|
|
4035
4083
|
F: __dxlog_file15,
|
|
4036
|
-
L:
|
|
4084
|
+
L: 212,
|
|
4037
4085
|
S: this,
|
|
4038
4086
|
A: [
|
|
4039
4087
|
"this.dataSpaceManager",
|
|
@@ -4057,7 +4105,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4057
4105
|
details: assertion
|
|
4058
4106
|
}, {
|
|
4059
4107
|
F: __dxlog_file15,
|
|
4060
|
-
L:
|
|
4108
|
+
L: 228,
|
|
4061
4109
|
S: this,
|
|
4062
4110
|
C: (f, a) => f(...a)
|
|
4063
4111
|
});
|
|
@@ -4068,7 +4116,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4068
4116
|
details: assertion
|
|
4069
4117
|
}, {
|
|
4070
4118
|
F: __dxlog_file15,
|
|
4071
|
-
L:
|
|
4119
|
+
L: 232,
|
|
4072
4120
|
S: this,
|
|
4073
4121
|
C: (f, a) => f(...a)
|
|
4074
4122
|
});
|
|
@@ -4079,7 +4127,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4079
4127
|
details: assertion
|
|
4080
4128
|
}, {
|
|
4081
4129
|
F: __dxlog_file15,
|
|
4082
|
-
L:
|
|
4130
|
+
L: 237,
|
|
4083
4131
|
S: this,
|
|
4084
4132
|
C: (f, a) => f(...a)
|
|
4085
4133
|
});
|
|
@@ -4090,7 +4138,7 @@ var ServiceContext = class ServiceContext2 {
|
|
|
4090
4138
|
} catch (err) {
|
|
4091
4139
|
log13.catch(err, void 0, {
|
|
4092
4140
|
F: __dxlog_file15,
|
|
4093
|
-
L:
|
|
4141
|
+
L: 243,
|
|
4094
4142
|
S: this,
|
|
4095
4143
|
C: (f, a) => f(...a)
|
|
4096
4144
|
});
|
|
@@ -4111,6 +4159,30 @@ ServiceContext = _ts_decorate5([
|
|
|
4111
4159
|
Trace2.resource()
|
|
4112
4160
|
], ServiceContext);
|
|
4113
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
|
+
|
|
4114
4186
|
// packages/sdk/client-services/src/packlets/locks/browser.ts
|
|
4115
4187
|
import { asyncTimeout, Trigger as Trigger6 } from "@dxos/async";
|
|
4116
4188
|
import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
|
|
@@ -4237,29 +4309,29 @@ var isLocked = (lockPath) => {
|
|
|
4237
4309
|
|
|
4238
4310
|
// packages/sdk/client-services/src/packlets/storage/storage.ts
|
|
4239
4311
|
import { DX_DATA } from "@dxos/client-protocol";
|
|
4240
|
-
import { InvalidConfigError } from "@dxos/
|
|
4312
|
+
import { InvalidConfigError } from "@dxos/protocols";
|
|
4241
4313
|
import { Runtime } from "@dxos/protocols/proto/dxos/config";
|
|
4242
4314
|
import { createStorage, StorageType } from "@dxos/random-access-storage";
|
|
4243
4315
|
import { isNode } from "@dxos/util";
|
|
4244
4316
|
var StorageDriver = Runtime.Client.Storage.StorageDriver;
|
|
4245
4317
|
var createStorageObjects = (config) => {
|
|
4246
|
-
const {
|
|
4247
|
-
if (persistent &&
|
|
4318
|
+
const { persistent = false, keyStore, dataStore, dataRoot = isNode() ? DX_DATA : "dxos/storage" } = config ?? {};
|
|
4319
|
+
if (persistent && dataStore === StorageDriver.RAM) {
|
|
4248
4320
|
throw new InvalidConfigError("RAM storage cannot be used in persistent mode.");
|
|
4249
4321
|
}
|
|
4250
|
-
if (!persistent &&
|
|
4322
|
+
if (!persistent && dataStore !== void 0 && dataStore !== StorageDriver.RAM) {
|
|
4251
4323
|
throw new InvalidConfigError("Cannot use a persistent storage in not persistent mode.");
|
|
4252
4324
|
}
|
|
4253
|
-
if (persistent &&
|
|
4325
|
+
if (persistent && keyStore === StorageDriver.RAM) {
|
|
4254
4326
|
throw new InvalidConfigError("RAM key storage cannot be used in persistent mode.");
|
|
4255
4327
|
}
|
|
4256
|
-
if (!persistent &&
|
|
4328
|
+
if (!persistent && keyStore !== StorageDriver.RAM && keyStore !== void 0) {
|
|
4257
4329
|
throw new InvalidConfigError("Cannot use a persistent key storage in not persistent mode.");
|
|
4258
4330
|
}
|
|
4259
4331
|
return {
|
|
4260
4332
|
storage: createStorage({
|
|
4261
|
-
type: persistent ? toStorageType(
|
|
4262
|
-
root: `${
|
|
4333
|
+
type: persistent ? toStorageType(dataStore) : StorageType.RAM,
|
|
4334
|
+
root: `${dataRoot}/`
|
|
4263
4335
|
})
|
|
4264
4336
|
};
|
|
4265
4337
|
};
|
|
@@ -4284,37 +4356,14 @@ var toStorageType = (type) => {
|
|
|
4284
4356
|
}
|
|
4285
4357
|
};
|
|
4286
4358
|
|
|
4287
|
-
// packages/sdk/client-services/src/packlets/services/service-registry.ts
|
|
4288
|
-
var ServiceRegistry = class {
|
|
4289
|
-
// prettier-ignore
|
|
4290
|
-
constructor(_serviceBundle, _handlers = {}) {
|
|
4291
|
-
this._serviceBundle = _serviceBundle;
|
|
4292
|
-
this._handlers = _handlers;
|
|
4293
|
-
}
|
|
4294
|
-
get descriptors() {
|
|
4295
|
-
return this._serviceBundle;
|
|
4296
|
-
}
|
|
4297
|
-
get services() {
|
|
4298
|
-
return this._handlers;
|
|
4299
|
-
}
|
|
4300
|
-
setServices(services) {
|
|
4301
|
-
this._handlers = services;
|
|
4302
|
-
}
|
|
4303
|
-
addService(name, service) {
|
|
4304
|
-
this._handlers[name] = service;
|
|
4305
|
-
}
|
|
4306
|
-
removeService(name) {
|
|
4307
|
-
delete this._handlers[name];
|
|
4308
|
-
}
|
|
4309
|
-
};
|
|
4310
|
-
|
|
4311
4359
|
// packages/sdk/client-services/src/packlets/services/service-host.ts
|
|
4312
4360
|
import { Event as Event8, synchronized as synchronized3 } from "@dxos/async";
|
|
4313
|
-
import { clientServiceBundle } from "@dxos/client-protocol";
|
|
4361
|
+
import { clientServiceBundle, defaultKey, Properties } from "@dxos/client-protocol";
|
|
4314
4362
|
import { Context as Context10 } from "@dxos/context";
|
|
4315
4363
|
import { DocumentModel as DocumentModel2 } from "@dxos/document-model";
|
|
4316
4364
|
import { DataServiceImpl } from "@dxos/echo-pipeline";
|
|
4317
|
-
import {
|
|
4365
|
+
import { base } from "@dxos/echo-schema";
|
|
4366
|
+
import { invariant as invariant14 } from "@dxos/invariant";
|
|
4318
4367
|
import { PublicKey as PublicKey10 } from "@dxos/keys";
|
|
4319
4368
|
import { log as log16 } from "@dxos/log";
|
|
4320
4369
|
import { WebsocketSignalManager } from "@dxos/messaging";
|
|
@@ -4587,6 +4636,18 @@ var __dxlog_file17 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/s
|
|
|
4587
4636
|
var createDefaultModelFactory = () => {
|
|
4588
4637
|
return new ModelFactory().registerModel(DocumentModel2).registerModel(TextModel);
|
|
4589
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
|
+
};
|
|
4590
4651
|
var ClientServicesHost = class ClientServicesHost2 {
|
|
4591
4652
|
constructor({
|
|
4592
4653
|
config,
|
|
@@ -4671,9 +4732,9 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4671
4732
|
* Can only be called once.
|
|
4672
4733
|
*/
|
|
4673
4734
|
initialize({ config, ...options }) {
|
|
4674
|
-
|
|
4735
|
+
invariant14(!this._open, "service host is open", {
|
|
4675
4736
|
F: __dxlog_file17,
|
|
4676
|
-
L:
|
|
4737
|
+
L: 201,
|
|
4677
4738
|
S: this,
|
|
4678
4739
|
A: [
|
|
4679
4740
|
"!this._open",
|
|
@@ -4682,14 +4743,14 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4682
4743
|
});
|
|
4683
4744
|
log16("initializing...", void 0, {
|
|
4684
4745
|
F: __dxlog_file17,
|
|
4685
|
-
L:
|
|
4746
|
+
L: 202,
|
|
4686
4747
|
S: this,
|
|
4687
4748
|
C: (f, a) => f(...a)
|
|
4688
4749
|
});
|
|
4689
4750
|
if (config) {
|
|
4690
|
-
|
|
4751
|
+
invariant14(!this._config, "config already set", {
|
|
4691
4752
|
F: __dxlog_file17,
|
|
4692
|
-
L:
|
|
4753
|
+
L: 205,
|
|
4693
4754
|
S: this,
|
|
4694
4755
|
A: [
|
|
4695
4756
|
"!this._config",
|
|
@@ -4705,9 +4766,9 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4705
4766
|
iceServers: this._config?.get("runtime.services.ice")
|
|
4706
4767
|
}), signalManager = new WebsocketSignalManager(this._config?.get("runtime.services.signaling") ?? []) } = options;
|
|
4707
4768
|
this._signalManager = signalManager;
|
|
4708
|
-
|
|
4769
|
+
invariant14(!this._networkManager, "network manager already set", {
|
|
4709
4770
|
F: __dxlog_file17,
|
|
4710
|
-
L:
|
|
4771
|
+
L: 221,
|
|
4711
4772
|
S: this,
|
|
4712
4773
|
A: [
|
|
4713
4774
|
"!this._networkManager",
|
|
@@ -4721,7 +4782,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4721
4782
|
});
|
|
4722
4783
|
log16("initialized", void 0, {
|
|
4723
4784
|
F: __dxlog_file17,
|
|
4724
|
-
L:
|
|
4785
|
+
L: 228,
|
|
4725
4786
|
S: this,
|
|
4726
4787
|
C: (f, a) => f(...a)
|
|
4727
4788
|
});
|
|
@@ -4735,40 +4796,40 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4735
4796
|
id: traceId
|
|
4736
4797
|
}), {
|
|
4737
4798
|
F: __dxlog_file17,
|
|
4738
|
-
L:
|
|
4799
|
+
L: 239,
|
|
4739
4800
|
S: this,
|
|
4740
4801
|
C: (f, a) => f(...a)
|
|
4741
4802
|
});
|
|
4742
|
-
|
|
4803
|
+
invariant14(this._config, "config not set", {
|
|
4743
4804
|
F: __dxlog_file17,
|
|
4744
|
-
L:
|
|
4805
|
+
L: 241,
|
|
4745
4806
|
S: this,
|
|
4746
4807
|
A: [
|
|
4747
4808
|
"this._config",
|
|
4748
4809
|
"'config not set'"
|
|
4749
4810
|
]
|
|
4750
4811
|
});
|
|
4751
|
-
|
|
4812
|
+
invariant14(this._storage, "storage not set", {
|
|
4752
4813
|
F: __dxlog_file17,
|
|
4753
|
-
L:
|
|
4814
|
+
L: 242,
|
|
4754
4815
|
S: this,
|
|
4755
4816
|
A: [
|
|
4756
4817
|
"this._storage",
|
|
4757
4818
|
"'storage not set'"
|
|
4758
4819
|
]
|
|
4759
4820
|
});
|
|
4760
|
-
|
|
4821
|
+
invariant14(this._signalManager, "signal manager not set", {
|
|
4761
4822
|
F: __dxlog_file17,
|
|
4762
|
-
L:
|
|
4823
|
+
L: 243,
|
|
4763
4824
|
S: this,
|
|
4764
4825
|
A: [
|
|
4765
4826
|
"this._signalManager",
|
|
4766
4827
|
"'signal manager not set'"
|
|
4767
4828
|
]
|
|
4768
4829
|
});
|
|
4769
|
-
|
|
4830
|
+
invariant14(this._networkManager, "network manager not set", {
|
|
4770
4831
|
F: __dxlog_file17,
|
|
4771
|
-
L:
|
|
4832
|
+
L: 244,
|
|
4772
4833
|
S: this,
|
|
4773
4834
|
A: [
|
|
4774
4835
|
"this._networkManager",
|
|
@@ -4780,7 +4841,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4780
4841
|
lockKey: this._resourceLock?.lockKey
|
|
4781
4842
|
}, {
|
|
4782
4843
|
F: __dxlog_file17,
|
|
4783
|
-
L:
|
|
4844
|
+
L: 247,
|
|
4784
4845
|
S: this,
|
|
4785
4846
|
C: (f, a) => f(...a)
|
|
4786
4847
|
});
|
|
@@ -4789,7 +4850,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4789
4850
|
this._serviceContext = new ServiceContext(this._storage, this._networkManager, this._signalManager, this._modelFactory);
|
|
4790
4851
|
this._serviceRegistry.setServices({
|
|
4791
4852
|
SystemService: this._systemService,
|
|
4792
|
-
IdentityService: new IdentityServiceImpl((params) => this.
|
|
4853
|
+
IdentityService: new IdentityServiceImpl((params) => this._createIdentity(params), this._serviceContext.identityManager, this._serviceContext.keyring),
|
|
4793
4854
|
InvitationsService: new InvitationsServiceImpl(this._serviceContext.invitations, (invitation) => this._serviceContext.getInvitationHandler(invitation)),
|
|
4794
4855
|
DevicesService: new DevicesServiceImpl(this._serviceContext.identityManager),
|
|
4795
4856
|
SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, this._serviceContext.dataServiceSubscriptions, async () => {
|
|
@@ -4826,7 +4887,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4826
4887
|
deviceKey
|
|
4827
4888
|
}, {
|
|
4828
4889
|
F: __dxlog_file17,
|
|
4829
|
-
L:
|
|
4890
|
+
L: 316,
|
|
4830
4891
|
S: this,
|
|
4831
4892
|
C: (f, a) => f(...a)
|
|
4832
4893
|
});
|
|
@@ -4834,7 +4895,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4834
4895
|
id: traceId
|
|
4835
4896
|
}), {
|
|
4836
4897
|
F: __dxlog_file17,
|
|
4837
|
-
L:
|
|
4898
|
+
L: 317,
|
|
4838
4899
|
S: this,
|
|
4839
4900
|
C: (f, a) => f(...a)
|
|
4840
4901
|
});
|
|
@@ -4848,7 +4909,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4848
4909
|
deviceKey
|
|
4849
4910
|
}, {
|
|
4850
4911
|
F: __dxlog_file17,
|
|
4851
|
-
L:
|
|
4912
|
+
L: 328,
|
|
4852
4913
|
S: this,
|
|
4853
4914
|
C: (f, a) => f(...a)
|
|
4854
4915
|
});
|
|
@@ -4864,7 +4925,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4864
4925
|
deviceKey
|
|
4865
4926
|
}, {
|
|
4866
4927
|
F: __dxlog_file17,
|
|
4867
|
-
L:
|
|
4928
|
+
L: 335,
|
|
4868
4929
|
S: this,
|
|
4869
4930
|
C: (f, a) => f(...a)
|
|
4870
4931
|
});
|
|
@@ -4875,13 +4936,13 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4875
4936
|
id: traceId
|
|
4876
4937
|
}), {
|
|
4877
4938
|
F: __dxlog_file17,
|
|
4878
|
-
L:
|
|
4939
|
+
L: 340,
|
|
4879
4940
|
S: this,
|
|
4880
4941
|
C: (f, a) => f(...a)
|
|
4881
4942
|
});
|
|
4882
4943
|
log16("resetting...", void 0, {
|
|
4883
4944
|
F: __dxlog_file17,
|
|
4884
|
-
L:
|
|
4945
|
+
L: 342,
|
|
4885
4946
|
S: this,
|
|
4886
4947
|
C: (f, a) => f(...a)
|
|
4887
4948
|
});
|
|
@@ -4889,7 +4950,7 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4889
4950
|
await this._storage.reset();
|
|
4890
4951
|
log16("reset", void 0, {
|
|
4891
4952
|
F: __dxlog_file17,
|
|
4892
|
-
L:
|
|
4953
|
+
L: 345,
|
|
4893
4954
|
S: this,
|
|
4894
4955
|
C: (f, a) => f(...a)
|
|
4895
4956
|
});
|
|
@@ -4897,12 +4958,31 @@ var ClientServicesHost = class ClientServicesHost2 {
|
|
|
4897
4958
|
id: traceId
|
|
4898
4959
|
}), {
|
|
4899
4960
|
F: __dxlog_file17,
|
|
4900
|
-
L:
|
|
4961
|
+
L: 346,
|
|
4901
4962
|
S: this,
|
|
4902
4963
|
C: (f, a) => f(...a)
|
|
4903
4964
|
});
|
|
4904
4965
|
await this._callbacks?.onReset?.();
|
|
4905
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
|
+
}
|
|
4906
4986
|
};
|
|
4907
4987
|
_ts_decorate7([
|
|
4908
4988
|
Trace3.info()
|
|
@@ -4948,11 +5028,11 @@ export {
|
|
|
4948
5028
|
DataSpaceManager,
|
|
4949
5029
|
SpacesServiceImpl,
|
|
4950
5030
|
ServiceContext,
|
|
5031
|
+
ServiceRegistry,
|
|
4951
5032
|
Lock,
|
|
4952
5033
|
isLocked,
|
|
4953
5034
|
createStorageObjects,
|
|
4954
|
-
ServiceRegistry,
|
|
4955
5035
|
createDefaultModelFactory,
|
|
4956
5036
|
ClientServicesHost
|
|
4957
5037
|
};
|
|
4958
|
-
//# sourceMappingURL=chunk-
|
|
5038
|
+
//# sourceMappingURL=chunk-DJ4JCFP7.mjs.map
|