UNPKG

@salad-labs/loopz-typescript

Version:
503 lines 27.8 kB
import { Engine, User, Conversation, QIError, Message, ConversationReport, MessageReport, ConversationTradingPool, MessageImportant, ConversationPin } from "./core/chat"; import { ConversationMutationEngine, ConversationSubscriptionEngine } from "./interfaces/chat/core/conversation"; import { MessageMutationEngine, MessageQueryEngine, MessageSubscriptionEngine } from "./interfaces/chat/core/message"; import { ConversationTradingPoolMutationEngine, ConversationTradingPoolQueryEngine, ConversationTradingPoolSubscriptionEngine } from "./interfaces/chat/core/conversationtradingpool"; import { UserMutationEngine, UserSubscriptionEngine } from "./interfaces/chat/core/user"; import { Conversation as ConversationGraphQL, ListConversationMembers as ListConversationMembersGraphQL, Message as MessageGraphQL, ConversationTradingPool as ConversationTradingPoolGraphQL, User as UserGraphQL, BatchDeleteMessagesResult as BatchDeleteMessagesResultGraphQL, MemberOutResult as MemberOutResultGraphQL, JoinConversationResult as JoinConversationResultGraphQL } from "./graphql/generated/graphql"; import { ConversationMember } from "./core/chat/conversationmember"; import { AddReactionToMessageArgs, AddReportToConversationArgs, AddReportToMessageArgs, CreateConversationGroupArgs, CreateConversationOneToOneArgs, DeleteBatchConversationMessagesArgs, EditMessageArgs, ListAllActiveUserConversationIdsArgs, ListMessagesByConversationIdArgs, ListMessagesImportantByUserConversationIdArgs, MuteConversationArgs, RemoveReactionFromMessageArgs, RequestTradeArgs, SendMessageArgs, UpdateConversationGroupInputArgs, UpdateUserArgs, AddMembersToConversationArgs, EjectMemberArgs, UpdateRequestTradeArgs, ListTradesByConversationIdArgs, ListMessagesByRangeOrderArgs, FindUsersByUsernameArgs } from "./types/chat/schema/args"; import { UAMutationEngine, UAQueryEngine } from "./interfaces/chat/core/ua"; import { Maybe } from "./types/base"; import { OperationResult } from "@urql/core"; import { SubscriptionGarbage } from "./types/chat/subscriptiongarbage"; import { KeyPairItem } from "./types/chat/keypairitem"; import { ConversationTradingPoolStatus } from "./enums"; import { LocalDBConversation, LocalDBMessage } from "./core/app/database"; import { Order } from "./order"; import { ChatEvents, EngineInitConfig } from "."; import { DetectiveMessage } from "./core/chat/detectivemessage"; import { ListMessagesUpdatedArgs } from "./types/chat/schema/args/listmessagesupdated"; export declare class Chat extends Engine implements UserMutationEngine, UserSubscriptionEngine, ConversationMutationEngine, ConversationSubscriptionEngine, MessageQueryEngine, MessageMutationEngine, MessageSubscriptionEngine, ConversationTradingPoolQueryEngine, ConversationTradingPoolMutationEngine, ConversationTradingPoolSubscriptionEngine, UAMutationEngine, UAQueryEngine { private static _config; private static _instance; private _isSyncing; private _syncingCounter; private _eventsCallbacks; private _unsubscribeSyncSet; private _conversationsMap; private _canChat; private _hookMessageCreated; private _hookMessageUpdated; private _hookMessageDeleted; private _hookConversationCreated; private _hookConversationUpdated; private _syncRunning; private _hookMessageCreatingFn; private _hookMessageUpdatingFn; private _hookConversationCreatingFn; private _hookConversationUpdatingFn; private _syncTimeout; private static _detectiveMessage; private SYNCING_TIME_MS; private _currentPublicConversation; private static PUBLIC_CONVERSATION_KEY; private constructor(); /** static methods */ static config(config: EngineInitConfig): void; static getInstance(): Chat; static getDetectiveMessageInstance(): DetectiveMessage; static silentRestoreSubscriptionSync(): void; static unsyncBrutal(): Promise<void>; /** message content handling */ private _getMessageContent; /** private instance methods */ /** * Internal method to set the current public conversation * @param {string} conversationId */ private _setCurrentPublicConversation; /** * Synchronize the public conversation state across windows */ private _syncPublicConversationState; /** * Updates the public conversation state in localStorage */ private _updatePublicConversationStorage; /** * Adds a listener for cross-window storage events */ private _setupStorageEventListener; private _defineHookFnLocalDB; private _emit; /** syncing data with backend*/ private _recoverUserConversations; private _recoverKeysFromConversations; private _recoverMessagesFromConversations; private _sync; private _onAddMembersToConversationSync; private _onAddReactionSync; private _onRemoveReactionSync; private _onSendMessageSync; private _onEditMessageSync; private _onDeleteMessageSync; private _onBatchDeleteMessagesSync; private _onUpdateConversationGroupSync; private _onEjectMemberSync; private _onLeaveConversationSync; private _onMuteConversationSync; private _onUnmuteConversationSync; private _onRequestTradeSync; private _onUpdateRequestTradeSync; private _addSubscriptionsSync; private _removeSubscriptionsSync; /** local database events */ private _onMessageCreatedLDB; private _onMessageDeletedLDB; private _onMessageUpdatedLDB; private _onConversationCreatedLDB; private _onConversationUpdatedLDB; private _makeUser; private _makeConversation; private _makeReaction; private _makeMessage; private _makeConversationMember; private _makeConversationReport; private _makeMessageReport; private _makeConversationTradingPool; private _makeMessageImportant; /** public instance methods */ /** Mutations */ /** * Let user to join a conversation * @param {object} [args] - The arguments to join the conversation. * @returns {Promise<Conversation | QIError>} A promise that resolves to a Conversation object if successful, or a QIError object if there was an error. */ joinConversation(args: { conversationId: string; encryptedConversationAESKey: string; encryptedConversationIVKey: string; }, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Conversation>; /** * Blocks a user by their ID. * @param {string} [id] - The ID of the user to block. * @returns {Promise<User | QIError>} A promise that resolves to a User object if successful, or a QIError object if there was an error. */ blockUser(overrideHandlingUnauthorizedQIError?: boolean): Promise<User | QIError>; blockUser(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<User | QIError>; addMembersToConversation(args: AddMembersToConversationArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<{ conversationId: string; items: Array<ConversationMember>; } | QIError>; pinMessage(overrideHandlingUnauthorizedQIError?: boolean): Promise<Message | QIError>; pinMessage(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<Message | QIError>; addReactionToMessage(args: AddReactionToMessageArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<Message | QIError>; addReportToConversation(args: AddReportToConversationArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | ConversationReport>; addReportToMessage(args: AddReportToMessageArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | MessageReport>; archiveConversation(overrideHandlingUnauthorizedQIError?: boolean): Promise<User | QIError>; archiveConversation(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<User | QIError>; archiveConversations(ids: Array<string>, overrideHandlingUnauthorizedQIError?: boolean): Promise<User | QIError>; createConversationGroup(args: CreateConversationGroupArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<{ keypairItem: KeyPairItem; conversation: Conversation; } | QIError>; createConversationOneToOne(args: CreateConversationOneToOneArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { keypairItem: KeyPairItem; conversation: Conversation; }>; deleteBatchConversationMessages(args: DeleteBatchConversationMessagesArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<{ conversationId: string; messagesIds: string[]; } | QIError>; deleteMessage(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<Message | QIError>; deleteRequestTrade(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<ConversationTradingPool | QIError>; editMessage(args: EditMessageArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Message>; ejectMember(args: EjectMemberArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { conversationId: string; conversation: Conversation; memberOut: User; }>; eraseConversationByAdmin(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<{ conversationId: string; items: Array<{ id: string; }>; } | QIError>; leaveConversation(overrideHandlingUnauthorizedQIError?: boolean): Promise<{ conversationId: string; conversation: Conversation; memberOut: User; } | QIError>; leaveConversation(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<{ conversationId: string; conversation: Conversation; memberOut: User; } | QIError>; muteConversation(args: MuteConversationArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Conversation>; unlockUser(overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | User>; unlockUser(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | User>; unpinMessage(overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Message>; unpinMessage(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Message>; removeReactionFromMessage(args: RemoveReactionFromMessageArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Message>; requestTrade(args: RequestTradeArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | ConversationTradingPool>; updateRequestTrade(args: UpdateRequestTradeArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | ConversationTradingPool>; sendMessage(args: SendMessageArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Message>; unarchiveConversation(overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | User>; unarchiveConversation(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | User>; unarchiveConversations(ids: Array<string>, overrideHandlingUnauthorizedQIError?: boolean): Promise<User | QIError>; unmuteConversation(overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Conversation>; unmuteConversation(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Conversation>; updateConversationGroup(args: UpdateConversationGroupInputArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Conversation>; updateUser(args: UpdateUserArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | User>; markImportantMessage(overrideHandlingUnauthorizedQIError?: boolean): Promise<Message | QIError>; markImportantMessage(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<Message | QIError>; unmarkImportantMessage(overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Message>; unmarkImportantMessage(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | Message>; pinConversation(overrideHandlingUnauthorizedQIError?: boolean): Promise<Conversation | QIError>; pinConversation(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<Conversation | QIError>; unpinConversation(overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | boolean>; unpinConversation(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | boolean>; listAllActiveUserConversationIds(args: ListAllActiveUserConversationIdsArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: string[]; nextToken?: string | undefined; }>; /** * Retrieves the conversation members from the conversation by its ID. * @returns A Promise that resolves to an array of ConversationMember objects or a QIError object. */ listConversationMembersByConversationId(conversationId: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<ConversationMember[] | QIError>; listConversationMemberByUserId(nextToken?: string | undefined, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: ConversationMember[]; nextToken?: Maybe<string> | undefined; }>; listUsersByIds(ids: string[], overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: User[]; unprocessedKeys?: Maybe<string[]> | undefined; }>; listConversationsByIds(ids: string[], overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: Conversation[]; unprocessedKeys?: Maybe<string[]> | undefined; }>; listMessagesByConversationId(args: ListMessagesByConversationIdArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: Message[]; nextToken?: Maybe<string> | undefined; }>; listMessagesByRangeOrder(args: ListMessagesByRangeOrderArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: Message[]; nextToken?: Maybe<string> | undefined; }>; listMessagesUpdated(args: ListMessagesUpdatedArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: Message[]; nextToken?: Maybe<string> | undefined; }>; listMessagesImportantByUserConversationId(args: ListMessagesImportantByUserConversationIdArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<{ items: MessageImportant[]; nextToken?: Maybe<string> | undefined; } | QIError>; listConversationsPinnedByCurrentUser(nextToken?: string | undefined, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: ConversationPin[]; nextToken?: Maybe<string> | undefined; }>; findUsersByUsername(args: FindUsersByUsernameArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { items: User[]; nextToken?: String | undefined; }>; getCurrentUser(overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | User>; getConversationById(id: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<Conversation | QIError>; listTradesByConversationId(args: ListTradesByConversationIdArgs, overrideHandlingUnauthorizedQIError?: boolean): Promise<{ items: Array<ConversationTradingPool>; nextToken?: Maybe<string>; } | QIError>; getConversationTradingPoolById(conversationTradingPoolId: string, overrideHandlingUnauthorizedQIError?: boolean): Promise<ConversationTradingPool | QIError>; /** * Subscriptions */ onChatMessageEvents(conversationId: string, callback: (response: Message | QIError, source: OperationResult<{ onChatMessageEvents: MessageGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onChatMemberEvents(conversationId: string, callback: (response: QIError | { conversationId: string; conversation: Conversation; memberOut: User; }, source: OperationResult<{ onChatMemberEvents: MemberOutResultGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onChatJoinEvents(conversationId: string, callback: (response: QIError | { conversationId: string; conversation: Conversation; member: User; }, source: OperationResult<{ onChatJoinEvents: JoinConversationResultGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onSendMessage(callback: (response: Message | QIError, source: OperationResult<{ onSendMessage: MessageGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): SubscriptionGarbage | QIError; onEditMessage(callback: (response: QIError | Message, source: OperationResult<{ onEditMessage: MessageGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onBatchDeleteMessages(callback: (response: QIError | { conversationId: string; messagesIds: string[]; }, source: OperationResult<{ onBatchDeleteMessages: BatchDeleteMessagesResultGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onDeleteMessage(callback: (response: QIError | Message, source: OperationResult<{ onDeleteMessage: MessageGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onAddReaction(callback: (response: QIError | Message, source: OperationResult<{ onAddReaction: MessageGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onRemoveReaction(callback: (response: QIError | Message, source: OperationResult<{ onRemoveReaction: MessageGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onAddPinMessage(callback: (response: QIError | Message, source: OperationResult<{ onAddPinMessage: MessageGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onRemovePinMessage(callback: (response: QIError | Message, source: OperationResult<{ onRemovePinMessage: MessageGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onUpdateConversationGroup(callback: (response: QIError | Conversation, source: OperationResult<{ onUpdateConversationGroup: ConversationGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onEjectMember(callback: (response: QIError | { conversationId: string; conversation: Conversation; memberOut: User; }, source: OperationResult<{ onEjectMember: MemberOutResultGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onLeaveConversation(callback: (response: QIError | { conversationId: string; conversation: Conversation; memberOut: User; }, source: OperationResult<{ onLeaveConversation: MemberOutResultGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onAddPinConversation(callback: (response: QIError | Conversation, source: OperationResult<{ onAddPinConversation: ConversationGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onRemovePinConversation(callback: (response: QIError | Conversation, source: OperationResult<{ onRemovePinConversation: ConversationGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onMuteConversation(callback: (response: QIError | Conversation, source: OperationResult<{ onMuteConversation: ConversationGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onUnmuteConversation(callback: (response: QIError | Conversation, source: OperationResult<{ onUnmuteConversation: ConversationGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onAddMembersToConversation(callback: (response: QIError | { conversationId: string; items: ConversationMember[]; membersIds: Array<string>; }, source: OperationResult<{ onAddMembersToConversation: ListConversationMembersGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onUpdateUser(callback: (response: QIError | User, source: OperationResult<{ onUpdateUser: UserGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onRequestTrade(callback: (response: QIError | ConversationTradingPool, source: OperationResult<{ onRequestTrade: ConversationTradingPoolGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onDeleteRequestTrade(callback: (response: QIError | ConversationTradingPool, source: OperationResult<{ onDeleteRequestTrade: ConversationTradingPoolGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; onUpdateRequestTrade(callback: (response: QIError | ConversationTradingPool, source: OperationResult<{ onUpdateRequestTrade: ConversationTradingPoolGraphQL; }, { jwt: string; }>, uuid: string) => void, overrideHandlingUnauthorizedQIError?: boolean): QIError | SubscriptionGarbage; /** Chat shortcut methods */ createConversation(type: "ONE_TO_ONE" | "GROUP", args: CreateConversationOneToOneArgs | CreateConversationGroupArgs, members: Array<User>): Promise<QIError | Conversation>; createPublicConversation(args: CreateConversationOneToOneArgs & { conversationKeys: { conversationAESKey: string; conversationIVKey: string; }; }, overrideHandlingUnauthorizedQIError?: boolean): Promise<QIError | { conversationId: string; conversation: Conversation; }>; /** * Leave the current public conversation * @returns {Promise<void>} */ leaveCurrentPublicConversation(): Promise<void>; /** Chat events methods */ /** * Add a new event and the associated callback. * @param {AuthEvents} event - The event to listen. * @param {Function} callback - The callback related to this event. * @param {boolean} onlyOnce - An optional flag, it allows the adding of only one callback associated to this event. * @returns None */ on(event: ChatEvents, callback: Function, onlyOnce?: boolean): void; /** * Remove an event and the associated callback or all the callbacks associated to that event. * @param {AuthEvents} event - The event to unlisten. * @param {Function} callback - The callback related to this event. * @returns None */ off(event: ChatEvents, callback?: Function): void; /** Override connect() */ connect(force?: boolean): Promise<void>; disconnect(emitEvent?: boolean): void; /** Syncing methods */ /** * Sync the current client with the backend. * @returns {Promise<void>} */ sync(): Promise<void>; /** * Set the syncing time to the time established by the param. * @param ms - Number of milliseconds for the syncing time */ setSyncingTime(ms: number): void; /** * An utility event method that allows the client to track the activity of the Chat object, while it's syncing with the backend. * @param {Function} callback - the callback that will run once the Chat object is syncing with the backend * @returns none */ syncing(callback: (isSyncing: boolean, syncingCounter: number) => void): void; /** * An utility event method that allows the client to track the activity of the Chat object, once it's performed a new sync with the backend. * @param {Function} callback - the callback that will run once the Chat object has performed another sync with the backend * @returns none */ syncUpdate(callback: (syncingCounter: number) => void): void; /** * Unsync the client. * @returns none */ unsync(): Promise<void>; /** * Check if the current Chat object is currently syncing with the backend. * @returns {boolean} isSyncing */ isSyncing(): boolean; /** * Check if user is already participating in a public conversation * @returns {boolean} Whether user is in a public conversation */ isInPublicConversation(): boolean; /** * Get the current public conversation ID * @returns {Maybe<string>} Current public conversation ID or null */ getCurrentPublicConversationId(): Maybe<string>; /** read local database */ fetchLocalDBMessages(conversationId: string, page: number, numberElements: number): Promise<LocalDBMessage[]>; fetchLocalDBConversations(page: number, numberElements: number): Promise<LocalDBConversation[]>; fetchLocalDBConversationsByUserId(userId: string, type: "ONE_TO_ONE" | "GROUP" | "ALL" | undefined, page: number, numberElements: number): Promise<LocalDBConversation[]>; searchTermsOnLocalDB(query: string, options?: Partial<{ conversationId: string; }>): Promise<Array<{ conversation: LocalDBConversation; messages: LocalDBMessage[]; }>>; /** delete operations local database */ softDeleteConversationOnLocalDB(conversationId: string): Promise<void>; truncateTableOnLocalDB(tableName: "message" | "user" | "conversation"): Promise<void>; /** update operations local database */ readMessages(conversationId: string): Promise<void>; /** handling of "ability to chat" based on _canChat, a property that becomes false if the system notices the current user has done another signin in another device */ clientCanChat(): boolean; setCanChat(canChat: boolean): void; /** combining messages (NFT & crypto) */ combineMessages({ initializator, counterparty, messageInitializator, messageCounterparty, }: { initializator: User; counterparty: User; messageInitializator: Message; messageCounterparty: Message; }): Promise<void>; handleOrderFromMessages({ conversationTradingPoolId, status, orderRef, dayDuration, }: { conversationTradingPoolId: string; status: ConversationTradingPoolStatus; orderRef: Order; dayDuration: number; }): Promise<void>; } //# sourceMappingURL=chat.d.ts.map