polfan-server-js-client 0.4.0 → 0.4.2
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 +71 -242
- package/build/index.cjs.js +219 -125
- 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 +7 -1
- package/build/types/Permissions.d.ts +8 -0
- package/build/types/state-tracker/TopicHistoryWindow.d.ts +26 -1
- package/build/types/types/src/index.d.ts +9 -1
- 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/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/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/package.json +43 -43
- package/src/AbstractChatClient.ts +12 -0
- package/src/Permissions.ts +2 -0
- package/src/index.ts +31 -31
- package/src/state-tracker/TopicHistoryWindow.ts +121 -42
- package/src/state-tracker/UsersManager.ts +51 -51
- package/src/types/src/index.ts +333 -313
- 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/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/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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {User} from "./User";
|
|
2
2
|
import {ChatLocation} from "./ChatLocation";
|
|
3
|
+
import {MessageReaction} from "./Reaction";
|
|
4
|
+
import {MessagePoll} from "./MessagePoll";
|
|
3
5
|
|
|
4
|
-
export type MessageType = 'Text'|'RoomJoin'|'RoomMemberAdd'|'RoomLeave'|'SpaceJoin'|'SpaceLeave'|'TopicChange'|'CustomNickChange'|'Ephemeral';
|
|
6
|
+
export type MessageType = 'Text'|'RoomJoin'|'RoomMemberAdd'|'RoomLeave'|'SpaceJoin'|'SpaceLeave'|'TopicChange'|'CustomNickChange'|'Ephemeral'|'Poll';
|
|
5
7
|
|
|
6
8
|
export interface MessageAuthor {
|
|
7
9
|
user: User;
|
|
@@ -18,4 +20,6 @@ export interface Message {
|
|
|
18
20
|
content?: string;
|
|
19
21
|
topicRef: string | null;
|
|
20
22
|
attachments: string[] | null;
|
|
23
|
+
reactions: MessageReaction[];
|
|
24
|
+
poll?: MessagePoll;
|
|
21
25
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ReactionType = 'Emoji' | 'Emoticon';
|
|
2
|
+
|
|
3
|
+
export interface MessageReaction {
|
|
4
|
+
type: ReactionType;
|
|
5
|
+
value: string;
|
|
6
|
+
count: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface UserReaction {
|
|
10
|
+
type: ReactionType;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ToggledReaction extends UserReaction {
|
|
15
|
+
isAdded: boolean;
|
|
16
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {ChatLocation} from "../ChatLocation";
|
|
2
|
+
import {MessagePoll} from "../MessagePoll";
|
|
2
3
|
|
|
3
4
|
export interface CreateMessage {
|
|
4
5
|
location: ChatLocation;
|
|
@@ -6,4 +7,6 @@ export interface CreateMessage {
|
|
|
6
7
|
attachments?: string[];
|
|
7
8
|
customNick?: string;
|
|
8
9
|
customColor?: string;
|
|
10
|
+
/** Turns the message into a poll; its content becomes the question. */
|
|
11
|
+
poll?: MessagePoll;
|
|
9
12
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {ChatLocation} from "../ChatLocation";
|
|
2
2
|
import {Message} from "../Message";
|
|
3
|
+
import {UserReaction} from "../Reaction";
|
|
3
4
|
|
|
4
5
|
export interface Messages {
|
|
5
6
|
location: ChatLocation;
|
|
6
7
|
messages: Message[];
|
|
8
|
+
/** Message id => reactions of the asking user; present only when requested. */
|
|
9
|
+
myReactions?: Record<string, UserReaction[]>;
|
|
7
10
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {ToggledReaction} from "../Reaction";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sent to every client of the voting user, so all of their devices know what they
|
|
5
|
+
* voted for without refetching the message history.
|
|
6
|
+
*/
|
|
7
|
+
export interface Reacted {
|
|
8
|
+
messageId: string;
|
|
9
|
+
reaction: ToggledReaction;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {ReactionType} from "../Reaction";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Who reacted, oldest vote first. Only the ids travel - the nicks are already
|
|
5
|
+
* known from the room members collection.
|
|
6
|
+
*/
|
|
7
|
+
export interface ReactionDetails {
|
|
8
|
+
messageId: string;
|
|
9
|
+
type: ReactionType;
|
|
10
|
+
value: string;
|
|
11
|
+
userIds: string[];
|
|
12
|
+
}
|