@kubb/plugin-vue-query 5.0.0 → 5.0.2

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 CHANGED
@@ -565,6 +565,16 @@ function resolveInfiniteConfig(infinite) {
565
565
  ...infinite
566
566
  };
567
567
  }
568
+ /**
569
+ * The request groups a query key is built from, matching `buildQueryKeyParams`. Headers are
570
+ * deliberately absent: they do not identify a cache entry, so the key factory takes no parameter
571
+ * for an operation that only carries headers.
572
+ */
573
+ const queryKeyGroupOrder = [
574
+ "path",
575
+ "query",
576
+ "body"
577
+ ];
568
578
  //#endregion
569
579
  //#region ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
570
580
  const declarationPrinter$7 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
@@ -578,11 +588,7 @@ function InfiniteQueryOptions$1({ name, clientName, initialPageParam, cursorPara
578
588
  });
579
589
  const groupedKeyParam = buildGroupedRequestParam(node, {
580
590
  resolver: tsResolver,
581
- keys: [
582
- "path",
583
- "query",
584
- "body"
585
- ],
591
+ keys: queryKeyGroupOrder,
586
592
  memberTypeWrapper
587
593
  });
588
594
  const queryKeyParamsNode = (0, _kubb_plugin_ts.createFunctionParameters)({ params: groupedKeyParam ? [groupedKeyParam] : [] });
@@ -592,12 +598,11 @@ function InfiniteQueryOptions$1({ name, clientName, initialPageParam, cursorPara
592
598
  memberTypeWrapper
593
599
  });
594
600
  const paramsSignature = declarationPrinter$7.print(paramsNode) ?? "";
595
- const queryFnBody = `const { data } = await ${buildClientCall(node, {
601
+ const queryFnBody = `return ${buildClientCall(node, {
596
602
  clientName,
597
603
  signal: true,
598
604
  unwrapName
599
- })}
600
- return data`;
605
+ })}.unwrap()`;
601
606
  const hasNewParams = nextParam != null || previousParam != null;
602
607
  const [getNextPageParamExpr, getPreviousPageParamExpr] = (() => {
603
608
  if (hasNewParams) {
@@ -868,11 +873,7 @@ const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "decla
868
873
  function buildQueryKeyParamsNode(node, options) {
869
874
  const groupedParam = buildGroupedRequestParam(node, {
870
875
  resolver: options.resolver,
871
- keys: [
872
- "path",
873
- "query",
874
- "body"
875
- ],
876
+ keys: queryKeyGroupOrder,
876
877
  memberTypeWrapper: maybeRefOrGetter
877
878
  });
878
879
  return (0, _kubb_plugin_ts.createFunctionParameters)({ params: groupedParam ? [groupedParam] : [] });
@@ -923,11 +924,10 @@ function QueryOptions({ name, clientName, node, tsResolver, queryKeyName }) {
923
924
  const queryKeyParamsCall = callPrinter$3.print(queryKeyParamsNode) ?? "";
924
925
  const paramsNode = getQueryOptionsParams(node, { resolver: tsResolver });
925
926
  const paramsSignature = declarationPrinter$3.print(paramsNode) ?? "";
926
- const queryFnBody = `const { data } = await ${buildVueClientCall(node, {
927
+ const queryFnBody = `return ${buildVueClientCall(node, {
927
928
  clientName,
928
929
  signal: true
929
- })}
930
- return data`;
930
+ })}.unwrap()`;
931
931
  return /* @__PURE__ */ (0, kubb_jsx_jsx_runtime.jsx)(kubb_jsx.File.Source, {
932
932
  name,
933
933
  isExportable: true,
@@ -1063,11 +1063,10 @@ function Mutation({ name, clientName, node, tsResolver, mutationKeyName }) {
1063
1063
  const hasMutationParams = groupedParam !== null;
1064
1064
  const groupedParamsNode = (0, _kubb_plugin_ts.createFunctionParameters)({ params: groupedParam ? [groupedParam] : [] });
1065
1065
  const argBindingStr = hasMutationParams ? callPrinter$1.print(groupedParamsNode) ?? "" : "";
1066
- const mutationFnBody = `const { data } = await ${buildVueClientCall(node, {
1066
+ const mutationFnBody = `return ${buildVueClientCall(node, {
1067
1067
  clientName,
1068
1068
  signal: false
1069
- })}
1070
- return data`;
1069
+ })}.unwrap()`;
1071
1070
  const generics = [
1072
1071
  TData,
1073
1072
  TError,