@liveblocks/client 0.15.8 → 0.15.11-test.1

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/lib/esm/index.js CHANGED
@@ -87,7 +87,7 @@ class AbstractCrdt {
87
87
  get _parentKey() {
88
88
  return __privateGet$4(this, _parentKey);
89
89
  }
90
- _apply(op, isLocal) {
90
+ _apply(op, _isLocal) {
91
91
  switch (op.type) {
92
92
  case OpType.DeleteCrdt: {
93
93
  if (this._parent != null && this._parentKey != null) {
@@ -287,10 +287,10 @@ const _LiveRegister = class extends AbstractCrdt {
287
287
  data: this.data
288
288
  };
289
289
  }
290
- _attachChild(id, key, crdt, opId, isLocal) {
290
+ _attachChild(_id, _key, _crdt, _opId, _isLocal) {
291
291
  throw new Error("Method not implemented.");
292
292
  }
293
- _detachChild(crdt) {
293
+ _detachChild(_crdt) {
294
294
  throw new Error("Method not implemented.");
295
295
  }
296
296
  _apply(op, isLocal) {
@@ -331,7 +331,7 @@ const _LiveList = class extends AbstractCrdt {
331
331
  position = newPosition;
332
332
  }
333
333
  }
334
- static _deserialize([id, item], parentToChildren, doc) {
334
+ static _deserialize([id], parentToChildren, doc) {
335
335
  const list = new _LiveList([]);
336
336
  list._attach(id, doc);
337
337
  const children = parentToChildren.get(id);
@@ -372,7 +372,7 @@ const _LiveList = class extends AbstractCrdt {
372
372
  }
373
373
  _attach(id, doc) {
374
374
  super._attach(id, doc);
375
- for (const [item, position] of __privateGet$2(this, _items)) {
375
+ for (const [item] of __privateGet$2(this, _items)) {
376
376
  item._attach(doc.generateId(), doc);
377
377
  }
378
378
  }
@@ -382,7 +382,7 @@ const _LiveList = class extends AbstractCrdt {
382
382
  value._detach();
383
383
  }
384
384
  }
385
- _attachChild(id, key, child, opId, isLocal) {
385
+ _attachChild(id, key, child, _opId, isLocal) {
386
386
  var _a;
387
387
  if (this._doc == null) {
388
388
  throw new Error("Can't attach child if doc is not present");
@@ -396,8 +396,8 @@ const _LiveList = class extends AbstractCrdt {
396
396
  let newKey = key;
397
397
  if (index !== -1) {
398
398
  if (isLocal) {
399
- let before = __privateGet$2(this, _items)[index] ? __privateGet$2(this, _items)[index][1] : void 0;
400
- let after = __privateGet$2(this, _items)[index + 1] ? __privateGet$2(this, _items)[index + 1][1] : void 0;
399
+ const before = __privateGet$2(this, _items)[index] ? __privateGet$2(this, _items)[index][1] : void 0;
400
+ const after = __privateGet$2(this, _items)[index + 1] ? __privateGet$2(this, _items)[index + 1][1] : void 0;
401
401
  newKey = makePosition(before, after);
402
402
  child._setParentLink(this, newKey);
403
403
  } else {
@@ -495,8 +495,8 @@ const _LiveList = class extends AbstractCrdt {
495
495
  if (index < 0 || index > __privateGet$2(this, _items).length) {
496
496
  throw new Error(`Cannot insert list item at index "${index}". index should be between 0 and ${__privateGet$2(this, _items).length}`);
497
497
  }
498
- let before = __privateGet$2(this, _items)[index - 1] ? __privateGet$2(this, _items)[index - 1][1] : void 0;
499
- let after = __privateGet$2(this, _items)[index] ? __privateGet$2(this, _items)[index][1] : void 0;
498
+ const before = __privateGet$2(this, _items)[index - 1] ? __privateGet$2(this, _items)[index - 1][1] : void 0;
499
+ const after = __privateGet$2(this, _items)[index] ? __privateGet$2(this, _items)[index][1] : void 0;
500
500
  const position = makePosition(before, after);
501
501
  const value = selfOrRegister(element);
502
502
  value._setParentLink(this, position);
@@ -608,9 +608,9 @@ const _LiveList = class extends AbstractCrdt {
608
608
  }
609
609
  clear() {
610
610
  if (this._doc) {
611
- let ops = [];
612
- let reverseOps = [];
613
- let updateDelta = [];
611
+ const ops = [];
612
+ const reverseOps = [];
613
+ const updateDelta = [];
614
614
  let i = 0;
615
615
  for (const item of __privateGet$2(this, _items)) {
616
616
  item[0]._detach();
@@ -781,13 +781,13 @@ const _LiveMap = class extends AbstractCrdt {
781
781
  }
782
782
  _attach(id, doc) {
783
783
  super._attach(id, doc);
784
- for (const [key, value] of __privateGet$1(this, _map$1)) {
784
+ for (const [_key, value] of __privateGet$1(this, _map$1)) {
785
785
  if (isCrdt(value)) {
786
786
  value._attach(doc.generateId(), doc);
787
787
  }
788
788
  }
789
789
  }
790
- _attachChild(id, key, child, opId, isLocal) {
790
+ _attachChild(id, key, child, _opId, _isLocal) {
791
791
  if (this._doc == null) {
792
792
  throw new Error("Can't attach child if doc is not present");
793
793
  }
@@ -1134,7 +1134,7 @@ function isPlain(value) {
1134
1134
  function isPlainObject$1(value) {
1135
1135
  if (typeof value !== "object" || value === null)
1136
1136
  return false;
1137
- let proto = Object.getPrototypeOf(value);
1137
+ const proto = Object.getPrototypeOf(value);
1138
1138
  if (proto === null)
1139
1139
  return true;
1140
1140
  let baseProto = proto;
@@ -1258,7 +1258,7 @@ const _LiveObject = class extends AbstractCrdt {
1258
1258
  }
1259
1259
  _attach(id, doc) {
1260
1260
  super._attach(id, doc);
1261
- for (const [key, value] of __privateGet(this, _map)) {
1261
+ for (const [_key, value] of __privateGet(this, _map)) {
1262
1262
  if (value instanceof AbstractCrdt) {
1263
1263
  value._attach(doc.generateId(), doc);
1264
1264
  }
@@ -1510,7 +1510,7 @@ applyUpdate_fn = function(op, isLocal) {
1510
1510
  reverse.push({ type: OpType.DeleteObjectKey, id: this._id, key });
1511
1511
  }
1512
1512
  }
1513
- let updateDelta = {};
1513
+ const updateDelta = {};
1514
1514
  for (const key in op.data) {
1515
1515
  if (isLocal) {
1516
1516
  __privateGet(this, _propToLastUpdate).set(key, op.opId);
@@ -1618,23 +1618,23 @@ function makeIdFactory(connectionId) {
1618
1618
  let count = 0;
1619
1619
  return () => `${connectionId}:${count++}`;
1620
1620
  }
1621
- function makeOthers(presenceMap) {
1622
- const array = Object.values(presenceMap).map((presence) => {
1623
- const _a = presence, publicKeys = __objRest(_a, ["_hasReceivedInitialPresence"]);
1621
+ function makeOthers(userMap) {
1622
+ const users = Object.values(userMap).map((user) => {
1623
+ const _a = user, publicKeys = __objRest(_a, ["_hasReceivedInitialPresence"]);
1624
1624
  return publicKeys;
1625
1625
  });
1626
1626
  return {
1627
1627
  get count() {
1628
- return array.length;
1628
+ return users.length;
1629
1629
  },
1630
1630
  [Symbol.iterator]() {
1631
- return array[Symbol.iterator]();
1631
+ return users[Symbol.iterator]();
1632
1632
  },
1633
1633
  map(callback) {
1634
- return array.map(callback);
1634
+ return users.map(callback);
1635
1635
  },
1636
1636
  toArray() {
1637
- return array;
1637
+ return users;
1638
1638
  }
1639
1639
  };
1640
1640
  }
@@ -1785,12 +1785,12 @@ function makeStateMachine(state, context, mockedEffects) {
1785
1785
  function notify({
1786
1786
  storageUpdates = /* @__PURE__ */ new Map(),
1787
1787
  presence = false,
1788
- others = []
1788
+ others: otherEvents = []
1789
1789
  }) {
1790
- if (others.length > 0) {
1790
+ if (otherEvents.length > 0) {
1791
1791
  state.others = makeOthers(state.users);
1792
- for (const event of others) {
1793
- for (const listener of state.listeners["others"]) {
1792
+ for (const event of otherEvents) {
1793
+ for (const listener of state.listeners.others) {
1794
1794
  listener(state.others, event);
1795
1795
  }
1796
1796
  }
@@ -2696,7 +2696,7 @@ function createClient(options) {
2696
2696
  return internalRoom.room;
2697
2697
  }
2698
2698
  function leave(roomId) {
2699
- let room = rooms.get(roomId);
2699
+ const room = rooms.get(roomId);
2700
2700
  if (room) {
2701
2701
  room.disconnect();
2702
2702
  rooms.delete(roomId);
@@ -2950,7 +2950,7 @@ function patchImmutableNode(state, path, update) {
2950
2950
  if (typeof state !== "object") {
2951
2951
  throw new Error("Internal: received update on LiveObject but state was not an object");
2952
2952
  }
2953
- let newState = Object.assign({}, state);
2953
+ const newState = Object.assign({}, state);
2954
2954
  for (const key in update.updates) {
2955
2955
  if (((_a = update.updates[key]) == null ? void 0 : _a.type) === "update") {
2956
2956
  newState[key] = liveNodeToJson(update.node.get(key));
@@ -3002,7 +3002,7 @@ function patchImmutableNode(state, path, update) {
3002
3002
  if (typeof state !== "object") {
3003
3003
  throw new Error("Internal: received update on LiveMap but state was not an object");
3004
3004
  }
3005
- let newState = Object.assign({}, state);
3005
+ const newState = Object.assign({}, state);
3006
3006
  for (const key in update.updates) {
3007
3007
  if (((_c = update.updates[key]) == null ? void 0 : _c.type) === "update") {
3008
3008
  newState[key] = liveNodeToJson(update.node.get(key));
package/lib/esm/index.mjs CHANGED
@@ -87,7 +87,7 @@ class AbstractCrdt {
87
87
  get _parentKey() {
88
88
  return __privateGet$4(this, _parentKey);
89
89
  }
90
- _apply(op, isLocal) {
90
+ _apply(op, _isLocal) {
91
91
  switch (op.type) {
92
92
  case OpType.DeleteCrdt: {
93
93
  if (this._parent != null && this._parentKey != null) {
@@ -287,10 +287,10 @@ const _LiveRegister = class extends AbstractCrdt {
287
287
  data: this.data
288
288
  };
289
289
  }
290
- _attachChild(id, key, crdt, opId, isLocal) {
290
+ _attachChild(_id, _key, _crdt, _opId, _isLocal) {
291
291
  throw new Error("Method not implemented.");
292
292
  }
293
- _detachChild(crdt) {
293
+ _detachChild(_crdt) {
294
294
  throw new Error("Method not implemented.");
295
295
  }
296
296
  _apply(op, isLocal) {
@@ -331,7 +331,7 @@ const _LiveList = class extends AbstractCrdt {
331
331
  position = newPosition;
332
332
  }
333
333
  }
334
- static _deserialize([id, item], parentToChildren, doc) {
334
+ static _deserialize([id], parentToChildren, doc) {
335
335
  const list = new _LiveList([]);
336
336
  list._attach(id, doc);
337
337
  const children = parentToChildren.get(id);
@@ -372,7 +372,7 @@ const _LiveList = class extends AbstractCrdt {
372
372
  }
373
373
  _attach(id, doc) {
374
374
  super._attach(id, doc);
375
- for (const [item, position] of __privateGet$2(this, _items)) {
375
+ for (const [item] of __privateGet$2(this, _items)) {
376
376
  item._attach(doc.generateId(), doc);
377
377
  }
378
378
  }
@@ -382,7 +382,7 @@ const _LiveList = class extends AbstractCrdt {
382
382
  value._detach();
383
383
  }
384
384
  }
385
- _attachChild(id, key, child, opId, isLocal) {
385
+ _attachChild(id, key, child, _opId, isLocal) {
386
386
  var _a;
387
387
  if (this._doc == null) {
388
388
  throw new Error("Can't attach child if doc is not present");
@@ -396,8 +396,8 @@ const _LiveList = class extends AbstractCrdt {
396
396
  let newKey = key;
397
397
  if (index !== -1) {
398
398
  if (isLocal) {
399
- let before = __privateGet$2(this, _items)[index] ? __privateGet$2(this, _items)[index][1] : void 0;
400
- let after = __privateGet$2(this, _items)[index + 1] ? __privateGet$2(this, _items)[index + 1][1] : void 0;
399
+ const before = __privateGet$2(this, _items)[index] ? __privateGet$2(this, _items)[index][1] : void 0;
400
+ const after = __privateGet$2(this, _items)[index + 1] ? __privateGet$2(this, _items)[index + 1][1] : void 0;
401
401
  newKey = makePosition(before, after);
402
402
  child._setParentLink(this, newKey);
403
403
  } else {
@@ -495,8 +495,8 @@ const _LiveList = class extends AbstractCrdt {
495
495
  if (index < 0 || index > __privateGet$2(this, _items).length) {
496
496
  throw new Error(`Cannot insert list item at index "${index}". index should be between 0 and ${__privateGet$2(this, _items).length}`);
497
497
  }
498
- let before = __privateGet$2(this, _items)[index - 1] ? __privateGet$2(this, _items)[index - 1][1] : void 0;
499
- let after = __privateGet$2(this, _items)[index] ? __privateGet$2(this, _items)[index][1] : void 0;
498
+ const before = __privateGet$2(this, _items)[index - 1] ? __privateGet$2(this, _items)[index - 1][1] : void 0;
499
+ const after = __privateGet$2(this, _items)[index] ? __privateGet$2(this, _items)[index][1] : void 0;
500
500
  const position = makePosition(before, after);
501
501
  const value = selfOrRegister(element);
502
502
  value._setParentLink(this, position);
@@ -608,9 +608,9 @@ const _LiveList = class extends AbstractCrdt {
608
608
  }
609
609
  clear() {
610
610
  if (this._doc) {
611
- let ops = [];
612
- let reverseOps = [];
613
- let updateDelta = [];
611
+ const ops = [];
612
+ const reverseOps = [];
613
+ const updateDelta = [];
614
614
  let i = 0;
615
615
  for (const item of __privateGet$2(this, _items)) {
616
616
  item[0]._detach();
@@ -781,13 +781,13 @@ const _LiveMap = class extends AbstractCrdt {
781
781
  }
782
782
  _attach(id, doc) {
783
783
  super._attach(id, doc);
784
- for (const [key, value] of __privateGet$1(this, _map$1)) {
784
+ for (const [_key, value] of __privateGet$1(this, _map$1)) {
785
785
  if (isCrdt(value)) {
786
786
  value._attach(doc.generateId(), doc);
787
787
  }
788
788
  }
789
789
  }
790
- _attachChild(id, key, child, opId, isLocal) {
790
+ _attachChild(id, key, child, _opId, _isLocal) {
791
791
  if (this._doc == null) {
792
792
  throw new Error("Can't attach child if doc is not present");
793
793
  }
@@ -1134,7 +1134,7 @@ function isPlain(value) {
1134
1134
  function isPlainObject$1(value) {
1135
1135
  if (typeof value !== "object" || value === null)
1136
1136
  return false;
1137
- let proto = Object.getPrototypeOf(value);
1137
+ const proto = Object.getPrototypeOf(value);
1138
1138
  if (proto === null)
1139
1139
  return true;
1140
1140
  let baseProto = proto;
@@ -1258,7 +1258,7 @@ const _LiveObject = class extends AbstractCrdt {
1258
1258
  }
1259
1259
  _attach(id, doc) {
1260
1260
  super._attach(id, doc);
1261
- for (const [key, value] of __privateGet(this, _map)) {
1261
+ for (const [_key, value] of __privateGet(this, _map)) {
1262
1262
  if (value instanceof AbstractCrdt) {
1263
1263
  value._attach(doc.generateId(), doc);
1264
1264
  }
@@ -1510,7 +1510,7 @@ applyUpdate_fn = function(op, isLocal) {
1510
1510
  reverse.push({ type: OpType.DeleteObjectKey, id: this._id, key });
1511
1511
  }
1512
1512
  }
1513
- let updateDelta = {};
1513
+ const updateDelta = {};
1514
1514
  for (const key in op.data) {
1515
1515
  if (isLocal) {
1516
1516
  __privateGet(this, _propToLastUpdate).set(key, op.opId);
@@ -1618,23 +1618,23 @@ function makeIdFactory(connectionId) {
1618
1618
  let count = 0;
1619
1619
  return () => `${connectionId}:${count++}`;
1620
1620
  }
1621
- function makeOthers(presenceMap) {
1622
- const array = Object.values(presenceMap).map((presence) => {
1623
- const _a = presence, publicKeys = __objRest(_a, ["_hasReceivedInitialPresence"]);
1621
+ function makeOthers(userMap) {
1622
+ const users = Object.values(userMap).map((user) => {
1623
+ const _a = user, publicKeys = __objRest(_a, ["_hasReceivedInitialPresence"]);
1624
1624
  return publicKeys;
1625
1625
  });
1626
1626
  return {
1627
1627
  get count() {
1628
- return array.length;
1628
+ return users.length;
1629
1629
  },
1630
1630
  [Symbol.iterator]() {
1631
- return array[Symbol.iterator]();
1631
+ return users[Symbol.iterator]();
1632
1632
  },
1633
1633
  map(callback) {
1634
- return array.map(callback);
1634
+ return users.map(callback);
1635
1635
  },
1636
1636
  toArray() {
1637
- return array;
1637
+ return users;
1638
1638
  }
1639
1639
  };
1640
1640
  }
@@ -1785,12 +1785,12 @@ function makeStateMachine(state, context, mockedEffects) {
1785
1785
  function notify({
1786
1786
  storageUpdates = /* @__PURE__ */ new Map(),
1787
1787
  presence = false,
1788
- others = []
1788
+ others: otherEvents = []
1789
1789
  }) {
1790
- if (others.length > 0) {
1790
+ if (otherEvents.length > 0) {
1791
1791
  state.others = makeOthers(state.users);
1792
- for (const event of others) {
1793
- for (const listener of state.listeners["others"]) {
1792
+ for (const event of otherEvents) {
1793
+ for (const listener of state.listeners.others) {
1794
1794
  listener(state.others, event);
1795
1795
  }
1796
1796
  }
@@ -2696,7 +2696,7 @@ function createClient(options) {
2696
2696
  return internalRoom.room;
2697
2697
  }
2698
2698
  function leave(roomId) {
2699
- let room = rooms.get(roomId);
2699
+ const room = rooms.get(roomId);
2700
2700
  if (room) {
2701
2701
  room.disconnect();
2702
2702
  rooms.delete(roomId);
@@ -2950,7 +2950,7 @@ function patchImmutableNode(state, path, update) {
2950
2950
  if (typeof state !== "object") {
2951
2951
  throw new Error("Internal: received update on LiveObject but state was not an object");
2952
2952
  }
2953
- let newState = Object.assign({}, state);
2953
+ const newState = Object.assign({}, state);
2954
2954
  for (const key in update.updates) {
2955
2955
  if (((_a = update.updates[key]) == null ? void 0 : _a.type) === "update") {
2956
2956
  newState[key] = liveNodeToJson(update.node.get(key));
@@ -3002,7 +3002,7 @@ function patchImmutableNode(state, path, update) {
3002
3002
  if (typeof state !== "object") {
3003
3003
  throw new Error("Internal: received update on LiveMap but state was not an object");
3004
3004
  }
3005
- let newState = Object.assign({}, state);
3005
+ const newState = Object.assign({}, state);
3006
3006
  for (const key in update.updates) {
3007
3007
  if (((_c = update.updates[key]) == null ? void 0 : _c.type) === "update") {
3008
3008
  newState[key] = liveNodeToJson(update.node.get(key));
package/lib/index.d.ts CHANGED
@@ -275,9 +275,7 @@ declare type User<TPresence extends Presence = Presence> = {
275
275
  */
276
276
  readonly presence?: TPresence;
277
277
  };
278
- declare type Presence = {
279
- [key: string]: any;
280
- };
278
+ declare type Presence = Record<string, unknown>;
281
279
  declare type AuthEndpointCallback = (room: string) => Promise<{
282
280
  token: string;
283
281
  }>;
package/lib/index.js CHANGED
@@ -324,7 +324,7 @@ var AbstractCrdt = function () {
324
324
 
325
325
  var _proto = AbstractCrdt.prototype;
326
326
 
327
- _proto._apply = function _apply(op, isLocal) {
327
+ _proto._apply = function _apply(op, _isLocal) {
328
328
  switch (op.type) {
329
329
  case OpType.DeleteCrdt:
330
330
  {
@@ -595,11 +595,11 @@ var LiveRegister = function (_AbstractCrdt) {
595
595
  };
596
596
  };
597
597
 
598
- _proto._attachChild = function _attachChild(id, key, crdt, opId, isLocal) {
598
+ _proto._attachChild = function _attachChild(_id, _key, _crdt, _opId, _isLocal) {
599
599
  throw new Error("Method not implemented.");
600
600
  };
601
601
 
602
- _proto._detachChild = function _detachChild(crdt) {
602
+ _proto._detachChild = function _detachChild(_crdt) {
603
603
  throw new Error("Method not implemented.");
604
604
  };
605
605
 
@@ -656,7 +656,6 @@ var LiveList = function (_AbstractCrdt) {
656
656
 
657
657
  LiveList._deserialize = function _deserialize(_ref, parentToChildren, doc) {
658
658
  var id = _ref[0];
659
- _ref[1];
660
659
  var list = new LiveList([]);
661
660
 
662
661
  list._attach(id, doc);
@@ -726,7 +725,6 @@ var LiveList = function (_AbstractCrdt) {
726
725
  for (var _iterator3 = _createForOfIteratorHelperLoose(_classPrivateFieldGet(this, _items)), _step3; !(_step3 = _iterator3()).done;) {
727
726
  var _step3$value = _step3.value,
728
727
  _item2 = _step3$value[0];
729
- _step3$value[1];
730
728
 
731
729
  _item2._attach(doc.generateId(), doc);
732
730
  }
@@ -743,7 +741,7 @@ var LiveList = function (_AbstractCrdt) {
743
741
  }
744
742
  };
745
743
 
746
- _proto._attachChild = function _attachChild(id, key, child, opId, isLocal) {
744
+ _proto._attachChild = function _attachChild(id, key, child, _opId, isLocal) {
747
745
  if (this._doc == null) {
748
746
  throw new Error("Can't attach child if doc is not present");
749
747
  }
@@ -1273,9 +1271,9 @@ var LiveMap = function (_AbstractCrdt) {
1273
1271
 
1274
1272
  for (var _iterator2 = _createForOfIteratorHelperLoose(_classPrivateFieldGet(this, _map$1)), _step2; !(_step2 = _iterator2()).done;) {
1275
1273
  var _step2$value = _step2.value,
1276
- _key = _step2$value[0],
1274
+ _key2 = _step2$value[0],
1277
1275
  _value2 = _step2$value[1];
1278
- ops.push.apply(ops, _value2._serialize(this._id, _key, doc));
1276
+ ops.push.apply(ops, _value2._serialize(this._id, _key2, doc));
1279
1277
  }
1280
1278
 
1281
1279
  return ops;
@@ -1331,7 +1329,7 @@ var LiveMap = function (_AbstractCrdt) {
1331
1329
  }
1332
1330
  };
1333
1331
 
1334
- _proto._attachChild = function _attachChild(id, key, child, opId, isLocal) {
1332
+ _proto._attachChild = function _attachChild(id, key, child, _opId, _isLocal) {
1335
1333
  var _updates;
1336
1334
 
1337
1335
  if (this._doc == null) {
@@ -2217,50 +2215,50 @@ var LiveObject = function (_AbstractCrdt) {
2217
2215
  };
2218
2216
  var updateDelta = {};
2219
2217
 
2220
- for (var _key in overrides) {
2221
- var _oldValue = _classPrivateFieldGet(this, _map).get(_key);
2218
+ for (var _key2 in overrides) {
2219
+ var _oldValue = _classPrivateFieldGet(this, _map).get(_key2);
2222
2220
 
2223
2221
  if (_oldValue instanceof AbstractCrdt) {
2224
- reverseOps.push.apply(reverseOps, _oldValue._serialize(this._id, _key));
2222
+ reverseOps.push.apply(reverseOps, _oldValue._serialize(this._id, _key2));
2225
2223
 
2226
2224
  _oldValue._detach();
2227
2225
  } else if (_oldValue === undefined) {
2228
2226
  reverseOps.push({
2229
2227
  type: OpType.DeleteObjectKey,
2230
2228
  id: this._id,
2231
- key: _key
2229
+ key: _key2
2232
2230
  });
2233
2231
  } else {
2234
- reverseUpdateOp.data[_key] = _oldValue;
2232
+ reverseUpdateOp.data[_key2] = _oldValue;
2235
2233
  }
2236
2234
 
2237
- var _newValue = overrides[_key];
2235
+ var _newValue = overrides[_key2];
2238
2236
 
2239
2237
  if (_newValue instanceof AbstractCrdt) {
2240
- _newValue._setParentLink(this, _key);
2238
+ _newValue._setParentLink(this, _key2);
2241
2239
 
2242
2240
  _newValue._attach(this._doc.generateId(), this._doc);
2243
2241
 
2244
- var newAttachChildOps = _newValue._serialize(this._id, _key, this._doc);
2242
+ var newAttachChildOps = _newValue._serialize(this._id, _key2, this._doc);
2245
2243
 
2246
2244
  var createCrdtOp = newAttachChildOps.find(function (op) {
2247
2245
  return op.parentId === _this2._id;
2248
2246
  });
2249
2247
 
2250
2248
  if (createCrdtOp) {
2251
- _classPrivateFieldGet(this, _propToLastUpdate).set(_key, createCrdtOp.opId);
2249
+ _classPrivateFieldGet(this, _propToLastUpdate).set(_key2, createCrdtOp.opId);
2252
2250
  }
2253
2251
 
2254
2252
  ops.push.apply(ops, newAttachChildOps);
2255
2253
  } else {
2256
- updatedProps[_key] = _newValue;
2254
+ updatedProps[_key2] = _newValue;
2257
2255
 
2258
- _classPrivateFieldGet(this, _propToLastUpdate).set(_key, opId);
2256
+ _classPrivateFieldGet(this, _propToLastUpdate).set(_key2, opId);
2259
2257
  }
2260
2258
 
2261
- _classPrivateFieldGet(this, _map).set(_key, _newValue);
2259
+ _classPrivateFieldGet(this, _map).set(_key2, _newValue);
2262
2260
 
2263
- updateDelta[_key] = {
2261
+ updateDelta[_key2] = {
2264
2262
  type: "update"
2265
2263
  };
2266
2264
  }
@@ -2321,31 +2319,31 @@ function _applyUpdate2(op, isLocal) {
2321
2319
 
2322
2320
  var updateDelta = {};
2323
2321
 
2324
- for (var _key2 in op.data) {
2322
+ for (var _key3 in op.data) {
2325
2323
  if (isLocal) {
2326
- _classPrivateFieldGet(this, _propToLastUpdate).set(_key2, op.opId);
2327
- } else if (_classPrivateFieldGet(this, _propToLastUpdate).get(_key2) == null) {
2324
+ _classPrivateFieldGet(this, _propToLastUpdate).set(_key3, op.opId);
2325
+ } else if (_classPrivateFieldGet(this, _propToLastUpdate).get(_key3) == null) {
2328
2326
  isModified = true;
2329
- } else if (_classPrivateFieldGet(this, _propToLastUpdate).get(_key2) === op.opId) {
2330
- _classPrivateFieldGet(this, _propToLastUpdate).delete(_key2);
2327
+ } else if (_classPrivateFieldGet(this, _propToLastUpdate).get(_key3) === op.opId) {
2328
+ _classPrivateFieldGet(this, _propToLastUpdate).delete(_key3);
2331
2329
 
2332
2330
  continue;
2333
2331
  } else {
2334
2332
  continue;
2335
2333
  }
2336
2334
 
2337
- var _oldValue2 = _classPrivateFieldGet(this, _map).get(_key2);
2335
+ var _oldValue2 = _classPrivateFieldGet(this, _map).get(_key3);
2338
2336
 
2339
2337
  if (isCrdt(_oldValue2)) {
2340
2338
  _oldValue2._detach();
2341
2339
  }
2342
2340
 
2343
2341
  isModified = true;
2344
- updateDelta[_key2] = {
2342
+ updateDelta[_key3] = {
2345
2343
  type: "update"
2346
2344
  };
2347
2345
 
2348
- _classPrivateFieldGet(this, _map).set(_key2, op.data[_key2]);
2346
+ _classPrivateFieldGet(this, _map).set(_key3, op.data[_key3]);
2349
2347
  }
2350
2348
 
2351
2349
  if (Object.keys(reverseUpdate.data).length !== 0) {
@@ -2429,26 +2427,26 @@ function makeIdFactory(connectionId) {
2429
2427
  };
2430
2428
  }
2431
2429
 
2432
- function makeOthers(presenceMap) {
2430
+ function makeOthers(userMap) {
2433
2431
  var _ref;
2434
2432
 
2435
- var array = Object.values(presenceMap).map(function (presence) {
2436
- presence._hasReceivedInitialPresence;
2437
- var publicKeys = _objectWithoutPropertiesLoose(presence, ["_hasReceivedInitialPresence"]);
2433
+ var users = Object.values(userMap).map(function (user) {
2434
+ user._hasReceivedInitialPresence;
2435
+ var publicKeys = _objectWithoutPropertiesLoose(user, ["_hasReceivedInitialPresence"]);
2438
2436
 
2439
2437
  return publicKeys;
2440
2438
  });
2441
2439
  return _ref = {
2442
2440
  get count() {
2443
- return array.length;
2441
+ return users.length;
2444
2442
  }
2445
2443
 
2446
2444
  }, _ref[Symbol.iterator] = function () {
2447
- return array[Symbol.iterator]();
2445
+ return users[Symbol.iterator]();
2448
2446
  }, _ref.map = function map(callback) {
2449
- return array.map(callback);
2447
+ return users.map(callback);
2450
2448
  }, _ref.toArray = function toArray() {
2451
- return array;
2449
+ return users;
2452
2450
  }, _ref;
2453
2451
  }
2454
2452
 
@@ -2648,15 +2646,15 @@ function makeStateMachine(state, context, mockedEffects) {
2648
2646
  _ref3$presence = _ref3.presence,
2649
2647
  presence = _ref3$presence === void 0 ? false : _ref3$presence,
2650
2648
  _ref3$others = _ref3.others,
2651
- others = _ref3$others === void 0 ? [] : _ref3$others;
2649
+ otherEvents = _ref3$others === void 0 ? [] : _ref3$others;
2652
2650
 
2653
- if (others.length > 0) {
2651
+ if (otherEvents.length > 0) {
2654
2652
  state.others = makeOthers(state.users);
2655
2653
 
2656
- for (var _iterator3 = _createForOfIteratorHelperLoose(others), _step3; !(_step3 = _iterator3()).done;) {
2654
+ for (var _iterator3 = _createForOfIteratorHelperLoose(otherEvents), _step3; !(_step3 = _iterator3()).done;) {
2657
2655
  var event = _step3.value;
2658
2656
 
2659
- for (var _iterator4 = _createForOfIteratorHelperLoose(state.listeners["others"]), _step4; !(_step4 = _iterator4()).done;) {
2657
+ for (var _iterator4 = _createForOfIteratorHelperLoose(state.listeners.others), _step4; !(_step4 = _iterator4()).done;) {
2660
2658
  var _listener = _step4.value;
2661
2659
 
2662
2660
  _listener(state.others, event);
package/lib/internal.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- declare type Presence = {
2
- [key: string]: any;
3
- };
1
+ declare type Presence = Record<string, unknown>;
4
2
 
5
3
  declare type ServerMessage = UpdatePresenceMessage | UserJoinMessage | UserLeftMessage | EventMessage | RoomStateMessage | InitialDocumentStateMessage | UpdateStorageMessage;
6
4
  declare enum ServerMessageType {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liveblocks/client",
3
- "version": "0.15.8",
3
+ "version": "0.15.11-test.1",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -33,7 +33,8 @@
33
33
  },
34
34
  "scripts": {
35
35
  "build": "rollup -c",
36
- "test": "jest --watch"
36
+ "test": "jest --watch",
37
+ "test-ci": "jest"
37
38
  },
38
39
  "license": "Apache-2.0",
39
40
  "devDependencies": {
@@ -48,7 +49,10 @@
48
49
  "@types/jest": "^26.0.21",
49
50
  "@types/node-fetch": "^2.6.1",
50
51
  "@types/ws": "^8.2.2",
52
+ "@typescript-eslint/eslint-plugin": "^5.17.0",
53
+ "@typescript-eslint/parser": "^5.17.0",
51
54
  "babel-jest": "^26.6.3",
55
+ "eslint": "^8.12.0",
52
56
  "jest": "^26.6.3",
53
57
  "jest-each": "^27.5.1",
54
58
  "msw": "^0.39.1",
@@ -65,4 +69,4 @@
65
69
  "url": "https://github.com/liveblocks/liveblocks.git",
66
70
  "directory": "packages/liveblocks-client"
67
71
  }
68
- }
72
+ }