@dxos/client-services 0.1.36-next.ef27157 → 0.1.36

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.
@@ -82,7 +82,7 @@ var import_async18 = require("@dxos/async");
82
82
  var import_client8 = require("@dxos/client");
83
83
  var import_echo_pipeline5 = require("@dxos/echo-pipeline");
84
84
  var import_log16 = require("@dxos/log");
85
- var import_protocols6 = require("@dxos/protocols");
85
+ var import_protocols7 = require("@dxos/protocols");
86
86
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
87
87
 
88
88
  // packages/sdk/client-services/src/packlets/deprecated/tracing.ts
@@ -698,10 +698,11 @@ var IdentityManager = class {
698
698
  async open() {
699
699
  var _a;
700
700
  import_log3.log.trace("dxos.halo.identity-manager", import_protocols2.trace.begin({
701
- id: this._instanceId
701
+ id: this._instanceId,
702
+ parentId: this._traceParent
702
703
  }), {
703
704
  file: "identity-manager.ts",
704
- line: 71,
705
+ line: 72,
705
706
  scope: this,
706
707
  callSite: (f, a) => f(...a)
707
708
  });
@@ -711,7 +712,7 @@ var IdentityManager = class {
711
712
  identityRecord
712
713
  }, {
713
714
  file: "identity-manager.ts",
714
- line: 75,
715
+ line: 76,
715
716
  scope: this,
716
717
  callSite: (f, a) => f(...a)
717
718
  });
@@ -724,7 +725,7 @@ var IdentityManager = class {
724
725
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
725
726
  }, {
726
727
  file: "identity-manager.ts",
727
- line: 80,
728
+ line: 81,
728
729
  scope: this,
729
730
  callSite: (f, a) => f(...a)
730
731
  });
@@ -738,7 +739,7 @@ var IdentityManager = class {
738
739
  id: this._instanceId
739
740
  }), {
740
741
  file: "identity-manager.ts",
741
- line: 90,
742
+ line: 91,
742
743
  scope: this,
743
744
  callSite: (f, a) => f(...a)
744
745
  });
@@ -748,7 +749,7 @@ var IdentityManager = class {
748
749
  (0, import_node_assert2.default)(!this._identity, "Identity already exists.");
749
750
  (0, import_log3.log)("creating identity...", {}, {
750
751
  file: "identity-manager.ts",
751
- line: 95,
752
+ line: 96,
752
753
  scope: this,
753
754
  callSite: (f, a) => f(...a)
754
755
  });
@@ -797,7 +798,7 @@ var IdentityManager = class {
797
798
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
798
799
  }, {
799
800
  file: "identity-manager.ts",
800
- line: 150,
801
+ line: 151,
801
802
  scope: this,
802
803
  callSite: (f, a) => f(...a)
803
804
  });
@@ -807,7 +808,7 @@ var IdentityManager = class {
807
808
  deviceKey: identity.deviceKey
808
809
  }, {
809
810
  file: "identity-manager.ts",
810
- line: 156,
811
+ line: 157,
811
812
  scope: this,
812
813
  callSite: (f, a) => f(...a)
813
814
  });
@@ -822,7 +823,7 @@ var IdentityManager = class {
822
823
  params
823
824
  }, {
824
825
  file: "identity-manager.ts",
825
- line: 164,
826
+ line: 165,
826
827
  scope: this,
827
828
  callSite: (f, a) => f(...a)
828
829
  });
@@ -848,7 +849,7 @@ var IdentityManager = class {
848
849
  displayName: (_a = this._identity.profileDocument) == null ? void 0 : _a.displayName
849
850
  }, {
850
851
  file: "identity-manager.ts",
851
- line: 184,
852
+ line: 185,
852
853
  scope: this,
853
854
  callSite: (f, a) => f(...a)
854
855
  });
@@ -858,7 +859,7 @@ var IdentityManager = class {
858
859
  deviceKey: identity.deviceKey
859
860
  }, {
860
861
  file: "identity-manager.ts",
861
- line: 190,
862
+ line: 191,
862
863
  scope: this,
863
864
  callSite: (f, a) => f(...a)
864
865
  });
@@ -870,7 +871,7 @@ var IdentityManager = class {
870
871
  identityRecord
871
872
  }, {
872
873
  file: "identity-manager.ts",
873
- line: 196,
874
+ line: 197,
874
875
  scope: this,
875
876
  callSite: (f, a) => f(...a)
876
877
  });
@@ -903,7 +904,7 @@ var IdentityManager = class {
903
904
  identityKey: identityRecord.identityKey
904
905
  }, {
905
906
  file: "identity-manager.ts",
906
- line: 224,
907
+ line: 225,
907
908
  scope: this,
908
909
  callSite: (f, a) => f(...a)
909
910
  });
@@ -1916,6 +1917,7 @@ var import_credentials11 = require("@dxos/credentials");
1916
1917
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
1917
1918
  var import_keys9 = require("@dxos/keys");
1918
1919
  var import_log9 = require("@dxos/log");
1920
+ var import_protocols5 = require("@dxos/protocols");
1919
1921
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
1920
1922
  var import_util5 = require("@dxos/util");
1921
1923
 
@@ -2412,6 +2414,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2412
2414
  this.updated = new import_async10.Event();
2413
2415
  this._spaces = new import_util5.ComplexMap(import_keys9.PublicKey.hash);
2414
2416
  this._isOpen = false;
2417
+ this._instanceId = import_keys9.PublicKey.random().toHex();
2415
2418
  }
2416
2419
  // TODO(burdon): Remove.
2417
2420
  get spaces() {
@@ -2420,7 +2423,16 @@ var DataSpaceManager = class DataSpaceManager2 {
2420
2423
  async open() {
2421
2424
  (0, import_log9.log)("open", {}, {
2422
2425
  file: "data-space-manager.ts",
2423
- line: 80,
2426
+ line: 83,
2427
+ scope: this,
2428
+ callSite: (f, a) => f(...a)
2429
+ });
2430
+ import_log9.log.trace("dxos.echo.data-space-manager", import_protocols5.trace.begin({
2431
+ id: this._instanceId,
2432
+ parentId: this._traceParent
2433
+ }), {
2434
+ file: "data-space-manager.ts",
2435
+ line: 84,
2424
2436
  scope: this,
2425
2437
  callSite: (f, a) => f(...a)
2426
2438
  });
@@ -2429,7 +2441,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2429
2441
  spaces: this._metadataStore.spaces.length
2430
2442
  }, {
2431
2443
  file: "data-space-manager.ts",
2432
- line: 82,
2444
+ line: 86,
2433
2445
  scope: this,
2434
2446
  callSite: (f, a) => f(...a)
2435
2447
  });
@@ -2438,7 +2450,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2438
2450
  spaceMetadata
2439
2451
  }, {
2440
2452
  file: "data-space-manager.ts",
2441
- line: 85,
2453
+ line: 89,
2442
2454
  scope: this,
2443
2455
  callSite: (f, a) => f(...a)
2444
2456
  });
@@ -2451,7 +2463,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2451
2463
  async close() {
2452
2464
  (0, import_log9.log)("close", {}, {
2453
2465
  file: "data-space-manager.ts",
2454
- line: 96,
2466
+ line: 100,
2455
2467
  scope: this,
2456
2468
  callSite: (f, a) => f(...a)
2457
2469
  });
@@ -2460,6 +2472,14 @@ var DataSpaceManager = class DataSpaceManager2 {
2460
2472
  for (const space of this._spaces.values()) {
2461
2473
  await space.close();
2462
2474
  }
2475
+ import_log9.log.trace("dxos.echo.data-space-manager", import_protocols5.trace.end({
2476
+ id: this._instanceId
2477
+ }), {
2478
+ file: "data-space-manager.ts",
2479
+ line: 106,
2480
+ scope: this,
2481
+ callSite: (f, a) => f(...a)
2482
+ });
2463
2483
  }
2464
2484
  /**
2465
2485
  * Creates a new space writing the genesis credentials to the control feed.
@@ -2479,7 +2499,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2479
2499
  spaceKey
2480
2500
  }, {
2481
2501
  file: "data-space-manager.ts",
2482
- line: 120,
2502
+ line: 125,
2483
2503
  scope: this,
2484
2504
  callSite: (f, a) => f(...a)
2485
2505
  });
@@ -2499,7 +2519,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2499
2519
  opts
2500
2520
  }, {
2501
2521
  file: "data-space-manager.ts",
2502
- line: 139,
2522
+ line: 144,
2503
2523
  scope: this,
2504
2524
  callSite: (f, a) => f(...a)
2505
2525
  });
@@ -2533,7 +2553,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2533
2553
  metadata
2534
2554
  }, {
2535
2555
  file: "data-space-manager.ts",
2536
- line: 175,
2556
+ line: 180,
2537
2557
  scope: this,
2538
2558
  callSite: (f, a) => f(...a)
2539
2559
  });
@@ -2588,7 +2608,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2588
2608
  space: space.key
2589
2609
  }, {
2590
2610
  file: "data-space-manager.ts",
2591
- line: 224,
2611
+ line: 229,
2592
2612
  scope: this,
2593
2613
  callSite: (f, a) => f(...a)
2594
2614
  });
@@ -2600,7 +2620,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2600
2620
  open: this._isOpen
2601
2621
  }, {
2602
2622
  file: "data-space-manager.ts",
2603
- line: 231,
2623
+ line: 236,
2604
2624
  scope: this,
2605
2625
  callSite: (f, a) => f(...a)
2606
2626
  });
@@ -2825,6 +2845,8 @@ var toStorageType = (type) => {
2825
2845
  return import_random_access_storage.StorageType.IDB;
2826
2846
  case StorageDriver.NODE:
2827
2847
  return import_random_access_storage.StorageType.NODE;
2848
+ case StorageDriver.WEBFS:
2849
+ return import_random_access_storage.StorageType.WEBFS;
2828
2850
  default:
2829
2851
  throw new Error(`Invalid storage type: ${StorageDriver[type]}`);
2830
2852
  }
@@ -3421,7 +3443,7 @@ var import_feed_store4 = require("@dxos/feed-store");
3421
3443
  var import_keyring = require("@dxos/keyring");
3422
3444
  var import_keys10 = require("@dxos/keys");
3423
3445
  var import_log15 = require("@dxos/log");
3424
- var import_protocols5 = require("@dxos/protocols");
3446
+ var import_protocols6 = require("@dxos/protocols");
3425
3447
  var ServiceContext = class {
3426
3448
  // prettier-ignore
3427
3449
  constructor(storage, networkManager, modelFactory) {
@@ -3432,6 +3454,7 @@ var ServiceContext = class {
3432
3454
  this.dataServiceSubscriptions = new import_echo_pipeline4.DataServiceSubscriptions();
3433
3455
  this._handlerFactories = /* @__PURE__ */ new Map();
3434
3456
  this._instanceId = import_keys10.PublicKey.random().toHex();
3457
+ networkManager._traceParent = this._instanceId;
3435
3458
  this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
3436
3459
  this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
3437
3460
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
@@ -3448,7 +3471,9 @@ var ServiceContext = class {
3448
3471
  feedStore: this.feedStore,
3449
3472
  networkManager: this.networkManager
3450
3473
  });
3474
+ this.spaceManager._traceParent = this._instanceId;
3451
3475
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
3476
+ this.identityManager._traceParent = this._instanceId;
3452
3477
  this.invitations = new InvitationsHandler(this.networkManager);
3453
3478
  this._handlerFactories.set(import_client7.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3454
3479
  var _a;
@@ -3456,17 +3481,17 @@ var ServiceContext = class {
3456
3481
  }, this._acceptIdentity.bind(this)));
3457
3482
  }
3458
3483
  async open() {
3459
- import_log15.log.trace("dxos.sdk.client-services", import_protocols5.trace.begin({
3484
+ import_log15.log.trace("dxos.sdk.service-context", import_protocols6.trace.begin({
3460
3485
  id: this._instanceId
3461
3486
  }), {
3462
3487
  file: "service-context.ts",
3463
- line: 111,
3488
+ line: 114,
3464
3489
  scope: this,
3465
3490
  callSite: (f, a) => f(...a)
3466
3491
  });
3467
3492
  (0, import_log15.log)("opening...", {}, {
3468
3493
  file: "service-context.ts",
3469
- line: 113,
3494
+ line: 116,
3470
3495
  scope: this,
3471
3496
  callSite: (f, a) => f(...a)
3472
3497
  });
@@ -3478,7 +3503,7 @@ var ServiceContext = class {
3478
3503
  }
3479
3504
  (0, import_log15.log)("opened", {}, {
3480
3505
  file: "service-context.ts",
3481
- line: 120,
3506
+ line: 123,
3482
3507
  scope: this,
3483
3508
  callSite: (f, a) => f(...a)
3484
3509
  });
@@ -3487,7 +3512,7 @@ var ServiceContext = class {
3487
3512
  var _a, _b;
3488
3513
  (0, import_log15.log)("closing...", {}, {
3489
3514
  file: "service-context.ts",
3490
- line: 124,
3515
+ line: 127,
3491
3516
  scope: this,
3492
3517
  callSite: (f, a) => f(...a)
3493
3518
  });
@@ -3500,15 +3525,15 @@ var ServiceContext = class {
3500
3525
  this.dataServiceSubscriptions.clear();
3501
3526
  (0, import_log15.log)("closed", {}, {
3502
3527
  file: "service-context.ts",
3503
- line: 132,
3528
+ line: 135,
3504
3529
  scope: this,
3505
3530
  callSite: (f, a) => f(...a)
3506
3531
  });
3507
- import_log15.log.trace("dxos.sdk.client-services", import_protocols5.trace.end({
3532
+ import_log15.log.trace("dxos.sdk.service-context", import_protocols6.trace.end({
3508
3533
  id: this._instanceId
3509
3534
  }), {
3510
3535
  file: "service-context.ts",
3511
- line: 134,
3536
+ line: 137,
3512
3537
  scope: this,
3513
3538
  callSite: (f, a) => f(...a)
3514
3539
  });
@@ -3516,7 +3541,7 @@ var ServiceContext = class {
3516
3541
  async reset() {
3517
3542
  (0, import_log15.log)("resetting...", {}, {
3518
3543
  file: "service-context.ts",
3519
- line: 138,
3544
+ line: 141,
3520
3545
  scope: this,
3521
3546
  callSite: (f, a) => f(...a)
3522
3547
  });
@@ -3524,7 +3549,7 @@ var ServiceContext = class {
3524
3549
  await this.storage.reset();
3525
3550
  (0, import_log15.log)("reset", {}, {
3526
3551
  file: "service-context.ts",
3527
- line: 141,
3552
+ line: 144,
3528
3553
  scope: this,
3529
3554
  callSite: (f, a) => f(...a)
3530
3555
  });
@@ -3549,7 +3574,7 @@ var ServiceContext = class {
3549
3574
  var _a;
3550
3575
  (0, import_log15.log)("initializing spaces...", {}, {
3551
3576
  file: "service-context.ts",
3552
- line: 166,
3577
+ line: 169,
3553
3578
  scope: this,
3554
3579
  callSite: (f, a) => f(...a)
3555
3580
  });
@@ -3568,6 +3593,7 @@ var ServiceContext = class {
3568
3593
  }
3569
3594
  };
3570
3595
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.modelFactory, this.feedStore, this.snapshotStore);
3596
+ this.dataSpaceManager._traceParent = this._instanceId;
3571
3597
  await this.dataSpaceManager.open();
3572
3598
  this._handlerFactories.set(import_client7.Invitation.Kind.SPACE, (invitation) => {
3573
3599
  (0, import_node_assert12.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
@@ -3588,7 +3614,7 @@ var ServiceContext = class {
3588
3614
  details: assertion
3589
3615
  }, {
3590
3616
  file: "service-context.ts",
3591
- line: 207,
3617
+ line: 211,
3592
3618
  scope: this,
3593
3619
  callSite: (f, a) => f(...a)
3594
3620
  });
@@ -3599,7 +3625,7 @@ var ServiceContext = class {
3599
3625
  details: assertion
3600
3626
  }, {
3601
3627
  file: "service-context.ts",
3602
- line: 211,
3628
+ line: 215,
3603
3629
  scope: this,
3604
3630
  callSite: (f, a) => f(...a)
3605
3631
  });
@@ -3610,7 +3636,7 @@ var ServiceContext = class {
3610
3636
  details: assertion
3611
3637
  }, {
3612
3638
  file: "service-context.ts",
3613
- line: 216,
3639
+ line: 220,
3614
3640
  scope: this,
3615
3641
  callSite: (f, a) => f(...a)
3616
3642
  });
@@ -3621,7 +3647,7 @@ var ServiceContext = class {
3621
3647
  } catch (err) {
3622
3648
  import_log15.log.catch(err, {}, {
3623
3649
  file: "service-context.ts",
3624
- line: 222,
3650
+ line: 226,
3625
3651
  scope: this,
3626
3652
  callSite: (f, a) => f(...a)
3627
3653
  });
@@ -3743,7 +3769,7 @@ var ClientServicesHost = class {
3743
3769
  if (this._open) {
3744
3770
  return;
3745
3771
  }
3746
- import_log16.log.trace("dxos.sdk.client-services-host", import_protocols6.trace.begin({
3772
+ import_log16.log.trace("dxos.sdk.client-services-host", import_protocols7.trace.begin({
3747
3773
  id: this._instanceId
3748
3774
  }), {
3749
3775
  file: "service-host.ts",
@@ -3826,7 +3852,7 @@ var ClientServicesHost = class {
3826
3852
  scope: this,
3827
3853
  callSite: (f, a) => f(...a)
3828
3854
  });
3829
- import_log16.log.trace("dxos.sdk.client-services-host", import_protocols6.trace.end({
3855
+ import_log16.log.trace("dxos.sdk.client-services-host", import_protocols7.trace.end({
3830
3856
  id: this._instanceId
3831
3857
  }), {
3832
3858
  file: "service-host.ts",