@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.
- package/dist/clients/axios.d.ts +2 -2
- package/dist/index.cjs +1893 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +480 -4
- package/dist/index.js +1885 -77
- package/dist/index.js.map +1 -1
- package/package.json +10 -25
- package/src/components/ClassClient.tsx +42 -138
- package/src/components/Client.tsx +85 -124
- package/src/components/ClientLegacy.tsx +501 -0
- package/src/components/Operations.tsx +8 -8
- package/src/components/StaticClassClient.tsx +41 -135
- package/src/components/Url.tsx +37 -46
- package/src/generators/classClientGenerator.tsx +125 -148
- package/src/generators/clientGenerator.tsx +93 -82
- package/src/generators/groupedClientGenerator.tsx +47 -50
- package/src/generators/operationsGenerator.tsx +9 -17
- package/src/generators/staticClassClientGenerator.tsx +159 -164
- package/src/index.ts +11 -1
- package/src/plugin.ts +115 -108
- package/src/presets.ts +25 -0
- package/src/resolvers/resolverClient.ts +26 -0
- package/src/resolvers/resolverClientLegacy.ts +26 -0
- package/src/types.ts +105 -40
- package/src/utils.ts +148 -0
- package/dist/StaticClassClient-By-aMAe4.cjs +0 -677
- package/dist/StaticClassClient-By-aMAe4.cjs.map +0 -1
- package/dist/StaticClassClient-CCn9g9eF.js +0 -636
- package/dist/StaticClassClient-CCn9g9eF.js.map +0 -1
- package/dist/components.cjs +0 -7
- package/dist/components.d.ts +0 -216
- package/dist/components.js +0 -2
- package/dist/generators-C2jT7XCH.js +0 -723
- package/dist/generators-C2jT7XCH.js.map +0 -1
- package/dist/generators-qkDW17Hf.cjs +0 -753
- package/dist/generators-qkDW17Hf.cjs.map +0 -1
- package/dist/generators.cjs +0 -7
- package/dist/generators.d.ts +0 -512
- package/dist/generators.js +0 -2
- package/dist/types-CdM4DK1M.d.ts +0 -169
- package/src/components/index.ts +0 -5
- package/src/generators/index.ts +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,486 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { PluginTs } from "@kubb/plugin-ts";
|
|
3
|
+
import { FunctionParams } from "@kubb/react-fabric";
|
|
4
|
+
import * as _$_kubb_core0 from "@kubb/core";
|
|
5
|
+
import { CompatibilityPreset, Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, ResolvePathOptions, Resolver, UserGroup } from "@kubb/core";
|
|
6
|
+
import { PluginZod } from "@kubb/plugin-zod";
|
|
7
|
+
import { FunctionParametersNode, OperationNode, Visitor } from "@kubb/ast/types";
|
|
8
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
4
9
|
|
|
10
|
+
//#region src/types.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* The concrete resolver type for `@kubb/plugin-client`.
|
|
13
|
+
* Extends the base `Resolver` with a `resolveName` helper for client function names.
|
|
14
|
+
*/
|
|
15
|
+
type ResolverClient = Resolver & {
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the function name for a given raw operation name.
|
|
18
|
+
* @example
|
|
19
|
+
* resolver.resolveName('show pet by id') // -> 'showPetById'
|
|
20
|
+
*/
|
|
21
|
+
resolveName(this: ResolverClient, name: string): string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Use either a preset `client` type OR a custom `importPath`, not both.
|
|
25
|
+
* `importPath` will override the default `client` preset when both are provided.
|
|
26
|
+
* These options are mutually exclusive. `bundle` and `importPath` are also
|
|
27
|
+
* mutually exclusive since `bundle` only has effect when `importPath` is not set.
|
|
28
|
+
*/
|
|
29
|
+
type ClientImportPath = {
|
|
30
|
+
/**
|
|
31
|
+
* Which client should be used to do the HTTP calls.
|
|
32
|
+
* - 'axios' uses axios client for HTTP requests.
|
|
33
|
+
* - 'fetch' uses native fetch API for HTTP requests.
|
|
34
|
+
* @default 'axios'
|
|
35
|
+
*/
|
|
36
|
+
client?: 'axios' | 'fetch';
|
|
37
|
+
importPath?: never;
|
|
38
|
+
} | {
|
|
39
|
+
client?: never;
|
|
40
|
+
/**
|
|
41
|
+
* Client import path for API calls.
|
|
42
|
+
* Used as `import client from '${importPath}'`.
|
|
43
|
+
* Accepts relative and absolute paths; path changes are not performed.
|
|
44
|
+
*/
|
|
45
|
+
importPath: string;
|
|
46
|
+
/**
|
|
47
|
+
* `bundle` has no effect when `importPath` is set.
|
|
48
|
+
* Use either `bundle` (with `client`) or `importPath`, not both.
|
|
49
|
+
*/
|
|
50
|
+
bundle?: never;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Discriminated union that ties `pathParamsType` to the `paramsType` values where it is meaningful.
|
|
54
|
+
*
|
|
55
|
+
* - `paramsType: 'object'` — all parameters (including path params) are merged into a single
|
|
56
|
+
* destructured object. `pathParamsType` is never reached in this code path and has no effect.
|
|
57
|
+
* - `paramsType?: 'inline'` (or omitted) — each parameter group is a separate function argument.
|
|
58
|
+
* `pathParamsType` controls whether the path-param group itself is destructured (`'object'`)
|
|
59
|
+
* or spread as individual arguments (`'inline'`).
|
|
60
|
+
*/
|
|
61
|
+
type ParamsTypeOptions = {
|
|
62
|
+
/**
|
|
63
|
+
* All parameters — path, query, headers, and body — are merged into a single
|
|
64
|
+
* destructured object argument.
|
|
65
|
+
* - 'object' returns the params and pathParams as an object.
|
|
66
|
+
* @default 'inline'
|
|
67
|
+
*/
|
|
68
|
+
paramsType: 'object';
|
|
69
|
+
/**
|
|
70
|
+
* `pathParamsType` has no effect when `paramsType` is `'object'`.
|
|
71
|
+
* Path params are already inside the single destructured object.
|
|
72
|
+
*/
|
|
73
|
+
pathParamsType?: never;
|
|
74
|
+
} | {
|
|
75
|
+
/**
|
|
76
|
+
* Each parameter group is emitted as a separate function argument.
|
|
77
|
+
* - 'inline' returns the params as comma separated params.
|
|
78
|
+
* @default 'inline'
|
|
79
|
+
*/
|
|
80
|
+
paramsType?: 'inline';
|
|
81
|
+
/**
|
|
82
|
+
* Controls how path parameters are arranged within the inline argument list.
|
|
83
|
+
* - 'object' groups path params into a destructured object: `{ petId }: PathParams`.
|
|
84
|
+
* - 'inline' emits each path param as its own argument: `petId: string`.
|
|
85
|
+
* @default 'inline'
|
|
86
|
+
*/
|
|
87
|
+
pathParamsType?: 'object' | 'inline';
|
|
88
|
+
};
|
|
89
|
+
type Options = {
|
|
90
|
+
/**
|
|
91
|
+
* Specify the export location for the files and define the behavior of the output.
|
|
92
|
+
* @default { path: 'clients', barrelType: 'named' }
|
|
93
|
+
*/
|
|
94
|
+
output?: Output;
|
|
95
|
+
/**
|
|
96
|
+
* Group the clients based on the provided name.
|
|
97
|
+
*/
|
|
98
|
+
group?: UserGroup;
|
|
99
|
+
/**
|
|
100
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
101
|
+
*/
|
|
102
|
+
exclude?: Array<Exclude>;
|
|
103
|
+
/**
|
|
104
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
105
|
+
*/
|
|
106
|
+
include?: Array<Include>;
|
|
107
|
+
/**
|
|
108
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
109
|
+
*/
|
|
110
|
+
override?: Array<Override<ResolvedOptions>>;
|
|
111
|
+
/**
|
|
112
|
+
* Create `operations.ts` file with all operations grouped by methods.
|
|
113
|
+
* @default false
|
|
114
|
+
*/
|
|
115
|
+
operations?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Export urls that are used by operation x.
|
|
118
|
+
* - 'export' makes them part of your barrel file.
|
|
119
|
+
* - false does not make them exportable.
|
|
120
|
+
* @default false
|
|
121
|
+
* @example getGetPetByIdUrl
|
|
122
|
+
*/
|
|
123
|
+
urlType?: 'export' | false;
|
|
124
|
+
/**
|
|
125
|
+
* Allows you to set a custom base url for all generated calls.
|
|
126
|
+
*/
|
|
127
|
+
baseURL?: string;
|
|
128
|
+
/**
|
|
129
|
+
* ReturnType that is used when calling the client.
|
|
130
|
+
* - 'data' returns ResponseConfig[data].
|
|
131
|
+
* - 'full' returns ResponseConfig.
|
|
132
|
+
* @default 'data'
|
|
133
|
+
*/
|
|
134
|
+
dataReturnType?: 'data' | 'full';
|
|
135
|
+
/**
|
|
136
|
+
* How to style your params, by default no casing is applied.
|
|
137
|
+
* - 'camelcase' uses camelCase for pathParams, queryParams and headerParams names
|
|
138
|
+
* @note response types (data/body) are not affected by this option
|
|
139
|
+
*/
|
|
140
|
+
paramsCasing?: 'camelcase';
|
|
141
|
+
/**
|
|
142
|
+
* Which parser can be used before returning the data.
|
|
143
|
+
* - 'client' returns the data as-is from the client.
|
|
144
|
+
* - 'zod' uses @kubb/plugin-zod to parse the data.
|
|
145
|
+
* @default 'client'
|
|
146
|
+
*/
|
|
147
|
+
parser?: 'client' | 'zod';
|
|
148
|
+
/**
|
|
149
|
+
* How to generate the client code.
|
|
150
|
+
* - 'function' generates standalone functions for each operation.
|
|
151
|
+
* - 'class' generates a class with methods for each operation.
|
|
152
|
+
* - 'staticClass' generates a class with static methods for each operation.
|
|
153
|
+
* @default 'function'
|
|
154
|
+
*/
|
|
155
|
+
clientType?: 'function' | 'class' | 'staticClass';
|
|
156
|
+
/**
|
|
157
|
+
* Bundle the selected client into the generated `.kubb` directory.
|
|
158
|
+
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
159
|
+
* @default false
|
|
160
|
+
* In version 5 of Kubb this is by default true
|
|
161
|
+
*/
|
|
162
|
+
bundle?: boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Generate a wrapper class that composes all tag-based client classes into a single entry point.
|
|
165
|
+
*/
|
|
166
|
+
wrapper?: {
|
|
167
|
+
/**
|
|
168
|
+
* Name of the wrapper class.
|
|
169
|
+
*/
|
|
170
|
+
className: string;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Apply a compatibility naming preset.
|
|
174
|
+
* @default 'default'
|
|
175
|
+
*/
|
|
176
|
+
compatibilityPreset?: CompatibilityPreset;
|
|
177
|
+
/**
|
|
178
|
+
* Override individual resolver methods. Any method you omit falls back to the
|
|
179
|
+
* preset resolver's implementation. Use `this.default(...)` to call it.
|
|
180
|
+
*/
|
|
181
|
+
resolver?: Partial<ResolverClient> & ThisType<ResolverClient>;
|
|
182
|
+
/**
|
|
183
|
+
* Single AST visitor applied to each node before printing.
|
|
184
|
+
* Return `null` or `undefined` from a method to leave the node unchanged.
|
|
185
|
+
*/
|
|
186
|
+
transformer?: Visitor;
|
|
187
|
+
/**
|
|
188
|
+
* Define some generators next to the client generators.
|
|
189
|
+
*/
|
|
190
|
+
generators?: Array<Generator<PluginClient>>;
|
|
191
|
+
} & ClientImportPath & ParamsTypeOptions;
|
|
192
|
+
type ResolvedOptions = {
|
|
193
|
+
output: Output;
|
|
194
|
+
exclude: Array<Exclude>;
|
|
195
|
+
include: Array<Include> | undefined;
|
|
196
|
+
override: Array<Override<ResolvedOptions>>;
|
|
197
|
+
group: Group | undefined;
|
|
198
|
+
client: Options['client'];
|
|
199
|
+
clientType: NonNullable<Options['clientType']>;
|
|
200
|
+
bundle: NonNullable<Options['bundle']>;
|
|
201
|
+
parser: NonNullable<Options['parser']>;
|
|
202
|
+
urlType: NonNullable<Options['urlType']>;
|
|
203
|
+
importPath: Options['importPath'];
|
|
204
|
+
baseURL: Options['baseURL'];
|
|
205
|
+
dataReturnType: NonNullable<Options['dataReturnType']>;
|
|
206
|
+
pathParamsType: NonNullable<NonNullable<Options['pathParamsType']>>;
|
|
207
|
+
paramsType: NonNullable<Options['paramsType']>;
|
|
208
|
+
paramsCasing: Options['paramsCasing'];
|
|
209
|
+
wrapper: Options['wrapper'];
|
|
210
|
+
resolver: ResolverClient;
|
|
211
|
+
};
|
|
212
|
+
type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions, ResolverClient>;
|
|
213
|
+
declare global {
|
|
214
|
+
namespace Kubb {
|
|
215
|
+
interface PluginRegistry {
|
|
216
|
+
'plugin-client': PluginClient;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/components/Client.d.ts
|
|
222
|
+
type Props$1 = {
|
|
223
|
+
name: string;
|
|
224
|
+
urlName?: string;
|
|
225
|
+
isExportable?: boolean;
|
|
226
|
+
isIndexable?: boolean;
|
|
227
|
+
isConfigurable?: boolean;
|
|
228
|
+
returnType?: string;
|
|
229
|
+
baseURL: string | undefined;
|
|
230
|
+
dataReturnType: PluginClient['resolvedOptions']['dataReturnType'];
|
|
231
|
+
paramsCasing: PluginClient['resolvedOptions']['paramsCasing'];
|
|
232
|
+
paramsType: PluginClient['resolvedOptions']['pathParamsType'];
|
|
233
|
+
pathParamsType: PluginClient['resolvedOptions']['pathParamsType'];
|
|
234
|
+
parser: PluginClient['resolvedOptions']['parser'] | undefined;
|
|
235
|
+
node: OperationNode;
|
|
236
|
+
tsResolver: PluginTs['resolver'];
|
|
237
|
+
zodResolver?: PluginZod['resolver'];
|
|
238
|
+
children?: FabricReactNode;
|
|
239
|
+
};
|
|
240
|
+
type GetParamsProps$1 = {
|
|
241
|
+
paramsCasing: PluginClient['resolvedOptions']['paramsCasing'];
|
|
242
|
+
paramsType: PluginClient['resolvedOptions']['paramsType'];
|
|
243
|
+
pathParamsType: PluginClient['resolvedOptions']['pathParamsType'];
|
|
244
|
+
node: OperationNode;
|
|
245
|
+
tsResolver: PluginTs['resolver'];
|
|
246
|
+
isConfigurable: boolean;
|
|
247
|
+
};
|
|
248
|
+
declare function Client({
|
|
249
|
+
name,
|
|
250
|
+
isExportable,
|
|
251
|
+
isIndexable,
|
|
252
|
+
returnType,
|
|
253
|
+
baseURL,
|
|
254
|
+
dataReturnType,
|
|
255
|
+
parser,
|
|
256
|
+
paramsType,
|
|
257
|
+
paramsCasing,
|
|
258
|
+
pathParamsType,
|
|
259
|
+
node,
|
|
260
|
+
tsResolver,
|
|
261
|
+
zodResolver,
|
|
262
|
+
urlName,
|
|
263
|
+
children,
|
|
264
|
+
isConfigurable
|
|
265
|
+
}: Props$1): FabricReactNode;
|
|
266
|
+
declare namespace Client {
|
|
267
|
+
var getParams: ({
|
|
268
|
+
paramsType,
|
|
269
|
+
paramsCasing,
|
|
270
|
+
pathParamsType,
|
|
271
|
+
node,
|
|
272
|
+
tsResolver,
|
|
273
|
+
isConfigurable
|
|
274
|
+
}: GetParamsProps$1) => FunctionParametersNode;
|
|
275
|
+
}
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/components/ClientLegacy.d.ts
|
|
278
|
+
/**
|
|
279
|
+
* Structural type matching OperationSchema from @kubb/plugin-oas.
|
|
280
|
+
* Avoids importing from @kubb/oas or @kubb/plugin-oas.
|
|
281
|
+
* Uses broad types so that OperationSchemas is assignable without imports.
|
|
282
|
+
*/
|
|
283
|
+
type LegacyOperationSchema = {
|
|
284
|
+
name?: string;
|
|
285
|
+
schema?: Record<string, any>;
|
|
286
|
+
statusCode?: string | number;
|
|
287
|
+
[key: string]: unknown;
|
|
288
|
+
};
|
|
289
|
+
type LegacyOperationSchemas = {
|
|
290
|
+
pathParams?: LegacyOperationSchema;
|
|
291
|
+
queryParams?: LegacyOperationSchema;
|
|
292
|
+
headerParams?: LegacyOperationSchema;
|
|
293
|
+
request?: LegacyOperationSchema;
|
|
294
|
+
response: LegacyOperationSchema & {
|
|
295
|
+
name: string;
|
|
296
|
+
};
|
|
297
|
+
statusCodes?: Array<LegacyOperationSchema & {
|
|
298
|
+
name: string;
|
|
299
|
+
}>;
|
|
300
|
+
errors?: Array<LegacyOperationSchema & {
|
|
301
|
+
name: string;
|
|
302
|
+
}>;
|
|
303
|
+
[key: string]: unknown;
|
|
304
|
+
};
|
|
305
|
+
type LegacyOperation = {
|
|
306
|
+
path: string;
|
|
307
|
+
method: string;
|
|
308
|
+
getDescription?(): string | undefined;
|
|
309
|
+
getSummary?(): string | undefined;
|
|
310
|
+
isDeprecated?(): boolean;
|
|
311
|
+
getContentType?(): string;
|
|
312
|
+
};
|
|
313
|
+
type Props = {
|
|
314
|
+
name: string;
|
|
315
|
+
urlName?: string;
|
|
316
|
+
isExportable?: boolean;
|
|
317
|
+
isIndexable?: boolean;
|
|
318
|
+
isConfigurable?: boolean;
|
|
319
|
+
returnType?: string;
|
|
320
|
+
baseURL: string | undefined;
|
|
321
|
+
dataReturnType: 'data' | 'full';
|
|
322
|
+
paramsCasing?: 'camelcase';
|
|
323
|
+
paramsType: 'object' | 'inline';
|
|
324
|
+
pathParamsType: 'object' | 'inline';
|
|
325
|
+
parser: 'client' | 'zod' | undefined;
|
|
326
|
+
typeSchemas: LegacyOperationSchemas;
|
|
327
|
+
zodSchemas: LegacyOperationSchemas | undefined;
|
|
328
|
+
operation: LegacyOperation;
|
|
329
|
+
children?: FabricReactNode;
|
|
330
|
+
};
|
|
331
|
+
type GetParamsProps = {
|
|
332
|
+
paramsCasing?: 'camelcase';
|
|
333
|
+
paramsType: 'object' | 'inline';
|
|
334
|
+
pathParamsType: 'object' | 'inline';
|
|
335
|
+
typeSchemas: LegacyOperationSchemas;
|
|
336
|
+
isConfigurable: boolean;
|
|
337
|
+
};
|
|
338
|
+
declare function ClientLegacy({
|
|
339
|
+
name,
|
|
340
|
+
isExportable,
|
|
341
|
+
isIndexable,
|
|
342
|
+
returnType,
|
|
343
|
+
typeSchemas,
|
|
344
|
+
baseURL,
|
|
345
|
+
dataReturnType,
|
|
346
|
+
parser,
|
|
347
|
+
zodSchemas,
|
|
348
|
+
paramsType,
|
|
349
|
+
paramsCasing,
|
|
350
|
+
pathParamsType,
|
|
351
|
+
operation,
|
|
352
|
+
urlName,
|
|
353
|
+
children,
|
|
354
|
+
isConfigurable
|
|
355
|
+
}: Props): FabricReactNode;
|
|
356
|
+
declare namespace ClientLegacy {
|
|
357
|
+
var getParams: ({
|
|
358
|
+
paramsType,
|
|
359
|
+
paramsCasing,
|
|
360
|
+
pathParamsType,
|
|
361
|
+
typeSchemas,
|
|
362
|
+
isConfigurable
|
|
363
|
+
}: GetParamsProps) => FunctionParams;
|
|
364
|
+
}
|
|
365
|
+
type UrlProps = {
|
|
366
|
+
name: string;
|
|
367
|
+
isExportable?: boolean;
|
|
368
|
+
isIndexable?: boolean;
|
|
369
|
+
baseURL: string | undefined;
|
|
370
|
+
paramsCasing?: 'camelcase';
|
|
371
|
+
paramsType: 'object' | 'inline';
|
|
372
|
+
pathParamsType: 'object' | 'inline';
|
|
373
|
+
typeSchemas: LegacyOperationSchemas;
|
|
374
|
+
operation: LegacyOperation;
|
|
375
|
+
};
|
|
376
|
+
type UrlGetParamsProps = {
|
|
377
|
+
paramsCasing?: 'camelcase';
|
|
378
|
+
paramsType: 'object' | 'inline';
|
|
379
|
+
pathParamsType: 'object' | 'inline';
|
|
380
|
+
typeSchemas: LegacyOperationSchemas;
|
|
381
|
+
};
|
|
382
|
+
declare function getUrlParams({
|
|
383
|
+
paramsType,
|
|
384
|
+
paramsCasing,
|
|
385
|
+
pathParamsType,
|
|
386
|
+
typeSchemas
|
|
387
|
+
}: UrlGetParamsProps): FunctionParams;
|
|
388
|
+
declare function UrlLegacy({
|
|
389
|
+
name,
|
|
390
|
+
isExportable,
|
|
391
|
+
isIndexable,
|
|
392
|
+
typeSchemas,
|
|
393
|
+
baseURL,
|
|
394
|
+
paramsType,
|
|
395
|
+
paramsCasing,
|
|
396
|
+
pathParamsType,
|
|
397
|
+
operation
|
|
398
|
+
}: UrlProps): FabricReactNode;
|
|
399
|
+
declare namespace UrlLegacy {
|
|
400
|
+
var getParams: typeof getUrlParams;
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/generators/classClientGenerator.d.ts
|
|
404
|
+
declare const classClientGenerator: _$_kubb_core0.Generator<PluginClient>;
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/generators/clientGenerator.d.ts
|
|
407
|
+
declare const clientGenerator: _$_kubb_core0.Generator<PluginClient>;
|
|
408
|
+
//#endregion
|
|
409
|
+
//#region src/generators/groupedClientGenerator.d.ts
|
|
410
|
+
declare const groupedClientGenerator: _$_kubb_core0.Generator<PluginClient>;
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/generators/operationsGenerator.d.ts
|
|
413
|
+
declare const operationsGenerator: _$_kubb_core0.Generator<PluginClient>;
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/generators/staticClassClientGenerator.d.ts
|
|
416
|
+
declare const staticClassClientGenerator: _$_kubb_core0.Generator<PluginClient>;
|
|
417
|
+
//#endregion
|
|
5
418
|
//#region src/plugin.d.ts
|
|
419
|
+
/**
|
|
420
|
+
* Canonical plugin name for `@kubb/plugin-client`, used to identify the plugin
|
|
421
|
+
* in driver lookups and warnings.
|
|
422
|
+
*/
|
|
6
423
|
declare const pluginClientName = "plugin-client";
|
|
7
|
-
|
|
424
|
+
/**
|
|
425
|
+
* The `@kubb/plugin-client` plugin factory.
|
|
426
|
+
*
|
|
427
|
+
* Generates type-safe HTTP client functions (or classes) from an OpenAPI/AST `RootNode`.
|
|
428
|
+
* Walks operations, delegates rendering to the active generators,
|
|
429
|
+
* and writes barrel files based on `output.barrelType`.
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```ts
|
|
433
|
+
* import { pluginClient } from '@kubb/plugin-client'
|
|
434
|
+
*
|
|
435
|
+
* export default defineConfig({
|
|
436
|
+
* plugins: [pluginClient({ output: { path: 'clients' } })],
|
|
437
|
+
* })
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
declare const pluginClient: (options?: Options | undefined) => _$_kubb_core0.UserPluginWithLifeCycle<PluginClient>;
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/presets.d.ts
|
|
443
|
+
/**
|
|
444
|
+
* Built-in preset registry for `@kubb/plugin-client`.
|
|
445
|
+
*
|
|
446
|
+
* - `default` — uses `resolverClient` with v5 naming conventions.
|
|
447
|
+
* - `kubbV4` — uses `resolverClientLegacy` with backward-compatible naming.
|
|
448
|
+
*
|
|
449
|
+
* Note: Unlike plugin-ts/plugin-zod, generators are not defined here because
|
|
450
|
+
* plugin-client selects generators dynamically based on `clientType`, `group`,
|
|
451
|
+
* and `operations` options. Generator selection happens in `plugin.ts`.
|
|
452
|
+
*/
|
|
453
|
+
declare const presets: _$_kubb_core0.Presets<ResolverClient>;
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/resolvers/resolverClient.d.ts
|
|
456
|
+
/**
|
|
457
|
+
* Resolver for `@kubb/plugin-client` that provides the default naming
|
|
458
|
+
* and path-resolution helpers used by the plugin.
|
|
459
|
+
*
|
|
460
|
+
* @example
|
|
461
|
+
* ```ts
|
|
462
|
+
* import { resolverClient } from '@kubb/plugin-client'
|
|
463
|
+
*
|
|
464
|
+
* resolverClient.default('list pets', 'function') // -> 'listPets'
|
|
465
|
+
* resolverClient.resolveName('show pet by id') // -> 'showPetById'
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
468
|
+
declare const resolverClient: ResolverClient;
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/resolvers/resolverClientLegacy.d.ts
|
|
471
|
+
/**
|
|
472
|
+
* Legacy resolver for `@kubb/plugin-client` that provides backward-compatible
|
|
473
|
+
* naming conventions matching the v4 behavior.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```ts
|
|
477
|
+
* import { resolverClientLegacy } from '@kubb/plugin-client'
|
|
478
|
+
*
|
|
479
|
+
* resolverClientLegacy.default('list pets', 'function') // -> 'listPets'
|
|
480
|
+
* resolverClientLegacy.resolveName('show pet by id') // -> 'showPetById'
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
declare const resolverClientLegacy: ResolverClient;
|
|
8
484
|
//#endregion
|
|
9
|
-
export { type ClientImportPath, type PluginClient, pluginClient, pluginClientName };
|
|
485
|
+
export { Client, type ClientImportPath, ClientLegacy, type PluginClient, type ResolverClient, UrlLegacy, classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator, pluginClient, pluginClientName, presets, resolverClient, resolverClientLegacy, staticClassClientGenerator };
|
|
10
486
|
//# sourceMappingURL=index.d.ts.map
|