@kubb/plugin-vue-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 +82 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -7
- 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
|
|
@@ -114,7 +114,7 @@ type Query = {
|
|
|
114
114
|
/**
|
|
115
115
|
* HTTP methods treated as queries.
|
|
116
116
|
*
|
|
117
|
-
* @default ['
|
|
117
|
+
* @default ['GET']
|
|
118
118
|
*/
|
|
119
119
|
methods?: Array<string>;
|
|
120
120
|
/**
|
|
@@ -129,7 +129,7 @@ type Mutation = {
|
|
|
129
129
|
/**
|
|
130
130
|
* HTTP methods treated as mutations.
|
|
131
131
|
*
|
|
132
|
-
* @default ['
|
|
132
|
+
* @default ['POST', 'PUT', 'PATCH', 'DELETE']
|
|
133
133
|
*/
|
|
134
134
|
methods?: Array<string>;
|
|
135
135
|
/**
|
|
@@ -287,13 +287,13 @@ declare global {
|
|
|
287
287
|
declare const pluginVueQueryName = "plugin-vue-query";
|
|
288
288
|
/**
|
|
289
289
|
* Generates one TanStack Query composable per OpenAPI operation for Vue's
|
|
290
|
-
* Composition API. Queries become `
|
|
291
|
-
* `
|
|
290
|
+
* Composition API. Queries become `useFoo` (and optionally
|
|
291
|
+
* `useFooInfinite`). Mutations become `useFoo` as well. Each composable
|
|
292
292
|
* is fully typed end to end.
|
|
293
293
|
*
|
|
294
294
|
* @example
|
|
295
295
|
* ```ts
|
|
296
|
-
* import { defineConfig } from 'kubb'
|
|
296
|
+
* import { defineConfig } from 'kubb/config'
|
|
297
297
|
* import { pluginTs } from '@kubb/plugin-ts'
|
|
298
298
|
* import { pluginVueQuery } from '@kubb/plugin-vue-query'
|
|
299
299
|
*
|
|
@@ -309,7 +309,7 @@ declare const pluginVueQueryName = "plugin-vue-query";
|
|
|
309
309
|
* })
|
|
310
310
|
* ```
|
|
311
311
|
*/
|
|
312
|
-
declare const pluginVueQuery: (options?: Options | undefined) => import("
|
|
312
|
+
declare const pluginVueQuery: (options?: Options | undefined) => import("kubb/kit").Plugin<PluginVueQuery>;
|
|
313
313
|
//#endregion
|
|
314
314
|
export { type PluginVueQuery, pluginVueQuery as default, pluginVueQuery, pluginVueQueryName };
|
|
315
315
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
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 "
|
|
7
|
-
import { getNestedAccessor } from "@kubb/ast/utils";
|
|
5
|
+
import { File, Function, Type, jsxRenderer } from "kubb/jsx";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
|
|
8
7
|
//#region ../../internals/utils/src/casing.ts
|
|
9
8
|
/**
|
|
10
9
|
* Shared implementation for camelCase and PascalCase conversion.
|
|
@@ -969,8 +968,8 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
|
|
|
969
968
|
const hasNewParams = nextParam != null || previousParam != null;
|
|
970
969
|
const [getNextPageParamExpr, getPreviousPageParamExpr] = (() => {
|
|
971
970
|
if (hasNewParams) {
|
|
972
|
-
const nextAccessor = nextParam ? getNestedAccessor(nextParam, "lastPage") : null;
|
|
973
|
-
const prevAccessor = previousParam ? getNestedAccessor(previousParam, "firstPage") : null;
|
|
971
|
+
const nextAccessor = nextParam ? ast.getNestedAccessor(nextParam, "lastPage") : null;
|
|
972
|
+
const prevAccessor = previousParam ? ast.getNestedAccessor(previousParam, "firstPage") : null;
|
|
974
973
|
return [nextAccessor ? `getNextPageParam: (lastPage) => ${nextAccessor}` : null, prevAccessor ? `getPreviousPageParam: (firstPage) => ${prevAccessor}` : null];
|
|
975
974
|
}
|
|
976
975
|
if (cursorParam) return [`getNextPageParam: (lastPage) => lastPage['${cursorParam}']`, `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`];
|
|
@@ -1626,8 +1625,8 @@ function capitalize(name) {
|
|
|
1626
1625
|
}
|
|
1627
1626
|
/**
|
|
1628
1627
|
* Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
|
|
1629
|
-
* file paths for every generated TanStack Query composable (`
|
|
1630
|
-
* `
|
|
1628
|
+
* file paths for every generated TanStack Query composable (`useFoo`,
|
|
1629
|
+
* `useFooInfinite`) and its companion helpers.
|
|
1631
1630
|
*
|
|
1632
1631
|
* Functions and files use camelCase; composables get the `use` prefix.
|
|
1633
1632
|
*
|
|
@@ -1701,13 +1700,13 @@ const resolverVueQuery = defineResolver(() => ({
|
|
|
1701
1700
|
const pluginVueQueryName = "plugin-vue-query";
|
|
1702
1701
|
/**
|
|
1703
1702
|
* Generates one TanStack Query composable per OpenAPI operation for Vue's
|
|
1704
|
-
* Composition API. Queries become `
|
|
1705
|
-
* `
|
|
1703
|
+
* Composition API. Queries become `useFoo` (and optionally
|
|
1704
|
+
* `useFooInfinite`). Mutations become `useFoo` as well. Each composable
|
|
1706
1705
|
* is fully typed end to end.
|
|
1707
1706
|
*
|
|
1708
1707
|
* @example
|
|
1709
1708
|
* ```ts
|
|
1710
|
-
* import { defineConfig } from 'kubb'
|
|
1709
|
+
* import { defineConfig } from 'kubb/config'
|
|
1711
1710
|
* import { pluginTs } from '@kubb/plugin-ts'
|
|
1712
1711
|
* import { pluginVueQuery } from '@kubb/plugin-vue-query'
|
|
1713
1712
|
*
|
|
@@ -1758,17 +1757,17 @@ const pluginVueQuery = definePlugin((options) => {
|
|
|
1758
1757
|
queryKey,
|
|
1759
1758
|
query: query === false ? false : {
|
|
1760
1759
|
importPath: "@tanstack/vue-query",
|
|
1761
|
-
methods: ["
|
|
1760
|
+
methods: ["GET"],
|
|
1762
1761
|
...query
|
|
1763
1762
|
},
|
|
1764
1763
|
mutationKey,
|
|
1765
1764
|
mutation: mutation === false ? false : {
|
|
1766
1765
|
importPath: "@tanstack/vue-query",
|
|
1767
1766
|
methods: [
|
|
1768
|
-
"
|
|
1769
|
-
"
|
|
1770
|
-
"
|
|
1771
|
-
"
|
|
1767
|
+
"POST",
|
|
1768
|
+
"PUT",
|
|
1769
|
+
"PATCH",
|
|
1770
|
+
"DELETE"
|
|
1772
1771
|
],
|
|
1773
1772
|
...mutation
|
|
1774
1773
|
},
|