@devanachat/sdk 0.10.0 → 0.12.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +2 -2
  3. package/build/index.cjs.js +533 -147
  4. package/build/index.cjs.js.map +1 -1
  5. package/build/index.mjs +531 -148
  6. package/build/index.mjs.map +1 -1
  7. package/build/index.umd.js +1 -1
  8. package/build/index.umd.js.map +1 -1
  9. package/build/types/AbstractChatClient.d.ts +21 -4
  10. package/build/types/Permissions.d.ts +13 -1
  11. package/build/types/index.d.ts +4 -3
  12. package/build/types/protocol/index.d.ts +18 -4
  13. package/build/types/protocol/schemes/Message.d.ts +4 -0
  14. package/build/types/protocol/schemes/MessageEmbed.d.ts +83 -0
  15. package/build/types/protocol/schemes/Role.d.ts +6 -0
  16. package/build/types/protocol/schemes/Space.d.ts +1 -0
  17. package/build/types/protocol/schemes/Topic.d.ts +1 -0
  18. package/build/types/protocol/schemes/commands/AckInteraction.d.ts +10 -0
  19. package/build/types/protocol/schemes/commands/CreateMessage.d.ts +8 -0
  20. package/build/types/protocol/schemes/commands/GetGifCategories.d.ts +3 -0
  21. package/build/types/protocol/schemes/commands/GetMessages.d.ts +1 -0
  22. package/build/types/protocol/schemes/commands/Interact.d.ts +5 -0
  23. package/build/types/protocol/schemes/commands/SearchGifs.d.ts +5 -0
  24. package/build/types/protocol/schemes/commands/Type.d.ts +4 -0
  25. package/build/types/protocol/schemes/commands/UpdateMessage.d.ts +8 -0
  26. package/build/types/protocol/schemes/commands/UpdateRole.d.ts +2 -0
  27. package/build/types/protocol/schemes/commands/UpdateSpace.d.ts +1 -0
  28. package/build/types/protocol/schemes/commands/UpdateTopic.d.ts +1 -0
  29. package/build/types/protocol/schemes/events/Error.d.ts +3 -0
  30. package/build/types/protocol/schemes/events/FoundGifs.d.ts +14 -0
  31. package/build/types/protocol/schemes/events/GifCategories.d.ts +8 -0
  32. package/build/types/protocol/schemes/events/Interacted.d.ts +4 -0
  33. package/build/types/protocol/schemes/events/InteractionResolved.d.ts +7 -0
  34. package/build/types/protocol/schemes/events/MessageUpdated.d.ts +6 -0
  35. package/build/types/protocol/schemes/events/Messages.d.ts +6 -2
  36. package/build/types/protocol/schemes/events/NewInteraction.d.ts +10 -0
  37. package/build/types/protocol/schemes/events/NewMessage.d.ts +4 -0
  38. package/build/types/protocol/schemes/events/Typing.d.ts +5 -0
  39. package/build/types/state-tracker/PermissionsManager.d.ts +1 -1
  40. package/build/types/state-tracker/RoomMessagesHistory.d.ts +7 -2
  41. package/build/types/state-tracker/RoomsManager.d.ts +14 -1
  42. package/build/types/state-tracker/StateSnapshot.d.ts +5 -1
  43. package/build/types/state-tracker/TopicHistoryWindow.d.ts +29 -2
  44. package/build/types/state-tracker/TypingManager.d.ts +35 -0
  45. package/build/types/state-tracker/functions.d.ts +8 -1
  46. 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, UpdateMessage, MessageUpdated, SearchGifs, GetGifCategories, FoundGifs, GifCategories, ReportAbuse, UpdateRoomMember, GetRelationships, GetUserInfo, UserInfo, SetSessionData, SessionData, GetSessionData, SetUserData, UserData, GetUserData, UnfollowTopic, TopicUnfollowed, Invite, Uninvite, GetInvited, Invited, React, Interact, AckInteraction, Unreact, GetReactionDetails, ReactionUpdated, Reacted, NewInteraction, Interacted, InteractionResolved, 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>;
@@ -102,9 +102,16 @@ export type EventsMap = {
102
102
  Topics: Topics;
103
103
  TopicUpdated: TopicUpdated;
104
104
  MessagesRedacted: MessagesRedacted;
105
+ MessageUpdated: MessageUpdated;
106
+ FoundGifs: FoundGifs;
107
+ GifCategories: GifCategories;
105
108
  ReactionUpdated: ReactionUpdated;
106
109
  Reacted: Reacted;
110
+ NewInteraction: NewInteraction;
111
+ Interacted: Interacted;
112
+ InteractionResolved: InteractionResolved;
107
113
  ReactionDetails: ReactionDetails;
114
+ Typing: Typing;
108
115
  };
109
116
  /**
110
117
  * Map of commands and their corresponding events.
@@ -155,7 +162,7 @@ export type CommandsMap = {
155
162
  GetSpaceSummary: CommandDefinition<GetSpaceSummary, EventsMap['SpaceSummaryEvent']>;
156
163
  UpdateSpaceMember: CommandDefinition<UpdateSpaceMember, EventsMap['SpaceMemberUpdated']>;
157
164
  JoinRoom: CommandDefinition<JoinRoom, EventsMap['RoomJoined']>;
158
- LeaveRoom: CommandDefinition<LeaveRoom, EventsMap['RoomLeft'] | EventsMap['Ok']>;
165
+ LeaveRoom: CommandDefinition<LeaveRoom, EventsMap['RoomLeft']>;
159
166
  GetIgnoredRooms: CommandDefinition<GetIgnoredRooms, EventsMap['IgnoredRooms']>;
160
167
  CreateRoom: CommandDefinition<CreateRoom, EventsMap['RoomJoined']>;
161
168
  DeleteRoom: CommandDefinition<DeleteRoom, EventsMap['RoomDeleted']>;
@@ -168,7 +175,8 @@ export type CommandsMap = {
168
175
  GetInvited: CommandDefinition<GetInvited, EventsMap['Invited']>;
169
176
  CreateTopic: CommandDefinition<CreateTopic, EventsMap['NewTopic']>;
170
177
  DeleteTopic: CommandDefinition<DeleteTopic, EventsMap['TopicDeleted']>;
171
- CreateMessage: CommandDefinition<CreateMessage, EventsMap['NewMessage']>;
178
+ /** `Ok` for an ephemeral message (`ephemeralFor`), which goes to its recipient alone. */
179
+ CreateMessage: CommandDefinition<CreateMessage, EventsMap['NewMessage'] | EventsMap['Ok']>;
172
180
  Ack: CommandDefinition<Ack, EventsMap['FollowedTopicUpdated'] | EventsMap['Ok']>;
173
181
  FollowTopic: CommandDefinition<FollowTopic, EventsMap['TopicFollowed']>;
174
182
  UnfollowTopic: CommandDefinition<UnfollowTopic, EventsMap['TopicUnfollowed']>;
@@ -179,8 +187,17 @@ export type CommandsMap = {
179
187
  GetTopics: CommandDefinition<GetTopics, EventsMap['Topics']>;
180
188
  UpdateTopic: CommandDefinition<UpdateTopic, EventsMap['TopicUpdated']>;
181
189
  RedactMessages: CommandDefinition<RedactMessages, EventsMap['MessagesRedacted']>;
190
+ /** Resolves with `Ok` when the edit changes nothing. */
191
+ UpdateMessage: CommandDefinition<UpdateMessage, EventsMap['MessageUpdated'] | EventsMap['Ok']>;
192
+ /** Available when the server runs GIF search; featured GIFs without a query. */
193
+ SearchGifs: CommandDefinition<SearchGifs, EventsMap['FoundGifs']>;
194
+ GetGifCategories: CommandDefinition<GetGifCategories, EventsMap['GifCategories']>;
182
195
  React: CommandDefinition<React, EventsMap['Reacted']>;
183
- Unreact: CommandDefinition<Unreact, EventsMap['Reacted']>;
196
+ Interact: CommandDefinition<Interact, EventsMap['Interacted']>;
197
+ AckInteraction: CommandDefinition<AckInteraction, EventsMap['Ok']>;
198
+ /** `Ok` when the user had no such reaction. */
199
+ Unreact: CommandDefinition<Unreact, EventsMap['Reacted'] | EventsMap['Ok']>;
184
200
  GetReactionDetails: CommandDefinition<GetReactionDetails, EventsMap['ReactionDetails']>;
201
+ Type: CommandDefinition<Type, EventsMap['Ok']>;
185
202
  };
186
203
  export {};
@@ -82,7 +82,7 @@ export declare class Permissions {
82
82
  value: number;
83
83
  maxLayer: Layer;
84
84
  };
85
- RedactMessages: {
85
+ ManageMessages: {
86
86
  value: number;
87
87
  maxLayer: Layer;
88
88
  };
@@ -114,6 +114,18 @@ 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
+ };
125
+ EditMessages: {
126
+ value: number;
127
+ maxLayer: Layer;
128
+ };
117
129
  };
118
130
  static getNames(): (keyof typeof this.list)[];
119
131
  static getByName(name: keyof typeof this.list): PermissionDefinition | undefined;
@@ -4,18 +4,19 @@ 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 './protocol';
7
- import { ErrorCode, HistoryRotation, NO_LIMIT, PmParticipantFlag, RoleFlag, SearchRange, UiPurpose, SpaceFeature, SpaceIntent, STORAGE_UNIT_BYTES, UserFeature, UserStatus } from './protocol';
7
+ import { ErrorCode, HistoryRotation, MessageEmbedFlag, NO_LIMIT, PmParticipantFlag, RoleFlag, SearchRange, UiPurpose, SpaceFeature, SpaceIntent, STORAGE_UNIT_BYTES, UserFeature, UserStatus } from './protocol';
8
8
  import { extractUserFromMember, getPmPeers, isGroupPm } from "./state-tracker/functions";
9
9
  import { AbstractRestClient } from "./AbstractRestClient";
10
10
  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
- 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, };
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, MessageEmbedFlag, 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,8 @@
1
1
  import { Envelope } from "./schemes/Envelope";
2
2
  import { Message, MessageType, MessageAuthor, MessageMentions } from "./schemes/Message";
3
+ import { MessageEmbed, MessageEmbedType, MessageEmbedFlag, SendableEmbed, EmbedTone, EmbedComponent, EmbedContainer, EmbedColumns, EmbedColumn, EmbedSeparator, EmbedText, EmbedMedia, EmbedMediaItem, EmbedPlayer, EmbedButton, EmbedSelect, EmbedSelectOption } from "./schemes/MessageEmbed";
3
4
  import { PermissionOverwritesValue } from "./schemes/PermissionOverwritesValue";
4
- import { Role, RoleFlag } from "./schemes/Role";
5
+ import { Role, RoleFlag, RoleIcon } from "./schemes/Role";
5
6
  import { Room, RoomType } from "./schemes/Room";
6
7
  import { PmParticipant, PmParticipantFlag } from "./schemes/PmParticipant";
7
8
  import { RoomMember } from "./schemes/RoomMember";
@@ -86,7 +87,7 @@ import { TopicFollowed } from "./schemes/events/TopicFollowed";
86
87
  import { GetFollowedTopics } from "./schemes/commands/GetFollowedTopics";
87
88
  import { FollowedTopicUpdated } from "./schemes/events/FollowedTopicUpdated";
88
89
  import { GetMessages } from "./schemes/commands/GetMessages";
89
- import { Messages } from "./schemes/events/Messages";
90
+ import { Messages, MessageUserReactions } from "./schemes/events/Messages";
90
91
  import { SearchMessages, SearchDate } from "./schemes/commands/SearchMessages";
91
92
  import { FoundMessages, FoundMessage, TextRange } from "./schemes/events/FoundMessages";
92
93
  import { Topics } from "./schemes/events/Topics";
@@ -134,6 +135,17 @@ import { Pong } from "./schemes/events/Pong";
134
135
  import { ReportAbuse } from "./schemes/commands/ReportAbuse";
135
136
  import { RedactMessages } from "./schemes/commands/RedactMessages";
136
137
  import { MessagesRedacted } from "./schemes/events/MessagesRedacted";
138
+ import { UpdateMessage } from "./schemes/commands/UpdateMessage";
139
+ import { Interact } from "./schemes/commands/Interact";
140
+ import { NewInteraction } from "./schemes/events/NewInteraction";
141
+ import { Interacted } from "./schemes/events/Interacted";
142
+ import { InteractionResolved, InteractionStatus } from "./schemes/events/InteractionResolved";
143
+ import { AckInteraction } from "./schemes/commands/AckInteraction";
144
+ import { MessageUpdated } from "./schemes/events/MessageUpdated";
145
+ import { SearchGifs } from "./schemes/commands/SearchGifs";
146
+ import { GetGifCategories } from "./schemes/commands/GetGifCategories";
147
+ import { GifCategory, GifCategories } from "./schemes/events/GifCategories";
148
+ import { FoundGif, FoundGifs } from "./schemes/events/FoundGifs";
137
149
  import { GetRelationships } from "./schemes/commands/GetRelationships";
138
150
  import { GetUserInfo } from "./schemes/commands/GetUserInfo";
139
151
  import { UserInfo } from "./schemes/events/UserInfo";
@@ -158,11 +170,13 @@ import { GetReactionDetails } from "./schemes/commands/GetReactionDetails";
158
170
  import { ReactionUpdated } from "./schemes/events/ReactionUpdated";
159
171
  import { Reacted } from "./schemes/events/Reacted";
160
172
  import { ReactionDetails } from "./schemes/events/ReactionDetails";
173
+ import { Type } from "./schemes/commands/Type";
174
+ import { Typing } from "./schemes/events/Typing";
161
175
  import { EntitlementsExtras, EntitlementsMap, EntitlementsSubject, EntitlementTarget, EntitlementValue, HistoryRotation, NO_LIMIT, SearchRange, SpaceFeature, STORAGE_UNIT_BYTES, UiPurpose, UserFeature } from "./schemes/Entitlements";
162
176
  import { GetEntitlements } from "./schemes/commands/GetEntitlements";
163
177
  import { Entitlements } from "./schemes/events/Entitlements";
164
178
  import { EntitlementUsage } from "./schemes/events/EntitlementUsage";
165
179
  import { CreateAccessTicket, TicketAudience } from "./schemes/commands/CreateAccessTicket";
166
180
  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, };
168
- export { ErrorCode, NO_LIMIT, STORAGE_UNIT_BYTES, HistoryRotation, PmParticipantFlag, RoleFlag, SearchRange, SpaceFeature, SpaceIntent, UiPurpose, UserFeature, UserStatus, };
181
+ 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, MessageEmbed, MessageEmbedType, SendableEmbed, EmbedTone, EmbedComponent, EmbedContainer, EmbedColumns, EmbedColumn, EmbedSeparator, EmbedText, EmbedMedia, EmbedMediaItem, EmbedPlayer, EmbedButton, EmbedSelect, EmbedSelectOption, EntitlementTarget, EntitlementsSubject, EntitlementValue, EntitlementsMap, EntitlementsExtras, TicketAudience, Bye, Error, ErrorDetails, IgnoredRooms, Messages, MessageUserReactions, NewInteraction, Interacted, InteractionResolved, InteractionStatus, 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, MessageUpdated, FoundGif, FoundGifs, GifCategory, GifCategories, 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, UpdateMessage, Interact, AckInteraction, SearchGifs, GetGifCategories, GetUserInfo, SetSessionData, GetSessionData, SetUserData, GetUserData, Invite, Uninvite, GetInvited, React, Unreact, GetReactionDetails, Type, GetEntitlements, CreateAccessTicket, };
182
+ export { ErrorCode, MessageEmbedFlag, NO_LIMIT, STORAGE_UNIT_BYTES, HistoryRotation, PmParticipantFlag, RoleFlag, SearchRange, SpaceFeature, SpaceIntent, UiPurpose, UserFeature, UserStatus, };
@@ -2,6 +2,7 @@ import { User } from "./User";
2
2
  import { ChatLocation } from "./ChatLocation";
3
3
  import { MessageReaction } from "./Reaction";
4
4
  import { MessagePoll } from "./MessagePoll";
5
+ import { MessageEmbed } from "./MessageEmbed";
5
6
  export type MessageType = 'Text' | 'RoomJoin' | 'RoomMemberAdd' | 'RoomLeave' | 'SpaceJoin' | 'SpaceLeave' | 'TopicChange' | 'CustomNickChange' | 'Ephemeral' | 'Poll' | 'RoomRename';
6
7
  /**
7
8
  * Mention targets a message actually reached, as resolved by the server: role
@@ -29,4 +30,7 @@ export interface Message {
29
30
  reactions: MessageReaction[];
30
31
  poll?: MessagePoll;
31
32
  mentions: MessageMentions | null;
33
+ editedAt?: string | null;
34
+ replyTo?: string | null;
35
+ embed?: MessageEmbed | null;
32
36
  }
@@ -0,0 +1,83 @@
1
+ export type MessageEmbedType = 'Link' | 'Video' | 'Gif' | 'Rich';
2
+ export declare enum MessageEmbedFlag {
3
+ HideContent = 1,
4
+ Suppressed = 2
5
+ }
6
+ export interface MessageEmbed {
7
+ type: MessageEmbedType;
8
+ root: EmbedComponent[];
9
+ flags: number;
10
+ }
11
+ export interface SendableEmbed {
12
+ root: EmbedComponent[];
13
+ hideContent?: boolean;
14
+ }
15
+ export type EmbedTone = 'Accent' | 'Positive' | 'Warning' | 'Danger' | 'Muted';
16
+ export interface EmbedContainer {
17
+ type: 'Container';
18
+ style?: 'Filled' | 'Outlined' | 'Plain';
19
+ accent?: EmbedTone | string;
20
+ spoiler?: boolean;
21
+ collapsible?: number;
22
+ children: EmbedComponent[];
23
+ }
24
+ export interface EmbedColumns {
25
+ type: 'Columns';
26
+ stack?: 'Auto' | 'Never';
27
+ children: EmbedColumn[];
28
+ }
29
+ export interface EmbedColumn {
30
+ type: 'Column';
31
+ weight?: 1 | 2 | 3 | 'Auto';
32
+ align?: 'Start' | 'Center';
33
+ children: EmbedComponent[];
34
+ }
35
+ export interface EmbedSeparator {
36
+ type: 'Separator';
37
+ }
38
+ export interface EmbedText {
39
+ type: 'Text';
40
+ content: string;
41
+ align?: 'Start' | 'Center';
42
+ }
43
+ export interface EmbedMediaItem {
44
+ url?: string;
45
+ attachmentId?: string;
46
+ width?: number;
47
+ height?: number;
48
+ alt?: string;
49
+ animated?: boolean;
50
+ }
51
+ export interface EmbedMedia {
52
+ type: 'Media';
53
+ items: EmbedMediaItem[];
54
+ size?: 'Auto' | 'Thumbnail';
55
+ spoiler?: boolean;
56
+ }
57
+ export interface EmbedPlayer {
58
+ type: 'Player';
59
+ provider: 'YouTube';
60
+ videoId: string;
61
+ start?: number;
62
+ }
63
+ export interface EmbedButton {
64
+ type: 'Button';
65
+ label: string;
66
+ variant?: 'Filled' | 'Tonal' | 'Outlined' | 'Text';
67
+ tone?: 'Default' | 'Danger';
68
+ icon?: string;
69
+ disabled?: boolean;
70
+ url?: string;
71
+ actionId?: string;
72
+ }
73
+ export interface EmbedSelectOption {
74
+ label: string;
75
+ value: string;
76
+ }
77
+ export interface EmbedSelect {
78
+ type: 'Select';
79
+ actionId: string;
80
+ placeholder?: string;
81
+ options: EmbedSelectOption[];
82
+ }
83
+ export type EmbedComponent = EmbedContainer | EmbedColumns | EmbedSeparator | EmbedText | EmbedMedia | EmbedPlayer | EmbedButton | EmbedSelect;
@@ -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
  }
@@ -16,4 +16,5 @@ export interface Space {
16
16
  banner: string | null;
17
17
  discoverable: SpaceDiscoverable;
18
18
  flags: number;
19
+ guestRole: string | null;
19
20
  }
@@ -5,4 +5,5 @@ export interface Topic {
5
5
  messageCount: number;
6
6
  refMessage?: Message;
7
7
  lastMessage?: Message;
8
+ stickyMessage?: Message | null;
8
9
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Answers an interaction without a message or an edit. Bots only; the author of the interacted message.
3
+ * `Timeout` is sent by the server alone.
4
+ */
5
+ export interface AckInteraction {
6
+ interactionId: string;
7
+ status?: 'Ok' | 'Fail';
8
+ /** A short plain text (up to 150 characters) shown to the user who interacted */
9
+ notice?: string;
10
+ }
@@ -1,5 +1,6 @@
1
1
  import { ChatLocation } from "../ChatLocation";
2
2
  import { MessagePoll } from "../MessagePoll";
3
+ import { SendableEmbed } from "../MessageEmbed";
3
4
  export interface CreateMessage {
4
5
  location: ChatLocation;
5
6
  content: string;
@@ -8,4 +9,11 @@ export interface CreateMessage {
8
9
  customColor?: string;
9
10
  /** Turns the message into a poll; its content becomes the question. */
10
11
  poll?: MessagePoll;
12
+ sticky?: boolean;
13
+ replyTo?: string;
14
+ embed?: SendableEmbed;
15
+ /** The interaction the message answers */
16
+ interactionId?: string;
17
+ /** Bots only: the id of the room member the message is shown to; it is not stored and resolves with `Ok` */
18
+ ephemeralFor?: string;
11
19
  }
@@ -0,0 +1,3 @@
1
+ export interface GetGifCategories {
2
+ locale?: string;
3
+ }
@@ -10,4 +10,5 @@ export interface GetMessages {
10
10
  * asking for their own state separately.
11
11
  */
12
12
  includeMyReactions?: boolean;
13
+ includeRepliedMessages?: boolean;
13
14
  }
@@ -0,0 +1,5 @@
1
+ export interface Interact {
2
+ messageId: string;
3
+ actionId: string;
4
+ value?: string;
5
+ }
@@ -0,0 +1,5 @@
1
+ export interface SearchGifs {
2
+ query: string;
3
+ position?: string;
4
+ locale?: string;
5
+ }
@@ -0,0 +1,4 @@
1
+ import { ChatLocation } from "../ChatLocation";
2
+ export interface Type {
3
+ location: ChatLocation;
4
+ }
@@ -0,0 +1,8 @@
1
+ import { SendableEmbed } from "../MessageEmbed";
2
+ export interface UpdateMessage {
3
+ messageId: string;
4
+ content?: string;
5
+ embed?: SendableEmbed | null;
6
+ /** The interaction the edit answers */
7
+ interactionId?: string;
8
+ }
@@ -1,3 +1,4 @@
1
+ import { RoleIcon } from "../Role";
1
2
  export interface UpdateRole {
2
3
  spaceId: string;
3
4
  id: string;
@@ -5,4 +6,5 @@ export interface UpdateRole {
5
6
  name?: string;
6
7
  color?: string;
7
8
  flags?: number;
9
+ icon?: RoleIcon | null;
8
10
  }
@@ -9,4 +9,5 @@ export interface UpdateSpace {
9
9
  banner?: string | null;
10
10
  discoverable?: SpaceDiscoverable;
11
11
  flags?: number;
12
+ guestRole?: string | null;
12
13
  }
@@ -2,4 +2,5 @@ import { ChatLocation } from "../ChatLocation";
2
2
  export interface UpdateTopic {
3
3
  location: ChatLocation;
4
4
  name?: string;
5
+ stickyMessageId?: string | null;
5
6
  }
@@ -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",
@@ -12,8 +13,10 @@ export declare enum ErrorCode {
12
13
  InvalidSearchQuery = "InvalidSearchQueryException",
13
14
  MessageSearchUnavailable = "MessageSearchUnavailableException",
14
15
  MessageNotFound = "MessageNotFoundException",
16
+ ReactionExistsAlready = "ReactionExistsAlreadyException",
15
17
  RoomIgnored = "RoomIgnoredException",
16
18
  RoomNotFound = "RoomNotFoundException",
19
+ SpaceJoinRestricted = "SpaceJoinRestrictedException",
17
20
  TopicNotFound = "TopicNotFoundException",
18
21
  UserNotFound = "UserNotFoundException"
19
22
  }
@@ -0,0 +1,14 @@
1
+ export interface FoundGif {
2
+ id: string;
3
+ url: string;
4
+ title: string;
5
+ width: number;
6
+ height: number;
7
+ posterUrl: string;
8
+ mp4Url: string | null;
9
+ webmUrl: string | null;
10
+ }
11
+ export interface FoundGifs {
12
+ gifs: FoundGif[];
13
+ next: string | null;
14
+ }
@@ -0,0 +1,8 @@
1
+ export interface GifCategory {
2
+ term: string;
3
+ name: string;
4
+ imageUrl: string;
5
+ }
6
+ export interface GifCategories {
7
+ categories: GifCategory[];
8
+ }
@@ -0,0 +1,4 @@
1
+ /** The answer to `Interact`: the id under which the author of the message gets the interaction. */
2
+ export interface Interacted {
3
+ interactionId: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ export type InteractionStatus = 'Ok' | 'Fail' | 'Timeout';
2
+ /** Sent to the user who interacted when a bot acknowledges the interaction or does not answer in time. */
3
+ export interface InteractionResolved {
4
+ interactionId: string;
5
+ status: InteractionStatus;
6
+ notice: string | null;
7
+ }
@@ -0,0 +1,6 @@
1
+ import { Message } from "../Message";
2
+ export interface MessageUpdated {
3
+ message: Message;
4
+ /** The interaction the edit answers */
5
+ interactionId?: string | null;
6
+ }
@@ -1,9 +1,13 @@
1
1
  import { ChatLocation } from "../ChatLocation";
2
2
  import { Message } from "../Message";
3
3
  import { UserReaction } from "../Reaction";
4
+ export interface MessageUserReactions {
5
+ messageId: string;
6
+ reactions: UserReaction[];
7
+ }
4
8
  export interface Messages {
5
9
  location: ChatLocation;
6
10
  messages: Message[];
7
- /** Message id => reactions of the asking user; present only when requested. */
8
- myReactions?: Record<string, UserReaction[]>;
11
+ myReactions?: MessageUserReactions[] | null;
12
+ repliedMessages?: Message[] | null;
9
13
  }
@@ -0,0 +1,10 @@
1
+ import { ChatLocation } from "../ChatLocation";
2
+ import { User } from "../User";
3
+ export interface NewInteraction {
4
+ interactionId: string;
5
+ location: ChatLocation;
6
+ messageId: string;
7
+ user: User;
8
+ actionId: string;
9
+ value: string | null;
10
+ }
@@ -1,4 +1,8 @@
1
1
  import { Message } from "../Message";
2
2
  export interface NewMessage {
3
3
  message: Message;
4
+ sticky?: boolean;
5
+ repliedMessage?: Message | null;
6
+ /** The interaction the message answers */
7
+ interactionId?: string | null;
4
8
  }
@@ -0,0 +1,5 @@
1
+ import { ChatLocation } from "../ChatLocation";
2
+ export interface Typing {
3
+ location: ChatLocation;
4
+ userId: string;
5
+ }
@@ -40,7 +40,7 @@ export declare class PermissionsManager extends EventTarget<PermissionsManagerEv
40
40
  */
41
41
  private deleteOverwritesByIdPrefix;
42
42
  private collectRoleOverwrites;
43
- private resolveOverwritesFromRolesByOrder;
43
+ private mergeRolesOverwrites;
44
44
  private resolveOverwritesHierarchy;
45
45
  private getRootAccessValue;
46
46
  private fetchComputedPermissions;
@@ -1,5 +1,5 @@
1
1
  import { ChatStateTracker } from "./ChatStateTracker";
2
- import { Message, MessagesRedacted, NewMessage, NewTopic, Reacted, ReactionUpdated, Room, RoomUpdated, Topic, TopicDeleted, UserReaction } from "../protocol";
2
+ import { Message, MessagesRedacted, MessageUpdated, NewMessage, NewTopic, Reacted, ReactionUpdated, Room, RoomUpdated, Topic, TopicDeleted, UserReaction } from "../protocol";
3
3
  import { TopicHistoryWindow } from "./TopicHistoryWindow";
4
4
  /**
5
5
  * Does not subscribe to the client itself - the messages manager routes the events of its room to it, so a history
@@ -52,7 +52,7 @@ export declare class RoomMessagesHistory {
52
52
  * For internal use.
53
53
  * @internal
54
54
  */
55
- _restoreWindow(topic: Topic, messages: Message[], myReactions: Record<string, UserReaction[]>): void;
55
+ _restoreWindow(topic: Topic, messages: Message[], myReactions: Record<string, UserReaction[]>, repliedMessages: Message[]): void;
56
56
  /**
57
57
  * For internal use.
58
58
  * @internal
@@ -78,6 +78,11 @@ export declare class RoomMessagesHistory {
78
78
  * @internal
79
79
  */
80
80
  _handleMessagesRedacted(ev: MessagesRedacted): void;
81
+ /**
82
+ * For internal use.
83
+ * @internal
84
+ */
85
+ _handleMessageUpdated(ev: MessageUpdated): void;
81
86
  /**
82
87
  * For internal use.
83
88
  * @internal
@@ -1,13 +1,15 @@
1
1
  import { ObservableIndexedObjectCollection } from "../IndexedObjectCollection";
2
- import { Room, RoomMember, Topic } from "../protocol";
2
+ import { ChatLocation, Room, RoomMember, Topic, MessageUserReactions } 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;
@@ -15,11 +17,19 @@ export declare class RoomsManager {
15
17
  private readonly membersPromises;
16
18
  private readonly topicsPromises;
17
19
  private readonly importedTopicIds;
20
+ private readonly stickyMyReactions;
21
+ private readonly stickyMyReactionsPromises;
18
22
  constructor(tracker: ChatStateTracker);
19
23
  /**
20
24
  * Get collection of room members.
21
25
  */
22
26
  getMembers(roomId: string): Promise<ObservableIndexedObjectCollection<RoomMember> | undefined>;
27
+ /**
28
+ * Get the reactions of the connected user on sticky messages, keyed by message id. A sticky message comes with its
29
+ * topic, outside of the message history, so the reactions of the given one are fetched once and then follow
30
+ * the reactions of the user.
31
+ */
32
+ getStickyMyReactions(location: ChatLocation, messageId: string): Promise<ObservableIndexedObjectCollection<MessageUserReactions>>;
23
33
  /**
24
34
  * Get a room member representing the current user.
25
35
  */
@@ -95,6 +105,9 @@ export declare class RoomsManager {
95
105
  private handleSession;
96
106
  private handleUserUpdated;
97
107
  private handleNewMessage;
108
+ private handleMessageUpdated;
109
+ private handleReactionUpdated;
110
+ private handleReacted;
98
111
  private handleMessagesRedacted;
99
112
  /**
100
113
  * The topics collection is where the message counters of a topic are kept up to date; a room in the list
@@ -2,7 +2,7 @@ import { Emoticon, FollowedTopic, Message, Room, RoomMember, RoomSummary, Space,
2
2
  /**
3
3
  * Version of the {@link StateSnapshot} format. A snapshot of any other version is rejected on import.
4
4
  */
5
- export declare const STATE_SNAPSHOT_VERSION = 2;
5
+ export declare const STATE_SNAPSHOT_VERSION = 3;
6
6
  /**
7
7
  * Plain, JSON-serializable copy of the state tracked by {@link ChatStateTracker}, made to restore the state at the
8
8
  * application start (before the connection is established) - see {@link ChatStateTracker.exportSnapshot}.
@@ -67,6 +67,10 @@ export interface TopicHistorySnapshot {
67
67
  */
68
68
  messages: Message[];
69
69
  myReactions: Record<string, UserReaction[]>;
70
+ /**
71
+ * The messages replied to by the ones above.
72
+ */
73
+ repliedMessages: Message[];
70
74
  /**
71
75
  * The topic of the history (if not the default one of the room) and the topics the messages refer to, as far as
72
76
  * they are known.