@kubb/plugin-vue-query 3.0.0-alpha.31 → 3.0.0-beta.10

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 (42) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-FSQSBTBH.cjs → chunk-5MY3SE2R.cjs} +220 -18
  3. package/dist/chunk-5MY3SE2R.cjs.map +1 -0
  4. package/dist/{chunk-V6YETPDM.js → chunk-DWWRCRGY.js} +220 -18
  5. package/dist/chunk-DWWRCRGY.js.map +1 -0
  6. package/dist/{chunk-IAQL3OW6.cjs → chunk-PGNSMLGU.cjs} +31 -21
  7. package/dist/chunk-PGNSMLGU.cjs.map +1 -0
  8. package/dist/{chunk-CTBTK7UQ.js → chunk-YQOJHRKU.js} +18 -8
  9. package/dist/chunk-YQOJHRKU.js.map +1 -0
  10. package/dist/components.cjs +8 -8
  11. package/dist/components.d.cts +19 -10
  12. package/dist/components.d.ts +19 -10
  13. package/dist/components.js +1 -1
  14. package/dist/generators.cjs +5 -5
  15. package/dist/generators.d.cts +1 -1
  16. package/dist/generators.d.ts +1 -1
  17. package/dist/generators.js +2 -2
  18. package/dist/index.cjs +6 -5
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +5 -4
  23. package/dist/index.js.map +1 -1
  24. package/dist/{types-BGytoVFN.d.cts → types-Dx6yZliF.d.cts} +101 -40
  25. package/dist/{types-BGytoVFN.d.ts → types-Dx6yZliF.d.ts} +101 -40
  26. package/package.json +14 -14
  27. package/src/components/InfiniteQuery.tsx +54 -1
  28. package/src/components/InfiniteQueryOptions.tsx +49 -2
  29. package/src/components/Mutation.tsx +7 -3
  30. package/src/components/Query.tsx +65 -2
  31. package/src/components/QueryOptions.tsx +50 -3
  32. package/src/generators/__snapshots__/findByTagsObject.ts +62 -0
  33. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
  34. package/src/generators/infiniteQueryGenerator.tsx +3 -1
  35. package/src/generators/mutationGenerator.tsx +2 -1
  36. package/src/generators/queryGenerator.tsx +3 -1
  37. package/src/plugin.ts +3 -2
  38. package/src/types.ts +18 -41
  39. package/dist/chunk-CTBTK7UQ.js.map +0 -1
  40. package/dist/chunk-FSQSBTBH.cjs.map +0 -1
  41. package/dist/chunk-IAQL3OW6.cjs.map +0 -1
  42. package/dist/chunk-V6YETPDM.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { Operation } from '@kubb/oas';
2
2
  import { OperationSchemas } from '@kubb/plugin-oas';
3
3
  import { ReactNode } from 'react';
4
- import { P as PluginVueQuery, I as Infinite } from './types-BGytoVFN.cjs';
4
+ import { P as PluginVueQuery, I as Infinite } from './types-Dx6yZliF.cjs';
5
5
  import { FunctionParams } from '@kubb/react';
6
6
  import '@kubb/core';
7
7
 
@@ -15,10 +15,11 @@ type Props$6 = {
15
15
  mutationKeyName: string;
16
16
  typeSchemas: OperationSchemas;
17
17
  operation: Operation;
18
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
18
19
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
19
20
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
20
21
  };
21
- declare function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props$6): ReactNode;
22
+ declare function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props$6): ReactNode;
22
23
 
23
24
  type Props$5 = {
24
25
  /**
@@ -30,17 +31,19 @@ type Props$5 = {
30
31
  queryKeyTypeName: string;
31
32
  typeSchemas: OperationSchemas;
32
33
  operation: Operation;
34
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
33
35
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
34
36
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
35
37
  };
36
38
  type GetParamsProps$5 = {
39
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
37
40
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
38
41
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
39
42
  typeSchemas: OperationSchemas;
40
43
  };
41
- declare function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props$5): ReactNode;
44
+ declare function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, }: Props$5): ReactNode;
42
45
  declare namespace Query {
43
- var getParams: ({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps$5) => FunctionParams;
46
+ var getParams: ({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps$5) => FunctionParams;
44
47
  }
45
48
 
46
49
  type Props$4 = {
@@ -65,15 +68,17 @@ type Props$3 = {
65
68
  clientName: string;
66
69
  queryKeyName: string;
67
70
  typeSchemas: OperationSchemas;
71
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
68
72
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
69
73
  };
70
74
  type GetParamsProps$3 = {
75
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
71
76
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
72
77
  typeSchemas: OperationSchemas;
73
78
  };
74
- declare function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }: Props$3): ReactNode;
79
+ declare function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props$3): ReactNode;
75
80
  declare namespace QueryOptions {
76
- var getParams: ({ pathParamsType, typeSchemas }: GetParamsProps$3) => FunctionParams;
81
+ var getParams: ({ paramsType, pathParamsType, typeSchemas }: GetParamsProps$3) => FunctionParams;
77
82
  }
78
83
 
79
84
  type Props$2 = {
@@ -81,6 +86,7 @@ type Props$2 = {
81
86
  clientName: string;
82
87
  queryKeyName: string;
83
88
  typeSchemas: OperationSchemas;
89
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
84
90
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
85
91
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
86
92
  initialPageParam: Infinite['initialPageParam'];
@@ -88,12 +94,13 @@ type Props$2 = {
88
94
  queryParam: Infinite['queryParam'];
89
95
  };
90
96
  type GetParamsProps$2 = {
97
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
91
98
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
92
99
  typeSchemas: OperationSchemas;
93
100
  };
94
- declare function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, typeSchemas, dataReturnType, pathParamsType, queryParam, queryKeyName, }: Props$2): ReactNode;
101
+ declare function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, typeSchemas, paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName, }: Props$2): ReactNode;
95
102
  declare namespace InfiniteQueryOptions {
96
- var getParams: ({ pathParamsType, typeSchemas }: GetParamsProps$2) => FunctionParams;
103
+ var getParams: ({ paramsType, pathParamsType, typeSchemas }: GetParamsProps$2) => FunctionParams;
97
104
  }
98
105
 
99
106
  type Props$1 = {
@@ -106,17 +113,19 @@ type Props$1 = {
106
113
  queryKeyTypeName: string;
107
114
  typeSchemas: OperationSchemas;
108
115
  operation: Operation;
116
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
109
117
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
110
118
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
111
119
  };
112
120
  type GetParamsProps$1 = {
121
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
113
122
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
114
123
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
115
124
  typeSchemas: OperationSchemas;
116
125
  };
117
- declare function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation, }: Props$1): ReactNode;
126
+ declare function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, }: Props$1): ReactNode;
118
127
  declare namespace InfiniteQuery {
119
- var getParams: ({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps$1) => FunctionParams;
128
+ var getParams: ({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps$1) => FunctionParams;
120
129
  }
121
130
 
122
131
  type Props = {
@@ -1,7 +1,7 @@
1
1
  import { Operation } from '@kubb/oas';
2
2
  import { OperationSchemas } from '@kubb/plugin-oas';
3
3
  import { ReactNode } from 'react';
4
- import { P as PluginVueQuery, I as Infinite } from './types-BGytoVFN.js';
4
+ import { P as PluginVueQuery, I as Infinite } from './types-Dx6yZliF.js';
5
5
  import { FunctionParams } from '@kubb/react';
6
6
  import '@kubb/core';
7
7
 
@@ -15,10 +15,11 @@ type Props$6 = {
15
15
  mutationKeyName: string;
16
16
  typeSchemas: OperationSchemas;
17
17
  operation: Operation;
18
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
18
19
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
19
20
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
20
21
  };
21
- declare function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props$6): ReactNode;
22
+ declare function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props$6): ReactNode;
22
23
 
23
24
  type Props$5 = {
24
25
  /**
@@ -30,17 +31,19 @@ type Props$5 = {
30
31
  queryKeyTypeName: string;
31
32
  typeSchemas: OperationSchemas;
32
33
  operation: Operation;
34
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
33
35
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
34
36
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
35
37
  };
36
38
  type GetParamsProps$5 = {
39
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
37
40
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
38
41
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
39
42
  typeSchemas: OperationSchemas;
40
43
  };
41
- declare function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props$5): ReactNode;
44
+ declare function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, }: Props$5): ReactNode;
42
45
  declare namespace Query {
43
- var getParams: ({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps$5) => FunctionParams;
46
+ var getParams: ({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps$5) => FunctionParams;
44
47
  }
45
48
 
46
49
  type Props$4 = {
@@ -65,15 +68,17 @@ type Props$3 = {
65
68
  clientName: string;
66
69
  queryKeyName: string;
67
70
  typeSchemas: OperationSchemas;
71
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
68
72
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
69
73
  };
70
74
  type GetParamsProps$3 = {
75
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
71
76
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
72
77
  typeSchemas: OperationSchemas;
73
78
  };
74
- declare function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }: Props$3): ReactNode;
79
+ declare function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props$3): ReactNode;
75
80
  declare namespace QueryOptions {
76
- var getParams: ({ pathParamsType, typeSchemas }: GetParamsProps$3) => FunctionParams;
81
+ var getParams: ({ paramsType, pathParamsType, typeSchemas }: GetParamsProps$3) => FunctionParams;
77
82
  }
78
83
 
79
84
  type Props$2 = {
@@ -81,6 +86,7 @@ type Props$2 = {
81
86
  clientName: string;
82
87
  queryKeyName: string;
83
88
  typeSchemas: OperationSchemas;
89
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
84
90
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
85
91
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
86
92
  initialPageParam: Infinite['initialPageParam'];
@@ -88,12 +94,13 @@ type Props$2 = {
88
94
  queryParam: Infinite['queryParam'];
89
95
  };
90
96
  type GetParamsProps$2 = {
97
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
91
98
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
92
99
  typeSchemas: OperationSchemas;
93
100
  };
94
- declare function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, typeSchemas, dataReturnType, pathParamsType, queryParam, queryKeyName, }: Props$2): ReactNode;
101
+ declare function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, typeSchemas, paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName, }: Props$2): ReactNode;
95
102
  declare namespace InfiniteQueryOptions {
96
- var getParams: ({ pathParamsType, typeSchemas }: GetParamsProps$2) => FunctionParams;
103
+ var getParams: ({ paramsType, pathParamsType, typeSchemas }: GetParamsProps$2) => FunctionParams;
97
104
  }
98
105
 
99
106
  type Props$1 = {
@@ -106,17 +113,19 @@ type Props$1 = {
106
113
  queryKeyTypeName: string;
107
114
  typeSchemas: OperationSchemas;
108
115
  operation: Operation;
116
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
109
117
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
110
118
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
111
119
  };
112
120
  type GetParamsProps$1 = {
121
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType'];
113
122
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'];
114
123
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'];
115
124
  typeSchemas: OperationSchemas;
116
125
  };
117
- declare function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation, }: Props$1): ReactNode;
126
+ declare function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, }: Props$1): ReactNode;
118
127
  declare namespace InfiniteQuery {
119
- var getParams: ({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps$1) => FunctionParams;
128
+ var getParams: ({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps$1) => FunctionParams;
120
129
  }
121
130
 
122
131
  type Props = {
@@ -1,3 +1,3 @@
1
- export { InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, Query, QueryKey, QueryOptions } from './chunk-V6YETPDM.js';
1
+ export { InfiniteQuery, InfiniteQueryOptions, Mutation, MutationKey, Query, QueryKey, QueryOptions } from './chunk-DWWRCRGY.js';
2
2
  //# sourceMappingURL=components.js.map
3
3
  //# sourceMappingURL=components.js.map
@@ -1,21 +1,21 @@
1
1
  'use strict';
2
2
 
3
- var chunkIAQL3OW6_cjs = require('./chunk-IAQL3OW6.cjs');
4
- require('./chunk-FSQSBTBH.cjs');
3
+ var chunkPGNSMLGU_cjs = require('./chunk-PGNSMLGU.cjs');
4
+ require('./chunk-5MY3SE2R.cjs');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "infiniteQueryGenerator", {
9
9
  enumerable: true,
10
- get: function () { return chunkIAQL3OW6_cjs.infiniteQueryGenerator; }
10
+ get: function () { return chunkPGNSMLGU_cjs.infiniteQueryGenerator; }
11
11
  });
12
12
  Object.defineProperty(exports, "mutationGenerator", {
13
13
  enumerable: true,
14
- get: function () { return chunkIAQL3OW6_cjs.mutationGenerator; }
14
+ get: function () { return chunkPGNSMLGU_cjs.mutationGenerator; }
15
15
  });
16
16
  Object.defineProperty(exports, "queryGenerator", {
17
17
  enumerable: true,
18
- get: function () { return chunkIAQL3OW6_cjs.queryGenerator; }
18
+ get: function () { return chunkPGNSMLGU_cjs.queryGenerator; }
19
19
  });
20
20
  //# sourceMappingURL=generators.cjs.map
21
21
  //# sourceMappingURL=generators.cjs.map
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginVueQuery } from './types-BGytoVFN.cjs';
2
+ import { P as PluginVueQuery } from './types-Dx6yZliF.cjs';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_plugin_oas from '@kubb/plugin-oas';
2
- import { P as PluginVueQuery } from './types-BGytoVFN.js';
2
+ import { P as PluginVueQuery } from './types-Dx6yZliF.js';
3
3
  import '@kubb/core';
4
4
  import '@kubb/oas';
5
5
 
@@ -1,4 +1,4 @@
1
- export { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './chunk-CTBTK7UQ.js';
2
- import './chunk-V6YETPDM.js';
1
+ export { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './chunk-YQOJHRKU.js';
2
+ import './chunk-DWWRCRGY.js';
3
3
  //# sourceMappingURL=generators.js.map
4
4
  //# sourceMappingURL=generators.js.map
package/dist/index.cjs CHANGED
@@ -1,11 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var chunkIAQL3OW6_cjs = require('./chunk-IAQL3OW6.cjs');
4
- require('./chunk-FSQSBTBH.cjs');
3
+ var chunkPGNSMLGU_cjs = require('./chunk-PGNSMLGU.cjs');
4
+ require('./chunk-5MY3SE2R.cjs');
5
5
  var path = require('path');
6
6
  var core = require('@kubb/core');
7
7
  var transformers = require('@kubb/core/transformers');
8
- require('@kubb/core/utils');
9
8
  var pluginOas = require('@kubb/plugin-oas');
10
9
  var pluginTs = require('@kubb/plugin-ts');
11
10
  var pluginZod = require('@kubb/plugin-zod');
@@ -25,10 +24,11 @@ var pluginVueQuery = core.createPlugin((options) => {
25
24
  parser = "client",
26
25
  infinite,
27
26
  transformers: transformers$1 = {},
27
+ paramsType = "inline",
28
28
  pathParamsType = "inline",
29
29
  mutation = {},
30
30
  query = {},
31
- generators = [chunkIAQL3OW6_cjs.queryGenerator, chunkIAQL3OW6_cjs.infiniteQueryGenerator, chunkIAQL3OW6_cjs.mutationGenerator].filter(Boolean)
31
+ generators = [chunkPGNSMLGU_cjs.queryGenerator, chunkPGNSMLGU_cjs.infiniteQueryGenerator, chunkPGNSMLGU_cjs.mutationGenerator].filter(Boolean)
32
32
  } = options;
33
33
  return {
34
34
  name: pluginVueQueryName,
@@ -59,7 +59,8 @@ var pluginVueQuery = core.createPlugin((options) => {
59
59
  importPath: "@tanstack/vue-query",
60
60
  ...mutation
61
61
  },
62
- pathParamsType,
62
+ paramsType,
63
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType,
63
64
  parser
64
65
  },
65
66
  pre: [pluginOas.pluginOasName, pluginTs.pluginTsName, parser === "zod" ? pluginZod.pluginZodName : void 0].filter(Boolean),
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts"],"names":["createPlugin","transformers","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","options","path","FileManager","camelCase","pascalCase","PluginManager","OperationGenerator"],"mappings":";;;;;;;;;;;;;;;;AAeO,IAAM,kBAAqB,GAAA,mBAAA;AAErB,IAAA,cAAA,GAAiBA,iBAA6B,CAAA,CAAC,OAAY,KAAA;AACtE,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,IACT,QAAA;AAAA,kBACAC,iBAAe,EAAC;AAAA,IA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AA;AAEA,MAAA,MAAM,KAAQ,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA,CAAA;AAC1D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,KAAK,CAAA,CAAA;AAE3B,MAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,QACxD,IAAA,EAAM,OAAO,UAAc,IAAA,OAAA;AAAA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA,GAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA,MAAA;AAAA,OACd,CAAA,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAAA,KACnC;AAAA,GACF,CAAA;AACF,CAAC","file":"index.cjs","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n pathParamsType = 'inline',\n mutation = {},\n query = {},\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n baseURL: undefined,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n query: {\n key: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutation: {\n key: (key: unknown[]) => key,\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n pathParamsType,\n parser,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
1
+ {"version":3,"sources":["../src/plugin.ts"],"names":["createPlugin","transformers","queryGenerator","infiniteQueryGenerator","mutationGenerator","pluginOasName","pluginTsName","pluginZodName","options","path","FileManager","camelCase","pascalCase","PluginManager","OperationGenerator"],"mappings":";;;;;;;;;;;;;;;AAcO,IAAM,kBAAqB,GAAA;AAErB,IAAA,cAAA,GAAiBA,iBAA6B,CAAA,CAAC,OAAY,KAAA;AACtE,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,IACT,QAAA;AAAA,kBACAC,iBAAe,EAAC;AAAA,IAChB,UAAa,GAAA,QAAA;AAAA,IACb,cAAiB,GAAA,QAAA;AAAA,IACjB,WAAW,EAAC;AAAA,IACZ,QAAQ,EAAC;AAAA,IACT,aAAa,CAACC,gCAAA,EAAgBC,0CAAwBC,mCAAiB,CAAA,CAAE,OAAO,OAAO;AAAA,GACrF,GAAA,OAAA;AAEJ,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,kBAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,MAAA;AAAA,MACA,OAAS,EAAA,KAAA,CAAA;AAAA,M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AA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.cjs","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = 'inline',\n mutation = {},\n query = {},\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n baseURL: undefined,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n query: {\n key: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutation: {\n key: (key: unknown[]) => key,\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,\n parser,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginVueQuery } from './types-BGytoVFN.cjs';
2
+ import { O as Options, P as PluginVueQuery } from './types-Dx6yZliF.cjs';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginVueQuery } from './types-BGytoVFN.js';
2
+ import { O as Options, P as PluginVueQuery } from './types-Dx6yZliF.js';
3
3
  import '@kubb/oas';
4
4
  import '@kubb/plugin-oas';
5
5
 
package/dist/index.js CHANGED
@@ -1,9 +1,8 @@
1
- import { queryGenerator, infiniteQueryGenerator, mutationGenerator } from './chunk-CTBTK7UQ.js';
2
- import './chunk-V6YETPDM.js';
1
+ import { queryGenerator, infiniteQueryGenerator, mutationGenerator } from './chunk-YQOJHRKU.js';
2
+ import './chunk-DWWRCRGY.js';
3
3
  import path from 'node:path';
4
4
  import { createPlugin, FileManager, PluginManager } from '@kubb/core';
5
5
  import { camelCase, pascalCase } from '@kubb/core/transformers';
6
- import '@kubb/core/utils';
7
6
  import { pluginOasName, OperationGenerator } from '@kubb/plugin-oas';
8
7
  import { pluginTsName } from '@kubb/plugin-ts';
9
8
  import { pluginZodName } from '@kubb/plugin-zod';
@@ -19,6 +18,7 @@ var pluginVueQuery = createPlugin((options) => {
19
18
  parser = "client",
20
19
  infinite,
21
20
  transformers = {},
21
+ paramsType = "inline",
22
22
  pathParamsType = "inline",
23
23
  mutation = {},
24
24
  query = {},
@@ -53,7 +53,8 @@ var pluginVueQuery = createPlugin((options) => {
53
53
  importPath: "@tanstack/vue-query",
54
54
  ...mutation
55
55
  },
56
- pathParamsType,
56
+ paramsType,
57
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType,
57
58
  parser
58
59
  },
59
60
  pre: [pluginOasName, pluginTsName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.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BAAA;AAAA,QAC7B;AAAA,UACE,GAAG,KAAK,MAAO,CAAA,OAAA;AAAA,UACf,OAAA;AAAA,SACF;AAAA,QACA;AAAA,UACE,GAAA;AAAA,UACA,eAAe,IAAK,CAAA,aAAA;AAAA,UACpB,QAAQ,IAAK,CAAA,MAAA;AAAA,UACb,WAAA,EAAa,cAAc,OAAQ,CAAA,WAAA;AAAA,UACnC,OAAA;AAAA,UACA,OAAA;AAAA,UACA,QAAA;AAAA,UACA,IAAA;AAAA,SACF;AAAA,OACF,CAAA;AAEA,MAAA,MAAM,KAAQ,GAAA,MAAM,kBAAmB,CAAA,KAAA,CAAM,GAAG,UAAU,CAAA,CAAA;AAC1D,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,KAAK,CAAA,CAAA;AAE3B,MAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,QACxD,IAAA,EAAM,OAAO,UAAc,IAAA,OAAA;AAAA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA,GAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA,MAAA;AAAA,OACd,CAAA,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAAA,KACnC;AAAA,GACF,CAAA;AACF,CAAC","file":"index.js","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n pathParamsType = 'inline',\n mutation = {},\n query = {},\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n baseURL: undefined,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n query: {\n key: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutation: {\n key: (key: unknown[]) => key,\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n pathParamsType,\n parser,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
1
+ {"version":3,"sources":["../src/plugin.ts"],"names":["options"],"mappings":";;;;;;;;;AAcO,IAAM,kBAAqB,GAAA;AAErB,IAAA,cAAA,GAAiB,YAA6B,CAAA,CAAC,OAAY,KAAA;AACtE,EAAM,MAAA;AAAA,IACJ,MAAS,GAAA,EAAE,IAAM,EAAA,OAAA,EAAS,YAAY,OAAQ,EAAA;AAAA,IAC9C,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,IACZ,MAAS,GAAA,QAAA;AAAA,IACT,QAAA;AAAA,IACA,eAAe,EAAC;AAAA,IAChB,UAAa,GAAA,QAAA;AAAA,IACb,cAAiB,GAAA,QAAA;AAAA,IACjB,WAAW,EAAC;AAAA,IACZ,QAAQ,EAAC;AAAA,IACT,aAAa,CAAC,cAAA,EA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AA,QAC3B,IAAA;AAAA,QACA,MAAA;AAAA,QACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,QACxB,IAAM,EAAA;AAAA,UACJ,SAAA,EAAW,KAAK,MAAO,CAAA;AAAA,SACzB;AAAA,QACA,QAAQ,IAAK,CAAA;AAAA,OACd,CAAA;AAED,MAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA;AAAA;AACnC,GACF;AACF,CAAC","file":"index.js","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas } from '@kubb/plugin-oas'\nimport { infiniteQueryGenerator, mutationGenerator, queryGenerator } from './generators'\nimport type { PluginVueQuery } from './types.ts'\n\nexport const pluginVueQueryName = 'plugin-vue-query' satisfies PluginVueQuery['name']\n\nexport const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {\n const {\n output = { path: 'hooks', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n parser = 'client',\n infinite,\n transformers = {},\n paramsType = 'inline',\n pathParamsType = 'inline',\n mutation = {},\n query = {},\n generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),\n } = options\n\n return {\n name: pluginVueQueryName,\n options: {\n output,\n baseURL: undefined,\n client: {\n importPath: '@kubb/plugin-client/client',\n dataReturnType: 'data',\n pathParamsType: 'inline',\n ...options.client,\n },\n infinite: infinite\n ? {\n queryParam: 'id',\n initialPageParam: 0,\n cursorParam: undefined,\n ...infinite,\n }\n : false,\n query: {\n key: (key: unknown[]) => key,\n methods: ['get'],\n importPath: '@tanstack/vue-query',\n ...query,\n },\n mutation: {\n key: (key: unknown[]) => key,\n methods: ['post', 'put', 'patch', 'delete'],\n importPath: '@tanstack/vue-query',\n ...mutation,\n },\n paramsType,\n pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,\n parser,\n },\n pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (options?.tag && group?.type === 'tag') {\n const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`\n\n return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)\n }\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n let resolvedName = camelCase(name)\n\n if (type === 'file' || type === 'function') {\n resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n }\n if (type === 'type') {\n resolvedName = pascalCase(name)\n }\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async buildStart() {\n const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(...generators)\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"]}
@@ -2,6 +2,90 @@ import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/co
2
2
  import { HttpMethod } from '@kubb/oas';
3
3
  import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
4
4
 
5
+ type Options$1 = {
6
+ /**
7
+ * Specify the export location for the files and define the behavior of the output
8
+ * @default { path: 'clients', barrelType: 'named' }
9
+ */
10
+ output?: Output;
11
+ /**
12
+ * Group the clients based on the provided name.
13
+ */
14
+ group?: Group;
15
+ /**
16
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
17
+ */
18
+ exclude?: Array<Exclude>;
19
+ /**
20
+ * Array containing include parameters to include tags/operations/methods/paths.
21
+ */
22
+ include?: Array<Include>;
23
+ /**
24
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
25
+ */
26
+ override?: Array<Override<ResolvedOptions$1>>;
27
+ /**
28
+ * Create `operations.ts` file with all operations grouped by methods.
29
+ * @default false
30
+ */
31
+ operations?: boolean;
32
+ /**
33
+ * Path to the client import path that will be used to do the API calls.
34
+ * It will be used as `import client from '${client.importPath}'`.
35
+ * It allows both relative and absolute path but be aware that we will not change the path.
36
+ * @default '@kubb/plugin-client/client'
37
+ */
38
+ importPath?: string;
39
+ /**
40
+ * ReturnType that will be used when calling the client.
41
+ * - 'data' will return ResponseConfig[data].
42
+ * - 'full' will return ResponseConfig.
43
+ * @default 'data'
44
+ */
45
+ dataReturnType?: 'data' | 'full';
46
+ /**
47
+ * How to pass your params
48
+ * - 'object' will return the params and pathParams as an object.
49
+ * - 'inline' will return the params as comma separated params.
50
+ * @default 'inline'
51
+ */
52
+ paramsType?: 'object' | 'inline';
53
+ /**
54
+ * How to pass your pathParams.
55
+ * - 'object' will return the pathParams as an object.
56
+ * - 'inline' will return the pathParams as comma separated params.
57
+ * @default 'inline'
58
+ */
59
+ pathParamsType?: 'object' | 'inline';
60
+ /**
61
+ * Which parser can be used before returning the data
62
+ * - 'zod' will use `@kubb/plugin-zod` to parse the data.
63
+ * @default 'client'
64
+ */
65
+ parser?: 'client' | 'zod';
66
+ transformers?: {
67
+ /**
68
+ * Customize the names based on the type that is provided by the plugin.
69
+ */
70
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
71
+ };
72
+ /**
73
+ * Define some generators next to the client generators
74
+ */
75
+ generators?: Array<Generator<PluginClient>>;
76
+ };
77
+ type ResolvedOptions$1 = {
78
+ output: Output;
79
+ group?: Options$1['group'];
80
+ baseURL: string | undefined;
81
+ parser: NonNullable<Options$1['parser']>;
82
+ importPath: NonNullable<Options$1['importPath']>;
83
+ dataReturnType: NonNullable<Options$1['dataReturnType']>;
84
+ pathParamsType: NonNullable<Options$1['pathParamsType']>;
85
+ paramsType: NonNullable<Options$1['paramsType']>;
86
+ };
87
+ type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
88
+
5
89
  type Query = {
6
90
  /**
7
91
  * Customize the queryKey, here you can specify a suffix.
@@ -43,7 +127,6 @@ type Mutation = {
43
127
  type Infinite = {
44
128
  /**
45
129
  * Specify the params key used for `pageParam`.
46
- * Used inside `useInfiniteQuery`, `createInfiniteQueries`, `createInfiniteQuery`
47
130
  * @default `'id'`
48
131
  */
49
132
  queryParam: string;
@@ -59,42 +142,15 @@ type Infinite = {
59
142
  };
60
143
  type Options = {
61
144
  /**
62
- * @default 'hooks'
145
+ * Specify the export location for the files and define the behavior of the output
146
+ * @default { path: 'hooks', barrelType: 'named' }
63
147
  */
64
148
  output?: Output;
65
149
  /**
66
150
  * Group the @tanstack/query hooks based on the provided name.
67
151
  */
68
152
  group?: Group;
69
- client?: {
70
- /**
71
- * Path to the client that will be used to do the API calls.
72
- * It will be used as `import client from '${client.importPath}'`.
73
- * It allows both relative and absolute path.
74
- * the path will be applied as is, so relative path should be based on the file being generated.
75
- * @default '@kubb/plugin-client/client'
76
- */
77
- importPath?: string;
78
- /**
79
- * ReturnType that needs to be used when calling client().
80
- *
81
- * `Data` will return ResponseConfig[data].
82
- *
83
- * `Full` will return ResponseConfig.
84
- * @default `'data'`
85
- * @private
86
- */
87
- dataReturnType?: 'data' | 'full';
88
- };
89
- /**
90
- * ReturnType that needs to be used when calling client().
91
- *
92
- * `Data` will return ResponseConfig[data].
93
- *
94
- * `Full` will return ResponseConfig.
95
- * @default `'data'`
96
- * @private
97
- */
153
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>;
98
154
  /**
99
155
  * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
100
156
  */
@@ -107,16 +163,20 @@ type Options = {
107
163
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
108
164
  */
109
165
  override?: Array<Override<ResolvedOptions>>;
166
+ /**
167
+ * How to pass your params
168
+ * - 'object' will return the params and pathParams as an object.
169
+ * - 'inline' will return the params as comma separated params.
170
+ * @default 'inline'
171
+ */
172
+ paramsType?: 'object' | 'inline';
110
173
  /**
111
174
  * How to pass your pathParams.
112
- *
113
- * `object` will return the pathParams as an object.
114
- *
115
- * `inline` will return the pathParams as comma separated params.
116
- * @default `'inline'`
117
- * @private
175
+ * - 'object' will return the pathParams as an object.
176
+ * - 'inline' will return the pathParams as comma separated params.
177
+ * @default 'inline'
118
178
  */
119
- pathParamsType?: 'object' | 'inline';
179
+ pathParamsType?: PluginClient['options']['pathParamsType'];
120
180
  /**
121
181
  * When set, an infiniteQuery hooks will be added.
122
182
  */
@@ -130,10 +190,10 @@ type Options = {
130
190
  */
131
191
  mutation?: Mutation | false;
132
192
  /**
133
- * Which parser can be used before returning the data to `@tanstack/query`.
193
+ * Which parser should be used before returning the data to `@tanstack/query`.
134
194
  * `'zod'` will use `@kubb/plugin-zod` to parse the data.
135
195
  */
136
- parser?: 'client' | 'zod';
196
+ parser?: PluginClient['options']['parser'];
137
197
  transformers?: {
138
198
  /**
139
199
  * Customize the names based on the type that is provided by the plugin.
@@ -150,6 +210,7 @@ type ResolvedOptions = {
150
210
  baseURL: string | undefined;
151
211
  client: Required<NonNullable<PluginVueQuery['options']['client']>>;
152
212
  parser: Required<NonNullable<Options['parser']>>;
213
+ paramsType: NonNullable<Options['paramsType']>;
153
214
  pathParamsType: NonNullable<Options['pathParamsType']>;
154
215
  /**
155
216
  * Only used of infinite