@alannxd/baileys 6.0.5 → 6.0.9

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.
Files changed (123) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +341 -286
  3. package/WAProto/WAProto.proto +1782 -359
  4. package/WAProto/index.d.ts +75133 -9893
  5. package/WAProto/index.js +205861 -60606
  6. package/lib/Socket/luxu.js +6 -117
  7. package/lib/Socket/messages-send.js +637 -493
  8. package/lib/Socket/newsletter.js +229 -156
  9. package/lib/Utils/browser-utils.js +26 -6
  10. package/lib/Utils/decode-wa-message.js +33 -0
  11. package/lib/Utils/generics.js +10 -0
  12. package/lib/Utils/index.js +1 -0
  13. package/lib/Utils/message-composer.js +273 -0
  14. package/lib/Utils/messages.js +361 -24
  15. package/lib/WABinary/generic-utils.js +8 -1
  16. package/lib/WABinary/jid-utils.js +2 -0
  17. package/lib/index.js +1 -2
  18. package/package.json +5 -4
  19. package/lib/Defaults/index.d.ts +0 -75
  20. package/lib/Signal/Group/ciphertext-message.d.ts +0 -10
  21. package/lib/Signal/Group/group-session-builder.d.ts +0 -15
  22. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  23. package/lib/Signal/Group/index.d.ts +0 -12
  24. package/lib/Signal/Group/keyhelper.d.ts +0 -11
  25. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  26. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  27. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  28. package/lib/Signal/Group/sender-key-name.d.ts +0 -18
  29. package/lib/Signal/Group/sender-key-record.d.ts +0 -31
  30. package/lib/Signal/Group/sender-key-state.d.ts +0 -39
  31. package/lib/Signal/Group/sender-message-key.d.ts +0 -12
  32. package/lib/Signal/libsignal.d.ts +0 -5
  33. package/lib/Signal/lid-mapping.d.ts +0 -23
  34. package/lib/Socket/Client/index.d.ts +0 -3
  35. package/lib/Socket/Client/types.d.ts +0 -16
  36. package/lib/Socket/Client/websocket.d.ts +0 -13
  37. package/lib/Socket/business.d.ts +0 -217
  38. package/lib/Socket/chats.d.ts +0 -124
  39. package/lib/Socket/communities.d.ts +0 -273
  40. package/lib/Socket/groups.d.ts +0 -162
  41. package/lib/Socket/index.d.ts +0 -260
  42. package/lib/Socket/luxu.d.ts +0 -22
  43. package/lib/Socket/messages-recv.d.ts +0 -213
  44. package/lib/Socket/messages-send.d.ts +0 -199
  45. package/lib/Socket/mex.d.ts +0 -3
  46. package/lib/Socket/newsletter.d.ts +0 -170
  47. package/lib/Socket/socket.d.ts +0 -59
  48. package/lib/Store/index.d.ts +0 -10
  49. package/lib/Store/keyed-db.d.ts +0 -22
  50. package/lib/Store/make-cache-manager-store.d.ts +0 -19
  51. package/lib/Store/make-in-memory-store.d.ts +0 -39
  52. package/lib/Store/make-ordered-dictionary.d.ts +0 -14
  53. package/lib/Store/object-repository.d.ts +0 -11
  54. package/lib/Types/Auth.d.ts +0 -117
  55. package/lib/Types/Bussines.d.ts +0 -25
  56. package/lib/Types/Call.d.ts +0 -15
  57. package/lib/Types/Chat.d.ts +0 -124
  58. package/lib/Types/Contact.d.ts +0 -26
  59. package/lib/Types/Events.d.ts +0 -256
  60. package/lib/Types/GroupMetadata.d.ts +0 -71
  61. package/lib/Types/Label.d.ts +0 -47
  62. package/lib/Types/LabelAssociation.d.ts +0 -30
  63. package/lib/Types/Message.d.ts +0 -320
  64. package/lib/Types/Mex.d.ts +0 -141
  65. package/lib/Types/Product.d.ts +0 -79
  66. package/lib/Types/Signal.d.ts +0 -87
  67. package/lib/Types/Socket.d.ts +0 -136
  68. package/lib/Types/State.d.ts +0 -97
  69. package/lib/Types/USync.d.ts +0 -26
  70. package/lib/Types/index.d.ts +0 -65
  71. package/lib/Utils/auth-utils.d.ts +0 -24
  72. package/lib/Utils/browser-utils.d.ts +0 -4
  73. package/lib/Utils/business.d.ts +0 -23
  74. package/lib/Utils/chat-utils.d.ts +0 -100
  75. package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
  76. package/lib/Utils/crypto.d.ts +0 -37
  77. package/lib/Utils/decode-wa-message.d.ts +0 -66
  78. package/lib/Utils/event-buffer.d.ts +0 -36
  79. package/lib/Utils/generics.d.ts +0 -91
  80. package/lib/Utils/history.d.ts +0 -24
  81. package/lib/Utils/identity-change-handler.d.ts +0 -44
  82. package/lib/Utils/index.d.ts +0 -22
  83. package/lib/Utils/link-preview.d.ts +0 -21
  84. package/lib/Utils/logger.d.ts +0 -12
  85. package/lib/Utils/lt-hash.d.ts +0 -8
  86. package/lib/Utils/make-mutex.d.ts +0 -9
  87. package/lib/Utils/message-retry-manager.d.ts +0 -115
  88. package/lib/Utils/messages-media.d.ts +0 -133
  89. package/lib/Utils/messages.d.ts +0 -91
  90. package/lib/Utils/noise-handler.d.ts +0 -20
  91. package/lib/Utils/offline-node-processor.d.ts +0 -17
  92. package/lib/Utils/pre-key-manager.d.ts +0 -28
  93. package/lib/Utils/process-message.d.ts +0 -60
  94. package/lib/Utils/reporting-utils.d.ts +0 -11
  95. package/lib/Utils/signal.d.ts +0 -47
  96. package/lib/Utils/stanza-ack.d.ts +0 -11
  97. package/lib/Utils/sync-action-utils.d.ts +0 -19
  98. package/lib/Utils/tc-token-utils.d.ts +0 -37
  99. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  100. package/lib/Utils/validate-connection.d.ts +0 -11
  101. package/lib/WABinary/constants.d.ts +0 -28
  102. package/lib/WABinary/decode.d.ts +0 -7
  103. package/lib/WABinary/encode.d.ts +0 -3
  104. package/lib/WABinary/generic-utils.d.ts +0 -18
  105. package/lib/WABinary/index.d.ts +0 -6
  106. package/lib/WABinary/jid-utils.d.ts +0 -48
  107. package/lib/WABinary/types.d.ts +0 -19
  108. package/lib/WAM/BinaryInfo.d.ts +0 -9
  109. package/lib/WAM/constants.d.ts +0 -40
  110. package/lib/WAM/encode.d.ts +0 -3
  111. package/lib/WAM/index.d.ts +0 -4
  112. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
  113. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -23
  114. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -13
  115. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -13
  116. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
  117. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -26
  118. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -10
  119. package/lib/WAUSync/Protocols/index.d.ts +0 -6
  120. package/lib/WAUSync/USyncQuery.d.ts +0 -30
  121. package/lib/WAUSync/USyncUser.d.ts +0 -17
  122. package/lib/WAUSync/index.d.ts +0 -4
  123. package/lib/index.d.ts +0 -13
@@ -1,59 +0,0 @@
1
- import { Boom } from '@hapi/boom';
2
- import { type NewChatMessageCapInfo, type ReachoutTimelockState, type SocketConfig } from '../Types/index.js';
3
- import { type BinaryNode } from '../WABinary/index.js';
4
- import { BinaryInfo } from '../WAM/BinaryInfo.js';
5
- import { USyncQuery } from '../WAUSync/index.js';
6
- import { WebSocketClient } from './Client/index.js';
7
- /**
8
- * Connects to WA servers and performs:
9
- * - simple queries (no retry mechanism, wait for connection establishment)
10
- * - listen to messages and emit events
11
- * - query phone connection
12
- */
13
- export declare const makeSocket: (config: SocketConfig) => {
14
- type: "md";
15
- ws: WebSocketClient;
16
- ev: import("../Types/index.js").BaileysEventEmitter & {
17
- process(handler: (events: Partial<import("../Types/index.js").BaileysEventMap>) => void | Promise<void>): () => void;
18
- buffer(): void;
19
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
20
- flush(): boolean;
21
- isBuffering(): boolean;
22
- destroy(): void;
23
- };
24
- authState: {
25
- creds: import("../Types/index.js").AuthenticationCreds;
26
- keys: import("../Types/index.js").SignalKeyStoreWithTransaction;
27
- };
28
- signalRepository: import("../Types/index.js").SignalRepositoryWithLIDStore;
29
- readonly user: import("../Types/index.js").Contact | undefined;
30
- generateMessageTag: () => string;
31
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
32
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
33
- waitForSocketOpen: () => Promise<void>;
34
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
35
- sendNode: (frame: BinaryNode) => Promise<void>;
36
- logout: (msg?: string) => Promise<void>;
37
- end: (error: Error | undefined) => Promise<void>;
38
- registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
39
- onUnexpectedError: (err: Error | Boom, msg: string) => void;
40
- uploadPreKeys: (count?: number) => Promise<void>;
41
- uploadPreKeysToServerIfRequired: () => Promise<void>;
42
- digestKeyBundle: () => Promise<void>;
43
- rotateSignedPreKey: () => Promise<void>;
44
- requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
45
- updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
46
- sendUnifiedSession: () => Promise<void>;
47
- wamBuffer: BinaryInfo;
48
- /** Waits for the connection to WA to reach a state */
49
- waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
50
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
51
- executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
52
- onWhatsApp: (...phoneNumber: string[]) => Promise<{
53
- jid: string;
54
- exists: boolean;
55
- }[] | undefined>;
56
- fetchAccountReachoutTimelock: () => Promise<ReachoutTimelockState>;
57
- fetchNewChatMessageCap: () => Promise<NewChatMessageCapInfo>;
58
- };
59
- //# sourceMappingURL=socket.d.ts.map
@@ -1,10 +0,0 @@
1
- export * from './make-cache-manager-store';
2
- export * from './make-in-memory-store';
3
- export * from './make-ordered-dictionary';
4
- export * from './object-repository';
5
- export * from './keyed-db
6
- export { default as makeCacheManagerStore } from './make-cache-manager-store';
7
- export { default as makeInMemoryStore } from './make-in-memory-store';
8
- export { default as makeOrderedDictionary } from './make-ordered-dictionary';
9
- export { default as objectRepository } from './object-repository';
10
- export { default as keyedDB} from './keyed-db';
@@ -1,22 +0,0 @@
1
- declare class KeyedDB<T> {
2
- private _compare: (a: string, b: string) => number;
3
- private _idGetter: (item: T) => string;
4
- private _array: T[];
5
- private _dict: { [id: string]: T };
6
- constructor(compareFn: (a: string, b: string) => number, idGetter: (item: T) => string);
7
- get length(): number;
8
- get(id: string): T | undefined;
9
- insert(entry: T, mode?: 'insert'): boolean;
10
- insertIfAbsent(...entries: T[]): T[];
11
- upsert(...entries: T[]): T[];
12
- update(id: string, updater: (item: T) => void): boolean;
13
- updateAssign(id: string, update: Partial<T>): boolean;
14
- deleteById(id: string): boolean;
15
- clear(): void;
16
- all(): T[];
17
- filter(predicate: (item: T) => boolean): void;
18
- count(): number;
19
- toJSON(): T[];
20
- fromJSON(array: T[]): void;
21
- }
22
- export default KeyedDB;
@@ -1,19 +0,0 @@
1
- import { Store } from 'cache-manager';
2
- import { proto as WAProto } from '../../WAProto';
3
-
4
- interface AuthState {
5
- clearState: () => Promise<void>;
6
- saveCreds: () => Promise<void>;
7
- state: {
8
- creds: any;
9
- keys: {
10
- get: (type: string, ids: string[]) => Promise<{ [id: string]: any }>;
11
- set: (data: { [category: string]: { [id: string]: any } }) => Promise<void>;
12
- };
13
- };
14
- }
15
-
16
- declare function makeCacheManagerAuthState(store: Store, sessionKey: string): Promise<AuthState>;
17
-
18
- export default makeCacheManagerAuthState;
19
- export { makeCacheManagerAuthState };
@@ -1,39 +0,0 @@
1
- import { proto as WAProto } from '../../WAProto';
2
- import { LabelAssociationType } from '../Types/LabelAssociation';
3
-
4
- interface StoreConfig {
5
- socket: any;
6
- chatKey?: any;
7
- labelAssociationKey?: any;
8
- logger?: any;
9
- }
10
-
11
- interface Store {
12
- chats: any;
13
- contacts: any;
14
- messages: any;
15
- groupMetadata: any;
16
- state: any;
17
- presences: any;
18
- labels: any;
19
- labelAssociations: any;
20
- bind: (ev: any) => void;
21
- loadMessages: (jid: string, count: number, cursor: any) => Promise<any[]>;
22
- getLabels: () => any[];
23
- getChatLabels: (chatId: string) => any[];
24
- getMessageLabels: (messageId: string) => any[];
25
- loadMessage: (jid: string, id: string) => Promise<any>;
26
- mostRecentMessage: (jid: string) => Promise<any>;
27
- fetchImageUrl: (jid: string, sock: any) => Promise<string | undefined>;
28
- fetchGroupMetadata: (jid: string, sock: any) => Promise<any>;
29
- fetchMessageReceipts: (opts: { remoteJid: string; id: string }) => Promise<any[] | undefined>;
30
- toJSON: () => any;
31
- fromJSON: (json: any) => void;
32
- writeToFile: (path: string) => void;
33
- readFromFile: (path: string) => void;
34
- }
35
-
36
- declare function makeStore(config: StoreConfig): Store;
37
-
38
- export default makeStore;
39
- export { makeStore, waChatKey, waMessageID, waLabelAssociationKey };
@@ -1,14 +0,0 @@
1
- declare function makeOrderedDictionary<T>(idGetter: (item: T) => string): {
2
- array: T[];
3
- get: (id: string) => T | undefined;
4
- upsert: (item: T, mode: 'append' | 'prepend') => void;
5
- update: (item: T) => boolean;
6
- remove: (item: T) => boolean;
7
- updateAssign: (id: string, update: Partial<T>) => boolean;
8
- clear: () => void;
9
- filter: (contain: (item: T) => boolean) => void;
10
- toJSON: () => T[];
11
- fromJSON: (newItems: T[]) => void;
12
- };
13
- export default makeOrderedDictionary;
14
- export { makeOrderedDictionary };
@@ -1,11 +0,0 @@
1
- declare class ObjectRepository<T> {
2
- private entityMap: Map<string, T>;
3
- constructor(entities?: { [id: string]: T });
4
- findById(id: string): T | undefined;
5
- findAll(): T[];
6
- upsertById(id: string, entity: T): Map<string, T>;
7
- deleteById(id: string): boolean;
8
- count(): number;
9
- toJSON(): T[];
10
- }
11
- export { ObjectRepository };
@@ -1,117 +0,0 @@
1
- import type { proto } from '../../WAProto/index.js';
2
- import type { Contact } from './Contact.js';
3
- import type { MinimalMessage } from './Message.js';
4
- export type KeyPair = {
5
- public: Uint8Array;
6
- private: Uint8Array;
7
- };
8
- export type SignedKeyPair = {
9
- keyPair: KeyPair;
10
- signature: Uint8Array;
11
- keyId: number;
12
- timestampS?: number;
13
- };
14
- export type ProtocolAddress = {
15
- name: string;
16
- deviceId: number;
17
- };
18
- export type SignalIdentity = {
19
- identifier: ProtocolAddress;
20
- identifierKey: Uint8Array;
21
- };
22
- export type LIDMapping = {
23
- pn: string;
24
- lid: string;
25
- };
26
- export type LTHashState = {
27
- version: number;
28
- hash: Buffer;
29
- indexValueMap: {
30
- [indexMacBase64: string]: {
31
- valueMac: Uint8Array | Buffer;
32
- };
33
- };
34
- };
35
- export type SignalCreds = {
36
- readonly signedIdentityKey: KeyPair;
37
- readonly signedPreKey: SignedKeyPair;
38
- readonly registrationId: number;
39
- };
40
- export type AccountSettings = {
41
- /** unarchive chats when a new message is received */
42
- unarchiveChats: boolean;
43
- /** the default mode to start new conversations with */
44
- defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>;
45
- };
46
- export type AuthenticationCreds = SignalCreds & {
47
- readonly noiseKey: KeyPair;
48
- readonly pairingEphemeralKeyPair: KeyPair;
49
- advSecretKey: string;
50
- me?: Contact;
51
- account?: proto.IADVSignedDeviceIdentity;
52
- signalIdentities?: SignalIdentity[];
53
- myAppStateKeyId?: string;
54
- firstUnuploadedPreKeyId: number;
55
- nextPreKeyId: number;
56
- lastAccountSyncTimestamp?: number;
57
- platform?: string;
58
- processedHistoryMessages: MinimalMessage[];
59
- /** number of times history & app state has been synced */
60
- accountSyncCounter: number;
61
- accountSettings: AccountSettings;
62
- registered: boolean;
63
- pairingCode: string | undefined;
64
- lastPropHash: string | undefined;
65
- routingInfo: Buffer | undefined;
66
- additionalData?: any | undefined;
67
- };
68
- export type SignalDataTypeMap = {
69
- 'pre-key': KeyPair;
70
- session: Uint8Array;
71
- 'sender-key': Uint8Array;
72
- 'sender-key-memory': {
73
- [jid: string]: boolean;
74
- };
75
- 'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
76
- 'app-state-sync-version': LTHashState;
77
- 'lid-mapping': string;
78
- 'device-list': string[];
79
- tctoken: {
80
- token: Buffer;
81
- timestamp?: string;
82
- senderTimestamp?: number;
83
- };
84
- 'identity-key': Uint8Array;
85
- };
86
- export type SignalDataSet = {
87
- [T in keyof SignalDataTypeMap]?: {
88
- [id: string]: SignalDataTypeMap[T] | null;
89
- };
90
- };
91
- type Awaitable<T> = T | Promise<T>;
92
- export type SignalKeyStore = {
93
- get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
94
- [id: string]: SignalDataTypeMap[T];
95
- }>;
96
- set(data: SignalDataSet): Awaitable<void>;
97
- /** clear all the data in the store */
98
- clear?(): Awaitable<void>;
99
- };
100
- export type SignalKeyStoreWithTransaction = SignalKeyStore & {
101
- isInTransaction: () => boolean;
102
- transaction<T>(exec: () => Promise<T>, key: string): Promise<T>;
103
- };
104
- export type TransactionCapabilityOptions = {
105
- maxCommitRetries: number;
106
- delayBetweenTriesMs: number;
107
- };
108
- export type SignalAuthState = {
109
- creds: SignalCreds;
110
- keys: SignalKeyStore | SignalKeyStoreWithTransaction;
111
- };
112
- export type AuthenticationState = {
113
- creds: AuthenticationCreds;
114
- keys: SignalKeyStore;
115
- };
116
- export {};
117
- //# sourceMappingURL=Auth.d.ts.map
@@ -1,25 +0,0 @@
1
- import type { proto } from '../../WAProto';
2
- export type DayOfWeekBussines = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
3
- export type HoursDay = {
4
- day: DayOfWeekBussines;
5
- mode: 'specific_hours';
6
- openTimeInMinutes: string;
7
- closeTimeInMinutes: string;
8
- } | {
9
- day: DayOfWeekBussines;
10
- mode: 'open_24h' | 'appointment_only';
11
- };
12
- export type UpdateBussinesProfileProps = {
13
- address?: string;
14
- websites?: string[];
15
- email?: string;
16
- description?: string;
17
- hours?: {
18
- timezone: string;
19
- days: HoursDay[];
20
- };
21
- };
22
- export type QuickReplyAction = proto.SyncActionValue.IQuickReplyAction & {
23
- timestamp?: string;
24
- };
25
- //# sourceMappingURL=Bussines.d.ts.map
@@ -1,15 +0,0 @@
1
- export type WACallUpdateType = 'offer' | 'ringing' | 'preaccept' | 'transport' | 'relaylatency' | 'timeout' | 'reject' | 'accept' | 'terminate';
2
- export type WACallEvent = {
3
- chatId: string;
4
- from: string;
5
- callerPn?: string;
6
- isGroup?: boolean;
7
- groupJid?: string;
8
- id: string;
9
- date: Date;
10
- isVideo?: boolean;
11
- status: WACallUpdateType;
12
- offline: boolean;
13
- latencyMs?: number;
14
- };
15
- //# sourceMappingURL=Call.d.ts.map
@@ -1,124 +0,0 @@
1
- import type { proto } from '../../WAProto/index.js';
2
- import type { AccountSettings } from './Auth.js';
3
- import type { QuickReplyAction } from './Bussines.js';
4
- import type { BufferedEventData } from './Events.js';
5
- import type { LabelActionBody } from './Label.js';
6
- import type { ChatLabelAssociationActionBody } from './LabelAssociation.js';
7
- import type { MessageLabelAssociationActionBody } from './LabelAssociation.js';
8
- import type { MinimalMessage, WAMessageKey } from './Message.js';
9
- /** privacy settings in WhatsApp Web */
10
- export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
11
- export type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
12
- export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist';
13
- export type WAReadReceiptsValue = 'all' | 'none';
14
- export type WAPrivacyCallValue = 'all' | 'known';
15
- export type WAPrivacyMessagesValue = 'all' | 'contacts';
16
- /** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
17
- export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
18
- export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"];
19
- export type WAPatchName = (typeof ALL_WA_PATCH_NAMES)[number];
20
- export interface PresenceData {
21
- lastKnownPresence: WAPresence;
22
- lastSeen?: number;
23
- groupOnlineCount?: number;
24
- }
25
- export type BotListInfo = {
26
- jid: string;
27
- personaId: string;
28
- };
29
- export type ChatMutation = {
30
- syncAction: proto.ISyncActionData;
31
- index: string[];
32
- };
33
- export type WAPatchCreate = {
34
- syncAction: proto.ISyncActionValue;
35
- index: string[];
36
- type: WAPatchName;
37
- apiVersion: number;
38
- operation: proto.SyncdMutation.SyncdOperation;
39
- };
40
- export type Chat = proto.IConversation & {
41
- /** unix timestamp of when the last message was received in the chat */
42
- lastMessageRecvTimestamp?: number;
43
- };
44
- export type ChatUpdate = Partial<Chat & {
45
- /**
46
- * if specified in the update,
47
- * the EV buffer will check if the condition gets fulfilled before applying the update
48
- * Right now, used to determine when to release an app state sync event
49
- *
50
- * @returns true, if the update should be applied;
51
- * false if it can be discarded;
52
- * undefined if the condition is not yet fulfilled
53
- * */
54
- conditional: (bufferedData: BufferedEventData) => boolean | undefined;
55
- /** last update time */
56
- timestamp?: number;
57
- }>;
58
- /**
59
- * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
60
- * for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat
61
- * */
62
- export type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange;
63
- export type ChatModification = {
64
- archive: boolean;
65
- lastMessages: LastMessageList;
66
- } | {
67
- pushNameSetting: string;
68
- } | {
69
- pin: boolean;
70
- } | {
71
- /** mute for duration, or provide timestamp of mute to remove*/
72
- mute: number | null;
73
- } | {
74
- clear: boolean;
75
- lastMessages: LastMessageList;
76
- } | {
77
- deleteForMe: {
78
- deleteMedia: boolean;
79
- key: WAMessageKey;
80
- timestamp: number;
81
- };
82
- } | {
83
- star: {
84
- messages: {
85
- id: string;
86
- fromMe?: boolean;
87
- }[];
88
- star: boolean;
89
- };
90
- } | {
91
- markRead: boolean;
92
- lastMessages: LastMessageList;
93
- } | {
94
- delete: true;
95
- lastMessages: LastMessageList;
96
- } | {
97
- contact: proto.SyncActionValue.IContactAction | null;
98
- } | {
99
- disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
100
- } | {
101
- addLabel: LabelActionBody;
102
- } | {
103
- addChatLabel: ChatLabelAssociationActionBody;
104
- } | {
105
- removeChatLabel: ChatLabelAssociationActionBody;
106
- } | {
107
- addMessageLabel: MessageLabelAssociationActionBody;
108
- } | {
109
- removeMessageLabel: MessageLabelAssociationActionBody;
110
- } | {
111
- quickReply: QuickReplyAction;
112
- };
113
- export type InitialReceivedChatsState = {
114
- [jid: string]: {
115
- /** the last message received from the other party */
116
- lastMsgRecvTimestamp?: number;
117
- /** the absolute last message in the chat */
118
- lastMsgTimestamp: number;
119
- };
120
- };
121
- export type InitialAppStateSyncOptions = {
122
- accountSettings: AccountSettings;
123
- };
124
- //# sourceMappingURL=Chat.d.ts.map
@@ -1,26 +0,0 @@
1
- export interface Contact {
2
- /** ID either in lid or jid format (preferred) **/
3
- id: string;
4
- /** ID in LID format (@lid) **/
5
- lid?: string;
6
- /** ID in PN format (@s.whatsapp.net) **/
7
- phoneNumber?: string;
8
- /** name of the contact, you have saved on your WA */
9
- name?: string;
10
- /** name of the contact, the contact has set on their own on WA */
11
- notify?: string;
12
- /** username associated with this contact, when provided by WA */
13
- username?: string;
14
- /** I have no idea */
15
- verifiedName?: string;
16
- /**
17
- * Url of the profile picture of the contact
18
- *
19
- * 'changed' => if the profile picture has changed
20
- * null => if the profile picture has not been set (default profile picture)
21
- * any other string => url of the profile picture
22
- */
23
- imgUrl?: string | null;
24
- status?: string;
25
- }
26
- //# sourceMappingURL=Contact.d.ts.map