@dxos/client-services 0.5.3-next.2c59258 → 0.5.3-next.63cdcad

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-R3VORRTJ.mjs → chunk-3GU2GXU2.mjs} +108 -61
  2. package/dist/lib/browser/{chunk-R3VORRTJ.mjs.map → chunk-3GU2GXU2.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-VOYHS6QR.cjs → chunk-PCHM5MI3.cjs} +142 -94
  8. package/dist/lib/node/chunk-PCHM5MI3.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 +33 -8
  32. package/src/version.ts +1 -1
  33. package/dist/lib/node/chunk-VOYHS6QR.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_VOYHS6QR_exports = {};
30
- __export(chunk_VOYHS6QR_exports, {
29
+ var chunk_PCHM5MI3_exports = {};
30
+ __export(chunk_PCHM5MI3_exports, {
31
31
  ClientRpcServer: () => ClientRpcServer,
32
32
  ClientServicesHost: () => ClientServicesHost,
33
33
  ClientServicesProviderResource: () => ClientServicesProviderResource,
@@ -56,6 +56,7 @@ __export(chunk_VOYHS6QR_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_VOYHS6QR_exports, {
66
67
  subscribeToSpaces: () => subscribeToSpaces,
67
68
  subscribeToSwarmInfo: () => subscribeToSwarmInfo
68
69
  });
69
- module.exports = __toCommonJS(chunk_VOYHS6QR_exports);
70
+ module.exports = __toCommonJS(chunk_PCHM5MI3_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,19 @@ var DataSpace = class {
4033
4033
  };
4034
4034
  });
4035
4035
  }
4036
+ if (!this._echoHost.roots.has(handle.documentId)) {
4037
+ await this._echoHost.openSpaceRoot(handle.url);
4038
+ } else {
4039
+ import_log10.log.warn("echo database root already exists", {
4040
+ space: this.key,
4041
+ rootUrl
4042
+ }, {
4043
+ F: __dxlog_file13,
4044
+ L: 393,
4045
+ S: this,
4046
+ C: (f, a) => f(...a)
4047
+ });
4048
+ }
4036
4049
  } catch (err) {
4037
4050
  if (err instanceof import_context9.ContextDisposedError) {
4038
4051
  return;
@@ -4043,7 +4056,7 @@ var DataSpace = class {
4043
4056
  err
4044
4057
  }, {
4045
4058
  F: __dxlog_file13,
4046
- L: 387,
4059
+ L: 399,
4047
4060
  S: this,
4048
4061
  C: (f, a) => f(...a)
4049
4062
  });
@@ -4098,7 +4111,7 @@ var DataSpace = class {
4098
4111
  const newRoot = this._echoHost.automergeRepo.create(rootHandle.docSync());
4099
4112
  (0, import_invariant11.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4100
4113
  F: __dxlog_file13,
4101
- L: 437,
4114
+ L: 449,
4102
4115
  S: this,
4103
4116
  A: [
4104
4117
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
@@ -4117,7 +4130,7 @@ var DataSpace = class {
4117
4130
  {
4118
4131
  import_log10.log.info("Fragmenting", void 0, {
4119
4132
  F: __dxlog_file13,
4120
- L: 449,
4133
+ L: 461,
4121
4134
  S: this,
4122
4135
  C: (f, a) => f(...a)
4123
4136
  });
@@ -4125,11 +4138,11 @@ var DataSpace = class {
4125
4138
  const rootHandle = this._echoHost.automergeRepo.find(currentRootUrl);
4126
4139
  await (0, import_context9.cancelWithContext)(this._ctx, (0, import_async11.asyncTimeout)(rootHandle.whenReady(), 1e4));
4127
4140
  const objects = Object.entries(rootHandle.docSync().objects);
4128
- const properties = objects.find(([_, value]) => value.system.type?.itemId === import_echo_schema.TYPE_PROPERTIES);
4141
+ const properties = findPropertiesObject(rootHandle.docSync());
4129
4142
  const otherObjects = objects.filter(([key]) => key !== properties?.[0]);
4130
4143
  (0, import_invariant11.invariant)(properties, "Properties not found", {
4131
4144
  F: __dxlog_file13,
4132
- L: 459,
4145
+ L: 471,
4133
4146
  S: this,
4134
4147
  A: [
4135
4148
  "properties",
@@ -4145,14 +4158,14 @@ var DataSpace = class {
4145
4158
  const newRoot = this._echoHost.automergeRepo.create(newSpaceDoc);
4146
4159
  (0, import_invariant11.invariant)(typeof newRoot.url === "string" && newRoot.url.length > 0, void 0, {
4147
4160
  F: __dxlog_file13,
4148
- L: 464,
4161
+ L: 476,
4149
4162
  S: this,
4150
4163
  A: [
4151
4164
  "typeof newRoot.url === 'string' && newRoot.url.length > 0",
4152
4165
  ""
4153
4166
  ]
4154
4167
  });
4155
- const docLoader = new import_echo_pipeline3.AutomergeDocumentLoaderImpl(this.key, this._echoHost.automergeRepo);
4168
+ const docLoader = new import_echo_pipeline2.AutomergeDocumentLoaderImpl(this.key, this._echoHost.automergeRepo);
4156
4169
  await docLoader.loadSpaceRootDocHandle(this._ctx, {
4157
4170
  rootUrl: newRoot.url
4158
4171
  });
@@ -4214,7 +4227,7 @@ var DataSpace = class {
4214
4227
  state: import_services9.SpaceState[this._state]
4215
4228
  }, {
4216
4229
  F: __dxlog_file13,
4217
- L: 530,
4230
+ L: 542,
4218
4231
  S: this,
4219
4232
  C: (f, a) => f(...a)
4220
4233
  });
@@ -4266,9 +4279,21 @@ DataSpace = _ts_decorate4([
4266
4279
  (0, import_async11.trackLeaks)("open", "close"),
4267
4280
  import_tracing4.trace.resource()
4268
4281
  ], DataSpace);
4282
+ var findPropertiesObject = (spaceDoc) => {
4283
+ for (const id in spaceDoc.objects ?? {}) {
4284
+ const obj = spaceDoc.objects[id];
4285
+ if (obj.system.type?.itemId === import_echo_schema.TYPE_PROPERTIES) {
4286
+ return [
4287
+ id,
4288
+ obj
4289
+ ];
4290
+ }
4291
+ }
4292
+ return void 0;
4293
+ };
4269
4294
  var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4270
4295
  const credentials = [
4271
- await (0, import_credentials16.createCredential)({
4296
+ await (0, import_credentials15.createCredential)({
4272
4297
  signer: keyring,
4273
4298
  issuer: space.key,
4274
4299
  subject: space.key,
@@ -4277,14 +4302,14 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4277
4302
  spaceKey: space.key
4278
4303
  }
4279
4304
  }),
4280
- await (0, import_credentials16.createCredential)({
4305
+ await (0, import_credentials15.createCredential)({
4281
4306
  signer: keyring,
4282
4307
  issuer: space.key,
4283
4308
  subject: signingContext.identityKey,
4284
4309
  assertion: {
4285
4310
  "@type": "dxos.halo.credentials.SpaceMember",
4286
4311
  spaceKey: space.key,
4287
- role: import_credentials17.SpaceMember.Role.OWNER,
4312
+ role: import_credentials16.SpaceMember.Role.OWNER,
4288
4313
  profile: signingContext.getProfile(),
4289
4314
  genesisFeedKey: space.controlFeedKey ?? (0, import_debug4.failUndefined)()
4290
4315
  }
@@ -4296,7 +4321,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4296
4321
  spaceKey: space.key,
4297
4322
  identityKey: signingContext.identityKey,
4298
4323
  deviceKey: signingContext.deviceKey,
4299
- designation: import_credentials17.AdmittedFeed.Designation.CONTROL
4324
+ designation: import_credentials16.AdmittedFeed.Designation.CONTROL
4300
4325
  }
4301
4326
  }),
4302
4327
  await signingContext.credentialSigner.createCredential({
@@ -4306,7 +4331,7 @@ var spaceGenesis = async (keyring, signingContext, space, automergeRoot) => {
4306
4331
  spaceKey: space.key,
4307
4332
  identityKey: signingContext.identityKey,
4308
4333
  deviceKey: signingContext.deviceKey,
4309
- designation: import_credentials17.AdmittedFeed.Designation.DATA
4334
+ designation: import_credentials16.AdmittedFeed.Designation.DATA
4310
4335
  }
4311
4336
  }),
4312
4337
  await signingContext.credentialSigner.createCredential({
@@ -4360,6 +4385,28 @@ var DataSpaceManager = class {
4360
4385
  const { spaceMemberPresenceAnnounceInterval = PRESENCE_ANNOUNCE_INTERVAL, spaceMemberPresenceOfflineTimeout = PRESENCE_OFFLINE_TIMEOUT } = params ?? {};
4361
4386
  this._spaceMemberPresenceAnnounceInterval = spaceMemberPresenceAnnounceInterval;
4362
4387
  this._spaceMemberPresenceOfflineTimeout = spaceMemberPresenceOfflineTimeout;
4388
+ import_tracing5.trace.diagnostic({
4389
+ id: "spaces",
4390
+ name: "Spaces",
4391
+ fetch: async () => {
4392
+ return Array.from(this._spaces.values()).map((space) => {
4393
+ const rootUrl = space.automergeSpaceState.rootUrl;
4394
+ const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
4395
+ const rootDoc = rootHandle?.docSync();
4396
+ const properties = rootDoc && findPropertiesObject(rootDoc);
4397
+ return {
4398
+ key: space.key.toHex(),
4399
+ state: import_services10.SpaceState[space.state],
4400
+ name: properties?.[1].data.name ?? null,
4401
+ inlineObjects: rootDoc ? Object.keys(rootDoc.objects ?? {}).length : null,
4402
+ linkedObjects: rootDoc ? Object.keys(rootDoc.links ?? {}).length : null,
4403
+ credentials: space.inner.spaceState.credentials.length,
4404
+ members: space.inner.spaceState.members.size,
4405
+ rootUrl
4406
+ };
4407
+ });
4408
+ }
4409
+ });
4363
4410
  }
4364
4411
  // TODO(burdon): Remove.
4365
4412
  get spaces() {
@@ -4368,7 +4415,7 @@ var DataSpaceManager = class {
4368
4415
  async open() {
4369
4416
  (0, import_log12.log)("open", void 0, {
4370
4417
  F: __dxlog_file14,
4371
- L: 115,
4418
+ L: 144,
4372
4419
  S: this,
4373
4420
  C: (f, a) => f(...a)
4374
4421
  });
@@ -4376,7 +4423,7 @@ var DataSpaceManager = class {
4376
4423
  id: this._instanceId
4377
4424
  }), {
4378
4425
  F: __dxlog_file14,
4379
- L: 116,
4426
+ L: 145,
4380
4427
  S: this,
4381
4428
  C: (f, a) => f(...a)
4382
4429
  });
@@ -4384,7 +4431,7 @@ var DataSpaceManager = class {
4384
4431
  spaces: this._metadataStore.spaces.length
4385
4432
  }, {
4386
4433
  F: __dxlog_file14,
4387
- L: 117,
4434
+ L: 146,
4388
4435
  S: this,
4389
4436
  C: (f, a) => f(...a)
4390
4437
  });
@@ -4394,7 +4441,7 @@ var DataSpaceManager = class {
4394
4441
  spaceMetadata
4395
4442
  }, {
4396
4443
  F: __dxlog_file14,
4397
- L: 121,
4444
+ L: 150,
4398
4445
  S: this,
4399
4446
  C: (f, a) => f(...a)
4400
4447
  });
@@ -4405,7 +4452,7 @@ var DataSpaceManager = class {
4405
4452
  err
4406
4453
  }, {
4407
4454
  F: __dxlog_file14,
4408
- L: 124,
4455
+ L: 153,
4409
4456
  S: this,
4410
4457
  C: (f, a) => f(...a)
4411
4458
  });
@@ -4422,7 +4469,7 @@ var DataSpaceManager = class {
4422
4469
  id: this._instanceId
4423
4470
  }), {
4424
4471
  F: __dxlog_file14,
4425
- L: 137,
4472
+ L: 166,
4426
4473
  S: this,
4427
4474
  C: (f, a) => f(...a)
4428
4475
  });
@@ -4430,7 +4477,7 @@ var DataSpaceManager = class {
4430
4477
  async close() {
4431
4478
  (0, import_log12.log)("close", void 0, {
4432
4479
  F: __dxlog_file14,
4433
- L: 142,
4480
+ L: 171,
4434
4481
  S: this,
4435
4482
  C: (f, a) => f(...a)
4436
4483
  });
@@ -4446,7 +4493,7 @@ var DataSpaceManager = class {
4446
4493
  async createSpace() {
4447
4494
  (0, import_invariant13.invariant)(this._isOpen, "Not open.", {
4448
4495
  F: __dxlog_file14,
4449
- L: 155,
4496
+ L: 184,
4450
4497
  S: this,
4451
4498
  A: [
4452
4499
  "this._isOpen",
@@ -4467,18 +4514,18 @@ var DataSpaceManager = class {
4467
4514
  spaceKey
4468
4515
  }, {
4469
4516
  F: __dxlog_file14,
4470
- L: 167,
4517
+ L: 196,
4471
4518
  S: this,
4472
4519
  C: (f, a) => f(...a)
4473
4520
  });
4474
- const automergeRootUrl = await this._echoHost.createSpaceRoot(spaceKey);
4521
+ const root = await this._echoHost.createSpaceRoot(spaceKey);
4475
4522
  const space = await this._constructSpace(metadata);
4476
- const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, automergeRootUrl);
4523
+ const credentials = await spaceGenesis(this._keyring, this._signingContext, space.inner, root.url);
4477
4524
  await this._metadataStore.addSpace(metadata);
4478
4525
  const memberCredential = credentials[1];
4479
- (0, import_invariant13.invariant)((0, import_credentials14.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4526
+ (0, import_invariant13.invariant)((0, import_credentials13.getCredentialAssertion)(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4480
4527
  F: __dxlog_file14,
4481
- L: 176,
4528
+ L: 205,
4482
4529
  S: this,
4483
4530
  A: [
4484
4531
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -4496,13 +4543,13 @@ var DataSpaceManager = class {
4496
4543
  opts
4497
4544
  }, {
4498
4545
  F: __dxlog_file14,
4499
- L: 188,
4546
+ L: 217,
4500
4547
  S: this,
4501
4548
  C: (f, a) => f(...a)
4502
4549
  });
4503
4550
  (0, import_invariant13.invariant)(this._isOpen, "Not open.", {
4504
4551
  F: __dxlog_file14,
4505
- L: 189,
4552
+ L: 218,
4506
4553
  S: this,
4507
4554
  A: [
4508
4555
  "this._isOpen",
@@ -4511,7 +4558,7 @@ var DataSpaceManager = class {
4511
4558
  });
4512
4559
  (0, import_invariant13.invariant)(!this._spaces.has(opts.spaceKey), "Space already exists.", {
4513
4560
  F: __dxlog_file14,
4514
- L: 190,
4561
+ L: 219,
4515
4562
  S: this,
4516
4563
  A: [
4517
4564
  "!this._spaces.has(opts.spaceKey)",
@@ -4546,7 +4593,7 @@ var DataSpaceManager = class {
4546
4593
  metadata
4547
4594
  }, {
4548
4595
  F: __dxlog_file14,
4549
- L: 223,
4596
+ L: 252,
4550
4597
  S: this,
4551
4598
  C: (f, a) => f(...a)
4552
4599
  });
@@ -4584,7 +4631,7 @@ var DataSpaceManager = class {
4584
4631
  onAuthFailure: () => {
4585
4632
  import_log12.log.warn("auth failure", void 0, {
4586
4633
  F: __dxlog_file14,
4587
- L: 260,
4634
+ L: 289,
4588
4635
  S: this,
4589
4636
  C: (f, a) => f(...a)
4590
4637
  });
@@ -4617,7 +4664,7 @@ var DataSpaceManager = class {
4617
4664
  space: space.key
4618
4665
  }, {
4619
4666
  F: __dxlog_file14,
4620
- L: 287,
4667
+ L: 316,
4621
4668
  S: this,
4622
4669
  C: (f, a) => f(...a)
4623
4670
  });
@@ -4628,7 +4675,7 @@ var DataSpaceManager = class {
4628
4675
  open: this._isOpen
4629
4676
  }, {
4630
4677
  F: __dxlog_file14,
4631
- L: 290,
4678
+ L: 319,
4632
4679
  S: this,
4633
4680
  C: (f, a) => f(...a)
4634
4681
  });
@@ -4647,7 +4694,7 @@ var DataSpaceManager = class {
4647
4694
  space: space.key
4648
4695
  }, {
4649
4696
  F: __dxlog_file14,
4650
- L: 298,
4697
+ L: 327,
4651
4698
  S: this,
4652
4699
  C: (f, a) => f(...a)
4653
4700
  });
@@ -4678,7 +4725,7 @@ var DataSpaceManager = class {
4678
4725
  const peers = presence.getPeersByIdentityKey(member.key);
4679
4726
  const sessions = peers.map((p) => p.peerId && spaceProtocol.sessions.get(p.peerId));
4680
4727
  const sessionsToClose = sessions.filter((s) => {
4681
- return (s && member.role === import_credentials15.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline4.AuthStatus.FAILURE)) ?? false;
4728
+ return (s && member.role === import_credentials14.SpaceMember.Role.REMOVED !== (s.authStatus === import_echo_pipeline3.AuthStatus.FAILURE)) ?? false;
4682
4729
  });
4683
4730
  sessionsToClose.forEach((session) => {
4684
4731
  void session.close().catch(import_log12.log.error);
@@ -4691,7 +4738,7 @@ var DataSpaceManager = class {
4691
4738
  closedSessions
4692
4739
  }, {
4693
4740
  F: __dxlog_file14,
4694
- L: 338,
4741
+ L: 367,
4695
4742
  S: this,
4696
4743
  C: (f, a) => f(...a)
4697
4744
  });
@@ -4699,14 +4746,14 @@ var DataSpaceManager = class {
4699
4746
  }
4700
4747
  _handleNewPeerConnected(space, peerState) {
4701
4748
  const role = space.spaceState.getMemberRole(peerState.identityKey);
4702
- if (role === import_credentials15.SpaceMember.Role.REMOVED) {
4749
+ if (role === import_credentials14.SpaceMember.Role.REMOVED) {
4703
4750
  const session = peerState.peerId && space.protocol.sessions.get(peerState.peerId);
4704
4751
  if (session != null) {
4705
4752
  (0, import_log12.log)("closing a session with a removed peer", {
4706
4753
  peerId: peerState.peerId
4707
4754
  }, {
4708
4755
  F: __dxlog_file14,
4709
- L: 352,
4756
+ L: 381,
4710
4757
  S: this,
4711
4758
  C: (f, a) => f(...a)
4712
4759
  });
@@ -4806,7 +4853,7 @@ var SpacesServiceImpl = class {
4806
4853
  role: space.spaceState.getMemberRole(identity.identityKey)
4807
4854
  });
4808
4855
  }
4809
- const credentials = await (0, import_credentials18.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
4856
+ const credentials = await (0, import_credentials17.createAdmissionCredentials)(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
4810
4857
  (0, import_invariant14.invariant)(credentials[0].credential, void 0, {
4811
4858
  F: __dxlog_file15,
4812
4859
  L: 95,
@@ -4817,7 +4864,7 @@ var SpacesServiceImpl = class {
4817
4864
  ]
4818
4865
  });
4819
4866
  const spaceMemberCredential = credentials[0].credential.credential;
4820
- (0, import_invariant14.invariant)((0, import_credentials18.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4867
+ (0, import_invariant14.invariant)((0, import_credentials17.getCredentialAssertion)(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
4821
4868
  F: __dxlog_file15,
4822
4869
  L: 97,
4823
4870
  S: this,
@@ -5034,8 +5081,8 @@ var ServiceContext = class extends import_context12.Resource {
5034
5081
  this.initialized = new import_async16.Trigger();
5035
5082
  this._handlerFactories = /* @__PURE__ */ new Map();
5036
5083
  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"));
5084
+ this.metadataStore = new import_echo_pipeline4.MetadataStore(storage.createDirectory("metadata"));
5085
+ this.snapshotStore = new import_echo_pipeline4.SnapshotStore(storage.createDirectory("snapshots"));
5039
5086
  this.blobStore = new import_teleport_extension_object_sync.BlobStore(storage.createDirectory("blobs"));
5040
5087
  this.keyring = new import_keyring.Keyring(storage.createDirectory("keyring"));
5041
5088
  this.feedStore = new import_feed_store5.FeedStore({
@@ -5043,12 +5090,12 @@ var ServiceContext = class extends import_context12.Resource {
5043
5090
  root: storage.createDirectory("feeds"),
5044
5091
  signer: this.keyring,
5045
5092
  hypercore: {
5046
- valueEncoding: import_echo_pipeline5.valueEncoding,
5093
+ valueEncoding: import_echo_pipeline4.valueEncoding,
5047
5094
  stats: true
5048
5095
  }
5049
5096
  })
5050
5097
  });
5051
- this.spaceManager = new import_echo_pipeline5.SpaceManager({
5098
+ this.spaceManager = new import_echo_pipeline4.SpaceManager({
5052
5099
  feedStore: this.feedStore,
5053
5100
  networkManager: this.networkManager,
5054
5101
  blobStore: this.blobStore,
@@ -5214,7 +5261,7 @@ var ServiceContext = class extends import_context12.Resource {
5214
5261
  this.initialized.wake();
5215
5262
  this._deviceSpaceSync = {
5216
5263
  processCredential: async (credential) => {
5217
- const assertion = (0, import_credentials19.getCredentialAssertion)(credential);
5264
+ const assertion = (0, import_credentials18.getCredentialAssertion)(credential);
5218
5265
  if (assertion["@type"] !== "dxos.halo.credentials.SpaceMember") {
5219
5266
  return;
5220
5267
  }
@@ -5270,14 +5317,14 @@ var ServiceContext = class extends import_context12.Resource {
5270
5317
  }
5271
5318
  };
5272
5319
  _ts_decorate6([
5273
- import_tracing5.trace.span()
5320
+ import_tracing6.trace.span()
5274
5321
  ], ServiceContext.prototype, "_open", null);
5275
5322
  _ts_decorate6([
5276
- import_tracing5.trace.span()
5323
+ import_tracing6.trace.span()
5277
5324
  ], ServiceContext.prototype, "_initialize", null);
5278
5325
  ServiceContext = _ts_decorate6([
5279
5326
  (0, import_util9.safeInstanceof)("dxos.client-services.ServiceContext"),
5280
- import_tracing5.trace.resource()
5327
+ import_tracing6.trace.resource()
5281
5328
  ], ServiceContext);
5282
5329
  var ServiceRegistry = class {
5283
5330
  // prettier-ignore
@@ -5301,7 +5348,7 @@ var ServiceRegistry = class {
5301
5348
  delete this._handlers[name];
5302
5349
  }
5303
5350
  };
5304
- var DXOS_VERSION = "0.5.3-next.2c59258";
5351
+ var DXOS_VERSION = "0.5.3-next.63cdcad";
5305
5352
  var getPlatform = () => {
5306
5353
  if (process.browser) {
5307
5354
  if (typeof window !== "undefined") {
@@ -5341,7 +5388,7 @@ var createDiagnostics = async (clientServices, serviceContext, config) => {
5341
5388
  version: import_protocols13.STORAGE_VERSION
5342
5389
  }
5343
5390
  },
5344
- trace: import_tracing6.TRACE_PROCESSOR.getDiagnostics()
5391
+ trace: import_tracing7.TRACE_PROCESSOR.getDiagnostics()
5345
5392
  };
5346
5393
  await Promise.all([
5347
5394
  (async () => {
@@ -5399,7 +5446,7 @@ var getSpaceStats = async (space) => {
5399
5446
  const stats = {
5400
5447
  key: space.key,
5401
5448
  metrics: space.metrics,
5402
- epochs: space.inner.spaceState.credentials.filter((0, import_credentials20.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
5449
+ epochs: space.inner.spaceState.credentials.filter((0, import_credentials19.credentialTypeFilter)("dxos.halo.credentials.Epoch")).map((credential) => ({
5403
5450
  ...credential.subject.assertion,
5404
5451
  id: credential.id
5405
5452
  })),
@@ -5868,7 +5915,7 @@ var ClientServicesHost = class {
5868
5915
  callbacks,
5869
5916
  runtimeParams
5870
5917
  } = {}) {
5871
- this._tracingService = import_tracing8.TRACE_PROCESSOR.createTraceSender();
5918
+ this._tracingService = import_tracing9.TRACE_PROCESSOR.createTraceSender();
5872
5919
  this._statusUpdate = new import_async18.Event();
5873
5920
  this._opening = false;
5874
5921
  this._open = false;
@@ -6230,21 +6277,21 @@ var ClientServicesHost = class {
6230
6277
  }
6231
6278
  };
6232
6279
  _ts_decorate8([
6233
- import_tracing8.trace.info()
6280
+ import_tracing9.trace.info()
6234
6281
  ], ClientServicesHost.prototype, "_opening", void 0);
6235
6282
  _ts_decorate8([
6236
- import_tracing8.trace.info()
6283
+ import_tracing9.trace.info()
6237
6284
  ], ClientServicesHost.prototype, "_open", void 0);
6238
6285
  _ts_decorate8([
6239
6286
  import_async18.synchronized,
6240
- import_tracing8.trace.span()
6287
+ import_tracing9.trace.span()
6241
6288
  ], ClientServicesHost.prototype, "open", null);
6242
6289
  _ts_decorate8([
6243
6290
  import_async18.synchronized,
6244
- import_tracing8.trace.span()
6291
+ import_tracing9.trace.span()
6245
6292
  ], ClientServicesHost.prototype, "close", null);
6246
6293
  ClientServicesHost = _ts_decorate8([
6247
- import_tracing8.trace.resource()
6294
+ import_tracing9.trace.resource()
6248
6295
  ], ClientServicesHost);
6249
6296
  var ClientServicesProviderResource = Symbol.for("dxos.resource.ClientServices");
6250
6297
  var GET_DIAGNOSTICS_RPC_TIMEOUT = 1e4;
@@ -6260,7 +6307,7 @@ var DiagnosticsCollector = class {
6260
6307
  });
6261
6308
  const clientDiagnostics = {
6262
6309
  config,
6263
- trace: import_tracing7.TRACE_PROCESSOR.getDiagnostics()
6310
+ trace: import_tracing8.TRACE_PROCESSOR.getDiagnostics()
6264
6311
  };
6265
6312
  const diagnostics = serviceDiagnostics != null ? {
6266
6313
  client: clientDiagnostics,
@@ -6273,12 +6320,12 @@ var DiagnosticsCollector = class {
6273
6320
  }
6274
6321
  };
6275
6322
  var findSystemServiceProvider = () => {
6276
- const serviceProviders = import_tracing7.TRACE_PROCESSOR.findResourcesByAnnotation(ClientServicesProviderResource);
6323
+ const serviceProviders = import_tracing8.TRACE_PROCESSOR.findResourcesByAnnotation(ClientServicesProviderResource);
6277
6324
  const providerResource = serviceProviders.find((r) => r.instance.deref()?.services?.SystemService != null);
6278
6325
  return providerResource?.instance?.deref() ?? null;
6279
6326
  };
6280
6327
  var findConfigs = () => {
6281
- const configs = import_tracing7.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
6328
+ const configs = import_tracing8.TRACE_PROCESSOR.findResourcesByAnnotation(import_config.ConfigResource);
6282
6329
  return configs.map((r) => r.instance.deref()).filter(import_util10.nonNullable);
6283
6330
  };
6284
6331
  // Annotate the CommonJS export names for ESM import in node:
@@ -6311,6 +6358,7 @@ var findConfigs = () => {
6311
6358
  createDiagnostics,
6312
6359
  createLevel,
6313
6360
  createStorageObjects,
6361
+ findPropertiesObject,
6314
6362
  getNetworkPeers,
6315
6363
  isLocked,
6316
6364
  subscribeToFeedBlocks,
@@ -6321,4 +6369,4 @@ var findConfigs = () => {
6321
6369
  subscribeToSpaces,
6322
6370
  subscribeToSwarmInfo
6323
6371
  });
6324
- //# sourceMappingURL=chunk-VOYHS6QR.cjs.map
6372
+ //# sourceMappingURL=chunk-PCHM5MI3.cjs.map