@devanachat/sdk 0.14.0 → 0.16.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 +73 -1
- package/build/index.cjs.js +521 -54
- package/build/index.cjs.js.map +1 -1
- package/build/index.mjs +520 -54
- 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 +15 -2
- package/build/types/Permissions.d.ts +4 -0
- package/build/types/index.d.ts +4 -2
- package/build/types/protocol/index.d.ts +17 -2
- package/build/types/protocol/schemes/Activity.d.ts +16 -0
- package/build/types/protocol/schemes/SavedItem.d.ts +7 -0
- package/build/types/protocol/schemes/commands/GetActivities.d.ts +3 -0
- package/build/types/protocol/schemes/commands/GetPermissionOverwrites.d.ts +17 -1
- package/build/types/protocol/schemes/commands/GetSavedItems.d.ts +3 -0
- package/build/types/protocol/schemes/commands/SaveItem.d.ts +5 -0
- package/build/types/protocol/schemes/commands/UnsaveItem.d.ts +5 -0
- package/build/types/protocol/schemes/commands/UpdateActivities.d.ts +4 -0
- package/build/types/protocol/schemes/events/Activities.d.ts +9 -0
- package/build/types/protocol/schemes/events/ActivityDeleted.d.ts +3 -0
- package/build/types/protocol/schemes/events/ActivityUpdated.d.ts +4 -0
- package/build/types/protocol/schemes/events/Error.d.ts +3 -1
- package/build/types/protocol/schemes/events/ItemSaved.d.ts +6 -0
- package/build/types/protocol/schemes/events/ItemUnsaved.d.ts +5 -0
- package/build/types/protocol/schemes/events/NewActivity.d.ts +8 -0
- package/build/types/protocol/schemes/events/PermissionOverwritesList.d.ts +4 -0
- package/build/types/protocol/schemes/events/SavedItems.d.ts +6 -0
- package/build/types/state-tracker/ActivitiesManager.d.ts +63 -0
- package/build/types/state-tracker/ChatStateTracker.d.ts +13 -0
- package/build/types/state-tracker/PermissionsManager.d.ts +8 -2
- package/build/types/state-tracker/SavedItemsManager.d.ts +46 -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, 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, JoinCall, DeclineCall, InviteToCall, MuteCallMember, KickCallMember, UpdateCallMember, GetCallMembers, CallJoined, CallUpdated, IncomingCallUpdated, CallVideoLimitReached, CallMembers, CallMemberJoined, CallMemberUpdated, CallMemberLeft } 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, PermissionOverwritesList, 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, JoinCall, DeclineCall, InviteToCall, MuteCallMember, KickCallMember, UpdateCallMember, GetCallMembers, CallJoined, CallUpdated, IncomingCallUpdated, CallVideoLimitReached, CallMembers, CallMemberJoined, CallMemberUpdated, CallMemberLeft, GetActivities, UpdateActivities, Activities, NewActivity, ActivityUpdated, ActivityDeleted, SaveItem, UnsaveItem, GetSavedItems, SavedItems, ItemSaved, ItemUnsaved } 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>;
|
|
@@ -44,6 +44,7 @@ export type EventsMap = {
|
|
|
44
44
|
Session: Session;
|
|
45
45
|
ComputedPermissions: ComputedPermissions;
|
|
46
46
|
PermissionOverwrites: PermissionOverwrites;
|
|
47
|
+
PermissionOverwritesList: PermissionOverwritesList;
|
|
47
48
|
PermissionOverwritesUpdated: PermissionOverwritesUpdated;
|
|
48
49
|
PermissionOverwriteTargets: PermissionOverwriteTargets;
|
|
49
50
|
Owners: Owners;
|
|
@@ -120,6 +121,13 @@ export type EventsMap = {
|
|
|
120
121
|
CallMemberJoined: CallMemberJoined;
|
|
121
122
|
CallMemberUpdated: CallMemberUpdated;
|
|
122
123
|
CallMemberLeft: CallMemberLeft;
|
|
124
|
+
Activities: Activities;
|
|
125
|
+
NewActivity: NewActivity;
|
|
126
|
+
ActivityUpdated: ActivityUpdated;
|
|
127
|
+
ActivityDeleted: ActivityDeleted;
|
|
128
|
+
SavedItems: SavedItems;
|
|
129
|
+
ItemSaved: ItemSaved;
|
|
130
|
+
ItemUnsaved: ItemUnsaved;
|
|
123
131
|
};
|
|
124
132
|
/**
|
|
125
133
|
* Map of commands and their corresponding events.
|
|
@@ -127,7 +135,7 @@ export type EventsMap = {
|
|
|
127
135
|
export type CommandsMap = {
|
|
128
136
|
GetSession: CommandDefinition<GetSession, EventsMap['Session']>;
|
|
129
137
|
SetPermissionOverwrites: CommandDefinition<SetPermissionOverwrites, EventsMap['PermissionOverwritesUpdated']>;
|
|
130
|
-
GetPermissionOverwrites: CommandDefinition<GetPermissionOverwrites, EventsMap['PermissionOverwrites']>;
|
|
138
|
+
GetPermissionOverwrites: CommandDefinition<GetPermissionOverwrites, EventsMap['PermissionOverwritesList'] | EventsMap['PermissionOverwrites']>;
|
|
131
139
|
GetComputedPermissions: CommandDefinition<GetComputedPermissions, EventsMap['ComputedPermissions']>;
|
|
132
140
|
GetPermissionOverwriteTargets: CommandDefinition<GetPermissionOverwriteTargets, EventsMap['PermissionOverwriteTargets']>;
|
|
133
141
|
GetOwners: CommandDefinition<GetOwners, EventsMap['Owners']>;
|
|
@@ -214,5 +222,10 @@ export type CommandsMap = {
|
|
|
214
222
|
KickCallMember: CommandDefinition<KickCallMember, EventsMap['Ok']>;
|
|
215
223
|
UpdateCallMember: CommandDefinition<UpdateCallMember, EventsMap['Ok']>;
|
|
216
224
|
GetCallMembers: CommandDefinition<GetCallMembers, EventsMap['CallMembers']>;
|
|
225
|
+
GetActivities: CommandDefinition<GetActivities, EventsMap['Activities']>;
|
|
226
|
+
UpdateActivities: CommandDefinition<UpdateActivities, EventsMap['ActivityUpdated']>;
|
|
227
|
+
SaveItem: CommandDefinition<SaveItem, EventsMap['ItemSaved']>;
|
|
228
|
+
UnsaveItem: CommandDefinition<UnsaveItem, EventsMap['ItemUnsaved']>;
|
|
229
|
+
GetSavedItems: CommandDefinition<GetSavedItems, EventsMap['SavedItems']>;
|
|
217
230
|
};
|
|
218
231
|
export {};
|
|
@@ -142,6 +142,10 @@ export declare class Permissions {
|
|
|
142
142
|
value: number;
|
|
143
143
|
maxLayer: Layer;
|
|
144
144
|
};
|
|
145
|
+
StartCalls: {
|
|
146
|
+
value: number;
|
|
147
|
+
maxLayer: Layer;
|
|
148
|
+
};
|
|
145
149
|
};
|
|
146
150
|
/**
|
|
147
151
|
* Whether the permission mask (e.g. from {@link PermissionsManager.calculatePermissions}) grants the permission.
|
package/build/types/index.d.ts
CHANGED
|
@@ -13,11 +13,13 @@ 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
15
|
import { CallsManager } from "./state-tracker/CallsManager";
|
|
16
|
-
|
|
16
|
+
import { ActivitiesManager } from "./state-tracker/ActivitiesManager";
|
|
17
|
+
import { SavedItemsManager, savedItemKey } from "./state-tracker/SavedItemsManager";
|
|
18
|
+
export { IndexedCollection, ObservableIndexedCollection, IndexedObjectCollection, ObservableIndexedObjectCollection, savedItemKey, Permissions, PermissionDefinition, Layer, WebSocketChatClient, WebApiChatClient, FilesClient, AbstractRestClient, extractUserFromMember, isGroupPm, getPmPeers, CallMemberFlag, 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, };
|
|
17
19
|
export type { CommandResult, CommandRequest, CommandResponse, CommandsMap, EventsMap, } from "./AbstractChatClient";
|
|
18
20
|
export type { WebSocketClientOptions } from "./WebSocketChatClient";
|
|
19
21
|
export type { WebApiChatClientOptions } from "./WebApiChatClient";
|
|
20
22
|
export type { RestClientOptions, RestClientResponse } from "./AbstractRestClient";
|
|
21
23
|
export type { EventHandler, ObservableInterface } from "./EventTarget";
|
|
22
24
|
export type { StateSnapshot, SpaceRoomsSnapshot, RoomFollowedTopicsSnapshot, EmoticonsSnapshot, StateSnapshotIntent, TopicHistorySnapshot, RoomMembersSnapshot, } from "./state-tracker/StateSnapshot";
|
|
23
|
-
export type { ChatTypes, File, UnreadSummary, TopicHistoryWindow, PermissionsManager, TypingManager, TypingUsers, CallsManager, };
|
|
25
|
+
export type { ChatTypes, File, UnreadSummary, TopicHistoryWindow, PermissionsManager, TypingManager, TypingUsers, CallsManager, ActivitiesManager, SavedItemsManager, };
|
|
@@ -39,6 +39,7 @@ import { TopicDeleted } from "./schemes/events/TopicDeleted";
|
|
|
39
39
|
import { NewMessage } from "./schemes/events/NewMessage";
|
|
40
40
|
import { PermissionOverwritesUpdated } from "./schemes/events/PermissionOverwritesUpdated";
|
|
41
41
|
import { PermissionOverwrites } from "./schemes/events/PermissionOverwrites";
|
|
42
|
+
import { PermissionOverwritesList } from "./schemes/events/PermissionOverwritesList";
|
|
42
43
|
import { GetSession } from "./schemes/commands/GetSession";
|
|
43
44
|
import { GetComputedPermissions } from "./schemes/commands/GetComputedPermissions";
|
|
44
45
|
import { JoinSpace } from "./schemes/commands/JoinSpace";
|
|
@@ -53,7 +54,7 @@ import { RoleUpdated } from "./schemes/events/RoleUpdated";
|
|
|
53
54
|
import { AssignRole } from "./schemes/commands/AssignRole";
|
|
54
55
|
import { DeassignRole } from "./schemes/commands/DeassignRole";
|
|
55
56
|
import { SetPermissionOverwrites } from "./schemes/commands/SetPermissionOverwrites";
|
|
56
|
-
import { GetPermissionOverwrites } from "./schemes/commands/GetPermissionOverwrites";
|
|
57
|
+
import { GetPermissionOverwrites, GetPermissionOverwritesBatch, GetPermissionOverwritesQuery, GetSinglePermissionOverwrites } from "./schemes/commands/GetPermissionOverwrites";
|
|
57
58
|
import { JoinRoom } from "./schemes/commands/JoinRoom";
|
|
58
59
|
import { LeaveRoom } from "./schemes/commands/LeaveRoom";
|
|
59
60
|
import { GetIgnoredRooms } from "./schemes/commands/GetIgnoredRooms";
|
|
@@ -197,5 +198,19 @@ import { CallMembers } from "./schemes/events/CallMembers";
|
|
|
197
198
|
import { CallMemberJoined } from "./schemes/events/CallMemberJoined";
|
|
198
199
|
import { CallMemberUpdated } from "./schemes/events/CallMemberUpdated";
|
|
199
200
|
import { CallMemberLeft } from "./schemes/events/CallMemberLeft";
|
|
200
|
-
|
|
201
|
+
import { Activity, ActivityType } from "./schemes/Activity";
|
|
202
|
+
import { GetActivities } from "./schemes/commands/GetActivities";
|
|
203
|
+
import { UpdateActivities } from "./schemes/commands/UpdateActivities";
|
|
204
|
+
import { Activities } from "./schemes/events/Activities";
|
|
205
|
+
import { NewActivity } from "./schemes/events/NewActivity";
|
|
206
|
+
import { ActivityUpdated } from "./schemes/events/ActivityUpdated";
|
|
207
|
+
import { ActivityDeleted } from "./schemes/events/ActivityDeleted";
|
|
208
|
+
import { SavedItem, SavedItemType } from "./schemes/SavedItem";
|
|
209
|
+
import { SaveItem } from "./schemes/commands/SaveItem";
|
|
210
|
+
import { UnsaveItem } from "./schemes/commands/UnsaveItem";
|
|
211
|
+
import { GetSavedItems } from "./schemes/commands/GetSavedItems";
|
|
212
|
+
import { SavedItems } from "./schemes/events/SavedItems";
|
|
213
|
+
import { ItemSaved } from "./schemes/events/ItemSaved";
|
|
214
|
+
import { ItemUnsaved } from "./schemes/events/ItemUnsaved";
|
|
215
|
+
export type { Envelope, Message, MessageType, MessageAuthor, MessageMentions, Role, RoleIcon, Room, RoomType, PmParticipant, RoomStream, RoomStreamType, RoomHistory, RoomHistoryMode, RoomCall, 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, Call, CallMember, CallQuality, CallMode, CallTurn, IncomingCall, MessageCall, MessageCallStatus, Activity, ActivityType, SavedItem, SavedItemType, Bye, Error, ErrorDetails, IgnoredRooms, Messages, MessageUserReactions, NewInteraction, Interacted, InteractionResolved, InteractionStatus, FoundMessages, FoundMessage, TextRange, NewMessage, NewRole, NewRoom, NewTopic, TopicFollowed, TopicUnfollowed, FollowedTopics, FollowedTopicUpdated, ComputedPermissions, PermissionOverwrites, PermissionOverwritesList, 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, CallJoined, CallUpdated, IncomingCallUpdated, CallVideoLimitReached, CallMembers, CallMemberJoined, CallMemberUpdated, CallMemberLeft, Activities, NewActivity, ActivityUpdated, ActivityDeleted, SavedItems, ItemSaved, ItemUnsaved, AssignRole, GetMessages, SearchMessages, SearchDate, CreateMessage, Ack, CreateRole, CreateRoom, CreateSpace, CreateTopic, FollowTopic, UnfollowTopic, UpdateFollowedTopic, GetFollowedTopics, DeassignRole, DeleteRole, DeleteRoom, DeleteSpace, DeleteTopic, SetPermissionOverwrites, GetPermissionOverwrites, GetPermissionOverwritesBatch, GetPermissionOverwritesQuery, GetSinglePermissionOverwrites, 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, JoinCall, DeclineCall, InviteToCall, MuteCallMember, KickCallMember, UpdateCallMember, GetCallMembers, GetActivities, UpdateActivities, SaveItem, UnsaveItem, GetSavedItems, };
|
|
201
216
|
export { CallMemberFlag, ErrorCode, MessageEmbedFlag, NO_LIMIT, STORAGE_UNIT_BYTES, HistoryRotation, PmParticipantFlag, RoleFlag, SearchRange, SpaceFeature, SpaceIntent, UiPurpose, UserFeature, UserStatus, };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChatLocation } from "./ChatLocation";
|
|
2
|
+
export type ActivityType = 'Mention' | 'Reply' | 'Reaction' | 'Thread' | 'MissedCall' | 'Custom';
|
|
3
|
+
export interface Activity {
|
|
4
|
+
id: string;
|
|
5
|
+
type: ActivityType;
|
|
6
|
+
groupKey: string | null;
|
|
7
|
+
location: ChatLocation | null;
|
|
8
|
+
messageId: string | null;
|
|
9
|
+
actorIds: string[];
|
|
10
|
+
count: number;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
title: string | null;
|
|
13
|
+
description: string | null;
|
|
14
|
+
link: string | null;
|
|
15
|
+
isRead: boolean;
|
|
16
|
+
}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { ChatLocation } from "../ChatLocation";
|
|
2
2
|
import { PermissionOverwritesTarget } from "../PermissionOverwritesTarget";
|
|
3
|
-
export interface
|
|
3
|
+
export interface GetPermissionOverwritesQuery {
|
|
4
4
|
location: ChatLocation;
|
|
5
5
|
target: PermissionOverwritesTarget;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Answered with `PermissionOverwritesList`: one result for each query, in their order. At most 50 queries, referring
|
|
9
|
+
* to at most 4 different locations.
|
|
10
|
+
*/
|
|
11
|
+
export interface GetPermissionOverwritesBatch {
|
|
12
|
+
queries: GetPermissionOverwritesQuery[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Answered with a single `PermissionOverwrites`.
|
|
16
|
+
* @deprecated Send `queries` instead.
|
|
17
|
+
*/
|
|
18
|
+
export interface GetSinglePermissionOverwrites {
|
|
19
|
+
location: ChatLocation;
|
|
20
|
+
target: PermissionOverwritesTarget;
|
|
21
|
+
}
|
|
22
|
+
export type GetPermissionOverwrites = GetPermissionOverwritesBatch | GetSinglePermissionOverwrites;
|
|
@@ -21,8 +21,10 @@ export declare enum ErrorCode {
|
|
|
21
21
|
ReactionExistsAlready = "ReactionExistsAlreadyException",
|
|
22
22
|
RoomIgnored = "RoomIgnoredException",
|
|
23
23
|
RoomNotFound = "RoomNotFoundException",
|
|
24
|
+
SavedItemsLimitReached = "SavedItemsLimitReachedException",
|
|
24
25
|
SpaceJoinRestricted = "SpaceJoinRestrictedException",
|
|
25
26
|
TooManyCallInvitees = "TooManyCallInviteesException",
|
|
26
27
|
TopicNotFound = "TopicNotFoundException",
|
|
27
|
-
UserNotFound = "UserNotFoundException"
|
|
28
|
+
UserNotFound = "UserNotFoundException",
|
|
29
|
+
UserType = "UserTypeException"
|
|
28
30
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { EventTarget } from "../EventTarget";
|
|
2
|
+
import { ObservableIndexedObjectCollection } from "../IndexedObjectCollection";
|
|
3
|
+
import { Activity, Message, User } from "../protocol";
|
|
4
|
+
import { ChatStateTracker } from "./ChatStateTracker";
|
|
5
|
+
interface EventMap {
|
|
6
|
+
seenAtChange: {};
|
|
7
|
+
}
|
|
8
|
+
export declare class ActivitiesManager extends EventTarget<EventMap> {
|
|
9
|
+
private tracker;
|
|
10
|
+
private readonly activities;
|
|
11
|
+
private readonly messages;
|
|
12
|
+
private readonly users;
|
|
13
|
+
private readonly promises;
|
|
14
|
+
private readonly acks;
|
|
15
|
+
private readonly hiddenRoomIds;
|
|
16
|
+
private activitiesWanted;
|
|
17
|
+
private messagesWanted;
|
|
18
|
+
private refreshScheduled;
|
|
19
|
+
private seen;
|
|
20
|
+
constructor(tracker: ChatStateTracker);
|
|
21
|
+
/**
|
|
22
|
+
* Your latest activities, keyed by id; always the same collection. The first call fetches them, later ones resolve
|
|
23
|
+
* with them. Once fetched, they are fetched again after every reconnect, also when the first fetch failed because
|
|
24
|
+
* the connection was not ready yet. The collection keeps no meaningful order - sort by `createdAt`. Marking the list
|
|
25
|
+
* as seen and clearing it is done with the `UpdateActivities` command.
|
|
26
|
+
* @param fetchWithMessages Fetch the messages and the actors of the activities along, so {@link getMessages} and
|
|
27
|
+
* {@link getUsers} need no request.
|
|
28
|
+
*/
|
|
29
|
+
get(fetchWithMessages?: boolean): Promise<ObservableIndexedObjectCollection<Activity>>;
|
|
30
|
+
/**
|
|
31
|
+
* The messages the activities point at, keyed by message id; always the same collection. The first call fetches
|
|
32
|
+
* them together with the list of {@link get}, unless they were fetched already; afterwards they come with new
|
|
33
|
+
* activities, follow the edits and are fetched again after every reconnect.
|
|
34
|
+
*/
|
|
35
|
+
getMessages(): Promise<ObservableIndexedObjectCollection<Message>>;
|
|
36
|
+
/**
|
|
37
|
+
* The actors of the activities, keyed by user id; always the same collection, fetched and kept together with
|
|
38
|
+
* {@link getMessages}.
|
|
39
|
+
*/
|
|
40
|
+
getUsers(): Promise<ObservableIndexedObjectCollection<User>>;
|
|
41
|
+
/**
|
|
42
|
+
* When the list was last seen, on any device; null until it is fetched or while it was never seen. A change emits
|
|
43
|
+
* `seenAtChange`. Activities created later that are not {@link Activity.isRead} are the unread ones.
|
|
44
|
+
*/
|
|
45
|
+
get seenAt(): string | null;
|
|
46
|
+
private registerFetch;
|
|
47
|
+
private fetch;
|
|
48
|
+
private apply;
|
|
49
|
+
private refresh;
|
|
50
|
+
private setSeen;
|
|
51
|
+
private handleNewActivity;
|
|
52
|
+
private handleActivityUpdated;
|
|
53
|
+
private handleActivityDeleted;
|
|
54
|
+
private handleFollowedTopicUpdated;
|
|
55
|
+
private handleMessageUpdated;
|
|
56
|
+
private handleMessagesRedacted;
|
|
57
|
+
private handleRoomDeleted;
|
|
58
|
+
private handleRoomLeft;
|
|
59
|
+
private handleRoomJoined;
|
|
60
|
+
private deleteActivities;
|
|
61
|
+
private handleSession;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -7,6 +7,8 @@ import { EmoticonsManager } from "./EmoticonsManager";
|
|
|
7
7
|
import { UsersManager } from "./UsersManager";
|
|
8
8
|
import { RelationshipsManager } from "./RelationshipsManager";
|
|
9
9
|
import { CallsManager } from "./CallsManager";
|
|
10
|
+
import { ActivitiesManager } from "./ActivitiesManager";
|
|
11
|
+
import { SavedItemsManager } from "./SavedItemsManager";
|
|
10
12
|
import { StateSnapshot, StateSnapshotIntent } from "./StateSnapshot";
|
|
11
13
|
export declare class ChatStateTracker {
|
|
12
14
|
readonly client: WebSocketChatClient;
|
|
@@ -38,6 +40,17 @@ export declare class ChatStateTracker {
|
|
|
38
40
|
* State of the calls in your rooms and of the calls ringing at you.
|
|
39
41
|
*/
|
|
40
42
|
readonly calls: CallsManager;
|
|
43
|
+
/**
|
|
44
|
+
* Your latest personal events from all spaces (mentions, replies, reactions, followed threads, missed calls) and the
|
|
45
|
+
* activities the server publishes. Private conversations keep their own unread state. Nothing is fetched until you
|
|
46
|
+
* ask for it. Not part of the state snapshot.
|
|
47
|
+
*/
|
|
48
|
+
readonly activities: ActivitiesManager;
|
|
49
|
+
/**
|
|
50
|
+
* The rooms and messages you saved, from all spaces. Nothing is fetched until you ask for it. Not part of the state
|
|
51
|
+
* snapshot.
|
|
52
|
+
*/
|
|
53
|
+
readonly savedItems: SavedItemsManager;
|
|
41
54
|
private _me;
|
|
42
55
|
private readonly deferredSession;
|
|
43
56
|
private sessionReceived;
|
|
@@ -17,16 +17,22 @@ export declare class PermissionsManager extends EventTarget<PermissionsManagerEv
|
|
|
17
17
|
private readonly overwrites;
|
|
18
18
|
private readonly overwritesPromises;
|
|
19
19
|
constructor(tracker: ChatStateTracker);
|
|
20
|
+
/**
|
|
21
|
+
* Cached: kept up to date only for your own overwrites and those of your roles in the locations you belong to.
|
|
22
|
+
* For live overwrites of another target send `GetPermissionOverwrites` yourself.
|
|
23
|
+
*/
|
|
20
24
|
getOverwrites(location: ChatLocation, target: PermissionOverwritesTarget): Promise<PermissionOverwrites | undefined>;
|
|
21
25
|
check(permissionNames: (keyof typeof Permissions.list)[], location: ChatLocation): Promise<CheckPermissionsResult>;
|
|
22
26
|
/**
|
|
23
27
|
* For a room or a space you have not joined the permissions are fetched from the server, on every call.
|
|
24
28
|
*/
|
|
25
29
|
calculatePermissions(location: ChatLocation): Promise<number>;
|
|
30
|
+
private fetchOverwrites;
|
|
31
|
+
private requestOverwrites;
|
|
32
|
+
private getFetchedOverwrites;
|
|
26
33
|
/**
|
|
27
34
|
* 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
|
|
29
|
-
* response arrives twice, as the command result and as an event.
|
|
35
|
+
* key have not been part of any result yet - every calculation needing them awaits their fetch.
|
|
30
36
|
*/
|
|
31
37
|
private handlePermissionOverwrites;
|
|
32
38
|
private handleSpaceDeleted;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ObservableIndexedObjectCollection } from "../IndexedObjectCollection";
|
|
2
|
+
import { Message, SavedItem, SavedItemType } from "../protocol";
|
|
3
|
+
import { ChatStateTracker } from "./ChatStateTracker";
|
|
4
|
+
/**
|
|
5
|
+
* The key of a saved item in the collection returned by {@link SavedItemsManager.get}.
|
|
6
|
+
*/
|
|
7
|
+
export declare const savedItemKey: (type: SavedItemType, id: string) => string;
|
|
8
|
+
export declare class SavedItemsManager {
|
|
9
|
+
private tracker;
|
|
10
|
+
private readonly items;
|
|
11
|
+
private readonly messages;
|
|
12
|
+
private readonly promises;
|
|
13
|
+
private readonly hiddenRoomIds;
|
|
14
|
+
private itemsWanted;
|
|
15
|
+
private messagesWanted;
|
|
16
|
+
private refreshScheduled;
|
|
17
|
+
constructor(tracker: ChatStateTracker);
|
|
18
|
+
/**
|
|
19
|
+
* The rooms and messages you saved, keyed by {@link savedItemKey}; always the same collection. The first call fetches
|
|
20
|
+
* the list, later ones resolve with it. Items of rooms you are not a member of are left out until you rejoin. The
|
|
21
|
+
* collection keeps no meaningful order - sort by `savedAt`. Once fetched, the list is fetched again after every
|
|
22
|
+
* reconnect. Saving and unsaving is done with the `SaveItem` and `UnsaveItem` commands.
|
|
23
|
+
* @param fetchWithMessages Fetch the contents of the saved messages along, so {@link getMessages} needs no request.
|
|
24
|
+
*/
|
|
25
|
+
get(fetchWithMessages?: boolean): Promise<ObservableIndexedObjectCollection<SavedItem>>;
|
|
26
|
+
/**
|
|
27
|
+
* The contents of the saved messages, keyed by message id; always the same collection. The first call fetches them
|
|
28
|
+
* together with the list of {@link get}, unless they were fetched already; afterwards they follow the edits and are
|
|
29
|
+
* fetched again after every reconnect.
|
|
30
|
+
*/
|
|
31
|
+
getMessages(): Promise<ObservableIndexedObjectCollection<Message>>;
|
|
32
|
+
isSaved(type: SavedItemType, id: string): Promise<boolean>;
|
|
33
|
+
private registerFetch;
|
|
34
|
+
private fetch;
|
|
35
|
+
private apply;
|
|
36
|
+
private refresh;
|
|
37
|
+
private handleItemSaved;
|
|
38
|
+
private handleItemUnsaved;
|
|
39
|
+
private handleMessageUpdated;
|
|
40
|
+
private handleMessagesRedacted;
|
|
41
|
+
private handleRoomDeleted;
|
|
42
|
+
private handleRoomLeft;
|
|
43
|
+
private handleRoomJoined;
|
|
44
|
+
private deleteRoomItems;
|
|
45
|
+
private handleSession;
|
|
46
|
+
}
|
package/package.json
CHANGED