lordceaser-baileys 1.0.19 → 1.0.21
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/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +235 -3
- package/lib/Defaults/index.js +23 -7
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/libsignal.js +9 -18
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +2 -0
- 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} +2 -2
- package/lib/Socket/business.d.ts +40 -38
- package/lib/Socket/chats.d.ts +23 -25
- package/lib/Socket/chats.js +77 -78
- package/lib/Socket/groups.d.ts +29 -30
- package/lib/Socket/groups.js +2 -3
- package/lib/Socket/index.d.ts +48 -44
- package/lib/Socket/index.js +2 -2
- package/lib/Socket/messages-recv.d.ts +37 -37
- package/lib/Socket/messages-recv.js +43 -97
- package/lib/Socket/messages-send.d.ts +31 -33
- package/lib/Socket/messages-send.js +69 -81
- package/lib/Socket/registration.d.ts +242 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +10 -9
- package/lib/Socket/socket.js +22 -27
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/make-cache-manager-store.d.ts +14 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +422 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Types/Auth.d.ts +7 -0
- package/lib/Types/Chat.d.ts +7 -12
- package/lib/Types/Contact.d.ts +1 -1
- package/lib/Types/GroupMetadata.d.ts +0 -2
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +10 -9
- package/lib/Types/Message.js +2 -0
- package/lib/Types/Socket.d.ts +11 -16
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.d.ts +3 -3
- package/lib/Utils/auth-utils.js +13 -7
- package/lib/Utils/business.js +5 -13
- package/lib/Utils/chat-utils.d.ts +14 -13
- package/lib/Utils/chat-utils.js +30 -35
- package/lib/Utils/crypto.d.ts +15 -14
- package/lib/Utils/crypto.js +30 -70
- package/lib/Utils/decode-wa-message.d.ts +2 -18
- package/lib/Utils/decode-wa-message.js +18 -22
- package/lib/Utils/event-buffer.d.ts +2 -2
- package/lib/Utils/event-buffer.js +7 -7
- package/lib/Utils/generics.d.ts +14 -15
- package/lib/Utils/generics.js +28 -32
- package/lib/Utils/history.d.ts +2 -2
- package/lib/Utils/link-preview.d.ts +2 -2
- package/lib/Utils/link-preview.js +1 -34
- package/lib/Utils/logger.d.ts +3 -10
- 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/make-mutex.js +0 -1
- package/lib/Utils/messages-media.d.ts +24 -20
- package/lib/Utils/messages-media.js +75 -78
- package/lib/Utils/messages.d.ts +9 -7
- package/lib/Utils/messages.js +29 -28
- package/lib/Utils/noise-handler.d.ts +11 -9
- package/lib/Utils/noise-handler.js +21 -16
- package/lib/Utils/process-message.d.ts +5 -4
- package/lib/Utils/process-message.js +39 -67
- package/lib/Utils/signal.d.ts +1 -2
- package/lib/Utils/signal.js +19 -11
- package/lib/Utils/use-multi-file-auth-state.js +13 -45
- package/lib/Utils/validate-connection.d.ts +3 -2
- package/lib/Utils/validate-connection.js +45 -15
- package/lib/WABinary/constants.js +5 -5
- package/lib/WABinary/decode.d.ts +3 -2
- package/lib/WABinary/decode.js +9 -20
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +18 -38
- package/lib/WABinary/generic-utils.d.ts +2 -1
- package/lib/WABinary/generic-utils.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +3 -7
- package/lib/WABinary/jid-utils.js +2 -9
- package/lib/WAM/BinaryInfo.d.ts +11 -2
- package/lib/WAM/constants.d.ts +2 -3
- package/lib/WAM/encode.d.ts +2 -1
- package/lib/WAM/encode.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +3 -3
- package/WAProto/index.d.ts +0 -53473
- package/WAProto/index.js +0 -165029
- package/lib/Socket/usync.d.ts +0 -36
- package/lib/Socket/usync.js +0 -70
- package/lib/Types/USync.d.ts +0 -25
- package/lib/Types/USync.js +0 -2
- package/lib/WAProto/index.d.ts +0 -53473
- package/lib/WAProto/index.js +0 -165029
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -32
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -57
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -30
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -42
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -53
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -24
- package/lib/WAUSync/Protocols/index.d.ts +0 -4
- package/lib/WAUSync/Protocols/index.js +0 -20
- package/lib/WAUSync/USyncQuery.d.ts +0 -28
- package/lib/WAUSync/USyncQuery.js +0 -89
- package/lib/WAUSync/USyncUser.d.ts +0 -12
- package/lib/WAUSync/USyncUser.js +0 -26
- package/lib/WAUSync/index.d.ts +0 -3
- package/lib/WAUSync/index.js +0 -19
- /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MobileSocketClient = void 0;
|
|
4
|
+
const net_1 = require("net");
|
|
5
|
+
const abstract_socket_client_1 = require("./abstract-socket-client");
|
|
6
|
+
class MobileSocketClient extends abstract_socket_client_1.AbstractSocketClient {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.socket = null;
|
|
10
|
+
}
|
|
11
|
+
get isOpen() {
|
|
12
|
+
var _a;
|
|
13
|
+
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'open';
|
|
14
|
+
}
|
|
15
|
+
get isClosed() {
|
|
16
|
+
var _a;
|
|
17
|
+
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
|
|
18
|
+
}
|
|
19
|
+
get isClosing() {
|
|
20
|
+
var _a;
|
|
21
|
+
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
|
|
22
|
+
}
|
|
23
|
+
get isConnecting() {
|
|
24
|
+
var _a;
|
|
25
|
+
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'opening';
|
|
26
|
+
}
|
|
27
|
+
async connect() {
|
|
28
|
+
var _a;
|
|
29
|
+
if (this.socket) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (this.config.agent) {
|
|
33
|
+
throw new Error('There are not support for proxy agent for mobile connection');
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.socket = (0, net_1.connect)({
|
|
37
|
+
host: this.url.hostname,
|
|
38
|
+
port: Number(this.url.port) || 443
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
this.socket.setMaxListeners(0);
|
|
42
|
+
const events = ['close', 'connect', 'data', 'drain', 'end', 'error', 'lookup', 'ready', 'timeout'];
|
|
43
|
+
for (const event of events) {
|
|
44
|
+
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.on(event, (...args) => this.emit(event, ...args));
|
|
45
|
+
}
|
|
46
|
+
this.socket.on('data', (...args) => this.emit('message', ...args));
|
|
47
|
+
this.socket.on('ready', (...args) => this.emit('open', ...args));
|
|
48
|
+
}
|
|
49
|
+
async close() {
|
|
50
|
+
if (!this.socket) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
return new Promise(resolve => {
|
|
54
|
+
this.socket.end(resolve);
|
|
55
|
+
this.socket = null;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
send(str, cb) {
|
|
59
|
+
if (this.socket === null) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return this.socket.write(str, undefined, cb);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.MobileSocketClient = MobileSocketClient;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import WebSocket from 'ws';
|
|
2
|
-
import { AbstractSocketClient } from './
|
|
2
|
+
import { AbstractSocketClient } from './abstract-socket-client';
|
|
3
3
|
export declare class WebSocketClient extends AbstractSocketClient {
|
|
4
4
|
protected socket: WebSocket | null;
|
|
5
5
|
get isOpen(): boolean;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.WebSocketClient = void 0;
|
|
7
7
|
const ws_1 = __importDefault(require("ws"));
|
|
8
8
|
const Defaults_1 = require("../../Defaults");
|
|
9
|
-
const
|
|
10
|
-
class WebSocketClient extends
|
|
9
|
+
const abstract_socket_client_1 = require("./abstract-socket-client");
|
|
10
|
+
class WebSocketClient extends abstract_socket_client_1.AbstractSocketClient {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
13
|
this.socket = null;
|
package/lib/Socket/business.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
/// <reference types="long" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig } from '../Types';
|
|
2
4
|
import { BinaryNode } from '../WABinary';
|
|
3
5
|
export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
4
|
-
logger: import("
|
|
6
|
+
logger: import("pino").Logger<import("pino").LoggerOptions>;
|
|
5
7
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
6
8
|
getCatalog: ({ jid, limit, cursor }: GetCatalogOptions) => Promise<{
|
|
7
9
|
products: import("../Types").Product[];
|
|
@@ -15,24 +17,26 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
15
17
|
deleted: number;
|
|
16
18
|
}>;
|
|
17
19
|
productUpdate: (productId: string, update: ProductUpdate) => Promise<import("../Types").Product>;
|
|
18
|
-
sendMessageAck: ({ tag, attrs, content }: BinaryNode
|
|
20
|
+
sendMessageAck: ({ tag, attrs, content }: BinaryNode) => Promise<void>;
|
|
19
21
|
sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
20
22
|
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
21
|
-
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").
|
|
22
|
-
requestPlaceholderResend: (messageKey: import("../Types").
|
|
23
|
-
getPrivacyTokens: (jids: string[]) => Promise<
|
|
23
|
+
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAProto.IMessageKey, oldestMsgTimestamp: number | import("long").Long) => Promise<string>;
|
|
24
|
+
requestPlaceholderResend: (messageKey: import("../Types").WAProto.IMessageKey) => Promise<string | undefined>;
|
|
25
|
+
getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
|
|
24
26
|
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
25
27
|
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
26
28
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
27
|
-
sendReceipts: (keys: import("../Types").
|
|
28
|
-
readMessages: (keys: import("../Types").
|
|
29
|
+
sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
30
|
+
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
|
|
29
31
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
30
32
|
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
31
33
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
32
34
|
[_: string]: string;
|
|
33
35
|
}>;
|
|
34
36
|
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
35
|
-
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?:
|
|
37
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
|
|
38
|
+
[key: string]: string;
|
|
39
|
+
} | undefined) => Promise<{
|
|
36
40
|
nodes: BinaryNode[];
|
|
37
41
|
shouldIncludeDeviceIdentity: boolean;
|
|
38
42
|
}>;
|
|
@@ -46,7 +50,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
46
50
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
47
51
|
[key: string]: string;
|
|
48
52
|
}[]>;
|
|
49
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
|
53
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
|
|
50
54
|
status: string;
|
|
51
55
|
jid: string;
|
|
52
56
|
}[]>;
|
|
@@ -55,44 +59,43 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
55
59
|
jid: string;
|
|
56
60
|
content: BinaryNode;
|
|
57
61
|
}[]>;
|
|
58
|
-
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
62
|
+
groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
|
|
59
63
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
60
64
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
61
65
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
62
66
|
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
63
|
-
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<
|
|
67
|
+
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
|
64
68
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
65
69
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
66
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
|
67
|
-
groupMemberAddMode: (jid: string, mode: "
|
|
70
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
|
|
71
|
+
groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
|
|
68
72
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
69
73
|
groupFetchAllParticipating: () => Promise<{
|
|
70
74
|
[_: string]: import("../Types").GroupMetadata;
|
|
71
75
|
}>;
|
|
72
|
-
getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
|
|
73
76
|
processingMutex: {
|
|
74
|
-
mutex<T>(code: () =>
|
|
77
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
75
78
|
};
|
|
76
79
|
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
77
80
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
78
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
79
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
80
|
-
profilePictureUrl: (jid: string, type?: "
|
|
81
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
|
82
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
|
83
|
+
profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
|
|
81
84
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
85
|
+
exists: boolean;
|
|
82
86
|
jid: string;
|
|
83
|
-
|
|
84
|
-
lid: unknown;
|
|
85
|
-
}[] | undefined>;
|
|
87
|
+
}[]>;
|
|
86
88
|
fetchBlocklist: () => Promise<string[]>;
|
|
87
|
-
fetchStatus: (
|
|
88
|
-
|
|
89
|
+
fetchStatus: (jid: string) => Promise<{
|
|
90
|
+
status: string | undefined;
|
|
91
|
+
setAt: Date;
|
|
92
|
+
} | undefined>;
|
|
89
93
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
90
94
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
91
95
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
92
96
|
updateProfileName: (name: string) => Promise<void>;
|
|
93
97
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
94
98
|
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
95
|
-
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
96
99
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
97
100
|
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
98
101
|
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
@@ -100,10 +103,10 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
100
103
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
101
104
|
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
|
|
102
105
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
103
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile
|
|
106
|
+
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
|
|
104
107
|
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
105
108
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
106
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number |
|
|
109
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
|
|
107
110
|
addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
|
|
108
111
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
109
112
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
@@ -111,16 +114,15 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
111
114
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
112
115
|
star: (jid: string, messages: {
|
|
113
116
|
id: string;
|
|
114
|
-
fromMe?: boolean;
|
|
117
|
+
fromMe?: boolean | undefined;
|
|
115
118
|
}[], star: boolean) => Promise<void>;
|
|
116
|
-
executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
|
|
117
119
|
type: "md";
|
|
118
|
-
ws:
|
|
120
|
+
ws: any;
|
|
119
121
|
ev: import("../Types").BaileysEventEmitter & {
|
|
120
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (
|
|
122
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
121
123
|
buffer(): void;
|
|
122
|
-
createBufferedFunction<A extends any[],
|
|
123
|
-
flush(force?: boolean): boolean;
|
|
124
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
125
|
+
flush(force?: boolean | undefined): boolean;
|
|
124
126
|
isBuffering(): boolean;
|
|
125
127
|
};
|
|
126
128
|
authState: {
|
|
@@ -130,17 +132,17 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
130
132
|
signalRepository: import("../Types").SignalRepository;
|
|
131
133
|
user: import("../Types").Contact | undefined;
|
|
132
134
|
generateMessageTag: () => string;
|
|
133
|
-
query: (node: BinaryNode, timeoutMs?: number) => Promise<
|
|
134
|
-
waitForMessage: <
|
|
135
|
+
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
|
|
136
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
|
135
137
|
waitForSocketOpen: () => Promise<void>;
|
|
136
138
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
137
139
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
138
|
-
logout: (msg?: string) => Promise<void>;
|
|
140
|
+
logout: (msg?: string | undefined) => Promise<void>;
|
|
139
141
|
end: (error: Error | undefined) => void;
|
|
140
|
-
onUnexpectedError: (err: Error | import("@hapi/boom").Boom
|
|
142
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
141
143
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
142
144
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
143
145
|
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
144
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) =>
|
|
145
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<
|
|
146
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
147
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
146
148
|
};
|
package/lib/Socket/chats.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Boom } from '@hapi/boom';
|
|
2
3
|
import { proto } from '../../WAProto';
|
|
3
|
-
import {
|
|
4
|
-
import { LabelActionBody } from '../Types/Label';
|
|
4
|
+
import { ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types';
|
|
5
5
|
import { BinaryNode } from '../WABinary';
|
|
6
|
-
import {
|
|
6
|
+
import { LabelActionBody } from '../Types/Label';
|
|
7
7
|
export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
8
|
-
getBotListV2: () => Promise<BotListInfo[]>;
|
|
9
8
|
processingMutex: {
|
|
10
|
-
mutex<T>(code: () =>
|
|
9
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
11
10
|
};
|
|
12
11
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
13
12
|
[_: string]: string;
|
|
@@ -16,22 +15,22 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
16
15
|
appPatch: (patchCreate: WAPatchCreate) => Promise<void>;
|
|
17
16
|
sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>;
|
|
18
17
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
19
|
-
profilePictureUrl: (jid: string, type?:
|
|
18
|
+
profilePictureUrl: (jid: string, type?: 'preview' | 'image', timeoutMs?: number) => Promise<string | undefined>;
|
|
20
19
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
20
|
+
exists: boolean;
|
|
21
21
|
jid: string;
|
|
22
|
-
|
|
23
|
-
lid: unknown;
|
|
24
|
-
}[] | undefined>;
|
|
22
|
+
}[]>;
|
|
25
23
|
fetchBlocklist: () => Promise<string[]>;
|
|
26
|
-
fetchStatus: (
|
|
27
|
-
|
|
24
|
+
fetchStatus: (jid: string) => Promise<{
|
|
25
|
+
status: string | undefined;
|
|
26
|
+
setAt: Date;
|
|
27
|
+
} | undefined>;
|
|
28
28
|
updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
29
29
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
30
30
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
31
31
|
updateProfileName: (name: string) => Promise<void>;
|
|
32
|
-
updateBlockStatus: (jid: string, action:
|
|
32
|
+
updateBlockStatus: (jid: string, action: 'block' | 'unblock') => Promise<void>;
|
|
33
33
|
updateCallPrivacy: (value: WAPrivacyCallValue) => Promise<void>;
|
|
34
|
-
updateMessagesPrivacy: (value: WAPrivacyMessagesValue) => Promise<void>;
|
|
35
34
|
updateLastSeenPrivacy: (value: WAPrivacyValue) => Promise<void>;
|
|
36
35
|
updateOnlinePrivacy: (value: WAPrivacyOnlineValue) => Promise<void>;
|
|
37
36
|
updateProfilePicturePrivacy: (value: WAPrivacyValue) => Promise<void>;
|
|
@@ -42,7 +41,7 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
42
41
|
getBusinessProfile: (jid: string) => Promise<WABusinessProfile | void>;
|
|
43
42
|
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
44
43
|
chatModify: (mod: ChatModification, jid: string) => Promise<void>;
|
|
45
|
-
cleanDirtyBits: (type:
|
|
44
|
+
cleanDirtyBits: (type: 'account_sync' | 'groups', fromTimestamp?: number | string) => Promise<void>;
|
|
46
45
|
addLabel: (jid: string, labels: LabelActionBody) => Promise<void>;
|
|
47
46
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
48
47
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
@@ -52,14 +51,13 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
52
51
|
id: string;
|
|
53
52
|
fromMe?: boolean;
|
|
54
53
|
}[], star: boolean) => Promise<void>;
|
|
55
|
-
executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
|
|
56
54
|
type: "md";
|
|
57
|
-
ws:
|
|
55
|
+
ws: any;
|
|
58
56
|
ev: import("../Types").BaileysEventEmitter & {
|
|
59
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (
|
|
57
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
60
58
|
buffer(): void;
|
|
61
|
-
createBufferedFunction<A extends any[],
|
|
62
|
-
flush(force?: boolean): boolean;
|
|
59
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
60
|
+
flush(force?: boolean | undefined): boolean;
|
|
63
61
|
isBuffering(): boolean;
|
|
64
62
|
};
|
|
65
63
|
authState: {
|
|
@@ -69,17 +67,17 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
69
67
|
signalRepository: import("../Types").SignalRepository;
|
|
70
68
|
user: import("../Types").Contact | undefined;
|
|
71
69
|
generateMessageTag: () => string;
|
|
72
|
-
query: (node: BinaryNode, timeoutMs?: number) => Promise<
|
|
73
|
-
waitForMessage: <
|
|
70
|
+
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
|
|
71
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
|
74
72
|
waitForSocketOpen: () => Promise<void>;
|
|
75
73
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
76
74
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
77
|
-
logout: (msg?: string) => Promise<void>;
|
|
75
|
+
logout: (msg?: string | undefined) => Promise<void>;
|
|
78
76
|
end: (error: Error | undefined) => void;
|
|
79
|
-
onUnexpectedError: (err: Error | Boom
|
|
77
|
+
onUnexpectedError: (err: Error | Boom<any>, msg: string) => void;
|
|
80
78
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
81
79
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
82
80
|
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
83
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) =>
|
|
84
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<
|
|
81
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
82
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
85
83
|
};
|
package/lib/Socket/chats.js
CHANGED
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makeChatsSocket = void 0;
|
|
7
|
-
const node_cache_1 = __importDefault(require("@cacheable/node-cache"));
|
|
8
7
|
const boom_1 = require("@hapi/boom");
|
|
8
|
+
const node_cache_1 = __importDefault(require("node-cache"));
|
|
9
9
|
const WAProto_1 = require("../../WAProto");
|
|
10
10
|
const Defaults_1 = require("../Defaults");
|
|
11
11
|
const Types_1 = require("../Types");
|
|
@@ -13,12 +13,11 @@ const Utils_1 = require("../Utils");
|
|
|
13
13
|
const make_mutex_1 = require("../Utils/make-mutex");
|
|
14
14
|
const process_message_1 = __importDefault(require("../Utils/process-message"));
|
|
15
15
|
const WABinary_1 = require("../WABinary");
|
|
16
|
-
const
|
|
17
|
-
const usync_1 = require("./usync");
|
|
16
|
+
const socket_1 = require("./socket");
|
|
18
17
|
const MAX_SYNC_ATTEMPTS = 2;
|
|
19
18
|
const makeChatsSocket = (config) => {
|
|
20
19
|
const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, } = config;
|
|
21
|
-
const sock = (0,
|
|
20
|
+
const sock = (0, socket_1.makeSocket)(config);
|
|
22
21
|
const { ev, ws, authState, generateMessageTag, sendNode, query, onUnexpectedError, } = sock;
|
|
23
22
|
let privacySettings;
|
|
24
23
|
let needToFlushWithAppStateSync = false;
|
|
@@ -26,7 +25,7 @@ const makeChatsSocket = (config) => {
|
|
|
26
25
|
/** this mutex ensures that the notifications (receipts, messages etc.) are processed in order */
|
|
27
26
|
const processingMutex = (0, make_mutex_1.makeMutex)();
|
|
28
27
|
const placeholderResendCache = config.placeholderResendCache || new node_cache_1.default({
|
|
29
|
-
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY,
|
|
28
|
+
stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY,
|
|
30
29
|
useClones: false
|
|
31
30
|
});
|
|
32
31
|
if (!config.placeholderResendCache) {
|
|
@@ -75,9 +74,6 @@ const makeChatsSocket = (config) => {
|
|
|
75
74
|
}]
|
|
76
75
|
});
|
|
77
76
|
};
|
|
78
|
-
const updateMessagesPrivacy = async (value) => {
|
|
79
|
-
await privacyQuery('messages', value);
|
|
80
|
-
};
|
|
81
77
|
const updateCallPrivacy = async (value) => {
|
|
82
78
|
await privacyQuery('calladd', value);
|
|
83
79
|
};
|
|
@@ -115,78 +111,84 @@ const makeChatsSocket = (config) => {
|
|
|
115
111
|
}]
|
|
116
112
|
});
|
|
117
113
|
};
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
/** helper function to run a generic IQ query */
|
|
115
|
+
const interactiveQuery = async (userNodes, queryNode) => {
|
|
116
|
+
const result = await query({
|
|
120
117
|
tag: 'iq',
|
|
121
118
|
attrs: {
|
|
122
|
-
xmlns: 'bot',
|
|
123
119
|
to: WABinary_1.S_WHATSAPP_NET,
|
|
124
|
-
type: 'get'
|
|
120
|
+
type: 'get',
|
|
121
|
+
xmlns: 'usync',
|
|
125
122
|
},
|
|
126
|
-
content: [
|
|
127
|
-
|
|
123
|
+
content: [
|
|
124
|
+
{
|
|
125
|
+
tag: 'usync',
|
|
128
126
|
attrs: {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
127
|
+
sid: generateMessageTag(),
|
|
128
|
+
mode: 'query',
|
|
129
|
+
last: 'true',
|
|
130
|
+
index: '0',
|
|
131
|
+
context: 'interactive',
|
|
132
|
+
},
|
|
133
|
+
content: [
|
|
134
|
+
{
|
|
135
|
+
tag: 'query',
|
|
136
|
+
attrs: {},
|
|
137
|
+
content: [queryNode]
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
tag: 'list',
|
|
141
|
+
attrs: {},
|
|
142
|
+
content: userNodes
|
|
143
|
+
}
|
|
144
|
+
]
|
|
142
145
|
}
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
const usyncNode = (0, WABinary_1.getBinaryNodeChild)(result, 'usync');
|
|
149
|
+
const listNode = (0, WABinary_1.getBinaryNodeChild)(usyncNode, 'list');
|
|
150
|
+
const users = (0, WABinary_1.getBinaryNodeChildren)(listNode, 'user');
|
|
151
|
+
return users;
|
|
146
152
|
};
|
|
147
153
|
const onWhatsApp = async (...jids) => {
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
const fetchDisappearingDuration = async (...jids) => {
|
|
172
|
-
const usyncQuery = new WAUSync_1.USyncQuery()
|
|
173
|
-
.withDisappearingModeProtocol();
|
|
174
|
-
for (const jid of jids) {
|
|
175
|
-
usyncQuery.withUser(new WAUSync_1.USyncUser().withId(jid));
|
|
176
|
-
}
|
|
177
|
-
const result = await sock.executeUSyncQuery(usyncQuery);
|
|
154
|
+
const query = { tag: 'contact', attrs: {} };
|
|
155
|
+
const list = jids.map((jid) => {
|
|
156
|
+
// insures only 1 + is there
|
|
157
|
+
const content = `+${jid.replace('+', '')}`;
|
|
158
|
+
return {
|
|
159
|
+
tag: 'user',
|
|
160
|
+
attrs: {},
|
|
161
|
+
content: [{
|
|
162
|
+
tag: 'contact',
|
|
163
|
+
attrs: {},
|
|
164
|
+
content,
|
|
165
|
+
}],
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
const results = await interactiveQuery(list, query);
|
|
169
|
+
return results.map(user => {
|
|
170
|
+
const contact = (0, WABinary_1.getBinaryNodeChild)(user, 'contact');
|
|
171
|
+
return { exists: (contact === null || contact === void 0 ? void 0 : contact.attrs.type) === 'in', jid: user.attrs.jid };
|
|
172
|
+
}).filter(item => item.exists);
|
|
173
|
+
};
|
|
174
|
+
const fetchStatus = async (jid) => {
|
|
175
|
+
const [result] = await interactiveQuery([{ tag: 'user', attrs: { jid } }], { tag: 'status', attrs: {} });
|
|
178
176
|
if (result) {
|
|
179
|
-
|
|
177
|
+
const status = (0, WABinary_1.getBinaryNodeChild)(result, 'status');
|
|
178
|
+
return {
|
|
179
|
+
status: status === null || status === void 0 ? void 0 : status.content.toString(),
|
|
180
|
+
setAt: new Date(+((status === null || status === void 0 ? void 0 : status.attrs.t) || 0) * 1000)
|
|
181
|
+
};
|
|
180
182
|
}
|
|
181
183
|
};
|
|
182
184
|
/** update the profile picture for yourself or a group */
|
|
183
185
|
const updateProfilePicture = async (jid, content) => {
|
|
184
|
-
let targetJid;
|
|
186
|
+
let targetJid = '';
|
|
185
187
|
if (!jid) {
|
|
186
188
|
throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
187
189
|
}
|
|
188
190
|
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
189
|
-
targetJid =
|
|
191
|
+
targetJid = jid; // in case it is someone other than us
|
|
190
192
|
}
|
|
191
193
|
const { img } = await (0, Utils_1.generateProfilePicture)(content);
|
|
192
194
|
await query({
|
|
@@ -208,12 +210,12 @@ const makeChatsSocket = (config) => {
|
|
|
208
210
|
};
|
|
209
211
|
/** remove the profile picture for yourself or a group */
|
|
210
212
|
const removeProfilePicture = async (jid) => {
|
|
211
|
-
let targetJid;
|
|
213
|
+
let targetJid = '';
|
|
212
214
|
if (!jid) {
|
|
213
215
|
throw new boom_1.Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
214
216
|
}
|
|
215
217
|
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
216
|
-
targetJid =
|
|
218
|
+
targetJid = jid; // in case it is someone other than us
|
|
217
219
|
}
|
|
218
220
|
await query({
|
|
219
221
|
tag: 'iq',
|
|
@@ -625,7 +627,7 @@ const makeChatsSocket = (config) => {
|
|
|
625
627
|
};
|
|
626
628
|
/** sending non-abt props may fix QR scan fail if server expects */
|
|
627
629
|
const fetchProps = async () => {
|
|
628
|
-
var _a, _b
|
|
630
|
+
var _a, _b;
|
|
629
631
|
const resultNode = await query({
|
|
630
632
|
tag: 'iq',
|
|
631
633
|
attrs: {
|
|
@@ -643,10 +645,8 @@ const makeChatsSocket = (config) => {
|
|
|
643
645
|
const propsNode = (0, WABinary_1.getBinaryNodeChild)(resultNode, 'props');
|
|
644
646
|
let props = {};
|
|
645
647
|
if (propsNode) {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
ev.emit('creds.update', authState.creds);
|
|
649
|
-
}
|
|
648
|
+
authState.creds.lastPropHash = (_b = propsNode === null || propsNode === void 0 ? void 0 : propsNode.attrs) === null || _b === void 0 ? void 0 : _b.hash;
|
|
649
|
+
ev.emit('creds.update', authState.creds);
|
|
650
650
|
props = (0, WABinary_1.reduceBinaryNodeToDictionary)(propsNode, 'prop');
|
|
651
651
|
}
|
|
652
652
|
logger.debug('fetched props');
|
|
@@ -774,6 +774,7 @@ const makeChatsSocket = (config) => {
|
|
|
774
774
|
keyStore: authState.keys,
|
|
775
775
|
logger,
|
|
776
776
|
options: config.options,
|
|
777
|
+
getMessage: config.getMessage,
|
|
777
778
|
})
|
|
778
779
|
]);
|
|
779
780
|
if (((_c = (_b = msg.message) === null || _b === void 0 ? void 0 : _b.protocolMessage) === null || _c === void 0 ? void 0 : _c.appStateSyncKeyShare)
|
|
@@ -828,18 +829,18 @@ const makeChatsSocket = (config) => {
|
|
|
828
829
|
sendPresenceUpdate(markOnlineOnConnect ? 'available' : 'unavailable')
|
|
829
830
|
.catch(error => onUnexpectedError(error, 'presence update requests'));
|
|
830
831
|
}
|
|
831
|
-
if (receivedPendingNotifications
|
|
832
|
+
if (receivedPendingNotifications) {
|
|
833
|
+
// if we don't have the app state key
|
|
832
834
|
// we keep buffering events until we finally have
|
|
833
835
|
// the key and can sync the messages
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
836
|
+
if (!((_a = authState.creds) === null || _a === void 0 ? void 0 : _a.myAppStateKeyId) && !config.mobile) {
|
|
837
|
+
ev.buffer();
|
|
838
|
+
needToFlushWithAppStateSync = true;
|
|
839
|
+
}
|
|
838
840
|
}
|
|
839
841
|
});
|
|
840
842
|
return {
|
|
841
843
|
...sock,
|
|
842
|
-
getBotListV2,
|
|
843
844
|
processingMutex,
|
|
844
845
|
fetchPrivacySettings,
|
|
845
846
|
upsertMessage,
|
|
@@ -850,14 +851,12 @@ const makeChatsSocket = (config) => {
|
|
|
850
851
|
onWhatsApp,
|
|
851
852
|
fetchBlocklist,
|
|
852
853
|
fetchStatus,
|
|
853
|
-
fetchDisappearingDuration,
|
|
854
854
|
updateProfilePicture,
|
|
855
855
|
removeProfilePicture,
|
|
856
856
|
updateProfileStatus,
|
|
857
857
|
updateProfileName,
|
|
858
858
|
updateBlockStatus,
|
|
859
859
|
updateCallPrivacy,
|
|
860
|
-
updateMessagesPrivacy,
|
|
861
860
|
updateLastSeenPrivacy,
|
|
862
861
|
updateOnlinePrivacy,
|
|
863
862
|
updateProfilePicturePrivacy,
|