@kubb/plugin-vue-query 5.0.0-beta.94 → 5.0.0-beta.98

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.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
2
  import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ResolverPatch, ast } from "kubb/kit";
3
+ import "@kubb/plugin-ts";
4
+ import "kubb/jsx";
5
+ import "@kubb/plugin-zod";
3
6
  //#region ../../internals/client/src/resolveClient.d.ts
4
7
  /**
5
8
  * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
@@ -21,16 +24,94 @@ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactory
21
24
  * client plugin.
22
25
  */
23
26
  type ClientSelector = 'fetch' | 'axios';
24
- //#endregion
25
- //#region src/types.d.ts
26
27
  /**
27
- * Builds the parts of a query or mutation key for one operation. Receives the operation node and
28
- * the resolved `paramsCasing` setting and returns the key elements in order.
28
+ * The resolved client strategy stored in a consumer plugin's options: the generated code always
29
+ * imports and calls a registered contract client plugin's `<op>`. The client runtime lives in
30
+ * plugin-axios / plugin-fetch, so nothing is bundled by the consumer.
29
31
  */
32
+ type ResolvedContractClient = {
33
+ kind: 'contract';
34
+ pluginName: string;
35
+ };
36
+ //#endregion
37
+ //#region ../../internals/tanstack-query/src/types.d.ts
38
+ type ParamsCasing = 'camelcase' | undefined;
30
39
  type Transformer = (props: {
31
40
  node: ast.OperationNode;
32
- casing: 'camelcase' | undefined;
41
+ casing: ParamsCasing;
33
42
  }) => Array<unknown>;
43
+ /**
44
+ * Configures the query side of a TanStack-family plugin: which HTTP methods produce query
45
+ * hooks and where the query runtime is imported from.
46
+ */
47
+ type Query = {
48
+ /**
49
+ * HTTP methods treated as queries. Operations using these methods produce
50
+ * `useQuery`-style hooks.
51
+ *
52
+ * @default ['GET']
53
+ */
54
+ methods?: Array<string>;
55
+ /**
56
+ * Module specifier used in the `import { useQuery } from '...'` statement at
57
+ * the top of every generated file. Each plugin defaults this to its own runtime
58
+ * package. Useful for routing through a wrapper that injects a default
59
+ * `queryClient`.
60
+ */
61
+ importPath?: string;
62
+ };
63
+ /**
64
+ * Configures the mutation side of a TanStack-family plugin: which HTTP methods produce
65
+ * mutation hooks and where the mutation runtime is imported from.
66
+ */
67
+ type Mutation = {
68
+ /**
69
+ * HTTP methods treated as mutations. Operations using these methods produce
70
+ * `useMutation`-style hooks.
71
+ *
72
+ * @default ['POST', 'PUT', 'PATCH', 'DELETE']
73
+ */
74
+ methods?: Array<string>;
75
+ /**
76
+ * Module specifier used in the `import { useMutation } from '...'` statement
77
+ * at the top of every generated file. Each plugin defaults this to its own
78
+ * runtime package.
79
+ */
80
+ importPath?: string;
81
+ };
82
+ type Infinite = {
83
+ /**
84
+ * Name of the query parameter that holds the page cursor.
85
+ *
86
+ * @default 'id'
87
+ */
88
+ queryParam?: string;
89
+ /**
90
+ * Path to the cursor field on the response. Leave undefined when the cursor
91
+ * is not known.
92
+ *
93
+ * @deprecated Use `nextParam` and `previousParam` for richer pagination control.
94
+ */
95
+ cursorParam?: string | null;
96
+ /**
97
+ * Path to the next-page cursor on the response. Supports dot notation
98
+ * (`'pagination.next.id'`) or array form (`['pagination', 'next', 'id']`).
99
+ */
100
+ nextParam?: string | Array<string> | null;
101
+ /**
102
+ * Path to the previous-page cursor on the response. Supports dot notation
103
+ * or array form.
104
+ */
105
+ previousParam?: string | Array<string> | null;
106
+ /**
107
+ * Initial value for `pageParam` on the first fetch.
108
+ *
109
+ * @default 0
110
+ */
111
+ initialPageParam?: unknown;
112
+ };
113
+ //#endregion
114
+ //#region src/types.d.ts
34
115
  /**
35
116
  * Resolver for Vue Query that provides naming methods for hook functions.
36
117
  */
@@ -119,67 +200,6 @@ type QueryKey = Transformer;
119
200
  * strings in `JSON.stringify(...)`.
120
201
  */
121
202
  type MutationKey = Transformer;
122
- type Query = {
123
- /**
124
- * HTTP methods treated as queries.
125
- *
126
- * @default ['GET']
127
- */
128
- methods?: Array<string>;
129
- /**
130
- * Module specifier used in the `import { useQuery } from '...'` statement at
131
- * the top of every generated composable file.
132
- *
133
- * @default '@tanstack/vue-query'
134
- */
135
- importPath?: string;
136
- };
137
- type Mutation = {
138
- /**
139
- * HTTP methods treated as mutations.
140
- *
141
- * @default ['POST', 'PUT', 'PATCH', 'DELETE']
142
- */
143
- methods?: Array<string>;
144
- /**
145
- * Module specifier used in the `import { useMutation } from '...'` statement
146
- * at the top of every generated composable file.
147
- *
148
- * @default '@tanstack/vue-query'
149
- */
150
- importPath?: string;
151
- };
152
- type Infinite = {
153
- /**
154
- * Name of the query parameter that holds the page cursor.
155
- *
156
- * @default 'id'
157
- */
158
- queryParam?: string;
159
- /**
160
- * Path to the cursor field on the response. Leave undefined when the cursor
161
- * is not known.
162
- *
163
- * @deprecated Use `nextParam` and `previousParam` for richer pagination control.
164
- */
165
- cursorParam?: string | null;
166
- /**
167
- * Path to the next-page cursor on the response. Supports dot notation
168
- * (`'pagination.next.id'`) or array form.
169
- */
170
- nextParam?: string | Array<string> | null;
171
- /**
172
- * Path to the previous-page cursor on the response. Supports dot notation
173
- * or array form.
174
- */
175
- previousParam?: string | Array<string> | null;
176
- /**
177
- * Initial value for `pageParam` on the first fetch.
178
- *
179
- * @default 0
180
- */
181
- initialPageParam?: unknown;
182
- };
183
203
  /**
184
204
  * Where the generated composables are written and how they are exported, plus the optional
185
205
  * `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
@@ -254,10 +274,7 @@ type Options = OutputOptions & {
254
274
  * The resolved client strategy for the generated composables, computed once during setup. The
255
275
  * composables always import and call a registered contract client plugin's `<op>`.
256
276
  */
257
- type ResolvedClient = {
258
- kind: 'contract';
259
- pluginName: string;
260
- };
277
+ type ResolvedClient = ResolvedContractClient;
261
278
  type ResolvedOptions = {
262
279
  output: Output;
263
280
  group: Group | null;
@@ -320,5 +337,26 @@ declare const pluginVueQueryName = "plugin-vue-query";
320
337
  */
321
338
  declare const pluginVueQuery: (options?: Options | undefined) => import("kubb/kit").Plugin<PluginVueQuery>;
322
339
  //#endregion
323
- export { type PluginVueQuery, pluginVueQuery as default, pluginVueQuery, pluginVueQueryName };
340
+ //#region src/resolvers/resolverVueQuery.d.ts
341
+ /**
342
+ * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
343
+ * file paths for every generated TanStack Query composable (`useFoo`,
344
+ * `useFooInfinite`) and its companion helpers.
345
+ *
346
+ * The `default` helpers are supplied by `createResolver`. Functions and files use camelCase;
347
+ * composables get the `use` prefix. Operation-specific naming is grouped under the `query`,
348
+ * `infiniteQuery`, and `mutation` namespaces.
349
+ *
350
+ * @example Resolve composable and helper names
351
+ * ```ts
352
+ * import { resolverVueQuery } from '@kubb/plugin-vue-query'
353
+ *
354
+ * resolverVueQuery.query.name(operationNode) // 'useGetPetById'
355
+ * resolverVueQuery.query.keyName(operationNode) // 'getPetByIdQueryKey'
356
+ * resolverVueQuery.query.optionsName(operationNode) // 'getPetByIdQueryOptions'
357
+ * ```
358
+ */
359
+ declare const resolverVueQuery: ResolverVueQuery;
360
+ //#endregion
361
+ export { type PluginVueQuery, type ResolverVueQuery, pluginVueQuery as default, pluginVueQuery, pluginVueQueryName, resolverVueQuery };
324
362
  //# sourceMappingURL=index.d.ts.map