polfan-server-js-client 0.2.2 → 0.2.6
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/copilot.data.migration.agent.xml +6 -0
- package/.idea/copilot.data.migration.ask.xml +6 -0
- package/.idea/copilot.data.migration.ask2agent.xml +6 -0
- package/.idea/copilot.data.migration.edit.xml +6 -0
- package/.idea/workspace.xml +376 -135
- package/babel.config.js +4 -5
- package/build/index.cjs.js +4538 -1816
- 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 +12 -2
- package/build/types/FilesClient.d.ts +7 -6
- package/build/types/IndexedObjectCollection.d.ts +4 -3
- package/build/types/Permissions.d.ts +4 -0
- package/build/types/WebSocketChatClient.d.ts +2 -0
- package/build/types/state-tracker/ChatStateTracker.d.ts +5 -0
- package/build/types/state-tracker/RelationshipsManager.d.ts +15 -0
- 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 +23 -5
- package/build/types/state-tracker/UsersManager.d.ts +3 -1
- package/build/types/types/src/index.d.ts +12 -3
- package/build/types/types/src/schemes/Emoticon.d.ts +1 -0
- package/build/types/types/src/schemes/Message.d.ts +1 -1
- package/build/types/types/src/schemes/Room.d.ts +2 -0
- package/build/types/types/src/schemes/RoomHistory.d.ts +5 -0
- package/build/types/types/src/schemes/RoomSummary.d.ts +1 -0
- package/build/types/types/src/schemes/SpaceSummary.d.ts +1 -0
- package/build/types/types/src/schemes/User.d.ts +2 -2
- package/build/types/types/src/schemes/UserRelationship.d.ts +6 -0
- package/build/types/types/src/schemes/commands/CreateMessage.d.ts +2 -0
- package/build/types/types/src/schemes/commands/CreateRelationship.d.ts +5 -0
- package/build/types/types/src/schemes/commands/CreateTopic.d.ts +5 -2
- package/build/types/types/src/schemes/commands/DeleteRelationship.d.ts +5 -0
- package/build/types/types/src/schemes/commands/GetRelationships.d.ts +2 -0
- package/build/types/types/src/schemes/commands/UpdateRoom.d.ts +2 -0
- package/build/types/types/src/schemes/commands/UpdateRoomMember.d.ts +7 -0
- package/build/types/types/src/schemes/commands/UpdateSpaceMember.d.ts +5 -0
- package/build/types/types/src/schemes/events/NewRelationship.d.ts +4 -0
- package/build/types/types/src/schemes/events/RelationshipDeleted.d.ts +4 -0
- package/build/types/types/src/schemes/events/Relationships.d.ts +4 -0
- package/build/types/types/src/schemes/events/RoomSummaryUpdated.d.ts +7 -0
- package/build/types/types/src/schemes/events/Session.d.ts +1 -0
- package/package.json +15 -30
- package/src/AbstractChatClient.ts +28 -4
- package/src/FilesClient.ts +26 -13
- package/src/IndexedObjectCollection.ts +26 -10
- package/src/Permissions.ts +1 -0
- package/src/WebSocketChatClient.ts +19 -11
- package/src/state-tracker/ChatStateTracker.ts +22 -6
- package/src/state-tracker/EmoticonsManager.ts +6 -4
- package/src/state-tracker/MessagesManager.ts +3 -3
- package/src/state-tracker/RelationshipsManager.ts +68 -0
- package/src/state-tracker/RoomMessagesHistory.ts +20 -3
- package/src/state-tracker/RoomsManager.ts +30 -7
- package/src/state-tracker/SpacesManager.ts +28 -1
- package/src/state-tracker/TopicHistoryWindow.ts +94 -23
- package/src/state-tracker/UsersManager.ts +16 -6
- package/src/types/src/index.ts +26 -5
- package/src/types/src/schemes/Emoticon.ts +1 -0
- package/src/types/src/schemes/Message.ts +1 -1
- package/src/types/src/schemes/Room.ts +2 -0
- package/src/types/src/schemes/RoomHistory.ts +6 -0
- package/src/types/src/schemes/RoomSummary.ts +1 -0
- package/src/types/src/schemes/SpaceSummary.ts +1 -0
- package/src/types/src/schemes/User.ts +2 -2
- package/src/types/src/schemes/UserRelationship.ts +8 -0
- package/src/types/src/schemes/commands/CreateMessage.ts +2 -0
- package/src/types/src/schemes/commands/CreateRelationship.ts +6 -0
- package/src/types/src/schemes/commands/CreateTopic.ts +6 -2
- package/src/types/src/schemes/commands/DeleteRelationship.ts +6 -0
- package/src/types/src/schemes/commands/GetRelationships.ts +3 -0
- package/src/types/src/schemes/commands/UpdateRoom.ts +2 -0
- package/src/types/src/schemes/commands/UpdateRoomMember.ts +7 -0
- package/src/types/src/schemes/commands/UpdateSpaceMember.ts +5 -0
- package/src/types/src/schemes/events/NewRelationship.ts +5 -0
- package/src/types/src/schemes/events/RelationshipDeleted.ts +5 -0
- package/src/types/src/schemes/events/Relationships.ts +5 -0
- package/src/types/src/schemes/events/RoomSummaryUpdated.ts +8 -0
- package/src/types/src/schemes/events/Session.ts +1 -0
- package/tests/history-window.test.ts +6 -1
- package/webpack.config.browser.js +2 -24
- package/webpack.config.node.js +2 -14
- package/.eslintignore +0 -0
- package/.eslintrc.json +0 -0
- package/src/types/src/schemes/commands/SetCustomNick.ts +0 -5
|
@@ -31,60 +31,80 @@ export abstract class TraversableRemoteCollection<T> extends ObservableIndexedOb
|
|
|
31
31
|
* Current mode od collection window. To change mode, call one of available fetch methods.
|
|
32
32
|
*/
|
|
33
33
|
public get state(): WindowState {
|
|
34
|
-
return this.
|
|
34
|
+
return this.internalState.current;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
protected internalState: {
|
|
38
|
+
current: WindowState,
|
|
39
|
+
ongoing?: WindowState,
|
|
40
|
+
limit: number | null,
|
|
41
|
+
oldestId: string | null,
|
|
42
|
+
} = {
|
|
43
|
+
current: WindowState.LIVE,
|
|
44
|
+
ongoing: undefined,
|
|
45
|
+
limit: 50,
|
|
46
|
+
oldestId: null,
|
|
47
|
+
};
|
|
48
|
+
|
|
37
49
|
/**
|
|
38
50
|
* Maximum numer of items stored in window.
|
|
39
51
|
* Null for unlimited.
|
|
40
52
|
*/
|
|
41
|
-
public limit: number | null
|
|
53
|
+
public get limit(): number | null {
|
|
54
|
+
return this.internalState.limit;
|
|
55
|
+
}
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Maximum numer of items stored in window.
|
|
59
|
+
* Null for unlimited.
|
|
60
|
+
*/
|
|
61
|
+
public set limit(value: number | null) {
|
|
62
|
+
this.internalState.limit = value;
|
|
63
|
+
}
|
|
46
64
|
|
|
47
65
|
public get hasLatest(): boolean {
|
|
48
66
|
return [WindowState.LATEST, WindowState.LIVE].includes(this.state);
|
|
49
67
|
}
|
|
50
68
|
|
|
51
69
|
public get hasOldest(): boolean {
|
|
52
|
-
return this.state === WindowState.OLDEST || this.oldestId !== null && this.has(this.oldestId);
|
|
70
|
+
return this.state === WindowState.OLDEST || this.internalState.oldestId !== null && this.has(this.internalState.oldestId);
|
|
53
71
|
}
|
|
54
72
|
|
|
73
|
+
public abstract createMirror(): TraversableRemoteCollection<T>;
|
|
74
|
+
|
|
55
75
|
public async resetToLatest(): Promise<void> {
|
|
56
|
-
if (this.
|
|
76
|
+
if (this.internalState.ongoing || this.internalState.current === WindowState.LATEST) {
|
|
57
77
|
return;
|
|
58
78
|
}
|
|
59
79
|
|
|
60
|
-
this.
|
|
80
|
+
this.internalState.ongoing = WindowState.LATEST;
|
|
61
81
|
|
|
62
82
|
let result;
|
|
63
83
|
|
|
64
84
|
try {
|
|
65
85
|
result = await this.fetchLatestItems();
|
|
66
86
|
} finally {
|
|
67
|
-
this.
|
|
87
|
+
this.internalState.ongoing = undefined;
|
|
68
88
|
}
|
|
69
89
|
|
|
70
90
|
this.deleteAll();
|
|
71
91
|
this.addItems(result, 'tail');
|
|
72
|
-
this.
|
|
92
|
+
this.internalState.current = WindowState.LATEST;
|
|
73
93
|
}
|
|
74
94
|
|
|
75
95
|
public async fetchPrevious(): Promise<void> {
|
|
76
|
-
if (this.
|
|
96
|
+
if (this.internalState.ongoing || this.hasOldest) {
|
|
77
97
|
return;
|
|
78
98
|
}
|
|
79
99
|
|
|
80
|
-
this.
|
|
100
|
+
this.internalState.ongoing = WindowState.PAST;
|
|
81
101
|
|
|
82
102
|
let result;
|
|
83
103
|
|
|
84
104
|
try {
|
|
85
105
|
result = await this.fetchItemsBefore();
|
|
86
106
|
} finally {
|
|
87
|
-
this.
|
|
107
|
+
this.internalState.ongoing = undefined;
|
|
88
108
|
}
|
|
89
109
|
|
|
90
110
|
if (! result) {
|
|
@@ -93,13 +113,13 @@ export abstract class TraversableRemoteCollection<T> extends ObservableIndexedOb
|
|
|
93
113
|
|
|
94
114
|
if (! result.length) {
|
|
95
115
|
const firstItem = this.getAt(0);
|
|
96
|
-
this.oldestId = firstItem ? this.getId(firstItem) : null;
|
|
116
|
+
this.internalState.oldestId = firstItem ? this.getId(firstItem) : null;
|
|
97
117
|
|
|
98
118
|
await this.refreshFetchedState();
|
|
99
119
|
|
|
100
120
|
// LATEST state has priority over OLDEST
|
|
101
|
-
if (this.
|
|
102
|
-
this.
|
|
121
|
+
if (this.internalState.current === WindowState.PAST) {
|
|
122
|
+
this.internalState.current = WindowState.OLDEST;
|
|
103
123
|
}
|
|
104
124
|
|
|
105
125
|
return;
|
|
@@ -110,18 +130,18 @@ export abstract class TraversableRemoteCollection<T> extends ObservableIndexedOb
|
|
|
110
130
|
}
|
|
111
131
|
|
|
112
132
|
public async fetchNext(): Promise<void> {
|
|
113
|
-
if (this.
|
|
133
|
+
if (this.internalState.ongoing || this.hasLatest) {
|
|
114
134
|
return;
|
|
115
135
|
}
|
|
116
136
|
|
|
117
|
-
this.
|
|
137
|
+
this.internalState.ongoing = WindowState.PAST;
|
|
118
138
|
|
|
119
139
|
let result;
|
|
120
140
|
|
|
121
141
|
try {
|
|
122
142
|
result = await this.fetchItemsAfter();
|
|
123
143
|
} finally {
|
|
124
|
-
this.
|
|
144
|
+
this.internalState.ongoing = undefined;
|
|
125
145
|
}
|
|
126
146
|
|
|
127
147
|
if (! result) {
|
|
@@ -145,7 +165,7 @@ export abstract class TraversableRemoteCollection<T> extends ObservableIndexedOb
|
|
|
145
165
|
protected abstract isLatestItemLoaded(): Promise<boolean>;
|
|
146
166
|
|
|
147
167
|
protected async refreshFetchedState(): Promise<void> {
|
|
148
|
-
this.
|
|
168
|
+
this.internalState.current = (await this.isLatestItemLoaded()) ? WindowState.LATEST : WindowState.PAST;
|
|
149
169
|
}
|
|
150
170
|
|
|
151
171
|
protected addItems(newItems: T[], to: 'head' | 'tail'): void {
|
|
@@ -187,14 +207,65 @@ export class TopicHistoryWindow extends TraversableRemoteCollection<Message> {
|
|
|
187
207
|
*/
|
|
188
208
|
public readonly WindowState: typeof WindowState = WindowState;
|
|
189
209
|
|
|
210
|
+
declare protected internalState: typeof TraversableRemoteCollection<Message>['prototype']['internalState'] & {
|
|
211
|
+
traverseLock: boolean,
|
|
212
|
+
};
|
|
213
|
+
|
|
190
214
|
public constructor(
|
|
191
215
|
private roomId: string,
|
|
192
216
|
private topicId: string,
|
|
193
217
|
private tracker: ChatStateTracker,
|
|
218
|
+
bindEvents: boolean = true,
|
|
194
219
|
) {
|
|
195
220
|
super('id');
|
|
196
|
-
|
|
197
|
-
this.
|
|
221
|
+
|
|
222
|
+
this.internalState.traverseLock = false;
|
|
223
|
+
|
|
224
|
+
if (bindEvents) {
|
|
225
|
+
this.tracker.client.on('Session', ev => this.handleSession(ev));
|
|
226
|
+
this.tracker.client.on('NewMessage', ev => this.handleNewMessage(ev));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
public createMirror(): TopicHistoryWindow {
|
|
231
|
+
const copy = new TopicHistoryWindow(this.roomId, this.topicId, this.tracker, false);
|
|
232
|
+
copy.eventTarget = this.eventTarget;
|
|
233
|
+
copy._items = this._items;
|
|
234
|
+
copy.internalState = this.internalState;
|
|
235
|
+
return copy;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
public get isTraverseLocked(): boolean {
|
|
239
|
+
return this.internalState.traverseLock;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
public async setTraverseLock(lock: boolean): Promise<void> {
|
|
243
|
+
this.internalState.traverseLock = lock;
|
|
244
|
+
|
|
245
|
+
if (lock && (this.state !== WindowState.LIVE && this.state !== WindowState.LATEST)) {
|
|
246
|
+
await super.resetToLatest();
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
public async resetToLatest(): Promise<void> {
|
|
251
|
+
if (this.internalState.traverseLock) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
return super.resetToLatest();
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public async fetchNext(): Promise<void> {
|
|
258
|
+
if (this.internalState.traverseLock) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
return super.fetchNext();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
public async fetchPrevious(): Promise<void> {
|
|
265
|
+
if (this.internalState.traverseLock) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
return super.fetchPrevious();
|
|
198
269
|
}
|
|
199
270
|
|
|
200
271
|
/**
|
|
@@ -224,7 +295,7 @@ export class TopicHistoryWindow extends TraversableRemoteCollection<Message> {
|
|
|
224
295
|
const rooms = ev.state.rooms;
|
|
225
296
|
|
|
226
297
|
if (rooms.find(room => room.id === this.roomId)) {
|
|
227
|
-
this.resetToLatest();
|
|
298
|
+
void this.resetToLatest();
|
|
228
299
|
} else {
|
|
229
300
|
this.deleteAll();
|
|
230
301
|
}
|
|
@@ -2,8 +2,11 @@ import {ChatStateTracker} from "./ChatStateTracker";
|
|
|
2
2
|
import {ObservableIndexedObjectCollection} from "../IndexedObjectCollection";
|
|
3
3
|
import {RoomMember, Session, SpaceMember, User} from "../types/src";
|
|
4
4
|
import {extractUserFromMember} from "./functions";
|
|
5
|
+
import {EventTarget} from "../EventTarget";
|
|
5
6
|
|
|
6
7
|
export class UsersManager {
|
|
8
|
+
public readonly onlineStatus = new EventTarget();
|
|
9
|
+
|
|
7
10
|
private readonly users: ObservableIndexedObjectCollection<User> = new ObservableIndexedObjectCollection('id');
|
|
8
11
|
|
|
9
12
|
public constructor(private tracker: ChatStateTracker) {
|
|
@@ -26,15 +29,22 @@ export class UsersManager {
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
private handleMembers(members: (RoomMember | SpaceMember)[]): void {
|
|
29
|
-
this.
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
private handleUsers(users: User[]): void {
|
|
33
|
-
this.users.set(...users);
|
|
32
|
+
this.handleUsers(members.map(extractUserFromMember));
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
private handleSession(session: Session): void {
|
|
37
36
|
this.users.deleteAll();
|
|
38
|
-
this.
|
|
37
|
+
this.handleUsers([session.user]);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
private handleUsers(users: User[]): void {
|
|
41
|
+
users.forEach(newUser => {
|
|
42
|
+
const oldUser = this.users.get(newUser.id);
|
|
43
|
+
if (oldUser && oldUser.online !== newUser.online) {
|
|
44
|
+
this.onlineStatus.emit('change', newUser);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
this.users.set(...users);
|
|
39
49
|
}
|
|
40
50
|
}
|
package/src/types/src/index.ts
CHANGED
|
@@ -57,7 +57,7 @@ import {LeaveRoom} from "./schemes/commands/LeaveRoom";
|
|
|
57
57
|
import {CreateRoom} from "./schemes/commands/CreateRoom";
|
|
58
58
|
import {DeleteRoom} from "./schemes/commands/DeleteRoom";
|
|
59
59
|
import {GetRoomMembers} from "./schemes/commands/GetRoomMembers";
|
|
60
|
-
import {CreateTopic} from "./schemes/commands/CreateTopic";
|
|
60
|
+
import {CreateTopic, CreateTopicInitialMessage} from "./schemes/commands/CreateTopic";
|
|
61
61
|
import {DeleteTopic} from "./schemes/commands/DeleteTopic";
|
|
62
62
|
import {CreateMessage} from "./schemes/commands/CreateMessage";
|
|
63
63
|
import {UpdateRole} from "./schemes/commands/UpdateRole";
|
|
@@ -111,12 +111,21 @@ import {GetClientData} from "./schemes/commands/GetClientData";
|
|
|
111
111
|
import {SetClientData} from "./schemes/commands/SetClientData";
|
|
112
112
|
import {ClientData} from "./schemes/events/ClientData";
|
|
113
113
|
import {RoomStream, RoomStreamType} from "./schemes/RoomStream";
|
|
114
|
+
import {RoomHistory, RoomHistoryMode} from "./schemes/RoomHistory";
|
|
114
115
|
import {GetRoomSummary} from "./schemes/commands/GetRoomSummary";
|
|
115
116
|
import {GetSpaceSummary} from "./schemes/commands/GetSpaceSummary";
|
|
116
117
|
import {SpaceFlag} from "./schemes/Space";
|
|
117
118
|
import {SpaceSummary as SpaceSummaryEvent} from "./schemes/events/SpaceSummary";
|
|
118
119
|
import {RoomSummary as RoomSummaryEvent} from "./schemes/events/RoomSummary";
|
|
119
|
-
import {
|
|
120
|
+
import {UpdateSpaceMember} from "./schemes/commands/UpdateSpaceMember";
|
|
121
|
+
import {NewRelationship} from "./schemes/events/NewRelationship";
|
|
122
|
+
import {RelationshipDeleted} from "./schemes/events/RelationshipDeleted";
|
|
123
|
+
import {UserRelationship, UserRelationshipType} from "./schemes/UserRelationship";
|
|
124
|
+
import {DeleteRelationship} from "./schemes/commands/DeleteRelationship";
|
|
125
|
+
import {Relationships} from "./schemes/events/Relationships";
|
|
126
|
+
import {CreateRelationship} from "./schemes/commands/CreateRelationship";
|
|
127
|
+
import {RoomSummaryUpdated} from "./schemes/events/RoomSummaryUpdated";
|
|
128
|
+
import {UpdateRoomMember} from "./schemes/commands/UpdateRoomMember";
|
|
120
129
|
|
|
121
130
|
export {
|
|
122
131
|
// objects
|
|
@@ -128,6 +137,10 @@ export {
|
|
|
128
137
|
Room,
|
|
129
138
|
RoomFlag,
|
|
130
139
|
RoomType,
|
|
140
|
+
RoomStream,
|
|
141
|
+
RoomStreamType,
|
|
142
|
+
RoomHistory,
|
|
143
|
+
RoomHistoryMode,
|
|
131
144
|
RoomMember,
|
|
132
145
|
RoomSummary,
|
|
133
146
|
RoomSummaryExtras,
|
|
@@ -146,8 +159,9 @@ export {
|
|
|
146
159
|
PermissionOverwritesTarget,
|
|
147
160
|
BanObject,
|
|
148
161
|
LeaveReason,
|
|
149
|
-
|
|
150
|
-
|
|
162
|
+
UserRelationship,
|
|
163
|
+
UserRelationshipType,
|
|
164
|
+
CreateTopicInitialMessage,
|
|
151
165
|
// events
|
|
152
166
|
Bye,
|
|
153
167
|
Error,
|
|
@@ -197,6 +211,10 @@ export {
|
|
|
197
211
|
ClientData,
|
|
198
212
|
SpaceSummaryEvent,
|
|
199
213
|
RoomSummaryEvent,
|
|
214
|
+
NewRelationship,
|
|
215
|
+
RelationshipDeleted,
|
|
216
|
+
Relationships,
|
|
217
|
+
RoomSummaryUpdated,
|
|
200
218
|
// commands
|
|
201
219
|
AssignRole,
|
|
202
220
|
GetMessages,
|
|
@@ -247,5 +265,8 @@ export {
|
|
|
247
265
|
SetClientData,
|
|
248
266
|
GetSpaceSummary,
|
|
249
267
|
GetRoomSummary,
|
|
250
|
-
|
|
268
|
+
UpdateSpaceMember,
|
|
269
|
+
CreateRelationship,
|
|
270
|
+
DeleteRelationship,
|
|
271
|
+
UpdateRoomMember,
|
|
251
272
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {User} from "./User";
|
|
2
2
|
import {ChatLocation} from "./ChatLocation";
|
|
3
3
|
|
|
4
|
-
export type MessageType = 'Text'|'RoomJoin'|'RoomLeave'|'SpaceJoin'|'SpaceLeave'|'TopicChange'|'CustomNickChange';
|
|
4
|
+
export type MessageType = 'Text'|'RoomJoin'|'RoomLeave'|'SpaceJoin'|'SpaceLeave'|'TopicChange'|'CustomNickChange'|'Ephemeral';
|
|
5
5
|
|
|
6
6
|
export interface MessageAuthor {
|
|
7
7
|
user: User;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {Topic} from "./Topic";
|
|
2
2
|
import {User} from "./User";
|
|
3
3
|
import {RoomStream} from "./RoomStream";
|
|
4
|
+
import {RoomHistory} from "./RoomHistory";
|
|
4
5
|
|
|
5
6
|
export type RoomType = 'Text' | 'ClassicText' | 'Pm';
|
|
6
7
|
|
|
@@ -19,4 +20,5 @@ export interface Room {
|
|
|
19
20
|
recipients: User[] | null;
|
|
20
21
|
flags: number;
|
|
21
22
|
stream: RoomStream | null;
|
|
23
|
+
history: RoomHistory | null;
|
|
22
24
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import {ChatLocation} from "../ChatLocation";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
export interface CreateTopicInitialMessage {
|
|
4
|
+
content?: string;
|
|
5
|
+
attachments?: string[];
|
|
6
|
+
}
|
|
3
7
|
|
|
4
8
|
export interface CreateTopic {
|
|
5
9
|
location: ChatLocation;
|
|
6
10
|
name: string;
|
|
7
11
|
refMessageId?: string;
|
|
8
|
-
initialMessage?:
|
|
12
|
+
initialMessage?: CreateTopicInitialMessage;
|
|
9
13
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {RoomStream} from "../RoomStream";
|
|
2
|
+
import {RoomHistory} from "../RoomHistory";
|
|
2
3
|
|
|
3
4
|
export interface UpdateRoom {
|
|
4
5
|
id: string;
|
|
@@ -6,4 +7,5 @@ export interface UpdateRoom {
|
|
|
6
7
|
description?: string;
|
|
7
8
|
flags?: number;
|
|
8
9
|
stream?: RoomStream | null;
|
|
10
|
+
history?: RoomHistory;
|
|
9
11
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IndexedObjectCollection } from "../src";
|
|
2
|
+
import {TopicHistoryWindow, TraversableRemoteCollection, WindowState} from "../src/state-tracker/TopicHistoryWindow";
|
|
2
3
|
|
|
3
4
|
interface SimpleMessage {
|
|
4
5
|
id: number;
|
|
@@ -18,6 +19,10 @@ const messages: SimpleMessage[] = [
|
|
|
18
19
|
];
|
|
19
20
|
|
|
20
21
|
class TestableHistoryWindow extends TraversableRemoteCollection<SimpleMessage> {
|
|
22
|
+
public createMirror(): TraversableRemoteCollection<SimpleMessage> {
|
|
23
|
+
throw new Error('Method not implemented.');
|
|
24
|
+
}
|
|
25
|
+
|
|
21
26
|
public constructor() {
|
|
22
27
|
super('id');
|
|
23
28
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const TerserPlugin = require(
|
|
3
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
2
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
4
3
|
|
|
5
4
|
module.exports = {
|
|
6
5
|
mode: "production",
|
|
@@ -27,32 +26,11 @@ module.exports = {
|
|
|
27
26
|
test: /\.(m|j|t)s$/,
|
|
28
27
|
exclude: /(node_modules|bower_components)/,
|
|
29
28
|
use: {
|
|
30
|
-
loader: 'babel-loader'
|
|
31
|
-
options: {
|
|
32
|
-
presets: [
|
|
33
|
-
['@babel/preset-env', { targets: { esmodules: true } }],
|
|
34
|
-
'@babel/preset-typescript'
|
|
35
|
-
],
|
|
36
|
-
plugins: [
|
|
37
|
-
|
|
38
|
-
]
|
|
39
|
-
}
|
|
29
|
+
loader: 'babel-loader'
|
|
40
30
|
}
|
|
41
31
|
},
|
|
42
|
-
{
|
|
43
|
-
test: /\.(sa|sc|c)ss$/,
|
|
44
|
-
use: [
|
|
45
|
-
MiniCssExtractPlugin.loader,
|
|
46
|
-
{ loader: "css-loader", options: { sourceMap: true } },
|
|
47
|
-
],
|
|
48
|
-
}
|
|
49
32
|
]
|
|
50
33
|
},
|
|
51
|
-
plugins: [
|
|
52
|
-
new MiniCssExtractPlugin({
|
|
53
|
-
filename: 'index.css',
|
|
54
|
-
}),
|
|
55
|
-
],
|
|
56
34
|
resolve: {
|
|
57
35
|
extensions: ['.ts', '.js', '.json']
|
|
58
36
|
}
|
package/webpack.config.node.js
CHANGED
|
@@ -24,24 +24,12 @@ module.exports = {
|
|
|
24
24
|
test: /\.(m|j|t)s$/,
|
|
25
25
|
exclude: /(node_modules|bower_components)/,
|
|
26
26
|
use: {
|
|
27
|
-
loader: 'babel-loader'
|
|
28
|
-
options: {
|
|
29
|
-
presets: [
|
|
30
|
-
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
31
|
-
'@babel/preset-typescript'
|
|
32
|
-
],
|
|
33
|
-
plugins: [
|
|
34
|
-
|
|
35
|
-
]
|
|
36
|
-
}
|
|
27
|
+
loader: 'babel-loader'
|
|
37
28
|
}
|
|
38
29
|
},
|
|
39
30
|
]
|
|
40
31
|
},
|
|
41
32
|
resolve: {
|
|
42
33
|
extensions: ['.ts', '.js', '.json']
|
|
43
|
-
}
|
|
44
|
-
externals: [
|
|
45
|
-
|
|
46
|
-
]
|
|
34
|
+
}
|
|
47
35
|
};
|
package/.eslintignore
DELETED
|
File without changes
|
package/.eslintrc.json
DELETED
|
File without changes
|