@kubb/plugin-client 5.0.0-alpha.3 → 5.0.0-alpha.31

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/dist/clients/axios.d.ts +2 -2
  2. package/dist/index.cjs +1893 -74
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +480 -4
  5. package/dist/index.js +1885 -77
  6. package/dist/index.js.map +1 -1
  7. package/package.json +10 -25
  8. package/src/components/ClassClient.tsx +42 -138
  9. package/src/components/Client.tsx +85 -124
  10. package/src/components/ClientLegacy.tsx +501 -0
  11. package/src/components/Operations.tsx +8 -8
  12. package/src/components/StaticClassClient.tsx +41 -135
  13. package/src/components/Url.tsx +37 -46
  14. package/src/generators/classClientGenerator.tsx +125 -148
  15. package/src/generators/clientGenerator.tsx +93 -82
  16. package/src/generators/groupedClientGenerator.tsx +47 -50
  17. package/src/generators/operationsGenerator.tsx +9 -17
  18. package/src/generators/staticClassClientGenerator.tsx +159 -164
  19. package/src/index.ts +11 -1
  20. package/src/plugin.ts +115 -108
  21. package/src/presets.ts +25 -0
  22. package/src/resolvers/resolverClient.ts +26 -0
  23. package/src/resolvers/resolverClientLegacy.ts +26 -0
  24. package/src/types.ts +105 -40
  25. package/src/utils.ts +148 -0
  26. package/dist/StaticClassClient-By-aMAe4.cjs +0 -677
  27. package/dist/StaticClassClient-By-aMAe4.cjs.map +0 -1
  28. package/dist/StaticClassClient-CCn9g9eF.js +0 -636
  29. package/dist/StaticClassClient-CCn9g9eF.js.map +0 -1
  30. package/dist/components.cjs +0 -7
  31. package/dist/components.d.ts +0 -216
  32. package/dist/components.js +0 -2
  33. package/dist/generators-C2jT7XCH.js +0 -723
  34. package/dist/generators-C2jT7XCH.js.map +0 -1
  35. package/dist/generators-qkDW17Hf.cjs +0 -753
  36. package/dist/generators-qkDW17Hf.cjs.map +0 -1
  37. package/dist/generators.cjs +0 -7
  38. package/dist/generators.d.ts +0 -512
  39. package/dist/generators.js +0 -2
  40. package/dist/types-CdM4DK1M.d.ts +0 -169
  41. package/src/components/index.ts +0 -5
  42. package/src/generators/index.ts +0 -5
@@ -1,169 +0,0 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
3
- import { Exclude, Include, Override, ResolvePathOptions } from "@kubb/plugin-oas";
4
- import { Generator } from "@kubb/plugin-oas/generators";
5
- import { Oas, contentType } from "@kubb/oas";
6
-
7
- //#region src/types.d.ts
8
- /**
9
- * Use either a preset `client` type OR a custom `importPath`, not both.
10
- * `importPath` will override the default `client` preset when both are provided.
11
- * These options are mutually exclusive. `bundle` and `importPath` are also
12
- * mutually exclusive since `bundle` only has effect when `importPath` is not set.
13
- */
14
- type ClientImportPath = {
15
- /**
16
- * Which client should be used to do the HTTP calls.
17
- * - 'axios' uses axios client for HTTP requests.
18
- * - 'fetch' uses native fetch API for HTTP requests.
19
- * @default 'axios'
20
- */
21
- client?: 'axios' | 'fetch';
22
- importPath?: never;
23
- } | {
24
- client?: never;
25
- /**
26
- * Client import path for API calls.
27
- * Used as `import client from '${importPath}'`.
28
- * Accepts relative and absolute paths; path changes are not performed.
29
- */
30
- importPath: string;
31
- /**
32
- * `bundle` has no effect when `importPath` is set.
33
- * Use either `bundle` (with `client`) or `importPath`, not both.
34
- */
35
- bundle?: never;
36
- };
37
- type Options = {
38
- /**
39
- * Specify the export location for the files and define the behavior of the output
40
- * @default { path: 'clients', barrelType: 'named' }
41
- */
42
- output?: Output<Oas>;
43
- /**
44
- * Define which contentType should be used.
45
- * By default, the first JSON valid mediaType is used
46
- */
47
- contentType?: contentType;
48
- /**
49
- * Group the clients based on the provided name.
50
- */
51
- group?: Group;
52
- /**
53
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
54
- */
55
- exclude?: Array<Exclude>;
56
- /**
57
- * Array containing include parameters to include tags/operations/methods/paths.
58
- */
59
- include?: Array<Include>;
60
- /**
61
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
62
- */
63
- override?: Array<Override<ResolvedOptions>>;
64
- /**
65
- * Create `operations.ts` file with all operations grouped by methods.
66
- * @default false
67
- */
68
- operations?: boolean;
69
- /**
70
- * Export urls that are used by operation x.
71
- * - 'export' makes them part of your barrel file.
72
- * - false does not make them exportable.
73
- * @default false
74
- * @example getGetPetByIdUrl
75
- */
76
- urlType?: 'export' | false;
77
- /**
78
- * Allows you to set a custom base url for all generated calls.
79
- */
80
- baseURL?: string;
81
- /**
82
- * ReturnType that is used when calling the client.
83
- * - 'data' returns ResponseConfig[data].
84
- * - 'full' returns ResponseConfig.
85
- * @default 'data'
86
- */
87
- dataReturnType?: 'data' | 'full';
88
- /**
89
- * How to style your params, by default no casing is applied
90
- * - 'camelcase' uses camelCase for pathParams, queryParams and headerParams names
91
- * @note response types (data/body) are not affected by this option
92
- */
93
- paramsCasing?: 'camelcase';
94
- /**
95
- * How to pass your params.
96
- * - 'object' returns the params and pathParams as an object.
97
- * - 'inline' returns the params as comma separated params.
98
- * @default 'inline'
99
- */
100
- paramsType?: 'object' | 'inline';
101
- /**
102
- * How to pass your pathParams.
103
- * - 'object' returns the pathParams as an object.
104
- * - 'inline' returns the pathParams as comma separated params.
105
- * @default 'inline'
106
- */
107
- pathParamsType?: 'object' | 'inline';
108
- /**
109
- * Which parser can be used before returning the data.
110
- * - 'client' returns the data as-is from the client.
111
- * - 'zod' uses @kubb/plugin-zod to parse the data.
112
- * @default 'client'
113
- */
114
- parser?: 'client' | 'zod';
115
- /**
116
- * How to generate the client code.
117
- * - 'function' generates standalone functions for each operation.
118
- * - 'class' generates a class with methods for each operation.
119
- * - 'staticClass' generates a class with static methods for each operation.
120
- * @default 'function'
121
- */
122
- clientType?: 'function' | 'class' | 'staticClass';
123
- /**
124
- * Bundle the selected client into the generated `.kubb` directory.
125
- * When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
126
- * @default false
127
- * In version 5 of Kubb this is by default true
128
- */
129
- bundle?: boolean;
130
- /**
131
- * Generate a wrapper class that composes all tag-based client classes into a single entry point.
132
- */
133
- wrapper?: {
134
- /**
135
- * Name of the wrapper class.
136
- */
137
- className: string;
138
- };
139
- transformers?: {
140
- /**
141
- * Customize the names based on the type that is provided by the plugin.
142
- */
143
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
144
- };
145
- /**
146
- * Define some generators next to the client generators
147
- */
148
- generators?: Array<Generator<PluginClient>>;
149
- } & ClientImportPath;
150
- type ResolvedOptions = {
151
- output: Output<Oas>;
152
- group?: Options['group'];
153
- baseURL: string | undefined;
154
- client: Options['client'];
155
- clientType: NonNullable<Options['clientType']>;
156
- bundle: NonNullable<Options['bundle']>;
157
- parser: NonNullable<Options['parser']>;
158
- urlType: NonNullable<Options['urlType']>;
159
- importPath: Options['importPath'];
160
- dataReturnType: NonNullable<Options['dataReturnType']>;
161
- pathParamsType: NonNullable<Options['pathParamsType']>;
162
- paramsType: NonNullable<Options['paramsType']>;
163
- paramsCasing: Options['paramsCasing'];
164
- wrapper: Options['wrapper'];
165
- };
166
- type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
167
- //#endregion
168
- export { Options as n, PluginClient as r, ClientImportPath as t };
169
- //# sourceMappingURL=types-CdM4DK1M.d.ts.map
@@ -1,5 +0,0 @@
1
- export { ClassClient } from './ClassClient.tsx'
2
- export { Client } from './Client.tsx'
3
- export { Operations } from './Operations.tsx'
4
- export { StaticClassClient } from './StaticClassClient.tsx'
5
- export { Url } from './Url.tsx'
@@ -1,5 +0,0 @@
1
- export { classClientGenerator } from './classClientGenerator.tsx'
2
- export { clientGenerator } from './clientGenerator.tsx'
3
- export { groupedClientGenerator } from './groupedClientGenerator.tsx'
4
- export { operationsGenerator } from './operationsGenerator.tsx'
5
- export { staticClassClientGenerator } from './staticClassClientGenerator.tsx'