polfan-server-js-client 0.2.49 → 0.2.50
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 +34 -32
- package/build/index.cjs.js +66 -2
- 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/AbstractChatClient.d.ts +2 -1
- package/build/types/state-tracker/RoomMessagesHistory.d.ts +2 -0
- package/build/types/state-tracker/SpacesManager.d.ts +1 -0
- package/build/types/state-tracker/TopicHistoryWindow.d.ts +6 -0
- package/build/types/types/src/index.d.ts +2 -1
- package/build/types/types/src/schemes/events/RoomSummaryUpdated.d.ts +7 -0
- package/package.json +1 -1
- package/src/AbstractChatClient.ts +17 -2
- package/src/state-tracker/RoomMessagesHistory.ts +20 -3
- package/src/state-tracker/SpacesManager.ts +28 -1
- package/src/state-tracker/TopicHistoryWindow.ts +35 -0
- package/src/types/src/index.ts +2 -0
- package/src/types/src/schemes/events/RoomSummaryUpdated.ts +8 -0
package/.idea/workspace.xml
CHANGED
|
@@ -4,8 +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$/
|
|
7
|
+
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="RoomSummaryUpdated event support">
|
|
8
|
+
<change beforePath="$PROJECT_DIR$/src/state-tracker/RoomMessagesHistory.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/RoomMessagesHistory.ts" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/state-tracker/TopicHistoryWindow.ts" afterDir="false" />
|
|
9
10
|
</list>
|
|
10
11
|
<option name="SHOW_DIALOG" value="false" />
|
|
11
12
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -123,31 +124,8 @@
|
|
|
123
124
|
<workItem from="1752834023436" duration="2601000" />
|
|
124
125
|
<workItem from="1753062168800" duration="4938000" />
|
|
125
126
|
<workItem from="1753441064452" duration="1184000" />
|
|
126
|
-
<workItem from="1753954931871" duration="
|
|
127
|
-
|
|
128
|
-
<task id="LOCAL-00004" summary="Emoticons support">
|
|
129
|
-
<option name="closed" value="true" />
|
|
130
|
-
<created>1738002764971</created>
|
|
131
|
-
<option name="number" value="00004" />
|
|
132
|
-
<option name="presentableId" value="LOCAL-00004" />
|
|
133
|
-
<option name="project" value="LOCAL" />
|
|
134
|
-
<updated>1738002764971</updated>
|
|
135
|
-
</task>
|
|
136
|
-
<task id="LOCAL-00005" summary="Emoticons support">
|
|
137
|
-
<option name="closed" value="true" />
|
|
138
|
-
<created>1738002769540</created>
|
|
139
|
-
<option name="number" value="00005" />
|
|
140
|
-
<option name="presentableId" value="LOCAL-00005" />
|
|
141
|
-
<option name="project" value="LOCAL" />
|
|
142
|
-
<updated>1738002769540</updated>
|
|
143
|
-
</task>
|
|
144
|
-
<task id="LOCAL-00006" summary="Emoticons support">
|
|
145
|
-
<option name="closed" value="true" />
|
|
146
|
-
<created>1738002772620</created>
|
|
147
|
-
<option name="number" value="00006" />
|
|
148
|
-
<option name="presentableId" value="LOCAL-00006" />
|
|
149
|
-
<option name="project" value="LOCAL" />
|
|
150
|
-
<updated>1738002772620</updated>
|
|
127
|
+
<workItem from="1753954931871" duration="14805000" />
|
|
128
|
+
<workItem from="1754567895893" duration="4461000" />
|
|
151
129
|
</task>
|
|
152
130
|
<task id="LOCAL-00007" summary="Emoticons support">
|
|
153
131
|
<option name="closed" value="true" />
|
|
@@ -517,7 +495,31 @@
|
|
|
517
495
|
<option name="project" value="LOCAL" />
|
|
518
496
|
<updated>1754249755333</updated>
|
|
519
497
|
</task>
|
|
520
|
-
<
|
|
498
|
+
<task id="LOCAL-00053" summary="New member count field in RoomSummary">
|
|
499
|
+
<option name="closed" value="true" />
|
|
500
|
+
<created>1754319172537</created>
|
|
501
|
+
<option name="number" value="00053" />
|
|
502
|
+
<option name="presentableId" value="LOCAL-00053" />
|
|
503
|
+
<option name="project" value="LOCAL" />
|
|
504
|
+
<updated>1754319172537</updated>
|
|
505
|
+
</task>
|
|
506
|
+
<task id="LOCAL-00054" summary="Version bump">
|
|
507
|
+
<option name="closed" value="true" />
|
|
508
|
+
<created>1754567912510</created>
|
|
509
|
+
<option name="number" value="00054" />
|
|
510
|
+
<option name="presentableId" value="LOCAL-00054" />
|
|
511
|
+
<option name="project" value="LOCAL" />
|
|
512
|
+
<updated>1754567912510</updated>
|
|
513
|
+
</task>
|
|
514
|
+
<task id="LOCAL-00055" summary="RoomSummaryUpdated event support">
|
|
515
|
+
<option name="closed" value="true" />
|
|
516
|
+
<created>1754568882637</created>
|
|
517
|
+
<option name="number" value="00055" />
|
|
518
|
+
<option name="presentableId" value="LOCAL-00055" />
|
|
519
|
+
<option name="project" value="LOCAL" />
|
|
520
|
+
<updated>1754568882638</updated>
|
|
521
|
+
</task>
|
|
522
|
+
<option name="localTasksCounter" value="56" />
|
|
521
523
|
<servers />
|
|
522
524
|
</component>
|
|
523
525
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -535,9 +537,6 @@
|
|
|
535
537
|
</option>
|
|
536
538
|
</component>
|
|
537
539
|
<component name="VcsManagerConfiguration">
|
|
538
|
-
<MESSAGE value="New scheme of Bye event" />
|
|
539
|
-
<MESSAGE value="Fix authentication" />
|
|
540
|
-
<MESSAGE value="Add notify option to Kick command" />
|
|
541
540
|
<MESSAGE value="UsersManager" />
|
|
542
541
|
<MESSAGE value="Client data and room stream support" />
|
|
543
542
|
<MESSAGE value="New collections mutationCounter property and map method remove" />
|
|
@@ -560,6 +559,9 @@
|
|
|
560
559
|
<MESSAGE value="Fix a relationship type" />
|
|
561
560
|
<MESSAGE value="Fix mutationCounter doesn't increment on delete" />
|
|
562
561
|
<MESSAGE value="Changes in chat protocol and schemes" />
|
|
563
|
-
<
|
|
562
|
+
<MESSAGE value="New member count field in RoomSummary" />
|
|
563
|
+
<MESSAGE value="Version bump" />
|
|
564
|
+
<MESSAGE value="RoomSummaryUpdated event support" />
|
|
565
|
+
<option name="LAST_COMMIT_MESSAGE" value="RoomSummaryUpdated event support" />
|
|
564
566
|
</component>
|
|
565
567
|
</project>
|
package/build/index.cjs.js
CHANGED
|
@@ -536,9 +536,37 @@ class TopicHistoryWindow extends TraversableRemoteCollection {
|
|
|
536
536
|
* Reexported available window modes enum.
|
|
537
537
|
*/
|
|
538
538
|
TopicHistoryWindow_defineProperty(this, "WindowState", WindowState);
|
|
539
|
+
TopicHistoryWindow_defineProperty(this, "traverseLock", false);
|
|
539
540
|
this.tracker.client.on('Session', ev => this.handleSession(ev));
|
|
540
541
|
this.tracker.client.on('NewMessage', ev => this.handleNewMessage(ev));
|
|
541
542
|
}
|
|
543
|
+
get isTraverseLocked() {
|
|
544
|
+
return this.traverseLock;
|
|
545
|
+
}
|
|
546
|
+
async setTraverseLock(lock) {
|
|
547
|
+
this.traverseLock = lock;
|
|
548
|
+
if (lock && this.state !== WindowState.LIVE && this.state !== WindowState.LATEST) {
|
|
549
|
+
await super.resetToLatest();
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
async resetToLatest() {
|
|
553
|
+
if (this.traverseLock) {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
return super.resetToLatest();
|
|
557
|
+
}
|
|
558
|
+
async fetchNext() {
|
|
559
|
+
if (this.traverseLock) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
return super.fetchNext();
|
|
563
|
+
}
|
|
564
|
+
async fetchPrevious() {
|
|
565
|
+
if (this.traverseLock) {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
return super.fetchPrevious();
|
|
569
|
+
}
|
|
542
570
|
|
|
543
571
|
/**
|
|
544
572
|
* For internal use.
|
|
@@ -637,9 +665,11 @@ class RoomMessagesHistory {
|
|
|
637
665
|
this.room = room;
|
|
638
666
|
this.tracker = tracker;
|
|
639
667
|
RoomMessagesHistory_defineProperty(this, "historyWindows", new IndexedCollection());
|
|
668
|
+
RoomMessagesHistory_defineProperty(this, "traverseLock", false);
|
|
640
669
|
this.tracker.client.on('RoomUpdated', ev => this.handleRoomUpdated(ev));
|
|
641
670
|
this.tracker.client.on('NewTopic', ev => this.handleNewTopic(ev));
|
|
642
671
|
this.tracker.client.on('TopicDeleted', ev => this.handleTopicDeleted(ev));
|
|
672
|
+
this.updateTraverseLock(this.room);
|
|
643
673
|
if (this.room.defaultTopic) {
|
|
644
674
|
this.createHistoryWindowForTopic(this.room.defaultTopic);
|
|
645
675
|
}
|
|
@@ -658,12 +688,16 @@ class RoomMessagesHistory {
|
|
|
658
688
|
}
|
|
659
689
|
return this.historyWindows.get(topicId);
|
|
660
690
|
}
|
|
661
|
-
handleRoomUpdated(ev) {
|
|
691
|
+
async handleRoomUpdated(ev) {
|
|
662
692
|
if (this.room.id === ev.room.id) {
|
|
663
693
|
this.room = ev.room;
|
|
694
|
+
this.updateTraverseLock(ev.room);
|
|
664
695
|
if (ev.room.defaultTopic) {
|
|
665
696
|
this.createHistoryWindowForTopic(ev.room.defaultTopic);
|
|
666
697
|
}
|
|
698
|
+
for (const [, window] of Array.from(this.historyWindows.items)) {
|
|
699
|
+
await window.setTraverseLock(this.traverseLock);
|
|
700
|
+
}
|
|
667
701
|
}
|
|
668
702
|
}
|
|
669
703
|
handleNewTopic(ev) {
|
|
@@ -680,7 +714,9 @@ class RoomMessagesHistory {
|
|
|
680
714
|
if (this.historyWindows.has(topic.id)) {
|
|
681
715
|
return;
|
|
682
716
|
}
|
|
683
|
-
|
|
717
|
+
const historyWindow = new TopicHistoryWindow(this.room.id, topic.id, this.tracker);
|
|
718
|
+
historyWindow.setTraverseLock(this.traverseLock);
|
|
719
|
+
this.historyWindows.set([topic.id, historyWindow]);
|
|
684
720
|
|
|
685
721
|
// If new topic refers to some message from this room, update other structures
|
|
686
722
|
if (topic.refMessage) {
|
|
@@ -688,6 +724,9 @@ class RoomMessagesHistory {
|
|
|
688
724
|
refHistoryWindow?._updateMessageReference(topic);
|
|
689
725
|
}
|
|
690
726
|
}
|
|
727
|
+
updateTraverseLock(room) {
|
|
728
|
+
this.traverseLock = room.history.mode === 'Ephemeral';
|
|
729
|
+
}
|
|
691
730
|
}
|
|
692
731
|
;// CONCATENATED MODULE: ./src/state-tracker/MessagesManager.ts
|
|
693
732
|
function MessagesManager_defineProperty(obj, key, value) { key = MessagesManager_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -1254,6 +1293,7 @@ class SpacesManager {
|
|
|
1254
1293
|
this.tracker.client.on('SpaceMemberLeft', ev => this.handleSpaceMemberLeft(ev));
|
|
1255
1294
|
this.tracker.client.on('SpaceMembers', ev => this.handleSpaceMembers(ev));
|
|
1256
1295
|
this.tracker.client.on('SpaceRooms', ev => this.handleSpaceRooms(ev));
|
|
1296
|
+
this.tracker.client.on('RoomSummaryUpdated', ev => this.handleRoomSummaryUpdated(ev));
|
|
1257
1297
|
this.tracker.client.on('SpaceMemberUpdated', ev => this.handleSpaceMemberUpdated(ev));
|
|
1258
1298
|
this.tracker.client.on('UserUpdated', ev => this.handleUserUpdated(ev));
|
|
1259
1299
|
this.tracker.client.on('NewRole', ev => this.handleNewRole(ev));
|
|
@@ -1414,6 +1454,30 @@ class SpacesManager {
|
|
|
1414
1454
|
ev.summaries.forEach(summary => this.roomIdToSpaceId.set([summary.id, ev.id]));
|
|
1415
1455
|
}
|
|
1416
1456
|
}
|
|
1457
|
+
async handleRoomSummaryUpdated(ev) {
|
|
1458
|
+
const spaceId = this.roomIdToSpaceId.get(ev.summary.id);
|
|
1459
|
+
const summariesPromise = this.roomsPromises.get(spaceId);
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Update summary only if the list was already loaded.
|
|
1463
|
+
* RoomSummaryUpdated event has a partial summary, so we need to update the existing summary by merging it.
|
|
1464
|
+
*/
|
|
1465
|
+
if (spaceId && summariesPromise) {
|
|
1466
|
+
await summariesPromise;
|
|
1467
|
+
const summaries = this.rooms.get(spaceId);
|
|
1468
|
+
const oldSummary = summaries.get(ev.summary.id);
|
|
1469
|
+
let newSummary;
|
|
1470
|
+
if (oldSummary) {
|
|
1471
|
+
newSummary = {
|
|
1472
|
+
...oldSummary,
|
|
1473
|
+
...ev.summary
|
|
1474
|
+
};
|
|
1475
|
+
} else {
|
|
1476
|
+
newSummary = ev.summary;
|
|
1477
|
+
}
|
|
1478
|
+
summaries.set(newSummary);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1417
1481
|
handleSpaceMemberUpdated(ev) {
|
|
1418
1482
|
if (this.members.has(ev.spaceId)) {
|
|
1419
1483
|
const members = this.members.get(ev.spaceId);
|