@ai-sdk/provider-utils 4.0.0-beta.21 → 4.0.0-beta.23
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.d.mts +10 -1
 - package/dist/index.d.ts +10 -1
 - package/dist/index.js +33 -11
 - package/dist/index.js.map +1 -1
 - package/dist/index.mjs +32 -11
 - package/dist/index.mjs.map +1 -1
 - package/package.json +2 -2
 
    
        package/dist/index.mjs
    CHANGED
    
    | 
         @@ -172,29 +172,42 @@ function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) { 
     | 
|
| 
       172 
172 
     | 
    
         
             
              return "runtime/unknown";
         
     | 
| 
       173 
173 
     | 
    
         
             
            }
         
     | 
| 
       174 
174 
     | 
    
         | 
| 
       175 
     | 
    
         
            -
            // src/ 
     | 
| 
       176 
     | 
    
         
            -
            function  
     | 
| 
       177 
     | 
    
         
            -
               
     | 
| 
       178 
     | 
    
         
            -
                 
     | 
| 
       179 
     | 
    
         
            -
               
     | 
| 
      
 175 
     | 
    
         
            +
            // src/normalize-headers.ts
         
     | 
| 
      
 176 
     | 
    
         
            +
            function normalizeHeaders(headers) {
         
     | 
| 
      
 177 
     | 
    
         
            +
              if (headers == null) {
         
     | 
| 
      
 178 
     | 
    
         
            +
                return {};
         
     | 
| 
      
 179 
     | 
    
         
            +
              }
         
     | 
| 
      
 180 
     | 
    
         
            +
              const normalized = {};
         
     | 
| 
      
 181 
     | 
    
         
            +
              if (headers instanceof Headers) {
         
     | 
| 
      
 182 
     | 
    
         
            +
                headers.forEach((value, key) => {
         
     | 
| 
      
 183 
     | 
    
         
            +
                  normalized[key.toLowerCase()] = value;
         
     | 
| 
      
 184 
     | 
    
         
            +
                });
         
     | 
| 
      
 185 
     | 
    
         
            +
              } else {
         
     | 
| 
      
 186 
     | 
    
         
            +
                if (!Array.isArray(headers)) {
         
     | 
| 
      
 187 
     | 
    
         
            +
                  headers = Object.entries(headers);
         
     | 
| 
      
 188 
     | 
    
         
            +
                }
         
     | 
| 
      
 189 
     | 
    
         
            +
                for (const [key, value] of headers) {
         
     | 
| 
      
 190 
     | 
    
         
            +
                  if (value != null) {
         
     | 
| 
      
 191 
     | 
    
         
            +
                    normalized[key.toLowerCase()] = value;
         
     | 
| 
      
 192 
     | 
    
         
            +
                  }
         
     | 
| 
      
 193 
     | 
    
         
            +
                }
         
     | 
| 
      
 194 
     | 
    
         
            +
              }
         
     | 
| 
      
 195 
     | 
    
         
            +
              return normalized;
         
     | 
| 
       180 
196 
     | 
    
         
             
            }
         
     | 
| 
       181 
197 
     | 
    
         | 
| 
       182 
198 
     | 
    
         
             
            // src/with-user-agent-suffix.ts
         
     | 
| 
       183 
199 
     | 
    
         
             
            function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
         
     | 
| 
       184 
     | 
    
         
            -
              const  
     | 
| 
       185 
     | 
    
         
            -
                headers != null ? headers : {}
         
     | 
| 
       186 
     | 
    
         
            -
              );
         
     | 
| 
       187 
     | 
    
         
            -
              const normalizedHeaders = new Headers(cleanedHeaders);
         
     | 
| 
      
 200 
     | 
    
         
            +
              const normalizedHeaders = new Headers(normalizeHeaders(headers));
         
     | 
| 
       188 
201 
     | 
    
         
             
              const currentUserAgentHeader = normalizedHeaders.get("user-agent") || "";
         
     | 
| 
       189 
202 
     | 
    
         
             
              normalizedHeaders.set(
         
     | 
| 
       190 
203 
     | 
    
         
             
                "user-agent",
         
     | 
| 
       191 
204 
     | 
    
         
             
                [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" ")
         
     | 
| 
       192 
205 
     | 
    
         
             
              );
         
     | 
| 
       193 
     | 
    
         
            -
              return Object.fromEntries(normalizedHeaders);
         
     | 
| 
      
 206 
     | 
    
         
            +
              return Object.fromEntries(normalizedHeaders.entries());
         
     | 
| 
       194 
207 
     | 
    
         
             
            }
         
     | 
| 
       195 
208 
     | 
    
         | 
| 
       196 
209 
     | 
    
         
             
            // src/version.ts
         
     | 
| 
       197 
     | 
    
         
            -
            var VERSION = true ? "4.0.0-beta. 
     | 
| 
      
 210 
     | 
    
         
            +
            var VERSION = true ? "4.0.0-beta.23" : "0.0.0-test";
         
     | 
| 
       198 
211 
     | 
    
         | 
| 
       199 
212 
     | 
    
         
             
            // src/get-from-api.ts
         
     | 
| 
       200 
213 
     | 
    
         
             
            var getOriginalFetch = () => globalThis.fetch;
         
     | 
| 
         @@ -2129,6 +2142,13 @@ function createProviderDefinedToolFactoryWithOutputSchema({ 
     | 
|
| 
       2129 
2142 
     | 
    
         
             
              });
         
     | 
| 
       2130 
2143 
     | 
    
         
             
            }
         
     | 
| 
       2131 
2144 
     | 
    
         | 
| 
      
 2145 
     | 
    
         
            +
            // src/remove-undefined-entries.ts
         
     | 
| 
      
 2146 
     | 
    
         
            +
            function removeUndefinedEntries(record) {
         
     | 
| 
      
 2147 
     | 
    
         
            +
              return Object.fromEntries(
         
     | 
| 
      
 2148 
     | 
    
         
            +
                Object.entries(record).filter(([_key, value]) => value != null)
         
     | 
| 
      
 2149 
     | 
    
         
            +
              );
         
     | 
| 
      
 2150 
     | 
    
         
            +
            }
         
     | 
| 
      
 2151 
     | 
    
         
            +
             
     | 
| 
       2132 
2152 
     | 
    
         
             
            // src/resolve.ts
         
     | 
| 
       2133 
2153 
     | 
    
         
             
            async function resolve(value) {
         
     | 
| 
       2134 
2154 
     | 
    
         
             
              if (typeof value === "function") {
         
     | 
| 
         @@ -2364,6 +2384,7 @@ export { 
     | 
|
| 
       2364 
2384 
     | 
    
         
             
              loadOptionalSetting,
         
     | 
| 
       2365 
2385 
     | 
    
         
             
              loadSetting,
         
     | 
| 
       2366 
2386 
     | 
    
         
             
              mediaTypeToExtension,
         
     | 
| 
      
 2387 
     | 
    
         
            +
              normalizeHeaders,
         
     | 
| 
       2367 
2388 
     | 
    
         
             
              parseJSON,
         
     | 
| 
       2368 
2389 
     | 
    
         
             
              parseJsonEventStream,
         
     | 
| 
       2369 
2390 
     | 
    
         
             
              parseProviderOptions,
         
     |