@queenanya/baileys 6.9.5 → 7.0.0

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.
Files changed (53) hide show
  1. package/README.md +56 -13
  2. package/lib/Defaults/baileys-version.json +1 -1
  3. package/lib/Defaults/index.js +4 -1
  4. package/lib/Socket/business.d.ts +46 -9
  5. package/lib/Socket/chats.d.ts +10 -2
  6. package/lib/Socket/chats.js +40 -1
  7. package/lib/Socket/groups.d.ts +17 -3
  8. package/lib/Socket/groups.js +12 -1
  9. package/lib/Socket/index.d.ts +46 -9
  10. package/lib/Socket/messages-recv.d.ts +45 -9
  11. package/lib/Socket/messages-recv.js +166 -15
  12. package/lib/Socket/messages-send.d.ts +39 -5
  13. package/lib/Socket/messages-send.js +153 -37
  14. package/lib/Socket/newsletter.d.ts +140 -0
  15. package/lib/Socket/newsletter.js +249 -0
  16. package/lib/Socket/registration.d.ts +46 -12
  17. package/lib/Socket/socket.js +4 -3
  18. package/lib/Store/make-in-memory-store.js +5 -1
  19. package/lib/Types/Chat.d.ts +5 -0
  20. package/lib/Types/Events.d.ts +32 -1
  21. package/lib/Types/GroupMetadata.d.ts +1 -1
  22. package/lib/Types/Label.d.ts +11 -0
  23. package/lib/Types/Message.d.ts +39 -27
  24. package/lib/Types/Newsletter.d.ts +79 -0
  25. package/lib/Types/Newsletter.js +18 -0
  26. package/lib/Types/Socket.d.ts +7 -0
  27. package/lib/Types/index.d.ts +9 -0
  28. package/lib/Types/index.js +1 -0
  29. package/lib/Utils/chat-utils.js +16 -0
  30. package/lib/Utils/crypto.d.ts +1 -1
  31. package/lib/Utils/crypto.js +4 -2
  32. package/lib/Utils/decode-wa-message.d.ts +1 -0
  33. package/lib/Utils/decode-wa-message.js +50 -22
  34. package/lib/Utils/generics.d.ts +30 -10
  35. package/lib/Utils/generics.js +82 -10
  36. package/lib/Utils/history.d.ts +4 -0
  37. package/lib/Utils/history.js +3 -0
  38. package/lib/Utils/logger.d.ts +1 -3
  39. package/lib/Utils/messages-media.d.ts +10 -1
  40. package/lib/Utils/messages-media.js +61 -18
  41. package/lib/Utils/messages.js +72 -69
  42. package/lib/Utils/noise-handler.d.ts +1 -1
  43. package/lib/Utils/noise-handler.js +2 -2
  44. package/lib/Utils/process-message.d.ts +3 -2
  45. package/lib/Utils/process-message.js +47 -24
  46. package/lib/Utils/signal.js +21 -16
  47. package/lib/WABinary/decode.d.ts +2 -2
  48. package/lib/WABinary/decode.js +6 -4
  49. package/lib/WABinary/encode.d.ts +1 -2
  50. package/lib/WABinary/encode.js +1 -1
  51. package/lib/WABinary/jid-utils.d.ts +3 -1
  52. package/lib/WABinary/jid-utils.js +4 -1
  53. package/package.json +31 -27
@@ -1,9 +1,10 @@
1
+ /// <reference types="long" />
1
2
  /// <reference types="node" />
2
3
  import { UserFacingSocketConfig } from '../Types';
3
4
  declare const makeWASocket: (config: UserFacingSocketConfig) => {
4
5
  register: (code: string) => Promise<import("./registration").ExistsResponse>;
5
6
  requestRegistrationCode: (registrationOptions?: import("./registration").RegistrationOptions | undefined) => Promise<import("./registration").ExistsResponse>;
6
- logger: import("pino").Logger<import("pino").LoggerOptions>;
7
+ logger: import("pino").Logger<never>;
7
8
  getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
8
9
  getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
9
10
  products: import("../Types").Product[];
@@ -20,22 +21,50 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
20
21
  sendMessageAck: ({ tag, attrs, content }: import("../index").BinaryNode) => Promise<void>;
21
22
  sendRetryRequest: (node: import("../index").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
22
23
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
24
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | import("long").Long) => Promise<string>;
25
+ requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
23
26
  getPrivacyTokens: (jids: string[]) => Promise<import("../index").BinaryNode>;
24
27
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
25
- relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
28
+ relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
26
29
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
27
- sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
28
- getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
29
- [key: string]: string;
30
- };
31
- readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
30
+ sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
31
+ readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
32
32
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
33
33
  waUploadToServer: import("../Types").WAMediaUploadFunction;
34
34
  fetchPrivacySettings: (force?: boolean) => Promise<{
35
35
  [_: string]: string;
36
36
  }>;
37
+ sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
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
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../index").JidWithDevice[]>;
37
45
  updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
38
46
  sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
47
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
48
+ duration: string;
49
+ }>;
50
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
51
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
52
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>;
53
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
54
+ newsletterRemovePicture: (jid: string) => Promise<void>;
55
+ newsletterUnfollow: (jid: string) => Promise<void>;
56
+ newsletterFollow: (jid: string) => Promise<void>;
57
+ newsletterUnmute: (jid: string) => Promise<void>;
58
+ newsletterMute: (jid: string) => Promise<void>;
59
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
60
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
61
+ newsletterAdminCount: (jid: string) => Promise<number>;
62
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
63
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
64
+ newsletterDelete: (jid: string) => Promise<void>;
65
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>;
66
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
67
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
39
68
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
40
69
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
41
70
  groupLeave: (id: string) => Promise<void>;
@@ -56,7 +85,8 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
56
85
  groupInviteCode: (jid: string) => Promise<string | undefined>;
57
86
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
58
87
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
59
- groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
88
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
89
+ groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
60
90
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
61
91
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
62
92
  groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
@@ -78,6 +108,11 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
78
108
  jid: string;
79
109
  }[]>;
80
110
  fetchBlocklist: () => Promise<string[]>;
111
+ fetchDisappearingDuration: (...jids: string[]) => Promise<{
112
+ user: string;
113
+ duration: number;
114
+ setAt: Date;
115
+ }[]>;
81
116
  fetchStatus: (jid: string) => Promise<{
82
117
  status: string | undefined;
83
118
  setAt: Date;
@@ -87,17 +122,19 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
87
122
  updateProfileStatus: (status: string) => Promise<void>;
88
123
  updateProfileName: (name: string) => Promise<void>;
89
124
  updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
125
+ updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
90
126
  updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
91
127
  updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
92
128
  updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
93
129
  updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
94
130
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
95
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
131
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
96
132
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
97
133
  getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
98
134
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
99
135
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
100
136
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
137
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
101
138
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
102
139
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
103
140
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -1,28 +1,56 @@
1
1
  /// <reference types="node" />
2
2
  import { Boom } from '@hapi/boom';
3
3
  import { proto } from '../../WAProto';
4
- import { MessageReceiptType, MessageRelayOptions, SocketConfig } from '../Types';
4
+ import { MessageReceiptType, MessageRelayOptions, SocketConfig, WAMessageKey } from '../Types';
5
5
  import { BinaryNode } from '../WABinary';
6
6
  export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
7
7
  sendMessageAck: ({ tag, attrs, content }: BinaryNode) => Promise<void>;
8
8
  sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
9
9
  rejectCall: (callId: string, callFrom: string) => Promise<void>;
10
+ fetchMessageHistory: (count: number, oldestMsgKey: WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
11
+ requestPlaceholderResend: (messageKey: WAMessageKey) => Promise<'RESOLVED' | string | undefined>;
10
12
  getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
11
13
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
12
- relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
14
+ relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
13
15
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
14
- sendReceipts: (keys: proto.IMessageKey[], type: MessageReceiptType) => Promise<void>;
15
- getButtonArgs: (message: proto.IMessage) => {
16
- [key: string]: string;
17
- };
18
- readMessages: (keys: proto.IMessageKey[]) => Promise<void>;
16
+ sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
17
+ readMessages: (keys: WAMessageKey[]) => Promise<void>;
19
18
  refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
20
19
  waUploadToServer: import("../Types").WAMediaUploadFunction;
21
20
  fetchPrivacySettings: (force?: boolean) => Promise<{
22
21
  [_: string]: string;
23
22
  }>;
23
+ sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
24
+ createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: {
25
+ [key: string]: string;
26
+ } | undefined) => Promise<{
27
+ nodes: BinaryNode[];
28
+ shouldIncludeDeviceIdentity: boolean;
29
+ }>;
30
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
24
31
  updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
25
32
  sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
33
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
34
+ duration: string;
35
+ }>;
36
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
37
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
38
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>;
39
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
40
+ newsletterRemovePicture: (jid: string) => Promise<void>;
41
+ newsletterUnfollow: (jid: string) => Promise<void>;
42
+ newsletterFollow: (jid: string) => Promise<void>;
43
+ newsletterUnmute: (jid: string) => Promise<void>;
44
+ newsletterMute: (jid: string) => Promise<void>;
45
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
46
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
47
+ newsletterAdminCount: (jid: string) => Promise<number>;
48
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
49
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
50
+ newsletterDelete: (jid: string) => Promise<void>;
51
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>;
52
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
53
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
26
54
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
27
55
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
28
56
  groupLeave: (id: string) => Promise<void>;
@@ -43,7 +71,8 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
43
71
  groupInviteCode: (jid: string) => Promise<string | undefined>;
44
72
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
45
73
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
46
- groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
74
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
75
+ groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
47
76
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
48
77
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
49
78
  groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
@@ -65,6 +94,11 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
65
94
  jid: string;
66
95
  }[]>;
67
96
  fetchBlocklist: () => Promise<string[]>;
97
+ fetchDisappearingDuration: (...jids: string[]) => Promise<{
98
+ user: string;
99
+ duration: number;
100
+ setAt: Date;
101
+ }[]>;
68
102
  fetchStatus: (jid: string) => Promise<{
69
103
  status: string | undefined;
70
104
  setAt: Date;
@@ -74,17 +108,19 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
74
108
  updateProfileStatus: (status: string) => Promise<void>;
75
109
  updateProfileName: (name: string) => Promise<void>;
76
110
  updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
111
+ updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
77
112
  updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
78
113
  updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
79
114
  updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
80
115
  updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
81
116
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
82
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
117
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
83
118
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
84
119
  getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
85
120
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
86
121
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
87
122
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
123
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
88
124
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
89
125
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
90
126
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
@@ -17,9 +17,9 @@ const WABinary_1 = require("../WABinary");
17
17
  const groups_1 = require("./groups");
18
18
  const messages_send_1 = require("./messages-send");
19
19
  const makeMessagesRecvSocket = (config) => {
20
- const { logger, retryRequestDelayMs, maxMsgRetryCount, getMessage, shouldIgnoreJid } = config;
20
+ const { logger, retryRequestDelayMs, maxMsgRetryCount, ignoreMsgLoading, getMessage, shouldIgnoreJid } = config;
21
21
  const sock = (0, messages_send_1.makeMessagesSocket)(config);
22
- const { ev, authState, ws, processingMutex, signalRepository, query, upsertMessage, resyncAppState, onUnexpectedError, assertSessions, sendNode, relayMessage, sendReceipt, uploadPreKeys, } = sock;
22
+ const { ev, authState, ws, processingMutex, signalRepository, query, upsertMessage, resyncAppState, onUnexpectedError, assertSessions, sendNode, relayMessage, sendReceipt, uploadPreKeys, sendPeerDataOperationMessage, } = sock;
23
23
  /** this mutex ensures that each retryRequest will wait for the previous one to finish */
24
24
  const retryMutex = (0, make_mutex_1.makeMutex)();
25
25
  const msgRetryCache = config.msgRetryCounterCache || new node_cache_1.default({
@@ -30,6 +30,10 @@ const makeMessagesRecvSocket = (config) => {
30
30
  stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.CALL_OFFER,
31
31
  useClones: false
32
32
  });
33
+ const placeholderResendCache = config.placeholderResendCache || new node_cache_1.default({
34
+ stdTTL: Defaults_1.DEFAULT_CACHE_TTLS.MSG_RETRY,
35
+ useClones: false
36
+ });
33
37
  let sendActiveReceipts = false;
34
38
  const sendMessageAck = async ({ tag, attrs, content }) => {
35
39
  const stanza = {
@@ -75,16 +79,24 @@ const makeMessagesRecvSocket = (config) => {
75
79
  await query(stanza);
76
80
  };
77
81
  const sendRetryRequest = async (node, forceIncludeKeys = false) => {
78
- const msgId = node.attrs.id;
79
- let retryCount = msgRetryCache.get(msgId) || 0;
82
+ const { fullMessage } = (0, Utils_1.decodeMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '');
83
+ const { key: msgKey } = fullMessage;
84
+ const msgId = msgKey.id;
85
+ const key = `${msgId}:${msgKey === null || msgKey === void 0 ? void 0 : msgKey.participant}`;
86
+ let retryCount = msgRetryCache.get(key) || 0;
80
87
  if (retryCount >= maxMsgRetryCount) {
81
88
  logger.debug({ retryCount, msgId }, 'reached retry limit, clearing');
82
- msgRetryCache.del(msgId);
89
+ msgRetryCache.del(key);
83
90
  return;
84
91
  }
85
92
  retryCount += 1;
86
- msgRetryCache.set(msgId, retryCount);
93
+ msgRetryCache.set(key, retryCount);
87
94
  const { account, signedPreKey, signedIdentityKey: identityKey } = authState.creds;
95
+ if (retryCount === 1) {
96
+ //request a resend via phone
97
+ const msgId = await requestPlaceholderResend(msgKey);
98
+ logger.debug(`sendRetryRequest: requested placeholder resend for message ${msgId}`);
99
+ }
88
100
  const deviceIdentity = (0, Utils_1.encodeSignedDeviceIdentity)(account, true);
89
101
  await authState.keys.transaction(async () => {
90
102
  const receipt = {
@@ -163,7 +175,7 @@ const makeMessagesRecvSocket = (config) => {
163
175
  }
164
176
  };
165
177
  const handleGroupNotification = (participant, child, msg) => {
166
- var _a, _b;
178
+ var _a, _b, _c, _d;
167
179
  const participantJid = ((_b = (_a = (0, WABinary_1.getBinaryNodeChild)(child, 'participant')) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.jid) || participant;
168
180
  switch (child === null || child === void 0 ? void 0 : child.tag) {
169
181
  case 'create':
@@ -190,6 +202,11 @@ const makeMessagesRecvSocket = (config) => {
190
202
  }
191
203
  };
192
204
  break;
205
+ case 'modify':
206
+ const oldNumber = (0, WABinary_1.getBinaryNodeChildren)(child, 'participant').map(p => p.attrs.jid);
207
+ msg.messageStubParameters = oldNumber || [];
208
+ msg.messageStubType = Types_1.WAMessageStubType.GROUP_PARTICIPANT_CHANGE_NUMBER;
209
+ break;
193
210
  case 'promote':
194
211
  case 'demote':
195
212
  case 'remove':
@@ -211,6 +228,11 @@ const makeMessagesRecvSocket = (config) => {
211
228
  msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_SUBJECT;
212
229
  msg.messageStubParameters = [child.attrs.subject];
213
230
  break;
231
+ case 'description':
232
+ const description = (_d = (_c = (0, WABinary_1.getBinaryNodeChild)(child, 'body')) === null || _c === void 0 ? void 0 : _c.content) === null || _d === void 0 ? void 0 : _d.toString();
233
+ msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_DESCRIPTION;
234
+ msg.messageStubParameters = description ? [description] : undefined;
235
+ break;
214
236
  case 'announcement':
215
237
  case 'not_announcement':
216
238
  msg.messageStubType = Types_1.WAMessageStubType.GROUP_CHANGE_ANNOUNCE;
@@ -250,6 +272,50 @@ const makeMessagesRecvSocket = (config) => {
250
272
  break;
251
273
  }
252
274
  };
275
+ const handleNewsletterNotification = (id, node) => {
276
+ const messages = (0, WABinary_1.getBinaryNodeChild)(node, 'messages');
277
+ const message = (0, WABinary_1.getBinaryNodeChild)(messages, 'message');
278
+ const server_id = message.attrs.server_id;
279
+ const reactionsList = (0, WABinary_1.getBinaryNodeChild)(message, 'reactions');
280
+ const viewsList = (0, WABinary_1.getBinaryNodeChildren)(message, 'views_count');
281
+ if (reactionsList) {
282
+ const reactions = (0, WABinary_1.getBinaryNodeChildren)(reactionsList, 'reaction');
283
+ if (reactions.length === 0) {
284
+ ev.emit('newsletter.reaction', { id, server_id, reaction: { removed: true } });
285
+ }
286
+ reactions.forEach(item => {
287
+ var _a, _b;
288
+ ev.emit('newsletter.reaction', { id, server_id, reaction: { code: (_a = item.attrs) === null || _a === void 0 ? void 0 : _a.code, count: +((_b = item.attrs) === null || _b === void 0 ? void 0 : _b.count) } });
289
+ });
290
+ }
291
+ if (viewsList.length) {
292
+ viewsList.forEach(item => {
293
+ ev.emit('newsletter.view', { id, server_id, count: +item.attrs.count });
294
+ });
295
+ }
296
+ };
297
+ const handleMexNewsletterNotification = (id, node) => {
298
+ var _a;
299
+ const operation = node === null || node === void 0 ? void 0 : node.attrs.op_name;
300
+ const content = JSON.parse((_a = node === null || node === void 0 ? void 0 : node.content) === null || _a === void 0 ? void 0 : _a.toString());
301
+ let contentPath;
302
+ if (operation === Types_1.MexOperations.PROMOTE || operation === Types_1.MexOperations.DEMOTE) {
303
+ let action;
304
+ if (operation === Types_1.MexOperations.PROMOTE) {
305
+ action = 'promote';
306
+ contentPath = content.data[Types_1.XWAPaths.PROMOTE];
307
+ }
308
+ if (operation === Types_1.MexOperations.DEMOTE) {
309
+ action = 'demote';
310
+ contentPath = content.data[Types_1.XWAPaths.DEMOTE];
311
+ }
312
+ ev.emit('newsletter-participants.update', { id, author: contentPath.actor.pn, user: contentPath.user.pn, new_role: contentPath.user_new_role, action });
313
+ }
314
+ if (operation === Types_1.MexOperations.UPDATE) {
315
+ contentPath = content.data[Types_1.XWAPaths.METADATA_UPDATE];
316
+ ev.emit('newsletter-settings.update', { id, update: contentPath.thread_metadata.settings });
317
+ }
318
+ };
253
319
  const processNotification = async (node) => {
254
320
  var _a, _b, _c;
255
321
  const result = {};
@@ -270,6 +336,12 @@ const makeMessagesRecvSocket = (config) => {
270
336
  logger.debug({ jid }, 'got privacy token update');
271
337
  }
272
338
  break;
339
+ case 'newsletter':
340
+ handleNewsletterNotification(node.attrs.from, child);
341
+ break;
342
+ case 'mex':
343
+ handleMexNewsletterNotification(node.attrs.from, child);
344
+ break;
273
345
  case 'w:gp2':
274
346
  handleGroupNotification(node.attrs.participant, child, result);
275
347
  break;
@@ -280,6 +352,9 @@ const makeMessagesRecvSocket = (config) => {
280
352
  case 'encrypt':
281
353
  await handleEncryptNotification(node);
282
354
  break;
355
+ case 'newsletter':
356
+ // TO DO
357
+ break;
283
358
  case 'devices':
284
359
  const devices = (0, WABinary_1.getBinaryNodeChildren)(child, 'device');
285
360
  if ((0, WABinary_1.areJidsSameUser)(child.attrs.jid, authState.creds.me.id)) {
@@ -298,7 +373,7 @@ const makeMessagesRecvSocket = (config) => {
298
373
  const setPicture = (0, WABinary_1.getBinaryNodeChild)(node, 'set');
299
374
  const delPicture = (0, WABinary_1.getBinaryNodeChild)(node, 'delete');
300
375
  ev.emit('contacts.update', [{
301
- id: (0, WABinary_1.jidNormalizedUser)((_a = node === null || node === void 0 ? void 0 : node.attrs) === null || _a === void 0 ? void 0 : _a.jid) || ((_c = (_b = (setPicture || delPicture)) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.hash) || '',
376
+ id: (0, WABinary_1.jidNormalizedUser)((_a = node === null || node === void 0 ? void 0 : node.attrs) === null || _a === void 0 ? void 0 : _a.from) || ((_c = (_b = (setPicture || delPicture)) === null || _b === void 0 ? void 0 : _b.attrs) === null || _c === void 0 ? void 0 : _c.hash) || '',
302
377
  imgUrl: setPicture ? 'changed' : 'removed'
303
378
  }]);
304
379
  if ((0, WABinary_1.isJidGroup)(from)) {
@@ -343,7 +418,7 @@ const makeMessagesRecvSocket = (config) => {
343
418
  const ref = toRequiredBuffer((0, WABinary_1.getBinaryNodeChildBuffer)(linkCodeCompanionReg, 'link_code_pairing_ref'));
344
419
  const primaryIdentityPublicKey = toRequiredBuffer((0, WABinary_1.getBinaryNodeChildBuffer)(linkCodeCompanionReg, 'primary_identity_pub'));
345
420
  const primaryEphemeralPublicKeyWrapped = toRequiredBuffer((0, WABinary_1.getBinaryNodeChildBuffer)(linkCodeCompanionReg, 'link_code_pairing_wrapped_primary_ephemeral_pub'));
346
- const codePairingPublicKey = decipherLinkPublicKey(primaryEphemeralPublicKeyWrapped);
421
+ const codePairingPublicKey = await decipherLinkPublicKey(primaryEphemeralPublicKeyWrapped);
347
422
  const companionSharedKey = Utils_1.Curve.sharedKey(authState.creds.pairingEphemeralKeyPair.private, codePairingPublicKey);
348
423
  const random = (0, crypto_1.randomBytes)(32);
349
424
  const linkCodeSalt = (0, crypto_1.randomBytes)(32);
@@ -400,10 +475,10 @@ const makeMessagesRecvSocket = (config) => {
400
475
  return result;
401
476
  }
402
477
  };
403
- function decipherLinkPublicKey(data) {
478
+ async function decipherLinkPublicKey(data) {
404
479
  const buffer = toRequiredBuffer(data);
405
480
  const salt = buffer.slice(0, 32);
406
- const secretKey = (0, Utils_1.derivePairingCodeKey)(authState.creds.pairingCode, salt);
481
+ const secretKey = await (0, Utils_1.derivePairingCodeKey)(authState.creds.pairingCode, salt);
407
482
  const iv = buffer.slice(32, 48);
408
483
  const payload = buffer.slice(48, 80);
409
484
  return (0, Utils_1.aesDecryptCTR)(payload, secretKey, iv);
@@ -566,14 +641,37 @@ const makeMessagesRecvSocket = (config) => {
566
641
  ]);
567
642
  };
568
643
  const handleMessage = async (node) => {
569
- var _a, _b;
644
+ var _a, _b, _c;
570
645
  if (shouldIgnoreJid(node.attrs.from) && node.attrs.from !== '@s.whatsapp.net') {
646
+ if (ignoreMsgLoading && node.attrs.offline) {
647
+ logger.debug({ key: node.attrs.key }, 'ignored offline message');
648
+ await sendMessageAck(node);
649
+ return;
650
+ }
571
651
  logger.debug({ key: node.attrs.key }, 'ignored message');
572
652
  await sendMessageAck(node);
573
653
  return;
574
654
  }
655
+ let response;
656
+ if ((0, WABinary_1.getBinaryNodeChild)(node, 'unavailable') && !(0, WABinary_1.getBinaryNodeChild)(node, 'enc')) {
657
+ await sendMessageAck(node);
658
+ const { key } = (0, Utils_1.decodeMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '').fullMessage;
659
+ response = await requestPlaceholderResend(key);
660
+ if (response === 'RESOLVED') {
661
+ return;
662
+ }
663
+ logger.debug('received unavailable message, acked and requested resend from phone');
664
+ }
665
+ else {
666
+ if (placeholderResendCache.get(node.attrs.id)) {
667
+ placeholderResendCache.del(node.attrs.id);
668
+ }
669
+ }
575
670
  const { fullMessage: msg, category, author, decrypt } = (0, Utils_1.decryptMessageNode)(node, authState.creds.me.id, authState.creds.me.lid || '', signalRepository, logger);
576
- if (((_b = (_a = msg.message) === null || _a === void 0 ? void 0 : _a.protocolMessage) === null || _b === void 0 ? void 0 : _b.type) === WAProto_1.proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER) {
671
+ if (response && ((_a = msg === null || msg === void 0 ? void 0 : msg.messageStubParameters) === null || _a === void 0 ? void 0 : _a[0]) === Utils_1.NO_MESSAGE_FOUND_ERROR_TEXT) {
672
+ msg.messageStubParameters = [Utils_1.NO_MESSAGE_FOUND_ERROR_TEXT, response];
673
+ }
674
+ if (((_c = (_b = msg.message) === null || _b === void 0 ? void 0 : _b.protocolMessage) === null || _c === void 0 ? void 0 : _c.type) === WAProto_1.proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER) {
577
675
  if (node.attrs.sender_pn) {
578
676
  ev.emit('chats.phoneNumberShare', { lid: node.attrs.from, jid: node.attrs.sender_pn });
579
677
  }
@@ -585,6 +683,9 @@ const makeMessagesRecvSocket = (config) => {
585
683
  if (msg.messageStubType === WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT) {
586
684
  retryMutex.mutex(async () => {
587
685
  if (ws.isOpen) {
686
+ if ((0, WABinary_1.getBinaryNodeChild)(node, 'unavailable')) {
687
+ return;
688
+ }
588
689
  const encNode = (0, WABinary_1.getBinaryNodeChild)(node, 'enc');
589
690
  await sendRetryRequest(node, !encNode);
590
691
  if (retryRequestDelayMs) {
@@ -627,6 +728,54 @@ const makeMessagesRecvSocket = (config) => {
627
728
  sendMessageAck(node)
628
729
  ]);
629
730
  };
731
+ const fetchMessageHistory = async (count, oldestMsgKey, oldestMsgTimestamp) => {
732
+ var _a;
733
+ if (!((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id)) {
734
+ throw new boom_1.Boom('Not authenticated');
735
+ }
736
+ const pdoMessage = {
737
+ historySyncOnDemandRequest: {
738
+ chatJid: oldestMsgKey.remoteJid,
739
+ oldestMsgFromMe: oldestMsgKey.fromMe,
740
+ oldestMsgId: oldestMsgKey.id,
741
+ oldestMsgTimestampMs: oldestMsgTimestamp,
742
+ onDemandMsgCount: count
743
+ },
744
+ peerDataOperationRequestType: WAProto_1.proto.Message.PeerDataOperationRequestType.HISTORY_SYNC_ON_DEMAND
745
+ };
746
+ return sendPeerDataOperationMessage(pdoMessage);
747
+ };
748
+ const requestPlaceholderResend = async (messageKey) => {
749
+ var _a;
750
+ if (!((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id)) {
751
+ throw new boom_1.Boom('Not authenticated');
752
+ }
753
+ if (placeholderResendCache.get(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id)) {
754
+ logger.debug('already requested resend', { messageKey });
755
+ return;
756
+ }
757
+ else {
758
+ placeholderResendCache.set(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id, true);
759
+ }
760
+ await (0, Utils_1.delay)(5000);
761
+ if (!placeholderResendCache.get(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id)) {
762
+ logger.debug('message received while resend requested', { messageKey });
763
+ return 'RESOLVED';
764
+ }
765
+ const pdoMessage = {
766
+ placeholderMessageResendRequest: [{
767
+ messageKey
768
+ }],
769
+ peerDataOperationRequestType: WAProto_1.proto.Message.PeerDataOperationRequestType.PLACEHOLDER_MESSAGE_RESEND
770
+ };
771
+ setTimeout(() => {
772
+ if (placeholderResendCache.get(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id)) {
773
+ logger.debug('PDO message without response after 15 seconds. Phone possibly offline', { messageKey });
774
+ placeholderResendCache.del(messageKey === null || messageKey === void 0 ? void 0 : messageKey.id);
775
+ }
776
+ }, 15000);
777
+ return sendPeerDataOperationMessage(pdoMessage);
778
+ };
630
779
  const handleCall = async (node) => {
631
780
  const { attrs } = node;
632
781
  const [infoChild] = (0, WABinary_1.getAllBinaryNodeChildren)(node);
@@ -661,7 +810,7 @@ const makeMessagesRecvSocket = (config) => {
661
810
  await sendMessageAck(node);
662
811
  };
663
812
  const handleBadAck = async ({ attrs }) => {
664
- const key = { remoteJid: attrs.from, fromMe: true, id: attrs.id };
813
+ const key = { remoteJid: attrs.from, fromMe: true, id: attrs.id, server_id: attrs === null || attrs === void 0 ? void 0 : attrs.server_id };
665
814
  // current hypothesis is that if pash is sent in the ack
666
815
  // it means -- the message hasn't reached all devices yet
667
816
  // we'll retry sending the message here
@@ -756,7 +905,9 @@ const makeMessagesRecvSocket = (config) => {
756
905
  ...sock,
757
906
  sendMessageAck,
758
907
  sendRetryRequest,
759
- rejectCall
908
+ rejectCall,
909
+ fetchMessageHistory,
910
+ requestPlaceholderResend,
760
911
  };
761
912
  };
762
913
  exports.makeMessagesRecvSocket = makeMessagesRecvSocket;
@@ -2,22 +2,48 @@
2
2
  import { Boom } from '@hapi/boom';
3
3
  import { proto } from '../../WAProto';
4
4
  import { AnyMessageContent, MediaConnInfo, MessageReceiptType, MessageRelayOptions, MiscMessageGenerationOptions, SocketConfig, WAMessageKey } from '../Types';
5
- import { BinaryNode } from '../WABinary';
5
+ import { BinaryNode, JidWithDevice } from '../WABinary';
6
6
  export declare const makeMessagesSocket: (config: SocketConfig) => {
7
7
  getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
8
8
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
9
- relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
9
+ relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
10
10
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
11
11
  sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
12
- getButtonArgs: (message: proto.IMessage) => BinaryNode['attrs'];
13
12
  readMessages: (keys: WAMessageKey[]) => Promise<void>;
14
13
  refreshMediaConn: (forceGet?: boolean) => Promise<MediaConnInfo>;
15
14
  waUploadToServer: import("../Types").WAMediaUploadFunction;
16
15
  fetchPrivacySettings: (force?: boolean) => Promise<{
17
16
  [_: string]: string;
18
17
  }>;
18
+ sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
19
+ createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode['attrs']) => Promise<{
20
+ nodes: BinaryNode[];
21
+ shouldIncludeDeviceIdentity: boolean;
22
+ }>;
23
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<JidWithDevice[]>;
19
24
  updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
20
25
  sendMessage: (jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
26
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
27
+ duration: string;
28
+ }>;
29
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
30
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
31
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>;
32
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
33
+ newsletterRemovePicture: (jid: string) => Promise<void>;
34
+ newsletterUnfollow: (jid: string) => Promise<void>;
35
+ newsletterFollow: (jid: string) => Promise<void>;
36
+ newsletterUnmute: (jid: string) => Promise<void>;
37
+ newsletterMute: (jid: string) => Promise<void>;
38
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
39
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
40
+ newsletterAdminCount: (jid: string) => Promise<number>;
41
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
42
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
43
+ newsletterDelete: (jid: string) => Promise<void>;
44
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>;
45
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
46
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
21
47
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
22
48
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
23
49
  groupLeave: (id: string) => Promise<void>;
@@ -38,7 +64,8 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
38
64
  groupInviteCode: (jid: string) => Promise<string | undefined>;
39
65
  groupRevokeInvite: (jid: string) => Promise<string | undefined>;
40
66
  groupAcceptInvite: (code: string) => Promise<string | undefined>;
41
- groupAcceptInviteV4: (key: string | proto.IMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
67
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
68
+ groupAcceptInviteV4: (key: string | WAMessageKey, inviteMessage: proto.Message.IGroupInviteMessage) => Promise<string>;
42
69
  groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
43
70
  groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
44
71
  groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
@@ -60,6 +87,11 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
60
87
  jid: string;
61
88
  }[]>;
62
89
  fetchBlocklist: () => Promise<string[]>;
90
+ fetchDisappearingDuration: (...jids: string[]) => Promise<{
91
+ user: string;
92
+ duration: number;
93
+ setAt: Date;
94
+ }[]>;
63
95
  fetchStatus: (jid: string) => Promise<{
64
96
  status: string | undefined;
65
97
  setAt: Date;
@@ -69,17 +101,19 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
69
101
  updateProfileStatus: (status: string) => Promise<void>;
70
102
  updateProfileName: (name: string) => Promise<void>;
71
103
  updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
104
+ updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
72
105
  updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
73
106
  updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
74
107
  updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
75
108
  updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
76
109
  updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
77
- updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
110
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
78
111
  updateDefaultDisappearingMode: (duration: number) => Promise<void>;
79
112
  getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
80
113
  resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
81
114
  chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
82
115
  cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
116
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>;
83
117
  addChatLabel: (jid: string, labelId: string) => Promise<void>;
84
118
  removeChatLabel: (jid: string, labelId: string) => Promise<void>;
85
119
  addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;