@dxos/client-services 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446

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 (73) hide show
  1. package/dist/lib/browser/{chunk-I3QLQXQD.mjs → chunk-2TKMQ2UP.mjs} +167 -170
  2. package/dist/lib/browser/chunk-2TKMQ2UP.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/testing/index.mjs +1 -1
  6. package/dist/lib/node/{chunk-Y747YVDI.cjs → chunk-HUMVSL5Y.cjs} +336 -339
  7. package/dist/lib/node/chunk-HUMVSL5Y.cjs.map +7 -0
  8. package/dist/lib/node/index.cjs +47 -47
  9. package/dist/lib/node/meta.json +1 -1
  10. package/dist/lib/node/testing/index.cjs +8 -8
  11. package/dist/lib/node-esm/{chunk-XNCWQTDB.mjs → chunk-DQCPFIVI.mjs} +167 -170
  12. package/dist/lib/node-esm/chunk-DQCPFIVI.mjs.map +7 -0
  13. package/dist/lib/node-esm/index.mjs +1 -1
  14. package/dist/lib/node-esm/meta.json +1 -1
  15. package/dist/lib/node-esm/testing/index.mjs +1 -1
  16. package/dist/types/src/packlets/agents/edge-agent-service.d.ts +1 -1
  17. package/dist/types/src/packlets/agents/edge-agent-service.d.ts.map +1 -1
  18. package/dist/types/src/packlets/devices/devices-service.d.ts.map +1 -1
  19. package/dist/types/src/packlets/devtools/feeds.d.ts.map +1 -1
  20. package/dist/types/src/packlets/devtools/keys.d.ts.map +1 -1
  21. package/dist/types/src/packlets/devtools/metadata.d.ts.map +1 -1
  22. package/dist/types/src/packlets/devtools/network.d.ts.map +1 -1
  23. package/dist/types/src/packlets/devtools/spaces.d.ts.map +1 -1
  24. package/dist/types/src/packlets/diagnostics/browser-diagnostics-broadcast.d.ts.map +1 -1
  25. package/dist/types/src/packlets/diagnostics/diagnostics-broadcast.d.ts.map +1 -1
  26. package/dist/types/src/packlets/diagnostics/diagnostics.d.ts.map +1 -1
  27. package/dist/types/src/packlets/identity/authenticator.d.ts.map +1 -1
  28. package/dist/types/src/packlets/invitations/invitation-host-extension.d.ts.map +1 -1
  29. package/dist/types/src/packlets/invitations/invitation-state.d.ts.map +1 -1
  30. package/dist/types/src/packlets/invitations/utils.d.ts.map +1 -1
  31. package/dist/types/src/packlets/locks/browser.d.ts.map +1 -1
  32. package/dist/types/src/packlets/locks/node.d.ts.map +1 -1
  33. package/dist/types/src/packlets/network/network-service.d.ts +1 -3
  34. package/dist/types/src/packlets/network/network-service.d.ts.map +1 -1
  35. package/dist/types/src/packlets/services/service-host.d.ts.map +1 -1
  36. package/dist/types/src/packlets/services/util.d.ts.map +1 -1
  37. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts +1 -1
  38. package/dist/types/src/packlets/space-export/space-archive-reader.d.ts.map +1 -1
  39. package/dist/types/src/packlets/spaces/data-space-manager.d.ts +1 -1
  40. package/dist/types/src/packlets/spaces/data-space-manager.d.ts.map +1 -1
  41. package/dist/types/src/packlets/spaces/data-space.d.ts.map +1 -1
  42. package/dist/types/src/packlets/spaces/edge-feed-replicator.d.ts.map +1 -1
  43. package/dist/types/src/packlets/spaces/epoch-migrations.d.ts.map +1 -1
  44. package/dist/types/src/packlets/spaces/genesis.d.ts.map +1 -1
  45. package/dist/types/src/packlets/spaces/spaces-service.d.ts.map +1 -1
  46. package/dist/types/src/packlets/storage/level.d.ts.map +1 -1
  47. package/dist/types/src/packlets/storage/profile-archive.d.ts.map +1 -1
  48. package/dist/types/src/packlets/storage/storage.d.ts.map +1 -1
  49. package/dist/types/src/packlets/storage/util.d.ts.map +1 -1
  50. package/dist/types/src/packlets/testing/credential-utils.d.ts.map +1 -1
  51. package/dist/types/src/packlets/testing/invitation-utils.d.ts.map +1 -1
  52. package/dist/types/src/packlets/testing/test-builder.d.ts.map +1 -1
  53. package/dist/types/src/version.d.ts +1 -1
  54. package/dist/types/src/version.d.ts.map +1 -1
  55. package/dist/types/tsconfig.tsbuildinfo +1 -1
  56. package/package.json +38 -39
  57. package/src/packlets/agents/edge-agent-service.ts +11 -8
  58. package/src/packlets/devices/devices-service.ts +3 -5
  59. package/src/packlets/identity/identity.test.ts +6 -9
  60. package/src/packlets/network/network-service.ts +15 -9
  61. package/src/packlets/services/service-host.ts +1 -5
  62. package/src/packlets/space-export/space-archive-reader.ts +1 -2
  63. package/src/packlets/spaces/data-space-manager.ts +29 -35
  64. package/src/packlets/spaces/data-space.ts +4 -11
  65. package/src/packlets/spaces/edge-feed-replicator.test.ts +1 -2
  66. package/src/packlets/spaces/edge-feed-replicator.ts +1 -2
  67. package/src/packlets/spaces/epoch-migrations.ts +2 -3
  68. package/src/packlets/spaces/spaces-service.ts +1 -2
  69. package/src/packlets/storage/profile-archive.ts +1 -2
  70. package/src/version.ts +1 -1
  71. package/dist/lib/browser/chunk-I3QLQXQD.mjs.map +0 -7
  72. package/dist/lib/node/chunk-Y747YVDI.cjs.map +0 -7
  73. package/dist/lib/node-esm/chunk-XNCWQTDB.mjs.map +0 -7
@@ -397,7 +397,7 @@ import { SpaceMember } from "@dxos/protocols/proto/dxos/client/services";
397
397
  import { TRACE_PROCESSOR } from "@dxos/tracing";
398
398
 
399
399
  // packages/sdk/client-services/src/version.ts
400
- var DXOS_VERSION = "0.8.2-main.fbd8ed0";
400
+ var DXOS_VERSION = "0.8.2-staging.7ac8446";
401
401
 
402
402
  // packages/sdk/client-services/src/packlets/services/platform.ts
403
403
  import { Platform } from "@dxos/protocols/proto/dxos/client/services";
@@ -739,7 +739,6 @@ import { log as log3, logInfo } from "@dxos/log";
739
739
  import { EdgeService } from "@dxos/protocols";
740
740
  import { buf } from "@dxos/protocols/buf";
741
741
  import { MessageSchema as RouterMessageSchema } from "@dxos/protocols/buf/dxos/edge/messenger_pb";
742
- import { EdgeStatus } from "@dxos/protocols/proto/dxos/client/services";
743
742
  import { ComplexMap as ComplexMap2, arrayToBuffer, bufferToArray, defaultMap, rangeFromTo } from "@dxos/util";
744
743
  function _ts_decorate(decorators, target, key, desc) {
745
744
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -830,7 +829,7 @@ var EdgeFeedReplicator = class extends Resource {
830
829
  async _open() {
831
830
  log3("open", void 0, {
832
831
  F: __dxlog_file5,
833
- L: 57,
832
+ L: 56,
834
833
  S: this,
835
834
  C: (f, a) => f(...a)
836
835
  });
@@ -849,7 +848,7 @@ var EdgeFeedReplicator = class extends Resource {
849
848
  _spaceId: this._spaceId
850
849
  }, {
851
850
  F: __dxlog_file5,
852
- L: 71,
851
+ L: 70,
853
852
  S: this,
854
853
  C: (f, a) => f(...a)
855
854
  });
@@ -862,7 +861,7 @@ var EdgeFeedReplicator = class extends Resource {
862
861
  type: payload.type
863
862
  }, {
864
863
  F: __dxlog_file5,
865
- L: 76,
864
+ L: 75,
866
865
  S: this,
867
866
  C: (f, a) => f(...a)
868
867
  });
@@ -874,14 +873,14 @@ var EdgeFeedReplicator = class extends Resource {
874
873
  }
875
874
  async _handleReconnect() {
876
875
  await this._resetConnection();
877
- if (this._messenger.status === EdgeStatus.CONNECTED) {
876
+ if (this._messenger.isConnected) {
878
877
  this._startReplication();
879
878
  }
880
879
  }
881
880
  async _close() {
882
881
  log3("close", void 0, {
883
882
  F: __dxlog_file5,
884
- L: 96,
883
+ L: 95,
885
884
  S: this,
886
885
  C: (f, a) => f(...a)
887
886
  });
@@ -893,7 +892,7 @@ var EdgeFeedReplicator = class extends Resource {
893
892
  this._connectionCtx = connectionCtx;
894
893
  log3("connection context created", void 0, {
895
894
  F: __dxlog_file5,
896
- L: 104,
895
+ L: 103,
897
896
  S: this,
898
897
  C: (f, a) => f(...a)
899
898
  });
@@ -906,7 +905,7 @@ var EdgeFeedReplicator = class extends Resource {
906
905
  async _resetConnection() {
907
906
  log3("resetConnection", void 0, {
908
907
  F: __dxlog_file5,
909
- L: 113,
908
+ L: 112,
910
909
  S: this,
911
910
  C: (f, a) => f(...a)
912
911
  });
@@ -922,7 +921,7 @@ var EdgeFeedReplicator = class extends Resource {
922
921
  hasConnectionCtx: !!this._connectionCtx
923
922
  }, {
924
923
  F: __dxlog_file5,
925
- L: 121,
924
+ L: 120,
926
925
  S: this,
927
926
  C: (f, a) => f(...a)
928
927
  });
@@ -939,7 +938,7 @@ var EdgeFeedReplicator = class extends Resource {
939
938
  key: feed.key
940
939
  }, {
941
940
  F: __dxlog_file5,
942
- L: 134,
941
+ L: 133,
943
942
  S: this,
944
943
  C: (f, a) => f(...a)
945
944
  });
@@ -955,7 +954,7 @@ var EdgeFeedReplicator = class extends Resource {
955
954
  if (!this._connectionCtx) {
956
955
  log3("message dropped because connection was disposed", void 0, {
957
956
  F: __dxlog_file5,
958
- L: 147,
957
+ L: 146,
959
958
  S: this,
960
959
  C: (f, a) => f(...a)
961
960
  });
@@ -967,14 +966,14 @@ var EdgeFeedReplicator = class extends Resource {
967
966
  blocks: message.blocks.map((b) => b.index)
968
967
  }, {
969
968
  F: __dxlog_file5,
970
- L: 152,
969
+ L: 151,
971
970
  S: this,
972
971
  C: (f, a) => f(...a)
973
972
  });
974
973
  }
975
974
  invariant2(message.feedKey, void 0, {
976
975
  F: __dxlog_file5,
977
- L: 158,
976
+ L: 157,
978
977
  S: this,
979
978
  A: [
980
979
  "message.feedKey",
@@ -986,7 +985,7 @@ var EdgeFeedReplicator = class extends Resource {
986
985
  type: message.type
987
986
  }, {
988
987
  F: __dxlog_file5,
989
- L: 161,
988
+ L: 160,
990
989
  S: this,
991
990
  C: (f, a) => f(...a)
992
991
  });
@@ -1005,7 +1004,7 @@ var EdgeFeedReplicator = class extends Resource {
1005
1004
  if (!this._connectionCtx) {
1006
1005
  log3.warn("received message after connection context was disposed", void 0, {
1007
1006
  F: __dxlog_file5,
1008
- L: 176,
1007
+ L: 175,
1009
1008
  S: this,
1010
1009
  C: (f, a) => f(...a)
1011
1010
  });
@@ -1023,7 +1022,7 @@ var EdgeFeedReplicator = class extends Resource {
1023
1022
  feedKey
1024
1023
  }, {
1025
1024
  F: __dxlog_file5,
1026
- L: 185,
1025
+ L: 184,
1027
1026
  S: this,
1028
1027
  C: (f, a) => f(...a)
1029
1028
  });
@@ -1039,7 +1038,7 @@ var EdgeFeedReplicator = class extends Resource {
1039
1038
  if (message.length > feed.length) {
1040
1039
  log3("requesting missing blocks", logMeta, {
1041
1040
  F: __dxlog_file5,
1042
- L: 195,
1041
+ L: 194,
1043
1042
  S: this,
1044
1043
  C: (f, a) => f(...a)
1045
1044
  });
@@ -1054,7 +1053,7 @@ var EdgeFeedReplicator = class extends Resource {
1054
1053
  } else if (message.length < feed.length) {
1055
1054
  log3("pushing blocks to remote", logMeta, {
1056
1055
  F: __dxlog_file5,
1057
- L: 203,
1056
+ L: 202,
1058
1057
  S: this,
1059
1058
  C: (f, a) => f(...a)
1060
1059
  });
@@ -1073,7 +1072,7 @@ var EdgeFeedReplicator = class extends Resource {
1073
1072
  blocks: message.blocks.map((b) => b.index)
1074
1073
  }, {
1075
1074
  F: __dxlog_file5,
1076
- L: 212,
1075
+ L: 211,
1077
1076
  S: this,
1078
1077
  C: (f, a) => f(...a)
1079
1078
  });
@@ -1084,7 +1083,7 @@ var EdgeFeedReplicator = class extends Resource {
1084
1083
  feedKey
1085
1084
  }, {
1086
1085
  F: __dxlog_file5,
1087
- L: 217,
1086
+ L: 216,
1088
1087
  S: this,
1089
1088
  C: (f, a) => f(...a)
1090
1089
  });
@@ -1098,7 +1097,7 @@ var EdgeFeedReplicator = class extends Resource {
1098
1097
  ...message
1099
1098
  }, {
1100
1099
  F: __dxlog_file5,
1101
- L: 226,
1100
+ L: 225,
1102
1101
  S: this,
1103
1102
  C: (f, a) => f(...a)
1104
1103
  });
@@ -1113,7 +1112,7 @@ var EdgeFeedReplicator = class extends Resource {
1113
1112
  to
1114
1113
  }, {
1115
1114
  F: __dxlog_file5,
1116
- L: 233,
1115
+ L: 232,
1117
1116
  S: this,
1118
1117
  C: (f, a) => f(...a)
1119
1118
  });
@@ -1123,7 +1122,7 @@ var EdgeFeedReplicator = class extends Resource {
1123
1122
  });
1124
1123
  invariant2(data instanceof Uint8Array, void 0, {
1125
1124
  F: __dxlog_file5,
1126
- L: 238,
1125
+ L: 237,
1127
1126
  S: this,
1128
1127
  A: [
1129
1128
  "data instanceof Uint8Array",
@@ -1151,7 +1150,7 @@ var EdgeFeedReplicator = class extends Resource {
1151
1150
  blocks: blocks.length
1152
1151
  }, {
1153
1152
  F: __dxlog_file5,
1154
- L: 259,
1153
+ L: 258,
1155
1154
  S: this,
1156
1155
  C: (f, a) => f(...a)
1157
1156
  });
@@ -1173,7 +1172,7 @@ var EdgeFeedReplicator = class extends Resource {
1173
1172
  if (!this._remoteLength.has(feed.key)) {
1174
1173
  log3("blocks not pushed because remote length is unknown", void 0, {
1175
1174
  F: __dxlog_file5,
1176
- L: 280,
1175
+ L: 279,
1177
1176
  S: this,
1178
1177
  C: (f, a) => f(...a)
1179
1178
  });
@@ -1198,7 +1197,7 @@ var EdgeFeedReplicator = class extends Resource {
1198
1197
  if (err instanceof EdgeIdentityChangedError || err instanceof EdgeConnectionClosedError) {
1199
1198
  log3("resetting on reconnect", void 0, {
1200
1199
  F: __dxlog_file5,
1201
- L: 297,
1200
+ L: 296,
1202
1201
  S: this,
1203
1202
  C: (f, a) => f(...a)
1204
1203
  });
@@ -1209,7 +1208,7 @@ var EdgeFeedReplicator = class extends Resource {
1209
1208
  }
1210
1209
  }, {
1211
1210
  F: __dxlog_file5,
1212
- L: 291
1211
+ L: 290
1213
1212
  });
1214
1213
  return connectionCtx;
1215
1214
  }
@@ -1229,12 +1228,12 @@ var bufferizeBlock = (block) => ({
1229
1228
  });
1230
1229
 
1231
1230
  // packages/sdk/client-services/src/packlets/spaces/data-space.ts
1232
- import { save } from "@automerge/automerge";
1233
1231
  import { Event as Event7, Mutex as Mutex2, scheduleTask as scheduleTask4, sleep as sleep3, synchronized as synchronized2, trackLeaks as trackLeaks2 } from "@dxos/async";
1232
+ import { save } from "@dxos/automerge/automerge";
1234
1233
  import { AUTH_TIMEOUT as AUTH_TIMEOUT2 } from "@dxos/client-protocol";
1235
1234
  import { Context as Context6, ContextDisposedError, cancelWithContext as cancelWithContext2 } from "@dxos/context";
1236
1235
  import { timed, warnAfterTimeout } from "@dxos/debug";
1237
- import { createMappedFeedWriter, FIND_PARAMS as FIND_PARAMS2 } from "@dxos/echo-pipeline";
1236
+ import { createMappedFeedWriter } from "@dxos/echo-pipeline";
1238
1237
  import { SpaceDocVersion as SpaceDocVersion2 } from "@dxos/echo-protocol";
1239
1238
  import { failedInvariant as failedInvariant3, invariant as invariant11 } from "@dxos/invariant";
1240
1239
  import { PublicKey as PublicKey8 } from "@dxos/keys";
@@ -1312,7 +1311,7 @@ var runEpochMigration = async (ctx, context) => {
1312
1311
  const rootHandle = await context.echoHost.loadDoc(ctx, context.currentRoot, {
1313
1312
  timeout: LOAD_DOC_TIMEOUT
1314
1313
  });
1315
- const newRoot = context.echoHost.createDoc(rootHandle.doc());
1314
+ const newRoot = context.echoHost.createDoc(rootHandle.docSync());
1316
1315
  await context.echoHost.flush();
1317
1316
  return {
1318
1317
  newRoot: newRoot.url
@@ -1328,7 +1327,7 @@ var runEpochMigration = async (ctx, context) => {
1328
1327
  case CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT: {
1329
1328
  invariant3(context.newAutomergeRoot, void 0, {
1330
1329
  F: __dxlog_file6,
1331
- L: 63,
1330
+ L: 62,
1332
1331
  S: void 0,
1333
1332
  A: [
1334
1333
  "context.newAutomergeRoot",
@@ -1857,14 +1856,14 @@ var DefaultSpaceStateMachine = class {
1857
1856
  };
1858
1857
 
1859
1858
  // packages/sdk/client-services/src/packlets/spaces/data-space-manager.ts
1860
- import { interpretAsDocumentId } from "@automerge/automerge-repo";
1861
1859
  import { Event as Event4, synchronized, trackLeaks } from "@dxos/async";
1860
+ import { interpretAsDocumentId } from "@dxos/automerge/automerge-repo";
1862
1861
  import { PropertiesType, TYPE_PROPERTIES } from "@dxos/client-protocol";
1863
1862
  import { Context as Context4, LifecycleState, Resource as Resource4, cancelWithContext } from "@dxos/context";
1864
1863
  import { createAdmissionCredentials, getCredentialAssertion as getCredentialAssertion2 } from "@dxos/credentials";
1865
- import { DatabaseRoot, findInlineObjectOfType, AuthStatus, CredentialServerExtension, FIND_PARAMS } from "@dxos/echo-pipeline";
1864
+ import { DatabaseRoot, findInlineObjectOfType, AuthStatus, CredentialServerExtension } from "@dxos/echo-pipeline";
1866
1865
  import { SpaceDocVersion, createIdFromSpaceKey, encodeReference } from "@dxos/echo-protocol";
1867
- import { ObjectId, getTypeReference } from "@dxos/echo-schema";
1866
+ import { createObjectId, getTypeReference } from "@dxos/echo-schema";
1868
1867
  import { writeMessages } from "@dxos/feed-store";
1869
1868
  import { assertArgument, assertState, failedInvariant, invariant as invariant5 } from "@dxos/invariant";
1870
1869
  import { PublicKey as PublicKey5 } from "@dxos/keys";
@@ -1987,11 +1986,10 @@ var DataSpaceManager = class extends Resource4 {
1987
1986
  id: "spaces",
1988
1987
  name: "Spaces",
1989
1988
  fetch: async () => {
1990
- return Promise.all(Array.from(this._spaces.values()).map(async (space) => {
1989
+ return Array.from(this._spaces.values()).map((space) => {
1991
1990
  const rootUrl = space.automergeSpaceState.rootUrl;
1992
- const rootHandle = rootUrl ? await this._echoHost.automergeRepo.find(rootUrl, FIND_PARAMS) : void 0;
1993
- await rootHandle?.whenReady();
1994
- const rootDoc = rootHandle?.doc();
1991
+ const rootHandle = rootUrl ? this._echoHost.automergeRepo.find(rootUrl) : void 0;
1992
+ const rootDoc = rootHandle?.docSync();
1995
1993
  const properties = rootDoc && findInlineObjectOfType(rootDoc, TYPE_PROPERTIES);
1996
1994
  return {
1997
1995
  key: space.key.toHex(),
@@ -2003,7 +2001,7 @@ var DataSpaceManager = class extends Resource4 {
2003
2001
  members: space.inner.spaceState.members.size,
2004
2002
  rootUrl
2005
2003
  };
2006
- }));
2004
+ });
2007
2005
  }
2008
2006
  });
2009
2007
  }
@@ -2019,7 +2017,7 @@ var DataSpaceManager = class extends Resource4 {
2019
2017
  async _open() {
2020
2018
  log6("open", void 0, {
2021
2019
  F: __dxlog_file9,
2022
- L: 215,
2020
+ L: 213,
2023
2021
  S: this,
2024
2022
  C: (f, a) => f(...a)
2025
2023
  });
@@ -2027,7 +2025,7 @@ var DataSpaceManager = class extends Resource4 {
2027
2025
  id: this._instanceId
2028
2026
  }), {
2029
2027
  F: __dxlog_file9,
2030
- L: 216,
2028
+ L: 214,
2031
2029
  S: this,
2032
2030
  C: (f, a) => f(...a)
2033
2031
  });
@@ -2035,7 +2033,7 @@ var DataSpaceManager = class extends Resource4 {
2035
2033
  spaces: this._metadataStore.spaces.length
2036
2034
  }, {
2037
2035
  F: __dxlog_file9,
2038
- L: 217,
2036
+ L: 215,
2039
2037
  S: this,
2040
2038
  C: (f, a) => f(...a)
2041
2039
  });
@@ -2045,7 +2043,7 @@ var DataSpaceManager = class extends Resource4 {
2045
2043
  spaceMetadata
2046
2044
  }, {
2047
2045
  F: __dxlog_file9,
2048
- L: 221,
2046
+ L: 219,
2049
2047
  S: this,
2050
2048
  C: (f, a) => f(...a)
2051
2049
  });
@@ -2056,7 +2054,7 @@ var DataSpaceManager = class extends Resource4 {
2056
2054
  err
2057
2055
  }, {
2058
2056
  F: __dxlog_file9,
2059
- L: 224,
2057
+ L: 222,
2060
2058
  S: this,
2061
2059
  C: (f, a) => f(...a)
2062
2060
  });
@@ -2067,7 +2065,7 @@ var DataSpaceManager = class extends Resource4 {
2067
2065
  id: this._instanceId
2068
2066
  }), {
2069
2067
  F: __dxlog_file9,
2070
- L: 230,
2068
+ L: 228,
2071
2069
  S: this,
2072
2070
  C: (f, a) => f(...a)
2073
2071
  });
@@ -2075,7 +2073,7 @@ var DataSpaceManager = class extends Resource4 {
2075
2073
  async _close() {
2076
2074
  log6("close", void 0, {
2077
2075
  F: __dxlog_file9,
2078
- L: 235,
2076
+ L: 233,
2079
2077
  S: this,
2080
2078
  C: (f, a) => f(...a)
2081
2079
  });
@@ -2106,7 +2104,7 @@ var DataSpaceManager = class extends Resource4 {
2106
2104
  spaceKey
2107
2105
  }, {
2108
2106
  F: __dxlog_file9,
2109
- L: 264,
2107
+ L: 262,
2110
2108
  S: this,
2111
2109
  C: (f, a) => f(...a)
2112
2110
  });
@@ -2114,7 +2112,7 @@ var DataSpaceManager = class extends Resource4 {
2114
2112
  if (options.documents) {
2115
2113
  invariant5(Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId)), "Invalid document IDs", {
2116
2114
  F: __dxlog_file9,
2117
- L: 269,
2115
+ L: 267,
2118
2116
  S: this,
2119
2117
  A: [
2120
2118
  "Object.keys(options.documents).every((documentId) => /^[a-zA-Z0-9]+$/.test(documentId))",
@@ -2126,7 +2124,7 @@ var DataSpaceManager = class extends Resource4 {
2126
2124
  documentId
2127
2125
  }, {
2128
2126
  F: __dxlog_file9,
2129
- L: 276,
2127
+ L: 274,
2130
2128
  S: this,
2131
2129
  C: (f, a) => f(...a)
2132
2130
  });
@@ -2140,7 +2138,7 @@ var DataSpaceManager = class extends Resource4 {
2140
2138
  spaceKey
2141
2139
  }, {
2142
2140
  F: __dxlog_file9,
2143
- L: 283,
2141
+ L: 281,
2144
2142
  S: this,
2145
2143
  C: (f, a) => f(...a)
2146
2144
  });
@@ -2149,7 +2147,7 @@ var DataSpaceManager = class extends Resource4 {
2149
2147
  const newRootDocId = documentIdMapping[interpretAsDocumentId(options.rootUrl)] ?? failedInvariant();
2150
2148
  const rootDocHandle = await this._echoHost.loadDoc(Context4.default(void 0, {
2151
2149
  F: __dxlog_file9,
2152
- L: 288
2150
+ L: 286
2153
2151
  }), newRootDocId);
2154
2152
  DatabaseRoot.mapLinks(rootDocHandle, documentIdMapping);
2155
2153
  root = await this._echoHost.openSpaceRoot(spaceId, `automerge:${newRootDocId}`);
@@ -2160,7 +2158,7 @@ var DataSpaceManager = class extends Resource4 {
2160
2158
  spaceKey
2161
2159
  }, {
2162
2160
  F: __dxlog_file9,
2163
- L: 296,
2161
+ L: 294,
2164
2162
  S: this,
2165
2163
  C: (f, a) => f(...a)
2166
2164
  });
@@ -2170,7 +2168,7 @@ var DataSpaceManager = class extends Resource4 {
2170
2168
  spaceKey
2171
2169
  }, {
2172
2170
  F: __dxlog_file9,
2173
- L: 301,
2171
+ L: 299,
2174
2172
  S: this,
2175
2173
  C: (f, a) => f(...a)
2176
2174
  });
@@ -2179,7 +2177,7 @@ var DataSpaceManager = class extends Resource4 {
2179
2177
  const memberCredential = credentials[1];
2180
2178
  invariant5(getCredentialAssertion2(memberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2181
2179
  F: __dxlog_file9,
2182
- L: 307,
2180
+ L: 305,
2183
2181
  S: this,
2184
2182
  A: [
2185
2183
  "getCredentialAssertion(memberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2193,7 +2191,7 @@ var DataSpaceManager = class extends Resource4 {
2193
2191
  spaceKey
2194
2192
  }, {
2195
2193
  F: __dxlog_file9,
2196
- L: 312,
2194
+ L: 310,
2197
2195
  S: this,
2198
2196
  C: (f, a) => f(...a)
2199
2197
  });
@@ -2206,18 +2204,7 @@ var DataSpaceManager = class extends Resource4 {
2206
2204
  }
2207
2205
  switch (space.databaseRoot.getVersion()) {
2208
2206
  case SpaceDocVersion.CURRENT: {
2209
- if (!space.databaseRoot.handle.isReady()) {
2210
- log6.warn("waiting for space root to be ready", {
2211
- spaceId: space.id
2212
- }, {
2213
- F: __dxlog_file9,
2214
- L: 325,
2215
- S: this,
2216
- C: (f, a) => f(...a)
2217
- });
2218
- await space.databaseRoot.handle.whenReady();
2219
- }
2220
- const [_, properties] = findInlineObjectOfType(space.databaseRoot.doc(), TYPE_PROPERTIES) ?? [];
2207
+ const [_, properties] = findInlineObjectOfType(space.databaseRoot.docSync(), TYPE_PROPERTIES) ?? [];
2221
2208
  return properties?.data?.[DEFAULT_SPACE_KEY] === this._signingContext.identityKey.toHex();
2222
2209
  }
2223
2210
  case SpaceDocVersion.LEGACY: {
@@ -2229,7 +2216,7 @@ var DataSpaceManager = class extends Resource4 {
2229
2216
  spaceId: space.id
2230
2217
  }, {
2231
2218
  F: __dxlog_file9,
2232
- L: 336,
2219
+ L: 330,
2233
2220
  S: this,
2234
2221
  C: (f, a) => f(...a)
2235
2222
  });
@@ -2250,7 +2237,7 @@ var DataSpaceManager = class extends Resource4 {
2250
2237
  keys: []
2251
2238
  }
2252
2239
  };
2253
- const propertiesId = ObjectId.random();
2240
+ const propertiesId = createObjectId();
2254
2241
  document.change((doc) => {
2255
2242
  setDeep(doc, [
2256
2243
  "objects",
@@ -2264,14 +2251,14 @@ var DataSpaceManager = class extends Resource4 {
2264
2251
  const automergeIndex = space.automergeSpaceState.rootUrl;
2265
2252
  invariant5(automergeIndex, void 0, {
2266
2253
  F: __dxlog_file9,
2267
- L: 369,
2254
+ L: 363,
2268
2255
  S: this,
2269
2256
  A: [
2270
2257
  "automergeIndex",
2271
2258
  ""
2272
2259
  ]
2273
2260
  });
2274
- const document = await this._echoHost.automergeRepo.find(automergeIndex, FIND_PARAMS);
2261
+ const document = this._echoHost.automergeRepo.find(automergeIndex);
2275
2262
  await document.whenReady();
2276
2263
  return document;
2277
2264
  }
@@ -2281,13 +2268,13 @@ var DataSpaceManager = class extends Resource4 {
2281
2268
  opts
2282
2269
  }, {
2283
2270
  F: __dxlog_file9,
2284
- L: 378,
2271
+ L: 372,
2285
2272
  S: this,
2286
2273
  C: (f, a) => f(...a)
2287
2274
  });
2288
2275
  invariant5(this._lifecycleState === LifecycleState.OPEN, "Not open.", {
2289
2276
  F: __dxlog_file9,
2290
- L: 379,
2277
+ L: 373,
2291
2278
  S: this,
2292
2279
  A: [
2293
2280
  "this._lifecycleState === LifecycleState.OPEN",
@@ -2296,7 +2283,7 @@ var DataSpaceManager = class extends Resource4 {
2296
2283
  });
2297
2284
  invariant5(!this._spaces.has(opts.spaceKey), "Space already exists.", {
2298
2285
  F: __dxlog_file9,
2299
- L: 380,
2286
+ L: 374,
2300
2287
  S: this,
2301
2288
  A: [
2302
2289
  "!this._spaces.has(opts.spaceKey)",
@@ -2320,7 +2307,7 @@ var DataSpaceManager = class extends Resource4 {
2320
2307
  const space = this._spaceManager.spaces.get(options.spaceKey);
2321
2308
  invariant5(space, void 0, {
2322
2309
  F: __dxlog_file9,
2323
- L: 400,
2310
+ L: 394,
2324
2311
  S: this,
2325
2312
  A: [
2326
2313
  "space",
@@ -2333,7 +2320,7 @@ var DataSpaceManager = class extends Resource4 {
2333
2320
  const credentials = await createAdmissionCredentials(this._signingContext.credentialSigner, options.identityKey, space.key, space.genesisFeedKey, options.role, space.spaceState.membershipChainHeads, options.profile, options.delegationCredentialId);
2334
2321
  invariant5(credentials[0].credential, void 0, {
2335
2322
  F: __dxlog_file9,
2336
- L: 419,
2323
+ L: 413,
2337
2324
  S: this,
2338
2325
  A: [
2339
2326
  "credentials[0].credential",
@@ -2343,7 +2330,7 @@ var DataSpaceManager = class extends Resource4 {
2343
2330
  const spaceMemberCredential = credentials[0].credential.credential;
2344
2331
  invariant5(getCredentialAssertion2(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2345
2332
  F: __dxlog_file9,
2346
- L: 421,
2333
+ L: 415,
2347
2334
  S: this,
2348
2335
  A: [
2349
2336
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2381,7 +2368,7 @@ var DataSpaceManager = class extends Resource4 {
2381
2368
  const space = this._spaces.get(spaceKey);
2382
2369
  invariant5(space, "Space not found.", {
2383
2370
  F: __dxlog_file9,
2384
- L: 458,
2371
+ L: 452,
2385
2372
  S: this,
2386
2373
  A: [
2387
2374
  "space",
@@ -2406,7 +2393,7 @@ var DataSpaceManager = class extends Resource4 {
2406
2393
  metadata
2407
2394
  }, {
2408
2395
  F: __dxlog_file9,
2409
- L: 477,
2396
+ L: 471,
2410
2397
  S: this,
2411
2398
  C: (f, a) => f(...a)
2412
2399
  });
@@ -2450,7 +2437,7 @@ var DataSpaceManager = class extends Resource4 {
2450
2437
  err
2451
2438
  }, {
2452
2439
  F: __dxlog_file9,
2453
- L: 519,
2440
+ L: 513,
2454
2441
  S: this,
2455
2442
  C: (f, a) => f(...a)
2456
2443
  });
@@ -2460,7 +2447,7 @@ var DataSpaceManager = class extends Resource4 {
2460
2447
  onAuthFailure: () => {
2461
2448
  log6.warn("auth failure", void 0, {
2462
2449
  F: __dxlog_file9,
2463
- L: 524,
2450
+ L: 518,
2464
2451
  S: this,
2465
2452
  C: (f, a) => f(...a)
2466
2453
  });
@@ -2493,7 +2480,7 @@ var DataSpaceManager = class extends Resource4 {
2493
2480
  space: space.key
2494
2481
  }, {
2495
2482
  F: __dxlog_file9,
2496
- L: 551,
2483
+ L: 545,
2497
2484
  S: this,
2498
2485
  C: (f, a) => f(...a)
2499
2486
  });
@@ -2504,7 +2491,7 @@ var DataSpaceManager = class extends Resource4 {
2504
2491
  open: this._lifecycleState === LifecycleState.OPEN
2505
2492
  }, {
2506
2493
  F: __dxlog_file9,
2507
- L: 554,
2494
+ L: 548,
2508
2495
  S: this,
2509
2496
  C: (f, a) => f(...a)
2510
2497
  });
@@ -2523,7 +2510,7 @@ var DataSpaceManager = class extends Resource4 {
2523
2510
  space: space.key
2524
2511
  }, {
2525
2512
  F: __dxlog_file9,
2526
- L: 562,
2513
+ L: 556,
2527
2514
  S: this,
2528
2515
  C: (f, a) => f(...a)
2529
2516
  });
@@ -2544,7 +2531,7 @@ var DataSpaceManager = class extends Resource4 {
2544
2531
  spaceId: dataSpace.id
2545
2532
  }, {
2546
2533
  F: __dxlog_file9,
2547
- L: 576,
2534
+ L: 570,
2548
2535
  S: this,
2549
2536
  C: (f, a) => f(...a)
2550
2537
  });
@@ -2574,7 +2561,7 @@ var DataSpaceManager = class extends Resource4 {
2574
2561
  space: space.key
2575
2562
  }, {
2576
2563
  F: __dxlog_file9,
2577
- L: 603,
2564
+ L: 597,
2578
2565
  S: this,
2579
2566
  C: (f, a) => f(...a)
2580
2567
  });
@@ -2607,7 +2594,7 @@ var DataSpaceManager = class extends Resource4 {
2607
2594
  closedSessions
2608
2595
  }, {
2609
2596
  F: __dxlog_file9,
2610
- L: 629,
2597
+ L: 623,
2611
2598
  S: this,
2612
2599
  C: (f, a) => f(...a)
2613
2600
  });
@@ -2622,7 +2609,7 @@ var DataSpaceManager = class extends Resource4 {
2622
2609
  peerId: peerState.peerId
2623
2610
  }, {
2624
2611
  F: __dxlog_file9,
2625
- L: 643,
2612
+ L: 637,
2626
2613
  S: this,
2627
2614
  C: (f, a) => f(...a)
2628
2615
  });
@@ -2767,7 +2754,7 @@ var extractSpaceArchive = async (archive) => {
2767
2754
  const documentId = entry2.fileName.replace(`${SpaceArchiveFileStructure2.documents}/`, "").replace(/\.bin$/, "");
2768
2755
  invariant6(!documentId.includes("/"), void 0, {
2769
2756
  F: __dxlog_file10,
2770
- L: 28,
2757
+ L: 27,
2771
2758
  S: void 0,
2772
2759
  A: [
2773
2760
  "!documentId.includes('/')",
@@ -2781,7 +2768,7 @@ var extractSpaceArchive = async (archive) => {
2781
2768
  documents
2782
2769
  }, {
2783
2770
  F: __dxlog_file10,
2784
- L: 32,
2771
+ L: 31,
2785
2772
  S: void 0,
2786
2773
  C: (f, a) => f(...a)
2787
2774
  });
@@ -2902,7 +2889,7 @@ var SpacesServiceImpl = class {
2902
2889
  const credentials = await createAdmissionCredentials2(identity.getIdentityCredentialSigner(), request.memberKey, space.key, space.genesisFeedKey, request.newRole, space.spaceState.membershipChainHeads);
2903
2890
  invariant7(credentials[0].credential, void 0, {
2904
2891
  F: __dxlog_file11,
2905
- L: 119,
2892
+ L: 118,
2906
2893
  S: this,
2907
2894
  A: [
2908
2895
  "credentials[0].credential",
@@ -2912,7 +2899,7 @@ var SpacesServiceImpl = class {
2912
2899
  const spaceMemberCredential = credentials[0].credential.credential;
2913
2900
  invariant7(getCredentialAssertion3(spaceMemberCredential)["@type"] === "dxos.halo.credentials.SpaceMember", void 0, {
2914
2901
  F: __dxlog_file11,
2915
- L: 121,
2902
+ L: 120,
2916
2903
  S: this,
2917
2904
  A: [
2918
2905
  "getCredentialAssertion(spaceMemberCredential)['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -2930,7 +2917,7 @@ var SpacesServiceImpl = class {
2930
2917
  ids: spaces.map((space) => space.id)
2931
2918
  }), {
2932
2919
  F: __dxlog_file11,
2933
- L: 134,
2920
+ L: 133,
2934
2921
  S: this,
2935
2922
  C: (f, a) => f(...a)
2936
2923
  });
@@ -3022,7 +3009,7 @@ var SpacesServiceImpl = class {
3022
3009
  } else {
3023
3010
  invariant7(!credential.id, "Id on unsigned credentials is not allowed", {
3024
3011
  F: __dxlog_file11,
3025
- L: 232,
3012
+ L: 231,
3026
3013
  S: this,
3027
3014
  A: [
3028
3015
  "!credential.id",
@@ -3031,7 +3018,7 @@ var SpacesServiceImpl = class {
3031
3018
  });
3032
3019
  invariant7(this._identityManager.identity, "Identity is not available", {
3033
3020
  F: __dxlog_file11,
3034
- L: 233,
3021
+ L: 232,
3035
3022
  S: this,
3036
3023
  A: [
3037
3024
  "this._identityManager.identity",
@@ -3041,7 +3028,7 @@ var SpacesServiceImpl = class {
3041
3028
  const signer = this._identityManager.identity.getIdentityCredentialSigner();
3042
3029
  invariant7(credential.issuer.equals(signer.getIssuer()), void 0, {
3043
3030
  F: __dxlog_file11,
3044
- L: 235,
3031
+ L: 234,
3045
3032
  S: this,
3046
3033
  A: [
3047
3034
  "credential.issuer.equals(signer.getIssuer())",
@@ -3118,7 +3105,7 @@ var SpacesServiceImpl = class {
3118
3105
  const extracted = await extractSpaceArchive(request.archive);
3119
3106
  invariant7(extracted.metadata.echo?.currentRootUrl, "Space archive does not contain a root URL", {
3120
3107
  F: __dxlog_file11,
3121
- L: 289,
3108
+ L: 288,
3122
3109
  S: this,
3123
3110
  A: [
3124
3111
  "extracted.metadata.echo?.currentRootUrl",
@@ -3138,7 +3125,7 @@ var SpacesServiceImpl = class {
3138
3125
  const assertion = getCredentialAssertion3(credential);
3139
3126
  invariant7(assertion["@type"] === "dxos.halo.credentials.SpaceMember", "Invalid credential", {
3140
3127
  F: __dxlog_file11,
3141
- L: 300,
3128
+ L: 299,
3142
3129
  S: this,
3143
3130
  A: [
3144
3131
  "assertion['@type'] === 'dxos.halo.credentials.SpaceMember'",
@@ -3148,7 +3135,7 @@ var SpacesServiceImpl = class {
3148
3135
  const myIdentity = this._identityManager.identity;
3149
3136
  invariant7(myIdentity && credential.subject.id.equals(myIdentity.identityKey), void 0, {
3150
3137
  F: __dxlog_file11,
3151
- L: 302,
3138
+ L: 301,
3152
3139
  S: this,
3153
3140
  A: [
3154
3141
  "myIdentity && credential.subject.id.equals(myIdentity.identityKey)",
@@ -4213,7 +4200,7 @@ var DataSpace = class {
4213
4200
  constructor(params) {
4214
4201
  this._ctx = new Context6(void 0, {
4215
4202
  F: __dxlog_file15,
4216
- L: 100
4203
+ L: 97
4217
4204
  });
4218
4205
  this._cache = void 0;
4219
4206
  this._edgeFeedReplicator = void 0;
@@ -4266,7 +4253,7 @@ var DataSpace = class {
4266
4253
  state: SpaceState4[this._state]
4267
4254
  }, {
4268
4255
  F: __dxlog_file15,
4269
- L: 176,
4256
+ L: 173,
4270
4257
  S: this,
4271
4258
  C: (f, a) => f(...a)
4272
4259
  });
@@ -4325,7 +4312,7 @@ var DataSpace = class {
4325
4312
  }
4326
4313
  await this._inner.open(new Context6(void 0, {
4327
4314
  F: __dxlog_file15,
4328
- L: 250
4315
+ L: 247
4329
4316
  }));
4330
4317
  await this._inner.startProtocol();
4331
4318
  await this._edgeFeedReplicator?.open();
@@ -4334,7 +4321,7 @@ var DataSpace = class {
4334
4321
  state: SpaceState4[this._state]
4335
4322
  }, {
4336
4323
  F: __dxlog_file15,
4337
- L: 256,
4324
+ L: 253,
4338
4325
  S: this,
4339
4326
  C: (f, a) => f(...a)
4340
4327
  });
@@ -4354,14 +4341,14 @@ var DataSpace = class {
4354
4341
  state: SpaceState4[this._state]
4355
4342
  }, {
4356
4343
  F: __dxlog_file15,
4357
- L: 275,
4344
+ L: 272,
4358
4345
  S: this,
4359
4346
  C: (f, a) => f(...a)
4360
4347
  });
4361
4348
  await this._ctx.dispose();
4362
4349
  this._ctx = new Context6(void 0, {
4363
4350
  F: __dxlog_file15,
4364
- L: 277
4351
+ L: 274
4365
4352
  });
4366
4353
  if (this._edgeFeedReplicator) {
4367
4354
  this.inner.protocol.feedAdded.remove(this._onFeedAdded);
@@ -4394,7 +4381,7 @@ var DataSpace = class {
4394
4381
  if (err instanceof CancelledError || err instanceof ContextDisposedError) {
4395
4382
  log12("data pipeline initialization cancelled", err, {
4396
4383
  F: __dxlog_file15,
4397
- L: 315,
4384
+ L: 312,
4398
4385
  S: this,
4399
4386
  C: (f, a) => f(...a)
4400
4387
  });
@@ -4402,7 +4389,7 @@ var DataSpace = class {
4402
4389
  }
4403
4390
  log12.error("Error initializing data pipeline", err, {
4404
4391
  F: __dxlog_file15,
4405
- L: 319,
4392
+ L: 316,
4406
4393
  S: this,
4407
4394
  C: (f, a) => f(...a)
4408
4395
  });
@@ -4411,7 +4398,7 @@ var DataSpace = class {
4411
4398
  state: SpaceState4[this._state]
4412
4399
  }, {
4413
4400
  F: __dxlog_file15,
4414
- L: 321,
4401
+ L: 318,
4415
4402
  S: this,
4416
4403
  C: (f, a) => f(...a)
4417
4404
  });
@@ -4431,13 +4418,13 @@ var DataSpace = class {
4431
4418
  state: SpaceState4[this._state]
4432
4419
  }, {
4433
4420
  F: __dxlog_file15,
4434
- L: 337,
4421
+ L: 334,
4435
4422
  S: this,
4436
4423
  C: (f, a) => f(...a)
4437
4424
  });
4438
4425
  log12("initializing control pipeline", void 0, {
4439
4426
  F: __dxlog_file15,
4440
- L: 339,
4427
+ L: 336,
4441
4428
  S: this,
4442
4429
  C: (f, a) => f(...a)
4443
4430
  });
@@ -4446,21 +4433,21 @@ var DataSpace = class {
4446
4433
  const ready = this.stateUpdate.waitForCondition(() => this._state === SpaceState4.SPACE_READY);
4447
4434
  log12("initializing automerge root", void 0, {
4448
4435
  F: __dxlog_file15,
4449
- L: 347,
4436
+ L: 344,
4450
4437
  S: this,
4451
4438
  C: (f, a) => f(...a)
4452
4439
  });
4453
4440
  this._automergeSpaceState.startProcessingRootDocs();
4454
4441
  log12("waiting for space to be ready", void 0, {
4455
4442
  F: __dxlog_file15,
4456
- L: 351,
4443
+ L: 348,
4457
4444
  S: this,
4458
4445
  C: (f, a) => f(...a)
4459
4446
  });
4460
4447
  await ready;
4461
4448
  log12("space is ready", void 0, {
4462
4449
  F: __dxlog_file15,
4463
- L: 353,
4450
+ L: 350,
4464
4451
  S: this,
4465
4452
  C: (f, a) => f(...a)
4466
4453
  });
@@ -4468,14 +4455,14 @@ var DataSpace = class {
4468
4455
  async *getAllDocuments() {
4469
4456
  invariant11(this._databaseRoot, "Space is not ready", {
4470
4457
  F: __dxlog_file15,
4471
- L: 357,
4458
+ L: 354,
4472
4459
  S: this,
4473
4460
  A: [
4474
4461
  "this._databaseRoot",
4475
4462
  "'Space is not ready'"
4476
4463
  ]
4477
4464
  });
4478
- const doc = this._databaseRoot.doc() ?? failedInvariant3();
4465
+ const doc = this._databaseRoot.docSync() ?? failedInvariant3();
4479
4466
  const root = save(doc);
4480
4467
  yield [
4481
4468
  this._databaseRoot.documentId,
@@ -4484,7 +4471,7 @@ var DataSpace = class {
4484
4471
  for (const documentUrl of this._databaseRoot.getAllLinkedDocuments()) {
4485
4472
  const data = await this._echoHost.exportDoc(Context6.default(void 0, {
4486
4473
  F: __dxlog_file15,
4487
- L: 363
4474
+ L: 360
4488
4475
  }), documentUrl);
4489
4476
  yield [
4490
4477
  documentUrl.replace(/^automerge:/, ""),
@@ -4499,7 +4486,7 @@ var DataSpace = class {
4499
4486
  state: SpaceState4[this._state]
4500
4487
  }, {
4501
4488
  F: __dxlog_file15,
4502
- L: 372,
4489
+ L: 369,
4503
4490
  S: this,
4504
4491
  C: (f, a) => f(...a)
4505
4492
  });
@@ -4516,7 +4503,7 @@ var DataSpace = class {
4516
4503
  await this._createWritableFeeds();
4517
4504
  log12("writable feeds created", void 0, {
4518
4505
  F: __dxlog_file15,
4519
- L: 389,
4506
+ L: 386,
4520
4507
  S: this,
4521
4508
  C: (f, a) => f(...a)
4522
4509
  });
@@ -4570,7 +4557,7 @@ var DataSpace = class {
4570
4557
  count: credentials.length
4571
4558
  }, {
4572
4559
  F: __dxlog_file15,
4573
- L: 447,
4560
+ L: 444,
4574
4561
  S: this,
4575
4562
  C: (f, a) => f(...a)
4576
4563
  });
@@ -4581,14 +4568,14 @@ var DataSpace = class {
4581
4568
  });
4582
4569
  log12("credentials notarized", void 0, {
4583
4570
  F: __dxlog_file15,
4584
- L: 451,
4571
+ L: 448,
4585
4572
  S: this,
4586
4573
  C: (f, a) => f(...a)
4587
4574
  });
4588
4575
  } catch (err) {
4589
4576
  log12.error("error notarizing credentials for feed admission", err, {
4590
4577
  F: __dxlog_file15,
4591
- L: 453,
4578
+ L: 450,
4592
4579
  S: this,
4593
4580
  C: (f, a) => f(...a)
4594
4581
  });
@@ -4603,17 +4590,16 @@ var DataSpace = class {
4603
4590
  rootUrl
4604
4591
  }, {
4605
4592
  F: __dxlog_file15,
4606
- L: 463,
4593
+ L: 460,
4607
4594
  S: this,
4608
4595
  C: (f, a) => f(...a)
4609
4596
  });
4610
- let handle;
4597
+ const handle = this._echoHost.automergeRepo.find(rootUrl);
4611
4598
  queueMicrotask(async () => {
4612
4599
  try {
4613
4600
  try {
4614
4601
  var _usingCtx = _using_ctx3();
4615
4602
  await warnAfterTimeout(5e3, "Automerge root doc load timeout (DataSpace)", async () => {
4616
- handle = await cancelWithContext2(this._ctx, this._echoHost.automergeRepo.find(rootUrl, FIND_PARAMS2));
4617
4603
  await cancelWithContext2(this._ctx, handle.whenReady());
4618
4604
  });
4619
4605
  if (this._ctx.disposed) {
@@ -4623,7 +4609,7 @@ var DataSpace = class {
4623
4609
  // Ensure only one root is processed at a time.
4624
4610
  _usingCtx.u(await this._epochProcessingMutex.acquire())
4625
4611
  );
4626
- const doc = handle.doc() ?? failedInvariant3();
4612
+ const doc = handle.docSync() ?? failedInvariant3();
4627
4613
  if (!doc.access?.spaceKey) {
4628
4614
  handle.change((doc2) => {
4629
4615
  doc2.access = {
@@ -4656,7 +4642,7 @@ var DataSpace = class {
4656
4642
  err
4657
4643
  }, {
4658
4644
  F: __dxlog_file15,
4659
- L: 510,
4645
+ L: 503,
4660
4646
  S: this,
4661
4647
  C: (f, a) => f(...a)
4662
4648
  });
@@ -4746,7 +4732,7 @@ var DataSpace = class {
4746
4732
  state: SpaceState4[this._state]
4747
4733
  }, {
4748
4734
  F: __dxlog_file15,
4749
- L: 592,
4735
+ L: 585,
4750
4736
  S: this,
4751
4737
  C: (f, a) => f(...a)
4752
4738
  });
@@ -7517,22 +7503,28 @@ _ts_decorate9([
7517
7503
  // packages/sdk/client-services/src/packlets/agents/edge-agent-service.ts
7518
7504
  import { Stream as Stream11 } from "@dxos/codec-protobuf/stream";
7519
7505
  import { EdgeAgentStatus as EdgeAgentStatus2 } from "@dxos/protocols";
7520
- import { QueryAgentStatusResponse, EdgeStatus as EdgeStatus2 } from "@dxos/protocols/proto/dxos/client/services";
7506
+ import { QueryAgentStatusResponse, QueryEdgeStatusResponse } from "@dxos/protocols/proto/dxos/client/services";
7521
7507
  var EdgeAgentServiceImpl = class {
7522
7508
  constructor(_agentManagerProvider, _edgeConnection) {
7523
7509
  this._agentManagerProvider = _agentManagerProvider;
7524
7510
  this._edgeConnection = _edgeConnection;
7525
7511
  }
7526
- // TODO(mykola): Reconcile with NetworkService.queryStatus.
7527
7512
  queryEdgeStatus() {
7528
7513
  return new Stream11(({ ctx, next }) => {
7529
- const update = () => {
7530
- next({
7531
- status: this._edgeConnection?.status ?? EdgeStatus2.NOT_CONNECTED
7532
- });
7533
- };
7534
- this._edgeConnection?.statusChanged.on(ctx, update);
7535
- update();
7514
+ next({
7515
+ status: QueryEdgeStatusResponse.EdgeStatus.NOT_CONNECTED
7516
+ });
7517
+ if (!this._edgeConnection) {
7518
+ return;
7519
+ }
7520
+ ctx.onDispose(
7521
+ // TODO(wittjosiah): EdgeConnection should include a disconnected event as well.
7522
+ this._edgeConnection.onReconnected(() => {
7523
+ next({
7524
+ status: QueryEdgeStatusResponse.EdgeStatus.CONNECTED
7525
+ });
7526
+ })
7527
+ );
7536
7528
  });
7537
7529
  }
7538
7530
  async createAgent() {
@@ -8347,7 +8339,7 @@ var createLevel = async (config) => {
8347
8339
  };
8348
8340
 
8349
8341
  // packages/sdk/client-services/src/packlets/storage/profile-archive.ts
8350
- import { cbor } from "@automerge/automerge-repo";
8342
+ import { cbor } from "@dxos/automerge/automerge-repo";
8351
8343
  import { invariant as invariant24 } from "@dxos/invariant";
8352
8344
  import { log as log25 } from "@dxos/log";
8353
8345
  import { ProfileArchiveEntryType } from "@dxos/protocols";
@@ -8369,7 +8361,7 @@ var exportProfileData = async ({ storage, level }) => {
8369
8361
  count: files.length
8370
8362
  }, {
8371
8363
  F: __dxlog_file29,
8372
- L: 31,
8364
+ L: 30,
8373
8365
  S: void 0,
8374
8366
  C: (f, a) => f(...a)
8375
8367
  });
@@ -8387,7 +8379,7 @@ var exportProfileData = async ({ storage, level }) => {
8387
8379
  count: files.length
8388
8380
  }, {
8389
8381
  F: __dxlog_file29,
8390
- L: 42,
8382
+ L: 41,
8391
8383
  S: void 0,
8392
8384
  C: (f, a) => f(...a)
8393
8385
  });
@@ -8395,7 +8387,7 @@ var exportProfileData = async ({ storage, level }) => {
8395
8387
  {
8396
8388
  log25.info("begin exporting kv pairs", void 0, {
8397
8389
  F: __dxlog_file29,
8398
- L: 46,
8390
+ L: 45,
8399
8391
  S: void 0,
8400
8392
  C: (f, a) => f(...a)
8401
8393
  });
@@ -8416,7 +8408,7 @@ var exportProfileData = async ({ storage, level }) => {
8416
8408
  count
8417
8409
  }, {
8418
8410
  F: __dxlog_file29,
8419
- L: 57,
8411
+ L: 56,
8420
8412
  S: void 0,
8421
8413
  C: (f, a) => f(...a)
8422
8414
  });
@@ -8432,7 +8424,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8432
8424
  const directory = await storage.createDirectory();
8433
8425
  invariant24(typeof entry2.key === "string", "Invalid key type", {
8434
8426
  F: __dxlog_file29,
8435
- L: 80,
8427
+ L: 79,
8436
8428
  S: void 0,
8437
8429
  A: [
8438
8430
  "typeof entry.key === 'string'",
@@ -8442,7 +8434,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8442
8434
  const file = await directory.getOrCreateFile(entry2.key);
8443
8435
  invariant24(entry2.value instanceof Uint8Array, "Invalid value type", {
8444
8436
  F: __dxlog_file29,
8445
- L: 82,
8437
+ L: 81,
8446
8438
  S: void 0,
8447
8439
  A: [
8448
8440
  "entry.value instanceof Uint8Array",
@@ -8456,7 +8448,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8456
8448
  case ProfileArchiveEntryType.KEY_VALUE: {
8457
8449
  invariant24(entry2.key instanceof Uint8Array, "Invalid key type", {
8458
8450
  F: __dxlog_file29,
8459
- L: 88,
8451
+ L: 87,
8460
8452
  S: void 0,
8461
8453
  A: [
8462
8454
  "entry.key instanceof Uint8Array",
@@ -8465,7 +8457,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8465
8457
  });
8466
8458
  invariant24(entry2.value instanceof Uint8Array, "Invalid value type", {
8467
8459
  F: __dxlog_file29,
8468
- L: 89,
8460
+ L: 88,
8469
8461
  S: void 0,
8470
8462
  A: [
8471
8463
  "entry.value instanceof Uint8Array",
@@ -8490,7 +8482,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8490
8482
  progress: `${(count / archive.storage.length * 100).toFixed()}%`
8491
8483
  }, {
8492
8484
  F: __dxlog_file29,
8493
- L: 102,
8485
+ L: 101,
8494
8486
  S: void 0,
8495
8487
  C: (f, a) => f(...a)
8496
8488
  });
@@ -8498,7 +8490,7 @@ var importProfileData = async ({ storage, level }, archive) => {
8498
8490
  }
8499
8491
  log25.info("committing changes..", void 0, {
8500
8492
  F: __dxlog_file29,
8501
- L: 110,
8493
+ L: 109,
8502
8494
  S: void 0,
8503
8495
  C: (f, a) => f(...a)
8504
8496
  });
@@ -8524,7 +8516,7 @@ import { WebsocketRpcClient } from "@dxos/websocket-rpc";
8524
8516
  import { SubscriptionList as SubscriptionList3 } from "@dxos/async";
8525
8517
  import { Stream as Stream12 } from "@dxos/codec-protobuf/stream";
8526
8518
  import { invariant as invariant25 } from "@dxos/invariant";
8527
- import { Device as Device2, DeviceKind as DeviceKind2, EdgeStatus as EdgeStatus3 } from "@dxos/protocols/proto/dxos/client/services";
8519
+ import { Device as Device2, DeviceKind as DeviceKind2 } from "@dxos/protocols/proto/dxos/client/services";
8528
8520
  var __dxlog_file30 = "/home/runner/work/dxos/dxos/packages/sdk/client-services/src/packlets/devices/devices-service.ts";
8529
8521
  var DevicesServiceImpl = class {
8530
8522
  constructor(_identityManager, _edgeConnection) {
@@ -8545,7 +8537,7 @@ var DevicesServiceImpl = class {
8545
8537
  } else {
8546
8538
  invariant25(this._identityManager.identity?.presence, "presence not present", {
8547
8539
  F: __dxlog_file30,
8548
- L: 37,
8540
+ L: 36,
8549
8541
  S: this,
8550
8542
  A: [
8551
8543
  "this._identityManager.identity?.presence",
@@ -8560,7 +8552,7 @@ var DevicesServiceImpl = class {
8560
8552
  if (isMe) {
8561
8553
  presence = Device2.PresenceState.ONLINE;
8562
8554
  } else if (profile.os?.toUpperCase() === "EDGE") {
8563
- presence = this._edgeConnection?.status === EdgeStatus3.CONNECTED ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
8555
+ presence = this._edgeConnection?.isConnected ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
8564
8556
  } else {
8565
8557
  presence = peers.some((peer) => peer.identityKey.equals(key)) ? Device2.PresenceState.ONLINE : Device2.PresenceState.OFFLINE;
8566
8558
  }
@@ -8820,13 +8812,12 @@ var LOG_PROCESSING = 0;
8820
8812
  // packages/sdk/client-services/src/packlets/network/network-service.ts
8821
8813
  import { Stream as Stream15 } from "@dxos/codec-protobuf/stream";
8822
8814
  var NetworkServiceImpl = class {
8823
- constructor(networkManager, signalManager, edgeConnection) {
8815
+ constructor(networkManager, signalManager) {
8824
8816
  this.networkManager = networkManager;
8825
8817
  this.signalManager = signalManager;
8826
- this.edgeConnection = edgeConnection;
8827
8818
  }
8828
8819
  queryStatus() {
8829
- return new Stream15(({ ctx, next }) => {
8820
+ return new Stream15(({ next }) => {
8830
8821
  const update = () => {
8831
8822
  next({
8832
8823
  swarm: this.networkManager.connectionState,
@@ -8837,9 +8828,13 @@ var NetworkServiceImpl = class {
8837
8828
  }))
8838
8829
  });
8839
8830
  };
8840
- this.networkManager.connectionStateChanged.on(ctx, () => update());
8841
- this.signalManager.statusChanged?.on(ctx, () => update());
8831
+ const unsubscribeSwarm = this.networkManager.connectionStateChanged.on(() => update());
8832
+ const unsubscribeSignal = this.signalManager.statusChanged?.on(() => update());
8842
8833
  update();
8834
+ return () => {
8835
+ unsubscribeSwarm();
8836
+ unsubscribeSignal?.();
8837
+ };
8843
8838
  });
8844
8839
  }
8845
8840
  async updateConfig(request) {
@@ -8855,24 +8850,26 @@ var NetworkServiceImpl = class {
8855
8850
  return this.signalManager.query(request);
8856
8851
  }
8857
8852
  subscribeSwarmState(request) {
8858
- return new Stream15(({ ctx, next }) => {
8859
- this.signalManager.swarmState?.on(ctx, (state) => {
8853
+ return new Stream15(({ next }) => {
8854
+ const unsubscribe = this.signalManager.swarmState?.on((state) => {
8860
8855
  if (request.topic.equals(state.swarmKey)) {
8861
8856
  next(state);
8862
8857
  }
8863
8858
  });
8859
+ return unsubscribe;
8864
8860
  });
8865
8861
  }
8866
8862
  async sendMessage(message) {
8867
8863
  return this.signalManager.sendMessage(message);
8868
8864
  }
8869
8865
  subscribeMessages(peer) {
8870
- return new Stream15(({ ctx, next }) => {
8871
- this.signalManager.onMessage.on(ctx, (message) => {
8866
+ return new Stream15(({ next }) => {
8867
+ const unsubscribe = this.signalManager.onMessage.on((message) => {
8872
8868
  if (message.recipient.peerKey === peer.peerKey) {
8873
8869
  next(message);
8874
8870
  }
8875
8871
  });
8872
+ return unsubscribe;
8876
8873
  });
8877
8874
  }
8878
8875
  };
@@ -9197,7 +9194,7 @@ var ClientServicesHost = class {
9197
9194
  SpacesService: new SpacesServiceImpl(this._serviceContext.identityManager, this._serviceContext.spaceManager, dataSpaceManagerProvider),
9198
9195
  DataService: this._serviceContext.echoHost.dataService,
9199
9196
  QueryService: this._serviceContext.echoHost.queryService,
9200
- NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager, this._edgeConnection),
9197
+ NetworkService: new NetworkServiceImpl(this._serviceContext.networkManager, this._serviceContext.signalManager),
9201
9198
  LoggingService: this._loggingService,
9202
9199
  TracingService: this._tracingService,
9203
9200
  // TODO(burdon): Move to new protobuf definitions.
@@ -9229,7 +9226,7 @@ var ClientServicesHost = class {
9229
9226
  deviceKey
9230
9227
  }, {
9231
9228
  F: __dxlog_file31,
9232
- L: 370,
9229
+ L: 366,
9233
9230
  S: this,
9234
9231
  C: (f, a) => f(...a)
9235
9232
  });
@@ -9237,7 +9234,7 @@ var ClientServicesHost = class {
9237
9234
  id: traceId
9238
9235
  }), {
9239
9236
  F: __dxlog_file31,
9240
- L: 371,
9237
+ L: 367,
9241
9238
  S: this,
9242
9239
  C: (f, a) => f(...a)
9243
9240
  });
@@ -9251,7 +9248,7 @@ var ClientServicesHost = class {
9251
9248
  deviceKey
9252
9249
  }, {
9253
9250
  F: __dxlog_file31,
9254
- L: 382,
9251
+ L: 378,
9255
9252
  S: this,
9256
9253
  C: (f, a) => f(...a)
9257
9254
  });
@@ -9269,7 +9266,7 @@ var ClientServicesHost = class {
9269
9266
  deviceKey
9270
9267
  }, {
9271
9268
  F: __dxlog_file31,
9272
- L: 391,
9269
+ L: 387,
9273
9270
  S: this,
9274
9271
  C: (f, a) => f(...a)
9275
9272
  });
@@ -9280,13 +9277,13 @@ var ClientServicesHost = class {
9280
9277
  id: traceId
9281
9278
  }), {
9282
9279
  F: __dxlog_file31,
9283
- L: 396,
9280
+ L: 392,
9284
9281
  S: this,
9285
9282
  C: (f, a) => f(...a)
9286
9283
  });
9287
9284
  log27.info("resetting...", void 0, {
9288
9285
  F: __dxlog_file31,
9289
- L: 398,
9286
+ L: 394,
9290
9287
  S: this,
9291
9288
  C: (f, a) => f(...a)
9292
9289
  });
@@ -9296,7 +9293,7 @@ var ClientServicesHost = class {
9296
9293
  await this._storage.reset();
9297
9294
  log27.info("reset", void 0, {
9298
9295
  F: __dxlog_file31,
9299
- L: 405,
9296
+ L: 401,
9300
9297
  S: this,
9301
9298
  C: (f, a) => f(...a)
9302
9299
  });
@@ -9304,7 +9301,7 @@ var ClientServicesHost = class {
9304
9301
  id: traceId
9305
9302
  }), {
9306
9303
  F: __dxlog_file31,
9307
- L: 406,
9304
+ L: 402,
9308
9305
  S: this,
9309
9306
  C: (f, a) => f(...a)
9310
9307
  });
@@ -9382,4 +9379,4 @@ export {
9382
9379
  importProfileData,
9383
9380
  ClientServicesHost
9384
9381
  };
9385
- //# sourceMappingURL=chunk-XNCWQTDB.mjs.map
9382
+ //# sourceMappingURL=chunk-DQCPFIVI.mjs.map