@dxos/client-services 0.1.51-next.57ad9f3 → 0.1.51

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.
Files changed (36) hide show
  1. package/dist/lib/browser/{chunk-YPN5TDAA.mjs → chunk-2GQ7337P.mjs} +91 -44
  2. package/dist/lib/browser/chunk-2GQ7337P.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/packlets/testing/index.mjs +8 -2
  6. package/dist/lib/browser/packlets/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/index.cjs +108 -61
  8. package/dist/lib/node/index.cjs.map +3 -3
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/packlets/testing/index.cjs +132 -79
  11. package/dist/lib/node/packlets/testing/index.cjs.map +3 -3
  12. package/dist/types/src/packlets/devtools/devtools.d.ts +2 -1
  13. package/dist/types/src/packlets/devtools/devtools.d.ts.map +1 -1
  14. package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
  15. package/dist/types/src/packlets/identity/identity-manager.d.ts.map +1 -1
  16. package/dist/types/src/packlets/logging/logging-service.d.ts +1 -1
  17. package/dist/types/src/packlets/logging/logging-service.d.ts.map +1 -1
  18. package/dist/types/src/packlets/services/service-context.d.ts +5 -0
  19. package/dist/types/src/packlets/services/service-context.d.ts.map +1 -1
  20. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  21. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  22. package/dist/types/src/packlets/testing/test-builder.d.ts +3 -0
  23. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  24. package/package.json +31 -30
  25. package/src/packlets/devtools/devtools.ts +7 -0
  26. package/src/packlets/devtools/feeds.ts +1 -0
  27. package/src/packlets/identity/identity-manager.test.ts +4 -1
  28. package/src/packlets/identity/identity-manager.ts +4 -1
  29. package/src/packlets/identity/identity.test.ts +40 -21
  30. package/src/packlets/logging/logging-service.ts +58 -15
  31. package/src/packlets/services/service-context.ts +7 -0
  32. package/src/packlets/spaces/data-space-manager.ts +2 -2
  33. package/src/packlets/spaces/data-space.ts +4 -1
  34. package/src/packlets/spaces/spaces-service.ts +3 -0
  35. package/src/packlets/testing/test-builder.ts +7 -0
  36. package/dist/lib/browser/chunk-YPN5TDAA.mjs.map +0 -7
@@ -63,7 +63,7 @@ var createMockCredential = async ({ signer, issuer }) => (0, import_credentials.
63
63
  // packages/sdk/client-services/src/packlets/testing/invitation-utils.ts
64
64
  var import_node_assert13 = __toESM(require("node:assert"));
65
65
  var import_async19 = require("@dxos/async");
66
- var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
66
+ var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
67
67
 
68
68
  // packages/sdk/client-services/src/packlets/services/service-host.ts
69
69
  var import_node_assert12 = __toESM(require("node:assert"));
@@ -75,7 +75,7 @@ var import_log15 = require("@dxos/log");
75
75
  var import_messaging = require("@dxos/messaging");
76
76
  var import_network_manager2 = require("@dxos/network-manager");
77
77
  var import_protocols9 = require("@dxos/protocols");
78
- var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
78
+ var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
79
79
 
80
80
  // packages/sdk/client-services/src/packlets/devices/devices-service.ts
81
81
  var import_async = require("@dxos/async");
@@ -148,11 +148,15 @@ var subscribeToFeeds = ({ feedStore }, { feedKeys }) => {
148
148
  }
149
149
  });
150
150
  next({
151
- feeds: Array.from(feedMap.values()).map((feed) => ({
152
- feedKey: feed.key,
153
- length: feed.properties.length,
154
- bytes: feed.core.byteLength
155
- }))
151
+ feeds: Array.from(feedMap.values()).map((feed) => {
152
+ var _a, _b;
153
+ return {
154
+ feedKey: feed.key,
155
+ length: feed.properties.length,
156
+ bytes: feed.core.byteLength,
157
+ downloaded: (_b = (_a = feed.core.bitfield) == null ? void 0 : _a.data.toBuffer()) != null ? _b : new Uint8Array()
158
+ };
159
+ })
156
160
  });
157
161
  };
158
162
  subscriptions.add(feedStore.feedOpened.on(update));
@@ -351,6 +355,11 @@ var DevtoolsServiceImpl = class {
351
355
  usageQuota: (_e = navigatorInfo == null ? void 0 : navigatorInfo.quota) != null ? _e : 0
352
356
  };
353
357
  }
358
+ async getBlobs() {
359
+ return {
360
+ blobs: await this.params.context.blobStore.list()
361
+ };
362
+ }
354
363
  async getSnapshots() {
355
364
  return {
356
365
  snapshots: await this.params.context.snapshotStore.listSnapshots()
@@ -891,7 +900,8 @@ var IdentityManager = class {
891
900
  });
892
901
  (0, import_node_assert2.default)(identityRecord.haloSpace.dataFeedKey);
893
902
  const dataFeed = await this._feedStore.openFeed(identityRecord.haloSpace.dataFeedKey, {
894
- writable: true
903
+ writable: true,
904
+ sparse: true
895
905
  });
896
906
  const space = await this._constructSpace({
897
907
  spaceRecord: identityRecord.haloSpace,
@@ -914,7 +924,7 @@ var IdentityManager = class {
914
924
  identityKey: identityRecord.identityKey
915
925
  }, {
916
926
  file: "identity-manager.ts",
917
- line: 223,
927
+ line: 226,
918
928
  scope: this,
919
929
  callSite: (f, a) => f(...a)
920
930
  });
@@ -935,7 +945,7 @@ var IdentityManager = class {
935
945
  onAuthFailure: () => {
936
946
  import_log3.log.warn("auth failure", {}, {
937
947
  file: "identity-manager.ts",
938
- line: 242,
948
+ line: 245,
939
949
  scope: this,
940
950
  callSite: (f, a) => f(...a)
941
951
  });
@@ -2214,6 +2224,7 @@ __decorate([
2214
2224
  var import_async12 = require("@dxos/async");
2215
2225
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
2216
2226
  var import_log9 = require("@dxos/log");
2227
+ var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2217
2228
  var import_util3 = require("@dxos/util");
2218
2229
  var LoggingServiceImpl = class {
2219
2230
  constructor() {
@@ -2230,31 +2241,60 @@ var LoggingServiceImpl = class {
2230
2241
  import_log9.log.runtimeConfig.processors.splice(index, 1);
2231
2242
  }
2232
2243
  queryLogs(request) {
2233
- var _a;
2234
- const filters = ((_a = request.filters) == null ? void 0 : _a.length) ? request.filters : void 0;
2235
2244
  return new import_codec_protobuf10.Stream(({ ctx, next }) => {
2236
2245
  const handler = (entry2) => {
2237
- var _a2, _b, _c;
2238
- 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"))) {
2246
+ var _a, _b, _c, _d, _e;
2247
+ if (LOG_PROCESSING > 0) {
2239
2248
  return;
2240
2249
  }
2241
- if ((0, import_log9.shouldLog)(entry2, filters)) {
2242
- const record = {
2243
- ...entry2,
2244
- context: (0, import_util3.jsonify)((0, import_log9.getContextFromEntry)(entry2))
2245
- };
2246
- (_b = record.meta) == null ? true : delete _b.bugcheck;
2247
- (_c = record.meta) == null ? true : delete _c.scope;
2250
+ if (((_a = entry2.meta) == null ? void 0 : _a.file.includes("logging-service")) || entry2.context && Object.values(entry2.context).some((value) => typeof value === "string" && value.includes("LoggingService"))) {
2251
+ return;
2252
+ }
2253
+ if (!shouldLog(entry2, request)) {
2254
+ return;
2255
+ }
2256
+ const record = {
2257
+ ...entry2,
2258
+ context: (0, import_util3.jsonify)((0, import_log9.getContextFromEntry)(entry2)),
2259
+ timestamp: new Date(),
2260
+ meta: {
2261
+ // TODO(dmaretskyi): Fix proto.
2262
+ file: (_c = (_b = entry2.meta) == null ? void 0 : _b.file) != null ? _c : "",
2263
+ line: (_e = (_d = entry2.meta) == null ? void 0 : _d.line) != null ? _e : 0
2264
+ }
2265
+ };
2266
+ try {
2267
+ LOG_PROCESSING++;
2248
2268
  next(record);
2269
+ } finally {
2270
+ LOG_PROCESSING--;
2249
2271
  }
2250
2272
  };
2251
- ctx.onDispose(() => {
2252
- this._logs.off(handler);
2253
- });
2254
- this._logs.on(handler);
2273
+ this._logs.on(ctx, handler);
2255
2274
  });
2256
2275
  }
2257
2276
  };
2277
+ var matchFilter = (filter, level, path, options) => {
2278
+ switch (options) {
2279
+ case import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE:
2280
+ return level >= filter.level && (!filter.pattern || path.includes(filter.pattern));
2281
+ case import_services7.QueryLogsRequest.MatchingOptions.EXPLICIT:
2282
+ return level === filter.level && (!filter.pattern || path.includes(filter.pattern));
2283
+ }
2284
+ };
2285
+ var shouldLog = (entry2, request) => {
2286
+ var _a;
2287
+ const options = (_a = request.options) != null ? _a : import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE;
2288
+ if (request.filters === void 0) {
2289
+ return options === import_services7.QueryLogsRequest.MatchingOptions.INCLUSIVE;
2290
+ } else {
2291
+ return request.filters.some((filter) => {
2292
+ var _a2, _b;
2293
+ return matchFilter(filter, entry2.level, (_b = (_a2 = entry2.meta) == null ? void 0 : _a2.file) != null ? _b : "", options);
2294
+ });
2295
+ }
2296
+ };
2297
+ var LOG_PROCESSING = 0;
2258
2298
 
2259
2299
  // packages/sdk/client-services/src/packlets/network/network-service.ts
2260
2300
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
@@ -2296,7 +2336,7 @@ var import_credentials13 = require("@dxos/credentials");
2296
2336
  var import_keys10 = require("@dxos/keys");
2297
2337
  var import_log12 = require("@dxos/log");
2298
2338
  var import_protocols6 = require("@dxos/protocols");
2299
- var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2339
+ var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
2300
2340
  var import_teleport_extension_gossip = require("@dxos/teleport-extension-gossip");
2301
2341
  var import_util6 = require("@dxos/util");
2302
2342
 
@@ -2309,7 +2349,7 @@ var import_echo_pipeline = require("@dxos/echo-pipeline");
2309
2349
  var import_errors3 = require("@dxos/errors");
2310
2350
  var import_keys9 = require("@dxos/keys");
2311
2351
  var import_log11 = require("@dxos/log");
2312
- var import_services7 = require("@dxos/protocols/proto/dxos/client/services");
2352
+ var import_services8 = require("@dxos/protocols/proto/dxos/client/services");
2313
2353
  var import_credentials10 = require("@dxos/protocols/proto/dxos/halo/credentials");
2314
2354
  var import_timeframe = require("@dxos/timeframe");
2315
2355
  var import_util5 = require("@dxos/util");
@@ -2570,7 +2610,7 @@ var __decorate2 = function(decorators, target, key, desc) {
2570
2610
  var DataSpace = class DataSpace2 {
2571
2611
  constructor(params) {
2572
2612
  this._ctx = new import_context6.Context();
2573
- this._state = import_services7.SpaceState.CLOSED;
2613
+ this._state = import_services8.SpaceState.CLOSED;
2574
2614
  /**
2575
2615
  * Error for _state === SpaceState.ERROR.
2576
2616
  */
@@ -2624,11 +2664,11 @@ var DataSpace = class DataSpace2 {
2624
2664
  await this.notarizationPlugin.open();
2625
2665
  await this._notarizationPluginConsumer.open();
2626
2666
  await this._inner.open();
2627
- this._state = import_services7.SpaceState.INACTIVE;
2667
+ this._state = import_services8.SpaceState.INACTIVE;
2628
2668
  this.metrics.open = new Date();
2629
2669
  }
2630
2670
  async close() {
2631
- this._state = import_services7.SpaceState.CLOSED;
2671
+ this._state = import_services8.SpaceState.CLOSED;
2632
2672
  await this._ctx.dispose();
2633
2673
  await this.authVerifier.close();
2634
2674
  await this._inner.close();
@@ -2666,7 +2706,7 @@ var DataSpace = class DataSpace2 {
2666
2706
  scope: this,
2667
2707
  callSite: (f, a) => f(...a)
2668
2708
  });
2669
- this._state = import_services7.SpaceState.ERROR;
2709
+ this._state = import_services8.SpaceState.ERROR;
2670
2710
  this.error = err;
2671
2711
  this.stateUpdate.emit();
2672
2712
  } finally {
@@ -2676,10 +2716,10 @@ var DataSpace = class DataSpace2 {
2676
2716
  }
2677
2717
  async initializeDataPipeline() {
2678
2718
  var _a, _b, _c, _d;
2679
- if (this._state !== import_services7.SpaceState.INACTIVE) {
2719
+ if (this._state !== import_services8.SpaceState.INACTIVE) {
2680
2720
  throw new import_errors3.SystemError("Invalid operation");
2681
2721
  }
2682
- this._state = import_services7.SpaceState.INITIALIZING;
2722
+ this._state = import_services8.SpaceState.INITIALIZING;
2683
2723
  await this._inner.controlPipeline.state.waitUntilReachedTargetTimeframe({
2684
2724
  ctx: this._ctx,
2685
2725
  breakOnStall: false
@@ -2719,7 +2759,7 @@ var DataSpace = class DataSpace2 {
2719
2759
  callSite: (f, a) => f(...a)
2720
2760
  });
2721
2761
  await ((_b = (_a = this._callbacks).beforeReady) == null ? void 0 : _b.call(_a));
2722
- this._state = import_services7.SpaceState.READY;
2762
+ this._state = import_services8.SpaceState.READY;
2723
2763
  this.stateUpdate.emit();
2724
2764
  await ((_d = (_c = this._callbacks).afterReady) == null ? void 0 : _d.call(_c));
2725
2765
  }
@@ -2743,7 +2783,8 @@ var DataSpace = class DataSpace2 {
2743
2783
  }
2744
2784
  if (!this.inner.dataFeedKey) {
2745
2785
  const dataFeed = await this._feedStore.openFeed(await this._keyring.createKey(), {
2746
- writable: true
2786
+ writable: true,
2787
+ sparse: true
2747
2788
  });
2748
2789
  this.inner.setDataFeed(dataFeed);
2749
2790
  credentials.push(await this._signingContext.credentialSigner.createCredential({
@@ -3036,7 +3077,7 @@ var DataSpaceManager = class DataSpaceManager2 {
3036
3077
  async waitUntilSpaceReady(spaceKey) {
3037
3078
  await (0, import_context7.cancelWithContext)(this._ctx, this.updated.waitForCondition(() => {
3038
3079
  const space = this._spaces.get(spaceKey);
3039
- return !!space && space.state === import_services8.SpaceState.READY;
3080
+ return !!space && space.state === import_services9.SpaceState.READY;
3040
3081
  }));
3041
3082
  }
3042
3083
  async _constructSpace(metadata) {
@@ -3061,7 +3102,8 @@ var DataSpaceManager = class DataSpaceManager2 {
3061
3102
  writable: true
3062
3103
  });
3063
3104
  const dataFeed = metadata.dataFeedKey && await this._feedStore.openFeed(metadata.dataFeedKey, {
3064
- writable: true
3105
+ writable: true,
3106
+ sparse: true
3065
3107
  });
3066
3108
  const space = await this._spaceManager.constructSpace({
3067
3109
  metadata,
@@ -3074,7 +3116,6 @@ var DataSpaceManager = class DataSpaceManager2 {
3074
3116
  session.addExtension("dxos.mesh.teleport.gossip", gossip.createExtension({
3075
3117
  remotePeerId: session.remotePeerId
3076
3118
  }));
3077
- session.addExtension("dxos.mesh.teleport.objectsync", space.snapshotManager.objectSync.createExtension());
3078
3119
  session.addExtension("dxos.mesh.teleport.notarization", dataSpace.notarizationPlugin.createExtension());
3079
3120
  },
3080
3121
  onAuthFailure: () => {
@@ -3160,7 +3201,7 @@ var import_debug5 = require("@dxos/debug");
3160
3201
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
3161
3202
  var import_log13 = require("@dxos/log");
3162
3203
  var import_protocols7 = require("@dxos/protocols");
3163
- var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
3204
+ var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
3164
3205
  var import_util7 = require("@dxos/util");
3165
3206
  var TIMEFRAME_UPDATE_DEBOUNCE_TIME = 500;
3166
3207
  var SpacesServiceImpl = class {
@@ -3207,6 +3248,7 @@ var SpacesServiceImpl = class {
3207
3248
  for (const space of dataSpaceManager.spaces.values()) {
3208
3249
  subscriptions.add(space.stateUpdate.on(ctx, onUpdate));
3209
3250
  subscriptions.add(space.presence.updated.on(ctx, onUpdate));
3251
+ subscriptions.add(space.dataPipeline.onNewEpoch.on(ctx, onUpdate));
3210
3252
  space.inner.controlPipeline.state.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate);
3211
3253
  if (space.dataPipeline.pipelineState) {
3212
3254
  subscriptions.add(space.dataPipeline.pipelineState.timeframeUpdate.debounce(TIMEFRAME_UPDATE_DEBOUNCE_TIME).on(ctx, onUpdate));
@@ -3277,21 +3319,23 @@ var SpacesServiceImpl = class {
3277
3319
  await space.createEpoch();
3278
3320
  }
3279
3321
  _transformSpace(space) {
3280
- var _a, _b, _c, _d, _e, _f;
3322
+ var _a, _b, _c, _d, _e, _f, _g;
3281
3323
  return {
3282
3324
  spaceKey: space.key,
3283
3325
  state: space.state,
3284
3326
  error: space.error ? (0, import_protocols7.encodeError)(space.error) : void 0,
3285
3327
  pipeline: {
3286
3328
  currentEpoch: space.dataPipeline.currentEpoch,
3329
+ appliedEpoch: space.dataPipeline.appliedEpoch,
3287
3330
  controlFeeds: space.inner.controlPipeline.state.feeds.map((feed) => feed.key),
3288
3331
  currentControlTimeframe: space.inner.controlPipeline.state.timeframe,
3289
3332
  targetControlTimeframe: space.inner.controlPipeline.state.targetTimeframe,
3290
3333
  totalControlTimeframe: space.inner.controlPipeline.state.endTimeframe,
3291
3334
  dataFeeds: (_b = (_a = space.dataPipeline.pipelineState) == null ? void 0 : _a.feeds.map((feed) => feed.key)) != null ? _b : [],
3292
- currentDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.timeframe,
3293
- targetDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.targetTimeframe,
3294
- totalDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.endTimeframe
3335
+ startDataTimeframe: (_c = space.dataPipeline.pipelineState) == null ? void 0 : _c.startTimeframe,
3336
+ currentDataTimeframe: (_d = space.dataPipeline.pipelineState) == null ? void 0 : _d.timeframe,
3337
+ targetDataTimeframe: (_e = space.dataPipeline.pipelineState) == null ? void 0 : _e.targetTimeframe,
3338
+ totalDataTimeframe: (_f = space.dataPipeline.pipelineState) == null ? void 0 : _f.endTimeframe
3295
3339
  },
3296
3340
  members: Array.from(space.inner.spaceState.members.values()).map((member) => {
3297
3341
  var _a2, _b2, _c2;
@@ -3302,10 +3346,10 @@ var SpacesServiceImpl = class {
3302
3346
  displayName: (_b2 = (_a2 = member.assertion.profile) == null ? void 0 : _a2.displayName) != null ? _b2 : (0, import_util7.humanize)(member.key)
3303
3347
  }
3304
3348
  },
3305
- 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
3349
+ 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_services10.SpaceMember.PresenceState.ONLINE : import_services10.SpaceMember.PresenceState.OFFLINE
3306
3350
  };
3307
3351
  }),
3308
- creator: (_f = space.inner.spaceState.creator) == null ? void 0 : _f.key,
3352
+ creator: (_g = space.inner.spaceState.creator) == null ? void 0 : _g.key,
3309
3353
  cache: space.cache,
3310
3354
  metrics: space.metrics
3311
3355
  };
@@ -3411,7 +3455,8 @@ var import_keyring = require("@dxos/keyring");
3411
3455
  var import_keys11 = require("@dxos/keys");
3412
3456
  var import_log14 = require("@dxos/log");
3413
3457
  var import_protocols8 = require("@dxos/protocols");
3414
- var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
3458
+ var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
3459
+ var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
3415
3460
  var ServiceContext = class {
3416
3461
  // prettier-ignore
3417
3462
  constructor(storage, networkManager, signalManager, modelFactory) {
@@ -3425,6 +3470,7 @@ var ServiceContext = class {
3425
3470
  this._instanceId = import_keys11.PublicKey.random().toHex();
3426
3471
  this.metadataStore = new import_echo_pipeline3.MetadataStore(storage.createDirectory("metadata"));
3427
3472
  this.snapshotStore = new import_echo_pipeline3.SnapshotStore(storage.createDirectory("snapshots"));
3473
+ this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
3428
3474
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
3429
3475
  this.feedStore = new import_feed_store4.FeedStore({
3430
3476
  factory: new import_feed_store4.FeedFactory({
@@ -3438,13 +3484,14 @@ var ServiceContext = class {
3438
3484
  this.spaceManager = new import_echo_pipeline3.SpaceManager({
3439
3485
  feedStore: this.feedStore,
3440
3486
  networkManager: this.networkManager,
3487
+ blobStore: this.blobStore,
3441
3488
  metadataStore: this.metadataStore,
3442
3489
  modelFactory: this.modelFactory,
3443
3490
  snapshotStore: this.snapshotStore
3444
3491
  });
3445
3492
  this.identityManager = new IdentityManager(this.metadataStore, this.keyring, this.feedStore, this.spaceManager);
3446
3493
  this.invitations = new InvitationsHandler(this.networkManager);
3447
- this._handlerFactories.set(import_services10.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3494
+ this._handlerFactories.set(import_services11.Invitation.Kind.DEVICE, () => new DeviceInvitationProtocol(this.keyring, () => {
3448
3495
  var _a;
3449
3496
  return (_a = this.identityManager.identity) != null ? _a : (0, import_debug6.failUndefined)();
3450
3497
  }, this._acceptIdentity.bind(this)));
@@ -3454,14 +3501,14 @@ var ServiceContext = class {
3454
3501
  id: this._instanceId
3455
3502
  }), {
3456
3503
  file: "service-context.ts",
3457
- line: 119,
3504
+ line: 126,
3458
3505
  scope: this,
3459
3506
  callSite: (f, a) => f(...a)
3460
3507
  });
3461
3508
  await this._checkStorageVersion();
3462
3509
  (0, import_log14.log)("opening...", {}, {
3463
3510
  file: "service-context.ts",
3464
- line: 123,
3511
+ line: 130,
3465
3512
  scope: this,
3466
3513
  callSite: (f, a) => f(...a)
3467
3514
  });
@@ -3474,7 +3521,7 @@ var ServiceContext = class {
3474
3521
  }
3475
3522
  (0, import_log14.log)("opened", {}, {
3476
3523
  file: "service-context.ts",
3477
- line: 131,
3524
+ line: 138,
3478
3525
  scope: this,
3479
3526
  callSite: (f, a) => f(...a)
3480
3527
  });
@@ -3482,7 +3529,7 @@ var ServiceContext = class {
3482
3529
  id: this._instanceId
3483
3530
  }), {
3484
3531
  file: "service-context.ts",
3485
- line: 132,
3532
+ line: 139,
3486
3533
  scope: this,
3487
3534
  callSite: (f, a) => f(...a)
3488
3535
  });
@@ -3491,7 +3538,7 @@ var ServiceContext = class {
3491
3538
  var _a, _b;
3492
3539
  (0, import_log14.log)("closing...", {}, {
3493
3540
  file: "service-context.ts",
3494
- line: 136,
3541
+ line: 143,
3495
3542
  scope: this,
3496
3543
  callSite: (f, a) => f(...a)
3497
3544
  });
@@ -3505,7 +3552,7 @@ var ServiceContext = class {
3505
3552
  this.dataServiceSubscriptions.clear();
3506
3553
  (0, import_log14.log)("closed", {}, {
3507
3554
  file: "service-context.ts",
3508
- line: 145,
3555
+ line: 152,
3509
3556
  scope: this,
3510
3557
  callSite: (f, a) => f(...a)
3511
3558
  });
@@ -3536,7 +3583,7 @@ var ServiceContext = class {
3536
3583
  var _a;
3537
3584
  (0, import_log14.log)("initializing spaces...", {}, {
3538
3585
  file: "service-context.ts",
3539
- line: 178,
3586
+ line: 185,
3540
3587
  scope: this,
3541
3588
  callSite: (f, a) => f(...a)
3542
3589
  });
@@ -3556,7 +3603,7 @@ var ServiceContext = class {
3556
3603
  };
3557
3604
  this.dataSpaceManager = new DataSpaceManager(this.spaceManager, this.metadataStore, this.dataServiceSubscriptions, this.keyring, signingContext, this.feedStore);
3558
3605
  await this.dataSpaceManager.open();
3559
- this._handlerFactories.set(import_services10.Invitation.Kind.SPACE, (invitation) => {
3606
+ this._handlerFactories.set(import_services11.Invitation.Kind.SPACE, (invitation) => {
3560
3607
  (0, import_node_assert11.default)(this.dataSpaceManager, "dataSpaceManager not initialized yet");
3561
3608
  return new SpaceInvitationProtocol(this.dataSpaceManager, signingContext, this.keyring, invitation.spaceKey);
3562
3609
  });
@@ -3575,7 +3622,7 @@ var ServiceContext = class {
3575
3622
  details: assertion
3576
3623
  }, {
3577
3624
  file: "service-context.ts",
3578
- line: 217,
3625
+ line: 224,
3579
3626
  scope: this,
3580
3627
  callSite: (f, a) => f(...a)
3581
3628
  });
@@ -3586,7 +3633,7 @@ var ServiceContext = class {
3586
3633
  details: assertion
3587
3634
  }, {
3588
3635
  file: "service-context.ts",
3589
- line: 221,
3636
+ line: 228,
3590
3637
  scope: this,
3591
3638
  callSite: (f, a) => f(...a)
3592
3639
  });
@@ -3597,7 +3644,7 @@ var ServiceContext = class {
3597
3644
  details: assertion
3598
3645
  }, {
3599
3646
  file: "service-context.ts",
3600
- line: 226,
3647
+ line: 233,
3601
3648
  scope: this,
3602
3649
  callSite: (f, a) => f(...a)
3603
3650
  });
@@ -3608,7 +3655,7 @@ var ServiceContext = class {
3608
3655
  } catch (err) {
3609
3656
  import_log14.log.catch(err, {}, {
3610
3657
  file: "service-context.ts",
3611
- line: 232,
3658
+ line: 239,
3612
3659
  scope: this,
3613
3660
  callSite: (f, a) => f(...a)
3614
3661
  });
@@ -3682,12 +3729,12 @@ var ClientServicesHost = class {
3682
3729
  this._systemService = new SystemServiceImpl({
3683
3730
  config: this._config,
3684
3731
  statusUpdate: this._statusUpdate,
3685
- getCurrentStatus: () => this.isOpen ? import_services11.SystemStatus.ACTIVE : import_services11.SystemStatus.INACTIVE,
3732
+ getCurrentStatus: () => this.isOpen ? import_services12.SystemStatus.ACTIVE : import_services12.SystemStatus.INACTIVE,
3686
3733
  onUpdateStatus: async (status) => {
3687
3734
  var _a, _b;
3688
- if (!this.isOpen && status === import_services11.SystemStatus.ACTIVE) {
3735
+ if (!this.isOpen && status === import_services12.SystemStatus.ACTIVE) {
3689
3736
  await ((_a = this._resourceLock) == null ? void 0 : _a.acquire());
3690
- } else if (this.isOpen && status === import_services11.SystemStatus.INACTIVE) {
3737
+ } else if (this.isOpen && status === import_services12.SystemStatus.INACTIVE) {
3691
3738
  await ((_b = this._resourceLock) == null ? void 0 : _b.release());
3692
3739
  }
3693
3740
  },
@@ -3895,7 +3942,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3895
3942
  hostObservable.subscribe(async (hostInvitation) => {
3896
3943
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
3897
3944
  switch (hostInvitation.state) {
3898
- case import_services12.Invitation.State.CONNECTING: {
3945
+ case import_services13.Invitation.State.CONNECTING: {
3899
3946
  if ((_b = (_a = hooks == null ? void 0 : hooks.host) == null ? void 0 : _a.onConnecting) == null ? void 0 : _b.call(_a, hostObservable)) {
3900
3947
  break;
3901
3948
  }
@@ -3903,29 +3950,29 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3903
3950
  guestObservable.subscribe(async (guestInvitation) => {
3904
3951
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
3905
3952
  switch (guestInvitation.state) {
3906
- case import_services12.Invitation.State.CONNECTING: {
3953
+ case import_services13.Invitation.State.CONNECTING: {
3907
3954
  if ((_b2 = (_a2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _a2.onConnecting) == null ? void 0 : _b2.call(_a2, guestObservable)) {
3908
3955
  break;
3909
3956
  }
3910
3957
  (0, import_node_assert13.default)(hostInvitation.swarmKey.equals(guestInvitation.swarmKey));
3911
3958
  break;
3912
3959
  }
3913
- case import_services12.Invitation.State.CONNECTED: {
3960
+ case import_services13.Invitation.State.CONNECTED: {
3914
3961
  (_d2 = (_c2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _c2.onConnected) == null ? void 0 : _d2.call(_c2, guestObservable);
3915
3962
  break;
3916
3963
  }
3917
- case import_services12.Invitation.State.READY_FOR_AUTHENTICATION: {
3964
+ case import_services13.Invitation.State.READY_FOR_AUTHENTICATION: {
3918
3965
  if ((_f2 = (_e2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _e2.onReady) == null ? void 0 : _f2.call(_e2, guestObservable)) {
3919
3966
  break;
3920
3967
  }
3921
3968
  await guestObservable.authenticate(await authCode.wait());
3922
3969
  break;
3923
3970
  }
3924
- case import_services12.Invitation.State.AUTHENTICATING: {
3971
+ case import_services13.Invitation.State.AUTHENTICATING: {
3925
3972
  (_h2 = (_g2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _g2.onAuthenticating) == null ? void 0 : _h2.call(_g2, guestObservable);
3926
3973
  break;
3927
3974
  }
3928
- case import_services12.Invitation.State.SUCCESS: {
3975
+ case import_services13.Invitation.State.SUCCESS: {
3929
3976
  if ((_j2 = (_i2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _i2.onSuccess) == null ? void 0 : _j2.call(_i2, guestObservable)) {
3930
3977
  break;
3931
3978
  }
@@ -3934,7 +3981,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3934
3981
  });
3935
3982
  break;
3936
3983
  }
3937
- case import_services12.Invitation.State.CANCELLED: {
3984
+ case import_services13.Invitation.State.CANCELLED: {
3938
3985
  if ((_l2 = (_k2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _k2.onCancelled) == null ? void 0 : _l2.call(_k2, guestObservable)) {
3939
3986
  break;
3940
3987
  }
@@ -3943,7 +3990,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3943
3990
  });
3944
3991
  break;
3945
3992
  }
3946
- case import_services12.Invitation.State.TIMEOUT: {
3993
+ case import_services13.Invitation.State.TIMEOUT: {
3947
3994
  if ((_n2 = (_m2 = hooks == null ? void 0 : hooks.guest) == null ? void 0 : _m2.onTimeout) == null ? void 0 : _n2.call(_m2, guestObservable)) {
3948
3995
  return;
3949
3996
  }
@@ -3963,11 +4010,11 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3963
4010
  });
3964
4011
  break;
3965
4012
  }
3966
- case import_services12.Invitation.State.CONNECTED: {
4013
+ case import_services13.Invitation.State.CONNECTED: {
3967
4014
  (_d = (_c = hooks == null ? void 0 : hooks.host) == null ? void 0 : _c.onConnected) == null ? void 0 : _d.call(_c, hostObservable);
3968
4015
  break;
3969
4016
  }
3970
- case import_services12.Invitation.State.READY_FOR_AUTHENTICATION: {
4017
+ case import_services13.Invitation.State.READY_FOR_AUTHENTICATION: {
3971
4018
  if ((_f = (_e = hooks == null ? void 0 : hooks.host) == null ? void 0 : _e.onReady) == null ? void 0 : _f.call(_e, hostObservable)) {
3972
4019
  break;
3973
4020
  }
@@ -3976,11 +4023,11 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3976
4023
  }
3977
4024
  break;
3978
4025
  }
3979
- case import_services12.Invitation.State.AUTHENTICATING: {
4026
+ case import_services13.Invitation.State.AUTHENTICATING: {
3980
4027
  (_h = (_g = hooks == null ? void 0 : hooks.host) == null ? void 0 : _g.onAuthenticating) == null ? void 0 : _h.call(_g, hostObservable);
3981
4028
  break;
3982
4029
  }
3983
- case import_services12.Invitation.State.SUCCESS: {
4030
+ case import_services13.Invitation.State.SUCCESS: {
3984
4031
  if ((_j = (_i = hooks == null ? void 0 : hooks.host) == null ? void 0 : _i.onSuccess) == null ? void 0 : _j.call(_i, hostObservable)) {
3985
4032
  break;
3986
4033
  }
@@ -3989,7 +4036,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3989
4036
  });
3990
4037
  break;
3991
4038
  }
3992
- case import_services12.Invitation.State.CANCELLED: {
4039
+ case import_services13.Invitation.State.CANCELLED: {
3993
4040
  if ((_l = (_k = hooks == null ? void 0 : hooks.host) == null ? void 0 : _k.onCancelled) == null ? void 0 : _l.call(_k, hostObservable)) {
3994
4041
  break;
3995
4042
  }
@@ -3998,7 +4045,7 @@ var performInvitation = ({ host, guest, options, hooks }) => {
3998
4045
  });
3999
4046
  break;
4000
4047
  }
4001
- case import_services12.Invitation.State.TIMEOUT: {
4048
+ case import_services13.Invitation.State.TIMEOUT: {
4002
4049
  if ((_n = (_m = hooks == null ? void 0 : hooks.host) == null ? void 0 : _m.onTimeout) == null ? void 0 : _n.call(_m, hostObservable)) {
4003
4050
  break;
4004
4051
  }
@@ -4024,12 +4071,12 @@ var performInvitation = ({ host, guest, options, hooks }) => {
4024
4071
  };
4025
4072
  var createInvitation = (host, options) => {
4026
4073
  options != null ? options : options = {
4027
- authMethod: import_services12.Invitation.AuthMethod.NONE,
4074
+ authMethod: import_services13.Invitation.AuthMethod.NONE,
4028
4075
  ...options != null ? options : {}
4029
4076
  };
4030
4077
  if (host instanceof ServiceContext) {
4031
4078
  const hostHandler = host.getInvitationHandler({
4032
- kind: import_services12.Invitation.Kind.SPACE,
4079
+ kind: import_services13.Invitation.Kind.SPACE,
4033
4080
  ...options
4034
4081
  });
4035
4082
  return host.invitations.createInvitation(hostHandler, options);
@@ -4058,6 +4105,7 @@ var import_keyring2 = require("@dxos/keyring");
4058
4105
  var import_messaging2 = require("@dxos/messaging");
4059
4106
  var import_network_manager3 = require("@dxos/network-manager");
4060
4107
  var import_random_access_storage2 = require("@dxos/random-access-storage");
4108
+ var import_teleport_extension_object_sync2 = require("@dxos/teleport-extension-object-sync");
4061
4109
  var createServiceHost = (config, signalManagerContext) => {
4062
4110
  return new ClientServicesHost({
4063
4111
  config,
@@ -4142,6 +4190,10 @@ var TestPeer = class {
4142
4190
  var _a, _b;
4143
4191
  return (_b = (_a = this._props).metadataStore) != null ? _b : _a.metadataStore = new import_echo_pipeline5.MetadataStore(this.storage.createDirectory("metadata"));
4144
4192
  }
4193
+ get blobStore() {
4194
+ var _a, _b;
4195
+ return (_b = (_a = this._props).blobStore) != null ? _b : _a.blobStore = new import_teleport_extension_object_sync2.BlobStore(this.storage.createDirectory("blobs"));
4196
+ }
4145
4197
  get snapshotStore() {
4146
4198
  var _a, _b;
4147
4199
  return (_b = (_a = this._props).snapshotStore) != null ? _b : _a.snapshotStore = new import_echo_pipeline5.SnapshotStore(this.storage.createDirectory("snapshots"));
@@ -4160,7 +4212,8 @@ var TestPeer = class {
4160
4212
  networkManager: this.networkManager,
4161
4213
  metadataStore: this.metadataStore,
4162
4214
  modelFactory: (0, import_client_protocol6.createDefaultModelFactory)(),
4163
- snapshotStore: this.snapshotStore
4215
+ snapshotStore: this.snapshotStore,
4216
+ blobStore: this.blobStore
4164
4217
  });
4165
4218
  }
4166
4219
  async destroy() {