polfan-server-js-client 0.1.99912 → 0.1.99914

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/build/index.js CHANGED
@@ -114,6 +114,7 @@ var EventTarget = /*#__PURE__*/function () {
114
114
  return this;
115
115
  }
116
116
  this.events.get(eventName).splice(index, 1);
117
+ return this;
117
118
  }
118
119
  }, {
119
120
  key: "emit",
@@ -973,13 +974,13 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
973
974
  * @internal
974
975
  */
975
976
  TopicHistoryWindow_createClass(TopicHistoryWindow, [{
976
- key: "_setTopicReference",
977
- value: function _setTopicReference(ref) {
978
- var refMessage = this.get(ref.messageId);
977
+ key: "_updateMessageReference",
978
+ value: function _updateMessageReference(refTopic) {
979
+ var refMessage = this.get(refTopic.refMessage.id);
979
980
  if (refMessage) {
980
981
  // Update referenced topic ID in message
981
982
  this.set(_objectSpread(_objectSpread({}, refMessage), {}, {
982
- topicRef: ref.topicId
983
+ topicRef: refTopic.id
983
984
  }));
984
985
  }
985
986
  }
@@ -991,7 +992,7 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
991
992
  while (1) {
992
993
  switch (_context5.prev = _context5.next) {
993
994
  case 0:
994
- if ([WindowState.LATEST, WindowState.LIVE].includes(this.state) && ev.location.roomId === this.roomId && ev.location.topicId === this.topicId) {
995
+ if ([WindowState.LATEST, WindowState.LIVE].includes(this.state) && ev.message.location.roomId === this.roomId && ev.message.location.topicId === this.topicId) {
995
996
  this.addItems([ev.message], 'tail');
996
997
  }
997
998
  case 1:
@@ -1341,13 +1342,9 @@ var RoomMessagesHistory = /*#__PURE__*/function () {
1341
1342
  this.historyWindows.set([topic.id, new TopicHistoryWindow(this.room.id, topic.id, this.tracker)]);
1342
1343
 
1343
1344
  // If new topic refers to some message from this room, update other structures
1344
- if (topic.messageRef) {
1345
- var refHistoryWindow = this.historyWindows.get(topic.messageRef.topicId);
1346
- refHistoryWindow._setTopicReference({
1347
- topicId: topic.id,
1348
- // Reverse the reference
1349
- messageId: topic.messageRef.messageId
1350
- });
1345
+ if (topic.refMessage) {
1346
+ var refHistoryWindow = this.historyWindows.get(topic.refMessage.location.topicId);
1347
+ refHistoryWindow === null || refHistoryWindow === void 0 ? void 0 : refHistoryWindow._updateMessageReference(topic);
1351
1348
  }
1352
1349
  }
1353
1350
  }]);
@@ -1812,8 +1809,8 @@ var MessagesManager = /*#__PURE__*/function () {
1812
1809
  key: "updateLocallyFollowedTopicOnNewMessage",
1813
1810
  value: function updateLocallyFollowedTopicOnNewMessage(ev) {
1814
1811
  var _this$tracker$me;
1815
- var roomFollowedTopics = this.followedTopics.get(ev.location.roomId);
1816
- var followedTopic = roomFollowedTopics === null || roomFollowedTopics === void 0 ? void 0 : roomFollowedTopics.get(ev.location.topicId);
1812
+ var roomFollowedTopics = this.followedTopics.get(ev.message.location.roomId);
1813
+ var followedTopic = roomFollowedTopics === null || roomFollowedTopics === void 0 ? void 0 : roomFollowedTopics.get(ev.message.location.topicId);
1817
1814
  if (!roomFollowedTopics || !followedTopic) {
1818
1815
  // Skip if we don't follow this room or targeted topic
1819
1816
  return;
@@ -2288,10 +2285,7 @@ var RoomsManager = /*#__PURE__*/function () {
2288
2285
  }, {
2289
2286
  key: "handleRoomUpdated",
2290
2287
  value: function handleRoomUpdated(ev) {
2291
- this.list.set(RoomsManager_objectSpread(RoomsManager_objectSpread({}, this.list.get(ev.room.id)), {}, {
2292
- name: ev.room.name,
2293
- description: ev.room.description
2294
- }));
2288
+ this.list.set(ev.room);
2295
2289
  }
2296
2290
  }, {
2297
2291
  key: "handleRoomDeleted",
@@ -2390,8 +2384,8 @@ var RoomsManager = /*#__PURE__*/function () {
2390
2384
  }, {
2391
2385
  key: "handleNewMessage",
2392
2386
  value: function handleNewMessage(ev) {
2393
- var topics = this.topics.get(ev.location.roomId);
2394
- var topic = topics === null || topics === void 0 ? void 0 : topics.get(ev.location.topicId);
2387
+ var topics = this.topics.get(ev.message.location.roomId);
2388
+ var topic = topics === null || topics === void 0 ? void 0 : topics.get(ev.message.location.topicId);
2395
2389
  if (topic) {
2396
2390
  topics.set(RoomsManager_objectSpread(RoomsManager_objectSpread({}, topic), {}, {
2397
2391
  messageCount: topic.messageCount + 1,
@@ -2779,9 +2773,7 @@ var SpacesManager = /*#__PURE__*/function () {
2779
2773
  }, {
2780
2774
  key: "handleSpaceUpdated",
2781
2775
  value: function handleSpaceUpdated(ev) {
2782
- this.list.set(SpacesManager_objectSpread(SpacesManager_objectSpread({}, this.list.get(ev.space.id)), {}, {
2783
- name: ev.space.name
2784
- }));
2776
+ this.list.set(ev.space);
2785
2777
  }
2786
2778
  }, {
2787
2779
  key: "handleSpaceDeleted",