@kubb/plugin-client 5.5.10 → 5.5.11

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.cjs CHANGED
@@ -453,7 +453,7 @@ var compatibility = {
453
453
  };
454
454
  //#endregion
455
455
  //#region package.json
456
- var version = "5.5.10";
456
+ var version = "5.5.11";
457
457
  //#endregion
458
458
  //#region ../../internals/client/src/builders/contentType.ts
459
459
  /**
package/dist/index.js CHANGED
@@ -427,7 +427,7 @@ var compatibility = {
427
427
  };
428
428
  //#endregion
429
429
  //#region package.json
430
- var version = "5.5.10";
430
+ var version = "5.5.11";
431
431
  //#endregion
432
432
  //#region ../../internals/client/src/builders/contentType.ts
433
433
  /**
@@ -12,6 +12,15 @@ The generated functions import your module through [`importPath`](https://kubb.d
12
12
 
13
13
  If your spec has server-sent event operations, also export `toEventStream` and the `EventStreamResult` and `SuccessOf` types.
14
14
 
15
+ The query plugins (`@kubb/plugin-react-query`, `@kubb/plugin-vue-query`, `@kubb/plugin-swr`) and `@kubb/plugin-mcp` call the generated functions with `throwOnError: true` and read `data` off the result. The query plugins also import two more types from your module:
16
+
17
+ | Export | Kind | Purpose |
18
+ | --------------------- | ---- | ----------------------------------------------------------------------- |
19
+ | `RequestConfig` | type | The per-call `client` options a hook accepts, minus the request fields. |
20
+ | `ResponseErrorConfig` | type | The error type of a failed hook, given the spec's error type. |
21
+
22
+ With a relative `importPath`, the hooks resolve it from the generated operation file, so one path serves both.
23
+
15
24
  ## What a generated function looks like
16
25
 
17
26
  ```typescript
@@ -64,6 +73,9 @@ export type RequestResult<TResponses, ThrowOnError extends boolean = true> = Thr
64
73
  ? { data: TResponses[keyof TResponses]; error: undefined; response: Response }
65
74
  : { data: TResponses[keyof TResponses]; error: undefined; response: Response } | { data: undefined; error: {}; response: Response }
66
75
 
76
+ // Only needed by the query plugins: what a failed hook rejects with.
77
+ export type ResponseErrorConfig<TError = unknown> = Error & { body?: TError }
78
+
67
79
  // Set this to your API host. `new URL()` needs an absolute URL.
68
80
  export const settings = { baseURL: 'https://petstore3.swagger.io/api/v3' }
69
81
 
package/docs/overview.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Client plugin turns each operation in your OpenAPI spec into a typed function that calls a client module you write. The generated code has no Fetch, axios, or Kubb runtime dependency.
4
4
 
5
- Each function takes grouped `path`, `query`, `headers`, and `body` parameters and passes the operation's auth requirements to your client in a `security` list. A single call can pass its own `client` to replace the default. For a ready-made client, or to use the query plugins or `@kubb/plugin-mcp`, use `@kubb/plugin-fetch` or `@kubb/plugin-axios` instead.
5
+ Each function takes grouped `path`, `query`, `headers`, and `body` parameters and passes the operation's auth requirements to your client in a `security` list. A single call can pass its own `client` to replace the default. For a ready-made client, use `@kubb/plugin-fetch` or `@kubb/plugin-axios` instead. The query plugins and `@kubb/plugin-mcp` work with this plugin too, and their hooks and handlers then call your client module.
6
6
 
7
7
  ## Setup
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "5.5.10",
3
+ "version": "5.5.11",
4
4
  "description": "Generate typed API operations against your own client module.",
5
5
  "keywords": [
6
6
  "api-client",