weave-typescript 0.11.12 → 0.11.13
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.
- package/dist/weaveapi/project/v1/project.pb.d.ts +40 -0
- package/dist/weaveapi/project/v1/project.pb.js +263 -0
- package/dist/weaveapi/project/v1/service.pb.d.ts +181 -0
- package/dist/weaveapi/project/v1/service.pb.js +1066 -0
- package/dist/weaveapi/workflow/v1/service.pb.d.ts +235 -0
- package/dist/weaveapi/workflow/v1/service.pb.js +1834 -0
- package/dist/weaveapi/workflow/v1/workflow.pb.d.ts +76 -0
- package/dist/weaveapi/workflow/v1/workflow.pb.js +539 -0
- package/dist/weavesql/llmxdb/capabilities_sql.d.ts +7 -7
- package/dist/weavesql/llmxdb/capabilities_sql.js +7 -7
- package/dist/weavesql/llmxdb/changes_sql.d.ts +5 -5
- package/dist/weavesql/llmxdb/changes_sql.js +6 -6
- package/dist/weavesql/llmxdb/models_sql.d.ts +6 -6
- package/dist/weavesql/llmxdb/models_sql.js +6 -6
- package/dist/weavesql/llmxdb/providers_sql.d.ts +5 -5
- package/dist/weavesql/llmxdb/providers_sql.js +5 -5
- package/dist/weavesql/llmxdb/scraper_runs_sql.d.ts +5 -5
- package/dist/weavesql/llmxdb/scraper_runs_sql.js +5 -5
- package/dist/weavesql/llmxdb/search_sql.d.ts +7 -7
- package/dist/weavesql/llmxdb/search_sql.js +7 -7
- package/dist/weavesql/weavedb/llm_provider_credentials_sql.d.ts +1 -1
- package/dist/weavesql/weavedb/llm_provider_credentials_sql.js +1 -1
- package/dist/weavesql/weavedb/project_sql.d.ts +95 -0
- package/dist/weavesql/weavedb/project_sql.js +166 -0
- package/dist/weavesql/weavedb/storage_sql.d.ts +2 -2
- package/dist/weavesql/weavedb/storage_sql.js +2 -2
- package/dist/weavesql/weavedb/workflow_sql.d.ts +142 -0
- package/dist/weavesql/weavedb/workflow_sql.js +260 -0
- package/package.json +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
2
|
+
interface Client {
|
|
3
|
+
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
|
+
}
|
|
5
|
+
export declare const createProjectQuery = "-- name: CreateProject :one\nINSERT INTO weave_v1.project (\n id,\n organization_id,\n name,\n description,\n status\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5\n)\nRETURNING id, organization_id, name, description, status, created_at, updated_at, archived_at";
|
|
6
|
+
export interface CreateProjectArgs {
|
|
7
|
+
id: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
status: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CreateProjectRow {
|
|
14
|
+
id: string;
|
|
15
|
+
organizationId: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
status: string;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
archivedAt: Date | null;
|
|
22
|
+
}
|
|
23
|
+
export declare function createProject(client: Client, args: CreateProjectArgs): Promise<CreateProjectRow | null>;
|
|
24
|
+
export declare const getProjectQuery = "-- name: GetProject :one\nSELECT id, organization_id, name, description, status, created_at, updated_at, archived_at\nFROM weave_v1.project\nWHERE id = $1";
|
|
25
|
+
export interface GetProjectArgs {
|
|
26
|
+
id: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GetProjectRow {
|
|
29
|
+
id: string;
|
|
30
|
+
organizationId: string;
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
status: string;
|
|
34
|
+
createdAt: Date;
|
|
35
|
+
updatedAt: Date;
|
|
36
|
+
archivedAt: Date | null;
|
|
37
|
+
}
|
|
38
|
+
export declare function getProject(client: Client, args: GetProjectArgs): Promise<GetProjectRow | null>;
|
|
39
|
+
export declare const listProjectsByOrganizationQuery = "-- name: ListProjectsByOrganization :many\nSELECT id, organization_id, name, description, status, created_at, updated_at, archived_at\nFROM weave_v1.project\nWHERE organization_id = $1\n AND ($2::BOOLEAN OR archived_at IS NULL)\nORDER BY created_at DESC\nLIMIT $4\nOFFSET $3";
|
|
40
|
+
export interface ListProjectsByOrganizationArgs {
|
|
41
|
+
organizationId: string;
|
|
42
|
+
includeArchived: boolean;
|
|
43
|
+
pageOffset: string;
|
|
44
|
+
pageSize: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ListProjectsByOrganizationRow {
|
|
47
|
+
id: string;
|
|
48
|
+
organizationId: string;
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
status: string;
|
|
52
|
+
createdAt: Date;
|
|
53
|
+
updatedAt: Date;
|
|
54
|
+
archivedAt: Date | null;
|
|
55
|
+
}
|
|
56
|
+
export declare function listProjectsByOrganization(client: Client, args: ListProjectsByOrganizationArgs): Promise<ListProjectsByOrganizationRow[]>;
|
|
57
|
+
export declare const updateProjectQuery = "-- name: UpdateProject :one\nUPDATE weave_v1.project\nSET name = $1,\n description = $2,\n status = $3,\n updated_at = NOW()\nWHERE id = $4\nRETURNING id, organization_id, name, description, status, created_at, updated_at, archived_at";
|
|
58
|
+
export interface UpdateProjectArgs {
|
|
59
|
+
name: string;
|
|
60
|
+
description: string;
|
|
61
|
+
status: string;
|
|
62
|
+
id: string;
|
|
63
|
+
}
|
|
64
|
+
export interface UpdateProjectRow {
|
|
65
|
+
id: string;
|
|
66
|
+
organizationId: string;
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
status: string;
|
|
70
|
+
createdAt: Date;
|
|
71
|
+
updatedAt: Date;
|
|
72
|
+
archivedAt: Date | null;
|
|
73
|
+
}
|
|
74
|
+
export declare function updateProject(client: Client, args: UpdateProjectArgs): Promise<UpdateProjectRow | null>;
|
|
75
|
+
export declare const archiveProjectQuery = "-- name: ArchiveProject :one\nUPDATE weave_v1.project\nSET status = 'archived',\n archived_at = NOW(),\n updated_at = NOW()\nWHERE id = $1\nRETURNING id, organization_id, name, description, status, created_at, updated_at, archived_at";
|
|
76
|
+
export interface ArchiveProjectArgs {
|
|
77
|
+
id: string;
|
|
78
|
+
}
|
|
79
|
+
export interface ArchiveProjectRow {
|
|
80
|
+
id: string;
|
|
81
|
+
organizationId: string;
|
|
82
|
+
name: string;
|
|
83
|
+
description: string;
|
|
84
|
+
status: string;
|
|
85
|
+
createdAt: Date;
|
|
86
|
+
updatedAt: Date;
|
|
87
|
+
archivedAt: Date | null;
|
|
88
|
+
}
|
|
89
|
+
export declare function archiveProject(client: Client, args: ArchiveProjectArgs): Promise<ArchiveProjectRow | null>;
|
|
90
|
+
export declare const deleteProjectQuery = "-- name: DeleteProject :exec\nDELETE\nFROM weave_v1.project\nWHERE id = $1";
|
|
91
|
+
export interface DeleteProjectArgs {
|
|
92
|
+
id: string;
|
|
93
|
+
}
|
|
94
|
+
export declare function deleteProject(client: Client, args: DeleteProjectArgs): Promise<void>;
|
|
95
|
+
export {};
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteProjectQuery = exports.archiveProjectQuery = exports.updateProjectQuery = exports.listProjectsByOrganizationQuery = exports.getProjectQuery = exports.createProjectQuery = void 0;
|
|
4
|
+
exports.createProject = createProject;
|
|
5
|
+
exports.getProject = getProject;
|
|
6
|
+
exports.listProjectsByOrganization = listProjectsByOrganization;
|
|
7
|
+
exports.updateProject = updateProject;
|
|
8
|
+
exports.archiveProject = archiveProject;
|
|
9
|
+
exports.deleteProject = deleteProject;
|
|
10
|
+
exports.createProjectQuery = `-- name: CreateProject :one
|
|
11
|
+
INSERT INTO weave_v1.project (
|
|
12
|
+
id,
|
|
13
|
+
organization_id,
|
|
14
|
+
name,
|
|
15
|
+
description,
|
|
16
|
+
status
|
|
17
|
+
)
|
|
18
|
+
VALUES (
|
|
19
|
+
$1,
|
|
20
|
+
$2,
|
|
21
|
+
$3,
|
|
22
|
+
$4,
|
|
23
|
+
$5
|
|
24
|
+
)
|
|
25
|
+
RETURNING id, organization_id, name, description, status, created_at, updated_at, archived_at`;
|
|
26
|
+
async function createProject(client, args) {
|
|
27
|
+
const result = await client.query({
|
|
28
|
+
text: exports.createProjectQuery,
|
|
29
|
+
values: [args.id, args.organizationId, args.name, args.description, args.status],
|
|
30
|
+
rowMode: "array"
|
|
31
|
+
});
|
|
32
|
+
if (result.rows.length !== 1) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const row = result.rows[0];
|
|
36
|
+
return {
|
|
37
|
+
id: row[0],
|
|
38
|
+
organizationId: row[1],
|
|
39
|
+
name: row[2],
|
|
40
|
+
description: row[3],
|
|
41
|
+
status: row[4],
|
|
42
|
+
createdAt: row[5],
|
|
43
|
+
updatedAt: row[6],
|
|
44
|
+
archivedAt: row[7]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.getProjectQuery = `-- name: GetProject :one
|
|
48
|
+
SELECT id, organization_id, name, description, status, created_at, updated_at, archived_at
|
|
49
|
+
FROM weave_v1.project
|
|
50
|
+
WHERE id = $1`;
|
|
51
|
+
async function getProject(client, args) {
|
|
52
|
+
const result = await client.query({
|
|
53
|
+
text: exports.getProjectQuery,
|
|
54
|
+
values: [args.id],
|
|
55
|
+
rowMode: "array"
|
|
56
|
+
});
|
|
57
|
+
if (result.rows.length !== 1) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const row = result.rows[0];
|
|
61
|
+
return {
|
|
62
|
+
id: row[0],
|
|
63
|
+
organizationId: row[1],
|
|
64
|
+
name: row[2],
|
|
65
|
+
description: row[3],
|
|
66
|
+
status: row[4],
|
|
67
|
+
createdAt: row[5],
|
|
68
|
+
updatedAt: row[6],
|
|
69
|
+
archivedAt: row[7]
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
exports.listProjectsByOrganizationQuery = `-- name: ListProjectsByOrganization :many
|
|
73
|
+
SELECT id, organization_id, name, description, status, created_at, updated_at, archived_at
|
|
74
|
+
FROM weave_v1.project
|
|
75
|
+
WHERE organization_id = $1
|
|
76
|
+
AND ($2::BOOLEAN OR archived_at IS NULL)
|
|
77
|
+
ORDER BY created_at DESC
|
|
78
|
+
LIMIT $4
|
|
79
|
+
OFFSET $3`;
|
|
80
|
+
async function listProjectsByOrganization(client, args) {
|
|
81
|
+
const result = await client.query({
|
|
82
|
+
text: exports.listProjectsByOrganizationQuery,
|
|
83
|
+
values: [args.organizationId, args.includeArchived, args.pageOffset, args.pageSize],
|
|
84
|
+
rowMode: "array"
|
|
85
|
+
});
|
|
86
|
+
return result.rows.map(row => {
|
|
87
|
+
return {
|
|
88
|
+
id: row[0],
|
|
89
|
+
organizationId: row[1],
|
|
90
|
+
name: row[2],
|
|
91
|
+
description: row[3],
|
|
92
|
+
status: row[4],
|
|
93
|
+
createdAt: row[5],
|
|
94
|
+
updatedAt: row[6],
|
|
95
|
+
archivedAt: row[7]
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
exports.updateProjectQuery = `-- name: UpdateProject :one
|
|
100
|
+
UPDATE weave_v1.project
|
|
101
|
+
SET name = $1,
|
|
102
|
+
description = $2,
|
|
103
|
+
status = $3,
|
|
104
|
+
updated_at = NOW()
|
|
105
|
+
WHERE id = $4
|
|
106
|
+
RETURNING id, organization_id, name, description, status, created_at, updated_at, archived_at`;
|
|
107
|
+
async function updateProject(client, args) {
|
|
108
|
+
const result = await client.query({
|
|
109
|
+
text: exports.updateProjectQuery,
|
|
110
|
+
values: [args.name, args.description, args.status, args.id],
|
|
111
|
+
rowMode: "array"
|
|
112
|
+
});
|
|
113
|
+
if (result.rows.length !== 1) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
const row = result.rows[0];
|
|
117
|
+
return {
|
|
118
|
+
id: row[0],
|
|
119
|
+
organizationId: row[1],
|
|
120
|
+
name: row[2],
|
|
121
|
+
description: row[3],
|
|
122
|
+
status: row[4],
|
|
123
|
+
createdAt: row[5],
|
|
124
|
+
updatedAt: row[6],
|
|
125
|
+
archivedAt: row[7]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
exports.archiveProjectQuery = `-- name: ArchiveProject :one
|
|
129
|
+
UPDATE weave_v1.project
|
|
130
|
+
SET status = 'archived',
|
|
131
|
+
archived_at = NOW(),
|
|
132
|
+
updated_at = NOW()
|
|
133
|
+
WHERE id = $1
|
|
134
|
+
RETURNING id, organization_id, name, description, status, created_at, updated_at, archived_at`;
|
|
135
|
+
async function archiveProject(client, args) {
|
|
136
|
+
const result = await client.query({
|
|
137
|
+
text: exports.archiveProjectQuery,
|
|
138
|
+
values: [args.id],
|
|
139
|
+
rowMode: "array"
|
|
140
|
+
});
|
|
141
|
+
if (result.rows.length !== 1) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const row = result.rows[0];
|
|
145
|
+
return {
|
|
146
|
+
id: row[0],
|
|
147
|
+
organizationId: row[1],
|
|
148
|
+
name: row[2],
|
|
149
|
+
description: row[3],
|
|
150
|
+
status: row[4],
|
|
151
|
+
createdAt: row[5],
|
|
152
|
+
updatedAt: row[6],
|
|
153
|
+
archivedAt: row[7]
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
exports.deleteProjectQuery = `-- name: DeleteProject :exec
|
|
157
|
+
DELETE
|
|
158
|
+
FROM weave_v1.project
|
|
159
|
+
WHERE id = $1`;
|
|
160
|
+
async function deleteProject(client, args) {
|
|
161
|
+
await client.query({
|
|
162
|
+
text: exports.deleteProjectQuery,
|
|
163
|
+
values: [args.id],
|
|
164
|
+
rowMode: "array"
|
|
165
|
+
});
|
|
166
|
+
}
|
|
@@ -2,7 +2,7 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
|
2
2
|
interface Client {
|
|
3
3
|
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
4
|
}
|
|
5
|
-
export declare const getStorageConnectionQuery = "-- name: GetStorageConnection :one\nSELECT id, organization_id, name, description, category, variant, details\nFROM storage_connection\nWHERE id = $1";
|
|
5
|
+
export declare const getStorageConnectionQuery = "-- name: GetStorageConnection :one\nSELECT id, organization_id, name, description, category, variant, details\nFROM weave.storage_connection\nWHERE id = $1";
|
|
6
6
|
export interface GetStorageConnectionArgs {
|
|
7
7
|
id: string;
|
|
8
8
|
}
|
|
@@ -16,7 +16,7 @@ export interface GetStorageConnectionRow {
|
|
|
16
16
|
details: any;
|
|
17
17
|
}
|
|
18
18
|
export declare function getStorageConnection(client: Client, args: GetStorageConnectionArgs): Promise<GetStorageConnectionRow | null>;
|
|
19
|
-
export declare const getStorageConnectionByDatasetIDQuery = "-- name: GetStorageConnectionByDatasetID :one\nSELECT sc.id, sc.organization_id, sc.name, sc.description, sc.category, sc.variant, sc.details\nFROM storage_connection sc\n JOIN generate_v1.dataset d ON d.storage_connection_id = sc.id\nWHERE d.id = $1";
|
|
19
|
+
export declare const getStorageConnectionByDatasetIDQuery = "-- name: GetStorageConnectionByDatasetID :one\nSELECT sc.id, sc.organization_id, sc.name, sc.description, sc.category, sc.variant, sc.details\nFROM weave.storage_connection sc\n JOIN generate_v1.dataset d ON d.storage_connection_id = sc.id\nWHERE d.id = $1";
|
|
20
20
|
export interface GetStorageConnectionByDatasetIDArgs {
|
|
21
21
|
datasetId: string;
|
|
22
22
|
}
|
|
@@ -5,7 +5,7 @@ exports.getStorageConnection = getStorageConnection;
|
|
|
5
5
|
exports.getStorageConnectionByDatasetID = getStorageConnectionByDatasetID;
|
|
6
6
|
exports.getStorageConnectionQuery = `-- name: GetStorageConnection :one
|
|
7
7
|
SELECT id, organization_id, name, description, category, variant, details
|
|
8
|
-
FROM storage_connection
|
|
8
|
+
FROM weave.storage_connection
|
|
9
9
|
WHERE id = $1`;
|
|
10
10
|
async function getStorageConnection(client, args) {
|
|
11
11
|
const result = await client.query({
|
|
@@ -29,7 +29,7 @@ async function getStorageConnection(client, args) {
|
|
|
29
29
|
}
|
|
30
30
|
exports.getStorageConnectionByDatasetIDQuery = `-- name: GetStorageConnectionByDatasetID :one
|
|
31
31
|
SELECT sc.id, sc.organization_id, sc.name, sc.description, sc.category, sc.variant, sc.details
|
|
32
|
-
FROM storage_connection sc
|
|
32
|
+
FROM weave.storage_connection sc
|
|
33
33
|
JOIN generate_v1.dataset d ON d.storage_connection_id = sc.id
|
|
34
34
|
WHERE d.id = $1`;
|
|
35
35
|
async function getStorageConnectionByDatasetID(client, args) {
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
2
|
+
interface Client {
|
|
3
|
+
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
|
+
}
|
|
5
|
+
export declare const createWorkflowQuery = "-- name: CreateWorkflow :one\nINSERT INTO weave_v1.workflow (\n id,\n project_id,\n name,\n description,\n status\n)\nVALUES (\n $1,\n $2,\n $3,\n $4,\n $5\n)\nRETURNING id, project_id, name, description, status, created_at, updated_at, archived_at";
|
|
6
|
+
export interface CreateWorkflowArgs {
|
|
7
|
+
id: string;
|
|
8
|
+
projectId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
status: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CreateWorkflowRow {
|
|
14
|
+
id: string;
|
|
15
|
+
projectId: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
status: string;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
archivedAt: Date | null;
|
|
22
|
+
}
|
|
23
|
+
export declare function createWorkflow(client: Client, args: CreateWorkflowArgs): Promise<CreateWorkflowRow | null>;
|
|
24
|
+
export declare const getWorkflowQuery = "-- name: GetWorkflow :one\nSELECT id, project_id, name, description, status, created_at, updated_at, archived_at\nFROM weave_v1.workflow\nWHERE id = $1\n AND project_id = $2";
|
|
25
|
+
export interface GetWorkflowArgs {
|
|
26
|
+
id: string;
|
|
27
|
+
projectId: string;
|
|
28
|
+
}
|
|
29
|
+
export interface GetWorkflowRow {
|
|
30
|
+
id: string;
|
|
31
|
+
projectId: string;
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
status: string;
|
|
35
|
+
createdAt: Date;
|
|
36
|
+
updatedAt: Date;
|
|
37
|
+
archivedAt: Date | null;
|
|
38
|
+
}
|
|
39
|
+
export declare function getWorkflow(client: Client, args: GetWorkflowArgs): Promise<GetWorkflowRow | null>;
|
|
40
|
+
export declare const listWorkflowsByProjectQuery = "-- name: ListWorkflowsByProject :many\nSELECT id, project_id, name, 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";
|
|
41
|
+
export interface ListWorkflowsByProjectArgs {
|
|
42
|
+
projectId: string;
|
|
43
|
+
includeArchived: boolean;
|
|
44
|
+
pageOffset: string;
|
|
45
|
+
pageSize: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ListWorkflowsByProjectRow {
|
|
48
|
+
id: string;
|
|
49
|
+
projectId: string;
|
|
50
|
+
name: string;
|
|
51
|
+
description: string;
|
|
52
|
+
status: string;
|
|
53
|
+
createdAt: Date;
|
|
54
|
+
updatedAt: Date;
|
|
55
|
+
archivedAt: Date | null;
|
|
56
|
+
}
|
|
57
|
+
export declare function listWorkflowsByProject(client: Client, args: ListWorkflowsByProjectArgs): Promise<ListWorkflowsByProjectRow[]>;
|
|
58
|
+
export declare const updateWorkflowQuery = "-- name: UpdateWorkflow :one\nUPDATE weave_v1.workflow\nSET name = $1,\n description = $2,\n status = $3,\n updated_at = NOW()\nWHERE id = $4\n AND project_id = $5\nRETURNING id, project_id, name, description, status, created_at, updated_at, archived_at";
|
|
59
|
+
export interface UpdateWorkflowArgs {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
status: string;
|
|
63
|
+
id: string;
|
|
64
|
+
projectId: string;
|
|
65
|
+
}
|
|
66
|
+
export interface UpdateWorkflowRow {
|
|
67
|
+
id: string;
|
|
68
|
+
projectId: string;
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
status: string;
|
|
72
|
+
createdAt: Date;
|
|
73
|
+
updatedAt: Date;
|
|
74
|
+
archivedAt: Date | null;
|
|
75
|
+
}
|
|
76
|
+
export declare function updateWorkflow(client: Client, args: UpdateWorkflowArgs): Promise<UpdateWorkflowRow | null>;
|
|
77
|
+
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, description, status, created_at, updated_at, archived_at";
|
|
78
|
+
export interface ArchiveWorkflowArgs {
|
|
79
|
+
id: string;
|
|
80
|
+
projectId: string;
|
|
81
|
+
}
|
|
82
|
+
export interface ArchiveWorkflowRow {
|
|
83
|
+
id: string;
|
|
84
|
+
projectId: string;
|
|
85
|
+
name: string;
|
|
86
|
+
description: string;
|
|
87
|
+
status: string;
|
|
88
|
+
createdAt: Date;
|
|
89
|
+
updatedAt: Date;
|
|
90
|
+
archivedAt: Date | null;
|
|
91
|
+
}
|
|
92
|
+
export declare function archiveWorkflow(client: Client, args: ArchiveWorkflowArgs): Promise<ArchiveWorkflowRow | null>;
|
|
93
|
+
export declare const deleteWorkflowQuery = "-- name: DeleteWorkflow :exec\nDELETE\nFROM weave_v1.workflow\nWHERE id = $1\n AND project_id = $2";
|
|
94
|
+
export interface DeleteWorkflowArgs {
|
|
95
|
+
id: string;
|
|
96
|
+
projectId: string;
|
|
97
|
+
}
|
|
98
|
+
export declare function deleteWorkflow(client: Client, args: DeleteWorkflowArgs): Promise<void>;
|
|
99
|
+
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";
|
|
100
|
+
export interface UpsertWorkflowStageStateArgs {
|
|
101
|
+
stage: string;
|
|
102
|
+
status: string;
|
|
103
|
+
blockedReason: string;
|
|
104
|
+
workflowId: string;
|
|
105
|
+
projectId: string;
|
|
106
|
+
}
|
|
107
|
+
export interface UpsertWorkflowStageStateRow {
|
|
108
|
+
workflowId: string;
|
|
109
|
+
stage: string;
|
|
110
|
+
status: string;
|
|
111
|
+
blockedReason: string;
|
|
112
|
+
updatedAt: Date;
|
|
113
|
+
}
|
|
114
|
+
export declare function upsertWorkflowStageState(client: Client, args: UpsertWorkflowStageStateArgs): Promise<UpsertWorkflowStageStateRow | null>;
|
|
115
|
+
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";
|
|
116
|
+
export interface GetWorkflowStageStateArgs {
|
|
117
|
+
workflowId: string;
|
|
118
|
+
projectId: string;
|
|
119
|
+
stage: string;
|
|
120
|
+
}
|
|
121
|
+
export interface GetWorkflowStageStateRow {
|
|
122
|
+
workflowId: string;
|
|
123
|
+
stage: string;
|
|
124
|
+
status: string;
|
|
125
|
+
blockedReason: string;
|
|
126
|
+
updatedAt: Date;
|
|
127
|
+
}
|
|
128
|
+
export declare function getWorkflowStageState(client: Client, args: GetWorkflowStageStateArgs): Promise<GetWorkflowStageStateRow | null>;
|
|
129
|
+
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";
|
|
130
|
+
export interface ListWorkflowStageStatesArgs {
|
|
131
|
+
workflowId: string;
|
|
132
|
+
projectId: string;
|
|
133
|
+
}
|
|
134
|
+
export interface ListWorkflowStageStatesRow {
|
|
135
|
+
workflowId: string;
|
|
136
|
+
stage: string;
|
|
137
|
+
status: string;
|
|
138
|
+
blockedReason: string;
|
|
139
|
+
updatedAt: Date;
|
|
140
|
+
}
|
|
141
|
+
export declare function listWorkflowStageStates(client: Client, args: ListWorkflowStageStatesArgs): Promise<ListWorkflowStageStatesRow[]>;
|
|
142
|
+
export {};
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listWorkflowStageStatesQuery = exports.getWorkflowStageStateQuery = exports.upsertWorkflowStageStateQuery = exports.deleteWorkflowQuery = exports.archiveWorkflowQuery = exports.updateWorkflowQuery = exports.listWorkflowsByProjectQuery = exports.getWorkflowQuery = exports.createWorkflowQuery = void 0;
|
|
4
|
+
exports.createWorkflow = createWorkflow;
|
|
5
|
+
exports.getWorkflow = getWorkflow;
|
|
6
|
+
exports.listWorkflowsByProject = listWorkflowsByProject;
|
|
7
|
+
exports.updateWorkflow = updateWorkflow;
|
|
8
|
+
exports.archiveWorkflow = archiveWorkflow;
|
|
9
|
+
exports.deleteWorkflow = deleteWorkflow;
|
|
10
|
+
exports.upsertWorkflowStageState = upsertWorkflowStageState;
|
|
11
|
+
exports.getWorkflowStageState = getWorkflowStageState;
|
|
12
|
+
exports.listWorkflowStageStates = listWorkflowStageStates;
|
|
13
|
+
exports.createWorkflowQuery = `-- name: CreateWorkflow :one
|
|
14
|
+
INSERT INTO weave_v1.workflow (
|
|
15
|
+
id,
|
|
16
|
+
project_id,
|
|
17
|
+
name,
|
|
18
|
+
description,
|
|
19
|
+
status
|
|
20
|
+
)
|
|
21
|
+
VALUES (
|
|
22
|
+
$1,
|
|
23
|
+
$2,
|
|
24
|
+
$3,
|
|
25
|
+
$4,
|
|
26
|
+
$5
|
|
27
|
+
)
|
|
28
|
+
RETURNING id, project_id, name, description, status, created_at, updated_at, archived_at`;
|
|
29
|
+
async function createWorkflow(client, args) {
|
|
30
|
+
const result = await client.query({
|
|
31
|
+
text: exports.createWorkflowQuery,
|
|
32
|
+
values: [args.id, args.projectId, args.name, args.description, args.status],
|
|
33
|
+
rowMode: "array"
|
|
34
|
+
});
|
|
35
|
+
if (result.rows.length !== 1) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const row = result.rows[0];
|
|
39
|
+
return {
|
|
40
|
+
id: row[0],
|
|
41
|
+
projectId: row[1],
|
|
42
|
+
name: row[2],
|
|
43
|
+
description: row[3],
|
|
44
|
+
status: row[4],
|
|
45
|
+
createdAt: row[5],
|
|
46
|
+
updatedAt: row[6],
|
|
47
|
+
archivedAt: row[7]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
exports.getWorkflowQuery = `-- name: GetWorkflow :one
|
|
51
|
+
SELECT id, project_id, name, description, status, created_at, updated_at, archived_at
|
|
52
|
+
FROM weave_v1.workflow
|
|
53
|
+
WHERE id = $1
|
|
54
|
+
AND project_id = $2`;
|
|
55
|
+
async function getWorkflow(client, args) {
|
|
56
|
+
const result = await client.query({
|
|
57
|
+
text: exports.getWorkflowQuery,
|
|
58
|
+
values: [args.id, args.projectId],
|
|
59
|
+
rowMode: "array"
|
|
60
|
+
});
|
|
61
|
+
if (result.rows.length !== 1) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const row = result.rows[0];
|
|
65
|
+
return {
|
|
66
|
+
id: row[0],
|
|
67
|
+
projectId: row[1],
|
|
68
|
+
name: row[2],
|
|
69
|
+
description: row[3],
|
|
70
|
+
status: row[4],
|
|
71
|
+
createdAt: row[5],
|
|
72
|
+
updatedAt: row[6],
|
|
73
|
+
archivedAt: row[7]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
exports.listWorkflowsByProjectQuery = `-- name: ListWorkflowsByProject :many
|
|
77
|
+
SELECT id, project_id, name, description, status, created_at, updated_at, archived_at
|
|
78
|
+
FROM weave_v1.workflow
|
|
79
|
+
WHERE project_id = $1
|
|
80
|
+
AND ($2::BOOLEAN OR archived_at IS NULL)
|
|
81
|
+
ORDER BY updated_at DESC
|
|
82
|
+
LIMIT $4
|
|
83
|
+
OFFSET $3`;
|
|
84
|
+
async function listWorkflowsByProject(client, args) {
|
|
85
|
+
const result = await client.query({
|
|
86
|
+
text: exports.listWorkflowsByProjectQuery,
|
|
87
|
+
values: [args.projectId, args.includeArchived, args.pageOffset, args.pageSize],
|
|
88
|
+
rowMode: "array"
|
|
89
|
+
});
|
|
90
|
+
return result.rows.map(row => {
|
|
91
|
+
return {
|
|
92
|
+
id: row[0],
|
|
93
|
+
projectId: row[1],
|
|
94
|
+
name: row[2],
|
|
95
|
+
description: row[3],
|
|
96
|
+
status: row[4],
|
|
97
|
+
createdAt: row[5],
|
|
98
|
+
updatedAt: row[6],
|
|
99
|
+
archivedAt: row[7]
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
exports.updateWorkflowQuery = `-- name: UpdateWorkflow :one
|
|
104
|
+
UPDATE weave_v1.workflow
|
|
105
|
+
SET name = $1,
|
|
106
|
+
description = $2,
|
|
107
|
+
status = $3,
|
|
108
|
+
updated_at = NOW()
|
|
109
|
+
WHERE id = $4
|
|
110
|
+
AND project_id = $5
|
|
111
|
+
RETURNING id, project_id, name, description, status, created_at, updated_at, archived_at`;
|
|
112
|
+
async function updateWorkflow(client, args) {
|
|
113
|
+
const result = await client.query({
|
|
114
|
+
text: exports.updateWorkflowQuery,
|
|
115
|
+
values: [args.name, args.description, args.status, args.id, args.projectId],
|
|
116
|
+
rowMode: "array"
|
|
117
|
+
});
|
|
118
|
+
if (result.rows.length !== 1) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
const row = result.rows[0];
|
|
122
|
+
return {
|
|
123
|
+
id: row[0],
|
|
124
|
+
projectId: row[1],
|
|
125
|
+
name: row[2],
|
|
126
|
+
description: row[3],
|
|
127
|
+
status: row[4],
|
|
128
|
+
createdAt: row[5],
|
|
129
|
+
updatedAt: row[6],
|
|
130
|
+
archivedAt: row[7]
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
exports.archiveWorkflowQuery = `-- name: ArchiveWorkflow :one
|
|
134
|
+
UPDATE weave_v1.workflow
|
|
135
|
+
SET status = 'archived',
|
|
136
|
+
archived_at = NOW(),
|
|
137
|
+
updated_at = NOW()
|
|
138
|
+
WHERE id = $1
|
|
139
|
+
AND project_id = $2
|
|
140
|
+
RETURNING id, project_id, name, description, status, created_at, updated_at, archived_at`;
|
|
141
|
+
async function archiveWorkflow(client, args) {
|
|
142
|
+
const result = await client.query({
|
|
143
|
+
text: exports.archiveWorkflowQuery,
|
|
144
|
+
values: [args.id, args.projectId],
|
|
145
|
+
rowMode: "array"
|
|
146
|
+
});
|
|
147
|
+
if (result.rows.length !== 1) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const row = result.rows[0];
|
|
151
|
+
return {
|
|
152
|
+
id: row[0],
|
|
153
|
+
projectId: row[1],
|
|
154
|
+
name: row[2],
|
|
155
|
+
description: row[3],
|
|
156
|
+
status: row[4],
|
|
157
|
+
createdAt: row[5],
|
|
158
|
+
updatedAt: row[6],
|
|
159
|
+
archivedAt: row[7]
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
exports.deleteWorkflowQuery = `-- name: DeleteWorkflow :exec
|
|
163
|
+
DELETE
|
|
164
|
+
FROM weave_v1.workflow
|
|
165
|
+
WHERE id = $1
|
|
166
|
+
AND project_id = $2`;
|
|
167
|
+
async function deleteWorkflow(client, args) {
|
|
168
|
+
await client.query({
|
|
169
|
+
text: exports.deleteWorkflowQuery,
|
|
170
|
+
values: [args.id, args.projectId],
|
|
171
|
+
rowMode: "array"
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
exports.upsertWorkflowStageStateQuery = `-- name: UpsertWorkflowStageState :one
|
|
175
|
+
INSERT INTO weave_v1.workflow_stage_state (
|
|
176
|
+
workflow_id,
|
|
177
|
+
stage,
|
|
178
|
+
status,
|
|
179
|
+
blocked_reason,
|
|
180
|
+
updated_at
|
|
181
|
+
)
|
|
182
|
+
SELECT w.id,
|
|
183
|
+
$1,
|
|
184
|
+
$2,
|
|
185
|
+
$3,
|
|
186
|
+
NOW()
|
|
187
|
+
FROM weave_v1.workflow w
|
|
188
|
+
WHERE w.id = $4
|
|
189
|
+
AND w.project_id = $5
|
|
190
|
+
ON CONFLICT (workflow_id, stage) DO UPDATE
|
|
191
|
+
SET status = EXCLUDED.status,
|
|
192
|
+
blocked_reason = EXCLUDED.blocked_reason,
|
|
193
|
+
updated_at = NOW()
|
|
194
|
+
RETURNING workflow_id, stage, status, blocked_reason, updated_at`;
|
|
195
|
+
async function upsertWorkflowStageState(client, args) {
|
|
196
|
+
const result = await client.query({
|
|
197
|
+
text: exports.upsertWorkflowStageStateQuery,
|
|
198
|
+
values: [args.stage, args.status, args.blockedReason, args.workflowId, args.projectId],
|
|
199
|
+
rowMode: "array"
|
|
200
|
+
});
|
|
201
|
+
if (result.rows.length !== 1) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
const row = result.rows[0];
|
|
205
|
+
return {
|
|
206
|
+
workflowId: row[0],
|
|
207
|
+
stage: row[1],
|
|
208
|
+
status: row[2],
|
|
209
|
+
blockedReason: row[3],
|
|
210
|
+
updatedAt: row[4]
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
exports.getWorkflowStageStateQuery = `-- name: GetWorkflowStageState :one
|
|
214
|
+
SELECT s.workflow_id, s.stage, s.status, s.blocked_reason, s.updated_at
|
|
215
|
+
FROM weave_v1.workflow_stage_state s
|
|
216
|
+
INNER JOIN weave_v1.workflow w ON w.id = s.workflow_id
|
|
217
|
+
WHERE s.workflow_id = $1
|
|
218
|
+
AND w.project_id = $2
|
|
219
|
+
AND s.stage = $3`;
|
|
220
|
+
async function getWorkflowStageState(client, args) {
|
|
221
|
+
const result = await client.query({
|
|
222
|
+
text: exports.getWorkflowStageStateQuery,
|
|
223
|
+
values: [args.workflowId, args.projectId, args.stage],
|
|
224
|
+
rowMode: "array"
|
|
225
|
+
});
|
|
226
|
+
if (result.rows.length !== 1) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
const row = result.rows[0];
|
|
230
|
+
return {
|
|
231
|
+
workflowId: row[0],
|
|
232
|
+
stage: row[1],
|
|
233
|
+
status: row[2],
|
|
234
|
+
blockedReason: row[3],
|
|
235
|
+
updatedAt: row[4]
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
exports.listWorkflowStageStatesQuery = `-- name: ListWorkflowStageStates :many
|
|
239
|
+
SELECT s.workflow_id, s.stage, s.status, s.blocked_reason, s.updated_at
|
|
240
|
+
FROM weave_v1.workflow_stage_state s
|
|
241
|
+
INNER JOIN weave_v1.workflow w ON w.id = s.workflow_id
|
|
242
|
+
WHERE s.workflow_id = $1
|
|
243
|
+
AND w.project_id = $2
|
|
244
|
+
ORDER BY s.stage`;
|
|
245
|
+
async function listWorkflowStageStates(client, args) {
|
|
246
|
+
const result = await client.query({
|
|
247
|
+
text: exports.listWorkflowStageStatesQuery,
|
|
248
|
+
values: [args.workflowId, args.projectId],
|
|
249
|
+
rowMode: "array"
|
|
250
|
+
});
|
|
251
|
+
return result.rows.map(row => {
|
|
252
|
+
return {
|
|
253
|
+
workflowId: row[0],
|
|
254
|
+
stage: row[1],
|
|
255
|
+
status: row[2],
|
|
256
|
+
blockedReason: row[3],
|
|
257
|
+
updatedAt: row[4]
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
}
|