@kubb/plugin-mcp 4.20.3 → 4.21.0
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.
- package/dist/{Server-DblKyNZ0.cjs → Server-9nmuwHl0.cjs} +12 -7
- package/dist/Server-9nmuwHl0.cjs.map +1 -0
- package/dist/{Server-BolLh_dK.js → Server-BCjV50o7.js} +12 -7
- package/dist/Server-BCjV50o7.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +3 -1
- package/dist/components.d.ts +3 -1
- package/dist/components.js +1 -1
- package/dist/{generators-4PG9gQkq.js → generators-CrC1R2wh.js} +4 -3
- package/dist/generators-CrC1R2wh.js.map +1 -0
- package/dist/{generators-dnrz3jPX.cjs → generators-DOGoAPGT.cjs} +4 -3
- package/dist/generators-DOGoAPGT.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +1 -1
- package/dist/index-DNBGPN7Z.d.ts +548 -0
- package/dist/index-RsNfvceH.d.cts +549 -0
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/{types-BpFIHuV_.d.ts → types-BtFvu11q.d.ts} +14 -4
- package/dist/{types-1i7hEdhc.d.cts → types-Bw-588-z.d.cts} +14 -5
- package/package.json +8 -8
- package/src/components/Server.tsx +7 -5
- package/src/generators/mcpGenerator.tsx +1 -1
- package/src/generators/serverGenerator.tsx +7 -1
- package/src/plugin.ts +2 -0
- package/src/types.ts +9 -1
- package/dist/Server-BolLh_dK.js.map +0 -1
- package/dist/Server-DblKyNZ0.cjs.map +0 -1
- package/dist/generators-4PG9gQkq.js.map +0 -1
- package/dist/generators-dnrz3jPX.cjs.map +0 -1
- package/dist/index-CGe1JmIp.d.cts +0 -1208
- package/dist/index-D9FArzes.d.ts +0 -1207
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
import { KubbFile } from "@kubb/fabric-core/types";
|
|
2
|
+
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
3
|
+
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
4
|
+
import BaseOas from "oas";
|
|
5
|
+
import { Operation } from "oas/operation";
|
|
6
|
+
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
7
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
8
|
+
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
9
|
+
|
|
10
|
+
//#region rolldown:runtime
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region ../oas/src/types.d.ts
|
|
13
|
+
type contentType = 'application/json' | (string & {});
|
|
14
|
+
type SchemaObject$1 = SchemaObject & {
|
|
15
|
+
'x-nullable'?: boolean;
|
|
16
|
+
$ref?: string;
|
|
17
|
+
};
|
|
18
|
+
type HttpMethod = HttpMethods;
|
|
19
|
+
type Document = OASDocument;
|
|
20
|
+
type Operation$1 = Operation;
|
|
21
|
+
type DiscriminatorObject$1 = DiscriminatorObject;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region ../oas/src/Oas.d.ts
|
|
24
|
+
type OasOptions = {
|
|
25
|
+
contentType?: contentType;
|
|
26
|
+
discriminator?: 'strict' | 'inherit';
|
|
27
|
+
/**
|
|
28
|
+
* Resolve name collisions when schemas from different components share the same name (case-insensitive).
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
collisionDetection?: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare class Oas extends BaseOas {
|
|
34
|
+
#private;
|
|
35
|
+
document: Document;
|
|
36
|
+
constructor(document: Document);
|
|
37
|
+
setOptions(options: OasOptions): void;
|
|
38
|
+
get options(): OasOptions;
|
|
39
|
+
get<T = unknown>($ref: string): T | null;
|
|
40
|
+
getKey($ref: string): string | undefined;
|
|
41
|
+
set($ref: string, value: unknown): false | undefined;
|
|
42
|
+
getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
|
|
43
|
+
dereferenceWithRef<T = unknown>(schema?: T): T;
|
|
44
|
+
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
45
|
+
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
46
|
+
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
47
|
+
validate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
48
|
+
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
49
|
+
/**
|
|
50
|
+
* Get schemas from OpenAPI components (schemas, responses, requestBodies).
|
|
51
|
+
* Returns schemas in dependency order along with name mapping for collision resolution.
|
|
52
|
+
*/
|
|
53
|
+
getSchemas(options?: {
|
|
54
|
+
contentType?: contentType;
|
|
55
|
+
includes?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
56
|
+
collisionDetection?: boolean;
|
|
57
|
+
}): {
|
|
58
|
+
schemas: Record<string, SchemaObject$1>;
|
|
59
|
+
nameMapping: Map<string, string>;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region ../core/src/utils/AsyncEventEmitter.d.ts
|
|
64
|
+
declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
|
|
65
|
+
#private;
|
|
66
|
+
constructor(maxListener?: number);
|
|
67
|
+
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
|
|
68
|
+
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
69
|
+
onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
|
|
70
|
+
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
71
|
+
removeAll(): void;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region ../core/src/types.d.ts
|
|
75
|
+
declare global {
|
|
76
|
+
namespace Kubb {
|
|
77
|
+
interface PluginContext {}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Config used in `kubb.config.ts`
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* import { defineConfig } from '@kubb/core'
|
|
85
|
+
* export default defineConfig({
|
|
86
|
+
* ...
|
|
87
|
+
* })
|
|
88
|
+
*/
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region ../plugin-oas/src/types.d.ts
|
|
91
|
+
type GetOasOptions = {
|
|
92
|
+
validate?: boolean;
|
|
93
|
+
};
|
|
94
|
+
type Context$2 = {
|
|
95
|
+
getOas(options?: GetOasOptions): Promise<Oas>;
|
|
96
|
+
getBaseURL(): Promise<string | undefined>;
|
|
97
|
+
};
|
|
98
|
+
declare global {
|
|
99
|
+
namespace Kubb {
|
|
100
|
+
interface PluginContext extends Context$2 {}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
type ResolvePathOptions = {
|
|
104
|
+
pluginKey?: Plugin['key'];
|
|
105
|
+
group?: {
|
|
106
|
+
tag?: string;
|
|
107
|
+
path?: string;
|
|
108
|
+
};
|
|
109
|
+
type?: ResolveNameParams['type'];
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* `propertyName` is the ref name + resolved with the nameResolver
|
|
113
|
+
* @example import { Pet } from './Pet'
|
|
114
|
+
*
|
|
115
|
+
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
116
|
+
*
|
|
117
|
+
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
118
|
+
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
119
|
+
*/
|
|
120
|
+
type Ref = {
|
|
121
|
+
propertyName: string;
|
|
122
|
+
originalName: string;
|
|
123
|
+
path: KubbFile.Path;
|
|
124
|
+
pluginKey?: Plugin['key'];
|
|
125
|
+
};
|
|
126
|
+
type Refs = Record<string, Ref>;
|
|
127
|
+
type OperationSchema = {
|
|
128
|
+
/**
|
|
129
|
+
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
130
|
+
*/
|
|
131
|
+
name: string;
|
|
132
|
+
schema: SchemaObject$1;
|
|
133
|
+
operation?: Operation$1;
|
|
134
|
+
/**
|
|
135
|
+
* OperationName in PascalCase, only being used in OperationGenerator
|
|
136
|
+
*/
|
|
137
|
+
operationName: string;
|
|
138
|
+
description?: string;
|
|
139
|
+
statusCode?: number;
|
|
140
|
+
keys?: string[];
|
|
141
|
+
keysToOmit?: string[];
|
|
142
|
+
withData?: boolean;
|
|
143
|
+
};
|
|
144
|
+
type OperationSchemas = {
|
|
145
|
+
pathParams?: OperationSchema & {
|
|
146
|
+
keysToOmit?: never;
|
|
147
|
+
};
|
|
148
|
+
queryParams?: OperationSchema & {
|
|
149
|
+
keysToOmit?: never;
|
|
150
|
+
};
|
|
151
|
+
headerParams?: OperationSchema & {
|
|
152
|
+
keysToOmit?: never;
|
|
153
|
+
};
|
|
154
|
+
request?: OperationSchema;
|
|
155
|
+
response: OperationSchema;
|
|
156
|
+
responses: Array<OperationSchema>;
|
|
157
|
+
statusCodes?: Array<OperationSchema>;
|
|
158
|
+
errors?: Array<OperationSchema>;
|
|
159
|
+
};
|
|
160
|
+
type ByTag = {
|
|
161
|
+
type: 'tag';
|
|
162
|
+
pattern: string | RegExp;
|
|
163
|
+
};
|
|
164
|
+
type ByOperationId = {
|
|
165
|
+
type: 'operationId';
|
|
166
|
+
pattern: string | RegExp;
|
|
167
|
+
};
|
|
168
|
+
type ByPath = {
|
|
169
|
+
type: 'path';
|
|
170
|
+
pattern: string | RegExp;
|
|
171
|
+
};
|
|
172
|
+
type ByMethod = {
|
|
173
|
+
type: 'method';
|
|
174
|
+
pattern: HttpMethod | RegExp;
|
|
175
|
+
};
|
|
176
|
+
type BySchemaName = {
|
|
177
|
+
type: 'schemaName';
|
|
178
|
+
pattern: string | RegExp;
|
|
179
|
+
};
|
|
180
|
+
type ByContentType = {
|
|
181
|
+
type: 'contentType';
|
|
182
|
+
pattern: string | RegExp;
|
|
183
|
+
};
|
|
184
|
+
type Exclude$1 = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
185
|
+
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
186
|
+
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
187
|
+
options: Partial<TOptions>;
|
|
188
|
+
};
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
191
|
+
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
192
|
+
fabric: Fabric;
|
|
193
|
+
oas: Oas;
|
|
194
|
+
exclude: Array<Exclude$1> | undefined;
|
|
195
|
+
include: Array<Include> | undefined;
|
|
196
|
+
override: Array<Override<TOptions>> | undefined;
|
|
197
|
+
contentType: contentType | undefined;
|
|
198
|
+
pluginManager: PluginManager;
|
|
199
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
200
|
+
/**
|
|
201
|
+
* Current plugin
|
|
202
|
+
*/
|
|
203
|
+
plugin: Plugin<TPluginOptions>;
|
|
204
|
+
mode: KubbFile.Mode;
|
|
205
|
+
UNSTABLE_NAMING?: true;
|
|
206
|
+
};
|
|
207
|
+
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
208
|
+
#private;
|
|
209
|
+
getOptions(operation: Operation$1, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
|
|
210
|
+
getSchemas(operation: Operation$1, {
|
|
211
|
+
resolveName
|
|
212
|
+
}?: {
|
|
213
|
+
resolveName?: (name: string) => string;
|
|
214
|
+
}): OperationSchemas;
|
|
215
|
+
getOperations(): Promise<Array<{
|
|
216
|
+
path: string;
|
|
217
|
+
method: HttpMethod;
|
|
218
|
+
operation: Operation$1;
|
|
219
|
+
}>>;
|
|
220
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
224
|
+
type SchemaKeywordMapper = {
|
|
225
|
+
object: {
|
|
226
|
+
keyword: 'object';
|
|
227
|
+
args: {
|
|
228
|
+
properties: {
|
|
229
|
+
[x: string]: Schema[];
|
|
230
|
+
};
|
|
231
|
+
additionalProperties: Schema[];
|
|
232
|
+
patternProperties?: Record<string, Schema[]>;
|
|
233
|
+
strict?: boolean;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
url: {
|
|
237
|
+
keyword: 'url';
|
|
238
|
+
};
|
|
239
|
+
readOnly: {
|
|
240
|
+
keyword: 'readOnly';
|
|
241
|
+
};
|
|
242
|
+
writeOnly: {
|
|
243
|
+
keyword: 'writeOnly';
|
|
244
|
+
};
|
|
245
|
+
uuid: {
|
|
246
|
+
keyword: 'uuid';
|
|
247
|
+
};
|
|
248
|
+
email: {
|
|
249
|
+
keyword: 'email';
|
|
250
|
+
};
|
|
251
|
+
firstName: {
|
|
252
|
+
keyword: 'firstName';
|
|
253
|
+
};
|
|
254
|
+
lastName: {
|
|
255
|
+
keyword: 'lastName';
|
|
256
|
+
};
|
|
257
|
+
phone: {
|
|
258
|
+
keyword: 'phone';
|
|
259
|
+
};
|
|
260
|
+
password: {
|
|
261
|
+
keyword: 'password';
|
|
262
|
+
};
|
|
263
|
+
date: {
|
|
264
|
+
keyword: 'date';
|
|
265
|
+
args: {
|
|
266
|
+
type?: 'date' | 'string';
|
|
267
|
+
};
|
|
268
|
+
};
|
|
269
|
+
time: {
|
|
270
|
+
keyword: 'time';
|
|
271
|
+
args: {
|
|
272
|
+
type?: 'date' | 'string';
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
datetime: {
|
|
276
|
+
keyword: 'datetime';
|
|
277
|
+
args: {
|
|
278
|
+
offset?: boolean;
|
|
279
|
+
local?: boolean;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
tuple: {
|
|
283
|
+
keyword: 'tuple';
|
|
284
|
+
args: {
|
|
285
|
+
items: Schema[];
|
|
286
|
+
min?: number;
|
|
287
|
+
max?: number;
|
|
288
|
+
rest?: Schema;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
array: {
|
|
292
|
+
keyword: 'array';
|
|
293
|
+
args: {
|
|
294
|
+
items: Schema[];
|
|
295
|
+
min?: number;
|
|
296
|
+
max?: number;
|
|
297
|
+
unique?: boolean;
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
enum: {
|
|
301
|
+
keyword: 'enum';
|
|
302
|
+
args: {
|
|
303
|
+
name: string;
|
|
304
|
+
typeName: string;
|
|
305
|
+
asConst: boolean;
|
|
306
|
+
items: Array<{
|
|
307
|
+
name: string | number;
|
|
308
|
+
format: 'string' | 'number' | 'boolean';
|
|
309
|
+
value?: string | number | boolean;
|
|
310
|
+
}>;
|
|
311
|
+
};
|
|
312
|
+
};
|
|
313
|
+
and: {
|
|
314
|
+
keyword: 'and';
|
|
315
|
+
args: Schema[];
|
|
316
|
+
};
|
|
317
|
+
const: {
|
|
318
|
+
keyword: 'const';
|
|
319
|
+
args: {
|
|
320
|
+
name: string | number;
|
|
321
|
+
format: 'string' | 'number' | 'boolean';
|
|
322
|
+
value?: string | number | boolean;
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
union: {
|
|
326
|
+
keyword: 'union';
|
|
327
|
+
args: Schema[];
|
|
328
|
+
};
|
|
329
|
+
ref: {
|
|
330
|
+
keyword: 'ref';
|
|
331
|
+
args: {
|
|
332
|
+
name: string;
|
|
333
|
+
$ref: string;
|
|
334
|
+
/**
|
|
335
|
+
* Full qualified path.
|
|
336
|
+
*/
|
|
337
|
+
path: KubbFile.Path;
|
|
338
|
+
/**
|
|
339
|
+
* When true `File.Import` is used.
|
|
340
|
+
* When false a reference is used inside the current file.
|
|
341
|
+
*/
|
|
342
|
+
isImportable: boolean;
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
matches: {
|
|
346
|
+
keyword: 'matches';
|
|
347
|
+
args?: string;
|
|
348
|
+
};
|
|
349
|
+
boolean: {
|
|
350
|
+
keyword: 'boolean';
|
|
351
|
+
};
|
|
352
|
+
default: {
|
|
353
|
+
keyword: 'default';
|
|
354
|
+
args: string | number | boolean;
|
|
355
|
+
};
|
|
356
|
+
string: {
|
|
357
|
+
keyword: 'string';
|
|
358
|
+
};
|
|
359
|
+
integer: {
|
|
360
|
+
keyword: 'integer';
|
|
361
|
+
};
|
|
362
|
+
number: {
|
|
363
|
+
keyword: 'number';
|
|
364
|
+
};
|
|
365
|
+
max: {
|
|
366
|
+
keyword: 'max';
|
|
367
|
+
args: number;
|
|
368
|
+
};
|
|
369
|
+
min: {
|
|
370
|
+
keyword: 'min';
|
|
371
|
+
args: number;
|
|
372
|
+
};
|
|
373
|
+
exclusiveMaximum: {
|
|
374
|
+
keyword: 'exclusiveMaximum';
|
|
375
|
+
args: number;
|
|
376
|
+
};
|
|
377
|
+
exclusiveMinimum: {
|
|
378
|
+
keyword: 'exclusiveMinimum';
|
|
379
|
+
args: number;
|
|
380
|
+
};
|
|
381
|
+
describe: {
|
|
382
|
+
keyword: 'describe';
|
|
383
|
+
args: string;
|
|
384
|
+
};
|
|
385
|
+
example: {
|
|
386
|
+
keyword: 'example';
|
|
387
|
+
args: string;
|
|
388
|
+
};
|
|
389
|
+
deprecated: {
|
|
390
|
+
keyword: 'deprecated';
|
|
391
|
+
};
|
|
392
|
+
optional: {
|
|
393
|
+
keyword: 'optional';
|
|
394
|
+
};
|
|
395
|
+
undefined: {
|
|
396
|
+
keyword: 'undefined';
|
|
397
|
+
};
|
|
398
|
+
nullish: {
|
|
399
|
+
keyword: 'nullish';
|
|
400
|
+
};
|
|
401
|
+
nullable: {
|
|
402
|
+
keyword: 'nullable';
|
|
403
|
+
};
|
|
404
|
+
null: {
|
|
405
|
+
keyword: 'null';
|
|
406
|
+
};
|
|
407
|
+
any: {
|
|
408
|
+
keyword: 'any';
|
|
409
|
+
};
|
|
410
|
+
unknown: {
|
|
411
|
+
keyword: 'unknown';
|
|
412
|
+
};
|
|
413
|
+
void: {
|
|
414
|
+
keyword: 'void';
|
|
415
|
+
};
|
|
416
|
+
blob: {
|
|
417
|
+
keyword: 'blob';
|
|
418
|
+
};
|
|
419
|
+
schema: {
|
|
420
|
+
keyword: 'schema';
|
|
421
|
+
args: {
|
|
422
|
+
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
423
|
+
format?: string;
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
name: {
|
|
427
|
+
keyword: 'name';
|
|
428
|
+
args: string;
|
|
429
|
+
};
|
|
430
|
+
catchall: {
|
|
431
|
+
keyword: 'catchall';
|
|
432
|
+
};
|
|
433
|
+
interface: {
|
|
434
|
+
keyword: 'interface';
|
|
435
|
+
};
|
|
436
|
+
};
|
|
437
|
+
type Schema = {
|
|
438
|
+
keyword: string;
|
|
439
|
+
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
442
|
+
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
443
|
+
fabric: Fabric;
|
|
444
|
+
oas: Oas;
|
|
445
|
+
pluginManager: PluginManager;
|
|
446
|
+
events?: AsyncEventEmitter<KubbEvents>;
|
|
447
|
+
/**
|
|
448
|
+
* Current plugin
|
|
449
|
+
*/
|
|
450
|
+
plugin: Plugin<TPluginOptions>;
|
|
451
|
+
mode: KubbFile.Mode;
|
|
452
|
+
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
453
|
+
override: Array<Override<TOptions>> | undefined;
|
|
454
|
+
contentType?: contentType;
|
|
455
|
+
output?: string;
|
|
456
|
+
};
|
|
457
|
+
type SchemaGeneratorOptions = {
|
|
458
|
+
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
459
|
+
unknownType: 'any' | 'unknown' | 'void';
|
|
460
|
+
emptySchemaType: 'any' | 'unknown' | 'void';
|
|
461
|
+
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
|
|
462
|
+
enumSuffix?: string;
|
|
463
|
+
/**
|
|
464
|
+
* @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
|
|
465
|
+
* When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
|
|
466
|
+
* @internal
|
|
467
|
+
*/
|
|
468
|
+
usedEnumNames?: Record<string, number>;
|
|
469
|
+
mapper?: Record<string, string>;
|
|
470
|
+
typed?: boolean;
|
|
471
|
+
transformers: {
|
|
472
|
+
/**
|
|
473
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
474
|
+
*/
|
|
475
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
476
|
+
/**
|
|
477
|
+
* Receive schema and name(propertyName) and return FakerMeta array
|
|
478
|
+
* TODO TODO add docs
|
|
479
|
+
* @beta
|
|
480
|
+
*/
|
|
481
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
|
|
482
|
+
};
|
|
483
|
+
};
|
|
484
|
+
type SchemaProps$1 = {
|
|
485
|
+
schema: SchemaObject$1 | null;
|
|
486
|
+
name: string | null;
|
|
487
|
+
parentName: string | null;
|
|
488
|
+
rootName?: string | null;
|
|
489
|
+
};
|
|
490
|
+
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
491
|
+
#private;
|
|
492
|
+
refs: Refs;
|
|
493
|
+
/**
|
|
494
|
+
* Creates a type node from a given schema.
|
|
495
|
+
* Delegates to getBaseTypeFromSchema internally and
|
|
496
|
+
* optionally adds a union with null.
|
|
497
|
+
*/
|
|
498
|
+
parse(props: SchemaProps$1): Schema[];
|
|
499
|
+
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
500
|
+
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
501
|
+
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
502
|
+
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
503
|
+
}
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
506
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
507
|
+
name: string;
|
|
508
|
+
type: 'react';
|
|
509
|
+
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
510
|
+
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
511
|
+
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
512
|
+
};
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region ../plugin-oas/src/generators/types.d.ts
|
|
515
|
+
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
516
|
+
config: Config;
|
|
517
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
518
|
+
plugin: Plugin<TOptions>;
|
|
519
|
+
operations: Array<Operation$1>;
|
|
520
|
+
};
|
|
521
|
+
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
522
|
+
config: Config;
|
|
523
|
+
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
524
|
+
plugin: Plugin<TOptions>;
|
|
525
|
+
operation: Operation$1;
|
|
526
|
+
};
|
|
527
|
+
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
528
|
+
config: Config;
|
|
529
|
+
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
530
|
+
plugin: Plugin<TOptions>;
|
|
531
|
+
schema: {
|
|
532
|
+
name: string;
|
|
533
|
+
tree: Array<Schema>;
|
|
534
|
+
value: SchemaObject$1;
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
540
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
541
|
+
name: string;
|
|
542
|
+
type: 'core';
|
|
543
|
+
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
544
|
+
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
545
|
+
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
546
|
+
};
|
|
547
|
+
//#endregion
|
|
548
|
+
export { OperationSchemas as a, Oas as c, Include as i, contentType as l, ReactGenerator as n, Override as o, Exclude$1 as r, ResolvePathOptions as s, Generator as t, __name as u };
|
|
549
|
+
//# sourceMappingURL=index-RsNfvceH.d.cts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_Server = require('./Server-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
const require_Server = require('./Server-9nmuwHl0.cjs');
|
|
2
|
+
const require_generators = require('./generators-DOGoAPGT.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_Server.__toESM(node_path);
|
|
5
5
|
let _kubb_core = require("@kubb/core");
|
|
@@ -16,7 +16,7 @@ const pluginMcp = (0, _kubb_core.definePlugin)((options) => {
|
|
|
16
16
|
const { output = {
|
|
17
17
|
path: "mcp",
|
|
18
18
|
barrelType: "named"
|
|
19
|
-
}, group, exclude = [], include, override = [], transformers = {}, generators = [require_generators.mcpGenerator, require_generators.serverGenerator].filter(Boolean), contentType, client } = options;
|
|
19
|
+
}, group, exclude = [], include, override = [], transformers = {}, generators = [require_generators.mcpGenerator, require_generators.serverGenerator].filter(Boolean), contentType, paramsCasing, client } = options;
|
|
20
20
|
const clientName = client?.client ?? "axios";
|
|
21
21
|
const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
|
|
22
22
|
return {
|
|
@@ -24,6 +24,7 @@ const pluginMcp = (0, _kubb_core.definePlugin)((options) => {
|
|
|
24
24
|
options: {
|
|
25
25
|
output,
|
|
26
26
|
group,
|
|
27
|
+
paramsCasing,
|
|
27
28
|
client: {
|
|
28
29
|
client: clientName,
|
|
29
30
|
clientType: client?.clientType ?? "function",
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,gBAAgB;AAE7B,MAAa,0CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,iCAAcC,mCAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;I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AC,KAAK,cAAc,eAAe,CAACE,qCAAiB,CAAC;AAE/E,OAAI,KAAK,OAAO,QAAQ,OAAO,UAAU,CAAC,mBAAmB,CAAC,KAAK,OAAO,QAAQ,OAAO,WAEvF,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMF,kBAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,iDACE,KAAK,OAAO,QAAQ,OAAO,WAAW,UAAU,gDAAgD,8CACjG,CAAC;KACF,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;AAGJ,OAAI,CAAC,gBACH,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMA,kBAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,iDAA2B,uCAAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAIG,oCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,qCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n paramsCasing,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n paramsCasing,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,gBAAgB;AAE7B,MAAa,0CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,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,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as PluginMcp, t as Options } from "./types-
|
|
1
|
+
import { u as __name } from "./index-RsNfvceH.cjs";
|
|
2
|
+
import { n as PluginMcp, t as Options } from "./types-Bw-588-z.cjs";
|
|
3
|
+
import * as _kubb_core0 from "@kubb/core";
|
|
3
4
|
|
|
4
5
|
//#region src/plugin.d.ts
|
|
5
6
|
declare const pluginMcpName = "plugin-mcp";
|
|
6
|
-
declare const pluginMcp: (options?: Options | undefined) => UserPluginWithLifeCycle<PluginMcp>;
|
|
7
|
+
declare const pluginMcp: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginMcp>;
|
|
7
8
|
//#endregion
|
|
8
9
|
export { type PluginMcp, pluginMcp, pluginMcpName };
|
|
9
10
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import
|
|
3
|
-
import { n as PluginMcp, t as Options } from "./types-
|
|
2
|
+
import "./index-DNBGPN7Z.js";
|
|
3
|
+
import { n as PluginMcp, t as Options } from "./types-BtFvu11q.js";
|
|
4
|
+
import * as _kubb_core0 from "@kubb/core";
|
|
4
5
|
|
|
5
6
|
//#region src/plugin.d.ts
|
|
6
7
|
declare const pluginMcpName = "plugin-mcp";
|
|
7
|
-
declare const pluginMcp: (options?: Options | undefined) => UserPluginWithLifeCycle<PluginMcp>;
|
|
8
|
+
declare const pluginMcp: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginMcp>;
|
|
8
9
|
//#endregion
|
|
9
10
|
export { type PluginMcp, pluginMcp, pluginMcpName };
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-eQyhnF5A.js";
|
|
2
|
-
import { n as mcpGenerator, t as serverGenerator } from "./generators-
|
|
2
|
+
import { n as mcpGenerator, t as serverGenerator } from "./generators-CrC1R2wh.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
5
|
import { camelCase } from "@kubb/core/transformers";
|
|
@@ -15,7 +15,7 @@ const pluginMcp = definePlugin((options) => {
|
|
|
15
15
|
const { output = {
|
|
16
16
|
path: "mcp",
|
|
17
17
|
barrelType: "named"
|
|
18
|
-
}, group, exclude = [], include, override = [], transformers = {}, generators = [mcpGenerator, serverGenerator].filter(Boolean), contentType, client } = options;
|
|
18
|
+
}, group, exclude = [], include, override = [], transformers = {}, generators = [mcpGenerator, serverGenerator].filter(Boolean), contentType, paramsCasing, client } = options;
|
|
19
19
|
const clientName = client?.client ?? "axios";
|
|
20
20
|
const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
|
|
21
21
|
return {
|
|
@@ -23,6 +23,7 @@ const pluginMcp = definePlugin((options) => {
|
|
|
23
23
|
options: {
|
|
24
24
|
output,
|
|
25
25
|
group,
|
|
26
|
+
paramsCasing,
|
|
26
27
|
client: {
|
|
27
28
|
client: clientName,
|
|
28
29
|
clientType: client?.clientType ?? "function",
|