@kubb/plugin-vue-query 5.0.0-beta.80 → 5.0.0-beta.81
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 +99 -195
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -168
- package/dist/index.js +99 -195
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
package/dist/index.cjs
CHANGED
|
@@ -28,7 +28,6 @@ let node_path = require("node:path");
|
|
|
28
28
|
node_path = __toESM(node_path, 1);
|
|
29
29
|
let _kubb_core = require("@kubb/core");
|
|
30
30
|
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
31
|
-
let _kubb_plugin_zod = require("@kubb/plugin-zod");
|
|
32
31
|
let _kubb_renderer_jsx = require("@kubb/renderer-jsx");
|
|
33
32
|
let _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
|
|
34
33
|
let _kubb_ast_utils = require("@kubb/ast/utils");
|
|
@@ -555,109 +554,6 @@ function createGroupConfig(group) {
|
|
|
555
554
|
};
|
|
556
555
|
}
|
|
557
556
|
//#endregion
|
|
558
|
-
//#region ../../internals/client/src/builders/validatorOptions.ts
|
|
559
|
-
/**
|
|
560
|
-
* Returns `true` when any direction of the validator uses zod (used for dependency checks).
|
|
561
|
-
*/
|
|
562
|
-
function isValidatorEnabled(validator) {
|
|
563
|
-
if (!validator) return false;
|
|
564
|
-
if (validator === "zod") return true;
|
|
565
|
-
return Boolean(validator.request || validator.response);
|
|
566
|
-
}
|
|
567
|
-
//#endregion
|
|
568
|
-
//#region ../../internals/client/src/resolveClient.ts
|
|
569
|
-
/**
|
|
570
|
-
* Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
|
|
571
|
-
* operation, shared so the selection rules and diagnostics stay in one place.
|
|
572
|
-
*
|
|
573
|
-
* Every client runtime lives in a dedicated client plugin, so a consumer always calls a registered
|
|
574
|
-
* contract client plugin (plugin-fetch or plugin-axios) and never emits its own inline client:
|
|
575
|
-
*
|
|
576
|
-
* - `contract` — a registered contract client plugin owns the `<op>` functions and the consumer
|
|
577
|
-
* imports and calls them.
|
|
578
|
-
* - `error` — no client plugin is registered, several are registered without a selector, or the
|
|
579
|
-
* requested one is missing.
|
|
580
|
-
*
|
|
581
|
-
* The `client` string selects explicitly (`'fetch'` / `'axios'`); when it is unset a lone registered
|
|
582
|
-
* contract client plugin is picked up automatically.
|
|
583
|
-
*/
|
|
584
|
-
const pluginFetchName = "plugin-fetch";
|
|
585
|
-
const pluginAxiosName = "plugin-axios";
|
|
586
|
-
const selectorToPlugin = {
|
|
587
|
-
fetch: pluginFetchName,
|
|
588
|
-
axios: pluginAxiosName
|
|
589
|
-
};
|
|
590
|
-
const contractPlugins = [pluginFetchName, pluginAxiosName];
|
|
591
|
-
/**
|
|
592
|
-
* Applies the `client` resolution rules. See the module comment for the strategy shape.
|
|
593
|
-
*
|
|
594
|
-
* @example
|
|
595
|
-
* ```ts
|
|
596
|
-
* resolveClient({ client: 'fetch', pluginNames: ['plugin-ts', 'plugin-fetch'] })
|
|
597
|
-
* // { kind: 'contract', pluginName: 'plugin-fetch' }
|
|
598
|
-
* ```
|
|
599
|
-
*
|
|
600
|
-
* @example
|
|
601
|
-
* ```ts
|
|
602
|
-
* resolveClient({ client: undefined, pluginNames: ['plugin-ts'] })
|
|
603
|
-
* // { kind: 'error', message: 'No client plugin is registered…' }
|
|
604
|
-
* ```
|
|
605
|
-
*/
|
|
606
|
-
function resolveClient(options) {
|
|
607
|
-
const { client, pluginNames } = options;
|
|
608
|
-
const has = (name) => pluginNames.includes(name);
|
|
609
|
-
if (client === "fetch" || client === "axios") {
|
|
610
|
-
const pluginName = selectorToPlugin[client];
|
|
611
|
-
if (!has(pluginName)) return {
|
|
612
|
-
kind: "error",
|
|
613
|
-
message: `\`client: '${client}'\` is set but \`@kubb/plugin-${client}\` is not registered in \`plugins\`. Add it, or drop \`client\` to use a different client plugin.`
|
|
614
|
-
};
|
|
615
|
-
return {
|
|
616
|
-
kind: "contract",
|
|
617
|
-
pluginName
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
const registered = contractPlugins.filter(has);
|
|
621
|
-
if (registered.length === 1) return {
|
|
622
|
-
kind: "contract",
|
|
623
|
-
pluginName: registered[0]
|
|
624
|
-
};
|
|
625
|
-
if (registered.length > 1) return {
|
|
626
|
-
kind: "error",
|
|
627
|
-
message: `Multiple client plugins are registered (${registered.map((name) => `\`@kubb/${name}\``).join(", ")}). Set \`client: 'fetch' | 'axios'\` to choose which client the hooks call, or register a single client plugin.`
|
|
628
|
-
};
|
|
629
|
-
return {
|
|
630
|
-
kind: "error",
|
|
631
|
-
message: "No client plugin is registered. Add `@kubb/plugin-axios` or `@kubb/plugin-fetch` to `plugins` so the generated code has an HTTP client to call."
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
//#endregion
|
|
635
|
-
//#region ../../internals/client/src/resolveClientOperation.ts
|
|
636
|
-
/**
|
|
637
|
-
* Resolves the contract client `<op>` a consumer (query hook, MCP handler) imports, by looking up
|
|
638
|
-
* the registered contract client plugin's resolver and output. Works for any contract client plugin
|
|
639
|
-
* (plugin-fetch or plugin-axios). Returns `null` when no contract plugin is in play (the inline
|
|
640
|
-
* path). The plugin injects `.kubb/client.ts` at the global output root, the same path consumers
|
|
641
|
-
* read `RequestConfig` / `ResponseErrorConfig` from.
|
|
642
|
-
*/
|
|
643
|
-
function resolveClientOperation(options) {
|
|
644
|
-
const { clientPlugin, driver, node, root, output } = options;
|
|
645
|
-
if (!clientPlugin) return null;
|
|
646
|
-
const resolver = driver.getResolver(clientPlugin.pluginName);
|
|
647
|
-
if (!resolver) return null;
|
|
648
|
-
const plugin = driver.getPlugin(clientPlugin.pluginName);
|
|
649
|
-
const file = resolver.resolveFile(operationFileEntry(node, node.operationId), {
|
|
650
|
-
root,
|
|
651
|
-
output: plugin?.options?.output ?? output,
|
|
652
|
-
group: plugin?.options?.group ?? void 0
|
|
653
|
-
});
|
|
654
|
-
return {
|
|
655
|
-
name: resolver.resolveName(node.operationId),
|
|
656
|
-
path: file.path,
|
|
657
|
-
clientPath: node_path.default.resolve(root, ".kubb/client.ts")
|
|
658
|
-
};
|
|
659
|
-
}
|
|
660
|
-
//#endregion
|
|
661
557
|
//#region ../../internals/tanstack-query/src/components/MutationKey.tsx
|
|
662
558
|
const declarationPrinter$7 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
663
559
|
const mutationKeyTransformer = ({ node }) => {
|
|
@@ -772,51 +668,6 @@ function buildQueryOptionsParams(node, options) {
|
|
|
772
668
|
default: "{}"
|
|
773
669
|
})].filter((param) => param !== null) });
|
|
774
670
|
}
|
|
775
|
-
/**
|
|
776
|
-
* Returns `'zod'` when response-direction parsing is enabled.
|
|
777
|
-
* The string shorthand `'zod'` also enables response parsing.
|
|
778
|
-
*/
|
|
779
|
-
function resolveResponseParser(parser) {
|
|
780
|
-
if (!parser) return null;
|
|
781
|
-
if (parser === "zod") return "zod";
|
|
782
|
-
return parser.response ?? null;
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* Returns `'zod'` when request body parsing is enabled.
|
|
786
|
-
* The string shorthand `'zod'` also enables request body parsing (existing behavior).
|
|
787
|
-
*/
|
|
788
|
-
function resolveRequestParser(parser) {
|
|
789
|
-
if (!parser) return null;
|
|
790
|
-
if (parser === "zod") return "zod";
|
|
791
|
-
return parser.request ?? null;
|
|
792
|
-
}
|
|
793
|
-
/**
|
|
794
|
-
* Returns `'zod'` when query-params parsing is enabled.
|
|
795
|
-
* Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.
|
|
796
|
-
*/
|
|
797
|
-
function resolveQueryParamsParser(parser) {
|
|
798
|
-
if (!parser || parser === "zod") return null;
|
|
799
|
-
return parser.request ?? null;
|
|
800
|
-
}
|
|
801
|
-
/**
|
|
802
|
-
* Collects the Zod schema import names for an operation based on the active parser directions.
|
|
803
|
-
*
|
|
804
|
-
* - `parser: 'zod'`: response and request body names (backward-compatible behavior).
|
|
805
|
-
* - `parser: { request: 'zod' }`: request body and query params names.
|
|
806
|
-
* - `parser: { response: 'zod' }`: response name only.
|
|
807
|
-
* - `parser: { request: 'zod', response: 'zod' }`: all three.
|
|
808
|
-
*
|
|
809
|
-
* Returns an empty array when no resolver is provided or `parser` is falsy.
|
|
810
|
-
*/
|
|
811
|
-
function resolveZodSchemaNames(node, zodResolver, parser) {
|
|
812
|
-
if (!zodResolver || !parser) return [];
|
|
813
|
-
const { query: queryParams } = getOperationParameters(node, { paramsCasing: "original" });
|
|
814
|
-
return [
|
|
815
|
-
resolveResponseParser(parser) === "zod" ? zodResolver.resolveResponseName?.(node) : null,
|
|
816
|
-
resolveRequestParser(parser) === "zod" && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,
|
|
817
|
-
resolveQueryParamsParser(parser) === "zod" && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]) : null
|
|
818
|
-
].filter((n) => Boolean(n));
|
|
819
|
-
}
|
|
820
671
|
(0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
821
672
|
const queryKeyTransformer = ({ node }) => {
|
|
822
673
|
if (!node.path) return [];
|
|
@@ -830,6 +681,99 @@ const queryKeyTransformer = ({ node }) => {
|
|
|
830
681
|
].filter(Boolean);
|
|
831
682
|
};
|
|
832
683
|
//#endregion
|
|
684
|
+
//#region ../../internals/client/src/resolveClient.ts
|
|
685
|
+
/**
|
|
686
|
+
* Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
|
|
687
|
+
* operation, shared so the selection rules and diagnostics stay in one place.
|
|
688
|
+
*
|
|
689
|
+
* Every client runtime lives in a dedicated client plugin, so a consumer always calls a registered
|
|
690
|
+
* contract client plugin (plugin-fetch or plugin-axios) and never emits its own inline client:
|
|
691
|
+
*
|
|
692
|
+
* - `contract` — a registered contract client plugin owns the `<op>` functions and the consumer
|
|
693
|
+
* imports and calls them.
|
|
694
|
+
* - `error` — no client plugin is registered, several are registered without a selector, or the
|
|
695
|
+
* requested one is missing.
|
|
696
|
+
*
|
|
697
|
+
* The `client` string selects explicitly (`'fetch'` / `'axios'`); when it is unset a lone registered
|
|
698
|
+
* contract client plugin is picked up automatically.
|
|
699
|
+
*/
|
|
700
|
+
const pluginFetchName = "plugin-fetch";
|
|
701
|
+
const pluginAxiosName = "plugin-axios";
|
|
702
|
+
const selectorToPlugin = {
|
|
703
|
+
fetch: pluginFetchName,
|
|
704
|
+
axios: pluginAxiosName
|
|
705
|
+
};
|
|
706
|
+
const contractPlugins = [pluginFetchName, pluginAxiosName];
|
|
707
|
+
/**
|
|
708
|
+
* Applies the `client` resolution rules. See the module comment for the strategy shape.
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```ts
|
|
712
|
+
* resolveClient({ client: 'fetch', pluginNames: ['plugin-ts', 'plugin-fetch'] })
|
|
713
|
+
* // { kind: 'contract', pluginName: 'plugin-fetch' }
|
|
714
|
+
* ```
|
|
715
|
+
*
|
|
716
|
+
* @example
|
|
717
|
+
* ```ts
|
|
718
|
+
* resolveClient({ client: undefined, pluginNames: ['plugin-ts'] })
|
|
719
|
+
* // { kind: 'error', message: 'No client plugin is registered…' }
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
function resolveClient(options) {
|
|
723
|
+
const { client, pluginNames } = options;
|
|
724
|
+
const has = (name) => pluginNames.includes(name);
|
|
725
|
+
if (client === "fetch" || client === "axios") {
|
|
726
|
+
const pluginName = selectorToPlugin[client];
|
|
727
|
+
if (!has(pluginName)) return {
|
|
728
|
+
kind: "error",
|
|
729
|
+
message: `\`client: '${client}'\` is set but \`@kubb/plugin-${client}\` is not registered in \`plugins\`. Add it, or drop \`client\` to use a different client plugin.`
|
|
730
|
+
};
|
|
731
|
+
return {
|
|
732
|
+
kind: "contract",
|
|
733
|
+
pluginName
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
const registered = contractPlugins.filter(has);
|
|
737
|
+
if (registered.length === 1) return {
|
|
738
|
+
kind: "contract",
|
|
739
|
+
pluginName: registered[0]
|
|
740
|
+
};
|
|
741
|
+
if (registered.length > 1) return {
|
|
742
|
+
kind: "error",
|
|
743
|
+
message: `Multiple client plugins are registered (${registered.map((name) => `\`@kubb/${name}\``).join(", ")}). Set \`client: 'fetch' | 'axios'\` to choose which client the hooks call, or register a single client plugin.`
|
|
744
|
+
};
|
|
745
|
+
return {
|
|
746
|
+
kind: "error",
|
|
747
|
+
message: "No client plugin is registered. Add `@kubb/plugin-axios` or `@kubb/plugin-fetch` to `plugins` so the generated code has an HTTP client to call."
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
//#endregion
|
|
751
|
+
//#region ../../internals/client/src/resolveClientOperation.ts
|
|
752
|
+
/**
|
|
753
|
+
* Resolves the contract client `<op>` a consumer (query hook, MCP handler) imports, by looking up
|
|
754
|
+
* the registered contract client plugin's resolver and output. Works for any contract client plugin
|
|
755
|
+
* (plugin-fetch or plugin-axios). Returns `null` when no contract plugin is in play (the inline
|
|
756
|
+
* path). The plugin injects `.kubb/client.ts` at the global output root, the same path consumers
|
|
757
|
+
* read `RequestConfig` / `ResponseErrorConfig` from.
|
|
758
|
+
*/
|
|
759
|
+
function resolveClientOperation(options) {
|
|
760
|
+
const { clientPlugin, driver, node, root, output } = options;
|
|
761
|
+
if (!clientPlugin) return null;
|
|
762
|
+
const resolver = driver.getResolver(clientPlugin.pluginName);
|
|
763
|
+
if (!resolver) return null;
|
|
764
|
+
const plugin = driver.getPlugin(clientPlugin.pluginName);
|
|
765
|
+
const file = resolver.resolveFile(operationFileEntry(node, node.operationId), {
|
|
766
|
+
root,
|
|
767
|
+
output: plugin?.options?.output ?? output,
|
|
768
|
+
group: plugin?.options?.group ?? void 0
|
|
769
|
+
});
|
|
770
|
+
return {
|
|
771
|
+
name: resolver.resolveName(node.operationId),
|
|
772
|
+
path: file.path,
|
|
773
|
+
clientPath: node_path.default.resolve(root, ".kubb/client.ts")
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
//#endregion
|
|
833
777
|
//#region src/utils.ts
|
|
834
778
|
const requestGroupOrder = [
|
|
835
779
|
"path",
|
|
@@ -1274,7 +1218,7 @@ const infiniteQueryGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1274
1218
|
operation(node, ctx) {
|
|
1275
1219
|
if (!_kubb_core.ast.isHttpOperationNode(node)) return null;
|
|
1276
1220
|
const { config, driver, resolver, root } = ctx;
|
|
1277
|
-
const { output, query, mutation, infinite,
|
|
1221
|
+
const { output, query, mutation, infinite, client, group, hooks } = ctx.options;
|
|
1278
1222
|
const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
|
|
1279
1223
|
if (!pluginTs) return null;
|
|
1280
1224
|
const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
|
|
@@ -1324,14 +1268,6 @@ const infiniteQueryGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1324
1268
|
includeParams: false
|
|
1325
1269
|
})
|
|
1326
1270
|
].filter((name) => Boolean(name));
|
|
1327
|
-
const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(_kubb_plugin_zod.pluginZodName) : null;
|
|
1328
|
-
const zodResolver = pluginZod ? driver.getResolver(_kubb_plugin_zod.pluginZodName) : null;
|
|
1329
|
-
const fileZod = zodResolver ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {
|
|
1330
|
-
root,
|
|
1331
|
-
output: pluginZod?.options?.output ?? output,
|
|
1332
|
-
group: pluginZod?.options?.group ?? void 0
|
|
1333
|
-
}) : null;
|
|
1334
|
-
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, validator);
|
|
1335
1271
|
const calledClientName = contractOp.name;
|
|
1336
1272
|
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsxs)(_kubb_renderer_jsx.File, {
|
|
1337
1273
|
baseName: meta.file.baseName,
|
|
@@ -1354,11 +1290,6 @@ const infiniteQueryGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1354
1290
|
}
|
|
1355
1291
|
}),
|
|
1356
1292
|
children: [
|
|
1357
|
-
fileZod && zodSchemaNames.length > 0 && /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
|
|
1358
|
-
name: zodSchemaNames,
|
|
1359
|
-
root: meta.file.path,
|
|
1360
|
-
path: fileZod.path
|
|
1361
|
-
}),
|
|
1362
1293
|
/* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
|
|
1363
1294
|
name: [contractOp.name],
|
|
1364
1295
|
root: meta.file.path,
|
|
@@ -1456,7 +1387,7 @@ const mutationGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1456
1387
|
operation(node, ctx) {
|
|
1457
1388
|
if (!_kubb_core.ast.isHttpOperationNode(node)) return null;
|
|
1458
1389
|
const { config, driver, resolver, root } = ctx;
|
|
1459
|
-
const { output, query, mutation,
|
|
1390
|
+
const { output, query, mutation, client, group, hooks } = ctx.options;
|
|
1460
1391
|
const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
|
|
1461
1392
|
if (!pluginTs) return null;
|
|
1462
1393
|
const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
|
|
@@ -1491,14 +1422,6 @@ const mutationGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1491
1422
|
order: "body-response-first",
|
|
1492
1423
|
includeParams: false
|
|
1493
1424
|
})].filter((name) => Boolean(name));
|
|
1494
|
-
const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(_kubb_plugin_zod.pluginZodName) : null;
|
|
1495
|
-
const zodResolver = pluginZod ? driver.getResolver(_kubb_plugin_zod.pluginZodName) : null;
|
|
1496
|
-
const fileZod = zodResolver ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {
|
|
1497
|
-
root,
|
|
1498
|
-
output: pluginZod?.options?.output ?? output,
|
|
1499
|
-
group: pluginZod?.options?.group ?? void 0
|
|
1500
|
-
}) : null;
|
|
1501
|
-
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, validator);
|
|
1502
1425
|
const calledClientName = contractOp.name;
|
|
1503
1426
|
const groups = getRequestGroups(node);
|
|
1504
1427
|
const hasRequestGroups = groups.path || groups.query || groups.body || groups.headers;
|
|
@@ -1523,11 +1446,6 @@ const mutationGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1523
1446
|
}
|
|
1524
1447
|
}),
|
|
1525
1448
|
children: [
|
|
1526
|
-
fileZod && zodSchemaNames.length > 0 && /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
|
|
1527
|
-
name: zodSchemaNames,
|
|
1528
|
-
root: meta.file.path,
|
|
1529
|
-
path: fileZod.path
|
|
1530
|
-
}),
|
|
1531
1449
|
/* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
|
|
1532
1450
|
name: [contractOp.name],
|
|
1533
1451
|
root: meta.file.path,
|
|
@@ -1595,7 +1513,7 @@ const queryGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1595
1513
|
operation(node, ctx) {
|
|
1596
1514
|
if (!_kubb_core.ast.isHttpOperationNode(node)) return null;
|
|
1597
1515
|
const { config, driver, resolver, root } = ctx;
|
|
1598
|
-
const { output, query, mutation,
|
|
1516
|
+
const { output, query, mutation, client, group, hooks } = ctx.options;
|
|
1599
1517
|
const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
|
|
1600
1518
|
if (!pluginTs) return null;
|
|
1601
1519
|
const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
|
|
@@ -1633,14 +1551,6 @@ const queryGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1633
1551
|
order: "body-response-first",
|
|
1634
1552
|
includeParams: false
|
|
1635
1553
|
})].filter((name) => Boolean(name));
|
|
1636
|
-
const pluginZod = isValidatorEnabled(validator) ? driver.getPlugin(_kubb_plugin_zod.pluginZodName) : null;
|
|
1637
|
-
const zodResolver = pluginZod ? driver.getResolver(_kubb_plugin_zod.pluginZodName) : null;
|
|
1638
|
-
const fileZod = zodResolver ? zodResolver.resolveFile(operationFileEntry(node, node.operationId), {
|
|
1639
|
-
root,
|
|
1640
|
-
output: pluginZod?.options?.output ?? output,
|
|
1641
|
-
group: pluginZod?.options?.group ?? void 0
|
|
1642
|
-
}) : null;
|
|
1643
|
-
const zodSchemaNames = resolveZodSchemaNames(node, zodResolver, validator);
|
|
1644
1554
|
const calledClientName = contractOp.name;
|
|
1645
1555
|
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsxs)(_kubb_renderer_jsx.File, {
|
|
1646
1556
|
baseName: meta.file.baseName,
|
|
@@ -1663,11 +1573,6 @@ const queryGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
1663
1573
|
}
|
|
1664
1574
|
}),
|
|
1665
1575
|
children: [
|
|
1666
|
-
fileZod && zodSchemaNames.length > 0 && /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
|
|
1667
|
-
name: zodSchemaNames,
|
|
1668
|
-
root: meta.file.path,
|
|
1669
|
-
path: fileZod.path
|
|
1670
|
-
}),
|
|
1671
1576
|
/* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
|
|
1672
1577
|
name: [contractOp.name],
|
|
1673
1578
|
root: meta.file.path,
|
|
@@ -1823,7 +1728,7 @@ const pluginVueQueryName = "plugin-vue-query";
|
|
|
1823
1728
|
/**
|
|
1824
1729
|
* Generates one TanStack Query composable per OpenAPI operation for Vue's
|
|
1825
1730
|
* Composition API. Queries become `useFooQuery` (and optionally
|
|
1826
|
-
* `useFooInfiniteQuery`)
|
|
1731
|
+
* `useFooInfiniteQuery`). Mutations become `useFooMutation`. Each composable
|
|
1827
1732
|
* is fully typed end to end.
|
|
1828
1733
|
*
|
|
1829
1734
|
* @example
|
|
@@ -1848,7 +1753,7 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
|
|
|
1848
1753
|
const { output = {
|
|
1849
1754
|
path: "hooks",
|
|
1850
1755
|
barrel: { type: "named" }
|
|
1851
|
-
}, group, exclude = [], include, override = [],
|
|
1756
|
+
}, group, exclude = [], include, override = [], infinite = false, mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, hooks = false, client, resolver: userResolver, macros: userMacros } = options;
|
|
1852
1757
|
const selectedGenerators = [
|
|
1853
1758
|
queryGenerator,
|
|
1854
1759
|
infiniteQueryGenerator,
|
|
@@ -1858,7 +1763,7 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
|
|
|
1858
1763
|
return {
|
|
1859
1764
|
name: pluginVueQueryName,
|
|
1860
1765
|
options,
|
|
1861
|
-
dependencies: [_kubb_plugin_ts.pluginTsName
|
|
1766
|
+
dependencies: [_kubb_plugin_ts.pluginTsName],
|
|
1862
1767
|
hooks: { "kubb:plugin:setup"(ctx) {
|
|
1863
1768
|
const resolver = userResolver ? {
|
|
1864
1769
|
...resolverVueQuery,
|
|
@@ -1902,7 +1807,6 @@ const pluginVueQuery = (0, _kubb_core.definePlugin)((options) => {
|
|
|
1902
1807
|
...infinite
|
|
1903
1808
|
} : false,
|
|
1904
1809
|
hooks,
|
|
1905
|
-
validator,
|
|
1906
1810
|
group: groupConfig,
|
|
1907
1811
|
exclude,
|
|
1908
1812
|
include,
|