@devanachat/sdk 0.0.0-stage → 0.7.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 +81 -0
- package/LICENSE +21 -0
- package/README.md +418 -2
- package/build/index.cjs.js +3656 -0
- package/build/index.cjs.js.map +1 -0
- package/build/index.mjs +3613 -0
- package/build/index.mjs.map +1 -0
- package/build/index.umd.js +2 -0
- package/build/index.umd.js.map +1 -0
- package/build/types/AbstractChatClient.d.ts +184 -0
- package/build/types/AbstractRestClient.d.ts +21 -0
- package/build/types/EventTarget.d.ts +32 -0
- package/build/types/FilesClient.d.ts +16 -0
- package/build/types/IndexedObjectCollection.d.ts +66 -0
- package/build/types/Permissions.d.ts +117 -0
- package/build/types/WebApiChatClient.d.ts +38 -0
- package/build/types/WebSocketChatClient.d.ts +110 -0
- package/build/types/index.d.ts +19 -0
- package/build/types/protocol/index.d.ts +165 -0
- package/build/types/protocol/schemes/BanObject.d.ts +14 -0
- package/build/types/protocol/schemes/ChatLocation.d.ts +5 -0
- package/build/types/protocol/schemes/Emoticon.d.ts +9 -0
- package/build/types/protocol/schemes/Entitlements.d.ts +92 -0
- package/build/types/protocol/schemes/Envelope.d.ts +5 -0
- package/build/types/protocol/schemes/FollowedTopic.d.ts +10 -0
- package/build/types/protocol/schemes/LeaveReason.d.ts +9 -0
- package/build/types/protocol/schemes/Message.d.ts +32 -0
- package/build/types/protocol/schemes/MessagePoll.d.ts +10 -0
- package/build/types/protocol/schemes/PermissionOverwritesTarget.d.ts +5 -0
- package/build/types/protocol/schemes/PermissionOverwritesValue.d.ts +4 -0
- package/build/types/protocol/schemes/Reaction.d.ts +13 -0
- package/build/types/protocol/schemes/Role.d.ts +20 -0
- package/build/types/protocol/schemes/Room.d.ts +17 -0
- package/build/types/protocol/schemes/RoomHistory.d.ts +5 -0
- package/build/types/protocol/schemes/RoomMember.d.ts +11 -0
- package/build/types/protocol/schemes/RoomStream.d.ts +5 -0
- package/build/types/protocol/schemes/RoomSummary.d.ts +15 -0
- package/build/types/protocol/schemes/SessionData.d.ts +10 -0
- package/build/types/protocol/schemes/Space.d.ts +19 -0
- package/build/types/protocol/schemes/SpaceMember.d.ts +7 -0
- package/build/types/protocol/schemes/SpaceSummary.d.ts +8 -0
- package/build/types/protocol/schemes/Topic.d.ts +8 -0
- package/build/types/protocol/schemes/User.d.ts +23 -0
- package/build/types/protocol/schemes/UserData.d.ts +10 -0
- package/build/types/protocol/schemes/UserInformation.d.ts +11 -0
- package/build/types/protocol/schemes/UserRelationship.d.ts +6 -0
- package/build/types/protocol/schemes/UserState.d.ts +6 -0
- package/build/types/protocol/schemes/commands/Ack.d.ts +5 -0
- package/build/types/protocol/schemes/commands/AssignRole.d.ts +6 -0
- package/build/types/protocol/schemes/commands/Ban.d.ts +10 -0
- package/build/types/protocol/schemes/commands/CreateAccessTicket.d.ts +13 -0
- package/build/types/protocol/schemes/commands/CreateEmoticon.d.ts +5 -0
- package/build/types/protocol/schemes/commands/CreateMessage.d.ts +11 -0
- package/build/types/protocol/schemes/commands/CreateOwner.d.ts +5 -0
- package/build/types/protocol/schemes/commands/CreateRelationship.d.ts +5 -0
- package/build/types/protocol/schemes/commands/CreateRole.d.ts +6 -0
- package/build/types/protocol/schemes/commands/CreateRoom.d.ts +9 -0
- package/build/types/protocol/schemes/commands/CreateSpace.d.ts +6 -0
- package/build/types/protocol/schemes/commands/CreateTopic.d.ts +11 -0
- package/build/types/protocol/schemes/commands/DeassignRole.d.ts +6 -0
- package/build/types/protocol/schemes/commands/DeleteEmoticon.d.ts +3 -0
- package/build/types/protocol/schemes/commands/DeleteOwner.d.ts +5 -0
- package/build/types/protocol/schemes/commands/DeleteRelationship.d.ts +5 -0
- package/build/types/protocol/schemes/commands/DeleteRole.d.ts +4 -0
- package/build/types/protocol/schemes/commands/DeleteRoom.d.ts +3 -0
- package/build/types/protocol/schemes/commands/DeleteSpace.d.ts +3 -0
- package/build/types/protocol/schemes/commands/DeleteTopic.d.ts +4 -0
- package/build/types/protocol/schemes/commands/FollowTopic.d.ts +4 -0
- package/build/types/protocol/schemes/commands/GetBans.d.ts +6 -0
- package/build/types/protocol/schemes/commands/GetClientData.d.ts +2 -0
- package/build/types/protocol/schemes/commands/GetComputedPermissions.d.ts +10 -0
- package/build/types/protocol/schemes/commands/GetDiscoverableSpaces.d.ts +2 -0
- package/build/types/protocol/schemes/commands/GetEmoticons.d.ts +3 -0
- package/build/types/protocol/schemes/commands/GetEntitlements.d.ts +8 -0
- package/build/types/protocol/schemes/commands/GetFollowedTopics.d.ts +4 -0
- package/build/types/protocol/schemes/commands/GetInvited.d.ts +3 -0
- package/build/types/protocol/schemes/commands/GetMessages.d.ts +13 -0
- package/build/types/protocol/schemes/commands/GetOwners.d.ts +4 -0
- package/build/types/protocol/schemes/commands/GetPermissionOverwriteTargets.d.ts +4 -0
- package/build/types/protocol/schemes/commands/GetPermissionOverwrites.d.ts +6 -0
- package/build/types/protocol/schemes/commands/GetReactionDetails.d.ts +8 -0
- package/build/types/protocol/schemes/commands/GetRelationships.d.ts +2 -0
- package/build/types/protocol/schemes/commands/GetRoomMembers.d.ts +3 -0
- package/build/types/protocol/schemes/commands/GetRoomSummary.d.ts +4 -0
- package/build/types/protocol/schemes/commands/GetSession.d.ts +2 -0
- package/build/types/protocol/schemes/commands/GetSessionData.d.ts +2 -0
- package/build/types/protocol/schemes/commands/GetSpaceMembers.d.ts +3 -0
- package/build/types/protocol/schemes/commands/GetSpaceRooms.d.ts +3 -0
- package/build/types/protocol/schemes/commands/GetSpaceSummary.d.ts +3 -0
- package/build/types/protocol/schemes/commands/GetTopics.d.ts +4 -0
- package/build/types/protocol/schemes/commands/GetUserData.d.ts +2 -0
- package/build/types/protocol/schemes/commands/GetUserInfo.d.ts +3 -0
- package/build/types/protocol/schemes/commands/Invite.d.ts +5 -0
- package/build/types/protocol/schemes/commands/JoinRoom.d.ts +13 -0
- package/build/types/protocol/schemes/commands/JoinSpace.d.ts +3 -0
- package/build/types/protocol/schemes/commands/Kick.d.ts +7 -0
- package/build/types/protocol/schemes/commands/LeaveRoom.d.ts +3 -0
- package/build/types/protocol/schemes/commands/LeaveSpace.d.ts +3 -0
- package/build/types/protocol/schemes/commands/Ping.d.ts +2 -0
- package/build/types/protocol/schemes/commands/React.d.ts +6 -0
- package/build/types/protocol/schemes/commands/RedactMessages.d.ts +3 -0
- package/build/types/protocol/schemes/commands/ReportAbuse.d.ts +9 -0
- package/build/types/protocol/schemes/commands/SearchMessages.d.ts +18 -0
- package/build/types/protocol/schemes/commands/SetClientData.d.ts +1 -0
- package/build/types/protocol/schemes/commands/SetPermissionOverwrites.d.ts +8 -0
- package/build/types/protocol/schemes/commands/SetSessionData.d.ts +17 -0
- package/build/types/protocol/schemes/commands/SetUserData.d.ts +6 -0
- package/build/types/protocol/schemes/commands/Unban.d.ts +3 -0
- package/build/types/protocol/schemes/commands/UnfollowTopic.d.ts +4 -0
- package/build/types/protocol/schemes/commands/Uninvite.d.ts +5 -0
- package/build/types/protocol/schemes/commands/Unreact.d.ts +6 -0
- package/build/types/protocol/schemes/commands/UpdateFollowedTopic.d.ts +6 -0
- package/build/types/protocol/schemes/commands/UpdateRole.d.ts +8 -0
- package/build/types/protocol/schemes/commands/UpdateRoom.d.ts +10 -0
- package/build/types/protocol/schemes/commands/UpdateRoomMember.d.ts +8 -0
- package/build/types/protocol/schemes/commands/UpdateSpace.d.ts +12 -0
- package/build/types/protocol/schemes/commands/UpdateSpaceMember.d.ts +6 -0
- package/build/types/protocol/schemes/commands/UpdateTopic.d.ts +5 -0
- package/build/types/protocol/schemes/events/AccessTicket.d.ts +14 -0
- package/build/types/protocol/schemes/events/Bans.d.ts +6 -0
- package/build/types/protocol/schemes/events/Bye.d.ts +4 -0
- package/build/types/protocol/schemes/events/ClientData.d.ts +1 -0
- package/build/types/protocol/schemes/events/ComputedPermissions.d.ts +9 -0
- package/build/types/protocol/schemes/events/DiscoverableSpaces.d.ts +4 -0
- package/build/types/protocol/schemes/events/EmoticonDeleted.d.ts +4 -0
- package/build/types/protocol/schemes/events/Emoticons.d.ts +6 -0
- package/build/types/protocol/schemes/events/EntitlementUsage.d.ts +11 -0
- package/build/types/protocol/schemes/events/Entitlements.d.ts +12 -0
- package/build/types/protocol/schemes/events/Error.d.ts +14 -0
- package/build/types/protocol/schemes/events/FollowedTopicUpdated.d.ts +4 -0
- package/build/types/protocol/schemes/events/FollowedTopics.d.ts +6 -0
- package/build/types/protocol/schemes/events/FoundMessages.d.ts +16 -0
- package/build/types/protocol/schemes/events/Invited.d.ts +10 -0
- package/build/types/protocol/schemes/events/Messages.d.ts +9 -0
- package/build/types/protocol/schemes/events/MessagesRedacted.d.ts +5 -0
- package/build/types/protocol/schemes/events/NewEmoticon.d.ts +4 -0
- package/build/types/protocol/schemes/events/NewMessage.d.ts +4 -0
- package/build/types/protocol/schemes/events/NewRelationship.d.ts +4 -0
- package/build/types/protocol/schemes/events/NewRole.d.ts +5 -0
- package/build/types/protocol/schemes/events/NewRoom.d.ts +5 -0
- package/build/types/protocol/schemes/events/NewTopic.d.ts +5 -0
- package/build/types/protocol/schemes/events/Ok.d.ts +2 -0
- package/build/types/protocol/schemes/events/Owners.d.ts +8 -0
- package/build/types/protocol/schemes/events/PermissionOverwriteTargets.d.ts +10 -0
- package/build/types/protocol/schemes/events/PermissionOverwrites.d.ts +8 -0
- package/build/types/protocol/schemes/events/PermissionOverwritesUpdated.d.ts +8 -0
- package/build/types/protocol/schemes/events/Pong.d.ts +2 -0
- package/build/types/protocol/schemes/events/Reacted.d.ts +9 -0
- package/build/types/protocol/schemes/events/ReactionDetails.d.ts +11 -0
- package/build/types/protocol/schemes/events/ReactionUpdated.d.ts +8 -0
- package/build/types/protocol/schemes/events/RelationshipDeleted.d.ts +4 -0
- package/build/types/protocol/schemes/events/Relationships.d.ts +4 -0
- package/build/types/protocol/schemes/events/RoleDeleted.d.ts +4 -0
- package/build/types/protocol/schemes/events/RoleUpdated.d.ts +5 -0
- package/build/types/protocol/schemes/events/RoomDeleted.d.ts +3 -0
- package/build/types/protocol/schemes/events/RoomJoined.d.ts +4 -0
- package/build/types/protocol/schemes/events/RoomLeft.d.ts +5 -0
- package/build/types/protocol/schemes/events/RoomMemberLeft.d.ts +4 -0
- package/build/types/protocol/schemes/events/RoomMemberUpdated.d.ts +6 -0
- package/build/types/protocol/schemes/events/RoomMembers.d.ts +5 -0
- package/build/types/protocol/schemes/events/RoomMembersJoined.d.ts +9 -0
- package/build/types/protocol/schemes/events/RoomSummary.d.ts +4 -0
- package/build/types/protocol/schemes/events/RoomSummaryUpdated.d.ts +8 -0
- package/build/types/protocol/schemes/events/RoomUpdated.d.ts +4 -0
- package/build/types/protocol/schemes/events/Session.d.ts +9 -0
- package/build/types/protocol/schemes/events/SpaceDeleted.d.ts +3 -0
- package/build/types/protocol/schemes/events/SpaceJoined.d.ts +4 -0
- package/build/types/protocol/schemes/events/SpaceLeft.d.ts +5 -0
- package/build/types/protocol/schemes/events/SpaceMemberJoined.d.ts +5 -0
- package/build/types/protocol/schemes/events/SpaceMemberLeft.d.ts +4 -0
- package/build/types/protocol/schemes/events/SpaceMemberUpdated.d.ts +6 -0
- package/build/types/protocol/schemes/events/SpaceMembers.d.ts +5 -0
- package/build/types/protocol/schemes/events/SpaceRooms.d.ts +5 -0
- package/build/types/protocol/schemes/events/SpaceSummary.d.ts +4 -0
- package/build/types/protocol/schemes/events/SpaceUpdated.d.ts +4 -0
- package/build/types/protocol/schemes/events/TopicDeleted.d.ts +4 -0
- package/build/types/protocol/schemes/events/TopicFollowed.d.ts +4 -0
- package/build/types/protocol/schemes/events/TopicUnfollowed.d.ts +4 -0
- package/build/types/protocol/schemes/events/TopicUpdated.d.ts +6 -0
- package/build/types/protocol/schemes/events/Topics.d.ts +6 -0
- package/build/types/protocol/schemes/events/UserInfo.d.ts +4 -0
- package/build/types/protocol/schemes/events/UserUpdated.d.ts +4 -0
- package/build/types/state-tracker/AsyncUtils.d.ts +15 -0
- package/build/types/state-tracker/ChatStateTracker.d.ts +41 -0
- package/build/types/state-tracker/EmoticonsManager.d.ts +15 -0
- package/build/types/state-tracker/FollowedTopicsManager.d.ts +85 -0
- package/build/types/state-tracker/MessagesManager.d.ts +27 -0
- package/build/types/state-tracker/PermissionsManager.d.ts +51 -0
- package/build/types/state-tracker/RelationshipsManager.d.ts +15 -0
- package/build/types/state-tracker/RoomMessagesHistory.d.ts +72 -0
- package/build/types/state-tracker/RoomsManager.d.ts +72 -0
- package/build/types/state-tracker/SpacesManager.d.ts +63 -0
- package/build/types/state-tracker/TopicHistoryWindow.d.ts +191 -0
- package/build/types/state-tracker/UsersManager.d.ts +23 -0
- package/build/types/state-tracker/functions.d.ts +6 -0
- package/package.json +67 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Message } from "../Message";
|
|
2
|
+
/** In UTF-16 code units, `end` exclusive. */
|
|
3
|
+
export interface TextRange {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
}
|
|
7
|
+
export interface FoundMessage {
|
|
8
|
+
message: Message;
|
|
9
|
+
spaceId: string | null;
|
|
10
|
+
ranges: TextRange[];
|
|
11
|
+
}
|
|
12
|
+
export interface FoundMessages {
|
|
13
|
+
results: FoundMessage[];
|
|
14
|
+
/** `null` - no more results. */
|
|
15
|
+
cursor: string | null;
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChatLocation } from "../ChatLocation";
|
|
2
|
+
import { Role } from "../Role";
|
|
3
|
+
export interface Invited {
|
|
4
|
+
location: ChatLocation;
|
|
5
|
+
/**
|
|
6
|
+
* Ids of the invited users. Join them with the space member collection to display them.
|
|
7
|
+
*/
|
|
8
|
+
userIds: string[];
|
|
9
|
+
roles: Role[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChatLocation } from "../ChatLocation";
|
|
2
|
+
import { Message } from "../Message";
|
|
3
|
+
import { UserReaction } from "../Reaction";
|
|
4
|
+
export interface Messages {
|
|
5
|
+
location: ChatLocation;
|
|
6
|
+
messages: Message[];
|
|
7
|
+
/** Message id => reactions of the asking user; present only when requested. */
|
|
8
|
+
myReactions?: Record<string, UserReaction[]>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChatLocation } from "../ChatLocation";
|
|
2
|
+
import { RoomMember } from "../RoomMember";
|
|
3
|
+
import { SpaceMember } from "../SpaceMember";
|
|
4
|
+
export interface Owners {
|
|
5
|
+
location: ChatLocation;
|
|
6
|
+
spaceMembers: SpaceMember[] | null;
|
|
7
|
+
roomMembers: RoomMember[] | null;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChatLocation } from "../ChatLocation";
|
|
2
|
+
import { SpaceMember } from "../SpaceMember";
|
|
3
|
+
import { RoomMember } from "../RoomMember";
|
|
4
|
+
import { Role } from "../Role";
|
|
5
|
+
export interface PermissionOverwriteTargets {
|
|
6
|
+
location: ChatLocation;
|
|
7
|
+
spaceMembers: SpaceMember[] | null;
|
|
8
|
+
roomMembers: RoomMember[] | null;
|
|
9
|
+
roles: Role[] | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PermissionOverwritesValue } from "../PermissionOverwritesValue";
|
|
2
|
+
import { ChatLocation } from "../ChatLocation";
|
|
3
|
+
import { PermissionOverwritesTarget } from "../PermissionOverwritesTarget";
|
|
4
|
+
export interface PermissionOverwrites {
|
|
5
|
+
location: ChatLocation;
|
|
6
|
+
target: PermissionOverwritesTarget;
|
|
7
|
+
overwrites: PermissionOverwritesValue;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PermissionOverwritesValue } from "../PermissionOverwritesValue";
|
|
2
|
+
import { ChatLocation } from "../ChatLocation";
|
|
3
|
+
import { PermissionOverwritesTarget } from "../PermissionOverwritesTarget";
|
|
4
|
+
export interface PermissionOverwritesUpdated {
|
|
5
|
+
location: ChatLocation;
|
|
6
|
+
target: PermissionOverwritesTarget;
|
|
7
|
+
overwrites: PermissionOverwritesValue;
|
|
8
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class DeferredTask {
|
|
2
|
+
readonly promise: Promise<void>;
|
|
3
|
+
resolve: () => void;
|
|
4
|
+
constructor();
|
|
5
|
+
}
|
|
6
|
+
export declare class PromiseRegistry {
|
|
7
|
+
private promises;
|
|
8
|
+
register<T = any>(promise: Promise<T>, key: string): void;
|
|
9
|
+
registerByFunction(fn: () => Promise<any>, key: string): void;
|
|
10
|
+
get<T = any>(key: string): Promise<T> | undefined;
|
|
11
|
+
has(key: string): boolean;
|
|
12
|
+
notExist(key: string): boolean;
|
|
13
|
+
forget(...keys: string[]): void;
|
|
14
|
+
forgetAll(): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WebSocketChatClient } from "../WebSocketChatClient";
|
|
2
|
+
import { User } from "../protocol";
|
|
3
|
+
import { RoomsManager } from "./RoomsManager";
|
|
4
|
+
import { SpacesManager } from "./SpacesManager";
|
|
5
|
+
import { PermissionsManager } from "./PermissionsManager";
|
|
6
|
+
import { EmoticonsManager } from "./EmoticonsManager";
|
|
7
|
+
import { UsersManager } from "./UsersManager";
|
|
8
|
+
import { RelationshipsManager } from "./RelationshipsManager";
|
|
9
|
+
export declare class ChatStateTracker {
|
|
10
|
+
readonly client: WebSocketChatClient;
|
|
11
|
+
/**
|
|
12
|
+
* State of your permissions.
|
|
13
|
+
*/
|
|
14
|
+
readonly permissions: PermissionsManager;
|
|
15
|
+
/**
|
|
16
|
+
* State of the rooms you are in.
|
|
17
|
+
*/
|
|
18
|
+
readonly rooms: RoomsManager;
|
|
19
|
+
/**
|
|
20
|
+
* State of the spaces you are in.
|
|
21
|
+
*/
|
|
22
|
+
readonly spaces: SpacesManager;
|
|
23
|
+
/**
|
|
24
|
+
* State of the emoticons (global and space-related).
|
|
25
|
+
*/
|
|
26
|
+
readonly emoticons: EmoticonsManager;
|
|
27
|
+
/**
|
|
28
|
+
* Users related state.
|
|
29
|
+
*/
|
|
30
|
+
readonly users: UsersManager;
|
|
31
|
+
/**
|
|
32
|
+
* State of relationships with other users.
|
|
33
|
+
*/
|
|
34
|
+
readonly relationships: RelationshipsManager;
|
|
35
|
+
private _me;
|
|
36
|
+
private readonly deferredSession;
|
|
37
|
+
constructor(client: WebSocketChatClient);
|
|
38
|
+
get me(): User | null;
|
|
39
|
+
getMe(): Promise<User>;
|
|
40
|
+
private handleSession;
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChatStateTracker } from "./ChatStateTracker";
|
|
2
|
+
import { ObservableIndexedObjectCollection } from "../IndexedObjectCollection";
|
|
3
|
+
import { Emoticon } from "../protocol";
|
|
4
|
+
export declare class EmoticonsManager {
|
|
5
|
+
private tracker;
|
|
6
|
+
private list;
|
|
7
|
+
private emoticonsPromises;
|
|
8
|
+
constructor(tracker: ChatStateTracker);
|
|
9
|
+
get(spaceId?: string): Promise<ObservableIndexedObjectCollection<Emoticon>>;
|
|
10
|
+
private handleEmoticons;
|
|
11
|
+
private handleNewEmoticon;
|
|
12
|
+
private handleEmoticonDeleted;
|
|
13
|
+
private handleSpaceDeleted;
|
|
14
|
+
private handleSession;
|
|
15
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { EventTarget } from "../EventTarget";
|
|
2
|
+
import { ChatStateTracker } from "./ChatStateTracker";
|
|
3
|
+
import { ObservableIndexedObjectCollection } from "../IndexedObjectCollection";
|
|
4
|
+
import { ChatLocation, FollowedTopic } from "../protocol";
|
|
5
|
+
interface EventMap {
|
|
6
|
+
change: {};
|
|
7
|
+
}
|
|
8
|
+
export interface UnreadSummary {
|
|
9
|
+
mentionCount: number;
|
|
10
|
+
unreadTopicCount: number;
|
|
11
|
+
unreadRoomCount: number;
|
|
12
|
+
isUnread: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class FollowedTopicsManager extends EventTarget<EventMap> {
|
|
15
|
+
private tracker;
|
|
16
|
+
private readonly followedTopics;
|
|
17
|
+
private readonly followedTopicsPromises;
|
|
18
|
+
private readonly deferredSession;
|
|
19
|
+
private readonly summariesCache;
|
|
20
|
+
/**
|
|
21
|
+
* Rooms whose cached followed-topics are stale after a reconnect and must
|
|
22
|
+
* be refetched (and reconciled in place) the next time they are accessed.
|
|
23
|
+
*/
|
|
24
|
+
private readonly staleRooms;
|
|
25
|
+
constructor(tracker: ChatStateTracker);
|
|
26
|
+
/**
|
|
27
|
+
* Cache followed topics for all joined rooms in a space and fetch them in bulk if necessary.
|
|
28
|
+
* Then you can get them using getRoomFollowedTopics().
|
|
29
|
+
* @see getForRoom
|
|
30
|
+
*/
|
|
31
|
+
cacheForSpace(spaceId: string | null): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Get followed topics for the given room.
|
|
34
|
+
* @return Undefined if you are not in the room, collection otherwise.
|
|
35
|
+
*/
|
|
36
|
+
getForRoom(roomId: string): Promise<ObservableIndexedObjectCollection<FollowedTopic> | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Batch acknowledge all messages for given room.
|
|
39
|
+
*/
|
|
40
|
+
ackRoom(roomId: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Summarize all unread messages or mentions from any topic in given location.
|
|
43
|
+
* This method uses an internal cache, so it's ok to call it multiple times.
|
|
44
|
+
* Capture the 'change' event to determine when it's worth calling this method again due to data changes.
|
|
45
|
+
* @return Undefined if you are not in room.
|
|
46
|
+
*/
|
|
47
|
+
summarize(location: ChatLocation): Promise<UnreadSummary>;
|
|
48
|
+
/**
|
|
49
|
+
* For internal use. If you want to delete the message, execute a proper command on client object.
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
_deleteByTopicIds(roomId: string, ...topicIds: string[]): void;
|
|
53
|
+
private handleSession;
|
|
54
|
+
private handleNewMessage;
|
|
55
|
+
private handleFollowedTopicUpdated;
|
|
56
|
+
private handleTopicFollowed;
|
|
57
|
+
private handleTopicUnfollowed;
|
|
58
|
+
private handleRoomDeleted;
|
|
59
|
+
private handleRoomJoin;
|
|
60
|
+
private handleRoomLeft;
|
|
61
|
+
private handleNewTopic;
|
|
62
|
+
private handleTopicDeleted;
|
|
63
|
+
/**
|
|
64
|
+
* Invalidate the summaries cache intentionally, only for the locations affected by the change.
|
|
65
|
+
*/
|
|
66
|
+
private invalidateUnreadSummaries;
|
|
67
|
+
private invalidateUnreadSummariesForRooms;
|
|
68
|
+
private updateLocallyFollowedTopicOnNewMessage;
|
|
69
|
+
/**
|
|
70
|
+
* Reconcile the followed-topics collection for a single room to exactly
|
|
71
|
+
* match the provided list (upsert present, drop absent) without emitting an
|
|
72
|
+
* intermediate empty state, and clear its stale marker. Does not touch the
|
|
73
|
+
* unread summaries cache - callers decide how to invalidate it.
|
|
74
|
+
*/
|
|
75
|
+
private applyRoomFollowedTopics;
|
|
76
|
+
/**
|
|
77
|
+
* Reconcile a batch of rooms from a single bulk GetFollowedTopics response.
|
|
78
|
+
* Rooms with no followed topics in the response are reconciled to empty, so
|
|
79
|
+
* topics unfollowed/removed during the downtime are correctly dropped.
|
|
80
|
+
*/
|
|
81
|
+
private reconcileRoomsFollowedTopics;
|
|
82
|
+
private setFollowedTopicsArray;
|
|
83
|
+
private clearRoomFollowedTopicsStructures;
|
|
84
|
+
}
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ChatStateTracker } from "./ChatStateTracker";
|
|
2
|
+
import { Message, ChatLocation } from "../protocol";
|
|
3
|
+
import { RoomMessagesHistory } from "./RoomMessagesHistory";
|
|
4
|
+
export declare class MessagesManager {
|
|
5
|
+
private tracker;
|
|
6
|
+
private readonly roomHistories;
|
|
7
|
+
private readonly previewHistories;
|
|
8
|
+
private readonly deferredSession;
|
|
9
|
+
constructor(tracker: ChatStateTracker);
|
|
10
|
+
/**
|
|
11
|
+
* Get history manager for given room ID. For a room you have not joined it is a preview (requires `PreviewRooms`),
|
|
12
|
+
* kept until {@link forgetRoomPreview} or until you join the room.
|
|
13
|
+
*/
|
|
14
|
+
getRoomHistory(roomId: string): Promise<RoomMessagesHistory>;
|
|
15
|
+
forgetRoomPreview(roomId: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* For internal use.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
_resolveLastMessage(location: ChatLocation): Promise<Message | null>;
|
|
21
|
+
private forEachRoomHistory;
|
|
22
|
+
private createHistoryForNewRoom;
|
|
23
|
+
private handleRoomDeleted;
|
|
24
|
+
private handleRoomJoin;
|
|
25
|
+
private handleRoomLeft;
|
|
26
|
+
private handleSession;
|
|
27
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ChatStateTracker } from "./ChatStateTracker";
|
|
2
|
+
import { ChatLocation, PermissionOverwrites, PermissionOverwritesTarget } from "../protocol";
|
|
3
|
+
import { ChangeEventMap, EventTarget } from "../EventTarget";
|
|
4
|
+
import { Permissions } from "../Permissions";
|
|
5
|
+
interface CheckPermissionsResult {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `hasAll` instead.
|
|
8
|
+
*/
|
|
9
|
+
ok: boolean;
|
|
10
|
+
hasAll: boolean;
|
|
11
|
+
hasAny: boolean;
|
|
12
|
+
missing: string[];
|
|
13
|
+
}
|
|
14
|
+
type PermissionsManagerEventMap = ChangeEventMap<void>;
|
|
15
|
+
export declare class PermissionsManager extends EventTarget<PermissionsManagerEventMap> {
|
|
16
|
+
private tracker;
|
|
17
|
+
private readonly overwrites;
|
|
18
|
+
private readonly overwritesPromises;
|
|
19
|
+
constructor(tracker: ChatStateTracker);
|
|
20
|
+
getOverwrites(location: ChatLocation, target: PermissionOverwritesTarget): Promise<PermissionOverwrites | undefined>;
|
|
21
|
+
check(permissionNames: (keyof typeof Permissions.list)[], location: ChatLocation): Promise<CheckPermissionsResult>;
|
|
22
|
+
/**
|
|
23
|
+
* For a room or a space you have not joined the permissions are fetched from the server, on every call.
|
|
24
|
+
*/
|
|
25
|
+
calculatePermissions(location: ChatLocation): Promise<number>;
|
|
26
|
+
/**
|
|
27
|
+
* Arriving overwrites change the permissions only when they replace different ones. The first ones fetched for a
|
|
28
|
+
* key have not been part of any result yet - every calculation needing them awaits their fetch - and a fetch
|
|
29
|
+
* response arrives twice, as the command result and as an event.
|
|
30
|
+
*/
|
|
31
|
+
private handlePermissionOverwrites;
|
|
32
|
+
private handleSpaceDeleted;
|
|
33
|
+
private handleRoomDeleted;
|
|
34
|
+
private handleTopicDeleted;
|
|
35
|
+
private handleRoleDeleted;
|
|
36
|
+
private handleSpaceMemberUpdated;
|
|
37
|
+
private handleRoomMemberUpdated;
|
|
38
|
+
/**
|
|
39
|
+
* @return Matched and deleted ids
|
|
40
|
+
*/
|
|
41
|
+
private deleteOverwritesByIdPrefix;
|
|
42
|
+
private collectRoleOverwrites;
|
|
43
|
+
private resolveOverwritesFromRolesByOrder;
|
|
44
|
+
private resolveOverwritesHierarchy;
|
|
45
|
+
private getRootAccessValue;
|
|
46
|
+
private fetchComputedPermissions;
|
|
47
|
+
private fetchMembersOrFail;
|
|
48
|
+
private validateLocation;
|
|
49
|
+
private handleSession;
|
|
50
|
+
}
|
|
51
|
+
export {};
|