gifted-baileys 1.5.0 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1429 -684
  3. package/WAProto/WAProto.proto +969 -88
  4. package/WAProto/index.d.ts +13199 -1260
  5. package/WAProto/index.js +124901 -74525
  6. package/lib/Defaults/baileys-version.json +1 -1
  7. package/lib/Defaults/index.d.ts +2 -2
  8. package/lib/Defaults/index.js +6 -5
  9. package/lib/Defaults/phonenumber-mcc.json +221 -221
  10. package/lib/Signal/libsignal.js +18 -9
  11. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -2
  12. package/lib/Socket/Client/index.d.ts +2 -3
  13. package/lib/Socket/Client/index.js +2 -3
  14. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -1
  15. package/lib/Socket/Client/types.d.ts +17 -0
  16. package/lib/Socket/Client/types.js +13 -0
  17. package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
  18. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +2 -2
  19. package/lib/Socket/business.d.ts +64 -29
  20. package/lib/Socket/business.js +1 -0
  21. package/lib/Socket/chats.d.ts +10 -8
  22. package/lib/Socket/chats.js +114 -97
  23. package/lib/Socket/groups.d.ts +10 -8
  24. package/lib/Socket/groups.js +4 -2
  25. package/lib/Socket/index.d.ts +70 -35
  26. package/lib/Socket/messages-recv.d.ts +63 -29
  27. package/lib/Socket/messages-recv.js +374 -155
  28. package/lib/Socket/messages-send.d.ts +48 -12
  29. package/lib/Socket/messages-send.js +445 -87
  30. package/lib/Socket/newsletter.d.ts +132 -0
  31. package/lib/Socket/newsletter.js +236 -0
  32. package/lib/Socket/registration.d.ts +73 -41
  33. package/lib/Socket/registration.js +7 -7
  34. package/lib/Socket/socket.d.ts +2 -0
  35. package/lib/Socket/socket.js +56 -15
  36. package/lib/Socket/usync.d.ts +37 -0
  37. package/lib/Socket/usync.js +70 -0
  38. package/lib/Store/make-cache-manager-store.d.ts +2 -1
  39. package/lib/Store/make-in-memory-store.d.ts +2 -1
  40. package/lib/Store/make-in-memory-store.js +40 -46
  41. package/lib/Store/make-ordered-dictionary.d.ts +1 -1
  42. package/lib/Types/Auth.d.ts +2 -1
  43. package/lib/Types/Call.d.ts +1 -1
  44. package/lib/Types/Chat.d.ts +12 -7
  45. package/lib/Types/Events.d.ts +17 -2
  46. package/lib/Types/GroupMetadata.d.ts +6 -2
  47. package/lib/Types/Label.d.ts +11 -0
  48. package/lib/Types/Label.js +1 -1
  49. package/lib/Types/LabelAssociation.js +1 -1
  50. package/lib/Types/Message.d.ts +184 -12
  51. package/lib/Types/Newsletter.d.ts +92 -0
  52. package/lib/Types/Newsletter.js +32 -0
  53. package/lib/Types/Socket.d.ts +7 -2
  54. package/lib/Types/USync.d.ts +25 -0
  55. package/lib/Types/USync.js +2 -0
  56. package/lib/Types/index.d.ts +10 -0
  57. package/lib/Types/index.js +2 -1
  58. package/lib/Utils/auth-utils.js +5 -3
  59. package/lib/Utils/business.d.ts +1 -1
  60. package/lib/Utils/business.js +2 -2
  61. package/lib/Utils/chat-utils.d.ts +11 -12
  62. package/lib/Utils/chat-utils.js +41 -20
  63. package/lib/Utils/crypto.d.ts +15 -16
  64. package/lib/Utils/crypto.js +35 -23
  65. package/lib/Utils/decode-wa-message.d.ts +17 -0
  66. package/lib/Utils/decode-wa-message.js +65 -13
  67. package/lib/Utils/generics.d.ts +11 -17
  68. package/lib/Utils/generics.js +47 -13
  69. package/lib/Utils/history.d.ts +6 -2
  70. package/lib/Utils/history.js +3 -0
  71. package/lib/Utils/link-preview.js +1 -1
  72. package/lib/Utils/logger.d.ts +1 -3
  73. package/lib/Utils/make-mutex.d.ts +2 -2
  74. package/lib/Utils/messages-media.d.ts +31 -25
  75. package/lib/Utils/messages-media.js +95 -53
  76. package/lib/Utils/messages.d.ts +2 -1
  77. package/lib/Utils/messages.js +515 -34
  78. package/lib/Utils/noise-handler.d.ts +6 -6
  79. package/lib/Utils/noise-handler.js +16 -3
  80. package/lib/Utils/process-message.js +4 -3
  81. package/lib/Utils/signal.d.ts +2 -1
  82. package/lib/Utils/signal.js +11 -19
  83. package/lib/Utils/use-multi-file-auth-state.js +11 -3
  84. package/lib/Utils/validate-connection.js +16 -2
  85. package/lib/WABinary/decode.d.ts +1 -2
  86. package/lib/WABinary/decode.js +17 -7
  87. package/lib/WABinary/encode.d.ts +1 -2
  88. package/lib/WABinary/encode.js +33 -17
  89. package/lib/WABinary/generic-utils.d.ts +2 -3
  90. package/lib/WABinary/generic-utils.js +2 -2
  91. package/lib/WABinary/jid-utils.d.ts +4 -2
  92. package/lib/WABinary/jid-utils.js +4 -1
  93. package/lib/WAM/BinaryInfo.d.ts +8 -0
  94. package/lib/WAM/BinaryInfo.js +13 -0
  95. package/lib/WAM/constants.d.ts +38 -0
  96. package/lib/WAM/constants.js +15350 -0
  97. package/lib/WAM/encode.d.ts +2 -0
  98. package/lib/WAM/encode.js +155 -0
  99. package/lib/WAM/index.d.ts +3 -0
  100. package/lib/WAM/index.js +19 -0
  101. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  102. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  103. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  104. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  105. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  106. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  107. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  108. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  109. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  110. package/lib/WAUSync/Protocols/index.js +20 -0
  111. package/lib/WAUSync/USyncQuery.d.ts +26 -0
  112. package/lib/WAUSync/USyncQuery.js +79 -0
  113. package/lib/WAUSync/USyncUser.d.ts +10 -0
  114. package/lib/WAUSync/USyncUser.js +22 -0
  115. package/lib/WAUSync/index.d.ts +3 -0
  116. package/lib/WAUSync/index.js +19 -0
  117. package/lib/gifted +1 -0
  118. package/lib/index.js +2 -0
  119. package/package.json +10 -7
  120. package/lib/index.d.ts +0 -10
@@ -1,23 +1,58 @@
1
1
  /// <reference types="node" />
2
2
  import { Boom } from '@hapi/boom';
3
3
  import { proto } from '../../WAProto';
4
- import { AnyMessageContent, MediaConnInfo, MessageReceiptType, MessageRelayOptions, MiscMessageGenerationOptions, SocketConfig, WAMessageKey } from '../Types';
5
- import { BinaryNode } from '../WABinary';
4
+ import { AnyMessageContent, Media, MediaConnInfo, MessageReceiptType, MessageRelayOptions, MiscMessageGenerationOptions, QueryIds, SocketConfig, WAMessageKey } from '../Types';
5
+ import { BinaryNode, JidWithDevice } from '../WABinary';
6
+ import { USyncQuery } from '../WAUSync';
6
7
  export declare const makeMessagesSocket: (config: SocketConfig) => {
7
8
  getPrivacyTokens: (jids: string[]) => Promise<BinaryNode>;
8
9
  assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
9
- relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
10
+ relayMessage: (jid: string, message: proto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: MessageRelayOptions) => Promise<string>;
10
11
  sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: MessageReceiptType) => Promise<void>;
11
12
  sendReceipts: (keys: WAMessageKey[], type: MessageReceiptType) => Promise<void>;
12
13
  getButtonArgs: (message: proto.IMessage) => BinaryNode['attrs'];
13
14
  readMessages: (keys: WAMessageKey[]) => Promise<void>;
14
15
  refreshMediaConn: (forceGet?: boolean) => Promise<MediaConnInfo>;
16
+ getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<JidWithDevice[]>;
17
+ sendPeerDataOperationMessage: (pdoMessage: proto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
18
+ createParticipantNodes: (jids: string[], message: proto.IMessage, extraAttrs?: BinaryNode['attrs']) => Promise<{
19
+ nodes: BinaryNode[];
20
+ shouldIncludeDeviceIdentity: boolean;
21
+ }>;
22
+ profilePictureUrl: (jid: string, type?: 'preview' | 'image', timeoutMs?: number) => Promise<string | null | undefined>;
15
23
  waUploadToServer: import("../Types").WAMediaUploadFunction;
16
24
  fetchPrivacySettings: (force?: boolean) => Promise<{
17
25
  [_: string]: string;
18
26
  }>;
19
27
  updateMediaMessage: (message: proto.IWebMessageInfo) => Promise<proto.IWebMessageInfo>;
28
+ sendStatusMentions: (content: AnyMessageContent, jids?: string[]) => Promise<proto.WebMessageInfo>;
29
+ sendAlbumMessage: (jid: string, medias: Media[], options?: MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo>;
20
30
  sendMessage: (jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions) => Promise<proto.WebMessageInfo | undefined>;
31
+ newsletterQuery: (jid: string, type: "get" | "set", content: BinaryNode[]) => Promise<BinaryNode>;
32
+ newsletterWMexQuery: (jid: string | undefined, queryId: QueryIds, content?: object | undefined) => Promise<BinaryNode>;
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
+ newsletterAction: (jid: string, type: "mute" | "follow" | "unfollow" | "unmute") => Promise<void>;
46
+ newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
47
+ newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
48
+ newsletterAdminCount: (jid: string) => Promise<number>;
49
+ newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
50
+ newsletterDemote: (jid: string, user: string) => Promise<void>;
51
+ newsletterDelete: (jid: string) => Promise<void>;
52
+ newsletterReactMessage: (jid: string, serverId: string, code?: string | undefined) => Promise<void>;
53
+ newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
54
+ newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
55
+ groupQuery: (jid: string, type: "get" | "set", content: BinaryNode[]) => Promise<BinaryNode>;
21
56
  groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
22
57
  groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
23
58
  groupLeave: (id: string) => Promise<void>;
@@ -27,7 +62,7 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
27
62
  }[]>;
28
63
  groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
29
64
  status: string;
30
- jid: string; /** Bulk read messages. Keys can be from different chats & participants */
65
+ jid: string;
31
66
  }[]>;
32
67
  groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
33
68
  status: string;
@@ -47,23 +82,22 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
47
82
  groupFetchAllParticipating: () => Promise<{
48
83
  [_: string]: import("../Types").GroupMetadata;
49
84
  }>;
85
+ interactiveQuery: (userNodes: BinaryNode[], queryNode: BinaryNode) => Promise<BinaryNode[]>;
50
86
  processingMutex: {
51
87
  mutex<T>(code: () => T | Promise<T>): Promise<T>;
52
88
  };
53
89
  upsertMessage: (msg: proto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
54
90
  appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
91
+ fetchUserLid: (jid: string) => Promise<string | undefined>;
55
92
  sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
56
93
  presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
57
- profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
58
94
  onWhatsApp: (...jids: string[]) => Promise<{
59
- exists: boolean;
60
95
  jid: string;
61
- }[]>;
96
+ exists: unknown;
97
+ }[] | undefined>;
62
98
  fetchBlocklist: () => Promise<string[]>;
63
- fetchStatus: (jid: string) => Promise<{
64
- status: string | undefined;
65
- setAt: Date;
66
- } | undefined>;
99
+ fetchStatus: (...jids: string[]) => Promise<import("../WAUSync").USyncQueryResultList[] | undefined>;
100
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../WAUSync").USyncQueryResultList[] | undefined>;
67
101
  updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
68
102
  removeProfilePicture: (jid: string) => Promise<void>;
69
103
  updateProfileStatus: (status: string) => Promise<void>;
@@ -88,6 +122,7 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
88
122
  id: string;
89
123
  fromMe?: boolean | undefined;
90
124
  }[], star: boolean) => Promise<void>;
125
+ executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync").USyncQueryResult | undefined>;
91
126
  type: "md";
92
127
  ws: any;
93
128
  ev: import("../Types").BaileysEventEmitter & {
@@ -114,6 +149,7 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
114
149
  onUnexpectedError: (err: Error | Boom<any>, msg: string) => void;
115
150
  uploadPreKeys: (count?: number) => Promise<void>;
116
151
  uploadPreKeysToServerIfRequired: () => Promise<void>;
117
- requestPairingCode: (phoneNumber: string) => Promise<string>;
152
+ requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
118
153
  waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
154
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
119
155
  };