gifted-baileys 1.5.6 → 1.5.7
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/README.md +9 -0
- 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 +3 -0
- package/lib/Defaults/index.d.ts +284 -0
- package/{src → lib}/Defaults/index.js +7 -14
- package/lib/Signal/libsignal.d.ts +3 -0
- package/lib/Signal/libsignal.js +161 -0
- package/lib/Socket/Client/abstract-socket-client.d.ts +15 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/{src → lib}/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +12 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/types.d.ts +17 -0
- package/lib/Socket/Client/types.js +13 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/websocket.js +62 -0
- package/lib/Socket/business.d.ts +170 -0
- package/{src → lib}/Socket/business.js +28 -33
- package/lib/Socket/chats.d.ts +81 -0
- package/{src → lib}/Socket/chats.js +174 -176
- package/lib/Socket/groups.d.ts +115 -0
- package/{src → lib}/Socket/groups.js +80 -68
- package/lib/Socket/index.d.ts +172 -0
- package/{src → lib}/Socket/index.js +4 -1
- package/lib/Socket/messages-recv.d.ts +158 -0
- package/{src → lib}/Socket/messages-recv.js +378 -211
- package/lib/Socket/messages-send.d.ts +155 -0
- package/{src → lib}/Socket/messages-send.js +452 -177
- package/lib/Socket/newsletter.d.ts +132 -0
- package/{src → lib}/Socket/newsletter.js +107 -98
- package/lib/Socket/registration.d.ts +264 -0
- package/{src → lib}/Socket/registration.js +56 -48
- package/lib/Socket/socket.d.ts +44 -0
- package/{src → lib}/Socket/socket.js +77 -77
- package/lib/Socket/usync.d.ts +37 -0
- package/lib/Socket/usync.js +70 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/make-cache-manager-store.d.ts +14 -0
- package/{src → lib}/Store/make-cache-manager-store.js +25 -34
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/{src → lib}/Store/make-in-memory-store.js +36 -32
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/{src → lib}/Store/object-repository.js +1 -1
- package/lib/Types/Auth.d.ts +109 -0
- package/lib/Types/Call.d.ts +13 -0
- package/lib/Types/Chat.d.ts +107 -0
- package/{src/Types/Contact.ts → lib/Types/Contact.d.ts} +8 -9
- package/lib/Types/Events.d.ts +172 -0
- package/lib/Types/GroupMetadata.d.ts +56 -0
- package/lib/Types/Label.d.ts +46 -0
- package/{src/Types/LabelAssociation.ts → lib/Types/LabelAssociation.d.ts} +16 -22
- package/lib/Types/Message.d.ts +433 -0
- package/lib/Types/Newsletter.d.ts +92 -0
- package/lib/Types/Product.d.ts +78 -0
- package/lib/Types/Signal.d.ts +57 -0
- package/{src/Types/Socket.ts → lib/Types/Socket.d.ts} +61 -68
- package/lib/Types/State.d.ts +27 -0
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/index.d.ts +66 -0
- package/lib/Utils/auth-utils.d.ts +18 -0
- package/{src → lib}/Utils/auth-utils.js +73 -90
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.d.ts +22 -0
- package/{src → lib}/Utils/business.js +15 -43
- package/lib/Utils/chat-utils.d.ts +70 -0
- package/{src → lib}/Utils/chat-utils.js +87 -94
- package/lib/Utils/crypto.d.ts +40 -0
- package/{src → lib}/Utils/crypto.js +4 -2
- package/lib/Utils/decode-wa-message.d.ts +36 -0
- package/lib/Utils/decode-wa-message.js +226 -0
- package/lib/Utils/event-buffer.d.ts +35 -0
- package/{src → lib}/Utils/event-buffer.js +4 -13
- package/lib/Utils/generics.d.ts +88 -0
- package/{src → lib}/Utils/generics.js +67 -86
- package/lib/Utils/history.d.ts +19 -0
- package/{src → lib}/Utils/history.js +13 -39
- package/lib/Utils/index.d.ts +17 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/{src → lib}/Utils/link-preview.js +17 -54
- package/lib/Utils/logger.d.ts +2 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/make-mutex.d.ts +7 -0
- package/{src → lib}/Utils/make-mutex.js +4 -13
- package/lib/Utils/messages-media.d.ts +113 -0
- package/{src → lib}/Utils/messages-media.js +193 -255
- package/lib/Utils/messages.d.ts +77 -0
- package/{src → lib}/Utils/messages.js +588 -118
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/process-message.d.ts +41 -0
- package/{src → lib}/Utils/process-message.js +27 -30
- package/lib/Utils/signal.d.ts +33 -0
- package/{src → lib}/Utils/signal.js +25 -42
- package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
- package/{src → lib}/Utils/use-multi-file-auth-state.js +27 -28
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/{src → lib}/Utils/validate-connection.js +40 -9
- package/lib/WABinary/constants.d.ts +27 -0
- package/lib/WABinary/decode.d.ts +6 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/{src → lib}/WABinary/encode.js +16 -10
- package/lib/WABinary/generic-utils.d.ts +14 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/jid-utils.d.ts +31 -0
- package/lib/WABinary/types.d.ts +18 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/constants.d.ts +38 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/index.d.ts +3 -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/{src → lib}/index.js +1 -0
- package/package.json +26 -8
- package/LICENSE +0 -21
- package/src/Defaults/baileys-version.json +0 -3
- package/src/Defaults/index.ts +0 -131
- package/src/README.md +0 -1
- package/src/Signal/libsignal.js +0 -180
- package/src/Signal/libsignal.ts +0 -141
- package/src/Socket/Client/abstract-socket-client.ts +0 -19
- package/src/Socket/Client/index.ts +0 -3
- package/src/Socket/Client/mobile-socket-client.js +0 -78
- package/src/Socket/Client/mobile-socket-client.ts +0 -66
- package/src/Socket/Client/web-socket-client.js +0 -75
- package/src/Socket/Client/web-socket-client.ts +0 -57
- package/src/Socket/business.ts +0 -281
- package/src/Socket/chats.ts +0 -1030
- package/src/Socket/groups.ts +0 -356
- package/src/Socket/index.ts +0 -13
- package/src/Socket/messages-recv.ts +0 -985
- package/src/Socket/messages-send.ts +0 -871
- package/src/Socket/newsletter.ts +0 -282
- package/src/Socket/registration.ts +0 -250
- package/src/Socket/socket.ts +0 -777
- package/src/Store/index.ts +0 -3
- package/src/Store/make-cache-manager-store.ts +0 -100
- package/src/Store/make-in-memory-store.ts +0 -475
- package/src/Store/make-ordered-dictionary.ts +0 -86
- package/src/Store/object-repository.ts +0 -32
- package/src/Tests/test.app-state-sync.js +0 -204
- package/src/Tests/test.app-state-sync.ts +0 -207
- package/src/Tests/test.event-buffer.js +0 -270
- package/src/Tests/test.event-buffer.ts +0 -319
- package/src/Tests/test.key-store.js +0 -76
- package/src/Tests/test.key-store.ts +0 -92
- package/src/Tests/test.libsignal.js +0 -141
- package/src/Tests/test.libsignal.ts +0 -186
- package/src/Tests/test.media-download.js +0 -93
- package/src/Tests/test.media-download.ts +0 -76
- package/src/Tests/test.messages.js +0 -33
- package/src/Tests/test.messages.ts +0 -37
- package/src/Tests/utils.js +0 -34
- package/src/Tests/utils.ts +0 -36
- package/src/Types/Auth.ts +0 -113
- package/src/Types/Call.ts +0 -15
- package/src/Types/Chat.ts +0 -106
- package/src/Types/Events.ts +0 -93
- package/src/Types/GroupMetadata.ts +0 -53
- package/src/Types/Label.ts +0 -36
- package/src/Types/Message.ts +0 -288
- package/src/Types/Newsletter.ts +0 -98
- package/src/Types/Product.ts +0 -85
- package/src/Types/Signal.ts +0 -68
- package/src/Types/State.ts +0 -29
- package/src/Types/index.ts +0 -59
- package/src/Utils/auth-utils.ts +0 -222
- package/src/Utils/baileys-event-stream.js +0 -92
- package/src/Utils/baileys-event-stream.ts +0 -66
- package/src/Utils/business.ts +0 -275
- package/src/Utils/chat-utils.ts +0 -860
- package/src/Utils/crypto.ts +0 -131
- package/src/Utils/decode-wa-message.js +0 -211
- package/src/Utils/decode-wa-message.ts +0 -228
- package/src/Utils/event-buffer.ts +0 -613
- package/src/Utils/generics.ts +0 -434
- package/src/Utils/history.ts +0 -112
- package/src/Utils/index.ts +0 -17
- package/src/Utils/link-preview.ts +0 -122
- package/src/Utils/logger.ts +0 -3
- package/src/Utils/lt-hash.ts +0 -61
- package/src/Utils/make-mutex.ts +0 -44
- package/src/Utils/messages-media.ts +0 -847
- package/src/Utils/messages.ts +0 -956
- package/src/Utils/noise-handler.ts +0 -197
- package/src/Utils/process-message.ts +0 -414
- package/src/Utils/signal.ts +0 -177
- package/src/Utils/use-multi-file-auth-state.ts +0 -90
- package/src/Utils/validate-connection.ts +0 -238
- package/src/WABinary/constants.ts +0 -42
- package/src/WABinary/decode.ts +0 -265
- package/src/WABinary/encode.ts +0 -236
- package/src/WABinary/generic-utils.ts +0 -121
- package/src/WABinary/index.ts +0 -5
- package/src/WABinary/jid-utils.ts +0 -68
- package/src/WABinary/types.ts +0 -17
- package/src/WAM/BinaryInfo.ts +0 -12
- package/src/WAM/constants.ts +0 -15382
- package/src/WAM/encode.ts +0 -174
- package/src/WAM/index.ts +0 -3
- package/src/gifted +0 -1
- package/src/index.ts +0 -13
- /package/{src → lib}/Defaults/phonenumber-mcc.json +0 -0
- /package/{src → lib}/Socket/Client/abstract-socket-client.js +0 -0
- /package/{src → lib}/Store/index.js +0 -0
- /package/{src → lib}/Store/make-ordered-dictionary.js +0 -0
- /package/{src → lib}/Types/Auth.js +0 -0
- /package/{src → lib}/Types/Call.js +0 -0
- /package/{src → lib}/Types/Chat.js +0 -0
- /package/{src → lib}/Types/Contact.js +0 -0
- /package/{src → lib}/Types/Events.js +0 -0
- /package/{src → lib}/Types/GroupMetadata.js +0 -0
- /package/{src → lib}/Types/Label.js +0 -0
- /package/{src → lib}/Types/LabelAssociation.js +0 -0
- /package/{src → lib}/Types/Message.js +0 -0
- /package/{src → lib}/Types/Newsletter.js +0 -0
- /package/{src → lib}/Types/Product.js +0 -0
- /package/{src → lib}/Types/Signal.js +0 -0
- /package/{src → lib}/Types/Socket.js +0 -0
- /package/{src → lib}/Types/State.js +0 -0
- /package/{src/WABinary/types.js → lib/Types/USync.js} +0 -0
- /package/{src → lib}/Types/index.js +0 -0
- /package/{src → lib}/Utils/index.js +0 -0
- /package/{src → lib}/Utils/logger.js +0 -0
- /package/{src → lib}/Utils/lt-hash.js +0 -0
- /package/{src → lib}/Utils/noise-handler.js +0 -0
- /package/{src → lib}/WABinary/constants.js +0 -0
- /package/{src → lib}/WABinary/decode.js +0 -0
- /package/{src → lib}/WABinary/generic-utils.js +0 -0
- /package/{src → lib}/WABinary/index.js +0 -0
- /package/{src → lib}/WABinary/jid-utils.js +0 -0
- /package/{src → lib}/WAM/BinaryInfo.js +0 -0
- /package/{src → lib}/WAM/constants.js +0 -0
- /package/{src → lib}/WAM/encode.js +0 -0
- /package/{src → lib}/WAM/index.js +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { proto } from '../../WAProto';
|
|
3
|
+
import { GroupMetadata, ParticipantAction, SocketConfig } from '../Types';
|
|
4
|
+
import { BinaryNode } from '../WABinary';
|
|
5
|
+
export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
6
|
+
groupQuery: (jid: string, type: 'get' | 'set', content: BinaryNode[]) => Promise<BinaryNode>;
|
|
7
|
+
groupMetadata: (jid: string) => Promise<GroupMetadata>;
|
|
8
|
+
groupCreate: (subject: string, participants: string[]) => Promise<GroupMetadata>;
|
|
9
|
+
groupLeave: (id: string) => Promise<void>;
|
|
10
|
+
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
11
|
+
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
}[]>;
|
|
14
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: 'approve' | 'reject') => Promise<{
|
|
15
|
+
status: string;
|
|
16
|
+
jid: string;
|
|
17
|
+
}[]>;
|
|
18
|
+
groupParticipantsUpdate: (jid: string, participants: string[], action: ParticipantAction) => Promise<{
|
|
19
|
+
status: string;
|
|
20
|
+
jid: string;
|
|
21
|
+
content: BinaryNode;
|
|
22
|
+
}[]>;
|
|
23
|
+
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
24
|
+
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
25
|
+
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
26
|
+
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* accept a GroupInviteMessage
|
|
29
|
+
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
|
|
30
|
+
* @param inviteMessage the message to accept
|
|
31
|
+
*/
|
|
32
|
+
groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
|
|
33
|
+
groupGetInviteInfo: (code: string) => Promise<GroupMetadata>;
|
|
34
|
+
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
35
|
+
groupSettingUpdate: (jid: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked') => Promise<void>;
|
|
36
|
+
groupMemberAddMode: (jid: string, mode: 'admin_add' | 'all_member_add') => Promise<void>;
|
|
37
|
+
groupJoinApprovalMode: (jid: string, mode: 'on' | 'off') => Promise<void>;
|
|
38
|
+
groupFetchAllParticipating: () => Promise<{
|
|
39
|
+
[_: string]: GroupMetadata;
|
|
40
|
+
}>;
|
|
41
|
+
interactiveQuery: (userNodes: BinaryNode[], queryNode: BinaryNode) => Promise<BinaryNode[]>;
|
|
42
|
+
processingMutex: {
|
|
43
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
|
44
|
+
};
|
|
45
|
+
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
46
|
+
[_: string]: string;
|
|
47
|
+
}>;
|
|
48
|
+
upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
49
|
+
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
50
|
+
fetchUserLid: (jid: string) => Promise<string | undefined>;
|
|
51
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
|
52
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
|
53
|
+
onWhatsApp: (...jids: string[]) => Promise<{
|
|
54
|
+
jid: string;
|
|
55
|
+
exists: unknown;
|
|
56
|
+
}[] | undefined>;
|
|
57
|
+
fetchBlocklist: () => Promise<string[]>;
|
|
58
|
+
fetchStatus: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
|
|
59
|
+
fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index").USyncQueryResultList[] | undefined>;
|
|
60
|
+
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
61
|
+
removeProfilePicture: (jid: string) => Promise<void>;
|
|
62
|
+
updateProfileStatus: (status: string) => Promise<void>;
|
|
63
|
+
updateProfileName: (name: string) => Promise<void>;
|
|
64
|
+
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
65
|
+
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
66
|
+
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
67
|
+
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
68
|
+
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
69
|
+
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
70
|
+
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
71
|
+
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
72
|
+
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
|
|
73
|
+
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
74
|
+
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
75
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
|
|
76
|
+
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
77
|
+
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
78
|
+
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
79
|
+
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
80
|
+
star: (jid: string, messages: {
|
|
81
|
+
id: string;
|
|
82
|
+
fromMe?: boolean | undefined;
|
|
83
|
+
}[], star: boolean) => Promise<void>;
|
|
84
|
+
executeUSyncQuery: (usyncQuery: import("../index").USyncQuery) => Promise<import("../index").USyncQueryResult | undefined>;
|
|
85
|
+
type: "md";
|
|
86
|
+
ws: any;
|
|
87
|
+
ev: import("../Types").BaileysEventEmitter & {
|
|
88
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
89
|
+
buffer(): void;
|
|
90
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
91
|
+
flush(force?: boolean | undefined): boolean;
|
|
92
|
+
isBuffering(): boolean;
|
|
93
|
+
};
|
|
94
|
+
authState: {
|
|
95
|
+
creds: import("../Types").AuthenticationCreds;
|
|
96
|
+
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
97
|
+
};
|
|
98
|
+
signalRepository: import("../Types").SignalRepository;
|
|
99
|
+
user: import("../Types").Contact | undefined;
|
|
100
|
+
generateMessageTag: () => string;
|
|
101
|
+
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
|
|
102
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
|
103
|
+
waitForSocketOpen: () => Promise<void>;
|
|
104
|
+
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
105
|
+
sendNode: (frame: BinaryNode) => Promise<void>;
|
|
106
|
+
logout: (msg?: string | undefined) => Promise<void>;
|
|
107
|
+
end: (error: Error | undefined) => void;
|
|
108
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
109
|
+
uploadPreKeys: (count?: number) => Promise<void>;
|
|
110
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
111
|
+
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
112
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
113
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
114
|
+
};
|
|
115
|
+
export declare const extractGroupMetadata: (result: BinaryNode) => GroupMetadata;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.extractGroupMetadata = exports.makeGroupsSocket = void 0;
|
|
13
4
|
const WAProto_1 = require("../../WAProto");
|
|
@@ -18,23 +9,21 @@ const chats_1 = require("./chats");
|
|
|
18
9
|
const makeGroupsSocket = (config) => {
|
|
19
10
|
const sock = (0, chats_1.makeChatsSocket)(config);
|
|
20
11
|
const { authState, ev, query, upsertMessage } = sock;
|
|
21
|
-
const groupQuery = (jid, type, content) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const groupMetadata = (jid) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
-
const result = yield groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
|
|
12
|
+
const groupQuery = async (jid, type, content) => (query({
|
|
13
|
+
tag: 'iq',
|
|
14
|
+
attrs: {
|
|
15
|
+
type,
|
|
16
|
+
xmlns: 'w:g2',
|
|
17
|
+
to: jid,
|
|
18
|
+
},
|
|
19
|
+
content
|
|
20
|
+
}));
|
|
21
|
+
const groupMetadata = async (jid) => {
|
|
22
|
+
const result = await groupQuery(jid, 'get', [{ tag: 'query', attrs: { request: 'interactive' } }]);
|
|
34
23
|
return (0, exports.extractGroupMetadata)(result);
|
|
35
|
-
}
|
|
36
|
-
const groupFetchAllParticipating = () =>
|
|
37
|
-
const result =
|
|
24
|
+
};
|
|
25
|
+
const groupFetchAllParticipating = async () => {
|
|
26
|
+
const result = await query({
|
|
38
27
|
tag: 'iq',
|
|
39
28
|
attrs: {
|
|
40
29
|
to: '@g.us',
|
|
@@ -67,18 +56,22 @@ const makeGroupsSocket = (config) => {
|
|
|
67
56
|
}
|
|
68
57
|
sock.ev.emit('groups.update', Object.values(data));
|
|
69
58
|
return data;
|
|
70
|
-
}
|
|
71
|
-
sock.ws.on('CB:ib,,dirty', (node) =>
|
|
59
|
+
};
|
|
60
|
+
sock.ws.on('CB:ib,,dirty', async (node) => {
|
|
72
61
|
const { attrs } = (0, WABinary_1.getBinaryNodeChild)(node, 'dirty');
|
|
73
62
|
if (attrs.type !== 'groups') {
|
|
74
63
|
return;
|
|
75
64
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
})
|
|
79
|
-
return
|
|
65
|
+
await groupFetchAllParticipating();
|
|
66
|
+
await sock.cleanDirtyBits('groups');
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
...sock,
|
|
70
|
+
groupQuery,
|
|
71
|
+
groupMetadata,
|
|
72
|
+
groupCreate: async (subject, participants) => {
|
|
80
73
|
const key = (0, Utils_1.generateMessageID)();
|
|
81
|
-
const result =
|
|
74
|
+
const result = await groupQuery('@g.us', 'set', [
|
|
82
75
|
{
|
|
83
76
|
tag: 'create',
|
|
84
77
|
attrs: {
|
|
@@ -92,8 +85,9 @@ const makeGroupsSocket = (config) => {
|
|
|
92
85
|
}
|
|
93
86
|
]);
|
|
94
87
|
return (0, exports.extractGroupMetadata)(result);
|
|
95
|
-
}
|
|
96
|
-
|
|
88
|
+
},
|
|
89
|
+
groupLeave: async (id) => {
|
|
90
|
+
await groupQuery('@g.us', 'set', [
|
|
97
91
|
{
|
|
98
92
|
tag: 'leave',
|
|
99
93
|
attrs: {},
|
|
@@ -102,16 +96,18 @@ const makeGroupsSocket = (config) => {
|
|
|
102
96
|
]
|
|
103
97
|
}
|
|
104
98
|
]);
|
|
105
|
-
}
|
|
106
|
-
|
|
99
|
+
},
|
|
100
|
+
groupUpdateSubject: async (jid, subject) => {
|
|
101
|
+
await groupQuery(jid, 'set', [
|
|
107
102
|
{
|
|
108
103
|
tag: 'subject',
|
|
109
104
|
attrs: {},
|
|
110
105
|
content: Buffer.from(subject, 'utf-8')
|
|
111
106
|
}
|
|
112
107
|
]);
|
|
113
|
-
}
|
|
114
|
-
|
|
108
|
+
},
|
|
109
|
+
groupRequestParticipantsList: async (jid) => {
|
|
110
|
+
const result = await groupQuery(jid, 'get', [
|
|
115
111
|
{
|
|
116
112
|
tag: 'membership_approval_requests',
|
|
117
113
|
attrs: {}
|
|
@@ -120,8 +116,9 @@ const makeGroupsSocket = (config) => {
|
|
|
120
116
|
const node = (0, WABinary_1.getBinaryNodeChild)(result, 'membership_approval_requests');
|
|
121
117
|
const participants = (0, WABinary_1.getBinaryNodeChildren)(node, 'membership_approval_request');
|
|
122
118
|
return participants.map(v => v.attrs);
|
|
123
|
-
}
|
|
124
|
-
|
|
119
|
+
},
|
|
120
|
+
groupRequestParticipantsUpdate: async (jid, participants, action) => {
|
|
121
|
+
const result = await groupQuery(jid, 'set', [{
|
|
125
122
|
tag: 'membership_requests_action',
|
|
126
123
|
attrs: {},
|
|
127
124
|
content: [
|
|
@@ -141,8 +138,9 @@ const makeGroupsSocket = (config) => {
|
|
|
141
138
|
return participantsAffected.map(p => {
|
|
142
139
|
return { status: p.attrs.error || '200', jid: p.attrs.jid };
|
|
143
140
|
});
|
|
144
|
-
}
|
|
145
|
-
|
|
141
|
+
},
|
|
142
|
+
groupParticipantsUpdate: async (jid, participants, action) => {
|
|
143
|
+
const result = await groupQuery(jid, 'set', [
|
|
146
144
|
{
|
|
147
145
|
tag: action,
|
|
148
146
|
attrs: {},
|
|
@@ -157,40 +155,47 @@ const makeGroupsSocket = (config) => {
|
|
|
157
155
|
return participantsAffected.map(p => {
|
|
158
156
|
return { status: p.attrs.error || '200', jid: p.attrs.jid, content: p };
|
|
159
157
|
});
|
|
160
|
-
}
|
|
158
|
+
},
|
|
159
|
+
groupUpdateDescription: async (jid, description) => {
|
|
161
160
|
var _a;
|
|
162
|
-
const metadata =
|
|
161
|
+
const metadata = await groupMetadata(jid);
|
|
163
162
|
const prev = (_a = metadata.descId) !== null && _a !== void 0 ? _a : null;
|
|
164
|
-
|
|
163
|
+
await groupQuery(jid, 'set', [
|
|
165
164
|
{
|
|
166
165
|
tag: 'description',
|
|
167
|
-
attrs:
|
|
166
|
+
attrs: {
|
|
167
|
+
...(description ? { id: (0, Utils_1.generateMessageID)() } : { delete: 'true' }),
|
|
168
|
+
...(prev ? { prev } : {})
|
|
169
|
+
},
|
|
168
170
|
content: description ? [
|
|
169
171
|
{ tag: 'body', attrs: {}, content: Buffer.from(description, 'utf-8') }
|
|
170
172
|
] : undefined
|
|
171
173
|
}
|
|
172
174
|
]);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
+
},
|
|
176
|
+
groupInviteCode: async (jid) => {
|
|
177
|
+
const result = await groupQuery(jid, 'get', [{ tag: 'invite', attrs: {} }]);
|
|
175
178
|
const inviteNode = (0, WABinary_1.getBinaryNodeChild)(result, 'invite');
|
|
176
179
|
return inviteNode === null || inviteNode === void 0 ? void 0 : inviteNode.attrs.code;
|
|
177
|
-
}
|
|
178
|
-
|
|
180
|
+
},
|
|
181
|
+
groupRevokeInvite: async (jid) => {
|
|
182
|
+
const result = await groupQuery(jid, 'set', [{ tag: 'invite', attrs: {} }]);
|
|
179
183
|
const inviteNode = (0, WABinary_1.getBinaryNodeChild)(result, 'invite');
|
|
180
184
|
return inviteNode === null || inviteNode === void 0 ? void 0 : inviteNode.attrs.code;
|
|
181
|
-
}
|
|
182
|
-
|
|
185
|
+
},
|
|
186
|
+
groupAcceptInvite: async (code) => {
|
|
187
|
+
const results = await groupQuery('@g.us', 'set', [{ tag: 'invite', attrs: { code } }]);
|
|
183
188
|
const result = (0, WABinary_1.getBinaryNodeChild)(results, 'group');
|
|
184
189
|
return result === null || result === void 0 ? void 0 : result.attrs.jid;
|
|
185
|
-
}
|
|
190
|
+
},
|
|
186
191
|
/**
|
|
187
192
|
* accept a GroupInviteMessage
|
|
188
193
|
* @param key the key of the invite message, or optionally only provide the jid of the person who sent the invite
|
|
189
194
|
* @param inviteMessage the message to accept
|
|
190
195
|
*/
|
|
191
|
-
groupAcceptInviteV4: ev.createBufferedFunction((key, inviteMessage) =>
|
|
196
|
+
groupAcceptInviteV4: ev.createBufferedFunction(async (key, inviteMessage) => {
|
|
192
197
|
key = typeof key === 'string' ? { remoteJid: key } : key;
|
|
193
|
-
const results =
|
|
198
|
+
const results = await groupQuery(inviteMessage.groupJid, 'set', [{
|
|
194
199
|
tag: 'accept',
|
|
195
200
|
attrs: {
|
|
196
201
|
code: inviteMessage.inviteCode,
|
|
@@ -217,7 +222,7 @@ const makeGroupsSocket = (config) => {
|
|
|
217
222
|
]);
|
|
218
223
|
}
|
|
219
224
|
// generate the group add message
|
|
220
|
-
|
|
225
|
+
await upsertMessage({
|
|
221
226
|
key: {
|
|
222
227
|
remoteJid: inviteMessage.groupJid,
|
|
223
228
|
id: (0, Utils_1.generateMessageID)(),
|
|
@@ -232,21 +237,28 @@ const makeGroupsSocket = (config) => {
|
|
|
232
237
|
messageTimestamp: (0, Utils_1.unixTimestampSeconds)()
|
|
233
238
|
}, 'notify');
|
|
234
239
|
return results.attrs.from;
|
|
235
|
-
})
|
|
236
|
-
|
|
240
|
+
}),
|
|
241
|
+
groupGetInviteInfo: async (code) => {
|
|
242
|
+
const results = await groupQuery('@g.us', 'get', [{ tag: 'invite', attrs: { code } }]);
|
|
237
243
|
return (0, exports.extractGroupMetadata)(results);
|
|
238
|
-
}
|
|
244
|
+
},
|
|
245
|
+
groupToggleEphemeral: async (jid, ephemeralExpiration) => {
|
|
239
246
|
const content = ephemeralExpiration ?
|
|
240
247
|
{ tag: 'ephemeral', attrs: { expiration: ephemeralExpiration.toString() } } :
|
|
241
248
|
{ tag: 'not_ephemeral', attrs: {} };
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
249
|
+
await groupQuery(jid, 'set', [content]);
|
|
250
|
+
},
|
|
251
|
+
groupSettingUpdate: async (jid, setting) => {
|
|
252
|
+
await groupQuery(jid, 'set', [{ tag: setting, attrs: {} }]);
|
|
253
|
+
},
|
|
254
|
+
groupMemberAddMode: async (jid, mode) => {
|
|
255
|
+
await groupQuery(jid, 'set', [{ tag: 'member_add_mode', attrs: {}, content: mode }]);
|
|
256
|
+
},
|
|
257
|
+
groupJoinApprovalMode: async (jid, mode) => {
|
|
258
|
+
await groupQuery(jid, 'set', [{ tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'group_join', attrs: { state: mode } }] }]);
|
|
259
|
+
},
|
|
260
|
+
groupFetchAllParticipating
|
|
261
|
+
};
|
|
250
262
|
};
|
|
251
263
|
exports.makeGroupsSocket = makeGroupsSocket;
|
|
252
264
|
const extractGroupMetadata = (result) => {
|
|
@@ -285,7 +297,7 @@ const extractGroupMetadata = (result) => {
|
|
|
285
297
|
admin: (attrs.type || null),
|
|
286
298
|
};
|
|
287
299
|
}),
|
|
288
|
-
ephemeralDuration: eph ? +eph :
|
|
300
|
+
ephemeralDuration: eph ? +eph : 0
|
|
289
301
|
};
|
|
290
302
|
return metadata;
|
|
291
303
|
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { UserFacingSocketConfig } from '../Types';
|
|
2
|
+
declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
3
|
+
register: (code: string) => Promise<import("./registration").ExistsResponse>;
|
|
4
|
+
requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions) => Promise<import("./registration").ExistsResponse>;
|
|
5
|
+
logger: Logger;
|
|
6
|
+
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
7
|
+
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
8
|
+
products: import("../Types").Product[];
|
|
9
|
+
nextPageCursor: any;
|
|
10
|
+
}>;
|
|
11
|
+
getCollections: (jid?: string, limit?: number) => Promise<{
|
|
12
|
+
collections: import("../Types").CatalogCollection[];
|
|
13
|
+
}>;
|
|
14
|
+
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
|
|
15
|
+
productDelete: (productIds: string[]) => Promise<{
|
|
16
|
+
deleted: number;
|
|
17
|
+
}>;
|
|
18
|
+
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
|
|
19
|
+
sendMessageAck: ({ tag, attrs, content }: import("..").BinaryNode, errorCode?: number) => Promise<void>;
|
|
20
|
+
sendRetryRequest: (node: import("..").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
21
|
+
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
22
|
+
id: any;
|
|
23
|
+
to: string;
|
|
24
|
+
}>;
|
|
25
|
+
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
26
|
+
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
|
|
27
|
+
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
|
|
28
|
+
getPrivacyTokens: (jids: string[]) => Promise<import("..").BinaryNode>;
|
|
29
|
+
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
30
|
+
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
31
|
+
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
32
|
+
sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
33
|
+
getButtonArgs: (message: import("../Types").WAProto.IMessage) => import("..").BinaryNode["attrs"];
|
|
34
|
+
readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
|
|
35
|
+
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
36
|
+
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("..").JidWithDevice[]>;
|
|
37
|
+
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
38
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("..").BinaryNode["attrs"]) => Promise<{
|
|
39
|
+
nodes: import("..").BinaryNode[];
|
|
40
|
+
shouldIncludeDeviceIdentity: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
43
|
+
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
44
|
+
[_: string]: string;
|
|
45
|
+
}>;
|
|
46
|
+
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
47
|
+
sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
|
48
|
+
sendAlbumMessage: (jid: string, medias: import("../Types").Media[], 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>;
|
|
50
|
+
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
51
|
+
duration: string;
|
|
52
|
+
}>;
|
|
53
|
+
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
54
|
+
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
55
|
+
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
56
|
+
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
57
|
+
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
58
|
+
newsletterUnfollow: (jid: string) => Promise<void>;
|
|
59
|
+
newsletterFollow: (jid: string) => Promise<void>;
|
|
60
|
+
newsletterUnmute: (jid: string) => Promise<void>;
|
|
61
|
+
newsletterMute: (jid: string) => Promise<void>;
|
|
62
|
+
newsletterAction: (jid: string, type: "follow" | "unfollow" | "mute" | "unmute") => Promise<void>;
|
|
63
|
+
newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
|
|
64
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
65
|
+
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
66
|
+
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
67
|
+
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
68
|
+
newsletterDelete: (jid: string) => Promise<void>;
|
|
69
|
+
newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
|
|
70
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
71
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
72
|
+
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
73
|
+
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
74
|
+
groupLeave: (id: string) => Promise<void>;
|
|
75
|
+
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
76
|
+
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
77
|
+
[key: string]: string;
|
|
78
|
+
}[]>;
|
|
79
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
80
|
+
status: string;
|
|
81
|
+
jid: string;
|
|
82
|
+
}[]>;
|
|
83
|
+
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
84
|
+
status: string;
|
|
85
|
+
jid: string;
|
|
86
|
+
content: import("..").BinaryNode;
|
|
87
|
+
}[]>;
|
|
88
|
+
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
89
|
+
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
90
|
+
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
91
|
+
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
92
|
+
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
|
93
|
+
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
94
|
+
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
95
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
96
|
+
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
97
|
+
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
98
|
+
groupFetchAllParticipating: () => Promise<{
|
|
99
|
+
[_: string]: import("../Types").GroupMetadata;
|
|
100
|
+
}>;
|
|
101
|
+
processingMutex: {
|
|
102
|
+
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
103
|
+
};
|
|
104
|
+
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
105
|
+
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
106
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
107
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
108
|
+
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
109
|
+
onWhatsApp: (...jids: string[]) => Promise<{
|
|
110
|
+
exists: boolean;
|
|
111
|
+
jid: string;
|
|
112
|
+
}[]>;
|
|
113
|
+
fetchBlocklist: () => Promise<string[]>;
|
|
114
|
+
fetchStatus: (jid: string) => Promise<{
|
|
115
|
+
status: string | undefined;
|
|
116
|
+
setAt: Date;
|
|
117
|
+
} | undefined>;
|
|
118
|
+
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
119
|
+
removeProfilePicture: (jid: string) => Promise<void>;
|
|
120
|
+
updateProfileStatus: (status: string) => Promise<void>;
|
|
121
|
+
updateProfileName: (name: string) => Promise<void>;
|
|
122
|
+
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
123
|
+
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
124
|
+
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
125
|
+
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
126
|
+
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
127
|
+
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
128
|
+
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
129
|
+
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
130
|
+
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
131
|
+
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
132
|
+
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
133
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
134
|
+
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
135
|
+
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
136
|
+
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
137
|
+
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
138
|
+
star: (jid: string, messages: {
|
|
139
|
+
id: string;
|
|
140
|
+
fromMe?: boolean;
|
|
141
|
+
}[], star: boolean) => Promise<void>;
|
|
142
|
+
type: "md";
|
|
143
|
+
ws: any;
|
|
144
|
+
ev: import("../Types").BaileysEventEmitter & {
|
|
145
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
146
|
+
buffer(): void;
|
|
147
|
+
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
148
|
+
flush(force?: boolean): boolean;
|
|
149
|
+
isBuffering(): boolean;
|
|
150
|
+
};
|
|
151
|
+
authState: {
|
|
152
|
+
creds: import("../Types").AuthenticationCreds;
|
|
153
|
+
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
154
|
+
};
|
|
155
|
+
signalRepository: import("../Types").SignalRepository;
|
|
156
|
+
user: import("../Types").Contact | undefined;
|
|
157
|
+
generateMessageTag: () => string;
|
|
158
|
+
query: (node: import("..").BinaryNode, timeoutMs?: number) => Promise<import("..").BinaryNode>;
|
|
159
|
+
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T>;
|
|
160
|
+
waitForSocketOpen: () => Promise<void>;
|
|
161
|
+
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
162
|
+
sendNode: (frame: import("..").BinaryNode) => Promise<void>;
|
|
163
|
+
logout: (msg?: string) => Promise<void>;
|
|
164
|
+
end: (error: Error | undefined) => void;
|
|
165
|
+
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
166
|
+
uploadPreKeys: (count?: number) => Promise<void>;
|
|
167
|
+
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
168
|
+
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
169
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
170
|
+
sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("..").BinaryNode>;
|
|
171
|
+
};
|
|
172
|
+
export default makeWASocket;
|
|
@@ -3,5 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const Defaults_1 = require("../Defaults");
|
|
4
4
|
const registration_1 = require("./registration");
|
|
5
5
|
// export the last socket layer
|
|
6
|
-
const makeWASocket = (config) => ((0, registration_1.makeRegistrationSocket)(
|
|
6
|
+
const makeWASocket = (config) => ((0, registration_1.makeRegistrationSocket)({
|
|
7
|
+
...Defaults_1.DEFAULT_CONNECTION_CONFIG,
|
|
8
|
+
...config
|
|
9
|
+
}));
|
|
7
10
|
exports.default = makeWASocket;
|