polfan-server-js-client 0.2.54 → 0.2.56
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 +26 -30
- package/build/index.cjs.js +32 -11
- 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/IndexedObjectCollection.d.ts +4 -3
- package/build/types/state-tracker/TopicHistoryWindow.d.ts +5 -3
- package/package.json +1 -1
- package/src/IndexedObjectCollection.ts +26 -12
- package/src/state-tracker/TopicHistoryWindow.ts +16 -3
- package/tests/history-window.test.ts +6 -1
package/.idea/workspace.xml
CHANGED
|
@@ -4,15 +4,9 @@
|
|
|
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 beforePath="$PROJECT_DIR$/
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/
|
|
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/types/src/schemes/events/Session.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/build/types/types/src/schemes/events/Session.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/AbstractChatClient.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/AbstractChatClient.ts" afterDir="false" />
|
|
15
|
-
<change beforePath="$PROJECT_DIR$/src/WebSocketChatClient.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/WebSocketChatClient.ts" afterDir="false" />
|
|
7
|
+
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Collection integration with React JS rework">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/tests/history-window.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/tests/history-window.test.ts" afterDir="false" />
|
|
16
10
|
</list>
|
|
17
11
|
<option name="SHOW_DIALOG" value="false" />
|
|
18
12
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -142,23 +136,9 @@
|
|
|
142
136
|
<workItem from="1757108361675" duration="5000" />
|
|
143
137
|
<workItem from="1759771277022" duration="584000" />
|
|
144
138
|
<workItem from="1759848250548" duration="413000" />
|
|
145
|
-
<workItem from="1761857165939" duration="
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<option name="closed" value="true" />
|
|
149
|
-
<created>1738413358814</created>
|
|
150
|
-
<option name="number" value="00011" />
|
|
151
|
-
<option name="presentableId" value="LOCAL-00011" />
|
|
152
|
-
<option name="project" value="LOCAL" />
|
|
153
|
-
<updated>1738413358814</updated>
|
|
154
|
-
</task>
|
|
155
|
-
<task id="LOCAL-00012" summary="Permission related changes in protocol types">
|
|
156
|
-
<option name="closed" value="true" />
|
|
157
|
-
<created>1739137397104</created>
|
|
158
|
-
<option name="number" value="00012" />
|
|
159
|
-
<option name="presentableId" value="LOCAL-00012" />
|
|
160
|
-
<option name="project" value="LOCAL" />
|
|
161
|
-
<updated>1739137397104</updated>
|
|
139
|
+
<workItem from="1761857165939" duration="4293000" />
|
|
140
|
+
<workItem from="1762715993044" duration="642000" />
|
|
141
|
+
<workItem from="1762724230487" duration="7498000" />
|
|
162
142
|
</task>
|
|
163
143
|
<task id="LOCAL-00013" summary="Permission related changes in protocol types">
|
|
164
144
|
<option name="closed" value="true" />
|
|
@@ -536,7 +516,23 @@
|
|
|
536
516
|
<option name="project" value="LOCAL" />
|
|
537
517
|
<updated>1756804976724</updated>
|
|
538
518
|
</task>
|
|
539
|
-
<
|
|
519
|
+
<task id="LOCAL-00060" summary="Fix websocket state error handling">
|
|
520
|
+
<option name="closed" value="true" />
|
|
521
|
+
<created>1761861305919</created>
|
|
522
|
+
<option name="number" value="00060" />
|
|
523
|
+
<option name="presentableId" value="LOCAL-00060" />
|
|
524
|
+
<option name="project" value="LOCAL" />
|
|
525
|
+
<updated>1761861305919</updated>
|
|
526
|
+
</task>
|
|
527
|
+
<task id="LOCAL-00061" summary="Collection integration with React JS rework">
|
|
528
|
+
<option name="closed" value="true" />
|
|
529
|
+
<created>1762773873854</created>
|
|
530
|
+
<option name="number" value="00061" />
|
|
531
|
+
<option name="presentableId" value="LOCAL-00061" />
|
|
532
|
+
<option name="project" value="LOCAL" />
|
|
533
|
+
<updated>1762773873854</updated>
|
|
534
|
+
</task>
|
|
535
|
+
<option name="localTasksCounter" value="62" />
|
|
540
536
|
<servers />
|
|
541
537
|
</component>
|
|
542
538
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -554,8 +550,6 @@
|
|
|
554
550
|
</option>
|
|
555
551
|
</component>
|
|
556
552
|
<component name="VcsManagerConfiguration">
|
|
557
|
-
<MESSAGE value="Private rooms and space summaries" />
|
|
558
|
-
<MESSAGE value="Custom nicks support" />
|
|
559
553
|
<MESSAGE value="CustomNickChange message type" />
|
|
560
554
|
<MESSAGE value="Fix module exporting (node + browser)" />
|
|
561
555
|
<MESSAGE value="Fix JoinRoom command response type" />
|
|
@@ -579,6 +573,8 @@
|
|
|
579
573
|
<MESSAGE value="Ephemeral room history support" />
|
|
580
574
|
<MESSAGE value="Protocol version support" />
|
|
581
575
|
<MESSAGE value="Update room on recipient user change" />
|
|
582
|
-
<
|
|
576
|
+
<MESSAGE value="Fix websocket state error handling" />
|
|
577
|
+
<MESSAGE value="Collection integration with React JS rework" />
|
|
578
|
+
<option name="LAST_COMMIT_MESSAGE" value="Collection integration with React JS rework" />
|
|
583
579
|
</component>
|
|
584
580
|
</project>
|
package/build/index.cjs.js
CHANGED
|
@@ -155,12 +155,8 @@ function IndexedObjectCollection_toPrimitive(input, hint) { if (typeof input !==
|
|
|
155
155
|
class IndexedCollection {
|
|
156
156
|
constructor(items = []) {
|
|
157
157
|
IndexedObjectCollection_defineProperty(this, "_items", new Map());
|
|
158
|
-
IndexedObjectCollection_defineProperty(this, "_mutationCounter", 0);
|
|
159
158
|
this.set(...items);
|
|
160
159
|
}
|
|
161
|
-
get mutationCounter() {
|
|
162
|
-
return this._mutationCounter;
|
|
163
|
-
}
|
|
164
160
|
get items() {
|
|
165
161
|
return this._items;
|
|
166
162
|
}
|
|
@@ -168,7 +164,6 @@ class IndexedCollection {
|
|
|
168
164
|
return this._items.size;
|
|
169
165
|
}
|
|
170
166
|
set(...items) {
|
|
171
|
-
this._mutationCounter++;
|
|
172
167
|
for (const item of items) {
|
|
173
168
|
this._items.set(item[0], item[1]);
|
|
174
169
|
}
|
|
@@ -183,11 +178,9 @@ class IndexedCollection {
|
|
|
183
178
|
for (const id of ids) {
|
|
184
179
|
this.items.delete(id);
|
|
185
180
|
}
|
|
186
|
-
this._mutationCounter++;
|
|
187
181
|
}
|
|
188
182
|
deleteAll() {
|
|
189
183
|
this.items.clear();
|
|
190
|
-
this._mutationCounter++;
|
|
191
184
|
}
|
|
192
185
|
findBy(field, valueToFind, limit = null) {
|
|
193
186
|
const result = new IndexedCollection();
|
|
@@ -202,6 +195,11 @@ class IndexedCollection {
|
|
|
202
195
|
}
|
|
203
196
|
return result;
|
|
204
197
|
}
|
|
198
|
+
shallowCopy() {
|
|
199
|
+
const copy = new IndexedCollection();
|
|
200
|
+
copy._items = this._items;
|
|
201
|
+
return copy;
|
|
202
|
+
}
|
|
205
203
|
}
|
|
206
204
|
class IndexedObjectCollection {
|
|
207
205
|
constructor(id, items = []) {
|
|
@@ -216,9 +214,6 @@ class IndexedObjectCollection {
|
|
|
216
214
|
get length() {
|
|
217
215
|
return this._items.length;
|
|
218
216
|
}
|
|
219
|
-
get mutationCounter() {
|
|
220
|
-
return this._items.mutationCounter;
|
|
221
|
-
}
|
|
222
217
|
set(...items) {
|
|
223
218
|
this._items.set(...items.map(item => [this.getId(item), item]));
|
|
224
219
|
}
|
|
@@ -249,6 +244,11 @@ class IndexedObjectCollection {
|
|
|
249
244
|
}
|
|
250
245
|
return result;
|
|
251
246
|
}
|
|
247
|
+
shallowCopy() {
|
|
248
|
+
const copy = new IndexedObjectCollection(this.id);
|
|
249
|
+
copy._items = this._items;
|
|
250
|
+
return copy;
|
|
251
|
+
}
|
|
252
252
|
getId(item) {
|
|
253
253
|
return typeof this.id === 'function' ? this.id(item) : item[this.id];
|
|
254
254
|
}
|
|
@@ -285,6 +285,12 @@ class ObservableIndexedCollection extends IndexedCollection {
|
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
+
shallowCopy() {
|
|
289
|
+
const copy = new ObservableIndexedCollection();
|
|
290
|
+
copy.eventTarget = this.eventTarget;
|
|
291
|
+
copy._items = this._items;
|
|
292
|
+
return copy;
|
|
293
|
+
}
|
|
288
294
|
on(eventName, handler) {
|
|
289
295
|
this.eventTarget.on(eventName, handler);
|
|
290
296
|
return this;
|
|
@@ -331,6 +337,12 @@ class ObservableIndexedObjectCollection extends IndexedObjectCollection {
|
|
|
331
337
|
});
|
|
332
338
|
}
|
|
333
339
|
}
|
|
340
|
+
shallowCopy() {
|
|
341
|
+
const copy = new ObservableIndexedObjectCollection(this.id);
|
|
342
|
+
copy.eventTarget = this.eventTarget;
|
|
343
|
+
copy._items = this._items;
|
|
344
|
+
return copy;
|
|
345
|
+
}
|
|
334
346
|
on(eventName, handler) {
|
|
335
347
|
this.eventTarget.on(eventName, handler);
|
|
336
348
|
return this;
|
|
@@ -416,9 +428,9 @@ class TraversableRemoteCollection extends ObservableIndexedObjectCollection {
|
|
|
416
428
|
* Null for unlimited.
|
|
417
429
|
*/
|
|
418
430
|
TopicHistoryWindow_defineProperty(this, "limit", 50);
|
|
431
|
+
TopicHistoryWindow_defineProperty(this, "oldestId", null);
|
|
419
432
|
TopicHistoryWindow_defineProperty(this, "currentState", WindowState.LIVE);
|
|
420
433
|
TopicHistoryWindow_defineProperty(this, "fetchingState", undefined);
|
|
421
|
-
TopicHistoryWindow_defineProperty(this, "oldestId", null);
|
|
422
434
|
}
|
|
423
435
|
/**
|
|
424
436
|
* Current mode od collection window. To change mode, call one of available fetch methods.
|
|
@@ -540,6 +552,15 @@ class TopicHistoryWindow extends TraversableRemoteCollection {
|
|
|
540
552
|
this.tracker.client.on('Session', ev => this.handleSession(ev));
|
|
541
553
|
this.tracker.client.on('NewMessage', ev => this.handleNewMessage(ev));
|
|
542
554
|
}
|
|
555
|
+
shallowCopy() {
|
|
556
|
+
const copy = new TopicHistoryWindow(this.roomId, this.topicId, this.tracker);
|
|
557
|
+
copy._items = this._items;
|
|
558
|
+
copy.limit = this.limit;
|
|
559
|
+
copy.currentState = this.currentState;
|
|
560
|
+
copy.fetchingState = this.fetchingState;
|
|
561
|
+
copy.oldestId = this.oldestId;
|
|
562
|
+
return copy;
|
|
563
|
+
}
|
|
543
564
|
get isTraverseLocked() {
|
|
544
565
|
return this.traverseLock;
|
|
545
566
|
}
|