@hbmodsofc/baileys 1.7.8 → 2.0.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.
- package/LICENSE +1 -1
- package/WAProto/index.js +157084 -24729
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +8 -12
- package/lib/Defaults/index.js +124 -90
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/group_cipher.d.ts +1 -0
- package/lib/Signal/Group/group_cipher.js +39 -28
- package/lib/Signal/Group/queue-job.d.ts +1 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +1 -1
- package/lib/Signal/Group/sender-chain-key.js +2 -9
- package/lib/Signal/Group/sender-key-distribution-message.js +3 -3
- package/lib/Signal/Group/sender-key-message.js +3 -3
- package/lib/Signal/Group/sender-key-state.d.ts +4 -4
- package/lib/Signal/Group/sender-key-state.js +16 -47
- package/lib/Signal/libsignal.d.ts +3 -7
- package/lib/Signal/libsignal.js +39 -224
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +3 -1
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.js +3 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
- package/lib/Socket/Client/{websocket.js → web-socket-client.js} +16 -10
- package/lib/Socket/business.d.ts +78 -94
- package/lib/Socket/business.js +11 -130
- package/lib/Socket/chats.d.ts +233 -63
- package/lib/Socket/chats.js +184 -234
- package/lib/Socket/groups.d.ts +41 -62
- package/lib/Socket/groups.js +64 -76
- package/lib/Socket/hbmods.d.ts +253 -0
- package/lib/Socket/hbmods.js +1 -0
- package/lib/Socket/index.d.ts +83 -129
- package/lib/Socket/index.js +6 -13
- package/lib/Socket/messages-recv.d.ts +48 -59
- package/lib/Socket/messages-recv.js +371 -516
- package/lib/Socket/messages-send.d.ts +67 -86
- package/lib/Socket/messages-send.js +1 -1091
- package/lib/Socket/newsletter.d.ts +64 -76
- package/lib/Socket/newsletter.js +1 -184
- package/lib/Socket/registration.d.ts +267 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +13 -19
- package/lib/Socket/socket.js +1 -805
- package/lib/Socket/usync.d.ts +36 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Types/Auth.d.ts +10 -4
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +9 -29
- package/lib/Types/Chat.js +1 -7
- package/lib/Types/Contact.d.ts +1 -5
- package/lib/Types/Events.d.ts +14 -55
- package/lib/Types/GroupMetadata.d.ts +5 -15
- package/lib/Types/Label.d.ts +0 -11
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +49 -75
- package/lib/Types/Message.js +7 -10
- package/lib/Types/Newsletter.d.ts +98 -129
- package/lib/Types/Newsletter.js +38 -33
- package/lib/Types/Product.d.ts +1 -1
- package/lib/Types/Signal.d.ts +1 -29
- package/lib/Types/Socket.d.ts +22 -48
- package/lib/Types/State.d.ts +2 -13
- package/lib/Types/State.js +0 -12
- package/lib/Types/USync.d.ts +1 -1
- package/lib/Types/index.d.ts +3 -10
- package/lib/Types/index.js +2 -2
- package/lib/Utils/auth-utils.d.ts +3 -3
- package/lib/Utils/auth-utils.js +102 -378
- package/lib/Utils/baileys-event-stream.js +1 -1
- package/lib/Utils/business.d.ts +2 -2
- package/lib/Utils/business.js +13 -19
- package/lib/Utils/chat-utils.d.ts +22 -21
- package/lib/Utils/chat-utils.js +154 -201
- package/lib/Utils/crypto.d.ts +19 -18
- package/lib/Utils/crypto.js +37 -78
- package/lib/Utils/decode-wa-message.d.ts +7 -34
- package/lib/Utils/decode-wa-message.js +66 -138
- package/lib/Utils/event-buffer.d.ts +8 -6
- package/lib/Utils/event-buffer.js +43 -81
- package/lib/Utils/generics.d.ts +27 -27
- package/lib/Utils/generics.js +133 -128
- package/lib/Utils/history.d.ts +5 -9
- package/lib/Utils/history.js +23 -17
- package/lib/Utils/index.d.ts +0 -2
- package/lib/Utils/index.js +0 -2
- package/lib/Utils/link-preview.d.ts +4 -4
- package/lib/Utils/link-preview.js +12 -40
- package/lib/Utils/logger.d.ts +3 -11
- package/lib/Utils/lt-hash.d.ts +8 -8
- package/lib/Utils/lt-hash.js +24 -23
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/make-mutex.js +2 -3
- package/lib/Utils/messages-media.d.ts +41 -37
- package/lib/Utils/messages-media.js +368 -252
- package/lib/Utils/messages.d.ts +15 -13
- package/lib/Utils/messages.js +261 -274
- package/lib/Utils/noise-handler.d.ts +15 -13
- package/lib/Utils/noise-handler.js +26 -20
- package/lib/Utils/process-message.d.ts +8 -9
- package/lib/Utils/process-message.js +93 -157
- package/lib/Utils/signal.d.ts +5 -6
- package/lib/Utils/signal.js +29 -37
- package/lib/Utils/use-multi-file-auth-state.d.ts +2 -1
- package/lib/Utils/use-multi-file-auth-state.js +7 -12
- package/lib/Utils/validate-connection.d.ts +6 -5
- package/lib/Utils/validate-connection.js +97 -39
- package/lib/WABinary/constants.d.ts +27 -24
- package/lib/WABinary/constants.js +13 -1276
- package/lib/WABinary/decode.d.ts +4 -3
- package/lib/WABinary/decode.js +14 -28
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +147 -134
- package/lib/WABinary/generic-utils.d.ts +7 -4
- package/lib/WABinary/generic-utils.js +125 -40
- package/lib/WABinary/jid-utils.d.ts +8 -13
- package/lib/WABinary/jid-utils.js +16 -27
- package/lib/WAM/BinaryInfo.d.ts +11 -2
- package/lib/WAM/constants.d.ts +2 -3
- package/lib/WAM/constants.js +2359 -2252
- package/lib/WAM/encode.d.ts +2 -1
- package/lib/WAM/encode.js +11 -8
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +4 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +5 -5
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +5 -5
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +6 -5
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +2 -2
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +3 -11
- package/lib/WAUSync/USyncQuery.d.ts +2 -2
- package/lib/WAUSync/USyncQuery.js +15 -19
- package/lib/WAUSync/USyncUser.d.ts +5 -5
- package/lib/WAUSync/index.d.ts +1 -1
- package/lib/WAUSync/index.js +1 -1
- package/package.json +102 -104
- package/lib/Signal/lid-mapping.d.ts +0 -26
- package/lib/Signal/lid-mapping.js +0 -146
- package/lib/Socket/communities.d.ts +0 -232
- package/lib/Socket/communities.js +0 -402
- package/lib/Socket/mex.d.ts +0 -2
- package/lib/Socket/mex.js +0 -45
- package/lib/Types/Bussines.d.ts +0 -24
- package/lib/Types/Bussines.js +0 -2
- package/lib/Utils/lidToJid-test.d.ts +0 -11
- package/lib/Utils/lidToJid-test.js +0 -27
- package/lib/Utils/message-retry-manager.d.ts +0 -81
- package/lib/Utils/message-retry-manager.js +0 -152
- /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
package/lib/Types/Message.d.ts
CHANGED
|
@@ -1,45 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
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';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
8
|
+
import { BinaryNode } from '../WABinary';
|
|
9
|
+
import { proto } from '../../WAProto';
|
|
10
|
+
import { MEDIA_HKDF_KEY_MAPPING } from '../Defaults';
|
|
7
11
|
import type { GroupMetadata } from './GroupMetadata';
|
|
8
|
-
import
|
|
12
|
+
import { CacheStore } from './Socket';
|
|
9
13
|
export { proto as WAProto };
|
|
10
|
-
export type WAMessage = proto.IWebMessageInfo
|
|
11
|
-
key: WAMessageKey;
|
|
12
|
-
};
|
|
14
|
+
export type WAMessage = proto.IWebMessageInfo;
|
|
13
15
|
export type WAMessageContent = proto.IMessage;
|
|
14
16
|
export type WAContactMessage = proto.Message.IContactMessage;
|
|
15
17
|
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
|
|
16
|
-
export type WAMessageKey = proto.IMessageKey
|
|
17
|
-
remoteJidAlt?: string;
|
|
18
|
-
participantAlt?: string;
|
|
19
|
-
server_id?: string;
|
|
20
|
-
isViewOnce?: boolean;
|
|
21
|
-
};
|
|
18
|
+
export type WAMessageKey = proto.IMessageKey;
|
|
22
19
|
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
|
23
20
|
export type WAContextInfo = proto.IContextInfo;
|
|
24
21
|
export type WALocationMessage = proto.Message.ILocationMessage;
|
|
25
22
|
export type WAGenericMediaMessage = proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
export type WAMediaPayloadURL = {
|
|
23
|
+
export import WAMessageStubType = proto.WebMessageInfo.StubType;
|
|
24
|
+
export import WAMessageStatus = proto.WebMessageInfo.Status;
|
|
25
|
+
export type WAMediaUpload = Buffer | {
|
|
30
26
|
url: URL | string;
|
|
31
|
-
}
|
|
32
|
-
export type WAMediaPayloadStream = {
|
|
27
|
+
} | {
|
|
33
28
|
stream: Readable;
|
|
34
29
|
};
|
|
35
|
-
export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
|
|
36
30
|
/** Set of message types that are supported by the library */
|
|
37
31
|
export type MessageType = keyof proto.Message;
|
|
38
|
-
export declare enum WAMessageAddressingMode {
|
|
39
|
-
PN = "pn",
|
|
40
|
-
LID = "lid"
|
|
41
|
-
}
|
|
42
|
-
export type MessageWithContextInfo = 'imageMessage' | 'contactMessage' | 'locationMessage' | 'extendedTextMessage' | 'documentMessage' | 'audioMessage' | 'videoMessage' | 'call' | 'contactsArrayMessage' | 'liveLocationMessage' | 'templateMessage' | 'stickerMessage' | 'groupInviteMessage' | 'templateButtonReplyMessage' | 'productMessage' | 'listMessage' | 'orderMessage' | 'listResponseMessage' | 'buttonsMessage' | 'buttonsResponseMessage' | 'interactiveMessage' | 'interactiveResponseMessage' | 'pollCreationMessage' | 'requestPhoneNumberMessage' | 'messageHistoryBundle' | 'eventMessage' | 'newsletterAdminInviteMessage' | 'albumMessage' | 'stickerPackMessage' | 'pollResultSnapshotMessage' | 'messageHistoryNotice';
|
|
43
32
|
export type DownloadableMessage = {
|
|
44
33
|
mediaKey?: Uint8Array | null;
|
|
45
34
|
directPath?: string | null;
|
|
@@ -75,9 +64,26 @@ type Contextable = {
|
|
|
75
64
|
type ViewOnce = {
|
|
76
65
|
viewOnce?: boolean;
|
|
77
66
|
};
|
|
67
|
+
type Buttonable = {
|
|
68
|
+
/** add buttons to the message */
|
|
69
|
+
buttons?: proto.Message.ButtonsMessage.IButton[];
|
|
70
|
+
};
|
|
71
|
+
type Templatable = {
|
|
72
|
+
/** add buttons to the message (conflicts with normal buttons)*/
|
|
73
|
+
templateButtons?: proto.IHydratedTemplateButton[];
|
|
74
|
+
footer?: string;
|
|
75
|
+
};
|
|
78
76
|
type Editable = {
|
|
79
77
|
edit?: WAMessageKey;
|
|
80
78
|
};
|
|
79
|
+
type Listable = {
|
|
80
|
+
/** Sections of the List */
|
|
81
|
+
sections?: proto.Message.ListMessage.ISection[];
|
|
82
|
+
/** Title of a List Message only */
|
|
83
|
+
title?: string;
|
|
84
|
+
/** Text of the bnutton on the list (required) */
|
|
85
|
+
buttonText?: string;
|
|
86
|
+
};
|
|
81
87
|
type WithDimensions = {
|
|
82
88
|
width?: number;
|
|
83
89
|
height?: number;
|
|
@@ -88,19 +94,6 @@ export type PollMessageOptions = {
|
|
|
88
94
|
values: string[];
|
|
89
95
|
/** 32 byte message secret to encrypt poll selections */
|
|
90
96
|
messageSecret?: Uint8Array;
|
|
91
|
-
toAnnouncementGroup?: boolean;
|
|
92
|
-
};
|
|
93
|
-
export type EventMessageOptions = {
|
|
94
|
-
name: string;
|
|
95
|
-
description?: string;
|
|
96
|
-
startDate: Date;
|
|
97
|
-
endDate?: Date;
|
|
98
|
-
location?: WALocationMessage;
|
|
99
|
-
call?: 'audio' | 'video';
|
|
100
|
-
isCancelled?: boolean;
|
|
101
|
-
isScheduleCall?: boolean;
|
|
102
|
-
extraGuestsAllowed?: boolean;
|
|
103
|
-
messageSecret?: Uint8Array<ArrayBufferLike>;
|
|
104
97
|
};
|
|
105
98
|
type SharePhoneNumber = {
|
|
106
99
|
sharePhoneNumber: boolean;
|
|
@@ -108,18 +101,19 @@ type SharePhoneNumber = {
|
|
|
108
101
|
type RequestPhoneNumber = {
|
|
109
102
|
requestPhoneNumber: boolean;
|
|
110
103
|
};
|
|
104
|
+
export type MediaType = keyof typeof MEDIA_HKDF_KEY_MAPPING;
|
|
111
105
|
export type AnyMediaMessageContent = (({
|
|
112
106
|
image: WAMediaUpload;
|
|
113
107
|
caption?: string;
|
|
114
108
|
jpegThumbnail?: string;
|
|
115
|
-
} & Mentionable & Contextable & WithDimensions) | ({
|
|
109
|
+
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | ({
|
|
116
110
|
video: WAMediaUpload;
|
|
117
111
|
caption?: string;
|
|
118
112
|
gifPlayback?: boolean;
|
|
119
113
|
jpegThumbnail?: string;
|
|
120
114
|
/** if set to true, will send as a `video note` */
|
|
121
115
|
ptv?: boolean;
|
|
122
|
-
} & Mentionable & Contextable & WithDimensions) | {
|
|
116
|
+
} & Mentionable & Contextable & Buttonable & Templatable & WithDimensions) | {
|
|
123
117
|
audio: WAMediaUpload;
|
|
124
118
|
/** if set to true, will send as a `voice note` */
|
|
125
119
|
ptt?: boolean;
|
|
@@ -133,7 +127,7 @@ export type AnyMediaMessageContent = (({
|
|
|
133
127
|
mimetype: string;
|
|
134
128
|
fileName?: string;
|
|
135
129
|
caption?: string;
|
|
136
|
-
} & Contextable)) & {
|
|
130
|
+
} & Contextable & Buttonable & Templatable)) & {
|
|
137
131
|
mimetype?: string;
|
|
138
132
|
} & Editable;
|
|
139
133
|
export type ButtonReplyInfo = {
|
|
@@ -141,24 +135,15 @@ export type ButtonReplyInfo = {
|
|
|
141
135
|
id: string;
|
|
142
136
|
index: number;
|
|
143
137
|
};
|
|
144
|
-
export type GroupInviteInfo = {
|
|
145
|
-
inviteCode: string;
|
|
146
|
-
inviteExpiration: number;
|
|
147
|
-
text: string;
|
|
148
|
-
jid: string;
|
|
149
|
-
subject: string;
|
|
150
|
-
};
|
|
151
138
|
export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
|
|
152
139
|
productImage: WAMediaUpload;
|
|
153
140
|
};
|
|
154
141
|
export type AnyRegularMessageContent = (({
|
|
155
142
|
text: string;
|
|
156
143
|
linkPreview?: WAUrlInfo | null;
|
|
157
|
-
} & Mentionable & Contextable & Editable) | AnyMediaMessageContent | {
|
|
158
|
-
event: EventMessageOptions;
|
|
159
|
-
} | ({
|
|
144
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Listable & Editable) | AnyMediaMessageContent | ({
|
|
160
145
|
poll: PollMessageOptions;
|
|
161
|
-
} & Mentionable & Contextable & Editable) | {
|
|
146
|
+
} & Mentionable & Contextable & Buttonable & Templatable & Editable) | {
|
|
162
147
|
contacts: {
|
|
163
148
|
displayName?: string;
|
|
164
149
|
contacts: proto.Message.IContactMessage[];
|
|
@@ -170,17 +155,8 @@ export type AnyRegularMessageContent = (({
|
|
|
170
155
|
} | {
|
|
171
156
|
buttonReply: ButtonReplyInfo;
|
|
172
157
|
type: 'template' | 'plain';
|
|
173
|
-
} | {
|
|
174
|
-
groupInvite: GroupInviteInfo;
|
|
175
158
|
} | {
|
|
176
159
|
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
|
177
|
-
} | {
|
|
178
|
-
pin: WAMessageKey;
|
|
179
|
-
type: proto.PinInChat.Type;
|
|
180
|
-
/**
|
|
181
|
-
* 24 hours, 7 days, 30 days
|
|
182
|
-
*/
|
|
183
|
-
time?: 86400 | 604800 | 2592000;
|
|
184
160
|
} | {
|
|
185
161
|
product: WASendableProduct;
|
|
186
162
|
businessOwnerJid?: string;
|
|
@@ -200,8 +176,8 @@ export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
|
|
|
200
176
|
type MinimalRelayOptions = {
|
|
201
177
|
/** override the message ID with a custom provided string */
|
|
202
178
|
messageId?: string;
|
|
203
|
-
/**
|
|
204
|
-
|
|
179
|
+
/** cached group metadata, use to prevent redundant requests to WA & speed up msg sending */
|
|
180
|
+
cachedGroupMetadata?: (jid: string) => Promise<GroupMetadataParticipants | undefined>;
|
|
205
181
|
};
|
|
206
182
|
export type MessageRelayOptions = MinimalRelayOptions & {
|
|
207
183
|
/** only send to a specific participant; used when a message decryption fails for a single user */
|
|
@@ -224,6 +200,7 @@ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
|
224
200
|
timestamp?: Date;
|
|
225
201
|
/** the message you want to quote */
|
|
226
202
|
quoted?: WAMessage;
|
|
203
|
+
additionalNodes?: BinaryNode[];
|
|
227
204
|
/** disappearing messages settings */
|
|
228
205
|
ephemeralExpiration?: number | string;
|
|
229
206
|
/** timeout for media upload to WA server */
|
|
@@ -240,19 +217,19 @@ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
|
240
217
|
export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
|
|
241
218
|
userJid: string;
|
|
242
219
|
};
|
|
243
|
-
export type
|
|
220
|
+
export type WAMediaUploadFunctionOpts = {
|
|
244
221
|
fileEncSha256B64: string;
|
|
245
222
|
mediaType: MediaType;
|
|
223
|
+
newsletter?: boolean;
|
|
246
224
|
timeoutMs?: number;
|
|
247
|
-
}
|
|
225
|
+
};
|
|
226
|
+
export type WAMediaUploadFunction = (readStream: Readable | Buffer, opts: WAMediaUploadFunctionOpts) => Promise<{
|
|
248
227
|
mediaUrl: string;
|
|
249
228
|
directPath: string;
|
|
250
|
-
|
|
251
|
-
ts?: number;
|
|
252
|
-
fbid?: number;
|
|
229
|
+
handle?: string;
|
|
253
230
|
}>;
|
|
254
231
|
export type MediaGenerationOptions = {
|
|
255
|
-
logger?:
|
|
232
|
+
logger?: Logger;
|
|
256
233
|
mediaTypeOverride?: MediaType;
|
|
257
234
|
upload: WAMediaUploadFunction;
|
|
258
235
|
/** cache media so it does not have to be uploaded again */
|
|
@@ -261,14 +238,11 @@ export type MediaGenerationOptions = {
|
|
|
261
238
|
options?: AxiosRequestConfig;
|
|
262
239
|
backgroundColor?: string;
|
|
263
240
|
font?: number;
|
|
241
|
+
/** The message is for newsletter? */
|
|
242
|
+
newsletter?: boolean;
|
|
264
243
|
};
|
|
265
244
|
export type MessageContentGenerationOptions = MediaGenerationOptions & {
|
|
266
245
|
getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
|
|
267
|
-
getProfilePicUrl?: (jid: string, type: 'image' | 'preview') => Promise<string | undefined>;
|
|
268
|
-
getCallLink?: (type: 'audio' | 'video', event?: {
|
|
269
|
-
startTime: number;
|
|
270
|
-
}) => Promise<string | undefined>;
|
|
271
|
-
jid?: string;
|
|
272
246
|
};
|
|
273
247
|
export type MessageGenerationOptions = MessageContentGenerationOptions & MessageGenerationOptionsFromContent;
|
|
274
248
|
/**
|
package/lib/Types/Message.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
Object.defineProperty(exports, "WAProto", { enumerable: true, get: function () { return
|
|
6
|
-
|
|
7
|
-
exports.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
WAMessageAddressingMode["PN"] = "pn";
|
|
11
|
-
WAMessageAddressingMode["LID"] = "lid";
|
|
12
|
-
})(WAMessageAddressingMode || (exports.WAMessageAddressingMode = WAMessageAddressingMode = {}));
|
|
3
|
+
exports.WAMessageStatus = exports.WAMessageStubType = exports.WAProto = void 0;
|
|
4
|
+
const WAProto_1 = require("../../WAProto");
|
|
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
|
+
exports.WAMessageStubType = WAProto_1.proto.WebMessageInfo.StubType;
|
|
8
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
|
9
|
+
exports.WAMessageStatus = WAProto_1.proto.WebMessageInfo.Status;
|
|
@@ -1,134 +1,103 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
xwa2_newsletter_demote = "xwa2_newsletter_demote",
|
|
13
|
-
xwa2_newsletter_delete_v2 = "xwa2_newsletter_delete_v2"
|
|
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
|
+
|
|
9
|
+
export type NewsletterViewerMetadata = {
|
|
10
|
+
mute: NewsletterMute
|
|
11
|
+
view_role: NewsletterViewRole
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
|
|
14
|
+
export type NewsletterMetadata = {
|
|
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
|
|
28
43
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
thread_metadata: {
|
|
40
|
-
creation_time: string;
|
|
41
|
-
description: {
|
|
42
|
-
id: string;
|
|
43
|
-
text: string;
|
|
44
|
-
update_time: string;
|
|
45
|
-
};
|
|
46
|
-
handle: string | null;
|
|
47
|
-
invite: string;
|
|
48
|
-
name: {
|
|
49
|
-
id: string;
|
|
50
|
-
text: string;
|
|
51
|
-
update_time: string;
|
|
52
|
-
};
|
|
53
|
-
picture: {
|
|
54
|
-
direct_path: string;
|
|
55
|
-
id: string;
|
|
56
|
-
type: string;
|
|
57
|
-
};
|
|
58
|
-
preview: {
|
|
59
|
-
direct_path: string;
|
|
60
|
-
id: string;
|
|
61
|
-
type: string;
|
|
62
|
-
};
|
|
63
|
-
subscribers_count: string;
|
|
64
|
-
verification: 'VERIFIED' | 'UNVERIFIED';
|
|
65
|
-
};
|
|
66
|
-
viewer_metadata: {
|
|
67
|
-
mute: 'ON' | 'OFF';
|
|
68
|
-
role: NewsletterViewRole;
|
|
69
|
-
};
|
|
44
|
+
|
|
45
|
+
export type SubscriberAction = "promote" | "demote"
|
|
46
|
+
|
|
47
|
+
export type ReactionModeUpdate = {
|
|
48
|
+
reaction_codes: {
|
|
49
|
+
blocked_codes: null
|
|
50
|
+
enabled_ts_sec: null
|
|
51
|
+
value: NewsletterReactionMode
|
|
52
|
+
}
|
|
70
53
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
description: {
|
|
79
|
-
id: string;
|
|
80
|
-
text: string;
|
|
81
|
-
update_time: string;
|
|
82
|
-
};
|
|
83
|
-
handle: string | null;
|
|
84
|
-
invite: string;
|
|
85
|
-
name: {
|
|
86
|
-
id: string;
|
|
87
|
-
text: string;
|
|
88
|
-
update_time: string;
|
|
89
|
-
};
|
|
90
|
-
picture: {
|
|
91
|
-
direct_path: string;
|
|
92
|
-
id: string;
|
|
93
|
-
type: string;
|
|
94
|
-
};
|
|
95
|
-
preview: {
|
|
96
|
-
direct_path: string;
|
|
97
|
-
id: string;
|
|
98
|
-
type: string;
|
|
99
|
-
};
|
|
100
|
-
subscribers_count: string;
|
|
101
|
-
verification: 'VERIFIED' | 'UNVERIFIED';
|
|
102
|
-
};
|
|
103
|
-
viewer_metadata: {
|
|
104
|
-
mute: 'ON' | 'OFF';
|
|
105
|
-
role: NewsletterViewRole;
|
|
106
|
-
};
|
|
54
|
+
|
|
55
|
+
/** only exists reaction mode update */
|
|
56
|
+
export type NewsletterSettingsUpdate = ReactionModeUpdate
|
|
57
|
+
|
|
58
|
+
export type NewsletterReaction = {
|
|
59
|
+
count: number
|
|
60
|
+
code: string
|
|
107
61
|
}
|
|
108
|
-
|
|
109
|
-
export
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
url?: string;
|
|
119
|
-
directPath?: string;
|
|
120
|
-
mediaKey?: string;
|
|
121
|
-
id?: string;
|
|
122
|
-
};
|
|
123
|
-
verification?: 'VERIFIED' | 'UNVERIFIED';
|
|
124
|
-
reaction_codes?: {
|
|
125
|
-
code: string;
|
|
126
|
-
count: number;
|
|
127
|
-
}[];
|
|
128
|
-
mute_state?: 'ON' | 'OFF';
|
|
129
|
-
thread_metadata?: {
|
|
130
|
-
creation_time?: number;
|
|
131
|
-
name?: string;
|
|
132
|
-
description?: string;
|
|
133
|
-
};
|
|
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
|
|
134
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
|
package/lib/Types/Newsletter.js
CHANGED
|
@@ -1,33 +1,38 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
package/lib/Types/Product.d.ts
CHANGED
package/lib/Types/Signal.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { proto } from '../../WAProto
|
|
2
|
-
import type { LIDMappingStore } from '../Signal/lid-mapping';
|
|
1
|
+
import { proto } from '../../WAProto';
|
|
3
2
|
type DecryptGroupSignalOpts = {
|
|
4
3
|
group: string;
|
|
5
4
|
authorJid: string;
|
|
@@ -18,11 +17,6 @@ type EncryptMessageOpts = {
|
|
|
18
17
|
jid: string;
|
|
19
18
|
data: Uint8Array;
|
|
20
19
|
};
|
|
21
|
-
type EncryptMessageWithWireOpts = {
|
|
22
|
-
encryptionJid: string;
|
|
23
|
-
wireJid: string;
|
|
24
|
-
data: Uint8Array;
|
|
25
|
-
};
|
|
26
20
|
type EncryptGroupMessageOpts = {
|
|
27
21
|
group: string;
|
|
28
22
|
data: Uint8Array;
|
|
@@ -53,33 +47,11 @@ export type SignalRepository = {
|
|
|
53
47
|
type: 'pkmsg' | 'msg';
|
|
54
48
|
ciphertext: Uint8Array;
|
|
55
49
|
}>;
|
|
56
|
-
encryptMessageWithWire(opts: EncryptMessageWithWireOpts): Promise<{
|
|
57
|
-
type: 'pkmsg' | 'msg';
|
|
58
|
-
ciphertext: Uint8Array;
|
|
59
|
-
wireJid: string;
|
|
60
|
-
}>;
|
|
61
50
|
encryptGroupMessage(opts: EncryptGroupMessageOpts): Promise<{
|
|
62
51
|
senderKeyDistributionMessage: Uint8Array;
|
|
63
52
|
ciphertext: Uint8Array;
|
|
64
53
|
}>;
|
|
65
54
|
injectE2ESession(opts: E2ESessionOpts): Promise<void>;
|
|
66
|
-
validateSession(jid: string): Promise<{
|
|
67
|
-
exists: boolean;
|
|
68
|
-
reason?: string;
|
|
69
|
-
}>;
|
|
70
55
|
jidToSignalProtocolAddress(jid: string): string;
|
|
71
|
-
migrateSession(fromJids: string[], toJid: string): Promise<{
|
|
72
|
-
migrated: number;
|
|
73
|
-
skipped: number;
|
|
74
|
-
total: number;
|
|
75
|
-
}>;
|
|
76
|
-
validateSession(jid: string): Promise<{
|
|
77
|
-
exists: boolean;
|
|
78
|
-
reason?: string;
|
|
79
|
-
}>;
|
|
80
|
-
deleteSession(jids: string[]): Promise<void>;
|
|
81
56
|
};
|
|
82
|
-
export interface SignalRepositoryWithLIDStore extends SignalRepository {
|
|
83
|
-
lidMapping: LIDMappingStore;
|
|
84
|
-
}
|
|
85
57
|
export {};
|