@kubb/plugin-vue-query 5.9.0-canary.20261029T145027 → 5.9.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 +81 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +81 -42
- package/dist/index.js.map +1 -1
- package/docs/options.md +32 -0
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -508,7 +508,7 @@ var compatibility = {
|
|
|
508
508
|
"node": ">=22.22"
|
|
509
509
|
};
|
|
510
510
|
// package.json
|
|
511
|
-
var version = "5.9.0
|
|
511
|
+
var version = "5.9.0";
|
|
512
512
|
// ../../internals/client/src/resolveOperationTypes.ts
|
|
513
513
|
/**
|
|
514
514
|
* A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`
|
|
@@ -757,8 +757,16 @@ function resolveClientOperation(options) {
|
|
|
757
757
|
* `pluginZod({ inferred: 'codec' })`), banner and footer.
|
|
758
758
|
*/
|
|
759
759
|
function resolveHookFile(node, ctx, options) {
|
|
760
|
-
const { name, output, group, contractOp, keyTypeName, extraTypeNames = [] } = options;
|
|
760
|
+
const { name, output, group, contractOp, keyTypeName, extraTypeNames = [], returnType = "data" } = options;
|
|
761
761
|
const { config, root, resolver } = ctx;
|
|
762
|
+
if (returnType !== "data" && contractOp.returnType === "data") throw new _kubb_kit.Diagnostics.Error({
|
|
763
|
+
code: _kubb_kit.Diagnostics.code.invalidPluginOptions,
|
|
764
|
+
severity: "error",
|
|
765
|
+
message: `Option \`returnType\` is '${returnType}' for ${node.operationId}, but the client plugin has \`returnType: 'data'\` and only returns the response body.`,
|
|
766
|
+
help: "Set the client plugin's `returnType` to 'full', or set the hook plugin's `returnType` to 'data'.",
|
|
767
|
+
location: { kind: "config" },
|
|
768
|
+
plugin: resolver.pluginName
|
|
769
|
+
});
|
|
762
770
|
const types = resolveOperationTypes(ctx.driver, resolver.pluginName);
|
|
763
771
|
const tsResolver = types.resolver;
|
|
764
772
|
const file = resolver.file({
|
|
@@ -777,9 +785,10 @@ function resolveHookFile(node, ctx, options) {
|
|
|
777
785
|
});
|
|
778
786
|
const importedTypeNames = [
|
|
779
787
|
tsResolver.response.options(node),
|
|
788
|
+
tsResolver.response.responses(node),
|
|
780
789
|
...extraTypeNames,
|
|
781
790
|
...resolveOperationTypeNames(node, tsResolver, {
|
|
782
|
-
exclude: keyTypeName ?
|
|
791
|
+
exclude: [keyTypeName, returnType !== "data" ? tsResolver.response.response(node) : null].filter((name) => Boolean(name)),
|
|
783
792
|
order: "body-response-first",
|
|
784
793
|
includeParams: false
|
|
785
794
|
})
|
|
@@ -794,6 +803,7 @@ function resolveHookFile(node, ctx, options) {
|
|
|
794
803
|
tsResolver,
|
|
795
804
|
contractOp,
|
|
796
805
|
importedTypeNames,
|
|
806
|
+
returnType,
|
|
797
807
|
banner: resolver.default.banner(ctx.meta, {
|
|
798
808
|
output,
|
|
799
809
|
config,
|
|
@@ -824,7 +834,11 @@ function HookFile({ hook, imports, children }) {
|
|
|
824
834
|
path: contractOp.path
|
|
825
835
|
}),
|
|
826
836
|
/* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
|
|
827
|
-
name: [
|
|
837
|
+
name: [
|
|
838
|
+
"RequestConfig",
|
|
839
|
+
"ResponseErrorConfig",
|
|
840
|
+
"RequestResult"
|
|
841
|
+
],
|
|
828
842
|
root: contractOp.clientPathIsFile ? file.path : void 0,
|
|
829
843
|
path: contractOp.clientPath,
|
|
830
844
|
isTypeOnly: true
|
|
@@ -964,11 +978,12 @@ function buildClientCall(node, options) {
|
|
|
964
978
|
}
|
|
965
979
|
/**
|
|
966
980
|
* Builds the query/mutation body that resolves a `buildClientCall` expression down to the bare
|
|
967
|
-
* success body. `
|
|
981
|
+
* success body. `clientReturnType` mirrors the registered client plugin's own `returnType` option: with
|
|
968
982
|
* `'data'` the call already resolves to the bare body, so it is returned directly; with `'full'`
|
|
969
983
|
* (the default) the call carries `unwrap()`, so the body calls it instead of destructuring `data`
|
|
970
984
|
* off the full result by hand. With `'plain'` (plugin-client) the call resolves to the user's
|
|
971
|
-
* `RequestResult`, so the body awaits it and reads `data`.
|
|
985
|
+
* `RequestResult`, so the body awaits it and reads `data`. With `returnType` `'full'` the body
|
|
986
|
+
* resolves to the whole `RequestResult`; `resolveHookFile` rejects that for a client that already stripped it.
|
|
972
987
|
*
|
|
973
988
|
* @example
|
|
974
989
|
* ```ts
|
|
@@ -977,22 +992,24 @@ function buildClientCall(node, options) {
|
|
|
977
992
|
* ```
|
|
978
993
|
*/
|
|
979
994
|
function buildCallResultBody(call, options = {}) {
|
|
980
|
-
const {
|
|
981
|
-
if (returnType === "data") return `return
|
|
982
|
-
if (
|
|
995
|
+
const { clientReturnType = "full", returnType = "data" } = options;
|
|
996
|
+
if (returnType !== "data" || clientReturnType === "data") return `return ${call}`;
|
|
997
|
+
if (clientReturnType === "plain") return `return (await ${call}).data`;
|
|
983
998
|
return `return ${call}.unwrap()`;
|
|
984
999
|
}
|
|
985
1000
|
/**
|
|
986
1001
|
* Builds the `TData` / `TError` type expressions shared by every generated hook, joining the resolved
|
|
987
1002
|
* success responses into `TData` and wrapping the error responses in `ResponseErrorConfig<...>`.
|
|
1003
|
+
* With `returnType` `'full'`, `TData` is the client's `RequestResult` over the operation's responses record.
|
|
988
1004
|
*/
|
|
989
|
-
function buildResponseTypes(node, resolver) {
|
|
990
|
-
|
|
1005
|
+
function buildResponseTypes(node, resolver, options = {}) {
|
|
1006
|
+
const { returnType = "data" } = options;
|
|
1007
|
+
return resolver.memo(`responseTypes:${returnType}:${node.method}\0${node.path}`, () => {
|
|
991
1008
|
const successNames = resolveSuccessNames(node, resolver);
|
|
992
1009
|
const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.response.response(node);
|
|
993
1010
|
const errorNames = resolveErrorNames(node, resolver);
|
|
994
1011
|
return {
|
|
995
|
-
TData: responseName,
|
|
1012
|
+
TData: returnType !== "data" ? `RequestResult<${resolver.response.responses(node)}, true>` : responseName,
|
|
996
1013
|
TError: `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`
|
|
997
1014
|
};
|
|
998
1015
|
});
|
|
@@ -1177,8 +1194,9 @@ function resolveMutationRequestType(node, resolver) {
|
|
|
1177
1194
|
// ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
|
|
1178
1195
|
const declarationPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
1179
1196
|
const callPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
1180
|
-
function InfiniteQueryOptions({ name, clientName, initialPageParam, hasExplicitInitialPageParam, cursorParam, nextParam, previousParam, getNextPageParam, getPreviousPageParam, node, tsResolver, queryParam, queryKeyName, queryKeyType = "typeof queryKey", memberTypeWrapper, unwrapName, returnType
|
|
1181
|
-
const { TData: queryFnDataType, TError: errorType } = buildResponseTypes(node, tsResolver);
|
|
1197
|
+
function InfiniteQueryOptions({ name, clientName, initialPageParam, hasExplicitInitialPageParam, cursorParam, nextParam, previousParam, getNextPageParam, getPreviousPageParam, node, tsResolver, queryParam, queryKeyName, queryKeyType = "typeof queryKey", memberTypeWrapper, unwrapName, clientReturnType, returnType }) {
|
|
1198
|
+
const { TData: queryFnDataType, TError: errorType } = buildResponseTypes(node, tsResolver, { returnType });
|
|
1199
|
+
const dataSuffix = returnType === "data" ? "" : ".data";
|
|
1182
1200
|
const { queryParamsTypeName, pageParamType } = resolvePageParamType(node, {
|
|
1183
1201
|
resolver: tsResolver,
|
|
1184
1202
|
initialPageParam,
|
|
@@ -1200,21 +1218,24 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, hasExplicitI
|
|
|
1200
1218
|
clientName,
|
|
1201
1219
|
signal: true,
|
|
1202
1220
|
unwrapName
|
|
1203
|
-
}), {
|
|
1221
|
+
}), {
|
|
1222
|
+
clientReturnType,
|
|
1223
|
+
returnType
|
|
1224
|
+
});
|
|
1204
1225
|
const initialPageParamLiteral = typeof initialPageParam === "string" || typeof initialPageParam === "object" && initialPageParam !== null ? JSON.stringify(initialPageParam) : String(initialPageParam === void 0 ? 0 : initialPageParam);
|
|
1205
1226
|
const serializedGetNextPageParam = typeof getNextPageParam === "function" ? getNextPageParam.toString() : getNextPageParam;
|
|
1206
1227
|
const getNextPageParamExpr = (() => {
|
|
1207
1228
|
if (serializedGetNextPageParam) return `getNextPageParam: ${serializedGetNextPageParam}`;
|
|
1208
|
-
if (nextParam) return `getNextPageParam: (lastPage) => ${getNestedAccessor(nextParam,
|
|
1209
|
-
if (cursorParam) return `getNextPageParam: (lastPage) => lastPage['${cursorParam}']`;
|
|
1210
|
-
return
|
|
1229
|
+
if (nextParam) return `getNextPageParam: (lastPage) => ${getNestedAccessor(nextParam, `lastPage${dataSuffix}`)}`;
|
|
1230
|
+
if (cursorParam) return `getNextPageParam: (lastPage) => lastPage${dataSuffix}['${cursorParam}']`;
|
|
1231
|
+
return `getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage${dataSuffix}) && lastPage${dataSuffix}.length === 0 ? undefined : lastPageParam + 1`;
|
|
1211
1232
|
})();
|
|
1212
1233
|
const serializedGetPreviousPageParam = typeof getPreviousPageParam === "function" ? getPreviousPageParam.toString() : getPreviousPageParam;
|
|
1213
1234
|
const defaultPreviousThreshold = hasExplicitInitialPageParam ? initialPageParamLiteral : "1";
|
|
1214
1235
|
const getPreviousPageParamExpr = (() => {
|
|
1215
1236
|
if (serializedGetPreviousPageParam) return `getPreviousPageParam: ${serializedGetPreviousPageParam}`;
|
|
1216
|
-
if (previousParam) return `getPreviousPageParam: (firstPage) => ${getNestedAccessor(previousParam,
|
|
1217
|
-
if (cursorParam) return `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`;
|
|
1237
|
+
if (previousParam) return `getPreviousPageParam: (firstPage) => ${getNestedAccessor(previousParam, `firstPage${dataSuffix}`)}`;
|
|
1238
|
+
if (cursorParam) return `getPreviousPageParam: (firstPage) => firstPage${dataSuffix}['${cursorParam}']`;
|
|
1218
1239
|
if (serializedGetNextPageParam || nextParam) return null;
|
|
1219
1240
|
return `getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= ${defaultPreviousThreshold} ? undefined : firstPageParam - 1`;
|
|
1220
1241
|
})();
|
|
@@ -1437,8 +1458,8 @@ function getQueryOptionsParams(node, options) {
|
|
|
1437
1458
|
memberTypeWrapper: maybeRefOrGetter
|
|
1438
1459
|
});
|
|
1439
1460
|
}
|
|
1440
|
-
function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, returnType
|
|
1441
|
-
const { TData, TError } = buildResponseTypes(node, tsResolver);
|
|
1461
|
+
function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, clientReturnType, returnType }) {
|
|
1462
|
+
const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType });
|
|
1442
1463
|
const queryKeyParamsNode = buildQueryKeyParams(node, {
|
|
1443
1464
|
resolver: tsResolver,
|
|
1444
1465
|
memberTypeWrapper: maybeRefOrGetter
|
|
@@ -1450,7 +1471,10 @@ function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, return
|
|
|
1450
1471
|
clientName,
|
|
1451
1472
|
signal: true,
|
|
1452
1473
|
unwrapName: (name) => `toValue(${name})`
|
|
1453
|
-
}), {
|
|
1474
|
+
}), {
|
|
1475
|
+
clientReturnType,
|
|
1476
|
+
returnType
|
|
1477
|
+
});
|
|
1454
1478
|
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Source, {
|
|
1455
1479
|
name,
|
|
1456
1480
|
isExportable: true,
|
|
@@ -1474,11 +1498,11 @@ function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, return
|
|
|
1474
1498
|
// src/components/Query.tsx
|
|
1475
1499
|
const declarationPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
1476
1500
|
const callPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
1477
|
-
function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver, infinite }) {
|
|
1478
|
-
const { TData, TError } = buildResponseTypes(node, tsResolver);
|
|
1501
|
+
function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver, infinite, returnType }) {
|
|
1502
|
+
const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType });
|
|
1479
1503
|
const optionsName = infinite ? "UseInfiniteQueryOptions" : "UseQueryOptions";
|
|
1480
1504
|
const hookName = infinite ? "useInfiniteQuery" : "useQuery";
|
|
1481
|
-
const
|
|
1505
|
+
const resultType = `${infinite ? "UseInfiniteQueryReturnType" : "UseQueryReturnType"}<${["TData", TError].join(", ")}> & { queryKey: TQueryKey }`;
|
|
1482
1506
|
const generics = [
|
|
1483
1507
|
infinite ? `TData = InfiniteData<${TData}>` : `TData = ${TData}`,
|
|
1484
1508
|
`TQueryData = ${TData}`,
|
|
@@ -1545,7 +1569,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, t
|
|
|
1545
1569
|
...${queryOptionsName}(${queryOptionsParamsCall}),
|
|
1546
1570
|
...resolvedOptions,
|
|
1547
1571
|
queryKey
|
|
1548
|
-
} as unknown as ${optionsName}<${castGenerics.join(", ")}>, toValue(queryClient)) as ${
|
|
1572
|
+
} as unknown as ${optionsName}<${castGenerics.join(", ")}>, toValue(queryClient)) as ${resultType}
|
|
1549
1573
|
|
|
1550
1574
|
queryResult.queryKey = queryKey as TQueryKey
|
|
1551
1575
|
|
|
@@ -1603,6 +1627,7 @@ const infiniteQueryGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1603
1627
|
output,
|
|
1604
1628
|
group,
|
|
1605
1629
|
contractOp,
|
|
1630
|
+
returnType: ctx.options.returnType,
|
|
1606
1631
|
keyTypeName: queryKeyTypeName,
|
|
1607
1632
|
extraTypeNames: [resolvePageParamType(node, {
|
|
1608
1633
|
resolver: resolveOperationTypes(ctx.driver, ctx.resolver.pluginName).resolver,
|
|
@@ -1655,7 +1680,8 @@ const infiniteQueryGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1655
1680
|
initialPageParam: infiniteOptions.initialPageParam,
|
|
1656
1681
|
hasExplicitInitialPageParam: infiniteOptions.hasExplicitInitialPageParam,
|
|
1657
1682
|
queryParam: infiniteOptions.queryParam,
|
|
1658
|
-
|
|
1683
|
+
clientReturnType: contractOp.returnType,
|
|
1684
|
+
returnType: hook.returnType,
|
|
1659
1685
|
queryKeyType: "QueryKey",
|
|
1660
1686
|
memberTypeWrapper: maybeRefOrGetter,
|
|
1661
1687
|
unwrapName: (name) => `toValue(${name})`
|
|
@@ -1681,7 +1707,8 @@ const infiniteQueryGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1681
1707
|
queryKeyTypeName,
|
|
1682
1708
|
node,
|
|
1683
1709
|
tsResolver,
|
|
1684
|
-
infinite: true
|
|
1710
|
+
infinite: true,
|
|
1711
|
+
returnType: hook.returnType
|
|
1685
1712
|
})
|
|
1686
1713
|
]
|
|
1687
1714
|
});
|
|
@@ -1691,8 +1718,8 @@ const infiniteQueryGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1691
1718
|
const declarationPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
|
|
1692
1719
|
const callPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
|
|
1693
1720
|
function buildMutationParamsNode(node, options) {
|
|
1694
|
-
const { resolver } = options;
|
|
1695
|
-
const { TData, TError } = buildResponseTypes(node, resolver);
|
|
1721
|
+
const { resolver, returnType } = options;
|
|
1722
|
+
const { TData, TError } = buildResponseTypes(node, resolver, { returnType });
|
|
1696
1723
|
return buildHookParams(node, {
|
|
1697
1724
|
resolver,
|
|
1698
1725
|
withRequest: false,
|
|
@@ -1707,8 +1734,8 @@ function buildMutationParamsNode(node, options) {
|
|
|
1707
1734
|
}`
|
|
1708
1735
|
});
|
|
1709
1736
|
}
|
|
1710
|
-
function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnType
|
|
1711
|
-
const { TData, TError } = buildResponseTypes(node, tsResolver);
|
|
1737
|
+
function Mutation({ name, clientName, node, tsResolver, mutationKeyName, clientReturnType, returnType }) {
|
|
1738
|
+
const { TData, TError } = buildResponseTypes(node, tsResolver, { returnType });
|
|
1712
1739
|
const groupedParam = buildGroupedRequestParam(node, {
|
|
1713
1740
|
resolver: tsResolver,
|
|
1714
1741
|
withContentType: true
|
|
@@ -1721,16 +1748,22 @@ function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnT
|
|
|
1721
1748
|
clientName,
|
|
1722
1749
|
signal: false,
|
|
1723
1750
|
withContentType: true,
|
|
1724
|
-
returnType,
|
|
1751
|
+
returnType: clientReturnType,
|
|
1725
1752
|
unwrapName: (name) => `toValue<${TRequest}['${name}']>(${name})`
|
|
1726
|
-
}), {
|
|
1753
|
+
}), {
|
|
1754
|
+
clientReturnType,
|
|
1755
|
+
returnType
|
|
1756
|
+
});
|
|
1727
1757
|
const generics = [
|
|
1728
1758
|
TData,
|
|
1729
1759
|
TError,
|
|
1730
1760
|
TRequest,
|
|
1731
1761
|
"TContext"
|
|
1732
1762
|
].join(", ");
|
|
1733
|
-
const paramsNode = buildMutationParamsNode(node, {
|
|
1763
|
+
const paramsNode = buildMutationParamsNode(node, {
|
|
1764
|
+
resolver: tsResolver,
|
|
1765
|
+
returnType
|
|
1766
|
+
});
|
|
1734
1767
|
const paramsSignature = declarationPrinter.print(paramsNode) ?? "";
|
|
1735
1768
|
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Source, {
|
|
1736
1769
|
name,
|
|
@@ -1792,7 +1825,8 @@ const mutationGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1792
1825
|
name: mutationHookName,
|
|
1793
1826
|
output,
|
|
1794
1827
|
group,
|
|
1795
|
-
contractOp
|
|
1828
|
+
contractOp,
|
|
1829
|
+
returnType: ctx.options.returnType
|
|
1796
1830
|
});
|
|
1797
1831
|
const groups = getRequestGroups(node);
|
|
1798
1832
|
const hasRequestGroups = groups.path || groups.query || groups.body || groups.headers;
|
|
@@ -1826,7 +1860,8 @@ const mutationGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1826
1860
|
node,
|
|
1827
1861
|
tsResolver: hook.tsResolver,
|
|
1828
1862
|
mutationKeyName,
|
|
1829
|
-
|
|
1863
|
+
clientReturnType: contractOp.returnType,
|
|
1864
|
+
returnType: hook.returnType
|
|
1830
1865
|
})
|
|
1831
1866
|
] })]
|
|
1832
1867
|
});
|
|
@@ -1869,7 +1904,8 @@ const queryGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1869
1904
|
output,
|
|
1870
1905
|
group,
|
|
1871
1906
|
contractOp,
|
|
1872
|
-
keyTypeName: queryKeyTypeName
|
|
1907
|
+
keyTypeName: queryKeyTypeName,
|
|
1908
|
+
returnType: ctx.options.returnType
|
|
1873
1909
|
});
|
|
1874
1910
|
const { tsResolver } = hook;
|
|
1875
1911
|
return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsxs)(HookFile, {
|
|
@@ -1903,7 +1939,8 @@ const queryGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1903
1939
|
queryKeyName,
|
|
1904
1940
|
node,
|
|
1905
1941
|
tsResolver,
|
|
1906
|
-
|
|
1942
|
+
clientReturnType: contractOp.returnType,
|
|
1943
|
+
returnType: hook.returnType
|
|
1907
1944
|
}),
|
|
1908
1945
|
query && hooks && /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsxs)(_kubb_renderer_jsx_jsx_runtime.Fragment, { children: [
|
|
1909
1946
|
/* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Import, {
|
|
@@ -1926,7 +1963,8 @@ const queryGenerator = (0, _kubb_kit.defineGenerator)({
|
|
|
1926
1963
|
queryKeyName,
|
|
1927
1964
|
queryKeyTypeName,
|
|
1928
1965
|
node,
|
|
1929
|
-
tsResolver
|
|
1966
|
+
tsResolver,
|
|
1967
|
+
returnType: hook.returnType
|
|
1930
1968
|
})
|
|
1931
1969
|
] })
|
|
1932
1970
|
]
|
|
@@ -2001,7 +2039,7 @@ const pluginVueQuery = (0, _kubb_kit.defineExtension)({
|
|
|
2001
2039
|
const { output = {
|
|
2002
2040
|
path: "hooks",
|
|
2003
2041
|
barrel: { type: "named" }
|
|
2004
|
-
}, group, exclude = [], include, override = [], infinite = false, mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, hooks = false, client, resolver: userResolver, macros: userMacros } = options;
|
|
2042
|
+
}, group, exclude = [], include, override = [], infinite = false, mutation = {}, query = {}, mutationKey = mutationKeyTransformer, queryKey = queryKeyTransformer, hooks = false, client, returnType = "data", resolver: userResolver, macros: userMacros } = options;
|
|
2005
2043
|
const resolver = userResolver ? _kubb_kit.Resolver.merge(resolverVueQuery, userResolver) : resolverVueQuery;
|
|
2006
2044
|
(0, _kubb_kit.setResolver)(resolver);
|
|
2007
2045
|
if (userMacros?.length) (0, _kubb_kit.setMacros)(userMacros);
|
|
@@ -2013,6 +2051,7 @@ const pluginVueQuery = (0, _kubb_kit.defineExtension)({
|
|
|
2013
2051
|
client,
|
|
2014
2052
|
plugins: (0, _kubb_kit.useConfig)().plugins
|
|
2015
2053
|
}),
|
|
2054
|
+
returnType,
|
|
2016
2055
|
queryKey,
|
|
2017
2056
|
query: resolveQueryConfig(query, { importPath: "@tanstack/vue-query" }),
|
|
2018
2057
|
mutationKey,
|