@dxos/echo-pipeline 0.4.4 → 0.4.5-main.60c9234

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.
@@ -3103,9 +3103,9 @@ var AutomergeHost = class {
3103
3103
  this._meshNetwork = new MeshNetworkAdapter();
3104
3104
  this._clientNetwork = new LocalHostNetworkAdapter();
3105
3105
  this._storage = storageDirectory.type === StorageType.IDB ? new IndexedDBStorageAdapter(storageDirectory.path, "data") : new AutomergeStorageAdapter(storageDirectory);
3106
- const localPeerId = `host-${PublicKey8.random().toHex()}`;
3106
+ this._peerId = `host-${PublicKey8.random().toHex()}`;
3107
3107
  this._repo = new Repo({
3108
- peerId: localPeerId,
3108
+ peerId: this._peerId,
3109
3109
  network: [
3110
3110
  this._clientNetwork,
3111
3111
  this._meshNetwork
@@ -3129,26 +3129,27 @@ var AutomergeHost = class {
3129
3129
  isRequested
3130
3130
  }, {
3131
3131
  F: __dxlog_file16,
3132
- L: 66,
3132
+ L: 69,
3133
3133
  S: this,
3134
3134
  C: (f, a) => f(...a)
3135
3135
  });
3136
3136
  return isRequested;
3137
3137
  }
3138
3138
  try {
3139
- if (!doc.experimental_spaceKey) {
3139
+ const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
3140
+ if (!rawSpaceKey) {
3140
3141
  log15("space key not found for share policy check", {
3141
3142
  peerId,
3142
3143
  documentId
3143
3144
  }, {
3144
3145
  F: __dxlog_file16,
3145
- L: 72,
3146
+ L: 77,
3146
3147
  S: this,
3147
3148
  C: (f, a) => f(...a)
3148
3149
  });
3149
3150
  return false;
3150
3151
  }
3151
- const spaceKey = PublicKey8.from(doc.experimental_spaceKey);
3152
+ const spaceKey = PublicKey8.from(rawSpaceKey);
3152
3153
  const authorizedDevices = this._authorizedDevices.get(spaceKey);
3153
3154
  const deviceKeyHex = this.repo.peerMetadataByPeerId[peerId]?.dxos_deviceKey;
3154
3155
  if (!deviceKeyHex) {
@@ -3157,7 +3158,7 @@ var AutomergeHost = class {
3157
3158
  documentId
3158
3159
  }, {
3159
3160
  F: __dxlog_file16,
3160
- L: 82,
3161
+ L: 87,
3161
3162
  S: this,
3162
3163
  C: (f, a) => f(...a)
3163
3164
  });
@@ -3166,7 +3167,7 @@ var AutomergeHost = class {
3166
3167
  const deviceKey = PublicKey8.from(deviceKeyHex);
3167
3168
  const isAuthorized = authorizedDevices?.has(deviceKey) ?? false;
3168
3169
  log15("share policy check", {
3169
- localPeer: localPeerId,
3170
+ localPeer: this._peerId,
3170
3171
  remotePeer: peerId,
3171
3172
  documentId,
3172
3173
  deviceKey,
@@ -3174,7 +3175,7 @@ var AutomergeHost = class {
3174
3175
  isAuthorized
3175
3176
  }, {
3176
3177
  F: __dxlog_file16,
3177
- L: 88,
3178
+ L: 93,
3178
3179
  S: this,
3179
3180
  C: (f, a) => f(...a)
3180
3181
  });
@@ -3182,7 +3183,7 @@ var AutomergeHost = class {
3182
3183
  } catch (err) {
3183
3184
  log15.catch(err, void 0, {
3184
3185
  F: __dxlog_file16,
3185
- L: 98,
3186
+ L: 103,
3186
3187
  S: this,
3187
3188
  C: (f, a) => f(...a)
3188
3189
  });
@@ -3200,7 +3201,22 @@ var AutomergeHost = class {
3200
3201
  return mapValues(this._repo.handles, (handle) => ({
3201
3202
  state: handle.state,
3202
3203
  hasDoc: !!handle.docSync(),
3203
- heads: handle.docSync() ? automerge.getHeads(handle.docSync()) : null
3204
+ heads: handle.docSync() ? automerge.getHeads(handle.docSync()) : null,
3205
+ data: handle.docSync()?.doc && mapValues(handle.docSync()?.doc, (value, key) => {
3206
+ try {
3207
+ switch (key) {
3208
+ case "access":
3209
+ case "links":
3210
+ return value;
3211
+ case "objects":
3212
+ return Object.keys(value);
3213
+ default:
3214
+ return `${value}`;
3215
+ }
3216
+ } catch (err) {
3217
+ return `${err}`;
3218
+ }
3219
+ })
3204
3220
  }));
3205
3221
  }
3206
3222
  _automergePeers() {
@@ -3234,13 +3250,16 @@ var AutomergeHost = class {
3234
3250
  deviceKey
3235
3251
  }, {
3236
3252
  F: __dxlog_file16,
3237
- L: 155,
3253
+ L: 177,
3238
3254
  S: this,
3239
3255
  C: (f, a) => f(...a)
3240
3256
  });
3241
3257
  defaultMap(this._authorizedDevices, spaceKey, () => new ComplexSet(PublicKey8.hash)).add(deviceKey);
3242
3258
  }
3243
3259
  };
3260
+ _ts_decorate9([
3261
+ trace6.info()
3262
+ ], AutomergeHost.prototype, "_peerId", void 0);
3244
3263
  _ts_decorate9([
3245
3264
  trace6.info({
3246
3265
  depth: null
@@ -3285,4 +3304,4 @@ export {
3285
3304
  MeshNetworkAdapter,
3286
3305
  AutomergeHost
3287
3306
  };
3288
- //# sourceMappingURL=chunk-WIB35LJH.mjs.map
3307
+ //# sourceMappingURL=chunk-DHCMI2ID.mjs.map