@queenanya/baileys 7.4.10 → 7.4.13

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 (111) hide show
  1. package/README.md +26 -26
  2. package/WAProto/index.js +97194 -67957
  3. package/lib/Defaults/baileys-version.json +1 -1
  4. package/lib/Defaults/index.d.ts +231 -1
  5. package/lib/Defaults/index.js +23 -11
  6. package/lib/Defaults/phonenumber-mcc.json +223 -0
  7. package/lib/Socket/Client/index.d.ts +3 -2
  8. package/lib/Socket/Client/index.js +3 -2
  9. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  10. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  11. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
  12. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +2 -2
  13. package/lib/Socket/business.d.ts +28 -31
  14. package/lib/Socket/chats.d.ts +9 -17
  15. package/lib/Socket/chats.js +116 -115
  16. package/lib/Socket/groups.d.ts +10 -23
  17. package/lib/Socket/groups.js +1 -12
  18. package/lib/Socket/index.d.ts +38 -69
  19. package/lib/Socket/index.js +2 -2
  20. package/lib/Socket/messages-recv.d.ts +28 -30
  21. package/lib/Socket/messages-recv.js +180 -291
  22. package/lib/Socket/messages-send.d.ts +19 -25
  23. package/lib/Socket/messages-send.js +76 -110
  24. package/lib/Socket/newsletter.d.ts +13 -19
  25. package/lib/Socket/newsletter.js +54 -67
  26. package/lib/Socket/{communities.d.ts → registration.d.ts} +145 -94
  27. package/lib/Socket/registration.js +166 -0
  28. package/lib/Socket/socket.d.ts +1 -3
  29. package/lib/Socket/socket.js +17 -15
  30. package/lib/Store/make-cache-manager-store.d.ts +1 -2
  31. package/lib/Store/make-in-memory-store.js +11 -13
  32. package/lib/Store/make-ordered-dictionary.js +2 -2
  33. package/lib/Types/Auth.d.ts +6 -1
  34. package/lib/Types/Call.d.ts +1 -1
  35. package/lib/Types/Chat.d.ts +7 -15
  36. package/lib/Types/Contact.d.ts +1 -6
  37. package/lib/Types/Events.d.ts +2 -44
  38. package/lib/Types/GroupMetadata.d.ts +1 -3
  39. package/lib/Types/Label.d.ts +0 -11
  40. package/lib/Types/Message.d.ts +30 -37
  41. package/lib/Types/Newsletter.d.ts +13 -0
  42. package/lib/Types/Newsletter.js +15 -1
  43. package/lib/Types/Socket.d.ts +3 -10
  44. package/lib/Types/index.d.ts +0 -8
  45. package/lib/Utils/auth-utils.js +7 -1
  46. package/lib/Utils/chat-utils.d.ts +4 -5
  47. package/lib/Utils/chat-utils.js +20 -52
  48. package/lib/Utils/crypto.d.ts +1 -2
  49. package/lib/Utils/crypto.js +2 -4
  50. package/lib/Utils/decode-wa-message.d.ts +0 -1
  51. package/lib/Utils/decode-wa-message.js +14 -34
  52. package/lib/Utils/event-buffer.js +8 -14
  53. package/lib/Utils/generics.d.ts +13 -37
  54. package/lib/Utils/generics.js +18 -103
  55. package/lib/Utils/history.d.ts +2 -6
  56. package/lib/Utils/history.js +0 -3
  57. package/lib/Utils/index.d.ts +0 -1
  58. package/lib/Utils/index.js +0 -1
  59. package/lib/Utils/link-preview.js +1 -24
  60. package/lib/Utils/logger.d.ts +3 -1
  61. package/lib/Utils/make-mutex.js +0 -1
  62. package/lib/Utils/messages-media.d.ts +2 -3
  63. package/lib/Utils/messages-media.js +32 -17
  64. package/lib/Utils/messages.d.ts +0 -1
  65. package/lib/Utils/messages.js +72 -67
  66. package/lib/Utils/noise-handler.d.ts +3 -3
  67. package/lib/Utils/noise-handler.js +12 -7
  68. package/lib/Utils/process-message.d.ts +2 -3
  69. package/lib/Utils/process-message.js +21 -55
  70. package/lib/Utils/signal.js +16 -23
  71. package/lib/Utils/use-multi-file-auth-state.js +3 -17
  72. package/lib/Utils/validate-connection.d.ts +1 -0
  73. package/lib/Utils/validate-connection.js +44 -10
  74. package/lib/WABinary/constants.js +5 -5
  75. package/lib/WABinary/decode.d.ts +2 -3
  76. package/lib/WABinary/decode.js +4 -6
  77. package/lib/WABinary/encode.d.ts +2 -1
  78. package/lib/WABinary/encode.js +6 -8
  79. package/lib/WABinary/generic-utils.d.ts +0 -1
  80. package/lib/WABinary/jid-utils.d.ts +3 -3
  81. package/lib/WABinary/jid-utils.js +5 -5
  82. package/lib/WAM/BinaryInfo.d.ts +2 -3
  83. package/lib/WAM/constants.d.ts +2 -3
  84. package/lib/WAM/encode.d.ts +0 -1
  85. package/lib/WAM/encode.js +2 -2
  86. package/lib/index.d.ts +0 -1
  87. package/lib/index.js +0 -1
  88. package/package.json +37 -39
  89. package/lib/Socket/communities.js +0 -354
  90. package/lib/Socket/usync.d.ts +0 -38
  91. package/lib/Socket/usync.js +0 -70
  92. package/lib/Types/USync.d.ts +0 -25
  93. package/lib/Types/USync.js +0 -2
  94. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  95. package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -32
  96. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  97. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -57
  98. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  99. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -30
  100. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  101. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -42
  102. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  103. package/lib/WAUSync/Protocols/index.js +0 -20
  104. package/lib/WAUSync/USyncQuery.d.ts +0 -26
  105. package/lib/WAUSync/USyncQuery.js +0 -79
  106. package/lib/WAUSync/USyncUser.d.ts +0 -10
  107. package/lib/WAUSync/USyncUser.js +0 -22
  108. package/lib/WAUSync/index.d.ts +0 -3
  109. package/lib/WAUSync/index.js +0 -19
  110. /package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +0 -0
  111. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode = void 0;
3
+ exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode = exports.generateMobileNode = void 0;
4
4
  const boom_1 = require("@hapi/boom");
5
5
  const crypto_1 = require("crypto");
6
6
  const WAProto_1 = require("../../WAProto");
@@ -10,19 +10,30 @@ const crypto_2 = require("./crypto");
10
10
  const generics_1 = require("./generics");
11
11
  const signal_1 = require("./signal");
12
12
  const getUserAgent = (config) => {
13
+ var _a, _b;
14
+ const osVersion = config.mobile ? '15.3.1' : '0.1';
15
+ const version = config.mobile ? [2, 24, 6] : config.version;
16
+ const device = config.mobile ? 'iPhone_7' : 'Desktop';
17
+ const manufacturer = config.mobile ? 'Apple' : '';
18
+ const platform = config.mobile ? WAProto_1.proto.ClientPayload.UserAgent.Platform.IOS : WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB;
19
+ const phoneId = config.mobile ? { phoneId: config.auth.creds.phoneId } : {};
13
20
  return {
14
21
  appVersion: {
15
- primary: config.version[0],
16
- secondary: config.version[1],
17
- tertiary: config.version[2],
22
+ primary: version[0],
23
+ secondary: version[1],
24
+ tertiary: version[2],
18
25
  },
19
- platform: WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB,
26
+ platform,
20
27
  releaseChannel: WAProto_1.proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
21
- osVersion: '0.1',
22
- device: 'Desktop',
23
- osBuildNumber: '0.1',
28
+ mcc: ((_a = config.auth.creds.registration) === null || _a === void 0 ? void 0 : _a.phoneNumberMobileCountryCode) || '000',
29
+ mnc: ((_b = config.auth.creds.registration) === null || _b === void 0 ? void 0 : _b.phoneNumberMobileNetworkCode) || '000',
30
+ osVersion: osVersion,
31
+ manufacturer,
32
+ device,
33
+ osBuildNumber: osVersion,
24
34
  localeLanguageIso6391: 'en',
25
- localeCountryIso31661Alpha2: 'US'
35
+ localeCountryIso31661Alpha2: 'US',
36
+ ...phoneId
26
37
  };
27
38
  };
28
39
  const PLATFORM_MAP = {
@@ -42,9 +53,32 @@ const getClientPayload = (config) => {
42
53
  connectReason: WAProto_1.proto.ClientPayload.ConnectReason.USER_ACTIVATED,
43
54
  userAgent: getUserAgent(config),
44
55
  };
45
- payload.webInfo = getWebInfo(config);
56
+ if (!config.mobile) {
57
+ payload.webInfo = getWebInfo(config);
58
+ }
46
59
  return payload;
47
60
  };
61
+ const generateMobileNode = (config) => {
62
+ if (!config.auth.creds) {
63
+ throw new boom_1.Boom('No registration data found', { data: config });
64
+ }
65
+ const payload = {
66
+ ...getClientPayload(config),
67
+ sessionId: Math.floor(Math.random() * 999999999 + 1),
68
+ shortConnect: true,
69
+ connectAttemptCount: 0,
70
+ device: 0,
71
+ dnsSource: {
72
+ appCached: false,
73
+ dnsMethod: WAProto_1.proto.ClientPayload.DNSSource.DNSResolutionMethod.SYSTEM,
74
+ },
75
+ passive: false,
76
+ pushName: 'test',
77
+ username: Number(`${config.auth.creds.registration.phoneNumberCountryCode}${config.auth.creds.registration.phoneNumberNationalNumber}`),
78
+ };
79
+ return WAProto_1.proto.ClientPayload.fromObject(payload);
80
+ };
81
+ exports.generateMobileNode = generateMobileNode;
48
82
  const generateLoginNode = (userJid, config) => {
49
83
  const { user, device } = (0, WABinary_1.jidDecode)(userJid);
50
84
  const payload = {
@@ -30,11 +30,11 @@ exports.SINGLE_BYTE_TOKENS = [
30
30
  '', 'xmlstreamstart', 'xmlstreamend', 's.whatsapp.net', 'type', 'participant', 'from', 'receipt', 'id', 'broadcast', 'status', 'message', 'notification', 'notify', 'to', 'jid', 'user', 'class', 'offline', 'g.us', 'result', 'mediatype', 'enc', 'skmsg', 'off_cnt', 'xmlns', 'presence', 'participants', 'ack', 't', 'iq', 'device_hash', 'read', 'value', 'media', 'picture', 'chatstate', 'unavailable', 'text', 'urn:xmpp:whatsapp:push', 'devices', 'verified_name', 'contact', 'composing', 'edge_routing', 'routing_info', 'item', 'image', 'verified_level', 'get', 'fallback_hostname', '2', 'media_conn', '1', 'v', 'handshake', 'fallback_class', 'count', 'config', 'offline_preview', 'download_buckets', 'w:profile:picture', 'set', 'creation', 'location', 'fallback_ip4', 'msg', 'urn:xmpp:ping', 'fallback_ip6', 'call-creator', 'relaylatency', 'success', 'subscribe', 'video', 'business_hours_config', 'platform', 'hostname', 'version', 'unknown', '0', 'ping', 'hash', 'edit', 'subject', 'max_buckets', 'download', 'delivery', 'props', 'sticker', 'name', 'last', 'contacts', 'business', 'primary', 'preview', 'w:p', 'pkmsg', 'call-id', 'retry', 'prop', 'call', 'auth_ttl', 'available', 'relay_id', 'last_id', 'day_of_week', 'w', 'host', 'seen', 'bits', 'list', 'atn', 'upload', 'is_new', 'w:stats', 'key', 'paused', 'specific_hours', 'multicast', 'stream:error', 'mmg.whatsapp.net', 'code', 'deny', 'played', 'profile', 'fna', 'device-list', 'close_time', 'latency', 'gcm', 'pop', 'audio', '26', 'w:web', 'open_time', 'error', 'auth', 'ip4', 'update', 'profile_options', 'config_value', 'category', 'catalog_not_created', '00', 'config_code', 'mode', 'catalog_status', 'ip6', 'blocklist', 'registration', '7', 'web', 'fail', 'w:m', 'cart_enabled', 'ttl', 'gif', '300', 'device_orientation', 'identity', 'query', '401', 'media-gig2-1.cdn.whatsapp.net', 'in', '3', 'te2', 'add', 'fallback', 'categories', 'ptt', 'encrypt', 'notice', 'thumbnail-document', 'item-not-found', '12', 'thumbnail-image', 'stage', 'thumbnail-link', 'usync', 'out', 'thumbnail-video', '8', '01', 'context', 'sidelist', 'thumbnail-gif', 'terminate', 'not-authorized', 'orientation', 'dhash', 'capability', 'side_list', 'md-app-state', 'description', 'serial', 'readreceipts', 'te', 'business_hours', 'md-msg-hist', 'tag', 'attribute_padding', 'document', 'open_24h', 'delete', 'expiration', 'active', 'prev_v_id', 'true', 'passive', 'index', '4', 'conflict', 'remove', 'w:gp2', 'config_expo_key', 'screen_height', 'replaced', '02', 'screen_width', 'uploadfieldstat', '2:47DEQpj8', 'media-bog1-1.cdn.whatsapp.net', 'encopt', 'url', 'catalog_exists', 'keygen', 'rate', 'offer', 'opus', 'media-mia3-1.cdn.whatsapp.net', 'privacy', 'media-mia3-2.cdn.whatsapp.net', 'signature', 'preaccept', 'token_id', 'media-eze1-1.cdn.whatsapp.net'
31
31
  ];
32
32
  exports.TOKEN_MAP = {};
33
- for (const [i, SINGLE_BYTE_TOKEN] of exports.SINGLE_BYTE_TOKENS.entries()) {
34
- exports.TOKEN_MAP[SINGLE_BYTE_TOKEN] = { index: i };
33
+ for (let i = 0; i < exports.SINGLE_BYTE_TOKENS.length; i++) {
34
+ exports.TOKEN_MAP[exports.SINGLE_BYTE_TOKENS[i]] = { index: i };
35
35
  }
36
- for (const [i, DOUBLE_BYTE_TOKEN] of exports.DOUBLE_BYTE_TOKENS.entries()) {
37
- for (const [j, element] of DOUBLE_BYTE_TOKEN.entries()) {
38
- exports.TOKEN_MAP[element] = { dict: i, index: j };
36
+ for (let i = 0; i < exports.DOUBLE_BYTE_TOKENS.length; i++) {
37
+ for (let j = 0; j < exports.DOUBLE_BYTE_TOKENS[i].length; j++) {
38
+ exports.TOKEN_MAP[exports.DOUBLE_BYTE_TOKENS[i][j]] = { dict: i, index: j };
39
39
  }
40
40
  }
@@ -1,8 +1,7 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import type { BinaryNode, BinaryNodeCodingOptions } from './types';
4
- export declare const decompressingIfRequired: (buffer: Buffer) => Promise<Buffer>;
3
+ export declare const decompressingIfRequired: (buffer: Buffer) => Buffer;
5
4
  export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, 'DOUBLE_BYTE_TOKENS' | 'SINGLE_BYTE_TOKENS' | 'TAGS'>, indexRef?: {
6
5
  index: number;
7
6
  }) => BinaryNode;
8
- export declare const decodeBinaryNode: (buff: Buffer) => Promise<BinaryNode>;
7
+ export declare const decodeBinaryNode: (buff: Buffer) => BinaryNode;
@@ -24,14 +24,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.decodeBinaryNode = exports.decodeDecompressedBinaryNode = exports.decompressingIfRequired = void 0;
27
- const util_1 = require("util");
28
27
  const zlib_1 = require("zlib");
29
28
  const constants = __importStar(require("./constants"));
30
29
  const jid_utils_1 = require("./jid-utils");
31
- const inflatePromise = (0, util_1.promisify)(zlib_1.inflate);
32
- const decompressingIfRequired = async (buffer) => {
30
+ const decompressingIfRequired = (buffer) => {
33
31
  if (2 & buffer.readUInt8()) {
34
- buffer = await inflatePromise(buffer.slice(1));
32
+ buffer = (0, zlib_1.inflateSync)(buffer.slice(1));
35
33
  }
36
34
  else { // nodes with no compression have a 0x00 prefix, we remove that
37
35
  buffer = buffer.slice(1);
@@ -247,8 +245,8 @@ const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0 }) =>
247
245
  };
248
246
  };
249
247
  exports.decodeDecompressedBinaryNode = decodeDecompressedBinaryNode;
250
- const decodeBinaryNode = async (buff) => {
251
- const decompBuff = await (0, exports.decompressingIfRequired)(buff);
248
+ const decodeBinaryNode = (buff) => {
249
+ const decompBuff = (0, exports.decompressingIfRequired)(buff);
252
250
  return (0, exports.decodeDecompressedBinaryNode)(decompBuff, constants);
253
251
  };
254
252
  exports.decodeBinaryNode = decodeBinaryNode;
@@ -1,2 +1,3 @@
1
+ /// <reference types="node" />
1
2
  import type { BinaryNode, BinaryNodeCodingOptions } from './types';
2
- export declare const encodeBinaryNode: ({ tag, attrs, content }: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, 'TAGS' | 'TOKEN_MAP'>, buffer?: number[]) => number[];
3
+ export declare const encodeBinaryNode: ({ tag, attrs, content }: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, 'TAGS' | 'TOKEN_MAP'>, buffer?: number[]) => Buffer;
@@ -35,11 +35,7 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
35
35
  buffer.push((value >> (curShift * 8)) & 0xff);
36
36
  }
37
37
  };
38
- const pushBytes = (bytes) => {
39
- for (const b of bytes) {
40
- buffer.push(b);
41
- }
42
- };
38
+ const pushBytes = (bytes) => (bytes.forEach(b => buffer.push(b)));
43
39
  const pushInt16 = (value) => {
44
40
  pushBytes([(value >> 8) & 0xff, value & 0xff]);
45
41
  };
@@ -141,7 +137,8 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
141
137
  if (str.length > TAGS.PACKED_MAX) {
142
138
  return false;
143
139
  }
144
- for (const char of str) {
140
+ for (let i = 0; i < str.length; i++) {
141
+ const char = str[i];
145
142
  const isInNibbleRange = char >= '0' && char <= '9';
146
143
  if (!isInNibbleRange && char !== '-' && char !== '.') {
147
144
  return false;
@@ -153,7 +150,8 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
153
150
  if (str.length > TAGS.PACKED_MAX) {
154
151
  return false;
155
152
  }
156
- for (const char of str) {
153
+ for (let i = 0; i < str.length; i++) {
154
+ const char = str[i];
157
155
  const isInNibbleRange = char >= '0' && char <= '9';
158
156
  if (!isInNibbleRange && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f')) {
159
157
  return false;
@@ -225,6 +223,6 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
225
223
  else {
226
224
  throw new Error(`invalid children for header "${tag}": ${content} (${typeof content})`);
227
225
  }
228
- return buffer;
226
+ return Buffer.from(buffer);
229
227
  };
230
228
  exports.encodeBinaryNode = encodeBinaryNode;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { proto } from '../../WAProto';
4
3
  import { BinaryNode } from './types';
5
4
  export declare const getBinaryNodeChildren: (node: BinaryNode | undefined, childTag: string) => BinaryNode[];
@@ -9,7 +9,7 @@ export type JidWithDevice = {
9
9
  device?: number;
10
10
  };
11
11
  export type FullJid = JidWithDevice & {
12
- server: JidServer;
12
+ server: JidServer | string;
13
13
  domainType?: number;
14
14
  };
15
15
  export declare const jidEncode: (user: string | number | null, server: JidServer, device?: number, agent?: number) => string;
@@ -26,6 +26,6 @@ export declare const isJidBroadcast: (jid: string | undefined) => boolean | unde
26
26
  export declare const isJidGroup: (jid: string | undefined) => boolean | undefined;
27
27
  /** is the jid the status broadcast */
28
28
  export declare const isJidStatusBroadcast: (jid: string) => boolean;
29
- /** is the jid a newsletter */
30
- export declare const isJidNewsletter: (jid: string | undefined) => boolean | undefined;
29
+ /** is the jid the newsletter */
30
+ export declare const isJidNewsLetter: (jid: string | undefined) => boolean | undefined;
31
31
  export declare const jidNormalizedUser: (jid: string | undefined) => string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jidNormalizedUser = exports.isJidNewsletter = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
3
+ exports.jidNormalizedUser = exports.isJidNewsLetter = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
4
4
  exports.S_WHATSAPP_NET = '@s.whatsapp.net';
5
5
  exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
6
6
  exports.SERVER_JID = 'server@c.us';
@@ -20,7 +20,7 @@ const jidDecode = (jid) => {
20
20
  const [userAgent, device] = userCombined.split(':');
21
21
  const user = userAgent.split('_')[0];
22
22
  return {
23
- server: server,
23
+ server,
24
24
  user,
25
25
  domainType: server === 'lid' ? 1 : 0,
26
26
  device: device ? +device : undefined
@@ -48,9 +48,9 @@ exports.isJidGroup = isJidGroup;
48
48
  /** is the jid the status broadcast */
49
49
  const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
50
50
  exports.isJidStatusBroadcast = isJidStatusBroadcast;
51
- /** is the jid a newsletter */
52
- const isJidNewsletter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@newsletter'));
53
- exports.isJidNewsletter = isJidNewsletter;
51
+ /** is the jid the newsletter */
52
+ const isJidNewsLetter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('newsletter'));
53
+ exports.isJidNewsLetter = isJidNewsLetter;
54
54
  const jidNormalizedUser = (jid) => {
55
55
  const result = (0, exports.jidDecode)(jid);
56
56
  if (!result) {
@@ -1,15 +1,14 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  export declare class BinaryInfo {
4
3
  protocolVersion: number;
5
4
  sequence: number;
6
5
  events: {
7
6
  [x: string]: {
8
7
  props: {
9
- [x: string]: import("./constants").Value;
8
+ [x: string]: any;
10
9
  };
11
10
  globals: {
12
- [x: string]: import("./constants").Value;
11
+ [x: string]: any;
13
12
  };
14
13
  };
15
14
  }[];
@@ -28,12 +28,11 @@ type EventByName<T extends Event['name']> = Extract<Event, {
28
28
  export type EventInputType = {
29
29
  [key in Event['name']]: {
30
30
  props: {
31
- [k in keyof EventByName<key>['props']]: Value;
31
+ [k in keyof EventByName<key>['props']]: any;
32
32
  };
33
33
  globals: {
34
- [x: string]: Value;
34
+ [x: string]: any;
35
35
  };
36
36
  };
37
37
  } & {};
38
- export type Value = number | null | string;
39
38
  export {};
@@ -1,4 +1,3 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="node" />
3
2
  import { BinaryInfo } from './BinaryInfo';
4
3
  export declare const encodeWAM: (binaryInfo: BinaryInfo) => Buffer;
package/lib/WAM/encode.js CHANGED
@@ -13,10 +13,10 @@ const encodeWAM = (binaryInfo) => {
13
13
  .reduce((a, b) => a + b);
14
14
  const buffer = Buffer.alloc(totalSize);
15
15
  let offset = 0;
16
- for (const buffer_ of binaryInfo.buffer) {
16
+ binaryInfo.buffer.forEach((buffer_) => {
17
17
  buffer_.copy(buffer, offset);
18
18
  offset += buffer_.length;
19
- }
19
+ });
20
20
  return buffer;
21
21
  };
22
22
  exports.encodeWAM = encodeWAM;
package/lib/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export * from './Store';
6
6
  export * from './Defaults';
7
7
  export * from './WABinary';
8
8
  export * from './WAM';
9
- export * from './WAUSync';
10
9
  export type WASocket = ReturnType<typeof makeWASocket>;
11
10
  export { makeWASocket };
12
11
  export default makeWASocket;
package/lib/index.js CHANGED
@@ -27,5 +27,4 @@ __exportStar(require("./Store"), exports);
27
27
  __exportStar(require("./Defaults"), exports);
28
28
  __exportStar(require("./WABinary"), exports);
29
29
  __exportStar(require("./WAM"), exports);
30
- __exportStar(require("./WAUSync"), exports);
31
30
  exports.default = Socket_1.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@queenanya/baileys",
3
- "version": "7.4.10",
3
+ "version": "7.4.13",
4
4
  "description": "WhatsApp API",
5
5
  "keywords": [
6
6
  "whatsapp",
@@ -12,9 +12,9 @@
12
12
  "automation",
13
13
  "multi-device"
14
14
  ],
15
- "homepage": "https://github.com/QueenAnya/bail",
15
+ "homepage": "https://github.com/QueenAnya/Bail",
16
16
  "repository": {
17
- "url": "git@github.com:QueenAnya/bail"
17
+ "url": "git@github.com:QueenAnya/Bail.git"
18
18
  },
19
19
  "license": "MIT",
20
20
  "author": "Adhiraj Singh",
@@ -27,51 +27,48 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@adiwajshing/keyed-db": "^0.2.4",
30
- "@queenanya/eslint-config": "github:whiskeysockets/eslint-config",
31
- "@hapi/boom": "^10.0.1",
30
+ "@hapi/boom": "^9.1.3",
32
31
  "async-lock": "^1.4.1",
33
- "audio-decode": "^2.2.0",
34
- "axios": "^1.7.3",
35
- "cache-manager": "^5.7.6",
36
- "futoin-hkdf": "^1.5.3",
37
- "jimp": "^0.22.12",
38
- "json": "^11.0.0",
39
- "libphonenumber-js": "^1.11.4",
40
- "libsignal": "npm:@queenanya/libsignal@latest",
41
- "lodash": "^4.17.21",
32
+ "audio-decode": "^2.1.3",
33
+ "axios": "^1.3.3",
34
+ "cache-manager": "4.0.1",
35
+ "futoin-hkdf": "^1.5.1",
36
+ "libphonenumber-js": "^1.10.20",
37
+ "libsignal": "github:adiwajshing/libsignal-node",
42
38
  "music-metadata": "^7.12.3",
43
39
  "node-cache": "^5.1.2",
44
- "pino": "^9.3.0",
45
- "protobufjs": "^7.3.2",
46
- "release-it": "^17.6.0",
47
- "uuid": "^10.0.0",
48
- "ws": "^8.18.0"
40
+ "pino": "^7.0.0",
41
+ "protobufjs": "^7.2.4",
42
+ "uuid": "^9.0.0",
43
+ "ws": "^8.13.0"
49
44
  },
50
45
  "devDependencies": {
51
- "@types/got": "^9.6.12",
52
- "@types/jest": "^29.5.12",
53
- "@types/node": "^20.14.10",
54
- "@types/sharp": "^0.31.1",
55
- "@types/ws": "^8.5.11",
56
- "conventional-changelog-cli": "^5.0.0",
57
- "eslint": "^9.7.0",
58
- "jest": "^29.7.0",
59
- "json": "^11.0.0",
60
- "link-preview-js": "^3.0.5",
61
- "open": "^10.1.0",
46
+ "@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
47
+ "@types/got": "^9.6.11",
48
+ "@types/jest": "^27.5.1",
49
+ "@types/node": "^16.0.0",
50
+ "@types/sharp": "^0.29.4",
51
+ "@types/ws": "^8.0.0",
52
+ "conventional-changelog-cli": "^2.2.2",
53
+ "eslint": "^8.0.0",
54
+ "jest": "^27.0.6",
55
+ "jimp": "^0.16.1",
56
+ "link-preview-js": "^3.0.0",
57
+ "open": "^8.4.2",
62
58
  "qrcode-terminal": "^0.12.0",
63
- "release-it": "^17.6.0",
64
- "sharp": "^0.33.4",
65
- "ts-jest": "^29.2.2",
66
- "ts-node": "^10.9.2",
59
+ "release-it": "^15.10.3",
60
+ "sharp": "^0.30.5",
61
+ "ts-jest": "^27.0.3",
62
+ "ts-node": "^10.8.1",
67
63
  "typedoc": "^0.24.7",
68
- "typescript": "^4.6.4"
64
+ "typescript": "^4.6.4",
65
+ "json": "^11.0.0"
69
66
  },
70
67
  "peerDependencies": {
71
- "jimp": "^0.22.12",
68
+ "jimp": "^0.16.1",
72
69
  "link-preview-js": "^3.0.0",
73
70
  "qrcode-terminal": "^0.12.0",
74
- "sharp": "^0.32.6"
71
+ "sharp": "^0.32.2"
75
72
  },
76
73
  "peerDependenciesMeta": {
77
74
  "jimp": {
@@ -95,9 +92,10 @@
95
92
  "changelog:preview": "conventional-changelog -p angular -u",
96
93
  "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
97
94
  "example": "node --inspect -r ts-node/register Example/example.ts",
95
+ "example:mobile": "node --inspect -r ts-node/register Example/example.ts --mobile",
98
96
  "gen:protobuf": "sh WAProto/GenerateStatics.sh",
99
- "lint": "eslint src --ext .js,.ts",
100
- "lint:fix": "yarn lint --fix",
97
+ "lint": "eslint src --ext .js,.ts,.jsx,.tsx",
98
+ "lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
101
99
  "release": "release-it",
102
100
  "test": "jest"
103
101
  }