@alannxd/baileys 6.0.5 → 6.0.6

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 (234) hide show
  1. package/WAProto/fix-import.js +29 -0
  2. package/WAProto/index.js +160 -201
  3. package/engine-requirements.js +1 -1
  4. package/lib/Defaults/baileys-version.json +3 -0
  5. package/lib/Defaults/index.d.ts +15 -37
  6. package/lib/Defaults/index.js +136 -119
  7. package/lib/Defaults/phonenumber-mcc.json +223 -0
  8. package/lib/Signal/Group/ciphertext-message.d.ts +0 -1
  9. package/lib/Signal/Group/ciphertext-message.js +5 -2
  10. package/lib/Signal/Group/group-session-builder.d.ts +3 -4
  11. package/lib/Signal/Group/group-session-builder.js +41 -7
  12. package/lib/Signal/Group/group_cipher.d.ts +4 -4
  13. package/lib/Signal/Group/group_cipher.js +51 -37
  14. package/lib/Signal/Group/index.d.ts +11 -12
  15. package/lib/Signal/Group/index.js +57 -12
  16. package/lib/Signal/Group/keyhelper.d.ts +1 -2
  17. package/lib/Signal/Group/keyhelper.js +44 -7
  18. package/lib/Signal/Group/queue-job.d.ts +1 -0
  19. package/lib/Signal/Group/queue-job.js +57 -0
  20. package/lib/Signal/Group/sender-chain-key.d.ts +2 -3
  21. package/lib/Signal/Group/sender-chain-key.js +15 -7
  22. package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -2
  23. package/lib/Signal/Group/sender-key-distribution-message.js +11 -8
  24. package/lib/Signal/Group/sender-key-message.d.ts +1 -2
  25. package/lib/Signal/Group/sender-key-message.js +12 -9
  26. package/lib/Signal/Group/sender-key-name.d.ts +0 -1
  27. package/lib/Signal/Group/sender-key-name.js +5 -2
  28. package/lib/Signal/Group/sender-key-record.d.ts +2 -3
  29. package/lib/Signal/Group/sender-key-record.js +21 -9
  30. package/lib/Signal/Group/sender-key-state.d.ts +6 -7
  31. package/lib/Signal/Group/sender-key-state.js +42 -27
  32. package/lib/Signal/Group/sender-message-key.d.ts +0 -1
  33. package/lib/Signal/Group/sender-message-key.js +7 -4
  34. package/lib/Signal/libsignal.d.ts +3 -5
  35. package/lib/Signal/libsignal.js +90 -347
  36. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +5 -4
  37. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  38. package/lib/Socket/Client/index.d.ts +3 -3
  39. package/lib/Socket/Client/index.js +19 -3
  40. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  41. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  42. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +2 -3
  43. package/lib/Socket/Client/web-socket-client.js +62 -0
  44. package/lib/Socket/business.d.ts +108 -154
  45. package/lib/Socket/business.js +43 -162
  46. package/lib/Socket/chats.d.ts +239 -96
  47. package/lib/Socket/chats.js +427 -627
  48. package/lib/Socket/communities.d.ts +146 -239
  49. package/lib/Socket/communities.js +80 -90
  50. package/lib/Socket/groups.d.ts +57 -104
  51. package/lib/Socket/groups.js +161 -154
  52. package/lib/Socket/index.d.ts +115 -202
  53. package/lib/Socket/index.js +10 -11
  54. package/lib/Socket/luxu.d.ts +266 -22
  55. package/lib/Socket/luxu.js +465 -422
  56. package/lib/Socket/messages-recv.d.ts +84 -136
  57. package/lib/Socket/messages-recv.js +615 -1421
  58. package/lib/Socket/messages-send.d.ts +126 -142
  59. package/lib/Socket/messages-send.js +671 -878
  60. package/lib/Socket/newsletter.d.ts +85 -121
  61. package/lib/Socket/newsletter.js +272 -147
  62. package/lib/Socket/registration.d.ts +267 -0
  63. package/lib/Socket/registration.js +166 -0
  64. package/lib/Socket/socket.d.ts +19 -34
  65. package/lib/Socket/socket.js +313 -544
  66. package/lib/Socket/usync.d.ts +36 -0
  67. package/lib/Socket/usync.js +70 -0
  68. package/lib/Store/index.d.ts +3 -10
  69. package/lib/Store/index.js +10 -10
  70. package/lib/Store/make-cache-manager-store.d.ts +11 -17
  71. package/lib/Store/make-cache-manager-store.js +41 -43
  72. package/lib/Store/make-in-memory-store.d.ts +118 -39
  73. package/lib/Store/make-in-memory-store.js +341 -112
  74. package/lib/Store/make-ordered-dictionary.d.ts +10 -11
  75. package/lib/Store/make-ordered-dictionary.js +20 -14
  76. package/lib/Store/object-repository.d.ts +9 -10
  77. package/lib/Store/object-repository.js +6 -11
  78. package/lib/Types/Auth.d.ts +12 -19
  79. package/lib/Types/Auth.js +2 -2
  80. package/lib/Types/Call.d.ts +1 -3
  81. package/lib/Types/Call.js +2 -2
  82. package/lib/Types/Chat.d.ts +13 -35
  83. package/lib/Types/Chat.js +4 -8
  84. package/lib/Types/Contact.d.ts +1 -8
  85. package/lib/Types/Contact.js +2 -2
  86. package/lib/Types/Events.d.ts +17 -116
  87. package/lib/Types/Events.js +2 -2
  88. package/lib/Types/GroupMetadata.d.ts +5 -21
  89. package/lib/Types/GroupMetadata.js +2 -2
  90. package/lib/Types/Label.d.ts +0 -12
  91. package/lib/Types/Label.js +5 -3
  92. package/lib/Types/LabelAssociation.d.ts +0 -1
  93. package/lib/Types/LabelAssociation.js +5 -3
  94. package/lib/Types/Message.d.ts +58 -105
  95. package/lib/Types/Message.js +9 -11
  96. package/lib/Types/Newsletter.d.ts +103 -0
  97. package/lib/Types/Newsletter.js +38 -0
  98. package/lib/Types/Product.d.ts +1 -2
  99. package/lib/Types/Product.js +2 -2
  100. package/lib/Types/Signal.d.ts +2 -32
  101. package/lib/Types/Signal.js +2 -2
  102. package/lib/Types/Socket.d.ts +25 -50
  103. package/lib/Types/Socket.js +2 -3
  104. package/lib/Types/State.d.ts +2 -72
  105. package/lib/Types/State.js +2 -56
  106. package/lib/Types/USync.d.ts +2 -3
  107. package/lib/Types/USync.js +2 -2
  108. package/lib/Types/index.d.ts +14 -22
  109. package/lib/Types/index.js +31 -15
  110. package/lib/Utils/auth-utils.d.ts +6 -12
  111. package/lib/Utils/auth-utils.js +143 -239
  112. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  113. package/lib/Utils/baileys-event-stream.js +63 -0
  114. package/lib/Utils/business.d.ts +2 -3
  115. package/lib/Utils/business.js +69 -66
  116. package/lib/Utils/chat-utils.d.ts +23 -52
  117. package/lib/Utils/chat-utils.js +253 -396
  118. package/lib/Utils/crypto.d.ts +22 -18
  119. package/lib/Utils/crypto.js +90 -57
  120. package/lib/Utils/decode-wa-message.d.ts +8 -55
  121. package/lib/Utils/decode-wa-message.js +84 -203
  122. package/lib/Utils/event-buffer.d.ts +8 -9
  123. package/lib/Utils/event-buffer.js +77 -185
  124. package/lib/Utils/generics.d.ts +29 -28
  125. package/lib/Utils/generics.js +210 -180
  126. package/lib/Utils/history.d.ts +9 -18
  127. package/lib/Utils/history.js +55 -93
  128. package/lib/Utils/index.d.ts +17 -22
  129. package/lib/Utils/index.js +33 -22
  130. package/lib/Utils/link-preview.d.ts +5 -5
  131. package/lib/Utils/link-preview.js +24 -16
  132. package/lib/Utils/logger.d.ts +3 -11
  133. package/lib/Utils/logger.js +7 -3
  134. package/lib/Utils/lt-hash.d.ts +12 -8
  135. package/lib/Utils/lt-hash.js +46 -3
  136. package/lib/Utils/make-mutex.d.ts +2 -4
  137. package/lib/Utils/make-mutex.js +34 -24
  138. package/lib/Utils/messages-media.d.ts +44 -61
  139. package/lib/Utils/messages-media.js +482 -451
  140. package/lib/Utils/messages.d.ts +18 -32
  141. package/lib/Utils/messages.js +369 -458
  142. package/lib/Utils/noise-handler.d.ts +14 -13
  143. package/lib/Utils/noise-handler.js +99 -145
  144. package/lib/Utils/process-message.d.ts +12 -31
  145. package/lib/Utils/process-message.js +150 -459
  146. package/lib/Utils/signal.d.ts +5 -20
  147. package/lib/Utils/signal.js +72 -120
  148. package/lib/Utils/use-multi-file-auth-state.d.ts +2 -2
  149. package/lib/Utils/use-multi-file-auth-state.js +27 -29
  150. package/lib/Utils/validate-connection.d.ts +7 -7
  151. package/lib/Utils/validate-connection.js +99 -73
  152. package/lib/WABinary/constants.d.ts +27 -25
  153. package/lib/WABinary/constants.js +20 -1281
  154. package/lib/WABinary/decode.d.ts +5 -5
  155. package/lib/WABinary/decode.js +42 -52
  156. package/lib/WABinary/encode.d.ts +3 -3
  157. package/lib/WABinary/encode.js +155 -110
  158. package/lib/WABinary/generic-utils.d.ts +7 -8
  159. package/lib/WABinary/generic-utils.js +49 -48
  160. package/lib/WABinary/index.d.ts +5 -6
  161. package/lib/WABinary/index.js +21 -6
  162. package/lib/WABinary/jid-utils.d.ts +8 -25
  163. package/lib/WABinary/jid-utils.js +40 -74
  164. package/lib/WABinary/types.d.ts +1 -2
  165. package/lib/WABinary/types.js +2 -2
  166. package/lib/WAM/BinaryInfo.d.ts +11 -3
  167. package/lib/WAM/BinaryInfo.js +5 -2
  168. package/lib/WAM/constants.d.ts +3 -5
  169. package/lib/WAM/constants.js +11958 -19461
  170. package/lib/WAM/encode.d.ts +3 -3
  171. package/lib/WAM/encode.js +22 -17
  172. package/lib/WAM/index.d.ts +3 -4
  173. package/lib/WAM/index.js +19 -4
  174. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
  175. package/lib/WAUSync/Protocols/USyncContactProtocol.js +13 -33
  176. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
  177. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +14 -11
  178. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
  179. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -9
  180. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
  181. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +13 -9
  182. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
  183. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +22 -20
  184. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -5
  185. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +8 -13
  186. package/lib/WAUSync/Protocols/index.d.ts +4 -6
  187. package/lib/WAUSync/Protocols/index.js +20 -6
  188. package/lib/WAUSync/USyncQuery.d.ts +4 -6
  189. package/lib/WAUSync/USyncQuery.js +35 -44
  190. package/lib/WAUSync/USyncUser.d.ts +5 -10
  191. package/lib/WAUSync/USyncUser.js +5 -10
  192. package/lib/WAUSync/index.js +19 -4
  193. package/lib/index.d.ts +9 -10
  194. package/lib/index.js +34 -12
  195. package/package.json +50 -83
  196. package/WAProto/GenerateStatics.sh +0 -3
  197. package/WAProto/WAProto.proto +0 -5479
  198. package/WAProto/fix-imports.js +0 -85
  199. package/WAProto/index.d.ts +0 -14017
  200. package/lib/Signal/lid-mapping.d.ts +0 -23
  201. package/lib/Signal/lid-mapping.js +0 -277
  202. package/lib/Socket/Client/types.js +0 -11
  203. package/lib/Socket/Client/websocket.js +0 -54
  204. package/lib/Socket/mex.d.ts +0 -3
  205. package/lib/Socket/mex.js +0 -42
  206. package/lib/Store/keyed-db.d.ts +0 -22
  207. package/lib/Store/keyed-db.js +0 -108
  208. package/lib/Types/Bussines.d.ts +0 -25
  209. package/lib/Types/Bussines.js +0 -2
  210. package/lib/Types/Mex.d.ts +0 -141
  211. package/lib/Types/Mex.js +0 -37
  212. package/lib/Utils/browser-utils.d.ts +0 -4
  213. package/lib/Utils/browser-utils.js +0 -28
  214. package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
  215. package/lib/Utils/companion-reg-client-utils.js +0 -35
  216. package/lib/Utils/identity-change-handler.d.ts +0 -44
  217. package/lib/Utils/identity-change-handler.js +0 -50
  218. package/lib/Utils/message-retry-manager.d.ts +0 -115
  219. package/lib/Utils/message-retry-manager.js +0 -265
  220. package/lib/Utils/offline-node-processor.d.ts +0 -17
  221. package/lib/Utils/offline-node-processor.js +0 -40
  222. package/lib/Utils/pre-key-manager.d.ts +0 -28
  223. package/lib/Utils/pre-key-manager.js +0 -106
  224. package/lib/Utils/reporting-utils.d.ts +0 -11
  225. package/lib/Utils/reporting-utils.js +0 -258
  226. package/lib/Utils/stanza-ack.d.ts +0 -11
  227. package/lib/Utils/stanza-ack.js +0 -38
  228. package/lib/Utils/sync-action-utils.d.ts +0 -19
  229. package/lib/Utils/sync-action-utils.js +0 -49
  230. package/lib/Utils/tc-token-utils.d.ts +0 -37
  231. package/lib/Utils/tc-token-utils.js +0 -163
  232. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
  233. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -25
  234. package/lib/WAUSync/index.d.ts +0 -4
@@ -1,32 +1,27 @@
1
- export class ObjectRepository {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectRepository = void 0;
4
+ class ObjectRepository {
2
5
  constructor(entities = {}) {
3
6
  this.entityMap = new Map(Object.entries(entities));
4
7
  }
5
-
6
8
  findById(id) {
7
9
  return this.entityMap.get(id);
8
10
  }
9
-
10
11
  findAll() {
11
12
  return Array.from(this.entityMap.values());
12
13
  }
13
-
14
14
  upsertById(id, entity) {
15
- this.entityMap.set(id, { ...entity });
16
- return this;
15
+ return this.entityMap.set(id, { ...entity });
17
16
  }
18
-
19
17
  deleteById(id) {
20
18
  return this.entityMap.delete(id);
21
19
  }
22
-
23
20
  count() {
24
21
  return this.entityMap.size;
25
22
  }
26
-
27
23
  toJSON() {
28
24
  return this.findAll();
29
25
  }
30
26
  }
31
-
32
- export default ObjectRepository;
27
+ exports.ObjectRepository = ObjectRepository;
@@ -1,6 +1,8 @@
1
- import type { proto } from '../../WAProto/index.js';
2
- import type { Contact } from './Contact.js';
3
- import type { MinimalMessage } from './Message.js';
1
+ /// <reference types="node" />
2
+ import type { proto } from '../../WAProto';
3
+ import { RegistrationOptions } from '../Socket/registration';
4
+ import type { Contact } from './Contact';
5
+ import type { MinimalMessage } from './Message';
4
6
  export type KeyPair = {
5
7
  public: Uint8Array;
6
8
  private: Uint8Array;
@@ -19,10 +21,6 @@ export type SignalIdentity = {
19
21
  identifier: ProtocolAddress;
20
22
  identifierKey: Uint8Array;
21
23
  };
22
- export type LIDMapping = {
23
- pn: string;
24
- lid: string;
25
- };
26
24
  export type LTHashState = {
27
25
  version: number;
28
26
  hash: Buffer;
@@ -59,29 +57,25 @@ export type AuthenticationCreds = SignalCreds & {
59
57
  /** number of times history & app state has been synced */
60
58
  accountSyncCounter: number;
61
59
  accountSettings: AccountSettings;
60
+ deviceId: string;
61
+ phoneId: string;
62
+ identityId: Buffer;
62
63
  registered: boolean;
64
+ backupToken: Buffer;
65
+ registration: RegistrationOptions;
63
66
  pairingCode: string | undefined;
64
67
  lastPropHash: string | undefined;
65
68
  routingInfo: Buffer | undefined;
66
- additionalData?: any | undefined;
67
69
  };
68
70
  export type SignalDataTypeMap = {
69
71
  'pre-key': KeyPair;
70
- session: Uint8Array;
72
+ 'session': Uint8Array;
71
73
  'sender-key': Uint8Array;
72
74
  'sender-key-memory': {
73
75
  [jid: string]: boolean;
74
76
  };
75
77
  'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
76
78
  '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
79
  };
86
80
  export type SignalDataSet = {
87
81
  [T in keyof SignalDataTypeMap]?: {
@@ -99,7 +93,7 @@ export type SignalKeyStore = {
99
93
  };
100
94
  export type SignalKeyStoreWithTransaction = SignalKeyStore & {
101
95
  isInTransaction: () => boolean;
102
- transaction<T>(exec: () => Promise<T>, key: string): Promise<T>;
96
+ transaction<T>(exec: () => Promise<T>): Promise<T>;
103
97
  };
104
98
  export type TransactionCapabilityOptions = {
105
99
  maxCommitRetries: number;
@@ -114,4 +108,3 @@ export type AuthenticationState = {
114
108
  keys: SignalKeyStore;
115
109
  };
116
110
  export {};
117
- //# sourceMappingURL=Auth.d.ts.map
package/lib/Types/Auth.js CHANGED
@@ -1,2 +1,2 @@
1
- export {};
2
- //# sourceMappingURL=Auth.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,7 @@
1
- export type WACallUpdateType = 'offer' | 'ringing' | 'preaccept' | 'transport' | 'relaylatency' | 'timeout' | 'reject' | 'accept' | 'terminate';
1
+ export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept';
2
2
  export type WACallEvent = {
3
3
  chatId: string;
4
4
  from: string;
5
- callerPn?: string;
6
5
  isGroup?: boolean;
7
6
  groupJid?: string;
8
7
  id: string;
@@ -12,4 +11,3 @@ export type WACallEvent = {
12
11
  offline: boolean;
13
12
  latencyMs?: number;
14
13
  };
15
- //# sourceMappingURL=Call.d.ts.map
package/lib/Types/Call.js CHANGED
@@ -1,2 +1,2 @@
1
- export {};
2
- //# sourceMappingURL=Call.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,31 +1,21 @@
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';
1
+ import type { proto } from '../../WAProto';
2
+ import type { AccountSettings } from './Auth';
3
+ import type { BufferedEventData } from './Events';
4
+ import type { ChatLabelAssociationActionBody } from './LabelAssociation';
5
+ import type { MessageLabelAssociationActionBody } from './LabelAssociation';
6
+ import type { MinimalMessage } from './Message';
9
7
  /** privacy settings in WhatsApp Web */
10
8
  export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
11
9
  export type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
12
- export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist';
13
10
  export type WAReadReceiptsValue = 'all' | 'none';
14
- export type WAPrivacyCallValue = 'all' | 'known';
15
- export type WAPrivacyMessagesValue = 'all' | 'contacts';
16
11
  /** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
17
12
  export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
18
13
  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];
14
+ export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number];
20
15
  export interface PresenceData {
21
16
  lastKnownPresence: WAPresence;
22
17
  lastSeen?: number;
23
- groupOnlineCount?: number;
24
18
  }
25
- export type BotListInfo = {
26
- jid: string;
27
- personaId: string;
28
- };
29
19
  export type ChatMutation = {
30
20
  syncAction: proto.ISyncActionData;
31
21
  index: string[];
@@ -52,8 +42,6 @@ export type ChatUpdate = Partial<Chat & {
52
42
  * undefined if the condition is not yet fulfilled
53
43
  * */
54
44
  conditional: (bufferedData: BufferedEventData) => boolean | undefined;
55
- /** last update time */
56
- timestamp?: number;
57
45
  }>;
58
46
  /**
59
47
  * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
@@ -71,13 +59,12 @@ export type ChatModification = {
71
59
  /** mute for duration, or provide timestamp of mute to remove*/
72
60
  mute: number | null;
73
61
  } | {
74
- clear: boolean;
75
- lastMessages: LastMessageList;
76
- } | {
77
- deleteForMe: {
78
- deleteMedia: boolean;
79
- key: WAMessageKey;
80
- timestamp: number;
62
+ clear: 'all' | {
63
+ messages: {
64
+ id: string;
65
+ fromMe?: boolean;
66
+ timestamp: number;
67
+ }[];
81
68
  };
82
69
  } | {
83
70
  star: {
@@ -93,12 +80,6 @@ export type ChatModification = {
93
80
  } | {
94
81
  delete: true;
95
82
  lastMessages: LastMessageList;
96
- } | {
97
- contact: proto.SyncActionValue.IContactAction | null;
98
- } | {
99
- disableLinkPreviews: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
100
- } | {
101
- addLabel: LabelActionBody;
102
83
  } | {
103
84
  addChatLabel: ChatLabelAssociationActionBody;
104
85
  } | {
@@ -107,8 +88,6 @@ export type ChatModification = {
107
88
  addMessageLabel: MessageLabelAssociationActionBody;
108
89
  } | {
109
90
  removeMessageLabel: MessageLabelAssociationActionBody;
110
- } | {
111
- quickReply: QuickReplyAction;
112
91
  };
113
92
  export type InitialReceivedChatsState = {
114
93
  [jid: string]: {
@@ -121,4 +100,3 @@ export type InitialReceivedChatsState = {
121
100
  export type InitialAppStateSyncOptions = {
122
101
  accountSettings: AccountSettings;
123
102
  };
124
- //# sourceMappingURL=Chat.d.ts.map
package/lib/Types/Chat.js CHANGED
@@ -1,8 +1,4 @@
1
- export const ALL_WA_PATCH_NAMES = [
2
- 'critical_block',
3
- 'critical_unblock_low',
4
- 'regular_high',
5
- 'regular_low',
6
- 'regular'
7
- ];
8
- //# sourceMappingURL=Chat.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ALL_WA_PATCH_NAMES = void 0;
4
+ exports.ALL_WA_PATCH_NAMES = ['critical_block', 'critical_unblock_low', 'regular_high', 'regular_low', 'regular'];
@@ -1,16 +1,10 @@
1
1
  export interface Contact {
2
- /** ID either in lid or jid format (preferred) **/
3
2
  id: string;
4
- /** ID in LID format (@lid) **/
5
3
  lid?: string;
6
- /** ID in PN format (@s.whatsapp.net) **/
7
- phoneNumber?: string;
8
4
  /** name of the contact, you have saved on your WA */
9
5
  name?: string;
10
6
  /** name of the contact, the contact has set on their own on WA */
11
7
  notify?: string;
12
- /** username associated with this contact, when provided by WA */
13
- username?: string;
14
8
  /** I have no idea */
15
9
  verifiedName?: string;
16
10
  /**
@@ -20,7 +14,6 @@ export interface Contact {
20
14
  * null => if the profile picture has not been set (default profile picture)
21
15
  * any other string => url of the profile picture
22
16
  */
23
- imgUrl?: string | null;
17
+ imgUrl?: string | null | 'changed';
24
18
  status?: string;
25
19
  }
26
- //# sourceMappingURL=Contact.d.ts.map
@@ -1,2 +1,2 @@
1
- export {};
2
- //# sourceMappingURL=Contact.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +1,14 @@
1
1
  import type { Boom } from '@hapi/boom';
2
- import { proto } from '../../WAProto/index.js';
3
- import type { AuthenticationCreds, LIDMapping } from './Auth.js';
4
- import type { WACallEvent } from './Call.js';
5
- import type { Chat, ChatUpdate, PresenceData } from './Chat.js';
6
- import type { Contact } from './Contact.js';
7
- import type { GroupMetadata, GroupParticipant, ParticipantAction, RequestJoinAction, RequestJoinMethod } from './GroupMetadata.js';
8
- import type { Label } from './Label.js';
9
- import type { LabelAssociation } from './LabelAssociation.js';
10
- import type { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message.js';
11
- import type { ConnectionState, NewChatMessageCapInfo } from './State.js';
2
+ import { proto } from '../../WAProto';
3
+ import { AuthenticationCreds } from './Auth';
4
+ import { WACallEvent } from './Call';
5
+ import { Chat, ChatUpdate, PresenceData } from './Chat';
6
+ import { Contact } from './Contact';
7
+ import { GroupMetadata, ParticipantAction } from './GroupMetadata';
8
+ import { Label } from './Label';
9
+ import { LabelAssociation } from './LabelAssociation';
10
+ import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message';
11
+ import { ConnectionState } from './State';
12
12
  export type BaileysEventMap = {
13
13
  /** connection state has been updated -- WS closed, opened, connecting etc. */
14
14
  'connection.update': Partial<ConnectionState>;
@@ -19,31 +19,16 @@ export type BaileysEventMap = {
19
19
  chats: Chat[];
20
20
  contacts: Contact[];
21
21
  messages: WAMessage[];
22
- lidPnMappings?: LIDMapping[];
23
- isLatest?: boolean;
24
- progress?: number | null;
25
- syncType?: proto.HistorySync.HistorySyncType | null;
26
- pastParticipants?: proto.IPastParticipants[] | null;
27
- chunkOrder?: number | null;
28
- peerDataRequestSessionId?: string | null;
29
- };
30
- /** signals history sync milestones (completion or stall) per sync type */
31
- 'messaging-history.status': {
32
- /** which sync phase this status refers to */
33
- syncType: proto.HistorySync.HistorySyncType;
34
- /** the status of this sync phase */
35
- status: 'complete' | 'paused';
36
- /**
37
- * progress === 100 was received from the server.
38
- * when false, completion was inferred via timeout (no more chunks arriving).
39
- */
40
- explicit: boolean;
22
+ isLatest: boolean;
41
23
  };
42
24
  /** upsert chats */
43
25
  'chats.upsert': Chat[];
44
26
  /** update the given chats */
45
27
  'chats.update': ChatUpdate[];
46
- 'lid-mapping.update': LIDMapping;
28
+ 'chats.phoneNumberShare': {
29
+ lid: string;
30
+ jid: string;
31
+ };
47
32
  /** delete chats with given ID */
48
33
  'chats.delete': string[];
49
34
  /** presence of contact in a chat updated */
@@ -73,12 +58,10 @@ export type BaileysEventMap = {
73
58
  /**
74
59
  * add/update the given messages. If they were received while the connection was online,
75
60
  * the update will have type: "notify"
76
- * if requestId is provided, then the messages was received from the phone due to it being unavailable
77
61
  * */
78
62
  'messages.upsert': {
79
63
  messages: WAMessage[];
80
64
  type: MessageUpsertType;
81
- requestId?: string;
82
65
  };
83
66
  /** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
84
67
  'messages.reaction': {
@@ -92,28 +75,9 @@ export type BaileysEventMap = {
92
75
  'group-participants.update': {
93
76
  id: string;
94
77
  author: string;
95
- authorPn?: string;
96
- authorUsername?: string;
97
- participants: GroupParticipant[];
78
+ participants: string[];
98
79
  action: ParticipantAction;
99
80
  };
100
- 'group.join-request': {
101
- id: string;
102
- author: string;
103
- authorPn?: string;
104
- authorUsername?: string;
105
- participant: string;
106
- participantPn?: string;
107
- action: RequestJoinAction;
108
- method: RequestJoinMethod;
109
- };
110
- 'group.member-tag.update': {
111
- groupId: string;
112
- participant: string;
113
- participantAlt?: string;
114
- label: string;
115
- messageTimestamp?: number;
116
- };
117
81
  'blocklist.set': {
118
82
  blocklist: string[];
119
83
  };
@@ -122,69 +86,12 @@ export type BaileysEventMap = {
122
86
  type: 'add' | 'remove';
123
87
  };
124
88
  /** Receive an update on a call, including when the call was received, rejected, accepted */
125
- call: WACallEvent[];
89
+ 'call': WACallEvent[];
126
90
  'labels.edit': Label;
127
91
  'labels.association': {
128
92
  association: LabelAssociation;
129
93
  type: 'add' | 'remove';
130
94
  };
131
- /** Newsletter-related events */
132
- 'newsletter.reaction': {
133
- id: string;
134
- server_id: string;
135
- reaction: {
136
- code?: string;
137
- count?: number;
138
- removed?: boolean;
139
- };
140
- };
141
- 'newsletter.view': {
142
- id: string;
143
- server_id: string;
144
- count: number;
145
- };
146
- 'newsletter-participants.update': {
147
- id: string;
148
- author: string;
149
- user: string;
150
- new_role: string;
151
- action: string;
152
- };
153
- 'newsletter-settings.update': {
154
- id: string;
155
- update: any;
156
- };
157
- 'message-capping.update': NewChatMessageCapInfo;
158
- /** Settings and actions sync events */
159
- 'chats.lock': {
160
- id: string;
161
- locked: boolean;
162
- };
163
- 'settings.update': {
164
- setting: 'unarchiveChats';
165
- value: boolean;
166
- } | {
167
- setting: 'locale';
168
- value: string;
169
- } | {
170
- setting: 'disableLinkPreviews';
171
- value: proto.SyncActionValue.IPrivacySettingDisableLinkPreviewsAction;
172
- } | {
173
- setting: 'timeFormat';
174
- value: proto.SyncActionValue.ITimeFormatAction;
175
- } | {
176
- setting: 'privacySettingRelayAllCalls';
177
- value: proto.SyncActionValue.IPrivacySettingRelayAllCalls;
178
- } | {
179
- setting: 'statusPrivacy';
180
- value: proto.SyncActionValue.IStatusPrivacyAction;
181
- } | {
182
- setting: 'notificationActivitySetting';
183
- value: proto.SyncActionValue.NotificationActivitySettingAction.NotificationActivitySetting;
184
- } | {
185
- setting: 'channelsPersonalisedRecommendation';
186
- value: proto.SyncActionValue.IPrivacySettingChannelsPersonalisedRecommendationAction;
187
- };
188
95
  };
189
96
  export type BufferedEventData = {
190
97
  historySets: {
@@ -199,11 +106,6 @@ export type BufferedEventData = {
199
106
  };
200
107
  empty: boolean;
201
108
  isLatest: boolean;
202
- progress?: number | null;
203
- syncType?: proto.HistorySync.HistorySyncType;
204
- pastParticipants?: proto.IPastParticipants[];
205
- chunkOrder?: number | null;
206
- peerDataRequestSessionId?: string;
207
109
  };
208
110
  chatUpserts: {
209
111
  [jid: string]: Chat;
@@ -253,4 +155,3 @@ export interface BaileysEventEmitter {
253
155
  removeAllListeners<T extends keyof BaileysEventMap>(event: T): void;
254
156
  emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
255
157
  }
256
- //# sourceMappingURL=Events.d.ts.map
@@ -1,2 +1,2 @@
1
- import { proto } from '../../WAProto/index.js';
2
- //# sourceMappingURL=Events.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,36 +1,23 @@
1
- import type { Contact } from './Contact.js';
2
- import type { WAMessageAddressingMode } from './Message.js';
3
- export type GroupParticipant = Contact & {
1
+ import { Contact } from './Contact';
2
+ export type GroupParticipant = (Contact & {
4
3
  isAdmin?: boolean;
5
4
  isSuperAdmin?: boolean;
6
5
  admin?: 'admin' | 'superadmin' | null;
7
- };
8
- export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify';
9
- export type RequestJoinAction = 'created' | 'revoked' | 'rejected';
10
- export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined;
6
+ });
7
+ export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote';
11
8
  export interface GroupMetadata {
12
9
  id: string;
13
- notify?: string;
14
- /** group uses 'lid' or 'pn' to send messages */
15
- addressingMode?: WAMessageAddressingMode;
16
10
  owner: string | undefined;
17
- ownerPn?: string | undefined;
18
- ownerUsername?: string | undefined;
19
- owner_country_code?: string | undefined;
20
11
  subject: string;
12
+ addressingMode: "pn" | "lid";
21
13
  /** group subject owner */
22
14
  subjectOwner?: string;
23
- subjectOwnerPn?: string;
24
- subjectOwnerUsername?: string;
25
15
  /** group subject modification date */
26
16
  subjectTime?: number;
27
17
  creation?: number;
28
18
  desc?: string;
29
19
  descOwner?: string;
30
- descOwnerPn?: string;
31
- descOwnerUsername?: string;
32
20
  descId?: string;
33
- descTime?: number;
34
21
  /** if this group is part of a community, it returns the jid of the community to which it belongs */
35
22
  linkedParent?: string;
36
23
  /** is set when the group only allows admins to change group settings */
@@ -52,8 +39,6 @@ export interface GroupMetadata {
52
39
  inviteCode?: string;
53
40
  /** the person who added you to group or changed some setting in group */
54
41
  author?: string;
55
- authorPn?: string;
56
- authorUsername?: string;
57
42
  }
58
43
  export interface WAGroupCreateResponse {
59
44
  status: number;
@@ -68,4 +53,3 @@ export interface GroupModificationResponse {
68
53
  [key: string]: {};
69
54
  };
70
55
  }
71
- //# sourceMappingURL=GroupMetadata.d.ts.map
@@ -1,2 +1,2 @@
1
- export {};
2
- //# sourceMappingURL=GroupMetadata.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -10,17 +10,6 @@ export interface Label {
10
10
  /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
11
11
  predefinedId?: string;
12
12
  }
13
- export interface LabelActionBody {
14
- id: string;
15
- /** Label name */
16
- name?: string;
17
- /** Label color ID */
18
- color?: number;
19
- /** Is label has been deleted */
20
- deleted?: boolean;
21
- /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
22
- predefinedId?: number;
23
- }
24
13
  /** WhatsApp has 20 predefined colors */
25
14
  export declare enum LabelColor {
26
15
  Color1 = 0,
@@ -44,4 +33,3 @@ export declare enum LabelColor {
44
33
  Color19 = 18,
45
34
  Color20 = 19
46
35
  }
47
- //# sourceMappingURL=Label.d.ts.map
@@ -1,5 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LabelColor = void 0;
1
4
  /** WhatsApp has 20 predefined colors */
2
- export var LabelColor;
5
+ var LabelColor;
3
6
  (function (LabelColor) {
4
7
  LabelColor[LabelColor["Color1"] = 0] = "Color1";
5
8
  LabelColor[LabelColor["Color2"] = 1] = "Color2";
@@ -21,5 +24,4 @@ export var LabelColor;
21
24
  LabelColor[LabelColor["Color18"] = 17] = "Color18";
22
25
  LabelColor[LabelColor["Color19"] = 18] = "Color19";
23
26
  LabelColor[LabelColor["Color20"] = 19] = "Color20";
24
- })(LabelColor || (LabelColor = {}));
25
- //# sourceMappingURL=Label.js.map
27
+ })(LabelColor = exports.LabelColor || (exports.LabelColor = {}));
@@ -27,4 +27,3 @@ export interface MessageLabelAssociationActionBody {
27
27
  labelId: string;
28
28
  messageId: string;
29
29
  }
30
- //# sourceMappingURL=LabelAssociation.d.ts.map
@@ -1,7 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LabelAssociationType = void 0;
1
4
  /** Association type */
2
- export var LabelAssociationType;
5
+ var LabelAssociationType;
3
6
  (function (LabelAssociationType) {
4
7
  LabelAssociationType["Chat"] = "label_jid";
5
8
  LabelAssociationType["Message"] = "label_message";
6
- })(LabelAssociationType || (LabelAssociationType = {}));
7
- //# sourceMappingURL=LabelAssociation.js.map
9
+ })(LabelAssociationType = exports.LabelAssociationType || (exports.LabelAssociationType = {}));