@kubb/plugin-fetch 5.5.8 → 5.5.10

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.
@@ -0,0 +1,99 @@
1
+ # Server-sent events
2
+
3
+ Operations returning `text/event-stream` produce a typed stream rather than a `RequestResult`.
4
+
5
+ ## Consume a stream
6
+
7
+ Read the `EventStreamResult.stream` with `for await`:
8
+
9
+ ```typescript
10
+ import { streamEvents } from './gen/clients/streamEvents'
11
+
12
+ const { stream } = await streamEvents({})
13
+
14
+ for await (const event of stream) {
15
+ console.info(event.data)
16
+ }
17
+ ```
18
+
19
+ `data` is typed from the operation's response schema. Each event also carries the optional SSE
20
+ fields, so you can branch on the event name or read the id:
21
+
22
+ ```typescript
23
+ type ServerSentEvent<TData> = {
24
+ data: TData
25
+ event?: string
26
+ id?: string
27
+ retry?: number
28
+ }
29
+ ```
30
+
31
+ The runtime parses each event's `data` as JSON when it is valid and keeps it as the raw string
32
+ otherwise.
33
+
34
+ ## Stop early
35
+
36
+ Break out of the loop to stop reading. The underlying reader is canceled when the iterator
37
+ finishes, so an early `break` releases the stream:
38
+
39
+ ```typescript
40
+ const { stream } = await streamEvents({})
41
+
42
+ for await (const event of stream) {
43
+ if (event.event === 'done') break
44
+ render(event.data)
45
+ }
46
+ ```
47
+
48
+ To stop a stream from outside the loop, pass an `AbortSignal` and abort it. Aborting ends the
49
+ request and the iteration:
50
+
51
+ ```typescript
52
+ const controller = new AbortController()
53
+ const { stream } = await streamEvents({ signal: controller.signal })
54
+
55
+ // elsewhere, for example on component unmount
56
+ controller.abort()
57
+ ```
58
+
59
+ ## Read the response
60
+
61
+ Read status and headers from the native `response` before iterating:
62
+
63
+ ```typescript
64
+ const { stream, response } = await streamEvents({})
65
+
66
+ console.info(response.status) // 200
67
+ console.info(response.headers.get('x-stream-id'))
68
+
69
+ for await (const event of stream) {
70
+ handle(event.data)
71
+ }
72
+ ```
73
+
74
+ ## Handle errors
75
+
76
+ Catch non-2xx responses around the call and iteration, and rethrow other errors such as connection failures:
77
+
78
+ ```typescript
79
+ import { ResponseError } from './gen/.kubb/client'
80
+
81
+ try {
82
+ const { stream } = await streamEvents({})
83
+ for await (const event of stream) {
84
+ handle(event.data)
85
+ }
86
+ } catch (error) {
87
+ if (!ResponseError.is(error)) throw error
88
+ console.error('stream rejected', error.status)
89
+ }
90
+ ```
91
+
92
+ > [!NOTE]
93
+ > A drop mid-stream ends the `for await` loop. Track the last event's `id` if you need to reconnect
94
+ > from where the stream stopped.
95
+
96
+ ## See also
97
+
98
+ - [Call operations](https://kubb.dev/extensions/kubb-labs/plugin-fetch/guides/calling-operations)
99
+ - [Handle errors](https://kubb.dev/extensions/kubb-labs/plugin-fetch/guides/error-handling)
@@ -0,0 +1,71 @@
1
+ # Use a custom transport
2
+
3
+ Set a transport at runtime to replace the network send. The client still builds URLs, serializes parameters, resolves authentication, and handles results.
4
+
5
+ The transport is a function. Use interceptors for request headers or response logging.
6
+
7
+ ## Write a transport function
8
+
9
+ `@kubb/plugin-fetch` types the transport as a function that receives a fully resolved request and returns a result:
10
+
11
+ ```typescript
12
+ type Transport = (request: ResolvedRequest) => Promise<TransportResult>
13
+
14
+ type ResolvedRequest = {
15
+ url: string
16
+ method: string
17
+ headers: Record<string, string>
18
+ body?: RequestBody
19
+ signal?: AbortSignal
20
+ credentials?: RequestCredentials
21
+ options?: FetchOptions
22
+ responseType?: ResponseType
23
+ }
24
+
25
+ type TransportResult<TData = unknown> = {
26
+ data: TData
27
+ status: number
28
+ statusText: string
29
+ headers: Headers
30
+ contentType?: string
31
+ request: Request
32
+ response: Response
33
+ }
34
+ ```
35
+
36
+ The core hands you a `ResolvedRequest` with the URL built, the query and body serialized, and auth headers set. Return the parsed `data` along with the native `request` and `response`, so status, headers, and the raw body stay reachable on the result.
37
+
38
+ ## Mock the network in tests
39
+
40
+ Return a fixed result from an isolated client in tests:
41
+
42
+ ```typescript
43
+ import { createClient } from './gen/.kubb/client'
44
+ import { getPetById } from './gen/clients/getPetById'
45
+
46
+ const testClient = createClient({
47
+ transport: async (request) => ({
48
+ data: { id: 1, name: 'Fluffy' },
49
+ status: 200,
50
+ statusText: 'OK',
51
+ headers: new Headers(),
52
+ request: new Request(request.url),
53
+ response: new Response(),
54
+ }),
55
+ })
56
+
57
+ const { data } = await getPetById({ path: { petId: 1 }, client: testClient })
58
+ // ^ { id: 1, name: 'Fluffy' }
59
+ ```
60
+
61
+ Pass the isolated client per operation or to a query plugin.
62
+
63
+ ## Where to set it
64
+
65
+ Use `client.setConfig({ transport })` for shared configuration, `createClient({ transport })` for an isolated instance, or pass `transport` on an operation to override it for one call.
66
+
67
+ ## See also
68
+
69
+ - [Add interceptors](https://kubb.dev/extensions/kubb-labs/plugin-fetch/guides/interceptors)
70
+ - [Set the base URL](https://kubb.dev/extensions/kubb-labs/plugin-fetch/guides/base-url)
71
+ - [Call operations](https://kubb.dev/extensions/kubb-labs/plugin-fetch/guides/calling-operations)
@@ -0,0 +1,200 @@
1
+ # Options
2
+
3
+ Pass these options to `pluginFetch()`. Shared options link to [Shared plugin options](https://kubb.dev/docs/5.x/reference/plugin-options).
4
+
5
+ ## Options overview
6
+
7
+ | Option | Purpose | Default |
8
+ | ------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------ |
9
+ | [`output`](https://kubb.dev/docs/5.x/reference/plugin-options#output) | Where files are written: `path`, `mode`, `barrel`, `banner`, `footer`. | `{ path: 'clients', barrel: { type: 'named' } }` |
10
+ | [`group`](https://kubb.dev/docs/5.x/reference/plugin-options#group) | Split output by tag or path: `type`, `name`. | None |
11
+ | [`baseURL`](#baseurl) | Base URL prepended to every request. | None |
12
+ | [`throwOnErrorDefault`](#throwonerrordefault) | Default error behavior and return type for generated operations. | `true` |
13
+ | [`validator`](#validator) | Validate request and response bodies with Zod. | `false` |
14
+ | [`comments`](#comments) | How much of each description reaches the JSDoc. | `'full'` |
15
+ | [`sdk`](#sdk) | Generate a class-based SDK instead of functions. | None |
16
+ | [`returnType`](#returntype) | Shape of the value a generated call resolves to. | `'full'` |
17
+ | [`include`](https://kubb.dev/docs/5.x/reference/plugin-options#include) | Keep only operations that match. | None |
18
+ | [`exclude`](https://kubb.dev/docs/5.x/reference/plugin-options#exclude) | Skip operations that match. | `[]` |
19
+ | [`override`](https://kubb.dev/docs/5.x/reference/plugin-options#override) | Apply different options per pattern. | `[]` |
20
+ | [`resolver`](#resolver) | Customize generated names and file paths. | `resolverClient` |
21
+ | [`macros`](https://kubb.dev/docs/5.x/reference/plugin-options#macros) | Rewrite AST nodes before printing. | `[]`, run after the built-in client macros |
22
+
23
+ ## Option details
24
+
25
+ ### baseURL
26
+
27
+ Base URL prepended to every request. When omitted, each request uses the operation's relative path from the spec. A value with a `${...}` interpolation is emitted as a template literal in the generated client config, so `baseURL: '${process.env.API_URL}'` reads the environment variable at runtime.
28
+
29
+ | | |
30
+ | -------- | -------- |
31
+ | Type | `string` |
32
+ | Required | `false` |
33
+
34
+ ### throwOnErrorDefault
35
+
36
+ Set `throwOnErrorDefault: false` to return documented error responses as values by default. It sets the fallback on each generated request and the default `ThrowOnError` type parameter on functions and SDK methods. It applies to the whole plugin, so `override` cannot set it. A call that passes `throwOnError` still wins. With `throwOnError: true`, a non-2xx response throws and the return type narrows to successful responses. Query hooks always pass `throwOnError: true`.
37
+
38
+ | | |
39
+ | -------- | --------- |
40
+ | Type | `boolean` |
41
+ | Required | `false` |
42
+ | Default | `true` |
43
+
44
+ ```typescript
45
+ // with pluginFetch({ throwOnErrorDefault: false })
46
+ const result = await getPetById({ path: { petId: 1 } })
47
+ if (result.status !== 200) console.error(result.status, result.error)
48
+ ```
49
+
50
+ ### validator
51
+
52
+ Validates request and response bodies with schemas from `@kubb/plugin-zod`, so add `pluginZod()` too. An invalid body makes the generated function throw a `ParseError`.
53
+
54
+ | | |
55
+ | -------- | --------------------------------------------------------- |
56
+ | Type | `false \| 'zod' \| { request?: 'zod'; response?: 'zod' }` |
57
+ | Required | `false` |
58
+ | Default | `false` |
59
+
60
+ ::field-group
61
+
62
+ :::field{name="false"}
63
+ Default value. Does no validation and returns the response cast to the generated type.
64
+ :::
65
+
66
+ :::field{name="'zod'"}
67
+ Validates the success response body, and the error body when a non-2xx call does not throw.
68
+ :::
69
+
70
+ :::field{name="{ request?: 'zod', response?: 'zod' }"}
71
+ Opts in per direction. `request` validates the request body before the call, and `response` validates the response body after it.
72
+ :::
73
+
74
+ ::
75
+
76
+ ```typescript [kubb.config.ts]
77
+ import { defineConfig } from 'kubb/config'
78
+ import { pluginTs } from '@kubb/plugin-ts'
79
+ import { pluginZod } from '@kubb/plugin-zod'
80
+ import { pluginFetch } from '@kubb/plugin-fetch'
81
+
82
+ export default defineConfig({
83
+ input: './petStore.yaml',
84
+ output: { path: './src/gen' },
85
+ plugins: [
86
+ pluginTs(),
87
+ pluginZod(),
88
+ pluginFetch({ validator: { request: 'zod', response: 'zod' } }),
89
+ ],
90
+ })
91
+ ```
92
+
93
+ ### comments
94
+
95
+ Controls generated JSDoc.
96
+
97
+ | | |
98
+ | -------- | ----------------------------- |
99
+ | Type | `'full' \| 'brief' \| 'none'` |
100
+ | Required | `false` |
101
+ | Default | `'full'` |
102
+
103
+ ::field-group
104
+
105
+ :::field{name="'full'"}
106
+ Default value. Keeps complete descriptions and tags.
107
+ :::
108
+
109
+ :::field{name="'brief'"}
110
+ Keeps the first sentence and other tags. Descriptions over 150 characters without a sentence ending are cut at the last word before 120.
111
+ :::
112
+
113
+ :::field{name="'none'"}
114
+ Omits JSDoc but keeps the generated-by banner.
115
+ :::
116
+
117
+ ::
118
+
119
+ ### sdk
120
+
121
+ Generates a class-based SDK. Each instance takes its own client config, so environments can use separate clients. Leave `sdk` unset to keep the standalone functions that query plugins call.
122
+
123
+ | | |
124
+ | -------- | ------------------------------------------- |
125
+ | Type | `{ mode?: 'tag' \| 'flat'; name?: string }` |
126
+ | Required | `false` |
127
+
128
+ ::field-group
129
+
130
+ :::field{name="'tag'"}
131
+ Default value for `sdk.mode`. Generates one class per tag, such as `PetClient`. Set `sdk.name` to also get a root class that shares one config, used as `new PetStore(config).pet.getPetById(...)`.
132
+ :::
133
+
134
+ :::field{name="'flat'"}
135
+ Generates one class named by `sdk.name`, with every operation as a method. Supports single-file output.
136
+ :::
137
+
138
+ ::
139
+
140
+ `mode: 'tag'` needs one file per tag, so it throws [`KUBB_INVALID_PLUGIN_OPTIONS`](https://kubb.dev/docs/5.x/reference/diagnostics#kubb-invalid-plugin-options) with single-file output. Use `mode: 'flat'` for a single file.
141
+
142
+ Methods take the same grouped options and return the same result as the standalone functions. See [Call operations](https://kubb.dev/extensions/kubb-labs/plugin-fetch/guides/calling-operations).
143
+
144
+ ```typescript
145
+ const pet = new PetClient({ baseURL: 'https://petstore.swagger.io/v2' })
146
+ const { data } = await pet.getPetById({ path: { petId: 1 } })
147
+ ```
148
+
149
+ ### returnType
150
+
151
+ Shape of the value a generated call resolves to.
152
+
153
+ | | |
154
+ | -------- | ------------------ |
155
+ | Type | `'full' \| 'data'` |
156
+ | Required | `false` |
157
+ | Default | `'full'` |
158
+
159
+ ::field-group
160
+
161
+ :::field{name="'full'"}
162
+ Default value. Returns `{ status, data, error, contentType, request, response }`.
163
+ :::
164
+
165
+ :::field{name="'data'"}
166
+ Returns the success body when `throwOnError` is `true`. With `throwOnError: false`, returns the full result so callers can tell errors from successes.
167
+ :::
168
+
169
+ ::
170
+
171
+ ```typescript
172
+ pluginFetch({ returnType: 'data' })
173
+
174
+ const pet = await getPetById({ path: { petId: 1 } }) // Pet, not { status, data, ... }
175
+ ```
176
+
177
+ It applies to the functions and the SDK. The query plugins and `@kubb/plugin-mcp` read it too, including a per-operation value set through [`override`](https://kubb.dev/docs/5.x/reference/plugin-options#override). To read headers such as `ETag` under `'data'`, pass `throwOnError: false` and call `result.response.headers.get('etag')`.
178
+
179
+ ### resolver
180
+
181
+ Overrides generated file and symbol names. Omitted members keep `resolverClient`. The shared members (`name`, `file`, `imports`) and the `this` context are described under [`resolver`](https://kubb.dev/docs/5.x/reference/plugin-options#resolver).
182
+
183
+ | | |
184
+ | -------- | ------------------------------- |
185
+ | Type | `ResolverPatch<ResolverClient>` |
186
+ | Required | `false` |
187
+
188
+ ```typescript [Partial override]
189
+ type ResolverClientPatch = {
190
+ name?(name: string): string
191
+ file?: {
192
+ baseName?(params: { name: string; extname: string }): string
193
+ path?(params: { baseName: string; output: Output }): string
194
+ }
195
+ imports?(options: ResolveImportsOptions): Array<ImportNode>
196
+ className?(name: string): string
197
+ groupName?(name: string): string // → 'PetClient'
198
+ propertyName?(name: string): string
199
+ }
200
+ ```
@@ -0,0 +1,41 @@
1
+ # Fetch
2
+
3
+ Generates a type-safe HTTP client based on the native Fetch API from your OpenAPI spec. Each operation becomes one async function with grouped `path`, `query`, `headers`, and `body` parameters and a result keyed by status code.
4
+
5
+ This plugin provides the client runtime. Query plugins such as `@kubb/plugin-react-query`, `@kubb/plugin-vue-query`, `@kubb/plugin-swr`, and `@kubb/plugin-mcp` call the functions it generates.
6
+
7
+ ## Setup
8
+
9
+ - Add `@kubb/plugin-ts` for the operation types. Without it, `@kubb/plugin-zod` with `inferred: true` supplies them.
10
+ - Add `@kubb/plugin-zod` when you set `validator`.
11
+ - No HTTP client package is needed.
12
+
13
+ ## Options worth knowing
14
+
15
+ - `baseURL` is prepended to every request.
16
+ - `validator: 'zod'` validates request and response bodies with the schemas from `@kubb/plugin-zod`.
17
+ - `sdk` generates a class-based SDK, grouped by tag or flat, instead of standalone functions. Query plugins need the standalone functions, so leave `sdk` unset when you use them.
18
+ - `returnType: 'data'` makes a call resolve to the success body instead of the full result with status, data, and error.
19
+ - `throwOnErrorDefault: false` returns documented error responses as values instead of throwing. A single call can still pass `throwOnError`.
20
+
21
+ ## Example
22
+
23
+ ```typescript [kubb.config.ts]
24
+ import { defineConfig } from 'kubb/config'
25
+ import { pluginTs } from '@kubb/plugin-ts'
26
+ import { pluginFetch } from '@kubb/plugin-fetch'
27
+
28
+ export default defineConfig({
29
+ input: './petStore.yaml',
30
+ output: { path: './src/gen' },
31
+ plugins: [
32
+ pluginTs(),
33
+ pluginFetch({ baseURL: 'https://petstore.swagger.io/v2' }),
34
+ ],
35
+ })
36
+ ```
37
+
38
+ ## See also
39
+
40
+ - [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
41
+ - [`@kubb/plugin-ts`](https://kubb.dev/extensions/kubb-labs/plugin-ts)
@@ -0,0 +1,198 @@
1
+ {
2
+ "$schema": "https://kubb.dev/schemas/kubb-extension.json",
3
+ "kind": "plugin",
4
+ "name": "plugin-fetch",
5
+ "export": "pluginFetch",
6
+ "displayName": "Fetch",
7
+ "description": "Generates a type-safe Fetch API client from your OpenAPI spec, one async function per operation, so each call stays in sync with the API.",
8
+ "category": "client",
9
+ "icon": {
10
+ "light": "https://kubb.dev/feature/javascript.svg"
11
+ },
12
+ "tags": ["api-client", "fetch", "http-client", "codegen", "openapi", "validator"],
13
+ "docs": "https://kubb.dev/extensions/kubb-labs/plugin-fetch",
14
+ "maintainers": [
15
+ {
16
+ "name": "Stijn Van Hulle",
17
+ "github": "stijnvanhulle"
18
+ }
19
+ ],
20
+ "dependencies": ["plugin-ts"],
21
+ "compatibility": {
22
+ "kubb": ">=5.8.3",
23
+ "node": ">=22"
24
+ },
25
+ "role": "client",
26
+ "options": [
27
+ {
28
+ "key": "outputPath",
29
+ "path": ["output", "path"],
30
+ "label": "Output Path",
31
+ "description": "Output folder for generated files",
32
+ "type": "text",
33
+ "default": "clients"
34
+ },
35
+ {
36
+ "key": "barrel",
37
+ "path": ["output", "barrel"],
38
+ "label": "Barrel",
39
+ "description": "How index.ts barrel files are generated",
40
+ "type": "select",
41
+ "default": {
42
+ "type": "named"
43
+ },
44
+ "choices": [
45
+ {
46
+ "label": "named",
47
+ "value": {
48
+ "type": "named"
49
+ }
50
+ },
51
+ {
52
+ "label": "named (nested)",
53
+ "value": {
54
+ "type": "named",
55
+ "nested": true
56
+ }
57
+ },
58
+ {
59
+ "label": "all",
60
+ "value": {
61
+ "type": "all"
62
+ }
63
+ },
64
+ {
65
+ "label": "all (nested)",
66
+ "value": {
67
+ "type": "all",
68
+ "nested": true
69
+ }
70
+ },
71
+ {
72
+ "label": "false (disabled)",
73
+ "value": false
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "key": "outputMode",
79
+ "path": ["output", "mode"],
80
+ "label": "Output Mode",
81
+ "description": "How the plugin consolidates its code into files. File mode writes everything into a single file, so the output path must include a file extension and cannot be grouped.",
82
+ "type": "select",
83
+ "default": "directory",
84
+ "choices": [
85
+ {
86
+ "label": "directory (one file per schema)",
87
+ "value": "directory"
88
+ },
89
+ {
90
+ "label": "file (single file)",
91
+ "value": "file"
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "key": "validator",
97
+ "path": ["validator"],
98
+ "label": "Validator",
99
+ "description": "Validate request and response bodies with schemas from @kubb/plugin-zod",
100
+ "type": "select",
101
+ "default": false,
102
+ "choices": [
103
+ {
104
+ "label": "false (disabled)",
105
+ "value": false
106
+ },
107
+ {
108
+ "label": "zod",
109
+ "value": "zod"
110
+ }
111
+ ]
112
+ },
113
+ {
114
+ "key": "group",
115
+ "path": ["group"],
116
+ "label": "Group",
117
+ "description": "Group generated operations by OpenAPI tag or path",
118
+ "type": "select",
119
+ "default": null,
120
+ "choices": [
121
+ {
122
+ "label": "none",
123
+ "value": null
124
+ },
125
+ {
126
+ "label": "by tag",
127
+ "value": {
128
+ "type": "tag"
129
+ }
130
+ },
131
+ {
132
+ "label": "by path",
133
+ "value": {
134
+ "type": "path"
135
+ }
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ "key": "excludeTags",
141
+ "path": ["exclude"],
142
+ "label": "Exclude Tags",
143
+ "description": "Comma-separated OpenAPI tags to exclude from generation",
144
+ "type": "list",
145
+ "item": {
146
+ "type": "tag",
147
+ "pattern": "$item"
148
+ }
149
+ },
150
+ {
151
+ "key": "includeTags",
152
+ "path": ["include"],
153
+ "label": "Include Tags",
154
+ "description": "Comma-separated OpenAPI tags to include. Only operations with these tags are generated",
155
+ "type": "list",
156
+ "item": {
157
+ "type": "tag",
158
+ "pattern": "$item"
159
+ }
160
+ },
161
+ {
162
+ "key": "baseURL",
163
+ "path": ["baseURL"],
164
+ "label": "Base URL",
165
+ "description": "Custom API base URL",
166
+ "type": "text"
167
+ },
168
+ {
169
+ "key": "sdkMode",
170
+ "path": ["sdk", "mode"],
171
+ "label": "SDK Mode",
172
+ "description": "Group generated operations into an SDK client by tag or flat",
173
+ "type": "select",
174
+ "default": null,
175
+ "choices": [
176
+ {
177
+ "label": "off (standalone functions)",
178
+ "value": null
179
+ },
180
+ {
181
+ "label": "tag",
182
+ "value": "tag"
183
+ },
184
+ {
185
+ "label": "flat",
186
+ "value": "flat"
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ "key": "sdkName",
192
+ "path": ["sdk", "name"],
193
+ "label": "SDK Name",
194
+ "description": "Root client name for the generated SDK",
195
+ "type": "text"
196
+ }
197
+ ]
198
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-fetch",
3
- "version": "5.5.8",
3
+ "version": "5.5.10",
4
4
  "description": "Generate a slim, type-safe HTTP client with Kubb based on the native Fetch api.",
5
5
  "keywords": [
6
6
  "api-client",
@@ -13,7 +13,7 @@
13
13
  "swagger",
14
14
  "typescript"
15
15
  ],
16
- "homepage": "https://kubb.dev/plugins/plugin-fetch",
16
+ "homepage": "https://kubb.dev/extensions/kubb-labs/plugin-fetch",
17
17
  "license": "MIT",
18
18
  "author": "stijnvanhulle",
19
19
  "repository": {
@@ -39,6 +39,8 @@
39
39
  "src",
40
40
  "dist",
41
41
  "templates",
42
+ "kubb-extension.json",
43
+ "docs",
42
44
  "!/**/**.test.**",
43
45
  "!/**/__tests__/**",
44
46
  "!/**/__snapshots__/**"
@@ -58,6 +60,7 @@
58
60
  "require": "./dist/index.cjs"
59
61
  },
60
62
  "./package.json": "./package.json",
63
+ "./kubb-extension.json": "./kubb-extension.json",
61
64
  "./templates/*": "./templates/*"
62
65
  },
63
66
  "publishConfig": {
@@ -65,17 +68,17 @@
65
68
  "registry": "https://registry.npmjs.org/"
66
69
  },
67
70
  "dependencies": {
68
- "@kubb/plugin-ts": "^5.0.7",
69
- "@kubb/plugin-zod": "^5.4.5"
71
+ "@kubb/plugin-ts": "^5.0.9",
72
+ "@kubb/plugin-zod": "^5.4.7"
70
73
  },
71
74
  "devDependencies": {
72
75
  "@internals/client": "0.0.0",
73
76
  "@internals/shared": "0.0.0",
74
- "kubb": "^5.8.0",
77
+ "kubb": "^5.8.3",
75
78
  "typescript": "^6.0.3"
76
79
  },
77
80
  "peerDependencies": {
78
- "kubb": "^5.8.0"
81
+ "kubb": "^5.8.3"
79
82
  },
80
83
  "engines": {
81
84
  "node": ">=22"
package/src/plugin.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import path from 'node:path'
2
2
  import { createSdkGenerator, defaultMacros, resolverClient } from '@internals/client'
3
3
  import { createGroupConfig } from '@internals/shared'
4
- import { addGenerator, definePlugin, injectFile, Resolver, setMacros, setResolver, useConfig } from 'kubb/kit'
4
+ import { addGenerator, defineExtension, injectFile, Resolver, setMacros, setResolver, useConfig } from 'kubb/kit'
5
+ import { compatibility } from '../kubb-extension.json'
5
6
  import { version } from '../package.json'
6
7
  import { pluginTsName } from '@kubb/plugin-ts'
7
8
  import { pluginZodName } from '@kubb/plugin-zod'
@@ -37,8 +38,9 @@ export const pluginFetchName = 'plugin-fetch' satisfies PluginFetch['name']
37
38
  * })
38
39
  * ```
39
40
  */
40
- export const pluginFetch = definePlugin<PluginFetch>({
41
- meta: { name: pluginFetchName, version, compatibility: { kubb: '>=5.8.0' } },
41
+ export const pluginFetch = defineExtension<PluginFetch>({
42
+ kind: 'plugin',
43
+ meta: { name: pluginFetchName, version, compatibility },
42
44
  // Both are ordering hints, skipped when the plugin is not in the pipeline. `plugin-ts` supplies
43
45
  // the operation types unless it is absent, in which case `pluginZod({ inferred: true })` does.
44
46
  dependencies: { [pluginTsName]: { optional: true }, [pluginZodName]: { optional: true } },