@dxos/echo-pipeline 0.4.5-main.b6f7e18 → 0.4.5-main.c8d4ae3

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.
@@ -27,9 +27,6 @@ export class AutomergeHost {
27
27
  private readonly _clientNetwork: LocalHostNetworkAdapter;
28
28
  private readonly _storage: StorageAdapter;
29
29
 
30
- @trace.info()
31
- private readonly _peerId: string;
32
-
33
30
  /**
34
31
  * spaceKey -> deviceKey[]
35
32
  */
@@ -46,9 +43,9 @@ export class AutomergeHost {
46
43
  storageDirectory.type === StorageType.IDB
47
44
  ? new IndexedDBStorageAdapter(storageDirectory.path, 'data')
48
45
  : new AutomergeStorageAdapter(storageDirectory);
49
- this._peerId = `host-${PublicKey.random().toHex()}` as PeerId;
46
+ const localPeerId = `host-${PublicKey.random().toHex()}` as PeerId;
50
47
  this._repo = new Repo({
51
- peerId: this._peerId as PeerId,
48
+ peerId: localPeerId,
52
49
  network: [this._clientNetwork, this._meshNetwork],
53
50
  storage: this._storage,
54
51
 
@@ -71,14 +68,12 @@ export class AutomergeHost {
71
68
  }
72
69
 
73
70
  try {
74
- // experimental_spaceKey is set on old documents, new ones are created with doc.access.spaceKey
75
- const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
76
- if (!rawSpaceKey) {
71
+ if (!doc.experimental_spaceKey) {
77
72
  log('space key not found for share policy check', { peerId, documentId });
78
73
  return false;
79
74
  }
80
75
 
81
- const spaceKey = PublicKey.from(rawSpaceKey);
76
+ const spaceKey = PublicKey.from(doc.experimental_spaceKey);
82
77
  const authorizedDevices = this._authorizedDevices.get(spaceKey);
83
78
 
84
79
  // TODO(mykola): Hack, stop abusing `peerMetadata` field.
@@ -91,7 +86,7 @@ export class AutomergeHost {
91
86
 
92
87
  const isAuthorized = authorizedDevices?.has(deviceKey) ?? false;
93
88
  log('share policy check', {
94
- localPeer: this._peerId,
89
+ localPeer: localPeerId,
95
90
  remotePeer: peerId,
96
91
  documentId,
97
92
  deviceKey,
@@ -119,23 +114,6 @@ export class AutomergeHost {
119
114
  state: handle.state,
120
115
  hasDoc: !!handle.docSync(),
121
116
  heads: handle.docSync() ? automerge.getHeads(handle.docSync()) : null,
122
- data:
123
- handle.docSync()?.doc &&
124
- mapValues(handle.docSync()?.doc, (value, key) => {
125
- try {
126
- switch (key) {
127
- case 'access':
128
- case 'links':
129
- return value;
130
- case 'objects':
131
- return Object.keys(value as any);
132
- default:
133
- return `${value}`;
134
- }
135
- } catch (err) {
136
- return `${err}`;
137
- }
138
- }),
139
117
  }));
140
118
  }
141
119