@queenanya/baileys 7.5.11 → 8.1.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 (157) hide show
  1. package/package.json +13 -97
  2. package/LICENSE +0 -21
  3. package/README.md +0 -931
  4. package/WAProto/GenerateStatics.sh +0 -4
  5. package/WAProto/WAProto.proto +0 -3344
  6. package/WAProto/index.d.ts +0 -37016
  7. package/WAProto/index.js +0 -101044
  8. package/WASignalGroup/GroupProtocol.js +0 -1697
  9. package/WASignalGroup/ciphertext_message.js +0 -16
  10. package/WASignalGroup/group_cipher.js +0 -120
  11. package/WASignalGroup/group_session_builder.js +0 -46
  12. package/WASignalGroup/index.js +0 -5
  13. package/WASignalGroup/keyhelper.js +0 -21
  14. package/WASignalGroup/protobufs.js +0 -3
  15. package/WASignalGroup/queue_job.js +0 -69
  16. package/WASignalGroup/sender_chain_key.js +0 -50
  17. package/WASignalGroup/sender_key_distribution_message.js +0 -78
  18. package/WASignalGroup/sender_key_message.js +0 -92
  19. package/WASignalGroup/sender_key_name.js +0 -70
  20. package/WASignalGroup/sender_key_record.js +0 -56
  21. package/WASignalGroup/sender_key_state.js +0 -129
  22. package/WASignalGroup/sender_message_key.js +0 -39
  23. package/lib/Defaults/baileys-version.json +0 -3
  24. package/lib/Defaults/index.d.ts +0 -53
  25. package/lib/Defaults/index.js +0 -107
  26. package/lib/Signal/libsignal.d.ts +0 -3
  27. package/lib/Signal/libsignal.js +0 -152
  28. package/lib/Socket/Client/index.d.ts +0 -2
  29. package/lib/Socket/Client/index.js +0 -18
  30. package/lib/Socket/Client/types.d.ts +0 -17
  31. package/lib/Socket/Client/types.js +0 -13
  32. package/lib/Socket/Client/websocket.d.ts +0 -12
  33. package/lib/Socket/Client/websocket.js +0 -62
  34. package/lib/Socket/business.d.ts +0 -177
  35. package/lib/Socket/business.js +0 -260
  36. package/lib/Socket/chats.d.ts +0 -91
  37. package/lib/Socket/chats.js +0 -949
  38. package/lib/Socket/groups.d.ts +0 -131
  39. package/lib/Socket/groups.js +0 -314
  40. package/lib/Socket/index.d.ts +0 -177
  41. package/lib/Socket/index.js +0 -10
  42. package/lib/Socket/messages-recv.d.ts +0 -164
  43. package/lib/Socket/messages-recv.js +0 -918
  44. package/lib/Socket/messages-send.d.ts +0 -157
  45. package/lib/Socket/messages-send.js +0 -794
  46. package/lib/Socket/newsletter.d.ts +0 -143
  47. package/lib/Socket/newsletter.js +0 -249
  48. package/lib/Socket/socket.d.ts +0 -45
  49. package/lib/Socket/socket.js +0 -616
  50. package/lib/Store/index.d.ts +0 -3
  51. package/lib/Store/index.js +0 -10
  52. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  53. package/lib/Store/make-cache-manager-store.js +0 -83
  54. package/lib/Store/make-in-memory-store.d.ts +0 -118
  55. package/lib/Store/make-in-memory-store.js +0 -420
  56. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  57. package/lib/Store/make-ordered-dictionary.js +0 -81
  58. package/lib/Store/object-repository.d.ts +0 -10
  59. package/lib/Store/object-repository.js +0 -27
  60. package/lib/Types/Auth.d.ts +0 -105
  61. package/lib/Types/Auth.js +0 -2
  62. package/lib/Types/Call.d.ts +0 -13
  63. package/lib/Types/Call.js +0 -2
  64. package/lib/Types/Chat.d.ts +0 -107
  65. package/lib/Types/Chat.js +0 -4
  66. package/lib/Types/Contact.d.ts +0 -19
  67. package/lib/Types/Contact.js +0 -2
  68. package/lib/Types/Events.d.ts +0 -199
  69. package/lib/Types/Events.js +0 -2
  70. package/lib/Types/GroupMetadata.d.ts +0 -56
  71. package/lib/Types/GroupMetadata.js +0 -2
  72. package/lib/Types/Label.d.ts +0 -46
  73. package/lib/Types/Label.js +0 -27
  74. package/lib/Types/LabelAssociation.d.ts +0 -29
  75. package/lib/Types/LabelAssociation.js +0 -9
  76. package/lib/Types/Message.d.ts +0 -280
  77. package/lib/Types/Message.js +0 -9
  78. package/lib/Types/Newsletter.d.ts +0 -79
  79. package/lib/Types/Newsletter.js +0 -18
  80. package/lib/Types/Product.d.ts +0 -78
  81. package/lib/Types/Product.js +0 -2
  82. package/lib/Types/Signal.d.ts +0 -57
  83. package/lib/Types/Signal.js +0 -2
  84. package/lib/Types/Socket.d.ts +0 -118
  85. package/lib/Types/Socket.js +0 -2
  86. package/lib/Types/State.d.ts +0 -27
  87. package/lib/Types/State.js +0 -2
  88. package/lib/Types/index.d.ts +0 -65
  89. package/lib/Types/index.js +0 -42
  90. package/lib/Utils/auth-utils.d.ts +0 -18
  91. package/lib/Utils/auth-utils.js +0 -200
  92. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  93. package/lib/Utils/baileys-event-stream.js +0 -63
  94. package/lib/Utils/business.d.ts +0 -22
  95. package/lib/Utils/business.js +0 -234
  96. package/lib/Utils/chat-utils.d.ts +0 -72
  97. package/lib/Utils/chat-utils.js +0 -745
  98. package/lib/Utils/crypto.d.ts +0 -42
  99. package/lib/Utils/crypto.js +0 -153
  100. package/lib/Utils/decode-wa-message.d.ts +0 -20
  101. package/lib/Utils/decode-wa-message.js +0 -218
  102. package/lib/Utils/event-buffer.d.ts +0 -35
  103. package/lib/Utils/event-buffer.js +0 -520
  104. package/lib/Utils/generics.d.ts +0 -119
  105. package/lib/Utils/generics.js +0 -467
  106. package/lib/Utils/history.d.ts +0 -19
  107. package/lib/Utils/history.js +0 -94
  108. package/lib/Utils/index.d.ts +0 -18
  109. package/lib/Utils/index.js +0 -34
  110. package/lib/Utils/link-preview.d.ts +0 -21
  111. package/lib/Utils/link-preview.js +0 -116
  112. package/lib/Utils/logger.d.ts +0 -2
  113. package/lib/Utils/logger.js +0 -7
  114. package/lib/Utils/lt-hash.d.ts +0 -12
  115. package/lib/Utils/lt-hash.js +0 -51
  116. package/lib/Utils/make-mutex.d.ts +0 -7
  117. package/lib/Utils/make-mutex.js +0 -44
  118. package/lib/Utils/messages-media.d.ts +0 -131
  119. package/lib/Utils/messages-media.js +0 -786
  120. package/lib/Utils/messages.d.ts +0 -78
  121. package/lib/Utils/messages.js +0 -767
  122. package/lib/Utils/noise-handler.d.ts +0 -21
  123. package/lib/Utils/noise-handler.js +0 -150
  124. package/lib/Utils/process-message.d.ts +0 -42
  125. package/lib/Utils/process-message.js +0 -355
  126. package/lib/Utils/signal.d.ts +0 -32
  127. package/lib/Utils/signal.js +0 -158
  128. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -12
  129. package/lib/Utils/use-multi-file-auth-state.js +0 -94
  130. package/lib/Utils/use-single-file-auth-state.d.ts +0 -5
  131. package/lib/Utils/use-single-file-auth-state.js +0 -66
  132. package/lib/Utils/validate-connection.d.ts +0 -10
  133. package/lib/Utils/validate-connection.js +0 -171
  134. package/lib/WABinary/constants.d.ts +0 -27
  135. package/lib/WABinary/constants.js +0 -40
  136. package/lib/WABinary/decode.d.ts +0 -8
  137. package/lib/WABinary/decode.js +0 -254
  138. package/lib/WABinary/encode.d.ts +0 -2
  139. package/lib/WABinary/encode.js +0 -230
  140. package/lib/WABinary/generic-utils.d.ts +0 -16
  141. package/lib/WABinary/generic-utils.js +0 -110
  142. package/lib/WABinary/index.d.ts +0 -5
  143. package/lib/WABinary/index.js +0 -21
  144. package/lib/WABinary/jid-utils.d.ts +0 -31
  145. package/lib/WABinary/jid-utils.js +0 -62
  146. package/lib/WABinary/types.d.ts +0 -18
  147. package/lib/WABinary/types.js +0 -2
  148. package/lib/WAM/BinaryInfo.d.ts +0 -18
  149. package/lib/WAM/BinaryInfo.js +0 -13
  150. package/lib/WAM/constants.d.ts +0 -39
  151. package/lib/WAM/constants.js +0 -15350
  152. package/lib/WAM/encode.d.ts +0 -4
  153. package/lib/WAM/encode.js +0 -155
  154. package/lib/WAM/index.d.ts +0 -3
  155. package/lib/WAM/index.js +0 -19
  156. package/lib/index.d.ts +0 -11
  157. package/lib/index.js +0 -30
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function makeOrderedDictionary(idGetter) {
4
- const array = [];
5
- const dict = {};
6
- const get = (id) => dict[id];
7
- const update = (item) => {
8
- const id = idGetter(item);
9
- const idx = array.findIndex(i => idGetter(i) === id);
10
- if (idx >= 0) {
11
- array[idx] = item;
12
- dict[id] = item;
13
- }
14
- return false;
15
- };
16
- const upsert = (item, mode) => {
17
- const id = idGetter(item);
18
- if (get(id)) {
19
- update(item);
20
- }
21
- else {
22
- if (mode === 'append') {
23
- array.push(item);
24
- }
25
- else {
26
- array.splice(0, 0, item);
27
- }
28
- dict[id] = item;
29
- }
30
- };
31
- const remove = (item) => {
32
- const id = idGetter(item);
33
- const idx = array.findIndex(i => idGetter(i) === id);
34
- if (idx >= 0) {
35
- array.splice(idx, 1);
36
- delete dict[id];
37
- return true;
38
- }
39
- return false;
40
- };
41
- return {
42
- array,
43
- get,
44
- upsert,
45
- update,
46
- remove,
47
- updateAssign: (id, update) => {
48
- const item = get(id);
49
- if (item) {
50
- Object.assign(item, update);
51
- delete dict[id];
52
- dict[idGetter(item)] = item;
53
- return true;
54
- }
55
- return false;
56
- },
57
- clear: () => {
58
- array.splice(0, array.length);
59
- for (const key of Object.keys(dict)) {
60
- delete dict[key];
61
- }
62
- },
63
- filter: (contain) => {
64
- let i = 0;
65
- while (i < array.length) {
66
- if (!contain(array[i])) {
67
- delete dict[idGetter(array[i])];
68
- array.splice(i, 1);
69
- }
70
- else {
71
- i += 1;
72
- }
73
- }
74
- },
75
- toJSON: () => array,
76
- fromJSON: (newItems) => {
77
- array.splice(0, array.length, ...newItems);
78
- }
79
- };
80
- }
81
- exports.default = makeOrderedDictionary;
@@ -1,10 +0,0 @@
1
- export declare class ObjectRepository<T extends object> {
2
- readonly entityMap: Map<string, T>;
3
- constructor(entities?: Record<string, T>);
4
- findById(id: string): T | undefined;
5
- findAll(): T[];
6
- upsertById(id: string, entity: T): Map<string, T>;
7
- deleteById(id: string): boolean;
8
- count(): number;
9
- toJSON(): T[];
10
- }
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObjectRepository = void 0;
4
- class ObjectRepository {
5
- constructor(entities = {}) {
6
- this.entityMap = new Map(Object.entries(entities));
7
- }
8
- findById(id) {
9
- return this.entityMap.get(id);
10
- }
11
- findAll() {
12
- return Array.from(this.entityMap.values());
13
- }
14
- upsertById(id, entity) {
15
- return this.entityMap.set(id, { ...entity });
16
- }
17
- deleteById(id) {
18
- return this.entityMap.delete(id);
19
- }
20
- count() {
21
- return this.entityMap.size;
22
- }
23
- toJSON() {
24
- return this.findAll();
25
- }
26
- }
27
- exports.ObjectRepository = ObjectRepository;
@@ -1,105 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import type { proto } from '../../WAProto';
4
- import type { Contact } from './Contact';
5
- import type { MinimalMessage } from './Message';
6
- export type KeyPair = {
7
- public: Uint8Array;
8
- private: Uint8Array;
9
- };
10
- export type SignedKeyPair = {
11
- keyPair: KeyPair;
12
- signature: Uint8Array;
13
- keyId: number;
14
- timestampS?: number;
15
- };
16
- export type ProtocolAddress = {
17
- name: string;
18
- deviceId: number;
19
- };
20
- export type SignalIdentity = {
21
- identifier: ProtocolAddress;
22
- identifierKey: Uint8Array;
23
- };
24
- export type LTHashState = {
25
- version: number;
26
- hash: Buffer;
27
- indexValueMap: {
28
- [indexMacBase64: string]: {
29
- valueMac: Uint8Array | Buffer;
30
- };
31
- };
32
- };
33
- export type SignalCreds = {
34
- readonly signedIdentityKey: KeyPair;
35
- readonly signedPreKey: SignedKeyPair;
36
- readonly registrationId: number;
37
- };
38
- export type AccountSettings = {
39
- /** unarchive chats when a new message is received */
40
- unarchiveChats: boolean;
41
- /** the default mode to start new conversations with */
42
- defaultDisappearingMode?: Pick<proto.IConversation, 'ephemeralExpiration' | 'ephemeralSettingTimestamp'>;
43
- };
44
- export type AuthenticationCreds = SignalCreds & {
45
- readonly noiseKey: KeyPair;
46
- readonly pairingEphemeralKeyPair: KeyPair;
47
- advSecretKey: string;
48
- me?: Contact;
49
- account?: proto.IADVSignedDeviceIdentity;
50
- signalIdentities?: SignalIdentity[];
51
- myAppStateKeyId?: string;
52
- firstUnuploadedPreKeyId: number;
53
- nextPreKeyId: number;
54
- lastAccountSyncTimestamp?: number;
55
- platform?: string;
56
- processedHistoryMessages: MinimalMessage[];
57
- /** number of times history & app state has been synced */
58
- accountSyncCounter: number;
59
- accountSettings: AccountSettings;
60
- registered: boolean;
61
- pairingCode: string | undefined;
62
- lastPropHash: string | undefined;
63
- routingInfo: Buffer | undefined;
64
- };
65
- export type SignalDataTypeMap = {
66
- 'pre-key': KeyPair;
67
- 'session': Uint8Array;
68
- 'sender-key': Uint8Array;
69
- 'sender-key-memory': {
70
- [jid: string]: boolean;
71
- };
72
- 'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
73
- 'app-state-sync-version': LTHashState;
74
- };
75
- export type SignalDataSet = {
76
- [T in keyof SignalDataTypeMap]?: {
77
- [id: string]: SignalDataTypeMap[T] | null;
78
- };
79
- };
80
- type Awaitable<T> = T | Promise<T>;
81
- export type SignalKeyStore = {
82
- get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<{
83
- [id: string]: SignalDataTypeMap[T];
84
- }>;
85
- set(data: SignalDataSet): Awaitable<void>;
86
- /** clear all the data in the store */
87
- clear?(): Awaitable<void>;
88
- };
89
- export type SignalKeyStoreWithTransaction = SignalKeyStore & {
90
- isInTransaction: () => boolean;
91
- transaction<T>(exec: () => Promise<T>): Promise<T>;
92
- };
93
- export type TransactionCapabilityOptions = {
94
- maxCommitRetries: number;
95
- delayBetweenTriesMs: number;
96
- };
97
- export type SignalAuthState = {
98
- creds: SignalCreds;
99
- keys: SignalKeyStore | SignalKeyStoreWithTransaction;
100
- };
101
- export type AuthenticationState = {
102
- creds: AuthenticationCreds;
103
- keys: SignalKeyStore;
104
- };
105
- export {};
package/lib/Types/Auth.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,13 +0,0 @@
1
- export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept' | 'terminate';
2
- export type WACallEvent = {
3
- chatId: string;
4
- from: string;
5
- isGroup?: boolean;
6
- groupJid?: string;
7
- id: string;
8
- date: Date;
9
- isVideo?: boolean;
10
- status: WACallUpdateType;
11
- offline: boolean;
12
- latencyMs?: number;
13
- };
package/lib/Types/Call.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,107 +0,0 @@
1
- import type { proto } from '../../WAProto';
2
- import type { AccountSettings } from './Auth';
3
- import type { BufferedEventData } from './Events';
4
- import type { ChatLabelAssociationActionBody } from './LabelAssociation';
5
- import type { MessageLabelAssociationActionBody } from './LabelAssociation';
6
- import type { MinimalMessage, WAMessageKey } from './Message';
7
- import type { LabelActionBody } from './Label';
8
- /** privacy settings in WhatsApp Web */
9
- export type WAPrivacyValue = 'all' | 'contacts' | 'contact_blacklist' | 'none';
10
- export type WAPrivacyOnlineValue = 'all' | 'match_last_seen';
11
- export type WAPrivacyGroupAddValue = 'all' | 'contacts' | 'contact_blacklist';
12
- export type WAReadReceiptsValue = 'all' | 'none';
13
- export type WAPrivacyCallValue = 'all' | 'known';
14
- /** set of statuses visible to other people; see updatePresence() in WhatsAppWeb.Send */
15
- export type WAPresence = 'unavailable' | 'available' | 'composing' | 'recording' | 'paused';
16
- export declare const ALL_WA_PATCH_NAMES: readonly ["critical_block", "critical_unblock_low", "regular_high", "regular_low", "regular"];
17
- export type WAPatchName = typeof ALL_WA_PATCH_NAMES[number];
18
- export interface PresenceData {
19
- lastKnownPresence: WAPresence;
20
- lastSeen?: number;
21
- }
22
- export type ChatMutation = {
23
- syncAction: proto.ISyncActionData;
24
- index: string[];
25
- };
26
- export type WAPatchCreate = {
27
- syncAction: proto.ISyncActionValue;
28
- index: string[];
29
- type: WAPatchName;
30
- apiVersion: number;
31
- operation: proto.SyncdMutation.SyncdOperation;
32
- };
33
- export type Chat = proto.IConversation & {
34
- /** unix timestamp of when the last message was received in the chat */
35
- lastMessageRecvTimestamp?: number;
36
- };
37
- export type ChatUpdate = Partial<Chat & {
38
- /**
39
- * if specified in the update,
40
- * the EV buffer will check if the condition gets fulfilled before applying the update
41
- * Right now, used to determine when to release an app state sync event
42
- *
43
- * @returns true, if the update should be applied;
44
- * false if it can be discarded;
45
- * undefined if the condition is not yet fulfilled
46
- * */
47
- conditional: (bufferedData: BufferedEventData) => boolean | undefined;
48
- }>;
49
- /**
50
- * the last messages in a chat, sorted reverse-chronologically. That is, the latest message should be first in the chat
51
- * for MD modifications, the last message in the array (i.e. the earlist message) must be the last message recv in the chat
52
- * */
53
- export type LastMessageList = MinimalMessage[] | proto.SyncActionValue.ISyncActionMessageRange;
54
- export type ChatModification = {
55
- archive: boolean;
56
- lastMessages: LastMessageList;
57
- } | {
58
- pushNameSetting: string;
59
- } | {
60
- pin: boolean;
61
- } | {
62
- /** mute for duration, or provide timestamp of mute to remove*/
63
- mute: number | null;
64
- } | {
65
- clear: boolean;
66
- } | {
67
- deleteForMe: {
68
- deleteMedia: boolean;
69
- key: WAMessageKey;
70
- timestamp: number;
71
- };
72
- } | {
73
- star: {
74
- messages: {
75
- id: string;
76
- fromMe?: boolean;
77
- }[];
78
- star: boolean;
79
- };
80
- } | {
81
- markRead: boolean;
82
- lastMessages: LastMessageList;
83
- } | {
84
- delete: true;
85
- lastMessages: LastMessageList;
86
- } | {
87
- addLabel: LabelActionBody;
88
- } | {
89
- addChatLabel: ChatLabelAssociationActionBody;
90
- } | {
91
- removeChatLabel: ChatLabelAssociationActionBody;
92
- } | {
93
- addMessageLabel: MessageLabelAssociationActionBody;
94
- } | {
95
- removeMessageLabel: MessageLabelAssociationActionBody;
96
- };
97
- export type InitialReceivedChatsState = {
98
- [jid: string]: {
99
- /** the last message received from the other party */
100
- lastMsgRecvTimestamp?: number;
101
- /** the absolute last message in the chat */
102
- lastMsgTimestamp: number;
103
- };
104
- };
105
- export type InitialAppStateSyncOptions = {
106
- accountSettings: AccountSettings;
107
- };
package/lib/Types/Chat.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_WA_PATCH_NAMES = void 0;
4
- exports.ALL_WA_PATCH_NAMES = ['critical_block', 'critical_unblock_low', 'regular_high', 'regular_low', 'regular'];
@@ -1,19 +0,0 @@
1
- export interface Contact {
2
- id: string;
3
- lid?: string;
4
- /** name of the contact, you have saved on your WA */
5
- name?: string;
6
- /** name of the contact, the contact has set on their own on WA */
7
- notify?: string;
8
- /** I have no idea */
9
- verifiedName?: string;
10
- /**
11
- * Url of the profile picture of the contact
12
- *
13
- * 'changed' => if the profile picture has changed
14
- * null => if the profile picture has not been set (default profile picture)
15
- * any other string => url of the profile picture
16
- */
17
- imgUrl?: string | null;
18
- status?: string;
19
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,199 +0,0 @@
1
- import type { Boom } from '@hapi/boom';
2
- import { proto } from '../../WAProto';
3
- import { AuthenticationCreds } from './Auth';
4
- import { WACallEvent } from './Call';
5
- import { Chat, ChatUpdate, PresenceData } from './Chat';
6
- import { Contact } from './Contact';
7
- import { GroupMetadata, ParticipantAction, RequestJoinAction, RequestJoinMethod } from './GroupMetadata';
8
- import { Label } from './Label';
9
- import { LabelAssociation } from './LabelAssociation';
10
- import { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message';
11
- import { ConnectionState } from './State';
12
- import { NewsletterSettingsUpdate, SubscriberAction, NewsletterViewRole } from './Newsletter';
13
- export type BaileysEventMap = {
14
- /** connection state has been updated -- WS closed, opened, connecting etc. */
15
- 'connection.update': Partial<ConnectionState>;
16
- /** credentials updated -- some metadata, keys or something */
17
- 'creds.update': Partial<AuthenticationCreds>;
18
- /** set chats (history sync), everything is reverse chronologically sorted */
19
- 'messaging-history.set': {
20
- chats: Chat[];
21
- contacts: Contact[];
22
- messages: WAMessage[];
23
- isLatest?: boolean;
24
- progress?: number | null;
25
- syncType?: proto.HistorySync.HistorySyncType;
26
- peerDataRequestSessionId?: string | null;
27
- };
28
- /** upsert chats */
29
- 'chats.upsert': Chat[];
30
- /** update the given chats */
31
- 'chats.update': ChatUpdate[];
32
- 'chats.phoneNumberShare': {
33
- lid: string;
34
- jid: string;
35
- };
36
- /** delete chats with given ID */
37
- 'chats.delete': string[];
38
- /** presence of contact in a chat updated */
39
- 'presence.update': {
40
- id: string;
41
- presences: {
42
- [participant: string]: PresenceData;
43
- };
44
- };
45
- 'contacts.upsert': Contact[];
46
- 'contacts.update': Partial<Contact>[];
47
- 'messages.delete': {
48
- keys: WAMessageKey[];
49
- } | {
50
- jid: string;
51
- all: true;
52
- };
53
- 'messages.update': WAMessageUpdate[];
54
- 'messages.media-update': {
55
- key: WAMessageKey;
56
- media?: {
57
- ciphertext: Uint8Array;
58
- iv: Uint8Array;
59
- };
60
- error?: Boom;
61
- }[];
62
- /**
63
- * add/update the given messages. If they were received while the connection was online,
64
- * the update will have type: "notify"
65
- * if requestId is provided, then the messages was received from the phone due to it being unavailable
66
- * */
67
- 'messages.upsert': {
68
- messages: WAMessage[];
69
- type: MessageUpsertType;
70
- requestId?: string;
71
- };
72
- /** message was reacted to. If reaction was removed -- then "reaction.text" will be falsey */
73
- 'messages.reaction': {
74
- key: WAMessageKey;
75
- reaction: proto.IReaction;
76
- }[];
77
- 'message-receipt.update': MessageUserReceiptUpdate[];
78
- 'groups.upsert': GroupMetadata[];
79
- 'groups.update': Partial<GroupMetadata>[];
80
- /** apply an action to participants in a group */
81
- 'group-participants.update': {
82
- id: string;
83
- author: string;
84
- participants: string[];
85
- action: ParticipantAction;
86
- };
87
- 'group.join-request': {
88
- id: string;
89
- author: string;
90
- participant: string;
91
- action: RequestJoinAction;
92
- method: RequestJoinMethod;
93
- };
94
- 'newsletter.reaction': {
95
- id: string;
96
- server_id: string;
97
- reaction: {
98
- code?: string;
99
- count?: number;
100
- removed?: boolean;
101
- };
102
- };
103
- 'newsletter.view': {
104
- id: string;
105
- server_id: string;
106
- count: number;
107
- };
108
- /**don't handles subscribe/unsubscribe actions */
109
- 'newsletter-participants.update': {
110
- id: string;
111
- author: string;
112
- user: string;
113
- new_role: NewsletterViewRole;
114
- action: SubscriberAction;
115
- };
116
- 'newsletter-settings.update': {
117
- id: string;
118
- update: NewsletterSettingsUpdate;
119
- };
120
- 'blocklist.set': {
121
- blocklist: string[];
122
- };
123
- 'blocklist.update': {
124
- blocklist: string[];
125
- type: 'add' | 'remove';
126
- };
127
- /** Receive an update on a call, including when the call was received, rejected, accepted */
128
- 'call': WACallEvent[];
129
- 'labels.edit': Label;
130
- 'labels.association': {
131
- association: LabelAssociation;
132
- type: 'add' | 'remove';
133
- };
134
- };
135
- export type BufferedEventData = {
136
- historySets: {
137
- chats: {
138
- [jid: string]: Chat;
139
- };
140
- contacts: {
141
- [jid: string]: Contact;
142
- };
143
- messages: {
144
- [uqId: string]: WAMessage;
145
- };
146
- empty: boolean;
147
- isLatest: boolean;
148
- progress?: number | null;
149
- syncType?: proto.HistorySync.HistorySyncType;
150
- peerDataRequestSessionId?: string;
151
- };
152
- chatUpserts: {
153
- [jid: string]: Chat;
154
- };
155
- chatUpdates: {
156
- [jid: string]: ChatUpdate;
157
- };
158
- chatDeletes: Set<string>;
159
- contactUpserts: {
160
- [jid: string]: Contact;
161
- };
162
- contactUpdates: {
163
- [jid: string]: Partial<Contact>;
164
- };
165
- messageUpserts: {
166
- [key: string]: {
167
- type: MessageUpsertType;
168
- message: WAMessage;
169
- };
170
- };
171
- messageUpdates: {
172
- [key: string]: WAMessageUpdate;
173
- };
174
- messageDeletes: {
175
- [key: string]: WAMessageKey;
176
- };
177
- messageReactions: {
178
- [key: string]: {
179
- key: WAMessageKey;
180
- reactions: proto.IReaction[];
181
- };
182
- };
183
- messageReceipts: {
184
- [key: string]: {
185
- key: WAMessageKey;
186
- userReceipt: proto.IUserReceipt[];
187
- };
188
- };
189
- groupUpdates: {
190
- [jid: string]: Partial<GroupMetadata>;
191
- };
192
- };
193
- export type BaileysEvent = keyof BaileysEventMap;
194
- export interface BaileysEventEmitter {
195
- on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
196
- off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
197
- removeAllListeners<T extends keyof BaileysEventMap>(event: T): void;
198
- emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
199
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,56 +0,0 @@
1
- import { Contact } from './Contact';
2
- export type GroupParticipant = (Contact & {
3
- isAdmin?: boolean;
4
- isSuperAdmin?: boolean;
5
- admin?: 'admin' | 'superadmin' | null;
6
- });
7
- export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote' | 'modify';
8
- export type RequestJoinAction = 'created' | 'revoked' | 'rejected';
9
- export type RequestJoinMethod = 'invite_link' | 'linked_group_join' | 'non_admin_add' | undefined;
10
- export interface GroupMetadata {
11
- id: string;
12
- owner: string | undefined;
13
- subject: string;
14
- /** group subject owner */
15
- subjectOwner?: string;
16
- /** group subject modification date */
17
- subjectTime?: number;
18
- creation?: number;
19
- desc?: string;
20
- descOwner?: string;
21
- descId?: string;
22
- /** if this group is part of a community, it returns the jid of the community to which it belongs */
23
- linkedParent?: string;
24
- /** is set when the group only allows admins to change group settings */
25
- restrict?: boolean;
26
- /** is set when the group only allows admins to write messages */
27
- announce?: boolean;
28
- /** is set when the group also allows members to add participants */
29
- memberAddMode?: boolean;
30
- /** Request approval to join the group */
31
- joinApprovalMode?: boolean;
32
- /** is this a community */
33
- isCommunity?: boolean;
34
- /** is this the announce of a community */
35
- isCommunityAnnounce?: boolean;
36
- /** number of group participants */
37
- size?: number;
38
- participants: GroupParticipant[];
39
- ephemeralDuration?: number;
40
- inviteCode?: string;
41
- /** the person who added you to group or changed some setting in group */
42
- author?: string;
43
- }
44
- export interface WAGroupCreateResponse {
45
- status: number;
46
- gid?: string;
47
- participants?: [{
48
- [key: string]: {};
49
- }];
50
- }
51
- export interface GroupModificationResponse {
52
- status: number;
53
- participants?: {
54
- [key: string]: {};
55
- };
56
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });