@dxos/echo-pipeline 0.4.6-main.e47f68d → 0.4.6-next.c12c15b

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