polfan-server-js-client 0.2.86 → 0.2.87
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 +23 -27
- package/build/index.cjs.js +29 -9
- 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 +12 -3
- package/package.json +1 -1
- package/src/state-tracker/TopicHistoryWindow.ts +32 -10
- package/tests/history-window.test.ts +35 -1
package/.idea/workspace.xml
CHANGED
|
@@ -4,22 +4,15 @@
|
|
|
4
4
|
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="
|
|
8
|
-
<change afterPath="$PROJECT_DIR$/
|
|
9
|
-
<change afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/GetUserInfo.ts" afterDir="false" />
|
|
10
|
-
<change afterPath="$PROJECT_DIR$/src/types/src/schemes/events/UserInfo.ts" afterDir="false" />
|
|
7
|
+
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Adjust to ban changes">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/build/index.cjs.js" beforeDir="false" afterPath="$PROJECT_DIR$/build/index.cjs.js" afterDir="false" />
|
|
11
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" />
|
|
12
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
13
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
14
|
-
<change beforePath="$PROJECT_DIR$/src/
|
|
15
|
-
<change beforePath="$PROJECT_DIR$/
|
|
16
|
-
<change beforePath="$PROJECT_DIR$/src/types/src/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/index.ts" afterDir="false" />
|
|
17
|
-
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/BanObject.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/BanObject.ts" afterDir="false" />
|
|
18
|
-
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/RoomSummary.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/RoomSummary.ts" afterDir="false" />
|
|
19
|
-
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/commands/Ban.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/Ban.ts" afterDir="false" />
|
|
20
|
-
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/commands/GetBans.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/GetBans.ts" afterDir="false" />
|
|
21
|
-
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/commands/Unban.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/commands/Unban.ts" afterDir="false" />
|
|
22
|
-
<change beforePath="$PROJECT_DIR$/src/types/src/schemes/events/Session.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/src/schemes/events/Session.ts" 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$/tests/history-window.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/history-window.test.ts" afterDir="false" />
|
|
23
16
|
</list>
|
|
24
17
|
<option name="SHOW_DIALOG" value="false" />
|
|
25
18
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -77,6 +70,7 @@
|
|
|
77
70
|
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager.252": "true",
|
|
78
71
|
"RunOnceActivity.git.unshallow": "true",
|
|
79
72
|
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
|
73
|
+
"codeWithMe.voiceChat.enabledByDefault": "false",
|
|
80
74
|
"com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
|
|
81
75
|
"git-widget-placeholder": "master",
|
|
82
76
|
"ignore.virus.scanning.warn.message": "true",
|
|
@@ -96,8 +90,8 @@
|
|
|
96
90
|
<component name="SharedIndexes">
|
|
97
91
|
<attachedChunks>
|
|
98
92
|
<set>
|
|
99
|
-
<option value="bundled-js-predefined-d6986cc7102b-
|
|
100
|
-
<option value="bundled-php-predefined-a98d8de5180a-
|
|
93
|
+
<option value="bundled-js-predefined-d6986cc7102b-31caf2ab9e3c-JavaScript-PS-261.23567.149" />
|
|
94
|
+
<option value="bundled-php-predefined-a98d8de5180a-022fa7b8ab75-com.jetbrains.php.sharedIndexes-PS-261.23567.149" />
|
|
101
95
|
</set>
|
|
102
96
|
</attachedChunks>
|
|
103
97
|
</component>
|
|
@@ -200,15 +194,9 @@
|
|
|
200
194
|
<workItem from="1774871561103" duration="4164000" />
|
|
201
195
|
<workItem from="1775031025390" duration="593000" />
|
|
202
196
|
<workItem from="1775641624063" duration="1179000" />
|
|
203
|
-
<workItem from="1776327180094" duration="
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
<option name="closed" value="true" />
|
|
207
|
-
<created>1751160521070</created>
|
|
208
|
-
<option name="number" value="00036" />
|
|
209
|
-
<option name="presentableId" value="LOCAL-00036" />
|
|
210
|
-
<option name="project" value="LOCAL" />
|
|
211
|
-
<updated>1751160521070</updated>
|
|
197
|
+
<workItem from="1776327180094" duration="5055000" />
|
|
198
|
+
<workItem from="1777136687009" duration="3369000" />
|
|
199
|
+
<workItem from="1777301595900" duration="1616000" />
|
|
212
200
|
</task>
|
|
213
201
|
<task id="LOCAL-00037" summary="Dedicated event for user status change">
|
|
214
202
|
<option name="closed" value="true" />
|
|
@@ -594,7 +582,15 @@
|
|
|
594
582
|
<option name="project" value="LOCAL" />
|
|
595
583
|
<updated>1769894114639</updated>
|
|
596
584
|
</task>
|
|
597
|
-
<
|
|
585
|
+
<task id="LOCAL-00085" summary="Adjust to ban changes">
|
|
586
|
+
<option name="closed" value="true" />
|
|
587
|
+
<created>1776807618896</created>
|
|
588
|
+
<option name="number" value="00085" />
|
|
589
|
+
<option name="presentableId" value="LOCAL-00085" />
|
|
590
|
+
<option name="project" value="LOCAL" />
|
|
591
|
+
<updated>1776807618896</updated>
|
|
592
|
+
</task>
|
|
593
|
+
<option name="localTasksCounter" value="86" />
|
|
598
594
|
<servers />
|
|
599
595
|
</component>
|
|
600
596
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -612,7 +608,6 @@
|
|
|
612
608
|
</option>
|
|
613
609
|
</component>
|
|
614
610
|
<component name="VcsManagerConfiguration">
|
|
615
|
-
<MESSAGE value="Protocol version support" />
|
|
616
611
|
<MESSAGE value="Update room on recipient user change" />
|
|
617
612
|
<MESSAGE value="Fix websocket state error handling" />
|
|
618
613
|
<MESSAGE value="Collection integration with React JS rework" />
|
|
@@ -637,7 +632,8 @@
|
|
|
637
632
|
<MESSAGE value="Improve EventTarget typings" />
|
|
638
633
|
<MESSAGE value="Delete redacted messages, improve collections, add tests" />
|
|
639
634
|
<MESSAGE value="Fix emitting event with deleted topics" />
|
|
640
|
-
<
|
|
635
|
+
<MESSAGE value="Adjust to ban changes" />
|
|
636
|
+
<option name="LAST_COMMIT_MESSAGE" value="Adjust to ban changes" />
|
|
641
637
|
</component>
|
|
642
638
|
<component name="XSLT-Support.FileAssociations.UIState">
|
|
643
639
|
<expand />
|
package/build/index.cjs.js
CHANGED
|
@@ -685,7 +685,8 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
685
685
|
TopicHistoryWindow_defineProperty(_this, "internalState", {
|
|
686
686
|
current: WindowState.LIVE,
|
|
687
687
|
ongoing: undefined,
|
|
688
|
-
limit:
|
|
688
|
+
limit: 1000,
|
|
689
|
+
retainRatio: 1,
|
|
689
690
|
fetchLimit: 50,
|
|
690
691
|
lastFetchCount: 0,
|
|
691
692
|
oldestId: null
|
|
@@ -720,7 +721,7 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
720
721
|
}
|
|
721
722
|
|
|
722
723
|
/**
|
|
723
|
-
* Maximum
|
|
724
|
+
* Maximum number of items stored in window (High Watermark).
|
|
724
725
|
* Null for unlimited.
|
|
725
726
|
*/
|
|
726
727
|
}, {
|
|
@@ -730,12 +731,28 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
730
731
|
}
|
|
731
732
|
|
|
732
733
|
/**
|
|
733
|
-
* Maximum
|
|
734
|
+
* Maximum number of items stored in window (High Watermark).
|
|
734
735
|
* Null for unlimited.
|
|
735
736
|
*/,
|
|
736
737
|
set: function set(value) {
|
|
737
738
|
this.internalState.limit = value;
|
|
738
739
|
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Percentage of limit to keep when trimming.
|
|
743
|
+
*/
|
|
744
|
+
}, {
|
|
745
|
+
key: "retainRatio",
|
|
746
|
+
get: function get() {
|
|
747
|
+
return this.internalState.retainRatio;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* Percentage of limit to keep when trimming.
|
|
752
|
+
*/,
|
|
753
|
+
set: function set(value) {
|
|
754
|
+
this.internalState.retainRatio = value;
|
|
755
|
+
}
|
|
739
756
|
}, {
|
|
740
757
|
key: "hasLatest",
|
|
741
758
|
get: function get() {
|
|
@@ -772,7 +789,7 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
772
789
|
this.internalState.ongoing = undefined;
|
|
773
790
|
return _context.f(4);
|
|
774
791
|
case 5:
|
|
775
|
-
this.deleteAll();
|
|
792
|
+
this._items.deleteAll(); // Directly call deleteAll to prevent event emit.
|
|
776
793
|
this.addItems(result, 'tail');
|
|
777
794
|
this.internalState.current = WindowState.LATEST;
|
|
778
795
|
case 6:
|
|
@@ -941,25 +958,28 @@ var TraversableRemoteCollection = /*#__PURE__*/function (_ObservableIndexedObj)
|
|
|
941
958
|
if (to === 'tail') {
|
|
942
959
|
result = this.trimItemsArrayToLimit([].concat(TopicHistoryWindow_toConsumableArray(this.items), TopicHistoryWindow_toConsumableArray(newItems)), 'head');
|
|
943
960
|
}
|
|
944
|
-
this.deleteAll();
|
|
961
|
+
this._items.deleteAll(); // Directly call deleteAll to prevent event emit.
|
|
945
962
|
this.set.apply(this, TopicHistoryWindow_toConsumableArray(result));
|
|
946
963
|
}
|
|
947
964
|
|
|
948
965
|
/**
|
|
949
|
-
* Return array with messages
|
|
966
|
+
* Return array with messages trimmed using High/Low Watermark strategy.
|
|
950
967
|
*/
|
|
951
968
|
}, {
|
|
952
969
|
key: "trimItemsArrayToLimit",
|
|
953
970
|
value: function trimItemsArrayToLimit(items, from) {
|
|
954
|
-
|
|
971
|
+
var highWatermark = this.limit;
|
|
972
|
+
if (highWatermark === null || items.length <= highWatermark) {
|
|
955
973
|
return items;
|
|
956
974
|
}
|
|
975
|
+
var lowWatermark = Math.floor(highWatermark * this.internalState.retainRatio);
|
|
957
976
|
if (from === 'head') {
|
|
958
|
-
return items.slice(-
|
|
977
|
+
return items.slice(-lowWatermark);
|
|
959
978
|
}
|
|
960
979
|
if (from === 'tail') {
|
|
961
|
-
return items.slice(0,
|
|
980
|
+
return items.slice(0, lowWatermark);
|
|
962
981
|
}
|
|
982
|
+
return items;
|
|
963
983
|
}
|
|
964
984
|
}]);
|
|
965
985
|
}(ObservableIndexedObjectCollection);
|