@dxos/echo-pipeline 0.4.8-main.a4c603b → 0.4.8-main.aa7abac

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,7 @@ var AutomergeHost = class {
3289
3289
  });
3290
3290
  }
3291
3291
  _onUpdate(event) {
3292
- const spaceKey = event.doc.access?.spaceKey;
3293
- if (!spaceKey) {
3292
+ if (this._metadata == null) {
3294
3293
  return;
3295
3294
  }
3296
3295
  const objectIds = getInlineChanges(event);
@@ -3302,22 +3301,20 @@ var AutomergeHost = class {
3302
3301
  if (!lastAvailableHash) {
3303
3302
  return;
3304
3303
  }
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(() => {
3304
+ const encodedIds = objectIds.map((objectId) => idCodec.encode({
3305
+ documentId: event.handle.documentId,
3306
+ objectId
3307
+ }));
3308
+ const idToLastHash = new Map(encodedIds.map((id) => [
3309
+ id,
3310
+ lastAvailableHash
3311
+ ]));
3312
+ const markingDirtyPromise = this._metadata.markDirty(idToLastHash).then(() => {
3316
3313
  this._updatingMetadata.delete(event.handle.documentId);
3317
3314
  }).catch((err) => {
3318
- !this._ctx.disposed && log15.catch(err, void 0, {
3315
+ this._ctx.disposed && log15.catch(err, void 0, {
3319
3316
  F: __dxlog_file16,
3320
- L: 200,
3317
+ L: 188,
3321
3318
  S: this,
3322
3319
  C: (f, a) => f(...a)
3323
3320
  });
@@ -3378,7 +3375,7 @@ var AutomergeHost = class {
3378
3375
  deviceKey
3379
3376
  }, {
3380
3377
  F: __dxlog_file16,
3381
- L: 268,
3378
+ L: 255,
3382
3379
  S: this,
3383
3380
  C: (f, a) => f(...a)
3384
3381
  });
@@ -3421,10 +3418,10 @@ var getInlineChanges = (event) => {
3421
3418
  };
3422
3419
  var getSpaceKeyFromDoc = (doc) => {
3423
3420
  const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
3424
- if (!rawSpaceKey) {
3425
- return;
3421
+ if (rawSpaceKey == null) {
3422
+ return null;
3426
3423
  }
3427
- return rawSpaceKey;
3424
+ return String(rawSpaceKey);
3428
3425
  };
3429
3426
 
3430
3427
  export {
@@ -3458,4 +3455,4 @@ export {
3458
3455
  AutomergeHost,
3459
3456
  getSpaceKeyFromDoc
3460
3457
  };
3461
- //# sourceMappingURL=chunk-M7BOB47J.mjs.map
3458
+ //# sourceMappingURL=chunk-3FVT6KX6.mjs.map