@kubb/plugin-react-query 5.0.0-alpha.9 → 5.0.0-beta.100

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 (47) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +38 -93
  3. package/dist/index.cjs +2317 -149
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +494 -6
  6. package/dist/index.js +2283 -143
  7. package/dist/index.js.map +1 -1
  8. package/package.json +47 -75
  9. package/dist/components-BHQT9ZLc.cjs +0 -1634
  10. package/dist/components-BHQT9ZLc.cjs.map +0 -1
  11. package/dist/components-CpyHYGOw.js +0 -1520
  12. package/dist/components-CpyHYGOw.js.map +0 -1
  13. package/dist/components.cjs +0 -13
  14. package/dist/components.d.ts +0 -398
  15. package/dist/components.js +0 -2
  16. package/dist/generators-DP07m3rH.cjs +0 -1469
  17. package/dist/generators-DP07m3rH.cjs.map +0 -1
  18. package/dist/generators-DkQwKTc2.js +0 -1427
  19. package/dist/generators-DkQwKTc2.js.map +0 -1
  20. package/dist/generators.cjs +0 -9
  21. package/dist/generators.d.ts +0 -523
  22. package/dist/generators.js +0 -2
  23. package/dist/types-D5S7Ny9r.d.ts +0 -270
  24. package/src/components/InfiniteQuery.tsx +0 -220
  25. package/src/components/InfiniteQueryOptions.tsx +0 -289
  26. package/src/components/Mutation.tsx +0 -158
  27. package/src/components/MutationKey.tsx +0 -1
  28. package/src/components/MutationOptions.tsx +0 -122
  29. package/src/components/Query.tsx +0 -194
  30. package/src/components/QueryKey.tsx +0 -1
  31. package/src/components/QueryOptions.tsx +0 -181
  32. package/src/components/SuspenseInfiniteQuery.tsx +0 -220
  33. package/src/components/SuspenseInfiniteQueryOptions.tsx +0 -289
  34. package/src/components/SuspenseQuery.tsx +0 -204
  35. package/src/components/index.ts +0 -11
  36. package/src/generators/customHookOptionsFileGenerator.tsx +0 -98
  37. package/src/generators/hookOptionsGenerator.tsx +0 -196
  38. package/src/generators/index.ts +0 -7
  39. package/src/generators/infiniteQueryGenerator.tsx +0 -214
  40. package/src/generators/mutationGenerator.tsx +0 -195
  41. package/src/generators/queryGenerator.tsx +0 -194
  42. package/src/generators/suspenseInfiniteQueryGenerator.tsx +0 -202
  43. package/src/generators/suspenseQueryGenerator.tsx +0 -207
  44. package/src/index.ts +0 -2
  45. package/src/plugin.ts +0 -239
  46. package/src/types.ts +0 -205
  47. /package/dist/{chunk--u3MIqq1.js → rolldown-runtime-C0LytTxp.js} +0 -0
@@ -1,523 +0,0 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { r as PluginReactQuery } from "./types-D5S7Ny9r.js";
3
- import { Config, FileMetaBase, Generator, Group, KubbEvents, Output, Plugin, PluginDriver, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
4
- import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
5
- import { FabricReactNode } from "@kubb/react-fabric/types";
6
- import { Fabric, KubbFile } from "@kubb/fabric-core/types";
7
-
8
- //#region ../../internals/utils/src/asyncEventEmitter.d.ts
9
- /** A function that can be registered as an event listener, synchronous or async. */
10
- type AsyncListener<TArgs extends unknown[]> = (...args: TArgs) => void | Promise<void>;
11
- /**
12
- * A typed EventEmitter that awaits all async listeners before resolving.
13
- * Wraps Node's `EventEmitter` with full TypeScript event-map inference.
14
- */
15
- declare class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: unknown[] }> {
16
- #private;
17
- /**
18
- * `maxListener` controls the maximum number of listeners per event before Node emits a memory-leak warning.
19
- * @default 10
20
- */
21
- constructor(maxListener?: number);
22
- /**
23
- * Emits an event and awaits all registered listeners in parallel.
24
- * Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.
25
- */
26
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
27
- /** Registers a persistent listener for the given event. */
28
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
29
- /** Registers a one-shot listener that removes itself after the first invocation. */
30
- onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
31
- /** Removes a previously registered listener. */
32
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
33
- /** Removes all listeners from every event channel. */
34
- removeAll(): void;
35
- }
36
- //#endregion
37
- //#region ../plugin-oas/src/types.d.ts
38
- type GetOasOptions = {
39
- validate?: boolean;
40
- };
41
- type Context$2 = {
42
- getOas(options?: GetOasOptions): Promise<Oas>;
43
- getBaseURL(): Promise<string | undefined>;
44
- };
45
- declare global {
46
- namespace Kubb {
47
- interface PluginContext extends Context$2 {}
48
- }
49
- }
50
- /**
51
- * `propertyName` is the ref name + resolved with the nameResolver
52
- * @example import { Pet } from './Pet'
53
- *
54
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
55
- *
56
- * `pluginName` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
57
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
58
- */
59
- type Ref = {
60
- propertyName: string;
61
- originalName: string;
62
- path: KubbFile.Path;
63
- pluginName?: string;
64
- };
65
- type Refs = Record<string, Ref>;
66
- type OperationSchema = {
67
- /**
68
- * Converted name, contains already `PathParams`, `QueryParams`, ...
69
- */
70
- name: string;
71
- schema: SchemaObject;
72
- operation?: Operation;
73
- /**
74
- * OperationName in PascalCase, only being used in OperationGenerator
75
- */
76
- operationName: string;
77
- description?: string;
78
- statusCode?: number;
79
- keys?: string[];
80
- keysToOmit?: string[];
81
- withData?: boolean;
82
- };
83
- type OperationSchemas = {
84
- pathParams?: OperationSchema & {
85
- keysToOmit?: never;
86
- };
87
- queryParams?: OperationSchema & {
88
- keysToOmit?: never;
89
- };
90
- headerParams?: OperationSchema & {
91
- keysToOmit?: never;
92
- };
93
- request?: OperationSchema;
94
- response: OperationSchema;
95
- responses: Array<OperationSchema>;
96
- statusCodes?: Array<OperationSchema>;
97
- errors?: Array<OperationSchema>;
98
- };
99
- type ByTag = {
100
- type: 'tag';
101
- pattern: string | RegExp;
102
- };
103
- type ByOperationId = {
104
- type: 'operationId';
105
- pattern: string | RegExp;
106
- };
107
- type ByPath = {
108
- type: 'path';
109
- pattern: string | RegExp;
110
- };
111
- type ByMethod = {
112
- type: 'method';
113
- pattern: HttpMethod | RegExp;
114
- };
115
- type BySchemaName = {
116
- type: 'schemaName';
117
- pattern: string | RegExp;
118
- };
119
- type ByContentType = {
120
- type: 'contentType';
121
- pattern: string | RegExp;
122
- };
123
- type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySchemaName;
124
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType | BySchemaName;
125
- type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
126
- options: Partial<TOptions>;
127
- };
128
- //#endregion
129
- //#region ../plugin-oas/src/OperationGenerator.d.ts
130
- type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
131
- fabric: Fabric;
132
- oas: Oas;
133
- exclude: Array<Exclude> | undefined;
134
- include: Array<Include> | undefined;
135
- override: Array<Override<TOptions>> | undefined;
136
- contentType: contentType | undefined;
137
- driver: PluginDriver;
138
- events?: AsyncEventEmitter<KubbEvents>;
139
- /**
140
- * Current plugin
141
- */
142
- plugin: Plugin<TPluginOptions>;
143
- mode: KubbFile.Mode;
144
- UNSTABLE_NAMING?: true;
145
- };
146
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> {
147
- #private;
148
- constructor(options: TPluginOptions['resolvedOptions'], context: Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>);
149
- get options(): TPluginOptions['resolvedOptions'];
150
- set options(options: TPluginOptions['resolvedOptions']);
151
- get context(): Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>;
152
- getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
153
- getSchemas(operation: Operation, {
154
- resolveName
155
- }?: {
156
- resolveName?: (name: string) => string;
157
- }): OperationSchemas;
158
- getOperations(): Promise<Array<{
159
- path: string;
160
- method: HttpMethod;
161
- operation: Operation;
162
- }>>;
163
- build(...generators: Array<Generator$1<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
164
- }
165
- //#endregion
166
- //#region ../plugin-oas/src/SchemaMapper.d.ts
167
- type SchemaKeywordMapper = {
168
- object: {
169
- keyword: 'object';
170
- args: {
171
- properties: {
172
- [x: string]: Schema[];
173
- };
174
- additionalProperties: Schema[];
175
- patternProperties?: Record<string, Schema[]>;
176
- strict?: boolean;
177
- };
178
- };
179
- url: {
180
- keyword: 'url';
181
- };
182
- readOnly: {
183
- keyword: 'readOnly';
184
- };
185
- writeOnly: {
186
- keyword: 'writeOnly';
187
- };
188
- uuid: {
189
- keyword: 'uuid';
190
- };
191
- email: {
192
- keyword: 'email';
193
- };
194
- firstName: {
195
- keyword: 'firstName';
196
- };
197
- lastName: {
198
- keyword: 'lastName';
199
- };
200
- phone: {
201
- keyword: 'phone';
202
- };
203
- password: {
204
- keyword: 'password';
205
- };
206
- date: {
207
- keyword: 'date';
208
- args: {
209
- type?: 'date' | 'string';
210
- };
211
- };
212
- time: {
213
- keyword: 'time';
214
- args: {
215
- type?: 'date' | 'string';
216
- };
217
- };
218
- datetime: {
219
- keyword: 'datetime';
220
- args: {
221
- offset?: boolean;
222
- local?: boolean;
223
- };
224
- };
225
- tuple: {
226
- keyword: 'tuple';
227
- args: {
228
- items: Schema[];
229
- min?: number;
230
- max?: number;
231
- rest?: Schema;
232
- };
233
- };
234
- array: {
235
- keyword: 'array';
236
- args: {
237
- items: Schema[];
238
- min?: number;
239
- max?: number;
240
- unique?: boolean;
241
- };
242
- };
243
- enum: {
244
- keyword: 'enum';
245
- args: {
246
- name: string;
247
- typeName: string;
248
- asConst: boolean;
249
- items: Array<{
250
- name: string | number;
251
- format: 'string' | 'number' | 'boolean';
252
- value?: string | number | boolean;
253
- }>;
254
- };
255
- };
256
- and: {
257
- keyword: 'and';
258
- args: Schema[];
259
- };
260
- const: {
261
- keyword: 'const';
262
- args: {
263
- name: string | number;
264
- format: 'string' | 'number' | 'boolean';
265
- value?: string | number | boolean;
266
- };
267
- };
268
- union: {
269
- keyword: 'union';
270
- args: Schema[];
271
- };
272
- ref: {
273
- keyword: 'ref';
274
- args: {
275
- name: string;
276
- $ref: string;
277
- /**
278
- * Full qualified path.
279
- */
280
- path: KubbFile.Path;
281
- /**
282
- * When true `File.Import` is used.
283
- * When false a reference is used inside the current file.
284
- */
285
- isImportable: boolean;
286
- };
287
- };
288
- matches: {
289
- keyword: 'matches';
290
- args?: string;
291
- };
292
- boolean: {
293
- keyword: 'boolean';
294
- };
295
- default: {
296
- keyword: 'default';
297
- args: string | number | boolean;
298
- };
299
- string: {
300
- keyword: 'string';
301
- };
302
- integer: {
303
- keyword: 'integer';
304
- };
305
- bigint: {
306
- keyword: 'bigint';
307
- };
308
- number: {
309
- keyword: 'number';
310
- };
311
- max: {
312
- keyword: 'max';
313
- args: number;
314
- };
315
- min: {
316
- keyword: 'min';
317
- args: number;
318
- };
319
- exclusiveMaximum: {
320
- keyword: 'exclusiveMaximum';
321
- args: number;
322
- };
323
- exclusiveMinimum: {
324
- keyword: 'exclusiveMinimum';
325
- args: number;
326
- };
327
- describe: {
328
- keyword: 'describe';
329
- args: string;
330
- };
331
- example: {
332
- keyword: 'example';
333
- args: string;
334
- };
335
- deprecated: {
336
- keyword: 'deprecated';
337
- };
338
- optional: {
339
- keyword: 'optional';
340
- };
341
- undefined: {
342
- keyword: 'undefined';
343
- };
344
- nullish: {
345
- keyword: 'nullish';
346
- };
347
- nullable: {
348
- keyword: 'nullable';
349
- };
350
- null: {
351
- keyword: 'null';
352
- };
353
- any: {
354
- keyword: 'any';
355
- };
356
- unknown: {
357
- keyword: 'unknown';
358
- };
359
- void: {
360
- keyword: 'void';
361
- };
362
- blob: {
363
- keyword: 'blob';
364
- };
365
- schema: {
366
- keyword: 'schema';
367
- args: {
368
- type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
369
- format?: string;
370
- };
371
- };
372
- name: {
373
- keyword: 'name';
374
- args: string;
375
- };
376
- catchall: {
377
- keyword: 'catchall';
378
- };
379
- interface: {
380
- keyword: 'interface';
381
- };
382
- };
383
- type Schema = {
384
- keyword: string;
385
- } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
386
- //#endregion
387
- //#region ../plugin-oas/src/SchemaGenerator.d.ts
388
- type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
389
- fabric: Fabric;
390
- oas: Oas;
391
- driver: PluginDriver;
392
- events?: AsyncEventEmitter<KubbEvents>;
393
- /**
394
- * Current plugin
395
- */
396
- plugin: Plugin<TPluginOptions>;
397
- mode: KubbFile.Mode;
398
- include?: Array<'schemas' | 'responses' | 'requestBodies'>;
399
- override: Array<Override<TOptions>> | undefined;
400
- contentType?: contentType;
401
- output?: string;
402
- };
403
- type SchemaGeneratorOptions = {
404
- dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
405
- integerType?: 'number' | 'bigint';
406
- unknownType: 'any' | 'unknown' | 'void';
407
- emptySchemaType: 'any' | 'unknown' | 'void';
408
- enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
409
- enumSuffix?: string;
410
- /**
411
- * @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
412
- * When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
413
- * @internal
414
- */
415
- usedEnumNames?: Record<string, number>;
416
- mapper?: Record<string, string>;
417
- typed?: boolean;
418
- transformers: {
419
- /**
420
- * Customize the names based on the type that is provided by the plugin.
421
- */
422
- name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
423
- /**
424
- * Receive schema and name(propertyName) and return Schema array.
425
- * Return `undefined` to fall through to default schema generation.
426
- * @beta
427
- */
428
- schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
429
- };
430
- };
431
- type SchemaProps$1 = {
432
- schema: SchemaObject | null;
433
- name: string | null;
434
- parentName: string | null;
435
- rootName?: string | null;
436
- };
437
- declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> {
438
- #private;
439
- constructor(options: TOptions, context: Context<TOptions, TPluginOptions>);
440
- get options(): TOptions;
441
- set options(options: TOptions);
442
- get context(): Context<TOptions, TPluginOptions>;
443
- refs: Refs;
444
- /**
445
- * Creates a type node from a given schema.
446
- * Delegates to getBaseTypeFromSchema internally and
447
- * optionally adds a union with null.
448
- */
449
- parse(props: SchemaProps$1): Schema[];
450
- static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
451
- static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
452
- static combineObjects(tree: Schema[] | undefined): Schema[];
453
- build(...generators: Array<Generator$1<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
454
- }
455
- //#endregion
456
- //#region ../plugin-oas/src/generators/createGenerator.d.ts
457
- type CoreGenerator<TOptions extends PluginFactoryOptions> = {
458
- name: string;
459
- type: 'core';
460
- version: '1';
461
- operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
462
- operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
463
- schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
464
- };
465
- //#endregion
466
- //#region ../plugin-oas/src/generators/types.d.ts
467
- type OperationsProps<TOptions extends PluginFactoryOptions> = {
468
- config: Config;
469
- generator: Omit<OperationGenerator<TOptions>, 'build'>;
470
- plugin: Plugin<TOptions>;
471
- operations: Array<Operation>;
472
- };
473
- type OperationProps<TOptions extends PluginFactoryOptions> = {
474
- config: Config;
475
- generator: Omit<OperationGenerator<TOptions>, 'build'>;
476
- plugin: Plugin<TOptions>;
477
- operation: Operation;
478
- };
479
- type SchemaProps<TOptions extends PluginFactoryOptions> = {
480
- config: Config;
481
- generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
482
- plugin: Plugin<TOptions>;
483
- schema: {
484
- name: string;
485
- tree: Array<Schema>;
486
- value: SchemaObject;
487
- };
488
- };
489
- type Generator$1<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions> | Generator<TOptions>;
490
- //#endregion
491
- //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
492
- type ReactGenerator<TOptions extends PluginFactoryOptions> = {
493
- name: string;
494
- type: 'react';
495
- version: '1';
496
- Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
497
- Operation: (props: OperationProps<TOptions>) => FabricReactNode;
498
- Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
499
- };
500
- //#endregion
501
- //#region src/generators/customHookOptionsFileGenerator.d.ts
502
- declare const customHookOptionsFileGenerator: ReactGenerator<PluginReactQuery>;
503
- //#endregion
504
- //#region src/generators/hookOptionsGenerator.d.ts
505
- declare const hookOptionsGenerator: ReactGenerator<PluginReactQuery>;
506
- //#endregion
507
- //#region src/generators/infiniteQueryGenerator.d.ts
508
- declare const infiniteQueryGenerator: ReactGenerator<PluginReactQuery>;
509
- //#endregion
510
- //#region src/generators/mutationGenerator.d.ts
511
- declare const mutationGenerator: ReactGenerator<PluginReactQuery>;
512
- //#endregion
513
- //#region src/generators/queryGenerator.d.ts
514
- declare const queryGenerator: ReactGenerator<PluginReactQuery>;
515
- //#endregion
516
- //#region src/generators/suspenseInfiniteQueryGenerator.d.ts
517
- declare const suspenseInfiniteQueryGenerator: ReactGenerator<PluginReactQuery>;
518
- //#endregion
519
- //#region src/generators/suspenseQueryGenerator.d.ts
520
- declare const suspenseQueryGenerator: ReactGenerator<PluginReactQuery>;
521
- //#endregion
522
- export { customHookOptionsFileGenerator, hookOptionsGenerator, infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseInfiniteQueryGenerator, suspenseQueryGenerator };
523
- //# sourceMappingURL=generators.d.ts.map
@@ -1,2 +0,0 @@
1
- import { a as infiniteQueryGenerator, i as mutationGenerator, n as suspenseInfiniteQueryGenerator, o as hookOptionsGenerator, r as queryGenerator, s as customHookOptionsFileGenerator, t as suspenseQueryGenerator } from "./generators-DkQwKTc2.js";
2
- export { customHookOptionsFileGenerator, hookOptionsGenerator, infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseInfiniteQueryGenerator, suspenseQueryGenerator };