@dxos/client-services 0.1.36 → 0.1.37-next.41339e7

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.
@@ -1084,7 +1084,7 @@ var InvitationsHandler = class {
1084
1084
  ...protocol.toJSON()
1085
1085
  }, {
1086
1086
  file: "invitations-handler.ts",
1087
- line: 102,
1087
+ line: 106,
1088
1088
  scope: this,
1089
1089
  callSite: (f, a) => f(...a)
1090
1090
  });
@@ -1102,7 +1102,7 @@ var InvitationsHandler = class {
1102
1102
  ...protocol.toJSON()
1103
1103
  }, {
1104
1104
  file: "invitations-handler.ts",
1105
- line: 115,
1105
+ line: 119,
1106
1106
  scope: this,
1107
1107
  callSite: (f, a) => f(...a)
1108
1108
  });
@@ -1121,7 +1121,7 @@ var InvitationsHandler = class {
1121
1121
  authCode: code
1122
1122
  }, {
1123
1123
  file: "invitations-handler.ts",
1124
- line: 134,
1124
+ line: 138,
1125
1125
  scope: this,
1126
1126
  callSite: (f, a) => f(...a)
1127
1127
  });
@@ -1130,7 +1130,7 @@ var InvitationsHandler = class {
1130
1130
  case import_services3.Invitation.AuthMethod.NONE: {
1131
1131
  (0, import_log4.log)("authentication not required", {}, {
1132
1132
  file: "invitations-handler.ts",
1133
- line: 139,
1133
+ line: 143,
1134
1134
  scope: this,
1135
1135
  callSite: (f, a) => f(...a)
1136
1136
  });
@@ -1155,7 +1155,7 @@ var InvitationsHandler = class {
1155
1155
  authMethod: invitation.authMethod
1156
1156
  }, {
1157
1157
  file: "invitations-handler.ts",
1158
- line: 157,
1158
+ line: 161,
1159
1159
  scope: this,
1160
1160
  callSite: (f, a) => f(...a)
1161
1161
  });
@@ -1185,12 +1185,22 @@ var InvitationsHandler = class {
1185
1185
  },
1186
1186
  onOpen: () => {
1187
1187
  (0, import_async7.scheduleTask)(ctx, async () => {
1188
+ const traceId = import_keys6.PublicKey.random().toHex();
1188
1189
  try {
1190
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.begin({
1191
+ id: traceId,
1192
+ parentId: this._traceParent
1193
+ }), {
1194
+ file: "invitations-handler.ts",
1195
+ line: 196,
1196
+ scope: this,
1197
+ callSite: (f, a) => f(...a)
1198
+ });
1189
1199
  (0, import_log4.log)("connected", {
1190
1200
  ...protocol.toJSON()
1191
1201
  }, {
1192
1202
  file: "invitations-handler.ts",
1193
- line: 191,
1203
+ line: 200,
1194
1204
  scope: this,
1195
1205
  callSite: (f, a) => f(...a)
1196
1206
  });
@@ -1206,7 +1216,7 @@ var InvitationsHandler = class {
1206
1216
  ...protocol.toJSON()
1207
1217
  }, {
1208
1218
  file: "invitations-handler.ts",
1209
- line: 194,
1219
+ line: 203,
1210
1220
  scope: this,
1211
1221
  callSite: (f, a) => f(...a)
1212
1222
  });
@@ -1214,13 +1224,21 @@ var InvitationsHandler = class {
1214
1224
  ...invitation,
1215
1225
  state: import_services3.Invitation.State.SUCCESS
1216
1226
  });
1227
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.end({
1228
+ id: traceId
1229
+ }), {
1230
+ file: "invitations-handler.ts",
1231
+ line: 205,
1232
+ scope: this,
1233
+ callSite: (f, a) => f(...a)
1234
+ });
1217
1235
  } catch (err) {
1218
1236
  if (err instanceof import_async7.TimeoutError) {
1219
1237
  (0, import_log4.log)("timeout", {
1220
1238
  ...protocol.toJSON()
1221
1239
  }, {
1222
1240
  file: "invitations-handler.ts",
1223
- line: 198,
1241
+ line: 208,
1224
1242
  scope: this,
1225
1243
  callSite: (f, a) => f(...a)
1226
1244
  });
@@ -1231,12 +1249,21 @@ var InvitationsHandler = class {
1231
1249
  } else {
1232
1250
  import_log4.log.error("failed", err, {
1233
1251
  file: "invitations-handler.ts",
1234
- line: 201,
1252
+ line: 211,
1235
1253
  scope: this,
1236
1254
  callSite: (f, a) => f(...a)
1237
1255
  });
1238
1256
  stream.error(err);
1239
1257
  }
1258
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.error({
1259
+ id: traceId,
1260
+ error: err
1261
+ }), {
1262
+ file: "invitations-handler.ts",
1263
+ line: 214,
1264
+ scope: this,
1265
+ callSite: (f, a) => f(...a)
1266
+ });
1240
1267
  } finally {
1241
1268
  if (type !== import_services3.Invitation.Type.MULTIUSE) {
1242
1269
  await (0, import_async7.sleep)(import_client.ON_CLOSE_DELAY);
@@ -1246,6 +1273,7 @@ var InvitationsHandler = class {
1246
1273
  });
1247
1274
  }
1248
1275
  });
1276
+ extension._traceParent = this._traceParent;
1249
1277
  return extension;
1250
1278
  };
1251
1279
  (0, import_async7.scheduleTask)(ctx, async () => {
@@ -1289,7 +1317,7 @@ var InvitationsHandler = class {
1289
1317
  ...protocol.toJSON()
1290
1318
  }, {
1291
1319
  file: "invitations-handler.ts",
1292
- line: 255,
1320
+ line: 267,
1293
1321
  scope: this,
1294
1322
  callSite: (f, a) => f(...a)
1295
1323
  });
@@ -1300,7 +1328,7 @@ var InvitationsHandler = class {
1300
1328
  } else {
1301
1329
  import_log4.log.warn("auth failed", err, {
1302
1330
  file: "invitations-handler.ts",
1303
- line: 258,
1331
+ line: 270,
1304
1332
  scope: this,
1305
1333
  callSite: (f, a) => f(...a)
1306
1334
  });
@@ -1314,7 +1342,7 @@ var InvitationsHandler = class {
1314
1342
  ...protocol.toJSON()
1315
1343
  }, {
1316
1344
  file: "invitations-handler.ts",
1317
- line: 266,
1345
+ line: 278,
1318
1346
  scope: this,
1319
1347
  callSite: (f, a) => f(...a)
1320
1348
  });
@@ -1325,7 +1353,17 @@ var InvitationsHandler = class {
1325
1353
  const extension = new InvitationGuestExtension({
1326
1354
  onOpen: () => {
1327
1355
  (0, import_async7.scheduleTask)(ctx, async () => {
1356
+ const traceId = import_keys6.PublicKey.random().toHex();
1328
1357
  try {
1358
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.begin({
1359
+ id: traceId,
1360
+ parentId: this._traceParent
1361
+ }), {
1362
+ file: "invitations-handler.ts",
1363
+ line: 290,
1364
+ scope: this,
1365
+ callSite: (f, a) => f(...a)
1366
+ });
1329
1367
  if (++connectionCount > 1) {
1330
1368
  throw new Error(`multiple connections detected: ${connectionCount}`);
1331
1369
  }
@@ -1334,7 +1372,7 @@ var InvitationsHandler = class {
1334
1372
  ...protocol.toJSON()
1335
1373
  }, {
1336
1374
  file: "invitations-handler.ts",
1337
- line: 284,
1375
+ line: 301,
1338
1376
  scope: this,
1339
1377
  callSite: (f, a) => f(...a)
1340
1378
  });
@@ -1346,7 +1384,7 @@ var InvitationsHandler = class {
1346
1384
  ...protocol.toJSON()
1347
1385
  }, {
1348
1386
  file: "invitations-handler.ts",
1349
- line: 288,
1387
+ line: 305,
1350
1388
  scope: this,
1351
1389
  callSite: (f, a) => f(...a)
1352
1390
  });
@@ -1356,7 +1394,7 @@ var InvitationsHandler = class {
1356
1394
  response: introductionResponse
1357
1395
  }, {
1358
1396
  file: "invitations-handler.ts",
1359
- line: 292,
1397
+ line: 309,
1360
1398
  scope: this,
1361
1399
  callSite: (f, a) => f(...a)
1362
1400
  });
@@ -1368,7 +1406,7 @@ var InvitationsHandler = class {
1368
1406
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1369
1407
  (0, import_log4.log)("guest waiting for authentication code...", {}, {
1370
1408
  file: "invitations-handler.ts",
1371
- line: 301,
1409
+ line: 318,
1372
1410
  scope: this,
1373
1411
  callSite: (f, a) => f(...a)
1374
1412
  });
@@ -1381,7 +1419,7 @@ var InvitationsHandler = class {
1381
1419
  });
1382
1420
  (0, import_log4.log)("sending authentication request", {}, {
1383
1421
  file: "invitations-handler.ts",
1384
- line: 305,
1422
+ line: 322,
1385
1423
  scope: this,
1386
1424
  callSite: (f, a) => f(...a)
1387
1425
  });
@@ -1403,7 +1441,7 @@ var InvitationsHandler = class {
1403
1441
  attempt
1404
1442
  }, {
1405
1443
  file: "invitations-handler.ts",
1406
- line: 316,
1444
+ line: 333,
1407
1445
  scope: this,
1408
1446
  callSite: (f, a) => f(...a)
1409
1447
  });
@@ -1421,7 +1459,7 @@ var InvitationsHandler = class {
1421
1459
  ...protocol.toJSON()
1422
1460
  }, {
1423
1461
  file: "invitations-handler.ts",
1424
- line: 327,
1462
+ line: 344,
1425
1463
  scope: this,
1426
1464
  callSite: (f, a) => f(...a)
1427
1465
  });
@@ -1432,7 +1470,7 @@ var InvitationsHandler = class {
1432
1470
  ...protocol.toJSON()
1433
1471
  }, {
1434
1472
  file: "invitations-handler.ts",
1435
- line: 335,
1473
+ line: 352,
1436
1474
  scope: this,
1437
1475
  callSite: (f, a) => f(...a)
1438
1476
  });
@@ -1441,13 +1479,21 @@ var InvitationsHandler = class {
1441
1479
  ...result,
1442
1480
  state: import_services3.Invitation.State.SUCCESS
1443
1481
  });
1482
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.end({
1483
+ id: traceId
1484
+ }), {
1485
+ file: "invitations-handler.ts",
1486
+ line: 354,
1487
+ scope: this,
1488
+ callSite: (f, a) => f(...a)
1489
+ });
1444
1490
  } catch (err) {
1445
1491
  if (err instanceof import_async7.TimeoutError) {
1446
1492
  (0, import_log4.log)("timeout", {
1447
1493
  ...protocol.toJSON()
1448
1494
  }, {
1449
1495
  file: "invitations-handler.ts",
1450
- line: 339,
1496
+ line: 357,
1451
1497
  scope: this,
1452
1498
  callSite: (f, a) => f(...a)
1453
1499
  });
@@ -1456,14 +1502,23 @@ var InvitationsHandler = class {
1456
1502
  state: import_services3.Invitation.State.TIMEOUT
1457
1503
  });
1458
1504
  } else {
1459
- import_log4.log.warn("auth failed", err, {
1505
+ (0, import_log4.log)("auth failed", err, {
1460
1506
  file: "invitations-handler.ts",
1461
- line: 342,
1507
+ line: 360,
1462
1508
  scope: this,
1463
1509
  callSite: (f, a) => f(...a)
1464
1510
  });
1465
1511
  stream.error(err);
1466
1512
  }
1513
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.error({
1514
+ id: traceId,
1515
+ error: err
1516
+ }), {
1517
+ file: "invitations-handler.ts",
1518
+ line: 363,
1519
+ scope: this,
1520
+ callSite: (f, a) => f(...a)
1521
+ });
1467
1522
  } finally {
1468
1523
  await ctx.dispose();
1469
1524
  }
@@ -1522,13 +1577,73 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1522
1577
  // Perhaps in the future we will have more complex logic here.
1523
1578
  InvitationHostService: {
1524
1579
  introduce: async (request) => {
1525
- return this._callbacks.introduce(request);
1580
+ const traceId = import_keys6.PublicKey.random().toHex();
1581
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
1582
+ id: traceId,
1583
+ parentId: this._traceParent
1584
+ }), {
1585
+ file: "invitations-handler.ts",
1586
+ line: 442,
1587
+ scope: this,
1588
+ callSite: (f, a) => f(...a)
1589
+ });
1590
+ const response = await this._callbacks.introduce(request);
1591
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
1592
+ id: traceId
1593
+ }), {
1594
+ file: "invitations-handler.ts",
1595
+ line: 447,
1596
+ scope: this,
1597
+ callSite: (f, a) => f(...a)
1598
+ });
1599
+ return response;
1526
1600
  },
1527
1601
  authenticate: async (request) => {
1528
- return this._callbacks.authenticate(request);
1602
+ const traceId = import_keys6.PublicKey.random().toHex();
1603
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
1604
+ id: traceId,
1605
+ parentId: this._traceParent
1606
+ }), {
1607
+ file: "invitations-handler.ts",
1608
+ line: 453,
1609
+ scope: this,
1610
+ callSite: (f, a) => f(...a)
1611
+ });
1612
+ const response = await this._callbacks.authenticate(request);
1613
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.end({
1614
+ id: traceId,
1615
+ data: {
1616
+ ...response
1617
+ }
1618
+ }), {
1619
+ file: "invitations-handler.ts",
1620
+ line: 458,
1621
+ scope: this,
1622
+ callSite: (f, a) => f(...a)
1623
+ });
1624
+ return response;
1529
1625
  },
1530
1626
  admit: async (request) => {
1531
- return this._callbacks.admit(request);
1627
+ const traceId = import_keys6.PublicKey.random().toHex();
1628
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
1629
+ id: traceId,
1630
+ parentId: this._traceParent
1631
+ }), {
1632
+ file: "invitations-handler.ts",
1633
+ line: 464,
1634
+ scope: this,
1635
+ callSite: (f, a) => f(...a)
1636
+ });
1637
+ const response = await this._callbacks.admit(request);
1638
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
1639
+ id: traceId
1640
+ }), {
1641
+ file: "invitations-handler.ts",
1642
+ line: 469,
1643
+ scope: this,
1644
+ callSite: (f, a) => f(...a)
1645
+ });
1646
+ return response;
1532
1647
  }
1533
1648
  }
1534
1649
  };
@@ -3475,6 +3590,7 @@ var ServiceContext = class {
3475
3590
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
3476
3591
  this.identityManager._traceParent = this._instanceId;
3477
3592
  this.invitations = new InvitationsHandler(this.networkManager);
3593
+ this.invitations._traceParent = this._instanceId;
3478
3594
  this._handlerFactories.set(import_client7.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3479
3595
  var _a;
3480
3596
  return (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
@@ -3485,13 +3601,13 @@ var ServiceContext = class {
3485
3601
  id: this._instanceId
3486
3602
  }), {
3487
3603
  file: "service-context.ts",
3488
- line: 114,
3604
+ line: 115,
3489
3605
  scope: this,
3490
3606
  callSite: (f, a) => f(...a)
3491
3607
  });
3492
3608
  (0, import_log15.log)("opening...", {}, {
3493
3609
  file: "service-context.ts",
3494
- line: 116,
3610
+ line: 117,
3495
3611
  scope: this,
3496
3612
  callSite: (f, a) => f(...a)
3497
3613
  });
@@ -3503,7 +3619,7 @@ var ServiceContext = class {
3503
3619
  }
3504
3620
  (0, import_log15.log)("opened", {}, {
3505
3621
  file: "service-context.ts",
3506
- line: 123,
3622
+ line: 124,
3507
3623
  scope: this,
3508
3624
  callSite: (f, a) => f(...a)
3509
3625
  });
@@ -3512,7 +3628,7 @@ var ServiceContext = class {
3512
3628
  var _a, _b;
3513
3629
  (0, import_log15.log)("closing...", {}, {
3514
3630
  file: "service-context.ts",
3515
- line: 127,
3631
+ line: 128,
3516
3632
  scope: this,
3517
3633
  callSite: (f, a) => f(...a)
3518
3634
  });
@@ -3525,7 +3641,7 @@ var ServiceContext = class {
3525
3641
  this.dataServiceSubscriptions.clear();
3526
3642
  (0, import_log15.log)("closed", {}, {
3527
3643
  file: "service-context.ts",
3528
- line: 135,
3644
+ line: 136,
3529
3645
  scope: this,
3530
3646
  callSite: (f, a) => f(...a)
3531
3647
  });
@@ -3533,23 +3649,7 @@ var ServiceContext = class {
3533
3649
  id: this._instanceId
3534
3650
  }), {
3535
3651
  file: "service-context.ts",
3536
- line: 137,
3537
- scope: this,
3538
- callSite: (f, a) => f(...a)
3539
- });
3540
- }
3541
- async reset() {
3542
- (0, import_log15.log)("resetting...", {}, {
3543
- file: "service-context.ts",
3544
- line: 141,
3545
- scope: this,
3546
- callSite: (f, a) => f(...a)
3547
- });
3548
- await this.close();
3549
- await this.storage.reset();
3550
- (0, import_log15.log)("reset", {}, {
3551
- file: "service-context.ts",
3552
- line: 144,
3652
+ line: 138,
3553
3653
  scope: this,
3554
3654
  callSite: (f, a) => f(...a)
3555
3655
  });
@@ -3574,7 +3674,7 @@ var ServiceContext = class {
3574
3674
  var _a;
3575
3675
  (0, import_log15.log)("initializing spaces...", {}, {
3576
3676
  file: "service-context.ts",
3577
- line: 169,
3677
+ line: 163,
3578
3678
  scope: this,
3579
3679
  callSite: (f, a) => f(...a)
3580
3680
  });
@@ -3614,7 +3714,7 @@ var ServiceContext = class {
3614
3714
  details: assertion
3615
3715
  }, {
3616
3716
  file: "service-context.ts",
3617
- line: 211,
3717
+ line: 205,
3618
3718
  scope: this,
3619
3719
  callSite: (f, a) => f(...a)
3620
3720
  });
@@ -3625,7 +3725,7 @@ var ServiceContext = class {
3625
3725
  details: assertion
3626
3726
  }, {
3627
3727
  file: "service-context.ts",
3628
- line: 215,
3728
+ line: 209,
3629
3729
  scope: this,
3630
3730
  callSite: (f, a) => f(...a)
3631
3731
  });
@@ -3636,7 +3736,7 @@ var ServiceContext = class {
3636
3736
  details: assertion
3637
3737
  }, {
3638
3738
  file: "service-context.ts",
3639
- line: 220,
3739
+ line: 214,
3640
3740
  scope: this,
3641
3741
  callSite: (f, a) => f(...a)
3642
3742
  });
@@ -3647,7 +3747,7 @@ var ServiceContext = class {
3647
3747
  } catch (err) {
3648
3748
  import_log15.log.catch(err, {}, {
3649
3749
  file: "service-context.ts",
3650
- line: 226,
3750
+ line: 220,
3651
3751
  scope: this,
3652
3752
  callSite: (f, a) => f(...a)
3653
3753
  });
@@ -3725,8 +3825,7 @@ var ClientServicesHost = class {
3725
3825
  }
3726
3826
  },
3727
3827
  onReset: async () => {
3728
- (0, import_node_assert13.default)(this._serviceContext, "service host is closed");
3729
- await this._serviceContext.reset();
3828
+ await this.reset();
3730
3829
  }
3731
3830
  });
3732
3831
  this._serviceRegistry = new ServiceRegistry(import_client8.clientServiceBundle, {
@@ -3773,7 +3872,7 @@ var ClientServicesHost = class {
3773
3872
  id: this._instanceId
3774
3873
  }), {
3775
3874
  file: "service-host.ts",
3776
- line: 167,
3875
+ line: 166,
3777
3876
  scope: this,
3778
3877
  callSite: (f, a) => f(...a)
3779
3878
  });
@@ -3785,7 +3884,7 @@ var ClientServicesHost = class {
3785
3884
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
3786
3885
  }, {
3787
3886
  file: "service-host.ts",
3788
- line: 174,
3887
+ line: 173,
3789
3888
  scope: this,
3790
3889
  callSite: (f, a) => f(...a)
3791
3890
  });
@@ -3819,7 +3918,7 @@ var ClientServicesHost = class {
3819
3918
  deviceKey
3820
3919
  }, {
3821
3920
  file: "service-host.ts",
3822
- line: 221,
3921
+ line: 220,
3823
3922
  scope: this,
3824
3923
  callSite: (f, a) => f(...a)
3825
3924
  });
@@ -3834,7 +3933,7 @@ var ClientServicesHost = class {
3834
3933
  deviceKey
3835
3934
  }, {
3836
3935
  file: "service-host.ts",
3837
- line: 230,
3936
+ line: 229,
3838
3937
  scope: this,
3839
3938
  callSite: (f, a) => f(...a)
3840
3939
  });
@@ -3848,7 +3947,7 @@ var ClientServicesHost = class {
3848
3947
  deviceKey
3849
3948
  }, {
3850
3949
  file: "service-host.ts",
3851
- line: 235,
3950
+ line: 234,
3852
3951
  scope: this,
3853
3952
  callSite: (f, a) => f(...a)
3854
3953
  });
@@ -3856,7 +3955,24 @@ var ClientServicesHost = class {
3856
3955
  id: this._instanceId
3857
3956
  }), {
3858
3957
  file: "service-host.ts",
3859
- line: 237,
3958
+ line: 236,
3959
+ scope: this,
3960
+ callSite: (f, a) => f(...a)
3961
+ });
3962
+ }
3963
+ async reset() {
3964
+ var _a;
3965
+ (0, import_log16.log)("resetting...", {}, {
3966
+ file: "service-host.ts",
3967
+ line: 240,
3968
+ scope: this,
3969
+ callSite: (f, a) => f(...a)
3970
+ });
3971
+ await ((_a = this._serviceContext) == null ? void 0 : _a.close());
3972
+ await this._storage.reset();
3973
+ (0, import_log16.log)("reset", {}, {
3974
+ file: "service-host.ts",
3975
+ line: 243,
3860
3976
  scope: this,
3861
3977
  callSite: (f, a) => f(...a)
3862
3978
  });