@dxos/client-services 0.5.3-main.d7fe7b5 → 0.5.3-main.de55336

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 (33) hide show
  1. package/dist/lib/browser/{chunk-EHAWIIYO.mjs → chunk-7EGDXZNY.mjs} +96 -61
  2. package/dist/lib/browser/{chunk-EHAWIIYO.mjs.map → chunk-7EGDXZNY.mjs.map} +3 -3
  3. package/dist/lib/browser/index.mjs +3 -1
  4. package/dist/lib/browser/index.mjs.map +1 -1
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/packlets/testing/index.mjs +1 -1
  7. package/dist/lib/node/{chunk-SECFIF7E.cjs → chunk-YPKL5SAD.cjs} +130 -94
  8. package/dist/lib/node/chunk-YPKL5SAD.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +45 -43
  10. package/dist/lib/node/index.cjs.map +1 -1
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/packlets/testing/index.cjs +8 -8
  13. package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
  14. package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
  15. package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
  16. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  17. package/dist/types/src/packlets/invitations/invitations-handler.d.ts +1 -0
  18. package/dist/types/src/packlets/invitations/invitations-handler.d.ts.map +1 -1
  19. package/dist/types/src/packlets/services/service-host.d.ts +1 -1
  20. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  21. package/dist/types/src/packlets/services/util.d.ts.map +1 -1
  22. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  23. package/dist/types/src/packlets/spaces/data-space.d.ts +6 -1
  24. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  25. package/dist/types/src/packlets/testing/credential-utils.d.ts.map +1 -1
  26. package/dist/types/src/packlets/testing/test-builder.d.ts +2 -2
  27. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  28. package/dist/types/src/version.d.ts +1 -1
  29. package/package.json +36 -36
  30. package/src/packlets/spaces/data-space-manager.ts +35 -6
  31. package/src/packlets/spaces/data-space.ts +29 -8
  32. package/src/version.ts +1 -1
  33. package/dist/lib/node/chunk-SECFIF7E.cjs.map +0 -7
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_SECFIF7E_exports = {};
30
- __export(chunk_SECFIF7E_exports, {
29
+ var chunk_YPKL5SAD_exports = {};
30
+ __export(chunk_YPKL5SAD_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -56,6 +56,7 @@ __export(chunk_SECFIF7E_exports, {
56
56
  createDiagnostics: () => createDiagnostics,
57
57
  createLevel: () => createLevel,
58
58
  createStorageObjects: () => createStorageObjects,
59
+ findPropertiesObject: () => findPropertiesObject,
59
60
  getNetworkPeers: () => getNetworkPeers,
60
61
  isLocked: () => isLocked,
61
62
  subscribeToFeedBlocks: () => subscribeToFeedBlocks,
@@ -66,7 +67,7 @@ __export(chunk_SECFIF7E_exports, {
66
67
  subscribeToSpaces: () => subscribeToSpaces,
67
68
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
68
69
  });
69
- module.exports = __toCommonJS(chunk_SECFIF7E_exports);
70
+ module.exports = __toCommonJS(chunk_YPKL5SAD_exports);
70
71
  var import_async = require("@dxos/async");
71
72
  var import_codec_protobuf = require("@dxos/codec-protobuf");
72
73
  var import_feed_store = require("@dxos/feed-store");
@@ -182,7 +183,6 @@ var import_client_protocol4 = require("@dxos/client-protocol");
182
183
  var import_context9 = require("@dxos/context");
183
184
  var import_debug3 = require("@dxos/debug");
184
185
  var import_echo_pipeline2 = require("@dxos/echo-pipeline");
185
- var import_echo_pipeline3 = require("@dxos/echo-pipeline");
186
186
  var import_echo_schema = require("@dxos/echo-schema");
187
187
  var import_invariant11 = require("@dxos/invariant");
188
188
  var import_keys9 = require("@dxos/keys");
@@ -190,12 +190,11 @@ var import_log10 = require("@dxos/log");
190
190
  var import_protocols8 = require("@dxos/protocols");
191
191
  var import_services9 = require("@dxos/protocols/proto/dxos/client/services");
192
192
  var import_credentials11 = require("@dxos/protocols/proto/dxos/halo/credentials");
193
- var import_credentials12 = require("@dxos/protocols/proto/dxos/halo/credentials");
194
193
  var import_timeframe2 = require("@dxos/timeframe");
195
194
  var import_tracing4 = require("@dxos/tracing");
196
195
  var import_util6 = require("@dxos/util");
197
196
  var import_async12 = require("@dxos/async");
198
- var import_credentials13 = require("@dxos/credentials");
197
+ var import_credentials12 = require("@dxos/credentials");
199
198
  var import_async13 = require("@dxos/async");
200
199
  var import_context10 = require("@dxos/context");
201
200
  var import_invariant12 = require("@dxos/invariant");
@@ -206,23 +205,24 @@ var import_teleport3 = require("@dxos/teleport");
206
205
  var import_util7 = require("@dxos/util");
207
206
  var import_async14 = require("@dxos/async");
208
207
  var import_context11 = require("@dxos/context");
209
- var import_credentials14 = require("@dxos/credentials");
210
- var import_echo_pipeline4 = require("@dxos/echo-pipeline");
208
+ var import_credentials13 = require("@dxos/credentials");
209
+ var import_echo_pipeline3 = require("@dxos/echo-pipeline");
211
210
  var import_invariant13 = require("@dxos/invariant");
212
211
  var import_keys11 = require("@dxos/keys");
213
212
  var import_log12 = require("@dxos/log");
214
213
  var import_protocols10 = require("@dxos/protocols");
215
214
  var import_services10 = require("@dxos/protocols/proto/dxos/client/services");
216
- var import_credentials15 = require("@dxos/protocols/proto/dxos/halo/credentials");
215
+ var import_credentials14 = require("@dxos/protocols/proto/dxos/halo/credentials");
217
216
  var import_teleport_extension_gossip2 = require("@dxos/teleport-extension-gossip");
217
+ var import_tracing5 = require("@dxos/tracing");
218
218
  var import_util8 = require("@dxos/util");
219
- var import_credentials16 = require("@dxos/credentials");
219
+ var import_credentials15 = require("@dxos/credentials");
220
220
  var import_debug4 = require("@dxos/debug");
221
- var import_credentials17 = require("@dxos/protocols/proto/dxos/halo/credentials");
221
+ var import_credentials16 = require("@dxos/protocols/proto/dxos/halo/credentials");
222
222
  var import_timeframe3 = require("@dxos/timeframe");
223
223
  var import_async15 = require("@dxos/async");
224
224
  var import_codec_protobuf10 = require("@dxos/codec-protobuf");
225
- var import_credentials18 = require("@dxos/credentials");
225
+ var import_credentials17 = require("@dxos/credentials");
226
226
  var import_debug5 = require("@dxos/debug");
227
227
  var import_feed_store4 = require("@dxos/feed-store");
228
228
  var import_invariant14 = require("@dxos/invariant");
@@ -231,10 +231,10 @@ var import_protocols11 = require("@dxos/protocols");
231
231
  var import_services11 = require("@dxos/protocols/proto/dxos/client/services");
232
232
  var import_async16 = require("@dxos/async");
233
233
  var import_context12 = require("@dxos/context");
234
- var import_credentials19 = require("@dxos/credentials");
234
+ var import_credentials18 = require("@dxos/credentials");
235
235
  var import_debug6 = require("@dxos/debug");
236
236
  var import_echo_db = require("@dxos/echo-db");
237
- var import_echo_pipeline5 = require("@dxos/echo-pipeline");
237
+ var import_echo_pipeline4 = require("@dxos/echo-pipeline");
238
238
  var import_feed_store5 = require("@dxos/feed-store");
239
239
  var import_invariant15 = require("@dxos/invariant");
240
240
  var import_keyring = require("@dxos/keyring");
@@ -243,19 +243,19 @@ var import_log14 = require("@dxos/log");
243
243
  var import_protocols12 = require("@dxos/protocols");
244
244
  var import_services12 = require("@dxos/protocols/proto/dxos/client/services");
245
245
  var import_teleport_extension_object_sync = require("@dxos/teleport-extension-object-sync");
246
- var import_tracing5 = require("@dxos/tracing");
246
+ var import_tracing6 = require("@dxos/tracing");
247
247
  var import_util9 = require("@dxos/util");
248
248
  var import_async17 = require("@dxos/async");
249
249
  var import_codec_protobuf11 = require("@dxos/codec-protobuf");
250
- var import_credentials20 = require("@dxos/credentials");
250
+ var import_credentials19 = require("@dxos/credentials");
251
251
  var import_invariant16 = require("@dxos/invariant");
252
252
  var import_protocols13 = require("@dxos/protocols");
253
253
  var import_services13 = require("@dxos/protocols/proto/dxos/client/services");
254
- var import_tracing6 = require("@dxos/tracing");
254
+ var import_tracing7 = require("@dxos/tracing");
255
255
  var import_services14 = require("@dxos/protocols/proto/dxos/client/services");
256
256
  var import_config = require("@dxos/config");
257
257
  var import_services15 = require("@dxos/protocols/proto/dxos/client/services");
258
- var import_tracing7 = require("@dxos/tracing");
258
+ var import_tracing8 = require("@dxos/tracing");
259
259
  var import_util10 = require("@dxos/util");
260
260
  var import_async18 = require("@dxos/async");
261
261
  var import_client_protocol5 = require("@dxos/client-protocol");
@@ -269,7 +269,7 @@ var import_messaging = require("@dxos/messaging");
269
269
  var import_network_manager2 = require("@dxos/network-manager");
270
270
  var import_protocols14 = require("@dxos/protocols");
271
271
  var import_services16 = require("@dxos/protocols/proto/dxos/client/services");
272
- var import_tracing8 = require("@dxos/tracing");
272
+ var import_tracing9 = require("@dxos/tracing");
273
273
  var import_util11 = require("@dxos/util");
274
274
  var import_websocket_rpc = require("@dxos/websocket-rpc");
275
275
  var import_async19 = require("@dxos/async");
@@ -3450,7 +3450,7 @@ var AutomergeSpaceState = class {
3450
3450
  this._isProcessingRootDocs = false;
3451
3451
  }
3452
3452
  async processCredential(credential) {
3453
- if (!(0, import_credentials13.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
3453
+ if (!(0, import_credentials12.checkCredentialType)(credential, "dxos.halo.credentials.Epoch")) {
3454
3454
  return;
3455
3455
  }
3456
3456
  this.lastEpoch = credential;
@@ -3775,7 +3775,7 @@ var DataSpace = class {
3775
3775
  state: import_services9.SpaceState[this._state]
3776
3776
  }, {
3777
3777
  F: __dxlog_file13,
3778
- L: 137,
3778
+ L: 141,
3779
3779
  S: this,
3780
3780
  C: (f, a) => f(...a)
3781
3781
  });
@@ -3825,7 +3825,7 @@ var DataSpace = class {
3825
3825
  state: import_services9.SpaceState[this._state]
3826
3826
  }, {
3827
3827
  F: __dxlog_file13,
3828
- L: 195,
3828
+ L: 199,
3829
3829
  S: this,
3830
3830
  C: (f, a) => f(...a)
3831
3831
  });
@@ -3843,7 +3843,7 @@ var DataSpace = class {
3843
3843
  state: import_services9.SpaceState[this._state]
3844
3844
  }, {
3845
3845
  F: __dxlog_file13,
3846
- L: 209,
3846
+ L: 213,
3847
3847
  S: this,
3848
3848
  C: (f, a) => f(...a)
3849
3849
  });
@@ -3875,7 +3875,7 @@ var DataSpace = class {
3875
3875
  if (err instanceof import_protocols8.CancelledError || err instanceof import_context9.ContextDisposedError) {
3876
3876
  (0, import_log10.log)("data pipeline initialization cancelled", err, {
3877
3877
  F: __dxlog_file13,
3878
- L: 242,
3878
+ L: 246,
3879
3879
  S: this,
3880
3880
  C: (f, a) => f(...a)
3881
3881
  });
@@ -3883,7 +3883,7 @@ var DataSpace = class {
3883
3883
  }
3884
3884
  import_log10.log.error("Error initializing data pipeline", err, {
3885
3885
  F: __dxlog_file13,
3886
- L: 246,
3886
+ L: 250,
3887
3887
  S: this,
3888
3888
  C: (f, a) => f(...a)
3889
3889
  });
@@ -3892,7 +3892,7 @@ var DataSpace = class {
3892
3892
  state: import_services9.SpaceState[this._state]
3893
3893
  }, {
3894
3894
  F: __dxlog_file13,
3895
- L: 248,
3895
+ L: 252,
3896
3896
  S: this,
3897
3897
  C: (f, a) => f(...a)
3898
3898
  });
@@ -3912,7 +3912,7 @@ var DataSpace = class {
3912
3912
  state: import_services9.SpaceState[this._state]
3913
3913
  }, {
3914
3914
  F: __dxlog_file13,
3915
- L: 264,
3915
+ L: 268,
3916
3916
  S: this,
3917
3917
  C: (f, a) => f(...a)
3918
3918
  });
@@ -3922,7 +3922,7 @@ var DataSpace = class {
3922
3922
  await (0, import_context9.cancelWithContext)(this._ctx, this.automergeSpaceState.ensureEpochInitialized());
3923
3923
  (0, import_log10.log)("data pipeline ready", void 0, {
3924
3924
  F: __dxlog_file13,
3925
- L: 276,
3925
+ L: 280,
3926
3926
  S: this,
3927
3927
  C: (f, a) => f(...a)
3928
3928
  });
@@ -3932,7 +3932,7 @@ var DataSpace = class {
3932
3932
  state: import_services9.SpaceState[this._state]
3933
3933
  }, {
3934
3934
  F: __dxlog_file13,
3935
- L: 280,
3935
+ L: 284,
3936
3936
  S: this,
3937
3937
  C: (f, a) => f(...a)
3938
3938
  });
@@ -3948,7 +3948,7 @@ var DataSpace = class {
3948
3948
  await this._createWritableFeeds();
3949
3949
  (0, import_log10.log)("writable feeds created", void 0, {
3950
3950
  F: __dxlog_file13,
3951
- L: 296,
3951
+ L: 300,
3952
3952
  S: this,
3953
3953
  C: (f, a) => f(...a)
3954
3954
  });
@@ -3975,7 +3975,7 @@ var DataSpace = class {
3975
3975
  spaceKey: this.key,
3976
3976
  deviceKey: this._signingContext.deviceKey,
3977
3977
  identityKey: this._signingContext.identityKey,
3978
- designation: import_credentials12.AdmittedFeed.Designation.CONTROL
3978
+ designation: import_credentials11.AdmittedFeed.Designation.CONTROL
3979
3979
  }
3980
3980
  }));
3981
3981
  }
@@ -3992,7 +3992,7 @@ var DataSpace = class {
3992
3992
  spaceKey: this.key,
3993
3993
  deviceKey: this._signingContext.deviceKey,
3994
3994
  identityKey: this._signingContext.identityKey,
3995
- designation: import_credentials12.AdmittedFeed.Designation.DATA
3995
+ designation: import_credentials11.AdmittedFeed.Designation.DATA
3996
3996
  }
3997
3997
  }));
3998
3998
  }
@@ -4011,7 +4011,7 @@ var DataSpace = class {
4011
4011
  rootUrl
4012
4012
  }, {
4013
4013
  F: __dxlog_file13,
4014
- L: 362,
4014
+ L: 366,
4015
4015
  S: this,
4016
4016
  C: (f, a) => f(...a)
4017
4017
  });
@@ -4033,6 +4033,7 @@ var DataSpace = class {
4033
4033
  };
4034
4034
  });
4035
4035
  }
4036
+ await this._echoHost.openSpaceRoot(handle.url);
4036
4037
  } catch (err) {
4037
4038
  if (err instanceof import_context9.ContextDisposedError) {
4038
4039
  return;
@@ -4043,7 +4044,7 @@ var DataSpace = class {
4043
4044
  err
4044
4045
  }, {
4045
4046
  F: __dxlog_file13,
4046
- L: 387,
4047
+ L: 395,
4047
4048
  S: this,
4048
4049
  C: (f, a) => f(...a)
4049
4050
  });
@@ -4098,7 +4099,7 @@ var DataSpace = class {
4098
4099
  const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
4099
4100
  (0, import_invariant11.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4100
4101
  F: __dxlog_file13,
4101
- L: 437,
4102
+ L: 445,
4102
4103
  S: this,
4103
4104
  A: [
4104
4105
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4117,7 +4118,7 @@ var DataSpace = class {
4117
4118
  {
4118
4119
  import_log10.log.info("Fragmenting", void 0, {
4119
4120
  F: __dxlog_file13,
4120
- L: 449,
4121
+ L: 457,
4121
4122
  S: this,
4122
4123
  C: (f, a) => f(...a)
4123
4124
  });
@@ -4125,11 +4126,11 @@ var DataSpace = class {
4125
4126
  const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
4126
4127
  await (0, import_context9.cancelWithContext)(this._ctx, (0, import_async11.asyncTimeout)(rootHandle.whenReady(), 1e4));
4127
4128
  const objects = Object.entries(rootHandle.docSync().objects);
4128
- const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_schema.TYPE_PROPERTIES);
4129
+ const properties = findPropertiesObject(rootHandle.docSync());
4129
4130
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
4130
4131
  (0, import_invariant11.invariant)(properties, "Properties not found", {
4131
4132
  F: __dxlog_file13,
4132
- L: 459,
4133
+ L: 467,
4133
4134
  S: this,
4134
4135
  A: [
4135
4136
  "properties",
@@ -4145,14 +4146,14 @@ var DataSpace = class {
4145
4146
  const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
4146
4147
  (0, import_invariant11.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4147
4148
  F: __dxlog_file13,
4148
- L: 464,
4149
+ L: 472,
4149
4150
  S: this,
4150
4151
  A: [
4151
4152
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
4152
4153
  ""
4153
4154
  ]
4154
4155
  });
4155
- const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(this.key, this._echoHost.automergeRepo);
4156
+ const docLoader = new import_echo_pipeline2.AutomergeDocumentLoaderImpl(this.key, this._echoHost.automergeRepo);
4156
4157
  await docLoader.loadSpaceRootDocHandle(this._ctx, {
4157
4158
  rootUrl: newRoot.url
4158
4159
  });
@@ -4214,7 +4215,7 @@ var DataSpace = class {
4214
4215
  state: import_services9.SpaceState[this._state]
4215
4216
  }, {
4216
4217
  F: __dxlog_file13,
4217
- L: 530,
4218
+ L: 538,
4218
4219
  S: this,
4219
4220
  C: (f, a) => f(...a)
4220
4221
  });
@@ -4266,9 +4267,21 @@ DataSpace = _ts_decorate4([
4266
4267
  (0, import_async11.trackLeaks)("open", "close"),
4267
4268
  import_tracing4.trace.resource()
4268
4269
  ], DataSpace);
4270
+ var findPropertiesObject = (spaceDoc) => {
4271
+ for (const id in spaceDoc.objects ?? {}) {
4272
+ const obj = spaceDoc.objects[id];
4273
+ if (obj.system.type?.itemId === import_echo_schema.TYPE_PROPERTIES) {
4274
+ return [
4275
+ id,
4276
+ obj
4277
+ ];
4278
+ }
4279
+ }
4280
+ return void 0;
4281
+ };
4269
4282
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4270
4283
  const credentials = [
4271
- await (0, import_credentials16.createCredential)({
4284
+ await (0, import_credentials15.createCredential)({
4272
4285
  signer: keyring,
4273
4286
  issuer: space.key,
4274
4287
  subject: space.key,
@@ -4277,14 +4290,14 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4277
4290
  spaceKey: space.key
4278
4291
  }
4279
4292
  }),
4280
- await (0, import_credentials16.createCredential)({
4293
+ await (0, import_credentials15.createCredential)({
4281
4294
  signer: keyring,
4282
4295
  issuer: space.key,
4283
4296
  subject: signingContext.identityKey,
4284
4297
  assertion: {
4285
4298
  "@type": "dxos.halo.credentials.SpaceMember",
4286
4299
  spaceKey: space.key,
4287
- role: import_credentials17.SpaceMember.Role.OWNER,
4300
+ role: import_credentials16.SpaceMember.Role.OWNER,
4288
4301
  profile: signingContext.getProfile(),
4289
4302
  genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
4290
4303
  }
@@ -4296,7 +4309,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4296
4309
  spaceKey: space.key,
4297
4310
  identityKey: signingContext.identityKey,
4298
4311
  deviceKey: signingContext.deviceKey,
4299
- designation: import_credentials17.AdmittedFeed.Designation.CONTROL
4312
+ designation: import_credentials16.AdmittedFeed.Designation.CONTROL
4300
4313
  }
4301
4314
  }),
4302
4315
  await signingContext.credentialSigner.createCredential({
@@ -4306,7 +4319,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4306
4319
  spaceKey: space.key,
4307
4320
  identityKey: signingContext.identityKey,
4308
4321
  deviceKey: signingContext.deviceKey,
4309
- designation: import_credentials17.AdmittedFeed.Designation.DATA
4322
+ designation: import_credentials16.AdmittedFeed.Designation.DATA
4310
4323
  }
4311
4324
  }),
4312
4325
  await signingContext.credentialSigner.createCredential({
@@ -4360,6 +4373,28 @@ var DataSpaceManager = class {
4360
4373
  const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
4361
4374
  this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
4362
4375
  this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
4376
+ import_tracing5.trace.diagnostic({
4377
+ id: "spaces",
4378
+ name: "Spaces",
4379
+ fetch: async () => {
4380
+ return Array.from(this._spaces.values()).map((space) => {
4381
+ const rootUrl = space.automergeSpaceState.rootUrl;
4382
+ const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
4383
+ const rootDoc = rootHandle?.docSync();
4384
+ const properties = rootDoc && findPropertiesObject(rootDoc);
4385
+ return {
4386
+ key: space.key.toHex(),
4387
+ state: import_services10.SpaceState[space.state],
4388
+ name: properties?.[1].data.name ?? null,
4389
+ inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
4390
+ linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
4391
+ credentials: space.inner.spaceState.credentials.length,
4392
+ members: space.inner.spaceState.members.size,
4393
+ rootUrl
4394
+ };
4395
+ });
4396
+ }
4397
+ });
4363
4398
  }
4364
4399
  // TODO(burdon): Remove.
4365
4400
  get spaces() {
@@ -4368,7 +4403,7 @@ var DataSpaceManager = class {
4368
4403
  async open() {
4369
4404
  (0, import_log12.log)("open", void 0, {
4370
4405
  F: __dxlog_file14,
4371
- L: 115,
4406
+ L: 144,
4372
4407
  S: this,
4373
4408
  C: (f, a) => f(...a)
4374
4409
  });
@@ -4376,7 +4411,7 @@ var DataSpaceManager = class {
4376
4411
  id: this._instanceId
4377
4412
  }), {
4378
4413
  F: __dxlog_file14,
4379
- L: 116,
4414
+ L: 145,
4380
4415
  S: this,
4381
4416
  C: (f, a) => f(...a)
4382
4417
  });
@@ -4384,7 +4419,7 @@ var DataSpaceManager = class {
4384
4419
  spaces: this._metadataStore.spaces.length
4385
4420
  }, {
4386
4421
  F: __dxlog_file14,
4387
- L: 117,
4422
+ L: 146,
4388
4423
  S: this,
4389
4424
  C: (f, a) => f(...a)
4390
4425
  });
@@ -4394,7 +4429,7 @@ var DataSpaceManager = class {
4394
4429
  spaceMetadata
4395
4430
  }, {
4396
4431
  F: __dxlog_file14,
4397
- L: 121,
4432
+ L: 150,
4398
4433
  S: this,
4399
4434
  C: (f, a) => f(...a)
4400
4435
  });
@@ -4405,7 +4440,7 @@ var DataSpaceManager = class {
4405
4440
  err
4406
4441
  }, {
4407
4442
  F: __dxlog_file14,
4408
- L: 124,
4443
+ L: 153,
4409
4444
  S: this,
4410
4445
  C: (f, a) => f(...a)
4411
4446
  });
@@ -4422,7 +4457,7 @@ var DataSpaceManager = class {
4422
4457
  id: this._instanceId
4423
4458
  }), {
4424
4459
  F: __dxlog_file14,
4425
- L: 137,
4460
+ L: 166,
4426
4461
  S: this,
4427
4462
  C: (f, a) => f(...a)
4428
4463
  });
@@ -4430,7 +4465,7 @@ var DataSpaceManager = class {
4430
4465
  async close() {
4431
4466
  (0, import_log12.log)("close", void 0, {
4432
4467
  F: __dxlog_file14,
4433
- L: 142,
4468
+ L: 171,
4434
4469
  S: this,
4435
4470
  C: (f, a) => f(...a)
4436
4471
  });
@@ -4446,7 +4481,7 @@ var DataSpaceManager = class {
4446
4481
  async createSpace() {
4447
4482
  (0, import_invariant13.invariant)(this._isOpen, "Not open.", {
4448
4483
  F: __dxlog_file14,
4449
- L: 155,
4484
+ L: 184,
4450
4485
  S: this,
4451
4486
  A: [
4452
4487
  "this._isOpen",
@@ -4467,18 +4502,18 @@ var DataSpaceManager = class {
4467
4502
  spaceKey
4468
4503
  }, {
4469
4504
  F: __dxlog_file14,
4470
- L: 167,
4505
+ L: 196,
4471
4506
  S: this,
4472
4507
  C: (f, a) => f(...a)
4473
4508
  });
4474
- const automergeRootUrl = await this._echoHost.createSpaceRoot(spaceKey);
4509
+ const root = await this._echoHost.createSpaceRoot(spaceKey);
4475
4510
  const space = await this._constructSpace(metadata);
4476
- const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRootUrl);
4511
+ const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
4477
4512
  await this._metadataStore.addSpace(metadata);
4478
4513
  const memberCredential = credentials[1];
4479
- (0, import_invariant13.invariant)((0, import_credentials14.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4514
+ (0, import_invariant13.invariant)((0, import_credentials13.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4480
4515
  F: __dxlog_file14,
4481
- L: 176,
4516
+ L: 205,
4482
4517
  S: this,
4483
4518
  A: [
4484
4519
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -4496,13 +4531,13 @@ var DataSpaceManager = class {
4496
4531
  opts
4497
4532
  }, {
4498
4533
  F: __dxlog_file14,
4499
- L: 188,
4534
+ L: 217,
4500
4535
  S: this,
4501
4536
  C: (f, a) => f(...a)
4502
4537
  });
4503
4538
  (0, import_invariant13.invariant)(this._isOpen, "Not open.", {
4504
4539
  F: __dxlog_file14,
4505
- L: 189,
4540
+ L: 218,
4506
4541
  S: this,
4507
4542
  A: [
4508
4543
  "this._isOpen",
@@ -4511,7 +4546,7 @@ var DataSpaceManager = class {
4511
4546
  });
4512
4547
  (0, import_invariant13.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
4513
4548
  F: __dxlog_file14,
4514
- L: 190,
4549
+ L: 219,
4515
4550
  S: this,
4516
4551
  A: [
4517
4552
  "!this._spaces.has(opts.spaceKey)",
@@ -4546,7 +4581,7 @@ var DataSpaceManager = class {
4546
4581
  metadata
4547
4582
  }, {
4548
4583
  F: __dxlog_file14,
4549
- L: 223,
4584
+ L: 252,
4550
4585
  S: this,
4551
4586
  C: (f, a) => f(...a)
4552
4587
  });
@@ -4584,7 +4619,7 @@ var DataSpaceManager = class {
4584
4619
  onAuthFailure: () => {
4585
4620
  import_log12.log.warn("auth failure", void 0, {
4586
4621
  F: __dxlog_file14,
4587
- L: 260,
4622
+ L: 289,
4588
4623
  S: this,
4589
4624
  C: (f, a) => f(...a)
4590
4625
  });
@@ -4617,7 +4652,7 @@ var DataSpaceManager = class {
4617
4652
  space: space.key
4618
4653
  }, {
4619
4654
  F: __dxlog_file14,
4620
- L: 287,
4655
+ L: 316,
4621
4656
  S: this,
4622
4657
  C: (f, a) => f(...a)
4623
4658
  });
@@ -4628,7 +4663,7 @@ var DataSpaceManager = class {
4628
4663
  open: this._isOpen
4629
4664
  }, {
4630
4665
  F: __dxlog_file14,
4631
- L: 290,
4666
+ L: 319,
4632
4667
  S: this,
4633
4668
  C: (f, a) => f(...a)
4634
4669
  });
@@ -4647,7 +4682,7 @@ var DataSpaceManager = class {
4647
4682
  space: space.key
4648
4683
  }, {
4649
4684
  F: __dxlog_file14,
4650
- L: 298,
4685
+ L: 327,
4651
4686
  S: this,
4652
4687
  C: (f, a) => f(...a)
4653
4688
  });
@@ -4678,7 +4713,7 @@ var DataSpaceManager = class {
4678
4713
  const peers = presence.getPeersByIdentityKey(member.key);
4679
4714
  const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
4680
4715
  const sessionsToClose = sessions.filter((s) => {
4681
- return (s && member.role === import_credentials15.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline4.AuthStatus.FAILURE)) ?? false;
4716
+ return (s && member.role === import_credentials14.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
4682
4717
  });
4683
4718
  sessionsToClose.forEach((session) => {
4684
4719
  void session.close().catch(import_log12.log.error);
@@ -4691,7 +4726,7 @@ var DataSpaceManager = class {
4691
4726
  closedSessions
4692
4727
  }, {
4693
4728
  F: __dxlog_file14,
4694
- L: 338,
4729
+ L: 367,
4695
4730
  S: this,
4696
4731
  C: (f, a) => f(...a)
4697
4732
  });
@@ -4699,14 +4734,14 @@ var DataSpaceManager = class {
4699
4734
  }
4700
4735
  _handleNewPeerConnected(space, peerState) {
4701
4736
  const role = space.spaceState.getMemberRole(peerState.identityKey);
4702
- if (role === import_credentials15.SpaceMember.Role.REMOVED) {
4737
+ if (role === import_credentials14.SpaceMember.Role.REMOVED) {
4703
4738
  const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
4704
4739
  if (session != null) {
4705
4740
  (0, import_log12.log)("closing a session with a removed peer", {
4706
4741
  peerId: peerState.peerId
4707
4742
  }, {
4708
4743
  F: __dxlog_file14,
4709
- L: 352,
4744
+ L: 381,
4710
4745
  S: this,
4711
4746
  C: (f, a) => f(...a)
4712
4747
  });
@@ -4806,7 +4841,7 @@ var SpacesServiceImpl = class {
4806
4841
  role: space.spaceState.getMemberRole(identity.identityKey)
4807
4842
  });
4808
4843
  }
4809
- const credentials = await (0, import_credentials18.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
4844
+ const credentials = await (0, import_credentials17.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
4810
4845
  (0, import_invariant14.invariant)(credentials[0].credential, void 0, {
4811
4846
  F: __dxlog_file15,
4812
4847
  L: 95,
@@ -4817,7 +4852,7 @@ var SpacesServiceImpl = class {
4817
4852
  ]
4818
4853
  });
4819
4854
  const spaceMemberCredential = credentials[0].credential.credential;
4820
- (0, import_invariant14.invariant)((0, import_credentials18.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4855
+ (0, import_invariant14.invariant)((0, import_credentials17.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4821
4856
  F: __dxlog_file15,
4822
4857
  L: 97,
4823
4858
  S: this,
@@ -5034,8 +5069,8 @@ var ServiceContext = class extends import_context12.Resource {
5034
5069
  this.initialized = new import_async16.Trigger();
5035
5070
  this._handlerFactories = /* @__PURE__ */ new Map();
5036
5071
  this._instanceId = import_keys12.PublicKey.random().toHex();
5037
- this.metadataStore = new import_echo_pipeline5.MetadataStore(storage.createDirectory("metadata"));
5038
- this.snapshotStore = new import_echo_pipeline5.SnapshotStore(storage.createDirectory("snapshots"));
5072
+ this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
5073
+ this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
5039
5074
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
5040
5075
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
5041
5076
  this.feedStore = new import_feed_store5.FeedStore({
@@ -5043,12 +5078,12 @@ var ServiceContext = class extends import_context12.Resource {
5043
5078
  root: storage.createDirectory("feeds"),
5044
5079
  signer: this.keyring,
5045
5080
  hypercore: {
5046
- valueEncoding: import_echo_pipeline5.valueEncoding,
5081
+ valueEncoding: import_echo_pipeline4.valueEncoding,
5047
5082
  stats: true
5048
5083
  }
5049
5084
  })
5050
5085
  });
5051
- this.spaceManager = new import_echo_pipeline5.SpaceManager({
5086
+ this.spaceManager = new import_echo_pipeline4.SpaceManager({
5052
5087
  feedStore: this.feedStore,
5053
5088
  networkManager: this.networkManager,
5054
5089
  blobStore: this.blobStore,
@@ -5214,7 +5249,7 @@ var ServiceContext = class extends import_context12.Resource {
5214
5249
  this.initialized.wake();
5215
5250
  this._deviceSpaceSync = {
5216
5251
  processCredential: async (credential) => {
5217
- const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
5252
+ const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
5218
5253
  if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
5219
5254
  return;
5220
5255
  }
@@ -5270,14 +5305,14 @@ var ServiceContext = class extends import_context12.Resource {
5270
5305
  }
5271
5306
  };
5272
5307
  _ts_decorate6([
5273
- import_tracing5.trace.span()
5308
+ import_tracing6.trace.span()
5274
5309
  ], ServiceContext.prototype, "_open", null);
5275
5310
  _ts_decorate6([
5276
- import_tracing5.trace.span()
5311
+ import_tracing6.trace.span()
5277
5312
  ], ServiceContext.prototype, "_initialize", null);
5278
5313
  ServiceContext = _ts_decorate6([
5279
5314
  (0, import_util9.safeInstanceof)("dxos.client-services.ServiceContext"),
5280
- import_tracing5.trace.resource()
5315
+ import_tracing6.trace.resource()
5281
5316
  ], ServiceContext);
5282
5317
  var ServiceRegistry = class {
5283
5318
  // prettier-ignore
@@ -5301,7 +5336,7 @@ var ServiceRegistry = class {
5301
5336
  delete this._handlers[name];
5302
5337
  }
5303
5338
  };
5304
- var DXOS_VERSION = "0.5.3-main.d7fe7b5";
5339
+ var DXOS_VERSION = "0.5.3-main.de55336";
5305
5340
  var getPlatform = () => {
5306
5341
  if (process.browser) {
5307
5342
  if (typeof window !== "undefined") {
@@ -5341,7 +5376,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
5341
5376
  version: import_protocols13.STORAGE_VERSION
5342
5377
  }
5343
5378
  },
5344
- trace: import_tracing6.TRACE_PROCESSOR.getDiagnostics()
5379
+ trace: import_tracing7.TRACE_PROCESSOR.getDiagnostics()
5345
5380
  };
5346
5381
  await Promise.all([
5347
5382
  (async () => {
@@ -5399,7 +5434,7 @@ var getSpaceStats = async (space) => {
5399
5434
  const stats = {
5400
5435
  key: space.key,
5401
5436
  metrics: space.metrics,
5402
- epochs: space.inner.spaceState.credentials.filter((0, import_credentials20.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
5437
+ epochs: space.inner.spaceState.credentials.filter((0, import_credentials19.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
5403
5438
  ...credential.subject.assertion,
5404
5439
  id: credential.id
5405
5440
  })),
@@ -5868,7 +5903,7 @@ var ClientServicesHost = class {
5868
5903
  callbacks,
5869
5904
  runtimeParams
5870
5905
  } = {}) {
5871
- this._tracingService = import_tracing8.TRACE_PROCESSOR.createTraceSender();
5906
+ this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
5872
5907
  this._statusUpdate = new import_async18.Event();
5873
5908
  this._opening = false;
5874
5909
  this._open = false;
@@ -6230,21 +6265,21 @@ var ClientServicesHost = class {
6230
6265
  }
6231
6266
  };
6232
6267
  _ts_decorate8([
6233
- import_tracing8.trace.info()
6268
+ import_tracing9.trace.info()
6234
6269
  ], ClientServicesHost.prototype, "_opening", void 0);
6235
6270
  _ts_decorate8([
6236
- import_tracing8.trace.info()
6271
+ import_tracing9.trace.info()
6237
6272
  ], ClientServicesHost.prototype, "_open", void 0);
6238
6273
  _ts_decorate8([
6239
6274
  import_async18.synchronized,
6240
- import_tracing8.trace.span()
6275
+ import_tracing9.trace.span()
6241
6276
  ], ClientServicesHost.prototype, "open", null);
6242
6277
  _ts_decorate8([
6243
6278
  import_async18.synchronized,
6244
- import_tracing8.trace.span()
6279
+ import_tracing9.trace.span()
6245
6280
  ], ClientServicesHost.prototype, "close", null);
6246
6281
  ClientServicesHost = _ts_decorate8([
6247
- import_tracing8.trace.resource()
6282
+ import_tracing9.trace.resource()
6248
6283
  ], ClientServicesHost);
6249
6284
  var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
6250
6285
  var GET_DIAGNOSTICS_RPC_TIMEOUT = 1e4;
@@ -6260,7 +6295,7 @@ var DiagnosticsCollector = class {
6260
6295
  });
6261
6296
  const clientDiagnostics = {
6262
6297
  config,
6263
- trace: import_tracing7.TRACE_PROCESSOR.getDiagnostics()
6298
+ trace: import_tracing8.TRACE_PROCESSOR.getDiagnostics()
6264
6299
  };
6265
6300
  const diagnostics = serviceDiagnostics != null ? {
6266
6301
  client: clientDiagnostics,
@@ -6273,12 +6308,12 @@ var DiagnosticsCollector = class {
6273
6308
  }
6274
6309
  };
6275
6310
  var findSystemServiceProvider = () => {
6276
- const serviceProviders = import_tracing7.TRACE_PROCESSOR.findResourcesByAnnotation(ClientServicesProviderResource);
6311
+ const serviceProviders = import_tracing8.TRACE_PROCESSOR.findResourcesByAnnotation(ClientServicesProviderResource);
6277
6312
  const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
6278
6313
  return providerResource?.instance?.deref() ?? null;
6279
6314
  };
6280
6315
  var findConfigs = () => {
6281
- const configs = import_tracing7.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
6316
+ const configs = import_tracing8.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
6282
6317
  return configs.map((r) => r.instance.deref()).filter(import_util10.nonNullable);
6283
6318
  };
6284
6319
  // Annotate the CommonJS export names for ESM import in node:
@@ -6311,6 +6346,7 @@ var findConfigs = () => {
6311
6346
  createDiagnostics,
6312
6347
  createLevel,
6313
6348
  createStorageObjects,
6349
+ findPropertiesObject,
6314
6350
  getNetworkPeers,
6315
6351
  isLocked,
6316
6352
  subscribeToFeedBlocks,
@@ -6321,4 +6357,4 @@ var findConfigs = () => {
6321
6357
  subscribeToSpaces,
6322
6358
  subscribeToSwarmInfo
6323
6359
  });
6324
- //# sourceMappingURL=chunk-SECFIF7E.cjs.map
6360
+ //# sourceMappingURL=chunk-YPKL5SAD.cjs.map