@kubb/plugin-fetch 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/OVERVIEW.md +19 -0
- package/dist/index.cjs +8 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +191 -0
- package/package.json +8 -5
- package/src/plugin.ts +2 -1
package/OVERVIEW.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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`.
|
package/dist/index.cjs
CHANGED
|
@@ -1480,8 +1480,14 @@ const resolverClient = (0, kubb_kit.createResolver)({
|
|
|
1480
1480
|
*/
|
|
1481
1481
|
const clientGenerator = createClientGenerator("fetch");
|
|
1482
1482
|
//#endregion
|
|
1483
|
+
//#region kubb-extension.json
|
|
1484
|
+
var compatibility = {
|
|
1485
|
+
"kubb": ">=5.8.0",
|
|
1486
|
+
"node": ">=22"
|
|
1487
|
+
};
|
|
1488
|
+
//#endregion
|
|
1483
1489
|
//#region package.json
|
|
1484
|
-
var version = "5.5.
|
|
1490
|
+
var version = "5.5.9";
|
|
1485
1491
|
//#endregion
|
|
1486
1492
|
//#region src/templates.ts
|
|
1487
1493
|
/** Absolute path to the fetch client template, copied into `.kubb/client.ts`. */
|
|
@@ -1526,7 +1532,7 @@ const pluginFetch = (0, kubb_kit.definePlugin)({
|
|
|
1526
1532
|
meta: {
|
|
1527
1533
|
name: pluginFetchName,
|
|
1528
1534
|
version,
|
|
1529
|
-
compatibility
|
|
1535
|
+
compatibility
|
|
1530
1536
|
},
|
|
1531
1537
|
dependencies: {
|
|
1532
1538
|
[_kubb_plugin_ts.pluginTsName]: { optional: true },
|