@liveblocks/core 1.1.4-internal1 → 1.1.4

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.d.ts CHANGED
@@ -669,212 +669,6 @@ declare type Delegates<T extends BaseAuthResult> = {
669
669
  createSocket: (token: T) => IWebSocketInstance;
670
670
  };
671
671
 
672
- declare type IdTuple<T> = [id: string, value: T];
673
- declare enum CrdtType {
674
- OBJECT = 0,
675
- LIST = 1,
676
- MAP = 2,
677
- REGISTER = 3
678
- }
679
- declare type SerializedCrdt = SerializedRootObject | SerializedChild;
680
- declare type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
681
- declare type SerializedRootObject = {
682
- readonly type: CrdtType.OBJECT;
683
- readonly data: JsonObject;
684
- readonly parentId?: never;
685
- readonly parentKey?: never;
686
- };
687
- declare type SerializedObject = {
688
- readonly type: CrdtType.OBJECT;
689
- readonly parentId: string;
690
- readonly parentKey: string;
691
- readonly data: JsonObject;
692
- };
693
- declare type SerializedList = {
694
- readonly type: CrdtType.LIST;
695
- readonly parentId: string;
696
- readonly parentKey: string;
697
- };
698
- declare type SerializedMap = {
699
- readonly type: CrdtType.MAP;
700
- readonly parentId: string;
701
- readonly parentKey: string;
702
- };
703
- declare type SerializedRegister = {
704
- readonly type: CrdtType.REGISTER;
705
- readonly parentId: string;
706
- readonly parentKey: string;
707
- readonly data: Json;
708
- };
709
- declare function isRootCrdt(crdt: SerializedCrdt): crdt is SerializedRootObject;
710
- declare function isChildCrdt(crdt: SerializedCrdt): crdt is SerializedChild;
711
-
712
- declare enum ServerMsgCode {
713
- UPDATE_PRESENCE = 100,
714
- USER_JOINED = 101,
715
- USER_LEFT = 102,
716
- BROADCASTED_EVENT = 103,
717
- ROOM_STATE = 104,
718
- INITIAL_STORAGE_STATE = 200,
719
- UPDATE_STORAGE = 201,
720
- REJECT_STORAGE_OP = 299,
721
- UPDATE_YDOC = 300
722
- }
723
- /**
724
- * Messages that can be sent from the server to the client.
725
- */
726
- declare type ServerMsg<TPresence extends JsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json> = UpdatePresenceServerMsg<TPresence> | UserJoinServerMsg<TUserMeta> | UserLeftServerMsg | BroadcastedEventServerMsg<TRoomEvent> | RoomStateServerMsg<TUserMeta> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | RejectedStorageOpServerMsg | YDocUpdate;
727
- /**
728
- * Sent by the WebSocket server and broadcasted to all clients to announce that
729
- * a User updated their presence. For example, when a user moves their cursor.
730
- *
731
- * In most cases, the data payload will only include the fields from the
732
- * Presence that have been changed since the last announcement. However, after
733
- * a new user joins a room, a "full presence" will be announced so the newly
734
- * connected user will get each other's user full presence at least once. In
735
- * those cases, the `targetActor` field indicates the newly connected client,
736
- * so all other existing clients can ignore this broadcasted message.
737
- */
738
- declare type UpdatePresenceServerMsg<TPresence extends JsonObject> = {
739
- readonly type: ServerMsgCode.UPDATE_PRESENCE;
740
- /**
741
- * The User whose Presence has changed.
742
- */
743
- readonly actor: number;
744
- /**
745
- * When set, signifies that this is a Full Presence™ update, not a patch.
746
- *
747
- * The numeric value itself no longer has specific meaning. Historically,
748
- * this field was intended so that clients could ignore these broadcasted
749
- * full presence messages, but it turned out that getting a full presence
750
- * "keyframe" from time to time was useful.
751
- *
752
- * So nowadays, the presence (pun intended) of this `targetActor` field
753
- * is a backward-compatible way of expressing that the `data` contains
754
- * all presence fields, and isn't a partial "patch".
755
- */
756
- readonly targetActor: number;
757
- /**
758
- * The partial or full Presence of a User. If the `targetActor` field is set,
759
- * this will be the full Presence, otherwise it only contain the fields that
760
- * have changed since the last broadcast.
761
- */
762
- readonly data: TPresence;
763
- } | {
764
- readonly type: ServerMsgCode.UPDATE_PRESENCE;
765
- /**
766
- * The User whose Presence has changed.
767
- */
768
- readonly actor: number;
769
- /**
770
- * Not set for partial presence updates.
771
- */
772
- readonly targetActor?: undefined;
773
- /**
774
- * A partial Presence patch to apply to the User. It will only contain the
775
- * fields that have changed since the last broadcast.
776
- */
777
- readonly data: Partial<TPresence>;
778
- };
779
- /**
780
- * Sent by the WebSocket server and broadcasted to all clients to announce that
781
- * a new User has joined the Room.
782
- */
783
- declare type UserJoinServerMsg<TUserMeta extends BaseUserMeta> = {
784
- readonly type: ServerMsgCode.USER_JOINED;
785
- readonly actor: number;
786
- /**
787
- * The id of the User that has been set in the authentication endpoint.
788
- * Useful to get additional information about the connected user.
789
- */
790
- readonly id: TUserMeta["id"];
791
- /**
792
- * Additional user information that has been set in the authentication
793
- * endpoint.
794
- */
795
- readonly info: TUserMeta["info"];
796
- /**
797
- * Permissions that the user has in the Room.
798
- */
799
- readonly scopes: string[];
800
- };
801
- /**
802
- * Sent by the WebSocket server and broadcasted to all clients to announce that
803
- * a new User has left the Room.
804
- */
805
- declare type UserLeftServerMsg = {
806
- readonly type: ServerMsgCode.USER_LEFT;
807
- readonly actor: number;
808
- };
809
- /**
810
- * Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
811
- * Contains a base64 encoded update
812
- */
813
- declare type YDocUpdate = {
814
- readonly type: ServerMsgCode.UPDATE_YDOC;
815
- readonly update: string;
816
- readonly isSync: boolean;
817
- };
818
- /**
819
- * Sent by the WebSocket server and broadcasted to all clients to announce that
820
- * a User broadcasted an Event to everyone in the Room.
821
- */
822
- declare type BroadcastedEventServerMsg<TRoomEvent extends Json> = {
823
- readonly type: ServerMsgCode.BROADCASTED_EVENT;
824
- /**
825
- * The User who broadcasted the Event.
826
- */
827
- readonly actor: number;
828
- /**
829
- * The arbitrary payload of the Event. This can be any JSON value. Clients
830
- * will have to manually verify/decode this event.
831
- */
832
- readonly event: TRoomEvent;
833
- };
834
- /**
835
- * Sent by the WebSocket server to a single client in response to the client
836
- * joining the Room, to provide the initial state of the Room. The payload
837
- * includes a list of all other Users that already are in the Room.
838
- */
839
- declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
840
- readonly type: ServerMsgCode.ROOM_STATE;
841
- readonly users: {
842
- readonly [actor: number]: TUserMeta & {
843
- scopes: string[];
844
- };
845
- };
846
- };
847
- /**
848
- * Sent by the WebSocket server to a single client in response to the client
849
- * joining the Room, to provide the initial Storage state of the Room. The
850
- * payload includes the entire Storage document.
851
- */
852
- declare type InitialDocumentStateServerMsg = {
853
- readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
854
- readonly items: IdTuple<SerializedCrdt>[];
855
- };
856
- /**
857
- * Sent by the WebSocket server and broadcasted to all clients to announce that
858
- * a change occurred in the Storage document.
859
- *
860
- * The payload of this message contains a list of Ops (aka incremental
861
- * mutations to make to the initially loaded document).
862
- */
863
- declare type UpdateStorageServerMsg = {
864
- readonly type: ServerMsgCode.UPDATE_STORAGE;
865
- readonly ops: Op[];
866
- };
867
- /**
868
- * Sent by the WebSocket server to the client to indicate that certain opIds
869
- * have been received but were rejected because they caused mutations that are
870
- * incompatible with the Room's schema.
871
- */
872
- declare type RejectedStorageOpServerMsg = {
873
- readonly type: ServerMsgCode.REJECT_STORAGE_OP;
874
- readonly opIds: string[];
875
- readonly reason: string;
876
- };
877
-
878
672
  declare type ReadonlyArrayWithLegacyMethods<T> = readonly T[] & {
879
673
  /**
880
674
  * @deprecated Prefer the normal .length property on arrays.
@@ -1326,7 +1120,7 @@ declare type Room<TPresence extends JsonObject, TStorage extends LsonObject, TUs
1326
1120
  */
1327
1121
  readonly storageDidLoad: Observable<void>;
1328
1122
  readonly storageStatus: Observable<StorageStatus>;
1329
- readonly ydoc: Observable<YDocUpdate>;
1123
+ readonly ydoc: Observable<string>;
1330
1124
  };
1331
1125
  /**
1332
1126
  * Batches modifications made during the given function.
@@ -1703,6 +1497,211 @@ declare type UpdateYDocClientMsg = {
1703
1497
  readonly update: string;
1704
1498
  };
1705
1499
 
1500
+ declare type IdTuple<T> = [id: string, value: T];
1501
+ declare enum CrdtType {
1502
+ OBJECT = 0,
1503
+ LIST = 1,
1504
+ MAP = 2,
1505
+ REGISTER = 3
1506
+ }
1507
+ declare type SerializedCrdt = SerializedRootObject | SerializedChild;
1508
+ declare type SerializedChild = SerializedObject | SerializedList | SerializedMap | SerializedRegister;
1509
+ declare type SerializedRootObject = {
1510
+ readonly type: CrdtType.OBJECT;
1511
+ readonly data: JsonObject;
1512
+ readonly parentId?: never;
1513
+ readonly parentKey?: never;
1514
+ };
1515
+ declare type SerializedObject = {
1516
+ readonly type: CrdtType.OBJECT;
1517
+ readonly parentId: string;
1518
+ readonly parentKey: string;
1519
+ readonly data: JsonObject;
1520
+ };
1521
+ declare type SerializedList = {
1522
+ readonly type: CrdtType.LIST;
1523
+ readonly parentId: string;
1524
+ readonly parentKey: string;
1525
+ };
1526
+ declare type SerializedMap = {
1527
+ readonly type: CrdtType.MAP;
1528
+ readonly parentId: string;
1529
+ readonly parentKey: string;
1530
+ };
1531
+ declare type SerializedRegister = {
1532
+ readonly type: CrdtType.REGISTER;
1533
+ readonly parentId: string;
1534
+ readonly parentKey: string;
1535
+ readonly data: Json;
1536
+ };
1537
+ declare function isRootCrdt(crdt: SerializedCrdt): crdt is SerializedRootObject;
1538
+ declare function isChildCrdt(crdt: SerializedCrdt): crdt is SerializedChild;
1539
+
1540
+ declare enum ServerMsgCode {
1541
+ UPDATE_PRESENCE = 100,
1542
+ USER_JOINED = 101,
1543
+ USER_LEFT = 102,
1544
+ BROADCASTED_EVENT = 103,
1545
+ ROOM_STATE = 104,
1546
+ INITIAL_STORAGE_STATE = 200,
1547
+ UPDATE_STORAGE = 201,
1548
+ REJECT_STORAGE_OP = 299,
1549
+ UPDATE_YDOC = 300
1550
+ }
1551
+ /**
1552
+ * Messages that can be sent from the server to the client.
1553
+ */
1554
+ declare type ServerMsg<TPresence extends JsonObject, TUserMeta extends BaseUserMeta, TRoomEvent extends Json> = UpdatePresenceServerMsg<TPresence> | UserJoinServerMsg<TUserMeta> | UserLeftServerMsg | BroadcastedEventServerMsg<TRoomEvent> | RoomStateServerMsg<TUserMeta> | InitialDocumentStateServerMsg | UpdateStorageServerMsg | RejectedStorageOpServerMsg | YDocUpdate;
1555
+ /**
1556
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
1557
+ * a User updated their presence. For example, when a user moves their cursor.
1558
+ *
1559
+ * In most cases, the data payload will only include the fields from the
1560
+ * Presence that have been changed since the last announcement. However, after
1561
+ * a new user joins a room, a "full presence" will be announced so the newly
1562
+ * connected user will get each other's user full presence at least once. In
1563
+ * those cases, the `targetActor` field indicates the newly connected client,
1564
+ * so all other existing clients can ignore this broadcasted message.
1565
+ */
1566
+ declare type UpdatePresenceServerMsg<TPresence extends JsonObject> = {
1567
+ readonly type: ServerMsgCode.UPDATE_PRESENCE;
1568
+ /**
1569
+ * The User whose Presence has changed.
1570
+ */
1571
+ readonly actor: number;
1572
+ /**
1573
+ * When set, signifies that this is a Full Presence™ update, not a patch.
1574
+ *
1575
+ * The numeric value itself no longer has specific meaning. Historically,
1576
+ * this field was intended so that clients could ignore these broadcasted
1577
+ * full presence messages, but it turned out that getting a full presence
1578
+ * "keyframe" from time to time was useful.
1579
+ *
1580
+ * So nowadays, the presence (pun intended) of this `targetActor` field
1581
+ * is a backward-compatible way of expressing that the `data` contains
1582
+ * all presence fields, and isn't a partial "patch".
1583
+ */
1584
+ readonly targetActor: number;
1585
+ /**
1586
+ * The partial or full Presence of a User. If the `targetActor` field is set,
1587
+ * this will be the full Presence, otherwise it only contain the fields that
1588
+ * have changed since the last broadcast.
1589
+ */
1590
+ readonly data: TPresence;
1591
+ } | {
1592
+ readonly type: ServerMsgCode.UPDATE_PRESENCE;
1593
+ /**
1594
+ * The User whose Presence has changed.
1595
+ */
1596
+ readonly actor: number;
1597
+ /**
1598
+ * Not set for partial presence updates.
1599
+ */
1600
+ readonly targetActor?: undefined;
1601
+ /**
1602
+ * A partial Presence patch to apply to the User. It will only contain the
1603
+ * fields that have changed since the last broadcast.
1604
+ */
1605
+ readonly data: Partial<TPresence>;
1606
+ };
1607
+ /**
1608
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
1609
+ * a new User has joined the Room.
1610
+ */
1611
+ declare type UserJoinServerMsg<TUserMeta extends BaseUserMeta> = {
1612
+ readonly type: ServerMsgCode.USER_JOINED;
1613
+ readonly actor: number;
1614
+ /**
1615
+ * The id of the User that has been set in the authentication endpoint.
1616
+ * Useful to get additional information about the connected user.
1617
+ */
1618
+ readonly id: TUserMeta["id"];
1619
+ /**
1620
+ * Additional user information that has been set in the authentication
1621
+ * endpoint.
1622
+ */
1623
+ readonly info: TUserMeta["info"];
1624
+ /**
1625
+ * Permissions that the user has in the Room.
1626
+ */
1627
+ readonly scopes: string[];
1628
+ };
1629
+ /**
1630
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
1631
+ * a new User has left the Room.
1632
+ */
1633
+ declare type UserLeftServerMsg = {
1634
+ readonly type: ServerMsgCode.USER_LEFT;
1635
+ readonly actor: number;
1636
+ };
1637
+ /**
1638
+ * Sent by the WebSocket server when the ydoc is updated or when requested based on stateVector passed.
1639
+ * Contains a base64 encoded update
1640
+ */
1641
+ declare type YDocUpdate = {
1642
+ readonly type: ServerMsgCode.UPDATE_YDOC;
1643
+ readonly update: string;
1644
+ };
1645
+ /**
1646
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
1647
+ * a User broadcasted an Event to everyone in the Room.
1648
+ */
1649
+ declare type BroadcastedEventServerMsg<TRoomEvent extends Json> = {
1650
+ readonly type: ServerMsgCode.BROADCASTED_EVENT;
1651
+ /**
1652
+ * The User who broadcasted the Event.
1653
+ */
1654
+ readonly actor: number;
1655
+ /**
1656
+ * The arbitrary payload of the Event. This can be any JSON value. Clients
1657
+ * will have to manually verify/decode this event.
1658
+ */
1659
+ readonly event: TRoomEvent;
1660
+ };
1661
+ /**
1662
+ * Sent by the WebSocket server to a single client in response to the client
1663
+ * joining the Room, to provide the initial state of the Room. The payload
1664
+ * includes a list of all other Users that already are in the Room.
1665
+ */
1666
+ declare type RoomStateServerMsg<TUserMeta extends BaseUserMeta> = {
1667
+ readonly type: ServerMsgCode.ROOM_STATE;
1668
+ readonly users: {
1669
+ readonly [actor: number]: TUserMeta & {
1670
+ scopes: string[];
1671
+ };
1672
+ };
1673
+ };
1674
+ /**
1675
+ * Sent by the WebSocket server to a single client in response to the client
1676
+ * joining the Room, to provide the initial Storage state of the Room. The
1677
+ * payload includes the entire Storage document.
1678
+ */
1679
+ declare type InitialDocumentStateServerMsg = {
1680
+ readonly type: ServerMsgCode.INITIAL_STORAGE_STATE;
1681
+ readonly items: IdTuple<SerializedCrdt>[];
1682
+ };
1683
+ /**
1684
+ * Sent by the WebSocket server and broadcasted to all clients to announce that
1685
+ * a change occurred in the Storage document.
1686
+ *
1687
+ * The payload of this message contains a list of Ops (aka incremental
1688
+ * mutations to make to the initially loaded document).
1689
+ */
1690
+ declare type UpdateStorageServerMsg = {
1691
+ readonly type: ServerMsgCode.UPDATE_STORAGE;
1692
+ readonly ops: Op[];
1693
+ };
1694
+ /**
1695
+ * Sent by the WebSocket server to the client to indicate that certain opIds
1696
+ * have been received but were rejected because they caused mutations that are
1697
+ * incompatible with the Room's schema.
1698
+ */
1699
+ declare type RejectedStorageOpServerMsg = {
1700
+ readonly type: ServerMsgCode.REJECT_STORAGE_OP;
1701
+ readonly opIds: string[];
1702
+ readonly reason: string;
1703
+ };
1704
+
1706
1705
  /**
1707
1706
  * Lookup table for nodes (= SerializedCrdt values) by their IDs.
1708
1707
  */
package/dist/index.js CHANGED
@@ -103,7 +103,7 @@ var onMessageFromPanel = eventSource.observable;
103
103
  // src/devtools/index.ts
104
104
  var VERSION = true ? (
105
105
  /* istanbul ignore next */
106
- "1.1.4-internal1"
106
+ "1.1.4"
107
107
  ) : "dev";
108
108
  var _devtoolsSetupHasRun = false;
109
109
  function setupDevTools(getAllRooms) {
@@ -726,6 +726,9 @@ function tryParseJson(rawMessage) {
726
726
  return void 0;
727
727
  }
728
728
  }
729
+ function deepClone(items) {
730
+ return JSON.parse(JSON.stringify(items));
731
+ }
729
732
  function b64decode(b64value) {
730
733
  try {
731
734
  const formattedValue = b64value.replace(/-/g, "+").replace(/_/g, "/");
@@ -4070,10 +4073,10 @@ var PatchableRef = class extends ImmutableRef {
4070
4073
  * Patches the current object.
4071
4074
  */
4072
4075
  patch(patch) {
4073
- const oldMe = this._data;
4074
- const newMe = merge(oldMe, patch);
4075
- if (oldMe !== newMe) {
4076
- this._data = freeze(newMe);
4076
+ const oldData = this._data;
4077
+ const newData = merge(oldData, patch);
4078
+ if (oldData !== newData) {
4079
+ this._data = freeze(newData);
4077
4080
  this.invalidate();
4078
4081
  }
4079
4082
  }
@@ -4149,7 +4152,7 @@ function createRoom(options, config) {
4149
4152
  buffer: {
4150
4153
  flushTimerID: void 0,
4151
4154
  lastFlushedAt: 0,
4152
- me: (
4155
+ presenceUpdates: (
4153
4156
  // Queue up the initial presence message as a Full Presence™ update
4154
4157
  {
4155
4158
  type: "full",
@@ -4230,7 +4233,7 @@ function createRoom(options, config) {
4230
4233
  if (sessionInfo === null) {
4231
4234
  throw new Error("Unexpected missing session info");
4232
4235
  }
4233
- context.buffer.me = {
4236
+ context.buffer.presenceUpdates = {
4234
4237
  type: "full",
4235
4238
  data: (
4236
4239
  // Because context.me.current is a readonly object, we'll have to
@@ -4461,11 +4464,11 @@ function createRoom(options, config) {
4461
4464
  reverse.data[key] = context.me.current[key];
4462
4465
  }
4463
4466
  context.me.patch(op.data);
4464
- if (context.buffer.me === null) {
4465
- context.buffer.me = { type: "partial", data: op.data };
4467
+ if (context.buffer.presenceUpdates === null) {
4468
+ context.buffer.presenceUpdates = { type: "partial", data: op.data };
4466
4469
  } else {
4467
4470
  for (const key in op.data) {
4468
- context.buffer.me.data[key] = op.data[key];
4471
+ context.buffer.presenceUpdates.data[key] = op.data[key];
4469
4472
  }
4470
4473
  }
4471
4474
  output.reverse.unshift(reverse);
@@ -4556,8 +4559,8 @@ function createRoom(options, config) {
4556
4559
  }
4557
4560
  function updatePresence(patch, options2) {
4558
4561
  const oldValues = {};
4559
- if (context.buffer.me === null) {
4560
- context.buffer.me = {
4562
+ if (context.buffer.presenceUpdates === null) {
4563
+ context.buffer.presenceUpdates = {
4561
4564
  type: "partial",
4562
4565
  data: {}
4563
4566
  };
@@ -4567,7 +4570,7 @@ function createRoom(options, config) {
4567
4570
  if (overrideValue === void 0) {
4568
4571
  continue;
4569
4572
  }
4570
- context.buffer.me.data[key] = overrideValue;
4573
+ context.buffer.presenceUpdates.data[key] = overrideValue;
4571
4574
  oldValues[key] = context.me.current[key];
4572
4575
  }
4573
4576
  context.me.patch(patch);
@@ -4745,7 +4748,7 @@ function createRoom(options, config) {
4745
4748
  break;
4746
4749
  }
4747
4750
  case 300 /* UPDATE_YDOC */: {
4748
- eventHub.ydoc.notify(message);
4751
+ eventHub.ydoc.notify(message.update);
4749
4752
  break;
4750
4753
  }
4751
4754
  case 104 /* ROOM_STATE */: {
@@ -4828,7 +4831,7 @@ ${Array.from(traces).join("\n\n")}`
4828
4831
  lastFlushedAt: now,
4829
4832
  messages: [],
4830
4833
  storageOperations: [],
4831
- me: null
4834
+ presenceUpdates: null
4832
4835
  };
4833
4836
  } else {
4834
4837
  clearTimeout(context.buffer.flushTimerID);
@@ -4840,18 +4843,18 @@ ${Array.from(traces).join("\n\n")}`
4840
4843
  }
4841
4844
  function serializeBuffer() {
4842
4845
  const messages = [];
4843
- if (context.buffer.me) {
4846
+ if (context.buffer.presenceUpdates) {
4844
4847
  messages.push(
4845
- context.buffer.me.type === "full" ? {
4848
+ context.buffer.presenceUpdates.type === "full" ? {
4846
4849
  type: 100 /* UPDATE_PRESENCE */,
4847
4850
  // Populating the `targetActor` field turns this message into
4848
4851
  // a Full Presence™ update message (not a patch), which will get
4849
4852
  // interpreted by other clients as such.
4850
4853
  targetActor: -1,
4851
- data: context.buffer.me.data
4854
+ data: context.buffer.presenceUpdates.data
4852
4855
  } : {
4853
4856
  type: 100 /* UPDATE_PRESENCE */,
4854
- data: context.buffer.me.data
4857
+ data: context.buffer.presenceUpdates.data
4855
4858
  }
4856
4859
  );
4857
4860
  }
@@ -5064,12 +5067,12 @@ ${Array.from(traces).join("\n\n")}`
5064
5067
  return {
5065
5068
  /* NOTE: Exposing __internal here only to allow testing implementation details in unit tests */
5066
5069
  __internal: {
5067
- get buffer() {
5068
- return context.buffer;
5070
+ get presenceBuffer() {
5071
+ return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _127 => _127.buffer, 'access', _128 => _128.presenceUpdates, 'optionalAccess', _129 => _129.data]), () => ( null)));
5069
5072
  },
5070
5073
  // prettier-ignore
5071
5074
  get undoStack() {
5072
- return context.undoStack;
5075
+ return deepClone(context.undoStack);
5073
5076
  },
5074
5077
  // prettier-ignore
5075
5078
  get nodeCount() {
@@ -5192,7 +5195,7 @@ function makeClassicSubscribeFn(events) {
5192
5195
  }
5193
5196
  if (isLiveNode(first)) {
5194
5197
  const node = first;
5195
- if (_optionalChain([options, 'optionalAccess', _127 => _127.isDeep])) {
5198
+ if (_optionalChain([options, 'optionalAccess', _130 => _130.isDeep])) {
5196
5199
  const storageCallback = second;
5197
5200
  return subscribeToLiveStructureDeeply(node, storageCallback);
5198
5201
  } else {
@@ -5222,7 +5225,7 @@ function makeCreateSocketDelegateForRoom(liveblocksServer, WebSocketPolyfill) {
5222
5225
  // @ts-ignore (__PACKAGE_VERSION__ will be injected by the build script)
5223
5226
  true ? (
5224
5227
  /* istanbul ignore next */
5225
- "1.1.4-internal1"
5228
+ "1.1.4"
5226
5229
  ) : "dev"}`
5227
5230
  );
5228
5231
  };
@@ -5361,7 +5364,7 @@ function createClient(options) {
5361
5364
  polyfills: clientOptions.polyfills,
5362
5365
  delegates: clientOptions.mockedDelegates,
5363
5366
  enableDebugLogging: clientOptions.enableDebugLogging,
5364
- unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _128 => _128.unstable_batchedUpdates]),
5367
+ unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _131 => _131.unstable_batchedUpdates]),
5365
5368
  liveblocksServer: getServerFromClientOptions(clientOptions),
5366
5369
  authentication: prepareAuthentication(clientOptions, roomId),
5367
5370
  httpSendEndpoint: buildLiveblocksHttpSendEndpoint(
@@ -5377,7 +5380,7 @@ function createClient(options) {
5377
5380
  const shouldConnect = _nullishCoalesce(options2.shouldInitiallyConnect, () => ( true));
5378
5381
  if (shouldConnect) {
5379
5382
  if (typeof atob === "undefined") {
5380
- if (_optionalChain([clientOptions, 'access', _129 => _129.polyfills, 'optionalAccess', _130 => _130.atob]) === void 0) {
5383
+ if (_optionalChain([clientOptions, 'access', _132 => _132.polyfills, 'optionalAccess', _133 => _133.atob]) === void 0) {
5381
5384
  throw new Error(
5382
5385
  "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"
5383
5386
  );
@@ -5710,12 +5713,12 @@ function legacy_patchImmutableNode(state, path, update) {
5710
5713
  }
5711
5714
  const newState = Object.assign({}, state);
5712
5715
  for (const key in update.updates) {
5713
- if (_optionalChain([update, 'access', _131 => _131.updates, 'access', _132 => _132[key], 'optionalAccess', _133 => _133.type]) === "update") {
5716
+ if (_optionalChain([update, 'access', _134 => _134.updates, 'access', _135 => _135[key], 'optionalAccess', _136 => _136.type]) === "update") {
5714
5717
  const val = update.node.get(key);
5715
5718
  if (val !== void 0) {
5716
5719
  newState[key] = lsonToJson(val);
5717
5720
  }
5718
- } else if (_optionalChain([update, 'access', _134 => _134.updates, 'access', _135 => _135[key], 'optionalAccess', _136 => _136.type]) === "delete") {
5721
+ } else if (_optionalChain([update, 'access', _137 => _137.updates, 'access', _138 => _138[key], 'optionalAccess', _139 => _139.type]) === "delete") {
5719
5722
  delete newState[key];
5720
5723
  }
5721
5724
  }
@@ -5776,12 +5779,12 @@ function legacy_patchImmutableNode(state, path, update) {
5776
5779
  }
5777
5780
  const newState = Object.assign({}, state);
5778
5781
  for (const key in update.updates) {
5779
- if (_optionalChain([update, 'access', _137 => _137.updates, 'access', _138 => _138[key], 'optionalAccess', _139 => _139.type]) === "update") {
5782
+ if (_optionalChain([update, 'access', _140 => _140.updates, 'access', _141 => _141[key], 'optionalAccess', _142 => _142.type]) === "update") {
5780
5783
  const value = update.node.get(key);
5781
5784
  if (value !== void 0) {
5782
5785
  newState[key] = lsonToJson(value);
5783
5786
  }
5784
- } else if (_optionalChain([update, 'access', _140 => _140.updates, 'access', _141 => _141[key], 'optionalAccess', _142 => _142.type]) === "delete") {
5787
+ } else if (_optionalChain([update, 'access', _143 => _143.updates, 'access', _144 => _144[key], 'optionalAccess', _145 => _145.type]) === "delete") {
5785
5788
  delete newState[key];
5786
5789
  }
5787
5790
  }