@kubb/plugin-react-query 4.18.4 → 4.18.5
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-OcdlPFQg.d.cts → types-DjAktNGY.d.cts} +105 -100
- package/dist/{types-BDdmQqvX.d.ts → types-O2rCspo7.d.ts} +105 -100
- package/package.json +7 -7
- package/src/types.ts +28 -28
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Operation, i as Transformer, l as __name, o as OperationSchemas, r as PluginReactQuery, t as Infinite } from "./types-
|
|
1
|
+
import { c as Operation, i as Transformer, l as __name, o as OperationSchemas, r as PluginReactQuery, t as Infinite } from "./types-DjAktNGY.cjs";
|
|
2
2
|
import { FunctionParams } from "@kubb/react-fabric";
|
|
3
3
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
4
4
|
|
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { c as Operation, i as Transformer, o as OperationSchemas, r as PluginReactQuery, t as Infinite } from "./types-
|
|
2
|
+
import { c as Operation, i as Transformer, o as OperationSchemas, r as PluginReactQuery, t as Infinite } from "./types-O2rCspo7.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,4 +1,4 @@
|
|
|
1
|
-
import { a as ReactGenerator, l as __name, r as PluginReactQuery } from "./types-
|
|
1
|
+
import { a as ReactGenerator, l as __name, r as PluginReactQuery } from "./types-DjAktNGY.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/generators/customHookOptionsFileGenerator.d.ts
|
|
4
4
|
declare const customHookOptionsFileGenerator: ReactGenerator<PluginReactQuery>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { a as ReactGenerator, r as PluginReactQuery } from "./types-
|
|
2
|
+
import { a as ReactGenerator, r as PluginReactQuery } from "./types-O2rCspo7.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/customHookOptionsFileGenerator.d.ts
|
|
5
5
|
declare const customHookOptionsFileGenerator: ReactGenerator<PluginReactQuery>;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as __name, n as Options, r as PluginReactQuery, s as UserPluginWithLifeCycle } from "./types-
|
|
1
|
+
import { l as __name, n as Options, r as PluginReactQuery, s as UserPluginWithLifeCycle } from "./types-DjAktNGY.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin.d.ts
|
|
4
4
|
declare const pluginReactQueryName = "plugin-react-query";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as Options, r as PluginReactQuery, s as UserPluginWithLifeCycle } from "./types-
|
|
2
|
+
import { n as Options, r as PluginReactQuery, s as UserPluginWithLifeCycle } from "./types-O2rCspo7.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginReactQueryName = "plugin-react-query";
|
|
@@ -38,7 +38,7 @@ declare class Oas extends BaseOas {
|
|
|
38
38
|
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
39
39
|
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
40
40
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
41
|
-
|
|
41
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
42
42
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
@@ -340,7 +340,7 @@ type Config<TInput = Input> = {
|
|
|
340
340
|
input: TInput;
|
|
341
341
|
output: {
|
|
342
342
|
/**
|
|
343
|
-
* The path where all generated files
|
|
343
|
+
* The path where all generated files receives exported.
|
|
344
344
|
* This can be an absolute path or a path relative to the specified root option.
|
|
345
345
|
*/
|
|
346
346
|
path: string;
|
|
@@ -355,41 +355,39 @@ type Config<TInput = Input> = {
|
|
|
355
355
|
write?: boolean;
|
|
356
356
|
/**
|
|
357
357
|
* Specifies the formatting tool to be used.
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* - '
|
|
362
|
-
* -
|
|
363
|
-
*
|
|
364
|
-
*
|
|
358
|
+
* - 'auto' automatically detects and uses biome or prettier (in that order of preference).
|
|
359
|
+
* - 'prettier' uses Prettier for code formatting.
|
|
360
|
+
* - 'biome' uses Biome for code formatting.
|
|
361
|
+
* - 'oxfmt' uses Oxfmt for code formatting.
|
|
362
|
+
* - false disables code formatting.
|
|
363
|
+
* @default 'prettier'
|
|
365
364
|
*/
|
|
366
365
|
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
367
366
|
/**
|
|
368
367
|
* Specifies the linter that should be used to analyze the code.
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
* - '
|
|
373
|
-
* -
|
|
374
|
-
*
|
|
375
|
-
* - 'oxlint': Represents the Oxlint tool for linting purposes.
|
|
376
|
-
*
|
|
368
|
+
* - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
369
|
+
* - 'eslint' uses ESLint for linting.
|
|
370
|
+
* - 'biome' uses Biome for linting.
|
|
371
|
+
* - 'oxlint' uses Oxlint for linting.
|
|
372
|
+
* - false disables linting.
|
|
373
|
+
* @default 'auto'
|
|
377
374
|
*/
|
|
378
375
|
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
379
376
|
/**
|
|
380
|
-
*
|
|
377
|
+
* Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
|
|
381
378
|
* @default { '.ts': '.ts'}
|
|
382
379
|
*/
|
|
383
380
|
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
384
381
|
/**
|
|
385
|
-
*
|
|
382
|
+
* 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`).
|
|
386
383
|
* @default 'named'
|
|
387
384
|
*/
|
|
388
385
|
barrelType?: Exclude<BarrelType, 'propagate'> | false;
|
|
389
386
|
/**
|
|
390
|
-
*
|
|
391
|
-
* - 'simple'
|
|
392
|
-
* - 'full'
|
|
387
|
+
* Adds a default banner to the start of every generated file indicating it was generated by Kubb.
|
|
388
|
+
* - 'simple' adds banner with link to Kubb.
|
|
389
|
+
* - 'full' adds source, title, description, and OpenAPI version.
|
|
390
|
+
* - false disables banner generation.
|
|
393
391
|
* @default 'simple'
|
|
394
392
|
*/
|
|
395
393
|
defaultBanner?: 'simple' | 'full' | false;
|
|
@@ -402,17 +400,17 @@ type Config<TInput = Input> = {
|
|
|
402
400
|
override?: boolean;
|
|
403
401
|
};
|
|
404
402
|
/**
|
|
405
|
-
* An array of Kubb plugins that
|
|
403
|
+
* An array of Kubb plugins that used in the generation.
|
|
406
404
|
* Each plugin may include additional configurable options(defined in the plugin itself).
|
|
407
|
-
* If a plugin depends on another plugin, an error
|
|
405
|
+
* If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
|
|
408
406
|
*/
|
|
409
407
|
plugins?: Array<Plugin>;
|
|
410
408
|
/**
|
|
411
|
-
* Hooks
|
|
409
|
+
* Hooks triggered when a specific action occurs in Kubb.
|
|
412
410
|
*/
|
|
413
411
|
hooks?: {
|
|
414
412
|
/**
|
|
415
|
-
* Hook that
|
|
413
|
+
* Hook that triggers at the end of all executions.
|
|
416
414
|
* Useful for running Prettier or ESLint to format/lint your code.
|
|
417
415
|
*/
|
|
418
416
|
done?: string | Array<string>;
|
|
@@ -441,7 +439,7 @@ TContext = any,
|
|
|
441
439
|
TResolvePathOptions extends object = object> = {
|
|
442
440
|
name: TName;
|
|
443
441
|
/**
|
|
444
|
-
* Same
|
|
442
|
+
* Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
445
443
|
*/
|
|
446
444
|
key: PluginKey<TName | string>;
|
|
447
445
|
options: TOptions;
|
|
@@ -462,12 +460,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
462
460
|
*/
|
|
463
461
|
options: TOptions['resolvedOptions'];
|
|
464
462
|
/**
|
|
465
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
463
|
+
* 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.
|
|
466
464
|
* Can be used to validate dependent plugins.
|
|
467
465
|
*/
|
|
468
466
|
pre?: Array<string>;
|
|
469
467
|
/**
|
|
470
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
468
|
+
* 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.
|
|
471
469
|
*/
|
|
472
470
|
post?: Array<string>;
|
|
473
471
|
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
@@ -485,12 +483,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
485
483
|
*/
|
|
486
484
|
key: TOptions['key'];
|
|
487
485
|
/**
|
|
488
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
486
|
+
* 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.
|
|
489
487
|
* Can be used to validate dependent plugins.
|
|
490
488
|
*/
|
|
491
489
|
pre?: Array<string>;
|
|
492
490
|
/**
|
|
493
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
491
|
+
* 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.
|
|
494
492
|
*/
|
|
495
493
|
post?: Array<string>;
|
|
496
494
|
/**
|
|
@@ -540,10 +538,12 @@ type ResolveNameParams = {
|
|
|
540
538
|
name: string;
|
|
541
539
|
pluginKey?: Plugin['key'];
|
|
542
540
|
/**
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
541
|
+
* Specifies the type of entity being named.
|
|
542
|
+
* - 'file' customizes the name of the created file (uses camelCase).
|
|
543
|
+
* - 'function' customizes the exported function names (uses camelCase).
|
|
544
|
+
* - 'type' customizes TypeScript types (uses PascalCase).
|
|
545
|
+
* - 'const' customizes variable names (uses camelCase).
|
|
546
|
+
* @default undefined
|
|
547
547
|
*/
|
|
548
548
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
549
549
|
};
|
|
@@ -598,11 +598,14 @@ type GroupContext = {
|
|
|
598
598
|
};
|
|
599
599
|
type Group = {
|
|
600
600
|
/**
|
|
601
|
-
*
|
|
601
|
+
* Defines the type where to group the files.
|
|
602
|
+
* - 'tag' groups files by OpenAPI tags.
|
|
603
|
+
* - 'path' groups files by OpenAPI paths.
|
|
604
|
+
* @default undefined
|
|
602
605
|
*/
|
|
603
606
|
type: 'tag' | 'path';
|
|
604
607
|
/**
|
|
605
|
-
* Return the name of a group based on the group name, this
|
|
608
|
+
* Return the name of a group based on the group name, this used for the file and name generation
|
|
606
609
|
*/
|
|
607
610
|
name?: (context: GroupContext) => string;
|
|
608
611
|
};
|
|
@@ -674,7 +677,7 @@ declare class PluginManager {
|
|
|
674
677
|
parameters: PluginParameter<H>;
|
|
675
678
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
676
679
|
/**
|
|
677
|
-
*
|
|
680
|
+
* Returns the first non-null result.
|
|
678
681
|
*/
|
|
679
682
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
680
683
|
hookName,
|
|
@@ -686,7 +689,7 @@ declare class PluginManager {
|
|
|
686
689
|
skipped?: ReadonlySet<Plugin> | null;
|
|
687
690
|
}): Promise<SafeParseResult<H>>;
|
|
688
691
|
/**
|
|
689
|
-
*
|
|
692
|
+
* Returns the first non-null result.
|
|
690
693
|
*/
|
|
691
694
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
692
695
|
hookName,
|
|
@@ -698,15 +701,15 @@ declare class PluginManager {
|
|
|
698
701
|
skipped?: ReadonlySet<Plugin> | null;
|
|
699
702
|
}): SafeParseResult<H>;
|
|
700
703
|
/**
|
|
701
|
-
*
|
|
704
|
+
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
702
705
|
*/
|
|
703
|
-
hookParallel<H extends PluginLifecycleHooks,
|
|
706
|
+
hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
|
|
704
707
|
hookName,
|
|
705
708
|
parameters
|
|
706
709
|
}: {
|
|
707
710
|
hookName: H;
|
|
708
711
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
709
|
-
}): Promise<Awaited<
|
|
712
|
+
}): Promise<Awaited<TOutput>[]>;
|
|
710
713
|
/**
|
|
711
714
|
* Chains plugins
|
|
712
715
|
*/
|
|
@@ -975,8 +978,8 @@ type SchemaKeywordMapper = {
|
|
|
975
978
|
*/
|
|
976
979
|
path: KubbFile.Path;
|
|
977
980
|
/**
|
|
978
|
-
* When true `File.Import`
|
|
979
|
-
* When false a reference
|
|
981
|
+
* When true `File.Import` is used.
|
|
982
|
+
* When false a reference is used inside the current file.
|
|
980
983
|
*/
|
|
981
984
|
isImportable: boolean;
|
|
982
985
|
};
|
|
@@ -1108,7 +1111,7 @@ type SchemaGeneratorOptions = {
|
|
|
1108
1111
|
*/
|
|
1109
1112
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1110
1113
|
/**
|
|
1111
|
-
* Receive schema and name(
|
|
1114
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
1112
1115
|
* TODO TODO add docs
|
|
1113
1116
|
* @beta
|
|
1114
1117
|
*/
|
|
@@ -1187,7 +1190,7 @@ type Options$1 = {
|
|
|
1187
1190
|
output?: Output<Oas>;
|
|
1188
1191
|
/**
|
|
1189
1192
|
* Define which contentType should be used.
|
|
1190
|
-
* By default, the first JSON valid mediaType
|
|
1193
|
+
* By default, the first JSON valid mediaType is used
|
|
1191
1194
|
*/
|
|
1192
1195
|
contentType?: contentType;
|
|
1193
1196
|
/**
|
|
@@ -1212,16 +1215,17 @@ type Options$1 = {
|
|
|
1212
1215
|
*/
|
|
1213
1216
|
operations?: boolean;
|
|
1214
1217
|
/**
|
|
1215
|
-
* Export urls that are used by operation x
|
|
1216
|
-
*
|
|
1217
|
-
* false
|
|
1218
|
+
* Export urls that are used by operation x.
|
|
1219
|
+
* - 'export' makes them part of your barrel file.
|
|
1220
|
+
* - false does not make them exportable.
|
|
1221
|
+
* @default false
|
|
1218
1222
|
* @example getGetPetByIdUrl
|
|
1219
1223
|
*/
|
|
1220
1224
|
urlType?: 'export' | false;
|
|
1221
1225
|
/**
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1226
|
+
* Client import path for API calls.
|
|
1227
|
+
* Used as `import client from '${client.importPath}'`.
|
|
1228
|
+
* Accepts relative and absolute paths; path changes are not performed.
|
|
1225
1229
|
*/
|
|
1226
1230
|
importPath?: string;
|
|
1227
1231
|
/**
|
|
@@ -1229,49 +1233,50 @@ type Options$1 = {
|
|
|
1229
1233
|
*/
|
|
1230
1234
|
baseURL?: string;
|
|
1231
1235
|
/**
|
|
1232
|
-
* ReturnType that
|
|
1233
|
-
* - 'data'
|
|
1234
|
-
* - 'full'
|
|
1236
|
+
* ReturnType that is used when calling the client.
|
|
1237
|
+
* - 'data' returns ResponseConfig[data].
|
|
1238
|
+
* - 'full' returns ResponseConfig.
|
|
1235
1239
|
* @default 'data'
|
|
1236
1240
|
*/
|
|
1237
1241
|
dataReturnType?: 'data' | 'full';
|
|
1238
1242
|
/**
|
|
1239
1243
|
* How to style your params, by default no casing is applied
|
|
1240
|
-
* - 'camelcase'
|
|
1244
|
+
* - 'camelcase' uses camelcase for the params names
|
|
1241
1245
|
*/
|
|
1242
1246
|
paramsCasing?: 'camelcase';
|
|
1243
1247
|
/**
|
|
1244
|
-
* How to pass your params
|
|
1245
|
-
* - 'object'
|
|
1246
|
-
* - 'inline'
|
|
1248
|
+
* How to pass your params.
|
|
1249
|
+
* - 'object' returns the params and pathParams as an object.
|
|
1250
|
+
* - 'inline' returns the params as comma separated params.
|
|
1247
1251
|
* @default 'inline'
|
|
1248
1252
|
*/
|
|
1249
1253
|
paramsType?: 'object' | 'inline';
|
|
1250
1254
|
/**
|
|
1251
1255
|
* How to pass your pathParams.
|
|
1252
|
-
* - 'object'
|
|
1253
|
-
* - 'inline'
|
|
1256
|
+
* - 'object' returns the pathParams as an object.
|
|
1257
|
+
* - 'inline' returns the pathParams as comma separated params.
|
|
1254
1258
|
* @default 'inline'
|
|
1255
1259
|
*/
|
|
1256
1260
|
pathParamsType?: 'object' | 'inline';
|
|
1257
1261
|
/**
|
|
1258
|
-
* Which parser can be used before returning the data
|
|
1259
|
-
* - '
|
|
1262
|
+
* Which parser can be used before returning the data.
|
|
1263
|
+
* - 'client' returns the data as-is from the client.
|
|
1264
|
+
* - 'zod' uses @kubb/plugin-zod to parse the data.
|
|
1260
1265
|
* @default 'client'
|
|
1261
1266
|
*/
|
|
1262
1267
|
parser?: 'client' | 'zod';
|
|
1263
1268
|
/**
|
|
1264
|
-
* Which client should be used to do the HTTP calls
|
|
1265
|
-
* - 'axios'
|
|
1266
|
-
* - 'fetch'
|
|
1269
|
+
* Which client should be used to do the HTTP calls.
|
|
1270
|
+
* - 'axios' uses axios client for HTTP requests.
|
|
1271
|
+
* - 'fetch' uses native fetch API for HTTP requests.
|
|
1267
1272
|
* @default 'axios'
|
|
1268
1273
|
*/
|
|
1269
1274
|
client?: 'axios' | 'fetch';
|
|
1270
1275
|
/**
|
|
1271
|
-
* How to generate the client code
|
|
1272
|
-
* - 'function'
|
|
1273
|
-
* - 'class'
|
|
1274
|
-
* - 'staticClass'
|
|
1276
|
+
* How to generate the client code.
|
|
1277
|
+
* - 'function' generates standalone functions for each operation.
|
|
1278
|
+
* - 'class' generates a class with methods for each operation.
|
|
1279
|
+
* - 'staticClass' generates a class with static methods for each operation.
|
|
1275
1280
|
* @default 'function'
|
|
1276
1281
|
*/
|
|
1277
1282
|
clientType?: 'function' | 'class' | 'staticClass';
|
|
@@ -1279,7 +1284,7 @@ type Options$1 = {
|
|
|
1279
1284
|
* Bundle the selected client into the generated `.kubb` directory.
|
|
1280
1285
|
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
1281
1286
|
* @default false
|
|
1282
|
-
* In version 5 of Kubb this
|
|
1287
|
+
* In version 5 of Kubb this is by default true
|
|
1283
1288
|
*/
|
|
1284
1289
|
bundle?: boolean;
|
|
1285
1290
|
transformers?: {
|
|
@@ -1333,10 +1338,10 @@ type Query = {
|
|
|
1333
1338
|
*/
|
|
1334
1339
|
methods: Array<HttpMethod>;
|
|
1335
1340
|
/**
|
|
1336
|
-
* Path to the useQuery
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1341
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
1342
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
1343
|
+
* Accepts relative and absolute paths.
|
|
1344
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
1340
1345
|
* @default '@tanstack/react-query'
|
|
1341
1346
|
*/
|
|
1342
1347
|
importPath?: string;
|
|
@@ -1348,10 +1353,10 @@ type Mutation = {
|
|
|
1348
1353
|
*/
|
|
1349
1354
|
methods: Array<HttpMethod>;
|
|
1350
1355
|
/**
|
|
1351
|
-
* Path to the useQuery
|
|
1352
|
-
*
|
|
1353
|
-
*
|
|
1354
|
-
*
|
|
1356
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
1357
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
1358
|
+
* Accepts relative and absolute paths.
|
|
1359
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
1355
1360
|
* @default '@tanstack/react-query'
|
|
1356
1361
|
*/
|
|
1357
1362
|
importPath?: string;
|
|
@@ -1363,17 +1368,17 @@ type Infinite = {
|
|
|
1363
1368
|
*/
|
|
1364
1369
|
queryParam: string;
|
|
1365
1370
|
/**
|
|
1366
|
-
* Which field of the data
|
|
1371
|
+
* Which field of the data is used, set it to undefined when no cursor is known.
|
|
1367
1372
|
* @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
|
|
1368
1373
|
*/
|
|
1369
1374
|
cursorParam?: string | undefined;
|
|
1370
1375
|
/**
|
|
1371
|
-
* Which field of the data
|
|
1376
|
+
* Which field of the data is used to get the cursor for the next page.
|
|
1372
1377
|
* Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
|
|
1373
1378
|
*/
|
|
1374
1379
|
nextParam?: string | string[] | undefined;
|
|
1375
1380
|
/**
|
|
1376
|
-
* Which field of the data
|
|
1381
|
+
* Which field of the data is used to get the cursor for the previous page.
|
|
1377
1382
|
* Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
|
|
1378
1383
|
*/
|
|
1379
1384
|
previousParam?: string | string[] | undefined;
|
|
@@ -1385,14 +1390,14 @@ type Infinite = {
|
|
|
1385
1390
|
};
|
|
1386
1391
|
type CustomOptions = {
|
|
1387
1392
|
/**
|
|
1388
|
-
* Path to the hook that
|
|
1389
|
-
* It
|
|
1393
|
+
* Path to the hook that is used to customize the hook options.
|
|
1394
|
+
* It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
|
|
1390
1395
|
* It allows both relative and absolute paths but be aware that we will not change the path.
|
|
1391
1396
|
*/
|
|
1392
1397
|
importPath: string;
|
|
1393
1398
|
/**
|
|
1394
|
-
* Name of the exported hook that
|
|
1395
|
-
* It
|
|
1399
|
+
* Name of the exported hook that is used to customize the hook options.
|
|
1400
|
+
* It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
|
|
1396
1401
|
* @default 'useCustomHookOptions'
|
|
1397
1402
|
*/
|
|
1398
1403
|
name?: string;
|
|
@@ -1405,7 +1410,7 @@ type Options = {
|
|
|
1405
1410
|
output?: Output<Oas>;
|
|
1406
1411
|
/**
|
|
1407
1412
|
* Define which contentType should be used.
|
|
1408
|
-
* By default, the first JSON valid mediaType
|
|
1413
|
+
* By default, the first JSON valid mediaType is used
|
|
1409
1414
|
*/
|
|
1410
1415
|
contentType?: contentType;
|
|
1411
1416
|
/**
|
|
@@ -1427,49 +1432,49 @@ type Options = {
|
|
|
1427
1432
|
override?: Array<Override<ResolvedOptions>>;
|
|
1428
1433
|
/**
|
|
1429
1434
|
* How to style your params, by default no casing is applied
|
|
1430
|
-
* - 'camelcase'
|
|
1435
|
+
* - 'camelcase' uses camelcase for the params names
|
|
1431
1436
|
*/
|
|
1432
1437
|
paramsCasing?: 'camelcase';
|
|
1433
1438
|
/**
|
|
1434
|
-
* How to pass your params
|
|
1435
|
-
* - 'object'
|
|
1436
|
-
* - 'inline'
|
|
1439
|
+
* How to pass your params.
|
|
1440
|
+
* - 'object' returns the params and pathParams as an object.
|
|
1441
|
+
* - 'inline' returns the params as comma separated params.
|
|
1437
1442
|
* @default 'inline'
|
|
1438
1443
|
*/
|
|
1439
1444
|
paramsType?: 'object' | 'inline';
|
|
1440
1445
|
/**
|
|
1441
1446
|
* How to pass your pathParams.
|
|
1442
|
-
* - 'object'
|
|
1443
|
-
* - 'inline'
|
|
1447
|
+
* - 'object' returns the pathParams as an object.
|
|
1448
|
+
* - 'inline': returns the pathParams as comma separated params.
|
|
1444
1449
|
* @default 'inline'
|
|
1445
1450
|
*/
|
|
1446
1451
|
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
1447
1452
|
/**
|
|
1448
|
-
* When set, an infiniteQuery hooks
|
|
1453
|
+
* When set, an infiniteQuery hooks is added.
|
|
1449
1454
|
*/
|
|
1450
1455
|
infinite?: Partial<Infinite> | false;
|
|
1451
1456
|
/**
|
|
1452
|
-
* When set, a suspenseQuery hooks
|
|
1457
|
+
* When set, a suspenseQuery hooks is added.
|
|
1453
1458
|
*/
|
|
1454
1459
|
suspense?: Partial<Suspense> | false;
|
|
1455
1460
|
queryKey?: QueryKey;
|
|
1456
1461
|
/**
|
|
1457
|
-
* Override some useQuery
|
|
1462
|
+
* Override some useQuery behaviors.
|
|
1458
1463
|
*/
|
|
1459
1464
|
query?: Partial<Query> | false;
|
|
1460
1465
|
mutationKey?: MutationKey;
|
|
1461
1466
|
/**
|
|
1462
|
-
* Override some useMutation
|
|
1467
|
+
* Override some useMutation behaviors.
|
|
1463
1468
|
*/
|
|
1464
1469
|
mutation?: Partial<Mutation> | false;
|
|
1465
1470
|
/**
|
|
1466
|
-
* When set, a custom hook
|
|
1471
|
+
* When set, a custom hook is used to customize the options of the generated hooks.
|
|
1467
1472
|
* It will also generate a `HookOptions` type that can be used to type the custom options of each hook for type-safety.
|
|
1468
1473
|
*/
|
|
1469
1474
|
customOptions?: CustomOptions;
|
|
1470
1475
|
/**
|
|
1471
1476
|
* Which parser should be used before returning the data to `@tanstack/query`.
|
|
1472
|
-
* `'zod'`
|
|
1477
|
+
* `'zod'` uses `@kubb/plugin-zod` to parse the data.
|
|
1473
1478
|
*/
|
|
1474
1479
|
parser?: PluginClient['options']['parser'];
|
|
1475
1480
|
transformers?: {
|
|
@@ -1505,4 +1510,4 @@ type ResolvedOptions = {
|
|
|
1505
1510
|
type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1506
1511
|
//#endregion
|
|
1507
1512
|
export { ReactGenerator as a, Operation$1 as c, Transformer as i, __name as l, Options as n, OperationSchemas as o, PluginReactQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
|
|
1508
|
-
//# sourceMappingURL=types-
|
|
1513
|
+
//# sourceMappingURL=types-DjAktNGY.d.cts.map
|
|
@@ -37,7 +37,7 @@ declare class Oas extends BaseOas {
|
|
|
37
37
|
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
38
38
|
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
39
39
|
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
40
|
-
|
|
40
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
41
41
|
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
42
42
|
}
|
|
43
43
|
//#endregion
|
|
@@ -339,7 +339,7 @@ type Config<TInput = Input> = {
|
|
|
339
339
|
input: TInput;
|
|
340
340
|
output: {
|
|
341
341
|
/**
|
|
342
|
-
* The path where all generated files
|
|
342
|
+
* The path where all generated files receives exported.
|
|
343
343
|
* This can be an absolute path or a path relative to the specified root option.
|
|
344
344
|
*/
|
|
345
345
|
path: string;
|
|
@@ -354,41 +354,39 @@ type Config<TInput = Input> = {
|
|
|
354
354
|
write?: boolean;
|
|
355
355
|
/**
|
|
356
356
|
* Specifies the formatting tool to be used.
|
|
357
|
-
*
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* - '
|
|
361
|
-
* -
|
|
362
|
-
*
|
|
363
|
-
*
|
|
357
|
+
* - 'auto' automatically detects and uses biome or prettier (in that order of preference).
|
|
358
|
+
* - 'prettier' uses Prettier for code formatting.
|
|
359
|
+
* - 'biome' uses Biome for code formatting.
|
|
360
|
+
* - 'oxfmt' uses Oxfmt for code formatting.
|
|
361
|
+
* - false disables code formatting.
|
|
362
|
+
* @default 'prettier'
|
|
364
363
|
*/
|
|
365
364
|
format?: 'auto' | 'prettier' | 'biome' | 'oxfmt' | false;
|
|
366
365
|
/**
|
|
367
366
|
* 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
|
-
*
|
|
367
|
+
* - 'auto' automatically detects and uses biome, oxlint, or eslint (in that order of preference).
|
|
368
|
+
* - 'eslint' uses ESLint for linting.
|
|
369
|
+
* - 'biome' uses Biome for linting.
|
|
370
|
+
* - 'oxlint' uses Oxlint for linting.
|
|
371
|
+
* - false disables linting.
|
|
372
|
+
* @default 'auto'
|
|
376
373
|
*/
|
|
377
374
|
lint?: 'auto' | 'eslint' | 'biome' | 'oxlint' | false;
|
|
378
375
|
/**
|
|
379
|
-
*
|
|
376
|
+
* Overrides the extension for generated imports and exports. By default, each plugin adds an extension.
|
|
380
377
|
* @default { '.ts': '.ts'}
|
|
381
378
|
*/
|
|
382
379
|
extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
|
|
383
380
|
/**
|
|
384
|
-
*
|
|
381
|
+
* 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
382
|
* @default 'named'
|
|
386
383
|
*/
|
|
387
384
|
barrelType?: Exclude<BarrelType, 'propagate'> | false;
|
|
388
385
|
/**
|
|
389
|
-
*
|
|
390
|
-
* - 'simple'
|
|
391
|
-
* - 'full'
|
|
386
|
+
* Adds a default banner to the start of every generated file indicating it was generated by Kubb.
|
|
387
|
+
* - 'simple' adds banner with link to Kubb.
|
|
388
|
+
* - 'full' adds source, title, description, and OpenAPI version.
|
|
389
|
+
* - false disables banner generation.
|
|
392
390
|
* @default 'simple'
|
|
393
391
|
*/
|
|
394
392
|
defaultBanner?: 'simple' | 'full' | false;
|
|
@@ -401,17 +399,17 @@ type Config<TInput = Input> = {
|
|
|
401
399
|
override?: boolean;
|
|
402
400
|
};
|
|
403
401
|
/**
|
|
404
|
-
* An array of Kubb plugins that
|
|
402
|
+
* An array of Kubb plugins that used in the generation.
|
|
405
403
|
* Each plugin may include additional configurable options(defined in the plugin itself).
|
|
406
|
-
* If a plugin depends on another plugin, an error
|
|
404
|
+
* If a plugin depends on another plugin, an error is returned if the required dependency is missing. See pre for more details.
|
|
407
405
|
*/
|
|
408
406
|
plugins?: Array<Plugin>;
|
|
409
407
|
/**
|
|
410
|
-
* Hooks
|
|
408
|
+
* Hooks triggered when a specific action occurs in Kubb.
|
|
411
409
|
*/
|
|
412
410
|
hooks?: {
|
|
413
411
|
/**
|
|
414
|
-
* Hook that
|
|
412
|
+
* Hook that triggers at the end of all executions.
|
|
415
413
|
* Useful for running Prettier or ESLint to format/lint your code.
|
|
416
414
|
*/
|
|
417
415
|
done?: string | Array<string>;
|
|
@@ -440,7 +438,7 @@ TContext = any,
|
|
|
440
438
|
TResolvePathOptions extends object = object> = {
|
|
441
439
|
name: TName;
|
|
442
440
|
/**
|
|
443
|
-
* Same
|
|
441
|
+
* Same behavior like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
444
442
|
*/
|
|
445
443
|
key: PluginKey<TName | string>;
|
|
446
444
|
options: TOptions;
|
|
@@ -461,12 +459,12 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
461
459
|
*/
|
|
462
460
|
options: TOptions['resolvedOptions'];
|
|
463
461
|
/**
|
|
464
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
462
|
+
* 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
463
|
* Can be used to validate dependent plugins.
|
|
466
464
|
*/
|
|
467
465
|
pre?: Array<string>;
|
|
468
466
|
/**
|
|
469
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
467
|
+
* 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
468
|
*/
|
|
471
469
|
post?: Array<string>;
|
|
472
470
|
inject?: (this: PluginContext<TOptions>, context: PluginContext<TOptions>) => TOptions['context'];
|
|
@@ -484,12 +482,12 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
484
482
|
*/
|
|
485
483
|
key: TOptions['key'];
|
|
486
484
|
/**
|
|
487
|
-
* Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin
|
|
485
|
+
* 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
486
|
* Can be used to validate dependent plugins.
|
|
489
487
|
*/
|
|
490
488
|
pre?: Array<string>;
|
|
491
489
|
/**
|
|
492
|
-
* Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin
|
|
490
|
+
* 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
491
|
*/
|
|
494
492
|
post?: Array<string>;
|
|
495
493
|
/**
|
|
@@ -539,10 +537,12 @@ type ResolveNameParams = {
|
|
|
539
537
|
name: string;
|
|
540
538
|
pluginKey?: Plugin['key'];
|
|
541
539
|
/**
|
|
542
|
-
*
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
540
|
+
* Specifies the type of entity being named.
|
|
541
|
+
* - 'file' customizes the name of the created file (uses camelCase).
|
|
542
|
+
* - 'function' customizes the exported function names (uses camelCase).
|
|
543
|
+
* - 'type' customizes TypeScript types (uses PascalCase).
|
|
544
|
+
* - 'const' customizes variable names (uses camelCase).
|
|
545
|
+
* @default undefined
|
|
546
546
|
*/
|
|
547
547
|
type?: 'file' | 'function' | 'type' | 'const';
|
|
548
548
|
};
|
|
@@ -597,11 +597,14 @@ type GroupContext = {
|
|
|
597
597
|
};
|
|
598
598
|
type Group = {
|
|
599
599
|
/**
|
|
600
|
-
*
|
|
600
|
+
* Defines the type where to group the files.
|
|
601
|
+
* - 'tag' groups files by OpenAPI tags.
|
|
602
|
+
* - 'path' groups files by OpenAPI paths.
|
|
603
|
+
* @default undefined
|
|
601
604
|
*/
|
|
602
605
|
type: 'tag' | 'path';
|
|
603
606
|
/**
|
|
604
|
-
* Return the name of a group based on the group name, this
|
|
607
|
+
* Return the name of a group based on the group name, this used for the file and name generation
|
|
605
608
|
*/
|
|
606
609
|
name?: (context: GroupContext) => string;
|
|
607
610
|
};
|
|
@@ -673,7 +676,7 @@ declare class PluginManager {
|
|
|
673
676
|
parameters: PluginParameter<H>;
|
|
674
677
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
675
678
|
/**
|
|
676
|
-
*
|
|
679
|
+
* Returns the first non-null result.
|
|
677
680
|
*/
|
|
678
681
|
hookFirst<H extends PluginLifecycleHooks>({
|
|
679
682
|
hookName,
|
|
@@ -685,7 +688,7 @@ declare class PluginManager {
|
|
|
685
688
|
skipped?: ReadonlySet<Plugin> | null;
|
|
686
689
|
}): Promise<SafeParseResult<H>>;
|
|
687
690
|
/**
|
|
688
|
-
*
|
|
691
|
+
* Returns the first non-null result.
|
|
689
692
|
*/
|
|
690
693
|
hookFirstSync<H extends PluginLifecycleHooks>({
|
|
691
694
|
hookName,
|
|
@@ -697,15 +700,15 @@ declare class PluginManager {
|
|
|
697
700
|
skipped?: ReadonlySet<Plugin> | null;
|
|
698
701
|
}): SafeParseResult<H>;
|
|
699
702
|
/**
|
|
700
|
-
*
|
|
703
|
+
* Runs all plugins in parallel based on `this.plugin` order and `pre`/`post` settings.
|
|
701
704
|
*/
|
|
702
|
-
hookParallel<H extends PluginLifecycleHooks,
|
|
705
|
+
hookParallel<H extends PluginLifecycleHooks, TOutput = void>({
|
|
703
706
|
hookName,
|
|
704
707
|
parameters
|
|
705
708
|
}: {
|
|
706
709
|
hookName: H;
|
|
707
710
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
708
|
-
}): Promise<Awaited<
|
|
711
|
+
}): Promise<Awaited<TOutput>[]>;
|
|
709
712
|
/**
|
|
710
713
|
* Chains plugins
|
|
711
714
|
*/
|
|
@@ -974,8 +977,8 @@ type SchemaKeywordMapper = {
|
|
|
974
977
|
*/
|
|
975
978
|
path: KubbFile.Path;
|
|
976
979
|
/**
|
|
977
|
-
* When true `File.Import`
|
|
978
|
-
* When false a reference
|
|
980
|
+
* When true `File.Import` is used.
|
|
981
|
+
* When false a reference is used inside the current file.
|
|
979
982
|
*/
|
|
980
983
|
isImportable: boolean;
|
|
981
984
|
};
|
|
@@ -1107,7 +1110,7 @@ type SchemaGeneratorOptions = {
|
|
|
1107
1110
|
*/
|
|
1108
1111
|
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
1109
1112
|
/**
|
|
1110
|
-
* Receive schema and name(
|
|
1113
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
1111
1114
|
* TODO TODO add docs
|
|
1112
1115
|
* @beta
|
|
1113
1116
|
*/
|
|
@@ -1186,7 +1189,7 @@ type Options$1 = {
|
|
|
1186
1189
|
output?: Output<Oas>;
|
|
1187
1190
|
/**
|
|
1188
1191
|
* Define which contentType should be used.
|
|
1189
|
-
* By default, the first JSON valid mediaType
|
|
1192
|
+
* By default, the first JSON valid mediaType is used
|
|
1190
1193
|
*/
|
|
1191
1194
|
contentType?: contentType;
|
|
1192
1195
|
/**
|
|
@@ -1211,16 +1214,17 @@ type Options$1 = {
|
|
|
1211
1214
|
*/
|
|
1212
1215
|
operations?: boolean;
|
|
1213
1216
|
/**
|
|
1214
|
-
* Export urls that are used by operation x
|
|
1215
|
-
*
|
|
1216
|
-
* false
|
|
1217
|
+
* Export urls that are used by operation x.
|
|
1218
|
+
* - 'export' makes them part of your barrel file.
|
|
1219
|
+
* - false does not make them exportable.
|
|
1220
|
+
* @default false
|
|
1217
1221
|
* @example getGetPetByIdUrl
|
|
1218
1222
|
*/
|
|
1219
1223
|
urlType?: 'export' | false;
|
|
1220
1224
|
/**
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1225
|
+
* Client import path for API calls.
|
|
1226
|
+
* Used as `import client from '${client.importPath}'`.
|
|
1227
|
+
* Accepts relative and absolute paths; path changes are not performed.
|
|
1224
1228
|
*/
|
|
1225
1229
|
importPath?: string;
|
|
1226
1230
|
/**
|
|
@@ -1228,49 +1232,50 @@ type Options$1 = {
|
|
|
1228
1232
|
*/
|
|
1229
1233
|
baseURL?: string;
|
|
1230
1234
|
/**
|
|
1231
|
-
* ReturnType that
|
|
1232
|
-
* - 'data'
|
|
1233
|
-
* - 'full'
|
|
1235
|
+
* ReturnType that is used when calling the client.
|
|
1236
|
+
* - 'data' returns ResponseConfig[data].
|
|
1237
|
+
* - 'full' returns ResponseConfig.
|
|
1234
1238
|
* @default 'data'
|
|
1235
1239
|
*/
|
|
1236
1240
|
dataReturnType?: 'data' | 'full';
|
|
1237
1241
|
/**
|
|
1238
1242
|
* How to style your params, by default no casing is applied
|
|
1239
|
-
* - 'camelcase'
|
|
1243
|
+
* - 'camelcase' uses camelcase for the params names
|
|
1240
1244
|
*/
|
|
1241
1245
|
paramsCasing?: 'camelcase';
|
|
1242
1246
|
/**
|
|
1243
|
-
* How to pass your params
|
|
1244
|
-
* - 'object'
|
|
1245
|
-
* - 'inline'
|
|
1247
|
+
* How to pass your params.
|
|
1248
|
+
* - 'object' returns the params and pathParams as an object.
|
|
1249
|
+
* - 'inline' returns the params as comma separated params.
|
|
1246
1250
|
* @default 'inline'
|
|
1247
1251
|
*/
|
|
1248
1252
|
paramsType?: 'object' | 'inline';
|
|
1249
1253
|
/**
|
|
1250
1254
|
* How to pass your pathParams.
|
|
1251
|
-
* - 'object'
|
|
1252
|
-
* - 'inline'
|
|
1255
|
+
* - 'object' returns the pathParams as an object.
|
|
1256
|
+
* - 'inline' returns the pathParams as comma separated params.
|
|
1253
1257
|
* @default 'inline'
|
|
1254
1258
|
*/
|
|
1255
1259
|
pathParamsType?: 'object' | 'inline';
|
|
1256
1260
|
/**
|
|
1257
|
-
* Which parser can be used before returning the data
|
|
1258
|
-
* - '
|
|
1261
|
+
* Which parser can be used before returning the data.
|
|
1262
|
+
* - 'client' returns the data as-is from the client.
|
|
1263
|
+
* - 'zod' uses @kubb/plugin-zod to parse the data.
|
|
1259
1264
|
* @default 'client'
|
|
1260
1265
|
*/
|
|
1261
1266
|
parser?: 'client' | 'zod';
|
|
1262
1267
|
/**
|
|
1263
|
-
* Which client should be used to do the HTTP calls
|
|
1264
|
-
* - 'axios'
|
|
1265
|
-
* - 'fetch'
|
|
1268
|
+
* Which client should be used to do the HTTP calls.
|
|
1269
|
+
* - 'axios' uses axios client for HTTP requests.
|
|
1270
|
+
* - 'fetch' uses native fetch API for HTTP requests.
|
|
1266
1271
|
* @default 'axios'
|
|
1267
1272
|
*/
|
|
1268
1273
|
client?: 'axios' | 'fetch';
|
|
1269
1274
|
/**
|
|
1270
|
-
* How to generate the client code
|
|
1271
|
-
* - 'function'
|
|
1272
|
-
* - 'class'
|
|
1273
|
-
* - 'staticClass'
|
|
1275
|
+
* How to generate the client code.
|
|
1276
|
+
* - 'function' generates standalone functions for each operation.
|
|
1277
|
+
* - 'class' generates a class with methods for each operation.
|
|
1278
|
+
* - 'staticClass' generates a class with static methods for each operation.
|
|
1274
1279
|
* @default 'function'
|
|
1275
1280
|
*/
|
|
1276
1281
|
clientType?: 'function' | 'class' | 'staticClass';
|
|
@@ -1278,7 +1283,7 @@ type Options$1 = {
|
|
|
1278
1283
|
* Bundle the selected client into the generated `.kubb` directory.
|
|
1279
1284
|
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
|
|
1280
1285
|
* @default false
|
|
1281
|
-
* In version 5 of Kubb this
|
|
1286
|
+
* In version 5 of Kubb this is by default true
|
|
1282
1287
|
*/
|
|
1283
1288
|
bundle?: boolean;
|
|
1284
1289
|
transformers?: {
|
|
@@ -1332,10 +1337,10 @@ type Query = {
|
|
|
1332
1337
|
*/
|
|
1333
1338
|
methods: Array<HttpMethod>;
|
|
1334
1339
|
/**
|
|
1335
|
-
* Path to the useQuery
|
|
1336
|
-
*
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1340
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
1341
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
1342
|
+
* Accepts relative and absolute paths.
|
|
1343
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
1339
1344
|
* @default '@tanstack/react-query'
|
|
1340
1345
|
*/
|
|
1341
1346
|
importPath?: string;
|
|
@@ -1347,10 +1352,10 @@ type Mutation = {
|
|
|
1347
1352
|
*/
|
|
1348
1353
|
methods: Array<HttpMethod>;
|
|
1349
1354
|
/**
|
|
1350
|
-
* Path to the useQuery
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1353
|
-
*
|
|
1355
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
1356
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
1357
|
+
* Accepts relative and absolute paths.
|
|
1358
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
1354
1359
|
* @default '@tanstack/react-query'
|
|
1355
1360
|
*/
|
|
1356
1361
|
importPath?: string;
|
|
@@ -1362,17 +1367,17 @@ type Infinite = {
|
|
|
1362
1367
|
*/
|
|
1363
1368
|
queryParam: string;
|
|
1364
1369
|
/**
|
|
1365
|
-
* Which field of the data
|
|
1370
|
+
* Which field of the data is used, set it to undefined when no cursor is known.
|
|
1366
1371
|
* @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
|
|
1367
1372
|
*/
|
|
1368
1373
|
cursorParam?: string | undefined;
|
|
1369
1374
|
/**
|
|
1370
|
-
* Which field of the data
|
|
1375
|
+
* Which field of the data is used to get the cursor for the next page.
|
|
1371
1376
|
* Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
|
|
1372
1377
|
*/
|
|
1373
1378
|
nextParam?: string | string[] | undefined;
|
|
1374
1379
|
/**
|
|
1375
|
-
* Which field of the data
|
|
1380
|
+
* Which field of the data is used to get the cursor for the previous page.
|
|
1376
1381
|
* Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
|
|
1377
1382
|
*/
|
|
1378
1383
|
previousParam?: string | string[] | undefined;
|
|
@@ -1384,14 +1389,14 @@ type Infinite = {
|
|
|
1384
1389
|
};
|
|
1385
1390
|
type CustomOptions = {
|
|
1386
1391
|
/**
|
|
1387
|
-
* Path to the hook that
|
|
1388
|
-
* It
|
|
1392
|
+
* Path to the hook that is used to customize the hook options.
|
|
1393
|
+
* It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
|
|
1389
1394
|
* It allows both relative and absolute paths but be aware that we will not change the path.
|
|
1390
1395
|
*/
|
|
1391
1396
|
importPath: string;
|
|
1392
1397
|
/**
|
|
1393
|
-
* Name of the exported hook that
|
|
1394
|
-
* It
|
|
1398
|
+
* Name of the exported hook that is used to customize the hook options.
|
|
1399
|
+
* It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
|
|
1395
1400
|
* @default 'useCustomHookOptions'
|
|
1396
1401
|
*/
|
|
1397
1402
|
name?: string;
|
|
@@ -1404,7 +1409,7 @@ type Options = {
|
|
|
1404
1409
|
output?: Output<Oas>;
|
|
1405
1410
|
/**
|
|
1406
1411
|
* Define which contentType should be used.
|
|
1407
|
-
* By default, the first JSON valid mediaType
|
|
1412
|
+
* By default, the first JSON valid mediaType is used
|
|
1408
1413
|
*/
|
|
1409
1414
|
contentType?: contentType;
|
|
1410
1415
|
/**
|
|
@@ -1426,49 +1431,49 @@ type Options = {
|
|
|
1426
1431
|
override?: Array<Override<ResolvedOptions>>;
|
|
1427
1432
|
/**
|
|
1428
1433
|
* How to style your params, by default no casing is applied
|
|
1429
|
-
* - 'camelcase'
|
|
1434
|
+
* - 'camelcase' uses camelcase for the params names
|
|
1430
1435
|
*/
|
|
1431
1436
|
paramsCasing?: 'camelcase';
|
|
1432
1437
|
/**
|
|
1433
|
-
* How to pass your params
|
|
1434
|
-
* - 'object'
|
|
1435
|
-
* - 'inline'
|
|
1438
|
+
* How to pass your params.
|
|
1439
|
+
* - 'object' returns the params and pathParams as an object.
|
|
1440
|
+
* - 'inline' returns the params as comma separated params.
|
|
1436
1441
|
* @default 'inline'
|
|
1437
1442
|
*/
|
|
1438
1443
|
paramsType?: 'object' | 'inline';
|
|
1439
1444
|
/**
|
|
1440
1445
|
* How to pass your pathParams.
|
|
1441
|
-
* - 'object'
|
|
1442
|
-
* - 'inline'
|
|
1446
|
+
* - 'object' returns the pathParams as an object.
|
|
1447
|
+
* - 'inline': returns the pathParams as comma separated params.
|
|
1443
1448
|
* @default 'inline'
|
|
1444
1449
|
*/
|
|
1445
1450
|
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
1446
1451
|
/**
|
|
1447
|
-
* When set, an infiniteQuery hooks
|
|
1452
|
+
* When set, an infiniteQuery hooks is added.
|
|
1448
1453
|
*/
|
|
1449
1454
|
infinite?: Partial<Infinite> | false;
|
|
1450
1455
|
/**
|
|
1451
|
-
* When set, a suspenseQuery hooks
|
|
1456
|
+
* When set, a suspenseQuery hooks is added.
|
|
1452
1457
|
*/
|
|
1453
1458
|
suspense?: Partial<Suspense> | false;
|
|
1454
1459
|
queryKey?: QueryKey;
|
|
1455
1460
|
/**
|
|
1456
|
-
* Override some useQuery
|
|
1461
|
+
* Override some useQuery behaviors.
|
|
1457
1462
|
*/
|
|
1458
1463
|
query?: Partial<Query> | false;
|
|
1459
1464
|
mutationKey?: MutationKey;
|
|
1460
1465
|
/**
|
|
1461
|
-
* Override some useMutation
|
|
1466
|
+
* Override some useMutation behaviors.
|
|
1462
1467
|
*/
|
|
1463
1468
|
mutation?: Partial<Mutation> | false;
|
|
1464
1469
|
/**
|
|
1465
|
-
* When set, a custom hook
|
|
1470
|
+
* When set, a custom hook is used to customize the options of the generated hooks.
|
|
1466
1471
|
* It will also generate a `HookOptions` type that can be used to type the custom options of each hook for type-safety.
|
|
1467
1472
|
*/
|
|
1468
1473
|
customOptions?: CustomOptions;
|
|
1469
1474
|
/**
|
|
1470
1475
|
* Which parser should be used before returning the data to `@tanstack/query`.
|
|
1471
|
-
* `'zod'`
|
|
1476
|
+
* `'zod'` uses `@kubb/plugin-zod` to parse the data.
|
|
1472
1477
|
*/
|
|
1473
1478
|
parser?: PluginClient['options']['parser'];
|
|
1474
1479
|
transformers?: {
|
|
@@ -1504,4 +1509,4 @@ type ResolvedOptions = {
|
|
|
1504
1509
|
type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
1505
1510
|
//#endregion
|
|
1506
1511
|
export { ReactGenerator as a, Operation$1 as c, Transformer as i, Options as n, OperationSchemas as o, PluginReactQuery as r, UserPluginWithLifeCycle as s, Infinite as t };
|
|
1507
|
-
//# sourceMappingURL=types-
|
|
1512
|
+
//# sourceMappingURL=types-O2rCspo7.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-react-query",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.5",
|
|
4
4
|
"description": "React Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for React applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-query",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@kubb/react-fabric": "0.12.4",
|
|
71
71
|
"remeda": "^2.33.4",
|
|
72
|
-
"@kubb/core": "4.18.
|
|
73
|
-
"@kubb/oas": "4.18.
|
|
74
|
-
"@kubb/plugin-client": "4.18.
|
|
75
|
-
"@kubb/plugin-oas": "4.18.
|
|
76
|
-
"@kubb/plugin-ts": "4.18.
|
|
77
|
-
"@kubb/plugin-zod": "4.18.
|
|
72
|
+
"@kubb/core": "4.18.5",
|
|
73
|
+
"@kubb/oas": "4.18.5",
|
|
74
|
+
"@kubb/plugin-client": "4.18.5",
|
|
75
|
+
"@kubb/plugin-oas": "4.18.5",
|
|
76
|
+
"@kubb/plugin-ts": "4.18.5",
|
|
77
|
+
"@kubb/plugin-zod": "4.18.5"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@kubb/react-fabric": "0.12.4"
|
package/src/types.ts
CHANGED
|
@@ -32,10 +32,10 @@ type Query = {
|
|
|
32
32
|
*/
|
|
33
33
|
methods: Array<HttpMethod>
|
|
34
34
|
/**
|
|
35
|
-
* Path to the useQuery
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
36
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
37
|
+
* Accepts relative and absolute paths.
|
|
38
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
39
39
|
* @default '@tanstack/react-query'
|
|
40
40
|
*/
|
|
41
41
|
importPath?: string
|
|
@@ -48,10 +48,10 @@ type Mutation = {
|
|
|
48
48
|
*/
|
|
49
49
|
methods: Array<HttpMethod>
|
|
50
50
|
/**
|
|
51
|
-
* Path to the useQuery
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* Path to the useQuery hook for useQuery functionality.
|
|
52
|
+
* Used as `import { useQuery } from '${importPath}'`.
|
|
53
|
+
* Accepts relative and absolute paths.
|
|
54
|
+
* Path is used as-is; relative paths are based on the generated file location.
|
|
55
55
|
* @default '@tanstack/react-query'
|
|
56
56
|
*/
|
|
57
57
|
importPath?: string
|
|
@@ -64,17 +64,17 @@ export type Infinite = {
|
|
|
64
64
|
*/
|
|
65
65
|
queryParam: string
|
|
66
66
|
/**
|
|
67
|
-
* Which field of the data
|
|
67
|
+
* Which field of the data is used, set it to undefined when no cursor is known.
|
|
68
68
|
* @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
|
|
69
69
|
*/
|
|
70
70
|
cursorParam?: string | undefined
|
|
71
71
|
/**
|
|
72
|
-
* Which field of the data
|
|
72
|
+
* Which field of the data is used to get the cursor for the next page.
|
|
73
73
|
* Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
|
|
74
74
|
*/
|
|
75
75
|
nextParam?: string | string[] | undefined
|
|
76
76
|
/**
|
|
77
|
-
* Which field of the data
|
|
77
|
+
* Which field of the data is used to get the cursor for the previous page.
|
|
78
78
|
* Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
|
|
79
79
|
*/
|
|
80
80
|
previousParam?: string | string[] | undefined
|
|
@@ -87,14 +87,14 @@ export type Infinite = {
|
|
|
87
87
|
|
|
88
88
|
type CustomOptions = {
|
|
89
89
|
/**
|
|
90
|
-
* Path to the hook that
|
|
91
|
-
* It
|
|
90
|
+
* Path to the hook that is used to customize the hook options.
|
|
91
|
+
* It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
|
|
92
92
|
* It allows both relative and absolute paths but be aware that we will not change the path.
|
|
93
93
|
*/
|
|
94
94
|
importPath: string
|
|
95
95
|
/**
|
|
96
|
-
* Name of the exported hook that
|
|
97
|
-
* It
|
|
96
|
+
* Name of the exported hook that is used to customize the hook options.
|
|
97
|
+
* It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
|
|
98
98
|
* @default 'useCustomHookOptions'
|
|
99
99
|
*/
|
|
100
100
|
name?: string
|
|
@@ -108,7 +108,7 @@ export type Options = {
|
|
|
108
108
|
output?: Output<Oas>
|
|
109
109
|
/**
|
|
110
110
|
* Define which contentType should be used.
|
|
111
|
-
* By default, the first JSON valid mediaType
|
|
111
|
+
* By default, the first JSON valid mediaType is used
|
|
112
112
|
*/
|
|
113
113
|
contentType?: contentType
|
|
114
114
|
/**
|
|
@@ -130,50 +130,50 @@ export type Options = {
|
|
|
130
130
|
override?: Array<Override<ResolvedOptions>>
|
|
131
131
|
/**
|
|
132
132
|
* How to style your params, by default no casing is applied
|
|
133
|
-
* - 'camelcase'
|
|
133
|
+
* - 'camelcase' uses camelcase for the params names
|
|
134
134
|
*/
|
|
135
135
|
paramsCasing?: 'camelcase'
|
|
136
136
|
/**
|
|
137
|
-
* How to pass your params
|
|
138
|
-
* - 'object'
|
|
139
|
-
* - 'inline'
|
|
137
|
+
* How to pass your params.
|
|
138
|
+
* - 'object' returns the params and pathParams as an object.
|
|
139
|
+
* - 'inline' returns the params as comma separated params.
|
|
140
140
|
* @default 'inline'
|
|
141
141
|
*/
|
|
142
142
|
paramsType?: 'object' | 'inline'
|
|
143
143
|
/**
|
|
144
144
|
* How to pass your pathParams.
|
|
145
|
-
* - 'object'
|
|
146
|
-
* - 'inline'
|
|
145
|
+
* - 'object' returns the pathParams as an object.
|
|
146
|
+
* - 'inline': returns the pathParams as comma separated params.
|
|
147
147
|
* @default 'inline'
|
|
148
148
|
*/
|
|
149
149
|
pathParamsType?: PluginClient['options']['pathParamsType']
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
|
-
* When set, an infiniteQuery hooks
|
|
152
|
+
* When set, an infiniteQuery hooks is added.
|
|
153
153
|
*/
|
|
154
154
|
infinite?: Partial<Infinite> | false
|
|
155
155
|
/**
|
|
156
|
-
* When set, a suspenseQuery hooks
|
|
156
|
+
* When set, a suspenseQuery hooks is added.
|
|
157
157
|
*/
|
|
158
158
|
suspense?: Partial<Suspense> | false
|
|
159
159
|
queryKey?: QueryKey
|
|
160
160
|
/**
|
|
161
|
-
* Override some useQuery
|
|
161
|
+
* Override some useQuery behaviors.
|
|
162
162
|
*/
|
|
163
163
|
query?: Partial<Query> | false
|
|
164
164
|
mutationKey?: MutationKey
|
|
165
165
|
/**
|
|
166
|
-
* Override some useMutation
|
|
166
|
+
* Override some useMutation behaviors.
|
|
167
167
|
*/
|
|
168
168
|
mutation?: Partial<Mutation> | false
|
|
169
169
|
/**
|
|
170
|
-
* When set, a custom hook
|
|
170
|
+
* When set, a custom hook is used to customize the options of the generated hooks.
|
|
171
171
|
* It will also generate a `HookOptions` type that can be used to type the custom options of each hook for type-safety.
|
|
172
172
|
*/
|
|
173
173
|
customOptions?: CustomOptions
|
|
174
174
|
/**
|
|
175
175
|
* Which parser should be used before returning the data to `@tanstack/query`.
|
|
176
|
-
* `'zod'`
|
|
176
|
+
* `'zod'` uses `@kubb/plugin-zod` to parse the data.
|
|
177
177
|
*/
|
|
178
178
|
parser?: PluginClient['options']['parser']
|
|
179
179
|
transformers?: {
|