weave-typescript 0.11.15 → 0.11.17

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 (69) hide show
  1. package/dist/weaveapi/data/v1/data.pb.d.ts +1 -1
  2. package/dist/weaveapi/data/v1/data.pb.js +11 -11
  3. package/dist/weaveapi/data/v1/service.pb.d.ts +89 -6
  4. package/dist/weaveapi/data/v1/service.pb.js +1195 -364
  5. package/dist/weaveapi/input/v1/input.pb.d.ts +1 -1
  6. package/dist/weaveapi/input/v1/input.pb.js +11 -11
  7. package/dist/weaveapi/input/v1/service.pb.d.ts +89 -10
  8. package/dist/weaveapi/input/v1/service.pb.js +1253 -642
  9. package/dist/weaveapi/integration/v1/integration.pb.d.ts +1 -1
  10. package/dist/weaveapi/integration/v1/integration.pb.js +11 -11
  11. package/dist/weaveapi/integration/v1/service.pb.d.ts +89 -7
  12. package/dist/weaveapi/integration/v1/service.pb.js +1164 -390
  13. package/dist/weaveapi/project/v1/project.pb.d.ts +1 -0
  14. package/dist/weaveapi/project/v1/project.pb.js +17 -1
  15. package/dist/weaveapi/project/v1/service.pb.d.ts +25 -0
  16. package/dist/weaveapi/project/v1/service.pb.js +248 -5
  17. package/dist/weaveapi/report/v1/report.pb.d.ts +2 -0
  18. package/dist/weaveapi/report/v1/report.pb.js +42 -2
  19. package/dist/weaveapi/report/v1/service.pb.d.ts +6 -6
  20. package/dist/weaveapi/report/v1/service.pb.js +416 -121
  21. package/dist/weaveapi/requirement/v1/requirement.pb.d.ts +1 -1
  22. package/dist/weaveapi/requirement/v1/requirement.pb.js +11 -11
  23. package/dist/weaveapi/requirement/v1/service.pb.d.ts +90 -10
  24. package/dist/weaveapi/requirement/v1/service.pb.js +1261 -601
  25. package/dist/weaveapi/run/v1/run.pb.d.ts +1 -0
  26. package/dist/weaveapi/run/v1/run.pb.js +21 -1
  27. package/dist/weaveapi/run/v1/service.pb.d.ts +6 -6
  28. package/dist/weaveapi/run/v1/service.pb.js +448 -126
  29. package/dist/weaveapi/script/v1/script.pb.d.ts +1 -1
  30. package/dist/weaveapi/script/v1/script.pb.js +11 -11
  31. package/dist/weaveapi/script/v1/service.pb.d.ts +90 -14
  32. package/dist/weaveapi/script/v1/service.pb.js +1404 -930
  33. package/dist/weaveapi/suite/v1/service.pb.d.ts +178 -12
  34. package/dist/weaveapi/suite/v1/service.pb.js +2631 -979
  35. package/dist/weaveapi/suite/v1/suite.pb.d.ts +2 -2
  36. package/dist/weaveapi/suite/v1/suite.pb.js +22 -22
  37. package/dist/weaveapi/testcase/v1/service.pb.d.ts +90 -14
  38. package/dist/weaveapi/testcase/v1/service.pb.js +1332 -856
  39. package/dist/weaveapi/testcase/v1/testcase.pb.d.ts +1 -1
  40. package/dist/weaveapi/testcase/v1/testcase.pb.js +11 -11
  41. package/dist/weaveapi/workflow/v1/service.pb.d.ts +26 -0
  42. package/dist/weaveapi/workflow/v1/service.pb.js +293 -5
  43. package/dist/weaveapi/workflow/v1/workflow.pb.d.ts +1 -0
  44. package/dist/weaveapi/workflow/v1/workflow.pb.js +17 -1
  45. package/dist/weavesql/weavedb/data_asset_sql.d.ts +81 -16
  46. package/dist/weavesql/weavedb/data_asset_sql.js +142 -24
  47. package/dist/weavesql/weavedb/input_sql.d.ts +88 -25
  48. package/dist/weavesql/weavedb/input_sql.js +150 -34
  49. package/dist/weavesql/weavedb/integration_sql.d.ts +85 -19
  50. package/dist/weavesql/weavedb/integration_sql.js +147 -28
  51. package/dist/weavesql/weavedb/project_sql.d.ts +29 -5
  52. package/dist/weavesql/weavedb/project_sql.js +73 -37
  53. package/dist/weavesql/weavedb/report_sql.d.ts +61 -7
  54. package/dist/weavesql/weavedb/report_sql.js +157 -81
  55. package/dist/weavesql/weavedb/requirement_sql.d.ts +83 -20
  56. package/dist/weavesql/weavedb/requirement_sql.js +144 -28
  57. package/dist/weavesql/weavedb/run_sql.d.ts +44 -8
  58. package/dist/weavesql/weavedb/run_sql.js +140 -93
  59. package/dist/weavesql/weavedb/suite_sql.d.ts +156 -30
  60. package/dist/weavesql/weavedb/suite_sql.js +274 -42
  61. package/dist/weavesql/weavedb/test_case_sql.d.ts +91 -27
  62. package/dist/weavesql/weavedb/test_case_sql.js +153 -36
  63. package/dist/weavesql/weavedb/test_script_sql.d.ts +91 -27
  64. package/dist/weavesql/weavedb/test_script_sql.js +153 -36
  65. package/dist/weavesql/weavedb/traceability_sql.d.ts +62 -4
  66. package/dist/weavesql/weavedb/traceability_sql.js +245 -37
  67. package/dist/weavesql/weavedb/workflow_sql.d.ts +30 -5
  68. package/dist/weavesql/weavedb/workflow_sql.js +76 -38
  69. package/package.json +1 -1
@@ -2,10 +2,10 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
2
2
  interface Client {
3
3
  query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
4
4
  }
5
- export declare const createTestCaseQuery = "-- name: CreateTestCase :one\nINSERT INTO weave_v1.test_case (\n id,\n workflow_id,\n key,\n title,\n description,\n type,\n status,\n priority,\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, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at";
5
+ export declare const createTestCaseQuery = "-- name: CreateTestCase :one\nINSERT INTO weave_v1.test_case (\n id,\n project_id,\n key,\n title,\n description,\n type,\n status,\n priority,\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, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at";
6
6
  export interface CreateTestCaseArgs {
7
7
  id: string;
8
- workflowId: string;
8
+ projectId: string;
9
9
  key: string;
10
10
  title: string;
11
11
  description: string;
@@ -16,7 +16,7 @@ export interface CreateTestCaseArgs {
16
16
  }
17
17
  export interface CreateTestCaseRow {
18
18
  id: string;
19
- workflowId: string;
19
+ projectId: string;
20
20
  key: string;
21
21
  title: string;
22
22
  description: string;
@@ -30,14 +30,14 @@ export interface CreateTestCaseRow {
30
30
  archivedAt: Date | null;
31
31
  }
32
32
  export declare function createTestCase(client: Client, args: CreateTestCaseArgs): Promise<CreateTestCaseRow | null>;
33
- export declare const getTestCaseQuery = "-- name: GetTestCase :one\nSELECT id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at\nFROM weave_v1.test_case\nWHERE id = $1\n AND workflow_id = $2";
33
+ export declare const getTestCaseQuery = "-- name: GetTestCase :one\nSELECT id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at\nFROM weave_v1.test_case\nWHERE id = $1\n AND project_id = $2";
34
34
  export interface GetTestCaseArgs {
35
35
  id: string;
36
- workflowId: string;
36
+ projectId: string;
37
37
  }
38
38
  export interface GetTestCaseRow {
39
39
  id: string;
40
- workflowId: string;
40
+ projectId: string;
41
41
  key: string;
42
42
  title: string;
43
43
  description: string;
@@ -51,8 +51,32 @@ export interface GetTestCaseRow {
51
51
  archivedAt: Date | null;
52
52
  }
53
53
  export declare function getTestCase(client: Client, args: GetTestCaseArgs): Promise<GetTestCaseRow | null>;
54
- export declare const listTestCasesByWorkflowQuery = "-- name: ListTestCasesByWorkflow :many\nSELECT id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at\nFROM weave_v1.test_case\nWHERE workflow_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
54
+ export declare const listTestCasesByProjectQuery = "-- name: ListTestCasesByProject :many\nSELECT id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at\nFROM weave_v1.test_case\nWHERE project_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
55
+ export interface ListTestCasesByProjectArgs {
56
+ projectId: string;
57
+ includeArchived: boolean;
58
+ pageOffset: string;
59
+ pageSize: string;
60
+ }
61
+ export interface ListTestCasesByProjectRow {
62
+ id: string;
63
+ projectId: string;
64
+ key: string;
65
+ title: string;
66
+ description: string;
67
+ type: string;
68
+ status: string;
69
+ priority: string;
70
+ currentVersionId: string | null;
71
+ metadata: any;
72
+ createdAt: Date;
73
+ updatedAt: Date;
74
+ archivedAt: Date | null;
75
+ }
76
+ export declare function listTestCasesByProject(client: Client, args: ListTestCasesByProjectArgs): Promise<ListTestCasesByProjectRow[]>;
77
+ export declare const listTestCasesByWorkflowQuery = "-- name: ListTestCasesByWorkflow :many\nSELECT c.id, c.project_id, c.key, c.title, c.description, c.type, c.status, c.priority, c.current_version_id, c.metadata, c.created_at, c.updated_at, c.archived_at\nFROM weave_v1.test_case c\n INNER JOIN weave_v1.workflow_test_case b\n ON b.test_case_id = c.id\n AND b.project_id = c.project_id\nWHERE b.project_id = $1\n AND b.workflow_id = $2\n AND ($3::BOOLEAN OR c.archived_at IS NULL)\nORDER BY c.updated_at DESC\nLIMIT $5\nOFFSET $4";
55
78
  export interface ListTestCasesByWorkflowArgs {
79
+ projectId: string;
56
80
  workflowId: string;
57
81
  includeArchived: boolean;
58
82
  pageOffset: string;
@@ -60,7 +84,7 @@ export interface ListTestCasesByWorkflowArgs {
60
84
  }
61
85
  export interface ListTestCasesByWorkflowRow {
62
86
  id: string;
63
- workflowId: string;
87
+ projectId: string;
64
88
  key: string;
65
89
  title: string;
66
90
  description: string;
@@ -74,7 +98,7 @@ export interface ListTestCasesByWorkflowRow {
74
98
  archivedAt: Date | null;
75
99
  }
76
100
  export declare function listTestCasesByWorkflow(client: Client, args: ListTestCasesByWorkflowArgs): Promise<ListTestCasesByWorkflowRow[]>;
77
- export declare const updateTestCaseQuery = "-- name: UpdateTestCase :one\nUPDATE weave_v1.test_case\nSET key = $1,\n title = $2,\n description = $3,\n type = $4,\n status = $5,\n priority = $6,\n metadata = $7,\n updated_at = NOW()\nWHERE id = $8\n AND workflow_id = $9\nRETURNING id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at";
101
+ export declare const updateTestCaseQuery = "-- name: UpdateTestCase :one\nUPDATE weave_v1.test_case\nSET key = $1,\n title = $2,\n description = $3,\n type = $4,\n status = $5,\n priority = $6,\n metadata = $7,\n updated_at = NOW()\nWHERE id = $8\n AND project_id = $9\nRETURNING id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at";
78
102
  export interface UpdateTestCaseArgs {
79
103
  key: string;
80
104
  title: string;
@@ -84,11 +108,11 @@ export interface UpdateTestCaseArgs {
84
108
  priority: string;
85
109
  metadata: any;
86
110
  id: string;
87
- workflowId: string;
111
+ projectId: string;
88
112
  }
89
113
  export interface UpdateTestCaseRow {
90
114
  id: string;
91
- workflowId: string;
115
+ projectId: string;
92
116
  key: string;
93
117
  title: string;
94
118
  description: string;
@@ -102,14 +126,14 @@ export interface UpdateTestCaseRow {
102
126
  archivedAt: Date | null;
103
127
  }
104
128
  export declare function updateTestCase(client: Client, args: UpdateTestCaseArgs): Promise<UpdateTestCaseRow | null>;
105
- export declare const archiveTestCaseQuery = "-- name: ArchiveTestCase :one\nUPDATE weave_v1.test_case\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\n AND workflow_id = $2\nRETURNING id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at";
129
+ export declare const archiveTestCaseQuery = "-- name: ArchiveTestCase :one\nUPDATE weave_v1.test_case\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\n AND project_id = $2\nRETURNING id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at";
106
130
  export interface ArchiveTestCaseArgs {
107
131
  id: string;
108
- workflowId: string;
132
+ projectId: string;
109
133
  }
110
134
  export interface ArchiveTestCaseRow {
111
135
  id: string;
112
- workflowId: string;
136
+ projectId: string;
113
137
  key: string;
114
138
  title: string;
115
139
  description: string;
@@ -123,12 +147,52 @@ export interface ArchiveTestCaseRow {
123
147
  archivedAt: Date | null;
124
148
  }
125
149
  export declare function archiveTestCase(client: Client, args: ArchiveTestCaseArgs): Promise<ArchiveTestCaseRow | null>;
126
- export declare const deleteTestCaseQuery = "-- name: DeleteTestCase :exec\nDELETE\nFROM weave_v1.test_case\nWHERE id = $1\n AND workflow_id = $2";
150
+ export declare const deleteTestCaseQuery = "-- name: DeleteTestCase :exec\nDELETE\nFROM weave_v1.test_case\nWHERE id = $1\n AND project_id = $2";
127
151
  export interface DeleteTestCaseArgs {
128
152
  id: string;
129
- workflowId: string;
153
+ projectId: string;
130
154
  }
131
155
  export declare function deleteTestCase(client: Client, args: DeleteTestCaseArgs): Promise<void>;
156
+ export declare const attachTestCaseToWorkflowQuery = "-- name: AttachTestCaseToWorkflow :one\nINSERT INTO weave_v1.workflow_test_case (\n project_id,\n workflow_id,\n test_case_id,\n attached_by,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5\n)\nON CONFLICT (workflow_id, test_case_id) DO UPDATE\nSET attached_by = EXCLUDED.attached_by,\n metadata = EXCLUDED.metadata,\n attached_at = NOW()\nRETURNING project_id, workflow_id, test_case_id, attached_by, metadata, attached_at";
157
+ export interface AttachTestCaseToWorkflowArgs {
158
+ projectId: string;
159
+ workflowId: string;
160
+ testCaseId: string;
161
+ attachedBy: string;
162
+ metadata: any;
163
+ }
164
+ export interface AttachTestCaseToWorkflowRow {
165
+ projectId: string;
166
+ workflowId: string;
167
+ testCaseId: string;
168
+ attachedBy: string;
169
+ metadata: any;
170
+ attachedAt: Date;
171
+ }
172
+ export declare function attachTestCaseToWorkflow(client: Client, args: AttachTestCaseToWorkflowArgs): Promise<AttachTestCaseToWorkflowRow | null>;
173
+ export declare const detachTestCaseFromWorkflowQuery = "-- name: DetachTestCaseFromWorkflow :exec\nDELETE\nFROM weave_v1.workflow_test_case\nWHERE project_id = $1\n AND workflow_id = $2\n AND test_case_id = $3";
174
+ export interface DetachTestCaseFromWorkflowArgs {
175
+ projectId: string;
176
+ workflowId: string;
177
+ testCaseId: string;
178
+ }
179
+ export declare function detachTestCaseFromWorkflow(client: Client, args: DetachTestCaseFromWorkflowArgs): Promise<void>;
180
+ export declare const listWorkflowTestCaseBindingsQuery = "-- name: ListWorkflowTestCaseBindings :many\nSELECT project_id, workflow_id, test_case_id, attached_by, metadata, attached_at\nFROM weave_v1.workflow_test_case\nWHERE project_id = $1\n AND workflow_id = $2\nORDER BY attached_at DESC\nLIMIT $4\nOFFSET $3";
181
+ export interface ListWorkflowTestCaseBindingsArgs {
182
+ projectId: string;
183
+ workflowId: string;
184
+ pageOffset: string;
185
+ pageSize: string;
186
+ }
187
+ export interface ListWorkflowTestCaseBindingsRow {
188
+ projectId: string;
189
+ workflowId: string;
190
+ testCaseId: string;
191
+ attachedBy: string;
192
+ metadata: any;
193
+ attachedAt: Date;
194
+ }
195
+ export declare function listWorkflowTestCaseBindings(client: Client, args: ListWorkflowTestCaseBindingsArgs): Promise<ListWorkflowTestCaseBindingsRow[]>;
132
196
  export declare const createTestCaseVersionQuery = "-- name: CreateTestCaseVersion :one\nINSERT INTO weave_v1.test_case_version (\n id,\n test_case_id,\n version_number,\n objective,\n preconditions,\n steps,\n expected_results,\n metadata,\n prompt_version\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9\n)\nRETURNING id, test_case_id, version_number, objective, preconditions, steps, expected_results, metadata, prompt_version, created_at";
133
197
  export interface CreateTestCaseVersionArgs {
134
198
  id: string;
@@ -154,11 +218,11 @@ export interface CreateTestCaseVersionRow {
154
218
  createdAt: Date;
155
219
  }
156
220
  export declare function createTestCaseVersion(client: Client, args: CreateTestCaseVersionArgs): Promise<CreateTestCaseVersionRow | null>;
157
- export declare const getTestCaseVersionQuery = "-- name: GetTestCaseVersion :one\nSELECT cv.id, cv.test_case_id, cv.version_number, cv.objective, cv.preconditions, cv.steps, cv.expected_results, cv.metadata, cv.prompt_version, cv.created_at\nFROM weave_v1.test_case_version cv\n INNER JOIN weave_v1.test_case c ON c.id = cv.test_case_id\nWHERE cv.id = $1\n AND cv.test_case_id = $2\n AND c.workflow_id = $3";
221
+ export declare const getTestCaseVersionQuery = "-- name: GetTestCaseVersion :one\nSELECT cv.id, cv.test_case_id, cv.version_number, cv.objective, cv.preconditions, cv.steps, cv.expected_results, cv.metadata, cv.prompt_version, cv.created_at\nFROM weave_v1.test_case_version cv\n INNER JOIN weave_v1.test_case c ON c.id = cv.test_case_id\nWHERE cv.id = $1\n AND cv.test_case_id = $2\n AND c.project_id = $3";
158
222
  export interface GetTestCaseVersionArgs {
159
223
  id: string;
160
224
  testCaseId: string;
161
- workflowId: string;
225
+ projectId: string;
162
226
  }
163
227
  export interface GetTestCaseVersionRow {
164
228
  id: string;
@@ -173,10 +237,10 @@ export interface GetTestCaseVersionRow {
173
237
  createdAt: Date;
174
238
  }
175
239
  export declare function getTestCaseVersion(client: Client, args: GetTestCaseVersionArgs): Promise<GetTestCaseVersionRow | null>;
176
- export declare const listTestCaseVersionsQuery = "-- name: ListTestCaseVersions :many\nSELECT cv.id, cv.test_case_id, cv.version_number, cv.objective, cv.preconditions, cv.steps, cv.expected_results, cv.metadata, cv.prompt_version, cv.created_at\nFROM weave_v1.test_case_version cv\n INNER JOIN weave_v1.test_case c ON c.id = cv.test_case_id\nWHERE cv.test_case_id = $1\n AND c.workflow_id = $2\nORDER BY cv.version_number DESC\nLIMIT $4\nOFFSET $3";
240
+ export declare const listTestCaseVersionsQuery = "-- name: ListTestCaseVersions :many\nSELECT cv.id, cv.test_case_id, cv.version_number, cv.objective, cv.preconditions, cv.steps, cv.expected_results, cv.metadata, cv.prompt_version, cv.created_at\nFROM weave_v1.test_case_version cv\n INNER JOIN weave_v1.test_case c ON c.id = cv.test_case_id\nWHERE cv.test_case_id = $1\n AND c.project_id = $2\nORDER BY cv.version_number DESC\nLIMIT $4\nOFFSET $3";
177
241
  export interface ListTestCaseVersionsArgs {
178
242
  testCaseId: string;
179
- workflowId: string;
243
+ projectId: string;
180
244
  pageOffset: string;
181
245
  pageSize: string;
182
246
  }
@@ -201,15 +265,15 @@ export interface GetNextTestCaseVersionNumberRow {
201
265
  versionNumber: string;
202
266
  }
203
267
  export declare function getNextTestCaseVersionNumber(client: Client, args: GetNextTestCaseVersionNumberArgs): Promise<GetNextTestCaseVersionNumberRow | null>;
204
- export declare const setCurrentTestCaseVersionQuery = "-- name: SetCurrentTestCaseVersion :one\nUPDATE weave_v1.test_case\nSET current_version_id = $1,\n updated_at = NOW()\nWHERE id = $2\n AND workflow_id = $3\nRETURNING id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at";
268
+ export declare const setCurrentTestCaseVersionQuery = "-- name: SetCurrentTestCaseVersion :one\nUPDATE weave_v1.test_case\nSET current_version_id = $1,\n updated_at = NOW()\nWHERE id = $2\n AND project_id = $3\nRETURNING id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at";
205
269
  export interface SetCurrentTestCaseVersionArgs {
206
270
  currentVersionId: string | null;
207
271
  id: string;
208
- workflowId: string;
272
+ projectId: string;
209
273
  }
210
274
  export interface SetCurrentTestCaseVersionRow {
211
275
  id: string;
212
- workflowId: string;
276
+ projectId: string;
213
277
  key: string;
214
278
  title: string;
215
279
  description: string;
@@ -238,17 +302,17 @@ export interface UpsertTestCaseRequirementLinkRow {
238
302
  createdAt: Date;
239
303
  }
240
304
  export declare function upsertTestCaseRequirementLink(client: Client, args: UpsertTestCaseRequirementLinkArgs): Promise<UpsertTestCaseRequirementLinkRow | null>;
241
- export declare const deleteTestCaseRequirementLinkQuery = "-- name: DeleteTestCaseRequirementLink :exec\nDELETE\nFROM weave_v1.test_case_requirement cr\nUSING weave_v1.test_case c\nWHERE cr.test_case_id = $1\n AND cr.requirement_id = $2\n AND cr.test_case_id = c.id\n AND c.workflow_id = $3";
305
+ export declare const deleteTestCaseRequirementLinkQuery = "-- name: DeleteTestCaseRequirementLink :exec\nDELETE\nFROM weave_v1.test_case_requirement cr\nUSING weave_v1.test_case c\nWHERE cr.test_case_id = $1\n AND cr.requirement_id = $2\n AND cr.test_case_id = c.id\n AND c.project_id = $3";
242
306
  export interface DeleteTestCaseRequirementLinkArgs {
243
307
  testCaseId: string;
244
308
  requirementId: string;
245
- workflowId: string;
309
+ projectId: string;
246
310
  }
247
311
  export declare function deleteTestCaseRequirementLink(client: Client, args: DeleteTestCaseRequirementLinkArgs): Promise<void>;
248
- export declare const listTestCaseRequirementLinksQuery = "-- name: ListTestCaseRequirementLinks :many\nSELECT cr.test_case_id, cr.requirement_id, cr.coverage_type, cr.confidence, cr.created_at\nFROM weave_v1.test_case_requirement cr\n INNER JOIN weave_v1.test_case c ON c.id = cr.test_case_id\nWHERE cr.test_case_id = $1\n AND c.workflow_id = $2\nORDER BY cr.created_at DESC";
312
+ export declare const listTestCaseRequirementLinksQuery = "-- name: ListTestCaseRequirementLinks :many\nSELECT cr.test_case_id, cr.requirement_id, cr.coverage_type, cr.confidence, cr.created_at\nFROM weave_v1.test_case_requirement cr\n INNER JOIN weave_v1.test_case c ON c.id = cr.test_case_id\nWHERE cr.test_case_id = $1\n AND c.project_id = $2\nORDER BY cr.created_at DESC";
249
313
  export interface ListTestCaseRequirementLinksArgs {
250
314
  testCaseId: string;
251
- workflowId: string;
315
+ projectId: string;
252
316
  }
253
317
  export interface ListTestCaseRequirementLinksRow {
254
318
  testCaseId: string;
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listTestCaseRequirementLinksQuery = exports.deleteTestCaseRequirementLinkQuery = exports.upsertTestCaseRequirementLinkQuery = exports.setCurrentTestCaseVersionQuery = exports.getNextTestCaseVersionNumberQuery = exports.listTestCaseVersionsQuery = exports.getTestCaseVersionQuery = exports.createTestCaseVersionQuery = exports.deleteTestCaseQuery = exports.archiveTestCaseQuery = exports.updateTestCaseQuery = exports.listTestCasesByWorkflowQuery = exports.getTestCaseQuery = exports.createTestCaseQuery = void 0;
3
+ exports.listTestCaseRequirementLinksQuery = exports.deleteTestCaseRequirementLinkQuery = exports.upsertTestCaseRequirementLinkQuery = exports.setCurrentTestCaseVersionQuery = exports.getNextTestCaseVersionNumberQuery = exports.listTestCaseVersionsQuery = exports.getTestCaseVersionQuery = exports.createTestCaseVersionQuery = exports.listWorkflowTestCaseBindingsQuery = exports.detachTestCaseFromWorkflowQuery = exports.attachTestCaseToWorkflowQuery = exports.deleteTestCaseQuery = exports.archiveTestCaseQuery = exports.updateTestCaseQuery = exports.listTestCasesByWorkflowQuery = exports.listTestCasesByProjectQuery = exports.getTestCaseQuery = exports.createTestCaseQuery = void 0;
4
4
  exports.createTestCase = createTestCase;
5
5
  exports.getTestCase = getTestCase;
6
+ exports.listTestCasesByProject = listTestCasesByProject;
6
7
  exports.listTestCasesByWorkflow = listTestCasesByWorkflow;
7
8
  exports.updateTestCase = updateTestCase;
8
9
  exports.archiveTestCase = archiveTestCase;
9
10
  exports.deleteTestCase = deleteTestCase;
11
+ exports.attachTestCaseToWorkflow = attachTestCaseToWorkflow;
12
+ exports.detachTestCaseFromWorkflow = detachTestCaseFromWorkflow;
13
+ exports.listWorkflowTestCaseBindings = listWorkflowTestCaseBindings;
10
14
  exports.createTestCaseVersion = createTestCaseVersion;
11
15
  exports.getTestCaseVersion = getTestCaseVersion;
12
16
  exports.listTestCaseVersions = listTestCaseVersions;
@@ -18,7 +22,7 @@ exports.listTestCaseRequirementLinks = listTestCaseRequirementLinks;
18
22
  exports.createTestCaseQuery = `-- name: CreateTestCase :one
19
23
  INSERT INTO weave_v1.test_case (
20
24
  id,
21
- workflow_id,
25
+ project_id,
22
26
  key,
23
27
  title,
24
28
  description,
@@ -38,11 +42,11 @@ VALUES (
38
42
  $8,
39
43
  $9
40
44
  )
41
- RETURNING id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at`;
45
+ RETURNING id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at`;
42
46
  async function createTestCase(client, args) {
43
47
  const result = await client.query({
44
48
  text: exports.createTestCaseQuery,
45
- values: [args.id, args.workflowId, args.key, args.title, args.description, args.type, args.status, args.priority, args.metadata],
49
+ values: [args.id, args.projectId, args.key, args.title, args.description, args.type, args.status, args.priority, args.metadata],
46
50
  rowMode: "array"
47
51
  });
48
52
  if (result.rows.length !== 1) {
@@ -51,7 +55,7 @@ async function createTestCase(client, args) {
51
55
  const row = result.rows[0];
52
56
  return {
53
57
  id: row[0],
54
- workflowId: row[1],
58
+ projectId: row[1],
55
59
  key: row[2],
56
60
  title: row[3],
57
61
  description: row[4],
@@ -66,14 +70,14 @@ async function createTestCase(client, args) {
66
70
  };
67
71
  }
68
72
  exports.getTestCaseQuery = `-- name: GetTestCase :one
69
- SELECT id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at
73
+ SELECT id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at
70
74
  FROM weave_v1.test_case
71
75
  WHERE id = $1
72
- AND workflow_id = $2`;
76
+ AND project_id = $2`;
73
77
  async function getTestCase(client, args) {
74
78
  const result = await client.query({
75
79
  text: exports.getTestCaseQuery,
76
- values: [args.id, args.workflowId],
80
+ values: [args.id, args.projectId],
77
81
  rowMode: "array"
78
82
  });
79
83
  if (result.rows.length !== 1) {
@@ -82,7 +86,7 @@ async function getTestCase(client, args) {
82
86
  const row = result.rows[0];
83
87
  return {
84
88
  id: row[0],
85
- workflowId: row[1],
89
+ projectId: row[1],
86
90
  key: row[2],
87
91
  title: row[3],
88
92
  description: row[4],
@@ -96,24 +100,60 @@ async function getTestCase(client, args) {
96
100
  archivedAt: row[12]
97
101
  };
98
102
  }
99
- exports.listTestCasesByWorkflowQuery = `-- name: ListTestCasesByWorkflow :many
100
- SELECT id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at
103
+ exports.listTestCasesByProjectQuery = `-- name: ListTestCasesByProject :many
104
+ SELECT id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at
101
105
  FROM weave_v1.test_case
102
- WHERE workflow_id = $1
106
+ WHERE project_id = $1
103
107
  AND ($2::BOOLEAN OR archived_at IS NULL)
104
108
  ORDER BY updated_at DESC
105
109
  LIMIT $4
106
110
  OFFSET $3`;
111
+ async function listTestCasesByProject(client, args) {
112
+ const result = await client.query({
113
+ text: exports.listTestCasesByProjectQuery,
114
+ values: [args.projectId, args.includeArchived, args.pageOffset, args.pageSize],
115
+ rowMode: "array"
116
+ });
117
+ return result.rows.map(row => {
118
+ return {
119
+ id: row[0],
120
+ projectId: row[1],
121
+ key: row[2],
122
+ title: row[3],
123
+ description: row[4],
124
+ type: row[5],
125
+ status: row[6],
126
+ priority: row[7],
127
+ currentVersionId: row[8],
128
+ metadata: row[9],
129
+ createdAt: row[10],
130
+ updatedAt: row[11],
131
+ archivedAt: row[12]
132
+ };
133
+ });
134
+ }
135
+ exports.listTestCasesByWorkflowQuery = `-- name: ListTestCasesByWorkflow :many
136
+ SELECT c.id, c.project_id, c.key, c.title, c.description, c.type, c.status, c.priority, c.current_version_id, c.metadata, c.created_at, c.updated_at, c.archived_at
137
+ FROM weave_v1.test_case c
138
+ INNER JOIN weave_v1.workflow_test_case b
139
+ ON b.test_case_id = c.id
140
+ AND b.project_id = c.project_id
141
+ WHERE b.project_id = $1
142
+ AND b.workflow_id = $2
143
+ AND ($3::BOOLEAN OR c.archived_at IS NULL)
144
+ ORDER BY c.updated_at DESC
145
+ LIMIT $5
146
+ OFFSET $4`;
107
147
  async function listTestCasesByWorkflow(client, args) {
108
148
  const result = await client.query({
109
149
  text: exports.listTestCasesByWorkflowQuery,
110
- values: [args.workflowId, args.includeArchived, args.pageOffset, args.pageSize],
150
+ values: [args.projectId, args.workflowId, args.includeArchived, args.pageOffset, args.pageSize],
111
151
  rowMode: "array"
112
152
  });
113
153
  return result.rows.map(row => {
114
154
  return {
115
155
  id: row[0],
116
- workflowId: row[1],
156
+ projectId: row[1],
117
157
  key: row[2],
118
158
  title: row[3],
119
159
  description: row[4],
@@ -139,12 +179,12 @@ SET key = $1,
139
179
  metadata = $7,
140
180
  updated_at = NOW()
141
181
  WHERE id = $8
142
- AND workflow_id = $9
143
- RETURNING id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at`;
182
+ AND project_id = $9
183
+ RETURNING id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at`;
144
184
  async function updateTestCase(client, args) {
145
185
  const result = await client.query({
146
186
  text: exports.updateTestCaseQuery,
147
- values: [args.key, args.title, args.description, args.type, args.status, args.priority, args.metadata, args.id, args.workflowId],
187
+ values: [args.key, args.title, args.description, args.type, args.status, args.priority, args.metadata, args.id, args.projectId],
148
188
  rowMode: "array"
149
189
  });
150
190
  if (result.rows.length !== 1) {
@@ -153,7 +193,7 @@ async function updateTestCase(client, args) {
153
193
  const row = result.rows[0];
154
194
  return {
155
195
  id: row[0],
156
- workflowId: row[1],
196
+ projectId: row[1],
157
197
  key: row[2],
158
198
  title: row[3],
159
199
  description: row[4],
@@ -173,12 +213,12 @@ SET status = 'archived',
173
213
  archived_at = NOW(),
174
214
  updated_at = NOW()
175
215
  WHERE id = $1
176
- AND workflow_id = $2
177
- RETURNING id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at`;
216
+ AND project_id = $2
217
+ RETURNING id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at`;
178
218
  async function archiveTestCase(client, args) {
179
219
  const result = await client.query({
180
220
  text: exports.archiveTestCaseQuery,
181
- values: [args.id, args.workflowId],
221
+ values: [args.id, args.projectId],
182
222
  rowMode: "array"
183
223
  });
184
224
  if (result.rows.length !== 1) {
@@ -187,7 +227,7 @@ async function archiveTestCase(client, args) {
187
227
  const row = result.rows[0];
188
228
  return {
189
229
  id: row[0],
190
- workflowId: row[1],
230
+ projectId: row[1],
191
231
  key: row[2],
192
232
  title: row[3],
193
233
  description: row[4],
@@ -205,14 +245,91 @@ exports.deleteTestCaseQuery = `-- name: DeleteTestCase :exec
205
245
  DELETE
206
246
  FROM weave_v1.test_case
207
247
  WHERE id = $1
208
- AND workflow_id = $2`;
248
+ AND project_id = $2`;
209
249
  async function deleteTestCase(client, args) {
210
250
  await client.query({
211
251
  text: exports.deleteTestCaseQuery,
212
- values: [args.id, args.workflowId],
252
+ values: [args.id, args.projectId],
213
253
  rowMode: "array"
214
254
  });
215
255
  }
256
+ exports.attachTestCaseToWorkflowQuery = `-- name: AttachTestCaseToWorkflow :one
257
+ INSERT INTO weave_v1.workflow_test_case (
258
+ project_id,
259
+ workflow_id,
260
+ test_case_id,
261
+ attached_by,
262
+ metadata
263
+ )
264
+ VALUES (
265
+ $1,
266
+ $2,
267
+ $3,
268
+ $4,
269
+ $5
270
+ )
271
+ ON CONFLICT (workflow_id, test_case_id) DO UPDATE
272
+ SET attached_by = EXCLUDED.attached_by,
273
+ metadata = EXCLUDED.metadata,
274
+ attached_at = NOW()
275
+ RETURNING project_id, workflow_id, test_case_id, attached_by, metadata, attached_at`;
276
+ async function attachTestCaseToWorkflow(client, args) {
277
+ const result = await client.query({
278
+ text: exports.attachTestCaseToWorkflowQuery,
279
+ values: [args.projectId, args.workflowId, args.testCaseId, args.attachedBy, args.metadata],
280
+ rowMode: "array"
281
+ });
282
+ if (result.rows.length !== 1) {
283
+ return null;
284
+ }
285
+ const row = result.rows[0];
286
+ return {
287
+ projectId: row[0],
288
+ workflowId: row[1],
289
+ testCaseId: row[2],
290
+ attachedBy: row[3],
291
+ metadata: row[4],
292
+ attachedAt: row[5]
293
+ };
294
+ }
295
+ exports.detachTestCaseFromWorkflowQuery = `-- name: DetachTestCaseFromWorkflow :exec
296
+ DELETE
297
+ FROM weave_v1.workflow_test_case
298
+ WHERE project_id = $1
299
+ AND workflow_id = $2
300
+ AND test_case_id = $3`;
301
+ async function detachTestCaseFromWorkflow(client, args) {
302
+ await client.query({
303
+ text: exports.detachTestCaseFromWorkflowQuery,
304
+ values: [args.projectId, args.workflowId, args.testCaseId],
305
+ rowMode: "array"
306
+ });
307
+ }
308
+ exports.listWorkflowTestCaseBindingsQuery = `-- name: ListWorkflowTestCaseBindings :many
309
+ SELECT project_id, workflow_id, test_case_id, attached_by, metadata, attached_at
310
+ FROM weave_v1.workflow_test_case
311
+ WHERE project_id = $1
312
+ AND workflow_id = $2
313
+ ORDER BY attached_at DESC
314
+ LIMIT $4
315
+ OFFSET $3`;
316
+ async function listWorkflowTestCaseBindings(client, args) {
317
+ const result = await client.query({
318
+ text: exports.listWorkflowTestCaseBindingsQuery,
319
+ values: [args.projectId, args.workflowId, args.pageOffset, args.pageSize],
320
+ rowMode: "array"
321
+ });
322
+ return result.rows.map(row => {
323
+ return {
324
+ projectId: row[0],
325
+ workflowId: row[1],
326
+ testCaseId: row[2],
327
+ attachedBy: row[3],
328
+ metadata: row[4],
329
+ attachedAt: row[5]
330
+ };
331
+ });
332
+ }
216
333
  exports.createTestCaseVersionQuery = `-- name: CreateTestCaseVersion :one
217
334
  INSERT INTO weave_v1.test_case_version (
218
335
  id,
@@ -266,11 +383,11 @@ FROM weave_v1.test_case_version cv
266
383
  INNER JOIN weave_v1.test_case c ON c.id = cv.test_case_id
267
384
  WHERE cv.id = $1
268
385
  AND cv.test_case_id = $2
269
- AND c.workflow_id = $3`;
386
+ AND c.project_id = $3`;
270
387
  async function getTestCaseVersion(client, args) {
271
388
  const result = await client.query({
272
389
  text: exports.getTestCaseVersionQuery,
273
- values: [args.id, args.testCaseId, args.workflowId],
390
+ values: [args.id, args.testCaseId, args.projectId],
274
391
  rowMode: "array"
275
392
  });
276
393
  if (result.rows.length !== 1) {
@@ -295,14 +412,14 @@ SELECT cv.id, cv.test_case_id, cv.version_number, cv.objective, cv.preconditions
295
412
  FROM weave_v1.test_case_version cv
296
413
  INNER JOIN weave_v1.test_case c ON c.id = cv.test_case_id
297
414
  WHERE cv.test_case_id = $1
298
- AND c.workflow_id = $2
415
+ AND c.project_id = $2
299
416
  ORDER BY cv.version_number DESC
300
417
  LIMIT $4
301
418
  OFFSET $3`;
302
419
  async function listTestCaseVersions(client, args) {
303
420
  const result = await client.query({
304
421
  text: exports.listTestCaseVersionsQuery,
305
- values: [args.testCaseId, args.workflowId, args.pageOffset, args.pageSize],
422
+ values: [args.testCaseId, args.projectId, args.pageOffset, args.pageSize],
306
423
  rowMode: "array"
307
424
  });
308
425
  return result.rows.map(row => {
@@ -343,12 +460,12 @@ UPDATE weave_v1.test_case
343
460
  SET current_version_id = $1,
344
461
  updated_at = NOW()
345
462
  WHERE id = $2
346
- AND workflow_id = $3
347
- RETURNING id, workflow_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at`;
463
+ AND project_id = $3
464
+ RETURNING id, project_id, key, title, description, type, status, priority, current_version_id, metadata, created_at, updated_at, archived_at`;
348
465
  async function setCurrentTestCaseVersion(client, args) {
349
466
  const result = await client.query({
350
467
  text: exports.setCurrentTestCaseVersionQuery,
351
- values: [args.currentVersionId, args.id, args.workflowId],
468
+ values: [args.currentVersionId, args.id, args.projectId],
352
469
  rowMode: "array"
353
470
  });
354
471
  if (result.rows.length !== 1) {
@@ -357,7 +474,7 @@ async function setCurrentTestCaseVersion(client, args) {
357
474
  const row = result.rows[0];
358
475
  return {
359
476
  id: row[0],
360
- workflowId: row[1],
477
+ projectId: row[1],
361
478
  key: row[2],
362
479
  title: row[3],
363
480
  description: row[4],
@@ -413,11 +530,11 @@ USING weave_v1.test_case c
413
530
  WHERE cr.test_case_id = $1
414
531
  AND cr.requirement_id = $2
415
532
  AND cr.test_case_id = c.id
416
- AND c.workflow_id = $3`;
533
+ AND c.project_id = $3`;
417
534
  async function deleteTestCaseRequirementLink(client, args) {
418
535
  await client.query({
419
536
  text: exports.deleteTestCaseRequirementLinkQuery,
420
- values: [args.testCaseId, args.requirementId, args.workflowId],
537
+ values: [args.testCaseId, args.requirementId, args.projectId],
421
538
  rowMode: "array"
422
539
  });
423
540
  }
@@ -426,12 +543,12 @@ SELECT cr.test_case_id, cr.requirement_id, cr.coverage_type, cr.confidence, cr.c
426
543
  FROM weave_v1.test_case_requirement cr
427
544
  INNER JOIN weave_v1.test_case c ON c.id = cr.test_case_id
428
545
  WHERE cr.test_case_id = $1
429
- AND c.workflow_id = $2
546
+ AND c.project_id = $2
430
547
  ORDER BY cr.created_at DESC`;
431
548
  async function listTestCaseRequirementLinks(client, args) {
432
549
  const result = await client.query({
433
550
  text: exports.listTestCaseRequirementLinksQuery,
434
- values: [args.testCaseId, args.workflowId],
551
+ values: [args.testCaseId, args.projectId],
435
552
  rowMode: "array"
436
553
  });
437
554
  return result.rows.map(row => {