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
@@ -1,16 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listWorkflowEventsByWorkflowQuery = exports.createWorkflowEventQuery = exports.deleteTestReportQuery = exports.archiveTestReportQuery = exports.listTestReportsByWorkflowQuery = exports.getTestReportQuery = exports.createTestReportQuery = void 0;
3
+ exports.listWorkflowEventsByWorkflowQuery = exports.listWorkflowEventsByProjectQuery = exports.createWorkflowEventQuery = exports.deleteTestReportQuery = exports.archiveTestReportQuery = exports.listTestReportsByWorkflowQuery = exports.listTestReportsByProjectQuery = exports.getTestReportQuery = exports.createTestReportQuery = void 0;
4
4
  exports.createTestReport = createTestReport;
5
5
  exports.getTestReport = getTestReport;
6
+ exports.listTestReportsByProject = listTestReportsByProject;
6
7
  exports.listTestReportsByWorkflow = listTestReportsByWorkflow;
7
8
  exports.archiveTestReport = archiveTestReport;
8
9
  exports.deleteTestReport = deleteTestReport;
9
10
  exports.createWorkflowEvent = createWorkflowEvent;
11
+ exports.listWorkflowEventsByProject = listWorkflowEventsByProject;
10
12
  exports.listWorkflowEventsByWorkflow = listWorkflowEventsByWorkflow;
11
13
  exports.createTestReportQuery = `-- name: CreateTestReport :one
12
14
  INSERT INTO weave_v1.test_report (
13
15
  id,
16
+ project_id,
14
17
  workflow_id,
15
18
  test_run_id,
16
19
  status,
@@ -29,13 +32,14 @@ VALUES (
29
32
  $6,
30
33
  $7,
31
34
  $8,
32
- $9
35
+ $9,
36
+ $10
33
37
  )
34
- RETURNING id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at`;
38
+ RETURNING id, project_id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at`;
35
39
  async function createTestReport(client, args) {
36
40
  const result = await client.query({
37
41
  text: exports.createTestReportQuery,
38
- values: [args.id, args.workflowId, args.testRunId, args.status, args.storageConnectionId, args.allureUri, args.summary, args.metadata, args.generatedAt],
42
+ values: [args.id, args.projectId, args.workflowId, args.testRunId, args.status, args.storageConnectionId, args.allureUri, args.summary, args.metadata, args.generatedAt],
39
43
  rowMode: "array"
40
44
  });
41
45
  if (result.rows.length !== 1) {
@@ -44,28 +48,30 @@ async function createTestReport(client, args) {
44
48
  const row = result.rows[0];
45
49
  return {
46
50
  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]
51
+ projectId: row[1],
52
+ workflowId: row[2],
53
+ testRunId: row[3],
54
+ status: row[4],
55
+ storageConnectionId: row[5],
56
+ allureUri: row[6],
57
+ summary: row[7],
58
+ metadata: row[8],
59
+ generatedAt: row[9],
60
+ createdAt: row[10],
61
+ updatedAt: row[11],
62
+ archivedAt: row[12]
58
63
  };
59
64
  }
60
65
  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
66
+ SELECT id, project_id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at
62
67
  FROM weave_v1.test_report
63
68
  WHERE id = $1
64
- AND workflow_id = $2`;
69
+ AND project_id = $2
70
+ AND workflow_id = $3`;
65
71
  async function getTestReport(client, args) {
66
72
  const result = await client.query({
67
73
  text: exports.getTestReportQuery,
68
- values: [args.id, args.workflowId],
74
+ values: [args.id, args.projectId, args.workflowId],
69
75
  rowMode: "array"
70
76
  });
71
77
  if (result.rows.length !== 1) {
@@ -74,47 +80,82 @@ async function getTestReport(client, args) {
74
80
  const row = result.rows[0];
75
81
  return {
76
82
  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]
83
+ projectId: row[1],
84
+ workflowId: row[2],
85
+ testRunId: row[3],
86
+ status: row[4],
87
+ storageConnectionId: row[5],
88
+ allureUri: row[6],
89
+ summary: row[7],
90
+ metadata: row[8],
91
+ generatedAt: row[9],
92
+ createdAt: row[10],
93
+ updatedAt: row[11],
94
+ archivedAt: row[12]
88
95
  };
89
96
  }
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
97
+ exports.listTestReportsByProjectQuery = `-- name: ListTestReportsByProject :many
98
+ SELECT id, project_id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at
92
99
  FROM weave_v1.test_report
93
- WHERE workflow_id = $1
100
+ WHERE project_id = $1
94
101
  AND ($2::BOOLEAN OR archived_at IS NULL)
95
102
  ORDER BY created_at DESC
96
103
  LIMIT $4
97
104
  OFFSET $3`;
105
+ async function listTestReportsByProject(client, args) {
106
+ const result = await client.query({
107
+ text: exports.listTestReportsByProjectQuery,
108
+ values: [args.projectId, args.includeArchived, args.pageOffset, args.pageSize],
109
+ rowMode: "array"
110
+ });
111
+ return result.rows.map(row => {
112
+ return {
113
+ id: row[0],
114
+ projectId: row[1],
115
+ workflowId: row[2],
116
+ testRunId: row[3],
117
+ status: row[4],
118
+ storageConnectionId: row[5],
119
+ allureUri: row[6],
120
+ summary: row[7],
121
+ metadata: row[8],
122
+ generatedAt: row[9],
123
+ createdAt: row[10],
124
+ updatedAt: row[11],
125
+ archivedAt: row[12]
126
+ };
127
+ });
128
+ }
129
+ exports.listTestReportsByWorkflowQuery = `-- name: ListTestReportsByWorkflow :many
130
+ SELECT id, project_id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at
131
+ FROM weave_v1.test_report
132
+ WHERE project_id = $1
133
+ AND workflow_id = $2
134
+ AND ($3::BOOLEAN OR archived_at IS NULL)
135
+ ORDER BY created_at DESC
136
+ LIMIT $5
137
+ OFFSET $4`;
98
138
  async function listTestReportsByWorkflow(client, args) {
99
139
  const result = await client.query({
100
140
  text: exports.listTestReportsByWorkflowQuery,
101
- values: [args.workflowId, args.includeArchived, args.pageOffset, args.pageSize],
141
+ values: [args.projectId, args.workflowId, args.includeArchived, args.pageOffset, args.pageSize],
102
142
  rowMode: "array"
103
143
  });
104
144
  return result.rows.map(row => {
105
145
  return {
106
146
  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]
147
+ projectId: row[1],
148
+ workflowId: row[2],
149
+ testRunId: row[3],
150
+ status: row[4],
151
+ storageConnectionId: row[5],
152
+ allureUri: row[6],
153
+ summary: row[7],
154
+ metadata: row[8],
155
+ generatedAt: row[9],
156
+ createdAt: row[10],
157
+ updatedAt: row[11],
158
+ archivedAt: row[12]
118
159
  };
119
160
  });
120
161
  }
@@ -124,12 +165,13 @@ SET status = 'archived',
124
165
  archived_at = NOW(),
125
166
  updated_at = NOW()
126
167
  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`;
168
+ AND project_id = $2
169
+ AND workflow_id = $3
170
+ RETURNING id, project_id, workflow_id, test_run_id, status, storage_connection_id, allure_uri, summary, metadata, generated_at, created_at, updated_at, archived_at`;
129
171
  async function archiveTestReport(client, args) {
130
172
  const result = await client.query({
131
173
  text: exports.archiveTestReportQuery,
132
- values: [args.id, args.workflowId],
174
+ values: [args.id, args.projectId, args.workflowId],
133
175
  rowMode: "array"
134
176
  });
135
177
  if (result.rows.length !== 1) {
@@ -138,34 +180,37 @@ async function archiveTestReport(client, args) {
138
180
  const row = result.rows[0];
139
181
  return {
140
182
  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]
183
+ projectId: row[1],
184
+ workflowId: row[2],
185
+ testRunId: row[3],
186
+ status: row[4],
187
+ storageConnectionId: row[5],
188
+ allureUri: row[6],
189
+ summary: row[7],
190
+ metadata: row[8],
191
+ generatedAt: row[9],
192
+ createdAt: row[10],
193
+ updatedAt: row[11],
194
+ archivedAt: row[12]
152
195
  };
153
196
  }
154
197
  exports.deleteTestReportQuery = `-- name: DeleteTestReport :exec
155
198
  DELETE
156
199
  FROM weave_v1.test_report
157
200
  WHERE id = $1
158
- AND workflow_id = $2`;
201
+ AND project_id = $2
202
+ AND workflow_id = $3`;
159
203
  async function deleteTestReport(client, args) {
160
204
  await client.query({
161
205
  text: exports.deleteTestReportQuery,
162
- values: [args.id, args.workflowId],
206
+ values: [args.id, args.projectId, args.workflowId],
163
207
  rowMode: "array"
164
208
  });
165
209
  }
166
210
  exports.createWorkflowEventQuery = `-- name: CreateWorkflowEvent :one
167
211
  INSERT INTO weave_v1.workflow_event (
168
212
  id,
213
+ project_id,
169
214
  workflow_id,
170
215
  event_type,
171
216
  actor,
@@ -180,13 +225,14 @@ VALUES (
180
225
  $4,
181
226
  $5,
182
227
  $6,
183
- $7
228
+ $7,
229
+ $8
184
230
  )
185
- RETURNING id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at`;
231
+ RETURNING id, project_id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at`;
186
232
  async function createWorkflowEvent(client, args) {
187
233
  const result = await client.query({
188
234
  text: exports.createWorkflowEventQuery,
189
- values: [args.id, args.workflowId, args.eventType, args.actor, args.entityType, args.entityId, args.payload],
235
+ values: [args.id, args.projectId, args.workflowId, args.eventType, args.actor, args.entityType, args.entityId, args.payload],
190
236
  rowMode: "array"
191
237
  });
192
238
  if (result.rows.length !== 1) {
@@ -195,38 +241,68 @@ async function createWorkflowEvent(client, args) {
195
241
  const row = result.rows[0];
196
242
  return {
197
243
  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]
244
+ projectId: row[1],
245
+ workflowId: row[2],
246
+ eventType: row[3],
247
+ actor: row[4],
248
+ entityType: row[5],
249
+ entityId: row[6],
250
+ payload: row[7],
251
+ createdAt: row[8]
205
252
  };
206
253
  }
207
- exports.listWorkflowEventsByWorkflowQuery = `-- name: ListWorkflowEventsByWorkflow :many
208
- SELECT id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at
254
+ exports.listWorkflowEventsByProjectQuery = `-- name: ListWorkflowEventsByProject :many
255
+ SELECT id, project_id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at
209
256
  FROM weave_v1.workflow_event
210
- WHERE workflow_id = $1
257
+ WHERE project_id = $1
211
258
  ORDER BY created_at DESC
212
259
  LIMIT $3
213
260
  OFFSET $2`;
261
+ async function listWorkflowEventsByProject(client, args) {
262
+ const result = await client.query({
263
+ text: exports.listWorkflowEventsByProjectQuery,
264
+ values: [args.projectId, args.pageOffset, args.pageSize],
265
+ rowMode: "array"
266
+ });
267
+ return result.rows.map(row => {
268
+ return {
269
+ id: row[0],
270
+ projectId: row[1],
271
+ workflowId: row[2],
272
+ eventType: row[3],
273
+ actor: row[4],
274
+ entityType: row[5],
275
+ entityId: row[6],
276
+ payload: row[7],
277
+ createdAt: row[8]
278
+ };
279
+ });
280
+ }
281
+ exports.listWorkflowEventsByWorkflowQuery = `-- name: ListWorkflowEventsByWorkflow :many
282
+ SELECT id, project_id, workflow_id, event_type, actor, entity_type, entity_id, payload, created_at
283
+ FROM weave_v1.workflow_event
284
+ WHERE project_id = $1
285
+ AND workflow_id = $2
286
+ ORDER BY created_at DESC
287
+ LIMIT $4
288
+ OFFSET $3`;
214
289
  async function listWorkflowEventsByWorkflow(client, args) {
215
290
  const result = await client.query({
216
291
  text: exports.listWorkflowEventsByWorkflowQuery,
217
- values: [args.workflowId, args.pageOffset, args.pageSize],
292
+ values: [args.projectId, args.workflowId, args.pageOffset, args.pageSize],
218
293
  rowMode: "array"
219
294
  });
220
295
  return result.rows.map(row => {
221
296
  return {
222
297
  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]
298
+ projectId: row[1],
299
+ workflowId: row[2],
300
+ eventType: row[3],
301
+ actor: row[4],
302
+ entityType: row[5],
303
+ entityId: row[6],
304
+ payload: row[7],
305
+ createdAt: row[8]
230
306
  };
231
307
  });
232
308
  }
@@ -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 createRequirementQuery = "-- name: CreateRequirement :one\nINSERT INTO weave_v1.requirement (\n id,\n workflow_id,\n key,\n title,\n description,\n status,\n priority,\n confidence,\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, status, priority, confidence, metadata, created_at, updated_at, archived_at";
5
+ export declare const createRequirementQuery = "-- name: CreateRequirement :one\nINSERT INTO weave_v1.requirement (\n id,\n project_id,\n key,\n title,\n description,\n status,\n priority,\n confidence,\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, status, priority, confidence, metadata, created_at, updated_at, archived_at";
6
6
  export interface CreateRequirementArgs {
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 CreateRequirementArgs {
16
16
  }
17
17
  export interface CreateRequirementRow {
18
18
  id: string;
19
- workflowId: string;
19
+ projectId: string;
20
20
  key: string;
21
21
  title: string;
22
22
  description: string;
@@ -29,14 +29,14 @@ export interface CreateRequirementRow {
29
29
  archivedAt: Date | null;
30
30
  }
31
31
  export declare function createRequirement(client: Client, args: CreateRequirementArgs): Promise<CreateRequirementRow | null>;
32
- export declare const getRequirementQuery = "-- name: GetRequirement :one\nSELECT id, workflow_id, key, title, description, status, priority, confidence, metadata, created_at, updated_at, archived_at\nFROM weave_v1.requirement\nWHERE id = $1\n AND workflow_id = $2";
32
+ export declare const getRequirementQuery = "-- name: GetRequirement :one\nSELECT id, project_id, key, title, description, status, priority, confidence, metadata, created_at, updated_at, archived_at\nFROM weave_v1.requirement\nWHERE id = $1\n AND project_id = $2";
33
33
  export interface GetRequirementArgs {
34
34
  id: string;
35
- workflowId: string;
35
+ projectId: string;
36
36
  }
37
37
  export interface GetRequirementRow {
38
38
  id: string;
39
- workflowId: string;
39
+ projectId: string;
40
40
  key: string;
41
41
  title: string;
42
42
  description: string;
@@ -49,8 +49,31 @@ export interface GetRequirementRow {
49
49
  archivedAt: Date | null;
50
50
  }
51
51
  export declare function getRequirement(client: Client, args: GetRequirementArgs): Promise<GetRequirementRow | null>;
52
- export declare const listRequirementsByWorkflowQuery = "-- name: ListRequirementsByWorkflow :many\nSELECT id, workflow_id, key, title, description, status, priority, confidence, metadata, created_at, updated_at, archived_at\nFROM weave_v1.requirement\nWHERE workflow_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
52
+ export declare const listRequirementsByProjectQuery = "-- name: ListRequirementsByProject :many\nSELECT id, project_id, key, title, description, status, priority, confidence, metadata, created_at, updated_at, archived_at\nFROM weave_v1.requirement\nWHERE project_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
53
+ export interface ListRequirementsByProjectArgs {
54
+ projectId: string;
55
+ includeArchived: boolean;
56
+ pageOffset: string;
57
+ pageSize: string;
58
+ }
59
+ export interface ListRequirementsByProjectRow {
60
+ id: string;
61
+ projectId: string;
62
+ key: string;
63
+ title: string;
64
+ description: string;
65
+ status: string;
66
+ priority: string;
67
+ confidence: string;
68
+ metadata: any;
69
+ createdAt: Date;
70
+ updatedAt: Date;
71
+ archivedAt: Date | null;
72
+ }
73
+ export declare function listRequirementsByProject(client: Client, args: ListRequirementsByProjectArgs): Promise<ListRequirementsByProjectRow[]>;
74
+ export declare const listRequirementsByWorkflowQuery = "-- name: ListRequirementsByWorkflow :many\nSELECT r.id, r.project_id, r.key, r.title, r.description, r.status, r.priority, r.confidence, r.metadata, r.created_at, r.updated_at, r.archived_at\nFROM weave_v1.requirement r\n INNER JOIN weave_v1.workflow_requirement b\n ON b.requirement_id = r.id\n AND b.project_id = r.project_id\nWHERE b.project_id = $1\n AND b.workflow_id = $2\n AND ($3::BOOLEAN OR r.archived_at IS NULL)\nORDER BY r.updated_at DESC\nLIMIT $5\nOFFSET $4";
53
75
  export interface ListRequirementsByWorkflowArgs {
76
+ projectId: string;
54
77
  workflowId: string;
55
78
  includeArchived: boolean;
56
79
  pageOffset: string;
@@ -58,7 +81,7 @@ export interface ListRequirementsByWorkflowArgs {
58
81
  }
59
82
  export interface ListRequirementsByWorkflowRow {
60
83
  id: string;
61
- workflowId: string;
84
+ projectId: string;
62
85
  key: string;
63
86
  title: string;
64
87
  description: string;
@@ -71,7 +94,7 @@ export interface ListRequirementsByWorkflowRow {
71
94
  archivedAt: Date | null;
72
95
  }
73
96
  export declare function listRequirementsByWorkflow(client: Client, args: ListRequirementsByWorkflowArgs): Promise<ListRequirementsByWorkflowRow[]>;
74
- export declare const updateRequirementQuery = "-- name: UpdateRequirement :one\nUPDATE weave_v1.requirement\nSET key = $1,\n title = $2,\n description = $3,\n status = $4,\n priority = $5,\n confidence = $6,\n metadata = $7,\n updated_at = NOW()\nWHERE id = $8\n AND workflow_id = $9\nRETURNING id, workflow_id, key, title, description, status, priority, confidence, metadata, created_at, updated_at, archived_at";
97
+ export declare const updateRequirementQuery = "-- name: UpdateRequirement :one\nUPDATE weave_v1.requirement\nSET key = $1,\n title = $2,\n description = $3,\n status = $4,\n priority = $5,\n confidence = $6,\n metadata = $7,\n updated_at = NOW()\nWHERE id = $8\n AND project_id = $9\nRETURNING id, project_id, key, title, description, status, priority, confidence, metadata, created_at, updated_at, archived_at";
75
98
  export interface UpdateRequirementArgs {
76
99
  key: string;
77
100
  title: string;
@@ -81,11 +104,11 @@ export interface UpdateRequirementArgs {
81
104
  confidence: string;
82
105
  metadata: any;
83
106
  id: string;
84
- workflowId: string;
107
+ projectId: string;
85
108
  }
86
109
  export interface UpdateRequirementRow {
87
110
  id: string;
88
- workflowId: string;
111
+ projectId: string;
89
112
  key: string;
90
113
  title: string;
91
114
  description: string;
@@ -98,14 +121,14 @@ export interface UpdateRequirementRow {
98
121
  archivedAt: Date | null;
99
122
  }
100
123
  export declare function updateRequirement(client: Client, args: UpdateRequirementArgs): Promise<UpdateRequirementRow | null>;
101
- export declare const archiveRequirementQuery = "-- name: ArchiveRequirement :one\nUPDATE weave_v1.requirement\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, status, priority, confidence, metadata, created_at, updated_at, archived_at";
124
+ export declare const archiveRequirementQuery = "-- name: ArchiveRequirement :one\nUPDATE weave_v1.requirement\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, status, priority, confidence, metadata, created_at, updated_at, archived_at";
102
125
  export interface ArchiveRequirementArgs {
103
126
  id: string;
104
- workflowId: string;
127
+ projectId: string;
105
128
  }
106
129
  export interface ArchiveRequirementRow {
107
130
  id: string;
108
- workflowId: string;
131
+ projectId: string;
109
132
  key: string;
110
133
  title: string;
111
134
  description: string;
@@ -118,12 +141,52 @@ export interface ArchiveRequirementRow {
118
141
  archivedAt: Date | null;
119
142
  }
120
143
  export declare function archiveRequirement(client: Client, args: ArchiveRequirementArgs): Promise<ArchiveRequirementRow | null>;
121
- export declare const deleteRequirementQuery = "-- name: DeleteRequirement :exec\nDELETE\nFROM weave_v1.requirement\nWHERE id = $1\n AND workflow_id = $2";
144
+ export declare const deleteRequirementQuery = "-- name: DeleteRequirement :exec\nDELETE\nFROM weave_v1.requirement\nWHERE id = $1\n AND project_id = $2";
122
145
  export interface DeleteRequirementArgs {
123
146
  id: string;
124
- workflowId: string;
147
+ projectId: string;
125
148
  }
126
149
  export declare function deleteRequirement(client: Client, args: DeleteRequirementArgs): Promise<void>;
150
+ export declare const attachRequirementToWorkflowQuery = "-- name: AttachRequirementToWorkflow :one\nINSERT INTO weave_v1.workflow_requirement (\n project_id,\n workflow_id,\n requirement_id,\n attached_by,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5\n)\nON CONFLICT (workflow_id, requirement_id) DO UPDATE\nSET attached_by = EXCLUDED.attached_by,\n metadata = EXCLUDED.metadata,\n attached_at = NOW()\nRETURNING project_id, workflow_id, requirement_id, attached_by, metadata, attached_at";
151
+ export interface AttachRequirementToWorkflowArgs {
152
+ projectId: string;
153
+ workflowId: string;
154
+ requirementId: string;
155
+ attachedBy: string;
156
+ metadata: any;
157
+ }
158
+ export interface AttachRequirementToWorkflowRow {
159
+ projectId: string;
160
+ workflowId: string;
161
+ requirementId: string;
162
+ attachedBy: string;
163
+ metadata: any;
164
+ attachedAt: Date;
165
+ }
166
+ export declare function attachRequirementToWorkflow(client: Client, args: AttachRequirementToWorkflowArgs): Promise<AttachRequirementToWorkflowRow | null>;
167
+ export declare const detachRequirementFromWorkflowQuery = "-- name: DetachRequirementFromWorkflow :exec\nDELETE\nFROM weave_v1.workflow_requirement\nWHERE project_id = $1\n AND workflow_id = $2\n AND requirement_id = $3";
168
+ export interface DetachRequirementFromWorkflowArgs {
169
+ projectId: string;
170
+ workflowId: string;
171
+ requirementId: string;
172
+ }
173
+ export declare function detachRequirementFromWorkflow(client: Client, args: DetachRequirementFromWorkflowArgs): Promise<void>;
174
+ export declare const listWorkflowRequirementBindingsQuery = "-- name: ListWorkflowRequirementBindings :many\nSELECT project_id, workflow_id, requirement_id, attached_by, metadata, attached_at\nFROM weave_v1.workflow_requirement\nWHERE project_id = $1\n AND workflow_id = $2\nORDER BY attached_at DESC\nLIMIT $4\nOFFSET $3";
175
+ export interface ListWorkflowRequirementBindingsArgs {
176
+ projectId: string;
177
+ workflowId: string;
178
+ pageOffset: string;
179
+ pageSize: string;
180
+ }
181
+ export interface ListWorkflowRequirementBindingsRow {
182
+ projectId: string;
183
+ workflowId: string;
184
+ requirementId: string;
185
+ attachedBy: string;
186
+ metadata: any;
187
+ attachedAt: Date;
188
+ }
189
+ export declare function listWorkflowRequirementBindings(client: Client, args: ListWorkflowRequirementBindingsArgs): Promise<ListWorkflowRequirementBindingsRow[]>;
127
190
  export declare const addRequirementSourceRefQuery = "-- name: AddRequirementSourceRef :one\nINSERT INTO weave_v1.requirement_source_ref (\n id,\n requirement_id,\n input_source_id,\n input_version_id,\n excerpt,\n locator\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6\n)\nRETURNING id, requirement_id, input_source_id, input_version_id, excerpt, locator, created_at";
128
191
  export interface AddRequirementSourceRefArgs {
129
192
  id: string;
@@ -143,10 +206,10 @@ export interface AddRequirementSourceRefRow {
143
206
  createdAt: Date;
144
207
  }
145
208
  export declare function addRequirementSourceRef(client: Client, args: AddRequirementSourceRefArgs): Promise<AddRequirementSourceRefRow | null>;
146
- export declare const listRequirementSourceRefsQuery = "-- name: ListRequirementSourceRefs :many\nSELECT rsr.id, rsr.requirement_id, rsr.input_source_id, rsr.input_version_id, rsr.excerpt, rsr.locator, rsr.created_at\nFROM weave_v1.requirement_source_ref rsr\n INNER JOIN weave_v1.requirement r ON r.id = rsr.requirement_id\nWHERE rsr.requirement_id = $1\n AND r.workflow_id = $2\nORDER BY rsr.created_at DESC";
209
+ export declare const listRequirementSourceRefsQuery = "-- name: ListRequirementSourceRefs :many\nSELECT rsr.id, rsr.requirement_id, rsr.input_source_id, rsr.input_version_id, rsr.excerpt, rsr.locator, rsr.created_at\nFROM weave_v1.requirement_source_ref rsr\n INNER JOIN weave_v1.requirement r ON r.id = rsr.requirement_id\nWHERE rsr.requirement_id = $1\n AND r.project_id = $2\nORDER BY rsr.created_at DESC";
147
210
  export interface ListRequirementSourceRefsArgs {
148
211
  requirementId: string;
149
- workflowId: string;
212
+ projectId: string;
150
213
  }
151
214
  export interface ListRequirementSourceRefsRow {
152
215
  id: string;
@@ -158,11 +221,11 @@ export interface ListRequirementSourceRefsRow {
158
221
  createdAt: Date;
159
222
  }
160
223
  export declare function listRequirementSourceRefs(client: Client, args: ListRequirementSourceRefsArgs): Promise<ListRequirementSourceRefsRow[]>;
161
- export declare const deleteRequirementSourceRefQuery = "-- name: DeleteRequirementSourceRef :exec\nDELETE\nFROM weave_v1.requirement_source_ref rsr\nUSING weave_v1.requirement r\nWHERE rsr.id = $1\n AND rsr.requirement_id = $2\n AND rsr.requirement_id = r.id\n AND r.workflow_id = $3";
224
+ export declare const deleteRequirementSourceRefQuery = "-- name: DeleteRequirementSourceRef :exec\nDELETE\nFROM weave_v1.requirement_source_ref rsr\nUSING weave_v1.requirement r\nWHERE rsr.id = $1\n AND rsr.requirement_id = $2\n AND rsr.requirement_id = r.id\n AND r.project_id = $3";
162
225
  export interface DeleteRequirementSourceRefArgs {
163
226
  id: string;
164
227
  requirementId: string;
165
- workflowId: string;
228
+ projectId: string;
166
229
  }
167
230
  export declare function deleteRequirementSourceRef(client: Client, args: DeleteRequirementSourceRefArgs): Promise<void>;
168
231
  export {};