astrabail 1.0.7 → 1.0.9

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 (223) hide show
  1. package/WAProto/GenerateStatics.sh +3 -0
  2. package/WAProto/WAProto.proto +3 -0
  3. package/WAProto/fix-imports.js +3 -0
  4. package/WAProto/index.d.ts +3 -0
  5. package/WAProto/index.js +3 -0
  6. package/WAProto/p.html +3 -0
  7. package/lib/Defaults/astrabail-version.json +3 -0
  8. package/lib/Defaults/index.d.ts +3 -1
  9. package/lib/Defaults/index.js +10 -3
  10. package/lib/Defaults/phonenumber-mcc.json +3 -0
  11. package/lib/Defaults/update-wa-version.js +3 -1
  12. package/lib/Signal/Group/ciphertext-message.d.ts +3 -1
  13. package/lib/Signal/Group/ciphertext-message.js +3 -0
  14. package/lib/Signal/Group/group-session-builder.d.ts +3 -1
  15. package/lib/Signal/Group/group-session-builder.js +3 -0
  16. package/lib/Signal/Group/group_cipher.d.ts +3 -1
  17. package/lib/Signal/Group/group_cipher.js +3 -0
  18. package/lib/Signal/Group/index.d.ts +3 -1
  19. package/lib/Signal/Group/index.js +3 -0
  20. package/lib/Signal/Group/keyhelper.d.ts +3 -1
  21. package/lib/Signal/Group/keyhelper.js +3 -0
  22. package/lib/Signal/Group/queue-job.js +3 -0
  23. package/lib/Signal/Group/sender-chain-key.d.ts +3 -1
  24. package/lib/Signal/Group/sender-chain-key.js +3 -0
  25. package/lib/Signal/Group/sender-key-distribution-message.d.ts +3 -1
  26. package/lib/Signal/Group/sender-key-distribution-message.js +3 -0
  27. package/lib/Signal/Group/sender-key-message.d.ts +3 -1
  28. package/lib/Signal/Group/sender-key-message.js +3 -0
  29. package/lib/Signal/Group/sender-key-name.d.ts +3 -1
  30. package/lib/Signal/Group/sender-key-name.js +3 -0
  31. package/lib/Signal/Group/sender-key-record.d.ts +3 -1
  32. package/lib/Signal/Group/sender-key-record.js +3 -0
  33. package/lib/Signal/Group/sender-key-state.d.ts +3 -1
  34. package/lib/Signal/Group/sender-key-state.js +3 -0
  35. package/lib/Signal/Group/sender-message-key.d.ts +3 -1
  36. package/lib/Signal/Group/sender-message-key.js +3 -0
  37. package/lib/Signal/libsignal.d.ts +3 -1
  38. package/lib/Signal/libsignal.js +3 -0
  39. package/lib/Signal/lid-mapping.d.ts +3 -1
  40. package/lib/Signal/lid-mapping.js +3 -0
  41. package/lib/Socket/Client/index.d.ts +3 -1
  42. package/lib/Socket/Client/index.js +3 -0
  43. package/lib/Socket/Client/types.d.ts +3 -1
  44. package/lib/Socket/Client/types.js +3 -0
  45. package/lib/Socket/Client/websocket.d.ts +3 -1
  46. package/lib/Socket/Client/websocket.js +3 -0
  47. package/lib/Socket/business.d.ts +5 -3
  48. package/lib/Socket/business.js +3 -0
  49. package/lib/Socket/chats.d.ts +5 -3
  50. package/lib/Socket/chats.js +4 -1
  51. package/lib/Socket/communities.d.ts +5 -3
  52. package/lib/Socket/communities.js +3 -0
  53. package/lib/Socket/community.js +3 -0
  54. package/lib/Socket/groups.d.ts +5 -3
  55. package/lib/Socket/groups.js +3 -0
  56. package/lib/Socket/index.d.ts +5 -3
  57. package/lib/Socket/index.js +3 -0
  58. package/lib/Socket/messages-recv.d.ts +5 -3
  59. package/lib/Socket/messages-recv.js +3 -0
  60. package/lib/Socket/messages-send.d.ts +5 -3
  61. package/lib/Socket/messages-send.js +111 -1
  62. package/lib/Socket/mex.d.ts +3 -1
  63. package/lib/Socket/mex.js +3 -0
  64. package/lib/Socket/newsletter.d.ts +5 -3
  65. package/lib/Socket/newsletter.js +3 -0
  66. package/lib/Socket/socket.d.ts +5 -3
  67. package/lib/Socket/socket.js +4 -1
  68. package/lib/Socket/usync.js +3 -0
  69. package/lib/Store/index.js +3 -0
  70. package/lib/Store/make-cache-manager-store.js +3 -0
  71. package/lib/Store/make-in-memory-store.js +4 -1
  72. package/lib/Store/make-ordered-dictionary.js +3 -0
  73. package/lib/Store/object-repository.js +3 -0
  74. package/lib/Types/Auth.d.ts +3 -1
  75. package/lib/Types/Auth.js +3 -0
  76. package/lib/Types/Bussines.d.ts +3 -1
  77. package/lib/Types/Bussines.js +3 -0
  78. package/lib/Types/Call.d.ts +3 -1
  79. package/lib/Types/Call.js +3 -0
  80. package/lib/Types/Chat.d.ts +3 -1
  81. package/lib/Types/Chat.js +3 -0
  82. package/lib/Types/Contact.d.ts +3 -1
  83. package/lib/Types/Contact.js +3 -0
  84. package/lib/Types/Events.d.ts +10 -8
  85. package/lib/Types/Events.js +3 -0
  86. package/lib/Types/GroupMetadata.d.ts +3 -1
  87. package/lib/Types/GroupMetadata.js +3 -0
  88. package/lib/Types/Label.d.ts +3 -1
  89. package/lib/Types/Label.js +3 -0
  90. package/lib/Types/LabelAssociation.d.ts +3 -1
  91. package/lib/Types/LabelAssociation.js +3 -0
  92. package/lib/Types/Message.d.ts +3 -1
  93. package/lib/Types/Message.js +3 -0
  94. package/lib/Types/MexUpdates.js +3 -0
  95. package/lib/Types/Newsletter.d.ts +3 -1
  96. package/lib/Types/Newsletter.js +3 -0
  97. package/lib/Types/Product.d.ts +3 -1
  98. package/lib/Types/Product.js +3 -0
  99. package/lib/Types/Signal.d.ts +3 -1
  100. package/lib/Types/Signal.js +3 -0
  101. package/lib/Types/Socket.d.ts +6 -4
  102. package/lib/Types/Socket.js +3 -0
  103. package/lib/Types/State.d.ts +3 -1
  104. package/lib/Types/State.js +3 -0
  105. package/lib/Types/USync.d.ts +3 -1
  106. package/lib/Types/USync.js +3 -0
  107. package/lib/Types/index.d.ts +4 -2
  108. package/lib/Types/index.js +3 -0
  109. package/lib/Utils/astrabail-event-stream.js +61 -1
  110. package/lib/Utils/audioToBuffer.js +3 -0
  111. package/lib/Utils/auth-utils.d.ts +3 -1
  112. package/lib/Utils/auth-utils.js +3 -0
  113. package/lib/Utils/bridge-runtime.d.ts +3 -0
  114. package/lib/Utils/bridge-runtime.js +3 -0
  115. package/lib/Utils/browser-utils.d.ts +3 -1
  116. package/lib/Utils/browser-utils.js +6 -3
  117. package/lib/Utils/business.d.ts +3 -1
  118. package/lib/Utils/business.js +3 -0
  119. package/lib/Utils/chat-utils.d.ts +5 -3
  120. package/lib/Utils/chat-utils.js +3 -0
  121. package/lib/Utils/crypto.d.ts +3 -1
  122. package/lib/Utils/crypto.js +3 -0
  123. package/lib/Utils/decode-wa-message.d.ts +3 -1
  124. package/lib/Utils/decode-wa-message.js +3 -0
  125. package/lib/Utils/event-buffer.d.ts +8 -6
  126. package/lib/Utils/event-buffer.js +4 -1
  127. package/lib/Utils/generics.d.ts +9 -7
  128. package/lib/Utils/generics.js +15 -12
  129. package/lib/Utils/history.d.ts +3 -1
  130. package/lib/Utils/history.js +3 -0
  131. package/lib/Utils/identity-change-handler.d.ts +3 -1
  132. package/lib/Utils/identity-change-handler.js +3 -0
  133. package/lib/Utils/index.d.ts +3 -1
  134. package/lib/Utils/index.js +3 -1
  135. package/lib/Utils/link-preview.d.ts +3 -1
  136. package/lib/Utils/link-preview.js +3 -0
  137. package/lib/Utils/logger.d.ts +3 -1
  138. package/lib/Utils/logger.js +3 -0
  139. package/lib/Utils/lt-hash.d.ts +3 -1
  140. package/lib/Utils/lt-hash.js +3 -0
  141. package/lib/Utils/make-mutex.d.ts +3 -1
  142. package/lib/Utils/make-mutex.js +3 -0
  143. package/lib/Utils/message-retry-manager.d.ts +3 -1
  144. package/lib/Utils/message-retry-manager.js +3 -0
  145. package/lib/Utils/messages-media.d.ts +3 -1
  146. package/lib/Utils/messages-media.js +4 -1
  147. package/lib/Utils/messages-newsletter.d.ts +3 -0
  148. package/lib/Utils/messages-newsletter.js +3 -0
  149. package/lib/Utils/messages.d.ts +3 -1
  150. package/lib/Utils/messages.js +4 -1
  151. package/lib/Utils/noise-handler.d.ts +3 -1
  152. package/lib/Utils/noise-handler.js +3 -0
  153. package/lib/Utils/pre-key-manager.d.ts +3 -1
  154. package/lib/Utils/pre-key-manager.js +3 -0
  155. package/lib/Utils/process-message.d.ts +5 -3
  156. package/lib/Utils/process-message.js +3 -0
  157. package/lib/Utils/reporting-utils.d.ts +3 -1
  158. package/lib/Utils/reporting-utils.js +3 -0
  159. package/lib/Utils/resolve-jid.d.ts +3 -0
  160. package/lib/Utils/resolve-jid.js +3 -0
  161. package/lib/Utils/rust-bridge-shim.d.ts +3 -0
  162. package/lib/Utils/rust-bridge-shim.js +3 -0
  163. package/lib/Utils/serial-task-queue.js +3 -0
  164. package/lib/Utils/signal.d.ts +3 -1
  165. package/lib/Utils/signal.js +3 -0
  166. package/lib/Utils/streamToBuffer.js +3 -0
  167. package/lib/Utils/sync-action-utils.d.ts +6 -4
  168. package/lib/Utils/sync-action-utils.js +3 -0
  169. package/lib/Utils/tc-token-utils.d.ts +3 -1
  170. package/lib/Utils/tc-token-utils.js +3 -0
  171. package/lib/Utils/use-mongo-file-auth-state.js +3 -0
  172. package/lib/Utils/use-multi-file-auth-state.d.ts +3 -1
  173. package/lib/Utils/use-multi-file-auth-state.js +4 -1
  174. package/lib/Utils/use-single-file-auth-state.js +3 -0
  175. package/lib/Utils/validate-connection.d.ts +3 -1
  176. package/lib/Utils/validate-connection.js +3 -0
  177. package/lib/WABinary/constants.d.ts +3 -1
  178. package/lib/WABinary/constants.js +3 -0
  179. package/lib/WABinary/decode.d.ts +3 -1
  180. package/lib/WABinary/decode.js +3 -0
  181. package/lib/WABinary/encode.d.ts +3 -1
  182. package/lib/WABinary/encode.js +3 -0
  183. package/lib/WABinary/generic-utils.d.ts +3 -1
  184. package/lib/WABinary/generic-utils.js +3 -0
  185. package/lib/WABinary/index.d.ts +3 -1
  186. package/lib/WABinary/index.js +3 -0
  187. package/lib/WABinary/jid-utils.d.ts +3 -1
  188. package/lib/WABinary/jid-utils.js +3 -0
  189. package/lib/WABinary/types.d.ts +3 -1
  190. package/lib/WABinary/types.js +3 -0
  191. package/lib/WAM/BinaryInfo.d.ts +3 -1
  192. package/lib/WAM/BinaryInfo.js +3 -0
  193. package/lib/WAM/constants.d.ts +3 -1
  194. package/lib/WAM/constants.js +3 -0
  195. package/lib/WAM/encode.d.ts +3 -1
  196. package/lib/WAM/encode.js +3 -0
  197. package/lib/WAM/index.d.ts +3 -1
  198. package/lib/WAM/index.js +3 -0
  199. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -1
  200. package/lib/WAUSync/Protocols/USyncContactProtocol.js +3 -0
  201. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +3 -1
  202. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +3 -0
  203. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +3 -1
  204. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +3 -0
  205. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +3 -1
  206. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -0
  207. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -1
  208. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +3 -0
  209. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -1
  210. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +3 -0
  211. package/lib/WAUSync/Protocols/index.d.ts +3 -1
  212. package/lib/WAUSync/Protocols/index.js +3 -0
  213. package/lib/WAUSync/USyncQuery.d.ts +3 -1
  214. package/lib/WAUSync/USyncQuery.js +3 -0
  215. package/lib/WAUSync/USyncUser.d.ts +3 -1
  216. package/lib/WAUSync/USyncUser.js +3 -0
  217. package/lib/WAUSync/index.d.ts +3 -1
  218. package/lib/WAUSync/index.js +3 -0
  219. package/lib/index.d.ts +3 -0
  220. package/lib/index.js +3 -0
  221. package/package.json +4 -4
  222. package/readme.md +1956 -1956
  223. package/lib/Utils/baileys-event-stream.js +0 -60
@@ -657,10 +657,16 @@ const makeMessagesSocket = (config) => {
657
657
  const additionalDevices = await getUSyncDevices(participantsList, !!useUserDevicesCache, false);
658
658
  devices.push(...additionalDevices);
659
659
  if (isGroup) {
660
+ // ── FIX: Adaptive Addressing Mode ────────────────────────────────────
661
+ // Hanya gunakan 'lid' jika bot BENAR-BENAR sudah terdaftar sebagai
662
+ // LID user. Jika tidak, fallback ke 'pn' agar pesan tidak stuck
663
+ // di grup yang belum sepenuhnya migrasi ke sistem LID WhatsApp.
664
+ const botHasLid = !!(meLid && meLid !== meId);
660
665
  additionalAttributes = {
661
666
  ...additionalAttributes,
662
- addressing_mode: groupData?.addressingMode || 'lid'
667
+ addressing_mode: groupData?.addressingMode || (botHasLid ? 'lid' : 'pn')
663
668
  };
669
+ // ── End Adaptive Addressing Mode ─────────────────────────────────────
664
670
  }
665
671
  // Ensure groupStatusMessageV2 always has messageContextInfo.messageSecret
666
672
  if (message?.groupStatusMessageV2 && !message?.messageContextInfo?.messageSecret) {
@@ -689,6 +695,19 @@ const makeMessagesSocket = (config) => {
689
695
  // to interactiveMessage with nativeFlowMessage so they display
690
696
  // and are interactive in group chats.
691
697
  // ──────────────────────────────────────────────────────────────
698
+ // FIX: ViewOnce Guard — jika pesan sudah di-wrap viewOnce oleh
699
+ // user (misal: relayMessage langsung), ekstrak inner message dulu
700
+ // agar konversi bisa berjalan dengan benar.
701
+ const _voKey = message.viewOnceMessage ? 'viewOnceMessage'
702
+ : message.viewOnceMessageV2 ? 'viewOnceMessageV2'
703
+ : message.viewOnceMessageV2Extension ? 'viewOnceMessageV2Extension'
704
+ : null;
705
+ if (_voKey) {
706
+ const _inner = message[_voKey]?.message;
707
+ if (_inner && (_inner.listMessage || _inner.buttonsMessage || _inner.templateMessage)) {
708
+ message = _inner; // unwrap untuk dikonversi, nanti patchMessageBeforeSending re-wrap
709
+ }
710
+ }
692
711
  // 1. listMessage → interactiveMessage single_select
693
712
  if (message.listMessage) {
694
713
  const list = message.listMessage;
@@ -1452,6 +1471,27 @@ const makeMessagesSocket = (config) => {
1452
1471
  },
1453
1472
  sendMessage: async (jid, content, options = {}) => {
1454
1473
  const userJid = authState.creds.me.id;
1474
+ // ── FIX: AstraBail Button Format Compatibility Bridge ─────────────
1475
+ // Bot yang pakai format button lama (seperti di library lain):
1476
+ // { buttons: [{buttonId:'x', buttonText:{displayText:'y'}, type:1}] }
1477
+ // dikonversi ke interactiveButtons AstraBail agar bisa diproses
1478
+ // dengan benar, termasuk di dalam grup besar.
1479
+ if (typeof content === 'object' &&
1480
+ Array.isArray(content.buttons) &&
1481
+ content.buttons.length > 0 &&
1482
+ !content.buttons.some(b => b.nativeFlowInfo) &&
1483
+ content.buttons.every(b => b.type === 1 || (!b.type && b.buttonId))) {
1484
+ const interactiveButtons = content.buttons.map(b => ({
1485
+ name: 'quick_reply',
1486
+ buttonParamsJson: JSON.stringify({
1487
+ display_text: b.buttonText?.displayText || b.buttonId || 'Button',
1488
+ id: b.buttonId || b.buttonText?.displayText || 'btn'
1489
+ })
1490
+ }));
1491
+ const { buttons: _b, headerType: _h, viewOnce: _v, ...restContent } = content;
1492
+ content = { ...restContent, interactiveButtons };
1493
+ }
1494
+ // ── End AstraBail Button Format Compatibility Bridge ──────────────
1455
1495
  // ── Normalize: buttons[].nativeFlowInfo -> interactiveButtons ──────
1456
1496
  if (typeof content === 'object' &&
1457
1497
  Array.isArray(content.buttons) &&
@@ -1564,6 +1604,73 @@ const makeMessagesSocket = (config) => {
1564
1604
  return msg;
1565
1605
  }
1566
1606
  // ── End Interactive Button ─────────────────────────────────────────
1607
+ // ── FIX: Album Message Handler (AstraBail-compatible + delay configurable) ──
1608
+ if (typeof content === 'object' && 'album' in content && content.album) {
1609
+ const albumDelay = config.albumMessageItemDelayMs ?? 800;
1610
+ const { album, caption } = content;
1611
+ if (caption && album.length > 0 && !album[0].caption) {
1612
+ album[0].caption = caption;
1613
+ }
1614
+ let mediaHandle;
1615
+ const albumMsg = (0, index_js_3.generateWAMessageFromContent)(jid, {
1616
+ albumMessage: {
1617
+ expectedImageCount: album.filter(item => 'image' in item).length,
1618
+ expectedVideoCount: album.filter(item => 'video' in item).length
1619
+ }
1620
+ }, { userJid, ...options });
1621
+ await relayMessage(jid, albumMsg.message, { messageId: albumMsg.key.id });
1622
+ for (const i in album) {
1623
+ const media = album[i];
1624
+ let mediaMsg;
1625
+ if ('image' in media) {
1626
+ mediaMsg = await (0, index_js_3.generateWAMessage)(jid, {
1627
+ image: media.image,
1628
+ ...(media.caption ? { caption: media.caption } : {})
1629
+ }, {
1630
+ logger, userJid,
1631
+ upload: async (readStream, opts) => {
1632
+ const up = await waUploadToServer(readStream, { ...opts, newsletter: _isNewsletterJid(jid) });
1633
+ mediaHandle = up.handle;
1634
+ return up;
1635
+ },
1636
+ ...options
1637
+ });
1638
+ } else if ('video' in media) {
1639
+ mediaMsg = await (0, index_js_3.generateWAMessage)(jid, {
1640
+ video: media.video,
1641
+ ...(media.caption ? { caption: media.caption } : {}),
1642
+ ...(media.gifPlayback !== undefined ? { gifPlayback: media.gifPlayback } : {})
1643
+ }, {
1644
+ logger, userJid,
1645
+ upload: async (readStream, opts) => {
1646
+ const up = await waUploadToServer(readStream, { ...opts, newsletter: _isNewsletterJid(jid) });
1647
+ mediaHandle = up.handle;
1648
+ return up;
1649
+ },
1650
+ ...options
1651
+ });
1652
+ }
1653
+ if (mediaMsg) {
1654
+ const { randomBytes: _rb } = require('node:crypto');
1655
+ mediaMsg.message.messageContextInfo = {
1656
+ messageSecret: _rb(32),
1657
+ messageAssociation: {
1658
+ associationType: 1,
1659
+ parentMessageKey: albumMsg.key
1660
+ }
1661
+ };
1662
+ await relayMessage(jid, mediaMsg.message, { messageId: mediaMsg.key.id });
1663
+ await (0, generics_js_1.delay)(albumDelay);
1664
+ }
1665
+ }
1666
+ if (config.emitOwnEvents) {
1667
+ process.nextTick(async () => {
1668
+ await messageMutex.mutex(() => upsertMessage(albumMsg, 'append'));
1669
+ });
1670
+ }
1671
+ return albumMsg;
1672
+ }
1673
+ // ── End Album Message Handler ─────────────────────────────────────
1567
1674
  if (typeof content === 'object' &&
1568
1675
  'disappearingMessagesInChat' in content &&
1569
1676
  typeof content['disappearingMessagesInChat'] !== 'undefined' &&
@@ -1690,3 +1797,6 @@ const makeMessagesSocket = (config) => {
1690
1797
  };
1691
1798
  };
1692
1799
  exports.makeMessagesSocket = makeMessagesSocket;
1800
+
1801
+
1802
+
@@ -1,3 +1,5 @@
1
1
  import type { BinaryNode } from '../WABinary/index.js';
2
2
  export declare const executeWMexQuery: <T>(variables: Record<string, unknown>, queryId: string, dataPath: string, query: (node: BinaryNode) => Promise<BinaryNode>, generateMessageTag: () => string) => Promise<T>;
3
- //# sourceMappingURL=mex.d.ts.map
3
+ //# sourceMappingURL=mex.d.ts.map
4
+
5
+
package/lib/Socket/mex.js CHANGED
@@ -43,3 +43,6 @@ const executeWMexQuery = async (variables, queryId, dataPath, query, generateMes
43
43
  throw new boom_1.Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result });
44
44
  };
45
45
  exports.executeWMexQuery = executeWMexQuery;
46
+
47
+
48
+
@@ -118,8 +118,8 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
118
118
  removeQuickReply: (timestamp: string) => Promise<void>;
119
119
  type: "md";
120
120
  ws: import("./Client/index.js").WebSocketClient;
121
- ev: import("../index.js").BaileysEventEmitter & {
122
- process(handler: (events: Partial<import("../index.js").BaileysEventMap>) => void | Promise<void>): () => void;
121
+ ev: import("../index.js").AstraBailEventEmitter & {
122
+ process(handler: (events: Partial<import("../index.js").AstraBailEventMap>) => void | Promise<void>): () => void;
123
123
  buffer(): void;
124
124
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
125
125
  flush(): boolean;
@@ -157,4 +157,6 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
157
157
  }[] | undefined>;
158
158
  };
159
159
  export type NewsletterSocket = ReturnType<typeof makeNewsletterSocket>;
160
- //# sourceMappingURL=newsletter.d.ts.map
160
+ //# sourceMappingURL=newsletter.d.ts.map
161
+
162
+
@@ -291,3 +291,6 @@ const extractNewsletterMetadata = (node, isCreate) => {
291
291
  return metadata;
292
292
  };
293
293
  exports.extractNewsletterMetadata = extractNewsletterMetadata;
294
+
295
+
296
+
@@ -13,8 +13,8 @@ import { WebSocketClient } from './Client/index.js';
13
13
  export declare const makeSocket: (config: SocketConfig) => {
14
14
  type: "md";
15
15
  ws: WebSocketClient;
16
- ev: import("../Types/index.js").BaileysEventEmitter & {
17
- process(handler: (events: Partial<import("../Types/index.js").BaileysEventMap>) => void | Promise<void>): () => void;
16
+ ev: import("../Types/index.js").AstraBailEventEmitter & {
17
+ process(handler: (events: Partial<import("../Types/index.js").AstraBailEventMap>) => void | Promise<void>): () => void;
18
18
  buffer(): void;
19
19
  createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
20
20
  flush(): boolean;
@@ -52,4 +52,6 @@ export declare const makeSocket: (config: SocketConfig) => {
52
52
  exists: boolean;
53
53
  }[] | undefined>;
54
54
  };
55
- //# sourceMappingURL=socket.d.ts.map
55
+ //# sourceMappingURL=socket.d.ts.map
56
+
57
+
@@ -32,7 +32,7 @@ const makeSocket = (config) => {
32
32
  const syncDisabled = index_js_2.PROCESSABLE_HISTORY_TYPES.map(syncType => config.shouldSyncHistoryMessage({ syncType })).filter(x => x === false)
33
33
  .length === index_js_2.PROCESSABLE_HISTORY_TYPES.length;
34
34
  if (syncDisabled) {
35
- logger.warn('⚠️ DANGER: DISABLING ALL SYNC BY shouldSyncHistoryMsg PREVENTS BAILEYS FROM ACCESSING INITIAL LID MAPPINGS, LEADING TO INSTABILIY AND SESSION ERRORS');
35
+ logger.warn('⚠️ DANGER: DISABLING ALL SYNC BY shouldSyncHistoryMsg PREVENTS AstraBail FROM ACCESSING INITIAL LID MAPPINGS, LEADING TO INSTABILIY AND SESSION ERRORS');
36
36
  }
37
37
  const url = typeof waWebSocketUrl === 'string' ? new url_1.URL(waWebSocketUrl) : waWebSocketUrl;
38
38
  if (config.mobile || url.protocol === 'tcp:') {
@@ -945,3 +945,6 @@ function mapWebSocketError(handler) {
945
945
  handler(new boom_1.Boom(`WebSocket Error (${error?.message})`, { statusCode: (0, index_js_4.getCodeFromWSError)(error), data: error }));
946
946
  };
947
947
  }
948
+
949
+
950
+
@@ -68,3 +68,6 @@ const makeUSyncSocket = (config) => {
68
68
  };
69
69
  };
70
70
  exports.makeUSyncSocket = makeUSyncSocket;
71
+
72
+
73
+
@@ -18,3 +18,6 @@ __exportStar(require("./make-cache-manager-store.js"), exports);
18
18
  __exportStar(require("./make-in-memory-store.js"), exports);
19
19
  __exportStar(require("./make-ordered-dictionary.js"), exports);
20
20
  __exportStar(require("./object-repository.js"), exports);
21
+
22
+
23
+
@@ -81,3 +81,6 @@ const makeCacheManagerAuthState = async (store, sessionKey) => {
81
81
  };
82
82
  };
83
83
  exports.makeCacheManagerAuthState = makeCacheManagerAuthState;
84
+
85
+
86
+
@@ -54,7 +54,7 @@ const makeInMemoryStore = (config) => {
54
54
  }
55
55
  };
56
56
  /**
57
- * binds to a BaileysEventEmitter.
57
+ * binds to a AstraBailEventEmitter.
58
58
  * It listens to all events and constructs a state that you can query accurate data from.
59
59
  * Eg. can use the store to fetch chats, contacts, messages etc.
60
60
  * @param ev typically the event emitter from the socket connection
@@ -396,3 +396,6 @@ const makeInMemoryStore = (config) => {
396
396
  };
397
397
  };
398
398
  exports.makeInMemoryStore = makeInMemoryStore;
399
+
400
+
401
+
@@ -79,3 +79,6 @@ function makeOrderedDictionary(idGetter) {
79
79
  }
80
80
  };
81
81
  }
82
+
83
+
84
+
@@ -25,3 +25,6 @@ class ObjectRepository {
25
25
  }
26
26
  }
27
27
  exports.ObjectRepository = ObjectRepository;
28
+
29
+
30
+
@@ -113,4 +113,6 @@ export type AuthenticationState = {
113
113
  keys: SignalKeyStore;
114
114
  };
115
115
  export {};
116
- //# sourceMappingURL=Auth.d.ts.map
116
+ //# sourceMappingURL=Auth.d.ts.map
117
+
118
+
package/lib/Types/Auth.js CHANGED
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+
5
+
@@ -22,4 +22,6 @@ export type UpdateBussinesProfileProps = {
22
22
  export type QuickReplyAction = proto.SyncActionValue.IQuickReplyAction & {
23
23
  timestamp?: string;
24
24
  };
25
- //# sourceMappingURL=Bussines.d.ts.map
25
+ //# sourceMappingURL=Bussines.d.ts.map
26
+
27
+
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+
5
+
@@ -12,4 +12,6 @@ export type WACallEvent = {
12
12
  offline: boolean;
13
13
  latencyMs?: number;
14
14
  };
15
- //# sourceMappingURL=Call.d.ts.map
15
+ //# sourceMappingURL=Call.d.ts.map
16
+
17
+
package/lib/Types/Call.js CHANGED
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+
5
+
@@ -120,4 +120,6 @@ export type InitialReceivedChatsState = {
120
120
  export type InitialAppStateSyncOptions = {
121
121
  accountSettings: AccountSettings;
122
122
  };
123
- //# sourceMappingURL=Chat.d.ts.map
123
+ //# sourceMappingURL=Chat.d.ts.map
124
+
125
+
package/lib/Types/Chat.js CHANGED
@@ -8,3 +8,6 @@ exports.ALL_WA_PATCH_NAMES = [
8
8
  'regular_low',
9
9
  'regular'
10
10
  ];
11
+
12
+
13
+
@@ -21,4 +21,6 @@ export interface Contact {
21
21
  imgUrl?: string | null;
22
22
  status?: string;
23
23
  }
24
- //# sourceMappingURL=Contact.d.ts.map
24
+ //# sourceMappingURL=Contact.d.ts.map
25
+
26
+
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+
5
+
@@ -9,7 +9,7 @@ import type { Label } from './Label.js';
9
9
  import type { LabelAssociation } from './LabelAssociation.js';
10
10
  import type { MessageUpsertType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message.js';
11
11
  import type { ConnectionState } from './State.js';
12
- export type BaileysEventMap = {
12
+ export type AstraBailEventMap = {
13
13
  /** connection state has been updated -- WS closed, opened, connecting etc. */
14
14
  'connection.update': Partial<ConnectionState>;
15
15
  /** credentials updated -- some metadata, keys or something */
@@ -227,11 +227,13 @@ export type BufferedEventData = {
227
227
  [jid: string]: Partial<GroupMetadata>;
228
228
  };
229
229
  };
230
- export type BaileysEvent = keyof BaileysEventMap;
231
- export interface BaileysEventEmitter {
232
- on<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
233
- off<T extends keyof BaileysEventMap>(event: T, listener: (arg: BaileysEventMap[T]) => void): void;
234
- removeAllListeners<T extends keyof BaileysEventMap>(event: T): void;
235
- emit<T extends keyof BaileysEventMap>(event: T, arg: BaileysEventMap[T]): boolean;
230
+ export type AstraBailEvent = keyof AstraBailEventMap;
231
+ export interface AstraBailEventEmitter {
232
+ on<T extends keyof AstraBailEventMap>(event: T, listener: (arg: AstraBailEventMap[T]) => void): void;
233
+ off<T extends keyof AstraBailEventMap>(event: T, listener: (arg: AstraBailEventMap[T]) => void): void;
234
+ removeAllListeners<T extends keyof AstraBailEventMap>(event: T): void;
235
+ emit<T extends keyof AstraBailEventMap>(event: T, arg: AstraBailEventMap[T]): boolean;
236
236
  }
237
- //# sourceMappingURL=Events.d.ts.map
237
+ //# sourceMappingURL=Events.d.ts.map
238
+
239
+
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const index_js_1 = require("../../WAProto/index.js");
4
+
5
+
6
+
@@ -64,4 +64,6 @@ export interface GroupModificationResponse {
64
64
  [key: string]: {};
65
65
  };
66
66
  }
67
- //# sourceMappingURL=GroupMetadata.d.ts.map
67
+ //# sourceMappingURL=GroupMetadata.d.ts.map
68
+
69
+
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+
5
+
@@ -44,4 +44,6 @@ export declare enum LabelColor {
44
44
  Color19 = 18,
45
45
  Color20 = 19
46
46
  }
47
- //# sourceMappingURL=Label.d.ts.map
47
+ //# sourceMappingURL=Label.d.ts.map
48
+
49
+
@@ -23,3 +23,6 @@ exports.LabelColor = void 0;
23
23
  LabelColor[LabelColor["Color19"] = 18] = "Color19";
24
24
  LabelColor[LabelColor["Color20"] = 19] = "Color20";
25
25
  })(exports.LabelColor || (exports.LabelColor = {}));
26
+
27
+
28
+
@@ -27,4 +27,6 @@ export interface MessageLabelAssociationActionBody {
27
27
  labelId: string;
28
28
  messageId: string;
29
29
  }
30
- //# sourceMappingURL=LabelAssociation.d.ts.map
30
+ //# sourceMappingURL=LabelAssociation.d.ts.map
31
+
32
+
@@ -5,3 +5,6 @@ exports.LabelAssociationType = void 0;
5
5
  LabelAssociationType["Chat"] = "label_jid";
6
6
  LabelAssociationType["Message"] = "label_message";
7
7
  })(exports.LabelAssociationType || (exports.LabelAssociationType = {}));
8
+
9
+
10
+
@@ -302,4 +302,6 @@ export type MediaDecryptionKeyInfo = {
302
302
  macKey?: Uint8Array;
303
303
  };
304
304
  export type MinimalMessage = Pick<WAMessage, 'key' | 'messageTimestamp'>;
305
- //# sourceMappingURL=Message.d.ts.map
305
+ //# sourceMappingURL=Message.d.ts.map
306
+
307
+
@@ -9,3 +9,6 @@ exports.WAMessageStatus = index_js_1.proto.WebMessageInfo.Status;
9
9
  WAMessageAddressingMode["PN"] = "pn";
10
10
  WAMessageAddressingMode["LID"] = "lid";
11
11
  })(exports.WAMessageAddressingMode || (exports.WAMessageAddressingMode = {}));
12
+
13
+
14
+
@@ -9,3 +9,6 @@ exports.XWAPathsMexUpdates = {
9
9
  GROUP_SHARING_CHANGE: "xwa2_notify_group_on_prop_change",
10
10
  COMMUNITY_OWNER_CHANGE: "xwa2_notify_group_on_participants_roles_change"
11
11
  };
12
+
13
+
14
+
@@ -132,4 +132,6 @@ export interface NewsletterMetadata {
132
132
  description?: string;
133
133
  };
134
134
  }
135
- //# sourceMappingURL=Newsletter.d.ts.map
135
+ //# sourceMappingURL=Newsletter.d.ts.map
136
+
137
+
@@ -41,3 +41,6 @@ exports.MexOperations = {
41
41
  QueryIds["JOB_MUTATION"] = "7150902998257522";
42
42
  QueryIds["SUBSCRIBED"] = "6388546374527196";
43
43
  })(exports.QueryIds || (exports.QueryIds = {}));
44
+
45
+
46
+
@@ -76,4 +76,6 @@ export type GetCatalogOptions = {
76
76
  limit?: number;
77
77
  jid?: string;
78
78
  };
79
- //# sourceMappingURL=Product.d.ts.map
79
+ //# sourceMappingURL=Product.d.ts.map
80
+
81
+
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+
5
+
@@ -73,4 +73,6 @@ export interface SignalRepositoryWithLIDStore extends SignalRepository {
73
73
  lidMapping: LIDMappingStore;
74
74
  }
75
75
  export {};
76
- //# sourceMappingURL=Signal.d.ts.map
76
+ //# sourceMappingURL=Signal.d.ts.map
77
+
78
+
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const index_js_1 = require("../../WAProto/index.js");
4
+
5
+
6
+
@@ -38,7 +38,7 @@ export type SocketConfig = {
38
38
  defaultQueryTimeoutMs: number | undefined;
39
39
  /** ping-pong interval for WS connection */
40
40
  keepAliveIntervalMs: number;
41
- /** should baileys use the mobile api instead of the multi device api
41
+ /** should AstraBail use the mobile api instead of the multi device api
42
42
  * @deprecated This feature has been removed
43
43
  */
44
44
  mobile?: boolean;
@@ -90,9 +90,9 @@ export type SocketConfig = {
90
90
  placeholderResendCache?: CacheStore;
91
91
  /** width for link preview images */
92
92
  linkPreviewImageThumbnailWidth: number;
93
- /** Should Baileys ask the phone for full history, will be received async */
93
+ /** Should AstraBail ask the phone for full history, will be received async */
94
94
  syncFullHistory: boolean;
95
- /** Should baileys fire init queries automatically, default true */
95
+ /** Should AstraBail fire init queries automatically, default true */
96
96
  fireInitQueries: boolean;
97
97
  /**
98
98
  * generate a high quality link preview,
@@ -130,4 +130,6 @@ export type SocketConfig = {
130
130
  cachedGroupMetadata: (jid: string) => Promise<GroupMetadata | undefined>;
131
131
  makeSignalRepository: (auth: SignalAuthState, logger: ILogger, pnToLIDFunc?: (jids: string[]) => Promise<LIDMapping[] | undefined>) => SignalRepositoryWithLIDStore;
132
132
  };
133
- //# sourceMappingURL=Socket.d.ts.map
133
+ //# sourceMappingURL=Socket.d.ts.map
134
+
135
+
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const index_js_1 = require("../../WAProto/index.js");
4
+
5
+
6
+
@@ -36,4 +36,6 @@ export type ConnectionState = {
36
36
  * */
37
37
  isOnline?: boolean;
38
38
  };
39
- //# sourceMappingURL=State.d.ts.map
39
+ //# sourceMappingURL=State.d.ts.map
40
+
41
+
@@ -12,3 +12,6 @@ const boom_1 = require("@hapi/boom");
12
12
  /** Initial sync is complete, or was skipped. The socket is fully operational and events are processed in real-time. */
13
13
  SyncState[SyncState["Online"] = 3] = "Online";
14
14
  })(exports.SyncState || (exports.SyncState = {}));
15
+
16
+
17
+
@@ -23,4 +23,6 @@ export interface USyncQueryProtocol {
23
23
  */
24
24
  parser: (data: BinaryNode) => unknown;
25
25
  }
26
- //# sourceMappingURL=USync.d.ts.map
26
+ //# sourceMappingURL=USync.d.ts.map
27
+
28
+
@@ -1,3 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const index_js_1 = require("../WAUSync/index.js");
4
+
5
+
6
+
@@ -18,7 +18,7 @@ export type UserFacingSocketConfig = Partial<SocketConfig> & {
18
18
  export type BrowsersMap = {
19
19
  ubuntu(browser: string): [string, string, string];
20
20
  macOS(browser: string): [string, string, string];
21
- baileys(browser: string): [string, string, string];
21
+ AstraBail(browser: string): [string, string, string];
22
22
  windows(browser: string): [string, string, string];
23
23
  appropriate(browser: string): [string, string, string];
24
24
  };
@@ -62,4 +62,6 @@ export type CurveKeyPair = {
62
62
  private: Uint8Array;
63
63
  public: Uint8Array;
64
64
  };
65
- //# sourceMappingURL=index.d.ts.map
65
+ //# sourceMappingURL=index.d.ts.map
66
+
67
+
@@ -40,3 +40,6 @@ __exportStar(require("./Newsletter.js"), exports);
40
40
  DisconnectReason[DisconnectReason["forbidden"] = 403] = "forbidden";
41
41
  DisconnectReason[DisconnectReason["unavailableService"] = 503] = "unavailableService";
42
42
  })(exports.DisconnectReason || (exports.DisconnectReason = {}));
43
+
44
+
45
+