@@ -46,9 +46,7 @@ export const invoke = (plan: Plan, input: unknown): Effect.Effect<unknown, unkno
4646 )
4747 }
4848 if ( json && Option . isNone ( decoded ) ) {
49- return yield * Effect . fail (
50- toolError ( `${ plan . operation . method } ${ plan . operation . path } returned malformed JSON.` ) ,
51- )
49+ return yield * Effect . fail ( toolError ( `${ plan . operation . method } ${ plan . operation . path } returned malformed JSON.` ) )
5250 }
5351 return parsed
5452 } )
@@ -208,8 +206,9 @@ const buildUrl = (plan: Plan, input: Readonly<Record<string, unknown>>): string
208206 return toolError ( `Missing required path parameter '${ field . inputName } '.` )
209207 }
210208 const fieldValue = serializeSimple ( field , item , ( value ) =>
211- encodeURIComponent ( value ) . replace ( / [ ! ' ( ) * ] / g, ( character ) =>
212- `%${ character . charCodeAt ( 0 ) . toString ( 16 ) . toUpperCase ( ) } ` ,
209+ encodeURIComponent ( value ) . replace (
210+ / [ ! ' ( ) * ] / g,
211+ ( character ) => `%${ character . charCodeAt ( 0 ) . toString ( 16 ) . toUpperCase ( ) } ` ,
213212 ) ,
214213 )
215214 if ( fieldValue instanceof ToolError ) return fieldValue
@@ -271,10 +270,7 @@ const serializeQuery = (
271270 if ( value . some ( ( item ) => item === undefined || ( item !== null && typeof item === "object" ) ) ) {
272271 return toolError ( `Query parameter '${ field . inputName } ' contains an unsupported nested value.` )
273272 }
274- return value . reduce (
275- ( current , item ) => HttpClientRequest . appendUrlParam ( current , field . name , String ( item ) ) ,
276- request ,
277- )
273+ return value . reduce ( ( current , item ) => HttpClientRequest . appendUrlParam ( current , field . name , String ( item ) ) , request )
278274 }
279275 if ( isRecord ( value ) && field . explode ) {
280276 return Object . entries ( value ) . reduce < HttpClientRequest . HttpClientRequest | ToolError > ( ( current , [ name , item ] ) => {
@@ -289,11 +285,15 @@ const serializeQuery = (
289285 return rendered instanceof ToolError ? rendered : HttpClientRequest . appendUrlParam ( request , field . name , rendered )
290286}
291287
292- const readResponseBody = ( response : HttpClientResponse . HttpClientResponse , plan : Plan ) : Effect . Effect < string , ToolError > =>
288+ const readResponseBody = (
289+ response : HttpClientResponse . HttpClientResponse ,
290+ plan : Plan ,
291+ ) : Effect . Effect < string , ToolError > =>
293292 Effect . gen ( function * ( ) {
294293 const contentLength = response . headers [ "content-length" ]
295294 const parsedSize = contentLength === undefined ? undefined : Number . parseInt ( contentLength , 10 )
296- const declaredSize = parsedSize !== undefined && Number . isSafeInteger ( parsedSize ) && parsedSize >= 0 ? parsedSize : undefined
295+ const declaredSize =
296+ parsedSize !== undefined && Number . isSafeInteger ( parsedSize ) && parsedSize >= 0 ? parsedSize : undefined
297297 if ( declaredSize !== undefined && declaredSize > maxResponseBodyBytes ) {
298298 return yield * Effect . fail ( toolError ( `${ plan . operation . method } ${ plan . operation . path } response exceeds 50 MiB.` ) )
299299 }
@@ -304,7 +304,9 @@ const readResponseBody = (response: HttpClientResponse.HttpClientResponse, plan:
304304 return Effect . fail ( toolError ( `${ plan . operation . method } ${ plan . operation . path } response exceeds 50 MiB.` ) )
305305 }
306306 if ( size + chunk . byteLength > body . byteLength ) {
307- const grown = Buffer . allocUnsafe ( Math . min ( maxResponseBodyBytes , Math . max ( size + chunk . byteLength , body . byteLength * 2 ) ) )
307+ const grown = Buffer . allocUnsafe (
308+ Math . min ( maxResponseBodyBytes , Math . max ( size + chunk . byteLength , body . byteLength * 2 ) ) ,
309+ )
308310 body . copy ( grown , 0 , 0 , size )
309311 body = grown
310312 }
0 commit comments