@dxos/client-services 0.1.48-next.83f55fd → 0.1.49-next.55d8a92

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.
@@ -151,7 +151,7 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
151
151
  feeds: Array.from(feedMap.values()).map((feed) => ({
152
152
  feedKey: feed.key,
153
153
  length: feed.properties.length,
154
- diskUsage: feed.core.byteLength
154
+ bytes: feed.core.byteLength
155
155
  }))
156
156
  });
157
157
  };
@@ -2138,6 +2138,7 @@ var SpaceInvitationProtocol = class {
2138
2138
  var import_async11 = require("@dxos/async");
2139
2139
  var import_codec_protobuf9 = require("@dxos/codec-protobuf");
2140
2140
  var import_log8 = require("@dxos/log");
2141
+ var import_util3 = require("@dxos/util");
2141
2142
  var LoggingServiceImpl = class {
2142
2143
  constructor() {
2143
2144
  this._logs = new import_async11.Event();
@@ -2157,12 +2158,18 @@ var LoggingServiceImpl = class {
2157
2158
  const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
2158
2159
  return new import_codec_protobuf9.Stream(({ ctx, next }) => {
2159
2160
  const handler = (entry2) => {
2160
- var _a2;
2161
+ var _a2, _b, _c;
2161
2162
  if (((_a2 = entry2.meta) == null ? void 0 : _a2.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
2162
2163
  return;
2163
2164
  }
2164
2165
  if ((0, import_log8.shouldLog)(entry2, filters)) {
2165
- next(jsonify(entry2));
2166
+ const record = {
2167
+ ...entry2,
2168
+ context: (0, import_util3.jsonify)((0, import_log8.getContextFromEntry)(entry2))
2169
+ };
2170
+ (_b = record.meta) == null ? true : delete _b.bugcheck;
2171
+ (_c = record.meta) == null ? true : delete _c.scope;
2172
+ next(record);
2166
2173
  }
2167
2174
  };
2168
2175
  ctx.onDispose(() => {
@@ -2172,30 +2179,6 @@ var LoggingServiceImpl = class {
2172
2179
  });
2173
2180
  }
2174
2181
  };
2175
- var jsonify = (value, handles = /* @__PURE__ */ new WeakSet()) => {
2176
- if (typeof value === "function") {
2177
- return null;
2178
- } else if (typeof value === "object" && value !== null) {
2179
- if (handles.has(value)) {
2180
- return null;
2181
- }
2182
- handles.add(value);
2183
- if (Array.isArray(value)) {
2184
- return value.map((x) => jsonify(x, handles));
2185
- } else {
2186
- if (typeof value.toJSON === "function") {
2187
- return value.toJSON();
2188
- }
2189
- const res = {};
2190
- for (const key of Object.keys(value)) {
2191
- res[key] = jsonify(value[key], handles);
2192
- }
2193
- return res;
2194
- }
2195
- } else {
2196
- return value;
2197
- }
2198
- };
2199
2182
 
2200
2183
  // packages/sdk/client-services/src/packlets/network/network-service.ts
2201
2184
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
@@ -2239,7 +2222,7 @@ var import_log11 = require("@dxos/log");
2239
2222
  var import_protocols6 = require("@dxos/protocols");
2240
2223
  var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2241
2224
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2242
- var import_util5 = require("@dxos/util");
2225
+ var import_util6 = require("@dxos/util");
2243
2226
 
2244
2227
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
2245
2228
  var import_async13 = require("@dxos/async");
@@ -2252,7 +2235,7 @@ var import_keys9 = require("@dxos/keys");
2252
2235
  var import_log10 = require("@dxos/log");
2253
2236
  var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2254
2237
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2255
- var import_util4 = require("@dxos/util");
2238
+ var import_util5 = require("@dxos/util");
2256
2239
 
2257
2240
  // packages/sdk/client-services/src/packlets/spaces/notarization-plugin.ts
2258
2241
  var import_node_assert9 = __toESM(require("node:assert"));
@@ -2262,7 +2245,7 @@ var import_keys8 = require("@dxos/keys");
2262
2245
  var import_log9 = require("@dxos/log");
2263
2246
  var import_protocols5 = require("@dxos/protocols");
2264
2247
  var import_teleport2 = require("@dxos/teleport");
2265
- var import_util3 = require("@dxos/util");
2248
+ var import_util4 = require("@dxos/util");
2266
2249
  var DEFAULT_RETRY_TIMEOUT = 1e3;
2267
2250
  var DEFAULT_SUCCESS_DELAY = 1e3;
2268
2251
  var DEFAULT_NOTARIZE_TIMEOUT = 1e4;
@@ -2271,8 +2254,8 @@ var NotarizationPlugin = class {
2271
2254
  this._ctx = new import_context5.Context();
2272
2255
  this._extensionOpened = new import_async12.Event();
2273
2256
  this._extensions = /* @__PURE__ */ new Set();
2274
- this._processedCredentials = new import_util3.ComplexSet(import_keys8.PublicKey.hash);
2275
- this._processCredentialsTriggers = new import_util3.ComplexMap(import_keys8.PublicKey.hash);
2257
+ this._processedCredentials = new import_util4.ComplexSet(import_keys8.PublicKey.hash);
2258
+ this._processCredentialsTriggers = new import_util4.ComplexMap(import_keys8.PublicKey.hash);
2276
2259
  }
2277
2260
  async open() {
2278
2261
  }
@@ -2414,7 +2397,7 @@ var NotarizationPlugin = class {
2414
2397
  if (this._processedCredentials.has(id)) {
2415
2398
  return;
2416
2399
  }
2417
- await (0, import_util3.entry)(this._processCredentialsTriggers, id).orInsert(new import_async12.Trigger()).value.wait();
2400
+ await (0, import_util4.entry)(this._processCredentialsTriggers, id).orInsert(new import_async12.Trigger()).value.wait();
2418
2401
  }
2419
2402
  /**
2420
2403
  * Requests from other peers to notarize credentials.
@@ -2525,7 +2508,7 @@ var DataSpace = class DataSpace2 {
2525
2508
  this._signingContext = params.signingContext;
2526
2509
  this._callbacks = (_a = params.callbacks) != null ? _a : {};
2527
2510
  this.authVerifier = new TrustedKeySetAuthVerifier({
2528
- trustedKeysProvider: () => new import_util4.ComplexSet(import_keys9.PublicKey.hash, Array.from(this._inner.spaceState.members.keys())),
2511
+ trustedKeysProvider: () => new import_util5.ComplexSet(import_keys9.PublicKey.hash, Array.from(this._inner.spaceState.members.keys())),
2529
2512
  update: this._inner.stateUpdate,
2530
2513
  authTimeout: import_client_protocol3.AUTH_TIMEOUT
2531
2514
  });
@@ -2823,7 +2806,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2823
2806
  this._feedStore = _feedStore;
2824
2807
  this._ctx = new import_context7.Context();
2825
2808
  this.updated = new import_async14.Event();
2826
- this._spaces = new import_util5.ComplexMap(import_keys10.PublicKey.hash);
2809
+ this._spaces = new import_util6.ComplexMap(import_keys10.PublicKey.hash);
2827
2810
  this._isOpen = false;
2828
2811
  this._instanceId = import_keys10.PublicKey.random().toHex();
2829
2812
  }
@@ -2999,7 +2982,7 @@ var DataSpaceManager = class DataSpaceManager2 {
2999
2982
  swarmIdentity: {
3000
2983
  peerKey: this._signingContext.deviceKey,
3001
2984
  credentialProvider: createAuthProvider(this._signingContext.credentialSigner),
3002
- credentialAuthenticator: (0, import_util5.deferFunction)(() => dataSpace.authVerifier.verifier)
2985
+ credentialAuthenticator: (0, import_util6.deferFunction)(() => dataSpace.authVerifier.verifier)
3003
2986
  },
3004
2987
  onNetworkConnection: (session) => {
3005
2988
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
@@ -3092,7 +3075,7 @@ var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3092
3075
  var import_log12 = require("@dxos/log");
3093
3076
  var import_protocols7 = require("@dxos/protocols");
3094
3077
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3095
- var import_util6 = require("@dxos/util");
3078
+ var import_util7 = require("@dxos/util");
3096
3079
  var TIMEFRAME_UPDATE_DEBOUNCE_TIME = 500;
3097
3080
  var SpacesServiceImpl = class {
3098
3081
  constructor(_identityManager, _spaceManager, _dataServiceSubscriptions, _getDataSpaceManager) {
@@ -3229,7 +3212,7 @@ var SpacesServiceImpl = class {
3229
3212
  identity: {
3230
3213
  identityKey: member.key,
3231
3214
  profile: {
3232
- displayName: (_b2 = (_a2 = member.assertion.profile) == null ? void 0 : _a2.displayName) != null ? _b2 : (0, import_util6.humanize)(member.key)
3215
+ displayName: (_b2 = (_a2 = member.assertion.profile) == null ? void 0 : _a2.displayName) != null ? _b2 : (0, import_util7.humanize)(member.key)
3233
3216
  }
3234
3217
  },
3235
3218
  presence: ((_c2 = this._identityManager.identity) == null ? void 0 : _c2.identityKey.equals(member.key)) || space.presence.getPeersOnline().filter(({ identityKey }) => identityKey.equals(member.key)).length > 0 ? import_services9.SpaceMember.PresenceState.ONLINE : import_services9.SpaceMember.PresenceState.OFFLINE
@@ -3333,7 +3316,7 @@ var import_client_protocol5 = require("@dxos/client-protocol");
3333
3316
  var import_log13 = require("@dxos/log");
3334
3317
  var import_messaging = require("@dxos/messaging");
3335
3318
  var import_network_manager2 = require("@dxos/network-manager");
3336
- var import_util7 = require("@dxos/util");
3319
+ var import_util8 = require("@dxos/util");
3337
3320
 
3338
3321
  // packages/sdk/client-services/src/packlets/services/client-rpc-server.ts
3339
3322
  var import_codec_protobuf13 = require("@dxos/codec-protobuf");
@@ -3485,7 +3468,7 @@ var IFrameHostRuntime = class {
3485
3468
  callSite: (f, a) => f(...a)
3486
3469
  });
3487
3470
  try {
3488
- this._config = await (0, import_util7.getAsyncValue)(this._configProvider);
3471
+ this._config = await (0, import_util8.getAsyncValue)(this._configProvider);
3489
3472
  this._transportFactory = (0, import_network_manager2.createWebRTCTransportFactory)({
3490
3473
  iceServers: this._config.get("runtime.services.ice")
3491
3474
  });
@@ -3573,7 +3556,7 @@ var import_errors5 = require("@dxos/errors");
3573
3556
  var import_log14 = require("@dxos/log");
3574
3557
  var import_network_manager3 = require("@dxos/network-manager");
3575
3558
  var import_rpc3 = require("@dxos/rpc");
3576
- var import_util8 = require("@dxos/util");
3559
+ var import_util9 = require("@dxos/util");
3577
3560
 
3578
3561
  // packages/sdk/client-services/src/packlets/vault/vault-resource-lock.ts
3579
3562
  var import_async19 = require("@dxos/async");
@@ -3709,7 +3692,7 @@ var import_async20 = require("@dxos/async");
3709
3692
  var import_client_protocol8 = require("@dxos/client-protocol");
3710
3693
  var import_log16 = require("@dxos/log");
3711
3694
  var import_rpc4 = require("@dxos/rpc");
3712
- var import_util9 = require("@dxos/util");
3695
+ var import_util10 = require("@dxos/util");
3713
3696
  var __decorate5 = function(decorators, target, key, desc) {
3714
3697
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3715
3698
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -3723,7 +3706,7 @@ var __decorate5 = function(decorators, target, key, desc) {
3723
3706
  var WorkerSession = class {
3724
3707
  constructor({ serviceHost, systemPort, appPort, shellPort, readySignal }) {
3725
3708
  this._startTrigger = new import_async20.Trigger();
3726
- this.onClose = new import_util9.Callback();
3709
+ this.onClose = new import_util10.Callback();
3727
3710
  (0, import_node_assert12.default)(serviceHost);
3728
3711
  this._serviceHost = serviceHost;
3729
3712
  const middleware = {
@@ -4207,7 +4190,7 @@ var ClientServicesHost = class {
4207
4190
  id: traceId
4208
4191
  }), {
4209
4192
  file: "service-host.ts",
4210
- line: 186,
4193
+ line: 187,
4211
4194
  scope: this,
4212
4195
  callSite: (f, a) => f(...a)
4213
4196
  });
@@ -4220,7 +4203,7 @@ var ClientServicesHost = class {
4220
4203
  lockKey: (_a = this._resourceLock) == null ? void 0 : _a.lockKey
4221
4204
  }, {
4222
4205
  file: "service-host.ts",
4223
- line: 194,
4206
+ line: 195,
4224
4207
  scope: this,
4225
4208
  callSite: (f, a) => f(...a)
4226
4209
  });
@@ -4255,7 +4238,7 @@ var ClientServicesHost = class {
4255
4238
  deviceKey
4256
4239
  }, {
4257
4240
  file: "service-host.ts",
4258
- line: 249,
4241
+ line: 250,
4259
4242
  scope: this,
4260
4243
  callSite: (f, a) => f(...a)
4261
4244
  });
@@ -4263,7 +4246,7 @@ var ClientServicesHost = class {
4263
4246
  id: traceId
4264
4247
  }), {
4265
4248
  file: "service-host.ts",
4266
- line: 250,
4249
+ line: 251,
4267
4250
  scope: this,
4268
4251
  callSite: (f, a) => f(...a)
4269
4252
  });
@@ -4278,7 +4261,7 @@ var ClientServicesHost = class {
4278
4261
  deviceKey
4279
4262
  }, {
4280
4263
  file: "service-host.ts",
4281
- line: 259,
4264
+ line: 260,
4282
4265
  scope: this,
4283
4266
  callSite: (f, a) => f(...a)
4284
4267
  });
@@ -4293,7 +4276,7 @@ var ClientServicesHost = class {
4293
4276
  deviceKey
4294
4277
  }, {
4295
4278
  file: "service-host.ts",
4296
- line: 265,
4279
+ line: 266,
4297
4280
  scope: this,
4298
4281
  callSite: (f, a) => f(...a)
4299
4282
  });
@@ -4305,13 +4288,13 @@ var ClientServicesHost = class {
4305
4288
  id: traceId
4306
4289
  }), {
4307
4290
  file: "service-host.ts",
4308
- line: 270,
4291
+ line: 271,
4309
4292
  scope: this,
4310
4293
  callSite: (f, a) => f(...a)
4311
4294
  });
4312
4295
  (0, import_log19.log)("resetting...", {}, {
4313
4296
  file: "service-host.ts",
4314
- line: 272,
4297
+ line: 273,
4315
4298
  scope: this,
4316
4299
  callSite: (f, a) => f(...a)
4317
4300
  });
@@ -4319,7 +4302,7 @@ var ClientServicesHost = class {
4319
4302
  await this._storage.reset();
4320
4303
  (0, import_log19.log)("reset", {}, {
4321
4304
  file: "service-host.ts",
4322
- line: 275,
4305
+ line: 276,
4323
4306
  scope: this,
4324
4307
  callSite: (f, a) => f(...a)
4325
4308
  });
@@ -4327,7 +4310,7 @@ var ClientServicesHost = class {
4327
4310
  id: traceId
4328
4311
  }), {
4329
4312
  file: "service-host.ts",
4330
- line: 276,
4313
+ line: 277,
4331
4314
  scope: this,
4332
4315
  callSite: (f, a) => f(...a)
4333
4316
  });
@@ -4530,6 +4513,7 @@ var acceptInvitation = (guest, invitation) => {
4530
4513
 
4531
4514
  // packages/sdk/client-services/src/packlets/testing/test-builder.ts
4532
4515
  var import_client_protocol10 = require("@dxos/client-protocol");
4516
+ var import_context8 = require("@dxos/context");
4533
4517
  var import_credentials15 = require("@dxos/credentials");
4534
4518
  var import_echo_pipeline5 = require("@dxos/echo-pipeline");
4535
4519
  var import_testing = require("@dxos/echo-pipeline/testing");
@@ -4577,20 +4561,29 @@ var syncItemsLocal = async (db1, db2) => {
4577
4561
  var TestBuilder = class {
4578
4562
  constructor() {
4579
4563
  this.signalContext = new import_messaging4.MemorySignalManagerContext();
4564
+ this._ctx = new import_context8.Context();
4580
4565
  }
4581
- createPeer() {
4582
- return new TestPeer(this.signalContext);
4566
+ createPeer(peerOptions) {
4567
+ const peer = new TestPeer(this.signalContext, peerOptions);
4568
+ this._ctx.onDispose(async () => peer.destroy());
4569
+ return peer;
4570
+ }
4571
+ async destroy() {
4572
+ await this._ctx.dispose();
4583
4573
  }
4584
4574
  };
4585
4575
  var TestPeer = class {
4586
- constructor(signalContext) {
4576
+ constructor(signalContext, opts = {
4577
+ storageType: import_random_access_storage2.StorageType.RAM
4578
+ }) {
4587
4579
  this.signalContext = signalContext;
4580
+ this.opts = opts;
4588
4581
  this._props = {};
4589
4582
  }
4590
4583
  get storage() {
4591
4584
  var _a, _b;
4592
4585
  return (_b = (_a = this._props).storage) != null ? _b : _a.storage = (0, import_random_access_storage2.createStorage)({
4593
- type: import_random_access_storage2.StorageType.RAM
4586
+ type: this.opts.storageType
4594
4587
  });
4595
4588
  }
4596
4589
  get keyring() {
@@ -4634,6 +4627,9 @@ var TestPeer = class {
4634
4627
  snapshotStore: this.snapshotStore
4635
4628
  });
4636
4629
  }
4630
+ async destroy() {
4631
+ await this.storage.reset();
4632
+ }
4637
4633
  };
4638
4634
  var createSigningContext = async (keyring) => {
4639
4635
  const identityKey = await keyring.createKey();