gifted-baileys 1.5.0 → 1.5.4
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/README.md +1429 -684
- package/WAProto/WAProto.proto +969 -88
- package/WAProto/index.d.ts +13199 -1260
- package/WAProto/index.js +124901 -74525
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +2 -2
- package/lib/Defaults/index.js +6 -5
- package/lib/Defaults/phonenumber-mcc.json +221 -221
- package/lib/Signal/libsignal.js +18 -9
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -2
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -1
- package/lib/Socket/Client/types.d.ts +17 -0
- package/lib/Socket/Client/types.js +13 -0
- package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
- package/lib/Socket/Client/{web-socket-client.js → websocket.js} +2 -2
- package/lib/Socket/business.d.ts +64 -29
- package/lib/Socket/business.js +1 -0
- package/lib/Socket/chats.d.ts +10 -8
- package/lib/Socket/chats.js +114 -97
- package/lib/Socket/groups.d.ts +10 -8
- package/lib/Socket/groups.js +4 -2
- package/lib/Socket/index.d.ts +70 -35
- package/lib/Socket/messages-recv.d.ts +63 -29
- package/lib/Socket/messages-recv.js +374 -155
- package/lib/Socket/messages-send.d.ts +48 -12
- package/lib/Socket/messages-send.js +445 -87
- package/lib/Socket/newsletter.d.ts +132 -0
- package/lib/Socket/newsletter.js +236 -0
- package/lib/Socket/registration.d.ts +73 -41
- package/lib/Socket/registration.js +7 -7
- package/lib/Socket/socket.d.ts +2 -0
- package/lib/Socket/socket.js +56 -15
- package/lib/Socket/usync.d.ts +37 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/make-cache-manager-store.d.ts +2 -1
- package/lib/Store/make-in-memory-store.d.ts +2 -1
- package/lib/Store/make-in-memory-store.js +40 -46
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Types/Auth.d.ts +2 -1
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +12 -7
- package/lib/Types/Events.d.ts +17 -2
- package/lib/Types/GroupMetadata.d.ts +6 -2
- package/lib/Types/Label.d.ts +11 -0
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +184 -12
- package/lib/Types/Newsletter.d.ts +92 -0
- package/lib/Types/Newsletter.js +32 -0
- package/lib/Types/Socket.d.ts +7 -2
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.d.ts +10 -0
- package/lib/Types/index.js +2 -1
- package/lib/Utils/auth-utils.js +5 -3
- package/lib/Utils/business.d.ts +1 -1
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +11 -12
- package/lib/Utils/chat-utils.js +41 -20
- package/lib/Utils/crypto.d.ts +15 -16
- package/lib/Utils/crypto.js +35 -23
- package/lib/Utils/decode-wa-message.d.ts +17 -0
- package/lib/Utils/decode-wa-message.js +65 -13
- package/lib/Utils/generics.d.ts +11 -17
- package/lib/Utils/generics.js +47 -13
- package/lib/Utils/history.d.ts +6 -2
- package/lib/Utils/history.js +3 -0
- package/lib/Utils/link-preview.js +1 -1
- package/lib/Utils/logger.d.ts +1 -3
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +31 -25
- package/lib/Utils/messages-media.js +95 -53
- package/lib/Utils/messages.d.ts +2 -1
- package/lib/Utils/messages.js +515 -34
- package/lib/Utils/noise-handler.d.ts +6 -6
- package/lib/Utils/noise-handler.js +16 -3
- package/lib/Utils/process-message.js +4 -3
- package/lib/Utils/signal.d.ts +2 -1
- package/lib/Utils/signal.js +11 -19
- package/lib/Utils/use-multi-file-auth-state.js +11 -3
- package/lib/Utils/validate-connection.js +16 -2
- package/lib/WABinary/decode.d.ts +1 -2
- package/lib/WABinary/decode.js +17 -7
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +33 -17
- package/lib/WABinary/generic-utils.d.ts +2 -3
- package/lib/WABinary/generic-utils.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +4 -2
- package/lib/WABinary/jid-utils.js +4 -1
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/BinaryInfo.js +13 -0
- package/lib/WAM/constants.d.ts +38 -0
- package/lib/WAM/constants.js +15350 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.js +155 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +19 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
- package/lib/WAUSync/Protocols/index.d.ts +4 -0
- package/lib/WAUSync/Protocols/index.js +20 -0
- package/lib/WAUSync/USyncQuery.d.ts +26 -0
- package/lib/WAUSync/USyncQuery.js +79 -0
- package/lib/WAUSync/USyncUser.d.ts +10 -0
- package/lib/WAUSync/USyncUser.js +22 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +19 -0
- package/lib/gifted +1 -0
- package/lib/index.js +2 -0
- package/package.json +10 -7
- package/lib/index.d.ts +0 -10
package/lib/Socket/business.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig } from '../Types';
|
|
3
2
|
import { BinaryNode } from '../WABinary';
|
|
4
3
|
export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
4
|
+
logger: Logger;
|
|
5
5
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
6
6
|
getCatalog: ({ jid, limit, cursor }: GetCatalogOptions) => Promise<{
|
|
7
7
|
products: import("../Types").Product[];
|
|
8
|
-
nextPageCursor:
|
|
8
|
+
nextPageCursor: any;
|
|
9
9
|
}>;
|
|
10
10
|
getCollections: (jid?: string, limit?: number) => Promise<{
|
|
11
11
|
collections: import("../Types").CatalogCollection[];
|
|
@@ -15,25 +15,59 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
15
15
|
deleted: number;
|
|
16
16
|
}>;
|
|
17
17
|
productUpdate: (productId: string, update: ProductUpdate) => Promise<import("../Types").Product>;
|
|
18
|
-
sendMessageAck: ({ tag, attrs }: BinaryNode) => Promise<void>;
|
|
18
|
+
sendMessageAck: ({ tag, attrs, content }: BinaryNode, errorCode?: number) => Promise<void>;
|
|
19
19
|
sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
20
|
+
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
21
|
+
id: any;
|
|
22
|
+
to: string;
|
|
23
|
+
}>;
|
|
20
24
|
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
25
|
+
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
|
|
26
|
+
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
|
|
21
27
|
getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
|
|
22
28
|
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
23
|
-
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
29
|
+
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
24
30
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
25
|
-
sendReceipts: (keys: import("../Types").
|
|
26
|
-
getButtonArgs: (message: import("../Types").WAProto.IMessage) =>
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
|
|
31
|
+
sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
32
|
+
getButtonArgs: (message: import("../Types").WAProto.IMessage) => BinaryNode["attrs"];
|
|
33
|
+
readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
|
|
30
34
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
35
|
+
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
36
|
+
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
37
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: BinaryNode["attrs"]) => Promise<{
|
|
38
|
+
nodes: BinaryNode[];
|
|
39
|
+
shouldIncludeDeviceIdentity: boolean;
|
|
40
|
+
}>;
|
|
31
41
|
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
32
42
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
33
43
|
[_: string]: string;
|
|
34
44
|
}>;
|
|
35
45
|
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
46
|
+
sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
47
|
+
sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
36
48
|
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
|
|
49
|
+
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
50
|
+
duration: string;
|
|
51
|
+
}>;
|
|
52
|
+
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
53
|
+
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
54
|
+
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
55
|
+
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
56
|
+
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
57
|
+
newsletterUnfollow: (jid: string) => Promise<void>;
|
|
58
|
+
newsletterFollow: (jid: string) => Promise<void>;
|
|
59
|
+
newsletterUnmute: (jid: string) => Promise<void>;
|
|
60
|
+
newsletterMute: (jid: string) => Promise<void>;
|
|
61
|
+
newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
|
|
62
|
+
newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
|
|
63
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
64
|
+
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
65
|
+
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
66
|
+
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
67
|
+
newsletterDelete: (jid: string) => Promise<void>;
|
|
68
|
+
newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
|
|
69
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
70
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
37
71
|
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
38
72
|
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
39
73
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -41,7 +75,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
41
75
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
42
76
|
[key: string]: string;
|
|
43
77
|
}[]>;
|
|
44
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
|
78
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
45
79
|
status: string;
|
|
46
80
|
jid: string;
|
|
47
81
|
}[]>;
|
|
@@ -50,27 +84,27 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
50
84
|
jid: string;
|
|
51
85
|
content: BinaryNode;
|
|
52
86
|
}[]>;
|
|
53
|
-
groupUpdateDescription: (jid: string, description?: string
|
|
87
|
+
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
54
88
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
55
89
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
56
90
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
57
91
|
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
|
58
92
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
59
93
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
60
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
|
61
|
-
groupMemberAddMode: (jid: string, mode: "
|
|
94
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
95
|
+
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
62
96
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
63
97
|
groupFetchAllParticipating: () => Promise<{
|
|
64
98
|
[_: string]: import("../Types").GroupMetadata;
|
|
65
99
|
}>;
|
|
66
100
|
processingMutex: {
|
|
67
|
-
mutex<T>(code: () => T |
|
|
101
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
68
102
|
};
|
|
69
103
|
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
70
104
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
71
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string
|
|
72
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer
|
|
73
|
-
profilePictureUrl: (jid: string, type?: "
|
|
105
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
106
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
107
|
+
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
74
108
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
75
109
|
exists: boolean;
|
|
76
110
|
jid: string;
|
|
@@ -92,25 +126,25 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
92
126
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
93
127
|
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
94
128
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
95
|
-
getBusinessProfile: (jid: string) => Promise<
|
|
129
|
+
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
96
130
|
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
97
131
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
98
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?:
|
|
132
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
99
133
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
100
134
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
101
135
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
102
136
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
103
137
|
star: (jid: string, messages: {
|
|
104
138
|
id: string;
|
|
105
|
-
fromMe?: boolean
|
|
139
|
+
fromMe?: boolean;
|
|
106
140
|
}[], star: boolean) => Promise<void>;
|
|
107
141
|
type: "md";
|
|
108
142
|
ws: any;
|
|
109
143
|
ev: import("../Types").BaileysEventEmitter & {
|
|
110
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
144
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
111
145
|
buffer(): void;
|
|
112
|
-
createBufferedFunction<A extends any[],
|
|
113
|
-
flush(force?: boolean
|
|
146
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
147
|
+
flush(force?: boolean): boolean;
|
|
114
148
|
isBuffering(): boolean;
|
|
115
149
|
};
|
|
116
150
|
authState: {
|
|
@@ -120,16 +154,17 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
120
154
|
signalRepository: import("../Types").SignalRepository;
|
|
121
155
|
user: import("../Types").Contact | undefined;
|
|
122
156
|
generateMessageTag: () => string;
|
|
123
|
-
query: (node: BinaryNode, timeoutMs?: number
|
|
124
|
-
waitForMessage: <
|
|
157
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
|
|
158
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
|
|
125
159
|
waitForSocketOpen: () => Promise<void>;
|
|
126
160
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
127
161
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
128
|
-
logout: (msg?: string
|
|
162
|
+
logout: (msg?: string) => Promise<void>;
|
|
129
163
|
end: (error: Error | undefined) => void;
|
|
130
|
-
onUnexpectedError: (err: Error |
|
|
164
|
+
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
131
165
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
132
166
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
133
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
134
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number
|
|
167
|
+
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
168
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
169
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
135
170
|
};
|
package/lib/Socket/business.js
CHANGED
package/lib/Socket/chats.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { Boom } from '@hapi/boom';
|
|
|
3
3
|
import { proto } from '../../WAProto';
|
|
4
4
|
import { ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAPatchCreate, WAPresence, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types';
|
|
5
5
|
import { BinaryNode } from '../WABinary';
|
|
6
|
+
import { USyncQuery } from '../WAUSync';
|
|
6
7
|
export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
8
|
+
interactiveQuery: (userNodes: BinaryNode[], queryNode: BinaryNode) => Promise<BinaryNode[]>;
|
|
7
9
|
processingMutex: {
|
|
8
10
|
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
9
11
|
};
|
|
@@ -12,18 +14,16 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
12
14
|
}>;
|
|
13
15
|
upsertMessage: (msg: proto.IWebMessageInfo, type: MessageUpsertType) => Promise<void>;
|
|
14
16
|
appPatch: (patchCreate: WAPatchCreate) => Promise<void>;
|
|
17
|
+
fetchUserLid: (jid: string) => Promise<string | undefined>;
|
|
15
18
|
sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>;
|
|
16
19
|
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
17
|
-
profilePictureUrl: (jid: string, type?: 'preview' | 'image', timeoutMs?: number) => Promise<string | undefined>;
|
|
18
20
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
19
|
-
exists: boolean;
|
|
20
21
|
jid: string;
|
|
21
|
-
|
|
22
|
+
exists: unknown;
|
|
23
|
+
}[] | undefined>;
|
|
22
24
|
fetchBlocklist: () => Promise<string[]>;
|
|
23
|
-
fetchStatus: (
|
|
24
|
-
|
|
25
|
-
setAt: Date;
|
|
26
|
-
} | undefined>;
|
|
25
|
+
fetchStatus: (...jids: string[]) => Promise<import("../WAUSync").USyncQueryResultList[] | undefined>;
|
|
26
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("../WAUSync").USyncQueryResultList[] | undefined>;
|
|
27
27
|
updateProfilePicture: (jid: string, content: WAMediaUpload) => Promise<void>;
|
|
28
28
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
29
29
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
@@ -48,6 +48,7 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
48
48
|
id: string;
|
|
49
49
|
fromMe?: boolean;
|
|
50
50
|
}[], star: boolean) => Promise<void>;
|
|
51
|
+
executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
|
|
51
52
|
type: "md";
|
|
52
53
|
ws: any;
|
|
53
54
|
ev: import("../Types").BaileysEventEmitter & {
|
|
@@ -74,6 +75,7 @@ export declare const makeChatsSocket: (config: SocketConfig) => {
|
|
|
74
75
|
onUnexpectedError: (err: Error | Boom<any>, msg: string) => void;
|
|
75
76
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
76
77
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
77
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
78
|
+
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
78
79
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
80
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
79
81
|
};
|
package/lib/Socket/chats.js
CHANGED
|
@@ -12,12 +12,13 @@ const Utils_1 = require("../Utils");
|
|
|
12
12
|
const make_mutex_1 = require("../Utils/make-mutex");
|
|
13
13
|
const process_message_1 = __importDefault(require("../Utils/process-message"));
|
|
14
14
|
const WABinary_1 = require("../WABinary");
|
|
15
|
-
const
|
|
15
|
+
const WAUSync_1 = require("../WAUSync");
|
|
16
|
+
const usync_1 = require("./usync");
|
|
16
17
|
const MAX_SYNC_ATTEMPTS = 2;
|
|
17
18
|
const makeChatsSocket = (config) => {
|
|
18
19
|
const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, } = config;
|
|
19
|
-
const sock = (0,
|
|
20
|
-
const { ev, ws, authState, generateMessageTag, sendNode, query, onUnexpectedError
|
|
20
|
+
const sock = (0, usync_1.makeUSyncSocket)(config);
|
|
21
|
+
const { ev, ws, authState, generateMessageTag, sendNode, query, onUnexpectedError } = sock;
|
|
21
22
|
let privacySettings;
|
|
22
23
|
let needToFlushWithAppStateSync = false;
|
|
23
24
|
let pendingAppStateSync = false;
|
|
@@ -139,44 +140,70 @@ const makeChatsSocket = (config) => {
|
|
|
139
140
|
const users = (0, WABinary_1.getBinaryNodeChildren)(listNode, 'user');
|
|
140
141
|
return users;
|
|
141
142
|
};
|
|
142
|
-
const
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
// insures only 1 + is there
|
|
146
|
-
const content = `+${jid.replace('+', '')}`;
|
|
147
|
-
return {
|
|
143
|
+
const fetchUserLid = async (jid) => {
|
|
144
|
+
const [result] = await interactiveQuery([
|
|
145
|
+
{
|
|
148
146
|
tag: 'user',
|
|
149
|
-
attrs: {}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}],
|
|
155
|
-
};
|
|
147
|
+
attrs: { jid }
|
|
148
|
+
}
|
|
149
|
+
], {
|
|
150
|
+
tag: 'lid',
|
|
151
|
+
attrs: {}
|
|
156
152
|
});
|
|
157
|
-
const results = await interactiveQuery(list, query);
|
|
158
|
-
return results.map(user => {
|
|
159
|
-
const contact = (0, WABinary_1.getBinaryNodeChild)(user, 'contact');
|
|
160
|
-
return { exists: (contact === null || contact === void 0 ? void 0 : contact.attrs.type) === 'in', jid: user.attrs.jid };
|
|
161
|
-
}).filter(item => item.exists);
|
|
162
|
-
};
|
|
163
|
-
const fetchStatus = async (jid) => {
|
|
164
|
-
const [result] = await interactiveQuery([{ tag: 'user', attrs: { jid } }], { tag: 'status', attrs: {} });
|
|
165
153
|
if (result) {
|
|
166
|
-
const
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
154
|
+
const lid = (0, WABinary_1.getBinaryNodeChild)(result, 'lid');
|
|
155
|
+
return lid.attrs.val;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const onWhatsApp = async (...jids) => {
|
|
159
|
+
const usyncQuery = new WAUSync_1.USyncQuery()
|
|
160
|
+
.withContactProtocol();
|
|
161
|
+
for (const jid of jids) {
|
|
162
|
+
const phone = `+${jid.replace('+', '').split('@')[0].split(':')[0]}`;
|
|
163
|
+
usyncQuery.withUser(new WAUSync_1.USyncUser().withPhone(phone));
|
|
164
|
+
}
|
|
165
|
+
const results = await sock.executeUSyncQuery(usyncQuery);
|
|
166
|
+
if (results) {
|
|
167
|
+
return results.list.filter((a) => !!a.contact).map(({ contact, id }) => ({ jid: id, exists: contact }));
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const fetchStatus = async (...jids) => {
|
|
171
|
+
const usyncQuery = new WAUSync_1.USyncQuery()
|
|
172
|
+
.withStatusProtocol();
|
|
173
|
+
for (const jid of jids) {
|
|
174
|
+
usyncQuery.withUser(new WAUSync_1.USyncUser().withId(jid));
|
|
175
|
+
}
|
|
176
|
+
const result = await sock.executeUSyncQuery(usyncQuery);
|
|
177
|
+
if (result) {
|
|
178
|
+
return result.list;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const fetchDisappearingDuration = async (...jids) => {
|
|
182
|
+
const usyncQuery = new WAUSync_1.USyncQuery()
|
|
183
|
+
.withDisappearingModeProtocol();
|
|
184
|
+
for (const jid of jids) {
|
|
185
|
+
usyncQuery.withUser(new WAUSync_1.USyncUser().withId(jid));
|
|
186
|
+
}
|
|
187
|
+
const result = await sock.executeUSyncQuery(usyncQuery);
|
|
188
|
+
if (result) {
|
|
189
|
+
return result.list;
|
|
171
190
|
}
|
|
172
191
|
};
|
|
173
192
|
/** update the profile picture for yourself or a group */
|
|
174
193
|
const updateProfilePicture = async (jid, content) => {
|
|
194
|
+
let targetJid;
|
|
195
|
+
if (!jid) {
|
|
196
|
+
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');
|
|
197
|
+
}
|
|
198
|
+
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
199
|
+
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
200
|
+
}
|
|
175
201
|
const { img } = await (0, Utils_1.generateProfilePicture)(content);
|
|
176
202
|
await query({
|
|
177
203
|
tag: 'iq',
|
|
178
204
|
attrs: {
|
|
179
|
-
|
|
205
|
+
target: targetJid,
|
|
206
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
180
207
|
type: 'set',
|
|
181
208
|
xmlns: 'w:profile:picture'
|
|
182
209
|
},
|
|
@@ -191,10 +218,18 @@ const makeChatsSocket = (config) => {
|
|
|
191
218
|
};
|
|
192
219
|
/** remove the profile picture for yourself or a group */
|
|
193
220
|
const removeProfilePicture = async (jid) => {
|
|
221
|
+
let targetJid;
|
|
222
|
+
if (!jid) {
|
|
223
|
+
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');
|
|
224
|
+
}
|
|
225
|
+
if ((0, WABinary_1.jidNormalizedUser)(jid) !== (0, WABinary_1.jidNormalizedUser)(authState.creds.me.id)) {
|
|
226
|
+
targetJid = (0, WABinary_1.jidNormalizedUser)(jid); // in case it is someone other than us
|
|
227
|
+
}
|
|
194
228
|
await query({
|
|
195
229
|
tag: 'iq',
|
|
196
230
|
attrs: {
|
|
197
|
-
|
|
231
|
+
target: targetJid,
|
|
232
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
198
233
|
type: 'set',
|
|
199
234
|
xmlns: 'w:profile:picture'
|
|
200
235
|
}
|
|
@@ -280,9 +315,9 @@ const makeChatsSocket = (config) => {
|
|
|
280
315
|
const email = (0, WABinary_1.getBinaryNodeChild)(profiles, 'email');
|
|
281
316
|
const category = (0, WABinary_1.getBinaryNodeChild)((0, WABinary_1.getBinaryNodeChild)(profiles, 'categories'), 'category');
|
|
282
317
|
const businessHours = (0, WABinary_1.getBinaryNodeChild)(profiles, 'business_hours');
|
|
283
|
-
const businessHoursConfig = businessHours
|
|
284
|
-
|
|
285
|
-
|
|
318
|
+
const businessHoursConfig = businessHours ?
|
|
319
|
+
(0, WABinary_1.getBinaryNodeChildren)(businessHours, 'business_hours_config') :
|
|
320
|
+
undefined;
|
|
286
321
|
const websiteStr = (_a = website === null || website === void 0 ? void 0 : website.content) === null || _a === void 0 ? void 0 : _a.toString();
|
|
287
322
|
return {
|
|
288
323
|
wid: (_b = profiles.attrs) === null || _b === void 0 ? void 0 : _b.jid,
|
|
@@ -391,12 +426,16 @@ const makeChatsSocket = (config) => {
|
|
|
391
426
|
states[name] = newState;
|
|
392
427
|
Object.assign(globalMutationMap, mutationMap);
|
|
393
428
|
logger.info(`restored state of ${name} from snapshot to v${newState.version} with mutations`);
|
|
394
|
-
await authState.keys.set({ 'app-state-sync-version': {
|
|
429
|
+
await authState.keys.set({ 'app-state-sync-version': {
|
|
430
|
+
[name]: newState
|
|
431
|
+
} });
|
|
395
432
|
}
|
|
396
433
|
// only process if there are syncd patches
|
|
397
434
|
if (patches.length) {
|
|
398
435
|
const { state: newState, mutationMap } = await (0, Utils_1.decodePatches)(name, patches, states[name], getAppStateSyncKey, config.options, initialVersionMap[name], logger, appStateMacVerification.patch);
|
|
399
|
-
await authState.keys.set({ 'app-state-sync-version': {
|
|
436
|
+
await authState.keys.set({ 'app-state-sync-version': {
|
|
437
|
+
[name]: newState
|
|
438
|
+
} });
|
|
400
439
|
logger.info(`synced ${name} to v${newState.version}`);
|
|
401
440
|
initialVersionMap[name] = newState.version;
|
|
402
441
|
Object.assign(globalMutationMap, mutationMap);
|
|
@@ -411,11 +450,13 @@ const makeChatsSocket = (config) => {
|
|
|
411
450
|
catch (error) {
|
|
412
451
|
// if retry attempts overshoot
|
|
413
452
|
// or key not found
|
|
414
|
-
const isIrrecoverableError = attemptsMap[name] >= MAX_SYNC_ATTEMPTS
|
|
415
|
-
|
|
416
|
-
|
|
453
|
+
const isIrrecoverableError = attemptsMap[name] >= MAX_SYNC_ATTEMPTS ||
|
|
454
|
+
((_a = error.output) === null || _a === void 0 ? void 0 : _a.statusCode) === 404 ||
|
|
455
|
+
error.name === 'TypeError';
|
|
417
456
|
logger.info({ name, error: error.stack }, `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}`);
|
|
418
|
-
await authState.keys.set({ 'app-state-sync-version': {
|
|
457
|
+
await authState.keys.set({ 'app-state-sync-version': {
|
|
458
|
+
[name]: null
|
|
459
|
+
} });
|
|
419
460
|
// increment number of retries
|
|
420
461
|
attemptsMap[name] = (attemptsMap[name] || 0) + 1;
|
|
421
462
|
if (isIrrecoverableError) {
|
|
@@ -436,23 +477,6 @@ const makeChatsSocket = (config) => {
|
|
|
436
477
|
* type = "preview" for a low res picture
|
|
437
478
|
* type = "image for the high res picture"
|
|
438
479
|
*/
|
|
439
|
-
const profilePictureUrl = async (jid, type = 'preview', timeoutMs) => {
|
|
440
|
-
var _a;
|
|
441
|
-
jid = (0, WABinary_1.jidNormalizedUser)(jid);
|
|
442
|
-
const result = await query({
|
|
443
|
-
tag: 'iq',
|
|
444
|
-
attrs: {
|
|
445
|
-
to: jid,
|
|
446
|
-
type: 'get',
|
|
447
|
-
xmlns: 'w:profile:picture'
|
|
448
|
-
},
|
|
449
|
-
content: [
|
|
450
|
-
{ tag: 'picture', attrs: { type, query: 'url' } }
|
|
451
|
-
]
|
|
452
|
-
}, timeoutMs);
|
|
453
|
-
const child = (0, WABinary_1.getBinaryNodeChild)(result, 'picture');
|
|
454
|
-
return (_a = child === null || child === void 0 ? void 0 : child.attrs) === null || _a === void 0 ? void 0 : _a.url;
|
|
455
|
-
};
|
|
456
480
|
const sendPresenceUpdate = async (type, toJid) => {
|
|
457
481
|
const me = authState.creds.me;
|
|
458
482
|
if (type === 'available' || type === 'unavailable') {
|
|
@@ -496,22 +520,22 @@ const makeChatsSocket = (config) => {
|
|
|
496
520
|
id: generateMessageTag(),
|
|
497
521
|
type: 'subscribe'
|
|
498
522
|
},
|
|
499
|
-
content: tcToken
|
|
500
|
-
|
|
523
|
+
content: tcToken ?
|
|
524
|
+
[
|
|
501
525
|
{
|
|
502
526
|
tag: 'tctoken',
|
|
503
527
|
attrs: {},
|
|
504
528
|
content: tcToken
|
|
505
529
|
}
|
|
506
|
-
]
|
|
507
|
-
|
|
530
|
+
] :
|
|
531
|
+
undefined
|
|
508
532
|
}));
|
|
509
533
|
const handlePresenceUpdate = ({ tag, attrs, content }) => {
|
|
510
534
|
var _a;
|
|
511
535
|
let presence;
|
|
512
536
|
const jid = attrs.from;
|
|
513
537
|
const participant = attrs.participant || attrs.from;
|
|
514
|
-
if (shouldIgnoreJid(jid)) {
|
|
538
|
+
if (shouldIgnoreJid(jid) && jid !== '@s.whatsapp.net') {
|
|
515
539
|
return;
|
|
516
540
|
}
|
|
517
541
|
if (tag === 'presence') {
|
|
@@ -535,7 +559,9 @@ const makeChatsSocket = (config) => {
|
|
|
535
559
|
logger.error({ tag, attrs, content }, 'recv invalid presence node');
|
|
536
560
|
}
|
|
537
561
|
if (presence) {
|
|
538
|
-
ev.emit('presence.update', { id: jid, presences: {
|
|
562
|
+
ev.emit('presence.update', { id: jid, presences: {
|
|
563
|
+
[participant]: presence
|
|
564
|
+
} });
|
|
539
565
|
}
|
|
540
566
|
};
|
|
541
567
|
const appPatch = async (patchCreate) => {
|
|
@@ -586,7 +612,9 @@ const makeChatsSocket = (config) => {
|
|
|
586
612
|
]
|
|
587
613
|
};
|
|
588
614
|
await query(node);
|
|
589
|
-
await authState.keys.set({ 'app-state-sync-version': {
|
|
615
|
+
await authState.keys.set({ 'app-state-sync-version': {
|
|
616
|
+
[name]: state
|
|
617
|
+
} });
|
|
590
618
|
});
|
|
591
619
|
});
|
|
592
620
|
if (config.emitOwnEvents) {
|
|
@@ -597,29 +625,9 @@ const makeChatsSocket = (config) => {
|
|
|
597
625
|
}
|
|
598
626
|
}
|
|
599
627
|
};
|
|
600
|
-
/** sending abt props may fix QR scan fail if server expects */
|
|
601
|
-
const fetchAbt = async () => {
|
|
602
|
-
const abtNode = await query({
|
|
603
|
-
tag: 'iq',
|
|
604
|
-
attrs: {
|
|
605
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
606
|
-
xmlns: 'abt',
|
|
607
|
-
type: 'get',
|
|
608
|
-
},
|
|
609
|
-
content: [
|
|
610
|
-
{ tag: 'props', attrs: { protocol: '1' } }
|
|
611
|
-
]
|
|
612
|
-
});
|
|
613
|
-
const propsNode = (0, WABinary_1.getBinaryNodeChild)(abtNode, 'props');
|
|
614
|
-
let props = {};
|
|
615
|
-
if (propsNode) {
|
|
616
|
-
props = (0, WABinary_1.reduceBinaryNodeToDictionary)(propsNode, 'prop');
|
|
617
|
-
}
|
|
618
|
-
logger.debug('fetched abt');
|
|
619
|
-
return props;
|
|
620
|
-
};
|
|
621
628
|
/** sending non-abt props may fix QR scan fail if server expects */
|
|
622
629
|
const fetchProps = async () => {
|
|
630
|
+
var _a, _b;
|
|
623
631
|
const resultNode = await query({
|
|
624
632
|
tag: 'iq',
|
|
625
633
|
attrs: {
|
|
@@ -628,12 +636,20 @@ const makeChatsSocket = (config) => {
|
|
|
628
636
|
type: 'get',
|
|
629
637
|
},
|
|
630
638
|
content: [
|
|
631
|
-
{
|
|
639
|
+
{
|
|
640
|
+
tag: 'props',
|
|
641
|
+
attrs: {
|
|
642
|
+
protocol: '2',
|
|
643
|
+
hash: ((_a = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _a === void 0 ? void 0 : _a.lastPropHash) || ''
|
|
644
|
+
}
|
|
645
|
+
}
|
|
632
646
|
]
|
|
633
647
|
});
|
|
634
648
|
const propsNode = (0, WABinary_1.getBinaryNodeChild)(resultNode, 'props');
|
|
635
649
|
let props = {};
|
|
636
650
|
if (propsNode) {
|
|
651
|
+
authState.creds.lastPropHash = (_b = propsNode === null || propsNode === void 0 ? void 0 : propsNode.attrs) === null || _b === void 0 ? void 0 : _b.hash;
|
|
652
|
+
ev.emit('creds.update', authState.creds);
|
|
637
653
|
props = (0, WABinary_1.reduceBinaryNodeToDictionary)(propsNode, 'prop');
|
|
638
654
|
}
|
|
639
655
|
logger.debug('fetched props');
|
|
@@ -643,7 +659,7 @@ const makeChatsSocket = (config) => {
|
|
|
643
659
|
* modify a chat -- mark unread, read etc.
|
|
644
660
|
* lastMessages must be sorted in reverse chronologically
|
|
645
661
|
* requires the last messages till the last message received; required for archive & unread
|
|
646
|
-
|
|
662
|
+
*/
|
|
647
663
|
const chatModify = (mod, jid) => {
|
|
648
664
|
const patch = (0, Utils_1.chatModificationToAppPatch)(mod, jid);
|
|
649
665
|
return appPatch(patch);
|
|
@@ -707,7 +723,6 @@ const makeChatsSocket = (config) => {
|
|
|
707
723
|
* */
|
|
708
724
|
const executeInitQueries = async () => {
|
|
709
725
|
await Promise.all([
|
|
710
|
-
fetchAbt(),
|
|
711
726
|
fetchProps(),
|
|
712
727
|
fetchBlocklist(),
|
|
713
728
|
fetchPrivacySettings(),
|
|
@@ -728,18 +743,18 @@ const makeChatsSocket = (config) => {
|
|
|
728
743
|
}
|
|
729
744
|
}
|
|
730
745
|
const historyMsg = (0, Utils_1.getHistoryMsg)(msg.message);
|
|
731
|
-
const shouldProcessHistoryMsg = historyMsg
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
746
|
+
const shouldProcessHistoryMsg = historyMsg ?
|
|
747
|
+
(shouldSyncHistoryMessage(historyMsg) &&
|
|
748
|
+
Defaults_1.PROCESSABLE_HISTORY_TYPES.includes(historyMsg.syncType)) :
|
|
749
|
+
false;
|
|
735
750
|
if (historyMsg && !authState.creds.myAppStateKeyId) {
|
|
736
751
|
logger.warn('skipping app state sync, as myAppStateKeyId is not set');
|
|
737
752
|
pendingAppStateSync = true;
|
|
738
753
|
}
|
|
739
754
|
await Promise.all([
|
|
740
755
|
(async () => {
|
|
741
|
-
if (historyMsg
|
|
742
|
-
|
|
756
|
+
if (historyMsg &&
|
|
757
|
+
authState.creds.myAppStateKeyId) {
|
|
743
758
|
pendingAppStateSync = false;
|
|
744
759
|
await doAppStateSync();
|
|
745
760
|
}
|
|
@@ -754,8 +769,8 @@ const makeChatsSocket = (config) => {
|
|
|
754
769
|
getMessage: config.getMessage,
|
|
755
770
|
})
|
|
756
771
|
]);
|
|
757
|
-
if (((_c = (_b = msg.message) === null || _b === void 0 ? void 0 : _b.protocolMessage) === null || _c === void 0 ? void 0 : _c.appStateSyncKeyShare)
|
|
758
|
-
|
|
772
|
+
if (((_c = (_b = msg.message) === null || _b === void 0 ? void 0 : _b.protocolMessage) === null || _c === void 0 ? void 0 : _c.appStateSyncKeyShare) &&
|
|
773
|
+
pendingAppStateSync) {
|
|
759
774
|
await doAppStateSync();
|
|
760
775
|
pendingAppStateSync = false;
|
|
761
776
|
}
|
|
@@ -818,16 +833,18 @@ const makeChatsSocket = (config) => {
|
|
|
818
833
|
});
|
|
819
834
|
return {
|
|
820
835
|
...sock,
|
|
836
|
+
interactiveQuery,
|
|
821
837
|
processingMutex,
|
|
822
838
|
fetchPrivacySettings,
|
|
823
839
|
upsertMessage,
|
|
824
840
|
appPatch,
|
|
841
|
+
fetchUserLid,
|
|
825
842
|
sendPresenceUpdate,
|
|
826
843
|
presenceSubscribe,
|
|
827
|
-
profilePictureUrl,
|
|
828
844
|
onWhatsApp,
|
|
829
845
|
fetchBlocklist,
|
|
830
846
|
fetchStatus,
|
|
847
|
+
fetchDisappearingDuration,
|
|
831
848
|
updateProfilePicture,
|
|
832
849
|
removeProfilePicture,
|
|
833
850
|
updateProfileStatus,
|