@liveblocks/server 1.0.15 → 1.1.1-pnpmtest1

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.
package/dist/index.cjs CHANGED
@@ -891,6 +891,9 @@ var InMemoryDriver = class {
891
891
  async delete_leased_session(sessionId) {
892
892
  this._leasedSessions.delete(sessionId);
893
893
  }
894
+ takeRowsWritten() {
895
+ return 0;
896
+ }
894
897
  next_actor() {
895
898
  return ++this._nextActor;
896
899
  }
@@ -1369,63 +1372,45 @@ var Storage = class {
1369
1372
  };
1370
1373
 
1371
1374
  // src/YjsStorage.ts
1372
-
1373
1375
  var _jsbase64 = require('js-base64');
1374
1376
 
1375
1377
  var _yjs = require('yjs'); var Y = _interopRequireWildcard(_yjs);
1376
- var MAX_Y_UPDATE_SIZE = 1e5;
1378
+ var UPDATE_COUNT_THRESHOLD = 1e3;
1377
1379
  var YjsStorage = class {
1378
- constructor(driver) {
1380
+ constructor(driver, updateCountThreshold = UPDATE_COUNT_THRESHOLD) {
1379
1381
  __publicField(this, "driver");
1382
+ __publicField(this, "updateCountThreshold");
1380
1383
  __publicField(this, "doc", new Y.Doc());
1381
1384
  // the root document
1382
- __publicField(this, "lastUpdatesById", /* @__PURE__ */ new Map());
1383
1385
  __publicField(this, "lastSnapshotById", /* @__PURE__ */ new Map());
1384
- // Keeps track of which keys are loaded, so we can clean them up without calling `.list()`
1385
- __publicField(this, "keysById", new (0, _core.DefaultMap)(
1386
- () => /* @__PURE__ */ new Set()
1387
- ));
1388
1386
  __publicField(this, "initPromisesById", /* @__PURE__ */ new Map());
1389
- /**
1390
- * Given a record of updates, merge them and compress if savings are significant
1391
- */
1392
- __publicField(this, "_loadAndCompressYJSUpdates", async (docUpdates, doc, docId) => {
1393
- const SAVINGS_THRESHOLD = 0.2;
1394
- const updates = Object.values(docUpdates);
1395
- const sizeOnDisk = updates.reduce((acc, update) => {
1396
- return acc + update.length;
1397
- }, 0);
1398
- if (updates.length > 0) {
1399
- const docKeys = Object.keys(docUpdates);
1400
- this.keysById.set(docId, new Set(docKeys));
1401
- const mergedUpdate = Y.mergeUpdates(updates);
1402
- Y.applyUpdate(doc, mergedUpdate);
1403
- const garbageCollectedUpdate = Y.encodeStateAsUpdate(doc);
1404
- if (garbageCollectedUpdate.length < sizeOnDisk * (1 - SAVINGS_THRESHOLD)) {
1405
- const newKey = _nanoid.nanoid.call(void 0, );
1406
- await this.driver.write_y_updates(
1407
- docId,
1408
- newKey,
1409
- garbageCollectedUpdate
1410
- );
1411
- await this.driver.delete_y_updates(docId, docKeys);
1412
- this.keysById.set(docId, /* @__PURE__ */ new Set([newKey]));
1413
- }
1414
- }
1387
+ __publicField(this, "storedKeysById", /* @__PURE__ */ new Map());
1388
+ // compact the updates into a single update and write it to the durable storage
1389
+ __publicField(this, "_compactYJSUpdates", async (doc, docId, storedKeys) => {
1390
+ const compactedUpdate = Y.encodeStateAsUpdate(doc);
1391
+ const newKey = _nanoid.nanoid.call(void 0, );
1392
+ await this.driver.write_y_updates(docId, newKey, compactedUpdate);
1393
+ await this.driver.delete_y_updates(docId, storedKeys);
1394
+ this.storedKeysById.set(docId, [newKey]);
1415
1395
  });
1416
1396
  __publicField(this, "_loadYDocFromDurableStorage", async (doc, docId) => {
1417
1397
  const docUpdates = Object.fromEntries(
1418
1398
  await this.driver.iter_y_updates(docId)
1419
1399
  );
1420
- await this._loadAndCompressYJSUpdates(docUpdates, doc, docId);
1421
- this.lastUpdatesById.set(docId, {
1422
- currentKey: _nanoid.nanoid.call(void 0, ),
1423
- lastVector: Y.encodeStateVector(doc)
1424
- });
1400
+ const updates = Object.values(docUpdates);
1401
+ const newupdate = Y.mergeUpdates(updates);
1402
+ const storedKeys = Object.keys(docUpdates);
1403
+ Y.applyUpdate(doc, newupdate);
1404
+ if (this.shouldCompact(storedKeys)) {
1405
+ await this._compactYJSUpdates(doc, docId, storedKeys);
1406
+ } else {
1407
+ this.storedKeysById.set(docId, storedKeys);
1408
+ }
1425
1409
  doc.emit("load", [doc]);
1426
1410
  return doc;
1427
1411
  });
1428
1412
  this.driver = driver;
1413
+ this.updateCountThreshold = updateCountThreshold;
1429
1414
  this.doc.on("subdocs", ({ removed }) => {
1430
1415
  removed.forEach((subdoc) => {
1431
1416
  subdoc.destroy();
@@ -1490,7 +1475,9 @@ var YjsStorage = class {
1490
1475
  }
1491
1476
  /**
1492
1477
  * @param update base64 encoded uint8array
1493
- * @returns
1478
+ * @returns { isUpdated: boolean; snapshotHash: string }
1479
+ * isUpdated: true if the update had an effect on the YDoc
1480
+ * snapshotHash: the hash of the new snapshot
1494
1481
  */
1495
1482
  async addYDocUpdate(logger, update, guid, isV2) {
1496
1483
  const doc = guid !== void 0 ? await this.getYSubdoc(guid) : this.doc;
@@ -1505,7 +1492,7 @@ var YjsStorage = class {
1505
1492
  const afterSnapshot = this._putLastSnapshot(doc);
1506
1493
  const updated = !Y.equalSnapshots(beforeSnapshot, afterSnapshot);
1507
1494
  if (updated) {
1508
- await this.handleYDocUpdate(doc);
1495
+ await this.handleYDocUpdate(doc, updateAsU8, isV2);
1509
1496
  }
1510
1497
  return {
1511
1498
  isUpdated: updated,
@@ -1583,43 +1570,27 @@ var YjsStorage = class {
1583
1570
  return subdoc;
1584
1571
  }
1585
1572
  // When the YJS doc changes, update it in durable storage
1586
- async handleYDocUpdate(doc) {
1573
+ async handleYDocUpdate(doc, update, isV2) {
1574
+ const v1update = isV2 ? Y.convertUpdateFormatV2ToV1(update) : update;
1587
1575
  const docId = doc.guid === this.doc.guid ? ROOT_YDOC_ID : doc.guid;
1588
- const docUpdateInfo = this.lastUpdatesById.get(docId);
1589
- const updateSinceLastVector = Y.encodeStateAsUpdate(
1590
- doc,
1591
- _optionalChain([docUpdateInfo, 'optionalAccess', _49 => _49.lastVector])
1592
- );
1593
- const storageKey = _nullishCoalesce(_optionalChain([docUpdateInfo, 'optionalAccess', _50 => _50.currentKey]), () => ( _nanoid.nanoid.call(void 0, )));
1594
- if (updateSinceLastVector.length > MAX_Y_UPDATE_SIZE) {
1595
- const newKey = _nanoid.nanoid.call(void 0, );
1596
- await this.driver.write_y_updates(
1597
- docId,
1598
- newKey,
1599
- Y.encodeStateAsUpdate(doc)
1600
- );
1601
- await this.driver.delete_y_updates(
1602
- docId,
1603
- Array.from(this.keysById.getOrCreate(docId))
1604
- );
1605
- this.keysById.set(docId, /* @__PURE__ */ new Set([newKey]));
1606
- this.lastUpdatesById.set(docId, {
1607
- currentKey: _nanoid.nanoid.call(void 0, ),
1608
- // start writing to a new key
1609
- lastVector: Y.encodeStateVector(doc)
1610
- });
1576
+ const storedKeys = this.storedKeysById.get(docId);
1577
+ if (this.shouldCompact(storedKeys)) {
1578
+ await this._compactYJSUpdates(doc, docId, storedKeys || []);
1579
+ return;
1580
+ }
1581
+ const newKey = _nanoid.nanoid.call(void 0, );
1582
+ await this.driver.write_y_updates(docId, newKey, v1update);
1583
+ if (!storedKeys) {
1584
+ this.storedKeysById.set(docId, [newKey]);
1611
1585
  } else {
1612
- await this.driver.write_y_updates(
1613
- docId,
1614
- storageKey,
1615
- updateSinceLastVector
1616
- );
1617
- const keys = [storageKey];
1618
- const currentKeys = this.keysById.getOrCreate(docId);
1619
- for (const key of keys) {
1620
- currentKeys.add(key);
1621
- }
1586
+ storedKeys.push(newKey);
1587
+ }
1588
+ }
1589
+ shouldCompact(storedKeys) {
1590
+ if (!storedKeys) {
1591
+ return false;
1622
1592
  }
1593
+ return storedKeys.length >= this.updateCountThreshold;
1623
1594
  }
1624
1595
  };
1625
1596
 
@@ -1733,7 +1704,7 @@ function stripOpId(op2) {
1733
1704
  var __socket, __debug, __lastActiveAt, __hasNotifiedClientStorageUpdateError;
1734
1705
  var BrowserSession = class {
1735
1706
  /** @internal - Never create a BrowserSession instance manually. Use the room.startBrowserSession() API instead. */
1736
- constructor(ticket, socket, debug) {
1707
+ constructor(ticket, socket, debug, createdAt) {
1737
1708
  // ^^ User-defined Session Metadata
1738
1709
  // ^^ User-defined Client Metadata (sent to client in ROOM_STATE)
1739
1710
  __publicField(this, "version");
@@ -1762,13 +1733,13 @@ var BrowserSession = class {
1762
1733
  this.publicMeta = ticket.publicMeta;
1763
1734
  __privateSet(this, __socket, socket);
1764
1735
  __privateSet(this, __debug, debug);
1765
- const now = /* @__PURE__ */ new Date();
1736
+ const now = _nullishCoalesce(createdAt, () => ( /* @__PURE__ */ new Date()));
1766
1737
  this.createdAt = now;
1767
1738
  __privateSet(this, __lastActiveAt, now);
1768
1739
  __privateSet(this, __hasNotifiedClientStorageUpdateError, false);
1769
1740
  }
1770
1741
  get lastActiveAt() {
1771
- const lastPing = _optionalChain([__privateGet, 'call', _51 => _51(this, __socket), 'access', _52 => _52.getLastPongTimestamp, 'optionalCall', _53 => _53()]);
1742
+ const lastPing = _optionalChain([__privateGet, 'call', _49 => _49(this, __socket), 'access', _50 => _50.getLastPongTimestamp, 'optionalCall', _51 => _51()]);
1772
1743
  if (lastPing && lastPing > __privateGet(this, __lastActiveAt)) {
1773
1744
  return lastPing;
1774
1745
  } else {
@@ -1860,28 +1831,28 @@ var Room = class {
1860
1831
  __publicField(this, "hooks");
1861
1832
  __privateAdd(this, __debug2);
1862
1833
  __privateAdd(this, __allowStreaming);
1863
- const driver = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _54 => _54.storage]), () => ( makeNewInMemoryDriver()));
1834
+ const driver = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _52 => _52.storage]), () => ( makeNewInMemoryDriver()));
1864
1835
  this.meta = meta;
1865
1836
  this.driver = driver;
1866
- this.logger = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _55 => _55.logger]), () => ( BLACK_HOLE));
1867
- __privateSet(this, __allowStreaming, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _56 => _56.allowStreaming]), () => ( true)));
1837
+ this.logger = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _53 => _53.logger]), () => ( BLACK_HOLE));
1838
+ __privateSet(this, __allowStreaming, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _54 => _54.allowStreaming]), () => ( true)));
1868
1839
  this.hooks = {
1869
- isClientMsgAllowed: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _57 => _57.hooks, 'optionalAccess', _58 => _58.isClientMsgAllowed]), () => ( (() => {
1840
+ isClientMsgAllowed: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _55 => _55.hooks, 'optionalAccess', _56 => _56.isClientMsgAllowed]), () => ( (() => {
1870
1841
  return {
1871
1842
  allowed: true
1872
1843
  };
1873
1844
  }))),
1874
1845
  // YYY .load() isn't called on the RoomServer yet! As soon as it does, these hooks will get called
1875
- onRoomWillLoad: _optionalChain([options, 'optionalAccess', _59 => _59.hooks, 'optionalAccess', _60 => _60.onRoomWillLoad]),
1876
- onRoomDidLoad: _optionalChain([options, 'optionalAccess', _61 => _61.hooks, 'optionalAccess', _62 => _62.onRoomDidLoad]),
1877
- onRoomWillUnload: _optionalChain([options, 'optionalAccess', _63 => _63.hooks, 'optionalAccess', _64 => _64.onRoomWillUnload]),
1878
- onRoomDidUnload: _optionalChain([options, 'optionalAccess', _65 => _65.hooks, 'optionalAccess', _66 => _66.onRoomDidUnload]),
1879
- onSessionDidStart: _optionalChain([options, 'optionalAccess', _67 => _67.hooks, 'optionalAccess', _68 => _68.onSessionDidStart]),
1880
- onSessionDidEnd: _optionalChain([options, 'optionalAccess', _69 => _69.hooks, 'optionalAccess', _70 => _70.onSessionDidEnd]),
1881
- postClientMsgStorageDidUpdate: _optionalChain([options, 'optionalAccess', _71 => _71.hooks, 'optionalAccess', _72 => _72.postClientMsgStorageDidUpdate]),
1882
- postClientMsgYdocDidUpdate: _optionalChain([options, 'optionalAccess', _73 => _73.hooks, 'optionalAccess', _74 => _74.postClientMsgYdocDidUpdate])
1846
+ onRoomWillLoad: _optionalChain([options, 'optionalAccess', _57 => _57.hooks, 'optionalAccess', _58 => _58.onRoomWillLoad]),
1847
+ onRoomDidLoad: _optionalChain([options, 'optionalAccess', _59 => _59.hooks, 'optionalAccess', _60 => _60.onRoomDidLoad]),
1848
+ onRoomWillUnload: _optionalChain([options, 'optionalAccess', _61 => _61.hooks, 'optionalAccess', _62 => _62.onRoomWillUnload]),
1849
+ onRoomDidUnload: _optionalChain([options, 'optionalAccess', _63 => _63.hooks, 'optionalAccess', _64 => _64.onRoomDidUnload]),
1850
+ onSessionDidStart: _optionalChain([options, 'optionalAccess', _65 => _65.hooks, 'optionalAccess', _66 => _66.onSessionDidStart]),
1851
+ onSessionDidEnd: _optionalChain([options, 'optionalAccess', _67 => _67.hooks, 'optionalAccess', _68 => _68.onSessionDidEnd]),
1852
+ postClientMsgStorageDidUpdate: _optionalChain([options, 'optionalAccess', _69 => _69.hooks, 'optionalAccess', _70 => _70.postClientMsgStorageDidUpdate]),
1853
+ postClientMsgYdocDidUpdate: _optionalChain([options, 'optionalAccess', _71 => _71.hooks, 'optionalAccess', _72 => _72.postClientMsgYdocDidUpdate])
1883
1854
  };
1884
- __privateSet(this, __debug2, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _75 => _75.enableDebugLogging]), () => ( false)));
1855
+ __privateSet(this, __debug2, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _73 => _73.enableDebugLogging]), () => ( false)));
1885
1856
  }
1886
1857
  get loadingState() {
1887
1858
  if (this._loadData$ === null) {
@@ -1937,13 +1908,13 @@ var Room = class {
1937
1908
  * room will be reloaded from storage.
1938
1909
  */
1939
1910
  unload(ctx) {
1940
- _optionalChain([this, 'access', _76 => _76.hooks, 'access', _77 => _77.onRoomWillUnload, 'optionalCall', _78 => _78(ctx)]);
1911
+ _optionalChain([this, 'access', _74 => _74.hooks, 'access', _75 => _75.onRoomWillUnload, 'optionalCall', _76 => _76(ctx)]);
1941
1912
  if (this._data) {
1942
1913
  this.storage.unload();
1943
1914
  this.yjsStorage.unload();
1944
1915
  }
1945
1916
  this._loadData$ = null;
1946
- _optionalChain([this, 'access', _79 => _79.hooks, 'access', _80 => _80.onRoomDidUnload, 'optionalCall', _81 => _81(ctx)]);
1917
+ _optionalChain([this, 'access', _77 => _77.hooks, 'access', _78 => _78.onRoomDidUnload, 'optionalCall', _79 => _79(ctx)]);
1947
1918
  }
1948
1919
  /**
1949
1920
  * Issues a Ticket with a new/unique actor ID
@@ -1957,17 +1928,17 @@ var Room = class {
1957
1928
  * unused Ticket will simply get garbage collected.
1958
1929
  */
1959
1930
  async createTicket(options) {
1960
- const actor$ = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.actor]), () => ( this.getNextActor()));
1931
+ const actor$ = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _80 => _80.actor]), () => ( this.getNextActor()));
1961
1932
  const sessionKey = _nanoid.nanoid.call(void 0, );
1962
- const info = _optionalChain([options, 'optionalAccess', _83 => _83.info]);
1933
+ const info = _optionalChain([options, 'optionalAccess', _81 => _81.info]);
1963
1934
  const ticket = {
1964
- version: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _84 => _84.version]), () => ( HIGHEST_PROTOCOL_VERSION)),
1935
+ version: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.version]), () => ( HIGHEST_PROTOCOL_VERSION)),
1965
1936
  actor: await actor$,
1966
1937
  sessionKey,
1967
- meta: _optionalChain([options, 'optionalAccess', _85 => _85.meta]),
1968
- publicMeta: _optionalChain([options, 'optionalAccess', _86 => _86.publicMeta]),
1969
- user: _optionalChain([options, 'optionalAccess', _87 => _87.id]) ? { id: options.id, info } : { anonymousId: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _88 => _88.anonymousId]), () => ( _nanoid.nanoid.call(void 0, ))), info },
1970
- scopes: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _89 => _89.scopes]), () => ( ["room:write"]))
1938
+ meta: _optionalChain([options, 'optionalAccess', _83 => _83.meta]),
1939
+ publicMeta: _optionalChain([options, 'optionalAccess', _84 => _84.publicMeta]),
1940
+ user: _optionalChain([options, 'optionalAccess', _85 => _85.id]) ? { id: options.id, info } : { anonymousId: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _86 => _86.anonymousId]), () => ( _nanoid.nanoid.call(void 0, ))), info },
1941
+ scopes: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _87 => _87.scopes]), () => ( ["room:write"]))
1971
1942
  };
1972
1943
  if (__privateGet(this, __debug2)) {
1973
1944
  console.log(`new ticket created: ${JSON.stringify(ticket)}`);
@@ -2005,8 +1976,13 @@ var Room = class {
2005
1976
  if (this.sessions.size > 0) {
2006
1977
  throw new Error("This API can only be called before any sessions exist");
2007
1978
  }
2008
- for (const { ticket, socket, lastActivity } of sessions) {
2009
- const newSession = new BrowserSession(ticket, socket, __privateGet(this, __debug2));
1979
+ for (const { ticket, socket, lastActivity, createdAt } of sessions) {
1980
+ const newSession = new BrowserSession(
1981
+ ticket,
1982
+ socket,
1983
+ __privateGet(this, __debug2),
1984
+ createdAt
1985
+ );
2010
1986
  this.sessions.set(ticket.sessionKey, newSession);
2011
1987
  newSession.markActive(lastActivity);
2012
1988
  }
@@ -2096,7 +2072,7 @@ var Room = class {
2096
2072
  ctx,
2097
2073
  defer
2098
2074
  );
2099
- const p$ = _optionalChain([this, 'access', _90 => _90.hooks, 'access', _91 => _91.onSessionDidStart, 'optionalCall', _92 => _92(newSession, ctx)]);
2075
+ const p$ = _optionalChain([this, 'access', _88 => _88.hooks, 'access', _89 => _89.onSessionDidStart, 'optionalCall', _90 => _90(newSession, ctx)]);
2100
2076
  if (p$) defer(p$);
2101
2077
  }
2102
2078
  /**
@@ -2120,7 +2096,7 @@ var Room = class {
2120
2096
  for (const other of this.otherSessions(key)) {
2121
2097
  other.send({ type: _core.ServerMsgCode.USER_LEFT, actor: session.actor });
2122
2098
  }
2123
- const p$ = _optionalChain([this, 'access', _93 => _93.hooks, 'access', _94 => _94.onSessionDidEnd, 'optionalCall', _95 => _95(session, ctx)]);
2099
+ const p$ = _optionalChain([this, 'access', _91 => _91.hooks, 'access', _92 => _92.onSessionDidEnd, 'optionalCall', _93 => _93(session, ctx)]);
2124
2100
  if (p$) defer(p$);
2125
2101
  }
2126
2102
  }
@@ -2424,7 +2400,7 @@ var Room = class {
2424
2400
  }
2425
2401
  // Don't ever manually call this!
2426
2402
  async _load(ctx) {
2427
- await _optionalChain([this, 'access', _96 => _96.hooks, 'access', _97 => _97.onRoomWillLoad, 'optionalCall', _98 => _98(ctx)]);
2403
+ await _optionalChain([this, 'access', _94 => _94.hooks, 'access', _95 => _95.onRoomWillLoad, 'optionalCall', _96 => _96(ctx)]);
2428
2404
  const storage = await this._loadStorage();
2429
2405
  const yjsStorage = await this._loadYjsStorage();
2430
2406
  this._data = {
@@ -2432,7 +2408,7 @@ var Room = class {
2432
2408
  storage,
2433
2409
  yjsStorage
2434
2410
  };
2435
- await _optionalChain([this, 'access', _99 => _99.hooks, 'access', _100 => _100.onRoomDidLoad, 'optionalCall', _101 => _101(ctx)]);
2411
+ await _optionalChain([this, 'access', _97 => _97.hooks, 'access', _98 => _98.onRoomDidLoad, 'optionalCall', _99 => _99(ctx)]);
2436
2412
  }
2437
2413
  /**
2438
2414
  * Returns a new, unique, actor ID.
@@ -2473,7 +2449,7 @@ var Room = class {
2473
2449
  }
2474
2450
  const sent = session.sendPong();
2475
2451
  if (sent !== 0) {
2476
- await _optionalChain([this, 'access', _102 => _102.hooks, 'access', _103 => _103.onDidPong, 'optionalCall', _104 => _104(ctx)]);
2452
+ await _optionalChain([this, 'access', _100 => _100.hooks, 'access', _101 => _101.onDidPong, 'optionalCall', _102 => _102(ctx)]);
2477
2453
  }
2478
2454
  }
2479
2455
  async _processClientMsg_withExclusiveAccess(sessionKey, messages, ctx, defer) {
@@ -2612,7 +2588,7 @@ var Room = class {
2612
2588
  break;
2613
2589
  }
2614
2590
  case _core.ClientMsgCode.UPDATE_STORAGE: {
2615
- _optionalChain([this, 'access', _105 => _105.driver, 'access', _106 => _106.bump_storage_version, 'optionalCall', _107 => _107()]);
2591
+ _optionalChain([this, 'access', _103 => _103.driver, 'access', _104 => _104.bump_storage_version, 'optionalCall', _105 => _105()]);
2616
2592
  const result = await this.storage.applyOps(msg.ops);
2617
2593
  const opsToForward = result.flatMap(
2618
2594
  (r) => r.action === "accepted" ? [r.op] : []
@@ -2644,7 +2620,7 @@ var Room = class {
2644
2620
  });
2645
2621
  }
2646
2622
  if (opsToForward.length > 0) {
2647
- const p$ = _optionalChain([this, 'access', _108 => _108.hooks, 'access', _109 => _109.postClientMsgStorageDidUpdate, 'optionalCall', _110 => _110(ctx)]);
2623
+ const p$ = _optionalChain([this, 'access', _106 => _106.hooks, 'access', _107 => _107.postClientMsgStorageDidUpdate, 'optionalCall', _108 => _108(ctx)]);
2648
2624
  if (p$) defer(p$);
2649
2625
  }
2650
2626
  break;
@@ -2695,7 +2671,7 @@ var Room = class {
2695
2671
  defer
2696
2672
  );
2697
2673
  if (result.isUpdated) {
2698
- const p$ = _optionalChain([this, 'access', _111 => _111.hooks, 'access', _112 => _112.postClientMsgYdocDidUpdate, 'optionalCall', _113 => _113(ctx, session)]);
2674
+ const p$ = _optionalChain([this, 'access', _109 => _109.hooks, 'access', _110 => _110.postClientMsgYdocDidUpdate, 'optionalCall', _111 => _111(ctx, session)]);
2699
2675
  if (p$) defer(p$);
2700
2676
  }
2701
2677
  break;