@hbmodsofc/baileys 1.7.7 → 2.0.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 (155) hide show
  1. package/LICENSE +1 -1
  2. package/WAProto/index.js +157084 -24729
  3. package/lib/Defaults/baileys-version.json +3 -0
  4. package/lib/Defaults/index.d.ts +8 -12
  5. package/lib/Defaults/index.js +124 -90
  6. package/lib/Defaults/phonenumber-mcc.json +223 -0
  7. package/lib/Signal/Group/group_cipher.d.ts +1 -0
  8. package/lib/Signal/Group/group_cipher.js +39 -28
  9. package/lib/Signal/Group/queue-job.d.ts +1 -0
  10. package/lib/Signal/Group/queue-job.js +57 -0
  11. package/lib/Signal/Group/sender-chain-key.d.ts +1 -1
  12. package/lib/Signal/Group/sender-chain-key.js +2 -9
  13. package/lib/Signal/Group/sender-key-distribution-message.js +3 -3
  14. package/lib/Signal/Group/sender-key-message.js +3 -3
  15. package/lib/Signal/Group/sender-key-state.d.ts +4 -4
  16. package/lib/Signal/Group/sender-key-state.js +16 -47
  17. package/lib/Signal/libsignal.d.ts +3 -7
  18. package/lib/Signal/libsignal.js +39 -224
  19. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +3 -1
  20. package/lib/Socket/Client/index.d.ts +3 -2
  21. package/lib/Socket/Client/index.js +3 -2
  22. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  23. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  24. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
  25. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +16 -10
  26. package/lib/Socket/business.d.ts +78 -94
  27. package/lib/Socket/business.js +11 -130
  28. package/lib/Socket/chats.d.ts +233 -63
  29. package/lib/Socket/chats.js +184 -234
  30. package/lib/Socket/groups.d.ts +41 -62
  31. package/lib/Socket/groups.js +64 -76
  32. package/lib/Socket/hbmods.d.ts +253 -0
  33. package/lib/Socket/hbmods.js +1 -0
  34. package/lib/Socket/index.d.ts +83 -129
  35. package/lib/Socket/index.js +6 -13
  36. package/lib/Socket/messages-recv.d.ts +48 -59
  37. package/lib/Socket/messages-recv.js +371 -516
  38. package/lib/Socket/messages-send.d.ts +67 -86
  39. package/lib/Socket/messages-send.js +1 -1091
  40. package/lib/Socket/newsletter.d.ts +64 -76
  41. package/lib/Socket/newsletter.js +1 -184
  42. package/lib/Socket/registration.d.ts +267 -0
  43. package/lib/Socket/registration.js +166 -0
  44. package/lib/Socket/socket.d.ts +13 -19
  45. package/lib/Socket/socket.js +1 -805
  46. package/lib/Socket/usync.d.ts +36 -0
  47. package/lib/Socket/usync.js +70 -0
  48. package/lib/Types/Auth.d.ts +10 -4
  49. package/lib/Types/Call.d.ts +1 -1
  50. package/lib/Types/Chat.d.ts +9 -29
  51. package/lib/Types/Chat.js +1 -7
  52. package/lib/Types/Contact.d.ts +1 -5
  53. package/lib/Types/Events.d.ts +14 -55
  54. package/lib/Types/GroupMetadata.d.ts +5 -15
  55. package/lib/Types/Label.d.ts +0 -11
  56. package/lib/Types/Label.js +1 -1
  57. package/lib/Types/LabelAssociation.js +1 -1
  58. package/lib/Types/Message.d.ts +49 -75
  59. package/lib/Types/Message.js +7 -10
  60. package/lib/Types/Newsletter.d.ts +98 -129
  61. package/lib/Types/Newsletter.js +38 -33
  62. package/lib/Types/Product.d.ts +1 -1
  63. package/lib/Types/Signal.d.ts +1 -29
  64. package/lib/Types/Socket.d.ts +22 -48
  65. package/lib/Types/State.d.ts +2 -13
  66. package/lib/Types/State.js +0 -12
  67. package/lib/Types/USync.d.ts +1 -1
  68. package/lib/Types/index.d.ts +3 -10
  69. package/lib/Types/index.js +2 -2
  70. package/lib/Utils/auth-utils.d.ts +3 -3
  71. package/lib/Utils/auth-utils.js +102 -378
  72. package/lib/Utils/baileys-event-stream.js +1 -1
  73. package/lib/Utils/business.d.ts +2 -2
  74. package/lib/Utils/business.js +13 -19
  75. package/lib/Utils/chat-utils.d.ts +22 -21
  76. package/lib/Utils/chat-utils.js +154 -201
  77. package/lib/Utils/crypto.d.ts +19 -18
  78. package/lib/Utils/crypto.js +37 -78
  79. package/lib/Utils/decode-wa-message.d.ts +7 -34
  80. package/lib/Utils/decode-wa-message.js +66 -138
  81. package/lib/Utils/event-buffer.d.ts +8 -6
  82. package/lib/Utils/event-buffer.js +43 -81
  83. package/lib/Utils/generics.d.ts +27 -27
  84. package/lib/Utils/generics.js +133 -128
  85. package/lib/Utils/history.d.ts +5 -9
  86. package/lib/Utils/history.js +23 -17
  87. package/lib/Utils/index.d.ts +0 -2
  88. package/lib/Utils/index.js +0 -2
  89. package/lib/Utils/link-preview.d.ts +4 -4
  90. package/lib/Utils/link-preview.js +12 -40
  91. package/lib/Utils/logger.d.ts +3 -11
  92. package/lib/Utils/lt-hash.d.ts +8 -8
  93. package/lib/Utils/lt-hash.js +24 -23
  94. package/lib/Utils/make-mutex.d.ts +2 -2
  95. package/lib/Utils/make-mutex.js +2 -3
  96. package/lib/Utils/messages-media.d.ts +41 -37
  97. package/lib/Utils/messages-media.js +368 -252
  98. package/lib/Utils/messages.d.ts +15 -13
  99. package/lib/Utils/messages.js +261 -274
  100. package/lib/Utils/noise-handler.d.ts +15 -13
  101. package/lib/Utils/noise-handler.js +26 -20
  102. package/lib/Utils/process-message.d.ts +8 -9
  103. package/lib/Utils/process-message.js +93 -157
  104. package/lib/Utils/signal.d.ts +5 -6
  105. package/lib/Utils/signal.js +29 -37
  106. package/lib/Utils/use-multi-file-auth-state.d.ts +2 -1
  107. package/lib/Utils/use-multi-file-auth-state.js +7 -12
  108. package/lib/Utils/validate-connection.d.ts +6 -5
  109. package/lib/Utils/validate-connection.js +97 -39
  110. package/lib/WABinary/constants.d.ts +27 -24
  111. package/lib/WABinary/constants.js +13 -1276
  112. package/lib/WABinary/decode.d.ts +4 -3
  113. package/lib/WABinary/decode.js +14 -28
  114. package/lib/WABinary/encode.d.ts +2 -1
  115. package/lib/WABinary/encode.js +147 -134
  116. package/lib/WABinary/generic-utils.d.ts +7 -4
  117. package/lib/WABinary/generic-utils.js +125 -40
  118. package/lib/WABinary/jid-utils.d.ts +8 -13
  119. package/lib/WABinary/jid-utils.js +16 -27
  120. package/lib/WAM/BinaryInfo.d.ts +11 -2
  121. package/lib/WAM/constants.d.ts +2 -3
  122. package/lib/WAM/constants.js +2359 -2252
  123. package/lib/WAM/encode.d.ts +2 -1
  124. package/lib/WAM/encode.js +11 -8
  125. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +2 -2
  126. package/lib/WAUSync/Protocols/USyncContactProtocol.js +4 -3
  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 +6 -5
  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 +3 -4
  136. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +3 -11
  137. package/lib/WAUSync/USyncQuery.d.ts +2 -2
  138. package/lib/WAUSync/USyncQuery.js +15 -19
  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/Signal/lid-mapping.d.ts +0 -26
  144. package/lib/Signal/lid-mapping.js +0 -146
  145. package/lib/Socket/communities.d.ts +0 -232
  146. package/lib/Socket/communities.js +0 -402
  147. package/lib/Socket/mex.d.ts +0 -2
  148. package/lib/Socket/mex.js +0 -45
  149. package/lib/Types/Bussines.d.ts +0 -24
  150. package/lib/Types/Bussines.js +0 -2
  151. package/lib/Utils/lidToJid-test.d.ts +0 -11
  152. package/lib/Utils/lidToJid-test.js +0 -27
  153. package/lib/Utils/message-retry-manager.d.ts +0 -81
  154. package/lib/Utils/message-retry-manager.js +0 -152
  155. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -1,2 +1,3 @@
1
+ /// <reference types="node" />
1
2
  import { BinaryInfo } from './BinaryInfo';
2
- export declare const encodeWAM: (binaryInfo: BinaryInfo) => Buffer<ArrayBuffer>;
3
+ export declare const encodeWAM: (binaryInfo: BinaryInfo) => Buffer;
package/lib/WAM/encode.js CHANGED
@@ -7,13 +7,16 @@ const encodeWAM = (binaryInfo) => {
7
7
  binaryInfo.buffer = [];
8
8
  encodeWAMHeader(binaryInfo);
9
9
  encodeEvents(binaryInfo);
10
- const totalSize = binaryInfo.buffer.map(a => a.length).reduce((a, b) => a + b);
10
+ console.log(binaryInfo.buffer);
11
+ const totalSize = binaryInfo.buffer
12
+ .map((a) => a.length)
13
+ .reduce((a, b) => a + b);
11
14
  const buffer = Buffer.alloc(totalSize);
12
15
  let offset = 0;
13
- for (const buffer_ of binaryInfo.buffer) {
16
+ binaryInfo.buffer.forEach((buffer_) => {
14
17
  buffer_.copy(buffer, offset);
15
18
  offset += buffer_.length;
16
- }
19
+ });
17
20
  return buffer;
18
21
  };
19
22
  exports.encodeWAM = encodeWAM;
@@ -28,7 +31,7 @@ function encodeWAMHeader(binaryInfo) {
28
31
  }
29
32
  function encodeGlobalAttributes(binaryInfo, globals) {
30
33
  for (const [key, _value] of Object.entries(globals)) {
31
- const id = constants_1.WEB_GLOBALS.find(a => a?.name === key).id;
34
+ const id = constants_1.WEB_GLOBALS.find(a => (a === null || a === void 0 ? void 0 : a.name) === key).id;
32
35
  let value = _value;
33
36
  if (typeof value === 'boolean') {
34
37
  value = value ? 1 : 0;
@@ -37,9 +40,9 @@ function encodeGlobalAttributes(binaryInfo, globals) {
37
40
  }
38
41
  }
39
42
  function encodeEvents(binaryInfo) {
40
- for (const [name, { props, globals }] of binaryInfo.events.map(a => Object.entries(a)[0])) {
43
+ for (const [name, { props, globals },] of binaryInfo.events.map((a) => Object.entries(a)[0])) {
41
44
  encodeGlobalAttributes(binaryInfo, globals);
42
- const event = constants_1.WEB_EVENTS.find(a => a.name === name);
45
+ const event = constants_1.WEB_EVENTS.find((a) => a.name === name);
43
46
  const props_ = Object.entries(props);
44
47
  let extended = false;
45
48
  for (const [, value] of props_) {
@@ -49,8 +52,8 @@ function encodeEvents(binaryInfo) {
49
52
  binaryInfo.buffer.push(serializeData(event.id, -event.weight, eventFlag));
50
53
  for (let i = 0; i < props_.length; i++) {
51
54
  const [key, _value] = props_[i];
52
- const id = event.props[key]?.[0];
53
- extended = i < props_.length - 1;
55
+ const id = (event.props)[key][0];
56
+ extended = i < (props_.length - 1);
54
57
  let value = _value;
55
58
  if (typeof value === 'boolean') {
56
59
  value = value ? 1 : 0;
@@ -1,5 +1,5 @@
1
- import type { USyncQueryProtocol } from '../../Types/USync';
2
- import { type BinaryNode } from '../../WABinary';
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { 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,13 +17,14 @@ 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;
24
25
  if (node.tag === 'contact') {
25
26
  (0, WABinary_1.assertNodeErrorFree)(node);
26
- return node?.attrs?.type === 'in';
27
+ return ((_a = node === null || node === void 0 ? void 0 : node.attrs) === null || _a === void 0 ? void 0 : _a.type) === 'in';
27
28
  }
28
29
  return false;
29
30
  }
@@ -1,5 +1,5 @@
1
- import type { USyncQueryProtocol } from '../../Types/USync';
2
- import { type BinaryNode } from '../../WABinary';
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { 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?.content)) {
30
+ if (Array.isArray(deviceListNode === null || deviceListNode === void 0 ? void 0 : 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?.tag === 'key-index-list') {
43
+ if ((keyIndexNode === null || keyIndexNode === void 0 ? void 0 : keyIndexNode.tag) === 'key-index-list') {
44
44
  keyIndex = {
45
45
  timestamp: +keyIndexNode.attrs['ts'],
46
- signedKeyIndex: keyIndexNode?.content,
46
+ signedKeyIndex: keyIndexNode === null || keyIndexNode === void 0 ? void 0 : keyIndexNode.content,
47
47
  expectedTimestamp: keyIndexNode.attrs['expected_ts'] ? +keyIndexNode.attrs['expected_ts'] : undefined
48
48
  };
49
49
  }
@@ -1,5 +1,5 @@
1
- import type { USyncQueryProtocol } from '../../Types/USync';
2
- import { type BinaryNode } from '../../WABinary';
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { 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 === 'disappearing_mode') {
19
+ if (node.tag === 'status') {
20
20
  (0, WABinary_1.assertNodeErrorFree)(node);
21
- const duration = +node?.attrs.duration;
22
- const setAt = new Date(+(node?.attrs.t || 0) * 1000);
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);
23
23
  return {
24
24
  duration,
25
- setAt
25
+ setAt,
26
26
  };
27
27
  }
28
28
  }
@@ -1,5 +1,5 @@
1
- import type { USyncQueryProtocol } from '../../Types/USync';
2
- import { type BinaryNode } from '../../WABinary';
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
3
3
  export type StatusData = {
4
4
  status?: string | null;
5
5
  setAt?: Date;
@@ -9,19 +9,20 @@ 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;
19
20
  if (node.tag === 'status') {
20
21
  (0, WABinary_1.assertNodeErrorFree)(node);
21
- let status = node?.content?.toString() ?? null;
22
- const setAt = new Date(+(node?.attrs.t || 0) * 1000);
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);
23
24
  if (!status) {
24
- if (node.attrs?.code && +node.attrs.code === 401) {
25
+ if (+((_c = node.attrs) === null || _c === void 0 ? void 0 : _c.code) === 401) {
25
26
  status = '';
26
27
  }
27
28
  else {
@@ -33,7 +34,7 @@ class USyncStatusProtocol {
33
34
  }
34
35
  return {
35
36
  status,
36
- setAt
37
+ setAt,
37
38
  };
38
39
  }
39
40
  }
@@ -1,5 +1,5 @@
1
- import type { USyncQueryProtocol } from '../../Types/USync';
2
- import { type BinaryNode } from '../../WABinary';
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { 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,9 +1,8 @@
1
- import type { USyncQueryProtocol } from '../../Types/USync';
2
- import type { BinaryNode } from '../../WABinary';
3
- import type { USyncUser } from '../USyncUser';
1
+ import { USyncQueryProtocol } from '../../Types/USync';
2
+ import { BinaryNode } from '../../WABinary';
4
3
  export declare class USyncLIDProtocol implements USyncQueryProtocol {
5
4
  name: string;
6
5
  getQueryElement(): BinaryNode;
7
- getUserElement(user: USyncUser): BinaryNode | null;
6
+ getUserElement(): null;
8
7
  parser(node: BinaryNode): string | null;
9
8
  }
@@ -8,19 +8,11 @@ class USyncLIDProtocol {
8
8
  getQueryElement() {
9
9
  return {
10
10
  tag: 'lid',
11
- attrs: {}
11
+ attrs: {},
12
12
  };
13
13
  }
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
- }
14
+ getUserElement() {
15
+ return null;
24
16
  }
25
17
  parser(node) {
26
18
  if (node.tag === 'lid') {
@@ -1,5 +1,5 @@
1
- import type { USyncQueryProtocol } from '../Types/USync';
2
- import { type BinaryNode } from '../WABinary';
1
+ import { USyncQueryProtocol } from '../Types/USync';
2
+ import { BinaryNode } from '../WABinary';
3
3
  import { USyncUser } from './USyncUser';
4
4
  export type USyncQueryResultList = {
5
5
  [protocol: string]: unknown;
@@ -28,36 +28,32 @@ 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?.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
- : {};
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)) : {};
61
57
  return { ...data, id };
62
58
  });
63
59
  }
@@ -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/index';
1
+ export * from './Protocols';
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/index"), exports);
17
+ __exportStar(require("./Protocols"), 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.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
2
+ "name": "@hbmodsofc/baileys",
3
+ "version": "2.0.0",
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"
94
18
  },
95
- "jimp": {
96
- "optional": true
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"
97
38
  },
98
- "link-preview-js": {
99
- "optional": true
100
- }
101
- },
102
- "packageManager": "yarn@1.22.22",
103
- "engines": {
104
- "node": ">=20.0.0"
105
- }
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": "^8.14.1",
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": "^1.6.0",
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.32.2",
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": "^1.6.0",
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"
106
106
  }
@@ -1,26 +0,0 @@
1
- import type { SignalKeyStoreWithTransaction } from '../Types';
2
- export declare class LIDMappingStore {
3
- private readonly mappingCache;
4
- private readonly keys;
5
- private onWhatsAppFunc?;
6
- constructor(keys: SignalKeyStoreWithTransaction, onWhatsAppFunc?: (...jids: string[]) => Promise<{
7
- jid: string;
8
- exists: boolean;
9
- lid: string;
10
- }[] | undefined>);
11
- /**
12
- * Store LID-PN mapping - USER LEVEL
13
- */
14
- storeLIDPNMappings(pairs: {
15
- lid: string;
16
- pn: string;
17
- }[]): Promise<void>;
18
- /**
19
- * Get LID for PN - Returns device-specific LID based on user mapping
20
- */
21
- getLIDForPN(pn: string): Promise<string | null>;
22
- /**
23
- * Get PN for LID - USER LEVEL with device construction
24
- */
25
- getPNForLID(lid: string): Promise<string | null>;
26
- }