@ai-sdk/provider-utils 4.0.15 → 4.0.16

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
@@ -50,25 +50,30 @@ function convertAsyncIteratorToReadableStream(iterator) {
50
50
  // src/create-tool-name-mapping.ts
51
51
  function createToolNameMapping({
52
52
  tools = [],
53
- providerToolNames
53
+ providerToolNames,
54
+ resolveProviderToolName
54
55
  }) {
56
+ var _a2;
55
57
  const customToolNameToProviderToolName = {};
56
58
  const providerToolNameToCustomToolName = {};
57
59
  for (const tool2 of tools) {
58
- if (tool2.type === "provider" && tool2.id in providerToolNames) {
59
- const providerToolName = providerToolNames[tool2.id];
60
+ if (tool2.type === "provider") {
61
+ const providerToolName = (_a2 = resolveProviderToolName == null ? void 0 : resolveProviderToolName(tool2)) != null ? _a2 : tool2.id in providerToolNames ? providerToolNames[tool2.id] : void 0;
62
+ if (providerToolName == null) {
63
+ continue;
64
+ }
60
65
  customToolNameToProviderToolName[tool2.name] = providerToolName;
61
66
  providerToolNameToCustomToolName[providerToolName] = tool2.name;
62
67
  }
63
68
  }
64
69
  return {
65
70
  toProviderToolName: (customToolName) => {
66
- var _a2;
67
- return (_a2 = customToolNameToProviderToolName[customToolName]) != null ? _a2 : customToolName;
71
+ var _a3;
72
+ return (_a3 = customToolNameToProviderToolName[customToolName]) != null ? _a3 : customToolName;
68
73
  },
69
74
  toCustomToolName: (providerToolName) => {
70
- var _a2;
71
- return (_a2 = providerToolNameToCustomToolName[providerToolName]) != null ? _a2 : providerToolName;
75
+ var _a3;
76
+ return (_a3 = providerToolNameToCustomToolName[providerToolName]) != null ? _a3 : providerToolName;
72
77
  }
73
78
  };
74
79
  }
@@ -474,7 +479,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
474
479
  }
475
480
 
476
481
  // src/version.ts
477
- var VERSION = true ? "4.0.15" : "0.0.0-test";
482
+ var VERSION = true ? "4.0.16" : "0.0.0-test";
478
483
 
479
484
  // src/get-from-api.ts
480
485
  var getOriginalFetch = () => globalThis.fetch;