@ai-sdk/amazon-bedrock 4.0.0-beta.42 → 4.0.0-beta.43

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/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  } from "@ai-sdk/provider-utils";
9
9
 
10
10
  // src/version.ts
11
- var VERSION = true ? "4.0.0-beta.42" : "0.0.0-test";
11
+ var VERSION = true ? "4.0.0-beta.43" : "0.0.0-test";
12
12
 
13
13
  // src/bedrock-provider.ts
14
14
  import { anthropicTools as anthropicTools2 } from "@ai-sdk/anthropic/internal";
@@ -1521,31 +1521,10 @@ var bedrockImageResponseSchema = z6.object({
1521
1521
  images: z6.array(z6.string())
1522
1522
  });
1523
1523
 
1524
- // src/headers-utils.ts
1525
- function extractHeaders(headers) {
1526
- let originalHeaders = {};
1527
- if (headers) {
1528
- if (headers instanceof Headers) {
1529
- originalHeaders = convertHeadersToRecord(headers);
1530
- } else if (Array.isArray(headers)) {
1531
- for (const [k, v] of headers) {
1532
- originalHeaders[k.toLowerCase()] = v;
1533
- }
1534
- } else {
1535
- originalHeaders = Object.fromEntries(
1536
- Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v])
1537
- );
1538
- }
1539
- }
1540
- return originalHeaders;
1541
- }
1542
- function convertHeadersToRecord(headers) {
1543
- return Object.fromEntries([...headers]);
1544
- }
1545
-
1546
1524
  // src/bedrock-sigv4-fetch.ts
1547
1525
  import {
1548
1526
  combineHeaders as combineHeaders4,
1527
+ normalizeHeaders,
1549
1528
  withUserAgentSuffix,
1550
1529
  getRuntimeEnvironmentUserAgent
1551
1530
  } from "@ai-sdk/provider-utils";
@@ -1555,8 +1534,8 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
1555
1534
  var _a, _b;
1556
1535
  const request = input instanceof Request ? input : void 0;
1557
1536
  const originalHeaders = combineHeaders4(
1558
- extractHeaders(request == null ? void 0 : request.headers),
1559
- extractHeaders(init == null ? void 0 : init.headers)
1537
+ normalizeHeaders(request == null ? void 0 : request.headers),
1538
+ normalizeHeaders(init == null ? void 0 : init.headers)
1560
1539
  );
1561
1540
  const headersWithUserAgent = withUserAgentSuffix(
1562
1541
  originalHeaders,
@@ -1592,7 +1571,7 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
1592
1571
  service: "bedrock"
1593
1572
  });
1594
1573
  const signingResult = await signer.sign();
1595
- const signedHeaders = convertHeadersToRecord(signingResult.headers);
1574
+ const signedHeaders = normalizeHeaders(signingResult.headers);
1596
1575
  const combinedHeaders = combineHeaders4(headersWithUserAgent, signedHeaders);
1597
1576
  return fetch(input, {
1598
1577
  ...init,
@@ -1614,7 +1593,7 @@ function prepareBodyString(body) {
1614
1593
  }
1615
1594
  function createApiKeyFetchFunction(apiKey, fetch = globalThis.fetch) {
1616
1595
  return async (input, init) => {
1617
- const originalHeaders = extractHeaders(init == null ? void 0 : init.headers);
1596
+ const originalHeaders = normalizeHeaders(init == null ? void 0 : init.headers);
1618
1597
  const headersWithUserAgent = withUserAgentSuffix(
1619
1598
  originalHeaders,
1620
1599
  `ai-sdk/amazon-bedrock/${VERSION}`,