@ai-sdk/gateway 4.0.129 → 4.0.130

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,13 @@
1
1
  # @ai-sdk/gateway
2
2
 
3
+ ## 4.0.130
4
+
5
+ ### Patch Changes
6
+
7
+ - 9ca8bcf: fix(gateway): Preserve AbortError and TimeoutError cancellation reasons instead of wrapping them in retryable GatewayResponseError errors with status 500. Propagate these errors from speech and transcription input streams to their output streams without leaving reads pending or causing unhandled rejections.
8
+ - Updated dependencies [61a315e]
9
+ - @ai-sdk/provider-utils@5.0.71
10
+
3
11
  ## 4.0.129
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -586,6 +586,7 @@ function isTimeoutError(error) {
586
586
  return false;
587
587
  }
588
588
  async function asGatewayError(error, authMethod) {
589
+ if ((error instanceof Error || typeof DOMException === "function" && error instanceof DOMException) && (error.name === "AbortError" || error.name === "TimeoutError")) throw error;
589
590
  if (GatewayError.isInstance(error)) return error;
590
591
  if (isTimeoutError(error)) return GatewayTimeoutError.createTimeoutError({
591
592
  originalMessage: error instanceof Error ? error.message : "Unknown error",
@@ -2063,7 +2064,7 @@ const gatewayRerankingResponseSchema = lazySchema(() => zodSchema(z.object({
2063
2064
  * synchronous, hence this helper.
2064
2065
  */
2065
2066
  async function errorControllerWithGatewayError(controller, error, authMethod) {
2066
- controller.error(await asGatewayError(error, authMethod));
2067
+ controller.error(await asGatewayError(error, authMethod).catch((error) => error));
2067
2068
  }
2068
2069
  /**
2069
2070
  * Extract a human-readable message from an `error` stream part's payload for
@@ -3271,7 +3272,7 @@ async function getVercelRequestId() {
3271
3272
  }
3272
3273
  //#endregion
3273
3274
  //#region src/version.ts
3274
- const VERSION = "4.0.129";
3275
+ const VERSION = "4.0.130";
3275
3276
  //#endregion
3276
3277
  //#region src/gateway-provider.ts
3277
3278
  const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";