@hbmodsofc/baileys 1.5.2 → 1.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/LICENSE +1 -1
  2. package/WAProto/index.js +19671 -152026
  3. package/lib/Defaults/index.d.ts +12 -8
  4. package/lib/Defaults/index.js +90 -124
  5. package/lib/Signal/Group/group_cipher.d.ts +0 -1
  6. package/lib/Signal/Group/group_cipher.js +28 -39
  7. package/lib/Signal/Group/sender-chain-key.d.ts +1 -1
  8. package/lib/Signal/Group/sender-chain-key.js +9 -2
  9. package/lib/Signal/Group/sender-key-distribution-message.js +3 -3
  10. package/lib/Signal/Group/sender-key-message.js +3 -3
  11. package/lib/Signal/Group/sender-key-state.d.ts +4 -4
  12. package/lib/Signal/Group/sender-key-state.js +47 -16
  13. package/lib/Signal/libsignal.d.ts +7 -3
  14. package/lib/Signal/libsignal.js +224 -39
  15. package/lib/Signal/lid-mapping.d.ts +26 -0
  16. package/lib/Signal/lid-mapping.js +146 -0
  17. package/lib/Socket/Client/index.d.ts +2 -3
  18. package/lib/Socket/Client/index.js +2 -3
  19. package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +1 -3
  20. package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
  21. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +10 -16
  22. package/lib/Socket/business.d.ts +94 -78
  23. package/lib/Socket/business.js +130 -11
  24. package/lib/Socket/chats.d.ts +63 -233
  25. package/lib/Socket/chats.js +234 -184
  26. package/lib/Socket/communities.d.ts +232 -0
  27. package/lib/Socket/communities.js +402 -0
  28. package/lib/Socket/groups.d.ts +62 -41
  29. package/lib/Socket/groups.js +76 -64
  30. package/lib/Socket/index.d.ts +129 -83
  31. package/lib/Socket/index.js +13 -6
  32. package/lib/Socket/messages-recv.d.ts +59 -48
  33. package/lib/Socket/messages-recv.js +516 -371
  34. package/lib/Socket/messages-send.d.ts +86 -67
  35. package/lib/Socket/messages-send.js +1091 -1
  36. package/lib/Socket/mex.d.ts +2 -0
  37. package/lib/Socket/mex.js +45 -0
  38. package/lib/Socket/newsletter.d.ts +76 -64
  39. package/lib/Socket/newsletter.js +184 -1
  40. package/lib/Socket/socket.d.ts +19 -13
  41. package/lib/Socket/socket.js +805 -1
  42. package/lib/Types/Auth.d.ts +4 -10
  43. package/lib/Types/Bussines.d.ts +24 -0
  44. package/lib/Types/Bussines.js +2 -0
  45. package/lib/Types/Call.d.ts +1 -1
  46. package/lib/Types/Chat.d.ts +29 -9
  47. package/lib/Types/Chat.js +7 -1
  48. package/lib/Types/Contact.d.ts +5 -1
  49. package/lib/Types/Events.d.ts +55 -14
  50. package/lib/Types/GroupMetadata.d.ts +15 -5
  51. package/lib/Types/Label.d.ts +11 -0
  52. package/lib/Types/Label.js +1 -1
  53. package/lib/Types/LabelAssociation.js +1 -1
  54. package/lib/Types/Message.d.ts +75 -49
  55. package/lib/Types/Message.js +10 -7
  56. package/lib/Types/Newsletter.d.ts +129 -98
  57. package/lib/Types/Newsletter.js +33 -38
  58. package/lib/Types/Product.d.ts +1 -1
  59. package/lib/Types/Signal.d.ts +29 -1
  60. package/lib/Types/Socket.d.ts +48 -22
  61. package/lib/Types/State.d.ts +13 -2
  62. package/lib/Types/State.js +12 -0
  63. package/lib/Types/USync.d.ts +1 -1
  64. package/lib/Types/index.d.ts +10 -3
  65. package/lib/Types/index.js +2 -2
  66. package/lib/Utils/auth-utils.d.ts +3 -3
  67. package/lib/Utils/auth-utils.js +378 -102
  68. package/lib/Utils/baileys-event-stream.js +1 -1
  69. package/lib/Utils/business.d.ts +2 -2
  70. package/lib/Utils/business.js +19 -13
  71. package/lib/Utils/chat-utils.d.ts +21 -22
  72. package/lib/Utils/chat-utils.js +201 -154
  73. package/lib/Utils/crypto.d.ts +18 -19
  74. package/lib/Utils/crypto.js +78 -37
  75. package/lib/Utils/decode-wa-message.d.ts +34 -7
  76. package/lib/Utils/decode-wa-message.js +138 -66
  77. package/lib/Utils/event-buffer.d.ts +6 -8
  78. package/lib/Utils/event-buffer.js +81 -43
  79. package/lib/Utils/generics.d.ts +27 -27
  80. package/lib/Utils/generics.js +128 -133
  81. package/lib/Utils/history.d.ts +9 -5
  82. package/lib/Utils/history.js +17 -23
  83. package/lib/Utils/index.d.ts +2 -0
  84. package/lib/Utils/index.js +2 -0
  85. package/lib/Utils/lidToJid-test.d.ts +11 -0
  86. package/lib/Utils/lidToJid-test.js +27 -0
  87. package/lib/Utils/link-preview.d.ts +4 -4
  88. package/lib/Utils/link-preview.js +40 -12
  89. package/lib/Utils/logger.d.ts +11 -3
  90. package/lib/Utils/lt-hash.d.ts +8 -8
  91. package/lib/Utils/lt-hash.js +23 -24
  92. package/lib/Utils/make-mutex.d.ts +2 -2
  93. package/lib/Utils/make-mutex.js +3 -2
  94. package/lib/Utils/message-retry-manager.d.ts +81 -0
  95. package/lib/Utils/message-retry-manager.js +152 -0
  96. package/lib/Utils/messages-media.d.ts +37 -41
  97. package/lib/Utils/messages-media.js +252 -368
  98. package/lib/Utils/messages.d.ts +13 -15
  99. package/lib/Utils/messages.js +274 -261
  100. package/lib/Utils/noise-handler.d.ts +13 -15
  101. package/lib/Utils/noise-handler.js +20 -26
  102. package/lib/Utils/process-message.d.ts +9 -8
  103. package/lib/Utils/process-message.js +157 -93
  104. package/lib/Utils/signal.d.ts +6 -5
  105. package/lib/Utils/signal.js +37 -29
  106. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -2
  107. package/lib/Utils/use-multi-file-auth-state.js +12 -7
  108. package/lib/Utils/validate-connection.d.ts +5 -6
  109. package/lib/Utils/validate-connection.js +39 -97
  110. package/lib/WABinary/constants.d.ts +24 -27
  111. package/lib/WABinary/constants.js +1276 -13
  112. package/lib/WABinary/decode.d.ts +3 -4
  113. package/lib/WABinary/decode.js +28 -14
  114. package/lib/WABinary/encode.d.ts +1 -2
  115. package/lib/WABinary/encode.js +134 -147
  116. package/lib/WABinary/generic-utils.d.ts +4 -7
  117. package/lib/WABinary/generic-utils.js +40 -125
  118. package/lib/WABinary/jid-utils.d.ts +13 -8
  119. package/lib/WABinary/jid-utils.js +27 -16
  120. package/lib/WAM/BinaryInfo.d.ts +2 -11
  121. package/lib/WAM/constants.d.ts +3 -2
  122. package/lib/WAM/constants.js +2252 -2359
  123. package/lib/WAM/encode.d.ts +1 -2
  124. package/lib/WAM/encode.js +8 -11
  125. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +2 -2
  126. package/lib/WAUSync/Protocols/USyncContactProtocol.js +3 -4
  127. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -2
  128. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +5 -5
  129. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -2
  130. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +5 -5
  131. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -2
  132. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +5 -6
  133. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +2 -2
  134. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -1
  135. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +4 -3
  136. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +11 -3
  137. package/lib/WAUSync/USyncQuery.d.ts +2 -2
  138. package/lib/WAUSync/USyncQuery.js +19 -15
  139. package/lib/WAUSync/USyncUser.d.ts +5 -5
  140. package/lib/WAUSync/index.d.ts +1 -1
  141. package/lib/WAUSync/index.js +1 -1
  142. package/package.json +102 -102
  143. package/lib/Defaults/baileys-version.json +0 -3
  144. package/lib/Defaults/phonenumber-mcc.json +0 -223
  145. package/lib/Signal/Group/queue-job.d.ts +0 -1
  146. package/lib/Signal/Group/queue-job.js +0 -57
  147. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  148. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  149. package/lib/Socket/hbmods.d.ts +0 -253
  150. package/lib/Socket/hbmods.js +0 -1
  151. package/lib/Socket/registration.d.ts +0 -267
  152. package/lib/Socket/registration.js +0 -166
  153. package/lib/Socket/usync.d.ts +0 -36
  154. package/lib/Socket/usync.js +0 -70
  155. /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
@@ -1,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  import { BinaryInfo } from './BinaryInfo';
3
- export declare const encodeWAM: (binaryInfo: BinaryInfo) => Buffer;
2
+ export declare const encodeWAM: (binaryInfo: BinaryInfo) => Buffer<ArrayBuffer>;
package/lib/WAM/encode.js CHANGED
@@ -7,16 +7,13 @@ const encodeWAM = (binaryInfo) => {
7
7
  binaryInfo.buffer = [];
8
8
  encodeWAMHeader(binaryInfo);
9
9
  encodeEvents(binaryInfo);
10
- console.log(binaryInfo.buffer);
11
- const totalSize = binaryInfo.buffer
12
- .map((a) => a.length)
13
- .reduce((a, b) => a + b);
10
+ const totalSize = binaryInfo.buffer.map(a => a.length).reduce((a, b) => a + b);
14
11
  const buffer = Buffer.alloc(totalSize);
15
12
  let offset = 0;
16
- binaryInfo.buffer.forEach((buffer_) => {
13
+ for (const buffer_ of binaryInfo.buffer) {
17
14
  buffer_.copy(buffer, offset);
18
15
  offset += buffer_.length;
19
- });
16
+ }
20
17
  return buffer;
21
18
  };
22
19
  exports.encodeWAM = encodeWAM;
@@ -31,7 +28,7 @@ function encodeWAMHeader(binaryInfo) {
31
28
  }
32
29
  function encodeGlobalAttributes(binaryInfo, globals) {
33
30
  for (const [key, _value] of Object.entries(globals)) {
34
- const id = constants_1.WEB_GLOBALS.find(a => (a === null || a === void 0 ? void 0 : a.name) === key).id;
31
+ const id = constants_1.WEB_GLOBALS.find(a => a?.name === key).id;
35
32
  let value = _value;
36
33
  if (typeof value === 'boolean') {
37
34
  value = value ? 1 : 0;
@@ -40,9 +37,9 @@ function encodeGlobalAttributes(binaryInfo, globals) {
40
37
  }
41
38
  }
42
39
  function encodeEvents(binaryInfo) {
43
- for (const [name, { props, globals },] of binaryInfo.events.map((a) => Object.entries(a)[0])) {
40
+ for (const [name, { props, globals }] of binaryInfo.events.map(a => Object.entries(a)[0])) {
44
41
  encodeGlobalAttributes(binaryInfo, globals);
45
- const event = constants_1.WEB_EVENTS.find((a) => a.name === name);
42
+ const event = constants_1.WEB_EVENTS.find(a => a.name === name);
46
43
  const props_ = Object.entries(props);
47
44
  let extended = false;
48
45
  for (const [, value] of props_) {
@@ -52,8 +49,8 @@ function encodeEvents(binaryInfo) {
52
49
  binaryInfo.buffer.push(serializeData(event.id, -event.weight, eventFlag));
53
50
  for (let i = 0; i < props_.length; i++) {
54
51
  const [key, _value] = props_[i];
55
- const id = (event.props)[key][0];
56
- extended = i < (props_.length - 1);
52
+ const id = event.props[key]?.[0];
53
+ extended = i < props_.length - 1;
57
54
  let value = _value;
58
55
  if (typeof value === 'boolean') {
59
56
  value = value ? 1 : 0;
@@ -1,5 +1,5 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
1
+ import type { USyncQueryProtocol } from '../../Types/USync';
2
+ import { type BinaryNode } from '../../WABinary';
3
3
  import { USyncUser } from '../USyncUser';
4
4
  export declare class USyncContactProtocol implements USyncQueryProtocol {
5
5
  name: string;
@@ -9,7 +9,7 @@ class USyncContactProtocol {
9
9
  getQueryElement() {
10
10
  return {
11
11
  tag: 'contact',
12
- attrs: {},
12
+ attrs: {}
13
13
  };
14
14
  }
15
15
  getUserElement(user) {
@@ -17,14 +17,13 @@ class USyncContactProtocol {
17
17
  return {
18
18
  tag: 'contact',
19
19
  attrs: {},
20
- content: user.phone,
20
+ content: user.phone
21
21
  };
22
22
  }
23
23
  parser(node) {
24
- var _a;
25
24
  if (node.tag === 'contact') {
26
25
  (0, WABinary_1.assertNodeErrorFree)(node);
27
- return ((_a = node === null || node === void 0 ? void 0 : node.attrs) === null || _a === void 0 ? void 0 : _a.type) === 'in';
26
+ return node?.attrs?.type === 'in';
28
27
  }
29
28
  return false;
30
29
  }
@@ -1,5 +1,5 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
1
+ import type { USyncQueryProtocol } from '../../Types/USync';
2
+ import { type BinaryNode } from '../../WABinary';
3
3
  export type KeyIndexData = {
4
4
  timestamp: number;
5
5
  signedKeyIndex?: Uint8Array;
@@ -10,8 +10,8 @@ class USyncDeviceProtocol {
10
10
  return {
11
11
  tag: 'devices',
12
12
  attrs: {
13
- version: '2',
14
- },
13
+ version: '2'
14
+ }
15
15
  };
16
16
  }
17
17
  getUserElement( /* user: USyncUser */) {
@@ -27,7 +27,7 @@ class USyncDeviceProtocol {
27
27
  (0, WABinary_1.assertNodeErrorFree)(node);
28
28
  const deviceListNode = (0, WABinary_1.getBinaryNodeChild)(node, 'device-list');
29
29
  const keyIndexNode = (0, WABinary_1.getBinaryNodeChild)(node, 'key-index-list');
30
- if (Array.isArray(deviceListNode === null || deviceListNode === void 0 ? void 0 : deviceListNode.content)) {
30
+ if (Array.isArray(deviceListNode?.content)) {
31
31
  for (const { tag, attrs } of deviceListNode.content) {
32
32
  const id = +attrs.id;
33
33
  const keyIndex = +attrs['key-index'];
@@ -40,10 +40,10 @@ class USyncDeviceProtocol {
40
40
  }
41
41
  }
42
42
  }
43
- if ((keyIndexNode === null || keyIndexNode === void 0 ? void 0 : keyIndexNode.tag) === 'key-index-list') {
43
+ if (keyIndexNode?.tag === 'key-index-list') {
44
44
  keyIndex = {
45
45
  timestamp: +keyIndexNode.attrs['ts'],
46
- signedKeyIndex: keyIndexNode === null || keyIndexNode === void 0 ? void 0 : keyIndexNode.content,
46
+ signedKeyIndex: keyIndexNode?.content,
47
47
  expectedTimestamp: keyIndexNode.attrs['expected_ts'] ? +keyIndexNode.attrs['expected_ts'] : undefined
48
48
  };
49
49
  }
@@ -1,5 +1,5 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
1
+ import type { USyncQueryProtocol } from '../../Types/USync';
2
+ import { type BinaryNode } from '../../WABinary';
3
3
  export type DisappearingModeData = {
4
4
  duration: number;
5
5
  setAt?: Date;
@@ -9,20 +9,20 @@ class USyncDisappearingModeProtocol {
9
9
  getQueryElement() {
10
10
  return {
11
11
  tag: 'disappearing_mode',
12
- attrs: {},
12
+ attrs: {}
13
13
  };
14
14
  }
15
15
  getUserElement() {
16
16
  return null;
17
17
  }
18
18
  parser(node) {
19
- if (node.tag === 'status') {
19
+ if (node.tag === 'disappearing_mode') {
20
20
  (0, WABinary_1.assertNodeErrorFree)(node);
21
- const duration = +(node === null || node === void 0 ? void 0 : node.attrs.duration);
22
- const setAt = new Date(+((node === null || node === void 0 ? void 0 : node.attrs.t) || 0) * 1000);
21
+ const duration = +node?.attrs.duration;
22
+ const setAt = new Date(+(node?.attrs.t || 0) * 1000);
23
23
  return {
24
24
  duration,
25
- setAt,
25
+ setAt
26
26
  };
27
27
  }
28
28
  }
@@ -1,5 +1,5 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
1
+ import type { USyncQueryProtocol } from '../../Types/USync';
2
+ import { type BinaryNode } from '../../WABinary';
3
3
  export type StatusData = {
4
4
  status?: string | null;
5
5
  setAt?: Date;
@@ -9,20 +9,19 @@ class USyncStatusProtocol {
9
9
  getQueryElement() {
10
10
  return {
11
11
  tag: 'status',
12
- attrs: {},
12
+ attrs: {}
13
13
  };
14
14
  }
15
15
  getUserElement() {
16
16
  return null;
17
17
  }
18
18
  parser(node) {
19
- var _a, _b, _c;
20
19
  if (node.tag === 'status') {
21
20
  (0, WABinary_1.assertNodeErrorFree)(node);
22
- let status = (_b = (_a = node === null || node === void 0 ? void 0 : node.content) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null;
23
- const setAt = new Date(+((node === null || node === void 0 ? void 0 : node.attrs.t) || 0) * 1000);
21
+ let status = node?.content?.toString() ?? null;
22
+ const setAt = new Date(+(node?.attrs.t || 0) * 1000);
24
23
  if (!status) {
25
- if (+((_c = node.attrs) === null || _c === void 0 ? void 0 : _c.code) === 401) {
24
+ if (node.attrs?.code && +node.attrs.code === 401) {
26
25
  status = '';
27
26
  }
28
27
  else {
@@ -34,7 +33,7 @@ class USyncStatusProtocol {
34
33
  }
35
34
  return {
36
35
  status,
37
- setAt,
36
+ setAt
38
37
  };
39
38
  }
40
39
  }
@@ -1,5 +1,5 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
1
+ import type { USyncQueryProtocol } from '../../Types/USync';
2
+ import { type BinaryNode } from '../../WABinary';
3
3
  import { USyncUser } from '../USyncUser';
4
4
  export type BotProfileCommand = {
5
5
  name: string;
@@ -17,7 +17,7 @@ class USyncBotProfileProtocol {
17
17
  return {
18
18
  tag: 'bot',
19
19
  attrs: {},
20
- content: [{ tag: 'profile', attrs: { 'persona_id': user.personaId } }]
20
+ content: [{ tag: 'profile', attrs: { persona_id: user.personaId } }]
21
21
  };
22
22
  }
23
23
  parser(node) {
@@ -1,8 +1,9 @@
1
- import { USyncQueryProtocol } from '../../Types/USync';
2
- import { BinaryNode } from '../../WABinary';
1
+ import type { USyncQueryProtocol } from '../../Types/USync';
2
+ import type { BinaryNode } from '../../WABinary';
3
+ import type { USyncUser } from '../USyncUser';
3
4
  export declare class USyncLIDProtocol implements USyncQueryProtocol {
4
5
  name: string;
5
6
  getQueryElement(): BinaryNode;
6
- getUserElement(): null;
7
+ getUserElement(user: USyncUser): BinaryNode | null;
7
8
  parser(node: BinaryNode): string | null;
8
9
  }
@@ -8,11 +8,19 @@ class USyncLIDProtocol {
8
8
  getQueryElement() {
9
9
  return {
10
10
  tag: 'lid',
11
- attrs: {},
11
+ attrs: {}
12
12
  };
13
13
  }
14
- getUserElement() {
15
- return null;
14
+ getUserElement(user) {
15
+ if (user.lid) {
16
+ return {
17
+ tag: 'lid',
18
+ attrs: { jid: user.lid }
19
+ };
20
+ }
21
+ else {
22
+ return null;
23
+ }
16
24
  }
17
25
  parser(node) {
18
26
  if (node.tag === 'lid') {
@@ -1,5 +1,5 @@
1
- import { USyncQueryProtocol } from '../Types/USync';
2
- import { BinaryNode } from '../WABinary';
1
+ import type { USyncQueryProtocol } from '../Types/USync';
2
+ import { type BinaryNode } from '../WABinary';
3
3
  import { USyncUser } from './USyncUser';
4
4
  export type USyncQueryResultList = {
5
5
  [protocol: string]: unknown;
@@ -28,32 +28,36 @@ class USyncQuery {
28
28
  if (result.attrs.type !== 'result') {
29
29
  return;
30
30
  }
31
- const protocolMap = Object.fromEntries(this.protocols.map((protocol) => {
31
+ const protocolMap = Object.fromEntries(this.protocols.map(protocol => {
32
32
  return [protocol.name, protocol.parser];
33
33
  }));
34
34
  const queryResult = {
35
35
  // TODO: implement errors etc.
36
36
  list: [],
37
- sideList: [],
37
+ sideList: []
38
38
  };
39
39
  const usyncNode = (0, WABinary_1.getBinaryNodeChild)(result, 'usync');
40
40
  //TODO: implement error backoff, refresh etc.
41
41
  //TODO: see if there are any errors in the result node
42
42
  //const resultNode = getBinaryNodeChild(usyncNode, 'result')
43
43
  const listNode = (0, WABinary_1.getBinaryNodeChild)(usyncNode, 'list');
44
- if (Array.isArray(listNode === null || listNode === void 0 ? void 0 : listNode.content) && typeof listNode !== 'undefined') {
45
- queryResult.list = listNode.content.map((node) => {
46
- const id = node === null || node === void 0 ? void 0 : node.attrs.jid;
47
- const data = Array.isArray(node === null || node === void 0 ? void 0 : node.content) ? Object.fromEntries(node.content.map((content) => {
48
- const protocol = content.tag;
49
- const parser = protocolMap[protocol];
50
- if (parser) {
51
- return [protocol, parser(content)];
52
- }
53
- else {
54
- return [protocol, null];
55
- }
56
- }).filter(([, b]) => b !== null)) : {};
44
+ if (Array.isArray(listNode?.content) && typeof listNode !== 'undefined') {
45
+ queryResult.list = listNode.content.map(node => {
46
+ const id = node?.attrs.jid;
47
+ const data = Array.isArray(node?.content)
48
+ ? Object.fromEntries(node.content
49
+ .map(content => {
50
+ const protocol = content.tag;
51
+ const parser = protocolMap[protocol];
52
+ if (parser) {
53
+ return [protocol, parser(content)];
54
+ }
55
+ else {
56
+ return [protocol, null];
57
+ }
58
+ })
59
+ .filter(([, b]) => b !== null))
60
+ : {};
57
61
  return { ...data, id };
58
62
  });
59
63
  }
@@ -1,9 +1,9 @@
1
1
  export declare class USyncUser {
2
- id: string;
3
- lid: string;
4
- phone: string;
5
- type: string;
6
- personaId: string;
2
+ id?: string;
3
+ lid?: string;
4
+ phone?: string;
5
+ type?: string;
6
+ personaId?: string;
7
7
  withId(id: string): this;
8
8
  withLid(lid: string): this;
9
9
  withPhone(phone: string): this;
@@ -1,3 +1,3 @@
1
- export * from './Protocols';
1
+ export * from './Protocols/index';
2
2
  export * from './USyncQuery';
3
3
  export * from './USyncUser';
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Protocols"), exports);
17
+ __exportStar(require("./Protocols/index"), exports);
18
18
  __exportStar(require("./USyncQuery"), exports);
19
19
  __exportStar(require("./USyncUser"), exports);
package/package.json CHANGED
@@ -1,106 +1,106 @@
1
1
  {
2
- "name": "@hbmodsofc/baileys",
3
- "version": "1.5.2",
4
- "description": "HBMods-OFC modified Baileys WhatsApp API for custom bots and personal projects",
5
- "keywords": [
6
- "HBWABot",
7
- "Baileys",
8
- "2025",
9
- "mizo"
10
- ],
11
- "license": "MIT",
12
- "author": "Herbert Suantak",
13
- "type": "commonjs",
14
- "main": "lib/index.js",
15
- "types": "lib/index.d.ts",
16
- "directories": {
17
- "lib": "lib"
2
+ "name": "@hbmodsofc/baileys",
3
+ "version": "1.7.7",
4
+ "description": "HBMods-OFC modified Baileys WhatsApp API for custom bots and personal projects",
5
+ "keywords": [
6
+ "HBWABot",
7
+ "Baileys",
8
+ "2025",
9
+ "mizo"
10
+ ],
11
+ "license": "MIT",
12
+ "author": "Herbert Suantak",
13
+ "type": "commonjs",
14
+ "main": "lib/index.js",
15
+ "types": "lib/index.d.ts",
16
+ "directories": {
17
+ "lib": "lib"
18
+ },
19
+ "files": [
20
+ "lib/*",
21
+ "WAProto/*.js",
22
+ "engine-requirements.js"
23
+ ],
24
+ "scripts": {
25
+ "build:all": "tsc && typedoc",
26
+ "build:docs": "typedoc",
27
+ "build:tsc": "tsc",
28
+ "changelog:last": "conventional-changelog -p angular -r 2",
29
+ "changelog:preview": "conventional-changelog -p angular -u",
30
+ "gen:protobuf": "sh WAProto/GenerateStatics.sh",
31
+ "lint": "eslint src --ext .js,.ts,.jsx,.tsx",
32
+ "lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
33
+ "prepack": "",
34
+ "prepare": "",
35
+ "preinstall": "node ./engine-requirements.js",
36
+ "release": "release-it",
37
+ "test": "jest"
38
+ },
39
+ "dependencies": {
40
+ "@adiwajshing/keyed-db": "^0.2.4",
41
+ "@cacheable/node-cache": "^1.4.0",
42
+ "@hapi/boom": "^9.1.3",
43
+ "async-mutex": "^0.5.0",
44
+ "axios": "^1.6.0",
45
+ "cache-manager": "4.0.1",
46
+ "libsignal": "npm:@shennmine/libsignal-node",
47
+ "lru-cache": "^11.1.0",
48
+ "music-metadata": "^11.7.0",
49
+ "pino": "^9.6",
50
+ "protobufjs": "^7.2.4",
51
+ "ws": "^8.13.0"
52
+ },
53
+ "devDependencies": {
54
+ "@eslint/eslintrc": "^3.3.1",
55
+ "@eslint/js": "^9.31.0",
56
+ "@types/jest": "^30.0.0",
57
+ "@types/node": "^20.9.0",
58
+ "@types/ws": "^8.0.0",
59
+ "@typescript-eslint/eslint-plugin": "^8",
60
+ "@typescript-eslint/parser": "^8",
61
+ "@whiskeysockets/eslint-config": "^1.0.0",
62
+ "conventional-changelog-cli": "^2.2.2",
63
+ "esbuild-register": "^3.6.0",
64
+ "eslint": "^9",
65
+ "eslint-config-prettier": "^10.1.2",
66
+ "eslint-plugin-prettier": "^5.4.0",
67
+ "jest": "^30.0.5",
68
+ "jimp": "^1.6.0",
69
+ "jiti": "^2.4.2",
70
+ "json": "^11.0.0",
71
+ "link-preview-js": "^3.0.0",
72
+ "lru-cache": "^11.1.0",
73
+ "open": "^8.4.2",
74
+ "pino-pretty": "^13.1.1",
75
+ "prettier": "^3.5.3",
76
+ "protobufjs-cli": "^1.1.3",
77
+ "release-it": "^15.10.3",
78
+ "ts-jest": "^29.4.0",
79
+ "tsc-esm-fix": "^3.1.2",
80
+ "tsx": "^4.20.3",
81
+ "typedoc": "^0.27.9",
82
+ "typedoc-plugin-markdown": "4.4.2",
83
+ "typescript": "^5.8.2"
84
+ },
85
+ "peerDependencies": {
86
+ "audio-decode": "^2.1.3",
87
+ "jimp": "^1.6.0",
88
+ "link-preview-js": "^3.0.0",
89
+ "sharp": "*"
90
+ },
91
+ "peerDependenciesMeta": {
92
+ "audio-decode": {
93
+ "optional": true
18
94
  },
19
- "files": [
20
- "lib/*",
21
- "WAProto/*.js",
22
- "engine-requirements.js"
23
- ],
24
- "scripts": {
25
- "build:all": "tsc && typedoc",
26
- "build:docs": "typedoc",
27
- "build:tsc": "tsc",
28
- "changelog:last": "conventional-changelog -p angular -r 2",
29
- "changelog:preview": "conventional-changelog -p angular -u",
30
- "gen:protobuf": "sh WAProto/GenerateStatics.sh",
31
- "lint": "eslint src --ext .js,.ts,.jsx,.tsx",
32
- "lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
33
- "prepack": "",
34
- "prepare": "",
35
- "preinstall": "node ./engine-requirements.js",
36
- "release": "release-it",
37
- "test": "jest"
95
+ "jimp": {
96
+ "optional": true
38
97
  },
39
- "dependencies": {
40
- "@adiwajshing/keyed-db": "^0.2.4",
41
- "@hapi/boom": "^9.1.3",
42
- "@cacheable/node-cache": "^1.4.0",
43
- "async-mutex": "^0.5.0",
44
- "audio-decode": "^2.1.3",
45
- "axios": "^1.3.3",
46
- "cache-manager": "4.0.1",
47
- "chalk": "^4.1.2",
48
- "futoin-hkdf": "^1.5.1",
49
- "libphonenumber-js": "^1.10.20",
50
- "lodash": "^4.17.21",
51
- "libsignal": "npm:@shennmine/libsignal-node",
52
- "music-metadata": "^7.12.3",
53
- "node-cache": "^5.1.2",
54
- "node-fetch": "^2.6.1",
55
- "pino": "^7.0.0",
56
- "protobufjs": "^7.2.4",
57
- "uuid": "^9.0.0",
58
- "ws": "^8.13.0"
59
- },
60
- "devDependencies": {
61
- "@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
62
- "@types/got": "^9.6.11",
63
- "@types/jest": "^27.5.1",
64
- "@types/node": "^16.0.0",
65
- "@types/sharp": "^0.29.4",
66
- "@types/ws": "^8.0.0",
67
- "conventional-changelog-cli": "^2.2.2",
68
- "eslint": "^8.0.0",
69
- "jest": "^27.0.6",
70
- "jimp": "^0.16.1",
71
- "link-preview-js": "^3.0.0",
72
- "open": "^8.4.2",
73
- "qrcode-terminal": "^0.12.0",
74
- "release-it": "^15.10.3",
75
- "sharp": "^0.30.5",
76
- "ts-jest": "^27.0.3",
77
- "ts-node": "^10.8.1",
78
- "typedoc": "^0.24.7",
79
- "typescript": "^4.6.4",
80
- "json": "^11.0.0"
81
- },
82
- "peerDependencies": {
83
- "jimp": "^0.16.1",
84
- "link-preview-js": "^3.0.0",
85
- "qrcode-terminal": "^0.12.0",
86
- "sharp": "^0.32.2"
87
- },
88
- "peerDependenciesMeta": {
89
- "jimp": {
90
- "optional": true
91
- },
92
- "link-preview-js": {
93
- "optional": true
94
- },
95
- "qrcode-terminal": {
96
- "optional": true
97
- },
98
- "sharp": {
99
- "optional": true
100
- }
101
- },
102
- "engines": {
103
- "node": ">=20.0.0"
104
- },
105
- "packageManager": "yarn@1.22.19"
98
+ "link-preview-js": {
99
+ "optional": true
100
+ }
101
+ },
102
+ "packageManager": "yarn@1.22.22",
103
+ "engines": {
104
+ "node": ">=20.0.0"
105
+ }
106
106
  }
@@ -1,3 +0,0 @@
1
- {
2
- "version": [2, 3000, 1026924051]
3
- }