alipclutch-baileys 8.3.0 → 8.4.1
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.
- package/LICENSE +3 -1
- package/README.md +10 -9
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +4775 -0
- package/WAProto/index.d.ts +55057 -0
- package/WAProto/index.js +56887 -17535
- package/WAProto/index.ts.ts +53473 -0
- package/lib/Defaults/baileys-version.json +2 -2
- package/lib/Defaults/index.d.ts +16 -7
- package/lib/Defaults/index.js +90 -119
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/types.d.ts +0 -1
- package/lib/Socket/Client/types.js +0 -1
- package/lib/Socket/Client/websocket.d.ts +0 -1
- package/lib/Socket/Client/websocket.js +0 -1
- package/lib/Socket/business.d.ts +59 -58
- package/lib/Socket/chats.d.ts +45 -230
- package/lib/Socket/chats.js +139 -238
- package/lib/Socket/groups.d.ts +41 -32
- package/lib/Socket/groups.js +38 -23
- package/lib/Socket/index.d.ts +63 -64
- package/lib/Socket/index.js +2 -3
- package/lib/Socket/messages-recv.js +9 -65
- package/lib/Socket/messages-send.d.ts +49 -47
- package/lib/Socket/messages-send.js +584 -395
- package/lib/Socket/newsletter.d.ts +39 -37
- package/lib/Socket/newsletter.js +88 -123
- package/lib/Socket/setup.js +433 -0
- package/lib/Socket/{dugong.d.ts → setup.ts} +17 -52
- package/lib/Socket/socket.d.ts +10 -10
- package/lib/Socket/socket.js +62 -38
- package/lib/Socket/usync.d.ts +3 -4
- package/lib/Socket/usync.js +0 -1
- package/lib/Store/index.d.ts +1 -2
- package/lib/Store/index.js +1 -3
- package/lib/Store/make-in-memory-store.d.ts +24 -24
- package/lib/Store/make-in-memory-store.js +26 -14
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +0 -7
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +14 -7
- package/lib/Types/Contact.d.ts +5 -1
- package/lib/Types/Events.d.ts +44 -2
- package/lib/Types/GroupMetadata.d.ts +11 -2
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +148 -21
- package/lib/Types/Message.js +0 -2
- package/lib/Types/Newsletter.d.ts +73 -97
- package/lib/Types/Newsletter.js +18 -38
- package/lib/Types/Socket.d.ts +17 -9
- package/lib/Types/index.d.ts +8 -1
- package/lib/Types/index.js +2 -2
- package/lib/Utils/auth-utils.d.ts +3 -3
- package/lib/Utils/auth-utils.js +6 -13
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +15 -16
- package/lib/Utils/chat-utils.js +36 -35
- package/lib/Utils/crypto.d.ts +15 -16
- package/lib/Utils/crypto.js +71 -29
- package/lib/Utils/decode-wa-message.d.ts +22 -6
- package/lib/Utils/decode-wa-message.js +65 -56
- package/lib/Utils/event-buffer.d.ts +2 -2
- package/lib/Utils/event-buffer.js +11 -7
- package/lib/Utils/generics.d.ts +17 -20
- package/lib/Utils/generics.js +95 -75
- package/lib/Utils/history.d.ts +4 -0
- package/lib/Utils/history.js +4 -6
- package/lib/Utils/link-preview.d.ts +2 -2
- package/lib/Utils/link-preview.js +34 -1
- package/lib/Utils/logger.d.ts +10 -3
- package/lib/Utils/lt-hash.d.ts +2 -2
- package/lib/Utils/lt-hash.js +6 -6
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +28 -24
- package/lib/Utils/messages-media.js +272 -111
- package/lib/Utils/messages.d.ts +13 -10
- package/lib/Utils/messages.js +323 -50
- package/lib/Utils/noise-handler.d.ts +10 -12
- package/lib/Utils/noise-handler.js +18 -23
- package/lib/Utils/process-message.d.ts +5 -4
- package/lib/Utils/process-message.js +108 -25
- package/lib/Utils/signal.d.ts +2 -1
- package/lib/Utils/signal.js +26 -26
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -1
- package/lib/Utils/use-multi-file-auth-state.js +51 -6
- package/lib/Utils/validate-connection.d.ts +3 -4
- package/lib/Utils/validate-connection.js +90 -66
- package/lib/WABinary/constants.d.ts +24 -27
- package/lib/WABinary/constants.js +1276 -13
- package/lib/WABinary/decode.d.ts +3 -4
- package/lib/WABinary/decode.js +26 -13
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +137 -152
- package/lib/WABinary/generic-utils.d.ts +1 -4
- package/lib/WABinary/generic-utils.js +37 -125
- package/lib/WABinary/jid-utils.d.ts +11 -5
- package/lib/WABinary/jid-utils.js +28 -5
- package/lib/WABinary/jid-utils.js.bak +83 -0
- package/lib/WAM/BinaryInfo.d.ts +2 -11
- package/lib/WAM/encode.d.ts +1 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +27 -15
- package/package.json +18 -31
- package/engine-requirements.js +0 -10
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/Client/web-socket-client.js +0 -62
- package/lib/Socket/dugong.js +0 -483
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/registration.js +0 -166
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-cache-manager-store.js +0 -83
|
@@ -3,21 +3,30 @@ export type GroupParticipant = (Contact & {
|
|
|
3
3
|
isAdmin?: boolean;
|
|
4
4
|
isSuperAdmin?: boolean;
|
|
5
5
|
admin?: 'admin' | 'superadmin' | null;
|
|
6
|
+
jid?: string;
|
|
7
|
+
lid?: string;
|
|
6
8
|
});
|
|
7
|
-
export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote';
|
|
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;
|
|
8
12
|
export interface GroupMetadata {
|
|
9
13
|
id: string;
|
|
14
|
+
/** group uses 'lid' or 'pn' to send messages */
|
|
15
|
+
addressingMode: 'pn' | 'lid';
|
|
10
16
|
owner: string | undefined;
|
|
17
|
+
ownerLid?: string | undefined;
|
|
11
18
|
subject: string;
|
|
12
|
-
addressingMode: "pn" | "lid";
|
|
13
19
|
/** group subject owner */
|
|
14
20
|
subjectOwner?: string;
|
|
21
|
+
subjectOwnerLid?: string;
|
|
15
22
|
/** group subject modification date */
|
|
16
23
|
subjectTime?: number;
|
|
17
24
|
creation?: number;
|
|
18
25
|
desc?: string;
|
|
19
26
|
descOwner?: string;
|
|
27
|
+
descOwnerLid?: string;
|
|
20
28
|
descId?: string;
|
|
29
|
+
descTime?: number;
|
|
21
30
|
/** if this group is part of a community, it returns the jid of the community to which it belongs */
|
|
22
31
|
linkedParent?: string;
|
|
23
32
|
/** is set when the group only allows admins to change group settings */
|
package/lib/Types/Label.js
CHANGED
|
@@ -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
|
|
27
|
+
})(LabelColor || (exports.LabelColor = 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
|
|
9
|
+
})(LabelAssociationType || (exports.LabelAssociationType = LabelAssociationType = {}));
|
package/lib/Types/Message.d.ts
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
1
|
import { AxiosRequestConfig } from 'axios';
|
|
5
|
-
import type { Logger } from 'pino';
|
|
6
2
|
import type { Readable } from 'stream';
|
|
7
3
|
import type { URL } from 'url';
|
|
8
|
-
import { BinaryNode } from '../WABinary';
|
|
9
4
|
import { proto } from '../../WAProto';
|
|
10
5
|
import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults';
|
|
6
|
+
import { BinaryNode } from '../WABinary';
|
|
11
7
|
import type { GroupMetadata } from './GroupMetadata';
|
|
12
8
|
import { CacheStore } from './Socket';
|
|
9
|
+
import { ILogger } from '../Utils/logger';
|
|
13
10
|
export { proto as WAProto };
|
|
14
|
-
export type WAMessage = proto.IWebMessageInfo
|
|
11
|
+
export type WAMessage = proto.IWebMessageInfo & {
|
|
12
|
+
key: WAMessageKey;
|
|
13
|
+
};
|
|
15
14
|
export type WAMessageContent = proto.IMessage;
|
|
16
15
|
export type WAContactMessage = proto.Message.IContactMessage;
|
|
17
16
|
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
|
|
18
|
-
export type WAMessageKey = proto.IMessageKey
|
|
17
|
+
export type WAMessageKey = proto.IMessageKey & {
|
|
18
|
+
senderPn?: string;
|
|
19
|
+
senderLid?: string;
|
|
20
|
+
participantLid?: string;
|
|
21
|
+
server_id?: string;
|
|
22
|
+
isViewOnce?: boolean;
|
|
23
|
+
};
|
|
19
24
|
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
|
20
25
|
export type WAContextInfo = proto.IContextInfo;
|
|
21
26
|
export type WALocationMessage = proto.Message.ILocationMessage;
|
|
22
27
|
export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export type
|
|
28
|
+
export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
|
|
29
|
+
export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
|
|
30
|
+
export type WAMediaPayloadURL = {
|
|
26
31
|
url: URL | string;
|
|
27
|
-
}
|
|
32
|
+
};
|
|
33
|
+
export type WAMediaPayloadStream = {
|
|
28
34
|
stream: Readable;
|
|
29
35
|
};
|
|
36
|
+
export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
|
|
30
37
|
/** Set of message types that are supported by the library */
|
|
31
38
|
export type MessageType = keyof proto.Message;
|
|
32
39
|
export type DownloadableMessage = {
|
|
@@ -73,6 +80,24 @@ type Templatable = {
|
|
|
73
80
|
templateButtons?: proto.IHydratedTemplateButton[];
|
|
74
81
|
footer?: string;
|
|
75
82
|
};
|
|
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
|
+
};
|
|
76
101
|
type Editable = {
|
|
77
102
|
edit?: WAMessageKey;
|
|
78
103
|
};
|
|
@@ -81,8 +106,10 @@ type Listable = {
|
|
|
81
106
|
sections?: proto.Message.ListMessage.ISection[];
|
|
82
107
|
/** Title of a List Message only */
|
|
83
108
|
title?: string;
|
|
84
|
-
/** Text of the
|
|
109
|
+
/** Text of the button on the list (required) */
|
|
85
110
|
buttonText?: string;
|
|
111
|
+
/** ListType of a List Message only */
|
|
112
|
+
listType?: proto.Message.ListMessage.ListType;
|
|
86
113
|
};
|
|
87
114
|
type WithDimensions = {
|
|
88
115
|
width?: number;
|
|
@@ -94,6 +121,7 @@ export type PollMessageOptions = {
|
|
|
94
121
|
values: string[];
|
|
95
122
|
/** 32 byte message secret to encrypt poll selections */
|
|
96
123
|
messageSecret?: Uint8Array;
|
|
124
|
+
toAnnouncementGroup?: boolean;
|
|
97
125
|
};
|
|
98
126
|
type SharePhoneNumber = {
|
|
99
127
|
sharePhoneNumber: boolean;
|
|
@@ -106,14 +134,14 @@ export type AnyMediaMessageContent = (({
|
|
|
106
134
|
image: WAMediaUpload;
|
|
107
135
|
caption?: string;
|
|
108
136
|
jpegThumbnail?: string;
|
|
109
|
-
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | ({
|
|
137
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Cardsable & WithDimensions) | ({
|
|
110
138
|
video: WAMediaUpload;
|
|
111
139
|
caption?: string;
|
|
112
140
|
gifPlayback?: boolean;
|
|
113
141
|
jpegThumbnail?: string;
|
|
114
142
|
/** if set to true, will send as a `video note` */
|
|
115
143
|
ptv?: boolean;
|
|
116
|
-
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | {
|
|
144
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Cardsable & WithDimensions) | {
|
|
117
145
|
audio: WAMediaUpload;
|
|
118
146
|
/** if set to true, will send as a `voice note` */
|
|
119
147
|
ptt?: boolean;
|
|
@@ -127,7 +155,7 @@ export type AnyMediaMessageContent = (({
|
|
|
127
155
|
mimetype: string;
|
|
128
156
|
fileName?: string;
|
|
129
157
|
caption?: string;
|
|
130
|
-
} & Contextable & Buttonable & Templatable)) & {
|
|
158
|
+
} & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Cardsable)) & {
|
|
131
159
|
mimetype?: string;
|
|
132
160
|
} & Editable;
|
|
133
161
|
export type ButtonReplyInfo = {
|
|
@@ -135,13 +163,76 @@ export type ButtonReplyInfo = {
|
|
|
135
163
|
id: string;
|
|
136
164
|
index: number;
|
|
137
165
|
};
|
|
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
|
+
};
|
|
138
221
|
export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
|
|
139
222
|
productImage: WAMediaUpload;
|
|
140
223
|
};
|
|
224
|
+
export type AlbumMedia = {
|
|
225
|
+
image: WAMediaUpload;
|
|
226
|
+
caption?: string;
|
|
227
|
+
} | {
|
|
228
|
+
video: WAMediaUpload;
|
|
229
|
+
caption?: string;
|
|
230
|
+
gifPlayback?: boolean;
|
|
231
|
+
};
|
|
141
232
|
export type AnyRegularMessageContent = (({
|
|
142
233
|
text: string;
|
|
143
234
|
linkPreview?: WAUrlInfo | null;
|
|
144
|
-
} & Mentionable & Contextable & Buttonable & Templatable & Listable & Editable) | AnyMediaMessageContent | ({
|
|
235
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Cardsable & Listable & Editable) | AnyMediaMessageContent | ({
|
|
145
236
|
poll: PollMessageOptions;
|
|
146
237
|
} & Mentionable & Contextable & Buttonable & Templatable & Editable) | {
|
|
147
238
|
contacts: {
|
|
@@ -155,14 +246,47 @@ export type AnyRegularMessageContent = (({
|
|
|
155
246
|
} | {
|
|
156
247
|
buttonReply: ButtonReplyInfo;
|
|
157
248
|
type: 'template' | 'plain';
|
|
249
|
+
} | {
|
|
250
|
+
groupInvite: GroupInviteInfo;
|
|
158
251
|
} | {
|
|
159
252
|
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
|
160
253
|
} | {
|
|
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
|
+
} | ({
|
|
161
282
|
product: WASendableProduct;
|
|
162
283
|
businessOwnerJid?: string;
|
|
163
284
|
body?: string;
|
|
164
285
|
footer?: string;
|
|
165
|
-
} | SharePhoneNumber | RequestPhoneNumber
|
|
286
|
+
} & Mentionable & Contextable & Interactiveable & Shopable & Cardsable & WithDimensions) | SharePhoneNumber | RequestPhoneNumber | ({
|
|
287
|
+
album: AlbumMedia[];
|
|
288
|
+
caption?: string;
|
|
289
|
+
} & Mentionable & Contextable & Editable)) & ViewOnce;
|
|
166
290
|
export type AnyMessageContent = AnyRegularMessageContent | {
|
|
167
291
|
forward: WAMessage;
|
|
168
292
|
force?: boolean;
|
|
@@ -176,8 +300,8 @@ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
|
|
|
176
300
|
type MinimalRelayOptions = {
|
|
177
301
|
/** override the message ID with a custom provided string */
|
|
178
302
|
messageId?: string;
|
|
179
|
-
/**
|
|
180
|
-
|
|
303
|
+
/** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
|
|
304
|
+
useCachedGroupMetadata?: boolean;
|
|
181
305
|
};
|
|
182
306
|
export type MessageRelayOptions = MinimalRelayOptions & {
|
|
183
307
|
/** only send to a specific participant; used when a message decryption fails for a single user */
|
|
@@ -194,13 +318,13 @@ export type MessageRelayOptions = MinimalRelayOptions & {
|
|
|
194
318
|
useUserDevicesCache?: boolean;
|
|
195
319
|
/** jid list of participants for status@broadcast */
|
|
196
320
|
statusJidList?: string[];
|
|
321
|
+
newsletter?: boolean;
|
|
197
322
|
};
|
|
198
323
|
export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
199
324
|
/** optional, if you want to manually set the timestamp of the message */
|
|
200
325
|
timestamp?: Date;
|
|
201
326
|
/** the message you want to quote */
|
|
202
327
|
quoted?: WAMessage;
|
|
203
|
-
additionalNodes?: BinaryNode[];
|
|
204
328
|
/** disappearing messages settings */
|
|
205
329
|
ephemeralExpiration?: number | string;
|
|
206
330
|
/** timeout for media upload to WA server */
|
|
@@ -213,6 +337,8 @@ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
|
213
337
|
font?: number;
|
|
214
338
|
/** if it is broadcast */
|
|
215
339
|
broadcast?: boolean;
|
|
340
|
+
newsletter?: boolean;
|
|
341
|
+
additionalNodes?: BinaryNode[];
|
|
216
342
|
};
|
|
217
343
|
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
|
|
218
344
|
userJid: string;
|
|
@@ -229,7 +355,7 @@ export type WAMediaUploadFunction = (readStream: Readable | Buffer, opts: WAMedi
|
|
|
229
355
|
handle?: string;
|
|
230
356
|
}>;
|
|
231
357
|
export type MediaGenerationOptions = {
|
|
232
|
-
logger?:
|
|
358
|
+
logger?: ILogger;
|
|
233
359
|
mediaTypeOverride?: MediaType;
|
|
234
360
|
upload: WAMediaUploadFunction;
|
|
235
361
|
/** cache media so it does not have to be uploaded again */
|
|
@@ -243,6 +369,7 @@ export type MediaGenerationOptions = {
|
|
|
243
369
|
};
|
|
244
370
|
export type MessageContentGenerationOptions = MediaGenerationOptions & {
|
|
245
371
|
getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
|
|
372
|
+
getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
|
|
246
373
|
};
|
|
247
374
|
export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
|
|
248
375
|
/**
|
package/lib/Types/Message.js
CHANGED
|
@@ -3,7 +3,5 @@ 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
|
|
7
6
|
exports.WAMessageStubType = WAProto_1.proto.WebMessageInfo.StubType;
|
|
8
|
-
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
9
7
|
exports.WAMessageStatus = WAProto_1.proto.WebMessageInfo.Status;
|
|
@@ -1,103 +1,79 @@
|
|
|
1
|
-
import { proto } from
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
7
|
-
export type NewsletterViewRole = "ADMIN" | "GUEST" | "OWNER" | "SUBSCRIBER"
|
|
8
|
-
|
|
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';
|
|
9
7
|
export type NewsletterViewerMetadata = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
8
|
+
mute: NewsletterMute;
|
|
9
|
+
view_role: NewsletterViewRole;
|
|
10
|
+
};
|
|
14
11
|
export type NewsletterMetadata = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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';
|
|
47
44
|
export type ReactionModeUpdate = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
export type NewsletterSettingsUpdate = ReactionModeUpdate
|
|
57
|
-
|
|
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;
|
|
58
53
|
export type NewsletterReaction = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
54
|
+
count: number;
|
|
55
|
+
code: string;
|
|
56
|
+
};
|
|
63
57
|
export type NewsletterFetchedUpdate = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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"
|
|
71
|
+
}
|
|
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"
|
|
72
79
|
}
|
|
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
|
package/lib/Types/Newsletter.js
CHANGED
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
"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 = {}));
|
package/lib/Types/Socket.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
1
|
import { AxiosRequestConfig } from 'axios';
|
|
4
2
|
import type { Agent } from 'https';
|
|
5
|
-
import type { Logger } from 'pino';
|
|
6
3
|
import type { URL } from 'url';
|
|
7
4
|
import { proto } from '../../WAProto';
|
|
8
5
|
import { AuthenticationState, SignalAuthState, TransactionCapabilityOptions } from './Auth';
|
|
6
|
+
import { GroupMetadata } from './GroupMetadata';
|
|
9
7
|
import { MediaConnInfo } from './Message';
|
|
10
8
|
import { SignalRepository } from './Signal';
|
|
9
|
+
import { ILogger } from '../Utils/logger';
|
|
11
10
|
export type WAVersion = [number, number, number];
|
|
12
11
|
export type WABrowserDescription = [string, string, string];
|
|
13
12
|
export type CacheStore = {
|
|
@@ -20,6 +19,9 @@ export type CacheStore = {
|
|
|
20
19
|
/** flush all data */
|
|
21
20
|
flushAll(): void;
|
|
22
21
|
};
|
|
22
|
+
export type PatchedMessageWithRecipientJID = proto.IMessage & {
|
|
23
|
+
recipientJid?: string;
|
|
24
|
+
};
|
|
23
25
|
export type SocketConfig = {
|
|
24
26
|
/** the WS url to connect to WA */
|
|
25
27
|
waWebSocketUrl: string | URL;
|
|
@@ -29,12 +31,14 @@ export type SocketConfig = {
|
|
|
29
31
|
defaultQueryTimeoutMs: number | undefined;
|
|
30
32
|
/** ping-pong interval for WS connection */
|
|
31
33
|
keepAliveIntervalMs: number;
|
|
32
|
-
/** should baileys use the mobile api instead of the multi device api
|
|
34
|
+
/** should baileys use the mobile api instead of the multi device api
|
|
35
|
+
* @deprecated This feature has been removed
|
|
36
|
+
*/
|
|
33
37
|
mobile?: boolean;
|
|
34
38
|
/** proxy agent */
|
|
35
39
|
agent?: Agent;
|
|
36
|
-
/**
|
|
37
|
-
logger:
|
|
40
|
+
/** logger */
|
|
41
|
+
logger: ILogger;
|
|
38
42
|
/** version to connect with */
|
|
39
43
|
version: WAVersion;
|
|
40
44
|
/** override browser config */
|
|
@@ -61,6 +65,8 @@ export type SocketConfig = {
|
|
|
61
65
|
transactionOpts: TransactionCapabilityOptions;
|
|
62
66
|
/** marks the client as online whenever the socket successfully connects */
|
|
63
67
|
markOnlineOnConnect: boolean;
|
|
68
|
+
/** alphanumeric country code (USA -> US) for the number used */
|
|
69
|
+
countryCode: string;
|
|
64
70
|
/** provide a cache to store media, so does not have to be re-uploaded */
|
|
65
71
|
mediaCache?: CacheStore;
|
|
66
72
|
/**
|
|
@@ -71,6 +77,8 @@ export type SocketConfig = {
|
|
|
71
77
|
userDevicesCache?: CacheStore;
|
|
72
78
|
/** cache to store call offers */
|
|
73
79
|
callOfferCache?: CacheStore;
|
|
80
|
+
/** cache to track placeholder resends */
|
|
81
|
+
placeholderResendCache?: CacheStore;
|
|
74
82
|
/** width for link preview images */
|
|
75
83
|
linkPreviewImageThumbnailWidth: number;
|
|
76
84
|
/** Should Baileys ask the phone for full history, will be received async */
|
|
@@ -91,7 +99,7 @@ export type SocketConfig = {
|
|
|
91
99
|
/**
|
|
92
100
|
* Optionally patch the message before sending out
|
|
93
101
|
* */
|
|
94
|
-
patchMessageBeforeSending: (msg: proto.IMessage, recipientJids
|
|
102
|
+
patchMessageBeforeSending: (msg: proto.IMessage, recipientJids?: string[]) => Promise<PatchedMessageWithRecipientJID[] | PatchedMessageWithRecipientJID> | PatchedMessageWithRecipientJID[] | PatchedMessageWithRecipientJID;
|
|
95
103
|
/** verify app state MACs */
|
|
96
104
|
appStateMacVerification: {
|
|
97
105
|
patch: boolean;
|
|
@@ -105,7 +113,7 @@ export type SocketConfig = {
|
|
|
105
113
|
* (solves the "this message can take a while" issue) can be retried
|
|
106
114
|
* */
|
|
107
115
|
getMessage: (key: proto.IMessageKey) => Promise<proto.IMessage | undefined>;
|
|
116
|
+
/** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
|
|
117
|
+
cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>;
|
|
108
118
|
makeSignalRepository: (auth: SignalAuthState) => SignalRepository;
|
|
109
|
-
/** Socket passthrough */
|
|
110
|
-
socket?: any;
|
|
111
119
|
};
|