stream-chat-react-native-core 4.10.0 → 5.0.0-offline-support.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/lib/commonjs/components/Attachment/Attachment.js +1 -1
- package/lib/commonjs/components/Attachment/AttachmentActions.js +1 -1
- package/lib/commonjs/components/Attachment/Card.js +1 -1
- package/lib/commonjs/components/Attachment/FileAttachment.js +1 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +1 -1
- package/lib/commonjs/components/Attachment/FileIcon.js +1 -1
- package/lib/commonjs/components/Attachment/GallaryImage.js +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +1 -1
- package/lib/commonjs/components/Attachment/Giphy.js +1 -1
- package/lib/commonjs/components/Attachment/ImageLoadingFailedIndicator.js +1 -1
- package/lib/commonjs/components/Attachment/ImageLoadingIndicator.js +1 -1
- package/lib/commonjs/components/Attachment/VideoThumbnail.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerError.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerErrorImage.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentSelectionBar.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/CameraSelectorIcon.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/FileSelectorIcon.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/ImageOverlaySelectedComponent.js +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/ImageSelectorIcon.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/commonjs/components/Avatar/Avatar.js +29 -16
- package/lib/commonjs/components/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/components/Avatar/GroupAvatar.js +26 -19
- package/lib/commonjs/components/Avatar/GroupAvatar.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +227 -257
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js +33 -3
- package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListFooterLoadingIndicator.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListHeaderErrorIndicator.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListLoadingIndicator.js +1 -1
- package/lib/commonjs/components/ChannelList/ChannelListMessenger.js +20 -8
- package/lib/commonjs/components/ChannelList/ChannelListMessenger.js.map +1 -1
- package/lib/commonjs/components/ChannelList/Skeleton.js +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/handleEventToSyncDB.js +187 -0
- package/lib/commonjs/components/ChannelList/hooks/listeners/handleEventToSyncDB.js.map +1 -0
- package/lib/commonjs/components/ChannelList/hooks/listeners/useAddedToChannelNotification.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useAddedToChannelNotification.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelDeleted.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelDeleted.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelHidden.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelHidden.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelTruncated.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelTruncated.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelUpdated.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelUpdated.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelVisible.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useChannelVisible.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useConnectionRecovered.js +128 -18
- package/lib/commonjs/components/ChannelList/hooks/listeners/useConnectionRecovered.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useNewMessage.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useNewMessage.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useNewMessageNotification.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useNewMessageNotification.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useRemovedFromChannelNotification.js +2 -2
- package/lib/commonjs/components/ChannelList/hooks/listeners/useRemovedFromChannelNotification.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useSyncDatabase.js +34 -0
- package/lib/commonjs/components/ChannelList/hooks/listeners/useSyncDatabase.js.map +1 -0
- package/lib/commonjs/components/ChannelList/hooks/listeners/useUserPresence.js +4 -4
- package/lib/commonjs/components/ChannelList/hooks/listeners/useUserPresence.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +47 -21
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +7 -9
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js +8 -6
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewUnreadCount.js +1 -1
- package/lib/commonjs/components/Chat/Chat.js +18 -7
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +3 -1
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/useMutedUsers.js +3 -3
- package/lib/commonjs/components/Chat/hooks/useMutedUsers.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryOverlay.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGridHandle.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ProgressControl.js +1 -1
- package/lib/commonjs/components/Indicators/EmptyStateIndicator.js +1 -1
- package/lib/commonjs/components/Indicators/LoadingDot.js +1 -1
- package/lib/commonjs/components/Indicators/LoadingDots.js +1 -1
- package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js +1 -1
- package/lib/commonjs/components/Indicators/LoadingIndicator.js +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +1 -1
- package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleViewFC.js +1 -1
- package/lib/commonjs/components/Message/Message.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageDeleted.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessagePinnedHeader.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageReplies.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/ReactionList.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.test.js +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActions.js +1 -1
- package/lib/commonjs/components/MessageInput/AttachButton.js +1 -1
- package/lib/commonjs/components/MessageInput/CommandsButton.js +1 -1
- package/lib/commonjs/components/MessageInput/CooldownTimer.js +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +1 -1
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +1 -1
- package/lib/commonjs/components/MessageInput/MoreOptionsButton.js +1 -1
- package/lib/commonjs/components/MessageInput/SendButton.js +1 -1
- package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js +1 -1
- package/lib/commonjs/components/MessageInput/ShowThreadMessageInChannelButton.js +1 -1
- package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js +1 -1
- package/lib/commonjs/components/MessageInput/components/InputEditingStateHeader.js +1 -1
- package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js +1 -1
- package/lib/commonjs/components/MessageInput/components/InputReplyStateHeader.js +1 -1
- package/lib/commonjs/components/MessageList/DateHeader.js +1 -1
- package/lib/commonjs/components/MessageList/InlineDateSeparator.js +1 -1
- package/lib/commonjs/components/MessageList/InlineLoadingMoreIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/InlineLoadingMoreRecentIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/InlineLoadingMoreThreadIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +135 -107
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageSystem.js +1 -1
- package/lib/commonjs/components/MessageList/NetworkDownIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +1 -1
- package/lib/commonjs/components/MessageList/TypingIndicator.js +1 -1
- package/lib/commonjs/components/MessageList/TypingIndicatorContainer.js +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionList.js +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayBackdrop.js +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayReactionList.js +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayReactions.js +1 -1
- package/lib/commonjs/components/MessageOverlay/OverlayReactionsAvatar.js +1 -1
- package/lib/commonjs/components/RTLComponents/WritingDirectionAwareText.js +1 -1
- package/lib/commonjs/components/Reply/Reply.js +1 -1
- package/lib/commonjs/components/Spinner/Spinner.js +1 -1
- package/lib/commonjs/components/Thread/Thread.js +1 -1
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +1 -1
- package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +1 -1
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js +3 -3
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/channelsContext/ChannelsContext.js +1 -1
- package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +1 -1
- package/lib/commonjs/contexts/chatContext/ChatContext.js +3 -3
- package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js +1 -1
- package/lib/commonjs/contexts/keyboardContext/KeyboardContext.js +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/hooks/useResettableState.test.js +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +1 -1
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +1 -1
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +3 -3
- package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
- package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +1 -1
- package/lib/commonjs/contexts/themeContext/ThemeContext.js +1 -1
- package/lib/commonjs/contexts/threadContext/ThreadContext.js +1 -1
- package/lib/commonjs/contexts/translationContext/TranslationContext.js +1 -1
- package/lib/commonjs/contexts/typingContext/TypingContext.js +1 -1
- package/lib/commonjs/hooks/useImageErrorHandler.js +35 -0
- package/lib/commonjs/hooks/useImageErrorHandler.js.map +1 -0
- package/lib/commonjs/icons/ArrowRight.js +1 -1
- package/lib/commonjs/icons/AtMentions.js +1 -1
- package/lib/commonjs/icons/Attach.js +1 -1
- package/lib/commonjs/icons/Audio.js +1 -1
- package/lib/commonjs/icons/CSV.js +1 -1
- package/lib/commonjs/icons/Camera.js +1 -1
- package/lib/commonjs/icons/Check.js +1 -1
- package/lib/commonjs/icons/CheckAll.js +1 -1
- package/lib/commonjs/icons/CheckSend.js +1 -1
- package/lib/commonjs/icons/CircleClose.js +1 -1
- package/lib/commonjs/icons/CirclePlus.js +1 -1
- package/lib/commonjs/icons/CircleRight.js +1 -1
- package/lib/commonjs/icons/Close.js +1 -1
- package/lib/commonjs/icons/Copy.js +1 -1
- package/lib/commonjs/icons/CurveLineLeftUp.js +1 -1
- package/lib/commonjs/icons/DOC.js +1 -1
- package/lib/commonjs/icons/DOCX.js +1 -1
- package/lib/commonjs/icons/Delete.js +1 -1
- package/lib/commonjs/icons/Down.js +1 -1
- package/lib/commonjs/icons/DownloadArrow.js +1 -1
- package/lib/commonjs/icons/DownloadCloud.js +1 -1
- package/lib/commonjs/icons/Edit.js +1 -1
- package/lib/commonjs/icons/Error.js +1 -1
- package/lib/commonjs/icons/Eye.js +1 -1
- package/lib/commonjs/icons/Flag.js +1 -1
- package/lib/commonjs/icons/Folder.js +1 -1
- package/lib/commonjs/icons/GenericFile.js +1 -1
- package/lib/commonjs/icons/GiphyIcon.js +1 -1
- package/lib/commonjs/icons/Grid.js +1 -1
- package/lib/commonjs/icons/Group.js +1 -1
- package/lib/commonjs/icons/HTML.js +1 -1
- package/lib/commonjs/icons/Imgur.js +1 -1
- package/lib/commonjs/icons/LOLReaction.js +1 -1
- package/lib/commonjs/icons/Lightning.js +1 -1
- package/lib/commonjs/icons/Link.js +1 -1
- package/lib/commonjs/icons/Loading.js +1 -1
- package/lib/commonjs/icons/Logo.js +1 -1
- package/lib/commonjs/icons/LoveReaction.js +1 -1
- package/lib/commonjs/icons/MD.js +1 -1
- package/lib/commonjs/icons/MailOpen.js +1 -1
- package/lib/commonjs/icons/MenuPointHorizontal.js +1 -1
- package/lib/commonjs/icons/MenuPointVertical.js +1 -1
- package/lib/commonjs/icons/MessageFlag.js +1 -1
- package/lib/commonjs/icons/MessageIcon.js +1 -1
- package/lib/commonjs/icons/Mute.js +1 -1
- package/lib/commonjs/icons/Notification.js +1 -1
- package/lib/commonjs/icons/ODT.js +1 -1
- package/lib/commonjs/icons/PDF.js +1 -1
- package/lib/commonjs/icons/PPT.js +1 -1
- package/lib/commonjs/icons/PPTX.js +1 -1
- package/lib/commonjs/icons/Pause.js +1 -1
- package/lib/commonjs/icons/Picture.js +1 -1
- package/lib/commonjs/icons/Pin.js +1 -1
- package/lib/commonjs/icons/PinHeader.js +1 -1
- package/lib/commonjs/icons/Play.js +1 -1
- package/lib/commonjs/icons/RAR.js +1 -1
- package/lib/commonjs/icons/RTF.js +1 -1
- package/lib/commonjs/icons/Recorder.js +1 -1
- package/lib/commonjs/icons/Refresh.js +1 -1
- package/lib/commonjs/icons/SEVEN_Z.js +1 -1
- package/lib/commonjs/icons/Search.js +1 -1
- package/lib/commonjs/icons/SendRight.js +1 -1
- package/lib/commonjs/icons/SendUp.js +1 -1
- package/lib/commonjs/icons/Share.js +1 -1
- package/lib/commonjs/icons/ShareRightArrow.js +1 -1
- package/lib/commonjs/icons/Smile.js +1 -1
- package/lib/commonjs/icons/Sound.js +1 -1
- package/lib/commonjs/icons/TAR.js +1 -1
- package/lib/commonjs/icons/TXT.js +1 -1
- package/lib/commonjs/icons/ThreadReply.js +1 -1
- package/lib/commonjs/icons/ThumbsDownReaction.js +1 -1
- package/lib/commonjs/icons/ThumbsUpReaction.js +1 -1
- package/lib/commonjs/icons/Time.js +1 -1
- package/lib/commonjs/icons/Unknown.js +1 -1
- package/lib/commonjs/icons/Unpin.js +1 -1
- package/lib/commonjs/icons/User.js +1 -1
- package/lib/commonjs/icons/UserAdd.js +1 -1
- package/lib/commonjs/icons/UserAdmin.js +1 -1
- package/lib/commonjs/icons/UserDelete.js +1 -1
- package/lib/commonjs/icons/UserMinus.js +1 -1
- package/lib/commonjs/icons/Video.js +1 -1
- package/lib/commonjs/icons/Warning.js +1 -1
- package/lib/commonjs/icons/WutReaction.js +1 -1
- package/lib/commonjs/icons/XLS.js +1 -1
- package/lib/commonjs/icons/XLSX.js +1 -1
- package/lib/commonjs/icons/ZIP.js +1 -1
- package/lib/commonjs/icons/utils/base.js +1 -1
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mock-builders/DB/consts.js +15 -0
- package/lib/commonjs/mock-builders/DB/consts.js.map +1 -0
- package/lib/commonjs/mock-builders/DB/mock.js +125 -0
- package/lib/commonjs/mock-builders/DB/mock.js.map +1 -0
- package/lib/commonjs/mock-builders/api/channelMocks.js +1 -0
- package/lib/commonjs/mock-builders/api/channelMocks.js.map +1 -1
- package/lib/commonjs/mock-builders/event/memberAdded.js +17 -0
- package/lib/commonjs/mock-builders/event/memberAdded.js.map +1 -0
- package/lib/commonjs/mock-builders/event/memberRemoved.js +17 -0
- package/lib/commonjs/mock-builders/event/memberRemoved.js.map +1 -0
- package/lib/commonjs/mock-builders/event/memberUpdated.js +17 -0
- package/lib/commonjs/mock-builders/event/memberUpdated.js.map +1 -0
- package/lib/commonjs/mock-builders/event/reactionDeleted.js +18 -0
- package/lib/commonjs/mock-builders/event/reactionDeleted.js.map +1 -0
- package/lib/commonjs/mock-builders/event/reactionNew.js +18 -0
- package/lib/commonjs/mock-builders/event/reactionNew.js.map +1 -0
- package/lib/commonjs/mock-builders/event/reactionUpdated.js +18 -0
- package/lib/commonjs/mock-builders/event/reactionUpdated.js.map +1 -0
- package/lib/commonjs/mock-builders/generator/reaction.js +1 -1
- package/lib/commonjs/mock-builders/generator/reaction.js.map +1 -1
- package/lib/commonjs/store/QuickSqliteClient.js +148 -0
- package/lib/commonjs/store/QuickSqliteClient.js.map +1 -0
- package/lib/commonjs/store/apis/deleteChannel.js +26 -0
- package/lib/commonjs/store/apis/deleteChannel.js.map +1 -0
- package/lib/commonjs/store/apis/deleteMember.js +28 -0
- package/lib/commonjs/store/apis/deleteMember.js.map +1 -0
- package/lib/commonjs/store/apis/deleteMessagesForChannel.js +26 -0
- package/lib/commonjs/store/apis/deleteMessagesForChannel.js.map +1 -0
- package/lib/commonjs/store/apis/deleteReactions.js +28 -0
- package/lib/commonjs/store/apis/deleteReactions.js.map +1 -0
- package/lib/commonjs/store/apis/getAllChannelIds.js +16 -0
- package/lib/commonjs/store/apis/getAllChannelIds.js.map +1 -0
- package/lib/commonjs/store/apis/getChannelMessages.js +45 -0
- package/lib/commonjs/store/apis/getChannelMessages.js.map +1 -0
- package/lib/commonjs/store/apis/getChannels.js +60 -0
- package/lib/commonjs/store/apis/getChannels.js.map +1 -0
- package/lib/commonjs/store/apis/getLastSyncedAt.js +23 -0
- package/lib/commonjs/store/apis/getLastSyncedAt.js.map +1 -0
- package/lib/commonjs/store/apis/getMembers.js +25 -0
- package/lib/commonjs/store/apis/getMembers.js.map +1 -0
- package/lib/commonjs/store/apis/getReads.js +25 -0
- package/lib/commonjs/store/apis/getReads.js.map +1 -0
- package/lib/commonjs/store/apis/queries/selectChannelIdsForFilterSort.js +31 -0
- package/lib/commonjs/store/apis/queries/selectChannelIdsForFilterSort.js.map +1 -0
- package/lib/commonjs/store/apis/queries/selectChannels.js +30 -0
- package/lib/commonjs/store/apis/queries/selectChannels.js.map +1 -0
- package/lib/commonjs/store/apis/queries/selectMembersForChannels.js +27 -0
- package/lib/commonjs/store/apis/queries/selectMembersForChannels.js.map +1 -0
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js +27 -0
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -0
- package/lib/commonjs/store/apis/queries/selectReactionsForMessages.js +27 -0
- package/lib/commonjs/store/apis/queries/selectReactionsForMessages.js.map +1 -0
- package/lib/commonjs/store/apis/queries/selectReadsForChannels.js +27 -0
- package/lib/commonjs/store/apis/queries/selectReadsForChannels.js.map +1 -0
- package/lib/commonjs/store/apis/updateMessage.js +69 -0
- package/lib/commonjs/store/apis/updateMessage.js.map +1 -0
- package/lib/commonjs/store/apis/updateReaction.js +53 -0
- package/lib/commonjs/store/apis/updateReaction.js.map +1 -0
- package/lib/commonjs/store/apis/upsertChannelData.js +26 -0
- package/lib/commonjs/store/apis/upsertChannelData.js.map +1 -0
- package/lib/commonjs/store/apis/upsertChannels.js +83 -0
- package/lib/commonjs/store/apis/upsertChannels.js.map +1 -0
- package/lib/commonjs/store/apis/upsertCidsForQuery.js +34 -0
- package/lib/commonjs/store/apis/upsertCidsForQuery.js.map +1 -0
- package/lib/commonjs/store/apis/upsertLastSyncedAt.js +22 -0
- package/lib/commonjs/store/apis/upsertLastSyncedAt.js.map +1 -0
- package/lib/commonjs/store/apis/upsertMembers.js +39 -0
- package/lib/commonjs/store/apis/upsertMembers.js.map +1 -0
- package/lib/commonjs/store/apis/upsertMessages.js +52 -0
- package/lib/commonjs/store/apis/upsertMessages.js.map +1 -0
- package/lib/commonjs/store/apis/upsertReads.js +39 -0
- package/lib/commonjs/store/apis/upsertReads.js.map +1 -0
- package/lib/commonjs/store/apis/utils/convertFilterSortToQuery.js +13 -0
- package/lib/commonjs/store/apis/utils/convertFilterSortToQuery.js.map +1 -0
- package/lib/commonjs/store/constants.js +11 -0
- package/lib/commonjs/store/constants.js.map +1 -0
- package/lib/commonjs/store/mappers/mapChannelDataToStorable.js +67 -0
- package/lib/commonjs/store/mappers/mapChannelDataToStorable.js.map +1 -0
- package/lib/commonjs/store/mappers/mapDateTimeToStorable.js +12 -0
- package/lib/commonjs/store/mappers/mapDateTimeToStorable.js.map +1 -0
- package/lib/commonjs/store/mappers/mapMemberToStorable.js +39 -0
- package/lib/commonjs/store/mappers/mapMemberToStorable.js.map +1 -0
- package/lib/commonjs/store/mappers/mapMessageToStorable.js +42 -0
- package/lib/commonjs/store/mappers/mapMessageToStorable.js.map +1 -0
- package/lib/commonjs/store/mappers/mapReactionToStorable.js +34 -0
- package/lib/commonjs/store/mappers/mapReactionToStorable.js.map +1 -0
- package/lib/commonjs/store/mappers/mapReadToStorable.js +23 -0
- package/lib/commonjs/store/mappers/mapReadToStorable.js.map +1 -0
- package/lib/commonjs/store/mappers/mapStorableToChannel.js +65 -0
- package/lib/commonjs/store/mappers/mapStorableToChannel.js.map +1 -0
- package/lib/commonjs/store/mappers/mapStorableToMember.js +38 -0
- package/lib/commonjs/store/mappers/mapStorableToMember.js.map +1 -0
- package/lib/commonjs/store/mappers/mapStorableToMessage.js +50 -0
- package/lib/commonjs/store/mappers/mapStorableToMessage.js.map +1 -0
- package/lib/commonjs/store/mappers/mapStorableToReaction.js +31 -0
- package/lib/commonjs/store/mappers/mapStorableToReaction.js.map +1 -0
- package/lib/commonjs/store/mappers/mapStorableToRead.js +20 -0
- package/lib/commonjs/store/mappers/mapStorableToRead.js.map +1 -0
- package/lib/commonjs/store/mappers/mapStorableToUser.js +31 -0
- package/lib/commonjs/store/mappers/mapStorableToUser.js.map +1 -0
- package/lib/commonjs/store/mappers/mapUserToStorable.js +34 -0
- package/lib/commonjs/store/mappers/mapUserToStorable.js.map +1 -0
- package/lib/commonjs/store/schema.js +161 -0
- package/lib/commonjs/store/schema.js.map +1 -0
- package/lib/commonjs/store/sqlite-utils/appendWhereCluase.js +37 -0
- package/lib/commonjs/store/sqlite-utils/appendWhereCluase.js.map +1 -0
- package/lib/commonjs/store/sqlite-utils/createCreateTableQuery.js +35 -0
- package/lib/commonjs/store/sqlite-utils/createCreateTableQuery.js.map +1 -0
- package/lib/commonjs/store/sqlite-utils/createDeleteQuery.js +14 -0
- package/lib/commonjs/store/sqlite-utils/createDeleteQuery.js.map +1 -0
- package/lib/commonjs/store/sqlite-utils/createSelectQuery.js +26 -0
- package/lib/commonjs/store/sqlite-utils/createSelectQuery.js.map +1 -0
- package/lib/commonjs/store/sqlite-utils/createUpdateQuery.js +29 -0
- package/lib/commonjs/store/sqlite-utils/createUpdateQuery.js.map +1 -0
- package/lib/commonjs/store/sqlite-utils/createUpsertQuery.js +30 -0
- package/lib/commonjs/store/sqlite-utils/createUpsertQuery.js.map +1 -0
- package/lib/commonjs/store/sqlite-utils/printRow.js +33 -0
- package/lib/commonjs/store/sqlite-utils/printRow.js.map +1 -0
- package/lib/commonjs/store/types.js +4 -0
- package/lib/commonjs/store/types.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +1 -1
- package/lib/module/components/Attachment/AttachmentActions.js +1 -1
- package/lib/module/components/Attachment/Card.js +1 -1
- package/lib/module/components/Attachment/FileAttachment.js +1 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js +1 -1
- package/lib/module/components/Attachment/FileIcon.js +1 -1
- package/lib/module/components/Attachment/GallaryImage.js +1 -1
- package/lib/module/components/Attachment/Gallery.js +1 -1
- package/lib/module/components/Attachment/Giphy.js +1 -1
- package/lib/module/components/Attachment/ImageLoadingFailedIndicator.js +1 -1
- package/lib/module/components/Attachment/ImageLoadingIndicator.js +1 -1
- package/lib/module/components/Attachment/VideoThumbnail.js +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerError.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerErrorImage.js +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentSelectionBar.js +1 -1
- package/lib/module/components/AttachmentPicker/components/CameraSelectorIcon.js +1 -1
- package/lib/module/components/AttachmentPicker/components/FileSelectorIcon.js +1 -1
- package/lib/module/components/AttachmentPicker/components/ImageOverlaySelectedComponent.js +1 -1
- package/lib/module/components/AttachmentPicker/components/ImageSelectorIcon.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
- package/lib/module/components/Avatar/Avatar.js +29 -16
- package/lib/module/components/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/Avatar/GroupAvatar.js +26 -19
- package/lib/module/components/Avatar/GroupAvatar.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +227 -257
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelList.js +33 -3
- package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelListFooterLoadingIndicator.js +1 -1
- package/lib/module/components/ChannelList/ChannelListHeaderErrorIndicator.js +1 -1
- package/lib/module/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js +1 -1
- package/lib/module/components/ChannelList/ChannelListLoadingIndicator.js +1 -1
- package/lib/module/components/ChannelList/ChannelListMessenger.js +20 -8
- package/lib/module/components/ChannelList/ChannelListMessenger.js.map +1 -1
- package/lib/module/components/ChannelList/Skeleton.js +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/handleEventToSyncDB.js +187 -0
- package/lib/module/components/ChannelList/hooks/listeners/handleEventToSyncDB.js.map +1 -0
- package/lib/module/components/ChannelList/hooks/listeners/useAddedToChannelNotification.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useAddedToChannelNotification.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useChannelDeleted.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useChannelDeleted.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useChannelHidden.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useChannelHidden.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useChannelTruncated.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useChannelTruncated.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useChannelUpdated.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useChannelUpdated.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useChannelVisible.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useChannelVisible.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useConnectionRecovered.js +128 -18
- package/lib/module/components/ChannelList/hooks/listeners/useConnectionRecovered.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useNewMessage.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useNewMessage.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useNewMessageNotification.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useNewMessageNotification.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useRemovedFromChannelNotification.js +2 -2
- package/lib/module/components/ChannelList/hooks/listeners/useRemovedFromChannelNotification.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/listeners/useSyncDatabase.js +34 -0
- package/lib/module/components/ChannelList/hooks/listeners/useSyncDatabase.js.map +1 -0
- package/lib/module/components/ChannelList/hooks/listeners/useUserPresence.js +4 -4
- package/lib/module/components/ChannelList/hooks/listeners/useUserPresence.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +47 -21
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelAvatar.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelAvatar.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreview.js +7 -9
- package/lib/module/components/ChannelPreview/ChannelPreview.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js +8 -6
- package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewUnreadCount.js +1 -1
- package/lib/module/components/Chat/Chat.js +18 -7
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/useCreateChatContext.js +3 -1
- package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
- package/lib/module/components/Chat/hooks/useMutedUsers.js +3 -3
- package/lib/module/components/Chat/hooks/useMutedUsers.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryOverlay.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGrid.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGridHandle.js +1 -1
- package/lib/module/components/ImageGallery/components/ProgressControl.js +1 -1
- package/lib/module/components/Indicators/EmptyStateIndicator.js +1 -1
- package/lib/module/components/Indicators/LoadingDot.js +1 -1
- package/lib/module/components/Indicators/LoadingDots.js +1 -1
- package/lib/module/components/Indicators/LoadingErrorIndicator.js +1 -1
- package/lib/module/components/Indicators/LoadingIndicator.js +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +1 -1
- package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleViewFC.js +1 -1
- package/lib/module/components/Message/Message.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageAvatar.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageDeleted.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageFooter.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessagePinnedHeader.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageReplies.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageStatus.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageTextContainer.js +1 -1
- package/lib/module/components/Message/MessageSimple/ReactionList.js +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.js +1 -1
- package/lib/module/components/Message/MessageSimple/utils/renderText.test.js +1 -1
- package/lib/module/components/Message/hooks/useMessageActions.js +1 -1
- package/lib/module/components/MessageInput/AttachButton.js +1 -1
- package/lib/module/components/MessageInput/CommandsButton.js +1 -1
- package/lib/module/components/MessageInput/CooldownTimer.js +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +1 -1
- package/lib/module/components/MessageInput/ImageUploadPreview.js +1 -1
- package/lib/module/components/MessageInput/InputButtons.js +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +1 -1
- package/lib/module/components/MessageInput/MoreOptionsButton.js +1 -1
- package/lib/module/components/MessageInput/SendButton.js +1 -1
- package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js +1 -1
- package/lib/module/components/MessageInput/ShowThreadMessageInChannelButton.js +1 -1
- package/lib/module/components/MessageInput/UploadProgressIndicator.js +1 -1
- package/lib/module/components/MessageInput/components/InputEditingStateHeader.js +1 -1
- package/lib/module/components/MessageInput/components/InputGiphySearch.js +1 -1
- package/lib/module/components/MessageInput/components/InputReplyStateHeader.js +1 -1
- package/lib/module/components/MessageList/DateHeader.js +1 -1
- package/lib/module/components/MessageList/InlineDateSeparator.js +1 -1
- package/lib/module/components/MessageList/InlineLoadingMoreIndicator.js +1 -1
- package/lib/module/components/MessageList/InlineLoadingMoreRecentIndicator.js +1 -1
- package/lib/module/components/MessageList/InlineLoadingMoreThreadIndicator.js +1 -1
- package/lib/module/components/MessageList/InlineUnreadIndicator.js +1 -1
- package/lib/module/components/MessageList/MessageList.js +135 -107
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/MessageSystem.js +1 -1
- package/lib/module/components/MessageList/NetworkDownIndicator.js +1 -1
- package/lib/module/components/MessageList/ScrollToBottomButton.js +1 -1
- package/lib/module/components/MessageList/TypingIndicator.js +1 -1
- package/lib/module/components/MessageList/TypingIndicatorContainer.js +1 -1
- package/lib/module/components/MessageOverlay/MessageActionList.js +1 -1
- package/lib/module/components/MessageOverlay/MessageActionListItem.js +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +1 -1
- package/lib/module/components/MessageOverlay/OverlayBackdrop.js +1 -1
- package/lib/module/components/MessageOverlay/OverlayReactionList.js +1 -1
- package/lib/module/components/MessageOverlay/OverlayReactions.js +1 -1
- package/lib/module/components/MessageOverlay/OverlayReactionsAvatar.js +1 -1
- package/lib/module/components/RTLComponents/WritingDirectionAwareText.js +1 -1
- package/lib/module/components/Reply/Reply.js +1 -1
- package/lib/module/components/Spinner/Spinner.js +1 -1
- package/lib/module/components/Thread/Thread.js +1 -1
- package/lib/module/components/Thread/components/ThreadFooterComponent.js +1 -1
- package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +1 -1
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js +3 -3
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/channelsContext/ChannelsContext.js +1 -1
- package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +1 -1
- package/lib/module/contexts/chatContext/ChatContext.js +3 -3
- package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js +1 -1
- package/lib/module/contexts/keyboardContext/KeyboardContext.js +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +1 -1
- package/lib/module/contexts/messageOverlayContext/hooks/useResettableState.test.js +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +1 -1
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +1 -1
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +3 -3
- package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js.map +1 -1
- package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +1 -1
- package/lib/module/contexts/themeContext/ThemeContext.js +1 -1
- package/lib/module/contexts/threadContext/ThreadContext.js +1 -1
- package/lib/module/contexts/translationContext/TranslationContext.js +1 -1
- package/lib/module/contexts/typingContext/TypingContext.js +1 -1
- package/lib/module/hooks/useImageErrorHandler.js +35 -0
- package/lib/module/hooks/useImageErrorHandler.js.map +1 -0
- package/lib/module/icons/ArrowRight.js +1 -1
- package/lib/module/icons/AtMentions.js +1 -1
- package/lib/module/icons/Attach.js +1 -1
- package/lib/module/icons/Audio.js +1 -1
- package/lib/module/icons/CSV.js +1 -1
- package/lib/module/icons/Camera.js +1 -1
- package/lib/module/icons/Check.js +1 -1
- package/lib/module/icons/CheckAll.js +1 -1
- package/lib/module/icons/CheckSend.js +1 -1
- package/lib/module/icons/CircleClose.js +1 -1
- package/lib/module/icons/CirclePlus.js +1 -1
- package/lib/module/icons/CircleRight.js +1 -1
- package/lib/module/icons/Close.js +1 -1
- package/lib/module/icons/Copy.js +1 -1
- package/lib/module/icons/CurveLineLeftUp.js +1 -1
- package/lib/module/icons/DOC.js +1 -1
- package/lib/module/icons/DOCX.js +1 -1
- package/lib/module/icons/Delete.js +1 -1
- package/lib/module/icons/Down.js +1 -1
- package/lib/module/icons/DownloadArrow.js +1 -1
- package/lib/module/icons/DownloadCloud.js +1 -1
- package/lib/module/icons/Edit.js +1 -1
- package/lib/module/icons/Error.js +1 -1
- package/lib/module/icons/Eye.js +1 -1
- package/lib/module/icons/Flag.js +1 -1
- package/lib/module/icons/Folder.js +1 -1
- package/lib/module/icons/GenericFile.js +1 -1
- package/lib/module/icons/GiphyIcon.js +1 -1
- package/lib/module/icons/Grid.js +1 -1
- package/lib/module/icons/Group.js +1 -1
- package/lib/module/icons/HTML.js +1 -1
- package/lib/module/icons/Imgur.js +1 -1
- package/lib/module/icons/LOLReaction.js +1 -1
- package/lib/module/icons/Lightning.js +1 -1
- package/lib/module/icons/Link.js +1 -1
- package/lib/module/icons/Loading.js +1 -1
- package/lib/module/icons/Logo.js +1 -1
- package/lib/module/icons/LoveReaction.js +1 -1
- package/lib/module/icons/MD.js +1 -1
- package/lib/module/icons/MailOpen.js +1 -1
- package/lib/module/icons/MenuPointHorizontal.js +1 -1
- package/lib/module/icons/MenuPointVertical.js +1 -1
- package/lib/module/icons/MessageFlag.js +1 -1
- package/lib/module/icons/MessageIcon.js +1 -1
- package/lib/module/icons/Mute.js +1 -1
- package/lib/module/icons/Notification.js +1 -1
- package/lib/module/icons/ODT.js +1 -1
- package/lib/module/icons/PDF.js +1 -1
- package/lib/module/icons/PPT.js +1 -1
- package/lib/module/icons/PPTX.js +1 -1
- package/lib/module/icons/Pause.js +1 -1
- package/lib/module/icons/Picture.js +1 -1
- package/lib/module/icons/Pin.js +1 -1
- package/lib/module/icons/PinHeader.js +1 -1
- package/lib/module/icons/Play.js +1 -1
- package/lib/module/icons/RAR.js +1 -1
- package/lib/module/icons/RTF.js +1 -1
- package/lib/module/icons/Recorder.js +1 -1
- package/lib/module/icons/Refresh.js +1 -1
- package/lib/module/icons/SEVEN_Z.js +1 -1
- package/lib/module/icons/Search.js +1 -1
- package/lib/module/icons/SendRight.js +1 -1
- package/lib/module/icons/SendUp.js +1 -1
- package/lib/module/icons/Share.js +1 -1
- package/lib/module/icons/ShareRightArrow.js +1 -1
- package/lib/module/icons/Smile.js +1 -1
- package/lib/module/icons/Sound.js +1 -1
- package/lib/module/icons/TAR.js +1 -1
- package/lib/module/icons/TXT.js +1 -1
- package/lib/module/icons/ThreadReply.js +1 -1
- package/lib/module/icons/ThumbsDownReaction.js +1 -1
- package/lib/module/icons/ThumbsUpReaction.js +1 -1
- package/lib/module/icons/Time.js +1 -1
- package/lib/module/icons/Unknown.js +1 -1
- package/lib/module/icons/Unpin.js +1 -1
- package/lib/module/icons/User.js +1 -1
- package/lib/module/icons/UserAdd.js +1 -1
- package/lib/module/icons/UserAdmin.js +1 -1
- package/lib/module/icons/UserDelete.js +1 -1
- package/lib/module/icons/UserMinus.js +1 -1
- package/lib/module/icons/Video.js +1 -1
- package/lib/module/icons/Warning.js +1 -1
- package/lib/module/icons/WutReaction.js +1 -1
- package/lib/module/icons/XLS.js +1 -1
- package/lib/module/icons/XLSX.js +1 -1
- package/lib/module/icons/ZIP.js +1 -1
- package/lib/module/icons/utils/base.js +1 -1
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mock-builders/DB/consts.js +15 -0
- package/lib/module/mock-builders/DB/consts.js.map +1 -0
- package/lib/module/mock-builders/DB/mock.js +125 -0
- package/lib/module/mock-builders/DB/mock.js.map +1 -0
- package/lib/module/mock-builders/api/channelMocks.js +1 -0
- package/lib/module/mock-builders/api/channelMocks.js.map +1 -1
- package/lib/module/mock-builders/event/memberAdded.js +17 -0
- package/lib/module/mock-builders/event/memberAdded.js.map +1 -0
- package/lib/module/mock-builders/event/memberRemoved.js +17 -0
- package/lib/module/mock-builders/event/memberRemoved.js.map +1 -0
- package/lib/module/mock-builders/event/memberUpdated.js +17 -0
- package/lib/module/mock-builders/event/memberUpdated.js.map +1 -0
- package/lib/module/mock-builders/event/reactionDeleted.js +18 -0
- package/lib/module/mock-builders/event/reactionDeleted.js.map +1 -0
- package/lib/module/mock-builders/event/reactionNew.js +18 -0
- package/lib/module/mock-builders/event/reactionNew.js.map +1 -0
- package/lib/module/mock-builders/event/reactionUpdated.js +18 -0
- package/lib/module/mock-builders/event/reactionUpdated.js.map +1 -0
- package/lib/module/mock-builders/generator/reaction.js +1 -1
- package/lib/module/mock-builders/generator/reaction.js.map +1 -1
- package/lib/module/store/QuickSqliteClient.js +148 -0
- package/lib/module/store/QuickSqliteClient.js.map +1 -0
- package/lib/module/store/apis/deleteChannel.js +26 -0
- package/lib/module/store/apis/deleteChannel.js.map +1 -0
- package/lib/module/store/apis/deleteMember.js +28 -0
- package/lib/module/store/apis/deleteMember.js.map +1 -0
- package/lib/module/store/apis/deleteMessagesForChannel.js +26 -0
- package/lib/module/store/apis/deleteMessagesForChannel.js.map +1 -0
- package/lib/module/store/apis/deleteReactions.js +28 -0
- package/lib/module/store/apis/deleteReactions.js.map +1 -0
- package/lib/module/store/apis/getAllChannelIds.js +16 -0
- package/lib/module/store/apis/getAllChannelIds.js.map +1 -0
- package/lib/module/store/apis/getChannelMessages.js +45 -0
- package/lib/module/store/apis/getChannelMessages.js.map +1 -0
- package/lib/module/store/apis/getChannels.js +60 -0
- package/lib/module/store/apis/getChannels.js.map +1 -0
- package/lib/module/store/apis/getLastSyncedAt.js +23 -0
- package/lib/module/store/apis/getLastSyncedAt.js.map +1 -0
- package/lib/module/store/apis/getMembers.js +25 -0
- package/lib/module/store/apis/getMembers.js.map +1 -0
- package/lib/module/store/apis/getReads.js +25 -0
- package/lib/module/store/apis/getReads.js.map +1 -0
- package/lib/module/store/apis/queries/selectChannelIdsForFilterSort.js +31 -0
- package/lib/module/store/apis/queries/selectChannelIdsForFilterSort.js.map +1 -0
- package/lib/module/store/apis/queries/selectChannels.js +30 -0
- package/lib/module/store/apis/queries/selectChannels.js.map +1 -0
- package/lib/module/store/apis/queries/selectMembersForChannels.js +27 -0
- package/lib/module/store/apis/queries/selectMembersForChannels.js.map +1 -0
- package/lib/module/store/apis/queries/selectMessagesForChannels.js +27 -0
- package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -0
- package/lib/module/store/apis/queries/selectReactionsForMessages.js +27 -0
- package/lib/module/store/apis/queries/selectReactionsForMessages.js.map +1 -0
- package/lib/module/store/apis/queries/selectReadsForChannels.js +27 -0
- package/lib/module/store/apis/queries/selectReadsForChannels.js.map +1 -0
- package/lib/module/store/apis/updateMessage.js +69 -0
- package/lib/module/store/apis/updateMessage.js.map +1 -0
- package/lib/module/store/apis/updateReaction.js +53 -0
- package/lib/module/store/apis/updateReaction.js.map +1 -0
- package/lib/module/store/apis/upsertChannelData.js +26 -0
- package/lib/module/store/apis/upsertChannelData.js.map +1 -0
- package/lib/module/store/apis/upsertChannels.js +83 -0
- package/lib/module/store/apis/upsertChannels.js.map +1 -0
- package/lib/module/store/apis/upsertCidsForQuery.js +34 -0
- package/lib/module/store/apis/upsertCidsForQuery.js.map +1 -0
- package/lib/module/store/apis/upsertLastSyncedAt.js +22 -0
- package/lib/module/store/apis/upsertLastSyncedAt.js.map +1 -0
- package/lib/module/store/apis/upsertMembers.js +39 -0
- package/lib/module/store/apis/upsertMembers.js.map +1 -0
- package/lib/module/store/apis/upsertMessages.js +52 -0
- package/lib/module/store/apis/upsertMessages.js.map +1 -0
- package/lib/module/store/apis/upsertReads.js +39 -0
- package/lib/module/store/apis/upsertReads.js.map +1 -0
- package/lib/module/store/apis/utils/convertFilterSortToQuery.js +13 -0
- package/lib/module/store/apis/utils/convertFilterSortToQuery.js.map +1 -0
- package/lib/module/store/constants.js +11 -0
- package/lib/module/store/constants.js.map +1 -0
- package/lib/module/store/mappers/mapChannelDataToStorable.js +67 -0
- package/lib/module/store/mappers/mapChannelDataToStorable.js.map +1 -0
- package/lib/module/store/mappers/mapDateTimeToStorable.js +12 -0
- package/lib/module/store/mappers/mapDateTimeToStorable.js.map +1 -0
- package/lib/module/store/mappers/mapMemberToStorable.js +39 -0
- package/lib/module/store/mappers/mapMemberToStorable.js.map +1 -0
- package/lib/module/store/mappers/mapMessageToStorable.js +42 -0
- package/lib/module/store/mappers/mapMessageToStorable.js.map +1 -0
- package/lib/module/store/mappers/mapReactionToStorable.js +34 -0
- package/lib/module/store/mappers/mapReactionToStorable.js.map +1 -0
- package/lib/module/store/mappers/mapReadToStorable.js +23 -0
- package/lib/module/store/mappers/mapReadToStorable.js.map +1 -0
- package/lib/module/store/mappers/mapStorableToChannel.js +65 -0
- package/lib/module/store/mappers/mapStorableToChannel.js.map +1 -0
- package/lib/module/store/mappers/mapStorableToMember.js +38 -0
- package/lib/module/store/mappers/mapStorableToMember.js.map +1 -0
- package/lib/module/store/mappers/mapStorableToMessage.js +50 -0
- package/lib/module/store/mappers/mapStorableToMessage.js.map +1 -0
- package/lib/module/store/mappers/mapStorableToReaction.js +31 -0
- package/lib/module/store/mappers/mapStorableToReaction.js.map +1 -0
- package/lib/module/store/mappers/mapStorableToRead.js +20 -0
- package/lib/module/store/mappers/mapStorableToRead.js.map +1 -0
- package/lib/module/store/mappers/mapStorableToUser.js +31 -0
- package/lib/module/store/mappers/mapStorableToUser.js.map +1 -0
- package/lib/module/store/mappers/mapUserToStorable.js +34 -0
- package/lib/module/store/mappers/mapUserToStorable.js.map +1 -0
- package/lib/module/store/schema.js +161 -0
- package/lib/module/store/schema.js.map +1 -0
- package/lib/module/store/sqlite-utils/appendWhereCluase.js +37 -0
- package/lib/module/store/sqlite-utils/appendWhereCluase.js.map +1 -0
- package/lib/module/store/sqlite-utils/createCreateTableQuery.js +35 -0
- package/lib/module/store/sqlite-utils/createCreateTableQuery.js.map +1 -0
- package/lib/module/store/sqlite-utils/createDeleteQuery.js +14 -0
- package/lib/module/store/sqlite-utils/createDeleteQuery.js.map +1 -0
- package/lib/module/store/sqlite-utils/createSelectQuery.js +26 -0
- package/lib/module/store/sqlite-utils/createSelectQuery.js.map +1 -0
- package/lib/module/store/sqlite-utils/createUpdateQuery.js +29 -0
- package/lib/module/store/sqlite-utils/createUpdateQuery.js.map +1 -0
- package/lib/module/store/sqlite-utils/createUpsertQuery.js +30 -0
- package/lib/module/store/sqlite-utils/createUpsertQuery.js.map +1 -0
- package/lib/module/store/sqlite-utils/printRow.js +33 -0
- package/lib/module/store/sqlite-utils/printRow.js.map +1 -0
- package/lib/module/store/types.js +4 -0
- package/lib/module/store/types.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/__tests__/utils/BetterSqlite.d.ts +8 -0
- package/lib/typescript/components/Channel/Channel.d.ts +3 -5
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreatePaginatedMessageListContext.d.ts +1 -1
- package/lib/typescript/components/ChannelList/hooks/listeners/handleEventToSyncDB.d.ts +2 -0
- package/lib/typescript/components/ChannelList/hooks/listeners/useConnectionRecovered.d.ts +3 -2
- package/lib/typescript/components/ChannelList/hooks/listeners/useSyncDatabase.d.ts +6 -0
- package/lib/typescript/components/ChannelList/hooks/usePaginatedChannels.d.ts +4 -2
- package/lib/typescript/components/Chat/Chat.d.ts +4 -0
- package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +17 -0
- package/lib/typescript/contexts/chatContext/ChatContext.d.ts +1 -0
- package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts +4 -0
- package/lib/typescript/hooks/useImageErrorHandler.d.ts +5 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/store/QuickSqliteClient.d.ts +18 -0
- package/lib/typescript/store/apis/deleteChannel.d.ts +4 -0
- package/lib/typescript/store/apis/deleteMember.d.ts +6 -0
- package/lib/typescript/store/apis/deleteMessagesForChannel.d.ts +4 -0
- package/lib/typescript/store/apis/deleteReactions.d.ts +4 -0
- package/lib/typescript/store/apis/getAllChannelIds.d.ts +1 -0
- package/lib/typescript/store/apis/getChannelMessages.d.ts +6 -0
- package/lib/typescript/store/apis/getChannels.d.ts +7 -0
- package/lib/typescript/store/apis/getLastSyncedAt.d.ts +3 -0
- package/lib/typescript/store/apis/getMembers.d.ts +5 -0
- package/lib/typescript/store/apis/getReads.d.ts +5 -0
- package/lib/typescript/store/apis/queries/selectChannelIdsForFilterSort.d.ts +6 -0
- package/lib/typescript/store/apis/queries/selectChannels.d.ts +4 -0
- package/lib/typescript/store/apis/queries/selectMembersForChannels.d.ts +2 -0
- package/lib/typescript/store/apis/queries/selectMessagesForChannels.d.ts +2 -0
- package/lib/typescript/store/apis/queries/selectReactionsForMessages.d.ts +2 -0
- package/lib/typescript/store/apis/queries/selectReadsForChannels.d.ts +2 -0
- package/lib/typescript/store/apis/updateMessage.d.ts +6 -0
- package/lib/typescript/store/apis/updateReaction.d.ts +7 -0
- package/lib/typescript/store/apis/upsertChannelData.d.ts +5 -0
- package/lib/typescript/store/apis/upsertChannels.d.ts +9 -0
- package/lib/typescript/store/apis/upsertCidsForQuery.d.ts +7 -0
- package/lib/typescript/store/apis/upsertLastSyncedAt.d.ts +4 -0
- package/lib/typescript/store/apis/upsertMembers.d.ts +7 -0
- package/lib/typescript/store/apis/upsertMessages.d.ts +6 -0
- package/lib/typescript/store/apis/upsertReads.d.ts +7 -0
- package/lib/typescript/store/apis/utils/convertFilterSortToQuery.d.ts +6 -0
- package/lib/typescript/store/constants.d.ts +3 -0
- package/lib/typescript/store/mappers/mapChannelDataToStorable.d.ts +4 -0
- package/lib/typescript/store/mappers/mapDateTimeToStorable.d.ts +1 -0
- package/lib/typescript/store/mappers/mapMemberToStorable.d.ts +7 -0
- package/lib/typescript/store/mappers/mapMessageToStorable.d.ts +3 -0
- package/lib/typescript/store/mappers/mapReactionToStorable.d.ts +3 -0
- package/lib/typescript/store/mappers/mapReadToStorable.d.ts +7 -0
- package/lib/typescript/store/mappers/mapStorableToChannel.d.ts +4 -0
- package/lib/typescript/store/mappers/mapStorableToMember.d.ts +4 -0
- package/lib/typescript/store/mappers/mapStorableToMessage.d.ts +8 -0
- package/lib/typescript/store/mappers/mapStorableToReaction.d.ts +4 -0
- package/lib/typescript/store/mappers/mapStorableToRead.d.ts +4 -0
- package/lib/typescript/store/mappers/mapStorableToUser.d.ts +4 -0
- package/lib/typescript/store/mappers/mapUserToStorable.d.ts +3 -0
- package/lib/typescript/store/schema.d.ts +110 -0
- package/lib/typescript/store/sqlite-utils/__tests__/createSelectQuery.test.d.ts +1 -0
- package/lib/typescript/store/sqlite-utils/appendWhereCluase.d.ts +2 -0
- package/lib/typescript/store/sqlite-utils/createCreateTableQuery.d.ts +2 -0
- package/lib/typescript/store/sqlite-utils/createDeleteQuery.d.ts +12 -0
- package/lib/typescript/store/sqlite-utils/createSelectQuery.d.ts +13 -0
- package/lib/typescript/store/sqlite-utils/createUpdateQuery.d.ts +13 -0
- package/lib/typescript/store/sqlite-utils/createUpsertQuery.d.ts +11 -0
- package/lib/typescript/store/sqlite-utils/printRow.d.ts +2 -0
- package/lib/typescript/store/types.d.ts +8 -0
- package/package.json +4 -2
- package/src/__tests__/offline-feature.test.js +619 -0
- package/src/__tests__/utils/BetterSqlite.js +44 -0
- package/src/components/Avatar/Avatar.tsx +46 -31
- package/src/components/Avatar/GroupAvatar.tsx +55 -43
- package/src/components/Channel/Channel.tsx +101 -136
- package/src/components/Channel/hooks/useCreateChannelContext.ts +2 -0
- package/src/components/Channel/hooks/useCreatePaginatedMessageListContext.ts +2 -0
- package/src/components/ChannelList/ChannelList.tsx +25 -2
- package/src/components/ChannelList/ChannelListMessenger.tsx +4 -0
- package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +1 -0
- package/src/components/ChannelList/hooks/listeners/handleEventToSyncDB.ts +175 -0
- package/src/components/ChannelList/hooks/listeners/useAddedToChannelNotification.ts +2 -2
- package/src/components/ChannelList/hooks/listeners/useChannelDeleted.ts +2 -2
- package/src/components/ChannelList/hooks/listeners/useChannelHidden.ts +2 -2
- package/src/components/ChannelList/hooks/listeners/useChannelTruncated.ts +2 -2
- package/src/components/ChannelList/hooks/listeners/useChannelUpdated.ts +2 -2
- package/src/components/ChannelList/hooks/listeners/useChannelVisible.ts +2 -2
- package/src/components/ChannelList/hooks/listeners/useConnectionRecovered.ts +59 -14
- package/src/components/ChannelList/hooks/listeners/useNewMessage.ts +3 -2
- package/src/components/ChannelList/hooks/listeners/useNewMessageNotification.ts +2 -2
- package/src/components/ChannelList/hooks/listeners/useRemovedFromChannelNotification.ts +2 -2
- package/src/components/ChannelList/hooks/listeners/useSyncDatabase.ts +30 -0
- package/src/components/ChannelList/hooks/listeners/useUserPresence.ts +5 -4
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +34 -10
- package/src/components/ChannelPreview/ChannelAvatar.tsx +3 -3
- package/src/components/ChannelPreview/ChannelPreview.tsx +8 -8
- package/src/components/ChannelPreview/ChannelPreviewMessage.tsx +10 -9
- package/src/components/Chat/Chat.tsx +24 -3
- package/src/components/Chat/hooks/useCreateChatContext.ts +7 -3
- package/src/components/Chat/hooks/useMutedUsers.ts +5 -3
- package/src/components/MessageList/MessageList.tsx +156 -100
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +2 -0
- package/src/contexts/channelContext/ChannelContext.tsx +15 -0
- package/src/contexts/chatContext/ChatContext.tsx +1 -0
- package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +4 -0
- package/src/hooks/useImageErrorHandler.ts +16 -0
- package/src/index.ts +3 -0
- package/src/mock-builders/DB/consts.ts +2 -0
- package/src/mock-builders/DB/mock.ts +114 -0
- package/src/mock-builders/api/channelMocks.tsx +1 -0
- package/src/mock-builders/event/memberAdded.js +9 -0
- package/src/mock-builders/event/memberRemoved.js +9 -0
- package/src/mock-builders/event/memberUpdated.js +9 -0
- package/src/mock-builders/event/reactionDeleted.js +10 -0
- package/src/mock-builders/event/reactionNew.js +10 -0
- package/src/mock-builders/event/reactionUpdated.js +10 -0
- package/src/mock-builders/generator/reaction.js +1 -1
- package/src/store/QuickSqliteClient.ts +120 -0
- package/src/store/apis/deleteChannel.ts +14 -0
- package/src/store/apis/deleteMember.ts +25 -0
- package/src/store/apis/deleteMessagesForChannel.ts +19 -0
- package/src/store/apis/deleteReactions.ts +24 -0
- package/src/store/apis/getAllChannelIds.ts +7 -0
- package/src/store/apis/getChannelMessages.ts +50 -0
- package/src/store/apis/getChannels.ts +43 -0
- package/src/store/apis/getLastSyncedAt.ts +13 -0
- package/src/store/apis/getMembers.ts +26 -0
- package/src/store/apis/getReads.ts +26 -0
- package/src/store/apis/queries/selectChannelIdsForFilterSort.ts +28 -0
- package/src/store/apis/queries/selectChannels.ts +19 -0
- package/src/store/apis/queries/selectMembersForChannels.ts +32 -0
- package/src/store/apis/queries/selectMessagesForChannels.ts +40 -0
- package/src/store/apis/queries/selectReactionsForMessages.ts +33 -0
- package/src/store/apis/queries/selectReadsForChannels.ts +30 -0
- package/src/store/apis/updateMessage.ts +65 -0
- package/src/store/apis/updateReaction.ts +54 -0
- package/src/store/apis/upsertChannelData.ts +20 -0
- package/src/store/apis/upsertChannels.ts +79 -0
- package/src/store/apis/upsertCidsForQuery.ts +30 -0
- package/src/store/apis/upsertLastSyncedAt.ts +17 -0
- package/src/store/apis/upsertMembers.ts +41 -0
- package/src/store/apis/upsertMessages.ts +43 -0
- package/src/store/apis/upsertReads.ts +41 -0
- package/src/store/apis/utils/convertFilterSortToQuery.ts +14 -0
- package/src/store/constants.ts +3 -0
- package/src/store/mappers/mapChannelDataToStorable.ts +67 -0
- package/src/store/mappers/mapDateTimeToStorable.ts +5 -0
- package/src/store/mappers/mapMemberToStorable.ts +45 -0
- package/src/store/mappers/mapMessageToStorable.ts +35 -0
- package/src/store/mappers/mapReactionToStorable.ts +19 -0
- package/src/store/mappers/mapReadToStorable.ts +25 -0
- package/src/store/mappers/mapStorableToChannel.ts +69 -0
- package/src/store/mappers/mapStorableToMember.ts +42 -0
- package/src/store/mappers/mapStorableToMessage.ts +40 -0
- package/src/store/mappers/mapStorableToReaction.ts +25 -0
- package/src/store/mappers/mapStorableToRead.ts +21 -0
- package/src/store/mappers/mapStorableToUser.ts +23 -0
- package/src/store/mappers/mapUserToStorable.ts +18 -0
- package/src/store/schema.ts +284 -0
- package/src/store/sqlite-utils/__tests__/createSelectQuery.test.ts +21 -0
- package/src/store/sqlite-utils/appendWhereCluase.ts +31 -0
- package/src/store/sqlite-utils/createCreateTableQuery.ts +39 -0
- package/src/store/sqlite-utils/createDeleteQuery.ts +23 -0
- package/src/store/sqlite-utils/createSelectQuery.ts +25 -0
- package/src/store/sqlite-utils/createUpdateQuery.ts +27 -0
- package/src/store/sqlite-utils/createUpsertQuery.ts +48 -0
- package/src/store/sqlite-utils/printRow.ts +28 -0
- package/src/store/types.ts +11 -0
- package/src/version.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MessageResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import { mapDateTimeToStorable } from './mapDateTimeToStorable';
|
|
4
|
+
|
|
5
|
+
import type { TableRow } from '../types';
|
|
6
|
+
|
|
7
|
+
export const mapMessageToStorable = (message: MessageResponse): TableRow<'messages'> => {
|
|
8
|
+
const {
|
|
9
|
+
attachments,
|
|
10
|
+
cid,
|
|
11
|
+
created_at,
|
|
12
|
+
deleted_at,
|
|
13
|
+
id,
|
|
14
|
+
reaction_counts,
|
|
15
|
+
text,
|
|
16
|
+
type,
|
|
17
|
+
updated_at,
|
|
18
|
+
user,
|
|
19
|
+
...extraData
|
|
20
|
+
} = message;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
attachments: JSON.stringify(attachments),
|
|
24
|
+
cid: cid || '',
|
|
25
|
+
createdAt: mapDateTimeToStorable(created_at),
|
|
26
|
+
deletedAt: mapDateTimeToStorable(deleted_at),
|
|
27
|
+
extraData: JSON.stringify(extraData),
|
|
28
|
+
id,
|
|
29
|
+
reactionCounts: JSON.stringify(reaction_counts),
|
|
30
|
+
text,
|
|
31
|
+
type,
|
|
32
|
+
updatedAt: mapDateTimeToStorable(updated_at),
|
|
33
|
+
userId: user?.id,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactionResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import { mapDateTimeToStorable } from './mapDateTimeToStorable';
|
|
4
|
+
|
|
5
|
+
import type { TableRow } from '../types';
|
|
6
|
+
|
|
7
|
+
export const mapReactionToStorable = (reaction: ReactionResponse): TableRow<'reactions'> => {
|
|
8
|
+
const { created_at, message_id, score, type, updated_at, user, ...extraData } = reaction;
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
createdAt: mapDateTimeToStorable(created_at),
|
|
12
|
+
extraData: JSON.stringify(extraData),
|
|
13
|
+
messageId: message_id,
|
|
14
|
+
score,
|
|
15
|
+
type: type || '',
|
|
16
|
+
updatedAt: mapDateTimeToStorable(updated_at),
|
|
17
|
+
userId: user?.id,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReadResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import { mapDateTimeToStorable } from './mapDateTimeToStorable';
|
|
4
|
+
|
|
5
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
6
|
+
import type { TableRow } from '../types';
|
|
7
|
+
|
|
8
|
+
export const mapReadToStorable = <
|
|
9
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
10
|
+
>({
|
|
11
|
+
cid,
|
|
12
|
+
read,
|
|
13
|
+
}: {
|
|
14
|
+
cid: string;
|
|
15
|
+
read: ReadResponse<StreamChatGenerics>;
|
|
16
|
+
}): TableRow<'reads'> => {
|
|
17
|
+
const { last_read, unread_messages, user } = read;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
cid,
|
|
21
|
+
lastRead: mapDateTimeToStorable(last_read),
|
|
22
|
+
unreadMessages: unread_messages,
|
|
23
|
+
userId: user?.id,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ChannelAPIResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
4
|
+
import type { TableRow } from '../types';
|
|
5
|
+
|
|
6
|
+
export const mapStorableToChannel = <
|
|
7
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
8
|
+
>(
|
|
9
|
+
channelRow: TableRow<'channels'>,
|
|
10
|
+
): Omit<
|
|
11
|
+
ChannelAPIResponse<StreamChatGenerics>,
|
|
12
|
+
'duration' | 'messages' | 'members' | 'pinned_messages'
|
|
13
|
+
> => {
|
|
14
|
+
const {
|
|
15
|
+
autoTranslationEnabled,
|
|
16
|
+
autoTranslationLanguage,
|
|
17
|
+
cid,
|
|
18
|
+
config,
|
|
19
|
+
cooldown,
|
|
20
|
+
createdAt,
|
|
21
|
+
createdById,
|
|
22
|
+
deletedAt,
|
|
23
|
+
disabled,
|
|
24
|
+
extraData,
|
|
25
|
+
frozen,
|
|
26
|
+
hidden,
|
|
27
|
+
id,
|
|
28
|
+
invites,
|
|
29
|
+
lastMessageAt,
|
|
30
|
+
memberCount,
|
|
31
|
+
muted,
|
|
32
|
+
ownCapabilities,
|
|
33
|
+
team,
|
|
34
|
+
truncatedAt,
|
|
35
|
+
truncatedBy,
|
|
36
|
+
truncatedById,
|
|
37
|
+
type,
|
|
38
|
+
updatedAt,
|
|
39
|
+
} = channelRow;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
channel: {
|
|
43
|
+
auto_translation_enabled: autoTranslationEnabled,
|
|
44
|
+
auto_translation_language: autoTranslationLanguage,
|
|
45
|
+
cid,
|
|
46
|
+
config: config && JSON.parse(config),
|
|
47
|
+
cooldown,
|
|
48
|
+
created_at: createdAt,
|
|
49
|
+
created_by_id: createdById,
|
|
50
|
+
deleted_at: deletedAt,
|
|
51
|
+
disabled,
|
|
52
|
+
frozen,
|
|
53
|
+
hidden,
|
|
54
|
+
id,
|
|
55
|
+
invites: invites && JSON.parse(invites),
|
|
56
|
+
last_message_at: lastMessageAt,
|
|
57
|
+
memberCount,
|
|
58
|
+
muted,
|
|
59
|
+
own_capabilities: ownCapabilities && JSON.parse(ownCapabilities),
|
|
60
|
+
team,
|
|
61
|
+
truncated_at: truncatedAt,
|
|
62
|
+
truncated_by: truncatedBy,
|
|
63
|
+
truncated_by_id: truncatedById,
|
|
64
|
+
type,
|
|
65
|
+
updated_at: updatedAt,
|
|
66
|
+
...(extraData ? JSON.parse(extraData) : {}),
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ChannelMemberResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import { mapStorableToUser } from './mapStorableToUser';
|
|
4
|
+
|
|
5
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
6
|
+
import type { TableRowJoinedUser } from '../types';
|
|
7
|
+
|
|
8
|
+
export const mapStorableToMember = <
|
|
9
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
10
|
+
>(
|
|
11
|
+
memberRow: TableRowJoinedUser<'members'>,
|
|
12
|
+
): ChannelMemberResponse<StreamChatGenerics> => {
|
|
13
|
+
const {
|
|
14
|
+
banned,
|
|
15
|
+
channelRole,
|
|
16
|
+
createdAt,
|
|
17
|
+
inviteAcceptedAt,
|
|
18
|
+
invited,
|
|
19
|
+
inviteRejectedAt,
|
|
20
|
+
isModerator,
|
|
21
|
+
role,
|
|
22
|
+
shadowBanned,
|
|
23
|
+
updatedAt,
|
|
24
|
+
user,
|
|
25
|
+
userId,
|
|
26
|
+
} = memberRow;
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
banned,
|
|
30
|
+
channel_role: channelRole,
|
|
31
|
+
created_at: createdAt,
|
|
32
|
+
invite_accepted_at: inviteAcceptedAt,
|
|
33
|
+
invite_rejected_at: inviteRejectedAt,
|
|
34
|
+
invited,
|
|
35
|
+
is_moderator: isModerator,
|
|
36
|
+
role,
|
|
37
|
+
shadow_banned: shadowBanned,
|
|
38
|
+
updated_at: updatedAt,
|
|
39
|
+
user: mapStorableToUser(user),
|
|
40
|
+
user_id: userId,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { MessageResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import { mapStorableToReaction } from './mapStorableToReaction';
|
|
4
|
+
|
|
5
|
+
import { mapStorableToUser } from './mapStorableToUser';
|
|
6
|
+
|
|
7
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
8
|
+
|
|
9
|
+
import type { TableRowJoinedUser } from '../types';
|
|
10
|
+
|
|
11
|
+
export const mapStorableToMessage = <
|
|
12
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
13
|
+
>({
|
|
14
|
+
currentUserId,
|
|
15
|
+
messageRow,
|
|
16
|
+
reactionRows,
|
|
17
|
+
}: {
|
|
18
|
+
currentUserId: string;
|
|
19
|
+
messageRow: TableRowJoinedUser<'messages'>;
|
|
20
|
+
reactionRows: TableRowJoinedUser<'reactions'>[];
|
|
21
|
+
}): MessageResponse<StreamChatGenerics> => {
|
|
22
|
+
const { createdAt, deletedAt, extraData, reactionCounts, updatedAt, user, ...rest } = messageRow;
|
|
23
|
+
const latestReactions =
|
|
24
|
+
reactionRows?.map((reaction) => mapStorableToReaction<StreamChatGenerics>(reaction)) || [];
|
|
25
|
+
|
|
26
|
+
const ownReactions = latestReactions.filter((reaction) => reaction.user?.id === currentUserId);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
...rest,
|
|
30
|
+
attachments: messageRow.attachments ? JSON.parse(messageRow.attachments) : [],
|
|
31
|
+
created_at: createdAt,
|
|
32
|
+
deleted_at: deletedAt,
|
|
33
|
+
latest_reactions: latestReactions,
|
|
34
|
+
own_reactions: ownReactions,
|
|
35
|
+
reaction_counts: reactionCounts ? JSON.parse(reactionCounts) : {},
|
|
36
|
+
updated_at: updatedAt,
|
|
37
|
+
user: mapStorableToUser(user),
|
|
38
|
+
...(extraData ? JSON.parse(extraData) : {}),
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ReactionResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import { mapStorableToUser } from './mapStorableToUser';
|
|
4
|
+
|
|
5
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
6
|
+
|
|
7
|
+
import type { TableRowJoinedUser } from '../types';
|
|
8
|
+
|
|
9
|
+
export const mapStorableToReaction = <
|
|
10
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
11
|
+
>(
|
|
12
|
+
reactionRow: TableRowJoinedUser<'reactions'>,
|
|
13
|
+
): ReactionResponse<StreamChatGenerics> => {
|
|
14
|
+
const { createdAt, extraData, messageId, score, type, updatedAt, user } = reactionRow;
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
created_at: createdAt,
|
|
18
|
+
message_id: messageId,
|
|
19
|
+
score,
|
|
20
|
+
type,
|
|
21
|
+
updated_at: updatedAt,
|
|
22
|
+
user: mapStorableToUser(user),
|
|
23
|
+
...(extraData ? JSON.parse(extraData) : {}),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReadResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import { mapStorableToUser } from './mapStorableToUser';
|
|
4
|
+
|
|
5
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
6
|
+
|
|
7
|
+
import type { TableRowJoinedUser } from '../types';
|
|
8
|
+
|
|
9
|
+
export const mapStorableToRead = <
|
|
10
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
11
|
+
>(
|
|
12
|
+
row: TableRowJoinedUser<'reads'>,
|
|
13
|
+
): ReadResponse<StreamChatGenerics> => {
|
|
14
|
+
const { lastRead, unreadMessages, user } = row;
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
last_read: lastRead,
|
|
18
|
+
unread_messages: unreadMessages,
|
|
19
|
+
user: mapStorableToUser(user),
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { UserResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
4
|
+
import type { TableRow } from '../types';
|
|
5
|
+
|
|
6
|
+
export const mapStorableToUser = <
|
|
7
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
8
|
+
>(
|
|
9
|
+
userRow: TableRow<'users'>,
|
|
10
|
+
): UserResponse<StreamChatGenerics> => {
|
|
11
|
+
const { banned, createdAt, extraData, id, lastActive, online, role, updatedAt } = userRow;
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
banned: Boolean(banned),
|
|
15
|
+
created_at: createdAt,
|
|
16
|
+
id,
|
|
17
|
+
last_active: lastActive,
|
|
18
|
+
online: Boolean(online),
|
|
19
|
+
role,
|
|
20
|
+
updated_at: updatedAt,
|
|
21
|
+
...(extraData ? JSON.parse(extraData) : {}),
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UserResponse } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
import type { TableRow } from '../types';
|
|
4
|
+
|
|
5
|
+
export const mapUserToStorable = (user: UserResponse): TableRow<'users'> => {
|
|
6
|
+
const { banned, created_at, id, last_active, online, role, updated_at, ...extraData } = user;
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
banned,
|
|
10
|
+
createdAt: created_at,
|
|
11
|
+
extraData: JSON.stringify(extraData || {}),
|
|
12
|
+
id,
|
|
13
|
+
lastActive: last_active,
|
|
14
|
+
online,
|
|
15
|
+
role,
|
|
16
|
+
updatedAt: updated_at,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type { MessageLabel, Role } from 'stream-chat';
|
|
2
|
+
|
|
3
|
+
type Tables = {
|
|
4
|
+
[P in keyof Schema]: {
|
|
5
|
+
columns: {
|
|
6
|
+
[K in keyof Schema[P]]: string;
|
|
7
|
+
};
|
|
8
|
+
primaryKey: Array<keyof Schema[P]>;
|
|
9
|
+
foreignKeys?: Array<{
|
|
10
|
+
column: `${Exclude<keyof Schema[P], symbol>}`;
|
|
11
|
+
referenceTable: `${keyof Schema}`;
|
|
12
|
+
referenceTableColumn: string;
|
|
13
|
+
// https://www.sqlite.org/foreignkeys.html#fk_actions
|
|
14
|
+
onDeleteAction?: 'NO ACTION' | 'RESTRICT' | 'SET NULL' | 'SET DEFAULT' | 'CASCADE';
|
|
15
|
+
}>;
|
|
16
|
+
indexes?: Array<{
|
|
17
|
+
columns: Array<keyof Schema[P]>;
|
|
18
|
+
name: string;
|
|
19
|
+
unique: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const tables: Tables = {
|
|
25
|
+
channelQueries: {
|
|
26
|
+
columns: {
|
|
27
|
+
cids: 'TEXT',
|
|
28
|
+
id: 'TEXT',
|
|
29
|
+
},
|
|
30
|
+
primaryKey: ['id'],
|
|
31
|
+
},
|
|
32
|
+
channels: {
|
|
33
|
+
columns: {
|
|
34
|
+
autoTranslationEnabled: 'BOOLEAN',
|
|
35
|
+
autoTranslationLanguage: 'TEXT',
|
|
36
|
+
cid: 'TEXT',
|
|
37
|
+
config: 'TEXT',
|
|
38
|
+
cooldown: 'BOOLEAN',
|
|
39
|
+
createdAt: 'TEXT',
|
|
40
|
+
createdById: 'TEXT',
|
|
41
|
+
deletedAt: 'TEXT',
|
|
42
|
+
disabled: 'BOOLEAN DEFAULT FALSE',
|
|
43
|
+
extraData: 'TEXT',
|
|
44
|
+
frozen: 'BOOLEAN',
|
|
45
|
+
hidden: 'BOOLEAN',
|
|
46
|
+
id: 'TEXT',
|
|
47
|
+
invites: 'TEXT',
|
|
48
|
+
lastMessageAt: 'TEXT',
|
|
49
|
+
memberCount: 'INTEGER',
|
|
50
|
+
muted: 'BOOLEAN DEFAULT FALSE',
|
|
51
|
+
ownCapabilities: 'TEXT',
|
|
52
|
+
team: 'TEXT',
|
|
53
|
+
truncatedAt: 'TEXT',
|
|
54
|
+
truncatedBy: 'TEXT',
|
|
55
|
+
truncatedById: 'TEXT',
|
|
56
|
+
type: 'TEXT',
|
|
57
|
+
updatedAt: 'TEXT',
|
|
58
|
+
},
|
|
59
|
+
primaryKey: ['cid'],
|
|
60
|
+
},
|
|
61
|
+
members: {
|
|
62
|
+
columns: {
|
|
63
|
+
banned: 'BOOLEAN DEFAULT FALSE',
|
|
64
|
+
channelRole: 'TEXT',
|
|
65
|
+
cid: 'TEXT NOT NULL',
|
|
66
|
+
createdAt: 'TEXT',
|
|
67
|
+
inviteAcceptedAt: 'TEXT',
|
|
68
|
+
invited: 'BOOLEAN',
|
|
69
|
+
inviteRejectedAt: 'TEXT',
|
|
70
|
+
isModerator: 'BOOLEAN',
|
|
71
|
+
role: 'TEXT',
|
|
72
|
+
shadowBanned: 'BOOLEAN DEFAULT FALSE',
|
|
73
|
+
updatedAt: 'TEXT',
|
|
74
|
+
userId: 'TEXT',
|
|
75
|
+
},
|
|
76
|
+
foreignKeys: [
|
|
77
|
+
{
|
|
78
|
+
column: 'cid',
|
|
79
|
+
onDeleteAction: 'CASCADE',
|
|
80
|
+
referenceTable: 'channels',
|
|
81
|
+
referenceTableColumn: 'cid',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
indexes: [
|
|
85
|
+
{
|
|
86
|
+
columns: ['cid', 'userId'],
|
|
87
|
+
name: 'index_members',
|
|
88
|
+
unique: false,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
primaryKey: ['cid', 'userId'],
|
|
92
|
+
},
|
|
93
|
+
messages: {
|
|
94
|
+
columns: {
|
|
95
|
+
attachments: 'TEXT',
|
|
96
|
+
cid: 'TEXT NOT NULL',
|
|
97
|
+
createdAt: 'TEXT',
|
|
98
|
+
deletedAt: 'TEXT',
|
|
99
|
+
extraData: 'TEXT',
|
|
100
|
+
id: 'TEXT',
|
|
101
|
+
reactionCounts: 'TEXT',
|
|
102
|
+
text: "TEXT DEFAULT ''",
|
|
103
|
+
type: 'TEXT',
|
|
104
|
+
updatedAt: 'TEXT',
|
|
105
|
+
userId: 'TEXT',
|
|
106
|
+
},
|
|
107
|
+
foreignKeys: [
|
|
108
|
+
{
|
|
109
|
+
column: 'cid',
|
|
110
|
+
onDeleteAction: 'CASCADE',
|
|
111
|
+
referenceTable: 'channels',
|
|
112
|
+
referenceTableColumn: 'cid',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
indexes: [
|
|
116
|
+
{
|
|
117
|
+
columns: ['cid', 'userId'],
|
|
118
|
+
name: 'index_messages',
|
|
119
|
+
unique: false,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
primaryKey: ['id'],
|
|
123
|
+
},
|
|
124
|
+
reactions: {
|
|
125
|
+
columns: {
|
|
126
|
+
createdAt: 'TEXT',
|
|
127
|
+
extraData: 'TEXT',
|
|
128
|
+
messageId: 'TEXT',
|
|
129
|
+
score: 'INTEGER DEFAULT 0',
|
|
130
|
+
type: 'TEXT',
|
|
131
|
+
updatedAt: 'TEXT',
|
|
132
|
+
userId: 'TEXT',
|
|
133
|
+
},
|
|
134
|
+
foreignKeys: [
|
|
135
|
+
{
|
|
136
|
+
column: 'messageId',
|
|
137
|
+
onDeleteAction: 'CASCADE',
|
|
138
|
+
referenceTable: 'messages',
|
|
139
|
+
referenceTableColumn: 'id',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
indexes: [
|
|
143
|
+
{
|
|
144
|
+
columns: ['messageId', 'userId'],
|
|
145
|
+
name: 'index_reaction',
|
|
146
|
+
unique: false,
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
primaryKey: ['messageId', 'userId', 'type'],
|
|
150
|
+
},
|
|
151
|
+
reads: {
|
|
152
|
+
columns: {
|
|
153
|
+
cid: 'TEXT NOT NULL',
|
|
154
|
+
lastRead: 'TEXT NOT NULL',
|
|
155
|
+
unreadMessages: 'INTEGER DEFAULT 0',
|
|
156
|
+
userId: 'TEXT',
|
|
157
|
+
},
|
|
158
|
+
indexes: [
|
|
159
|
+
{
|
|
160
|
+
columns: ['cid', 'userId'],
|
|
161
|
+
name: 'index_reads_cid',
|
|
162
|
+
unique: false,
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
primaryKey: ['userId', 'cid'],
|
|
166
|
+
},
|
|
167
|
+
users: {
|
|
168
|
+
columns: {
|
|
169
|
+
banned: 'BOOLEAN DEFAULT FALSE',
|
|
170
|
+
createdAt: 'TEXT',
|
|
171
|
+
extraData: 'TEXT',
|
|
172
|
+
id: 'TEXT',
|
|
173
|
+
lastActive: 'TEXT',
|
|
174
|
+
online: 'INTEGER',
|
|
175
|
+
role: 'TEXT',
|
|
176
|
+
updatedAt: 'TEXT',
|
|
177
|
+
},
|
|
178
|
+
indexes: [
|
|
179
|
+
{
|
|
180
|
+
columns: ['id'],
|
|
181
|
+
name: 'index_users_id',
|
|
182
|
+
unique: true,
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
primaryKey: ['id'],
|
|
186
|
+
},
|
|
187
|
+
userSyncStatus: {
|
|
188
|
+
columns: {
|
|
189
|
+
lastSyncedAt: 'TEXT',
|
|
190
|
+
userId: 'TEXT',
|
|
191
|
+
},
|
|
192
|
+
primaryKey: ['userId'],
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// TODO: Checking the optionality of columns
|
|
197
|
+
export type Schema = {
|
|
198
|
+
channelQueries: {
|
|
199
|
+
cids: string;
|
|
200
|
+
id: string;
|
|
201
|
+
};
|
|
202
|
+
channels: {
|
|
203
|
+
cid: string;
|
|
204
|
+
extraData: string;
|
|
205
|
+
id: string;
|
|
206
|
+
type: string;
|
|
207
|
+
autoTranslationEnabled?: boolean;
|
|
208
|
+
autoTranslationLanguage?: string;
|
|
209
|
+
config?: string;
|
|
210
|
+
cooldown?: number;
|
|
211
|
+
createdAt?: string;
|
|
212
|
+
createdById?: string;
|
|
213
|
+
deletedAt?: string;
|
|
214
|
+
disabled?: boolean;
|
|
215
|
+
frozen?: boolean;
|
|
216
|
+
hidden?: boolean;
|
|
217
|
+
invites?: string;
|
|
218
|
+
lastMessageAt?: string;
|
|
219
|
+
memberCount?: number;
|
|
220
|
+
muted?: boolean;
|
|
221
|
+
ownCapabilities?: string;
|
|
222
|
+
team?: string;
|
|
223
|
+
truncatedAt?: string;
|
|
224
|
+
truncatedBy?: string;
|
|
225
|
+
truncatedById?: string;
|
|
226
|
+
updatedAt?: string;
|
|
227
|
+
};
|
|
228
|
+
members: {
|
|
229
|
+
cid: string;
|
|
230
|
+
banned?: boolean;
|
|
231
|
+
channelRole?: Role;
|
|
232
|
+
createdAt?: string;
|
|
233
|
+
inviteAcceptedAt?: string;
|
|
234
|
+
invited?: boolean;
|
|
235
|
+
inviteRejectedAt?: string;
|
|
236
|
+
isModerator?: boolean;
|
|
237
|
+
role?: string;
|
|
238
|
+
shadowBanned?: boolean;
|
|
239
|
+
updatedAt?: string;
|
|
240
|
+
userId?: string;
|
|
241
|
+
};
|
|
242
|
+
messages: {
|
|
243
|
+
attachments: string;
|
|
244
|
+
cid: string;
|
|
245
|
+
createdAt: string;
|
|
246
|
+
deletedAt: string;
|
|
247
|
+
extraData: string;
|
|
248
|
+
id: string;
|
|
249
|
+
reactionCounts: string;
|
|
250
|
+
type: MessageLabel;
|
|
251
|
+
updatedAt: string;
|
|
252
|
+
text?: string;
|
|
253
|
+
userId?: string;
|
|
254
|
+
};
|
|
255
|
+
reactions: {
|
|
256
|
+
createdAt: string;
|
|
257
|
+
messageId: string;
|
|
258
|
+
type: string;
|
|
259
|
+
updatedAt: string;
|
|
260
|
+
extraData?: string;
|
|
261
|
+
score?: number;
|
|
262
|
+
userId?: string;
|
|
263
|
+
};
|
|
264
|
+
reads: {
|
|
265
|
+
cid: string;
|
|
266
|
+
lastRead: string;
|
|
267
|
+
unreadMessages?: number;
|
|
268
|
+
userId?: string;
|
|
269
|
+
};
|
|
270
|
+
users: {
|
|
271
|
+
id: string;
|
|
272
|
+
banned?: boolean;
|
|
273
|
+
createdAt?: string;
|
|
274
|
+
extraData?: string;
|
|
275
|
+
lastActive?: string;
|
|
276
|
+
online?: boolean;
|
|
277
|
+
role?: string;
|
|
278
|
+
updatedAt?: string;
|
|
279
|
+
};
|
|
280
|
+
userSyncStatus: {
|
|
281
|
+
lastSyncedAt: string;
|
|
282
|
+
userId: string;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createSelectQuery } from '../createSelectQuery';
|
|
2
|
+
|
|
3
|
+
describe('createSelectQuery', () => {
|
|
4
|
+
it('should build a simple select query', () => {
|
|
5
|
+
const query = createSelectQuery('channels');
|
|
6
|
+
|
|
7
|
+
expect(query).toStrictEqual(['SELECT * FROM channels', []]);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should build select query with where clause', () => {
|
|
11
|
+
const query = createSelectQuery('channels', ['cid', 'id'], {
|
|
12
|
+
cid: 'messaging:1nj32k341nkn23',
|
|
13
|
+
id: ['123', '456'],
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(query).toStrictEqual([
|
|
17
|
+
'SELECT cid, id FROM channels WHERE cid = ? AND id in (?,?)',
|
|
18
|
+
['messaging:1nj32k341nkn23', '123', '456'],
|
|
19
|
+
]);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Schema } from '../schema';
|
|
2
|
+
import type { PreparedQueries, TableColumnNames } from '../types';
|
|
3
|
+
|
|
4
|
+
export const appendWhereClause = <T extends keyof Schema>(
|
|
5
|
+
selectQuery: string,
|
|
6
|
+
whereCondition?: Partial<{ [k in TableColumnNames<T>]: any }>,
|
|
7
|
+
) => {
|
|
8
|
+
if (!whereCondition) return [selectQuery, []];
|
|
9
|
+
|
|
10
|
+
const whereClause = [];
|
|
11
|
+
const whereParams: unknown[] = [];
|
|
12
|
+
|
|
13
|
+
for (const key in whereCondition) {
|
|
14
|
+
const value: unknown = whereCondition[key];
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
if (!value || value.length === 0) continue;
|
|
17
|
+
const questionMarks = Array(Object.keys(value).length).fill('?').join(',');
|
|
18
|
+
whereClause.push(`${key} in (${questionMarks})`);
|
|
19
|
+
whereParams.push(...value);
|
|
20
|
+
} else {
|
|
21
|
+
whereClause.push(`${key} = ?`);
|
|
22
|
+
whereParams.push(value);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!whereParams.length) {
|
|
27
|
+
return [selectQuery, []];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return [`${selectQuery} WHERE ${whereClause.join(' AND ')}`, whereParams] as PreparedQueries;
|
|
31
|
+
};
|