@corva/chat-core 0.1.15 → 0.1.16
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/dist/index.d.ts +5 -1
- package/dist/index.js +61 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -514,6 +514,7 @@ interface ReadyChannelData {
|
|
|
514
514
|
channel_type: string;
|
|
515
515
|
last_message_id?: string;
|
|
516
516
|
name?: string;
|
|
517
|
+
server?: string;
|
|
517
518
|
}
|
|
518
519
|
interface ChannelUnread {
|
|
519
520
|
_id: {
|
|
@@ -538,6 +539,7 @@ interface RevoltSocketEventHandlers {
|
|
|
538
539
|
onRoomChange?: (roomId: string, change: unknown) => void;
|
|
539
540
|
onChannelAck?: (channelId: string, messageId: string) => void;
|
|
540
541
|
onServerMembersChange?: (serverId: string) => void;
|
|
542
|
+
onServerJoined?: (channels: ReadyChannelData[]) => void;
|
|
541
543
|
onError?: (error: unknown) => void;
|
|
542
544
|
}
|
|
543
545
|
|
|
@@ -1177,6 +1179,7 @@ declare const createGroupSubscription: (groupId: string, name: string, owner: {
|
|
|
1177
1179
|
_id: string;
|
|
1178
1180
|
username: string;
|
|
1179
1181
|
}, recipientIds: string[]) => Subscription;
|
|
1182
|
+
declare const createChannelSubscription: (channelId: string, name: string, lastMessageId?: string) => Subscription;
|
|
1180
1183
|
declare const createDMSubscription: (roomId: string, recipient?: User) => Subscription;
|
|
1181
1184
|
declare const addOrUpdateSubscription: (subscriptions: Subscription[], newSubscription: Subscription) => Subscription[];
|
|
1182
1185
|
declare const removeSubscription: (subscriptions: Subscription[], roomId: string) => Subscription[];
|
|
@@ -1784,6 +1787,7 @@ declare const createSocketEventHandlers: (config: SocketEventHandlersConfig) =>
|
|
|
1784
1787
|
onAuthenticated: () => void;
|
|
1785
1788
|
onDisconnected: () => void;
|
|
1786
1789
|
onReady: (channels: ReadyChannelData[], channelUnreads?: ChannelUnread[]) => void;
|
|
1790
|
+
onServerJoined: (channels: ReadyChannelData[]) => void;
|
|
1787
1791
|
onChannelAck: (channelId: string, messageId: string) => void;
|
|
1788
1792
|
onMessage: (message: Message) => void;
|
|
1789
1793
|
onRoomChange: (roomId: string, change: unknown) => void;
|
|
@@ -1806,4 +1810,4 @@ declare const createSocketEventHandlers: (config: SocketEventHandlersConfig) =>
|
|
|
1806
1810
|
|
|
1807
1811
|
declare const installUnreadWatcher: () => void;
|
|
1808
1812
|
|
|
1809
|
-
export { ALERT_SEVERITY, ASSET_API_FIELDS, ASSET_CHAT_PREFIXES, ASSET_NOUN, type AckScheduler, type AlertData, type AlertSeverity, type AlertWirePayload, type AppCommentAttachment, type AppCommentData, type AppCommentWirePayload, type AppStateAdapter, type AskCorvaData, type AskCorvaWirePayload, type AssetChatChannel, type AssetChatSession, type AssetStore, type Attachment, type AuthStore, CHANNEL_NAME_MAX_LENGTH, CHANNEL_TYPES, CORVA_JOIN_MESSAGE_TYPE, CORVA_MESSAGE_TYPES, CORVA_SYS_PREFIX, type ChannelAsset, type ChannelContentFilter, type ChannelContentFilterStore, type ChannelContentFilters, type ChannelNameValidation, type ChannelNotificationPreference, type ChannelNotificationSetting, type ChannelUnread, type ChatAsset, type ChatAssetIdentity, type ChatAssetType, type ChatDates, type ChatHost, type ChatNotifier, type ChatPlatform, type CorvaAPIUser, type CorvaApiAdapter, type CorvaRevoltAuthResponse, type CorvaSystemMessage, type CorvaUser, type CorvaUserService, DATE_SEPARATOR_LABELS, DEFAULT_CHANNEL_CONTENT_FILTER, DEFAULT_CHANNEL_CONTENT_FILTERS, DEFAULT_CHANNEL_PREFERENCE, DEFAULT_FAVORITE_ROOMS_SETTINGS, DEFAULT_HIDDEN_ROOMS_SETTINGS, DEFAULT_NOTIFICATION_PREFERENCES, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_ROOM_LIST_ORDER, DIRECT_MESSAGE_PLACEHOLDER, type EditableMentionText, type ExternalChannel, type FavoriteRoomsSettings, type FavoriteRoomsStore, type FeedItemData, type FeedWirePayload, type FileAttachment, type FilterEntityWindow, type ForwardWirePayload, type ForwardedFrom, GENERAL_CHAT_NAME, type HiddenRoomsSettings, type HttpClient, type HttpClientConfig, HttpError, type HttpRequestInit, type HttpResponseLike, type JoinRequired, type JoinWirePayload, type KeyValueStorage, type LocatorContext, type LoginCredentials, MAX_ATTACHMENT_SIZE_BYTES, MAX_ATTACHMENT_SIZE_MB, MAX_NAVIGATION_HISTORY, MENTION_BOUNDARY_SOURCE, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MENTION_USERNAME_SOURCE, MUTE_PRESET_OPTIONS, type MemberStore, type MentionDisplayResolver, type MentionFormat, type MentionLookupOptions, type MentionSegment, type MentionTextSegment, type MentionUserIds, type Message, type MessageCache, type MessageFormData, type MessageStore, NOTIFICATION_DESTINATIONS, NOTIFICATION_SETTING_ALL, NOTIFICATION_SETTING_MENTIONS, NOTIFICATION_SETTING_NOTHING, type NavigationEntry, type NavigationHistoryStore, type NotificationDestination, type NotificationPreferences, type NotificationSettings, type NotificationStore, type OutgoingMentionOptions, PAUSE_INDEFINITELY, PAUSE_PRESETS, PAUSE_PRESET_OPTIONS, type PausePreset, type PausePresetOption, REVOLT_SYSTEM_USER_ID, ROOM_LIST_ORDER, type ReadyChannelData, type RevoltAPIInstance, type RevoltChannel, type RevoltIncomingMessagePayload, type RevoltLoginResponse, type RevoltMessage, type RevoltMessageResponse, type RevoltSocketConfig, type RevoltSocketEventHandlers, type RevoltSocketInstance, type RevoltUploadResponse, type RevoltUserResponse, type Room, type RoomListOrder, type RoomStore, type RoomType, SESSION_STORAGE_KEY, SIDEBAR_SECTIONS, SIDEBAR_TABS, SOFT_DELETE_MARKER, SYSTEM_MESSAGE_TEXTS, type SaveSessionParams, type SelectableAssetType, type SessionData, SessionManager, type SharedFile, type SharedRefs, type SidebarSectionKey, type SidebarTabKey, type SocketCloseEventLike, type SocketEventHandlersConfig, type StoredChannelPreference, type Subscription, type TextSegment, type TracesViewportRequest, type TypingManager, type UIStore, type UploadAndSendResult, type UploadFile, type UploadedFile, type User, type UserStatus, type ViewportDeepLink, type ViewportIndexCurve, type ViewportMode, WEBSOCKET_CONNECTING, WEBSOCKET_OPEN, type WebSocketLike, type WireSeverity, addMessage, addOrUpdateSubscription, alertMessageAsText, assetStore, authStore, buildAppCommentMessageContent, buildAskCorvaMessageContent, buildFinalMessage, buildForwardMessageContent, buildGroupChannelName, canDeleteMessage, canEditMessage, channelContentFilterStore, channelToAsset, chatToastStore, clearLastOpenedRoom, clearLastOpenedThread, compareByActivity, compareByName, compareByRecencyDesc, configureChat, configureChatStorage, createAckScheduler, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, decodeMentionsForEdit, deriveAllowedChatAsset, encodeMentionsForSend, encodeOutgoingMentions, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, findMentionUserById, findMentionUserByUsername, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getCorvaUserName, getExternalChannel, getHydratedAckedId, getLastOpenedRoom, getLastOpenedThread, getMentionLabel, getMentionSearchHandle, getMentionedUserIds, getMessageTimestamp, getPauseUntil, getPlatformMentionUserIds, getReactionCount, getRoomDisplayName, getSystemMessageWithCorvaNames, getUserDisplayName, getUserSecondaryText, handleUnauthorized, hasReactions, hasUserReacted, initChat, installUnreadWatcher, isAlertMessage, isAppCommentMessage, isAskCorvaMessage, isChannelMuted, isChatAssetTypeAllowed, isChatStorageConfigured, isCurrentRoomSelection, isDeepEqual, isDefaultChannelPreference, isDisallowedAssetChatRoom, isDmGroup, isExternalServerChannel, isForwardedMessage, isGeneralRoom, isNotificationsPaused, isPauseActive, isSoftDeletedMessage, isSystemMessage, isUnknownMention, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, mapCorvaMessageNote, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, resolveMentionDisplayName, roomStore, saveLastChatActivity, saveLastOpenedRoom, saveLastOpenedThread, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, toEditableMentionText, toReadableMentionText, toReadableText, tokenizeMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
|
|
1813
|
+
export { ALERT_SEVERITY, ASSET_API_FIELDS, ASSET_CHAT_PREFIXES, ASSET_NOUN, type AckScheduler, type AlertData, type AlertSeverity, type AlertWirePayload, type AppCommentAttachment, type AppCommentData, type AppCommentWirePayload, type AppStateAdapter, type AskCorvaData, type AskCorvaWirePayload, type AssetChatChannel, type AssetChatSession, type AssetStore, type Attachment, type AuthStore, CHANNEL_NAME_MAX_LENGTH, CHANNEL_TYPES, CORVA_JOIN_MESSAGE_TYPE, CORVA_MESSAGE_TYPES, CORVA_SYS_PREFIX, type ChannelAsset, type ChannelContentFilter, type ChannelContentFilterStore, type ChannelContentFilters, type ChannelNameValidation, type ChannelNotificationPreference, type ChannelNotificationSetting, type ChannelUnread, type ChatAsset, type ChatAssetIdentity, type ChatAssetType, type ChatDates, type ChatHost, type ChatNotifier, type ChatPlatform, type CorvaAPIUser, type CorvaApiAdapter, type CorvaRevoltAuthResponse, type CorvaSystemMessage, type CorvaUser, type CorvaUserService, DATE_SEPARATOR_LABELS, DEFAULT_CHANNEL_CONTENT_FILTER, DEFAULT_CHANNEL_CONTENT_FILTERS, DEFAULT_CHANNEL_PREFERENCE, DEFAULT_FAVORITE_ROOMS_SETTINGS, DEFAULT_HIDDEN_ROOMS_SETTINGS, DEFAULT_NOTIFICATION_PREFERENCES, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_ROOM_LIST_ORDER, DIRECT_MESSAGE_PLACEHOLDER, type EditableMentionText, type ExternalChannel, type FavoriteRoomsSettings, type FavoriteRoomsStore, type FeedItemData, type FeedWirePayload, type FileAttachment, type FilterEntityWindow, type ForwardWirePayload, type ForwardedFrom, GENERAL_CHAT_NAME, type HiddenRoomsSettings, type HttpClient, type HttpClientConfig, HttpError, type HttpRequestInit, type HttpResponseLike, type JoinRequired, type JoinWirePayload, type KeyValueStorage, type LocatorContext, type LoginCredentials, MAX_ATTACHMENT_SIZE_BYTES, MAX_ATTACHMENT_SIZE_MB, MAX_NAVIGATION_HISTORY, MENTION_BOUNDARY_SOURCE, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MENTION_USERNAME_SOURCE, MUTE_PRESET_OPTIONS, type MemberStore, type MentionDisplayResolver, type MentionFormat, type MentionLookupOptions, type MentionSegment, type MentionTextSegment, type MentionUserIds, type Message, type MessageCache, type MessageFormData, type MessageStore, NOTIFICATION_DESTINATIONS, NOTIFICATION_SETTING_ALL, NOTIFICATION_SETTING_MENTIONS, NOTIFICATION_SETTING_NOTHING, type NavigationEntry, type NavigationHistoryStore, type NotificationDestination, type NotificationPreferences, type NotificationSettings, type NotificationStore, type OutgoingMentionOptions, PAUSE_INDEFINITELY, PAUSE_PRESETS, PAUSE_PRESET_OPTIONS, type PausePreset, type PausePresetOption, REVOLT_SYSTEM_USER_ID, ROOM_LIST_ORDER, type ReadyChannelData, type RevoltAPIInstance, type RevoltChannel, type RevoltIncomingMessagePayload, type RevoltLoginResponse, type RevoltMessage, type RevoltMessageResponse, type RevoltSocketConfig, type RevoltSocketEventHandlers, type RevoltSocketInstance, type RevoltUploadResponse, type RevoltUserResponse, type Room, type RoomListOrder, type RoomStore, type RoomType, SESSION_STORAGE_KEY, SIDEBAR_SECTIONS, SIDEBAR_TABS, SOFT_DELETE_MARKER, SYSTEM_MESSAGE_TEXTS, type SaveSessionParams, type SelectableAssetType, type SessionData, SessionManager, type SharedFile, type SharedRefs, type SidebarSectionKey, type SidebarTabKey, type SocketCloseEventLike, type SocketEventHandlersConfig, type StoredChannelPreference, type Subscription, type TextSegment, type TracesViewportRequest, type TypingManager, type UIStore, type UploadAndSendResult, type UploadFile, type UploadedFile, type User, type UserStatus, type ViewportDeepLink, type ViewportIndexCurve, type ViewportMode, WEBSOCKET_CONNECTING, WEBSOCKET_OPEN, type WebSocketLike, type WireSeverity, addMessage, addOrUpdateSubscription, alertMessageAsText, assetStore, authStore, buildAppCommentMessageContent, buildAskCorvaMessageContent, buildFinalMessage, buildForwardMessageContent, buildGroupChannelName, canDeleteMessage, canEditMessage, channelContentFilterStore, channelToAsset, chatToastStore, clearLastOpenedRoom, clearLastOpenedThread, compareByActivity, compareByName, compareByRecencyDesc, configureChat, configureChatStorage, createAckScheduler, createChannelSubscription, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, decodeMentionsForEdit, deriveAllowedChatAsset, encodeMentionsForSend, encodeOutgoingMentions, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, findMentionUserById, findMentionUserByUsername, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getCorvaUserName, getExternalChannel, getHydratedAckedId, getLastOpenedRoom, getLastOpenedThread, getMentionLabel, getMentionSearchHandle, getMentionedUserIds, getMessageTimestamp, getPauseUntil, getPlatformMentionUserIds, getReactionCount, getRoomDisplayName, getSystemMessageWithCorvaNames, getUserDisplayName, getUserSecondaryText, handleUnauthorized, hasReactions, hasUserReacted, initChat, installUnreadWatcher, isAlertMessage, isAppCommentMessage, isAskCorvaMessage, isChannelMuted, isChatAssetTypeAllowed, isChatStorageConfigured, isCurrentRoomSelection, isDeepEqual, isDefaultChannelPreference, isDisallowedAssetChatRoom, isDmGroup, isExternalServerChannel, isForwardedMessage, isGeneralRoom, isNotificationsPaused, isPauseActive, isSoftDeletedMessage, isSystemMessage, isUnknownMention, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, mapCorvaMessageNote, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, resolveMentionDisplayName, roomStore, saveLastChatActivity, saveLastOpenedRoom, saveLastOpenedThread, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, toEditableMentionText, toReadableMentionText, toReadableText, tokenizeMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
|
package/dist/index.js
CHANGED
|
@@ -1362,6 +1362,19 @@ var createGroupSubscription = (groupId, name, owner, recipientIds) => ({
|
|
|
1362
1362
|
groupMentions: 0,
|
|
1363
1363
|
recipients: recipientIds
|
|
1364
1364
|
});
|
|
1365
|
+
var createChannelSubscription = (channelId, name, lastMessageId) => ({
|
|
1366
|
+
_id: channelId,
|
|
1367
|
+
rid: channelId,
|
|
1368
|
+
name,
|
|
1369
|
+
t: "c",
|
|
1370
|
+
u: { _id: "", username: "" },
|
|
1371
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1372
|
+
open: true,
|
|
1373
|
+
alert: false,
|
|
1374
|
+
userMentions: 0,
|
|
1375
|
+
groupMentions: 0,
|
|
1376
|
+
last_message_id: lastMessageId
|
|
1377
|
+
});
|
|
1365
1378
|
var createDMSubscription = (roomId, recipient) => {
|
|
1366
1379
|
const displayName = recipient?.username || DIRECT_MESSAGE_PLACEHOLDER;
|
|
1367
1380
|
return {
|
|
@@ -5340,7 +5353,8 @@ function createEventRouter(userCache2, sessionToken, autumnUrl, handlers, getMem
|
|
|
5340
5353
|
channel_type: message.channel_type,
|
|
5341
5354
|
name: message.name,
|
|
5342
5355
|
recipients: message.recipients,
|
|
5343
|
-
owner: message.owner
|
|
5356
|
+
owner: message.owner,
|
|
5357
|
+
server: message.server
|
|
5344
5358
|
};
|
|
5345
5359
|
handlers.onRoomChange?.(message._id, payload);
|
|
5346
5360
|
break;
|
|
@@ -5360,6 +5374,9 @@ function createEventRouter(userCache2, sessionToken, autumnUrl, handlers, getMem
|
|
|
5360
5374
|
case "ServerMemberLeave":
|
|
5361
5375
|
if (typeof message.id === "string") handlers.onServerMembersChange?.(message.id);
|
|
5362
5376
|
break;
|
|
5377
|
+
case "ServerCreate":
|
|
5378
|
+
if (Array.isArray(message.channels)) handlers.onServerJoined?.(message.channels);
|
|
5379
|
+
break;
|
|
5363
5380
|
case "ServerMemberUpdate":
|
|
5364
5381
|
if (message.id?.server) handlers.onServerMembersChange?.(message.id.server);
|
|
5365
5382
|
break;
|
|
@@ -5592,6 +5609,21 @@ var createSocketEventHandlers = (config) => {
|
|
|
5592
5609
|
const getHidden = () => roomStore.getState();
|
|
5593
5610
|
const scheduleAck = (channelId, messageId) => sharedRefs.ackChannel?.(channelId, messageId);
|
|
5594
5611
|
const enqueueRoomTask = createRoomTaskQueue();
|
|
5612
|
+
const registerExternalServer = (channelId, serverId) => {
|
|
5613
|
+
if (!getExternalChannel(channelId)) {
|
|
5614
|
+
authStore.getState().setChannelServer(channelId, serverId, null);
|
|
5615
|
+
}
|
|
5616
|
+
};
|
|
5617
|
+
const isOnOtherServer = (serverId) => {
|
|
5618
|
+
const ownServerId = authStore.getState().serverId;
|
|
5619
|
+
return !!serverId && !!ownServerId && serverId !== ownServerId;
|
|
5620
|
+
};
|
|
5621
|
+
const isOtherServerChat = (ch) => ch.channel_type === CHANNEL_TYPES.TEXT_CHANNEL && !!ch.name && isOnOtherServer(ch.server) && !isGeneralRoom(ch);
|
|
5622
|
+
const getExternalServerChannels = (channels) => channels.filter(isOtherServerChat);
|
|
5623
|
+
const toMissingSubscriptions = (subs, channels) => {
|
|
5624
|
+
const listedRids = new Set(subs.map((sub) => sub.rid));
|
|
5625
|
+
return channels.filter((ch) => !listedRids.has(ch._id)).map((ch) => createChannelSubscription(ch._id, ch.name, ch.last_message_id));
|
|
5626
|
+
};
|
|
5595
5627
|
let hasAuthenticated = false;
|
|
5596
5628
|
return {
|
|
5597
5629
|
onConnected: () => {
|
|
@@ -5611,6 +5643,8 @@ var createSocketEventHandlers = (config) => {
|
|
|
5611
5643
|
},
|
|
5612
5644
|
onReady: (channels, channelUnreads) => {
|
|
5613
5645
|
if (!authStore.getState().user?._id) return;
|
|
5646
|
+
const externalChannels = getExternalServerChannels(channels);
|
|
5647
|
+
externalChannels.forEach((ch) => registerExternalServer(ch._id, ch.server));
|
|
5614
5648
|
const channelLastMsg = /* @__PURE__ */ new Map();
|
|
5615
5649
|
channels.forEach((ch) => {
|
|
5616
5650
|
if (ch.last_message_id) {
|
|
@@ -5618,8 +5652,12 @@ var createSocketEventHandlers = (config) => {
|
|
|
5618
5652
|
}
|
|
5619
5653
|
});
|
|
5620
5654
|
const applyUnreads = (ackedMap) => {
|
|
5621
|
-
const
|
|
5622
|
-
const
|
|
5655
|
+
const currentSubs = getRoom().subscriptions;
|
|
5656
|
+
const listedSubs = [
|
|
5657
|
+
...currentSubs,
|
|
5658
|
+
...toMissingSubscriptions(currentSubs, externalChannels)
|
|
5659
|
+
];
|
|
5660
|
+
const subs = listedSubs.map((sub) => {
|
|
5623
5661
|
const lastMsg = channelLastMsg.get(sub.rid) || sub.last_message_id;
|
|
5624
5662
|
const lastAcked = ackedMap.get(sub.rid);
|
|
5625
5663
|
const acked = getHydratedAckedId(
|
|
@@ -5659,6 +5697,17 @@ var createSocketEventHandlers = (config) => {
|
|
|
5659
5697
|
});
|
|
5660
5698
|
}
|
|
5661
5699
|
},
|
|
5700
|
+
onServerJoined: (channels) => {
|
|
5701
|
+
const externalChannels = getExternalServerChannels(channels);
|
|
5702
|
+
externalChannels.forEach((ch) => registerExternalServer(ch._id, ch.server));
|
|
5703
|
+
const currentSubs = getRoom().subscriptions;
|
|
5704
|
+
const joinedSubs = toMissingSubscriptions(currentSubs, externalChannels).map((sub) => ({
|
|
5705
|
+
...sub,
|
|
5706
|
+
last_acked_message_id: getHydratedAckedId(sub.rid, sub.last_message_id)
|
|
5707
|
+
}));
|
|
5708
|
+
if (!joinedSubs.length) return;
|
|
5709
|
+
roomStore.getState().setSubscriptions([...currentSubs, ...joinedSubs]);
|
|
5710
|
+
},
|
|
5662
5711
|
onChannelAck: (channelId, messageId) => {
|
|
5663
5712
|
const state = getRoom();
|
|
5664
5713
|
const updatedSubs = state.subscriptions.map(
|
|
@@ -5785,6 +5834,14 @@ var createSocketEventHandlers = (config) => {
|
|
|
5785
5834
|
try {
|
|
5786
5835
|
const payload = change;
|
|
5787
5836
|
if (payload?.event === "create" && (payload?.channel_type === CHANNEL_TYPES.GROUP || payload?.channel_type === CHANNEL_TYPES.TEXT_CHANNEL || payload?.channel_type === CHANNEL_TYPES.DIRECT_MESSAGE)) {
|
|
5837
|
+
const created = {
|
|
5838
|
+
_id: roomId,
|
|
5839
|
+
channel_type: payload.channel_type,
|
|
5840
|
+
name: payload.name,
|
|
5841
|
+
server: payload.server
|
|
5842
|
+
};
|
|
5843
|
+
if (isOtherServerChat(created)) registerExternalServer(roomId, created.server);
|
|
5844
|
+
else if (isOnOtherServer(payload.server)) return;
|
|
5788
5845
|
enqueueRoomTask(roomId, async () => {
|
|
5789
5846
|
const currentSubs = getRoom().subscriptions;
|
|
5790
5847
|
let subType = "c";
|
|
@@ -6236,6 +6293,6 @@ function ensureChatSession(corvaUser) {
|
|
|
6236
6293
|
return inFlight;
|
|
6237
6294
|
}
|
|
6238
6295
|
|
|
6239
|
-
export { ALERT_SEVERITY, ASSET_API_FIELDS, ASSET_CHAT_PREFIXES, ASSET_NOUN, CHANNEL_NAME_MAX_LENGTH, CHANNEL_TYPES, CORVA_JOIN_MESSAGE_TYPE, CORVA_MESSAGE_TYPES, CORVA_SYS_PREFIX, DATE_SEPARATOR_LABELS, DEFAULT_CHANNEL_CONTENT_FILTER, DEFAULT_CHANNEL_CONTENT_FILTERS, DEFAULT_CHANNEL_PREFERENCE, DEFAULT_FAVORITE_ROOMS_SETTINGS, DEFAULT_HIDDEN_ROOMS_SETTINGS, DEFAULT_NOTIFICATION_PREFERENCES, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_ROOM_LIST_ORDER, DIRECT_MESSAGE_PLACEHOLDER, GENERAL_CHAT_NAME, HttpError, MAX_ATTACHMENT_SIZE_BYTES, MAX_ATTACHMENT_SIZE_MB, MAX_NAVIGATION_HISTORY, MENTION_BOUNDARY_SOURCE, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MENTION_USERNAME_SOURCE, MUTE_PRESET_OPTIONS, NOTIFICATION_DESTINATIONS, NOTIFICATION_SETTING_ALL, NOTIFICATION_SETTING_MENTIONS, NOTIFICATION_SETTING_NOTHING, PAUSE_INDEFINITELY, PAUSE_PRESETS, PAUSE_PRESET_OPTIONS, REVOLT_SYSTEM_USER_ID, ROOM_LIST_ORDER, SESSION_STORAGE_KEY, SIDEBAR_SECTIONS, SIDEBAR_TABS, SOFT_DELETE_MARKER, SYSTEM_MESSAGE_TEXTS, SessionManager, WEBSOCKET_CONNECTING, WEBSOCKET_OPEN, addMessage, addOrUpdateSubscription, alertMessageAsText, assetStore, authStore, buildAppCommentMessageContent, buildAskCorvaMessageContent, buildFinalMessage, buildForwardMessageContent, buildGroupChannelName, canDeleteMessage, canEditMessage, channelContentFilterStore, channelToAsset, chatToastStore, clearLastOpenedRoom, clearLastOpenedThread, compareByActivity, compareByName, compareByRecencyDesc, configureChat, configureChatStorage, createAckScheduler, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, decodeMentionsForEdit, deriveAllowedChatAsset, encodeMentionsForSend, encodeOutgoingMentions, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, findMentionUserById, findMentionUserByUsername, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getCorvaUserName, getExternalChannel, getHydratedAckedId, getLastOpenedRoom, getLastOpenedThread, getMentionLabel, getMentionSearchHandle, getMentionedUserIds, getMessageTimestamp, getPauseUntil, getPlatformMentionUserIds, getReactionCount, getRoomDisplayName, getSystemMessageWithCorvaNames, getUserDisplayName, getUserSecondaryText, handleUnauthorized, hasReactions, hasUserReacted, initChat, installUnreadWatcher, isAlertMessage, isAppCommentMessage, isAskCorvaMessage, isChannelMuted, isChatAssetTypeAllowed, isChatStorageConfigured, isCurrentRoomSelection, isDeepEqual, isDefaultChannelPreference, isDisallowedAssetChatRoom, isDmGroup, isExternalServerChannel, isForwardedMessage, isGeneralRoom, isNotificationsPaused, isPauseActive, isSoftDeletedMessage, isSystemMessage, isUnknownMention, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, mapCorvaMessageNote, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, resolveMentionDisplayName, roomStore, saveLastChatActivity, saveLastOpenedRoom, saveLastOpenedThread, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, toEditableMentionText, toReadableMentionText, toReadableText, tokenizeMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
|
|
6296
|
+
export { ALERT_SEVERITY, ASSET_API_FIELDS, ASSET_CHAT_PREFIXES, ASSET_NOUN, CHANNEL_NAME_MAX_LENGTH, CHANNEL_TYPES, CORVA_JOIN_MESSAGE_TYPE, CORVA_MESSAGE_TYPES, CORVA_SYS_PREFIX, DATE_SEPARATOR_LABELS, DEFAULT_CHANNEL_CONTENT_FILTER, DEFAULT_CHANNEL_CONTENT_FILTERS, DEFAULT_CHANNEL_PREFERENCE, DEFAULT_FAVORITE_ROOMS_SETTINGS, DEFAULT_HIDDEN_ROOMS_SETTINGS, DEFAULT_NOTIFICATION_PREFERENCES, DEFAULT_NOTIFICATION_SETTINGS, DEFAULT_ROOM_LIST_ORDER, DIRECT_MESSAGE_PLACEHOLDER, GENERAL_CHAT_NAME, HttpError, MAX_ATTACHMENT_SIZE_BYTES, MAX_ATTACHMENT_SIZE_MB, MAX_NAVIGATION_HISTORY, MENTION_BOUNDARY_SOURCE, MENTION_REPLACE_PATTERN, MENTION_SPLIT_PATTERN, MENTION_USERNAME_SOURCE, MUTE_PRESET_OPTIONS, NOTIFICATION_DESTINATIONS, NOTIFICATION_SETTING_ALL, NOTIFICATION_SETTING_MENTIONS, NOTIFICATION_SETTING_NOTHING, PAUSE_INDEFINITELY, PAUSE_PRESETS, PAUSE_PRESET_OPTIONS, REVOLT_SYSTEM_USER_ID, ROOM_LIST_ORDER, SESSION_STORAGE_KEY, SIDEBAR_SECTIONS, SIDEBAR_TABS, SOFT_DELETE_MARKER, SYSTEM_MESSAGE_TEXTS, SessionManager, WEBSOCKET_CONNECTING, WEBSOCKET_OPEN, addMessage, addOrUpdateSubscription, alertMessageAsText, assetStore, authStore, buildAppCommentMessageContent, buildAskCorvaMessageContent, buildFinalMessage, buildForwardMessageContent, buildGroupChannelName, canDeleteMessage, canEditMessage, channelContentFilterStore, channelToAsset, chatToastStore, clearLastOpenedRoom, clearLastOpenedThread, compareByActivity, compareByName, compareByRecencyDesc, configureChat, configureChatStorage, createAckScheduler, createChannelSubscription, createCorvaUserService, createDMSubscription, createGroupSubscription, createHttpClient, createLatestWinsQueue, createMemoryStorage, createMessageCache, createRevoltAPI, createRevoltSocket, createRoomTaskQueue, createSocketEventHandlers, createSoftDeletedMessage, createTypingManager, decodeMentionsForEdit, deriveAllowedChatAsset, encodeMentionsForSend, encodeOutgoingMentions, enrichWithCorvaData, ensureChatSession, extractTimestampFromULID, failOptimisticMessage, favoriteRoomsStore, findGeneralRoom, findMentionUserById, findMentionUserByUsername, formatAssetChatName, getAppCommentAttachments, getAssetChatChannel, getAssetChatSession, getAssetTypeFromDisplayName, getChatHost, getChatStorage, getCorvaUserFields, getCorvaUserName, getExternalChannel, getHydratedAckedId, getLastOpenedRoom, getLastOpenedThread, getMentionLabel, getMentionSearchHandle, getMentionedUserIds, getMessageTimestamp, getPauseUntil, getPlatformMentionUserIds, getReactionCount, getRoomDisplayName, getSystemMessageWithCorvaNames, getUserDisplayName, getUserSecondaryText, handleUnauthorized, hasReactions, hasUserReacted, initChat, installUnreadWatcher, isAlertMessage, isAppCommentMessage, isAskCorvaMessage, isChannelMuted, isChatAssetTypeAllowed, isChatStorageConfigured, isCurrentRoomSelection, isDeepEqual, isDefaultChannelPreference, isDisallowedAssetChatRoom, isDmGroup, isExternalServerChannel, isForwardedMessage, isGeneralRoom, isNotificationsPaused, isPauseActive, isSoftDeletedMessage, isSystemMessage, isUnknownMention, isUnread, isUserOnline, isValidPausePreset, isVisibleUnread, keepChatUsed, loadUntilFound, mapCorvaMessageNote, memberStore, messageStore, navigationHistoryStore, notificationStore, onChatStorageConfigured, parseCorvaSystemMessage, prepareRoomSelection, removeMessageFromList, removeSubscription, resetAssetStore, resetAuthStore, resetChannelContentFilterStore, resetChatAssetPermissionsSnapshot, resetChatHost, resetFavoriteRoomsStore, resetMemberStore, resetMessageStore, resetNavigationHistoryStore, resetNotificationStore, resetRoomStore, resetUIStore, resolveMentionDisplayName, roomStore, saveLastChatActivity, saveLastOpenedRoom, saveLastOpenedThread, searchMessages, searchRooms, searchUsers, selectCanGoBack, selectCanGoForward, setAllowedChatAssetTypes, settleOptimisticMessage, sharedRefs, sortChannels, sortDMs, sortMessagesByTime, sortUsersByStatus, stripPlatformMentions, toEditableMentionText, toReadableMentionText, toReadableText, tokenizeMentions, uiStore, updateMessageInList, uploadAndSend, validateChannelName, waitForNextPaint, wasRecentlyActive, withChannelPreferenceDefaults };
|
|
6240
6297
|
//# sourceMappingURL=index.js.map
|
|
6241
6298
|
//# sourceMappingURL=index.js.map
|