@devanachat/sdk 0.10.0 → 0.11.0
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/CHANGELOG.md +33 -0
- package/build/index.cjs.js +171 -32
- package/build/index.cjs.js.map +1 -1
- package/build/index.mjs +170 -33
- package/build/index.mjs.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/build/types/AbstractChatClient.d.ts +4 -2
- package/build/types/Permissions.d.ts +8 -0
- package/build/types/index.d.ts +3 -2
- package/build/types/protocol/index.d.ts +4 -2
- package/build/types/protocol/schemes/Role.d.ts +6 -0
- package/build/types/protocol/schemes/Space.d.ts +1 -0
- package/build/types/protocol/schemes/Topic.d.ts +1 -0
- package/build/types/protocol/schemes/commands/CreateMessage.d.ts +1 -0
- package/build/types/protocol/schemes/commands/Type.d.ts +4 -0
- package/build/types/protocol/schemes/commands/UpdateRole.d.ts +2 -0
- package/build/types/protocol/schemes/commands/UpdateSpace.d.ts +1 -0
- package/build/types/protocol/schemes/commands/UpdateTopic.d.ts +1 -0
- package/build/types/protocol/schemes/events/Error.d.ts +2 -0
- package/build/types/protocol/schemes/events/NewMessage.d.ts +1 -0
- package/build/types/protocol/schemes/events/Typing.d.ts +5 -0
- package/build/types/state-tracker/PermissionsManager.d.ts +1 -1
- package/build/types/state-tracker/RoomsManager.d.ts +2 -0
- package/build/types/state-tracker/TypingManager.d.ts +35 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bye, GetSession, JoinSpace, Session, SpaceJoined, Error as ErrorType, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMemberUpdated, SpaceDeleted, SpaceMembers, SpaceRooms, NewRole, RoomDeleted, RoomJoined, RoomLeft, RoomMemberLeft, RoomMembersJoined, RoomMembers, NewRoom, NewTopic, TopicDeleted, NewMessage, GetPermissionOverwrites, GetComputedPermissions, ComputedPermissions, LeaveSpace, CreateSpace, DeleteSpace, GetSpaceMembers, GetSpaceRooms, CreateRole, DeleteRole, AssignRole, DeassignRole, SetPermissionOverwrites, JoinRoom, LeaveRoom, GetIgnoredRooms, IgnoredRooms, CreateRoom, DeleteRoom, GetRoomMembers, CreateTopic, DeleteTopic, CreateMessage, Envelope, PermissionOverwrites, PermissionOverwritesUpdated, RoomMemberUpdated, UpdateRole, RoleUpdated, Ack, UserUpdated, UpdateRoom, RoomUpdated, UpdateSpace, SpaceUpdated, PermissionOverwriteTargets, GetPermissionOverwriteTargets, Owners, Ok, GetOwners, CreateOwner, RoleDeleted, FollowedTopicUpdated, TopicFollowed, FollowedTopics, FollowTopic, UpdateFollowedTopic, GetFollowedTopics, Messages, GetMessages, SearchMessages, FoundMessages, Topics, GetTopics, TopicUpdated, UpdateTopic, GetDiscoverableSpaces, DiscoverableSpaces, CreateEmoticon, DeleteEmoticon, GetEmoticons, Emoticons, EmoticonDeleted, NewEmoticon, Bans, GetBans, Ban, Unban, Kick, ClientData, GetClientData, SetClientData, GetRoomSummary, GetSpaceSummary, RoomSummaryEvent, SpaceSummaryEvent, UpdateSpaceMember, Relationships, RelationshipDeleted, NewRelationship, DeleteRelationship, CreateRelationship, RoomSummaryUpdated, Pong, Ping, RedactMessages, MessagesRedacted, ReportAbuse, UpdateRoomMember, GetRelationships, GetUserInfo, UserInfo, SetSessionData, SessionData, GetSessionData, SetUserData, UserData, GetUserData, UnfollowTopic, TopicUnfollowed, Invite, Uninvite, GetInvited, Invited, React, Unreact, GetReactionDetails, ReactionUpdated, Reacted, ReactionDetails, GetEntitlements, Entitlements, EntitlementUsage, CreateAccessTicket, AccessTicket } from "./protocol";
|
|
1
|
+
import { Bye, GetSession, JoinSpace, Session, SpaceJoined, Error as ErrorType, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMemberUpdated, SpaceDeleted, SpaceMembers, SpaceRooms, NewRole, RoomDeleted, RoomJoined, RoomLeft, RoomMemberLeft, RoomMembersJoined, RoomMembers, NewRoom, NewTopic, TopicDeleted, NewMessage, GetPermissionOverwrites, GetComputedPermissions, ComputedPermissions, LeaveSpace, CreateSpace, DeleteSpace, GetSpaceMembers, GetSpaceRooms, CreateRole, DeleteRole, AssignRole, DeassignRole, SetPermissionOverwrites, JoinRoom, LeaveRoom, GetIgnoredRooms, IgnoredRooms, CreateRoom, DeleteRoom, GetRoomMembers, CreateTopic, DeleteTopic, CreateMessage, Envelope, PermissionOverwrites, PermissionOverwritesUpdated, RoomMemberUpdated, UpdateRole, RoleUpdated, Ack, UserUpdated, UpdateRoom, RoomUpdated, UpdateSpace, SpaceUpdated, PermissionOverwriteTargets, GetPermissionOverwriteTargets, Owners, Ok, GetOwners, CreateOwner, RoleDeleted, FollowedTopicUpdated, TopicFollowed, FollowedTopics, FollowTopic, UpdateFollowedTopic, GetFollowedTopics, Messages, GetMessages, SearchMessages, FoundMessages, Topics, GetTopics, TopicUpdated, UpdateTopic, GetDiscoverableSpaces, DiscoverableSpaces, CreateEmoticon, DeleteEmoticon, GetEmoticons, Emoticons, EmoticonDeleted, NewEmoticon, Bans, GetBans, Ban, Unban, Kick, ClientData, GetClientData, SetClientData, GetRoomSummary, GetSpaceSummary, RoomSummaryEvent, SpaceSummaryEvent, UpdateSpaceMember, Relationships, RelationshipDeleted, NewRelationship, DeleteRelationship, CreateRelationship, RoomSummaryUpdated, Pong, Ping, RedactMessages, MessagesRedacted, ReportAbuse, UpdateRoomMember, GetRelationships, GetUserInfo, UserInfo, SetSessionData, SessionData, GetSessionData, SetUserData, UserData, GetUserData, UnfollowTopic, TopicUnfollowed, Invite, Uninvite, GetInvited, Invited, React, Unreact, GetReactionDetails, ReactionUpdated, Reacted, ReactionDetails, Type, Typing, GetEntitlements, Entitlements, EntitlementUsage, CreateAccessTicket, AccessTicket } from "./protocol";
|
|
2
2
|
import { EventTarget } from "./EventTarget";
|
|
3
3
|
type ArrayOfPromiseResolvers = [(value: any) => void, (reason?: any) => void];
|
|
4
4
|
type ExtraEventMap = Record<string, any>;
|
|
@@ -105,6 +105,7 @@ export type EventsMap = {
|
|
|
105
105
|
ReactionUpdated: ReactionUpdated;
|
|
106
106
|
Reacted: Reacted;
|
|
107
107
|
ReactionDetails: ReactionDetails;
|
|
108
|
+
Typing: Typing;
|
|
108
109
|
};
|
|
109
110
|
/**
|
|
110
111
|
* Map of commands and their corresponding events.
|
|
@@ -155,7 +156,7 @@ export type CommandsMap = {
|
|
|
155
156
|
GetSpaceSummary: CommandDefinition<GetSpaceSummary, EventsMap['SpaceSummaryEvent']>;
|
|
156
157
|
UpdateSpaceMember: CommandDefinition<UpdateSpaceMember, EventsMap['SpaceMemberUpdated']>;
|
|
157
158
|
JoinRoom: CommandDefinition<JoinRoom, EventsMap['RoomJoined']>;
|
|
158
|
-
LeaveRoom: CommandDefinition<LeaveRoom, EventsMap['RoomLeft']
|
|
159
|
+
LeaveRoom: CommandDefinition<LeaveRoom, EventsMap['RoomLeft']>;
|
|
159
160
|
GetIgnoredRooms: CommandDefinition<GetIgnoredRooms, EventsMap['IgnoredRooms']>;
|
|
160
161
|
CreateRoom: CommandDefinition<CreateRoom, EventsMap['RoomJoined']>;
|
|
161
162
|
DeleteRoom: CommandDefinition<DeleteRoom, EventsMap['RoomDeleted']>;
|
|
@@ -182,5 +183,6 @@ export type CommandsMap = {
|
|
|
182
183
|
React: CommandDefinition<React, EventsMap['Reacted']>;
|
|
183
184
|
Unreact: CommandDefinition<Unreact, EventsMap['Reacted']>;
|
|
184
185
|
GetReactionDetails: CommandDefinition<GetReactionDetails, EventsMap['ReactionDetails']>;
|
|
186
|
+
Type: CommandDefinition<Type, EventsMap['Ok']>;
|
|
185
187
|
};
|
|
186
188
|
export {};
|
|
@@ -114,6 +114,14 @@ export declare class Permissions {
|
|
|
114
114
|
value: number;
|
|
115
115
|
maxLayer: Layer;
|
|
116
116
|
};
|
|
117
|
+
ManagePins: {
|
|
118
|
+
value: number;
|
|
119
|
+
maxLayer: Layer;
|
|
120
|
+
};
|
|
121
|
+
SendAttachments: {
|
|
122
|
+
value: number;
|
|
123
|
+
maxLayer: Layer;
|
|
124
|
+
};
|
|
117
125
|
};
|
|
118
126
|
static getNames(): (keyof typeof this.list)[];
|
|
119
127
|
static getByName(name: keyof typeof this.list): PermissionDefinition | undefined;
|
package/build/types/index.d.ts
CHANGED
|
@@ -11,11 +11,12 @@ import { UnreadSummary } from "./state-tracker/FollowedTopicsManager";
|
|
|
11
11
|
import { TopicHistoryWindow } from "./state-tracker/TopicHistoryWindow";
|
|
12
12
|
import { PermissionsManager } from "./state-tracker/PermissionsManager";
|
|
13
13
|
import { STATE_SNAPSHOT_VERSION } from "./state-tracker/StateSnapshot";
|
|
14
|
-
|
|
14
|
+
import { TYPING_INTERVAL_MS, TYPING_TIMEOUT_MS, TypingManager, TypingUsers } from "./state-tracker/TypingManager";
|
|
15
|
+
export { IndexedCollection, ObservableIndexedCollection, IndexedObjectCollection, ObservableIndexedObjectCollection, Permissions, PermissionDefinition, Layer, WebSocketChatClient, WebApiChatClient, FilesClient, AbstractRestClient, extractUserFromMember, isGroupPm, getPmPeers, ErrorCode, PmParticipantFlag, UserStatus, RoleFlag, SpaceFeature, UserFeature, HistoryRotation, SearchRange, UiPurpose, SpaceIntent, NO_LIMIT, STORAGE_UNIT_BYTES, STATE_SNAPSHOT_VERSION, TYPING_INTERVAL_MS, TYPING_TIMEOUT_MS, };
|
|
15
16
|
export type { CommandResult, CommandRequest, CommandResponse, CommandsMap, EventsMap, } from "./AbstractChatClient";
|
|
16
17
|
export type { WebSocketClientOptions } from "./WebSocketChatClient";
|
|
17
18
|
export type { WebApiChatClientOptions } from "./WebApiChatClient";
|
|
18
19
|
export type { RestClientOptions, RestClientResponse } from "./AbstractRestClient";
|
|
19
20
|
export type { EventHandler, ObservableInterface } from "./EventTarget";
|
|
20
21
|
export type { StateSnapshot, SpaceRoomsSnapshot, RoomFollowedTopicsSnapshot, EmoticonsSnapshot, StateSnapshotIntent, TopicHistorySnapshot, RoomMembersSnapshot, } from "./state-tracker/StateSnapshot";
|
|
21
|
-
export type { ChatTypes, File, UnreadSummary, TopicHistoryWindow, PermissionsManager, };
|
|
22
|
+
export type { ChatTypes, File, UnreadSummary, TopicHistoryWindow, PermissionsManager, TypingManager, TypingUsers, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Envelope } from "./schemes/Envelope";
|
|
2
2
|
import { Message, MessageType, MessageAuthor, MessageMentions } from "./schemes/Message";
|
|
3
3
|
import { PermissionOverwritesValue } from "./schemes/PermissionOverwritesValue";
|
|
4
|
-
import { Role, RoleFlag } from "./schemes/Role";
|
|
4
|
+
import { Role, RoleFlag, RoleIcon } from "./schemes/Role";
|
|
5
5
|
import { Room, RoomType } from "./schemes/Room";
|
|
6
6
|
import { PmParticipant, PmParticipantFlag } from "./schemes/PmParticipant";
|
|
7
7
|
import { RoomMember } from "./schemes/RoomMember";
|
|
@@ -158,11 +158,13 @@ import { GetReactionDetails } from "./schemes/commands/GetReactionDetails";
|
|
|
158
158
|
import { ReactionUpdated } from "./schemes/events/ReactionUpdated";
|
|
159
159
|
import { Reacted } from "./schemes/events/Reacted";
|
|
160
160
|
import { ReactionDetails } from "./schemes/events/ReactionDetails";
|
|
161
|
+
import { Type } from "./schemes/commands/Type";
|
|
162
|
+
import { Typing } from "./schemes/events/Typing";
|
|
161
163
|
import { EntitlementsExtras, EntitlementsMap, EntitlementsSubject, EntitlementTarget, EntitlementValue, HistoryRotation, NO_LIMIT, SearchRange, SpaceFeature, STORAGE_UNIT_BYTES, UiPurpose, UserFeature } from "./schemes/Entitlements";
|
|
162
164
|
import { GetEntitlements } from "./schemes/commands/GetEntitlements";
|
|
163
165
|
import { Entitlements } from "./schemes/events/Entitlements";
|
|
164
166
|
import { EntitlementUsage } from "./schemes/events/EntitlementUsage";
|
|
165
167
|
import { CreateAccessTicket, TicketAudience } from "./schemes/commands/CreateAccessTicket";
|
|
166
168
|
import { AccessTicket } from "./schemes/events/AccessTicket";
|
|
167
|
-
export type { Envelope, Message, MessageType, MessageAuthor, MessageMentions, Role, Room, RoomType, PmParticipant, RoomStream, RoomStreamType, RoomHistory, RoomHistoryMode, RoomMember, RoomSummary, RoomSummaryExtras, Space, SpaceMember, Topic, FollowedTopic, NotificationLevel, User, UserState, PermissionOverwritesValue, ChatLocation, SpaceSummary, SpaceDiscoverable, Emoticon, PermissionOverwritesTarget, BanObject, LeaveReason, UserRelationship, UserRelationshipType, CreateTopicInitialMessage, UserInformation, SessionPush, SessionData, SessionPlatform, UserData, PrivateMessagePolicy, ReactionType, MessageReaction, UserReaction, ToggledReaction, MessagePoll, MessagePollOption, EntitlementTarget, EntitlementsSubject, EntitlementValue, EntitlementsMap, EntitlementsExtras, TicketAudience, Bye, Error, ErrorDetails, IgnoredRooms, Messages, FoundMessages, FoundMessage, TextRange, 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, Entitlements, EntitlementUsage, AccessTicket, AssignRole, GetMessages, SearchMessages, SearchDate, 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, GetIgnoredRooms, 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, GetEntitlements, CreateAccessTicket, };
|
|
169
|
+
export type { Envelope, Message, MessageType, MessageAuthor, MessageMentions, Role, RoleIcon, Room, RoomType, PmParticipant, RoomStream, RoomStreamType, RoomHistory, RoomHistoryMode, RoomMember, RoomSummary, RoomSummaryExtras, Space, SpaceMember, Topic, FollowedTopic, NotificationLevel, User, UserState, PermissionOverwritesValue, ChatLocation, SpaceSummary, SpaceDiscoverable, Emoticon, PermissionOverwritesTarget, BanObject, LeaveReason, UserRelationship, UserRelationshipType, CreateTopicInitialMessage, UserInformation, SessionPush, SessionData, SessionPlatform, UserData, PrivateMessagePolicy, ReactionType, MessageReaction, UserReaction, ToggledReaction, MessagePoll, MessagePollOption, EntitlementTarget, EntitlementsSubject, EntitlementValue, EntitlementsMap, EntitlementsExtras, TicketAudience, Bye, Error, ErrorDetails, IgnoredRooms, Messages, FoundMessages, FoundMessage, TextRange, 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, Typing, Entitlements, EntitlementUsage, AccessTicket, AssignRole, GetMessages, SearchMessages, SearchDate, 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, GetIgnoredRooms, 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, Type, GetEntitlements, CreateAccessTicket, };
|
|
168
170
|
export { ErrorCode, NO_LIMIT, STORAGE_UNIT_BYTES, HistoryRotation, PmParticipantFlag, RoleFlag, SearchRange, SpaceFeature, SpaceIntent, UiPurpose, UserFeature, UserStatus, };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactionType } from "./Reaction";
|
|
1
2
|
/**
|
|
2
3
|
* Bit flags of a role, stored in {@link Role.flags}.
|
|
3
4
|
*
|
|
@@ -11,10 +12,15 @@ export declare enum RoleFlag {
|
|
|
11
12
|
SeparateOnMembersList = 1,
|
|
12
13
|
MentionableByEveryone = 2
|
|
13
14
|
}
|
|
15
|
+
export interface RoleIcon {
|
|
16
|
+
type: ReactionType;
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
14
19
|
export interface Role {
|
|
15
20
|
id: string;
|
|
16
21
|
priority: number;
|
|
17
22
|
name: string;
|
|
18
23
|
color?: string;
|
|
19
24
|
flags: number;
|
|
25
|
+
icon?: RoleIcon | null;
|
|
20
26
|
}
|
|
@@ -5,6 +5,7 @@ export interface Error {
|
|
|
5
5
|
code: string;
|
|
6
6
|
message: string;
|
|
7
7
|
details?: ErrorDetails | null;
|
|
8
|
+
subcode?: string | null;
|
|
8
9
|
}
|
|
9
10
|
export declare enum ErrorCode {
|
|
10
11
|
Authentication = "AuthenticationException",
|
|
@@ -14,6 +15,7 @@ export declare enum ErrorCode {
|
|
|
14
15
|
MessageNotFound = "MessageNotFoundException",
|
|
15
16
|
RoomIgnored = "RoomIgnoredException",
|
|
16
17
|
RoomNotFound = "RoomNotFoundException",
|
|
18
|
+
SpaceJoinRestricted = "SpaceJoinRestrictedException",
|
|
17
19
|
TopicNotFound = "TopicNotFoundException",
|
|
18
20
|
UserNotFound = "UserNotFoundException"
|
|
19
21
|
}
|
|
@@ -40,7 +40,7 @@ export declare class PermissionsManager extends EventTarget<PermissionsManagerEv
|
|
|
40
40
|
*/
|
|
41
41
|
private deleteOverwritesByIdPrefix;
|
|
42
42
|
private collectRoleOverwrites;
|
|
43
|
-
private
|
|
43
|
+
private mergeRolesOverwrites;
|
|
44
44
|
private resolveOverwritesHierarchy;
|
|
45
45
|
private getRootAccessValue;
|
|
46
46
|
private fetchComputedPermissions;
|
|
@@ -3,11 +3,13 @@ import { Room, RoomMember, Topic } from "../protocol";
|
|
|
3
3
|
import { ChatStateTracker } from "./ChatStateTracker";
|
|
4
4
|
import { MessagesManager } from "./MessagesManager";
|
|
5
5
|
import { FollowedTopicsManager } from "./FollowedTopicsManager";
|
|
6
|
+
import { TypingManager } from "./TypingManager";
|
|
6
7
|
import { RoomMembersSnapshot, StateSnapshotIntent, TopicHistorySnapshot } from "./StateSnapshot";
|
|
7
8
|
export declare class RoomsManager {
|
|
8
9
|
private tracker;
|
|
9
10
|
readonly messages: MessagesManager;
|
|
10
11
|
readonly followedTopics: FollowedTopicsManager;
|
|
12
|
+
readonly typing: TypingManager;
|
|
11
13
|
private readonly list;
|
|
12
14
|
private readonly topics;
|
|
13
15
|
private readonly members;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ChatStateTracker } from "./ChatStateTracker";
|
|
2
|
+
import { ObservableIndexedCollection } from "../IndexedObjectCollection";
|
|
3
|
+
export declare const TYPING_INTERVAL_MS = 5000;
|
|
4
|
+
export declare const TYPING_TIMEOUT_MS: number;
|
|
5
|
+
/**
|
|
6
|
+
* Ids of the users typing in a topic, each mapped to the time (`Date.now()`) its typing expires at.
|
|
7
|
+
*/
|
|
8
|
+
export type TypingUsers = ObservableIndexedCollection<string, number>;
|
|
9
|
+
export declare class TypingManager {
|
|
10
|
+
private tracker;
|
|
11
|
+
private readonly topics;
|
|
12
|
+
private readonly lastSentAt;
|
|
13
|
+
constructor(tracker: ChatStateTracker);
|
|
14
|
+
/**
|
|
15
|
+
* Users typing in the topic, without you. Tracking of the topic starts with the first call, so the collection
|
|
16
|
+
* fills up with the next notifications, within {@link TYPING_INTERVAL_MS}. A user leaves it
|
|
17
|
+
* {@link TYPING_TIMEOUT_MS} after their last notification or at once with their message in the topic.
|
|
18
|
+
* Only ids are kept - resolve the users yourself, e.g. from {@link RoomsManager.getMembers}.
|
|
19
|
+
*/
|
|
20
|
+
get(roomId: string, topicId: string): TypingUsers;
|
|
21
|
+
/**
|
|
22
|
+
* Tell the other members of the room that you are typing in the topic. Call it on every change of the text:
|
|
23
|
+
* the command is sent at most once per {@link TYPING_INTERVAL_MS} for a topic, and again right after your
|
|
24
|
+
* message in it. Classic rooms do not support typing.
|
|
25
|
+
*/
|
|
26
|
+
notify(roomId: string, topicId: string): void;
|
|
27
|
+
private handleTyping;
|
|
28
|
+
private handleNewMessage;
|
|
29
|
+
private handleTopicDeleted;
|
|
30
|
+
private handleRoomGone;
|
|
31
|
+
private handleSession;
|
|
32
|
+
private clear;
|
|
33
|
+
private scheduleExpiry;
|
|
34
|
+
private expire;
|
|
35
|
+
}
|
package/package.json
CHANGED