@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.
@@ -1037,7 +1037,7 @@ var InvitationsHandler = class {
1037
1037
  ...protocol.toJSON()
1038
1038
  }, {
1039
1039
  file: "invitations-handler.ts",
1040
- line: 102,
1040
+ line: 106,
1041
1041
  scope: this,
1042
1042
  callSite: (f, a) => f(...a)
1043
1043
  });
@@ -1055,7 +1055,7 @@ var InvitationsHandler = class {
1055
1055
  ...protocol.toJSON()
1056
1056
  }, {
1057
1057
  file: "invitations-handler.ts",
1058
- line: 115,
1058
+ line: 119,
1059
1059
  scope: this,
1060
1060
  callSite: (f, a) => f(...a)
1061
1061
  });
@@ -1074,7 +1074,7 @@ var InvitationsHandler = class {
1074
1074
  authCode: code
1075
1075
  }, {
1076
1076
  file: "invitations-handler.ts",
1077
- line: 134,
1077
+ line: 138,
1078
1078
  scope: this,
1079
1079
  callSite: (f, a) => f(...a)
1080
1080
  });
@@ -1083,7 +1083,7 @@ var InvitationsHandler = class {
1083
1083
  case import_services2.Invitation.AuthMethod.NONE: {
1084
1084
  (0, import_log4.log)("authentication not required", {}, {
1085
1085
  file: "invitations-handler.ts",
1086
- line: 139,
1086
+ line: 143,
1087
1087
  scope: this,
1088
1088
  callSite: (f, a) => f(...a)
1089
1089
  });
@@ -1108,7 +1108,7 @@ var InvitationsHandler = class {
1108
1108
  authMethod: invitation.authMethod
1109
1109
  }, {
1110
1110
  file: "invitations-handler.ts",
1111
- line: 157,
1111
+ line: 161,
1112
1112
  scope: this,
1113
1113
  callSite: (f, a) => f(...a)
1114
1114
  });
@@ -1138,12 +1138,22 @@ var InvitationsHandler = class {
1138
1138
  },
1139
1139
  onOpen: () => {
1140
1140
  (0, import_async6.scheduleTask)(ctx, async () => {
1141
+ const traceId = import_keys5.PublicKey.random().toHex();
1141
1142
  try {
1143
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.begin({
1144
+ id: traceId,
1145
+ parentId: this._traceParent
1146
+ }), {
1147
+ file: "invitations-handler.ts",
1148
+ line: 196,
1149
+ scope: this,
1150
+ callSite: (f, a) => f(...a)
1151
+ });
1142
1152
  (0, import_log4.log)("connected", {
1143
1153
  ...protocol.toJSON()
1144
1154
  }, {
1145
1155
  file: "invitations-handler.ts",
1146
- line: 191,
1156
+ line: 200,
1147
1157
  scope: this,
1148
1158
  callSite: (f, a) => f(...a)
1149
1159
  });
@@ -1159,7 +1169,7 @@ var InvitationsHandler = class {
1159
1169
  ...protocol.toJSON()
1160
1170
  }, {
1161
1171
  file: "invitations-handler.ts",
1162
- line: 194,
1172
+ line: 203,
1163
1173
  scope: this,
1164
1174
  callSite: (f, a) => f(...a)
1165
1175
  });
@@ -1167,13 +1177,21 @@ var InvitationsHandler = class {
1167
1177
  ...invitation,
1168
1178
  state: import_services2.Invitation.State.SUCCESS
1169
1179
  });
1180
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.end({
1181
+ id: traceId
1182
+ }), {
1183
+ file: "invitations-handler.ts",
1184
+ line: 205,
1185
+ scope: this,
1186
+ callSite: (f, a) => f(...a)
1187
+ });
1170
1188
  } catch (err) {
1171
1189
  if (err instanceof import_async6.TimeoutError) {
1172
1190
  (0, import_log4.log)("timeout", {
1173
1191
  ...protocol.toJSON()
1174
1192
  }, {
1175
1193
  file: "invitations-handler.ts",
1176
- line: 198,
1194
+ line: 208,
1177
1195
  scope: this,
1178
1196
  callSite: (f, a) => f(...a)
1179
1197
  });
@@ -1184,12 +1202,21 @@ var InvitationsHandler = class {
1184
1202
  } else {
1185
1203
  import_log4.log.error("failed", err, {
1186
1204
  file: "invitations-handler.ts",
1187
- line: 201,
1205
+ line: 211,
1188
1206
  scope: this,
1189
1207
  callSite: (f, a) => f(...a)
1190
1208
  });
1191
1209
  stream.error(err);
1192
1210
  }
1211
+ import_log4.log.trace("dxos.sdk.invitations-handler.host.onOpen", import_protocols3.trace.error({
1212
+ id: traceId,
1213
+ error: err
1214
+ }), {
1215
+ file: "invitations-handler.ts",
1216
+ line: 214,
1217
+ scope: this,
1218
+ callSite: (f, a) => f(...a)
1219
+ });
1193
1220
  } finally {
1194
1221
  if (type !== import_services2.Invitation.Type.MULTIUSE) {
1195
1222
  await (0, import_async6.sleep)(import_client.ON_CLOSE_DELAY);
@@ -1199,6 +1226,7 @@ var InvitationsHandler = class {
1199
1226
  });
1200
1227
  }
1201
1228
  });
1229
+ extension._traceParent = this._traceParent;
1202
1230
  return extension;
1203
1231
  };
1204
1232
  (0, import_async6.scheduleTask)(ctx, async () => {
@@ -1242,7 +1270,7 @@ var InvitationsHandler = class {
1242
1270
  ...protocol.toJSON()
1243
1271
  }, {
1244
1272
  file: "invitations-handler.ts",
1245
- line: 255,
1273
+ line: 267,
1246
1274
  scope: this,
1247
1275
  callSite: (f, a) => f(...a)
1248
1276
  });
@@ -1253,7 +1281,7 @@ var InvitationsHandler = class {
1253
1281
  } else {
1254
1282
  import_log4.log.warn("auth failed", err, {
1255
1283
  file: "invitations-handler.ts",
1256
- line: 258,
1284
+ line: 270,
1257
1285
  scope: this,
1258
1286
  callSite: (f, a) => f(...a)
1259
1287
  });
@@ -1267,7 +1295,7 @@ var InvitationsHandler = class {
1267
1295
  ...protocol.toJSON()
1268
1296
  }, {
1269
1297
  file: "invitations-handler.ts",
1270
- line: 266,
1298
+ line: 278,
1271
1299
  scope: this,
1272
1300
  callSite: (f, a) => f(...a)
1273
1301
  });
@@ -1278,7 +1306,17 @@ var InvitationsHandler = class {
1278
1306
  const extension = new InvitationGuestExtension({
1279
1307
  onOpen: () => {
1280
1308
  (0, import_async6.scheduleTask)(ctx, async () => {
1309
+ const traceId = import_keys5.PublicKey.random().toHex();
1281
1310
  try {
1311
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.begin({
1312
+ id: traceId,
1313
+ parentId: this._traceParent
1314
+ }), {
1315
+ file: "invitations-handler.ts",
1316
+ line: 290,
1317
+ scope: this,
1318
+ callSite: (f, a) => f(...a)
1319
+ });
1282
1320
  if (++connectionCount > 1) {
1283
1321
  throw new Error(`multiple connections detected: ${connectionCount}`);
1284
1322
  }
@@ -1287,7 +1325,7 @@ var InvitationsHandler = class {
1287
1325
  ...protocol.toJSON()
1288
1326
  }, {
1289
1327
  file: "invitations-handler.ts",
1290
- line: 284,
1328
+ line: 301,
1291
1329
  scope: this,
1292
1330
  callSite: (f, a) => f(...a)
1293
1331
  });
@@ -1299,7 +1337,7 @@ var InvitationsHandler = class {
1299
1337
  ...protocol.toJSON()
1300
1338
  }, {
1301
1339
  file: "invitations-handler.ts",
1302
- line: 288,
1340
+ line: 305,
1303
1341
  scope: this,
1304
1342
  callSite: (f, a) => f(...a)
1305
1343
  });
@@ -1309,7 +1347,7 @@ var InvitationsHandler = class {
1309
1347
  response: introductionResponse
1310
1348
  }, {
1311
1349
  file: "invitations-handler.ts",
1312
- line: 292,
1350
+ line: 309,
1313
1351
  scope: this,
1314
1352
  callSite: (f, a) => f(...a)
1315
1353
  });
@@ -1321,7 +1359,7 @@ var InvitationsHandler = class {
1321
1359
  for (let attempt = 1; attempt <= MAX_OTP_ATTEMPTS; attempt++) {
1322
1360
  (0, import_log4.log)("guest waiting for authentication code...", {}, {
1323
1361
  file: "invitations-handler.ts",
1324
- line: 301,
1362
+ line: 318,
1325
1363
  scope: this,
1326
1364
  callSite: (f, a) => f(...a)
1327
1365
  });
@@ -1334,7 +1372,7 @@ var InvitationsHandler = class {
1334
1372
  });
1335
1373
  (0, import_log4.log)("sending authentication request", {}, {
1336
1374
  file: "invitations-handler.ts",
1337
- line: 305,
1375
+ line: 322,
1338
1376
  scope: this,
1339
1377
  callSite: (f, a) => f(...a)
1340
1378
  });
@@ -1356,7 +1394,7 @@ var InvitationsHandler = class {
1356
1394
  attempt
1357
1395
  }, {
1358
1396
  file: "invitations-handler.ts",
1359
- line: 316,
1397
+ line: 333,
1360
1398
  scope: this,
1361
1399
  callSite: (f, a) => f(...a)
1362
1400
  });
@@ -1374,7 +1412,7 @@ var InvitationsHandler = class {
1374
1412
  ...protocol.toJSON()
1375
1413
  }, {
1376
1414
  file: "invitations-handler.ts",
1377
- line: 327,
1415
+ line: 344,
1378
1416
  scope: this,
1379
1417
  callSite: (f, a) => f(...a)
1380
1418
  });
@@ -1385,7 +1423,7 @@ var InvitationsHandler = class {
1385
1423
  ...protocol.toJSON()
1386
1424
  }, {
1387
1425
  file: "invitations-handler.ts",
1388
- line: 335,
1426
+ line: 352,
1389
1427
  scope: this,
1390
1428
  callSite: (f, a) => f(...a)
1391
1429
  });
@@ -1394,13 +1432,21 @@ var InvitationsHandler = class {
1394
1432
  ...result,
1395
1433
  state: import_services2.Invitation.State.SUCCESS
1396
1434
  });
1435
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.end({
1436
+ id: traceId
1437
+ }), {
1438
+ file: "invitations-handler.ts",
1439
+ line: 354,
1440
+ scope: this,
1441
+ callSite: (f, a) => f(...a)
1442
+ });
1397
1443
  } catch (err) {
1398
1444
  if (err instanceof import_async6.TimeoutError) {
1399
1445
  (0, import_log4.log)("timeout", {
1400
1446
  ...protocol.toJSON()
1401
1447
  }, {
1402
1448
  file: "invitations-handler.ts",
1403
- line: 339,
1449
+ line: 357,
1404
1450
  scope: this,
1405
1451
  callSite: (f, a) => f(...a)
1406
1452
  });
@@ -1409,14 +1455,23 @@ var InvitationsHandler = class {
1409
1455
  state: import_services2.Invitation.State.TIMEOUT
1410
1456
  });
1411
1457
  } else {
1412
- import_log4.log.warn("auth failed", err, {
1458
+ (0, import_log4.log)("auth failed", err, {
1413
1459
  file: "invitations-handler.ts",
1414
- line: 342,
1460
+ line: 360,
1415
1461
  scope: this,
1416
1462
  callSite: (f, a) => f(...a)
1417
1463
  });
1418
1464
  stream.error(err);
1419
1465
  }
1466
+ import_log4.log.trace("dxos.sdk.invitations-handler.guest.onOpen", import_protocols3.trace.error({
1467
+ id: traceId,
1468
+ error: err
1469
+ }), {
1470
+ file: "invitations-handler.ts",
1471
+ line: 363,
1472
+ scope: this,
1473
+ callSite: (f, a) => f(...a)
1474
+ });
1420
1475
  } finally {
1421
1476
  await ctx.dispose();
1422
1477
  }
@@ -1475,13 +1530,73 @@ var InvitationHostExtension = class extends import_teleport.RpcExtension {
1475
1530
  // Perhaps in the future we will have more complex logic here.
1476
1531
  InvitationHostService: {
1477
1532
  introduce: async (request) => {
1478
- return this._callbacks.introduce(request);
1533
+ const traceId = import_keys5.PublicKey.random().toHex();
1534
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.begin({
1535
+ id: traceId,
1536
+ parentId: this._traceParent
1537
+ }), {
1538
+ file: "invitations-handler.ts",
1539
+ line: 442,
1540
+ scope: this,
1541
+ callSite: (f, a) => f(...a)
1542
+ });
1543
+ const response = await this._callbacks.introduce(request);
1544
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.introduce", import_protocols3.trace.end({
1545
+ id: traceId
1546
+ }), {
1547
+ file: "invitations-handler.ts",
1548
+ line: 447,
1549
+ scope: this,
1550
+ callSite: (f, a) => f(...a)
1551
+ });
1552
+ return response;
1479
1553
  },
1480
1554
  authenticate: async (request) => {
1481
- return this._callbacks.authenticate(request);
1555
+ const traceId = import_keys5.PublicKey.random().toHex();
1556
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.begin({
1557
+ id: traceId,
1558
+ parentId: this._traceParent
1559
+ }), {
1560
+ file: "invitations-handler.ts",
1561
+ line: 453,
1562
+ scope: this,
1563
+ callSite: (f, a) => f(...a)
1564
+ });
1565
+ const response = await this._callbacks.authenticate(request);
1566
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.authenticate", import_protocols3.trace.end({
1567
+ id: traceId,
1568
+ data: {
1569
+ ...response
1570
+ }
1571
+ }), {
1572
+ file: "invitations-handler.ts",
1573
+ line: 458,
1574
+ scope: this,
1575
+ callSite: (f, a) => f(...a)
1576
+ });
1577
+ return response;
1482
1578
  },
1483
1579
  admit: async (request) => {
1484
- return this._callbacks.admit(request);
1580
+ const traceId = import_keys5.PublicKey.random().toHex();
1581
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.begin({
1582
+ id: traceId,
1583
+ parentId: this._traceParent
1584
+ }), {
1585
+ file: "invitations-handler.ts",
1586
+ line: 464,
1587
+ scope: this,
1588
+ callSite: (f, a) => f(...a)
1589
+ });
1590
+ const response = await this._callbacks.admit(request);
1591
+ import_log4.log.trace("dxos.sdk.invitation-handler.host.admit", import_protocols3.trace.end({
1592
+ id: traceId
1593
+ }), {
1594
+ file: "invitations-handler.ts",
1595
+ line: 469,
1596
+ scope: this,
1597
+ callSite: (f, a) => f(...a)
1598
+ });
1599
+ return response;
1485
1600
  }
1486
1601
  }
1487
1602
  };
@@ -3665,6 +3780,7 @@ var ServiceContext = class {
3665
3780
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
3666
3781
  this.identityManager._traceParent = this._instanceId;
3667
3782
  this.invitations = new InvitationsHandler(this.networkManager);
3783
+ this.invitations._traceParent = this._instanceId;
3668
3784
  this._handlerFactories.set(import_client7.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3669
3785
  var _a;
3670
3786
  return (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
@@ -3675,13 +3791,13 @@ var ServiceContext = class {
3675
3791
  id: this._instanceId
3676
3792
  }), {
3677
3793
  file: "service-context.ts",
3678
- line: 114,
3794
+ line: 115,
3679
3795
  scope: this,
3680
3796
  callSite: (f, a) => f(...a)
3681
3797
  });
3682
3798
  (0, import_log15.log)("opening...", {}, {
3683
3799
  file: "service-context.ts",
3684
- line: 116,
3800
+ line: 117,
3685
3801
  scope: this,
3686
3802
  callSite: (f, a) => f(...a)
3687
3803
  });
@@ -3693,7 +3809,7 @@ var ServiceContext = class {
3693
3809
  }
3694
3810
  (0, import_log15.log)("opened", {}, {
3695
3811
  file: "service-context.ts",
3696
- line: 123,
3812
+ line: 124,
3697
3813
  scope: this,
3698
3814
  callSite: (f, a) => f(...a)
3699
3815
  });
@@ -3702,7 +3818,7 @@ var ServiceContext = class {
3702
3818
  var _a, _b;
3703
3819
  (0, import_log15.log)("closing...", {}, {
3704
3820
  file: "service-context.ts",
3705
- line: 127,
3821
+ line: 128,
3706
3822
  scope: this,
3707
3823
  callSite: (f, a) => f(...a)
3708
3824
  });
@@ -3715,7 +3831,7 @@ var ServiceContext = class {
3715
3831
  this.dataServiceSubscriptions.clear();
3716
3832
  (0, import_log15.log)("closed", {}, {
3717
3833
  file: "service-context.ts",
3718
- line: 135,
3834
+ line: 136,
3719
3835
  scope: this,
3720
3836
  callSite: (f, a) => f(...a)
3721
3837
  });
@@ -3723,23 +3839,7 @@ var ServiceContext = class {
3723
3839
  id: this._instanceId
3724
3840
  }), {
3725
3841
  file: "service-context.ts",
3726
- line: 137,
3727
- scope: this,
3728
- callSite: (f, a) => f(...a)
3729
- });
3730
- }
3731
- async reset() {
3732
- (0, import_log15.log)("resetting...", {}, {
3733
- file: "service-context.ts",
3734
- line: 141,
3735
- scope: this,
3736
- callSite: (f, a) => f(...a)
3737
- });
3738
- await this.close();
3739
- await this.storage.reset();
3740
- (0, import_log15.log)("reset", {}, {
3741
- file: "service-context.ts",
3742
- line: 144,
3842
+ line: 138,
3743
3843
  scope: this,
3744
3844
  callSite: (f, a) => f(...a)
3745
3845
  });
@@ -3764,7 +3864,7 @@ var ServiceContext = class {
3764
3864
  var _a;
3765
3865
  (0, import_log15.log)("initializing spaces...", {}, {
3766
3866
  file: "service-context.ts",
3767
- line: 169,
3867
+ line: 163,
3768
3868
  scope: this,
3769
3869
  callSite: (f, a) => f(...a)
3770
3870
  });
@@ -3804,7 +3904,7 @@ var ServiceContext = class {
3804
3904
  details: assertion
3805
3905
  }, {
3806
3906
  file: "service-context.ts",
3807
- line: 211,
3907
+ line: 205,
3808
3908
  scope: this,
3809
3909
  callSite: (f, a) => f(...a)
3810
3910
  });
@@ -3815,7 +3915,7 @@ var ServiceContext = class {
3815
3915
  details: assertion
3816
3916
  }, {
3817
3917
  file: "service-context.ts",
3818
- line: 215,
3918
+ line: 209,
3819
3919
  scope: this,
3820
3920
  callSite: (f, a) => f(...a)
3821
3921
  });
@@ -3826,7 +3926,7 @@ var ServiceContext = class {
3826
3926
  details: assertion
3827
3927
  }, {
3828
3928
  file: "service-context.ts",
3829
- line: 220,
3929
+ line: 214,
3830
3930
  scope: this,
3831
3931
  callSite: (f, a) => f(...a)
3832
3932
  });
@@ -3837,7 +3937,7 @@ var ServiceContext = class {
3837
3937
  } catch (err) {
3838
3938
  import_log15.log.catch(err, {}, {
3839
3939
  file: "service-context.ts",
3840
- line: 226,
3940
+ line: 220,
3841
3941
  scope: this,
3842
3942
  callSite: (f, a) => f(...a)
3843
3943
  });
@@ -3915,8 +4015,7 @@ var ClientServicesHost = class {
3915
4015
  }
3916
4016
  },
3917
4017
  onReset: async () => {
3918
- (0, import_node_assert13.default)(this._serviceContext, "service host is closed");
3919
- await this._serviceContext.reset();
4018
+ await this.reset();
3920
4019
  }
3921
4020
  });
3922
4021
  this._serviceRegistry = new ServiceRegistry(import_client8.clientServiceBundle, {
@@ -3963,7 +4062,7 @@ var ClientServicesHost = class {
3963
4062
  id: this._instanceId
3964
4063
  }), {
3965
4064
  file: "service-host.ts",
3966
- line: 167,
4065
+ line: 166,
3967
4066
  scope: this,
3968
4067
  callSite: (f, a) => f(...a)
3969
4068
  });
@@ -3975,7 +4074,7 @@ var ClientServicesHost = class {
3975
4074
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
3976
4075
  }, {
3977
4076
  file: "service-host.ts",
3978
- line: 174,
4077
+ line: 173,
3979
4078
  scope: this,
3980
4079
  callSite: (f, a) => f(...a)
3981
4080
  });
@@ -4009,7 +4108,7 @@ var ClientServicesHost = class {
4009
4108
  deviceKey
4010
4109
  }, {
4011
4110
  file: "service-host.ts",
4012
- line: 221,
4111
+ line: 220,
4013
4112
  scope: this,
4014
4113
  callSite: (f, a) => f(...a)
4015
4114
  });
@@ -4024,7 +4123,7 @@ var ClientServicesHost = class {
4024
4123
  deviceKey
4025
4124
  }, {
4026
4125
  file: "service-host.ts",
4027
- line: 230,
4126
+ line: 229,
4028
4127
  scope: this,
4029
4128
  callSite: (f, a) => f(...a)
4030
4129
  });
@@ -4038,7 +4137,7 @@ var ClientServicesHost = class {
4038
4137
  deviceKey
4039
4138
  }, {
4040
4139
  file: "service-host.ts",
4041
- line: 235,
4140
+ line: 234,
4042
4141
  scope: this,
4043
4142
  callSite: (f, a) => f(...a)
4044
4143
  });
@@ -4046,7 +4145,24 @@ var ClientServicesHost = class {
4046
4145
  id: this._instanceId
4047
4146
  }), {
4048
4147
  file: "service-host.ts",
4049
- line: 237,
4148
+ line: 236,
4149
+ scope: this,
4150
+ callSite: (f, a) => f(...a)
4151
+ });
4152
+ }
4153
+ async reset() {
4154
+ var _a;
4155
+ (0, import_log16.log)("resetting...", {}, {
4156
+ file: "service-host.ts",
4157
+ line: 240,
4158
+ scope: this,
4159
+ callSite: (f, a) => f(...a)
4160
+ });
4161
+ await ((_a = this._serviceContext) == null ? void 0 : _a.close());
4162
+ await this._storage.reset();
4163
+ (0, import_log16.log)("reset", {}, {
4164
+ file: "service-host.ts",
4165
+ line: 243,
4050
4166
  scope: this,
4051
4167
  callSite: (f, a) => f(...a)
4052
4168
  });