@dxos/echo-pipeline 0.4.7-main.85d9ee7 → 0.4.7-main.b1ae49b

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.
Files changed (29) hide show
  1. package/dist/lib/browser/{chunk-2AAHNMOH.mjs → chunk-LED7X4WK.mjs} +177 -35
  2. package/dist/lib/browser/chunk-LED7X4WK.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +1 -1
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/lib/browser/testing/index.mjs +6 -4
  6. package/dist/lib/browser/testing/index.mjs.map +3 -3
  7. package/dist/lib/node/{chunk-CZ5KWO66.cjs → chunk-UKREXVZX.cjs} +176 -38
  8. package/dist/lib/node/chunk-UKREXVZX.cjs.map +7 -0
  9. package/dist/lib/node/index.cjs +29 -29
  10. package/dist/lib/node/index.cjs.map +1 -1
  11. package/dist/lib/node/meta.json +1 -1
  12. package/dist/lib/node/testing/index.cjs +20 -18
  13. package/dist/lib/node/testing/index.cjs.map +3 -3
  14. package/dist/types/src/automerge/automerge-host.d.ts +14 -1
  15. package/dist/types/src/automerge/automerge-host.d.ts.map +1 -1
  16. package/dist/types/src/automerge/automerge-storage/342/200/223wrapper.d.ts +25 -0
  17. package/dist/types/src/automerge/automerge-storage/342/200/223wrapper.d.ts.map +1 -0
  18. package/dist/types/src/metadata/metadata-store.d.ts +6 -2
  19. package/dist/types/src/metadata/metadata-store.d.ts.map +1 -1
  20. package/dist/types/src/testing/util.d.ts.map +1 -1
  21. package/package.json +33 -33
  22. package/src/automerge/automerge-host.test.ts +3 -3
  23. package/src/automerge/automerge-host.ts +118 -11
  24. package/src/automerge/automerge-storage/342/200/223wrapper.ts +59 -0
  25. package/src/metadata/metadata-store.ts +46 -3
  26. package/src/testing/util.ts +3 -1
  27. package/src/tests/database.test.ts +3 -1
  28. package/dist/lib/browser/chunk-2AAHNMOH.mjs.map +0 -7
  29. package/dist/lib/node/chunk-CZ5KWO66.cjs.map +0 -7
@@ -491,7 +491,8 @@ var DataServiceImpl = class {
491
491
 
492
492
  // packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts
493
493
  import CRC32 from "crc-32";
494
- import { synchronized, Event } from "@dxos/async";
494
+ import { Event, scheduleTaskInterval, synchronized } from "@dxos/async";
495
+ import { Context as Context2 } from "@dxos/context";
495
496
  import { invariant as invariant4 } from "@dxos/invariant";
496
497
  import { PublicKey as PublicKey3 } from "@dxos/keys";
497
498
  import { log as log3 } from "@dxos/log";
@@ -509,6 +510,7 @@ function _ts_decorate(decorators, target, key, desc) {
509
510
  return c > 3 && r && Object.defineProperty(target, key, r), r;
510
511
  }
511
512
  var __dxlog_file4 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/metadata/metadata-store.ts";
513
+ var EXPIRED_INVITATION_CLEANUP_INTERVAL = 60 * 60 * 1e3;
512
514
  var emptyEchoMetadata = () => ({
513
515
  version: STORAGE_VERSION,
514
516
  spaces: [],
@@ -524,6 +526,7 @@ var MetadataStore = class {
524
526
  this._spaceLargeMetadata = new ComplexMap3(PublicKey3.hash);
525
527
  this._metadataFile = void 0;
526
528
  this.update = new Event();
529
+ this._invitationCleanupCtx = new Context2();
527
530
  this._directory = directory;
528
531
  }
529
532
  get metadata() {
@@ -553,7 +556,7 @@ var MetadataStore = class {
553
556
  name: file.filename
554
557
  }, {
555
558
  F: __dxlog_file4,
556
- L: 85,
559
+ L: 89,
557
560
  S: this,
558
561
  C: (f, a) => f(...a)
559
562
  });
@@ -589,12 +592,13 @@ var MetadataStore = class {
589
592
  checksum
590
593
  }, {
591
594
  F: __dxlog_file4,
592
- L: 120,
595
+ L: 124,
593
596
  S: this,
594
597
  C: (f, a) => f(...a)
595
598
  });
596
599
  }
597
600
  async close() {
601
+ await this._invitationCleanupCtx.dispose();
598
602
  await this.flush();
599
603
  await this._metadataFile?.close();
600
604
  this._metadataFile = void 0;
@@ -621,7 +625,7 @@ var MetadataStore = class {
621
625
  err
622
626
  }, {
623
627
  F: __dxlog_file4,
624
- L: 151,
628
+ L: 156,
625
629
  S: this,
626
630
  C: (f, a) => f(...a)
627
631
  });
@@ -638,12 +642,19 @@ var MetadataStore = class {
638
642
  err
639
643
  }, {
640
644
  F: __dxlog_file4,
641
- L: 163,
645
+ L: 168,
642
646
  S: this,
643
647
  C: (f, a) => f(...a)
644
648
  });
645
649
  }
646
650
  });
651
+ scheduleTaskInterval(this._invitationCleanupCtx, async () => {
652
+ for (const invitation of this.getInvitations()) {
653
+ if (invitation.created && invitation.lifetime && invitation.lifetime !== 0 && invitation.created.getTime() + invitation.lifetime * 1e3 < Date.now()) {
654
+ await this.removeInvitation(invitation.invitationId);
655
+ }
656
+ }
657
+ }, EXPIRED_INVITATION_CLEANUP_INTERVAL);
647
658
  }
648
659
  async _save() {
649
660
  const data = {
@@ -668,7 +679,7 @@ var MetadataStore = class {
668
679
  err
669
680
  }, {
670
681
  F: __dxlog_file4,
671
- L: 192,
682
+ L: 215,
672
683
  S: this,
673
684
  C: (f, a) => f(...a)
674
685
  });
@@ -689,7 +700,7 @@ var MetadataStore = class {
689
700
  const space = this.spaces.find((space2) => space2.key === spaceKey);
690
701
  invariant4(space, "Space not found", {
691
702
  F: __dxlog_file4,
692
- L: 214,
703
+ L: 237,
693
704
  S: this,
694
705
  A: [
695
706
  "space",
@@ -713,7 +724,7 @@ var MetadataStore = class {
713
724
  async clear() {
714
725
  log3("clearing all metadata", void 0, {
715
726
  F: __dxlog_file4,
716
- L: 233,
727
+ L: 256,
717
728
  S: this,
718
729
  C: (f, a) => f(...a)
719
730
  });
@@ -726,7 +737,7 @@ var MetadataStore = class {
726
737
  async setIdentityRecord(record) {
727
738
  invariant4(!this._metadata.identity, "Cannot overwrite existing identity in metadata", {
728
739
  F: __dxlog_file4,
729
- L: 243,
740
+ L: 266,
730
741
  S: this,
731
742
  A: [
732
743
  "!this._metadata.identity",
@@ -737,10 +748,26 @@ var MetadataStore = class {
737
748
  await this._save();
738
749
  await this.flush();
739
750
  }
751
+ getInvitations() {
752
+ return this._metadata.invitations ?? [];
753
+ }
754
+ async addInvitation(invitation) {
755
+ if (this._metadata.invitations?.find((i) => i.invitationId === invitation.invitationId)) {
756
+ return;
757
+ }
758
+ (this._metadata.invitations ??= []).push(invitation);
759
+ await this._save();
760
+ await this.flush();
761
+ }
762
+ async removeInvitation(invitationId) {
763
+ this._metadata.invitations = (this._metadata.invitations ?? []).filter((i) => i.invitationId !== invitationId);
764
+ await this._save();
765
+ await this.flush();
766
+ }
740
767
  async addSpace(record) {
741
768
  invariant4(!(this._metadata.spaces ?? []).find((space) => space.key === record.key), "Cannot overwrite existing space in metadata", {
742
769
  F: __dxlog_file4,
743
- L: 251,
770
+ L: 294,
744
771
  S: this,
745
772
  A: [
746
773
  "!(this._metadata.spaces ?? []).find((space) => space.key === record.key)",
@@ -895,7 +922,7 @@ _ts_decorate2([
895
922
 
896
923
  // packages/core/echo/echo-pipeline/src/pipeline/pipeline.ts
897
924
  import { Event as Event3, sleepWithContext, synchronized as synchronized2, Trigger } from "@dxos/async";
898
- import { Context as Context2, rejectOnDispose } from "@dxos/context";
925
+ import { Context as Context3, rejectOnDispose } from "@dxos/context";
899
926
  import { failUndefined } from "@dxos/debug";
900
927
  import { FeedSetIterator } from "@dxos/feed-store";
901
928
  import { invariant as invariant6 } from "@dxos/invariant";
@@ -950,7 +977,7 @@ var PipelineState = class {
950
977
  constructor(_feeds, _timeframeClock) {
951
978
  this._feeds = _feeds;
952
979
  this._timeframeClock = _timeframeClock;
953
- this._ctx = new Context2();
980
+ this._ctx = new Context3();
954
981
  this.timeframeUpdate = this._timeframeClock.update;
955
982
  this.stalled = new Event3();
956
983
  this._startTimeframe = new Timeframe2();
@@ -998,7 +1025,7 @@ var PipelineState = class {
998
1025
  *
999
1026
  * @param timeout Timeout in milliseconds to specify the maximum wait time.
1000
1027
  */
1001
- async waitUntilReachedTargetTimeframe({ ctx = new Context2(), timeout, breakOnStall = true } = {}) {
1028
+ async waitUntilReachedTargetTimeframe({ ctx = new Context3(), timeout, breakOnStall = true } = {}) {
1002
1029
  log6("waitUntilReachedTargetTimeframe", {
1003
1030
  timeout,
1004
1031
  current: this.timeframe,
@@ -1166,7 +1193,7 @@ var Pipeline = class {
1166
1193
  await this._feedSetIterator?.close();
1167
1194
  await this._processingTrigger.wait();
1168
1195
  await this._state._ctx.dispose();
1169
- this._state._ctx = new Context2();
1196
+ this._state._ctx = new Context3();
1170
1197
  this._state._reachedTargetPromise = void 0;
1171
1198
  this._state._reachedTarget = false;
1172
1199
  this._isStarted = false;
@@ -1351,7 +1378,7 @@ _ts_decorate3([
1351
1378
 
1352
1379
  // packages/core/echo/echo-pipeline/src/space/auth.ts
1353
1380
  import { runInContext, scheduleTask } from "@dxos/async";
1354
- import { Context as Context3 } from "@dxos/context";
1381
+ import { Context as Context4 } from "@dxos/context";
1355
1382
  import { randomBytes } from "@dxos/crypto";
1356
1383
  import { invariant as invariant7 } from "@dxos/invariant";
1357
1384
  import { log as log7 } from "@dxos/log";
@@ -1370,7 +1397,7 @@ var AuthExtension = class extends RpcExtension {
1370
1397
  timeout: 60 * 1e3
1371
1398
  });
1372
1399
  this._authParams = _authParams;
1373
- this._ctx = new Context3({
1400
+ this._ctx = new Context4({
1374
1401
  onError: (err) => {
1375
1402
  log7.catch(err, void 0, {
1376
1403
  F: __dxlog_file8,
@@ -1458,7 +1485,7 @@ var AuthExtension = class extends RpcExtension {
1458
1485
 
1459
1486
  // packages/core/echo/echo-pipeline/src/space/data-pipeline.ts
1460
1487
  import { Event as Event4, scheduleTask as scheduleTask2, sleep, synchronized as synchronized3, trackLeaks } from "@dxos/async";
1461
- import { Context as Context4 } from "@dxos/context";
1488
+ import { Context as Context5 } from "@dxos/context";
1462
1489
  import { checkCredentialType } from "@dxos/credentials";
1463
1490
  import { getStateMachineFromItem, ItemManager, TYPE_PROPERTIES } from "@dxos/echo-db";
1464
1491
  import { invariant as invariant8 } from "@dxos/invariant";
@@ -1484,7 +1511,7 @@ var TIMEFRAME_SAVE_DEBOUNCE_INTERVAL = 5e3;
1484
1511
  var DataPipeline = class {
1485
1512
  constructor(_params) {
1486
1513
  this._params = _params;
1487
- this._ctx = new Context4();
1514
+ this._ctx = new Context5();
1488
1515
  this._pipeline = void 0;
1489
1516
  this._targetTimeframe = void 0;
1490
1517
  this._lastAutomaticSnapshotTimeframe = new Timeframe3();
@@ -1592,7 +1619,7 @@ var DataPipeline = class {
1592
1619
  }
1593
1620
  await this.databaseHost?.close();
1594
1621
  await this.itemManager?.destroy();
1595
- this._ctx = new Context4();
1622
+ this._ctx = new Context5();
1596
1623
  this._pipeline = void 0;
1597
1624
  this._targetTimeframe = void 0;
1598
1625
  this._lastAutomaticSnapshotTimeframe = new Timeframe3();
@@ -1739,7 +1766,7 @@ var DataPipeline = class {
1739
1766
  return;
1740
1767
  }
1741
1768
  await this._epochCtx?.dispose();
1742
- const ctx = new Context4({
1769
+ const ctx = new Context5({
1743
1770
  onError: (err) => {
1744
1771
  if (err instanceof CancelledError) {
1745
1772
  log8("Epoch processing cancelled.", void 0, {
@@ -1934,7 +1961,7 @@ import { Callback as Callback2 } from "@dxos/util";
1934
1961
 
1935
1962
  // packages/core/echo/echo-pipeline/src/space/control-pipeline.ts
1936
1963
  import { DeferredTask, sleepWithContext as sleepWithContext2, trackLeaks as trackLeaks2 } from "@dxos/async";
1937
- import { Context as Context5 } from "@dxos/context";
1964
+ import { Context as Context6 } from "@dxos/context";
1938
1965
  import { SpaceStateMachine } from "@dxos/credentials";
1939
1966
  import { PublicKey as PublicKey5 } from "@dxos/keys";
1940
1967
  import { log as log9 } from "@dxos/log";
@@ -1958,7 +1985,7 @@ var CONTROL_PIPELINE_SNAPSHOT_DELAY = 1e4;
1958
1985
  var USE_SNAPSHOTS = true;
1959
1986
  var ControlPipeline = class {
1960
1987
  constructor({ spaceKey, genesisFeed, feedProvider, metadataStore }) {
1961
- this._ctx = new Context5();
1988
+ this._ctx = new Context6();
1962
1989
  this._lastTimeframeSaveTime = Date.now();
1963
1990
  this.onFeedAdmitted = new Callback();
1964
1991
  this._usage = new TimeUsageCounter2();
@@ -2033,7 +2060,7 @@ var ControlPipeline = class {
2033
2060
  C: (f, a) => f(...a)
2034
2061
  });
2035
2062
  setTimeout(async () => {
2036
- void this._consumePipeline(new Context5());
2063
+ void this._consumePipeline(new Context6());
2037
2064
  });
2038
2065
  await this._pipeline.start();
2039
2066
  log9("started", void 0, {
@@ -3076,14 +3103,48 @@ var MeshNetworkAdapter = class extends NetworkAdapter2 {
3076
3103
  };
3077
3104
 
3078
3105
  // packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts
3079
- import { next as automerge } from "@dxos/automerge/automerge";
3106
+ import { next as automerge, getHeads } from "@dxos/automerge/automerge";
3080
3107
  import { Repo } from "@dxos/automerge/automerge-repo";
3081
3108
  import { IndexedDBStorageAdapter } from "@dxos/automerge/automerge-repo-storage-indexeddb";
3109
+ import { Context as Context7, cancelWithContext as cancelWithContext2 } from "@dxos/context";
3082
3110
  import { PublicKey as PublicKey8 } from "@dxos/keys";
3083
3111
  import { log as log15 } from "@dxos/log";
3112
+ import { idCodec } from "@dxos/protocols";
3084
3113
  import { StorageType } from "@dxos/random-access-storage";
3085
3114
  import { trace as trace6 } from "@dxos/tracing";
3086
3115
  import { ComplexMap as ComplexMap7, ComplexSet, defaultMap, mapValues } from "@dxos/util";
3116
+
3117
+ // packages/core/echo/echo-pipeline/src/automerge/automerge-storage–wrapper.ts
3118
+ var AutomergeStorageWrapper = class {
3119
+ constructor({ storage, callbacks }) {
3120
+ this._storage = storage;
3121
+ this._callbacks = callbacks;
3122
+ }
3123
+ async load(key) {
3124
+ return this._storage.load(key);
3125
+ }
3126
+ async save(key, value) {
3127
+ await this._callbacks.beforeSave?.(key);
3128
+ await this._storage.save(key, value);
3129
+ await this._callbacks.afterSave?.(key);
3130
+ }
3131
+ async remove(key) {
3132
+ return this._storage.remove(key);
3133
+ }
3134
+ async loadRange(keyPrefix) {
3135
+ return this._storage.loadRange(keyPrefix);
3136
+ }
3137
+ async removeRange(keyPrefix) {
3138
+ return this._storage.removeRange(keyPrefix);
3139
+ }
3140
+ async close() {
3141
+ if (this._storage instanceof AutomergeStorageAdapter) {
3142
+ return this._storage.close();
3143
+ }
3144
+ }
3145
+ };
3146
+
3147
+ // packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts
3087
3148
  function _ts_decorate9(decorators, target, key, desc) {
3088
3149
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3089
3150
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
@@ -3096,15 +3157,26 @@ function _ts_decorate9(decorators, target, key, desc) {
3096
3157
  }
3097
3158
  var __dxlog_file16 = "/home/runner/work/dxos/dxos/packages/core/echo/echo-pipeline/src/automerge/automerge-host.ts";
3098
3159
  var AutomergeHost = class {
3099
- constructor(storageDirectory) {
3160
+ constructor({ directory, metadata }) {
3161
+ this._ctx = new Context7();
3100
3162
  /**
3101
3163
  * spaceKey -> deviceKey[]
3102
3164
  */
3103
3165
  this._authorizedDevices = new ComplexMap7(PublicKey8.hash);
3166
+ this._updatingMetadata = /* @__PURE__ */ new Map();
3104
3167
  this._requestedDocs = /* @__PURE__ */ new Set();
3168
+ this._metadata = metadata;
3105
3169
  this._meshNetwork = new MeshNetworkAdapter();
3106
3170
  this._clientNetwork = new LocalHostNetworkAdapter();
3107
- this._storage = storageDirectory.type === StorageType.IDB ? new IndexedDBStorageAdapter(storageDirectory.path, "data") : new AutomergeStorageAdapter(storageDirectory);
3171
+ this._storage = new AutomergeStorageWrapper({
3172
+ storage: (
3173
+ // TODO(mykola): Delete specific handling of IDB storage.
3174
+ directory.type === StorageType.IDB ? new IndexedDBStorageAdapter(directory.path, "data") : new AutomergeStorageAdapter(directory)
3175
+ ),
3176
+ callbacks: {
3177
+ beforeSave: (params) => this._beforeSave(params)
3178
+ }
3179
+ });
3108
3180
  this._peerId = `host-${PublicKey8.random().toHex()}`;
3109
3181
  this._repo = new Repo({
3110
3182
  peerId: this._peerId,
@@ -3117,7 +3189,7 @@ var AutomergeHost = class {
3117
3189
  // Hosts, running in the worker, don't share documents unless requested by other peers.
3118
3190
  sharePolicy: async (peerId, documentId) => {
3119
3191
  if (peerId.startsWith("client-")) {
3120
- return true;
3192
+ return false;
3121
3193
  }
3122
3194
  if (!documentId) {
3123
3195
  return false;
@@ -3131,7 +3203,7 @@ var AutomergeHost = class {
3131
3203
  isRequested
3132
3204
  }, {
3133
3205
  F: __dxlog_file16,
3134
- L: 69,
3206
+ L: 96,
3135
3207
  S: this,
3136
3208
  C: (f, a) => f(...a)
3137
3209
  });
@@ -3145,7 +3217,7 @@ var AutomergeHost = class {
3145
3217
  documentId
3146
3218
  }, {
3147
3219
  F: __dxlog_file16,
3148
- L: 77,
3220
+ L: 104,
3149
3221
  S: this,
3150
3222
  C: (f, a) => f(...a)
3151
3223
  });
@@ -3160,7 +3232,7 @@ var AutomergeHost = class {
3160
3232
  documentId
3161
3233
  }, {
3162
3234
  F: __dxlog_file16,
3163
- L: 87,
3235
+ L: 114,
3164
3236
  S: this,
3165
3237
  C: (f, a) => f(...a)
3166
3238
  });
@@ -3177,7 +3249,7 @@ var AutomergeHost = class {
3177
3249
  isAuthorized
3178
3250
  }, {
3179
3251
  F: __dxlog_file16,
3180
- L: 93,
3252
+ L: 120,
3181
3253
  S: this,
3182
3254
  C: (f, a) => f(...a)
3183
3255
  });
@@ -3185,7 +3257,7 @@ var AutomergeHost = class {
3185
3257
  } catch (err) {
3186
3258
  log15.catch(err, void 0, {
3187
3259
  F: __dxlog_file16,
3188
- L: 103,
3260
+ L: 130,
3189
3261
  S: this,
3190
3262
  C: (f, a) => f(...a)
3191
3263
  });
@@ -3195,10 +3267,61 @@ var AutomergeHost = class {
3195
3267
  });
3196
3268
  this._clientNetwork.ready();
3197
3269
  this._meshNetwork.ready();
3270
+ {
3271
+ const listener = ({ handle }) => this._onDocument(handle);
3272
+ this._repo.on("document", listener);
3273
+ this._ctx.onDispose(() => {
3274
+ this._repo.off("document", listener);
3275
+ });
3276
+ }
3198
3277
  }
3199
3278
  get repo() {
3200
3279
  return this._repo;
3201
3280
  }
3281
+ async _beforeSave(path) {
3282
+ const id = path[0];
3283
+ if (this._updatingMetadata.has(id)) {
3284
+ return this._updatingMetadata.get(id);
3285
+ }
3286
+ }
3287
+ _onDocument(handle) {
3288
+ const listener = (event) => this._onUpdate(event);
3289
+ handle.on("change", listener);
3290
+ this._ctx.onDispose(() => {
3291
+ handle.off("change", listener);
3292
+ });
3293
+ }
3294
+ _onUpdate(event) {
3295
+ const spaceKey = event.doc.access?.spaceKey;
3296
+ if (!spaceKey) {
3297
+ return;
3298
+ }
3299
+ const objectIds = getInlineChanges(event);
3300
+ if (objectIds.length === 0) {
3301
+ return;
3302
+ }
3303
+ const heads = getHeads(event.doc);
3304
+ const lastAvailableHash = heads.at(-1);
3305
+ if (!lastAvailableHash) {
3306
+ return;
3307
+ }
3308
+ const markingDirtyPromise = Promise.all(objectIds.map(async (objectId) => {
3309
+ await cancelWithContext2(this._ctx, this._metadata.markDirty(idCodec.encode({
3310
+ documentId: event.handle.documentId,
3311
+ objectId
3312
+ }), lastAvailableHash));
3313
+ })).then(() => {
3314
+ this._updatingMetadata.delete(event.handle.documentId);
3315
+ }).catch((err) => {
3316
+ !this._ctx.disposed && log15.catch(err, void 0, {
3317
+ F: __dxlog_file16,
3318
+ L: 198,
3319
+ S: this,
3320
+ C: (f, a) => f(...a)
3321
+ });
3322
+ });
3323
+ this._updatingMetadata.set(event.handle.documentId, markingDirtyPromise);
3324
+ }
3202
3325
  _automergeDocs() {
3203
3326
  return mapValues(this._repo.handles, (handle) => ({
3204
3327
  state: handle.state,
@@ -3225,8 +3348,9 @@ var AutomergeHost = class {
3225
3348
  return this._repo.peers;
3226
3349
  }
3227
3350
  async close() {
3228
- this._storage instanceof AutomergeStorageAdapter && await this._storage.close();
3351
+ await this._storage.close();
3229
3352
  await this._clientNetwork.close();
3353
+ await this._ctx.dispose();
3230
3354
  }
3231
3355
  //
3232
3356
  // Methods for client-services.
@@ -3252,7 +3376,7 @@ var AutomergeHost = class {
3252
3376
  deviceKey
3253
3377
  }, {
3254
3378
  F: __dxlog_file16,
3255
- L: 177,
3379
+ L: 266,
3256
3380
  S: this,
3257
3381
  C: (f, a) => f(...a)
3258
3382
  });
@@ -3275,6 +3399,24 @@ _ts_decorate9([
3275
3399
  AutomergeHost = _ts_decorate9([
3276
3400
  trace6.resource()
3277
3401
  ], AutomergeHost);
3402
+ var getInlineChanges = (event) => {
3403
+ const inlineChangedObjectIds = /* @__PURE__ */ new Set();
3404
+ for (const { path } of event.patches) {
3405
+ if (path.length < 2) {
3406
+ continue;
3407
+ }
3408
+ switch (path[0]) {
3409
+ case "objects":
3410
+ if (path.length >= 2) {
3411
+ inlineChangedObjectIds.add(path[1]);
3412
+ }
3413
+ break;
3414
+ }
3415
+ }
3416
+ return [
3417
+ ...inlineChangedObjectIds
3418
+ ];
3419
+ };
3278
3420
 
3279
3421
  export {
3280
3422
  codec,
@@ -3306,4 +3448,4 @@ export {
3306
3448
  MeshNetworkAdapter,
3307
3449
  AutomergeHost
3308
3450
  };
3309
- //# sourceMappingURL=chunk-2AAHNMOH.mjs.map
3451
+ //# sourceMappingURL=chunk-LED7X4WK.mjs.map