@kubb/plugin-svelte-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 (41) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-WAAKXO6O.cjs → chunk-HUR476BL.cjs} +125 -21
  3. package/dist/chunk-HUR476BL.cjs.map +1 -0
  4. package/dist/{chunk-B7GVNGYU.js → chunk-LSV2AJSI.js} +125 -21
  5. package/dist/chunk-LSV2AJSI.js.map +1 -0
  6. package/dist/{chunk-TZ5HDOZR.js → chunk-NH7LXCFD.js} +15 -8
  7. package/dist/chunk-NH7LXCFD.js.map +1 -0
  8. package/dist/{chunk-DUG3WM5P.cjs → chunk-VO3QBBZG.cjs} +24 -17
  9. package/dist/chunk-VO3QBBZG.cjs.map +1 -0
  10. package/dist/components.cjs +6 -6
  11. package/dist/components.d.cts +11 -6
  12. package/dist/components.d.ts +11 -6
  13. package/dist/components.js +1 -1
  14. package/dist/generators.cjs +4 -4
  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-Cg7Z4H-7.d.cts +200 -0
  25. package/dist/types-Cg7Z4H-7.d.ts +200 -0
  26. package/package.json +14 -14
  27. package/src/components/Mutation.tsx +7 -3
  28. package/src/components/Query.tsx +62 -6
  29. package/src/components/QueryOptions.tsx +47 -7
  30. package/src/generators/__snapshots__/findByTagsObject.ts +60 -0
  31. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
  32. package/src/generators/mutationGenerator.tsx +2 -1
  33. package/src/generators/queryGenerator.tsx +3 -1
  34. package/src/plugin.ts +3 -2
  35. package/src/types.ts +18 -39
  36. package/dist/chunk-B7GVNGYU.js.map +0 -1
  37. package/dist/chunk-DUG3WM5P.cjs.map +0 -1
  38. package/dist/chunk-TZ5HDOZR.js.map +0 -1
  39. package/dist/chunk-WAAKXO6O.cjs.map +0 -1
  40. package/dist/types-s0tn0Q8J.d.cts +0 -138
  41. package/dist/types-s0tn0Q8J.d.ts +0 -138
@@ -1,138 +0,0 @@
1
- import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
2
- import { HttpMethod } from '@kubb/oas';
3
- import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
4
-
5
- type Query = {
6
- /**
7
- * Customize the queryKey, here you can specify a suffix.
8
- */
9
- key: (key: unknown[]) => unknown[];
10
- /**
11
- * Define which HttpMethods can be used for queries
12
- * @default ['get']
13
- */
14
- methods: Array<HttpMethod>;
15
- /**
16
- * Path to the useQuery that will be used to do the useQuery functionality.
17
- * It will be used as `import { useQuery } from '${importPath}'`.
18
- * It allows both relative and absolute path.
19
- * the path will be applied as is, so relative path should be based on the file being generated.
20
- * @default '@tanstack/svelte-query'
21
- */
22
- importPath?: string;
23
- };
24
- type Mutation = {
25
- /**
26
- * Customize the queryKey, here you can specify a suffix.
27
- */
28
- key: (key: unknown[]) => unknown[];
29
- /**
30
- * Define which HttpMethods can be used for mutations
31
- * @default ['post', 'put', 'delete']
32
- */
33
- methods: Array<HttpMethod>;
34
- /**
35
- * Path to the useQuery that will be used to do the useQuery functionality.
36
- * It will be used as `import { useQuery } from '${importPath}'`.
37
- * It allows both relative and absolute path.
38
- * the path will be applied as is, so relative path should be based on the file being generated.
39
- * @default '@tanstack/svelte-query'
40
- */
41
- importPath?: string;
42
- };
43
- type Options = {
44
- /**
45
- * @default 'hooks'
46
- */
47
- output?: Output;
48
- /**
49
- * Group the @tanstack/query hooks based on the provided name.
50
- */
51
- group?: Group;
52
- client?: {
53
- /**
54
- * Path to the client that will be used to do the API calls.
55
- * It will be used as `import client from '${client.importPath}'`.
56
- * It allows both relative and absolute path.
57
- * the path will be applied as is, so relative path should be based on the file being generated.
58
- * @default '@kubb/plugin-client/client'
59
- */
60
- importPath?: string;
61
- /**
62
- * ReturnType that needs to be used when calling client().
63
- *
64
- * `Data` will return ResponseConfig[data].
65
- *
66
- * `Full` will return ResponseConfig.
67
- * @default `'data'`
68
- * @private
69
- */
70
- dataReturnType?: 'data' | 'full';
71
- };
72
- /**
73
- * ReturnType that needs to be used when calling client().
74
- *
75
- * `Data` will return ResponseConfig[data].
76
- *
77
- * `Full` will return ResponseConfig.
78
- * @default `'data'`
79
- * @private
80
- */
81
- /**
82
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
83
- */
84
- exclude?: Array<Exclude>;
85
- /**
86
- * Array containing include parameters to include tags/operations/methods/paths.
87
- */
88
- include?: Array<Include>;
89
- /**
90
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
91
- */
92
- override?: Array<Override<ResolvedOptions>>;
93
- /**
94
- * How to pass your pathParams.
95
- *
96
- * `object` will return the pathParams as an object.
97
- *
98
- * `inline` will return the pathParams as comma separated params.
99
- * @default `'inline'`
100
- * @private
101
- */
102
- pathParamsType?: 'object' | 'inline';
103
- /**
104
- * Override some useQuery behaviours.
105
- */
106
- query?: Partial<Query> | false;
107
- /**
108
- * Override some useMutation behaviours.
109
- */
110
- mutation?: Mutation | false;
111
- /**
112
- * Which parser can be used before returning the data to `@tanstack/query`.
113
- * `'zod'` will use `@kubb/plugin-zod` to parse the data.
114
- */
115
- parser?: 'client' | 'zod';
116
- transformers?: {
117
- /**
118
- * Customize the names based on the type that is provided by the plugin.
119
- */
120
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
121
- };
122
- /**
123
- * Define some generators next to the svelte-query generators
124
- */
125
- generators?: Array<Generator<PluginSvelteQuery>>;
126
- };
127
- type ResolvedOptions = {
128
- output: Output;
129
- baseURL: string | undefined;
130
- client: Required<NonNullable<PluginSvelteQuery['options']['client']>>;
131
- parser: Required<NonNullable<Options['parser']>>;
132
- pathParamsType: NonNullable<Options['pathParamsType']>;
133
- query: NonNullable<Required<Query>> | false;
134
- mutation: NonNullable<Required<Mutation>> | false;
135
- };
136
- type PluginSvelteQuery = PluginFactoryOptions<'plugin-svelte-query', Options, ResolvedOptions, never, ResolvePathOptions>;
137
-
138
- export type { Options as O, PluginSvelteQuery as P };