weave-typescript 0.19.0 → 0.21.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/inference/v1/inference.pb.d.ts +588 -0
- package/dist/weaveapi/inference/v1/inference.pb.js +7170 -0
- package/dist/weaveapi/inference/v1/service.pb.d.ts +235 -0
- package/dist/weaveapi/inference/v1/service.pb.js +651 -0
- package/dist/weaveapi/model/v1/model.pb.d.ts +105 -0
- package/dist/weaveapi/model/v1/model.pb.js +1001 -0
- package/dist/weaveapi/model/v1/service.pb.d.ts +116 -0
- package/dist/weaveapi/model/v1/service.pb.js +579 -0
- package/dist/weaveapi/provider/v1/provider.pb.d.ts +14 -0
- package/dist/weaveapi/provider/v1/provider.pb.js +88 -2
- package/dist/weaveapi/provider/v1/service.pb.d.ts +26 -1
- package/dist/weaveapi/provider/v1/service.pb.js +325 -6
- package/dist/weavesql/weavedb/model_catalog_sql.d.ts +91 -0
- package/dist/weavesql/weavedb/model_catalog_sql.js +213 -0
- package/dist/weavesql/weavedb/provider_sql.d.ts +25 -9
- package/dist/weavesql/weavedb/provider_sql.js +83 -54
- package/package.json +2 -2
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLatestModelCatalogRevisionQuery = exports.getModelCatalogModelByProviderAndIDQuery = exports.listModelCatalogModelsByProviderQuery = exports.listModelCatalogProvidersQuery = exports.deleteModelCatalogModelsByProviderQuery = exports.upsertModelCatalogModelQuery = void 0;
|
|
4
|
+
exports.upsertModelCatalogModel = upsertModelCatalogModel;
|
|
5
|
+
exports.listModelCatalogProviders = listModelCatalogProviders;
|
|
6
|
+
exports.listModelCatalogModelsByProvider = listModelCatalogModelsByProvider;
|
|
7
|
+
exports.getModelCatalogModelByProviderAndID = getModelCatalogModelByProviderAndID;
|
|
8
|
+
exports.getLatestModelCatalogRevision = getLatestModelCatalogRevision;
|
|
9
|
+
exports.upsertModelCatalogModelQuery = `-- name: UpsertModelCatalogModel :one
|
|
10
|
+
INSERT INTO weave.llm_model_catalog_models (
|
|
11
|
+
provider_kind,
|
|
12
|
+
model_id,
|
|
13
|
+
display_name,
|
|
14
|
+
primary_type,
|
|
15
|
+
capabilities,
|
|
16
|
+
pricing,
|
|
17
|
+
params,
|
|
18
|
+
max_input_tokens,
|
|
19
|
+
max_output_tokens,
|
|
20
|
+
release_order,
|
|
21
|
+
catalog_revision,
|
|
22
|
+
synced_at
|
|
23
|
+
) VALUES (
|
|
24
|
+
$1,
|
|
25
|
+
$2,
|
|
26
|
+
$3,
|
|
27
|
+
$4,
|
|
28
|
+
$5,
|
|
29
|
+
$6,
|
|
30
|
+
$7,
|
|
31
|
+
$8,
|
|
32
|
+
$9,
|
|
33
|
+
$10,
|
|
34
|
+
$11,
|
|
35
|
+
$12
|
|
36
|
+
)
|
|
37
|
+
ON CONFLICT (provider_kind, model_id) DO UPDATE
|
|
38
|
+
SET
|
|
39
|
+
display_name = EXCLUDED.display_name,
|
|
40
|
+
primary_type = EXCLUDED.primary_type,
|
|
41
|
+
capabilities = EXCLUDED.capabilities,
|
|
42
|
+
pricing = EXCLUDED.pricing,
|
|
43
|
+
params = EXCLUDED.params,
|
|
44
|
+
max_input_tokens = EXCLUDED.max_input_tokens,
|
|
45
|
+
max_output_tokens = EXCLUDED.max_output_tokens,
|
|
46
|
+
release_order = EXCLUDED.release_order,
|
|
47
|
+
catalog_revision = EXCLUDED.catalog_revision,
|
|
48
|
+
synced_at = EXCLUDED.synced_at,
|
|
49
|
+
updated_at = now()
|
|
50
|
+
RETURNING
|
|
51
|
+
provider_kind,
|
|
52
|
+
model_id,
|
|
53
|
+
display_name,
|
|
54
|
+
primary_type,
|
|
55
|
+
capabilities,
|
|
56
|
+
pricing,
|
|
57
|
+
params,
|
|
58
|
+
max_input_tokens,
|
|
59
|
+
max_output_tokens,
|
|
60
|
+
release_order,
|
|
61
|
+
catalog_revision,
|
|
62
|
+
synced_at,
|
|
63
|
+
updated_at`;
|
|
64
|
+
async function upsertModelCatalogModel(client, args) {
|
|
65
|
+
const result = await client.query({
|
|
66
|
+
text: exports.upsertModelCatalogModelQuery,
|
|
67
|
+
values: [args.providerKind, args.modelId, args.displayName, args.primaryType, args.capabilities, args.pricing, args.params, args.maxInputTokens, args.maxOutputTokens, args.releaseOrder, args.catalogRevision, args.syncedAt],
|
|
68
|
+
rowMode: "array"
|
|
69
|
+
});
|
|
70
|
+
if (result.rows.length !== 1) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
const row = result.rows[0];
|
|
74
|
+
return {
|
|
75
|
+
providerKind: row[0],
|
|
76
|
+
modelId: row[1],
|
|
77
|
+
displayName: row[2],
|
|
78
|
+
primaryType: row[3],
|
|
79
|
+
capabilities: row[4],
|
|
80
|
+
pricing: row[5],
|
|
81
|
+
params: row[6],
|
|
82
|
+
maxInputTokens: row[7],
|
|
83
|
+
maxOutputTokens: row[8],
|
|
84
|
+
releaseOrder: row[9],
|
|
85
|
+
catalogRevision: row[10],
|
|
86
|
+
syncedAt: row[11],
|
|
87
|
+
updatedAt: row[12]
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
exports.deleteModelCatalogModelsByProviderQuery = `-- name: DeleteModelCatalogModelsByProvider :execrows
|
|
91
|
+
DELETE FROM weave.llm_model_catalog_models
|
|
92
|
+
WHERE provider_kind = $1`;
|
|
93
|
+
exports.listModelCatalogProvidersQuery = `-- name: ListModelCatalogProviders :many
|
|
94
|
+
SELECT DISTINCT provider_kind
|
|
95
|
+
FROM weave.llm_model_catalog_models
|
|
96
|
+
ORDER BY provider_kind ASC`;
|
|
97
|
+
async function listModelCatalogProviders(client) {
|
|
98
|
+
const result = await client.query({
|
|
99
|
+
text: exports.listModelCatalogProvidersQuery,
|
|
100
|
+
values: [],
|
|
101
|
+
rowMode: "array"
|
|
102
|
+
});
|
|
103
|
+
return result.rows.map(row => {
|
|
104
|
+
return {
|
|
105
|
+
providerKind: row[0]
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
exports.listModelCatalogModelsByProviderQuery = `-- name: ListModelCatalogModelsByProvider :many
|
|
110
|
+
SELECT
|
|
111
|
+
provider_kind,
|
|
112
|
+
model_id,
|
|
113
|
+
display_name,
|
|
114
|
+
primary_type,
|
|
115
|
+
capabilities,
|
|
116
|
+
pricing,
|
|
117
|
+
params,
|
|
118
|
+
max_input_tokens,
|
|
119
|
+
max_output_tokens,
|
|
120
|
+
release_order,
|
|
121
|
+
catalog_revision,
|
|
122
|
+
synced_at,
|
|
123
|
+
updated_at
|
|
124
|
+
FROM weave.llm_model_catalog_models
|
|
125
|
+
WHERE provider_kind = $1
|
|
126
|
+
ORDER BY release_order ASC, model_id ASC`;
|
|
127
|
+
async function listModelCatalogModelsByProvider(client, args) {
|
|
128
|
+
const result = await client.query({
|
|
129
|
+
text: exports.listModelCatalogModelsByProviderQuery,
|
|
130
|
+
values: [args.providerKind],
|
|
131
|
+
rowMode: "array"
|
|
132
|
+
});
|
|
133
|
+
return result.rows.map(row => {
|
|
134
|
+
return {
|
|
135
|
+
providerKind: row[0],
|
|
136
|
+
modelId: row[1],
|
|
137
|
+
displayName: row[2],
|
|
138
|
+
primaryType: row[3],
|
|
139
|
+
capabilities: row[4],
|
|
140
|
+
pricing: row[5],
|
|
141
|
+
params: row[6],
|
|
142
|
+
maxInputTokens: row[7],
|
|
143
|
+
maxOutputTokens: row[8],
|
|
144
|
+
releaseOrder: row[9],
|
|
145
|
+
catalogRevision: row[10],
|
|
146
|
+
syncedAt: row[11],
|
|
147
|
+
updatedAt: row[12]
|
|
148
|
+
};
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
exports.getModelCatalogModelByProviderAndIDQuery = `-- name: GetModelCatalogModelByProviderAndID :one
|
|
152
|
+
SELECT
|
|
153
|
+
provider_kind,
|
|
154
|
+
model_id,
|
|
155
|
+
display_name,
|
|
156
|
+
primary_type,
|
|
157
|
+
capabilities,
|
|
158
|
+
pricing,
|
|
159
|
+
params,
|
|
160
|
+
max_input_tokens,
|
|
161
|
+
max_output_tokens,
|
|
162
|
+
release_order,
|
|
163
|
+
catalog_revision,
|
|
164
|
+
synced_at,
|
|
165
|
+
updated_at
|
|
166
|
+
FROM weave.llm_model_catalog_models
|
|
167
|
+
WHERE provider_kind = $1
|
|
168
|
+
AND model_id = $2`;
|
|
169
|
+
async function getModelCatalogModelByProviderAndID(client, args) {
|
|
170
|
+
const result = await client.query({
|
|
171
|
+
text: exports.getModelCatalogModelByProviderAndIDQuery,
|
|
172
|
+
values: [args.providerKind, args.modelId],
|
|
173
|
+
rowMode: "array"
|
|
174
|
+
});
|
|
175
|
+
if (result.rows.length !== 1) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
const row = result.rows[0];
|
|
179
|
+
return {
|
|
180
|
+
providerKind: row[0],
|
|
181
|
+
modelId: row[1],
|
|
182
|
+
displayName: row[2],
|
|
183
|
+
primaryType: row[3],
|
|
184
|
+
capabilities: row[4],
|
|
185
|
+
pricing: row[5],
|
|
186
|
+
params: row[6],
|
|
187
|
+
maxInputTokens: row[7],
|
|
188
|
+
maxOutputTokens: row[8],
|
|
189
|
+
releaseOrder: row[9],
|
|
190
|
+
catalogRevision: row[10],
|
|
191
|
+
syncedAt: row[11],
|
|
192
|
+
updatedAt: row[12]
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
exports.getLatestModelCatalogRevisionQuery = `-- name: GetLatestModelCatalogRevision :one
|
|
196
|
+
SELECT catalog_revision
|
|
197
|
+
FROM weave.llm_model_catalog_models
|
|
198
|
+
ORDER BY synced_at DESC, updated_at DESC
|
|
199
|
+
LIMIT 1`;
|
|
200
|
+
async function getLatestModelCatalogRevision(client) {
|
|
201
|
+
const result = await client.query({
|
|
202
|
+
text: exports.getLatestModelCatalogRevisionQuery,
|
|
203
|
+
values: [],
|
|
204
|
+
rowMode: "array"
|
|
205
|
+
});
|
|
206
|
+
if (result.rows.length !== 1) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
const row = result.rows[0];
|
|
210
|
+
return {
|
|
211
|
+
catalogRevision: row[0]
|
|
212
|
+
};
|
|
213
|
+
}
|
|
@@ -2,13 +2,15 @@ import { QueryArrayConfig, QueryArrayResult } from "pg";
|
|
|
2
2
|
interface Client {
|
|
3
3
|
query: (config: QueryArrayConfig) => Promise<QueryArrayResult>;
|
|
4
4
|
}
|
|
5
|
-
export declare const createProviderConfigurationQuery = "-- name: CreateProviderConfiguration :one\nINSERT INTO weave.llm_provider_configurations (\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n status,\n created_by_user_id,\n updated_by_user_id\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8\n)\nRETURNING\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at";
|
|
5
|
+
export declare const createProviderConfigurationQuery = "-- name: CreateProviderConfiguration :one\nINSERT INTO weave.llm_provider_configurations (\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n authentication_type,\n settings,\n status,\n created_by_user_id,\n updated_by_user_id\n) VALUES (\n $1,\n $2,\n $3,\n $4,\n $5,\n $6,\n $7,\n $8,\n $9,\n $10\n)\nRETURNING\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n authentication_type,\n settings,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at";
|
|
6
6
|
export interface CreateProviderConfigurationArgs {
|
|
7
7
|
id: string;
|
|
8
8
|
organizationId: string;
|
|
9
9
|
providerKind: string;
|
|
10
10
|
displayName: string;
|
|
11
11
|
baseUrl: string | null;
|
|
12
|
+
authenticationType: string;
|
|
13
|
+
settings: any;
|
|
12
14
|
status: string;
|
|
13
15
|
createdByUserId: string;
|
|
14
16
|
updatedByUserId: string;
|
|
@@ -19,6 +21,8 @@ export interface CreateProviderConfigurationRow {
|
|
|
19
21
|
providerKind: string;
|
|
20
22
|
displayName: string;
|
|
21
23
|
baseUrl: string | null;
|
|
24
|
+
authenticationType: string;
|
|
25
|
+
settings: any;
|
|
22
26
|
status: string;
|
|
23
27
|
createdByUserId: string;
|
|
24
28
|
updatedByUserId: string;
|
|
@@ -26,7 +30,7 @@ export interface CreateProviderConfigurationRow {
|
|
|
26
30
|
updatedAt: Date;
|
|
27
31
|
}
|
|
28
32
|
export declare function createProviderConfiguration(client: Client, args: CreateProviderConfigurationArgs): Promise<CreateProviderConfigurationRow | null>;
|
|
29
|
-
export declare const getProviderConfigurationByIDQuery = "-- name: GetProviderConfigurationByID :one\nSELECT\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at\nFROM weave.llm_provider_configurations\nWHERE organization_id = $1\n AND id = $2";
|
|
33
|
+
export declare const getProviderConfigurationByIDQuery = "-- name: GetProviderConfigurationByID :one\nSELECT\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n authentication_type,\n settings,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at\nFROM weave.llm_provider_configurations\nWHERE organization_id = $1\n AND id = $2";
|
|
30
34
|
export interface GetProviderConfigurationByIDArgs {
|
|
31
35
|
organizationId: string;
|
|
32
36
|
id: string;
|
|
@@ -37,6 +41,8 @@ export interface GetProviderConfigurationByIDRow {
|
|
|
37
41
|
providerKind: string;
|
|
38
42
|
displayName: string;
|
|
39
43
|
baseUrl: string | null;
|
|
44
|
+
authenticationType: string;
|
|
45
|
+
settings: any;
|
|
40
46
|
status: string;
|
|
41
47
|
createdByUserId: string;
|
|
42
48
|
updatedByUserId: string;
|
|
@@ -44,25 +50,27 @@ export interface GetProviderConfigurationByIDRow {
|
|
|
44
50
|
updatedAt: Date;
|
|
45
51
|
}
|
|
46
52
|
export declare function getProviderConfigurationByID(client: Client, args: GetProviderConfigurationByIDArgs): Promise<GetProviderConfigurationByIDRow | null>;
|
|
47
|
-
export declare const
|
|
48
|
-
export interface
|
|
53
|
+
export declare const listProviderConfigurationsByKindQuery = "-- name: ListProviderConfigurationsByKind :many\nSELECT\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n authentication_type,\n settings,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at\nFROM weave.llm_provider_configurations\nWHERE organization_id = $1\n AND provider_kind = $2\nORDER BY updated_at DESC, created_at DESC";
|
|
54
|
+
export interface ListProviderConfigurationsByKindArgs {
|
|
49
55
|
organizationId: string;
|
|
50
56
|
providerKind: string;
|
|
51
57
|
}
|
|
52
|
-
export interface
|
|
58
|
+
export interface ListProviderConfigurationsByKindRow {
|
|
53
59
|
id: string;
|
|
54
60
|
organizationId: string;
|
|
55
61
|
providerKind: string;
|
|
56
62
|
displayName: string;
|
|
57
63
|
baseUrl: string | null;
|
|
64
|
+
authenticationType: string;
|
|
65
|
+
settings: any;
|
|
58
66
|
status: string;
|
|
59
67
|
createdByUserId: string;
|
|
60
68
|
updatedByUserId: string;
|
|
61
69
|
createdAt: Date;
|
|
62
70
|
updatedAt: Date;
|
|
63
71
|
}
|
|
64
|
-
export declare function
|
|
65
|
-
export declare const listProviderConfigurationsQuery = "-- name: ListProviderConfigurations :many\nSELECT\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at\nFROM weave.llm_provider_configurations\nWHERE organization_id = $1\nORDER BY updated_at DESC, created_at DESC";
|
|
72
|
+
export declare function listProviderConfigurationsByKind(client: Client, args: ListProviderConfigurationsByKindArgs): Promise<ListProviderConfigurationsByKindRow[]>;
|
|
73
|
+
export declare const listProviderConfigurationsQuery = "-- name: ListProviderConfigurations :many\nSELECT\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n authentication_type,\n settings,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at\nFROM weave.llm_provider_configurations\nWHERE organization_id = $1\nORDER BY updated_at DESC, created_at DESC";
|
|
66
74
|
export interface ListProviderConfigurationsArgs {
|
|
67
75
|
organizationId: string;
|
|
68
76
|
}
|
|
@@ -72,6 +80,8 @@ export interface ListProviderConfigurationsRow {
|
|
|
72
80
|
providerKind: string;
|
|
73
81
|
displayName: string;
|
|
74
82
|
baseUrl: string | null;
|
|
83
|
+
authenticationType: string;
|
|
84
|
+
settings: any;
|
|
75
85
|
status: string;
|
|
76
86
|
createdByUserId: string;
|
|
77
87
|
updatedByUserId: string;
|
|
@@ -79,10 +89,12 @@ export interface ListProviderConfigurationsRow {
|
|
|
79
89
|
updatedAt: Date;
|
|
80
90
|
}
|
|
81
91
|
export declare function listProviderConfigurations(client: Client, args: ListProviderConfigurationsArgs): Promise<ListProviderConfigurationsRow[]>;
|
|
82
|
-
export declare const updateProviderConfigurationByIDQuery = "-- name: UpdateProviderConfigurationByID :one\nUPDATE weave.llm_provider_configurations\nSET\n display_name = $1,\n base_url = $2,\n
|
|
92
|
+
export declare const updateProviderConfigurationByIDQuery = "-- name: UpdateProviderConfigurationByID :one\nUPDATE weave.llm_provider_configurations\nSET\n display_name = $1,\n base_url = $2,\n authentication_type = $3,\n settings = $4,\n status = $5,\n updated_by_user_id = $6,\n updated_at = now()\nWHERE organization_id = $7\n AND id = $8\nRETURNING\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n authentication_type,\n settings,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at";
|
|
83
93
|
export interface UpdateProviderConfigurationByIDArgs {
|
|
84
94
|
displayName: string;
|
|
85
95
|
baseUrl: string | null;
|
|
96
|
+
authenticationType: string;
|
|
97
|
+
settings: any;
|
|
86
98
|
status: string;
|
|
87
99
|
updatedByUserId: string;
|
|
88
100
|
organizationId: string;
|
|
@@ -94,6 +106,8 @@ export interface UpdateProviderConfigurationByIDRow {
|
|
|
94
106
|
providerKind: string;
|
|
95
107
|
displayName: string;
|
|
96
108
|
baseUrl: string | null;
|
|
109
|
+
authenticationType: string;
|
|
110
|
+
settings: any;
|
|
97
111
|
status: string;
|
|
98
112
|
createdByUserId: string;
|
|
99
113
|
updatedByUserId: string;
|
|
@@ -101,7 +115,7 @@ export interface UpdateProviderConfigurationByIDRow {
|
|
|
101
115
|
updatedAt: Date;
|
|
102
116
|
}
|
|
103
117
|
export declare function updateProviderConfigurationByID(client: Client, args: UpdateProviderConfigurationByIDArgs): Promise<UpdateProviderConfigurationByIDRow | null>;
|
|
104
|
-
export declare const disableProviderConfigurationByIDQuery = "-- name: DisableProviderConfigurationByID :one\nUPDATE weave.llm_provider_configurations\nSET\n status = 'PROVIDER_CONFIGURATION_STATUS_DISABLED',\n updated_by_user_id = $1,\n updated_at = now()\nWHERE organization_id = $2\n AND id = $3\nRETURNING\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at";
|
|
118
|
+
export declare const disableProviderConfigurationByIDQuery = "-- name: DisableProviderConfigurationByID :one\nUPDATE weave.llm_provider_configurations\nSET\n status = 'PROVIDER_CONFIGURATION_STATUS_DISABLED',\n updated_by_user_id = $1,\n updated_at = now()\nWHERE organization_id = $2\n AND id = $3\nRETURNING\n id,\n organization_id,\n provider_kind,\n display_name,\n base_url,\n authentication_type,\n settings,\n status,\n created_by_user_id,\n updated_by_user_id,\n created_at,\n updated_at";
|
|
105
119
|
export interface DisableProviderConfigurationByIDArgs {
|
|
106
120
|
updatedByUserId: string;
|
|
107
121
|
organizationId: string;
|
|
@@ -113,6 +127,8 @@ export interface DisableProviderConfigurationByIDRow {
|
|
|
113
127
|
providerKind: string;
|
|
114
128
|
displayName: string;
|
|
115
129
|
baseUrl: string | null;
|
|
130
|
+
authenticationType: string;
|
|
131
|
+
settings: any;
|
|
116
132
|
status: string;
|
|
117
133
|
createdByUserId: string;
|
|
118
134
|
updatedByUserId: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProviderCredentialByProviderIDQuery = exports.upsertProviderCredentialQuery = exports.disableProviderConfigurationByIDQuery = exports.updateProviderConfigurationByIDQuery = exports.listProviderConfigurationsQuery = exports.
|
|
3
|
+
exports.getProviderCredentialByProviderIDQuery = exports.upsertProviderCredentialQuery = exports.disableProviderConfigurationByIDQuery = exports.updateProviderConfigurationByIDQuery = exports.listProviderConfigurationsQuery = exports.listProviderConfigurationsByKindQuery = exports.getProviderConfigurationByIDQuery = exports.createProviderConfigurationQuery = void 0;
|
|
4
4
|
exports.createProviderConfiguration = createProviderConfiguration;
|
|
5
5
|
exports.getProviderConfigurationByID = getProviderConfigurationByID;
|
|
6
|
-
exports.
|
|
6
|
+
exports.listProviderConfigurationsByKind = listProviderConfigurationsByKind;
|
|
7
7
|
exports.listProviderConfigurations = listProviderConfigurations;
|
|
8
8
|
exports.updateProviderConfigurationByID = updateProviderConfigurationByID;
|
|
9
9
|
exports.disableProviderConfigurationByID = disableProviderConfigurationByID;
|
|
@@ -16,6 +16,8 @@ INSERT INTO weave.llm_provider_configurations (
|
|
|
16
16
|
provider_kind,
|
|
17
17
|
display_name,
|
|
18
18
|
base_url,
|
|
19
|
+
authentication_type,
|
|
20
|
+
settings,
|
|
19
21
|
status,
|
|
20
22
|
created_by_user_id,
|
|
21
23
|
updated_by_user_id
|
|
@@ -27,7 +29,9 @@ INSERT INTO weave.llm_provider_configurations (
|
|
|
27
29
|
$5,
|
|
28
30
|
$6,
|
|
29
31
|
$7,
|
|
30
|
-
$8
|
|
32
|
+
$8,
|
|
33
|
+
$9,
|
|
34
|
+
$10
|
|
31
35
|
)
|
|
32
36
|
RETURNING
|
|
33
37
|
id,
|
|
@@ -35,6 +39,8 @@ RETURNING
|
|
|
35
39
|
provider_kind,
|
|
36
40
|
display_name,
|
|
37
41
|
base_url,
|
|
42
|
+
authentication_type,
|
|
43
|
+
settings,
|
|
38
44
|
status,
|
|
39
45
|
created_by_user_id,
|
|
40
46
|
updated_by_user_id,
|
|
@@ -43,7 +49,7 @@ RETURNING
|
|
|
43
49
|
async function createProviderConfiguration(client, args) {
|
|
44
50
|
const result = await client.query({
|
|
45
51
|
text: exports.createProviderConfigurationQuery,
|
|
46
|
-
values: [args.id, args.organizationId, args.providerKind, args.displayName, args.baseUrl, args.status, args.createdByUserId, args.updatedByUserId],
|
|
52
|
+
values: [args.id, args.organizationId, args.providerKind, args.displayName, args.baseUrl, args.authenticationType, args.settings, args.status, args.createdByUserId, args.updatedByUserId],
|
|
47
53
|
rowMode: "array"
|
|
48
54
|
});
|
|
49
55
|
if (result.rows.length !== 1) {
|
|
@@ -56,11 +62,13 @@ async function createProviderConfiguration(client, args) {
|
|
|
56
62
|
providerKind: row[2],
|
|
57
63
|
displayName: row[3],
|
|
58
64
|
baseUrl: row[4],
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
authenticationType: row[5],
|
|
66
|
+
settings: row[6],
|
|
67
|
+
status: row[7],
|
|
68
|
+
createdByUserId: row[8],
|
|
69
|
+
updatedByUserId: row[9],
|
|
70
|
+
createdAt: row[10],
|
|
71
|
+
updatedAt: row[11]
|
|
64
72
|
};
|
|
65
73
|
}
|
|
66
74
|
exports.getProviderConfigurationByIDQuery = `-- name: GetProviderConfigurationByID :one
|
|
@@ -70,6 +78,8 @@ SELECT
|
|
|
70
78
|
provider_kind,
|
|
71
79
|
display_name,
|
|
72
80
|
base_url,
|
|
81
|
+
authentication_type,
|
|
82
|
+
settings,
|
|
73
83
|
status,
|
|
74
84
|
created_by_user_id,
|
|
75
85
|
updated_by_user_id,
|
|
@@ -94,20 +104,24 @@ async function getProviderConfigurationByID(client, args) {
|
|
|
94
104
|
providerKind: row[2],
|
|
95
105
|
displayName: row[3],
|
|
96
106
|
baseUrl: row[4],
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
authenticationType: row[5],
|
|
108
|
+
settings: row[6],
|
|
109
|
+
status: row[7],
|
|
110
|
+
createdByUserId: row[8],
|
|
111
|
+
updatedByUserId: row[9],
|
|
112
|
+
createdAt: row[10],
|
|
113
|
+
updatedAt: row[11]
|
|
102
114
|
};
|
|
103
115
|
}
|
|
104
|
-
exports.
|
|
116
|
+
exports.listProviderConfigurationsByKindQuery = `-- name: ListProviderConfigurationsByKind :many
|
|
105
117
|
SELECT
|
|
106
118
|
id,
|
|
107
119
|
organization_id,
|
|
108
120
|
provider_kind,
|
|
109
121
|
display_name,
|
|
110
122
|
base_url,
|
|
123
|
+
authentication_type,
|
|
124
|
+
settings,
|
|
111
125
|
status,
|
|
112
126
|
created_by_user_id,
|
|
113
127
|
updated_by_user_id,
|
|
@@ -115,29 +129,30 @@ SELECT
|
|
|
115
129
|
updated_at
|
|
116
130
|
FROM weave.llm_provider_configurations
|
|
117
131
|
WHERE organization_id = $1
|
|
118
|
-
AND provider_kind = $2
|
|
119
|
-
|
|
132
|
+
AND provider_kind = $2
|
|
133
|
+
ORDER BY updated_at DESC, created_at DESC`;
|
|
134
|
+
async function listProviderConfigurationsByKind(client, args) {
|
|
120
135
|
const result = await client.query({
|
|
121
|
-
text: exports.
|
|
136
|
+
text: exports.listProviderConfigurationsByKindQuery,
|
|
122
137
|
values: [args.organizationId, args.providerKind],
|
|
123
138
|
rowMode: "array"
|
|
124
139
|
});
|
|
125
|
-
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
};
|
|
140
|
+
return result.rows.map(row => {
|
|
141
|
+
return {
|
|
142
|
+
id: row[0],
|
|
143
|
+
organizationId: row[1],
|
|
144
|
+
providerKind: row[2],
|
|
145
|
+
displayName: row[3],
|
|
146
|
+
baseUrl: row[4],
|
|
147
|
+
authenticationType: row[5],
|
|
148
|
+
settings: row[6],
|
|
149
|
+
status: row[7],
|
|
150
|
+
createdByUserId: row[8],
|
|
151
|
+
updatedByUserId: row[9],
|
|
152
|
+
createdAt: row[10],
|
|
153
|
+
updatedAt: row[11]
|
|
154
|
+
};
|
|
155
|
+
});
|
|
141
156
|
}
|
|
142
157
|
exports.listProviderConfigurationsQuery = `-- name: ListProviderConfigurations :many
|
|
143
158
|
SELECT
|
|
@@ -146,6 +161,8 @@ SELECT
|
|
|
146
161
|
provider_kind,
|
|
147
162
|
display_name,
|
|
148
163
|
base_url,
|
|
164
|
+
authentication_type,
|
|
165
|
+
settings,
|
|
149
166
|
status,
|
|
150
167
|
created_by_user_id,
|
|
151
168
|
updated_by_user_id,
|
|
@@ -167,11 +184,13 @@ async function listProviderConfigurations(client, args) {
|
|
|
167
184
|
providerKind: row[2],
|
|
168
185
|
displayName: row[3],
|
|
169
186
|
baseUrl: row[4],
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
187
|
+
authenticationType: row[5],
|
|
188
|
+
settings: row[6],
|
|
189
|
+
status: row[7],
|
|
190
|
+
createdByUserId: row[8],
|
|
191
|
+
updatedByUserId: row[9],
|
|
192
|
+
createdAt: row[10],
|
|
193
|
+
updatedAt: row[11]
|
|
175
194
|
};
|
|
176
195
|
});
|
|
177
196
|
}
|
|
@@ -180,17 +199,21 @@ UPDATE weave.llm_provider_configurations
|
|
|
180
199
|
SET
|
|
181
200
|
display_name = $1,
|
|
182
201
|
base_url = $2,
|
|
183
|
-
|
|
184
|
-
|
|
202
|
+
authentication_type = $3,
|
|
203
|
+
settings = $4,
|
|
204
|
+
status = $5,
|
|
205
|
+
updated_by_user_id = $6,
|
|
185
206
|
updated_at = now()
|
|
186
|
-
WHERE organization_id = $
|
|
187
|
-
AND id = $
|
|
207
|
+
WHERE organization_id = $7
|
|
208
|
+
AND id = $8
|
|
188
209
|
RETURNING
|
|
189
210
|
id,
|
|
190
211
|
organization_id,
|
|
191
212
|
provider_kind,
|
|
192
213
|
display_name,
|
|
193
214
|
base_url,
|
|
215
|
+
authentication_type,
|
|
216
|
+
settings,
|
|
194
217
|
status,
|
|
195
218
|
created_by_user_id,
|
|
196
219
|
updated_by_user_id,
|
|
@@ -199,7 +222,7 @@ RETURNING
|
|
|
199
222
|
async function updateProviderConfigurationByID(client, args) {
|
|
200
223
|
const result = await client.query({
|
|
201
224
|
text: exports.updateProviderConfigurationByIDQuery,
|
|
202
|
-
values: [args.displayName, args.baseUrl, args.status, args.updatedByUserId, args.organizationId, args.id],
|
|
225
|
+
values: [args.displayName, args.baseUrl, args.authenticationType, args.settings, args.status, args.updatedByUserId, args.organizationId, args.id],
|
|
203
226
|
rowMode: "array"
|
|
204
227
|
});
|
|
205
228
|
if (result.rows.length !== 1) {
|
|
@@ -212,11 +235,13 @@ async function updateProviderConfigurationByID(client, args) {
|
|
|
212
235
|
providerKind: row[2],
|
|
213
236
|
displayName: row[3],
|
|
214
237
|
baseUrl: row[4],
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
238
|
+
authenticationType: row[5],
|
|
239
|
+
settings: row[6],
|
|
240
|
+
status: row[7],
|
|
241
|
+
createdByUserId: row[8],
|
|
242
|
+
updatedByUserId: row[9],
|
|
243
|
+
createdAt: row[10],
|
|
244
|
+
updatedAt: row[11]
|
|
220
245
|
};
|
|
221
246
|
}
|
|
222
247
|
exports.disableProviderConfigurationByIDQuery = `-- name: DisableProviderConfigurationByID :one
|
|
@@ -233,6 +258,8 @@ RETURNING
|
|
|
233
258
|
provider_kind,
|
|
234
259
|
display_name,
|
|
235
260
|
base_url,
|
|
261
|
+
authentication_type,
|
|
262
|
+
settings,
|
|
236
263
|
status,
|
|
237
264
|
created_by_user_id,
|
|
238
265
|
updated_by_user_id,
|
|
@@ -254,11 +281,13 @@ async function disableProviderConfigurationByID(client, args) {
|
|
|
254
281
|
providerKind: row[2],
|
|
255
282
|
displayName: row[3],
|
|
256
283
|
baseUrl: row[4],
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
284
|
+
authenticationType: row[5],
|
|
285
|
+
settings: row[6],
|
|
286
|
+
status: row[7],
|
|
287
|
+
createdByUserId: row[8],
|
|
288
|
+
updatedByUserId: row[9],
|
|
289
|
+
createdAt: row[10],
|
|
290
|
+
updatedAt: row[11]
|
|
262
291
|
};
|
|
263
292
|
}
|
|
264
293
|
exports.upsertProviderCredentialQuery = `-- name: UpsertProviderCredential :one
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weave-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.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.20260417.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "node tools/sqlcgen.test.js",
|