weave-typescript 0.15.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/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/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/provider_sql.d.ts +162 -0
- package/dist/weavesql/weavedb/provider_sql.js +358 -0
- 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
|
+
}
|
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",
|