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.
Files changed (86) hide show
  1. package/.idea/copilot.data.migration.agent.xml +6 -0
  2. package/.idea/copilot.data.migration.ask.xml +6 -0
  3. package/.idea/copilot.data.migration.ask2agent.xml +6 -0
  4. package/.idea/copilot.data.migration.edit.xml +6 -0
  5. package/.idea/workspace.xml +376 -135
  6. package/babel.config.js +4 -5
  7. package/build/index.cjs.js +4538 -1816
  8. package/build/index.cjs.js.map +1 -1
  9. package/build/index.umd.js +1 -1
  10. package/build/index.umd.js.map +1 -1
  11. package/build/types/AbstractChatClient.d.ts +12 -2
  12. package/build/types/FilesClient.d.ts +7 -6
  13. package/build/types/IndexedObjectCollection.d.ts +4 -3
  14. package/build/types/Permissions.d.ts +4 -0
  15. package/build/types/WebSocketChatClient.d.ts +2 -0
  16. package/build/types/state-tracker/ChatStateTracker.d.ts +5 -0
  17. package/build/types/state-tracker/RelationshipsManager.d.ts +15 -0
  18. package/build/types/state-tracker/RoomMessagesHistory.d.ts +2 -0
  19. package/build/types/state-tracker/SpacesManager.d.ts +1 -0
  20. package/build/types/state-tracker/TopicHistoryWindow.d.ts +23 -5
  21. package/build/types/state-tracker/UsersManager.d.ts +3 -1
  22. package/build/types/types/src/index.d.ts +12 -3
  23. package/build/types/types/src/schemes/Emoticon.d.ts +1 -0
  24. package/build/types/types/src/schemes/Message.d.ts +1 -1
  25. package/build/types/types/src/schemes/Room.d.ts +2 -0
  26. package/build/types/types/src/schemes/RoomHistory.d.ts +5 -0
  27. package/build/types/types/src/schemes/RoomSummary.d.ts +1 -0
  28. package/build/types/types/src/schemes/SpaceSummary.d.ts +1 -0
  29. package/build/types/types/src/schemes/User.d.ts +2 -2
  30. package/build/types/types/src/schemes/UserRelationship.d.ts +6 -0
  31. package/build/types/types/src/schemes/commands/CreateMessage.d.ts +2 -0
  32. package/build/types/types/src/schemes/commands/CreateRelationship.d.ts +5 -0
  33. package/build/types/types/src/schemes/commands/CreateTopic.d.ts +5 -2
  34. package/build/types/types/src/schemes/commands/DeleteRelationship.d.ts +5 -0
  35. package/build/types/types/src/schemes/commands/GetRelationships.d.ts +2 -0
  36. package/build/types/types/src/schemes/commands/UpdateRoom.d.ts +2 -0
  37. package/build/types/types/src/schemes/commands/UpdateRoomMember.d.ts +7 -0
  38. package/build/types/types/src/schemes/commands/UpdateSpaceMember.d.ts +5 -0
  39. package/build/types/types/src/schemes/events/NewRelationship.d.ts +4 -0
  40. package/build/types/types/src/schemes/events/RelationshipDeleted.d.ts +4 -0
  41. package/build/types/types/src/schemes/events/Relationships.d.ts +4 -0
  42. package/build/types/types/src/schemes/events/RoomSummaryUpdated.d.ts +7 -0
  43. package/build/types/types/src/schemes/events/Session.d.ts +1 -0
  44. package/package.json +15 -30
  45. package/src/AbstractChatClient.ts +28 -4
  46. package/src/FilesClient.ts +26 -13
  47. package/src/IndexedObjectCollection.ts +26 -10
  48. package/src/Permissions.ts +1 -0
  49. package/src/WebSocketChatClient.ts +19 -11
  50. package/src/state-tracker/ChatStateTracker.ts +22 -6
  51. package/src/state-tracker/EmoticonsManager.ts +6 -4
  52. package/src/state-tracker/MessagesManager.ts +3 -3
  53. package/src/state-tracker/RelationshipsManager.ts +68 -0
  54. package/src/state-tracker/RoomMessagesHistory.ts +20 -3
  55. package/src/state-tracker/RoomsManager.ts +30 -7
  56. package/src/state-tracker/SpacesManager.ts +28 -1
  57. package/src/state-tracker/TopicHistoryWindow.ts +94 -23
  58. package/src/state-tracker/UsersManager.ts +16 -6
  59. package/src/types/src/index.ts +26 -5
  60. package/src/types/src/schemes/Emoticon.ts +1 -0
  61. package/src/types/src/schemes/Message.ts +1 -1
  62. package/src/types/src/schemes/Room.ts +2 -0
  63. package/src/types/src/schemes/RoomHistory.ts +6 -0
  64. package/src/types/src/schemes/RoomSummary.ts +1 -0
  65. package/src/types/src/schemes/SpaceSummary.ts +1 -0
  66. package/src/types/src/schemes/User.ts +2 -2
  67. package/src/types/src/schemes/UserRelationship.ts +8 -0
  68. package/src/types/src/schemes/commands/CreateMessage.ts +2 -0
  69. package/src/types/src/schemes/commands/CreateRelationship.ts +6 -0
  70. package/src/types/src/schemes/commands/CreateTopic.ts +6 -2
  71. package/src/types/src/schemes/commands/DeleteRelationship.ts +6 -0
  72. package/src/types/src/schemes/commands/GetRelationships.ts +3 -0
  73. package/src/types/src/schemes/commands/UpdateRoom.ts +2 -0
  74. package/src/types/src/schemes/commands/UpdateRoomMember.ts +7 -0
  75. package/src/types/src/schemes/commands/UpdateSpaceMember.ts +5 -0
  76. package/src/types/src/schemes/events/NewRelationship.ts +5 -0
  77. package/src/types/src/schemes/events/RelationshipDeleted.ts +5 -0
  78. package/src/types/src/schemes/events/Relationships.ts +5 -0
  79. package/src/types/src/schemes/events/RoomSummaryUpdated.ts +8 -0
  80. package/src/types/src/schemes/events/Session.ts +1 -0
  81. package/tests/history-window.test.ts +6 -1
  82. package/webpack.config.browser.js +2 -24
  83. package/webpack.config.node.js +2 -14
  84. package/.eslintignore +0 -0
  85. package/.eslintrc.json +0 -0
  86. 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.currentState;
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 = 50;
53
+ public get limit(): number | null {
54
+ return this.internalState.limit;
55
+ }
42
56
 
43
- private currentState: WindowState = WindowState.LIVE;
44
- private fetchingState: WindowState = undefined;
45
- public oldestId: string = null;
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.fetchingState || this.currentState === WindowState.LATEST) {
76
+ if (this.internalState.ongoing || this.internalState.current === WindowState.LATEST) {
57
77
  return;
58
78
  }
59
79
 
60
- this.fetchingState = WindowState.LATEST;
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.fetchingState = undefined;
87
+ this.internalState.ongoing = undefined;
68
88
  }
69
89
 
70
90
  this.deleteAll();
71
91
  this.addItems(result, 'tail');
72
- this.currentState = WindowState.LATEST;
92
+ this.internalState.current = WindowState.LATEST;
73
93
  }
74
94
 
75
95
  public async fetchPrevious(): Promise<void> {
76
- if (this.fetchingState || this.hasOldest) {
96
+ if (this.internalState.ongoing || this.hasOldest) {
77
97
  return;
78
98
  }
79
99
 
80
- this.fetchingState = WindowState.PAST;
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.fetchingState = undefined;
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.currentState === WindowState.PAST) {
102
- this.currentState = WindowState.OLDEST;
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.fetchingState || this.hasLatest) {
133
+ if (this.internalState.ongoing || this.hasLatest) {
114
134
  return;
115
135
  }
116
136
 
117
- this.fetchingState = WindowState.PAST;
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.fetchingState = undefined;
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.currentState = (await this.isLatestItemLoaded()) ? WindowState.LATEST : WindowState.PAST;
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
- this.tracker.client.on('Session', ev => this.handleSession(ev));
197
- this.tracker.client.on('NewMessage', ev => this.handleNewMessage(ev));
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.users.set(...members.map(extractUserFromMember));
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.users.set(session.user);
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
  }
@@ -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 {SetCustomNick} from "./schemes/commands/SetCustomNick";
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
- RoomStream,
150
- RoomStreamType,
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
- SetCustomNick,
268
+ UpdateSpaceMember,
269
+ CreateRelationship,
270
+ DeleteRelationship,
271
+ UpdateRoomMember,
251
272
  };
@@ -6,4 +6,5 @@ export interface Emoticon {
6
6
  name: string;
7
7
  fileId: string;
8
8
  user: User;
9
+ tag?: string;
9
10
  }
@@ -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
  }
@@ -0,0 +1,6 @@
1
+ export type RoomHistoryMode = 'Full' | 'Ephemeral' | 'MaxAge';
2
+
3
+ export interface RoomHistory {
4
+ mode: RoomHistoryMode;
5
+ maxAge?: number;
6
+ }
@@ -8,6 +8,7 @@ export interface RoomSummary {
8
8
  id: string;
9
9
  name: string;
10
10
  description: string;
11
+ memberCount: number;
11
12
  type: RoomType;
12
13
  extras?: RoomSummaryExtras;
13
14
  }
@@ -4,4 +4,5 @@ export interface SpaceSummary {
4
4
  description: string;
5
5
  icon?: string;
6
6
  banner?: string;
7
+ memberCount: number;
7
8
  }
@@ -1,9 +1,9 @@
1
- export type UserFlag = 'bot' | 'temp';
1
+ export type UserTags = 'bot' | 'temp';
2
2
 
3
3
  export interface User {
4
4
  id: string;
5
5
  nick: string;
6
6
  avatar: string;
7
- flags: UserFlag[];
7
+ tags: UserTags[];
8
8
  online: boolean;
9
9
  }
@@ -0,0 +1,8 @@
1
+ import {User} from "./User";
2
+
3
+ export type UserRelationshipType = 'Ignore';
4
+
5
+ export interface UserRelationship {
6
+ refUser: User;
7
+ type: UserRelationshipType;
8
+ }
@@ -4,4 +4,6 @@ export interface CreateMessage {
4
4
  location: ChatLocation;
5
5
  content: string;
6
6
  attachments?: string[];
7
+ customNick?: string;
8
+ customColor?: string;
7
9
  }
@@ -0,0 +1,6 @@
1
+ import {UserRelationshipType} from "../UserRelationship";
2
+
3
+ export interface CreateRelationship {
4
+ refUserId: string;
5
+ type: UserRelationshipType;
6
+ }
@@ -1,9 +1,13 @@
1
1
  import {ChatLocation} from "../ChatLocation";
2
- import {CreateMessage} from "./CreateMessage";
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?: Omit<CreateMessage, 'location'>;
12
+ initialMessage?: CreateTopicInitialMessage;
9
13
  }
@@ -0,0 +1,6 @@
1
+ import {UserRelationshipType} from "../UserRelationship";
2
+
3
+ export interface DeleteRelationship {
4
+ refUserId: string;
5
+ type: UserRelationshipType;
6
+ }
@@ -0,0 +1,3 @@
1
+ export interface GetRelationships {
2
+
3
+ }
@@ -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
  }
@@ -0,0 +1,7 @@
1
+ export interface UpdateRoomMember {
2
+ roomId: string;
3
+ userId: string;
4
+ customNick?: string|null;
5
+ customColor?: string|null;
6
+ extras?: string|null;
7
+ }
@@ -0,0 +1,5 @@
1
+ export interface UpdateSpaceMember {
2
+ spaceId: string;
3
+ userId: string;
4
+ customNick?: string|null;
5
+ }
@@ -0,0 +1,5 @@
1
+ import {UserRelationship} from "../UserRelationship";
2
+
3
+ export interface NewRelationship {
4
+ relationship: UserRelationship;
5
+ }
@@ -0,0 +1,5 @@
1
+ import {UserRelationship} from "../UserRelationship";
2
+
3
+ export interface RelationshipDeleted {
4
+ relationship: UserRelationship;
5
+ }
@@ -0,0 +1,5 @@
1
+ import {UserRelationship} from "../UserRelationship";
2
+
3
+ export interface Relationships {
4
+ relationships: UserRelationship[];
5
+ }
@@ -0,0 +1,8 @@
1
+ import {RoomSummary} from "../RoomSummary";
2
+
3
+ export interface RoomSummaryUpdated {
4
+ /**
5
+ * Partial summary: without the `extras` field.
6
+ */
7
+ summary: RoomSummary;
8
+ }
@@ -3,6 +3,7 @@ import {User} from "../User";
3
3
 
4
4
  export interface Session {
5
5
  serverVersion: string;
6
+ protoVersion: string;
6
7
  state: UserState;
7
8
  user: User;
8
9
  }
@@ -1,4 +1,5 @@
1
- import {TraversableRemoteCollection, WindowState} from "../src/state-tracker/TopicHistoryWindow";
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('terser-webpack-plugin');
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
  }
@@ -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
@@ -1,5 +0,0 @@
1
- export interface SetCustomNick {
2
- spaceId: string;
3
- userId: string;
4
- nick: string|null;
5
- }