🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@ai-sdk/provider-utils

Package Overview
Dependencies
Maintainers
3
Versions
304
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/provider-utils - npm Package Compare versions

Comparing version
4.0.32
to
4.0.33
+6
-0
CHANGELOG.md
# @ai-sdk/provider-utils
## 4.0.33
### Patch Changes
- b30e43a: Limit JSON response body reads in response handlers to prevent unbounded memory use.
## 4.0.32

@@ -4,0 +10,0 @@

+1
-1
{
"name": "@ai-sdk/provider-utils",
"version": "4.0.32",
"version": "4.0.33",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -5,2 +5,3 @@ import { APICallError, EmptyResponseBodyError } from '@ai-sdk/provider';

import { parseJsonEventStream } from './parse-json-event-stream';
import { readResponseWithSizeLimit } from './read-response-with-size-limit';
import type { FlexibleSchema } from './schema';

@@ -18,2 +19,19 @@

const textDecoder = new TextDecoder();
async function readResponseBodyAsText({
response,
url,
}: {
response: Response;
url: string;
}) {
return textDecoder.decode(
await readResponseWithSizeLimit({
response,
url,
}),
);
}
export const createJsonErrorResponseHandler =

@@ -30,3 +48,3 @@ <T>({

async ({ response, url, requestBodyValues }) => {
const responseBody = await response.text();
const responseBody = await readResponseBodyAsText({ response, url });
const responseHeaders = extractResponseHeaders(response);

@@ -109,3 +127,3 @@

async ({ response, url, requestBodyValues }) => {
const responseBody = await response.text();
const responseBody = await readResponseBodyAsText({ response, url });

@@ -177,3 +195,3 @@ const parsedResult = await safeParseJSON({

const responseHeaders = extractResponseHeaders(response);
const responseBody = await response.text();
const responseBody = await readResponseBodyAsText({ response, url });

@@ -180,0 +198,0 @@ return {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display