@dxos/echo-pipeline 0.4.8-main.27faba7 → 0.4.8-main.2d8e727

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.
@@ -2793,11 +2793,9 @@ SpaceManager = _ts_decorate8([
2793
2793
  ], SpaceManager);
2794
2794
 
2795
2795
  // packages/core/echo/echo-pipeline/src/automerge/automerge-storage-adapter.ts
2796
- import { StorageAdapter } from "@dxos/automerge/automerge-repo";
2797
2796
  import { arrayToBuffer as arrayToBuffer2, bufferToArray } from "@dxos/util";
2798
- var AutomergeStorageAdapter = class extends StorageAdapter {
2797
+ var AutomergeStorageAdapter = class {
2799
2798
  constructor(_directory) {
2800
- super();
2801
2799
  this._directory = _directory;
2802
2800
  this._state = "opened";
2803
2801
  }
@@ -3210,20 +3208,19 @@ var AutomergeHost = class {
3210
3208
  return isRequested;
3211
3209
  }
3212
3210
  try {
3213
- const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
3214
- if (!rawSpaceKey) {
3211
+ const spaceKey = getSpaceKeyFromDoc(doc);
3212
+ if (!spaceKey) {
3215
3213
  log15("space key not found for share policy check", {
3216
3214
  peerId,
3217
3215
  documentId
3218
3216
  }, {
3219
3217
  F: __dxlog_file16,
3220
- L: 104,
3218
+ L: 103,
3221
3219
  S: this,
3222
3220
  C: (f, a) => f(...a)
3223
3221
  });
3224
3222
  return false;
3225
3223
  }
3226
- const spaceKey = PublicKey8.from(rawSpaceKey);
3227
3224
  const authorizedDevices = this._authorizedDevices.get(spaceKey);
3228
3225
  const deviceKeyHex = this.repo.peerMetadataByPeerId[peerId]?.dxos_deviceKey;
3229
3226
  if (!deviceKeyHex) {
@@ -3232,7 +3229,7 @@ var AutomergeHost = class {
3232
3229
  documentId
3233
3230
  }, {
3234
3231
  F: __dxlog_file16,
3235
- L: 114,
3232
+ L: 112,
3236
3233
  S: this,
3237
3234
  C: (f, a) => f(...a)
3238
3235
  });
@@ -3249,7 +3246,7 @@ var AutomergeHost = class {
3249
3246
  isAuthorized
3250
3247
  }, {
3251
3248
  F: __dxlog_file16,
3252
- L: 120,
3249
+ L: 118,
3253
3250
  S: this,
3254
3251
  C: (f, a) => f(...a)
3255
3252
  });
@@ -3257,7 +3254,7 @@ var AutomergeHost = class {
3257
3254
  } catch (err) {
3258
3255
  log15.catch(err, void 0, {
3259
3256
  F: __dxlog_file16,
3260
- L: 130,
3257
+ L: 128,
3261
3258
  S: this,
3262
3259
  C: (f, a) => f(...a)
3263
3260
  });
@@ -3306,16 +3303,21 @@ var AutomergeHost = class {
3306
3303
  return;
3307
3304
  }
3308
3305
  const markingDirtyPromise = Promise.all(objectIds.map(async (objectId) => {
3306
+ const spaceKey2 = getSpaceKeyFromDoc(event.doc);
3307
+ if (!spaceKey2) {
3308
+ return;
3309
+ }
3309
3310
  await cancelWithContext2(this._ctx, this._metadata.markDirty(idCodec.encode({
3310
3311
  documentId: event.handle.documentId,
3311
- objectId
3312
+ objectId,
3313
+ spaceKey: spaceKey2
3312
3314
  }), lastAvailableHash));
3313
3315
  })).then(() => {
3314
3316
  this._updatingMetadata.delete(event.handle.documentId);
3315
3317
  }).catch((err) => {
3316
3318
  !this._ctx.disposed && log15.catch(err, void 0, {
3317
3319
  F: __dxlog_file16,
3318
- L: 198,
3320
+ L: 200,
3319
3321
  S: this,
3320
3322
  C: (f, a) => f(...a)
3321
3323
  });
@@ -3376,7 +3378,7 @@ var AutomergeHost = class {
3376
3378
  deviceKey
3377
3379
  }, {
3378
3380
  F: __dxlog_file16,
3379
- L: 266,
3381
+ L: 268,
3380
3382
  S: this,
3381
3383
  C: (f, a) => f(...a)
3382
3384
  });
@@ -3417,6 +3419,13 @@ var getInlineChanges = (event) => {
3417
3419
  ...inlineChangedObjectIds
3418
3420
  ];
3419
3421
  };
3422
+ var getSpaceKeyFromDoc = (doc) => {
3423
+ const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
3424
+ if (!rawSpaceKey) {
3425
+ return;
3426
+ }
3427
+ return rawSpaceKey;
3428
+ };
3420
3429
 
3421
3430
  export {
3422
3431
  codec,
@@ -3446,6 +3455,7 @@ export {
3446
3455
  AutomergeStorageAdapter,
3447
3456
  LocalHostNetworkAdapter,
3448
3457
  MeshNetworkAdapter,
3449
- AutomergeHost
3458
+ AutomergeHost,
3459
+ getSpaceKeyFromDoc
3450
3460
  };
3451
- //# sourceMappingURL=chunk-LED7X4WK.mjs.map
3461
+ //# sourceMappingURL=chunk-M7BOB47J.mjs.map