weave-typescript 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/weaveapi/atc/v1/service.pb.d.ts +24 -0
- package/dist/weaveapi/atc/v1/service.pb.js +163 -1
- package/dist/weaveapi/project/v1/project.pb.d.ts +2 -0
- package/dist/weaveapi/project/v1/project.pb.js +27 -1
- package/dist/weaveapi/provider/v1/provider.pb.d.ts +123 -0
- package/dist/weaveapi/provider/v1/provider.pb.js +914 -0
- package/dist/weaveapi/provider/v1/service.pb.d.ts +198 -0
- package/dist/weaveapi/provider/v1/service.pb.js +1569 -0
- package/dist/weaveapi/task/v1/service.pb.d.ts +1 -0
- package/dist/weaveapi/task/v1/service.pb.js +21 -1
- package/dist/weaveapi/task/v1/task.pb.d.ts +1 -0
- package/dist/weaveapi/task/v1/task.pb.js +21 -1
- package/dist/weavesql/atcdb/event_sql.d.ts +68 -0
- package/dist/weavesql/atcdb/event_sql.js +143 -1
- package/dist/weavesql/atcdb/run_template_sql.d.ts +122 -0
- package/dist/weavesql/atcdb/run_template_sql.js +197 -0
- package/dist/weavesql/atcdb/snapshot_sql.d.ts +58 -0
- package/dist/weavesql/atcdb/snapshot_sql.js +124 -0
- package/dist/weavesql/atcdb/team_sql.d.ts +111 -0
- package/dist/weavesql/atcdb/team_sql.js +235 -0
- package/dist/weavesql/atcdb/workflow_template_sql.d.ts +122 -0
- package/dist/weavesql/atcdb/workflow_template_sql.js +197 -0
- package/dist/weavesql/weavedb/project_sql.d.ts +53 -5
- package/dist/weavesql/weavedb/project_sql.js +114 -11
- package/dist/weavesql/weavedb/provider_sql.d.ts +162 -0
- package/dist/weavesql/weavedb/provider_sql.js +358 -0
- package/dist/weavesql/weavedb/task_sql.d.ts +51 -4
- package/dist/weavesql/weavedb/task_sql.js +115 -13
- package/package.json +2 -2
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProviderCredentialByProviderIDQuery = exports.upsertProviderCredentialQuery = exports.disableProviderConfigurationByIDQuery = exports.updateProviderConfigurationByIDQuery = exports.listProviderConfigurationsQuery = exports.getProviderConfigurationByKindQuery = exports.getProviderConfigurationByIDQuery = exports.createProviderConfigurationQuery = void 0;
|
|
4
|
+
exports.createProviderConfiguration = createProviderConfiguration;
|
|
5
|
+
exports.getProviderConfigurationByID = getProviderConfigurationByID;
|
|
6
|
+
exports.getProviderConfigurationByKind = getProviderConfigurationByKind;
|
|
7
|
+
exports.listProviderConfigurations = listProviderConfigurations;
|
|
8
|
+
exports.updateProviderConfigurationByID = updateProviderConfigurationByID;
|
|
9
|
+
exports.disableProviderConfigurationByID = disableProviderConfigurationByID;
|
|
10
|
+
exports.upsertProviderCredential = upsertProviderCredential;
|
|
11
|
+
exports.getProviderCredentialByProviderID = getProviderCredentialByProviderID;
|
|
12
|
+
exports.createProviderConfigurationQuery = `-- name: CreateProviderConfiguration :one
|
|
13
|
+
INSERT INTO weave.llm_provider_configurations (
|
|
14
|
+
id,
|
|
15
|
+
organization_id,
|
|
16
|
+
provider_kind,
|
|
17
|
+
display_name,
|
|
18
|
+
base_url,
|
|
19
|
+
status,
|
|
20
|
+
created_by_user_id,
|
|
21
|
+
updated_by_user_id
|
|
22
|
+
) VALUES (
|
|
23
|
+
$1,
|
|
24
|
+
$2,
|
|
25
|
+
$3,
|
|
26
|
+
$4,
|
|
27
|
+
$5,
|
|
28
|
+
$6,
|
|
29
|
+
$7,
|
|
30
|
+
$8
|
|
31
|
+
)
|
|
32
|
+
RETURNING
|
|
33
|
+
id,
|
|
34
|
+
organization_id,
|
|
35
|
+
provider_kind,
|
|
36
|
+
display_name,
|
|
37
|
+
base_url,
|
|
38
|
+
status,
|
|
39
|
+
created_by_user_id,
|
|
40
|
+
updated_by_user_id,
|
|
41
|
+
created_at,
|
|
42
|
+
updated_at`;
|
|
43
|
+
async function createProviderConfiguration(client, args) {
|
|
44
|
+
const result = await client.query({
|
|
45
|
+
text: exports.createProviderConfigurationQuery,
|
|
46
|
+
values: [args.id, args.organizationId, args.providerKind, args.displayName, args.baseUrl, args.status, args.createdByUserId, args.updatedByUserId],
|
|
47
|
+
rowMode: "array"
|
|
48
|
+
});
|
|
49
|
+
if (result.rows.length !== 1) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const row = result.rows[0];
|
|
53
|
+
return {
|
|
54
|
+
id: row[0],
|
|
55
|
+
organizationId: row[1],
|
|
56
|
+
providerKind: row[2],
|
|
57
|
+
displayName: row[3],
|
|
58
|
+
baseUrl: row[4],
|
|
59
|
+
status: row[5],
|
|
60
|
+
createdByUserId: row[6],
|
|
61
|
+
updatedByUserId: row[7],
|
|
62
|
+
createdAt: row[8],
|
|
63
|
+
updatedAt: row[9]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.getProviderConfigurationByIDQuery = `-- name: GetProviderConfigurationByID :one
|
|
67
|
+
SELECT
|
|
68
|
+
id,
|
|
69
|
+
organization_id,
|
|
70
|
+
provider_kind,
|
|
71
|
+
display_name,
|
|
72
|
+
base_url,
|
|
73
|
+
status,
|
|
74
|
+
created_by_user_id,
|
|
75
|
+
updated_by_user_id,
|
|
76
|
+
created_at,
|
|
77
|
+
updated_at
|
|
78
|
+
FROM weave.llm_provider_configurations
|
|
79
|
+
WHERE organization_id = $1
|
|
80
|
+
AND id = $2`;
|
|
81
|
+
async function getProviderConfigurationByID(client, args) {
|
|
82
|
+
const result = await client.query({
|
|
83
|
+
text: exports.getProviderConfigurationByIDQuery,
|
|
84
|
+
values: [args.organizationId, args.id],
|
|
85
|
+
rowMode: "array"
|
|
86
|
+
});
|
|
87
|
+
if (result.rows.length !== 1) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const row = result.rows[0];
|
|
91
|
+
return {
|
|
92
|
+
id: row[0],
|
|
93
|
+
organizationId: row[1],
|
|
94
|
+
providerKind: row[2],
|
|
95
|
+
displayName: row[3],
|
|
96
|
+
baseUrl: row[4],
|
|
97
|
+
status: row[5],
|
|
98
|
+
createdByUserId: row[6],
|
|
99
|
+
updatedByUserId: row[7],
|
|
100
|
+
createdAt: row[8],
|
|
101
|
+
updatedAt: row[9]
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
exports.getProviderConfigurationByKindQuery = `-- name: GetProviderConfigurationByKind :one
|
|
105
|
+
SELECT
|
|
106
|
+
id,
|
|
107
|
+
organization_id,
|
|
108
|
+
provider_kind,
|
|
109
|
+
display_name,
|
|
110
|
+
base_url,
|
|
111
|
+
status,
|
|
112
|
+
created_by_user_id,
|
|
113
|
+
updated_by_user_id,
|
|
114
|
+
created_at,
|
|
115
|
+
updated_at
|
|
116
|
+
FROM weave.llm_provider_configurations
|
|
117
|
+
WHERE organization_id = $1
|
|
118
|
+
AND provider_kind = $2`;
|
|
119
|
+
async function getProviderConfigurationByKind(client, args) {
|
|
120
|
+
const result = await client.query({
|
|
121
|
+
text: exports.getProviderConfigurationByKindQuery,
|
|
122
|
+
values: [args.organizationId, args.providerKind],
|
|
123
|
+
rowMode: "array"
|
|
124
|
+
});
|
|
125
|
+
if (result.rows.length !== 1) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const row = result.rows[0];
|
|
129
|
+
return {
|
|
130
|
+
id: row[0],
|
|
131
|
+
organizationId: row[1],
|
|
132
|
+
providerKind: row[2],
|
|
133
|
+
displayName: row[3],
|
|
134
|
+
baseUrl: row[4],
|
|
135
|
+
status: row[5],
|
|
136
|
+
createdByUserId: row[6],
|
|
137
|
+
updatedByUserId: row[7],
|
|
138
|
+
createdAt: row[8],
|
|
139
|
+
updatedAt: row[9]
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
exports.listProviderConfigurationsQuery = `-- name: ListProviderConfigurations :many
|
|
143
|
+
SELECT
|
|
144
|
+
id,
|
|
145
|
+
organization_id,
|
|
146
|
+
provider_kind,
|
|
147
|
+
display_name,
|
|
148
|
+
base_url,
|
|
149
|
+
status,
|
|
150
|
+
created_by_user_id,
|
|
151
|
+
updated_by_user_id,
|
|
152
|
+
created_at,
|
|
153
|
+
updated_at
|
|
154
|
+
FROM weave.llm_provider_configurations
|
|
155
|
+
WHERE organization_id = $1
|
|
156
|
+
ORDER BY updated_at DESC, created_at DESC`;
|
|
157
|
+
async function listProviderConfigurations(client, args) {
|
|
158
|
+
const result = await client.query({
|
|
159
|
+
text: exports.listProviderConfigurationsQuery,
|
|
160
|
+
values: [args.organizationId],
|
|
161
|
+
rowMode: "array"
|
|
162
|
+
});
|
|
163
|
+
return result.rows.map(row => {
|
|
164
|
+
return {
|
|
165
|
+
id: row[0],
|
|
166
|
+
organizationId: row[1],
|
|
167
|
+
providerKind: row[2],
|
|
168
|
+
displayName: row[3],
|
|
169
|
+
baseUrl: row[4],
|
|
170
|
+
status: row[5],
|
|
171
|
+
createdByUserId: row[6],
|
|
172
|
+
updatedByUserId: row[7],
|
|
173
|
+
createdAt: row[8],
|
|
174
|
+
updatedAt: row[9]
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
exports.updateProviderConfigurationByIDQuery = `-- name: UpdateProviderConfigurationByID :one
|
|
179
|
+
UPDATE weave.llm_provider_configurations
|
|
180
|
+
SET
|
|
181
|
+
display_name = $1,
|
|
182
|
+
base_url = $2,
|
|
183
|
+
status = $3,
|
|
184
|
+
updated_by_user_id = $4,
|
|
185
|
+
updated_at = now()
|
|
186
|
+
WHERE organization_id = $5
|
|
187
|
+
AND id = $6
|
|
188
|
+
RETURNING
|
|
189
|
+
id,
|
|
190
|
+
organization_id,
|
|
191
|
+
provider_kind,
|
|
192
|
+
display_name,
|
|
193
|
+
base_url,
|
|
194
|
+
status,
|
|
195
|
+
created_by_user_id,
|
|
196
|
+
updated_by_user_id,
|
|
197
|
+
created_at,
|
|
198
|
+
updated_at`;
|
|
199
|
+
async function updateProviderConfigurationByID(client, args) {
|
|
200
|
+
const result = await client.query({
|
|
201
|
+
text: exports.updateProviderConfigurationByIDQuery,
|
|
202
|
+
values: [args.displayName, args.baseUrl, args.status, args.updatedByUserId, args.organizationId, args.id],
|
|
203
|
+
rowMode: "array"
|
|
204
|
+
});
|
|
205
|
+
if (result.rows.length !== 1) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
const row = result.rows[0];
|
|
209
|
+
return {
|
|
210
|
+
id: row[0],
|
|
211
|
+
organizationId: row[1],
|
|
212
|
+
providerKind: row[2],
|
|
213
|
+
displayName: row[3],
|
|
214
|
+
baseUrl: row[4],
|
|
215
|
+
status: row[5],
|
|
216
|
+
createdByUserId: row[6],
|
|
217
|
+
updatedByUserId: row[7],
|
|
218
|
+
createdAt: row[8],
|
|
219
|
+
updatedAt: row[9]
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
exports.disableProviderConfigurationByIDQuery = `-- name: DisableProviderConfigurationByID :one
|
|
223
|
+
UPDATE weave.llm_provider_configurations
|
|
224
|
+
SET
|
|
225
|
+
status = 'PROVIDER_CONFIGURATION_STATUS_DISABLED',
|
|
226
|
+
updated_by_user_id = $1,
|
|
227
|
+
updated_at = now()
|
|
228
|
+
WHERE organization_id = $2
|
|
229
|
+
AND id = $3
|
|
230
|
+
RETURNING
|
|
231
|
+
id,
|
|
232
|
+
organization_id,
|
|
233
|
+
provider_kind,
|
|
234
|
+
display_name,
|
|
235
|
+
base_url,
|
|
236
|
+
status,
|
|
237
|
+
created_by_user_id,
|
|
238
|
+
updated_by_user_id,
|
|
239
|
+
created_at,
|
|
240
|
+
updated_at`;
|
|
241
|
+
async function disableProviderConfigurationByID(client, args) {
|
|
242
|
+
const result = await client.query({
|
|
243
|
+
text: exports.disableProviderConfigurationByIDQuery,
|
|
244
|
+
values: [args.updatedByUserId, args.organizationId, args.id],
|
|
245
|
+
rowMode: "array"
|
|
246
|
+
});
|
|
247
|
+
if (result.rows.length !== 1) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
const row = result.rows[0];
|
|
251
|
+
return {
|
|
252
|
+
id: row[0],
|
|
253
|
+
organizationId: row[1],
|
|
254
|
+
providerKind: row[2],
|
|
255
|
+
displayName: row[3],
|
|
256
|
+
baseUrl: row[4],
|
|
257
|
+
status: row[5],
|
|
258
|
+
createdByUserId: row[6],
|
|
259
|
+
updatedByUserId: row[7],
|
|
260
|
+
createdAt: row[8],
|
|
261
|
+
updatedAt: row[9]
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
exports.upsertProviderCredentialQuery = `-- name: UpsertProviderCredential :one
|
|
265
|
+
INSERT INTO weave.llm_provider_credentials (
|
|
266
|
+
provider_configuration_id,
|
|
267
|
+
organization_id,
|
|
268
|
+
encrypted_credentials,
|
|
269
|
+
credential_hint,
|
|
270
|
+
credential_status,
|
|
271
|
+
key_version,
|
|
272
|
+
last_rotated_at
|
|
273
|
+
) VALUES (
|
|
274
|
+
$1,
|
|
275
|
+
$2,
|
|
276
|
+
$3,
|
|
277
|
+
$4,
|
|
278
|
+
$5,
|
|
279
|
+
$6,
|
|
280
|
+
$7
|
|
281
|
+
)
|
|
282
|
+
ON CONFLICT (provider_configuration_id) DO UPDATE
|
|
283
|
+
SET
|
|
284
|
+
organization_id = EXCLUDED.organization_id,
|
|
285
|
+
encrypted_credentials = EXCLUDED.encrypted_credentials,
|
|
286
|
+
credential_hint = EXCLUDED.credential_hint,
|
|
287
|
+
credential_status = EXCLUDED.credential_status,
|
|
288
|
+
key_version = EXCLUDED.key_version,
|
|
289
|
+
last_rotated_at = EXCLUDED.last_rotated_at,
|
|
290
|
+
updated_at = now()
|
|
291
|
+
RETURNING
|
|
292
|
+
provider_configuration_id,
|
|
293
|
+
organization_id,
|
|
294
|
+
encrypted_credentials,
|
|
295
|
+
credential_hint,
|
|
296
|
+
credential_status,
|
|
297
|
+
key_version,
|
|
298
|
+
last_rotated_at,
|
|
299
|
+
created_at,
|
|
300
|
+
updated_at`;
|
|
301
|
+
async function upsertProviderCredential(client, args) {
|
|
302
|
+
const result = await client.query({
|
|
303
|
+
text: exports.upsertProviderCredentialQuery,
|
|
304
|
+
values: [args.providerConfigurationId, args.organizationId, args.encryptedCredentials, args.credentialHint, args.credentialStatus, args.keyVersion, args.lastRotatedAt],
|
|
305
|
+
rowMode: "array"
|
|
306
|
+
});
|
|
307
|
+
if (result.rows.length !== 1) {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
const row = result.rows[0];
|
|
311
|
+
return {
|
|
312
|
+
providerConfigurationId: row[0],
|
|
313
|
+
organizationId: row[1],
|
|
314
|
+
encryptedCredentials: row[2],
|
|
315
|
+
credentialHint: row[3],
|
|
316
|
+
credentialStatus: row[4],
|
|
317
|
+
keyVersion: row[5],
|
|
318
|
+
lastRotatedAt: row[6],
|
|
319
|
+
createdAt: row[7],
|
|
320
|
+
updatedAt: row[8]
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
exports.getProviderCredentialByProviderIDQuery = `-- name: GetProviderCredentialByProviderID :one
|
|
324
|
+
SELECT
|
|
325
|
+
provider_configuration_id,
|
|
326
|
+
organization_id,
|
|
327
|
+
encrypted_credentials,
|
|
328
|
+
credential_hint,
|
|
329
|
+
credential_status,
|
|
330
|
+
key_version,
|
|
331
|
+
last_rotated_at,
|
|
332
|
+
created_at,
|
|
333
|
+
updated_at
|
|
334
|
+
FROM weave.llm_provider_credentials
|
|
335
|
+
WHERE organization_id = $1
|
|
336
|
+
AND provider_configuration_id = $2`;
|
|
337
|
+
async function getProviderCredentialByProviderID(client, args) {
|
|
338
|
+
const result = await client.query({
|
|
339
|
+
text: exports.getProviderCredentialByProviderIDQuery,
|
|
340
|
+
values: [args.organizationId, args.providerConfigurationId],
|
|
341
|
+
rowMode: "array"
|
|
342
|
+
});
|
|
343
|
+
if (result.rows.length !== 1) {
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
const row = result.rows[0];
|
|
347
|
+
return {
|
|
348
|
+
providerConfigurationId: row[0],
|
|
349
|
+
organizationId: row[1],
|
|
350
|
+
encryptedCredentials: row[2],
|
|
351
|
+
credentialHint: row[3],
|
|
352
|
+
credentialStatus: row[4],
|
|
353
|
+
keyVersion: row[5],
|
|
354
|
+
lastRotatedAt: row[6],
|
|
355
|
+
createdAt: row[7],
|
|
356
|
+
updatedAt: row[8]
|
|
357
|
+
};
|
|
358
|
+
}
|
|
@@ -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 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";
|
|
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,\n completion_approved";
|
|
6
6
|
export interface CreateTaskArgs {
|
|
7
7
|
id: string;
|
|
8
8
|
organizationId: string;
|
|
@@ -41,9 +41,10 @@ export interface CreateTaskRow {
|
|
|
41
41
|
createdAt: Date;
|
|
42
42
|
updatedAt: Date;
|
|
43
43
|
completedAt: Date | null;
|
|
44
|
+
completionApproved: boolean;
|
|
44
45
|
}
|
|
45
46
|
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 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,\n t.completion_approved\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
48
|
export interface GetTaskBySlugArgs {
|
|
48
49
|
organizationId: string;
|
|
49
50
|
projectSlug: string;
|
|
@@ -70,9 +71,10 @@ export interface GetTaskBySlugRow {
|
|
|
70
71
|
createdAt: Date;
|
|
71
72
|
updatedAt: Date;
|
|
72
73
|
completedAt: Date | null;
|
|
74
|
+
completionApproved: boolean;
|
|
73
75
|
}
|
|
74
76
|
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";
|
|
77
|
+
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,\n t.completion_approved\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
78
|
export interface ListProjectTasksArgs {
|
|
77
79
|
organizationId: string;
|
|
78
80
|
projectSlug: string;
|
|
@@ -99,9 +101,10 @@ export interface ListProjectTasksRow {
|
|
|
99
101
|
createdAt: Date;
|
|
100
102
|
updatedAt: Date;
|
|
101
103
|
completedAt: Date | null;
|
|
104
|
+
completionApproved: boolean;
|
|
102
105
|
}
|
|
103
106
|
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 = $
|
|
107
|
+
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 completion_approved = $13,\n updated_at = now()\nFROM weave.projects AS p\nWHERE p.id = t.project_id\n AND t.organization_id = $14\n AND p.slug = $15\n AND t.slug = $16\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,\n t.completion_approved";
|
|
105
108
|
export interface UpdateTaskBySlugArgs {
|
|
106
109
|
title: string;
|
|
107
110
|
summary: string;
|
|
@@ -115,6 +118,7 @@ export interface UpdateTaskBySlugArgs {
|
|
|
115
118
|
sourceId: string | null;
|
|
116
119
|
sourceMetadata: any | null;
|
|
117
120
|
completedAt: Date | null;
|
|
121
|
+
completionApproved: boolean;
|
|
118
122
|
organizationId: string;
|
|
119
123
|
projectSlug: string;
|
|
120
124
|
taskSlug: string;
|
|
@@ -139,8 +143,37 @@ export interface UpdateTaskBySlugRow {
|
|
|
139
143
|
createdAt: Date;
|
|
140
144
|
updatedAt: Date;
|
|
141
145
|
completedAt: Date | null;
|
|
146
|
+
completionApproved: boolean;
|
|
142
147
|
}
|
|
143
148
|
export declare function updateTaskBySlug(client: Client, args: UpdateTaskBySlugArgs): Promise<UpdateTaskBySlugRow | null>;
|
|
149
|
+
export declare const holdInProgressTasksByProjectIDQuery = "-- name: HoldInProgressTasksByProjectID :many\nUPDATE weave.tasks\nSET\n status = 'TASK_STATUS_HOLD',\n updated_at = now()\nWHERE organization_id = $1\n AND project_id = $2\n AND status = 'TASK_STATUS_IN_PROGRESS'\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,\n completion_approved";
|
|
150
|
+
export interface HoldInProgressTasksByProjectIDArgs {
|
|
151
|
+
organizationId: string;
|
|
152
|
+
projectId: string;
|
|
153
|
+
}
|
|
154
|
+
export interface HoldInProgressTasksByProjectIDRow {
|
|
155
|
+
id: string;
|
|
156
|
+
organizationId: string;
|
|
157
|
+
projectId: string;
|
|
158
|
+
slug: string;
|
|
159
|
+
title: string;
|
|
160
|
+
summary: string;
|
|
161
|
+
description: string;
|
|
162
|
+
status: string;
|
|
163
|
+
ownerKind: string;
|
|
164
|
+
ownerId: string | null;
|
|
165
|
+
ownerSlug: string | null;
|
|
166
|
+
ownerDisplayName: string;
|
|
167
|
+
creatorUserId: string;
|
|
168
|
+
sourceSystem: string | null;
|
|
169
|
+
sourceId: string | null;
|
|
170
|
+
sourceMetadata: any | null;
|
|
171
|
+
createdAt: Date;
|
|
172
|
+
updatedAt: Date;
|
|
173
|
+
completedAt: Date | null;
|
|
174
|
+
completionApproved: boolean;
|
|
175
|
+
}
|
|
176
|
+
export declare function holdInProgressTasksByProjectID(client: Client, args: HoldInProgressTasksByProjectIDArgs): Promise<HoldInProgressTasksByProjectIDRow[]>;
|
|
144
177
|
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
178
|
export interface ListTaskActivityArgs {
|
|
146
179
|
organizationId: string;
|
|
@@ -160,4 +193,18 @@ export interface ListTaskActivityRow {
|
|
|
160
193
|
createdAt: Date;
|
|
161
194
|
}
|
|
162
195
|
export declare function listTaskActivity(client: Client, args: ListTaskActivityArgs): Promise<ListTaskActivityRow[]>;
|
|
196
|
+
export declare const createTaskActivityQuery = "-- name: CreateTaskActivity :exec\nINSERT INTO weave.task_activity (\n id,\n organization_id,\n project_id,\n task_id,\n event_type,\n actor_id,\n actor_slug,\n actor_label,\n description,\n metadata\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10\n)";
|
|
197
|
+
export interface CreateTaskActivityArgs {
|
|
198
|
+
id: string;
|
|
199
|
+
organizationId: string;
|
|
200
|
+
projectId: string;
|
|
201
|
+
taskId: string;
|
|
202
|
+
eventType: string;
|
|
203
|
+
actorId: string | null;
|
|
204
|
+
actorSlug: string | null;
|
|
205
|
+
actorLabel: string;
|
|
206
|
+
description: string;
|
|
207
|
+
metadata: any | null;
|
|
208
|
+
}
|
|
209
|
+
export declare function createTaskActivity(client: Client, args: CreateTaskActivityArgs): Promise<void>;
|
|
163
210
|
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listTaskActivityQuery = exports.updateTaskBySlugQuery = exports.listProjectTasksQuery = exports.getTaskBySlugQuery = exports.createTaskQuery = void 0;
|
|
3
|
+
exports.createTaskActivityQuery = exports.listTaskActivityQuery = exports.holdInProgressTasksByProjectIDQuery = exports.updateTaskBySlugQuery = exports.listProjectTasksQuery = exports.getTaskBySlugQuery = exports.createTaskQuery = void 0;
|
|
4
4
|
exports.createTask = createTask;
|
|
5
5
|
exports.getTaskBySlug = getTaskBySlug;
|
|
6
6
|
exports.listProjectTasks = listProjectTasks;
|
|
7
7
|
exports.updateTaskBySlug = updateTaskBySlug;
|
|
8
|
+
exports.holdInProgressTasksByProjectID = holdInProgressTasksByProjectID;
|
|
8
9
|
exports.listTaskActivity = listTaskActivity;
|
|
10
|
+
exports.createTaskActivity = createTaskActivity;
|
|
9
11
|
exports.createTaskQuery = `-- name: CreateTask :one
|
|
10
12
|
INSERT INTO weave.tasks (
|
|
11
13
|
id,
|
|
@@ -61,7 +63,8 @@ RETURNING
|
|
|
61
63
|
source_metadata,
|
|
62
64
|
created_at,
|
|
63
65
|
updated_at,
|
|
64
|
-
completed_at
|
|
66
|
+
completed_at,
|
|
67
|
+
completion_approved`;
|
|
65
68
|
async function createTask(client, args) {
|
|
66
69
|
const result = await client.query({
|
|
67
70
|
text: exports.createTaskQuery,
|
|
@@ -91,7 +94,8 @@ async function createTask(client, args) {
|
|
|
91
94
|
sourceMetadata: row[15],
|
|
92
95
|
createdAt: row[16],
|
|
93
96
|
updatedAt: row[17],
|
|
94
|
-
completedAt: row[18]
|
|
97
|
+
completedAt: row[18],
|
|
98
|
+
completionApproved: row[19]
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
exports.getTaskBySlugQuery = `-- name: GetTaskBySlug :one
|
|
@@ -115,7 +119,8 @@ SELECT
|
|
|
115
119
|
t.source_metadata,
|
|
116
120
|
t.created_at,
|
|
117
121
|
t.updated_at,
|
|
118
|
-
t.completed_at
|
|
122
|
+
t.completed_at,
|
|
123
|
+
t.completion_approved
|
|
119
124
|
FROM weave.tasks AS t
|
|
120
125
|
JOIN weave.projects AS p
|
|
121
126
|
ON p.id = t.project_id
|
|
@@ -152,7 +157,8 @@ async function getTaskBySlug(client, args) {
|
|
|
152
157
|
sourceMetadata: row[16],
|
|
153
158
|
createdAt: row[17],
|
|
154
159
|
updatedAt: row[18],
|
|
155
|
-
completedAt: row[19]
|
|
160
|
+
completedAt: row[19],
|
|
161
|
+
completionApproved: row[20]
|
|
156
162
|
};
|
|
157
163
|
}
|
|
158
164
|
exports.listProjectTasksQuery = `-- name: ListProjectTasks :many
|
|
@@ -176,7 +182,8 @@ SELECT
|
|
|
176
182
|
t.source_metadata,
|
|
177
183
|
t.created_at,
|
|
178
184
|
t.updated_at,
|
|
179
|
-
t.completed_at
|
|
185
|
+
t.completed_at,
|
|
186
|
+
t.completion_approved
|
|
180
187
|
FROM weave.tasks AS t
|
|
181
188
|
JOIN weave.projects AS p
|
|
182
189
|
ON p.id = t.project_id
|
|
@@ -211,7 +218,8 @@ async function listProjectTasks(client, args) {
|
|
|
211
218
|
sourceMetadata: row[16],
|
|
212
219
|
createdAt: row[17],
|
|
213
220
|
updatedAt: row[18],
|
|
214
|
-
completedAt: row[19]
|
|
221
|
+
completedAt: row[19],
|
|
222
|
+
completionApproved: row[20]
|
|
215
223
|
};
|
|
216
224
|
});
|
|
217
225
|
}
|
|
@@ -230,12 +238,13 @@ SET
|
|
|
230
238
|
source_id = $10,
|
|
231
239
|
source_metadata = $11,
|
|
232
240
|
completed_at = $12,
|
|
241
|
+
completion_approved = $13,
|
|
233
242
|
updated_at = now()
|
|
234
243
|
FROM weave.projects AS p
|
|
235
244
|
WHERE p.id = t.project_id
|
|
236
|
-
AND t.organization_id = $
|
|
237
|
-
AND p.slug = $
|
|
238
|
-
AND t.slug = $
|
|
245
|
+
AND t.organization_id = $14
|
|
246
|
+
AND p.slug = $15
|
|
247
|
+
AND t.slug = $16
|
|
239
248
|
RETURNING
|
|
240
249
|
t.id,
|
|
241
250
|
t.organization_id,
|
|
@@ -255,11 +264,12 @@ RETURNING
|
|
|
255
264
|
t.source_metadata,
|
|
256
265
|
t.created_at,
|
|
257
266
|
t.updated_at,
|
|
258
|
-
t.completed_at
|
|
267
|
+
t.completed_at,
|
|
268
|
+
t.completion_approved`;
|
|
259
269
|
async function updateTaskBySlug(client, args) {
|
|
260
270
|
const result = await client.query({
|
|
261
271
|
text: exports.updateTaskBySlugQuery,
|
|
262
|
-
values: [args.title, args.summary, args.description, args.status, args.ownerKind, args.ownerId, args.ownerSlug, args.ownerDisplayName, args.sourceSystem, args.sourceId, args.sourceMetadata, args.completedAt, args.organizationId, args.projectSlug, args.taskSlug],
|
|
272
|
+
values: [args.title, args.summary, args.description, args.status, args.ownerKind, args.ownerId, args.ownerSlug, args.ownerDisplayName, args.sourceSystem, args.sourceId, args.sourceMetadata, args.completedAt, args.completionApproved, args.organizationId, args.projectSlug, args.taskSlug],
|
|
263
273
|
rowMode: "array"
|
|
264
274
|
});
|
|
265
275
|
if (result.rows.length !== 1) {
|
|
@@ -285,9 +295,70 @@ async function updateTaskBySlug(client, args) {
|
|
|
285
295
|
sourceMetadata: row[15],
|
|
286
296
|
createdAt: row[16],
|
|
287
297
|
updatedAt: row[17],
|
|
288
|
-
completedAt: row[18]
|
|
298
|
+
completedAt: row[18],
|
|
299
|
+
completionApproved: row[19]
|
|
289
300
|
};
|
|
290
301
|
}
|
|
302
|
+
exports.holdInProgressTasksByProjectIDQuery = `-- name: HoldInProgressTasksByProjectID :many
|
|
303
|
+
UPDATE weave.tasks
|
|
304
|
+
SET
|
|
305
|
+
status = 'TASK_STATUS_HOLD',
|
|
306
|
+
updated_at = now()
|
|
307
|
+
WHERE organization_id = $1
|
|
308
|
+
AND project_id = $2
|
|
309
|
+
AND status = 'TASK_STATUS_IN_PROGRESS'
|
|
310
|
+
RETURNING
|
|
311
|
+
id,
|
|
312
|
+
organization_id,
|
|
313
|
+
project_id,
|
|
314
|
+
slug,
|
|
315
|
+
title,
|
|
316
|
+
summary,
|
|
317
|
+
description,
|
|
318
|
+
status,
|
|
319
|
+
owner_kind,
|
|
320
|
+
owner_id,
|
|
321
|
+
owner_slug,
|
|
322
|
+
owner_display_name,
|
|
323
|
+
creator_user_id,
|
|
324
|
+
source_system,
|
|
325
|
+
source_id,
|
|
326
|
+
source_metadata,
|
|
327
|
+
created_at,
|
|
328
|
+
updated_at,
|
|
329
|
+
completed_at,
|
|
330
|
+
completion_approved`;
|
|
331
|
+
async function holdInProgressTasksByProjectID(client, args) {
|
|
332
|
+
const result = await client.query({
|
|
333
|
+
text: exports.holdInProgressTasksByProjectIDQuery,
|
|
334
|
+
values: [args.organizationId, args.projectId],
|
|
335
|
+
rowMode: "array"
|
|
336
|
+
});
|
|
337
|
+
return result.rows.map(row => {
|
|
338
|
+
return {
|
|
339
|
+
id: row[0],
|
|
340
|
+
organizationId: row[1],
|
|
341
|
+
projectId: row[2],
|
|
342
|
+
slug: row[3],
|
|
343
|
+
title: row[4],
|
|
344
|
+
summary: row[5],
|
|
345
|
+
description: row[6],
|
|
346
|
+
status: row[7],
|
|
347
|
+
ownerKind: row[8],
|
|
348
|
+
ownerId: row[9],
|
|
349
|
+
ownerSlug: row[10],
|
|
350
|
+
ownerDisplayName: row[11],
|
|
351
|
+
creatorUserId: row[12],
|
|
352
|
+
sourceSystem: row[13],
|
|
353
|
+
sourceId: row[14],
|
|
354
|
+
sourceMetadata: row[15],
|
|
355
|
+
createdAt: row[16],
|
|
356
|
+
updatedAt: row[17],
|
|
357
|
+
completedAt: row[18],
|
|
358
|
+
completionApproved: row[19]
|
|
359
|
+
};
|
|
360
|
+
});
|
|
361
|
+
}
|
|
291
362
|
exports.listTaskActivityQuery = `-- name: ListTaskActivity :many
|
|
292
363
|
SELECT
|
|
293
364
|
id,
|
|
@@ -326,3 +397,34 @@ async function listTaskActivity(client, args) {
|
|
|
326
397
|
};
|
|
327
398
|
});
|
|
328
399
|
}
|
|
400
|
+
exports.createTaskActivityQuery = `-- name: CreateTaskActivity :exec
|
|
401
|
+
INSERT INTO weave.task_activity (
|
|
402
|
+
id,
|
|
403
|
+
organization_id,
|
|
404
|
+
project_id,
|
|
405
|
+
task_id,
|
|
406
|
+
event_type,
|
|
407
|
+
actor_id,
|
|
408
|
+
actor_slug,
|
|
409
|
+
actor_label,
|
|
410
|
+
description,
|
|
411
|
+
metadata
|
|
412
|
+
) VALUES (
|
|
413
|
+
$1,
|
|
414
|
+
$2,
|
|
415
|
+
$3,
|
|
416
|
+
$4,
|
|
417
|
+
$5,
|
|
418
|
+
$6,
|
|
419
|
+
$7,
|
|
420
|
+
$8,
|
|
421
|
+
$9,
|
|
422
|
+
$10
|
|
423
|
+
)`;
|
|
424
|
+
async function createTaskActivity(client, args) {
|
|
425
|
+
await client.query({
|
|
426
|
+
text: exports.createTaskActivityQuery,
|
|
427
|
+
values: [args.id, args.organizationId, args.projectId, args.taskId, args.eventType, args.actorId, args.actorSlug, args.actorLabel, args.description, args.metadata],
|
|
428
|
+
rowMode: "array"
|
|
429
|
+
});
|
|
430
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weave-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^25.2.0",
|
|
33
33
|
"@types/pg": "^8.15.5",
|
|
34
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
34
|
+
"@typescript/native-preview": "7.0.0-dev.20260412.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "node tools/sqlcgen.test.js",
|