cuki-bailx 1.2.5 → 2.0.7

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 (154) hide show
  1. package/WAProto/AICommon.js +27981 -0
  2. package/WAProto/AICommon.proto +713 -0
  3. package/WAProto/Ephemeral.js +295 -0
  4. package/WAProto/Ephemeral.proto +7 -0
  5. package/WAProto/GenerateStatics.sh +4 -0
  6. package/WAProto/WAProto.proto +4775 -0
  7. package/WAProto/cuki.js +7 -0
  8. package/WAProto/index.js +56886 -17506
  9. package/lib/Defaults/baileys-version.json +2 -2
  10. package/lib/Defaults/index.js +117 -102
  11. package/lib/Socket/Client/index.js +2 -3
  12. package/lib/Socket/Client/{web-socket-client.js → websocket.js} +54 -5
  13. package/lib/Socket/chats.js +97 -90
  14. package/lib/Socket/groups.js +20 -5
  15. package/lib/Socket/index.js +2 -2
  16. package/lib/Socket/messages-recv.js +9 -65
  17. package/lib/Socket/messages-send.js +612 -286
  18. package/lib/Socket/newsletter.js +68 -41
  19. package/lib/Socket/{dugong.js → setup.js} +5 -13
  20. package/lib/Socket/socket.js +58 -32
  21. package/lib/Store/index.js +1 -3
  22. package/lib/Store/make-in-memory-store.js +26 -14
  23. package/lib/Store/make-ordered-dictionary.js +2 -2
  24. package/lib/Types/Label.js +1 -1
  25. package/lib/Types/LabelAssociation.js +1 -1
  26. package/lib/Types/Message.js +0 -2
  27. package/lib/Types/Newsletter.js +3 -17
  28. package/lib/Types/index.js +2 -2
  29. package/lib/Utils/auth-utils.js +6 -13
  30. package/lib/Utils/business.js +2 -2
  31. package/lib/Utils/chat-utils.js +36 -35
  32. package/lib/Utils/crypto.js +71 -29
  33. package/lib/Utils/decode-wa-message.js +65 -56
  34. package/lib/Utils/event-buffer.js +11 -7
  35. package/lib/Utils/generics.js +73 -23
  36. package/lib/Utils/history.js +4 -6
  37. package/lib/Utils/link-preview.js +34 -1
  38. package/lib/Utils/lt-hash.js +6 -6
  39. package/lib/Utils/messages-media.js +479 -161
  40. package/lib/Utils/messages.js +391 -77
  41. package/lib/Utils/noise-handler.js +19 -23
  42. package/lib/Utils/signal.js +47 -36
  43. package/lib/Utils/use-multi-file-auth-state.js +51 -6
  44. package/lib/Utils/validate-connection.js +94 -66
  45. package/lib/WABinary/constants.js +1276 -13
  46. package/lib/WABinary/decode.js +26 -13
  47. package/lib/WABinary/encode.js +39 -17
  48. package/lib/WABinary/generic-utils.js +2 -85
  49. package/lib/WABinary/jid-utils.js +12 -5
  50. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
  51. package/lib/index.js +18 -5
  52. package/package.json +100 -105
  53. package/engine-requirements.js +0 -10
  54. package/lib/Defaults/index.d.ts +0 -53
  55. package/lib/Defaults/phonenumber-mcc.json +0 -223
  56. package/lib/Signal/Group/ciphertext-message.d.ts +0 -9
  57. package/lib/Signal/Group/group-session-builder.d.ts +0 -14
  58. package/lib/Signal/Group/group_cipher.d.ts +0 -17
  59. package/lib/Signal/Group/index.d.ts +0 -11
  60. package/lib/Signal/Group/keyhelper.d.ts +0 -10
  61. package/lib/Signal/Group/queue-job.d.ts +0 -1
  62. package/lib/Signal/Group/sender-chain-key.d.ts +0 -13
  63. package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -16
  64. package/lib/Signal/Group/sender-key-message.d.ts +0 -18
  65. package/lib/Signal/Group/sender-key-name.d.ts +0 -17
  66. package/lib/Signal/Group/sender-key-record.d.ts +0 -30
  67. package/lib/Signal/Group/sender-key-state.d.ts +0 -38
  68. package/lib/Signal/Group/sender-message-key.d.ts +0 -11
  69. package/lib/Signal/libsignal.d.ts +0 -3
  70. package/lib/Socket/Client/abstract-socket-client.d.ts +0 -17
  71. package/lib/Socket/Client/index.d.ts +0 -3
  72. package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
  73. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  74. package/lib/Socket/Client/web-socket-client.d.ts +0 -12
  75. package/lib/Socket/business.d.ts +0 -171
  76. package/lib/Socket/chats.d.ts +0 -80
  77. package/lib/Socket/dugong.d.ts +0 -219
  78. package/lib/Socket/groups.d.ts +0 -115
  79. package/lib/Socket/index.d.ts +0 -173
  80. package/lib/Socket/messages-recv.d.ts +0 -161
  81. package/lib/Socket/messages-send.d.ts +0 -149
  82. package/lib/Socket/newsletter.d.ts +0 -134
  83. package/lib/Socket/registration.d.ts +0 -267
  84. package/lib/Socket/registration.js +0 -166
  85. package/lib/Socket/socket.d.ts +0 -43
  86. package/lib/Socket/socket.js.bak +0 -630
  87. package/lib/Socket/usync.d.ts +0 -36
  88. package/lib/Store/index.d.ts +0 -3
  89. package/lib/Store/make-cache-manager-store.d.ts +0 -13
  90. package/lib/Store/make-cache-manager-store.js +0 -83
  91. package/lib/Store/make-in-memory-store.d.ts +0 -118
  92. package/lib/Store/make-ordered-dictionary.d.ts +0 -13
  93. package/lib/Store/object-repository.d.ts +0 -10
  94. package/lib/Types/Auth.d.ts +0 -110
  95. package/lib/Types/Call.d.ts +0 -13
  96. package/lib/Types/Chat.d.ts +0 -102
  97. package/lib/Types/Contact.d.ts +0 -19
  98. package/lib/Types/Events.d.ts +0 -157
  99. package/lib/Types/GroupMetadata.d.ts +0 -55
  100. package/lib/Types/Label.d.ts +0 -35
  101. package/lib/Types/LabelAssociation.d.ts +0 -29
  102. package/lib/Types/Message.d.ts +0 -273
  103. package/lib/Types/Newsletter.d.ts +0 -92
  104. package/lib/Types/Product.d.ts +0 -78
  105. package/lib/Types/Signal.d.ts +0 -57
  106. package/lib/Types/Socket.d.ts +0 -111
  107. package/lib/Types/State.d.ts +0 -27
  108. package/lib/Types/USync.d.ts +0 -25
  109. package/lib/Types/index.d.ts +0 -57
  110. package/lib/Utils/auth-utils.d.ts +0 -18
  111. package/lib/Utils/baileys-event-stream.d.ts +0 -16
  112. package/lib/Utils/business.d.ts +0 -22
  113. package/lib/Utils/chat-utils.d.ts +0 -71
  114. package/lib/Utils/crypto.d.ts +0 -41
  115. package/lib/Utils/decode-wa-message.d.ts +0 -19
  116. package/lib/Utils/event-buffer.d.ts +0 -35
  117. package/lib/Utils/generics.d.ts +0 -92
  118. package/lib/Utils/history.d.ts +0 -15
  119. package/lib/Utils/index.d.ts +0 -17
  120. package/lib/Utils/link-preview.d.ts +0 -21
  121. package/lib/Utils/logger.d.ts +0 -4
  122. package/lib/Utils/lt-hash.d.ts +0 -12
  123. package/lib/Utils/make-mutex.d.ts +0 -7
  124. package/lib/Utils/messages-media.d.ts +0 -116
  125. package/lib/Utils/messages.d.ts +0 -77
  126. package/lib/Utils/noise-handler.d.ts +0 -21
  127. package/lib/Utils/process-message.d.ts +0 -41
  128. package/lib/Utils/signal.d.ts +0 -32
  129. package/lib/Utils/use-multi-file-auth-state.d.ts +0 -13
  130. package/lib/Utils/validate-connection.d.ts +0 -11
  131. package/lib/WABinary/constants.d.ts +0 -27
  132. package/lib/WABinary/decode.d.ts +0 -7
  133. package/lib/WABinary/encode.d.ts +0 -3
  134. package/lib/WABinary/generic-utils.d.ts +0 -16
  135. package/lib/WABinary/index.d.ts +0 -5
  136. package/lib/WABinary/jid-utils.d.ts +0 -31
  137. package/lib/WABinary/types.d.ts +0 -18
  138. package/lib/WAM/BinaryInfo.d.ts +0 -17
  139. package/lib/WAM/constants.d.ts +0 -38
  140. package/lib/WAM/encode.d.ts +0 -3
  141. package/lib/WAM/index.d.ts +0 -3
  142. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -9
  143. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -22
  144. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -12
  145. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -12
  146. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -25
  147. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -8
  148. package/lib/WAUSync/Protocols/index.d.ts +0 -4
  149. package/lib/WAUSync/USyncQuery.d.ts +0 -28
  150. package/lib/WAUSync/USyncUser.d.ts +0 -12
  151. package/lib/WAUSync/index.d.ts +0 -3
  152. package/lib/index.d.ts +0 -12
  153. package/lib/index.js.bak +0 -48
  154. /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
@@ -15,21 +15,33 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.decodeBinaryNode = exports.decodeDecompressedBinaryNode = exports.decompressingIfRequired = void 0;
37
+ const util_1 = require("util");
27
38
  const zlib_1 = require("zlib");
28
39
  const constants = __importStar(require("./constants"));
29
40
  const jid_utils_1 = require("./jid-utils");
30
- const decompressingIfRequired = (buffer) => {
41
+ const inflatePromise = (0, util_1.promisify)(zlib_1.inflate);
42
+ const decompressingIfRequired = async (buffer) => {
31
43
  if (2 & buffer.readUInt8()) {
32
- buffer = (0, zlib_1.inflateSync)(buffer.slice(1));
44
+ buffer = await inflatePromise(buffer.slice(1));
33
45
  }
34
46
  else { // nodes with no compression have a 0x00 prefix, we remove that
35
47
  buffer = buffer.slice(1);
@@ -144,10 +156,11 @@ const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0 }) =>
144
156
  throw new Error('invalid jid pair: ' + i + ', ' + j);
145
157
  };
146
158
  const readAdJid = () => {
147
- const agent = readByte();
159
+ const rawDomainType = readByte();
160
+ const domainType = Number(rawDomainType);
148
161
  const device = readByte();
149
162
  const user = readString(readByte());
150
- return (0, jid_utils_1.jidEncode)(user, agent === 0 ? 's.whatsapp.net' : 'lid', device);
163
+ return (0, jid_utils_1.jidEncode)(user, domainType === 0 || domainType === 128 ? 's.whatsapp.net' : 'lid', device);
151
164
  };
152
165
  const readString = (tag) => {
153
166
  if (tag >= 1 && tag < SINGLE_BYTE_TOKENS.length) {
@@ -245,8 +258,8 @@ const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0 }) =>
245
258
  };
246
259
  };
247
260
  exports.decodeDecompressedBinaryNode = decodeDecompressedBinaryNode;
248
- const decodeBinaryNode = (buff) => {
249
- const decompBuff = (0, exports.decompressingIfRequired)(buff);
261
+ const decodeBinaryNode = async (buff) => {
262
+ const decompBuff = await (0, exports.decompressingIfRequired)(buff);
250
263
  return (0, exports.decodeDecompressedBinaryNode)(decompBuff, constants);
251
264
  };
252
265
  exports.decodeBinaryNode = decodeBinaryNode;
@@ -15,18 +15,33 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.encodeBinaryNode = void 0;
27
37
  const constants = __importStar(require("./constants"));
28
38
  const jid_utils_1 = require("./jid-utils");
29
- const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0]) => {
39
+ const encodeBinaryNode = (node, opts = constants, buffer = [0]) => {
40
+ const encoded = encodeBinaryNodeInner(node, opts, buffer);
41
+ return Buffer.from(encoded);
42
+ };
43
+ exports.encodeBinaryNode = encodeBinaryNode;
44
+ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
30
45
  const { TAGS, TOKEN_MAP } = opts;
31
46
  const pushByte = (value) => buffer.push(value & 0xff);
32
47
  const pushInt = (value, n, littleEndian = false) => {
@@ -134,7 +149,7 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
134
149
  }
135
150
  };
136
151
  const isNibble = (str) => {
137
- if (str.length > TAGS.PACKED_MAX) {
152
+ if (!str || str.length > TAGS.PACKED_MAX) {
138
153
  return false;
139
154
  }
140
155
  for (let i = 0; i < str.length; i++) {
@@ -147,19 +162,23 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
147
162
  return true;
148
163
  };
149
164
  const isHex = (str) => {
150
- if (str.length > TAGS.PACKED_MAX) {
165
+ if (!str || str.length > TAGS.PACKED_MAX) {
151
166
  return false;
152
167
  }
153
168
  for (let i = 0; i < str.length; i++) {
154
169
  const char = str[i];
155
170
  const isInNibbleRange = char >= '0' && char <= '9';
156
- if (!isInNibbleRange && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f')) {
171
+ if (!isInNibbleRange && !(char >= 'A' && char <= 'F')) {
157
172
  return false;
158
173
  }
159
174
  }
160
175
  return true;
161
176
  };
162
177
  const writeString = (str) => {
178
+ if (str === undefined || str === null) {
179
+ pushByte(TAGS.LIST_EMPTY);
180
+ return;
181
+ }
163
182
  const tokenIndex = TOKEN_MAP[str];
164
183
  if (tokenIndex) {
165
184
  if (typeof tokenIndex.dict === 'number') {
@@ -195,7 +214,10 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
195
214
  pushInt16(listSize);
196
215
  }
197
216
  };
198
- const validAttributes = Object.keys(attrs).filter(k => (typeof attrs[k] !== 'undefined' && attrs[k] !== null));
217
+ if (!tag) {
218
+ throw new Error('Invalid node: tag cannot be undefined');
219
+ }
220
+ const validAttributes = Object.keys(attrs || {}).filter(k => (typeof attrs[k] !== 'undefined' && attrs[k] !== null));
199
221
  writeListStart(2 * validAttributes.length + 1 + (typeof content !== 'undefined' ? 1 : 0));
200
222
  writeString(tag);
201
223
  for (const key of validAttributes) {
@@ -212,9 +234,10 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
212
234
  pushBytes(content);
213
235
  }
214
236
  else if (Array.isArray(content)) {
215
- writeListStart(content.length);
216
- for (const item of content) {
217
- (0, exports.encodeBinaryNode)(item, opts, buffer);
237
+ const validContent = content.filter(item => item && (item.tag || Buffer.isBuffer(item) || item instanceof Uint8Array || typeof item === 'string'));
238
+ writeListStart(validContent.length);
239
+ for (const item of validContent) {
240
+ encodeBinaryNodeInner(item, opts, buffer);
218
241
  }
219
242
  }
220
243
  else if (typeof content === 'undefined') {
@@ -223,6 +246,5 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
223
246
  else {
224
247
  throw new Error(`invalid children for header "${tag}": ${content} (${typeof content})`);
225
248
  }
226
- return Buffer.from(buffer);
249
+ return buffer;
227
250
  };
228
- exports.encodeBinaryNode = encodeBinaryNode;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.binaryNodeToString = exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
3
+ exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
4
+ exports.binaryNodeToString = binaryNodeToString;
4
5
  const boom_1 = require("@hapi/boom");
5
6
  const WAProto_1 = require("../../WAProto");
6
- const Utils_1 = require("../Utils")
7
7
  // some extra useful utilities
8
8
  const getBinaryNodeChildren = (node, childTag) => {
9
9
  if (Array.isArray(node === null || node === void 0 ? void 0 : node.content)) {
@@ -108,86 +108,3 @@ function binaryNodeToString(node, i = 0) {
108
108
  const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>';
109
109
  return tag + content;
110
110
  }
111
- exports.binaryNodeToString = binaryNodeToString;
112
- const getBinaryFilteredBizBot = (nodeContent) => {
113
- if (!Array.isArray(nodeContent)) return false
114
-
115
- return nodeContent.some(b =>
116
- ['bot'].includes(b?.tag) && b?.attrs?.biz_bot === '1'
117
- )
118
- }
119
- exports.getBinaryFilteredBizBot = getBinaryFilteredBizBot;
120
- const getBinaryNodeFilter = (node) => {
121
- if (!Array.isArray(node)) return false
122
-
123
- return node.some(item =>
124
- ['native_flow'].includes(item?.content?.[0]?.content?.[0]?.tag) ||
125
- ['interactive', 'buttons', 'list'].includes(item?.content?.[0]?.tag) ||
126
- ['hsm', 'biz'].includes(item?.tag) ||
127
- ['bot'].includes(item?.tag) && item?.attrs?.biz_bot === '1'
128
- )
129
- }
130
- exports.getBinaryNodeFilter = getBinaryNodeFilter;
131
- const getAdditionalNode = (name) => {
132
- if (name) name = name.toLowerCase()
133
- const ts = Utils_1.unixTimestampSeconds(new Date()) - 77980457
134
-
135
- const flow_name = {
136
- cta_catalog: 'cta_catalog',
137
- mpm: 'mpm',
138
- call_request: 'call_permission_request',
139
- view_catalog: 'automated_greeting_message_view_catalog',
140
- wa_pay_detail: 'wa_payment_transaction_details',
141
- send_location: 'send_location',
142
- }
143
-
144
- if (flow_name[name] || name === 'interactive' || name === 'buttons') {
145
- return [{
146
- tag: 'biz',
147
- attrs: {
148
- actual_actors: '2',
149
- host_storage: '2',
150
- privacy_mode_ts: `${ts}`
151
- },
152
- content: [{
153
- tag: 'engagement',
154
- attrs: {
155
- customer_service_state: 'open',
156
- conversation_state: 'open'
157
- }
158
- }, {
159
- tag: 'interactive',
160
- attrs: {
161
- type: 'native_flow',
162
- v: '1'
163
- },
164
- content: [{
165
- tag: 'native_flow',
166
- attrs: {
167
- v: '9',
168
- name: flow_name[name] ?? 'mixed',
169
- },
170
- content: []
171
- }]
172
- }]
173
- }]
174
- } else {
175
- return [{
176
- tag: 'biz',
177
- attrs: {
178
- actual_actors: '2',
179
- host_storage: '2',
180
- privacy_mode_ts: `${ts}`
181
- },
182
- content: [{
183
- tag: 'engagement',
184
- attrs: {
185
- customer_service_state: 'open',
186
- conversation_state: 'open'
187
- }
188
- }]
189
- }]
190
- }
191
- }
192
- exports.getAdditionalNode = getAdditionalNode;
193
-
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jidNormalizedUser = exports.isJidNewsLetter = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
3
+ exports.getBotJid = exports.jidNormalizedUser = exports.isJidBot = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidNewsletter = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.isJidMetaAi = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.META_AI_JID = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
4
4
  exports.S_WHATSAPP_NET = '@s.whatsapp.net';
5
5
  exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
6
6
  exports.SERVER_JID = 'server@c.us';
7
7
  exports.PSA_WID = '0@c.us';
8
8
  exports.STORIES_JID = 'status@broadcast';
9
+ exports.META_AI_JID = '13135550002@c.us';
9
10
  const jidEncode = (user, server, device, agent) => {
10
11
  return `${user || ''}${!!agent ? `_${agent}` : ''}${!!device ? `:${device}` : ''}@${server}`;
11
12
  };
@@ -20,7 +21,7 @@ const jidDecode = (jid) => {
20
21
  const [userAgent, device] = userCombined.split(':');
21
22
  const user = userAgent.split('_')[0];
22
23
  return {
23
- server,
24
+ server: server,
24
25
  user,
25
26
  domainType: server === 'lid' ? 1 : 0,
26
27
  device: device ? +device : undefined
@@ -33,6 +34,9 @@ const areJidsSameUser = (jid1, jid2) => {
33
34
  return (((_a = (0, exports.jidDecode)(jid1)) === null || _a === void 0 ? void 0 : _a.user) === ((_b = (0, exports.jidDecode)(jid2)) === null || _b === void 0 ? void 0 : _b.user));
34
35
  };
35
36
  exports.areJidsSameUser = areJidsSameUser;
37
+ /** is the jid Meta IA */
38
+ const isJidMetaAi = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@bot'));
39
+ exports.isJidMetaAi = isJidMetaAi;
36
40
  /** is the jid a user */
37
41
  const isJidUser = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@s.whatsapp.net'));
38
42
  exports.isJidUser = isJidUser;
@@ -42,15 +46,18 @@ exports.isLidUser = isLidUser;
42
46
  /** is the jid a broadcast */
43
47
  const isJidBroadcast = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@broadcast'));
44
48
  exports.isJidBroadcast = isJidBroadcast;
49
+ /** is the jid a newsletter */
50
+ const isJidNewsletter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@newsletter'));
51
+ exports.isJidNewsletter = isJidNewsletter;
45
52
  /** is the jid a group */
46
53
  const isJidGroup = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@g.us'));
47
54
  exports.isJidGroup = isJidGroup;
48
55
  /** is the jid the status broadcast */
49
56
  const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
50
57
  exports.isJidStatusBroadcast = isJidStatusBroadcast;
51
- /** is the jid the newsletter */
52
- const isJidNewsLetter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('newsletter'));
53
- exports.isJidNewsLetter = isJidNewsLetter;
58
+ const botRegexp = /^1313555\d{4}$|^131655500\d{2}$/;
59
+ const isJidBot = (jid) => (jid && botRegexp.test(jid.split('@')[0]) && jid.endsWith('@c.us'));
60
+ exports.isJidBot = isJidBot;
54
61
  const jidNormalizedUser = (jid) => {
55
62
  const result = (0, exports.jidDecode)(jid);
56
63
  if (!result) {
@@ -16,7 +16,7 @@ class USyncDisappearingModeProtocol {
16
16
  return null;
17
17
  }
18
18
  parser(node) {
19
- if (node.tag === 'status') {
19
+ if (node.tag === 'disappearing_mode') {
20
20
  (0, WABinary_1.assertNodeErrorFree)(node);
21
21
  const duration = +(node === null || node === void 0 ? void 0 : node.attrs.duration);
22
22
  const setAt = new Date(+((node === null || node === void 0 ? void 0 : node.attrs.t) || 0) * 1000);
package/lib/index.js CHANGED
@@ -14,12 +14,13 @@ console.log(`
14
14
  ║╚╗║╚╝║║╚╗╔║║╗
15
15
  ╚═╝╚══╝╚╩╝╚══╝
16
16
  `);
17
+ console.log(gradient(['blue', 'cyan'])('Telegram : t.me/cukiii_55'));
17
18
 
18
19
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
20
  if (k2 === undefined) k2 = k;
20
21
  var desc = Object.getOwnPropertyDescriptor(m, k);
21
22
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
- desc = { enumerable: true, get: function() { return m[k]; } };
23
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
24
  }
24
25
  Object.defineProperty(o, k2, desc);
25
26
  }) : (function(o, m, k, k2) {
@@ -27,15 +28,28 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
27
28
  o[k2] = m[k];
28
29
  }));
29
30
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
+ for (var p in m)
32
+ if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p))
33
+ __createBinding(exports, m, p);
31
34
  };
32
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ var __importDefault = (this && this.__importDefault) || function(mod) {
33
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
34
37
  };
38
+
35
39
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.makeWASocket = void 0;
40
+ exports.proto = exports.makeWASocket = void 0;
41
+
42
+ const WAProto_1 = require("../WAProto");
43
+ Object.defineProperty(exports, "proto", {
44
+ enumerable: true,
45
+ get: function() {
46
+ return WAProto_1.proto;
47
+ }
48
+ });
49
+
37
50
  const Socket_1 = __importDefault(require("./Socket"));
38
51
  exports.makeWASocket = Socket_1.default;
52
+
39
53
  __exportStar(require("../WAProto"), exports);
40
54
  __exportStar(require("./Utils"), exports);
41
55
  __exportStar(require("./Types"), exports);
@@ -46,4 +60,3 @@ __exportStar(require("./WAM"), exports);
46
60
  __exportStar(require("./WAUSync"), exports);
47
61
 
48
62
  exports.default = Socket_1.default;
49
-
package/package.json CHANGED
@@ -1,110 +1,105 @@
1
1
  {
2
- "name": "cuki-bailx",
3
- "version": "1.2.5",
4
- "description": "Simple whatsapp baileys",
5
- "keywords": [
6
- "whatsapp",
7
- "laurine-wabot",
8
- "baileys",
9
- "whatsapp-web",
10
- "whatsapp-chat",
11
- "whatsapp-group",
12
- "botwa",
13
- "cuki"
14
- ],
15
- "homepage": "—",
16
- "repository": {
17
- "url": "—"
2
+ "name": "cuki-bailx",
3
+ "version": "2.0.7",
4
+ "description": "whatsapp baileys mod by cuki",
5
+ "keywords": [
6
+ "baileys",
7
+ "baileys-mod",
8
+ "cuki-bailx",
9
+ "cuki digital",
10
+ "whatsapp",
11
+ "whatsapp-api",
12
+ "whatsapp-web",
13
+ "whatsapp-bot",
14
+ "automation",
15
+ "multi-device",
16
+ "Hutao-Md"
17
+ ],
18
+ "homepage": "https://whatsapp.com/channel/0029Vb6VdC18Pgs9uRZAra3b",
19
+ "license": "MIT",
20
+ "author": "CukiDigital",
21
+ "main": "./lib/index.js",
22
+ "files": [
23
+ "lib/*",
24
+ "WAProto/*"
25
+ ],
26
+ "scripts": {
27
+ "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
28
+ "changelog:preview": "conventional-changelog -p angular -u",
29
+ "changelog:last": "conventional-changelog -p angular -r 2",
30
+ "gen:protobuf": "sh WAProto/GenerateStatics.sh",
31
+ "example": "node --inspect Example/example.js",
32
+ "lint": "eslint src --ext .js",
33
+ "lint:fix": "yarn lint --fix",
34
+ "release": "release-it",
35
+ "test": "jest"
36
+ },
37
+ "dependencies": {
38
+ "@adiwajshing/keyed-db": "^0.2.4",
39
+ "@cacheable/node-cache": "^1.4.0",
40
+ "@hapi/boom": "^9.1.3",
41
+ "acorn": "^8.15.0",
42
+ "acorn-walk": "^8.3.4",
43
+ "async-mutex": "^0.5.0",
44
+ "audio-decode": "^2.1.3",
45
+ "axios": "^1.6.0",
46
+ "cache-manager": "^5.7.6",
47
+ "chalk": "^4.1.2",
48
+ "cheerio": "^1.0.0-rc.10",
49
+ "gradient-string": "^2.0.2",
50
+ "libphonenumber-js": "^1.10.20",
51
+ "libsignal": "npm:@10.vyzensja/lib-signal",
52
+ "lodash": "^4.17.21",
53
+ "music-metadata": "^7.12.3",
54
+ "pino": "^9.6",
55
+ "protobufjs": "^6.11.3",
56
+ "uuid": "^10.0.0",
57
+ "ws": "^8.13.0"
58
+ },
59
+ "devDependencies": {
60
+ "@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
61
+ "@types/got": "^9.6.11",
62
+ "@types/jest": "^27.5.1",
63
+ "@types/node": "^16.18.126",
64
+ "@types/sharp": "^0.29.4",
65
+ "@types/ws": "^8.0.0",
66
+ "conventional-changelog-cli": "^2.2.2",
67
+ "eslint": "^8.0.0",
68
+ "jest": "^27.0.6",
69
+ "jimp": "^0.16.1",
70
+ "json": "^11.0.0",
71
+ "link-preview-js": "^3.0.0",
72
+ "open": "^8.4.2",
73
+ "qrcode-terminal": "^0.12.0",
74
+ "release-it": "^15.10.3",
75
+ "sharp": "^0.34.1",
76
+ "ts-jest": "^27.0.3",
77
+ "ts-node": "^10.8.1",
78
+ "typedoc": "^0.27.9",
79
+ "typescript": "^5.8.2"
80
+ },
81
+ "peerDependencies": {
82
+ "jimp": "^0.16.1",
83
+ "link-preview-js": "^3.0.0",
84
+ "qrcode-terminal": "^0.12.0",
85
+ "sharp": "^0.34.1"
86
+ },
87
+ "peerDependenciesMeta": {
88
+ "jimp": {
89
+ "optional": true
18
90
  },
19
- "license": "MIT",
20
- "author": "Adhiraj Singh",
21
- "main": "lib/index.js",
22
- "types": "lib/index.d.ts",
23
- "files": [
24
- "lib/*",
25
- "WAProto/*.js",
26
- "engine-requirements.js"
27
- ],
28
- "scripts": {
29
- "build:all": "tsc && typedoc",
30
- "build:docs": "typedoc",
31
- "build:tsc": "tsc",
32
- "changelog:last": "conventional-changelog -p angular -r 2",
33
- "changelog:preview": "conventional-changelog -p angular -u",
34
- "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
35
- "example": "node --inspect -r ts-node/register Example/example.ts",
36
- "gen:protobuf": "sh WAProto/GenerateStatics.sh",
37
- "lint": "eslint src --ext .js,.ts,.jsx,.tsx",
38
- "lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
39
- "prepack": "",
40
- "prepare": "",
41
- "preinstall": "node ./engine-requirements.js",
42
- "release": "release-it",
43
- "test": "jest"
91
+ "link-preview-js": {
92
+ "optional": true
44
93
  },
45
- "dependencies": {
46
- "@adiwajshing/keyed-db": "^0.2.4",
47
- "@hapi/boom": "^9.1.3",
48
- "@cacheable/node-cache": "^1.4.0",
49
- "audio-decode": "^2.1.3",
50
- "axios": "^1.3.3",
51
- "cache-manager": "4.0.1",
52
- "chalk": "^4.1.2",
53
- "gradient-string": "^2.0.2",
54
- "futoin-hkdf": "^1.5.1",
55
- "libphonenumber-js": "^1.10.20",
56
- "libsignal": "npm:@shennmine/libsignal-node",
57
- "music-metadata": "^7.12.3",
58
- "node-cache": "^5.1.2",
59
- "pino": "^7.0.0",
60
- "protobufjs": "^7.2.4",
61
- "uuid": "^9.0.0",
62
- "ws": "^8.13.0"
94
+ "qrcode-terminal": {
95
+ "optional": true
63
96
  },
64
- "devDependencies": {
65
- "@adiwajshing/eslint-config": "github:adiwajshing/eslint-config",
66
- "@types/got": "^9.6.11",
67
- "@types/jest": "^27.5.1",
68
- "@types/node": "^16.0.0",
69
- "@types/sharp": "^0.29.4",
70
- "@types/ws": "^8.0.0",
71
- "conventional-changelog-cli": "^2.2.2",
72
- "eslint": "^8.0.0",
73
- "jest": "^27.0.6",
74
- "jimp": "^0.16.1",
75
- "link-preview-js": "^3.0.0",
76
- "open": "^8.4.2",
77
- "qrcode-terminal": "^0.12.0",
78
- "release-it": "^15.10.3",
79
- "sharp": "^0.30.5",
80
- "ts-jest": "^27.0.3",
81
- "ts-node": "^10.8.1",
82
- "typedoc": "^0.24.7",
83
- "typescript": "^4.6.4",
84
- "json": "^11.0.0"
85
- },
86
- "peerDependencies": {
87
- "jimp": "^0.16.1",
88
- "link-preview-js": "^3.0.0",
89
- "qrcode-terminal": "^0.12.0",
90
- "sharp": "^0.32.2"
91
- },
92
- "peerDependenciesMeta": {
93
- "jimp": {
94
- "optional": true
95
- },
96
- "link-preview-js": {
97
- "optional": true
98
- },
99
- "qrcode-terminal": {
100
- "optional": true
101
- },
102
- "sharp": {
103
- "optional": true
104
- }
105
- },
106
- "packageManager": "yarn@1.22.19",
107
- "engines": {
108
- "node": ">=20.0.0"
97
+ "sharp": {
98
+ "optional": true
109
99
  }
110
- }
100
+ },
101
+ "packageManager": "yarn@1.22.19",
102
+ "engines": {
103
+ "node": ">=20.0.0"
104
+ }
105
+ }
@@ -1,10 +0,0 @@
1
- const major = parseInt(process.versions.node.split('.')[0], 10);
2
-
3
- if (major < 20) {
4
- console.error(
5
- `\n❌ This package requires Node.js 20+ to run reliably.\n` +
6
- ` You are using Node.js ${process.versions.node}.\n` +
7
- ` Please upgrade to Node.js 20+ to proceed.\n`
8
- );
9
- process.exit(1);
10
- }