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