@kubb/plugin-client 4.18.4 → 4.19.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 +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/{types-Chp-emXk.d.cts → types-9E2xtAWa.d.cts} +97 -75
- package/dist/{types-aqsuGVmg.d.ts → types-CEoiGmcV.d.ts} +97 -75
- package/package.json +7 -7
- package/src/types.ts +28 -26
package/dist/components.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-DlpkT3g-.cjs";
|
|
2
|
-
import { i as OperationSchemas, n as PluginClient, o as Operation } from "./types-
|
|
2
|
+
import { i as OperationSchemas, n as PluginClient, o as Operation } from "./types-9E2xtAWa.cjs";
|
|
3
3
|
import { FunctionParams } from "@kubb/react-fabric";
|
|
4
4
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-iVr_oF3V.js";
|
|
2
|
-
import { i as OperationSchemas, n as PluginClient, o as Operation } from "./types-
|
|
2
|
+
import { i as OperationSchemas, n as PluginClient, o as Operation } from "./types-CEoiGmcV.js";
|
|
3
3
|
import { FunctionParams } from "@kubb/react-fabric";
|
|
4
4
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-DlpkT3g-.cjs";
|
|
2
|
-
import { n as PluginClient, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginClient, r as ReactGenerator } from "./types-9E2xtAWa.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/classClientGenerator.d.ts
|
|
5
5
|
declare const classClientGenerator: ReactGenerator<PluginClient>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-iVr_oF3V.js";
|
|
2
|
-
import { n as PluginClient, r as ReactGenerator } from "./types-
|
|
2
|
+
import { n as PluginClient, r as ReactGenerator } from "./types-CEoiGmcV.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/classClientGenerator.d.ts
|
|
5
5
|
declare const classClientGenerator: ReactGenerator<PluginClient>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-DlpkT3g-.cjs";
|
|
2
|
-
import { a as UserPluginWithLifeCycle, n as PluginClient, t as Options } from "./types-
|
|
2
|
+
import { a as UserPluginWithLifeCycle, n as PluginClient, t as Options } from "./types-9E2xtAWa.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginClientName = "plugin-client";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-iVr_oF3V.js";
|
|
2
|
-
import { a as UserPluginWithLifeCycle, n as PluginClient, t as Options } from "./types-
|
|
2
|
+
import { a as UserPluginWithLifeCycle, n as PluginClient, t as Options } from "./types-CEoiGmcV.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginClientName = "plugin-client";
|
|
@@ -19,16 +19,21 @@ type Operation$1 = Operation;
|
|
|
19
19
|
type DiscriminatorObject$1 = DiscriminatorObject;
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region ../oas/src/Oas.d.ts
|
|
22
|
-
type
|
|
22
|
+
type OasOptions = {
|
|
23
23
|
contentType?: contentType;
|
|
24
24
|
discriminator?: 'strict' | 'inherit';
|
|
25
|
+
/**
|
|
26
|
+
* Resolve name collisions when schemas from different components share the same name (case-insensitive).
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
collisionDetection?: boolean;
|
|
25
30
|
};
|
|
26
31
|
declare class Oas extends BaseOas {
|
|
27
32
|
#private;
|
|
28
33
|
document: Document;
|
|
29
34
|
constructor(document: Document);
|
|
30
|
-
setOptions(options:
|
|
31
|
-
get options():
|
|
35
|
+
setOptions(options: OasOptions): void;
|
|
36
|
+
get options(): OasOptions;
|
|
32
37
|
get<T = unknown>($ref: string): T | null;
|
|
33
38
|
getKey($ref: string): string | undefined;
|
|
34
39
|
set($ref: string, value: unknown): false | undefined;
|
|
@@ -37,8 +42,20 @@ declare class Oas extends BaseOas {
|
|
|
37
42
|
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
38
43
|
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
39
44
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
40
|
-
|
|
45
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
41
46
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
47
|
+
/**
|
|
48
|
+
* Get schemas from OpenAPI components (schemas, responses, requestBodies).
|
|
49
|
+
* Returns schemas in dependency order along with name mapping for collision resolution.
|
|
50
|
+
*/
|
|
51
|
+
getSchemas(options?: {
|
|
52
|
+
contentType?: contentType;
|
|
53
|
+
includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
54
|
+
collisionDetection?: boolean;
|
|
55
|
+
}): {
|
|
56
|
+
schemas: Record<string, SchemaObject$1>;
|
|
57
|
+
nameMapping: Map<string, string>;
|
|
58
|
+
};
|
|
42
59
|
}
|
|
43
60
|
//#endregion
|
|
44
61
|
//#region ../core/src/BaseGenerator.d.ts
|
|
@@ -339,7 +356,7 @@ type Config<TInput = Input> = {
|
|
|
339
356
|
input: TInput;
|
|
340
357
|
output: {
|
|
341
358
|
/**
|
|
342
|
-
* The path where all generated files
|
|
359
|
+
* The path where all generated files receives exported.
|
|
343
360
|
* This can be an absolute path or a path relative to the specified root option.
|
|
344
361
|
*/
|
|
345
362
|
path: string;
|
|
@@ -354,41 +371,39 @@ type Config<TInput = Input> = {
|
|
|
354
371
|
write?: boolean;
|
|
355
372
|
/**
|
|
356
373
|
* Specifies the formatting tool to be used.
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* - '
|
|
361
|
-
* -
|
|
362
|
-
*
|
|
363
|
-
*
|
|
374
|
+
* - 'auto' automatically detects and uses biome or prettier (in that order of preference).
|
|
375
|
+
* - 'prettier' uses Prettier for code formatting.
|
|
376
|
+
* - 'biome' uses Biome for code formatting.
|
|
377
|
+
* - 'oxfmt' uses Oxfmt for code formatting.
|
|
378
|
+
* - false disables code formatting.
|
|
379
|
+
* @default 'prettier'
|
|
364
380
|
*/
|
|
365
381
|
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
366
382
|
/**
|
|
367
383
|
* Specifies the linter that should be used to analyze the code.
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* - '
|
|
372
|
-
* -
|
|
373
|
-
*
|
|
374
|
-
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
375
|
-
*
|
|
384
|
+
* - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
385
|
+
* - 'eslint' uses ESLint for linting.
|
|
386
|
+
* - 'biome' uses Biome for linting.
|
|
387
|
+
* - 'oxlint' uses Oxlint for linting.
|
|
388
|
+
* - false disables linting.
|
|
389
|
+
* @default 'auto'
|
|
376
390
|
*/
|
|
377
391
|
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
378
392
|
/**
|
|
379
|
-
*
|
|
393
|
+
* Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
|
|
380
394
|
* @default { '.ts': '.ts'}
|
|
381
395
|
*/
|
|
382
396
|
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
383
397
|
/**
|
|
384
|
-
*
|
|
398
|
+
* Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
|
|
385
399
|
* @default 'named'
|
|
386
400
|
*/
|
|
387
401
|
barrelType?: Exclude<BarrelType, 'propagate'> | false;
|
|
388
402
|
/**
|
|
389
|
-
*
|
|
390
|
-
* - 'simple'
|
|
391
|
-
* - 'full'
|
|
403
|
+
* Adds a default banner to the start of every generated file indicating it was generated by Kubb.
|
|
404
|
+
* - 'simple' adds banner with link to Kubb.
|
|
405
|
+
* - 'full' adds source, title, description, and OpenAPI version.
|
|
406
|
+
* - false disables banner generation.
|
|
392
407
|
* @default 'simple'
|
|
393
408
|
*/
|
|
394
409
|
defaultBanner?: 'simple' | 'full' | false;
|
|
@@ -401,17 +416,17 @@ type Config<TInput = Input> = {
|
|
|
401
416
|
override?: boolean;
|
|
402
417
|
};
|
|
403
418
|
/**
|
|
404
|
-
* An array of Kubb plugins that
|
|
419
|
+
* An array of Kubb plugins that used in the generation.
|
|
405
420
|
* Each plugin may include additional configurable options(defined in the plugin itself).
|
|
406
|
-
* If a plugin depends on another plugin, an error
|
|
421
|
+
* If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
|
|
407
422
|
*/
|
|
408
423
|
plugins?: Array<Plugin>;
|
|
409
424
|
/**
|
|
410
|
-
* Hooks
|
|
425
|
+
* Hooks triggered when a specific action occurs in Kubb.
|
|
411
426
|
*/
|
|
412
427
|
hooks?: {
|
|
413
428
|
/**
|
|
414
|
-
* Hook that
|
|
429
|
+
* Hook that triggers at the end of all executions.
|
|
415
430
|
* Useful for running Prettier or ESLint to format/lint your code.
|
|
416
431
|
*/
|
|
417
432
|
done?: string | Array<string>;
|
|
@@ -440,7 +455,7 @@ TContext = any,
|
|
|
440
455
|
TResolvePathOptions extends object = object> = {
|
|
441
456
|
name: TName;
|
|
442
457
|
/**
|
|
443
|
-
* Same
|
|
458
|
+
* Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
444
459
|
*/
|
|
445
460
|
key: PluginKey<TName | string>;
|
|
446
461
|
options: TOptions;
|
|
@@ -461,12 +476,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
461
476
|
*/
|
|
462
477
|
options: TOptions['resolvedOptions'];
|
|
463
478
|
/**
|
|
464
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
479
|
+
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
|
|
465
480
|
* Can be used to validate dependent plugins.
|
|
466
481
|
*/
|
|
467
482
|
pre?: Array<string>;
|
|
468
483
|
/**
|
|
469
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
484
|
+
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
|
|
470
485
|
*/
|
|
471
486
|
post?: Array<string>;
|
|
472
487
|
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
@@ -484,12 +499,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
484
499
|
*/
|
|
485
500
|
key: TOptions['key'];
|
|
486
501
|
/**
|
|
487
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
502
|
+
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
|
|
488
503
|
* Can be used to validate dependent plugins.
|
|
489
504
|
*/
|
|
490
505
|
pre?: Array<string>;
|
|
491
506
|
/**
|
|
492
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
507
|
+
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
|
|
493
508
|
*/
|
|
494
509
|
post?: Array<string>;
|
|
495
510
|
/**
|
|
@@ -539,10 +554,12 @@ type ResolveNameParams = {
|
|
|
539
554
|
name: string;
|
|
540
555
|
pluginKey?: Plugin['key'];
|
|
541
556
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
557
|
+
* Specifies the type of entity being named.
|
|
558
|
+
* - 'file' customizes the name of the created file (uses camelCase).
|
|
559
|
+
* - 'function' customizes the exported function names (uses camelCase).
|
|
560
|
+
* - 'type' customizes TypeScript types (uses PascalCase).
|
|
561
|
+
* - 'const' customizes variable names (uses camelCase).
|
|
562
|
+
* @default undefined
|
|
546
563
|
*/
|
|
547
564
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
548
565
|
};
|
|
@@ -597,11 +614,14 @@ type GroupContext = {
|
|
|
597
614
|
};
|
|
598
615
|
type Group = {
|
|
599
616
|
/**
|
|
600
|
-
*
|
|
617
|
+
* Defines the type where to group the files.
|
|
618
|
+
* - 'tag' groups files by OpenAPI tags.
|
|
619
|
+
* - 'path' groups files by OpenAPI paths.
|
|
620
|
+
* @default undefined
|
|
601
621
|
*/
|
|
602
622
|
type: 'tag' | 'path';
|
|
603
623
|
/**
|
|
604
|
-
* Return the name of a group based on the group name, this
|
|
624
|
+
* Return the name of a group based on the group name, this used for the file and name generation
|
|
605
625
|
*/
|
|
606
626
|
name?: (context: GroupContext) => string;
|
|
607
627
|
};
|
|
@@ -673,7 +693,7 @@ declare class PluginManager {
|
|
|
673
693
|
parameters: PluginParameter<H>;
|
|
674
694
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
675
695
|
/**
|
|
676
|
-
*
|
|
696
|
+
* Returns the first non-null result.
|
|
677
697
|
*/
|
|
678
698
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
679
699
|
hookName,
|
|
@@ -685,7 +705,7 @@ declare class PluginManager {
|
|
|
685
705
|
skipped?: ReadonlySet<Plugin> | null;
|
|
686
706
|
}): Promise<SafeParseResult<H>>;
|
|
687
707
|
/**
|
|
688
|
-
*
|
|
708
|
+
* Returns the first non-null result.
|
|
689
709
|
*/
|
|
690
710
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
691
711
|
hookName,
|
|
@@ -697,15 +717,15 @@ declare class PluginManager {
|
|
|
697
717
|
skipped?: ReadonlySet<Plugin> | null;
|
|
698
718
|
}): SafeParseResult<H>;
|
|
699
719
|
/**
|
|
700
|
-
*
|
|
720
|
+
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
701
721
|
*/
|
|
702
|
-
hookParallel<H extends PluginLifecycleHooks,
|
|
722
|
+
hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
|
|
703
723
|
hookName,
|
|
704
724
|
parameters
|
|
705
725
|
}: {
|
|
706
726
|
hookName: H;
|
|
707
727
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
708
|
-
}): Promise<Awaited<
|
|
728
|
+
}): Promise<Awaited<TOutput>[]>;
|
|
709
729
|
/**
|
|
710
730
|
* Chains plugins
|
|
711
731
|
*/
|
|
@@ -974,8 +994,8 @@ type SchemaKeywordMapper = {
|
|
|
974
994
|
*/
|
|
975
995
|
path: KubbFile.Path;
|
|
976
996
|
/**
|
|
977
|
-
* When true `File.Import`
|
|
978
|
-
* When false a reference
|
|
997
|
+
* When true `File.Import` is used.
|
|
998
|
+
* When false a reference is used inside the current file.
|
|
979
999
|
*/
|
|
980
1000
|
isImportable: boolean;
|
|
981
1001
|
};
|
|
@@ -1107,7 +1127,7 @@ type SchemaGeneratorOptions = {
|
|
|
1107
1127
|
*/
|
|
1108
1128
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1109
1129
|
/**
|
|
1110
|
-
* Receive schema and name(
|
|
1130
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
1111
1131
|
* TODO TODO add docs
|
|
1112
1132
|
* @beta
|
|
1113
1133
|
*/
|
|
@@ -1186,7 +1206,7 @@ type Options = {
|
|
|
1186
1206
|
output?: Output<Oas>;
|
|
1187
1207
|
/**
|
|
1188
1208
|
* Define which contentType should be used.
|
|
1189
|
-
* By default, the first JSON valid mediaType
|
|
1209
|
+
* By default, the first JSON valid mediaType is used
|
|
1190
1210
|
*/
|
|
1191
1211
|
contentType?: contentType;
|
|
1192
1212
|
/**
|
|
@@ -1211,16 +1231,17 @@ type Options = {
|
|
|
1211
1231
|
*/
|
|
1212
1232
|
operations?: boolean;
|
|
1213
1233
|
/**
|
|
1214
|
-
* Export urls that are used by operation x
|
|
1215
|
-
*
|
|
1216
|
-
* false
|
|
1234
|
+
* Export urls that are used by operation x.
|
|
1235
|
+
* - 'export' makes them part of your barrel file.
|
|
1236
|
+
* - false does not make them exportable.
|
|
1237
|
+
* @default false
|
|
1217
1238
|
* @example getGetPetByIdUrl
|
|
1218
1239
|
*/
|
|
1219
1240
|
urlType?: 'export' | false;
|
|
1220
1241
|
/**
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1242
|
+
* Client import path for API calls.
|
|
1243
|
+
* Used as `import client from '${client.importPath}'`.
|
|
1244
|
+
* Accepts relative and absolute paths; path changes are not performed.
|
|
1224
1245
|
*/
|
|
1225
1246
|
importPath?: string;
|
|
1226
1247
|
/**
|
|
@@ -1228,49 +1249,50 @@ type Options = {
|
|
|
1228
1249
|
*/
|
|
1229
1250
|
baseURL?: string;
|
|
1230
1251
|
/**
|
|
1231
|
-
* ReturnType that
|
|
1232
|
-
* - 'data'
|
|
1233
|
-
* - 'full'
|
|
1252
|
+
* ReturnType that is used when calling the client.
|
|
1253
|
+
* - 'data' returns ResponseConfig[data].
|
|
1254
|
+
* - 'full' returns ResponseConfig.
|
|
1234
1255
|
* @default 'data'
|
|
1235
1256
|
*/
|
|
1236
1257
|
dataReturnType?: 'data' | 'full';
|
|
1237
1258
|
/**
|
|
1238
1259
|
* How to style your params, by default no casing is applied
|
|
1239
|
-
* - 'camelcase'
|
|
1260
|
+
* - 'camelcase' uses camelcase for the params names
|
|
1240
1261
|
*/
|
|
1241
1262
|
paramsCasing?: 'camelcase';
|
|
1242
1263
|
/**
|
|
1243
|
-
* How to pass your params
|
|
1244
|
-
* - 'object'
|
|
1245
|
-
* - 'inline'
|
|
1264
|
+
* How to pass your params.
|
|
1265
|
+
* - 'object' returns the params and pathParams as an object.
|
|
1266
|
+
* - 'inline' returns the params as comma separated params.
|
|
1246
1267
|
* @default 'inline'
|
|
1247
1268
|
*/
|
|
1248
1269
|
paramsType?: 'object' | 'inline';
|
|
1249
1270
|
/**
|
|
1250
1271
|
* How to pass your pathParams.
|
|
1251
|
-
* - 'object'
|
|
1252
|
-
* - 'inline'
|
|
1272
|
+
* - 'object' returns the pathParams as an object.
|
|
1273
|
+
* - 'inline' returns the pathParams as comma separated params.
|
|
1253
1274
|
* @default 'inline'
|
|
1254
1275
|
*/
|
|
1255
1276
|
pathParamsType?: 'object' | 'inline';
|
|
1256
1277
|
/**
|
|
1257
|
-
* Which parser can be used before returning the data
|
|
1258
|
-
* - '
|
|
1278
|
+
* Which parser can be used before returning the data.
|
|
1279
|
+
* - 'client' returns the data as-is from the client.
|
|
1280
|
+
* - 'zod' uses @kubb/plugin-zod to parse the data.
|
|
1259
1281
|
* @default 'client'
|
|
1260
1282
|
*/
|
|
1261
1283
|
parser?: 'client' | 'zod';
|
|
1262
1284
|
/**
|
|
1263
|
-
* Which client should be used to do the HTTP calls
|
|
1264
|
-
* - 'axios'
|
|
1265
|
-
* - 'fetch'
|
|
1285
|
+
* Which client should be used to do the HTTP calls.
|
|
1286
|
+
* - 'axios' uses axios client for HTTP requests.
|
|
1287
|
+
* - 'fetch' uses native fetch API for HTTP requests.
|
|
1266
1288
|
* @default 'axios'
|
|
1267
1289
|
*/
|
|
1268
1290
|
client?: 'axios' | 'fetch';
|
|
1269
1291
|
/**
|
|
1270
|
-
* How to generate the client code
|
|
1271
|
-
* - 'function'
|
|
1272
|
-
* - 'class'
|
|
1273
|
-
* - 'staticClass'
|
|
1292
|
+
* How to generate the client code.
|
|
1293
|
+
* - 'function' generates standalone functions for each operation.
|
|
1294
|
+
* - 'class' generates a class with methods for each operation.
|
|
1295
|
+
* - 'staticClass' generates a class with static methods for each operation.
|
|
1274
1296
|
* @default 'function'
|
|
1275
1297
|
*/
|
|
1276
1298
|
clientType?: 'function' | 'class' | 'staticClass';
|
|
@@ -1278,7 +1300,7 @@ type Options = {
|
|
|
1278
1300
|
* Bundle the selected client into the generated `.kubb` directory.
|
|
1279
1301
|
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
1280
1302
|
* @default false
|
|
1281
|
-
* In version 5 of Kubb this
|
|
1303
|
+
* In version 5 of Kubb this is by default true
|
|
1282
1304
|
*/
|
|
1283
1305
|
bundle?: boolean;
|
|
1284
1306
|
transformers?: {
|
|
@@ -1310,4 +1332,4 @@ type ResolvedOptions = {
|
|
|
1310
1332
|
type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1311
1333
|
//#endregion
|
|
1312
1334
|
export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginClient as n, Operation$1 as o, ReactGenerator as r, Options as t };
|
|
1313
|
-
//# sourceMappingURL=types-
|
|
1335
|
+
//# sourceMappingURL=types-9E2xtAWa.d.cts.map
|
|
@@ -19,16 +19,21 @@ type Operation$1 = Operation;
|
|
|
19
19
|
type DiscriminatorObject$1 = DiscriminatorObject;
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region ../oas/src/Oas.d.ts
|
|
22
|
-
type
|
|
22
|
+
type OasOptions = {
|
|
23
23
|
contentType?: contentType;
|
|
24
24
|
discriminator?: 'strict' | 'inherit';
|
|
25
|
+
/**
|
|
26
|
+
* Resolve name collisions when schemas from different components share the same name (case-insensitive).
|
|
27
|
+
* @default false
|
|
28
|
+
*/
|
|
29
|
+
collisionDetection?: boolean;
|
|
25
30
|
};
|
|
26
31
|
declare class Oas extends BaseOas {
|
|
27
32
|
#private;
|
|
28
33
|
document: Document;
|
|
29
34
|
constructor(document: Document);
|
|
30
|
-
setOptions(options:
|
|
31
|
-
get options():
|
|
35
|
+
setOptions(options: OasOptions): void;
|
|
36
|
+
get options(): OasOptions;
|
|
32
37
|
get<T = unknown>($ref: string): T | null;
|
|
33
38
|
getKey($ref: string): string | undefined;
|
|
34
39
|
set($ref: string, value: unknown): false | undefined;
|
|
@@ -37,8 +42,20 @@ declare class Oas extends BaseOas {
|
|
|
37
42
|
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
38
43
|
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
39
44
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
40
|
-
|
|
45
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
41
46
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
47
|
+
/**
|
|
48
|
+
* Get schemas from OpenAPI components (schemas, responses, requestBodies).
|
|
49
|
+
* Returns schemas in dependency order along with name mapping for collision resolution.
|
|
50
|
+
*/
|
|
51
|
+
getSchemas(options?: {
|
|
52
|
+
contentType?: contentType;
|
|
53
|
+
includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
54
|
+
collisionDetection?: boolean;
|
|
55
|
+
}): {
|
|
56
|
+
schemas: Record<string, SchemaObject$1>;
|
|
57
|
+
nameMapping: Map<string, string>;
|
|
58
|
+
};
|
|
42
59
|
}
|
|
43
60
|
//#endregion
|
|
44
61
|
//#region ../core/src/BaseGenerator.d.ts
|
|
@@ -339,7 +356,7 @@ type Config<TInput = Input> = {
|
|
|
339
356
|
input: TInput;
|
|
340
357
|
output: {
|
|
341
358
|
/**
|
|
342
|
-
* The path where all generated files
|
|
359
|
+
* The path where all generated files receives exported.
|
|
343
360
|
* This can be an absolute path or a path relative to the specified root option.
|
|
344
361
|
*/
|
|
345
362
|
path: string;
|
|
@@ -354,41 +371,39 @@ type Config<TInput = Input> = {
|
|
|
354
371
|
write?: boolean;
|
|
355
372
|
/**
|
|
356
373
|
* Specifies the formatting tool to be used.
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* - '
|
|
361
|
-
* -
|
|
362
|
-
*
|
|
363
|
-
*
|
|
374
|
+
* - 'auto' automatically detects and uses biome or prettier (in that order of preference).
|
|
375
|
+
* - 'prettier' uses Prettier for code formatting.
|
|
376
|
+
* - 'biome' uses Biome for code formatting.
|
|
377
|
+
* - 'oxfmt' uses Oxfmt for code formatting.
|
|
378
|
+
* - false disables code formatting.
|
|
379
|
+
* @default 'prettier'
|
|
364
380
|
*/
|
|
365
381
|
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
366
382
|
/**
|
|
367
383
|
* Specifies the linter that should be used to analyze the code.
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
* - '
|
|
372
|
-
* -
|
|
373
|
-
*
|
|
374
|
-
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
375
|
-
*
|
|
384
|
+
* - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
385
|
+
* - 'eslint' uses ESLint for linting.
|
|
386
|
+
* - 'biome' uses Biome for linting.
|
|
387
|
+
* - 'oxlint' uses Oxlint for linting.
|
|
388
|
+
* - false disables linting.
|
|
389
|
+
* @default 'auto'
|
|
376
390
|
*/
|
|
377
391
|
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
378
392
|
/**
|
|
379
|
-
*
|
|
393
|
+
* Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
|
|
380
394
|
* @default { '.ts': '.ts'}
|
|
381
395
|
*/
|
|
382
396
|
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
383
397
|
/**
|
|
384
|
-
*
|
|
398
|
+
* Configures how `index.ts` files are created, including disabling barrel file generation. Each plugin has its own `barrelType` option; this setting controls the root barrel file (e.g., `src/gen/index.ts`).
|
|
385
399
|
* @default 'named'
|
|
386
400
|
*/
|
|
387
401
|
barrelType?: Exclude<BarrelType, 'propagate'> | false;
|
|
388
402
|
/**
|
|
389
|
-
*
|
|
390
|
-
* - 'simple'
|
|
391
|
-
* - 'full'
|
|
403
|
+
* Adds a default banner to the start of every generated file indicating it was generated by Kubb.
|
|
404
|
+
* - 'simple' adds banner with link to Kubb.
|
|
405
|
+
* - 'full' adds source, title, description, and OpenAPI version.
|
|
406
|
+
* - false disables banner generation.
|
|
392
407
|
* @default 'simple'
|
|
393
408
|
*/
|
|
394
409
|
defaultBanner?: 'simple' | 'full' | false;
|
|
@@ -401,17 +416,17 @@ type Config<TInput = Input> = {
|
|
|
401
416
|
override?: boolean;
|
|
402
417
|
};
|
|
403
418
|
/**
|
|
404
|
-
* An array of Kubb plugins that
|
|
419
|
+
* An array of Kubb plugins that used in the generation.
|
|
405
420
|
* Each plugin may include additional configurable options(defined in the plugin itself).
|
|
406
|
-
* If a plugin depends on another plugin, an error
|
|
421
|
+
* If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
|
|
407
422
|
*/
|
|
408
423
|
plugins?: Array<Plugin>;
|
|
409
424
|
/**
|
|
410
|
-
* Hooks
|
|
425
|
+
* Hooks triggered when a specific action occurs in Kubb.
|
|
411
426
|
*/
|
|
412
427
|
hooks?: {
|
|
413
428
|
/**
|
|
414
|
-
* Hook that
|
|
429
|
+
* Hook that triggers at the end of all executions.
|
|
415
430
|
* Useful for running Prettier or ESLint to format/lint your code.
|
|
416
431
|
*/
|
|
417
432
|
done?: string | Array<string>;
|
|
@@ -440,7 +455,7 @@ TContext = any,
|
|
|
440
455
|
TResolvePathOptions extends object = object> = {
|
|
441
456
|
name: TName;
|
|
442
457
|
/**
|
|
443
|
-
* Same
|
|
458
|
+
* Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
444
459
|
*/
|
|
445
460
|
key: PluginKey<TName | string>;
|
|
446
461
|
options: TOptions;
|
|
@@ -461,12 +476,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
461
476
|
*/
|
|
462
477
|
options: TOptions['resolvedOptions'];
|
|
463
478
|
/**
|
|
464
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
479
|
+
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
|
|
465
480
|
* Can be used to validate dependent plugins.
|
|
466
481
|
*/
|
|
467
482
|
pre?: Array<string>;
|
|
468
483
|
/**
|
|
469
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
484
|
+
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
|
|
470
485
|
*/
|
|
471
486
|
post?: Array<string>;
|
|
472
487
|
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
@@ -484,12 +499,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
484
499
|
*/
|
|
485
500
|
key: TOptions['key'];
|
|
486
501
|
/**
|
|
487
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
502
|
+
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin is executed after these plugins.
|
|
488
503
|
* Can be used to validate dependent plugins.
|
|
489
504
|
*/
|
|
490
505
|
pre?: Array<string>;
|
|
491
506
|
/**
|
|
492
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
507
|
+
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin is executed before these plugins.
|
|
493
508
|
*/
|
|
494
509
|
post?: Array<string>;
|
|
495
510
|
/**
|
|
@@ -539,10 +554,12 @@ type ResolveNameParams = {
|
|
|
539
554
|
name: string;
|
|
540
555
|
pluginKey?: Plugin['key'];
|
|
541
556
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
557
|
+
* Specifies the type of entity being named.
|
|
558
|
+
* - 'file' customizes the name of the created file (uses camelCase).
|
|
559
|
+
* - 'function' customizes the exported function names (uses camelCase).
|
|
560
|
+
* - 'type' customizes TypeScript types (uses PascalCase).
|
|
561
|
+
* - 'const' customizes variable names (uses camelCase).
|
|
562
|
+
* @default undefined
|
|
546
563
|
*/
|
|
547
564
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
548
565
|
};
|
|
@@ -597,11 +614,14 @@ type GroupContext = {
|
|
|
597
614
|
};
|
|
598
615
|
type Group = {
|
|
599
616
|
/**
|
|
600
|
-
*
|
|
617
|
+
* Defines the type where to group the files.
|
|
618
|
+
* - 'tag' groups files by OpenAPI tags.
|
|
619
|
+
* - 'path' groups files by OpenAPI paths.
|
|
620
|
+
* @default undefined
|
|
601
621
|
*/
|
|
602
622
|
type: 'tag' | 'path';
|
|
603
623
|
/**
|
|
604
|
-
* Return the name of a group based on the group name, this
|
|
624
|
+
* Return the name of a group based on the group name, this used for the file and name generation
|
|
605
625
|
*/
|
|
606
626
|
name?: (context: GroupContext) => string;
|
|
607
627
|
};
|
|
@@ -673,7 +693,7 @@ declare class PluginManager {
|
|
|
673
693
|
parameters: PluginParameter<H>;
|
|
674
694
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
675
695
|
/**
|
|
676
|
-
*
|
|
696
|
+
* Returns the first non-null result.
|
|
677
697
|
*/
|
|
678
698
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
679
699
|
hookName,
|
|
@@ -685,7 +705,7 @@ declare class PluginManager {
|
|
|
685
705
|
skipped?: ReadonlySet<Plugin> | null;
|
|
686
706
|
}): Promise<SafeParseResult<H>>;
|
|
687
707
|
/**
|
|
688
|
-
*
|
|
708
|
+
* Returns the first non-null result.
|
|
689
709
|
*/
|
|
690
710
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
691
711
|
hookName,
|
|
@@ -697,15 +717,15 @@ declare class PluginManager {
|
|
|
697
717
|
skipped?: ReadonlySet<Plugin> | null;
|
|
698
718
|
}): SafeParseResult<H>;
|
|
699
719
|
/**
|
|
700
|
-
*
|
|
720
|
+
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
701
721
|
*/
|
|
702
|
-
hookParallel<H extends PluginLifecycleHooks,
|
|
722
|
+
hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
|
|
703
723
|
hookName,
|
|
704
724
|
parameters
|
|
705
725
|
}: {
|
|
706
726
|
hookName: H;
|
|
707
727
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
708
|
-
}): Promise<Awaited<
|
|
728
|
+
}): Promise<Awaited<TOutput>[]>;
|
|
709
729
|
/**
|
|
710
730
|
* Chains plugins
|
|
711
731
|
*/
|
|
@@ -974,8 +994,8 @@ type SchemaKeywordMapper = {
|
|
|
974
994
|
*/
|
|
975
995
|
path: KubbFile.Path;
|
|
976
996
|
/**
|
|
977
|
-
* When true `File.Import`
|
|
978
|
-
* When false a reference
|
|
997
|
+
* When true `File.Import` is used.
|
|
998
|
+
* When false a reference is used inside the current file.
|
|
979
999
|
*/
|
|
980
1000
|
isImportable: boolean;
|
|
981
1001
|
};
|
|
@@ -1107,7 +1127,7 @@ type SchemaGeneratorOptions = {
|
|
|
1107
1127
|
*/
|
|
1108
1128
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1109
1129
|
/**
|
|
1110
|
-
* Receive schema and name(
|
|
1130
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
1111
1131
|
* TODO TODO add docs
|
|
1112
1132
|
* @beta
|
|
1113
1133
|
*/
|
|
@@ -1186,7 +1206,7 @@ type Options = {
|
|
|
1186
1206
|
output?: Output<Oas>;
|
|
1187
1207
|
/**
|
|
1188
1208
|
* Define which contentType should be used.
|
|
1189
|
-
* By default, the first JSON valid mediaType
|
|
1209
|
+
* By default, the first JSON valid mediaType is used
|
|
1190
1210
|
*/
|
|
1191
1211
|
contentType?: contentType;
|
|
1192
1212
|
/**
|
|
@@ -1211,16 +1231,17 @@ type Options = {
|
|
|
1211
1231
|
*/
|
|
1212
1232
|
operations?: boolean;
|
|
1213
1233
|
/**
|
|
1214
|
-
* Export urls that are used by operation x
|
|
1215
|
-
*
|
|
1216
|
-
* false
|
|
1234
|
+
* Export urls that are used by operation x.
|
|
1235
|
+
* - 'export' makes them part of your barrel file.
|
|
1236
|
+
* - false does not make them exportable.
|
|
1237
|
+
* @default false
|
|
1217
1238
|
* @example getGetPetByIdUrl
|
|
1218
1239
|
*/
|
|
1219
1240
|
urlType?: 'export' | false;
|
|
1220
1241
|
/**
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1242
|
+
* Client import path for API calls.
|
|
1243
|
+
* Used as `import client from '${client.importPath}'`.
|
|
1244
|
+
* Accepts relative and absolute paths; path changes are not performed.
|
|
1224
1245
|
*/
|
|
1225
1246
|
importPath?: string;
|
|
1226
1247
|
/**
|
|
@@ -1228,49 +1249,50 @@ type Options = {
|
|
|
1228
1249
|
*/
|
|
1229
1250
|
baseURL?: string;
|
|
1230
1251
|
/**
|
|
1231
|
-
* ReturnType that
|
|
1232
|
-
* - 'data'
|
|
1233
|
-
* - 'full'
|
|
1252
|
+
* ReturnType that is used when calling the client.
|
|
1253
|
+
* - 'data' returns ResponseConfig[data].
|
|
1254
|
+
* - 'full' returns ResponseConfig.
|
|
1234
1255
|
* @default 'data'
|
|
1235
1256
|
*/
|
|
1236
1257
|
dataReturnType?: 'data' | 'full';
|
|
1237
1258
|
/**
|
|
1238
1259
|
* How to style your params, by default no casing is applied
|
|
1239
|
-
* - 'camelcase'
|
|
1260
|
+
* - 'camelcase' uses camelcase for the params names
|
|
1240
1261
|
*/
|
|
1241
1262
|
paramsCasing?: 'camelcase';
|
|
1242
1263
|
/**
|
|
1243
|
-
* How to pass your params
|
|
1244
|
-
* - 'object'
|
|
1245
|
-
* - 'inline'
|
|
1264
|
+
* How to pass your params.
|
|
1265
|
+
* - 'object' returns the params and pathParams as an object.
|
|
1266
|
+
* - 'inline' returns the params as comma separated params.
|
|
1246
1267
|
* @default 'inline'
|
|
1247
1268
|
*/
|
|
1248
1269
|
paramsType?: 'object' | 'inline';
|
|
1249
1270
|
/**
|
|
1250
1271
|
* How to pass your pathParams.
|
|
1251
|
-
* - 'object'
|
|
1252
|
-
* - 'inline'
|
|
1272
|
+
* - 'object' returns the pathParams as an object.
|
|
1273
|
+
* - 'inline' returns the pathParams as comma separated params.
|
|
1253
1274
|
* @default 'inline'
|
|
1254
1275
|
*/
|
|
1255
1276
|
pathParamsType?: 'object' | 'inline';
|
|
1256
1277
|
/**
|
|
1257
|
-
* Which parser can be used before returning the data
|
|
1258
|
-
* - '
|
|
1278
|
+
* Which parser can be used before returning the data.
|
|
1279
|
+
* - 'client' returns the data as-is from the client.
|
|
1280
|
+
* - 'zod' uses @kubb/plugin-zod to parse the data.
|
|
1259
1281
|
* @default 'client'
|
|
1260
1282
|
*/
|
|
1261
1283
|
parser?: 'client' | 'zod';
|
|
1262
1284
|
/**
|
|
1263
|
-
* Which client should be used to do the HTTP calls
|
|
1264
|
-
* - 'axios'
|
|
1265
|
-
* - 'fetch'
|
|
1285
|
+
* Which client should be used to do the HTTP calls.
|
|
1286
|
+
* - 'axios' uses axios client for HTTP requests.
|
|
1287
|
+
* - 'fetch' uses native fetch API for HTTP requests.
|
|
1266
1288
|
* @default 'axios'
|
|
1267
1289
|
*/
|
|
1268
1290
|
client?: 'axios' | 'fetch';
|
|
1269
1291
|
/**
|
|
1270
|
-
* How to generate the client code
|
|
1271
|
-
* - 'function'
|
|
1272
|
-
* - 'class'
|
|
1273
|
-
* - 'staticClass'
|
|
1292
|
+
* How to generate the client code.
|
|
1293
|
+
* - 'function' generates standalone functions for each operation.
|
|
1294
|
+
* - 'class' generates a class with methods for each operation.
|
|
1295
|
+
* - 'staticClass' generates a class with static methods for each operation.
|
|
1274
1296
|
* @default 'function'
|
|
1275
1297
|
*/
|
|
1276
1298
|
clientType?: 'function' | 'class' | 'staticClass';
|
|
@@ -1278,7 +1300,7 @@ type Options = {
|
|
|
1278
1300
|
* Bundle the selected client into the generated `.kubb` directory.
|
|
1279
1301
|
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
1280
1302
|
* @default false
|
|
1281
|
-
* In version 5 of Kubb this
|
|
1303
|
+
* In version 5 of Kubb this is by default true
|
|
1282
1304
|
*/
|
|
1283
1305
|
bundle?: boolean;
|
|
1284
1306
|
transformers?: {
|
|
@@ -1310,4 +1332,4 @@ type ResolvedOptions = {
|
|
|
1310
1332
|
type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1311
1333
|
//#endregion
|
|
1312
1334
|
export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginClient as n, Operation$1 as o, ReactGenerator as r, Options as t };
|
|
1313
|
-
//# sourceMappingURL=types-
|
|
1335
|
+
//# sourceMappingURL=types-CEoiGmcV.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.19.0",
|
|
4
4
|
"description": "API client generator plugin for Kubb, creating type-safe HTTP clients (Axios, Fetch) from OpenAPI specifications for making API requests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
],
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@kubb/react-fabric": "0.12.4",
|
|
90
|
-
"@kubb/core": "4.
|
|
91
|
-
"@kubb/oas": "4.
|
|
92
|
-
"@kubb/plugin-oas": "4.
|
|
93
|
-
"@kubb/plugin-ts": "4.
|
|
94
|
-
"@kubb/plugin-zod": "4.
|
|
90
|
+
"@kubb/core": "4.19.0",
|
|
91
|
+
"@kubb/oas": "4.19.0",
|
|
92
|
+
"@kubb/plugin-oas": "4.19.0",
|
|
93
|
+
"@kubb/plugin-ts": "4.19.0",
|
|
94
|
+
"@kubb/plugin-zod": "4.19.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"axios": "^1.13.
|
|
97
|
+
"axios": "^1.13.3"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@kubb/react-fabric": "0.12.4",
|
package/src/types.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type Options = {
|
|
|
12
12
|
output?: Output<Oas>
|
|
13
13
|
/**
|
|
14
14
|
* Define which contentType should be used.
|
|
15
|
-
* By default, the first JSON valid mediaType
|
|
15
|
+
* By default, the first JSON valid mediaType is used
|
|
16
16
|
*/
|
|
17
17
|
contentType?: contentType
|
|
18
18
|
/**
|
|
@@ -37,16 +37,17 @@ export type Options = {
|
|
|
37
37
|
*/
|
|
38
38
|
operations?: boolean
|
|
39
39
|
/**
|
|
40
|
-
* Export urls that are used by operation x
|
|
41
|
-
*
|
|
42
|
-
* false
|
|
40
|
+
* Export urls that are used by operation x.
|
|
41
|
+
* - 'export' makes them part of your barrel file.
|
|
42
|
+
* - false does not make them exportable.
|
|
43
|
+
* @default false
|
|
43
44
|
* @example getGetPetByIdUrl
|
|
44
45
|
*/
|
|
45
46
|
urlType?: 'export' | false
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
48
|
+
* Client import path for API calls.
|
|
49
|
+
* Used as `import client from '${client.importPath}'`.
|
|
50
|
+
* Accepts relative and absolute paths; path changes are not performed.
|
|
50
51
|
*/
|
|
51
52
|
importPath?: string
|
|
52
53
|
/**
|
|
@@ -54,49 +55,50 @@ export type Options = {
|
|
|
54
55
|
*/
|
|
55
56
|
baseURL?: string
|
|
56
57
|
/**
|
|
57
|
-
* ReturnType that
|
|
58
|
-
* - 'data'
|
|
59
|
-
* - 'full'
|
|
58
|
+
* ReturnType that is used when calling the client.
|
|
59
|
+
* - 'data' returns ResponseConfig[data].
|
|
60
|
+
* - 'full' returns ResponseConfig.
|
|
60
61
|
* @default 'data'
|
|
61
62
|
*/
|
|
62
63
|
dataReturnType?: 'data' | 'full'
|
|
63
64
|
/**
|
|
64
65
|
* How to style your params, by default no casing is applied
|
|
65
|
-
* - 'camelcase'
|
|
66
|
+
* - 'camelcase' uses camelcase for the params names
|
|
66
67
|
*/
|
|
67
68
|
paramsCasing?: 'camelcase'
|
|
68
69
|
/**
|
|
69
|
-
* How to pass your params
|
|
70
|
-
* - 'object'
|
|
71
|
-
* - 'inline'
|
|
70
|
+
* How to pass your params.
|
|
71
|
+
* - 'object' returns the params and pathParams as an object.
|
|
72
|
+
* - 'inline' returns the params as comma separated params.
|
|
72
73
|
* @default 'inline'
|
|
73
74
|
*/
|
|
74
75
|
paramsType?: 'object' | 'inline'
|
|
75
76
|
/**
|
|
76
77
|
* How to pass your pathParams.
|
|
77
|
-
* - 'object'
|
|
78
|
-
* - 'inline'
|
|
78
|
+
* - 'object' returns the pathParams as an object.
|
|
79
|
+
* - 'inline' returns the pathParams as comma separated params.
|
|
79
80
|
* @default 'inline'
|
|
80
81
|
*/
|
|
81
82
|
pathParamsType?: 'object' | 'inline'
|
|
82
83
|
/**
|
|
83
|
-
* Which parser can be used before returning the data
|
|
84
|
-
* - '
|
|
84
|
+
* Which parser can be used before returning the data.
|
|
85
|
+
* - 'client' returns the data as-is from the client.
|
|
86
|
+
* - 'zod' uses @kubb/plugin-zod to parse the data.
|
|
85
87
|
* @default 'client'
|
|
86
88
|
*/
|
|
87
89
|
parser?: 'client' | 'zod'
|
|
88
90
|
/**
|
|
89
|
-
* Which client should be used to do the HTTP calls
|
|
90
|
-
* - 'axios'
|
|
91
|
-
* - 'fetch'
|
|
91
|
+
* Which client should be used to do the HTTP calls.
|
|
92
|
+
* - 'axios' uses axios client for HTTP requests.
|
|
93
|
+
* - 'fetch' uses native fetch API for HTTP requests.
|
|
92
94
|
* @default 'axios'
|
|
93
95
|
*/
|
|
94
96
|
client?: 'axios' | 'fetch'
|
|
95
97
|
/**
|
|
96
|
-
* How to generate the client code
|
|
97
|
-
* - 'function'
|
|
98
|
-
* - 'class'
|
|
99
|
-
* - 'staticClass'
|
|
98
|
+
* How to generate the client code.
|
|
99
|
+
* - 'function' generates standalone functions for each operation.
|
|
100
|
+
* - 'class' generates a class with methods for each operation.
|
|
101
|
+
* - 'staticClass' generates a class with static methods for each operation.
|
|
100
102
|
* @default 'function'
|
|
101
103
|
*/
|
|
102
104
|
clientType?: 'function' | 'class' | 'staticClass'
|
|
@@ -104,7 +106,7 @@ export type Options = {
|
|
|
104
106
|
* Bundle the selected client into the generated `.kubb` directory.
|
|
105
107
|
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
106
108
|
* @default false
|
|
107
|
-
* In version 5 of Kubb this
|
|
109
|
+
* In version 5 of Kubb this is by default true
|
|
108
110
|
*/
|
|
109
111
|
bundle?: boolean
|
|
110
112
|
transformers?: {
|