@dxos/echo-pipeline 0.5.9-main.1c1903d → 0.5.9-main.1cc8373

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 (32) hide show
  1. package/dist/lib/browser/{chunk-I2J5TTHJ.mjs → chunk-HS77A4I4.mjs} +174 -23
  2. package/dist/lib/browser/{chunk-I2J5TTHJ.mjs.map → chunk-HS77A4I4.mjs.map} +4 -4
  3. package/dist/lib/browser/index.mjs +50 -52
  4. package/dist/lib/browser/index.mjs.map +3 -3
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/testing/index.mjs +11 -7
  7. package/dist/lib/browser/testing/index.mjs.map +1 -1
  8. package/dist/lib/node/{chunk-QPCNQ4ZK.cjs → chunk-Y5U7UXEL.cjs} +185 -34
  9. package/dist/lib/node/{chunk-QPCNQ4ZK.cjs.map → chunk-Y5U7UXEL.cjs.map} +4 -4
  10. package/dist/lib/node/index.cjs +82 -84
  11. package/dist/lib/node/index.cjs.map +3 -3
  12. package/dist/lib/node/meta.json +1 -1
  13. package/dist/lib/node/testing/index.cjs +21 -17
  14. package/dist/lib/node/testing/index.cjs.map +1 -1
  15. package/dist/types/src/automerge/automerge-doc-loader.d.ts.map +1 -1
  16. package/dist/types/src/automerge/automerge-host.d.ts +0 -1
  17. package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
  18. package/dist/types/src/automerge/mesh-echo-replicator.d.ts.map +1 -1
  19. package/dist/types/src/space/admission-discovery-extension.d.ts +30 -0
  20. package/dist/types/src/space/admission-discovery-extension.d.ts.map +1 -0
  21. package/dist/types/src/space/index.d.ts +1 -0
  22. package/dist/types/src/space/index.d.ts.map +1 -1
  23. package/dist/types/src/space/space-manager.d.ts +8 -0
  24. package/dist/types/src/space/space-manager.d.ts.map +1 -1
  25. package/package.json +33 -33
  26. package/src/automerge/automerge-doc-loader.test.ts +2 -3
  27. package/src/automerge/automerge-doc-loader.ts +4 -2
  28. package/src/automerge/automerge-host.ts +0 -14
  29. package/src/automerge/mesh-echo-replicator.ts +6 -1
  30. package/src/space/admission-discovery-extension.ts +90 -0
  31. package/src/space/index.ts +1 -0
  32. package/src/space/space-manager.ts +46 -1
@@ -18,45 +18,46 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var node_exports = {};
20
20
  __export(node_exports, {
21
- AuthExtension: () => import_chunk_QPCNQ4ZK.AuthExtension,
22
- AuthStatus: () => import_chunk_QPCNQ4ZK.AuthStatus,
21
+ AuthExtension: () => import_chunk_Y5U7UXEL.AuthExtension,
22
+ AuthStatus: () => import_chunk_Y5U7UXEL.AuthStatus,
23
23
  AutomergeDocumentLoaderImpl: () => AutomergeDocumentLoaderImpl,
24
24
  AutomergeHost: () => AutomergeHost,
25
- DataServiceImpl: () => import_chunk_QPCNQ4ZK.DataServiceImpl,
25
+ CredentialRetrieverExtension: () => import_chunk_Y5U7UXEL.CredentialRetrieverExtension,
26
+ CredentialServerExtension: () => import_chunk_Y5U7UXEL.CredentialServerExtension,
27
+ DataServiceImpl: () => import_chunk_Y5U7UXEL.DataServiceImpl,
26
28
  LevelDBStorageAdapter: () => LevelDBStorageAdapter,
27
29
  LocalHostNetworkAdapter: () => LocalHostNetworkAdapter,
28
- MOCK_AUTH_PROVIDER: () => import_chunk_QPCNQ4ZK.MOCK_AUTH_PROVIDER,
29
- MOCK_AUTH_VERIFIER: () => import_chunk_QPCNQ4ZK.MOCK_AUTH_VERIFIER,
30
+ MOCK_AUTH_PROVIDER: () => import_chunk_Y5U7UXEL.MOCK_AUTH_PROVIDER,
31
+ MOCK_AUTH_VERIFIER: () => import_chunk_Y5U7UXEL.MOCK_AUTH_VERIFIER,
30
32
  MeshEchoReplicator: () => MeshEchoReplicator,
31
- MetadataStore: () => import_chunk_QPCNQ4ZK.MetadataStore,
32
- Pipeline: () => import_chunk_QPCNQ4ZK.Pipeline,
33
- SnapshotManager: () => import_chunk_QPCNQ4ZK.SnapshotManager,
34
- SnapshotStore: () => import_chunk_QPCNQ4ZK.SnapshotStore,
35
- Space: () => import_chunk_QPCNQ4ZK.Space,
36
- SpaceManager: () => import_chunk_QPCNQ4ZK.SpaceManager,
37
- SpaceProtocol: () => import_chunk_QPCNQ4ZK.SpaceProtocol,
38
- SpaceProtocolSession: () => import_chunk_QPCNQ4ZK.SpaceProtocolSession,
39
- TimeframeClock: () => import_chunk_QPCNQ4ZK.TimeframeClock,
40
- codec: () => import_chunk_QPCNQ4ZK.codec,
41
- createIdFromSpaceKey: () => import_chunk_QPCNQ4ZK.createIdFromSpaceKey,
42
- createMappedFeedWriter: () => import_chunk_QPCNQ4ZK.createMappedFeedWriter,
33
+ MetadataStore: () => import_chunk_Y5U7UXEL.MetadataStore,
34
+ Pipeline: () => import_chunk_Y5U7UXEL.Pipeline,
35
+ SnapshotManager: () => import_chunk_Y5U7UXEL.SnapshotManager,
36
+ SnapshotStore: () => import_chunk_Y5U7UXEL.SnapshotStore,
37
+ Space: () => import_chunk_Y5U7UXEL.Space,
38
+ SpaceManager: () => import_chunk_Y5U7UXEL.SpaceManager,
39
+ SpaceProtocol: () => import_chunk_Y5U7UXEL.SpaceProtocol,
40
+ SpaceProtocolSession: () => import_chunk_Y5U7UXEL.SpaceProtocolSession,
41
+ TimeframeClock: () => import_chunk_Y5U7UXEL.TimeframeClock,
42
+ codec: () => import_chunk_Y5U7UXEL.codec,
43
+ createIdFromSpaceKey: () => import_chunk_Y5U7UXEL.createIdFromSpaceKey,
44
+ createMappedFeedWriter: () => import_chunk_Y5U7UXEL.createMappedFeedWriter,
43
45
  encodingOptions: () => encodingOptions,
44
46
  getSpaceKeyFromDoc: () => getSpaceKeyFromDoc,
45
- hasInvitationExpired: () => import_chunk_QPCNQ4ZK.hasInvitationExpired,
46
- mapFeedIndexesToTimeframe: () => import_chunk_QPCNQ4ZK.mapFeedIndexesToTimeframe,
47
- mapTimeframeToFeedIndexes: () => import_chunk_QPCNQ4ZK.mapTimeframeToFeedIndexes,
48
- startAfter: () => import_chunk_QPCNQ4ZK.startAfter,
49
- valueEncoding: () => import_chunk_QPCNQ4ZK.valueEncoding
47
+ hasInvitationExpired: () => import_chunk_Y5U7UXEL.hasInvitationExpired,
48
+ mapFeedIndexesToTimeframe: () => import_chunk_Y5U7UXEL.mapFeedIndexesToTimeframe,
49
+ mapTimeframeToFeedIndexes: () => import_chunk_Y5U7UXEL.mapTimeframeToFeedIndexes,
50
+ startAfter: () => import_chunk_Y5U7UXEL.startAfter,
51
+ valueEncoding: () => import_chunk_Y5U7UXEL.valueEncoding
50
52
  });
51
53
  module.exports = __toCommonJS(node_exports);
52
- var import_chunk_QPCNQ4ZK = require("./chunk-QPCNQ4ZK.cjs");
54
+ var import_chunk_Y5U7UXEL = require("./chunk-Y5U7UXEL.cjs");
53
55
  var import_async = require("@dxos/async");
54
56
  var import_automerge = require("@dxos/automerge/automerge");
55
57
  var import_automerge_repo = require("@dxos/automerge/automerge-repo");
56
58
  var import_context = require("@dxos/context");
57
59
  var import_invariant = require("@dxos/invariant");
58
60
  var import_keys = require("@dxos/keys");
59
- var import_log = require("@dxos/log");
60
61
  var import_protocols = require("@dxos/protocols");
61
62
  var import_tracing = require("@dxos/tracing");
62
63
  var import_util = require("@dxos/util");
@@ -64,7 +65,7 @@ var import_async2 = require("@dxos/async");
64
65
  var import_automerge_repo2 = require("@dxos/automerge/automerge-repo");
65
66
  var import_context2 = require("@dxos/context");
66
67
  var import_invariant2 = require("@dxos/invariant");
67
- var import_log2 = require("@dxos/log");
68
+ var import_log = require("@dxos/log");
68
69
  var import_context3 = require("@dxos/context");
69
70
  var import_async3 = require("@dxos/async");
70
71
  var import_automerge_repo3 = require("@dxos/automerge/automerge-repo");
@@ -73,14 +74,15 @@ var import_invariant3 = require("@dxos/invariant");
73
74
  var import_async4 = require("@dxos/async");
74
75
  var import_context4 = require("@dxos/context");
75
76
  var import_debug = require("@dxos/debug");
77
+ var import_echo_protocol = require("@dxos/echo-protocol");
76
78
  var import_invariant4 = require("@dxos/invariant");
77
- var import_log3 = require("@dxos/log");
79
+ var import_log2 = require("@dxos/log");
78
80
  var import_tracing2 = require("@dxos/tracing");
79
81
  var import_automerge_repo4 = require("@dxos/automerge/automerge-repo");
80
82
  var import_context5 = require("@dxos/context");
81
83
  var import_invariant5 = require("@dxos/invariant");
82
84
  var import_keys2 = require("@dxos/keys");
83
- var import_log4 = require("@dxos/log");
85
+ var import_log3 = require("@dxos/log");
84
86
  var import_teleport_extension_automerge_replicator = require("@dxos/teleport-extension-automerge-replicator");
85
87
  var import_util2 = require("@dxos/util");
86
88
  function _ts_decorate(decorators, target, key, desc) {
@@ -115,7 +117,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
115
117
  }
116
118
  connectionEntry.writer.write(message).catch((err) => {
117
119
  if (connectionEntry.isOpen) {
118
- import_log2.log.catch(err, void 0, {
120
+ import_log.log.catch(err, void 0, {
119
121
  F: __dxlog_file,
120
122
  L: 49,
121
123
  S: this,
@@ -137,7 +139,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
137
139
  ]
138
140
  });
139
141
  this._lifecycleState = import_context2.LifecycleState.OPEN;
140
- (0, import_log2.log)("emit ready", void 0, {
142
+ (0, import_log.log)("emit ready", void 0, {
141
143
  F: __dxlog_file,
142
144
  L: 63,
143
145
  S: this,
@@ -235,7 +237,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
235
237
  return connection.connection.shouldAdvertize(params);
236
238
  }
237
239
  _onConnectionOpen(connection) {
238
- (0, import_log2.log)("Connection opened", {
240
+ (0, import_log.log)("Connection opened", {
239
241
  peerId: connection.peerId
240
242
  }, {
241
243
  F: __dxlog_file,
@@ -272,7 +274,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
272
274
  }
273
275
  } catch (err) {
274
276
  if (connectionEntry.isOpen) {
275
- import_log2.log.catch(err, void 0, {
277
+ import_log.log.catch(err, void 0, {
276
278
  F: __dxlog_file,
277
279
  L: 139,
278
280
  S: this,
@@ -281,7 +283,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
281
283
  }
282
284
  }
283
285
  });
284
- (0, import_log2.log)("emit peer-candidate", {
286
+ (0, import_log.log)("emit peer-candidate", {
285
287
  peerId: connection.peerId
286
288
  }, {
287
289
  F: __dxlog_file,
@@ -296,7 +298,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
296
298
  * TODO(y): replace with a proper API call when sharePolicy update becomes supported by automerge-repo
297
299
  */
298
300
  _onConnectionAuthScopeChanged(connection) {
299
- (0, import_log2.log)("Connection auth scope changed", {
301
+ (0, import_log.log)("Connection auth scope changed", {
300
302
  peerId: connection.peerId
301
303
  }, {
302
304
  F: __dxlog_file,
@@ -320,7 +322,7 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
320
322
  this._emitPeerCandidate(connection);
321
323
  }
322
324
  _onConnectionClosed(connection) {
323
- (0, import_log2.log)("Connection closed", {
325
+ (0, import_log.log)("Connection closed", {
324
326
  peerId: connection.peerId
325
327
  }, {
326
328
  F: __dxlog_file,
@@ -342,13 +344,13 @@ var EchoNetworkAdapter = class extends import_automerge_repo2.NetworkAdapter {
342
344
  this.emit("peer-disconnected", {
343
345
  peerId: connection.peerId
344
346
  });
345
- void entry.reader.cancel().catch((err) => import_log2.log.catch(err, void 0, {
347
+ void entry.reader.cancel().catch((err) => import_log.log.catch(err, void 0, {
346
348
  F: __dxlog_file,
347
349
  L: 168,
348
350
  S: this,
349
351
  C: (f, a) => f(...a)
350
352
  }));
351
- void entry.writer.abort().catch((err) => import_log2.log.catch(err, void 0, {
353
+ void entry.writer.abort().catch((err) => import_log.log.catch(err, void 0, {
352
354
  F: __dxlog_file,
353
355
  L: 169,
354
356
  S: this,
@@ -616,11 +618,13 @@ function _ts_decorate2(decorators, target, key, desc) {
616
618
  var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
617
619
  var AutomergeHost = class {
618
620
  constructor({ db, indexMetadataStore }) {
619
- this._ctx = new import_context.Context();
621
+ this._ctx = new import_context.Context(void 0, {
622
+ F: __dxlog_file3,
623
+ L: 49
624
+ });
620
625
  this._echoNetworkAdapter = new EchoNetworkAdapter({
621
626
  getContainingSpaceForDocument: this._getContainingSpaceForDocument.bind(this)
622
627
  });
623
- this._requestedDocs = /* @__PURE__ */ new Set();
624
628
  this._storage = new LevelDBStorageAdapter({
625
629
  db,
626
630
  callbacks: {
@@ -676,21 +680,6 @@ var AutomergeHost = class {
676
680
  if (!documentId) {
677
681
  return false;
678
682
  }
679
- const doc = this._repo.handles[documentId]?.docSync();
680
- if (!doc) {
681
- const isRequested = this._requestedDocs.has(`automerge:${documentId}`);
682
- (0, import_log.log)("doc share policy check", {
683
- peerId,
684
- documentId,
685
- isRequested
686
- }, {
687
- F: __dxlog_file3,
688
- L: 143,
689
- S: this,
690
- C: (f, a) => f(...a)
691
- });
692
- return isRequested;
693
- }
694
683
  const peerMetadata = this.repo.peerMetadataByPeerId[peerId];
695
684
  if (peerMetadata?.dxos_peerSource === "EchoNetworkAdapter") {
696
685
  return this._echoNetworkAdapter.shouldAdvertize(peerId, {
@@ -771,7 +760,7 @@ var AutomergeHost = class {
771
760
  await Promise.all(states?.map(async ({ heads, documentId }) => {
772
761
  (0, import_invariant.invariant)(heads, "heads are required for flush", {
773
762
  F: __dxlog_file3,
774
- L: 237,
763
+ L: 223,
775
764
  S: this,
776
765
  A: [
777
766
  "heads",
@@ -871,7 +860,7 @@ var AutomergeDocumentLoaderImpl = class {
871
860
  return;
872
861
  }
873
862
  if (!spaceState.rootUrl) {
874
- import_log3.log.error("Database opened with no rootUrl", {
863
+ import_log2.log.error("Database opened with no rootUrl", {
875
864
  spaceId: this._spaceId
876
865
  }, {
877
866
  F: __dxlog_file4,
@@ -930,7 +919,7 @@ var AutomergeDocumentLoaderImpl = class {
930
919
  const documentUrl = (spaceRootDoc.links ?? {})[objectId];
931
920
  if (documentUrl == null) {
932
921
  this._objectsPendingDocumentLoad.add(objectId);
933
- import_log3.log.info("loading delayed until object links are initialized", {
922
+ import_log2.log.info("loading delayed until object links are initialized", {
934
923
  objectId
935
924
  }, {
936
925
  F: __dxlog_file4,
@@ -977,7 +966,9 @@ var AutomergeDocumentLoaderImpl = class {
977
966
  ""
978
967
  ]
979
968
  });
980
- const spaceDocHandle = this._repo.create();
969
+ const spaceDocHandle = this._repo.create({
970
+ version: import_echo_protocol.SpaceDocVersion.CURRENT
971
+ });
981
972
  this._initDocAccess(spaceDocHandle);
982
973
  this.onObjectBoundToDocument(spaceDocHandle, objectId);
983
974
  this._spaceRootDocHandle.change((newDoc) => {
@@ -1008,30 +999,30 @@ var AutomergeDocumentLoaderImpl = class {
1008
999
  };
1009
1000
  const objectDocumentHandle = this._objectDocumentHandles.get(objectId);
1010
1001
  if (objectDocumentHandle != null && objectDocumentHandle.url !== automergeUrl) {
1011
- import_log3.log.warn("object already inlined in a different document, ignoring the link", {
1002
+ import_log2.log.warn("object already inlined in a different document, ignoring the link", {
1012
1003
  ...logMeta,
1013
1004
  actualDocumentUrl: objectDocumentHandle.url
1014
1005
  }, {
1015
1006
  F: __dxlog_file4,
1016
- L: 157,
1007
+ L: 159,
1017
1008
  S: this,
1018
1009
  C: (f, a) => f(...a)
1019
1010
  });
1020
1011
  continue;
1021
1012
  }
1022
1013
  if (objectDocumentHandle?.url === automergeUrl) {
1023
- import_log3.log.warn("object document was already loaded", logMeta, {
1014
+ import_log2.log.warn("object document was already loaded", logMeta, {
1024
1015
  F: __dxlog_file4,
1025
- L: 164,
1016
+ L: 166,
1026
1017
  S: this,
1027
1018
  C: (f, a) => f(...a)
1028
1019
  });
1029
1020
  continue;
1030
1021
  }
1031
1022
  const handle = this._repo.find(automergeUrl);
1032
- import_log3.log.debug("document loading triggered", logMeta, {
1023
+ import_log2.log.debug("document loading triggered", logMeta, {
1033
1024
  F: __dxlog_file4,
1034
- L: 168,
1025
+ L: 170,
1035
1026
  S: this,
1036
1027
  C: (f, a) => f(...a)
1037
1028
  });
@@ -1049,12 +1040,12 @@ var AutomergeDocumentLoaderImpl = class {
1049
1040
  break;
1050
1041
  } catch (err) {
1051
1042
  if (`${err}`.includes("Timeout")) {
1052
- import_log3.log.info("wraparound", {
1043
+ import_log2.log.info("wraparound", {
1053
1044
  id: docHandle.documentId,
1054
1045
  state: docHandle.state
1055
1046
  }, {
1056
1047
  F: __dxlog_file4,
1057
- L: 184,
1048
+ L: 186,
1058
1049
  S: this,
1059
1050
  C: (f, a) => f(...a)
1060
1051
  });
@@ -1094,9 +1085,9 @@ var AutomergeDocumentLoaderImpl = class {
1094
1085
  docUrl: handle.url
1095
1086
  };
1096
1087
  if (this.onObjectDocumentLoaded.listenerCount() === 0) {
1097
- import_log3.log.info("document loaded after all listeners were removed", logMeta, {
1088
+ import_log2.log.info("document loaded after all listeners were removed", logMeta, {
1098
1089
  F: __dxlog_file4,
1099
- L: 220,
1090
+ L: 222,
1100
1091
  S: this,
1101
1092
  C: (f, a) => f(...a)
1102
1093
  });
@@ -1104,9 +1095,9 @@ var AutomergeDocumentLoaderImpl = class {
1104
1095
  }
1105
1096
  const objectDocHandle = this._objectDocumentHandles.get(objectId);
1106
1097
  if (objectDocHandle?.url !== handle.url) {
1107
- import_log3.log.warn("object was rebound while a document was loading, discarding handle", logMeta, {
1098
+ import_log2.log.warn("object was rebound while a document was loading, discarding handle", logMeta, {
1108
1099
  F: __dxlog_file4,
1109
- L: 225,
1100
+ L: 227,
1110
1101
  S: this,
1111
1102
  C: (f, a) => f(...a)
1112
1103
  });
@@ -1118,14 +1109,14 @@ var AutomergeDocumentLoaderImpl = class {
1118
1109
  });
1119
1110
  } catch (err) {
1120
1111
  const shouldRetryLoading = this.onObjectDocumentLoaded.listenerCount() > 0;
1121
- import_log3.log.warn("failed to load a document", {
1112
+ import_log2.log.warn("failed to load a document", {
1122
1113
  objectId,
1123
1114
  automergeUrl: handle.url,
1124
1115
  retryLoading: shouldRetryLoading,
1125
1116
  err
1126
1117
  }, {
1127
1118
  F: __dxlog_file4,
1128
- L: 231,
1119
+ L: 233,
1129
1120
  S: this,
1130
1121
  C: (f, a) => f(...a)
1131
1122
  });
@@ -1175,7 +1166,7 @@ var MeshEchoReplicator = class {
1175
1166
  const connection = new MeshReplicatorConnection({
1176
1167
  ownPeerId: this._context.peerId,
1177
1168
  onRemoteConnected: async () => {
1178
- (0, import_log4.log)("onRemoteConnected", {
1169
+ (0, import_log3.log)("onRemoteConnected", {
1179
1170
  peerId: connection.peerId
1180
1171
  }, {
1181
1172
  F: __dxlog_file5,
@@ -1201,7 +1192,7 @@ var MeshEchoReplicator = class {
1201
1192
  }
1202
1193
  },
1203
1194
  onRemoteDisconnected: async () => {
1204
- (0, import_log4.log)("onRemoteDisconnected", {
1195
+ (0, import_log3.log)("onRemoteDisconnected", {
1205
1196
  peerId: connection.peerId
1206
1197
  }, {
1207
1198
  F: __dxlog_file5,
@@ -1210,12 +1201,12 @@ var MeshEchoReplicator = class {
1210
1201
  C: (f, a) => f(...a)
1211
1202
  });
1212
1203
  this._context?.onConnectionClosed(connection);
1213
- await connection.disable();
1214
1204
  this._connectionsPerPeer.delete(connection.peerId);
1205
+ await connection.disable();
1215
1206
  this._connections.delete(connection);
1216
1207
  },
1217
1208
  shouldAdvertize: async (params) => {
1218
- (0, import_log4.log)("shouldAdvertize", {
1209
+ (0, import_log3.log)("shouldAdvertize", {
1219
1210
  peerId: connection.peerId,
1220
1211
  documentId: params.documentId
1221
1212
  }, {
@@ -1236,7 +1227,7 @@ var MeshEchoReplicator = class {
1236
1227
  try {
1237
1228
  const spaceKey = await this._context.getContainingSpaceForDocument(params.documentId);
1238
1229
  if (!spaceKey) {
1239
- (0, import_log4.log)("space key not found for share policy check", {
1230
+ (0, import_log3.log)("space key not found for share policy check", {
1240
1231
  peerId: connection.peerId,
1241
1232
  documentId: params.documentId
1242
1233
  }, {
@@ -1249,7 +1240,7 @@ var MeshEchoReplicator = class {
1249
1240
  }
1250
1241
  const authorizedDevices = this._authorizedDevices.get(spaceKey);
1251
1242
  if (!connection.remoteDeviceKey) {
1252
- (0, import_log4.log)("device key not found for share policy check", {
1243
+ (0, import_log3.log)("device key not found for share policy check", {
1253
1244
  peerId: connection.peerId,
1254
1245
  documentId: params.documentId
1255
1246
  }, {
@@ -1261,7 +1252,7 @@ var MeshEchoReplicator = class {
1261
1252
  return false;
1262
1253
  }
1263
1254
  const isAuthorized = authorizedDevices?.has(connection.remoteDeviceKey) ?? false;
1264
- (0, import_log4.log)("share policy check", {
1255
+ (0, import_log3.log)("share policy check", {
1265
1256
  localPeer: this._context.peerId,
1266
1257
  remotePeer: connection.peerId,
1267
1258
  documentId: params.documentId,
@@ -1276,7 +1267,7 @@ var MeshEchoReplicator = class {
1276
1267
  });
1277
1268
  return isAuthorized;
1278
1269
  } catch (err) {
1279
- import_log4.log.catch(err, void 0, {
1270
+ import_log3.log.catch(err, void 0, {
1280
1271
  F: __dxlog_file5,
1281
1272
  L: 111,
1282
1273
  S: this,
@@ -1290,7 +1281,7 @@ var MeshEchoReplicator = class {
1290
1281
  return connection.replicatorExtension;
1291
1282
  }
1292
1283
  authorizeDevice(spaceKey, deviceKey) {
1293
- (0, import_log4.log)("authorizeDevice", {
1284
+ (0, import_log3.log)("authorizeDevice", {
1294
1285
  spaceKey,
1295
1286
  deviceKey
1296
1287
  }, {
@@ -1300,6 +1291,11 @@ var MeshEchoReplicator = class {
1300
1291
  C: (f, a) => f(...a)
1301
1292
  });
1302
1293
  (0, import_util2.defaultMap)(this._authorizedDevices, spaceKey, () => new import_util2.ComplexSet(import_keys2.PublicKey.hash)).add(deviceKey);
1294
+ for (const connection of this._connections) {
1295
+ if (connection.remoteDeviceKey && connection.remoteDeviceKey.equals(deviceKey)) {
1296
+ this._context?.onConnectionAuthScopeChanged(connection);
1297
+ }
1298
+ }
1303
1299
  }
1304
1300
  };
1305
1301
  var MeshReplicatorConnection = class extends import_context5.Resource {
@@ -1331,13 +1327,13 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
1331
1327
  onStartReplication: async (info, remotePeerId) => {
1332
1328
  this.remoteDeviceKey = remotePeerId;
1333
1329
  this._remotePeerId = info.id;
1334
- (0, import_log4.log)("onStartReplication", {
1330
+ (0, import_log3.log)("onStartReplication", {
1335
1331
  id: info.id,
1336
1332
  thisPeerId: this.peerId,
1337
1333
  remotePeerId: remotePeerId.toHex()
1338
1334
  }, {
1339
1335
  F: __dxlog_file5,
1340
- L: 187,
1336
+ L: 192,
1341
1337
  S: this,
1342
1338
  C: (f, a) => f(...a)
1343
1339
  });
@@ -1361,7 +1357,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
1361
1357
  get peerId() {
1362
1358
  (0, import_invariant5.invariant)(this._remotePeerId != null, "Remote peer has not connected yet.", {
1363
1359
  F: __dxlog_file5,
1364
- L: 210,
1360
+ L: 215,
1365
1361
  S: this,
1366
1362
  A: [
1367
1363
  "this._remotePeerId != null",
@@ -1380,7 +1376,7 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
1380
1376
  async enable() {
1381
1377
  (0, import_invariant5.invariant)(this._remotePeerId != null, "Remote peer has not connected yet.", {
1382
1378
  F: __dxlog_file5,
1383
- L: 223,
1379
+ L: 228,
1384
1380
  S: this,
1385
1381
  A: [
1386
1382
  "this._remotePeerId != null",
@@ -1402,6 +1398,8 @@ var MeshReplicatorConnection = class extends import_context5.Resource {
1402
1398
  AuthStatus,
1403
1399
  AutomergeDocumentLoaderImpl,
1404
1400
  AutomergeHost,
1401
+ CredentialRetrieverExtension,
1402
+ CredentialServerExtension,
1405
1403
  DataServiceImpl,
1406
1404
  LevelDBStorageAdapter,
1407
1405
  LocalHostNetworkAdapter,