@kubb/plugin-mcp
Version:
Generator mcp
186 lines (185 loc) • 6.41 kB
TypeScript
import { t as __name } from "./chunk-eQyhnF5A.js";
import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-D9FArzes.js";
//#region ../plugin-client/src/types.d.ts
type Options$1 = {
/**
* Specify the export location for the files and define the behavior of the output
* @default { path: 'clients', barrelType: 'named' }
*/
output?: Output<Oas>;
/**
* Define which contentType should be used.
* By default, the first JSON valid mediaType is used
*/
contentType?: contentType;
/**
* Group the clients based on the provided name.
*/
group?: Group;
/**
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
*/
exclude?: Array<Exclude>;
/**
* Array containing include parameters to include tags/operations/methods/paths.
*/
include?: Array<Include>;
/**
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
*/
override?: Array<Override<ResolvedOptions$1>>;
/**
* Create `operations.ts` file with all operations grouped by methods.
* @default false
*/
operations?: boolean;
/**
* Export urls that are used by operation x.
* - 'export' makes them part of your barrel file.
* - false does not make them exportable.
* @default false
* @example getGetPetByIdUrl
*/
urlType?: 'export' | false;
/**
* Client import path for API calls.
* Used as `import client from '${client.importPath}'`.
* Accepts relative and absolute paths; path changes are not performed.
*/
importPath?: string;
/**
* Allows you to set a custom base url for all generated calls.
*/
baseURL?: string;
/**
* ReturnType that is used when calling the client.
* - 'data' returns ResponseConfig[data].
* - 'full' returns ResponseConfig.
* @default 'data'
*/
dataReturnType?: 'data' | 'full';
/**
* How to style your params, by default no casing is applied
* - 'camelcase' uses camelcase for the params names
*/
paramsCasing?: 'camelcase';
/**
* How to pass your params.
* - 'object' returns the params and pathParams as an object.
* - 'inline' returns the params as comma separated params.
* @default 'inline'
*/
paramsType?: 'object' | 'inline';
/**
* How to pass your pathParams.
* - 'object' returns the pathParams as an object.
* - 'inline' returns the pathParams as comma separated params.
* @default 'inline'
*/
pathParamsType?: 'object' | 'inline';
/**
* Which parser can be used before returning the data.
* - 'client' returns the data as-is from the client.
* - 'zod' uses @kubb/plugin-zod to parse the data.
* @default 'client'
*/
parser?: 'client' | 'zod';
/**
* Which client should be used to do the HTTP calls.
* - 'axios' uses axios client for HTTP requests.
* - 'fetch' uses native fetch API for HTTP requests.
* @default 'axios'
*/
client?: 'axios' | 'fetch';
/**
* How to generate the client code.
* - 'function' generates standalone functions for each operation.
* - 'class' generates a class with methods for each operation.
* - 'staticClass' generates a class with static methods for each operation.
* @default 'function'
*/
clientType?: 'function' | 'class' | 'staticClass';
/**
* Bundle the selected client into the generated `.kubb` directory.
* When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
* @default false
* In version 5 of Kubb this is by default true
*/
bundle?: boolean;
transformers?: {
/**
* Customize the names based on the type that is provided by the plugin.
*/
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
};
/**
* Define some generators next to the client generators
*/
generators?: Array<Generator<PluginClient>>;
};
type ResolvedOptions$1 = {
output: Output<Oas>;
group?: Options$1['group'];
baseURL: string | undefined;
client: Options$1['client'];
clientType: NonNullable<Options$1['clientType']>;
bundle: NonNullable<Options$1['bundle']>;
parser: NonNullable<Options$1['parser']>;
urlType: NonNullable<Options$1['urlType']>;
importPath: Options$1['importPath'];
dataReturnType: NonNullable<Options$1['dataReturnType']>;
pathParamsType: NonNullable<Options$1['pathParamsType']>;
paramsType: NonNullable<Options$1['paramsType']>;
paramsCasing: Options$1['paramsCasing'];
};
type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
//#endregion
//#region src/types.d.ts
type Options = {
/**
* Specify the export location for the files and define the behavior of the output
* @default { path: 'mcp', barrelType: 'named' }
*/
output?: Output<Oas>;
/**
* Define which contentType should be used.
* By default, the first JSON valid mediaType is used
*/
contentType?: contentType;
client?: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle'>;
/**
* Group the mcp requests based on the provided name.
*/
group?: Group;
/**
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
*/
exclude?: Array<Exclude>;
/**
* Array containing include parameters to include tags/operations/methods/paths.
*/
include?: Array<Include>;
/**
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
*/
override?: Array<Override<ResolvedOptions>>;
transformers?: {
/**
* Customize the names based on the type that is provided by the plugin.
*/
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
};
/**
* Define some generators next to the Mcp generators.
*/
generators?: Array<Generator<PluginMcp>>;
};
type ResolvedOptions = {
output: Output<Oas>;
group: Options['group'];
client: NonNullable<PluginMcp['options']['client']>;
};
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
//#endregion
export { PluginMcp as n, Options as t };
//# sourceMappingURL=types-BpFIHuV_.d.ts.map