@ai-sdk/provider-utils
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -41,2 +41,3 @@ "use strict"; | ||
getErrorMessage: () => getErrorMessage, | ||
isAbortError: () => isAbortError, | ||
isParseableJson: () => isParseableJson, | ||
@@ -84,2 +85,7 @@ loadApiKey: () => loadApiKey, | ||
// src/is-abort-error.ts | ||
function isAbortError(error) { | ||
return error instanceof DOMException && (error.name === "AbortError" || error.name === "TimeoutError"); | ||
} | ||
// src/load-api-key.ts | ||
@@ -259,6 +265,4 @@ var import_provider = require("@ai-sdk/provider"); | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
if (error.name === "AbortError" || import_provider4.APICallError.isAPICallError(error)) { | ||
throw error; | ||
} | ||
if (isAbortError(error) || import_provider4.APICallError.isAPICallError(error)) { | ||
throw error; | ||
} | ||
@@ -282,3 +286,3 @@ throw new import_provider4.APICallError({ | ||
if (error instanceof Error) { | ||
if (error.name === "AbortError" || import_provider4.APICallError.isAPICallError(error)) { | ||
if (isAbortError(error) || import_provider4.APICallError.isAPICallError(error)) { | ||
throw error; | ||
@@ -296,6 +300,4 @@ } | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
if (error.name === "AbortError") { | ||
throw error; | ||
} | ||
if (isAbortError(error)) { | ||
throw error; | ||
} | ||
@@ -452,2 +454,3 @@ if (error instanceof TypeError && error.message === "fetch failed") { | ||
getErrorMessage, | ||
isAbortError, | ||
isParseableJson, | ||
@@ -454,0 +457,0 @@ loadApiKey, |
@@ -20,2 +20,4 @@ import { JSONParseError, TypeValidationError, APICallError } from '@ai-sdk/provider'; | ||
declare function isAbortError(error: unknown): error is DOMException; | ||
declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterName, description, }: { | ||
@@ -159,2 +161,2 @@ apiKey: string | undefined; | ||
export { type ParseResult, type ResponseHandler, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, extractResponseHeaders, generateId, getErrorMessage, isParseableJson, loadApiKey, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, validateTypes, withoutTrailingSlash }; | ||
export { type ParseResult, type ResponseHandler, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, extractResponseHeaders, generateId, getErrorMessage, isAbortError, isParseableJson, loadApiKey, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, validateTypes, withoutTrailingSlash }; |
@@ -41,2 +41,3 @@ "use strict"; | ||
getErrorMessage: () => getErrorMessage, | ||
isAbortError: () => isAbortError, | ||
isParseableJson: () => isParseableJson, | ||
@@ -84,2 +85,7 @@ loadApiKey: () => loadApiKey, | ||
// src/is-abort-error.ts | ||
function isAbortError(error) { | ||
return error instanceof DOMException && (error.name === "AbortError" || error.name === "TimeoutError"); | ||
} | ||
// src/load-api-key.ts | ||
@@ -259,6 +265,4 @@ var import_provider = require("@ai-sdk/provider"); | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
if (error.name === "AbortError" || import_provider4.APICallError.isAPICallError(error)) { | ||
throw error; | ||
} | ||
if (isAbortError(error) || import_provider4.APICallError.isAPICallError(error)) { | ||
throw error; | ||
} | ||
@@ -282,3 +286,3 @@ throw new import_provider4.APICallError({ | ||
if (error instanceof Error) { | ||
if (error.name === "AbortError" || import_provider4.APICallError.isAPICallError(error)) { | ||
if (isAbortError(error) || import_provider4.APICallError.isAPICallError(error)) { | ||
throw error; | ||
@@ -296,6 +300,4 @@ } | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
if (error.name === "AbortError") { | ||
throw error; | ||
} | ||
if (isAbortError(error)) { | ||
throw error; | ||
} | ||
@@ -452,2 +454,3 @@ if (error instanceof TypeError && error.message === "fetch failed") { | ||
getErrorMessage, | ||
isAbortError, | ||
isParseableJson, | ||
@@ -454,0 +457,0 @@ loadApiKey, |
{ | ||
"name": "@ai-sdk/provider-utils", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1637476
17885
6
0