@ai-sdk/provider-utils 4.0.15 → 4.0.17

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.17" : "0.0.0-test";
478
483
 
479
484
  // src/get-from-api.ts
480
485
  var getOriginalFetch = () => globalThis.fetch;
@@ -2549,6 +2554,12 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
2549
2554
  };
2550
2555
  };
2551
2556
 
2557
+ // src/strip-file-extension.ts
2558
+ function stripFileExtension(filename) {
2559
+ const firstDotIndex = filename.indexOf(".");
2560
+ return firstDotIndex === -1 ? filename : filename.slice(0, firstDotIndex);
2561
+ }
2562
+
2552
2563
  // src/without-trailing-slash.ts
2553
2564
  function withoutTrailingSlash(url) {
2554
2565
  return url == null ? void 0 : url.replace(/\/$/, "");
@@ -2637,6 +2648,7 @@ export {
2637
2648
  resolve,
2638
2649
  safeParseJSON,
2639
2650
  safeValidateTypes,
2651
+ stripFileExtension,
2640
2652
  tool,
2641
2653
  validateTypes,
2642
2654
  withUserAgentSuffix,