@desplega.ai/qa-use 2.0.1
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/LICENSE +21 -0
- package/README.md +1003 -0
- package/bin/qa-use.js +7 -0
- package/dist/lib/api/index.d.ts +296 -0
- package/dist/lib/api/index.d.ts.map +1 -0
- package/dist/lib/api/index.js +564 -0
- package/dist/lib/api/index.js.map +1 -0
- package/dist/lib/api/sse.d.ts +33 -0
- package/dist/lib/api/sse.d.ts.map +1 -0
- package/dist/lib/api/sse.js +97 -0
- package/dist/lib/api/sse.js.map +1 -0
- package/dist/lib/browser/index.d.ts +28 -0
- package/dist/lib/browser/index.d.ts.map +1 -0
- package/dist/lib/browser/index.js +145 -0
- package/dist/lib/browser/index.js.map +1 -0
- package/dist/lib/env/index.d.ts +41 -0
- package/dist/lib/env/index.d.ts.map +1 -0
- package/dist/lib/env/index.js +125 -0
- package/dist/lib/env/index.js.map +1 -0
- package/dist/lib/tunnel/index.d.ts +38 -0
- package/dist/lib/tunnel/index.d.ts.map +1 -0
- package/dist/lib/tunnel/index.js +154 -0
- package/dist/lib/tunnel/index.js.map +1 -0
- package/dist/package.json +100 -0
- package/dist/src/cli/commands/info.d.ts +6 -0
- package/dist/src/cli/commands/info.d.ts.map +1 -0
- package/dist/src/cli/commands/info.js +32 -0
- package/dist/src/cli/commands/info.js.map +1 -0
- package/dist/src/cli/commands/mcp.d.ts +6 -0
- package/dist/src/cli/commands/mcp.d.ts.map +1 -0
- package/dist/src/cli/commands/mcp.js +45 -0
- package/dist/src/cli/commands/mcp.js.map +1 -0
- package/dist/src/cli/commands/setup.d.ts +6 -0
- package/dist/src/cli/commands/setup.d.ts.map +1 -0
- package/dist/src/cli/commands/setup.js +59 -0
- package/dist/src/cli/commands/setup.js.map +1 -0
- package/dist/src/cli/commands/test/index.d.ts +6 -0
- package/dist/src/cli/commands/test/index.d.ts.map +1 -0
- package/dist/src/cli/commands/test/index.js +15 -0
- package/dist/src/cli/commands/test/index.js.map +1 -0
- package/dist/src/cli/commands/test/init.d.ts +6 -0
- package/dist/src/cli/commands/test/init.d.ts.map +1 -0
- package/dist/src/cli/commands/test/init.js +64 -0
- package/dist/src/cli/commands/test/init.js.map +1 -0
- package/dist/src/cli/commands/test/list.d.ts +6 -0
- package/dist/src/cli/commands/test/list.d.ts.map +1 -0
- package/dist/src/cli/commands/test/list.js +70 -0
- package/dist/src/cli/commands/test/list.js.map +1 -0
- package/dist/src/cli/commands/test/run.d.ts +6 -0
- package/dist/src/cli/commands/test/run.d.ts.map +1 -0
- package/dist/src/cli/commands/test/run.js +95 -0
- package/dist/src/cli/commands/test/run.js.map +1 -0
- package/dist/src/cli/commands/test/validate.d.ts +6 -0
- package/dist/src/cli/commands/test/validate.d.ts.map +1 -0
- package/dist/src/cli/commands/test/validate.js +70 -0
- package/dist/src/cli/commands/test/validate.js.map +1 -0
- package/dist/src/cli/index.d.ts +6 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +21 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/lib/config.d.ts +36 -0
- package/dist/src/cli/lib/config.d.ts.map +1 -0
- package/dist/src/cli/lib/config.js +89 -0
- package/dist/src/cli/lib/config.js.map +1 -0
- package/dist/src/cli/lib/loader.d.ts +49 -0
- package/dist/src/cli/lib/loader.d.ts.map +1 -0
- package/dist/src/cli/lib/loader.js +122 -0
- package/dist/src/cli/lib/loader.js.map +1 -0
- package/dist/src/cli/lib/output.d.ts +53 -0
- package/dist/src/cli/lib/output.d.ts.map +1 -0
- package/dist/src/cli/lib/output.js +133 -0
- package/dist/src/cli/lib/output.js.map +1 -0
- package/dist/src/cli/lib/runner.d.ts +23 -0
- package/dist/src/cli/lib/runner.d.ts.map +1 -0
- package/dist/src/cli/lib/runner.js +40 -0
- package/dist/src/cli/lib/runner.js.map +1 -0
- package/dist/src/http-server.d.ts +14 -0
- package/dist/src/http-server.d.ts.map +1 -0
- package/dist/src/http-server.js +145 -0
- package/dist/src/http-server.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +21 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/server.d.ts +58 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +2376 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tunnel-mode.d.ts +13 -0
- package/dist/src/tunnel-mode.d.ts.map +1 -0
- package/dist/src/tunnel-mode.js +159 -0
- package/dist/src/tunnel-mode.js.map +1 -0
- package/dist/src/types/test-definition.d.ts +320 -0
- package/dist/src/types/test-definition.d.ts.map +1 -0
- package/dist/src/types/test-definition.js +11 -0
- package/dist/src/types/test-definition.js.map +1 -0
- package/dist/src/types.d.ts +209 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +34 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/package.d.ts +12 -0
- package/dist/src/utils/package.d.ts.map +1 -0
- package/dist/src/utils/package.js +36 -0
- package/dist/src/utils/package.js.map +1 -0
- package/dist/src/utils/summary.d.ts +45 -0
- package/dist/src/utils/summary.d.ts.map +1 -0
- package/dist/src/utils/summary.js +198 -0
- package/dist/src/utils/summary.js.map +1 -0
- package/lib/api/index.ts +977 -0
- package/lib/api/sse.ts +112 -0
- package/lib/browser/index.ts +181 -0
- package/lib/env/index.ts +156 -0
- package/lib/tunnel/index.test.ts +344 -0
- package/lib/tunnel/index.ts +197 -0
- package/lib/tunnel/integration.test.ts +98 -0
- package/package.json +100 -0
- package/server.json +16 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import 'dotenv/config';
|
|
3
|
+
import { getEnv } from '../env/index.js';
|
|
4
|
+
import { generateEnhancedTestSummary, formatEnhancedTestReport, generateIssueStatistics, categorizeIssues, } from '../../src/utils/summary.js';
|
|
5
|
+
import { streamSSE } from './sse.js';
|
|
6
|
+
// Re-export utility functions for external consumers
|
|
7
|
+
export { generateEnhancedTestSummary, formatEnhancedTestReport, generateIssueStatistics, categorizeIssues, };
|
|
8
|
+
export class ApiClient {
|
|
9
|
+
client;
|
|
10
|
+
apiKey = null;
|
|
11
|
+
appConfigId = null;
|
|
12
|
+
constructor(baseUrl) {
|
|
13
|
+
// Use environment variable if available, otherwise use provided baseUrl, finally fall back to production
|
|
14
|
+
const apiUrl = getEnv('QA_USE_API_URL') || baseUrl || 'https://api.desplega.ai';
|
|
15
|
+
this.client = axios.create({
|
|
16
|
+
baseURL: apiUrl,
|
|
17
|
+
timeout: 30000,
|
|
18
|
+
headers: {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
// Auto-load API key from environment or config file if available
|
|
23
|
+
const envApiKey = getEnv('QA_USE_API_KEY');
|
|
24
|
+
if (envApiKey) {
|
|
25
|
+
this.setApiKey(envApiKey);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
setApiKey(apiKey) {
|
|
29
|
+
this.apiKey = apiKey;
|
|
30
|
+
this.client.defaults.headers['Authorization'] = `Bearer ${apiKey}`;
|
|
31
|
+
}
|
|
32
|
+
getApiKey() {
|
|
33
|
+
return this.apiKey;
|
|
34
|
+
}
|
|
35
|
+
setAppConfigId(appConfigId) {
|
|
36
|
+
this.appConfigId = appConfigId;
|
|
37
|
+
}
|
|
38
|
+
getAppConfigId() {
|
|
39
|
+
return this.appConfigId;
|
|
40
|
+
}
|
|
41
|
+
static getAppUrl() {
|
|
42
|
+
return getEnv('QA_USE_APP_URL') || 'https://app.desplega.ai';
|
|
43
|
+
}
|
|
44
|
+
getApiUrl() {
|
|
45
|
+
return this.client.defaults.baseURL || 'https://api.desplega.ai';
|
|
46
|
+
}
|
|
47
|
+
async validateApiKey(apiKey) {
|
|
48
|
+
const keyToValidate = apiKey || this.apiKey;
|
|
49
|
+
if (!keyToValidate) {
|
|
50
|
+
return {
|
|
51
|
+
success: false,
|
|
52
|
+
message: 'No API key provided',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const response = await this.client.get('/vibe-qa/check', {
|
|
57
|
+
headers: {
|
|
58
|
+
Authorization: `Bearer ${keyToValidate}`,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
// Store app_config.id if available
|
|
62
|
+
if (response.data?.data?.app_config?.id) {
|
|
63
|
+
this.appConfigId = response.data.data.app_config.id;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
...response.data,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (axios.isAxiosError(error)) {
|
|
72
|
+
const statusCode = error.response?.status;
|
|
73
|
+
const errorData = error.response?.data;
|
|
74
|
+
return {
|
|
75
|
+
success: false,
|
|
76
|
+
message: errorData?.message || `HTTP ${statusCode}: ${error.message}`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async createSession(options) {
|
|
86
|
+
try {
|
|
87
|
+
// Determine region from options or environment variable or config file
|
|
88
|
+
const region = options.region || getEnv('QA_USE_REGION') || 'auto';
|
|
89
|
+
const sessionData = {
|
|
90
|
+
url: options.url,
|
|
91
|
+
task: options.task,
|
|
92
|
+
ws_url: options.wsUrl,
|
|
93
|
+
dep_id: options.dependencyId,
|
|
94
|
+
source: 'mcp',
|
|
95
|
+
autopilot: true,
|
|
96
|
+
use_storage_path: false,
|
|
97
|
+
persist: true,
|
|
98
|
+
region: region,
|
|
99
|
+
};
|
|
100
|
+
if (options.devMode) {
|
|
101
|
+
sessionData.autopilot = false;
|
|
102
|
+
sessionData.use_storage_path = true;
|
|
103
|
+
sessionData.persist = false;
|
|
104
|
+
}
|
|
105
|
+
const response = await this.client.post('/vibe-qa/sessions', sessionData);
|
|
106
|
+
return {
|
|
107
|
+
sessionId: response.data.data.agent_id,
|
|
108
|
+
appConfigId: response.data.data.app_config_id,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (axios.isAxiosError(error)) {
|
|
113
|
+
const statusCode = error.response?.status;
|
|
114
|
+
const errorData = error.response?.data;
|
|
115
|
+
throw new Error(errorData?.message || errorData?.detail || `HTTP ${statusCode}: Failed to create session`);
|
|
116
|
+
}
|
|
117
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error creating session');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async listSessions(options = {}) {
|
|
121
|
+
try {
|
|
122
|
+
const params = new URLSearchParams();
|
|
123
|
+
if (options.limit !== undefined)
|
|
124
|
+
params.append('limit', options.limit.toString());
|
|
125
|
+
if (options.offset !== undefined)
|
|
126
|
+
params.append('offset', options.offset.toString());
|
|
127
|
+
if (options.query)
|
|
128
|
+
params.append('query', options.query);
|
|
129
|
+
params.append('self_only', 'true');
|
|
130
|
+
const response = await this.client.get(`/vibe-qa/sessions?${params.toString()}`);
|
|
131
|
+
return response.data;
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (axios.isAxiosError(error)) {
|
|
135
|
+
const statusCode = error.response?.status;
|
|
136
|
+
const errorData = error.response?.data;
|
|
137
|
+
throw new Error(errorData?.message || errorData?.detail || `HTTP ${statusCode}: Failed to fetch sessions`);
|
|
138
|
+
}
|
|
139
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error fetching sessions');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async getSession(sessionId, selfOnly = true) {
|
|
143
|
+
try {
|
|
144
|
+
const params = new URLSearchParams();
|
|
145
|
+
if (selfOnly) {
|
|
146
|
+
params.append('self_only', 'true');
|
|
147
|
+
}
|
|
148
|
+
const response = await this.client.get(`/vibe-qa/sessions/${sessionId}?${params.toString()}`);
|
|
149
|
+
return response.data;
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
if (axios.isAxiosError(error)) {
|
|
153
|
+
const statusCode = error.response?.status;
|
|
154
|
+
const errorData = error.response?.data;
|
|
155
|
+
if (statusCode === 404) {
|
|
156
|
+
throw new Error(`Session not found: ${sessionId}`);
|
|
157
|
+
}
|
|
158
|
+
throw new Error(errorData?.message || errorData?.detail || `HTTP ${statusCode}: Failed to fetch session`);
|
|
159
|
+
}
|
|
160
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error fetching session');
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async sendMessage(options) {
|
|
164
|
+
try {
|
|
165
|
+
const eventData = {
|
|
166
|
+
group_key: options.sessionId,
|
|
167
|
+
event_type: 'test_agent_2.event.incoming',
|
|
168
|
+
event_data: {
|
|
169
|
+
type: options.action,
|
|
170
|
+
message: options.data || '',
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
const response = await this.client.post('/vibe-qa/new-event', eventData);
|
|
174
|
+
return response.data;
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (axios.isAxiosError(error)) {
|
|
178
|
+
const statusCode = error.response?.status;
|
|
179
|
+
const errorData = error.response?.data;
|
|
180
|
+
throw new Error(errorData?.message ||
|
|
181
|
+
errorData?.detail ||
|
|
182
|
+
`HTTP ${statusCode}: Failed to send message to session`);
|
|
183
|
+
}
|
|
184
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error sending message to session');
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async register(email) {
|
|
188
|
+
try {
|
|
189
|
+
const response = await this.client.post('/vibe-qa/register', {
|
|
190
|
+
email,
|
|
191
|
+
cfg_type: 'local',
|
|
192
|
+
source: 'mcp',
|
|
193
|
+
});
|
|
194
|
+
return {
|
|
195
|
+
success: true,
|
|
196
|
+
message: response.data.message || 'Registration successful',
|
|
197
|
+
apiKey: response.data.apiKey,
|
|
198
|
+
...response.data,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
if (axios.isAxiosError(error)) {
|
|
203
|
+
const statusCode = error.response?.status;
|
|
204
|
+
const errorData = error.response?.data;
|
|
205
|
+
return {
|
|
206
|
+
success: false,
|
|
207
|
+
message: errorData?.message || errorData?.detail || `HTTP ${statusCode}: Registration failed`,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
success: false,
|
|
212
|
+
message: error instanceof Error ? error.message : 'Unknown error during registration',
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
async listTests(options = {}) {
|
|
217
|
+
try {
|
|
218
|
+
const params = new URLSearchParams();
|
|
219
|
+
if (options.limit !== undefined)
|
|
220
|
+
params.append('limit', options.limit.toString());
|
|
221
|
+
if (options.offset !== undefined)
|
|
222
|
+
params.append('offset', options.offset.toString());
|
|
223
|
+
if (options.query)
|
|
224
|
+
params.append('query', options.query);
|
|
225
|
+
if (options.self_only === undefined || options.self_only === true) {
|
|
226
|
+
params.append('self_only', 'true');
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
params.append('self_only', 'false');
|
|
230
|
+
}
|
|
231
|
+
const response = await this.client.get(`/vibe-qa/tests?${params.toString()}`);
|
|
232
|
+
return response.data.items;
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
if (axios.isAxiosError(error)) {
|
|
236
|
+
const statusCode = error.response?.status;
|
|
237
|
+
const errorData = error.response?.data;
|
|
238
|
+
throw new Error(errorData?.message || errorData?.detail || `HTTP ${statusCode}: Failed to fetch tests`);
|
|
239
|
+
}
|
|
240
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error fetching tests');
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
async getTest(testId, selfOnly = true) {
|
|
244
|
+
try {
|
|
245
|
+
const params = new URLSearchParams();
|
|
246
|
+
if (selfOnly) {
|
|
247
|
+
params.append('self_only', 'true');
|
|
248
|
+
}
|
|
249
|
+
const response = await this.client.get(`/vibe-qa/tests/${testId}?${params.toString()}`);
|
|
250
|
+
return response.data;
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
if (axios.isAxiosError(error)) {
|
|
254
|
+
const statusCode = error.response?.status;
|
|
255
|
+
const errorData = error.response?.data;
|
|
256
|
+
if (statusCode === 404) {
|
|
257
|
+
throw new Error(`Test not found: ${testId}`);
|
|
258
|
+
}
|
|
259
|
+
throw new Error(errorData?.message || errorData?.detail || `HTTP ${statusCode}: Failed to fetch test`);
|
|
260
|
+
}
|
|
261
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error fetching test');
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async runTests(options) {
|
|
265
|
+
try {
|
|
266
|
+
const requestData = {
|
|
267
|
+
test_ids: options.test_ids,
|
|
268
|
+
ws_url: options.ws_url,
|
|
269
|
+
app_config_id: options.app_config_id,
|
|
270
|
+
};
|
|
271
|
+
const response = await this.client.post('/vibe-qa/run-tests', requestData);
|
|
272
|
+
return {
|
|
273
|
+
success: true,
|
|
274
|
+
message: response.data.message || 'Tests started successfully',
|
|
275
|
+
test_run_id: response.data.test_run_id,
|
|
276
|
+
sessions: response.data.sessions,
|
|
277
|
+
...response.data,
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
if (axios.isAxiosError(error)) {
|
|
282
|
+
const statusCode = error.response?.status;
|
|
283
|
+
const errorData = error.response?.data;
|
|
284
|
+
return {
|
|
285
|
+
success: false,
|
|
286
|
+
message: errorData?.message || errorData?.detail || `HTTP ${statusCode}: Failed to run tests`,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
success: false,
|
|
291
|
+
message: error instanceof Error ? error.message : 'Unknown error running tests',
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
async listTestRuns(options = {}) {
|
|
296
|
+
try {
|
|
297
|
+
const params = new URLSearchParams();
|
|
298
|
+
if (options.test_id)
|
|
299
|
+
params.append('test_id', options.test_id);
|
|
300
|
+
if (options.run_id)
|
|
301
|
+
params.append('run_id', options.run_id);
|
|
302
|
+
if (options.limit !== undefined)
|
|
303
|
+
params.append('limit', options.limit.toString());
|
|
304
|
+
if (options.offset !== undefined)
|
|
305
|
+
params.append('offset', options.offset.toString());
|
|
306
|
+
const response = await this.client.get(`/vibe-qa/tests-runs?${params.toString()}`);
|
|
307
|
+
return response.data;
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
if (axios.isAxiosError(error)) {
|
|
311
|
+
const statusCode = error.response?.status;
|
|
312
|
+
const errorData = error.response?.data;
|
|
313
|
+
throw new Error(errorData?.message || errorData?.detail || `HTTP ${statusCode}: Failed to fetch test runs`);
|
|
314
|
+
}
|
|
315
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error fetching test runs');
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
async updateAppConfig(config) {
|
|
319
|
+
try {
|
|
320
|
+
if (!this.apiKey) {
|
|
321
|
+
return {
|
|
322
|
+
success: false,
|
|
323
|
+
message: 'API key not configured. Please set an API key first.',
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
// Apply default for vp_type if not specified
|
|
327
|
+
const configWithDefaults = {
|
|
328
|
+
...config,
|
|
329
|
+
vp_type: config.vp_type || 'desktop',
|
|
330
|
+
cfg_type: config.cfg_type || 'local',
|
|
331
|
+
};
|
|
332
|
+
const response = await this.client.post('/vibe-qa/app-configs', configWithDefaults);
|
|
333
|
+
return {
|
|
334
|
+
success: true,
|
|
335
|
+
message: response.data.message || 'App config updated successfully',
|
|
336
|
+
data: response.data,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
if (axios.isAxiosError(error)) {
|
|
341
|
+
const statusCode = error.response?.status;
|
|
342
|
+
const errorData = error.response?.data;
|
|
343
|
+
return {
|
|
344
|
+
success: false,
|
|
345
|
+
message: errorData?.message ||
|
|
346
|
+
errorData?.detail ||
|
|
347
|
+
`HTTP ${statusCode}: Failed to update app config`,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
success: false,
|
|
352
|
+
message: error instanceof Error ? error.message : 'Unknown error updating app config',
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
async listAppConfigs(options = {}) {
|
|
357
|
+
try {
|
|
358
|
+
if (!this.apiKey) {
|
|
359
|
+
throw new Error('API key not configured. Please set an API key first.');
|
|
360
|
+
}
|
|
361
|
+
const params = new URLSearchParams();
|
|
362
|
+
if (options.limit !== undefined)
|
|
363
|
+
params.append('limit', options.limit.toString());
|
|
364
|
+
if (options.offset !== undefined)
|
|
365
|
+
params.append('offset', options.offset.toString());
|
|
366
|
+
if (options.query)
|
|
367
|
+
params.append('query', options.query);
|
|
368
|
+
if (options.source)
|
|
369
|
+
params.append('source', options.source);
|
|
370
|
+
if (options.cfg_type)
|
|
371
|
+
params.append('cfg_type', options.cfg_type);
|
|
372
|
+
const response = await this.client.get(`/vibe-qa/app-configs?${params.toString()}`);
|
|
373
|
+
return response.data;
|
|
374
|
+
}
|
|
375
|
+
catch (error) {
|
|
376
|
+
if (axios.isAxiosError(error)) {
|
|
377
|
+
const statusCode = error.response?.status;
|
|
378
|
+
const errorData = error.response?.data;
|
|
379
|
+
throw new Error(errorData?.message ||
|
|
380
|
+
errorData?.detail ||
|
|
381
|
+
`HTTP ${statusCode}: Failed to fetch app configs`);
|
|
382
|
+
}
|
|
383
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error fetching app configs');
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
async setWsUrl(wsUrl) {
|
|
387
|
+
try {
|
|
388
|
+
if (!this.apiKey) {
|
|
389
|
+
return {
|
|
390
|
+
success: false,
|
|
391
|
+
message: 'API key not configured. Please set an API key first.',
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
const response = await this.client.post('/vibe-qa/ws-url', {
|
|
395
|
+
ws_url: wsUrl,
|
|
396
|
+
});
|
|
397
|
+
return {
|
|
398
|
+
success: true,
|
|
399
|
+
message: response.data.message || 'WebSocket URL set successfully',
|
|
400
|
+
data: response.data.data,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
catch (error) {
|
|
404
|
+
if (axios.isAxiosError(error)) {
|
|
405
|
+
const statusCode = error.response?.status;
|
|
406
|
+
const errorData = error.response?.data;
|
|
407
|
+
return {
|
|
408
|
+
success: false,
|
|
409
|
+
message: errorData?.message ||
|
|
410
|
+
errorData?.detail ||
|
|
411
|
+
`HTTP ${statusCode}: Failed to set WebSocket URL`,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
return {
|
|
415
|
+
success: false,
|
|
416
|
+
message: error instanceof Error ? error.message : 'Unknown error setting WebSocket URL',
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
// ==========================================
|
|
421
|
+
// CLI Test Definition Methods
|
|
422
|
+
// ==========================================
|
|
423
|
+
/**
|
|
424
|
+
* Run test definitions with SSE streaming progress
|
|
425
|
+
* @param options - Test execution options
|
|
426
|
+
* @param onEvent - Optional callback for SSE events
|
|
427
|
+
* @returns Promise resolving to test result
|
|
428
|
+
*/
|
|
429
|
+
async runCliTest(options, onEvent) {
|
|
430
|
+
try {
|
|
431
|
+
const response = await fetch(`${this.getApiUrl()}/vibe-qa/cli/run`, {
|
|
432
|
+
method: 'POST',
|
|
433
|
+
headers: {
|
|
434
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
435
|
+
'Content-Type': 'application/json',
|
|
436
|
+
Accept: 'text/event-stream',
|
|
437
|
+
},
|
|
438
|
+
body: JSON.stringify(options),
|
|
439
|
+
});
|
|
440
|
+
if (!response.ok) {
|
|
441
|
+
const errorData = (await response.json().catch(() => ({})));
|
|
442
|
+
throw new Error(errorData?.message || errorData?.detail || `HTTP ${response.status}: Failed to run test`);
|
|
443
|
+
}
|
|
444
|
+
let result = null;
|
|
445
|
+
// Stream SSE events
|
|
446
|
+
for await (const event of streamSSE(response)) {
|
|
447
|
+
if (onEvent)
|
|
448
|
+
onEvent(event);
|
|
449
|
+
// Capture final result
|
|
450
|
+
if (event.event === 'complete' || event.event === 'error') {
|
|
451
|
+
result = event.data;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
if (!result) {
|
|
455
|
+
throw new Error('No result received from test execution');
|
|
456
|
+
}
|
|
457
|
+
return result;
|
|
458
|
+
}
|
|
459
|
+
catch (error) {
|
|
460
|
+
if (error instanceof Error) {
|
|
461
|
+
throw error;
|
|
462
|
+
}
|
|
463
|
+
throw new Error('Unknown error running test');
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Export a database test to YAML or JSON format
|
|
468
|
+
* @param testId - UUID of the test to export
|
|
469
|
+
* @param format - Output format ('yaml' or 'json')
|
|
470
|
+
* @param includeDeps - Whether to include dependencies
|
|
471
|
+
* @returns Promise resolving to YAML/JSON string
|
|
472
|
+
*/
|
|
473
|
+
async exportTest(testId, format = 'yaml', includeDeps = true) {
|
|
474
|
+
try {
|
|
475
|
+
const params = new URLSearchParams();
|
|
476
|
+
params.append('format', format);
|
|
477
|
+
if (!includeDeps)
|
|
478
|
+
params.append('no_deps', 'true');
|
|
479
|
+
const response = await this.client.get(`/vibe-qa/cli/export/${testId}?${params.toString()}`);
|
|
480
|
+
return response.data;
|
|
481
|
+
}
|
|
482
|
+
catch (error) {
|
|
483
|
+
if (axios.isAxiosError(error)) {
|
|
484
|
+
const statusCode = error.response?.status;
|
|
485
|
+
const errorData = error.response?.data;
|
|
486
|
+
if (statusCode === 404) {
|
|
487
|
+
throw new Error(`Test not found: ${testId}`);
|
|
488
|
+
}
|
|
489
|
+
throw new Error(errorData?.message || errorData?.detail || `HTTP ${statusCode}: Failed to export test`);
|
|
490
|
+
}
|
|
491
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error exporting test');
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Validate test definitions without running them
|
|
496
|
+
* @param definitions - Array of TestDefinitions to validate
|
|
497
|
+
* @returns Promise resolving to validation result
|
|
498
|
+
*/
|
|
499
|
+
async validateTestDefinition(definitions) {
|
|
500
|
+
try {
|
|
501
|
+
const response = await this.client.post('/vibe-qa/cli/validate', {
|
|
502
|
+
test_definitions: definitions,
|
|
503
|
+
});
|
|
504
|
+
return response.data;
|
|
505
|
+
}
|
|
506
|
+
catch (error) {
|
|
507
|
+
if (axios.isAxiosError(error)) {
|
|
508
|
+
const statusCode = error.response?.status;
|
|
509
|
+
const errorData = error.response?.data;
|
|
510
|
+
throw new Error(errorData?.message ||
|
|
511
|
+
errorData?.detail ||
|
|
512
|
+
`HTTP ${statusCode}: Failed to validate test definition`);
|
|
513
|
+
}
|
|
514
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error validating test definition');
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Import (create/update) tests from definitions
|
|
519
|
+
* @param definitions - Array of TestDefinitions to import
|
|
520
|
+
* @param options - Import options (upsert, dry_run)
|
|
521
|
+
* @returns Promise resolving to import result
|
|
522
|
+
*/
|
|
523
|
+
async importTestDefinition(definitions, options = {}) {
|
|
524
|
+
try {
|
|
525
|
+
const response = await this.client.post('/vibe-qa/cli/import', {
|
|
526
|
+
test_definitions: definitions,
|
|
527
|
+
upsert: options.upsert ?? true,
|
|
528
|
+
dry_run: options.dry_run ?? false,
|
|
529
|
+
});
|
|
530
|
+
return response.data;
|
|
531
|
+
}
|
|
532
|
+
catch (error) {
|
|
533
|
+
if (axios.isAxiosError(error)) {
|
|
534
|
+
const statusCode = error.response?.status;
|
|
535
|
+
const errorData = error.response?.data;
|
|
536
|
+
throw new Error(errorData?.message ||
|
|
537
|
+
errorData?.detail ||
|
|
538
|
+
`HTTP ${statusCode}: Failed to import test definition`);
|
|
539
|
+
}
|
|
540
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error importing test definition');
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Get JSON Schema for TestDefinition format
|
|
545
|
+
* @returns Promise resolving to JSON Schema object
|
|
546
|
+
*/
|
|
547
|
+
async getTestDefinitionSchema() {
|
|
548
|
+
try {
|
|
549
|
+
const response = await this.client.get('/vibe-qa/cli/schema');
|
|
550
|
+
return response.data;
|
|
551
|
+
}
|
|
552
|
+
catch (error) {
|
|
553
|
+
if (axios.isAxiosError(error)) {
|
|
554
|
+
const statusCode = error.response?.status;
|
|
555
|
+
const errorData = error.response?.data;
|
|
556
|
+
throw new Error(errorData?.message ||
|
|
557
|
+
errorData?.detail ||
|
|
558
|
+
`HTTP ${statusCode}: Failed to fetch test definition schema`);
|
|
559
|
+
}
|
|
560
|
+
throw new Error(error instanceof Error ? error.message : 'Unknown error fetching test definition schema');
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAQzC,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAiB,MAAM,UAAU,CAAC;AAOpD,qDAAqD;AACrD,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,GACjB,CAAC;AAiRF,MAAM,OAAO,SAAS;IACH,MAAM,CAAgB;IAC/B,MAAM,GAAkB,IAAI,CAAC;IAC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C,OAAO,CAAC,CAAC,CAAC,+CAA+C,CACzF,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-Sent Events (SSE) parsing utilities
|
|
3
|
+
*
|
|
4
|
+
* Used for streaming test execution progress from /vibe-qa/cli/run endpoint
|
|
5
|
+
*/
|
|
6
|
+
export interface SSEEvent {
|
|
7
|
+
event: string;
|
|
8
|
+
data: any;
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse SSE data from a chunk of text
|
|
13
|
+
*
|
|
14
|
+
* @param chunk - Raw SSE text chunk (may contain multiple events)
|
|
15
|
+
* @returns Array of parsed SSE events
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseSSE(chunk: string): SSEEvent[];
|
|
18
|
+
/**
|
|
19
|
+
* Stream SSE events from a Response object
|
|
20
|
+
*
|
|
21
|
+
* @param response - Fetch Response with SSE stream
|
|
22
|
+
* @yields SSE events as they arrive
|
|
23
|
+
*/
|
|
24
|
+
export declare function streamSSE(response: Response): AsyncGenerator<SSEEvent, void, unknown>;
|
|
25
|
+
/**
|
|
26
|
+
* Helper to consume an SSE stream and call a callback for each event
|
|
27
|
+
*
|
|
28
|
+
* @param response - Fetch Response with SSE stream
|
|
29
|
+
* @param onEvent - Callback to handle each event
|
|
30
|
+
* @returns Promise that resolves when stream ends
|
|
31
|
+
*/
|
|
32
|
+
export declare function consumeSSE(response: Response, onEvent: (event: SSEEvent) => void | Promise<void>): Promise<void>;
|
|
33
|
+
//# sourceMappingURL=sse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../lib/api/sse.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,EAAE,CA4BlD;AAED;;;;;GAKG;AACH,wBAAuB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAyC5F;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACjD,OAAO,CAAC,IAAI,CAAC,CAIf"}
|