vantuz 3.3.4 → 3.3.6
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/cli.js +169 -169
- package/config.js +69 -46
- package/core/engine.js +296 -339
- package/core/gateway.js +139 -68
- package/package.json +87 -90
- package/platforms/amazon.js +4 -1
- package/platforms/ciceksepeti.js +2 -1
- package/platforms/n11.js +2 -2
- package/platforms/pazarama.js +2 -1
- package/platforms/pttavm.js +14 -0
package/core/gateway.js
CHANGED
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* - Sistem durumu sorgulama
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import axios from 'axios';
|
|
13
|
-
import fs from 'fs';
|
|
14
|
-
import path from 'path';
|
|
15
|
-
import os from 'os';
|
|
16
|
-
import { log } from './ai-provider.js';
|
|
12
|
+
import axios from 'axios';
|
|
13
|
+
import fs from 'fs';
|
|
14
|
+
import path from 'path';
|
|
15
|
+
import os from 'os';
|
|
16
|
+
import { log } from './ai-provider.js';
|
|
17
17
|
|
|
18
18
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
19
19
|
// CONFIG - Gateway ayarları
|
|
@@ -42,15 +42,15 @@ function getGatewayToken(config) {
|
|
|
42
42
|
// GATEWAY CLIENT
|
|
43
43
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
44
44
|
|
|
45
|
-
export class VantuzGateway {
|
|
45
|
+
export class VantuzGateway {
|
|
46
46
|
constructor() {
|
|
47
47
|
this.config = loadGatewayConfig();
|
|
48
48
|
const port = this.config?.gateway?.port || 18789;
|
|
49
49
|
this.baseUrl = `http://localhost:${port}`;
|
|
50
50
|
this.token = getGatewayToken(this.config);
|
|
51
51
|
this.connected = false;
|
|
52
|
-
this.version = null;
|
|
53
|
-
}
|
|
52
|
+
this.version = null;
|
|
53
|
+
}
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* HTTP Headers (token auth)
|
|
@@ -101,66 +101,137 @@ export class VantuzGateway {
|
|
|
101
101
|
/**
|
|
102
102
|
* Gateway sağlık kontrolü
|
|
103
103
|
*/
|
|
104
|
-
async health() {
|
|
105
|
-
const result = await this._request('GET', '/health');
|
|
106
|
-
this.connected = result.success;
|
|
107
|
-
if (result.success) {
|
|
108
|
-
this.version = result.data?.version || 'unknown';
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Gateway sürecini başlat
|
|
115
|
-
*/
|
|
116
|
-
async start() {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
104
|
+
async health() {
|
|
105
|
+
const result = await this._request('GET', '/health');
|
|
106
|
+
this.connected = result.success;
|
|
107
|
+
if (result.success) {
|
|
108
|
+
this.version = result.data?.version || 'unknown';
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Gateway sürecini başlat
|
|
115
|
+
*/
|
|
116
|
+
async start() {
|
|
117
|
+
const cwd = process.cwd();
|
|
118
|
+
const gatewayCmd = path.join(cwd, '.openclaw', 'gateway.cmd');
|
|
119
|
+
const isWin = process.platform === 'win32';
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
const { spawn } = await import('child_process');
|
|
123
|
+
let child;
|
|
124
|
+
|
|
125
|
+
if (isWin && fs.existsSync(gatewayCmd)) {
|
|
126
|
+
// Windows: Use generated CMD (has config env vars)
|
|
127
|
+
child = spawn(gatewayCmd, [], {
|
|
128
|
+
detached: true,
|
|
129
|
+
stdio: 'ignore', // Keep it in background
|
|
130
|
+
shell: true,
|
|
131
|
+
cwd // Ensure CWD is correct for finding node_modules
|
|
132
|
+
});
|
|
133
|
+
} else {
|
|
134
|
+
// Linux/Mac or missing CMD: Use npx directly
|
|
135
|
+
// We try to load token from config if possible to pass as ENV
|
|
136
|
+
const env = { ...process.env };
|
|
137
|
+
if (this.config?.gateway?.auth?.token) {
|
|
138
|
+
env.OPENCLAW_GATEWAY_TOKEN = this.config.gateway.auth.token;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
child = spawn('npx', ['openclaw', 'gateway', '--port', '18789', '--allow-unconfigured'], {
|
|
142
|
+
detached: true,
|
|
143
|
+
stdio: 'ignore',
|
|
144
|
+
shell: true,
|
|
145
|
+
cwd,
|
|
146
|
+
env
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (child) {
|
|
151
|
+
child.unref(); // Detach process so it outlives parent
|
|
152
|
+
return { success: true };
|
|
153
|
+
}
|
|
154
|
+
return { success: false, error: 'Child process could not be spawned' };
|
|
155
|
+
|
|
156
|
+
} catch (e) {
|
|
157
|
+
return { success: false, error: e.message };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Vantuz API Server (server/app.js) başlat
|
|
163
|
+
*/
|
|
164
|
+
async startServer() {
|
|
165
|
+
const serverPath = path.join(process.cwd(), 'server', 'app.js');
|
|
166
|
+
if (!fs.existsSync(serverPath)) {
|
|
167
|
+
return { success: false, error: 'Server dosyası bulunamadı: server/app.js' };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
try {
|
|
171
|
+
const { spawn } = await import('child_process');
|
|
172
|
+
const child = spawn('node', [serverPath], {
|
|
173
|
+
detached: true,
|
|
174
|
+
stdio: 'ignore',
|
|
175
|
+
shell: true,
|
|
176
|
+
cwd: process.cwd(),
|
|
177
|
+
env: { ...process.env, PORT: '3001' } // Ensure default port
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
child.unref();
|
|
181
|
+
return { success: true };
|
|
182
|
+
} catch (e) {
|
|
183
|
+
return { success: false, error: e.message };
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Tüm sistemi başlat (Gateway + Server)
|
|
189
|
+
*/
|
|
190
|
+
async startFullStack() {
|
|
191
|
+
// 1. Start Gateway
|
|
192
|
+
const gwResult = await this.start();
|
|
193
|
+
|
|
194
|
+
// 2. Wait for Gateway to initialize (approx 3s)
|
|
195
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
196
|
+
|
|
197
|
+
// 3. Start Server
|
|
198
|
+
const serverResult = await this.startServer();
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
success: gwResult.success && serverResult.success,
|
|
202
|
+
gateway: gwResult,
|
|
203
|
+
server: serverResult
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Gateway çalışmıyorsa başlat ve sağlık kontrolü yap
|
|
209
|
+
*/
|
|
210
|
+
async ensureRunning(options = {}) {
|
|
211
|
+
const {
|
|
212
|
+
retries = 5,
|
|
213
|
+
intervalMs = 1000
|
|
214
|
+
} = options;
|
|
215
|
+
|
|
216
|
+
if (this.isConnected()) {
|
|
217
|
+
return { success: true, already: true };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const started = await this.start();
|
|
221
|
+
if (!started.success) {
|
|
222
|
+
return started;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
for (let i = 0; i < retries; i++) {
|
|
226
|
+
await new Promise(r => setTimeout(r, intervalMs));
|
|
227
|
+
const health = await this.health();
|
|
228
|
+
if (health.success) {
|
|
229
|
+
return { success: true, started: true };
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return { success: false, error: 'Gateway başlatıldı ancak sağlık kontrolü geçmedi' };
|
|
234
|
+
}
|
|
164
235
|
|
|
165
236
|
/**
|
|
166
237
|
* Detaylı sistem durumu
|
package/package.json
CHANGED
|
@@ -1,91 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
"name":
|
|
3
|
-
"version": "3.3.
|
|
4
|
-
"description":
|
|
5
|
-
"type":
|
|
6
|
-
"main":
|
|
7
|
-
"bin":
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"scripts":
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"keywords":
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"author":
|
|
44
|
-
"license":
|
|
45
|
-
"repository":
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"homepage":
|
|
50
|
-
"bugs":
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"dependencies":
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"devDependencies":
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"os":
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"engines":
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"files":
|
|
77
|
-
|
|
78
|
-
"onboard.js",
|
|
1
|
+
{
|
|
2
|
+
"name": "vantuz",
|
|
3
|
+
"version": "3.3.6",
|
|
4
|
+
"description": "Yapay Zeka Destekli E-Ticaret Yönetim Platformu - 7 Pazaryeri + WhatsApp/Telegram",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "cli.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"vantuz": "cli.js",
|
|
9
|
+
"vantuz-onboard": "onboard.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "node cli.js tui",
|
|
13
|
+
"tui": "node cli.js tui",
|
|
14
|
+
"config": "node cli.js config",
|
|
15
|
+
"status": "node cli.js status",
|
|
16
|
+
"postinstall": "echo \u0027Vantuz kuruldu! Baslatmak icin: npx vantuz-onboard\u0027",
|
|
17
|
+
"test": "node --test",
|
|
18
|
+
"lint": "eslint plugins/"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"ecommerce",
|
|
22
|
+
"e-ticaret",
|
|
23
|
+
"trendyol",
|
|
24
|
+
"hepsiburada",
|
|
25
|
+
"amazon",
|
|
26
|
+
"n11",
|
|
27
|
+
"ciceksepeti",
|
|
28
|
+
"pttavm",
|
|
29
|
+
"pazarama",
|
|
30
|
+
"marketplace",
|
|
31
|
+
"pazaryeri",
|
|
32
|
+
"ai",
|
|
33
|
+
"yapay-zeka",
|
|
34
|
+
"repricer",
|
|
35
|
+
"fiyatlama",
|
|
36
|
+
"whatsapp",
|
|
37
|
+
"telegram",
|
|
38
|
+
"enterprise",
|
|
39
|
+
"gateway",
|
|
40
|
+
"management",
|
|
41
|
+
"cli"
|
|
42
|
+
],
|
|
43
|
+
"author": "Vantuz",
|
|
44
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "git+https://github.com/cokdalazimdegil/vantuz.git"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://nuricanavsar.com/public/vantuz",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/cokdalazimdegil/vantuz/issues"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"axios": "^1.13.5",
|
|
55
|
+
"cors": "^2.8.6",
|
|
56
|
+
"cron": "^4.4.0",
|
|
57
|
+
"dotenv": "^16.0.0",
|
|
58
|
+
"express": "^5.2.1",
|
|
59
|
+
"openclaw": "^0.0.1",
|
|
60
|
+
"playwright": "^1.58.2",
|
|
61
|
+
"sqlite": "^5.1.1",
|
|
62
|
+
"sqlite3": "^5.0.2",
|
|
63
|
+
"xml2js": "^0.6.2"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"eslint": "^8.0.0"
|
|
67
|
+
},
|
|
68
|
+
"os": [
|
|
69
|
+
"darwin",
|
|
70
|
+
"linux",
|
|
71
|
+
"win32"
|
|
72
|
+
],
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": "\u003e=18.0.0"
|
|
75
|
+
},
|
|
76
|
+
"files": [
|
|
77
|
+
"cli.js",
|
|
78
|
+
"onboard.js",
|
|
79
79
|
"config.js",
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
"core",
|
|
81
|
+
"server",
|
|
82
|
+
"platforms",
|
|
83
|
+
"plugins",
|
|
84
|
+
"start.bat",
|
|
85
|
+
"LICENSE",
|
|
86
|
+
"README.md"
|
|
87
|
+
]
|
|
88
|
+
}
|
package/platforms/amazon.js
CHANGED
|
@@ -4,7 +4,10 @@ export default {
|
|
|
4
4
|
description: 'Global E-ticaret Platformu',
|
|
5
5
|
requiredFields: [
|
|
6
6
|
{ key: 'sellerId', label: 'Seller ID', env: 'AMAZON_SELLER_ID' },
|
|
7
|
-
{ key: '
|
|
7
|
+
{ key: 'clientId', label: 'Client ID (LWA)', env: 'AMAZON_CLIENT_ID' },
|
|
8
|
+
{ key: 'clientSecret', label: 'Client Secret (LWA)', env: 'AMAZON_CLIENT_SECRET' },
|
|
9
|
+
{ key: 'refreshToken', label: 'Refresh Token', env: 'AMAZON_REFRESH_TOKEN' },
|
|
10
|
+
{ key: 'region', label: 'Bölge (eu/na/tr)', env: 'AMAZON_REGION', default: 'eu' }
|
|
8
11
|
],
|
|
9
12
|
async getOrders(creds) {
|
|
10
13
|
// Stub
|
package/platforms/ciceksepeti.js
CHANGED
|
@@ -3,7 +3,8 @@ export default {
|
|
|
3
3
|
icon: '🌸', // Flower icon for ÇiçekSepeti
|
|
4
4
|
description: 'Entegre Çevrimiçi Çiçek ve Hediye Platformu',
|
|
5
5
|
requiredFields: [
|
|
6
|
-
{ key: 'apiKey', label: 'API Key', env: 'CICEKSEPETI_API_KEY' }
|
|
6
|
+
{ key: 'apiKey', label: 'API Key', env: 'CICEKSEPETI_API_KEY' },
|
|
7
|
+
{ key: 'supplierId', label: 'Supplier ID', env: 'CICEKSEPETI_SUPPLIER_ID' }
|
|
7
8
|
],
|
|
8
9
|
async getOrders(creds) {
|
|
9
10
|
// Stub
|
package/platforms/n11.js
CHANGED
|
@@ -3,8 +3,8 @@ export default {
|
|
|
3
3
|
icon: '🔵', // Blue circle icon for N11
|
|
4
4
|
description: 'Alternatif E-ticaret Platformu',
|
|
5
5
|
requiredFields: [
|
|
6
|
-
{ key: 'apiKey', label: '
|
|
7
|
-
{ key: 'apiSecret', label: '
|
|
6
|
+
{ key: 'apiKey', label: 'App Key', env: 'N11_API_KEY' },
|
|
7
|
+
{ key: 'apiSecret', label: 'App Secret', env: 'N11_API_SECRET' }
|
|
8
8
|
],
|
|
9
9
|
async getOrders(creds) {
|
|
10
10
|
// Stub
|
package/platforms/pazarama.js
CHANGED
|
@@ -3,7 +3,8 @@ export default {
|
|
|
3
3
|
icon: '🛒', // Shopping cart icon for Pazarama
|
|
4
4
|
description: 'Yeni Nesil Mobil Alışveriş Platformu',
|
|
5
5
|
requiredFields: [
|
|
6
|
-
{ key: '
|
|
6
|
+
{ key: 'clientId', label: 'Client ID', env: 'PAZARAMA_CLIENT_ID' },
|
|
7
|
+
{ key: 'clientSecret', label: 'Client Secret', env: 'PAZARAMA_CLIENT_SECRET' }
|
|
7
8
|
],
|
|
8
9
|
async getOrders(creds) {
|
|
9
10
|
// Stub
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
name: 'PttAVM',
|
|
3
|
+
icon: '📮', // Postbox icon for PttAVM
|
|
4
|
+
description: 'Türkiye\'nin Güvenilir E-ticaret Platformu',
|
|
5
|
+
requiredFields: [
|
|
6
|
+
{ key: 'apiKey', label: 'API Key', env: 'PTTAVM_API_KEY' },
|
|
7
|
+
{ key: 'token', label: 'Token', env: 'PTTAVM_TOKEN' },
|
|
8
|
+
{ key: 'shopId', label: 'Shop ID', env: 'PTTAVM_SHOP_ID' }
|
|
9
|
+
],
|
|
10
|
+
async getOrders(creds) {
|
|
11
|
+
// Stub
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
};
|