@kubb/plugin-swr 4.21.1 → 4.22.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.
- package/dist/components.d.cts +4 -2
- package/dist/components.d.ts +3 -1
- package/dist/{generators-Dne6RR0a.js → generators-BMFIXxZt.js} +21 -5
- package/dist/generators-BMFIXxZt.js.map +1 -0
- package/dist/{generators-BxyAhcMf.cjs → generators-D41KAUiP.cjs} +21 -5
- package/dist/generators-D41KAUiP.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.cts +457 -1
- package/dist/generators.d.ts +457 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/types-DZvQyyev.d.cts +144 -0
- package/dist/types-Dlz_Xa_K.d.ts +143 -0
- package/package.json +8 -8
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +2 -2
- package/src/generators/__snapshots__/clientGetImportPath.ts +2 -2
- package/src/generators/__snapshots__/clientPostImportPath.ts +2 -2
- package/src/generators/__snapshots__/findByTags.ts +2 -2
- package/src/generators/__snapshots__/findByTagsObject.ts +2 -2
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +2 -2
- package/src/generators/__snapshots__/findByTagsTemplateString.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithZod.ts +2 -2
- package/src/generators/__snapshots__/postAsQuery.ts +2 -2
- package/src/generators/__snapshots__/updatePetById.ts +2 -2
- package/src/generators/__snapshots__/updatePetByIdParamsToTrigger.ts +2 -2
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +2 -2
- package/src/generators/mutationGenerator.tsx +2 -2
- package/src/generators/queryGenerator.tsx +2 -2
- package/dist/generators-BxyAhcMf.cjs.map +0 -1
- package/dist/generators-Dne6RR0a.js.map +0 -1
- package/dist/types-BEeE3UeI.d.ts +0 -817
- package/dist/types-DE2uAix2.d.cts +0 -818
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
+
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
3
|
+
import { PluginClient } from "@kubb/plugin-client";
|
|
4
|
+
import { Exclude, Include, OperationSchemas, Override, ResolvePathOptions } from "@kubb/plugin-oas";
|
|
5
|
+
import { HttpMethod, Oas, Operation, contentType } from "@kubb/oas";
|
|
6
|
+
import { Generator } from "@kubb/plugin-oas/generators";
|
|
7
|
+
|
|
8
|
+
//#region src/types.d.ts
|
|
9
|
+
type TransformerProps = {
|
|
10
|
+
operation: Operation;
|
|
11
|
+
schemas: OperationSchemas;
|
|
12
|
+
casing: 'camelcase' | undefined;
|
|
13
|
+
};
|
|
14
|
+
type Transformer = (props: TransformerProps) => unknown[];
|
|
15
|
+
/**
|
|
16
|
+
* Customize the queryKey
|
|
17
|
+
*/
|
|
18
|
+
type QueryKey = Transformer;
|
|
19
|
+
/**
|
|
20
|
+
* Customize the mutationKey
|
|
21
|
+
*/
|
|
22
|
+
type MutationKey = Transformer;
|
|
23
|
+
type Query = {
|
|
24
|
+
/**
|
|
25
|
+
* Define which HttpMethods can be used for queries
|
|
26
|
+
* @default ['get']
|
|
27
|
+
*/
|
|
28
|
+
methods?: Array<HttpMethod>;
|
|
29
|
+
/**
|
|
30
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
31
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
32
|
+
* Accepts relative and absolute paths.
|
|
33
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
34
|
+
* @default 'swr'
|
|
35
|
+
*/
|
|
36
|
+
importPath?: string;
|
|
37
|
+
};
|
|
38
|
+
type Mutation = {
|
|
39
|
+
/**
|
|
40
|
+
* Define which HttpMethods can be used for queries
|
|
41
|
+
* @default ['post', 'put', 'delete', 'patch']
|
|
42
|
+
*/
|
|
43
|
+
methods?: Array<HttpMethod>;
|
|
44
|
+
/**
|
|
45
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
46
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
47
|
+
* Accepts relative and absolute paths.
|
|
48
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
49
|
+
* @default 'swr/mutation'
|
|
50
|
+
*/
|
|
51
|
+
importPath?: string;
|
|
52
|
+
/**
|
|
53
|
+
* When true, mutation parameters (path params, query params, headers, body) is passed via `trigger()` instead of as hook arguments.
|
|
54
|
+
* This aligns with React Query's mutation pattern where variables are passed when triggering the mutation.
|
|
55
|
+
* @default false
|
|
56
|
+
* @deprecated This will become the default behavior in v5. Set to `true` to opt-in early.
|
|
57
|
+
*/
|
|
58
|
+
paramsToTrigger?: boolean;
|
|
59
|
+
};
|
|
60
|
+
type Options = {
|
|
61
|
+
/**
|
|
62
|
+
* Specify the export location for the files and define the behavior of the output
|
|
63
|
+
* @default { path: 'hooks', barrelType: 'named' }
|
|
64
|
+
*/
|
|
65
|
+
output?: Output<Oas>;
|
|
66
|
+
/**
|
|
67
|
+
* Define which contentType should be used.
|
|
68
|
+
* By default, the first JSON valid mediaType is used
|
|
69
|
+
*/
|
|
70
|
+
contentType?: contentType;
|
|
71
|
+
/**
|
|
72
|
+
* Group the SWR hooks based on the provided name.
|
|
73
|
+
*/
|
|
74
|
+
group?: Group;
|
|
75
|
+
/**
|
|
76
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
77
|
+
*/
|
|
78
|
+
exclude?: Array<Exclude>;
|
|
79
|
+
/**
|
|
80
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
81
|
+
*/
|
|
82
|
+
include?: Array<Include>;
|
|
83
|
+
/**
|
|
84
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
85
|
+
*/
|
|
86
|
+
override?: Array<Override<ResolvedOptions>>;
|
|
87
|
+
client?: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
88
|
+
queryKey?: QueryKey;
|
|
89
|
+
query?: Query | false;
|
|
90
|
+
mutationKey?: MutationKey;
|
|
91
|
+
mutation?: Mutation | false;
|
|
92
|
+
/**
|
|
93
|
+
* How to style your params, by default no casing is applied
|
|
94
|
+
* - 'camelcase' uses camelcase for the params names
|
|
95
|
+
*/
|
|
96
|
+
paramsCasing?: 'camelcase';
|
|
97
|
+
/**
|
|
98
|
+
* How to pass your params
|
|
99
|
+
* - 'object' returns the params and pathParams as an object.
|
|
100
|
+
* - 'inline' returns the params as comma separated params.
|
|
101
|
+
* @default 'inline'
|
|
102
|
+
*/
|
|
103
|
+
paramsType?: 'object' | 'inline';
|
|
104
|
+
/**
|
|
105
|
+
* How to pass your pathParams.
|
|
106
|
+
* - 'object' returns the pathParams as an object.
|
|
107
|
+
* - 'inline': returns the pathParams as comma separated params.
|
|
108
|
+
* @default 'inline'
|
|
109
|
+
*/
|
|
110
|
+
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
111
|
+
/**
|
|
112
|
+
* Which parser should be used before returning the data to `swr`.
|
|
113
|
+
* `'zod'` uses `@kubb/plugin-zod` to parse the data.
|
|
114
|
+
*/
|
|
115
|
+
parser?: PluginClient['options']['parser'];
|
|
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 swr generators
|
|
124
|
+
*/
|
|
125
|
+
generators?: Array<Generator<PluginSwr>>;
|
|
126
|
+
};
|
|
127
|
+
type ResolvedOptions = {
|
|
128
|
+
output: Output<Oas>;
|
|
129
|
+
client: NonNullable<PluginSwr['options']['client']>;
|
|
130
|
+
parser: Required<NonNullable<Options['parser']>>;
|
|
131
|
+
queryKey: QueryKey | undefined;
|
|
132
|
+
query: NonNullable<Required<Query>> | false;
|
|
133
|
+
mutationKey: MutationKey | undefined;
|
|
134
|
+
mutation: (Required<Pick<Mutation, 'methods' | 'importPath'>> & Pick<Mutation, 'paramsToTrigger'>) | false;
|
|
135
|
+
paramsCasing: Options['paramsCasing'];
|
|
136
|
+
paramsType: NonNullable<Options['paramsType']>;
|
|
137
|
+
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
138
|
+
group: Options['group'];
|
|
139
|
+
};
|
|
140
|
+
type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
141
|
+
//#endregion
|
|
142
|
+
export { PluginSwr as n, Transformer as r, Options as t };
|
|
143
|
+
//# sourceMappingURL=types-Dlz_Xa_K.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-swr",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.22.0",
|
|
4
4
|
"description": "SWR hooks generator plugin for Kubb, creating type-safe data fetching hooks from OpenAPI specifications for React and Next.js applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"swr",
|
|
@@ -76,13 +76,13 @@
|
|
|
76
76
|
],
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@kubb/react-fabric": "0.12.11",
|
|
79
|
-
"remeda": "^2.33.
|
|
80
|
-
"@kubb/core": "4.
|
|
81
|
-
"@kubb/oas": "4.
|
|
82
|
-
"@kubb/plugin-client": "4.
|
|
83
|
-
"@kubb/plugin-oas": "4.
|
|
84
|
-
"@kubb/plugin-ts": "4.
|
|
85
|
-
"@kubb/plugin-zod": "4.
|
|
79
|
+
"remeda": "^2.33.6",
|
|
80
|
+
"@kubb/core": "4.22.0",
|
|
81
|
+
"@kubb/oas": "4.22.0",
|
|
82
|
+
"@kubb/plugin-client": "4.22.0",
|
|
83
|
+
"@kubb/plugin-oas": "4.22.0",
|
|
84
|
+
"@kubb/plugin-ts": "4.22.0",
|
|
85
|
+
"@kubb/plugin-zod": "4.22.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
88
|
"@kubb/react-fabric": "0.12.11"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWR from 'swr'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig, ResponseConfig } from './test/.kubb/fetch'
|
|
7
7
|
import { fetch } from './test/.kubb/fetch'
|
|
8
8
|
|
|
9
9
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
15
15
|
* @summary Finds Pets by tags
|
|
16
16
|
* {@link /pet/findByTags}
|
|
17
17
|
*/
|
|
18
|
-
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?:
|
|
18
|
+
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
19
19
|
const { client: request = fetch, ...requestConfig } = config
|
|
20
20
|
|
|
21
21
|
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import fetch from 'axios'
|
|
6
6
|
import useSWR from 'swr'
|
|
7
|
-
import type { RequestConfig, ResponseErrorConfig } from 'axios'
|
|
7
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from 'axios'
|
|
8
8
|
|
|
9
9
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
10
10
|
|
|
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
15
15
|
* @summary Finds Pets by tags
|
|
16
16
|
* {@link /pet/findByTags}
|
|
17
17
|
*/
|
|
18
|
-
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?:
|
|
18
|
+
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
19
19
|
const { client: request = fetch, ...requestConfig } = config
|
|
20
20
|
|
|
21
21
|
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import fetch from 'axios'
|
|
6
6
|
import useSWRMutation from 'swr/mutation'
|
|
7
|
-
import type { RequestConfig, ResponseErrorConfig } from 'axios'
|
|
7
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from 'axios'
|
|
8
8
|
import type { SWRMutationConfiguration } from 'swr/mutation'
|
|
9
9
|
|
|
10
10
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:petId' }] as const
|
|
@@ -18,7 +18,7 @@ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMu
|
|
|
18
18
|
export async function updatePetWithForm(
|
|
19
19
|
petId: UpdatePetWithFormPathParams['petId'],
|
|
20
20
|
params?: UpdatePetWithFormQueryParams,
|
|
21
|
-
config: Partial<RequestConfig> & { client?:
|
|
21
|
+
config: Partial<RequestConfig> & { client?: Client } = {},
|
|
22
22
|
) {
|
|
23
23
|
const { client: request = fetch, ...requestConfig } = config
|
|
24
24
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWR from 'swr'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import { fetch } from './test/.kubb/fetch'
|
|
8
8
|
|
|
9
9
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
15
15
|
* @summary Finds Pets by tags
|
|
16
16
|
* {@link /pet/findByTags}
|
|
17
17
|
*/
|
|
18
|
-
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?:
|
|
18
|
+
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
19
19
|
const { client: request = fetch, ...requestConfig } = config
|
|
20
20
|
|
|
21
21
|
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWR from 'swr'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import { fetch } from './test/.kubb/fetch'
|
|
8
8
|
|
|
9
9
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
15
15
|
* @summary Finds Pets by tags
|
|
16
16
|
* {@link /pet/findByTags}
|
|
17
17
|
*/
|
|
18
|
-
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?:
|
|
18
|
+
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
19
19
|
const { client: request = fetch, ...requestConfig } = config
|
|
20
20
|
|
|
21
21
|
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWR from 'swr'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import { fetch } from './test/.kubb/fetch'
|
|
8
8
|
|
|
9
9
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
15
15
|
* @summary Finds Pets by tags
|
|
16
16
|
* {@link /pet/findByTags}
|
|
17
17
|
*/
|
|
18
|
-
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?:
|
|
18
|
+
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
19
19
|
const { client: request = fetch, ...requestConfig } = config
|
|
20
20
|
|
|
21
21
|
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWR from 'swr'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import { fetch } from './test/.kubb/fetch'
|
|
8
8
|
|
|
9
9
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
15
15
|
* @summary Finds Pets by tags
|
|
16
16
|
* {@link /pet/findByTags}
|
|
17
17
|
*/
|
|
18
|
-
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?:
|
|
18
|
+
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
19
19
|
const { client: request = fetch, ...requestConfig } = config
|
|
20
20
|
|
|
21
21
|
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWR from 'swr'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import { fetch } from './test/.kubb/fetch'
|
|
8
8
|
|
|
9
9
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
15
15
|
* @summary Finds Pets by tags
|
|
16
16
|
* {@link /pet/findByTags}
|
|
17
17
|
*/
|
|
18
|
-
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?:
|
|
18
|
+
export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams } = {}, config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
19
19
|
const { client: request = fetch, ...requestConfig } = config
|
|
20
20
|
|
|
21
21
|
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWR from 'custom-swr'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import { fetch } from './test/.kubb/fetch'
|
|
8
8
|
|
|
9
9
|
export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams) =>
|
|
@@ -17,7 +17,7 @@ export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQuery
|
|
|
17
17
|
*/
|
|
18
18
|
export async function updatePetWithForm(
|
|
19
19
|
{ petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
|
|
20
|
-
config: Partial<RequestConfig> & { client?:
|
|
20
|
+
config: Partial<RequestConfig> & { client?: Client } = {},
|
|
21
21
|
) {
|
|
22
22
|
const { client: request = fetch, ...requestConfig } = config
|
|
23
23
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWRMutation from 'swr/mutation'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import type { SWRMutationConfiguration } from 'swr/mutation'
|
|
8
8
|
import { fetch } from './test/.kubb/fetch'
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMu
|
|
|
18
18
|
export async function updatePetWithForm(
|
|
19
19
|
petId: UpdatePetWithFormPathParams['petId'],
|
|
20
20
|
params?: UpdatePetWithFormQueryParams,
|
|
21
|
-
config: Partial<RequestConfig> & { client?:
|
|
21
|
+
config: Partial<RequestConfig> & { client?: Client } = {},
|
|
22
22
|
) {
|
|
23
23
|
const { client: request = fetch, ...requestConfig } = config
|
|
24
24
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWRMutation from 'swr/mutation'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import type { SWRMutationConfiguration } from 'swr/mutation'
|
|
8
8
|
import { fetch } from './test/.kubb/fetch'
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMu
|
|
|
18
18
|
export async function updatePetWithForm(
|
|
19
19
|
petId: UpdatePetWithFormPathParams['petId'],
|
|
20
20
|
params?: UpdatePetWithFormQueryParams,
|
|
21
|
-
config: Partial<RequestConfig> & { client?:
|
|
21
|
+
config: Partial<RequestConfig> & { client?: Client } = {},
|
|
22
22
|
) {
|
|
23
23
|
const { client: request = fetch, ...requestConfig } = config
|
|
24
24
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Do not edit manually.
|
|
4
4
|
*/
|
|
5
5
|
import useSWRMutation from 'swr/mutation'
|
|
6
|
-
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
7
|
import type { SWRMutationConfiguration } from 'swr/mutation'
|
|
8
8
|
import { fetch } from './test/.kubb/fetch'
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMu
|
|
|
18
18
|
export async function updatePetWithForm(
|
|
19
19
|
{ petId }: { petId: UpdatePetWithFormPathParams['petId'] },
|
|
20
20
|
params?: UpdatePetWithFormQueryParams,
|
|
21
|
-
config: Partial<RequestConfig> & { client?:
|
|
21
|
+
config: Partial<RequestConfig> & { client?: Client } = {},
|
|
22
22
|
) {
|
|
23
23
|
const { client: request = fetch, ...requestConfig } = config
|
|
24
24
|
|
|
@@ -87,14 +87,14 @@ export const mutationGenerator = createReactGenerator<PluginSwr>({
|
|
|
87
87
|
{options.client.importPath ? (
|
|
88
88
|
<>
|
|
89
89
|
<File.Import name={'fetch'} path={options.client.importPath} />
|
|
90
|
-
<File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
90
|
+
<File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
91
91
|
{options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
|
|
92
92
|
</>
|
|
93
93
|
) : (
|
|
94
94
|
<>
|
|
95
95
|
<File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />
|
|
96
96
|
<File.Import
|
|
97
|
-
name={['RequestConfig', 'ResponseErrorConfig']}
|
|
97
|
+
name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
|
|
98
98
|
root={mutation.file.path}
|
|
99
99
|
path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
|
|
100
100
|
isTypeOnly
|
|
@@ -94,14 +94,14 @@ export const queryGenerator = createReactGenerator<PluginSwr>({
|
|
|
94
94
|
{options.client.importPath ? (
|
|
95
95
|
<>
|
|
96
96
|
<File.Import name={'fetch'} path={options.client.importPath} />
|
|
97
|
-
<File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
97
|
+
<File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
98
98
|
{options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
|
|
99
99
|
</>
|
|
100
100
|
) : (
|
|
101
101
|
<>
|
|
102
102
|
<File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />
|
|
103
103
|
<File.Import
|
|
104
|
-
name={['RequestConfig', 'ResponseErrorConfig']}
|
|
104
|
+
name={['Client', 'RequestConfig', 'ResponseErrorConfig']}
|
|
105
105
|
root={query.file.path}
|
|
106
106
|
path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
|
|
107
107
|
isTypeOnly
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-BxyAhcMf.cjs","names":["pluginTsName","pluginZodName","pluginClientName","File","path","MutationKey","Client","Mutation","pluginClientName","pluginTsName","pluginZodName","File","path","QueryKey","Client","QueryOptions","Query"],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-mutation',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n options.mutation !== false &&\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : 'swr'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={mutation.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n <File.Import name=\"useSWRMutation\" path={importPath} />\n <File.Import name={['SWRMutationConfiguration', 'SWRMutationResponse']} path={importPath} isTypeOnly />\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\n />\n\n {!shouldUseClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n mutationKeyTypeName={mutationKey.typeName}\n paramsToTrigger={options.mutation.paramsToTrigger}\n />\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : 'swr/mutation'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, {\n pluginKey: [pluginTsName],\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, {\n pluginKey: [pluginZodName],\n type: 'function',\n }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n {!shouldUseClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.client.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n />\n {options.query && (\n <>\n <File.Import name=\"useSWR\" path={importPath} />\n <File.Import name={['SWRResponse']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n paramsCasing={options.paramsCasing}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAa,0EAAoD;CAC/D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,wDAAkC;EAExC,MAAM,0CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,4DAAgC,UAAU;EAEvE,MAAM,UAAU,CAAC,CAAC,QAAQ,SAAS,QAAQ,OAAO,QAAQ,MAAM,WAAW,UAAU,WAAW,OAAO;EACvG,MAAM,aAC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AgB,QAAQ;KACrD,YAAY,QAAQ;KACpB,gBAAgB,QAAQ;KACxB,QAAQ,QAAQ;MAChB;IAEJ,wDAACC;KACC,MAAM,aAAa;KACnB,YAAY,OAAO;KACnB,aAAa,KAAK;KAClB,YAAY,QAAQ;KACpB,cAAc,QAAQ;KACtB,gBAAgB,QAAQ;MACxB;IACD,QAAQ,SACP;KACE,wDAACJ,wBAAK;MAAO,MAAK;MAAS,MAAM;OAAc;KAC/C,wDAACA,wBAAK;MAAO,MAAM,CAAC,cAAc;MAAE,MAAM;MAAY;OAAa;KACnE,wDAACK;MACC,MAAM,MAAM;MACZ,kBAAkB,aAAa;MAC/B,aAAa,KAAK;MAClB,YAAY,QAAQ;MACpB,gBAAgB,QAAQ;MACb;MACX,gBAAgB,QAAQ,OAAO,kBAAkB;MACjD,cAAc,SAAS;MACvB,cAAc,QAAQ;MACtB,kBAAkB,SAAS;OAC3B;QACD;;IAEA;;CAGZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-Dne6RR0a.js","names":[],"sources":["../src/generators/mutationGenerator.tsx","../src/generators/queryGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-mutation',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n options.mutation !== false &&\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : 'swr'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File\n baseName={mutation.file.baseName}\n path={mutation.file.path}\n meta={mutation.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={mutation.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import\n name={['ResponseConfig']}\n root={mutation.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n </>\n )}\n <File.Import name=\"useSWRMutation\" path={importPath} />\n <File.Import name={['SWRMutationConfiguration', 'SWRMutationResponse']} path={importPath} isTypeOnly />\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.mutationKey}\n />\n\n {!shouldUseClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n {options.mutation && (\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n mutationKeyTypeName={mutationKey.typeName}\n paramsToTrigger={options.mutation.paramsToTrigger}\n />\n )}\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginSwr } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginSwr>({\n name: 'swr-query',\n Operation({ config, operation, generator, plugin }) {\n const {\n options,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : 'swr/mutation'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])\n // Class-based clients are not compatible with query hooks, so we generate inline clients\n const shouldUseClientPlugin = hasClientPlugin && options.client.clientType !== 'class'\n const client = {\n name: shouldUseClientPlugin\n ? getName(operation, {\n type: 'function',\n pluginKey: [pluginClientName],\n })\n : getName(operation, {\n type: 'function',\n }),\n file: getFile(operation, { pluginKey: [pluginClientName] }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, {\n pluginKey: [pluginTsName],\n type: 'type',\n }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, {\n pluginKey: [pluginZodName],\n type: 'function',\n }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File\n baseName={query.file.baseName}\n path={query.file.path}\n meta={query.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />\n )}\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={query.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n {shouldUseClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}\n {!shouldUseClientPlugin && (\n <File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n paramsCasing={options.paramsCasing}\n transformer={options.queryKey}\n />\n {!shouldUseClientPlugin && (\n <Client\n name={client.name}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsCasing={options.client.paramsCasing || options.paramsCasing}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n )}\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n paramsCasing={options.paramsCasing}\n pathParamsType={options.pathParamsType}\n />\n {options.query && (\n <>\n <File.Import name=\"useSWR\" path={importPath} />\n <File.Import name={['SWRResponse']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType || 'data'}\n queryKeyName={queryKey.name}\n paramsCasing={options.paramsCasing}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAa,oBAAoB,qBAAgC;CAC/D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EACJ,SACA,SAAS,EAAE,aACT;EACJ,MAAM,gBAAgB,kBAAkB;EAExC,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