@pontalabs/baileys 1.0.6 → 1.0.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.
Files changed (185) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +839 -267
  3. package/WAProto/GenerateStatics.sh +4 -3
  4. package/WAProto/WAProto.proto +511 -1215
  5. package/WAProto/index.d.ts +55 -14017
  6. package/WAProto/index.js +29 -97689
  7. package/lib/Defaults/index.d.ts +74 -72
  8. package/lib/Defaults/index.js +108 -94
  9. package/lib/Signal/Group/ciphertext-message.d.ts +7 -8
  10. package/lib/Signal/Group/ciphertext-message.js +16 -9
  11. package/lib/Signal/Group/group-session-builder.d.ts +13 -11
  12. package/lib/Signal/Group/group-session-builder.js +61 -19
  13. package/lib/Signal/Group/group_cipher.d.ts +16 -14
  14. package/lib/Signal/Group/group_cipher.js +70 -41
  15. package/lib/Signal/Group/index.d.ts +11 -12
  16. package/lib/Signal/Group/index.js +61 -12
  17. package/lib/Signal/Group/keyhelper.d.ts +14 -9
  18. package/lib/Signal/Group/keyhelper.js +58 -10
  19. package/lib/Signal/Group/sender-chain-key.d.ts +13 -13
  20. package/lib/Signal/Group/sender-chain-key.js +34 -13
  21. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -16
  22. package/lib/Signal/Group/sender-key-distribution-message.js +36 -28
  23. package/lib/Signal/Group/sender-key-message.d.ts +18 -18
  24. package/lib/Signal/Group/sender-key-message.js +45 -38
  25. package/lib/Signal/Group/sender-key-name.d.ts +15 -14
  26. package/lib/Signal/Group/sender-key-name.js +31 -20
  27. package/lib/Signal/Group/sender-key-record.d.ts +25 -24
  28. package/lib/Signal/Group/sender-key-record.js +35 -18
  29. package/lib/Signal/Group/sender-key-state.d.ts +34 -29
  30. package/lib/Signal/Group/sender-key-state.js +100 -37
  31. package/lib/Signal/Group/sender-message-key.d.ts +10 -11
  32. package/lib/Signal/Group/sender-message-key.js +22 -15
  33. package/lib/Signal/libsignal.d.ts +8 -5
  34. package/lib/Signal/libsignal.js +142 -288
  35. package/lib/Signal/lid-mapping.d.ts +28 -23
  36. package/lib/Signal/lid-mapping.js +184 -277
  37. package/lib/Socket/Client/index.d.ts +2 -3
  38. package/lib/Socket/Client/index.js +22 -3
  39. package/lib/Socket/Client/types.d.ts +15 -15
  40. package/lib/Socket/Client/types.js +15 -8
  41. package/lib/Socket/Client/websocket.d.ts +12 -12
  42. package/lib/Socket/Client/websocket.js +37 -29
  43. package/lib/Socket/business.d.ts +178 -208
  44. package/lib/Socket/business.js +127 -91
  45. package/lib/Socket/chats.d.ts +93 -120
  46. package/lib/Socket/chats.js +652 -727
  47. package/lib/Socket/community.js +10 -2
  48. package/lib/Socket/groups.d.ts +111 -143
  49. package/lib/Socket/groups.js +186 -165
  50. package/lib/Socket/index.d.ts +183 -252
  51. package/lib/Socket/index.js +18 -38
  52. package/lib/Socket/messages-recv.d.ts +167 -196
  53. package/lib/Socket/messages-recv.js +1567 -1443
  54. package/lib/Socket/messages-send.d.ts +158 -192
  55. package/lib/Socket/messages-send.js +1208 -1102
  56. package/lib/Socket/newsletter.d.ts +138 -163
  57. package/lib/Socket/newsletter.js +249 -153
  58. package/lib/Socket/socket.d.ts +36 -50
  59. package/lib/Socket/socket.js +820 -749
  60. package/lib/Store/index.d.ts +4 -4
  61. package/lib/Store/index.js +24 -4
  62. package/lib/Store/make-in-memory-store.d.ts +104 -44
  63. package/lib/Store/make-in-memory-store.js +213 -199
  64. package/lib/Store/make-ordered-dictionary.d.ts +12 -13
  65. package/lib/Store/make-ordered-dictionary.js +45 -38
  66. package/lib/Store/object-repository.d.ts +10 -11
  67. package/lib/Store/object-repository.js +16 -9
  68. package/lib/Types/Auth.d.ts +97 -93
  69. package/lib/Types/Auth.js +3 -2
  70. package/lib/Types/Bussines.js +3 -2
  71. package/lib/Types/Call.d.ts +13 -14
  72. package/lib/Types/Call.js +3 -2
  73. package/lib/Types/Chat.d.ts +97 -78
  74. package/lib/Types/Chat.js +9 -8
  75. package/lib/Types/Contact.d.ts +9 -12
  76. package/lib/Types/Contact.js +3 -2
  77. package/lib/Types/Events.d.ts +176 -206
  78. package/lib/Types/Events.js +3 -2
  79. package/lib/Types/GroupMetadata.d.ts +48 -53
  80. package/lib/Types/GroupMetadata.js +3 -2
  81. package/lib/Types/Label.d.ts +14 -13
  82. package/lib/Types/Label.js +30 -24
  83. package/lib/Types/LabelAssociation.d.ts +20 -15
  84. package/lib/Types/LabelAssociation.js +12 -6
  85. package/lib/Types/Message.d.ts +412 -248
  86. package/lib/Types/Message.js +19 -17
  87. package/lib/Types/Product.d.ts +71 -58
  88. package/lib/Types/Product.js +3 -2
  89. package/lib/Types/Signal.d.ts +82 -71
  90. package/lib/Types/Signal.js +3 -2
  91. package/lib/Types/Socket.d.ts +81 -76
  92. package/lib/Types/Socket.js +3 -3
  93. package/lib/Types/State.d.ts +19 -75
  94. package/lib/Types/State.js +14 -56
  95. package/lib/Types/USync.d.ts +8 -8
  96. package/lib/Types/USync.js +3 -2
  97. package/lib/Types/index.d.ts +62 -47
  98. package/lib/Types/index.js +50 -26
  99. package/lib/Utils/auth-utils.d.ts +10 -13
  100. package/lib/Utils/auth-utils.js +472 -213
  101. package/lib/Utils/business.d.ts +20 -14
  102. package/lib/Utils/business.js +134 -110
  103. package/lib/Utils/chat-utils.d.ts +70 -88
  104. package/lib/Utils/chat-utils.js +403 -466
  105. package/lib/Utils/crypto.d.ts +46 -27
  106. package/lib/Utils/crypto.js +188 -117
  107. package/lib/Utils/decode-wa-message.d.ts +45 -58
  108. package/lib/Utils/decode-wa-message.js +311 -212
  109. package/lib/Utils/event-buffer.d.ts +17 -14
  110. package/lib/Utils/event-buffer.js +296 -321
  111. package/lib/Utils/generics.d.ts +92 -66
  112. package/lib/Utils/generics.js +436 -270
  113. package/lib/Utils/history.d.ts +23 -24
  114. package/lib/Utils/history.js +76 -106
  115. package/lib/Utils/index.d.ts +21 -24
  116. package/lib/Utils/index.js +41 -24
  117. package/lib/Utils/link-preview.d.ts +14 -12
  118. package/lib/Utils/link-preview.js +75 -40
  119. package/lib/Utils/logger.d.ts +11 -10
  120. package/lib/Utils/logger.js +7 -3
  121. package/lib/Utils/lt-hash.d.ts +14 -8
  122. package/lib/Utils/lt-hash.js +53 -3
  123. package/lib/Utils/make-mutex.d.ts +7 -7
  124. package/lib/Utils/make-mutex.js +44 -28
  125. package/lib/Utils/message-retry-manager.d.ts +88 -115
  126. package/lib/Utils/message-retry-manager.js +160 -265
  127. package/lib/Utils/messages-media.d.ts +107 -105
  128. package/lib/Utils/messages-media.js +619 -548
  129. package/lib/Utils/messages.d.ts +66 -52
  130. package/lib/Utils/messages.js +1558 -1730
  131. package/lib/Utils/noise-handler.d.ts +18 -18
  132. package/lib/Utils/noise-handler.js +130 -176
  133. package/lib/Utils/process-message.d.ts +32 -43
  134. package/lib/Utils/process-message.js +282 -484
  135. package/lib/Utils/rich-message-utils.js +724 -1220
  136. package/lib/Utils/signal.d.ts +32 -37
  137. package/lib/Utils/signal.js +105 -140
  138. package/lib/Utils/use-multi-file-auth-state.d.ts +5 -5
  139. package/lib/Utils/use-multi-file-auth-state.js +120 -70
  140. package/lib/Utils/use-single-file-auth-state.d.ts +13 -11
  141. package/lib/Utils/use-single-file-auth-state.js +66 -92
  142. package/lib/Utils/validate-connection.d.ts +13 -11
  143. package/lib/Utils/validate-connection.js +113 -128
  144. package/lib/WABinary/constants.d.ts +27 -25
  145. package/lib/WABinary/constants.js +1292 -1451
  146. package/lib/WABinary/decode.d.ts +9 -7
  147. package/lib/WABinary/decode.js +189 -163
  148. package/lib/WABinary/encode.d.ts +3 -3
  149. package/lib/WABinary/encode.js +155 -110
  150. package/lib/WABinary/generic-utils.d.ts +27 -14
  151. package/lib/WABinary/generic-utils.js +105 -177
  152. package/lib/WABinary/index.d.ts +5 -6
  153. package/lib/WABinary/index.js +25 -6
  154. package/lib/WABinary/jid-utils.d.ts +54 -41
  155. package/lib/WABinary/jid-utils.js +152 -83
  156. package/lib/WABinary/types.d.ts +13 -10
  157. package/lib/WABinary/types.js +3 -2
  158. package/lib/WAM/BinaryInfo.d.ts +15 -8
  159. package/lib/WAM/BinaryInfo.js +14 -7
  160. package/lib/WAM/constants.d.ts +37 -30
  161. package/lib/WAM/constants.js +11983 -19465
  162. package/lib/WAM/encode.d.ts +3 -3
  163. package/lib/WAM/encode.js +109 -95
  164. package/lib/WAM/index.d.ts +3 -4
  165. package/lib/WAM/index.js +23 -4
  166. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
  167. package/lib/WAUSync/Protocols/USyncContactProtocol.js +21 -37
  168. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -19
  169. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +26 -18
  170. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -11
  171. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +20 -12
  172. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -11
  173. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +24 -16
  174. package/lib/WAUSync/Protocols/index.d.ts +6 -6
  175. package/lib/WAUSync/Protocols/index.js +26 -6
  176. package/lib/WAUSync/USyncQuery.d.ts +28 -27
  177. package/lib/WAUSync/USyncQuery.js +62 -68
  178. package/lib/WAUSync/USyncUser.d.ts +10 -15
  179. package/lib/WAUSync/USyncUser.js +19 -20
  180. package/lib/WAUSync/index.d.ts +3 -4
  181. package/lib/WAUSync/index.js +23 -4
  182. package/lib/index.d.ts +12 -11
  183. package/lib/index.js +39 -12
  184. package/package.json +42 -86
  185. package/engine-requirements.js +0 -10
@@ -1,54 +1,62 @@
1
- import WebSocket from 'ws';
2
- import { DEFAULT_ORIGIN } from '../../Defaults/index.js';
3
- import { AbstractSocketClient } from './types.js';
4
- export class WebSocketClient extends AbstractSocketClient {
1
+ "use strict"
2
+
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod }
5
+ }
6
+
7
+ Object.defineProperty(exports, "__esModule", { value: true })
8
+
9
+ const ws_1 = __importDefault(require("ws"))
10
+ const Defaults_1 = require("../../Defaults")
11
+ const types_1 = require("./types")
12
+
13
+ class WebSocketClient extends types_1.AbstractSocketClient {
5
14
  constructor() {
6
- super(...arguments);
7
- this.socket = null;
15
+ super(...arguments)
16
+ this.socket = null
8
17
  }
9
18
  get isOpen() {
10
- return this.socket?.readyState === WebSocket.OPEN;
19
+ return this.socket?.readyState === ws_1.default.OPEN
11
20
  }
12
21
  get isClosed() {
13
- return this.socket === null || this.socket?.readyState === WebSocket.CLOSED;
22
+ return this.socket?.readyState === ws_1.default.CLOSED
14
23
  }
15
24
  get isClosing() {
16
- return this.socket === null || this.socket?.readyState === WebSocket.CLOSING;
25
+ this.socket?.readyState === ws_1.default.CLOSING
17
26
  }
18
27
  get isConnecting() {
19
- return this.socket?.readyState === WebSocket.CONNECTING;
28
+ this.socket?.readyState === ws_1.default.CONNECTING
20
29
  }
21
- connect() {
30
+ async connect() {
22
31
  if (this.socket) {
23
- return;
32
+ return
24
33
  }
25
- this.socket = new WebSocket(this.url, {
26
- origin: DEFAULT_ORIGIN,
34
+ this.socket = new ws_1.default(this.url, {
35
+ origin: Defaults_1.DEFAULT_ORIGIN,
27
36
  headers: this.config.options?.headers,
28
37
  handshakeTimeout: this.config.connectTimeoutMs,
29
38
  timeout: this.config.connectTimeoutMs,
30
- agent: this.config.agent
31
- });
32
- this.socket.setMaxListeners(0);
33
- const events = ['close', 'error', 'upgrade', 'message', 'open', 'ping', 'pong', 'unexpected-response'];
39
+ agent: this.config.agent,
40
+ })
41
+ this.socket.setMaxListeners(0)
42
+ const events = ['close', 'error', 'upgrade', 'message', 'open', 'ping', 'pong', 'unexpected-response']
34
43
  for (const event of events) {
35
- this.socket?.on(event, (...args) => this.emit(event, ...args));
44
+ this.socket?.on(event, (...args) => this.emit(event, ...args))
36
45
  }
37
46
  }
38
47
  async close() {
39
48
  if (!this.socket) {
40
- return;
49
+ return
41
50
  }
42
- const closePromise = new Promise(resolve => {
43
- this.socket?.once('close', resolve);
44
- });
45
- this.socket.close();
46
- await closePromise;
47
- this.socket = null;
51
+ this.socket.close()
52
+ this.socket = null
48
53
  }
49
54
  send(str, cb) {
50
- this.socket?.send(str, cb);
51
- return Boolean(this.socket);
55
+ this.socket?.send(str, cb)
56
+ return Boolean(this.socket)
52
57
  }
53
58
  }
54
- //# sourceMappingURL=websocket.js.map
59
+
60
+ module.exports = {
61
+ WebSocketClient
62
+ }
@@ -1,217 +1,187 @@
1
- import type { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig, WAMediaUpload } from '../Types/index.js';
2
- import type { UpdateBussinesProfileProps } from '../Types/Bussines.js';
3
- import { type BinaryNode } from '../WABinary/index.js';
1
+ import { GetCatalogOptions, ProductCreate, ProductUpdate, SocketConfig, UpdateBussinesProfileProps } from '../Types'
2
+ import { BinaryNode } from '../WABinary'
3
+
4
4
  export declare const makeBusinessSocket: (config: SocketConfig) => {
5
- logger: import("../Utils/logger.js").ILogger;
6
- getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../index.js").OrderDetails>;
5
+ logger: import("../Utils/logger").ILogger
6
+ getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>
7
7
  getCatalog: ({ jid, limit, cursor }: GetCatalogOptions) => Promise<{
8
- products: import("../index.js").Product[];
9
- nextPageCursor: string | undefined;
10
- }>;
8
+ products: import("../Types").Product[]
9
+ nextPageCursor: string | undefined
10
+ }>
11
11
  getCollections: (jid?: string, limit?: number) => Promise<{
12
- collections: import("../index.js").CatalogCollection[];
13
- }>;
14
- productCreate: (create: ProductCreate) => Promise<import("../index.js").Product>;
12
+ collections: import("../Types").CatalogCollection[]
13
+ }>
14
+ productCreate: (create: ProductCreate) => Promise<import("../Types").Product>
15
15
  productDelete: (productIds: string[]) => Promise<{
16
- deleted: number;
17
- }>;
18
- productUpdate: (productId: string, update: ProductUpdate) => Promise<import("../index.js").Product>;
19
- updateBussinesProfile: (args: UpdateBussinesProfileProps) => Promise<any>;
20
- updateCoverPhoto: (photo: WAMediaUpload) => Promise<number>;
21
- removeCoverPhoto: (id: string) => Promise<any>;
22
- sendMessageAck: (node: BinaryNode, errorCode?: number) => Promise<void>;
23
- sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
24
- rejectCall: (callId: string, callFrom: string) => Promise<void>;
25
- fetchMessageHistory: (count: number, oldestMsgKey: import("../index.js").WAMessageKey, oldestMsgTimestamp: number | import("long").default) => Promise<string>;
26
- requestPlaceholderResend: (messageKey: import("../index.js").WAMessageKey, msgData?: Partial<import("../index.js").WAMessage>) => Promise<string | undefined>;
27
- messageRetryManager: import("../index.js").MessageRetryManager | null;
28
- userDevicesCache: import("../index.js").PossiblyExtendedCacheStore | import("@cacheable/node-cache").NodeCache<import("../index.js").JidWithDevice[]>;
29
- devicesMutex: {
30
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
31
- };
32
- issuePrivacyTokens: (jids: string[], timestamp?: number) => Promise<any>;
33
- assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
34
- relayMessage: (jid: string, message: import("../index.js").proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../index.js").MessageRelayOptions) => Promise<string>;
35
- sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../index.js").MessageReceiptType) => Promise<void>;
36
- sendReceipts: (keys: import("../index.js").WAMessageKey[], type: import("../index.js").MessageReceiptType) => Promise<void>;
37
- readMessages: (keys: import("../index.js").WAMessageKey[]) => Promise<void>;
38
- refreshMediaConn: (forceGet?: boolean) => Promise<import("../index.js").MediaConnInfo>;
39
- getMediaHost: () => string;
40
- waUploadToServer: import("../index.js").WAMediaUploadFunction;
16
+ deleted: number
17
+ }>
18
+ productUpdate: (productId: string, update: ProductUpdate) => Promise<import("../Types").Product>
19
+ updateBussinesProfile: (args: UpdateBussinesProfileProps) => Promise<any>
20
+ updateCoverPhoto: (photo: import("../Types").WAMediaUpload) => Promise<number>
21
+ removeCoverPhoto: (id: string) => Promise<any>
22
+ sendMessageAck: ({ tag, attrs, content }: BinaryNode, errorCode?: number | undefined) => Promise<void>
23
+ sendRetryRequest: (node: BinaryNode, forceIncludeKeys?: boolean) => Promise<void>
24
+ offerCall: (toJid: string, isVideo?: boolean) => Promise<{
25
+ id: any
26
+ to: string
27
+ }>
28
+ rejectCall: (callId: string, callFrom: string) => Promise<void>
29
+ fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAProto.IMessageKey, oldestMsgTimestamp: number | import("long").Long) => Promise<string>
30
+ requestPlaceholderResend: (messageKey: import("../Types").WAProto.IMessageKey) => Promise<string | undefined>
31
+ getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>
32
+ assertSessions: (jids: string[], force: boolean) => Promise<boolean>
33
+ relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>
34
+ sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>
35
+ sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>
36
+ readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>
37
+ refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>
38
+ waUploadToServer: import("../Types").WAMediaUploadFunction
41
39
  fetchPrivacySettings: (force?: boolean) => Promise<{
42
- [_: string]: string;
43
- }>;
44
- sendPeerDataOperationMessage: (pdoMessage: import("../index.js").proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
45
- createParticipantNodes: (recipientJids: string[], message: import("../index.js").proto.IMessage, extraAttrs?: BinaryNode["attrs"], dsmMessage?: import("../index.js").proto.IMessage) => Promise<{
46
- nodes: BinaryNode[];
47
- shouldIncludeDeviceIdentity: boolean;
48
- }>;
49
- getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<(import("../index.js").JidWithDevice & {
50
- jid: string;
51
- })[]>;
52
- updateMemberLabel: (jid: string, memberLabel: string) => Promise<string>;
53
- updateMediaMessage: (message: import("../index.js").WAMessage) => Promise<import("../index.js").WAMessage>;
54
- sendMessage: (jid: string, content: import("../index.js").AnyMessageContent, options?: import("../index.js").MiscMessageGenerationOptions) => Promise<import("../index.js").WAMessage | undefined>;
55
- newsletterCreate: (name: string, description?: string) => Promise<import("../index.js").NewsletterMetadata>;
56
- newsletterUpdate: (jid: string, updates: import("../index.js").NewsletterUpdate) => Promise<unknown>;
57
- newsletterSubscribers: (jid: string) => Promise<{
58
- subscribers: number;
59
- }>;
60
- newsletterMetadata: (type: "invite" | "jid", key: string) => Promise<import("../index.js").NewsletterMetadata | null>;
61
- newsletterFollow: (jid: string) => Promise<unknown>;
62
- newsletterUnfollow: (jid: string) => Promise<unknown>;
63
- newsletterMute: (jid: string) => Promise<unknown>;
64
- newsletterUnmute: (jid: string) => Promise<unknown>;
65
- newsletterUpdateName: (jid: string, name: string) => Promise<unknown>;
66
- newsletterUpdateDescription: (jid: string, description: string) => Promise<unknown>;
67
- newsletterUpdatePicture: (jid: string, content: WAMediaUpload) => Promise<unknown>;
68
- newsletterRemovePicture: (jid: string) => Promise<unknown>;
69
- newsletterReactMessage: (jid: string, serverId: string, reaction?: string) => Promise<void>;
70
- newsletterFetchMessages: (jid: string, count: number, since: number, after: number) => Promise<any>;
71
- subscribeNewsletterUpdates: (jid: string) => Promise<{
72
- duration: string;
73
- } | null>;
74
- newsletterAdminCount: (jid: string) => Promise<number>;
75
- newsletterChangeOwner: (jid: string, newOwnerJid: string) => Promise<void>;
76
- newsletterDemote: (jid: string, userJid: string) => Promise<void>;
77
- newsletterDelete: (jid: string) => Promise<void>;
78
- groupMetadata: (jid: string) => Promise<import("../index.js").GroupMetadata>;
79
- groupCreate: (subject: string, participants: string[]) => Promise<import("../index.js").GroupMetadata>;
80
- groupLeave: (id: string) => Promise<void>;
81
- groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
40
+ [_: string]: string
41
+ }>
42
+ sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>
43
+ createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
44
+ [key: string]: string
45
+ } | undefined) => Promise<{
46
+ nodes: BinaryNode[]
47
+ shouldIncludeDeviceIdentity: boolean
48
+ }>
49
+ profilePictureUrl: (jid: string) => Promise<string>
50
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>
51
+ getEphemeralGroup: (jid: string) => Promise<number>
52
+ updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>
53
+ sendStatusMentions: (content: import("../Types").WAProto.IMessage, jid: string, Private?: boolean) => Promise<string>
54
+ sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>
55
+ groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>
56
+ groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>
57
+ groupLeave: (id: string) => Promise<void>
58
+ groupUpdateSubject: (jid: string, subject: string) => Promise<void>
82
59
  groupRequestParticipantsList: (jid: string) => Promise<{
83
- [key: string]: string;
84
- }[]>;
85
- groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
86
- status: string;
87
- jid: string | undefined;
88
- }[]>;
89
- groupParticipantsUpdate: (jid: string, participants: string[], action: import("../index.js").ParticipantAction) => Promise<{
90
- status: string;
91
- jid: string | undefined;
92
- content: BinaryNode;
93
- }[]>;
94
- groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
95
- groupInviteCode: (jid: string) => Promise<string | undefined>;
96
- groupRevokeInvite: (jid: string) => Promise<string | undefined>;
97
- groupAcceptInvite: (code: string) => Promise<string | undefined>;
98
- groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
99
- groupAcceptInviteV4: (key: string | import("../index.js").WAMessageKey, inviteMessage: import("../index.js").proto.Message.IGroupInviteMessage) => Promise<any>;
100
- groupGetInviteInfo: (code: string) => Promise<import("../index.js").GroupMetadata>;
101
- groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
102
- groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
103
- groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
104
- groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
60
+ [key: string]: string
61
+ }[]>
62
+ groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
63
+ status: string
64
+ jid: string
65
+ }[]>
66
+ groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
67
+ status: string
68
+ jid: string
69
+ content: BinaryNode
70
+ }[]>
71
+ subscribeNewsletterUpdates: (jid: string) => Promise<{
72
+ duration: string
73
+ }>
74
+ newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>
75
+ newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>
76
+ newsletterUpdateName: (jid: string, name: string) => Promise<void>
77
+ newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>
78
+ newsletterRemovePicture: (jid: string) => Promise<void>
79
+ newsletterUnfollow: (jid: string) => Promise<void>
80
+ newsletterFollow: (jid: string) => Promise<void>
81
+ newsletterUnmute: (jid: string) => Promise<void>
82
+ newsletterMute: (jid: string) => Promise<void>
83
+ newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>
84
+ newsletterQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
85
+ newsletterWMexQuery: (jid?: string | undefined, query_id: number, content: BinaryNode) => Promise<BinaryNode>
86
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>
87
+ newsletterFetchAllParticipating: () => Promise<{
88
+ [_: string]: import("../Types").NewsletterMetadata
89
+ }>
90
+ newsletterAdminCount: (jid: string) => Promise<number>
91
+ newsletterChangeOwner: (jid: string, userLid: string) => Promise<void>
92
+ newsletterDemote: (jid: string, userLid: string) => Promise<void>
93
+ newsletterDelete: (jid: string) => Promise<void>
94
+ newsletterReactMessage: (jid: string, server_id: string, code?: string | undefined) => Promise<void>
95
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>
96
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>
97
+ groupQuery: (jid: string, type: string, content: BinaryNode) => Promise<BinaryNode>
98
+ groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>
99
+ groupInviteCode: (jid: string) => Promise<string | undefined>
100
+ groupRevokeInvite: (jid: string) => Promise<string | undefined>
101
+ groupAcceptInvite: (code: string) => Promise<string | undefined>
102
+ groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>
103
+ groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>
104
+ groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>
105
+ groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>
106
+ groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>
107
+ groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>
108
+ groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>
105
109
  groupFetchAllParticipating: () => Promise<{
106
- [_: string]: import("../index.js").GroupMetadata;
107
- }>;
108
- serverProps: {
109
- privacyTokenOn1to1: boolean;
110
- profilePicPrivacyToken: boolean;
111
- lidTrustedTokenIssueToLid: boolean;
112
- };
113
- createCallLink: (type: "audio" | "video", event?: {
114
- startTime: number;
115
- }, timeoutMs?: number) => Promise<string | undefined>;
116
- getBotListV2: () => Promise<import("../index.js").BotListInfo[]>;
117
- messageMutex: {
118
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
119
- };
120
- receiptMutex: {
121
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
122
- };
123
- appStatePatchMutex: {
124
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
125
- };
126
- notificationMutex: {
127
- mutex<T>(code: () => Promise<T> | T): Promise<T>;
128
- };
129
- upsertMessage: (msg: import("../index.js").WAMessage, type: import("../index.js").MessageUpsertType) => Promise<void>;
130
- appPatch: (patchCreate: import("../index.js").WAPatchCreate) => Promise<void>;
131
- sendPresenceUpdate: (type: import("../index.js").WAPresence, toJid?: string) => Promise<void>;
132
- presenceSubscribe: (toJid: string) => Promise<void>;
133
- profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
134
- fetchBlocklist: () => Promise<(string | undefined)[]>;
135
- fetchStatus: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
136
- fetchDisappearingDuration: (...jids: string[]) => Promise<import("../index.js").USyncQueryResultList[] | undefined>;
137
- updateProfilePicture: (jid: string, content: WAMediaUpload, dimensions?: {
138
- width: number;
139
- height: number;
140
- }) => Promise<void>;
141
- removeProfilePicture: (jid: string) => Promise<void>;
142
- updateProfileStatus: (status: string) => Promise<void>;
143
- updateProfileName: (name: string) => Promise<void>;
144
- updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
145
- updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
146
- updateCallPrivacy: (value: import("../index.js").WAPrivacyCallValue) => Promise<void>;
147
- updateMessagesPrivacy: (value: import("../index.js").WAPrivacyMessagesValue) => Promise<void>;
148
- updateLastSeenPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
149
- updateOnlinePrivacy: (value: import("../index.js").WAPrivacyOnlineValue) => Promise<void>;
150
- updateProfilePicturePrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
151
- updateStatusPrivacy: (value: import("../index.js").WAPrivacyValue) => Promise<void>;
152
- updateReadReceiptsPrivacy: (value: import("../index.js").WAReadReceiptsValue) => Promise<void>;
153
- updateGroupsAddPrivacy: (value: import("../index.js").WAPrivacyGroupAddValue) => Promise<void>;
154
- updateDefaultDisappearingMode: (duration: number) => Promise<void>;
155
- getBusinessProfile: (jid: string) => Promise<import("../index.js").WABusinessProfile | void>;
156
- resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
157
- chatModify: (mod: import("../index.js").ChatModification, jid: string) => Promise<void>;
158
- cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
159
- addOrEditContact: (jid: string, contact: import("../index.js").proto.SyncActionValue.IContactAction) => Promise<void>;
160
- removeContact: (jid: string) => Promise<void>;
161
- placeholderResendCache: import("../index.js").CacheStore;
162
- addLabel: (jid: string, labels: import("../Types/Label.js").LabelActionBody) => Promise<void>;
163
- addChatLabel: (jid: string, labelId: string) => Promise<void>;
164
- removeChatLabel: (jid: string, labelId: string) => Promise<void>;
165
- addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
166
- removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
110
+ [_: string]: import("../Types").GroupMetadata
111
+ }>
112
+ processingMutex: {
113
+ mutex<T>(code: () => T | Promise<T>): Promise<T>
114
+ }
115
+ upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>
116
+ appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>
117
+ sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>
118
+ presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>
119
+ getBotListV2: () => Promise<BotListInfo[]>
120
+ getLidUser: (jid: string) => Promise<{
121
+ lid: string
122
+ id: string
123
+ }[] | undefined>
124
+ fetchBlocklist: () => Promise<string[]>
125
+ fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
126
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>
127
+ updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>
128
+ removeProfilePicture: (jid: string) => Promise<void>
129
+ updateProfileStatus: (status: string) => Promise<void>
130
+ updateProfileName: (name: string) => Promise<void>
131
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>
132
+ updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>
133
+ updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
134
+ updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>
135
+ updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
136
+ updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>
137
+ updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>
138
+ updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>
139
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>
140
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>
141
+ getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>
142
+ resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>
143
+ chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>
144
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>
145
+ addLabel: (jid: string, labels: import("../Types/Label").LabelActionBody) => Promise<void>
146
+ addChatLabel: (jid: string, labelId: string) => Promise<void>
147
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>
148
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
149
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>
150
+ clearMessage: (jid: string, key: import("../Types").WAProto.IMessageKey, timeStamp: number | import("long").Long) => Promise<void>
167
151
  star: (jid: string, messages: {
168
- id: string;
169
- fromMe?: boolean;
170
- }[], star: boolean) => Promise<void>;
171
- addOrEditQuickReply: (quickReply: import("../Types/Bussines.js").QuickReplyAction) => Promise<void>;
172
- removeQuickReply: (timestamp: string) => Promise<void>;
173
- type: "md";
174
- ws: import("./Client/index.js").WebSocketClient;
175
- ev: import("../index.js").BaileysEventEmitter & {
176
- process(handler: (events: Partial<import("../index.js").BaileysEventMap>) => void | Promise<void>): () => void;
177
- buffer(): void;
178
- createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
179
- flush(): boolean;
180
- isBuffering(): boolean;
181
- destroy(): void;
182
- };
152
+ id: string
153
+ fromMe?: boolean | undefined
154
+ }[], star: boolean) => Promise<void>
155
+ addOrEditQuickReply: (quickReply: import("../Types/Bussines").QuickReplyAction) => Promise<void>
156
+ removeQuickReply: (timestamp: string) => Promise<void>
157
+ executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>
158
+ type: "md"
159
+ ws: import("./Client").WebSocketClient
160
+ ev: import("../Types").BaileysEventEmitter & {
161
+ process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void
162
+ buffer(): void
163
+ createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>
164
+ flush(force?: boolean | undefined): boolean
165
+ isBuffering(): boolean
166
+ }
183
167
  authState: {
184
- creds: import("../index.js").AuthenticationCreds;
185
- keys: import("../index.js").SignalKeyStoreWithTransaction;
186
- };
187
- signalRepository: import("../index.js").SignalRepositoryWithLIDStore;
188
- user: import("../index.js").Contact | undefined;
189
- generateMessageTag: () => string;
190
- query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
191
- waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
192
- waitForSocketOpen: () => Promise<void>;
193
- sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
194
- sendNode: (frame: BinaryNode) => Promise<void>;
195
- logout: (msg?: string) => Promise<void>;
196
- end: (error: Error | undefined) => Promise<void>;
197
- registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
198
- onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
199
- uploadPreKeys: (count?: number) => Promise<void>;
200
- uploadPreKeysToServerIfRequired: () => Promise<void>;
201
- digestKeyBundle: () => Promise<void>;
202
- rotateSignedPreKey: () => Promise<void>;
203
- requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
204
- updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
205
- sendUnifiedSession: () => Promise<void>;
206
- wamBuffer: import("../index.js").BinaryInfo;
207
- waitForConnectionUpdate: (check: (u: Partial<import("../index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
208
- sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
209
- executeUSyncQuery: (usyncQuery: import("../index.js").USyncQuery) => Promise<import("../index.js").USyncQueryResult | undefined>;
210
- onWhatsApp: (...phoneNumber: string[]) => Promise<{
211
- jid: string;
212
- exists: boolean;
213
- }[] | undefined>;
214
- fetchAccountReachoutTimelock: () => Promise<import("../index.js").ReachoutTimelockState>;
215
- fetchNewChatMessageCap: () => Promise<import("../index.js").NewChatMessageCapInfo>;
216
- };
217
- //# sourceMappingURL=business.d.ts.map
168
+ creds: import("../Types").AuthenticationCreds
169
+ keys: import("../Types").SignalKeyStoreWithTransaction
170
+ }
171
+ signalRepository: import("../Types").SignalRepository
172
+ user: import("../Types").Contact | undefined
173
+ generateMessageTag: () => string
174
+ query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>
175
+ waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>
176
+ waitForSocketOpen: () => Promise<void>
177
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>
178
+ sendNode: (frame: BinaryNode) => Promise<void>
179
+ logout: (msg?: string | undefined) => Promise<void>
180
+ end: (error: Error | undefined) => void
181
+ onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void
182
+ uploadPreKeys: (count?: number) => Promise<void>
183
+ uploadPreKeysToServerIfRequired: () => Promise<void>
184
+ requestPairingCode: (phoneNumber: string, code?: string) => Promise<string>
185
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>
186
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>
187
+ }