stream-chat-react-native-core 4.15.0-beta.2 → 5.0.0-beta.1
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/AudioAttachment.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/Gallery.js +19 -19
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/GalleryImage.js +1 -1
- package/lib/commonjs/components/Attachment/Giphy.js +40 -40
- package/lib/commonjs/components/Attachment/Giphy.js.map +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 +31 -18
- package/lib/commonjs/components/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/components/Avatar/GroupAvatar.js +28 -21
- 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 +41 -10
- 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/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/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/useUserPresence.js +4 -4
- package/lib/commonjs/components/ChannelList/hooks/listeners/useUserPresence.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +57 -22
- 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/ChannelPreview.js +3 -3
- 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 +45 -9
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js +144 -0
- package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js.map +1 -0
- package/lib/commonjs/components/Chat/hooks/useConnectionRecovered.js +171 -0
- package/lib/commonjs/components/Chat/hooks/useConnectionRecovered.js.map +1 -0
- package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +7 -3
- 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/Chat/hooks/useSyncDatabase.js +29 -0
- package/lib/commonjs/components/Chat/hooks/useSyncDatabase.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +36 -30
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +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 +3 -3
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGridHandle.js +1 -1
- package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js +6 -0
- package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js.map +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 +140 -112
- 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/ProgressControl/ProgressControl.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/components/index.js +26 -13
- package/lib/commonjs/components/index.js.map +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/channelsStateContext/useChannelState.js +5 -5
- package/lib/commonjs/contexts/channelsStateContext/useChannelState.js.map +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 +14 -15
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.md +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 +13 -26
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +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/{components/Attachment/hooks → hooks}/useLoadingImage.js +10 -0
- package/lib/commonjs/hooks/useLoadingImage.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 +22 -1
- 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 +113 -0
- package/lib/commonjs/mock-builders/DB/mock.js.map +1 -0
- 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 +160 -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 +47 -0
- package/lib/commonjs/store/apis/getChannels.js.map +1 -0
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js +37 -0
- package/lib/commonjs/store/apis/getChannelsForFilterSort.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/index.js +264 -0
- package/lib/commonjs/store/apis/index.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 +23 -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/test-utils/BetterSqlite.js +54 -0
- package/lib/commonjs/test-utils/BetterSqlite.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/AudioAttachment.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/Gallery.js +19 -19
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/GalleryImage.js +1 -1
- package/lib/module/components/Attachment/Giphy.js +40 -40
- package/lib/module/components/Attachment/Giphy.js.map +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 +31 -18
- package/lib/module/components/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/Avatar/GroupAvatar.js +28 -21
- 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 +41 -10
- 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/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/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/useUserPresence.js +4 -4
- package/lib/module/components/ChannelList/hooks/listeners/useUserPresence.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +57 -22
- 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/ChannelPreview.js +3 -3
- 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 +45 -9
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/handleEventToSyncDB.js +144 -0
- package/lib/module/components/Chat/hooks/handleEventToSyncDB.js.map +1 -0
- package/lib/module/components/Chat/hooks/useConnectionRecovered.js +171 -0
- package/lib/module/components/Chat/hooks/useConnectionRecovered.js.map +1 -0
- package/lib/module/components/Chat/hooks/useCreateChatContext.js +7 -3
- 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/Chat/hooks/useSyncDatabase.js +29 -0
- package/lib/module/components/Chat/hooks/useSyncDatabase.js.map +1 -0
- package/lib/module/components/ImageGallery/ImageGallery.js +36 -30
- package/lib/module/components/ImageGallery/ImageGallery.js.map +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 +3 -3
- package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGridHandle.js +1 -1
- package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js +6 -0
- package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js.map +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 +140 -112
- 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/ProgressControl/ProgressControl.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/components/index.js +26 -13
- package/lib/module/components/index.js.map +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/channelsStateContext/useChannelState.js +5 -5
- package/lib/module/contexts/channelsStateContext/useChannelState.js.map +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 +14 -15
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
- package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.md +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 +13 -26
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +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/{components/Attachment/hooks → hooks}/useLoadingImage.js +10 -0
- package/lib/module/hooks/useLoadingImage.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 +22 -1
- 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 +113 -0
- package/lib/module/mock-builders/DB/mock.js.map +1 -0
- 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 +160 -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 +47 -0
- package/lib/module/store/apis/getChannels.js.map +1 -0
- package/lib/module/store/apis/getChannelsForFilterSort.js +37 -0
- package/lib/module/store/apis/getChannelsForFilterSort.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/index.js +264 -0
- package/lib/module/store/apis/index.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 +23 -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/test-utils/BetterSqlite.js +54 -0
- package/lib/module/test-utils/BetterSqlite.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
- package/lib/typescript/components/Attachment/Giphy.d.ts +1 -1
- 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/usePaginatedChannels.d.ts +4 -2
- package/lib/typescript/components/Chat/Chat.d.ts +4 -0
- package/lib/typescript/components/Chat/hooks/handleEventToSyncDB.d.ts +2 -0
- package/lib/typescript/components/Chat/hooks/useConnectionRecovered.d.ts +10 -0
- package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
- package/lib/typescript/components/Chat/hooks/useSyncDatabase.d.ts +8 -0
- package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/hooks/useImageGalleryGestures.d.ts +2 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
- package/lib/typescript/components/index.d.ts +2 -1
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +17 -0
- package/lib/typescript/contexts/chatContext/ChatContext.d.ts +3 -1
- package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts +9 -10
- package/lib/typescript/contexts/paginatedMessageListContext/PaginatedMessageListContext.d.ts +4 -0
- package/lib/typescript/{components/Attachment/hooks → hooks}/useLoadingImage.d.ts +0 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/store/QuickSqliteClient.d.ts +22 -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 +15 -0
- package/lib/typescript/store/apis/getChannelsForFilterSort.d.ts +17 -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/index.d.ts +20 -0
- package/lib/typescript/store/apis/queries/selectChannelIdsForFilterSort.d.ts +15 -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 +3 -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 +9 -0
- package/lib/typescript/test-utils/BetterSqlite.d.ts +8 -0
- package/package.json +5 -2
- package/src/__tests__/offline-feature.test.js +656 -0
- package/src/components/Attachment/Gallery.tsx +18 -17
- package/src/components/Attachment/Giphy.tsx +9 -10
- package/src/components/Avatar/Avatar.tsx +45 -31
- package/src/components/Avatar/GroupAvatar.tsx +46 -35
- 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 +28 -8
- package/src/components/ChannelList/ChannelListMessenger.tsx +4 -0
- package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +2 -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/useNewMessage.ts +2 -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/useUserPresence.ts +5 -4
- package/src/components/ChannelList/hooks/usePaginatedChannels.ts +46 -10
- package/src/components/ChannelPreview/ChannelPreview.tsx +2 -2
- package/src/components/ChannelPreview/ChannelPreviewMessage.tsx +10 -9
- package/src/components/Chat/Chat.tsx +41 -4
- package/src/components/Chat/hooks/handleEventToSyncDB.ts +142 -0
- package/src/components/Chat/hooks/useConnectionRecovered.ts +92 -0
- package/src/components/Chat/hooks/useCreateChatContext.ts +9 -3
- package/src/components/Chat/hooks/useMutedUsers.ts +5 -3
- package/src/components/Chat/hooks/useSyncDatabase.ts +30 -0
- package/src/components/ImageGallery/ImageGallery.tsx +30 -18
- package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +6 -6
- package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +3 -3
- package/src/components/ImageGallery/__tests__/ImageGalleryGrid.test.tsx +3 -3
- package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +3 -3
- package/src/components/ImageGallery/components/ImageGrid.tsx +3 -3
- package/src/components/ImageGallery/hooks/useImageGalleryGestures.tsx +16 -0
- package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessageAvatar.test.js.snap +1 -0
- package/src/components/MessageList/MessageList.tsx +162 -106
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +6 -0
- package/src/components/index.ts +2 -1
- package/src/contexts/channelContext/ChannelContext.tsx +15 -0
- package/src/contexts/channelsStateContext/useChannelState.ts +2 -2
- package/src/contexts/chatContext/ChatContext.tsx +3 -1
- package/src/contexts/imageGalleryContext/ImageGalleryContext.md +1 -1
- package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +19 -14
- package/src/contexts/overlayContext/OverlayProvider.tsx +1 -5
- package/src/contexts/paginatedMessageListContext/PaginatedMessageListContext.tsx +4 -0
- package/src/{components/Attachment/hooks → hooks}/useLoadingImage.tsx +9 -1
- package/src/index.ts +4 -0
- package/src/mock-builders/DB/consts.ts +2 -0
- package/src/mock-builders/DB/mock.ts +107 -0
- package/src/mock-builders/event/memberAdded.js +8 -0
- package/src/mock-builders/event/memberRemoved.js +8 -0
- package/src/mock-builders/event/memberUpdated.js +8 -0
- package/src/mock-builders/event/reactionDeleted.js +9 -0
- package/src/mock-builders/event/reactionNew.js +9 -0
- package/src/mock-builders/event/reactionUpdated.js +9 -0
- package/src/mock-builders/generator/reaction.js +1 -1
- package/src/store/QuickSqliteClient.ts +144 -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 +46 -0
- package/src/store/apis/getChannelsForFilterSort.ts +45 -0
- package/src/store/apis/getLastSyncedAt.ts +17 -0
- package/src/store/apis/getMembers.ts +26 -0
- package/src/store/apis/getReads.ts +26 -0
- package/src/store/apis/index.ts +20 -0
- package/src/store/apis/queries/selectChannelIdsForFilterSort.ts +38 -0
- package/src/store/apis/queries/selectChannels.ts +25 -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 +32 -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 +19 -0
- package/src/store/types.ts +12 -0
- package/src/test-utils/BetterSqlite.js +44 -0
- package/src/version.json +1 -1
- package/lib/commonjs/components/Attachment/hooks/useLoadingImage.js.map +0 -1
- package/lib/commonjs/components/ChannelList/hooks/listeners/useConnectionRecovered.js +0 -45
- package/lib/commonjs/components/ChannelList/hooks/listeners/useConnectionRecovered.js.map +0 -1
- package/lib/module/components/Attachment/hooks/useLoadingImage.js.map +0 -1
- package/lib/module/components/ChannelList/hooks/listeners/useConnectionRecovered.js +0 -45
- package/lib/module/components/ChannelList/hooks/listeners/useConnectionRecovered.js.map +0 -1
- package/lib/typescript/components/ChannelList/hooks/listeners/useConnectionRecovered.d.ts +0 -8
- package/src/components/ChannelList/hooks/listeners/useConnectionRecovered.ts +0 -41
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.mapStorableToRead = void 0;
|
|
5
|
+
|
|
6
|
+
var _mapStorableToUser = require("./mapStorableToUser");
|
|
7
|
+
|
|
8
|
+
var mapStorableToRead = function mapStorableToRead(row) {
|
|
9
|
+
var lastRead = row.lastRead,
|
|
10
|
+
unreadMessages = row.unreadMessages,
|
|
11
|
+
user = row.user;
|
|
12
|
+
return {
|
|
13
|
+
last_read: lastRead,
|
|
14
|
+
unread_messages: unreadMessages,
|
|
15
|
+
user: (0, _mapStorableToUser.mapStorableToUser)(user)
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.mapStorableToRead = mapStorableToRead;
|
|
20
|
+
//# sourceMappingURL=mapStorableToRead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["mapStorableToRead.ts"],"names":["mapStorableToRead","row","lastRead","unreadMessages","user","last_read","unread_messages"],"mappings":";;;;;AAEA;;AAMO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAG/BC,GAH+B,EAIM;AACrC,MAAQC,QAAR,GAA2CD,GAA3C,CAAQC,QAAR;AAAA,MAAkBC,cAAlB,GAA2CF,GAA3C,CAAkBE,cAAlB;AAAA,MAAkCC,IAAlC,GAA2CH,GAA3C,CAAkCG,IAAlC;AAEA,SAAO;AACLC,IAAAA,SAAS,EAAEH,QADN;AAELI,IAAAA,eAAe,EAAEH,cAFZ;AAGLC,IAAAA,IAAI,EAAE,0CAAkBA,IAAlB;AAHD,GAAP;AAKD,CAZM","sourcesContent":["import type { ReadResponse } from 'stream-chat';\n\nimport { mapStorableToUser } from './mapStorableToUser';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\n\nimport type { TableRowJoinedUser } from '../types';\n\nexport const mapStorableToRead = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n row: TableRowJoinedUser<'reads'>,\n): ReadResponse<StreamChatGenerics> => {\n const { lastRead, unreadMessages, user } = row;\n\n return {\n last_read: lastRead,\n unread_messages: unreadMessages,\n user: mapStorableToUser(user),\n };\n};\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mapStorableToUser = void 0;
|
|
7
|
+
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
10
|
+
var mapStorableToUser = function mapStorableToUser(userRow) {
|
|
11
|
+
var banned = userRow.banned,
|
|
12
|
+
createdAt = userRow.createdAt,
|
|
13
|
+
extraData = userRow.extraData,
|
|
14
|
+
id = userRow.id,
|
|
15
|
+
lastActive = userRow.lastActive,
|
|
16
|
+
online = userRow.online,
|
|
17
|
+
role = userRow.role,
|
|
18
|
+
updatedAt = userRow.updatedAt;
|
|
19
|
+
return (0, _extends2["default"])({
|
|
20
|
+
banned: Boolean(banned),
|
|
21
|
+
created_at: createdAt,
|
|
22
|
+
id: id,
|
|
23
|
+
last_active: lastActive,
|
|
24
|
+
online: Boolean(online),
|
|
25
|
+
role: role,
|
|
26
|
+
updated_at: updatedAt
|
|
27
|
+
}, extraData ? JSON.parse(extraData) : {});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.mapStorableToUser = mapStorableToUser;
|
|
31
|
+
//# sourceMappingURL=mapStorableToUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["mapStorableToUser.ts"],"names":["mapStorableToUser","userRow","banned","createdAt","extraData","id","lastActive","online","role","updatedAt","Boolean","created_at","last_active","updated_at","JSON","parse"],"mappings":";;;;;;;;;AAKO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAG/BC,OAH+B,EAIM;AACrC,MAAQC,MAAR,GAAkFD,OAAlF,CAAQC,MAAR;AAAA,MAAgBC,SAAhB,GAAkFF,OAAlF,CAAgBE,SAAhB;AAAA,MAA2BC,SAA3B,GAAkFH,OAAlF,CAA2BG,SAA3B;AAAA,MAAsCC,EAAtC,GAAkFJ,OAAlF,CAAsCI,EAAtC;AAAA,MAA0CC,UAA1C,GAAkFL,OAAlF,CAA0CK,UAA1C;AAAA,MAAsDC,MAAtD,GAAkFN,OAAlF,CAAsDM,MAAtD;AAAA,MAA8DC,IAA9D,GAAkFP,OAAlF,CAA8DO,IAA9D;AAAA,MAAoEC,SAApE,GAAkFR,OAAlF,CAAoEQ,SAApE;AAEA;AACEP,IAAAA,MAAM,EAAEQ,OAAO,CAACR,MAAD,CADjB;AAEES,IAAAA,UAAU,EAAER,SAFd;AAGEE,IAAAA,EAAE,EAAFA,EAHF;AAIEO,IAAAA,WAAW,EAAEN,UAJf;AAKEC,IAAAA,MAAM,EAAEG,OAAO,CAACH,MAAD,CALjB;AAMEC,IAAAA,IAAI,EAAJA,IANF;AAOEK,IAAAA,UAAU,EAAEJ;AAPd,KAQML,SAAS,GAAGU,IAAI,CAACC,KAAL,CAAWX,SAAX,CAAH,GAA2B,EAR1C;AAUD,CAjBM","sourcesContent":["import type { UserResponse } from 'stream-chat';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport type { TableRow } from '../types';\n\nexport const mapStorableToUser = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>(\n userRow: TableRow<'users'>,\n): UserResponse<StreamChatGenerics> => {\n const { banned, createdAt, extraData, id, lastActive, online, role, updatedAt } = userRow;\n\n return {\n banned: Boolean(banned),\n created_at: createdAt,\n id,\n last_active: lastActive,\n online: Boolean(online),\n role,\n updated_at: updatedAt,\n ...(extraData ? JSON.parse(extraData) : {}),\n };\n};\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.mapUserToStorable = void 0;
|
|
7
|
+
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
|
|
10
|
+
var _excluded = ["banned", "created_at", "id", "last_active", "online", "role", "updated_at"];
|
|
11
|
+
|
|
12
|
+
var mapUserToStorable = function mapUserToStorable(user) {
|
|
13
|
+
var banned = user.banned,
|
|
14
|
+
created_at = user.created_at,
|
|
15
|
+
id = user.id,
|
|
16
|
+
last_active = user.last_active,
|
|
17
|
+
online = user.online,
|
|
18
|
+
role = user.role,
|
|
19
|
+
updated_at = user.updated_at,
|
|
20
|
+
extraData = (0, _objectWithoutProperties2["default"])(user, _excluded);
|
|
21
|
+
return {
|
|
22
|
+
banned: banned,
|
|
23
|
+
createdAt: created_at,
|
|
24
|
+
extraData: JSON.stringify(extraData || {}),
|
|
25
|
+
id: id,
|
|
26
|
+
lastActive: last_active,
|
|
27
|
+
online: online,
|
|
28
|
+
role: role,
|
|
29
|
+
updatedAt: updated_at
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.mapUserToStorable = mapUserToStorable;
|
|
34
|
+
//# sourceMappingURL=mapUserToStorable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["mapUserToStorable.ts"],"names":["mapUserToStorable","user","banned","created_at","id","last_active","online","role","updated_at","extraData","createdAt","JSON","stringify","lastActive","updatedAt"],"mappings":";;;;;;;;;;;AAIO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,IAAD,EAA2C;AAC1E,MAAQC,MAAR,GAAwFD,IAAxF,CAAQC,MAAR;AAAA,MAAgBC,UAAhB,GAAwFF,IAAxF,CAAgBE,UAAhB;AAAA,MAA4BC,EAA5B,GAAwFH,IAAxF,CAA4BG,EAA5B;AAAA,MAAgCC,WAAhC,GAAwFJ,IAAxF,CAAgCI,WAAhC;AAAA,MAA6CC,MAA7C,GAAwFL,IAAxF,CAA6CK,MAA7C;AAAA,MAAqDC,IAArD,GAAwFN,IAAxF,CAAqDM,IAArD;AAAA,MAA2DC,UAA3D,GAAwFP,IAAxF,CAA2DO,UAA3D;AAAA,MAA0EC,SAA1E,6CAAwFR,IAAxF;AAEA,SAAO;AACLC,IAAAA,MAAM,EAANA,MADK;AAELQ,IAAAA,SAAS,EAAEP,UAFN;AAGLM,IAAAA,SAAS,EAAEE,IAAI,CAACC,SAAL,CAAeH,SAAS,IAAI,EAA5B,CAHN;AAILL,IAAAA,EAAE,EAAFA,EAJK;AAKLS,IAAAA,UAAU,EAAER,WALP;AAMLC,IAAAA,MAAM,EAANA,MANK;AAOLC,IAAAA,IAAI,EAAJA,IAPK;AAQLO,IAAAA,SAAS,EAAEN;AARN,GAAP;AAUD,CAbM","sourcesContent":["import type { UserResponse } from 'stream-chat';\n\nimport type { TableRow } from '../types';\n\nexport const mapUserToStorable = (user: UserResponse): TableRow<'users'> => {\n const { banned, created_at, id, last_active, online, role, updated_at, ...extraData } = user;\n\n return {\n banned,\n createdAt: created_at,\n extraData: JSON.stringify(extraData || {}),\n id,\n lastActive: last_active,\n online,\n role,\n updatedAt: updated_at,\n };\n};\n"]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.tables = void 0;
|
|
5
|
+
var tables = {
|
|
6
|
+
channelQueries: {
|
|
7
|
+
columns: {
|
|
8
|
+
cids: 'TEXT',
|
|
9
|
+
id: 'TEXT'
|
|
10
|
+
},
|
|
11
|
+
primaryKey: ['id']
|
|
12
|
+
},
|
|
13
|
+
channels: {
|
|
14
|
+
columns: {
|
|
15
|
+
autoTranslationEnabled: 'BOOLEAN',
|
|
16
|
+
autoTranslationLanguage: 'TEXT',
|
|
17
|
+
cid: 'TEXT',
|
|
18
|
+
config: 'TEXT',
|
|
19
|
+
cooldown: 'BOOLEAN',
|
|
20
|
+
createdAt: 'TEXT',
|
|
21
|
+
createdById: 'TEXT',
|
|
22
|
+
deletedAt: 'TEXT',
|
|
23
|
+
disabled: 'BOOLEAN DEFAULT FALSE',
|
|
24
|
+
extraData: 'TEXT',
|
|
25
|
+
frozen: 'BOOLEAN',
|
|
26
|
+
hidden: 'BOOLEAN',
|
|
27
|
+
id: 'TEXT',
|
|
28
|
+
invites: 'TEXT',
|
|
29
|
+
lastMessageAt: 'TEXT',
|
|
30
|
+
memberCount: 'INTEGER',
|
|
31
|
+
muted: 'BOOLEAN DEFAULT FALSE',
|
|
32
|
+
ownCapabilities: 'TEXT',
|
|
33
|
+
team: 'TEXT',
|
|
34
|
+
truncatedAt: 'TEXT',
|
|
35
|
+
truncatedBy: 'TEXT',
|
|
36
|
+
truncatedById: 'TEXT',
|
|
37
|
+
type: 'TEXT',
|
|
38
|
+
updatedAt: 'TEXT'
|
|
39
|
+
},
|
|
40
|
+
primaryKey: ['cid']
|
|
41
|
+
},
|
|
42
|
+
members: {
|
|
43
|
+
columns: {
|
|
44
|
+
banned: 'BOOLEAN DEFAULT FALSE',
|
|
45
|
+
channelRole: 'TEXT',
|
|
46
|
+
cid: 'TEXT NOT NULL',
|
|
47
|
+
createdAt: 'TEXT',
|
|
48
|
+
inviteAcceptedAt: 'TEXT',
|
|
49
|
+
invited: 'BOOLEAN',
|
|
50
|
+
inviteRejectedAt: 'TEXT',
|
|
51
|
+
isModerator: 'BOOLEAN',
|
|
52
|
+
role: 'TEXT',
|
|
53
|
+
shadowBanned: 'BOOLEAN DEFAULT FALSE',
|
|
54
|
+
updatedAt: 'TEXT',
|
|
55
|
+
userId: 'TEXT'
|
|
56
|
+
},
|
|
57
|
+
foreignKeys: [{
|
|
58
|
+
column: 'cid',
|
|
59
|
+
onDeleteAction: 'CASCADE',
|
|
60
|
+
referenceTable: 'channels',
|
|
61
|
+
referenceTableColumn: 'cid'
|
|
62
|
+
}],
|
|
63
|
+
indexes: [{
|
|
64
|
+
columns: ['cid', 'userId'],
|
|
65
|
+
name: 'index_members',
|
|
66
|
+
unique: false
|
|
67
|
+
}],
|
|
68
|
+
primaryKey: ['cid', 'userId']
|
|
69
|
+
},
|
|
70
|
+
messages: {
|
|
71
|
+
columns: {
|
|
72
|
+
attachments: 'TEXT',
|
|
73
|
+
cid: 'TEXT NOT NULL',
|
|
74
|
+
createdAt: 'TEXT',
|
|
75
|
+
deletedAt: 'TEXT',
|
|
76
|
+
extraData: 'TEXT',
|
|
77
|
+
id: 'TEXT',
|
|
78
|
+
reactionCounts: 'TEXT',
|
|
79
|
+
text: "TEXT DEFAULT ''",
|
|
80
|
+
type: 'TEXT',
|
|
81
|
+
updatedAt: 'TEXT',
|
|
82
|
+
userId: 'TEXT'
|
|
83
|
+
},
|
|
84
|
+
foreignKeys: [{
|
|
85
|
+
column: 'cid',
|
|
86
|
+
onDeleteAction: 'CASCADE',
|
|
87
|
+
referenceTable: 'channels',
|
|
88
|
+
referenceTableColumn: 'cid'
|
|
89
|
+
}],
|
|
90
|
+
indexes: [{
|
|
91
|
+
columns: ['cid', 'userId'],
|
|
92
|
+
name: 'index_messages',
|
|
93
|
+
unique: false
|
|
94
|
+
}],
|
|
95
|
+
primaryKey: ['id']
|
|
96
|
+
},
|
|
97
|
+
reactions: {
|
|
98
|
+
columns: {
|
|
99
|
+
createdAt: 'TEXT',
|
|
100
|
+
extraData: 'TEXT',
|
|
101
|
+
messageId: 'TEXT',
|
|
102
|
+
score: 'INTEGER DEFAULT 0',
|
|
103
|
+
type: 'TEXT',
|
|
104
|
+
updatedAt: 'TEXT',
|
|
105
|
+
userId: 'TEXT'
|
|
106
|
+
},
|
|
107
|
+
foreignKeys: [{
|
|
108
|
+
column: 'messageId',
|
|
109
|
+
onDeleteAction: 'CASCADE',
|
|
110
|
+
referenceTable: 'messages',
|
|
111
|
+
referenceTableColumn: 'id'
|
|
112
|
+
}],
|
|
113
|
+
indexes: [{
|
|
114
|
+
columns: ['messageId', 'userId'],
|
|
115
|
+
name: 'index_reaction',
|
|
116
|
+
unique: false
|
|
117
|
+
}],
|
|
118
|
+
primaryKey: ['messageId', 'userId', 'type']
|
|
119
|
+
},
|
|
120
|
+
reads: {
|
|
121
|
+
columns: {
|
|
122
|
+
cid: 'TEXT NOT NULL',
|
|
123
|
+
lastRead: 'TEXT NOT NULL',
|
|
124
|
+
unreadMessages: 'INTEGER DEFAULT 0',
|
|
125
|
+
userId: 'TEXT'
|
|
126
|
+
},
|
|
127
|
+
indexes: [{
|
|
128
|
+
columns: ['cid', 'userId'],
|
|
129
|
+
name: 'index_reads_cid',
|
|
130
|
+
unique: false
|
|
131
|
+
}],
|
|
132
|
+
primaryKey: ['userId', 'cid']
|
|
133
|
+
},
|
|
134
|
+
users: {
|
|
135
|
+
columns: {
|
|
136
|
+
banned: 'BOOLEAN DEFAULT FALSE',
|
|
137
|
+
createdAt: 'TEXT',
|
|
138
|
+
extraData: 'TEXT',
|
|
139
|
+
id: 'TEXT',
|
|
140
|
+
lastActive: 'TEXT',
|
|
141
|
+
online: 'INTEGER',
|
|
142
|
+
role: 'TEXT',
|
|
143
|
+
updatedAt: 'TEXT'
|
|
144
|
+
},
|
|
145
|
+
indexes: [{
|
|
146
|
+
columns: ['id'],
|
|
147
|
+
name: 'index_users_id',
|
|
148
|
+
unique: true
|
|
149
|
+
}],
|
|
150
|
+
primaryKey: ['id']
|
|
151
|
+
},
|
|
152
|
+
userSyncStatus: {
|
|
153
|
+
columns: {
|
|
154
|
+
lastSyncedAt: 'TEXT',
|
|
155
|
+
userId: 'TEXT'
|
|
156
|
+
},
|
|
157
|
+
primaryKey: ['userId']
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
exports.tables = tables;
|
|
161
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["schema.ts"],"names":["tables","channelQueries","columns","cids","id","primaryKey","channels","autoTranslationEnabled","autoTranslationLanguage","cid","config","cooldown","createdAt","createdById","deletedAt","disabled","extraData","frozen","hidden","invites","lastMessageAt","memberCount","muted","ownCapabilities","team","truncatedAt","truncatedBy","truncatedById","type","updatedAt","members","banned","channelRole","inviteAcceptedAt","invited","inviteRejectedAt","isModerator","role","shadowBanned","userId","foreignKeys","column","onDeleteAction","referenceTable","referenceTableColumn","indexes","name","unique","messages","attachments","reactionCounts","text","reactions","messageId","score","reads","lastRead","unreadMessages","users","lastActive","online","userSyncStatus","lastSyncedAt"],"mappings":";;;;AAuBO,IAAMA,MAAc,GAAG;AAC5BC,EAAAA,cAAc,EAAE;AACdC,IAAAA,OAAO,EAAE;AACPC,MAAAA,IAAI,EAAE,MADC;AAEPC,MAAAA,EAAE,EAAE;AAFG,KADK;AAKdC,IAAAA,UAAU,EAAE,CAAC,IAAD;AALE,GADY;AAQ5BC,EAAAA,QAAQ,EAAE;AACRJ,IAAAA,OAAO,EAAE;AACPK,MAAAA,sBAAsB,EAAE,SADjB;AAEPC,MAAAA,uBAAuB,EAAE,MAFlB;AAGPC,MAAAA,GAAG,EAAE,MAHE;AAIPC,MAAAA,MAAM,EAAE,MAJD;AAKPC,MAAAA,QAAQ,EAAE,SALH;AAMPC,MAAAA,SAAS,EAAE,MANJ;AAOPC,MAAAA,WAAW,EAAE,MAPN;AAQPC,MAAAA,SAAS,EAAE,MARJ;AASPC,MAAAA,QAAQ,EAAE,uBATH;AAUPC,MAAAA,SAAS,EAAE,MAVJ;AAWPC,MAAAA,MAAM,EAAE,SAXD;AAYPC,MAAAA,MAAM,EAAE,SAZD;AAaPd,MAAAA,EAAE,EAAE,MAbG;AAcPe,MAAAA,OAAO,EAAE,MAdF;AAePC,MAAAA,aAAa,EAAE,MAfR;AAgBPC,MAAAA,WAAW,EAAE,SAhBN;AAiBPC,MAAAA,KAAK,EAAE,uBAjBA;AAkBPC,MAAAA,eAAe,EAAE,MAlBV;AAmBPC,MAAAA,IAAI,EAAE,MAnBC;AAoBPC,MAAAA,WAAW,EAAE,MApBN;AAqBPC,MAAAA,WAAW,EAAE,MArBN;AAsBPC,MAAAA,aAAa,EAAE,MAtBR;AAuBPC,MAAAA,IAAI,EAAE,MAvBC;AAwBPC,MAAAA,SAAS,EAAE;AAxBJ,KADD;AA2BRxB,IAAAA,UAAU,EAAE,CAAC,KAAD;AA3BJ,GARkB;AAqC5ByB,EAAAA,OAAO,EAAE;AACP5B,IAAAA,OAAO,EAAE;AACP6B,MAAAA,MAAM,EAAE,uBADD;AAEPC,MAAAA,WAAW,EAAE,MAFN;AAGPvB,MAAAA,GAAG,EAAE,eAHE;AAIPG,MAAAA,SAAS,EAAE,MAJJ;AAKPqB,MAAAA,gBAAgB,EAAE,MALX;AAMPC,MAAAA,OAAO,EAAE,SANF;AAOPC,MAAAA,gBAAgB,EAAE,MAPX;AAQPC,MAAAA,WAAW,EAAE,SARN;AASPC,MAAAA,IAAI,EAAE,MATC;AAUPC,MAAAA,YAAY,EAAE,uBAVP;AAWPT,MAAAA,SAAS,EAAE,MAXJ;AAYPU,MAAAA,MAAM,EAAE;AAZD,KADF;AAePC,IAAAA,WAAW,EAAE,CACX;AACEC,MAAAA,MAAM,EAAE,KADV;AAEEC,MAAAA,cAAc,EAAE,SAFlB;AAGEC,MAAAA,cAAc,EAAE,UAHlB;AAIEC,MAAAA,oBAAoB,EAAE;AAJxB,KADW,CAfN;AAuBPC,IAAAA,OAAO,EAAE,CACP;AACE3C,MAAAA,OAAO,EAAE,CAAC,KAAD,EAAQ,QAAR,CADX;AAEE4C,MAAAA,IAAI,EAAE,eAFR;AAGEC,MAAAA,MAAM,EAAE;AAHV,KADO,CAvBF;AA8BP1C,IAAAA,UAAU,EAAE,CAAC,KAAD,EAAQ,QAAR;AA9BL,GArCmB;AAqE5B2C,EAAAA,QAAQ,EAAE;AACR9C,IAAAA,OAAO,EAAE;AACP+C,MAAAA,WAAW,EAAE,MADN;AAEPxC,MAAAA,GAAG,EAAE,eAFE;AAGPG,MAAAA,SAAS,EAAE,MAHJ;AAIPE,MAAAA,SAAS,EAAE,MAJJ;AAKPE,MAAAA,SAAS,EAAE,MALJ;AAMPZ,MAAAA,EAAE,EAAE,MANG;AAOP8C,MAAAA,cAAc,EAAE,MAPT;AAQPC,MAAAA,IAAI,EAAE,iBARC;AASPvB,MAAAA,IAAI,EAAE,MATC;AAUPC,MAAAA,SAAS,EAAE,MAVJ;AAWPU,MAAAA,MAAM,EAAE;AAXD,KADD;AAcRC,IAAAA,WAAW,EAAE,CACX;AACEC,MAAAA,MAAM,EAAE,KADV;AAEEC,MAAAA,cAAc,EAAE,SAFlB;AAGEC,MAAAA,cAAc,EAAE,UAHlB;AAIEC,MAAAA,oBAAoB,EAAE;AAJxB,KADW,CAdL;AAsBRC,IAAAA,OAAO,EAAE,CACP;AACE3C,MAAAA,OAAO,EAAE,CAAC,KAAD,EAAQ,QAAR,CADX;AAEE4C,MAAAA,IAAI,EAAE,gBAFR;AAGEC,MAAAA,MAAM,EAAE;AAHV,KADO,CAtBD;AA6BR1C,IAAAA,UAAU,EAAE,CAAC,IAAD;AA7BJ,GArEkB;AAoG5B+C,EAAAA,SAAS,EAAE;AACTlD,IAAAA,OAAO,EAAE;AACPU,MAAAA,SAAS,EAAE,MADJ;AAEPI,MAAAA,SAAS,EAAE,MAFJ;AAGPqC,MAAAA,SAAS,EAAE,MAHJ;AAIPC,MAAAA,KAAK,EAAE,mBAJA;AAKP1B,MAAAA,IAAI,EAAE,MALC;AAMPC,MAAAA,SAAS,EAAE,MANJ;AAOPU,MAAAA,MAAM,EAAE;AAPD,KADA;AAUTC,IAAAA,WAAW,EAAE,CACX;AACEC,MAAAA,MAAM,EAAE,WADV;AAEEC,MAAAA,cAAc,EAAE,SAFlB;AAGEC,MAAAA,cAAc,EAAE,UAHlB;AAIEC,MAAAA,oBAAoB,EAAE;AAJxB,KADW,CAVJ;AAkBTC,IAAAA,OAAO,EAAE,CACP;AACE3C,MAAAA,OAAO,EAAE,CAAC,WAAD,EAAc,QAAd,CADX;AAEE4C,MAAAA,IAAI,EAAE,gBAFR;AAGEC,MAAAA,MAAM,EAAE;AAHV,KADO,CAlBA;AAyBT1C,IAAAA,UAAU,EAAE,CAAC,WAAD,EAAc,QAAd,EAAwB,MAAxB;AAzBH,GApGiB;AA+H5BkD,EAAAA,KAAK,EAAE;AACLrD,IAAAA,OAAO,EAAE;AACPO,MAAAA,GAAG,EAAE,eADE;AAEP+C,MAAAA,QAAQ,EAAE,eAFH;AAGPC,MAAAA,cAAc,EAAE,mBAHT;AAIPlB,MAAAA,MAAM,EAAE;AAJD,KADJ;AAOLM,IAAAA,OAAO,EAAE,CACP;AACE3C,MAAAA,OAAO,EAAE,CAAC,KAAD,EAAQ,QAAR,CADX;AAEE4C,MAAAA,IAAI,EAAE,iBAFR;AAGEC,MAAAA,MAAM,EAAE;AAHV,KADO,CAPJ;AAcL1C,IAAAA,UAAU,EAAE,CAAC,QAAD,EAAW,KAAX;AAdP,GA/HqB;AA+I5BqD,EAAAA,KAAK,EAAE;AACLxD,IAAAA,OAAO,EAAE;AACP6B,MAAAA,MAAM,EAAE,uBADD;AAEPnB,MAAAA,SAAS,EAAE,MAFJ;AAGPI,MAAAA,SAAS,EAAE,MAHJ;AAIPZ,MAAAA,EAAE,EAAE,MAJG;AAKPuD,MAAAA,UAAU,EAAE,MALL;AAMPC,MAAAA,MAAM,EAAE,SAND;AAOPvB,MAAAA,IAAI,EAAE,MAPC;AAQPR,MAAAA,SAAS,EAAE;AARJ,KADJ;AAWLgB,IAAAA,OAAO,EAAE,CACP;AACE3C,MAAAA,OAAO,EAAE,CAAC,IAAD,CADX;AAEE4C,MAAAA,IAAI,EAAE,gBAFR;AAGEC,MAAAA,MAAM,EAAE;AAHV,KADO,CAXJ;AAkBL1C,IAAAA,UAAU,EAAE,CAAC,IAAD;AAlBP,GA/IqB;AAmK5BwD,EAAAA,cAAc,EAAE;AACd3D,IAAAA,OAAO,EAAE;AACP4D,MAAAA,YAAY,EAAE,MADP;AAEPvB,MAAAA,MAAM,EAAE;AAFD,KADK;AAKdlC,IAAAA,UAAU,EAAE,CAAC,QAAD;AALE;AAnKY,CAAvB","sourcesContent":["import type { MessageLabel, Role } from 'stream-chat';\n\ntype Tables = {\n [P in keyof Schema]: {\n columns: {\n [K in keyof Schema[P]]: string;\n };\n primaryKey: Array<keyof Schema[P]>;\n foreignKeys?: Array<{\n column: `${Exclude<keyof Schema[P], symbol>}`;\n referenceTable: `${keyof Schema}`;\n referenceTableColumn: string;\n // https://www.sqlite.org/foreignkeys.html#fk_actions\n onDeleteAction?: 'NO ACTION' | 'RESTRICT' | 'SET NULL' | 'SET DEFAULT' | 'CASCADE';\n }>;\n indexes?: Array<{\n columns: Array<keyof Schema[P]>;\n name: string;\n unique: boolean;\n }>;\n };\n};\n\nexport const tables: Tables = {\n channelQueries: {\n columns: {\n cids: 'TEXT',\n id: 'TEXT',\n },\n primaryKey: ['id'],\n },\n channels: {\n columns: {\n autoTranslationEnabled: 'BOOLEAN',\n autoTranslationLanguage: 'TEXT',\n cid: 'TEXT',\n config: 'TEXT',\n cooldown: 'BOOLEAN',\n createdAt: 'TEXT',\n createdById: 'TEXT',\n deletedAt: 'TEXT',\n disabled: 'BOOLEAN DEFAULT FALSE',\n extraData: 'TEXT',\n frozen: 'BOOLEAN',\n hidden: 'BOOLEAN',\n id: 'TEXT',\n invites: 'TEXT',\n lastMessageAt: 'TEXT',\n memberCount: 'INTEGER',\n muted: 'BOOLEAN DEFAULT FALSE',\n ownCapabilities: 'TEXT',\n team: 'TEXT',\n truncatedAt: 'TEXT',\n truncatedBy: 'TEXT',\n truncatedById: 'TEXT',\n type: 'TEXT',\n updatedAt: 'TEXT',\n },\n primaryKey: ['cid'],\n },\n members: {\n columns: {\n banned: 'BOOLEAN DEFAULT FALSE',\n channelRole: 'TEXT',\n cid: 'TEXT NOT NULL',\n createdAt: 'TEXT',\n inviteAcceptedAt: 'TEXT',\n invited: 'BOOLEAN',\n inviteRejectedAt: 'TEXT',\n isModerator: 'BOOLEAN',\n role: 'TEXT',\n shadowBanned: 'BOOLEAN DEFAULT FALSE',\n updatedAt: 'TEXT',\n userId: 'TEXT',\n },\n foreignKeys: [\n {\n column: 'cid',\n onDeleteAction: 'CASCADE',\n referenceTable: 'channels',\n referenceTableColumn: 'cid',\n },\n ],\n indexes: [\n {\n columns: ['cid', 'userId'],\n name: 'index_members',\n unique: false,\n },\n ],\n primaryKey: ['cid', 'userId'],\n },\n messages: {\n columns: {\n attachments: 'TEXT',\n cid: 'TEXT NOT NULL',\n createdAt: 'TEXT',\n deletedAt: 'TEXT',\n extraData: 'TEXT',\n id: 'TEXT',\n reactionCounts: 'TEXT',\n text: \"TEXT DEFAULT ''\",\n type: 'TEXT',\n updatedAt: 'TEXT',\n userId: 'TEXT',\n },\n foreignKeys: [\n {\n column: 'cid',\n onDeleteAction: 'CASCADE',\n referenceTable: 'channels',\n referenceTableColumn: 'cid',\n },\n ],\n indexes: [\n {\n columns: ['cid', 'userId'],\n name: 'index_messages',\n unique: false,\n },\n ],\n primaryKey: ['id'],\n },\n reactions: {\n columns: {\n createdAt: 'TEXT',\n extraData: 'TEXT',\n messageId: 'TEXT',\n score: 'INTEGER DEFAULT 0',\n type: 'TEXT',\n updatedAt: 'TEXT',\n userId: 'TEXT',\n },\n foreignKeys: [\n {\n column: 'messageId',\n onDeleteAction: 'CASCADE',\n referenceTable: 'messages',\n referenceTableColumn: 'id',\n },\n ],\n indexes: [\n {\n columns: ['messageId', 'userId'],\n name: 'index_reaction',\n unique: false,\n },\n ],\n primaryKey: ['messageId', 'userId', 'type'],\n },\n reads: {\n columns: {\n cid: 'TEXT NOT NULL',\n lastRead: 'TEXT NOT NULL',\n unreadMessages: 'INTEGER DEFAULT 0',\n userId: 'TEXT',\n },\n indexes: [\n {\n columns: ['cid', 'userId'],\n name: 'index_reads_cid',\n unique: false,\n },\n ],\n primaryKey: ['userId', 'cid'],\n },\n users: {\n columns: {\n banned: 'BOOLEAN DEFAULT FALSE',\n createdAt: 'TEXT',\n extraData: 'TEXT',\n id: 'TEXT',\n lastActive: 'TEXT',\n online: 'INTEGER',\n role: 'TEXT',\n updatedAt: 'TEXT',\n },\n indexes: [\n {\n columns: ['id'],\n name: 'index_users_id',\n unique: true,\n },\n ],\n primaryKey: ['id'],\n },\n userSyncStatus: {\n columns: {\n lastSyncedAt: 'TEXT',\n userId: 'TEXT',\n },\n primaryKey: ['userId'],\n },\n};\n\n// TODO: Checking the optionality of columns\nexport type Schema = {\n channelQueries: {\n cids: string;\n id: string;\n };\n channels: {\n cid: string;\n extraData: string;\n id: string;\n type: string;\n autoTranslationEnabled?: boolean;\n autoTranslationLanguage?: string;\n config?: string;\n cooldown?: number;\n createdAt?: string;\n createdById?: string;\n deletedAt?: string;\n disabled?: boolean;\n frozen?: boolean;\n hidden?: boolean;\n invites?: string;\n lastMessageAt?: string;\n memberCount?: number;\n muted?: boolean;\n ownCapabilities?: string;\n team?: string;\n truncatedAt?: string;\n truncatedBy?: string;\n truncatedById?: string;\n updatedAt?: string;\n };\n members: {\n cid: string;\n banned?: boolean;\n channelRole?: Role;\n createdAt?: string;\n inviteAcceptedAt?: string;\n invited?: boolean;\n inviteRejectedAt?: string;\n isModerator?: boolean;\n role?: string;\n shadowBanned?: boolean;\n updatedAt?: string;\n userId?: string;\n };\n messages: {\n attachments: string;\n cid: string;\n createdAt: string;\n deletedAt: string;\n extraData: string;\n id: string;\n reactionCounts: string;\n type: MessageLabel;\n updatedAt: string;\n text?: string;\n userId?: string;\n };\n reactions: {\n createdAt: string;\n messageId: string;\n type: string;\n updatedAt: string;\n extraData?: string;\n score?: number;\n userId?: string;\n };\n reads: {\n cid: string;\n lastRead: string;\n unreadMessages?: number;\n userId?: string;\n };\n users: {\n id: string;\n banned?: boolean;\n createdAt?: string;\n extraData?: string;\n lastActive?: string;\n online?: boolean;\n role?: string;\n updatedAt?: string;\n };\n userSyncStatus: {\n lastSyncedAt: string;\n userId: string;\n };\n};\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.appendWhereClause = void 0;
|
|
7
|
+
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
|
|
10
|
+
var appendWhereClause = function appendWhereClause(selectQuery, whereCondition) {
|
|
11
|
+
if (!whereCondition) return [selectQuery, []];
|
|
12
|
+
var whereClause = [];
|
|
13
|
+
var whereParams = [];
|
|
14
|
+
|
|
15
|
+
for (var key in whereCondition) {
|
|
16
|
+
var value = whereCondition[key];
|
|
17
|
+
if (value === undefined) continue;
|
|
18
|
+
|
|
19
|
+
if (Array.isArray(value)) {
|
|
20
|
+
var questionMarks = Array(Object.keys(value).length).fill('?').join(',');
|
|
21
|
+
whereClause.push(key + " in (" + questionMarks + ")");
|
|
22
|
+
whereParams.push.apply(whereParams, (0, _toConsumableArray2["default"])(value));
|
|
23
|
+
} else {
|
|
24
|
+
whereClause.push(key + " = ?");
|
|
25
|
+
whereParams.push(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!whereParams.length && !whereClause.length) {
|
|
30
|
+
return [selectQuery, []];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return [selectQuery + " WHERE " + whereClause.join(' AND '), whereParams];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.appendWhereClause = appendWhereClause;
|
|
37
|
+
//# sourceMappingURL=appendWhereCluase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["appendWhereCluase.ts"],"names":["appendWhereClause","selectQuery","whereCondition","whereClause","whereParams","key","value","undefined","Array","isArray","questionMarks","Object","keys","length","fill","join","push"],"mappings":";;;;;;;;;AAGO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAC/BC,WAD+B,EAE/BC,cAF+B,EAGX;AACpB,MAAI,CAACA,cAAL,EAAqB,OAAO,CAACD,WAAD,EAAc,EAAd,CAAP;AAErB,MAAME,WAAW,GAAG,EAApB;AACA,MAAMC,WAA+B,GAAG,EAAxC;;AAEA,OAAK,IAAMC,GAAX,IAAkBH,cAAlB,EAAkC;AAChC,QAAMI,KAAK,GAAGJ,cAAc,CAACG,GAAD,CAA5B;AACA,QAAIC,KAAK,KAAKC,SAAd,EAAyB;;AAEzB,QAAIC,KAAK,CAACC,OAAN,CAAcH,KAAd,CAAJ,EAA0B;AACxB,UAAMI,aAAa,GAAGF,KAAK,CAACG,MAAM,CAACC,IAAP,CAAYN,KAAZ,EAAmBO,MAApB,CAAL,CAAiCC,IAAjC,CAAsC,GAAtC,EAA2CC,IAA3C,CAAgD,GAAhD,CAAtB;AACAZ,MAAAA,WAAW,CAACa,IAAZ,CAAoBX,GAApB,aAA+BK,aAA/B;AACAN,MAAAA,WAAW,CAACY,IAAZ,OAAAZ,WAAW,sCAASE,KAAT,EAAX;AACD,KAJD,MAIO;AACLH,MAAAA,WAAW,CAACa,IAAZ,CAAoBX,GAApB;AACAD,MAAAA,WAAW,CAACY,IAAZ,CAAiBV,KAAjB;AACD;AACF;;AAED,MAAI,CAACF,WAAW,CAACS,MAAb,IAAuB,CAACV,WAAW,CAACU,MAAxC,EAAgD;AAC9C,WAAO,CAACZ,WAAD,EAAc,EAAd,CAAP;AACD;;AAED,SAAO,CAAIA,WAAJ,eAAyBE,WAAW,CAACY,IAAZ,CAAiB,OAAjB,CAAzB,EAAsDX,WAAtD,CAAP;AACD,CA5BM","sourcesContent":["import type { Schema } from '../schema';\nimport type { PreparedQueries, TableColumnNames, TableColumnValue } from '../types';\n\nexport const appendWhereClause = <T extends keyof Schema>(\n selectQuery: string,\n whereCondition?: Partial<{ [k in TableColumnNames<T>]: TableColumnValue | TableColumnValue[] }>,\n): PreparedQueries => {\n if (!whereCondition) return [selectQuery, []];\n\n const whereClause = [];\n const whereParams: TableColumnValue[] = [];\n\n for (const key in whereCondition) {\n const value = whereCondition[key];\n if (value === undefined) continue;\n\n if (Array.isArray(value)) {\n const questionMarks = Array(Object.keys(value).length).fill('?').join(',');\n whereClause.push(`${key} in (${questionMarks})`);\n whereParams.push(...value);\n } else {\n whereClause.push(`${key} = ?`);\n whereParams.push(value);\n }\n }\n\n if (!whereParams.length && !whereClause.length) {\n return [selectQuery, []];\n }\n\n return [`${selectQuery} WHERE ${whereClause.join(' AND ')}`, whereParams];\n};\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createCreateTableQuery = void 0;
|
|
7
|
+
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _schema = require("../schema");
|
|
13
|
+
|
|
14
|
+
var createCreateTableQuery = function createCreateTableQuery(tableName) {
|
|
15
|
+
var _tables$tableName$for, _tables$tableName$ind;
|
|
16
|
+
|
|
17
|
+
var columnsWithDescriptors = Object.entries(_schema.tables[tableName].columns).map(function (entry) {
|
|
18
|
+
var _entry = (0, _slicedToArray2["default"])(entry, 2),
|
|
19
|
+
key = _entry[0],
|
|
20
|
+
value = _entry[1];
|
|
21
|
+
|
|
22
|
+
return key + " " + value;
|
|
23
|
+
});
|
|
24
|
+
var primaryKeyConstraints = _schema.tables[tableName].primaryKey.length > 0 ? ["PRIMARY KEY (" + _schema.tables[tableName].primaryKey.join(', ') + ")"] : [];
|
|
25
|
+
var foreignKeysConstraints = ((_tables$tableName$for = _schema.tables[tableName].foreignKeys) == null ? void 0 : _tables$tableName$for.map(function (k) {
|
|
26
|
+
return "FOREIGN KEY (" + k.column + ") REFERENCES " + k.referenceTable + "(" + k.referenceTableColumn + ") ON DELETE " + (k.onDeleteAction || 'NO ACTION');
|
|
27
|
+
})) || [];
|
|
28
|
+
var indexQueries = ((_tables$tableName$ind = _schema.tables[tableName].indexes) == null ? void 0 : _tables$tableName$ind.map(function (index) {
|
|
29
|
+
return ["CREATE " + (index.unique ? 'UNIQUE' : '') + " INDEX IF NOT EXISTS " + index.name + " ON " + tableName + "(" + index.columns.join(',') + ")"];
|
|
30
|
+
})) || [];
|
|
31
|
+
return [["CREATE TABLE IF NOT EXISTS " + tableName + "(\n " + [].concat((0, _toConsumableArray2["default"])(columnsWithDescriptors), primaryKeyConstraints, (0, _toConsumableArray2["default"])(foreignKeysConstraints)).join(',\n') + "\n );"]].concat((0, _toConsumableArray2["default"])(indexQueries));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.createCreateTableQuery = createCreateTableQuery;
|
|
35
|
+
//# sourceMappingURL=createCreateTableQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createCreateTableQuery.ts"],"names":["createCreateTableQuery","tableName","columnsWithDescriptors","Object","entries","tables","columns","map","entry","key","value","primaryKeyConstraints","primaryKey","length","join","foreignKeysConstraints","foreignKeys","k","column","referenceTable","referenceTableColumn","onDeleteAction","indexQueries","indexes","index","unique","name"],"mappings":";;;;;;;;;;;AAAA;;AAGO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACC,SAAD,EAAyC;AAAA;;AAC7E,MAAMC,sBAAsB,GAAGC,MAAM,CAACC,OAAP,CAAeC,eAAOJ,SAAP,EAAkBK,OAAjC,EAA0CC,GAA1C,CAA8C,UAACC,KAAD,EAAW;AACtF,iDAAqBA,KAArB;AAAA,QAAOC,GAAP;AAAA,QAAYC,KAAZ;;AACA,WAAUD,GAAV,SAAiBC,KAAjB;AACD,GAH8B,CAA/B;AAKA,MAAMC,qBAAqB,GACzBN,eAAOJ,SAAP,EAAkBW,UAAlB,CAA6BC,MAA7B,GAAsC,CAAtC,GACI,mBAAiBR,eAAOJ,SAAP,EAAkBW,UAAlB,CAA6BE,IAA7B,CAAkC,IAAlC,CAAjB,OADJ,GAEI,EAHN;AAIA,MAAMC,sBAAsB,GAC1B,yCAAOd,SAAP,EAAkBe,WAAlB,2CAA+BT,GAA/B,CACE,UAACU,CAAD;AAAA,6BACkBA,CAAC,CAACC,MADpB,qBAC0CD,CAAC,CAACE,cAD5C,SAEIF,CAAC,CAACG,oBAFN,qBAGiBH,CAAC,CAACI,cAAF,IAAoB,WAHrC;AAAA,GADF,MAKK,EANP;AAQA,MAAMC,YAA+B,GACnC,yCAAOrB,SAAP,EAAkBsB,OAAlB,2CAA2BhB,GAA3B,CAA+B,UAACiB,KAAD;AAAA,WAAW,cAC9BA,KAAK,CAACC,MAAN,GAAe,QAAf,GAA0B,EADI,8BAEtCD,KAAK,CAACE,IAFgC,YAGjCzB,SAHiC,SAGpBuB,KAAK,CAAClB,OAAN,CAAcQ,IAAd,CAAmB,GAAnB,CAHoB,OAAX;AAAA,GAA/B,MAIM,EALR;AAOA,UACE,iCACgCb,SADhC,qBAEQ,8CAAIC,sBAAJ,GAA+BS,qBAA/B,sCAAyDI,sBAAzD,GAAiFD,IAAjF,CACA,KADA,CAFR,kBADF,6CAQKQ,YARL;AAUD,CAnCM","sourcesContent":["import { tables } from '../schema';\nimport type { PreparedQueries, Table } from '../types';\n\nexport const createCreateTableQuery = (tableName: Table): PreparedQueries[] => {\n const columnsWithDescriptors = Object.entries(tables[tableName].columns).map((entry) => {\n const [key, value] = entry;\n return `${key} ${value}`;\n });\n\n const primaryKeyConstraints =\n tables[tableName].primaryKey.length > 0\n ? [`PRIMARY KEY (${tables[tableName].primaryKey.join(', ')})`]\n : [];\n const foreignKeysConstraints =\n tables[tableName].foreignKeys?.map(\n (k) =>\n `FOREIGN KEY (${k.column}) REFERENCES ${k.referenceTable}(${\n k.referenceTableColumn\n }) ON DELETE ${k.onDeleteAction || 'NO ACTION'}`,\n ) || [];\n\n const indexQueries: PreparedQueries[] =\n tables[tableName].indexes?.map((index) => [\n `CREATE ${index.unique ? 'UNIQUE' : ''} INDEX IF NOT EXISTS ${\n index.name\n } ON ${tableName}(${index.columns.join(',')})`,\n ]) || [];\n\n return [\n [\n `CREATE TABLE IF NOT EXISTS ${tableName}(\n ${[...columnsWithDescriptors, ...primaryKeyConstraints, ...foreignKeysConstraints].join(\n ',\\n',\n )}\n );`,\n ],\n ...indexQueries,\n ];\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.createDeleteQuery = void 0;
|
|
5
|
+
|
|
6
|
+
var _appendWhereCluase = require("./appendWhereCluase");
|
|
7
|
+
|
|
8
|
+
var createDeleteQuery = function createDeleteQuery(table, whereCondition) {
|
|
9
|
+
var deleteQuery = "DELETE FROM " + table;
|
|
10
|
+
return (0, _appendWhereCluase.appendWhereClause)(deleteQuery, whereCondition);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.createDeleteQuery = createDeleteQuery;
|
|
14
|
+
//# sourceMappingURL=createDeleteQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createDeleteQuery.ts"],"names":["createDeleteQuery","table","whereCondition","deleteQuery"],"mappings":";;;;;AAAA;;AAeO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAC/BC,KAD+B,EAE/BC,cAF+B,EAGX;AACpB,MAAMC,WAAW,oBAAkBF,KAAnC;AAEA,SAAO,0CAAkBE,WAAlB,EAA+BD,cAA/B,CAAP;AACD,CAPM","sourcesContent":["import { appendWhereClause } from './appendWhereCluase';\n\nimport type { Schema } from '../schema';\nimport type { PreparedQueries, TableColumnNames, TableColumnValue } from '../types';\n\n/**\n * Creates a simple delete query for sqlite.\n *\n * @param {string} table Table name\n * @param {Object} whereCondition Where condition for select query.\n * e.g., { id: 'vishal', cid: ['messaging:id1', 'messaging:id2'] }.\n * All the conditions will be joined with AND in final query.\n * @returns {string} Final select query\n */\n\nexport const createDeleteQuery = <T extends keyof Schema>(\n table: T,\n whereCondition: Partial<{ [k in TableColumnNames<T>]: TableColumnValue | TableColumnValue[] }>,\n): PreparedQueries => {\n const deleteQuery = `DELETE FROM ${table}`;\n\n return appendWhereClause(deleteQuery, whereCondition);\n};\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSelectQuery = void 0;
|
|
7
|
+
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
|
|
10
|
+
var _appendWhereCluase = require("./appendWhereCluase");
|
|
11
|
+
|
|
12
|
+
var createSelectQuery = function createSelectQuery(table) {
|
|
13
|
+
var fields = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['*'];
|
|
14
|
+
var whereCondition = arguments.length > 2 ? arguments[2] : undefined;
|
|
15
|
+
var selectQuery = "SELECT " + fields.join(', ') + " FROM " + table;
|
|
16
|
+
|
|
17
|
+
var _appendWhereClause = (0, _appendWhereCluase.appendWhereClause)(selectQuery, whereCondition),
|
|
18
|
+
_appendWhereClause2 = (0, _slicedToArray2["default"])(_appendWhereClause, 2),
|
|
19
|
+
selectQueryWithWhere = _appendWhereClause2[0],
|
|
20
|
+
whereParams = _appendWhereClause2[1];
|
|
21
|
+
|
|
22
|
+
return ["" + selectQueryWithWhere, whereParams || []];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.createSelectQuery = createSelectQuery;
|
|
26
|
+
//# sourceMappingURL=createSelectQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createSelectQuery.ts"],"names":["createSelectQuery","table","fields","whereCondition","selectQuery","join","selectQueryWithWhere","whereParams"],"mappings":";;;;;;;;;AAAA;;AAeO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAC/BC,KAD+B,EAIX;AAAA,MAFpBC,MAEoB,uEAF8B,CAAC,GAAD,CAE9B;AAAA,MADpBC,cACoB;AACpB,MAAMC,WAAW,eAAaF,MAAM,CAACG,IAAP,CAAY,IAAZ,CAAb,cAAuCJ,KAAxD;;AACA,2BAA4C,0CAAkBG,WAAlB,EAA+BD,cAA/B,CAA5C;AAAA;AAAA,MAAOG,oBAAP;AAAA,MAA6BC,WAA7B;;AAEA,SAAO,MAAID,oBAAJ,EAA4BC,WAAW,IAAI,EAA3C,CAAP;AACD,CATM","sourcesContent":["import { appendWhereClause } from './appendWhereCluase';\n\nimport type { Schema } from '../schema';\nimport type { PreparedQueries, TableColumnNames, TableColumnValue } from '../types';\n\n/**\n * Creates a simple select query for sqlite.\n *\n * @param {string} table Table name\n * @param {Array} fields Array of columns which need to be selected e.g., ['*'] or ['id', 'name']\n * @param {Object} whereCondition Where condition for select query.\n * e.g., { id: 'vishal', cid: ['messaging:id1', 'messaging:id2'] }.\n * All the conditions will be joined with AND in final query.\n * @returns {string} Final select query\n */\nexport const createSelectQuery = <T extends keyof Schema>(\n table: T,\n fields: Array<'*'> | Array<TableColumnNames<T>> = ['*'],\n whereCondition?: Partial<{ [k in TableColumnNames<T>]: TableColumnValue | TableColumnValue[] }>,\n): PreparedQueries => {\n const selectQuery = `SELECT ${fields.join(', ')} FROM ${table}`;\n const [selectQueryWithWhere, whereParams] = appendWhereClause(selectQuery, whereCondition);\n\n return [`${selectQueryWithWhere}`, whereParams || []];\n};\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createUpdateQuery = void 0;
|
|
7
|
+
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _appendWhereCluase = require("./appendWhereCluase");
|
|
13
|
+
|
|
14
|
+
var createUpdateQuery = function createUpdateQuery(table, set, whereCondition) {
|
|
15
|
+
var fields = Object.keys(set).map(function (key) {
|
|
16
|
+
return key + " = ?";
|
|
17
|
+
});
|
|
18
|
+
var updateQuery = "UPDATE " + table + " SET " + fields.join(',');
|
|
19
|
+
|
|
20
|
+
var _appendWhereClause = (0, _appendWhereCluase.appendWhereClause)(updateQuery, whereCondition),
|
|
21
|
+
_appendWhereClause2 = (0, _slicedToArray2["default"])(_appendWhereClause, 2),
|
|
22
|
+
updateQueryWithWhere = _appendWhereClause2[0],
|
|
23
|
+
whereParams = _appendWhereClause2[1];
|
|
24
|
+
|
|
25
|
+
return [updateQueryWithWhere, [].concat((0, _toConsumableArray2["default"])(Object.values(set)), (0, _toConsumableArray2["default"])(whereParams || []))];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.createUpdateQuery = createUpdateQuery;
|
|
29
|
+
//# sourceMappingURL=createUpdateQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createUpdateQuery.ts"],"names":["createUpdateQuery","table","set","whereCondition","fields","Object","keys","map","key","updateQuery","join","updateQueryWithWhere","whereParams","values"],"mappings":";;;;;;;;;;;AAAA;;AAeO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAC/BC,KAD+B,EAE/BC,GAF+B,EAG/BC,cAH+B,EAIX;AACpB,MAAMC,MAAM,GAAGC,MAAM,CAACC,IAAP,CAAYJ,GAAZ,EAAiBK,GAAjB,CAAqB,UAACC,GAAD;AAAA,WAAYA,GAAZ;AAAA,GAArB,CAAf;AACA,MAAMC,WAAW,eAAaR,KAAb,aAA0BG,MAAM,CAACM,IAAP,CAAY,GAAZ,CAA3C;;AAEA,2BAA4C,0CAAkBD,WAAlB,EAA+BN,cAA/B,CAA5C;AAAA;AAAA,MAAOQ,oBAAP;AAAA,MAA6BC,WAA7B;;AAEA,SAAO,CAACD,oBAAD,gDAA2BN,MAAM,CAACQ,MAAP,CAAcX,GAAd,CAA3B,uCAAmDU,WAAW,IAAI,EAAlE,GAAP;AACD,CAXM","sourcesContent":["import { appendWhereClause } from './appendWhereCluase';\n\nimport type { Schema } from '../schema';\nimport type { PreparedQueries, TableColumnNames, TableColumnValue, TableRow } from '../types';\n\n/**\n * Creates a simple update query for sqlite.\n *\n * @param {string} table Table name\n * @param {Object} set Set conditions for update query.\n * @param {Object} whereCondition Where condition for select query.\n * e.g., { id: 'vishal', cid: ['messaging:id1', 'messaging:id2'] }.\n * All the conditions will be joined with AND in final query.\n * @returns {string} Final update query for sqlite\n */\nexport const createUpdateQuery = <T extends keyof Schema>(\n table: T,\n set: Partial<TableRow<T>>,\n whereCondition: Partial<{ [k in TableColumnNames<T>]: TableColumnValue | TableColumnValue[] }>,\n): PreparedQueries => {\n const fields = Object.keys(set).map((key) => `${key} = ?`);\n const updateQuery = `UPDATE ${table} SET ${fields.join(',')}`;\n\n const [updateQueryWithWhere, whereParams] = appendWhereClause(updateQuery, whereCondition);\n\n return [updateQueryWithWhere, [...Object.values(set), ...(whereParams || [])]];\n};\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.createUpsertQuery = void 0;
|
|
5
|
+
|
|
6
|
+
var _schema = require("../schema");
|
|
7
|
+
|
|
8
|
+
var createUpsertQuery = function createUpsertQuery(table, row, conflictCheckKeys) {
|
|
9
|
+
var filteredRow = {};
|
|
10
|
+
|
|
11
|
+
for (var key in row) {
|
|
12
|
+
if (row[key] !== undefined) {
|
|
13
|
+
filteredRow[key] = row[key];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var fields = Object.keys(filteredRow);
|
|
18
|
+
var questionMarks = Array(Object.keys(fields).length).fill('?').join(',');
|
|
19
|
+
var conflictKeys = conflictCheckKeys || _schema.tables[table].primaryKey;
|
|
20
|
+
var conflictMatchersWithoutPK = fields.filter(function (f) {
|
|
21
|
+
return !conflictKeys.includes(f);
|
|
22
|
+
}).map(function (f) {
|
|
23
|
+
return f + "=excluded." + f;
|
|
24
|
+
});
|
|
25
|
+
var conflictConstraint = conflictKeys.length > 0 ? "ON CONFLICT(" + conflictKeys.join(',') + ") DO UPDATE SET\n " + conflictMatchersWithoutPK.join(',') : '';
|
|
26
|
+
return ["INSERT INTO " + table + " (" + fields.join(',') + ") VALUES (" + questionMarks + ") " + conflictConstraint, Object.values(filteredRow)];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.createUpsertQuery = createUpsertQuery;
|
|
30
|
+
//# sourceMappingURL=createUpsertQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createUpsertQuery.ts"],"names":["createUpsertQuery","table","row","conflictCheckKeys","filteredRow","key","undefined","fields","Object","keys","questionMarks","Array","length","fill","join","conflictKeys","tables","primaryKey","conflictMatchersWithoutPK","filter","f","includes","map","conflictConstraint","values"],"mappings":";;;;;AAAA;;AAWO,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAC/BC,KAD+B,EAE/BC,GAF+B,EAG/BC,iBAH+B,EAIX;AACpB,MAAMC,WAAuB,GAAG,EAAhC;;AAQA,OAAK,IAAMC,GAAX,IAAkBH,GAAlB,EAAuB;AACrB,QAAIA,GAAG,CAACG,GAAD,CAAH,KAAaC,SAAjB,EAA4B;AAC1BF,MAAAA,WAAW,CAACC,GAAD,CAAX,GAAmBH,GAAG,CAACG,GAAD,CAAtB;AACD;AACF;;AACD,MAAME,MAAM,GAAGC,MAAM,CAACC,IAAP,CAAYL,WAAZ,CAAf;AAEA,MAAMM,aAAa,GAAGC,KAAK,CAACH,MAAM,CAACC,IAAP,CAAYF,MAAZ,EAAoBK,MAArB,CAAL,CAAkCC,IAAlC,CAAuC,GAAvC,EAA4CC,IAA5C,CAAiD,GAAjD,CAAtB;AACA,MAAMC,YAAY,GAAGZ,iBAAiB,IAAIa,eAAOf,KAAP,EAAcgB,UAAxD;AACA,MAAMC,yBAAmC,GAAIX,MAAD,CACzCY,MADyC,CAClC,UAACC,CAAD;AAAA,WAAO,CAAEL,YAAD,CAA2BM,QAA3B,CAAoCD,CAApC,CAAR;AAAA,GADkC,EAEzCE,GAFyC,CAErC,UAACF,CAAD;AAAA,WAAUA,CAAV,kBAAwBA,CAAxB;AAAA,GAFqC,CAA5C;AAIA,MAAMG,kBAAkB,GACtBR,YAAY,CAACH,MAAb,GAAsB,CAAtB,oBACmBG,YAAY,CAACD,IAAb,CAAkB,GAAlB,CADnB,2BAEAI,yBAAyB,CAACJ,IAA1B,CAA+B,GAA/B,CAFA,GAGI,EAJN;AAMA,SAAO,kBACUb,KADV,UACoBM,MAAM,CAACO,IAAP,CAAY,GAAZ,CADpB,kBACiDJ,aADjD,UACmEa,kBADnE,EAELf,MAAM,CAACgB,MAAP,CAAcpB,WAAd,CAFK,CAAP;AAID,CApCM","sourcesContent":["import { Schema, tables } from '../schema';\nimport type { PreparedQueries, TableColumnNames, TableRow } from '../types';\n\n/**\n * Creates a simple upsert query for sqlite.\n *\n * @param {string} table Table name\n * @param {Object} row Table row to insert or update.\n * @param {Array} conflictCheckKeys Custom list of columns to check conflicts for - https://www.sqlite.org/lang_UPSERT.html. By default conflicts are checked on primary keys.\n * @returns {string} Final upsert query for sqlite\n */\nexport const createUpsertQuery = <T extends keyof Schema>(\n table: T,\n row: Partial<TableRow<T>>,\n conflictCheckKeys?: Array<TableColumnNames<T>>,\n): PreparedQueries => {\n const filteredRow: typeof row = {};\n\n // In case of \"DO UPDATE SET\", we only want to update the properties which\n // are provided, and not set undefined properties in database.\n // E.g., channel date such as `own_capabilities` is only available in response of client.queryChannels or channel.query.\n // But its not available in `event.channel`. And our mapper functions such as mapChannelToStorable will set fields which are not available as undefined.\n // So when you execute upsert query for storable value of `event.channel` in `channels` table, it will\n // unset ownCapabilities field for that channel in `channels` table.\n for (const key in row) {\n if (row[key] !== undefined) {\n filteredRow[key] = row[key];\n }\n }\n const fields = Object.keys(filteredRow) as (keyof typeof row)[];\n\n const questionMarks = Array(Object.keys(fields).length).fill('?').join(',');\n const conflictKeys = conflictCheckKeys || tables[table].primaryKey;\n const conflictMatchersWithoutPK: string[] = (fields as string[])\n .filter((f) => !(conflictKeys as string[]).includes(f))\n .map((f) => `${f}=excluded.${f}`);\n\n const conflictConstraint =\n conflictKeys.length > 0\n ? `ON CONFLICT(${conflictKeys.join(',')}) DO UPDATE SET\n ${conflictMatchersWithoutPK.join(',')}`\n : '';\n\n return [\n `INSERT INTO ${table} (${fields.join(',')}) VALUES (${questionMarks}) ${conflictConstraint}`,\n Object.values(filteredRow),\n ];\n};\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.printRow = void 0;
|
|
5
|
+
|
|
6
|
+
var printRow = function printRow(row) {
|
|
7
|
+
var prettyRow = {};
|
|
8
|
+
|
|
9
|
+
for (var key in row) {
|
|
10
|
+
var value = row[key];
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
prettyRow[key] = JSON.parse(value);
|
|
14
|
+
} catch (e) {
|
|
15
|
+
prettyRow[key] = value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
console.log(JSON.stringify(prettyRow, null, 2));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.printRow = printRow;
|
|
23
|
+
//# sourceMappingURL=printRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["printRow.ts"],"names":["printRow","row","prettyRow","key","value","JSON","parse","e","console","log","stringify"],"mappings":";;;;;AAGO,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CAACC,GAAD,EAAwB;AAE9C,MAAMC,SAA8B,GAAG,EAAvC;;AACA,OAAK,IAAMC,GAAX,IAAkBF,GAAlB,EAAuB;AAErB,QAAMG,KAAK,GAAGH,GAAG,CAACE,GAAD,CAAjB;;AAEA,QAAI;AACFD,MAAAA,SAAS,CAACC,GAAD,CAAT,GAAiBE,IAAI,CAACC,KAAL,CAAWF,KAAX,CAAjB;AACD,KAFD,CAEE,OAAOG,CAAP,EAAU;AACVL,MAAAA,SAAS,CAACC,GAAD,CAAT,GAAiBC,KAAjB;AACD;AACF;;AAEDI,EAAAA,OAAO,CAACC,GAAR,CAAYJ,IAAI,CAACK,SAAL,CAAeR,SAAf,EAA0B,IAA1B,EAAgC,CAAhC,CAAZ;AACD,CAfM","sourcesContent":["import type { TableRow } from '../types';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const printRow = (row: TableRow<any>) => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const prettyRow: Record<string, any> = {};\n for (const key in row) {\n // @ts-ignore\n const value = row[key];\n\n try {\n prettyRow[key] = JSON.parse(value);\n } catch (e) {\n prettyRow[key] = value;\n }\n }\n\n console.log(JSON.stringify(prettyRow, null, 2));\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BetterSqlite = void 0;
|
|
7
|
+
|
|
8
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
9
|
+
|
|
10
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _betterSqlite = _interopRequireDefault(require("better-sqlite3"));
|
|
13
|
+
|
|
14
|
+
var _schema = require("../store/schema");
|
|
15
|
+
|
|
16
|
+
var BetterSqlite = (0, _createClass2["default"])(function BetterSqlite() {
|
|
17
|
+
(0, _classCallCheck2["default"])(this, BetterSqlite);
|
|
18
|
+
this.db = null;
|
|
19
|
+
});
|
|
20
|
+
exports.BetterSqlite = BetterSqlite;
|
|
21
|
+
|
|
22
|
+
BetterSqlite.openDB = function () {
|
|
23
|
+
BetterSqlite.db = new _betterSqlite["default"]('foobar.db');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
BetterSqlite.closeDB = function () {
|
|
27
|
+
BetterSqlite.db.close();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
BetterSqlite.getTables = function () {
|
|
31
|
+
BetterSqlite.openDB();
|
|
32
|
+
var tablesInDb = BetterSqlite.db.pragma("table_list;");
|
|
33
|
+
BetterSqlite.closeDB();
|
|
34
|
+
return tablesInDb;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
BetterSqlite.dropAllTables = function () {
|
|
38
|
+
BetterSqlite.openDB();
|
|
39
|
+
var tableNames = Object.keys(_schema.tables);
|
|
40
|
+
tableNames.forEach(function (name) {
|
|
41
|
+
var stmt = BetterSqlite.db.prepare("DROP TABLE IF EXISTS " + name);
|
|
42
|
+
stmt.run();
|
|
43
|
+
});
|
|
44
|
+
BetterSqlite.closeDB();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
BetterSqlite.selectFromTable = function (table) {
|
|
48
|
+
BetterSqlite.openDB();
|
|
49
|
+
var stmt = BetterSqlite.db.prepare("SELECT * FROM " + table);
|
|
50
|
+
var result = stmt.all();
|
|
51
|
+
BetterSqlite.closeDB();
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=BetterSqlite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["BetterSqlite.js"],"names":["BetterSqlite","db","openDB","Database","closeDB","close","getTables","tablesInDb","pragma","dropAllTables","tableNames","Object","keys","tables","forEach","name","stmt","prepare","run","selectFromTable","table","result","all"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;IAEaA,Y;;OACXC,E,GAAK,I;;;;AADMD,Y,CAGJE,M,GAAS,YAAM;AAHXF,EAAAA,YAIT,CAAKC,EAAL,GAAU,IAAIE,wBAAJ,CAAa,WAAb,CAAV;AACD,C;;AALUH,Y,CAOJI,O,GAAU,YAAM;AAPZJ,EAAAA,YAQT,CAAKC,EAAL,CAAQI,KAAR;AACD,C;;AATUL,Y,CAWJM,S,GAAY,YAAM;AAXdN,EAAAA,YAYT,CAAKE,MAAL;AACA,MAAMK,UAAU,GAbPP,YAaU,CAAKC,EAAL,CAAQO,MAAR,eAAnB;AAbSR,EAAAA,YAcT,CAAKI,OAAL;AAEA,SAAOG,UAAP;AACD,C;;AAjBUP,Y,CAmBJS,a,GAAgB,YAAM;AAnBlBT,EAAAA,YAoBT,CAAKE,MAAL;AACA,MAAMQ,UAAU,GAAGC,MAAM,CAACC,IAAP,CAAYC,cAAZ,CAAnB;AAEAH,EAAAA,UAAU,CAACI,OAAX,CAAmB,UAACC,IAAD,EAAU;AAC3B,QAAMC,IAAI,GAxBHhB,YAwBM,CAAKC,EAAL,CAAQgB,OAAR,2BAAwCF,IAAxC,CAAb;AACAC,IAAAA,IAAI,CAACE,GAAL;AACD,GAHD;AAvBSlB,EAAAA,YA4BT,CAAKI,OAAL;AACD,C;;AA7BUJ,Y,CA+BJmB,e,GAAkB,UAACC,KAAD,EAAW;AA/BzBpB,EAAAA,YAgCT,CAAKE,MAAL;AACA,MAAMc,IAAI,GAjCDhB,YAiCI,CAAKC,EAAL,CAAQgB,OAAR,oBAAiCG,KAAjC,CAAb;AACA,MAAMC,MAAM,GAAGL,IAAI,CAACM,GAAL,EAAf;AAlCStB,EAAAA,YAmCT,CAAKI,OAAL;AAEA,SAAOiB,MAAP;AACD,C","sourcesContent":["import Database from 'better-sqlite3';\n\nimport { tables } from '../store/schema';\n\nexport class BetterSqlite {\n db = null;\n\n static openDB = () => {\n this.db = new Database('foobar.db');\n };\n\n static closeDB = () => {\n this.db.close();\n };\n\n static getTables = () => {\n this.openDB();\n const tablesInDb = this.db.pragma(`table_list;`);\n this.closeDB();\n\n return tablesInDb;\n };\n\n static dropAllTables = () => {\n this.openDB();\n const tableNames = Object.keys(tables);\n\n tableNames.forEach((name) => {\n const stmt = this.db.prepare(`DROP TABLE IF EXISTS ${name}`);\n stmt.run();\n });\n\n this.closeDB();\n };\n\n static selectFromTable = (table) => {\n this.openDB();\n const stmt = this.db.prepare(`SELECT * FROM ${table}`);\n const result = stmt.all();\n this.closeDB();\n\n return result;\n };\n}\n"]}
|
package/lib/module/version.json
CHANGED
|
@@ -4,7 +4,7 @@ import { MessageContextValue } from '../../contexts/messageContext/MessageContex
|
|
|
4
4
|
import { MessagesContextValue } from '../../contexts/messagesContext/MessagesContext';
|
|
5
5
|
import { OverlayContextValue } from '../../contexts/overlayContext/OverlayContext';
|
|
6
6
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
7
|
-
export declare type GalleryPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ImageGalleryContextValue<StreamChatGenerics>, '
|
|
7
|
+
export declare type GalleryPropsWithContext<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> = Pick<ImageGalleryContextValue<StreamChatGenerics>, 'setSelectedMessage' | 'setMessages'> & Pick<MessageContextValue<StreamChatGenerics>, 'alignment' | 'groupStyles' | 'images' | 'videos' | 'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress' | 'threadList'> & Pick<MessagesContextValue<StreamChatGenerics>, 'additionalTouchableProps' | 'legacyImageViewerSwipeBehaviour' | 'VideoThumbnail' | 'ImageLoadingIndicator' | 'ImageLoadingFailedIndicator'> & Pick<OverlayContextValue, 'setOverlay'> & {
|
|
8
8
|
channelId: string | undefined;
|
|
9
9
|
hasThreadReplies?: boolean;
|
|
10
10
|
/**
|