project: Move to ESM Modules

This commit is contained in:
Rajeh Taher
2025-07-17 13:54:17 +03:00
parent 19124426b2
commit 787aed88b8
69 changed files with 5143 additions and 4757 deletions
+10 -9
View File
@@ -1,15 +1,16 @@
import type { Boom } from '@hapi/boom'
import { proto } from '../../WAProto'
import { AuthenticationCreds } from './Auth'
import { WACallEvent } from './Call'
import { Chat, ChatUpdate, PresenceData } from './Chat'
import { Contact } from './Contact'
import { GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod } from './GroupMetadata'
import { Label } from './Label'
import { LabelAssociation } from './LabelAssociation'
import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message'
import { ConnectionState } from './State'
import type { AuthenticationCreds } from './Auth'
import type { WACallEvent } from './Call'
import type { Chat, ChatUpdate, PresenceData } from './Chat'
import type { Contact } from './Contact'
import type { GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod } from './GroupMetadata'
import type { Label } from './Label'
import type { LabelAssociation } from './LabelAssociation'
import type { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message'
import type { ConnectionState } from './State'
// TODO: refactor this mess
export type BaileysEventMap = {
/** connection state has been updated -- WS closed, opened, connecting etc. */
'connection.update': Partial<ConnectionState>
+1 -1
View File
@@ -1,4 +1,4 @@
import { Contact } from './Contact'
import type { Contact } from './Contact'
export type GroupParticipant = Contact & {
isAdmin?: boolean
+4 -4
View File
@@ -1,11 +1,11 @@
import { AxiosRequestConfig } from 'axios'
import type { AxiosRequestConfig } from 'axios'
import type { Readable } from 'stream'
import type { URL } from 'url'
import { proto } from '../../WAProto'
import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults'
import { BinaryNode } from '../WABinary'
import type { BinaryNode } from '../WABinary'
import type { GroupMetadata } from './GroupMetadata'
import { CacheStore } from './Socket'
import type { CacheStore } from './Socket'
// export the WAMessage Prototypes
export { proto as WAProto }
@@ -32,7 +32,7 @@ export type WAGenericMediaMessage =
| proto.Message.IStickerMessage
export const WAMessageStubType = proto.WebMessageInfo.StubType
export const WAMessageStatus = proto.WebMessageInfo.Status
import { ILogger } from '../Utils/logger'
import type { ILogger } from '../Utils/logger'
export type WAMediaPayloadURL = { url: URL | string }
export type WAMediaPayloadStream = { stream: Readable }
export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL
+1 -1
View File
@@ -1,4 +1,4 @@
import { WAMediaUpload } from './Message'
import type { WAMediaUpload } from './Message'
export type CatalogResult = {
data: {
+6 -6
View File
@@ -1,12 +1,12 @@
import { AxiosRequestConfig } from 'axios'
import type { AxiosRequestConfig } from 'axios'
import type { Agent } from 'https'
import type { URL } from 'url'
import { proto } from '../../WAProto'
import { ILogger } from '../Utils/logger'
import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth'
import { GroupMetadata } from './GroupMetadata'
import { MediaConnInfo } from './Message'
import { SignalRepository } from './Signal'
import type { ILogger } from '../Utils/logger'
import type { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth'
import type { GroupMetadata } from './GroupMetadata'
import { type MediaConnInfo } from './Message'
import type { SignalRepository } from './Signal'
export type WAVersion = [number, number, number]
export type WABrowserDescription = [string, string, string]
+5 -2
View File
@@ -1,13 +1,16 @@
import { Contact } from './Contact'
import { Boom } from '@hapi/boom'
import type { Contact } from './Contact'
export type WAConnectionState = 'open' | 'connecting' | 'close'
export type ConnectionState = {
/** connection is now open, connecting or closed */
connection: WAConnectionState
/** the error that caused the connection to close */
lastDisconnect?: {
error: Error | undefined
// TODO: refactor and gain independence from Boom
error: Boom | Error | undefined
date: Date
}
/** is this a new login */
+1 -1
View File
@@ -1,4 +1,4 @@
import { BinaryNode } from '../WABinary'
import type { BinaryNode } from '../WABinary'
import { USyncUser } from '../WAUSync'
/**
+2 -2
View File
@@ -11,8 +11,8 @@ export * from './Call'
export * from './Signal'
export * from './Newsletter'
import { AuthenticationState } from './Auth'
import { SocketConfig } from './Socket'
import type { AuthenticationState } from './Auth'
import type { SocketConfig } from './Socket'
export type UserFacingSocketConfig = Partial<SocketConfig> & { auth: AuthenticationState }