ai 5.0.0-canary.1 → 5.0.0-canary.2
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.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -4700,6 +4700,25 @@ function asArray(value) {
|
|
4700
4700
|
return value === void 0 ? [] : Array.isArray(value) ? value : [value];
|
4701
4701
|
}
|
4702
4702
|
|
4703
|
+
// util/consume-stream.ts
|
4704
|
+
async function consumeStream({
|
4705
|
+
stream,
|
4706
|
+
onError
|
4707
|
+
}) {
|
4708
|
+
const reader = stream.getReader();
|
4709
|
+
try {
|
4710
|
+
while (true) {
|
4711
|
+
const { done } = await reader.read();
|
4712
|
+
if (done)
|
4713
|
+
break;
|
4714
|
+
}
|
4715
|
+
} catch (error) {
|
4716
|
+
onError == null ? void 0 : onError(error);
|
4717
|
+
} finally {
|
4718
|
+
reader.releaseLock();
|
4719
|
+
}
|
4720
|
+
}
|
4721
|
+
|
4703
4722
|
// core/util/merge-streams.ts
|
4704
4723
|
function mergeStreams(stream1, stream2) {
|
4705
4724
|
const reader1 = stream1.getReader();
|
@@ -5941,9 +5960,15 @@ var DefaultStreamTextResult = class {
|
|
5941
5960
|
)
|
5942
5961
|
);
|
5943
5962
|
}
|
5944
|
-
async consumeStream() {
|
5945
|
-
|
5946
|
-
|
5963
|
+
async consumeStream(options) {
|
5964
|
+
var _a17;
|
5965
|
+
try {
|
5966
|
+
await consumeStream({
|
5967
|
+
stream: this.fullStream,
|
5968
|
+
onError: options == null ? void 0 : options.onError
|
5969
|
+
});
|
5970
|
+
} catch (error) {
|
5971
|
+
(_a17 = options == null ? void 0 : options.onError) == null ? void 0 : _a17.call(options, error);
|
5947
5972
|
}
|
5948
5973
|
}
|
5949
5974
|
get experimental_partialOutputStream() {
|