@kubb/plugin-mcp 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 (37) hide show
  1. package/dist/{OperationGenerator-CVN32WMS.d.ts → SchemaGenerator-Bu2D8QtI.d.cts} +230 -325
  2. package/dist/{OperationGenerator-Bq_OAgZR.d.cts → SchemaGenerator-geilI4rJ.d.ts} +230 -325
  3. package/dist/{Server-CKHk0vlR.js → Server-DMDo69md.js} +3 -3
  4. package/dist/Server-DMDo69md.js.map +1 -0
  5. package/dist/{Server-AWXKgK_d.cjs → Server-vKCXRjmg.cjs} +8 -8
  6. package/dist/Server-vKCXRjmg.cjs.map +1 -0
  7. package/dist/chunk-DMmIE7y6.js +28 -0
  8. package/dist/components.cjs +1 -1
  9. package/dist/components.d.cts +6 -4
  10. package/dist/components.d.ts +6 -4
  11. package/dist/components.js +1 -1
  12. package/dist/{generators-naBCKi9F.cjs → generators-8HowWmDg.cjs} +20 -20
  13. package/dist/generators-8HowWmDg.cjs.map +1 -0
  14. package/dist/{generators-zuKj-GtG.js → generators-Bp0d1HbP.js} +4 -4
  15. package/dist/generators-Bp0d1HbP.js.map +1 -0
  16. package/dist/generators.cjs +2 -2
  17. package/dist/generators.d.cts +4 -4
  18. package/dist/generators.d.ts +4 -4
  19. package/dist/generators.js +2 -2
  20. package/dist/index.cjs +3 -2
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +3 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/{types-BtZpMsBD.d.ts → types-BPcoHHAu.d.cts} +2 -2
  27. package/dist/{types-Dr8_aqGF.d.cts → types-DXH0aZQO.d.ts} +2 -2
  28. package/package.json +18 -14
  29. package/src/components/Server.tsx +6 -6
  30. package/src/generators/mcpGenerator.tsx +1 -1
  31. package/src/generators/serverGenerator.tsx +1 -1
  32. package/src/plugin.ts +1 -0
  33. package/src/types.ts +2 -2
  34. package/dist/Server-AWXKgK_d.cjs.map +0 -1
  35. package/dist/Server-CKHk0vlR.js.map +0 -1
  36. package/dist/generators-naBCKi9F.cjs.map +0 -1
  37. package/dist/generators-zuKj-GtG.js.map +0 -1
@@ -1,138 +1,25 @@
1
+ import { Fabric, FileManager } from "@kubb/react-fabric";
2
+ import { KubbFile } from "@kubb/fabric-core/types";
1
3
  import { ConsolaInstance, LogLevel } from "consola";
2
- import { FileManager } from "@kubb/fabric-core";
3
4
  import * as OasTypes from "oas/types";
4
5
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
5
6
  import { Operation, Operation as Operation$1 } from "oas/operation";
6
7
  import { OpenAPIV3 } from "openapi-types";
7
8
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
8
9
  import BaseOas from "oas";
10
+ import { KubbNode } from "@kubb/react-fabric/types";
9
11
 
10
- //#region ../core/src/fs/types.d.ts
11
- type BasePath<T$1 extends string = string> = `${T$1}/`;
12
- type Import = {
13
- /**
14
- * Import name to be used
15
- * @example ["useState"]
16
- * @example "React"
17
- */
18
- name: string | Array<string | {
19
- propertyName: string;
20
- name?: string;
21
- }>;
22
- /**
23
- * Path for the import
24
- * @example '@kubb/core'
25
- */
26
- path: string;
27
- /**
28
- * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
29
- */
30
- isTypeOnly?: boolean;
31
- isNameSpace?: boolean;
32
- /**
33
- * When root is set it will get the path with relative getRelativePath(root, path).
34
- */
35
- root?: string;
36
- };
37
- type Source = {
38
- name?: string;
39
- value?: string;
40
- isTypeOnly?: boolean;
41
- /**
42
- * Has const or type 'export'
43
- * @default false
44
- */
45
- isExportable?: boolean;
46
- /**
47
- * When set, barrel generation will add this
48
- * @default false
49
- */
50
- isIndexable?: boolean;
51
- };
52
- type Export = {
53
- /**
54
- * Export name to be used.
55
- * @example ["useState"]
56
- * @example "React"
57
- */
58
- name?: string | Array<string>;
59
- /**
60
- * Path for the import.
61
- * @example '@kubb/core'
62
- */
63
- path: string;
64
- /**
65
- * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
66
- */
67
- isTypeOnly?: boolean;
68
- /**
69
- * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
70
- */
71
- asAlias?: boolean;
72
- };
73
- type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
74
- type Mode = 'single' | 'split';
75
- /**
76
- * Name to be used to dynamicly create the baseName(based on input.path)
77
- * Based on UNIX basename
78
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
79
- */
80
- type BaseName = `${string}.${string}`;
81
- /**
82
- * Path will be full qualified path to a specified file
83
- */
84
- type Path = string;
85
- type AdvancedPath<T$1 extends BaseName = BaseName> = `${BasePath}${T$1}`;
86
- type OptionalPath = Path | undefined | null;
87
- type File<TMeta extends object = object> = {
88
- /**
89
- * Name to be used to create the path
90
- * Based on UNIX basename, `${name}.extname`
91
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
92
- */
93
- baseName: BaseName;
94
- /**
95
- * Path will be full qualified path to a specified file
96
- */
97
- path: AdvancedPath<BaseName> | Path;
98
- sources: Array<Source>;
99
- imports?: Array<Import>;
100
- exports?: Array<Export>;
101
- /**
102
- * Use extra meta, this is getting used to generate the barrel/index files.
103
- */
104
- meta?: TMeta;
105
- banner?: string;
106
- footer?: string;
107
- };
108
- type ResolvedImport = Import;
109
- type ResolvedExport = Export;
110
- type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
111
- /**
112
- * @default object-hash
113
- */
114
- id: string;
115
- /**
116
- * Contains the first part of the baseName, generated based on baseName
117
- * @link https://nodejs.org/api/path.html#pathformatpathobject
118
- */
119
- name: string;
120
- extname: Extname;
121
- imports: Array<ResolvedImport>;
122
- exports: Array<ResolvedExport>;
123
- };
124
- //#endregion
125
12
  //#region ../core/src/BaseGenerator.d.ts
126
13
  /**
127
14
  * Abstract class that contains the building blocks for plugins to create their own Generator
128
15
  * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
129
16
  */
130
- declare abstract class BaseGenerator<TOptions$1 = unknown, TContext = unknown> {
17
+ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
131
18
  #private;
132
- constructor(options?: TOptions$1, context?: TContext);
133
- get options(): TOptions$1;
19
+ constructor(options?: TOptions, context?: TContext);
20
+ get options(): TOptions;
134
21
  get context(): TContext;
135
- set options(options: TOptions$1);
22
+ set options(options: TOptions);
136
23
  abstract build(...params: unknown[]): unknown;
137
24
  }
138
25
  //#endregion
@@ -185,7 +72,7 @@ type Logger = {
185
72
  };
186
73
  //#endregion
187
74
  //#region ../core/src/utils/types.d.ts
188
- type PossiblePromise<T$1> = Promise<T$1> | T$1;
75
+ type PossiblePromise<T> = Promise<T> | T;
189
76
  //#endregion
190
77
  //#region ../core/src/types.d.ts
191
78
  type InputPath = {
@@ -259,7 +146,7 @@ type Config<TInput = Input> = {
259
146
  * Override the extension to the generated imports and exports, by default each plugin will add an extension
260
147
  * @default { '.ts': '.ts'}
261
148
  */
262
- extension?: Record<Extname, Extname | ''>;
149
+ extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
263
150
  /**
264
151
  * 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`.
265
152
  * @default 'named'
@@ -298,11 +185,11 @@ TName extends string = string,
298
185
  /**
299
186
  * Options of the plugin.
300
187
  */
301
- TOptions$1 extends object = object,
188
+ TOptions extends object = object,
302
189
  /**
303
190
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
304
191
  */
305
- TResolvedOptions extends object = TOptions$1,
192
+ TResolvedOptions extends object = TOptions,
306
193
  /**
307
194
  * Context that you want to expose to other plugins.
308
195
  */
@@ -316,23 +203,23 @@ TResolvePathOptions extends object = object> = {
316
203
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
317
204
  */
318
205
  key: PluginKey<TName | string>;
319
- options: TOptions$1;
206
+ options: TOptions;
320
207
  resolvedOptions: TResolvedOptions;
321
208
  context: TContext;
322
209
  resolvePathOptions: TResolvePathOptions;
323
210
  };
324
211
  type PluginKey<TName> = [name: TName, identifier?: string | number];
325
- type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
212
+ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
326
213
  /**
327
214
  * Unique name used for the plugin
328
215
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
329
216
  * @example @kubb/typescript
330
217
  */
331
- name: TOptions$1['name'];
218
+ name: TOptions['name'];
332
219
  /**
333
220
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
334
221
  */
335
- options: TOptions$1['resolvedOptions'];
222
+ options: TOptions['resolvedOptions'];
336
223
  /**
337
224
  * 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.
338
225
  * Can be used to validate dependent plugins.
@@ -342,23 +229,23 @@ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions>
342
229
  * 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.
343
230
  */
344
231
  post?: Array<string>;
345
- } & (TOptions$1['context'] extends never ? {
232
+ } & (TOptions['context'] extends never ? {
346
233
  context?: never;
347
234
  } : {
348
- context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
235
+ context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
349
236
  });
350
- type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
351
- type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
237
+ type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
238
+ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
352
239
  /**
353
240
  * Unique name used for the plugin
354
241
  * @example @kubb/typescript
355
242
  */
356
- name: TOptions$1['name'];
243
+ name: TOptions['name'];
357
244
  /**
358
245
  * Internal key used when a developer uses more than one of the same plugin
359
246
  * @private
360
247
  */
361
- key: TOptions$1['key'];
248
+ key: TOptions['key'];
362
249
  /**
363
250
  * 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.
364
251
  * Can be used to validate dependent plugins.
@@ -371,49 +258,49 @@ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
371
258
  /**
372
259
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
373
260
  */
374
- options: TOptions$1['resolvedOptions'];
375
- } & (TOptions$1['context'] extends never ? {
261
+ options: TOptions['resolvedOptions'];
262
+ } & (TOptions['context'] extends never ? {
376
263
  context?: never;
377
264
  } : {
378
- context: TOptions$1['context'];
265
+ context: TOptions['context'];
379
266
  });
380
- type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
381
- type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
267
+ type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
268
+ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
382
269
  /**
383
270
  * Start of the lifecycle of a plugin.
384
271
  * @type hookParallel
385
272
  */
386
- buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
273
+ buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
387
274
  /**
388
275
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
389
276
  * Options can als be included.
390
277
  * @type hookFirst
391
278
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
392
279
  */
393
- resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
280
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
394
281
  /**
395
282
  * Resolve to a name based on a string.
396
283
  * Useful when converting to PascalCase or camelCase.
397
284
  * @type hookFirst
398
285
  * @example ('pet') => 'Pet'
399
286
  */
400
- resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
287
+ resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
401
288
  /**
402
289
  * End of the plugin lifecycle.
403
290
  * @type hookParallel
404
291
  */
405
- buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
292
+ buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
406
293
  };
407
294
  type PluginLifecycleHooks = keyof PluginLifecycle;
408
- type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
409
- type ResolvePathParams<TOptions$1 = object> = {
295
+ type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
296
+ type ResolvePathParams<TOptions = object> = {
410
297
  pluginKey?: Plugin['key'];
411
- baseName: BaseName;
412
- mode?: Mode;
298
+ baseName: KubbFile.BaseName;
299
+ mode?: KubbFile.Mode;
413
300
  /**
414
301
  * Options to be passed to 'resolvePath' 3th parameter
415
302
  */
416
- options?: TOptions$1;
303
+ options?: TOptions;
417
304
  };
418
305
  type ResolveNameParams = {
419
306
  name: string;
@@ -426,15 +313,16 @@ type ResolveNameParams = {
426
313
  */
427
314
  type?: 'file' | 'function' | 'type' | 'const';
428
315
  };
429
- type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
316
+ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
317
+ fabric: Fabric;
430
318
  config: Config;
431
319
  /**
432
320
  * @deprecated
433
321
  */
434
322
  fileManager: FileManager;
435
323
  pluginManager: PluginManager;
436
- addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
437
- resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
324
+ addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
325
+ resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
438
326
  resolveName: (params: ResolveNameParams) => string;
439
327
  logger: Logger;
440
328
  /**
@@ -444,12 +332,12 @@ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOption
444
332
  /**
445
333
  * Current plugin
446
334
  */
447
- plugin: Plugin<TOptions$1>;
335
+ plugin: Plugin<TOptions>;
448
336
  };
449
337
  /**
450
338
  * Specify the export location for the files and define the behavior of the output
451
339
  */
452
- type Output<TOptions$1> = {
340
+ type Output<TOptions> = {
453
341
  /**
454
342
  * Path to the output folder or file that will contain the generated code
455
343
  */
@@ -462,11 +350,11 @@ type Output<TOptions$1> = {
462
350
  /**
463
351
  * Add a banner text in the beginning of every file
464
352
  */
465
- banner?: string | ((options: TOptions$1) => string);
353
+ banner?: string | ((options: TOptions) => string);
466
354
  /**
467
355
  * Add a footer text in the beginning of every file
468
356
  */
469
- footer?: string | ((options: TOptions$1) => string);
357
+ footer?: string | ((options: TOptions) => string);
470
358
  };
471
359
  type GroupContext = {
472
360
  group: string;
@@ -485,20 +373,21 @@ type Group = {
485
373
  //#region ../core/src/PluginManager.d.ts
486
374
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
487
375
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
488
- type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
376
+ type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
489
377
  message: string;
490
378
  strategy: Strategy;
491
- hookName: H$1;
379
+ hookName: H;
492
380
  plugin: Plugin;
493
381
  parameters?: unknown[] | undefined;
494
382
  output?: unknown;
495
383
  };
496
- type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
497
- type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
384
+ type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
385
+ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
498
386
  result: Result;
499
387
  plugin: Plugin;
500
388
  };
501
389
  type Options$2 = {
390
+ fabric: Fabric;
502
391
  logger: Logger;
503
392
  /**
504
393
  * @default Number.POSITIVE_INFINITY
@@ -510,20 +399,16 @@ type Events = {
510
399
  executed: [executer: Executer];
511
400
  error: [error: Error];
512
401
  };
513
- type GetFileProps<TOptions$1 = object> = {
402
+ type GetFileProps<TOptions = object> = {
514
403
  name: string;
515
- mode?: Mode;
516
- extname: Extname;
404
+ mode?: KubbFile.Mode;
405
+ extname: KubbFile.Extname;
517
406
  pluginKey: Plugin['key'];
518
- options?: TOptions$1;
407
+ options?: TOptions;
519
408
  };
520
409
  declare class PluginManager {
521
410
  #private;
522
411
  readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
523
- /**
524
- * @deprecated do not use from pluginManager
525
- */
526
- readonly fileManager: FileManager;
527
412
  readonly events: EventEmitter<Events>;
528
413
  readonly config: Config;
529
414
  readonly executed: Array<Executer>;
@@ -536,10 +421,10 @@ declare class PluginManager {
536
421
  extname,
537
422
  pluginKey,
538
423
  options
539
- }: GetFileProps<TOptions>): File<{
424
+ }: GetFileProps<TOptions>): KubbFile.File<{
540
425
  pluginKey: Plugin['key'];
541
426
  }>;
542
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
427
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
543
428
  resolveName: (params: ResolveNameParams) => string;
544
429
  /**
545
430
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -671,6 +556,170 @@ declare class Oas<const TOAS = unknown> extends BaseOas {
671
556
  valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
672
557
  }
673
558
  //#endregion
559
+ //#region ../plugin-oas/src/generators/createReactGenerator.d.ts
560
+ type ReactGenerator<TOptions extends PluginFactoryOptions> = {
561
+ name: string;
562
+ type: 'react';
563
+ Operations: (props: OperationsProps<TOptions>) => KubbNode;
564
+ Operation: (props: OperationProps<TOptions>) => KubbNode;
565
+ Schema: (props: SchemaProps$1<TOptions>) => KubbNode;
566
+ };
567
+ //#endregion
568
+ //#region ../plugin-oas/src/generators/types.d.ts
569
+ type OperationsProps<TOptions extends PluginFactoryOptions> = {
570
+ /**
571
+ * @deprecated
572
+ */
573
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
574
+ options: TOptions['resolvedOptions'];
575
+ operations: Array<Operation$1>;
576
+ };
577
+ type OperationProps<TOptions extends PluginFactoryOptions> = {
578
+ /**
579
+ * @deprecated
580
+ */
581
+ instance: Omit<OperationGenerator<TOptions>, 'build'>;
582
+ options: TOptions['resolvedOptions'];
583
+ operation: Operation$1;
584
+ };
585
+ type SchemaProps$1<TOptions extends PluginFactoryOptions> = {
586
+ instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
587
+ options: TOptions['resolvedOptions'];
588
+ schema: {
589
+ name: string;
590
+ tree: Array<Schema>;
591
+ value: SchemaObject$1;
592
+ };
593
+ };
594
+ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
595
+ //#endregion
596
+ //#region ../plugin-oas/src/generators/createGenerator.d.ts
597
+ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
598
+ name: string;
599
+ type: 'core';
600
+ operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
601
+ operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
602
+ schema: (props: SchemaProps$1<TOptions>) => Promise<KubbFile.File[]>;
603
+ };
604
+ //#endregion
605
+ //#region ../plugin-oas/src/types.d.ts
606
+ type ResolvePathOptions = {
607
+ pluginKey?: Plugin['key'];
608
+ group?: {
609
+ tag?: string;
610
+ path?: string;
611
+ };
612
+ type?: ResolveNameParams['type'];
613
+ };
614
+ /**
615
+ * `propertyName` is the ref name + resolved with the nameResolver
616
+ * @example import { Pet } from './Pet'
617
+ *
618
+ * `originalName` is the original name used(in PascalCase), only used to remove duplicates
619
+ *
620
+ * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
621
+ * @example import a type(plugin-ts) for a mock file(swagger-faker)
622
+ */
623
+ type Ref = {
624
+ propertyName: string;
625
+ originalName: string;
626
+ path: KubbFile.OptionalPath;
627
+ pluginKey?: Plugin['key'];
628
+ };
629
+ type Refs = Record<string, Ref>;
630
+ type OperationSchema = {
631
+ /**
632
+ * Converted name, contains already `PathParams`, `QueryParams`, ...
633
+ */
634
+ name: string;
635
+ schema: SchemaObject$1;
636
+ operation?: Operation$1;
637
+ /**
638
+ * OperationName in PascalCase, only being used in OperationGenerator
639
+ */
640
+ operationName: string;
641
+ description?: string;
642
+ statusCode?: number;
643
+ keys?: string[];
644
+ keysToOmit?: string[];
645
+ withData?: boolean;
646
+ };
647
+ type OperationSchemas = {
648
+ pathParams?: OperationSchema & {
649
+ keysToOmit?: never;
650
+ };
651
+ queryParams?: OperationSchema & {
652
+ keysToOmit?: never;
653
+ };
654
+ headerParams?: OperationSchema & {
655
+ keysToOmit?: never;
656
+ };
657
+ request?: OperationSchema;
658
+ response: OperationSchema;
659
+ responses: Array<OperationSchema>;
660
+ statusCodes?: Array<OperationSchema>;
661
+ errors?: Array<OperationSchema>;
662
+ };
663
+ type ByTag = {
664
+ type: 'tag';
665
+ pattern: string | RegExp;
666
+ };
667
+ type ByOperationId = {
668
+ type: 'operationId';
669
+ pattern: string | RegExp;
670
+ };
671
+ type ByPath = {
672
+ type: 'path';
673
+ pattern: string | RegExp;
674
+ };
675
+ type ByMethod = {
676
+ type: 'method';
677
+ pattern: HttpMethod | RegExp;
678
+ };
679
+ type BySchemaName = {
680
+ type: 'schemaName';
681
+ pattern: string | RegExp;
682
+ };
683
+ type ByContentType = {
684
+ type: 'contentType';
685
+ pattern: string | RegExp;
686
+ };
687
+ type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
688
+ type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
689
+ type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
690
+ options: Partial<TOptions>;
691
+ };
692
+ //#endregion
693
+ //#region ../plugin-oas/src/OperationGenerator.d.ts
694
+ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
695
+ fabric: Fabric;
696
+ oas: Oas;
697
+ exclude: Array<Exclude$1> | undefined;
698
+ include: Array<Include> | undefined;
699
+ override: Array<Override<TOptions>> | undefined;
700
+ contentType: contentType | undefined;
701
+ pluginManager: PluginManager;
702
+ /**
703
+ * Current plugin
704
+ */
705
+ plugin: Plugin<TPluginOptions>;
706
+ mode: KubbFile.Mode;
707
+ };
708
+ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
709
+ #private;
710
+ getSchemas(operation: Operation$1, {
711
+ resolveName
712
+ }?: {
713
+ resolveName?: (name: string) => string;
714
+ }): OperationSchemas;
715
+ getOperations(): Promise<Array<{
716
+ path: string;
717
+ method: HttpMethod;
718
+ operation: Operation$1;
719
+ }>>;
720
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
721
+ }
722
+ //#endregion
674
723
  //#region ../plugin-oas/src/SchemaMapper.d.ts
675
724
  type SchemaKeywordMapper = {
676
725
  object: {
@@ -784,7 +833,7 @@ type SchemaKeywordMapper = {
784
833
  /**
785
834
  * Full qualified path.
786
835
  */
787
- path: OptionalPath;
836
+ path: KubbFile.OptionalPath;
788
837
  /**
789
838
  * When true `File.Import` will be used.
790
839
  * When false a reference will be used inside the current file.
@@ -888,105 +937,18 @@ type Schema = {
888
937
  keyword: string;
889
938
  } | SchemaKeywordMapper[keyof SchemaKeywordMapper];
890
939
  //#endregion
891
- //#region ../plugin-oas/src/types.d.ts
892
- type ResolvePathOptions = {
893
- pluginKey?: Plugin['key'];
894
- group?: {
895
- tag?: string;
896
- path?: string;
897
- };
898
- type?: ResolveNameParams['type'];
899
- };
900
- /**
901
- * `propertyName` is the ref name + resolved with the nameResolver
902
- * @example import { Pet } from './Pet'
903
- *
904
- * `originalName` is the original name used(in PascalCase), only used to remove duplicates
905
- *
906
- * `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
907
- * @example import a type(plugin-ts) for a mock file(swagger-faker)
908
- */
909
- type Ref = {
910
- propertyName: string;
911
- originalName: string;
912
- path: OptionalPath;
913
- pluginKey?: Plugin['key'];
914
- };
915
- type Refs = Record<string, Ref>;
916
- type OperationSchema = {
917
- /**
918
- * Converted name, contains already `PathParams`, `QueryParams`, ...
919
- */
920
- name: string;
921
- schema: SchemaObject$1;
922
- operation?: Operation$1;
923
- /**
924
- * OperationName in PascalCase, only being used in OperationGenerator
925
- */
926
- operationName: string;
927
- description?: string;
928
- statusCode?: number;
929
- keys?: string[];
930
- keysToOmit?: string[];
931
- withData?: boolean;
932
- };
933
- type OperationSchemas = {
934
- pathParams?: OperationSchema & {
935
- keysToOmit?: never;
936
- };
937
- queryParams?: OperationSchema & {
938
- keysToOmit?: never;
939
- };
940
- headerParams?: OperationSchema & {
941
- keysToOmit?: never;
942
- };
943
- request?: OperationSchema;
944
- response: OperationSchema;
945
- responses: Array<OperationSchema>;
946
- statusCodes?: Array<OperationSchema>;
947
- errors?: Array<OperationSchema>;
948
- };
949
- type ByTag = {
950
- type: 'tag';
951
- pattern: string | RegExp;
952
- };
953
- type ByOperationId = {
954
- type: 'operationId';
955
- pattern: string | RegExp;
956
- };
957
- type ByPath = {
958
- type: 'path';
959
- pattern: string | RegExp;
960
- };
961
- type ByMethod = {
962
- type: 'method';
963
- pattern: HttpMethod | RegExp;
964
- };
965
- type BySchemaName = {
966
- type: 'schemaName';
967
- pattern: string | RegExp;
968
- };
969
- type ByContentType = {
970
- type: 'contentType';
971
- pattern: string | RegExp;
972
- };
973
- type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
974
- type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
975
- type Override<TOptions$1> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
976
- options: Partial<TOptions$1>;
977
- };
978
- //#endregion
979
940
  //#region ../plugin-oas/src/SchemaGenerator.d.ts
980
- type Context$1<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
941
+ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
942
+ fabric: Fabric;
981
943
  oas: Oas;
982
944
  pluginManager: PluginManager;
983
945
  /**
984
946
  * Current plugin
985
947
  */
986
948
  plugin: Plugin<TPluginOptions>;
987
- mode: Mode;
949
+ mode: KubbFile.Mode;
988
950
  include?: Array<'schemas' | 'responses' | 'requestBodies'>;
989
- override: Array<Override<TOptions$1>> | undefined;
951
+ override: Array<Override<TOptions>> | undefined;
990
952
  contentType?: contentType;
991
953
  output?: string;
992
954
  };
@@ -1009,15 +971,15 @@ type SchemaGeneratorOptions = {
1009
971
  * TODO TODO add docs
1010
972
  * @beta
1011
973
  */
1012
- schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema[] | undefined;
974
+ schema?: (schemaProps: SchemaProps, defaultSchemas: Schema[]) => Schema[] | undefined;
1013
975
  };
1014
976
  };
1015
- type SchemaProps$1 = {
977
+ type SchemaProps = {
1016
978
  schemaObject?: SchemaObject$1;
1017
979
  name?: string;
1018
980
  parentName?: string;
1019
981
  };
1020
- 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>> {
982
+ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
1021
983
  #private;
1022
984
  refs: Refs;
1023
985
  /**
@@ -1025,72 +987,15 @@ declare class SchemaGenerator<TOptions$1 extends SchemaGeneratorOptions = Schema
1025
987
  * Delegates to getBaseTypeFromSchema internally and
1026
988
  * optionally adds a union with null.
1027
989
  */
1028
- parse(props: SchemaProps$1): Schema[];
990
+ parse(props: SchemaProps): Schema[];
1029
991
  deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
1030
992
  find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1031
993
  static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
1032
994
  static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1033
995
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1034
996
  static combineObjects(tree: Schema[] | undefined): Schema[];
1035
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
1036
- }
1037
- //#endregion
1038
- //#region ../plugin-oas/src/generator.d.ts
1039
- type OperationsProps<TOptions$1 extends PluginFactoryOptions> = {
1040
- instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
1041
- options: TOptions$1['resolvedOptions'];
1042
- operations: Array<Operation$1>;
1043
- };
1044
- type OperationProps<TOptions$1 extends PluginFactoryOptions> = {
1045
- instance: Omit<OperationGenerator<TOptions$1>, 'build'>;
1046
- options: TOptions$1['resolvedOptions'];
1047
- operation: Operation$1;
1048
- };
1049
- type SchemaProps<TOptions$1 extends PluginFactoryOptions> = {
1050
- instance: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions$1>, 'build'>;
1051
- options: TOptions$1['resolvedOptions'];
1052
- schema: {
1053
- name: string;
1054
- tree: Array<Schema>;
1055
- value: SchemaObject$1;
1056
- };
1057
- };
1058
- type GeneratorOptions<TOptions$1 extends PluginFactoryOptions> = {
1059
- name: string;
1060
- operations?: (this: GeneratorOptions<TOptions$1>, props: OperationsProps<TOptions$1>) => Promise<File[]>;
1061
- operation?: (this: GeneratorOptions<TOptions$1>, props: OperationProps<TOptions$1>) => Promise<File[]>;
1062
- schema?: (this: GeneratorOptions<TOptions$1>, props: SchemaProps<TOptions$1>) => Promise<File[]>;
1063
- };
1064
- type Generator<TOptions$1 extends PluginFactoryOptions> = GeneratorOptions<TOptions$1>;
1065
- //#endregion
1066
- //#region ../plugin-oas/src/OperationGenerator.d.ts
1067
- type Context<TOptions$1, TPluginOptions extends PluginFactoryOptions> = {
1068
- oas: Oas;
1069
- exclude: Array<Exclude$1> | undefined;
1070
- include: Array<Include> | undefined;
1071
- override: Array<Override<TOptions$1>> | undefined;
1072
- contentType: contentType | undefined;
1073
- pluginManager: PluginManager;
1074
- /**
1075
- * Current plugin
1076
- */
1077
- plugin: Plugin<TPluginOptions>;
1078
- mode: Mode;
1079
- };
1080
- declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context<TPluginOptions['resolvedOptions'], TPluginOptions>> {
1081
- #private;
1082
- getSchemas(operation: Operation$1, {
1083
- resolveName
1084
- }?: {
1085
- resolveName?: (name: string) => string;
1086
- }): OperationSchemas;
1087
- getOperations(): Promise<Array<{
1088
- path: string;
1089
- method: HttpMethod;
1090
- operation: Operation$1;
1091
- }>>;
1092
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
997
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
1093
998
  }
1094
999
  //#endregion
1095
- export { Override as a, contentType as c, PluginFactoryOptions as d, ResolveNameParams as f, OperationSchemas as i, Group as l, File as m, Exclude$1 as n, ResolvePathOptions as o, UserPluginWithLifeCycle as p, Include as r, Oas as s, Generator as t, Output as u };
1096
- //# sourceMappingURL=OperationGenerator-Bq_OAgZR.d.cts.map
1000
+ export { ResolvePathOptions as a, Oas as c, Output as d, PluginFactoryOptions as f, Override as i, contentType as l, UserPluginWithLifeCycle as m, Include as n, Generator as o, ResolveNameParams as p, OperationSchemas as r, ReactGenerator as s, Exclude$1 as t, Group as u };
1001
+ //# sourceMappingURL=SchemaGenerator-geilI4rJ.d.ts.map