@xbibzlibrary/whatsbibz 1.4.0 → 1.4.3

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 (245) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.cn.md +5 -5
  3. package/README.id.md +5 -5
  4. package/README.md +5 -5
  5. package/WAProto/WAProto.proto +1 -0
  6. package/WAProto/index.d.ts +1 -0
  7. package/WAProto/index.js +1 -0
  8. package/lib/BibzWhats/banner.d.ts +1 -0
  9. package/lib/BibzWhats/banner.js +1 -0
  10. package/lib/BibzWhats/client.d.ts +1 -0
  11. package/lib/BibzWhats/client.js +1 -0
  12. package/lib/BibzWhats/device-identity.d.ts +1 -0
  13. package/lib/BibzWhats/device-identity.js +1 -0
  14. package/lib/BibzWhats/extract.d.ts +1 -0
  15. package/lib/BibzWhats/extract.js +1 -0
  16. package/lib/BibzWhats/index.d.ts +1 -0
  17. package/lib/BibzWhats/index.js +1 -0
  18. package/lib/BibzWhats/jid.d.ts +1 -0
  19. package/lib/BibzWhats/jid.js +1 -0
  20. package/lib/BibzWhats/pairing.d.ts +1 -0
  21. package/lib/BibzWhats/pairing.js +1 -0
  22. package/lib/BibzWhats/send.d.ts +1 -0
  23. package/lib/BibzWhats/send.js +1 -0
  24. package/lib/BibzWhats/version.js +5 -4
  25. package/lib/Defaults/index.d.ts +3 -0
  26. package/lib/Defaults/index.js +4 -6
  27. package/lib/Modded/message_builder.d.ts +1 -0
  28. package/lib/Modded/message_builder.js +11 -35
  29. package/lib/Signal/Group/ciphertext-message.d.ts +1 -0
  30. package/lib/Signal/Group/ciphertext-message.js +1 -0
  31. package/lib/Signal/Group/group-session-builder.d.ts +1 -0
  32. package/lib/Signal/Group/group-session-builder.js +1 -0
  33. package/lib/Signal/Group/group_cipher.d.ts +1 -0
  34. package/lib/Signal/Group/group_cipher.js +1 -0
  35. package/lib/Signal/Group/index.d.ts +1 -0
  36. package/lib/Signal/Group/index.js +1 -0
  37. package/lib/Signal/Group/keyhelper.d.ts +1 -0
  38. package/lib/Signal/Group/keyhelper.js +1 -0
  39. package/lib/Signal/Group/sender-chain-key.d.ts +1 -0
  40. package/lib/Signal/Group/sender-chain-key.js +1 -0
  41. package/lib/Signal/Group/sender-key-distribution-message.d.ts +1 -0
  42. package/lib/Signal/Group/sender-key-distribution-message.js +1 -0
  43. package/lib/Signal/Group/sender-key-message.d.ts +1 -0
  44. package/lib/Signal/Group/sender-key-message.js +1 -0
  45. package/lib/Signal/Group/sender-key-name.d.ts +1 -0
  46. package/lib/Signal/Group/sender-key-name.js +1 -0
  47. package/lib/Signal/Group/sender-key-record.d.ts +1 -0
  48. package/lib/Signal/Group/sender-key-record.js +1 -0
  49. package/lib/Signal/Group/sender-key-state.d.ts +1 -0
  50. package/lib/Signal/Group/sender-key-state.js +1 -0
  51. package/lib/Signal/Group/sender-message-key.d.ts +1 -0
  52. package/lib/Signal/Group/sender-message-key.js +1 -0
  53. package/lib/Signal/libsignal.d.ts +1 -0
  54. package/lib/Signal/libsignal.js +1 -0
  55. package/lib/Signal/lid-mapping.d.ts +1 -0
  56. package/lib/Signal/lid-mapping.js +1 -0
  57. package/lib/Socket/Client/index.d.ts +1 -0
  58. package/lib/Socket/Client/index.js +1 -0
  59. package/lib/Socket/Client/types.d.ts +1 -0
  60. package/lib/Socket/Client/types.js +1 -0
  61. package/lib/Socket/Client/websocket.d.ts +1 -0
  62. package/lib/Socket/Client/websocket.js +1 -0
  63. package/lib/Socket/business.d.ts +1 -2
  64. package/lib/Socket/business.js +1 -0
  65. package/lib/Socket/chats.d.ts +1 -0
  66. package/lib/Socket/chats.js +1 -0
  67. package/lib/Socket/communities.d.ts +1 -2
  68. package/lib/Socket/communities.js +12 -2
  69. package/lib/Socket/engine.d.ts +1 -0
  70. package/lib/Socket/engine.js +1 -0
  71. package/lib/Socket/groups.d.ts +1 -0
  72. package/lib/Socket/groups.js +1 -0
  73. package/lib/Socket/index.d.ts +1 -2
  74. package/lib/Socket/index.js +12 -11
  75. package/lib/Socket/messages-recv.d.ts +1 -2
  76. package/lib/Socket/messages-recv.js +13 -4
  77. package/lib/Socket/messages-send.d.ts +7 -2
  78. package/lib/Socket/messages-send.js +59 -23
  79. package/lib/Socket/mex.d.ts +1 -0
  80. package/lib/Socket/mex.js +1 -0
  81. package/lib/Socket/newsletter.d.ts +1 -1
  82. package/lib/Socket/newsletter.js +255 -432
  83. package/lib/Socket/socket.d.ts +1 -0
  84. package/lib/Socket/socket.js +20 -1
  85. package/lib/Types/Auth.d.ts +2 -0
  86. package/lib/Types/Auth.js +1 -0
  87. package/lib/Types/Bussines.d.ts +1 -0
  88. package/lib/Types/Bussines.js +1 -0
  89. package/lib/Types/Call.d.ts +1 -0
  90. package/lib/Types/Call.js +1 -0
  91. package/lib/Types/Chat.d.ts +1 -0
  92. package/lib/Types/Chat.js +1 -0
  93. package/lib/Types/Contact.d.ts +1 -0
  94. package/lib/Types/Contact.js +1 -0
  95. package/lib/Types/Events.d.ts +1 -0
  96. package/lib/Types/Events.js +1 -0
  97. package/lib/Types/GroupMetadata.d.ts +1 -0
  98. package/lib/Types/GroupMetadata.js +1 -0
  99. package/lib/Types/Label.d.ts +1 -0
  100. package/lib/Types/Label.js +1 -0
  101. package/lib/Types/LabelAssociation.d.ts +1 -0
  102. package/lib/Types/LabelAssociation.js +1 -0
  103. package/lib/Types/Message.d.ts +1 -0
  104. package/lib/Types/Message.js +1 -0
  105. package/lib/Types/Newsletter.d.ts +1 -0
  106. package/lib/Types/Newsletter.js +1 -0
  107. package/lib/Types/Product.d.ts +1 -0
  108. package/lib/Types/Product.js +1 -0
  109. package/lib/Types/Signal.d.ts +1 -0
  110. package/lib/Types/Signal.js +1 -0
  111. package/lib/Types/Socket.d.ts +1 -6
  112. package/lib/Types/Socket.js +1 -0
  113. package/lib/Types/State.d.ts +1 -0
  114. package/lib/Types/State.js +1 -0
  115. package/lib/Types/USync.d.ts +1 -0
  116. package/lib/Types/USync.js +1 -0
  117. package/lib/Types/index.d.ts +1 -0
  118. package/lib/Types/index.js +1 -0
  119. package/lib/Utils/auth-utils.d.ts +1 -0
  120. package/lib/Utils/auth-utils.js +4 -0
  121. package/lib/Utils/browser-utils.d.ts +1 -0
  122. package/lib/Utils/browser-utils.js +3 -2
  123. package/lib/Utils/business.d.ts +1 -0
  124. package/lib/Utils/business.js +1 -0
  125. package/lib/Utils/chat-utils.d.ts +1 -0
  126. package/lib/Utils/chat-utils.js +1 -0
  127. package/lib/Utils/companion-reg-client-utils.d.ts +1 -0
  128. package/lib/Utils/companion-reg-client-utils.js +1 -0
  129. package/lib/Utils/crypto.d.ts +1 -0
  130. package/lib/Utils/crypto.js +1 -0
  131. package/lib/Utils/decode-wa-message.d.ts +1 -0
  132. package/lib/Utils/decode-wa-message.js +1 -0
  133. package/lib/Utils/event-buffer.d.ts +1 -0
  134. package/lib/Utils/event-buffer.js +9 -0
  135. package/lib/Utils/generics.d.ts +1 -0
  136. package/lib/Utils/generics.js +2 -1
  137. package/lib/Utils/history.d.ts +1 -0
  138. package/lib/Utils/history.js +1 -0
  139. package/lib/Utils/identity-change-handler.d.ts +1 -0
  140. package/lib/Utils/identity-change-handler.js +1 -0
  141. package/lib/Utils/index.d.ts +1 -0
  142. package/lib/Utils/index.js +1 -0
  143. package/lib/Utils/link-preview.d.ts +1 -0
  144. package/lib/Utils/link-preview.js +1 -0
  145. package/lib/Utils/logger.d.ts +1 -0
  146. package/lib/Utils/logger.js +1 -0
  147. package/lib/Utils/lt-hash.d.ts +1 -0
  148. package/lib/Utils/lt-hash.js +1 -0
  149. package/lib/Utils/make-mutex.d.ts +1 -0
  150. package/lib/Utils/make-mutex.js +1 -0
  151. package/lib/Utils/message-retry-manager.d.ts +1 -0
  152. package/lib/Utils/message-retry-manager.js +1 -0
  153. package/lib/Utils/messages-media.d.ts +1 -0
  154. package/lib/Utils/messages-media.js +28 -92
  155. package/lib/Utils/messages.d.ts +5 -0
  156. package/lib/Utils/messages.js +50 -5
  157. package/lib/Utils/noise-handler.d.ts +1 -0
  158. package/lib/Utils/noise-handler.js +1 -0
  159. package/lib/Utils/offline-node-processor.d.ts +2 -0
  160. package/lib/Utils/offline-node-processor.js +6 -0
  161. package/lib/Utils/platform-identity.d.ts +1 -0
  162. package/lib/Utils/platform-identity.js +1 -0
  163. package/lib/Utils/pre-key-manager.d.ts +1 -0
  164. package/lib/Utils/pre-key-manager.js +1 -0
  165. package/lib/Utils/process-message.d.ts +1 -0
  166. package/lib/Utils/process-message.js +1 -0
  167. package/lib/Utils/reporting-utils.d.ts +1 -0
  168. package/lib/Utils/reporting-utils.js +1 -0
  169. package/lib/Utils/rich-messages.d.ts +1 -0
  170. package/lib/Utils/rich-messages.js +1 -0
  171. package/lib/Utils/signal.d.ts +1 -0
  172. package/lib/Utils/signal.js +1 -0
  173. package/lib/Utils/stanza-ack.d.ts +1 -0
  174. package/lib/Utils/stanza-ack.js +1 -0
  175. package/lib/Utils/sticker-pack.d.ts +1 -0
  176. package/lib/Utils/sticker-pack.js +1 -0
  177. package/lib/Utils/sync-action-utils.d.ts +1 -0
  178. package/lib/Utils/sync-action-utils.js +1 -0
  179. package/lib/Utils/tc-token-utils.d.ts +1 -0
  180. package/lib/Utils/tc-token-utils.js +1 -0
  181. package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
  182. package/lib/Utils/use-multi-file-auth-state.js +1 -0
  183. package/lib/Utils/validate-connection.d.ts +1 -0
  184. package/lib/Utils/validate-connection.js +1 -0
  185. package/lib/VoIP/audio-feeder.d.ts +1 -0
  186. package/lib/VoIP/audio-feeder.js +1 -0
  187. package/lib/VoIP/index.d.ts +1 -0
  188. package/lib/VoIP/index.js +1 -0
  189. package/lib/VoIP/relay-transport.d.ts +1 -0
  190. package/lib/VoIP/relay-transport.js +1 -0
  191. package/lib/VoIP/signaling.js +1 -0
  192. package/lib/VoIP/types.d.ts +1 -0
  193. package/lib/VoIP/types.js +1 -0
  194. package/lib/VoIP/wasm-engine.d.ts +1 -0
  195. package/lib/VoIP/wasm-engine.js +1 -0
  196. package/lib/VoIP/worker-bootstrap.js +2 -1
  197. package/lib/WABinary/constants.d.ts +1 -0
  198. package/lib/WABinary/constants.js +1 -0
  199. package/lib/WABinary/decode.d.ts +1 -0
  200. package/lib/WABinary/decode.js +1 -0
  201. package/lib/WABinary/encode.d.ts +1 -0
  202. package/lib/WABinary/encode.js +1 -0
  203. package/lib/WABinary/generic-utils.d.ts +1 -0
  204. package/lib/WABinary/generic-utils.js +1 -0
  205. package/lib/WABinary/index.d.ts +1 -0
  206. package/lib/WABinary/index.js +1 -0
  207. package/lib/WABinary/jid-utils.d.ts +1 -0
  208. package/lib/WABinary/jid-utils.js +1 -0
  209. package/lib/WABinary/types.d.ts +1 -0
  210. package/lib/WABinary/types.js +1 -0
  211. package/lib/WAM/BinaryInfo.d.ts +1 -0
  212. package/lib/WAM/BinaryInfo.js +1 -0
  213. package/lib/WAM/constants.d.ts +1 -0
  214. package/lib/WAM/constants.js +1 -0
  215. package/lib/WAM/encode.d.ts +1 -0
  216. package/lib/WAM/encode.js +1 -0
  217. package/lib/WAM/index.d.ts +1 -0
  218. package/lib/WAM/index.js +1 -0
  219. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +1 -0
  220. package/lib/WAUSync/Protocols/USyncContactProtocol.js +1 -0
  221. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +1 -0
  222. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +1 -0
  223. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +1 -0
  224. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -0
  225. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +1 -0
  226. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +1 -0
  227. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +1 -0
  228. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -0
  229. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +1 -0
  230. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +1 -0
  231. package/lib/WAUSync/Protocols/index.d.ts +1 -0
  232. package/lib/WAUSync/Protocols/index.js +1 -0
  233. package/lib/WAUSync/USyncQuery.d.ts +1 -0
  234. package/lib/WAUSync/USyncQuery.js +1 -0
  235. package/lib/WAUSync/USyncUser.d.ts +1 -0
  236. package/lib/WAUSync/USyncUser.js +1 -0
  237. package/lib/WAUSync/index.d.ts +1 -0
  238. package/lib/WAUSync/index.js +1 -0
  239. package/lib/assets/wasm/loader.js +1 -0
  240. package/lib/assets/wasm/worker-modules.js +1 -0
  241. package/lib/index.d.ts +1 -0
  242. package/lib/index.js +1 -1
  243. package/package.json +27 -9
  244. package/WAProto/GenerateStatics.sh +0 -3
  245. package/WAProto/fix-imports.js +0 -81
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Socket/socket */
1
2
  import { Boom } from '@hapi/boom';
2
3
  import type { SocketConfig } from '../Types/index.js';
3
4
  import { type BinaryNode } from '../WABinary/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Socket/socket */
1
2
  import { Boom } from '@hapi/boom';
2
3
  import { randomBytes } from 'crypto';
3
4
  import { URL } from 'url';
@@ -494,6 +495,10 @@ export const makeSocket = (config) => {
494
495
  signalRepository.close?.();
495
496
  }
496
497
  catch { }
498
+ try {
499
+ keys.disposeTransactionStorage?.();
500
+ }
501
+ catch { }
497
502
  if (!ws.isClosed && !ws.isClosing) {
498
503
  try {
499
504
  await ws.close();
@@ -723,7 +728,21 @@ export const makeSocket = (config) => {
723
728
  }
724
729
  });
725
730
  ws.on('error', mapWebSocketError(end));
726
- ws.on('close', () => void end(new Boom('Connection Terminated', { statusCode: DisconnectReason.connectionClosed })));
731
+ ws.on('close', (code, reason) => {
732
+ const reasonStr = Buffer.isBuffer(reason) ? reason.toString('utf-8') : (typeof reason === 'string' ? reason : '');
733
+ const details = [];
734
+ if (typeof code === 'number') {
735
+ details.push(`code ${code}`);
736
+ }
737
+ if (reasonStr) {
738
+ details.push(`reason: ${reasonStr}`);
739
+ }
740
+ const suffix = details.length ? ` (${details.join(', ')})` : '';
741
+ void end(new Boom(`Connection Terminated${suffix}`, {
742
+ statusCode: DisconnectReason.connectionClosed,
743
+ data: { code, reason: reasonStr || undefined }
744
+ }));
745
+ });
727
746
  // the server terminated the connection
728
747
  ws.on('CB:xmlstreamend', () => void end(new Boom('Connection Terminated by Server', { statusCode: DisconnectReason.connectionClosed })));
729
748
  let refreshPairingQR;
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Auth */
1
2
  import type { proto } from '../../WAProto/index.js';
2
3
  import type { Contact } from './Contact.js';
3
4
  import type { MinimalMessage } from './Message.js';
@@ -98,6 +99,7 @@ export type SignalKeyStore = {
98
99
  };
99
100
  export type SignalKeyStoreWithTransaction = SignalKeyStore & {
100
101
  isInTransaction: () => boolean;
102
+ disposeTransactionStorage?: () => void;
101
103
  transaction<T>(exec: () => Promise<T>, key: string): Promise<T>;
102
104
  };
103
105
  export type TransactionCapabilityOptions = {
package/lib/Types/Auth.js CHANGED
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Auth */
1
2
  export {};
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Bussines */
1
2
  export type DayOfWeekBussines =
2
3
  | "sun"
3
4
  | "mon"
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Bussines */
1
2
  export {};
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Call */
1
2
  export type WACallUpdateType = 'offer' | 'ringing' | 'timeout' | 'reject' | 'accept' | 'terminate';
2
3
  export type WACallEvent = {
3
4
  chatId: string;
package/lib/Types/Call.js CHANGED
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Call */
1
2
  export {};
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Chat */
1
2
  import type { proto } from '../../WAProto/index.js';
2
3
  import type { AccountSettings } from './Auth.js';
3
4
  import type { QuickReplyAction } from './Bussines.js';
package/lib/Types/Chat.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Chat */
1
2
  export const ALL_WA_PATCH_NAMES = [
2
3
  'critical_block',
3
4
  'critical_unblock_low',
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Contact */
1
2
  export interface Contact {
2
3
  /** ID either in lid or jid format (preferred) **/
3
4
  id: string;
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Contact */
1
2
  export {};
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Events */
1
2
  import type { Boom } from '@hapi/boom';
2
3
  import { proto } from '../../WAProto/index.js';
3
4
  import type { AuthenticationCreds, LIDMapping } from './Auth.js';
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Events */
1
2
  import { proto } from '../../WAProto/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/GroupMetadata */
1
2
  import type { Contact } from './Contact.js';
2
3
  import type { WAMessageAddressingMode } from './Message.js';
3
4
  export type GroupParticipant = Contact & {
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/GroupMetadata */
1
2
  export {};
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Label */
1
2
  export interface Label {
2
3
  /** Label uniq ID */
3
4
  id: string;
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Label */
1
2
  /** WhatsApp has 20 predefined colors */
2
3
  export var LabelColor;
3
4
  (function (LabelColor) {
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/LabelAssociation */
1
2
  /** Association type */
2
3
  export declare enum LabelAssociationType {
3
4
  Chat = "label_jid",
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/LabelAssociation */
1
2
  /** Association type */
2
3
  export var LabelAssociationType;
3
4
  (function (LabelAssociationType) {
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Message */
1
2
  import type { Readable } from "stream";
2
3
  import type { URL } from "url";
3
4
  import { proto } from "../../WAProto/index.js";
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Message */
1
2
  import { proto } from '../../WAProto/index.js';
2
3
  // export the WAMessage Prototypes
3
4
  export { proto as WAProto };
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Newsletter */
1
2
  export declare enum XWAPaths {
2
3
  xwa2_newsletter_create = "xwa2_newsletter_create",
3
4
  xwa2_newsletter_subscribers = "xwa2_newsletter_subscribers",
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Newsletter */
1
2
  export var XWAPaths;
2
3
  (function (XWAPaths) {
3
4
  XWAPaths["xwa2_newsletter_create"] = "xwa2_newsletter_create";
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Product */
1
2
  import type { WAMediaUpload } from './Message.js';
2
3
  export type CatalogResult = {
3
4
  data: {
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Product */
1
2
  export {};
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Signal */
1
2
  import { proto } from '../../WAProto/index.js';
2
3
  import type { LIDMappingStore } from '../Signal/lid-mapping.js';
3
4
  type DecryptGroupSignalOpts = {
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Signal */
1
2
  import { proto } from '../../WAProto/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Socket */
1
2
  import type { Agent } from "https";
2
3
  import type { URL } from "url";
3
4
  import { proto } from "../../WAProto/index.js";
@@ -101,12 +102,6 @@ export type SocketConfig = {
101
102
  markOnlineOnConnect: boolean;
102
103
  /** alphanumeric country code (USA -> US) for the number used */
103
104
  countryCode: string;
104
- /** automatically follow a newsletter/channel once the socket connection opens */
105
- autoFollowNewsletterOnConnect: boolean;
106
- /** delay before auto follow is attempted after connection opens */
107
- autoFollowNewsletterDelayMs: number;
108
- /** newsletter jid used for auto follow */
109
- autoFollowNewsletterJid: string;
110
105
  /** provide a cache to store media, so does not have to be re-uploaded */
111
106
  mediaCache?: CacheStore;
112
107
  /**
@@ -1,2 +1,3 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/Socket */
1
2
  import { proto } from '../../WAProto/index.js';
2
3
  import {} from './Message.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/State */
1
2
  import { Boom } from '@hapi/boom';
2
3
  import type { Contact } from './Contact.js';
3
4
  export declare enum SyncState {
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/State */
1
2
  import { Boom } from '@hapi/boom';
2
3
  export var SyncState;
3
4
  (function (SyncState) {
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/USync */
1
2
  import type { BinaryNode } from '../WABinary/index.js';
2
3
  import { USyncUser } from '../WAUSync/index.js';
3
4
  /**
@@ -1 +1,2 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/USync */
1
2
  import { USyncUser } from '../WAUSync/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/index */
1
2
  export * from "./Auth.js";
2
3
  export * from "./GroupMetadata.js";
3
4
  export * from "./Chat.js";
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Types/index */
1
2
  export * from "./Auth.js";
2
3
  export * from "./GroupMetadata.js";
3
4
  export * from "./Chat.js";
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/auth-utils */
1
2
  import type { AuthenticationCreds, CacheStore, SignalKeyStore, SignalKeyStoreWithTransaction, TransactionCapabilityOptions } from '../Types/index.js';
2
3
  import type { ILogger } from './logger.js';
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/auth-utils */
1
2
  import NodeCache from '@cacheable/node-cache';
2
3
  import { AsyncLocalStorage } from 'async_hooks';
3
4
  import { Mutex } from 'async-mutex';
@@ -227,6 +228,9 @@ export const addTransactionCapability = (state, logger, { maxCommitRetries, dela
227
228
  }
228
229
  },
229
230
  isInTransaction,
231
+ disposeTransactionStorage: () => {
232
+ txStorage.disable();
233
+ },
230
234
  transaction: async (work, key) => {
231
235
  const existing = txStorage.getStore();
232
236
  // Nested transaction - reuse existing context
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/browser-utils */
1
2
  import type { BrowsersMap } from '../Types/index.js';
2
3
  export declare const Browsers: BrowsersMap;
3
4
  export declare const getPlatformId: (browser: string) => string;
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/browser-utils */
1
2
  import { platform, release } from 'os';
2
3
  import { proto } from '../../WAProto/index.js';
3
4
  import { hostOsLabel } from './platform-identity.js';
@@ -28,9 +29,9 @@ export const Browsers = {
28
29
  linux: browser => ['Linux', browser, '6.12.44'],
29
30
  baileys: browser => ['Baileys', browser, '6.5.0'],
30
31
  /** identitas companion BibzWhats (tampil di daftar perangkat tertaut) */
31
- whatsbibz: browser => ['WhatsBibz', browser, '1.4.0'],
32
+ whatsbibz: browser => ['WhatsBibz', browser, '1.4.3'],
32
33
  /** alias lama */
33
- bibzwhats: browser => ['WhatsBibz', browser, '1.4.0'],
34
+ bibzwhats: browser => ['WhatsBibz', browser, '1.4.3'],
34
35
  windows: browser => ['Windows', browser, '10.0.22631'],
35
36
  /** eksperimental (upstream #2201): companion Android — bisa menerima view-once */
36
37
  android: browser => [browser, 'Android', ''],
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/business */
1
2
  import type { CatalogCollection, OrderDetails, Product, ProductCreate, ProductUpdate, WAMediaUpload, WAMediaUploadFunction } from '../Types/index.js';
2
3
  import { type BinaryNode } from '../WABinary/index.js';
3
4
  export declare const parseCatalogNode: (node: BinaryNode) => {
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/business */
1
2
  import { Boom } from '@hapi/boom';
2
3
  import { createHash } from 'crypto';
3
4
  import { createWriteStream, promises as fs } from 'fs';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/chat-utils */
1
2
  import { proto } from '../../WAProto/index.js';
2
3
  import type { BaileysEventEmitter, ChatModification, ChatMutation, Contact, InitialAppStateSyncOptions, LTHashState, WAPatchCreate, WAPatchName } from '../Types/index.js';
3
4
  import { type BinaryNode } from '../WABinary/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/chat-utils */
1
2
  import { Boom } from '@hapi/boom';
2
3
  import { expandAppStateKeys } from 'whatsapp-rust-bridge';
3
4
  import { proto } from '../../WAProto/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/companion-reg-client-utils */
1
2
  import type { BinaryNode } from '../WABinary/index.js';
2
3
  import type { AuthenticationCreds } from '../Types/index.js';
3
4
  import type { ILogger } from './logger.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/companion-reg-client-utils */
1
2
  // BibzWhats — penanganan `companion_reg_refresh` (bawaan, bukan patch eksternal).
2
3
  //
3
4
  // Sejak 2026-07-28 server WhatsApp mengirim notification `companion_reg_refresh`
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/crypto */
1
2
  import type { KeyPair } from '../Types/index.js';
2
3
  export interface HkdfInfo {
3
4
  salt?: Uint8Array;
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/crypto */
1
2
  import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes } from 'crypto';
2
3
  import * as curve from 'libsignal/src/curve.js';
3
4
  import { KEY_BUNDLE_TYPE } from '../Defaults/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/decode-wa-message */
1
2
  import type { WAMessage } from '../Types/index.js';
2
3
  import type { SignalRepositoryWithLIDStore } from '../Types/Signal.js';
3
4
  import { type BinaryNode } from '../WABinary/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/decode-wa-message */
1
2
  import { Boom } from '@hapi/boom';
2
3
  import { proto } from '../../WAProto/index.js';
3
4
  import { areJidsSameUser, isHostedLidUser, isHostedPnUser, isJidBroadcast, isJidGroup, isJidMetaAI, isJidNewsletter, isJidStatusBroadcast, isLidUser, isPnUser
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/event-buffer */
1
2
  import type { BaileysEventEmitter, BaileysEventMap } from '../Types/index.js';
2
3
  import type { ILogger } from './logger.js';
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/event-buffer */
1
2
  import EventEmitter from 'events';
2
3
  import { WAMessageStatus } from '../Types/index.js';
3
4
  import { trimUndefined } from './generics.js';
@@ -379,7 +380,11 @@ eventData, logger) {
379
380
  }
380
381
  if (data.messageUpdates[key]) {
381
382
  logger.debug('absorbed prior message update in message upsert');
383
+ const { messageTimestamp } = message;
382
384
  Object.assign(message, data.messageUpdates[key].update);
385
+ if (messageTimestamp !== undefined && message.messageTimestamp === undefined) {
386
+ message.messageTimestamp = messageTimestamp;
387
+ }
383
388
  delete data.messageUpdates[key];
384
389
  }
385
390
  if (data.historySets.messages[key]) {
@@ -399,7 +404,11 @@ eventData, logger) {
399
404
  const keyStr = stringifyMessageKey(key);
400
405
  const existing = data.historySets.messages[keyStr] || data.messageUpserts[keyStr]?.message;
401
406
  if (existing) {
407
+ const { messageTimestamp } = existing;
402
408
  Object.assign(existing, update);
409
+ if (messageTimestamp !== undefined && existing.messageTimestamp === undefined) {
410
+ existing.messageTimestamp = messageTimestamp;
411
+ }
403
412
  // if the message was received & read by us
404
413
  // the chat counter must have been incremented
405
414
  // so we need to decrement it
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/generics */
1
2
  import { proto } from '../../WAProto/index.js';
2
3
  import type { BaileysEventEmitter, BaileysEventMap, ConnectionState, WACallUpdateType, WAMessageKey, WAVersion } from '../Types/index.js';
3
4
  import { type BinaryNode } from '../WABinary/index.js';
@@ -1,7 +1,8 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/generics */
1
2
  import { Boom } from '@hapi/boom';
2
3
  import { createHash, randomBytes } from 'crypto';
3
4
  import { proto } from '../../WAProto/index.js';
4
- const bibzWhatsVersion = [2, 3000, 1046874154];
5
+ const bibzWhatsVersion = [2, 3000, 1051141409];
5
6
  import { DisconnectReason } from '../Types/index.js';
6
7
  import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
7
8
  import { sha256 } from './crypto.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/history */
1
2
  import { proto } from '../../WAProto/index.js';
2
3
  import type { Chat, Contact, LIDMapping, WAMessage } from '../Types/index.js';
3
4
  import type { ILogger } from './logger.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/history */
1
2
  import { promisify } from 'util';
2
3
  import { inflate } from 'zlib';
3
4
  import { proto } from '../../WAProto/index.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/identity-change-handler */
1
2
  import NodeCache from '@cacheable/node-cache';
2
3
  import { type BinaryNode } from '../WABinary/index.js';
3
4
  import type { ILogger } from './logger.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/identity-change-handler */
1
2
  import NodeCache from '@cacheable/node-cache';
2
3
  import { areJidsSameUser, getBinaryNodeChild, jidDecode } from '../WABinary/index.js';
3
4
  import { isStringNullOrEmpty } from './generics.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/index */
1
2
  export * from "./generics.js";
2
3
  export * from "./decode-wa-message.js";
3
4
  export * from "./messages.js";
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/index */
1
2
  export * from './generics.js';
2
3
  export * from './decode-wa-message.js';
3
4
  export * from './messages.js';
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/link-preview */
1
2
  import type { WAMediaUploadFunction, WAUrlInfo } from '../Types/index.js';
2
3
  import type { ILogger } from './logger.js';
3
4
  export type URLGenerationOptions = {
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/link-preview */
1
2
  import { prepareWAMessageMedia } from './messages.js';
2
3
  import { extractImageThumb, getHttpStream } from './messages-media.js';
3
4
  const THUMBNAIL_WIDTH_PX = 192;
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/logger */
1
2
  import P from 'pino';
2
3
  export interface ILogger {
3
4
  level: string;
@@ -1,2 +1,3 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/logger */
1
2
  import P from 'pino';
2
3
  export default P({ timestamp: () => `,"time":"${new Date().toJSON()}"` });
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/lt-hash */
1
2
  /**
2
3
  * LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data
3
4
  * over a series of mutations. You can add/remove mutations and it'll return a hash equal to
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/lt-hash */
1
2
  import { LTHashAntiTampering } from 'whatsapp-rust-bridge';
2
3
  /**
3
4
  * LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/make-mutex */
1
2
  export declare const makeMutex: () => {
2
3
  mutex<T>(code: () => Promise<T> | T): Promise<T>;
3
4
  };
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/make-mutex */
1
2
  import { Mutex as AsyncMutex } from 'async-mutex';
2
3
  export const makeMutex = () => {
3
4
  const mutex = new AsyncMutex();
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/message-retry-manager */
1
2
  import type { proto } from '../../WAProto/index.js';
2
3
  import type { ILogger } from './logger.js';
3
4
  export interface RecentMessageKey {
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/message-retry-manager */
1
2
  import { LRUCache } from 'lru-cache';
2
3
  /** Number of sent messages to cache in memory for handling retry receipts */
3
4
  const RECENT_MESSAGES_SIZE = 512;
@@ -1,3 +1,4 @@
1
+ /** @module @xbibzlibrary/whatsbibz/lib/Utils/messages-media */
1
2
  import { Boom } from '@hapi/boom';
2
3
  import type { Agent } from 'https';
3
4
  import { Readable } from 'stream';