kage-baileys 3.0.6 → 3.2.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 (216) hide show
  1. package/Example/connection.cjs +4 -0
  2. package/README.MD +4726 -48
  3. package/WAProto/WAProto.proto +3395 -415
  4. package/WAProto/compat.cjs +12 -0
  5. package/WAProto/index.d.ts +47104 -19888
  6. package/WAProto/index.js +131979 -57361
  7. package/lib/Addon/http-error.js +43 -0
  8. package/lib/Addon/index.js +32 -0
  9. package/lib/Addon/keyed-db.js +250 -0
  10. package/lib/Addon/link-preview.js +82 -0
  11. package/lib/Defaults/baileys-version.json +3 -0
  12. package/lib/Defaults/connection.js +110 -0
  13. package/lib/Defaults/constants.js +156 -0
  14. package/lib/Defaults/history.js +46 -0
  15. package/lib/Defaults/index.js +230 -0
  16. package/lib/Defaults/media.js +104 -0
  17. package/lib/Defaults/phonenumber-mcc.json +223 -0
  18. package/lib/Defaults/prefix.js +44 -0
  19. package/lib/Extensions/business-advanced.js +382 -0
  20. package/lib/Extensions/business.js +159 -0
  21. package/lib/Extensions/chats-advanced.js +1106 -0
  22. package/lib/Extensions/chats.js +349 -0
  23. package/lib/Extensions/communities-advanced.js +430 -0
  24. package/lib/Extensions/community.js +94 -0
  25. package/lib/Extensions/groups-advanced.js +343 -0
  26. package/lib/Extensions/index.js +30 -0
  27. package/lib/Extensions/messages-recv-advanced.js +1690 -0
  28. package/lib/Extensions/messages-send-advanced.js +622 -0
  29. package/lib/Extensions/messages-send.js +1380 -0
  30. package/lib/Extensions/newsletter-advanced.js +228 -0
  31. package/lib/Extensions/newsletter.js +72 -0
  32. package/lib/Extensions/socket.js +389 -0
  33. package/lib/Modded/message_builder.js +2084 -4
  34. package/lib/Signal/Group/ciphertext-message.js +54 -0
  35. package/lib/Signal/Group/group-session-builder.js +124 -0
  36. package/lib/Signal/Group/group_cipher.js +216 -0
  37. package/lib/Signal/Group/index.js +124 -0
  38. package/lib/Signal/Group/keyhelper.js +108 -0
  39. package/lib/Signal/Group/sender-chain-key.js +83 -0
  40. package/lib/Signal/Group/sender-key-distribution-message.js +157 -0
  41. package/lib/Signal/Group/sender-key-message.js +166 -0
  42. package/lib/Signal/Group/sender-key-name.js +130 -0
  43. package/lib/Signal/Group/sender-key-record.js +113 -0
  44. package/lib/Signal/Group/sender-key-state.js +208 -0
  45. package/lib/Signal/Group/sender-message-key.js +82 -0
  46. package/lib/Signal/libsignal.js +935 -0
  47. package/lib/Signal/lid-mapping.js +545 -1
  48. package/lib/Socket/Client/index.js +60 -0
  49. package/lib/Socket/Client/types.js +51 -0
  50. package/lib/Socket/Client/websocket.js +152 -0
  51. package/lib/Socket/business.js +831 -0
  52. package/lib/Socket/chats.js +2535 -49
  53. package/lib/Socket/communities.js +450 -1
  54. package/lib/Socket/community.js +1022 -0
  55. package/lib/Socket/dugong.js +1 -1
  56. package/lib/Socket/groups.js +747 -0
  57. package/lib/Socket/index.js +60 -2
  58. package/lib/Socket/messages-recv.js +3450 -5
  59. package/lib/Socket/messages-send.js +3123 -0
  60. package/lib/Socket/mex.js +126 -1
  61. package/lib/Socket/newsletter.js +465 -0
  62. package/lib/Socket/socket.js +2217 -1
  63. package/lib/Store/index.js +79 -0
  64. package/lib/Store/make-cache-manager-store.js +186 -0
  65. package/lib/Store/make-in-memory-store.js +878 -0
  66. package/lib/Store/make-ordered-dictionary.js +187 -0
  67. package/lib/Store/object-repository.js +78 -0
  68. package/lib/Types/Auth.js +25 -0
  69. package/lib/Types/Bussines.js +25 -1
  70. package/lib/Types/Call.js +25 -0
  71. package/lib/Types/Chat.js +39 -0
  72. package/lib/Types/Contact.js +25 -0
  73. package/lib/Types/Events.js +25 -0
  74. package/lib/Types/GroupMetadata.js +25 -0
  75. package/lib/Types/Label.js +76 -0
  76. package/lib/Types/LabelAssociation.js +40 -0
  77. package/lib/Types/Message.js +57 -0
  78. package/lib/Types/Mex.js +56 -1
  79. package/lib/Types/MexUpdates.js +46 -0
  80. package/lib/Types/Newsletter.js +56 -0
  81. package/lib/Types/Product.js +25 -0
  82. package/lib/Types/RichType.js +23 -0
  83. package/lib/Types/Signal.js +25 -0
  84. package/lib/Types/Socket.js +25 -0
  85. package/lib/Types/State.js +92 -0
  86. package/lib/Types/USync.js +25 -0
  87. package/lib/Types/index.js +133 -0
  88. package/lib/Utils/auth-utils.js +703 -0
  89. package/lib/Utils/automation-tools.js +51 -16
  90. package/lib/Utils/baileys-event-stream.js +146 -0
  91. package/lib/Utils/browser-utils.js +95 -0
  92. package/lib/Utils/business.js +525 -0
  93. package/lib/Utils/chat-utils.js +1861 -0
  94. package/lib/Utils/companion-reg-client-utils.js +55 -1
  95. package/lib/Utils/crypto.js +355 -0
  96. package/lib/Utils/decode-wa-message.js +709 -0
  97. package/lib/Utils/event-buffer.js +1323 -8
  98. package/lib/Utils/generics.js +945 -1
  99. package/lib/Utils/history.js +266 -0
  100. package/lib/Utils/identity-change-handler.js +62 -1
  101. package/lib/Utils/index.js +114 -0
  102. package/lib/Utils/link-preview.js +179 -0
  103. package/lib/Utils/logger.js +42 -0
  104. package/lib/Utils/lt-hash.js +73 -0
  105. package/lib/Utils/make-mutex.js +104 -0
  106. package/lib/Utils/message-inspector.js +110 -0
  107. package/lib/Utils/message-retry-manager.js +507 -2
  108. package/lib/Utils/messages-media.js +1931 -1
  109. package/lib/Utils/messages.js +3748 -0
  110. package/lib/Utils/noise-handler.js +423 -0
  111. package/lib/Utils/offline-node-processor.js +53 -1
  112. package/lib/Utils/pre-key-manager.js +255 -1
  113. package/lib/Utils/process-message.js +1592 -0
  114. package/lib/Utils/reporting-utils.js +272 -1
  115. package/lib/Utils/rich-message-utils.js +377 -0
  116. package/lib/Utils/rich-messages.js +1 -1
  117. package/lib/Utils/signal.js +437 -0
  118. package/lib/Utils/stanza-ack.js +51 -1
  119. package/lib/Utils/status-refresh.js +37 -0
  120. package/lib/Utils/status-tools.js +4 -2
  121. package/lib/Utils/sync-action-utils.js +63 -1
  122. package/lib/Utils/tc-token-utils.js +185 -1
  123. package/lib/Utils/terminal-banner.js +31 -0
  124. package/lib/Utils/use-multi-file-auth-state.js +271 -0
  125. package/lib/Utils/use-single-file-auth-state.js +108 -0
  126. package/lib/Utils/use-sqlite-auth-state.js +142 -0
  127. package/lib/Utils/validate-connection.js +497 -1
  128. package/lib/Utils/view-once-compat.js +13 -5
  129. package/lib/VoIP/audio-feeder.js +150 -0
  130. package/lib/VoIP/index.js +289 -0
  131. package/lib/VoIP/relay-transport.js +608 -0
  132. package/lib/VoIP/signaling.js +583 -0
  133. package/lib/VoIP/types.js +30 -0
  134. package/lib/VoIP/wasm-engine.js +1261 -2
  135. package/lib/VoIP/worker-bootstrap.js +1090 -2
  136. package/lib/WABinary/constants.js +2805 -0
  137. package/lib/WABinary/decode.js +649 -2
  138. package/lib/WABinary/encode.js +564 -2
  139. package/lib/WABinary/generic-utils.js +401 -0
  140. package/lib/WABinary/index.js +82 -0
  141. package/lib/WABinary/jid-utils.js +290 -0
  142. package/lib/WABinary/types.js +25 -0
  143. package/lib/WAM/BinaryInfo.js +50 -0
  144. package/lib/WAM/constants.js +45747 -0
  145. package/lib/WAM/encode.js +393 -0
  146. package/lib/WAM/index.js +78 -0
  147. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +135 -0
  148. package/lib/WAUSync/Protocols/USyncContactProtocol.js +110 -0
  149. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +142 -0
  150. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +85 -0
  151. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +69 -0
  152. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +107 -0
  153. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +38 -1
  154. package/lib/WAUSync/Protocols/index.js +83 -0
  155. package/lib/WAUSync/USyncQuery.js +241 -2
  156. package/lib/WAUSync/USyncUser.js +86 -0
  157. package/lib/WAUSync/index.js +78 -0
  158. package/lib/assets/wasm/loader.js +1875 -1
  159. package/lib/assets/wasm/worker-modules.js +11047 -1
  160. package/lib/index.d.ts +126 -0
  161. package/lib/index.js +53 -21
  162. package/lib/index.mjs +437 -0
  163. package/licenses/upstream-MIT.txt +22 -0
  164. package/maintenance/api-coverage.json +1642 -0
  165. package/maintenance/archivos-sha256.json +207 -0
  166. package/maintenance/consumer-validation.log +3 -0
  167. package/maintenance/dependency-audit.json +4 -4
  168. package/maintenance/extension-inventory.json +57 -0
  169. package/maintenance/protocol-update.json +1101 -0
  170. package/maintenance/protocol-wire-audit.json +4 -0
  171. package/maintenance/reference-socket-surface.json +209 -0
  172. package/maintenance/resumen-validacion.json +50 -0
  173. package/maintenance/validation.log +2725 -0
  174. package/maintenance/verification.json +566 -0
  175. package/package.json +107 -9
  176. package/scripts/check-imports.cjs +10 -0
  177. package/scripts/check-package.cjs +40 -0
  178. package/scripts/check-syntax.cjs +1 -1
  179. package/scripts/generate-protobuf.cjs +6 -1
  180. package/scripts/generate-public-types.cjs +9 -0
  181. package/scripts/kage-base64-fix.cjs +45 -0
  182. package/scripts/maintenance.cjs +10 -0
  183. package/test/advanced.test.cjs +24 -0
  184. package/test/base64-fix.test.cjs +49 -0
  185. package/test/maintenance.test.cjs +1 -1
  186. package/test/npm-publication.test.cjs +141 -0
  187. package/test/recepcion-reparada.test.cjs +98 -0
  188. package/test/resilience-binary.test.cjs +69 -0
  189. package/test/resilience-transport.test.cjs +34 -0
  190. package/test/types.test.ts +5 -0
  191. package/test/upgrade.test.cjs +104 -0
  192. package/tsconfig.json +20 -0
  193. package/WAProto/p.html +0 -1
  194. package/lib/KageExtra/Modded/message_builder.js +0 -2330
  195. package/lib/KageExtra/VoIP/audio-feeder.js +0 -136
  196. package/lib/KageExtra/VoIP/index.js +0 -282
  197. package/lib/KageExtra/VoIP/relay-transport.js +0 -559
  198. package/lib/KageExtra/VoIP/signaling.js +0 -603
  199. package/lib/KageExtra/VoIP/types.js +0 -17
  200. package/lib/KageExtra/VoIP/wasm-engine.js +0 -1214
  201. package/lib/KageExtra/VoIP/worker-bootstrap.js +0 -1042
  202. package/lib/KageExtra/assets/wasm/loader.js +0 -5
  203. package/lib/KageExtra/assets/wasm/whatsapp.wasm +0 -0
  204. package/lib/KageExtra/assets/wasm/worker-modules.js +0 -273
  205. package/lib/KageExtra/index.js +0 -3
  206. package/lib/KageExtra/package.json +0 -1
  207. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -53
  208. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -24
  209. package/maintenance/revision-full-check.txt +0 -1097
  210. package/maintenance/revision-library-tests.tap +0 -1088
  211. package/maintenance/revision-protobuf.txt +0 -5
  212. package/maintenance/revision-syntax.txt +0 -5
  213. package/maintenance/schema-coverage.json +0 -23
  214. package/maintenance/schema-merge.json +0 -30
  215. package/maintenance/validation-node20.txt +0 -191
  216. package/maintenance/validation-node22.txt +0 -237
@@ -83,3 +83,293 @@ const getBotJid = (jid) => {
83
83
  return mappedNumber ? `${mappedNumber}@s.whatsapp.net` : jid;
84
84
  };
85
85
  exports.getBotJid = getBotJid;
86
+
87
+ // Kage: compatibilidad de API.
88
+ const __kageModule86 = (() => {
89
+ const module = { exports: {} }; const exports = module.exports;
90
+ "use strict"
91
+
92
+ Object.defineProperty(exports, "__esModule", { value: true })
93
+
94
+ const S_WHATSAPP_NET = '@s.whatsapp.net'
95
+
96
+ const OFFICIAL_BIZ_JID = '16505361212@c.us'
97
+
98
+ const SERVER_JID = 'server@c.us'
99
+
100
+ const PSA_WID = '0@c.us'
101
+
102
+ const STORIES_JID = 'status@broadcast'
103
+
104
+ const META_AI_JID = '13135550002@c.us'
105
+
106
+ const WAJIDDomains = {
107
+ WHATSAPP: 0,
108
+ LID: 1,
109
+ HOSTED: 128,
110
+ HOSTED_LID: 129
111
+ }
112
+
113
+ const getServerFromDomainType = (initialServer, domainType) => {
114
+ switch (domainType) {
115
+ case WAJIDDomains.LID:
116
+ return 'lid'
117
+ case WAJIDDomains.HOSTED:
118
+ return 'hosted'
119
+ case WAJIDDomains.HOSTED_LID:
120
+ return 'hosted.lid'
121
+ case WAJIDDomains.WHATSAPP:
122
+ default:
123
+ return initialServer
124
+ }
125
+ }
126
+
127
+ const jidEncode = (user, server, device, agent) => {
128
+ return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server}`
129
+ }
130
+
131
+ const jidDecode = (jid) => {
132
+ // todo: investigate how to implement hosted ids in this case
133
+ const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1
134
+
135
+ if (sepIdx < 0) {
136
+ return undefined
137
+ }
138
+
139
+ const server = jid.slice(sepIdx + 1)
140
+ const userCombined = jid.slice(0, sepIdx)
141
+ const [userAgent, device] = userCombined.split(':')
142
+ const [user, agent] = userAgent.split('_')
143
+
144
+ let domainType = WAJIDDomains.WHATSAPP
145
+
146
+ if (server === 'lid') {
147
+ domainType = WAJIDDomains.LID
148
+ }
149
+ else if (server === 'hosted') {
150
+ domainType = WAJIDDomains.HOSTED
151
+ }
152
+ else if (server === 'hosted.lid') {
153
+ domainType = WAJIDDomains.HOSTED_LID
154
+ }
155
+ else if (agent) {
156
+ domainType = parseInt(agent)
157
+ }
158
+ return {
159
+ server: server,
160
+ user: user,
161
+ domainType,
162
+ device: device ? +device : undefined
163
+ }
164
+ }
165
+
166
+ /** is the jid a user */
167
+ const areJidsSameUser = (jid1, jid2) => jidDecode(jid1)?.user === jidDecode(jid2)?.user
168
+
169
+ /** is the jid Meta AI */
170
+ const isJidMetaAI = (jid) => jid?.endsWith('@bot')
171
+
172
+ /** is the jid a PN user */
173
+ const isPnUser = (jid) => jid?.endsWith('@s.whatsapp.net')
174
+
175
+ /** is the jid a LID */
176
+ const isLidUser = (jid) => jid?.endsWith('@lid')
177
+
178
+ /** is the jid a broadcast */
179
+ const isJidBroadcast = (jid) => jid?.endsWith('@broadcast')
180
+
181
+ /** is the jid a group */
182
+ const isJidGroup = (jid) => jid?.endsWith('@g.us')
183
+
184
+ /** is the jid the status broadcast */
185
+ const isJidStatusBroadcast = (jid) => jid === 'status@broadcast'
186
+
187
+ /** is the jid a newsletter */
188
+ const isJidNewsletter = (jid) => jid?.endsWith('@newsletter')
189
+
190
+ /** is the jid a hosted PN */
191
+ const isHostedPnUser = (jid) => jid?.endsWith('@hosted')
192
+
193
+ /** is the jid a hosted LID */
194
+ const isHostedLidUser = (jid) => jid?.endsWith('@hosted.lid')
195
+
196
+ /** is the jid a bot */
197
+ const botRegexp = /^1313555\d{4}$|^131655500\d{2}$/
198
+ const isJidBot = (jid) => (jid && botRegexp.test(jid.split('@')[0]) && jid.endsWith('@c.us'))
199
+
200
+ const jidNormalizedUser = (jid) => {
201
+ const result = jidDecode(jid)
202
+ if (!result) {
203
+ return ''
204
+ }
205
+ const { user, server } = result
206
+ return jidEncode(user, server === 'c.us' ? 's.whatsapp.net' : server)
207
+ }
208
+
209
+ const transferDevice = (fromJid, toJid) => {
210
+ const fromDecoded = jidDecode(fromJid)
211
+ const deviceId = fromDecoded?.device || 0
212
+ const { server, user } = jidDecode(toJid)
213
+ return jidEncode(user, server, deviceId)
214
+ }
215
+
216
+ module.exports = {
217
+ S_WHATSAPP_NET,
218
+ OFFICIAL_BIZ_JID,
219
+ SERVER_JID,
220
+ PSA_WID,
221
+ STORIES_JID,
222
+ META_AI_JID,
223
+ WAJIDDomains,
224
+ jidEncode,
225
+ jidDecode,
226
+ areJidsSameUser,
227
+ isJidMetaAI,
228
+ isPnUser,
229
+ isLidUser,
230
+ isJidBroadcast,
231
+ isJidGroup,
232
+ isJidStatusBroadcast,
233
+ isJidNewsletter,
234
+ isHostedPnUser,
235
+ isHostedLidUser,
236
+ isJidBot,
237
+ transferDevice,
238
+ jidNormalizedUser,
239
+ getServerFromDomainType
240
+ }
241
+ return module.exports;
242
+ })();
243
+ for (const key of Object.keys(__kageModule86)) {
244
+ if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule86[key]});
245
+ }
246
+
247
+ // Kage: funciones avanzadas.
248
+ const __kageModule195 = (() => {
249
+ const module = { exports: {} }; const exports = module.exports;
250
+ "use strict";
251
+ Object.defineProperty(exports, "__esModule", { value: true });
252
+ exports.transferDevice = exports.jidNormalizedUser = exports.isJidBot = exports.isHostedLidUser = exports.isHostedPnUser = exports.isJidNewsletter = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isPnUser = exports.isJidMetaAI = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.getServerFromDomainType = exports.WAJIDDomains = exports.META_AI_JID = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
253
+ exports.S_WHATSAPP_NET = '@s.whatsapp.net';
254
+ exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
255
+ exports.SERVER_JID = 'server@c.us';
256
+ exports.PSA_WID = '0@c.us';
257
+ exports.STORIES_JID = 'status@broadcast';
258
+ exports.META_AI_JID = '13135550002@c.us';
259
+ (function (WAJIDDomains) {
260
+ WAJIDDomains[WAJIDDomains["WHATSAPP"] = 0] = "WHATSAPP";
261
+ WAJIDDomains[WAJIDDomains["LID"] = 1] = "LID";
262
+ WAJIDDomains[WAJIDDomains["HOSTED"] = 128] = "HOSTED";
263
+ WAJIDDomains[WAJIDDomains["HOSTED_LID"] = 129] = "HOSTED_LID";
264
+ })(exports.WAJIDDomains || (exports.WAJIDDomains = {}));
265
+ const getServerFromDomainType = (initialServer, domainType) => {
266
+ switch (domainType) {
267
+ case exports.WAJIDDomains.LID:
268
+ return 'lid';
269
+ case exports.WAJIDDomains.HOSTED:
270
+ return 'hosted';
271
+ case exports.WAJIDDomains.HOSTED_LID:
272
+ return 'hosted.lid';
273
+ case exports.WAJIDDomains.WHATSAPP:
274
+ default:
275
+ return initialServer;
276
+ }
277
+ };
278
+ exports.getServerFromDomainType = getServerFromDomainType;
279
+ const jidEncode = (user, server, device, agent) => {
280
+ return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server || 'lid'}`;
281
+ };
282
+ exports.jidEncode = jidEncode;
283
+ const jidDecode = (jid) => {
284
+ // todo: investigate how to implement hosted ids in this case
285
+ const sepIdx = typeof jid === 'string' ? jid.indexOf('@') : -1;
286
+ if (sepIdx < 0) {
287
+ return undefined;
288
+ }
289
+ const server = jid.slice(sepIdx + 1);
290
+ const userCombined = jid.slice(0, sepIdx);
291
+ const [userAgent, device] = userCombined.split(':');
292
+ const [user, agent] = userAgent.split('_');
293
+ let domainType = exports.WAJIDDomains.WHATSAPP;
294
+ if (server === 'lid') {
295
+ domainType = exports.WAJIDDomains.LID;
296
+ }
297
+ else if (server === 'hosted') {
298
+ domainType = exports.WAJIDDomains.HOSTED;
299
+ }
300
+ else if (server === 'hosted.lid') {
301
+ domainType = exports.WAJIDDomains.HOSTED_LID;
302
+ }
303
+ else if (agent) {
304
+ domainType = parseInt(agent);
305
+ }
306
+ return {
307
+ server: server,
308
+ user: user,
309
+ domainType,
310
+ device: device ? +device : undefined
311
+ };
312
+ };
313
+ exports.jidDecode = jidDecode;
314
+ /** is the jid a user */
315
+ const areJidsSameUser = (jid1, jid2) => (0, exports.jidDecode)(jid1)?.user === (0, exports.jidDecode)(jid2)?.user;
316
+ exports.areJidsSameUser = areJidsSameUser;
317
+ /** is the jid Meta AI */
318
+ const isJidMetaAI = (jid) => jid?.endsWith('@bot');
319
+ exports.isJidMetaAI = isJidMetaAI;
320
+ /** is the jid a PN user */
321
+ const isPnUser = (jid) => jid?.endsWith('@s.whatsapp.net');
322
+ exports.isPnUser = isPnUser;
323
+ /** is the jid a LID */
324
+ const isLidUser = (jid) => jid?.endsWith('@lid');
325
+ exports.isLidUser = isLidUser;
326
+ /** is the jid a broadcast */
327
+ const isJidBroadcast = (jid) => jid?.endsWith('@broadcast');
328
+ exports.isJidBroadcast = isJidBroadcast;
329
+ /** is the jid a group */
330
+ const isJidGroup = (jid) => jid?.endsWith('@g.us');
331
+ exports.isJidGroup = isJidGroup;
332
+ /** is the jid the status broadcast */
333
+ const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
334
+ exports.isJidStatusBroadcast = isJidStatusBroadcast;
335
+ /** is the jid a newsletter */
336
+ const isJidNewsletter = (jid) => jid?.endsWith('@newsletter');
337
+ exports.isJidNewsletter = isJidNewsletter;
338
+ /** is the jid a hosted PN */
339
+ const isHostedPnUser = (jid) => jid?.endsWith('@hosted');
340
+ exports.isHostedPnUser = isHostedPnUser;
341
+ /** is the jid a hosted LID */
342
+ const isHostedLidUser = (jid) => jid?.endsWith('@hosted.lid');
343
+ exports.isHostedLidUser = isHostedLidUser;
344
+ const botRegexp = /^1313555\d{4}$|^131655500\d{2}$/;
345
+ const isJidBot = (jid) => jid && botRegexp.test(jid.split('@')[0]) && jid.endsWith('@c.us');
346
+ exports.isJidBot = isJidBot;
347
+ const jidNormalizedUser = (jid) => {
348
+ const result = (0, exports.jidDecode)(jid);
349
+ if (!result) {
350
+ return '';
351
+ }
352
+ const { user, server } = result;
353
+ return (0, exports.jidEncode)(user, server === 'c.us' ? 's.whatsapp.net' : server);
354
+ };
355
+ exports.jidNormalizedUser = jidNormalizedUser;
356
+ const transferDevice = (fromJid, toJid) => {
357
+ const fromDecoded = (0, exports.jidDecode)(fromJid);
358
+ const deviceId = fromDecoded?.device || 0;
359
+ const { server, user } = (0, exports.jidDecode)(toJid);
360
+ return (0, exports.jidEncode)(user, server, deviceId);
361
+ };
362
+ exports.transferDevice = transferDevice;
363
+
364
+ return module.exports;
365
+ })();
366
+ for (const key of Object.keys(__kageModule195)) {
367
+ if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule195[key]});
368
+ }
369
+ Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule195, configurable:true});
370
+
371
+ // Kage: superficie pública completa.
372
+ for (const name of ["WAJIDDomains"]) {
373
+ const advanced = exports[Symbol.for('kage.advanced')][name];
374
+ for (const [key, value] of Object.entries(advanced || {})) if (!(key in exports[name])) exports[name][key] = value;
375
+ }
@@ -1,2 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+ // Kage: compatibilidad de API.
5
+ const __kageModule87 = (() => {
6
+ const module = { exports: {} }; const exports = module.exports;
7
+ "use strict"
8
+
9
+ Object.defineProperty(exports, "__esModule", { value: true })
10
+ return module.exports;
11
+ })();
12
+ for (const key of Object.keys(__kageModule87)) {
13
+ if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule87[key]});
14
+ }
15
+
16
+ // Kage: funciones avanzadas.
17
+ const __kageModule196 = (() => {
18
+ const module = { exports: {} }; const exports = module.exports;
19
+ "use strict";
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+
22
+ return module.exports;
23
+ })();
24
+ for (const key of Object.keys(__kageModule196)) {
25
+ if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule196[key]});
26
+ }
27
+ Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule196, configurable:true});
@@ -11,3 +11,53 @@ class BinaryInfo {
11
11
  }
12
12
  }
13
13
  exports.BinaryInfo = BinaryInfo;
14
+
15
+ // Kage: compatibilidad de API.
16
+ const __kageModule88 = (() => {
17
+ const module = { exports: {} }; const exports = module.exports;
18
+ "use strict"
19
+
20
+ Object.defineProperty(exports, "__esModule", { value: true })
21
+
22
+ class BinaryInfo {
23
+ constructor(options = {}) {
24
+ this.protocolVersion = 5
25
+ this.sequence = 0
26
+ this.events = []
27
+ this.buffer = []
28
+ Object.assign(this, options)
29
+ }
30
+ }
31
+
32
+ module.exports = {
33
+ BinaryInfo
34
+ }
35
+ return module.exports;
36
+ })();
37
+ for (const key of Object.keys(__kageModule88)) {
38
+ if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule88[key]});
39
+ }
40
+
41
+ // Kage: funciones avanzadas.
42
+ const __kageModule197 = (() => {
43
+ const module = { exports: {} }; const exports = module.exports;
44
+ "use strict";
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.BinaryInfo = void 0;
47
+ class BinaryInfo {
48
+ constructor(options = {}) {
49
+ this.protocolVersion = 5;
50
+ this.sequence = 0;
51
+ this.events = [];
52
+ this.buffer = [];
53
+ Object.assign(this, options);
54
+ }
55
+ }
56
+ exports.BinaryInfo = BinaryInfo;
57
+
58
+ return module.exports;
59
+ })();
60
+ for (const key of Object.keys(__kageModule197)) {
61
+ if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule197[key]});
62
+ }
63
+ Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule197, configurable:true});