@kubb/plugin-mcp 4.4.0 → 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.
@@ -1,4 +1,4 @@
1
- import { KubbNode } from "@kubb/react-fabric/types";
1
+ import { KubbFile } from "@kubb/fabric-core/types";
2
2
  import { Fabric, FileManager } from "@kubb/react-fabric";
3
3
  import { ConsolaInstance, LogLevel } from "consola";
4
4
  import * as OasTypes from "oas/types";
@@ -7,122 +7,8 @@ import { Operation, Operation as Operation$1 } from "oas/operation";
7
7
  import { OpenAPIV3 } from "openapi-types";
8
8
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
9
9
  import BaseOas from "oas";
10
+ import { KubbNode } from "@kubb/react-fabric/types";
10
11
 
11
- //#region ../core/src/fs/types.d.ts
12
- type BasePath<T extends string = string> = `${T}/`;
13
- type Import = {
14
- /**
15
- * Import name to be used
16
- * @example ["useState"]
17
- * @example "React"
18
- */
19
- name: string | Array<string | {
20
- propertyName: string;
21
- name?: string;
22
- }>;
23
- /**
24
- * Path for the import
25
- * @example '@kubb/core'
26
- */
27
- path: string;
28
- /**
29
- * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
30
- */
31
- isTypeOnly?: boolean;
32
- isNameSpace?: boolean;
33
- /**
34
- * When root is set it will get the path with relative getRelativePath(root, path).
35
- */
36
- root?: string;
37
- };
38
- type Source = {
39
- name?: string;
40
- value?: string;
41
- isTypeOnly?: boolean;
42
- /**
43
- * Has const or type 'export'
44
- * @default false
45
- */
46
- isExportable?: boolean;
47
- /**
48
- * When set, barrel generation will add this
49
- * @default false
50
- */
51
- isIndexable?: boolean;
52
- };
53
- type Export = {
54
- /**
55
- * Export name to be used.
56
- * @example ["useState"]
57
- * @example "React"
58
- */
59
- name?: string | Array<string>;
60
- /**
61
- * Path for the import.
62
- * @example '@kubb/core'
63
- */
64
- path: string;
65
- /**
66
- * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
67
- */
68
- isTypeOnly?: boolean;
69
- /**
70
- * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
71
- */
72
- asAlias?: boolean;
73
- };
74
- type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
75
- type Mode = 'single' | 'split';
76
- /**
77
- * Name to be used to dynamicly create the baseName(based on input.path)
78
- * Based on UNIX basename
79
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
80
- */
81
- type BaseName = `${string}.${string}`;
82
- /**
83
- * Path will be full qualified path to a specified file
84
- */
85
- type Path = string;
86
- type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
87
- type OptionalPath = Path | undefined | null;
88
- type File<TMeta extends object = object> = {
89
- /**
90
- * Name to be used to create the path
91
- * Based on UNIX basename, `${name}.extname`
92
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
93
- */
94
- baseName: BaseName;
95
- /**
96
- * Path will be full qualified path to a specified file
97
- */
98
- path: AdvancedPath<BaseName> | Path;
99
- sources: Array<Source>;
100
- imports?: Array<Import>;
101
- exports?: Array<Export>;
102
- /**
103
- * Use extra meta, this is getting used to generate the barrel/index files.
104
- */
105
- meta?: TMeta;
106
- banner?: string;
107
- footer?: string;
108
- };
109
- type ResolvedImport = Import;
110
- type ResolvedExport = Export;
111
- type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
112
- /**
113
- * @default object-hash
114
- */
115
- id: string;
116
- /**
117
- * Contains the first part of the baseName, generated based on baseName
118
- * @link https://nodejs.org/api/path.html#pathformatpathobject
119
- */
120
- name: string;
121
- extname: Extname;
122
- imports: Array<ResolvedImport>;
123
- exports: Array<ResolvedExport>;
124
- };
125
- //#endregion
126
12
  //#region ../core/src/BaseGenerator.d.ts
127
13
  /**
128
14
  * Abstract class that contains the building blocks for plugins to create their own Generator
@@ -260,7 +146,7 @@ type Config<TInput = Input> = {
260
146
  * Override the extension to the generated imports and exports, by default each plugin will add an extension
261
147
  * @default { '.ts': '.ts'}
262
148
  */
263
- extension?: Record<Extname, Extname | ''>;
149
+ extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
264
150
  /**
265
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`.
266
152
  * @default 'named'
@@ -391,7 +277,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
391
277
  * @type hookFirst
392
278
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
393
279
  */
394
- resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
280
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
395
281
  /**
396
282
  * Resolve to a name based on a string.
397
283
  * Useful when converting to PascalCase or camelCase.
@@ -409,8 +295,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
409
295
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
410
296
  type ResolvePathParams<TOptions = object> = {
411
297
  pluginKey?: Plugin['key'];
412
- baseName: BaseName;
413
- mode?: Mode;
298
+ baseName: KubbFile.BaseName;
299
+ mode?: KubbFile.Mode;
414
300
  /**
415
301
  * Options to be passed to 'resolvePath' 3th parameter
416
302
  */
@@ -435,8 +321,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
435
321
  */
436
322
  fileManager: FileManager;
437
323
  pluginManager: PluginManager;
438
- addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
439
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
324
+ addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
325
+ resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
440
326
  resolveName: (params: ResolveNameParams) => string;
441
327
  logger: Logger;
442
328
  /**
@@ -515,8 +401,8 @@ type Events = {
515
401
  };
516
402
  type GetFileProps<TOptions = object> = {
517
403
  name: string;
518
- mode?: Mode;
519
- extname: Extname;
404
+ mode?: KubbFile.Mode;
405
+ extname: KubbFile.Extname;
520
406
  pluginKey: Plugin['key'];
521
407
  options?: TOptions;
522
408
  };
@@ -535,10 +421,10 @@ declare class PluginManager {
535
421
  extname,
536
422
  pluginKey,
537
423
  options
538
- }: GetFileProps<TOptions>): File<{
424
+ }: GetFileProps<TOptions>): KubbFile.File<{
539
425
  pluginKey: Plugin['key'];
540
426
  }>;
541
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
427
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
542
428
  resolveName: (params: ResolveNameParams) => string;
543
429
  /**
544
430
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -711,9 +597,9 @@ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions>
711
597
  type CoreGenerator<TOptions extends PluginFactoryOptions> = {
712
598
  name: string;
713
599
  type: 'core';
714
- operations: (props: OperationsProps<TOptions>) => Promise<File[]>;
715
- operation: (props: OperationProps<TOptions>) => Promise<File[]>;
716
- schema: (props: SchemaProps$1<TOptions>) => Promise<File[]>;
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[]>;
717
603
  };
718
604
  //#endregion
719
605
  //#region ../plugin-oas/src/types.d.ts
@@ -737,7 +623,7 @@ type ResolvePathOptions = {
737
623
  type Ref = {
738
624
  propertyName: string;
739
625
  originalName: string;
740
- path: OptionalPath;
626
+ path: KubbFile.OptionalPath;
741
627
  pluginKey?: Plugin['key'];
742
628
  };
743
629
  type Refs = Record<string, Ref>;
@@ -817,7 +703,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
817
703
  * Current plugin
818
704
  */
819
705
  plugin: Plugin<TPluginOptions>;
820
- mode: Mode;
706
+ mode: KubbFile.Mode;
821
707
  };
822
708
  declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
823
709
  #private;
@@ -831,7 +717,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
831
717
  method: HttpMethod;
832
718
  operation: Operation$1;
833
719
  }>>;
834
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
720
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
835
721
  }
836
722
  //#endregion
837
723
  //#region ../plugin-oas/src/SchemaMapper.d.ts
@@ -947,7 +833,7 @@ type SchemaKeywordMapper = {
947
833
  /**
948
834
  * Full qualified path.
949
835
  */
950
- path: OptionalPath;
836
+ path: KubbFile.OptionalPath;
951
837
  /**
952
838
  * When true `File.Import` will be used.
953
839
  * When false a reference will be used inside the current file.
@@ -1060,7 +946,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
1060
946
  * Current plugin
1061
947
  */
1062
948
  plugin: Plugin<TPluginOptions>;
1063
- mode: Mode;
949
+ mode: KubbFile.Mode;
1064
950
  include?: Array<'schemas' | 'responses' | 'requestBodies'>;
1065
951
  override: Array<Override<TOptions>> | undefined;
1066
952
  contentType?: contentType;
@@ -1108,8 +994,8 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
1108
994
  static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1109
995
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1110
996
  static combineObjects(tree: Schema[] | undefined): Schema[];
1111
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File<TFileMeta>>>;
997
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
1112
998
  }
1113
999
  //#endregion
1114
- export { ResolvePathOptions as a, Oas as c, Output as d, PluginFactoryOptions as f, File as h, 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 };
1115
- //# sourceMappingURL=SchemaGenerator-C1vgcKII.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-Bu2D8QtI.d.cts.map
@@ -1,5 +1,5 @@
1
1
  import { Fabric, FileManager } from "@kubb/react-fabric";
2
- import { KubbNode } from "@kubb/react-fabric/types";
2
+ import { KubbFile } from "@kubb/fabric-core/types";
3
3
  import { ConsolaInstance, LogLevel } from "consola";
4
4
  import * as OasTypes from "oas/types";
5
5
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
@@ -7,122 +7,8 @@ import { Operation, Operation as Operation$1 } from "oas/operation";
7
7
  import { OpenAPIV3 } from "openapi-types";
8
8
  import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
9
9
  import BaseOas from "oas";
10
+ import { KubbNode } from "@kubb/react-fabric/types";
10
11
 
11
- //#region ../core/src/fs/types.d.ts
12
- type BasePath<T extends string = string> = `${T}/`;
13
- type Import = {
14
- /**
15
- * Import name to be used
16
- * @example ["useState"]
17
- * @example "React"
18
- */
19
- name: string | Array<string | {
20
- propertyName: string;
21
- name?: string;
22
- }>;
23
- /**
24
- * Path for the import
25
- * @example '@kubb/core'
26
- */
27
- path: string;
28
- /**
29
- * Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
30
- */
31
- isTypeOnly?: boolean;
32
- isNameSpace?: boolean;
33
- /**
34
- * When root is set it will get the path with relative getRelativePath(root, path).
35
- */
36
- root?: string;
37
- };
38
- type Source = {
39
- name?: string;
40
- value?: string;
41
- isTypeOnly?: boolean;
42
- /**
43
- * Has const or type 'export'
44
- * @default false
45
- */
46
- isExportable?: boolean;
47
- /**
48
- * When set, barrel generation will add this
49
- * @default false
50
- */
51
- isIndexable?: boolean;
52
- };
53
- type Export = {
54
- /**
55
- * Export name to be used.
56
- * @example ["useState"]
57
- * @example "React"
58
- */
59
- name?: string | Array<string>;
60
- /**
61
- * Path for the import.
62
- * @example '@kubb/core'
63
- */
64
- path: string;
65
- /**
66
- * Add `type` prefix to the export, this will result in: `export type { Type } from './path'`.
67
- */
68
- isTypeOnly?: boolean;
69
- /**
70
- * Make it possible to override the name, this will result in: `export * as aliasName from './path'`.
71
- */
72
- asAlias?: boolean;
73
- };
74
- type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
75
- type Mode = 'single' | 'split';
76
- /**
77
- * Name to be used to dynamicly create the baseName(based on input.path)
78
- * Based on UNIX basename
79
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
80
- */
81
- type BaseName = `${string}.${string}`;
82
- /**
83
- * Path will be full qualified path to a specified file
84
- */
85
- type Path = string;
86
- type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
87
- type OptionalPath = Path | undefined | null;
88
- type File$1<TMeta extends object = object> = {
89
- /**
90
- * Name to be used to create the path
91
- * Based on UNIX basename, `${name}.extname`
92
- * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
93
- */
94
- baseName: BaseName;
95
- /**
96
- * Path will be full qualified path to a specified file
97
- */
98
- path: AdvancedPath<BaseName> | Path;
99
- sources: Array<Source>;
100
- imports?: Array<Import>;
101
- exports?: Array<Export>;
102
- /**
103
- * Use extra meta, this is getting used to generate the barrel/index files.
104
- */
105
- meta?: TMeta;
106
- banner?: string;
107
- footer?: string;
108
- };
109
- type ResolvedImport = Import;
110
- type ResolvedExport = Export;
111
- type ResolvedFile<TMeta extends object = object> = File$1<TMeta> & {
112
- /**
113
- * @default object-hash
114
- */
115
- id: string;
116
- /**
117
- * Contains the first part of the baseName, generated based on baseName
118
- * @link https://nodejs.org/api/path.html#pathformatpathobject
119
- */
120
- name: string;
121
- extname: Extname;
122
- imports: Array<ResolvedImport>;
123
- exports: Array<ResolvedExport>;
124
- };
125
- //#endregion
126
12
  //#region ../core/src/BaseGenerator.d.ts
127
13
  /**
128
14
  * Abstract class that contains the building blocks for plugins to create their own Generator
@@ -260,7 +146,7 @@ type Config<TInput = Input> = {
260
146
  * Override the extension to the generated imports and exports, by default each plugin will add an extension
261
147
  * @default { '.ts': '.ts'}
262
148
  */
263
- extension?: Record<Extname, Extname | ''>;
149
+ extension?: Record<KubbFile.Extname, KubbFile.Extname | ''>;
264
150
  /**
265
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`.
266
152
  * @default 'named'
@@ -391,7 +277,7 @@ type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOption
391
277
  * @type hookFirst
392
278
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
393
279
  */
394
- resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
280
+ resolvePath?: (this: PluginContext<TOptions>, baseName: KubbFile.BaseName, mode?: KubbFile.Mode, options?: TOptions['resolvePathOptions']) => KubbFile.OptionalPath;
395
281
  /**
396
282
  * Resolve to a name based on a string.
397
283
  * Useful when converting to PascalCase or camelCase.
@@ -409,8 +295,8 @@ type PluginLifecycleHooks = keyof PluginLifecycle;
409
295
  type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
410
296
  type ResolvePathParams<TOptions = object> = {
411
297
  pluginKey?: Plugin['key'];
412
- baseName: BaseName;
413
- mode?: Mode;
298
+ baseName: KubbFile.BaseName;
299
+ mode?: KubbFile.Mode;
414
300
  /**
415
301
  * Options to be passed to 'resolvePath' 3th parameter
416
302
  */
@@ -435,8 +321,8 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
435
321
  */
436
322
  fileManager: FileManager;
437
323
  pluginManager: PluginManager;
438
- addFile: (...file: Array<File$1>) => Promise<Array<ResolvedFile>>;
439
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
324
+ addFile: (...file: Array<KubbFile.File>) => Promise<Array<KubbFile.ResolvedFile>>;
325
+ resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => KubbFile.OptionalPath;
440
326
  resolveName: (params: ResolveNameParams) => string;
441
327
  logger: Logger;
442
328
  /**
@@ -515,8 +401,8 @@ type Events = {
515
401
  };
516
402
  type GetFileProps<TOptions = object> = {
517
403
  name: string;
518
- mode?: Mode;
519
- extname: Extname;
404
+ mode?: KubbFile.Mode;
405
+ extname: KubbFile.Extname;
520
406
  pluginKey: Plugin['key'];
521
407
  options?: TOptions;
522
408
  };
@@ -535,10 +421,10 @@ declare class PluginManager {
535
421
  extname,
536
422
  pluginKey,
537
423
  options
538
- }: GetFileProps<TOptions>): File$1<{
424
+ }: GetFileProps<TOptions>): KubbFile.File<{
539
425
  pluginKey: Plugin['key'];
540
426
  }>;
541
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
427
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
542
428
  resolveName: (params: ResolveNameParams) => string;
543
429
  /**
544
430
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
@@ -711,9 +597,9 @@ type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions>
711
597
  type CoreGenerator<TOptions extends PluginFactoryOptions> = {
712
598
  name: string;
713
599
  type: 'core';
714
- operations: (props: OperationsProps<TOptions>) => Promise<File$1[]>;
715
- operation: (props: OperationProps<TOptions>) => Promise<File$1[]>;
716
- schema: (props: SchemaProps$1<TOptions>) => Promise<File$1[]>;
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[]>;
717
603
  };
718
604
  //#endregion
719
605
  //#region ../plugin-oas/src/types.d.ts
@@ -737,7 +623,7 @@ type ResolvePathOptions = {
737
623
  type Ref = {
738
624
  propertyName: string;
739
625
  originalName: string;
740
- path: OptionalPath;
626
+ path: KubbFile.OptionalPath;
741
627
  pluginKey?: Plugin['key'];
742
628
  };
743
629
  type Refs = Record<string, Ref>;
@@ -817,7 +703,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
817
703
  * Current plugin
818
704
  */
819
705
  plugin: Plugin<TPluginOptions>;
820
- mode: Mode;
706
+ mode: KubbFile.Mode;
821
707
  };
822
708
  declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
823
709
  #private;
@@ -831,7 +717,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
831
717
  method: HttpMethod;
832
718
  operation: Operation$1;
833
719
  }>>;
834
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File$1<TFileMeta>>>;
720
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
835
721
  }
836
722
  //#endregion
837
723
  //#region ../plugin-oas/src/SchemaMapper.d.ts
@@ -947,7 +833,7 @@ type SchemaKeywordMapper = {
947
833
  /**
948
834
  * Full qualified path.
949
835
  */
950
- path: OptionalPath;
836
+ path: KubbFile.OptionalPath;
951
837
  /**
952
838
  * When true `File.Import` will be used.
953
839
  * When false a reference will be used inside the current file.
@@ -1060,7 +946,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
1060
946
  * Current plugin
1061
947
  */
1062
948
  plugin: Plugin<TPluginOptions>;
1063
- mode: Mode;
949
+ mode: KubbFile.Mode;
1064
950
  include?: Array<'schemas' | 'responses' | 'requestBodies'>;
1065
951
  override: Array<Override<TOptions>> | undefined;
1066
952
  contentType?: contentType;
@@ -1108,8 +994,8 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
1108
994
  static findInObject<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1109
995
  static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
1110
996
  static combineObjects(tree: Schema[] | undefined): Schema[];
1111
- build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<File$1<TFileMeta>>>;
997
+ build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
1112
998
  }
1113
999
  //#endregion
1114
- export { ResolvePathOptions as a, Oas as c, Output as d, PluginFactoryOptions as f, File$1 as h, 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 };
1115
- //# sourceMappingURL=SchemaGenerator-wXj7HtlS.d.ts.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
@@ -1 +1 @@
1
- {"version":3,"file":"Server-DMDo69md.js","names":[],"sources":["../src/components/Server.tsx"],"sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { isNullable, isReference } from '@kubb/oas'\nimport { camelCase } from '@kubb/core/transformers'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\n operations: Array<{\n tool: {\n name: string\n description: string\n }\n mcp: {\n name: string\n file: KubbFile.File\n }\n zod: {\n name: string\n file: KubbFile.File\n schemas: OperationSchemas\n }\n type: {\n schemas: OperationSchemas\n }\n }>\n}\n\ntype GetParamsProps = {\n schemas: OperationSchemas\n}\n\nfunction getParams({ schemas }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\n })\n\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...Object.entries(pathParams).reduce((acc, [key, param]) => {\n if (param && schemas.pathParams?.name) {\n let suffix = '.shape'\n\n if (isNullable(schemas.pathParams.schema)) {\n if (isReference(schemas.pathParams)) {\n suffix = '.unwrap().schema.unwrap().shape'\n } else {\n suffix = '.unwrap().shape'\n }\n } else {\n if (isReference(schemas.pathParams)) {\n suffix = '.schema.shape'\n }\n }\n\n param.value = `${schemas.pathParams?.name}${suffix}['${key}']`\n }\n\n return {\n ...acc,\n [camelCase(key)]: param,\n }\n }, {}),\n data: schemas.request?.name\n ? {\n value: schemas.request?.name,\n optional: isOptional(schemas.request?.schema),\n }\n : undefined,\n params: schemas.queryParams?.name\n ? {\n value: schemas.queryParams?.name,\n optional: isOptional(schemas.queryParams?.schema),\n }\n : undefined,\n headers: schemas.headerParams?.name\n ? {\n value: schemas.headerParams?.name,\n optional: isOptional(schemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n })\n}\n\nexport function Server({ name, serverName, serverVersion, operations }: Props): KubbNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod }) => {\n const paramsClient = getParams({ schemas: zod.schemas })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nasync function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n\nstartServer()\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAqCA,SAAS,UAAU,EAAE,WAA2B;CAC9C,MAAM,aAAa,cAAc,QAAQ,YAAY,EACnD,OAAO,OACR,CAAC;AAEF,QAAO,eAAe,QAAQ,EAC5B,MAAM;EACJ,MAAM;EACN,UAAU;GACR,GAAG,OAAO,QAAQ,WAAW,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;AAC1D,QAAI,SAAS,QAAQ,YAAY,MAAM;KACrC,IAAI,SAAS;AAEb,SAAI,WAAW,QAAQ,WAAW,OAAO,CACvC,KAAI,YAAY,QAAQ,WAAW,CACjC,UAAS;SAET,UAAS;cAGP,YAAY,QAAQ,WAAW,CACjC,UAAS;AAIb,WAAM,QAAQ,GAAG,QAAQ,YAAY,OAAO,OAAO,IAAI,IAAI;;AAG7D,WAAO;KACL,GAAG;MACF,UAAU,IAAI,GAAG;KACnB;MACA,EAAE,CAAC;GACN,MAAM,QAAQ,SAAS,OACnB;IACE,OAAO,QAAQ,SAAS;IACxB,UAAU,WAAW,QAAQ,SAAS,OAAO;IAC9C,GACD;GACJ,QAAQ,QAAQ,aAAa,OACzB;IACE,OAAO,QAAQ,aAAa;IAC5B,UAAU,WAAW,QAAQ,aAAa,OAAO;IAClD,GACD;GACJ,SAAS,QAAQ,cAAc,OAC3B;IACE,OAAO,QAAQ,cAAc;IAC7B,UAAU,WAAW,QAAQ,cAAc,OAAO;IACnD,GACD;GACL;EACF,EACF,CAAC;;AAGJ,SAAgB,OAAO,EAAE,MAAM,YAAY,eAAe,cAA+B;AACvF,QACE,qBAAC,KAAK;EAAa;EAAM;EAAa;;GACpC,oBAAC;IAAM,MAAM;IAAU;cACpB;;WAEE,WAAW;cACR,cAAc;;;KAGd;GAEP,WACE,KAAK,EAAE,MAAM,KAAK,UAAU;IAC3B,MAAM,eAAe,UAAU,EAAE,SAAS,IAAI,SAAS,CAAC;AAExD,QAAI,IAAI,QAAQ,SAAS,QAAQ,IAAI,QAAQ,cAAc,QAAQ,IAAI,QAAQ,aAAa,QAAQ,IAAI,QAAQ,YAAY,KAC1H,QAAO;cACL,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC,IAAI,aAAa,eAAe,CAAC,WAAW,aAAa,UAAU,CAAC;WACtI,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;AAKrC,WAAO;cACH,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC;WAClE,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;KAGrC,CACD,OAAO,QAAQ;GAEjB;;;;;;;;;;;;;;;GAcW"}
1
+ {"version":3,"file":"Server-DMDo69md.js","names":[],"sources":["../src/components/Server.tsx"],"sourcesContent":["import { camelCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { isNullable, isReference } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\n operations: Array<{\n tool: {\n name: string\n description: string\n }\n mcp: {\n name: string\n file: KubbFile.File\n }\n zod: {\n name: string\n file: KubbFile.File\n schemas: OperationSchemas\n }\n type: {\n schemas: OperationSchemas\n }\n }>\n}\n\ntype GetParamsProps = {\n schemas: OperationSchemas\n}\n\nfunction getParams({ schemas }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\n })\n\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...Object.entries(pathParams).reduce((acc, [key, param]) => {\n if (param && schemas.pathParams?.name) {\n let suffix = '.shape'\n\n if (isNullable(schemas.pathParams.schema)) {\n if (isReference(schemas.pathParams)) {\n suffix = '.unwrap().schema.unwrap().shape'\n } else {\n suffix = '.unwrap().shape'\n }\n } else {\n if (isReference(schemas.pathParams)) {\n suffix = '.schema.shape'\n }\n }\n\n param.value = `${schemas.pathParams?.name}${suffix}['${key}']`\n }\n\n return {\n ...acc,\n [camelCase(key)]: param,\n }\n }, {}),\n data: schemas.request?.name\n ? {\n value: schemas.request?.name,\n optional: isOptional(schemas.request?.schema),\n }\n : undefined,\n params: schemas.queryParams?.name\n ? {\n value: schemas.queryParams?.name,\n optional: isOptional(schemas.queryParams?.schema),\n }\n : undefined,\n headers: schemas.headerParams?.name\n ? {\n value: schemas.headerParams?.name,\n optional: isOptional(schemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n })\n}\n\nexport function Server({ name, serverName, serverVersion, operations }: Props): KubbNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod }) => {\n const paramsClient = getParams({ schemas: zod.schemas })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nasync function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n\nstartServer()\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAoCA,SAAS,UAAU,EAAE,WAA2B;CAC9C,MAAM,aAAa,cAAc,QAAQ,YAAY,EACnD,OAAO,OACR,CAAC;AAEF,QAAO,eAAe,QAAQ,EAC5B,MAAM;EACJ,MAAM;EACN,UAAU;GACR,GAAG,OAAO,QAAQ,WAAW,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;AAC1D,QAAI,SAAS,QAAQ,YAAY,MAAM;KACrC,IAAI,SAAS;AAEb,SAAI,WAAW,QAAQ,WAAW,OAAO,CACvC,KAAI,YAAY,QAAQ,WAAW,CACjC,UAAS;SAET,UAAS;cAGP,YAAY,QAAQ,WAAW,CACjC,UAAS;AAIb,WAAM,QAAQ,GAAG,QAAQ,YAAY,OAAO,OAAO,IAAI,IAAI;;AAG7D,WAAO;KACL,GAAG;MACF,UAAU,IAAI,GAAG;KACnB;MACA,EAAE,CAAC;GACN,MAAM,QAAQ,SAAS,OACnB;IACE,OAAO,QAAQ,SAAS;IACxB,UAAU,WAAW,QAAQ,SAAS,OAAO;IAC9C,GACD;GACJ,QAAQ,QAAQ,aAAa,OACzB;IACE,OAAO,QAAQ,aAAa;IAC5B,UAAU,WAAW,QAAQ,aAAa,OAAO;IAClD,GACD;GACJ,SAAS,QAAQ,cAAc,OAC3B;IACE,OAAO,QAAQ,cAAc;IAC7B,UAAU,WAAW,QAAQ,cAAc,OAAO;IACnD,GACD;GACL;EACF,EACF,CAAC;;AAGJ,SAAgB,OAAO,EAAE,MAAM,YAAY,eAAe,cAA+B;AACvF,QACE,qBAAC,KAAK;EAAa;EAAM;EAAa;;GACpC,oBAAC;IAAM,MAAM;IAAU;cACpB;;WAEE,WAAW;cACR,cAAc;;;KAGd;GAEP,WACE,KAAK,EAAE,MAAM,KAAK,UAAU;IAC3B,MAAM,eAAe,UAAU,EAAE,SAAS,IAAI,SAAS,CAAC;AAExD,QAAI,IAAI,QAAQ,SAAS,QAAQ,IAAI,QAAQ,cAAc,QAAQ,IAAI,QAAQ,aAAa,QAAQ,IAAI,QAAQ,YAAY,KAC1H,QAAO;cACL,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC,IAAI,aAAa,eAAe,CAAC,WAAW,aAAa,UAAU,CAAC;WACtI,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;AAKrC,WAAO;cACH,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC;WAClE,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;KAGrC,CACD,OAAO,QAAQ;GAEjB;;;;;;;;;;;;;;;GAcW"}
@@ -1 +1 @@
1
- {"version":3,"file":"Server-vKCXRjmg.cjs","names":["FunctionParams","File","Const"],"sources":["../src/components/Server.tsx"],"sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { isNullable, isReference } from '@kubb/oas'\nimport { camelCase } from '@kubb/core/transformers'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\n operations: Array<{\n tool: {\n name: string\n description: string\n }\n mcp: {\n name: string\n file: KubbFile.File\n }\n zod: {\n name: string\n file: KubbFile.File\n schemas: OperationSchemas\n }\n type: {\n schemas: OperationSchemas\n }\n }>\n}\n\ntype GetParamsProps = {\n schemas: OperationSchemas\n}\n\nfunction getParams({ schemas }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\n })\n\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...Object.entries(pathParams).reduce((acc, [key, param]) => {\n if (param && schemas.pathParams?.name) {\n let suffix = '.shape'\n\n if (isNullable(schemas.pathParams.schema)) {\n if (isReference(schemas.pathParams)) {\n suffix = '.unwrap().schema.unwrap().shape'\n } else {\n suffix = '.unwrap().shape'\n }\n } else {\n if (isReference(schemas.pathParams)) {\n suffix = '.schema.shape'\n }\n }\n\n param.value = `${schemas.pathParams?.name}${suffix}['${key}']`\n }\n\n return {\n ...acc,\n [camelCase(key)]: param,\n }\n }, {}),\n data: schemas.request?.name\n ? {\n value: schemas.request?.name,\n optional: isOptional(schemas.request?.schema),\n }\n : undefined,\n params: schemas.queryParams?.name\n ? {\n value: schemas.queryParams?.name,\n optional: isOptional(schemas.queryParams?.schema),\n }\n : undefined,\n headers: schemas.headerParams?.name\n ? {\n value: schemas.headerParams?.name,\n optional: isOptional(schemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n })\n}\n\nexport function Server({ name, serverName, serverVersion, operations }: Props): KubbNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod }) => {\n const paramsClient = getParams({ schemas: zod.schemas })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nasync function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n\nstartServer()\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAS,UAAU,EAAE,WAA2B;CAC9C,MAAM,wDAA2B,QAAQ,YAAY,EACnD,OAAO,OACR,CAAC;AAEF,QAAOA,mCAAe,QAAQ,EAC5B,MAAM;EACJ,MAAM;EACN,UAAU;GACR,GAAG,OAAO,QAAQ,WAAW,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;AAC1D,QAAI,SAAS,QAAQ,YAAY,MAAM;KACrC,IAAI,SAAS;AAEb,oCAAe,QAAQ,WAAW,OAAO,CACvC,iCAAgB,QAAQ,WAAW,CACjC,UAAS;SAET,UAAS;0CAGK,QAAQ,WAAW,CACjC,UAAS;AAIb,WAAM,QAAQ,GAAG,QAAQ,YAAY,OAAO,OAAO,IAAI,IAAI;;AAG7D,WAAO;KACL,GAAG;8CACQ,IAAI,GAAG;KACnB;MACA,EAAE,CAAC;GACN,MAAM,QAAQ,SAAS,OACnB;IACE,OAAO,QAAQ,SAAS;IACxB,kDAAqB,QAAQ,SAAS,OAAO;IAC9C,GACD;GACJ,QAAQ,QAAQ,aAAa,OACzB;IACE,OAAO,QAAQ,aAAa;IAC5B,kDAAqB,QAAQ,aAAa,OAAO;IAClD,GACD;GACJ,SAAS,QAAQ,cAAc,OAC3B;IACE,OAAO,QAAQ,cAAc;IAC7B,kDAAqB,QAAQ,cAAc,OAAO;IACnD,GACD;GACL;EACF,EACF,CAAC;;AAGJ,SAAgB,OAAO,EAAE,MAAM,YAAY,eAAe,cAA+B;AACvF,QACE,0DAACC,yBAAK;EAAa;EAAM;EAAa;;GACpC,yDAACC;IAAM,MAAM;IAAU;cACpB;;WAEE,WAAW;cACR,cAAc;;;KAGd;GAEP,WACE,KAAK,EAAE,MAAM,KAAK,UAAU;IAC3B,MAAM,eAAe,UAAU,EAAE,SAAS,IAAI,SAAS,CAAC;AAExD,QAAI,IAAI,QAAQ,SAAS,QAAQ,IAAI,QAAQ,cAAc,QAAQ,IAAI,QAAQ,aAAa,QAAQ,IAAI,QAAQ,YAAY,KAC1H,QAAO;cACL,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC,IAAI,aAAa,eAAe,CAAC,WAAW,aAAa,UAAU,CAAC;WACtI,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;AAKrC,WAAO;cACH,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC;WAClE,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;KAGrC,CACD,OAAO,QAAQ;GAEjB;;;;;;;;;;;;;;;GAcW"}
1
+ {"version":3,"file":"Server-vKCXRjmg.cjs","names":["FunctionParams","File","Const"],"sources":["../src/components/Server.tsx"],"sourcesContent":["import { camelCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { isNullable, isReference } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\n operations: Array<{\n tool: {\n name: string\n description: string\n }\n mcp: {\n name: string\n file: KubbFile.File\n }\n zod: {\n name: string\n file: KubbFile.File\n schemas: OperationSchemas\n }\n type: {\n schemas: OperationSchemas\n }\n }>\n}\n\ntype GetParamsProps = {\n schemas: OperationSchemas\n}\n\nfunction getParams({ schemas }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\n })\n\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...Object.entries(pathParams).reduce((acc, [key, param]) => {\n if (param && schemas.pathParams?.name) {\n let suffix = '.shape'\n\n if (isNullable(schemas.pathParams.schema)) {\n if (isReference(schemas.pathParams)) {\n suffix = '.unwrap().schema.unwrap().shape'\n } else {\n suffix = '.unwrap().shape'\n }\n } else {\n if (isReference(schemas.pathParams)) {\n suffix = '.schema.shape'\n }\n }\n\n param.value = `${schemas.pathParams?.name}${suffix}['${key}']`\n }\n\n return {\n ...acc,\n [camelCase(key)]: param,\n }\n }, {}),\n data: schemas.request?.name\n ? {\n value: schemas.request?.name,\n optional: isOptional(schemas.request?.schema),\n }\n : undefined,\n params: schemas.queryParams?.name\n ? {\n value: schemas.queryParams?.name,\n optional: isOptional(schemas.queryParams?.schema),\n }\n : undefined,\n headers: schemas.headerParams?.name\n ? {\n value: schemas.headerParams?.name,\n optional: isOptional(schemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n })\n}\n\nexport function Server({ name, serverName, serverVersion, operations }: Props): KubbNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod }) => {\n const paramsClient = getParams({ schemas: zod.schemas })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nasync function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n\nstartServer()\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAS,UAAU,EAAE,WAA2B;CAC9C,MAAM,wDAA2B,QAAQ,YAAY,EACnD,OAAO,OACR,CAAC;AAEF,QAAOA,mCAAe,QAAQ,EAC5B,MAAM;EACJ,MAAM;EACN,UAAU;GACR,GAAG,OAAO,QAAQ,WAAW,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;AAC1D,QAAI,SAAS,QAAQ,YAAY,MAAM;KACrC,IAAI,SAAS;AAEb,oCAAe,QAAQ,WAAW,OAAO,CACvC,iCAAgB,QAAQ,WAAW,CACjC,UAAS;SAET,UAAS;0CAGK,QAAQ,WAAW,CACjC,UAAS;AAIb,WAAM,QAAQ,GAAG,QAAQ,YAAY,OAAO,OAAO,IAAI,IAAI;;AAG7D,WAAO;KACL,GAAG;8CACQ,IAAI,GAAG;KACnB;MACA,EAAE,CAAC;GACN,MAAM,QAAQ,SAAS,OACnB;IACE,OAAO,QAAQ,SAAS;IACxB,kDAAqB,QAAQ,SAAS,OAAO;IAC9C,GACD;GACJ,QAAQ,QAAQ,aAAa,OACzB;IACE,OAAO,QAAQ,aAAa;IAC5B,kDAAqB,QAAQ,aAAa,OAAO;IAClD,GACD;GACJ,SAAS,QAAQ,cAAc,OAC3B;IACE,OAAO,QAAQ,cAAc;IAC7B,kDAAqB,QAAQ,cAAc,OAAO;IACnD,GACD;GACL;EACF,EACF,CAAC;;AAGJ,SAAgB,OAAO,EAAE,MAAM,YAAY,eAAe,cAA+B;AACvF,QACE,0DAACC,yBAAK;EAAa;EAAM;EAAa;;GACpC,yDAACC;IAAM,MAAM;IAAU;cACpB;;WAEE,WAAW;cACR,cAAc;;;KAGd;GAEP,WACE,KAAK,EAAE,MAAM,KAAK,UAAU;IAC3B,MAAM,eAAe,UAAU,EAAE,SAAS,IAAI,SAAS,CAAC;AAExD,QAAI,IAAI,QAAQ,SAAS,QAAQ,IAAI,QAAQ,cAAc,QAAQ,IAAI,QAAQ,aAAa,QAAQ,IAAI,QAAQ,YAAY,KAC1H,QAAO;cACL,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC,IAAI,aAAa,eAAe,CAAC,WAAW,aAAa,UAAU,CAAC;WACtI,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;AAKrC,WAAO;cACH,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC;WAClE,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;KAGrC,CACD,OAAO,QAAQ;GAEjB;;;;;;;;;;;;;;;GAcW"}
@@ -1,4 +1,5 @@
1
- import { h as File, r as OperationSchemas } from "./SchemaGenerator-C1vgcKII.cjs";
1
+ import { r as OperationSchemas } from "./SchemaGenerator-Bu2D8QtI.cjs";
2
+ import { KubbFile } from "@kubb/fabric-core/types";
2
3
  import { KubbNode } from "@kubb/react-fabric/types";
3
4
 
4
5
  //#region src/components/Server.d.ts
@@ -13,11 +14,11 @@ type Props = {
13
14
  };
14
15
  mcp: {
15
16
  name: string;
16
- file: File;
17
+ file: KubbFile.File;
17
18
  };
18
19
  zod: {
19
20
  name: string;
20
- file: File;
21
+ file: KubbFile.File;
21
22
  schemas: OperationSchemas;
22
23
  };
23
24
  type: {
@@ -1,4 +1,5 @@
1
- import { h as File, r as OperationSchemas } from "./SchemaGenerator-wXj7HtlS.js";
1
+ import { r as OperationSchemas } from "./SchemaGenerator-geilI4rJ.js";
2
+ import { KubbFile } from "@kubb/fabric-core/types";
2
3
  import { KubbNode } from "@kubb/react-fabric/types";
3
4
 
4
5
  //#region src/components/Server.d.ts
@@ -13,11 +14,11 @@ type Props = {
13
14
  };
14
15
  mcp: {
15
16
  name: string;
16
- file: File;
17
+ file: KubbFile.File;
17
18
  };
18
19
  zod: {
19
20
  name: string;
20
- file: File;
21
+ file: KubbFile.File;
21
22
  schemas: OperationSchemas;
22
23
  };
23
24
  type: {
@@ -1,5 +1,5 @@
1
- import { s as ReactGenerator } from "./SchemaGenerator-C1vgcKII.cjs";
2
- import { n as PluginMcp } from "./types-3zb5y21F.cjs";
1
+ import { s as ReactGenerator } from "./SchemaGenerator-Bu2D8QtI.cjs";
2
+ import { n as PluginMcp } from "./types-BPcoHHAu.cjs";
3
3
 
4
4
  //#region src/generators/mcpGenerator.d.ts
5
5
  declare const mcpGenerator: ReactGenerator<PluginMcp>;
@@ -1,5 +1,5 @@
1
- import { s as ReactGenerator } from "./SchemaGenerator-wXj7HtlS.js";
2
- import { n as PluginMcp } from "./types-b6nPxXzv.js";
1
+ import { s as ReactGenerator } from "./SchemaGenerator-geilI4rJ.js";
2
+ import { n as PluginMcp } from "./types-DXH0aZQO.js";
3
3
 
4
4
  //#region src/generators/mcpGenerator.d.ts
5
5
  declare const mcpGenerator: ReactGenerator<PluginMcp>;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { m as UserPluginWithLifeCycle } from "./SchemaGenerator-C1vgcKII.cjs";
2
- import { n as PluginMcp, t as Options } from "./types-3zb5y21F.cjs";
1
+ import { m as UserPluginWithLifeCycle } from "./SchemaGenerator-Bu2D8QtI.cjs";
2
+ import { n as PluginMcp, t as Options } from "./types-BPcoHHAu.cjs";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginMcpName = "plugin-mcp";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { m as UserPluginWithLifeCycle } from "./SchemaGenerator-wXj7HtlS.js";
2
- import { n as PluginMcp, t as Options } from "./types-b6nPxXzv.js";
1
+ import { m as UserPluginWithLifeCycle } from "./SchemaGenerator-geilI4rJ.js";
2
+ import { n as PluginMcp, t as Options } from "./types-DXH0aZQO.js";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginMcpName = "plugin-mcp";
@@ -1,4 +1,4 @@
1
- import { a as ResolvePathOptions, c as Oas, d as Output, f as PluginFactoryOptions, i as Override, l as contentType, n as Include, o as Generator, p as ResolveNameParams, t as Exclude, u as Group } from "./SchemaGenerator-C1vgcKII.cjs";
1
+ import { a as ResolvePathOptions, c as Oas, d as Output, f as PluginFactoryOptions, i as Override, l as contentType, n as Include, o as Generator, p as ResolveNameParams, t as Exclude, u as Group } from "./SchemaGenerator-Bu2D8QtI.cjs";
2
2
 
3
3
  //#region ../plugin-client/src/types.d.ts
4
4
  type Options$1 = {
@@ -165,4 +165,4 @@ type ResolvedOptions = {
165
165
  type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
166
166
  //#endregion
167
167
  export { PluginMcp as n, Options as t };
168
- //# sourceMappingURL=types-3zb5y21F.d.cts.map
168
+ //# sourceMappingURL=types-BPcoHHAu.d.cts.map
@@ -1,4 +1,4 @@
1
- import { a as ResolvePathOptions, c as Oas, d as Output, f as PluginFactoryOptions, i as Override, l as contentType, n as Include, o as Generator, p as ResolveNameParams, t as Exclude, u as Group } from "./SchemaGenerator-wXj7HtlS.js";
1
+ import { a as ResolvePathOptions, c as Oas, d as Output, f as PluginFactoryOptions, i as Override, l as contentType, n as Include, o as Generator, p as ResolveNameParams, t as Exclude, u as Group } from "./SchemaGenerator-geilI4rJ.js";
2
2
 
3
3
  //#region ../plugin-client/src/types.d.ts
4
4
  type Options$1 = {
@@ -165,4 +165,4 @@ type ResolvedOptions = {
165
165
  type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
166
166
  //#endregion
167
167
  export { PluginMcp as n, Options as t };
168
- //# sourceMappingURL=types-b6nPxXzv.d.ts.map
168
+ //# sourceMappingURL=types-DXH0aZQO.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-mcp",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "description": "Generator mcp",
5
5
  "keywords": [
6
6
  "typescript",
@@ -61,21 +61,25 @@
61
61
  "!/**/**.test.**",
62
62
  "!/**/__tests__/**"
63
63
  ],
64
+ "size-limit": [
65
+ {
66
+ "path": "./dist/*.js",
67
+ "limit": "510 KiB",
68
+ "gzip": true
69
+ }
70
+ ],
64
71
  "dependencies": {
65
- "@kubb/react-fabric": "0.2.8",
66
- "@kubb/core": "4.4.0",
67
- "@kubb/oas": "4.4.0",
68
- "@kubb/plugin-client": "4.4.0",
69
- "@kubb/plugin-oas": "4.4.0",
70
- "@kubb/plugin-ts": "4.4.0",
71
- "@kubb/plugin-zod": "4.4.0"
72
- },
73
- "devDependencies": {
74
- "tsdown": "^0.15.11",
75
- "typescript": "^5.9.3"
72
+ "@kubb/react-fabric": "0.2.10",
73
+ "@kubb/core": "4.4.1",
74
+ "@kubb/oas": "4.4.1",
75
+ "@kubb/plugin-client": "4.4.1",
76
+ "@kubb/plugin-oas": "4.4.1",
77
+ "@kubb/plugin-ts": "4.4.1",
78
+ "@kubb/plugin-zod": "4.4.1"
76
79
  },
80
+ "devDependencies": {},
77
81
  "peerDependencies": {
78
- "@kubb/react-fabric": "0.2.8"
82
+ "@kubb/react-fabric": "0.2.10"
79
83
  },
80
84
  "engines": {
81
85
  "node": ">=20"
@@ -85,7 +89,7 @@
85
89
  "registry": "https://registry.npmjs.org/"
86
90
  },
87
91
  "scripts": {
88
- "build": "tsdown",
92
+ "build": "tsdown && size-limit",
89
93
  "clean": "npx rimraf ./dist",
90
94
  "lint": "bun biome lint .",
91
95
  "lint:fix": "bun biome lint --fix --unsafe .",
@@ -1,11 +1,10 @@
1
- import type { KubbFile } from '@kubb/core/fs'
2
- import type { KubbNode } from '@kubb/react-fabric/types'
3
-
4
- import { Const, File, FunctionParams } from '@kubb/react-fabric'
1
+ import { camelCase } from '@kubb/core/transformers'
2
+ import type { KubbFile } from '@kubb/fabric-core/types'
3
+ import { isNullable, isReference } from '@kubb/oas'
5
4
  import type { OperationSchemas } from '@kubb/plugin-oas'
6
5
  import { getPathParams, isOptional } from '@kubb/plugin-oas/utils'
7
- import { isNullable, isReference } from '@kubb/oas'
8
- import { camelCase } from '@kubb/core/transformers'
6
+ import { Const, File, FunctionParams } from '@kubb/react-fabric'
7
+ import type { KubbNode } from '@kubb/react-fabric/types'
9
8
 
10
9
  type Props = {
11
10
  name: string