@dxos/echo-pipeline 0.4.8-main.2d8e727 → 0.4.8-main.3a03fb7

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.
@@ -3104,7 +3104,7 @@ var MeshNetworkAdapter = class extends NetworkAdapter2 {
3104
3104
  import { next as automerge, getHeads } from "@dxos/automerge/automerge";
3105
3105
  import { Repo } from "@dxos/automerge/automerge-repo";
3106
3106
  import { IndexedDBStorageAdapter } from "@dxos/automerge/automerge-repo-storage-indexeddb";
3107
- import { Context as Context7, cancelWithContext as cancelWithContext2 } from "@dxos/context";
3107
+ import { Context as Context7 } from "@dxos/context";
3108
3108
  import { PublicKey as PublicKey8 } from "@dxos/keys";
3109
3109
  import { log as log15 } from "@dxos/log";
3110
3110
  import { idCodec } from "@dxos/protocols";
@@ -3221,7 +3221,7 @@ var AutomergeHost = class {
3221
3221
  });
3222
3222
  return false;
3223
3223
  }
3224
- const authorizedDevices = this._authorizedDevices.get(spaceKey);
3224
+ const authorizedDevices = this._authorizedDevices.get(PublicKey8.from(spaceKey));
3225
3225
  const deviceKeyHex = this.repo.peerMetadataByPeerId[peerId]?.dxos_deviceKey;
3226
3226
  if (!deviceKeyHex) {
3227
3227
  log15("device key not found for share policy check", {
@@ -3289,8 +3289,8 @@ var AutomergeHost = class {
3289
3289
  });
3290
3290
  }
3291
3291
  _onUpdate(event) {
3292
- const spaceKey = event.doc.access?.spaceKey;
3293
- if (!spaceKey) {
3292
+ const spaceKey = getSpaceKeyFromDoc(event.doc);
3293
+ if (!spaceKey || this._metadata == null) {
3294
3294
  return;
3295
3295
  }
3296
3296
  const objectIds = getInlineChanges(event);
@@ -3302,22 +3302,21 @@ var AutomergeHost = class {
3302
3302
  if (!lastAvailableHash) {
3303
3303
  return;
3304
3304
  }
3305
- const markingDirtyPromise = Promise.all(objectIds.map(async (objectId) => {
3306
- const spaceKey2 = getSpaceKeyFromDoc(event.doc);
3307
- if (!spaceKey2) {
3308
- return;
3309
- }
3310
- await cancelWithContext2(this._ctx, this._metadata.markDirty(idCodec.encode({
3311
- documentId: event.handle.documentId,
3312
- objectId,
3313
- spaceKey: spaceKey2
3314
- }), lastAvailableHash));
3315
- })).then(() => {
3305
+ const encodedIds = objectIds.map((objectId) => idCodec.encode({
3306
+ documentId: event.handle.documentId,
3307
+ objectId,
3308
+ spaceKey
3309
+ }));
3310
+ const idToLastHash = new Map(encodedIds.map((id) => [
3311
+ id,
3312
+ lastAvailableHash
3313
+ ]));
3314
+ const markingDirtyPromise = this._metadata.markDirty(idToLastHash).then(() => {
3316
3315
  this._updatingMetadata.delete(event.handle.documentId);
3317
3316
  }).catch((err) => {
3318
- !this._ctx.disposed && log15.catch(err, void 0, {
3317
+ this._ctx.disposed && log15.catch(err, void 0, {
3319
3318
  F: __dxlog_file16,
3320
- L: 200,
3319
+ L: 191,
3321
3320
  S: this,
3322
3321
  C: (f, a) => f(...a)
3323
3322
  });
@@ -3378,7 +3377,7 @@ var AutomergeHost = class {
3378
3377
  deviceKey
3379
3378
  }, {
3380
3379
  F: __dxlog_file16,
3381
- L: 268,
3380
+ L: 258,
3382
3381
  S: this,
3383
3382
  C: (f, a) => f(...a)
3384
3383
  });
@@ -3421,10 +3420,10 @@ var getInlineChanges = (event) => {
3421
3420
  };
3422
3421
  var getSpaceKeyFromDoc = (doc) => {
3423
3422
  const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
3424
- if (!rawSpaceKey) {
3425
- return;
3423
+ if (rawSpaceKey == null) {
3424
+ return null;
3426
3425
  }
3427
- return rawSpaceKey;
3426
+ return String(rawSpaceKey);
3428
3427
  };
3429
3428
 
3430
3429
  export {
@@ -3458,4 +3457,4 @@ export {
3458
3457
  AutomergeHost,
3459
3458
  getSpaceKeyFromDoc
3460
3459
  };
3461
- //# sourceMappingURL=chunk-M7BOB47J.mjs.map
3460
+ //# sourceMappingURL=chunk-XR2636AC.mjs.map