@ai-sdk/provider-utils 4.0.16 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/provider-utils
2
2
 
3
+ ## 4.0.17
4
+
5
+ ### Patch Changes
6
+
7
+ - 08336f1: fix(bedrock): strip file extensions from filename
8
+
3
9
  ## 4.0.16
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1276,6 +1276,16 @@ type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
1276
1276
  */
1277
1277
  declare function resolve<T>(value: Resolvable<T>): Promise<T>;
1278
1278
 
1279
+ /**
1280
+ * Strips file extension segments from a filename.
1281
+ *
1282
+ * Examples:
1283
+ * - "report.pdf" -> "report"
1284
+ * - "archive.tar.gz" -> "archive"
1285
+ * - "filename" -> "filename"
1286
+ */
1287
+ declare function stripFileExtension(filename: string): string;
1288
+
1279
1289
  declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
1280
1290
  declare function convertUint8ArrayToBase64(array: Uint8Array): string;
1281
1291
  declare function convertToBase64(value: string | Uint8Array): string;
@@ -1411,4 +1421,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
1411
1421
  */
1412
1422
  type ToolCallOptions = ToolExecutionOptions;
1413
1423
 
1414
- export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
1424
+ export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, stripFileExtension, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.d.ts CHANGED
@@ -1276,6 +1276,16 @@ type Resolvable<T> = MaybePromiseLike<T> | (() => MaybePromiseLike<T>);
1276
1276
  */
1277
1277
  declare function resolve<T>(value: Resolvable<T>): Promise<T>;
1278
1278
 
1279
+ /**
1280
+ * Strips file extension segments from a filename.
1281
+ *
1282
+ * Examples:
1283
+ * - "report.pdf" -> "report"
1284
+ * - "archive.tar.gz" -> "archive"
1285
+ * - "filename" -> "filename"
1286
+ */
1287
+ declare function stripFileExtension(filename: string): string;
1288
+
1279
1289
  declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
1280
1290
  declare function convertUint8ArrayToBase64(array: Uint8Array): string;
1281
1291
  declare function convertToBase64(value: string | Uint8Array): string;
@@ -1411,4 +1421,4 @@ interface ToolResult<NAME extends string, INPUT, OUTPUT> {
1411
1421
  */
1412
1422
  type ToolCallOptions = ToolExecutionOptions;
1413
1423
 
1414
- export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
1424
+ export { type AssistantContent, type AssistantModelMessage, DEFAULT_MAX_DOWNLOAD_SIZE, type DataContent, DelayedPromise, DownloadError, type FetchFunction, type FilePart, type FlexibleSchema, type IdGenerator, type ImagePart, type InferSchema, type InferToolInput, type InferToolOutput, type LazySchema, type MaybePromiseLike, type ModelMessage, type ParseResult, type ProviderOptions, type ProviderToolFactory, type ProviderToolFactoryWithOutputSchema, type ReasoningPart, type Resolvable, type ResponseHandler, type Schema, type SystemModelMessage, type TextPart, type Tool, type ToolApprovalRequest, type ToolApprovalResponse, type ToolCall, type ToolCallOptions, type ToolCallPart, type ToolContent, type ToolExecuteFunction, type ToolExecutionOptions, type ToolModelMessage, type ToolNameMapping, type ToolNeedsApprovalFunction, type ToolResult, type ToolResultOutput, type ToolResultPart, type UserContent, type UserModelMessage, VERSION, type ValidationResult, asSchema, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertImageModelFileToDataUri, convertToBase64, convertToFormData, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderToolFactory, createProviderToolFactoryWithOutputSchema, createStatusCodeErrorResponseHandler, createToolNameMapping, delay, downloadBlob, dynamicTool, executeTool, extractResponseHeaders, generateId, getErrorMessage, getFromApi, getRuntimeEnvironmentUserAgent, injectJsonInstructionIntoMessages, isAbortError, isNonNullable, isParsableJson, isUrlSupported, jsonSchema, lazySchema, loadApiKey, loadOptionalSetting, loadSetting, mediaTypeToExtension, normalizeHeaders, parseJSON, parseJsonEventStream, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, readResponseWithSizeLimit, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, stripFileExtension, tool, validateTypes, withUserAgentSuffix, withoutTrailingSlash, zodSchema };
package/dist/index.js CHANGED
@@ -84,6 +84,7 @@ __export(src_exports, {
84
84
  resolve: () => resolve,
85
85
  safeParseJSON: () => safeParseJSON,
86
86
  safeValidateTypes: () => safeValidateTypes,
87
+ stripFileExtension: () => stripFileExtension,
87
88
  tool: () => tool,
88
89
  validateTypes: () => validateTypes,
89
90
  withUserAgentSuffix: () => withUserAgentSuffix,
@@ -573,7 +574,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
573
574
  }
574
575
 
575
576
  // src/version.ts
576
- var VERSION = true ? "4.0.16" : "0.0.0-test";
577
+ var VERSION = true ? "4.0.17" : "0.0.0-test";
577
578
 
578
579
  // src/get-from-api.ts
579
580
  var getOriginalFetch = () => globalThis.fetch;
@@ -2641,6 +2642,12 @@ var createStatusCodeErrorResponseHandler = () => async ({ response, url, request
2641
2642
  };
2642
2643
  };
2643
2644
 
2645
+ // src/strip-file-extension.ts
2646
+ function stripFileExtension(filename) {
2647
+ const firstDotIndex = filename.indexOf(".");
2648
+ return firstDotIndex === -1 ? filename : filename.slice(0, firstDotIndex);
2649
+ }
2650
+
2644
2651
  // src/without-trailing-slash.ts
2645
2652
  function withoutTrailingSlash(url) {
2646
2653
  return url == null ? void 0 : url.replace(/\/$/, "");
@@ -2728,6 +2735,7 @@ var import_stream2 = require("eventsource-parser/stream");
2728
2735
  resolve,
2729
2736
  safeParseJSON,
2730
2737
  safeValidateTypes,
2738
+ stripFileExtension,
2731
2739
  tool,
2732
2740
  validateTypes,
2733
2741
  withUserAgentSuffix,