@ai-sdk/provider-utils 4.0.0-beta.26 → 4.0.0-beta.28
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/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 +2 -2
 
    
        package/dist/index.mjs
    CHANGED
    
    | 
         @@ -11,6 +11,7 @@ function combineHeaders(...headers) { 
     | 
|
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            // src/convert-async-iterator-to-readable-stream.ts
         
     | 
| 
       13 
13 
     | 
    
         
             
            function convertAsyncIteratorToReadableStream(iterator) {
         
     | 
| 
      
 14 
     | 
    
         
            +
              let cancelled = false;
         
     | 
| 
       14 
15 
     | 
    
         
             
              return new ReadableStream({
         
     | 
| 
       15 
16 
     | 
    
         
             
                /**
         
     | 
| 
       16 
17 
     | 
    
         
             
                 * Called when the consumer wants to pull more data from the stream.
         
     | 
| 
         @@ -19,6 +20,7 @@ function convertAsyncIteratorToReadableStream(iterator) { 
     | 
|
| 
       19 
20 
     | 
    
         
             
                 * @returns {Promise<void>}
         
     | 
| 
       20 
21 
     | 
    
         
             
                 */
         
     | 
| 
       21 
22 
     | 
    
         
             
                async pull(controller) {
         
     | 
| 
      
 23 
     | 
    
         
            +
                  if (cancelled) return;
         
     | 
| 
       22 
24 
     | 
    
         
             
                  try {
         
     | 
| 
       23 
25 
     | 
    
         
             
                    const { value, done } = await iterator.next();
         
     | 
| 
       24 
26 
     | 
    
         
             
                    if (done) {
         
     | 
| 
         @@ -33,7 +35,14 @@ function convertAsyncIteratorToReadableStream(iterator) { 
     | 
|
| 
       33 
35 
     | 
    
         
             
                /**
         
     | 
| 
       34 
36 
     | 
    
         
             
                 * Called when the consumer cancels the stream.
         
     | 
| 
       35 
37 
     | 
    
         
             
                 */
         
     | 
| 
       36 
     | 
    
         
            -
                cancel() {
         
     | 
| 
      
 38 
     | 
    
         
            +
                async cancel(reason) {
         
     | 
| 
      
 39 
     | 
    
         
            +
                  cancelled = true;
         
     | 
| 
      
 40 
     | 
    
         
            +
                  if (iterator.return) {
         
     | 
| 
      
 41 
     | 
    
         
            +
                    try {
         
     | 
| 
      
 42 
     | 
    
         
            +
                      await iterator.return(reason);
         
     | 
| 
      
 43 
     | 
    
         
            +
                    } catch (e) {
         
     | 
| 
      
 44 
     | 
    
         
            +
                    }
         
     | 
| 
      
 45 
     | 
    
         
            +
                  }
         
     | 
| 
       37 
46 
     | 
    
         
             
                }
         
     | 
| 
       38 
47 
     | 
    
         
             
              });
         
     | 
| 
       39 
48 
     | 
    
         
             
            }
         
     | 
| 
         @@ -207,7 +216,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) { 
     | 
|
| 
       207 
216 
     | 
    
         
             
            }
         
     | 
| 
       208 
217 
     | 
    
         | 
| 
       209 
218 
     | 
    
         
             
            // src/version.ts
         
     | 
| 
       210 
     | 
    
         
            -
            var VERSION = true ? "4.0.0-beta. 
     | 
| 
      
 219 
     | 
    
         
            +
            var VERSION = true ? "4.0.0-beta.28" : "0.0.0-test";
         
     | 
| 
       211 
220 
     | 
    
         | 
| 
       212 
221 
     | 
    
         
             
            // src/get-from-api.ts
         
     | 
| 
       213 
222 
     | 
    
         
             
            var getOriginalFetch = () => globalThis.fetch;
         
     |