weave-typescript 0.11.14 → 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.
Files changed (63) hide show
  1. package/dist/weaveapi/data/v1/data.pb.d.ts +54 -0
  2. package/dist/weaveapi/data/v1/data.pb.js +411 -0
  3. package/dist/weaveapi/data/v1/service.pb.d.ts +213 -0
  4. package/dist/weaveapi/data/v1/service.pb.js +1948 -0
  5. package/dist/weaveapi/input/v1/input.pb.d.ts +77 -0
  6. package/dist/weaveapi/input/v1/input.pb.js +632 -0
  7. package/dist/weaveapi/input/v1/service.pb.d.ts +311 -0
  8. package/dist/weaveapi/input/v1/service.pb.js +3001 -0
  9. package/dist/weaveapi/integration/v1/integration.pb.d.ts +67 -0
  10. package/dist/weaveapi/integration/v1/integration.pb.js +486 -0
  11. package/dist/weaveapi/integration/v1/service.pb.d.ts +236 -0
  12. package/dist/weaveapi/integration/v1/service.pb.js +2220 -0
  13. package/dist/weaveapi/report/v1/report.pb.d.ts +79 -0
  14. package/dist/weaveapi/report/v1/report.pb.js +638 -0
  15. package/dist/weaveapi/report/v1/service.pb.d.ts +194 -0
  16. package/dist/weaveapi/report/v1/service.pb.js +1630 -0
  17. package/dist/weaveapi/requirement/v1/requirement.pb.d.ts +70 -0
  18. package/dist/weaveapi/requirement/v1/requirement.pb.js +570 -0
  19. package/dist/weaveapi/requirement/v1/service.pb.d.ts +310 -0
  20. package/dist/weaveapi/requirement/v1/service.pb.js +2978 -0
  21. package/dist/weaveapi/run/v1/run.pb.d.ts +116 -0
  22. package/dist/weaveapi/run/v1/run.pb.js +1135 -0
  23. package/dist/weaveapi/run/v1/service.pb.d.ts +229 -0
  24. package/dist/weaveapi/run/v1/service.pb.js +2106 -0
  25. package/dist/weaveapi/script/v1/script.pb.d.ts +102 -0
  26. package/dist/weaveapi/script/v1/script.pb.js +1025 -0
  27. package/dist/weaveapi/script/v1/service.pb.d.ts +426 -0
  28. package/dist/weaveapi/script/v1/service.pb.js +4399 -0
  29. package/dist/weaveapi/storage/v1/service.pb.d.ts +4 -0
  30. package/dist/weaveapi/storage/v1/service.pb.js +50 -7
  31. package/dist/weaveapi/storage/v1/storage.pb.d.ts +2 -0
  32. package/dist/weaveapi/storage/v1/storage.pb.js +23 -0
  33. package/dist/weaveapi/storage/v1/vcs.pb.d.ts +75 -0
  34. package/dist/weaveapi/storage/v1/vcs.pb.js +864 -0
  35. package/dist/weaveapi/suite/v1/service.pb.d.ts +373 -0
  36. package/dist/weaveapi/suite/v1/service.pb.js +3629 -0
  37. package/dist/weaveapi/suite/v1/suite.pb.d.ts +92 -0
  38. package/dist/weaveapi/suite/v1/suite.pb.js +876 -0
  39. package/dist/weaveapi/testcase/v1/service.pb.d.ts +422 -0
  40. package/dist/weaveapi/testcase/v1/service.pb.js +4254 -0
  41. package/dist/weaveapi/testcase/v1/testcase.pb.d.ts +91 -0
  42. package/dist/weaveapi/testcase/v1/testcase.pb.js +794 -0
  43. package/dist/weavesql/weavedb/data_asset_sql.d.ts +141 -0
  44. package/dist/weavesql/weavedb/data_asset_sql.js +217 -0
  45. package/dist/weavesql/weavedb/input_sql.d.ts +230 -0
  46. package/dist/weavesql/weavedb/input_sql.js +384 -0
  47. package/dist/weavesql/weavedb/integration_sql.d.ts +170 -0
  48. package/dist/weavesql/weavedb/integration_sql.js +258 -0
  49. package/dist/weavesql/weavedb/report_sql.d.ts +138 -0
  50. package/dist/weavesql/weavedb/report_sql.js +232 -0
  51. package/dist/weavesql/weavedb/requirement_sql.d.ts +168 -0
  52. package/dist/weavesql/weavedb/requirement_sql.js +283 -0
  53. package/dist/weavesql/weavedb/run_sql.d.ts +247 -0
  54. package/dist/weavesql/weavedb/run_sql.js +415 -0
  55. package/dist/weavesql/weavedb/suite_sql.d.ts +228 -0
  56. package/dist/weavesql/weavedb/suite_sql.js +399 -0
  57. package/dist/weavesql/weavedb/test_case_sql.d.ts +261 -0
  58. package/dist/weavesql/weavedb/test_case_sql.js +446 -0
  59. package/dist/weavesql/weavedb/test_script_sql.d.ts +290 -0
  60. package/dist/weavesql/weavedb/test_script_sql.js +488 -0
  61. package/dist/weavesql/weavedb/traceability_sql.d.ts +59 -0
  62. package/dist/weavesql/weavedb/traceability_sql.js +155 -0
  63. package/package.json +1 -1
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteIntegrationEndpointQuery = exports.archiveIntegrationEndpointQuery = exports.setIntegrationEndpointValidationResultQuery = exports.updateIntegrationEndpointQuery = exports.listIntegrationEndpointsByWorkflowQuery = exports.getIntegrationEndpointQuery = exports.createIntegrationEndpointQuery = void 0;
4
+ exports.createIntegrationEndpoint = createIntegrationEndpoint;
5
+ exports.getIntegrationEndpoint = getIntegrationEndpoint;
6
+ exports.listIntegrationEndpointsByWorkflow = listIntegrationEndpointsByWorkflow;
7
+ exports.updateIntegrationEndpoint = updateIntegrationEndpoint;
8
+ exports.setIntegrationEndpointValidationResult = setIntegrationEndpointValidationResult;
9
+ exports.archiveIntegrationEndpoint = archiveIntegrationEndpoint;
10
+ exports.deleteIntegrationEndpoint = deleteIntegrationEndpoint;
11
+ exports.createIntegrationEndpointQuery = `-- name: CreateIntegrationEndpoint :one
12
+ INSERT INTO weave_v1.integration_endpoint (
13
+ id,
14
+ workflow_id,
15
+ name,
16
+ description,
17
+ type,
18
+ status,
19
+ target_uri,
20
+ auth_reference,
21
+ config,
22
+ metadata
23
+ )
24
+ VALUES (
25
+ $1,
26
+ $2,
27
+ $3,
28
+ $4,
29
+ $5,
30
+ $6,
31
+ $7,
32
+ $8,
33
+ $9,
34
+ $10
35
+ )
36
+ RETURNING id, workflow_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at`;
37
+ async function createIntegrationEndpoint(client, args) {
38
+ const result = await client.query({
39
+ text: exports.createIntegrationEndpointQuery,
40
+ values: [args.id, args.workflowId, args.name, args.description, args.type, args.status, args.targetUri, args.authReference, args.config, args.metadata],
41
+ rowMode: "array"
42
+ });
43
+ if (result.rows.length !== 1) {
44
+ return null;
45
+ }
46
+ const row = result.rows[0];
47
+ return {
48
+ id: row[0],
49
+ workflowId: row[1],
50
+ name: row[2],
51
+ description: row[3],
52
+ type: row[4],
53
+ status: row[5],
54
+ targetUri: row[6],
55
+ authReference: row[7],
56
+ config: row[8],
57
+ metadata: row[9],
58
+ lastCheckedAt: row[10],
59
+ lastError: row[11],
60
+ createdAt: row[12],
61
+ updatedAt: row[13],
62
+ archivedAt: row[14]
63
+ };
64
+ }
65
+ exports.getIntegrationEndpointQuery = `-- name: GetIntegrationEndpoint :one
66
+ SELECT id, workflow_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at
67
+ FROM weave_v1.integration_endpoint
68
+ WHERE id = $1
69
+ AND workflow_id = $2`;
70
+ async function getIntegrationEndpoint(client, args) {
71
+ const result = await client.query({
72
+ text: exports.getIntegrationEndpointQuery,
73
+ values: [args.id, args.workflowId],
74
+ rowMode: "array"
75
+ });
76
+ if (result.rows.length !== 1) {
77
+ return null;
78
+ }
79
+ const row = result.rows[0];
80
+ return {
81
+ id: row[0],
82
+ workflowId: row[1],
83
+ name: row[2],
84
+ description: row[3],
85
+ type: row[4],
86
+ status: row[5],
87
+ targetUri: row[6],
88
+ authReference: row[7],
89
+ config: row[8],
90
+ metadata: row[9],
91
+ lastCheckedAt: row[10],
92
+ lastError: row[11],
93
+ createdAt: row[12],
94
+ updatedAt: row[13],
95
+ archivedAt: row[14]
96
+ };
97
+ }
98
+ exports.listIntegrationEndpointsByWorkflowQuery = `-- name: ListIntegrationEndpointsByWorkflow :many
99
+ SELECT id, workflow_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at
100
+ FROM weave_v1.integration_endpoint
101
+ WHERE workflow_id = $1
102
+ AND ($2::BOOLEAN OR archived_at IS NULL)
103
+ ORDER BY updated_at DESC
104
+ LIMIT $4
105
+ OFFSET $3`;
106
+ async function listIntegrationEndpointsByWorkflow(client, args) {
107
+ const result = await client.query({
108
+ text: exports.listIntegrationEndpointsByWorkflowQuery,
109
+ values: [args.workflowId, args.includeArchived, 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
+ name: row[2],
117
+ description: row[3],
118
+ type: row[4],
119
+ status: row[5],
120
+ targetUri: row[6],
121
+ authReference: row[7],
122
+ config: row[8],
123
+ metadata: row[9],
124
+ lastCheckedAt: row[10],
125
+ lastError: row[11],
126
+ createdAt: row[12],
127
+ updatedAt: row[13],
128
+ archivedAt: row[14]
129
+ };
130
+ });
131
+ }
132
+ exports.updateIntegrationEndpointQuery = `-- name: UpdateIntegrationEndpoint :one
133
+ UPDATE weave_v1.integration_endpoint
134
+ SET name = $1,
135
+ description = $2,
136
+ type = $3,
137
+ status = $4,
138
+ target_uri = $5,
139
+ auth_reference = $6,
140
+ config = $7,
141
+ metadata = $8,
142
+ updated_at = NOW()
143
+ WHERE id = $9
144
+ AND workflow_id = $10
145
+ RETURNING id, workflow_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at`;
146
+ async function updateIntegrationEndpoint(client, args) {
147
+ const result = await client.query({
148
+ text: exports.updateIntegrationEndpointQuery,
149
+ values: [args.name, args.description, args.type, args.status, args.targetUri, args.authReference, args.config, args.metadata, args.id, args.workflowId],
150
+ rowMode: "array"
151
+ });
152
+ if (result.rows.length !== 1) {
153
+ return null;
154
+ }
155
+ const row = result.rows[0];
156
+ return {
157
+ id: row[0],
158
+ workflowId: row[1],
159
+ name: row[2],
160
+ description: row[3],
161
+ type: row[4],
162
+ status: row[5],
163
+ targetUri: row[6],
164
+ authReference: row[7],
165
+ config: row[8],
166
+ metadata: row[9],
167
+ lastCheckedAt: row[10],
168
+ lastError: row[11],
169
+ createdAt: row[12],
170
+ updatedAt: row[13],
171
+ archivedAt: row[14]
172
+ };
173
+ }
174
+ exports.setIntegrationEndpointValidationResultQuery = `-- name: SetIntegrationEndpointValidationResult :one
175
+ UPDATE weave_v1.integration_endpoint
176
+ SET status = $1,
177
+ last_checked_at = $2,
178
+ last_error = $3,
179
+ updated_at = NOW()
180
+ WHERE id = $4
181
+ AND workflow_id = $5
182
+ RETURNING id, workflow_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at`;
183
+ async function setIntegrationEndpointValidationResult(client, args) {
184
+ const result = await client.query({
185
+ text: exports.setIntegrationEndpointValidationResultQuery,
186
+ values: [args.status, args.lastCheckedAt, args.lastError, args.id, args.workflowId],
187
+ rowMode: "array"
188
+ });
189
+ if (result.rows.length !== 1) {
190
+ return null;
191
+ }
192
+ const row = result.rows[0];
193
+ return {
194
+ id: row[0],
195
+ workflowId: row[1],
196
+ name: row[2],
197
+ description: row[3],
198
+ type: row[4],
199
+ status: row[5],
200
+ targetUri: row[6],
201
+ authReference: row[7],
202
+ config: row[8],
203
+ metadata: row[9],
204
+ lastCheckedAt: row[10],
205
+ lastError: row[11],
206
+ createdAt: row[12],
207
+ updatedAt: row[13],
208
+ archivedAt: row[14]
209
+ };
210
+ }
211
+ exports.archiveIntegrationEndpointQuery = `-- name: ArchiveIntegrationEndpoint :one
212
+ UPDATE weave_v1.integration_endpoint
213
+ SET status = 'archived',
214
+ archived_at = NOW(),
215
+ updated_at = NOW()
216
+ WHERE id = $1
217
+ AND workflow_id = $2
218
+ RETURNING id, workflow_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at`;
219
+ async function archiveIntegrationEndpoint(client, args) {
220
+ const result = await client.query({
221
+ text: exports.archiveIntegrationEndpointQuery,
222
+ values: [args.id, args.workflowId],
223
+ rowMode: "array"
224
+ });
225
+ if (result.rows.length !== 1) {
226
+ return null;
227
+ }
228
+ const row = result.rows[0];
229
+ return {
230
+ id: row[0],
231
+ workflowId: row[1],
232
+ name: row[2],
233
+ description: row[3],
234
+ type: row[4],
235
+ status: row[5],
236
+ targetUri: row[6],
237
+ authReference: row[7],
238
+ config: row[8],
239
+ metadata: row[9],
240
+ lastCheckedAt: row[10],
241
+ lastError: row[11],
242
+ createdAt: row[12],
243
+ updatedAt: row[13],
244
+ archivedAt: row[14]
245
+ };
246
+ }
247
+ exports.deleteIntegrationEndpointQuery = `-- name: DeleteIntegrationEndpoint :exec
248
+ DELETE
249
+ FROM weave_v1.integration_endpoint
250
+ WHERE id = $1
251
+ AND workflow_id = $2`;
252
+ async function deleteIntegrationEndpoint(client, args) {
253
+ await client.query({
254
+ text: exports.deleteIntegrationEndpointQuery,
255
+ values: [args.id, args.workflowId],
256
+ rowMode: "array"
257
+ });
258
+ }
@@ -0,0 +1,138 @@
1
+ import { QueryArrayConfig, QueryArrayResult } from "pg";
2
+ interface Client {
3
+ query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
4
+ }
5
+ export declare const createTestReportQuery = "-- name: CreateTestReport :one\nINSERT INTO weave_v1.test_report (\n id,\n workflow_id,\n test_run_id,\n status,\n storage_connection_id,\n allure_uri,\n summary,\n metadata,\n generated_at\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, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at";
6
+ export interface CreateTestReportArgs {
7
+ id: string;
8
+ workflowId: string;
9
+ testRunId: string;
10
+ status: string;
11
+ storageConnectionId: string | null;
12
+ allureUri: string;
13
+ summary: any;
14
+ metadata: any;
15
+ generatedAt: Date | null;
16
+ }
17
+ export interface CreateTestReportRow {
18
+ id: string;
19
+ workflowId: string;
20
+ testRunId: string;
21
+ status: string;
22
+ storageConnectionId: string | null;
23
+ allureUri: string;
24
+ summary: any;
25
+ metadata: any;
26
+ generatedAt: Date | null;
27
+ createdAt: Date;
28
+ updatedAt: Date;
29
+ archivedAt: Date | null;
30
+ }
31
+ export declare function createTestReport(client: Client, args: CreateTestReportArgs): Promise<CreateTestReportRow | null>;
32
+ export declare const getTestReportQuery = "-- name: GetTestReport :one\nSELECT id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at\nFROM weave_v1.test_report\nWHERE id = $1\n AND workflow_id = $2";
33
+ export interface GetTestReportArgs {
34
+ id: string;
35
+ workflowId: string;
36
+ }
37
+ export interface GetTestReportRow {
38
+ id: string;
39
+ workflowId: string;
40
+ testRunId: string;
41
+ status: string;
42
+ storageConnectionId: string | null;
43
+ allureUri: string;
44
+ summary: any;
45
+ metadata: any;
46
+ generatedAt: Date | null;
47
+ createdAt: Date;
48
+ updatedAt: Date;
49
+ archivedAt: Date | null;
50
+ }
51
+ export declare function getTestReport(client: Client, args: GetTestReportArgs): Promise<GetTestReportRow | null>;
52
+ export declare const listTestReportsByWorkflowQuery = "-- name: ListTestReportsByWorkflow :many\nSELECT id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at\nFROM weave_v1.test_report\nWHERE workflow_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY created_at DESC\nLIMIT $4\nOFFSET $3";
53
+ export interface ListTestReportsByWorkflowArgs {
54
+ workflowId: string;
55
+ includeArchived: boolean;
56
+ pageOffset: string;
57
+ pageSize: string;
58
+ }
59
+ export interface ListTestReportsByWorkflowRow {
60
+ id: string;
61
+ workflowId: string;
62
+ testRunId: string;
63
+ status: string;
64
+ storageConnectionId: string | null;
65
+ allureUri: string;
66
+ summary: any;
67
+ metadata: any;
68
+ generatedAt: Date | null;
69
+ createdAt: Date;
70
+ updatedAt: Date;
71
+ archivedAt: Date | null;
72
+ }
73
+ export declare function listTestReportsByWorkflow(client: Client, args: ListTestReportsByWorkflowArgs): Promise<ListTestReportsByWorkflowRow[]>;
74
+ export declare const archiveTestReportQuery = "-- name: ArchiveTestReport :one\nUPDATE weave_v1.test_report\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\n AND workflow_id = $2\nRETURNING id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at";
75
+ export interface ArchiveTestReportArgs {
76
+ id: string;
77
+ workflowId: string;
78
+ }
79
+ export interface ArchiveTestReportRow {
80
+ id: string;
81
+ workflowId: string;
82
+ testRunId: string;
83
+ status: string;
84
+ storageConnectionId: string | null;
85
+ allureUri: string;
86
+ summary: any;
87
+ metadata: any;
88
+ generatedAt: Date | null;
89
+ createdAt: Date;
90
+ updatedAt: Date;
91
+ archivedAt: Date | null;
92
+ }
93
+ export declare function archiveTestReport(client: Client, args: ArchiveTestReportArgs): Promise<ArchiveTestReportRow | null>;
94
+ export declare const deleteTestReportQuery = "-- name: DeleteTestReport :exec\nDELETE\nFROM weave_v1.test_report\nWHERE id = $1\n AND workflow_id = $2";
95
+ export interface DeleteTestReportArgs {
96
+ id: string;
97
+ workflowId: string;
98
+ }
99
+ export declare function deleteTestReport(client: Client, args: DeleteTestReportArgs): Promise<void>;
100
+ export declare const createWorkflowEventQuery = "-- name: CreateWorkflowEvent :one\nINSERT INTO weave_v1.workflow_event (\n id,\n workflow_id,\n event_type,\n actor,\n entity_type,\n entity_id,\n payload\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7\n)\nRETURNING id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at";
101
+ export interface CreateWorkflowEventArgs {
102
+ id: string;
103
+ workflowId: string;
104
+ eventType: string;
105
+ actor: string;
106
+ entityType: string;
107
+ entityId: string | null;
108
+ payload: any;
109
+ }
110
+ export interface CreateWorkflowEventRow {
111
+ id: string;
112
+ workflowId: string;
113
+ eventType: string;
114
+ actor: string;
115
+ entityType: string;
116
+ entityId: string | null;
117
+ payload: any;
118
+ createdAt: Date;
119
+ }
120
+ export declare function createWorkflowEvent(client: Client, args: CreateWorkflowEventArgs): Promise<CreateWorkflowEventRow | null>;
121
+ export declare const listWorkflowEventsByWorkflowQuery = "-- name: ListWorkflowEventsByWorkflow :many\nSELECT id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at\nFROM weave_v1.workflow_event\nWHERE workflow_id = $1\nORDER BY created_at DESC\nLIMIT $3\nOFFSET $2";
122
+ export interface ListWorkflowEventsByWorkflowArgs {
123
+ workflowId: string;
124
+ pageOffset: string;
125
+ pageSize: string;
126
+ }
127
+ export interface ListWorkflowEventsByWorkflowRow {
128
+ id: string;
129
+ workflowId: string;
130
+ eventType: string;
131
+ actor: string;
132
+ entityType: string;
133
+ entityId: string | null;
134
+ payload: any;
135
+ createdAt: Date;
136
+ }
137
+ export declare function listWorkflowEventsByWorkflow(client: Client, args: ListWorkflowEventsByWorkflowArgs): Promise<ListWorkflowEventsByWorkflowRow[]>;
138
+ export {};
@@ -0,0 +1,232 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listWorkflowEventsByWorkflowQuery = exports.createWorkflowEventQuery = exports.deleteTestReportQuery = exports.archiveTestReportQuery = exports.listTestReportsByWorkflowQuery = exports.getTestReportQuery = exports.createTestReportQuery = void 0;
4
+ exports.createTestReport = createTestReport;
5
+ exports.getTestReport = getTestReport;
6
+ exports.listTestReportsByWorkflow = listTestReportsByWorkflow;
7
+ exports.archiveTestReport = archiveTestReport;
8
+ exports.deleteTestReport = deleteTestReport;
9
+ exports.createWorkflowEvent = createWorkflowEvent;
10
+ exports.listWorkflowEventsByWorkflow = listWorkflowEventsByWorkflow;
11
+ exports.createTestReportQuery = `-- name: CreateTestReport :one
12
+ INSERT INTO weave_v1.test_report (
13
+ id,
14
+ workflow_id,
15
+ test_run_id,
16
+ status,
17
+ storage_connection_id,
18
+ allure_uri,
19
+ summary,
20
+ metadata,
21
+ generated_at
22
+ )
23
+ VALUES (
24
+ $1,
25
+ $2,
26
+ $3,
27
+ $4,
28
+ $5,
29
+ $6,
30
+ $7,
31
+ $8,
32
+ $9
33
+ )
34
+ RETURNING id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at`;
35
+ async function createTestReport(client, args) {
36
+ const result = await client.query({
37
+ text: exports.createTestReportQuery,
38
+ values: [args.id, args.workflowId, args.testRunId, args.status, args.storageConnectionId, args.allureUri, args.summary, args.metadata, args.generatedAt],
39
+ rowMode: "array"
40
+ });
41
+ if (result.rows.length !== 1) {
42
+ return null;
43
+ }
44
+ const row = result.rows[0];
45
+ return {
46
+ id: row[0],
47
+ workflowId: row[1],
48
+ testRunId: row[2],
49
+ status: row[3],
50
+ storageConnectionId: row[4],
51
+ allureUri: row[5],
52
+ summary: row[6],
53
+ metadata: row[7],
54
+ generatedAt: row[8],
55
+ createdAt: row[9],
56
+ updatedAt: row[10],
57
+ archivedAt: row[11]
58
+ };
59
+ }
60
+ exports.getTestReportQuery = `-- name: GetTestReport :one
61
+ SELECT id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at
62
+ FROM weave_v1.test_report
63
+ WHERE id = $1
64
+ AND workflow_id = $2`;
65
+ async function getTestReport(client, args) {
66
+ const result = await client.query({
67
+ text: exports.getTestReportQuery,
68
+ values: [args.id, args.workflowId],
69
+ rowMode: "array"
70
+ });
71
+ if (result.rows.length !== 1) {
72
+ return null;
73
+ }
74
+ const row = result.rows[0];
75
+ return {
76
+ id: row[0],
77
+ workflowId: row[1],
78
+ testRunId: row[2],
79
+ status: row[3],
80
+ storageConnectionId: row[4],
81
+ allureUri: row[5],
82
+ summary: row[6],
83
+ metadata: row[7],
84
+ generatedAt: row[8],
85
+ createdAt: row[9],
86
+ updatedAt: row[10],
87
+ archivedAt: row[11]
88
+ };
89
+ }
90
+ exports.listTestReportsByWorkflowQuery = `-- name: ListTestReportsByWorkflow :many
91
+ SELECT id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at
92
+ FROM weave_v1.test_report
93
+ WHERE workflow_id = $1
94
+ AND ($2::BOOLEAN OR archived_at IS NULL)
95
+ ORDER BY created_at DESC
96
+ LIMIT $4
97
+ OFFSET $3`;
98
+ async function listTestReportsByWorkflow(client, args) {
99
+ const result = await client.query({
100
+ text: exports.listTestReportsByWorkflowQuery,
101
+ values: [args.workflowId, args.includeArchived, args.pageOffset, args.pageSize],
102
+ rowMode: "array"
103
+ });
104
+ return result.rows.map(row => {
105
+ return {
106
+ id: row[0],
107
+ workflowId: row[1],
108
+ testRunId: row[2],
109
+ status: row[3],
110
+ storageConnectionId: row[4],
111
+ allureUri: row[5],
112
+ summary: row[6],
113
+ metadata: row[7],
114
+ generatedAt: row[8],
115
+ createdAt: row[9],
116
+ updatedAt: row[10],
117
+ archivedAt: row[11]
118
+ };
119
+ });
120
+ }
121
+ exports.archiveTestReportQuery = `-- name: ArchiveTestReport :one
122
+ UPDATE weave_v1.test_report
123
+ SET status = 'archived',
124
+ archived_at = NOW(),
125
+ updated_at = NOW()
126
+ WHERE id = $1
127
+ AND workflow_id = $2
128
+ RETURNING id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at`;
129
+ async function archiveTestReport(client, args) {
130
+ const result = await client.query({
131
+ text: exports.archiveTestReportQuery,
132
+ values: [args.id, args.workflowId],
133
+ rowMode: "array"
134
+ });
135
+ if (result.rows.length !== 1) {
136
+ return null;
137
+ }
138
+ const row = result.rows[0];
139
+ return {
140
+ id: row[0],
141
+ workflowId: row[1],
142
+ testRunId: row[2],
143
+ status: row[3],
144
+ storageConnectionId: row[4],
145
+ allureUri: row[5],
146
+ summary: row[6],
147
+ metadata: row[7],
148
+ generatedAt: row[8],
149
+ createdAt: row[9],
150
+ updatedAt: row[10],
151
+ archivedAt: row[11]
152
+ };
153
+ }
154
+ exports.deleteTestReportQuery = `-- name: DeleteTestReport :exec
155
+ DELETE
156
+ FROM weave_v1.test_report
157
+ WHERE id = $1
158
+ AND workflow_id = $2`;
159
+ async function deleteTestReport(client, args) {
160
+ await client.query({
161
+ text: exports.deleteTestReportQuery,
162
+ values: [args.id, args.workflowId],
163
+ rowMode: "array"
164
+ });
165
+ }
166
+ exports.createWorkflowEventQuery = `-- name: CreateWorkflowEvent :one
167
+ INSERT INTO weave_v1.workflow_event (
168
+ id,
169
+ workflow_id,
170
+ event_type,
171
+ actor,
172
+ entity_type,
173
+ entity_id,
174
+ payload
175
+ )
176
+ VALUES (
177
+ $1,
178
+ $2,
179
+ $3,
180
+ $4,
181
+ $5,
182
+ $6,
183
+ $7
184
+ )
185
+ RETURNING id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at`;
186
+ async function createWorkflowEvent(client, args) {
187
+ const result = await client.query({
188
+ text: exports.createWorkflowEventQuery,
189
+ values: [args.id, args.workflowId, args.eventType, args.actor, args.entityType, args.entityId, args.payload],
190
+ rowMode: "array"
191
+ });
192
+ if (result.rows.length !== 1) {
193
+ return null;
194
+ }
195
+ const row = result.rows[0];
196
+ return {
197
+ id: row[0],
198
+ workflowId: row[1],
199
+ eventType: row[2],
200
+ actor: row[3],
201
+ entityType: row[4],
202
+ entityId: row[5],
203
+ payload: row[6],
204
+ createdAt: row[7]
205
+ };
206
+ }
207
+ exports.listWorkflowEventsByWorkflowQuery = `-- name: ListWorkflowEventsByWorkflow :many
208
+ SELECT id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at
209
+ FROM weave_v1.workflow_event
210
+ WHERE workflow_id = $1
211
+ ORDER BY created_at DESC
212
+ LIMIT $3
213
+ OFFSET $2`;
214
+ async function listWorkflowEventsByWorkflow(client, args) {
215
+ const result = await client.query({
216
+ text: exports.listWorkflowEventsByWorkflowQuery,
217
+ values: [args.workflowId, args.pageOffset, args.pageSize],
218
+ rowMode: "array"
219
+ });
220
+ return result.rows.map(row => {
221
+ return {
222
+ id: row[0],
223
+ workflowId: row[1],
224
+ eventType: row[2],
225
+ actor: row[3],
226
+ entityType: row[4],
227
+ entityId: row[5],
228
+ payload: row[6],
229
+ createdAt: row[7]
230
+ };
231
+ });
232
+ }