@kubb/plugin-vue-query 3.0.14 → 3.2.0

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 (41) hide show
  1. package/dist/{chunk-HWT3VLRR.js → chunk-FPSHQREX.js} +69 -32
  2. package/dist/chunk-FPSHQREX.js.map +1 -0
  3. package/dist/{chunk-YWUOBXLY.js → chunk-GNUJZEZD.js} +14 -3
  4. package/dist/chunk-GNUJZEZD.js.map +1 -0
  5. package/dist/{chunk-63EIV54R.cjs → chunk-M7ME77VI.cjs} +25 -14
  6. package/dist/chunk-M7ME77VI.cjs.map +1 -0
  7. package/dist/{chunk-JYBDVID2.cjs → chunk-X3AYO2AG.cjs} +69 -32
  8. package/dist/chunk-X3AYO2AG.cjs.map +1 -0
  9. package/dist/components.cjs +8 -8
  10. package/dist/components.d.cts +25 -13
  11. package/dist/components.d.ts +25 -13
  12. package/dist/components.js +1 -1
  13. package/dist/generators.cjs +5 -5
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +2 -2
  17. package/dist/index.cjs +18 -10
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +15 -7
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-C8LfCZUP.d.cts → types-BeGGMRuk.d.cts} +23 -1
  24. package/dist/{types-C8LfCZUP.d.ts → types-BeGGMRuk.d.ts} +23 -1
  25. package/package.json +11 -11
  26. package/src/components/InfiniteQuery.tsx +9 -1
  27. package/src/components/InfiniteQueryOptions.tsx +9 -2
  28. package/src/components/Mutation.tsx +18 -3
  29. package/src/components/MutationKey.tsx +5 -4
  30. package/src/components/Query.tsx +9 -1
  31. package/src/components/QueryKey.tsx +9 -5
  32. package/src/components/QueryOptions.tsx +9 -3
  33. package/src/generators/infiniteQueryGenerator.tsx +4 -0
  34. package/src/generators/mutationGenerator.tsx +3 -0
  35. package/src/generators/queryGenerator.tsx +4 -0
  36. package/src/plugin.ts +16 -6
  37. package/src/types.ts +8 -0
  38. package/dist/chunk-63EIV54R.cjs.map +0 -1
  39. package/dist/chunk-HWT3VLRR.js.map +0 -1
  40. package/dist/chunk-JYBDVID2.cjs.map +0 -1
  41. package/dist/chunk-YWUOBXLY.js.map +0 -1
@@ -47,6 +47,11 @@ type Options$2 = {
47
47
  * @default 'data'
48
48
  */
49
49
  dataReturnType?: 'data' | 'full';
50
+ /**
51
+ * How to style your params, by default no casing is applied
52
+ * - 'camelcase' will use camelcase for the params names
53
+ */
54
+ paramsCasing?: 'camelcase';
50
55
  /**
51
56
  * How to pass your params
52
57
  * - 'object' will return the params and pathParams as an object.
@@ -87,12 +92,14 @@ type ResolvedOptions$2 = {
87
92
  dataReturnType: NonNullable<Options$2['dataReturnType']>;
88
93
  pathParamsType: NonNullable<Options$2['pathParamsType']>;
89
94
  paramsType: NonNullable<Options$2['paramsType']>;
95
+ paramsCasing: Options$2['paramsCasing'];
90
96
  };
91
97
  type PluginClient = PluginFactoryOptions<'plugin-client', Options$2, ResolvedOptions$2, never, ResolvePathOptions>;
92
98
 
93
99
  type TransformerProps$1 = {
94
100
  operation: Operation;
95
101
  schemas: OperationSchemas;
102
+ casing: 'camelcase' | undefined;
96
103
  };
97
104
  type Transformer$1 = (props: TransformerProps$1) => unknown[];
98
105
  type Suspense = object;
@@ -173,6 +180,11 @@ type Options$1 = {
173
180
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
174
181
  */
175
182
  override?: Array<Override<ResolvedOptions$1>>;
183
+ /**
184
+ * How to style your params, by default no casing is applied
185
+ * - 'camelcase' will use camelcase for the params names
186
+ */
187
+ paramsCasing?: 'camelcase';
176
188
  /**
177
189
  * How to pass your params
178
190
  * - 'object' will return the params and pathParams as an object.
@@ -223,11 +235,13 @@ type Options$1 = {
223
235
  };
224
236
  type ResolvedOptions$1 = {
225
237
  output: Output;
238
+ group: Options$1['group'];
226
239
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
227
240
  baseURL?: string;
228
241
  };
229
242
  parser: Required<NonNullable<Options$1['parser']>>;
230
243
  pathParamsType: NonNullable<Options$1['pathParamsType']>;
244
+ paramsCasing: Options$1['paramsCasing'];
231
245
  paramsType: NonNullable<Options$1['paramsType']>;
232
246
  /**
233
247
  * Only used of infinite
@@ -244,6 +258,7 @@ type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options$1, Re
244
258
  type TransformerProps = {
245
259
  operation: Operation;
246
260
  schemas: OperationSchemas;
261
+ casing: 'camelcase' | undefined;
247
262
  };
248
263
  type Transformer = (props: TransformerProps) => unknown[];
249
264
  /**
@@ -323,6 +338,11 @@ type Options = {
323
338
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
324
339
  */
325
340
  override?: Array<Override<ResolvedOptions>>;
341
+ /**
342
+ * How to style your params, by default no casing is applied
343
+ * - 'camelcase' will use camelcase for the params names
344
+ */
345
+ paramsCasing?: 'camelcase';
326
346
  /**
327
347
  * How to pass your params
328
348
  * - 'object' will return the params and pathParams as an object.
@@ -369,10 +389,12 @@ type Options = {
369
389
  };
370
390
  type ResolvedOptions = {
371
391
  output: Output;
392
+ group: Options['group'];
372
393
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
373
394
  baseURL?: string;
374
395
  };
375
396
  parser: Required<NonNullable<Options['parser']>>;
397
+ paramsCasing: Options['paramsCasing'];
376
398
  paramsType: NonNullable<Options['paramsType']>;
377
399
  pathParamsType: NonNullable<Options['pathParamsType']>;
378
400
  /**
@@ -386,4 +408,4 @@ type ResolvedOptions = {
386
408
  };
387
409
  type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options, ResolvedOptions, never, ResolvePathOptions>;
388
410
 
389
- export type { Infinite as I, Options as O, PluginVueQuery as P, Transformer as T };
411
+ export type { Infinite as I, Options as O, PluginVueQuery as P, Transformer as T, PluginReactQuery as a };
@@ -47,6 +47,11 @@ type Options$2 = {
47
47
  * @default 'data'
48
48
  */
49
49
  dataReturnType?: 'data' | 'full';
50
+ /**
51
+ * How to style your params, by default no casing is applied
52
+ * - 'camelcase' will use camelcase for the params names
53
+ */
54
+ paramsCasing?: 'camelcase';
50
55
  /**
51
56
  * How to pass your params
52
57
  * - 'object' will return the params and pathParams as an object.
@@ -87,12 +92,14 @@ type ResolvedOptions$2 = {
87
92
  dataReturnType: NonNullable<Options$2['dataReturnType']>;
88
93
  pathParamsType: NonNullable<Options$2['pathParamsType']>;
89
94
  paramsType: NonNullable<Options$2['paramsType']>;
95
+ paramsCasing: Options$2['paramsCasing'];
90
96
  };
91
97
  type PluginClient = PluginFactoryOptions<'plugin-client', Options$2, ResolvedOptions$2, never, ResolvePathOptions>;
92
98
 
93
99
  type TransformerProps$1 = {
94
100
  operation: Operation;
95
101
  schemas: OperationSchemas;
102
+ casing: 'camelcase' | undefined;
96
103
  };
97
104
  type Transformer$1 = (props: TransformerProps$1) => unknown[];
98
105
  type Suspense = object;
@@ -173,6 +180,11 @@ type Options$1 = {
173
180
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
174
181
  */
175
182
  override?: Array<Override<ResolvedOptions$1>>;
183
+ /**
184
+ * How to style your params, by default no casing is applied
185
+ * - 'camelcase' will use camelcase for the params names
186
+ */
187
+ paramsCasing?: 'camelcase';
176
188
  /**
177
189
  * How to pass your params
178
190
  * - 'object' will return the params and pathParams as an object.
@@ -223,11 +235,13 @@ type Options$1 = {
223
235
  };
224
236
  type ResolvedOptions$1 = {
225
237
  output: Output;
238
+ group: Options$1['group'];
226
239
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
227
240
  baseURL?: string;
228
241
  };
229
242
  parser: Required<NonNullable<Options$1['parser']>>;
230
243
  pathParamsType: NonNullable<Options$1['pathParamsType']>;
244
+ paramsCasing: Options$1['paramsCasing'];
231
245
  paramsType: NonNullable<Options$1['paramsType']>;
232
246
  /**
233
247
  * Only used of infinite
@@ -244,6 +258,7 @@ type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options$1, Re
244
258
  type TransformerProps = {
245
259
  operation: Operation;
246
260
  schemas: OperationSchemas;
261
+ casing: 'camelcase' | undefined;
247
262
  };
248
263
  type Transformer = (props: TransformerProps) => unknown[];
249
264
  /**
@@ -323,6 +338,11 @@ type Options = {
323
338
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
324
339
  */
325
340
  override?: Array<Override<ResolvedOptions>>;
341
+ /**
342
+ * How to style your params, by default no casing is applied
343
+ * - 'camelcase' will use camelcase for the params names
344
+ */
345
+ paramsCasing?: 'camelcase';
326
346
  /**
327
347
  * How to pass your params
328
348
  * - 'object' will return the params and pathParams as an object.
@@ -369,10 +389,12 @@ type Options = {
369
389
  };
370
390
  type ResolvedOptions = {
371
391
  output: Output;
392
+ group: Options['group'];
372
393
  client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & {
373
394
  baseURL?: string;
374
395
  };
375
396
  parser: Required<NonNullable<Options['parser']>>;
397
+ paramsCasing: Options['paramsCasing'];
376
398
  paramsType: NonNullable<Options['paramsType']>;
377
399
  pathParamsType: NonNullable<Options['pathParamsType']>;
378
400
  /**
@@ -386,4 +408,4 @@ type ResolvedOptions = {
386
408
  };
387
409
  type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options, ResolvedOptions, never, ResolvePathOptions>;
388
410
 
389
- export type { Infinite as I, Options as O, PluginVueQuery as P, Transformer as T };
411
+ export type { Infinite as I, Options as O, PluginVueQuery as P, Transformer as T, PluginReactQuery as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-vue-query",
3
- "version": "3.0.14",
3
+ "version": "3.2.0",
4
4
  "description": "Generator vue-query hooks",
5
5
  "keywords": [
6
6
  "faker",
@@ -63,21 +63,21 @@
63
63
  ],
64
64
  "dependencies": {
65
65
  "remeda": "^2.17.4",
66
- "@kubb/core": "3.0.14",
67
- "@kubb/fs": "3.0.14",
68
- "@kubb/oas": "3.0.14",
69
- "@kubb/plugin-oas": "3.0.14",
70
- "@kubb/plugin-ts": "3.0.14",
71
- "@kubb/plugin-zod": "3.0.14",
72
- "@kubb/react": "3.0.14"
66
+ "@kubb/core": "3.2.0",
67
+ "@kubb/fs": "3.2.0",
68
+ "@kubb/oas": "3.2.0",
69
+ "@kubb/plugin-oas": "3.2.0",
70
+ "@kubb/plugin-ts": "3.2.0",
71
+ "@kubb/plugin-zod": "3.2.0",
72
+ "@kubb/react": "3.2.0"
73
73
  },
74
74
  "devDependencies": {
75
- "@types/react": "^18.3.12",
75
+ "@types/react": "^18.3.16",
76
76
  "react": "^18.3.1",
77
77
  "tsup": "^8.3.5",
78
78
  "typescript": "^5.7.2",
79
- "@kubb/config-ts": "3.0.14",
80
- "@kubb/config-tsup": "3.0.14"
79
+ "@kubb/config-ts": "3.2.0",
80
+ "@kubb/config-tsup": "3.2.0"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "@kubb/react": "^3.0.0"
@@ -18,19 +18,21 @@ type Props = {
18
18
  queryKeyTypeName: string
19
19
  typeSchemas: OperationSchemas
20
20
  operation: Operation
21
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
21
22
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
22
23
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
23
24
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
24
25
  }
25
26
 
26
27
  type GetParamsProps = {
28
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
27
29
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
28
30
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
29
31
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
30
32
  typeSchemas: OperationSchemas
31
33
  }
32
34
 
33
- function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
35
+ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
34
36
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
35
37
 
36
38
  if (paramsType === 'object') {
@@ -40,6 +42,7 @@ function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }:
40
42
  children: {
41
43
  ...getPathParams(typeSchemas.pathParams, {
42
44
  typed: true,
45
+ casing: paramsCasing,
43
46
  override(item) {
44
47
  return {
45
48
  ...item,
@@ -85,6 +88,7 @@ function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }:
85
88
  optional: isOptional(typeSchemas.pathParams?.schema),
86
89
  children: getPathParams(typeSchemas.pathParams, {
87
90
  typed: true,
91
+ casing: paramsCasing,
88
92
  override(item) {
89
93
  return {
90
94
  ...item,
@@ -130,6 +134,7 @@ export function InfiniteQuery({
130
134
  queryKeyName,
131
135
  paramsType,
132
136
  pathParamsType,
137
+ paramsCasing,
133
138
  dataReturnType,
134
139
  typeSchemas,
135
140
  operation,
@@ -141,13 +146,16 @@ export function InfiniteQuery({
141
146
  const queryKeyParams = QueryKey.getParams({
142
147
  pathParamsType,
143
148
  typeSchemas,
149
+ paramsCasing,
144
150
  })
145
151
  const queryOptionsParams = QueryOptions.getParams({
146
152
  paramsType,
147
153
  pathParamsType,
148
154
  typeSchemas,
155
+ paramsCasing,
149
156
  })
150
157
  const params = getParams({
158
+ paramsCasing,
151
159
  paramsType,
152
160
  pathParamsType,
153
161
  dataReturnType,
@@ -14,6 +14,7 @@ type Props = {
14
14
  clientName: string
15
15
  queryKeyName: string
16
16
  typeSchemas: OperationSchemas
17
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
17
18
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
18
19
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
19
20
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
@@ -23,12 +24,13 @@ type Props = {
23
24
  }
24
25
 
25
26
  type GetParamsProps = {
27
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
26
28
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
27
29
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
28
30
  typeSchemas: OperationSchemas
29
31
  }
30
32
 
31
- function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) {
33
+ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {
32
34
  if (paramsType === 'object') {
33
35
  return FunctionParams.factory({
34
36
  data: {
@@ -36,6 +38,7 @@ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps)
36
38
  children: {
37
39
  ...getPathParams(typeSchemas.pathParams, {
38
40
  typed: true,
41
+ casing: paramsCasing,
39
42
  override(item) {
40
43
  return {
41
44
  ...item,
@@ -76,6 +79,7 @@ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps)
76
79
  optional: isOptional(typeSchemas.pathParams?.schema),
77
80
  children: getPathParams(typeSchemas.pathParams, {
78
81
  typed: true,
82
+ casing: paramsCasing,
79
83
  override(item) {
80
84
  return {
81
85
  ...item,
@@ -116,18 +120,21 @@ export function InfiniteQueryOptions({
116
120
  cursorParam,
117
121
  typeSchemas,
118
122
  paramsType,
123
+ paramsCasing,
119
124
  dataReturnType,
120
125
  pathParamsType,
121
126
  queryParam,
122
127
  queryKeyName,
123
128
  }: Props): ReactNode {
124
- const params = getParams({ paramsType, pathParamsType, typeSchemas })
129
+ const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })
125
130
  const clientParams = Client.getParams({
126
131
  paramsType,
132
+ paramsCasing,
127
133
  typeSchemas,
128
134
  pathParamsType,
129
135
  })
130
136
  const queryKeyParams = QueryKey.getParams({
137
+ paramsCasing,
131
138
  pathParamsType,
132
139
  typeSchemas,
133
140
  })
@@ -19,22 +19,25 @@ type Props = {
19
19
  mutationKeyName: string
20
20
  typeSchemas: OperationSchemas
21
21
  operation: Operation
22
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
22
23
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
23
24
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
24
25
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
25
26
  }
26
27
 
27
28
  type GetParamsProps = {
29
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
28
30
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
29
31
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
30
32
  typeSchemas: OperationSchemas
31
33
  }
32
34
 
33
- function getParams({ dataReturnType, typeSchemas }: GetParamsProps) {
35
+ function getParams({ paramsCasing, dataReturnType, typeSchemas }: GetParamsProps) {
34
36
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
35
37
  const mutationParams = FunctionParams.factory({
36
38
  ...getPathParams(typeSchemas.pathParams, {
37
39
  typed: true,
40
+ casing: paramsCasing,
38
41
  override(item) {
39
42
  return {
40
43
  ...item,
@@ -76,26 +79,38 @@ function getParams({ dataReturnType, typeSchemas }: GetParamsProps) {
76
79
  })
77
80
  }
78
81
 
79
- export function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode {
82
+ export function Mutation({
83
+ name,
84
+ clientName,
85
+ paramsCasing,
86
+ paramsType,
87
+ pathParamsType,
88
+ dataReturnType,
89
+ typeSchemas,
90
+ operation,
91
+ mutationKeyName,
92
+ }: Props): ReactNode {
80
93
  const mutationKeyParams = MutationKey.getParams({
81
94
  pathParamsType,
82
95
  typeSchemas,
83
96
  })
84
97
 
85
98
  const params = getParams({
99
+ paramsCasing,
86
100
  pathParamsType,
87
101
  dataReturnType,
88
102
  typeSchemas,
89
103
  })
90
104
 
91
105
  const clientParams = Client.getParams({
106
+ paramsCasing,
92
107
  paramsType,
93
108
  typeSchemas,
94
109
  pathParamsType,
95
110
  })
96
111
 
97
112
  const mutationParams = FunctionParams.factory({
98
- ...getPathParams(typeSchemas.pathParams, { typed: true }),
113
+ ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),
99
114
  data: typeSchemas.request?.name
100
115
  ? {
101
116
  type: typeSchemas.request?.name,
@@ -11,6 +11,7 @@ type Props = {
11
11
  typeName: string
12
12
  typeSchemas: OperationSchemas
13
13
  operation: Operation
14
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
14
15
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
15
16
  transformer: Transformer | undefined
16
17
  }
@@ -24,15 +25,15 @@ function getParams({}: GetParamsProps) {
24
25
  return FunctionParams.factory({})
25
26
  }
26
27
 
27
- const getTransformer: Transformer = ({ operation }) => {
28
- const path = new URLPath(operation.path)
28
+ const getTransformer: Transformer = ({ operation, casing }) => {
29
+ const path = new URLPath(operation.path, { casing })
29
30
 
30
31
  return [JSON.stringify({ url: path.path })].filter(Boolean)
31
32
  }
32
33
 
33
- export function MutationKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {
34
+ export function MutationKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {
34
35
  const params = getParams({ pathParamsType, typeSchemas })
35
- const keys = transformer({ operation, schemas: typeSchemas })
36
+ const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing })
36
37
 
37
38
  return (
38
39
  <>
@@ -19,19 +19,21 @@ type Props = {
19
19
  queryKeyTypeName: string
20
20
  typeSchemas: OperationSchemas
21
21
  operation: Operation
22
+ paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']
22
23
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
23
24
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
24
25
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
25
26
  }
26
27
 
27
28
  type GetParamsProps = {
29
+ paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']
28
30
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
29
31
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
30
32
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
31
33
  typeSchemas: OperationSchemas
32
34
  }
33
35
 
34
- function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
36
+ function getParams({ paramsCasing, paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
35
37
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
36
38
 
37
39
  if (paramsType === 'object') {
@@ -41,6 +43,7 @@ function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }:
41
43
  children: {
42
44
  ...getPathParams(typeSchemas.pathParams, {
43
45
  typed: true,
46
+ casing: paramsCasing,
44
47
  override(item) {
45
48
  return {
46
49
  ...item,
@@ -86,6 +89,7 @@ function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }:
86
89
  optional: isOptional(typeSchemas.pathParams?.schema),
87
90
  children: getPathParams(typeSchemas.pathParams, {
88
91
  typed: true,
92
+ casing: paramsCasing,
89
93
  override(item) {
90
94
  return {
91
95
  ...item,
@@ -130,6 +134,7 @@ export function Query({
130
134
  queryOptionsName,
131
135
  queryKeyName,
132
136
  paramsType,
137
+ paramsCasing,
133
138
  pathParamsType,
134
139
  dataReturnType,
135
140
  typeSchemas,
@@ -142,13 +147,16 @@ export function Query({
142
147
  const queryKeyParams = QueryKey.getParams({
143
148
  pathParamsType,
144
149
  typeSchemas,
150
+ paramsCasing,
145
151
  })
146
152
  const queryOptionsParams = QueryOptions.getParams({
147
153
  paramsType,
148
154
  pathParamsType,
149
155
  typeSchemas,
156
+ paramsCasing,
150
157
  })
151
158
  const params = getParams({
159
+ paramsCasing,
152
160
  paramsType,
153
161
  pathParamsType,
154
162
  dataReturnType,
@@ -12,21 +12,24 @@ type Props = {
12
12
  typeName: string
13
13
  typeSchemas: OperationSchemas
14
14
  operation: Operation
15
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
15
16
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
16
17
  transformer: Transformer | undefined
17
18
  }
18
19
 
19
20
  type GetParamsProps = {
21
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
20
22
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
21
23
  typeSchemas: OperationSchemas
22
24
  }
23
25
 
24
- function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
26
+ function getParams({ pathParamsType, paramsCasing, typeSchemas }: GetParamsProps) {
25
27
  return FunctionParams.factory({
26
28
  pathParams: {
27
29
  mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
28
30
  children: getPathParams(typeSchemas.pathParams, {
29
31
  typed: true,
32
+ casing: paramsCasing,
30
33
  override(item) {
31
34
  return {
32
35
  ...item,
@@ -50,8 +53,8 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
50
53
  })
51
54
  }
52
55
 
53
- const getTransformer: Transformer = ({ operation, schemas }) => {
54
- const path = new URLPath(operation.path)
56
+ const getTransformer: Transformer = ({ operation, schemas, casing }) => {
57
+ const path = new URLPath(operation.path, { casing })
55
58
  const keys = [
56
59
  path.toObject({
57
60
  type: 'path',
@@ -64,11 +67,12 @@ const getTransformer: Transformer = ({ operation, schemas }) => {
64
67
  return keys
65
68
  }
66
69
 
67
- export function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {
68
- const params = getParams({ pathParamsType, typeSchemas })
70
+ export function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {
71
+ const params = getParams({ pathParamsType, typeSchemas, paramsCasing })
69
72
  const keys = transformer({
70
73
  operation,
71
74
  schemas: typeSchemas,
75
+ casing: paramsCasing,
72
76
  })
73
77
 
74
78
  return (
@@ -15,17 +15,19 @@ type Props = {
15
15
  clientName: string
16
16
  queryKeyName: string
17
17
  typeSchemas: OperationSchemas
18
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
18
19
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
19
20
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
20
21
  }
21
22
 
22
23
  type GetParamsProps = {
24
+ paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
23
25
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
24
26
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
25
27
  typeSchemas: OperationSchemas
26
28
  }
27
29
 
28
- function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) {
30
+ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {
29
31
  if (paramsType === 'object') {
30
32
  return FunctionParams.factory({
31
33
  data: {
@@ -33,6 +35,7 @@ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps)
33
35
  children: {
34
36
  ...getPathParams(typeSchemas.pathParams, {
35
37
  typed: true,
38
+ casing: paramsCasing,
36
39
  override(item) {
37
40
  return {
38
41
  ...item,
@@ -73,6 +76,7 @@ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps)
73
76
  optional: isOptional(typeSchemas.pathParams?.schema),
74
77
  children: getPathParams(typeSchemas.pathParams, {
75
78
  typed: true,
79
+ casing: paramsCasing,
76
80
  override(item) {
77
81
  return {
78
82
  ...item,
@@ -106,16 +110,18 @@ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps)
106
110
  })
107
111
  }
108
112
 
109
- export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props): ReactNode {
110
- const params = getParams({ paramsType, pathParamsType, typeSchemas })
113
+ export function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }: Props): ReactNode {
114
+ const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })
111
115
  const clientParams = Client.getParams({
112
116
  paramsType,
117
+ paramsCasing,
113
118
  typeSchemas,
114
119
  pathParamsType,
115
120
  })
116
121
  const queryKeyParams = QueryKey.getParams({
117
122
  pathParamsType,
118
123
  typeSchemas,
124
+ paramsCasing,
119
125
  })
120
126
 
121
127
  const enabled = Object.entries(queryKeyParams.flatParams)
@@ -85,6 +85,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
85
85
  name={queryKey.name}
86
86
  typeName={queryKey.typeName}
87
87
  operation={operation}
88
+ paramsCasing={options.paramsCasing}
88
89
  pathParamsType={options.pathParamsType}
89
90
  typeSchemas={type.schemas}
90
91
  transformer={options.queryKey}
@@ -98,6 +99,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
98
99
  typeSchemas={type.schemas}
99
100
  zodSchemas={zod.schemas}
100
101
  dataReturnType={options.client.dataReturnType}
102
+ paramsCasing={options.paramsCasing}
101
103
  paramsType={options.paramsType}
102
104
  pathParamsType={options.pathParamsType}
103
105
  parser={options.parser}
@@ -112,6 +114,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
112
114
  queryKeyName={queryKey.name}
113
115
  typeSchemas={type.schemas}
114
116
  paramsType={options.paramsType}
117
+ paramsCasing={options.paramsCasing}
115
118
  pathParamsType={options.pathParamsType}
116
119
  dataReturnType={options.client.dataReturnType}
117
120
  cursorParam={options.infinite.cursorParam}
@@ -128,6 +131,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
128
131
  name={query.name}
129
132
  queryOptionsName={queryOptions.name}
130
133
  typeSchemas={type.schemas}
134
+ paramsCasing={options.paramsCasing}
131
135
  paramsType={options.paramsType}
132
136
  pathParamsType={options.pathParamsType}
133
137
  operation={operation}
@@ -80,6 +80,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
80
80
  typeName={mutationKey.typeName}
81
81
  operation={operation}
82
82
  pathParamsType={options.pathParamsType}
83
+ paramsCasing={options.paramsCasing}
83
84
  typeSchemas={type.schemas}
84
85
  transformer={options.mutationKey}
85
86
  />
@@ -92,6 +93,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
92
93
  typeSchemas={type.schemas}
93
94
  zodSchemas={zod.schemas}
94
95
  dataReturnType={options.client.dataReturnType}
96
+ paramsCasing={options.paramsCasing}
95
97
  paramsType={options.paramsType}
96
98
  pathParamsType={options.pathParamsType}
97
99
  parser={options.parser}
@@ -106,6 +108,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
106
108
  typeName={mutation.typeName}
107
109
  typeSchemas={type.schemas}
108
110
  operation={operation}
111
+ paramsCasing={options.paramsCasing}
109
112
  dataReturnType={options.client.dataReturnType}
110
113
  paramsType={options.paramsType}
111
114
  pathParamsType={options.pathParamsType}