@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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @ai-sdk/amazon-bedrock
2
2
 
3
+ ## 4.0.0-beta.43
4
+
5
+ ### Patch Changes
6
+
7
+ - 58920e0: refactor: consolidate header normalization across packages, remove duplicates, preserve custom headers
8
+ - Updated dependencies [58920e0]
9
+ - @ai-sdk/provider-utils@4.0.0-beta.22
10
+ - @ai-sdk/anthropic@3.0.0-beta.39
11
+
3
12
  ## 4.0.0-beta.42
4
13
 
5
14
  ### Patch Changes
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
30
30
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "4.0.0-beta.42" : "0.0.0-test";
33
+ var VERSION = true ? "4.0.0-beta.43" : "0.0.0-test";
34
34
 
35
35
  // src/bedrock-provider.ts
36
36
  var import_internal2 = require("@ai-sdk/anthropic/internal");
@@ -1510,28 +1510,6 @@ var bedrockImageResponseSchema = import_v46.z.object({
1510
1510
  images: import_v46.z.array(import_v46.z.string())
1511
1511
  });
1512
1512
 
1513
- // src/headers-utils.ts
1514
- function extractHeaders(headers) {
1515
- let originalHeaders = {};
1516
- if (headers) {
1517
- if (headers instanceof Headers) {
1518
- originalHeaders = convertHeadersToRecord(headers);
1519
- } else if (Array.isArray(headers)) {
1520
- for (const [k, v] of headers) {
1521
- originalHeaders[k.toLowerCase()] = v;
1522
- }
1523
- } else {
1524
- originalHeaders = Object.fromEntries(
1525
- Object.entries(headers).map(([k, v]) => [k.toLowerCase(), v])
1526
- );
1527
- }
1528
- }
1529
- return originalHeaders;
1530
- }
1531
- function convertHeadersToRecord(headers) {
1532
- return Object.fromEntries([...headers]);
1533
- }
1534
-
1535
1513
  // src/bedrock-sigv4-fetch.ts
1536
1514
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1537
1515
  var import_aws4fetch = require("aws4fetch");
@@ -1540,8 +1518,8 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
1540
1518
  var _a, _b;
1541
1519
  const request = input instanceof Request ? input : void 0;
1542
1520
  const originalHeaders = (0, import_provider_utils7.combineHeaders)(
1543
- extractHeaders(request == null ? void 0 : request.headers),
1544
- extractHeaders(init == null ? void 0 : init.headers)
1521
+ (0, import_provider_utils7.normalizeHeaders)(request == null ? void 0 : request.headers),
1522
+ (0, import_provider_utils7.normalizeHeaders)(init == null ? void 0 : init.headers)
1545
1523
  );
1546
1524
  const headersWithUserAgent = (0, import_provider_utils7.withUserAgentSuffix)(
1547
1525
  originalHeaders,
@@ -1577,7 +1555,7 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
1577
1555
  service: "bedrock"
1578
1556
  });
1579
1557
  const signingResult = await signer.sign();
1580
- const signedHeaders = convertHeadersToRecord(signingResult.headers);
1558
+ const signedHeaders = (0, import_provider_utils7.normalizeHeaders)(signingResult.headers);
1581
1559
  const combinedHeaders = (0, import_provider_utils7.combineHeaders)(headersWithUserAgent, signedHeaders);
1582
1560
  return fetch(input, {
1583
1561
  ...init,
@@ -1599,7 +1577,7 @@ function prepareBodyString(body) {
1599
1577
  }
1600
1578
  function createApiKeyFetchFunction(apiKey, fetch = globalThis.fetch) {
1601
1579
  return async (input, init) => {
1602
- const originalHeaders = extractHeaders(init == null ? void 0 : init.headers);
1580
+ const originalHeaders = (0, import_provider_utils7.normalizeHeaders)(init == null ? void 0 : init.headers);
1603
1581
  const headersWithUserAgent = (0, import_provider_utils7.withUserAgentSuffix)(
1604
1582
  originalHeaders,
1605
1583
  `ai-sdk/amazon-bedrock/${VERSION}`,