@kubb/plugin-axios 6.1.0-canary.20261115T203618 → 6.1.0
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 +1 -1
- package/dist/index.js +1 -1
- package/docs/options.md +31 -0
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var compatibility = {
|
|
|
11
11
|
"node": ">=22.22"
|
|
12
12
|
};
|
|
13
13
|
// package.json
|
|
14
|
-
var version = "6.1.0
|
|
14
|
+
var version = "6.1.0";
|
|
15
15
|
// src/plugin.ts
|
|
16
16
|
/**
|
|
17
17
|
* Canonical plugin name for `@kubb/plugin-axios`. Used for driver lookups and cross-plugin
|
package/dist/index.js
CHANGED
package/docs/options.md
CHANGED
|
@@ -11,6 +11,8 @@ Pass these options to `pluginAxios()`. Shared options link to [Shared plugin opt
|
|
|
11
11
|
| [`baseURL`](#baseurl) | Base URL the client starts with. | None |
|
|
12
12
|
| [`throwOnErrorDefault`](#throwonerrordefault) | Throw on a non-2xx response unless a call says otherwise. | `true` |
|
|
13
13
|
| [`validator`](#validator) | Validate requests and responses with Zod. | `false` |
|
|
14
|
+
| [`auth`](#auth) | How generated functions take `auth`. | None |
|
|
15
|
+
| [`auth.mode`](#auth) | Optional `auth`, or required when a token is needed. | `'optional'` |
|
|
14
16
|
| [`returnType`](#returntype) | What a call resolves to. | `'full'` |
|
|
15
17
|
| [`sdk`](#sdk) | Generate classes instead of standalone functions. | None |
|
|
16
18
|
| [`sdk.mode`](#sdk) | One class per tag, or one class with every operation. | `'tag'` |
|
|
@@ -98,6 +100,35 @@ export default defineConfig({
|
|
|
98
100
|
|
|
99
101
|
See [Turn validation off at runtime](https://kubb.dev/extensions/kubb-labs/plugin-axios/guides/error-handling#turn-validation-off-at-runtime) and [Parameter validation](https://kubb.dev/extensions/kubb-labs/plugin-axios/guides/serialization#parameter-validation).
|
|
100
102
|
|
|
103
|
+
### auth
|
|
104
|
+
|
|
105
|
+
Sets how generated functions take the `auth` option.
|
|
106
|
+
|
|
107
|
+
| | |
|
|
108
|
+
| -------- | ------------------------------------- |
|
|
109
|
+
| Type | `{ mode?: 'optional' \| 'required' }` |
|
|
110
|
+
| Required | `false` |
|
|
111
|
+
|
|
112
|
+
::field-group
|
|
113
|
+
|
|
114
|
+
:::field{name="mode: 'optional'"}
|
|
115
|
+
Default value. Every generated function takes `auth` as an optional option. Use it when `client.setConfig({ auth })` supplies the token, and with the query-hook plugins, which pass a partial config to the function.
|
|
116
|
+
:::
|
|
117
|
+
|
|
118
|
+
:::field{name="mode: 'required'"}
|
|
119
|
+
A generated function whose operation needs a security scheme takes `auth` as a required option, so a missing token fails at compile time. An operation without `security`, or one that allows `{}` (anonymous access), keeps `auth` optional.
|
|
120
|
+
:::
|
|
121
|
+
|
|
122
|
+
::
|
|
123
|
+
|
|
124
|
+
SDK classes take `auth` in their constructor and ignore this option.
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
// with pluginAxios({ auth: { mode: 'required' } })
|
|
128
|
+
await addPet({ body, auth: () => getToken() })
|
|
129
|
+
await addPet({ body }) // Type error: `auth` is missing
|
|
130
|
+
```
|
|
131
|
+
|
|
101
132
|
### returnType
|
|
102
133
|
|
|
103
134
|
What a generated function or SDK method resolves to. The query plugins and `@kubb/plugin-mcp` read it too.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-axios",
|
|
3
|
-
"version": "6.1.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Generate a slim, type-safe HTTP client with Kubb based on axios.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
86
|
"@kubb/kit": "^5.20.1",
|
|
87
|
-
"@kubb/plugin-client": "^6.1.0
|
|
87
|
+
"@kubb/plugin-client": "^6.1.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"axios": "^1.21.1",
|