@dxos/client-services 0.3.3-main.f2ca85a → 0.3.3-main.f990aad

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.
@@ -2420,9 +2420,21 @@ var SpaceInvitationProtocol = class {
2420
2420
  import { Stream as Stream9 } from "@dxos/codec-protobuf";
2421
2421
  import { raise } from "@dxos/debug";
2422
2422
  import { parseMethodName, RpcPeer } from "@dxos/rpc";
2423
- var ClientRpcServer = class {
2423
+ import { MapCounter, trace as trace5 } from "@dxos/tracing";
2424
+ function _ts_decorate3(decorators, target, key, desc) {
2425
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2426
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2427
+ r = Reflect.decorate(decorators, target, key, desc);
2428
+ else
2429
+ for (var i = decorators.length - 1; i >= 0; i--)
2430
+ if (d = decorators[i])
2431
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2432
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2433
+ }
2434
+ var ClientRpcServer = class ClientRpcServer2 {
2424
2435
  constructor(params) {
2425
2436
  this._handlerCache = /* @__PURE__ */ new Map();
2437
+ this._callMetrics = new MapCounter();
2426
2438
  const { serviceRegistry, handleCall, handleStream, ...rpcOptions } = params;
2427
2439
  this._handleCall = handleCall;
2428
2440
  this._handleStream = handleStream;
@@ -2432,6 +2444,7 @@ var ClientRpcServer = class {
2432
2444
  callHandler: (method, params2) => {
2433
2445
  const [serviceName, methodName] = parseMethodName(method);
2434
2446
  const handler = (method2, params3) => this._getServiceHandler(serviceName).call(method2, params3);
2447
+ this._callMetrics.inc(`${serviceName}.${methodName} request`);
2435
2448
  if (this._handleCall) {
2436
2449
  return this._handleCall(methodName, params2, handler);
2437
2450
  } else {
@@ -2441,14 +2454,21 @@ var ClientRpcServer = class {
2441
2454
  streamHandler: (method, params2) => {
2442
2455
  const [serviceName, methodName] = parseMethodName(method);
2443
2456
  const handler = (method2, params3) => this._getServiceHandler(serviceName).callStream(method2, params3);
2457
+ this._callMetrics.inc(`${serviceName}.${methodName} request stream`);
2444
2458
  if (this._handleStream) {
2445
- return Stream9.unwrapPromise(this._handleStream(methodName, params2, handler));
2459
+ return Stream9.map(Stream9.unwrapPromise(this._handleStream(methodName, params2, handler)), (data) => {
2460
+ this._callMetrics.inc(`${serviceName}.${methodName} response stream`);
2461
+ return data;
2462
+ });
2446
2463
  } else {
2447
2464
  return handler(methodName, params2);
2448
2465
  }
2449
2466
  }
2450
2467
  });
2451
2468
  }
2469
+ get _services() {
2470
+ return Object.keys(this._serviceRegistry.services);
2471
+ }
2452
2472
  async open() {
2453
2473
  await this._rpcPeer.open();
2454
2474
  }
@@ -2467,6 +2487,15 @@ var ClientRpcServer = class {
2467
2487
  return this._handlerCache.get(serviceName);
2468
2488
  }
2469
2489
  };
2490
+ _ts_decorate3([
2491
+ trace5.metricsCounter()
2492
+ ], ClientRpcServer.prototype, "_callMetrics", void 0);
2493
+ _ts_decorate3([
2494
+ trace5.info()
2495
+ ], ClientRpcServer.prototype, "_services", null);
2496
+ ClientRpcServer = _ts_decorate3([
2497
+ trace5.resource()
2498
+ ], ClientRpcServer);
2470
2499
 
2471
2500
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2472
2501
  import { Trigger as Trigger4 } from "@dxos/async";
@@ -2508,7 +2537,7 @@ var getPlatform = () => {
2508
2537
  };
2509
2538
 
2510
2539
  // packages/sdk/client-services/src/version.ts
2511
- var DXOS_VERSION = "0.3.3-main.f2ca85a";
2540
+ var DXOS_VERSION = "0.3.3-main.f990aad";
2512
2541
 
2513
2542
  // packages/sdk/client-services/src/packlets/services/diagnostics.ts
2514
2543
  var __dxlog_file10 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/services/diagnostics.ts";
@@ -2653,7 +2682,7 @@ import { CancelledError, SystemError } from "@dxos/protocols";
2653
2682
  import { SpaceState } from "@dxos/protocols/proto/dxos/client/services";
2654
2683
  import { AdmittedFeed as AdmittedFeed3 } from "@dxos/protocols/proto/dxos/halo/credentials";
2655
2684
  import { Timeframe as Timeframe2 } from "@dxos/timeframe";
2656
- import { trace as trace5 } from "@dxos/tracing";
2685
+ import { trace as trace6 } from "@dxos/tracing";
2657
2686
  import { ComplexSet as ComplexSet3 } from "@dxos/util";
2658
2687
 
2659
2688
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
@@ -2925,7 +2954,7 @@ var NotarizationTeleportExtension = class extends RpcExtension2 {
2925
2954
  };
2926
2955
 
2927
2956
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2928
- function _ts_decorate3(decorators, target, key, desc) {
2957
+ function _ts_decorate4(decorators, target, key, desc) {
2929
2958
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2930
2959
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2931
2960
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3257,32 +3286,32 @@ var DataSpace = class DataSpace2 {
3257
3286
  this.stateUpdate.emit();
3258
3287
  }
3259
3288
  };
3260
- _ts_decorate3([
3289
+ _ts_decorate4([
3261
3290
  synchronized
3262
3291
  ], DataSpace.prototype, "open", null);
3263
- _ts_decorate3([
3292
+ _ts_decorate4([
3264
3293
  synchronized
3265
3294
  ], DataSpace.prototype, "close", null);
3266
- _ts_decorate3([
3267
- trace5.span({
3295
+ _ts_decorate4([
3296
+ trace6.span({
3268
3297
  showInBrowserTimeline: true
3269
3298
  })
3270
3299
  ], DataSpace.prototype, "initializeDataPipeline", null);
3271
- _ts_decorate3([
3272
- trace5.span({
3300
+ _ts_decorate4([
3301
+ trace6.span({
3273
3302
  showInBrowserTimeline: true
3274
3303
  })
3275
3304
  ], DataSpace.prototype, "_initializeAndReadControlPipeline", null);
3276
- _ts_decorate3([
3305
+ _ts_decorate4([
3277
3306
  timed(1e4)
3278
3307
  ], DataSpace.prototype, "_createWritableFeeds", null);
3279
- _ts_decorate3([
3308
+ _ts_decorate4([
3280
3309
  synchronized
3281
3310
  ], DataSpace.prototype, "activate", null);
3282
- _ts_decorate3([
3311
+ _ts_decorate4([
3283
3312
  synchronized
3284
3313
  ], DataSpace.prototype, "deactivate", null);
3285
- DataSpace = _ts_decorate3([
3314
+ DataSpace = _ts_decorate4([
3286
3315
  trackLeaks("open", "close")
3287
3316
  ], DataSpace);
3288
3317
 
@@ -3293,7 +3322,7 @@ import { getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credent
3293
3322
  import { invariant as invariant11 } from "@dxos/invariant";
3294
3323
  import { PublicKey as PublicKey9 } from "@dxos/keys";
3295
3324
  import { log as log11 } from "@dxos/log";
3296
- import { trace as trace6 } from "@dxos/protocols";
3325
+ import { trace as trace7 } from "@dxos/protocols";
3297
3326
  import { SpaceState as SpaceState2 } from "@dxos/protocols/proto/dxos/client/services";
3298
3327
  import { Gossip, Presence } from "@dxos/teleport-extension-gossip";
3299
3328
  import { ComplexMap as ComplexMap3, deferFunction as deferFunction2, forEachAsync } from "@dxos/util";
@@ -3368,7 +3397,7 @@ var spaceGenesis = async (keyring, signingContext, space) => {
3368
3397
  };
3369
3398
 
3370
3399
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
3371
- function _ts_decorate4(decorators, target, key, desc) {
3400
+ function _ts_decorate5(decorators, target, key, desc) {
3372
3401
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3373
3402
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3374
3403
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3404,7 +3433,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3404
3433
  S: this,
3405
3434
  C: (f, a) => f(...a)
3406
3435
  });
3407
- log11.trace("dxos.echo.data-space-manager.open", trace6.begin({
3436
+ log11.trace("dxos.echo.data-space-manager.open", trace7.begin({
3408
3437
  id: this._instanceId
3409
3438
  }), {
3410
3439
  F: __dxlog_file13,
@@ -3450,7 +3479,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3450
3479
  space.initializeDataPipelineAsync();
3451
3480
  }
3452
3481
  }
3453
- log11.trace("dxos.echo.data-space-manager.open", trace6.end({
3482
+ log11.trace("dxos.echo.data-space-manager.open", trace7.end({
3454
3483
  id: this._instanceId
3455
3484
  }), {
3456
3485
  F: __dxlog_file13,
@@ -3684,19 +3713,19 @@ var DataSpaceManager = class DataSpaceManager2 {
3684
3713
  return dataSpace;
3685
3714
  }
3686
3715
  };
3687
- _ts_decorate4([
3716
+ _ts_decorate5([
3688
3717
  synchronized2
3689
3718
  ], DataSpaceManager.prototype, "open", null);
3690
- _ts_decorate4([
3719
+ _ts_decorate5([
3691
3720
  synchronized2
3692
3721
  ], DataSpaceManager.prototype, "close", null);
3693
- _ts_decorate4([
3722
+ _ts_decorate5([
3694
3723
  synchronized2
3695
3724
  ], DataSpaceManager.prototype, "createSpace", null);
3696
- _ts_decorate4([
3725
+ _ts_decorate5([
3697
3726
  synchronized2
3698
3727
  ], DataSpaceManager.prototype, "acceptSpace", null);
3699
- DataSpaceManager = _ts_decorate4([
3728
+ DataSpaceManager = _ts_decorate5([
3700
3729
  trackLeaks2("open", "close")
3701
3730
  ], DataSpaceManager);
3702
3731
 
@@ -3932,12 +3961,12 @@ import { invariant as invariant13 } from "@dxos/invariant";
3932
3961
  import { Keyring } from "@dxos/keyring";
3933
3962
  import { PublicKey as PublicKey10 } from "@dxos/keys";
3934
3963
  import { log as log13 } from "@dxos/log";
3935
- import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace7 } from "@dxos/protocols";
3964
+ import { InvalidStorageVersionError, STORAGE_VERSION as STORAGE_VERSION2, trace as trace8 } from "@dxos/protocols";
3936
3965
  import { Invitation as Invitation6 } from "@dxos/protocols/proto/dxos/client/services";
3937
3966
  import { BlobStore } from "@dxos/teleport-extension-object-sync";
3938
3967
  import { trace as Trace2 } from "@dxos/tracing";
3939
3968
  import { safeInstanceof } from "@dxos/util";
3940
- function _ts_decorate5(decorators, target, key, desc) {
3969
+ function _ts_decorate6(decorators, target, key, desc) {
3941
3970
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3942
3971
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
3943
3972
  r = Reflect.decorate(decorators, target, key, desc);
@@ -3992,7 +4021,7 @@ var ServiceContext = class ServiceContext2 {
3992
4021
  S: this,
3993
4022
  C: (f, a) => f(...a)
3994
4023
  });
3995
- log13.trace("dxos.sdk.service-context.open", trace7.begin({
4024
+ log13.trace("dxos.sdk.service-context.open", trace8.begin({
3996
4025
  id: this._instanceId
3997
4026
  }), {
3998
4027
  F: __dxlog_file15,
@@ -4008,7 +4037,7 @@ var ServiceContext = class ServiceContext2 {
4008
4037
  if (this.identityManager.identity) {
4009
4038
  await this._initialize(ctx);
4010
4039
  }
4011
- log13.trace("dxos.sdk.service-context.open", trace7.end({
4040
+ log13.trace("dxos.sdk.service-context.open", trace8.end({
4012
4041
  id: this._instanceId
4013
4042
  }), {
4014
4043
  F: __dxlog_file15,
@@ -4171,13 +4200,13 @@ var ServiceContext = class ServiceContext2 {
4171
4200
  await identity.space.spaceState.addCredentialProcessor(this._deviceSpaceSync);
4172
4201
  }
4173
4202
  };
4174
- _ts_decorate5([
4203
+ _ts_decorate6([
4175
4204
  Trace2.span()
4176
4205
  ], ServiceContext.prototype, "open", null);
4177
- _ts_decorate5([
4206
+ _ts_decorate6([
4178
4207
  Trace2.span()
4179
4208
  ], ServiceContext.prototype, "_initialize", null);
4180
- ServiceContext = _ts_decorate5([
4209
+ ServiceContext = _ts_decorate6([
4181
4210
  safeInstanceof("dxos.client-services.ServiceContext"),
4182
4211
  Trace2.resource()
4183
4212
  ], ServiceContext);
@@ -4210,7 +4239,7 @@ var ServiceRegistry = class {
4210
4239
  import { asyncTimeout, Trigger as Trigger7 } from "@dxos/async";
4211
4240
  import { RESOURCE_LOCK_TIMEOUT } from "@dxos/client-protocol";
4212
4241
  import { log as log14, logInfo } from "@dxos/log";
4213
- function _ts_decorate6(decorators, target, key, desc) {
4242
+ function _ts_decorate7(decorators, target, key, desc) {
4214
4243
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4215
4244
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4216
4245
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4323,7 +4352,7 @@ var Lock = class {
4323
4352
  });
4324
4353
  }
4325
4354
  };
4326
- _ts_decorate6([
4355
+ _ts_decorate7([
4327
4356
  logInfo
4328
4357
  ], Lock.prototype, "lockKey", null);
4329
4358
  var isLocked = (lockPath) => {
@@ -4392,7 +4421,7 @@ import { log as log16 } from "@dxos/log";
4392
4421
  import { WebsocketSignalManager } from "@dxos/messaging";
4393
4422
  import { ModelFactory } from "@dxos/model-factory";
4394
4423
  import { createSimplePeerTransportFactory, NetworkManager } from "@dxos/network-manager";
4395
- import { trace as trace8 } from "@dxos/protocols";
4424
+ import { trace as trace9 } from "@dxos/protocols";
4396
4425
  import { SystemStatus } from "@dxos/protocols/proto/dxos/client/services";
4397
4426
  import { TextModel } from "@dxos/text-model";
4398
4427
  import { TRACE_PROCESSOR, trace as Trace3 } from "@dxos/tracing";
@@ -4646,7 +4675,7 @@ var SystemServiceImpl = class {
4646
4675
  };
4647
4676
 
4648
4677
  // packages/sdk/client-services/src/packlets/services/service-host.ts
4649
- function _ts_decorate7(decorators, target, key, desc) {
4678
+ function _ts_decorate8(decorators, target, key, desc) {
4650
4679
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4651
4680
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
4652
4681
  r = Reflect.decorate(decorators, target, key, desc);
@@ -4816,7 +4845,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4816
4845
  return;
4817
4846
  }
4818
4847
  const traceId = PublicKey11.random().toHex();
4819
- log16.trace("dxos.client-services.host.open", trace8.begin({
4848
+ log16.trace("dxos.client-services.host.open", trace9.begin({
4820
4849
  id: traceId
4821
4850
  }), {
4822
4851
  F: __dxlog_file17,
@@ -4915,7 +4944,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4915
4944
  S: this,
4916
4945
  C: (f, a) => f(...a)
4917
4946
  });
4918
- log16.trace("dxos.client-services.host.open", trace8.end({
4947
+ log16.trace("dxos.client-services.host.open", trace9.end({
4919
4948
  id: traceId
4920
4949
  }), {
4921
4950
  F: __dxlog_file17,
@@ -4956,7 +4985,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4956
4985
  }
4957
4986
  async reset() {
4958
4987
  const traceId = PublicKey11.random().toHex();
4959
- log16.trace("dxos.sdk.client-services-host.reset", trace8.begin({
4988
+ log16.trace("dxos.sdk.client-services-host.reset", trace9.begin({
4960
4989
  id: traceId
4961
4990
  }), {
4962
4991
  F: __dxlog_file17,
@@ -4978,7 +5007,7 @@ var ClientServicesHost = class ClientServicesHost2 {
4978
5007
  S: this,
4979
5008
  C: (f, a) => f(...a)
4980
5009
  });
4981
- log16.trace("dxos.sdk.client-services-host.reset", trace8.end({
5010
+ log16.trace("dxos.sdk.client-services-host.reset", trace9.end({
4982
5011
  id: traceId
4983
5012
  }), {
4984
5013
  F: __dxlog_file17,
@@ -5008,21 +5037,21 @@ var ClientServicesHost = class ClientServicesHost2 {
5008
5037
  return identity;
5009
5038
  }
5010
5039
  };
5011
- _ts_decorate7([
5040
+ _ts_decorate8([
5012
5041
  Trace3.info()
5013
5042
  ], ClientServicesHost.prototype, "_opening", void 0);
5014
- _ts_decorate7([
5043
+ _ts_decorate8([
5015
5044
  Trace3.info()
5016
5045
  ], ClientServicesHost.prototype, "_open", void 0);
5017
- _ts_decorate7([
5046
+ _ts_decorate8([
5018
5047
  synchronized3,
5019
5048
  Trace3.span()
5020
5049
  ], ClientServicesHost.prototype, "open", null);
5021
- _ts_decorate7([
5050
+ _ts_decorate8([
5022
5051
  synchronized3,
5023
5052
  Trace3.span()
5024
5053
  ], ClientServicesHost.prototype, "close", null);
5025
- ClientServicesHost = _ts_decorate7([
5054
+ ClientServicesHost = _ts_decorate8([
5026
5055
  Trace3.resource()
5027
5056
  ], ClientServicesHost);
5028
5057
 
@@ -5059,4 +5088,4 @@ export {
5059
5088
  createDefaultModelFactory,
5060
5089
  ClientServicesHost
5061
5090
  };
5062
- //# sourceMappingURL=chunk-CIMVJJPI.mjs.map
5091
+ //# sourceMappingURL=chunk-UUQTHQF5.mjs.map