@ai-sdk/provider-utils 3.0.13 → 3.0.14
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 +6 -0
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -103,6 +103,7 @@ function combineHeaders(...headers) {
|
|
|
103
103
|
|
|
104
104
|
// src/convert-async-iterator-to-readable-stream.ts
|
|
105
105
|
function convertAsyncIteratorToReadableStream(iterator) {
|
|
106
|
+
let cancelled = false;
|
|
106
107
|
return new ReadableStream({
|
|
107
108
|
/**
|
|
108
109
|
* Called when the consumer wants to pull more data from the stream.
|
|
@@ -111,6 +112,7 @@ function convertAsyncIteratorToReadableStream(iterator) {
|
|
|
111
112
|
* @returns {Promise<void>}
|
|
112
113
|
*/
|
|
113
114
|
async pull(controller) {
|
|
115
|
+
if (cancelled) return;
|
|
114
116
|
try {
|
|
115
117
|
const { value, done } = await iterator.next();
|
|
116
118
|
if (done) {
|
|
@@ -125,7 +127,14 @@ function convertAsyncIteratorToReadableStream(iterator) {
|
|
|
125
127
|
/**
|
|
126
128
|
* Called when the consumer cancels the stream.
|
|
127
129
|
*/
|
|
128
|
-
cancel() {
|
|
130
|
+
async cancel(reason) {
|
|
131
|
+
cancelled = true;
|
|
132
|
+
if (iterator.return) {
|
|
133
|
+
try {
|
|
134
|
+
await iterator.return(reason);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
}
|
|
137
|
+
}
|
|
129
138
|
}
|
|
130
139
|
});
|
|
131
140
|
}
|
|
@@ -299,7 +308,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
299
308
|
}
|
|
300
309
|
|
|
301
310
|
// src/version.ts
|
|
302
|
-
var VERSION = true ? "3.0.
|
|
311
|
+
var VERSION = true ? "3.0.14" : "0.0.0-test";
|
|
303
312
|
|
|
304
313
|
// src/get-from-api.ts
|
|
305
314
|
var getOriginalFetch = () => globalThis.fetch;
|