@heavstaltech/baileys 1.0.2 → 3.2.4

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 (133) hide show
  1. package/README.md +226 -53
  2. package/WAProto/index.js +14270 -302
  3. package/engine-requirements.js +10 -0
  4. package/lib/Defaults/baileys-version.json +1 -1
  5. package/lib/Defaults/index.js +118 -79
  6. package/lib/Defaults/phonenumber-mcc.json +223 -0
  7. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  8. package/lib/Signal/Group/ciphertext-message.js +15 -0
  9. package/lib/Signal/Group/group-session-builder.d.ts +14 -0
  10. package/lib/Signal/Group/group-session-builder.js +64 -0
  11. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  12. package/lib/Signal/Group/group_cipher.js +96 -0
  13. package/lib/Signal/Group/index.d.ts +11 -0
  14. package/lib/Signal/Group/index.js +57 -0
  15. package/lib/Signal/Group/keyhelper.d.ts +10 -0
  16. package/lib/Signal/Group/keyhelper.js +55 -0
  17. package/lib/Signal/Group/queue-job.d.ts +1 -0
  18. package/lib/Signal/Group/queue-job.js +57 -0
  19. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  20. package/lib/Signal/Group/sender-chain-key.js +34 -0
  21. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  22. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  23. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  24. package/lib/Signal/Group/sender-key-message.js +69 -0
  25. package/lib/Signal/Group/sender-key-name.d.ts +17 -0
  26. package/lib/Signal/Group/sender-key-name.js +51 -0
  27. package/lib/Signal/Group/sender-key-record.d.ts +30 -0
  28. package/lib/Signal/Group/sender-key-record.js +53 -0
  29. package/lib/Signal/Group/sender-key-state.d.ts +38 -0
  30. package/lib/Signal/Group/sender-key-state.js +99 -0
  31. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  32. package/{WASignalGroup/sender_message_key.js → lib/Signal/Group/sender-message-key.js} +6 -16
  33. package/lib/Signal/libsignal.js +51 -29
  34. package/lib/Socket/business.d.ts +43 -42
  35. package/lib/Socket/chats.d.ts +222 -36
  36. package/lib/Socket/chats.js +186 -153
  37. package/lib/Socket/dugong.d.ts +254 -0
  38. package/lib/Socket/dugong.js +484 -0
  39. package/lib/Socket/groups.d.ts +7 -7
  40. package/lib/Socket/groups.js +37 -35
  41. package/lib/Socket/index.d.ts +52 -51
  42. package/lib/Socket/index.js +1 -0
  43. package/lib/Socket/messages-recv.d.ts +37 -34
  44. package/lib/Socket/messages-recv.js +175 -37
  45. package/lib/Socket/messages-send.d.ts +12 -18
  46. package/lib/Socket/messages-send.js +396 -574
  47. package/lib/Socket/newsletter.d.ts +28 -26
  48. package/lib/Socket/newsletter.js +140 -25
  49. package/lib/Socket/registration.d.ts +52 -49
  50. package/lib/Socket/registration.js +7 -7
  51. package/lib/Socket/socket.d.ts +0 -1
  52. package/lib/Socket/socket.js +47 -198
  53. package/lib/Socket/usync.d.ts +10 -11
  54. package/lib/Store/make-cache-manager-store.d.ts +1 -2
  55. package/lib/Store/make-in-memory-store.d.ts +2 -2
  56. package/lib/Store/make-in-memory-store.js +1 -5
  57. package/lib/Store/make-ordered-dictionary.js +2 -2
  58. package/lib/Types/Auth.d.ts +1 -0
  59. package/lib/Types/Call.d.ts +1 -1
  60. package/lib/Types/Chat.d.ts +7 -12
  61. package/lib/Types/Events.d.ts +2 -17
  62. package/lib/Types/GroupMetadata.d.ts +2 -3
  63. package/lib/Types/Label.d.ts +0 -11
  64. package/lib/Types/Label.js +1 -1
  65. package/lib/Types/LabelAssociation.js +1 -1
  66. package/lib/Types/Message.d.ts +10 -170
  67. package/lib/Types/Newsletter.d.ts +97 -86
  68. package/lib/Types/Newsletter.js +38 -32
  69. package/lib/Types/Socket.d.ts +2 -7
  70. package/lib/Types/index.d.ts +0 -9
  71. package/lib/Types/index.js +1 -1
  72. package/lib/Utils/auth-utils.js +14 -35
  73. package/lib/Utils/business.d.ts +1 -1
  74. package/lib/Utils/business.js +2 -2
  75. package/lib/Utils/chat-utils.d.ts +12 -11
  76. package/lib/Utils/chat-utils.js +36 -52
  77. package/lib/Utils/crypto.d.ts +16 -15
  78. package/lib/Utils/crypto.js +26 -74
  79. package/lib/Utils/decode-wa-message.d.ts +0 -17
  80. package/lib/Utils/decode-wa-message.js +17 -53
  81. package/lib/Utils/event-buffer.js +7 -10
  82. package/lib/Utils/generics.d.ts +17 -13
  83. package/lib/Utils/generics.js +79 -58
  84. package/lib/Utils/history.d.ts +2 -6
  85. package/lib/Utils/history.js +6 -4
  86. package/lib/Utils/logger.d.ts +3 -1
  87. package/lib/Utils/lt-hash.js +12 -12
  88. package/lib/Utils/make-mutex.d.ts +2 -2
  89. package/lib/Utils/messages-media.d.ts +28 -25
  90. package/lib/Utils/messages-media.js +201 -103
  91. package/lib/Utils/messages.js +36 -473
  92. package/lib/Utils/noise-handler.d.ts +5 -4
  93. package/lib/Utils/noise-handler.js +14 -19
  94. package/lib/Utils/process-message.d.ts +5 -5
  95. package/lib/Utils/process-message.js +23 -75
  96. package/lib/Utils/signal.d.ts +1 -2
  97. package/lib/Utils/signal.js +26 -32
  98. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  99. package/lib/Utils/use-multi-file-auth-state.js +66 -242
  100. package/lib/Utils/validate-connection.d.ts +1 -1
  101. package/lib/Utils/validate-connection.js +88 -64
  102. package/lib/WABinary/constants.d.ts +27 -24
  103. package/lib/WABinary/decode.d.ts +2 -1
  104. package/lib/WABinary/decode.js +11 -23
  105. package/lib/WABinary/encode.d.ts +2 -1
  106. package/lib/WABinary/encode.js +147 -134
  107. package/lib/WABinary/generic-utils.d.ts +5 -2
  108. package/lib/WABinary/generic-utils.js +125 -37
  109. package/lib/WABinary/jid-utils.d.ts +1 -1
  110. package/lib/WAM/BinaryInfo.d.ts +11 -2
  111. package/lib/WAM/encode.d.ts +2 -1
  112. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
  113. package/lib/WAUSync/USyncUser.d.ts +2 -0
  114. package/lib/index.d.ts +12 -0
  115. package/lib/index.js +12 -0
  116. package/package.json +102 -98
  117. package/WAProto/index.d.ts +0 -50383
  118. package/WASignalGroup/GroupProtocol.js +0 -1697
  119. package/WASignalGroup/ciphertext_message.js +0 -16
  120. package/WASignalGroup/group_cipher.js +0 -120
  121. package/WASignalGroup/group_session_builder.js +0 -46
  122. package/WASignalGroup/index.js +0 -5
  123. package/WASignalGroup/keyhelper.js +0 -21
  124. package/WASignalGroup/protobufs.js +0 -3
  125. package/WASignalGroup/queue_job.js +0 -69
  126. package/WASignalGroup/sender_chain_key.js +0 -50
  127. package/WASignalGroup/sender_key_distribution_message.js +0 -78
  128. package/WASignalGroup/sender_key_message.js +0 -92
  129. package/WASignalGroup/sender_key_name.js +0 -70
  130. package/WASignalGroup/sender_key_record.js +0 -56
  131. package/WASignalGroup/sender_key_state.js +0 -129
  132. package/lib/Utils/use-single-file-auth-state.d.ts +0 -12
  133. package/lib/Utils/use-single-file-auth-state.js +0 -75
@@ -24,4 +24,4 @@ var LabelColor;
24
24
  LabelColor[LabelColor["Color18"] = 17] = "Color18";
25
25
  LabelColor[LabelColor["Color19"] = 18] = "Color19";
26
26
  LabelColor[LabelColor["Color20"] = 19] = "Color20";
27
- })(LabelColor || (exports.LabelColor = LabelColor = {}));
27
+ })(LabelColor = exports.LabelColor || (exports.LabelColor = {}));
@@ -6,4 +6,4 @@ var LabelAssociationType;
6
6
  (function (LabelAssociationType) {
7
7
  LabelAssociationType["Chat"] = "label_jid";
8
8
  LabelAssociationType["Message"] = "label_message";
9
- })(LabelAssociationType || (exports.LabelAssociationType = LabelAssociationType = {}));
9
+ })(LabelAssociationType = exports.LabelAssociationType || (exports.LabelAssociationType = {}));
@@ -19,7 +19,6 @@ export type WAMessageKey = proto.IMessageKey;
19
19
  export type WATextMessage = proto.Message.IExtendedTextMessage;
20
20
  export type WAContextInfo = proto.IContextInfo;
21
21
  export type WALocationMessage = proto.Message.ILocationMessage;
22
- export type WALiveLocationMessage = proto.Message.ILiveLocationMessage;
23
22
  export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
24
23
  export import WAMessageStubType = proto.WebMessageInfo.StubType;
25
24
  export import WAMessageStatus = proto.WebMessageInfo.Status;
@@ -28,7 +27,6 @@ export type WAMediaUpload = Buffer | {
28
27
  } | {
29
28
  stream: Readable;
30
29
  };
31
- export import Annotations = proto.IInteractiveAnnotation;
32
30
  /** Set of message types that are supported by the library */
33
31
  export type MessageType = keyof proto.Message;
34
32
  export type DownloadableMessage = {
@@ -55,19 +53,6 @@ export interface WAUrlInfo {
55
53
  highQualityThumbnail?: proto.Message.IImageMessage;
56
54
  originalThumbnailUrl?: string;
57
55
  }
58
- export interface Media {
59
- image?: WAMediaUpload;
60
- video?: WAMediaUpload;
61
- }
62
- export interface Carousel {
63
- image?: WAMediaUpload;
64
- video?: WAMediaUpload;
65
- product?: WASendableProduct;
66
- title?: string;
67
- caption?: string;
68
- footer?: string;
69
- buttons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[];
70
- }
71
56
  type Mentionable = {
72
57
  /** list of jids that are mentioned in the accompanying text */
73
58
  mentions?: string[];
@@ -88,35 +73,6 @@ type Templatable = {
88
73
  templateButtons?: proto.IHydratedTemplateButton[];
89
74
  footer?: string;
90
75
  };
91
- type Interactiveable = {
92
- /** add buttons to the message (conflicts with normal buttons)*/
93
- interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[];
94
- title?: string;
95
- subtitle?: string;
96
- media?: boolean;
97
- };
98
- type Shopable = {
99
- shop?: proto.Message.InteractiveMessage.ShopMessage.Surface;
100
- id?: string;
101
- title?: string;
102
- subtitle?: string;
103
- media?: boolean;
104
- };
105
- type Collectionable = {
106
- collection?: {
107
- bizJid?: string;
108
- id?: string;
109
- version?: number;
110
- };
111
- title?: string;
112
- subtitle?: string;
113
- media?: boolean;
114
- };
115
- type Cardsable = {
116
- cards?: Carousel[];
117
- title?: string;
118
- subtitle?: string;
119
- };
120
76
  type Editable = {
121
77
  edit?: WAMessageKey;
122
78
  };
@@ -125,7 +81,7 @@ type Listable = {
125
81
  sections?: proto.Message.ListMessage.ISection[];
126
82
  /** Title of a List Message only */
127
83
  title?: string;
128
- /** Text of the button on the list (required) */
84
+ /** Text of the bnutton on the list (required) */
129
85
  buttonText?: string;
130
86
  };
131
87
  type WithDimensions = {
@@ -138,12 +94,6 @@ export type PollMessageOptions = {
138
94
  values: string[];
139
95
  /** 32 byte message secret to encrypt poll selections */
140
96
  messageSecret?: Uint8Array;
141
- toAnnouncementGroup?: boolean;
142
- };
143
- export type PollResultMessage = {
144
- name: string;
145
- votes: proto.Message.PollResultSnapshotMessage.PollVote[];
146
- messageSecret?: Uint8Array;
147
97
  };
148
98
  type SharePhoneNumber = {
149
99
  sharePhoneNumber: boolean;
@@ -151,123 +101,48 @@ type SharePhoneNumber = {
151
101
  type RequestPhoneNumber = {
152
102
  requestPhoneNumber: boolean;
153
103
  };
154
- export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
155
- productImage: WAMediaUpload;
156
- };
157
104
  export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
158
105
  export type AnyMediaMessageContent = (({
159
106
  image: WAMediaUpload;
160
107
  caption?: string;
161
108
  jpegThumbnail?: string;
162
- annotations?: Annotations;
163
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | ({
109
+ } & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | ({
164
110
  video: WAMediaUpload;
165
111
  caption?: string;
166
112
  gifPlayback?: boolean;
167
113
  jpegThumbnail?: string;
168
114
  /** if set to true, will send as a `video note` */
169
115
  ptv?: boolean;
170
- annotations?: Annotations;
171
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | {
116
+ } & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | {
172
117
  audio: WAMediaUpload;
173
118
  /** if set to true, will send as a `voice note` */
174
119
  ptt?: boolean;
175
120
  /** optionally tell the duration of the audio */
176
121
  seconds?: number;
177
- annotations?: Annotations;
178
122
  } | ({
179
123
  sticker: WAMediaUpload;
180
124
  isAnimated?: boolean;
181
- annotations?: Annotations;
182
125
  } & WithDimensions) | ({
183
126
  document: WAMediaUpload;
184
127
  mimetype: string;
185
128
  fileName?: string;
186
129
  caption?: string;
187
- annotations?: Annotations;
188
- } & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable)) & {
130
+ } & Contextable & Buttonable & Templatable)) & {
189
131
  mimetype?: string;
190
132
  } & Editable;
191
133
  export type ButtonReplyInfo = {
192
134
  displayText: string;
193
135
  id: string;
194
136
  index: number;
195
- text: string;
196
- nativeFlow: proto.Message.InteractiveResponseMessage.NativeFlowResponseMessage;
197
- };
198
- export type GroupInviteInfo = {
199
- inviteCode: string;
200
- inviteExpiration: number;
201
- text: string;
202
- jid: string;
203
- subject: string;
204
- thumbnail: Buffer;
205
- };
206
- export type PinInChatInfo = {
207
- key: WAMessageKey;
208
- type?: number;
209
- time?: number;
210
- };
211
- export type KeepInChatInfo = {
212
- key: WAMessageKey;
213
- type?: number;
214
- time?: number;
215
- };
216
- export type CallCreationInfo = {
217
- time?: number;
218
- title?: string;
219
- type?: number;
220
137
  };
221
- export type PaymentInviteInfo = {
222
- type?: number;
223
- expiry?: number;
224
- };
225
- export type RequestPaymentInfo = {
226
- expiry: number;
227
- amount: number;
228
- currency: string;
229
- from: string;
230
- note?: string;
231
- sticker?: WAMediaUpload;
232
- background: string;
233
- /** add contextInfo to the message */
234
- contextInfo?: proto.IContextInfo;
235
- };
236
- export type EventsInfo = {
237
- isCanceled?: boolean;
238
- name: string;
239
- description: string;
240
- joinLink?: string;
241
- startTime?: number;
242
- messageSecret?: Uint8Array;
243
- };
244
- export type AdminInviteInfo = {
245
- inviteExpiration: number;
246
- text: string;
247
- jid: string;
248
- subject: string;
249
- thumbnail: Buffer;
250
- };
251
- export type OrderInfo = {
252
- id: number;
253
- thumbnail: string;
254
- itemCount: number;
255
- status: number;
256
- surface: number;
257
- title: string;
258
- text: string;
259
- seller: string;
260
- token: string;
261
- amount: number;
262
- currency: string;
138
+ export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
139
+ productImage: WAMediaUpload;
263
140
  };
264
141
  export type AnyRegularMessageContent = (({
265
142
  text: string;
266
143
  linkPreview?: WAUrlInfo | null;
267
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable) | AnyMediaMessageContent | ({
144
+ } & Mentionable & Contextable & Buttonable & Templatable & Listable & Editable) | AnyMediaMessageContent | ({
268
145
  poll: PollMessageOptions;
269
- } | {
270
- pollResult: PollResultMessage;
271
146
  } & Mentionable & Contextable & Buttonable & Templatable & Editable) | {
272
147
  contacts: {
273
148
  displayName?: string;
@@ -275,49 +150,19 @@ export type AnyRegularMessageContent = (({
275
150
  };
276
151
  } | {
277
152
  location: WALocationMessage;
278
- } | {
279
- liveLocation: WALiveLocationMessage;
280
153
  } | {
281
154
  react: proto.Message.IReactionMessage;
282
155
  } | {
283
156
  buttonReply: ButtonReplyInfo;
284
- type: 'template' | 'plain' | 'interactive';
285
- } | {
286
- groupInvite: GroupInviteInfo;
287
- } | {
288
- pin: WAMessageKey;
289
- type: proto.PinInChat.Type;
290
- /**
291
- * 24 hours, 7 days, 30 days
292
- */
293
- time?: 86400 | 604800 | 2592000;
294
- } | {
295
- keep: WAMessageKey;
296
- type: number;
297
- /**
298
- * 24 hours, 7 days, 90 days
299
- */
300
- time?: 86400 | 604800 | 7776000;
301
- } | {
302
- paymentInvite: PaymentInviteInfo;
303
- } | {
304
- requestPayment: RequestPaymentInfo;
305
- } | {
306
- event: EventsInfo;
307
- } | {
308
- order: OrderInfo;
309
- } | {
310
- call: CallCreationInfo;
311
- } | {
312
- inviteAdmin: AdminInviteInfo;
157
+ type: 'template' | 'plain';
313
158
  } | {
314
159
  listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
315
- } | ({
160
+ } | {
316
161
  product: WASendableProduct;
317
162
  businessOwnerJid?: string;
318
163
  body?: string;
319
164
  footer?: string;
320
- } & Mentionable & Contextable & Interactiveable & Shopable & Collectionable & Cardsable & WithDimensions) | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
165
+ } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
321
166
  export type AnyMessageContent = AnyRegularMessageContent | {
322
167
  forward: WAMessage;
323
168
  force?: boolean;
@@ -368,8 +213,6 @@ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
368
213
  font?: number;
369
214
  /** if it is broadcast */
370
215
  broadcast?: boolean;
371
- /** delay of message time */
372
- delay?: number;
373
216
  };
374
217
  export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
375
218
  userJid: string;
@@ -393,8 +236,6 @@ export type MediaGenerationOptions = {
393
236
  mediaCache?: CacheStore;
394
237
  mediaUploadTimeoutMs?: number;
395
238
  options?: AxiosRequestConfig;
396
- /** the message you want to quote */
397
- quoted?: WAMessage;
398
239
  backgroundColor?: string;
399
240
  font?: number;
400
241
  /** The message is for newsletter? */
@@ -402,7 +243,6 @@ export type MediaGenerationOptions = {
402
243
  };
403
244
  export type MessageContentGenerationOptions = MediaGenerationOptions & {
404
245
  getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
405
- getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
406
246
  };
407
247
  export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
408
248
  /**
@@ -1,92 +1,103 @@
1
- import { proto } from '../../WAProto';
2
- export type NewsletterReactionMode = 'ALL' | 'BASIC' | 'NONE';
3
- export type NewsletterState = 'ACTIVE' | 'GEOSUSPENDED' | 'SUSPENDED';
4
- export type NewsletterVerification = 'VERIFIED' | 'UNVERIFIED';
5
- export type NewsletterMute = 'ON' | 'OFF' | 'UNDEFINED';
6
- export type NewsletterViewRole = 'ADMIN' | 'GUEST' | 'OWNER' | 'SUBSCRIBER';
1
+ import { proto } from "../../WAProto"
2
+
3
+ export type NewsletterReactionMode = "ALL" | "BASIC" | "NONE"
4
+ export type NewsletterState = "ACTIVE" | "GEOSUSPENDED" | "SUSPENDED"
5
+ export type NewsletterVerification = "VERIFIED" | "UNVERIFIED"
6
+ export type NewsletterMute = "ON" | "OFF" | "UNDEFINED"
7
+ export type NewsletterViewRole = "ADMIN" | "GUEST" | "OWNER" | "SUBSCRIBER"
8
+
7
9
  export type NewsletterViewerMetadata = {
8
- mute: NewsletterMute;
9
- view_role: NewsletterViewRole;
10
- };
10
+ mute: NewsletterMute
11
+ view_role: NewsletterViewRole
12
+ }
13
+
11
14
  export type NewsletterMetadata = {
12
- /**jid of newsletter */
13
- id: string;
14
- /**state of newsletter */
15
- state: NewsletterState;
16
- /**creation timestamp of newsletter */
17
- creation_time: number;
18
- /**name of newsletter */
19
- name: string;
20
- /**timestamp of last name modification of newsletter */
21
- nameTime: number;
22
- /**description of newsletter */
23
- description: string;
24
- /**timestamp of last description modification of newsletter */
25
- descriptionTime: number;
26
- /**invite code of newsletter */
27
- invite: string;
28
- /**i dont know */
29
- handle: null;
30
- /**direct path of picture */
31
- picture: string | null;
32
- /**direct path of picture preview (lower quality) */
33
- preview: string | null;
34
- /**reaction mode of newsletter */
35
- reaction_codes?: NewsletterReactionMode;
36
- /**subscribers count of newsletter */
37
- subscribers: number;
38
- /**verification state of newsletter */
39
- verification: NewsletterVerification;
40
- /**viewer metadata */
41
- viewer_metadata: NewsletterViewerMetadata;
42
- };
43
- export type SubscriberAction = 'promote' | 'demote';
15
+ /** jid of newsletter */
16
+ id: string
17
+ /** state of newsletter */
18
+ state: NewsletterState
19
+ /** creation timestamp of newsletter */
20
+ creation_time: number
21
+ /** name of newsletter */
22
+ name: string
23
+ /** timestamp of last name modification of newsletter */
24
+ nameTime: number
25
+ /** description of newsletter */
26
+ description: string
27
+ /** timestamp of last description modification of newsletter */
28
+ descriptionTime: number
29
+ /** invite code of newsletter */
30
+ invite: string
31
+ /** direct path of picture */
32
+ picture: string | null
33
+ /** direct path of picture preview (lower quality) */
34
+ preview: string | null
35
+ /** reaction mode of newsletter */
36
+ reaction_codes?: NewsletterReactionMode
37
+ /** subscribers count of newsletter */
38
+ subscribers: number
39
+ /** verification state of newsletter */
40
+ verification: NewsletterVerification
41
+ /** viewer metadata */
42
+ viewer_metadata: NewsletterViewerMetadata
43
+ }
44
+
45
+ export type SubscriberAction = "promote" | "demote"
46
+
44
47
  export type ReactionModeUpdate = {
45
- reaction_codes: {
46
- blocked_codes: null;
47
- enabled_ts_sec: null;
48
- value: NewsletterReactionMode;
49
- };
50
- };
51
- /**only exists reaction mode update */
52
- export type NewsletterSettingsUpdate = ReactionModeUpdate;
53
- export type NewsletterReaction = {
54
- count: number;
55
- code: string;
56
- };
57
- export type NewsletterFetchedUpdate = {
58
- /**id of message in newsletter, starts from 100 */
59
- server_id: string;
60
- /**count of views in this message */
61
- views?: number;
62
- /**reactions in this message */
63
- reactions: NewsletterReaction[];
64
- /**the message, if you requested only updates, you will not receive message */
65
- message?: proto.IWebMessageInfo;
66
- };
67
- export declare enum MexOperations {
68
- PROMOTE = "NotificationNewsletterAdminPromote",
69
- DEMOTE = "NotificationNewsletterAdminDemote",
70
- UPDATE = "NotificationNewsletterUpdate"
48
+ reaction_codes: {
49
+ blocked_codes: null
50
+ enabled_ts_sec: null
51
+ value: NewsletterReactionMode
52
+ }
71
53
  }
72
- export declare enum XWAPaths {
73
- PROMOTE = "xwa2_notify_newsletter_admin_promote",
74
- DEMOTE = "xwa2_notify_newsletter_admin_demote",
75
- ADMIN_COUNT = "xwa2_newsletter_admin",
76
- CREATE = "xwa2_newsletter_create",
77
- NEWSLETTER = "xwa2_newsletter",
78
- METADATA_UPDATE = "xwa2_notify_newsletter_on_metadata_update"
54
+
55
+ /** only exists reaction mode update */
56
+ export type NewsletterSettingsUpdate = ReactionModeUpdate
57
+
58
+ export type NewsletterReaction = {
59
+ count: number
60
+ code: string
79
61
  }
80
- export declare enum QueryIds {
81
- JOB_MUTATION = "7150902998257522",
82
- METADATA = "6620195908089573",
83
- UNFOLLOW = "7238632346214362",
84
- FOLLOW = "7871414976211147",
85
- UNMUTE = "7337137176362961",
86
- MUTE = "25151904754424642",
87
- CREATE = "6996806640408138",
88
- ADMIN_COUNT = "7130823597031706",
89
- CHANGE_OWNER = "7341777602580933",
90
- DELETE = "8316537688363079",
91
- DEMOTE = "6551828931592903"
62
+
63
+ export type NewsletterFetchedUpdate = {
64
+ /** id of message in newsletter, starts from 100 */
65
+ server_id: string
66
+ /** count of views in this message */
67
+ views?: number
68
+ /** reactions in this message */
69
+ reactions: NewsletterReaction[]
70
+ /** the message, if you requested only updates, you will not receive message */
71
+ message?: proto.IWebMessageInfo
92
72
  }
73
+
74
+ export const MexOperations = {
75
+ PROMOTE: "NotificationNewsletterAdminPromote",
76
+ DEMOTE: "NotificationNewsletterAdminDemote",
77
+ UPDATE: "NotificationNewsletterUpdate"
78
+ } as const
79
+
80
+ export const XWAPaths = {
81
+ PROMOTE: "xwa2_notify_newsletter_admin_promote",
82
+ DEMOTE: "xwa2_notify_newsletter_admin_demote",
83
+ ADMIN_COUNT: "xwa2_newsletter_admin",
84
+ CREATE: "xwa2_newsletter_create",
85
+ NEWSLETTER: "xwa2_newsletter",
86
+ SUBSCRIBED: "xwa2_newsletter_subscribed",
87
+ METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
88
+ } as const
89
+
90
+ export const QueryIds = {
91
+ JOB_MUTATION: "7150902998257522",
92
+ METADATA: "6620195908089573",
93
+ UNFOLLOW: "7238632346214362",
94
+ FOLLOW: "7871414976211147",
95
+ UNMUTE: "7337137176362961",
96
+ MUTE: "25151904754424642",
97
+ CREATE: "6996806640408138",
98
+ ADMIN_COUNT: "7130823597031706",
99
+ CHANGE_OWNER: "7341777602580933",
100
+ DELETE: "8316537688363079",
101
+ DEMOTE: "6551828931592903",
102
+ SUBSCRIBED: "6388546374527196"
103
+ } as const
@@ -1,32 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QueryIds = exports.XWAPaths = exports.MexOperations = void 0;
4
- var MexOperations;
5
- (function (MexOperations) {
6
- MexOperations["PROMOTE"] = "NotificationNewsletterAdminPromote";
7
- MexOperations["DEMOTE"] = "NotificationNewsletterAdminDemote";
8
- MexOperations["UPDATE"] = "NotificationNewsletterUpdate";
9
- })(MexOperations || (exports.MexOperations = MexOperations = {}));
10
- var XWAPaths;
11
- (function (XWAPaths) {
12
- XWAPaths["PROMOTE"] = "xwa2_notify_newsletter_admin_promote";
13
- XWAPaths["DEMOTE"] = "xwa2_notify_newsletter_admin_demote";
14
- XWAPaths["ADMIN_COUNT"] = "xwa2_newsletter_admin";
15
- XWAPaths["CREATE"] = "xwa2_newsletter_create";
16
- XWAPaths["NEWSLETTER"] = "xwa2_newsletter";
17
- XWAPaths["METADATA_UPDATE"] = "xwa2_notify_newsletter_on_metadata_update";
18
- })(XWAPaths || (exports.XWAPaths = XWAPaths = {}));
19
- var QueryIds;
20
- (function (QueryIds) {
21
- QueryIds["JOB_MUTATION"] = "7150902998257522";
22
- QueryIds["METADATA"] = "6620195908089573";
23
- QueryIds["UNFOLLOW"] = "7238632346214362";
24
- QueryIds["FOLLOW"] = "7871414976211147";
25
- QueryIds["UNMUTE"] = "7337137176362961";
26
- QueryIds["MUTE"] = "25151904754424642";
27
- QueryIds["CREATE"] = "6996806640408138";
28
- QueryIds["ADMIN_COUNT"] = "7130823597031706";
29
- QueryIds["CHANGE_OWNER"] = "7341777602580933";
30
- QueryIds["DELETE"] = "8316537688363079";
31
- QueryIds["DEMOTE"] = "6551828931592903";
32
- })(QueryIds || (exports.QueryIds = QueryIds = {}));
1
+ "use strict"
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true })
4
+
5
+ const MexOperations = {
6
+ PROMOTE: "NotificationNewsletterAdminPromote",
7
+ DEMOTE: "NotificationNewsletterAdminDemote",
8
+ UPDATE: "NotificationNewsletterUpdate"
9
+ }
10
+
11
+ const XWAPaths = {
12
+ PROMOTE: "xwa2_notify_newsletter_admin_promote",
13
+ DEMOTE: "xwa2_notify_newsletter_admin_demote",
14
+ ADMIN_COUNT: "xwa2_newsletter_admin",
15
+ CREATE: "xwa2_newsletter_create",
16
+ NEWSLETTER: "xwa2_newsletter",
17
+ SUBSCRIBED: "xwa2_newsletter_subscribed",
18
+ METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
19
+ }
20
+
21
+ const QueryIds = {
22
+ JOB_MUTATION: "7150902998257522",
23
+ METADATA: "6620195908089573",
24
+ UNFOLLOW: "7238632346214362",
25
+ FOLLOW: "7871414976211147",
26
+ UNMUTE: "7337137176362961",
27
+ MUTE: "25151904754424642",
28
+ CREATE: "6996806640408138",
29
+ ADMIN_COUNT: "7130823597031706",
30
+ CHANGE_OWNER: "7341777602580933",
31
+ DELETE: "8316537688363079",
32
+ DEMOTE: "6551828931592903",
33
+ SUBSCRIBED: "6388546374527196"
34
+ }
35
+
36
+ exports.MexOperations = MexOperations
37
+ exports.XWAPaths = XWAPaths
38
+ exports.QueryIds = QueryIds
@@ -1,10 +1,11 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import { AxiosRequestConfig } from 'axios';
2
4
  import type { Agent } from 'https';
3
5
  import type { Logger } from 'pino';
4
6
  import type { URL } from 'url';
5
7
  import { proto } from '../../WAProto';
6
8
  import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth';
7
- import { GroupMetadata } from './GroupMetadata';
8
9
  import { MediaConnInfo } from './Message';
9
10
  import { SignalRepository } from './Signal';
10
11
  export type WAVersion = [number, number, number];
@@ -60,8 +61,6 @@ export type SocketConfig = {
60
61
  transactionOpts: TransactionCapabilityOptions;
61
62
  /** marks the client as online whenever the socket successfully connects */
62
63
  markOnlineOnConnect: boolean;
63
- /** alphanumeric country code (USA -> US) for the number used */
64
- countryCode: string;
65
64
  /** provide a cache to store media, so does not have to be re-uploaded */
66
65
  mediaCache?: CacheStore;
67
66
  /**
@@ -72,8 +71,6 @@ export type SocketConfig = {
72
71
  userDevicesCache?: CacheStore;
73
72
  /** cache to store call offers */
74
73
  callOfferCache?: CacheStore;
75
- /** cache to track placeholder resends */
76
- placeholderResendCache?: CacheStore;
77
74
  /** width for link preview images */
78
75
  linkPreviewImageThumbnailWidth: number;
79
76
  /** Should Baileys ask the phone for full history, will be received async */
@@ -108,8 +105,6 @@ export type SocketConfig = {
108
105
  * (solves the "this message can take a while" issue) can be retried
109
106
  * */
110
107
  getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>;
111
- /** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
112
- cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>;
113
108
  makeSignalRepository: (auth: SignalAuthState) => SignalRepository;
114
109
  /** Socket passthrough */
115
110
  socket?: any;
@@ -15,15 +15,6 @@ import { SocketConfig } from './Socket';
15
15
  export type UserFacingSocketConfig = Partial<SocketConfig> & {
16
16
  auth: AuthenticationState;
17
17
  };
18
- export type BrowsersMap = {
19
- ubuntu(browser: string): [string, string, string];
20
- macOS(browser: string): [string, string, string];
21
- baileys(browser: string): [string, string, string];
22
- windows(browser: string): [string, string, string];
23
- iOS(browser: string): [string, string, string];
24
- linux(browser: string): [string, string, string];
25
- appropriate(browser: string): [string, string, string];
26
- };
27
18
  export declare enum DisconnectReason {
28
19
  connectionClosed = 428,
29
20
  connectionLost = 408,
@@ -39,4 +39,4 @@ var DisconnectReason;
39
39
  DisconnectReason[DisconnectReason["multideviceMismatch"] = 411] = "multideviceMismatch";
40
40
  DisconnectReason[DisconnectReason["forbidden"] = 403] = "forbidden";
41
41
  DisconnectReason[DisconnectReason["unavailableService"] = 503] = "unavailableService";
42
- })(DisconnectReason || (exports.DisconnectReason = DisconnectReason = {}));
42
+ })(DisconnectReason = exports.DisconnectReason || (exports.DisconnectReason = {}));