polfan-server-js-client 0.3.3 → 0.4.1
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/.gitmodules +3 -3
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_05_08_2026_17_28_[Changes]/shelved.patch +447 -0
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_05_08_2026_17_28_[Changes]1/shelved.patch +0 -0
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_05_08_2026_17_28__Changes_.xml +4 -0
- package/.idea/workspace.xml +61 -52
- package/CODE_OF_CONDUCT.md +76 -76
- package/README.md +44 -44
- package/babel.config.js +5 -5
- package/build/index.cjs.js +398 -427
- 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/index.d.ts +2 -1
- package/build/types/state-tracker/RoomMessagesHistory.d.ts +4 -15
- package/build/types/state-tracker/TopicHistoryWindow.d.ts +0 -48
- package/build/types/types/src/index.d.ts +11 -3
- package/build/types/types/src/schemes/Message.d.ts +5 -1
- package/build/types/types/src/schemes/MessagePoll.d.ts +10 -0
- package/build/types/types/src/schemes/Reaction.d.ts +13 -0
- package/build/types/types/src/schemes/SessionData.d.ts +6 -0
- package/build/types/types/src/schemes/User.d.ts +15 -0
- package/build/types/types/src/schemes/UserData.d.ts +5 -0
- package/build/types/types/src/schemes/commands/CreateMessage.d.ts +3 -0
- package/build/types/types/src/schemes/commands/GetMessages.d.ts +5 -0
- package/build/types/types/src/schemes/commands/GetReactionDetails.d.ts +8 -0
- package/build/types/types/src/schemes/commands/React.d.ts +6 -0
- package/build/types/types/src/schemes/commands/SetSessionData.d.ts +9 -1
- package/build/types/types/src/schemes/commands/SetUserData.d.ts +1 -0
- package/build/types/types/src/schemes/commands/Unreact.d.ts +6 -0
- package/build/types/types/src/schemes/events/Messages.d.ts +3 -0
- package/build/types/types/src/schemes/events/Reacted.d.ts +9 -0
- package/build/types/types/src/schemes/events/ReactionDetails.d.ts +11 -0
- package/build/types/types/src/schemes/events/ReactionUpdated.d.ts +8 -0
- package/jest.config.ts +199 -199
- package/package.json +1 -1
- package/scripts/getPackageJson.js +24 -24
- package/src/FilesClient.ts +42 -42
- package/src/index.ts +2 -0
- package/src/state-tracker/ChatStateTracker.ts +71 -71
- package/src/state-tracker/RoomMessagesHistory.ts +9 -27
- package/src/state-tracker/TopicHistoryWindow.ts +1 -133
- package/src/state-tracker/UsersManager.ts +1 -1
- package/src/state-tracker/functions.ts +28 -28
- package/src/types/src/index.ts +24 -2
- package/src/types/src/schemes/Message.ts +5 -1
- package/src/types/src/schemes/MessagePoll.ts +12 -0
- package/src/types/src/schemes/Reaction.ts +16 -0
- package/src/types/src/schemes/SessionData.ts +8 -1
- package/src/types/src/schemes/User.ts +17 -1
- package/src/types/src/schemes/UserData.ts +5 -0
- package/src/types/src/schemes/commands/CreateMessage.ts +3 -0
- package/src/types/src/schemes/commands/GetMessages.ts +5 -0
- package/src/types/src/schemes/commands/GetReactionDetails.ts +9 -0
- package/src/types/src/schemes/commands/React.ts +7 -0
- package/src/types/src/schemes/commands/SetSessionData.ts +11 -2
- package/src/types/src/schemes/commands/SetUserData.ts +1 -0
- package/src/types/src/schemes/commands/Unreact.ts +7 -0
- package/src/types/src/schemes/events/Messages.ts +3 -0
- package/src/types/src/schemes/events/Reacted.ts +10 -0
- package/src/types/src/schemes/events/ReactionDetails.ts +12 -0
- package/src/types/src/schemes/events/ReactionUpdated.ts +9 -0
- package/tests/async-utils.test.ts +29 -29
- package/tests/history-window.test.ts +0 -131
- package/tests/space-roles.test.ts +42 -42
- package/tests/state-reconnect.test.ts +0 -260
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_26_07_2026_21_26_[Changes]/shelved.patch +0 -174
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_26_07_2026_21_26__Changes_.xml +0 -4
- package/.idea/shelf/Uncommitted_changes_before_rebase_[Changes]/shelved.patch +0 -18
- package/.idea/shelf/Uncommitted_changes_before_rebase__Changes_.xml +0 -4
package/build/types/index.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import { IndexedCollection, IndexedObjectCollection, ObservableIndexedCollection
|
|
|
4
4
|
import { FilesClient, File } from "./FilesClient";
|
|
5
5
|
import { Permissions, PermissionDefinition, Layer } from "./Permissions";
|
|
6
6
|
import * as ChatTypes from './types/src';
|
|
7
|
+
import { UserStatus } from './types/src';
|
|
7
8
|
import { extractUserFromMember } from "./state-tracker/functions";
|
|
8
9
|
import { AbstractRestClient } from "./AbstractRestClient";
|
|
9
10
|
import { UnreadSummary } from "./state-tracker/FollowedTopicsManager";
|
|
10
|
-
export { IndexedCollection, ObservableIndexedCollection, IndexedObjectCollection, ObservableIndexedObjectCollection, Permissions, PermissionDefinition, Layer, WebSocketChatClient, WebApiChatClient, FilesClient, AbstractRestClient, extractUserFromMember, };
|
|
11
|
+
export { IndexedCollection, ObservableIndexedCollection, IndexedObjectCollection, ObservableIndexedObjectCollection, Permissions, PermissionDefinition, Layer, WebSocketChatClient, WebApiChatClient, FilesClient, AbstractRestClient, extractUserFromMember, UserStatus, };
|
|
11
12
|
export type { ChatTypes, File, UnreadSummary, };
|
|
@@ -6,7 +6,6 @@ export declare class RoomMessagesHistory {
|
|
|
6
6
|
private tracker;
|
|
7
7
|
private historyWindows;
|
|
8
8
|
private traverseLock;
|
|
9
|
-
private timeLimitedHistory;
|
|
10
9
|
constructor(room: Room, tracker: ChatStateTracker);
|
|
11
10
|
/**
|
|
12
11
|
* Returns a history window object for the given topic ID, allowing you to view message history.
|
|
@@ -21,24 +20,14 @@ export declare class RoomMessagesHistory {
|
|
|
21
20
|
*
|
|
22
21
|
* The window bindings are preserved; only windows that the application had
|
|
23
22
|
* actually pulled to the latest page (state === LATEST) are refreshed, with
|
|
24
|
-
* a single
|
|
25
|
-
* were never pulled (LIVE) or belong to an ephemeral room are left
|
|
26
|
-
* so their in-memory context survives the reconnect.
|
|
27
|
-
*
|
|
28
|
-
* How a refreshed window is rebuilt depends on the room history mode: rooms
|
|
29
|
-
* keeping the full history are simply reset to the latest page (it can
|
|
30
|
-
* always be traversed back on demand), while rooms with a time-limited
|
|
31
|
-
* history (MaxAge) load the messages missed during the downtime on top of
|
|
32
|
-
* the already loaded ones, with the messages returned in both deduplicated.
|
|
33
|
-
* The maxAge retention applies to what the server serves - so that users
|
|
34
|
-
* joining later do not see the older conversation - and never to what this
|
|
35
|
-
* client already has: messages the user witnessed stay in the window until
|
|
36
|
-
* they are pushed out by its own size limit.
|
|
23
|
+
* a single resetToLatest instead of a chain of catch-up requests. Windows
|
|
24
|
+
* that were never pulled (LIVE) or belong to an ephemeral room are left
|
|
25
|
+
* untouched so their in-memory context survives the reconnect.
|
|
37
26
|
*/
|
|
38
27
|
resync(room: Room): Promise<void>;
|
|
39
28
|
private handleRoomUpdated;
|
|
40
29
|
private handleNewTopic;
|
|
41
30
|
private handleTopicDeleted;
|
|
42
31
|
private createHistoryWindowForTopic;
|
|
43
|
-
private
|
|
32
|
+
private updateTraverseLock;
|
|
44
33
|
}
|
|
@@ -34,7 +34,6 @@ export declare abstract class TraversableRemoteCollection<ItemT, EventMapT exten
|
|
|
34
34
|
fetchLimit: number;
|
|
35
35
|
lastFetchCount: number;
|
|
36
36
|
oldestId: string | null;
|
|
37
|
-
gaps: string[];
|
|
38
37
|
};
|
|
39
38
|
/**
|
|
40
39
|
* Number of items to fetch per request.
|
|
@@ -63,44 +62,12 @@ export declare abstract class TraversableRemoteCollection<ItemT, EventMapT exten
|
|
|
63
62
|
*/
|
|
64
63
|
set retainRatio(value: number);
|
|
65
64
|
get hasLatest(): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* IDs of the items the window could not stitch to the ones loaded before
|
|
68
|
-
* them: there is a gap in front of each of them, i.e. the item right above
|
|
69
|
-
* it in the window is not its real predecessor and an unknown number of
|
|
70
|
-
* items in between was never fetched.
|
|
71
|
-
*
|
|
72
|
-
* Such a gap appears when the collection is resynchronised after a
|
|
73
|
-
* reconnect (see resyncToLatest) and more items than a single page arrived
|
|
74
|
-
* while the connection was down. The markers are kept in the window order
|
|
75
|
-
* and disappear together with the items they point at.
|
|
76
|
-
*/
|
|
77
|
-
get gaps(): readonly string[];
|
|
78
65
|
get hasOldest(): boolean;
|
|
79
66
|
abstract createMirror(): TraversableRemoteCollection<ItemT, EventMapT>;
|
|
80
67
|
resetToLatest(force?: boolean): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* Refresh the window with the latest page, keeping the already loaded items
|
|
83
|
-
* instead of replacing them.
|
|
84
|
-
*
|
|
85
|
-
* This is the reconnect-friendly variant of resetToLatest: the items missed
|
|
86
|
-
* while the connection was down are pulled with a single request and merged
|
|
87
|
-
* on top of the loaded ones (items returned in both are deduplicated), so
|
|
88
|
-
* the context the application already had does not disappear. The window
|
|
89
|
-
* size limit is the only thing that pushes the oldest items out.
|
|
90
|
-
*
|
|
91
|
-
* An empty or partial page is not a reason to drop anything: it only means
|
|
92
|
-
* the collection has little (or nothing) left on the remote side, while the
|
|
93
|
-
* items loaded earlier are still valid. When the page is full and does not
|
|
94
|
-
* reach the loaded items, an unknown number of items in between was never
|
|
95
|
-
* fetched - both parts are still kept, and the seam between them is recorded
|
|
96
|
-
* in `gaps` so the application can show where the history is not continuous.
|
|
97
|
-
*/
|
|
98
|
-
resyncToLatest(): Promise<void>;
|
|
99
68
|
fetchPrevious(): Promise<void>;
|
|
100
69
|
fetchNext(): Promise<void>;
|
|
101
70
|
jumpTo(id: string): Promise<void>;
|
|
102
|
-
delete(...ids: string[]): void;
|
|
103
|
-
deleteAll(): void;
|
|
104
71
|
protected abstract fetchLatestItems(): Promise<ItemT[]>;
|
|
105
72
|
protected abstract fetchItemsBefore(): Promise<ItemT[] | null>;
|
|
106
73
|
protected abstract fetchItemsAfter(): Promise<ItemT[] | null>;
|
|
@@ -109,20 +76,6 @@ export declare abstract class TraversableRemoteCollection<ItemT, EventMapT exten
|
|
|
109
76
|
protected refreshFetchedState(): Promise<void>;
|
|
110
77
|
protected addItems(newItems: ItemT[], to: 'head' | 'tail'): void;
|
|
111
78
|
protected emitChangeWithDiff(itemChanged: boolean, originalState: WindowState): void;
|
|
112
|
-
/**
|
|
113
|
-
* Record that the history is not continuous in front of the given item.
|
|
114
|
-
*/
|
|
115
|
-
protected markGapBefore(id: string): void;
|
|
116
|
-
/**
|
|
117
|
-
* Forget the gap in front of the given item - the items before it are known
|
|
118
|
-
* to be its real predecessors now.
|
|
119
|
-
*/
|
|
120
|
-
protected clearGapBefore(id: string): void;
|
|
121
|
-
/**
|
|
122
|
-
* Forget the gap markers pointing at items that are no longer in the window
|
|
123
|
-
* (trimmed, deleted or replaced), so `gaps` never refers to nothing.
|
|
124
|
-
*/
|
|
125
|
-
protected dropDanglingGaps(): void;
|
|
126
79
|
/**
|
|
127
80
|
* Return array with messages trimmed using High/Low Watermark strategy.
|
|
128
81
|
*/
|
|
@@ -147,7 +100,6 @@ export declare class TopicHistoryWindow extends TraversableRemoteCollection<Mess
|
|
|
147
100
|
get isTraverseLocked(): boolean;
|
|
148
101
|
setTraverseLock(lock: boolean): Promise<void>;
|
|
149
102
|
resetToLatest(force?: boolean): Promise<void>;
|
|
150
|
-
resyncToLatest(): Promise<void>;
|
|
151
103
|
fetchNext(): Promise<void>;
|
|
152
104
|
fetchPrevious(): Promise<void>;
|
|
153
105
|
jumpTo(id: string): Promise<void>;
|
|
@@ -8,7 +8,7 @@ import { RoomSummary, RoomSummaryExtras } from "./schemes/RoomSummary";
|
|
|
8
8
|
import { Space, SpaceDiscoverable } from "./schemes/Space";
|
|
9
9
|
import { SpaceMember } from "./schemes/SpaceMember";
|
|
10
10
|
import { Topic } from "./schemes/Topic";
|
|
11
|
-
import { User } from "./schemes/User";
|
|
11
|
+
import { User, UserStatus } from "./schemes/User";
|
|
12
12
|
import { UserState } from "./schemes/UserState";
|
|
13
13
|
import { Bye } from "./schemes/events/Bye";
|
|
14
14
|
import { Error } from "./schemes/events/Error";
|
|
@@ -134,7 +134,7 @@ import { GetUserInfo } from "./schemes/commands/GetUserInfo";
|
|
|
134
134
|
import { UserInfo } from "./schemes/events/UserInfo";
|
|
135
135
|
import { UserInformation } from "./schemes/UserInformation";
|
|
136
136
|
import { SetSessionData, SessionPush } from "./schemes/commands/SetSessionData";
|
|
137
|
-
import { SessionData } from "./schemes/SessionData";
|
|
137
|
+
import { SessionData, SessionPlatform } from "./schemes/SessionData";
|
|
138
138
|
import { GetSessionData } from "./schemes/commands/GetSessionData";
|
|
139
139
|
import { UserData, PrivateMessagePolicy } from "./schemes/UserData";
|
|
140
140
|
import { SetUserData } from "./schemes/commands/SetUserData";
|
|
@@ -145,4 +145,12 @@ import { Uninvite } from "./schemes/commands/Uninvite";
|
|
|
145
145
|
import { GetInvited } from "./schemes/commands/GetInvited";
|
|
146
146
|
import { Invited } from "./schemes/events/Invited";
|
|
147
147
|
import { TopicUnfollowed } from "./schemes/events/TopicUnfollowed";
|
|
148
|
-
|
|
148
|
+
import { MessageReaction, ReactionType, ToggledReaction, UserReaction } from "./schemes/Reaction";
|
|
149
|
+
import { MessagePoll, MessagePollOption } from "./schemes/MessagePoll";
|
|
150
|
+
import { React } from "./schemes/commands/React";
|
|
151
|
+
import { Unreact } from "./schemes/commands/Unreact";
|
|
152
|
+
import { GetReactionDetails } from "./schemes/commands/GetReactionDetails";
|
|
153
|
+
import { ReactionUpdated } from "./schemes/events/ReactionUpdated";
|
|
154
|
+
import { Reacted } from "./schemes/events/Reacted";
|
|
155
|
+
import { ReactionDetails } from "./schemes/events/ReactionDetails";
|
|
156
|
+
export { Envelope, Message, MessageType, MessageAuthor, Role, Room, RoomType, RoomStream, RoomStreamType, RoomHistory, RoomHistoryMode, RoomMember, RoomSummary, RoomSummaryExtras, Space, SpaceMember, Topic, FollowedTopic, NotificationLevel, User, UserStatus, UserState, PermissionOverwritesValue, ChatLocation, SpaceSummary, SpaceDiscoverable, Emoticon, PermissionOverwritesTarget, BanObject, LeaveReason, UserRelationship, UserRelationshipType, CreateTopicInitialMessage, UserInformation, SessionPush, SessionData, SessionPlatform, UserData, PrivateMessagePolicy, ReactionType, MessageReaction, UserReaction, ToggledReaction, MessagePoll, MessagePollOption, Bye, Error, Messages, NewMessage, NewRole, NewRoom, NewTopic, TopicFollowed, TopicUnfollowed, FollowedTopics, FollowedTopicUpdated, ComputedPermissions, PermissionOverwrites, PermissionOverwritesUpdated, RoleDeleted, RoleUpdated, RoomDeleted, RoomUpdated, RoomJoined, RoomLeft, RoomMembersJoined, RoomMemberLeft, RoomMembers, RoomMemberUpdated, UserUpdated, Session, SpaceDeleted, SpaceUpdated, SpaceJoined, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMembers, SpaceMemberUpdated, SpaceRooms, TopicDeleted, TopicUpdated, PermissionOverwriteTargets, Owners, Ok, DiscoverableSpaces, Emoticons, EmoticonDeleted, NewEmoticon, Bans, ClientData, SpaceSummaryEvent, RoomSummaryEvent, NewRelationship, RelationshipDeleted, Relationships, RoomSummaryUpdated, Pong, MessagesRedacted, UserInfo, Invited, ReactionUpdated, Reacted, ReactionDetails, AssignRole, GetMessages, CreateMessage, Ack, CreateRole, CreateRoom, CreateSpace, CreateTopic, FollowTopic, UnfollowTopic, UpdateFollowedTopic, GetFollowedTopics, DeassignRole, DeleteRole, DeleteRoom, DeleteSpace, DeleteTopic, SetPermissionOverwrites, GetPermissionOverwrites, GetComputedPermissions, GetRoomMembers, GetSession, GetSpaceMembers, GetSpaceRooms, JoinRoom, JoinSpace, LeaveRoom, LeaveSpace, UpdateRole, UpdateSpace, UpdateRoom, UpdateTopic, GetPermissionOverwriteTargets, CreateOwner, DeleteOwner, GetOwners, Topics, GetTopics, GetDiscoverableSpaces, GetEmoticons, CreateEmoticon, DeleteEmoticon, Ban, Unban, GetBans, Kick, GetClientData, SetClientData, GetSpaceSummary, GetRoomSummary, UpdateSpaceMember, CreateRelationship, DeleteRelationship, GetRelationships, UpdateRoomMember, Ping, ReportAbuse, RedactMessages, GetUserInfo, SetSessionData, GetSessionData, SetUserData, GetUserData, Invite, Uninvite, GetInvited, React, Unreact, GetReactionDetails, };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { User } from "./User";
|
|
2
2
|
import { ChatLocation } from "./ChatLocation";
|
|
3
|
-
|
|
3
|
+
import { MessageReaction } from "./Reaction";
|
|
4
|
+
import { MessagePoll } from "./MessagePoll";
|
|
5
|
+
export type MessageType = 'Text' | 'RoomJoin' | 'RoomMemberAdd' | 'RoomLeave' | 'SpaceJoin' | 'SpaceLeave' | 'TopicChange' | 'CustomNickChange' | 'Ephemeral' | 'Poll';
|
|
4
6
|
export interface MessageAuthor {
|
|
5
7
|
user: User;
|
|
6
8
|
customNick?: string;
|
|
@@ -15,4 +17,6 @@ export interface Message {
|
|
|
15
17
|
content?: string;
|
|
16
18
|
topicRef: string | null;
|
|
17
19
|
attachments: string[] | null;
|
|
20
|
+
reactions: MessageReaction[];
|
|
21
|
+
poll?: MessagePoll;
|
|
18
22
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ReactionType = 'Emoji' | 'Emoticon';
|
|
2
|
+
export interface MessageReaction {
|
|
3
|
+
type: ReactionType;
|
|
4
|
+
value: string;
|
|
5
|
+
count: number;
|
|
6
|
+
}
|
|
7
|
+
export interface UserReaction {
|
|
8
|
+
type: ReactionType;
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ToggledReaction extends UserReaction {
|
|
12
|
+
isAdded: boolean;
|
|
13
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { SessionPush } from "./commands/SetSessionData";
|
|
2
|
+
/**
|
|
3
|
+
* Platform of a client session. Reported on connect (the `platform` query
|
|
4
|
+
* parameter) and independent of the push registration.
|
|
5
|
+
*/
|
|
6
|
+
export type SessionPlatform = 'web' | 'ios' | 'android' | 'desktop';
|
|
2
7
|
export interface SessionData {
|
|
8
|
+
platform?: SessionPlatform;
|
|
3
9
|
push?: SessionPush;
|
|
4
10
|
}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
export type UserTags = 'bot' | 'temp' | string;
|
|
2
|
+
/**
|
|
3
|
+
* Availability of a user, aggregated over all of their sessions.
|
|
4
|
+
*
|
|
5
|
+
* - `Offline` - no session is connected and none can be reached asynchronously.
|
|
6
|
+
* - `Online` - at least one session holds a live connection.
|
|
7
|
+
* - `OnlineAsync` - no live connection, but a push-registered device was active
|
|
8
|
+
* recently, so a message will still reach the user.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum UserStatus {
|
|
11
|
+
Offline = 0,
|
|
12
|
+
Online = 1,
|
|
13
|
+
OnlineAsync = 2
|
|
14
|
+
}
|
|
2
15
|
export interface User {
|
|
3
16
|
id: string;
|
|
4
17
|
nick: string;
|
|
5
18
|
avatar: string;
|
|
6
19
|
tags: UserTags[];
|
|
20
|
+
status: UserStatus;
|
|
21
|
+
/** @deprecated Use {@link status}. Kept for clients older than the numeric status. */
|
|
7
22
|
online: boolean;
|
|
8
23
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export type PrivateMessagePolicy = 'None' | 'Mutual' | 'All';
|
|
2
2
|
export interface UserData {
|
|
3
3
|
privateMessagePolicy: PrivateMessagePolicy;
|
|
4
|
+
/**
|
|
5
|
+
* Whether others may see that the user is reachable on a push-registered
|
|
6
|
+
* device while disconnected. When false the user simply reads as offline.
|
|
7
|
+
*/
|
|
8
|
+
showAsyncPresence: boolean;
|
|
4
9
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { ChatLocation } from "../ChatLocation";
|
|
2
|
+
import { MessagePoll } from "../MessagePoll";
|
|
2
3
|
export interface CreateMessage {
|
|
3
4
|
location: ChatLocation;
|
|
4
5
|
content: string;
|
|
5
6
|
attachments?: string[];
|
|
6
7
|
customNick?: string;
|
|
7
8
|
customColor?: string;
|
|
9
|
+
/** Turns the message into a poll; its content becomes the question. */
|
|
10
|
+
poll?: MessagePoll;
|
|
8
11
|
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { SessionPlatform } from "../SessionData";
|
|
1
2
|
export interface SessionPush {
|
|
2
3
|
token?: string;
|
|
3
|
-
platform?: 'ios' | 'android' | 'web';
|
|
4
4
|
active?: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated The platform describes the session, not its push registration.
|
|
7
|
+
* Use {@link SetSessionData.platform} (or the `platform` connection query
|
|
8
|
+
* parameter). Still accepted by the server, but the top-level field wins.
|
|
9
|
+
*/
|
|
10
|
+
platform?: SessionPlatform;
|
|
5
11
|
}
|
|
6
12
|
export interface SetSessionData {
|
|
7
13
|
clientFocused?: boolean;
|
|
8
14
|
push?: SessionPush;
|
|
15
|
+
/** Client platform of this session; null leaves the stored value unchanged. */
|
|
16
|
+
platform?: SessionPlatform;
|
|
9
17
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ChatLocation } from "../ChatLocation";
|
|
2
2
|
import { Message } from "../Message";
|
|
3
|
+
import { UserReaction } from "../Reaction";
|
|
3
4
|
export interface Messages {
|
|
4
5
|
location: ChatLocation;
|
|
5
6
|
messages: Message[];
|
|
7
|
+
/** Message id => reactions of the asking user; present only when requested. */
|
|
8
|
+
myReactions?: Record<string, UserReaction[]>;
|
|
6
9
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ToggledReaction } from "../Reaction";
|
|
2
|
+
/**
|
|
3
|
+
* Sent to every client of the voting user, so all of their devices know what they
|
|
4
|
+
* voted for without refetching the message history.
|
|
5
|
+
*/
|
|
6
|
+
export interface Reacted {
|
|
7
|
+
messageId: string;
|
|
8
|
+
reaction: ToggledReaction;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactionType } from "../Reaction";
|
|
2
|
+
/**
|
|
3
|
+
* Who reacted, oldest vote first. Only the ids travel - the nicks are already
|
|
4
|
+
* known from the room members collection.
|
|
5
|
+
*/
|
|
6
|
+
export interface ReactionDetails {
|
|
7
|
+
messageId: string;
|
|
8
|
+
type: ReactionType;
|
|
9
|
+
value: string;
|
|
10
|
+
userIds: string[];
|
|
11
|
+
}
|