weave-typescript 0.11.14 → 0.11.16

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 (75) hide show
  1. package/dist/weaveapi/data/v1/data.pb.d.ts +54 -0
  2. package/dist/weaveapi/data/v1/data.pb.js +411 -0
  3. package/dist/weaveapi/data/v1/service.pb.d.ts +296 -0
  4. package/dist/weaveapi/data/v1/service.pb.js +2779 -0
  5. package/dist/weaveapi/input/v1/input.pb.d.ts +77 -0
  6. package/dist/weaveapi/input/v1/input.pb.js +632 -0
  7. package/dist/weaveapi/input/v1/service.pb.d.ts +390 -0
  8. package/dist/weaveapi/input/v1/service.pb.js +3612 -0
  9. package/dist/weaveapi/integration/v1/integration.pb.d.ts +67 -0
  10. package/dist/weaveapi/integration/v1/integration.pb.js +486 -0
  11. package/dist/weaveapi/integration/v1/service.pb.d.ts +318 -0
  12. package/dist/weaveapi/integration/v1/service.pb.js +2994 -0
  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 +81 -0
  18. package/dist/weaveapi/report/v1/report.pb.js +678 -0
  19. package/dist/weaveapi/report/v1/service.pb.d.ts +194 -0
  20. package/dist/weaveapi/report/v1/service.pb.js +1925 -0
  21. package/dist/weaveapi/requirement/v1/requirement.pb.d.ts +70 -0
  22. package/dist/weaveapi/requirement/v1/requirement.pb.js +570 -0
  23. package/dist/weaveapi/requirement/v1/service.pb.d.ts +390 -0
  24. package/dist/weaveapi/requirement/v1/service.pb.js +3638 -0
  25. package/dist/weaveapi/run/v1/run.pb.d.ts +117 -0
  26. package/dist/weaveapi/run/v1/run.pb.js +1155 -0
  27. package/dist/weaveapi/run/v1/service.pb.d.ts +229 -0
  28. package/dist/weaveapi/run/v1/service.pb.js +2428 -0
  29. package/dist/weaveapi/script/v1/script.pb.d.ts +102 -0
  30. package/dist/weaveapi/script/v1/script.pb.js +1025 -0
  31. package/dist/weaveapi/script/v1/service.pb.d.ts +502 -0
  32. package/dist/weaveapi/script/v1/service.pb.js +4873 -0
  33. package/dist/weaveapi/storage/v1/service.pb.d.ts +4 -0
  34. package/dist/weaveapi/storage/v1/service.pb.js +50 -7
  35. package/dist/weaveapi/storage/v1/storage.pb.d.ts +2 -0
  36. package/dist/weaveapi/storage/v1/storage.pb.js +23 -0
  37. package/dist/weaveapi/storage/v1/vcs.pb.d.ts +75 -0
  38. package/dist/weaveapi/storage/v1/vcs.pb.js +864 -0
  39. package/dist/weaveapi/suite/v1/service.pb.d.ts +539 -0
  40. package/dist/weaveapi/suite/v1/service.pb.js +5281 -0
  41. package/dist/weaveapi/suite/v1/suite.pb.d.ts +92 -0
  42. package/dist/weaveapi/suite/v1/suite.pb.js +876 -0
  43. package/dist/weaveapi/testcase/v1/service.pb.d.ts +498 -0
  44. package/dist/weaveapi/testcase/v1/service.pb.js +4730 -0
  45. package/dist/weaveapi/testcase/v1/testcase.pb.d.ts +91 -0
  46. package/dist/weaveapi/testcase/v1/testcase.pb.js +794 -0
  47. package/dist/weaveapi/workflow/v1/service.pb.d.ts +26 -0
  48. package/dist/weaveapi/workflow/v1/service.pb.js +293 -5
  49. package/dist/weaveapi/workflow/v1/workflow.pb.d.ts +1 -0
  50. package/dist/weaveapi/workflow/v1/workflow.pb.js +17 -1
  51. package/dist/weavesql/weavedb/data_asset_sql.d.ts +206 -0
  52. package/dist/weavesql/weavedb/data_asset_sql.js +335 -0
  53. package/dist/weavesql/weavedb/input_sql.d.ts +293 -0
  54. package/dist/weavesql/weavedb/input_sql.js +500 -0
  55. package/dist/weavesql/weavedb/integration_sql.d.ts +236 -0
  56. package/dist/weavesql/weavedb/integration_sql.js +377 -0
  57. package/dist/weavesql/weavedb/project_sql.d.ts +29 -5
  58. package/dist/weavesql/weavedb/project_sql.js +73 -37
  59. package/dist/weavesql/weavedb/report_sql.d.ts +192 -0
  60. package/dist/weavesql/weavedb/report_sql.js +308 -0
  61. package/dist/weavesql/weavedb/requirement_sql.d.ts +231 -0
  62. package/dist/weavesql/weavedb/requirement_sql.js +399 -0
  63. package/dist/weavesql/weavedb/run_sql.d.ts +283 -0
  64. package/dist/weavesql/weavedb/run_sql.js +462 -0
  65. package/dist/weavesql/weavedb/suite_sql.d.ts +354 -0
  66. package/dist/weavesql/weavedb/suite_sql.js +631 -0
  67. package/dist/weavesql/weavedb/test_case_sql.d.ts +325 -0
  68. package/dist/weavesql/weavedb/test_case_sql.js +563 -0
  69. package/dist/weavesql/weavedb/test_script_sql.d.ts +354 -0
  70. package/dist/weavesql/weavedb/test_script_sql.js +605 -0
  71. package/dist/weavesql/weavedb/traceability_sql.d.ts +117 -0
  72. package/dist/weavesql/weavedb/traceability_sql.js +363 -0
  73. package/dist/weavesql/weavedb/workflow_sql.d.ts +30 -5
  74. package/dist/weavesql/weavedb/workflow_sql.js +76 -38
  75. package/package.json +1 -1
@@ -0,0 +1,236 @@
1
+ import { QueryArrayConfig, QueryArrayResult } from "pg";
2
+ interface Client {
3
+ query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
4
+ }
5
+ export declare const createIntegrationEndpointQuery = "-- name: CreateIntegrationEndpoint :one\nINSERT INTO weave_v1.integration_endpoint (\n id,\n project_id,\n name,\n description,\n type,\n status,\n target_uri,\n auth_reference,\n config,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10\n)\nRETURNING id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at";
6
+ export interface CreateIntegrationEndpointArgs {
7
+ id: string;
8
+ projectId: string;
9
+ name: string;
10
+ description: string;
11
+ type: string;
12
+ status: string;
13
+ targetUri: string;
14
+ authReference: string;
15
+ config: any;
16
+ metadata: any;
17
+ }
18
+ export interface CreateIntegrationEndpointRow {
19
+ id: string;
20
+ projectId: string;
21
+ name: string;
22
+ description: string;
23
+ type: string;
24
+ status: string;
25
+ targetUri: string;
26
+ authReference: string;
27
+ config: any;
28
+ metadata: any;
29
+ lastCheckedAt: Date | null;
30
+ lastError: string;
31
+ createdAt: Date;
32
+ updatedAt: Date;
33
+ archivedAt: Date | null;
34
+ }
35
+ export declare function createIntegrationEndpoint(client: Client, args: CreateIntegrationEndpointArgs): Promise<CreateIntegrationEndpointRow | null>;
36
+ export declare const getIntegrationEndpointQuery = "-- name: GetIntegrationEndpoint :one\nSELECT id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at\nFROM weave_v1.integration_endpoint\nWHERE id = $1\n AND project_id = $2";
37
+ export interface GetIntegrationEndpointArgs {
38
+ id: string;
39
+ projectId: string;
40
+ }
41
+ export interface GetIntegrationEndpointRow {
42
+ id: string;
43
+ projectId: string;
44
+ name: string;
45
+ description: string;
46
+ type: string;
47
+ status: string;
48
+ targetUri: string;
49
+ authReference: string;
50
+ config: any;
51
+ metadata: any;
52
+ lastCheckedAt: Date | null;
53
+ lastError: string;
54
+ createdAt: Date;
55
+ updatedAt: Date;
56
+ archivedAt: Date | null;
57
+ }
58
+ export declare function getIntegrationEndpoint(client: Client, args: GetIntegrationEndpointArgs): Promise<GetIntegrationEndpointRow | null>;
59
+ export declare const listIntegrationEndpointsByProjectQuery = "-- name: ListIntegrationEndpointsByProject :many\nSELECT id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at\nFROM weave_v1.integration_endpoint\nWHERE project_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
60
+ export interface ListIntegrationEndpointsByProjectArgs {
61
+ projectId: string;
62
+ includeArchived: boolean;
63
+ pageOffset: string;
64
+ pageSize: string;
65
+ }
66
+ export interface ListIntegrationEndpointsByProjectRow {
67
+ id: string;
68
+ projectId: string;
69
+ name: string;
70
+ description: string;
71
+ type: string;
72
+ status: string;
73
+ targetUri: string;
74
+ authReference: string;
75
+ config: any;
76
+ metadata: any;
77
+ lastCheckedAt: Date | null;
78
+ lastError: string;
79
+ createdAt: Date;
80
+ updatedAt: Date;
81
+ archivedAt: Date | null;
82
+ }
83
+ export declare function listIntegrationEndpointsByProject(client: Client, args: ListIntegrationEndpointsByProjectArgs): Promise<ListIntegrationEndpointsByProjectRow[]>;
84
+ export declare const listIntegrationEndpointsByWorkflowQuery = "-- name: ListIntegrationEndpointsByWorkflow :many\nSELECT e.id, e.project_id, e.name, e.description, e.type, e.status, e.target_uri, e.auth_reference, e.config, e.metadata, e.last_checked_at, e.last_error, e.created_at, e.updated_at, e.archived_at\nFROM weave_v1.integration_endpoint e\n INNER JOIN weave_v1.workflow_integration_endpoint b\n ON b.integration_endpoint_id = e.id\n AND b.project_id = e.project_id\nWHERE b.project_id = $1\n AND b.workflow_id = $2\n AND ($3::BOOLEAN OR e.archived_at IS NULL)\nORDER BY e.updated_at DESC\nLIMIT $5\nOFFSET $4";
85
+ export interface ListIntegrationEndpointsByWorkflowArgs {
86
+ projectId: string;
87
+ workflowId: string;
88
+ includeArchived: boolean;
89
+ pageOffset: string;
90
+ pageSize: string;
91
+ }
92
+ export interface ListIntegrationEndpointsByWorkflowRow {
93
+ id: string;
94
+ projectId: string;
95
+ name: string;
96
+ description: string;
97
+ type: string;
98
+ status: string;
99
+ targetUri: string;
100
+ authReference: string;
101
+ config: any;
102
+ metadata: any;
103
+ lastCheckedAt: Date | null;
104
+ lastError: string;
105
+ createdAt: Date;
106
+ updatedAt: Date;
107
+ archivedAt: Date | null;
108
+ }
109
+ export declare function listIntegrationEndpointsByWorkflow(client: Client, args: ListIntegrationEndpointsByWorkflowArgs): Promise<ListIntegrationEndpointsByWorkflowRow[]>;
110
+ export declare const updateIntegrationEndpointQuery = "-- name: UpdateIntegrationEndpoint :one\nUPDATE weave_v1.integration_endpoint\nSET name = $1,\n description = $2,\n type = $3,\n status = $4,\n target_uri = $5,\n auth_reference = $6,\n config = $7,\n metadata = $8,\n updated_at = NOW()\nWHERE id = $9\n AND project_id = $10\nRETURNING id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at";
111
+ export interface UpdateIntegrationEndpointArgs {
112
+ name: string;
113
+ description: string;
114
+ type: string;
115
+ status: string;
116
+ targetUri: string;
117
+ authReference: string;
118
+ config: any;
119
+ metadata: any;
120
+ id: string;
121
+ projectId: string;
122
+ }
123
+ export interface UpdateIntegrationEndpointRow {
124
+ id: string;
125
+ projectId: string;
126
+ name: string;
127
+ description: string;
128
+ type: string;
129
+ status: string;
130
+ targetUri: string;
131
+ authReference: string;
132
+ config: any;
133
+ metadata: any;
134
+ lastCheckedAt: Date | null;
135
+ lastError: string;
136
+ createdAt: Date;
137
+ updatedAt: Date;
138
+ archivedAt: Date | null;
139
+ }
140
+ export declare function updateIntegrationEndpoint(client: Client, args: UpdateIntegrationEndpointArgs): Promise<UpdateIntegrationEndpointRow | null>;
141
+ export declare const setIntegrationEndpointValidationResultQuery = "-- name: SetIntegrationEndpointValidationResult :one\nUPDATE weave_v1.integration_endpoint\nSET status = $1,\n last_checked_at = $2,\n last_error = $3,\n updated_at = NOW()\nWHERE id = $4\n AND project_id = $5\nRETURNING id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at";
142
+ export interface SetIntegrationEndpointValidationResultArgs {
143
+ status: string;
144
+ lastCheckedAt: Date | null;
145
+ lastError: string;
146
+ id: string;
147
+ projectId: string;
148
+ }
149
+ export interface SetIntegrationEndpointValidationResultRow {
150
+ id: string;
151
+ projectId: string;
152
+ name: string;
153
+ description: string;
154
+ type: string;
155
+ status: string;
156
+ targetUri: string;
157
+ authReference: string;
158
+ config: any;
159
+ metadata: any;
160
+ lastCheckedAt: Date | null;
161
+ lastError: string;
162
+ createdAt: Date;
163
+ updatedAt: Date;
164
+ archivedAt: Date | null;
165
+ }
166
+ export declare function setIntegrationEndpointValidationResult(client: Client, args: SetIntegrationEndpointValidationResultArgs): Promise<SetIntegrationEndpointValidationResultRow | null>;
167
+ export declare const archiveIntegrationEndpointQuery = "-- name: ArchiveIntegrationEndpoint :one\nUPDATE weave_v1.integration_endpoint\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\n AND project_id = $2\nRETURNING id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at";
168
+ export interface ArchiveIntegrationEndpointArgs {
169
+ id: string;
170
+ projectId: string;
171
+ }
172
+ export interface ArchiveIntegrationEndpointRow {
173
+ id: string;
174
+ projectId: string;
175
+ name: string;
176
+ description: string;
177
+ type: string;
178
+ status: string;
179
+ targetUri: string;
180
+ authReference: string;
181
+ config: any;
182
+ metadata: any;
183
+ lastCheckedAt: Date | null;
184
+ lastError: string;
185
+ createdAt: Date;
186
+ updatedAt: Date;
187
+ archivedAt: Date | null;
188
+ }
189
+ export declare function archiveIntegrationEndpoint(client: Client, args: ArchiveIntegrationEndpointArgs): Promise<ArchiveIntegrationEndpointRow | null>;
190
+ export declare const deleteIntegrationEndpointQuery = "-- name: DeleteIntegrationEndpoint :exec\nDELETE\nFROM weave_v1.integration_endpoint\nWHERE id = $1\n AND project_id = $2";
191
+ export interface DeleteIntegrationEndpointArgs {
192
+ id: string;
193
+ projectId: string;
194
+ }
195
+ export declare function deleteIntegrationEndpoint(client: Client, args: DeleteIntegrationEndpointArgs): Promise<void>;
196
+ export declare const attachIntegrationEndpointToWorkflowQuery = "-- name: AttachIntegrationEndpointToWorkflow :one\nINSERT INTO weave_v1.workflow_integration_endpoint (\n project_id,\n workflow_id,\n integration_endpoint_id,\n attached_by,\n metadata\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5\n)\nON CONFLICT (workflow_id, integration_endpoint_id) DO UPDATE\nSET attached_by = EXCLUDED.attached_by,\n metadata = EXCLUDED.metadata,\n attached_at = NOW()\nRETURNING project_id, workflow_id, integration_endpoint_id, attached_by, metadata, attached_at";
197
+ export interface AttachIntegrationEndpointToWorkflowArgs {
198
+ projectId: string;
199
+ workflowId: string;
200
+ integrationEndpointId: string;
201
+ attachedBy: string;
202
+ metadata: any;
203
+ }
204
+ export interface AttachIntegrationEndpointToWorkflowRow {
205
+ projectId: string;
206
+ workflowId: string;
207
+ integrationEndpointId: string;
208
+ attachedBy: string;
209
+ metadata: any;
210
+ attachedAt: Date;
211
+ }
212
+ export declare function attachIntegrationEndpointToWorkflow(client: Client, args: AttachIntegrationEndpointToWorkflowArgs): Promise<AttachIntegrationEndpointToWorkflowRow | null>;
213
+ export declare const detachIntegrationEndpointFromWorkflowQuery = "-- name: DetachIntegrationEndpointFromWorkflow :exec\nDELETE\nFROM weave_v1.workflow_integration_endpoint\nWHERE project_id = $1\n AND workflow_id = $2\n AND integration_endpoint_id = $3";
214
+ export interface DetachIntegrationEndpointFromWorkflowArgs {
215
+ projectId: string;
216
+ workflowId: string;
217
+ integrationEndpointId: string;
218
+ }
219
+ export declare function detachIntegrationEndpointFromWorkflow(client: Client, args: DetachIntegrationEndpointFromWorkflowArgs): Promise<void>;
220
+ export declare const listWorkflowIntegrationEndpointBindingsQuery = "-- name: ListWorkflowIntegrationEndpointBindings :many\nSELECT project_id, workflow_id, integration_endpoint_id, attached_by, metadata, attached_at\nFROM weave_v1.workflow_integration_endpoint\nWHERE project_id = $1\n AND workflow_id = $2\nORDER BY attached_at DESC\nLIMIT $4\nOFFSET $3";
221
+ export interface ListWorkflowIntegrationEndpointBindingsArgs {
222
+ projectId: string;
223
+ workflowId: string;
224
+ pageOffset: string;
225
+ pageSize: string;
226
+ }
227
+ export interface ListWorkflowIntegrationEndpointBindingsRow {
228
+ projectId: string;
229
+ workflowId: string;
230
+ integrationEndpointId: string;
231
+ attachedBy: string;
232
+ metadata: any;
233
+ attachedAt: Date;
234
+ }
235
+ export declare function listWorkflowIntegrationEndpointBindings(client: Client, args: ListWorkflowIntegrationEndpointBindingsArgs): Promise<ListWorkflowIntegrationEndpointBindingsRow[]>;
236
+ export {};
@@ -0,0 +1,377 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listWorkflowIntegrationEndpointBindingsQuery = exports.detachIntegrationEndpointFromWorkflowQuery = exports.attachIntegrationEndpointToWorkflowQuery = exports.deleteIntegrationEndpointQuery = exports.archiveIntegrationEndpointQuery = exports.setIntegrationEndpointValidationResultQuery = exports.updateIntegrationEndpointQuery = exports.listIntegrationEndpointsByWorkflowQuery = exports.listIntegrationEndpointsByProjectQuery = exports.getIntegrationEndpointQuery = exports.createIntegrationEndpointQuery = void 0;
4
+ exports.createIntegrationEndpoint = createIntegrationEndpoint;
5
+ exports.getIntegrationEndpoint = getIntegrationEndpoint;
6
+ exports.listIntegrationEndpointsByProject = listIntegrationEndpointsByProject;
7
+ exports.listIntegrationEndpointsByWorkflow = listIntegrationEndpointsByWorkflow;
8
+ exports.updateIntegrationEndpoint = updateIntegrationEndpoint;
9
+ exports.setIntegrationEndpointValidationResult = setIntegrationEndpointValidationResult;
10
+ exports.archiveIntegrationEndpoint = archiveIntegrationEndpoint;
11
+ exports.deleteIntegrationEndpoint = deleteIntegrationEndpoint;
12
+ exports.attachIntegrationEndpointToWorkflow = attachIntegrationEndpointToWorkflow;
13
+ exports.detachIntegrationEndpointFromWorkflow = detachIntegrationEndpointFromWorkflow;
14
+ exports.listWorkflowIntegrationEndpointBindings = listWorkflowIntegrationEndpointBindings;
15
+ exports.createIntegrationEndpointQuery = `-- name: CreateIntegrationEndpoint :one
16
+ INSERT INTO weave_v1.integration_endpoint (
17
+ id,
18
+ project_id,
19
+ name,
20
+ description,
21
+ type,
22
+ status,
23
+ target_uri,
24
+ auth_reference,
25
+ config,
26
+ metadata
27
+ )
28
+ VALUES (
29
+ $1,
30
+ $2,
31
+ $3,
32
+ $4,
33
+ $5,
34
+ $6,
35
+ $7,
36
+ $8,
37
+ $9,
38
+ $10
39
+ )
40
+ RETURNING id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at`;
41
+ async function createIntegrationEndpoint(client, args) {
42
+ const result = await client.query({
43
+ text: exports.createIntegrationEndpointQuery,
44
+ values: [args.id, args.projectId, args.name, args.description, args.type, args.status, args.targetUri, args.authReference, args.config, args.metadata],
45
+ rowMode: "array"
46
+ });
47
+ if (result.rows.length !== 1) {
48
+ return null;
49
+ }
50
+ const row = result.rows[0];
51
+ return {
52
+ id: row[0],
53
+ projectId: row[1],
54
+ name: row[2],
55
+ description: row[3],
56
+ type: row[4],
57
+ status: row[5],
58
+ targetUri: row[6],
59
+ authReference: row[7],
60
+ config: row[8],
61
+ metadata: row[9],
62
+ lastCheckedAt: row[10],
63
+ lastError: row[11],
64
+ createdAt: row[12],
65
+ updatedAt: row[13],
66
+ archivedAt: row[14]
67
+ };
68
+ }
69
+ exports.getIntegrationEndpointQuery = `-- name: GetIntegrationEndpoint :one
70
+ SELECT id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at
71
+ FROM weave_v1.integration_endpoint
72
+ WHERE id = $1
73
+ AND project_id = $2`;
74
+ async function getIntegrationEndpoint(client, args) {
75
+ const result = await client.query({
76
+ text: exports.getIntegrationEndpointQuery,
77
+ values: [args.id, args.projectId],
78
+ rowMode: "array"
79
+ });
80
+ if (result.rows.length !== 1) {
81
+ return null;
82
+ }
83
+ const row = result.rows[0];
84
+ return {
85
+ id: row[0],
86
+ projectId: row[1],
87
+ name: row[2],
88
+ description: row[3],
89
+ type: row[4],
90
+ status: row[5],
91
+ targetUri: row[6],
92
+ authReference: row[7],
93
+ config: row[8],
94
+ metadata: row[9],
95
+ lastCheckedAt: row[10],
96
+ lastError: row[11],
97
+ createdAt: row[12],
98
+ updatedAt: row[13],
99
+ archivedAt: row[14]
100
+ };
101
+ }
102
+ exports.listIntegrationEndpointsByProjectQuery = `-- name: ListIntegrationEndpointsByProject :many
103
+ SELECT id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at
104
+ FROM weave_v1.integration_endpoint
105
+ WHERE project_id = $1
106
+ AND ($2::BOOLEAN OR archived_at IS NULL)
107
+ ORDER BY updated_at DESC
108
+ LIMIT $4
109
+ OFFSET $3`;
110
+ async function listIntegrationEndpointsByProject(client, args) {
111
+ const result = await client.query({
112
+ text: exports.listIntegrationEndpointsByProjectQuery,
113
+ values: [args.projectId, args.includeArchived, args.pageOffset, args.pageSize],
114
+ rowMode: "array"
115
+ });
116
+ return result.rows.map(row => {
117
+ return {
118
+ id: row[0],
119
+ projectId: row[1],
120
+ name: row[2],
121
+ description: row[3],
122
+ type: row[4],
123
+ status: row[5],
124
+ targetUri: row[6],
125
+ authReference: row[7],
126
+ config: row[8],
127
+ metadata: row[9],
128
+ lastCheckedAt: row[10],
129
+ lastError: row[11],
130
+ createdAt: row[12],
131
+ updatedAt: row[13],
132
+ archivedAt: row[14]
133
+ };
134
+ });
135
+ }
136
+ exports.listIntegrationEndpointsByWorkflowQuery = `-- name: ListIntegrationEndpointsByWorkflow :many
137
+ SELECT e.id, e.project_id, e.name, e.description, e.type, e.status, e.target_uri, e.auth_reference, e.config, e.metadata, e.last_checked_at, e.last_error, e.created_at, e.updated_at, e.archived_at
138
+ FROM weave_v1.integration_endpoint e
139
+ INNER JOIN weave_v1.workflow_integration_endpoint b
140
+ ON b.integration_endpoint_id = e.id
141
+ AND b.project_id = e.project_id
142
+ WHERE b.project_id = $1
143
+ AND b.workflow_id = $2
144
+ AND ($3::BOOLEAN OR e.archived_at IS NULL)
145
+ ORDER BY e.updated_at DESC
146
+ LIMIT $5
147
+ OFFSET $4`;
148
+ async function listIntegrationEndpointsByWorkflow(client, args) {
149
+ const result = await client.query({
150
+ text: exports.listIntegrationEndpointsByWorkflowQuery,
151
+ values: [args.projectId, args.workflowId, args.includeArchived, args.pageOffset, args.pageSize],
152
+ rowMode: "array"
153
+ });
154
+ return result.rows.map(row => {
155
+ return {
156
+ id: row[0],
157
+ projectId: row[1],
158
+ name: row[2],
159
+ description: row[3],
160
+ type: row[4],
161
+ status: row[5],
162
+ targetUri: row[6],
163
+ authReference: row[7],
164
+ config: row[8],
165
+ metadata: row[9],
166
+ lastCheckedAt: row[10],
167
+ lastError: row[11],
168
+ createdAt: row[12],
169
+ updatedAt: row[13],
170
+ archivedAt: row[14]
171
+ };
172
+ });
173
+ }
174
+ exports.updateIntegrationEndpointQuery = `-- name: UpdateIntegrationEndpoint :one
175
+ UPDATE weave_v1.integration_endpoint
176
+ SET name = $1,
177
+ description = $2,
178
+ type = $3,
179
+ status = $4,
180
+ target_uri = $5,
181
+ auth_reference = $6,
182
+ config = $7,
183
+ metadata = $8,
184
+ updated_at = NOW()
185
+ WHERE id = $9
186
+ AND project_id = $10
187
+ RETURNING id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at`;
188
+ async function updateIntegrationEndpoint(client, args) {
189
+ const result = await client.query({
190
+ text: exports.updateIntegrationEndpointQuery,
191
+ values: [args.name, args.description, args.type, args.status, args.targetUri, args.authReference, args.config, args.metadata, args.id, args.projectId],
192
+ rowMode: "array"
193
+ });
194
+ if (result.rows.length !== 1) {
195
+ return null;
196
+ }
197
+ const row = result.rows[0];
198
+ return {
199
+ id: row[0],
200
+ projectId: row[1],
201
+ name: row[2],
202
+ description: row[3],
203
+ type: row[4],
204
+ status: row[5],
205
+ targetUri: row[6],
206
+ authReference: row[7],
207
+ config: row[8],
208
+ metadata: row[9],
209
+ lastCheckedAt: row[10],
210
+ lastError: row[11],
211
+ createdAt: row[12],
212
+ updatedAt: row[13],
213
+ archivedAt: row[14]
214
+ };
215
+ }
216
+ exports.setIntegrationEndpointValidationResultQuery = `-- name: SetIntegrationEndpointValidationResult :one
217
+ UPDATE weave_v1.integration_endpoint
218
+ SET status = $1,
219
+ last_checked_at = $2,
220
+ last_error = $3,
221
+ updated_at = NOW()
222
+ WHERE id = $4
223
+ AND project_id = $5
224
+ RETURNING id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at`;
225
+ async function setIntegrationEndpointValidationResult(client, args) {
226
+ const result = await client.query({
227
+ text: exports.setIntegrationEndpointValidationResultQuery,
228
+ values: [args.status, args.lastCheckedAt, args.lastError, args.id, args.projectId],
229
+ rowMode: "array"
230
+ });
231
+ if (result.rows.length !== 1) {
232
+ return null;
233
+ }
234
+ const row = result.rows[0];
235
+ return {
236
+ id: row[0],
237
+ projectId: row[1],
238
+ name: row[2],
239
+ description: row[3],
240
+ type: row[4],
241
+ status: row[5],
242
+ targetUri: row[6],
243
+ authReference: row[7],
244
+ config: row[8],
245
+ metadata: row[9],
246
+ lastCheckedAt: row[10],
247
+ lastError: row[11],
248
+ createdAt: row[12],
249
+ updatedAt: row[13],
250
+ archivedAt: row[14]
251
+ };
252
+ }
253
+ exports.archiveIntegrationEndpointQuery = `-- name: ArchiveIntegrationEndpoint :one
254
+ UPDATE weave_v1.integration_endpoint
255
+ SET status = 'archived',
256
+ archived_at = NOW(),
257
+ updated_at = NOW()
258
+ WHERE id = $1
259
+ AND project_id = $2
260
+ RETURNING id, project_id, name, description, type, status, target_uri, auth_reference, config, metadata, last_checked_at, last_error, created_at, updated_at, archived_at`;
261
+ async function archiveIntegrationEndpoint(client, args) {
262
+ const result = await client.query({
263
+ text: exports.archiveIntegrationEndpointQuery,
264
+ values: [args.id, args.projectId],
265
+ rowMode: "array"
266
+ });
267
+ if (result.rows.length !== 1) {
268
+ return null;
269
+ }
270
+ const row = result.rows[0];
271
+ return {
272
+ id: row[0],
273
+ projectId: row[1],
274
+ name: row[2],
275
+ description: row[3],
276
+ type: row[4],
277
+ status: row[5],
278
+ targetUri: row[6],
279
+ authReference: row[7],
280
+ config: row[8],
281
+ metadata: row[9],
282
+ lastCheckedAt: row[10],
283
+ lastError: row[11],
284
+ createdAt: row[12],
285
+ updatedAt: row[13],
286
+ archivedAt: row[14]
287
+ };
288
+ }
289
+ exports.deleteIntegrationEndpointQuery = `-- name: DeleteIntegrationEndpoint :exec
290
+ DELETE
291
+ FROM weave_v1.integration_endpoint
292
+ WHERE id = $1
293
+ AND project_id = $2`;
294
+ async function deleteIntegrationEndpoint(client, args) {
295
+ await client.query({
296
+ text: exports.deleteIntegrationEndpointQuery,
297
+ values: [args.id, args.projectId],
298
+ rowMode: "array"
299
+ });
300
+ }
301
+ exports.attachIntegrationEndpointToWorkflowQuery = `-- name: AttachIntegrationEndpointToWorkflow :one
302
+ INSERT INTO weave_v1.workflow_integration_endpoint (
303
+ project_id,
304
+ workflow_id,
305
+ integration_endpoint_id,
306
+ attached_by,
307
+ metadata
308
+ )
309
+ VALUES (
310
+ $1,
311
+ $2,
312
+ $3,
313
+ $4,
314
+ $5
315
+ )
316
+ ON CONFLICT (workflow_id, integration_endpoint_id) DO UPDATE
317
+ SET attached_by = EXCLUDED.attached_by,
318
+ metadata = EXCLUDED.metadata,
319
+ attached_at = NOW()
320
+ RETURNING project_id, workflow_id, integration_endpoint_id, attached_by, metadata, attached_at`;
321
+ async function attachIntegrationEndpointToWorkflow(client, args) {
322
+ const result = await client.query({
323
+ text: exports.attachIntegrationEndpointToWorkflowQuery,
324
+ values: [args.projectId, args.workflowId, args.integrationEndpointId, args.attachedBy, args.metadata],
325
+ rowMode: "array"
326
+ });
327
+ if (result.rows.length !== 1) {
328
+ return null;
329
+ }
330
+ const row = result.rows[0];
331
+ return {
332
+ projectId: row[0],
333
+ workflowId: row[1],
334
+ integrationEndpointId: row[2],
335
+ attachedBy: row[3],
336
+ metadata: row[4],
337
+ attachedAt: row[5]
338
+ };
339
+ }
340
+ exports.detachIntegrationEndpointFromWorkflowQuery = `-- name: DetachIntegrationEndpointFromWorkflow :exec
341
+ DELETE
342
+ FROM weave_v1.workflow_integration_endpoint
343
+ WHERE project_id = $1
344
+ AND workflow_id = $2
345
+ AND integration_endpoint_id = $3`;
346
+ async function detachIntegrationEndpointFromWorkflow(client, args) {
347
+ await client.query({
348
+ text: exports.detachIntegrationEndpointFromWorkflowQuery,
349
+ values: [args.projectId, args.workflowId, args.integrationEndpointId],
350
+ rowMode: "array"
351
+ });
352
+ }
353
+ exports.listWorkflowIntegrationEndpointBindingsQuery = `-- name: ListWorkflowIntegrationEndpointBindings :many
354
+ SELECT project_id, workflow_id, integration_endpoint_id, attached_by, metadata, attached_at
355
+ FROM weave_v1.workflow_integration_endpoint
356
+ WHERE project_id = $1
357
+ AND workflow_id = $2
358
+ ORDER BY attached_at DESC
359
+ LIMIT $4
360
+ OFFSET $3`;
361
+ async function listWorkflowIntegrationEndpointBindings(client, args) {
362
+ const result = await client.query({
363
+ text: exports.listWorkflowIntegrationEndpointBindingsQuery,
364
+ values: [args.projectId, args.workflowId, args.pageOffset, args.pageSize],
365
+ rowMode: "array"
366
+ });
367
+ return result.rows.map(row => {
368
+ return {
369
+ projectId: row[0],
370
+ workflowId: row[1],
371
+ integrationEndpointId: row[2],
372
+ attachedBy: row[3],
373
+ metadata: row[4],
374
+ attachedAt: row[5]
375
+ };
376
+ });
377
+ }