From e9d90aa0a5cac9987fabfef632a92c8d020b9677 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Mon, 20 Dec 2021 13:58:39 +0530 Subject: [PATCH] fix: remove dup eventemitter --- src/Types/index.ts | 56 +--------------------------------------------- 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/src/Types/index.ts b/src/Types/index.ts index 641bedb..5e91fa3 100644 --- a/src/Types/index.ts +++ b/src/Types/index.ts @@ -8,16 +8,9 @@ export * from './Legacy' export * from './Socket' export * from './Events' -import type EventEmitter from "events" import type NodeCache from 'node-cache' import { AuthenticationState, AuthenticationCreds } from './Auth' -import { Chat, PresenceData } from './Chat' -import { Contact } from './Contact' -import { ConnectionState } from './State' - -import { GroupMetadata, ParticipantAction } from './GroupMetadata' -import { MessageInfoUpdate, MessageUpdateType, WAMessage, WAMessageUpdate, WAMessageKey } from './Message' import { proto } from '../../WAProto' import { CommonSocketConfig } from './Socket' @@ -74,51 +67,4 @@ export type WABusinessProfile = { wid?: string } -export type CurveKeyPair = { private: Uint8Array; public: Uint8Array } - -export type BaileysEventMap = { - /** connection state has been updated -- WS closed, opened, connecting etc. */ - 'connection.update': Partial - /** credentials updated -- some metadata, keys or something */ - 'creds.update': Partial - /** set chats (history sync), messages are reverse chronologically sorted */ - 'chats.set': { chats: Chat[], messages: WAMessage[] } - /** upsert chats */ - 'chats.upsert': Chat[] - /** update the given chats */ - 'chats.update': Partial[] - /** delete chats with given ID */ - 'chats.delete': string[] - /** presence of contact in a chat updated */ - 'presence.update': { id: string, presences: { [participant: string]: PresenceData } } - - 'contacts.upsert': Contact[] - 'contacts.update': Partial[] - - 'messages.delete': { keys: WAMessageKey[] } | { jid: string, all: true } - 'messages.update': WAMessageUpdate[] - /** - * add/update the given messages. If they were received while the connection was online, - * the update will have type: "notify" - * */ - 'messages.upsert': { messages: WAMessage[], type: MessageUpdateType } - - 'message-info.update': MessageInfoUpdate[] - - 'groups.upsert': GroupMetadata[] - 'groups.update': Partial[] - /** apply an action to participants in a group */ - 'group-participants.update': { id: string, participants: string[], action: ParticipantAction } - - 'blocklist.set': { blocklist: string[] } - 'blocklist.update': { blocklist: string[], type: 'add' | 'remove' } -} - -export interface CommonBaileysEventEmitter extends EventEmitter { - on>(event: T, listener: (arg: BaileysEventMap[T]) => void): this - off>(event: T, listener: (arg: BaileysEventMap[T]) => void): this - removeAllListeners>(event: T): this - emit>(event: T, arg: BaileysEventMap[T]): boolean -} - -export type BaileysEventEmitter = CommonBaileysEventEmitter \ No newline at end of file +export type CurveKeyPair = { private: Uint8Array; public: Uint8Array } \ No newline at end of file