@liveblocks/client 0.16.13 → 0.16.16

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { C as ClientOptions, a as Client } from './shared';
2
- export { B as BroadcastOptions, a as Client, H as History, J as Json, d as JsonObject, L as LiveList, b as LiveMap, c as LiveObject, e as LiveStructure, f as Lson, g as LsonObject, O as Others, P as Presence, R as Room, S as StorageUpdate, U as User } from './shared';
2
+ export { B as BroadcastOptions, a as Client, H as History, J as Json, d as JsonObject, c as LiveList, b as LiveMap, L as LiveObject, e as Lson, f as LsonObject, O as Others, P as Presence, R as Room, S as StorageUpdate, U as User } from './shared';
3
3
 
4
4
  /**
5
5
  * Create a client that will be responsible to communicate with liveblocks servers.
package/index.js CHANGED
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var LiveObject = require("./shared.js"), _excluded = [ "_hasReceivedInitialPresence" ], BACKOFF_RETRY_DELAYS = [ 250, 500, 1e3, 2e3, 4e3, 8e3, 1e4 ], BACKOFF_RETRY_DELAYS_SLOW = [ 2e3, 3e4, 6e4, 3e5 ];
8
8
 
9
+ function isValidRoomEventType(value) {
10
+ return "my-presence" === value || "others" === value || "event" === value || "error" === value || "connection" === value;
11
+ }
12
+
9
13
  function makeOthers(userMap) {
10
14
  var _ref, users = Object.values(userMap).map((function(user) {
11
15
  return user._hasReceivedInitialPresence, LiveObject._objectWithoutPropertiesLoose(user, _excluded);
@@ -93,8 +97,8 @@ function makeStateMachine(state, context, mockedEffects) {
93
97
  roomId: context.roomId
94
98
  })), state.defaultStorageRoot) null == state.root.get(_key) && state.root.set(_key, state.defaultStorageRoot[_key]);
95
99
  }
96
- function addItem(id, liveItem) {
97
- state.items.set(id, liveItem);
100
+ function addItem(id, item) {
101
+ state.items.set(id, item);
98
102
  }
99
103
  function deleteItem(id) {
100
104
  state.items.delete(id);
@@ -160,34 +164,40 @@ function makeStateMachine(state, context, mockedEffects) {
160
164
  if (state.me = LiveObject._extends({}, state.me, op.data), null == state.buffer.presence) state.buffer.presence = op.data; else for (var _key3 in op.data) state.buffer.presence[_key3] = op.data[_key3];
161
165
  result.reverse.unshift(reverse), result.updates.presence = !0;
162
166
  } else {
163
- var source = void 0;
164
- if (op.opId || (op.opId = generateOpId()), isLocal) source = LiveObject.OpSource.UNDOREDO_RECONNECT; else source = state.offlineOperations.delete(LiveObject.nn(op.opId)) ? LiveObject.OpSource.ACK : LiveObject.OpSource.REMOTE;
165
- var applyOpResult = applyOp(op, source);
167
+ isLocal && !op.opId && (op.opId = generateOpId());
168
+ var applyOpResult = applyOp(op, isLocal);
166
169
  if (applyOpResult.modified) {
167
- var _result$reverse, parentId = "HasParent" === applyOpResult.modified.node.parent.type ? LiveObject.nn(applyOpResult.modified.node.parent.node._id, "Expected parent node to have an ID") : void 0;
168
- if (!parentId || !createdNodeIds.has(parentId)) result.updates.storageUpdates.set(LiveObject.nn(applyOpResult.modified.node._id), LiveObject.mergeStorageUpdates(result.updates.storageUpdates.get(LiveObject.nn(applyOpResult.modified.node._id)), applyOpResult.modified)),
170
+ var _applyOpResult$modifi, _result$reverse, parentId = null == (_applyOpResult$modifi = applyOpResult.modified.node._parent) ? void 0 : _applyOpResult$modifi._id;
171
+ if (!createdNodeIds.has(parentId)) result.updates.storageUpdates.set(applyOpResult.modified.node._id, LiveObject.mergeStorageUpdates(result.updates.storageUpdates.get(applyOpResult.modified.node._id), applyOpResult.modified)),
169
172
  (_result$reverse = result.reverse).unshift.apply(_result$reverse, applyOpResult.reverse);
170
- op.type !== LiveObject.OpCode.CREATE_LIST && op.type !== LiveObject.OpCode.CREATE_MAP && op.type !== LiveObject.OpCode.CREATE_OBJECT || createdNodeIds.add(LiveObject.nn(applyOpResult.modified.node._id));
173
+ op.type !== LiveObject.OpCode.CREATE_LIST && op.type !== LiveObject.OpCode.CREATE_MAP && op.type !== LiveObject.OpCode.CREATE_OBJECT || createdNodeIds.add(applyOpResult.modified.node._id);
171
174
  }
172
175
  }
173
176
  }
174
177
  return result;
175
178
  }
176
- function applyOp(op, source) {
177
- switch (op.type) {
179
+ function applyOp(op, isLocal) {
180
+ switch (op.opId && state.offlineOperations.delete(op.opId), op.type) {
178
181
  case LiveObject.OpCode.DELETE_OBJECT_KEY:
179
182
  case LiveObject.OpCode.UPDATE_OBJECT:
180
183
  case LiveObject.OpCode.DELETE_CRDT:
181
184
  var item = state.items.get(op.id);
182
185
  return null == item ? {
183
186
  modified: !1
184
- } : item._apply(op, source === LiveObject.OpSource.UNDOREDO_RECONNECT);
187
+ } : item._apply(op, isLocal);
185
188
 
186
189
  case LiveObject.OpCode.SET_PARENT_KEY:
187
190
  var _item = state.items.get(op.id);
188
- return null == _item ? {
191
+ if (null == _item) return {
189
192
  modified: !1
190
- } : "HasParent" === _item.parent.type && LiveObject.isLiveList(_item.parent.node) ? _item.parent.node._setChildKey(op.parentKey, _item, source) : {
193
+ };
194
+ if (_item._parent instanceof LiveObject.LiveList) {
195
+ var previousKey = _item._parentKey;
196
+ return previousKey === op.parentKey ? {
197
+ modified: !1
198
+ } : _item._parent._setChildKey(op.parentKey, _item, previousKey);
199
+ }
200
+ return {
191
201
  modified: !1
192
202
  };
193
203
 
@@ -195,13 +205,10 @@ function makeStateMachine(state, context, mockedEffects) {
195
205
  case LiveObject.OpCode.CREATE_LIST:
196
206
  case LiveObject.OpCode.CREATE_MAP:
197
207
  case LiveObject.OpCode.CREATE_REGISTER:
198
- if (void 0 === op.parentId) return {
199
- modified: !1
200
- };
201
208
  var parent = state.items.get(op.parentId);
202
209
  return null == parent ? {
203
210
  modified: !1
204
- } : parent._attachChild(op, source);
211
+ } : parent._attachChild(op, isLocal);
205
212
  }
206
213
  }
207
214
  function connect() {
@@ -440,7 +447,7 @@ function makeStateMachine(state, context, mockedEffects) {
440
447
  function tryFlushing() {
441
448
  var storageOps = state.buffer.storageOperations;
442
449
  if (storageOps.length > 0 && storageOps.forEach((function(op) {
443
- state.offlineOperations.set(LiveObject.nn(op.opId), op);
450
+ state.offlineOperations.set(op.opId, op);
444
451
  })), null != state.socket && state.socket.readyState === state.socket.OPEN) {
445
452
  var now = Date.now();
446
453
  if (now - state.lastFlushTime > context.throttleDelay) {
@@ -488,10 +495,10 @@ function makeStateMachine(state, context, mockedEffects) {
488
495
  "unavailable" === state.connection.state && reconnect();
489
496
  },
490
497
  simulateSocketClose: function() {
491
- state.socket && (state.socket = null);
498
+ state.socket && state.socket.close();
492
499
  },
493
500
  simulateSendCloseEvent: function(event) {
494
- onClose(event);
501
+ state.socket && onClose(event);
495
502
  },
496
503
  onVisibilityChange: function(visibilityState) {
497
504
  "visible" === visibilityState && "open" === state.connection.state && heartbeat();
@@ -519,23 +526,28 @@ function makeStateMachine(state, context, mockedEffects) {
519
526
  }();
520
527
  },
521
528
  subscribe: function(firstParam, listener, options) {
522
- if (LiveObject.isLiveNode(firstParam)) return function(liveValue, innerCallback, options) {
529
+ if (firstParam instanceof LiveObject.AbstractCrdt) return function(crdt, innerCallback, options) {
523
530
  return genericSubscribe((function(updates) {
524
531
  for (var _step, relatedUpdates = [], _iterator = LiveObject._createForOfIteratorHelperLoose(updates); !(_step = _iterator()).done; ) {
525
532
  var update = _step.value;
526
- null != options && options.isDeep && LiveObject.isSameNodeOrChildOf(update.node, liveValue) ? relatedUpdates.push(update) : update.node._id === liveValue._id && innerCallback(update.node);
533
+ null != options && options.isDeep && LiveObject.isSameNodeOrChildOf(update.node, crdt) ? relatedUpdates.push(update) : update.node._id === crdt._id && innerCallback(update.node);
527
534
  }
528
535
  null != options && options.isDeep && relatedUpdates.length > 0 && innerCallback(relatedUpdates);
529
536
  }));
530
537
  }(firstParam, listener, options);
531
538
  if ("function" == typeof firstParam) return genericSubscribe(firstParam);
532
- if ("my-presence" !== (value = firstParam) && "others" !== value && "event" !== value && "error" !== value && "connection" !== value) throw new Error('"' + firstParam + '" is not a valid event name');
533
- var value;
539
+ if (!isValidRoomEventType(firstParam)) throw new Error('"' + firstParam + '" is not a valid event name');
534
540
  return state.listeners[firstParam].push(listener), function() {
535
541
  var callbacks = state.listeners[firstParam];
536
542
  LiveObject.remove(callbacks, listener);
537
543
  };
538
544
  },
545
+ unsubscribe: function(event, callback) {
546
+ if (console.warn("unsubscribe is depreacted and will be removed in a future version.\nuse the callback returned by subscribe instead.\nSee v0.13 release notes for more information.\n"),
547
+ !isValidRoomEventType(event)) throw new Error('"' + event + '" is not a valid event name');
548
+ var callbacks = state.listeners[event];
549
+ LiveObject.remove(callbacks, callback);
550
+ },
539
551
  updatePresence: function(overrides, options) {
540
552
  var oldValues = {};
541
553
  for (var _key4 in null == state.buffer.presence && (state.buffer.presence = {}),
@@ -623,7 +635,7 @@ function makeStateMachine(state, context, mockedEffects) {
623
635
  return _getInitialStateResolver = resolve;
624
636
  }))), _getInitialStatePromise.then((function() {
625
637
  return {
626
- root: LiveObject.nn(state.root)
638
+ root: state.root
627
639
  };
628
640
  })));
629
641
  },
@@ -709,6 +721,7 @@ function createRoom(options, context) {
709
721
  getConnectionState: machine.selectors.getConnectionState,
710
722
  getSelf: machine.selectors.getSelf,
711
723
  subscribe: machine.subscribe,
724
+ unsubscribe: machine.unsubscribe,
712
725
  getPresence: machine.selectors.getPresence,
713
726
  updatePresence: machine.updatePresence,
714
727
  getOthers: machine.selectors.getOthers,
@@ -721,9 +734,9 @@ function createRoom(options, context) {
721
734
  pause: machine.pauseHistory,
722
735
  resume: machine.resumeHistory
723
736
  },
724
- __INTERNAL_DO_NOT_USE: {
725
- simulateCloseWebsocket: machine.simulateSocketClose,
726
- simulateSendCloseEvent: machine.simulateSendCloseEvent
737
+ internalDevTools: {
738
+ closeWebsocket: machine.simulateSocketClose,
739
+ sendCloseEvent: machine.simulateSendCloseEvent
727
740
  }
728
741
  };
729
742
  return {
@@ -819,8 +832,8 @@ exports.createClient = function(options) {
819
832
  enter: function(roomId, options) {
820
833
  void 0 === options && (options = {});
821
834
  var internalRoom = rooms.get(roomId);
822
- return internalRoom || (LiveObject.errorIf(options.defaultPresence, "Argument `defaultPresence` will be removed in @liveblocks/client 0.18. Please use `initialPresence` instead. For more info, see https://bit.ly/3Niy5aP"),
823
- LiveObject.errorIf(options.defaultStorageRoot, "Argument `defaultStorageRoot` will be removed in @liveblocks/client 0.18. Please use `initialStorage` instead. For more info, see https://bit.ly/3Niy5aP"),
835
+ return internalRoom || (LiveObject.deprecateIf(options.defaultPresence, "Argument `defaultPresence` will be removed in @liveblocks/client 0.18. Please use `initialPresence` instead. For more info, see https://bit.ly/3Niy5aP", "defaultPresence"),
836
+ LiveObject.deprecateIf(options.defaultStorageRoot, "Argument `defaultStorageRoot` will be removed in @liveblocks/client 0.18. Please use `initialStorage` instead. For more info, see https://bit.ly/3Niy5aP", "defaultStorageRoot"),
824
837
  internalRoom = createRoom({
825
838
  initialPresence: options.initialPresence,
826
839
  initialStorage: options.initialStorage,
package/index.mjs CHANGED
@@ -1,9 +1,13 @@
1
- import { i as isLiveNode, r as remove, S as ServerMsgCode, m as mergeStorageUpdates, W as WebsocketCloseCodes, C as ClientMsgCode, n as nn, a as isTokenValid, b as isSameNodeOrChildOf, L as LiveObject, g as getTreesDiffOperations, O as OpSource, c as OpCode, d as isLiveList, t as tryParseJson, e as isJsonArray, f as compact, h as b64decode, j as isJsonObject, k as isRootCrdt, l as errorIf } from "./shared.mjs";
1
+ import { A as AbstractCrdt, r as remove, S as ServerMsgCode, m as mergeStorageUpdates, W as WebsocketCloseCodes, C as ClientMsgCode, i as isTokenValid, a as isSameNodeOrChildOf, L as LiveObject, g as getTreesDiffOperations, O as OpCode, b as LiveList, t as tryParseJson, c as isJsonArray, d as compact, e as b64decode, f as isJsonObject, h as isRootCrdt, j as deprecateIf } from "./shared.mjs";
2
2
 
3
- export { o as LiveList, p as LiveMap, L as LiveObject } from "./shared.mjs";
3
+ export { b as LiveList, k as LiveMap, L as LiveObject } from "./shared.mjs";
4
4
 
5
5
  const BACKOFF_RETRY_DELAYS = [ 250, 500, 1e3, 2e3, 4e3, 8e3, 1e4 ], BACKOFF_RETRY_DELAYS_SLOW = [ 2e3, 3e4, 6e4, 3e5 ];
6
6
 
7
+ function isValidRoomEventType(value) {
8
+ return "my-presence" === value || "others" === value || "event" === value || "error" === value || "connection" === value;
9
+ }
10
+
7
11
  function makeOthers(userMap) {
8
12
  const users = Object.values(userMap).map((user => function(s, e) {
9
13
  var t = {};
@@ -84,8 +88,8 @@ function makeStateMachine(state, context, mockedEffects) {
84
88
  }(message.items);
85
89
  for (const key in state.defaultStorageRoot) null == state.root.get(key) && state.root.set(key, state.defaultStorageRoot[key]);
86
90
  }
87
- function addItem(id, liveItem) {
88
- state.items.set(id, liveItem);
91
+ function addItem(id, item) {
92
+ state.items.set(id, item);
89
93
  }
90
94
  function deleteItem(id) {
91
95
  state.items.delete(id);
@@ -124,6 +128,7 @@ function makeStateMachine(state, context, mockedEffects) {
124
128
  return `${getConnectionId()}:${state.opClock++}`;
125
129
  }
126
130
  function apply(item, isLocal) {
131
+ var _a;
127
132
  const result = {
128
133
  reverse: [],
129
134
  updates: {
@@ -140,21 +145,18 @@ function makeStateMachine(state, context, mockedEffects) {
140
145
  if (state.me = Object.assign(Object.assign({}, state.me), op.data), null == state.buffer.presence) state.buffer.presence = op.data; else for (const key in op.data) state.buffer.presence[key] = op.data[key];
141
146
  result.reverse.unshift(reverse), result.updates.presence = !0;
142
147
  } else {
143
- let source;
144
- if (op.opId || (op.opId = generateOpId()), isLocal) source = OpSource.UNDOREDO_RECONNECT; else {
145
- source = state.offlineOperations.delete(nn(op.opId)) ? OpSource.ACK : OpSource.REMOTE;
146
- }
147
- const applyOpResult = applyOp(op, source);
148
+ isLocal && !op.opId && (op.opId = generateOpId());
149
+ const applyOpResult = applyOp(op, isLocal);
148
150
  if (applyOpResult.modified) {
149
- const parentId = "HasParent" === applyOpResult.modified.node.parent.type ? nn(applyOpResult.modified.node.parent.node._id, "Expected parent node to have an ID") : void 0;
150
- parentId && createdNodeIds.has(parentId) || (result.updates.storageUpdates.set(nn(applyOpResult.modified.node._id), mergeStorageUpdates(result.updates.storageUpdates.get(nn(applyOpResult.modified.node._id)), applyOpResult.modified)),
151
- result.reverse.unshift(...applyOpResult.reverse)), op.type !== OpCode.CREATE_LIST && op.type !== OpCode.CREATE_MAP && op.type !== OpCode.CREATE_OBJECT || createdNodeIds.add(nn(applyOpResult.modified.node._id));
151
+ const parentId = null === (_a = applyOpResult.modified.node._parent) || void 0 === _a ? void 0 : _a._id;
152
+ createdNodeIds.has(parentId) || (result.updates.storageUpdates.set(applyOpResult.modified.node._id, mergeStorageUpdates(result.updates.storageUpdates.get(applyOpResult.modified.node._id), applyOpResult.modified)),
153
+ result.reverse.unshift(...applyOpResult.reverse)), op.type !== OpCode.CREATE_LIST && op.type !== OpCode.CREATE_MAP && op.type !== OpCode.CREATE_OBJECT || createdNodeIds.add(applyOpResult.modified.node._id);
152
154
  }
153
155
  }
154
156
  return result;
155
157
  }
156
- function applyOp(op, source) {
157
- switch (op.type) {
158
+ function applyOp(op, isLocal) {
159
+ switch (op.opId && state.offlineOperations.delete(op.opId), op.type) {
158
160
  case OpCode.DELETE_OBJECT_KEY:
159
161
  case OpCode.UPDATE_OBJECT:
160
162
  case OpCode.DELETE_CRDT:
@@ -162,15 +164,22 @@ function makeStateMachine(state, context, mockedEffects) {
162
164
  const item = state.items.get(op.id);
163
165
  return null == item ? {
164
166
  modified: !1
165
- } : item._apply(op, source === OpSource.UNDOREDO_RECONNECT);
167
+ } : item._apply(op, isLocal);
166
168
  }
167
169
 
168
170
  case OpCode.SET_PARENT_KEY:
169
171
  {
170
172
  const item = state.items.get(op.id);
171
- return null == item ? {
173
+ if (null == item) return {
172
174
  modified: !1
173
- } : "HasParent" === item.parent.type && isLiveList(item.parent.node) ? item.parent.node._setChildKey(op.parentKey, item, source) : {
175
+ };
176
+ if (item._parent instanceof LiveList) {
177
+ const previousKey = item._parentKey;
178
+ return previousKey === op.parentKey ? {
179
+ modified: !1
180
+ } : item._parent._setChildKey(op.parentKey, item, previousKey);
181
+ }
182
+ return {
174
183
  modified: !1
175
184
  };
176
185
  }
@@ -180,13 +189,10 @@ function makeStateMachine(state, context, mockedEffects) {
180
189
  case OpCode.CREATE_MAP:
181
190
  case OpCode.CREATE_REGISTER:
182
191
  {
183
- if (void 0 === op.parentId) return {
184
- modified: !1
185
- };
186
192
  const parent = state.items.get(op.parentId);
187
193
  return null == parent ? {
188
194
  modified: !1
189
- } : parent._attachChild(op, source);
195
+ } : parent._attachChild(op, isLocal);
190
196
  }
191
197
  }
192
198
  }
@@ -418,7 +424,7 @@ function makeStateMachine(state, context, mockedEffects) {
418
424
  function tryFlushing() {
419
425
  const storageOps = state.buffer.storageOperations;
420
426
  if (storageOps.length > 0 && storageOps.forEach((op => {
421
- state.offlineOperations.set(nn(op.opId), op);
427
+ state.offlineOperations.set(op.opId, op);
422
428
  })), null == state.socket || state.socket.readyState !== state.socket.OPEN) return void (state.buffer.storageOperations = []);
423
429
  const now = Date.now();
424
430
  if (now - state.lastFlushTime > context.throttleDelay) {
@@ -460,10 +466,10 @@ function makeStateMachine(state, context, mockedEffects) {
460
466
  "unavailable" === state.connection.state && reconnect();
461
467
  },
462
468
  simulateSocketClose: function() {
463
- state.socket && (state.socket = null);
469
+ state.socket && state.socket.close();
464
470
  },
465
471
  simulateSendCloseEvent: function(event) {
466
- onClose(event);
472
+ state.socket && onClose(event);
467
473
  },
468
474
  onVisibilityChange: function(visibilityState) {
469
475
  "visible" === visibilityState && "open" === state.connection.state && heartbeat();
@@ -487,21 +493,26 @@ function makeStateMachine(state, context, mockedEffects) {
487
493
  }();
488
494
  },
489
495
  subscribe: function(firstParam, listener, options) {
490
- if (isLiveNode(firstParam)) return function(liveValue, innerCallback, options) {
496
+ if (firstParam instanceof AbstractCrdt) return function(crdt, innerCallback, options) {
491
497
  return genericSubscribe((updates => {
492
498
  const relatedUpdates = [];
493
- for (const update of updates) (null == options ? void 0 : options.isDeep) && isSameNodeOrChildOf(update.node, liveValue) ? relatedUpdates.push(update) : update.node._id === liveValue._id && innerCallback(update.node);
499
+ for (const update of updates) (null == options ? void 0 : options.isDeep) && isSameNodeOrChildOf(update.node, crdt) ? relatedUpdates.push(update) : update.node._id === crdt._id && innerCallback(update.node);
494
500
  (null == options ? void 0 : options.isDeep) && relatedUpdates.length > 0 && innerCallback(relatedUpdates);
495
501
  }));
496
502
  }(firstParam, listener, options);
497
503
  if ("function" == typeof firstParam) return genericSubscribe(firstParam);
498
- if ("my-presence" !== (value = firstParam) && "others" !== value && "event" !== value && "error" !== value && "connection" !== value) throw new Error(`"${firstParam}" is not a valid event name`);
499
- var value;
504
+ if (!isValidRoomEventType(firstParam)) throw new Error(`"${firstParam}" is not a valid event name`);
500
505
  return state.listeners[firstParam].push(listener), () => {
501
506
  const callbacks = state.listeners[firstParam];
502
507
  remove(callbacks, listener);
503
508
  };
504
509
  },
510
+ unsubscribe: function(event, callback) {
511
+ if (console.warn("unsubscribe is depreacted and will be removed in a future version.\nuse the callback returned by subscribe instead.\nSee v0.13 release notes for more information.\n"),
512
+ !isValidRoomEventType(event)) throw new Error(`"${event}" is not a valid event name`);
513
+ const callbacks = state.listeners[event];
514
+ remove(callbacks, callback);
515
+ },
505
516
  updatePresence: function(overrides, options) {
506
517
  const oldValues = {};
507
518
  null == state.buffer.presence && (state.buffer.presence = {});
@@ -577,7 +588,7 @@ function makeStateMachine(state, context, mockedEffects) {
577
588
  type: ClientMsgCode.FETCH_STORAGE
578
589
  }), tryFlushing(), _getInitialStatePromise = new Promise((resolve => _getInitialStateResolver = resolve))),
579
590
  _getInitialStatePromise.then((() => ({
580
- root: nn(state.root)
591
+ root: state.root
581
592
  }))));
582
593
  },
583
594
  selectors: {
@@ -663,6 +674,7 @@ function createRoom(options, context) {
663
674
  getConnectionState: machine.selectors.getConnectionState,
664
675
  getSelf: machine.selectors.getSelf,
665
676
  subscribe: machine.subscribe,
677
+ unsubscribe: machine.unsubscribe,
666
678
  getPresence: machine.selectors.getPresence,
667
679
  updatePresence: machine.updatePresence,
668
680
  getOthers: machine.selectors.getOthers,
@@ -675,9 +687,9 @@ function createRoom(options, context) {
675
687
  pause: machine.pauseHistory,
676
688
  resume: machine.resumeHistory
677
689
  },
678
- __INTERNAL_DO_NOT_USE: {
679
- simulateCloseWebsocket: machine.simulateSocketClose,
680
- simulateSendCloseEvent: machine.simulateSendCloseEvent
690
+ internalDevTools: {
691
+ closeWebsocket: machine.simulateSocketClose,
692
+ sendCloseEvent: machine.simulateSendCloseEvent
681
693
  }
682
694
  };
683
695
  return {
@@ -748,8 +760,8 @@ function createClient(options) {
748
760
  },
749
761
  enter: function(roomId, options = {}) {
750
762
  let internalRoom = rooms.get(roomId);
751
- return internalRoom || (errorIf(options.defaultPresence, "Argument `defaultPresence` will be removed in @liveblocks/client 0.18. Please use `initialPresence` instead. For more info, see https://bit.ly/3Niy5aP"),
752
- errorIf(options.defaultStorageRoot, "Argument `defaultStorageRoot` will be removed in @liveblocks/client 0.18. Please use `initialStorage` instead. For more info, see https://bit.ly/3Niy5aP"),
763
+ return internalRoom || (deprecateIf(options.defaultPresence, "Argument `defaultPresence` will be removed in @liveblocks/client 0.18. Please use `initialPresence` instead. For more info, see https://bit.ly/3Niy5aP", "defaultPresence"),
764
+ deprecateIf(options.defaultStorageRoot, "Argument `defaultStorageRoot` will be removed in @liveblocks/client 0.18. Please use `initialStorage` instead. For more info, see https://bit.ly/3Niy5aP", "defaultStorageRoot"),
753
765
  internalRoom = createRoom({
754
766
  initialPresence: options.initialPresence,
755
767
  initialStorage: options.initialStorage,