@kubb/plugin-msw 4.3.1 → 4.4.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 (39) hide show
  1. package/dist/chunk-DMmIE7y6.js +28 -0
  2. package/dist/{components-zb0hoJri.js → components-C1RVylIl.js} +3 -3
  3. package/dist/components-C1RVylIl.js.map +1 -0
  4. package/dist/{components-K3TBkxEb.cjs → components-DhZ1MTrg.cjs} +15 -15
  5. package/dist/components-DhZ1MTrg.cjs.map +1 -0
  6. package/dist/components.cjs +1 -1
  7. package/dist/components.d.cts +5 -4
  8. package/dist/components.d.ts +6 -5
  9. package/dist/components.js +1 -1
  10. package/dist/{generators-DWokU4z5.js → generators-BvLpjRZi.js} +4 -4
  11. package/dist/generators-BvLpjRZi.js.map +1 -0
  12. package/dist/{generators-DpY1JzRC.cjs → generators-CNRKORe8.cjs} +17 -17
  13. package/dist/generators-CNRKORe8.cjs.map +1 -0
  14. package/dist/generators.cjs +2 -2
  15. package/dist/generators.d.cts +3 -3
  16. package/dist/generators.d.ts +4 -4
  17. package/dist/generators.js +2 -2
  18. package/dist/index.cjs +3 -2
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +1 -1
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +3 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/{types-CZEZAxGw.d.ts → types-BKFpz20w.d.ts} +215 -310
  25. package/dist/{types-CjM44aZF.d.cts → types-CvyuqqRp.d.cts} +214 -309
  26. package/dist/{types-IbHKcY02.d.ts → types-D0JuaurR.d.ts} +1 -1
  27. package/package.json +17 -13
  28. package/src/components/Handlers.tsx +3 -2
  29. package/src/components/Mock.tsx +3 -2
  30. package/src/components/MockWithFaker.tsx +3 -2
  31. package/src/components/Response.tsx +3 -2
  32. package/src/generators/handlersGenerator.tsx +1 -1
  33. package/src/generators/mswGenerator.tsx +1 -1
  34. package/src/plugin.ts +1 -0
  35. package/src/types.ts +1 -1
  36. package/dist/components-K3TBkxEb.cjs.map +0 -1
  37. package/dist/components-zb0hoJri.js.map +0 -1
  38. package/dist/generators-DWokU4z5.js.map +0 -1
  39. package/dist/generators-DpY1JzRC.cjs.map +0 -1
@@ -1,11 +1,13 @@
1
- import { a as contentType, i as SchemaObject$1, n as OasTypes, r as Operation$1, t as HttpMethod } from "./types-IbHKcY02.js";
1
+ import { a as contentType, i as SchemaObject$1, n as OasTypes, r as Operation$1, t as HttpMethod } from "./types-D0JuaurR.js";
2
+ import { Fabric, FileManager } from "@kubb/react-fabric";
2
3
  import { OASDocument, SchemaObject, User } from "oas/types";
3
4
  import { Operation } from "oas/operation";
4
5
  import { OpenAPIV3 } from "openapi-types";
5
6
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
6
7
  import BaseOas from "oas";
8
+ import { KubbNode } from "@kubb/react-fabric/types";
9
+ import { KubbFile } from "@kubb/fabric-core/types";
7
10
  import { ConsolaInstance, LogLevel } from "consola";
8
- import { FileManager } from "@kubb/fabric-core";
9
11
 
10
12
  //#region ../oas/src/Oas.d.ts
11
13
  type Options$3 = {
@@ -40,130 +42,15 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
40
42
  * Abstract class that contains the building blocks for plugins to create their own Generator
41
43
  * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
42
44
  */
43
- declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
45
+ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
44
46
  #private;
45
- constructor(options?: TOptions$1, context?: TContext);
46
- get options(): TOptions$1;
47
+ constructor(options?: TOptions, context?: TContext);
48
+ get options(): TOptions;
47
49
  get context(): TContext;
48
- set options(options: TOptions$1);
50
+ set options(options: TOptions);
49
51
  abstract build(...params: unknown[]): unknown;
50
52
  }
51
53
  //#endregion
52
- //#region ../core/src/fs/types.d.ts
53
- type BasePath<T$1 extends string = string> = `${T$1}/`;
54
- type Import = {
55
- /**
56
- * Import name to be used
57
- * @example ["useState"]
58
- * @example "React"
59
- */
60
- name: string | Array<string | {
61
- propertyName: string;
62
- name?: string;
63
- }>;
64
- /**
65
- * Path for the import
66
- * @example '@kubb/core'
67
- */
68
- path: string;
69
- /**
70
- * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
71
- */
72
- isTypeOnly?: boolean;
73
- isNameSpace?: boolean;
74
- /**
75
- * When root is set it will get the path with relative getRelativePath(root, path).
76
- */
77
- root?: string;
78
- };
79
- type Source = {
80
- name?: string;
81
- value?: string;
82
- isTypeOnly?: boolean;
83
- /**
84
- * Has const or type 'export'
85
- * @default false
86
- */
87
- isExportable?: boolean;
88
- /**
89
- * When set, barrel generation will add this
90
- * @default false
91
- */
92
- isIndexable?: boolean;
93
- };
94
- type Export = {
95
- /**
96
- * Export name to be used.
97
- * @example ["useState"]
98
- * @example "React"
99
- */
100
- name?: string | Array<string>;
101
- /**
102
- * Path for the import.
103
- * @example '@kubb/core'
104
- */
105
- path: string;
106
- /**
107
- * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
108
- */
109
- isTypeOnly?: boolean;
110
- /**
111
- * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
112
- */
113
- asAlias?: boolean;
114
- };
115
- type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
116
- type Mode = 'single' | 'split';
117
- /**
118
- * Name to be used to dynamicly create the baseName(based on input.path)
119
- * Based on UNIX basename
120
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
121
- */
122
- type BaseName = `${string}.${string}`;
123
- /**
124
- * Path will be full qualified path to a specified file
125
- */
126
- type Path = string;
127
- type AdvancedPath<T$1 extends BaseName = BaseName> = `${BasePath}${T$1}`;
128
- type OptionalPath = Path | undefined | null;
129
- type File<TMeta extends object = object> = {
130
- /**
131
- * Name to be used to create the path
132
- * Based on UNIX basename, `${name}.extname`
133
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
134
- */
135
- baseName: BaseName;
136
- /**
137
- * Path will be full qualified path to a specified file
138
- */
139
- path: AdvancedPath<BaseName> | Path;
140
- sources: Array<Source>;
141
- imports?: Array<Import>;
142
- exports?: Array<Export>;
143
- /**
144
- * Use extra meta, this is getting used to generate the barrel/index files.
145
- */
146
- meta?: TMeta;
147
- banner?: string;
148
- footer?: string;
149
- };
150
- type ResolvedImport = Import;
151
- type ResolvedExport = Export;
152
- type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
153
- /**
154
- * @default object-hash
155
- */
156
- id: string;
157
- /**
158
- * Contains the first part of the baseName, generated based on baseName
159
- * @link https://nodejs.org/api/path.html#pathformatpathobject
160
- */
161
- name: string;
162
- extname: Extname;
163
- imports: Array<ResolvedImport>;
164
- exports: Array<ResolvedExport>;
165
- };
166
- //#endregion
167
54
  //#region ../core/src/utils/EventEmitter.d.ts
168
55
  declare class EventEmitter<TEvents extends Record<string, any>> {
169
56
  #private;
@@ -213,7 +100,7 @@ type Logger = {
213
100
  };
214
101
  //#endregion
215
102
  //#region ../core/src/utils/types.d.ts
216
- type PossiblePromise<T$1> = Promise<T$1> | T$1;
103
+ type PossiblePromise<T> = Promise<T> | T;
217
104
  //#endregion
218
105
  //#region ../core/src/types.d.ts
219
106
  type InputPath = {
@@ -287,7 +174,7 @@ type Config<TInput = Input> = {
287
174
  * Override the extension to the generated imports and exports, by default each plugin will add an extension
288
175
  * @default { '.ts': '.ts'}
289
176
  */
290
- extension?: Record<Extname, Extname | ''>;
177
+ extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
291
178
  /**
292
179
  * Specify how `index.ts` files should be created. You can also disable the generation of barrel files here. While each plugin has its own `barrelType` option, this setting controls the creation of the root barrel file, such as` src/gen/index.ts`.
293
180
  * @default 'named'
@@ -326,11 +213,11 @@ TName extends string = string,
326
213
  /**
327
214
  * Options of the plugin.
328
215
  */
329
- TOptions$1 extends object = object,
216
+ TOptions extends object = object,
330
217
  /**
331
218
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
332
219
  */
333
- TResolvedOptions extends object = TOptions$1,
220
+ TResolvedOptions extends object = TOptions,
334
221
  /**
335
222
  * Context that you want to expose to other plugins.
336
223
  */
@@ -344,23 +231,23 @@ TResolvePathOptions extends object = object> = {
344
231
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
345
232
  */
346
233
  key: PluginKey<TName | string>;
347
- options: TOptions$1;
234
+ options: TOptions;
348
235
  resolvedOptions: TResolvedOptions;
349
236
  context: TContext;
350
237
  resolvePathOptions: TResolvePathOptions;
351
238
  };
352
239
  type PluginKey<TName> = [name: TName, identifier?: string | number];
353
- type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
240
+ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
354
241
  /**
355
242
  * Unique name used for the plugin
356
243
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
357
244
  * @example @kubb/typescript
358
245
  */
359
- name: TOptions$1['name'];
246
+ name: TOptions['name'];
360
247
  /**
361
248
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
362
249
  */
363
- options: TOptions$1['resolvedOptions'];
250
+ options: TOptions['resolvedOptions'];
364
251
  /**
365
252
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
366
253
  * Can be used to validate dependent plugins.
@@ -370,23 +257,23 @@ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions>
370
257
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
371
258
  */
372
259
  post?: Array<string>;
373
- } & (TOptions$1['context'] extends never ? {
260
+ } & (TOptions['context'] extends never ? {
374
261
  context?: never;
375
262
  } : {
376
- context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
263
+ context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
377
264
  });
378
- type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
379
- type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
265
+ type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
266
+ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
380
267
  /**
381
268
  * Unique name used for the plugin
382
269
  * @example @kubb/typescript
383
270
  */
384
- name: TOptions$1['name'];
271
+ name: TOptions['name'];
385
272
  /**
386
273
  * Internal key used when a developer uses more than one of the same plugin
387
274
  * @private
388
275
  */
389
- key: TOptions$1['key'];
276
+ key: TOptions['key'];
390
277
  /**
391
278
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
392
279
  * Can be used to validate dependent plugins.
@@ -399,49 +286,49 @@ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
399
286
  /**
400
287
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
401
288
  */
402
- options: TOptions$1['resolvedOptions'];
403
- } & (TOptions$1['context'] extends never ? {
289
+ options: TOptions['resolvedOptions'];
290
+ } & (TOptions['context'] extends never ? {
404
291
  context?: never;
405
292
  } : {
406
- context: TOptions$1['context'];
293
+ context: TOptions['context'];
407
294
  });
408
- type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
409
- type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
295
+ type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
296
+ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
410
297
  /**
411
298
  * Start of the lifecycle of a plugin.
412
299
  * @type hookParallel
413
300
  */
414
- buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
301
+ buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
415
302
  /**
416
303
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
417
304
  * Options can als be included.
418
305
  * @type hookFirst
419
306
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
420
307
  */
421
- resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
308
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
422
309
  /**
423
310
  * Resolve to a name based on a string.
424
311
  * Useful when converting to PascalCase or camelCase.
425
312
  * @type hookFirst
426
313
  * @example ('pet') => 'Pet'
427
314
  */
428
- resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
315
+ resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
429
316
  /**
430
317
  * End of the plugin lifecycle.
431
318
  * @type hookParallel
432
319
  */
433
- buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
320
+ buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
434
321
  };
435
322
  type PluginLifecycleHooks = keyof PluginLifecycle;
436
- type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
437
- type ResolvePathParams<TOptions$1 = object> = {
323
+ type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
324
+ type ResolvePathParams<TOptions = object> = {
438
325
  pluginKey?: Plugin['key'];
439
- baseName: BaseName;
440
- mode?: Mode;
326
+ baseName: KubbFile.BaseName;
327
+ mode?: KubbFile.Mode;
441
328
  /**
442
329
  * Options to be passed to 'resolvePath' 3th parameter
443
330
  */
444
- options?: TOptions$1;
331
+ options?: TOptions;
445
332
  };
446
333
  type ResolveNameParams = {
447
334
  name: string;
@@ -454,15 +341,16 @@ type ResolveNameParams = {
454
341
  */
455
342
  type?: 'file' | 'function' | 'type' | 'const';
456
343
  };
457
- type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
344
+ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
345
+ fabric: Fabric;
458
346
  config: Config;
459
347
  /**
460
348
  * @deprecated
461
349
  */
462
350
  fileManager: FileManager;
463
351
  pluginManager: PluginManager;
464
- addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
465
- resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
352
+ addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
353
+ resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
466
354
  resolveName: (params: ResolveNameParams) => string;
467
355
  logger: Logger;
468
356
  /**
@@ -472,12 +360,12 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
472
360
  /**
473
361
  * Current plugin
474
362
  */
475
- plugin: Plugin<TOptions$1>;
363
+ plugin: Plugin<TOptions>;
476
364
  };
477
365
  /**
478
366
  * Specify the export location for the files and define the behavior of the output
479
367
  */
480
- type Output<TOptions$1> = {
368
+ type Output<TOptions> = {
481
369
  /**
482
370
  * Path to the output folder or file that will contain the generated code
483
371
  */
@@ -490,11 +378,11 @@ type Output<TOptions$1> = {
490
378
  /**
491
379
  * Add a banner text in the beginning of every file
492
380
  */
493
- banner?: string | ((options: TOptions$1) => string);
381
+ banner?: string | ((options: TOptions) => string);
494
382
  /**
495
383
  * Add a footer text in the beginning of every file
496
384
  */
497
- footer?: string | ((options: TOptions$1) => string);
385
+ footer?: string | ((options: TOptions) => string);
498
386
  };
499
387
  type GroupContext = {
500
388
  group: string;
@@ -513,20 +401,21 @@ type Group = {
513
401
  //#region ../core/src/PluginManager.d.ts
514
402
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
515
403
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
516
- type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
404
+ type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
517
405
  message: string;
518
406
  strategy: Strategy;
519
- hookName: H$1;
407
+ hookName: H;
520
408
  plugin: Plugin;
521
409
  parameters?: unknown[] | undefined;
522
410
  output?: unknown;
523
411
  };
524
- type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
525
- type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
412
+ type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
413
+ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
526
414
  result: Result;
527
415
  plugin: Plugin;
528
416
  };
529
417
  type Options$2 = {
418
+ fabric: Fabric;
530
419
  logger: Logger;
531
420
  /**
532
421
  * @default Number.POSITIVE_INFINITY
@@ -538,20 +427,16 @@ type Events = {
538
427
  executed: [executer: Executer];
539
428
  error: [error: Error];
540
429
  };
541
- type GetFileProps<TOptions$1 = object> = {
430
+ type GetFileProps<TOptions = object> = {
542
431
  name: string;
543
- mode?: Mode;
544
- extname: Extname;
432
+ mode?: KubbFile.Mode;
433
+ extname: KubbFile.Extname;
545
434
  pluginKey: Plugin['key'];
546
- options?: TOptions$1;
435
+ options?: TOptions;
547
436
  };
548
437
  declare class PluginManager {
549
438
  #private;
550
439
  readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
551
- /**
552
- * @deprecated do not use from pluginManager
553
- */
554
- readonly fileManager: FileManager;
555
440
  readonly events: EventEmitter<Events>;
556
441
  readonly config: Config;
557
442
  readonly executed: Array<Executer>;
@@ -564,10 +449,10 @@ declare class PluginManager {
564
449
  extname,
565
450
  pluginKey,
566
451
  options
567
- }: GetFileProps<TOptions>): File<{
452
+ }: GetFileProps<TOptions>): KubbFile.File<{
568
453
  pluginKey: Plugin['key'];
569
454
  }>;
570
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
455
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
571
456
  resolveName: (params: ResolveNameParams) => string;
572
457
  /**
573
458
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -664,6 +549,133 @@ type FileMetaBase = {
664
549
  pluginKey?: Plugin['key'];
665
550
  };
666
551
  //#endregion
552
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
553
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
554
+ name: string;
555
+ type: 'core';
556
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
557
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
558
+ schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
559
+ };
560
+ //#endregion
561
+ //#region ../plugin-oas/src/types.d.ts
562
+ type ResolvePathOptions = {
563
+ pluginKey?: Plugin['key'];
564
+ group?: {
565
+ tag?: string;
566
+ path?: string;
567
+ };
568
+ type?: ResolveNameParams['type'];
569
+ };
570
+ /**
571
+ * `propertyName` is the ref name + resolved with the nameResolver
572
+ * @example import { Pet } from './Pet'
573
+ *
574
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
575
+ *
576
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
577
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
578
+ */
579
+ type Ref = {
580
+ propertyName: string;
581
+ originalName: string;
582
+ path: KubbFile.OptionalPath;
583
+ pluginKey?: Plugin['key'];
584
+ };
585
+ type Refs = Record<string, Ref>;
586
+ type OperationSchema = {
587
+ /**
588
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
589
+ */
590
+ name: string;
591
+ schema: SchemaObject$1;
592
+ operation?: Operation$1;
593
+ /**
594
+ * OperationName in PascalCase, only being used in OperationGenerator
595
+ */
596
+ operationName: string;
597
+ description?: string;
598
+ statusCode?: number;
599
+ keys?: string[];
600
+ keysToOmit?: string[];
601
+ withData?: boolean;
602
+ };
603
+ type OperationSchemas = {
604
+ pathParams?: OperationSchema & {
605
+ keysToOmit?: never;
606
+ };
607
+ queryParams?: OperationSchema & {
608
+ keysToOmit?: never;
609
+ };
610
+ headerParams?: OperationSchema & {
611
+ keysToOmit?: never;
612
+ };
613
+ request?: OperationSchema;
614
+ response: OperationSchema;
615
+ responses: Array<OperationSchema>;
616
+ statusCodes?: Array<OperationSchema>;
617
+ errors?: Array<OperationSchema>;
618
+ };
619
+ type ByTag = {
620
+ type: 'tag';
621
+ pattern: string | RegExp;
622
+ };
623
+ type ByOperationId = {
624
+ type: 'operationId';
625
+ pattern: string | RegExp;
626
+ };
627
+ type ByPath = {
628
+ type: 'path';
629
+ pattern: string | RegExp;
630
+ };
631
+ type ByMethod = {
632
+ type: 'method';
633
+ pattern: HttpMethod | RegExp;
634
+ };
635
+ type BySchemaName = {
636
+ type: 'schemaName';
637
+ pattern: string | RegExp;
638
+ };
639
+ type ByContentType = {
640
+ type: 'contentType';
641
+ pattern: string | RegExp;
642
+ };
643
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
644
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
645
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
646
+ options: Partial<TOptions>;
647
+ };
648
+ //#endregion
649
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
650
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
651
+ fabric: Fabric;
652
+ oas: Oas;
653
+ exclude: Array<Exclude$1> | undefined;
654
+ include: Array<Include> | undefined;
655
+ override: Array<Override<TOptions>> | undefined;
656
+ contentType: contentType | undefined;
657
+ pluginManager: PluginManager;
658
+ /**
659
+ * Current plugin
660
+ */
661
+ plugin: Plugin<TPluginOptions>;
662
+ mode: KubbFile.Mode;
663
+ };
664
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
665
+ #private;
666
+ getSchemas(operation: Operation$1, {
667
+ resolveName
668
+ }?: {
669
+ resolveName?: (name: string) => string;
670
+ }): OperationSchemas;
671
+ getOperations(): Promise<Array<{
672
+ path: string;
673
+ method: HttpMethod;
674
+ operation: Operation$1;
675
+ }>>;
676
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
677
+ }
678
+ //#endregion
667
679
  //#region ../plugin-oas/src/SchemaMapper.d.ts
668
680
  type SchemaKeywordMapper = {
669
681
  object: {
@@ -777,7 +789,7 @@ type SchemaKeywordMapper = {
777
789
  /**
778
790
  * Full qualified path.
779
791
  */
780
- path: OptionalPath;
792
+ path: KubbFile.OptionalPath;
781
793
  /**
782
794
  * When true `File.Import` will be used.
783
795
  * When false a reference will be used inside the current file.
@@ -881,105 +893,18 @@ type Schema = {
881
893
  keyword: string;
882
894
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
883
895
  //#endregion
884
- //#region ../plugin-oas/src/types.d.ts
885
- type ResolvePathOptions = {
886
- pluginKey?: Plugin['key'];
887
- group?: {
888
- tag?: string;
889
- path?: string;
890
- };
891
- type?: ResolveNameParams['type'];
892
- };
893
- /**
894
- * `propertyName` is the ref name + resolved with the nameResolver
895
- * @example import { Pet } from './Pet'
896
- *
897
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
898
- *
899
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
900
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
901
- */
902
- type Ref = {
903
- propertyName: string;
904
- originalName: string;
905
- path: OptionalPath;
906
- pluginKey?: Plugin['key'];
907
- };
908
- type Refs = Record<string, Ref>;
909
- type OperationSchema = {
910
- /**
911
- * Converted name, contains already `PathParams`, `QueryParams`, ...
912
- */
913
- name: string;
914
- schema: SchemaObject$1;
915
- operation?: Operation$1;
916
- /**
917
- * OperationName in PascalCase, only being used in OperationGenerator
918
- */
919
- operationName: string;
920
- description?: string;
921
- statusCode?: number;
922
- keys?: string[];
923
- keysToOmit?: string[];
924
- withData?: boolean;
925
- };
926
- type OperationSchemas = {
927
- pathParams?: OperationSchema & {
928
- keysToOmit?: never;
929
- };
930
- queryParams?: OperationSchema & {
931
- keysToOmit?: never;
932
- };
933
- headerParams?: OperationSchema & {
934
- keysToOmit?: never;
935
- };
936
- request?: OperationSchema;
937
- response: OperationSchema;
938
- responses: Array<OperationSchema>;
939
- statusCodes?: Array<OperationSchema>;
940
- errors?: Array<OperationSchema>;
941
- };
942
- type ByTag = {
943
- type: 'tag';
944
- pattern: string | RegExp;
945
- };
946
- type ByOperationId = {
947
- type: 'operationId';
948
- pattern: string | RegExp;
949
- };
950
- type ByPath = {
951
- type: 'path';
952
- pattern: string | RegExp;
953
- };
954
- type ByMethod = {
955
- type: 'method';
956
- pattern: HttpMethod | RegExp;
957
- };
958
- type BySchemaName = {
959
- type: 'schemaName';
960
- pattern: string | RegExp;
961
- };
962
- type ByContentType = {
963
- type: 'contentType';
964
- pattern: string | RegExp;
965
- };
966
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
967
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
968
- type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
969
- options: Partial<TOptions$1>;
970
- };
971
- //#endregion
972
896
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
973
- type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
897
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
898
+ fabric: Fabric;
974
899
  oas: Oas;
975
900
  pluginManager: PluginManager;
976
901
  /**
977
902
  * Current plugin
978
903
  */
979
904
  plugin: Plugin<TPluginOptions>;
980
- mode: Mode;
905
+ mode: KubbFile.Mode;
981
906
  include?: Array<'schemas' | 'responses' | 'requestBodies'>;
982
- override: Array<Override<TOptions$1>> | undefined;
907
+ override: Array<Override<TOptions>> | undefined;
983
908
  contentType?: contentType;
984
909
  output?: string;
985
910
  };
@@ -1010,7 +935,7 @@ type SchemaProps$1 = {
1010
935
  name?: string;
1011
936
  parentName?: string;
1012
937
  };
1013
- declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions$1, Context$1<TOptions$1, TPluginOptions>> {
938
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
1014
939
  #private;
1015
940
  refs: Refs;
1016
941
  /**
@@ -1025,65 +950,45 @@ declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = Schema
1025
950
  static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1026
951
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1027
952
  static combineObjects(tree: Schema[] | undefined): Schema[];
1028
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
953
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
1029
954
  }
1030
955
  //#endregion
1031
- //#region ../plugin-oas/src/generator.d.ts
1032
- type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
1033
- instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
1034
- options: TOptions$1['resolvedOptions'];
956
+ //#region ../plugin-oas/src/generators/types.d.ts
957
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
958
+ /**
959
+ * @deprecated
960
+ */
961
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
962
+ options: TOptions['resolvedOptions'];
1035
963
  operations: Array<Operation$1>;
1036
964
  };
1037
- type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
1038
- instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
1039
- options: TOptions$1['resolvedOptions'];
965
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
966
+ /**
967
+ * @deprecated
968
+ */
969
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
970
+ options: TOptions['resolvedOptions'];
1040
971
  operation: Operation$1;
1041
972
  };
1042
- type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
1043
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
1044
- options: TOptions$1['resolvedOptions'];
973
+ type SchemaProps<TOptions extends PluginFactoryOptions> = {
974
+ instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
975
+ options: TOptions['resolvedOptions'];
1045
976
  schema: {
1046
977
  name: string;
1047
978
  tree: Array<Schema>;
1048
979
  value: SchemaObject$1;
1049
980
  };
1050
981
  };
1051
- type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
1052
- name: string;
1053
- operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
1054
- operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
1055
- schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
1056
- };
1057
- type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
982
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
1058
983
  //#endregion
1059
- //#region ../plugin-oas/src/OperationGenerator.d.ts
1060
- type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
1061
- oas: Oas;
1062
- exclude: Array<Exclude$1> | undefined;
1063
- include: Array<Include> | undefined;
1064
- override: Array<Override<TOptions$1>> | undefined;
1065
- contentType: contentType | undefined;
1066
- pluginManager: PluginManager;
1067
- /**
1068
- * Current plugin
1069
- */
1070
- plugin: Plugin<TPluginOptions>;
1071
- mode: Mode;
984
+ //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
985
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
986
+ name: string;
987
+ type: 'react';
988
+ Operations: (props: OperationsProps<TOptions>) => KubbNode;
989
+ Operation: (props: OperationProps<TOptions>) => KubbNode;
990
+ Schema: (props: SchemaProps<TOptions>) => KubbNode;
1072
991
  };
1073
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
1074
- #private;
1075
- getSchemas(operation: Operation$1, {
1076
- resolveName
1077
- }?: {
1078
- resolveName?: (name: string) => string;
1079
- }): OperationSchemas;
1080
- getOperations(): Promise<Array<{
1081
- path: string;
1082
- method: HttpMethod;
1083
- operation: Operation$1;
1084
- }>>;
1085
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
1086
- }
1087
992
  //#endregion
1088
993
  //#region src/types.d.ts
1089
994
  type Options$1 = {
@@ -1145,5 +1050,5 @@ type ResolvedOptions = {
1145
1050
  };
1146
1051
  type PluginMsw = PluginFactoryOptions<'plugin-msw', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1147
1052
  //#endregion
1148
- export { UserPluginWithLifeCycle as i, PluginMsw as n, Generator as r, Options$1 as t };
1149
- //# sourceMappingURL=types-CZEZAxGw.d.ts.map
1053
+ export { UserPluginWithLifeCycle as i, PluginMsw as n, ReactGenerator as r, Options$1 as t };
1054
+ //# sourceMappingURL=types-BKFpz20w.d.ts.map