@neelegirl/wa-api 1.1.1 → 1.3.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.
@@ -49,29 +49,27 @@ const sessions = new Map();
49
49
  const callback = new Map();
50
50
  const retryCount = new Map();
51
51
  let stock;
52
- const CURRENT_WA_API_VERSION = "1.1.1";
53
- // Globale Flag um sicherzustellen, dass Update-Benachrichtigung nur einmal angezeigt wird
54
- if (typeof global !== 'undefined' && !global.__waApiUpdateCheckShown) {
55
- global.__waApiUpdateCheckShown = false;
56
- }
57
- // Version-Vergleichsfunktion (semantische Versionierung)
58
- const compareVersions = (v1, v2) => {
59
- const parts1 = v1.split('.').map(Number);
60
- const parts2 = v2.split('.').map(Number);
61
- for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
62
- const part1 = parts1[i] || 0;
63
- const part2 = parts2[i] || 0;
64
- if (part1 > part2) return 1;
65
- if (part1 < part2) return -1;
52
+ const CURRENT_WA_API_VERSION = "1.3.2";
53
+ let waApiUpdateCheckDone = false;
54
+
55
+ function isNewerVersion(latest, current) {
56
+ if (!latest || !current) return false;
57
+ const a = current.split('.').map((n) => parseInt(n, 10) || 0);
58
+ const b = latest.split('.').map((n) => parseInt(n, 10) || 0);
59
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
60
+ const x = a[i] || 0, y = b[i] || 0;
61
+ if (y > x) return true;
62
+ if (y < x) return false;
66
63
  }
67
- return 0;
68
- };
69
- // Update-Check-Funktion für WA-API
64
+ return false;
65
+ }
66
+
67
+ // Liest von der offiziellen npm-Registry (registry.npmjs.org), ob ein Update existiert – nur 1x pro Prozess
70
68
  const checkWaApiUpdate = () => {
71
- // Wenn bereits angezeigt, nicht erneut prüfen
72
- if (typeof global !== 'undefined' && global.__waApiUpdateCheckShown) {
69
+ if (waApiUpdateCheckDone) {
73
70
  return Promise.resolve(null);
74
71
  }
72
+ waApiUpdateCheckDone = true;
75
73
  return new Promise((resolve) => {
76
74
  const url = `https://registry.npmjs.org/@neelegirl/wa-api/latest`;
77
75
  https_1.default.get(url, { timeout: 5000 }, (res) => {
@@ -83,13 +81,9 @@ const checkWaApiUpdate = () => {
83
81
  try {
84
82
  const packageInfo = JSON.parse(data);
85
83
  const latestVersion = packageInfo.version;
86
- // Nur anzeigen wenn latestVersion wirklich NEUER ist als die aktuelle Version
87
- if (latestVersion && compareVersions(latestVersion, CURRENT_WA_API_VERSION) > 0) {
88
- const updateMessage = `\n╔════════════════════════════════════════╗\n║ 🔔 NEUES UPDATE VERFÜGBAR! 🔔 ║\n╠════════════════════════════════════════╣\n║ @neelegirl/wa-api ║\n║ Aktuelle Version: ${CURRENT_WA_API_VERSION.padEnd(20)} ║\n║ Neue Version: ${latestVersion.padEnd(20)} ║\n║ ║\n║ Bitte aktualisiere: ║\n║ npm install @neelegirl/wa-api@latest ║\n╚════════════════════════════════════════╝\n`;
84
+ if (latestVersion && isNewerVersion(latestVersion, CURRENT_WA_API_VERSION)) {
85
+ const updateMessage = `\n╔════════════════════════════════════════╗\n║ 🔔 NEUES UPDATE VERFÜGBAR! 🔔 ║\n╠════════════════════════════════════════╣\n║ @neelegirl/wa-api ║\n║ Aktuelle Version: ${(CURRENT_WA_API_VERSION || '').padEnd(20)} ║\n║ Neue Version: ${(latestVersion || '').padEnd(20)} ║\n║ ║\n║ Bitte aktualisiere: ║\n║ npm install @neelegirl/wa-api@latest ║\n╚════════════════════════════════════════╝\n`;
89
86
  console.log(updateMessage);
90
- if (typeof global !== 'undefined') {
91
- global.__waApiUpdateCheckShown = true; // Markiere als angezeigt
92
- }
93
87
  resolve({
94
88
  current: CURRENT_WA_API_VERSION,
95
89
  latest: latestVersion,
@@ -97,13 +91,11 @@ const checkWaApiUpdate = () => {
97
91
  });
98
92
  }
99
93
  else {
100
- // Kein Update verfügbar oder lokale Version ist neuer/gleich
101
- if (typeof global !== 'undefined') {
102
- global.__waApiUpdateCheckShown = true; // Markiere als geprüft
103
- }
94
+ const currentVersionMessage = `\n╔════════════════════════════════════════╗\n║ ✅ Du nutzt die aktuelle Version ║\n║ von @neelegirl/wa-api ║\n╚════════════════════════════════════════╝\n`;
95
+ console.log(currentVersionMessage);
104
96
  resolve({
105
97
  current: CURRENT_WA_API_VERSION,
106
- latest: latestVersion,
98
+ latest: latestVersion || CURRENT_WA_API_VERSION,
107
99
  hasUpdate: false
108
100
  });
109
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neelegirl/wa-api",
3
- "version": "1.1.1",
3
+ "version": "1.3.2",
4
4
  "description": "Multi Session Whatsapp Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,26 +8,24 @@
8
8
  "type": "git",
9
9
  "url": "git+https://github.com/neelegirly/neelegirl-wa-api.git"
10
10
  },
11
- "homepage": "https://https://github.com/neelegirly/neelegirl-wa-api#readme",
11
+ "homepage": "https://github.com/neelegirly/neelegirl-wa-api#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/neelegirly/neelegirl-wa-api"
14
14
  },
15
- "files": [
16
- "dist/**/*"
17
- ],
15
+ "files": ["dist/**/*"],
18
16
  "scripts": {
19
17
  "build": "tsc",
20
18
  "start": "tsc && node ./dist/index.js",
21
19
  "test": "echo \"Error: no test specified\" && exit 1",
22
20
  "run-script": "node ./dist/index.js"
23
21
  },
24
- "author": "Neele",
22
+ "author": { "name": "Neele" },
25
23
  "license": "ISC",
26
24
  "dependencies": {
27
25
  "jest": "^29.0.0",
28
26
  "@adiwajshing/keyed-db": "^0.2.4",
29
27
  "@hapi/boom": "^10.0.1",
30
- "@neelegirl/baileys": "^1.7.0",
28
+ "@neelegirl/baileys": "^2.0.0",
31
29
  "mime": "^3.0.0",
32
30
  "pino": "^8.11.0",
33
31
  "qrcode-terminal": "^0.12.0"
package/readme.md CHANGED
@@ -5,11 +5,12 @@
5
5
  ### *Multi-Session WhatsApp – einfach & stabil*
6
6
  ### *QR · Pairing · Auto-Reconnect · Smart Queue Ready*
7
7
 
8
- [![Version](https://img.shields.io/badge/Version-1.1.1-ff69b4?style=for-the-badge&logo=github)](https://github.com/neelegirl/wa-api)
8
+ [![Version](https://img.shields.io/badge/Version-1.3.2-ff69b4?style=for-the-badge&logo=github)](https://github.com/neelegirl/wa-api)
9
+ [![Baileys](https://img.shields.io/badge/@neelegirl/baileys-2.0.2-9b59b6?style=for-the-badge)](https://www.npmjs.com/package/@neelegirl/baileys)
10
+ [![Baileys API](https://img.shields.io/badge/Baileys_API-1.7.2-9b59b6?style=for-the-badge)](https://github.com/WhiskeySockets/Baileys)
9
11
  [![npm](https://img.shields.io/npm/v/@neelegirl/wa-api?style=for-the-badge&color=ff69b4&logo=npm)](https://www.npmjs.com/package/@neelegirl/wa-api)
10
12
  [![Downloads](https://img.shields.io/npm/dw/@neelegirl/wa-api?style=for-the-badge&color=ff69b4&logo=npm)](https://www.npmjs.com/package/@neelegirl/wa-api)
11
13
  [![License](https://img.shields.io/github/license/neelegirl/wa-api?style=for-the-badge&color=ff69b4)](LICENSE)
12
- [![Baileys](https://img.shields.io/badge/Baileys-1.7.1-ff69b4?style=for-the-badge)](https://www.npmjs.com/package/@neelegirl/baileys)
13
14
 
14
15
  ---
15
16
 
@@ -17,7 +18,11 @@
17
18
  <img src="https://files.catbox.moe/63h8xn.jpeg" width="720" alt="Neele WA-API Header" />
18
19
  </p>
19
20
 
20
- **✨ v1.1.1** · README Glow-Up · Kompatibel mit @neelegirl/baileys 1.7.1
21
+ | 📦 Paket | 🎯 Baileys | Highlights |
22
+ |----------|------------|----------------|
23
+ | **@neelegirl/wa-api v1.3.2** | **@neelegirl/baileys 2.0.2** | Multi-Session · QR · Pairing · Update-Check von npm |
24
+
25
+ **✨ v1.3.2** · README Glow-Up · Kompatibel mit **@neelegirl/baileys 2.0.2** & **Baileys API 1.7.2** · Update-Prüfung via npm-Registry
21
26
 
22
27
  [**Installation**](#-installation) · [**Quickstart**](#-quickstart-guide) · [**Features**](#-features) · [**API**](#-vollständige-api-referenz) · [**Support**](#-support--community)
23
28
 
@@ -61,7 +66,7 @@
61
66
  | 🎨 **Einfach** | Simple API für Anfänger | ✅ |
62
67
  | 🚀 **Smart Queue** | Nutzt Baileys Smart Message Queue | ✅ |
63
68
 
64
- > ⚠️ **Wichtig**: Diese Library funktioniert **ausschließlich** mit **@neelegirl/baileys**!
69
+ > ⚠️ **Wichtig**: Diese Library funktioniert **ausschließlich** mit **@neelegirl/baileys** (empfohlen **v2.0.0**, Baileys API **1.7.2**)!
65
70
 
66
71
  ---
67
72
 
@@ -630,26 +635,22 @@ if (session) {
630
635
 
631
636
  ---
632
637
 
633
- ## 🆕 Was ist neu in Version 1.1.1?
638
+ ## 🆕 Was ist neu in Version 1.3.2?
634
639
 
635
- ### ✨ **Neue Features**
640
+ ### ✨ **Neue Features & Glow-Up**
636
641
 
637
- - 📖 **README Glow-Up** – Überarbeitete Doku, klarere Struktur, bessere Beispiele
638
- - ✅ **Kompatibilität** mit @neelegirl/baileys 1.7.1
639
- - 🚀 **Smart Queue Ready** – Bereit für Baileys Smart Message Queue
640
- - 🔔 **Auto-Update-Check** Beim Start, nur einmal pro Prozess
641
- - 🚀 **Stabilität** und Performance verbessert
642
- - 🐛 **Bugfixes** für Session-Management
643
- - 💎 **Multi-Device** optimiert
644
- - 🎨 **QR-Code-Anzeige** mit Version-Info
642
+ - 📖 **README Glow-Up** – Version 1.3.2, Badges & Changelog
643
+ - ✅ **Kompatibilität** mit **@neelegirl/baileys 2.0.2** & **Baileys API 1.7.2**
644
+ - 🔔 **Update-Check** – Liest Version von **npm-Registry** (registry.npmjs.org), nur 1× pro Prozess
645
+ - 📦 **Abhängigkeit** auf `@neelegirl/baileys@^2.0.0` (empfohlen 2.0.2)
646
+ - 🚀 **Smart Queue Ready** · QR · Pairing · Auto-Reconnect
647
+ - 💎 **Multi-Device** & Session-Management optimiert
645
648
 
646
649
  ### 🔄 **Verbesserungen**
647
650
 
648
- - Verbesserte Fehlerbehandlung
649
- - Optimierte Session-Verwaltung
650
- - Schnellerer Verbindungsaufbau
651
- - Bessere LID-Unterstützung
652
- - Smart Queue Integration möglich
651
+ - Semver-Vergleich für „Update verfügbar“ nur bei wirklich neuerer Version
652
+ - Verbesserte Fehlerbehandlung & Stabilität
653
+ - Schnellerer Verbindungsaufbau · Bessere LID-Unterstützung
653
654
 
654
655
  ---
655
656
 
@@ -671,14 +672,50 @@ if (session) {
671
672
 
672
673
  ## 📝 Changelog
673
674
 
674
- ### Version 1.1.1 (Aktuell) 🎉
675
+ ### Version 1.3.2 (Aktuell) 🎉
675
676
 
676
- - 📖 **README Glow-Up** – Überarbeitete Dokumentation
677
- - Kompatibilität mit @neelegirl/baileys 1.7.1
678
- - 🚀 Smart Queue Ready · Auto-Update-Check (1x pro Prozess)
679
- - 🚀 Verbesserte Stabilität & Fehlerbehandlung
677
+ - 📖 **README Glow-Up** – Version 1.3.2, Baileys 2.0.2 Badges
678
+ - 🔔 Update-Check von **npm-Registry** (registry.npmjs.org), nur 1× pro Prozess
679
+ - Kompatibilität mit **@neelegirl/baileys 2.0.2** & **Baileys API 1.7.2**
680
+ - 📦 Abhängigkeit `@neelegirl/baileys@^2.0.0`
681
+ - 🚀 Smart Queue Ready · Semver-Vergleich für Update-Hinweis
680
682
  - 💎 Multi-Device & Session-Management optimiert
681
683
 
684
+ ### Version 1.3.1
685
+
686
+ - 📖 README Glow-Up · Changelog · Baileys 2.0.2
687
+
688
+ ### Version 1.2.5
689
+
690
+ - 📖 README Glow-Up · Changelog
691
+
692
+ ### Version 1.2.4
693
+
694
+ - 📖 README Glow-Up · Changelog
695
+
696
+ ### Version 1.2.3
697
+
698
+ - 📖 README Glow-Up · Changelog
699
+
700
+ ### Version 1.2.2
701
+
702
+ - 📖 README Glow-Up · Changelog ergänzt
703
+
704
+ ### Version 1.2.1
705
+
706
+ - 📖 README Glow-Up · Update-Check von npm-Registry · Baileys 2.0.2 Badges
707
+
708
+ ### Version 1.2.0
709
+
710
+ - 📖 README Glow-Up · Baileys 2.0.0 Badges
711
+ - ✨ Kompatibilität mit @neelegirl/baileys 2.0.0 & Baileys API 1.7.2
712
+ - 🚀 Smart Queue Ready · Auto-Update-Check (1x pro Prozess)
713
+
714
+ ### Version 1.1.1
715
+
716
+ - 📖 README Glow-Up · Kompatibilität mit @neelegirl/baileys 1.7.1
717
+ - 🚀 Smart Queue Ready, Auto-Update-Check
718
+
682
719
  ### Version 1.1.0
683
720
 
684
721
  - ✨ Kompatibilität mit @neelegirl/baileys 1.7.0