@n4tzz/n4lyx 2.7.8 → 2.7.10

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.
package/WAProto/p.html CHANGED
@@ -1 +1 @@
1
- n4lyx
1
+ wileys
@@ -8,7 +8,7 @@ const WAProto_1 = require("../../WAProto");
8
8
  const libsignal_1 = require("../Signal/libsignal");
9
9
  const browser_utils_1 = require("../Utils/browser-utils");
10
10
  const logger_1 = __importDefault(require("../Utils/logger"));
11
- exports.version = [2, 2413, 51];
11
+ exports.version = [2, 3000, 1033105955];
12
12
  exports.UNAUTHORIZED_CODES = [401, 403, 419];
13
13
  exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
14
14
  exports.CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
@@ -44,7 +44,7 @@ exports.DEFAULT_CONNECTION_CONFIG = {
44
44
  waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
45
45
  connectTimeoutMs: 20_000,
46
46
  keepAliveIntervalMs: 30_000,
47
- logger: logger_1.default.child({ class: 'n4lyx' }),
47
+ logger: logger_1.default.child({ class: 'baileys' }),
48
48
  emitOwnEvents: true,
49
49
  defaultQueryTimeoutMs: 60_000,
50
50
  customUploadHosts: [],
@@ -268,61 +268,6 @@ const makeGroupsSocket = (config) => {
268
268
  groupJoinApprovalMode: async (jid, mode) => {
269
269
  await groupQuery(jid, 'set', [{ tag: 'membership_approval_mode', attrs: {}, content: [{ tag: 'group_join', attrs: { state: mode } }] }]);
270
270
  },
271
- /**
272
- * n4lyx: Tag all members in a group (@everyone / @all)
273
- * @param jid group jid
274
- * @param scope 'all' | 'admins' | 'non_admins' - who gets tagged
275
- * @returns list of participant jids that were mentioned
276
- */
277
- groupTagAll: async (jid, scope = 'all') => {
278
- const metadata = await groupMetadata(jid);
279
- let targets = metadata.participants;
280
- if (scope === 'admins') {
281
- targets = targets.filter(p => p.admin === 'admin' || p.admin === 'superadmin');
282
- } else if (scope === 'non_admins') {
283
- targets = targets.filter(p => !p.admin);
284
- }
285
- return targets.map(p => p.id);
286
- },
287
- /**
288
- * n4lyx: Set group status v2 (extended group status with metadata)
289
- * @param jid group jid
290
- * @param options status options
291
- */
292
- groupSetStatusV2: async (jid, options = {}) => {
293
- const {
294
- duration = 86400,
295
- allowReply = true,
296
- allowReaction = true,
297
- visibility = 'all'
298
- } = options;
299
- await groupQuery(jid, 'set', [
300
- {
301
- tag: 'status_v2',
302
- attrs: {
303
- duration: duration.toString(),
304
- allow_reply: allowReply ? '1' : '0',
305
- allow_reaction: allowReaction ? '1' : '0',
306
- visibility
307
- }
308
- }
309
- ]);
310
- },
311
- /**
312
- * n4lyx: Get group status v2 settings
313
- * @param jid group jid
314
- */
315
- groupGetStatusV2: async (jid) => {
316
- const result = await groupQuery(jid, 'get', [{ tag: 'status_v2', attrs: {} }]);
317
- const statusNode = (0, WABinary_1.getBinaryNodeChild)(result, 'status_v2');
318
- if (!statusNode) return null;
319
- return {
320
- duration: statusNode.attrs.duration ? +statusNode.attrs.duration : 86400,
321
- allowReply: statusNode.attrs.allow_reply === '1',
322
- allowReaction: statusNode.attrs.allow_reaction === '1',
323
- visibility: statusNode.attrs.visibility || 'all'
324
- };
325
- },
326
271
  groupFetchAllParticipating
327
272
  };
328
273
  };
@@ -380,7 +380,7 @@ const makeMessagesRecvSocket = (config) => {
380
380
  break;
381
381
  break;
382
382
  default:
383
- // console.log("N4LYX-DEBUG:", JSON.stringify({ ...child, content: Buffer.isBuffer(child.content) ? child.content.toString() : child.content, participant }, null, 2))
383
+ // console.log("WILEYS-DEBUG:", JSON.stringify({ ...child, content: Buffer.isBuffer(child.content) ? child.content.toString() : child.content, participant }, null, 2))
384
384
  }
385
385
  };
386
386
  const handleNewsletterNotification = (id, node) => {
@@ -812,21 +812,6 @@ const makeMessagesSocket = (config) => {
812
812
  const isKeepMsg = 'keep' in content && content.keep;
813
813
  const isPollMessage = 'poll' in content && !!content.poll;
814
814
  const isAiMsg = 'ai' in content && !!content.ai;
815
- // n4lyx: tagAll - auto-fetch all participant jids and inject into contextInfo
816
- const isTagAll = 'tagAll' in content && !!content.tagAll;
817
- if (isTagAll && (0, WABinary_1.isJidGroup)(jid)) {
818
- try {
819
- const taggedJids = await sock.groupTagAll(jid, content.tagAllScope || 'all');
820
- const [msgType] = Object.keys(fullMsg.message);
821
- if (msgType && fullMsg.message[msgType]) {
822
- fullMsg.message[msgType].contextInfo = fullMsg.message[msgType].contextInfo || {};
823
- fullMsg.message[msgType].contextInfo.mentionedJid = taggedJids;
824
- fullMsg.message[msgType].contextInfo.isTagAll = true;
825
- }
826
- } catch (e) {
827
- logger.warn({ err: e }, 'n4lyx: failed to fetch participants for tagAll');
828
- }
829
- }
830
815
  const additionalAttributes = {};
831
816
  const additionalNodes = [];
832
817
  // required for delete
@@ -65,7 +65,7 @@ exports.default = (config) => {
65
65
  return Object.keys(contacts);
66
66
  };
67
67
  /**
68
- * binds to an N4lyxEventEmitter.
68
+ * binds to a WileysEventEmitter.
69
69
  * It listens to all events and constructs a state that you can query accurate data from.
70
70
  * Eg. can use the store to fetch chats, contacts, messages etc.
71
71
  * @param ev typically the event emitter from the socket connection
@@ -27,14 +27,14 @@ const BUFFERABLE_EVENT_SET = new Set(BUFFERABLE_EVENT);
27
27
  /**
28
28
  * The event buffer logically consolidates different events into a single event
29
29
  * making the data processing more efficient.
30
- * @param ev the n4lyx event emitter
30
+ * @param ev the wileys event emitter
31
31
  */
32
32
  const makeEventBuffer = (logger) => {
33
33
  const ev = new events_1.default();
34
34
  const historyCache = new Set();
35
35
  let data = makeBufferData();
36
36
  let buffersInProgress = 0;
37
- // take the generic event and fire it as an n4lyx event
37
+ // take the generic event and fire it as a wileys event
38
38
  ev.on('event', (map) => {
39
39
  for (const event in map) {
40
40
  ev.emit(event, map[event]);
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestN4lyxVersion = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.generateMessageID = exports.generateMessageIDV2 = exports.delayCancellable = exports.delay = exports.debouncedTimeout = exports.unixTimestampSeconds = exports.toNumber = exports.encodeBigEndian = exports.generateRegistrationId = exports.encodeNewsletterMessage = exports.encodeWAMessage = exports.unpadRandomMax16 = exports.writeRandomPadMax16 = exports.getKeyAuthor = exports.BufferJSON = exports.getPlatformId = exports.Browsers = void 0;
39
+ exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestWileysVersion = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.generateMessageID = exports.generateMessageIDV2 = exports.delayCancellable = exports.delay = exports.debouncedTimeout = exports.unixTimestampSeconds = exports.toNumber = exports.encodeBigEndian = exports.generateRegistrationId = exports.encodeNewsletterMessage = exports.encodeWAMessage = exports.unpadRandomMax16 = exports.writeRandomPadMax16 = exports.getKeyAuthor = exports.BufferJSON = exports.getPlatformId = exports.Browsers = void 0;
40
40
  exports.promiseTimeout = promiseTimeout;
41
41
  exports.bindWaitForEvent = bindWaitForEvent;
42
42
  exports.trimUndefined = trimUndefined;
@@ -46,7 +46,7 @@ const axios_1 = __importDefault(require("axios"));
46
46
  const crypto_1 = require("crypto");
47
47
  const os_1 = require("os");
48
48
  const WAProto_1 = require("../../WAProto");
49
- const n4lyx_version_json_1 = require("../Defaults/n4lyx-version.json");
49
+ const wileys_version_json_1 = require("../Defaults/wileys-version.json");
50
50
  const Types_1 = require("../Types");
51
51
  const WABinary_1 = require("../WABinary");
52
52
  const COMPANION_PLATFORM_MAP = {
@@ -68,7 +68,7 @@ const PLATFORM_MAP = {
68
68
  exports.Browsers = {
69
69
  ubuntu: (browser) => ['Ubuntu', browser, '22.04.4'],
70
70
  macOS: (browser) => ['Mac OS', browser, '14.4.1'],
71
- n4lyx: (browser) => ['N4lyx', browser, '1.0.0'],
71
+ baileys: (browser) => ['Baileys', browser, '6.5.0'],
72
72
  windows: (browser) => ['Windows', browser, '10.0.22631'],
73
73
  /** The appropriate browser based on your OS & release */
74
74
  appropriate: (browser) => [PLATFORM_MAP[(0, os_1.platform)()] || 'Ubuntu', browser, (0, os_1.release)()]
@@ -259,9 +259,9 @@ const printQRIfNecessaryListener = (ev, logger) => {
259
259
  };
260
260
  exports.printQRIfNecessaryListener = printQRIfNecessaryListener;
261
261
 
262
- const fetchLatestN4lyxVersion = async (options = {}) => {
262
+ const fetchLatestWileysVersion = async (options = {}) => {
263
263
  try {
264
- const { data } = await axios_1.default.get('https://registry.npmjs.org/@n4tzz/n4lyx', {
264
+ const { data } = await axios_1.default.get('https://registry.npmjs.org/wileys', {
265
265
  ...options,
266
266
  responseType: 'json'
267
267
  });
@@ -273,17 +273,17 @@ const fetchLatestN4lyxVersion = async (options = {}) => {
273
273
  };
274
274
  } catch (error) {
275
275
  return {
276
- version: n4lyx_version_json_1.version,
276
+ version: wileys_version_json_1.version,
277
277
  isLatest: false,
278
278
  error
279
279
  };
280
280
  }
281
281
  };
282
- exports.fetchLatestN4lyxVersion = fetchLatestN4lyxVersion;
282
+ exports.fetchLatestWileysVersion = fetchLatestWileysVersion;
283
283
 
284
284
  const fetchLatestBaileysVersion = async (options = {}) => {
285
285
  try {
286
- const { data } = await axios_1.default.get('https://registry.npmjs.org/@n4tzz/n4lyx', {
286
+ const { data } = await axios_1.default.get('https://registry.npmjs.org/wileys', {
287
287
  ...options,
288
288
  responseType: 'json'
289
289
  });
@@ -295,7 +295,7 @@ const fetchLatestBaileysVersion = async (options = {}) => {
295
295
  };
296
296
  } catch (error) {
297
297
  return {
298
- version: n4lyx_version_json_1.version,
298
+ version: wileys_version_json_1.version,
299
299
  isLatest: false,
300
300
  error
301
301
  };
@@ -317,7 +317,7 @@ const fetchLatestWaWebVersion = async (options) => {
317
317
  const match = data.match(regex);
318
318
  if (!(match === null || match === void 0 ? void 0 : match[1])) {
319
319
  return {
320
- version: n4lyx_version_json_1.version,
320
+ version: wileys_version_json_1.version,
321
321
  isLatest: false,
322
322
  error: {
323
323
  message: 'Could not find client revision in the fetched content'
@@ -332,7 +332,7 @@ const fetchLatestWaWebVersion = async (options) => {
332
332
  }
333
333
  catch (error) {
334
334
  return {
335
- version: n4lyx_version_json_1.version,
335
+ version: wileys_version_json_1.version,
336
336
  isLatest: false,
337
337
  error
338
338
  };
@@ -367,7 +367,7 @@ const CODE_MAP = {
367
367
  conflict: Types_1.DisconnectReason.connectionReplaced
368
368
  };
369
369
  /**
370
- * Stream errors generally provide a reason, map that to an n4lyx DisconnectReason
370
+ * Stream errors generally provide a reason, map that to a baileys DisconnectReason
371
371
  * @param reason the string reason given, eg. "conflict"
372
372
  */
373
373
  const getErrorCodeFromStreamError = (node) => {
@@ -26,7 +26,7 @@ __exportStar(require("./history"), exports);
26
26
  __exportStar(require("./chat-utils"), exports);
27
27
  __exportStar(require("./lt-hash"), exports);
28
28
  __exportStar(require("./auth-utils"), exports);
29
- __exportStar(require("./n4lyx-event-stream"), exports);
29
+ __exportStar(require("./wileys-event-stream"), exports);
30
30
  __exportStar(require("./use-multi-file-auth-state"), exports);
31
31
  __exportStar(require("./link-preview"), exports);
32
32
  __exportStar(require("./event-buffer"), exports);
@@ -670,28 +670,6 @@ const generateWAMessageContent = async (message, options) => {
670
670
  m[messageType].contextInfo = m[messageType] || {};
671
671
  m[messageType].contextInfo.mentionedJid = message.mentions;
672
672
  }
673
- // n4lyx: tag all support - mention everyone in a group
674
- if ('tagAll' in message && message.tagAll) {
675
- const [messageType] = Object.keys(m);
676
- m[messageType] = m[messageType] || {};
677
- m[messageType].contextInfo = m[messageType].contextInfo || {};
678
- m[messageType].contextInfo.isTagAll = true;
679
- // scope: 'all' | 'admins' | 'non_admins', default to 'all'
680
- m[messageType].contextInfo.tagAllScope = message.tagAllScope || 'all';
681
- }
682
- // n4lyx: group status v2 message support
683
- if ('groupStatusV2' in message && message.groupStatusV2) {
684
- const gsv2 = message.groupStatusV2;
685
- m = {
686
- groupStatusV2Message: {
687
- message: m,
688
- duration: gsv2.duration || 86400,
689
- allowReply: gsv2.allowReply !== false,
690
- allowReaction: gsv2.allowReaction !== false,
691
- visibility: gsv2.visibility || 'all'
692
- }
693
- };
694
- }
695
673
  if ('edit' in message) {
696
674
  m = {
697
675
  protocolMessage: {
@@ -8,7 +8,7 @@ const WAProto_1 = require("../../WAProto");
8
8
  const auth_utils_1 = require("./auth-utils");
9
9
  const generics_1 = require("./generics");
10
10
  // We need to lock files due to the fact that we are using async functions to read and write files
11
- // https://github.com/N4tzzOfficial/n4lyx/issues
11
+ // https://github.com/WhiskeySockets/Wileys/issues/794
12
12
  // https://github.com/nodejs/node/issues/26338
13
13
  // Use a Map to store mutexes for each file path
14
14
  const fileLocks = new Map();
@@ -11,7 +11,7 @@ const readline_1 = require("readline");
11
11
  const generics_1 = require("./generics");
12
12
  const make_mutex_1 = require("./make-mutex");
13
13
  /**
14
- * Captures events from an n4lyx event emitter & stores them in a file
14
+ * Captures events from a wileys event emitter & stores them in a file
15
15
  * @param ev The event emitter to read events from
16
16
  * @param filename File to save to
17
17
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n4tzz/n4lyx",
3
- "version": "2.7.8",
3
+ "version": "2.7.10",
4
4
  "description": "N4lyx - WhatsApp Web API Library powered by N4tzzOfficial",
5
5
  "keywords": [
6
6
  "n4lyx",