From 2bdeeb517150a1935f8b19844333a4adee9d21a7 Mon Sep 17 00:00:00 2001 From: stijnvanhulle <5904681+stijnvanhulle@users.noreply.github.com> Date: Tue, 1 Sep 2026 21:10:17 +0000 Subject: [PATCH] chore(examples): update generated files --- examples/advanced/src/gen/.kubb/client.ts | 24 +++++++++++++++++++ examples/axios/src/gen/.kubb/client.ts | 24 +++++++++++++++++++ examples/fetch/src/gen/.kubb/client.ts | 21 ++++++++++++++++ examples/mcp/src/gen/.kubb/client.ts | 24 +++++++++++++++++++ examples/react-query/src/gen/.kubb/client.ts | 21 ++++++++++++++++ examples/sdk/src/gen/.kubb/client.ts | 21 ++++++++++++++++ .../simple-single/src/gen/.kubb/client.ts | 21 ++++++++++++++++ examples/swr/src/gen/.kubb/client.ts | 21 ++++++++++++++++ examples/vue-query/src/gen/.kubb/client.ts | 21 ++++++++++++++++ 9 files changed, 198 insertions(+) diff --git a/examples/advanced/src/gen/.kubb/client.ts b/examples/advanced/src/gen/.kubb/client.ts index 72bedcf64..2c6612afd 100644 --- a/examples/advanced/src/gen/.kubb/client.ts +++ b/examples/advanced/src/gen/.kubb/client.ts @@ -84,6 +84,30 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult< + TResponses, + ThrowOnError extends boolean = true, + TRequest = AxiosRequestConfig, + TResponse = AxiosResponse, +> = ThrowOnError extends true ? RequestResult['data'] : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */ diff --git a/examples/axios/src/gen/.kubb/client.ts b/examples/axios/src/gen/.kubb/client.ts index d928c18f3..e022ad571 100644 --- a/examples/axios/src/gen/.kubb/client.ts +++ b/examples/axios/src/gen/.kubb/client.ts @@ -84,6 +84,30 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult< + TResponses, + ThrowOnError extends boolean = true, + TRequest = AxiosRequestConfig, + TResponse = AxiosResponse, +> = ThrowOnError extends true ? RequestResult['data'] : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */ diff --git a/examples/fetch/src/gen/.kubb/client.ts b/examples/fetch/src/gen/.kubb/client.ts index f80182aca..4829ea625 100644 --- a/examples/fetch/src/gen/.kubb/client.ts +++ b/examples/fetch/src/gen/.kubb/client.ts @@ -82,6 +82,27 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult = ThrowOnError extends true + ? RequestResult['data'] + : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */ diff --git a/examples/mcp/src/gen/.kubb/client.ts b/examples/mcp/src/gen/.kubb/client.ts index ff65e0b9d..94b20e2b9 100644 --- a/examples/mcp/src/gen/.kubb/client.ts +++ b/examples/mcp/src/gen/.kubb/client.ts @@ -84,6 +84,30 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult< + TResponses, + ThrowOnError extends boolean = true, + TRequest = AxiosRequestConfig, + TResponse = AxiosResponse, +> = ThrowOnError extends true ? RequestResult['data'] : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */ diff --git a/examples/react-query/src/gen/.kubb/client.ts b/examples/react-query/src/gen/.kubb/client.ts index f80182aca..4829ea625 100644 --- a/examples/react-query/src/gen/.kubb/client.ts +++ b/examples/react-query/src/gen/.kubb/client.ts @@ -82,6 +82,27 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult = ThrowOnError extends true + ? RequestResult['data'] + : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */ diff --git a/examples/sdk/src/gen/.kubb/client.ts b/examples/sdk/src/gen/.kubb/client.ts index f80182aca..4829ea625 100644 --- a/examples/sdk/src/gen/.kubb/client.ts +++ b/examples/sdk/src/gen/.kubb/client.ts @@ -82,6 +82,27 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult = ThrowOnError extends true + ? RequestResult['data'] + : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */ diff --git a/examples/simple-single/src/gen/.kubb/client.ts b/examples/simple-single/src/gen/.kubb/client.ts index f80182aca..4829ea625 100644 --- a/examples/simple-single/src/gen/.kubb/client.ts +++ b/examples/simple-single/src/gen/.kubb/client.ts @@ -82,6 +82,27 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult = ThrowOnError extends true + ? RequestResult['data'] + : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */ diff --git a/examples/swr/src/gen/.kubb/client.ts b/examples/swr/src/gen/.kubb/client.ts index f80182aca..4829ea625 100644 --- a/examples/swr/src/gen/.kubb/client.ts +++ b/examples/swr/src/gen/.kubb/client.ts @@ -82,6 +82,27 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult = ThrowOnError extends true + ? RequestResult['data'] + : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */ diff --git a/examples/vue-query/src/gen/.kubb/client.ts b/examples/vue-query/src/gen/.kubb/client.ts index f80182aca..4829ea625 100644 --- a/examples/vue-query/src/gen/.kubb/client.ts +++ b/examples/vue-query/src/gen/.kubb/client.ts @@ -82,6 +82,27 @@ export type RequestResult +/** + * The shape a generated operation returns when `returnType: 'data'` is set: the bare success body + * once `throwOnError` (on by default) narrows away the error branch, falling back to the full + * `RequestResult` when a call sets `throwOnError: false` and still needs `error` to discriminate a + * failed response. + */ +export type UnwrappedResult = ThrowOnError extends true + ? RequestResult['data'] + : RequestResult + +/** + * Narrows a resolved call down to its success body once `throwOnError` (on by default) rules out + * the error branch, the same default the runtime itself applies. Falls back to the full result for + * a call that sets `throwOnError: false`, since that path still needs `error` to discriminate a + * failed response. Backs `returnType: 'data'`, mirroring how `toEventStream` centralizes the + * post-processing for `text/event-stream` operations. + */ +export function unwrapResult(promise: Promise, throwOnError: boolean | undefined): Promise { + return promise.then((result) => ((throwOnError ?? true) ? result.data : result)) +} + /** * The data-shaped keys of the grouped options object, which `Options` re-adds typed per operation. */