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