alipclutch-baileys 6.7.0 → 7.1.0

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 (121) hide show
  1. package/LICENSE +1 -1
  2. package/WAProto/index.js +77698 -117050
  3. package/engine-requirements.js +3 -3
  4. package/lib/Defaults/baileys-version.json +3 -0
  5. package/lib/Defaults/index.d.ts +6 -4
  6. package/lib/Defaults/index.js +118 -78
  7. package/lib/Defaults/phonenumber-mcc.json +223 -0
  8. package/lib/Socket/Client/abstract-socket-client.d.ts +17 -0
  9. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  10. package/lib/Socket/Client/index.d.ts +3 -2
  11. package/lib/Socket/Client/index.js +3 -2
  12. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  13. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  14. package/lib/Socket/Client/types.d.ts +1 -0
  15. package/lib/Socket/Client/types.js +1 -0
  16. package/lib/Socket/Client/web-socket-client.d.ts +12 -0
  17. package/lib/Socket/Client/web-socket-client.js +62 -0
  18. package/lib/Socket/Client/websocket.d.ts +1 -0
  19. package/lib/Socket/Client/websocket.js +1 -0
  20. package/lib/Socket/business.d.ts +58 -59
  21. package/lib/Socket/chats.d.ts +230 -45
  22. package/lib/Socket/chats.js +238 -139
  23. package/lib/Socket/dugong.d.ts +254 -0
  24. package/lib/Socket/dugong.js +483 -0
  25. package/lib/Socket/groups.d.ts +32 -41
  26. package/lib/Socket/groups.js +23 -38
  27. package/lib/Socket/index.d.ts +64 -63
  28. package/lib/Socket/index.js +3 -2
  29. package/lib/Socket/messages-recv.js +65 -9
  30. package/lib/Socket/messages-send.d.ts +47 -49
  31. package/lib/Socket/messages-send.js +420 -382
  32. package/lib/Socket/newsletter.d.ts +37 -39
  33. package/lib/Socket/newsletter.js +124 -71
  34. package/lib/Socket/registration.d.ts +267 -0
  35. package/lib/Socket/registration.js +166 -0
  36. package/lib/Socket/socket.d.ts +10 -10
  37. package/lib/Socket/socket.js +38 -62
  38. package/lib/Socket/usync.d.ts +4 -3
  39. package/lib/Socket/usync.js +1 -0
  40. package/lib/Store/index.d.ts +2 -1
  41. package/lib/Store/index.js +3 -1
  42. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  43. package/lib/Store/make-cache-manager-store.js +83 -0
  44. package/lib/Store/make-in-memory-store.d.ts +24 -24
  45. package/lib/Store/make-in-memory-store.js +14 -26
  46. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  47. package/lib/Store/make-ordered-dictionary.js +2 -2
  48. package/lib/Types/Auth.d.ts +7 -0
  49. package/lib/Types/Call.d.ts +1 -1
  50. package/lib/Types/Chat.d.ts +7 -14
  51. package/lib/Types/Contact.d.ts +1 -5
  52. package/lib/Types/Events.d.ts +2 -44
  53. package/lib/Types/GroupMetadata.d.ts +2 -11
  54. package/lib/Types/Label.js +1 -1
  55. package/lib/Types/LabelAssociation.js +1 -1
  56. package/lib/Types/Message.d.ts +21 -148
  57. package/lib/Types/Message.js +2 -0
  58. package/lib/Types/Newsletter.d.ts +97 -73
  59. package/lib/Types/Newsletter.js +38 -18
  60. package/lib/Types/Socket.d.ts +9 -17
  61. package/lib/Types/index.d.ts +1 -8
  62. package/lib/Types/index.js +2 -2
  63. package/lib/Utils/auth-utils.d.ts +3 -3
  64. package/lib/Utils/auth-utils.js +13 -6
  65. package/lib/Utils/business.js +2 -2
  66. package/lib/Utils/chat-utils.d.ts +16 -15
  67. package/lib/Utils/chat-utils.js +35 -36
  68. package/lib/Utils/crypto.d.ts +16 -15
  69. package/lib/Utils/crypto.js +29 -71
  70. package/lib/Utils/decode-wa-message.d.ts +6 -22
  71. package/lib/Utils/decode-wa-message.js +56 -65
  72. package/lib/Utils/event-buffer.d.ts +2 -2
  73. package/lib/Utils/event-buffer.js +7 -11
  74. package/lib/Utils/generics.d.ts +20 -17
  75. package/lib/Utils/generics.js +76 -96
  76. package/lib/Utils/history.d.ts +0 -4
  77. package/lib/Utils/history.js +6 -4
  78. package/lib/Utils/link-preview.d.ts +2 -2
  79. package/lib/Utils/link-preview.js +1 -34
  80. package/lib/Utils/logger.d.ts +3 -10
  81. package/lib/Utils/lt-hash.d.ts +2 -2
  82. package/lib/Utils/lt-hash.js +6 -6
  83. package/lib/Utils/make-mutex.d.ts +2 -2
  84. package/lib/Utils/messages-media.d.ts +24 -28
  85. package/lib/Utils/messages-media.js +236 -296
  86. package/lib/Utils/messages.d.ts +10 -13
  87. package/lib/Utils/messages.js +92 -325
  88. package/lib/Utils/noise-handler.d.ts +12 -10
  89. package/lib/Utils/noise-handler.js +23 -18
  90. package/lib/Utils/process-message.d.ts +4 -5
  91. package/lib/Utils/process-message.js +25 -108
  92. package/lib/Utils/signal.d.ts +1 -2
  93. package/lib/Utils/signal.js +26 -26
  94. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  95. package/lib/Utils/use-multi-file-auth-state.js +6 -51
  96. package/lib/Utils/validate-connection.d.ts +4 -3
  97. package/lib/Utils/validate-connection.js +52 -20
  98. package/lib/WABinary/constants.d.ts +27 -24
  99. package/lib/WABinary/constants.js +13 -1276
  100. package/lib/WABinary/decode.d.ts +4 -3
  101. package/lib/WABinary/decode.js +13 -26
  102. package/lib/WABinary/encode.d.ts +2 -1
  103. package/lib/WABinary/encode.js +152 -137
  104. package/lib/WABinary/generic-utils.d.ts +4 -1
  105. package/lib/WABinary/generic-utils.js +125 -37
  106. package/lib/WABinary/jid-utils.d.ts +5 -11
  107. package/lib/WABinary/jid-utils.js +5 -28
  108. package/lib/WAM/BinaryInfo.d.ts +11 -2
  109. package/lib/WAM/encode.d.ts +2 -1
  110. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  111. package/lib/index.d.ts +1 -0
  112. package/lib/index.js +36 -43
  113. package/package.json +1 -1
  114. package/WAProto/GenerateStatics.sh +0 -4
  115. package/WAProto/WAProto.proto +0 -4775
  116. package/WAProto/index.d.ts +0 -55057
  117. package/WAProto/index.ts.ts +0 -53473
  118. package/WAProto/p.html +0 -1
  119. package/lib/Defaults/wileys-version.json +0 -3
  120. package/lib/WABinary/jid-utils.js.bak +0 -83
  121. /package/{README.MD → README.md} +0 -0
@@ -4,12 +4,11 @@ import { AuthenticationCreds } from './Auth';
4
4
  import { WACallEvent } from './Call';
5
5
  import { Chat, ChatUpdate, PresenceData } from './Chat';
6
6
  import { Contact } from './Contact';
7
- import { GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod } from './GroupMetadata';
7
+ import { GroupMetadata, ParticipantAction } from './GroupMetadata';
8
8
  import { Label } from './Label';
9
9
  import { LabelAssociation } from './LabelAssociation';
10
10
  import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message';
11
11
  import { ConnectionState } from './State';
12
- import { NewsletterSettingsUpdate, SubscriberAction, NewsletterViewRole } from './Newsletter';
13
12
  export type BaileysEventMap = {
14
13
  /** connection state has been updated -- WS closed, opened, connecting etc. */
15
14
  'connection.update': Partial<ConnectionState>;
@@ -20,10 +19,7 @@ export type BaileysEventMap = {
20
19
  chats: Chat[];
21
20
  contacts: Contact[];
22
21
  messages: WAMessage[];
23
- isLatest?: boolean;
24
- progress?: number | null;
25
- syncType?: proto.HistorySync.HistorySyncType;
26
- peerDataRequestSessionId?: string | null;
22
+ isLatest: boolean;
27
23
  };
28
24
  /** upsert chats */
29
25
  'chats.upsert': Chat[];
@@ -62,12 +58,10 @@ export type BaileysEventMap = {
62
58
  /**
63
59
  * add/update the given messages. If they were received while the connection was online,
64
60
  * the update will have type: "notify"
65
- * if requestId is provided, then the messages was received from the phone due to it being unavailable
66
61
  * */
67
62
  'messages.upsert': {
68
63
  messages: WAMessage[];
69
64
  type: MessageUpsertType;
70
- requestId?: string;
71
65
  };
72
66
  /** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
73
67
  'messages.reaction': {
@@ -84,39 +78,6 @@ export type BaileysEventMap = {
84
78
  participants: string[];
85
79
  action: ParticipantAction;
86
80
  };
87
- 'group.join-request': {
88
- id: string;
89
- author: string;
90
- participant: string;
91
- action: RequestJoinAction;
92
- method: RequestJoinMethod;
93
- };
94
- 'newsletter.reaction': {
95
- id: string;
96
- server_id: string;
97
- reaction: {
98
- code?: string;
99
- count?: number;
100
- removed?: boolean;
101
- };
102
- };
103
- 'newsletter.view': {
104
- id: string;
105
- server_id: string;
106
- count: number;
107
- };
108
- /**don't handles subscribe/unsubscribe actions */
109
- 'newsletter-participants.update': {
110
- id: string;
111
- author: string;
112
- user: string;
113
- new_role: NewsletterViewRole;
114
- action: SubscriberAction;
115
- };
116
- 'newsletter-settings.update': {
117
- id: string;
118
- update: NewsletterSettingsUpdate;
119
- };
120
81
  'blocklist.set': {
121
82
  blocklist: string[];
122
83
  };
@@ -145,9 +106,6 @@ export type BufferedEventData = {
145
106
  };
146
107
  empty: boolean;
147
108
  isLatest: boolean;
148
- progress?: number | null;
149
- syncType?: proto.HistorySync.HistorySyncType;
150
- peerDataRequestSessionId?: string;
151
109
  };
152
110
  chatUpserts: {
153
111
  [jid: string]: Chat;
@@ -3,30 +3,21 @@ export type GroupParticipant = (Contact & {
3
3
  isAdmin?: boolean;
4
4
  isSuperAdmin?: boolean;
5
5
  admin?: 'admin' | 'superadmin' | null;
6
- jid?: string;
7
- lid?: string;
8
6
  });
9
- export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify';
10
- export type RequestJoinAction = 'created' | 'revoked' | 'rejected';
11
- export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined;
7
+ export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote';
12
8
  export interface GroupMetadata {
13
9
  id: string;
14
- /** group uses 'lid' or 'pn' to send messages */
15
- addressingMode: 'pn' | 'lid';
16
10
  owner: string | undefined;
17
- ownerLid?: string | undefined;
18
11
  subject: string;
12
+ addressingMode: "pn" | "lid";
19
13
  /** group subject owner */
20
14
  subjectOwner?: string;
21
- subjectOwnerLid?: string;
22
15
  /** group subject modification date */
23
16
  subjectTime?: number;
24
17
  creation?: number;
25
18
  desc?: string;
26
19
  descOwner?: string;
27
- descOwnerLid?: string;
28
20
  descId?: string;
29
- descTime?: number;
30
21
  /** if this group is part of a community, it returns the jid of the community to which it belongs */
31
22
  linkedParent?: string;
32
23
  /** is set when the group only allows admins to change group settings */
@@ -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 = {}));
@@ -1,39 +1,32 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
1
4
  import { AxiosRequestConfig } from 'axios';
5
+ import type { Logger } from 'pino';
2
6
  import type { Readable } from 'stream';
3
7
  import type { URL } from 'url';
8
+ import { BinaryNode } from '../WABinary';
4
9
  import { proto } from '../../WAProto';
5
10
  import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults';
6
- import { BinaryNode } from '../WABinary';
7
11
  import type { GroupMetadata } from './GroupMetadata';
8
12
  import { CacheStore } from './Socket';
9
- import { ILogger } from '../Utils/logger';
10
13
  export { proto as WAProto };
11
- export type WAMessage = proto.IWebMessageInfo & {
12
- key: WAMessageKey;
13
- };
14
+ export type WAMessage = proto.IWebMessageInfo;
14
15
  export type WAMessageContent = proto.IMessage;
15
16
  export type WAContactMessage = proto.Message.IContactMessage;
16
17
  export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
17
- export type WAMessageKey = proto.IMessageKey & {
18
- senderPn?: string;
19
- senderLid?: string;
20
- participantLid?: string;
21
- server_id?: string;
22
- isViewOnce?: boolean;
23
- };
18
+ export type WAMessageKey = proto.IMessageKey;
24
19
  export type WATextMessage = proto.Message.IExtendedTextMessage;
25
20
  export type WAContextInfo = proto.IContextInfo;
26
21
  export type WALocationMessage = proto.Message.ILocationMessage;
27
22
  export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
28
- export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
29
- export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
30
- export type WAMediaPayloadURL = {
23
+ export import WAMessageStubType = proto.WebMessageInfo.StubType;
24
+ export import WAMessageStatus = proto.WebMessageInfo.Status;
25
+ export type WAMediaUpload = Buffer | {
31
26
  url: URL | string;
32
- };
33
- export type WAMediaPayloadStream = {
27
+ } | {
34
28
  stream: Readable;
35
29
  };
36
- export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
37
30
  /** Set of message types that are supported by the library */
38
31
  export type MessageType = keyof proto.Message;
39
32
  export type DownloadableMessage = {
@@ -80,24 +73,6 @@ type Templatable = {
80
73
  templateButtons?: proto.IHydratedTemplateButton[];
81
74
  footer?: string;
82
75
  };
83
- type Interactiveable = {
84
- /** add buttons to the message */
85
- interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.NativeFlowButton[];
86
- title?: string;
87
- subtitle?: string;
88
- media?: boolean;
89
- };
90
- type Shopable = {
91
- shop?: proto.Message.InteractiveMessage.ShopMessage.Surface;
92
- id?: string;
93
- title?: string;
94
- subtitle?: string;
95
- media?: boolean;
96
- };
97
- type Cardsable = {
98
- cards?: string[];
99
- subtitle?: string;
100
- };
101
76
  type Editable = {
102
77
  edit?: WAMessageKey;
103
78
  };
@@ -106,10 +81,8 @@ type Listable = {
106
81
  sections?: proto.Message.ListMessage.ISection[];
107
82
  /** Title of a List Message only */
108
83
  title?: string;
109
- /** Text of the button on the list (required) */
84
+ /** Text of the bnutton on the list (required) */
110
85
  buttonText?: string;
111
- /** ListType of a List Message only */
112
- listType?: proto.Message.ListMessage.ListType;
113
86
  };
114
87
  type WithDimensions = {
115
88
  width?: number;
@@ -121,7 +94,6 @@ export type PollMessageOptions = {
121
94
  values: string[];
122
95
  /** 32 byte message secret to encrypt poll selections */
123
96
  messageSecret?: Uint8Array;
124
- toAnnouncementGroup?: boolean;
125
97
  };
126
98
  type SharePhoneNumber = {
127
99
  sharePhoneNumber: boolean;
@@ -134,14 +106,14 @@ export type AnyMediaMessageContent = (({
134
106
  image: WAMediaUpload;
135
107
  caption?: string;
136
108
  jpegThumbnail?: string;
137
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Cardsable & WithDimensions) | ({
109
+ } & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | ({
138
110
  video: WAMediaUpload;
139
111
  caption?: string;
140
112
  gifPlayback?: boolean;
141
113
  jpegThumbnail?: string;
142
114
  /** if set to true, will send as a `video note` */
143
115
  ptv?: boolean;
144
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Cardsable & WithDimensions) | {
116
+ } & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | {
145
117
  audio: WAMediaUpload;
146
118
  /** if set to true, will send as a `voice note` */
147
119
  ptt?: boolean;
@@ -155,7 +127,7 @@ export type AnyMediaMessageContent = (({
155
127
  mimetype: string;
156
128
  fileName?: string;
157
129
  caption?: string;
158
- } & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Cardsable)) & {
130
+ } & Contextable & Buttonable & Templatable)) & {
159
131
  mimetype?: string;
160
132
  } & Editable;
161
133
  export type ButtonReplyInfo = {
@@ -163,76 +135,13 @@ export type ButtonReplyInfo = {
163
135
  id: string;
164
136
  index: number;
165
137
  };
166
- export type GroupInviteInfo = {
167
- inviteCode: string;
168
- inviteExpiration: number;
169
- text: string;
170
- jid: string;
171
- subject: string;
172
- };
173
- export type CallCreationInfo = {
174
- time?: number;
175
- title?: string;
176
- type?: number;
177
- };
178
- export type AdminInviteInfo = {
179
- inviteExpiration: number;
180
- text: string;
181
- jid: string;
182
- subject: string;
183
- thumbnail: Buffer;
184
- };
185
- export type PaymentInviteInfo = {
186
- type?: number;
187
- expiry?: number;
188
- };
189
- export type RequestPaymentInfo = {
190
- expiry: number;
191
- amount: number;
192
- currency: string;
193
- from: string;
194
- note?: string;
195
- sticker?: WAMediaUpload;
196
- background: string;
197
- /** add contextInfo to the message */
198
- contextInfo?: proto.IContextInfo;
199
- };
200
- export type EventsInfo = {
201
- isCanceled?: boolean;
202
- name: string;
203
- description: string;
204
- joinLink?: string;
205
- startTime?: number;
206
- messageSecret?: Uint8Array;
207
- };
208
- export type OrderInfo = {
209
- id: number;
210
- thumbnail: string;
211
- itemCount: number;
212
- status: number;
213
- surface: number;
214
- title: string;
215
- text: string;
216
- seller: string;
217
- token: string;
218
- amount: number;
219
- currency: string;
220
- };
221
138
  export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
222
139
  productImage: WAMediaUpload;
223
140
  };
224
- export type AlbumMedia = {
225
- image: WAMediaUpload;
226
- caption?: string;
227
- } | {
228
- video: WAMediaUpload;
229
- caption?: string;
230
- gifPlayback?: boolean;
231
- };
232
141
  export type AnyRegularMessageContent = (({
233
142
  text: string;
234
143
  linkPreview?: WAUrlInfo | null;
235
- } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Cardsable & Listable & Editable) | AnyMediaMessageContent | ({
144
+ } & Mentionable & Contextable & Buttonable & Templatable & Listable & Editable) | AnyMediaMessageContent | ({
236
145
  poll: PollMessageOptions;
237
146
  } & Mentionable & Contextable & Buttonable & Templatable & Editable) | {
238
147
  contacts: {
@@ -246,47 +155,14 @@ export type AnyRegularMessageContent = (({
246
155
  } | {
247
156
  buttonReply: ButtonReplyInfo;
248
157
  type: 'template' | 'plain';
249
- } | {
250
- groupInvite: GroupInviteInfo;
251
158
  } | {
252
159
  listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
253
160
  } | {
254
- pin: WAMessageKey;
255
- type: proto.PinInChat.Type;
256
- /**
257
- * 24 hours, 7 days, 30 days
258
- */
259
- time?: 86400 | 604800 | 2592000;
260
- } | {
261
- keep: WAMessageKey;
262
- type: number;
263
- /**
264
- * 24 hours, 7 days, 90 days
265
- */
266
- time?: 86400 | 604800 | 7776000;
267
- } | {
268
- paymentInvite: PaymentInviteInfo;
269
- } | {
270
- requestPayment: RequestPaymentInfo;
271
- } | {
272
- event: EventsInfo;
273
- } | {
274
- order: OrderInfo;
275
- } | {
276
- call: CallCreationInfo;
277
- } | {
278
- inviteAdmin: AdminInviteInfo;
279
- } | {
280
- listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
281
- } | ({
282
161
  product: WASendableProduct;
283
162
  businessOwnerJid?: string;
284
163
  body?: string;
285
164
  footer?: string;
286
- } & Mentionable & Contextable & Interactiveable & Shopable & Cardsable & WithDimensions) | SharePhoneNumber | RequestPhoneNumber | ({
287
- album: AlbumMedia[];
288
- caption?: string;
289
- } & Mentionable & Contextable & Editable)) & ViewOnce;
165
+ } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
290
166
  export type AnyMessageContent = AnyRegularMessageContent | {
291
167
  forward: WAMessage;
292
168
  force?: boolean;
@@ -300,8 +176,8 @@ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
300
176
  type MinimalRelayOptions = {
301
177
  /** override the message ID with a custom provided string */
302
178
  messageId?: string;
303
- /** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
304
- useCachedGroupMetadata?: boolean;
179
+ /** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
180
+ cachedGroupMetadata?: (jid: string) => Promise<GroupMetadataParticipants | undefined>;
305
181
  };
306
182
  export type MessageRelayOptions = MinimalRelayOptions & {
307
183
  /** only send to a specific participant; used when a message decryption fails for a single user */
@@ -318,13 +194,13 @@ export type MessageRelayOptions = MinimalRelayOptions & {
318
194
  useUserDevicesCache?: boolean;
319
195
  /** jid list of participants for status@broadcast */
320
196
  statusJidList?: string[];
321
- newsletter?: boolean;
322
197
  };
323
198
  export type MiscMessageGenerationOptions = MinimalRelayOptions & {
324
199
  /** optional, if you want to manually set the timestamp of the message */
325
200
  timestamp?: Date;
326
201
  /** the message you want to quote */
327
202
  quoted?: WAMessage;
203
+ additionalNodes?: BinaryNode[];
328
204
  /** disappearing messages settings */
329
205
  ephemeralExpiration?: number | string;
330
206
  /** timeout for media upload to WA server */
@@ -337,8 +213,6 @@ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
337
213
  font?: number;
338
214
  /** if it is broadcast */
339
215
  broadcast?: boolean;
340
- newsletter?: boolean;
341
- additionalNodes?: BinaryNode[];
342
216
  };
343
217
  export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
344
218
  userJid: string;
@@ -355,7 +229,7 @@ export type WAMediaUploadFunction = (readStream: Readable | Buffer, opts: WAMedi
355
229
  handle?: string;
356
230
  }>;
357
231
  export type MediaGenerationOptions = {
358
- logger?: ILogger;
232
+ logger?: Logger;
359
233
  mediaTypeOverride?: MediaType;
360
234
  upload: WAMediaUploadFunction;
361
235
  /** cache media so it does not have to be uploaded again */
@@ -369,7 +243,6 @@ export type MediaGenerationOptions = {
369
243
  };
370
244
  export type MessageContentGenerationOptions = MediaGenerationOptions & {
371
245
  getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
372
- getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
373
246
  };
374
247
  export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
375
248
  /**
@@ -3,5 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WAMessageStatus = exports.WAMessageStubType = exports.WAProto = void 0;
4
4
  const WAProto_1 = require("../../WAProto");
5
5
  Object.defineProperty(exports, "WAProto", { enumerable: true, get: function () { return WAProto_1.proto; } });
6
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
6
7
  exports.WAMessageStubType = WAProto_1.proto.WebMessageInfo.StubType;
8
+ // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
7
9
  exports.WAMessageStatus = WAProto_1.proto.WebMessageInfo.Status;
@@ -1,79 +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;
48
+ reaction_codes: {
49
+ blocked_codes: null
50
+ enabled_ts_sec: null
51
+ value: NewsletterReactionMode
52
+ }
53
+ }
54
+
55
+ /** only exists reaction mode update */
56
+ export type NewsletterSettingsUpdate = ReactionModeUpdate
57
+
53
58
  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"
59
+ count: number
60
+ code: string
71
61
  }
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"
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
79
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,18 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- 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 = {}));
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