@kubb/plugin-react-query 4.21.2 → 4.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/components.d.cts +3 -1
  2. package/dist/components.d.ts +3 -1
  3. package/dist/{generators-DLX0cp80.js → generators-DTkvanZK.js} +51 -11
  4. package/dist/generators-DTkvanZK.js.map +1 -0
  5. package/dist/{generators-BNYyHlZa.cjs → generators-DtDEbt56.cjs} +51 -11
  6. package/dist/generators-DtDEbt56.cjs.map +1 -0
  7. package/dist/generators.cjs +1 -1
  8. package/dist/generators.d.cts +457 -1
  9. package/dist/generators.d.ts +457 -1
  10. package/dist/generators.js +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.d.cts +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/types-CgOcKVIt.d.cts +204 -0
  16. package/dist/types-DoN-nl4J.d.ts +203 -0
  17. package/package.json +8 -8
  18. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +2 -2
  19. package/src/generators/__snapshots__/clientGetImportPath.ts +2 -2
  20. package/src/generators/__snapshots__/clientPostImportPath.ts +2 -2
  21. package/src/generators/__snapshots__/createUsersWithListInput.ts +2 -2
  22. package/src/generators/__snapshots__/createUsersWithListInputAsQuery.ts +2 -2
  23. package/src/generators/__snapshots__/findByStatusAllOptional.ts +2 -5
  24. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +2 -2
  25. package/src/generators/__snapshots__/findByTags.ts +2 -2
  26. package/src/generators/__snapshots__/findByTagsObject.ts +2 -2
  27. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +2 -2
  28. package/src/generators/__snapshots__/findByTagsTemplateString.ts +2 -2
  29. package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +2 -2
  30. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +2 -2
  31. package/src/generators/__snapshots__/findByTagsWithZod.ts +2 -2
  32. package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +2 -2
  33. package/src/generators/__snapshots__/findInfiniteByTags.ts +2 -2
  34. package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +2 -2
  35. package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +2 -2
  36. package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +2 -2
  37. package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +2 -2
  38. package/src/generators/__snapshots__/findSuspenseByTags.ts +2 -2
  39. package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +2 -2
  40. package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +2 -2
  41. package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +2 -2
  42. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +2 -2
  43. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +2 -2
  44. package/src/generators/__snapshots__/getPetIdCamelCase.ts +2 -2
  45. package/src/generators/__snapshots__/postAsQuery.ts +2 -2
  46. package/src/generators/__snapshots__/updatePetById.ts +2 -2
  47. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +2 -2
  48. package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +2 -2
  49. package/src/generators/infiniteQueryGenerator.tsx +2 -2
  50. package/src/generators/mutationGenerator.tsx +2 -2
  51. package/src/generators/queryGenerator.tsx +2 -2
  52. package/src/generators/suspenseInfiniteQueryGenerator.tsx +2 -2
  53. package/src/generators/suspenseQueryGenerator.tsx +2 -2
  54. package/dist/generators-BNYyHlZa.cjs.map +0 -1
  55. package/dist/generators-DLX0cp80.js.map +0 -1
  56. package/dist/types-CdpInNzi.d.ts +0 -877
  57. package/dist/types-Fb-3R-ua.d.cts +0 -878
@@ -1,878 +0,0 @@
1
- import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
2
- import BaseOas from "oas";
3
- import { Operation } from "oas/operation";
4
- import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
5
- import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
6
- import { KubbFile } from "@kubb/fabric-core/types";
7
- import { Fabric } from "@kubb/react-fabric";
8
- import { FabricReactNode } from "@kubb/react-fabric/types";
9
-
10
- //#region rolldown:runtime
11
- //#endregion
12
- //#region ../oas/src/types.d.ts
13
- type contentType = 'application/json' | (string & {});
14
- type SchemaObject$1 = SchemaObject & {
15
- 'x-nullable'?: boolean;
16
- $ref?: string;
17
- };
18
- type HttpMethod = HttpMethods;
19
- type Document = OASDocument;
20
- type Operation$1 = Operation;
21
- type DiscriminatorObject$1 = DiscriminatorObject;
22
- //#endregion
23
- //#region ../oas/src/Oas.d.ts
24
- type OasOptions = {
25
- contentType?: contentType;
26
- discriminator?: 'strict' | 'inherit';
27
- /**
28
- * Resolve name collisions when schemas from different components share the same name (case-insensitive).
29
- * @default false
30
- */
31
- collisionDetection?: boolean;
32
- };
33
- declare class Oas extends BaseOas {
34
- #private;
35
- document: Document;
36
- constructor(document: Document);
37
- setOptions(options: OasOptions): void;
38
- get options(): OasOptions;
39
- get<T = unknown>($ref: string): T | null;
40
- getKey($ref: string): string | undefined;
41
- set($ref: string, value: unknown): false | undefined;
42
- getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
43
- dereferenceWithRef<T = unknown>(schema?: T): T;
44
- getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
45
- getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
46
- getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
47
- validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
48
- flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
49
- /**
50
- * Get schemas from OpenAPI components (schemas, responses, requestBodies).
51
- * Returns schemas in dependency order along with name mapping for collision resolution.
52
- */
53
- getSchemas(options?: {
54
- contentType?: contentType;
55
- includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
56
- collisionDetection?: boolean;
57
- }): {
58
- schemas: Record<string, SchemaObject$1>;
59
- nameMapping: Map<string, string>;
60
- };
61
- }
62
- //#endregion
63
- //#region ../core/src/utils/AsyncEventEmitter.d.ts
64
- declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
65
- #private;
66
- constructor(maxListener?: number);
67
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
68
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
69
- onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
70
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
71
- removeAll(): void;
72
- }
73
- //#endregion
74
- //#region ../core/src/types.d.ts
75
- declare global {
76
- namespace Kubb {
77
- interface PluginContext {}
78
- }
79
- }
80
- /**
81
- * Config used in `kubb.config.ts`
82
- *
83
- * @example
84
- * import { defineConfig } from '@kubb/core'
85
- * export default defineConfig({
86
- * ...
87
- * })
88
- */
89
- //#endregion
90
- //#region ../plugin-oas/src/types.d.ts
91
- type GetOasOptions = {
92
- validate?: boolean;
93
- };
94
- type Context$2 = {
95
- getOas(options?: GetOasOptions): Promise<Oas>;
96
- getBaseURL(): Promise<string | undefined>;
97
- };
98
- declare global {
99
- namespace Kubb {
100
- interface PluginContext extends Context$2 {}
101
- }
102
- }
103
- type ResolvePathOptions = {
104
- pluginKey?: Plugin['key'];
105
- group?: {
106
- tag?: string;
107
- path?: string;
108
- };
109
- type?: ResolveNameParams['type'];
110
- };
111
- /**
112
- * `propertyName` is the ref name + resolved with the nameResolver
113
- * @example import { Pet } from './Pet'
114
- *
115
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
116
- *
117
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
118
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
119
- */
120
- type Ref = {
121
- propertyName: string;
122
- originalName: string;
123
- path: KubbFile.Path;
124
- pluginKey?: Plugin['key'];
125
- };
126
- type Refs = Record<string, Ref>;
127
- type OperationSchema = {
128
- /**
129
- * Converted name, contains already `PathParams`, `QueryParams`, ...
130
- */
131
- name: string;
132
- schema: SchemaObject$1;
133
- operation?: Operation$1;
134
- /**
135
- * OperationName in PascalCase, only being used in OperationGenerator
136
- */
137
- operationName: string;
138
- description?: string;
139
- statusCode?: number;
140
- keys?: string[];
141
- keysToOmit?: string[];
142
- withData?: boolean;
143
- };
144
- type OperationSchemas = {
145
- pathParams?: OperationSchema & {
146
- keysToOmit?: never;
147
- };
148
- queryParams?: OperationSchema & {
149
- keysToOmit?: never;
150
- };
151
- headerParams?: OperationSchema & {
152
- keysToOmit?: never;
153
- };
154
- request?: OperationSchema;
155
- response: OperationSchema;
156
- responses: Array<OperationSchema>;
157
- statusCodes?: Array<OperationSchema>;
158
- errors?: Array<OperationSchema>;
159
- };
160
- type ByTag = {
161
- type: 'tag';
162
- pattern: string | RegExp;
163
- };
164
- type ByOperationId = {
165
- type: 'operationId';
166
- pattern: string | RegExp;
167
- };
168
- type ByPath = {
169
- type: 'path';
170
- pattern: string | RegExp;
171
- };
172
- type ByMethod = {
173
- type: 'method';
174
- pattern: HttpMethod | RegExp;
175
- };
176
- type BySchemaName = {
177
- type: 'schemaName';
178
- pattern: string | RegExp;
179
- };
180
- type ByContentType = {
181
- type: 'contentType';
182
- pattern: string | RegExp;
183
- };
184
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
185
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
186
- type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
187
- options: Partial<TOptions>;
188
- };
189
- //#endregion
190
- //#region ../plugin-oas/src/OperationGenerator.d.ts
191
- type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
192
- fabric: Fabric;
193
- oas: Oas;
194
- exclude: Array<Exclude$1> | undefined;
195
- include: Array<Include> | undefined;
196
- override: Array<Override<TOptions>> | undefined;
197
- contentType: contentType | undefined;
198
- pluginManager: PluginManager;
199
- events?: AsyncEventEmitter<KubbEvents>;
200
- /**
201
- * Current plugin
202
- */
203
- plugin: Plugin<TPluginOptions>;
204
- mode: KubbFile.Mode;
205
- UNSTABLE_NAMING?: true;
206
- };
207
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
208
- #private;
209
- getOptions(operation: Operation$1, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
210
- getSchemas(operation: Operation$1, {
211
- resolveName
212
- }?: {
213
- resolveName?: (name: string) => string;
214
- }): OperationSchemas;
215
- getOperations(): Promise<Array<{
216
- path: string;
217
- method: HttpMethod;
218
- operation: Operation$1;
219
- }>>;
220
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
221
- }
222
- //#endregion
223
- //#region ../plugin-oas/src/SchemaMapper.d.ts
224
- type SchemaKeywordMapper = {
225
- object: {
226
- keyword: 'object';
227
- args: {
228
- properties: {
229
- [x: string]: Schema[];
230
- };
231
- additionalProperties: Schema[];
232
- patternProperties?: Record<string, Schema[]>;
233
- strict?: boolean;
234
- };
235
- };
236
- url: {
237
- keyword: 'url';
238
- };
239
- readOnly: {
240
- keyword: 'readOnly';
241
- };
242
- writeOnly: {
243
- keyword: 'writeOnly';
244
- };
245
- uuid: {
246
- keyword: 'uuid';
247
- };
248
- email: {
249
- keyword: 'email';
250
- };
251
- firstName: {
252
- keyword: 'firstName';
253
- };
254
- lastName: {
255
- keyword: 'lastName';
256
- };
257
- phone: {
258
- keyword: 'phone';
259
- };
260
- password: {
261
- keyword: 'password';
262
- };
263
- date: {
264
- keyword: 'date';
265
- args: {
266
- type?: 'date' | 'string';
267
- };
268
- };
269
- time: {
270
- keyword: 'time';
271
- args: {
272
- type?: 'date' | 'string';
273
- };
274
- };
275
- datetime: {
276
- keyword: 'datetime';
277
- args: {
278
- offset?: boolean;
279
- local?: boolean;
280
- };
281
- };
282
- tuple: {
283
- keyword: 'tuple';
284
- args: {
285
- items: Schema[];
286
- min?: number;
287
- max?: number;
288
- rest?: Schema;
289
- };
290
- };
291
- array: {
292
- keyword: 'array';
293
- args: {
294
- items: Schema[];
295
- min?: number;
296
- max?: number;
297
- unique?: boolean;
298
- };
299
- };
300
- enum: {
301
- keyword: 'enum';
302
- args: {
303
- name: string;
304
- typeName: string;
305
- asConst: boolean;
306
- items: Array<{
307
- name: string | number;
308
- format: 'string' | 'number' | 'boolean';
309
- value?: string | number | boolean;
310
- }>;
311
- };
312
- };
313
- and: {
314
- keyword: 'and';
315
- args: Schema[];
316
- };
317
- const: {
318
- keyword: 'const';
319
- args: {
320
- name: string | number;
321
- format: 'string' | 'number' | 'boolean';
322
- value?: string | number | boolean;
323
- };
324
- };
325
- union: {
326
- keyword: 'union';
327
- args: Schema[];
328
- };
329
- ref: {
330
- keyword: 'ref';
331
- args: {
332
- name: string;
333
- $ref: string;
334
- /**
335
- * Full qualified path.
336
- */
337
- path: KubbFile.Path;
338
- /**
339
- * When true `File.Import` is used.
340
- * When false a reference is used inside the current file.
341
- */
342
- isImportable: boolean;
343
- };
344
- };
345
- matches: {
346
- keyword: 'matches';
347
- args?: string;
348
- };
349
- boolean: {
350
- keyword: 'boolean';
351
- };
352
- default: {
353
- keyword: 'default';
354
- args: string | number | boolean;
355
- };
356
- string: {
357
- keyword: 'string';
358
- };
359
- integer: {
360
- keyword: 'integer';
361
- };
362
- number: {
363
- keyword: 'number';
364
- };
365
- max: {
366
- keyword: 'max';
367
- args: number;
368
- };
369
- min: {
370
- keyword: 'min';
371
- args: number;
372
- };
373
- exclusiveMaximum: {
374
- keyword: 'exclusiveMaximum';
375
- args: number;
376
- };
377
- exclusiveMinimum: {
378
- keyword: 'exclusiveMinimum';
379
- args: number;
380
- };
381
- describe: {
382
- keyword: 'describe';
383
- args: string;
384
- };
385
- example: {
386
- keyword: 'example';
387
- args: string;
388
- };
389
- deprecated: {
390
- keyword: 'deprecated';
391
- };
392
- optional: {
393
- keyword: 'optional';
394
- };
395
- undefined: {
396
- keyword: 'undefined';
397
- };
398
- nullish: {
399
- keyword: 'nullish';
400
- };
401
- nullable: {
402
- keyword: 'nullable';
403
- };
404
- null: {
405
- keyword: 'null';
406
- };
407
- any: {
408
- keyword: 'any';
409
- };
410
- unknown: {
411
- keyword: 'unknown';
412
- };
413
- void: {
414
- keyword: 'void';
415
- };
416
- blob: {
417
- keyword: 'blob';
418
- };
419
- schema: {
420
- keyword: 'schema';
421
- args: {
422
- type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
423
- format?: string;
424
- };
425
- };
426
- name: {
427
- keyword: 'name';
428
- args: string;
429
- };
430
- catchall: {
431
- keyword: 'catchall';
432
- };
433
- interface: {
434
- keyword: 'interface';
435
- };
436
- };
437
- type Schema = {
438
- keyword: string;
439
- } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
440
- //#endregion
441
- //#region ../plugin-oas/src/SchemaGenerator.d.ts
442
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
443
- fabric: Fabric;
444
- oas: Oas;
445
- pluginManager: PluginManager;
446
- events?: AsyncEventEmitter<KubbEvents>;
447
- /**
448
- * Current plugin
449
- */
450
- plugin: Plugin<TPluginOptions>;
451
- mode: KubbFile.Mode;
452
- include?: Array<'schemas' | 'responses' | 'requestBodies'>;
453
- override: Array<Override<TOptions>> | undefined;
454
- contentType?: contentType;
455
- output?: string;
456
- };
457
- type SchemaGeneratorOptions = {
458
- dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
459
- unknownType: 'any' | 'unknown' | 'void';
460
- emptySchemaType: 'any' | 'unknown' | 'void';
461
- enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
462
- enumSuffix?: string;
463
- /**
464
- * @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
465
- * When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
466
- * @internal
467
- */
468
- usedEnumNames?: Record<string, number>;
469
- mapper?: Record<string, string>;
470
- typed?: boolean;
471
- transformers: {
472
- /**
473
- * Customize the names based on the type that is provided by the plugin.
474
- */
475
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
476
- /**
477
- * Receive schema and name(propertyName) and return FakerMeta array
478
- * TODO TODO add docs
479
- * @beta
480
- */
481
- schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
482
- };
483
- };
484
- type SchemaProps$1 = {
485
- schema: SchemaObject$1 | null;
486
- name: string | null;
487
- parentName: string | null;
488
- rootName?: string | null;
489
- };
490
- declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
491
- #private;
492
- refs: Refs;
493
- /**
494
- * Creates a type node from a given schema.
495
- * Delegates to getBaseTypeFromSchema internally and
496
- * optionally adds a union with null.
497
- */
498
- parse(props: SchemaProps$1): Schema[];
499
- static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
500
- static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
501
- static combineObjects(tree: Schema[] | undefined): Schema[];
502
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
503
- }
504
- //#endregion
505
- //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
506
- type ReactGenerator<TOptions extends PluginFactoryOptions> = {
507
- name: string;
508
- type: 'react';
509
- Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
510
- Operation: (props: OperationProps<TOptions>) => FabricReactNode;
511
- Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
512
- };
513
- //#endregion
514
- //#region ../plugin-oas/src/generators/types.d.ts
515
- type OperationsProps<TOptions extends PluginFactoryOptions> = {
516
- config: Config;
517
- generator: Omit<OperationGenerator<TOptions>, 'build'>;
518
- plugin: Plugin<TOptions>;
519
- operations: Array<Operation$1>;
520
- };
521
- type OperationProps<TOptions extends PluginFactoryOptions> = {
522
- config: Config;
523
- generator: Omit<OperationGenerator<TOptions>, 'build'>;
524
- plugin: Plugin<TOptions>;
525
- operation: Operation$1;
526
- };
527
- type SchemaProps<TOptions extends PluginFactoryOptions> = {
528
- config: Config;
529
- generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
530
- plugin: Plugin<TOptions>;
531
- schema: {
532
- name: string;
533
- tree: Array<Schema>;
534
- value: SchemaObject$1;
535
- };
536
- };
537
- type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
538
- //#endregion
539
- //#region ../plugin-oas/src/generators/createGenerator.d.ts
540
- type CoreGenerator<TOptions extends PluginFactoryOptions> = {
541
- name: string;
542
- type: 'core';
543
- operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
544
- operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
545
- schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
546
- };
547
- //#endregion
548
- //#region ../plugin-client/src/types.d.ts
549
- type Options$1 = {
550
- /**
551
- * Specify the export location for the files and define the behavior of the output
552
- * @default { path: 'clients', barrelType: 'named' }
553
- */
554
- output?: Output<Oas>;
555
- /**
556
- * Define which contentType should be used.
557
- * By default, the first JSON valid mediaType is used
558
- */
559
- contentType?: contentType;
560
- /**
561
- * Group the clients based on the provided name.
562
- */
563
- group?: Group;
564
- /**
565
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
566
- */
567
- exclude?: Array<Exclude$1>;
568
- /**
569
- * Array containing include parameters to include tags/operations/methods/paths.
570
- */
571
- include?: Array<Include>;
572
- /**
573
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
574
- */
575
- override?: Array<Override<ResolvedOptions$1>>;
576
- /**
577
- * Create `operations.ts` file with all operations grouped by methods.
578
- * @default false
579
- */
580
- operations?: boolean;
581
- /**
582
- * Export urls that are used by operation x.
583
- * - 'export' makes them part of your barrel file.
584
- * - false does not make them exportable.
585
- * @default false
586
- * @example getGetPetByIdUrl
587
- */
588
- urlType?: 'export' | false;
589
- /**
590
- * Client import path for API calls.
591
- * Used as `import client from '${client.importPath}'`.
592
- * Accepts relative and absolute paths; path changes are not performed.
593
- */
594
- importPath?: string;
595
- /**
596
- * Allows you to set a custom base url for all generated calls.
597
- */
598
- baseURL?: string;
599
- /**
600
- * ReturnType that is used when calling the client.
601
- * - 'data' returns ResponseConfig[data].
602
- * - 'full' returns ResponseConfig.
603
- * @default 'data'
604
- */
605
- dataReturnType?: 'data' | 'full';
606
- /**
607
- * How to style your params, by default no casing is applied
608
- * - 'camelcase' uses camelCase for pathParams, queryParams and headerParams names
609
- * @note response types (data/body) are not affected by this option
610
- */
611
- paramsCasing?: 'camelcase';
612
- /**
613
- * How to pass your params.
614
- * - 'object' returns the params and pathParams as an object.
615
- * - 'inline' returns the params as comma separated params.
616
- * @default 'inline'
617
- */
618
- paramsType?: 'object' | 'inline';
619
- /**
620
- * How to pass your pathParams.
621
- * - 'object' returns the pathParams as an object.
622
- * - 'inline' returns the pathParams as comma separated params.
623
- * @default 'inline'
624
- */
625
- pathParamsType?: 'object' | 'inline';
626
- /**
627
- * Which parser can be used before returning the data.
628
- * - 'client' returns the data as-is from the client.
629
- * - 'zod' uses @kubb/plugin-zod to parse the data.
630
- * @default 'client'
631
- */
632
- parser?: 'client' | 'zod';
633
- /**
634
- * Which client should be used to do the HTTP calls.
635
- * - 'axios' uses axios client for HTTP requests.
636
- * - 'fetch' uses native fetch API for HTTP requests.
637
- * @default 'axios'
638
- */
639
- client?: 'axios' | 'fetch';
640
- /**
641
- * How to generate the client code.
642
- * - 'function' generates standalone functions for each operation.
643
- * - 'class' generates a class with methods for each operation.
644
- * - 'staticClass' generates a class with static methods for each operation.
645
- * @default 'function'
646
- */
647
- clientType?: 'function' | 'class' | 'staticClass';
648
- /**
649
- * Bundle the selected client into the generated `.kubb` directory.
650
- * When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
651
- * @default false
652
- * In version 5 of Kubb this is by default true
653
- */
654
- bundle?: boolean;
655
- transformers?: {
656
- /**
657
- * Customize the names based on the type that is provided by the plugin.
658
- */
659
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
660
- };
661
- /**
662
- * Define some generators next to the client generators
663
- */
664
- generators?: Array<Generator<PluginClient>>;
665
- };
666
- type ResolvedOptions$1 = {
667
- output: Output<Oas>;
668
- group?: Options$1['group'];
669
- baseURL: string | undefined;
670
- client: Options$1['client'];
671
- clientType: NonNullable<Options$1['clientType']>;
672
- bundle: NonNullable<Options$1['bundle']>;
673
- parser: NonNullable<Options$1['parser']>;
674
- urlType: NonNullable<Options$1['urlType']>;
675
- importPath: Options$1['importPath'];
676
- dataReturnType: NonNullable<Options$1['dataReturnType']>;
677
- pathParamsType: NonNullable<Options$1['pathParamsType']>;
678
- paramsType: NonNullable<Options$1['paramsType']>;
679
- paramsCasing: Options$1['paramsCasing'];
680
- };
681
- type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
682
- //#endregion
683
- //#region src/types.d.ts
684
- type TransformerProps = {
685
- operation: Operation$1;
686
- schemas: OperationSchemas;
687
- casing: 'camelcase' | undefined;
688
- };
689
- type Transformer = (props: TransformerProps) => unknown[];
690
- type Suspense = object;
691
- /**
692
- * Customize the queryKey
693
- */
694
- type QueryKey = Transformer;
695
- /**
696
- * Customize the mutationKey
697
- */
698
- type MutationKey = Transformer;
699
- type Query = {
700
- /**
701
- * Define which HttpMethods can be used for queries
702
- * @default ['get']
703
- */
704
- methods: Array<HttpMethod>;
705
- /**
706
- * Path to the useQuery hook for useQuery functionality.
707
- * Used as `import { useQuery } from '${importPath}'`.
708
- * Accepts relative and absolute paths.
709
- * Path is used as-is; relative paths are based on the generated file location.
710
- * @default '@tanstack/react-query'
711
- */
712
- importPath?: string;
713
- };
714
- type Mutation = {
715
- /**
716
- * Define which HttpMethods can be used for mutations
717
- * @default ['post', 'put', 'delete']
718
- */
719
- methods: Array<HttpMethod>;
720
- /**
721
- * Path to the useQuery hook for useQuery functionality.
722
- * Used as `import { useQuery } from '${importPath}'`.
723
- * Accepts relative and absolute paths.
724
- * Path is used as-is; relative paths are based on the generated file location.
725
- * @default '@tanstack/react-query'
726
- */
727
- importPath?: string;
728
- };
729
- type Infinite = {
730
- /**
731
- * Specify the params key used for `pageParam`.
732
- * @default 'id'
733
- */
734
- queryParam: string;
735
- /**
736
- * Which field of the data is used, set it to undefined when no cursor is known.
737
- * @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
738
- */
739
- cursorParam?: string | undefined;
740
- /**
741
- * Which field of the data is used to get the cursor for the next page.
742
- * Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
743
- */
744
- nextParam?: string | string[] | undefined;
745
- /**
746
- * Which field of the data is used to get the cursor for the previous page.
747
- * Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
748
- */
749
- previousParam?: string | string[] | undefined;
750
- /**
751
- * The initial value, the value of the first page.
752
- * @default 0
753
- */
754
- initialPageParam: unknown;
755
- };
756
- type CustomOptions = {
757
- /**
758
- * Path to the hook that is used to customize the hook options.
759
- * It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
760
- * It allows both relative and absolute paths but be aware that we will not change the path.
761
- */
762
- importPath: string;
763
- /**
764
- * Name of the exported hook that is used to customize the hook options.
765
- * It used as `import ${customOptions.name} from '${customOptions.importPath}'`.
766
- * @default 'useCustomHookOptions'
767
- */
768
- name?: string;
769
- };
770
- type Options = {
771
- /**
772
- * Specify the export location for the files and define the behavior of the output
773
- * @default { path: 'hooks', barrelType: 'named' }
774
- */
775
- output?: Output<Oas>;
776
- /**
777
- * Define which contentType should be used.
778
- * By default, the first JSON valid mediaType is used
779
- */
780
- contentType?: contentType;
781
- /**
782
- * Group the @tanstack/query hooks based on the provided name.
783
- */
784
- group?: Group;
785
- client?: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
786
- /**
787
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
788
- */
789
- exclude?: Array<Exclude$1>;
790
- /**
791
- * Array containing include parameters to include tags/operations/methods/paths.
792
- */
793
- include?: Array<Include>;
794
- /**
795
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
796
- */
797
- override?: Array<Override<ResolvedOptions>>;
798
- /**
799
- * How to style your params, by default no casing is applied
800
- * - 'camelcase' uses camelcase for the params names
801
- */
802
- paramsCasing?: 'camelcase';
803
- /**
804
- * How to pass your params.
805
- * - 'object' returns the params and pathParams as an object.
806
- * - 'inline' returns the params as comma separated params.
807
- * @default 'inline'
808
- */
809
- paramsType?: 'object' | 'inline';
810
- /**
811
- * How to pass your pathParams.
812
- * - 'object' returns the pathParams as an object.
813
- * - 'inline': returns the pathParams as comma separated params.
814
- * @default 'inline'
815
- */
816
- pathParamsType?: PluginClient['options']['pathParamsType'];
817
- /**
818
- * When set, an infiniteQuery hooks is added.
819
- */
820
- infinite?: Partial<Infinite> | false;
821
- /**
822
- * When set, a suspenseQuery hooks is added.
823
- */
824
- suspense?: Partial<Suspense> | false;
825
- queryKey?: QueryKey;
826
- /**
827
- * Override some useQuery behaviors.
828
- */
829
- query?: Partial<Query> | false;
830
- mutationKey?: MutationKey;
831
- /**
832
- * Override some useMutation behaviors.
833
- */
834
- mutation?: Partial<Mutation> | false;
835
- /**
836
- * When set, a custom hook is used to customize the options of the generated hooks.
837
- * It will also generate a `HookOptions` type that can be used to type the custom options of each hook for type-safety.
838
- */
839
- customOptions?: CustomOptions;
840
- /**
841
- * Which parser should be used before returning the data to `@tanstack/query`.
842
- * `'zod'` uses `@kubb/plugin-zod` to parse the data.
843
- */
844
- parser?: PluginClient['options']['parser'];
845
- transformers?: {
846
- /**
847
- * Customize the names based on the type that is provided by the plugin.
848
- */
849
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
850
- };
851
- /**
852
- * Define some generators next to the react-query generators
853
- */
854
- generators?: Array<Generator<PluginReactQuery>>;
855
- };
856
- type ResolvedOptions = {
857
- output: Output<Oas>;
858
- group: Options['group'];
859
- client: NonNullable<PluginReactQuery['options']['client']>;
860
- parser: Required<NonNullable<Options['parser']>>;
861
- pathParamsType: NonNullable<Options['pathParamsType']>;
862
- paramsCasing: Options['paramsCasing'];
863
- paramsType: NonNullable<Options['paramsType']>;
864
- /**
865
- * Only used of infinite
866
- */
867
- infinite: NonNullable<Infinite> | false;
868
- suspense: Suspense | false;
869
- queryKey: QueryKey | undefined;
870
- query: NonNullable<Required<Query>> | false;
871
- mutationKey: MutationKey | undefined;
872
- mutation: NonNullable<Required<Mutation>> | false;
873
- customOptions: NonNullable<Required<CustomOptions>> | undefined;
874
- };
875
- type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>;
876
- //#endregion
877
- export { ReactGenerator as a, __name as c, Transformer as i, Options as n, OperationSchemas as o, PluginReactQuery as r, Operation$1 as s, Infinite as t };
878
- //# sourceMappingURL=types-Fb-3R-ua.d.cts.map