weave-typescript 0.19.0 → 0.20.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.
@@ -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.getProviderConfigurationByKindQuery = exports.getProviderConfigurationByIDQuery = exports.createProviderConfigurationQuery = void 0;
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.getProviderConfigurationByKind = getProviderConfigurationByKind;
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
- status: row[5],
60
- createdByUserId: row[6],
61
- updatedByUserId: row[7],
62
- createdAt: row[8],
63
- updatedAt: row[9]
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
- status: row[5],
98
- createdByUserId: row[6],
99
- updatedByUserId: row[7],
100
- createdAt: row[8],
101
- updatedAt: row[9]
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.getProviderConfigurationByKindQuery = `-- name: GetProviderConfigurationByKind :one
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
- async function getProviderConfigurationByKind(client, args) {
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.getProviderConfigurationByKindQuery,
136
+ text: exports.listProviderConfigurationsByKindQuery,
122
137
  values: [args.organizationId, args.providerKind],
123
138
  rowMode: "array"
124
139
  });
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
- };
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
- status: row[5],
171
- createdByUserId: row[6],
172
- updatedByUserId: row[7],
173
- createdAt: row[8],
174
- updatedAt: row[9]
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
- status = $3,
184
- updated_by_user_id = $4,
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 = $5
187
- AND id = $6
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
- status: row[5],
216
- createdByUserId: row[6],
217
- updatedByUserId: row[7],
218
- createdAt: row[8],
219
- updatedAt: row[9]
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
- status: row[5],
258
- createdByUserId: row[6],
259
- updatedByUserId: row[7],
260
- createdAt: row[8],
261
- updatedAt: row[9]
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.19.0",
3
+ "version": "0.20.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [