@queenanya/baileys 7.2.0 → 7.2.2

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.
@@ -50,10 +50,23 @@ export declare function bindWaitForEvent<T extends keyof BaileysEventMap>(ev: Ba
50
50
  export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
51
51
  export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logger: Logger) => void;
52
52
  /**
53
- * utility that fetches latest baileys version from the master branch.
53
+ * utility that fetches latest baileys version from the main branch.
54
54
  * Use to ensure your WA connection is always on the latest version
55
55
  */
56
56
  export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<any>) => Promise<{
57
+ version: number[];
58
+ isLatest: boolean;
59
+ error?: undefined;
60
+ } | {
61
+ version: WAVersion;
62
+ isLatest: boolean;
63
+ error: any;
64
+ }>;
65
+ /**
66
+ * utility that fetches latest baileys version from the master branch.
67
+ * Use to ensure your WA connection is always on the latest version
68
+ */
69
+ export declare const fetchLatestBaileysVersion2: (options?: AxiosRequestConfig<any>) => Promise<{
57
70
  version: WAVersion;
58
71
  isLatest: boolean;
59
72
  error?: undefined;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.bytesToCrockford = exports.trimUndefined = exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.bindWaitForEvent = exports.generateMessageID = exports.generateMessageIDV3 = exports.generateMessageIDV2 = exports.promiseTimeout = 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;
6
+ exports.bytesToCrockford = exports.trimUndefined = exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion2 = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.bindWaitForEvent = exports.generateMessageID = exports.generateMessageIDV3 = exports.generateMessageIDV2 = exports.promiseTimeout = 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;
7
7
  const boom_1 = require("@hapi/boom");
8
8
  const axios_1 = __importDefault(require("axios"));
9
9
  const crypto_1 = require("crypto");
@@ -238,10 +238,36 @@ const printQRIfNecessaryListener = (ev, logger) => {
238
238
  };
239
239
  exports.printQRIfNecessaryListener = printQRIfNecessaryListener;
240
240
  /**
241
- * utility that fetches latest baileys version from the master branch.
241
+ * utility that fetches latest baileys version from the main branch.
242
242
  * Use to ensure your WA connection is always on the latest version
243
243
  */
244
244
  const fetchLatestBaileysVersion = async (options = {}) => {
245
+ try {
246
+ const result = await axios_1.default.get('https://raw.githubusercontent.com/wppconnect-team/wa-version/main/versions.json', {
247
+ ...options,
248
+ responseType: 'json'
249
+ });
250
+ const version = result.data.currentVersion.split('.');
251
+ const version2 = version[2].replace('-alpha', '');
252
+ return {
253
+ version: [+version[0], +version[1], +version2],
254
+ isLatest: true
255
+ };
256
+ }
257
+ catch (error) {
258
+ return {
259
+ version: baileys_version_json_1.version,
260
+ isLatest: false,
261
+ error
262
+ };
263
+ }
264
+ };
265
+ exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;
266
+ /**
267
+ * utility that fetches latest baileys version from the master branch.
268
+ * Use to ensure your WA connection is always on the latest version
269
+ */
270
+ const fetchLatestBaileysVersion2 = async (options = {}) => {
245
271
  const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/baileys-version.json';
246
272
  try {
247
273
  const result = await axios_1.default.get(URL, {
@@ -261,7 +287,7 @@ const fetchLatestBaileysVersion = async (options = {}) => {
261
287
  };
262
288
  }
263
289
  };
264
- exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;
290
+ exports.fetchLatestBaileysVersion2 = fetchLatestBaileysVersion2;
265
291
  /**
266
292
  * A utility that fetches the latest web version of whatsapp.
267
293
  * Use to ensure your WA connection is always on the latest version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@queenanya/baileys",
3
- "version": "7.2.0",
3
+ "version": "7.2.2",
4
4
  "description": "WhatsApp API",
5
5
  "keywords": [
6
6
  "whatsapp",
@@ -44,6 +44,7 @@
44
44
  "dependencies": {
45
45
  "@adiwajshing/keyed-db": "^0.2.4",
46
46
  "@hapi/boom": "^10.0.1",
47
+ "@queenanya/invite": "latest",
47
48
  "async-lock": "^1.4.1",
48
49
  "audio-decode": "^2.2.0",
49
50
  "axios": "^1.7.2",