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

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
@@ -21,16 +21,94 @@ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactory
21
21
  * client plugin.
22
22
  */
23
23
  type ClientSelector = 'fetch' | 'axios';
24
- //#endregion
25
- //#region src/types.d.ts
26
24
  /**
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.
25
+ * The resolved client strategy stored in a consumer plugin's options: the generated code always
26
+ * imports and calls a registered contract client plugin's `<op>`. The client runtime lives in
27
+ * plugin-axios / plugin-fetch, so nothing is bundled by the consumer.
29
28
  */
29
+ type ResolvedContractClient = {
30
+ kind: 'contract';
31
+ pluginName: string;
32
+ };
33
+ //#endregion
34
+ //#region ../../internals/tanstack-query/src/types.d.ts
35
+ type ParamsCasing = 'camelcase' | undefined;
30
36
  type Transformer = (props: {
31
37
  node: ast.OperationNode;
32
- casing: 'camelcase' | undefined;
38
+ casing: ParamsCasing;
33
39
  }) => Array<unknown>;
40
+ /**
41
+ * Configures the query side of a TanStack-family plugin: which HTTP methods produce query
42
+ * hooks and where the query runtime is imported from.
43
+ */
44
+ type Query = {
45
+ /**
46
+ * HTTP methods treated as queries. Operations using these methods produce
47
+ * `useQuery`-style hooks.
48
+ *
49
+ * @default ['GET']
50
+ */
51
+ methods?: Array<string>;
52
+ /**
53
+ * Module specifier used in the `import { useQuery } from '...'` statement at
54
+ * the top of every generated file. Each plugin defaults this to its own runtime
55
+ * package. Useful for routing through a wrapper that injects a default
56
+ * `queryClient`.
57
+ */
58
+ importPath?: string;
59
+ };
60
+ /**
61
+ * Configures the mutation side of a TanStack-family plugin: which HTTP methods produce
62
+ * mutation hooks and where the mutation runtime is imported from.
63
+ */
64
+ type Mutation = {
65
+ /**
66
+ * HTTP methods treated as mutations. Operations using these methods produce
67
+ * `useMutation`-style hooks.
68
+ *
69
+ * @default ['POST', 'PUT', 'PATCH', 'DELETE']
70
+ */
71
+ methods?: Array<string>;
72
+ /**
73
+ * Module specifier used in the `import { useMutation } from '...'` statement
74
+ * at the top of every generated file. Each plugin defaults this to its own
75
+ * runtime package.
76
+ */
77
+ importPath?: string;
78
+ };
79
+ type Infinite = {
80
+ /**
81
+ * Name of the query parameter that holds the page cursor.
82
+ *
83
+ * @default 'id'
84
+ */
85
+ queryParam?: string;
86
+ /**
87
+ * Path to the cursor field on the response. Leave undefined when the cursor
88
+ * is not known.
89
+ *
90
+ * @deprecated Use `nextParam` and `previousParam` for richer pagination control.
91
+ */
92
+ cursorParam?: string | null;
93
+ /**
94
+ * Path to the next-page cursor on the response. Supports dot notation
95
+ * (`'pagination.next.id'`) or array form (`['pagination', 'next', 'id']`).
96
+ */
97
+ nextParam?: string | Array<string> | null;
98
+ /**
99
+ * Path to the previous-page cursor on the response. Supports dot notation
100
+ * or array form.
101
+ */
102
+ previousParam?: string | Array<string> | null;
103
+ /**
104
+ * Initial value for `pageParam` on the first fetch.
105
+ *
106
+ * @default 0
107
+ */
108
+ initialPageParam?: unknown;
109
+ };
110
+ //#endregion
111
+ //#region src/types.d.ts
34
112
  /**
35
113
  * Resolver for Vue Query that provides naming methods for hook functions.
36
114
  */
@@ -119,67 +197,6 @@ type QueryKey = Transformer;
119
197
  * strings in `JSON.stringify(...)`.
120
198
  */
121
199
  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
200
  /**
184
201
  * Where the generated composables are written and how they are exported, plus the optional
185
202
  * `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
@@ -254,10 +271,7 @@ type Options = OutputOptions & {
254
271
  * The resolved client strategy for the generated composables, computed once during setup. The
255
272
  * composables always import and call a registered contract client plugin's `<op>`.
256
273
  */
257
- type ResolvedClient = {
258
- kind: 'contract';
259
- pluginName: string;
260
- };
274
+ type ResolvedClient = ResolvedContractClient;
261
275
  type ResolvedOptions = {
262
276
  output: Output;
263
277
  group: Group | null;
@@ -320,5 +334,26 @@ declare const pluginVueQueryName = "plugin-vue-query";
320
334
  */
321
335
  declare const pluginVueQuery: (options?: Options | undefined) => import("kubb/kit").Plugin<PluginVueQuery>;
322
336
  //#endregion
323
- export { type PluginVueQuery, pluginVueQuery as default, pluginVueQuery, pluginVueQueryName };
337
+ //#region src/resolvers/resolverVueQuery.d.ts
338
+ /**
339
+ * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
340
+ * file paths for every generated TanStack Query composable (`useFoo`,
341
+ * `useFooInfinite`) and its companion helpers.
342
+ *
343
+ * The `default` helpers are supplied by `createResolver`. Functions and files use camelCase;
344
+ * composables get the `use` prefix. Operation-specific naming is grouped under the `query`,
345
+ * `infiniteQuery`, and `mutation` namespaces.
346
+ *
347
+ * @example Resolve composable and helper names
348
+ * ```ts
349
+ * import { resolverVueQuery } from '@kubb/plugin-vue-query'
350
+ *
351
+ * resolverVueQuery.query.name(operationNode) // 'useGetPetById'
352
+ * resolverVueQuery.query.keyName(operationNode) // 'getPetByIdQueryKey'
353
+ * resolverVueQuery.query.optionsName(operationNode) // 'getPetByIdQueryOptions'
354
+ * ```
355
+ */
356
+ declare const resolverVueQuery: ResolverVueQuery;
357
+ //#endregion
358
+ export { type PluginVueQuery, type ResolverVueQuery, pluginVueQuery as default, pluginVueQuery, pluginVueQueryName, resolverVueQuery };
324
359
  //# sourceMappingURL=index.d.ts.map