@kubb/plugin-mcp 3.16.1 → 3.16.3
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/OperationGenerator-BMJ9Szu5.d.cts +1111 -0
- package/dist/OperationGenerator-D1X1O_-A.d.ts +1111 -0
- package/dist/Server-BX80OVzu.js +90 -0
- package/dist/Server-BX80OVzu.js.map +1 -0
- package/dist/Server-Bh-nULhJ.cjs +124 -0
- package/dist/Server-Bh-nULhJ.cjs.map +1 -0
- package/dist/components.cjs +2 -11
- package/dist/components.d.cts +31 -25
- package/dist/components.d.ts +31 -25
- package/dist/components.js +3 -3
- package/dist/generators-CFdUB1k-.js +225 -0
- package/dist/generators-CFdUB1k-.js.map +1 -0
- package/dist/generators-UZiEnnoX.cjs +236 -0
- package/dist/generators-UZiEnnoX.cjs.map +1 -0
- package/dist/generators.cjs +4 -16
- package/dist/generators.d.cts +9 -9
- package/dist/generators.d.ts +9 -9
- package/dist/generators.js +4 -4
- package/dist/index.cjs +82 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -8
- package/dist/index.d.ts +7 -8
- package/dist/index.js +82 -95
- package/dist/index.js.map +1 -1
- package/dist/types-DLgrsgaK.d.ts +168 -0
- package/dist/types-Dg5mHzgC.d.cts +168 -0
- package/package.json +21 -36
- package/dist/chunk-JTYWPGT3.js +0 -178
- package/dist/chunk-JTYWPGT3.js.map +0 -1
- package/dist/chunk-MTZE6GGJ.cjs +0 -181
- package/dist/chunk-MTZE6GGJ.cjs.map +0 -1
- package/dist/chunk-ODMTYF4L.cjs +0 -97
- package/dist/chunk-ODMTYF4L.cjs.map +0 -1
- package/dist/chunk-YP4TIQ5F.js +0 -95
- package/dist/chunk-YP4TIQ5F.js.map +0 -1
- package/dist/components.cjs.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/generators.cjs.map +0 -1
- package/dist/generators.js.map +0 -1
- package/dist/types-B4DlUSkU.d.cts +0 -54
- package/dist/types-B4DlUSkU.d.ts +0 -54
package/dist/index.js
CHANGED
|
@@ -1,100 +1,87 @@
|
|
|
1
|
-
import { mcpGenerator, serverGenerator } from
|
|
2
|
-
import
|
|
3
|
-
import path from
|
|
4
|
-
import {
|
|
5
|
-
import { camelCase } from
|
|
6
|
-
import {
|
|
7
|
-
import { pluginTsName } from
|
|
8
|
-
import { pluginZodName } from
|
|
1
|
+
import { mcpGenerator, serverGenerator } from "./generators-CFdUB1k-.js";
|
|
2
|
+
import "./Server-BX80OVzu.js";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { FileManager, PluginManager, createPlugin } from "@kubb/core";
|
|
5
|
+
import { camelCase } from "@kubb/core/transformers";
|
|
6
|
+
import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
|
|
7
|
+
import { pluginTsName } from "@kubb/plugin-ts";
|
|
8
|
+
import { pluginZodName } from "@kubb/plugin-zod";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await this.addFile(...files);
|
|
84
|
-
const barrelFiles = await this.fileManager.getBarrelFiles({
|
|
85
|
-
type: output.barrelType ?? "named",
|
|
86
|
-
root,
|
|
87
|
-
output,
|
|
88
|
-
meta: {
|
|
89
|
-
pluginKey: this.plugin.key
|
|
90
|
-
},
|
|
91
|
-
logger: this.logger
|
|
92
|
-
});
|
|
93
|
-
await this.addFile(...barrelFiles);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
10
|
+
//#region src/plugin.ts
|
|
11
|
+
const pluginMcpName = "plugin-mcp";
|
|
12
|
+
const pluginMcp = createPlugin((options) => {
|
|
13
|
+
const { output = {
|
|
14
|
+
path: "mcp",
|
|
15
|
+
barrelType: "named"
|
|
16
|
+
}, group, exclude = [], include, override = [], transformers = {}, generators = [mcpGenerator, serverGenerator].filter(Boolean), contentType } = options;
|
|
17
|
+
return {
|
|
18
|
+
name: pluginMcpName,
|
|
19
|
+
options: {
|
|
20
|
+
output,
|
|
21
|
+
group,
|
|
22
|
+
client: {
|
|
23
|
+
importPath: "@kubb/plugin-client/clients/axios",
|
|
24
|
+
dataReturnType: "data",
|
|
25
|
+
...options.client
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
pre: [
|
|
29
|
+
pluginOasName,
|
|
30
|
+
pluginTsName,
|
|
31
|
+
pluginZodName
|
|
32
|
+
].filter(Boolean),
|
|
33
|
+
resolvePath(baseName, pathMode, options$1) {
|
|
34
|
+
const root = path.resolve(this.config.root, this.config.output.path);
|
|
35
|
+
const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
|
|
36
|
+
if (mode === "single")
|
|
37
|
+
/**
|
|
38
|
+
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
39
|
+
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
40
|
+
*/
|
|
41
|
+
return path.resolve(root, output.path);
|
|
42
|
+
if (group && (options$1?.group?.path || options$1?.group?.tag)) {
|
|
43
|
+
const groupName = group?.name ? group.name : (ctx) => {
|
|
44
|
+
if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
45
|
+
return `${camelCase(ctx.group)}Requests`;
|
|
46
|
+
};
|
|
47
|
+
return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options$1.group.path : options$1.group.tag }), baseName);
|
|
48
|
+
}
|
|
49
|
+
return path.resolve(root, output.path, baseName);
|
|
50
|
+
},
|
|
51
|
+
resolveName(name, type) {
|
|
52
|
+
const resolvedName = camelCase(name, { isFile: type === "file" });
|
|
53
|
+
if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
|
|
54
|
+
return resolvedName;
|
|
55
|
+
},
|
|
56
|
+
async buildStart() {
|
|
57
|
+
const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
|
|
58
|
+
const oas = await swaggerPlugin.context.getOas();
|
|
59
|
+
const root = path.resolve(this.config.root, this.config.output.path);
|
|
60
|
+
const mode = FileManager.getMode(path.resolve(root, output.path));
|
|
61
|
+
const operationGenerator = new OperationGenerator(this.plugin.options, {
|
|
62
|
+
oas,
|
|
63
|
+
pluginManager: this.pluginManager,
|
|
64
|
+
plugin: this.plugin,
|
|
65
|
+
contentType,
|
|
66
|
+
exclude,
|
|
67
|
+
include,
|
|
68
|
+
override,
|
|
69
|
+
mode
|
|
70
|
+
});
|
|
71
|
+
const files = await operationGenerator.build(...generators);
|
|
72
|
+
await this.addFile(...files);
|
|
73
|
+
const barrelFiles = await this.fileManager.getBarrelFiles({
|
|
74
|
+
type: output.barrelType ?? "named",
|
|
75
|
+
root,
|
|
76
|
+
output,
|
|
77
|
+
meta: { pluginKey: this.plugin.key },
|
|
78
|
+
logger: this.logger
|
|
79
|
+
});
|
|
80
|
+
await this.addFile(...barrelFiles);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
96
83
|
});
|
|
97
84
|
|
|
85
|
+
//#endregion
|
|
98
86
|
export { pluginMcp, pluginMcpName };
|
|
99
|
-
//# sourceMappingURL=index.js.map
|
|
100
87
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = createPlugin<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 } = options\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\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 ?? FileManager.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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAaA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,aAAwB,CAAC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;CAAS,GAC7C,OACA,UAAU,CAAE,GACZ,SACA,WAAW,CAAE,GACb,eAAe,CAAE,GACjB,aAAa,CAAC,cAAc,eAAgB,EAAC,OAAO,QAAQ,EAC5D,aACD,GAAG;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;GACZ;EACF;EACD,KAAK;GAAC;GAAe;GAAc;EAAc,EAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAUA,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,YAAY,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;AAE7E,OAAI,SAAS;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,OACN,CAAC,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC,IAAI;AAErC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC,QAAQ,CAAC;IACzC;AAEL,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,IACpE,EAAC,EACF,SACD;GACF;AAED,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;EACjD;EACD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM,EACnC,QAAQ,SAAS,OAClB,EAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;EACR;EACD,MAAM,aAAa;GACjB,MAAM,CAAC,cAA8C,GAAG,cAAc,mBAAyC,KAAK,SAAS,CAAC,aAAc,EAAC;GAE7I,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GAEjE,MAAM,qBAAqB,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;GACD;GAED,MAAM,QAAQ,MAAM,mBAAmB,MAAM,GAAG,WAAW;GAC3D,MAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,IACxB;IACD,QAAQ,KAAK;GACd,EAAC;GAEF,MAAM,KAAK,QAAQ,GAAG,YAAY;EACnC;CACF;AACF,EAAC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Exclude, Generator, Group, Include, Oas, Output, Override, PluginFactoryOptions, ResolveNameParams, ResolvePathOptions, contentType } from "./OperationGenerator-D1X1O_-A.js";
|
|
2
|
+
|
|
3
|
+
//#region ../plugin-client/src/types.d.ts
|
|
4
|
+
type Options$1 = {
|
|
5
|
+
/**
|
|
6
|
+
* Specify the export location for the files and define the behavior of the output
|
|
7
|
+
* @default { path: 'clients', barrelType: 'named' }
|
|
8
|
+
*/
|
|
9
|
+
output?: Output<Oas>;
|
|
10
|
+
/**
|
|
11
|
+
* Define which contentType should be used.
|
|
12
|
+
* By default, the first JSON valid mediaType will be used
|
|
13
|
+
*/
|
|
14
|
+
contentType?: contentType;
|
|
15
|
+
/**
|
|
16
|
+
* Group the clients based on the provided name.
|
|
17
|
+
*/
|
|
18
|
+
group?: Group;
|
|
19
|
+
/**
|
|
20
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
21
|
+
*/
|
|
22
|
+
exclude?: Array<Exclude>;
|
|
23
|
+
/**
|
|
24
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
25
|
+
*/
|
|
26
|
+
include?: Array<Include>;
|
|
27
|
+
/**
|
|
28
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
29
|
+
*/
|
|
30
|
+
override?: Array<Override<ResolvedOptions$1>>;
|
|
31
|
+
/**
|
|
32
|
+
* Create `operations.ts` file with all operations grouped by methods.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
operations?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Export urls that are used by operation x
|
|
38
|
+
* `export` will make them part of your barrel file
|
|
39
|
+
* false will not make them exportable
|
|
40
|
+
* @example getGetPetByIdUrl
|
|
41
|
+
*/
|
|
42
|
+
urlType?: 'export' | false;
|
|
43
|
+
/**
|
|
44
|
+
* Path to the client import path that will be used to do the API calls.
|
|
45
|
+
* It will be used as `import client from '${client.importPath}'`.
|
|
46
|
+
* It allows both relative and absolute path but be aware that we will not change the path.
|
|
47
|
+
* @default '@kubb/plugin-client/clients/axios'
|
|
48
|
+
*/
|
|
49
|
+
importPath?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Allows you to set a custom base url for all generated calls.
|
|
52
|
+
*/
|
|
53
|
+
baseURL?: string;
|
|
54
|
+
/**
|
|
55
|
+
* ReturnType that will be used when calling the client.
|
|
56
|
+
* - 'data' will return ResponseConfig[data].
|
|
57
|
+
* - 'full' will return ResponseConfig.
|
|
58
|
+
* @default 'data'
|
|
59
|
+
*/
|
|
60
|
+
dataReturnType?: 'data' | 'full';
|
|
61
|
+
/**
|
|
62
|
+
* How to style your params, by default no casing is applied
|
|
63
|
+
* - 'camelcase' will use camelcase for the params names
|
|
64
|
+
*/
|
|
65
|
+
paramsCasing?: 'camelcase';
|
|
66
|
+
/**
|
|
67
|
+
* How to pass your params
|
|
68
|
+
* - 'object' will return the params and pathParams as an object.
|
|
69
|
+
* - 'inline' will return the params as comma separated params.
|
|
70
|
+
* @default 'inline'
|
|
71
|
+
*/
|
|
72
|
+
paramsType?: 'object' | 'inline';
|
|
73
|
+
/**
|
|
74
|
+
* How to pass your pathParams.
|
|
75
|
+
* - 'object' will return the pathParams as an object.
|
|
76
|
+
* - 'inline' will return the pathParams as comma separated params.
|
|
77
|
+
* @default 'inline'
|
|
78
|
+
*/
|
|
79
|
+
pathParamsType?: 'object' | 'inline';
|
|
80
|
+
/**
|
|
81
|
+
* Which parser can be used before returning the data
|
|
82
|
+
* - 'zod' will use `@kubb/plugin-zod` to parse the data.
|
|
83
|
+
* @default 'client'
|
|
84
|
+
*/
|
|
85
|
+
parser?: 'client' | 'zod';
|
|
86
|
+
/**
|
|
87
|
+
* Which client should be used to do the HTTP calls
|
|
88
|
+
* - 'axios' will use `@kubb/plugin-client/clients/axios` to fetch data.
|
|
89
|
+
* - 'fetch' will use `@kubb/plugin-client/clients/fetch` to fetch data.
|
|
90
|
+
* @default 'axios'
|
|
91
|
+
*/
|
|
92
|
+
client?: 'axios' | 'fetch';
|
|
93
|
+
transformers?: {
|
|
94
|
+
/**
|
|
95
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
96
|
+
*/
|
|
97
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Define some generators next to the client generators
|
|
101
|
+
*/
|
|
102
|
+
generators?: Array<Generator<PluginClient>>;
|
|
103
|
+
};
|
|
104
|
+
type ResolvedOptions$1 = {
|
|
105
|
+
output: Output<Oas>;
|
|
106
|
+
group?: Options$1['group'];
|
|
107
|
+
baseURL: string | undefined;
|
|
108
|
+
parser: NonNullable<Options$1['parser']>;
|
|
109
|
+
urlType: NonNullable<Options$1['urlType']>;
|
|
110
|
+
importPath: NonNullable<Options$1['importPath']>;
|
|
111
|
+
dataReturnType: NonNullable<Options$1['dataReturnType']>;
|
|
112
|
+
pathParamsType: NonNullable<Options$1['pathParamsType']>;
|
|
113
|
+
paramsType: NonNullable<Options$1['paramsType']>;
|
|
114
|
+
paramsCasing: Options$1['paramsCasing'];
|
|
115
|
+
};
|
|
116
|
+
type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/types.d.ts
|
|
119
|
+
type Options = {
|
|
120
|
+
/**
|
|
121
|
+
* Specify the export location for the files and define the behavior of the output
|
|
122
|
+
* @default { path: 'mcp', barrelType: 'named' }
|
|
123
|
+
*/
|
|
124
|
+
output?: Output<Oas>;
|
|
125
|
+
/**
|
|
126
|
+
* Define which contentType should be used.
|
|
127
|
+
* By default, the first JSON valid mediaType will be used
|
|
128
|
+
*/
|
|
129
|
+
contentType?: contentType;
|
|
130
|
+
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
131
|
+
/**
|
|
132
|
+
* Group the mcp requests based on the provided name.
|
|
133
|
+
*/
|
|
134
|
+
group?: Group;
|
|
135
|
+
/**
|
|
136
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
137
|
+
*/
|
|
138
|
+
exclude?: Array<Exclude>;
|
|
139
|
+
/**
|
|
140
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
141
|
+
*/
|
|
142
|
+
include?: Array<Include>;
|
|
143
|
+
/**
|
|
144
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
145
|
+
*/
|
|
146
|
+
override?: Array<Override<ResolvedOptions>>;
|
|
147
|
+
transformers?: {
|
|
148
|
+
/**
|
|
149
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
150
|
+
*/
|
|
151
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Define some generators next to the Mcp generators.
|
|
155
|
+
*/
|
|
156
|
+
generators?: Array<Generator<PluginMcp>>;
|
|
157
|
+
};
|
|
158
|
+
type ResolvedOptions = {
|
|
159
|
+
output: Output<Oas>;
|
|
160
|
+
group: Options['group'];
|
|
161
|
+
client: Required<Omit<NonNullable<PluginMcp['options']['client']>, 'baseURL'>> & {
|
|
162
|
+
baseURL?: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
166
|
+
//#endregion
|
|
167
|
+
export { Options, PluginMcp };
|
|
168
|
+
//# sourceMappingURL=types-DLgrsgaK.d.ts.map
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { Exclude, Generator, Group, Include, Oas, Output, Override, PluginFactoryOptions, ResolveNameParams, ResolvePathOptions, contentType } from "./OperationGenerator-BMJ9Szu5.cjs";
|
|
2
|
+
|
|
3
|
+
//#region ../plugin-client/src/types.d.ts
|
|
4
|
+
type Options$1 = {
|
|
5
|
+
/**
|
|
6
|
+
* Specify the export location for the files and define the behavior of the output
|
|
7
|
+
* @default { path: 'clients', barrelType: 'named' }
|
|
8
|
+
*/
|
|
9
|
+
output?: Output<Oas>;
|
|
10
|
+
/**
|
|
11
|
+
* Define which contentType should be used.
|
|
12
|
+
* By default, the first JSON valid mediaType will be used
|
|
13
|
+
*/
|
|
14
|
+
contentType?: contentType;
|
|
15
|
+
/**
|
|
16
|
+
* Group the clients based on the provided name.
|
|
17
|
+
*/
|
|
18
|
+
group?: Group;
|
|
19
|
+
/**
|
|
20
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
21
|
+
*/
|
|
22
|
+
exclude?: Array<Exclude>;
|
|
23
|
+
/**
|
|
24
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
25
|
+
*/
|
|
26
|
+
include?: Array<Include>;
|
|
27
|
+
/**
|
|
28
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
29
|
+
*/
|
|
30
|
+
override?: Array<Override<ResolvedOptions$1>>;
|
|
31
|
+
/**
|
|
32
|
+
* Create `operations.ts` file with all operations grouped by methods.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
operations?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Export urls that are used by operation x
|
|
38
|
+
* `export` will make them part of your barrel file
|
|
39
|
+
* false will not make them exportable
|
|
40
|
+
* @example getGetPetByIdUrl
|
|
41
|
+
*/
|
|
42
|
+
urlType?: 'export' | false;
|
|
43
|
+
/**
|
|
44
|
+
* Path to the client import path that will be used to do the API calls.
|
|
45
|
+
* It will be used as `import client from '${client.importPath}'`.
|
|
46
|
+
* It allows both relative and absolute path but be aware that we will not change the path.
|
|
47
|
+
* @default '@kubb/plugin-client/clients/axios'
|
|
48
|
+
*/
|
|
49
|
+
importPath?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Allows you to set a custom base url for all generated calls.
|
|
52
|
+
*/
|
|
53
|
+
baseURL?: string;
|
|
54
|
+
/**
|
|
55
|
+
* ReturnType that will be used when calling the client.
|
|
56
|
+
* - 'data' will return ResponseConfig[data].
|
|
57
|
+
* - 'full' will return ResponseConfig.
|
|
58
|
+
* @default 'data'
|
|
59
|
+
*/
|
|
60
|
+
dataReturnType?: 'data' | 'full';
|
|
61
|
+
/**
|
|
62
|
+
* How to style your params, by default no casing is applied
|
|
63
|
+
* - 'camelcase' will use camelcase for the params names
|
|
64
|
+
*/
|
|
65
|
+
paramsCasing?: 'camelcase';
|
|
66
|
+
/**
|
|
67
|
+
* How to pass your params
|
|
68
|
+
* - 'object' will return the params and pathParams as an object.
|
|
69
|
+
* - 'inline' will return the params as comma separated params.
|
|
70
|
+
* @default 'inline'
|
|
71
|
+
*/
|
|
72
|
+
paramsType?: 'object' | 'inline';
|
|
73
|
+
/**
|
|
74
|
+
* How to pass your pathParams.
|
|
75
|
+
* - 'object' will return the pathParams as an object.
|
|
76
|
+
* - 'inline' will return the pathParams as comma separated params.
|
|
77
|
+
* @default 'inline'
|
|
78
|
+
*/
|
|
79
|
+
pathParamsType?: 'object' | 'inline';
|
|
80
|
+
/**
|
|
81
|
+
* Which parser can be used before returning the data
|
|
82
|
+
* - 'zod' will use `@kubb/plugin-zod` to parse the data.
|
|
83
|
+
* @default 'client'
|
|
84
|
+
*/
|
|
85
|
+
parser?: 'client' | 'zod';
|
|
86
|
+
/**
|
|
87
|
+
* Which client should be used to do the HTTP calls
|
|
88
|
+
* - 'axios' will use `@kubb/plugin-client/clients/axios` to fetch data.
|
|
89
|
+
* - 'fetch' will use `@kubb/plugin-client/clients/fetch` to fetch data.
|
|
90
|
+
* @default 'axios'
|
|
91
|
+
*/
|
|
92
|
+
client?: 'axios' | 'fetch';
|
|
93
|
+
transformers?: {
|
|
94
|
+
/**
|
|
95
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
96
|
+
*/
|
|
97
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Define some generators next to the client generators
|
|
101
|
+
*/
|
|
102
|
+
generators?: Array<Generator<PluginClient>>;
|
|
103
|
+
};
|
|
104
|
+
type ResolvedOptions$1 = {
|
|
105
|
+
output: Output<Oas>;
|
|
106
|
+
group?: Options$1['group'];
|
|
107
|
+
baseURL: string | undefined;
|
|
108
|
+
parser: NonNullable<Options$1['parser']>;
|
|
109
|
+
urlType: NonNullable<Options$1['urlType']>;
|
|
110
|
+
importPath: NonNullable<Options$1['importPath']>;
|
|
111
|
+
dataReturnType: NonNullable<Options$1['dataReturnType']>;
|
|
112
|
+
pathParamsType: NonNullable<Options$1['pathParamsType']>;
|
|
113
|
+
paramsType: NonNullable<Options$1['paramsType']>;
|
|
114
|
+
paramsCasing: Options$1['paramsCasing'];
|
|
115
|
+
};
|
|
116
|
+
type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/types.d.ts
|
|
119
|
+
type Options = {
|
|
120
|
+
/**
|
|
121
|
+
* Specify the export location for the files and define the behavior of the output
|
|
122
|
+
* @default { path: 'mcp', barrelType: 'named' }
|
|
123
|
+
*/
|
|
124
|
+
output?: Output<Oas>;
|
|
125
|
+
/**
|
|
126
|
+
* Define which contentType should be used.
|
|
127
|
+
* By default, the first JSON valid mediaType will be used
|
|
128
|
+
*/
|
|
129
|
+
contentType?: contentType;
|
|
130
|
+
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>;
|
|
131
|
+
/**
|
|
132
|
+
* Group the mcp requests based on the provided name.
|
|
133
|
+
*/
|
|
134
|
+
group?: Group;
|
|
135
|
+
/**
|
|
136
|
+
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
137
|
+
*/
|
|
138
|
+
exclude?: Array<Exclude>;
|
|
139
|
+
/**
|
|
140
|
+
* Array containing include parameters to include tags/operations/methods/paths.
|
|
141
|
+
*/
|
|
142
|
+
include?: Array<Include>;
|
|
143
|
+
/**
|
|
144
|
+
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
145
|
+
*/
|
|
146
|
+
override?: Array<Override<ResolvedOptions>>;
|
|
147
|
+
transformers?: {
|
|
148
|
+
/**
|
|
149
|
+
* Customize the names based on the type that is provided by the plugin.
|
|
150
|
+
*/
|
|
151
|
+
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Define some generators next to the Mcp generators.
|
|
155
|
+
*/
|
|
156
|
+
generators?: Array<Generator<PluginMcp>>;
|
|
157
|
+
};
|
|
158
|
+
type ResolvedOptions = {
|
|
159
|
+
output: Output<Oas>;
|
|
160
|
+
group: Options['group'];
|
|
161
|
+
client: Required<Omit<NonNullable<PluginMcp['options']['client']>, 'baseURL'>> & {
|
|
162
|
+
baseURL?: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
166
|
+
//#endregion
|
|
167
|
+
export { Options, PluginMcp };
|
|
168
|
+
//# sourceMappingURL=types-Dg5mHzgC.d.cts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-mcp",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.3",
|
|
4
4
|
"description": "Generator mcp",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -24,35 +24,21 @@
|
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
26
|
"import": "./dist/index.js",
|
|
27
|
-
"require": "./dist/index.cjs"
|
|
28
|
-
"default": "./dist/index.cjs"
|
|
29
|
-
},
|
|
30
|
-
"./utils": {
|
|
31
|
-
"import": "./dist/utils.js",
|
|
32
|
-
"require": "./dist/utils.cjs",
|
|
33
|
-
"default": "./dist/utils.cjs"
|
|
34
|
-
},
|
|
35
|
-
"./hooks": {
|
|
36
|
-
"import": "./dist/hooks.js",
|
|
37
|
-
"require": "./dist/hooks.cjs",
|
|
38
|
-
"default": "./dist/hooks.cjs"
|
|
27
|
+
"require": "./dist/index.cjs"
|
|
39
28
|
},
|
|
40
29
|
"./components": {
|
|
41
30
|
"import": "./dist/components.js",
|
|
42
|
-
"require": "./dist/components.cjs"
|
|
43
|
-
"default": "./dist/components.cjs"
|
|
31
|
+
"require": "./dist/components.cjs"
|
|
44
32
|
},
|
|
45
33
|
"./generators": {
|
|
46
34
|
"import": "./dist/generators.js",
|
|
47
|
-
"require": "./dist/generators.cjs"
|
|
48
|
-
"default": "./dist/generators.cjs"
|
|
35
|
+
"require": "./dist/generators.cjs"
|
|
49
36
|
},
|
|
50
|
-
"./package.json": "./package.json"
|
|
51
|
-
"./*": "./*"
|
|
37
|
+
"./package.json": "./package.json"
|
|
52
38
|
},
|
|
53
|
-
"main": "dist/index.cjs",
|
|
54
|
-
"module": "dist/index.js",
|
|
55
|
-
"types": "./dist/index.d.
|
|
39
|
+
"main": "./dist/index.cjs",
|
|
40
|
+
"module": "./dist/index.js",
|
|
41
|
+
"types": "./dist/index.d.cts",
|
|
56
42
|
"typesVersions": {
|
|
57
43
|
"*": {
|
|
58
44
|
"utils": [
|
|
@@ -76,21 +62,20 @@
|
|
|
76
62
|
"!/**/__tests__/**"
|
|
77
63
|
],
|
|
78
64
|
"dependencies": {
|
|
79
|
-
"@kubb/core": "3.16.
|
|
80
|
-
"@kubb/
|
|
81
|
-
"@kubb/plugin-
|
|
82
|
-
"@kubb/oas": "3.16.
|
|
83
|
-
"@kubb/plugin-ts": "3.16.
|
|
84
|
-
"@kubb/plugin-zod": "3.16.
|
|
85
|
-
"@kubb/react": "3.16.
|
|
65
|
+
"@kubb/core": "3.16.3",
|
|
66
|
+
"@kubb/oas": "3.16.3",
|
|
67
|
+
"@kubb/plugin-client": "3.16.3",
|
|
68
|
+
"@kubb/plugin-oas": "3.16.3",
|
|
69
|
+
"@kubb/plugin-ts": "3.16.3",
|
|
70
|
+
"@kubb/plugin-zod": "3.16.3",
|
|
71
|
+
"@kubb/react": "3.16.3"
|
|
86
72
|
},
|
|
87
73
|
"devDependencies": {
|
|
88
74
|
"@types/react": "^18.3.23",
|
|
89
75
|
"react": "^18.3.1",
|
|
90
|
-
"
|
|
91
|
-
"typescript": "^5.
|
|
92
|
-
"@kubb/config-ts": "3.16.
|
|
93
|
-
"@kubb/config-tsup": "3.16.1"
|
|
76
|
+
"tsdown": "^0.14.1",
|
|
77
|
+
"typescript": "^5.9.2",
|
|
78
|
+
"@kubb/config-ts": "3.16.3"
|
|
94
79
|
},
|
|
95
80
|
"peerDependencies": {
|
|
96
81
|
"@kubb/react": "^3.0.0"
|
|
@@ -103,13 +88,13 @@
|
|
|
103
88
|
"registry": "https://registry.npmjs.org/"
|
|
104
89
|
},
|
|
105
90
|
"scripts": {
|
|
106
|
-
"build": "
|
|
91
|
+
"build": "tsdown",
|
|
107
92
|
"clean": "npx rimraf ./dist",
|
|
108
93
|
"lint": "bun biome lint .",
|
|
109
|
-
"lint:fix": "bun biome lint--fix --unsafe .",
|
|
94
|
+
"lint:fix": "bun biome lint --fix --unsafe .",
|
|
110
95
|
"release": "pnpm publish --no-git-check",
|
|
111
96
|
"release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
|
|
112
|
-
"start": "
|
|
97
|
+
"start": "tsdown --watch",
|
|
113
98
|
"test": "vitest --passWithNoTests",
|
|
114
99
|
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
|
|
115
100
|
}
|