@liveblocks/core 1.2.0-comments4 → 1.2.0-comments6

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.js CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "1.2.0-comments4";
9
+ var PKG_VERSION = "1.2.0-comments6";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -637,6 +637,11 @@ var ServerMsgCode = /* @__PURE__ */ ((ServerMsgCode2) => {
637
637
  ServerMsgCode2[ServerMsgCode2["UPDATE_STORAGE"] = 201] = "UPDATE_STORAGE";
638
638
  ServerMsgCode2[ServerMsgCode2["REJECT_STORAGE_OP"] = 299] = "REJECT_STORAGE_OP";
639
639
  ServerMsgCode2[ServerMsgCode2["UPDATE_YDOC"] = 300] = "UPDATE_YDOC";
640
+ ServerMsgCode2[ServerMsgCode2["THREAD_CREATED"] = 400] = "THREAD_CREATED";
641
+ ServerMsgCode2[ServerMsgCode2["THREAD_METADATA_UPDATED"] = 401] = "THREAD_METADATA_UPDATED";
642
+ ServerMsgCode2[ServerMsgCode2["COMMENT_CREATED"] = 402] = "COMMENT_CREATED";
643
+ ServerMsgCode2[ServerMsgCode2["COMMENT_EDITED"] = 403] = "COMMENT_EDITED";
644
+ ServerMsgCode2[ServerMsgCode2["COMMENT_DELETED"] = 404] = "COMMENT_DELETED";
640
645
  return ServerMsgCode2;
641
646
  })(ServerMsgCode || {});
642
647
 
@@ -1250,6 +1255,9 @@ var ManagedSocket = class {
1250
1255
  function canWriteStorage(scopes) {
1251
1256
  return scopes.includes("room:write" /* Write */);
1252
1257
  }
1258
+ function canComment(scopes) {
1259
+ return scopes.includes("comments:write" /* CommentsWrite */) || scopes.includes("room:write" /* Write */);
1260
+ }
1253
1261
  function isValidAuthTokenPayload(data) {
1254
1262
  return isPlainObject(data) && (data.k === "acc" /* ACCESS_TOKEN */ || data.k === "id" /* ID_TOKEN */ || data.k === "sec-legacy" /* SECRET_LEGACY */);
1255
1263
  }
@@ -1662,98 +1670,146 @@ function errorIf(condition, message) {
1662
1670
  }
1663
1671
  }
1664
1672
 
1665
- // src/lib/Json.ts
1666
- function isJsonScalar(data) {
1667
- return data === null || typeof data === "string" || typeof data === "number" || typeof data === "boolean";
1668
- }
1669
- function isJsonArray(data) {
1670
- return Array.isArray(data);
1671
- }
1672
- function isJsonObject(data) {
1673
- return !isJsonScalar(data) && !isJsonArray(data);
1674
- }
1675
-
1676
- // src/realtime-client.ts
1677
- function authValueToString(authValue) {
1678
- return authValue.type === "secret" ? authValue.token.raw : authValue.publicApiKey;
1673
+ // src/comments/index.ts
1674
+ function getAuthBearerHeaderFromAuthValue(authValue) {
1675
+ if (authValue.type === "public") {
1676
+ return authValue.publicApiKey;
1677
+ } else {
1678
+ return authValue.token.raw;
1679
+ }
1679
1680
  }
1680
- function createRealtimeClient(authManager, serverEndpoint) {
1681
- const eventHub = {
1682
- error: makeEventSource(),
1683
- connection: makeEventSource(),
1684
- events: {}
1685
- };
1686
- let managedSocket = null;
1687
- function createManagedSocket(roomId) {
1688
- managedSocket = new ManagedSocket(
1689
- {
1690
- // TODO: We're trying to (re)connect based on the first roomId that the user is asking for
1691
- // This is bad because the user might now have access to this room (anymore)
1692
- // This prevent any future reconnection to the websocket server
1693
- // We need to find a better way to handle the first (re)connection
1694
- // (Could it be based on the current listeners)
1695
- authenticate: () => authManager.getAuthValue("room:read", roomId),
1696
- createSocket: (authValue) => new WebSocket(
1697
- `${serverEndpoint}?token=${authValue.type === "secret" ? authValue.token.raw : authValue.publicApiKey}`
1698
- )
1699
- },
1700
- true,
1701
- false
1702
- );
1703
- managedSocket.events.statusDidChange.subscribe((status) => {
1704
- if (status === "connected") {
1705
- for (const roomId2 in eventHub.events) {
1706
- const eventSource2 = eventHub.events[roomId2];
1707
- if (eventSource2.count() > 0) {
1708
- subscribeToRoomEvents(roomId2);
1709
- }
1681
+ function createCommentsApi(roomId, getAuthValue, { serverEndpoint }) {
1682
+ async function fetchJson(endpoint, options) {
1683
+ const response = await fetchApi(roomId, endpoint, options);
1684
+ if (!response.ok) {
1685
+ if (response.status >= 400 && response.status < 600) {
1686
+ let errorMessage = "";
1687
+ try {
1688
+ const errorBody = await response.json();
1689
+ errorMessage = errorBody.message;
1690
+ } catch (error3) {
1691
+ errorMessage = response.statusText;
1710
1692
  }
1693
+ throw new Error(
1694
+ `Request failed with status ${response.status}: ${errorMessage}`
1695
+ );
1711
1696
  }
1712
- eventHub.connection.notify(status);
1713
- });
1714
- managedSocket.events.onLiveblocksError.subscribe(eventHub.error.notify);
1715
- managedSocket.events.onMessage.subscribe((event) => {
1716
- if (typeof event.data !== "string") {
1717
- return;
1718
- }
1719
- const jsonEvent = tryParseJson(event.data);
1720
- if (jsonEvent !== void 0 && isJsonObject(jsonEvent) && typeof jsonEvent.roomId === "string") {
1721
- eventHub.events[jsonEvent.roomId].notify(jsonEvent);
1697
+ }
1698
+ let body;
1699
+ try {
1700
+ body = await response.json();
1701
+ } catch (e3) {
1702
+ body = {};
1703
+ }
1704
+ return body;
1705
+ }
1706
+ async function fetchApi(roomId2, endpoint, options) {
1707
+ const authValue = await getAuthValue();
1708
+ const url = `${serverEndpoint}/c/rooms/${roomId2}${endpoint}`;
1709
+ return await fetch(url, {
1710
+ ...options,
1711
+ headers: {
1712
+ ..._optionalChain([options, 'optionalAccess', _43 => _43.headers]),
1713
+ Authorization: `Bearer ${getAuthBearerHeaderFromAuthValue(authValue)}`
1722
1714
  }
1723
1715
  });
1724
- managedSocket.connect();
1725
1716
  }
1726
- function getOrCreateEventSource(roomId) {
1727
- let eventSource2 = eventHub.events[roomId];
1728
- if (eventSource2 === void 0) {
1729
- eventSource2 = makeEventSource();
1730
- eventHub.events[roomId] = eventSource2;
1717
+ async function getThreads() {
1718
+ const response = await fetchApi(roomId, "/threads");
1719
+ if (response.ok) {
1720
+ const json = await response.json();
1721
+ return json.data;
1722
+ } else if (response.status === 404) {
1723
+ return [];
1724
+ } else {
1725
+ throw new Error("FAIL");
1731
1726
  }
1732
- return eventSource2;
1733
1727
  }
1734
- async function subscribeToRoomEvents(roomId) {
1735
- const authValue = await authManager.getAuthValue("room:read", roomId);
1736
- if (managedSocket === null || managedSocket.getStatus() !== "connected") {
1737
- return;
1738
- }
1739
- managedSocket.send(
1740
- JSON.stringify({
1741
- type: "subscribeToRooms",
1742
- rooms: [roomId],
1743
- token: authValueToString(authValue)
1728
+ function createThread({
1729
+ metadata,
1730
+ body,
1731
+ commentId,
1732
+ threadId
1733
+ }) {
1734
+ return fetchJson("/threads", {
1735
+ method: "POST",
1736
+ headers: {
1737
+ "Content-Type": "application/json"
1738
+ },
1739
+ body: JSON.stringify({
1740
+ id: threadId,
1741
+ comment: {
1742
+ id: commentId,
1743
+ body
1744
+ },
1745
+ metadata
1744
1746
  })
1747
+ });
1748
+ }
1749
+ function editThreadMetadata({
1750
+ metadata,
1751
+ threadId
1752
+ }) {
1753
+ return fetchJson(
1754
+ `/threads/${threadId}/metadata`,
1755
+ {
1756
+ method: "POST",
1757
+ headers: {
1758
+ "Content-Type": "application/json"
1759
+ },
1760
+ body: JSON.stringify(metadata)
1761
+ }
1745
1762
  );
1746
1763
  }
1747
- return {
1748
- subscribeToEvents: (roomId, callback) => {
1749
- if (!managedSocket) {
1750
- createManagedSocket(roomId);
1764
+ function createComment({
1765
+ threadId,
1766
+ commentId,
1767
+ body
1768
+ }) {
1769
+ return fetchJson(`/threads/${threadId}/comments`, {
1770
+ method: "POST",
1771
+ headers: {
1772
+ "Content-Type": "application/json"
1773
+ },
1774
+ body: JSON.stringify({
1775
+ id: commentId,
1776
+ body
1777
+ })
1778
+ });
1779
+ }
1780
+ function editComment({
1781
+ threadId,
1782
+ commentId,
1783
+ body
1784
+ }) {
1785
+ return fetchJson(
1786
+ `/threads/${threadId}/comments/${commentId}`,
1787
+ {
1788
+ method: "POST",
1789
+ headers: {
1790
+ "Content-Type": "application/json"
1791
+ },
1792
+ body: JSON.stringify({
1793
+ body
1794
+ })
1751
1795
  }
1752
- subscribeToRoomEvents(roomId);
1753
- return getOrCreateEventSource(roomId).subscribe(callback);
1754
- },
1755
- error: eventHub.error.observable,
1756
- connection: eventHub.connection.observable
1796
+ );
1797
+ }
1798
+ async function deleteComment({
1799
+ threadId,
1800
+ commentId
1801
+ }) {
1802
+ await fetchJson(`/threads/${threadId}/comments/${commentId}`, {
1803
+ method: "DELETE"
1804
+ });
1805
+ }
1806
+ return {
1807
+ getThreads,
1808
+ createThread,
1809
+ editThreadMetadata,
1810
+ createComment,
1811
+ editComment,
1812
+ deleteComment
1757
1813
  };
1758
1814
  }
1759
1815
 
@@ -2118,7 +2174,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
2118
2174
  return [
2119
2175
  {
2120
2176
  type: 8 /* CREATE_REGISTER */,
2121
- opId: _optionalChain([pool, 'optionalAccess', _43 => _43.generateOpId, 'call', _44 => _44()]),
2177
+ opId: _optionalChain([pool, 'optionalAccess', _44 => _44.generateOpId, 'call', _45 => _45()]),
2122
2178
  id: this._id,
2123
2179
  parentId,
2124
2180
  parentKey,
@@ -2209,7 +2265,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2209
2265
  const ops = [];
2210
2266
  const op = {
2211
2267
  id: this._id,
2212
- opId: _optionalChain([pool, 'optionalAccess', _45 => _45.generateOpId, 'call', _46 => _46()]),
2268
+ opId: _optionalChain([pool, 'optionalAccess', _46 => _46.generateOpId, 'call', _47 => _47()]),
2213
2269
  type: 2 /* CREATE_LIST */,
2214
2270
  parentId,
2215
2271
  parentKey
@@ -2477,7 +2533,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2477
2533
  _applyInsertUndoRedo(op) {
2478
2534
  const { id, parentKey: key } = op;
2479
2535
  const child = creationOpToLiveNode(op);
2480
- if (_optionalChain([this, 'access', _47 => _47._pool, 'optionalAccess', _48 => _48.getNode, 'call', _49 => _49(id)]) !== void 0) {
2536
+ if (_optionalChain([this, 'access', _48 => _48._pool, 'optionalAccess', _49 => _49.getNode, 'call', _50 => _50(id)]) !== void 0) {
2481
2537
  return { modified: false };
2482
2538
  }
2483
2539
  child._attach(id, nn(this._pool));
@@ -2485,8 +2541,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
2485
2541
  const existingItemIndex = this._indexOfPosition(key);
2486
2542
  let newKey = key;
2487
2543
  if (existingItemIndex !== -1) {
2488
- const before2 = _optionalChain([this, 'access', _50 => _50._items, 'access', _51 => _51[existingItemIndex], 'optionalAccess', _52 => _52._parentPos]);
2489
- const after2 = _optionalChain([this, 'access', _53 => _53._items, 'access', _54 => _54[existingItemIndex + 1], 'optionalAccess', _55 => _55._parentPos]);
2544
+ const before2 = _optionalChain([this, 'access', _51 => _51._items, 'access', _52 => _52[existingItemIndex], 'optionalAccess', _53 => _53._parentPos]);
2545
+ const after2 = _optionalChain([this, 'access', _54 => _54._items, 'access', _55 => _55[existingItemIndex + 1], 'optionalAccess', _56 => _56._parentPos]);
2490
2546
  newKey = makePosition(before2, after2);
2491
2547
  child._setParentLink(this, newKey);
2492
2548
  }
@@ -2501,7 +2557,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2501
2557
  _applySetUndoRedo(op) {
2502
2558
  const { id, parentKey: key } = op;
2503
2559
  const child = creationOpToLiveNode(op);
2504
- if (_optionalChain([this, 'access', _56 => _56._pool, 'optionalAccess', _57 => _57.getNode, 'call', _58 => _58(id)]) !== void 0) {
2560
+ if (_optionalChain([this, 'access', _57 => _57._pool, 'optionalAccess', _58 => _58.getNode, 'call', _59 => _59(id)]) !== void 0) {
2505
2561
  return { modified: false };
2506
2562
  }
2507
2563
  this._unacknowledgedSets.set(key, nn(op.opId));
@@ -2623,7 +2679,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2623
2679
  } else {
2624
2680
  this._items[existingItemIndex]._setParentLink(
2625
2681
  this,
2626
- makePosition(newKey, _optionalChain([this, 'access', _59 => _59._items, 'access', _60 => _60[existingItemIndex + 1], 'optionalAccess', _61 => _61._parentPos]))
2682
+ makePosition(newKey, _optionalChain([this, 'access', _60 => _60._items, 'access', _61 => _61[existingItemIndex + 1], 'optionalAccess', _62 => _62._parentPos]))
2627
2683
  );
2628
2684
  const previousIndex = this._items.indexOf(child);
2629
2685
  child._setParentLink(this, newKey);
@@ -2649,7 +2705,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2649
2705
  if (existingItemIndex !== -1) {
2650
2706
  this._items[existingItemIndex]._setParentLink(
2651
2707
  this,
2652
- makePosition(newKey, _optionalChain([this, 'access', _62 => _62._items, 'access', _63 => _63[existingItemIndex + 1], 'optionalAccess', _64 => _64._parentPos]))
2708
+ makePosition(newKey, _optionalChain([this, 'access', _63 => _63._items, 'access', _64 => _64[existingItemIndex + 1], 'optionalAccess', _65 => _65._parentPos]))
2653
2709
  );
2654
2710
  }
2655
2711
  child._setParentLink(this, newKey);
@@ -2668,7 +2724,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2668
2724
  if (existingItemIndex !== -1) {
2669
2725
  this._items[existingItemIndex]._setParentLink(
2670
2726
  this,
2671
- makePosition(newKey, _optionalChain([this, 'access', _65 => _65._items, 'access', _66 => _66[existingItemIndex + 1], 'optionalAccess', _67 => _67._parentPos]))
2727
+ makePosition(newKey, _optionalChain([this, 'access', _66 => _66._items, 'access', _67 => _67[existingItemIndex + 1], 'optionalAccess', _68 => _68._parentPos]))
2672
2728
  );
2673
2729
  }
2674
2730
  child._setParentLink(this, newKey);
@@ -2696,7 +2752,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2696
2752
  if (existingItemIndex !== -1) {
2697
2753
  this._items[existingItemIndex]._setParentLink(
2698
2754
  this,
2699
- makePosition(newKey, _optionalChain([this, 'access', _68 => _68._items, 'access', _69 => _69[existingItemIndex + 1], 'optionalAccess', _70 => _70._parentPos]))
2755
+ makePosition(newKey, _optionalChain([this, 'access', _69 => _69._items, 'access', _70 => _70[existingItemIndex + 1], 'optionalAccess', _71 => _71._parentPos]))
2700
2756
  );
2701
2757
  }
2702
2758
  child._setParentLink(this, newKey);
@@ -2754,7 +2810,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2754
2810
  * @param element The element to add to the end of the LiveList.
2755
2811
  */
2756
2812
  push(element) {
2757
- _optionalChain([this, 'access', _71 => _71._pool, 'optionalAccess', _72 => _72.assertStorageIsWritable, 'call', _73 => _73()]);
2813
+ _optionalChain([this, 'access', _72 => _72._pool, 'optionalAccess', _73 => _73.assertStorageIsWritable, 'call', _74 => _74()]);
2758
2814
  return this.insert(element, this.length);
2759
2815
  }
2760
2816
  /**
@@ -2763,7 +2819,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2763
2819
  * @param index The index at which you want to insert the element.
2764
2820
  */
2765
2821
  insert(element, index) {
2766
- _optionalChain([this, 'access', _74 => _74._pool, 'optionalAccess', _75 => _75.assertStorageIsWritable, 'call', _76 => _76()]);
2822
+ _optionalChain([this, 'access', _75 => _75._pool, 'optionalAccess', _76 => _76.assertStorageIsWritable, 'call', _77 => _77()]);
2767
2823
  if (index < 0 || index > this._items.length) {
2768
2824
  throw new Error(
2769
2825
  `Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
@@ -2793,7 +2849,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2793
2849
  * @param targetIndex The index where the element should be after moving.
2794
2850
  */
2795
2851
  move(index, targetIndex) {
2796
- _optionalChain([this, 'access', _77 => _77._pool, 'optionalAccess', _78 => _78.assertStorageIsWritable, 'call', _79 => _79()]);
2852
+ _optionalChain([this, 'access', _78 => _78._pool, 'optionalAccess', _79 => _79.assertStorageIsWritable, 'call', _80 => _80()]);
2797
2853
  if (targetIndex < 0) {
2798
2854
  throw new Error("targetIndex cannot be less than 0");
2799
2855
  }
@@ -2851,7 +2907,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2851
2907
  * @param index The index of the element to delete
2852
2908
  */
2853
2909
  delete(index) {
2854
- _optionalChain([this, 'access', _80 => _80._pool, 'optionalAccess', _81 => _81.assertStorageIsWritable, 'call', _82 => _82()]);
2910
+ _optionalChain([this, 'access', _81 => _81._pool, 'optionalAccess', _82 => _82.assertStorageIsWritable, 'call', _83 => _83()]);
2855
2911
  if (index < 0 || index >= this._items.length) {
2856
2912
  throw new Error(
2857
2913
  `Cannot delete list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
@@ -2884,7 +2940,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2884
2940
  }
2885
2941
  }
2886
2942
  clear() {
2887
- _optionalChain([this, 'access', _83 => _83._pool, 'optionalAccess', _84 => _84.assertStorageIsWritable, 'call', _85 => _85()]);
2943
+ _optionalChain([this, 'access', _84 => _84._pool, 'optionalAccess', _85 => _85.assertStorageIsWritable, 'call', _86 => _86()]);
2888
2944
  if (this._pool) {
2889
2945
  const ops = [];
2890
2946
  const reverseOps = [];
@@ -2918,7 +2974,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
2918
2974
  }
2919
2975
  }
2920
2976
  set(index, item) {
2921
- _optionalChain([this, 'access', _86 => _86._pool, 'optionalAccess', _87 => _87.assertStorageIsWritable, 'call', _88 => _88()]);
2977
+ _optionalChain([this, 'access', _87 => _87._pool, 'optionalAccess', _88 => _88.assertStorageIsWritable, 'call', _89 => _89()]);
2922
2978
  if (index < 0 || index >= this._items.length) {
2923
2979
  throw new Error(
2924
2980
  `Cannot set list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
@@ -3066,7 +3122,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
3066
3122
  _shiftItemPosition(index, key) {
3067
3123
  const shiftedPosition = makePosition(
3068
3124
  key,
3069
- this._items.length > index + 1 ? _optionalChain([this, 'access', _89 => _89._items, 'access', _90 => _90[index + 1], 'optionalAccess', _91 => _91._parentPos]) : void 0
3125
+ this._items.length > index + 1 ? _optionalChain([this, 'access', _90 => _90._items, 'access', _91 => _91[index + 1], 'optionalAccess', _92 => _92._parentPos]) : void 0
3070
3126
  );
3071
3127
  this._items[index]._setParentLink(this, shiftedPosition);
3072
3128
  }
@@ -3192,7 +3248,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
3192
3248
  const ops = [];
3193
3249
  const op = {
3194
3250
  id: this._id,
3195
- opId: _optionalChain([pool, 'optionalAccess', _92 => _92.generateOpId, 'call', _93 => _93()]),
3251
+ opId: _optionalChain([pool, 'optionalAccess', _93 => _93.generateOpId, 'call', _94 => _94()]),
3196
3252
  type: 7 /* CREATE_MAP */,
3197
3253
  parentId,
3198
3254
  parentKey
@@ -3339,7 +3395,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
3339
3395
  * @param value The value of the element to add. Should be serializable to JSON.
3340
3396
  */
3341
3397
  set(key, value) {
3342
- _optionalChain([this, 'access', _94 => _94._pool, 'optionalAccess', _95 => _95.assertStorageIsWritable, 'call', _96 => _96()]);
3398
+ _optionalChain([this, 'access', _95 => _95._pool, 'optionalAccess', _96 => _96.assertStorageIsWritable, 'call', _97 => _97()]);
3343
3399
  const oldValue = this._map.get(key);
3344
3400
  if (oldValue) {
3345
3401
  oldValue._detach();
@@ -3385,7 +3441,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
3385
3441
  * @returns true if an element existed and has been removed, or false if the element does not exist.
3386
3442
  */
3387
3443
  delete(key) {
3388
- _optionalChain([this, 'access', _97 => _97._pool, 'optionalAccess', _98 => _98.assertStorageIsWritable, 'call', _99 => _99()]);
3444
+ _optionalChain([this, 'access', _98 => _98._pool, 'optionalAccess', _99 => _99.assertStorageIsWritable, 'call', _100 => _100()]);
3389
3445
  const item = this._map.get(key);
3390
3446
  if (item === void 0) {
3391
3447
  return false;
@@ -3559,7 +3615,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
3559
3615
  if (this._id === void 0) {
3560
3616
  throw new Error("Cannot serialize item is not attached");
3561
3617
  }
3562
- const opId = _optionalChain([pool, 'optionalAccess', _100 => _100.generateOpId, 'call', _101 => _101()]);
3618
+ const opId = _optionalChain([pool, 'optionalAccess', _101 => _101.generateOpId, 'call', _102 => _102()]);
3563
3619
  const ops = [];
3564
3620
  const op = parentId !== void 0 && parentKey !== void 0 ? {
3565
3621
  type: 4 /* CREATE_OBJECT */,
@@ -3840,7 +3896,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
3840
3896
  * @param value The value of the property to add
3841
3897
  */
3842
3898
  set(key, value) {
3843
- _optionalChain([this, 'access', _102 => _102._pool, 'optionalAccess', _103 => _103.assertStorageIsWritable, 'call', _104 => _104()]);
3899
+ _optionalChain([this, 'access', _103 => _103._pool, 'optionalAccess', _104 => _104.assertStorageIsWritable, 'call', _105 => _105()]);
3844
3900
  this.update({ [key]: value });
3845
3901
  }
3846
3902
  /**
@@ -3855,7 +3911,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
3855
3911
  * @param key The key of the property to delete
3856
3912
  */
3857
3913
  delete(key) {
3858
- _optionalChain([this, 'access', _105 => _105._pool, 'optionalAccess', _106 => _106.assertStorageIsWritable, 'call', _107 => _107()]);
3914
+ _optionalChain([this, 'access', _106 => _106._pool, 'optionalAccess', _107 => _107.assertStorageIsWritable, 'call', _108 => _108()]);
3859
3915
  const keyAsString = key;
3860
3916
  const oldValue = this._map.get(keyAsString);
3861
3917
  if (oldValue === void 0) {
@@ -3908,7 +3964,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
3908
3964
  * @param patch The object used to overrides properties
3909
3965
  */
3910
3966
  update(patch) {
3911
- _optionalChain([this, 'access', _108 => _108._pool, 'optionalAccess', _109 => _109.assertStorageIsWritable, 'call', _110 => _110()]);
3967
+ _optionalChain([this, 'access', _109 => _109._pool, 'optionalAccess', _110 => _110.assertStorageIsWritable, 'call', _111 => _111()]);
3912
3968
  if (this._pool === void 0 || this._id === void 0) {
3913
3969
  for (const key in patch) {
3914
3970
  const newValue = patch[key];
@@ -4278,6 +4334,17 @@ function captureStackTrace(msg, traceRoot) {
4278
4334
  return errorLike.stack;
4279
4335
  }
4280
4336
 
4337
+ // src/lib/Json.ts
4338
+ function isJsonScalar(data) {
4339
+ return data === null || typeof data === "string" || typeof data === "number" || typeof data === "boolean";
4340
+ }
4341
+ function isJsonArray(data) {
4342
+ return Array.isArray(data);
4343
+ }
4344
+ function isJsonObject(data) {
4345
+ return !isJsonScalar(data) && !isJsonArray(data);
4346
+ }
4347
+
4281
4348
  // src/protocol/ClientMsg.ts
4282
4349
  var ClientMsgCode = /* @__PURE__ */ ((ClientMsgCode2) => {
4283
4350
  ClientMsgCode2[ClientMsgCode2["UPDATE_PRESENCE"] = 100] = "UPDATE_PRESENCE";
@@ -4348,6 +4415,7 @@ function makeUser(conn, presence) {
4348
4415
  id,
4349
4416
  info,
4350
4417
  canWrite,
4418
+ canComment: canComment(conn.scopes),
4351
4419
  isReadOnly: !canWrite,
4352
4420
  // Deprecated, kept for backward-compatibility
4353
4421
  presence
@@ -4708,7 +4776,7 @@ function createRoom(options, config) {
4708
4776
  }
4709
4777
  },
4710
4778
  assertStorageIsWritable: () => {
4711
- const scopes = _optionalChain([context, 'access', _111 => _111.dynamicSessionInfo, 'access', _112 => _112.current, 'optionalAccess', _113 => _113.scopes]);
4779
+ const scopes = _optionalChain([context, 'access', _112 => _112.dynamicSessionInfo, 'access', _113 => _113.current, 'optionalAccess', _114 => _114.scopes]);
4712
4780
  if (scopes === void 0) {
4713
4781
  return;
4714
4782
  }
@@ -4735,19 +4803,20 @@ function createRoom(options, config) {
4735
4803
  history: makeEventSource(),
4736
4804
  storageDidLoad: makeEventSource(),
4737
4805
  storageStatus: makeEventSource(),
4738
- ydoc: makeEventSource()
4806
+ ydoc: makeEventSource(),
4807
+ comments: makeEventSource()
4739
4808
  };
4740
4809
  function sendMessages(messageOrMessages) {
4741
4810
  const message = JSON.stringify(messageOrMessages);
4742
4811
  if (config.unstable_fallbackToHTTP) {
4743
4812
  const size = new TextEncoder().encode(message).length;
4744
4813
  if (size > MAX_MESSAGE_SIZE && // TODO: support public api key auth in REST API
4745
- _optionalChain([managedSocket, 'access', _114 => _114.authValue, 'optionalAccess', _115 => _115.type]) === "secret" && config.httpSendEndpoint) {
4814
+ _optionalChain([managedSocket, 'access', _115 => _115.authValue, 'optionalAccess', _116 => _116.type]) === "secret" && config.httpSendEndpoint) {
4746
4815
  void httpSend(
4747
4816
  message,
4748
4817
  managedSocket.authValue.token.raw,
4749
4818
  config.httpSendEndpoint,
4750
- _optionalChain([config, 'access', _116 => _116.polyfills, 'optionalAccess', _117 => _117.fetch])
4819
+ _optionalChain([config, 'access', _117 => _117.polyfills, 'optionalAccess', _118 => _118.fetch])
4751
4820
  ).then((resp) => {
4752
4821
  if (!resp.ok && resp.status === 403) {
4753
4822
  managedSocket.reconnect();
@@ -4776,6 +4845,7 @@ function createRoom(options, config) {
4776
4845
  info: staticSession.userInfo,
4777
4846
  presence: myPresence,
4778
4847
  canWrite,
4848
+ canComment: canComment(dynamicSession.scopes),
4779
4849
  isReadOnly: !canWrite
4780
4850
  // Deprecated, kept for backward-compatibility
4781
4851
  };
@@ -5003,7 +5073,7 @@ function createRoom(options, config) {
5003
5073
  }
5004
5074
  context.myPresence.patch(patch);
5005
5075
  if (context.activeBatch) {
5006
- if (_optionalChain([options2, 'optionalAccess', _118 => _118.addToHistory])) {
5076
+ if (_optionalChain([options2, 'optionalAccess', _119 => _119.addToHistory])) {
5007
5077
  context.activeBatch.reverseOps.unshift({
5008
5078
  type: "presence",
5009
5079
  data: oldValues
@@ -5013,7 +5083,7 @@ function createRoom(options, config) {
5013
5083
  } else {
5014
5084
  flushNowOrSoon();
5015
5085
  batchUpdates(() => {
5016
- if (_optionalChain([options2, 'optionalAccess', _119 => _119.addToHistory])) {
5086
+ if (_optionalChain([options2, 'optionalAccess', _120 => _120.addToHistory])) {
5017
5087
  addToUndoStack(
5018
5088
  [{ type: "presence", data: oldValues }],
5019
5089
  doNotBatchUpdates
@@ -5190,7 +5260,7 @@ function createRoom(options, config) {
5190
5260
  const unacknowledgedOps = new Map(context.unacknowledgedOps);
5191
5261
  createOrUpdateRootFromMessage(message, doNotBatchUpdates);
5192
5262
  applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
5193
- _optionalChain([_resolveStoragePromise, 'optionalCall', _120 => _120()]);
5263
+ _optionalChain([_resolveStoragePromise, 'optionalCall', _121 => _121()]);
5194
5264
  notifyStorageStatus();
5195
5265
  eventHub.storageDidLoad.notify();
5196
5266
  break;
@@ -5213,7 +5283,7 @@ function createRoom(options, config) {
5213
5283
  if (process.env.NODE_ENV !== "production") {
5214
5284
  const traces = /* @__PURE__ */ new Set();
5215
5285
  for (const opId of message.opIds) {
5216
- const trace = _optionalChain([context, 'access', _121 => _121.opStackTraces, 'optionalAccess', _122 => _122.get, 'call', _123 => _123(opId)]);
5286
+ const trace = _optionalChain([context, 'access', _122 => _122.opStackTraces, 'optionalAccess', _123 => _123.get, 'call', _124 => _124(opId)]);
5217
5287
  if (trace) {
5218
5288
  traces.add(trace);
5219
5289
  }
@@ -5232,6 +5302,14 @@ ${Array.from(traces).join("\n\n")}`
5232
5302
  }
5233
5303
  break;
5234
5304
  }
5305
+ case 400 /* THREAD_CREATED */:
5306
+ case 401 /* THREAD_METADATA_UPDATED */:
5307
+ case 402 /* COMMENT_CREATED */:
5308
+ case 403 /* COMMENT_EDITED */:
5309
+ case 404 /* COMMENT_DELETED */: {
5310
+ eventHub.comments.notify(message);
5311
+ break;
5312
+ }
5235
5313
  }
5236
5314
  }
5237
5315
  notify(updates, doNotBatchUpdates);
@@ -5494,14 +5572,18 @@ ${Array.from(traces).join("\n\n")}`
5494
5572
  history: eventHub.history.observable,
5495
5573
  storageDidLoad: eventHub.storageDidLoad.observable,
5496
5574
  storageStatus: eventHub.storageStatus.observable,
5497
- ydoc: eventHub.ydoc.observable
5575
+ ydoc: eventHub.ydoc.observable,
5576
+ comments: eventHub.comments.observable
5498
5577
  };
5578
+ const commentsApi = createCommentsApi(config.roomId, delegates.authenticate, {
5579
+ serverEndpoint: "https://api.liveblocks.io/v2"
5580
+ });
5499
5581
  return Object.defineProperty(
5500
5582
  {
5501
5583
  /* NOTE: Exposing __internal here only to allow testing implementation details in unit tests */
5502
5584
  __internal: {
5503
5585
  get presenceBuffer() {
5504
- return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _124 => _124.buffer, 'access', _125 => _125.presenceUpdates, 'optionalAccess', _126 => _126.data]), () => ( null)));
5586
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _125 => _125.buffer, 'access', _126 => _126.presenceUpdates, 'optionalAccess', _127 => _127.data]), () => ( null)));
5505
5587
  },
5506
5588
  // prettier-ignore
5507
5589
  get undoStack() {
@@ -5553,7 +5635,8 @@ ${Array.from(traces).join("\n\n")}`
5553
5635
  getSelf: () => self.current,
5554
5636
  // Presence
5555
5637
  getPresence: () => context.myPresence.current,
5556
- getOthers: () => context.others.current
5638
+ getOthers: () => context.others.current,
5639
+ ...commentsApi
5557
5640
  },
5558
5641
  // Explictly make the __internal field non-enumerable, to avoid aggressive
5559
5642
  // freezing when used with Immer
@@ -5632,7 +5715,7 @@ function makeClassicSubscribeFn(events) {
5632
5715
  }
5633
5716
  if (isLiveNode(first)) {
5634
5717
  const node = first;
5635
- if (_optionalChain([options, 'optionalAccess', _127 => _127.isDeep])) {
5718
+ if (_optionalChain([options, 'optionalAccess', _128 => _128.isDeep])) {
5636
5719
  const storageCallback = second;
5637
5720
  return subscribeToLiveStructureDeeply(node, storageCallback);
5638
5721
  } else {
@@ -5733,12 +5816,12 @@ function createClient(options) {
5733
5816
  createSocket: makeCreateSocketDelegateForRoom(
5734
5817
  roomId,
5735
5818
  getServerFromClientOptions(clientOptions),
5736
- _optionalChain([clientOptions, 'access', _128 => _128.polyfills, 'optionalAccess', _129 => _129.WebSocket])
5819
+ _optionalChain([clientOptions, 'access', _129 => _129.polyfills, 'optionalAccess', _130 => _130.WebSocket])
5737
5820
  ),
5738
5821
  authenticate: makeAuthDelegateForRoom(roomId, authManager)
5739
5822
  })),
5740
5823
  enableDebugLogging: clientOptions.enableDebugLogging,
5741
- unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _130 => _130.unstable_batchedUpdates]),
5824
+ unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _131 => _131.unstable_batchedUpdates]),
5742
5825
  liveblocksServer: getServerFromClientOptions(clientOptions),
5743
5826
  httpSendEndpoint: buildLiveblocksHttpSendEndpoint(
5744
5827
  clientOptions,
@@ -5753,7 +5836,7 @@ function createClient(options) {
5753
5836
  const shouldConnect = _nullishCoalesce(options2.shouldInitiallyConnect, () => ( true));
5754
5837
  if (shouldConnect) {
5755
5838
  if (typeof atob === "undefined") {
5756
- if (_optionalChain([clientOptions, 'access', _131 => _131.polyfills, 'optionalAccess', _132 => _132.atob]) === void 0) {
5839
+ if (_optionalChain([clientOptions, 'access', _132 => _132.polyfills, 'optionalAccess', _133 => _133.atob]) === void 0) {
5757
5840
  throw new Error(
5758
5841
  "You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
5759
5842
  );
@@ -5773,13 +5856,6 @@ function createClient(options) {
5773
5856
  }
5774
5857
  }
5775
5858
  return {
5776
- __internal: {
5777
- getAuthValue: authManager.getAuthValue,
5778
- realtimeClient: createRealtimeClient(
5779
- authManager,
5780
- getWsEventServerEndpoint(options)
5781
- )
5782
- },
5783
5859
  getRoom,
5784
5860
  enter,
5785
5861
  leave
@@ -5813,12 +5889,6 @@ function buildLiveblocksHttpSendEndpoint(options, roomId) {
5813
5889
  roomId
5814
5890
  )}/send-message`;
5815
5891
  }
5816
- function getWsEventServerEndpoint(options) {
5817
- if (typeof options.eventsServerEndpoint === "string") {
5818
- return options.eventsServerEndpoint;
5819
- }
5820
- return `wss://events.liveblocks.io/v1`;
5821
- }
5822
5892
 
5823
5893
  // src/crdts/utils.ts
5824
5894
  function toPlainLson(lson) {
@@ -6049,12 +6119,12 @@ function legacy_patchImmutableNode(state, path, update) {
6049
6119
  }
6050
6120
  const newState = Object.assign({}, state);
6051
6121
  for (const key in update.updates) {
6052
- if (_optionalChain([update, 'access', _133 => _133.updates, 'access', _134 => _134[key], 'optionalAccess', _135 => _135.type]) === "update") {
6122
+ if (_optionalChain([update, 'access', _134 => _134.updates, 'access', _135 => _135[key], 'optionalAccess', _136 => _136.type]) === "update") {
6053
6123
  const val = update.node.get(key);
6054
6124
  if (val !== void 0) {
6055
6125
  newState[key] = lsonToJson(val);
6056
6126
  }
6057
- } else if (_optionalChain([update, 'access', _136 => _136.updates, 'access', _137 => _137[key], 'optionalAccess', _138 => _138.type]) === "delete") {
6127
+ } else if (_optionalChain([update, 'access', _137 => _137.updates, 'access', _138 => _138[key], 'optionalAccess', _139 => _139.type]) === "delete") {
6058
6128
  delete newState[key];
6059
6129
  }
6060
6130
  }
@@ -6115,12 +6185,12 @@ function legacy_patchImmutableNode(state, path, update) {
6115
6185
  }
6116
6186
  const newState = Object.assign({}, state);
6117
6187
  for (const key in update.updates) {
6118
- if (_optionalChain([update, 'access', _139 => _139.updates, 'access', _140 => _140[key], 'optionalAccess', _141 => _141.type]) === "update") {
6188
+ if (_optionalChain([update, 'access', _140 => _140.updates, 'access', _141 => _141[key], 'optionalAccess', _142 => _142.type]) === "update") {
6119
6189
  const value = update.node.get(key);
6120
6190
  if (value !== void 0) {
6121
6191
  newState[key] = lsonToJson(value);
6122
6192
  }
6123
- } else if (_optionalChain([update, 'access', _142 => _142.updates, 'access', _143 => _143[key], 'optionalAccess', _144 => _144.type]) === "delete") {
6193
+ } else if (_optionalChain([update, 'access', _143 => _143.updates, 'access', _144 => _144[key], 'optionalAccess', _145 => _145.type]) === "delete") {
6124
6194
  delete newState[key];
6125
6195
  }
6126
6196
  }
@@ -6210,7 +6280,7 @@ function createCacheItem(key, defaultAsyncFunction, options) {
6210
6280
  let previousState = { isLoading: false };
6211
6281
  const eventSource2 = makeEventSource();
6212
6282
  function notify() {
6213
- const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _145 => _145.isStateEqual]), () => ( isShallowEqual));
6283
+ const isEqual = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _146 => _146.isStateEqual]), () => ( isShallowEqual));
6214
6284
  if (!isEqual(previousState, state)) {
6215
6285
  previousState = state;
6216
6286
  eventSource2.notify(state);
@@ -6289,7 +6359,7 @@ function createAsyncCache(asyncFunction, options) {
6289
6359
  return create(key).get();
6290
6360
  }
6291
6361
  function getState(key) {
6292
- return _optionalChain([cache, 'access', _146 => _146.get, 'call', _147 => _147(key), 'optionalAccess', _148 => _148.getState, 'call', _149 => _149()]);
6362
+ return _optionalChain([cache, 'access', _147 => _147.get, 'call', _148 => _148(key), 'optionalAccess', _149 => _149.getState, 'call', _150 => _150()]);
6293
6363
  }
6294
6364
  function revalidate(key) {
6295
6365
  return create(key).revalidate();
@@ -6407,163 +6477,6 @@ function makePoller(callback) {
6407
6477
  };
6408
6478
  }
6409
6479
 
6410
- // src/comments/index.ts
6411
- function createCommentsApi(client, { serverEndpoint }) {
6412
- async function fetchJson(roomId, endpoint, options) {
6413
- const response = await fetchApi(roomId, endpoint, options);
6414
- if (!response.ok) {
6415
- if (response.status >= 400 && response.status < 600) {
6416
- let errorMessage = "";
6417
- try {
6418
- const errorBody = await response.json();
6419
- errorMessage = errorBody.message;
6420
- } catch (error3) {
6421
- errorMessage = response.statusText;
6422
- }
6423
- throw new Error(
6424
- `Request failed with status ${response.status}: ${errorMessage}`
6425
- );
6426
- }
6427
- }
6428
- let body;
6429
- try {
6430
- body = await response.json();
6431
- } catch (e3) {
6432
- body = {};
6433
- }
6434
- return body;
6435
- }
6436
- async function fetchApi(roomId, endpoint, options) {
6437
- const authValue = await client.__internal.getAuthValue(
6438
- "comments:read",
6439
- // TODO: Use the right scope
6440
- roomId
6441
- );
6442
- if (authValue.type !== "secret") {
6443
- throw new Error("Only secret key are supported for client.");
6444
- }
6445
- const url = `${serverEndpoint}/rooms/${roomId}${endpoint}`;
6446
- return await fetch(url, {
6447
- ...options,
6448
- headers: {
6449
- ..._optionalChain([options, 'optionalAccess', _150 => _150.headers]),
6450
- Authorization: `Bearer ${authValue.token.raw}`
6451
- }
6452
- });
6453
- }
6454
- async function getThreads({
6455
- roomId
6456
- }) {
6457
- const response = await fetchApi(roomId, "/threads");
6458
- if (response.ok) {
6459
- const json = await response.json();
6460
- return json.data;
6461
- } else if (response.status === 404) {
6462
- return [];
6463
- } else {
6464
- throw new Error("FAIL");
6465
- }
6466
- }
6467
- function createThread({
6468
- roomId,
6469
- metadata,
6470
- body,
6471
- commentId,
6472
- threadId
6473
- }) {
6474
- return fetchJson(roomId, "/threads", {
6475
- method: "POST",
6476
- headers: {
6477
- "Content-Type": "application/json"
6478
- },
6479
- body: JSON.stringify({
6480
- id: threadId,
6481
- comment: {
6482
- id: commentId,
6483
- body
6484
- },
6485
- metadata
6486
- })
6487
- });
6488
- }
6489
- function editThreadMetadata({
6490
- roomId,
6491
- metadata,
6492
- threadId
6493
- }) {
6494
- return fetchJson(
6495
- roomId,
6496
- `/threads/${threadId}/metadata`,
6497
- {
6498
- method: "POST",
6499
- headers: {
6500
- "Content-Type": "application/json"
6501
- },
6502
- body: JSON.stringify(metadata)
6503
- }
6504
- );
6505
- }
6506
- function createComment({
6507
- roomId,
6508
- threadId,
6509
- commentId,
6510
- body
6511
- }) {
6512
- return fetchJson(roomId, `/threads/${threadId}/comments`, {
6513
- method: "POST",
6514
- headers: {
6515
- "Content-Type": "application/json"
6516
- },
6517
- body: JSON.stringify({
6518
- id: commentId,
6519
- body
6520
- })
6521
- });
6522
- }
6523
- function editComment({
6524
- roomId,
6525
- threadId,
6526
- commentId,
6527
- body
6528
- }) {
6529
- return fetchJson(
6530
- roomId,
6531
- `/threads/${threadId}/comments/${commentId}`,
6532
- {
6533
- method: "POST",
6534
- headers: {
6535
- "Content-Type": "application/json"
6536
- },
6537
- body: JSON.stringify({
6538
- body
6539
- })
6540
- }
6541
- );
6542
- }
6543
- async function deleteComment({
6544
- roomId,
6545
- threadId,
6546
- commentId
6547
- }) {
6548
- await fetchJson(roomId, `/threads/${threadId}/comments/${commentId}`, {
6549
- method: "DELETE"
6550
- });
6551
- }
6552
- return {
6553
- getThreads,
6554
- createThread,
6555
- editThreadMetadata,
6556
- createComment,
6557
- editComment,
6558
- deleteComment
6559
- };
6560
- }
6561
-
6562
- // src/comments/utils.ts
6563
- function isCommentBodyMention(element) {
6564
- return "type" in element && element.type === "mention";
6565
- }
6566
-
6567
6480
  // src/index.ts
6568
6481
  detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
6569
6482
 
@@ -6607,6 +6520,5 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
6607
6520
 
6608
6521
 
6609
6522
 
6610
-
6611
- exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asArrayWithLegacyMethods = asArrayWithLegacyMethods; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.console = fancy_console_exports; exports.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyMention = isCommentBodyMention; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.shallow = shallow; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
6523
+ exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.OpCode = OpCode; exports.ServerMsgCode = ServerMsgCode; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asArrayWithLegacyMethods = asArrayWithLegacyMethods; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.b64decode = b64decode; exports.console = fancy_console_exports; exports.createAsyncCache = createAsyncCache; exports.createClient = createClient; exports.createCommentsApi = createCommentsApi; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.errorIf = errorIf; exports.freeze = freeze; exports.isChildCrdt = isChildCrdt; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.nn = nn; exports.patchLiveObjectKey = patchLiveObjectKey; exports.shallow = shallow; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.withTimeout = withTimeout;
6612
6524
  //# sourceMappingURL=index.js.map