@kubb/plugin-react-query 5.0.0-beta.81 → 5.0.0-beta.84
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 +142 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -16
- package/dist/index.js.map +1 -1
- package/package.json +4 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ast } from "
|
|
2
|
+
import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ast } from "kubb/kit";
|
|
3
3
|
//#region ../../internals/client/src/resolveClient.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
|
|
@@ -170,7 +170,7 @@ type Query = {
|
|
|
170
170
|
* HTTP methods treated as queries. Operations using these methods produce
|
|
171
171
|
* `useQuery`-style hooks.
|
|
172
172
|
*
|
|
173
|
-
* @default ['
|
|
173
|
+
* @default ['GET']
|
|
174
174
|
*/
|
|
175
175
|
methods?: Array<string>;
|
|
176
176
|
/**
|
|
@@ -187,7 +187,7 @@ type Mutation = {
|
|
|
187
187
|
* HTTP methods treated as mutations. Operations using these methods produce
|
|
188
188
|
* `useMutation`-style hooks.
|
|
189
189
|
*
|
|
190
|
-
* @default ['
|
|
190
|
+
* @default ['POST', 'PUT', 'PATCH', 'DELETE']
|
|
191
191
|
*/
|
|
192
192
|
methods?: Array<string>;
|
|
193
193
|
/**
|
|
@@ -383,7 +383,7 @@ declare const pluginReactQueryName = "plugin-react-query";
|
|
|
383
383
|
*
|
|
384
384
|
* @example
|
|
385
385
|
* ```ts
|
|
386
|
-
* import { defineConfig } from 'kubb'
|
|
386
|
+
* import { defineConfig } from 'kubb/config'
|
|
387
387
|
* import { pluginTs } from '@kubb/plugin-ts'
|
|
388
388
|
* import { pluginReactQuery } from '@kubb/plugin-react-query'
|
|
389
389
|
*
|
|
@@ -400,7 +400,7 @@ declare const pluginReactQueryName = "plugin-react-query";
|
|
|
400
400
|
* })
|
|
401
401
|
* ```
|
|
402
402
|
*/
|
|
403
|
-
declare const pluginReactQuery: (options?: Options | undefined) => import("
|
|
403
|
+
declare const pluginReactQuery: (options?: Options | undefined) => import("kubb/kit").Plugin<PluginReactQuery>;
|
|
404
404
|
//#endregion
|
|
405
405
|
export { type PluginReactQuery, pluginReactQuery as default, pluginReactQuery, pluginReactQueryName };
|
|
406
406
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { ast, defineGenerator, definePlugin, defineResolver } from "
|
|
3
|
+
import { ast, defineGenerator, definePlugin, defineResolver } from "kubb/kit";
|
|
4
4
|
import { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral, functionPrinter, pluginTsName } from "@kubb/plugin-ts";
|
|
5
|
-
import { File, Function, Type, jsxRenderer } from "
|
|
6
|
-
import { Fragment, jsx, jsxs } from "
|
|
5
|
+
import { File, Function, Type, jsxRenderer } from "kubb/jsx";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
|
|
7
7
|
import fs from "node:fs";
|
|
8
|
-
import { getNestedAccessor } from "@kubb/ast/utils";
|
|
9
8
|
//#region ../../internals/utils/src/casing.ts
|
|
10
9
|
/**
|
|
11
10
|
* Shared implementation for camelCase and PascalCase conversion.
|
|
@@ -1261,8 +1260,8 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
1261
1260
|
const hasNewParams = nextParam != null || previousParam != null;
|
|
1262
1261
|
const [getNextPageParamExpr, getPreviousPageParamExpr] = (() => {
|
|
1263
1262
|
if (hasNewParams) {
|
|
1264
|
-
const nextAccessor = nextParam ? getNestedAccessor(nextParam, "lastPage") : null;
|
|
1265
|
-
const prevAccessor = previousParam ? getNestedAccessor(previousParam, "firstPage") : null;
|
|
1263
|
+
const nextAccessor = nextParam ? ast.getNestedAccessor(nextParam, "lastPage") : null;
|
|
1264
|
+
const prevAccessor = previousParam ? ast.getNestedAccessor(previousParam, "firstPage") : null;
|
|
1266
1265
|
return [nextAccessor ? `getNextPageParam: (lastPage) => ${nextAccessor}` : null, prevAccessor ? `getPreviousPageParam: (firstPage) => ${prevAccessor}` : null];
|
|
1267
1266
|
}
|
|
1268
1267
|
if (cursorParam) return [`getNextPageParam: (lastPage) => lastPage['${cursorParam}']`, `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`];
|
|
@@ -1621,8 +1620,8 @@ function SuspenseInfiniteQueryOptions({ name, clientName, initialPageParam, curs
|
|
|
1621
1620
|
const hasNewParams = nextParam != null || previousParam != null;
|
|
1622
1621
|
const [getNextPageParamExpr, getPreviousPageParamExpr] = (() => {
|
|
1623
1622
|
if (hasNewParams) {
|
|
1624
|
-
const nextAccessor = nextParam ? getNestedAccessor(nextParam, "lastPage") : null;
|
|
1625
|
-
const prevAccessor = previousParam ? getNestedAccessor(previousParam, "firstPage") : null;
|
|
1623
|
+
const nextAccessor = nextParam ? ast.getNestedAccessor(nextParam, "lastPage") : null;
|
|
1624
|
+
const prevAccessor = previousParam ? ast.getNestedAccessor(previousParam, "firstPage") : null;
|
|
1626
1625
|
return [nextAccessor ? `getNextPageParam: (lastPage) => ${nextAccessor}` : null, prevAccessor ? `getPreviousPageParam: (firstPage) => ${prevAccessor}` : null];
|
|
1627
1626
|
}
|
|
1628
1627
|
if (cursorParam) return [`getNextPageParam: (lastPage) => lastPage['${cursorParam}']`, `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`];
|
|
@@ -2504,8 +2503,8 @@ function capitalize(name) {
|
|
|
2504
2503
|
}
|
|
2505
2504
|
/**
|
|
2506
2505
|
* Default resolver used by `@kubb/plugin-react-query`. Decides the names and
|
|
2507
|
-
* file paths for every generated TanStack Query hook (`
|
|
2508
|
-
* `
|
|
2506
|
+
* file paths for every generated TanStack Query hook (`useFoo`,
|
|
2507
|
+
* `useFooSuspense`, `useFooInfinite`, ...) and its companion helpers
|
|
2509
2508
|
* (`fooQueryKey`, `fooQueryOptions`).
|
|
2510
2509
|
*
|
|
2511
2510
|
* Functions and files use camelCase; hooks get the `use` prefix; suspense and
|
|
@@ -2627,7 +2626,7 @@ const pluginReactQueryName = "plugin-react-query";
|
|
|
2627
2626
|
*
|
|
2628
2627
|
* @example
|
|
2629
2628
|
* ```ts
|
|
2630
|
-
* import { defineConfig } from 'kubb'
|
|
2629
|
+
* import { defineConfig } from 'kubb/config'
|
|
2631
2630
|
* import { pluginTs } from '@kubb/plugin-ts'
|
|
2632
2631
|
* import { pluginReactQuery } from '@kubb/plugin-react-query'
|
|
2633
2632
|
*
|
|
@@ -2683,17 +2682,17 @@ const pluginReactQuery = definePlugin((options) => {
|
|
|
2683
2682
|
queryKey,
|
|
2684
2683
|
query: query === false ? false : {
|
|
2685
2684
|
importPath: "@tanstack/react-query",
|
|
2686
|
-
methods: ["
|
|
2685
|
+
methods: ["GET"],
|
|
2687
2686
|
...query
|
|
2688
2687
|
},
|
|
2689
2688
|
mutationKey,
|
|
2690
2689
|
mutation: mutation === false ? false : {
|
|
2691
2690
|
importPath: "@tanstack/react-query",
|
|
2692
2691
|
methods: [
|
|
2693
|
-
"
|
|
2694
|
-
"
|
|
2695
|
-
"
|
|
2696
|
-
"
|
|
2692
|
+
"POST",
|
|
2693
|
+
"PUT",
|
|
2694
|
+
"PATCH",
|
|
2695
|
+
"DELETE"
|
|
2697
2696
|
],
|
|
2698
2697
|
...mutation
|
|
2699
2698
|
},
|