@d0v3riz/baileys 6.3.1 → 6.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/WAProto/WAProto.proto +58 -24
- package/WAProto/index.d.ts +649 -410
- package/WAProto/index.js +1632 -985
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +1 -1
- package/lib/Socket/Client/abstract-socket-client.d.ts +1 -0
- package/lib/Socket/Client/web-socket-client.d.ts +1 -1
- package/lib/Socket/Client/web-socket-client.js +1 -1
- package/lib/Socket/business.d.ts +4 -3
- package/lib/Socket/chats.d.ts +6 -5
- package/lib/Socket/groups.d.ts +3 -2
- package/lib/Socket/index.d.ts +9 -8
- package/lib/Socket/messages-recv.d.ts +5 -3
- package/lib/Socket/messages-recv.js +75 -2
- package/lib/Socket/messages-send.d.ts +3 -2
- package/lib/Socket/messages-send.js +13 -8
- package/lib/Socket/registration.d.ts +5 -4
- package/lib/Socket/socket.d.ts +4 -3
- package/lib/Socket/socket.js +69 -9
- package/lib/Store/make-in-memory-store.d.ts +2 -2
- package/lib/Types/Auth.d.ts +19 -17
- package/lib/Types/Call.d.ts +2 -2
- package/lib/Types/Chat.d.ts +13 -13
- package/lib/Types/Events.d.ts +3 -3
- package/lib/Types/GroupMetadata.d.ts +2 -2
- package/lib/Types/LabelAssociation.d.ts +2 -2
- package/lib/Types/Message.d.ts +57 -45
- package/lib/Types/Product.d.ts +14 -14
- package/lib/Types/Signal.d.ts +10 -10
- package/lib/Types/Socket.d.ts +5 -4
- package/lib/Types/State.d.ts +2 -2
- package/lib/Types/index.d.ts +5 -5
- package/lib/Utils/auth-utils.js +3 -1
- package/lib/Utils/chat-utils.d.ts +4 -4
- package/lib/Utils/crypto.d.ts +3 -0
- package/lib/Utils/crypto.js +15 -1
- package/lib/Utils/event-buffer.d.ts +2 -2
- package/lib/Utils/event-buffer.js +3 -3
- package/lib/Utils/generics.d.ts +7 -6
- package/lib/Utils/generics.js +25 -27
- package/lib/Utils/link-preview.d.ts +1 -1
- package/lib/Utils/link-preview.js +1 -24
- package/lib/Utils/make-mutex.d.ts +1 -1
- package/lib/Utils/messages-media.d.ts +9 -3
- package/lib/Utils/messages-media.js +54 -6
- package/lib/Utils/messages.d.ts +6 -5
- package/lib/Utils/messages.js +35 -1
- package/lib/Utils/process-message.d.ts +2 -2
- package/lib/Utils/validate-connection.js +1 -2
- package/lib/WABinary/jid-utils.d.ts +4 -4
- package/lib/WABinary/types.d.ts +4 -4
- package/lib/index.d.ts +1 -1
- package/package.json +8 -6
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.extensionForMediaMessage = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.getHttpStream = exports.generateThumbnail = exports.getStream = exports.toBuffer = exports.toReadable = exports.getAudioDuration = exports.mediaMessageSHA256B64 = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.getMediaKeys = exports.hkdfInfoKey = void 0;
|
|
26
|
+
exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.extensionForMediaMessage = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.getHttpStream = exports.generateThumbnail = exports.getStream = exports.toBuffer = exports.toReadable = exports.getAudioWaveform = exports.getAudioDuration = exports.mediaMessageSHA256B64 = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.getMediaKeys = exports.hkdfInfoKey = void 0;
|
|
27
27
|
const boom_1 = require("@hapi/boom");
|
|
28
28
|
const child_process_1 = require("child_process");
|
|
29
29
|
const Crypto = __importStar(require("crypto"));
|
|
@@ -41,11 +41,13 @@ const getTmpFilesDirectory = () => (0, os_1.tmpdir)();
|
|
|
41
41
|
const getImageProcessingLibrary = async () => {
|
|
42
42
|
const [_jimp, sharp] = await Promise.all([
|
|
43
43
|
(async () => {
|
|
44
|
-
const jimp = await (
|
|
44
|
+
const jimp = await (import('jimp')
|
|
45
|
+
.catch(() => { }));
|
|
45
46
|
return jimp;
|
|
46
47
|
})(),
|
|
47
48
|
(async () => {
|
|
48
|
-
const sharp = await (
|
|
49
|
+
const sharp = await (import('sharp')
|
|
50
|
+
.catch(() => { }));
|
|
49
51
|
return sharp;
|
|
50
52
|
})()
|
|
51
53
|
]);
|
|
@@ -186,7 +188,7 @@ const mediaMessageSHA256B64 = (message) => {
|
|
|
186
188
|
};
|
|
187
189
|
exports.mediaMessageSHA256B64 = mediaMessageSHA256B64;
|
|
188
190
|
async function getAudioDuration(buffer) {
|
|
189
|
-
const musicMetadata = await
|
|
191
|
+
const musicMetadata = await import('music-metadata');
|
|
190
192
|
let metadata;
|
|
191
193
|
if (Buffer.isBuffer(buffer)) {
|
|
192
194
|
metadata = await musicMetadata.parseBuffer(buffer, undefined, { duration: true });
|
|
@@ -206,6 +208,48 @@ async function getAudioDuration(buffer) {
|
|
|
206
208
|
return metadata.format.duration;
|
|
207
209
|
}
|
|
208
210
|
exports.getAudioDuration = getAudioDuration;
|
|
211
|
+
/**
|
|
212
|
+
referenced from and modifying https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareAudioWaveform.ts
|
|
213
|
+
*/
|
|
214
|
+
async function getAudioWaveform(buffer, logger) {
|
|
215
|
+
try {
|
|
216
|
+
const audioDecode = (...args) => import('audio-decode').then(({ default: audioDecode }) => audioDecode(...args));
|
|
217
|
+
let audioData;
|
|
218
|
+
if (Buffer.isBuffer(buffer)) {
|
|
219
|
+
audioData = buffer;
|
|
220
|
+
}
|
|
221
|
+
else if (typeof buffer === 'string') {
|
|
222
|
+
const rStream = (0, fs_1.createReadStream)(buffer);
|
|
223
|
+
audioData = await (0, exports.toBuffer)(rStream);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
audioData = await (0, exports.toBuffer)(buffer);
|
|
227
|
+
}
|
|
228
|
+
const audioBuffer = await audioDecode(audioData);
|
|
229
|
+
const rawData = audioBuffer.getChannelData(0); // We only need to work with one channel of data
|
|
230
|
+
const samples = 64; // Number of samples we want to have in our final data set
|
|
231
|
+
const blockSize = Math.floor(rawData.length / samples); // the number of samples in each subdivision
|
|
232
|
+
const filteredData = [];
|
|
233
|
+
for (let i = 0; i < samples; i++) {
|
|
234
|
+
const blockStart = blockSize * i; // the location of the first sample in the block
|
|
235
|
+
let sum = 0;
|
|
236
|
+
for (let j = 0; j < blockSize; j++) {
|
|
237
|
+
sum = sum + Math.abs(rawData[blockStart + j]); // find the sum of all the samples in the block
|
|
238
|
+
}
|
|
239
|
+
filteredData.push(sum / blockSize); // divide the sum by the block size to get the average
|
|
240
|
+
}
|
|
241
|
+
// This guarantees that the largest data point will be set to 1, and the rest of the data will scale proportionally.
|
|
242
|
+
const multiplier = Math.pow(Math.max(...filteredData), -1);
|
|
243
|
+
const normalizedData = filteredData.map((n) => n * multiplier);
|
|
244
|
+
// Generate waveform like WhatsApp
|
|
245
|
+
const waveform = new Uint8Array(normalizedData.map((n) => Math.floor(100 * n)));
|
|
246
|
+
return waveform;
|
|
247
|
+
}
|
|
248
|
+
catch (e) {
|
|
249
|
+
logger === null || logger === void 0 ? void 0 : logger.debug('Failed to generate waveform: ' + e);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
exports.getAudioWaveform = getAudioWaveform;
|
|
209
253
|
const toReadable = (buffer) => {
|
|
210
254
|
const readable = new stream_1.Readable({ read: () => { } });
|
|
211
255
|
readable.push(buffer);
|
|
@@ -269,7 +313,7 @@ async function generateThumbnail(file, mediaType, options) {
|
|
|
269
313
|
}
|
|
270
314
|
exports.generateThumbnail = generateThumbnail;
|
|
271
315
|
const getHttpStream = async (url, options = {}) => {
|
|
272
|
-
const { default: axios } = await
|
|
316
|
+
const { default: axios } = await import('axios');
|
|
273
317
|
const fetched = await axios.get(url.toString(), { ...options, responseType: 'stream' });
|
|
274
318
|
return fetched.data;
|
|
275
319
|
};
|
|
@@ -481,7 +525,7 @@ exports.extensionForMediaMessage = extensionForMediaMessage;
|
|
|
481
525
|
const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, options }, refreshMediaConn) => {
|
|
482
526
|
return async (stream, { mediaType, fileEncSha256B64, timeoutMs }) => {
|
|
483
527
|
var _a, _b;
|
|
484
|
-
const { default: axios } = await
|
|
528
|
+
const { default: axios } = await import('axios');
|
|
485
529
|
// send a query JSON to obtain the url & auth token to upload our media
|
|
486
530
|
let uploadInfo = await refreshMediaConn(false);
|
|
487
531
|
let urls;
|
|
@@ -630,3 +674,7 @@ const MEDIA_RETRY_STATUS_MAP = {
|
|
|
630
674
|
[WAProto_1.proto.MediaRetryNotification.ResultType.NOT_FOUND]: 404,
|
|
631
675
|
[WAProto_1.proto.MediaRetryNotification.ResultType.GENERAL_ERROR]: 418,
|
|
632
676
|
};
|
|
677
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
678
|
+
function __importStar(arg0) {
|
|
679
|
+
throw new Error('Function not implemented.');
|
|
680
|
+
}
|
package/lib/Utils/messages.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import { Logger } from 'pino';
|
|
3
4
|
import { proto } from '../../WAProto';
|
|
4
5
|
import { AnyMediaMessageContent, AnyMessageContent, MediaGenerationOptions, MessageContentGenerationOptions, MessageGenerationOptions, MessageGenerationOptionsFromContent, MessageUserReceipt, WAMessage, WAMessageContent, WAProto } from '../Types';
|
|
@@ -11,13 +12,13 @@ import { MediaDownloadOptions } from './messages-media';
|
|
|
11
12
|
export declare const extractUrlFromText: (text: string) => string | undefined;
|
|
12
13
|
export declare const generateLinkPreviewIfRequired: (text: string, getUrlInfo: MessageGenerationOptions['getUrlInfo'], logger: MessageGenerationOptions['logger']) => Promise<import("../Types").WAUrlInfo | undefined>;
|
|
13
14
|
export declare const prepareWAMessageMedia: (message: AnyMediaMessageContent, options: MediaGenerationOptions) => Promise<proto.Message>;
|
|
14
|
-
export declare const prepareDisappearingMessageSettingContent: (ephemeralExpiration?: number
|
|
15
|
+
export declare const prepareDisappearingMessageSettingContent: (ephemeralExpiration?: number) => proto.Message;
|
|
15
16
|
/**
|
|
16
17
|
* Generate forwarded message content like WA does
|
|
17
18
|
* @param message the message to forward
|
|
18
19
|
* @param options.forceForward will show the message as forwarded even if it is from you
|
|
19
20
|
*/
|
|
20
|
-
export declare const generateForwardMessageContent: (message: WAMessage, forceForward?: boolean
|
|
21
|
+
export declare const generateForwardMessageContent: (message: WAMessage, forceForward?: boolean) => proto.IMessage;
|
|
21
22
|
export declare const generateWAMessageContent: (message: AnyMessageContent, options: MessageContentGenerationOptions) => Promise<proto.Message>;
|
|
22
23
|
export declare const generateWAMessageFromContent: (jid: string, message: WAMessageContent, options: MessageGenerationOptionsFromContent) => proto.WebMessageInfo;
|
|
23
24
|
export declare const generateWAMessage: (jid: string, content: AnyMessageContent, options: MessageGenerationOptions) => Promise<proto.WebMessageInfo>;
|
|
@@ -45,7 +46,7 @@ export declare const updateMessageWithReceipt: (msg: Pick<WAMessage, 'userReceip
|
|
|
45
46
|
export declare const updateMessageWithReaction: (msg: Pick<WAMessage, 'reactions'>, reaction: proto.IReaction) => void;
|
|
46
47
|
/** Update the message with a new poll update */
|
|
47
48
|
export declare const updateMessageWithPollUpdate: (msg: Pick<WAMessage, 'pollUpdates'>, update: proto.IPollUpdate) => void;
|
|
48
|
-
|
|
49
|
+
type VoteAggregation = {
|
|
49
50
|
name: string;
|
|
50
51
|
voters: string[];
|
|
51
52
|
};
|
|
@@ -62,14 +63,14 @@ export declare const aggregateMessageKeysNotFromMe: (keys: proto.IMessageKey[])
|
|
|
62
63
|
participant: string | undefined;
|
|
63
64
|
messageIds: string[];
|
|
64
65
|
}[];
|
|
65
|
-
|
|
66
|
+
type DownloadMediaMessageContext = {
|
|
66
67
|
reuploadRequest: (msg: WAMessage) => Promise<WAMessage>;
|
|
67
68
|
logger: Logger;
|
|
68
69
|
};
|
|
69
70
|
/**
|
|
70
71
|
* Downloads the given message. Throws an error if it's not a media message
|
|
71
72
|
*/
|
|
72
|
-
export declare const downloadMediaMessage: (message: WAMessage, type: 'buffer' | 'stream', options: MediaDownloadOptions, ctx?: DownloadMediaMessageContext
|
|
73
|
+
export declare const downloadMediaMessage: (message: WAMessage, type: 'buffer' | 'stream', options: MediaDownloadOptions, ctx?: DownloadMediaMessageContext) => Promise<Buffer | import("stream").Transform>;
|
|
73
74
|
/** Checks whether the given message is a media message; if it is returns the inner content */
|
|
74
75
|
export declare const assertMediaContent: (content: proto.IMessage | null | undefined) => proto.Message.IVideoMessage | proto.Message.IImageMessage | proto.Message.IAudioMessage | proto.Message.IDocumentMessage | proto.Message.IStickerMessage;
|
|
75
76
|
export {};
|
package/lib/Utils/messages.js
CHANGED
|
@@ -54,6 +54,20 @@ const generateLinkPreviewIfRequired = async (text, getUrlInfo, logger) => {
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
exports.generateLinkPreviewIfRequired = generateLinkPreviewIfRequired;
|
|
57
|
+
const assertColor = async (color) => {
|
|
58
|
+
let assertedColor;
|
|
59
|
+
if (typeof color === 'number') {
|
|
60
|
+
assertedColor = color > 0 ? color : 0xffffffff + Number(color) + 1;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
let hex = color.trim().replace('#', '');
|
|
64
|
+
if (hex.length <= 6) {
|
|
65
|
+
hex = 'FF' + hex.padStart(6, '0');
|
|
66
|
+
}
|
|
67
|
+
assertedColor = parseInt(hex, 16);
|
|
68
|
+
return assertedColor;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
57
71
|
const prepareWAMessageMedia = async (message, options) => {
|
|
58
72
|
const logger = options.logger;
|
|
59
73
|
let mediaType;
|
|
@@ -97,6 +111,8 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
97
111
|
const requiresDurationComputation = mediaType === 'audio' && typeof uploadData.seconds === 'undefined';
|
|
98
112
|
const requiresThumbnailComputation = (mediaType === 'image' || mediaType === 'video') &&
|
|
99
113
|
(typeof uploadData['jpegThumbnail'] === 'undefined');
|
|
114
|
+
const requiresWaveformProcessing = mediaType === 'audio' && uploadData.ptt === 'true' || true;
|
|
115
|
+
const requiresAudioBackground = options.backgroundColor && mediaType === 'audio' && uploadData.ptt === 'true' || true;
|
|
100
116
|
const requiresOriginalForSomeProcessing = requiresDurationComputation || requiresThumbnailComputation;
|
|
101
117
|
const { mediaKey, encWriteStream, bodyPath, fileEncSha256, fileSha256, fileLength, didSaveToTmpPath } = await (0, messages_media_1.encryptedStream)(uploadData.media, options.mediaTypeOverride || mediaType, {
|
|
102
118
|
logger,
|
|
@@ -127,6 +143,18 @@ const prepareWAMessageMedia = async (message, options) => {
|
|
|
127
143
|
uploadData.seconds = await (0, messages_media_1.getAudioDuration)(bodyPath);
|
|
128
144
|
logger === null || logger === void 0 ? void 0 : logger.debug('computed audio duration');
|
|
129
145
|
}
|
|
146
|
+
if (requiresWaveformProcessing) {
|
|
147
|
+
uploadData.waveform = await (0, messages_media_1.getAudioWaveform)(bodyPath, logger);
|
|
148
|
+
logger === null || logger === void 0 ? void 0 : logger.debug('processed waveform');
|
|
149
|
+
}
|
|
150
|
+
if (requiresWaveformProcessing) {
|
|
151
|
+
uploadData.waveform = await (0, messages_media_1.getAudioWaveform)(bodyPath, logger);
|
|
152
|
+
logger === null || logger === void 0 ? void 0 : logger.debug('processed waveform');
|
|
153
|
+
}
|
|
154
|
+
if (requiresAudioBackground) {
|
|
155
|
+
uploadData.backgroundArgb = await assertColor(options.backgroundColor);
|
|
156
|
+
logger === null || logger === void 0 ? void 0 : logger.debug('computed backgroundColor audio status');
|
|
157
|
+
}
|
|
130
158
|
}
|
|
131
159
|
catch (error) {
|
|
132
160
|
logger === null || logger === void 0 ? void 0 : logger.warn({ trace: error.stack }, 'failed to obtain extra info');
|
|
@@ -235,6 +263,12 @@ const generateWAMessageContent = async (message, options) => {
|
|
|
235
263
|
extContent.thumbnailEncSha256 = img.fileEncSha256;
|
|
236
264
|
}
|
|
237
265
|
}
|
|
266
|
+
if (options.backgroundColor) {
|
|
267
|
+
extContent.backgroundArgb = await assertColor(options.backgroundColor);
|
|
268
|
+
}
|
|
269
|
+
if (options.font) {
|
|
270
|
+
extContent.font = options.font;
|
|
271
|
+
}
|
|
238
272
|
m.extendedTextMessage = extContent;
|
|
239
273
|
}
|
|
240
274
|
else if ('contacts' in message) {
|
|
@@ -466,7 +500,7 @@ const generateWAMessageFromContent = (jid, message, options) => {
|
|
|
466
500
|
message: message,
|
|
467
501
|
messageTimestamp: timestamp,
|
|
468
502
|
messageStubParameters: [],
|
|
469
|
-
participant: (0, WABinary_1.isJidGroup)(jid) ? userJid : undefined,
|
|
503
|
+
participant: (0, WABinary_1.isJidGroup)(jid) || (0, WABinary_1.isJidStatusBroadcast)(jid) ? userJid : undefined,
|
|
470
504
|
status: Types_1.WAMessageStatus.PENDING
|
|
471
505
|
};
|
|
472
506
|
return Types_1.WAProto.WebMessageInfo.fromObject(messageJSON);
|
|
@@ -2,7 +2,7 @@ import { AxiosRequestConfig } from 'axios';
|
|
|
2
2
|
import type { Logger } from 'pino';
|
|
3
3
|
import { proto } from '../../WAProto';
|
|
4
4
|
import { AuthenticationCreds, BaileysEventEmitter, SignalKeyStoreWithTransaction, SocketConfig } from '../Types';
|
|
5
|
-
|
|
5
|
+
type ProcessMessageContext = {
|
|
6
6
|
shouldProcessHistoryMsg: boolean;
|
|
7
7
|
creds: AuthenticationCreds;
|
|
8
8
|
keyStore: SignalKeyStoreWithTransaction;
|
|
@@ -20,7 +20,7 @@ export declare const shouldIncrementChatUnread: (message: proto.IWebMessageInfo)
|
|
|
20
20
|
* Typically -- that'll be the remoteJid, but for broadcasts, it'll be the participant
|
|
21
21
|
*/
|
|
22
22
|
export declare const getChatId: ({ remoteJid, participant, fromMe }: proto.IMessageKey) => string;
|
|
23
|
-
|
|
23
|
+
type PollContext = {
|
|
24
24
|
/** normalised jid of the person that created the poll */
|
|
25
25
|
pollCreatorJid: string;
|
|
26
26
|
/** ID of the poll creation message */
|
|
@@ -180,9 +180,8 @@ const encodeSignedDeviceIdentity = (account, includeSignatureKey) => {
|
|
|
180
180
|
if (!includeSignatureKey || !((_a = account.accountSignatureKey) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
181
181
|
account.accountSignatureKey = null;
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
return WAProto_1.proto.ADVSignedDeviceIdentity
|
|
184
184
|
.encode(account)
|
|
185
185
|
.finish();
|
|
186
|
-
return accountEnc;
|
|
187
186
|
};
|
|
188
187
|
exports.encodeSignedDeviceIdentity = encodeSignedDeviceIdentity;
|
|
@@ -3,16 +3,16 @@ export declare const OFFICIAL_BIZ_JID = "16505361212@c.us";
|
|
|
3
3
|
export declare const SERVER_JID = "server@c.us";
|
|
4
4
|
export declare const PSA_WID = "0@c.us";
|
|
5
5
|
export declare const STORIES_JID = "status@broadcast";
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type JidServer = 'c.us' | 'g.us' | 'broadcast' | 's.whatsapp.net' | 'call';
|
|
7
|
+
export type JidWithDevice = {
|
|
8
8
|
user: string;
|
|
9
9
|
device?: number;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type FullJid = JidWithDevice & {
|
|
12
12
|
server: JidServer | string;
|
|
13
13
|
agent?: number;
|
|
14
14
|
};
|
|
15
|
-
export declare const jidEncode: (user: string | number | null, server: JidServer, device?: number
|
|
15
|
+
export declare const jidEncode: (user: string | number | null, server: JidServer, device?: number, agent?: number) => string;
|
|
16
16
|
export declare const jidDecode: (jid: string | undefined) => FullJid | undefined;
|
|
17
17
|
/** is the jid a user */
|
|
18
18
|
export declare const areJidsSameUser: (jid1: string | undefined, jid2: string | undefined) => boolean;
|
package/lib/WABinary/types.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ import * as constants from './constants';
|
|
|
6
6
|
* This is done for easy serialization, to prevent running into issues with prototypes &
|
|
7
7
|
* to maintain functional code structure
|
|
8
8
|
* */
|
|
9
|
-
export
|
|
9
|
+
export type BinaryNode = {
|
|
10
10
|
tag: string;
|
|
11
11
|
attrs: {
|
|
12
12
|
[key: string]: string;
|
|
13
13
|
};
|
|
14
14
|
content?: BinaryNode[] | string | Uint8Array;
|
|
15
15
|
};
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
16
|
+
export type BinaryNodeAttributes = BinaryNode['attrs'];
|
|
17
|
+
export type BinaryNodeData = BinaryNode['content'];
|
|
18
|
+
export type BinaryNodeCodingOptions = typeof constants;
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export * from './Types';
|
|
|
5
5
|
export * from './Store';
|
|
6
6
|
export * from './Defaults';
|
|
7
7
|
export * from './WABinary';
|
|
8
|
-
export
|
|
8
|
+
export type WASocket = ReturnType<typeof makeWASocket>;
|
|
9
9
|
export { makeWASocket };
|
|
10
10
|
export default makeWASocket;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d0v3riz/baileys",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.1",
|
|
4
4
|
"description": "WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
35
35
|
"example": "node --inspect -r ts-node/register Example/example.ts",
|
|
36
36
|
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
37
|
-
"lint": "eslint
|
|
38
|
-
"lint:fix": "eslint
|
|
37
|
+
"lint": "eslint src --ext .js,.ts,.jsx,.tsx",
|
|
38
|
+
"lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
|
|
39
39
|
"prepack": "tsc",
|
|
40
40
|
"prepare": "tsc",
|
|
41
41
|
"release": "release-it",
|
|
@@ -43,7 +43,9 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
46
|
+
"@d0v3riz/ws": "^8.13.0",
|
|
46
47
|
"@hapi/boom": "^9.1.3",
|
|
48
|
+
"audio-decode": "^2.1.3",
|
|
47
49
|
"axios": "^1.3.3",
|
|
48
50
|
"cache-manager": "^5.2.2",
|
|
49
51
|
"futoin-hkdf": "^1.5.1",
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
"ws": "^8.13.0"
|
|
58
60
|
},
|
|
59
61
|
"devDependencies": {
|
|
60
|
-
"@adiwajshing/eslint-config": "
|
|
62
|
+
"@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
|
|
61
63
|
"@types/got": "^9.6.11",
|
|
62
64
|
"@types/jest": "^27.5.1",
|
|
63
65
|
"@types/node": "^16.0.0",
|
|
@@ -74,7 +76,7 @@
|
|
|
74
76
|
"ts-jest": "^27.0.3",
|
|
75
77
|
"ts-node": "^10.8.1",
|
|
76
78
|
"typedoc": "^0.24.7",
|
|
77
|
-
"typescript": "^4.
|
|
79
|
+
"typescript": "^4.6.4"
|
|
78
80
|
},
|
|
79
81
|
"peerDependencies": {
|
|
80
82
|
"jimp": "^0.16.1",
|
|
@@ -97,4 +99,4 @@
|
|
|
97
99
|
}
|
|
98
100
|
},
|
|
99
101
|
"packageManager": "yarn@1.22.19"
|
|
100
|
-
}
|
|
102
|
+
}
|