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 createInputSourceQuery = "-- name: CreateInputSource :one\nINSERT INTO weave_v1.input_source (\n id,\n workflow_id,\n source_type,\n name,\n description,\n origin_uri,\n status,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8\n)\nRETURNING id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at";
5
+ export declare const createInputSourceQuery = "-- name: CreateInputSource :one\nINSERT INTO weave_v1.input_source (\n id,\n project_id,\n source_type,\n name,\n description,\n origin_uri,\n status,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8\n)\nRETURNING id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at";
6
6
  export interface CreateInputSourceArgs {
7
7
  id: string;
8
- workflowId: string;
8
+ projectId: string;
9
9
  sourceType: string;
10
10
  name: string;
11
11
  description: string;
@@ -15,7 +15,7 @@ export interface CreateInputSourceArgs {
15
15
  }
16
16
  export interface CreateInputSourceRow {
17
17
  id: string;
18
- workflowId: string;
18
+ projectId: string;
19
19
  sourceType: string;
20
20
  name: string;
21
21
  description: string;
@@ -28,14 +28,14 @@ export interface CreateInputSourceRow {
28
28
  archivedAt: Date | null;
29
29
  }
30
30
  export declare function createInputSource(client: Client, args: CreateInputSourceArgs): Promise<CreateInputSourceRow | null>;
31
- export declare const getInputSourceQuery = "-- name: GetInputSource :one\nSELECT id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at\nFROM weave_v1.input_source\nWHERE id = $1\n AND workflow_id = $2";
31
+ export declare const getInputSourceQuery = "-- name: GetInputSource :one\nSELECT id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at\nFROM weave_v1.input_source\nWHERE id = $1\n AND project_id = $2";
32
32
  export interface GetInputSourceArgs {
33
33
  id: string;
34
- workflowId: string;
34
+ projectId: string;
35
35
  }
36
36
  export interface GetInputSourceRow {
37
37
  id: string;
38
- workflowId: string;
38
+ projectId: string;
39
39
  sourceType: string;
40
40
  name: string;
41
41
  description: string;
@@ -48,8 +48,31 @@ export interface GetInputSourceRow {
48
48
  archivedAt: Date | null;
49
49
  }
50
50
  export declare function getInputSource(client: Client, args: GetInputSourceArgs): Promise<GetInputSourceRow | null>;
51
- export declare const listInputSourcesByWorkflowQuery = "-- name: ListInputSourcesByWorkflow :many\nSELECT id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at\nFROM weave_v1.input_source\nWHERE workflow_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
51
+ export declare const listInputSourcesByProjectQuery = "-- name: ListInputSourcesByProject :many\nSELECT id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at\nFROM weave_v1.input_source\nWHERE project_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
52
+ export interface ListInputSourcesByProjectArgs {
53
+ projectId: string;
54
+ includeArchived: boolean;
55
+ pageOffset: string;
56
+ pageSize: string;
57
+ }
58
+ export interface ListInputSourcesByProjectRow {
59
+ id: string;
60
+ projectId: string;
61
+ sourceType: string;
62
+ name: string;
63
+ description: string;
64
+ originUri: string;
65
+ status: string;
66
+ metadata: any;
67
+ activeVersionId: string | null;
68
+ createdAt: Date;
69
+ updatedAt: Date;
70
+ archivedAt: Date | null;
71
+ }
72
+ export declare function listInputSourcesByProject(client: Client, args: ListInputSourcesByProjectArgs): Promise<ListInputSourcesByProjectRow[]>;
73
+ export declare const listInputSourcesByWorkflowQuery = "-- name: ListInputSourcesByWorkflow :many\nSELECT s.id, s.project_id, s.source_type, s.name, s.description, s.origin_uri, s.status, s.metadata, s.active_version_id, s.created_at, s.updated_at, s.archived_at\nFROM weave_v1.input_source s\n INNER JOIN weave_v1.workflow_input_source b\n ON b.input_source_id = s.id\n AND b.project_id = s.project_id\nWHERE b.project_id = $1\n AND b.workflow_id = $2\n AND ($3::BOOLEAN OR s.archived_at IS NULL)\nORDER BY s.updated_at DESC\nLIMIT $5\nOFFSET $4";
52
74
  export interface ListInputSourcesByWorkflowArgs {
75
+ projectId: string;
53
76
  workflowId: string;
54
77
  includeArchived: boolean;
55
78
  pageOffset: string;
@@ -57,7 +80,7 @@ export interface ListInputSourcesByWorkflowArgs {
57
80
  }
58
81
  export interface ListInputSourcesByWorkflowRow {
59
82
  id: string;
60
- workflowId: string;
83
+ projectId: string;
61
84
  sourceType: string;
62
85
  name: string;
63
86
  description: string;
@@ -70,7 +93,7 @@ export interface ListInputSourcesByWorkflowRow {
70
93
  archivedAt: Date | null;
71
94
  }
72
95
  export declare function listInputSourcesByWorkflow(client: Client, args: ListInputSourcesByWorkflowArgs): Promise<ListInputSourcesByWorkflowRow[]>;
73
- export declare const updateInputSourceQuery = "-- name: UpdateInputSource :one\nUPDATE weave_v1.input_source\nSET name = $1,\n description = $2,\n origin_uri = $3,\n status = $4,\n metadata = $5,\n updated_at = NOW()\nWHERE id = $6\n AND workflow_id = $7\nRETURNING id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at";
96
+ export declare const updateInputSourceQuery = "-- name: UpdateInputSource :one\nUPDATE weave_v1.input_source\nSET name = $1,\n description = $2,\n origin_uri = $3,\n status = $4,\n metadata = $5,\n updated_at = NOW()\nWHERE id = $6\n AND project_id = $7\nRETURNING id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at";
74
97
  export interface UpdateInputSourceArgs {
75
98
  name: string;
76
99
  description: string;
@@ -78,11 +101,11 @@ export interface UpdateInputSourceArgs {
78
101
  status: string;
79
102
  metadata: any;
80
103
  id: string;
81
- workflowId: string;
104
+ projectId: string;
82
105
  }
83
106
  export interface UpdateInputSourceRow {
84
107
  id: string;
85
- workflowId: string;
108
+ projectId: string;
86
109
  sourceType: string;
87
110
  name: string;
88
111
  description: string;
@@ -95,14 +118,14 @@ export interface UpdateInputSourceRow {
95
118
  archivedAt: Date | null;
96
119
  }
97
120
  export declare function updateInputSource(client: Client, args: UpdateInputSourceArgs): Promise<UpdateInputSourceRow | null>;
98
- export declare const archiveInputSourceQuery = "-- name: ArchiveInputSource :one\nUPDATE weave_v1.input_source\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\n AND workflow_id = $2\nRETURNING id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at";
121
+ export declare const archiveInputSourceQuery = "-- name: ArchiveInputSource :one\nUPDATE weave_v1.input_source\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\n AND project_id = $2\nRETURNING id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at";
99
122
  export interface ArchiveInputSourceArgs {
100
123
  id: string;
101
- workflowId: string;
124
+ projectId: string;
102
125
  }
103
126
  export interface ArchiveInputSourceRow {
104
127
  id: string;
105
- workflowId: string;
128
+ projectId: string;
106
129
  sourceType: string;
107
130
  name: string;
108
131
  description: string;
@@ -115,12 +138,52 @@ export interface ArchiveInputSourceRow {
115
138
  archivedAt: Date | null;
116
139
  }
117
140
  export declare function archiveInputSource(client: Client, args: ArchiveInputSourceArgs): Promise<ArchiveInputSourceRow | null>;
118
- export declare const deleteInputSourceQuery = "-- name: DeleteInputSource :exec\nDELETE\nFROM weave_v1.input_source\nWHERE id = $1\n AND workflow_id = $2";
141
+ export declare const deleteInputSourceQuery = "-- name: DeleteInputSource :exec\nDELETE\nFROM weave_v1.input_source\nWHERE id = $1\n AND project_id = $2";
119
142
  export interface DeleteInputSourceArgs {
120
143
  id: string;
121
- workflowId: string;
144
+ projectId: string;
122
145
  }
123
146
  export declare function deleteInputSource(client: Client, args: DeleteInputSourceArgs): Promise<void>;
147
+ export declare const attachInputSourceToWorkflowQuery = "-- name: AttachInputSourceToWorkflow :one\nINSERT INTO weave_v1.workflow_input_source (\n project_id,\n workflow_id,\n input_source_id,\n attached_by,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5\n)\nON CONFLICT (workflow_id, input_source_id) DO UPDATE\nSET attached_by = EXCLUDED.attached_by,\n metadata = EXCLUDED.metadata,\n attached_at = NOW()\nRETURNING project_id, workflow_id, input_source_id, attached_by, metadata, attached_at";
148
+ export interface AttachInputSourceToWorkflowArgs {
149
+ projectId: string;
150
+ workflowId: string;
151
+ inputSourceId: string;
152
+ attachedBy: string;
153
+ metadata: any;
154
+ }
155
+ export interface AttachInputSourceToWorkflowRow {
156
+ projectId: string;
157
+ workflowId: string;
158
+ inputSourceId: string;
159
+ attachedBy: string;
160
+ metadata: any;
161
+ attachedAt: Date;
162
+ }
163
+ export declare function attachInputSourceToWorkflow(client: Client, args: AttachInputSourceToWorkflowArgs): Promise<AttachInputSourceToWorkflowRow | null>;
164
+ export declare const detachInputSourceFromWorkflowQuery = "-- name: DetachInputSourceFromWorkflow :exec\nDELETE\nFROM weave_v1.workflow_input_source\nWHERE project_id = $1\n AND workflow_id = $2\n AND input_source_id = $3";
165
+ export interface DetachInputSourceFromWorkflowArgs {
166
+ projectId: string;
167
+ workflowId: string;
168
+ inputSourceId: string;
169
+ }
170
+ export declare function detachInputSourceFromWorkflow(client: Client, args: DetachInputSourceFromWorkflowArgs): Promise<void>;
171
+ export declare const listWorkflowInputSourceBindingsQuery = "-- name: ListWorkflowInputSourceBindings :many\nSELECT project_id, workflow_id, input_source_id, attached_by, metadata, attached_at\nFROM weave_v1.workflow_input_source\nWHERE project_id = $1\n AND workflow_id = $2\nORDER BY attached_at DESC\nLIMIT $4\nOFFSET $3";
172
+ export interface ListWorkflowInputSourceBindingsArgs {
173
+ projectId: string;
174
+ workflowId: string;
175
+ pageOffset: string;
176
+ pageSize: string;
177
+ }
178
+ export interface ListWorkflowInputSourceBindingsRow {
179
+ projectId: string;
180
+ workflowId: string;
181
+ inputSourceId: string;
182
+ attachedBy: string;
183
+ metadata: any;
184
+ attachedAt: Date;
185
+ }
186
+ export declare function listWorkflowInputSourceBindings(client: Client, args: ListWorkflowInputSourceBindingsArgs): Promise<ListWorkflowInputSourceBindingsRow[]>;
124
187
  export declare const createInputVersionQuery = "-- name: CreateInputVersion :one\nINSERT INTO weave_v1.input_version (\n id,\n input_source_id,\n version_number,\n checksum,\n content_uri,\n status,\n parsed_summary,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8\n)\nRETURNING id, input_source_id, version_number, checksum, content_uri, status, parsed_summary, metadata, created_at";
125
188
  export interface CreateInputVersionArgs {
126
189
  id: string;
@@ -144,11 +207,11 @@ export interface CreateInputVersionRow {
144
207
  createdAt: Date;
145
208
  }
146
209
  export declare function createInputVersion(client: Client, args: CreateInputVersionArgs): Promise<CreateInputVersionRow | null>;
147
- export declare const getInputVersionQuery = "-- name: GetInputVersion :one\nSELECT v.id, v.input_source_id, v.version_number, v.checksum, v.content_uri, v.status, v.parsed_summary, v.metadata, v.created_at\nFROM weave_v1.input_version v\n INNER JOIN weave_v1.input_source s ON s.id = v.input_source_id\nWHERE v.id = $1\n AND v.input_source_id = $2\n AND s.workflow_id = $3";
210
+ export declare const getInputVersionQuery = "-- name: GetInputVersion :one\nSELECT v.id, v.input_source_id, v.version_number, v.checksum, v.content_uri, v.status, v.parsed_summary, v.metadata, v.created_at\nFROM weave_v1.input_version v\n INNER JOIN weave_v1.input_source s ON s.id = v.input_source_id\nWHERE v.id = $1\n AND v.input_source_id = $2\n AND s.project_id = $3";
148
211
  export interface GetInputVersionArgs {
149
212
  id: string;
150
213
  inputSourceId: string;
151
- workflowId: string;
214
+ projectId: string;
152
215
  }
153
216
  export interface GetInputVersionRow {
154
217
  id: string;
@@ -162,10 +225,10 @@ export interface GetInputVersionRow {
162
225
  createdAt: Date;
163
226
  }
164
227
  export declare function getInputVersion(client: Client, args: GetInputVersionArgs): Promise<GetInputVersionRow | null>;
165
- export declare const listInputVersionsBySourceQuery = "-- name: ListInputVersionsBySource :many\nSELECT v.id, v.input_source_id, v.version_number, v.checksum, v.content_uri, v.status, v.parsed_summary, v.metadata, v.created_at\nFROM weave_v1.input_version v\n INNER JOIN weave_v1.input_source s ON s.id = v.input_source_id\nWHERE v.input_source_id = $1\n AND s.workflow_id = $2\nORDER BY v.version_number DESC\nLIMIT $4\nOFFSET $3";
228
+ export declare const listInputVersionsBySourceQuery = "-- name: ListInputVersionsBySource :many\nSELECT v.id, v.input_source_id, v.version_number, v.checksum, v.content_uri, v.status, v.parsed_summary, v.metadata, v.created_at\nFROM weave_v1.input_version v\n INNER JOIN weave_v1.input_source s ON s.id = v.input_source_id\nWHERE v.input_source_id = $1\n AND s.project_id = $2\nORDER BY v.version_number DESC\nLIMIT $4\nOFFSET $3";
166
229
  export interface ListInputVersionsBySourceArgs {
167
230
  inputSourceId: string;
168
- workflowId: string;
231
+ projectId: string;
169
232
  pageOffset: string;
170
233
  pageSize: string;
171
234
  }
@@ -189,15 +252,15 @@ export interface GetNextInputVersionNumberRow {
189
252
  versionNumber: string;
190
253
  }
191
254
  export declare function getNextInputVersionNumber(client: Client, args: GetNextInputVersionNumberArgs): Promise<GetNextInputVersionNumberRow | null>;
192
- export declare const setInputSourceActiveVersionQuery = "-- name: SetInputSourceActiveVersion :one\nUPDATE weave_v1.input_source\nSET active_version_id = $1,\n updated_at = NOW()\nWHERE id = $2\n AND workflow_id = $3\nRETURNING id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at";
255
+ export declare const setInputSourceActiveVersionQuery = "-- name: SetInputSourceActiveVersion :one\nUPDATE weave_v1.input_source\nSET active_version_id = $1,\n updated_at = NOW()\nWHERE id = $2\n AND project_id = $3\nRETURNING id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at";
193
256
  export interface SetInputSourceActiveVersionArgs {
194
257
  activeVersionId: string | null;
195
258
  id: string;
196
- workflowId: string;
259
+ projectId: string;
197
260
  }
198
261
  export interface SetInputSourceActiveVersionRow {
199
262
  id: string;
200
- workflowId: string;
263
+ projectId: string;
201
264
  sourceType: string;
202
265
  name: string;
203
266
  description: string;
@@ -210,10 +273,10 @@ export interface SetInputSourceActiveVersionRow {
210
273
  archivedAt: Date | null;
211
274
  }
212
275
  export declare function setInputSourceActiveVersion(client: Client, args: SetInputSourceActiveVersionArgs): Promise<SetInputSourceActiveVersionRow | null>;
213
- export declare const getInputSourceActiveVersionQuery = "-- name: GetInputSourceActiveVersion :one\nSELECT v.id, v.input_source_id, v.version_number, v.checksum, v.content_uri, v.status, v.parsed_summary, v.metadata, v.created_at\nFROM weave_v1.input_source s\n INNER JOIN weave_v1.input_version v ON v.id = s.active_version_id\nWHERE s.id = $1\n AND s.workflow_id = $2";
276
+ export declare const getInputSourceActiveVersionQuery = "-- name: GetInputSourceActiveVersion :one\nSELECT v.id, v.input_source_id, v.version_number, v.checksum, v.content_uri, v.status, v.parsed_summary, v.metadata, v.created_at\nFROM weave_v1.input_source s\n INNER JOIN weave_v1.input_version v ON v.id = s.active_version_id\nWHERE s.id = $1\n AND s.project_id = $2";
214
277
  export interface GetInputSourceActiveVersionArgs {
215
278
  id: string;
216
- workflowId: string;
279
+ projectId: string;
217
280
  }
218
281
  export interface GetInputSourceActiveVersionRow {
219
282
  id: string;
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInputSourceActiveVersionQuery = exports.setInputSourceActiveVersionQuery = exports.getNextInputVersionNumberQuery = exports.listInputVersionsBySourceQuery = exports.getInputVersionQuery = exports.createInputVersionQuery = exports.deleteInputSourceQuery = exports.archiveInputSourceQuery = exports.updateInputSourceQuery = exports.listInputSourcesByWorkflowQuery = exports.getInputSourceQuery = exports.createInputSourceQuery = void 0;
3
+ exports.getInputSourceActiveVersionQuery = exports.setInputSourceActiveVersionQuery = exports.getNextInputVersionNumberQuery = exports.listInputVersionsBySourceQuery = exports.getInputVersionQuery = exports.createInputVersionQuery = exports.listWorkflowInputSourceBindingsQuery = exports.detachInputSourceFromWorkflowQuery = exports.attachInputSourceToWorkflowQuery = exports.deleteInputSourceQuery = exports.archiveInputSourceQuery = exports.updateInputSourceQuery = exports.listInputSourcesByWorkflowQuery = exports.listInputSourcesByProjectQuery = exports.getInputSourceQuery = exports.createInputSourceQuery = void 0;
4
4
  exports.createInputSource = createInputSource;
5
5
  exports.getInputSource = getInputSource;
6
+ exports.listInputSourcesByProject = listInputSourcesByProject;
6
7
  exports.listInputSourcesByWorkflow = listInputSourcesByWorkflow;
7
8
  exports.updateInputSource = updateInputSource;
8
9
  exports.archiveInputSource = archiveInputSource;
9
10
  exports.deleteInputSource = deleteInputSource;
11
+ exports.attachInputSourceToWorkflow = attachInputSourceToWorkflow;
12
+ exports.detachInputSourceFromWorkflow = detachInputSourceFromWorkflow;
13
+ exports.listWorkflowInputSourceBindings = listWorkflowInputSourceBindings;
10
14
  exports.createInputVersion = createInputVersion;
11
15
  exports.getInputVersion = getInputVersion;
12
16
  exports.listInputVersionsBySource = listInputVersionsBySource;
@@ -16,7 +20,7 @@ exports.getInputSourceActiveVersion = getInputSourceActiveVersion;
16
20
  exports.createInputSourceQuery = `-- name: CreateInputSource :one
17
21
  INSERT INTO weave_v1.input_source (
18
22
  id,
19
- workflow_id,
23
+ project_id,
20
24
  source_type,
21
25
  name,
22
26
  description,
@@ -34,11 +38,11 @@ VALUES (
34
38
  $7,
35
39
  $8
36
40
  )
37
- RETURNING id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at`;
41
+ RETURNING id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at`;
38
42
  async function createInputSource(client, args) {
39
43
  const result = await client.query({
40
44
  text: exports.createInputSourceQuery,
41
- values: [args.id, args.workflowId, args.sourceType, args.name, args.description, args.originUri, args.status, args.metadata],
45
+ values: [args.id, args.projectId, args.sourceType, args.name, args.description, args.originUri, args.status, args.metadata],
42
46
  rowMode: "array"
43
47
  });
44
48
  if (result.rows.length !== 1) {
@@ -47,7 +51,7 @@ async function createInputSource(client, args) {
47
51
  const row = result.rows[0];
48
52
  return {
49
53
  id: row[0],
50
- workflowId: row[1],
54
+ projectId: row[1],
51
55
  sourceType: row[2],
52
56
  name: row[3],
53
57
  description: row[4],
@@ -61,14 +65,14 @@ async function createInputSource(client, args) {
61
65
  };
62
66
  }
63
67
  exports.getInputSourceQuery = `-- name: GetInputSource :one
64
- SELECT id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at
68
+ SELECT id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at
65
69
  FROM weave_v1.input_source
66
70
  WHERE id = $1
67
- AND workflow_id = $2`;
71
+ AND project_id = $2`;
68
72
  async function getInputSource(client, args) {
69
73
  const result = await client.query({
70
74
  text: exports.getInputSourceQuery,
71
- values: [args.id, args.workflowId],
75
+ values: [args.id, args.projectId],
72
76
  rowMode: "array"
73
77
  });
74
78
  if (result.rows.length !== 1) {
@@ -77,7 +81,7 @@ async function getInputSource(client, args) {
77
81
  const row = result.rows[0];
78
82
  return {
79
83
  id: row[0],
80
- workflowId: row[1],
84
+ projectId: row[1],
81
85
  sourceType: row[2],
82
86
  name: row[3],
83
87
  description: row[4],
@@ -90,24 +94,59 @@ async function getInputSource(client, args) {
90
94
  archivedAt: row[11]
91
95
  };
92
96
  }
93
- exports.listInputSourcesByWorkflowQuery = `-- name: ListInputSourcesByWorkflow :many
94
- SELECT id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at
97
+ exports.listInputSourcesByProjectQuery = `-- name: ListInputSourcesByProject :many
98
+ SELECT id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at
95
99
  FROM weave_v1.input_source
96
- WHERE workflow_id = $1
100
+ WHERE project_id = $1
97
101
  AND ($2::BOOLEAN OR archived_at IS NULL)
98
102
  ORDER BY updated_at DESC
99
103
  LIMIT $4
100
104
  OFFSET $3`;
105
+ async function listInputSourcesByProject(client, args) {
106
+ const result = await client.query({
107
+ text: exports.listInputSourcesByProjectQuery,
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
+ sourceType: row[2],
116
+ name: row[3],
117
+ description: row[4],
118
+ originUri: row[5],
119
+ status: row[6],
120
+ metadata: row[7],
121
+ activeVersionId: row[8],
122
+ createdAt: row[9],
123
+ updatedAt: row[10],
124
+ archivedAt: row[11]
125
+ };
126
+ });
127
+ }
128
+ exports.listInputSourcesByWorkflowQuery = `-- name: ListInputSourcesByWorkflow :many
129
+ SELECT s.id, s.project_id, s.source_type, s.name, s.description, s.origin_uri, s.status, s.metadata, s.active_version_id, s.created_at, s.updated_at, s.archived_at
130
+ FROM weave_v1.input_source s
131
+ INNER JOIN weave_v1.workflow_input_source b
132
+ ON b.input_source_id = s.id
133
+ AND b.project_id = s.project_id
134
+ WHERE b.project_id = $1
135
+ AND b.workflow_id = $2
136
+ AND ($3::BOOLEAN OR s.archived_at IS NULL)
137
+ ORDER BY s.updated_at DESC
138
+ LIMIT $5
139
+ OFFSET $4`;
101
140
  async function listInputSourcesByWorkflow(client, args) {
102
141
  const result = await client.query({
103
142
  text: exports.listInputSourcesByWorkflowQuery,
104
- values: [args.workflowId, args.includeArchived, args.pageOffset, args.pageSize],
143
+ values: [args.projectId, args.workflowId, args.includeArchived, args.pageOffset, args.pageSize],
105
144
  rowMode: "array"
106
145
  });
107
146
  return result.rows.map(row => {
108
147
  return {
109
148
  id: row[0],
110
- workflowId: row[1],
149
+ projectId: row[1],
111
150
  sourceType: row[2],
112
151
  name: row[3],
113
152
  description: row[4],
@@ -130,12 +169,12 @@ SET name = $1,
130
169
  metadata = $5,
131
170
  updated_at = NOW()
132
171
  WHERE id = $6
133
- AND workflow_id = $7
134
- RETURNING id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at`;
172
+ AND project_id = $7
173
+ RETURNING id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at`;
135
174
  async function updateInputSource(client, args) {
136
175
  const result = await client.query({
137
176
  text: exports.updateInputSourceQuery,
138
- values: [args.name, args.description, args.originUri, args.status, args.metadata, args.id, args.workflowId],
177
+ values: [args.name, args.description, args.originUri, args.status, args.metadata, args.id, args.projectId],
139
178
  rowMode: "array"
140
179
  });
141
180
  if (result.rows.length !== 1) {
@@ -144,7 +183,7 @@ async function updateInputSource(client, args) {
144
183
  const row = result.rows[0];
145
184
  return {
146
185
  id: row[0],
147
- workflowId: row[1],
186
+ projectId: row[1],
148
187
  sourceType: row[2],
149
188
  name: row[3],
150
189
  description: row[4],
@@ -163,12 +202,12 @@ SET status = 'archived',
163
202
  archived_at = NOW(),
164
203
  updated_at = NOW()
165
204
  WHERE id = $1
166
- AND workflow_id = $2
167
- RETURNING id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at`;
205
+ AND project_id = $2
206
+ RETURNING id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at`;
168
207
  async function archiveInputSource(client, args) {
169
208
  const result = await client.query({
170
209
  text: exports.archiveInputSourceQuery,
171
- values: [args.id, args.workflowId],
210
+ values: [args.id, args.projectId],
172
211
  rowMode: "array"
173
212
  });
174
213
  if (result.rows.length !== 1) {
@@ -177,7 +216,7 @@ async function archiveInputSource(client, args) {
177
216
  const row = result.rows[0];
178
217
  return {
179
218
  id: row[0],
180
- workflowId: row[1],
219
+ projectId: row[1],
181
220
  sourceType: row[2],
182
221
  name: row[3],
183
222
  description: row[4],
@@ -194,14 +233,91 @@ exports.deleteInputSourceQuery = `-- name: DeleteInputSource :exec
194
233
  DELETE
195
234
  FROM weave_v1.input_source
196
235
  WHERE id = $1
197
- AND workflow_id = $2`;
236
+ AND project_id = $2`;
198
237
  async function deleteInputSource(client, args) {
199
238
  await client.query({
200
239
  text: exports.deleteInputSourceQuery,
201
- values: [args.id, args.workflowId],
240
+ values: [args.id, args.projectId],
202
241
  rowMode: "array"
203
242
  });
204
243
  }
244
+ exports.attachInputSourceToWorkflowQuery = `-- name: AttachInputSourceToWorkflow :one
245
+ INSERT INTO weave_v1.workflow_input_source (
246
+ project_id,
247
+ workflow_id,
248
+ input_source_id,
249
+ attached_by,
250
+ metadata
251
+ )
252
+ VALUES (
253
+ $1,
254
+ $2,
255
+ $3,
256
+ $4,
257
+ $5
258
+ )
259
+ ON CONFLICT (workflow_id, input_source_id) DO UPDATE
260
+ SET attached_by = EXCLUDED.attached_by,
261
+ metadata = EXCLUDED.metadata,
262
+ attached_at = NOW()
263
+ RETURNING project_id, workflow_id, input_source_id, attached_by, metadata, attached_at`;
264
+ async function attachInputSourceToWorkflow(client, args) {
265
+ const result = await client.query({
266
+ text: exports.attachInputSourceToWorkflowQuery,
267
+ values: [args.projectId, args.workflowId, args.inputSourceId, args.attachedBy, args.metadata],
268
+ rowMode: "array"
269
+ });
270
+ if (result.rows.length !== 1) {
271
+ return null;
272
+ }
273
+ const row = result.rows[0];
274
+ return {
275
+ projectId: row[0],
276
+ workflowId: row[1],
277
+ inputSourceId: row[2],
278
+ attachedBy: row[3],
279
+ metadata: row[4],
280
+ attachedAt: row[5]
281
+ };
282
+ }
283
+ exports.detachInputSourceFromWorkflowQuery = `-- name: DetachInputSourceFromWorkflow :exec
284
+ DELETE
285
+ FROM weave_v1.workflow_input_source
286
+ WHERE project_id = $1
287
+ AND workflow_id = $2
288
+ AND input_source_id = $3`;
289
+ async function detachInputSourceFromWorkflow(client, args) {
290
+ await client.query({
291
+ text: exports.detachInputSourceFromWorkflowQuery,
292
+ values: [args.projectId, args.workflowId, args.inputSourceId],
293
+ rowMode: "array"
294
+ });
295
+ }
296
+ exports.listWorkflowInputSourceBindingsQuery = `-- name: ListWorkflowInputSourceBindings :many
297
+ SELECT project_id, workflow_id, input_source_id, attached_by, metadata, attached_at
298
+ FROM weave_v1.workflow_input_source
299
+ WHERE project_id = $1
300
+ AND workflow_id = $2
301
+ ORDER BY attached_at DESC
302
+ LIMIT $4
303
+ OFFSET $3`;
304
+ async function listWorkflowInputSourceBindings(client, args) {
305
+ const result = await client.query({
306
+ text: exports.listWorkflowInputSourceBindingsQuery,
307
+ values: [args.projectId, args.workflowId, args.pageOffset, args.pageSize],
308
+ rowMode: "array"
309
+ });
310
+ return result.rows.map(row => {
311
+ return {
312
+ projectId: row[0],
313
+ workflowId: row[1],
314
+ inputSourceId: row[2],
315
+ attachedBy: row[3],
316
+ metadata: row[4],
317
+ attachedAt: row[5]
318
+ };
319
+ });
320
+ }
205
321
  exports.createInputVersionQuery = `-- name: CreateInputVersion :one
206
322
  INSERT INTO weave_v1.input_version (
207
323
  id,
@@ -252,11 +368,11 @@ FROM weave_v1.input_version v
252
368
  INNER JOIN weave_v1.input_source s ON s.id = v.input_source_id
253
369
  WHERE v.id = $1
254
370
  AND v.input_source_id = $2
255
- AND s.workflow_id = $3`;
371
+ AND s.project_id = $3`;
256
372
  async function getInputVersion(client, args) {
257
373
  const result = await client.query({
258
374
  text: exports.getInputVersionQuery,
259
- values: [args.id, args.inputSourceId, args.workflowId],
375
+ values: [args.id, args.inputSourceId, args.projectId],
260
376
  rowMode: "array"
261
377
  });
262
378
  if (result.rows.length !== 1) {
@@ -280,14 +396,14 @@ SELECT v.id, v.input_source_id, v.version_number, v.checksum, v.content_uri, v.s
280
396
  FROM weave_v1.input_version v
281
397
  INNER JOIN weave_v1.input_source s ON s.id = v.input_source_id
282
398
  WHERE v.input_source_id = $1
283
- AND s.workflow_id = $2
399
+ AND s.project_id = $2
284
400
  ORDER BY v.version_number DESC
285
401
  LIMIT $4
286
402
  OFFSET $3`;
287
403
  async function listInputVersionsBySource(client, args) {
288
404
  const result = await client.query({
289
405
  text: exports.listInputVersionsBySourceQuery,
290
- values: [args.inputSourceId, args.workflowId, args.pageOffset, args.pageSize],
406
+ values: [args.inputSourceId, args.projectId, args.pageOffset, args.pageSize],
291
407
  rowMode: "array"
292
408
  });
293
409
  return result.rows.map(row => {
@@ -327,12 +443,12 @@ UPDATE weave_v1.input_source
327
443
  SET active_version_id = $1,
328
444
  updated_at = NOW()
329
445
  WHERE id = $2
330
- AND workflow_id = $3
331
- RETURNING id, workflow_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at`;
446
+ AND project_id = $3
447
+ RETURNING id, project_id, source_type, name, description, origin_uri, status, metadata, active_version_id, created_at, updated_at, archived_at`;
332
448
  async function setInputSourceActiveVersion(client, args) {
333
449
  const result = await client.query({
334
450
  text: exports.setInputSourceActiveVersionQuery,
335
- values: [args.activeVersionId, args.id, args.workflowId],
451
+ values: [args.activeVersionId, args.id, args.projectId],
336
452
  rowMode: "array"
337
453
  });
338
454
  if (result.rows.length !== 1) {
@@ -341,7 +457,7 @@ async function setInputSourceActiveVersion(client, args) {
341
457
  const row = result.rows[0];
342
458
  return {
343
459
  id: row[0],
344
- workflowId: row[1],
460
+ projectId: row[1],
345
461
  sourceType: row[2],
346
462
  name: row[3],
347
463
  description: row[4],
@@ -359,11 +475,11 @@ SELECT v.id, v.input_source_id, v.version_number, v.checksum, v.content_uri, v.s
359
475
  FROM weave_v1.input_source s
360
476
  INNER JOIN weave_v1.input_version v ON v.id = s.active_version_id
361
477
  WHERE s.id = $1
362
- AND s.workflow_id = $2`;
478
+ AND s.project_id = $2`;
363
479
  async function getInputSourceActiveVersion(client, args) {
364
480
  const result = await client.query({
365
481
  text: exports.getInputSourceActiveVersionQuery,
366
- values: [args.id, args.workflowId],
482
+ values: [args.id, args.projectId],
367
483
  rowMode: "array"
368
484
  });
369
485
  if (result.rows.length !== 1) {