weave-typescript 0.11.13 → 0.11.15
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/dist/weaveapi/data/v1/data.pb.d.ts +54 -0
- package/dist/weaveapi/data/v1/data.pb.js +411 -0
- package/dist/weaveapi/data/v1/service.pb.d.ts +213 -0
- package/dist/weaveapi/data/v1/service.pb.js +1948 -0
- package/dist/weaveapi/input/v1/input.pb.d.ts +77 -0
- package/dist/weaveapi/input/v1/input.pb.js +632 -0
- package/dist/weaveapi/input/v1/service.pb.d.ts +311 -0
- package/dist/weaveapi/input/v1/service.pb.js +3001 -0
- package/dist/weaveapi/integration/v1/integration.pb.d.ts +67 -0
- package/dist/weaveapi/integration/v1/integration.pb.js +486 -0
- package/dist/weaveapi/integration/v1/service.pb.d.ts +236 -0
- package/dist/weaveapi/integration/v1/service.pb.js +2220 -0
- package/dist/weaveapi/report/v1/report.pb.d.ts +79 -0
- package/dist/weaveapi/report/v1/report.pb.js +638 -0
- package/dist/weaveapi/report/v1/service.pb.d.ts +194 -0
- package/dist/weaveapi/report/v1/service.pb.js +1630 -0
- package/dist/weaveapi/requirement/v1/requirement.pb.d.ts +70 -0
- package/dist/weaveapi/requirement/v1/requirement.pb.js +570 -0
- package/dist/weaveapi/requirement/v1/service.pb.d.ts +310 -0
- package/dist/weaveapi/requirement/v1/service.pb.js +2978 -0
- package/dist/weaveapi/run/v1/run.pb.d.ts +116 -0
- package/dist/weaveapi/run/v1/run.pb.js +1135 -0
- package/dist/weaveapi/run/v1/service.pb.d.ts +229 -0
- package/dist/weaveapi/run/v1/service.pb.js +2106 -0
- package/dist/weaveapi/script/v1/script.pb.d.ts +102 -0
- package/dist/weaveapi/script/v1/script.pb.js +1025 -0
- package/dist/weaveapi/script/v1/service.pb.d.ts +426 -0
- package/dist/weaveapi/script/v1/service.pb.js +4399 -0
- package/dist/weaveapi/storage/v1/service.pb.d.ts +4 -0
- package/dist/weaveapi/storage/v1/service.pb.js +50 -7
- package/dist/weaveapi/storage/v1/storage.pb.d.ts +2 -0
- package/dist/weaveapi/storage/v1/storage.pb.js +23 -0
- package/dist/weaveapi/storage/v1/vcs.pb.d.ts +75 -0
- package/dist/weaveapi/storage/v1/vcs.pb.js +864 -0
- package/dist/weaveapi/suite/v1/service.pb.d.ts +373 -0
- package/dist/weaveapi/suite/v1/service.pb.js +3629 -0
- package/dist/weaveapi/suite/v1/suite.pb.d.ts +92 -0
- package/dist/weaveapi/suite/v1/suite.pb.js +876 -0
- package/dist/weaveapi/testcase/v1/service.pb.d.ts +422 -0
- package/dist/weaveapi/testcase/v1/service.pb.js +4254 -0
- package/dist/weaveapi/testcase/v1/testcase.pb.d.ts +91 -0
- package/dist/weaveapi/testcase/v1/testcase.pb.js +794 -0
- package/dist/weavesql/weavedb/data_asset_sql.d.ts +141 -0
- package/dist/weavesql/weavedb/data_asset_sql.js +217 -0
- package/dist/weavesql/weavedb/input_sql.d.ts +230 -0
- package/dist/weavesql/weavedb/input_sql.js +384 -0
- package/dist/weavesql/weavedb/integration_sql.d.ts +170 -0
- package/dist/weavesql/weavedb/integration_sql.js +258 -0
- package/dist/weavesql/weavedb/report_sql.d.ts +138 -0
- package/dist/weavesql/weavedb/report_sql.js +232 -0
- package/dist/weavesql/weavedb/requirement_sql.d.ts +168 -0
- package/dist/weavesql/weavedb/requirement_sql.js +283 -0
- package/dist/weavesql/weavedb/run_sql.d.ts +247 -0
- package/dist/weavesql/weavedb/run_sql.js +415 -0
- package/dist/weavesql/weavedb/suite_sql.d.ts +228 -0
- package/dist/weavesql/weavedb/suite_sql.js +399 -0
- package/dist/weavesql/weavedb/test_case_sql.d.ts +261 -0
- package/dist/weavesql/weavedb/test_case_sql.js +446 -0
- package/dist/weavesql/weavedb/test_script_sql.d.ts +290 -0
- package/dist/weavesql/weavedb/test_script_sql.js +488 -0
- package/dist/weavesql/weavedb/traceability_sql.d.ts +59 -0
- package/dist/weavesql/weavedb/traceability_sql.js +155 -0
- package/package.json +1 -1
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTestRunLiveCountsQuery = exports.listTestRunArtifactsQuery = exports.createTestRunArtifactQuery = exports.listTestRunCaseResultsQuery = exports.upsertTestRunCaseResultQuery = exports.cancelTestRunQuery = exports.updateTestRunStatusQuery = exports.listTestRunsByWorkflowQuery = exports.getTestRunQuery = exports.createTestRunQuery = void 0;
|
|
4
|
+
exports.createTestRun = createTestRun;
|
|
5
|
+
exports.getTestRun = getTestRun;
|
|
6
|
+
exports.listTestRunsByWorkflow = listTestRunsByWorkflow;
|
|
7
|
+
exports.updateTestRunStatus = updateTestRunStatus;
|
|
8
|
+
exports.cancelTestRun = cancelTestRun;
|
|
9
|
+
exports.upsertTestRunCaseResult = upsertTestRunCaseResult;
|
|
10
|
+
exports.listTestRunCaseResults = listTestRunCaseResults;
|
|
11
|
+
exports.createTestRunArtifact = createTestRunArtifact;
|
|
12
|
+
exports.listTestRunArtifacts = listTestRunArtifacts;
|
|
13
|
+
exports.getTestRunLiveCounts = getTestRunLiveCounts;
|
|
14
|
+
exports.createTestRunQuery = `-- name: CreateTestRun :one
|
|
15
|
+
INSERT INTO weave_v1.test_run (
|
|
16
|
+
id,
|
|
17
|
+
workflow_id,
|
|
18
|
+
test_suite_id,
|
|
19
|
+
status,
|
|
20
|
+
environment,
|
|
21
|
+
triggered_by,
|
|
22
|
+
runtime_config,
|
|
23
|
+
summary,
|
|
24
|
+
trace_id,
|
|
25
|
+
queued_at
|
|
26
|
+
)
|
|
27
|
+
VALUES (
|
|
28
|
+
$1,
|
|
29
|
+
$2,
|
|
30
|
+
$3,
|
|
31
|
+
$4,
|
|
32
|
+
$5,
|
|
33
|
+
$6,
|
|
34
|
+
$7,
|
|
35
|
+
$8,
|
|
36
|
+
$9,
|
|
37
|
+
NOW()
|
|
38
|
+
)
|
|
39
|
+
RETURNING id, workflow_id, test_suite_id, status, environment, triggered_by, runtime_config, summary, trace_id, queued_at, started_at, finished_at, created_at, updated_at`;
|
|
40
|
+
async function createTestRun(client, args) {
|
|
41
|
+
const result = await client.query({
|
|
42
|
+
text: exports.createTestRunQuery,
|
|
43
|
+
values: [args.id, args.workflowId, args.testSuiteId, args.status, args.environment, args.triggeredBy, args.runtimeConfig, args.summary, args.traceId],
|
|
44
|
+
rowMode: "array"
|
|
45
|
+
});
|
|
46
|
+
if (result.rows.length !== 1) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const row = result.rows[0];
|
|
50
|
+
return {
|
|
51
|
+
id: row[0],
|
|
52
|
+
workflowId: row[1],
|
|
53
|
+
testSuiteId: row[2],
|
|
54
|
+
status: row[3],
|
|
55
|
+
environment: row[4],
|
|
56
|
+
triggeredBy: row[5],
|
|
57
|
+
runtimeConfig: row[6],
|
|
58
|
+
summary: row[7],
|
|
59
|
+
traceId: row[8],
|
|
60
|
+
queuedAt: row[9],
|
|
61
|
+
startedAt: row[10],
|
|
62
|
+
finishedAt: row[11],
|
|
63
|
+
createdAt: row[12],
|
|
64
|
+
updatedAt: row[13]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
exports.getTestRunQuery = `-- name: GetTestRun :one
|
|
68
|
+
SELECT id, workflow_id, test_suite_id, status, environment, triggered_by, runtime_config, summary, trace_id, queued_at, started_at, finished_at, created_at, updated_at
|
|
69
|
+
FROM weave_v1.test_run
|
|
70
|
+
WHERE id = $1
|
|
71
|
+
AND workflow_id = $2`;
|
|
72
|
+
async function getTestRun(client, args) {
|
|
73
|
+
const result = await client.query({
|
|
74
|
+
text: exports.getTestRunQuery,
|
|
75
|
+
values: [args.id, args.workflowId],
|
|
76
|
+
rowMode: "array"
|
|
77
|
+
});
|
|
78
|
+
if (result.rows.length !== 1) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const row = result.rows[0];
|
|
82
|
+
return {
|
|
83
|
+
id: row[0],
|
|
84
|
+
workflowId: row[1],
|
|
85
|
+
testSuiteId: row[2],
|
|
86
|
+
status: row[3],
|
|
87
|
+
environment: row[4],
|
|
88
|
+
triggeredBy: row[5],
|
|
89
|
+
runtimeConfig: row[6],
|
|
90
|
+
summary: row[7],
|
|
91
|
+
traceId: row[8],
|
|
92
|
+
queuedAt: row[9],
|
|
93
|
+
startedAt: row[10],
|
|
94
|
+
finishedAt: row[11],
|
|
95
|
+
createdAt: row[12],
|
|
96
|
+
updatedAt: row[13]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
exports.listTestRunsByWorkflowQuery = `-- name: ListTestRunsByWorkflow :many
|
|
100
|
+
SELECT id, workflow_id, test_suite_id, status, environment, triggered_by, runtime_config, summary, trace_id, queued_at, started_at, finished_at, created_at, updated_at
|
|
101
|
+
FROM weave_v1.test_run
|
|
102
|
+
WHERE workflow_id = $1
|
|
103
|
+
ORDER BY created_at DESC
|
|
104
|
+
LIMIT $3
|
|
105
|
+
OFFSET $2`;
|
|
106
|
+
async function listTestRunsByWorkflow(client, args) {
|
|
107
|
+
const result = await client.query({
|
|
108
|
+
text: exports.listTestRunsByWorkflowQuery,
|
|
109
|
+
values: [args.workflowId, args.pageOffset, args.pageSize],
|
|
110
|
+
rowMode: "array"
|
|
111
|
+
});
|
|
112
|
+
return result.rows.map(row => {
|
|
113
|
+
return {
|
|
114
|
+
id: row[0],
|
|
115
|
+
workflowId: row[1],
|
|
116
|
+
testSuiteId: row[2],
|
|
117
|
+
status: row[3],
|
|
118
|
+
environment: row[4],
|
|
119
|
+
triggeredBy: row[5],
|
|
120
|
+
runtimeConfig: row[6],
|
|
121
|
+
summary: row[7],
|
|
122
|
+
traceId: row[8],
|
|
123
|
+
queuedAt: row[9],
|
|
124
|
+
startedAt: row[10],
|
|
125
|
+
finishedAt: row[11],
|
|
126
|
+
createdAt: row[12],
|
|
127
|
+
updatedAt: row[13]
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
exports.updateTestRunStatusQuery = `-- name: UpdateTestRunStatus :one
|
|
132
|
+
UPDATE weave_v1.test_run
|
|
133
|
+
SET status = $1,
|
|
134
|
+
started_at = $2,
|
|
135
|
+
finished_at = $3,
|
|
136
|
+
summary = $4,
|
|
137
|
+
updated_at = NOW()
|
|
138
|
+
WHERE id = $5
|
|
139
|
+
AND workflow_id = $6
|
|
140
|
+
RETURNING id, workflow_id, test_suite_id, status, environment, triggered_by, runtime_config, summary, trace_id, queued_at, started_at, finished_at, created_at, updated_at`;
|
|
141
|
+
async function updateTestRunStatus(client, args) {
|
|
142
|
+
const result = await client.query({
|
|
143
|
+
text: exports.updateTestRunStatusQuery,
|
|
144
|
+
values: [args.status, args.startedAt, args.finishedAt, args.summary, args.id, args.workflowId],
|
|
145
|
+
rowMode: "array"
|
|
146
|
+
});
|
|
147
|
+
if (result.rows.length !== 1) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const row = result.rows[0];
|
|
151
|
+
return {
|
|
152
|
+
id: row[0],
|
|
153
|
+
workflowId: row[1],
|
|
154
|
+
testSuiteId: row[2],
|
|
155
|
+
status: row[3],
|
|
156
|
+
environment: row[4],
|
|
157
|
+
triggeredBy: row[5],
|
|
158
|
+
runtimeConfig: row[6],
|
|
159
|
+
summary: row[7],
|
|
160
|
+
traceId: row[8],
|
|
161
|
+
queuedAt: row[9],
|
|
162
|
+
startedAt: row[10],
|
|
163
|
+
finishedAt: row[11],
|
|
164
|
+
createdAt: row[12],
|
|
165
|
+
updatedAt: row[13]
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
exports.cancelTestRunQuery = `-- name: CancelTestRun :one
|
|
169
|
+
UPDATE weave_v1.test_run
|
|
170
|
+
SET status = 'canceled',
|
|
171
|
+
finished_at = NOW(),
|
|
172
|
+
updated_at = NOW()
|
|
173
|
+
WHERE id = $1
|
|
174
|
+
AND workflow_id = $2
|
|
175
|
+
RETURNING id, workflow_id, test_suite_id, status, environment, triggered_by, runtime_config, summary, trace_id, queued_at, started_at, finished_at, created_at, updated_at`;
|
|
176
|
+
async function cancelTestRun(client, args) {
|
|
177
|
+
const result = await client.query({
|
|
178
|
+
text: exports.cancelTestRunQuery,
|
|
179
|
+
values: [args.id, args.workflowId],
|
|
180
|
+
rowMode: "array"
|
|
181
|
+
});
|
|
182
|
+
if (result.rows.length !== 1) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
const row = result.rows[0];
|
|
186
|
+
return {
|
|
187
|
+
id: row[0],
|
|
188
|
+
workflowId: row[1],
|
|
189
|
+
testSuiteId: row[2],
|
|
190
|
+
status: row[3],
|
|
191
|
+
environment: row[4],
|
|
192
|
+
triggeredBy: row[5],
|
|
193
|
+
runtimeConfig: row[6],
|
|
194
|
+
summary: row[7],
|
|
195
|
+
traceId: row[8],
|
|
196
|
+
queuedAt: row[9],
|
|
197
|
+
startedAt: row[10],
|
|
198
|
+
finishedAt: row[11],
|
|
199
|
+
createdAt: row[12],
|
|
200
|
+
updatedAt: row[13]
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
exports.upsertTestRunCaseResultQuery = `-- name: UpsertTestRunCaseResult :one
|
|
204
|
+
INSERT INTO weave_v1.test_run_case_result (
|
|
205
|
+
id,
|
|
206
|
+
test_run_id,
|
|
207
|
+
test_case_id,
|
|
208
|
+
test_script_id,
|
|
209
|
+
status,
|
|
210
|
+
duration_ms,
|
|
211
|
+
error_summary,
|
|
212
|
+
assertion_count,
|
|
213
|
+
failed_assertion_count,
|
|
214
|
+
details,
|
|
215
|
+
started_at,
|
|
216
|
+
finished_at
|
|
217
|
+
)
|
|
218
|
+
VALUES (
|
|
219
|
+
$1,
|
|
220
|
+
$2,
|
|
221
|
+
$3,
|
|
222
|
+
$4,
|
|
223
|
+
$5,
|
|
224
|
+
$6,
|
|
225
|
+
$7,
|
|
226
|
+
$8,
|
|
227
|
+
$9,
|
|
228
|
+
$10,
|
|
229
|
+
$11,
|
|
230
|
+
$12
|
|
231
|
+
)
|
|
232
|
+
ON CONFLICT (id) DO UPDATE
|
|
233
|
+
SET status = EXCLUDED.status,
|
|
234
|
+
duration_ms = EXCLUDED.duration_ms,
|
|
235
|
+
error_summary = EXCLUDED.error_summary,
|
|
236
|
+
assertion_count = EXCLUDED.assertion_count,
|
|
237
|
+
failed_assertion_count = EXCLUDED.failed_assertion_count,
|
|
238
|
+
details = EXCLUDED.details,
|
|
239
|
+
started_at = EXCLUDED.started_at,
|
|
240
|
+
finished_at = EXCLUDED.finished_at,
|
|
241
|
+
updated_at = NOW()
|
|
242
|
+
RETURNING id, test_run_id, test_case_id, test_script_id, status, duration_ms, error_summary, assertion_count, failed_assertion_count, details, started_at, finished_at, created_at, updated_at`;
|
|
243
|
+
async function upsertTestRunCaseResult(client, args) {
|
|
244
|
+
const result = await client.query({
|
|
245
|
+
text: exports.upsertTestRunCaseResultQuery,
|
|
246
|
+
values: [args.id, args.testRunId, args.testCaseId, args.testScriptId, args.status, args.durationMs, args.errorSummary, args.assertionCount, args.failedAssertionCount, args.details, args.startedAt, args.finishedAt],
|
|
247
|
+
rowMode: "array"
|
|
248
|
+
});
|
|
249
|
+
if (result.rows.length !== 1) {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
const row = result.rows[0];
|
|
253
|
+
return {
|
|
254
|
+
id: row[0],
|
|
255
|
+
testRunId: row[1],
|
|
256
|
+
testCaseId: row[2],
|
|
257
|
+
testScriptId: row[3],
|
|
258
|
+
status: row[4],
|
|
259
|
+
durationMs: row[5],
|
|
260
|
+
errorSummary: row[6],
|
|
261
|
+
assertionCount: row[7],
|
|
262
|
+
failedAssertionCount: row[8],
|
|
263
|
+
details: row[9],
|
|
264
|
+
startedAt: row[10],
|
|
265
|
+
finishedAt: row[11],
|
|
266
|
+
createdAt: row[12],
|
|
267
|
+
updatedAt: row[13]
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
exports.listTestRunCaseResultsQuery = `-- name: ListTestRunCaseResults :many
|
|
271
|
+
SELECT cr.id, cr.test_run_id, cr.test_case_id, cr.test_script_id, cr.status, cr.duration_ms, cr.error_summary, cr.assertion_count, cr.failed_assertion_count, cr.details, cr.started_at, cr.finished_at, cr.created_at, cr.updated_at
|
|
272
|
+
FROM weave_v1.test_run_case_result cr
|
|
273
|
+
INNER JOIN weave_v1.test_run r ON r.id = cr.test_run_id
|
|
274
|
+
WHERE cr.test_run_id = $1
|
|
275
|
+
AND r.workflow_id = $2
|
|
276
|
+
ORDER BY cr.created_at ASC
|
|
277
|
+
LIMIT $4
|
|
278
|
+
OFFSET $3`;
|
|
279
|
+
async function listTestRunCaseResults(client, args) {
|
|
280
|
+
const result = await client.query({
|
|
281
|
+
text: exports.listTestRunCaseResultsQuery,
|
|
282
|
+
values: [args.testRunId, args.workflowId, args.pageOffset, args.pageSize],
|
|
283
|
+
rowMode: "array"
|
|
284
|
+
});
|
|
285
|
+
return result.rows.map(row => {
|
|
286
|
+
return {
|
|
287
|
+
id: row[0],
|
|
288
|
+
testRunId: row[1],
|
|
289
|
+
testCaseId: row[2],
|
|
290
|
+
testScriptId: row[3],
|
|
291
|
+
status: row[4],
|
|
292
|
+
durationMs: row[5],
|
|
293
|
+
errorSummary: row[6],
|
|
294
|
+
assertionCount: row[7],
|
|
295
|
+
failedAssertionCount: row[8],
|
|
296
|
+
details: row[9],
|
|
297
|
+
startedAt: row[10],
|
|
298
|
+
finishedAt: row[11],
|
|
299
|
+
createdAt: row[12],
|
|
300
|
+
updatedAt: row[13]
|
|
301
|
+
};
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
exports.createTestRunArtifactQuery = `-- name: CreateTestRunArtifact :one
|
|
305
|
+
INSERT INTO weave_v1.test_run_artifact (
|
|
306
|
+
id,
|
|
307
|
+
test_run_id,
|
|
308
|
+
test_run_case_result_id,
|
|
309
|
+
artifact_type,
|
|
310
|
+
name,
|
|
311
|
+
storage_connection_id,
|
|
312
|
+
uri,
|
|
313
|
+
content_type,
|
|
314
|
+
size_bytes,
|
|
315
|
+
checksum,
|
|
316
|
+
metadata
|
|
317
|
+
)
|
|
318
|
+
VALUES (
|
|
319
|
+
$1,
|
|
320
|
+
$2,
|
|
321
|
+
$3,
|
|
322
|
+
$4,
|
|
323
|
+
$5,
|
|
324
|
+
$6,
|
|
325
|
+
$7,
|
|
326
|
+
$8,
|
|
327
|
+
$9,
|
|
328
|
+
$10,
|
|
329
|
+
$11
|
|
330
|
+
)
|
|
331
|
+
RETURNING id, test_run_id, test_run_case_result_id, artifact_type, name, storage_connection_id, uri, content_type, size_bytes, checksum, metadata, created_at`;
|
|
332
|
+
async function createTestRunArtifact(client, args) {
|
|
333
|
+
const result = await client.query({
|
|
334
|
+
text: exports.createTestRunArtifactQuery,
|
|
335
|
+
values: [args.id, args.testRunId, args.testRunCaseResultId, args.artifactType, args.name, args.storageConnectionId, args.uri, args.contentType, args.sizeBytes, args.checksum, args.metadata],
|
|
336
|
+
rowMode: "array"
|
|
337
|
+
});
|
|
338
|
+
if (result.rows.length !== 1) {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
const row = result.rows[0];
|
|
342
|
+
return {
|
|
343
|
+
id: row[0],
|
|
344
|
+
testRunId: row[1],
|
|
345
|
+
testRunCaseResultId: row[2],
|
|
346
|
+
artifactType: row[3],
|
|
347
|
+
name: row[4],
|
|
348
|
+
storageConnectionId: row[5],
|
|
349
|
+
uri: row[6],
|
|
350
|
+
contentType: row[7],
|
|
351
|
+
sizeBytes: row[8],
|
|
352
|
+
checksum: row[9],
|
|
353
|
+
metadata: row[10],
|
|
354
|
+
createdAt: row[11]
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
exports.listTestRunArtifactsQuery = `-- name: ListTestRunArtifacts :many
|
|
358
|
+
SELECT a.id, a.test_run_id, a.test_run_case_result_id, a.artifact_type, a.name, a.storage_connection_id, a.uri, a.content_type, a.size_bytes, a.checksum, a.metadata, a.created_at
|
|
359
|
+
FROM weave_v1.test_run_artifact a
|
|
360
|
+
INNER JOIN weave_v1.test_run r ON r.id = a.test_run_id
|
|
361
|
+
WHERE a.test_run_id = $1
|
|
362
|
+
AND r.workflow_id = $2
|
|
363
|
+
AND ($3::UUID IS NULL OR a.test_run_case_result_id = $3)
|
|
364
|
+
ORDER BY a.created_at ASC
|
|
365
|
+
LIMIT $5
|
|
366
|
+
OFFSET $4`;
|
|
367
|
+
async function listTestRunArtifacts(client, args) {
|
|
368
|
+
const result = await client.query({
|
|
369
|
+
text: exports.listTestRunArtifactsQuery,
|
|
370
|
+
values: [args.testRunId, args.workflowId, args.testRunCaseResultId, args.pageOffset, args.pageSize],
|
|
371
|
+
rowMode: "array"
|
|
372
|
+
});
|
|
373
|
+
return result.rows.map(row => {
|
|
374
|
+
return {
|
|
375
|
+
id: row[0],
|
|
376
|
+
testRunId: row[1],
|
|
377
|
+
testRunCaseResultId: row[2],
|
|
378
|
+
artifactType: row[3],
|
|
379
|
+
name: row[4],
|
|
380
|
+
storageConnectionId: row[5],
|
|
381
|
+
uri: row[6],
|
|
382
|
+
contentType: row[7],
|
|
383
|
+
sizeBytes: row[8],
|
|
384
|
+
checksum: row[9],
|
|
385
|
+
metadata: row[10],
|
|
386
|
+
createdAt: row[11]
|
|
387
|
+
};
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
exports.getTestRunLiveCountsQuery = `-- name: GetTestRunLiveCounts :one
|
|
391
|
+
SELECT COUNT(*) FILTER ( WHERE status = 'pending')::INTEGER AS pending_count,
|
|
392
|
+
COUNT(*) FILTER ( WHERE status = 'running')::INTEGER AS running_count,
|
|
393
|
+
COUNT(*) FILTER ( WHERE status = 'passed')::INTEGER AS passed_count,
|
|
394
|
+
COUNT(*) FILTER ( WHERE status = 'failed')::INTEGER AS failed_count,
|
|
395
|
+
COUNT(*)::INTEGER AS total_count
|
|
396
|
+
FROM weave_v1.test_run_case_result
|
|
397
|
+
WHERE test_run_id = $1`;
|
|
398
|
+
async function getTestRunLiveCounts(client, args) {
|
|
399
|
+
const result = await client.query({
|
|
400
|
+
text: exports.getTestRunLiveCountsQuery,
|
|
401
|
+
values: [args.testRunId],
|
|
402
|
+
rowMode: "array"
|
|
403
|
+
});
|
|
404
|
+
if (result.rows.length !== 1) {
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
const row = result.rows[0];
|
|
408
|
+
return {
|
|
409
|
+
pendingCount: row[0],
|
|
410
|
+
runningCount: row[1],
|
|
411
|
+
passedCount: row[2],
|
|
412
|
+
failedCount: row[3],
|
|
413
|
+
totalCount: row[4]
|
|
414
|
+
};
|
|
415
|
+
}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
2
|
+
interface Client {
|
|
3
|
+
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
|
+
}
|
|
5
|
+
export declare const createTestSuiteQuery = "-- name: CreateTestSuite :one\nINSERT INTO weave_v1.test_suite (\n id,\n workflow_id,\n name,\n description,\n status,\n goal,\n current_version,\n execution_profile,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9\n)\nRETURNING id, workflow_id, name, description, status, goal, current_version, execution_profile, metadata, created_at, updated_at, archived_at";
|
|
6
|
+
export interface CreateTestSuiteArgs {
|
|
7
|
+
id: string;
|
|
8
|
+
workflowId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
status: string;
|
|
12
|
+
goal: string;
|
|
13
|
+
currentVersion: number;
|
|
14
|
+
executionProfile: any;
|
|
15
|
+
metadata: any;
|
|
16
|
+
}
|
|
17
|
+
export interface CreateTestSuiteRow {
|
|
18
|
+
id: string;
|
|
19
|
+
workflowId: string;
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
status: string;
|
|
23
|
+
goal: string;
|
|
24
|
+
currentVersion: number;
|
|
25
|
+
executionProfile: any;
|
|
26
|
+
metadata: any;
|
|
27
|
+
createdAt: Date;
|
|
28
|
+
updatedAt: Date;
|
|
29
|
+
archivedAt: Date | null;
|
|
30
|
+
}
|
|
31
|
+
export declare function createTestSuite(client: Client, args: CreateTestSuiteArgs): Promise<CreateTestSuiteRow | null>;
|
|
32
|
+
export declare const getTestSuiteQuery = "-- name: GetTestSuite :one\nSELECT id, workflow_id, name, description, status, goal, current_version, execution_profile, metadata, created_at, updated_at, archived_at\nFROM weave_v1.test_suite\nWHERE id = $1\n AND workflow_id = $2";
|
|
33
|
+
export interface GetTestSuiteArgs {
|
|
34
|
+
id: string;
|
|
35
|
+
workflowId: string;
|
|
36
|
+
}
|
|
37
|
+
export interface GetTestSuiteRow {
|
|
38
|
+
id: string;
|
|
39
|
+
workflowId: string;
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
status: string;
|
|
43
|
+
goal: string;
|
|
44
|
+
currentVersion: number;
|
|
45
|
+
executionProfile: any;
|
|
46
|
+
metadata: any;
|
|
47
|
+
createdAt: Date;
|
|
48
|
+
updatedAt: Date;
|
|
49
|
+
archivedAt: Date | null;
|
|
50
|
+
}
|
|
51
|
+
export declare function getTestSuite(client: Client, args: GetTestSuiteArgs): Promise<GetTestSuiteRow | null>;
|
|
52
|
+
export declare const listTestSuitesByWorkflowQuery = "-- name: ListTestSuitesByWorkflow :many\nSELECT id, workflow_id, name, description, status, goal, current_version, execution_profile, metadata, created_at, updated_at, archived_at\nFROM weave_v1.test_suite\nWHERE workflow_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
|
|
53
|
+
export interface ListTestSuitesByWorkflowArgs {
|
|
54
|
+
workflowId: string;
|
|
55
|
+
includeArchived: boolean;
|
|
56
|
+
pageOffset: string;
|
|
57
|
+
pageSize: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ListTestSuitesByWorkflowRow {
|
|
60
|
+
id: string;
|
|
61
|
+
workflowId: string;
|
|
62
|
+
name: string;
|
|
63
|
+
description: string;
|
|
64
|
+
status: string;
|
|
65
|
+
goal: string;
|
|
66
|
+
currentVersion: number;
|
|
67
|
+
executionProfile: any;
|
|
68
|
+
metadata: any;
|
|
69
|
+
createdAt: Date;
|
|
70
|
+
updatedAt: Date;
|
|
71
|
+
archivedAt: Date | null;
|
|
72
|
+
}
|
|
73
|
+
export declare function listTestSuitesByWorkflow(client: Client, args: ListTestSuitesByWorkflowArgs): Promise<ListTestSuitesByWorkflowRow[]>;
|
|
74
|
+
export declare const updateTestSuiteQuery = "-- name: UpdateTestSuite :one\nUPDATE weave_v1.test_suite\nSET name = $1,\n description = $2,\n status = $3,\n goal = $4,\n current_version = $5,\n execution_profile = $6,\n metadata = $7,\n updated_at = NOW()\nWHERE id = $8\n AND workflow_id = $9\nRETURNING id, workflow_id, name, description, status, goal, current_version, execution_profile, metadata, created_at, updated_at, archived_at";
|
|
75
|
+
export interface UpdateTestSuiteArgs {
|
|
76
|
+
name: string;
|
|
77
|
+
description: string;
|
|
78
|
+
status: string;
|
|
79
|
+
goal: string;
|
|
80
|
+
currentVersion: number;
|
|
81
|
+
executionProfile: any;
|
|
82
|
+
metadata: any;
|
|
83
|
+
id: string;
|
|
84
|
+
workflowId: string;
|
|
85
|
+
}
|
|
86
|
+
export interface UpdateTestSuiteRow {
|
|
87
|
+
id: string;
|
|
88
|
+
workflowId: string;
|
|
89
|
+
name: string;
|
|
90
|
+
description: string;
|
|
91
|
+
status: string;
|
|
92
|
+
goal: string;
|
|
93
|
+
currentVersion: number;
|
|
94
|
+
executionProfile: any;
|
|
95
|
+
metadata: any;
|
|
96
|
+
createdAt: Date;
|
|
97
|
+
updatedAt: Date;
|
|
98
|
+
archivedAt: Date | null;
|
|
99
|
+
}
|
|
100
|
+
export declare function updateTestSuite(client: Client, args: UpdateTestSuiteArgs): Promise<UpdateTestSuiteRow | null>;
|
|
101
|
+
export declare const archiveTestSuiteQuery = "-- name: ArchiveTestSuite :one\nUPDATE weave_v1.test_suite\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\n AND workflow_id = $2\nRETURNING id, workflow_id, name, description, status, goal, current_version, execution_profile, metadata, created_at, updated_at, archived_at";
|
|
102
|
+
export interface ArchiveTestSuiteArgs {
|
|
103
|
+
id: string;
|
|
104
|
+
workflowId: string;
|
|
105
|
+
}
|
|
106
|
+
export interface ArchiveTestSuiteRow {
|
|
107
|
+
id: string;
|
|
108
|
+
workflowId: string;
|
|
109
|
+
name: string;
|
|
110
|
+
description: string;
|
|
111
|
+
status: string;
|
|
112
|
+
goal: string;
|
|
113
|
+
currentVersion: number;
|
|
114
|
+
executionProfile: any;
|
|
115
|
+
metadata: any;
|
|
116
|
+
createdAt: Date;
|
|
117
|
+
updatedAt: Date;
|
|
118
|
+
archivedAt: Date | null;
|
|
119
|
+
}
|
|
120
|
+
export declare function archiveTestSuite(client: Client, args: ArchiveTestSuiteArgs): Promise<ArchiveTestSuiteRow | null>;
|
|
121
|
+
export declare const deleteTestSuiteQuery = "-- name: DeleteTestSuite :exec\nDELETE\nFROM weave_v1.test_suite\nWHERE id = $1\n AND workflow_id = $2";
|
|
122
|
+
export interface DeleteTestSuiteArgs {
|
|
123
|
+
id: string;
|
|
124
|
+
workflowId: string;
|
|
125
|
+
}
|
|
126
|
+
export declare function deleteTestSuite(client: Client, args: DeleteTestSuiteArgs): Promise<void>;
|
|
127
|
+
export declare const upsertTestSuiteItemQuery = "-- name: UpsertTestSuiteItem :one\nINSERT INTO weave_v1.test_suite_item (\n id,\n test_suite_id,\n test_case_id,\n test_script_id,\n position,\n is_required,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7\n)\nON CONFLICT (test_suite_id, position) DO UPDATE\nSET test_case_id = EXCLUDED.test_case_id,\n test_script_id = EXCLUDED.test_script_id,\n is_required = EXCLUDED.is_required,\n metadata = EXCLUDED.metadata,\n updated_at = NOW()\nRETURNING id, test_suite_id, test_case_id, test_script_id, position, is_required, metadata, created_at, updated_at";
|
|
128
|
+
export interface UpsertTestSuiteItemArgs {
|
|
129
|
+
id: string;
|
|
130
|
+
testSuiteId: string;
|
|
131
|
+
testCaseId: string | null;
|
|
132
|
+
testScriptId: string | null;
|
|
133
|
+
position: number;
|
|
134
|
+
isRequired: boolean;
|
|
135
|
+
metadata: any;
|
|
136
|
+
}
|
|
137
|
+
export interface UpsertTestSuiteItemRow {
|
|
138
|
+
id: string;
|
|
139
|
+
testSuiteId: string;
|
|
140
|
+
testCaseId: string | null;
|
|
141
|
+
testScriptId: string | null;
|
|
142
|
+
position: number;
|
|
143
|
+
isRequired: boolean;
|
|
144
|
+
metadata: any;
|
|
145
|
+
createdAt: Date;
|
|
146
|
+
updatedAt: Date;
|
|
147
|
+
}
|
|
148
|
+
export declare function upsertTestSuiteItem(client: Client, args: UpsertTestSuiteItemArgs): Promise<UpsertTestSuiteItemRow | null>;
|
|
149
|
+
export declare const listTestSuiteItemsQuery = "-- name: ListTestSuiteItems :many\nSELECT si.id, si.test_suite_id, si.test_case_id, si.test_script_id, si.position, si.is_required, si.metadata, si.created_at, si.updated_at\nFROM weave_v1.test_suite_item si\n INNER JOIN weave_v1.test_suite s ON s.id = si.test_suite_id\nWHERE si.test_suite_id = $1\n AND s.workflow_id = $2\nORDER BY si.position";
|
|
150
|
+
export interface ListTestSuiteItemsArgs {
|
|
151
|
+
testSuiteId: string;
|
|
152
|
+
workflowId: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ListTestSuiteItemsRow {
|
|
155
|
+
id: string;
|
|
156
|
+
testSuiteId: string;
|
|
157
|
+
testCaseId: string | null;
|
|
158
|
+
testScriptId: string | null;
|
|
159
|
+
position: number;
|
|
160
|
+
isRequired: boolean;
|
|
161
|
+
metadata: any;
|
|
162
|
+
createdAt: Date;
|
|
163
|
+
updatedAt: Date;
|
|
164
|
+
}
|
|
165
|
+
export declare function listTestSuiteItems(client: Client, args: ListTestSuiteItemsArgs): Promise<ListTestSuiteItemsRow[]>;
|
|
166
|
+
export declare const deleteTestSuiteItemQuery = "-- name: DeleteTestSuiteItem :exec\nDELETE\nFROM weave_v1.test_suite_item si\nUSING weave_v1.test_suite s\nWHERE si.id = $1\n AND si.test_suite_id = $2\n AND s.id = si.test_suite_id\n AND s.workflow_id = $3";
|
|
167
|
+
export interface DeleteTestSuiteItemArgs {
|
|
168
|
+
id: string;
|
|
169
|
+
testSuiteId: string;
|
|
170
|
+
workflowId: string;
|
|
171
|
+
}
|
|
172
|
+
export declare function deleteTestSuiteItem(client: Client, args: DeleteTestSuiteItemArgs): Promise<void>;
|
|
173
|
+
export declare const upsertDataBindingTemplateQuery = "-- name: UpsertDataBindingTemplate :one\nINSERT INTO weave_v1.data_binding_template (\n id,\n workflow_id,\n name,\n description,\n target_scope,\n test_script_id,\n test_suite_id,\n binding_spec,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9\n)\nON CONFLICT (id) DO UPDATE\nSET name = EXCLUDED.name,\n description = EXCLUDED.description,\n target_scope = EXCLUDED.target_scope,\n test_script_id = EXCLUDED.test_script_id,\n test_suite_id = EXCLUDED.test_suite_id,\n binding_spec = EXCLUDED.binding_spec,\n metadata = EXCLUDED.metadata,\n updated_at = NOW()\nRETURNING id, workflow_id, name, description, target_scope, test_script_id, test_suite_id, binding_spec, metadata, created_at, updated_at, archived_at";
|
|
174
|
+
export interface UpsertDataBindingTemplateArgs {
|
|
175
|
+
id: string;
|
|
176
|
+
workflowId: string;
|
|
177
|
+
name: string;
|
|
178
|
+
description: string;
|
|
179
|
+
targetScope: string;
|
|
180
|
+
testScriptId: string | null;
|
|
181
|
+
testSuiteId: string | null;
|
|
182
|
+
bindingSpec: any;
|
|
183
|
+
metadata: any;
|
|
184
|
+
}
|
|
185
|
+
export interface UpsertDataBindingTemplateRow {
|
|
186
|
+
id: string;
|
|
187
|
+
workflowId: string;
|
|
188
|
+
name: string;
|
|
189
|
+
description: string;
|
|
190
|
+
targetScope: string;
|
|
191
|
+
testScriptId: string | null;
|
|
192
|
+
testSuiteId: string | null;
|
|
193
|
+
bindingSpec: any;
|
|
194
|
+
metadata: any;
|
|
195
|
+
createdAt: Date;
|
|
196
|
+
updatedAt: Date;
|
|
197
|
+
archivedAt: Date | null;
|
|
198
|
+
}
|
|
199
|
+
export declare function upsertDataBindingTemplate(client: Client, args: UpsertDataBindingTemplateArgs): Promise<UpsertDataBindingTemplateRow | null>;
|
|
200
|
+
export declare const listDataBindingTemplatesQuery = "-- name: ListDataBindingTemplates :many\nSELECT id, workflow_id, name, description, target_scope, test_script_id, test_suite_id, binding_spec, metadata, created_at, updated_at, archived_at\nFROM weave_v1.data_binding_template\nWHERE workflow_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
|
|
201
|
+
export interface ListDataBindingTemplatesArgs {
|
|
202
|
+
workflowId: string;
|
|
203
|
+
includeArchived: boolean;
|
|
204
|
+
pageOffset: string;
|
|
205
|
+
pageSize: string;
|
|
206
|
+
}
|
|
207
|
+
export interface ListDataBindingTemplatesRow {
|
|
208
|
+
id: string;
|
|
209
|
+
workflowId: string;
|
|
210
|
+
name: string;
|
|
211
|
+
description: string;
|
|
212
|
+
targetScope: string;
|
|
213
|
+
testScriptId: string | null;
|
|
214
|
+
testSuiteId: string | null;
|
|
215
|
+
bindingSpec: any;
|
|
216
|
+
metadata: any;
|
|
217
|
+
createdAt: Date;
|
|
218
|
+
updatedAt: Date;
|
|
219
|
+
archivedAt: Date | null;
|
|
220
|
+
}
|
|
221
|
+
export declare function listDataBindingTemplates(client: Client, args: ListDataBindingTemplatesArgs): Promise<ListDataBindingTemplatesRow[]>;
|
|
222
|
+
export declare const deleteDataBindingTemplateQuery = "-- name: DeleteDataBindingTemplate :exec\nDELETE\nFROM weave_v1.data_binding_template\nWHERE id = $1\n AND workflow_id = $2";
|
|
223
|
+
export interface DeleteDataBindingTemplateArgs {
|
|
224
|
+
id: string;
|
|
225
|
+
workflowId: string;
|
|
226
|
+
}
|
|
227
|
+
export declare function deleteDataBindingTemplate(client: Client, args: DeleteDataBindingTemplateArgs): Promise<void>;
|
|
228
|
+
export {};
|