vantuz 3.5.6 → 3.5.8

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/core/database.js CHANGED
@@ -7,9 +7,8 @@ let db;
7
7
 
8
8
  try {
9
9
  db = new Database(dbPath);
10
- console.log('✅ SQLite DB connected directly.');
11
10
  } catch (e) {
12
- console.error('❌ SQLite connection failed:', e);
11
+ console.error('❌ Veritabanı bağlantısı başarısız:', e.message);
13
12
  process.exit(1);
14
13
  }
15
14
 
@@ -41,7 +41,9 @@ module.exports = {
41
41
  return { valid: false, reason: 'Süresi Dolmuş Lisans' };
42
42
  }
43
43
 
44
- return { valid: true, data: payload };
44
+ // Payload'dan customer veya user'ı al
45
+ const customer = payload.customer || payload.user || 'Müşteri';
46
+ return { valid: true, data: { ...payload, customer } };
45
47
 
46
48
  } catch (e) {
47
49
  return { valid: false, reason: 'Lisans Okunamadı: ' + e.message };
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const fs = require('fs');
4
+ const { execSync } = require('child_process');
4
5
  const clear = require('console-clear');
5
6
  const figlet = require('figlet');
6
7
  const chalk = require('chalk');
@@ -10,6 +11,41 @@ const ora = require('ora');
10
11
  const Conf = require('conf');
11
12
  const db = require('./core/database');
12
13
  const licenseManager = require('./core/license-manager');
14
+ const pkg = require('./package.json');
15
+
16
+ // --- BASİT KOMUT SATIRI ARGÜMANLARI ---
17
+ const args = process.argv.slice(2);
18
+
19
+ if (args.includes('--version') || args.includes('-v')) {
20
+ console.log(pkg.version);
21
+ process.exit(0);
22
+ }
23
+
24
+ if (args.includes('--upgrade') || args.includes('-U')) {
25
+ clear();
26
+ console.log(chalk.cyan(figlet.textSync('VANTUZ', { horizontalLayout: 'full' })));
27
+ console.log(chalk.yellow(' 🚀 Güncelleme Kontrol Ediliyor...\n'));
28
+
29
+ try {
30
+ // Check current version
31
+ const currentVersion = pkg.version;
32
+
33
+ // Run upgrade
34
+ console.log(chalk.cyan(' 📦 En güncel paketler indiriliyor...'));
35
+ execSync('npm install -g vantuz@latest', { stdio: 'pipe' });
36
+
37
+ // Show success
38
+ console.log(chalk.green(' ✅ Tüm paketler güncellendi!'));
39
+ console.log(chalk.white('\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
40
+ console.log(chalk.green(' 🎉 Vantuz ' + currentVersion + ' → ' + pkg.version + ' başarıyla yükseltildi!'));
41
+ console.log(chalk.white(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
42
+
43
+ } catch(e) {
44
+ console.log(chalk.red(' ❌ Güncelleme sırasında hata oluştu:'));
45
+ console.log(chalk.gray(' ' + e.message));
46
+ }
47
+ process.exit(0);
48
+ }
13
49
 
14
50
  // ... (Diğer importlar aynı) ...
15
51
  const productManager = require('./core/product-manager');
@@ -26,7 +62,7 @@ const config = new Conf({ projectName: 'vantuz' });
26
62
  const printHeader = () => {
27
63
  clear();
28
64
  console.log(chalk.cyan(figlet.textSync('VANTUZ', { horizontalLayout: 'full' })));
29
- console.log(chalk.grey(' 🐙 E-Ticaretin Yapay Zeka Beyni | v2.2 Enterprise\n'));
65
+ console.log(chalk.grey(` 🐙 E-Ticaretin Yapay Zeka Beyni | v${pkg.version}\n`));
30
66
  };
31
67
 
32
68
  async function main() {
@@ -207,9 +243,96 @@ async function showDashboard(licenseData) {
207
243
  }
208
244
 
209
245
  async function handleAction(action) {
210
- if (action === 'products') await productManager.manageProducts();
211
- if (action === 'add_store') await setupWizard();
212
- // Diğer aksiyonlar...
246
+ const inquirer = require('inquirer');
247
+ const chalk = require('chalk');
248
+
249
+ switch(action) {
250
+ case 'orders':
251
+ console.log(chalk.cyan('\n📦 Sipariş Yönetimi'));
252
+ console.log(chalk.grey('─'.repeat(40)));
253
+ const orders = await db.Order.findAll({ limit: 20 });
254
+ if (orders.length === 0) {
255
+ console.log(chalk.yellow(' Henüz sipariş yok.'));
256
+ } else {
257
+ orders.forEach(o => {
258
+ console.log(` ${o.id} | ${o.status} | ${o.total} TL`);
259
+ });
260
+ }
261
+ console.log(chalk.grey('\n [Geri dönmek için Enter tuşuna bas]'));
262
+ await inquirer.prompt([{ type: 'input', name: 'back', message: '' }]);
263
+ break;
264
+
265
+ case 'products':
266
+ await productManager.manageProducts();
267
+ break;
268
+
269
+ case 'ai':
270
+ console.log(chalk.cyan('\n🧠 Pazar Analizi'));
271
+ console.log(chalk.grey('─'.repeat(40)));
272
+ console.log(chalk.green(' 📊 Raporlar yükleniyor...'));
273
+
274
+ const stores = await db.Store.findAll();
275
+ console.log(chalk.white(`\n 📈 Toplam Mağaza: ${stores.length}`));
276
+ console.log(chalk.white(` 🛒 Aktif Ürünler: ${await db.Product.count()}`));
277
+ console.log(chalk.white(` 📦 Bekleyen Siparişler: ${await db.Order.count({ where: { status: 'pending' } })}`));
278
+
279
+ console.log(chalk.cyan('\n 🤖 Yapay Zeka Analizi:'));
280
+ console.log(chalk.white(' • Fiyatlandırma önerileri hazırlanıyor...'));
281
+ console.log(chalk.white(' • Stok optimizasyonu analiz ediliyor...'));
282
+ console.log(chalk.white(' • Rakip takibi aktif...\n'));
283
+
284
+ console.log(chalk.grey('\n [Geri dönmek için Enter tuşuna bas]'));
285
+ await inquirer.prompt([{ type: 'input', name: 'back', message: '' }]);
286
+ break;
287
+
288
+ case 'add_store':
289
+ await setupWizard();
290
+ break;
291
+
292
+ case 'settings':
293
+ console.log(chalk.cyan('\n⚙️ Ayarlar'));
294
+ console.log(chalk.grey('─'.repeat(40)));
295
+ const { settingAction } = await inquirer.prompt([
296
+ {
297
+ type: 'list',
298
+ name: 'settingAction',
299
+ message: 'Ayarlar:',
300
+ choices: [
301
+ '🔑 Lisans Anahtarı Değiştir',
302
+ '🔔 Bildirim Ayarları',
303
+ '🕐 Otomatik Senkron Saatleri',
304
+ '📱 Telegram/WhatsApp Bağlantısı',
305
+ '🔙 Geri'
306
+ ]
307
+ }
308
+ ]);
309
+
310
+ if (settingAction === '🔑 Lisans Anahtarı Değiştir') {
311
+ const { newKey } = await inquirer.prompt([
312
+ { type: 'input', name: 'newKey', message: 'Yeni lisans anahtarı:' }
313
+ ]);
314
+ const result = licenseManager.verifyLicense(newKey);
315
+ if (result.valid) {
316
+ config.set('licenseKey', newKey);
317
+ console.log(chalk.green(' ✅ Lisans güncellendi!'));
318
+ } else {
319
+ console.log(chalk.red(' ❌ Geçersiz anahtar: ' + result.reason));
320
+ }
321
+ } else if (settingAction === '🔙 Geri') {
322
+ return;
323
+ }
324
+ break;
325
+
326
+ case 'exit':
327
+ case 'quit':
328
+ console.log(chalk.yellow('\n👋 Vantuz kapatılıyor...'));
329
+ console.log(chalk.grey(' Görüşmek üzere! 🐙\n'));
330
+ process.exit(0);
331
+ break;
332
+
333
+ default:
334
+ console.log(chalk.yellow(' ⚠️ Bu özellik henüz aktif değil.'));
335
+ }
213
336
  }
214
337
 
215
338
  main().catch(err => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vantuz",
3
- "version": "3.5.6",
3
+ "version": "3.5.8",
4
4
  "description": "Yapay Zeka Destekli Yeni Nesil E-Ticaret Yönetim Platformu (CLI)",
5
5
  "main": "index.js",
6
6
  "bin": {