@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.
@@ -18589,13 +18589,16 @@ function createServer({
18589
18589
  pushController
18590
18590
  }) {
18591
18591
  const responsesArray = Array.isArray(responses) ? responses : [responses];
18592
- const responsesByUrl = responsesArray.reduce((responsesByUrl2, response) => {
18593
- if (!responsesByUrl2[response.url]) {
18594
- responsesByUrl2[response.url] = [];
18595
- }
18596
- responsesByUrl2[response.url].push(response);
18597
- return responsesByUrl2;
18598
- }, {});
18592
+ const responsesByUrl = responsesArray.reduce(
18593
+ (responsesByUrl2, response) => {
18594
+ if (!responsesByUrl2[response.url]) {
18595
+ responsesByUrl2[response.url] = [];
18596
+ }
18597
+ responsesByUrl2[response.url].push(response);
18598
+ return responsesByUrl2;
18599
+ },
18600
+ {}
18601
+ );
18599
18602
  const streams = {};
18600
18603
  responsesArray.filter(
18601
18604
  (response) => response.type === "controlled-stream"
@@ -18797,6 +18800,20 @@ function createTestServer(routes) {
18797
18800
  }
18798
18801
  }
18799
18802
  );
18803
+ case "readable-stream": {
18804
+ return new HttpResponse(
18805
+ response.stream.pipeThrough(new TextEncoderStream()),
18806
+ {
18807
+ status: 200,
18808
+ headers: {
18809
+ "Content-Type": "text/event-stream",
18810
+ "Cache-Control": "no-cache",
18811
+ Connection: "keep-alive",
18812
+ ...response.headers
18813
+ }
18814
+ }
18815
+ );
18816
+ }
18800
18817
  case "binary": {
18801
18818
  return HttpResponse.arrayBuffer(response.body, {
18802
18819
  status: 200,