polfan-server-js-client 0.2.49 → 0.2.51
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 +73 -65
- 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/src/types/src/schemes/events/Session.ts +1 -0
package/.idea/workspace.xml
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
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="
|
|
7
|
+
<list default="true" id="831dae43-0da1-47fd-a5f7-33dd5eec2992" name="Changes" comment="Ephemeral room history support">
|
|
8
8
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/src/types" beforeDir="false" afterPath="$PROJECT_DIR$/src/types" afterDir="false" />
|
|
10
|
+
<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" />
|
|
9
11
|
</list>
|
|
10
12
|
<option name="SHOW_DIALOG" value="false" />
|
|
11
13
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -48,24 +50,24 @@
|
|
|
48
50
|
<option name="hideEmptyMiddlePackages" value="true" />
|
|
49
51
|
<option name="showLibraryContents" value="true" />
|
|
50
52
|
</component>
|
|
51
|
-
<component name="PropertiesComponent"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
<component name="PropertiesComponent">{
|
|
54
|
+
"keyToString": {
|
|
55
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
56
|
+
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
|
|
57
|
+
"RunOnceActivity.git.unshallow": "true",
|
|
58
|
+
"git-widget-placeholder": "master",
|
|
59
|
+
"ignore.virus.scanning.warn.message": "true",
|
|
60
|
+
"junie.onboarding.icon.badge.shown": "true",
|
|
61
|
+
"last_opened_file_path": "//wsl.localhost/Debian/home/jarek/polfan-js-client-library",
|
|
62
|
+
"node.js.detected.package.eslint": "true",
|
|
63
|
+
"node.js.detected.package.tslint": "true",
|
|
64
|
+
"node.js.selected.package.eslint": "(autodetect)",
|
|
65
|
+
"node.js.selected.package.tslint": "(autodetect)",
|
|
66
|
+
"nodejs_package_manager_path": "npm",
|
|
67
|
+
"ts.external.directory.path": "\\\\wsl.localhost\\Debian\\home\\jarek\\polfan-js-client-library\\node_modules\\typescript\\lib",
|
|
68
|
+
"vue.rearranger.settings.migration": "true"
|
|
67
69
|
}
|
|
68
|
-
}
|
|
70
|
+
}</component>
|
|
69
71
|
<component name="SharedIndexes">
|
|
70
72
|
<attachedChunks>
|
|
71
73
|
<set>
|
|
@@ -123,47 +125,13 @@
|
|
|
123
125
|
<workItem from="1752834023436" duration="2601000" />
|
|
124
126
|
<workItem from="1753062168800" duration="4938000" />
|
|
125
127
|
<workItem from="1753441064452" duration="1184000" />
|
|
126
|
-
<workItem from="1753954931871" duration="
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<
|
|
130
|
-
<
|
|
131
|
-
<
|
|
132
|
-
<
|
|
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>
|
|
151
|
-
</task>
|
|
152
|
-
<task id="LOCAL-00007" summary="Emoticons support">
|
|
153
|
-
<option name="closed" value="true" />
|
|
154
|
-
<created>1738002786100</created>
|
|
155
|
-
<option name="number" value="00007" />
|
|
156
|
-
<option name="presentableId" value="LOCAL-00007" />
|
|
157
|
-
<option name="project" value="LOCAL" />
|
|
158
|
-
<updated>1738002786100</updated>
|
|
159
|
-
</task>
|
|
160
|
-
<task id="LOCAL-00008" summary="Emoticons support">
|
|
161
|
-
<option name="closed" value="true" />
|
|
162
|
-
<created>1738002805203</created>
|
|
163
|
-
<option name="number" value="00008" />
|
|
164
|
-
<option name="presentableId" value="LOCAL-00008" />
|
|
165
|
-
<option name="project" value="LOCAL" />
|
|
166
|
-
<updated>1738002805203</updated>
|
|
128
|
+
<workItem from="1753954931871" duration="14805000" />
|
|
129
|
+
<workItem from="1754567895893" duration="6715000" />
|
|
130
|
+
<workItem from="1755450616809" duration="66000" />
|
|
131
|
+
<workItem from="1755452202060" duration="1749000" />
|
|
132
|
+
<workItem from="1755600989345" duration="1221000" />
|
|
133
|
+
<workItem from="1755609872522" duration="1114000" />
|
|
134
|
+
<workItem from="1756051973155" duration="643000" />
|
|
167
135
|
</task>
|
|
168
136
|
<task id="LOCAL-00009" summary="Emoticons support">
|
|
169
137
|
<option name="closed" value="true" />
|
|
@@ -517,7 +485,47 @@
|
|
|
517
485
|
<option name="project" value="LOCAL" />
|
|
518
486
|
<updated>1754249755333</updated>
|
|
519
487
|
</task>
|
|
520
|
-
<
|
|
488
|
+
<task id="LOCAL-00053" summary="New member count field in RoomSummary">
|
|
489
|
+
<option name="closed" value="true" />
|
|
490
|
+
<created>1754319172537</created>
|
|
491
|
+
<option name="number" value="00053" />
|
|
492
|
+
<option name="presentableId" value="LOCAL-00053" />
|
|
493
|
+
<option name="project" value="LOCAL" />
|
|
494
|
+
<updated>1754319172537</updated>
|
|
495
|
+
</task>
|
|
496
|
+
<task id="LOCAL-00054" summary="Version bump">
|
|
497
|
+
<option name="closed" value="true" />
|
|
498
|
+
<created>1754567912510</created>
|
|
499
|
+
<option name="number" value="00054" />
|
|
500
|
+
<option name="presentableId" value="LOCAL-00054" />
|
|
501
|
+
<option name="project" value="LOCAL" />
|
|
502
|
+
<updated>1754567912510</updated>
|
|
503
|
+
</task>
|
|
504
|
+
<task id="LOCAL-00055" summary="RoomSummaryUpdated event support">
|
|
505
|
+
<option name="closed" value="true" />
|
|
506
|
+
<created>1754568882637</created>
|
|
507
|
+
<option name="number" value="00055" />
|
|
508
|
+
<option name="presentableId" value="LOCAL-00055" />
|
|
509
|
+
<option name="project" value="LOCAL" />
|
|
510
|
+
<updated>1754568882638</updated>
|
|
511
|
+
</task>
|
|
512
|
+
<task id="LOCAL-00056" summary="Ephemeral room history support">
|
|
513
|
+
<option name="closed" value="true" />
|
|
514
|
+
<created>1754573943778</created>
|
|
515
|
+
<option name="number" value="00056" />
|
|
516
|
+
<option name="presentableId" value="LOCAL-00056" />
|
|
517
|
+
<option name="project" value="LOCAL" />
|
|
518
|
+
<updated>1754573943778</updated>
|
|
519
|
+
</task>
|
|
520
|
+
<task id="LOCAL-00057" summary="Ephemeral room history support">
|
|
521
|
+
<option name="closed" value="true" />
|
|
522
|
+
<created>1756051989192</created>
|
|
523
|
+
<option name="number" value="00057" />
|
|
524
|
+
<option name="presentableId" value="LOCAL-00057" />
|
|
525
|
+
<option name="project" value="LOCAL" />
|
|
526
|
+
<updated>1756051989192</updated>
|
|
527
|
+
</task>
|
|
528
|
+
<option name="localTasksCounter" value="58" />
|
|
521
529
|
<servers />
|
|
522
530
|
</component>
|
|
523
531
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -535,10 +543,6 @@
|
|
|
535
543
|
</option>
|
|
536
544
|
</component>
|
|
537
545
|
<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
|
-
<MESSAGE value="UsersManager" />
|
|
542
546
|
<MESSAGE value="Client data and room stream support" />
|
|
543
547
|
<MESSAGE value="New collections mutationCounter property and map method remove" />
|
|
544
548
|
<MESSAGE value="Private rooms and space summaries" />
|
|
@@ -560,6 +564,10 @@
|
|
|
560
564
|
<MESSAGE value="Fix a relationship type" />
|
|
561
565
|
<MESSAGE value="Fix mutationCounter doesn't increment on delete" />
|
|
562
566
|
<MESSAGE value="Changes in chat protocol and schemes" />
|
|
563
|
-
<
|
|
567
|
+
<MESSAGE value="New member count field in RoomSummary" />
|
|
568
|
+
<MESSAGE value="Version bump" />
|
|
569
|
+
<MESSAGE value="RoomSummaryUpdated event support" />
|
|
570
|
+
<MESSAGE value="Ephemeral room history support" />
|
|
571
|
+
<option name="LAST_COMMIT_MESSAGE" value="Ephemeral room history support" />
|
|
564
572
|
</component>
|
|
565
573
|
</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);
|