@pontalabs/baileys 1.0.6 → 1.0.7

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 (185) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +839 -267
  3. package/WAProto/GenerateStatics.sh +4 -3
  4. package/WAProto/WAProto.proto +511 -1215
  5. package/WAProto/index.d.ts +55 -14017
  6. package/WAProto/index.js +29 -97689
  7. package/lib/Defaults/index.d.ts +74 -72
  8. package/lib/Defaults/index.js +108 -94
  9. package/lib/Signal/Group/ciphertext-message.d.ts +7 -8
  10. package/lib/Signal/Group/ciphertext-message.js +16 -9
  11. package/lib/Signal/Group/group-session-builder.d.ts +13 -11
  12. package/lib/Signal/Group/group-session-builder.js +61 -19
  13. package/lib/Signal/Group/group_cipher.d.ts +16 -14
  14. package/lib/Signal/Group/group_cipher.js +70 -41
  15. package/lib/Signal/Group/index.d.ts +11 -12
  16. package/lib/Signal/Group/index.js +61 -12
  17. package/lib/Signal/Group/keyhelper.d.ts +14 -9
  18. package/lib/Signal/Group/keyhelper.js +58 -10
  19. package/lib/Signal/Group/sender-chain-key.d.ts +13 -13
  20. package/lib/Signal/Group/sender-chain-key.js +34 -13
  21. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -16
  22. package/lib/Signal/Group/sender-key-distribution-message.js +36 -28
  23. package/lib/Signal/Group/sender-key-message.d.ts +18 -18
  24. package/lib/Signal/Group/sender-key-message.js +45 -38
  25. package/lib/Signal/Group/sender-key-name.d.ts +15 -14
  26. package/lib/Signal/Group/sender-key-name.js +31 -20
  27. package/lib/Signal/Group/sender-key-record.d.ts +25 -24
  28. package/lib/Signal/Group/sender-key-record.js +35 -18
  29. package/lib/Signal/Group/sender-key-state.d.ts +34 -29
  30. package/lib/Signal/Group/sender-key-state.js +100 -37
  31. package/lib/Signal/Group/sender-message-key.d.ts +10 -11
  32. package/lib/Signal/Group/sender-message-key.js +22 -15
  33. package/lib/Signal/libsignal.d.ts +8 -5
  34. package/lib/Signal/libsignal.js +142 -288
  35. package/lib/Signal/lid-mapping.d.ts +28 -23
  36. package/lib/Signal/lid-mapping.js +184 -277
  37. package/lib/Socket/Client/index.d.ts +2 -3
  38. package/lib/Socket/Client/index.js +22 -3
  39. package/lib/Socket/Client/types.d.ts +15 -15
  40. package/lib/Socket/Client/types.js +15 -8
  41. package/lib/Socket/Client/websocket.d.ts +12 -12
  42. package/lib/Socket/Client/websocket.js +37 -29
  43. package/lib/Socket/business.d.ts +178 -208
  44. package/lib/Socket/business.js +127 -91
  45. package/lib/Socket/chats.d.ts +93 -120
  46. package/lib/Socket/chats.js +652 -727
  47. package/lib/Socket/community.js +10 -2
  48. package/lib/Socket/groups.d.ts +111 -143
  49. package/lib/Socket/groups.js +186 -165
  50. package/lib/Socket/index.d.ts +183 -252
  51. package/lib/Socket/index.js +18 -38
  52. package/lib/Socket/messages-recv.d.ts +167 -196
  53. package/lib/Socket/messages-recv.js +1567 -1443
  54. package/lib/Socket/messages-send.d.ts +158 -192
  55. package/lib/Socket/messages-send.js +1208 -1102
  56. package/lib/Socket/newsletter.d.ts +138 -163
  57. package/lib/Socket/newsletter.js +249 -153
  58. package/lib/Socket/socket.d.ts +36 -50
  59. package/lib/Socket/socket.js +820 -749
  60. package/lib/Store/index.d.ts +4 -4
  61. package/lib/Store/index.js +24 -4
  62. package/lib/Store/make-in-memory-store.d.ts +104 -44
  63. package/lib/Store/make-in-memory-store.js +213 -199
  64. package/lib/Store/make-ordered-dictionary.d.ts +12 -13
  65. package/lib/Store/make-ordered-dictionary.js +45 -38
  66. package/lib/Store/object-repository.d.ts +10 -11
  67. package/lib/Store/object-repository.js +16 -9
  68. package/lib/Types/Auth.d.ts +97 -93
  69. package/lib/Types/Auth.js +3 -2
  70. package/lib/Types/Bussines.js +3 -2
  71. package/lib/Types/Call.d.ts +13 -14
  72. package/lib/Types/Call.js +3 -2
  73. package/lib/Types/Chat.d.ts +97 -78
  74. package/lib/Types/Chat.js +9 -8
  75. package/lib/Types/Contact.d.ts +9 -12
  76. package/lib/Types/Contact.js +3 -2
  77. package/lib/Types/Events.d.ts +176 -206
  78. package/lib/Types/Events.js +3 -2
  79. package/lib/Types/GroupMetadata.d.ts +48 -53
  80. package/lib/Types/GroupMetadata.js +3 -2
  81. package/lib/Types/Label.d.ts +14 -13
  82. package/lib/Types/Label.js +30 -24
  83. package/lib/Types/LabelAssociation.d.ts +20 -15
  84. package/lib/Types/LabelAssociation.js +12 -6
  85. package/lib/Types/Message.d.ts +412 -248
  86. package/lib/Types/Message.js +19 -17
  87. package/lib/Types/Product.d.ts +71 -58
  88. package/lib/Types/Product.js +3 -2
  89. package/lib/Types/Signal.d.ts +82 -71
  90. package/lib/Types/Signal.js +3 -2
  91. package/lib/Types/Socket.d.ts +81 -76
  92. package/lib/Types/Socket.js +3 -3
  93. package/lib/Types/State.d.ts +19 -75
  94. package/lib/Types/State.js +14 -56
  95. package/lib/Types/USync.d.ts +8 -8
  96. package/lib/Types/USync.js +3 -2
  97. package/lib/Types/index.d.ts +62 -47
  98. package/lib/Types/index.js +50 -26
  99. package/lib/Utils/auth-utils.d.ts +10 -13
  100. package/lib/Utils/auth-utils.js +472 -213
  101. package/lib/Utils/business.d.ts +20 -14
  102. package/lib/Utils/business.js +134 -110
  103. package/lib/Utils/chat-utils.d.ts +70 -88
  104. package/lib/Utils/chat-utils.js +403 -466
  105. package/lib/Utils/crypto.d.ts +46 -27
  106. package/lib/Utils/crypto.js +188 -117
  107. package/lib/Utils/decode-wa-message.d.ts +45 -58
  108. package/lib/Utils/decode-wa-message.js +311 -212
  109. package/lib/Utils/event-buffer.d.ts +17 -14
  110. package/lib/Utils/event-buffer.js +296 -321
  111. package/lib/Utils/generics.d.ts +92 -66
  112. package/lib/Utils/generics.js +436 -270
  113. package/lib/Utils/history.d.ts +23 -24
  114. package/lib/Utils/history.js +76 -106
  115. package/lib/Utils/index.d.ts +21 -24
  116. package/lib/Utils/index.js +41 -24
  117. package/lib/Utils/link-preview.d.ts +14 -12
  118. package/lib/Utils/link-preview.js +75 -40
  119. package/lib/Utils/logger.d.ts +11 -10
  120. package/lib/Utils/logger.js +7 -3
  121. package/lib/Utils/lt-hash.d.ts +14 -8
  122. package/lib/Utils/lt-hash.js +53 -3
  123. package/lib/Utils/make-mutex.d.ts +7 -7
  124. package/lib/Utils/make-mutex.js +44 -28
  125. package/lib/Utils/message-retry-manager.d.ts +88 -115
  126. package/lib/Utils/message-retry-manager.js +160 -265
  127. package/lib/Utils/messages-media.d.ts +107 -105
  128. package/lib/Utils/messages-media.js +619 -548
  129. package/lib/Utils/messages.d.ts +66 -52
  130. package/lib/Utils/messages.js +1558 -1730
  131. package/lib/Utils/noise-handler.d.ts +18 -18
  132. package/lib/Utils/noise-handler.js +130 -176
  133. package/lib/Utils/process-message.d.ts +32 -43
  134. package/lib/Utils/process-message.js +282 -484
  135. package/lib/Utils/rich-message-utils.js +724 -1220
  136. package/lib/Utils/signal.d.ts +32 -37
  137. package/lib/Utils/signal.js +105 -140
  138. package/lib/Utils/use-multi-file-auth-state.d.ts +5 -5
  139. package/lib/Utils/use-multi-file-auth-state.js +120 -70
  140. package/lib/Utils/use-single-file-auth-state.d.ts +13 -11
  141. package/lib/Utils/use-single-file-auth-state.js +66 -92
  142. package/lib/Utils/validate-connection.d.ts +13 -11
  143. package/lib/Utils/validate-connection.js +113 -128
  144. package/lib/WABinary/constants.d.ts +27 -25
  145. package/lib/WABinary/constants.js +1292 -1451
  146. package/lib/WABinary/decode.d.ts +9 -7
  147. package/lib/WABinary/decode.js +189 -163
  148. package/lib/WABinary/encode.d.ts +3 -3
  149. package/lib/WABinary/encode.js +155 -110
  150. package/lib/WABinary/generic-utils.d.ts +27 -14
  151. package/lib/WABinary/generic-utils.js +105 -177
  152. package/lib/WABinary/index.d.ts +5 -6
  153. package/lib/WABinary/index.js +25 -6
  154. package/lib/WABinary/jid-utils.d.ts +54 -41
  155. package/lib/WABinary/jid-utils.js +152 -83
  156. package/lib/WABinary/types.d.ts +13 -10
  157. package/lib/WABinary/types.js +3 -2
  158. package/lib/WAM/BinaryInfo.d.ts +15 -8
  159. package/lib/WAM/BinaryInfo.js +14 -7
  160. package/lib/WAM/constants.d.ts +37 -30
  161. package/lib/WAM/constants.js +11983 -19465
  162. package/lib/WAM/encode.d.ts +3 -3
  163. package/lib/WAM/encode.js +109 -95
  164. package/lib/WAM/index.d.ts +3 -4
  165. package/lib/WAM/index.js +23 -4
  166. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
  167. package/lib/WAUSync/Protocols/USyncContactProtocol.js +21 -37
  168. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -19
  169. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +26 -18
  170. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -11
  171. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +20 -12
  172. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -11
  173. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +24 -16
  174. package/lib/WAUSync/Protocols/index.d.ts +6 -6
  175. package/lib/WAUSync/Protocols/index.js +26 -6
  176. package/lib/WAUSync/USyncQuery.d.ts +28 -27
  177. package/lib/WAUSync/USyncQuery.js +62 -68
  178. package/lib/WAUSync/USyncUser.d.ts +10 -15
  179. package/lib/WAUSync/USyncUser.js +19 -20
  180. package/lib/WAUSync/index.d.ts +3 -4
  181. package/lib/WAUSync/index.js +23 -4
  182. package/lib/index.d.ts +12 -11
  183. package/lib/index.js +39 -12
  184. package/package.json +42 -86
  185. package/engine-requirements.js +0 -10
@@ -1,256 +1,226 @@
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';
1
+ import type { Boom } from '@hapi/boom'
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, RequestJoinAction, RequestJoinMethod } from './GroupMetadata'
8
+ import { Label } from './Label'
9
+ import { LabelAssociation } from './LabelAssociation'
10
+ import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message'
11
+ import { NewsletterViewRole, SubscriberAction, NewsletterSettingsUpdate } from './Newsletter'
12
+ import { ConnectionState } from './State'
13
+
12
14
  export type BaileysEventMap = {
13
15
  /** connection state has been updated -- WS closed, opened, connecting etc. */
14
- 'connection.update': Partial<ConnectionState>;
16
+ 'connection.update': Partial<ConnectionState>
15
17
  /** credentials updated -- some metadata, keys or something */
16
- 'creds.update': Partial<AuthenticationCreds>;
18
+ 'creds.update': Partial<AuthenticationCreds>
17
19
  /** set chats (history sync), everything is reverse chronologically sorted */
18
20
  'messaging-history.set': {
19
- chats: Chat[];
20
- contacts: Contact[];
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;
41
- };
21
+ chats: Chat[]
22
+ contacts: Contact[]
23
+ messages: WAMessage[]
24
+ isLatest?: boolean
25
+ progress?: number | null
26
+ syncType?: proto.HistorySync.HistorySyncType
27
+ peerDataRequestSessionId?: string | null
28
+ }
42
29
  /** upsert chats */
43
- 'chats.upsert': Chat[];
30
+ 'chats.upsert': Chat[]
44
31
  /** update the given chats */
45
- 'chats.update': ChatUpdate[];
46
- 'lid-mapping.update': LIDMapping;
32
+ 'chats.update': ChatUpdate[]
33
+ 'lid-mapping.update': {
34
+ lid: string
35
+ pn: string
36
+ }
47
37
  /** delete chats with given ID */
48
- 'chats.delete': string[];
38
+ 'chats.delete': string[]
49
39
  /** presence of contact in a chat updated */
50
40
  'presence.update': {
51
- id: string;
41
+ id: string
52
42
  presences: {
53
- [participant: string]: PresenceData;
54
- };
55
- };
56
- 'contacts.upsert': Contact[];
57
- 'contacts.update': Partial<Contact>[];
43
+ [participant: string]: PresenceData
44
+ }
45
+ }
46
+ 'contacts.upsert': Contact[]
47
+ 'contacts.update': Partial<Contact>[]
58
48
  'messages.delete': {
59
- keys: WAMessageKey[];
49
+ keys: WAMessageKey[]
60
50
  } | {
61
- jid: string;
62
- all: true;
63
- };
64
- 'messages.update': WAMessageUpdate[];
51
+ jid: string
52
+ all: true
53
+ }
54
+ 'messages.update': WAMessageUpdate[]
65
55
  'messages.media-update': {
66
- key: WAMessageKey;
56
+ key: WAMessageKey
67
57
  media?: {
68
- ciphertext: Uint8Array;
69
- iv: Uint8Array;
70
- };
71
- error?: Boom;
72
- }[];
58
+ ciphertext: Uint8Array
59
+ iv: Uint8Array
60
+ }
61
+ error?: Boom
62
+ }[]
73
63
  /**
74
64
  * add/update the given messages. If they were received while the connection was online,
75
65
  * the update will have type: "notify"
76
66
  * if requestId is provided, then the messages was received from the phone due to it being unavailable
77
67
  * */
78
68
  'messages.upsert': {
79
- messages: WAMessage[];
80
- type: MessageUpsertType;
81
- requestId?: string;
82
- };
69
+ messages: WAMessage[]
70
+ type: MessageUpsertType
71
+ requestId?: string
72
+ }
73
+ // 'messages.poll': {
74
+ // key: WAMessageKey
75
+ // pollUpdates: proto.IPollUpdateMessage
76
+ // }[]
83
77
  /** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
84
78
  'messages.reaction': {
85
- key: WAMessageKey;
86
- reaction: proto.IReaction;
87
- }[];
88
- 'message-receipt.update': MessageUserReceiptUpdate[];
89
- 'groups.upsert': GroupMetadata[];
90
- 'groups.update': Partial<GroupMetadata>[];
79
+ key: WAMessageKey
80
+ reaction: proto.IReaction
81
+ }[]
82
+ 'message-receipt.update': MessageUserReceiptUpdate[]
83
+ 'groups.upsert': GroupMetadata[]
84
+ 'groups.update': Partial<GroupMetadata>[]
91
85
  /** apply an action to participants in a group */
92
86
  'group-participants.update': {
93
- id: string;
94
- author: string;
95
- authorPn?: string;
96
- authorUsername?: string;
97
- participants: GroupParticipant[];
98
- action: ParticipantAction;
99
- };
87
+ id: string
88
+ author: string
89
+ participants: string[]
90
+ action: ParticipantAction
91
+ }
100
92
  '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
- 'blocklist.set': {
118
- blocklist: string[];
119
- };
120
- 'blocklist.update': {
121
- blocklist: string[];
122
- type: 'add' | 'remove';
123
- };
124
- /** Receive an update on a call, including when the call was received, rejected, accepted */
125
- call: WACallEvent[];
126
- 'labels.edit': Label;
127
- 'labels.association': {
128
- association: LabelAssociation;
129
- type: 'add' | 'remove';
130
- };
131
- /** Newsletter-related events */
93
+ id: string
94
+ author: string
95
+ participant: string
96
+ action: RequestJoinAction
97
+ method: RequestJoinMethod
98
+ }
132
99
  'newsletter.reaction': {
133
- id: string;
134
- server_id: string;
100
+ id: string
101
+ newsletter_server_id: string
135
102
  reaction: {
136
- code?: string;
137
- count?: number;
138
- removed?: boolean;
139
- };
140
- };
103
+ code?: string
104
+ count?: number
105
+ removed?: boolean
106
+ }
107
+ }
141
108
  'newsletter.view': {
142
- id: string;
143
- server_id: string;
144
- count: number;
145
- };
109
+ id: string
110
+ newsletter_server_id: string
111
+ count: number
112
+ }
146
113
  'newsletter-participants.update': {
147
- id: string;
148
- author: string;
149
- user: string;
150
- new_role: string;
151
- action: string;
152
- };
114
+ id: string
115
+ author: string
116
+ user: string
117
+ new_role: NewsletterViewRole
118
+ action: SubscriberAction
119
+ }
153
120
  '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
- };
121
+ id: string
122
+ update: NewsletterSettingsUpdate
123
+ }
124
+ 'limit-sharing.update': {
125
+ id: string
126
+ author: string
127
+ action: 'on' | 'off'
128
+ trigger: proto.LimitSharing.TriggerType
129
+ update_time: number
130
+ }
131
+ 'community-owner.update': {
132
+ id: string
133
+ author: string
134
+ user: string
135
+ new_role: 'SUPERADMIN_MEMBER'
136
+ update_time: number
137
+ }
138
+ 'blocklist.set': {
139
+ blocklist: string[]
140
+ }
141
+ 'blocklist.update': {
142
+ blocklist: string[]
143
+ type: 'add' | 'remove'
144
+ }
145
+ /** Receive an update on a call, including when the call was received, rejected, accepted */
146
+ 'call': WACallEvent[]
147
+ 'labels.edit': Label
148
+ 'labels.association': {
149
+ association: LabelAssociation
150
+ type: 'add' | 'remove'
151
+ }
152
+ }
153
+
189
154
  export type BufferedEventData = {
190
155
  historySets: {
191
156
  chats: {
192
- [jid: string]: Chat;
193
- };
157
+ [jid: string]: Chat
158
+ }
194
159
  contacts: {
195
- [jid: string]: Contact;
196
- };
160
+ [jid: string]: Contact
161
+ }
197
162
  messages: {
198
- [uqId: string]: WAMessage;
199
- };
200
- empty: boolean;
201
- isLatest: boolean;
202
- progress?: number | null;
203
- syncType?: proto.HistorySync.HistorySyncType;
204
- pastParticipants?: proto.IPastParticipants[];
205
- chunkOrder?: number | null;
206
- peerDataRequestSessionId?: string;
207
- };
163
+ [uqId: string]: WAMessage
164
+ }
165
+ empty: boolean
166
+ isLatest: boolean
167
+ progress?: number | null
168
+ syncType?: proto.HistorySync.HistorySyncType
169
+ peerDataRequestSessionId?: string
170
+ }
208
171
  chatUpserts: {
209
- [jid: string]: Chat;
210
- };
172
+ [jid: string]: Chat
173
+ }
211
174
  chatUpdates: {
212
- [jid: string]: ChatUpdate;
213
- };
214
- chatDeletes: Set<string>;
175
+ [jid: string]: ChatUpdate
176
+ }
177
+ chatDeletes: Set<string>
215
178
  contactUpserts: {
216
- [jid: string]: Contact;
217
- };
179
+ [jid: string]: Contact
180
+ }
218
181
  contactUpdates: {
219
- [jid: string]: Partial<Contact>;
220
- };
182
+ [jid: string]: Partial<Contact>
183
+ }
221
184
  messageUpserts: {
222
185
  [key: string]: {
223
- type: MessageUpsertType;
224
- message: WAMessage;
225
- };
226
- };
186
+ type: MessageUpsertType
187
+ message: WAMessage
188
+ }
189
+ }
227
190
  messageUpdates: {
228
- [key: string]: WAMessageUpdate;
229
- };
191
+ [key: string]: WAMessageUpdate
192
+ }
230
193
  messageDeletes: {
231
- [key: string]: WAMessageKey;
232
- };
194
+ [key: string]: WAMessageKey
195
+ }
196
+ // messagePollings: {
197
+ // [key: string]: {
198
+ // key: WAMessageKey
199
+ // pollUpdates: proto.IPollUpdateMessage[]
200
+ // }
201
+ // }
233
202
  messageReactions: {
234
203
  [key: string]: {
235
- key: WAMessageKey;
236
- reactions: proto.IReaction[];
237
- };
238
- };
204
+ key: WAMessageKey
205
+ reactions: proto.IReaction[]
206
+ }
207
+ }
239
208
  messageReceipts: {
240
209
  [key: string]: {
241
- key: WAMessageKey;
242
- userReceipt: proto.IUserReceipt[];
243
- };
244
- };
210
+ key: WAMessageKey
211
+ userReceipt: proto.IUserReceipt[]
212
+ }
213
+ }
245
214
  groupUpdates: {
246
- [jid: string]: Partial<GroupMetadata>;
247
- };
248
- };
249
- export type BaileysEvent = keyof BaileysEventMap;
250
- export interface BaileysEventEmitter {
251
- on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
252
- off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
253
- removeAllListeners<T extends keyof BaileysEventMap>(event: T): void;
254
- emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
215
+ [jid: string]: Partial<GroupMetadata>
216
+ }
255
217
  }
256
- //# sourceMappingURL=Events.d.ts.map
218
+
219
+ export type BaileysEvent = keyof BaileysEventMap
220
+
221
+ export interface BaileysEventEmitter {
222
+ on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void
223
+ off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void
224
+ removeAllListeners<T extends keyof BaileysEventMap>(event: T): void
225
+ emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean
226
+ }
@@ -1,2 +1,3 @@
1
- import { proto } from '../../WAProto/index.js';
2
- //# sourceMappingURL=Events.js.map
1
+ "use strict"
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true })
@@ -1,71 +1,66 @@
1
- import type { Contact } from './Contact.js';
2
- import type { WAMessageAddressingMode } from './Message.js';
3
- export type GroupParticipant = Contact & {
4
- isAdmin?: boolean;
5
- isSuperAdmin?: boolean;
6
- 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;
1
+ import { Contact } from './Contact'
2
+
3
+ export type GroupParticipant = (Contact & {
4
+ isAdmin?: boolean
5
+ isSuperAdmin?: boolean
6
+ admin?: 'admin' | 'superadmin' | null
7
+ })
8
+
9
+ export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify'
10
+
11
+ export type RequestJoinAction = 'created' | 'revoked' | 'rejected'
12
+
13
+ export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined
14
+
11
15
  export interface GroupMetadata {
12
- id: string;
13
- notify?: string;
14
- /** group uses 'lid' or 'pn' to send messages */
15
- addressingMode?: WAMessageAddressingMode;
16
- owner: string | undefined;
17
- ownerPn?: string | undefined;
18
- ownerUsername?: string | undefined;
19
- owner_country_code?: string | undefined;
20
- subject: string;
16
+ id: string
17
+ addressingMode: string
18
+ owner: string | undefined
19
+ ownerCountry: string,
20
+ subject: string
21
21
  /** group subject owner */
22
- subjectOwner?: string;
23
- subjectOwnerPn?: string;
24
- subjectOwnerUsername?: string;
22
+ subjectOwner?: string
25
23
  /** group subject modification date */
26
- subjectTime?: number;
27
- creation?: number;
28
- desc?: string;
29
- descOwner?: string;
30
- descOwnerPn?: string;
31
- descOwnerUsername?: string;
32
- descId?: string;
33
- descTime?: number;
24
+ subjectTime?: number
25
+ creation?: number
26
+ desc?: string
27
+ descOwner?: string
28
+ descId?: string
34
29
  /** if this group is part of a community, it returns the jid of the community to which it belongs */
35
- linkedParent?: string;
30
+ linkedParent?: string
36
31
  /** is set when the group only allows admins to change group settings */
37
- restrict?: boolean;
32
+ restrict?: boolean
38
33
  /** is set when the group only allows admins to write messages */
39
- announce?: boolean;
34
+ announce?: boolean
40
35
  /** is set when the group also allows members to add participants */
41
- memberAddMode?: boolean;
36
+ memberAddMode?: boolean
42
37
  /** Request approval to join the group */
43
- joinApprovalMode?: boolean;
38
+ joinApprovalMode?: boolean
44
39
  /** is this a community */
45
- isCommunity?: boolean;
40
+ isCommunity?: boolean
46
41
  /** is this the announce of a community */
47
- isCommunityAnnounce?: boolean;
42
+ isCommunityAnnounce?: boolean
48
43
  /** number of group participants */
49
- size?: number;
50
- participants: GroupParticipant[];
51
- ephemeralDuration?: number;
52
- inviteCode?: string;
44
+ size?: number
45
+ participants: GroupParticipant[]
46
+ picture?: string
47
+ ephemeralDuration?: number
48
+ inviteCode?: string
53
49
  /** the person who added you to group or changed some setting in group */
54
- author?: string;
55
- authorPn?: string;
56
- authorUsername?: string;
50
+ author?: string
57
51
  }
52
+
58
53
  export interface WAGroupCreateResponse {
59
- status: number;
60
- gid?: string;
54
+ status: number
55
+ gid?: string
61
56
  participants?: [{
62
- [key: string]: {};
63
- }];
57
+ [key: string]: {}
58
+ }]
64
59
  }
60
+
65
61
  export interface GroupModificationResponse {
66
- status: number;
62
+ status: number
67
63
  participants?: {
68
- [key: string]: {};
69
- };
70
- }
71
- //# sourceMappingURL=GroupMetadata.d.ts.map
64
+ [key: string]: {}
65
+ }
66
+ }
@@ -1,2 +1,3 @@
1
- export {};
2
- //# sourceMappingURL=GroupMetadata.js.map
1
+ "use strict"
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true })
@@ -1,28 +1,30 @@
1
1
  export interface Label {
2
2
  /** Label uniq ID */
3
- id: string;
3
+ id: string
4
4
  /** Label name */
5
- name: string;
5
+ name: string
6
6
  /** Label color ID */
7
- color: number;
7
+ color: number
8
8
  /** Is label has been deleted */
9
- deleted: boolean;
9
+ deleted: boolean
10
10
  /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
11
- predefinedId?: string;
11
+ predefinedId?: string
12
12
  }
13
+
13
14
  export interface LabelActionBody {
14
- id: string;
15
+ id: string
15
16
  /** Label name */
16
- name?: string;
17
+ name?: string
17
18
  /** Label color ID */
18
- color?: number;
19
+ color?: number
19
20
  /** Is label has been deleted */
20
- deleted?: boolean;
21
+ deleted?: boolean
21
22
  /** WhatsApp has 5 predefined labels (New customer, New order & etc) */
22
- predefinedId?: number;
23
+ predefinedId?: number
23
24
  }
25
+
24
26
  /** WhatsApp has 20 predefined colors */
25
- export declare enum LabelColor {
27
+ export declare const enum LabelColor {
26
28
  Color1 = 0,
27
29
  Color2 = 1,
28
30
  Color3 = 2,
@@ -43,5 +45,4 @@ export declare enum LabelColor {
43
45
  Color18 = 17,
44
46
  Color19 = 18,
45
47
  Color20 = 19
46
- }
47
- //# sourceMappingURL=Label.d.ts.map
48
+ }