mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-07 22:24:06 -05:00
fix(build): fix type assertion (#2696)
* fix(build): fix type assertion * ack PR comment * more
This commit is contained in:
@@ -70,7 +70,7 @@ export const requestTool: ToolConfig<RequestParams, RequestResponse> = {
|
||||
return allHeaders
|
||||
},
|
||||
|
||||
body: (params: RequestParams) => {
|
||||
body: ((params: RequestParams) => {
|
||||
if (params.formData) {
|
||||
const formData = new FormData()
|
||||
Object.entries(params.formData).forEach(([key, value]) => {
|
||||
@@ -90,7 +90,7 @@ export const requestTool: ToolConfig<RequestParams, RequestResponse> = {
|
||||
) {
|
||||
// Convert JSON object to URL-encoded string
|
||||
const urlencoded = new URLSearchParams()
|
||||
Object.entries(params.body).forEach(([key, value]) => {
|
||||
Object.entries(params.body as Record<string, unknown>).forEach(([key, value]) => {
|
||||
if (value !== undefined && value !== null) {
|
||||
urlencoded.append(key, String(value))
|
||||
}
|
||||
@@ -98,11 +98,11 @@ export const requestTool: ToolConfig<RequestParams, RequestResponse> = {
|
||||
return urlencoded.toString()
|
||||
}
|
||||
|
||||
return params.body
|
||||
return params.body as Record<string, any>
|
||||
}
|
||||
|
||||
return undefined
|
||||
},
|
||||
}) as (params: RequestParams) => Record<string, any> | string | FormData | undefined,
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
|
||||
@@ -68,7 +68,7 @@ export const webhookRequestTool: ToolConfig<WebhookRequestParams, RequestRespons
|
||||
return { ...webhookHeaders, ...userHeaders }
|
||||
},
|
||||
|
||||
body: (params: WebhookRequestParams) => params.body,
|
||||
body: (params: WebhookRequestParams) => params.body as Record<string, any>,
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
|
||||
@@ -93,7 +93,7 @@ export interface ToolConfig<P = any, R = any> {
|
||||
url: string | ((params: P) => string)
|
||||
method: HttpMethod | ((params: P) => HttpMethod)
|
||||
headers: (params: P) => Record<string, string>
|
||||
body?: (params: P) => Record<string, any> | string
|
||||
body?: (params: P) => Record<string, any> | string | FormData | undefined
|
||||
}
|
||||
|
||||
// Post-processing (optional) - allows additional processing after the initial request
|
||||
|
||||
Reference in New Issue
Block a user