@ai-sdk/provider-utils 4.0.66 → 4.0.68
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.
- package/CHANGELOG.md +16 -0
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/parse-json-event-stream.ts +18 -1
- package/src/schema.ts +2 -1
package/dist/index.mjs
CHANGED
|
@@ -947,7 +947,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
947
947
|
}
|
|
948
948
|
|
|
949
949
|
// src/version.ts
|
|
950
|
-
var VERSION = true ? "4.0.
|
|
950
|
+
var VERSION = true ? "4.0.68" : "0.0.0-test";
|
|
951
951
|
|
|
952
952
|
// src/get-from-api.ts
|
|
953
953
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -2526,7 +2526,7 @@ function standardSchema(standardSchema2) {
|
|
|
2526
2526
|
{
|
|
2527
2527
|
validate: async (value) => {
|
|
2528
2528
|
const result = await standardSchema2["~standard"].validate(value);
|
|
2529
|
-
return "value" in result ? { success: true, value: result.value } : {
|
|
2529
|
+
return result.issues === void 0 && "value" in result ? { success: true, value: result.value } : {
|
|
2530
2530
|
success: false,
|
|
2531
2531
|
error: new TypeValidationError({
|
|
2532
2532
|
value,
|
|
@@ -2676,11 +2676,13 @@ function isParsableJson(input) {
|
|
|
2676
2676
|
import {
|
|
2677
2677
|
EventSourceParserStream
|
|
2678
2678
|
} from "eventsource-parser/stream";
|
|
2679
|
+
var DEFAULT_MAX_EVENT_SIZE = 64 * 1024 * 1024;
|
|
2679
2680
|
function parseJsonEventStream({
|
|
2680
2681
|
stream,
|
|
2681
|
-
schema
|
|
2682
|
+
schema,
|
|
2683
|
+
maxEventSize = DEFAULT_MAX_EVENT_SIZE
|
|
2682
2684
|
}) {
|
|
2683
|
-
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
|
|
2685
|
+
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream({ maxBufferSize: maxEventSize })).pipeThrough(
|
|
2684
2686
|
new TransformStream({
|
|
2685
2687
|
async transform({ data }, controller) {
|
|
2686
2688
|
if (data === "[DONE]") {
|