weave-typescript 0.42.8 → 0.44.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.
@@ -2,166 +2,647 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
2
2
  interface Client {
3
3
  query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
4
4
  }
5
- export declare const createWorkflowQuery = "-- name: CreateWorkflow :one\nINSERT INTO weave_v1.workflow (\n id,\n project_id,\n name,\n slug,\n description,\n status\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6\n)\nRETURNING id, project_id, name, slug, description, status, created_at, updated_at, archived_at";
6
- export interface CreateWorkflowArgs {
5
+ export declare const createWorkflowTemplateQuery = "-- name: CreateWorkflowTemplate :one\nINSERT INTO weave.workflow_templates (\n id,\n organization_id,\n slug,\n name,\n description,\n status,\n created_by_user_id\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7\n)\nRETURNING id, organization_id, slug, name, description, status, created_by_user_id, draft_revision, latest_version_id, latest_version, created_at, updated_at";
6
+ export interface CreateWorkflowTemplateArgs {
7
7
  id: string;
8
- projectId: string;
9
- name: string;
8
+ organizationId: string;
10
9
  slug: string;
10
+ name: string;
11
11
  description: string;
12
12
  status: string;
13
+ createdByUserId: string;
13
14
  }
14
- export interface CreateWorkflowRow {
15
+ export interface CreateWorkflowTemplateRow {
15
16
  id: string;
16
- projectId: string;
17
- name: string;
17
+ organizationId: string;
18
18
  slug: string;
19
+ name: string;
19
20
  description: string;
20
21
  status: string;
22
+ createdByUserId: string;
23
+ draftRevision: number;
24
+ latestVersionId: string | null;
25
+ latestVersion: number;
21
26
  createdAt: Date;
22
27
  updatedAt: Date;
23
- archivedAt: Date | null;
24
28
  }
25
- export declare function createWorkflow(client: Client, args: CreateWorkflowArgs): Promise<CreateWorkflowRow | null>;
26
- export declare const getWorkflowQuery = "-- name: GetWorkflow :one\nSELECT id, project_id, name, slug, description, status, created_at, updated_at, archived_at\nFROM weave_v1.workflow\nWHERE id = $1\n AND project_id = $2";
27
- export interface GetWorkflowArgs {
29
+ export declare function createWorkflowTemplate(client: Client, args: CreateWorkflowTemplateArgs): Promise<CreateWorkflowTemplateRow | null>;
30
+ export declare const createWorkflowTemplateDraftQuery = "-- name: CreateWorkflowTemplateDraft :one\nINSERT INTO weave.workflow_template_drafts (\n id,\n template_id,\n organization_id,\n base_version_id,\n revision,\n name,\n description,\n definition,\n input_schema,\n output_schema,\n metadata,\n updated_by_user_id\n) VALUES (\n $1,\n $2,\n $3,\n $4::uuid,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12\n)\nRETURNING id, template_id, organization_id, base_version_id, revision, name, description, definition, input_schema, output_schema, metadata, updated_by_user_id, created_at, updated_at";
31
+ export interface CreateWorkflowTemplateDraftArgs {
28
32
  id: string;
29
- projectId: string;
33
+ templateId: string;
34
+ organizationId: string;
35
+ baseVersionId: string | null;
36
+ revision: number;
37
+ name: string;
38
+ description: string;
39
+ definition: any;
40
+ inputSchema: any;
41
+ outputSchema: any;
42
+ metadata: any;
43
+ updatedByUserId: string;
30
44
  }
31
- export interface GetWorkflowRow {
45
+ export interface CreateWorkflowTemplateDraftRow {
32
46
  id: string;
33
- projectId: string;
47
+ templateId: string;
48
+ organizationId: string;
49
+ baseVersionId: string | null;
50
+ revision: number;
34
51
  name: string;
52
+ description: string;
53
+ definition: any;
54
+ inputSchema: any;
55
+ outputSchema: any;
56
+ metadata: any;
57
+ updatedByUserId: string;
58
+ createdAt: Date;
59
+ updatedAt: Date;
60
+ }
61
+ export declare function createWorkflowTemplateDraft(client: Client, args: CreateWorkflowTemplateDraftArgs): Promise<CreateWorkflowTemplateDraftRow | null>;
62
+ export declare const getWorkflowTemplateByIDQuery = "-- name: GetWorkflowTemplateByID :one\nSELECT id, organization_id, slug, name, description, status, created_by_user_id, draft_revision, latest_version_id, latest_version, created_at, updated_at FROM weave.workflow_templates\nWHERE organization_id = $1\n AND id = $2";
63
+ export interface GetWorkflowTemplateByIDArgs {
64
+ organizationId: string;
65
+ templateId: string;
66
+ }
67
+ export interface GetWorkflowTemplateByIDRow {
68
+ id: string;
69
+ organizationId: string;
35
70
  slug: string;
71
+ name: string;
36
72
  description: string;
37
73
  status: string;
74
+ createdByUserId: string;
75
+ draftRevision: number;
76
+ latestVersionId: string | null;
77
+ latestVersion: number;
38
78
  createdAt: Date;
39
79
  updatedAt: Date;
40
- archivedAt: Date | null;
41
80
  }
42
- export declare function getWorkflow(client: Client, args: GetWorkflowArgs): Promise<GetWorkflowRow | null>;
43
- export declare const getWorkflowBySlugQuery = "-- name: GetWorkflowBySlug :one\nSELECT w.id, w.project_id, w.name, w.slug, w.description, w.status, w.created_at, w.updated_at, w.archived_at\nFROM weave_v1.workflow w\n INNER JOIN weave_v1.project p ON p.id = w.project_id\nWHERE p.organization_id = $1\n AND p.slug = $2\n AND w.slug = $3";
44
- export interface GetWorkflowBySlugArgs {
81
+ export declare function getWorkflowTemplateByID(client: Client, args: GetWorkflowTemplateByIDArgs): Promise<GetWorkflowTemplateByIDRow | null>;
82
+ export declare const getWorkflowTemplateBySlugQuery = "-- name: GetWorkflowTemplateBySlug :one\nSELECT id, organization_id, slug, name, description, status, created_by_user_id, draft_revision, latest_version_id, latest_version, created_at, updated_at FROM weave.workflow_templates\nWHERE organization_id = $1\n AND slug = $2";
83
+ export interface GetWorkflowTemplateBySlugArgs {
45
84
  organizationId: string;
46
- projectSlug: string;
47
85
  slug: string;
48
86
  }
49
- export interface GetWorkflowBySlugRow {
87
+ export interface GetWorkflowTemplateBySlugRow {
50
88
  id: string;
51
- projectId: string;
52
- name: string;
89
+ organizationId: string;
53
90
  slug: string;
91
+ name: string;
54
92
  description: string;
55
93
  status: string;
94
+ createdByUserId: string;
95
+ draftRevision: number;
96
+ latestVersionId: string | null;
97
+ latestVersion: number;
56
98
  createdAt: Date;
57
99
  updatedAt: Date;
58
- archivedAt: Date | null;
59
100
  }
60
- export declare function getWorkflowBySlug(client: Client, args: GetWorkflowBySlugArgs): Promise<GetWorkflowBySlugRow | null>;
61
- export declare const listWorkflowsByProjectQuery = "-- name: ListWorkflowsByProject :many\nSELECT id, project_id, name, slug, description, status, created_at, updated_at, archived_at\nFROM weave_v1.workflow\nWHERE project_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY updated_at DESC\nLIMIT $4\nOFFSET $3";
62
- export interface ListWorkflowsByProjectArgs {
63
- projectId: string;
64
- includeArchived: boolean;
101
+ export declare function getWorkflowTemplateBySlug(client: Client, args: GetWorkflowTemplateBySlugArgs): Promise<GetWorkflowTemplateBySlugRow | null>;
102
+ export declare const getWorkflowTemplateDraftQuery = "-- name: GetWorkflowTemplateDraft :one\nSELECT id, template_id, organization_id, base_version_id, revision, name, description, definition, input_schema, output_schema, metadata, updated_by_user_id, created_at, updated_at FROM weave.workflow_template_drafts\nWHERE organization_id = $1\n AND template_id = $2";
103
+ export interface GetWorkflowTemplateDraftArgs {
104
+ organizationId: string;
105
+ templateId: string;
106
+ }
107
+ export interface GetWorkflowTemplateDraftRow {
108
+ id: string;
109
+ templateId: string;
110
+ organizationId: string;
111
+ baseVersionId: string | null;
112
+ revision: number;
113
+ name: string;
114
+ description: string;
115
+ definition: any;
116
+ inputSchema: any;
117
+ outputSchema: any;
118
+ metadata: any;
119
+ updatedByUserId: string;
120
+ createdAt: Date;
121
+ updatedAt: Date;
122
+ }
123
+ export declare function getWorkflowTemplateDraft(client: Client, args: GetWorkflowTemplateDraftArgs): Promise<GetWorkflowTemplateDraftRow | null>;
124
+ export declare const listWorkflowTemplatesQuery = "-- name: ListWorkflowTemplates :many\nSELECT id, organization_id, slug, name, description, status, created_by_user_id, draft_revision, latest_version_id, latest_version, created_at, updated_at FROM weave.workflow_templates\nWHERE organization_id = $1\n AND (\n $2::text IS NULL\n OR status = $2::text\n )\nORDER BY updated_at DESC, created_at DESC\nLIMIT $4 OFFSET $3";
125
+ export interface ListWorkflowTemplatesArgs {
126
+ organizationId: string;
127
+ status: string | null;
65
128
  pageOffset: string;
66
129
  pageSize: string;
67
130
  }
68
- export interface ListWorkflowsByProjectRow {
131
+ export interface ListWorkflowTemplatesRow {
69
132
  id: string;
70
- projectId: string;
71
- name: string;
133
+ organizationId: string;
72
134
  slug: string;
135
+ name: string;
73
136
  description: string;
74
137
  status: string;
138
+ createdByUserId: string;
139
+ draftRevision: number;
140
+ latestVersionId: string | null;
141
+ latestVersion: number;
75
142
  createdAt: Date;
76
143
  updatedAt: Date;
77
- archivedAt: Date | null;
78
144
  }
79
- export declare function listWorkflowsByProject(client: Client, args: ListWorkflowsByProjectArgs): Promise<ListWorkflowsByProjectRow[]>;
80
- export declare const updateWorkflowQuery = "-- name: UpdateWorkflow :one\nUPDATE weave_v1.workflow\nSET name = $1,\n slug = $2,\n description = $3,\n status = $4,\n updated_at = NOW()\nWHERE id = $5\n AND project_id = $6\nRETURNING id, project_id, name, slug, description, status, created_at, updated_at, archived_at";
81
- export interface UpdateWorkflowArgs {
145
+ export declare function listWorkflowTemplates(client: Client, args: ListWorkflowTemplatesArgs): Promise<ListWorkflowTemplatesRow[]>;
146
+ export declare const updateWorkflowTemplateDraftMetadataQuery = "-- name: UpdateWorkflowTemplateDraftMetadata :one\nUPDATE weave.workflow_templates\nSET\n name = $1,\n description = $2,\n draft_revision = $3,\n updated_at = now()\nWHERE organization_id = $4\n AND id = $5\nRETURNING id, organization_id, slug, name, description, status, created_by_user_id, draft_revision, latest_version_id, latest_version, created_at, updated_at";
147
+ export interface UpdateWorkflowTemplateDraftMetadataArgs {
82
148
  name: string;
149
+ description: string;
150
+ draftRevision: number;
151
+ organizationId: string;
152
+ templateId: string;
153
+ }
154
+ export interface UpdateWorkflowTemplateDraftMetadataRow {
155
+ id: string;
156
+ organizationId: string;
83
157
  slug: string;
158
+ name: string;
84
159
  description: string;
85
160
  status: string;
86
- id: string;
87
- projectId: string;
161
+ createdByUserId: string;
162
+ draftRevision: number;
163
+ latestVersionId: string | null;
164
+ latestVersion: number;
165
+ createdAt: Date;
166
+ updatedAt: Date;
167
+ }
168
+ export declare function updateWorkflowTemplateDraftMetadata(client: Client, args: UpdateWorkflowTemplateDraftMetadataArgs): Promise<UpdateWorkflowTemplateDraftMetadataRow | null>;
169
+ export declare const updateWorkflowTemplateStatusQuery = "-- name: UpdateWorkflowTemplateStatus :one\nUPDATE weave.workflow_templates\nSET\n status = $1,\n updated_at = now()\nWHERE organization_id = $2\n AND id = $3\nRETURNING id, organization_id, slug, name, description, status, created_by_user_id, draft_revision, latest_version_id, latest_version, created_at, updated_at";
170
+ export interface UpdateWorkflowTemplateStatusArgs {
171
+ status: string;
172
+ organizationId: string;
173
+ templateId: string;
88
174
  }
89
- export interface UpdateWorkflowRow {
175
+ export interface UpdateWorkflowTemplateStatusRow {
90
176
  id: string;
91
- projectId: string;
92
- name: string;
177
+ organizationId: string;
93
178
  slug: string;
179
+ name: string;
94
180
  description: string;
95
181
  status: string;
182
+ createdByUserId: string;
183
+ draftRevision: number;
184
+ latestVersionId: string | null;
185
+ latestVersion: number;
96
186
  createdAt: Date;
97
187
  updatedAt: Date;
98
- archivedAt: Date | null;
99
188
  }
100
- export declare function updateWorkflow(client: Client, args: UpdateWorkflowArgs): Promise<UpdateWorkflowRow | null>;
101
- export declare const archiveWorkflowQuery = "-- name: ArchiveWorkflow :one\nUPDATE weave_v1.workflow\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\n AND project_id = $2\nRETURNING id, project_id, name, slug, description, status, created_at, updated_at, archived_at";
102
- export interface ArchiveWorkflowArgs {
189
+ export declare function updateWorkflowTemplateStatus(client: Client, args: UpdateWorkflowTemplateStatusArgs): Promise<UpdateWorkflowTemplateStatusRow | null>;
190
+ export declare const updateWorkflowDraftQuery = "-- name: UpdateWorkflowDraft :one\nUPDATE weave.workflow_template_drafts\nSET\n base_version_id = $1::uuid,\n revision = revision + 1,\n name = $2,\n description = $3,\n definition = $4,\n input_schema = $5,\n output_schema = $6,\n metadata = $7,\n updated_by_user_id = $8,\n updated_at = now()\nWHERE organization_id = $9\n AND template_id = $10\n AND revision = $11\nRETURNING id, template_id, organization_id, base_version_id, revision, name, description, definition, input_schema, output_schema, metadata, updated_by_user_id, created_at, updated_at";
191
+ export interface UpdateWorkflowDraftArgs {
192
+ baseVersionId: string | null;
193
+ name: string;
194
+ description: string;
195
+ definition: any;
196
+ inputSchema: any;
197
+ outputSchema: any;
198
+ metadata: any;
199
+ updatedByUserId: string;
200
+ organizationId: string;
201
+ templateId: string;
202
+ expectedRevision: number;
203
+ }
204
+ export interface UpdateWorkflowDraftRow {
103
205
  id: string;
104
- projectId: string;
206
+ templateId: string;
207
+ organizationId: string;
208
+ baseVersionId: string | null;
209
+ revision: number;
210
+ name: string;
211
+ description: string;
212
+ definition: any;
213
+ inputSchema: any;
214
+ outputSchema: any;
215
+ metadata: any;
216
+ updatedByUserId: string;
217
+ createdAt: Date;
218
+ updatedAt: Date;
219
+ }
220
+ export declare function updateWorkflowDraft(client: Client, args: UpdateWorkflowDraftArgs): Promise<UpdateWorkflowDraftRow | null>;
221
+ export declare const insertWorkflowDraftPatchQuery = "-- name: InsertWorkflowDraftPatch :one\nINSERT INTO weave.workflow_template_draft_patches (\n id,\n template_id,\n organization_id,\n revision,\n patch,\n created_by_user_id\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6\n)\nRETURNING id, template_id, organization_id, revision, patch, created_by_user_id, created_at";
222
+ export interface InsertWorkflowDraftPatchArgs {
223
+ id: string;
224
+ templateId: string;
225
+ organizationId: string;
226
+ revision: number;
227
+ patch: any;
228
+ createdByUserId: string;
105
229
  }
106
- export interface ArchiveWorkflowRow {
230
+ export interface InsertWorkflowDraftPatchRow {
107
231
  id: string;
108
- projectId: string;
232
+ templateId: string;
233
+ organizationId: string;
234
+ revision: number;
235
+ patch: any;
236
+ createdByUserId: string;
237
+ createdAt: Date;
238
+ }
239
+ export declare function insertWorkflowDraftPatch(client: Client, args: InsertWorkflowDraftPatchArgs): Promise<InsertWorkflowDraftPatchRow | null>;
240
+ export declare const insertWorkflowTemplateVersionQuery = "-- name: InsertWorkflowTemplateVersion :one\nINSERT INTO weave.workflow_template_versions (\n id,\n template_id,\n organization_id,\n version,\n source_draft_revision,\n name,\n description,\n definition,\n input_schema,\n output_schema,\n metadata,\n published_by_user_id\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12\n)\nRETURNING id, template_id, organization_id, version, source_draft_revision, name, description, definition, input_schema, output_schema, metadata, published_by_user_id, published_at";
241
+ export interface InsertWorkflowTemplateVersionArgs {
242
+ id: string;
243
+ templateId: string;
244
+ organizationId: string;
245
+ version: number;
246
+ sourceDraftRevision: number;
109
247
  name: string;
248
+ description: string;
249
+ definition: any;
250
+ inputSchema: any;
251
+ outputSchema: any;
252
+ metadata: any;
253
+ publishedByUserId: string;
254
+ }
255
+ export interface InsertWorkflowTemplateVersionRow {
256
+ id: string;
257
+ templateId: string;
258
+ organizationId: string;
259
+ version: number;
260
+ sourceDraftRevision: number;
261
+ name: string;
262
+ description: string;
263
+ definition: any;
264
+ inputSchema: any;
265
+ outputSchema: any;
266
+ metadata: any;
267
+ publishedByUserId: string;
268
+ publishedAt: Date;
269
+ }
270
+ export declare function insertWorkflowTemplateVersion(client: Client, args: InsertWorkflowTemplateVersionArgs): Promise<InsertWorkflowTemplateVersionRow | null>;
271
+ export declare const setWorkflowTemplateLatestVersionQuery = "-- name: SetWorkflowTemplateLatestVersion :one\nUPDATE weave.workflow_templates\nSET\n latest_version_id = $1,\n latest_version = $2,\n updated_at = now()\nWHERE organization_id = $3\n AND id = $4\nRETURNING id, organization_id, slug, name, description, status, created_by_user_id, draft_revision, latest_version_id, latest_version, created_at, updated_at";
272
+ export interface SetWorkflowTemplateLatestVersionArgs {
273
+ versionId: string | null;
274
+ version: number;
275
+ organizationId: string;
276
+ templateId: string;
277
+ }
278
+ export interface SetWorkflowTemplateLatestVersionRow {
279
+ id: string;
280
+ organizationId: string;
110
281
  slug: string;
282
+ name: string;
111
283
  description: string;
112
284
  status: string;
285
+ createdByUserId: string;
286
+ draftRevision: number;
287
+ latestVersionId: string | null;
288
+ latestVersion: number;
113
289
  createdAt: Date;
114
290
  updatedAt: Date;
115
- archivedAt: Date | null;
116
291
  }
117
- export declare function archiveWorkflow(client: Client, args: ArchiveWorkflowArgs): Promise<ArchiveWorkflowRow | null>;
118
- export declare const deleteWorkflowQuery = "-- name: DeleteWorkflow :exec\nDELETE\nFROM weave_v1.workflow\nWHERE id = $1\n AND project_id = $2";
119
- export interface DeleteWorkflowArgs {
292
+ export declare function setWorkflowTemplateLatestVersion(client: Client, args: SetWorkflowTemplateLatestVersionArgs): Promise<SetWorkflowTemplateLatestVersionRow | null>;
293
+ export declare const getWorkflowTemplateVersionByNumberQuery = "-- name: GetWorkflowTemplateVersionByNumber :one\nSELECT id, template_id, organization_id, version, source_draft_revision, name, description, definition, input_schema, output_schema, metadata, published_by_user_id, published_at FROM weave.workflow_template_versions\nWHERE organization_id = $1\n AND template_id = $2\n AND version = $3";
294
+ export interface GetWorkflowTemplateVersionByNumberArgs {
295
+ organizationId: string;
296
+ templateId: string;
297
+ version: number;
298
+ }
299
+ export interface GetWorkflowTemplateVersionByNumberRow {
120
300
  id: string;
121
- projectId: string;
301
+ templateId: string;
302
+ organizationId: string;
303
+ version: number;
304
+ sourceDraftRevision: number;
305
+ name: string;
306
+ description: string;
307
+ definition: any;
308
+ inputSchema: any;
309
+ outputSchema: any;
310
+ metadata: any;
311
+ publishedByUserId: string;
312
+ publishedAt: Date;
122
313
  }
123
- export declare function deleteWorkflow(client: Client, args: DeleteWorkflowArgs): Promise<void>;
124
- export declare const upsertWorkflowStageStateQuery = "-- name: UpsertWorkflowStageState :one\nINSERT INTO weave_v1.workflow_stage_state (\n workflow_id,\n stage,\n status,\n blocked_reason,\n updated_at\n)\nSELECT w.id,\n $1,\n $2,\n $3,\n NOW()\nFROM weave_v1.workflow w\nWHERE w.id = $4\n AND w.project_id = $5\nON CONFLICT (workflow_id, stage) DO UPDATE\nSET status = EXCLUDED.status,\n blocked_reason = EXCLUDED.blocked_reason,\n updated_at = NOW()\nRETURNING workflow_id, stage, status, blocked_reason, updated_at";
125
- export interface UpsertWorkflowStageStateArgs {
126
- stage: string;
314
+ export declare function getWorkflowTemplateVersionByNumber(client: Client, args: GetWorkflowTemplateVersionByNumberArgs): Promise<GetWorkflowTemplateVersionByNumberRow | null>;
315
+ export declare const getWorkflowTemplateVersionByIDQuery = "-- name: GetWorkflowTemplateVersionByID :one\nSELECT id, template_id, organization_id, version, source_draft_revision, name, description, definition, input_schema, output_schema, metadata, published_by_user_id, published_at FROM weave.workflow_template_versions\nWHERE organization_id = $1\n AND id = $2";
316
+ export interface GetWorkflowTemplateVersionByIDArgs {
317
+ organizationId: string;
318
+ versionId: string;
319
+ }
320
+ export interface GetWorkflowTemplateVersionByIDRow {
321
+ id: string;
322
+ templateId: string;
323
+ organizationId: string;
324
+ version: number;
325
+ sourceDraftRevision: number;
326
+ name: string;
327
+ description: string;
328
+ definition: any;
329
+ inputSchema: any;
330
+ outputSchema: any;
331
+ metadata: any;
332
+ publishedByUserId: string;
333
+ publishedAt: Date;
334
+ }
335
+ export declare function getWorkflowTemplateVersionByID(client: Client, args: GetWorkflowTemplateVersionByIDArgs): Promise<GetWorkflowTemplateVersionByIDRow | null>;
336
+ export declare const listWorkflowTemplateVersionsQuery = "-- name: ListWorkflowTemplateVersions :many\nSELECT id, template_id, organization_id, version, source_draft_revision, name, description, definition, input_schema, output_schema, metadata, published_by_user_id, published_at FROM weave.workflow_template_versions\nWHERE organization_id = $1\n AND template_id = $2\nORDER BY version DESC\nLIMIT $4 OFFSET $3";
337
+ export interface ListWorkflowTemplateVersionsArgs {
338
+ organizationId: string;
339
+ templateId: string;
340
+ pageOffset: string;
341
+ pageSize: string;
342
+ }
343
+ export interface ListWorkflowTemplateVersionsRow {
344
+ id: string;
345
+ templateId: string;
346
+ organizationId: string;
347
+ version: number;
348
+ sourceDraftRevision: number;
349
+ name: string;
350
+ description: string;
351
+ definition: any;
352
+ inputSchema: any;
353
+ outputSchema: any;
354
+ metadata: any;
355
+ publishedByUserId: string;
356
+ publishedAt: Date;
357
+ }
358
+ export declare function listWorkflowTemplateVersions(client: Client, args: ListWorkflowTemplateVersionsArgs): Promise<ListWorkflowTemplateVersionsRow[]>;
359
+ export declare const createWorkflowRunQuery = "-- name: CreateWorkflowRun :one\nINSERT INTO weave.workflow_runs (\n id,\n organization_id,\n workflow_template_id,\n workflow_version_id,\n status,\n created_by_user_id,\n chat_session_id,\n input\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7::uuid,\n $8\n)\nRETURNING id, organization_id, workflow_template_id, workflow_version_id, status, created_by_user_id, chat_session_id, input, output, error_code, safe_error_message, created_at, started_at, finished_at";
360
+ export interface CreateWorkflowRunArgs {
361
+ id: string;
362
+ organizationId: string;
363
+ workflowTemplateId: string;
364
+ workflowVersionId: string;
127
365
  status: string;
128
- blockedReason: string;
129
- workflowId: string;
130
- projectId: string;
366
+ createdByUserId: string;
367
+ chatSessionId: string | null;
368
+ input: any;
131
369
  }
132
- export interface UpsertWorkflowStageStateRow {
133
- workflowId: string;
134
- stage: string;
370
+ export interface CreateWorkflowRunRow {
371
+ id: string;
372
+ organizationId: string;
373
+ workflowTemplateId: string;
374
+ workflowVersionId: string;
135
375
  status: string;
136
- blockedReason: string;
137
- updatedAt: Date;
376
+ createdByUserId: string;
377
+ chatSessionId: string | null;
378
+ input: any;
379
+ output: any;
380
+ errorCode: string;
381
+ safeErrorMessage: string;
382
+ createdAt: Date;
383
+ startedAt: Date | null;
384
+ finishedAt: Date | null;
138
385
  }
139
- export declare function upsertWorkflowStageState(client: Client, args: UpsertWorkflowStageStateArgs): Promise<UpsertWorkflowStageStateRow | null>;
140
- export declare const getWorkflowStageStateQuery = "-- name: GetWorkflowStageState :one\nSELECT s.workflow_id, s.stage, s.status, s.blocked_reason, s.updated_at\nFROM weave_v1.workflow_stage_state s\n INNER JOIN weave_v1.workflow w ON w.id = s.workflow_id\nWHERE s.workflow_id = $1\n AND w.project_id = $2\n AND s.stage = $3";
141
- export interface GetWorkflowStageStateArgs {
142
- workflowId: string;
143
- projectId: string;
144
- stage: string;
386
+ export declare function createWorkflowRun(client: Client, args: CreateWorkflowRunArgs): Promise<CreateWorkflowRunRow | null>;
387
+ export declare const getWorkflowRunQuery = "-- name: GetWorkflowRun :one\nSELECT id, organization_id, workflow_template_id, workflow_version_id, status, created_by_user_id, chat_session_id, input, output, error_code, safe_error_message, created_at, started_at, finished_at FROM weave.workflow_runs\nWHERE organization_id = $1\n AND id = $2";
388
+ export interface GetWorkflowRunArgs {
389
+ organizationId: string;
390
+ workflowRunId: string;
145
391
  }
146
- export interface GetWorkflowStageStateRow {
147
- workflowId: string;
148
- stage: string;
392
+ export interface GetWorkflowRunRow {
393
+ id: string;
394
+ organizationId: string;
395
+ workflowTemplateId: string;
396
+ workflowVersionId: string;
149
397
  status: string;
150
- blockedReason: string;
151
- updatedAt: Date;
398
+ createdByUserId: string;
399
+ chatSessionId: string | null;
400
+ input: any;
401
+ output: any;
402
+ errorCode: string;
403
+ safeErrorMessage: string;
404
+ createdAt: Date;
405
+ startedAt: Date | null;
406
+ finishedAt: Date | null;
152
407
  }
153
- export declare function getWorkflowStageState(client: Client, args: GetWorkflowStageStateArgs): Promise<GetWorkflowStageStateRow | null>;
154
- export declare const listWorkflowStageStatesQuery = "-- name: ListWorkflowStageStates :many\nSELECT s.workflow_id, s.stage, s.status, s.blocked_reason, s.updated_at\nFROM weave_v1.workflow_stage_state s\n INNER JOIN weave_v1.workflow w ON w.id = s.workflow_id\nWHERE s.workflow_id = $1\n AND w.project_id = $2\nORDER BY s.stage";
155
- export interface ListWorkflowStageStatesArgs {
156
- workflowId: string;
157
- projectId: string;
408
+ export declare function getWorkflowRun(client: Client, args: GetWorkflowRunArgs): Promise<GetWorkflowRunRow | null>;
409
+ export declare const listWorkflowRunsQuery = "-- name: ListWorkflowRuns :many\nSELECT id, organization_id, workflow_template_id, workflow_version_id, status, created_by_user_id, chat_session_id, input, output, error_code, safe_error_message, created_at, started_at, finished_at FROM weave.workflow_runs\nWHERE organization_id = $1\n AND (\n $2::uuid IS NULL\n OR workflow_template_id = $2::uuid\n )\n AND (\n $3::text IS NULL\n OR status = $3::text\n )\nORDER BY created_at DESC\nLIMIT $5 OFFSET $4";
410
+ export interface ListWorkflowRunsArgs {
411
+ organizationId: string;
412
+ workflowTemplateId: string | null;
413
+ status: string | null;
414
+ pageOffset: string;
415
+ pageSize: string;
158
416
  }
159
- export interface ListWorkflowStageStatesRow {
160
- workflowId: string;
161
- stage: string;
417
+ export interface ListWorkflowRunsRow {
418
+ id: string;
419
+ organizationId: string;
420
+ workflowTemplateId: string;
421
+ workflowVersionId: string;
162
422
  status: string;
163
- blockedReason: string;
164
- updatedAt: Date;
423
+ createdByUserId: string;
424
+ chatSessionId: string | null;
425
+ input: any;
426
+ output: any;
427
+ errorCode: string;
428
+ safeErrorMessage: string;
429
+ createdAt: Date;
430
+ startedAt: Date | null;
431
+ finishedAt: Date | null;
432
+ }
433
+ export declare function listWorkflowRuns(client: Client, args: ListWorkflowRunsArgs): Promise<ListWorkflowRunsRow[]>;
434
+ export declare const updateWorkflowRunStatusQuery = "-- name: UpdateWorkflowRunStatus :one\nUPDATE weave.workflow_runs\nSET\n status = $1,\n output = $2,\n error_code = $3,\n safe_error_message = $4,\n started_at = COALESCE(started_at, $5::timestamptz),\n finished_at = $6::timestamptz\nWHERE organization_id = $7\n AND id = $8\nRETURNING id, organization_id, workflow_template_id, workflow_version_id, status, created_by_user_id, chat_session_id, input, output, error_code, safe_error_message, created_at, started_at, finished_at";
435
+ export interface UpdateWorkflowRunStatusArgs {
436
+ status: string;
437
+ output: any;
438
+ errorCode: string;
439
+ safeErrorMessage: string;
440
+ startedAt: Date | null;
441
+ finishedAt: Date | null;
442
+ organizationId: string;
443
+ workflowRunId: string;
444
+ }
445
+ export interface UpdateWorkflowRunStatusRow {
446
+ id: string;
447
+ organizationId: string;
448
+ workflowTemplateId: string;
449
+ workflowVersionId: string;
450
+ status: string;
451
+ createdByUserId: string;
452
+ chatSessionId: string | null;
453
+ input: any;
454
+ output: any;
455
+ errorCode: string;
456
+ safeErrorMessage: string;
457
+ createdAt: Date;
458
+ startedAt: Date | null;
459
+ finishedAt: Date | null;
460
+ }
461
+ export declare function updateWorkflowRunStatus(client: Client, args: UpdateWorkflowRunStatusArgs): Promise<UpdateWorkflowRunStatusRow | null>;
462
+ export declare const createWorkflowStepRunQuery = "-- name: CreateWorkflowStepRun :one\nINSERT INTO weave.workflow_step_runs (\n id,\n organization_id,\n workflow_run_id,\n step_key,\n step_name,\n step_kind,\n status,\n input\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8\n)\nRETURNING id, organization_id, workflow_run_id, step_key, step_name, step_kind, status, agent_run_id, child_workflow_run_id, input, output, error_code, safe_error_message, created_at, started_at, finished_at";
463
+ export interface CreateWorkflowStepRunArgs {
464
+ id: string;
465
+ organizationId: string;
466
+ workflowRunId: string;
467
+ stepKey: string;
468
+ stepName: string;
469
+ stepKind: string;
470
+ status: string;
471
+ input: any;
472
+ }
473
+ export interface CreateWorkflowStepRunRow {
474
+ id: string;
475
+ organizationId: string;
476
+ workflowRunId: string;
477
+ stepKey: string;
478
+ stepName: string;
479
+ stepKind: string;
480
+ status: string;
481
+ agentRunId: string | null;
482
+ childWorkflowRunId: string | null;
483
+ input: any;
484
+ output: any;
485
+ errorCode: string;
486
+ safeErrorMessage: string;
487
+ createdAt: Date;
488
+ startedAt: Date | null;
489
+ finishedAt: Date | null;
490
+ }
491
+ export declare function createWorkflowStepRun(client: Client, args: CreateWorkflowStepRunArgs): Promise<CreateWorkflowStepRunRow | null>;
492
+ export declare const listWorkflowStepRunsQuery = "-- name: ListWorkflowStepRuns :many\nSELECT id, organization_id, workflow_run_id, step_key, step_name, step_kind, status, agent_run_id, child_workflow_run_id, input, output, error_code, safe_error_message, created_at, started_at, finished_at FROM weave.workflow_step_runs\nWHERE organization_id = $1\n AND workflow_run_id = $2\nORDER BY created_at, step_key";
493
+ export interface ListWorkflowStepRunsArgs {
494
+ organizationId: string;
495
+ workflowRunId: string;
496
+ }
497
+ export interface ListWorkflowStepRunsRow {
498
+ id: string;
499
+ organizationId: string;
500
+ workflowRunId: string;
501
+ stepKey: string;
502
+ stepName: string;
503
+ stepKind: string;
504
+ status: string;
505
+ agentRunId: string | null;
506
+ childWorkflowRunId: string | null;
507
+ input: any;
508
+ output: any;
509
+ errorCode: string;
510
+ safeErrorMessage: string;
511
+ createdAt: Date;
512
+ startedAt: Date | null;
513
+ finishedAt: Date | null;
514
+ }
515
+ export declare function listWorkflowStepRuns(client: Client, args: ListWorkflowStepRunsArgs): Promise<ListWorkflowStepRunsRow[]>;
516
+ export declare const updateWorkflowStepRunStatusQuery = "-- name: UpdateWorkflowStepRunStatus :one\nUPDATE weave.workflow_step_runs\nSET\n status = $1,\n agent_run_id = $2::uuid,\n child_workflow_run_id = $3::uuid,\n output = $4,\n error_code = $5,\n safe_error_message = $6,\n started_at = COALESCE(started_at, $7::timestamptz),\n finished_at = $8::timestamptz\nWHERE organization_id = $9\n AND id = $10\nRETURNING id, organization_id, workflow_run_id, step_key, step_name, step_kind, status, agent_run_id, child_workflow_run_id, input, output, error_code, safe_error_message, created_at, started_at, finished_at";
517
+ export interface UpdateWorkflowStepRunStatusArgs {
518
+ status: string;
519
+ agentRunId: string | null;
520
+ childWorkflowRunId: string | null;
521
+ output: any;
522
+ errorCode: string;
523
+ safeErrorMessage: string;
524
+ startedAt: Date | null;
525
+ finishedAt: Date | null;
526
+ organizationId: string;
527
+ workflowStepRunId: string;
528
+ }
529
+ export interface UpdateWorkflowStepRunStatusRow {
530
+ id: string;
531
+ organizationId: string;
532
+ workflowRunId: string;
533
+ stepKey: string;
534
+ stepName: string;
535
+ stepKind: string;
536
+ status: string;
537
+ agentRunId: string | null;
538
+ childWorkflowRunId: string | null;
539
+ input: any;
540
+ output: any;
541
+ errorCode: string;
542
+ safeErrorMessage: string;
543
+ createdAt: Date;
544
+ startedAt: Date | null;
545
+ finishedAt: Date | null;
546
+ }
547
+ export declare function updateWorkflowStepRunStatus(client: Client, args: UpdateWorkflowStepRunStatusArgs): Promise<UpdateWorkflowStepRunStatusRow | null>;
548
+ export declare const insertWorkflowRunEventQuery = "-- name: InsertWorkflowRunEvent :one\nINSERT INTO weave.workflow_run_events (\n id,\n organization_id,\n workflow_run_id,\n workflow_step_run_id,\n agent_run_id,\n sequence,\n kind,\n message,\n payload\n) VALUES (\n $1,\n $2,\n $3,\n $4::uuid,\n $5::uuid,\n $6,\n $7,\n $8,\n $9\n)\nRETURNING id, organization_id, workflow_run_id, workflow_step_run_id, agent_run_id, sequence, kind, message, payload, created_at";
549
+ export interface InsertWorkflowRunEventArgs {
550
+ id: string;
551
+ organizationId: string;
552
+ workflowRunId: string;
553
+ workflowStepRunId: string | null;
554
+ agentRunId: string | null;
555
+ sequence: string;
556
+ kind: string;
557
+ message: string;
558
+ payload: any;
559
+ }
560
+ export interface InsertWorkflowRunEventRow {
561
+ id: string;
562
+ organizationId: string;
563
+ workflowRunId: string;
564
+ workflowStepRunId: string | null;
565
+ agentRunId: string | null;
566
+ sequence: string;
567
+ kind: string;
568
+ message: string;
569
+ payload: any;
570
+ createdAt: Date;
571
+ }
572
+ export declare function insertWorkflowRunEvent(client: Client, args: InsertWorkflowRunEventArgs): Promise<InsertWorkflowRunEventRow | null>;
573
+ export declare const listWorkflowRunEventsQuery = "-- name: ListWorkflowRunEvents :many\nSELECT id, organization_id, workflow_run_id, workflow_step_run_id, agent_run_id, sequence, kind, message, payload, created_at FROM weave.workflow_run_events\nWHERE organization_id = $1\n AND workflow_run_id = $2\n AND sequence > $3\nORDER BY sequence\nLIMIT $4";
574
+ export interface ListWorkflowRunEventsArgs {
575
+ organizationId: string;
576
+ workflowRunId: string;
577
+ afterSequence: string;
578
+ pageSize: string;
579
+ }
580
+ export interface ListWorkflowRunEventsRow {
581
+ id: string;
582
+ organizationId: string;
583
+ workflowRunId: string;
584
+ workflowStepRunId: string | null;
585
+ agentRunId: string | null;
586
+ sequence: string;
587
+ kind: string;
588
+ message: string;
589
+ payload: any;
590
+ createdAt: Date;
591
+ }
592
+ export declare function listWorkflowRunEvents(client: Client, args: ListWorkflowRunEventsArgs): Promise<ListWorkflowRunEventsRow[]>;
593
+ export declare const insertToolCallEventQuery = "-- name: InsertToolCallEvent :one\nINSERT INTO weave.tool_call_events (\n id,\n organization_id,\n workflow_run_id,\n workflow_step_run_id,\n agent_run_id,\n tool_call_id,\n tool_name,\n state,\n arguments,\n result,\n error_code,\n safe_error_message\n) VALUES (\n $1,\n $2,\n $3::uuid,\n $4::uuid,\n $5::uuid,\n $6,\n $7,\n $8,\n $9,\n $10,\n $11,\n $12\n)\nRETURNING id, organization_id, workflow_run_id, workflow_step_run_id, agent_run_id, tool_call_id, tool_name, state, arguments, result, error_code, safe_error_message, created_at";
594
+ export interface InsertToolCallEventArgs {
595
+ id: string;
596
+ organizationId: string;
597
+ workflowRunId: string | null;
598
+ workflowStepRunId: string | null;
599
+ agentRunId: string | null;
600
+ toolCallId: string;
601
+ toolName: string;
602
+ state: string;
603
+ arguments: any;
604
+ result: any;
605
+ errorCode: string;
606
+ safeErrorMessage: string;
607
+ }
608
+ export interface InsertToolCallEventRow {
609
+ id: string;
610
+ organizationId: string;
611
+ workflowRunId: string | null;
612
+ workflowStepRunId: string | null;
613
+ agentRunId: string | null;
614
+ toolCallId: string;
615
+ toolName: string;
616
+ state: string;
617
+ arguments: any;
618
+ result: any;
619
+ errorCode: string;
620
+ safeErrorMessage: string;
621
+ createdAt: Date;
622
+ }
623
+ export declare function insertToolCallEvent(client: Client, args: InsertToolCallEventArgs): Promise<InsertToolCallEventRow | null>;
624
+ export declare const listToolCallEventsQuery = "-- name: ListToolCallEvents :many\nSELECT id, organization_id, workflow_run_id, workflow_step_run_id, agent_run_id, tool_call_id, tool_name, state, arguments, result, error_code, safe_error_message, created_at FROM weave.tool_call_events\nWHERE organization_id = $1\n AND (\n $2::uuid IS NULL\n OR workflow_run_id = $2::uuid\n )\n AND (\n $3::uuid IS NULL\n OR agent_run_id = $3::uuid\n )\nORDER BY created_at\nLIMIT $5 OFFSET $4";
625
+ export interface ListToolCallEventsArgs {
626
+ organizationId: string;
627
+ workflowRunId: string | null;
628
+ agentRunId: string | null;
629
+ pageOffset: string;
630
+ pageSize: string;
631
+ }
632
+ export interface ListToolCallEventsRow {
633
+ id: string;
634
+ organizationId: string;
635
+ workflowRunId: string | null;
636
+ workflowStepRunId: string | null;
637
+ agentRunId: string | null;
638
+ toolCallId: string;
639
+ toolName: string;
640
+ state: string;
641
+ arguments: any;
642
+ result: any;
643
+ errorCode: string;
644
+ safeErrorMessage: string;
645
+ createdAt: Date;
165
646
  }
166
- export declare function listWorkflowStageStates(client: Client, args: ListWorkflowStageStatesArgs): Promise<ListWorkflowStageStatesRow[]>;
647
+ export declare function listToolCallEvents(client: Client, args: ListToolCallEventsArgs): Promise<ListToolCallEventsRow[]>;
167
648
  export {};