@kubb/plugin-swr 3.0.0-beta.9 → 3.0.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/{chunk-H23WKEYP.js → chunk-2KDZWGWG.js} +122 -23
- package/dist/chunk-2KDZWGWG.js.map +1 -0
- package/dist/{chunk-PTOQHHST.cjs → chunk-64KLXAGI.cjs} +45 -28
- package/dist/chunk-64KLXAGI.cjs.map +1 -0
- package/dist/{chunk-JWGWABV5.cjs → chunk-AFAHUG3Q.cjs} +129 -30
- package/dist/chunk-AFAHUG3Q.cjs.map +1 -0
- package/dist/{chunk-4EGGCGSE.js → chunk-T6K6P5I7.js} +43 -26
- package/dist/chunk-T6K6P5I7.js.map +1 -0
- package/dist/components.cjs +6 -6
- package/dist/components.d.cts +15 -9
- package/dist/components.d.ts +15 -9
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +23 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -23
- package/dist/index.js.map +1 -1
- package/dist/types-AhGZx7jH.d.cts +272 -0
- package/dist/types-AhGZx7jH.d.ts +272 -0
- package/package.json +13 -13
- package/src/components/Mutation.tsx +15 -4
- package/src/components/MutationKey.tsx +11 -5
- package/src/components/Query.tsx +63 -6
- package/src/components/QueryKey.tsx +17 -7
- package/src/components/QueryOptions.tsx +47 -7
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +11 -5
- package/src/generators/__snapshots__/clientGetImportPath.ts +11 -5
- package/src/generators/__snapshots__/findByTags.ts +11 -5
- package/src/generators/__snapshots__/findByTagsObject.ts +49 -0
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +11 -5
- package/src/generators/__snapshots__/findByTagsWithZod.ts +11 -5
- package/src/generators/__snapshots__/postAsQuery.ts +14 -5
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
- package/src/generators/mutationGenerator.tsx +26 -18
- package/src/generators/queryGenerator.tsx +26 -13
- package/src/plugin.ts +21 -21
- package/src/types.ts +71 -46
- package/dist/chunk-4EGGCGSE.js.map +0 -1
- package/dist/chunk-H23WKEYP.js.map +0 -1
- package/dist/chunk-JWGWABV5.cjs.map +0 -1
- package/dist/chunk-PTOQHHST.cjs.map +0 -1
- package/dist/types-Bt7A3YoC.d.cts +0 -101
- package/dist/types-Bt7A3YoC.d.ts +0 -101
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
|
|
2
|
-
import { HttpMethod } from '@kubb/oas';
|
|
3
|
-
import { PluginClient } from '@kubb/plugin-client';
|
|
4
|
-
import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
|
|
5
|
-
|
|
6
|
-
type Options = {
|
|
7
|
-
/**
|
|
8
|
-
* Specify the export location for the files and define the behavior of the output
|
|
9
|
-
* @default { path: 'hooks', barrelType: 'named' }
|
|
10
|
-
*/
|
|
11
|
-
output?: Output;
|
|
12
|
-
/**
|
|
13
|
-
* Group the SWR hooks based on the provided name.
|
|
14
|
-
*/
|
|
15
|
-
group?: Group;
|
|
16
|
-
/**
|
|
17
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
18
|
-
*/
|
|
19
|
-
exclude?: Array<Exclude>;
|
|
20
|
-
/**
|
|
21
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
22
|
-
*/
|
|
23
|
-
include?: Array<Include>;
|
|
24
|
-
/**
|
|
25
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
26
|
-
*/
|
|
27
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
28
|
-
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>;
|
|
29
|
-
query?: {
|
|
30
|
-
/**
|
|
31
|
-
* Customize the queryKey, here you can specify a suffix.
|
|
32
|
-
*/
|
|
33
|
-
key: (key: unknown[]) => unknown[];
|
|
34
|
-
/**
|
|
35
|
-
* Define which HttpMethods can be used for queries
|
|
36
|
-
* @default ['get']
|
|
37
|
-
*/
|
|
38
|
-
methods?: Array<HttpMethod>;
|
|
39
|
-
/**
|
|
40
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
41
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
42
|
-
* It allows both relative and absolute path.
|
|
43
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
44
|
-
* @default 'swr'
|
|
45
|
-
*/
|
|
46
|
-
importPath?: string;
|
|
47
|
-
};
|
|
48
|
-
mutation?: {
|
|
49
|
-
/**
|
|
50
|
-
* Customize the queryKey, here you can specify a suffix.
|
|
51
|
-
*/
|
|
52
|
-
key: (key: unknown[]) => unknown[];
|
|
53
|
-
/**
|
|
54
|
-
* Define which HttpMethods can be used for queries
|
|
55
|
-
* @default ['post', 'put', 'delete', 'patch']
|
|
56
|
-
*/
|
|
57
|
-
methods?: Array<HttpMethod>;
|
|
58
|
-
/**
|
|
59
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
60
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
61
|
-
* It allows both relative and absolute path.
|
|
62
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
63
|
-
* @default 'swr/mutation'
|
|
64
|
-
*/
|
|
65
|
-
importPath?: string;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* How to pass your pathParams.
|
|
69
|
-
* - 'object' will return the pathParams as an object.
|
|
70
|
-
* - 'inline' will return the pathParams as comma separated params.
|
|
71
|
-
* @default 'inline'
|
|
72
|
-
*/
|
|
73
|
-
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
74
|
-
/**
|
|
75
|
-
* Which parser can be used before returning the data to `swr`.
|
|
76
|
-
* `'zod'` will use `@kubb/plugin-zod` to parse the data.
|
|
77
|
-
*/
|
|
78
|
-
parser?: PluginClient['options']['parser'];
|
|
79
|
-
transformers?: {
|
|
80
|
-
/**
|
|
81
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
82
|
-
*/
|
|
83
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Define some generators next to the swr generators
|
|
87
|
-
*/
|
|
88
|
-
generators?: Array<Generator<PluginSwr>>;
|
|
89
|
-
};
|
|
90
|
-
type ResolvedOptions = {
|
|
91
|
-
output: Output;
|
|
92
|
-
baseURL: string | undefined;
|
|
93
|
-
client: Required<NonNullable<Options['client']>>;
|
|
94
|
-
parser: Required<NonNullable<Options['parser']>>;
|
|
95
|
-
mutation: Required<NonNullable<Options['mutation']>>;
|
|
96
|
-
query: Required<NonNullable<Options['query']>>;
|
|
97
|
-
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
98
|
-
};
|
|
99
|
-
type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
100
|
-
|
|
101
|
-
export type { Options as O, PluginSwr as P };
|
package/dist/types-Bt7A3YoC.d.ts
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
|
|
2
|
-
import { HttpMethod } from '@kubb/oas';
|
|
3
|
-
import { PluginClient } from '@kubb/plugin-client';
|
|
4
|
-
import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
|
|
5
|
-
|
|
6
|
-
type Options = {
|
|
7
|
-
/**
|
|
8
|
-
* Specify the export location for the files and define the behavior of the output
|
|
9
|
-
* @default { path: 'hooks', barrelType: 'named' }
|
|
10
|
-
*/
|
|
11
|
-
output?: Output;
|
|
12
|
-
/**
|
|
13
|
-
* Group the SWR hooks based on the provided name.
|
|
14
|
-
*/
|
|
15
|
-
group?: Group;
|
|
16
|
-
/**
|
|
17
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
18
|
-
*/
|
|
19
|
-
exclude?: Array<Exclude>;
|
|
20
|
-
/**
|
|
21
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
22
|
-
*/
|
|
23
|
-
include?: Array<Include>;
|
|
24
|
-
/**
|
|
25
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
26
|
-
*/
|
|
27
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
28
|
-
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>;
|
|
29
|
-
query?: {
|
|
30
|
-
/**
|
|
31
|
-
* Customize the queryKey, here you can specify a suffix.
|
|
32
|
-
*/
|
|
33
|
-
key: (key: unknown[]) => unknown[];
|
|
34
|
-
/**
|
|
35
|
-
* Define which HttpMethods can be used for queries
|
|
36
|
-
* @default ['get']
|
|
37
|
-
*/
|
|
38
|
-
methods?: Array<HttpMethod>;
|
|
39
|
-
/**
|
|
40
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
41
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
42
|
-
* It allows both relative and absolute path.
|
|
43
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
44
|
-
* @default 'swr'
|
|
45
|
-
*/
|
|
46
|
-
importPath?: string;
|
|
47
|
-
};
|
|
48
|
-
mutation?: {
|
|
49
|
-
/**
|
|
50
|
-
* Customize the queryKey, here you can specify a suffix.
|
|
51
|
-
*/
|
|
52
|
-
key: (key: unknown[]) => unknown[];
|
|
53
|
-
/**
|
|
54
|
-
* Define which HttpMethods can be used for queries
|
|
55
|
-
* @default ['post', 'put', 'delete', 'patch']
|
|
56
|
-
*/
|
|
57
|
-
methods?: Array<HttpMethod>;
|
|
58
|
-
/**
|
|
59
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
60
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
61
|
-
* It allows both relative and absolute path.
|
|
62
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
63
|
-
* @default 'swr/mutation'
|
|
64
|
-
*/
|
|
65
|
-
importPath?: string;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* How to pass your pathParams.
|
|
69
|
-
* - 'object' will return the pathParams as an object.
|
|
70
|
-
* - 'inline' will return the pathParams as comma separated params.
|
|
71
|
-
* @default 'inline'
|
|
72
|
-
*/
|
|
73
|
-
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
74
|
-
/**
|
|
75
|
-
* Which parser can be used before returning the data to `swr`.
|
|
76
|
-
* `'zod'` will use `@kubb/plugin-zod` to parse the data.
|
|
77
|
-
*/
|
|
78
|
-
parser?: PluginClient['options']['parser'];
|
|
79
|
-
transformers?: {
|
|
80
|
-
/**
|
|
81
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
82
|
-
*/
|
|
83
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Define some generators next to the swr generators
|
|
87
|
-
*/
|
|
88
|
-
generators?: Array<Generator<PluginSwr>>;
|
|
89
|
-
};
|
|
90
|
-
type ResolvedOptions = {
|
|
91
|
-
output: Output;
|
|
92
|
-
baseURL: string | undefined;
|
|
93
|
-
client: Required<NonNullable<Options['client']>>;
|
|
94
|
-
parser: Required<NonNullable<Options['parser']>>;
|
|
95
|
-
mutation: Required<NonNullable<Options['mutation']>>;
|
|
96
|
-
query: Required<NonNullable<Options['query']>>;
|
|
97
|
-
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
98
|
-
};
|
|
99
|
-
type PluginSwr = PluginFactoryOptions<'plugin-swr', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
100
|
-
|
|
101
|
-
export type { Options as O, PluginSwr as P };
|