@hansaka02/baileys 7.3.2 → 7.3.4

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 (202) hide show
  1. package/README.md +247 -203
  2. package/lib/Defaults/connection.js +51 -0
  3. package/lib/Defaults/constants.js +62 -0
  4. package/lib/Defaults/history.js +17 -0
  5. package/lib/Defaults/index.js +36 -142
  6. package/lib/Defaults/media.js +48 -0
  7. package/lib/Defaults/prefix.js +18 -0
  8. package/lib/Signal/Group/group-session-builder.js +10 -42
  9. package/lib/Signal/Group/group_cipher.js +9 -6
  10. package/lib/Signal/Group/index.js +39 -53
  11. package/lib/Signal/Group/keyhelper.js +8 -41
  12. package/lib/Signal/Group/sender-chain-key.js +4 -4
  13. package/lib/Signal/Group/sender-key-distribution-message.js +5 -5
  14. package/lib/Signal/Group/sender-key-message.js +12 -8
  15. package/lib/Signal/Group/sender-key-record.js +7 -7
  16. package/lib/Signal/Group/sender-key-state.js +4 -4
  17. package/lib/Signal/Group/sender-message-key.js +2 -2
  18. package/lib/Signal/libsignal.js +45 -69
  19. package/lib/Signal/lid-mapping.js +15 -11
  20. package/lib/Socket/Client/types.js +2 -2
  21. package/lib/Socket/Client/websocket.js +16 -14
  22. package/lib/Socket/business.js +41 -32
  23. package/lib/Socket/chats.js +123 -98
  24. package/lib/Socket/community.js +50 -40
  25. package/lib/Socket/groups.js +59 -47
  26. package/lib/Socket/index.js +4 -4
  27. package/lib/Socket/messages-recv.js +219 -172
  28. package/lib/Socket/messages-send.js +187 -143
  29. package/lib/Socket/newsletter.js +61 -47
  30. package/lib/Socket/socket.js +133 -90
  31. package/lib/Socket/usync.js +6 -6
  32. package/lib/Store/index.js +27 -11
  33. package/lib/Store/make-cache-manager-store.js +14 -15
  34. package/lib/Store/make-in-memory-store.js +28 -24
  35. package/lib/Types/LabelAssociation.js +2 -2
  36. package/lib/Types/Message.js +6 -6
  37. package/lib/Types/MexUpdates.js +5 -5
  38. package/lib/Types/State.js +4 -4
  39. package/lib/Types/index.js +28 -12
  40. package/lib/Utils/auth-utils.js +28 -26
  41. package/lib/Utils/baileys-event-stream.js +68 -69
  42. package/lib/Utils/business.js +63 -53
  43. package/lib/Utils/chat-utils.js +81 -71
  44. package/lib/Utils/crypto.js +25 -45
  45. package/lib/Utils/decode-wa-message.js +319 -311
  46. package/lib/Utils/event-buffer.js +21 -22
  47. package/lib/Utils/generics.js +65 -82
  48. package/lib/Utils/history.js +21 -21
  49. package/lib/Utils/index.js +27 -13
  50. package/lib/Utils/link-preview.js +7 -30
  51. package/lib/Utils/logger.js +5 -5
  52. package/lib/Utils/lt-hash.js +3 -3
  53. package/lib/Utils/message-retry-manager.js +4 -4
  54. package/lib/Utils/messages-media.js +104 -109
  55. package/lib/Utils/messages.js +203 -171
  56. package/lib/Utils/noise-handler.js +28 -19
  57. package/lib/Utils/process-message.js +111 -96
  58. package/lib/Utils/signal.js +36 -25
  59. package/lib/Utils/use-multi-file-auth-state.js +18 -22
  60. package/lib/Utils/validate-connection.js +52 -45
  61. package/lib/WABinary/decode.js +6 -32
  62. package/lib/WABinary/encode.js +3 -29
  63. package/lib/WABinary/generic-utils.js +4 -4
  64. package/lib/WABinary/index.js +27 -11
  65. package/lib/WAM/encode.js +16 -8
  66. package/lib/WAM/index.js +27 -11
  67. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +20 -16
  68. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
  69. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +7 -4
  70. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -2
  71. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -2
  72. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -2
  73. package/lib/WAUSync/Protocols/index.js +27 -11
  74. package/lib/WAUSync/USyncQuery.js +17 -10
  75. package/lib/WAUSync/index.js +27 -11
  76. package/lib/index.js +60 -31
  77. package/package.json +8 -14
  78. package/WAProto/AICommon/AICommon.d.ts +0 -11702
  79. package/WAProto/Adv/Adv.d.ts +0 -643
  80. package/WAProto/BotMetadata/BotMetadata.d.ts +0 -5654
  81. package/WAProto/Cert/Cert.d.ts +0 -613
  82. package/WAProto/ChatLockSettings/ChatLockSettings.d.ts +0 -476
  83. package/WAProto/CompanionReg/CompanionReg.d.ts +0 -1361
  84. package/WAProto/DeviceCapabilities/DeviceCapabilities.d.ts +0 -577
  85. package/WAProto/E2E/E2E.d.ts +0 -41724
  86. package/WAProto/Ephemeral/Ephemeral.d.ts +0 -114
  87. package/WAProto/HistorySync/HistorySync.d.ts +0 -51700
  88. package/WAProto/LidMigrationSyncPayload/LidMigrationSyncPayload.d.ts +0 -229
  89. package/WAProto/MdStorageChatRowOpaqueData/MdStorageChatRowOpaqueData.d.ts +0 -583
  90. package/WAProto/MdStorageMsgRowOpaqueData/MdStorageMsgRowOpaqueData.d.ts +0 -42897
  91. package/WAProto/MmsRetry/MmsRetry.d.ts +0 -243
  92. package/WAProto/Protocol/Protocol.d.ts +0 -270
  93. package/WAProto/Reporting/Reporting.d.ts +0 -371
  94. package/WAProto/ServerSync/ServerSync.d.ts +0 -1285
  95. package/WAProto/SignalLocalStorageProtocol/SignalLocalStorageProtocol.d.ts +0 -1868
  96. package/WAProto/SignalWhisperTextProtocol/SignalWhisperTextProtocol.d.ts +0 -767
  97. package/WAProto/StatusAttributions/StatusAttributions.d.ts +0 -1027
  98. package/WAProto/SyncAction/SyncAction.d.ts +0 -11193
  99. package/WAProto/UserPassword/UserPassword.d.ts +0 -363
  100. package/WAProto/VnameCert/VnameCert.d.ts +0 -821
  101. package/WAProto/Wa6/Wa6.d.ts +0 -2128
  102. package/WAProto/Web/Web.d.ts +0 -46383
  103. package/WAProto/index.d.ts +0 -55
  104. package/lib/Defaults/index.d.ts +0 -77
  105. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  106. package/lib/Signal/Group/group-session-builder.d.ts +0 -17
  107. package/lib/Signal/Group/group_cipher.d.ts +0 -19
  108. package/lib/Signal/Group/index.d.ts +0 -11
  109. package/lib/Signal/Group/keyhelper.d.ts +0 -16
  110. package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
  111. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
  112. package/lib/Signal/Group/sender-key-message.d.ts +0 -19
  113. package/lib/Signal/Group/sender-key-name.d.ts +0 -19
  114. package/lib/Signal/Group/sender-key-record.d.ts +0 -32
  115. package/lib/Signal/Group/sender-key-state.d.ts +0 -44
  116. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  117. package/lib/Signal/libsignal.d.ts +0 -8
  118. package/lib/Signal/lid-mapping.d.ts +0 -28
  119. package/lib/Socket/Client/index.d.ts +0 -2
  120. package/lib/Socket/Client/types.d.ts +0 -16
  121. package/lib/Socket/Client/websocket.d.ts +0 -13
  122. package/lib/Socket/business.d.ts +0 -187
  123. package/lib/Socket/chats.d.ts +0 -97
  124. package/lib/Socket/community.d.ts +0 -129
  125. package/lib/Socket/groups.d.ts +0 -129
  126. package/lib/Socket/index.d.ts +0 -191
  127. package/lib/Socket/messages-recv.d.ts +0 -174
  128. package/lib/Socket/messages-send.d.ts +0 -165
  129. package/lib/Socket/newsletter.d.ts +0 -145
  130. package/lib/Socket/socket.d.ts +0 -45
  131. package/lib/Socket/usync.d.ts +0 -37
  132. package/lib/Store/index.d.ts +0 -4
  133. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  134. package/lib/Store/make-in-memory-store.d.ts +0 -123
  135. package/lib/Store/make-ordered-dictionary.d.ts +0 -12
  136. package/lib/Store/object-repository.d.ts +0 -10
  137. package/lib/Types/Auth.d.ts +0 -121
  138. package/lib/Types/Bussiness.d.ts +0 -28
  139. package/lib/Types/Call.d.ts +0 -14
  140. package/lib/Types/Chat.d.ts +0 -143
  141. package/lib/Types/Contact.d.ts +0 -23
  142. package/lib/Types/Events.d.ts +0 -226
  143. package/lib/Types/GroupMetadata.d.ts +0 -66
  144. package/lib/Types/Label.d.ts +0 -48
  145. package/lib/Types/LabelAssociation.d.ts +0 -35
  146. package/lib/Types/Message.d.ts +0 -484
  147. package/lib/Types/MexUpdates.d.ts +0 -9
  148. package/lib/Types/Newsletter.d.ts +0 -109
  149. package/lib/Types/Product.d.ts +0 -92
  150. package/lib/Types/Signal.d.ts +0 -98
  151. package/lib/Types/Socket.d.ts +0 -141
  152. package/lib/Types/State.d.ts +0 -41
  153. package/lib/Types/USync.d.ts +0 -26
  154. package/lib/Types/index.d.ts +0 -80
  155. package/lib/Utils/auth-utils.d.ts +0 -21
  156. package/lib/Utils/baileys-event-stream.d.ts +0 -18
  157. package/lib/Utils/business.d.ts +0 -29
  158. package/lib/Utils/chat-utils.d.ts +0 -82
  159. package/lib/Utils/crypto.d.ts +0 -56
  160. package/lib/Utils/decode-wa-message.d.ts +0 -53
  161. package/lib/Utils/event-buffer.d.ts +0 -39
  162. package/lib/Utils/generics.d.ts +0 -117
  163. package/lib/Utils/history.d.ts +0 -23
  164. package/lib/Utils/index.d.ts +0 -20
  165. package/lib/Utils/link-preview.d.ts +0 -23
  166. package/lib/Utils/logger.d.ts +0 -13
  167. package/lib/Utils/lt-hash.d.ts +0 -14
  168. package/lib/Utils/make-mutex.d.ts +0 -9
  169. package/lib/Utils/message-retry-manager.d.ts +0 -88
  170. package/lib/Utils/messages-media.d.ts +0 -135
  171. package/lib/Utils/messages.d.ts +0 -105
  172. package/lib/Utils/noise-handler.d.ts +0 -20
  173. package/lib/Utils/process-message.d.ts +0 -49
  174. package/lib/Utils/signal.d.ts +0 -42
  175. package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
  176. package/lib/Utils/use-mongo-file-auth-state.js +0 -84
  177. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  178. package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
  179. package/lib/Utils/use-single-file-auth-state.js +0 -80
  180. package/lib/Utils/validate-connection.d.ts +0 -13
  181. package/lib/WABinary/constants.d.ts +0 -30
  182. package/lib/WABinary/decode.d.ts +0 -9
  183. package/lib/WABinary/encode.d.ts +0 -3
  184. package/lib/WABinary/generic-utils.d.ts +0 -28
  185. package/lib/WABinary/index.d.ts +0 -5
  186. package/lib/WABinary/jid-utils.d.ts +0 -58
  187. package/lib/WABinary/types.d.ts +0 -22
  188. package/lib/WAM/BinaryInfo.d.ts +0 -16
  189. package/lib/WAM/constants.d.ts +0 -47
  190. package/lib/WAM/encode.d.ts +0 -3
  191. package/lib/WAM/index.d.ts +0 -3
  192. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
  193. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
  194. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -26
  195. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -14
  196. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -10
  197. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -14
  198. package/lib/WAUSync/Protocols/index.d.ts +0 -6
  199. package/lib/WAUSync/USyncQuery.d.ts +0 -31
  200. package/lib/WAUSync/USyncUser.d.ts +0 -12
  201. package/lib/WAUSync/index.d.ts +0 -3
  202. package/lib/index.d.ts +0 -13
package/lib/WAM/encode.js CHANGED
@@ -2,7 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
4
 
5
- const constants_1 = require("./constants")
5
+ const {
6
+ FLAG_BYTE,
7
+ FLAG_EVENT,
8
+ FLAG_EXTENDED,
9
+ FLAG_FIELD,
10
+ FLAG_GLOBAL,
11
+ WEB_EVENTS,
12
+ WEB_GLOBALS
13
+ } = require("./constants")
6
14
  const getHeaderBitLength = (key) => (key < 256 ? 2 : 3)
7
15
 
8
16
  const encodeWAM = (binaryInfo) => {
@@ -33,25 +41,25 @@ function encodeWAMHeader(binaryInfo) {
33
41
 
34
42
  function encodeGlobalAttributes(binaryInfo, globals) {
35
43
  for (const [key, _value] of Object.entries(globals)) {
36
- const id = constants_1.WEB_GLOBALS.find(a => a?.name === key)?.id
44
+ const id = WEB_GLOBALS.find(a => a?.name === key)?.id
37
45
  let value = _value
38
46
  if (typeof value === 'boolean') {
39
47
  value = value ? 1 : 0
40
48
  }
41
- binaryInfo.buffer.push(serializeData(id, value, constants_1.FLAG_GLOBAL))
49
+ binaryInfo.buffer.push(serializeData(id, value, FLAG_GLOBAL))
42
50
  }
43
51
  }
44
52
 
45
53
  function encodeEvents(binaryInfo) {
46
54
  for (const [name, { props, globals },] of binaryInfo.events.map((a) => Object.entries(a)[0])) {
47
55
  encodeGlobalAttributes(binaryInfo, globals)
48
- const event = constants_1.WEB_EVENTS.find((a) => a.name === name)
56
+ const event = WEB_EVENTS.find((a) => a.name === name)
49
57
  const props_ = Object.entries(props)
50
58
  let extended = false
51
59
  for (const [, value] of props_) {
52
60
  extended || (extended = value !== null)
53
61
  }
54
- const eventFlag = extended ? constants_1.FLAG_EVENT : constants_1.FLAG_EVENT | constants_1.FLAG_EXTENDED
62
+ const eventFlag = extended ? FLAG_EVENT : FLAG_EVENT | FLAG_EXTENDED
55
63
  binaryInfo.buffer.push(serializeData(event.id, -event.weight, eventFlag))
56
64
  for (let i = 0; i < props_.length; i++) {
57
65
  const [key, _value] = props_[i]
@@ -61,7 +69,7 @@ function encodeEvents(binaryInfo) {
61
69
  if (typeof value === 'boolean') {
62
70
  value = value ? 1 : 0
63
71
  }
64
- const fieldFlag = extended ? constants_1.FLAG_EVENT : constants_1.FLAG_FIELD | constants_1.FLAG_EXTENDED
72
+ const fieldFlag = extended ? FLAG_EVENT : FLAG_FIELD | FLAG_EXTENDED
65
73
  binaryInfo.buffer.push(serializeData(id, value, fieldFlag))
66
74
  }
67
75
  }
@@ -72,7 +80,7 @@ function serializeData(key, value, flag) {
72
80
  let buffer
73
81
  let offset = 0
74
82
  if (value === null) {
75
- if (flag === constants_1.FLAG_GLOBAL) {
83
+ if (flag === FLAG_GLOBAL) {
76
84
  buffer = Buffer.alloc(bufferLength)
77
85
  offset = serializeHeader(buffer, offset, key, flag)
78
86
  return buffer
@@ -151,7 +159,7 @@ function serializeHeader(buffer, offset, key, flag) {
151
159
  offset += 1
152
160
  }
153
161
  else {
154
- buffer.writeUInt8(flag | constants_1.FLAG_BYTE, offset)
162
+ buffer.writeUInt8(flag | FLAG_BYTE, offset)
155
163
  offset += 1
156
164
  buffer.writeUInt16LE(key, offset)
157
165
  offset += 2
package/lib/WAM/index.js CHANGED
@@ -1,22 +1,38 @@
1
1
  "use strict"
2
2
 
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ const __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k
5
- var desc = Object.getOwnPropertyDescriptor(m, k)
5
+
6
+ let desc = Object.getOwnPropertyDescriptor(m, k)
7
+
6
8
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k] } }
9
+ desc = {
10
+ enumerable: true,
11
+ get: function() {
12
+ return m[k]
13
+ }
14
+ }
8
15
  }
9
- Object.defineProperty(o, k2, desc)
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k
12
- o[k2] = m[k]
13
- }))
14
16
 
15
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
17
+ Object.defineProperty(o, k2, desc)
18
+
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k
21
+ o[k2] = m[k]
22
+ }
23
+ ))
24
+
25
+ const __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) {
27
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
28
+ __createBinding(exports, m, p)
29
+ }
30
+ }
17
31
  }
18
32
 
19
- Object.defineProperty(exports, "__esModule", { value: true })
33
+ Object.defineProperty(exports, "__esModule", {
34
+ value: true
35
+ })
20
36
 
21
37
  __exportStar(require("./constants"), exports)
22
38
  __exportStar(require("./encode"), exports)
@@ -2,7 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
4
 
5
- const WABinary_1 = require("../../WABinary")
5
+ const {
6
+ getBinaryNodeChild,
7
+ getBinaryNodeChildren,
8
+ getBinaryNodeChildString
9
+ } = require("../../WABinary")
6
10
 
7
11
  class USyncBotProfileProtocol {
8
12
  constructor() {
@@ -23,41 +27,41 @@ class USyncBotProfileProtocol {
23
27
  }
24
28
  }
25
29
  parser(node) {
26
- const botNode = WABinary_1.getBinaryNodeChild(node, 'bot')
27
- const profile = WABinary_1.getBinaryNodeChild(botNode, 'profile')
30
+ const botNode = getBinaryNodeChild(node, 'bot')
31
+ const profile = getBinaryNodeChild(botNode, 'profile')
28
32
 
29
- const commandsNode = WABinary_1.getBinaryNodeChild(profile, 'commands')
30
- const promptsNode = WABinary_1.getBinaryNodeChild(profile, 'prompts')
33
+ const commandsNode = getBinaryNodeChild(profile, 'commands')
34
+ const promptsNode = getBinaryNodeChild(profile, 'prompts')
31
35
 
32
36
  const commands = []
33
37
  const prompts = []
34
38
 
35
39
  if (commandsNode) {
36
- for (const command of WABinary_1.getBinaryNodeChildren(commandsNode, 'command')) {
40
+ for (const command of getBinaryNodeChildren(commandsNode, 'command')) {
37
41
  commands.push({
38
- name: WABinary_1.getBinaryNodeChildString(command, 'name') || '',
39
- description: WABinary_1.getBinaryNodeChildString(command, 'description') || ''
42
+ name: getBinaryNodeChildString(command, 'name') || '',
43
+ description: getBinaryNodeChildString(command, 'description') || ''
40
44
  })
41
45
  }
42
46
  }
43
47
 
44
48
  if (promptsNode) {
45
- for (const prompt of WABinary_1.getBinaryNodeChildren(promptsNode, 'prompt')) {
49
+ for (const prompt of getBinaryNodeChildren(promptsNode, 'prompt')) {
46
50
  prompts.push(
47
- `${WABinary_1.getBinaryNodeChildString(prompt, 'emoji') || ''} ${WABinary_1.getBinaryNodeChildString(prompt, 'text') || ''}`
51
+ `${getBinaryNodeChildString(prompt, 'emoji') || ''} ${getBinaryNodeChildString(prompt, 'text') || ''}`
48
52
  )
49
53
  }
50
54
  }
51
55
 
52
56
  return {
53
- isDefault: !!WABinary_1.getBinaryNodeChild(profile, 'default'),
57
+ isDefault: !!getBinaryNodeChild(profile, 'default'),
54
58
  jid: node.attrs.jid,
55
- name: WABinary_1.getBinaryNodeChildString(profile, 'name') || '',
56
- attributes: WABinary_1.getBinaryNodeChildString(profile, 'attributes') || '',
57
- description: WABinary_1.getBinaryNodeChildString(profile, 'description') || '',
58
- category: WABinary_1.getBinaryNodeChildString(profile, 'category') || '',
59
+ name: getBinaryNodeChildString(profile, 'name') || '',
60
+ attributes: getBinaryNodeChildString(profile, 'attributes') || '',
61
+ description: getBinaryNodeChildString(profile, 'description') || '',
62
+ category: getBinaryNodeChildString(profile, 'category') || '',
59
63
  personaId: profile.attrs['persona_id'] || '',
60
- commandsDescription: WABinary_1.getBinaryNodeChildString(commandsNode, 'description') || '',
64
+ commandsDescription: getBinaryNodeChildString(commandsNode, 'description') || '',
61
65
  commands,
62
66
  prompts
63
67
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
4
 
5
- const WABinary_1 = require("../../WABinary")
5
+ const { assertNodeErrorFree } = require("../../WABinary")
6
6
 
7
7
  class USyncContactProtocol {
8
8
  constructor() {
@@ -24,7 +24,7 @@ class USyncContactProtocol {
24
24
  }
25
25
  parser(node) {
26
26
  if (node.tag === 'contact') {
27
- WABinary_1.assertNodeErrorFree(node)
27
+ assertNodeErrorFree(node)
28
28
  return node?.attrs?.type === 'in'
29
29
  }
30
30
  return false
@@ -2,7 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
4
 
5
- const WABinary_1 = require("../../WABinary")
5
+ const {
6
+ getBinaryNodeChild,
7
+ assertNodeErrorFree
8
+ } = require("../../WABinary")
6
9
 
7
10
  class USyncDeviceProtocol {
8
11
  constructor() {
@@ -26,9 +29,9 @@ class USyncDeviceProtocol {
26
29
  const deviceList = []
27
30
  let keyIndex = undefined
28
31
  if (node.tag === 'devices') {
29
- WABinary_1.assertNodeErrorFree(node)
30
- const deviceListNode = WABinary_1.getBinaryNodeChild(node, 'device-list')
31
- const keyIndexNode = WABinary_1.getBinaryNodeChild(node, 'key-index-list')
32
+ assertNodeErrorFree(node)
33
+ const deviceListNode = getBinaryNodeChild(node, 'device-list')
34
+ const keyIndexNode = getBinaryNodeChild(node, 'key-index-list')
32
35
  if (Array.isArray(deviceListNode?.content)) {
33
36
  for (const { tag, attrs } of deviceListNode.content) {
34
37
  const id = +attrs.id
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
4
 
5
- const WABinary_1 = require("../../WABinary")
5
+ const { assertNodeErrorFree } = require("../../WABinary")
6
6
 
7
7
  class USyncDisappearingModeProtocol {
8
8
  constructor() {
@@ -19,7 +19,7 @@ class USyncDisappearingModeProtocol {
19
19
  }
20
20
  parser(node) {
21
21
  if (node.tag === 'disappearing_mode') {
22
- WABinary_1.assertNodeErrorFree(node)
22
+ assertNodeErrorFree(node)
23
23
  const duration = +node?.attrs?.duration
24
24
  const setAt = new Date(+(node?.attrs?.t || 0) * 1000)
25
25
  return {
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
4
 
5
- const WABinary_1 = require("../../WABinary")
6
-
7
5
  class USyncLIDProtocol {
8
6
  constructor() {
9
7
  this.name = 'lid'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
4
 
5
- const WABinary_1 = require("../../WABinary")
5
+ const { assertNodeErrorFree } = require("../../WABinary")
6
6
 
7
7
  class USyncStatusProtocol {
8
8
  constructor() {
@@ -19,7 +19,7 @@ class USyncStatusProtocol {
19
19
  }
20
20
  parser(node) {
21
21
  if (node.tag === 'status') {
22
- WABinary_1.assertNodeErrorFree(node)
22
+ assertNodeErrorFree(node)
23
23
  let status = node?.content?.toString() || null
24
24
  const setAt = new Date(+(node?.attrs?.t || 0) * 1000)
25
25
  if (!status) {
@@ -1,22 +1,38 @@
1
1
  "use strict"
2
2
 
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ const __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k
5
- var desc = Object.getOwnPropertyDescriptor(m, k)
5
+
6
+ let desc = Object.getOwnPropertyDescriptor(m, k)
7
+
6
8
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k] } }
9
+ desc = {
10
+ enumerable: true,
11
+ get: function() {
12
+ return m[k]
13
+ }
14
+ }
8
15
  }
9
- Object.defineProperty(o, k2, desc)
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k
12
- o[k2] = m[k]
13
- }))
14
16
 
15
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
17
+ Object.defineProperty(o, k2, desc)
18
+
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k
21
+ o[k2] = m[k]
22
+ }
23
+ ))
24
+
25
+ const __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) {
27
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
28
+ __createBinding(exports, m, p)
29
+ }
30
+ }
17
31
  }
18
32
 
19
- Object.defineProperty(exports, "__esModule", { value: true })
33
+ Object.defineProperty(exports, "__esModule", {
34
+ value: true
35
+ })
20
36
 
21
37
  __exportStar(require("./USyncBotProfileProtocol"), exports)
22
38
  __exportStar(require("./USyncContactProtocol"), exports)
@@ -2,8 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", { value: true })
4
4
 
5
- const WABinary_1 = require("../WABinary")
6
- const Protocols_1 = require("./Protocols")
5
+ const { getBinaryNodeChild } = require("../WABinary")
6
+ const {
7
+ USyncLIDProtocol,
8
+ USyncDeviceProtocol,
9
+ USyncContactProtocol,
10
+ USyncStatusProtocol,
11
+ USyncBotProfileProtocol,
12
+ USyncDisappearingModeProtocol
13
+ } = require("./Protocols")
7
14
 
8
15
  class USyncQuery {
9
16
  constructor() {
@@ -36,11 +43,11 @@ class USyncQuery {
36
43
  list: [],
37
44
  sideList: [],
38
45
  }
39
- const usyncNode = WABinary_1.getBinaryNodeChild(result, 'usync')
46
+ const usyncNode = getBinaryNodeChild(result, 'usync')
40
47
  //TODO: implement error backoff, refresh etc.
41
48
  //TODO: see if there are any errors in the result node
42
49
  //const resultNode = getBinaryNodeChild(usyncNode, 'result')
43
- const listNode = WABinary_1.getBinaryNodeChild(usyncNode, 'list')
50
+ const listNode = getBinaryNodeChild(usyncNode, 'list')
44
51
  if (Array.isArray(listNode?.content) && typeof listNode !== 'undefined') {
45
52
  queryResult.list = listNode.content.map((node) => {
46
53
  const id = node?.attrs?.jid
@@ -62,27 +69,27 @@ class USyncQuery {
62
69
  return queryResult
63
70
  }
64
71
  withLIDProtocol() {
65
- this.protocols.push(new Protocols_1.USyncLIDProtocol())
72
+ this.protocols.push(new USyncLIDProtocol())
66
73
  return this
67
74
  }
68
75
  withDeviceProtocol() {
69
- this.protocols.push(new Protocols_1.USyncDeviceProtocol())
76
+ this.protocols.push(new USyncDeviceProtocol())
70
77
  return this
71
78
  }
72
79
  withContactProtocol() {
73
- this.protocols.push(new Protocols_1.USyncContactProtocol())
80
+ this.protocols.push(new USyncContactProtocol())
74
81
  return this
75
82
  }
76
83
  withStatusProtocol() {
77
- this.protocols.push(new Protocols_1.USyncStatusProtocol())
84
+ this.protocols.push(new USyncStatusProtocol())
78
85
  return this
79
86
  }
80
87
  withBotProfileProtocol() {
81
- this.protocols.push(new Protocols_1.USyncBotProfileProtocol())
88
+ this.protocols.push(new USyncBotProfileProtocol())
82
89
  return this
83
90
  }
84
91
  withDisappearingModeProtocol() {
85
- this.protocols.push(new Protocols_1.USyncDisappearingModeProtocol())
92
+ this.protocols.push(new USyncDisappearingModeProtocol())
86
93
  return this
87
94
  }
88
95
  }
@@ -1,22 +1,38 @@
1
1
  "use strict"
2
2
 
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ const __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k
5
- var desc = Object.getOwnPropertyDescriptor(m, k)
5
+
6
+ let desc = Object.getOwnPropertyDescriptor(m, k)
7
+
6
8
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k] } }
9
+ desc = {
10
+ enumerable: true,
11
+ get: function() {
12
+ return m[k]
13
+ }
14
+ }
8
15
  }
9
- Object.defineProperty(o, k2, desc)
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k
12
- o[k2] = m[k]
13
- }))
14
16
 
15
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p)
17
+ Object.defineProperty(o, k2, desc)
18
+
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k
21
+ o[k2] = m[k]
22
+ }
23
+ ))
24
+
25
+ const __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) {
27
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
28
+ __createBinding(exports, m, p)
29
+ }
30
+ }
17
31
  }
18
32
 
19
- Object.defineProperty(exports, "__esModule", { value: true })
33
+ Object.defineProperty(exports, "__esModule", {
34
+ value: true
35
+ })
20
36
 
21
37
  __exportStar(require("./Protocols"), exports)
22
38
  __exportStar(require("./USyncQuery"), exports)
package/lib/index.js CHANGED
@@ -1,33 +1,62 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
1
+ "use strict"
2
+
3
+ const __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k
5
+
6
+ let desc = Object.getOwnPropertyDescriptor(m, k)
7
+
5
8
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
9
+ desc = {
10
+ enumerable: true,
11
+ get: function() {
12
+ return m[k]
13
+ }
14
+ }
7
15
  }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.proto = exports.makeWASocket = void 0;
21
- const WAProto_1 = require("../WAProto");
22
- Object.defineProperty(exports, "proto", { enumerable: true, get: function () { return WAProto_1.proto; } });
23
- const Socket_1 = __importDefault(require("./Socket"));
24
- exports.makeWASocket = Socket_1.default;
25
- __exportStar(require("../WAProto"), exports);
26
- __exportStar(require("./Utils"), exports);
27
- __exportStar(require("./Types"), exports);
28
- __exportStar(require("./Store"), exports);
29
- __exportStar(require("./Defaults"), exports);
30
- __exportStar(require("./WABinary"), exports);
31
- __exportStar(require("./WAM"), exports);
32
- __exportStar(require("./WAUSync"), exports);
33
- exports.default = Socket_1.default;
16
+
17
+ Object.defineProperty(o, k2, desc)
18
+
19
+ }) : (function(o, m, k, k2) {
20
+ if (k2 === undefined) k2 = k
21
+ o[k2] = m[k]
22
+ }
23
+ ))
24
+
25
+ const __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) {
27
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) {
28
+ __createBinding(exports, m, p)
29
+ }
30
+ }
31
+ }
32
+
33
+ Object.defineProperty(exports, "__esModule", {
34
+ value: true
35
+ })
36
+
37
+ exports.proto =
38
+ exports.makeWASocket = null
39
+
40
+ const { proto } = require("../WAProto")
41
+
42
+ Object.defineProperty(exports, "proto", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return proto
46
+ }
47
+ })
48
+
49
+ const { default: socket } = require("./Socket")
50
+
51
+ exports.makeWASocket = socket
52
+
53
+ __exportStar(require("../WAProto"), exports)
54
+ __exportStar(require("./Utils"), exports)
55
+ __exportStar(require("./Types"), exports)
56
+ __exportStar(require("./Store"), exports)
57
+ __exportStar(require("./Defaults"), exports)
58
+ __exportStar(require("./WABinary"), exports)
59
+ __exportStar(require("./WAM"), exports)
60
+ __exportStar(require("./WAUSync"), exports)
61
+
62
+ exports.default = socket
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hansaka02/baileys",
3
- "version": "7.3.2",
4
- "description": "WhatsApp API Modification By Itsukiichan",
3
+ "version": "7.3.4",
4
+ "description": "WhatsApp API Modification By hansaka",
5
5
  "keywords": [
6
6
  "whatsapp",
7
7
  "js-whatsapp",
@@ -15,45 +15,39 @@
15
15
  "homepage": "https://github.com/hansaka02/Baileys",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+ssh://git@github.com/hansaka02/Baileys.git"
18
+ "url": "git+ssh://git@github.com/Itsukichann/Baileys.git"
19
19
  },
20
20
  "license": "MIT",
21
21
  "author": "hansaka02",
22
22
  "main": "lib/index.js",
23
- "types": "lib/index.d.ts",
24
23
  "files": [
25
24
  "lib/*",
26
25
  "WAProto/*",
27
26
  "engine-requirements.js"
28
27
  ],
29
28
  "scripts": {
30
- "build:all": "tsc && typedoc",
31
- "build:docs": "typedoc",
32
- "build:tsc": "tsc",
33
29
  "changelog:last": "conventional-changelog -p angular -r 2",
34
30
  "changelog:preview": "conventional-changelog -p angular -u",
35
31
  "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
36
32
  "lint": "eslint src --ext .js,.ts",
37
33
  "lint:fix": "yarn lint --fix",
38
- "prepack": "tsc",
39
- "prepare": "tsc",
40
34
  "preinstall": "node ./engine-requirements.js",
41
35
  "release": "release-it",
42
36
  "test": "jest"
43
37
  },
44
38
  "dependencies": {
39
+ "@hapi/boom": "^9.1.3",
45
40
  "@adiwajshing/keyed-db": "^0.2.4",
46
41
  "@cacheable/node-cache": "1.5.3",
47
- "@hapi/boom": "^9.1.3",
48
42
  "@itsukichan/eslint-config": "^1.0.0",
49
43
  "@itsukichan/libsignal-node": "^1.0.1",
50
44
  "async-mutex": "^0.5.0",
51
- "audio-decode": "^2.2.2",
52
45
  "axios": "^1.12.1",
46
+ "audio-decode": "^2.2.2",
53
47
  "cache-manager": "^5.7.6",
54
48
  "fflate": "^0.8.2",
55
- "link-preview-js": "^3.0.14",
56
49
  "lodash": "^4.17.21",
50
+ "link-preview-js": "^3.0.14",
57
51
  "lru-cache": "^11.1.0",
58
52
  "music-metadata": "^7.12.3",
59
53
  "pino": "^9.6",
@@ -77,7 +71,7 @@
77
71
  "ts-node": "^10.8.1",
78
72
  "typedoc": "^0.27.9",
79
73
  "typedoc-plugin-markdown": "4.4.2",
80
- "typescript": "^5.9.3"
74
+ "typescript": "^5.8.2"
81
75
  },
82
76
  "peerDependencies": {
83
77
  "jimp": "^0.22.12"
@@ -95,6 +89,6 @@
95
89
  "lib": "lib"
96
90
  },
97
91
  "bugs": {
98
- "url": "https://github.com/Itsukichann/Baileys/issues"
92
+ "url": "https://github.com/hansaka02Baileys/issues"
99
93
  }
100
94
  }