@ai-sdk/provider-utils 2.1.11 → 2.1.13
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 +13 -0
- package/package.json +2 -2
- package/test/dist/index.d.mts +9 -1
- package/test/dist/index.d.ts +9 -1
- package/test/dist/index.js +24 -7
- package/test/dist/index.js.map +1 -1
- package/test/dist/index.mjs +24 -7
- package/test/dist/index.mjs.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# @ai-sdk/provider-utils
|
2
2
|
|
3
|
+
## 2.1.13
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [2e1101a]
|
8
|
+
- @ai-sdk/provider@1.0.11
|
9
|
+
|
10
|
+
## 2.1.12
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- 1531959: feat (provider-utils): add readable-stream to unified test server
|
15
|
+
|
3
16
|
## 2.1.11
|
4
17
|
|
5
18
|
### Patch Changes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ai-sdk/provider-utils",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.13",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"sideEffects": false,
|
6
6
|
"main": "./dist/index.js",
|
@@ -26,7 +26,7 @@
|
|
26
26
|
}
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@ai-sdk/provider": "1.0.
|
29
|
+
"@ai-sdk/provider": "1.0.11",
|
30
30
|
"eventsource-parser": "^3.0.0",
|
31
31
|
"nanoid": "^3.3.8",
|
32
32
|
"secure-json-parse": "^2.7.0"
|
package/test/dist/index.d.mts
CHANGED
@@ -112,7 +112,11 @@ type UrlHandler = {
|
|
112
112
|
headers?: Record<string, string>;
|
113
113
|
status?: number;
|
114
114
|
body?: string;
|
115
|
-
}
|
115
|
+
} | {
|
116
|
+
type: 'readable-stream';
|
117
|
+
headers?: Record<string, string>;
|
118
|
+
stream: ReadableStream;
|
119
|
+
} | undefined;
|
116
120
|
};
|
117
121
|
type FullUrlHandler = {
|
118
122
|
response: {
|
@@ -136,6 +140,10 @@ type FullUrlHandler = {
|
|
136
140
|
type: 'empty';
|
137
141
|
headers?: Record<string, string>;
|
138
142
|
status?: number;
|
143
|
+
} | {
|
144
|
+
type: 'readable-stream';
|
145
|
+
headers?: Record<string, string>;
|
146
|
+
stream: ReadableStream;
|
139
147
|
} | undefined;
|
140
148
|
};
|
141
149
|
type FullHandlers<URLS extends {
|
package/test/dist/index.d.ts
CHANGED
@@ -112,7 +112,11 @@ type UrlHandler = {
|
|
112
112
|
headers?: Record<string, string>;
|
113
113
|
status?: number;
|
114
114
|
body?: string;
|
115
|
-
}
|
115
|
+
} | {
|
116
|
+
type: 'readable-stream';
|
117
|
+
headers?: Record<string, string>;
|
118
|
+
stream: ReadableStream;
|
119
|
+
} | undefined;
|
116
120
|
};
|
117
121
|
type FullUrlHandler = {
|
118
122
|
response: {
|
@@ -136,6 +140,10 @@ type FullUrlHandler = {
|
|
136
140
|
type: 'empty';
|
137
141
|
headers?: Record<string, string>;
|
138
142
|
status?: number;
|
143
|
+
} | {
|
144
|
+
type: 'readable-stream';
|
145
|
+
headers?: Record<string, string>;
|
146
|
+
stream: ReadableStream;
|
139
147
|
} | undefined;
|
140
148
|
};
|
141
149
|
type FullHandlers<URLS extends {
|
package/test/dist/index.js
CHANGED
@@ -18642,13 +18642,16 @@ function createServer({
|
|
18642
18642
|
pushController
|
18643
18643
|
}) {
|
18644
18644
|
const responsesArray = Array.isArray(responses) ? responses : [responses];
|
18645
|
-
const responsesByUrl = responsesArray.reduce(
|
18646
|
-
|
18647
|
-
responsesByUrl2[response.url]
|
18648
|
-
|
18649
|
-
|
18650
|
-
|
18651
|
-
|
18645
|
+
const responsesByUrl = responsesArray.reduce(
|
18646
|
+
(responsesByUrl2, response) => {
|
18647
|
+
if (!responsesByUrl2[response.url]) {
|
18648
|
+
responsesByUrl2[response.url] = [];
|
18649
|
+
}
|
18650
|
+
responsesByUrl2[response.url].push(response);
|
18651
|
+
return responsesByUrl2;
|
18652
|
+
},
|
18653
|
+
{}
|
18654
|
+
);
|
18652
18655
|
const streams = {};
|
18653
18656
|
responsesArray.filter(
|
18654
18657
|
(response) => response.type === "controlled-stream"
|
@@ -18850,6 +18853,20 @@ function createTestServer(routes) {
|
|
18850
18853
|
}
|
18851
18854
|
}
|
18852
18855
|
);
|
18856
|
+
case "readable-stream": {
|
18857
|
+
return new HttpResponse(
|
18858
|
+
response.stream.pipeThrough(new TextEncoderStream()),
|
18859
|
+
{
|
18860
|
+
status: 200,
|
18861
|
+
headers: {
|
18862
|
+
"Content-Type": "text/event-stream",
|
18863
|
+
"Cache-Control": "no-cache",
|
18864
|
+
Connection: "keep-alive",
|
18865
|
+
...response.headers
|
18866
|
+
}
|
18867
|
+
}
|
18868
|
+
);
|
18869
|
+
}
|
18853
18870
|
case "binary": {
|
18854
18871
|
return HttpResponse.arrayBuffer(response.body, {
|
18855
18872
|
status: 200,
|