@violetix/baileys 0.5.6 → 0.6.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 (80) hide show
  1. package/README.md +1530 -2009
  2. package/WAProto/index.d.ts +14030 -14586
  3. package/WAProto/index.js +58426 -88874
  4. package/lib/Defaults/index.d.ts +2 -7
  5. package/lib/Defaults/index.js +5 -20
  6. package/lib/Signal/Group/sender-key-message.js +19 -1
  7. package/lib/Signal/libsignal.js +82 -29
  8. package/lib/Signal/xeddsa-fast.js +114 -0
  9. package/lib/Socket/Client/types.js +6 -8
  10. package/lib/Socket/Client/websocket.js +3 -38
  11. package/lib/Socket/business.d.ts +0 -3
  12. package/lib/Socket/chats.d.ts +0 -3
  13. package/lib/Socket/chats.js +18 -45
  14. package/lib/Socket/communities.d.ts +0 -3
  15. package/lib/Socket/graphql.js +3 -7
  16. package/lib/Socket/groups.d.ts +0 -3
  17. package/lib/Socket/groups.js +3 -8
  18. package/lib/Socket/index.d.ts +15 -17
  19. package/lib/Socket/messages-recv.d.ts +0 -3
  20. package/lib/Socket/messages-recv.js +43 -127
  21. package/lib/Socket/messages-send.d.ts +0 -4
  22. package/lib/Socket/messages-send.js +63 -191
  23. package/lib/Socket/newsletter.d.ts +0 -3
  24. package/lib/Socket/newsletter.js +1 -2
  25. package/lib/Socket/newsletter.js.map +1 -1
  26. package/lib/Socket/socket.d.ts +0 -9
  27. package/lib/Socket/socket.js +53 -346
  28. package/lib/Store/make-in-memory-store.js +30 -41
  29. package/lib/Types/Auth.d.ts +2 -60
  30. package/lib/Types/Bussines.d.ts +2 -9
  31. package/lib/Types/Call.d.ts +2 -22
  32. package/lib/Types/Chat.d.ts +1 -2
  33. package/lib/Types/Contact.d.ts +2 -11
  34. package/lib/Types/Events.d.ts +2 -41
  35. package/lib/Types/GroupMetadata.d.ts +2 -36
  36. package/lib/Types/Message.d.ts +1 -11
  37. package/lib/Types/Product.d.ts +2 -5
  38. package/lib/Types/Signal.d.ts +2 -10
  39. package/lib/Types/Socket.d.ts +2 -33
  40. package/lib/Types/USync.d.ts +2 -9
  41. package/lib/Types/index.d.ts +1 -3
  42. package/lib/Utils/auth-utils.d.ts +2 -3
  43. package/lib/Utils/auth-utils.js +53 -37
  44. package/lib/Utils/business.js +11 -25
  45. package/lib/Utils/chat-utils.js +4 -6
  46. package/lib/Utils/decode-wa-message.js +2 -2
  47. package/lib/Utils/event-buffer.js +12 -21
  48. package/lib/Utils/generics.d.ts +5 -5
  49. package/lib/Utils/generics.js +7 -25
  50. package/lib/Utils/history.d.ts +1 -2
  51. package/lib/Utils/history.js +83 -137
  52. package/lib/Utils/index.d.ts +0 -4
  53. package/lib/Utils/index.js +0 -4
  54. package/lib/Utils/listener-guard.js +0 -2
  55. package/lib/Utils/message-retry-manager.js +0 -20
  56. package/lib/Utils/messages-media.d.ts +8 -39
  57. package/lib/Utils/messages-media.js +89 -218
  58. package/lib/Utils/messages.d.ts +0 -1
  59. package/lib/Utils/messages.js +36 -122
  60. package/lib/Utils/process-message.d.ts +0 -18
  61. package/lib/Utils/process-message.js +47 -99
  62. package/lib/Utils/rich-message-utils.js +4 -3
  63. package/lib/Utils/use-multi-file-auth-state.d.ts +3 -5
  64. package/lib/Utils/use-multi-file-auth-state.js +6 -27
  65. package/lib/Utils/use-single-file-auth-state.d.ts +1 -1
  66. package/lib/Utils/use-single-file-auth-state.js +3 -12
  67. package/lib/WABinary/types.d.ts +2 -6
  68. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +3 -6
  69. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -3
  70. package/lib/WAUSync/USyncQuery.d.ts +1 -1
  71. package/lib/WAUSync/USyncQuery.js +4 -7
  72. package/package.json +107 -123
  73. package/lib/Utils/a2ui.d.ts +0 -50
  74. package/lib/Utils/a2ui.js +0 -168
  75. package/lib/Utils/anchor-guard.d.ts +0 -71
  76. package/lib/Utils/anchor-guard.js +0 -404
  77. package/lib/Utils/connection-manager.d.ts +0 -44
  78. package/lib/Utils/connection-manager.js +0 -258
  79. package/lib/Utils/ignore-key.d.ts +0 -51
  80. package/lib/Utils/ignore-key.js +0 -176
@@ -9,7 +9,7 @@ import { writeFileSync, readFileSync, existsSync } from 'fs';
9
9
  import { WAProto } from '../Types/index.js';
10
10
  import { LabelAssociationType } from '../Types/LabelAssociation.js';
11
11
  import { DEFAULT_CONNECTION_CONFIG } from '../Defaults/index.js';
12
- import { BufferJSON, md5, toNumber, updateMessageWithReceipt, updateMessageWithReaction } from '../Utils/index.js';
12
+ import { md5, toNumber, updateMessageWithReceipt, updateMessageWithReaction } from '../Utils/index.js';
13
13
  import { jidDecode, jidNormalizedUser } from '../WABinary/index.js';
14
14
  import { makeOrderedDictionary } from './make-ordered-dictionary.js';
15
15
  import { ObjectRepository } from './object-repository.js';
@@ -24,8 +24,8 @@ export const waLabelAssociationKey = {
24
24
  };
25
25
  const makeMessagesDictionary = () => makeOrderedDictionary(waMessageID);
26
26
  const enforceLimits = (messages, groupMetadata, chats, maxChats, maxMessagesPerChat) => {
27
- if (chats.length > maxChats) {
28
- const toRemove = chats.all().slice(maxChats);
27
+ if (chats.count() > maxChats) {
28
+ const toRemove = chats.all().slice(0, chats.count() - maxChats);
29
29
  for (const chat of toRemove) {
30
30
  chats.deleteById(chat.id);
31
31
  delete messages[chat.id];
@@ -34,9 +34,8 @@ const enforceLimits = (messages, groupMetadata, chats, maxChats, maxMessagesPerC
34
34
  }
35
35
  for (const jid of Object.keys(messages)) {
36
36
  const list = messages[jid];
37
- if (list.array.length > maxMessagesPerChat) {
38
- const expired = new Set(list.array.slice(0, list.array.length - maxMessagesPerChat));
39
- list.filter(message => !expired.has(message));
37
+ if (list.length > maxMessagesPerChat) {
38
+ list.filter(m => false, { limit: list.length - maxMessagesPerChat });
40
39
  }
41
40
  }
42
41
  };
@@ -69,9 +68,6 @@ export const makeInMemoryStore = (config = {}) => {
69
68
  }
70
69
  }
71
70
  };
72
- // one key rule for every handler; upsert used alt+normalized while update/receipt/reaction/delete
73
- // used raw or non-alt keys, so LID chats never found their stored messages
74
- const keyJid = (key) => jidNormalizedUser(key.remoteJidAlt || key.remoteJid);
75
71
  const assertMessageList = (jid) => {
76
72
  if (!messages[jid]) {
77
73
  messages[jid] = makeMessagesDictionary();
@@ -119,7 +115,8 @@ export const makeInMemoryStore = (config = {}) => {
119
115
  }
120
116
  logger.debug({ deletedContacts: isLatest ? oldContacts.size : 0, newContacts }, 'synced contacts');
121
117
  for (const msg of newMessages) {
122
- const list = assertMessageList(keyJid(msg.key));
118
+ const jid = msg.key.remoteJidAlt || msg.key.remoteJid;
119
+ const list = assertMessageList(jid);
123
120
  list.upsert(msg, 'prepend');
124
121
  }
125
122
  enforceLimits(messages, groupMetadata, chats, maxChats, maxMessagesPerChat);
@@ -151,13 +148,9 @@ export const makeInMemoryStore = (config = {}) => {
151
148
  }
152
149
  }
153
150
  else {
154
- logger.debug({ update }, 'got update for non-existant contact');
155
- continue;
151
+ return logger.debug({ update }, 'got update for non-existant contact');
156
152
  }
157
- // was Object.assign(contact, contact): update fields (notify, name...) never landed.
158
- // id may be a WA_ADD_NOTIF hash and imgUrl a sentinel, so neither is copied.
159
- const { id: _id, imgUrl: _imgUrl, ...fields } = update;
160
- Object.assign(contact, fields);
153
+ Object.assign(contacts[contact.id], contact);
161
154
  }
162
155
  });
163
156
  on('chats.upsert', newChats => {
@@ -217,7 +210,7 @@ export const makeInMemoryStore = (config = {}) => {
217
210
  case 'append':
218
211
  case 'notify':
219
212
  for (const msg of newMessages) {
220
- const jid = keyJid(msg.key);
213
+ const jid = jidNormalizedUser(msg.key.remoteJidAlt || msg.key.remoteJid);
221
214
  const list = assertMessageList(jid);
222
215
  list.upsert(msg, 'append');
223
216
  enforceLimits(messages, groupMetadata, chats, maxChats, maxMessagesPerChat);
@@ -237,12 +230,7 @@ export const makeInMemoryStore = (config = {}) => {
237
230
  on('messages.update', updates => {
238
231
  var _a;
239
232
  for (const { update, key } of updates) {
240
- // no create: an update for an unknown chat must not add an empty list that evicts real ones
241
- const list = messages[keyJid(key)];
242
- if (!list) {
243
- logger.debug({ update }, 'got update for non-existent message');
244
- continue;
245
- }
233
+ const list = assertMessageList(jidNormalizedUser(key.remoteJid));
246
234
  if (update === null || update === void 0 ? void 0 : update.status) {
247
235
  const listStatus = (_a = list.get(key.id)) === null || _a === void 0 ? void 0 : _a.status;
248
236
  if (listStatus && (update === null || update === void 0 ? void 0 : update.status) <= listStatus) {
@@ -263,7 +251,8 @@ export const makeInMemoryStore = (config = {}) => {
263
251
  list === null || list === void 0 ? void 0 : list.clear();
264
252
  }
265
253
  else {
266
- const list = messages[keyJid(item.keys[0])];
254
+ const jid = item.keys[0].remoteJidAlt || item.keys[0].remoteJid;
255
+ const list = messages[jid];
267
256
  if (list) {
268
257
  const idSet = new Set(item.keys.map(k => k.id));
269
258
  list.filter(m => !idSet.has(m.key.id));
@@ -292,8 +281,7 @@ export const makeInMemoryStore = (config = {}) => {
292
281
  case 'promote':
293
282
  for (const participant of metadata.participants) {
294
283
  for (const participantData of participants) {
295
- if ((participantData.id && participantData.id === participant.id) ||
296
- (participantData.phoneNumber && participantData.phoneNumber === participant.phoneNumber)) {
284
+ if (participantData.id === participant.id || participantData.phoneNumber === participant.phoneNumber) {
297
285
  participant.admin = action === 'promote' && 'admin';
298
286
  }
299
287
  }
@@ -318,7 +306,8 @@ export const makeInMemoryStore = (config = {}) => {
318
306
  });
319
307
  on('message-receipt.update', updates => {
320
308
  for (const { key, receipt } of updates) {
321
- const msg = messages[keyJid(key)]?.get(key.id);
309
+ const obj = messages[key.remoteJidAlt || key.remoteJid];
310
+ const msg = obj === null || obj === void 0 ? void 0 : obj.get(key.id);
322
311
  if (msg) {
323
312
  updateMessageWithReceipt(msg, receipt);
324
313
  }
@@ -326,7 +315,8 @@ export const makeInMemoryStore = (config = {}) => {
326
315
  });
327
316
  on('messages.reaction', (reactions) => {
328
317
  for (const { key, reaction } of reactions) {
329
- const msg = messages[keyJid(key)]?.get(key.id);
318
+ const obj = messages[key.remoteJidAlt || key.remoteJid];
319
+ const msg = obj === null || obj === void 0 ? void 0 : obj.get(key.id);
330
320
  if (msg) {
331
321
  updateMessageWithReaction(msg, reaction);
332
322
  }
@@ -357,7 +347,6 @@ export const makeInMemoryStore = (config = {}) => {
357
347
  list.upsert(WAProto.WebMessageInfo.fromObject(msg), 'append');
358
348
  }
359
349
  }
360
- enforceLimits(messages, groupMetadata, chats, maxChats, maxMessagesPerChat);
361
350
  };
362
351
  return {
363
352
  chats,
@@ -371,28 +360,28 @@ export const makeInMemoryStore = (config = {}) => {
371
360
  bind,
372
361
  /** loads messages from the store, if not found -- uses the legacy connection */
373
362
  loadMessages: async (jid, count, cursor) => {
374
- const list = messages[jid]; // read-only: don't create phantom lists
363
+ const list = assertMessageList(jid);
375
364
  const mode = !cursor || 'before' in cursor ? 'before' : 'after';
376
365
  const cursorKey = !!cursor ? ('before' in cursor ? cursor.before : cursor.after) : undefined;
377
- const cursorValue = cursorKey ? list?.get(cursorKey.id) : undefined;
378
- let result;
366
+ const cursorValue = cursorKey ? list.get(cursorKey.id) : undefined;
367
+ let messages;
379
368
  if (list && mode === 'before' && (!cursorKey || cursorValue)) {
380
369
  if (cursorValue) {
381
370
  const msgIdx = list.array.findIndex(m => m.key.id === (cursorKey === null || cursorKey === void 0 ? void 0 : cursorKey.id));
382
- result = list.array.slice(0, msgIdx);
371
+ messages = list.array.slice(0, msgIdx);
383
372
  }
384
373
  else {
385
- result = list.array;
374
+ messages = list.array;
386
375
  }
387
- const diff = count - result.length;
376
+ const diff = count - messages.length;
388
377
  if (diff < 0) {
389
- result = result.slice(-count); // get the last X messages
378
+ messages = messages.slice(-count); // get the last X messages
390
379
  }
391
380
  }
392
381
  else {
393
- result = [];
382
+ messages = [];
394
383
  }
395
- return result;
384
+ return messages;
396
385
  },
397
386
  /**
398
387
  * Get all available labels for profile
@@ -455,16 +444,16 @@ export const makeInMemoryStore = (config = {}) => {
455
444
  toJSON,
456
445
  fromJSON,
457
446
  writeToFile: (path) => {
458
- writeFileSync(path, JSON.stringify(toJSON(), BufferJSON.replacer));
447
+ writeFileSync(path, JSON.stringify(toJSON()));
459
448
  },
460
449
  readFromFile: (path) => {
461
450
  if (existsSync(path)) {
462
451
  logger.debug({ path }, 'reading from file');
463
452
  const jsonStr = readFileSync(path, { encoding: 'utf-8' });
464
- const json = JSON.parse(jsonStr, BufferJSON.reviver);
453
+ const json = JSON.parse(jsonStr);
465
454
  fromJSON(json);
466
455
  }
467
456
  }
468
457
  };
469
458
  };
470
- //# sourceMappingURL=make-in-memory-store.js.map
459
+ //# sourceMappingURL=make-in-memory-store.js.map
@@ -1,60 +1,2 @@
1
- import type { proto } from '../../WAProto/index.js';
2
- import type { Contact } from './Contact.js';
3
-
4
- export type KeyPair = { public: Uint8Array; private: Uint8Array };
5
- export type SignedKeyPair = { keyPair: KeyPair; signature: Uint8Array; keyId: number };
6
- export type SignalIdentity = { identifier: { name: string; deviceId: number }; identifierKey: Uint8Array };
7
- export interface AuthenticationCreds {
8
- noiseKey: KeyPair;
9
- pairingEphemeralKeyPair: KeyPair;
10
- signedIdentityKey: KeyPair;
11
- signedPreKey: SignedKeyPair;
12
- registrationId: number;
13
- advSecretKey: string;
14
- processedHistoryMessages: { key: proto.IMessageKey; messageTimestamp: number | Long }[];
15
- nextPreKeyId: number;
16
- firstUnuploadedPreKeyId: number;
17
- accountSyncCounter: number;
18
- accountSettings: { unarchiveChats: boolean; defaultDisappearingMode?: proto.IDisappearingMode };
19
- registered: boolean;
20
- me?: Contact;
21
- account?: proto.IADVSignedDeviceIdentity;
22
- signalIdentities?: SignalIdentity[];
23
- pairingCode?: string;
24
- lastPropHash?: string;
25
- routingInfo?: Uint8Array;
26
- platform?: string;
27
- lastAccountSyncTimestamp?: number;
28
- myAppStateKeyId?: string;
29
- additionalData?: unknown;
30
- }
31
- export interface SignalDataTypeMap {
32
- 'pre-key': KeyPair;
33
- session: Uint8Array;
34
- 'sender-key': Uint8Array;
35
- 'sender-key-memory': Record<string, boolean>;
36
- 'app-state-sync-key': proto.Message.IAppStateSyncKeyData;
37
- 'app-state-sync-version': { version: number; hash: Uint8Array; indexValueMap: Record<string, { valueMac: Uint8Array }> };
38
- 'identity-key': Uint8Array;
39
- 'lid-mapping': string;
40
- 'device-list': string[];
41
- tctoken: { token?: Uint8Array; timestamp?: number | string; senderTimestamp?: number };
42
- }
43
- export type SignalDataSet = {
44
- [T in keyof SignalDataTypeMap]?: Record<string, SignalDataTypeMap[T] | null>;
45
- };
46
- export type Awaitable<T> = T | Promise<T>;
47
- export interface SignalKeyStore {
48
- get<T extends keyof SignalDataTypeMap>(type: T, ids: string[]): Awaitable<Record<string, SignalDataTypeMap[T] | null | undefined>>;
49
- set(data: SignalDataSet): Awaitable<void>;
50
- clear?(): Awaitable<void>;
51
- flush?(): Awaitable<void>;
52
- }
53
- export type SignalKeyStoreWithTransaction = SignalKeyStore & {
54
- isInTransaction(): boolean;
55
- transaction<T>(work: () => Promise<T>, key: string): Promise<T>;
56
- flush(): Promise<void>;
57
- };
58
- export type AuthenticationState = { creds: AuthenticationCreds; keys: SignalKeyStore };
59
- export type TransactionCapabilityOptions = { maxCommitRetries: number; delayBetweenTriesMs: number };
60
- import type Long from 'long';
1
+ export {};
2
+ //# sourceMappingURL=Auth.d.ts.map
@@ -1,9 +1,2 @@
1
- export interface BusinessProfile {
2
- wid: string;
3
- address?: string;
4
- description?: string;
5
- email?: string;
6
- website?: string[];
7
- category?: string;
8
- business_hours?: { timezone?: string; business_config: unknown[] };
9
- }
1
+ export {};
2
+ //# sourceMappingURL=Bussines.d.ts.map
@@ -1,22 +1,2 @@
1
- export interface WACallEvent {
2
- id: string;
3
- from: string;
4
- chatId?: string;
5
- date: Date;
6
- offline: boolean;
7
- status: string;
8
- isVideo?: boolean;
9
- isGroup?: boolean;
10
- callKey?: Uint8Array;
11
- audioCodecs?: unknown[];
12
- audioCodec?: unknown;
13
- videoCodec?: unknown;
14
- isLightweight?: boolean;
15
- silenceReason?: string;
16
- peerJid?: string;
17
- participants?: unknown[];
18
- muted?: boolean;
19
- enabled?: boolean;
20
- state?: string;
21
- latencyMs?: number;
22
- }
1
+ export {};
2
+ //# sourceMappingURL=Call.d.ts.map
@@ -1,3 +1,2 @@
1
1
  export const ALL_WA_PATCH_NAMES: string[];
2
- export type Chat = import('../../WAProto/index.js').proto.IConversation & { id: string };
3
- //# sourceMappingURL=Chat.d.ts.map
2
+ //# sourceMappingURL=Chat.d.ts.map
@@ -1,11 +1,2 @@
1
- export interface Contact {
2
- id: string;
3
- name?: string;
4
- notify?: string;
5
- verifiedName?: string;
6
- imgUrl?: string | null;
7
- status?: string;
8
- lid?: string;
9
- phoneNumber?: string;
10
- username?: string;
11
- }
1
+ export {};
2
+ //# sourceMappingURL=Contact.d.ts.map
@@ -1,41 +1,2 @@
1
- import type { AuthenticationCreds, Awaitable } from './Auth.js';
2
- import type { Contact } from './Contact.js';
3
- import type { GroupMetadata, GroupParticipant, ParticipantAction } from './GroupMetadata.js';
4
- import type { ConnectionState } from './Socket.js';
5
- import type { WAMessage, WAMessageKey, WAMessageUpdate, MessageUpsertType } from './Message.js';
6
- import type { WACallEvent } from './Call.js';
7
- export interface BaileysEventMap {
8
- 'connection.update': Partial<ConnectionState>;
9
- 'creds.update': Partial<AuthenticationCreds>;
10
- 'messages.upsert': { messages: WAMessage[]; type: MessageUpsertType; requestId?: string };
11
- 'messages.update': WAMessageUpdate[];
12
- 'messages.delete': { keys: WAMessageKey[] } | { jid: string; all: true };
13
- 'messages.reaction': { key: WAMessageKey; reaction: import('../../WAProto/index.js').proto.IReaction }[];
14
- 'messaging-history.set': { chats: Chat[]; contacts: Contact[]; messages: WAMessage[]; isLatest?: boolean; progress?: number; syncType?: number };
15
- 'contacts.upsert': Contact[];
16
- 'contacts.update': Partial<Contact>[];
17
- 'chats.upsert': Chat[];
18
- 'chats.update': Partial<Chat>[];
19
- 'chats.delete': string[];
20
- 'groups.upsert': GroupMetadata[];
21
- 'groups.update': Partial<GroupMetadata>[];
22
- 'group-participants.update': { id: string; author?: string; participants: GroupParticipant[]; action: ParticipantAction };
23
- 'blocklist.set': { blocklist: string[] };
24
- 'blocklist.update': { blocklist: string[]; type: 'add' | 'remove' };
25
- call: WACallEvent[];
26
- /** Protocol extension events retain the existing permissive payload contract. */
27
- [event: string]: any;
28
- }
29
- export interface BaileysEventEmitter {
30
- on<T extends keyof BaileysEventMap>(event: T, listener: (value: BaileysEventMap[T]) => void): void;
31
- off<T extends keyof BaileysEventMap>(event: T, listener: (value: BaileysEventMap[T]) => void): void;
32
- emit<T extends keyof BaileysEventMap>(event: T, value: BaileysEventMap[T]): boolean;
33
- process(handler: (events: Partial<BaileysEventMap>) => Awaitable<void>): () => void;
34
- removeAllListeners(event?: keyof BaileysEventMap): void;
35
- isBuffering(): boolean;
36
- buffer(): void;
37
- flush(force?: boolean): boolean;
38
- createBufferedFunction<A extends unknown[], R>(work: (...args: A) => Promise<R>): (...args: A) => Promise<R>;
39
- destroy(): void;
40
- }
41
- import type { Chat } from './Chat.js';
1
+ export {};
2
+ //# sourceMappingURL=Events.d.ts.map
@@ -1,36 +1,2 @@
1
- import type { Contact } from './Contact.js';
2
- export type ParticipantAction = 'add' | 'remove' | 'promote' | 'demote';
3
- export interface GroupParticipant extends Contact {
4
- admin?: 'admin' | 'superadmin' | null | false;
5
- }
6
- export interface GroupMetadata {
7
- id: string;
8
- subject: string;
9
- participants: GroupParticipant[];
10
- notify?: string;
11
- addressingMode?: 'lid' | 'pn';
12
- owner?: string;
13
- ownerPn?: string;
14
- ownerUsername?: string;
15
- owner_country_code?: string;
16
- subjectOwner?: string;
17
- subjectOwnerPn?: string;
18
- subjectOwnerUsername?: string;
19
- subjectTime?: number;
20
- creation?: number;
21
- size?: number;
22
- desc?: string;
23
- descId?: string;
24
- descOwner?: string;
25
- descOwnerPn?: string;
26
- descOwnerUsername?: string;
27
- descTime?: number;
28
- restrict?: boolean;
29
- announce?: boolean;
30
- isCommunity?: boolean;
31
- isCommunityAnnounce?: boolean;
32
- joinApprovalMode?: boolean;
33
- memberAddMode?: boolean;
34
- linkedParent?: string;
35
- ephemeralDuration?: number;
36
- }
1
+ export {};
2
+ //# sourceMappingURL=GroupMetadata.d.ts.map
@@ -1,14 +1,4 @@
1
1
  export { proto as WAProto };
2
- export type WAMessage = proto.IWebMessageInfo & { key: WAMessageKey };
3
- export type WAMessageKey = proto.IMessageKey & {
4
- remoteJidAlt?: string;
5
- participantAlt?: string;
6
- remoteJidUsername?: string;
7
- };
8
- export type WAMessageContent = proto.IMessage;
9
- export type MessageUpsertType = 'append' | 'notify';
10
- export type WAMessageUpdate = { key: WAMessageKey; update: Partial<WAMessage> };
11
- export type WAMediaUpload = Buffer | { url: string | URL } | { stream: import('node:stream').Readable };
12
2
  export const AssociationType: typeof proto.MessageAssociation.AssociationType;
13
3
  export const ButtonHeaderType: typeof proto.Message.ButtonsMessage.HeaderType;
14
4
  export const ButtonType: typeof proto.Message.ButtonsMessage.Button.Type;
@@ -19,4 +9,4 @@ export const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
19
9
  export const WAMessageStatus: typeof proto.WebMessageInfo.Status;
20
10
  export const WAMessageAddressingMode: any;
21
11
  import { proto } from '../../WAProto/index.js';
22
- //# sourceMappingURL=Message.d.ts.map
12
+ //# sourceMappingURL=Message.d.ts.map
@@ -1,5 +1,2 @@
1
- import type { makeBusinessSocket } from '../Socket/business.js';
2
- export type Product = Awaited<ReturnType<ReturnType<typeof makeBusinessSocket>['productCreate']>>;
3
- export type CatalogResult = { products: Product[]; nextPageCursor?: string };
4
- export type ProductUpdate = Partial<Pick<Product, 'name' | 'description' | 'price' | 'currency' | 'retailerId' | 'url' | 'isHidden' | 'availability'>>;
5
- export type ProductCreate = ProductUpdate & { name: string; price: number; currency: string; images: import('./Message.js').WAMediaUpload[] };
1
+ export {};
2
+ //# sourceMappingURL=Product.d.ts.map
@@ -1,10 +1,2 @@
1
- import type { makeLibSignalRepository } from '../Signal/libsignal.js';
2
- export type SignalRepository = ReturnType<typeof makeLibSignalRepository>;
3
- export type SignalAuthState = import('./Auth.js').AuthenticationState;
4
- export type E2ESession = {
5
- jid: string;
6
- registrationId: number;
7
- identityKey: Uint8Array;
8
- signedPreKey: { keyId: number; publicKey: Uint8Array; signature: Uint8Array };
9
- preKey?: { keyId: number; publicKey: Uint8Array };
10
- };
1
+ export {};
2
+ //# sourceMappingURL=Signal.d.ts.map
@@ -1,33 +1,2 @@
1
- import type makeWASocket from '../Socket/index.js';
2
- import type { DEFAULT_CONNECTION_CONFIG } from '../Defaults/index.js';
3
- import type { AuthenticationState, Awaitable } from './Auth.js';
4
- import type { GroupMetadata } from './GroupMetadata.js';
5
- import type { WAMessageContent, WAMessageKey } from './Message.js';
6
- export type WAVersion = [number, number, number];
7
- export type WABrowserDescription = [string, string, string];
8
- export type SocketConfig = Omit<Partial<typeof DEFAULT_CONNECTION_CONFIG>,
9
- 'auth' | 'version' | 'getMessage' | 'cachedGroupMetadata' | 'shouldIgnoreJid' | 'customUploadHosts' | 'patchMessageBeforeSending'> & {
10
- auth: AuthenticationState;
11
- version?: WAVersion | (() => Awaitable<WAVersion>);
12
- getMessage?: (key: WAMessageKey) => Promise<WAMessageContent | undefined>;
13
- cachedGroupMetadata?: (jid: string) => Promise<GroupMetadata | undefined>;
14
- shouldIgnoreJid?: (jid: string) => boolean;
15
- customUploadHosts?: { hostname: string; maxContentLengthBytes?: number }[];
16
- patchMessageBeforeSending?: (message: WAMessageContent, recipientJids?: string[]) => Awaitable<
17
- WAMessageContent | { recipientJid: string; message: WAMessageContent }[]
18
- >;
19
- /** Preserve socket extensions that are not part of the default config. */
20
- [option: string]: unknown;
21
- };
22
- export type UserFacingSocketConfig = SocketConfig;
23
- export type WASocket = ReturnType<typeof makeWASocket>;
24
- export interface ConnectionState {
25
- connection: 'open' | 'connecting' | 'close';
26
- lastDisconnect?: { error?: Error; date: Date };
27
- qr?: string;
28
- receivedPendingNotifications?: boolean;
29
- isNewLogin?: boolean;
30
- isOnline?: boolean;
31
- passkeyRequired?: boolean;
32
- pairingCodeExpired?: boolean;
33
- }
1
+ export {};
2
+ //# sourceMappingURL=Socket.d.ts.map
@@ -1,9 +1,2 @@
1
- import type { BinaryNode } from '../WABinary/types.js';
2
- import type { USyncUser } from '../WAUSync/USyncUser.js';
3
- export interface USyncProtocol {
4
- name: string;
5
- getQueryElement(): BinaryNode;
6
- getUserElement(user: USyncUser): BinaryNode | null;
7
- parser(node: BinaryNode): unknown;
8
- }
9
- export type USyncQueryResult = NonNullable<ReturnType<import('../WAUSync/USyncQuery.js').USyncQuery['parseUSyncQueryResult']>>;
1
+ export {};
2
+ //# sourceMappingURL=USync.d.ts.map
@@ -9,8 +9,6 @@ export * from "./Events.js";
9
9
  export * from "./Product.js";
10
10
  export * from "./Call.js";
11
11
  export * from "./Signal.js";
12
- export * from "./USync.js";
13
- export * from "./Bussines.js";
14
12
  export * from "./Mex.js";
15
13
  export const DisconnectReason: any;
16
- //# sourceMappingURL=index.d.ts.map
14
+ //# sourceMappingURL=index.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * @param logger to log trace events
5
5
  * @param _cache cache store to use
6
6
  */
7
- export function makeCacheableSignalKeyStore(store: any, logger: any, _cache?: any): {
7
+ export function makeCacheableSignalKeyStore(store: any, logger: any, _cache: any): {
8
8
  get(type: any, ids: any): Promise<any>;
9
9
  set(data: any): Promise<any>;
10
10
  clear(): Promise<void>;
@@ -17,7 +17,6 @@ export function addTransactionCapability(state: any, logger: any, { maxCommitRet
17
17
  set: (data: any) => Promise<void>;
18
18
  isInTransaction: () => boolean;
19
19
  transaction: (work: any, key: any) => Promise<any>;
20
- flush: () => Promise<void>;
21
20
  };
22
21
  export function assertMeId(creds: any): any;
23
22
  export function initAuthCreds(): {
@@ -56,4 +55,4 @@ export function initAuthCreds(): {
56
55
  routingInfo: undefined;
57
56
  additionalData: undefined;
58
57
  };
59
- //# sourceMappingURL=auth-utils.d.ts.map
58
+ //# sourceMappingURL=auth-utils.d.ts.map