weave-typescript 0.12.0 → 0.14.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.
- package/dist/google/api/annotations.pb.js +1 -1
- package/dist/google/api/http.pb.js +1 -1
- package/dist/google/protobuf/descriptor.pb.d.ts +8 -1
- package/dist/google/protobuf/descriptor.pb.js +8 -1
- package/dist/google/protobuf/struct.pb.js +1 -1
- package/dist/google/protobuf/timestamp.pb.d.ts +7 -6
- package/dist/google/protobuf/timestamp.pb.js +1 -1
- package/dist/index.d.ts +9 -16
- package/dist/index.js +13 -21
- package/dist/weaveapi/{storage/v1/auth.pb.d.ts → atc/v1/event.pb.d.ts} +12 -6
- package/dist/weaveapi/atc/v1/event.pb.js +263 -0
- package/dist/weaveapi/{auth/v1/session.pb.d.ts → atc/v1/message.pb.d.ts} +22 -21
- package/dist/weaveapi/atc/v1/message.pb.js +287 -0
- package/dist/weaveapi/atc/v1/process.pb.d.ts +91 -0
- package/dist/weaveapi/atc/v1/process.pb.js +658 -0
- package/dist/weaveapi/atc/v1/run.pb.d.ts +71 -0
- package/dist/weaveapi/atc/v1/run.pb.js +525 -0
- package/dist/weaveapi/atc/v1/service.pb.d.ts +339 -0
- package/dist/weaveapi/atc/v1/service.pb.js +1922 -0
- package/dist/weaveapi/project/v1/project.pb.d.ts +67 -5
- package/dist/weaveapi/project/v1/project.pb.js +765 -66
- package/dist/weaveapi/project/v1/service.pb.d.ts +117 -76
- package/dist/weaveapi/project/v1/service.pb.js +1088 -401
- package/dist/weaveapi/task/v1/service.pb.d.ts +171 -0
- package/dist/weaveapi/task/v1/service.pb.js +1416 -0
- package/dist/weaveapi/task/v1/task.pb.d.ts +84 -0
- package/dist/weaveapi/task/v1/task.pb.js +782 -0
- package/dist/weavesql/atcdb/event_sql.d.ts +101 -0
- package/dist/weavesql/atcdb/event_sql.js +191 -0
- package/dist/weavesql/atcdb/mailbox_sql.d.ts +43 -0
- package/dist/weavesql/atcdb/mailbox_sql.js +85 -0
- package/dist/weavesql/weavedb/project_sql.d.ts +121 -46
- package/dist/weavesql/weavedb/project_sql.js +304 -112
- package/dist/weavesql/weavedb/task_sql.d.ts +163 -0
- package/dist/weavesql/weavedb/task_sql.js +328 -0
- package/package.json +1 -1
- package/dist/weaveapi/auth/v1/service.pb.d.ts +0 -709
- package/dist/weaveapi/auth/v1/service.pb.js +0 -4977
- package/dist/weaveapi/auth/v1/session.pb.js +0 -308
- package/dist/weaveapi/auth/v1/usage.pb.d.ts +0 -76
- package/dist/weaveapi/auth/v1/usage.pb.js +0 -849
- package/dist/weaveapi/auth/v1/user.pb.d.ts +0 -141
- package/dist/weaveapi/auth/v1/user.pb.js +0 -1625
- package/dist/weaveapi/data/v1/data.pb.d.ts +0 -54
- package/dist/weaveapi/data/v1/data.pb.js +0 -411
- package/dist/weaveapi/data/v1/service.pb.d.ts +0 -296
- package/dist/weaveapi/data/v1/service.pb.js +0 -2777
- package/dist/weaveapi/generate/v1/configuration.pb.d.ts +0 -122
- package/dist/weaveapi/generate/v1/configuration.pb.js +0 -877
- package/dist/weaveapi/generate/v1/generate.pb.d.ts +0 -48
- package/dist/weaveapi/generate/v1/generate.pb.js +0 -367
- package/dist/weaveapi/generate/v1/service.pb.d.ts +0 -173
- package/dist/weaveapi/generate/v1/service.pb.js +0 -1207
- package/dist/weaveapi/input/v1/input.pb.d.ts +0 -77
- package/dist/weaveapi/input/v1/input.pb.js +0 -632
- package/dist/weaveapi/input/v1/service.pb.d.ts +0 -390
- package/dist/weaveapi/input/v1/service.pb.js +0 -3610
- package/dist/weaveapi/integration/v1/integration.pb.d.ts +0 -67
- package/dist/weaveapi/integration/v1/integration.pb.js +0 -486
- package/dist/weaveapi/integration/v1/service.pb.d.ts +0 -318
- package/dist/weaveapi/integration/v1/service.pb.js +0 -2992
- package/dist/weaveapi/llmx/v1/architecture.pb.d.ts +0 -665
- package/dist/weaveapi/llmx/v1/architecture.pb.js +0 -3028
- package/dist/weaveapi/llmx/v1/capabilities.pb.d.ts +0 -709
- package/dist/weaveapi/llmx/v1/capabilities.pb.js +0 -3458
- package/dist/weaveapi/llmx/v1/model.pb.d.ts +0 -375
- package/dist/weaveapi/llmx/v1/model.pb.js +0 -1472
- package/dist/weaveapi/llmx/v1/pricing.pb.d.ts +0 -340
- package/dist/weaveapi/llmx/v1/pricing.pb.js +0 -974
- package/dist/weaveapi/llmx/v1/provider.pb.d.ts +0 -72
- package/dist/weaveapi/llmx/v1/provider.pb.js +0 -218
- package/dist/weaveapi/llmx/v1/service.pb.d.ts +0 -683
- package/dist/weaveapi/llmx/v1/service.pb.js +0 -5266
- package/dist/weaveapi/mcpregistry/v1/server.pb.d.ts +0 -54
- package/dist/weaveapi/mcpregistry/v1/server.pb.js +0 -436
- package/dist/weaveapi/mcpregistry/v1/service.pb.d.ts +0 -171
- package/dist/weaveapi/mcpregistry/v1/service.pb.js +0 -963
- package/dist/weaveapi/payment/v1/invoice.pb.d.ts +0 -92
- package/dist/weaveapi/payment/v1/invoice.pb.js +0 -998
- package/dist/weaveapi/payment/v1/service.pb.d.ts +0 -662
- package/dist/weaveapi/payment/v1/service.pb.js +0 -5395
- package/dist/weaveapi/payment/v1/subscription.pb.d.ts +0 -165
- package/dist/weaveapi/payment/v1/subscription.pb.js +0 -1930
- package/dist/weaveapi/report/v1/report.pb.d.ts +0 -81
- package/dist/weaveapi/report/v1/report.pb.js +0 -678
- package/dist/weaveapi/report/v1/service.pb.d.ts +0 -194
- package/dist/weaveapi/report/v1/service.pb.js +0 -1923
- package/dist/weaveapi/requirement/v1/requirement.pb.d.ts +0 -70
- package/dist/weaveapi/requirement/v1/requirement.pb.js +0 -570
- package/dist/weaveapi/requirement/v1/service.pb.d.ts +0 -390
- package/dist/weaveapi/requirement/v1/service.pb.js +0 -3636
- package/dist/weaveapi/run/v1/run.pb.d.ts +0 -117
- package/dist/weaveapi/run/v1/run.pb.js +0 -1155
- package/dist/weaveapi/run/v1/service.pb.d.ts +0 -229
- package/dist/weaveapi/run/v1/service.pb.js +0 -2426
- package/dist/weaveapi/script/v1/script.pb.d.ts +0 -102
- package/dist/weaveapi/script/v1/script.pb.js +0 -1025
- package/dist/weaveapi/script/v1/service.pb.d.ts +0 -502
- package/dist/weaveapi/script/v1/service.pb.js +0 -4871
- package/dist/weaveapi/storage/v1/auth.pb.js +0 -110
- package/dist/weaveapi/storage/v1/nosql_database.pb.d.ts +0 -91
- package/dist/weaveapi/storage/v1/nosql_database.pb.js +0 -1056
- package/dist/weaveapi/storage/v1/object_store.pb.d.ts +0 -49
- package/dist/weaveapi/storage/v1/object_store.pb.js +0 -441
- package/dist/weaveapi/storage/v1/service.pb.d.ts +0 -245
- package/dist/weaveapi/storage/v1/service.pb.js +0 -1339
- package/dist/weaveapi/storage/v1/sql_database.pb.d.ts +0 -98
- package/dist/weaveapi/storage/v1/sql_database.pb.js +0 -1184
- package/dist/weaveapi/storage/v1/storage.pb.d.ts +0 -35
- package/dist/weaveapi/storage/v1/storage.pb.js +0 -198
- package/dist/weaveapi/storage/v1/vcs.pb.d.ts +0 -75
- package/dist/weaveapi/storage/v1/vcs.pb.js +0 -864
- package/dist/weaveapi/suite/v1/service.pb.d.ts +0 -539
- package/dist/weaveapi/suite/v1/service.pb.js +0 -5279
- package/dist/weaveapi/suite/v1/suite.pb.d.ts +0 -92
- package/dist/weaveapi/suite/v1/suite.pb.js +0 -876
- package/dist/weaveapi/synthesize/v1/dataset.pb.d.ts +0 -68
- package/dist/weaveapi/synthesize/v1/dataset.pb.js +0 -460
- package/dist/weaveapi/synthesize/v1/inline_data.pb.d.ts +0 -45
- package/dist/weaveapi/synthesize/v1/inline_data.pb.js +0 -166
- package/dist/weaveapi/synthesize/v1/relationship.pb.d.ts +0 -58
- package/dist/weaveapi/synthesize/v1/relationship.pb.js +0 -253
- package/dist/weaveapi/synthesize/v1/service.pb.d.ts +0 -144
- package/dist/weaveapi/synthesize/v1/service.pb.js +0 -917
- package/dist/weaveapi/synthesize/v1/training.pb.d.ts +0 -58
- package/dist/weaveapi/synthesize/v1/training.pb.js +0 -386
- package/dist/weaveapi/testcase/v1/service.pb.d.ts +0 -498
- package/dist/weaveapi/testcase/v1/service.pb.js +0 -4728
- package/dist/weaveapi/testcase/v1/testcase.pb.d.ts +0 -91
- package/dist/weaveapi/testcase/v1/testcase.pb.js +0 -794
- package/dist/weaveapi/workflow/v1/service.pb.d.ts +0 -261
- package/dist/weaveapi/workflow/v1/service.pb.js +0 -2120
- package/dist/weaveapi/workflow/v1/workflow.pb.d.ts +0 -77
- package/dist/weaveapi/workflow/v1/workflow.pb.js +0 -555
- package/dist/weaveapi/workflowdata/v1/service.pb.d.ts +0 -295
- package/dist/weaveapi/workflowdata/v1/service.pb.js +0 -2612
|
@@ -1,35 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.listProjectActivityQuery = exports.listProjectPermissionsQuery = exports.updateProjectBySlugQuery = exports.listProjectsQuery = exports.getProjectBySlugQuery = exports.getProjectByIDQuery = exports.createProjectQuery = void 0;
|
|
4
4
|
exports.createProject = createProject;
|
|
5
|
-
exports.
|
|
5
|
+
exports.getProjectByID = getProjectByID;
|
|
6
6
|
exports.getProjectBySlug = getProjectBySlug;
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
7
|
+
exports.listProjects = listProjects;
|
|
8
|
+
exports.updateProjectBySlug = updateProjectBySlug;
|
|
9
|
+
exports.listProjectPermissions = listProjectPermissions;
|
|
10
|
+
exports.listProjectActivity = listProjectActivity;
|
|
11
11
|
exports.createProjectQuery = `-- name: CreateProject :one
|
|
12
|
-
INSERT INTO
|
|
12
|
+
INSERT INTO weave.projects (
|
|
13
13
|
id,
|
|
14
14
|
organization_id,
|
|
15
|
-
name,
|
|
16
15
|
slug,
|
|
16
|
+
name,
|
|
17
|
+
summary,
|
|
17
18
|
description,
|
|
18
|
-
status
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
status,
|
|
20
|
+
owner_user_id,
|
|
21
|
+
creator_user_id,
|
|
22
|
+
workspace_id,
|
|
23
|
+
git_repository,
|
|
24
|
+
start_date,
|
|
25
|
+
target_date,
|
|
26
|
+
source_system,
|
|
27
|
+
source_id,
|
|
28
|
+
source_metadata
|
|
29
|
+
) VALUES (
|
|
21
30
|
$1,
|
|
22
31
|
$2,
|
|
23
32
|
$3,
|
|
24
33
|
$4,
|
|
25
34
|
$5,
|
|
26
|
-
$6
|
|
35
|
+
$6,
|
|
36
|
+
$7,
|
|
37
|
+
$8,
|
|
38
|
+
$9,
|
|
39
|
+
$10,
|
|
40
|
+
$11,
|
|
41
|
+
$12,
|
|
42
|
+
$13,
|
|
43
|
+
$14,
|
|
44
|
+
$15,
|
|
45
|
+
$16
|
|
27
46
|
)
|
|
28
|
-
RETURNING
|
|
47
|
+
RETURNING
|
|
48
|
+
id,
|
|
49
|
+
organization_id,
|
|
50
|
+
slug,
|
|
51
|
+
name,
|
|
52
|
+
summary,
|
|
53
|
+
description,
|
|
54
|
+
status,
|
|
55
|
+
owner_user_id,
|
|
56
|
+
creator_user_id,
|
|
57
|
+
workspace_id,
|
|
58
|
+
git_repository,
|
|
59
|
+
start_date,
|
|
60
|
+
target_date,
|
|
61
|
+
source_system,
|
|
62
|
+
source_id,
|
|
63
|
+
source_metadata,
|
|
64
|
+
created_at,
|
|
65
|
+
updated_at`;
|
|
29
66
|
async function createProject(client, args) {
|
|
30
67
|
const result = await client.query({
|
|
31
68
|
text: exports.createProjectQuery,
|
|
32
|
-
values: [args.id, args.organizationId, args.name, args.
|
|
69
|
+
values: [args.id, args.organizationId, args.slug, args.name, args.summary, args.description, args.status, args.ownerUserId, args.creatorUserId, args.workspaceId, args.gitRepository, args.startDate, args.targetDate, args.sourceSystem, args.sourceId, args.sourceMetadata],
|
|
33
70
|
rowMode: "array"
|
|
34
71
|
});
|
|
35
72
|
if (result.rows.length !== 1) {
|
|
@@ -39,23 +76,51 @@ async function createProject(client, args) {
|
|
|
39
76
|
return {
|
|
40
77
|
id: row[0],
|
|
41
78
|
organizationId: row[1],
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
79
|
+
slug: row[2],
|
|
80
|
+
name: row[3],
|
|
81
|
+
summary: row[4],
|
|
82
|
+
description: row[5],
|
|
83
|
+
status: row[6],
|
|
84
|
+
ownerUserId: row[7],
|
|
85
|
+
creatorUserId: row[8],
|
|
86
|
+
workspaceId: row[9],
|
|
87
|
+
gitRepository: row[10],
|
|
88
|
+
startDate: row[11],
|
|
89
|
+
targetDate: row[12],
|
|
90
|
+
sourceSystem: row[13],
|
|
91
|
+
sourceId: row[14],
|
|
92
|
+
sourceMetadata: row[15],
|
|
93
|
+
createdAt: row[16],
|
|
94
|
+
updatedAt: row[17]
|
|
49
95
|
};
|
|
50
96
|
}
|
|
51
|
-
exports.
|
|
52
|
-
SELECT
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
97
|
+
exports.getProjectByIDQuery = `-- name: GetProjectByID :one
|
|
98
|
+
SELECT
|
|
99
|
+
id,
|
|
100
|
+
organization_id,
|
|
101
|
+
slug,
|
|
102
|
+
name,
|
|
103
|
+
summary,
|
|
104
|
+
description,
|
|
105
|
+
status,
|
|
106
|
+
owner_user_id,
|
|
107
|
+
creator_user_id,
|
|
108
|
+
workspace_id,
|
|
109
|
+
git_repository,
|
|
110
|
+
start_date,
|
|
111
|
+
target_date,
|
|
112
|
+
source_system,
|
|
113
|
+
source_id,
|
|
114
|
+
source_metadata,
|
|
115
|
+
created_at,
|
|
116
|
+
updated_at
|
|
117
|
+
FROM weave.projects
|
|
118
|
+
WHERE organization_id = $1
|
|
119
|
+
AND id = $2`;
|
|
120
|
+
async function getProjectByID(client, args) {
|
|
56
121
|
const result = await client.query({
|
|
57
|
-
text: exports.
|
|
58
|
-
values: [args.id],
|
|
122
|
+
text: exports.getProjectByIDQuery,
|
|
123
|
+
values: [args.organizationId, args.id],
|
|
59
124
|
rowMode: "array"
|
|
60
125
|
});
|
|
61
126
|
if (result.rows.length !== 1) {
|
|
@@ -65,24 +130,51 @@ async function getProject(client, args) {
|
|
|
65
130
|
return {
|
|
66
131
|
id: row[0],
|
|
67
132
|
organizationId: row[1],
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
133
|
+
slug: row[2],
|
|
134
|
+
name: row[3],
|
|
135
|
+
summary: row[4],
|
|
136
|
+
description: row[5],
|
|
137
|
+
status: row[6],
|
|
138
|
+
ownerUserId: row[7],
|
|
139
|
+
creatorUserId: row[8],
|
|
140
|
+
workspaceId: row[9],
|
|
141
|
+
gitRepository: row[10],
|
|
142
|
+
startDate: row[11],
|
|
143
|
+
targetDate: row[12],
|
|
144
|
+
sourceSystem: row[13],
|
|
145
|
+
sourceId: row[14],
|
|
146
|
+
sourceMetadata: row[15],
|
|
147
|
+
createdAt: row[16],
|
|
148
|
+
updatedAt: row[17]
|
|
75
149
|
};
|
|
76
150
|
}
|
|
77
151
|
exports.getProjectBySlugQuery = `-- name: GetProjectBySlug :one
|
|
78
|
-
SELECT
|
|
79
|
-
|
|
152
|
+
SELECT
|
|
153
|
+
id,
|
|
154
|
+
organization_id,
|
|
155
|
+
slug,
|
|
156
|
+
name,
|
|
157
|
+
summary,
|
|
158
|
+
description,
|
|
159
|
+
status,
|
|
160
|
+
owner_user_id,
|
|
161
|
+
creator_user_id,
|
|
162
|
+
workspace_id,
|
|
163
|
+
git_repository,
|
|
164
|
+
start_date,
|
|
165
|
+
target_date,
|
|
166
|
+
source_system,
|
|
167
|
+
source_id,
|
|
168
|
+
source_metadata,
|
|
169
|
+
created_at,
|
|
170
|
+
updated_at
|
|
171
|
+
FROM weave.projects
|
|
80
172
|
WHERE organization_id = $1
|
|
81
173
|
AND slug = $2`;
|
|
82
174
|
async function getProjectBySlug(client, args) {
|
|
83
175
|
const result = await client.query({
|
|
84
176
|
text: exports.getProjectBySlugQuery,
|
|
85
|
-
values: [args.organizationId, args.
|
|
177
|
+
values: [args.organizationId, args.projectSlug],
|
|
86
178
|
rowMode: "array"
|
|
87
179
|
});
|
|
88
180
|
if (result.rows.length !== 1) {
|
|
@@ -92,56 +184,116 @@ async function getProjectBySlug(client, args) {
|
|
|
92
184
|
return {
|
|
93
185
|
id: row[0],
|
|
94
186
|
organizationId: row[1],
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
187
|
+
slug: row[2],
|
|
188
|
+
name: row[3],
|
|
189
|
+
summary: row[4],
|
|
190
|
+
description: row[5],
|
|
191
|
+
status: row[6],
|
|
192
|
+
ownerUserId: row[7],
|
|
193
|
+
creatorUserId: row[8],
|
|
194
|
+
workspaceId: row[9],
|
|
195
|
+
gitRepository: row[10],
|
|
196
|
+
startDate: row[11],
|
|
197
|
+
targetDate: row[12],
|
|
198
|
+
sourceSystem: row[13],
|
|
199
|
+
sourceId: row[14],
|
|
200
|
+
sourceMetadata: row[15],
|
|
201
|
+
createdAt: row[16],
|
|
202
|
+
updatedAt: row[17]
|
|
102
203
|
};
|
|
103
204
|
}
|
|
104
|
-
exports.
|
|
105
|
-
SELECT
|
|
106
|
-
|
|
205
|
+
exports.listProjectsQuery = `-- name: ListProjects :many
|
|
206
|
+
SELECT
|
|
207
|
+
id,
|
|
208
|
+
organization_id,
|
|
209
|
+
slug,
|
|
210
|
+
name,
|
|
211
|
+
summary,
|
|
212
|
+
description,
|
|
213
|
+
status,
|
|
214
|
+
owner_user_id,
|
|
215
|
+
creator_user_id,
|
|
216
|
+
workspace_id,
|
|
217
|
+
git_repository,
|
|
218
|
+
start_date,
|
|
219
|
+
target_date,
|
|
220
|
+
source_system,
|
|
221
|
+
source_id,
|
|
222
|
+
source_metadata,
|
|
223
|
+
created_at,
|
|
224
|
+
updated_at
|
|
225
|
+
FROM weave.projects
|
|
107
226
|
WHERE organization_id = $1
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
LIMIT $4
|
|
111
|
-
OFFSET $3`;
|
|
112
|
-
async function listProjectsByOrganization(client, args) {
|
|
227
|
+
ORDER BY updated_at DESC, created_at DESC`;
|
|
228
|
+
async function listProjects(client, args) {
|
|
113
229
|
const result = await client.query({
|
|
114
|
-
text: exports.
|
|
115
|
-
values: [args.organizationId
|
|
230
|
+
text: exports.listProjectsQuery,
|
|
231
|
+
values: [args.organizationId],
|
|
116
232
|
rowMode: "array"
|
|
117
233
|
});
|
|
118
234
|
return result.rows.map(row => {
|
|
119
235
|
return {
|
|
120
236
|
id: row[0],
|
|
121
237
|
organizationId: row[1],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
238
|
+
slug: row[2],
|
|
239
|
+
name: row[3],
|
|
240
|
+
summary: row[4],
|
|
241
|
+
description: row[5],
|
|
242
|
+
status: row[6],
|
|
243
|
+
ownerUserId: row[7],
|
|
244
|
+
creatorUserId: row[8],
|
|
245
|
+
workspaceId: row[9],
|
|
246
|
+
gitRepository: row[10],
|
|
247
|
+
startDate: row[11],
|
|
248
|
+
targetDate: row[12],
|
|
249
|
+
sourceSystem: row[13],
|
|
250
|
+
sourceId: row[14],
|
|
251
|
+
sourceMetadata: row[15],
|
|
252
|
+
createdAt: row[16],
|
|
253
|
+
updatedAt: row[17]
|
|
129
254
|
};
|
|
130
255
|
});
|
|
131
256
|
}
|
|
132
|
-
exports.
|
|
133
|
-
UPDATE
|
|
134
|
-
SET
|
|
135
|
-
|
|
257
|
+
exports.updateProjectBySlugQuery = `-- name: UpdateProjectBySlug :one
|
|
258
|
+
UPDATE weave.projects
|
|
259
|
+
SET
|
|
260
|
+
name = $1,
|
|
261
|
+
summary = $2,
|
|
136
262
|
description = $3,
|
|
137
263
|
status = $4,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
264
|
+
workspace_id = $5,
|
|
265
|
+
git_repository = $6,
|
|
266
|
+
start_date = $7,
|
|
267
|
+
target_date = $8,
|
|
268
|
+
source_system = $9,
|
|
269
|
+
source_id = $10,
|
|
270
|
+
source_metadata = $11,
|
|
271
|
+
updated_at = now()
|
|
272
|
+
WHERE organization_id = $12
|
|
273
|
+
AND slug = $13
|
|
274
|
+
RETURNING
|
|
275
|
+
id,
|
|
276
|
+
organization_id,
|
|
277
|
+
slug,
|
|
278
|
+
name,
|
|
279
|
+
summary,
|
|
280
|
+
description,
|
|
281
|
+
status,
|
|
282
|
+
owner_user_id,
|
|
283
|
+
creator_user_id,
|
|
284
|
+
workspace_id,
|
|
285
|
+
git_repository,
|
|
286
|
+
start_date,
|
|
287
|
+
target_date,
|
|
288
|
+
source_system,
|
|
289
|
+
source_id,
|
|
290
|
+
source_metadata,
|
|
291
|
+
created_at,
|
|
292
|
+
updated_at`;
|
|
293
|
+
async function updateProjectBySlug(client, args) {
|
|
142
294
|
const result = await client.query({
|
|
143
|
-
text: exports.
|
|
144
|
-
values: [args.name, args.
|
|
295
|
+
text: exports.updateProjectBySlugQuery,
|
|
296
|
+
values: [args.name, args.summary, args.description, args.status, args.workspaceId, args.gitRepository, args.startDate, args.targetDate, args.sourceSystem, args.sourceId, args.sourceMetadata, args.organizationId, args.projectSlug],
|
|
145
297
|
rowMode: "array"
|
|
146
298
|
});
|
|
147
299
|
if (result.rows.length !== 1) {
|
|
@@ -151,52 +303,92 @@ async function updateProject(client, args) {
|
|
|
151
303
|
return {
|
|
152
304
|
id: row[0],
|
|
153
305
|
organizationId: row[1],
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
306
|
+
slug: row[2],
|
|
307
|
+
name: row[3],
|
|
308
|
+
summary: row[4],
|
|
309
|
+
description: row[5],
|
|
310
|
+
status: row[6],
|
|
311
|
+
ownerUserId: row[7],
|
|
312
|
+
creatorUserId: row[8],
|
|
313
|
+
workspaceId: row[9],
|
|
314
|
+
gitRepository: row[10],
|
|
315
|
+
startDate: row[11],
|
|
316
|
+
targetDate: row[12],
|
|
317
|
+
sourceSystem: row[13],
|
|
318
|
+
sourceId: row[14],
|
|
319
|
+
sourceMetadata: row[15],
|
|
320
|
+
createdAt: row[16],
|
|
321
|
+
updatedAt: row[17]
|
|
161
322
|
};
|
|
162
323
|
}
|
|
163
|
-
exports.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
324
|
+
exports.listProjectPermissionsQuery = `-- name: ListProjectPermissions :many
|
|
325
|
+
SELECT
|
|
326
|
+
id,
|
|
327
|
+
project_id,
|
|
328
|
+
principal_kind,
|
|
329
|
+
principal_id,
|
|
330
|
+
principal_slug,
|
|
331
|
+
principal_display_name,
|
|
332
|
+
permission_level,
|
|
333
|
+
created_at
|
|
334
|
+
FROM weave.project_shares
|
|
335
|
+
WHERE organization_id = $1
|
|
336
|
+
AND project_id = $2
|
|
337
|
+
ORDER BY principal_kind ASC, principal_display_name ASC`;
|
|
338
|
+
async function listProjectPermissions(client, args) {
|
|
171
339
|
const result = await client.query({
|
|
172
|
-
text: exports.
|
|
173
|
-
values: [args.
|
|
340
|
+
text: exports.listProjectPermissionsQuery,
|
|
341
|
+
values: [args.organizationId, args.projectId],
|
|
174
342
|
rowMode: "array"
|
|
175
343
|
});
|
|
176
|
-
|
|
177
|
-
return
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
updatedAt: row[7],
|
|
189
|
-
archivedAt: row[8]
|
|
190
|
-
};
|
|
344
|
+
return result.rows.map(row => {
|
|
345
|
+
return {
|
|
346
|
+
id: row[0],
|
|
347
|
+
projectId: row[1],
|
|
348
|
+
principalKind: row[2],
|
|
349
|
+
principalId: row[3],
|
|
350
|
+
principalSlug: row[4],
|
|
351
|
+
principalDisplayName: row[5],
|
|
352
|
+
permissionLevel: row[6],
|
|
353
|
+
createdAt: row[7]
|
|
354
|
+
};
|
|
355
|
+
});
|
|
191
356
|
}
|
|
192
|
-
exports.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
357
|
+
exports.listProjectActivityQuery = `-- name: ListProjectActivity :many
|
|
358
|
+
SELECT
|
|
359
|
+
id,
|
|
360
|
+
project_id,
|
|
361
|
+
task_id,
|
|
362
|
+
event_type,
|
|
363
|
+
actor_id,
|
|
364
|
+
actor_slug,
|
|
365
|
+
actor_label,
|
|
366
|
+
description,
|
|
367
|
+
metadata,
|
|
368
|
+
created_at
|
|
369
|
+
FROM weave.project_activity
|
|
370
|
+
WHERE organization_id = $1
|
|
371
|
+
AND project_id = $2
|
|
372
|
+
ORDER BY created_at DESC
|
|
373
|
+
LIMIT $3`;
|
|
374
|
+
async function listProjectActivity(client, args) {
|
|
375
|
+
const result = await client.query({
|
|
376
|
+
text: exports.listProjectActivityQuery,
|
|
377
|
+
values: [args.organizationId, args.projectId, args.pageLimit],
|
|
200
378
|
rowMode: "array"
|
|
201
379
|
});
|
|
380
|
+
return result.rows.map(row => {
|
|
381
|
+
return {
|
|
382
|
+
id: row[0],
|
|
383
|
+
projectId: row[1],
|
|
384
|
+
taskId: row[2],
|
|
385
|
+
eventType: row[3],
|
|
386
|
+
actorId: row[4],
|
|
387
|
+
actorSlug: row[5],
|
|
388
|
+
actorLabel: row[6],
|
|
389
|
+
description: row[7],
|
|
390
|
+
metadata: row[8],
|
|
391
|
+
createdAt: row[9]
|
|
392
|
+
};
|
|
393
|
+
});
|
|
202
394
|
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
2
|
+
interface Client {
|
|
3
|
+
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
|
+
}
|
|
5
|
+
export declare const createTaskQuery = "-- name: CreateTask :one\nINSERT INTO weave.tasks (\n id,\n organization_id,\n project_id,\n slug,\n title,\n summary,\n description,\n status,\n owner_kind,\n owner_id,\n owner_slug,\n owner_display_name,\n creator_user_id,\n source_system,\n source_id,\n source_metadata\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 $13,\n $14,\n $15,\n $16\n)\nRETURNING\n id,\n organization_id,\n project_id,\n slug,\n title,\n summary,\n description,\n status,\n owner_kind,\n owner_id,\n owner_slug,\n owner_display_name,\n creator_user_id,\n source_system,\n source_id,\n source_metadata,\n created_at,\n updated_at,\n completed_at";
|
|
6
|
+
export interface CreateTaskArgs {
|
|
7
|
+
id: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
slug: string;
|
|
11
|
+
title: string;
|
|
12
|
+
summary: string;
|
|
13
|
+
description: string;
|
|
14
|
+
status: string;
|
|
15
|
+
ownerKind: string;
|
|
16
|
+
ownerId: string | null;
|
|
17
|
+
ownerSlug: string | null;
|
|
18
|
+
ownerDisplayName: string;
|
|
19
|
+
creatorUserId: string;
|
|
20
|
+
sourceSystem: string | null;
|
|
21
|
+
sourceId: string | null;
|
|
22
|
+
sourceMetadata: any | null;
|
|
23
|
+
}
|
|
24
|
+
export interface CreateTaskRow {
|
|
25
|
+
id: string;
|
|
26
|
+
organizationId: string;
|
|
27
|
+
projectId: string;
|
|
28
|
+
slug: string;
|
|
29
|
+
title: string;
|
|
30
|
+
summary: string;
|
|
31
|
+
description: string;
|
|
32
|
+
status: string;
|
|
33
|
+
ownerKind: string;
|
|
34
|
+
ownerId: string | null;
|
|
35
|
+
ownerSlug: string | null;
|
|
36
|
+
ownerDisplayName: string;
|
|
37
|
+
creatorUserId: string;
|
|
38
|
+
sourceSystem: string | null;
|
|
39
|
+
sourceId: string | null;
|
|
40
|
+
sourceMetadata: any | null;
|
|
41
|
+
createdAt: Date;
|
|
42
|
+
updatedAt: Date;
|
|
43
|
+
completedAt: Date | null;
|
|
44
|
+
}
|
|
45
|
+
export declare function createTask(client: Client, args: CreateTaskArgs): Promise<CreateTaskRow | null>;
|
|
46
|
+
export declare const getTaskBySlugQuery = "-- name: GetTaskBySlug :one\nSELECT\n t.id,\n t.organization_id,\n t.project_id,\n p.slug AS project_slug,\n t.slug,\n t.title,\n t.summary,\n t.description,\n t.status,\n t.owner_kind,\n t.owner_id,\n t.owner_slug,\n t.owner_display_name,\n t.creator_user_id,\n t.source_system,\n t.source_id,\n t.source_metadata,\n t.created_at,\n t.updated_at,\n t.completed_at\nFROM weave.tasks AS t\nJOIN weave.projects AS p\n ON p.id = t.project_id\nWHERE t.organization_id = $1\n AND p.slug = $2\n AND t.slug = $3";
|
|
47
|
+
export interface GetTaskBySlugArgs {
|
|
48
|
+
organizationId: string;
|
|
49
|
+
projectSlug: string;
|
|
50
|
+
taskSlug: string;
|
|
51
|
+
}
|
|
52
|
+
export interface GetTaskBySlugRow {
|
|
53
|
+
id: string;
|
|
54
|
+
organizationId: string;
|
|
55
|
+
projectId: string;
|
|
56
|
+
projectSlug: string;
|
|
57
|
+
slug: string;
|
|
58
|
+
title: string;
|
|
59
|
+
summary: string;
|
|
60
|
+
description: string;
|
|
61
|
+
status: string;
|
|
62
|
+
ownerKind: string;
|
|
63
|
+
ownerId: string | null;
|
|
64
|
+
ownerSlug: string | null;
|
|
65
|
+
ownerDisplayName: string;
|
|
66
|
+
creatorUserId: string;
|
|
67
|
+
sourceSystem: string | null;
|
|
68
|
+
sourceId: string | null;
|
|
69
|
+
sourceMetadata: any | null;
|
|
70
|
+
createdAt: Date;
|
|
71
|
+
updatedAt: Date;
|
|
72
|
+
completedAt: Date | null;
|
|
73
|
+
}
|
|
74
|
+
export declare function getTaskBySlug(client: Client, args: GetTaskBySlugArgs): Promise<GetTaskBySlugRow | null>;
|
|
75
|
+
export declare const listProjectTasksQuery = "-- name: ListProjectTasks :many\nSELECT\n t.id,\n t.organization_id,\n t.project_id,\n p.slug AS project_slug,\n t.slug,\n t.title,\n t.summary,\n t.description,\n t.status,\n t.owner_kind,\n t.owner_id,\n t.owner_slug,\n t.owner_display_name,\n t.creator_user_id,\n t.source_system,\n t.source_id,\n t.source_metadata,\n t.created_at,\n t.updated_at,\n t.completed_at\nFROM weave.tasks AS t\nJOIN weave.projects AS p\n ON p.id = t.project_id\nWHERE t.organization_id = $1\n AND p.slug = $2\nORDER BY t.updated_at DESC, t.created_at DESC\nLIMIT $3";
|
|
76
|
+
export interface ListProjectTasksArgs {
|
|
77
|
+
organizationId: string;
|
|
78
|
+
projectSlug: string;
|
|
79
|
+
pageLimit: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ListProjectTasksRow {
|
|
82
|
+
id: string;
|
|
83
|
+
organizationId: string;
|
|
84
|
+
projectId: string;
|
|
85
|
+
projectSlug: string;
|
|
86
|
+
slug: string;
|
|
87
|
+
title: string;
|
|
88
|
+
summary: string;
|
|
89
|
+
description: string;
|
|
90
|
+
status: string;
|
|
91
|
+
ownerKind: string;
|
|
92
|
+
ownerId: string | null;
|
|
93
|
+
ownerSlug: string | null;
|
|
94
|
+
ownerDisplayName: string;
|
|
95
|
+
creatorUserId: string;
|
|
96
|
+
sourceSystem: string | null;
|
|
97
|
+
sourceId: string | null;
|
|
98
|
+
sourceMetadata: any | null;
|
|
99
|
+
createdAt: Date;
|
|
100
|
+
updatedAt: Date;
|
|
101
|
+
completedAt: Date | null;
|
|
102
|
+
}
|
|
103
|
+
export declare function listProjectTasks(client: Client, args: ListProjectTasksArgs): Promise<ListProjectTasksRow[]>;
|
|
104
|
+
export declare const updateTaskBySlugQuery = "-- name: UpdateTaskBySlug :one\nUPDATE weave.tasks AS t\nSET\n title = $1,\n summary = $2,\n description = $3,\n status = $4,\n owner_kind = $5,\n owner_id = $6,\n owner_slug = $7,\n owner_display_name = $8,\n source_system = $9,\n source_id = $10,\n source_metadata = $11,\n completed_at = $12,\n updated_at = now()\nFROM weave.projects AS p\nWHERE p.id = t.project_id\n AND t.organization_id = $13\n AND p.slug = $14\n AND t.slug = $15\nRETURNING\n t.id,\n t.organization_id,\n t.project_id,\n t.slug,\n t.title,\n t.summary,\n t.description,\n t.status,\n t.owner_kind,\n t.owner_id,\n t.owner_slug,\n t.owner_display_name,\n t.creator_user_id,\n t.source_system,\n t.source_id,\n t.source_metadata,\n t.created_at,\n t.updated_at,\n t.completed_at";
|
|
105
|
+
export interface UpdateTaskBySlugArgs {
|
|
106
|
+
title: string;
|
|
107
|
+
summary: string;
|
|
108
|
+
description: string;
|
|
109
|
+
status: string;
|
|
110
|
+
ownerKind: string;
|
|
111
|
+
ownerId: string | null;
|
|
112
|
+
ownerSlug: string | null;
|
|
113
|
+
ownerDisplayName: string;
|
|
114
|
+
sourceSystem: string | null;
|
|
115
|
+
sourceId: string | null;
|
|
116
|
+
sourceMetadata: any | null;
|
|
117
|
+
completedAt: Date | null;
|
|
118
|
+
organizationId: string;
|
|
119
|
+
projectSlug: string;
|
|
120
|
+
taskSlug: string;
|
|
121
|
+
}
|
|
122
|
+
export interface UpdateTaskBySlugRow {
|
|
123
|
+
id: string;
|
|
124
|
+
organizationId: string;
|
|
125
|
+
projectId: string;
|
|
126
|
+
slug: string;
|
|
127
|
+
title: string;
|
|
128
|
+
summary: string;
|
|
129
|
+
description: string;
|
|
130
|
+
status: string;
|
|
131
|
+
ownerKind: string;
|
|
132
|
+
ownerId: string | null;
|
|
133
|
+
ownerSlug: string | null;
|
|
134
|
+
ownerDisplayName: string;
|
|
135
|
+
creatorUserId: string;
|
|
136
|
+
sourceSystem: string | null;
|
|
137
|
+
sourceId: string | null;
|
|
138
|
+
sourceMetadata: any | null;
|
|
139
|
+
createdAt: Date;
|
|
140
|
+
updatedAt: Date;
|
|
141
|
+
completedAt: Date | null;
|
|
142
|
+
}
|
|
143
|
+
export declare function updateTaskBySlug(client: Client, args: UpdateTaskBySlugArgs): Promise<UpdateTaskBySlugRow | null>;
|
|
144
|
+
export declare const listTaskActivityQuery = "-- name: ListTaskActivity :many\nSELECT\n id,\n project_id,\n task_id,\n event_type,\n actor_id,\n actor_slug,\n actor_label,\n description,\n metadata,\n created_at\nFROM weave.task_activity\nWHERE organization_id = $1\n AND task_id = $2\nORDER BY created_at DESC\nLIMIT $3";
|
|
145
|
+
export interface ListTaskActivityArgs {
|
|
146
|
+
organizationId: string;
|
|
147
|
+
taskId: string;
|
|
148
|
+
pageLimit: string;
|
|
149
|
+
}
|
|
150
|
+
export interface ListTaskActivityRow {
|
|
151
|
+
id: string;
|
|
152
|
+
projectId: string;
|
|
153
|
+
taskId: string;
|
|
154
|
+
eventType: string;
|
|
155
|
+
actorId: string | null;
|
|
156
|
+
actorSlug: string | null;
|
|
157
|
+
actorLabel: string;
|
|
158
|
+
description: string;
|
|
159
|
+
metadata: any | null;
|
|
160
|
+
createdAt: Date;
|
|
161
|
+
}
|
|
162
|
+
export declare function listTaskActivity(client: Client, args: ListTaskActivityArgs): Promise<ListTaskActivityRow[]>;
|
|
163
|
+
export {};
|