@hbmodsofc/baileys 1.7.8 → 2.2.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/lib/Defaults/baileys-version.json +3 -0
  3. package/lib/Defaults/index.d.ts +8 -12
  4. package/lib/Defaults/index.js +124 -90
  5. package/lib/Defaults/phonenumber-mcc.json +223 -0
  6. package/lib/Signal/Group/group_cipher.d.ts +1 -0
  7. package/lib/Signal/Group/group_cipher.js +39 -28
  8. package/lib/Signal/Group/queue-job.d.ts +1 -0
  9. package/lib/Signal/Group/queue-job.js +57 -0
  10. package/lib/Signal/Group/sender-chain-key.d.ts +1 -1
  11. package/lib/Signal/Group/sender-chain-key.js +2 -9
  12. package/lib/Signal/Group/sender-key-distribution-message.js +3 -3
  13. package/lib/Signal/Group/sender-key-message.js +3 -3
  14. package/lib/Signal/Group/sender-key-state.d.ts +4 -4
  15. package/lib/Signal/Group/sender-key-state.js +16 -47
  16. package/lib/Signal/libsignal.d.ts +3 -7
  17. package/lib/Signal/libsignal.js +39 -224
  18. package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +3 -1
  19. package/lib/Socket/Client/index.d.ts +3 -2
  20. package/lib/Socket/Client/index.js +3 -2
  21. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  22. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  23. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
  24. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +16 -10
  25. package/lib/Socket/business.d.ts +78 -94
  26. package/lib/Socket/business.js +11 -130
  27. package/lib/Socket/chats.d.ts +233 -63
  28. package/lib/Socket/chats.js +184 -234
  29. package/lib/Socket/groups.d.ts +41 -62
  30. package/lib/Socket/groups.js +64 -76
  31. package/lib/Socket/hbmods.d.ts +253 -0
  32. package/lib/Socket/hbmods.js +1 -0
  33. package/lib/Socket/index.d.ts +83 -129
  34. package/lib/Socket/index.js +6 -13
  35. package/lib/Socket/messages-recv.d.ts +48 -59
  36. package/lib/Socket/messages-recv.js +371 -516
  37. package/lib/Socket/messages-send.d.ts +67 -86
  38. package/lib/Socket/messages-send.js +1 -1091
  39. package/lib/Socket/newsletter.d.ts +64 -76
  40. package/lib/Socket/newsletter.js +1 -184
  41. package/lib/Socket/registration.d.ts +267 -0
  42. package/lib/Socket/registration.js +166 -0
  43. package/lib/Socket/socket.d.ts +13 -19
  44. package/lib/Socket/socket.js +1 -805
  45. package/lib/Socket/usync.d.ts +36 -0
  46. package/lib/Socket/usync.js +70 -0
  47. package/lib/Types/Auth.d.ts +10 -4
  48. package/lib/Types/Call.d.ts +1 -1
  49. package/lib/Types/Chat.d.ts +9 -29
  50. package/lib/Types/Chat.js +1 -7
  51. package/lib/Types/Contact.d.ts +1 -5
  52. package/lib/Types/Events.d.ts +14 -55
  53. package/lib/Types/GroupMetadata.d.ts +5 -15
  54. package/lib/Types/Label.d.ts +0 -11
  55. package/lib/Types/Label.js +1 -1
  56. package/lib/Types/LabelAssociation.js +1 -1
  57. package/lib/Types/Message.d.ts +49 -75
  58. package/lib/Types/Message.js +7 -10
  59. package/lib/Types/Newsletter.d.ts +98 -129
  60. package/lib/Types/Newsletter.js +38 -33
  61. package/lib/Types/Product.d.ts +1 -1
  62. package/lib/Types/Signal.d.ts +1 -29
  63. package/lib/Types/Socket.d.ts +22 -48
  64. package/lib/Types/State.d.ts +2 -13
  65. package/lib/Types/State.js +0 -12
  66. package/lib/Types/USync.d.ts +1 -1
  67. package/lib/Types/index.d.ts +3 -10
  68. package/lib/Types/index.js +2 -2
  69. package/lib/Utils/auth-utils.d.ts +3 -3
  70. package/lib/Utils/auth-utils.js +102 -378
  71. package/lib/Utils/baileys-event-stream.js +1 -1
  72. package/lib/Utils/business.d.ts +2 -2
  73. package/lib/Utils/business.js +13 -19
  74. package/lib/Utils/chat-utils.d.ts +22 -21
  75. package/lib/Utils/chat-utils.js +154 -201
  76. package/lib/Utils/crypto.d.ts +19 -18
  77. package/lib/Utils/crypto.js +37 -78
  78. package/lib/Utils/decode-wa-message.d.ts +7 -34
  79. package/lib/Utils/decode-wa-message.js +66 -138
  80. package/lib/Utils/event-buffer.d.ts +8 -6
  81. package/lib/Utils/event-buffer.js +43 -81
  82. package/lib/Utils/generics.d.ts +27 -27
  83. package/lib/Utils/generics.js +133 -128
  84. package/lib/Utils/history.d.ts +5 -9
  85. package/lib/Utils/history.js +23 -17
  86. package/lib/Utils/index.d.ts +0 -2
  87. package/lib/Utils/index.js +0 -2
  88. package/lib/Utils/link-preview.d.ts +4 -4
  89. package/lib/Utils/link-preview.js +12 -40
  90. package/lib/Utils/logger.d.ts +3 -11
  91. package/lib/Utils/lt-hash.d.ts +8 -8
  92. package/lib/Utils/lt-hash.js +24 -23
  93. package/lib/Utils/make-mutex.d.ts +2 -2
  94. package/lib/Utils/make-mutex.js +2 -3
  95. package/lib/Utils/messages-media.d.ts +41 -37
  96. package/lib/Utils/messages-media.js +368 -252
  97. package/lib/Utils/messages.d.ts +15 -13
  98. package/lib/Utils/messages.js +261 -274
  99. package/lib/Utils/noise-handler.d.ts +15 -13
  100. package/lib/Utils/noise-handler.js +26 -20
  101. package/lib/Utils/process-message.d.ts +8 -9
  102. package/lib/Utils/process-message.js +93 -157
  103. package/lib/Utils/signal.d.ts +5 -6
  104. package/lib/Utils/signal.js +29 -37
  105. package/lib/Utils/use-multi-file-auth-state.d.ts +2 -1
  106. package/lib/Utils/use-multi-file-auth-state.js +7 -12
  107. package/lib/Utils/validate-connection.d.ts +6 -5
  108. package/lib/Utils/validate-connection.js +97 -39
  109. package/lib/WABinary/constants.d.ts +27 -24
  110. package/lib/WABinary/constants.js +13 -1276
  111. package/lib/WABinary/decode.d.ts +4 -3
  112. package/lib/WABinary/decode.js +14 -28
  113. package/lib/WABinary/encode.d.ts +2 -1
  114. package/lib/WABinary/encode.js +147 -134
  115. package/lib/WABinary/generic-utils.d.ts +7 -4
  116. package/lib/WABinary/generic-utils.js +125 -40
  117. package/lib/WABinary/jid-utils.d.ts +8 -13
  118. package/lib/WABinary/jid-utils.js +16 -27
  119. package/lib/WAM/BinaryInfo.d.ts +11 -2
  120. package/lib/WAM/constants.d.ts +2 -3
  121. package/lib/WAM/constants.js +2359 -2252
  122. package/lib/WAM/encode.d.ts +2 -1
  123. package/lib/WAM/encode.js +11 -8
  124. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +2 -2
  125. package/lib/WAUSync/Protocols/USyncContactProtocol.js +4 -3
  126. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -2
  127. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +5 -5
  128. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -2
  129. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +5 -5
  130. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -2
  131. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +6 -5
  132. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +2 -2
  133. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -1
  134. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -4
  135. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +3 -11
  136. package/lib/WAUSync/USyncQuery.d.ts +2 -2
  137. package/lib/WAUSync/USyncQuery.js +15 -19
  138. package/lib/WAUSync/USyncUser.d.ts +5 -5
  139. package/lib/WAUSync/index.d.ts +1 -1
  140. package/lib/WAUSync/index.js +1 -1
  141. package/package.json +102 -104
  142. package/WAProto/index.js +0 -37306
  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,108 +1,106 @@
1
1
  {
2
- "name": "@hbmodsofc/baileys",
3
- "version": "1.7.8",
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
- "node-cache": "^5.1.2",
50
- "node-fetch": "^2.6.1",
51
- "pino": "^9.6",
52
- "protobufjs": "^7.2.4",
53
- "ws": "^8.13.0"
54
- },
55
- "devDependencies": {
56
- "@eslint/eslintrc": "^3.3.1",
57
- "@eslint/js": "^9.31.0",
58
- "@types/jest": "^30.0.0",
59
- "@types/node": "^20.9.0",
60
- "@types/ws": "^8.0.0",
61
- "@typescript-eslint/eslint-plugin": "^8",
62
- "@typescript-eslint/parser": "^8",
63
- "@whiskeysockets/eslint-config": "^1.0.0",
64
- "conventional-changelog-cli": "^2.2.2",
65
- "esbuild-register": "^3.6.0",
66
- "eslint": "^9",
67
- "eslint-config-prettier": "^10.1.2",
68
- "eslint-plugin-prettier": "^5.4.0",
69
- "jest": "^30.0.5",
70
- "jimp": "^1.6.0",
71
- "jiti": "^2.4.2",
72
- "json": "^11.0.0",
73
- "link-preview-js": "^3.0.0",
74
- "lru-cache": "^11.1.0",
75
- "open": "^8.4.2",
76
- "pino-pretty": "^13.1.1",
77
- "prettier": "^3.5.3",
78
- "protobufjs-cli": "^1.1.3",
79
- "release-it": "^15.10.3",
80
- "ts-jest": "^29.4.0",
81
- "tsc-esm-fix": "^3.1.2",
82
- "tsx": "^4.20.3",
83
- "typedoc": "^0.27.9",
84
- "typedoc-plugin-markdown": "4.4.2",
85
- "typescript": "^5.8.2"
86
- },
87
- "peerDependencies": {
88
- "audio-decode": "^2.1.3",
89
- "jimp": "^1.6.0",
90
- "link-preview-js": "^3.0.0",
91
- "sharp": "*"
92
- },
93
- "peerDependenciesMeta": {
94
- "audio-decode": {
95
- "optional": true
2
+ "name": "@hbmodsofc/baileys",
3
+ "version": "2.2.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"
96
18
  },
97
- "jimp": {
98
- "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"
99
38
  },
100
- "link-preview-js": {
101
- "optional": true
102
- }
103
- },
104
- "packageManager": "yarn@1.22.22",
105
- "engines": {
106
- "node": ">=20.0.0"
107
- }
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.34.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": "^1.6.0",
84
+ "link-preview-js": "^3.0.0",
85
+ "qrcode-terminal": "^0.12.0",
86
+ "sharp": "^0.34.5"
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"
108
106
  }