Skip to content

Commit bd9fb9f

Browse files
chore(deps): update dependency gts to v6 (#29)
* chore(deps): update dependency gts to v6 * fix lint issues --------- Co-authored-by: Twisha Bansal <twishabansal@google.com>
1 parent f1dc8f1 commit bd9fb9f

18 files changed

+268
-259
lines changed

packages/toolbox-core/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"extends": "./node_modules/gts",
3+
"parserOptions": {
4+
"project": "./tsconfig.json"
5+
},
36
"env": {
47
"node": true,
58
"jest": true

packages/toolbox-core/package-lock.json

Lines changed: 38 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/toolbox-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@types/tmp": "^0.2.6",
5858
"cross-env": "^7.0.3",
5959
"fs-extra": "^11.3.0",
60-
"gts": "^5.3.1",
60+
"gts": "^6.0.0",
6161
"jest": "^29.7.0",
6262
"tmp": "^0.2.3",
6363
"ts-jest": "^29.3.4",

packages/toolbox-core/src/toolbox_core/client.ts

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class ToolboxClient {
5656
constructor(
5757
url: string,
5858
session?: AxiosInstance | null,
59-
clientHeaders?: ClientHeadersConfig | null
59+
clientHeaders?: ClientHeadersConfig | null,
6060
) {
6161
this.#baseUrl = url;
6262
this.#session = session || axios.create({baseURL: this.#baseUrl});
@@ -72,7 +72,7 @@ class ToolboxClient {
7272
Object.entries(this.#clientHeaders).map(async ([key, value]) => {
7373
const resolved = await resolveValue(value);
7474
return [key, String(resolved)];
75-
})
75+
}),
7676
);
7777
return Object.fromEntries(resolvedEntries);
7878
}
@@ -129,7 +129,7 @@ class ToolboxClient {
129129
toolName: string,
130130
toolSchema: ToolSchemaFromManifest,
131131
authTokenGetters: AuthTokenGetters = {},
132-
boundParams: BoundParams = {}
132+
boundParams: BoundParams = {},
133133
): {
134134
tool: ReturnType<typeof ToolboxTool>;
135135
usedAuthKeys: Set<string>;
@@ -153,7 +153,7 @@ class ToolboxClient {
153153
identifyAuthRequirements(
154154
authParams,
155155
toolSchema.authRequired || [],
156-
authTokenGetters ? Object.keys(authTokenGetters) : []
156+
authTokenGetters ? Object.keys(authTokenGetters) : [],
157157
);
158158

159159
const paramZodSchema = createZodSchemaFromParams(params);
@@ -168,7 +168,7 @@ class ToolboxClient {
168168
remainingAuthnParams,
169169
remainingAuthzTokens,
170170
currBoundParams,
171-
this.#clientHeaders
171+
this.#clientHeaders,
172172
);
173173

174174
const usedBoundKeys = new Set(Object.keys(currBoundParams));
@@ -193,7 +193,7 @@ class ToolboxClient {
193193
async loadTool(
194194
name: string,
195195
authTokenGetters: AuthTokenGetters | null = {},
196-
boundParams: BoundParams | null = {}
196+
boundParams: BoundParams | null = {},
197197
): Promise<ReturnType<typeof ToolboxTool>> {
198198
const apiPath = `/api/tool/${name}`;
199199
const manifest = await this.#fetchAndParseManifest(apiPath);
@@ -207,20 +207,20 @@ class ToolboxClient {
207207
name,
208208
specificToolSchema,
209209
authTokenGetters || undefined,
210-
boundParams || {}
210+
boundParams || {},
211211
);
212212

213213
const providedAuthKeys = new Set(
214-
authTokenGetters ? Object.keys(authTokenGetters) : []
214+
authTokenGetters ? Object.keys(authTokenGetters) : [],
215215
);
216216
const providedBoundKeys = new Set(
217-
boundParams ? Object.keys(boundParams) : []
217+
boundParams ? Object.keys(boundParams) : [],
218218
);
219219
const unusedAuth = [...providedAuthKeys].filter(
220-
key => !usedAuthKeys.has(key)
220+
key => !usedAuthKeys.has(key),
221221
);
222222
const unusedBound = [...providedBoundKeys].filter(
223-
key => !usedBoundKeys.has(key)
223+
key => !usedBoundKeys.has(key),
224224
);
225225

226226
const errorMessages: string[] = [];
@@ -229,13 +229,13 @@ class ToolboxClient {
229229
}
230230
if (unusedBound.length > 0) {
231231
errorMessages.push(
232-
`unused bound parameters: ${unusedBound.join(', ')}`
232+
`unused bound parameters: ${unusedBound.join(', ')}`,
233233
);
234234
}
235235

236236
if (errorMessages.length > 0) {
237237
throw new Error(
238-
`Validation failed for tool '${name}': ${errorMessages.join('; ')}.`
238+
`Validation failed for tool '${name}': ${errorMessages.join('; ')}.`,
239239
);
240240
}
241241
return tool;
@@ -259,7 +259,7 @@ class ToolboxClient {
259259
name?: string,
260260
authTokenGetters: AuthTokenGetters | null = {},
261261
boundParams: BoundParams | null = {},
262-
strict = false
262+
strict = false,
263263
): Promise<Array<ReturnType<typeof ToolboxTool>>> {
264264
const toolsetName = name || '';
265265
const apiPath = `/api/toolset/${toolsetName}`;
@@ -270,40 +270,40 @@ class ToolboxClient {
270270
const overallUsedAuthKeys: Set<string> = new Set();
271271
const overallUsedBoundParams: Set<string> = new Set();
272272
const providedAuthKeys = new Set(
273-
authTokenGetters ? Object.keys(authTokenGetters) : []
273+
authTokenGetters ? Object.keys(authTokenGetters) : [],
274274
);
275275
const providedBoundKeys = new Set(
276-
boundParams ? Object.keys(boundParams) : []
276+
boundParams ? Object.keys(boundParams) : [],
277277
);
278278

279279
for (const [toolName, toolSchema] of Object.entries(manifest.tools)) {
280280
const {tool, usedAuthKeys, usedBoundKeys} = this.#createToolInstance(
281281
toolName,
282282
toolSchema,
283283
authTokenGetters || {},
284-
boundParams || {}
284+
boundParams || {},
285285
);
286286
tools.push(tool);
287287

288288
if (strict) {
289289
const unusedAuth = [...providedAuthKeys].filter(
290-
key => !usedAuthKeys.has(key)
290+
key => !usedAuthKeys.has(key),
291291
);
292292
const unusedBound = [...providedBoundKeys].filter(
293-
key => !usedBoundKeys.has(key)
293+
key => !usedBoundKeys.has(key),
294294
);
295295
const errorMessages: string[] = [];
296296
if (unusedAuth.length > 0) {
297297
errorMessages.push(`unused auth tokens: ${unusedAuth.join(', ')}`);
298298
}
299299
if (unusedBound.length > 0) {
300300
errorMessages.push(
301-
`unused bound parameters: ${unusedBound.join(', ')}`
301+
`unused bound parameters: ${unusedBound.join(', ')}`,
302302
);
303303
}
304304
if (errorMessages.length > 0) {
305305
throw new Error(
306-
`Validation failed for tool '${toolName}': ${errorMessages.join('; ')}.`
306+
`Validation failed for tool '${toolName}': ${errorMessages.join('; ')}.`,
307307
);
308308
}
309309
} else {
@@ -314,25 +314,25 @@ class ToolboxClient {
314314

315315
if (!strict) {
316316
const unusedAuth = [...providedAuthKeys].filter(
317-
key => !overallUsedAuthKeys.has(key)
317+
key => !overallUsedAuthKeys.has(key),
318318
);
319319
const unusedBound = [...providedBoundKeys].filter(
320-
key => !overallUsedBoundParams.has(key)
320+
key => !overallUsedBoundParams.has(key),
321321
);
322322
const errorMessages: string[] = [];
323323
if (unusedAuth.length > 0) {
324324
errorMessages.push(
325-
`unused auth tokens could not be applied to any tool: ${unusedAuth.join(', ')}`
325+
`unused auth tokens could not be applied to any tool: ${unusedAuth.join(', ')}`,
326326
);
327327
}
328328
if (unusedBound.length > 0) {
329329
errorMessages.push(
330-
`unused bound parameters could not be applied to any tool: ${unusedBound.join(', ')}`
330+
`unused bound parameters could not be applied to any tool: ${unusedBound.join(', ')}`,
331331
);
332332
}
333333
if (errorMessages.length > 0) {
334334
throw new Error(
335-
`Validation failed for toolset '${name || 'default'}': ${errorMessages.join('; ')}.`
335+
`Validation failed for toolset '${name || 'default'}': ${errorMessages.join('; ')}.`,
336336
);
337337
}
338338
}

0 commit comments

Comments
 (0)