alipclutch-baileys 8.3.0 → 8.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -1
- package/README.md +10 -9
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +4775 -0
- package/WAProto/index.d.ts +55057 -0
- package/WAProto/index.js +56887 -17535
- package/WAProto/index.ts.ts +53473 -0
- package/lib/Defaults/baileys-version.json +2 -2
- package/lib/Defaults/index.d.ts +16 -7
- package/lib/Defaults/index.js +90 -119
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/types.d.ts +0 -1
- package/lib/Socket/Client/types.js +0 -1
- package/lib/Socket/Client/websocket.d.ts +0 -1
- package/lib/Socket/Client/websocket.js +0 -1
- package/lib/Socket/business.d.ts +59 -58
- package/lib/Socket/chats.d.ts +45 -230
- package/lib/Socket/chats.js +139 -238
- package/lib/Socket/groups.d.ts +41 -32
- package/lib/Socket/groups.js +38 -23
- package/lib/Socket/index.d.ts +63 -64
- package/lib/Socket/index.js +2 -3
- package/lib/Socket/messages-recv.js +9 -65
- package/lib/Socket/messages-send.d.ts +49 -47
- package/lib/Socket/messages-send.js +584 -395
- package/lib/Socket/newsletter.d.ts +39 -37
- package/lib/Socket/newsletter.js +88 -123
- package/lib/Socket/setup.js +433 -0
- package/lib/Socket/{dugong.d.ts → setup.ts} +17 -52
- package/lib/Socket/socket.d.ts +10 -10
- package/lib/Socket/socket.js +62 -38
- package/lib/Socket/usync.d.ts +3 -4
- package/lib/Socket/usync.js +0 -1
- package/lib/Store/index.d.ts +1 -2
- package/lib/Store/index.js +1 -3
- package/lib/Store/make-in-memory-store.d.ts +24 -24
- package/lib/Store/make-in-memory-store.js +26 -14
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +0 -7
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +14 -7
- package/lib/Types/Contact.d.ts +5 -1
- package/lib/Types/Events.d.ts +44 -2
- package/lib/Types/GroupMetadata.d.ts +11 -2
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +148 -21
- package/lib/Types/Message.js +0 -2
- package/lib/Types/Newsletter.d.ts +73 -97
- package/lib/Types/Newsletter.js +18 -38
- package/lib/Types/Socket.d.ts +17 -9
- package/lib/Types/index.d.ts +8 -1
- package/lib/Types/index.js +2 -2
- package/lib/Utils/auth-utils.d.ts +3 -3
- package/lib/Utils/auth-utils.js +6 -13
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +15 -16
- package/lib/Utils/chat-utils.js +36 -35
- package/lib/Utils/crypto.d.ts +15 -16
- package/lib/Utils/crypto.js +71 -29
- package/lib/Utils/decode-wa-message.d.ts +22 -6
- package/lib/Utils/decode-wa-message.js +65 -56
- package/lib/Utils/event-buffer.d.ts +2 -2
- package/lib/Utils/event-buffer.js +11 -7
- package/lib/Utils/generics.d.ts +17 -20
- package/lib/Utils/generics.js +95 -75
- package/lib/Utils/history.d.ts +4 -0
- package/lib/Utils/history.js +4 -6
- package/lib/Utils/link-preview.d.ts +2 -2
- package/lib/Utils/link-preview.js +34 -1
- package/lib/Utils/logger.d.ts +10 -3
- package/lib/Utils/lt-hash.d.ts +2 -2
- package/lib/Utils/lt-hash.js +6 -6
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +28 -24
- package/lib/Utils/messages-media.js +272 -111
- package/lib/Utils/messages.d.ts +13 -10
- package/lib/Utils/messages.js +323 -50
- package/lib/Utils/noise-handler.d.ts +10 -12
- package/lib/Utils/noise-handler.js +18 -23
- package/lib/Utils/process-message.d.ts +5 -4
- package/lib/Utils/process-message.js +108 -25
- package/lib/Utils/signal.d.ts +2 -1
- package/lib/Utils/signal.js +26 -26
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -1
- package/lib/Utils/use-multi-file-auth-state.js +51 -6
- package/lib/Utils/validate-connection.d.ts +3 -4
- package/lib/Utils/validate-connection.js +90 -66
- package/lib/WABinary/constants.d.ts +24 -27
- package/lib/WABinary/constants.js +1276 -13
- package/lib/WABinary/decode.d.ts +3 -4
- package/lib/WABinary/decode.js +26 -13
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +137 -152
- package/lib/WABinary/generic-utils.d.ts +1 -4
- package/lib/WABinary/generic-utils.js +37 -125
- package/lib/WABinary/jid-utils.d.ts +11 -5
- package/lib/WABinary/jid-utils.js +28 -5
- package/lib/WABinary/jid-utils.js.bak +83 -0
- package/lib/WAM/BinaryInfo.d.ts +2 -11
- package/lib/WAM/encode.d.ts +1 -2
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +27 -15
- package/package.json +18 -31
- package/engine-requirements.js +0 -10
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/Client/web-socket-client.d.ts +0 -12
- package/lib/Socket/Client/web-socket-client.js +0 -62
- package/lib/Socket/dugong.js +0 -483
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/registration.js +0 -166
- package/lib/Store/make-cache-manager-store.d.ts +0 -13
- package/lib/Store/make-cache-manager-store.js +0 -83
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { proto } from '../../WAProto';
|
|
3
|
-
import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
|
|
2
|
+
import { GroupMetadata, ParticipantAction, SocketConfig, WAMessageKey } from '../Types';
|
|
4
3
|
import { BinaryNode } from '../WABinary';
|
|
5
4
|
export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
5
|
+
groupQuery: (jid: string, type: "get" | "set", content: BinaryNode[]) => Promise<any>;
|
|
6
6
|
groupMetadata: (jid: string) => Promise<GroupMetadata>;
|
|
7
7
|
groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
|
|
8
8
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -10,7 +10,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
10
10
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
11
11
|
[key: string]: string;
|
|
12
12
|
}[]>;
|
|
13
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action:
|
|
13
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
14
14
|
status: string;
|
|
15
15
|
jid: string;
|
|
16
16
|
}[]>;
|
|
@@ -23,72 +23,81 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
23
23
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
24
24
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
25
25
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
26
|
+
/**
|
|
27
|
+
* revoke a v4 invite for someone
|
|
28
|
+
* @param groupJid group jid
|
|
29
|
+
* @param invitedJid jid of person you invited
|
|
30
|
+
* @returns true if successful
|
|
31
|
+
*/
|
|
32
|
+
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
26
33
|
/**
|
|
27
34
|
* accept a GroupInviteMessage
|
|
28
35
|
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
|
|
29
36
|
* @param inviteMessage the message to accept
|
|
30
37
|
*/
|
|
31
|
-
groupAcceptInviteV4: (key: string |
|
|
38
|
+
groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<any>;
|
|
32
39
|
groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
|
|
33
40
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
34
|
-
groupSettingUpdate: (jid: string, setting:
|
|
35
|
-
groupMemberAddMode: (jid: string, mode:
|
|
36
|
-
groupJoinApprovalMode: (jid: string, mode:
|
|
41
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
42
|
+
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
43
|
+
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
37
44
|
groupFetchAllParticipating: () => Promise<{
|
|
38
45
|
[_: string]: GroupMetadata;
|
|
39
46
|
}>;
|
|
47
|
+
getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
|
|
40
48
|
processingMutex: {
|
|
41
|
-
mutex<T>(code: () => T |
|
|
49
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
42
50
|
};
|
|
43
51
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
44
52
|
[_: string]: string;
|
|
45
53
|
}>;
|
|
46
|
-
upsertMessage: (msg:
|
|
54
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
47
55
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
48
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string
|
|
49
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer
|
|
50
|
-
profilePictureUrl: (jid: string, type?: "
|
|
56
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
57
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
58
|
+
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
51
59
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
52
60
|
jid: string;
|
|
53
61
|
exists: unknown;
|
|
54
62
|
lid: unknown;
|
|
55
63
|
}[] | undefined>;
|
|
56
64
|
fetchBlocklist: () => Promise<string[]>;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
setAt: Date;
|
|
60
|
-
} | undefined>;
|
|
65
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
66
|
+
fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
61
67
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
62
68
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
63
69
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
64
70
|
updateProfileName: (name: string) => Promise<void>;
|
|
65
71
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
72
|
+
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
73
|
+
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
66
74
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
67
75
|
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
68
76
|
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
69
77
|
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
70
78
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
71
|
-
updateGroupsAddPrivacy: (value: import("../Types").
|
|
79
|
+
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
|
|
72
80
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
73
|
-
getBusinessProfile: (jid: string) => Promise<
|
|
74
|
-
resyncAppState: (collections: readonly ("
|
|
81
|
+
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
82
|
+
resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
75
83
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
76
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?:
|
|
84
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
77
85
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
78
86
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
79
87
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
80
88
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
81
89
|
star: (jid: string, messages: {
|
|
82
90
|
id: string;
|
|
83
|
-
fromMe?: boolean
|
|
91
|
+
fromMe?: boolean;
|
|
84
92
|
}[], star: boolean) => Promise<void>;
|
|
93
|
+
executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
|
|
85
94
|
type: "md";
|
|
86
|
-
ws:
|
|
95
|
+
ws: import("./Client").WebSocketClient;
|
|
87
96
|
ev: import("../Types").BaileysEventEmitter & {
|
|
88
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
97
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
89
98
|
buffer(): void;
|
|
90
|
-
createBufferedFunction<A extends any[],
|
|
91
|
-
flush(force?: boolean
|
|
99
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
100
|
+
flush(force?: boolean): boolean;
|
|
92
101
|
isBuffering(): boolean;
|
|
93
102
|
};
|
|
94
103
|
authState: {
|
|
@@ -98,18 +107,18 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
98
107
|
signalRepository: import("../Types").SignalRepository;
|
|
99
108
|
user: import("../Types").Contact | undefined;
|
|
100
109
|
generateMessageTag: () => string;
|
|
101
|
-
query: (node: BinaryNode, timeoutMs?: number
|
|
102
|
-
waitForMessage: <
|
|
110
|
+
query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
|
|
111
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
|
103
112
|
waitForSocketOpen: () => Promise<void>;
|
|
104
113
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
105
114
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
106
|
-
logout: (msg?: string
|
|
115
|
+
logout: (msg?: string) => Promise<void>;
|
|
107
116
|
end: (error: Error | undefined) => void;
|
|
108
|
-
onUnexpectedError: (err: Error | import("@hapi/boom").Boom
|
|
117
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
|
|
109
118
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
110
119
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
111
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
112
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined
|
|
113
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<
|
|
120
|
+
requestPairingCode: (phoneNumber: any, pairKey?: string) => Promise<string>;
|
|
121
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
122
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
114
123
|
};
|
|
115
124
|
export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
|
package/lib/Socket/groups.js
CHANGED
|
@@ -6,7 +6,6 @@ const Types_1 = require("../Types");
|
|
|
6
6
|
const Utils_1 = require("../Utils");
|
|
7
7
|
const WABinary_1 = require("../WABinary");
|
|
8
8
|
const chats_1 = require("./chats");
|
|
9
|
-
const WAUSync_1 = require("../WAUSync");
|
|
10
9
|
const makeGroupsSocket = (config) => {
|
|
11
10
|
const sock = (0, chats_1.makeChatsSocket)(config);
|
|
12
11
|
const { authState, ev, query, upsertMessage } = sock;
|
|
@@ -68,9 +67,10 @@ const makeGroupsSocket = (config) => {
|
|
|
68
67
|
});
|
|
69
68
|
return {
|
|
70
69
|
...sock,
|
|
70
|
+
groupQuery,
|
|
71
71
|
groupMetadata,
|
|
72
72
|
groupCreate: async (subject, participants) => {
|
|
73
|
-
const key = (0, Utils_1.
|
|
73
|
+
const key = (0, Utils_1.generateMessageIDV2)();
|
|
74
74
|
const result = await groupQuery('@g.us', 'set', [
|
|
75
75
|
{
|
|
76
76
|
tag: 'create',
|
|
@@ -164,7 +164,7 @@ const makeGroupsSocket = (config) => {
|
|
|
164
164
|
{
|
|
165
165
|
tag: 'description',
|
|
166
166
|
attrs: {
|
|
167
|
-
...(description ? { id: (0, Utils_1.
|
|
167
|
+
...(description ? { id: (0, Utils_1.generateMessageIDV2)() } : { delete: 'true' }),
|
|
168
168
|
...(prev ? { prev } : {})
|
|
169
169
|
},
|
|
170
170
|
content: description ? [
|
|
@@ -188,12 +188,23 @@ const makeGroupsSocket = (config) => {
|
|
|
188
188
|
const result = (0, WABinary_1.getBinaryNodeChild)(results, 'group');
|
|
189
189
|
return result === null || result === void 0 ? void 0 : result.attrs.jid;
|
|
190
190
|
},
|
|
191
|
+
/**
|
|
192
|
+
* revoke a v4 invite for someone
|
|
193
|
+
* @param groupJid group jid
|
|
194
|
+
* @param invitedJid jid of person you invited
|
|
195
|
+
* @returns true if successful
|
|
196
|
+
*/
|
|
197
|
+
groupRevokeInviteV4: async (groupJid, invitedJid) => {
|
|
198
|
+
const result = await groupQuery(groupJid, 'set', [{ tag: 'revoke', attrs: {}, content: [{ tag: 'participant', attrs: { jid: invitedJid } }] }]);
|
|
199
|
+
return !!result;
|
|
200
|
+
},
|
|
191
201
|
/**
|
|
192
202
|
* accept a GroupInviteMessage
|
|
193
203
|
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
|
|
194
204
|
* @param inviteMessage the message to accept
|
|
195
205
|
*/
|
|
196
206
|
groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
|
|
207
|
+
var _a;
|
|
197
208
|
key = typeof key === 'string' ? { remoteJid: key } : key;
|
|
198
209
|
const results = await groupQuery(inviteMessage.groupJid, 'set', [{
|
|
199
210
|
tag: 'accept',
|
|
@@ -225,7 +236,7 @@ const makeGroupsSocket = (config) => {
|
|
|
225
236
|
await upsertMessage({
|
|
226
237
|
key: {
|
|
227
238
|
remoteJid: inviteMessage.groupJid,
|
|
228
|
-
id: (0, Utils_1.
|
|
239
|
+
id: (0, Utils_1.generateMessageIDV2)((_a = sock.user) === null || _a === void 0 ? void 0 : _a.id),
|
|
229
240
|
fromMe: false,
|
|
230
241
|
participant: key.remoteJid,
|
|
231
242
|
},
|
|
@@ -263,49 +274,54 @@ const makeGroupsSocket = (config) => {
|
|
|
263
274
|
exports.makeGroupsSocket = makeGroupsSocket;
|
|
264
275
|
const extractGroupMetadata = (result) => {
|
|
265
276
|
var _a, _b;
|
|
266
|
-
const group = WABinary_1.getBinaryNodeChild(result, 'group');
|
|
267
|
-
const descChild = WABinary_1.getBinaryNodeChild(group, 'description');
|
|
277
|
+
const group = (0, WABinary_1.getBinaryNodeChild)(result, 'group');
|
|
278
|
+
const descChild = (0, WABinary_1.getBinaryNodeChild)(group, 'description');
|
|
268
279
|
let desc;
|
|
269
280
|
let descId;
|
|
270
281
|
let descOwner;
|
|
271
282
|
let descOwnerLid;
|
|
272
283
|
let descTime;
|
|
273
284
|
if (descChild) {
|
|
274
|
-
desc = WABinary_1.getBinaryNodeChildString(descChild, 'body');
|
|
275
|
-
descOwner = WABinary_1.jidNormalizedUser(descChild.attrs.participant_pn || descChild.attrs.participant);
|
|
285
|
+
desc = (0, WABinary_1.getBinaryNodeChildString)(descChild, 'body');
|
|
286
|
+
descOwner = (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant_pn || descChild.attrs.participant);
|
|
276
287
|
if (group.attrs.addressing_mode === 'lid') {
|
|
277
|
-
descOwnerLid = WABinary_1.jidNormalizedUser(descChild.attrs.participant);
|
|
288
|
+
descOwnerLid = (0, WABinary_1.jidNormalizedUser)(descChild.attrs.participant);
|
|
278
289
|
}
|
|
279
290
|
descId = descChild.attrs.id;
|
|
280
291
|
descTime = descChild.attrs.t ? +descChild.attrs.t : undefined;
|
|
281
292
|
}
|
|
282
293
|
const groupSize = group.attrs.size ? Number(group.attrs.size) : undefined;
|
|
283
294
|
const groupId = group.attrs.id.includes('@') ? group.attrs.id : (0, WABinary_1.jidEncode)(group.attrs.id, 'g.us');
|
|
284
|
-
const eph = WABinary_1.getBinaryNodeChild(group, 'ephemeral')
|
|
285
|
-
const memberAddMode = WABinary_1.getBinaryNodeChildString(group, 'member_add_mode') === 'all_member_add';
|
|
295
|
+
const eph = (_a = (0, WABinary_1.getBinaryNodeChild)(group, 'ephemeral')) === null || _a === void 0 ? void 0 : _a.attrs.expiration;
|
|
296
|
+
const memberAddMode = (0, WABinary_1.getBinaryNodeChildString)(group, 'member_add_mode') === 'all_member_add';
|
|
286
297
|
const metadata = {
|
|
287
298
|
id: groupId,
|
|
288
299
|
addressingMode: group.attrs.addressing_mode,
|
|
289
300
|
subject: group.attrs.subject,
|
|
290
|
-
subjectOwner: WABinary_1.jidNormalizedUser(group.attrs.s_o_pn || group.attrs.s_o),
|
|
291
|
-
...(group.attrs.addressing_mode === 'lid' ? { subjectOwnerLid: WABinary_1.jidNormalizedUser(group.attrs.s_o) } : {}),
|
|
301
|
+
subjectOwner: (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o_pn || group.attrs.s_o),
|
|
302
|
+
...(group.attrs.addressing_mode === 'lid' ? { subjectOwnerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.s_o) } : {}),
|
|
292
303
|
subjectTime: group.attrs.s_t ? +group.attrs.s_t : undefined,
|
|
293
|
-
size: groupSize || WABinary_1.getBinaryNodeChildren(group, 'participant').length,
|
|
304
|
+
size: groupSize || (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').length,
|
|
294
305
|
creation: group.attrs.creation ? +group.attrs.creation : undefined,
|
|
295
|
-
owner: WABinary_1.jidNormalizedUser(group.attrs.creator_pn || group.attrs.creator),
|
|
296
|
-
...(group.attrs.addressing_mode === 'lid' ? { ownerLid: WABinary_1.jidNormalizedUser(group.attrs.creator) } : {}),
|
|
306
|
+
owner: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator_pn || group.attrs.creator),
|
|
307
|
+
...(group.attrs.addressing_mode === 'lid' ? { ownerLid: (0, WABinary_1.jidNormalizedUser)(group.attrs.creator) } : {}),
|
|
308
|
+
desc,
|
|
309
|
+
descId,
|
|
297
310
|
descOwner,
|
|
298
311
|
descOwnerLid,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
312
|
+
descTime,
|
|
313
|
+
linkedParent: ((_b = (0, WABinary_1.getBinaryNodeChild)(group, 'linked_parent')) === null || _b === void 0 ? void 0 : _b.attrs.jid) || undefined,
|
|
314
|
+
restrict: !!(0, WABinary_1.getBinaryNodeChild)(group, 'locked'),
|
|
315
|
+
announce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'announcement'),
|
|
316
|
+
isCommunity: !!(0, WABinary_1.getBinaryNodeChild)(group, 'parent'),
|
|
317
|
+
isCommunityAnnounce: !!(0, WABinary_1.getBinaryNodeChild)(group, 'default_sub_group'),
|
|
318
|
+
joinApprovalMode: !!(0, WABinary_1.getBinaryNodeChild)(group, 'membership_approval_mode'),
|
|
304
319
|
memberAddMode,
|
|
305
|
-
participants: WABinary_1.getBinaryNodeChildren(group, 'participant').map(({ attrs }) => {
|
|
320
|
+
participants: (0, WABinary_1.getBinaryNodeChildren)(group, 'participant').map(({ attrs }) => {
|
|
306
321
|
return {
|
|
307
322
|
id: attrs.jid,
|
|
308
323
|
jid: attrs.phone_number || attrs.jid,
|
|
324
|
+
lid: attrs.lid || attrs.jid,
|
|
309
325
|
admin: (attrs.type || null),
|
|
310
326
|
};
|
|
311
327
|
}),
|
|
@@ -314,4 +330,3 @@ const extractGroupMetadata = (result) => {
|
|
|
314
330
|
return metadata;
|
|
315
331
|
};
|
|
316
332
|
exports.extractGroupMetadata = extractGroupMetadata;
|
|
317
|
-
|
package/lib/Socket/index.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { UserFacingSocketConfig } from '../Types';
|
|
3
2
|
declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
4
|
-
|
|
5
|
-
requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions | undefined) => Promise<import("./registration").ExistsResponse>;
|
|
6
|
-
logger: import("pino").Logger<import("pino").LoggerOptions>;
|
|
3
|
+
logger: import("../Utils/logger").ILogger;
|
|
7
4
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
8
5
|
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
9
6
|
products: import("../Types").Product[];
|
|
10
7
|
nextPageCursor: string | undefined;
|
|
11
8
|
}>;
|
|
12
|
-
getCollections: (jid?: string
|
|
9
|
+
getCollections: (jid?: string, limit?: number) => Promise<{
|
|
13
10
|
collections: import("../Types").CatalogCollection[];
|
|
14
11
|
}>;
|
|
15
12
|
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
|
|
@@ -17,41 +14,40 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
17
14
|
deleted: number;
|
|
18
15
|
}>;
|
|
19
16
|
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
|
|
20
|
-
sendMessageAck: ({ tag, attrs, content }: import("
|
|
21
|
-
sendRetryRequest: (node: import("
|
|
17
|
+
sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode, errorCode?: number) => Promise<void>;
|
|
18
|
+
sendRetryRequest: (node: import("..").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
19
|
+
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
22
20
|
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
callId: string;
|
|
22
|
+
toJid: string;
|
|
23
|
+
isVideo: boolean;
|
|
25
24
|
}>;
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
|
|
26
|
+
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
|
|
27
|
+
getPrivacyTokens: (jids: string[]) => Promise<any>;
|
|
28
28
|
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
29
|
-
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache,
|
|
29
|
+
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
30
30
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
31
|
-
sendReceipts: (keys: import("../Types").
|
|
32
|
-
|
|
33
|
-
[key: string]: string;
|
|
34
|
-
};
|
|
35
|
-
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
|
|
31
|
+
sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
32
|
+
readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
|
|
36
33
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
37
|
-
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../index").JidWithDevice[]>;
|
|
38
|
-
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
|
|
39
|
-
[key: string]: string;
|
|
40
|
-
} | undefined) => Promise<{
|
|
41
|
-
nodes: import("../index").BinaryNode[];
|
|
42
|
-
shouldIncludeDeviceIdentity: boolean;
|
|
43
|
-
}>;
|
|
44
34
|
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
45
35
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
46
36
|
[_: string]: string;
|
|
47
37
|
}>;
|
|
38
|
+
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>;
|
|
39
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("..").BinaryNode["attrs"]) => Promise<{
|
|
40
|
+
nodes: import("..").BinaryNode[];
|
|
41
|
+
shouldIncludeDeviceIdentity: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
48
44
|
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
49
|
-
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo
|
|
45
|
+
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
50
46
|
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
51
47
|
duration: string;
|
|
52
48
|
}>;
|
|
53
49
|
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
54
|
-
newsletterUpdateDescription: (jid: string, description?: string
|
|
50
|
+
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
55
51
|
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
56
52
|
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
57
53
|
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
@@ -59,16 +55,16 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
59
55
|
newsletterFollow: (jid: string) => Promise<void>;
|
|
60
56
|
newsletterUnmute: (jid: string) => Promise<void>;
|
|
61
57
|
newsletterMute: (jid: string) => Promise<void>;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
|
|
58
|
+
newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>;
|
|
59
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
65
60
|
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
66
61
|
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
67
62
|
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
68
63
|
newsletterDelete: (jid: string) => Promise<void>;
|
|
69
|
-
newsletterReactMessage: (jid: string,
|
|
70
|
-
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number
|
|
71
|
-
newsletterFetchUpdates: (jid: string, count: number, after?: number
|
|
64
|
+
newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>;
|
|
65
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
66
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
67
|
+
groupQuery: (jid: string, type: "get" | "set", content: import("..").BinaryNode[]) => Promise<any>;
|
|
72
68
|
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
73
69
|
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
74
70
|
groupLeave: (id: string) => Promise<void>;
|
|
@@ -76,77 +72,80 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
76
72
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
77
73
|
[key: string]: string;
|
|
78
74
|
}[]>;
|
|
79
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
|
75
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
80
76
|
status: string;
|
|
81
77
|
jid: string;
|
|
82
78
|
}[]>;
|
|
83
79
|
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
84
80
|
status: string;
|
|
85
81
|
jid: string;
|
|
86
|
-
content: import("
|
|
82
|
+
content: import("..").BinaryNode;
|
|
87
83
|
}[]>;
|
|
88
|
-
groupUpdateDescription: (jid: string, description?: string
|
|
84
|
+
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
89
85
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
90
86
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
91
87
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
92
|
-
|
|
88
|
+
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
89
|
+
groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<any>;
|
|
93
90
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
94
91
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
95
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
|
96
|
-
groupMemberAddMode: (jid: string, mode: "
|
|
92
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
93
|
+
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
97
94
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
98
95
|
groupFetchAllParticipating: () => Promise<{
|
|
99
96
|
[_: string]: import("../Types").GroupMetadata;
|
|
100
97
|
}>;
|
|
98
|
+
getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
|
|
101
99
|
processingMutex: {
|
|
102
|
-
mutex<T>(code: () => T |
|
|
100
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
103
101
|
};
|
|
104
|
-
upsertMessage: (msg: import("../Types").
|
|
102
|
+
upsertMessage: (msg: import("../Types").WAMessage, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
105
103
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
106
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string
|
|
107
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer
|
|
108
|
-
profilePictureUrl: (jid: string, type?: "
|
|
104
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
105
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
106
|
+
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
109
107
|
onWhatsApp: (...jids: string[]) => Promise<{
|
|
110
108
|
jid: string;
|
|
111
109
|
exists: unknown;
|
|
112
110
|
lid: unknown;
|
|
113
111
|
}[] | undefined>;
|
|
114
112
|
fetchBlocklist: () => Promise<string[]>;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
setAt: Date;
|
|
118
|
-
} | undefined>;
|
|
113
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
114
|
+
fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
119
115
|
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
120
116
|
removeProfilePicture: (jid: string) => Promise<void>;
|
|
121
117
|
updateProfileStatus: (status: string) => Promise<void>;
|
|
122
118
|
updateProfileName: (name: string) => Promise<void>;
|
|
123
119
|
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
120
|
+
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
121
|
+
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
124
122
|
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
125
123
|
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
126
124
|
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
127
125
|
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
128
126
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
129
|
-
updateGroupsAddPrivacy: (value: import("../Types").
|
|
127
|
+
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
|
|
130
128
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
131
|
-
getBusinessProfile: (jid: string) => Promise<
|
|
132
|
-
resyncAppState: (collections: readonly ("
|
|
129
|
+
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
130
|
+
resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
133
131
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
134
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?:
|
|
132
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
135
133
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
136
134
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
137
135
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
138
136
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
139
137
|
star: (jid: string, messages: {
|
|
140
138
|
id: string;
|
|
141
|
-
fromMe?: boolean
|
|
139
|
+
fromMe?: boolean;
|
|
142
140
|
}[], star: boolean) => Promise<void>;
|
|
141
|
+
executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
|
|
143
142
|
type: "md";
|
|
144
|
-
ws:
|
|
143
|
+
ws: import("./Client").WebSocketClient;
|
|
145
144
|
ev: import("../Types").BaileysEventEmitter & {
|
|
146
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
145
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
147
146
|
buffer(): void;
|
|
148
|
-
createBufferedFunction<A extends any[],
|
|
149
|
-
flush(force?: boolean
|
|
147
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
148
|
+
flush(force?: boolean): boolean;
|
|
150
149
|
isBuffering(): boolean;
|
|
151
150
|
};
|
|
152
151
|
authState: {
|
|
@@ -156,18 +155,18 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
156
155
|
signalRepository: import("../Types").SignalRepository;
|
|
157
156
|
user: import("../Types").Contact | undefined;
|
|
158
157
|
generateMessageTag: () => string;
|
|
159
|
-
query: (node: import("
|
|
160
|
-
waitForMessage: <
|
|
158
|
+
query: (node: import("..").BinaryNode, timeoutMs?: number) => Promise<any>;
|
|
159
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
|
161
160
|
waitForSocketOpen: () => Promise<void>;
|
|
162
161
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
163
|
-
sendNode: (frame: import("
|
|
164
|
-
logout: (msg?: string
|
|
162
|
+
sendNode: (frame: import("..").BinaryNode) => Promise<void>;
|
|
163
|
+
logout: (msg?: string) => Promise<void>;
|
|
165
164
|
end: (error: Error | undefined) => void;
|
|
166
|
-
onUnexpectedError: (err: Error | import("@hapi/boom").Boom
|
|
165
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
|
|
167
166
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
168
167
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
169
|
-
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
170
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined
|
|
171
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<
|
|
168
|
+
requestPairingCode: (phoneNumber: any, pairKey?: string) => Promise<string>;
|
|
169
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
170
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
172
171
|
};
|
|
173
172
|
export default makeWASocket;
|
package/lib/Socket/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const Defaults_1 = require("../Defaults");
|
|
4
|
-
const
|
|
4
|
+
const business_1 = require("./business");
|
|
5
5
|
// export the last socket layer
|
|
6
|
-
const makeWASocket = (config) => ((0,
|
|
6
|
+
const makeWASocket = (config) => ((0, business_1.makeBusinessSocket)({
|
|
7
7
|
...Defaults_1.DEFAULT_CONNECTION_CONFIG,
|
|
8
8
|
...config
|
|
9
9
|
}));
|
|
10
10
|
exports.default = makeWASocket;
|
|
11
|
-
exports.makeWASocket = makeWASocket;
|