polfan-server-js-client 0.2.92 → 0.2.93
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/.idea/workspace.xml +31 -14
- package/build/index.cjs.js +209 -106
- package/build/index.cjs.js.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/build/types/state-tracker/TopicHistoryWindow.d.ts +4 -0
- package/build/types/types/src/schemes/commands/GetMessages.d.ts +1 -0
- package/package.json +1 -1
- package/src/state-tracker/TopicHistoryWindow.ts +50 -1
- package/src/types/src/schemes/commands/GetMessages.ts +1 -0
- package/tests/history-window.test.ts +84 -1
package/.idea/workspace.xml
CHANGED
|
@@ -5,7 +5,16 @@
|
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
7
|
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Improve event emitting in TopicHistoryWindow">
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/build/index.cjs.js" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.cjs.js" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/build/index.cjs.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.cjs.js.map" afterDir="false" />
|
|
10
|
+
<change beforePath="$PROJECT_DIR$/build/index.umd.js" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.umd.js" afterDir="false" />
|
|
11
|
+
<change beforePath="$PROJECT_DIR$/build/index.umd.js.map" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.umd.js.map" afterDir="false" />
|
|
12
|
+
<change beforePath="$PROJECT_DIR$/build/types/state-tracker/TopicHistoryWindow.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/build/types/state-tracker/TopicHistoryWindow.d.ts" afterDir="false" />
|
|
13
|
+
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
14
|
+
<change beforePath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" afterDir="false" />
|
|
15
|
+
<change beforePath="$PROJECT_DIR$/src/types" beforeDir="false" afterPath="$PROJECT_DIR$/src/types" afterDir="false" />
|
|
16
|
+
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/commands/GetMessages.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/GetMessages.ts" afterDir="false" />
|
|
17
|
+
<change beforePath="$PROJECT_DIR$/tests/history-window.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/history-window.test.ts" afterDir="false" />
|
|
9
18
|
</list>
|
|
10
19
|
<option name="SHOW_DIALOG" value="false" />
|
|
11
20
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -15,6 +24,9 @@
|
|
|
15
24
|
<component name="ComposerSettings">
|
|
16
25
|
<execution />
|
|
17
26
|
</component>
|
|
27
|
+
<component name="EmbeddingIndexingInfo">
|
|
28
|
+
<option name="cachedIndexableFilesCount" value="196" />
|
|
29
|
+
</component>
|
|
18
30
|
<component name="Git.Rebase.Settings">
|
|
19
31
|
<option name="NEW_BASE" value="origin/main" />
|
|
20
32
|
</component>
|
|
@@ -190,15 +202,12 @@
|
|
|
190
202
|
<workItem from="1776327180094" duration="5055000" />
|
|
191
203
|
<workItem from="1777136687009" duration="3369000" />
|
|
192
204
|
<workItem from="1777301595900" duration="1696000" />
|
|
193
|
-
<workItem from="1778067371586" duration="
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
<
|
|
197
|
-
<
|
|
198
|
-
<
|
|
199
|
-
<option name="presentableId" value="LOCAL-00042" />
|
|
200
|
-
<option name="project" value="LOCAL" />
|
|
201
|
-
<updated>1752966028333</updated>
|
|
205
|
+
<workItem from="1778067371586" duration="13165000" />
|
|
206
|
+
<workItem from="1778339707416" duration="3414000" />
|
|
207
|
+
<workItem from="1781017734453" duration="2603000" />
|
|
208
|
+
<workItem from="1781251927873" duration="586000" />
|
|
209
|
+
<workItem from="1781374850619" duration="61000" />
|
|
210
|
+
<workItem from="1781543017114" duration="2360000" />
|
|
202
211
|
</task>
|
|
203
212
|
<task id="LOCAL-00043" summary="Fix global emoticons support">
|
|
204
213
|
<option name="closed" value="true" />
|
|
@@ -584,7 +593,15 @@
|
|
|
584
593
|
<option name="project" value="LOCAL" />
|
|
585
594
|
<updated>1778087747027</updated>
|
|
586
595
|
</task>
|
|
587
|
-
<
|
|
596
|
+
<task id="LOCAL-00091" summary="Improve event emitting in TopicHistoryWindow">
|
|
597
|
+
<option name="closed" value="true" />
|
|
598
|
+
<created>1778088996747</created>
|
|
599
|
+
<option name="number" value="00091" />
|
|
600
|
+
<option name="presentableId" value="LOCAL-00091" />
|
|
601
|
+
<option name="project" value="LOCAL" />
|
|
602
|
+
<updated>1778088996747</updated>
|
|
603
|
+
</task>
|
|
604
|
+
<option name="localTasksCounter" value="92" />
|
|
588
605
|
<servers />
|
|
589
606
|
</component>
|
|
590
607
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -602,7 +619,6 @@
|
|
|
602
619
|
</option>
|
|
603
620
|
</component>
|
|
604
621
|
<component name="VcsManagerConfiguration">
|
|
605
|
-
<MESSAGE value="Improvements and fixes to collection mirroring" />
|
|
606
622
|
<MESSAGE value="Align to custom colors and nicks protocol changes" />
|
|
607
623
|
<MESSAGE value="Connection handling optimizations" />
|
|
608
624
|
<MESSAGE value="Ping-pong connection monitoring" />
|
|
@@ -626,8 +642,9 @@
|
|
|
626
642
|
<MESSAGE value="TopicHistoryWindow retainRatio and event handling improvements" />
|
|
627
643
|
<MESSAGE value="Remove removed message from Topic last message" />
|
|
628
644
|
<MESSAGE value="Update Topic on redacted message" />
|
|
629
|
-
<MESSAGE value="
|
|
630
|
-
<
|
|
645
|
+
<MESSAGE value="Fix room member update event handle" />
|
|
646
|
+
<MESSAGE value="Fix room member update event handle" />
|
|
647
|
+
<option name="LAST_COMMIT_MESSAGE" value="Fix room member update event handle" />
|
|
631
648
|
</component>
|
|
632
649
|
<component name="XSLT-Support.FileAssociations.UIState">
|
|
633
650
|
<expand />
|
package/build/index.cjs.js
CHANGED
|
@@ -924,32 +924,79 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
924
924
|
}
|
|
925
925
|
return fetchNext;
|
|
926
926
|
}()
|
|
927
|
+
}, {
|
|
928
|
+
key: "jumpTo",
|
|
929
|
+
value: function () {
|
|
930
|
+
var _jumpTo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(id) {
|
|
931
|
+
var result, originalState;
|
|
932
|
+
return _regenerator().w(function (_context4) {
|
|
933
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
934
|
+
case 0:
|
|
935
|
+
if (!(this.internalState.ongoing || this._items.has(id))) {
|
|
936
|
+
_context4.n = 1;
|
|
937
|
+
break;
|
|
938
|
+
}
|
|
939
|
+
return _context4.a(2);
|
|
940
|
+
case 1:
|
|
941
|
+
originalState = this.state;
|
|
942
|
+
this.internalState.ongoing = WindowState.PAST;
|
|
943
|
+
_context4.p = 2;
|
|
944
|
+
_context4.n = 3;
|
|
945
|
+
return this.fetchItemsAround(id);
|
|
946
|
+
case 3:
|
|
947
|
+
result = _context4.v;
|
|
948
|
+
this.internalState.lastFetchCount = result ? result.length : 0;
|
|
949
|
+
case 4:
|
|
950
|
+
_context4.p = 4;
|
|
951
|
+
this.internalState.ongoing = undefined;
|
|
952
|
+
return _context4.f(4);
|
|
953
|
+
case 5:
|
|
954
|
+
if (result) {
|
|
955
|
+
_context4.n = 6;
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
return _context4.a(2);
|
|
959
|
+
case 6:
|
|
960
|
+
this._items.deleteAll(); // Directly call deleteAll to prevent event emit.
|
|
961
|
+
this.addItems(result, 'tail');
|
|
962
|
+
this.internalState.current = WindowState.PAST;
|
|
963
|
+
this.emitChangeWithDiff(true, originalState);
|
|
964
|
+
case 7:
|
|
965
|
+
return _context4.a(2);
|
|
966
|
+
}
|
|
967
|
+
}, _callee4, this, [[2,, 4, 5]]);
|
|
968
|
+
}));
|
|
969
|
+
function jumpTo(_x) {
|
|
970
|
+
return _jumpTo.apply(this, arguments);
|
|
971
|
+
}
|
|
972
|
+
return jumpTo;
|
|
973
|
+
}()
|
|
927
974
|
}, {
|
|
928
975
|
key: "refreshFetchedState",
|
|
929
976
|
value: function () {
|
|
930
|
-
var _refreshFetchedState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
977
|
+
var _refreshFetchedState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
931
978
|
var _t;
|
|
932
|
-
return _regenerator().w(function (
|
|
933
|
-
while (1) switch (
|
|
979
|
+
return _regenerator().w(function (_context5) {
|
|
980
|
+
while (1) switch (_context5.n) {
|
|
934
981
|
case 0:
|
|
935
|
-
|
|
982
|
+
_context5.n = 1;
|
|
936
983
|
return this.isLatestItemLoaded();
|
|
937
984
|
case 1:
|
|
938
|
-
if (!
|
|
939
|
-
|
|
985
|
+
if (!_context5.v) {
|
|
986
|
+
_context5.n = 2;
|
|
940
987
|
break;
|
|
941
988
|
}
|
|
942
989
|
_t = WindowState.LATEST;
|
|
943
|
-
|
|
990
|
+
_context5.n = 3;
|
|
944
991
|
break;
|
|
945
992
|
case 2:
|
|
946
993
|
_t = WindowState.PAST;
|
|
947
994
|
case 3:
|
|
948
995
|
this.internalState.current = _t;
|
|
949
996
|
case 4:
|
|
950
|
-
return
|
|
997
|
+
return _context5.a(2);
|
|
951
998
|
}
|
|
952
|
-
},
|
|
999
|
+
}, _callee5, this);
|
|
953
1000
|
}));
|
|
954
1001
|
function refreshFetchedState() {
|
|
955
1002
|
return _refreshFetchedState.apply(this, arguments);
|
|
@@ -1048,23 +1095,23 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1048
1095
|
}, {
|
|
1049
1096
|
key: "setTraverseLock",
|
|
1050
1097
|
value: function () {
|
|
1051
|
-
var _setTraverseLock = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1052
|
-
return _regenerator().w(function (
|
|
1053
|
-
while (1) switch (
|
|
1098
|
+
var _setTraverseLock = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(lock) {
|
|
1099
|
+
return _regenerator().w(function (_context6) {
|
|
1100
|
+
while (1) switch (_context6.n) {
|
|
1054
1101
|
case 0:
|
|
1055
1102
|
this.internalState.traverseLock = lock;
|
|
1056
1103
|
if (!(lock && this.state !== WindowState.LIVE && this.state !== WindowState.LATEST)) {
|
|
1057
|
-
|
|
1104
|
+
_context6.n = 1;
|
|
1058
1105
|
break;
|
|
1059
1106
|
}
|
|
1060
|
-
|
|
1107
|
+
_context6.n = 1;
|
|
1061
1108
|
return TopicHistoryWindow_superPropGet(TopicHistoryWindow, "resetToLatest", this, 3)([]);
|
|
1062
1109
|
case 1:
|
|
1063
|
-
return
|
|
1110
|
+
return _context6.a(2);
|
|
1064
1111
|
}
|
|
1065
|
-
},
|
|
1112
|
+
}, _callee6, this);
|
|
1066
1113
|
}));
|
|
1067
|
-
function setTraverseLock(
|
|
1114
|
+
function setTraverseLock(_x2) {
|
|
1068
1115
|
return _setTraverseLock.apply(this, arguments);
|
|
1069
1116
|
}
|
|
1070
1117
|
return setTraverseLock;
|
|
@@ -1072,19 +1119,19 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1072
1119
|
}, {
|
|
1073
1120
|
key: "resetToLatest",
|
|
1074
1121
|
value: function () {
|
|
1075
|
-
var _resetToLatest2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1076
|
-
return _regenerator().w(function (
|
|
1077
|
-
while (1) switch (
|
|
1122
|
+
var _resetToLatest2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
1123
|
+
return _regenerator().w(function (_context7) {
|
|
1124
|
+
while (1) switch (_context7.n) {
|
|
1078
1125
|
case 0:
|
|
1079
1126
|
if (!this.internalState.traverseLock) {
|
|
1080
|
-
|
|
1127
|
+
_context7.n = 1;
|
|
1081
1128
|
break;
|
|
1082
1129
|
}
|
|
1083
|
-
return
|
|
1130
|
+
return _context7.a(2);
|
|
1084
1131
|
case 1:
|
|
1085
|
-
return
|
|
1132
|
+
return _context7.a(2, TopicHistoryWindow_superPropGet(TopicHistoryWindow, "resetToLatest", this, 3)([]));
|
|
1086
1133
|
}
|
|
1087
|
-
},
|
|
1134
|
+
}, _callee7, this);
|
|
1088
1135
|
}));
|
|
1089
1136
|
function resetToLatest() {
|
|
1090
1137
|
return _resetToLatest2.apply(this, arguments);
|
|
@@ -1094,19 +1141,19 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1094
1141
|
}, {
|
|
1095
1142
|
key: "fetchNext",
|
|
1096
1143
|
value: function () {
|
|
1097
|
-
var _fetchNext2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1098
|
-
return _regenerator().w(function (
|
|
1099
|
-
while (1) switch (
|
|
1144
|
+
var _fetchNext2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
1145
|
+
return _regenerator().w(function (_context8) {
|
|
1146
|
+
while (1) switch (_context8.n) {
|
|
1100
1147
|
case 0:
|
|
1101
1148
|
if (!this.internalState.traverseLock) {
|
|
1102
|
-
|
|
1149
|
+
_context8.n = 1;
|
|
1103
1150
|
break;
|
|
1104
1151
|
}
|
|
1105
|
-
return
|
|
1152
|
+
return _context8.a(2);
|
|
1106
1153
|
case 1:
|
|
1107
|
-
return
|
|
1154
|
+
return _context8.a(2, TopicHistoryWindow_superPropGet(TopicHistoryWindow, "fetchNext", this, 3)([]));
|
|
1108
1155
|
}
|
|
1109
|
-
},
|
|
1156
|
+
}, _callee8, this);
|
|
1110
1157
|
}));
|
|
1111
1158
|
function fetchNext() {
|
|
1112
1159
|
return _fetchNext2.apply(this, arguments);
|
|
@@ -1116,25 +1163,47 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1116
1163
|
}, {
|
|
1117
1164
|
key: "fetchPrevious",
|
|
1118
1165
|
value: function () {
|
|
1119
|
-
var _fetchPrevious2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1120
|
-
return _regenerator().w(function (
|
|
1121
|
-
while (1) switch (
|
|
1166
|
+
var _fetchPrevious2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
1167
|
+
return _regenerator().w(function (_context9) {
|
|
1168
|
+
while (1) switch (_context9.n) {
|
|
1122
1169
|
case 0:
|
|
1123
1170
|
if (!this.internalState.traverseLock) {
|
|
1124
|
-
|
|
1171
|
+
_context9.n = 1;
|
|
1125
1172
|
break;
|
|
1126
1173
|
}
|
|
1127
|
-
return
|
|
1174
|
+
return _context9.a(2);
|
|
1128
1175
|
case 1:
|
|
1129
|
-
return
|
|
1176
|
+
return _context9.a(2, TopicHistoryWindow_superPropGet(TopicHistoryWindow, "fetchPrevious", this, 3)([]));
|
|
1130
1177
|
}
|
|
1131
|
-
},
|
|
1178
|
+
}, _callee9, this);
|
|
1132
1179
|
}));
|
|
1133
1180
|
function fetchPrevious() {
|
|
1134
1181
|
return _fetchPrevious2.apply(this, arguments);
|
|
1135
1182
|
}
|
|
1136
1183
|
return fetchPrevious;
|
|
1137
1184
|
}()
|
|
1185
|
+
}, {
|
|
1186
|
+
key: "jumpTo",
|
|
1187
|
+
value: function () {
|
|
1188
|
+
var _jumpTo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(id) {
|
|
1189
|
+
return _regenerator().w(function (_context0) {
|
|
1190
|
+
while (1) switch (_context0.n) {
|
|
1191
|
+
case 0:
|
|
1192
|
+
if (!this.internalState.traverseLock) {
|
|
1193
|
+
_context0.n = 1;
|
|
1194
|
+
break;
|
|
1195
|
+
}
|
|
1196
|
+
return _context0.a(2);
|
|
1197
|
+
case 1:
|
|
1198
|
+
return _context0.a(2, TopicHistoryWindow_superPropGet(TopicHistoryWindow, "jumpTo", this, 3)([id]));
|
|
1199
|
+
}
|
|
1200
|
+
}, _callee0, this);
|
|
1201
|
+
}));
|
|
1202
|
+
function jumpTo(_x3) {
|
|
1203
|
+
return _jumpTo2.apply(this, arguments);
|
|
1204
|
+
}
|
|
1205
|
+
return jumpTo;
|
|
1206
|
+
}()
|
|
1138
1207
|
/**
|
|
1139
1208
|
* For internal use.
|
|
1140
1209
|
* @internal
|
|
@@ -1153,20 +1222,20 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1153
1222
|
}, {
|
|
1154
1223
|
key: "fetchItemsAfter",
|
|
1155
1224
|
value: function () {
|
|
1156
|
-
var _fetchItemsAfter = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1225
|
+
var _fetchItemsAfter = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
1157
1226
|
var _this$getAt;
|
|
1158
1227
|
var afterId, result;
|
|
1159
|
-
return _regenerator().w(function (
|
|
1160
|
-
while (1) switch (
|
|
1228
|
+
return _regenerator().w(function (_context1) {
|
|
1229
|
+
while (1) switch (_context1.n) {
|
|
1161
1230
|
case 0:
|
|
1162
1231
|
afterId = (_this$getAt = this.getAt(this.length - 1)) === null || _this$getAt === void 0 ? void 0 : _this$getAt.id;
|
|
1163
1232
|
if (afterId) {
|
|
1164
|
-
|
|
1233
|
+
_context1.n = 1;
|
|
1165
1234
|
break;
|
|
1166
1235
|
}
|
|
1167
|
-
return
|
|
1236
|
+
return _context1.a(2, null);
|
|
1168
1237
|
case 1:
|
|
1169
|
-
|
|
1238
|
+
_context1.n = 2;
|
|
1170
1239
|
return this.tracker.client.send('GetMessages', {
|
|
1171
1240
|
location: {
|
|
1172
1241
|
roomId: this.roomId,
|
|
@@ -1176,39 +1245,73 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1176
1245
|
limit: this.internalState.fetchLimit
|
|
1177
1246
|
});
|
|
1178
1247
|
case 2:
|
|
1179
|
-
result =
|
|
1248
|
+
result = _context1.v;
|
|
1180
1249
|
if (!result.error) {
|
|
1181
|
-
|
|
1250
|
+
_context1.n = 3;
|
|
1182
1251
|
break;
|
|
1183
1252
|
}
|
|
1184
1253
|
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1185
1254
|
case 3:
|
|
1186
|
-
return
|
|
1255
|
+
return _context1.a(2, result.data.messages);
|
|
1187
1256
|
}
|
|
1188
|
-
},
|
|
1257
|
+
}, _callee1, this);
|
|
1189
1258
|
}));
|
|
1190
1259
|
function fetchItemsAfter() {
|
|
1191
1260
|
return _fetchItemsAfter.apply(this, arguments);
|
|
1192
1261
|
}
|
|
1193
1262
|
return fetchItemsAfter;
|
|
1194
1263
|
}()
|
|
1264
|
+
}, {
|
|
1265
|
+
key: "fetchItemsAround",
|
|
1266
|
+
value: function () {
|
|
1267
|
+
var _fetchItemsAround = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(id) {
|
|
1268
|
+
var result;
|
|
1269
|
+
return _regenerator().w(function (_context10) {
|
|
1270
|
+
while (1) switch (_context10.n) {
|
|
1271
|
+
case 0:
|
|
1272
|
+
_context10.n = 1;
|
|
1273
|
+
return this.tracker.client.send('GetMessages', {
|
|
1274
|
+
location: {
|
|
1275
|
+
roomId: this.roomId,
|
|
1276
|
+
topicId: this.topicId
|
|
1277
|
+
},
|
|
1278
|
+
around: id,
|
|
1279
|
+
limit: this.internalState.fetchLimit
|
|
1280
|
+
});
|
|
1281
|
+
case 1:
|
|
1282
|
+
result = _context10.v;
|
|
1283
|
+
if (!result.error) {
|
|
1284
|
+
_context10.n = 2;
|
|
1285
|
+
break;
|
|
1286
|
+
}
|
|
1287
|
+
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1288
|
+
case 2:
|
|
1289
|
+
return _context10.a(2, result.data.messages);
|
|
1290
|
+
}
|
|
1291
|
+
}, _callee10, this);
|
|
1292
|
+
}));
|
|
1293
|
+
function fetchItemsAround(_x4) {
|
|
1294
|
+
return _fetchItemsAround.apply(this, arguments);
|
|
1295
|
+
}
|
|
1296
|
+
return fetchItemsAround;
|
|
1297
|
+
}()
|
|
1195
1298
|
}, {
|
|
1196
1299
|
key: "fetchItemsBefore",
|
|
1197
1300
|
value: function () {
|
|
1198
|
-
var _fetchItemsBefore = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1301
|
+
var _fetchItemsBefore = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
1199
1302
|
var _this$getAt2;
|
|
1200
1303
|
var beforeId, result;
|
|
1201
|
-
return _regenerator().w(function (
|
|
1202
|
-
while (1) switch (
|
|
1304
|
+
return _regenerator().w(function (_context11) {
|
|
1305
|
+
while (1) switch (_context11.n) {
|
|
1203
1306
|
case 0:
|
|
1204
1307
|
beforeId = (_this$getAt2 = this.getAt(0)) === null || _this$getAt2 === void 0 ? void 0 : _this$getAt2.id;
|
|
1205
1308
|
if (beforeId) {
|
|
1206
|
-
|
|
1309
|
+
_context11.n = 1;
|
|
1207
1310
|
break;
|
|
1208
1311
|
}
|
|
1209
|
-
return
|
|
1312
|
+
return _context11.a(2, null);
|
|
1210
1313
|
case 1:
|
|
1211
|
-
|
|
1314
|
+
_context11.n = 2;
|
|
1212
1315
|
return this.tracker.client.send('GetMessages', {
|
|
1213
1316
|
location: {
|
|
1214
1317
|
roomId: this.roomId,
|
|
@@ -1218,16 +1321,16 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1218
1321
|
limit: this.internalState.fetchLimit
|
|
1219
1322
|
});
|
|
1220
1323
|
case 2:
|
|
1221
|
-
result =
|
|
1324
|
+
result = _context11.v;
|
|
1222
1325
|
if (!result.error) {
|
|
1223
|
-
|
|
1326
|
+
_context11.n = 3;
|
|
1224
1327
|
break;
|
|
1225
1328
|
}
|
|
1226
1329
|
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1227
1330
|
case 3:
|
|
1228
|
-
return
|
|
1331
|
+
return _context11.a(2, result.data.messages);
|
|
1229
1332
|
}
|
|
1230
|
-
},
|
|
1333
|
+
}, _callee11, this);
|
|
1231
1334
|
}));
|
|
1232
1335
|
function fetchItemsBefore() {
|
|
1233
1336
|
return _fetchItemsBefore.apply(this, arguments);
|
|
@@ -1237,12 +1340,12 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1237
1340
|
}, {
|
|
1238
1341
|
key: "fetchLatestItems",
|
|
1239
1342
|
value: function () {
|
|
1240
|
-
var _fetchLatestItems = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1343
|
+
var _fetchLatestItems = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
1241
1344
|
var result;
|
|
1242
|
-
return _regenerator().w(function (
|
|
1243
|
-
while (1) switch (
|
|
1345
|
+
return _regenerator().w(function (_context12) {
|
|
1346
|
+
while (1) switch (_context12.n) {
|
|
1244
1347
|
case 0:
|
|
1245
|
-
|
|
1348
|
+
_context12.n = 1;
|
|
1246
1349
|
return this.tracker.client.send('GetMessages', {
|
|
1247
1350
|
location: {
|
|
1248
1351
|
roomId: this.roomId,
|
|
@@ -1251,16 +1354,16 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1251
1354
|
limit: this.internalState.fetchLimit
|
|
1252
1355
|
});
|
|
1253
1356
|
case 1:
|
|
1254
|
-
result =
|
|
1357
|
+
result = _context12.v;
|
|
1255
1358
|
if (!result.error) {
|
|
1256
|
-
|
|
1359
|
+
_context12.n = 2;
|
|
1257
1360
|
break;
|
|
1258
1361
|
}
|
|
1259
1362
|
throw new Error("Cannot fetch messages: ".concat(result.error.message));
|
|
1260
1363
|
case 2:
|
|
1261
|
-
return
|
|
1364
|
+
return _context12.a(2, result.data.messages);
|
|
1262
1365
|
}
|
|
1263
|
-
},
|
|
1366
|
+
}, _callee12, this);
|
|
1264
1367
|
}));
|
|
1265
1368
|
function fetchLatestItems() {
|
|
1266
1369
|
return _fetchLatestItems.apply(this, arguments);
|
|
@@ -1270,16 +1373,16 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1270
1373
|
}, {
|
|
1271
1374
|
key: "getTopic",
|
|
1272
1375
|
value: function () {
|
|
1273
|
-
var _getTopic = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1274
|
-
return _regenerator().w(function (
|
|
1275
|
-
while (1) switch (
|
|
1376
|
+
var _getTopic = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
|
|
1377
|
+
return _regenerator().w(function (_context13) {
|
|
1378
|
+
while (1) switch (_context13.n) {
|
|
1276
1379
|
case 0:
|
|
1277
|
-
|
|
1380
|
+
_context13.n = 1;
|
|
1278
1381
|
return this.tracker.rooms.getTopics(this.roomId, [this.topicId]);
|
|
1279
1382
|
case 1:
|
|
1280
|
-
return
|
|
1383
|
+
return _context13.a(2, _context13.v.get(this.topicId));
|
|
1281
1384
|
}
|
|
1282
|
-
},
|
|
1385
|
+
}, _callee13, this);
|
|
1283
1386
|
}));
|
|
1284
1387
|
function getTopic() {
|
|
1285
1388
|
return _getTopic.apply(this, arguments);
|
|
@@ -1289,43 +1392,43 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1289
1392
|
}, {
|
|
1290
1393
|
key: "getLatestMessageId",
|
|
1291
1394
|
value: function () {
|
|
1292
|
-
var _getLatestMessageId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1395
|
+
var _getLatestMessageId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
1293
1396
|
var _yield$this$getTopic;
|
|
1294
1397
|
var _t2, _t3, _t4, _t5;
|
|
1295
|
-
return _regenerator().w(function (
|
|
1296
|
-
while (1) switch (
|
|
1398
|
+
return _regenerator().w(function (_context14) {
|
|
1399
|
+
while (1) switch (_context14.n) {
|
|
1297
1400
|
case 0:
|
|
1298
|
-
|
|
1401
|
+
_context14.n = 1;
|
|
1299
1402
|
return this.getTopic();
|
|
1300
1403
|
case 1:
|
|
1301
|
-
_t4 = _yield$this$getTopic =
|
|
1404
|
+
_t4 = _yield$this$getTopic = _context14.v;
|
|
1302
1405
|
_t3 = _t4 === null;
|
|
1303
1406
|
if (_t3) {
|
|
1304
|
-
|
|
1407
|
+
_context14.n = 2;
|
|
1305
1408
|
break;
|
|
1306
1409
|
}
|
|
1307
1410
|
_t3 = _yield$this$getTopic === void 0;
|
|
1308
1411
|
case 2:
|
|
1309
1412
|
_t2 = _t3;
|
|
1310
1413
|
if (_t2) {
|
|
1311
|
-
|
|
1414
|
+
_context14.n = 3;
|
|
1312
1415
|
break;
|
|
1313
1416
|
}
|
|
1314
1417
|
_t2 = (_yield$this$getTopic = _yield$this$getTopic.lastMessage) === null || _yield$this$getTopic === void 0;
|
|
1315
1418
|
case 3:
|
|
1316
1419
|
if (!_t2) {
|
|
1317
|
-
|
|
1420
|
+
_context14.n = 4;
|
|
1318
1421
|
break;
|
|
1319
1422
|
}
|
|
1320
1423
|
_t5 = void 0;
|
|
1321
|
-
|
|
1424
|
+
_context14.n = 5;
|
|
1322
1425
|
break;
|
|
1323
1426
|
case 4:
|
|
1324
1427
|
_t5 = _yield$this$getTopic.id;
|
|
1325
1428
|
case 5:
|
|
1326
|
-
return
|
|
1429
|
+
return _context14.a(2, _t5);
|
|
1327
1430
|
}
|
|
1328
|
-
},
|
|
1431
|
+
}, _callee14, this);
|
|
1329
1432
|
}));
|
|
1330
1433
|
function getLatestMessageId() {
|
|
1331
1434
|
return _getLatestMessageId.apply(this, arguments);
|
|
@@ -1335,18 +1438,18 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1335
1438
|
}, {
|
|
1336
1439
|
key: "isLatestItemLoaded",
|
|
1337
1440
|
value: function () {
|
|
1338
|
-
var _isLatestItemLoaded = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1441
|
+
var _isLatestItemLoaded = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
|
|
1339
1442
|
var lastMessageId;
|
|
1340
|
-
return _regenerator().w(function (
|
|
1341
|
-
while (1) switch (
|
|
1443
|
+
return _regenerator().w(function (_context15) {
|
|
1444
|
+
while (1) switch (_context15.n) {
|
|
1342
1445
|
case 0:
|
|
1343
|
-
|
|
1446
|
+
_context15.n = 1;
|
|
1344
1447
|
return this.getLatestMessageId();
|
|
1345
1448
|
case 1:
|
|
1346
|
-
lastMessageId =
|
|
1347
|
-
return
|
|
1449
|
+
lastMessageId = _context15.v;
|
|
1450
|
+
return _context15.a(2, lastMessageId ? this.has(lastMessageId) : true);
|
|
1348
1451
|
}
|
|
1349
|
-
},
|
|
1452
|
+
}, _callee15, this);
|
|
1350
1453
|
}));
|
|
1351
1454
|
function isLatestItemLoaded() {
|
|
1352
1455
|
return _isLatestItemLoaded.apply(this, arguments);
|
|
@@ -1356,10 +1459,10 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1356
1459
|
}, {
|
|
1357
1460
|
key: "handleNewMessage",
|
|
1358
1461
|
value: function () {
|
|
1359
|
-
var _handleNewMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1462
|
+
var _handleNewMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16(ev) {
|
|
1360
1463
|
var originalState;
|
|
1361
|
-
return _regenerator().w(function (
|
|
1362
|
-
while (1) switch (
|
|
1464
|
+
return _regenerator().w(function (_context16) {
|
|
1465
|
+
while (1) switch (_context16.n) {
|
|
1363
1466
|
case 0:
|
|
1364
1467
|
if ([WindowState.LATEST, WindowState.LIVE].includes(this.state) && ev.message.location.roomId === this.roomId && ev.message.location.topicId === this.topicId) {
|
|
1365
1468
|
originalState = this.state;
|
|
@@ -1367,11 +1470,11 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1367
1470
|
this.emitChangeWithDiff(true, originalState);
|
|
1368
1471
|
}
|
|
1369
1472
|
case 1:
|
|
1370
|
-
return
|
|
1473
|
+
return _context16.a(2);
|
|
1371
1474
|
}
|
|
1372
|
-
},
|
|
1475
|
+
}, _callee16, this);
|
|
1373
1476
|
}));
|
|
1374
|
-
function handleNewMessage(
|
|
1477
|
+
function handleNewMessage(_x5) {
|
|
1375
1478
|
return _handleNewMessage.apply(this, arguments);
|
|
1376
1479
|
}
|
|
1377
1480
|
return handleNewMessage;
|
|
@@ -1379,16 +1482,16 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1379
1482
|
}, {
|
|
1380
1483
|
key: "handleMessagesRedacted",
|
|
1381
1484
|
value: function () {
|
|
1382
|
-
var _handleMessagesRedacted = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
1485
|
+
var _handleMessagesRedacted = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(ev) {
|
|
1383
1486
|
var refTopicIds;
|
|
1384
|
-
return _regenerator().w(function (
|
|
1385
|
-
while (1) switch (
|
|
1487
|
+
return _regenerator().w(function (_context17) {
|
|
1488
|
+
while (1) switch (_context17.n) {
|
|
1386
1489
|
case 0:
|
|
1387
1490
|
if (!(ev.location.topicId !== this.topicId || ev.location.roomId !== this.roomId)) {
|
|
1388
|
-
|
|
1491
|
+
_context17.n = 1;
|
|
1389
1492
|
break;
|
|
1390
1493
|
}
|
|
1391
|
-
return
|
|
1494
|
+
return _context17.a(2);
|
|
1392
1495
|
case 1:
|
|
1393
1496
|
refTopicIds = this.items.filter(function (msg) {
|
|
1394
1497
|
return msg.topicRef && ev.ids.includes(msg.id);
|
|
@@ -1397,21 +1500,21 @@ var TopicHistoryWindow = /*#__PURE__*/function (_TraversableRemoteCol) {
|
|
|
1397
1500
|
});
|
|
1398
1501
|
this["delete"].apply(this, TopicHistoryWindow_toConsumableArray(ev.ids));
|
|
1399
1502
|
if (!(this.length === 0)) {
|
|
1400
|
-
|
|
1503
|
+
_context17.n = 2;
|
|
1401
1504
|
break;
|
|
1402
1505
|
}
|
|
1403
|
-
|
|
1506
|
+
_context17.n = 2;
|
|
1404
1507
|
return this.resetToLatest();
|
|
1405
1508
|
case 2:
|
|
1406
1509
|
if (refTopicIds.length > 0) {
|
|
1407
1510
|
this.eventTarget.emit('reftopicsdeleted', refTopicIds);
|
|
1408
1511
|
}
|
|
1409
1512
|
case 3:
|
|
1410
|
-
return
|
|
1513
|
+
return _context17.a(2);
|
|
1411
1514
|
}
|
|
1412
|
-
},
|
|
1515
|
+
}, _callee17, this);
|
|
1413
1516
|
}));
|
|
1414
|
-
function handleMessagesRedacted(
|
|
1517
|
+
function handleMessagesRedacted(_x6) {
|
|
1415
1518
|
return _handleMessagesRedacted.apply(this, arguments);
|
|
1416
1519
|
}
|
|
1417
1520
|
return handleMessagesRedacted;
|