@kubb/plugin-client 5.5.8 → 5.5.9

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.8";
456
+ var version = "5.5.9";
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.8";
430
+ var version = "5.5.9";
431
431
  //#endregion
432
432
  //#region ../../internals/client/src/builders/contentType.ts
433
433
  /**
package/docs/overview.md CHANGED
@@ -1,25 +1,27 @@
1
1
  # Client
2
2
 
3
- Generates typed operation functions from your OpenAPI spec that call a client module you write. You decide the transport, authentication, and error handling, and the generated code has no Fetch, axios, or Kubb runtime dependency.
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.
6
-
7
- Use it to connect the generated functions to an HTTP layer you already have, or to sign requests. For a ready-made client, 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, or to use the query plugins or `@kubb/plugin-mcp`, use `@kubb/plugin-fetch` or `@kubb/plugin-axios` instead.
8
6
 
9
7
  ## Setup
10
8
 
11
- - Set `importPath` to your client module. It is required. The module must export `client` and the `Options` and `RequestResult` types.
12
- - Add `@kubb/plugin-ts` for the operation types.
13
- - Add `@kubb/plugin-zod` when you set `validator`. Generation fails without it.
9
+ - Set the required `importPath` option to your client module. The module must export `client` and the `Options` and `RequestResult` types. When the spec has server-sent event operations, it must also export `toEventStream` and the `EventStreamResult` and `SuccessOf` types.
10
+ - Add `@kubb/plugin-ts` for the operation types, or `@kubb/plugin-zod` with `inferred: true`.
11
+ - Add `@kubb/plugin-zod` when you set `validator`, and install `zod` v4. Generation fails without the plugin.
14
12
 
15
13
  ## Options worth knowing
16
14
 
17
15
  - `importPath` is written into every generated import as given, so it must resolve from the generated file. A relative path, a package name, or an alias works.
18
- - `validator: 'zod'` passes request and response schemas from `@kubb/plugin-zod` to your client.
16
+ - `validator: 'zod'` passes response schemas from `@kubb/plugin-zod` to your client. Use `{ request: 'zod', response: 'zod' }` to also pass request body schemas.
19
17
  - `throwOnErrorDefault` is the `throwOnError` value each call passes to your client. The default is `true`.
20
18
 
19
+ See [Options](https://kubb.dev/extensions/kubb-labs/plugin-client/options) for every option and its default.
20
+
21
21
  ## Example
22
22
 
23
+ The config below groups the generated functions by tag and points them at the client module in `src/client.ts`.
24
+
23
25
  ```typescript [kubb.config.ts]
24
26
  import { defineConfig } from 'kubb/config'
25
27
  import { pluginTs } from '@kubb/plugin-ts'
@@ -39,9 +41,3 @@ export default defineConfig({
39
41
  ],
40
42
  })
41
43
  ```
42
-
43
- ## See also
44
-
45
- - [`@kubb/plugin-fetch`](https://kubb.dev/extensions/kubb-labs/plugin-fetch)
46
- - [`@kubb/plugin-axios`](https://kubb.dev/extensions/kubb-labs/plugin-axios)
47
- - [Example project](https://github.com/kubb-labs/plugins/tree/main/examples/client)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "5.5.8",
3
+ "version": "5.5.9",
4
4
  "description": "Generate typed API operations against your own client module.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -47,8 +47,8 @@
47
47
  "registry": "https://registry.npmjs.org/"
48
48
  },
49
49
  "dependencies": {
50
- "@kubb/plugin-ts": "^5.0.9",
51
- "@kubb/plugin-zod": "^5.4.7"
50
+ "@kubb/plugin-ts": "^5.0.10",
51
+ "@kubb/plugin-zod": "^5.4.8"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@internals/client": "0.0.0",