@ai-sdk/amazon-bedrock 4.0.99 → 4.0.101

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
@@ -1504,7 +1504,7 @@ var BedrockAdditionalModelResponseFieldsSchema = z4.object({
1504
1504
  var BedrockToolUseSchema = z4.object({
1505
1505
  toolUseId: z4.string(),
1506
1506
  name: z4.string(),
1507
- input: z4.unknown()
1507
+ input: z4.unknown().optional()
1508
1508
  });
1509
1509
  var BedrockReasoningTextSchema = z4.object({
1510
1510
  signature: z4.string().nullish(),
@@ -2014,12 +2014,13 @@ import {
2014
2014
  import { AwsV4Signer } from "aws4fetch";
2015
2015
 
2016
2016
  // src/version.ts
2017
- var VERSION = true ? "4.0.99" : "0.0.0-test";
2017
+ var VERSION = true ? "4.0.101" : "0.0.0-test";
2018
2018
 
2019
2019
  // src/bedrock-sigv4-fetch.ts
2020
- function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
2020
+ function createSigV4FetchFunction(getCredentials, fetch) {
2021
2021
  return async (input, init) => {
2022
2022
  var _a, _b;
2023
+ const effectiveFetch = fetch != null ? fetch : globalThis.fetch;
2023
2024
  const request = input instanceof Request ? input : void 0;
2024
2025
  const originalHeaders = combineHeaders4(
2025
2026
  normalizeHeaders(request == null ? void 0 : request.headers),
@@ -2039,7 +2040,7 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
2039
2040
  }
2040
2041
  const effectiveMethod = (_b = init == null ? void 0 : init.method) != null ? _b : request == null ? void 0 : request.method;
2041
2042
  if ((effectiveMethod == null ? void 0 : effectiveMethod.toUpperCase()) !== "POST" || !effectiveBody) {
2042
- return fetch(input, {
2043
+ return effectiveFetch(input, {
2043
2044
  ...init,
2044
2045
  headers: headersWithUserAgent
2045
2046
  });
@@ -2061,7 +2062,7 @@ function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
2061
2062
  const signingResult = await signer.sign();
2062
2063
  const signedHeaders = normalizeHeaders(signingResult.headers);
2063
2064
  const combinedHeaders = combineHeaders4(headersWithUserAgent, signedHeaders);
2064
- return fetch(input, {
2065
+ return effectiveFetch(input, {
2065
2066
  ...init,
2066
2067
  body,
2067
2068
  headers: combinedHeaders
@@ -2079,8 +2080,9 @@ function prepareBodyString(body) {
2079
2080
  return JSON.stringify(body);
2080
2081
  }
2081
2082
  }
2082
- function createApiKeyFetchFunction(apiKey, fetch = globalThis.fetch) {
2083
+ function createApiKeyFetchFunction(apiKey, fetch) {
2083
2084
  return async (input, init) => {
2085
+ const effectiveFetch = fetch != null ? fetch : globalThis.fetch;
2084
2086
  const originalHeaders = normalizeHeaders(init == null ? void 0 : init.headers);
2085
2087
  const headersWithUserAgent = withUserAgentSuffix(
2086
2088
  originalHeaders,
@@ -2090,7 +2092,7 @@ function createApiKeyFetchFunction(apiKey, fetch = globalThis.fetch) {
2090
2092
  const finalHeaders = combineHeaders4(headersWithUserAgent, {
2091
2093
  Authorization: `Bearer ${apiKey}`
2092
2094
  });
2093
- return fetch(input, {
2095
+ return effectiveFetch(input, {
2094
2096
  ...init,
2095
2097
  headers: finalHeaders
2096
2098
  });