@dxos/echo-pipeline 0.4.8-main.6d7437e → 0.4.8-main.a4c603b

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 } from "@dxos/context";
3107
+ import { Context as Context7, cancelWithContext as cancelWithContext2 } 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(PublicKey8.from(spaceKey));
3224
+ const authorizedDevices = this._authorizedDevices.get(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 = getSpaceKeyFromDoc(event.doc);
3293
- if (!spaceKey || this._metadata == null) {
3292
+ const spaceKey = event.doc.access?.spaceKey;
3293
+ if (!spaceKey) {
3294
3294
  return;
3295
3295
  }
3296
3296
  const objectIds = getInlineChanges(event);
@@ -3302,21 +3302,22 @@ var AutomergeHost = class {
3302
3302
  if (!lastAvailableHash) {
3303
3303
  return;
3304
3304
  }
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(() => {
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(() => {
3315
3316
  this._updatingMetadata.delete(event.handle.documentId);
3316
3317
  }).catch((err) => {
3317
- this._ctx.disposed && log15.catch(err, void 0, {
3318
+ !this._ctx.disposed && log15.catch(err, void 0, {
3318
3319
  F: __dxlog_file16,
3319
- L: 191,
3320
+ L: 200,
3320
3321
  S: this,
3321
3322
  C: (f, a) => f(...a)
3322
3323
  });
@@ -3377,7 +3378,7 @@ var AutomergeHost = class {
3377
3378
  deviceKey
3378
3379
  }, {
3379
3380
  F: __dxlog_file16,
3380
- L: 258,
3381
+ L: 268,
3381
3382
  S: this,
3382
3383
  C: (f, a) => f(...a)
3383
3384
  });
@@ -3420,10 +3421,10 @@ var getInlineChanges = (event) => {
3420
3421
  };
3421
3422
  var getSpaceKeyFromDoc = (doc) => {
3422
3423
  const rawSpaceKey = doc.access?.spaceKey ?? doc.experimental_spaceKey;
3423
- if (rawSpaceKey == null) {
3424
- return null;
3424
+ if (!rawSpaceKey) {
3425
+ return;
3425
3426
  }
3426
- return String(rawSpaceKey);
3427
+ return rawSpaceKey;
3427
3428
  };
3428
3429
 
3429
3430
  export {
@@ -3457,4 +3458,4 @@ export {
3457
3458
  AutomergeHost,
3458
3459
  getSpaceKeyFromDoc
3459
3460
  };
3460
- //# sourceMappingURL=chunk-XR2636AC.mjs.map
3461
+ //# sourceMappingURL=chunk-M7BOB47J.mjs.map