weave-typescript 0.14.0 → 0.16.0

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 (29) hide show
  1. package/dist/weaveapi/atc/v1/service.pb.d.ts +24 -0
  2. package/dist/weaveapi/atc/v1/service.pb.js +163 -1
  3. package/dist/weaveapi/project/v1/project.pb.d.ts +2 -0
  4. package/dist/weaveapi/project/v1/project.pb.js +27 -1
  5. package/dist/weaveapi/provider/v1/provider.pb.d.ts +123 -0
  6. package/dist/weaveapi/provider/v1/provider.pb.js +914 -0
  7. package/dist/weaveapi/provider/v1/service.pb.d.ts +198 -0
  8. package/dist/weaveapi/provider/v1/service.pb.js +1569 -0
  9. package/dist/weaveapi/task/v1/service.pb.d.ts +1 -0
  10. package/dist/weaveapi/task/v1/service.pb.js +21 -1
  11. package/dist/weaveapi/task/v1/task.pb.d.ts +1 -0
  12. package/dist/weaveapi/task/v1/task.pb.js +21 -1
  13. package/dist/weavesql/atcdb/event_sql.d.ts +68 -0
  14. package/dist/weavesql/atcdb/event_sql.js +143 -1
  15. package/dist/weavesql/atcdb/run_template_sql.d.ts +122 -0
  16. package/dist/weavesql/atcdb/run_template_sql.js +197 -0
  17. package/dist/weavesql/atcdb/snapshot_sql.d.ts +58 -0
  18. package/dist/weavesql/atcdb/snapshot_sql.js +124 -0
  19. package/dist/weavesql/atcdb/team_sql.d.ts +111 -0
  20. package/dist/weavesql/atcdb/team_sql.js +235 -0
  21. package/dist/weavesql/atcdb/workflow_template_sql.d.ts +122 -0
  22. package/dist/weavesql/atcdb/workflow_template_sql.js +197 -0
  23. package/dist/weavesql/weavedb/project_sql.d.ts +53 -5
  24. package/dist/weavesql/weavedb/project_sql.js +114 -11
  25. package/dist/weavesql/weavedb/provider_sql.d.ts +162 -0
  26. package/dist/weavesql/weavedb/provider_sql.js +358 -0
  27. package/dist/weavesql/weavedb/task_sql.d.ts +51 -4
  28. package/dist/weavesql/weavedb/task_sql.js +115 -13
  29. package/package.json +2 -2
@@ -49,6 +49,7 @@ export interface UpdateTaskRequest {
49
49
  [key: string]: any;
50
50
  } | undefined;
51
51
  completedAt: string;
52
+ completionApproved: boolean;
52
53
  }
53
54
  export interface UpdateTaskResponse {
54
55
  task: Task | undefined;
@@ -546,6 +546,7 @@ function createBaseUpdateTaskRequest() {
546
546
  sourceId: "",
547
547
  sourceMetadata: undefined,
548
548
  completedAt: "",
549
+ completionApproved: false,
549
550
  };
550
551
  }
551
552
  exports.UpdateTaskRequest = {
@@ -595,6 +596,9 @@ exports.UpdateTaskRequest = {
595
596
  if (message.completedAt !== "") {
596
597
  writer.uint32(122).string(message.completedAt);
597
598
  }
599
+ if (message.completionApproved !== false) {
600
+ writer.uint32(128).bool(message.completionApproved);
601
+ }
598
602
  return writer;
599
603
  },
600
604
  decode(input, length) {
@@ -709,6 +713,13 @@ exports.UpdateTaskRequest = {
709
713
  message.completedAt = reader.string();
710
714
  continue;
711
715
  }
716
+ case 16: {
717
+ if (tag !== 128) {
718
+ break;
719
+ }
720
+ message.completionApproved = reader.bool();
721
+ continue;
722
+ }
712
723
  }
713
724
  if ((tag & 7) === 4 || tag === 0) {
714
725
  break;
@@ -778,6 +789,11 @@ exports.UpdateTaskRequest = {
778
789
  : isSet(object.completed_at)
779
790
  ? globalThis.String(object.completed_at)
780
791
  : "",
792
+ completionApproved: isSet(object.completionApproved)
793
+ ? globalThis.Boolean(object.completionApproved)
794
+ : isSet(object.completion_approved)
795
+ ? globalThis.Boolean(object.completion_approved)
796
+ : false,
781
797
  };
782
798
  },
783
799
  toJSON(message) {
@@ -827,13 +843,16 @@ exports.UpdateTaskRequest = {
827
843
  if (message.completedAt !== "") {
828
844
  obj.completedAt = message.completedAt;
829
845
  }
846
+ if (message.completionApproved !== false) {
847
+ obj.completionApproved = message.completionApproved;
848
+ }
830
849
  return obj;
831
850
  },
832
851
  create(base) {
833
852
  return exports.UpdateTaskRequest.fromPartial(base !== null && base !== void 0 ? base : {});
834
853
  },
835
854
  fromPartial(object) {
836
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
855
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
837
856
  const message = createBaseUpdateTaskRequest();
838
857
  message.organizationId = (_a = object.organizationId) !== null && _a !== void 0 ? _a : "";
839
858
  message.projectSlug = (_b = object.projectSlug) !== null && _b !== void 0 ? _b : "";
@@ -850,6 +869,7 @@ exports.UpdateTaskRequest = {
850
869
  message.sourceId = (_o = object.sourceId) !== null && _o !== void 0 ? _o : "";
851
870
  message.sourceMetadata = (_p = object.sourceMetadata) !== null && _p !== void 0 ? _p : undefined;
852
871
  message.completedAt = (_q = object.completedAt) !== null && _q !== void 0 ? _q : "";
872
+ message.completionApproved = (_r = object.completionApproved) !== null && _r !== void 0 ? _r : false;
853
873
  return message;
854
874
  },
855
875
  };
@@ -45,6 +45,7 @@ export interface Task {
45
45
  createdAt: Date | undefined;
46
46
  updatedAt: Date | undefined;
47
47
  completedAt: Date | undefined;
48
+ completionApproved: boolean;
48
49
  }
49
50
  /** TaskActivityEntry is an immutable activity record for a task. */
50
51
  export interface TaskActivityEntry {
@@ -131,6 +131,7 @@ function createBaseTask() {
131
131
  createdAt: undefined,
132
132
  updatedAt: undefined,
133
133
  completedAt: undefined,
134
+ completionApproved: false,
134
135
  };
135
136
  }
136
137
  exports.Task = {
@@ -195,6 +196,9 @@ exports.Task = {
195
196
  if (message.completedAt !== undefined) {
196
197
  timestamp_pb_1.Timestamp.encode(toTimestamp(message.completedAt), writer.uint32(162).fork()).join();
197
198
  }
199
+ if (message.completionApproved !== false) {
200
+ writer.uint32(168).bool(message.completionApproved);
201
+ }
198
202
  return writer;
199
203
  },
200
204
  decode(input, length) {
@@ -344,6 +348,13 @@ exports.Task = {
344
348
  message.completedAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
345
349
  continue;
346
350
  }
351
+ case 21: {
352
+ if (tag !== 168) {
353
+ break;
354
+ }
355
+ message.completionApproved = reader.bool();
356
+ continue;
357
+ }
347
358
  }
348
359
  if ((tag & 7) === 4 || tag === 0) {
349
360
  break;
@@ -430,6 +441,11 @@ exports.Task = {
430
441
  : isSet(object.completed_at)
431
442
  ? fromJsonTimestamp(object.completed_at)
432
443
  : undefined,
444
+ completionApproved: isSet(object.completionApproved)
445
+ ? globalThis.Boolean(object.completionApproved)
446
+ : isSet(object.completion_approved)
447
+ ? globalThis.Boolean(object.completion_approved)
448
+ : false,
433
449
  };
434
450
  },
435
451
  toJSON(message) {
@@ -494,13 +510,16 @@ exports.Task = {
494
510
  if (message.completedAt !== undefined) {
495
511
  obj.completedAt = message.completedAt.toISOString();
496
512
  }
513
+ if (message.completionApproved !== false) {
514
+ obj.completionApproved = message.completionApproved;
515
+ }
497
516
  return obj;
498
517
  },
499
518
  create(base) {
500
519
  return exports.Task.fromPartial(base !== null && base !== void 0 ? base : {});
501
520
  },
502
521
  fromPartial(object) {
503
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
522
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
504
523
  const message = createBaseTask();
505
524
  message.id = (_a = object.id) !== null && _a !== void 0 ? _a : "";
506
525
  message.organizationId = (_b = object.organizationId) !== null && _b !== void 0 ? _b : "";
@@ -522,6 +541,7 @@ exports.Task = {
522
541
  message.createdAt = (_t = object.createdAt) !== null && _t !== void 0 ? _t : undefined;
523
542
  message.updatedAt = (_u = object.updatedAt) !== null && _u !== void 0 ? _u : undefined;
524
543
  message.completedAt = (_v = object.completedAt) !== null && _v !== void 0 ? _v : undefined;
544
+ message.completionApproved = (_w = object.completionApproved) !== null && _w !== void 0 ? _w : false;
525
545
  return message;
526
546
  },
527
547
  };
@@ -98,4 +98,72 @@ export interface LockRunRow {
98
98
  pgAdvisoryXactLock: string;
99
99
  }
100
100
  export declare function lockRun(client: Client, args: LockRunArgs): Promise<void>;
101
+ export declare const queryEventsByTypeQuery = "-- name: QueryEventsByType :many\nSELECT\n id,\n tenant_id,\n run_id,\n sequence,\n type,\n data,\n causation_id,\n correlation_id,\n occurred_at\nFROM atc.events\nWHERE tenant_id = $1\n AND type = $2\n AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())\n AND (\n $3::timestamptz IS NULL\n OR (occurred_at, sequence) < ($3::timestamptz, $4::bigint)\n )\nORDER BY occurred_at DESC, sequence DESC\nLIMIT $5";
102
+ export interface QueryEventsByTypeArgs {
103
+ tenantId: string;
104
+ eventType: string;
105
+ afterOccurredAt: Date;
106
+ afterSequence: string;
107
+ pageSize: string;
108
+ }
109
+ export interface QueryEventsByTypeRow {
110
+ id: string;
111
+ tenantId: string;
112
+ runId: string;
113
+ sequence: string;
114
+ type: string;
115
+ data: any | null;
116
+ causationId: string | null;
117
+ correlationId: string | null;
118
+ occurredAt: Date;
119
+ }
120
+ export declare function queryEventsByType(client: Client, args: QueryEventsByTypeArgs): Promise<QueryEventsByTypeRow[]>;
121
+ export declare const queryEventsByTimeRangeQuery = "-- name: QueryEventsByTimeRange :many\nSELECT\n id,\n tenant_id,\n run_id,\n sequence,\n type,\n data,\n causation_id,\n correlation_id,\n occurred_at\nFROM atc.events\nWHERE tenant_id = $1\n AND occurred_at >= $2\n AND occurred_at < $3\n AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())\nORDER BY occurred_at ASC, sequence ASC\nLIMIT $4";
122
+ export interface QueryEventsByTimeRangeArgs {
123
+ tenantId: string;
124
+ startTime: Date;
125
+ endTime: Date;
126
+ pageSize: string;
127
+ }
128
+ export interface QueryEventsByTimeRangeRow {
129
+ id: string;
130
+ tenantId: string;
131
+ runId: string;
132
+ sequence: string;
133
+ type: string;
134
+ data: any | null;
135
+ causationId: string | null;
136
+ correlationId: string | null;
137
+ occurredAt: Date;
138
+ }
139
+ export declare function queryEventsByTimeRange(client: Client, args: QueryEventsByTimeRangeArgs): Promise<QueryEventsByTimeRangeRow[]>;
140
+ export declare const queryEventsByRunAndTypesQuery = "-- name: QueryEventsByRunAndTypes :many\nSELECT\n id,\n tenant_id,\n run_id,\n sequence,\n type,\n data,\n causation_id,\n correlation_id,\n occurred_at\nFROM atc.events\nWHERE tenant_id = $1\n AND run_id = $2\n AND type = ANY($3::text[])\n AND sequence > $4\n AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())\nORDER BY sequence ASC\nLIMIT $5";
141
+ export interface QueryEventsByRunAndTypesArgs {
142
+ tenantId: string;
143
+ runId: string;
144
+ eventTypes: string[];
145
+ afterSequence: string;
146
+ pageSize: string;
147
+ }
148
+ export interface QueryEventsByRunAndTypesRow {
149
+ id: string;
150
+ tenantId: string;
151
+ runId: string;
152
+ sequence: string;
153
+ type: string;
154
+ data: any | null;
155
+ causationId: string | null;
156
+ correlationId: string | null;
157
+ occurredAt: Date;
158
+ }
159
+ export declare function queryEventsByRunAndTypes(client: Client, args: QueryEventsByRunAndTypesArgs): Promise<QueryEventsByRunAndTypesRow[]>;
160
+ export declare const countEventsByTypeQuery = "-- name: CountEventsByType :one\nSELECT COUNT(*)::BIGINT AS total\nFROM atc.events\nWHERE tenant_id = $1\n AND type = $2\n AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())";
161
+ export interface CountEventsByTypeArgs {
162
+ tenantId: string;
163
+ eventType: string;
164
+ }
165
+ export interface CountEventsByTypeRow {
166
+ total: string;
167
+ }
168
+ export declare function countEventsByType(client: Client, args: CountEventsByTypeArgs): Promise<CountEventsByTypeRow | null>;
101
169
  export {};
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.lockRunQuery = exports.listEventsByTypeQuery = exports.loadAllEventsQuery = exports.loadEventsQuery = exports.getCurrentVersionQuery = exports.insertEventQuery = void 0;
3
+ exports.countEventsByTypeQuery = exports.queryEventsByRunAndTypesQuery = exports.queryEventsByTimeRangeQuery = exports.queryEventsByTypeQuery = exports.lockRunQuery = exports.listEventsByTypeQuery = exports.loadAllEventsQuery = exports.loadEventsQuery = exports.getCurrentVersionQuery = exports.insertEventQuery = void 0;
4
4
  exports.insertEvent = insertEvent;
5
5
  exports.getCurrentVersion = getCurrentVersion;
6
6
  exports.loadEvents = loadEvents;
7
7
  exports.loadAllEvents = loadAllEvents;
8
8
  exports.listEventsByType = listEventsByType;
9
9
  exports.lockRun = lockRun;
10
+ exports.queryEventsByType = queryEventsByType;
11
+ exports.queryEventsByTimeRange = queryEventsByTimeRange;
12
+ exports.queryEventsByRunAndTypes = queryEventsByRunAndTypes;
13
+ exports.countEventsByType = countEventsByType;
10
14
  exports.insertEventQuery = `-- name: InsertEvent :one
11
15
  INSERT INTO atc.events (
12
16
  id,
@@ -189,3 +193,141 @@ async function lockRun(client, args) {
189
193
  rowMode: "array"
190
194
  });
191
195
  }
196
+ exports.queryEventsByTypeQuery = `-- name: QueryEventsByType :many
197
+ SELECT
198
+ id,
199
+ tenant_id,
200
+ run_id,
201
+ sequence,
202
+ type,
203
+ data,
204
+ causation_id,
205
+ correlation_id,
206
+ occurred_at
207
+ FROM atc.events
208
+ WHERE tenant_id = $1
209
+ AND type = $2
210
+ AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())
211
+ AND (
212
+ $3::timestamptz IS NULL
213
+ OR (occurred_at, sequence) < ($3::timestamptz, $4::bigint)
214
+ )
215
+ ORDER BY occurred_at DESC, sequence DESC
216
+ LIMIT $5`;
217
+ async function queryEventsByType(client, args) {
218
+ const result = await client.query({
219
+ text: exports.queryEventsByTypeQuery,
220
+ values: [args.tenantId, args.eventType, args.afterOccurredAt, args.afterSequence, args.pageSize],
221
+ rowMode: "array"
222
+ });
223
+ return result.rows.map(row => {
224
+ return {
225
+ id: row[0],
226
+ tenantId: row[1],
227
+ runId: row[2],
228
+ sequence: row[3],
229
+ type: row[4],
230
+ data: row[5],
231
+ causationId: row[6],
232
+ correlationId: row[7],
233
+ occurredAt: row[8]
234
+ };
235
+ });
236
+ }
237
+ exports.queryEventsByTimeRangeQuery = `-- name: QueryEventsByTimeRange :many
238
+ SELECT
239
+ id,
240
+ tenant_id,
241
+ run_id,
242
+ sequence,
243
+ type,
244
+ data,
245
+ causation_id,
246
+ correlation_id,
247
+ occurred_at
248
+ FROM atc.events
249
+ WHERE tenant_id = $1
250
+ AND occurred_at >= $2
251
+ AND occurred_at < $3
252
+ AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())
253
+ ORDER BY occurred_at ASC, sequence ASC
254
+ LIMIT $4`;
255
+ async function queryEventsByTimeRange(client, args) {
256
+ const result = await client.query({
257
+ text: exports.queryEventsByTimeRangeQuery,
258
+ values: [args.tenantId, args.startTime, args.endTime, args.pageSize],
259
+ rowMode: "array"
260
+ });
261
+ return result.rows.map(row => {
262
+ return {
263
+ id: row[0],
264
+ tenantId: row[1],
265
+ runId: row[2],
266
+ sequence: row[3],
267
+ type: row[4],
268
+ data: row[5],
269
+ causationId: row[6],
270
+ correlationId: row[7],
271
+ occurredAt: row[8]
272
+ };
273
+ });
274
+ }
275
+ exports.queryEventsByRunAndTypesQuery = `-- name: QueryEventsByRunAndTypes :many
276
+ SELECT
277
+ id,
278
+ tenant_id,
279
+ run_id,
280
+ sequence,
281
+ type,
282
+ data,
283
+ causation_id,
284
+ correlation_id,
285
+ occurred_at
286
+ FROM atc.events
287
+ WHERE tenant_id = $1
288
+ AND run_id = $2
289
+ AND type = ANY($3::text[])
290
+ AND sequence > $4
291
+ AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())
292
+ ORDER BY sequence ASC
293
+ LIMIT $5`;
294
+ async function queryEventsByRunAndTypes(client, args) {
295
+ const result = await client.query({
296
+ text: exports.queryEventsByRunAndTypesQuery,
297
+ values: [args.tenantId, args.runId, args.eventTypes, args.afterSequence, args.pageSize],
298
+ rowMode: "array"
299
+ });
300
+ return result.rows.map(row => {
301
+ return {
302
+ id: row[0],
303
+ tenantId: row[1],
304
+ runId: row[2],
305
+ sequence: row[3],
306
+ type: row[4],
307
+ data: row[5],
308
+ causationId: row[6],
309
+ correlationId: row[7],
310
+ occurredAt: row[8]
311
+ };
312
+ });
313
+ }
314
+ exports.countEventsByTypeQuery = `-- name: CountEventsByType :one
315
+ SELECT COUNT(*)::BIGINT AS total
316
+ FROM atc.events
317
+ WHERE tenant_id = $1
318
+ AND type = $2
319
+ AND transaction_id < pg_snapshot_xmin(pg_current_snapshot())`;
320
+ async function countEventsByType(client, args) {
321
+ const result = await client.query({
322
+ text: exports.countEventsByTypeQuery,
323
+ values: [args.tenantId, args.eventType],
324
+ rowMode: "array"
325
+ });
326
+ if (result.rows.length !== 1) {
327
+ return null;
328
+ }
329
+ const row = result.rows[0];
330
+ return {
331
+ total: row[0]
332
+ };
333
+ }
@@ -0,0 +1,122 @@
1
+ import { QueryArrayConfig, QueryArrayResult } from "pg";
2
+ interface Client {
3
+ query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
4
+ }
5
+ export declare const insertRunTemplateQuery = "-- name: InsertRunTemplate :one\nINSERT INTO atc.run_templates (\n id,\n tenant_id,\n name,\n version,\n handler_type,\n config,\n security_context,\n budget_context,\n pinned_caller,\n created_by\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10\n)\nRETURNING id, tenant_id, name, version, handler_type, config, security_context, budget_context, pinned_caller, created_by, created_at, updated_at";
6
+ export interface InsertRunTemplateArgs {
7
+ id: string;
8
+ tenantId: string;
9
+ name: string;
10
+ version: number;
11
+ handlerType: string;
12
+ config: any;
13
+ securityContext: any | null;
14
+ budgetContext: any | null;
15
+ pinnedCaller: any | null;
16
+ createdBy: string;
17
+ }
18
+ export interface InsertRunTemplateRow {
19
+ id: string;
20
+ tenantId: string;
21
+ name: string;
22
+ version: number;
23
+ handlerType: string;
24
+ config: any;
25
+ securityContext: any | null;
26
+ budgetContext: any | null;
27
+ pinnedCaller: any | null;
28
+ createdBy: string;
29
+ createdAt: Date;
30
+ updatedAt: Date;
31
+ }
32
+ export declare function insertRunTemplate(client: Client, args: InsertRunTemplateArgs): Promise<InsertRunTemplateRow | null>;
33
+ export declare const getRunTemplateQuery = "-- name: GetRunTemplate :one\nSELECT id, tenant_id, name, version, handler_type, config, security_context, budget_context, pinned_caller, created_by, created_at, updated_at\nFROM atc.run_templates\nWHERE tenant_id = $1\n AND id = $2";
34
+ export interface GetRunTemplateArgs {
35
+ tenantId: string;
36
+ id: string;
37
+ }
38
+ export interface GetRunTemplateRow {
39
+ id: string;
40
+ tenantId: string;
41
+ name: string;
42
+ version: number;
43
+ handlerType: string;
44
+ config: any;
45
+ securityContext: any | null;
46
+ budgetContext: any | null;
47
+ pinnedCaller: any | null;
48
+ createdBy: string;
49
+ createdAt: Date;
50
+ updatedAt: Date;
51
+ }
52
+ export declare function getRunTemplate(client: Client, args: GetRunTemplateArgs): Promise<GetRunTemplateRow | null>;
53
+ export declare const getRunTemplateByNameQuery = "-- name: GetRunTemplateByName :one\nSELECT id, tenant_id, name, version, handler_type, config, security_context, budget_context, pinned_caller, created_by, created_at, updated_at\nFROM atc.run_templates\nWHERE tenant_id = $1\n AND name = $2\nORDER BY version DESC\nLIMIT 1";
54
+ export interface GetRunTemplateByNameArgs {
55
+ tenantId: string;
56
+ name: string;
57
+ }
58
+ export interface GetRunTemplateByNameRow {
59
+ id: string;
60
+ tenantId: string;
61
+ name: string;
62
+ version: number;
63
+ handlerType: string;
64
+ config: any;
65
+ securityContext: any | null;
66
+ budgetContext: any | null;
67
+ pinnedCaller: any | null;
68
+ createdBy: string;
69
+ createdAt: Date;
70
+ updatedAt: Date;
71
+ }
72
+ export declare function getRunTemplateByName(client: Client, args: GetRunTemplateByNameArgs): Promise<GetRunTemplateByNameRow | null>;
73
+ export declare const listRunTemplatesQuery = "-- name: ListRunTemplates :many\nSELECT id, tenant_id, name, version, handler_type, config, security_context, budget_context, pinned_caller, created_by, created_at, updated_at\nFROM atc.run_templates\nWHERE tenant_id = $1\nORDER BY name ASC, version DESC";
74
+ export interface ListRunTemplatesArgs {
75
+ tenantId: string;
76
+ }
77
+ export interface ListRunTemplatesRow {
78
+ id: string;
79
+ tenantId: string;
80
+ name: string;
81
+ version: number;
82
+ handlerType: string;
83
+ config: any;
84
+ securityContext: any | null;
85
+ budgetContext: any | null;
86
+ pinnedCaller: any | null;
87
+ createdBy: string;
88
+ createdAt: Date;
89
+ updatedAt: Date;
90
+ }
91
+ export declare function listRunTemplates(client: Client, args: ListRunTemplatesArgs): Promise<ListRunTemplatesRow[]>;
92
+ export declare const updateRunTemplateQuery = "-- name: UpdateRunTemplate :one\nUPDATE atc.run_templates\nSET\n config = $1,\n security_context = $2,\n budget_context = $3,\n pinned_caller = $4,\n version = version + 1,\n updated_at = now()\nWHERE tenant_id = $5\n AND id = $6\nRETURNING id, tenant_id, name, version, handler_type, config, security_context, budget_context, pinned_caller, created_by, created_at, updated_at";
93
+ export interface UpdateRunTemplateArgs {
94
+ config: any;
95
+ securityContext: any | null;
96
+ budgetContext: any | null;
97
+ pinnedCaller: any | null;
98
+ tenantId: string;
99
+ id: string;
100
+ }
101
+ export interface UpdateRunTemplateRow {
102
+ id: string;
103
+ tenantId: string;
104
+ name: string;
105
+ version: number;
106
+ handlerType: string;
107
+ config: any;
108
+ securityContext: any | null;
109
+ budgetContext: any | null;
110
+ pinnedCaller: any | null;
111
+ createdBy: string;
112
+ createdAt: Date;
113
+ updatedAt: Date;
114
+ }
115
+ export declare function updateRunTemplate(client: Client, args: UpdateRunTemplateArgs): Promise<UpdateRunTemplateRow | null>;
116
+ export declare const deleteRunTemplateQuery = "-- name: DeleteRunTemplate :exec\nDELETE FROM atc.run_templates\nWHERE tenant_id = $1\n AND id = $2";
117
+ export interface DeleteRunTemplateArgs {
118
+ tenantId: string;
119
+ id: string;
120
+ }
121
+ export declare function deleteRunTemplate(client: Client, args: DeleteRunTemplateArgs): Promise<void>;
122
+ export {};