@kubb/plugin-vue-query 5.0.0-beta.15 → 5.0.0-beta.25

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.
Files changed (38) hide show
  1. package/dist/{components-1cEftHJm.cjs → components-CeZrYaZj.cjs} +44 -53
  2. package/dist/components-CeZrYaZj.cjs.map +1 -0
  3. package/dist/{components-DTSvTMEo.js → components-CpTXuQiK.js} +44 -53
  4. package/dist/components-CpTXuQiK.js.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.ts +3 -3
  7. package/dist/components.js +1 -1
  8. package/dist/{generators-BEiWCS-U.cjs → generators-BSMwPpbh.cjs} +55 -39
  9. package/dist/generators-BSMwPpbh.cjs.map +1 -0
  10. package/dist/{generators-F6_EduRU.js → generators-Cb5_nhMY.js} +55 -39
  11. package/dist/generators-Cb5_nhMY.js.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +17 -1
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +47 -8
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +29 -1
  18. package/dist/index.js +47 -8
  19. package/dist/index.js.map +1 -1
  20. package/dist/{types-Bkm7bWT3.d.ts → types-D-LjzI_Q.d.ts} +73 -46
  21. package/extension.yaml +779 -255
  22. package/package.json +7 -7
  23. package/src/components/InfiniteQuery.tsx +1 -1
  24. package/src/components/InfiniteQueryOptions.tsx +21 -31
  25. package/src/components/Mutation.tsx +2 -2
  26. package/src/components/Query.tsx +1 -1
  27. package/src/components/QueryKey.tsx +3 -3
  28. package/src/components/QueryOptions.tsx +1 -1
  29. package/src/generators/infiniteQueryGenerator.tsx +22 -13
  30. package/src/generators/mutationGenerator.tsx +20 -12
  31. package/src/generators/queryGenerator.tsx +20 -12
  32. package/src/plugin.ts +32 -4
  33. package/src/resolvers/resolverVueQuery.ts +13 -2
  34. package/src/types.ts +72 -45
  35. package/dist/components-1cEftHJm.cjs.map +0 -1
  36. package/dist/components-DTSvTMEo.js.map +0 -1
  37. package/dist/generators-BEiWCS-U.cjs.map +0 -1
  38. package/dist/generators-F6_EduRU.js.map +0 -1
@@ -6,7 +6,7 @@ import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
6
6
  type Transformer = (props: {
7
7
  node: ast.OperationNode;
8
8
  casing: 'camelcase' | undefined;
9
- }) => unknown[];
9
+ }) => Array<unknown>;
10
10
  /**
11
11
  * Resolver for Vue Query that provides naming methods for hook functions.
12
12
  */
@@ -73,145 +73,172 @@ type ResolverVueQuery = Resolver & {
73
73
  resolveInfiniteClientName(this: ResolverVueQuery, node: ast.OperationNode): string;
74
74
  };
75
75
  /**
76
- * Customize the queryKey.
76
+ * Builds the `queryKey` used by each generated query composable.
77
+ *
78
+ * @note String values are inlined verbatim into generated code. Wrap literal
79
+ * strings in `JSON.stringify(...)`.
77
80
  */
78
81
  type QueryKey = Transformer;
79
82
  /**
80
- * Customize the mutationKey.
83
+ * Builds the `mutationKey` used by each generated mutation composable.
84
+ *
85
+ * @note String values are inlined verbatim into generated code. Wrap literal
86
+ * strings in `JSON.stringify(...)`.
81
87
  */
82
88
  type MutationKey = Transformer;
83
89
  type Query = {
84
90
  /**
85
- * HTTP methods to use for queries.
91
+ * HTTP methods treated as queries.
86
92
  *
87
93
  * @default ['get']
88
94
  */
89
95
  methods?: Array<string>;
90
96
  /**
91
- * Path to the useQuery hook for useQuery functionality.
92
- * Used as `import { useQuery } from '${importPath}'`.
93
- * Accepts relative and absolute paths.
94
- * Path is used as-is; relative paths are based on the generated file location.
97
+ * Module specifier used in the `import { useQuery } from '...'` statement at
98
+ * the top of every generated composable file.
99
+ *
95
100
  * @default '@tanstack/vue-query'
96
101
  */
97
102
  importPath?: string;
98
103
  };
99
104
  type Mutation = {
100
105
  /**
101
- * HTTP methods to use for mutations.
106
+ * HTTP methods treated as mutations.
102
107
  *
103
108
  * @default ['post', 'put', 'delete']
104
109
  */
105
110
  methods?: Array<string>;
106
111
  /**
107
- * Path to the useMutation hook for useMutation functionality.
108
- * Used as `import { useMutation } from '${importPath}'`.
109
- * Accepts relative and absolute paths.
110
- * Path is used as-is; relative paths are based on the generated file location.
112
+ * Module specifier used in the `import { useMutation } from '...'` statement
113
+ * at the top of every generated composable file.
114
+ *
111
115
  * @default '@tanstack/vue-query'
112
116
  */
113
117
  importPath?: string;
114
118
  };
115
119
  type Infinite = {
116
120
  /**
117
- * Specify the params key used for `pageParam`.
121
+ * Name of the query parameter that holds the page cursor.
122
+ *
118
123
  * @default 'id'
119
124
  */
120
- queryParam: string;
125
+ queryParam?: string;
121
126
  /**
122
- * Which field of the data is used, set it to undefined when no cursor is known.
123
- * @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
127
+ * Path to the cursor field on the response. Leave undefined when the cursor
128
+ * is not known.
129
+ *
130
+ * @deprecated Use `nextParam` and `previousParam` for richer pagination control.
124
131
  */
125
- cursorParam?: string | undefined;
132
+ cursorParam?: string | null;
126
133
  /**
127
- * Which field of the data is used to get the cursor for the next page.
128
- * Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
134
+ * Path to the next-page cursor on the response. Supports dot notation
135
+ * (`'pagination.next.id'`) or array form.
129
136
  */
130
- nextParam?: string | string[] | undefined;
137
+ nextParam?: string | Array<string> | null;
131
138
  /**
132
- * Which field of the data is used to get the cursor for the previous page.
133
- * Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
139
+ * Path to the previous-page cursor on the response. Supports dot notation
140
+ * or array form.
134
141
  */
135
- previousParam?: string | string[] | undefined;
142
+ previousParam?: string | Array<string> | null;
136
143
  /**
137
- * The initial value, the value of the first page.
144
+ * Initial value for `pageParam` on the first fetch.
145
+ *
138
146
  * @default 0
139
147
  */
140
- initialPageParam: unknown;
148
+ initialPageParam?: unknown;
141
149
  };
142
150
  type Options = {
143
151
  /**
144
- * Specify the export location for the files and define the behavior of the output
145
- * @default { path: 'hooks', barrelType: 'named' }
152
+ * Where the generated composables are written and how they are exported.
153
+ *
154
+ * @default { path: 'hooks', barrel: { type: 'named' } }
146
155
  */
147
156
  output?: Output;
148
157
  /**
149
- * Group the @tanstack/query hooks based on the provided name.
158
+ * Split generated files into subfolders based on the operation's tag.
150
159
  */
151
160
  group?: Group;
161
+ /**
162
+ * HTTP client used inside every generated composable. Mirrors a subset of
163
+ * `pluginClient` options.
164
+ */
152
165
  client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
153
166
  /**
154
- * Tags, operations, or paths to exclude from generation.
167
+ * Skip operations matching at least one entry in the list.
155
168
  */
156
169
  exclude?: Array<Exclude>;
157
170
  /**
158
- * Tags, operations, or paths to include in generation.
171
+ * Restrict generation to operations matching at least one entry in the list.
159
172
  */
160
173
  include?: Array<Include>;
161
174
  /**
162
- * Override options for specific tags, operations, or paths.
175
+ * Apply a different options object to operations matching a pattern.
163
176
  */
164
177
  override?: Array<Override<ResolvedOptions>>;
165
178
  /**
166
- * Apply casing to parameter names.
179
+ * Rename parameter properties in the generated composables.
180
+ *
181
+ * @note Must match the value of `paramsCasing` on `@kubb/plugin-ts`.
167
182
  */
168
183
  paramsCasing?: 'camelcase';
169
184
  /**
170
- * How parameters are passed: grouped in an object or spread inline.
185
+ * How operation parameters appear in the generated composable signature.
171
186
  *
172
187
  * @default 'inline'
173
188
  */
174
189
  paramsType?: 'object' | 'inline';
175
190
  /**
176
- * How path parameters are passed: grouped in an object or spread inline.
191
+ * How URL path parameters are arranged inside the inline argument list.
177
192
  *
178
193
  * @default 'inline'
179
194
  */
180
195
  pathParamsType?: PluginClient['options']['pathParamsType'];
181
196
  /**
182
- * Add infinite query hooks.
197
+ * Enables `useInfiniteQuery` composables for cursor- or page-based pagination.
198
+ * Pass an object to configure how the cursor is read; pass `false` to skip.
199
+ *
200
+ * @default false
183
201
  */
184
202
  infinite?: Partial<Infinite> | false;
203
+ /**
204
+ * Custom `queryKey` builder.
205
+ */
185
206
  queryKey?: QueryKey;
186
207
  /**
187
- * Configure useQuery behavior.
208
+ * Configures query composables. Set to `false` to skip composable generation
209
+ * and emit only `queryOptions(...)` helpers.
188
210
  */
189
211
  query?: Partial<Query> | false;
212
+ /**
213
+ * Custom `mutationKey` builder.
214
+ */
190
215
  mutationKey?: MutationKey;
191
216
  /**
192
- * Configure useMutation behavior.
217
+ * Configures mutation composables. Set to `false` to skip mutation generation.
193
218
  */
194
219
  mutation?: Partial<Mutation> | false;
195
220
  /**
196
- * Parser to use for validating response data.
221
+ * Validator applied to response bodies before they reach the caller.
222
+ * - `'client'` — no validation.
223
+ * - `'zod'` — pipes responses through schemas from `@kubb/plugin-zod`.
197
224
  */
198
225
  parser?: PluginClient['options']['parser'];
199
226
  /**
200
- * Override naming conventions for function names and types.
227
+ * Override how composable names and file paths are built.
201
228
  */
202
229
  resolver?: Partial<ResolverVueQuery> & ThisType<ResolverVueQuery>;
203
230
  /**
204
- * AST visitor to transform generated nodes.
231
+ * AST visitor applied to each operation node before printing.
205
232
  */
206
233
  transformer?: ast.Visitor;
207
234
  /**
208
- * Additional generators alongside the default generators.
235
+ * Custom generators that run alongside the built-in Vue Query generators.
209
236
  */
210
237
  generators?: Array<Generator<PluginVueQuery>>;
211
238
  };
212
239
  type ResolvedOptions = {
213
240
  output: Output;
214
- group: Group | undefined;
241
+ group: Group | null;
215
242
  exclude: NonNullable<Options['exclude']>;
216
243
  include: Options['include'];
217
244
  override: NonNullable<Options['override']>;
@@ -224,9 +251,9 @@ type ResolvedOptions = {
224
251
  * Only used for infinite
225
252
  */
226
253
  infinite: NonNullable<Infinite> | false;
227
- queryKey: QueryKey | undefined;
254
+ queryKey: QueryKey | null;
228
255
  query: NonNullable<Required<Query>> | false;
229
- mutationKey: MutationKey | undefined;
256
+ mutationKey: MutationKey | null;
230
257
  mutation: NonNullable<Required<Mutation>> | false;
231
258
  resolver: ResolverVueQuery;
232
259
  };
@@ -240,4 +267,4 @@ declare global {
240
267
  }
241
268
  //#endregion
242
269
  export { Transformer as i, Options as n, PluginVueQuery as r, Infinite as t };
243
- //# sourceMappingURL=types-Bkm7bWT3.d.ts.map
270
+ //# sourceMappingURL=types-D-LjzI_Q.d.ts.map